diff --git a/CHANGELOG.md b/CHANGELOG.md index 17a5a3ad8d..29cbf2f319 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,34 @@ +## [8.13.5](https://github.com/hirosystems/stacks-blockchain-api/compare/v8.13.4...v8.13.5) (2025-12-02) + + +### Bug Fixes + +* support new sip-034 tenure change causes ([#2384](https://github.com/hirosystems/stacks-blockchain-api/issues/2384)) ([399908f](https://github.com/hirosystems/stacks-blockchain-api/commit/399908fd08fdaee3edc5b0820f0526378f7ab51a)) + +## [8.13.4](https://github.com/hirosystems/stacks-blockchain-api/compare/v8.13.3...v8.13.4) (2025-11-06) + + +### Bug Fixes + +* upgrade to latest stacks-encoding-native-js with arm64 support ([#2376](https://github.com/hirosystems/stacks-blockchain-api/issues/2376)) ([5ab7328](https://github.com/hirosystems/stacks-blockchain-api/commit/5ab7328c4c63c270fe0c43cec45f2a5a3e84d4cf)) + +## [8.13.3](https://github.com/hirosystems/stacks-blockchain-api/compare/v8.13.2...v8.13.3) (2025-11-06) + + +### Bug Fixes + +* upgrade stacks-encoding-native-js ([#2375](https://github.com/hirosystems/stacks-blockchain-api/issues/2375)) ([ae9933b](https://github.com/hirosystems/stacks-blockchain-api/commit/ae9933b1d0caf303838db621997c31f749100ff8)) + +## [8.13.2](https://github.com/hirosystems/stacks-blockchain-api/compare/v8.13.1...v8.13.2) (2025-10-21) + + +### Bug Fixes + +* calculate burnchain reward reorgs correctly ([#2355](https://github.com/hirosystems/stacks-blockchain-api/issues/2355)) ([f82efbc](https://github.com/hirosystems/stacks-blockchain-api/commit/f82efbc6ddc0d98bea92c389888dfc7b5b17926b)) +* do not display revoked pool delegations ([#2357](https://github.com/hirosystems/stacks-blockchain-api/issues/2357)) ([c6de314](https://github.com/hirosystems/stacks-blockchain-api/commit/c6de31493b92c4e5ae5dcc44519dcc9867886abd)) +* push redis updates to a stream ([#2360](https://github.com/hirosystems/stacks-blockchain-api/issues/2360)) ([2bfacf6](https://github.com/hirosystems/stacks-blockchain-api/commit/2bfacf6ee5ef19758f0b7b24cdbd677f4d89e0ed)) +* sanitize event observer strings ([#2361](https://github.com/hirosystems/stacks-blockchain-api/issues/2361)) ([2604539](https://github.com/hirosystems/stacks-blockchain-api/commit/2604539d5e94f0f2ec20d05d86aa3690dcdb1474)) + ## [8.13.1](https://github.com/hirosystems/stacks-blockchain-api/compare/v8.13.0...v8.13.1) (2025-09-23) diff --git a/client/src/generated/schema.d.ts b/client/src/generated/schema.d.ts index e110639842..fa7860d32b 100644 --- a/client/src/generated/schema.d.ts +++ b/client/src/generated/schema.d.ts @@ -1945,6 +1945,8 @@ export interface operations { * @example 123 */ nonce?: number; + /** @description Exclude function_args from contract call responses for smaller transaction sizes. */ + exclude_function_args?: boolean; }; header?: never; path?: never; @@ -3265,7 +3267,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -3302,6 +3304,8 @@ export interface operations { * @example true */ unanchored?: boolean; + /** @description Exclude function_args from contract call responses for smaller transaction sizes. */ + exclude_function_args?: boolean; }; header?: never; path?: never; @@ -4619,7 +4623,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -4709,6 +4713,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -4808,6 +4813,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -4907,6 +4913,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -5013,6 +5020,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -5111,6 +5119,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -5209,6 +5218,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -5227,7 +5237,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -5289,6 +5299,8 @@ export interface operations { offset?: number; /** @description Results per page */ limit?: number; + /** @description Exclude function_args from contract call responses for smaller transaction sizes. */ + exclude_function_args?: boolean; }; header?: never; path?: never; @@ -5395,6 +5407,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -5494,6 +5507,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -5593,6 +5607,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -5699,6 +5714,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -5797,6 +5813,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -5895,6 +5912,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -5913,7 +5931,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -6140,6 +6158,8 @@ export interface operations { * @example true */ unanchored?: boolean; + /** @description Exclude function_args from contract call responses for smaller transaction sizes. */ + exclude_function_args?: boolean; }; header?: never; path: { @@ -7459,7 +7479,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -7549,6 +7569,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -7648,6 +7669,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -7747,6 +7769,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -7853,6 +7876,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -7951,6 +7975,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -8049,6 +8074,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -8067,7 +8093,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -8144,6 +8170,8 @@ export interface operations { offset?: number; /** @description Results per page */ limit?: number; + /** @description Exclude function_args from contract call responses for smaller transaction sizes. */ + exclude_function_args?: boolean; }; header?: never; path: { @@ -9466,7 +9494,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -9497,6 +9525,8 @@ export interface operations { offset?: number; /** @description Results per page */ limit?: number; + /** @description Exclude function_args from contract call responses for smaller transaction sizes. */ + exclude_function_args?: boolean; }; header?: never; path: { @@ -10823,7 +10853,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -12468,7 +12498,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -13848,7 +13878,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -15233,7 +15263,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -17047,7 +17077,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -18018,6 +18048,8 @@ export interface operations { unanchored?: boolean; /** @description Block hash or block height. Return data representing the state up until that point in time, rather than the current block. Note - Use either of the query parameters but not both at a time. */ until_block?: string; + /** @description Exclude function_args from contract call responses for smaller transaction sizes. */ + exclude_function_args?: boolean; }; header?: never; path: { @@ -19340,7 +19372,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -20687,7 +20719,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -22085,7 +22117,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -22353,6 +22385,8 @@ export interface operations { * @example true */ unanchored?: boolean; + /** @description Exclude function_args from contract call responses for smaller transaction sizes. */ + exclude_function_args?: boolean; }; header?: never; path: { @@ -22461,6 +22495,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -22560,6 +22595,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -22659,6 +22695,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -22765,6 +22802,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -22863,6 +22901,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -22961,6 +23000,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -22979,7 +23019,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -24515,7 +24555,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -24605,6 +24645,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -24704,6 +24745,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -24803,6 +24845,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -24909,6 +24952,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -25007,6 +25051,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -25105,6 +25150,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -25123,7 +25169,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -25222,6 +25268,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -25321,6 +25368,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -25420,6 +25468,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -25526,6 +25575,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -25624,6 +25674,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -25722,6 +25773,7 @@ export interface operations { 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"; + replaced_by_tx_id: string | null; /** @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. */ @@ -25740,7 +25792,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -27057,7 +27109,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -27347,7 +27399,7 @@ export interface operations { limit?: number; /** @description Result offset */ offset?: number; - /** @description Cursor for pagination */ + /** @description Cursor for block pagination */ cursor?: string; }; header?: never; @@ -28882,7 +28934,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; @@ -29165,7 +29217,7 @@ export interface operations { limit?: number; /** @description Result offset */ offset?: number; - /** @description Cursor for pagination */ + /** @description Cursor for block pagination */ cursor?: string; }; header?: never; @@ -29651,6 +29703,8 @@ export interface operations { limit?: number; /** @description Result offset */ offset?: number; + /** @description Exclude function_args from contract call responses for smaller transaction sizes. */ + exclude_function_args?: boolean; }; header?: never; path: { @@ -30974,7 +31028,7 @@ export interface operations { /** @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"; + cause: "block_found" | "extended" | "extended_runtime" | "extended_read_count" | "extended_read_length" | "extended_write_count" | "extended_write_length"; /** @description (Hex string) The ECDSA public key hash of the current tenure. */ pubkey_hash: string; }; diff --git a/package-lock.json b/package-lock.json index d147b6d98b..05e450f9a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "@fastify/type-provider-typebox": "4.0.0", "@hirosystems/api-toolkit": "1.9.0", "@hirosystems/salt-n-pepper-client": "1.1.2", + "@hirosystems/stacks-encoding-native-js": "1.2.0", "@scure/base": "1.1.1", "@sinclair/typebox": "0.32.35", "@stacks/common": "6.10.0", @@ -66,7 +67,6 @@ "socket.io": "4.8.0", "source-map-support": "0.5.21", "split2": "3.2.2", - "stacks-encoding-native-js": "1.1.0-beta.8", "strict-event-emitter-types": "2.0.0", "tiny-secp256k1": "2.2.1", "ts-unused-exports": "7.0.3", @@ -1558,6 +1558,22 @@ "redis": "^4.7.0" } }, + "node_modules/@hirosystems/stacks-encoding-native-js": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@hirosystems/stacks-encoding-native-js/-/stacks-encoding-native-js-1.2.0.tgz", + "integrity": "sha512-FJ1s7c84WPCOHczMrT2YXwN7Tj48wckFpJr3qPsp877HEqAuDDMf9BvRifi8PgEHd0VYccROWlCF86Ciomp1rQ==", + "license": "GPL-3.0", + "dependencies": { + "@types/node": "^16.11.26", + "detect-libc": "^2.0.1" + } + }, + "node_modules/@hirosystems/stacks-encoding-native-js/node_modules/@types/node": { + "version": "16.18.126", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.126.tgz", + "integrity": "sha512-OTcgaiwfGFBKacvfwuHzzn1KLxH/er8mluiy8/uM3sGXHaRe73RrSIj01jow9t4kJEW633Ov+cOexXeiApTyAw==", + "license": "MIT" + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.14", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", @@ -16703,21 +16719,6 @@ "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", "dev": true }, - "node_modules/stacks-encoding-native-js": { - "version": "1.1.0-beta.8", - "resolved": "https://registry.npmjs.org/stacks-encoding-native-js/-/stacks-encoding-native-js-1.1.0-beta.8.tgz", - "integrity": "sha512-5q1unUwwPtDmkje+7Y6iGqZk9bKf7QRokLuOAfj/MXLmgJsZRJi4JOBrEzAuFa4MJexiLnNzXWLI/yTU9+/P5A==", - "license": "GPL-3.0", - "dependencies": { - "@types/node": "^16.11.26", - "detect-libc": "^2.0.1" - } - }, - "node_modules/stacks-encoding-native-js/node_modules/@types/node": { - "version": "16.18.104", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.104.tgz", - "integrity": "sha512-OF3keVCbfPlkzxnnDBUZJn1RiCJzKeadjiW0xTEb0G1SUJ5gDVb3qnzZr2T4uIFvsbKJbXy1v2DN7e2zaEY7jQ==" - }, "node_modules/standard-as-callback": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/standard-as-callback/-/standard-as-callback-2.1.0.tgz", diff --git a/package.json b/package.json index 513a991e8c..7850b6c4d8 100644 --- a/package.json +++ b/package.json @@ -98,6 +98,7 @@ "@fastify/type-provider-typebox": "4.0.0", "@hirosystems/api-toolkit": "1.9.0", "@hirosystems/salt-n-pepper-client": "1.1.2", + "@hirosystems/stacks-encoding-native-js": "1.2.0", "@scure/base": "1.1.1", "@sinclair/typebox": "0.32.35", "@stacks/common": "6.10.0", @@ -146,7 +147,6 @@ "socket.io": "4.8.0", "source-map-support": "0.5.21", "split2": "3.2.2", - "stacks-encoding-native-js": "1.1.0-beta.8", "strict-event-emitter-types": "2.0.0", "tiny-secp256k1": "2.2.1", "ts-unused-exports": "7.0.3", diff --git a/src/api/controllers/db-controller.ts b/src/api/controllers/db-controller.ts index 9c0ac09056..d7fc60e901 100644 --- a/src/api/controllers/db-controller.ts +++ b/src/api/controllers/db-controller.ts @@ -9,7 +9,7 @@ import { decodeClarityValueToRepr, decodeClarityValueToTypeName, decodePostConditions, -} from 'stacks-encoding-native-js'; +} from '@hirosystems/stacks-encoding-native-js'; import { RosettaBlock, @@ -152,6 +152,16 @@ export function getTxTenureChangeCauseString(cause: number) { return 'block_found'; case 1: return 'extended'; + case 2: + return 'extended_runtime'; + case 3: + return 'extended_read_count'; + case 4: + return 'extended_read_length'; + case 5: + return 'extended_write_count'; + case 6: + return 'extended_write_length'; default: throw new Error(`Unexpected tenure change cause value ${cause}`); } diff --git a/src/api/routes/address.ts b/src/api/routes/address.ts index 63fa9ca9de..5784cb9ae3 100644 --- a/src/api/routes/address.ts +++ b/src/api/routes/address.ts @@ -14,7 +14,7 @@ import { parseDbTx, } from '../controllers/db-controller'; import { InvalidRequestError, InvalidRequestErrorType, NotFoundError } from '../../errors'; -import { decodeClarityValueToRepr } from 'stacks-encoding-native-js'; +import { decodeClarityValueToRepr } from '@hirosystems/stacks-encoding-native-js'; import { handlePrincipalCache, handlePrincipalMempoolCache, diff --git a/src/api/routes/debug.ts b/src/api/routes/debug.ts index 0f2be6672e..72827e1421 100644 --- a/src/api/routes/debug.ts +++ b/src/api/routes/debug.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ -import { stacksToBitcoinAddress } from 'stacks-encoding-native-js'; +import { stacksToBitcoinAddress } from '@hirosystems/stacks-encoding-native-js'; import { htmlEscape } from 'escape-goat'; import { makeSTXTokenTransfer, diff --git a/src/api/routes/rosetta/construction.ts b/src/api/routes/rosetta/construction.ts index 7a802c709b..b795e9d580 100644 --- a/src/api/routes/rosetta/construction.ts +++ b/src/api/routes/rosetta/construction.ts @@ -52,7 +52,7 @@ import { uintCV, } from '@stacks/transactions'; import * as express from 'express'; -import { bitcoinToStacksAddress } from 'stacks-encoding-native-js'; +import { bitcoinToStacksAddress } from '@hirosystems/stacks-encoding-native-js'; import { StacksCoreRpcClient, getCoreNodeEndpoint } from '../../../core-rpc/client'; import { DbBlock } from '../../../datastore/common'; import { PgStore } from '../../../datastore/pg-store'; diff --git a/src/api/routes/tokens.ts b/src/api/routes/tokens.ts index e978bb8129..c60513fa3f 100644 --- a/src/api/routes/tokens.ts +++ b/src/api/routes/tokens.ts @@ -1,6 +1,6 @@ import { getPagingQueryLimit, parsePagingQueryInput, ResourceType } from '../pagination'; import { isValidPrincipal } from '../../helpers'; -import { decodeClarityValueToRepr } from 'stacks-encoding-native-js'; +import { decodeClarityValueToRepr } from '@hirosystems/stacks-encoding-native-js'; import { getAssetEventTypeString, parseDbTx } from '../controllers/db-controller'; import { handleChainTipCache } from '../controllers/cache-controller'; import { has0xPrefix } from '@hirosystems/api-toolkit'; diff --git a/src/api/routes/v2/helpers.ts b/src/api/routes/v2/helpers.ts index d1df786696..4d4bc12f6d 100644 --- a/src/api/routes/v2/helpers.ts +++ b/src/api/routes/v2/helpers.ts @@ -16,7 +16,7 @@ import { getTxStatusString, parseDbTx, } from '../../../api/controllers/db-controller'; -import { decodeClarityValueToRepr } from 'stacks-encoding-native-js'; +import { decodeClarityValueToRepr } from '@hirosystems/stacks-encoding-native-js'; import { TransactionVersion, getAddressFromPublicKey } from '@stacks/transactions'; import { SmartContractStatusList } from '../../schemas/entities/smart-contracts'; import { AddressTransaction, AddressTransactionEvent } from '../../schemas/entities/addresses'; diff --git a/src/api/schemas/entities/transactions.ts b/src/api/schemas/entities/transactions.ts index 2491e82c7c..e3b1a005b2 100644 --- a/src/api/schemas/entities/transactions.ts +++ b/src/api/schemas/entities/transactions.ts @@ -324,10 +324,21 @@ export const TenureChangeTransactionMetadataProperties = { previous_tenure_blocks: Type.Integer({ description: 'The number of blocks produced in the previous tenure.', }), - cause: Type.Union([Type.Literal('block_found'), Type.Literal('extended')], { - description: - 'Cause of change in mining tenure. Depending on cause, tenure can be ended or extended.', - }), + cause: Type.Union( + [ + Type.Literal('block_found'), + Type.Literal('extended'), + Type.Literal('extended_runtime'), + Type.Literal('extended_read_count'), + Type.Literal('extended_read_length'), + Type.Literal('extended_write_count'), + Type.Literal('extended_write_length'), + ], + { + description: + 'Cause of change in mining tenure. Depending on cause, tenure can be ended or extended.', + } + ), pubkey_hash: Type.String({ description: '(Hex string) The ECDSA public key hash of the current tenure.', }), diff --git a/src/api/serializers/post-conditions.ts b/src/api/serializers/post-conditions.ts index 4bf66aa96c..a1f3b5848d 100644 --- a/src/api/serializers/post-conditions.ts +++ b/src/api/serializers/post-conditions.ts @@ -3,7 +3,7 @@ import { PostConditionAssetInfoID, PostConditionPrincipal, PostConditionPrincipalTypeID, -} from 'stacks-encoding-native-js'; +} from '@hirosystems/stacks-encoding-native-js'; const assetPrincipalTypeMap = { [PostConditionPrincipalTypeID.Origin]: 'principal_origin', diff --git a/src/c32-addr-cache.ts b/src/c32-addr-cache.ts index fa49292959..4ab9f65429 100644 --- a/src/c32-addr-cache.ts +++ b/src/c32-addr-cache.ts @@ -9,7 +9,7 @@ and for now this approach is much easier and faster. import * as c32check from 'c32check'; import * as LruCache from 'lru-cache'; -import { stacksAddressFromParts } from 'stacks-encoding-native-js'; +import { stacksAddressFromParts } from '@hirosystems/stacks-encoding-native-js'; type c32AddressFn = typeof c32check.c32address; diff --git a/src/datastore/helpers.ts b/src/datastore/helpers.ts index fa649218a7..72c34459b9 100644 --- a/src/datastore/helpers.ts +++ b/src/datastore/helpers.ts @@ -58,7 +58,7 @@ import { PostConditionAuthFlag, PrincipalTypeID, TxPayloadTypeID, -} from 'stacks-encoding-native-js'; +} from '@hirosystems/stacks-encoding-native-js'; import { getTxSenderAddress } from '../event-stream/reader'; import postgres = require('postgres'); import * as prom from 'prom-client'; diff --git a/src/event-stream/bns/bns-helpers.ts b/src/event-stream/bns/bns-helpers.ts index 9dd35db5c6..4e51b7292c 100644 --- a/src/event-stream/bns/bns-helpers.ts +++ b/src/event-stream/bns/bns-helpers.ts @@ -21,7 +21,7 @@ import { ClarityValueTuple, ClarityValueUInt, TxPayloadTypeID, -} from 'stacks-encoding-native-js'; +} from '@hirosystems/stacks-encoding-native-js'; import { SmartContractEvent } from '../core-node-message'; import { DbBnsNamespace, DbBnsName } from '../../datastore/common'; import { hexToBuffer, hexToUtf8String } from '@hirosystems/api-toolkit'; diff --git a/src/event-stream/core-node-message.ts b/src/event-stream/core-node-message.ts index 0656794d83..dc3c3483d7 100644 --- a/src/event-stream/core-node-message.ts +++ b/src/event-stream/core-node-message.ts @@ -1,4 +1,4 @@ -import { DecodedTxResult } from 'stacks-encoding-native-js'; +import { DecodedTxResult } from '@hirosystems/stacks-encoding-native-js'; import { ClarityAbi } from './contract-abi'; export enum CoreNodeEventType { diff --git a/src/event-stream/event-server.ts b/src/event-stream/event-server.ts index 3b22a09362..aaa8b8c2ee 100644 --- a/src/event-stream/event-server.ts +++ b/src/event-stream/event-server.ts @@ -59,7 +59,7 @@ import { ClarityValueStringAscii, ClarityValueTuple, TxPayloadTypeID, -} from 'stacks-encoding-native-js'; +} from '@hirosystems/stacks-encoding-native-js'; import { BnsContractIdentifier } from './bns/bns-constants'; import { parseNameFromContractEvent, diff --git a/src/event-stream/pox-event-parsing.ts b/src/event-stream/pox-event-parsing.ts index 5466fea729..96a2da2d3b 100644 --- a/src/event-stream/pox-event-parsing.ts +++ b/src/event-stream/pox-event-parsing.ts @@ -29,7 +29,7 @@ import { ClarityValueTuple, ClarityValueUInt, decodeClarityValue, -} from 'stacks-encoding-native-js'; +} from '@hirosystems/stacks-encoding-native-js'; import { poxAddressToBtcAddress } from '@stacks/stacking'; import { SyntheticPoxEventName } from '../pox-helpers'; import { logger } from '../logger'; diff --git a/src/event-stream/reader.ts b/src/event-stream/reader.ts index 6525d818c6..a884ddd425 100644 --- a/src/event-stream/reader.ts +++ b/src/event-stream/reader.ts @@ -34,7 +34,7 @@ import { TxSpendingConditionSingleSigHashMode, decodeClarityValueList, ClarityValueBuffer, -} from 'stacks-encoding-native-js'; +} from '@hirosystems/stacks-encoding-native-js'; import { DbMicroblockPartial, DbPoxSyntheticDelegateStxEvent, diff --git a/src/helpers.ts b/src/helpers.ts index 377e810a98..2ed64aa0f1 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -4,7 +4,10 @@ import * as btc from 'bitcoinjs-lib'; import * as dotenv from 'dotenv-flow'; import * as http from 'http'; import * as path from 'path'; -import { isValidStacksAddress, stacksToBitcoinAddress } from 'stacks-encoding-native-js'; +import { + isValidStacksAddress, + stacksToBitcoinAddress, +} from '@hirosystems/stacks-encoding-native-js'; import * as stream from 'stream'; import * as ecc from 'tiny-secp256k1'; import * as util from 'util'; diff --git a/src/import-v1/index.ts b/src/import-v1/index.ts index d016578cd3..9be7bff568 100644 --- a/src/import-v1/index.ts +++ b/src/import-v1/index.ts @@ -5,7 +5,7 @@ import * as util from 'util'; import * as readline from 'readline'; import * as path from 'path'; import * as zlib from 'zlib'; -import { bitcoinToStacksAddress } from 'stacks-encoding-native-js'; +import { bitcoinToStacksAddress } from '@hirosystems/stacks-encoding-native-js'; import * as split2 from 'split2'; import { DataStoreBnsBlockTxData, diff --git a/src/inspector-util.ts b/src/inspector-util.ts index be456661af..b2a083c367 100644 --- a/src/inspector-util.ts +++ b/src/inspector-util.ts @@ -9,7 +9,7 @@ import { Socket } from 'net'; import * as os from 'os'; import * as path from 'path'; import * as fs from 'fs'; -import { startProfiler, stopProfiler } from 'stacks-encoding-native-js'; +import { startProfiler, stopProfiler } from '@hirosystems/stacks-encoding-native-js'; import { logger } from './logger'; import { stopwatch, Stopwatch, timeout } from '@hirosystems/api-toolkit'; diff --git a/src/rosetta/rosetta-helpers.ts b/src/rosetta/rosetta-helpers.ts index e7be28cc3a..c2a540c013 100644 --- a/src/rosetta/rosetta-helpers.ts +++ b/src/rosetta/rosetta-helpers.ts @@ -65,7 +65,7 @@ import { decodeClarityValueList, ClarityValue, ClarityValueList, -} from 'stacks-encoding-native-js'; +} from '@hirosystems/stacks-encoding-native-js'; import { PgStore } from '../datastore/pg-store'; import { poxAddressToBtcAddress } from '@stacks/stacking'; import { parseRecoverableSignatureVrs } from '@stacks/common'; diff --git a/tests/2.5/pox-4-burnchain-delegate-stx.test.ts b/tests/2.5/pox-4-burnchain-delegate-stx.test.ts index 374fb56385..1dcc824128 100644 --- a/tests/2.5/pox-4-burnchain-delegate-stx.test.ts +++ b/tests/2.5/pox-4-burnchain-delegate-stx.test.ts @@ -31,7 +31,7 @@ import { StacksNetwork } from '@stacks/network'; import { RPCClient } from 'rpc-bitcoin'; import * as supertest from 'supertest'; import { PoxContractIdentifier } from '../../src/pox-helpers'; -import { ClarityValueUInt, decodeClarityValue } from 'stacks-encoding-native-js'; +import { ClarityValueUInt, decodeClarityValue } from '@hirosystems/stacks-encoding-native-js'; import { decodeBtcAddress, poxAddressToBtcAddress } from '@stacks/stacking'; import { timeout } from '@hirosystems/api-toolkit'; import { AddressStxBalance } from '../../src/api/schemas/entities/addresses'; diff --git a/tests/2.5/pox-4-burnchain-stack-stx.test.ts b/tests/2.5/pox-4-burnchain-stack-stx.test.ts index dbc6fe35f2..572ff46296 100644 --- a/tests/2.5/pox-4-burnchain-stack-stx.test.ts +++ b/tests/2.5/pox-4-burnchain-stack-stx.test.ts @@ -30,7 +30,7 @@ import { ApiServer } from '../../src/api/init'; import { StacksNetwork } from '@stacks/network'; import { RPCClient } from 'rpc-bitcoin'; import * as supertest from 'supertest'; -import { ClarityValueUInt, decodeClarityValue } from 'stacks-encoding-native-js'; +import { ClarityValueUInt, decodeClarityValue } from '@hirosystems/stacks-encoding-native-js'; import { decodeBtcAddress, poxAddressToTuple } from '@stacks/stacking'; import { timeout } from '@hirosystems/api-toolkit'; import { hexToBytes } from '@stacks/common'; diff --git a/tests/2.5/pox-4-delegate-aggregation.test.ts b/tests/2.5/pox-4-delegate-aggregation.test.ts index 33d1db5bda..698538a8a5 100644 --- a/tests/2.5/pox-4-delegate-aggregation.test.ts +++ b/tests/2.5/pox-4-delegate-aggregation.test.ts @@ -33,7 +33,7 @@ import { ClarityValueTuple, ClarityValueUInt, decodeClarityValue, -} from 'stacks-encoding-native-js'; +} from '@hirosystems/stacks-encoding-native-js'; import * as assert from 'assert'; import { hexToBytes } from '@stacks/common'; import { StackingClient } from '@stacks/stacking'; diff --git a/tests/2.5/pox-4-delegate-revoked-stacking.test.ts b/tests/2.5/pox-4-delegate-revoked-stacking.test.ts index d4eeb236da..099722b3b6 100644 --- a/tests/2.5/pox-4-delegate-revoked-stacking.test.ts +++ b/tests/2.5/pox-4-delegate-revoked-stacking.test.ts @@ -13,7 +13,11 @@ import { standardPrincipalCV, uintCV, } from '@stacks/transactions'; -import { ClarityValueTuple, ClarityValueUInt, decodeClarityValue } from 'stacks-encoding-native-js'; +import { + ClarityValueTuple, + ClarityValueUInt, + decodeClarityValue, +} from '@hirosystems/stacks-encoding-native-js'; import { testnetKeys } from '../../src/api/routes/debug'; import { CoreRpcPoxInfo } from '../../src/core-rpc/client'; import { DbTxStatus } from '../../src/datastore/common'; diff --git a/tests/2.5/pox-4-delegate-stacking.test.ts b/tests/2.5/pox-4-delegate-stacking.test.ts index ec6b399be2..0d4fb0c5d5 100644 --- a/tests/2.5/pox-4-delegate-stacking.test.ts +++ b/tests/2.5/pox-4-delegate-stacking.test.ts @@ -24,7 +24,7 @@ import { standardPrincipalCV, uintCV, } from '@stacks/transactions'; -import { ClarityValueTuple, ClarityValueUInt } from 'stacks-encoding-native-js'; +import { ClarityValueTuple, ClarityValueUInt } from '@hirosystems/stacks-encoding-native-js'; import * as assert from 'assert'; import { StackingClient } from '@stacks/stacking'; import { getPublicKeyFromPrivate } from '@stacks/encryption'; diff --git a/tests/api/address.test.ts b/tests/api/address.test.ts index 745018bec4..167524fd12 100644 --- a/tests/api/address.test.ts +++ b/tests/api/address.test.ts @@ -12,7 +12,7 @@ import { serializeCV, } from '@stacks/transactions'; import { createClarityValueArray } from '../../src/stacks-encoding-helpers'; -import { decodeTransaction } from 'stacks-encoding-native-js'; +import { decodeTransaction } from '@hirosystems/stacks-encoding-native-js'; import { DbBlock, DbTxTypeId, diff --git a/tests/api/helpers.test.ts b/tests/api/helpers.test.ts index d2c706e111..4d052c0db1 100644 --- a/tests/api/helpers.test.ts +++ b/tests/api/helpers.test.ts @@ -1,6 +1,9 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import * as c32check from 'c32check'; -import { bitcoinToStacksAddress, stacksToBitcoinAddress } from 'stacks-encoding-native-js'; +import { + bitcoinToStacksAddress, + stacksToBitcoinAddress, +} from '@hirosystems/stacks-encoding-native-js'; import * as c32AddrCache from '../../src/c32-addr-cache'; import { ADDR_CACHE_ENV_VAR } from '../../src/c32-addr-cache'; import { isValidBitcoinAddress, getUintEnvOrDefault, BitVec } from '../../src/helpers'; diff --git a/tests/api/import-genesis.test.ts b/tests/api/import-genesis.test.ts index 2fdc3331fd..0453b10fce 100644 --- a/tests/api/import-genesis.test.ts +++ b/tests/api/import-genesis.test.ts @@ -1,5 +1,5 @@ import { importV1TokenOfferingData } from '../../src/import-v1'; -import { bitcoinToStacksAddress } from 'stacks-encoding-native-js'; +import { bitcoinToStacksAddress } from '@hirosystems/stacks-encoding-native-js'; import { PgWriteStore } from '../../src/datastore/pg-write-store'; import { migrate } from '../utils/test-helpers'; diff --git a/tests/api/parse-db-tx.test.ts b/tests/api/parse-db-tx.test.ts index 085c365702..cb7060b610 100644 --- a/tests/api/parse-db-tx.test.ts +++ b/tests/api/parse-db-tx.test.ts @@ -1,6 +1,6 @@ import { migrate } from '../utils/test-helpers'; import { importEventsFromTsv } from '../../src/event-replay/event-replay'; -import { decodeClarityValueList } from 'stacks-encoding-native-js'; +import { decodeClarityValueList } from '@hirosystems/stacks-encoding-native-js'; import * as fs from 'fs'; import * as readline from 'readline'; import { PgSqlClient, timeout } from '@hirosystems/api-toolkit'; diff --git a/tests/api/synthetic-stx-txs.test.ts b/tests/api/synthetic-stx-txs.test.ts index b19769c30c..ebefbb67e7 100644 --- a/tests/api/synthetic-stx-txs.test.ts +++ b/tests/api/synthetic-stx-txs.test.ts @@ -1,7 +1,7 @@ import { ChainID } from '@stacks/transactions'; import * as fs from 'fs'; import * as path from 'path'; -import { DecodedTxResult, TxPayloadTypeID } from 'stacks-encoding-native-js'; +import { DecodedTxResult, TxPayloadTypeID } from '@hirosystems/stacks-encoding-native-js'; import { CoreNodeBlockMessage } from '../../src/event-stream/core-node-message'; import { CoreNodeMsgBlockData, parseMessageTransaction } from '../../src/event-stream/reader'; import { parseNewBlockMessage } from '../../src/event-stream/event-server'; diff --git a/tests/api/tx.test.ts b/tests/api/tx.test.ts index e66bec0707..8349ccef2d 100644 --- a/tests/api/tx.test.ts +++ b/tests/api/tx.test.ts @@ -21,7 +21,10 @@ import { stringAsciiCV, } from '@stacks/transactions'; import { createClarityValueArray } from '../../src/stacks-encoding-helpers'; -import { decodeTransaction, TxPayloadVersionedSmartContract } from 'stacks-encoding-native-js'; +import { + decodeTransaction, + TxPayloadVersionedSmartContract, +} from '@hirosystems/stacks-encoding-native-js'; import { getTxFromDataStore, TransactionType } from '../../src/api/controllers/db-controller'; import { DbBlock, diff --git a/tests/rosetta/api.test.ts b/tests/rosetta/api.test.ts index 505acb8ed9..cdca2b3472 100644 --- a/tests/rosetta/api.test.ts +++ b/tests/rosetta/api.test.ts @@ -818,131 +818,157 @@ describe('Rosetta API', () => { }); }); - test('epoch3 tenure-change block/transaction', async () => { - const parentData = new TestBlockBuilder().addTx().build(); - const block1: TestBlockArgs = { - block_height: 2, - block_hash: '0xd0dd05e3d0a1bd60640c9d9d30d57012ffe47b52fe643140c39199c757d37e3f', - index_block_hash: '0x6a36c14514047074c2877065809bbb70d81d52507747f4616da997deb7228fad', - parent_index_block_hash: parentData.block.index_block_hash, - parent_block_hash: parentData.block.block_hash, - parent_microblock_hash: '0x0000000000000000000000000000000000000000000000000000000000000000', - burn_block_hash: '0xfe15c0d3ebe314fad720a08b839a004c2e6386f5aecc19ec74807d1920cb6aeb', - miner_txid: '0x0000000000000000000000000000000000000000000000000000000000000000', - }; - const txTenureChange1: TestTxArgs = { - tx_id: '0xc152de9376bab4fc27291c9cd088643698290a12bb511d768f873cb3d280eb48', - tx_index: 1, - type_id: DbTxTypeId.TenureChange, - status: DbTxStatus.Success, - raw_result: '0x0703', - canonical: true, - microblock_canonical: true, - microblock_sequence: 2147483647, - microblock_hash: '0x00', - fee_rate: 0n, - sender_address: 'ST1HB1T8WRNBYB0Y3T7WXZS38NKKPTBR3EG9EPJKR', - tenure_change_tenure_consensus_hash: '0x2fedd90a5f318ed8cec419fd1c6656b5af452497', - tenure_change_prev_tenure_consensus_hash: '0x5104aae6d442b49c8e8d2031df7f40b67528e654', - tenure_change_burn_view_consensus_hash: '0x2fedd90a5f318ed8cec419fd1c6656b5af452497', - tenure_change_previous_tenure_end: - '0xb77b061202b1e6dce889ba1633efa969d3c24679d32a7542d29015ee94e8a860', - tenure_change_previous_tenure_blocks: 9, - tenure_change_cause: 0, - tenure_change_pubkey_hash: '0x62b4273562dfa3825496094507564bf2b30c8b11', - }; - const blockData1 = new TestBlockBuilder(block1).addTx(txTenureChange1).build(); - - await db.update(parentData); - await db.update(blockData1); - - const query1 = await supertest(api.server) - .post(`/rosetta/v1/block/transaction`) - .send({ - network_identifier: { blockchain: 'stacks', network: 'testnet' }, - block_identifier: { - index: blockData1.block.block_height, - hash: blockData1.block.block_hash, - }, - transaction_identifier: { hash: txTenureChange1.tx_id }, - }); - expect(query1.status).toBe(200); - expect(query1.type).toBe('application/json'); - expect(query1.body).toEqual({ - transaction_identifier: { - hash: txTenureChange1.tx_id, - }, - operations: [ - { - operation_identifier: { - index: 0, - }, - type: 'tenure_change', - status: 'success', - metadata: { - tenure_consensus_hash: txTenureChange1.tenure_change_tenure_consensus_hash, - prev_tenure_consensus_hash: txTenureChange1.tenure_change_prev_tenure_consensus_hash, - burn_view_consensus_hash: txTenureChange1.tenure_change_burn_view_consensus_hash, - previous_tenure_end: txTenureChange1.tenure_change_previous_tenure_end, - previous_tenure_blocks: txTenureChange1.tenure_change_previous_tenure_blocks, - cause: 'block_found', - pubkey_hash: txTenureChange1.tenure_change_pubkey_hash, + describe('epoch3 tenure-change block/transaction', () => { + const changeTenure = async (cause: number, causeString: string) => { + const parentData = new TestBlockBuilder().addTx().build(); + const block1: TestBlockArgs = { + block_height: 2, + block_hash: '0xd0dd05e3d0a1bd60640c9d9d30d57012ffe47b52fe643140c39199c757d37e3f', + index_block_hash: '0x6a36c14514047074c2877065809bbb70d81d52507747f4616da997deb7228fad', + parent_index_block_hash: parentData.block.index_block_hash, + parent_block_hash: parentData.block.block_hash, + parent_microblock_hash: + '0x0000000000000000000000000000000000000000000000000000000000000000', + burn_block_hash: '0xfe15c0d3ebe314fad720a08b839a004c2e6386f5aecc19ec74807d1920cb6aeb', + miner_txid: '0x0000000000000000000000000000000000000000000000000000000000000000', + }; + const txTenureChange1: TestTxArgs = { + tx_id: '0xc152de9376bab4fc27291c9cd088643698290a12bb511d768f873cb3d280eb48', + tx_index: 1, + type_id: DbTxTypeId.TenureChange, + status: DbTxStatus.Success, + raw_result: '0x0703', + canonical: true, + microblock_canonical: true, + microblock_sequence: 2147483647, + microblock_hash: '0x00', + fee_rate: 0n, + sender_address: 'ST1HB1T8WRNBYB0Y3T7WXZS38NKKPTBR3EG9EPJKR', + tenure_change_tenure_consensus_hash: '0x2fedd90a5f318ed8cec419fd1c6656b5af452497', + tenure_change_prev_tenure_consensus_hash: '0x5104aae6d442b49c8e8d2031df7f40b67528e654', + tenure_change_burn_view_consensus_hash: '0x2fedd90a5f318ed8cec419fd1c6656b5af452497', + tenure_change_previous_tenure_end: + '0xb77b061202b1e6dce889ba1633efa969d3c24679d32a7542d29015ee94e8a860', + tenure_change_previous_tenure_blocks: 9, + tenure_change_cause: cause, + tenure_change_pubkey_hash: '0x62b4273562dfa3825496094507564bf2b30c8b11', + }; + const blockData1 = new TestBlockBuilder(block1).addTx(txTenureChange1).build(); + + await db.update(parentData); + await db.update(blockData1); + + const query1 = await supertest(api.server) + .post(`/rosetta/v1/block/transaction`) + .send({ + network_identifier: { blockchain: 'stacks', network: 'testnet' }, + block_identifier: { + index: blockData1.block.block_height, + hash: blockData1.block.block_hash, }, + transaction_identifier: { hash: txTenureChange1.tx_id }, + }); + expect(query1.status).toBe(200); + expect(query1.type).toBe('application/json'); + expect(query1.body).toEqual({ + transaction_identifier: { + hash: txTenureChange1.tx_id, }, - ], - }); - - const query2 = await supertest(api.address) - .post(`/rosetta/v1/block`) - .send({ - network_identifier: { blockchain: 'stacks', network: 'testnet' }, - block_identifier: { index: blockData1.block.block_height }, - }); - expect(query1.status).toBe(200); - expect(query1.type).toBe('application/json'); - const expected: RosettaBlockResponse = { - block: { - block_identifier: { - index: blockData1.block.block_height, - hash: blockData1.block.block_hash, - }, - parent_block_identifier: { - index: blockData1.block.block_height - 1, - hash: blockData1.block.parent_block_hash, - }, - timestamp: blockData1.block.burn_block_time * 1000, - transactions: [ + operations: [ { - transaction_identifier: { - hash: txTenureChange1.tx_id as string, + operation_identifier: { + index: 0, + }, + type: 'tenure_change', + status: 'success', + metadata: { + tenure_consensus_hash: txTenureChange1.tenure_change_tenure_consensus_hash, + prev_tenure_consensus_hash: txTenureChange1.tenure_change_prev_tenure_consensus_hash, + burn_view_consensus_hash: txTenureChange1.tenure_change_burn_view_consensus_hash, + previous_tenure_end: txTenureChange1.tenure_change_previous_tenure_end, + previous_tenure_blocks: txTenureChange1.tenure_change_previous_tenure_blocks, + cause: causeString, + pubkey_hash: txTenureChange1.tenure_change_pubkey_hash, }, - operations: [ - { - operation_identifier: { - index: 0, - }, - type: 'tenure_change', - status: 'success', - metadata: { - tenure_consensus_hash: txTenureChange1.tenure_change_tenure_consensus_hash, - prev_tenure_consensus_hash: - txTenureChange1.tenure_change_prev_tenure_consensus_hash, - burn_view_consensus_hash: txTenureChange1.tenure_change_burn_view_consensus_hash, - previous_tenure_end: txTenureChange1.tenure_change_previous_tenure_end, - previous_tenure_blocks: txTenureChange1.tenure_change_previous_tenure_blocks, - cause: 'block_found', - pubkey_hash: txTenureChange1.tenure_change_pubkey_hash, - }, - }, - ], }, ], - metadata: { - burn_block_height: blockData1.block.burn_block_height, + }); + + const query2 = await supertest(api.address) + .post(`/rosetta/v1/block`) + .send({ + network_identifier: { blockchain: 'stacks', network: 'testnet' }, + block_identifier: { index: blockData1.block.block_height }, + }); + expect(query1.status).toBe(200); + expect(query1.type).toBe('application/json'); + const expected: RosettaBlockResponse = { + block: { + block_identifier: { + index: blockData1.block.block_height, + hash: blockData1.block.block_hash, + }, + parent_block_identifier: { + index: blockData1.block.block_height - 1, + hash: blockData1.block.parent_block_hash, + }, + timestamp: blockData1.block.burn_block_time * 1000, + transactions: [ + { + transaction_identifier: { + hash: txTenureChange1.tx_id as string, + }, + operations: [ + { + operation_identifier: { + index: 0, + }, + type: 'tenure_change', + status: 'success', + metadata: { + tenure_consensus_hash: txTenureChange1.tenure_change_tenure_consensus_hash, + prev_tenure_consensus_hash: + txTenureChange1.tenure_change_prev_tenure_consensus_hash, + burn_view_consensus_hash: + txTenureChange1.tenure_change_burn_view_consensus_hash, + previous_tenure_end: txTenureChange1.tenure_change_previous_tenure_end, + previous_tenure_blocks: txTenureChange1.tenure_change_previous_tenure_blocks, + cause: causeString, + pubkey_hash: txTenureChange1.tenure_change_pubkey_hash, + }, + }, + ], + }, + ], + metadata: { + burn_block_height: blockData1.block.burn_block_height, + }, }, - }, + }; + expect(query2.body).toEqual(expected); }; - expect(query2.body).toEqual(expected); + + test('block_found', async () => { + await expect(changeTenure(0, 'block_found')).resolves.not.toThrow(); + }); + test('extended', async () => { + await expect(changeTenure(1, 'extended')).resolves.not.toThrow(); + }); + test('extended_runtime', async () => { + await expect(changeTenure(2, 'extended_runtime')).resolves.not.toThrow(); + }); + test('extended_read_count', async () => { + await expect(changeTenure(3, 'extended_read_count')).resolves.not.toThrow(); + }); + test('extended_read_length', async () => { + await expect(changeTenure(4, 'extended_read_length')).resolves.not.toThrow(); + }); + test('extended_write_length', async () => { + await expect(changeTenure(5, 'extended_write_count')).resolves.not.toThrow(); + }); + test('extended_read_count', async () => { + await expect(changeTenure(6, 'extended_write_length')).resolves.not.toThrow(); + }); }); test('block/transaction - invalid transaction hash', async () => { diff --git a/tests/subnets/subnet.test.ts b/tests/subnets/subnet.test.ts index c478b3756e..d2776bae9f 100644 --- a/tests/subnets/subnet.test.ts +++ b/tests/subnets/subnet.test.ts @@ -25,7 +25,7 @@ import { } from '@stacks/transactions'; import { StacksCoreRpcClient } from '../../src/core-rpc/client'; import { StacksTestnet } from '@stacks/network'; -import { ClarityTypeID, decodeClarityValue } from 'stacks-encoding-native-js'; +import { ClarityTypeID, decodeClarityValue } from '@hirosystems/stacks-encoding-native-js'; import { timeout } from '@hirosystems/api-toolkit'; import { TransactionEventsResponse, diff --git a/tests/utils/test-helpers.ts b/tests/utils/test-helpers.ts index 0245f8920e..1b95e218a6 100644 --- a/tests/utils/test-helpers.ts +++ b/tests/utils/test-helpers.ts @@ -37,7 +37,7 @@ import { ClarityTypeID, ClarityValue as NativeClarityValue, decodeClarityValue, -} from 'stacks-encoding-native-js'; +} from '@hirosystems/stacks-encoding-native-js'; import * as supertest from 'supertest'; import { ApiServer } from '../../src/api/init'; import { testnetKeys } from '../../src/api/routes/debug';