I want to get the token balance of RMRK in the chain statemine with py-substrate.
1 Answer
from substrateinterface import SubstrateInterface
ASSET_ID = 8 # RMRK.app
ACCOUNT = '<<YOUR_ACCOUNT>>'
substrate = SubstrateInterface(url='wss://statemine-rpc.polkadot.io')
account_info = substrate.query(
module='Assets',
storage_function='Account',
params=[ASSET_ID, ACCOUNT],
)
print(f'Balance: {account_info["balance"]}')
-
-
Sure, you can always check its repository: github.com/polkascan/py-substrate-interface. It also has a Github page here: polkascan.github.io/py-substrate-interface Commented Mar 3, 2022 at 3:49
-
.Hi, The doc is very simple and can't help me. Can you help me to solve some issues? How to send a rmrk transaction ? I define the: call_module = "Assets" and call_function = 'transfer', call_params = { "id": 8, "target": target, 'amount': amount, }. But when I call "substrate.create_signed_extrinsic", the error "ValueError: Element "asset_id" of struct is missing in given value".– JackCommented Mar 4, 2022 at 6:43
-
Without the whole code is hard to get it but maybe do what the error is point out? Like replacing
"id": 8
by"asset_id": 8
? Commented Mar 4, 2022 at 18:36