Token module: Endpoint reference
This page summarizes all available API endpoints of the Token module.
Endpoints can be invoked as explained in the Connecting via endpoints guide. |
token_getBalances
Returns the balances of all tokens associated with a specific account.
Name | Type | Description | Sample |
---|---|---|---|
|
string |
Account address. |
kly55e8u4heymzmxgcrg4dc5xpgd5ckkyv53oxftb |
klayr-core endpoint:invoke token_getBalances '{"address":"kly55e8u4heymzmxgcrg4dc5xpgd5ckkyv53oxftb"}' --pretty
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": "1",
"method": "token_getBalances",
"params": {"address":"kly55e8u4heymzmxgcrg4dc5xpgd5ckkyv53oxftb"}
}'
Response
{
"balances": [
{
"tokenID": "0200000000000000",
"availableBalance": "1000000000",
"lockedBalances": []
}
]
}
token_getBalance
Returns the balance of a specific token associated with a specific account.
Name | Type | Description | Sample |
---|---|---|---|
|
string |
TokenID of the token to query the balance for. |
0200000000000000 |
|
string |
Account address. |
kly55e8u4heymzmxgcrg4dc5xpgd5ckkyv53oxftb |
klayr-core endpoint:invoke token_getBalance '{"tokenID":"0200000000000000","address":"kly55e8u4heymzmxgcrg4dc5xpgd5ckkyv53oxftb"}' --pretty
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": "1",
"method": "token_getBalance",
"params": {"tokenID":"0200000000000000","address":"kly55e8u4heymzmxgcrg4dc5xpgd5ckkyv53oxftb"}
}'
Response
{
"availableBalance": "1000000000",
"lockedBalances": []
}
token_getTotalSupply
Returns the total supply that exists of a specific token.
No Parameters.
klayr-core endpoint:invoke token_getTotalSupply --pretty
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": "1",
"method": "token_getTotalSupply",
"params": {}
}'
Response
{
"totalSupply": [
{
"tokenID": "0200000000000000",
"totalSupply": "11121172542991566"
}
]
}
token_getSupportedTokens
Returns a list of token IDs that are supported in the network.
No Parameters.
klayr-core endpoint:invoke token_getSupportedTokens --pretty
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": "1",
"method": "token_getSupportedTokens",
"params": {}
}'
Response
{
"supportedTokens": [
"0200000000000000",
"0200000000000000"
]
}
token_isSupported
Checks if a specific token is supported by the network.
Name | Type | Description | Sample |
---|---|---|---|
|
string |
TokenID of the token to query the balance for. |
0200000000000000 |
klayr-core endpoint:invoke token_isSupported '{"tokenID":"0200000000000000"}' --pretty
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": "1",
"method": "token_isSupported",
"params": {"tokenID":"0200000000000000"}
}'
Response
{
"supported": true
}
token_getEscrowedAmounts
Returns all balances of existing sidechain escrow accounts.
No Parameters.
klayr-core endpoint:invoke token_getEscrowedAmounts --pretty
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": "1",
"method": "token_getEscrowedAmounts",
"params": {}
}'
Response
{
"escrowedAmounts": [
{
"escrowChainID": "02000007",
"amount": "0",
"tokenID": "0200000000000000"
},
{
"escrowChainID": "02000070",
"amount": "0",
"tokenID": "0200000000000000"
},
{
"escrowChainID": "02001337",
"amount": "0",
"tokenID": "0200000000000000"
},
{
"escrowChainID": "02100000",
"amount": "0",
"tokenID": "0200000000000000"
},
{
"escrowChainID": "02100001",
"amount": "0",
"tokenID": "0200000000000000"
}
]
}
token_getInitializationFees
Returns the fees for initializing new user and escrow accounts.
No Parameters.
klayr-core endpoint:invoke token_getInitializationFees --pretty
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": "1",
"method": "token_getInitializationFees",
"params": {}
}'
Response
{
"userAccount": "5000000",
"escrowAccount": "5000000"
}
token_hasUserAccount
Checks if an account exists for the provided address and token in the network.
Name | Type | Description | Sample |
---|---|---|---|
|
string |
Token ID. |
0200000000000000 |
|
string |
Account address. |
kly55e8u4heymzmxgcrg4dc5xpgd5ckkyv53oxftb |
klayr-core endpoint:invoke token_hasUserAccount '{"tokenID":"0200000000000000","address":"kly55e8u4heymzmxgcrg4dc5xpgd5ckkyv53oxftb"}' --pretty
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": "1",
"method": "token_hasUserAccount",
"params": {"tokenID":"0200000000000000","address":"kly55e8u4heymzmxgcrg4dc5xpgd5ckkyv53oxftb"}
}'
Response
{
"exists": true
}
token_hasEscrowAccount
Checks if an escrow account exists for the provided chain ID and token in the network.
Name | Type | Description | Sample |
---|---|---|---|
|
string |
Token ID. |
0200000000000000 |
|
string |
Escrow chain ID. |
02001337 |
klayr-core endpoint:invoke token_hasEscrowAccount '{"tokenID":"0200000000000000","escrowChainID":"02001337"}' --pretty
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": "1",
"method": "token_hasEscrowAccount",
"params": {"tokenID":"0200000000000000","escrowChainID":"02001337"}
}'
Response
{
"exists": true
}