Initiate DappPortalSDK
Initiate SDK
1. Initialize SDK via init()
method
init()
method import DappPortalSDK from '@linenext/dapp-portal-sdk'
const sdk = await DappPortalSDK.init({ clientId: '<CLIENT_ID>', chainId: '1001 });
Parameters
clientId*required string
the clientId provided when applying for the SDK
chainId string
The default value is 8217 (mainnet). To use the testnet during development, set the value to 1001.
Response
Returns a DappPortalSDK
object through which the following methods can be called.
DappPortalSDK
getWalletProvider function
Initialize walletProvider
getPaymentProvider function
Initialize paymentProvider
isSupportedBrowser function
Returns true
if the current browser is supported; otherwise, returns false
.
We highly recommend executing DappPortalSDK.init() only once and managing it as a singleton object. If you create a new DappPortalSDK object by calling DappPortalSDK.init() every time you make a request to the wallet, it may lead to malfunction. The reason we do not enforce this as a singleton is to support scenarios where multi-configurations are needed. For example, if you want to use both testnet and mainnet in a single app. In such cases, we also recommend managing one singleton DappPortalSDK object for testnet and another singleton for mainnet.
Last updated