Crypto (Coin + Tokens)
JavaScript Crypto (Coin + Tokens) Functions
Get balance
Description
Returns the current balance of blockchain native coins and tokens in the user's wallet for multiple blockchains
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
blockchainIds | String[] | defaultBlockchainIds | Blockchain ids |
Return type
Promise<{
[blockchainId: string]: {
value: string
tokenMetadata?: {
tokenAddress: string
tokenDecimals: string
tokeName: string
tokenSymbol: string
}
coinMetadata?: {
tokenAddress: string
tokenDecimals: string
tokeName: string
tokenSymbol: string
}
}[]
}>
Usage Example
const balance = await sdk.crypto.getBalance()
// or
const balance = await sdk.crypto.getBalance({ blockchainIds: ['ethereum', 'polygon'] })
Response Example
{
"tezosGhost": [
{
"value": "8.092449",
"coinMetadata": {
"coinName": "Tezos",
"coinSymbol": "XTZ",
"coinDecimals": "6"
}
},
{
"value": "3.0",
"tokenMetadata": {
"tokenAddress": "KT1H9hKtcqcMHuCoaisu8Qy7wutoUPFELcLm",
"tokenName": "Tether USD",
"tokenSymbol": "USDT",
"tokenDecimals": "6"
}
},
{
"value": "3.0",
"tokenMetadata": {
"tokenAddress": "KT1AfUy48JvqVvtcXKxBDy1guDTJSWd1n8Uv",
"tokenName": "Kolibri USD",
"tokenSymbol": "kUSD",
"tokenDecimals": "18"
}
}
],
"ethereumSepolia": [
{
"value": "0.099638562787420425",
"coinMetadata": {
"coinName": "Sepolia Ether",
"coinSymbol": "ETH",
"coinDecimals": "18"
}
},
{
"value": "1.999999",
"tokenMetadata": {
"tokenAddress": "0xe15501dd8857a885defe240147ea3b1c998855be",
"tokenSymbol": "TW",
"tokenName": "Tweed",
"tokenDecimals": "18"
}
}
]
}
Get exchange rates
Description
Returns exchange rates between crypto and fiat
Return type
Promise<{ cryptoCurrencyId: string, fiatCurrencyId: string, rate: string }[]>
Usage Example
const exchangeRates = await sdk.crypto.getExchangeRates()
Response Example
[{ "cryptoCurrencyId": "ETH", "fiatCurrencyId": "usd", "rate": "1234" }]
Get transactions
Description
Returns a list of blockchain native coin and token transactions for multiple blockchains
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
blockchainIds | String[] | defaultBlockchainIds | Blockchain ids |
Return type
Promise<{
[blockchainId: string] : {
createdAt: string
id: string
toAddress: string,
fromAddress: string
direction: string
gasUsed: string
gasLimit: number
gasPrice: string
status: string
value: string
type: "buy" | "fund" | "receive" | "sell" | "send"
coinMetadata: {
coinDecimals: string
coinName: string
coinSymbol: string
}
tokenMetadata?: {
tokenName: string
tokenSymbol: string
tokenDecimals: string
tokenId?: string
tokenMedia?: {
raw: string
gateway: string
}[]
}
}[]
}>
Usage Example
const transactions = await sdk.crypto.getTransactions()
// or
const transactions = await sdk.crypto.getTransactions({ blockchainIds: ['ethereum', 'polygon'] })
Response Example
{
"tezosGhost": [
{
"createdAt": "2023-06-29T07:26:40Z",
"fromAddress": "tz1NpGHrD9qNZNnXWTyVYkPgq3DvdhC7hDho",
"toAddress": "tz1NpGHrD9qNZNnXWTyVYkPgq3DvdhC7hDho",
"value": "0.0002",
"status": "completed",
"id": "opUEAQjPPM2SKDzAdPSgKMrFMnJpSh9LpXc1J8BaiwEgqSAG5Yu",
"nonce": "17525774",
"gasUsed": "169",
"direction": "outgoing",
"coinMetadata": {
"coinName": "Tezos",
"coinSymbol": "XTZ",
"coinDecimals": "6"
},
"gasPrice": "0",
"gasLimit": 269,
"type": "send"
},
{
"createdAt": "2023-06-28T08:17:58Z",
"fromAddress": "tz1Vr7wLtVvpCdmLTTNPgt8rP9vjmFxRMSWg",
"toAddress": "tz1NpGHrD9qNZNnXWTyVYkPgq3DvdhC7hDho",
"value": "3.0",
"status": "completed",
"id": "opU95cSzjHnqNBwAJLwak2VgJsn3ywYNxyR15CMQJ7fJ4cKgJv3",
"nonce": "16941454",
"gasUsed": "169",
"direction": "incoming",
"coinMetadata": {
"coinName": "Tezos",
"coinSymbol": "XTZ",
"coinDecimals": "6"
},
"gasPrice": "0",
"gasLimit": 269,
"type": "receive"
}
],
"ethereumSepolia": [
{
"fromAddress": "0x3a27c671c01be1b8ba8fd0be94e8cfe5f77fc67b",
"toAddress": "0x2f42ee19146b55f624ebd9ea66d3919ba13eec8b",
"value": "0.0001",
"gasUsed": "21000",
"gasPrice": "214080493",
"direction": "incoming",
"createdAt": "2023-06-28T08:17:58Z",
"nonce": "0",
"id": "0x87cef4db73fa22b27972dd518c8693246f61979e00a5b807a85c342c004da01e",
"coinMetadata": {
"coinName": "Sepolia Ether",
"coinSymbol": "ETH",
"coinDecimals": "18"
},
"status": "completed",
"type": "send"
},
{
"fromAddress": "0x7f8e0b31dd7e8c12cf907225e25ed83c649bcc62",
"toAddress": "0x3a27c671c01be1b8ba8fd0be94e8cfe5f77fc67b",
"value": "0.1",
"gasUsed": "21000",
"gasPrice": "1761138757",
"direction": "incoming",
"createdAt": "2023-06-28T08:17:58Z",
"nonce": "7",
"id": "0x2354c9859d56c4ba2f0183661c03752f2b6e5d2d2f8198072c6773e5d285d830",
"coinMetadata": {
"coinName": "Sepolia Ether",
"coinSymbol": "ETH",
"coinDecimals": "18"
},
"status": "completed",
"type": "receive"
}
]
}
Last updated