-
-
Save elsehow/92937f826c2aacc159d21345358a9a8f to your computer and use it in GitHub Desktop.
ABCI query with Tendermint RPC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def abci_query (rpc, path, data): | |
# from | |
# https://functionx.gitbook.io/home/developers/json-rcp-abci-query | |
q = { | |
"jsonrpc": "2.0", | |
"id": 0, | |
"method": "abci_query", | |
"params": { | |
"path": path, | |
"data": json.dumps(data).encode('utf-8').hex(), | |
}, | |
} | |
resp = post(rpc, json=q, headers={'height': '0'}) | |
b64str = resp.json()['result']['response']['value'] | |
bs = b64str.encode('ascii') | |
return json.loads(base64.b64decode(bs).decode('ascii')) | |
d = { | |
"address": "my-juno-address", | |
} | |
abci_query(juno_rpc, 'custom/bank/all_balances', d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment