Reading the amount of tokens on an address via API

Hi everyone!

I was looking for a way to automatically read the amount of tokens (not Waves coins) stored on a particular address and add a certain percentage of that token if the tokens on the address have reached a certain amount.

Is there a way to do that automatically with a PHP/Javascript script via API? What if there are multiple token addresses?

Thank you!

  1. There is http://nodes.wavesnodes.com/api-docs/index.html#!/assets/balance_1 to get the balance by specific asset, for example:

{
  "address": "3P4VysS47zNuxAPHqABuMM1RZEpW6evxAiV",
  "assetId": "3taHxaAB5oPdkY4geikcFGd4m4wisBPukSnD8V5Nz7LF",
  "balance": 100000000
}

To get the balance for multiple addresses see: https://docs.wavesplatform.com/en/waves-api-and-sdk/waves-node-rest-api/asset-transactions/distribution-methods.html
2. To distribute assets to multiple addresses, use https://docs.wavesplatform.com/en/blockchain/waves-protocol/mass-transfer-transaction.html, example of JSON: https://testnode1.wavesnodes.com/transactions/info/GnupVrhwszpPSAsKAQT741sLptYPAviGs9iXXGj7NhtE

1 Like