API Reference
DocumentationLog In

Advanced API

Below are a few examples for making requests to the Coinbase Node's Advanced API using the Coinbase Cloud SDK.

Balances

GetSingleBalance

import { GetSingleBalanceResponse } from 'coinbase-cloud-sdk';

const singleBalance: GetSingleBalanceResponse = await coinbaseCloud.advanced
  .getSingleBalance(
    '0x00000000DF0635793e91d4f8e7426dbd9ed08471186f428D',
    '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
  );
const singleBalance = await coinbaseCloud.advanced
  .getSingleBalance(
    '0x00000000DF0635793e91d4f8e7426dbd9ed08471186f428D',
    '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
  );
{
   "blockHeight":"0xf4788e",
   "address":"0xdf0635793e91d4f8e7426dbd9ed08471186f428d",
   "nativeAmount":"0x4956e9805cef471",
   "nativeUnit":"Wei",
   "tokenBalance":{
      "contract":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "amount":"0x360246df",
      "decimals":6
   }
}

See getSingleBalance.

GetBalances

import { GetBalancesResponse } from 'coinbase-cloud-sdk';

const balances: GetBalancesResponse = await coinbaseCloud.advanced
  .getBalances([
    {
      address: '0x00000000DF0635793e91d4f8e7426dbd9ed08471186f428D',
      contract: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
    },
    {
      address: '0xdf0635793e91d4f8e7426dbd9ed08471186f428d',
      contract: '0x6b175474e89094c44da98b954eedeac495271d0f'
    }
  ]);
const balances = await coinbaseCloud.advanced
  .getBalances([
    {
      address: '0x00000000DF0635793e91d4f8e7426dbd9ed08471186f428D',
      contract: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
    },
    {
      address: '0xdf0635793e91d4f8e7426dbd9ed08471186f428d',
      contract: '0x6b175474e89094c44da98b954eedeac495271d0f'
    }
  ]);
{
   "balances":[
      {
         "blockHeight":"0xf47898",
         "address":"0xdf0635793e91d4f8e7426dbd9ed08471186f428d",
         "nativeAmount":"0x4956e9805cef471",
         "nativeUnit":"Wei",
         "tokenBalances":[
            {
               "contract":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
               "amount":"0x360246df",
               "decimals":6
            },
            {
               "contract":"0x6b175474e89094c44da98b954eedeac495271d0f",
               "amount":"0x147fb0b4b9b0085c2",
               "decimals":18
            }
         ]
      }
   ]
}

See getBalances.

Allowances

GetTokenAllowances

import { GetTokenAllowancesResponse } from 'coinbase-cloud-sdk';

const allowances: GetTokenAllowancesResponse = await coinbaseCloud.advanced
  .getTokenAllowances([
    {
      owner: '0xa646147bda82a866eba03568f363fc9c90185c6e',
      spender: '0xadd0e097b961572b2a1f5de572c622eef97e3d82',
      contracts: ['0xdac17f958d2ee523a2206206994597c13d831ec7']
    }
  ]);
const allowances = await coinbaseCloud.advanced
  .getTokenAllowances([
    {
      owner: '0xa646147bda82a866eba03568f363fc9c90185c6e',
      spender: '0xadd0e097b961572b2a1f5de572c622eef97e3d82',
      contracts: ['0xdac17f958d2ee523a2206206994597c13d831ec7']
    }
  ]);
{
   "allowances":[
      {
         "blockHeight":"0xf4789c",
         "owner":"0xa646147bda82a866eba03568f363fc9c90185c6e",
         "spender":"0xadd0e097b961572b2a1f5de572c622eef97e3d82",
         "tokenAllowances":[
            {
               "contract":"0xdac17f958d2ee523a2206206994597c13d831ec7",
               "amount":"0xffecee2142a7dea9314b809a0c42d3e9560b1408a9f3b3e792e3",
               "decimals":6
            }
         ]
      }
   ]
}

See getTokenAllowances.

Transactions and Transfers

GetTransactionByHash

import { GetTransactionByHashResponse } from 'coinbase-cloud-sdk';

const transaction: GetTransactionByHashResponse = await coinbaseCloud.advanced
  .getTransactionByHash(
    '0x2be70b2bcff662ba941c3f3c7706ef2c674d0d0ea4a13a91543cbe18862063d4'
  );
const transaction = await coinbaseCloud.advanced
  .getTransactionByHash(
    '0x2be70b2bcff662ba941c3f3c7706ef2c674d0d0ea4a13a91543cbe18862063d4'
  );
{
   "transaction":{
      "transactionHash":"0x2be70b2bcff662ba941c3f3c7706ef2c674d0d0ea4a13a91543cbe18862063d4",
      "transactionIndex":"0x8",
      "from":"0x3f13e7a451a907030f8346db90c112c5d0dd7d9b",
      "to":"0x797dbfab26308010199f0b18c97c1c554dd119f9",
      "value":"0x11047ac8796000",
      "gasLimit":"0x5208",
      "gasPrice":"0x2540be400",
      "gasUsed":"0x5208",
      "cumulativeGasUsed":"0x562d9",
      "status":"0x1",
      "input":"0x",
      "nonce":"0xb",
      "blockHash":"0xaa20f7bde5be60603f11a45fc4923aab7552be775403fc00c2e6b805e6297dbe",
      "blockNumber":"0x989680",
      "blockTimestamp":"0x5eb01705"
   }
}

See getTransactionByHash.

GetTransactionsByAddress

import { GetTransactionsByAddressResponse } from 'coinbase-cloud-sdk';

const transactions: GetTransactionsByAddressResponse = await coinbaseCloud.advanced
  .getTransactionsByAddress(
    '0xcAfB10eE663f465f9d10588AC44eD20eD608C11e',
    '0x0',
    '0xf183f2',
    'SENDER_OR_RECEIVER',
    'desc',
    20,
    1
  );
const transactions = await coinbaseCloud.advanced
  .getTransactionsByAddress(
    '0xcAfB10eE663f465f9d10588AC44eD20eD608C11e',
    '0x0',
    '0xf183f2',
    'SENDER_OR_RECEIVER',
    'desc',
    20,
    1
  );
{
   "transactions":[
      {
         "transactionHash":"0x82e204e54650c8d4a86dd42d5ddb1f4f508757c3645d7a969b05e65e65a22e3c",
         "transactionIndex":"0x4a",
         "from":"0xcafb10ee663f465f9d10588ac44ed20ed608c11e",
         "to":"0xab7c74abc0c4d48d1bdad5dcb26153fc8780f83e",
         "value":"0x0",
         "gasLimit":"0x35f48",
         "gasPrice":"0x1bf08eb000",
         "gasUsed":"0x5967",
         "cumulativeGasUsed":"0x4d0faa",
         "status":"0x1",
         "input":"0x7065cb4800000000000000000000000061d5a4d5bd270e59e9320243e574288e2a199fed",
         "nonce":"0x339",
         "blockHash":"0xcc9f4e6afb7cbcf16cd89bac006124e4962c9afffe5279d3757a067407379e97",
         "blockNumber":"0xae2cb2",
         "blockTimestamp":"0x5fcff7aa"
      },
      {
         "transactionHash":"0xce72a6f1454037ba9339b52509c9ab45e548e56890d463501a79dafc90967b5f",
         "transactionIndex":"0x10",
         "from":"0xcafb10ee663f465f9d10588ac44ed20ed608c11e",
         "to":"0xab7c74abc0c4d48d1bdad5dcb26153fc8780f83e",
         "value":"0x0",
         "gasLimit":"0x35f94",
         "gasPrice":"0x1bf08eb000",
         "gasUsed":"0x5939",
         "cumulativeGasUsed":"0xfcf5a",
         "status":"0x1",
         "input":"0x797af627ab7c74abc0c4d48d1bdad5dcb26153fc8780f83e000000000000000000000000",
         "nonce":"0x338",
         "blockHash":"0x1f80cabc176ee88e0ee4452535611606233b45be85437b35a3ebd6475d46d797",
         "blockNumber":"0xae2caa",
         "blockTimestamp":"0x5fcff741"
      },
      { "...":"output truncated."}
   ]
}

See getTransactionsByAddress.

GetTokenTransfersByAddress

import { GetTokenTransfersByAddressResponse } from 'coinbase-cloud-sdk';

const tokenTransfers: GetTokenTransfersByAddressResponse = await coinbaseCloud.advanced
  .getTokenTransfersByAddress(
    '0x0000000000000000000000000000000000000000',
    '0xdb0db3',
    '0xea11e0',
    'RECEIVER_ONLY',
    'asc',
    10,
    1
  );
const tokenTransfers = await coinbaseCloud.advanced
  .getTokenTransfersByAddress(
    '0x0000000000000000000000000000000000000000',
    '0xdb0db3',
    '0xea11e0',
    'RECEIVER_ONLY',
    'asc',
    10,
    1
  );
{
   "tokenTransfers":[
      {
         "tokenAddress":"0xb8f5eba1a53d27a06c9c993d832d945ce20a31ec",
         "tokenType":"erc20",
         "from":"0x0000000000000000000000000000000000000000",
         "to":"0x0000000000000000000000000000000000000000",
         "value":"0x6b871aed704361",
         "transactionHash":"0xa9a74e3442be5815ef7adc4568f8dc3e0b32787aec6d2c891866888d51f223d8",
         "transactionIndex":"0x66",
         "blockHash":"0x84210a366e05d2cb7ac1674901e259620c5485ccfa079618c2b07d5c5466dc3d",
         "blockNumber":"0xdb0db3",
         "blockTimestamp":"0x62294683"
      },
      {
         "tokenAddress":"0xb5de0c3753b6e1b4dba616db82767f17513e6d4e",
         "tokenType":"erc20",
         "from":"0xb5de0c3753b6e1b4dba616db82767f17513e6d4e",
         "to":"0x0000000000000000000000000000000000000000",
         "value":"0x117efd202d61b92ba",
         "transactionHash":"0xdb7590bf6069127301ceeebf1b0f33bf483e08a37fc321e48eadbfaf4fb595fb",
         "transactionIndex":"0x48",
         "blockHash":"0x84210a366e05d2cb7ac1674901e259620c5485ccfa079618c2b07d5c5466dc3d",
         "blockNumber":"0xdb0db3",
         "blockTimestamp":"0x62294683"
      },
      { "...":"output truncated." }
   ]
}

See getTokenTransfersByAddress.

Contracts

GetTokenStandardEvents

import { GetTokenStandardEventsResponse } from 'coinbase-cloud-sdk';

const tokenEvents: GetTokenStandardEventsResponse = await coinbaseCloud.advanced
  .getTokenStandardEvents(
    '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
    '0x1',
    '0xea11e0',
    ['0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'],
    'desc',
    10,
    1
  );
const tokenEvents = await coinbaseCloud.advanced
  .getTokenStandardEvents(
    '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
    '0x1',
    '0xea11e0',
    ['0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'],
    'desc',
    10,
    1
  );
{
   "events":[
      {
         "transactionHash":"0x5ceae3d7df98226a44c1396028bb33e5c0b60ca6b0d9a256d375d9646718384a",
         "transactionIndex":"0xc5",
         "data":{
            "data":"2558303470381793",
            "from":"0x03f7724180aa6b939894b5ca4314783b0b36b329",
            "name":"Transfer",
            "to":"0xd0dcb7a4f8cfcdb29364d621ca5d997b7eddbc46"
         },
         "eventType":"Transfer",
         "signature":"Transfer(address, address, uint256)",
         "signatureHash":"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
         "blockHash":"0xf65c5d6431207c5e0f56a388202f5840af501fb48be3e21ca30aa14403e32c79",
         "blockNumber":"0xea11e0",
         "blockTimestamp":"0x62f8f7aa"
      },
      {
         "transactionHash":"0xb9fc5f4efc405df10a7d237e9ed23eda9032a5a05cde6d80a59f3905d1361ca8",
         "transactionIndex":"0xc2",
         "data":{
            "data":"556127946936842595",
            "from":"0x9c2dc3d5ffcecf61312c5f4c00660695b32fb3d1",
            "name":"Transfer",
            "to":"0x53e0e51b5ed9202110d7ecd637a4581db8b9879f"
         },
         "eventType":"Transfer",
         "signature":"Transfer(address, address, uint256)",
         "signatureHash":"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
         "blockHash":"0xf65c5d6431207c5e0f56a388202f5840af501fb48be3e21ca30aa14403e32c79",
         "blockNumber":"0xea11e0",
         "blockTimestamp":"0x62f8f7aa"
      },
      { "...":"output truncated." }
   ]
}

See getTokenStandardEvents.

GetTokenMetadata

import { GetTokenContractMetadataResponse } from 'coinbase-cloud-sdk';

const tokenMetadata: GetTokenContractMetadataResponse = await coinbaseCloud.advanced
  .getTokenMetadata('0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48');
const tokenMetadata = await coinbaseCloud.advanced
  .getTokenMetadata('0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48');
{
   "blockHeight":"0xf478ce",
   "tokenMetadata":{
      "name":"USD Coin",
      "symbol":"USDC",
      "totalSupply":"0x8ee1dc62b8651e",
      "decimals":6
   }
}

See getTokenMetadata.