Skip to content

Commit

Permalink
Request OperationData initiator fields (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout authored Jul 10, 2021
1 parent f25d4e9 commit a702778
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dipdup/datasources/tzkt/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"sender",
"nonce",
"target",
"initiator",
"amount",
"storage",
"status",
Expand Down Expand Up @@ -655,12 +656,14 @@ def convert_operation(cls, operation_json: Dict[str, Any]) -> OperationData:
counter=operation_json['counter'],
sender_address=operation_json['sender']['address'] if operation_json.get('sender') else None,
target_address=operation_json['target']['address'] if operation_json.get('target') else None,
initiator_address=operation_json['initiator']['address'] if operation_json.get('initiator') else None,
amount=operation_json.get('amount') or operation_json.get('contractBalance'),
status=operation_json['status'],
has_internals=operation_json.get('hasInternals'),
sender_alias=operation_json['sender'].get('alias'),
nonce=operation_json.get('nonce'),
target_alias=operation_json['target'].get('alias') if operation_json.get('target') else None,
initiator_alias=operation_json['initiator'].get('alias') if operation_json.get('initiator') else None,
entrypoint=operation_json['parameter']['entrypoint'] if operation_json.get('parameter') else None,
parameter_json=operation_json['parameter']['value'] if operation_json.get('parameter') else None,
originated_contract_address=operation_json['originatedContract']['address']
Expand Down
2 changes: 2 additions & 0 deletions src/dipdup/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class OperationData:
counter: int
sender_address: str
target_address: Optional[str]
initiator_address: Optional[str]
amount: Optional[int]
status: str
has_internals: Optional[bool]
Expand All @@ -68,6 +69,7 @@ class OperationData:
sender_alias: Optional[str] = None
nonce: Optional[int] = None
target_alias: Optional[str] = None
initiator_alias: Optional[str] = None
entrypoint: Optional[str] = None
parameter_json: Optional[Any] = None
originated_contract_address: Optional[str] = None
Expand Down
1 change: 1 addition & 0 deletions tests/test_dipdup/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def test_merged_storage(self):
counter=0,
sender_address='',
target_address='',
initiator_address='',
amount=0,
status='',
has_internals=False,
Expand Down

0 comments on commit a702778

Please sign in to comment.