Unifi Apps SDK
1. Getting Started
Latest Version
- npm: https://www.npmjs.com/package/@linenext/dapp-portal-sdk/v/1.6.0
- cdn: https://static.kaiawallet.io/js/dapp-portal-sdk-1.6.0.js
How to get SDK Access(clientId & clientSecret)
To integrate Unifi Apps SDK, you need to receive a clientId and clientSecret from the Unifi team.
Steps:
- Submit Unifi Apps Application
- Please review and submit the Unifi Apps SDK Terms & Conditions as instructed.
- Receive your
clientIdandclientSecretvia the submitted email.
Never expose clientSecret publicly.
If it has been compromised, request regeneration via Tech Support.
Project Setup & Domain Registration
- Your
clientIdbecomes active only when a domain is registered.
- For testing purposes, you may use
http://localhost:3000. - For external test domains, please request whitelisting via Tech Support or email.
- For testing purposes, you may use
- Payments via
paymentProviderrequire a validclientSecret.
Install SDK
Install the SDK via npm, yarn, or pnpm
npm install @linenext/dapp-portal-sdk
# or
yarn add @linenext/dapp-portal-sdk
# or
pnpm add @linenext/dapp-portal-sdk
2. SDK Initialization
Initialize the SDK
You must initialize the SDK each time the Unifi Apps is loaded.
import DappPortalSDK from '@linenext/dapp-portal-sdk' const sdk = await DappPortalSDK.init({ clientId: '<CLIENT_ID>', chainId: '1001', // or '8217' for mainnet });
Parameters
| Name | Type | Description |
|---|---|---|
| clientId*required | string | the clientId provided when applying for the SDK |
| chainId | string | The default value is 1001(testnet). To use the mainnet after development, set the value to 8217(mainnet). |
Response
Returns a DappPortalSDK object through which the following methods can be called.
- Call
liff.init()before callingDappPortalSDK.init(). - Do not trigger wallet connection(
connectWallet) on LINE MINI App or LINE Login LIFF entry. Only connect when needed(e.g., item purchase, on-chain rewards). - This ensures accurate tracking of active users and attribution via LINE.
- Initialize the SDK only once and manage the
DappPortalSDKinstance as a singleton. - Avoid calling
DappPortalSDK.init()multiple times—it may cause unexpected behavior or malfunctions.
3. SDK API Reference
DappPortalSDK Class
Constructor
DappPortalSDK(config: DappPortalSDKClientConfig)
Initializes the SDK using your credentials.
clientId: string(Provided by the Unifi team)chainId: string("1001" for testnet, "8217" for mainnet)
Instance Methods
getWalletProvider(): WalletProvider
Returns EIP-1193-compatible wallet provider instance.
- This allows you to send transactions, sign messages, and interact with wallets.
getPaymentProvider(): PaymentProvider
Returns the object for managing payments and transaction history.
isSupportedBrowser(): boolean
Checks if the current browser is compatible.
showUnsupportedBrowserGuide(): Promise<void>
Displays a guide prompting the user to open in a supported browser.
4. Security Guidelines
- Keep
clientSecretconfidential. - Never commit it to source control.
- If exposed, rotate it immediately via Tech Support.