diff --git a/docs/schema.md b/docs/schema.md index f453728..c732a37 100644 --- a/docs/schema.md +++ b/docs/schema.md @@ -180,6 +180,28 @@ public_key: STRING slots: INTEGER (REPEATED) ``` +### endorsement_with_slot_operations + +``` +level: INTEGER +timestamp: TIMESTAMP +block_hash: STRING +branch: STRING +signature: STRING +operation_hash: STRING +operation_group_index: INTEGER +operation_index: INTEGER +content_index: INTEGER +internal_operation_index: INTEGER +delegate: STRING +endorsement_branch: STRING +endorsement_signature: STRING +operations_kind: STRING +operations_level: INTEGER +slot``: INTEGER +slots: INTEGER (REPEATED) +``` + ### origination_operations ``` diff --git a/tezosetl/enums/operation_kinds.py b/tezosetl/enums/operation_kinds.py index 6801ee5..50d8904 100644 --- a/tezosetl/enums/operation_kinds.py +++ b/tezosetl/enums/operation_kinds.py @@ -5,6 +5,7 @@ class OperationKind: double_baking_evidence = 'double_baking_evidence' double_endorsement_evidence = 'double_endorsement_evidence' endorsement = 'endorsement' + endorsement_with_slot = 'endorsement_with_slot' origination = 'origination' proposals = 'proposals' reveal = 'reveal' @@ -18,6 +19,7 @@ class OperationKind: double_baking_evidence, double_endorsement_evidence, endorsement, + endorsement_with_slot, origination, proposals, reveal, diff --git a/tezosetl/mappers/operation_mapper.py b/tezosetl/mappers/operation_mapper.py index 7e0983e..0d199a9 100644 --- a/tezosetl/mappers/operation_mapper.py +++ b/tezosetl/mappers/operation_mapper.py @@ -71,6 +71,8 @@ def map_base_operation(block, operation_group_index, operation_index, content_in def map_operation(operation_kind, content, base_operation): if operation_kind == OperationKind.endorsement: return map_endorsement(content, base_operation) + elif operation_kind == OperationKind.endorsement_with_slot: + return map_endorsement_with_slot(content, base_operation) elif operation_kind == OperationKind.transaction: return map_transaction(content, base_operation) elif operation_kind == OperationKind.delegation: @@ -104,6 +106,21 @@ def map_endorsement(content, base_operation): }} +def map_endorsement_with_slot(content, base_operation): + metadata = content.get('metadata', EMPTY_OBJECT) + endorsement = content.get('endorsement', EMPTY_OBJECT) + operations = endorsement.get('operations', EMPTY_OBJECT) + return {**base_operation, **{ + 'delegate': metadata.get('delegate'), + 'endorsement_branch': endorsement.get('branch'), + 'endorsement_signature': endorsement.get('signature'), + 'operations_kind': operations.get('kind'), + 'operations_level': operations.get('level'), + 'slot': content.get('slot'), + 'slots': metadata.get('slots') + }} + + def map_transaction(content, base_operation): operation_result = get_operation_result(content)