Crypto (Coin + Tokens)

Crypto (Coin + Tokens) Functions

Get balance

Description

Returns the balance of blockchain native currency and tokens (In the supported standards) 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
      cryptoCurrencyToken: {
        contractAddress?: string
        decimals: number
        name: string
        logo: string
        symbol: string
      }
   }[]
}>

Usage Example

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

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 transactions

Description

Returns a list of blockchain native currency and 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
    id: string
    fromAddress: string
    toAddress: string
    value: string
    gasUsed: string
    gasPrice: string
    status: string
    direction: string
    type: "buy" | "fund" | "receive" | "sell" | "send"
    coinMetadata?: {
      coinName: string
      coinSymbol: string
      coinDecimals: string
    }
    tokenMetadata?: {
      tokenName: string
      tokenSymbol: string
      tokenDecimals: string
      tokenId?: string
      tokenMedia?: {
        raw: string
        gateway: string
      }[]
    }
  }[]
}>

Usage Example

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

Response Example

{
  "ethereum": [
    {
      "createdAt": "2022-11-15T21:01:47.000Z",
      "id": "0xe0eebdcb1e585e4680c1d1c1d95afbbff8977140adca291f6ca33bbccf830899",
      "value": "0.005",
      "direction": "incoming",
      "gasUsed": "0",
      "gasPrice": "0",
      "fromAddress": "0xc1af9c48fb30fa29b0d4b1332c63c5e71e636f62",
      "status": "complete",
      "toAddress": "0x15b895d74582daea01be8e5be264243d8c9d7bb1",
      "type": "receive",
      "coinMetadata": {
        "coinName": "Ethereum",
        "coinSymbol": "ETH",
        "coinDecimals": "18"
      }
    }
  ]
}

Last updated