Skip to main content

Token data object

Currently, in our API reference, we have a token.data object required as a parameter for a bunch of endpoints.

Example: Token data

However, it is not clear from the API reference what this object should look like. This page is to provide that clarification.

Endpoints requiring token.data:

token

The token param is made up of two fields:

  • type
  • data

type can be one of: ETH, ERC20, or ERC721

data depends on the type that is used. Fields are:

  • decimals (required for ETH, ERC20)
  • token_address (required for ERC20, ERC721)
  • token_id (required for ERC721)

If any of the required fields are missing, the request will error out.

Example requests:

type: 'ETH'

{
...
"token": {
"type": "ETH",
"data": {
"decimals": 18
}
}
}

type: 'ERC20'

{
...
"token": {
"type": "ERC20",
"data": {
"decimals": 18,
"token_address": "0x..."
}
}
}

type: 'ERC721'

{
...
"token": {
"type": "ERC721",
"data": {
"token_address": "0x...",
"token_id": "123"
}
}
}