From 9f8a706d2d3f0f67015cf407ef86283d358a1fe2 Mon Sep 17 00:00:00 2001 From: Arjan Zijderveld Date: Tue, 22 Dec 2020 18:45:56 +0100 Subject: [PATCH] Added additional ink_env types --- substrateinterface/contracts.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/substrateinterface/contracts.py b/substrateinterface/contracts.py index 0124a39..cb476c3 100644 --- a/substrateinterface/contracts.py +++ b/substrateinterface/contracts.py @@ -133,10 +133,25 @@ def get_type_string_for_metadata_type(self, type_id: int) -> str: arg_type = self.metadata_dict['types'][type_id - 1] + # Predefined types defined in crate ink_env if 'path' in arg_type: + if arg_type['path'] == ['ink_env', 'types', 'AccountId']: return 'AccountId' + if arg_type['path'] == ['ink_env', 'types', 'Hash']: + return 'Hash' + + if arg_type['path'] == ['ink_env', 'types', 'Balance']: + return 'Balance' + + if arg_type['path'] == ['ink_env', 'types', 'Timestamp']: + return 'Moment' + + if arg_type['path'] == ['ink_env', 'types', 'BlockNumber']: + return 'BlockNumber' + + # RUST primitives if 'primitive' in arg_type['def']: return arg_type['def']['primitive']