Account total balance with UniversalDividendApi_account_balances as failsafe of indexer
Only available in runtime v1000
WARNING: this method can not be called as batch (or as multiple query in one call), so it is slow. It should only be a backup if the indexer is not online !
Replace balance without claim UDs by real balance with UniversalDividendApi_account_balances call:
{ /// Total balance own by user total: number,
/// transferable amount (include unclaimed UDs, but without the "dépôt d’existence" neither the "reserved amount") transferable: number,
/// total balance of the unclaimed UDs unclaim_uds: number }
Usage with Curl:
RPC_URL="http://127.0.0.1:9933"
HEX_ACCOUNT="0x0123…ef" # Clé publique paddée à 32 octets et encodée en hexadécimal
curl -X POST $RPC_URL \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"state_call",
"params":[
"UniversalDividendApi_account_balances",
"'"${HEX_ACCOUNT}"'"
]
}'
Edited by Vincent Texier