polkascan / py-substrate-interface

Python Substrate Interface
https://polkascan.github.io/py-substrate-interface/
Apache License 2.0
240 stars 111 forks source link

Added query_multi() function #333

Closed arjanz closed 1 year ago

arjanz commented 1 year ago

Example:

storage_keys = [
    substrate.create_storage_key(
        "System", "Account", ["F4xQKRUagnSGjFqafyhajLs94e7Vvzvr8ebwYJceKpr8R7T"]
    ),
    substrate.create_storage_key(
        "System", "Account", ["GSEX8kR4Kz5UZGhvRUCJG93D5hhTAoVZ5tAe6Zne7V42DSi"]
    ),
    substrate.create_storage_key(
        "Staking", "Bonded", ["GSEX8kR4Kz5UZGhvRUCJG93D5hhTAoVZ5tAe6Zne7V42DSi"]
    )
]

result = substrate.query_multi(storage_keys)

for storage_key, value_obj in result:
    print(storage_key, value_obj)