Configuration
The following parameters need to be configured when using @orderly.network/react
:
OrderlyAppProvider
All components within @orderly.network/react
needs to be used within OrderlyAppProvider
. This component provides global configuration for the App, and provides real-time state, data, and Account
management through @orderly.network/hooks
.
OrderlyAppProvider
has the following parameters:
appIcons
- Type: AppLogos
- Required: false
Customize your app’s icons, The AppLogos
type is defined as follows:
toastLimitCount
- Type:
number
- Required: false
The maximum number of toast notifications that are displayed concurrently.
includeTestnet
- Type:
boolean
- Required: false
Whether Testnet chains are included.
onChainChanged
- Type:
(chainId: string) => void
- Required: false
The callback function when the user switches between the mainnet and testnet will be invoked upon successful network switch. The function takes the switched network ID as a parameter.
If your app switches between testnet and mainnet, then you will have to do a full page reload for the Orderly SDK to work properly:
The following properties will be passed through to the OrderlyConfigProvider
component. For more information about the configuration of OrderlyConfigProvider
, please refer to the technical documentation.
brokerId
- Type:
string
- Required: true
broker id
networkId
- Type:
string
- Required: false
- Default:
mainnet
The network ID, possible values are mainnet
and testnet
.
configStore
keyStore
chainFilter
- Type:
filteredChains | filterChainsFunc
- API - Required:
false
- Default: all supported chains by Orderly Network
It is recommended to provide your own list of supported chains:
shareOptions
- Type:
DrawOptions
- API - Required: `true
The shareOptions
need to be set so that users can share their PnL as an image.
A preset of images can be found [in our example DEX]9https://github.com/OrderlyNetwork/js-sdk-demo/tree/main/public/images).
If custom images are provided, it might be necessary to change the placement of various text elements. Please check following example:
WalletConnectorContext
WalletConnectorContext
is a React Context used to provide wallet connection methods or data for the currently connected wallet in the app. It can be used as follows:
In the example code above, each property or method of the value
object must be implemented; otherwise, the entire app will be unable to connect to the wallet. If you find this process cumbersome or are starting a new project, it is recommended to use the @orderly.network/web3-onboard
library provided by Orderly. Please refer to this link for more information.
import ts from “typescript”