Skip to content

Commit

Permalink
Refactored all Struct properties to snake_case
Browse files Browse the repository at this point in the history
To ensure compatibility with generated `PortableRegistry` Structs
  • Loading branch information
arjanz committed Aug 2, 2021
1 parent f304866 commit ef8ae3d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
21 changes: 9 additions & 12 deletions substrateinterface/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1494,13 +1494,13 @@ def generate_signature_payload(self, call, era=None, nonce=0, tip=0, include_cal
'era': era,
'nonce': nonce,
'tip': tip,
'specVersion': self.runtime_version,
'genesisHash': genesis_hash,
'blockHash': block_hash
'spec_version': self.runtime_version,
'genesis_hash': genesis_hash,
'block_hash': block_hash
}

if self.transaction_version is not None:
payload_dict['transactionVersion'] = self.transaction_version
payload_dict['transaction_version'] = self.transaction_version

signature_payload.encode(payload_dict)

Expand Down Expand Up @@ -2264,7 +2264,7 @@ def decode_block(block_data):

if log_digest.value['PreRuntime']['engine'] == 'BABE':
validator_set = self.query("Session", "Validators", block_hash=block_hash)
rank_validator = log_digest.value['PreRuntime']['data']['authorityIndex']
rank_validator = log_digest.value['PreRuntime']['data']['authority_index']

block_author = validator_set.elements[rank_validator]
block_data['author'] = block_author.value
Expand Down Expand Up @@ -2621,13 +2621,13 @@ def serialize_storage_item(self, storage_item, module, spec_version_id):
storage_dict["type_value"] = type_info["value"]
storage_dict["type_keys"] = [type_info["key"]]
storage_dict["type_hashers"] = [type_info["hasher"]]
storage_dict["type_is_linked"] = type_info["isLinked"]
storage_dict["type_is_linked"] = type_info["is_linked"]

elif type_class == 'DoubleMapType':

storage_dict["type_value"] = type_info["value"]
storage_dict["type_keys"] = [type_info["key1"], type_info["key2"]]
storage_dict["type_hashers"] = [type_info["hasher"], type_info["key2Hasher"]]
storage_dict["type_hashers"] = [type_info["hasher"], type_info["key2_hasher"]]

elif type_class == 'NMapType':

Expand Down Expand Up @@ -2977,15 +2977,12 @@ def process_events(self):

elif event.value['module_id'] == 'System' and event.value['event_id'] == 'ExtrinsicFailed':
self.__is_success = False
raise NotImplementedError()

elif event.value['module_id'] == 'Treasury' and event.value['event_id'] == 'Deposit':
self.__total_fee_amount += event.params[0]['value']
raise NotImplementedError()
self.__total_fee_amount += event.value['attributes']

elif event.value['module_id'] == 'Balances' and event.value['event_id'] == 'Deposit':
self.__total_fee_amount += event.params[0]['value']
raise NotImplementedError()
self.__total_fee_amount += event.value['attributes']
else:

if event.event_module.name == 'System' and event.event.name == 'ExtrinsicSuccess':
Expand Down
2 changes: 1 addition & 1 deletion test/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_system_account_non_existing(self):
{
'nonce': 0, 'consumers': 0, 'providers': 0, 'sufficients': 0,
'data': {
'free': 0, 'reserved': 0, 'miscFrozen': 0, 'feeFrozen': 0
'free': 0, 'reserved': 0, 'misc_frozen': 0, 'fee_frozen': 0
}
}, result.value)

Expand Down

0 comments on commit ef8ae3d

Please sign in to comment.