diff --git a/src/blockchain/utils.ts b/src/blockchain/utils.ts index 6010725..92df871 100644 --- a/src/blockchain/utils.ts +++ b/src/blockchain/utils.ts @@ -40,11 +40,17 @@ export function createEvent( export function createAction( accountUpdateId: string, data: string[], - transactionInfo: TransactionInfo + transactionInfo: TransactionInfo, + sequenceNumber: number, + zkappAccountUpdateIds: number[], + zkappEventElementIds: number[] ): Action { return { accountUpdateId, data, transactionInfo, + sequenceNumber, + zkappAccountUpdateIds, + zkappEventElementIds, }; } diff --git a/src/db/sql/events-actions/queries.ts b/src/db/sql/events-actions/queries.ts index 80d7593..73ca386 100644 --- a/src/db/sql/events-actions/queries.ts +++ b/src/db/sql/events-actions/queries.ts @@ -108,7 +108,7 @@ function emittedZkAppCommandsCTE(db_client: postgres.Sql) { SELECT blocks_accessed.*, zkcu.id AS zkapp_account_update_id, - bzkc.sequence_no, + bzkc.sequence_no AS sequence_number, zkapp_fee_payer_body_id, zkapp_account_updates_ids, authorization_kind, diff --git a/src/db/sql/events-actions/types.ts b/src/db/sql/events-actions/types.ts index 1bc7bfe..31f2ae6 100644 --- a/src/db/sql/events-actions/types.ts +++ b/src/db/sql/events-actions/types.ts @@ -33,6 +33,9 @@ export type ArchiveNodeDatabaseRow = { // Current status of the block within the chain. chain_status: string; + // Sequence number of the transaction within a block + sequence_number: number; + // Hash representing the ledger state. ledger_hash: string; diff --git a/src/services/data-adapters/database-row-adapters.ts b/src/services/data-adapters/database-row-adapters.ts index e8100a1..0d7a0f2 100644 --- a/src/services/data-adapters/database-row-adapters.ts +++ b/src/services/data-adapters/database-row-adapters.ts @@ -210,11 +210,19 @@ function mapActionOrEvent( const event = createEvent(elementIdToFieldValues, transactionInfo); data.push(event); } else { - const { zkapp_account_update_id } = rows[i]; + const { + zkapp_account_update_id, + zkapp_account_updates_ids, + sequence_number, + zkapp_event_element_ids, + } = rows[i]; const action = createAction( zkapp_account_update_id.toString(), elementIdToFieldValues, - transactionInfo + transactionInfo, + sequence_number, + zkapp_account_updates_ids, + zkapp_event_element_ids ); data.push(action); }