Skip to content

Commit

Permalink
Added str primitive type mapping
Browse files Browse the repository at this point in the history
Multiple contract events in ContractExecutionReceipt
  • Loading branch information
Arjan Zijderveld committed Dec 17, 2020
1 parent 51df5e6 commit 4b211ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requests~=2.25.0
xxhash>=2.0.0
pytest>=6.1.2

scalecodec>=0.10.39
scalecodec>=0.10.40
py-sr25519-bindings>=0.1.2
py-ed25519-bindings>=0.1.2
py-bip39-bindings>=0.1.6
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
'idna>=2.8',
'requests>=2.25.0',
'xxhash>=1.3.0',
'scalecodec>=0.10.39',
'scalecodec>=0.10.40',
'py-sr25519-bindings>=0.1.2',
'py-ed25519-bindings>=0.1.2',
'py-bip39-bindings>=0.1.6'
Expand Down
13 changes: 8 additions & 5 deletions substrateinterface/contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def process_encode(self, value):
class ContractExecutionReceipt(ExtrinsicReceipt):

def __init__(self, *args, **kwargs):
self.__contract_execution_result = None
self.__contract_events = None
self.contract_metadata = kwargs.pop('contract_metadata')
super(ContractExecutionReceipt, self).__init__(*args, **kwargs)

Expand All @@ -244,6 +244,9 @@ def process_events(self):
super().process_events()

if self.triggered_events:

self.__contract_events = []

for event in self.triggered_events:
if event.event_module.name == 'Contracts' and event.event.name == 'ContractExecution':

Expand All @@ -256,14 +259,14 @@ def process_events(self):

contract_event_obj.decode()

self.__contract_execution_result = contract_event_obj
self.__contract_events.append(contract_event_obj)

@property
def contract_execution_result(self):
if self.__contract_execution_result is None:
def contract_events(self):
if self.__contract_events is None:
self.process_events()

return self.__contract_execution_result
return self.__contract_events


class ContractCode:
Expand Down

0 comments on commit 4b211ab

Please sign in to comment.