Created
February 26, 2023 13:05
-
-
Save muharem/8d21bfdbab6bf4ccf7fbdc9c3ad4d228 to your computer and use it in GitHub Desktop.
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
from substrateinterface import SubstrateInterface | |
substrate = SubstrateInterface( | |
# url="wss://kusama-rpc.polkadot.io", | |
url="wss://kusama-rpc.dwellir.com", | |
) | |
block_number = 16799223 | |
block_hash = substrate.get_block_hash(block_number) | |
# block_hash = substrate.get_block_header()['header']['number'] | |
def get_address_by_rank(rank): | |
result = substrate.query_map( | |
module='FellowshipCollective', | |
storage_function='IndexToId', | |
params=[rank], | |
page_size=1000, | |
block_hash=block_hash) | |
return result | |
members = {}; | |
for rank in range(10): | |
result = get_address_by_rank(rank) | |
for id, address in result: | |
members[id.value] = [rank, address.value] | |
ids = list(members.keys()) | |
ids.sort() | |
for id in ids: | |
print("id {}, {}, {}".format(id, members[id][0], members[id][1])) | |
# print("({}, \"{}\"),".format(members[id][0], members[id][1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this only valid when ids are consistent over ranks for the same member.
which is a case now.