Token

Token Functions

Get balance

Description

Returns the balance of Tokens in the user's wallet for the supported blockchains, filtered by the blockchainIds

Parameters

NameTypeRequiredDefaultDescription

blockchainIds

String[]

defaultBlockchainIds

Blockchain ids

userId

String

✔️

User id

Return type

Promise<{
   [blockchainId: string]: {
      value: string
      tokenMetadata: {
        tokenAddress: string
        tokenDecimals: string
        tokenName: string
        tokenSymbol: string
      }
   }[]
}>

Usage Example

const balance = await sdk.token.getBalance({ userId: '123' })

Response Example

{
  "ethereum": [
    {
      "value": "0.12",
      "tokenMetadata": {
        "tokenAddress": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0",
        "tokenDecimals": "18",
        "tokenName": "Polygon Matic",
        "tokenSymbol": "MATIC"
      }
    }
  ],
  "polygon": []
}

Get transactions

Description

Returns a list of token transactions for the supported blockchains, filtered by the blockchainIds

Parameters

NameTypeRequiredDefaultDescription

blockchainIds

String[]

defaultBlockchainIds

Blockchain ids

userId

String

✔️

User id

Return type

Promise<{
  [blockchainId: string] : {
    createdAt: string
    value: string
    tokenMetadata: {
      tokenDecimals: string
      tokenName: string
      tokenSymbol: string
    }
    toAddress: string,
    fromAddress: string
    direction: string
    gasUsed: string
    gasLimit: number
    gasPrice: string
    id: string
    status: string
    type: "buy" | "fund" | "receive" | "sell" | "send"
  }[]
}>

Usage Example

const transactions = await sdk.token.getTransactions({ userId: '123' })

Response Example

{
  "tezosGhost": [
    {
      "createdAt": "2023-06-29T07:48:00Z",
      "value": "3.0",
      "tokenMetadata": {
        "tokenAddress": "KT1AfUy48JvqVvtcXKxBDy1guDTJSWd1n8Uv",
        "tokenDecimals": "18",
        "tokenName": "Kolibri USD",
        "tokenSymbol": "kUSD"
      },
      "nonce": "16941458",
      "direction": "incoming",
      "toAddress": "tz1NpGHrD9qNZNnXWTyVYkPgq3DvdhC7hDho",
      "fromAddress": "tz1Vr7wLtVvpCdmLTTNPgt8rP9vjmFxRMSWg",
      "gasUsed": "3219",
      "id": "opaoXY13tkcrYeok4BmXRAFGTffCD5RyyWhWrB9kubR1aduPPC3",
      "gasPrice": "0",
      "status": "completed",
      "type": "receive"
    },
    {
      "createdAt": "2023-06-29T07:47:41Z",
      "value": "3.0",
      "tokenMetadata": {
        "tokenAddress": "KT1H9hKtcqcMHuCoaisu8Qy7wutoUPFELcLm",
        "tokenDecimals": "6",
        "tokenName": "Tether USD",
        "tokenSymbol": "USDT"
      },
      "gas": "3619",
      "nonce": "16941457",
      "direction": "incoming",
      "toAddress": "tz1NpGHrD9qNZNnXWTyVYkPgq3DvdhC7hDho",
      "fromAddress": "tz1Vr7wLtVvpCdmLTTNPgt8rP9vjmFxRMSWg",
      "gasUsed": "3619",
      "id": "oovjQ5YiHaD3Tsw7ukF9qYzsB1iSm6PWooDUPXh13FeMkja1Sm4",
      "gasPrice": "0",
      "status": "completed",
      "type": "receive"
    }
  ],
  "ethereumSepolia": [
    {
      "fromAddress": "0x3a27c671c01be1b8ba8fd0be94e8cfe5f77fc67b",
      "toAddress": "0x2f42ee19146b55f624ebd9ea66d3919ba13eec8b",
      "value": "1.0",
      "tokenAddress": "0xe15501dd8857a885defe240147ea3b1c998855be",
      "gasUsed": "52155",
      "gasPrice": "4926498365",
      "direction": "incoming",
      "createdAt": "2023-06-28T08:17:58Z",
      "tokenMetadata": {
        "tokenSymbol": "TW",
        "tokenName": "Tweed",
        "tokenDecimals": "18",
        "tokenAddress": "0xe15501dd8857a885defe240147ea3b1c998855be"
      },
      "id": "0x01e3183570f73a714cdc876916e6d83d8246b8aa0ad8da7975f5bc258822c4bc",
      "nonce": "1",
      "status": "completed",
      "type": "send"
    },
    {
      "fromAddress": "0x0000000000000000000000000000000000000000",
      "toAddress": "0x3a27c671c01be1b8ba8fd0be94e8cfe5f77fc67b",
      "value": "2000000.0",
      "tokenAddress": "0xe15501dd8857a885defe240147ea3b1c998855be",
      "gasUsed": "37081",
      "gasPrice": "15684032508",
      "direction": "incoming",
      "createdAt": "2023-06-28T08:17:58Z",
      "tokenMetadata": {
        "tokenSymbol": "TW",
        "tokenName": "Tweed",
        "tokenDecimals": "18",
        "tokenAddress": "0xe15501dd8857a885defe240147ea3b1c998855be"
      },
      "id": "0xd07bbacb39570e8442207a3a8dcd4392294ec9ba37d089e67206ee5a9e58f084",
      "nonce": "10",
      "status": "completed",
      "type": "receive"
    },
    {
      "fromAddress": "0x0000000000000000000000000000000000000000",
      "toAddress": "0x3a27c671c01be1b8ba8fd0be94e8cfe5f77fc67b",
      "value": "0.0000000002",
      "tokenAddress": "0xe15501dd8857a885defe240147ea3b1c998855be",
      "gasUsed": "71221",
      "gasPrice": "13720111665",
      "direction": "incoming",
      "createdAt": "2023-06-28T08:17:58Z",
      "tokenMetadata": {
        "tokenSymbol": "TW",
        "tokenName": "Tweed",
        "tokenDecimals": "18",
        "tokenAddress": "0xe15501dd8857a885defe240147ea3b1c998855be"
      },
      "id": "0x29b1be7296483450ef8e437911e1900832ca10ec88caeb5c05d15f3fd60b0769",
      "nonce": "9",
      "status": "completed",
      "type": "receive"
    }
  ]
}

Last updated