get_currency_balance
The get_currency_balance method retrieves the balance of a specific currency or token for a given EOS account. This is essential for querying account balances accurately and ensuring up-to-date financial information.
Example use cases:
Balance Querying
Users and developers can utilize the get_currency_balance method to query the balances of specific currencies or tokens, enabling effective account management and financial planning.
Financial Management
This method is pivotal for financial management in decentralized applications, allowing for the implementation of features related to balance checking, fund transfer validations, and more.
Smart Contract Interaction
Developers can leverage this method to interact with token contracts to retrieve the balance of an account, facilitating the development of functionalities around token transactions and balance validations in dApps.
Parameters
The getCurrencyBalance method requires the following parameters in the request body:
parameter | type | description |
|---|---|---|
account | string | The name of the account for which the balance is being requested. |
code | string | The smart contract that operates the currency. |
symbol | string (optional) | The symbol of the currency/token. If not provided, returns balances for all tokens under the smart contract. |
Return Object
Upon a successful request, the method returns an array containing the balances of the specified currency/token for the given account:
Each item in the array represents a balance in the format "amount SYMBOL" (e.g., "100.0000 EOS").
field | description |
|---|---|
balance | The balance of the specified currency/token in the format 'amount SYMBOL', e.g., '100.0000 EOS'. |
JSON-RPC Request Example
Response Example