Repository navigation
feat(api): add event_count to v3 transaction summaries - #2724
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The shared-layer changes are consistent and no blocking issues were identified; tests were not executed.
No open issues 🎉
What changed in this PR
Adds event_count to shared v3 transaction summaries so listing endpoints expose it alongside the single-transaction endpoint.
Changes:
- Moves the field into shared datastore types, query columns, schemas, and serialization.
- Updates endpoint tests to assert zero and nonzero event counts.
| File | Description |
|---|---|
| tests/api/transactions/tx-v3.test.ts | Checks counts in transaction lists. |
| tests/api/transactions/tx-batch-v3.test.ts | Checks counts in batch summaries. |
| tests/api/principal-v3/principals.test.ts | Updates principal transaction expectations. |
| tests/api/blocks/block-v3.test.ts | Checks counts in block transactions. |
| src/datastore/v3/types.ts | Adds the field to the shared summary type. |
| src/datastore/v3/constants.ts | Includes the field in summary queries. |
| src/api/serializers/v3/transactions.ts | Serializes the field through shared summaries. |
| src/api/schemas/v3/entities/transactions.ts | Removes the redundant full-transaction declaration. |
| src/api/schemas/v3/entities/transaction-summaries.ts | Declares the field in the shared response schema. |
Review effort: Balanced
rafa-stacks
marked this pull request as ready for review
October 19, 2026 21:11
bgridley-stacks
approved these changes
Oct 19, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
event_countto the v3 transaction summary, so it is now returned by every v3 endpoint that lists transaction summaries (transactions list and batch, block transactions, principal transactions, and search), not only by the single-transaction endpoint.Sample responses below were captured from the real endpoints against a seeded test fixture.
TestBlockBuilderderivesblock.timeand setsbitcoin_block.heightequal to the block height, so those values are fixture artifacts.`GET /extended/v3/transactions?limit=1`
{ "total": 3, "limit": 1, "cursor": { "next": "2:0:0", "previous": null, "current": "2:0:1" }, "results": [ { "tx_id": "0xc3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3", "sender": { "address": "ST3J8EVYHVKH6XXPD61EE8XEHW4Y2K83861225AB1", "nonce": 2 }, "sponsor": null, "fee_rate": "3000", "block": { "height": 2, "hash": "0x0202020202020202020202020202020202020202020202020202020202020202", "index_hash": "0x2222222222222222222222222222222222222222222222222222222222222222", "time": 94869287, "time_iso": "1973-01-03T00:34:47.000Z", "tx_index": 1 }, "bitcoin_block": { "height": 2, "time": 1760000600, "time_iso": "2025-10-09T09:03:20.000Z" }, "status": "success", "event_count": 3, "type": "contract_call", "contract_call": { "contract_id": "ST000000000000000000002AMW42H.pox-5", "function_name": "stake" } } ] }`GET /extended/v3/blocks/2/transactions?limit=1`
{ "total": 2, "limit": 1, "cursor": { "next": "2:0:0", "previous": null, "current": "2:0:1" }, "results": [ { "tx_id": "0xc3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3", "sender": { "address": "ST3J8EVYHVKH6XXPD61EE8XEHW4Y2K83861225AB1", "nonce": 2 }, "sponsor": null, "fee_rate": "3000", "block": { "height": 2, "hash": "0x0202020202020202020202020202020202020202020202020202020202020202", "index_hash": "0x2222222222222222222222222222222222222222222222222222222222222222", "time": 94869287, "time_iso": "1973-01-03T00:34:47.000Z", "tx_index": 1 }, "bitcoin_block": { "height": 2, "time": 1760000600, "time_iso": "2025-10-09T09:03:20.000Z" }, "status": "success", "event_count": 3, "type": "contract_call", "contract_call": { "contract_id": "ST000000000000000000002AMW42H.pox-5", "function_name": "stake" } } ] }`GET /extended/v3/principals/{principal}/transactions?limit=1`
{ "total": 3, "limit": 1, "cursor": { "next": "2:0:0", "previous": null, "current": "2:0:1" }, "results": [ { "transaction": { "tx_id": "0xc3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3", "sender": { "address": "ST3J8EVYHVKH6XXPD61EE8XEHW4Y2K83861225AB1", "nonce": 2 }, "sponsor": null, "fee_rate": "3000", "block": { "height": 2, "hash": "0x0202020202020202020202020202020202020202020202020202020202020202", "index_hash": "0x2222222222222222222222222222222222222222222222222222222222222222", "time": 94869287, "time_iso": "1973-01-03T00:34:47.000Z", "tx_index": 1 }, "bitcoin_block": { "height": 2, "time": 1760000600, "time_iso": "2025-10-09T09:03:20.000Z" }, "status": "success", "event_count": 3, "type": "contract_call", "contract_call": { "contract_id": "ST000000000000000000002AMW42H.pox-5", "function_name": "stake" } }, "involvement": "sender", "balance_changes": { "stx": { "sent": "3006", "received": "0", "net": "-3006" } }, "affected_balances": { "stx": true, "ft": false, "nft": false } } ] }`GET /extended/v3/transactions/batch?tx_id=…`
{ "results": [ { "tx_id": "0xb2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2", "sender": { "address": "ST3J8EVYHVKH6XXPD61EE8XEHW4Y2K83861225AB1", "nonce": 1 }, "sponsor": null, "fee_rate": "180", "block": { "height": 2, "hash": "0x0202020202020202020202020202020202020202020202020202020202020202", "index_hash": "0x2222222222222222222222222222222222222222222222222222222222222222", "time": 94869287, "time_iso": "1973-01-03T00:34:47.000Z", "tx_index": 0 }, "bitcoin_block": { "height": 2, "time": 1760000600, "time_iso": "2025-10-09T09:03:20.000Z" }, "status": "success", "event_count": 1, "type": "token_transfer", "token_transfer": { "recipient": "STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6", "amount": "2500000", "memo": { "hex": "0x", "repr": "" } } }, { "tx_id": "0xa1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1", "sender": { "address": "ST3J8EVYHVKH6XXPD61EE8XEHW4Y2K83861225AB1", "nonce": 0 }, "sponsor": null, "fee_rate": "0", "block": { "height": 1, "hash": "0x0101010101010101010101010101010101010101010101010101010101010101", "index_hash": "0x1111111111111111111111111111111111111111111111111111111111111111", "time": 94869287, "time_iso": "1973-01-03T00:34:47.000Z", "tx_index": 0 }, "bitcoin_block": { "height": 1, "time": 1760000000, "time_iso": "2025-10-09T08:53:20.000Z" }, "status": "success", "event_count": 0, "type": "coinbase", "coinbase": { "alt_recipient": null } } ] }`GET /extended/v3/search?q={tx_id}&type=transaction`
{ "results": [ { "type": "transaction", "result": { "tx_id": "0xc3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3", "sender": { "address": "ST3J8EVYHVKH6XXPD61EE8XEHW4Y2K83861225AB1", "nonce": 2 }, "sponsor": null, "fee_rate": "3000", "block": { "height": 2, "hash": "0x0202020202020202020202020202020202020202020202020202020202020202", "index_hash": "0x2222222222222222222222222222222222222222222222222222222222222222", "time": 94869287, "time_iso": "1973-01-03T00:34:47.000Z", "tx_index": 1 }, "bitcoin_block": { "height": 2, "time": 1760000600, "time_iso": "2025-10-09T09:03:20.000Z" }, "status": "success", "event_count": 3, "type": "contract_call", "contract_call": { "contract_id": "ST000000000000000000002AMW42H.pox-5", "function_name": "stake" } } } ] }