This function provides JSON-RPC API format on request. You can send request to retrieve healthy status of chain and sign transaction with wallet. If you send it before wallet connection, user will see a screen to select wallet type to connect.
You can find the available KAIA-related methods, their parameters, and corresponding responses in the table below. RPC methods that are not included in the table will be requested directly to the chain node and please refer to Kaia docs' RPC API Reference.
Returns the list of addresses currently connected to the wallet.
If no wallet is connected, an empty array is returned.
null
kaia_requestAccounts
Initiates wallet connection.
During the process, a window is displayed for the user to select a wallet provider.
Returns a list of addresses associated with the selected wallet.
Initiate sign procedure. We recommend to use personal_sign to get compatibility with various wallets including OKX Wallet.
[message: string, account: string]
signature
kaia_connectAndSign (EIP-191) recommendedIniitiates wallet connection and signing.
Prompts the user to select a wallet provider, then signs the provided message.
Returns [account, signature] as an array.
[message: string]
account and signature as Array
kaia_getBalance
Returns the kaia balance.
[account: string, blockNumberOrHash: string]
blockNumberOrHash can be set as latest or earliest
latest: the most recent block
earliest: the genesis block (block 0)
the balance value in kei, the smallest unit of the KAIA blockchain.
1 KAIA = 10^18 kei
kaia_sendTransaction
Constructs a transaction with given parameters
[{
from: string,
to: string,
value: string,
gas: string
}]
from field should be the account that achieved from 'kaia_accounts','kaia_requestAccounts' or 'kaia_connectAndSign'
transactionHash
Error
Code
Description
-32001
-32004
Invalid from address (Please retry methohs after executing walletProvider.disconnectWallet())
-32005
User logged out due to incorrect password input (Please retry methohs after executing walletProvider.disconnectWallet())
-32006
Wallet is not connected yet (If an error occurs while the wallet in connected, Please retry methods after executing walletProvider.disconnectWallet(). If an error occurs while the wallet is not connected, please connect wallet first)
walletProvider.disconnectWallet()
Disconnects the wallet.
When this function is called, a confirmation window will appear to confirm the disconnection.