Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/api/schemas/v3/entities/transaction-summaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export const BaseTransactionSummarySchema = Type.Object({
block: BlockPositionSchema,
bitcoin_block: BitcoinBlockPositionSchema,
status: TransactionStatusSchema,
event_count: Type.Integer({
description: 'Number of events in the transaction',
}),
});
export type BaseTransactionSummary = Static<typeof BaseTransactionSummarySchema>;

Expand Down
3 changes: 0 additions & 3 deletions src/api/schemas/v3/entities/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ const BaseTransactionSchema = Type.Composite([
description: 'Only present when requested via the `include=post_conditions` query param.',
})
),
event_count: Type.Integer({
description: 'Number of events in the transaction',
}),
execution_cost: ExecutionCostSchema,
vm_error: Nullable(
Type.String({
Expand Down
2 changes: 1 addition & 1 deletion src/api/serializers/v3/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export function serializeDbTransactionSummary(summary: DbTransactionSummary): Tr
time_iso: unixEpochToIso(summary.burn_block_time),
},
status: serializeDbTransactionStatus(summary.status),
event_count: summary.event_count,
};
switch (summary.type_id) {
case DbTxTypeId.TokenTransfer: {
Expand Down Expand Up @@ -241,7 +242,6 @@ export function serializeDbTransaction(
hash: transaction.parent_block_hash,
index_hash: transaction.parent_index_block_hash,
},
event_count: transaction.event_count,
// execution_cost_* arrive as decimal strings from Postgres (BIGINT). Coerce to ints
// to match the response schema; v1/v2 do the same in `datastore/helpers.ts`.
execution_cost: {
Expand Down
2 changes: 1 addition & 1 deletion src/datastore/v3/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const TX_SUMMARY_COLUMNS = [
'contract_call_function_name',
'coinbase_alt_recipient',
'tenure_change_cause',
'event_count',
];

// Heavy columns (post_conditions, raw_result, smart_contract_source_code,
Expand All @@ -46,7 +47,6 @@ export const TX_COLUMNS = [
...TX_SUMMARY_COLUMNS,
'parent_block_hash',
'parent_index_block_hash',
'event_count',
'execution_cost_read_count',
'execution_cost_read_length',
'execution_cost_runtime',
Expand Down
2 changes: 1 addition & 1 deletion src/datastore/v3/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ export interface DbTransactionSummary extends DbTxLocation {
contract_call_function_name: string | null;
coinbase_alt_recipient: string | null;
tenure_change_cause: number | null;
event_count: number;
}

export interface DbTransaction extends DbTransactionSummary {
post_conditions: string;
event_count: number;
execution_cost_read_count: number;
execution_cost_read_length: number;
execution_cost_runtime: number;
Expand Down
3 changes: 3 additions & 0 deletions tests/api/blocks/block-v3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ describe('v3 blocks', () => {
burn_block_time: 1000,
tx_index: 1,
fee_rate: 75n,
event_count: 2,
type_id: DbTxTypeId.TokenTransfer,
status: DbTxStatus.Success,
sender_address: SENDER,
Expand Down Expand Up @@ -166,6 +167,7 @@ describe('v3 blocks', () => {
},
sponsor: null,
fee_rate: '75',
event_count: 2,
token_transfer: {
recipient: RECIPIENT,
amount: '100',
Expand Down Expand Up @@ -198,6 +200,7 @@ describe('v3 blocks', () => {
},
sponsor: null,
fee_rate: '50',
event_count: 0,
coinbase: {
alt_recipient: null,
},
Expand Down
2 changes: 2 additions & 0 deletions tests/api/principal-v3/principals.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ describe('principals', () => {
},
sponsor: null,
fee_rate: '50',
event_count: 0,
block: {
height: 2,
hash: hex(2),
Expand Down Expand Up @@ -211,6 +212,7 @@ describe('principals', () => {
},
sponsor: null,
fee_rate: '50',
event_count: 0,
block: {
height: 1,
hash: hex(1),
Expand Down
5 changes: 3 additions & 2 deletions tests/api/transactions/tx-batch-v3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ describe('v3 transactions batch', () => {
.addTx({
tx_id: TX_3,
tx_index: 0,
event_count: 4,
block_hash: '0x0002',
index_block_hash: '0x0002',
type_id: DbTxTypeId.Coinbase,
Expand Down Expand Up @@ -137,13 +138,13 @@ describe('v3 transactions batch', () => {
body.results.map((r: { tx_id: string }) => r.tx_id),
[TX_3, TX_1]
);
// Summary shape, not full transaction: no event_count / execution_cost / post_conditions.
// Summary shape, not full transaction: no execution_cost / post_conditions.
const summary = body.results[0];
assert.equal(summary.block.height, 2);
assert.equal(summary.sender.address, SENDER);
assert.equal(summary.status, 'success');
assert.equal(summary.type, 'coinbase');
assert.equal('event_count' in summary, false);
assert.equal(summary.event_count, 4);
assert.equal('execution_cost' in summary, false);
});

Expand Down
3 changes: 3 additions & 0 deletions tests/api/transactions/tx-v3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ describe('v3 transactions', () => {
tx_id: '0x0002',
tx_index: 0,
fee_rate: 50n,
event_count: 3,
block_hash: '0x0002',
index_block_hash: '0x0002',
block_time: 2000,
Expand Down Expand Up @@ -131,6 +132,7 @@ describe('v3 transactions', () => {
},
sponsor: null,
fee_rate: '50',
event_count: 3,
token_transfer: {
recipient: 'STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6',
amount: '100',
Expand Down Expand Up @@ -163,6 +165,7 @@ describe('v3 transactions', () => {
},
sponsor: null,
fee_rate: '50',
event_count: 0,
coinbase: {
alt_recipient: null,
},
Expand Down
Loading