Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added multiple params as key support for query_map #351

Merged
merged 1 commit into from
Aug 18, 2023

Conversation

arjanz
Copy link
Member

@arjanz arjanz commented Aug 18, 2023

Possibility to omit multiple parameters when using query_map, which was bound to only the last parameter.

For example:

result = self.kusama_substrate.query_map(
            module='ConvictionVoting',
            storage_function='VotingFor',
            max_results=10
        )
print([record for record in result])

# [[(<scale_info::0(value=Cwvu9hqzqCMMK8yLVAcSKPjMDs2yQrrfEpAV3ZVJqpQz7RJ)>, <U16(value=0)>), <scale_info::600(value={'Casting': {'votes': [(72, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}}), (86, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}}), (122, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}})], 'delegations': {'votes': 58500000000000000, 'capital': 58500000000000000}, 'prior': (0, 0)}})>], [(<scale_info::0(value=Cwvu9hqzqCMMK8yLVAcSKPjMDs2yQrrfEpAV3ZVJqpQz7RJ)>, <U16(value=14)>), <scale_info::600(value={'Casting': {'votes': [], 'delegations': {'votes': 57000000000000000, 'capital': 57000000000000000}, 'prior': (0, 0)}})>], [(<scale_info::0(value=Cwvu9hqzqCMMK8yLVAcSKPjMDs2yQrrfEpAV3ZVJqpQz7RJ)>, <U16(value=15)>), <scale_info::600(value={'Casting': {'votes': [(39, {'Standard': {'vote': {'aye': True, 'conviction': 'None'}, 'balance': 50000000000}}), (80, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}}), (91, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}}), (96, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}})], 'delegations': {'votes': 57000000000000000, 'capital': 57000000000000000}, 'prior': (0, 0)}})>], [(<scale_info::0(value=Cwvu9hqzqCMMK8yLVAcSKPjMDs2yQrrfEpAV3ZVJqpQz7RJ)>, <U16(value=10)>), <scale_info::600(value={'Casting': {'votes': [(16, {'Standard': {'vote': {'aye': True, 'conviction': 'None'}, 'balance': 50000000000}})], 'delegations': {'votes': 57000000000000000, 'capital': 57000000000000000}, 'prior': (0, 0)}})>], [(<scale_info::0(value=Cwvu9hqzqCMMK8yLVAcSKPjMDs2yQrrfEpAV3ZVJqpQz7RJ)>, <U16(value=1)>), <scale_info::600(value={'Casting': {'votes': [(8, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}}), (14, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}}), (17, {'Standard': {'vote': {'aye': True, 'conviction': 'None'}, 'balance': 50000000000}}), (23, {'Standard': {'vote': {'aye': True, 'conviction': 'None'}, 'balance': 50000000000}}), (24, {'Standard': {'vote': {'aye': True, 'conviction': 'None'}, 'balance': 50000000000}}), (34, {'Standard': {'vote': {'aye': True, 'conviction': 'None'}, 'balance': 50000000000}}), (42, {'Standard': {'vote': {'aye': True, 'conviction': 'None'}, 'balance': 50000000000}}), (43, {'Standard': {'vote': {'aye': True, 'conviction': 'None'}, 'balance': 50000000000}}), (49, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}}), (53, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}}), (85, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}}), (118, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}}), (130, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}}), (167, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}}), (219, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}}), (230, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}}), (232, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}})], 'delegations': {'votes': 57000000000000000, 'capital': 57000000000000000}, 'prior': (0, 0)}})>], [(<scale_info::0(value=Cwvu9hqzqCMMK8yLVAcSKPjMDs2yQrrfEpAV3ZVJqpQz7RJ)>, <U16(value=20)>), <scale_info::600(value={'Casting': {'votes': [(15, {'Standard': {'vote': {'aye': True, 'conviction': 'None'}, 'balance': 50000000000}}), (89, {'Standard': {'vote': {'aye': True, 'conviction': 'Locked1x'}, 'balance': 50000000000}})], 'delegations': {'votes': 57000000000000000, 'capital': 57000000000000000}, 'prior': (0, 0)}})>], [(<scale_info::0(value=Dcu6mYmwZjGkYJt43BJvuWnxGUZfsDZUos3xL4hKYMRWaT7)>, <U16(value=0)>), <scale_info::600(value={'Delegating': {'balance': 100000000000, 'target': 'Day71GSJAxUUiFic8bVaWoAczR3Ue3jNonBZthVHp2BKzyJ', 'conviction': 'None', 'delegations': {'votes': 0, 'capital': 0}, 'prior': (16871527, 113000000000)}})>], [(<scale_info::0(value=Dcu6mYmwZjGkYJt43BJvuWnxGUZfsDZUos3xL4hKYMRWaT7)>, <U16(value=14)>), <scale_info::600(value={'Delegating': {'balance': 100000000000, 'target': 'Day71GSJAxUUiFic8bVaWoAczR3Ue3jNonBZthVHp2BKzyJ', 'conviction': 'None', 'delegations': {'votes': 0, 'capital': 0}, 'prior': (16871527, 113000000000)}})>], [(<scale_info::0(value=Dcu6mYmwZjGkYJt43BJvuWnxGUZfsDZUos3xL4hKYMRWaT7)>, <U16(value=31)>), <scale_info::600(value={'Delegating': {'balance': 100000000000, 'target': 'Day71GSJAxUUiFic8bVaWoAczR3Ue3jNonBZthVHp2BKzyJ', 'conviction': 'None', 'delegations': {'votes': 0, 'capital': 0}, 'prior': (16871527, 113000000000)}})>], [(<scale_info::0(value=Dcu6mYmwZjGkYJt43BJvuWnxGUZfsDZUos3xL4hKYMRWaT7)>, <U16(value=21)>), <scale_info::600(value={'Delegating': {'balance': 100000000000, 'target': 'Day71GSJAxUUiFic8bVaWoAczR3Ue3jNonBZthVHp2BKzyJ', 'conviction': 'None', 'delegations': {'votes': 0, 'capital': 0}, 'prior': (16871527, 113000000000)}})>]]

Closes #350

@arjanz arjanz merged commit 111ff53 into master Aug 18, 2023
1 check passed
@arjanz arjanz deleted the az-multiple-param-key-query-map branch August 18, 2023 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'ConvictionVoting.VotingFor' storage function history without parameters"
1 participant