From ad59681f8756e692618dcb906f51221b2c30ceef Mon Sep 17 00:00:00 2001 From: Rafael Cardenas Date: Fri, 16 May 2025 11:38:04 -0600 Subject: [PATCH 1/8] feat: store and expose vm_error in failed transactions --- client/src/generated/schema.d.ts | 2384 +++++++++++++++------- migrations/1747408872545_txs-vm-error.js | 11 + src/api/controllers/db-controller.ts | 1 + src/api/schemas/entities/transactions.ts | 1 + src/datastore/common.ts | 3 + src/datastore/helpers.ts | 1 + src/datastore/pg-write-store.ts | 2 + src/event-stream/core-node-message.ts | 1 + tests/api/address.test.ts | 9 + tests/api/search.test.ts | 2 + tests/api/tx.test.ts | 9 + tests/api/websocket.test.ts | 2 + 12 files changed, 1664 insertions(+), 762 deletions(-) create mode 100644 migrations/1747408872545_txs-vm-error.js diff --git a/client/src/generated/schema.d.ts b/client/src/generated/schema.d.ts index f444cc972..e11063984 100644 --- a/client/src/generated/schema.d.ts +++ b/client/src/generated/schema.d.ts @@ -86,31 +86,6 @@ export interface paths { patch?: never; trace?: never; }; - "/extended/v1/tx/mempool/dropped": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - /** - * Get dropped mempool transactions - * @description Retrieves all recently-broadcast transactions that have been dropped from the mempool. - * - * Transactions are dropped from the mempool if: - * * they were stale and awaiting garbage collection or, - * * were expensive, or - * * were replaced with a new fee - */ - get: operations["get_dropped_mempool_transaction_list"]; - put?: never; - post?: never; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; "/extended/v1/tx/mempool/stats": { parameters: { query?: never; @@ -820,7 +795,10 @@ export interface paths { }; /** * Get account STX balance - * @description Retrieves STX token balance for a given Address or Contract Identifier. + * @deprecated + * @description **NOTE:** This endpoint is deprecated in favor of [Get address STX balance](/api/get-principal-stx-balance). + * + * Retrieves STX token balance for a given Address or Contract Identifier. */ get: operations["get_account_stx_balance"]; put?: never; @@ -840,7 +818,10 @@ export interface paths { }; /** * Get account balances - * @description Retrieves total account balance information for a given Address or Contract Identifier. This includes the balances of STX Tokens, Fungible Tokens and Non-Fungible Tokens for the account. + * @deprecated + * @description **NOTE:** This endpoint is deprecated in favor of [Get address FT balances](/api/get-principal-ft-balances). + * + * Retrieves total account balance information for a given Address or Contract Identifier. This includes the balances of STX Tokens, Fungible Tokens and Non-Fungible Tokens for the account. */ get: operations["get_account_balance"]; put?: never; @@ -1166,13 +1147,13 @@ export interface paths { get?: never; put?: never; /** - * Add testnet BTC tokens to address - * @description Add 1 BTC token to the specified testnet BTC address. + * Add regtest BTC tokens to address + * @description Add 0.01 BTC token to the specified regtest BTC address. * - * The endpoint returns the transaction ID, which you can use to view the transaction in a testnet Bitcoin block + * The endpoint returns the transaction ID, which you can use to view the transaction in a regtest Bitcoin block * explorer. The tokens are delivered once the transaction has been included in a block. * - * **Note:** This is a testnet only endpoint. This endpoint will not work on the mainnet. + * **Note:** This is a Bitcoin regtest-only endpoint. This endpoint will not work on the Bitcoin mainnet. */ post: operations["run_faucet_btc"]; delete?: never; @@ -1309,6 +1290,26 @@ export interface paths { patch?: never; trace?: never; }; + "/extended/v2/blocks/{height_or_hash}/signer-signatures": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get signer signatures for block + * @description Retrieves the signer signatures (an array of signature byte strings) in a single block + */ + get: operations["get_signer_signatures_for_block"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/extended/v2/burn-blocks/": { parameters: { query?: never; @@ -1369,6 +1370,26 @@ export interface paths { patch?: never; trace?: never; }; + "/extended/v2/block-tenures/{tenure_height}/blocks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get blocks by tenure + * @description Retrieves blocks confirmed in a block tenure + */ + get: operations["get_tenure_blocks"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/extended/v2/smart-contracts/status": { parameters: { query?: never; @@ -1551,6 +1572,66 @@ export interface paths { patch?: never; trace?: never; }; + "/extended/v2/addresses/{principal}/balances/stx": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get principal STX balance + * @description Retrieves STX account balance information for a given Address or Contract Identifier. + */ + get: operations["get_principal_stx_balance"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/extended/v2/addresses/{principal}/balances/ft": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get principal FT balances + * @description Retrieves Fungible-token account balance information for a given Address or Contract Identifier. + */ + get: operations["get_principal_ft_balances"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/extended/v2/addresses/{principal}/balances/ft/{token}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get principal FT balance + * @description Retrieves a specific fungible-token balance for a given principal. + */ + get: operations["get_principal_ft_balance"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/v1/names/{name}/zonefile/{zoneFileHash}": { parameters: { query?: never; @@ -1803,6 +1884,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_transaction_list: { @@ -2007,6 +2102,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -2221,6 +2317,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -2435,6 +2532,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -2656,6 +2754,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -2869,6 +2968,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -3082,6 +3182,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -3172,6 +3273,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_tx_list_details: { @@ -3341,6 +3456,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -3555,6 +3671,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -3769,6 +3886,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -3990,6 +4108,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -4203,6 +4322,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -4416,6 +4536,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -5121,6 +5242,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_mempool_transaction_list: { @@ -5786,11 +5921,104 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; + }; + }; + get_mempool_transaction_stats: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description GET request that returns stats on mempool transactions */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @description Number of tranasction in the mempool, broken down by transaction type. */ + tx_type_counts: { + [key: string]: number; + }; + /** @description The simple mean (average) transaction fee, broken down by transaction type. Note that this does not factor in actual execution costs. The average fee is not a reliable metric for calculating a fee for a new transaction. */ + tx_simple_fee_averages: { + [key: string]: { + p25: number | null; + p50: number | null; + p75: number | null; + p95: number | null; + } & { + [key: string]: unknown; + }; + }; + /** @description The average time (in blocks) that transactions have lived in the mempool. The start block height is simply the current chain-tip of when the attached Stacks node receives the transaction. This timing can be different across Stacks nodes / API instances due to propagation timing differences in the p2p network. */ + tx_ages: { + [key: string]: { + p25: number | null; + p50: number | null; + p75: number | null; + p95: number | null; + } & { + [key: string]: unknown; + }; + }; + /** @description The average byte size of transactions in the mempool, broken down by transaction type. */ + tx_byte_sizes: { + [key: string]: { + p25: number | null; + p50: number | null; + p75: number | null; + p95: number | null; + } & { + [key: string]: unknown; + }; + }; + }; + }; + }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; - get_dropped_mempool_transaction_list: { + get_filtered_events: { parameters: { query?: { + /** + * @description Transaction ID + * @example 0xf6bd5f4a7b26184a3466340b2e99fd003b4962c0e382a7e4b6a13df3dd7a91c6 + */ + tx_id?: string; + address?: string; + type?: ("smart_contract_log" | "stx_lock" | "stx_asset" | "fungible_token_asset" | "non_fungible_token_asset")[]; /** @description Result offset */ offset?: number; /** @description Results per page */ @@ -5802,7 +6030,7 @@ export interface operations { }; requestBody?: never; responses: { - /** @description List of dropped mempool transactions */ + /** @description Default Response */ 200: { headers: { [name: string]: unknown; @@ -5813,717 +6041,11 @@ export interface operations { limit: number; /** @example 0 */ offset: number; - /** @example 1 */ - total: number; - results: ({ - /** @description Transaction ID */ - tx_id: string; - /** @description Used for ordering the transactions originating from and paying from an account. The nonce ensures that a transaction is processed at most once. The nonce counts the number of times an account's owner(s) have authorized a transaction. The first transaction from an account will have a nonce value equal to 0, the second will have a nonce value equal to 1, and so on. */ - nonce: number; - /** @description Transaction fee as Integer string (64-bit unsigned integer). */ - fee_rate: string; - /** @description Address of the transaction initiator */ - sender_address: string; - sponsor_nonce?: number; - /** @description Denotes whether the originating account is the same as the paying account */ - sponsored: boolean; - sponsor_address?: string; - post_condition_mode: "allow" | "deny"; - post_conditions: ({ - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent_equal_to" | "sent_greater_than" | "sent_greater_than_or_equal_to" | "sent_less_than" | "sent_less_than_or_equal_to"; - amount: string; - /** @enum {string} */ - type: "stx"; - } | { - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent_equal_to" | "sent_greater_than" | "sent_greater_than_or_equal_to" | "sent_less_than" | "sent_less_than_or_equal_to"; - amount: string; - /** @enum {string} */ - type: "fungible"; - asset: { - asset_name: string; - contract_address: string; - contract_name: string; - }; - } | { - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent" | "not_sent"; - /** @enum {string} */ - type: "non_fungible"; - asset_value: { - hex: string; - repr: string; - }; - asset: { - asset_name: string; - contract_address: string; - contract_name: string; - }; - })[]; - /** @description `on_chain_only`: the transaction MUST be included in an anchored block, `off_chain_only`: the transaction MUST be included in a microblock, `any`: the leader can choose where to include the transaction. */ - anchor_mode: "on_chain_only" | "off_chain_only" | "any"; - /** @description Status of the transaction */ - tx_status: "pending" | "dropped_replace_by_fee" | "dropped_replace_across_fork" | "dropped_too_expensive" | "dropped_stale_garbage_collect" | "dropped_problematic"; - /** @description A unix timestamp (in seconds) indicating when the transaction broadcast was received by the node. */ - receipt_time: number; - /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when the transaction broadcast was received by the node. */ - receipt_time_iso: string; - /** @enum {string} */ - tx_type: "token_transfer"; - token_transfer: { - recipient_address: string; - /** @description Transfer amount as Integer string (64-bit unsigned integer) */ - amount: string; - /** @description Hex encoded arbitrary message, up to 34 bytes length (should try decoding to an ASCII string) */ - memo: string; - }; - } | { - /** @description Transaction ID */ - tx_id: string; - /** @description Used for ordering the transactions originating from and paying from an account. The nonce ensures that a transaction is processed at most once. The nonce counts the number of times an account's owner(s) have authorized a transaction. The first transaction from an account will have a nonce value equal to 0, the second will have a nonce value equal to 1, and so on. */ - nonce: number; - /** @description Transaction fee as Integer string (64-bit unsigned integer). */ - fee_rate: string; - /** @description Address of the transaction initiator */ - sender_address: string; - sponsor_nonce?: number; - /** @description Denotes whether the originating account is the same as the paying account */ - sponsored: boolean; - sponsor_address?: string; - post_condition_mode: "allow" | "deny"; - post_conditions: ({ - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent_equal_to" | "sent_greater_than" | "sent_greater_than_or_equal_to" | "sent_less_than" | "sent_less_than_or_equal_to"; - amount: string; - /** @enum {string} */ - type: "stx"; - } | { - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent_equal_to" | "sent_greater_than" | "sent_greater_than_or_equal_to" | "sent_less_than" | "sent_less_than_or_equal_to"; - amount: string; - /** @enum {string} */ - type: "fungible"; - asset: { - asset_name: string; - contract_address: string; - contract_name: string; - }; - } | { - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent" | "not_sent"; - /** @enum {string} */ - type: "non_fungible"; - asset_value: { - hex: string; - repr: string; - }; - asset: { - asset_name: string; - contract_address: string; - contract_name: string; - }; - })[]; - /** @description `on_chain_only`: the transaction MUST be included in an anchored block, `off_chain_only`: the transaction MUST be included in a microblock, `any`: the leader can choose where to include the transaction. */ - anchor_mode: "on_chain_only" | "off_chain_only" | "any"; - /** @description Status of the transaction */ - tx_status: "pending" | "dropped_replace_by_fee" | "dropped_replace_across_fork" | "dropped_too_expensive" | "dropped_stale_garbage_collect" | "dropped_problematic"; - /** @description A unix timestamp (in seconds) indicating when the transaction broadcast was received by the node. */ - receipt_time: number; - /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when the transaction broadcast was received by the node. */ - receipt_time_iso: string; - /** @enum {string} */ - tx_type: "smart_contract"; - smart_contract: { - clarity_version: number | null; - /** @description Contract identifier formatted as `.` */ - contract_id: string; - /** @description Clarity code of the smart contract being deployed */ - source_code: string; - }; - } | { - /** @description Transaction ID */ - tx_id: string; - /** @description Used for ordering the transactions originating from and paying from an account. The nonce ensures that a transaction is processed at most once. The nonce counts the number of times an account's owner(s) have authorized a transaction. The first transaction from an account will have a nonce value equal to 0, the second will have a nonce value equal to 1, and so on. */ - nonce: number; - /** @description Transaction fee as Integer string (64-bit unsigned integer). */ - fee_rate: string; - /** @description Address of the transaction initiator */ - sender_address: string; - sponsor_nonce?: number; - /** @description Denotes whether the originating account is the same as the paying account */ - sponsored: boolean; - sponsor_address?: string; - post_condition_mode: "allow" | "deny"; - post_conditions: ({ - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent_equal_to" | "sent_greater_than" | "sent_greater_than_or_equal_to" | "sent_less_than" | "sent_less_than_or_equal_to"; - amount: string; - /** @enum {string} */ - type: "stx"; - } | { - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent_equal_to" | "sent_greater_than" | "sent_greater_than_or_equal_to" | "sent_less_than" | "sent_less_than_or_equal_to"; - amount: string; - /** @enum {string} */ - type: "fungible"; - asset: { - asset_name: string; - contract_address: string; - contract_name: string; - }; - } | { - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent" | "not_sent"; - /** @enum {string} */ - type: "non_fungible"; - asset_value: { - hex: string; - repr: string; - }; - asset: { - asset_name: string; - contract_address: string; - contract_name: string; - }; - })[]; - /** @description `on_chain_only`: the transaction MUST be included in an anchored block, `off_chain_only`: the transaction MUST be included in a microblock, `any`: the leader can choose where to include the transaction. */ - anchor_mode: "on_chain_only" | "off_chain_only" | "any"; - /** @description Status of the transaction */ - tx_status: "pending" | "dropped_replace_by_fee" | "dropped_replace_across_fork" | "dropped_too_expensive" | "dropped_stale_garbage_collect" | "dropped_problematic"; - /** @description A unix timestamp (in seconds) indicating when the transaction broadcast was received by the node. */ - receipt_time: number; - /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when the transaction broadcast was received by the node. */ - receipt_time_iso: string; - /** @enum {string} */ - tx_type: "contract_call"; - contract_call: { - /** @description Contract identifier formatted as `.` */ - contract_id: string; - /** @description Name of the Clarity function to be invoked */ - function_name: string; - /** @description Function definition, including function name and type as well as parameter names and types */ - function_signature: string; - function_args?: { - hex: string; - repr: string; - name: string; - type: string; - }[]; - }; - } | { - /** @description Transaction ID */ - tx_id: string; - /** @description Used for ordering the transactions originating from and paying from an account. The nonce ensures that a transaction is processed at most once. The nonce counts the number of times an account's owner(s) have authorized a transaction. The first transaction from an account will have a nonce value equal to 0, the second will have a nonce value equal to 1, and so on. */ - nonce: number; - /** @description Transaction fee as Integer string (64-bit unsigned integer). */ - fee_rate: string; - /** @description Address of the transaction initiator */ - sender_address: string; - sponsor_nonce?: number; - /** @description Denotes whether the originating account is the same as the paying account */ - sponsored: boolean; - sponsor_address?: string; - post_condition_mode: "allow" | "deny"; - post_conditions: ({ - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent_equal_to" | "sent_greater_than" | "sent_greater_than_or_equal_to" | "sent_less_than" | "sent_less_than_or_equal_to"; - amount: string; - /** @enum {string} */ - type: "stx"; - } | { - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent_equal_to" | "sent_greater_than" | "sent_greater_than_or_equal_to" | "sent_less_than" | "sent_less_than_or_equal_to"; - amount: string; - /** @enum {string} */ - type: "fungible"; - asset: { - asset_name: string; - contract_address: string; - contract_name: string; - }; - } | { - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent" | "not_sent"; - /** @enum {string} */ - type: "non_fungible"; - asset_value: { - hex: string; - repr: string; - }; - asset: { - asset_name: string; - contract_address: string; - contract_name: string; - }; - })[]; - /** @description `on_chain_only`: the transaction MUST be included in an anchored block, `off_chain_only`: the transaction MUST be included in a microblock, `any`: the leader can choose where to include the transaction. */ - anchor_mode: "on_chain_only" | "off_chain_only" | "any"; - /** @description Status of the transaction */ - tx_status: "pending" | "dropped_replace_by_fee" | "dropped_replace_across_fork" | "dropped_too_expensive" | "dropped_stale_garbage_collect" | "dropped_problematic"; - /** @description A unix timestamp (in seconds) indicating when the transaction broadcast was received by the node. */ - receipt_time: number; - /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when the transaction broadcast was received by the node. */ - receipt_time_iso: string; - /** @enum {string} */ - tx_type: "poison_microblock"; - poison_microblock: { - /** @description Hex encoded microblock header */ - microblock_header_1: string; - /** @description Hex encoded microblock header */ - microblock_header_2: string; - }; - } | { - /** @description Transaction ID */ - tx_id: string; - /** @description Used for ordering the transactions originating from and paying from an account. The nonce ensures that a transaction is processed at most once. The nonce counts the number of times an account's owner(s) have authorized a transaction. The first transaction from an account will have a nonce value equal to 0, the second will have a nonce value equal to 1, and so on. */ - nonce: number; - /** @description Transaction fee as Integer string (64-bit unsigned integer). */ - fee_rate: string; - /** @description Address of the transaction initiator */ - sender_address: string; - sponsor_nonce?: number; - /** @description Denotes whether the originating account is the same as the paying account */ - sponsored: boolean; - sponsor_address?: string; - post_condition_mode: "allow" | "deny"; - post_conditions: ({ - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent_equal_to" | "sent_greater_than" | "sent_greater_than_or_equal_to" | "sent_less_than" | "sent_less_than_or_equal_to"; - amount: string; - /** @enum {string} */ - type: "stx"; - } | { - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent_equal_to" | "sent_greater_than" | "sent_greater_than_or_equal_to" | "sent_less_than" | "sent_less_than_or_equal_to"; - amount: string; - /** @enum {string} */ - type: "fungible"; - asset: { - asset_name: string; - contract_address: string; - contract_name: string; - }; - } | { - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent" | "not_sent"; - /** @enum {string} */ - type: "non_fungible"; - asset_value: { - hex: string; - repr: string; - }; - asset: { - asset_name: string; - contract_address: string; - contract_name: string; - }; - })[]; - /** @description `on_chain_only`: the transaction MUST be included in an anchored block, `off_chain_only`: the transaction MUST be included in a microblock, `any`: the leader can choose where to include the transaction. */ - anchor_mode: "on_chain_only" | "off_chain_only" | "any"; - /** @description Status of the transaction */ - tx_status: "pending" | "dropped_replace_by_fee" | "dropped_replace_across_fork" | "dropped_too_expensive" | "dropped_stale_garbage_collect" | "dropped_problematic"; - /** @description A unix timestamp (in seconds) indicating when the transaction broadcast was received by the node. */ - receipt_time: number; - /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when the transaction broadcast was received by the node. */ - receipt_time_iso: string; - /** @enum {string} */ - tx_type: "coinbase"; - coinbase_payload: { - /** @description Hex encoded 32-byte scratch space for block leader's use */ - data: string; - alt_recipient?: string | null; - vrf_proof?: string | null; - }; - } | { - /** @description Transaction ID */ - tx_id: string; - /** @description Used for ordering the transactions originating from and paying from an account. The nonce ensures that a transaction is processed at most once. The nonce counts the number of times an account's owner(s) have authorized a transaction. The first transaction from an account will have a nonce value equal to 0, the second will have a nonce value equal to 1, and so on. */ - nonce: number; - /** @description Transaction fee as Integer string (64-bit unsigned integer). */ - fee_rate: string; - /** @description Address of the transaction initiator */ - sender_address: string; - sponsor_nonce?: number; - /** @description Denotes whether the originating account is the same as the paying account */ - sponsored: boolean; - sponsor_address?: string; - post_condition_mode: "allow" | "deny"; - post_conditions: ({ - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent_equal_to" | "sent_greater_than" | "sent_greater_than_or_equal_to" | "sent_less_than" | "sent_less_than_or_equal_to"; - amount: string; - /** @enum {string} */ - type: "stx"; - } | { - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent_equal_to" | "sent_greater_than" | "sent_greater_than_or_equal_to" | "sent_less_than" | "sent_less_than_or_equal_to"; - amount: string; - /** @enum {string} */ - type: "fungible"; - asset: { - asset_name: string; - contract_address: string; - contract_name: string; - }; - } | { - principal: { - /** @enum {string} */ - type_id: "principal_origin"; - } | { - /** @enum {string} */ - type_id: "principal_standard"; - address: string; - } | { - /** @enum {string} */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; - condition_code: "sent" | "not_sent"; - /** @enum {string} */ - type: "non_fungible"; - asset_value: { - hex: string; - repr: string; - }; - asset: { - asset_name: string; - contract_address: string; - contract_name: string; - }; - })[]; - /** @description `on_chain_only`: the transaction MUST be included in an anchored block, `off_chain_only`: the transaction MUST be included in a microblock, `any`: the leader can choose where to include the transaction. */ - anchor_mode: "on_chain_only" | "off_chain_only" | "any"; - /** @description Status of the transaction */ - tx_status: "pending" | "dropped_replace_by_fee" | "dropped_replace_across_fork" | "dropped_too_expensive" | "dropped_stale_garbage_collect" | "dropped_problematic"; - /** @description A unix timestamp (in seconds) indicating when the transaction broadcast was received by the node. */ - receipt_time: number; - /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when the transaction broadcast was received by the node. */ - receipt_time_iso: string; - /** @enum {string} */ - tx_type: "tenure_change"; - tenure_change_payload: { - /** @description Consensus hash of this tenure. Corresponds to the sortition in which the miner of this block was chosen. */ - tenure_consensus_hash: string; - /** @description Consensus hash of the previous tenure. Corresponds to the sortition of the previous winning block-commit. */ - prev_tenure_consensus_hash: string; - /** @description Current consensus hash on the underlying burnchain. Corresponds to the last-seen sortition. */ - burn_view_consensus_hash: string; - /** @description (Hex string) Stacks Block hash */ - previous_tenure_end: string; - /** @description The number of blocks produced in the previous tenure. */ - previous_tenure_blocks: number; - /** @description Cause of change in mining tenure. Depending on cause, tenure can be ended or extended. */ - cause: "block_found" | "extended"; - /** @description (Hex string) The ECDSA public key hash of the current tenure. */ - pubkey_hash: string; - }; - })[]; - }; - }; - }; - }; - }; - get_mempool_transaction_stats: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description GET request that returns stats on mempool transactions */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @description Number of tranasction in the mempool, broken down by transaction type. */ - tx_type_counts: { - [key: string]: number; - }; - /** @description The simple mean (average) transaction fee, broken down by transaction type. Note that this does not factor in actual execution costs. The average fee is not a reliable metric for calculating a fee for a new transaction. */ - tx_simple_fee_averages: { - [key: string]: { - p25: number | null; - p50: number | null; - p75: number | null; - p95: number | null; - } & { - [key: string]: unknown; - }; - }; - /** @description The average time (in blocks) that transactions have lived in the mempool. The start block height is simply the current chain-tip of when the attached Stacks node receives the transaction. This timing can be different across Stacks nodes / API instances due to propagation timing differences in the p2p network. */ - tx_ages: { - [key: string]: { - p25: number | null; - p50: number | null; - p75: number | null; - p95: number | null; - } & { - [key: string]: unknown; - }; - }; - /** @description The average byte size of transactions in the mempool, broken down by transaction type. */ - tx_byte_sizes: { - [key: string]: { - p25: number | null; - p50: number | null; - p75: number | null; - p95: number | null; - } & { - [key: string]: unknown; - }; - }; - }; - }; - }; - }; - }; - get_filtered_events: { - parameters: { - query?: { - /** - * @description Transaction ID - * @example 0xf6bd5f4a7b26184a3466340b2e99fd003b4962c0e382a7e4b6a13df3dd7a91c6 - */ - tx_id?: string; - address?: string; - type?: ("smart_contract_log" | "stx_lock" | "stx_asset" | "fungible_token_asset" | "non_fungible_token_asset")[]; - /** @description Result offset */ - offset?: number; - /** @description Results per page */ - limit?: number; - }; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Default Response */ - 200: { - headers: { - [name: string]: unknown; - }; - content: { - "application/json": { - /** @example 20 */ - limit: number; - /** @example 0 */ - offset: number; - events: (({ - event_index: number; - } & { - /** @enum {string} */ - event_type: "smart_contract_log"; + events: (({ + event_index: number; + } & { + /** @enum {string} */ + event_type: "smart_contract_log"; tx_id: string; contract_log: { contract_id: string; @@ -6590,6 +6112,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_transaction_by_id: { @@ -6760,6 +6296,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -6974,6 +6511,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -7188,6 +6726,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -7409,6 +6948,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -7622,6 +7162,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -7835,6 +7376,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -8532,6 +8074,20 @@ export interface operations { }); }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_raw_transaction_by_id: { @@ -8565,6 +8121,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_transactions_by_block_hash: { @@ -8733,6 +8303,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -8947,6 +8518,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -9161,6 +8733,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -9382,6 +8955,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -9595,6 +9169,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -9808,6 +9383,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -9898,6 +9474,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_transactions_by_block_height: { @@ -10070,6 +9660,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -10284,6 +9875,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -10498,6 +10090,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -10719,6 +10312,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -10932,6 +10526,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -11145,6 +10740,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -11235,6 +10831,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_stx_supply: { @@ -11277,6 +10887,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_stx_supply_total_supply_plain: { @@ -11299,6 +10923,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_stx_supply_circulating_plain: { @@ -11321,6 +10959,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_total_stx_supply_legacy_format: { @@ -11369,6 +11021,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_network_block_times: { @@ -11396,6 +11062,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_network_block_time_by_network: { @@ -11420,6 +11100,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_nft_holdings: { @@ -11431,11 +11125,6 @@ export interface operations { limit?: number; /** @description index of first tokens to fetch */ offset?: number; - /** - * @description Include data from unanchored (i.e. unconfirmed) microblocks - * @example true - */ - unanchored?: boolean; /** @description whether or not to include the complete transaction metadata instead of just `tx_id`. Enabling this option can affect performance and response times. */ tx_metadata: boolean; }; @@ -11616,6 +11305,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -11830,6 +11520,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -12044,6 +11735,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -12265,6 +11957,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -12478,6 +12171,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -12691,6 +12385,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -12782,6 +12477,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_nft_history: { @@ -12976,6 +12685,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -13190,6 +12900,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -13404,6 +13115,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -13625,6 +13337,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -13838,6 +13551,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -14051,6 +13765,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -14142,6 +13857,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_nft_mints: { @@ -14341,6 +14070,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -14555,6 +14285,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -14769,6 +14500,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -14990,6 +14722,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -15203,6 +14936,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -15416,6 +15150,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -15507,6 +15242,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_ft_holders: { @@ -15559,6 +15308,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_contracts_by_trait: { @@ -15600,6 +15363,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_contract_by_id: { @@ -15634,6 +15411,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_contract_events_by_id: { @@ -15736,6 +15527,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; fetch_fee_rate: { @@ -15766,6 +15571,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_microblock_list: { @@ -15827,6 +15646,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_microblock_by_hash: { @@ -15881,6 +15714,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_unanchored_txs: { @@ -16037,6 +15884,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -16251,6 +16099,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -16465,6 +16314,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -16686,6 +16536,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -16899,6 +16750,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -17112,6 +16964,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -17202,6 +17055,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_block_list: { @@ -17242,6 +17109,8 @@ export interface operations { block_time: number; /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. */ block_time_iso: string; + /** @description The tenure height (AKA coinbase height) of this block */ + tenure_height: number; /** @description The only hash that can uniquely identify an anchored block or an unconfirmed state trie */ index_block_hash: string; /** @description Hash of the parent block */ @@ -17284,6 +17153,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_block_by_height: { @@ -17318,6 +17201,8 @@ export interface operations { block_time: number; /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. */ block_time_iso: string; + /** @description The tenure height (AKA coinbase height) of this block */ + tenure_height: number; /** @description The only hash that can uniquely identify an anchored block or an unconfirmed state trie */ index_block_hash: string; /** @description Hash of the parent block */ @@ -17359,6 +17244,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_block_by_burn_block_height: { @@ -17393,6 +17292,8 @@ export interface operations { block_time: number; /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. */ block_time_iso: string; + /** @description The tenure height (AKA coinbase height) of this block */ + tenure_height: number; /** @description The only hash that can uniquely identify an anchored block or an unconfirmed state trie */ index_block_hash: string; /** @description Hash of the parent block */ @@ -17434,6 +17335,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_block_by_hash: { @@ -17468,6 +17383,8 @@ export interface operations { block_time: number; /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. */ block_time_iso: string; + /** @description The tenure height (AKA coinbase height) of this block */ + tenure_height: number; /** @description The only hash that can uniquely identify an anchored block or an unconfirmed state trie */ index_block_hash: string; /** @description Hash of the parent block */ @@ -17509,6 +17426,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_block_by_burn_block_hash: { @@ -17543,6 +17474,8 @@ export interface operations { block_time: number; /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. */ block_time_iso: string; + /** @description The tenure height (AKA coinbase height) of this block */ + tenure_height: number; /** @description The only hash that can uniquely identify an anchored block or an unconfirmed state trie */ index_block_hash: string; /** @description Hash of the parent block */ @@ -17584,6 +17517,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_burnchain_reward_slot_holders: { @@ -17628,6 +17575,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_burnchain_reward_slot_holders_by_address: { @@ -17678,6 +17639,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_burnchain_reward_list: { @@ -17722,6 +17697,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_burnchain_reward_list_by_address: { @@ -17772,6 +17761,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_burnchain_rewards_total_by_address: { @@ -17803,6 +17806,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_account_stx_balance: { @@ -17834,9 +17851,13 @@ export interface operations { balance: string; /** @description Total STX balance considering pending mempool transactions */ estimated_balance?: string; - total_sent: string; - total_received: string; - total_fees_sent: string; + /** @description Inbound STX balance from pending mempool transactions */ + pending_balance_inbound?: string; + /** @description Outbound STX balance from pending mempool transactions */ + pending_balance_outbound?: string; + total_sent?: string; + total_received?: string; + total_fees_sent?: string; total_miner_rewards_received: string; /** @description The transaction where the lock event occurred. Empty if no tokens are locked. */ lock_tx_id: string; @@ -17867,6 +17888,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_account_balance: { @@ -17900,9 +17935,13 @@ export interface operations { balance: string; /** @description Total STX balance considering pending mempool transactions */ estimated_balance?: string; - total_sent: string; - total_received: string; - total_fees_sent: string; + /** @description Inbound STX balance from pending mempool transactions */ + pending_balance_inbound?: string; + /** @description Outbound STX balance from pending mempool transactions */ + pending_balance_outbound?: string; + total_sent?: string; + total_received?: string; + total_fees_sent?: string; total_miner_rewards_received: string; /** @description The transaction where the lock event occurred. Empty if no tokens are locked. */ lock_tx_id: string; @@ -17947,6 +17986,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_account_transactions: { @@ -18124,6 +18177,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -18338,6 +18392,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -18552,6 +18607,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -18773,6 +18829,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -18986,6 +19043,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -19199,6 +19257,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -19289,6 +19348,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_single_transaction_with_transfers: { @@ -19451,6 +19524,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -19665,6 +19739,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -19879,6 +19954,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -20100,6 +20176,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -20313,6 +20390,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -20526,6 +20604,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -20651,6 +20730,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_account_transactions_with_transfers: { @@ -20829,6 +20922,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -21043,6 +21137,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -21257,6 +21352,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -21478,6 +21574,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -21691,6 +21788,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -21904,6 +22002,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -22030,6 +22129,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_account_assets: { @@ -22139,6 +22252,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_account_inbound: { @@ -22198,6 +22325,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_address_mempool_transactions: { @@ -22846,6 +22987,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_account_nonces: { @@ -22888,6 +23043,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; search_by_id: { @@ -22930,9 +23099,13 @@ export interface operations { balance: string; /** @description Total STX balance considering pending mempool transactions */ estimated_balance?: string; - total_sent: string; - total_received: string; - total_fees_sent: string; + /** @description Inbound STX balance from pending mempool transactions */ + pending_balance_inbound?: string; + /** @description Outbound STX balance from pending mempool transactions */ + pending_balance_outbound?: string; + total_sent?: string; + total_received?: string; + total_fees_sent?: string; total_miner_rewards_received: string; /** @description The transaction where the lock event occurred. Empty if no tokens are locked. */ lock_tx_id: string; @@ -22988,6 +23161,8 @@ export interface operations { block_time: number; /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. */ block_time_iso: string; + /** @description The tenure height (AKA coinbase height) of this block */ + tenure_height: number; /** @description The only hash that can uniquely identify an anchored block or an unconfirmed state trie */ index_block_hash: string; /** @description Hash of the parent block */ @@ -23177,6 +23352,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -23391,6 +23567,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -23605,6 +23782,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -23826,6 +24004,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -24039,6 +24218,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -24252,6 +24432,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -25713,6 +25894,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -25927,6 +26109,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -26141,6 +26324,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -26362,6 +26546,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -26575,6 +26760,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -26788,6 +26974,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -26895,6 +27082,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_pool_delegations: { @@ -26956,16 +27157,34 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; run_faucet_btc: { parameters: { query?: { /** - * @description A valid testnet BTC address + * @description A valid regtest BTC address * @example 2N4M94S1ZPt8HfxydXzL2P7qyzgVq7MHWts */ address?: string; + /** @description Request a large amount of regtest BTC than the default */ + large?: boolean; + /** @description Request an extra large amount of regtest BTC than the default */ + xlarge?: boolean; }; header?: never; path?: never; @@ -26974,13 +27193,13 @@ export interface operations { requestBody?: { content: { "application/json": { - /** @description A valid testnet BTC address */ + /** @description A valid regtest BTC address */ address?: string; } | null; }; }; responses: { - /** @description POST request that initiates a transfer of tokens to a specified testnet address */ + /** @description POST request that initiates a transfer of tokens to a specified Bitcoin regtest address */ 200: { headers: { [name: string]: unknown; @@ -27021,7 +27240,7 @@ export interface operations { header?: never; path: { /** - * @description A valid testnet BTC address + * @description A valid regtest BTC address * @example 2N4M94S1ZPt8HfxydXzL2P7qyzgVq7MHWts */ address: string; @@ -27164,6 +27383,8 @@ export interface operations { block_time: number; /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. */ block_time_iso: string; + /** @description The tenure height (AKA coinbase height) of this block */ + tenure_height: number; /** @description The only hash that can uniquely identify an anchored block or an unconfirmed state trie */ index_block_hash: string; /** @description Hash of the parent block */ @@ -27196,6 +27417,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_average_block_times: { @@ -27225,6 +27460,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_block: { @@ -27255,6 +27504,8 @@ export interface operations { block_time: number; /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. */ block_time_iso: string; + /** @description The tenure height (AKA coinbase height) of this block */ + tenure_height: number; /** @description The only hash that can uniquely identify an anchored block or an unconfirmed state trie */ index_block_hash: string; /** @description Hash of the parent block */ @@ -27286,6 +27537,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_transactions_by_block: { @@ -27454,6 +27719,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -27668,6 +27934,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -27882,6 +28149,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -28103,6 +28371,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -28316,6 +28585,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -28529,6 +28799,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -28619,6 +28890,69 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; + }; + }; + get_signer_signatures_for_block: { + parameters: { + query?: { + /** @description Results per page */ + limit?: number; + /** @description Result offset */ + offset?: number; + }; + header?: never; + path: { + height_or_hash: "latest" | string | number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Default Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example 20 */ + limit: number; + /** @example 0 */ + offset: number; + /** @example 1 */ + total: number; + results: string[]; + }; + }; + }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_burn_blocks: { @@ -28667,6 +29001,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_burn_block: { @@ -28704,6 +29052,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_blocks_by_burn_block: { @@ -28746,6 +29108,107 @@ export interface operations { block_time: number; /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. */ block_time_iso: string; + /** @description The tenure height (AKA coinbase height) of this block */ + tenure_height: number; + /** @description The only hash that can uniquely identify an anchored block or an unconfirmed state trie */ + index_block_hash: string; + /** @description Hash of the parent block */ + parent_block_hash: string; + /** @description Index block hash of the parent block */ + parent_index_block_hash: string; + /** @description Unix timestamp (in seconds) indicating when this block was mined. */ + burn_block_time: number; + /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. */ + burn_block_time_iso: string; + /** @description Hash of the anchor chain block */ + burn_block_hash: string; + /** @description Height of the anchor chain block */ + burn_block_height: number; + /** @description Anchor chain transaction ID */ + miner_txid: string; + /** @description Number of transactions included in the block */ + tx_count: number; + /** @description Execution cost read count. */ + execution_cost_read_count: number; + /** @description Execution cost read length. */ + execution_cost_read_length: number; + /** @description Execution cost runtime. */ + execution_cost_runtime: number; + /** @description Execution cost write count. */ + execution_cost_write_count: number; + /** @description Execution cost write length. */ + execution_cost_write_length: number; + }[]; + }; + }; + }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; + }; + }; + get_tenure_blocks: { + parameters: { + query?: { + /** @description Results per page */ + limit?: number; + /** @description Result offset */ + offset?: number; + /** @description Cursor for pagination */ + cursor?: string; + }; + header?: never; + path: { + /** + * @description Block tenure height + * @example 165453 + */ + tenure_height: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Default Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example 20 */ + limit: number; + /** @example 0 */ + offset: number; + /** @example 1 */ + total: number; + next_cursor: string | null; + prev_cursor: string | null; + cursor: string | null; + results: { + /** @description Set to `true` if block corresponds to the canonical chain tip */ + canonical: boolean; + /** @description Height of the block */ + height: number; + /** @description Hash representing the block */ + hash: string; + /** @description Unix timestamp (in seconds) indicating when this block was mined. */ + block_time: number; + /** @description An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. */ + block_time_iso: string; + /** @description The tenure height (AKA coinbase height) of this block */ + tenure_height: number; /** @description The only hash that can uniquely identify an anchored block or an unconfirmed state trie */ index_block_hash: string; /** @description Hash of the parent block */ @@ -28778,6 +29241,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_smart_contracts_status: { @@ -28818,6 +29295,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_mempool_fee_priorities: { @@ -28863,6 +29354,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_pox_cycles: { @@ -28903,6 +29408,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_pox_cycle: { @@ -28933,6 +29452,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_pox_cycle_signers: { @@ -28981,6 +29514,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_pox_cycle_signer: { @@ -29021,6 +29568,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_pox_cycle_signer_stackers: { @@ -29067,6 +29628,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_address_transactions: { @@ -29236,6 +29811,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -29450,6 +30026,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -29664,6 +30241,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -29885,6 +30463,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -30098,6 +30677,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -30311,6 +30891,7 @@ export interface operations { execution_cost_write_count: number; /** @description Execution cost write length. */ execution_cost_write_length: number; + vm_error: string | null; events: (({ event_index: number; } & { @@ -30423,6 +31004,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_address_transaction_events: { @@ -30508,6 +31103,173 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; + }; + }; + get_principal_stx_balance: { + parameters: { + query?: { + /** @description Include pending mempool transactions in the balance calculation */ + include_mempool?: boolean; + }; + header?: never; + path: { + principal: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Default Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + balance: string; + /** @description Total STX balance considering pending mempool transactions */ + estimated_balance?: string; + /** @description Inbound STX balance from pending mempool transactions */ + pending_balance_inbound?: string; + /** @description Outbound STX balance from pending mempool transactions */ + pending_balance_outbound?: string; + total_sent?: string; + total_received?: string; + total_fees_sent?: string; + total_miner_rewards_received: string; + /** @description The transaction where the lock event occurred. Empty if no tokens are locked. */ + lock_tx_id: string; + /** @description The amount of locked STX, as string quoted micro-STX. Zero if no tokens are locked. */ + locked: string; + /** @description The STX chain block height of when the lock event occurred. Zero if no tokens are locked. */ + lock_height: number; + /** @description The burnchain block height of when the lock event occurred. Zero if no tokens are locked. */ + burnchain_lock_height: number; + /** @description The burnchain block height of when the tokens unlock. Zero if no tokens are locked. */ + burnchain_unlock_height: number; + }; + }; + }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; + }; + }; + get_principal_ft_balances: { + parameters: { + query?: { + /** @description Results per page */ + limit?: number; + /** @description Result offset */ + offset?: number; + }; + header?: never; + path: { + principal: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Default Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example 20 */ + limit: number; + /** @example 0 */ + offset: number; + /** @example 1 */ + total: number; + results: { + token: string; + balance: string; + }[]; + }; + }; + }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; + }; + }; + get_principal_ft_balance: { + parameters: { + query?: never; + header?: never; + path: { + principal: string; + /** @description fungible token identifier */ + token: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Default Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + balance: string; + }; + }; + }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_historical_zone_file: { @@ -30590,6 +31352,20 @@ export interface operations { "application/json": string[]; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; fetch_zone_file: { @@ -30722,6 +31498,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_all_namespaces: { @@ -30754,6 +31544,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_namespace_names: { @@ -30791,6 +31595,20 @@ export interface operations { "application/json": string[]; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_names_owned_by_address: { @@ -30830,6 +31648,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_namespace_price: { @@ -30870,6 +31702,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; get_name_price: { @@ -30910,6 +31756,20 @@ export interface operations { }; }; }; + /** @description Default Response */ + "4XX": { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + message?: string; + } & { + [key: string]: unknown; + }; + }; + }; }; }; } diff --git a/migrations/1747408872545_txs-vm-error.js b/migrations/1747408872545_txs-vm-error.js new file mode 100644 index 000000000..47b45fa29 --- /dev/null +++ b/migrations/1747408872545_txs-vm-error.js @@ -0,0 +1,11 @@ +/* eslint-disable camelcase */ + +exports.shorthands = undefined; + +exports.up = pgm => { + pgm.addColumn('txs', { + vm_error: { + type: 'text', + } + }); +}; diff --git a/src/api/controllers/db-controller.ts b/src/api/controllers/db-controller.ts index ec70ce459..46baa65a7 100644 --- a/src/api/controllers/db-controller.ts +++ b/src/api/controllers/db-controller.ts @@ -1135,6 +1135,7 @@ function parseDbAbstractTx(dbTx: DbTx, baseTx: BaseTransaction): AbstractTransac execution_cost_runtime: dbTx.execution_cost_runtime, execution_cost_write_count: dbTx.execution_cost_write_count, execution_cost_write_length: dbTx.execution_cost_write_length, + vm_error: dbTx.vm_error ?? null, }; return abstractTx; } diff --git a/src/api/schemas/entities/transactions.ts b/src/api/schemas/entities/transactions.ts index a683571e1..1119efea2 100644 --- a/src/api/schemas/entities/transactions.ts +++ b/src/api/schemas/entities/transactions.ts @@ -150,6 +150,7 @@ const AbstractTransactionProperties = { execution_cost_write_length: Type.Integer({ description: 'Execution cost write length.', }), + vm_error: Nullable(Type.String({ description: 'Clarity VM error produced by this transaction' })), events: Type.Array(TransactionEventSchema), }; const AbstractTransactionSchema = Type.Object({ diff --git a/src/datastore/common.ts b/src/datastore/common.ts index 78f1f0dd2..4b5a07d4b 100644 --- a/src/datastore/common.ts +++ b/src/datastore/common.ts @@ -236,6 +236,8 @@ export interface DbTx extends BaseTx { execution_cost_runtime: number; execution_cost_write_count: number; execution_cost_write_length: number; + + vm_error?: string; } export interface DbTxRaw extends DbTx { @@ -1228,6 +1230,7 @@ export interface TxInsertValues { execution_cost_runtime: number; execution_cost_write_count: number; execution_cost_write_length: number; + vm_error: string | null; } export interface MempoolTxInsertValues { diff --git a/src/datastore/helpers.ts b/src/datastore/helpers.ts index 9cf54a0f1..b916f6735 100644 --- a/src/datastore/helpers.ts +++ b/src/datastore/helpers.ts @@ -1206,6 +1206,7 @@ export function createDbTxFromCoreMsg(msg: CoreNodeParsedTxMessage): DbTxRaw { execution_cost_runtime: coreTx.execution_cost.runtime, execution_cost_write_count: coreTx.execution_cost.write_count, execution_cost_write_length: coreTx.execution_cost.write_length, + vm_error: coreTx.vm_error ?? undefined, }; extractTransactionPayload(parsedTx, dbTx); return dbTx; diff --git a/src/datastore/pg-write-store.ts b/src/datastore/pg-write-store.ts index fd0e55ee2..f477b0f05 100644 --- a/src/datastore/pg-write-store.ts +++ b/src/datastore/pg-write-store.ts @@ -1896,6 +1896,7 @@ export class PgWriteStore extends PgStore { execution_cost_runtime: tx.execution_cost_runtime, execution_cost_write_count: tx.execution_cost_write_count, execution_cost_write_length: tx.execution_cost_write_length, + vm_error: tx.vm_error ?? null, })); let count = 0; @@ -3492,6 +3493,7 @@ export class PgWriteStore extends PgStore { execution_cost_runtime: tx.execution_cost_runtime, execution_cost_write_count: tx.execution_cost_write_count, execution_cost_write_length: tx.execution_cost_write_length, + vm_error: tx.vm_error ?? null, })); await sql`INSERT INTO txs ${sql(values)}`; } diff --git a/src/event-stream/core-node-message.ts b/src/event-stream/core-node-message.ts index 9c8b276de..176983430 100644 --- a/src/event-stream/core-node-message.ts +++ b/src/event-stream/core-node-message.ts @@ -245,6 +245,7 @@ export interface CoreNodeTxMessage { microblock_sequence: number | null; microblock_hash: string | null; microblock_parent_hash: string | null; + vm_error: string | null; burnchain_op?: BurnchainOp | null; } diff --git a/tests/api/address.test.ts b/tests/api/address.test.ts index 4e0ebfaf3..f9b82650a 100644 --- a/tests/api/address.test.ts +++ b/tests/api/address.test.ts @@ -300,6 +300,7 @@ describe('address tests', () => { execution_cost_runtime: 3, execution_cost_write_count: 4, execution_cost_write_length: 5, + vm_error: null, }, stx_sent: '1339', stx_received: '0', @@ -390,6 +391,7 @@ describe('address tests', () => { execution_cost_runtime: 3, execution_cost_write_count: 4, execution_cost_write_length: 5, + vm_error: null, }, stx_sent: '1484', stx_received: '0', @@ -454,6 +456,7 @@ describe('address tests', () => { execution_cost_runtime: 3, execution_cost_write_count: 4, execution_cost_write_length: 5, + vm_error: null, }, stx_sent: '1334', stx_received: '0', @@ -1950,6 +1953,7 @@ describe('address tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }, { tx_id: '0x1234', @@ -1993,6 +1997,7 @@ describe('address tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }, { tx_id: '0x12340005', @@ -2037,6 +2042,7 @@ describe('address tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }, { tx_id: '0x12340003', @@ -2081,6 +2087,7 @@ describe('address tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }, { tx_id: '0x12340002', @@ -2125,6 +2132,7 @@ describe('address tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }, ], }; @@ -2518,6 +2526,7 @@ describe('address tests', () => { microblock_hash: null, microblock_parent_hash: null, microblock_sequence: null, + vm_error: null, execution_cost: { read_count: 0, read_length: 0, diff --git a/tests/api/search.test.ts b/tests/api/search.test.ts index 7f8bfe8e4..1cac7c19e 100644 --- a/tests/api/search.test.ts +++ b/tests/api/search.test.ts @@ -577,6 +577,7 @@ describe('search tests', () => { execution_cost_write_count: 0, execution_cost_write_length: 0, tx_type: 'coinbase', + vm_error: null, coinbase_payload: { data: '0x636f696e62617365206869', alt_recipient: null, @@ -1580,6 +1581,7 @@ describe('search tests', () => { }, tx_status: 'success', tx_type: 'smart_contract', + vm_error: null, }, }, }; diff --git a/tests/api/tx.test.ts b/tests/api/tx.test.ts index 9913bc49d..9446199ea 100644 --- a/tests/api/tx.test.ts +++ b/tests/api/tx.test.ts @@ -388,6 +388,7 @@ describe('tx tests', () => { microblock_hash: null, microblock_parent_hash: null, microblock_sequence: null, + vm_error: null, execution_cost: { read_count: 0, read_length: 0, @@ -547,6 +548,7 @@ describe('tx tests', () => { microblock_hash: null, microblock_parent_hash: null, microblock_sequence: null, + vm_error: null, execution_cost: { read_count: 0, read_length: 0, @@ -696,6 +698,7 @@ describe('tx tests', () => { microblock_hash: null, microblock_parent_hash: null, microblock_sequence: null, + vm_error: null, execution_cost: { read_count: 0, read_length: 0, @@ -856,6 +859,7 @@ describe('tx tests', () => { microblock_hash: null, microblock_parent_hash: null, microblock_sequence: null, + vm_error: null, execution_cost: { read_count: 0, read_length: 0, @@ -1080,6 +1084,7 @@ describe('tx tests', () => { microblock_hash: null, microblock_parent_hash: null, microblock_sequence: null, + vm_error: null, execution_cost: { read_count: 0, read_length: 0, @@ -1484,6 +1489,7 @@ describe('tx tests', () => { microblock_hash: null, microblock_parent_hash: null, microblock_sequence: null, + vm_error: null, execution_cost: { read_count: 0, read_length: 0, @@ -1649,6 +1655,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; expect(txQuery.result).toEqual(expectedResp); @@ -1717,6 +1724,7 @@ describe('tx tests', () => { microblock_hash: null, microblock_parent_hash: null, microblock_sequence: null, + vm_error: null, execution_cost: { read_count: 0, read_length: 0, @@ -1873,6 +1881,7 @@ describe('tx tests', () => { microblock_hash: null, microblock_parent_hash: null, microblock_sequence: null, + vm_error: null, execution_cost: { read_count: 0, read_length: 0, diff --git a/tests/api/websocket.test.ts b/tests/api/websocket.test.ts index bfd3682c5..119296f4c 100644 --- a/tests/api/websocket.test.ts +++ b/tests/api/websocket.test.ts @@ -333,6 +333,7 @@ describe('websocket notifications', () => { }, tx_status: 'success', tx_type: 'token_transfer', + vm_error: null, }, }); @@ -736,6 +737,7 @@ describe('websocket notifications', () => { }, tx_status: 'success', tx_type: 'token_transfer', + vm_error: null, }, }); await subscription.unsubscribe(); From 3b17041ca2f74eca11fb446a452ea14f1b581884 Mon Sep 17 00:00:00 2001 From: Rafael Cardenas Date: Fri, 16 May 2025 12:05:12 -0600 Subject: [PATCH 2/8] fix: tests --- tests/api/address.test.ts | 2 ++ tests/api/tx.test.ts | 13 +++++++++++-- tests/api/websocket.test.ts | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/api/address.test.ts b/tests/api/address.test.ts index f9b82650a..f2d7933c0 100644 --- a/tests/api/address.test.ts +++ b/tests/api/address.test.ts @@ -795,6 +795,7 @@ describe('address tests', () => { execution_cost_runtime: 3, execution_cost_write_count: 4, execution_cost_write_length: 5, + vm_error: null, }, stx_sent: '0', stx_received: '105', @@ -2207,6 +2208,7 @@ describe('address tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }, ], }; diff --git a/tests/api/tx.test.ts b/tests/api/tx.test.ts index 9446199ea..8d2208713 100644 --- a/tests/api/tx.test.ts +++ b/tests/api/tx.test.ts @@ -495,6 +495,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const fetchTx = await supertest(api.server).get(`/extended/v1/tx/${dbTx.tx_id}`); expect(fetchTx.status).toBe(200); @@ -645,6 +646,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const fetchTx = await supertest(api.server).get(`/extended/v1/tx/${dbTx.tx_id}`); expect(fetchTx.status).toBe(200); @@ -795,6 +797,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const fetchTx = await supertest(api.server).get(`/extended/v1/tx/${dbTx.tx_id}`); expect(fetchTx.status).toBe(200); @@ -985,6 +988,7 @@ describe('tx tests', () => { execution_cost_write_count: 0, execution_cost_write_length: 0, sponsor_nonce: 2, + vm_error: null, }; const fetchTx = await supertest(api.server).get(`/extended/v1/tx/${dbTx.tx_id}`); expect(fetchTx.status).toBe(200); @@ -1724,7 +1728,7 @@ describe('tx tests', () => { microblock_hash: null, microblock_parent_hash: null, microblock_sequence: null, - vm_error: null, + vm_error: 'Clarity error', execution_cost: { read_count: 0, read_length: 0, @@ -1824,6 +1828,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: 'Clarity error', }; expect(txQuery.result).toEqual(expectedResp); @@ -1881,7 +1886,7 @@ describe('tx tests', () => { microblock_hash: null, microblock_parent_hash: null, microblock_sequence: null, - vm_error: null, + vm_error: 'post condition error', execution_cost: { read_count: 0, read_length: 0, @@ -1981,6 +1986,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: 'post condition error', }; expect(txQuery.result).toEqual(expectedResp); @@ -3611,6 +3617,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const fetchTx = await supertest(api.server).get(`/extended/v1/tx/${tx.tx_id}`); @@ -3782,6 +3789,7 @@ describe('tx tests', () => { execution_cost_runtime: 116256000, execution_cost_write_count: 9, execution_cost_write_length: 339, + vm_error: null, tx_type: 'contract_call', contract_call: { contract_id: 'SP3YK7KWMYRCDMV5M4792T0T7DERQXHJJGGEPV1N8.pg-mdomains-v1', @@ -4251,6 +4259,7 @@ describe('tx tests', () => { }, tx_status: 'success', tx_type: 'coinbase', + vm_error: null, }); result = await supertest(api.server).get(`/extended/v2/blocks/latest/transactions`); diff --git a/tests/api/websocket.test.ts b/tests/api/websocket.test.ts index 119296f4c..780f0f816 100644 --- a/tests/api/websocket.test.ts +++ b/tests/api/websocket.test.ts @@ -410,6 +410,7 @@ describe('websocket notifications', () => { }, tx_status: 'success', tx_type: 'token_transfer', + vm_error: null, }, }); } finally { From 3b75ddcb3f51e9aea3f3264f4b0d4966200ef8f2 Mon Sep 17 00:00:00 2001 From: Rafael Cardenas Date: Fri, 16 May 2025 12:18:36 -0600 Subject: [PATCH 3/8] fix: load vm_error from table --- src/datastore/common.ts | 2 ++ src/datastore/helpers.ts | 1 + tests/api/address.test.ts | 5 +++++ tests/api/tx.test.ts | 1 + 4 files changed, 9 insertions(+) diff --git a/src/datastore/common.ts b/src/datastore/common.ts index 4b5a07d4b..14ff3c14f 100644 --- a/src/datastore/common.ts +++ b/src/datastore/common.ts @@ -1029,6 +1029,8 @@ export interface TxQueryResult { execution_cost_runtime: string; execution_cost_write_count: string; execution_cost_write_length: string; + + vm_error?: string; } export interface ContractTxQueryResult extends TxQueryResult { diff --git a/src/datastore/helpers.ts b/src/datastore/helpers.ts index b916f6735..6ebfd2f46 100644 --- a/src/datastore/helpers.ts +++ b/src/datastore/helpers.ts @@ -124,6 +124,7 @@ export const TX_COLUMNS = [ 'execution_cost_runtime', 'execution_cost_write_count', 'execution_cost_write_length', + 'vm_error', ]; export const MEMPOOL_TX_COLUMNS = [ diff --git a/tests/api/address.test.ts b/tests/api/address.test.ts index f2d7933c0..bda47f018 100644 --- a/tests/api/address.test.ts +++ b/tests/api/address.test.ts @@ -871,6 +871,7 @@ describe('address tests', () => { execution_cost_runtime: 3, execution_cost_write_count: 4, execution_cost_write_length: 5, + vm_error: null, }, stx_sent: '0', stx_received: '105', @@ -961,6 +962,7 @@ describe('address tests', () => { execution_cost_runtime: 3, execution_cost_write_count: 4, execution_cost_write_length: 5, + vm_error: null, }, stx_sent: '0', stx_received: '15', @@ -2273,6 +2275,7 @@ describe('address tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, fee_rate: '10', is_unanchored: false, microblock_canonical: true, @@ -2353,6 +2356,7 @@ describe('address tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, fee_rate: '10', is_unanchored: false, microblock_canonical: true, @@ -2437,6 +2441,7 @@ describe('address tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const blockTxsRows = await api.datastore.getBlockTxsRows(block.block_hash); diff --git a/tests/api/tx.test.ts b/tests/api/tx.test.ts index 8d2208713..25e0637c3 100644 --- a/tests/api/tx.test.ts +++ b/tests/api/tx.test.ts @@ -3887,6 +3887,7 @@ describe('tx tests', () => { execution_cost_runtime: 116256000, execution_cost_write_count: 9, execution_cost_write_length: 339, + vm_error: null, tx_type: 'contract_call', contract_call: { contract_id: 'SP000000000000000000002Q6VF78.bns', From ecc49d43434d02dc3c0aff28e77512d37513125e Mon Sep 17 00:00:00 2001 From: Rafael Cardenas Date: Fri, 16 May 2025 12:20:51 -0600 Subject: [PATCH 4/8] fix: parse vm error --- src/datastore/helpers.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/datastore/helpers.ts b/src/datastore/helpers.ts index 6ebfd2f46..6ddc45e78 100644 --- a/src/datastore/helpers.ts +++ b/src/datastore/helpers.ts @@ -385,6 +385,7 @@ export function parseTxQueryResult(result: ContractTxQueryResult): DbTx { execution_cost_write_count: Number.parseInt(result.execution_cost_write_count), execution_cost_write_length: Number.parseInt(result.execution_cost_write_length), abi: parseAbiColumn(result.abi), + vm_error: result.vm_error, }; parseTxTypeSpecificQueryResult(result, tx); return tx; From 4ef1f1d430ca657a6a6373b68db80c23cd4f62b4 Mon Sep 17 00:00:00 2001 From: Rafael Cardenas Date: Fri, 16 May 2025 14:48:30 -0600 Subject: [PATCH 5/8] fix: standard null type --- src/datastore/common.ts | 4 ++-- src/datastore/helpers.ts | 2 +- tests/api/address.test.ts | 4 ++-- tests/api/block.test.ts | 1 + tests/api/cache-control.test.ts | 2 ++ tests/api/datastore.test.ts | 34 +++++++++++++++++++++++++++++++++ tests/api/mempool.test.ts | 3 +++ tests/api/microblock.test.ts | 3 +++ tests/api/other.test.ts | 1 + tests/api/search.test.ts | 8 ++++++++ tests/api/tx.test.ts | 11 +++++++++++ 11 files changed, 68 insertions(+), 5 deletions(-) diff --git a/src/datastore/common.ts b/src/datastore/common.ts index 14ff3c14f..d2314a8a4 100644 --- a/src/datastore/common.ts +++ b/src/datastore/common.ts @@ -237,7 +237,7 @@ export interface DbTx extends BaseTx { execution_cost_write_count: number; execution_cost_write_length: number; - vm_error?: string; + vm_error: string | null; } export interface DbTxRaw extends DbTx { @@ -1030,7 +1030,7 @@ export interface TxQueryResult { execution_cost_write_count: string; execution_cost_write_length: string; - vm_error?: string; + vm_error: string | null; } export interface ContractTxQueryResult extends TxQueryResult { diff --git a/src/datastore/helpers.ts b/src/datastore/helpers.ts index 6ddc45e78..c54359dce 100644 --- a/src/datastore/helpers.ts +++ b/src/datastore/helpers.ts @@ -1208,7 +1208,7 @@ export function createDbTxFromCoreMsg(msg: CoreNodeParsedTxMessage): DbTxRaw { execution_cost_runtime: coreTx.execution_cost.runtime, execution_cost_write_count: coreTx.execution_cost.write_count, execution_cost_write_length: coreTx.execution_cost.write_length, - vm_error: coreTx.vm_error ?? undefined, + vm_error: coreTx.vm_error, }; extractTransactionPayload(parsedTx, dbTx); return dbTx; diff --git a/tests/api/address.test.ts b/tests/api/address.test.ts index bda47f018..1f5547c94 100644 --- a/tests/api/address.test.ts +++ b/tests/api/address.test.ts @@ -2453,7 +2453,7 @@ describe('address tests', () => { abi: JSON.parse(contractCallResult1?.abi ?? ''), }).toEqual({ ...contractCall, - ...{ abi: contractJsonAbi }, + ...{ abi: contractJsonAbi, vm_error: null }, }); const searchResult8 = await supertest(api.server).get( @@ -2473,7 +2473,7 @@ describe('address tests', () => { abi: JSON.parse(contractCallResult2?.abi ?? ''), }).toEqual({ ...contractCall, - ...{ abi: contractJsonAbi }, + ...{ abi: contractJsonAbi, vm_error: null }, }); }); diff --git a/tests/api/block.test.ts b/tests/api/block.test.ts index e00e43520..bae5a03af 100644 --- a/tests/api/block.test.ts +++ b/tests/api/block.test.ts @@ -127,6 +127,7 @@ describe('block tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.updateTx(client, tx); diff --git a/tests/api/cache-control.test.ts b/tests/api/cache-control.test.ts index 7fa0aeabb..cab1c8d9c 100644 --- a/tests/api/cache-control.test.ts +++ b/tests/api/cache-control.test.ts @@ -99,6 +99,7 @@ describe('cache-control tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.update({ block: block1, @@ -272,6 +273,7 @@ describe('cache-control tests', () => { // These properties can be determined with a db query, they are set while the db is inserting them. block_height: -1, + vm_error: null, }; await db.updateMicroblocks({ diff --git a/tests/api/datastore.test.ts b/tests/api/datastore.test.ts index 133d79371..7f5a39969 100644 --- a/tests/api/datastore.test.ts +++ b/tests/api/datastore.test.ts @@ -134,6 +134,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const tx2 = { ...tx, @@ -318,6 +319,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const createFtEvent = ( sender: string, @@ -489,6 +491,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const createNFtEvents = ( sender: string, @@ -671,6 +674,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.updateTx(client, tx); const blockTxs = await db.getBlockTxs(block.index_block_hash); @@ -750,6 +754,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const stxEvent: DbStxEvent = { event_type: DbEventTypeId.StxAsset, @@ -1084,6 +1089,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const createStxEvent = ( sender: string, @@ -1149,6 +1155,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const createFtEvent = ( sender: string, @@ -1225,6 +1232,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const createNFtEvents = ( sender: string, @@ -2060,6 +2068,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.update({ block: dbBlock, @@ -2146,6 +2155,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await expect(db.updateTx(client, { ...tx, raw_tx: '0x' })).rejects.toEqual( new Error('new row for relation "txs" violates check constraint "valid_token_transfer"') @@ -2238,6 +2248,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await expect(db.updateTx(client, { ...tx, raw_tx: '0x' })).rejects.toEqual( new Error('new row for relation "txs" violates check constraint "valid_smart_contract"') @@ -2339,6 +2350,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await expect(db.updateTx(client, tx)).rejects.toEqual( new Error( @@ -2419,6 +2431,7 @@ describe('postgres datastore', () => { smart_contract_contract_id: 'my-contract', smart_contract_source_code: '(src)', sponsor_nonce: undefined, + vm_error: null, }; expect(txQuery.result).toEqual(txRes); }); @@ -2482,6 +2495,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await expect(db.updateTx(client, { ...tx, raw_tx: '0x' })).rejects.toEqual( new Error('new row for relation "txs" violates check constraint "valid_contract_call"') @@ -2574,6 +2588,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await expect(db.updateTx(client, { ...tx, raw_tx: '0x' })).rejects.toEqual( new Error('new row for relation "txs" violates check constraint "valid_poison_microblock"') @@ -2665,6 +2680,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await expect(db.updateTx(client, { ...tx, raw_tx: '0x' })).rejects.toEqual( new Error('new row for relation "txs" violates check constraint "valid_coinbase"') @@ -2759,6 +2775,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const updatedRows = await db.updateTx(client, tx); expect(updatedRows).toBe(1); @@ -2835,6 +2852,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const tx2: DbTx = { ...tx1, @@ -3377,6 +3395,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const tx1b: DbTxRaw = { ...tx1, @@ -3656,6 +3675,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const tx2: DbTxRaw = { @@ -3693,6 +3713,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const stxLockEvent1: DbStxLockEvent = { @@ -3915,6 +3936,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const tx2: DbTxRaw = { @@ -3952,6 +3974,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const stxLockEvent1: DbStxLockEvent = { @@ -4200,6 +4223,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const contract1: DbSmartContract = { tx_id: tx3.tx_id, @@ -4727,6 +4751,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const tx2: DbTxRaw = { @@ -4764,6 +4789,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; // test sponsored tx @@ -4802,6 +4828,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const tx4: DbTxRaw = { @@ -4839,6 +4866,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; // test stx mint @@ -5202,6 +5230,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.update({ @@ -5292,6 +5321,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.update({ @@ -5381,6 +5411,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const tx2: DbTxRaw = { ...tx1, @@ -5744,6 +5775,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.updateTx(client, tx); @@ -5782,6 +5814,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.updateTx(client, tx2); const blockTxs = await db.getTxsFromBlock({ hash: block.block_hash }, 20, 0); @@ -5856,6 +5889,7 @@ describe('postgres datastore', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.updateTx(client, tx); const blockTxs = await db.getTxsFromBlock({ hash: block.block_hash }, 20, 6); diff --git a/tests/api/mempool.test.ts b/tests/api/mempool.test.ts index 2a6eeda42..cd8f128cc 100644 --- a/tests/api/mempool.test.ts +++ b/tests/api/mempool.test.ts @@ -595,6 +595,7 @@ describe('mempool tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const dataStoreUpdate1: DataStoreBlockUpdateData = { block: dbBlock1, @@ -1728,6 +1729,7 @@ describe('mempool tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; // Simulate the bug with a txs being in the mempool at confirmed at the same time by @@ -1906,6 +1908,7 @@ describe('mempool tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.updateMempoolTxs({ mempoolTxs: [mempoolTx] }); diff --git a/tests/api/microblock.test.ts b/tests/api/microblock.test.ts index f43eee5ba..902af7e96 100644 --- a/tests/api/microblock.test.ts +++ b/tests/api/microblock.test.ts @@ -327,6 +327,7 @@ describe('microblock tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const contractJsonAbi = { maps: [], @@ -453,6 +454,7 @@ describe('microblock tests', () => { // These properties can be determined with a db query, they are set while the db is inserting them. block_height: -1, + vm_error: null, }; const mbTx2: DbTxRaw = { tx_id: '0x03', @@ -501,6 +503,7 @@ describe('microblock tests', () => { // These properties can be determined with a db query, they are set while the db is inserting them. block_height: -1, + vm_error: null, }; const mempoolTx1: DbMempoolTxRaw = { diff --git a/tests/api/other.test.ts b/tests/api/other.test.ts index 853cabdcf..e27ec4ffa 100644 --- a/tests/api/other.test.ts +++ b/tests/api/other.test.ts @@ -101,6 +101,7 @@ describe('other tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const stxMintEvent1: DbStxEvent = { event_index: 0, diff --git a/tests/api/search.test.ts b/tests/api/search.test.ts index 1cac7c19e..732feadb1 100644 --- a/tests/api/search.test.ts +++ b/tests/api/search.test.ts @@ -104,6 +104,7 @@ describe('search tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.updateTx(client, tx); @@ -319,6 +320,7 @@ describe('search tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const mempoolTx: DbMempoolTxRaw = { @@ -666,6 +668,7 @@ describe('search tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.updateTx(client, stxTx1); @@ -719,6 +722,7 @@ describe('search tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.updateTx(client, stxTx2); @@ -938,6 +942,7 @@ describe('search tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.updateTx(client, smartContract); @@ -1113,6 +1118,7 @@ describe('search tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const stxTx2: DbTxRaw = { @@ -1152,6 +1158,7 @@ describe('search tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const stxEvent1: DbStxEvent = { @@ -1272,6 +1279,7 @@ describe('search tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const smartContract: DbSmartContract = { diff --git a/tests/api/tx.test.ts b/tests/api/tx.test.ts index 25e0637c3..99803a3f5 100644 --- a/tests/api/tx.test.ts +++ b/tests/api/tx.test.ts @@ -127,6 +127,7 @@ describe('tx tests', () => { execution_cost_write_length: 339, contract_call_contract_id: 'SP3YK7KWMYRCDMV5M4792T0T7DERQXHJJGGEPV1N8.pg-mdomains-v1', contract_call_function_name: 'bns-name-preorder', + vm_error: null, }; const smartContract1: DbSmartContract = { tx_id: '0x668142abbcabb846e3f83183325325071a8b4882dcf5476a38148cb5b738fc83', @@ -197,6 +198,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const versionedSmartContract1: DbSmartContract = { @@ -245,6 +247,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.update({ block: dbBlock, @@ -1277,6 +1280,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const dbStxEvent: DbStxEvent = { @@ -2744,6 +2748,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.update({ @@ -2868,6 +2873,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.update({ @@ -3526,6 +3532,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const nftEvent: DbNftEvent = { canonical: true, @@ -3668,6 +3675,7 @@ describe('tx tests', () => { contract_call_function_args: bufferToHex( createClarityValueArray(bufferCV(Buffer.from('test')), uintCV(1234n)) ), + vm_error: null, }; const tx2: DbTxRaw = { type_id: DbTxTypeId.ContractCall, @@ -3708,6 +3716,7 @@ describe('tx tests', () => { contract_call_function_args: bufferToHex( createClarityValueArray(bufferCV(Buffer.from('test')), uintCV(1234n)) ), + vm_error: null, }; const contractCall: DbSmartContract = { tx_id: '0x668142abbcabb846e3f83183325325071a8b4882dcf5476a38148cb5b738fc83', @@ -4130,6 +4139,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.update({ block, @@ -4349,6 +4359,7 @@ describe('tx tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.updateTx(client, tx); const result1 = await supertest(api.server).get(`/extended/v1/tx/block/${block.block_hash}`); From 538f243b5a5c6ac4ad467112a4e63b57d2cede25 Mon Sep 17 00:00:00 2001 From: Rafael Cardenas Date: Fri, 16 May 2025 14:51:15 -0600 Subject: [PATCH 6/8] fix: tests --- src/api/controllers/db-controller.ts | 2 +- src/datastore/pg-write-store.ts | 4 ++-- tests/api/smart-contract.test.ts | 4 ++++ tests/utils/test-builders.ts | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/api/controllers/db-controller.ts b/src/api/controllers/db-controller.ts index 46baa65a7..ec77e121e 100644 --- a/src/api/controllers/db-controller.ts +++ b/src/api/controllers/db-controller.ts @@ -1135,7 +1135,7 @@ function parseDbAbstractTx(dbTx: DbTx, baseTx: BaseTransaction): AbstractTransac execution_cost_runtime: dbTx.execution_cost_runtime, execution_cost_write_count: dbTx.execution_cost_write_count, execution_cost_write_length: dbTx.execution_cost_write_length, - vm_error: dbTx.vm_error ?? null, + vm_error: dbTx.vm_error, }; return abstractTx; } diff --git a/src/datastore/pg-write-store.ts b/src/datastore/pg-write-store.ts index f477b0f05..8fc0e5e8a 100644 --- a/src/datastore/pg-write-store.ts +++ b/src/datastore/pg-write-store.ts @@ -1896,7 +1896,7 @@ export class PgWriteStore extends PgStore { execution_cost_runtime: tx.execution_cost_runtime, execution_cost_write_count: tx.execution_cost_write_count, execution_cost_write_length: tx.execution_cost_write_length, - vm_error: tx.vm_error ?? null, + vm_error: tx.vm_error, })); let count = 0; @@ -3493,7 +3493,7 @@ export class PgWriteStore extends PgStore { execution_cost_runtime: tx.execution_cost_runtime, execution_cost_write_count: tx.execution_cost_write_count, execution_cost_write_length: tx.execution_cost_write_length, - vm_error: tx.vm_error ?? null, + vm_error: tx.vm_error, })); await sql`INSERT INTO txs ${sql(values)}`; } diff --git a/tests/api/smart-contract.test.ts b/tests/api/smart-contract.test.ts index 4d8ff10d8..291db7b69 100644 --- a/tests/api/smart-contract.test.ts +++ b/tests/api/smart-contract.test.ts @@ -103,6 +103,7 @@ describe('smart contract tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const tx2: DbTxRaw = { ...tx1, @@ -270,6 +271,7 @@ describe('smart contract tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.update({ @@ -386,6 +388,7 @@ describe('smart contract tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; await db.update({ @@ -487,6 +490,7 @@ describe('smart contract tests', () => { execution_cost_runtime: 0, execution_cost_write_count: 0, execution_cost_write_length: 0, + vm_error: null, }; const tx2: DbTxRaw = { ...tx1, diff --git a/tests/utils/test-builders.ts b/tests/utils/test-builders.ts index 312c5db1d..03c8b4c53 100644 --- a/tests/utils/test-builders.ts +++ b/tests/utils/test-builders.ts @@ -200,6 +200,7 @@ export interface TestTxArgs extends Partial { tx_index?: number; type_id?: DbTxTypeId; nonce?: number; + vm_error?: string; } /** @@ -266,6 +267,7 @@ function testTx(args?: TestTxArgs): DataStoreTxEventData { tenure_change_previous_tenure_blocks: args?.tenure_change_previous_tenure_blocks, tenure_change_cause: args?.tenure_change_cause, tenure_change_pubkey_hash: args?.tenure_change_pubkey_hash, + vm_error: args?.vm_error ?? null, }, stxLockEvents: [], stxEvents: [], From f5d889b4d61be198015b6d82c64b1df694c4f17e Mon Sep 17 00:00:00 2001 From: Rafael Cardenas Date: Fri, 16 May 2025 15:00:07 -0600 Subject: [PATCH 7/8] fix: property may not come in past node versions --- src/datastore/common.ts | 2 +- src/datastore/pg-write-store.ts | 4 ++-- src/event-stream/core-node-message.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/datastore/common.ts b/src/datastore/common.ts index d2314a8a4..bbee8a601 100644 --- a/src/datastore/common.ts +++ b/src/datastore/common.ts @@ -237,7 +237,7 @@ export interface DbTx extends BaseTx { execution_cost_write_count: number; execution_cost_write_length: number; - vm_error: string | null; + vm_error?: string | null; } export interface DbTxRaw extends DbTx { diff --git a/src/datastore/pg-write-store.ts b/src/datastore/pg-write-store.ts index 8fc0e5e8a..f477b0f05 100644 --- a/src/datastore/pg-write-store.ts +++ b/src/datastore/pg-write-store.ts @@ -1896,7 +1896,7 @@ export class PgWriteStore extends PgStore { execution_cost_runtime: tx.execution_cost_runtime, execution_cost_write_count: tx.execution_cost_write_count, execution_cost_write_length: tx.execution_cost_write_length, - vm_error: tx.vm_error, + vm_error: tx.vm_error ?? null, })); let count = 0; @@ -3493,7 +3493,7 @@ export class PgWriteStore extends PgStore { execution_cost_runtime: tx.execution_cost_runtime, execution_cost_write_count: tx.execution_cost_write_count, execution_cost_write_length: tx.execution_cost_write_length, - vm_error: tx.vm_error, + vm_error: tx.vm_error ?? null, })); await sql`INSERT INTO txs ${sql(values)}`; } diff --git a/src/event-stream/core-node-message.ts b/src/event-stream/core-node-message.ts index 176983430..7167aa7d4 100644 --- a/src/event-stream/core-node-message.ts +++ b/src/event-stream/core-node-message.ts @@ -245,7 +245,7 @@ export interface CoreNodeTxMessage { microblock_sequence: number | null; microblock_hash: string | null; microblock_parent_hash: string | null; - vm_error: string | null; + vm_error?: string | null; burnchain_op?: BurnchainOp | null; } From b974c0212bd1cea72345c7e0729ac931bfde0f81 Mon Sep 17 00:00:00 2001 From: Rafael Cardenas Date: Fri, 16 May 2025 15:06:05 -0600 Subject: [PATCH 8/8] fix: db controller --- src/api/controllers/db-controller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/controllers/db-controller.ts b/src/api/controllers/db-controller.ts index ec77e121e..46baa65a7 100644 --- a/src/api/controllers/db-controller.ts +++ b/src/api/controllers/db-controller.ts @@ -1135,7 +1135,7 @@ function parseDbAbstractTx(dbTx: DbTx, baseTx: BaseTransaction): AbstractTransac execution_cost_runtime: dbTx.execution_cost_runtime, execution_cost_write_count: dbTx.execution_cost_write_count, execution_cost_write_length: dbTx.execution_cost_write_length, - vm_error: dbTx.vm_error, + vm_error: dbTx.vm_error ?? null, }; return abstractTx; }