Installation and usage of the platform

REST API: information about address assets and balances

https://img.shields.io/badge/auth-required-orange.svg

The methods of the assets group are provided for obtaining information about assets and address balances.

GET /assets/balance/{address}

The method returns the balance of all assets of the address.

Note

It is recommended to use the GET /assets/details/{assetId} method to get information about the asset.

Parameters returned in the method response:

  • address – participant address;

  • balances – object with balances of the participant:

    • assetId – asset identifier;

    • balance – asset balance;

    • quantity – the total number of issued tokens of the asset;

    • reissuable – the reissuability of an asset;

    • minSponsoredAssetFee – minimum fee for sponsored transactions;

    • sponsorBalance – funds allocated to pay for transactions on sponsored assets.

Response example:

GET /assets/balance/{address}:
{
  "address": "3Mv61qe6egMSjRDZiiuvJDnf3Q1qW9tTZDB",
  "balances": [
    {
      "assetId": "Ax9T4grFxx5m3KPUEKjMdnQkCKtBktf694wU2wJYvQUD",
      "balance": 4879179221,
      "quantity": 48791792210,
      "reissuable": true,
      "minSponsoredAssetFee" : 100,
      "sponsorBalance" : 1233221,
    },
    {
      "assetId": "49KfHPJcKvSAvNKwM7CTofjKHzL87SaSx8eyADBjv5Wi",
      "balance": 10,
      "quantity": 10000000000,
      "reissuable": false,
    }
  ]
}

GET /assets/balance-v2/{address}

The method returns the balance of all the assets of the address, including the balance of the assets issued by a smart contract.

Parameters returned in the method response:

  • address – participant address;

  • balances – object with balances of the participant:

    • name – asset name;

    • assetId – asset identifier;

    • balance – asset balance;

    • reissuable – the flag, which indicates the reissuability of the asset;

    • sponsorshipIsEnabled – the flag that takes true or false value, and according to the value allows or does not allow to pay fees in a non-system (not WEST) token;

    • sponsorBalance – funds allocated for transaction fees on sponsored assets;

    • quantity – the total number of issued tokens of the asset;

    • decimals – the maximum number of decimal places for a particular asset;

    • description – the description of the asset given by the participant who issued it;

    • timestamp – the time of the asset issue;

    • issueHeight – the height at which the asset was issued;

    • issuer – the address of the participant who issued the asset.

Response example:

GET /assets/balance-v2/{address}:
{
  "address": "3Mv61qe6egMSjRDZiiuvJDnf3Q1qW9tTZDB",
  "balances": [
    {
      "name": "WBTC",
      "assetId": "3Mv61qe6egMSjRDZiiuvJDnf3Q1qW9tTZDB",
      "balance": 100000000,
      "reissuable": true,
      "sponsorshipIsEnabled": true,
      "sponsorBalance": 0,
      "quantity": 10000000,
      "decimals": 8,
      "description": "Wrapped BTC token",
      "timestamp": 100,
      "issueHeight": 100,
      "issuer": {}
    }
  ]
}

POST /assets/balance

The method returns a set of pairs assetidbalance for each address passed in the addresses field when the method is called.

Parameters returned in the method response:

  • assetId – asset identifier;

  • balance – asset balance.

Response example for one address:

POST /assets/balance:
[{"3Mv61qe6egMSjRDZiiuvJDnf3Q1qW9tTZDB": {"assedId": "3Mv61qe6egMSjRDZiiuvJDnf3Q1qW9tTZDB", "balance": 1}]

GET /assets/balance/{address}/{assetId}

The method returns the balance of the address in the specified {assetId}.

Response example:

GET /assets/balance/{address}/{assetId}:
{
  "address": "3Mv61qe6egMSjRDZiiuvJDnf3Q1qW9tTZDB",
  "assetId": "Ax9T4grFxx5m3KPUEKjMdnQkCKtBktf694wU2wJYvQUD",
  "balance": 4879179221
}

GET /assets/details/{assetId}

The method returns description of the specified {assetId}.

Response example:

GET /assets/details/{assetId}:
{
  "assetId" : "8tdULCMr598Kn2dUaKwHkvsNyFbDB1Uj5NxvVRTQRnMQ",
  "issueHeight" : 140194,
  "issueTimestamp" : 1504015013373,
  "issuer" : "3NCBMxgdghg4tUhEEffSXy11L6hUi6fcBpd",
  "name" : "name",
  "description" : "Sponsored asset",
  "decimals" : 1,
  "reissuable" : true,
  "quantity" : 1221905614,
  "script" : null,
  "scriptText" : null,
  "complexity" : 0,
  "extraFee": 0,
  "minSponsoredAssetFee" : 100000
}

GET /assets/{assetId}/distribution

The method returns the number of asset tokens on all addresses using the specified asset.

Response example:

GET /assets/details/{assetId}:
{
  "3P8GxcTEyZtG6LEfnn9knp9wu8uLKrAFHCb": 1,
  "3P2voHxcJg79csj4YspNq1akepX8TSmGhTE": 1200
}
See also