@linenext/dapp-portal-sdk v1.3.4
Dapp Portal SDK
Quick start
Create a Project
Prepare the provided clientId. The SDK operates only on pre-approved host addresses.
Install the SDK
Add the Dapp Portal SDK to your project by entering the following command:
npm install @linenext/dapp-portal-sdkor
yarn add @linenext/dapp-portal-sdkSign a Transaction
Initialize the SDK with the clientId confirmed during the project creation step, and obtain a WalletProvider.
import DappPortalSDK from '@linenext/dapp-portal-sdk'
const sdk = await DappPortalSDK.init({ clientId: '<CLIENT_ID>' });
const provider = sdk.getWalletProvider()If you wish to use the testnet, initialize the SDK like this:
const sdk = await DappPortalSDK.init({
clientId: '<CLIENT_ID>',
chainId: '1001',
});Send a kaia_requestAccounts request to the wallet to check the address of the connected wallet. During this process, the user will see a screen to select the wallet type and confirm the connection.
const accounts = await provider.request({ method: 'kaia_requestAccounts' });
const accountAddress = accounts[0]Create a transaction that requires the user's signature. The address used in the from field should match the wallet address obtained in the previous step.
const tx = {
from: accountAddress,
to: '0xBBBBBBBBBBBB',
value: '10',
gas: '21000',
};Send a kaia_sendTransaction request to the wallet. During this process, a popup will open for the user to verify the transaction to be signed. If successful, it returns the Tx hash.
const txHash = await provider.request({method: 'kaia_sendTransaction', params: [tx]});Connect and Sign a Message
You can use the kaia_connectAndSign method to connect to a wallet and sign a message in a single step. This method simplifies the process by combining wallet connection and message signing.
const [address, signature] = await provider.request({method: 'kaia_connectAndSign', params: [someMessage]});Compatible Libraries
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
11 months ago
12 months ago