diff --git a/app/global.css b/app/global.css index c53b87456..64465e9a8 100644 --- a/app/global.css +++ b/app/global.css @@ -473,7 +473,9 @@ a[href="/stacks/api/blocks/block-by-burn-block-height"], a[href="/stacks/api/blocks/block-by-hash"], a[href="/stacks/api/blocks/block-by-height"], a[href="/stacks/api/blocks/recent-blocks"], -a[href="/stacks/api/fees/fee-rate"] { +a[href="/stacks/api/fees/fee-rate"], +a[href="/stacks/api/accounts/balances"], +a[href="/stacks/api/accounts/stx-balances"] { text-decoration: line-through; color: hsl(var(--muted-foreground) / var(--tw-text-opacity)); } diff --git a/content/docs/stacks/api/accounts/assets.mdx b/content/docs/stacks/api/accounts/assets.mdx index 44fa66d7a..6abfbee24 100644 --- a/content/docs/stacks/api/accounts/assets.mdx +++ b/content/docs/stacks/api/accounts/assets.mdx @@ -29,38 +29,34 @@ import { ## Get account assets Retrieves a list of all assets events associated with an account or a Contract Identifier. This includes Transfers, Mints. -### Path Parameters - +### Query Parameters -Stacks address or a Contract identifier + -Example: `"SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0"` +Results per page - -### Query Parameters +Default: `20` - +Minimum: `0` -max number of account assets to fetch - -Example: `20` +Maximum: `100` - + + +Result offset -index of first account assets to fetch +Default: `0` -Example: `42000` +Minimum: `0` -Include transaction data from unanchored (i.e. unconfirmed) microblocks - -Example: `true` +Include data from unanchored (i.e. unconfirmed) microblocks Default: `false` @@ -68,17 +64,22 @@ Include transaction data from unanchored (i.e. unconfirmed) microblocks -returned data representing the state at that point in time, rather than the current block. Note - Use either of the query parameters but not both at a time. +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. -Example: `60000` + + +### Path Parameters + + | Status code | Description | -| :------ | :------ | -| `200` | Success | +| ----------- | ----------- | +| `200` | Default Response | +| `4XX` | Default Response | - + @@ -90,8 +91,8 @@ returned data representing the state at that point in time, rather than the curr -```terminal -$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/assets?limit=20&offset=42000&unanchored=true&until_block=60000" +```bash +curl -X GET "https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/assets?limit=20&offset=0&unanchored=false&until_block=string" ``` @@ -99,7 +100,7 @@ $ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11B ```js -fetch("https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/assets?limit=20&offset=42000&unanchored=true&until_block=60000", { +fetch("https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/assets?limit=20&offset=0&unanchored=false&until_block=string", { method: "GET" }); ``` @@ -108,21 +109,19 @@ fetch("https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0 - + -GET request that returns address assets - ```json { - "limit": 30, + "limit": 20, "offset": 0, - "total": 0, + "total": 1, "results": [ { "event_index": 0, @@ -146,16 +145,10 @@ GET request that returns address assets ```ts -export type TransactionEvent = - | TransactionEventSmartContractLog - | TransactionEventStxLock - | TransactionEventStxAsset - | TransactionEventFungibleAsset - | TransactionEventNonFungibleAsset; /** * Only present in `smart_contract` and `contract_call` tx types. */ -export type TransactionEventSmartContractLog = AbstractTransactionEvent & { +export type SmartContractLogTransactionEvent = AbstractTransactionEvent & { event_type: "smart_contract_log"; tx_id: string; contract_log: { @@ -170,7 +163,7 @@ export type TransactionEventSmartContractLog = AbstractTransactionEvent & { /** * Only present in `smart_contract` and `contract_call` tx types. */ -export type TransactionEventStxLock = AbstractTransactionEvent & { +export type StxLockTransactionEvent = AbstractTransactionEvent1 & { event_type: "stx_lock"; tx_id: string; stx_lock_event: { @@ -182,28 +175,33 @@ export type TransactionEventStxLock = AbstractTransactionEvent & { /** * Only present in `smart_contract` and `contract_call` tx types. */ -export type TransactionEventStxAsset = AbstractTransactionEvent & { +export type StxAssetTransactionEvent = AbstractTransactionEvent2 & { event_type: "stx_asset"; tx_id: string; - asset: TransactionEventAsset; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; }; -export type TransactionEventAssetType = "transfer" | "mint" | "burn"; -export type TransactionEventFungibleAsset = AbstractTransactionEvent & { +export type FungibleTokenAssetTransactionEvent = AbstractTransactionEvent3 & { event_type: "fungible_token_asset"; tx_id: string; asset: { - asset_event_type: string; + asset_event_type: "transfer" | "mint" | "burn"; asset_id: string; sender: string; recipient: string; amount: string; }; }; -export type TransactionEventNonFungibleAsset = AbstractTransactionEvent & { +export type NonFungibleTokenAssetTransactionEvent = AbstractTransactionEvent4 & { event_type: "non_fungible_token_asset"; tx_id: string; asset: { - asset_event_type: string; + asset_event_type: "transfer" | "mint" | "burn"; asset_id: string; sender: string; recipient: string; @@ -214,26 +212,63 @@ export type TransactionEventNonFungibleAsset = AbstractTransactionEvent & { }; }; -/** - * GET request that returns address assets - */ export interface AddressAssetsListResponse { limit: number; offset: number; total: number; - results: TransactionEvent[]; + results: ( + | SmartContractLogTransactionEvent + | StxLockTransactionEvent + | StxAssetTransactionEvent + | FungibleTokenAssetTransactionEvent + | NonFungibleTokenAssetTransactionEvent + )[]; } export interface AbstractTransactionEvent { event_index: number; } -export interface TransactionEventAsset { - asset_event_type?: TransactionEventAssetType; - asset_id?: string; - sender?: string; - recipient?: string; - amount?: string; - value?: string; - memo?: string; +export interface AbstractTransactionEvent1 { + event_index: number; +} +export interface AbstractTransactionEvent2 { + event_index: number; +} +export interface AbstractTransactionEvent3 { + event_index: number; +} +export interface AbstractTransactionEvent4 { + event_index: number; +} +``` + + + + + + + + + + + + + +```json +{ + "error": "string", + "message": "string" +} +``` + + + + + +```ts +export interface ErrorResponse { + error: string; + message?: string; + [k: string]: unknown; } ``` diff --git a/content/docs/stacks/api/accounts/balances.mdx b/content/docs/stacks/api/accounts/balances.mdx index aabdefb5f..978ed7eec 100644 --- a/content/docs/stacks/api/accounts/balances.mdx +++ b/content/docs/stacks/api/accounts/balances.mdx @@ -28,23 +28,15 @@ import { ## Get account 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. -### Path Parameters - - - -Stacks address or a Contract identifier +**NOTE:** This endpoint is deprecated in favor of [Get address FT balances](/stacks/api/accounts/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. -Example: `"SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0"` - - ### Query Parameters -Include transaction data from unanchored (i.e. unconfirmed) microblocks - -Example: `true` +Include data from unanchored (i.e. unconfirmed) microblocks Default: `false` @@ -52,17 +44,22 @@ Include transaction data from unanchored (i.e. unconfirmed) microblocks -returned data representing the state up until that point in time, rather than the current block. +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. -Example: `60000` + + +### Path Parameters + + | Status code | Description | -| :------ | :------ | -| `200` | Success | +| ----------- | ----------- | +| `200` | GET request that returns address balances | +| `4XX` | Default Response | - + @@ -74,8 +71,8 @@ returned data representing the state up until that point in time, rather than th -```terminal -$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/balances?unanchored=true&until_block=60000" +```bash +curl -X GET "https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/balances?unanchored=false&until_block=string" ``` @@ -83,7 +80,7 @@ $ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11B ```js -fetch("https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/balances?unanchored=true&until_block=60000", { +fetch("https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/balances?unanchored=false&until_block=string", { method: "GET" }); ``` @@ -92,7 +89,7 @@ fetch("https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0 - + @@ -106,6 +103,9 @@ GET request that returns address balances { "stx": { "balance": "string", + "estimated_balance": "string", + "pending_balance_inbound": "string", + "pending_balance_outbound": "string", "total_sent": "string", "total_received": "string", "total_fees_sent": "string", @@ -173,9 +173,21 @@ export interface AddressBalanceResponse { } export interface StxBalance { balance: string; - total_sent: string; - total_received: string; - total_fees_sent: string; + /** + * Total STX balance considering pending mempool transactions + */ + estimated_balance?: string; + /** + * Inbound STX balance from pending mempool transactions + */ + pending_balance_inbound?: string; + /** + * 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; /** * The transaction where the lock event occurred. Empty if no tokens are locked. @@ -240,6 +252,37 @@ export interface AddressUnlockSchedule { + + + + + + +```json +{ + "error": "string", + "message": "string" +} +``` + + + + + +```ts +export interface ErrorResponse { + error: string; + message?: string; + [k: string]: unknown; +} +``` + + + + + + + diff --git a/content/docs/stacks/api/accounts/inbound-stx-transfers.mdx b/content/docs/stacks/api/accounts/inbound-stx-transfers.mdx index 595d9fe52..bdf74d141 100644 --- a/content/docs/stacks/api/accounts/inbound-stx-transfers.mdx +++ b/content/docs/stacks/api/accounts/inbound-stx-transfers.mdx @@ -29,44 +29,41 @@ import { ## Get inbound STX transfers Retrieves a list of STX transfers with memos to the given principal. This includes regular transfers from a stx-transfer transaction type, -and transfers from contract-call transactions a the `send-many-memo` bulk sending contract. + and transfers from contract-call transactions a the `send-many-memo` bulk sending contract. -### Path Parameters - - +### Query Parameters -Stacks address or a Contract identifier + -Example: `"SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0"` +Results per page - -### Query Parameters +Default: `20` - +Minimum: `0` -number of items to return +Maximum: `50` - + -number of items to skip +Result offset -Example: `42000` +Default: `0` + +Minimum: `0` - + -Filter for transfers only at this given block height +Filter for transactions only at this given block height -Include transaction data from unanchored (i.e. unconfirmed) microblocks - -Example: `true` +Include data from unanchored (i.e. unconfirmed) microblocks Default: `false` @@ -74,17 +71,22 @@ Include transaction data from unanchored (i.e. unconfirmed) microblocks -returned 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. +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. + + + +### Path Parameters -Example: `60000` + | Status code | Description | -| :------ | :------ | -| `200` | Success | +| ----------- | ----------- | +| `200` | Default Response | +| `4XX` | Default Response | - + @@ -96,8 +98,8 @@ returned data representing the state up until that point in time, rather than th -```terminal -$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/stx_inbound?limit=0&offset=42000&height=0&unanchored=true&until_block=60000" +```bash +curl -X GET "https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/stx_inbound?limit=20&offset=0&height=0&unanchored=false&until_block=string" ``` @@ -105,7 +107,7 @@ $ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11B ```js -fetch("https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/stx_inbound?limit=0&offset=42000&height=0&unanchored=true&until_block=60000", { +fetch("https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/stx_inbound?limit=20&offset=0&height=0&unanchored=false&until_block=string", { method: "GET" }); ``` @@ -114,21 +116,19 @@ fetch("https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0 - + -GET request that returns a list of inbound STX transfers with a memo - ```json { - "limit": 30, + "limit": 20, "offset": 0, - "total": 0, + "total": 1, "results": [ { "sender": "string", @@ -148,18 +148,12 @@ GET request that returns a list of inbound STX transfers with a memo ```ts -/** - * GET request that returns a list of inbound STX transfers with a memo - */ export interface AddressStxInboundListResponse { limit: number; offset: number; total: number; results: InboundStxTransfer[]; } -/** - * A inbound STX transfer with a memo - */ export interface InboundStxTransfer { /** * Principal that sent this transfer @@ -198,6 +192,37 @@ export interface InboundStxTransfer { + + + + + + +```json +{ + "error": "string", + "message": "string" +} +``` + + + + + +```ts +export interface ErrorResponse { + error: string; + message?: string; + [k: string]: unknown; +} +``` + + + + + + + diff --git a/content/docs/stacks/api/accounts/latest-nonce.mdx b/content/docs/stacks/api/accounts/latest-nonce.mdx index ace705b94..fcae1fb94 100644 --- a/content/docs/stacks/api/accounts/latest-nonce.mdx +++ b/content/docs/stacks/api/accounts/latest-nonce.mdx @@ -29,22 +29,14 @@ import { ## Get the latest nonce used by an account Retrieves the latest nonce values used by an account by inspecting the mempool, microblock transactions, and anchored transactions. -### Path Parameters - - - -Stacks address -Example: `"SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0"` - - ### Query Parameters - + Optionally get the nonce at a given block height. -Example: `66119` +Minimum: `1` @@ -52,15 +44,20 @@ Optionally get the nonce at a given block height. Optionally get the nonce at a given block hash. Note - Use either of the query parameters but not both at a time. -Example: `"0x72d53f3cba39e149dcd42708e535bdae03d73e60d2fe853aaf61c0b392f521e9"` + + +### Path Parameters + + | Status code | Description | -| :------ | :------ | -| `200` | Success | +| ----------- | ----------- | +| `200` | The latest nonce values used by an account by inspecting the mempool, microblock transactions, and anchored transactions | +| `4XX` | Default Response | - + @@ -72,8 +69,8 @@ Optionally get the nonce at a given block hash. Note - Use either of the query p -```terminal -$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/nonces?block_height=66119&block_hash=0x72d53f3cba39e149dcd42708e535bdae03d73e60d2fe853aaf61c0b392f521e9" +```bash +curl -X GET "https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/nonces?block_height=1&block_hash=string" ``` @@ -81,7 +78,7 @@ $ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11B ```js -fetch("https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/nonces?block_height=66119&block_hash=0x72d53f3cba39e149dcd42708e535bdae03d73e60d2fe853aaf61c0b392f521e9", { +fetch("https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/nonces?block_height=1&block_hash=string", { method: "GET" }); ``` @@ -90,7 +87,7 @@ fetch("https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0 - + @@ -123,14 +120,8 @@ The latest nonce values used by an account by inspecting the mempool, microblock * The latest nonce values used by an account by inspecting the mempool, microblock transactions, and anchored transactions */ export interface AddressNonces { - /** - * The latest nonce found within mempool transactions sent by this address. Will be null if there are no current mempool transactions for this address. - */ - last_mempool_tx_nonce: number; - /** - * The latest nonce found within transactions sent by this address, including unanchored microblock transactions. Will be null if there are no current transactions for this address. - */ - last_executed_tx_nonce: number; + last_mempool_tx_nonce: number | null; + last_executed_tx_nonce: number | null; /** * The likely nonce required for creating the next transaction, based on the last nonces seen by the API. This can be incorrect if the API's mempool or transactions aren't fully synchronized, even by a small amount, or if a previous transaction is still propagating through the Stacks blockchain network when this endpoint is called. */ @@ -142,7 +133,38 @@ export interface AddressNonces { /** * Nonces currently in mempool for this address. */ - detected_mempool_nonces?: number[]; + detected_mempool_nonces: number[]; +} +``` + + + + + + + + + + + + + +```json +{ + "error": "string", + "message": "string" +} +``` + + + + + +```ts +export interface ErrorResponse { + error: string; + message?: string; + [k: string]: unknown; } ``` diff --git a/content/docs/stacks/api/accounts/meta.json b/content/docs/stacks/api/accounts/meta.json index c361f191c..cdedb61f1 100644 --- a/content/docs/stacks/api/accounts/meta.json +++ b/content/docs/stacks/api/accounts/meta.json @@ -5,6 +5,9 @@ "assets", "balances", "stx-balances", + "principal-stx-balance", + "principal-ft-balances", + "principal-ft-balance", "inbound-stx-transfers", "transactions", "transactions-with-transfers", diff --git a/content/docs/stacks/api/accounts/nft-events.mdx b/content/docs/stacks/api/accounts/nft-events.mdx deleted file mode 100644 index 7ea2f2187..000000000 --- a/content/docs/stacks/api/accounts/nft-events.mdx +++ /dev/null @@ -1,162 +0,0 @@ ---- -title: Get nft events -description: Retrieves a list of all nft events associated with an account or a contract identifier. -toc: false ---- - -import { Root, API, APIExample } from '@/components/layout'; -import { APIInfo, Property } from 'fumadocs-openapi/ui' -import { Badge } from '@/components/ui/badge'; -import { Tabs, Tab } from 'fumadocs-ui/components/tabs' -import { Tabs as UITabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; -import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'; - -import { InlineCode } from '@/components/inline-code'; - - - - - - - - -This endpoint is deprecated in favor of [Get nft holdings](/stacks/api/non-fungible-tokens/holdings). - - -Retrieves a list of all NFTs owned by an address and contains the Clarity value of the identifier of the NFT. - -### Path Parameters - - - -Stacks address or a contract identifier - -Example: `"SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0"` - - -### Query Parameters - - - -Number of items to return - - - - - -Number of items to skip - -Example: `42000` - - - - - -Include transaction data from unanchored (i.e. unconfirmed) microblocks - -Example: `true` - -Default: `false` - - - - - -Returned 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. - -Example: `60000` - - - -| Status code | Description | -| :----------- | :----------- | -| `200` | Success | - - - - - -```terminal -$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/nft_events" -``` - - - - - - - -```json title="Example response" -{ - "limit": 0, - "offset": 0, - "total": 0, - "nft_events": [ - { - "sender": "string", - "recipient": "string", - "asset_identifier": "string", - "asset_event_type": "string", - "value": { - "hex": "string", - "repr": "string" - }, - "tx_id": "string", - "tx_index": 0, - "block_height": 0, - "event_index": 0 - } - ] -} -``` - - - - - -```ts -export interface AddressNftListResponse { - limit: number; - offset: number; - total: number; - nft_events: NftEvent[]; -} -export interface NftEvent { - sender?: string; - recipient?: string; - asset_identifier: string; - asset_event_type: string; - /** - * Identifier of the NFT - */ - value: { - /** - * Hex string representing the identifier of the NFT - */ - hex: string; - /** - * Readable string of the NFT identifier - */ - repr: string; - }; - tx_id: string; - tx_index: number; - block_height: number; - event_index: number; -} - -``` - - - - - - - - - - - - - - diff --git a/content/docs/stacks/api/accounts/principal-ft-balance.mdx b/content/docs/stacks/api/accounts/principal-ft-balance.mdx new file mode 100644 index 000000000..c1c6a2e87 --- /dev/null +++ b/content/docs/stacks/api/accounts/principal-ft-balance.mdx @@ -0,0 +1,147 @@ +--- +title: Get principal FT balance +description: Retrieves a specific fungible-token balance for a given principal. +toc: false +--- + +import { + API, + APIExample, + APIInfo, + APIPlayground, + ExampleResponse, + Property, + Request, + Requests, + Response, + Responses, + ResponseTypes, + Root, + TypeScriptResponse +} from 'fumadocs-openapi/ui'; + + + + + + + +## Get principal FT balance + +Retrieves a specific fungible-token balance for a given principal. + +### Path Parameters + + + + + + + +fungible token identifier + + + +| Status code | Description | +| ----------- | ----------- | +| `200` | Default Response | +| `4XX` | Default Response | + + + + + + + + + + + + + +```bash +curl -X GET "https://api.hiro.so/extended/v2/addresses/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/balances/ft/string" +``` + + + + + +```js +fetch("https://api.hiro.so/extended/v2/addresses/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/balances/ft/string", { + method: "GET" +}); +``` + + + + + + + + + + + + + +```json +{ + "balance": "string" +} +``` + + + + + +```ts +export interface Response { + balance: string; +} +``` + + + + + + + + + + + + + +```json +{ + "error": "string", + "message": "string" +} +``` + + + + + +```ts +export interface ErrorResponse { + error: string; + message?: string; + [k: string]: unknown; +} +``` + + + + + + + + + + + + + + \ No newline at end of file diff --git a/content/docs/stacks/api/accounts/principal-ft-balances.mdx b/content/docs/stacks/api/accounts/principal-ft-balances.mdx new file mode 100644 index 000000000..474fd1e8f --- /dev/null +++ b/content/docs/stacks/api/accounts/principal-ft-balances.mdx @@ -0,0 +1,179 @@ +--- +title: Get principal FT balances +description: Retrieves Fungible-token account balance information for a given Address or Contract Identifier. +toc: false +--- + +import { + API, + APIExample, + APIInfo, + APIPlayground, + ExampleResponse, + Property, + Request, + Requests, + Response, + Responses, + ResponseTypes, + Root, + TypeScriptResponse +} from 'fumadocs-openapi/ui'; + + + + + + + +## Get principal FT balances + +Retrieves Fungible-token account balance information for a given Address or Contract Identifier. + +### Query Parameters + + + +Results per page + +Default: `100` + +Minimum: `0` + +Maximum: `200` + + + + + +Result offset + +Default: `0` + +Minimum: `0` + + + +### Path Parameters + + + + + +| Status code | Description | +| ----------- | ----------- | +| `200` | Default Response | +| `4XX` | Default Response | + + + + + + + + + + + + + +```bash +curl -X GET "https://api.hiro.so/extended/v2/addresses/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/balances/ft?limit=100&offset=0" +``` + + + + + +```js +fetch("https://api.hiro.so/extended/v2/addresses/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/balances/ft?limit=100&offset=0", { + method: "GET" +}); +``` + + + + + + + + + + + + + +```json +{ + "limit": 20, + "offset": 0, + "total": 1, + "results": [ + { + "token": "string", + "balance": "string" + } + ] +} +``` + + + + + +```ts +export interface Response { + limit: number; + offset: number; + total: number; + results: { + token: string; + balance: string; + }[]; +} +``` + + + + + + + + + + + + + +```json +{ + "error": "string", + "message": "string" +} +``` + + + + + +```ts +export interface ErrorResponse { + error: string; + message?: string; + [k: string]: unknown; +} +``` + + + + + + + + + + + + + + \ No newline at end of file diff --git a/content/docs/stacks/api/accounts/principal-stx-balance.mdx b/content/docs/stacks/api/accounts/principal-stx-balance.mdx new file mode 100644 index 000000000..53d1ad63c --- /dev/null +++ b/content/docs/stacks/api/accounts/principal-stx-balance.mdx @@ -0,0 +1,199 @@ +--- +title: Get principal STX balance +description: Retrieves STX account balance information for a given Address or Contract Identifier. +toc: false +--- + +import { + API, + APIExample, + APIInfo, + APIPlayground, + ExampleResponse, + Property, + Request, + Requests, + Response, + Responses, + ResponseTypes, + Root, + TypeScriptResponse +} from 'fumadocs-openapi/ui'; + + + + + + + +## Get principal STX balance + +Retrieves STX account balance information for a given Address or Contract Identifier. + +### Query Parameters + + + +Include pending mempool transactions in the balance calculation + +Default: `false` + + + +### Path Parameters + + + + + +| Status code | Description | +| ----------- | ----------- | +| `200` | Default Response | +| `4XX` | Default Response | + + + + + + + + + + + + + +```bash +curl -X GET "https://api.hiro.so/extended/v2/addresses/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/balances/stx?include_mempool=false" +``` + + + + + +```js +fetch("https://api.hiro.so/extended/v2/addresses/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/balances/stx?include_mempool=false", { + method: "GET" +}); +``` + + + + + + + + + + + + + +```json +{ + "balance": "string", + "estimated_balance": "string", + "pending_balance_inbound": "string", + "pending_balance_outbound": "string", + "total_sent": "string", + "total_received": "string", + "total_fees_sent": "string", + "total_miner_rewards_received": "string", + "lock_tx_id": "string", + "locked": "string", + "lock_height": 0, + "burnchain_lock_height": 0, + "burnchain_unlock_height": 0 +} +``` + + + + + +```ts +export interface StxBalance { + balance: string; + /** + * Total STX balance considering pending mempool transactions + */ + estimated_balance?: string; + /** + * Inbound STX balance from pending mempool transactions + */ + pending_balance_inbound?: string; + /** + * 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; + /** + * The transaction where the lock event occurred. Empty if no tokens are locked. + */ + lock_tx_id: string; + /** + * The amount of locked STX, as string quoted micro-STX. Zero if no tokens are locked. + */ + locked: string; + /** + * The STX chain block height of when the lock event occurred. Zero if no tokens are locked. + */ + lock_height: number; + /** + * The burnchain block height of when the lock event occurred. Zero if no tokens are locked. + */ + burnchain_lock_height: number; + /** + * The burnchain block height of when the tokens unlock. Zero if no tokens are locked. + */ + burnchain_unlock_height: number; +} +``` + + + + + + + + + + + + + +```json +{ + "error": "string", + "message": "string" +} +``` + + + + + +```ts +export interface ErrorResponse { + error: string; + message?: string; + [k: string]: unknown; +} +``` + + + + + + + + + + + + + + \ No newline at end of file diff --git a/content/docs/stacks/api/accounts/stx-balances.mdx b/content/docs/stacks/api/accounts/stx-balances.mdx index 7959d01fa..72e4c160f 100644 --- a/content/docs/stacks/api/accounts/stx-balances.mdx +++ b/content/docs/stacks/api/accounts/stx-balances.mdx @@ -28,23 +28,15 @@ import { ## Get account STX balance -Retrieves STX token balance for a given Address or Contract Identifier. -### Path Parameters - - +**NOTE:** This endpoint is deprecated in favor of [Get address STX balance](/stacks/api/accounts/principal-stx-balance). -Stacks address or a Contract identifier. - -Example: `"SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0"` +Retrieves STX token balance for a given Address or Contract Identifier. - ### Query Parameters -Include transaction data from unanchored (i.e. unconfirmed) microblocks. - -Example: `true` +Include data from unanchored (i.e. unconfirmed) microblocks Default: `false` @@ -52,17 +44,22 @@ Include transaction data from unanchored (i.e. unconfirmed) microblocks. -returned 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. +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. + + + +### Path Parameters -Example: `60000` + | Status code | Description | -| :------ | :------ | -| `200` | Success | +| ----------- | ----------- | +| `200` | GET request that returns address balances | +| `4XX` | Default Response | - + @@ -74,8 +71,8 @@ returned data representing the state up until that point in time, rather than th -```terminal -$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/stx?unanchored=true&until_block=60000" +```bash +curl -X GET "https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/stx?unanchored=false&until_block=string" ``` @@ -83,7 +80,7 @@ $ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11B ```js -fetch("https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/stx?unanchored=true&until_block=60000", { +fetch("https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/stx?unanchored=false&until_block=string", { method: "GET" }); ``` @@ -92,7 +89,7 @@ fetch("https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0 - + @@ -105,6 +102,9 @@ GET request that returns address balances ```json { "balance": "string", + "estimated_balance": "string", + "pending_balance_inbound": "string", + "pending_balance_outbound": "string", "total_sent": "string", "total_received": "string", "total_fees_sent": "string", @@ -135,15 +135,27 @@ GET request that returns address balances /** * GET request that returns address balances */ -export type AddressStxBalanceResponse = StxBalance & { +export type AddressStxBalance = StxBalance & { token_offering_locked?: AddressTokenOfferingLocked; }; export interface StxBalance { balance: string; - total_sent: string; - total_received: string; - total_fees_sent: string; + /** + * Total STX balance considering pending mempool transactions + */ + estimated_balance?: string; + /** + * Inbound STX balance from pending mempool transactions + */ + pending_balance_inbound?: string; + /** + * 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; /** * The transaction where the lock event occurred. Empty if no tokens are locked. @@ -198,10 +210,41 @@ export interface AddressUnlockSchedule { + + + + + + +```json +{ + "error": "string", + "message": "string" +} +``` + + + + + +```ts +export interface ErrorResponse { + error: string; + message?: string; + [k: string]: unknown; +} +``` + + + + + + + - + \ No newline at end of file diff --git a/content/docs/stacks/api/accounts/transaction-with-transfers.mdx b/content/docs/stacks/api/accounts/transaction-with-transfers.mdx index c99539a96..f252bd9d5 100644 --- a/content/docs/stacks/api/accounts/transaction-with-transfers.mdx +++ b/content/docs/stacks/api/accounts/transaction-with-transfers.mdx @@ -28,36 +28,28 @@ import { ## Get account transaction information for specific transaction - -This endpoint is deprecated in favor of [Get events for an address transaction](/stacks/api/transactions/events-for-an-address-transaction). - +**NOTE:** This endpoint is deprecated in favor of [Get events for an address transaction](/api/get-address-transaction-events). -Retrieves transaction details for a given Transaction Id `tx_id`, for a given account or contract Identifier. + Retrieves transaction details for a given Transaction Id `tx_id`, for a given account or contract Identifier. ### Path Parameters - - -Stacks address or a contract identifier - -Example: `"SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE"` + -Transaction id - -Example: `"0x34d79c7cfc2fe525438736733e501a4bf0308a5556e3e080d1e2c0858aad7448"` +Transaction ID | Status code | Description | -| :------ | :------ | -| `200` | Success | -| `404` | Not found | +| ----------- | ----------- | +| `200` | Transaction with STX transfers for a given address | +| `4XX` | Default Response | - + @@ -69,8 +61,8 @@ Transaction id -```terminal -$ curl -X GET "https://api.hiro.so/extended/v1/address/SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE/0x34d79c7cfc2fe525438736733e501a4bf0308a5556e3e080d1e2c0858aad7448/with_transfers" +```bash +curl -X GET "https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/string/with_transfers" ``` @@ -78,7 +70,7 @@ $ curl -X GET "https://api.hiro.so/extended/v1/address/SP3FBR2AGK5H9QBDH3EEN6DF8 ```js -fetch("https://api.hiro.so/extended/v1/address/SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE/0x34d79c7cfc2fe525438736733e501a4bf0308a5556e3e080d1e2c0858aad7448/with_transfers", { +fetch("https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/string/with_transfers", { method: "GET" }); ``` @@ -87,7 +79,7 @@ fetch("https://api.hiro.so/extended/v1/address/SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX - + @@ -123,8 +115,8 @@ Transaction with STX transfers for a given address "block_height": 0, "block_time": 0, "block_time_iso": "string", - "burn_block_height": 0, "burn_block_time": 0, + "burn_block_height": 0, "burn_block_time_iso": "string", "parent_burn_block_time": 0, "parent_burn_block_time_iso": "string", @@ -179,19 +171,19 @@ Transaction with STX transfers for a given address ], "ft_transfers": [ { - "asset_identifier": "string", "amount": "string", + "asset_identifier": "string", "sender": "string", "recipient": "string" } ], "nft_transfers": [ { - "asset_identifier": "string", "value": { "hex": "string", "repr": "string" }, + "asset_identifier": "string", "sender": "string", "recipient": "string" } @@ -205,222 +197,75 @@ Transaction with STX transfers for a given address ```ts /** - * Describes all transaction types on Stacks 2.0 blockchain - */ -export type Transaction = - | TokenTransferTransaction - | SmartContractTransaction - | ContractCallTransaction - | PoisonMicroblockTransaction - | CoinbaseTransaction - | TenureChangeTransaction; -/** - * Describes representation of a Type-0 Stacks 2.0 transaction. https://github.com/blockstack/stacks-blockchain/blob/master/sip/sip-005-blocks-and-transactions.md#type-0-transferring-an-asset - */ -export type TokenTransferTransaction = AbstractTransaction & TokenTransferTransactionMetadata; -/** - * Anchored transaction metadata. All mined/anchored Stacks transactions have these properties. + * Only present in `smart_contract` and `contract_call` tx types. */ -export type AbstractTransaction = BaseTransaction & { - /** - * Hash of the blocked this transactions was associated with - */ - block_hash: string; - /** - * Height of the block this transactions was associated with - */ - block_height: number; - /** - * Unix timestamp (in seconds) indicating when this block was mined. - */ - block_time: number; - /** - * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. - */ - block_time_iso: string; - /** - * Height of the anchor burn block. - */ - burn_block_height: number; - /** - * Unix timestamp (in seconds) indicating when this block was mined - */ - burn_block_time: number; - /** - * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. - */ - burn_block_time_iso: string; - /** - * Unix timestamp (in seconds) indicating when this parent block was mined - */ - parent_burn_block_time: number; - /** - * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. - */ - parent_burn_block_time_iso: string; - /** - * Set to `true` if block corresponds to the canonical chain tip - */ - canonical: boolean; - /** - * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction - */ - tx_index: number; - tx_status: TransactionStatus; - /** - * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. - */ - tx_result: { - /** - * Hex string representing the value fo the transaction result - */ - hex: string; - /** - * Readable string of the transaction result - */ - repr: string; +export type SmartContractLogTransactionEvent = AbstractTransactionEvent & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; }; - /** - * Number of transaction events - */ - event_count: number; - /** - * Hash of the previous block. - */ - parent_block_hash: string; - /** - * True if the transaction is included in a microblock that has not been confirmed by an anchor block. - */ - is_unanchored: boolean; - /** - * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. - */ - microblock_hash: string; - /** - * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). - */ - microblock_sequence: number; - /** - * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. - */ - microblock_canonical: boolean; - /** - * Execution cost read count. - */ - execution_cost_read_count: number; - /** - * Execution cost read length. - */ - execution_cost_read_length: number; - /** - * Execution cost runtime. - */ - execution_cost_runtime: number; - /** - * Execution cost write count. - */ - execution_cost_write_count: number; - /** - * Execution cost write length. - */ - execution_cost_write_length: number; - /** - * List of transaction events - */ - events: TransactionEvent[]; }; -export type PostConditionMode = "allow" | "deny"; /** - * Post-conditionscan limit the damage done to a user's assets + * Only present in `smart_contract` and `contract_call` tx types. */ -export type PostCondition = PostConditionStx | PostConditionFungible | PostConditionNonFungible; -export type PostConditionStx = { - principal: PostConditionPrincipal; -} & { - condition_code: PostConditionFungibleConditionCode; - amount: string; - type: "stx"; +export type StxLockTransactionEvent = AbstractTransactionEvent1 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; + }; }; -export type PostConditionPrincipal = - | { - /** - * String literal of type `PostConditionPrincipalType` - */ - type_id: "principal_origin"; - } - | { - /** - * String literal of type `PostConditionPrincipalType` - */ - type_id: "principal_standard"; - address: string; - } - | { - /** - * String literal of type `PostConditionPrincipalType` - */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; /** - * A fungible condition code encodes a statement being made for either STX or a fungible token, with respect to the originating account. + * Only present in `smart_contract` and `contract_call` tx types. */ -export type PostConditionFungibleConditionCode = - | "sent_equal_to" - | "sent_greater_than" - | "sent_greater_than_or_equal_to" - | "sent_less_than" - | "sent_less_than_or_equal_to"; -export type PostConditionFungible = { - principal: PostConditionPrincipal; -} & { - condition_code: PostConditionFungibleConditionCode; - type: "fungible"; - amount: string; +export type StxAssetTransactionEvent = AbstractTransactionEvent2 & { + event_type: "stx_asset"; + tx_id: string; asset: { - asset_name: string; - contract_address: string; - contract_name: string; + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; }; }; -export type PostConditionNonFungible = { - principal: PostConditionPrincipal; -} & { - condition_code: PostConditionNonFungibleConditionCode; - type: "non_fungible"; - asset_value: { - hex: string; - repr: string; +export type FungibleTokenAssetTransactionEvent = AbstractTransactionEvent3 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; }; +}; +export type NonFungibleTokenAssetTransactionEvent = AbstractTransactionEvent4 & { + event_type: "non_fungible_token_asset"; + tx_id: string; asset: { - asset_name: string; - contract_address: string; - contract_name: string; + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; }; }; -/** - * A non-fungible condition code encodes a statement being made about a non-fungible token, with respect to whether or not the particular non-fungible token is owned by the account. - */ -export type PostConditionNonFungibleConditionCode = "sent" | "not_sent"; -/** - * `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. - */ -export type TransactionAnchorModeType = "on_chain_only" | "off_chain_only" | "any"; -/** - * Status of the transaction - */ -export type TransactionStatus = "success" | "abort_by_response" | "abort_by_post_condition"; -export type TransactionEvent = - | TransactionEventSmartContractLog - | TransactionEventStxLock - | TransactionEventStxAsset - | TransactionEventFungibleAsset - | TransactionEventNonFungibleAsset; /** * Only present in `smart_contract` and `contract_call` tx types. */ -export type TransactionEventSmartContractLog = AbstractTransactionEvent & { +export type SmartContractLogTransactionEvent1 = AbstractTransactionEvent5 & { event_type: "smart_contract_log"; tx_id: string; contract_log: { @@ -435,7 +280,7 @@ export type TransactionEventSmartContractLog = AbstractTransactionEvent & { /** * Only present in `smart_contract` and `contract_call` tx types. */ -export type TransactionEventStxLock = AbstractTransactionEvent & { +export type StxLockTransactionEvent1 = AbstractTransactionEvent6 & { event_type: "stx_lock"; tx_id: string; stx_lock_event: { @@ -447,28 +292,33 @@ export type TransactionEventStxLock = AbstractTransactionEvent & { /** * Only present in `smart_contract` and `contract_call` tx types. */ -export type TransactionEventStxAsset = AbstractTransactionEvent & { +export type StxAssetTransactionEvent1 = AbstractTransactionEvent7 & { event_type: "stx_asset"; tx_id: string; - asset: TransactionEventAsset; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; }; -export type TransactionEventAssetType = "transfer" | "mint" | "burn"; -export type TransactionEventFungibleAsset = AbstractTransactionEvent & { +export type FungibleTokenAssetTransactionEvent1 = AbstractTransactionEvent8 & { event_type: "fungible_token_asset"; tx_id: string; asset: { - asset_event_type: string; + asset_event_type: "transfer" | "mint" | "burn"; asset_id: string; sender: string; recipient: string; amount: string; }; }; -export type TransactionEventNonFungibleAsset = AbstractTransactionEvent & { +export type NonFungibleTokenAssetTransactionEvent1 = AbstractTransactionEvent9 & { event_type: "non_fungible_token_asset"; tx_id: string; asset: { - asset_event_type: string; + asset_event_type: "transfer" | "mint" | "burn"; asset_id: string; sender: string; recipient: string; @@ -479,40 +329,290 @@ export type TransactionEventNonFungibleAsset = AbstractTransactionEvent & { }; }; /** - * Describes representation of a Type-1 Stacks 2.0 transaction. https://github.com/blockstack/stacks-blockchain/blob/master/sip/sip-005-blocks-and-transactions.md#type-1-instantiating-a-smart-contract + * Only present in `smart_contract` and `contract_call` tx types. */ -export type SmartContractTransaction = AbstractTransaction & SmartContractTransactionMetadata; +export type SmartContractLogTransactionEvent2 = AbstractTransactionEvent10 & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; + }; +}; /** - * Describes representation of a Type 2 Stacks 2.0 transaction: Contract Call + * Only present in `smart_contract` and `contract_call` tx types. */ -export type ContractCallTransaction = AbstractTransaction & ContractCallTransactionMetadata; +export type StxLockTransactionEvent2 = AbstractTransactionEvent11 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; + }; +}; /** - * Describes representation of a Type 3 Stacks 2.0 transaction: Poison Microblock + * Only present in `smart_contract` and `contract_call` tx types. */ -export type PoisonMicroblockTransaction = AbstractTransaction & PoisonMicroblockTransactionMetadata; +export type StxAssetTransactionEvent2 = AbstractTransactionEvent12 & { + event_type: "stx_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; +}; +export type FungibleTokenAssetTransactionEvent2 = AbstractTransactionEvent13 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; + }; +}; +export type NonFungibleTokenAssetTransactionEvent2 = AbstractTransactionEvent14 & { + event_type: "non_fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; + }; +}; /** - * Describes representation of a Type 3 Stacks 2.0 transaction: Poison Microblock + * Only present in `smart_contract` and `contract_call` tx types. */ -export type CoinbaseTransaction = AbstractTransaction & CoinbaseTransactionMetadata; +export type SmartContractLogTransactionEvent3 = AbstractTransactionEvent15 & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; + }; +}; /** - * Describes representation of a Type 7 Stacks transaction: Tenure Change + * Only present in `smart_contract` and `contract_call` tx types. */ -export type TenureChangeTransaction = AbstractTransaction & TenureChangeTransactionMetadata; - +export type StxLockTransactionEvent3 = AbstractTransactionEvent16 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; + }; +}; /** - * Transaction with STX transfers for a given address + * Only present in `smart_contract` and `contract_call` tx types. */ -export interface AddressTransactionWithTransfers { - tx: Transaction; - /** - * Total sent from the given address, including the tx fee, in micro-STX as an integer string. - */ - stx_sent: string; - /** - * Total received by the given address in micro-STX as an integer string. - */ - stx_received: string; - stx_transfers: { +export type StxAssetTransactionEvent3 = AbstractTransactionEvent17 & { + event_type: "stx_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; +}; +export type FungibleTokenAssetTransactionEvent3 = AbstractTransactionEvent18 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; + }; +}; +export type NonFungibleTokenAssetTransactionEvent3 = AbstractTransactionEvent19 & { + event_type: "non_fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type SmartContractLogTransactionEvent4 = AbstractTransactionEvent20 & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type StxLockTransactionEvent4 = AbstractTransactionEvent21 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type StxAssetTransactionEvent4 = AbstractTransactionEvent22 & { + event_type: "stx_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; +}; +export type FungibleTokenAssetTransactionEvent4 = AbstractTransactionEvent23 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; + }; +}; +export type NonFungibleTokenAssetTransactionEvent4 = AbstractTransactionEvent24 & { + event_type: "non_fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type SmartContractLogTransactionEvent5 = AbstractTransactionEvent25 & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type StxLockTransactionEvent5 = AbstractTransactionEvent26 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type StxAssetTransactionEvent5 = AbstractTransactionEvent27 & { + event_type: "stx_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; +}; +export type FungibleTokenAssetTransactionEvent5 = AbstractTransactionEvent28 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; + }; +}; +export type NonFungibleTokenAssetTransactionEvent5 = AbstractTransactionEvent29 & { + event_type: "non_fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; + }; +}; + +/** + * Transaction with STX transfers for a given address + */ +export interface AddressTransactionWithTransfers { + tx: + | TokenTransferTransaction + | SmartContractTransaction + | ContractCallTransaction + | PoisonMicroblockTransaction + | CoinbaseTransaction + | TenureChangeTransaction; + /** + * Total sent from the given address, including the tx fee, in micro-STX as an integer string. + */ + stx_sent: string; + /** + * Total received by the given address in micro-STX as an integer string. + */ + stx_received: string; + stx_transfers: { /** * Amount transferred in micro-STX as an integer string. */ @@ -527,14 +627,14 @@ export interface AddressTransactionWithTransfers { recipient?: string; }[]; ft_transfers?: { - /** - * Fungible Token asset identifier. - */ - asset_identifier: string; /** * Amount transferred as an integer string. This balance does not factor in possible SIP-010 decimals. */ amount: string; + /** + * Fungible Token asset identifier. + */ + asset_identifier: string; /** * Principal that sent the asset. */ @@ -545,10 +645,6 @@ export interface AddressTransactionWithTransfers { recipient?: string; }[]; nft_transfers?: { - /** - * Non Fungible Token asset identifier. - */ - asset_identifier: string; /** * Non Fungible Token asset value. */ @@ -556,6 +652,10 @@ export interface AddressTransactionWithTransfers { hex: string; repr: string; }; + /** + * Non Fungible Token asset identifier. + */ + asset_identifier: string; /** * Principal that sent the asset. */ @@ -566,10 +666,7 @@ export interface AddressTransactionWithTransfers { recipient?: string; }[]; } -/** - * Transaction properties that are available from a raw serialized transactions. These are available for transactions in the mempool as well as mined transactions. - */ -export interface BaseTransaction { +export interface TokenTransferTransaction { /** * Transaction ID */ @@ -592,50 +689,453 @@ export interface BaseTransaction { */ sponsored: boolean; sponsor_address?: string; - post_condition_mode: PostConditionMode; - post_conditions: PostCondition[]; - anchor_mode: TransactionAnchorModeType; -} -export interface AbstractTransactionEvent { - event_index: number; -} -export interface TransactionEventAsset { - asset_event_type?: TransactionEventAssetType; - asset_id?: string; - sender?: string; - recipient?: string; - amount?: string; - value?: string; - memo?: string; -} -/** - * Metadata associated with token-transfer type transactions - */ -export interface TokenTransferTransactionMetadata { - tx_type: "token_transfer"; - token_transfer: { - recipient_address: string; + post_condition_mode: "allow" | "deny"; + post_conditions: ( + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { /** - * Transfer amount as Integer string (64-bit unsigned integer) + * Hex string representing the value fo the transaction result */ - amount: string; + hex: string; /** - * Hex encoded arbitrary message, up to 34 bytes length (should try decoding to an ASCII string) + * Readable string of the transaction result */ - memo: string; + repr: string; }; -} -/** - * Metadata associated with a contract-deploy type transaction. https://github.com/blockstack/stacks-blockchain/blob/master/sip/sip-005-blocks-and-transactions.md#type-1-instantiating-a-smart-contract - */ -export interface SmartContractTransactionMetadata { - tx_type: "smart_contract"; - smart_contract: { - /** - * The Clarity version of the contract, only specified for versioned contract transactions, otherwise null - */ - clarity_version?: number; - /** + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent + | StxLockTransactionEvent + | StxAssetTransactionEvent + | FungibleTokenAssetTransactionEvent + | NonFungibleTokenAssetTransactionEvent + )[]; + tx_type: "token_transfer"; + token_transfer: { + recipient_address: string; + /** + * Transfer amount as Integer string (64-bit unsigned integer) + */ + amount: string; + /** + * Hex encoded arbitrary message, up to 34 bytes length (should try decoding to an ASCII string) + */ + memo: string; + }; +} +export interface AbstractTransactionEvent { + event_index: number; +} +export interface AbstractTransactionEvent1 { + event_index: number; +} +export interface AbstractTransactionEvent2 { + event_index: number; +} +export interface AbstractTransactionEvent3 { + event_index: number; +} +export interface AbstractTransactionEvent4 { + event_index: number; +} +export interface SmartContractTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { + /** + * Hex string representing the value fo the transaction result + */ + hex: string; + /** + * Readable string of the transaction result + */ + repr: string; + }; + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent1 + | StxLockTransactionEvent1 + | StxAssetTransactionEvent1 + | FungibleTokenAssetTransactionEvent1 + | NonFungibleTokenAssetTransactionEvent1 + )[]; + tx_type: "smart_contract"; + smart_contract: { + clarity_version: number | null; + /** * Contract identifier formatted as `.` */ contract_id: string; @@ -645,10 +1145,240 @@ export interface SmartContractTransactionMetadata { source_code: string; }; } -/** - * Metadata associated with a contract-call type transaction - */ -export interface ContractCallTransactionMetadata { +export interface AbstractTransactionEvent5 { + event_index: number; +} +export interface AbstractTransactionEvent6 { + event_index: number; +} +export interface AbstractTransactionEvent7 { + event_index: number; +} +export interface AbstractTransactionEvent8 { + event_index: number; +} +export interface AbstractTransactionEvent9 { + event_index: number; +} +export interface ContractCallTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { + /** + * Hex string representing the value fo the transaction result + */ + hex: string; + /** + * Readable string of the transaction result + */ + repr: string; + }; + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent2 + | StxLockTransactionEvent2 + | StxAssetTransactionEvent2 + | FungibleTokenAssetTransactionEvent2 + | NonFungibleTokenAssetTransactionEvent2 + )[]; tx_type: "contract_call"; contract_call: { /** @@ -663,9 +1393,6 @@ export interface ContractCallTransactionMetadata { * Function definition, including function name and type as well as parameter names and types */ function_signature: string; - /** - * List of arguments used to invoke the function - */ function_args?: { hex: string; repr: string; @@ -674,48 +1401,732 @@ export interface ContractCallTransactionMetadata { }[]; }; } -/** - * Metadata associated with a poison-microblock type transaction - */ -export interface PoisonMicroblockTransactionMetadata { +export interface AbstractTransactionEvent10 { + event_index: number; +} +export interface AbstractTransactionEvent11 { + event_index: number; +} +export interface AbstractTransactionEvent12 { + event_index: number; +} +export interface AbstractTransactionEvent13 { + event_index: number; +} +export interface AbstractTransactionEvent14 { + event_index: number; +} +export interface PoisonMicroblockTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { + /** + * Hex string representing the value fo the transaction result + */ + hex: string; + /** + * Readable string of the transaction result + */ + repr: string; + }; + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent3 + | StxLockTransactionEvent3 + | StxAssetTransactionEvent3 + | FungibleTokenAssetTransactionEvent3 + | NonFungibleTokenAssetTransactionEvent3 + )[]; tx_type: "poison_microblock"; poison_microblock: { /** - * Hex encoded microblock header + * Hex encoded microblock header + */ + microblock_header_1: string; + /** + * Hex encoded microblock header + */ + microblock_header_2: string; + }; +} +export interface AbstractTransactionEvent15 { + event_index: number; +} +export interface AbstractTransactionEvent16 { + event_index: number; +} +export interface AbstractTransactionEvent17 { + event_index: number; +} +export interface AbstractTransactionEvent18 { + event_index: number; +} +export interface AbstractTransactionEvent19 { + event_index: number; +} +export interface CoinbaseTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { + /** + * Hex string representing the value fo the transaction result */ - microblock_header_1: string; + hex: string; /** - * Hex encoded microblock header + * Readable string of the transaction result */ - microblock_header_2: string; + repr: string; }; -} -/** - * Describes representation of a Type 3 Stacks 2.0 transaction: Poison Microblock - */ -export interface CoinbaseTransactionMetadata { + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent4 + | StxLockTransactionEvent4 + | StxAssetTransactionEvent4 + | FungibleTokenAssetTransactionEvent4 + | NonFungibleTokenAssetTransactionEvent4 + )[]; tx_type: "coinbase"; coinbase_payload: { /** * Hex encoded 32-byte scratch space for block leader's use */ data: string; + alt_recipient?: string | null; + vrf_proof?: string | null; + }; +} +export interface AbstractTransactionEvent20 { + event_index: number; +} +export interface AbstractTransactionEvent21 { + event_index: number; +} +export interface AbstractTransactionEvent22 { + event_index: number; +} +export interface AbstractTransactionEvent23 { + event_index: number; +} +export interface AbstractTransactionEvent24 { + event_index: number; +} +export interface TenureChangeTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { /** - * A principal that will receive the miner rewards for this coinbase transaction. Can be either a standard principal or contract principal. Only specified for `coinbase-to-alt-recipient` transaction types, otherwise null. + * Hex string representing the value fo the transaction result */ - alt_recipient?: string; + hex: string; /** - * Hex encoded 80-byte VRF proof + * Readable string of the transaction result */ - vrf_proof?: string; + repr: string; }; -} -/** - * Describes representation of a Type 7 Stacks transaction: Tenure Change - */ -export interface TenureChangeTransactionMetadata { + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent5 + | StxLockTransactionEvent5 + | StxAssetTransactionEvent5 + | FungibleTokenAssetTransactionEvent5 + | NonFungibleTokenAssetTransactionEvent5 + )[]; tx_type: "tenure_change"; - tenure_change_payload?: { + tenure_change_payload: { /** * Consensus hash of this tenure. Corresponds to the sortition in which the miner of this block was chosen. */ @@ -746,6 +2157,52 @@ export interface TenureChangeTransactionMetadata { pubkey_hash: string; }; } +export interface AbstractTransactionEvent25 { + event_index: number; +} +export interface AbstractTransactionEvent26 { + event_index: number; +} +export interface AbstractTransactionEvent27 { + event_index: number; +} +export interface AbstractTransactionEvent28 { + event_index: number; +} +export interface AbstractTransactionEvent29 { + event_index: number; +} +``` + + + + + + + + + + + + + +```json +{ + "error": "string", + "message": "string" +} +``` + + + + + +```ts +export interface ErrorResponse { + error: string; + message?: string; + [k: string]: unknown; +} ``` diff --git a/content/docs/stacks/api/accounts/transactions-with-transfers.mdx b/content/docs/stacks/api/accounts/transactions-with-transfers.mdx index 7dd840c4b..00c7c70c3 100644 --- a/content/docs/stacks/api/accounts/transactions-with-transfers.mdx +++ b/content/docs/stacks/api/accounts/transactions-with-transfers.mdx @@ -29,46 +29,40 @@ import { ## Get account transactions including STX transfers for each transaction. Retrieve all transactions for an account or contract identifier including STX transfers for each transaction. -### Path Parameters - - -Stacks address or a Contract identifier +### Query Parameters -Example: `"SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0"` + - -### Query Parameters +Results per page - +Default: `20` -max number of account transactions to fetch +Minimum: `0` -Example: `20` +Maximum: `50` - + + +Result offset -index of first account transaction to fetch +Default: `0` -Example: `10` +Minimum: `0` - + Filter for transactions only at this given block height -Example: `66119` - -Include transaction data from unanchored (i.e. unconfirmed) microblocks - -Example: `true` +Include data from unanchored (i.e. unconfirmed) microblocks Default: `false` @@ -76,17 +70,22 @@ Include transaction data from unanchored (i.e. unconfirmed) microblocks -returned data representing the state up until that point in time, rather than the current block. +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. -Example: `60000` + + +### Path Parameters + + | Status code | Description | -| :------ | :------ | -| `200` | Success | +| ----------- | ----------- | +| `200` | Default Response | +| `4XX` | Default Response | - + @@ -98,8 +97,8 @@ returned data representing the state up until that point in time, rather than th -```terminal -$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/transactions_with_transfers?limit=20&offset=10&height=66119&unanchored=true&until_block=60000" +```bash +curl -X GET "https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/transactions_with_transfers?limit=20&offset=0&height=0&unanchored=false&until_block=string" ``` @@ -107,7 +106,7 @@ $ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11B ```js -fetch("https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/transactions_with_transfers?limit=20&offset=10&height=66119&unanchored=true&until_block=60000", { +fetch("https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/transactions_with_transfers?limit=20&offset=0&height=0&unanchored=false&until_block=string", { method: "GET" }); ``` @@ -116,21 +115,19 @@ fetch("https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0 - + -GET request that returns account transactions - ```json { - "limit": 30, + "limit": 20, "offset": 0, - "total": 0, + "total": 1, "results": [ { "tx": { @@ -157,8 +154,8 @@ GET request that returns account transactions "block_height": 0, "block_time": 0, "block_time_iso": "string", - "burn_block_height": 0, "burn_block_time": 0, + "burn_block_height": 0, "burn_block_time_iso": "string", "parent_burn_block_time": 0, "parent_burn_block_time_iso": "string", @@ -213,19 +210,19 @@ GET request that returns account transactions ], "ft_transfers": [ { - "asset_identifier": "string", "amount": "string", + "asset_identifier": "string", "sender": "string", "recipient": "string" } ], "nft_transfers": [ { - "asset_identifier": "string", "value": { "hex": "string", "repr": "string" }, + "asset_identifier": "string", "sender": "string", "recipient": "string" } @@ -241,222 +238,75 @@ GET request that returns account transactions ```ts /** - * Describes all transaction types on Stacks 2.0 blockchain - */ -export type Transaction = - | TokenTransferTransaction - | SmartContractTransaction - | ContractCallTransaction - | PoisonMicroblockTransaction - | CoinbaseTransaction - | TenureChangeTransaction; -/** - * Describes representation of a Type-0 Stacks 2.0 transaction. https://github.com/blockstack/stacks-blockchain/blob/master/sip/sip-005-blocks-and-transactions.md#type-0-transferring-an-asset - */ -export type TokenTransferTransaction = AbstractTransaction & TokenTransferTransactionMetadata; -/** - * Anchored transaction metadata. All mined/anchored Stacks transactions have these properties. + * Only present in `smart_contract` and `contract_call` tx types. */ -export type AbstractTransaction = BaseTransaction & { - /** - * Hash of the blocked this transactions was associated with - */ - block_hash: string; - /** - * Height of the block this transactions was associated with - */ - block_height: number; - /** - * Unix timestamp (in seconds) indicating when this block was mined. - */ - block_time: number; - /** - * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. - */ - block_time_iso: string; - /** - * Height of the anchor burn block. - */ - burn_block_height: number; - /** - * Unix timestamp (in seconds) indicating when this block was mined - */ - burn_block_time: number; - /** - * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. - */ - burn_block_time_iso: string; - /** - * Unix timestamp (in seconds) indicating when this parent block was mined - */ - parent_burn_block_time: number; - /** - * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. - */ - parent_burn_block_time_iso: string; - /** - * Set to `true` if block corresponds to the canonical chain tip - */ - canonical: boolean; - /** - * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction - */ - tx_index: number; - tx_status: TransactionStatus; - /** - * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. - */ - tx_result: { - /** - * Hex string representing the value fo the transaction result - */ - hex: string; - /** - * Readable string of the transaction result - */ - repr: string; +export type SmartContractLogTransactionEvent = AbstractTransactionEvent & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; }; - /** - * Number of transaction events - */ - event_count: number; - /** - * Hash of the previous block. - */ - parent_block_hash: string; - /** - * True if the transaction is included in a microblock that has not been confirmed by an anchor block. - */ - is_unanchored: boolean; - /** - * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. - */ - microblock_hash: string; - /** - * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). - */ - microblock_sequence: number; - /** - * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. - */ - microblock_canonical: boolean; - /** - * Execution cost read count. - */ - execution_cost_read_count: number; - /** - * Execution cost read length. - */ - execution_cost_read_length: number; - /** - * Execution cost runtime. - */ - execution_cost_runtime: number; - /** - * Execution cost write count. - */ - execution_cost_write_count: number; - /** - * Execution cost write length. - */ - execution_cost_write_length: number; - /** - * List of transaction events - */ - events: TransactionEvent[]; }; -export type PostConditionMode = "allow" | "deny"; /** - * Post-conditionscan limit the damage done to a user's assets + * Only present in `smart_contract` and `contract_call` tx types. */ -export type PostCondition = PostConditionStx | PostConditionFungible | PostConditionNonFungible; -export type PostConditionStx = { - principal: PostConditionPrincipal; -} & { - condition_code: PostConditionFungibleConditionCode; - amount: string; - type: "stx"; +export type StxLockTransactionEvent = AbstractTransactionEvent1 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; + }; }; -export type PostConditionPrincipal = - | { - /** - * String literal of type `PostConditionPrincipalType` - */ - type_id: "principal_origin"; - } - | { - /** - * String literal of type `PostConditionPrincipalType` - */ - type_id: "principal_standard"; - address: string; - } - | { - /** - * String literal of type `PostConditionPrincipalType` - */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; /** - * A fungible condition code encodes a statement being made for either STX or a fungible token, with respect to the originating account. + * Only present in `smart_contract` and `contract_call` tx types. */ -export type PostConditionFungibleConditionCode = - | "sent_equal_to" - | "sent_greater_than" - | "sent_greater_than_or_equal_to" - | "sent_less_than" - | "sent_less_than_or_equal_to"; -export type PostConditionFungible = { - principal: PostConditionPrincipal; -} & { - condition_code: PostConditionFungibleConditionCode; - type: "fungible"; - amount: string; +export type StxAssetTransactionEvent = AbstractTransactionEvent2 & { + event_type: "stx_asset"; + tx_id: string; asset: { - asset_name: string; - contract_address: string; - contract_name: string; + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; }; }; -export type PostConditionNonFungible = { - principal: PostConditionPrincipal; -} & { - condition_code: PostConditionNonFungibleConditionCode; - type: "non_fungible"; - asset_value: { - hex: string; - repr: string; +export type FungibleTokenAssetTransactionEvent = AbstractTransactionEvent3 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; }; +}; +export type NonFungibleTokenAssetTransactionEvent = AbstractTransactionEvent4 & { + event_type: "non_fungible_token_asset"; + tx_id: string; asset: { - asset_name: string; - contract_address: string; - contract_name: string; + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; }; }; -/** - * A non-fungible condition code encodes a statement being made about a non-fungible token, with respect to whether or not the particular non-fungible token is owned by the account. - */ -export type PostConditionNonFungibleConditionCode = "sent" | "not_sent"; -/** - * `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. - */ -export type TransactionAnchorModeType = "on_chain_only" | "off_chain_only" | "any"; -/** - * Status of the transaction - */ -export type TransactionStatus = "success" | "abort_by_response" | "abort_by_post_condition"; -export type TransactionEvent = - | TransactionEventSmartContractLog - | TransactionEventStxLock - | TransactionEventStxAsset - | TransactionEventFungibleAsset - | TransactionEventNonFungibleAsset; /** * Only present in `smart_contract` and `contract_call` tx types. */ -export type TransactionEventSmartContractLog = AbstractTransactionEvent & { +export type SmartContractLogTransactionEvent1 = AbstractTransactionEvent5 & { event_type: "smart_contract_log"; tx_id: string; contract_log: { @@ -471,7 +321,7 @@ export type TransactionEventSmartContractLog = AbstractTransactionEvent & { /** * Only present in `smart_contract` and `contract_call` tx types. */ -export type TransactionEventStxLock = AbstractTransactionEvent & { +export type StxLockTransactionEvent1 = AbstractTransactionEvent6 & { event_type: "stx_lock"; tx_id: string; stx_lock_event: { @@ -483,28 +333,33 @@ export type TransactionEventStxLock = AbstractTransactionEvent & { /** * Only present in `smart_contract` and `contract_call` tx types. */ -export type TransactionEventStxAsset = AbstractTransactionEvent & { +export type StxAssetTransactionEvent1 = AbstractTransactionEvent7 & { event_type: "stx_asset"; tx_id: string; - asset: TransactionEventAsset; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; }; -export type TransactionEventAssetType = "transfer" | "mint" | "burn"; -export type TransactionEventFungibleAsset = AbstractTransactionEvent & { +export type FungibleTokenAssetTransactionEvent1 = AbstractTransactionEvent8 & { event_type: "fungible_token_asset"; tx_id: string; asset: { - asset_event_type: string; + asset_event_type: "transfer" | "mint" | "burn"; asset_id: string; sender: string; recipient: string; amount: string; }; }; -export type TransactionEventNonFungibleAsset = AbstractTransactionEvent & { +export type NonFungibleTokenAssetTransactionEvent1 = AbstractTransactionEvent9 & { event_type: "non_fungible_token_asset"; tx_id: string; asset: { - asset_event_type: string; + asset_event_type: "transfer" | "mint" | "burn"; asset_id: string; sender: string; recipient: string; @@ -515,30 +370,271 @@ export type TransactionEventNonFungibleAsset = AbstractTransactionEvent & { }; }; /** - * Describes representation of a Type-1 Stacks 2.0 transaction. https://github.com/blockstack/stacks-blockchain/blob/master/sip/sip-005-blocks-and-transactions.md#type-1-instantiating-a-smart-contract + * Only present in `smart_contract` and `contract_call` tx types. */ -export type SmartContractTransaction = AbstractTransaction & SmartContractTransactionMetadata; +export type SmartContractLogTransactionEvent2 = AbstractTransactionEvent10 & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; + }; +}; /** - * Describes representation of a Type 2 Stacks 2.0 transaction: Contract Call + * Only present in `smart_contract` and `contract_call` tx types. */ -export type ContractCallTransaction = AbstractTransaction & ContractCallTransactionMetadata; +export type StxLockTransactionEvent2 = AbstractTransactionEvent11 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; + }; +}; /** - * Describes representation of a Type 3 Stacks 2.0 transaction: Poison Microblock + * Only present in `smart_contract` and `contract_call` tx types. */ -export type PoisonMicroblockTransaction = AbstractTransaction & PoisonMicroblockTransactionMetadata; +export type StxAssetTransactionEvent2 = AbstractTransactionEvent12 & { + event_type: "stx_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; +}; +export type FungibleTokenAssetTransactionEvent2 = AbstractTransactionEvent13 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; + }; +}; +export type NonFungibleTokenAssetTransactionEvent2 = AbstractTransactionEvent14 & { + event_type: "non_fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; + }; +}; /** - * Describes representation of a Type 3 Stacks 2.0 transaction: Poison Microblock + * Only present in `smart_contract` and `contract_call` tx types. */ -export type CoinbaseTransaction = AbstractTransaction & CoinbaseTransactionMetadata; +export type SmartContractLogTransactionEvent3 = AbstractTransactionEvent15 & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; + }; +}; /** - * Describes representation of a Type 7 Stacks transaction: Tenure Change + * Only present in `smart_contract` and `contract_call` tx types. */ -export type TenureChangeTransaction = AbstractTransaction & TenureChangeTransactionMetadata; - +export type StxLockTransactionEvent3 = AbstractTransactionEvent16 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; + }; +}; /** - * GET request that returns account transactions + * Only present in `smart_contract` and `contract_call` tx types. */ -export interface AddressTransactionsWithTransfersListResponse { +export type StxAssetTransactionEvent3 = AbstractTransactionEvent17 & { + event_type: "stx_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; +}; +export type FungibleTokenAssetTransactionEvent3 = AbstractTransactionEvent18 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; + }; +}; +export type NonFungibleTokenAssetTransactionEvent3 = AbstractTransactionEvent19 & { + event_type: "non_fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type SmartContractLogTransactionEvent4 = AbstractTransactionEvent20 & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type StxLockTransactionEvent4 = AbstractTransactionEvent21 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type StxAssetTransactionEvent4 = AbstractTransactionEvent22 & { + event_type: "stx_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; +}; +export type FungibleTokenAssetTransactionEvent4 = AbstractTransactionEvent23 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; + }; +}; +export type NonFungibleTokenAssetTransactionEvent4 = AbstractTransactionEvent24 & { + event_type: "non_fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type SmartContractLogTransactionEvent5 = AbstractTransactionEvent25 & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type StxLockTransactionEvent5 = AbstractTransactionEvent26 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type StxAssetTransactionEvent5 = AbstractTransactionEvent27 & { + event_type: "stx_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; +}; +export type FungibleTokenAssetTransactionEvent5 = AbstractTransactionEvent28 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; + }; +}; +export type NonFungibleTokenAssetTransactionEvent5 = AbstractTransactionEvent29 & { + event_type: "non_fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; + }; +}; + +export interface AddressTransactionsWithTransfersListResponse { limit: number; offset: number; total: number; @@ -548,7 +644,13 @@ export interface AddressTransactionsWithTransfersListResponse { * Transaction with STX transfers for a given address */ export interface AddressTransactionWithTransfers { - tx: Transaction; + tx: + | TokenTransferTransaction + | SmartContractTransaction + | ContractCallTransaction + | PoisonMicroblockTransaction + | CoinbaseTransaction + | TenureChangeTransaction; /** * Total sent from the given address, including the tx fee, in micro-STX as an integer string. */ @@ -572,14 +674,14 @@ export interface AddressTransactionWithTransfers { recipient?: string; }[]; ft_transfers?: { - /** - * Fungible Token asset identifier. - */ - asset_identifier: string; /** * Amount transferred as an integer string. This balance does not factor in possible SIP-010 decimals. */ amount: string; + /** + * Fungible Token asset identifier. + */ + asset_identifier: string; /** * Principal that sent the asset. */ @@ -590,10 +692,6 @@ export interface AddressTransactionWithTransfers { recipient?: string; }[]; nft_transfers?: { - /** - * Non Fungible Token asset identifier. - */ - asset_identifier: string; /** * Non Fungible Token asset value. */ @@ -601,6 +699,10 @@ export interface AddressTransactionWithTransfers { hex: string; repr: string; }; + /** + * Non Fungible Token asset identifier. + */ + asset_identifier: string; /** * Principal that sent the asset. */ @@ -611,10 +713,7 @@ export interface AddressTransactionWithTransfers { recipient?: string; }[]; } -/** - * Transaction properties that are available from a raw serialized transactions. These are available for transactions in the mempool as well as mined transactions. - */ -export interface BaseTransaction { +export interface TokenTransferTransaction { /** * Transaction ID */ @@ -637,63 +736,696 @@ export interface BaseTransaction { */ sponsored: boolean; sponsor_address?: string; - post_condition_mode: PostConditionMode; - post_conditions: PostCondition[]; - anchor_mode: TransactionAnchorModeType; -} -export interface AbstractTransactionEvent { - event_index: number; -} -export interface TransactionEventAsset { - asset_event_type?: TransactionEventAssetType; - asset_id?: string; - sender?: string; - recipient?: string; - amount?: string; - value?: string; - memo?: string; -} -/** - * Metadata associated with token-transfer type transactions - */ -export interface TokenTransferTransactionMetadata { - tx_type: "token_transfer"; - token_transfer: { - recipient_address: string; - /** - * Transfer amount as Integer string (64-bit unsigned integer) - */ - amount: string; - /** - * Hex encoded arbitrary message, up to 34 bytes length (should try decoding to an ASCII string) - */ - memo: string; - }; -} -/** - * Metadata associated with a contract-deploy type transaction. https://github.com/blockstack/stacks-blockchain/blob/master/sip/sip-005-blocks-and-transactions.md#type-1-instantiating-a-smart-contract - */ -export interface SmartContractTransactionMetadata { - tx_type: "smart_contract"; - smart_contract: { - /** - * The Clarity version of the contract, only specified for versioned contract transactions, otherwise null - */ - clarity_version?: number; + post_condition_mode: "allow" | "deny"; + post_conditions: ( + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { /** - * Contract identifier formatted as `.` + * Hex string representing the value fo the transaction result */ - contract_id: string; + hex: string; /** - * Clarity code of the smart contract being deployed + * Readable string of the transaction result */ - source_code: string; + repr: string; }; -} -/** - * Metadata associated with a contract-call type transaction - */ -export interface ContractCallTransactionMetadata { + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent + | StxLockTransactionEvent + | StxAssetTransactionEvent + | FungibleTokenAssetTransactionEvent + | NonFungibleTokenAssetTransactionEvent + )[]; + tx_type: "token_transfer"; + token_transfer: { + recipient_address: string; + /** + * Transfer amount as Integer string (64-bit unsigned integer) + */ + amount: string; + /** + * Hex encoded arbitrary message, up to 34 bytes length (should try decoding to an ASCII string) + */ + memo: string; + }; +} +export interface AbstractTransactionEvent { + event_index: number; +} +export interface AbstractTransactionEvent1 { + event_index: number; +} +export interface AbstractTransactionEvent2 { + event_index: number; +} +export interface AbstractTransactionEvent3 { + event_index: number; +} +export interface AbstractTransactionEvent4 { + event_index: number; +} +export interface SmartContractTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { + /** + * Hex string representing the value fo the transaction result + */ + hex: string; + /** + * Readable string of the transaction result + */ + repr: string; + }; + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent1 + | StxLockTransactionEvent1 + | StxAssetTransactionEvent1 + | FungibleTokenAssetTransactionEvent1 + | NonFungibleTokenAssetTransactionEvent1 + )[]; + tx_type: "smart_contract"; + smart_contract: { + clarity_version: number | null; + /** + * Contract identifier formatted as `.` + */ + contract_id: string; + /** + * Clarity code of the smart contract being deployed + */ + source_code: string; + }; +} +export interface AbstractTransactionEvent5 { + event_index: number; +} +export interface AbstractTransactionEvent6 { + event_index: number; +} +export interface AbstractTransactionEvent7 { + event_index: number; +} +export interface AbstractTransactionEvent8 { + event_index: number; +} +export interface AbstractTransactionEvent9 { + event_index: number; +} +export interface ContractCallTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { + /** + * Hex string representing the value fo the transaction result + */ + hex: string; + /** + * Readable string of the transaction result + */ + repr: string; + }; + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent2 + | StxLockTransactionEvent2 + | StxAssetTransactionEvent2 + | FungibleTokenAssetTransactionEvent2 + | NonFungibleTokenAssetTransactionEvent2 + )[]; tx_type: "contract_call"; contract_call: { /** @@ -708,9 +1440,6 @@ export interface ContractCallTransactionMetadata { * Function definition, including function name and type as well as parameter names and types */ function_signature: string; - /** - * List of arguments used to invoke the function - */ function_args?: { hex: string; repr: string; @@ -719,48 +1448,732 @@ export interface ContractCallTransactionMetadata { }[]; }; } -/** - * Metadata associated with a poison-microblock type transaction - */ -export interface PoisonMicroblockTransactionMetadata { +export interface AbstractTransactionEvent10 { + event_index: number; +} +export interface AbstractTransactionEvent11 { + event_index: number; +} +export interface AbstractTransactionEvent12 { + event_index: number; +} +export interface AbstractTransactionEvent13 { + event_index: number; +} +export interface AbstractTransactionEvent14 { + event_index: number; +} +export interface PoisonMicroblockTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { + /** + * Hex string representing the value fo the transaction result + */ + hex: string; + /** + * Readable string of the transaction result + */ + repr: string; + }; + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent3 + | StxLockTransactionEvent3 + | StxAssetTransactionEvent3 + | FungibleTokenAssetTransactionEvent3 + | NonFungibleTokenAssetTransactionEvent3 + )[]; tx_type: "poison_microblock"; poison_microblock: { /** - * Hex encoded microblock header + * Hex encoded microblock header + */ + microblock_header_1: string; + /** + * Hex encoded microblock header + */ + microblock_header_2: string; + }; +} +export interface AbstractTransactionEvent15 { + event_index: number; +} +export interface AbstractTransactionEvent16 { + event_index: number; +} +export interface AbstractTransactionEvent17 { + event_index: number; +} +export interface AbstractTransactionEvent18 { + event_index: number; +} +export interface AbstractTransactionEvent19 { + event_index: number; +} +export interface CoinbaseTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { + /** + * Hex string representing the value fo the transaction result */ - microblock_header_1: string; + hex: string; /** - * Hex encoded microblock header + * Readable string of the transaction result */ - microblock_header_2: string; + repr: string; }; -} -/** - * Describes representation of a Type 3 Stacks 2.0 transaction: Poison Microblock - */ -export interface CoinbaseTransactionMetadata { + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent4 + | StxLockTransactionEvent4 + | StxAssetTransactionEvent4 + | FungibleTokenAssetTransactionEvent4 + | NonFungibleTokenAssetTransactionEvent4 + )[]; tx_type: "coinbase"; coinbase_payload: { /** * Hex encoded 32-byte scratch space for block leader's use */ data: string; + alt_recipient?: string | null; + vrf_proof?: string | null; + }; +} +export interface AbstractTransactionEvent20 { + event_index: number; +} +export interface AbstractTransactionEvent21 { + event_index: number; +} +export interface AbstractTransactionEvent22 { + event_index: number; +} +export interface AbstractTransactionEvent23 { + event_index: number; +} +export interface AbstractTransactionEvent24 { + event_index: number; +} +export interface TenureChangeTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { /** - * A principal that will receive the miner rewards for this coinbase transaction. Can be either a standard principal or contract principal. Only specified for `coinbase-to-alt-recipient` transaction types, otherwise null. + * Hex string representing the value fo the transaction result */ - alt_recipient?: string; + hex: string; /** - * Hex encoded 80-byte VRF proof + * Readable string of the transaction result */ - vrf_proof?: string; + repr: string; }; -} -/** - * Describes representation of a Type 7 Stacks transaction: Tenure Change - */ -export interface TenureChangeTransactionMetadata { + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent5 + | StxLockTransactionEvent5 + | StxAssetTransactionEvent5 + | FungibleTokenAssetTransactionEvent5 + | NonFungibleTokenAssetTransactionEvent5 + )[]; tx_type: "tenure_change"; - tenure_change_payload?: { + tenure_change_payload: { /** * Consensus hash of this tenure. Corresponds to the sortition in which the miner of this block was chosen. */ @@ -791,6 +2204,52 @@ export interface TenureChangeTransactionMetadata { pubkey_hash: string; }; } +export interface AbstractTransactionEvent25 { + event_index: number; +} +export interface AbstractTransactionEvent26 { + event_index: number; +} +export interface AbstractTransactionEvent27 { + event_index: number; +} +export interface AbstractTransactionEvent28 { + event_index: number; +} +export interface AbstractTransactionEvent29 { + event_index: number; +} +``` + + + + + + + + + + + + + +```json +{ + "error": "string", + "message": "string" +} +``` + + + + + +```ts +export interface ErrorResponse { + error: string; + message?: string; + [k: string]: unknown; +} ``` diff --git a/content/docs/stacks/api/accounts/transactions.mdx b/content/docs/stacks/api/accounts/transactions.mdx index 1324de296..5766bb46d 100644 --- a/content/docs/stacks/api/accounts/transactions.mdx +++ b/content/docs/stacks/api/accounts/transactions.mdx @@ -28,54 +28,45 @@ import { ## Get account transactions - -This endpoint is deprecated in favor of [Get address transactions](/stacks/api/transactions/address-transactions). - +**NOTE:** This endpoint is deprecated in favor of [Get address transactions](/api/get-address-transactions). -Retrieves a list of all Transactions for a given Address or Contract Identifier. More information on Transaction types can be found [here](https://docs.stacks.co/understand-stacks/transactions#types). + Retrieves a list of all Transactions for a given Address or Contract Identifier. More information on Transaction types can be found [here](https://docs.stacks.co/understand-stacks/transactions#types). -If you need to actively monitor new transactions for an address or contract id, we highly recommend subscribing to [WebSockets or Socket.io](https://github.com/hirosystems/stacks-blockchain-api/tree/master/client) for real-time updates. + If you need to actively monitor new transactions for an address or contract id, we highly recommend subscribing to [WebSockets or Socket.io](https://github.com/hirosystems/stacks-blockchain-api/tree/master/client) for real-time updates. -### Path Parameters - - - -Stacks address or a Contract identifier +### Query Parameters -Example: `"SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0"` + - -### Query Parameters +Results per page - +Default: `20` -max number of account transactions to fetch +Minimum: `0` -Example: `42000` +Maximum: `50` - + -index of first account transaction to fetch +Result offset -Example: `42000` +Default: `0` + +Minimum: `0` - + Filter for transactions only at this given block height -Example: `42000` - -Include transaction data from unanchored (i.e. unconfirmed) microblocks - -Example: `true` +Include data from unanchored (i.e. unconfirmed) microblocks Default: `false` @@ -83,17 +74,22 @@ Include transaction data from unanchored (i.e. unconfirmed) microblocks -returned 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. +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. + + + +### Path Parameters -Example: `60000` + | Status code | Description | -| :------ | :------ | -| `200` | Success | +| ----------- | ----------- | +| `200` | GET request that returns account transactions | +| `4XX` | Default Response | - + @@ -105,8 +101,8 @@ returned data representing the state up until that point in time, rather than th -```terminal -$ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/transactions?limit=42000&offset=42000&height=42000&unanchored=true&until_block=60000" +```bash +curl -X GET "https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/transactions?limit=20&offset=0&height=0&unanchored=false&until_block=string" ``` @@ -114,7 +110,7 @@ $ curl -X GET "https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11B ```js -fetch("https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0/transactions?limit=42000&offset=42000&height=42000&unanchored=true&until_block=60000", { +fetch("https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/transactions?limit=20&offset=0&height=0&unanchored=false&until_block=string", { method: "GET" }); ``` @@ -123,7 +119,7 @@ fetch("https://api.hiro.so/extended/v1/address/SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0 - + @@ -135,9 +131,9 @@ GET request that returns account transactions ```json { - "limit": 30, + "limit": 20, "offset": 0, - "total": 0, + "total": 1, "results": [ { "tx_id": "string", @@ -159,9 +155,48 @@ GET request that returns account transactions } ], "anchor_mode": "on_chain_only", - "tx_status": "pending", - "receipt_time": 0, - "receipt_time_iso": "string", + "block_hash": "string", + "block_height": 0, + "block_time": 0, + "block_time_iso": "string", + "burn_block_time": 0, + "burn_block_height": 0, + "burn_block_time_iso": "string", + "parent_burn_block_time": 0, + "parent_burn_block_time_iso": "string", + "canonical": true, + "tx_index": 0, + "tx_status": "success", + "tx_result": { + "hex": "string", + "repr": "string" + }, + "event_count": 0, + "parent_block_hash": "string", + "is_unanchored": true, + "microblock_hash": "string", + "microblock_sequence": 0, + "microblock_canonical": true, + "execution_cost_read_count": 0, + "execution_cost_read_length": 0, + "execution_cost_runtime": 0, + "execution_cost_write_count": 0, + "execution_cost_write_length": 0, + "events": [ + { + "event_index": 0, + "event_type": "smart_contract_log", + "tx_id": "string", + "contract_log": { + "contract_id": "string", + "topic": "string", + "value": { + "hex": "string", + "repr": "string" + } + } + } + ], "tx_type": "token_transfer", "token_transfer": { "recipient_address": "string", @@ -179,280 +214,141 @@ GET request that returns account transactions ```ts /** - * Describes all transaction types on Stacks 2.0 blockchain - */ -export type MempoolTransaction = - | MempoolTokenTransferTransaction - | MempoolSmartContractTransaction - | MempoolContractCallTransaction - | MempoolPoisonMicroblockTransaction - | MempoolCoinbaseTransaction - | MempoolTenureChangeTransaction; -/** - * Describes representation of a Type-0 Stacks 2.0 transaction. https://github.com/blockstack/stacks-blockchain/blob/master/sip/sip-005-blocks-and-transactions.md#type-0-transferring-an-asset - */ -export type MempoolTokenTransferTransaction = AbstractMempoolTransaction & TokenTransferTransactionMetadata; -/** - * Abstract transaction. This schema makes up all properties common between all Stacks 2.0 transaction types + * Only present in `smart_contract` and `contract_call` tx types. */ -export type AbstractMempoolTransaction = BaseTransaction & { - tx_status: MempoolTransactionStatus; - /** - * A unix timestamp (in seconds) indicating when the transaction broadcast was received by the node. - */ - receipt_time: number; - /** - * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when the transaction broadcast was received by the node. - */ - receipt_time_iso: string; +export type SmartContractLogTransactionEvent = AbstractTransactionEvent & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; + }; }; -export type PostConditionMode = "allow" | "deny"; /** - * Post-conditionscan limit the damage done to a user's assets + * Only present in `smart_contract` and `contract_call` tx types. */ -export type PostCondition = PostConditionStx | PostConditionFungible | PostConditionNonFungible; -export type PostConditionStx = { - principal: PostConditionPrincipal; -} & { - condition_code: PostConditionFungibleConditionCode; - amount: string; - type: "stx"; +export type StxLockTransactionEvent = AbstractTransactionEvent1 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; + }; }; -export type PostConditionPrincipal = - | { - /** - * String literal of type `PostConditionPrincipalType` - */ - type_id: "principal_origin"; - } - | { - /** - * String literal of type `PostConditionPrincipalType` - */ - type_id: "principal_standard"; - address: string; - } - | { - /** - * String literal of type `PostConditionPrincipalType` - */ - type_id: "principal_contract"; - address: string; - contract_name: string; - }; /** - * A fungible condition code encodes a statement being made for either STX or a fungible token, with respect to the originating account. + * Only present in `smart_contract` and `contract_call` tx types. */ -export type PostConditionFungibleConditionCode = - | "sent_equal_to" - | "sent_greater_than" - | "sent_greater_than_or_equal_to" - | "sent_less_than" - | "sent_less_than_or_equal_to"; -export type PostConditionFungible = { - principal: PostConditionPrincipal; -} & { - condition_code: PostConditionFungibleConditionCode; - type: "fungible"; - amount: string; +export type StxAssetTransactionEvent = AbstractTransactionEvent2 & { + event_type: "stx_asset"; + tx_id: string; asset: { - asset_name: string; - contract_address: string; - contract_name: string; + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; }; }; -export type PostConditionNonFungible = { - principal: PostConditionPrincipal; -} & { - condition_code: PostConditionNonFungibleConditionCode; - type: "non_fungible"; - asset_value: { - hex: string; - repr: string; +export type FungibleTokenAssetTransactionEvent = AbstractTransactionEvent3 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; }; +}; +export type NonFungibleTokenAssetTransactionEvent = AbstractTransactionEvent4 & { + event_type: "non_fungible_token_asset"; + tx_id: string; asset: { - asset_name: string; - contract_address: string; - contract_name: string; + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; }; }; /** - * A non-fungible condition code encodes a statement being made about a non-fungible token, with respect to whether or not the particular non-fungible token is owned by the account. - */ -export type PostConditionNonFungibleConditionCode = "sent" | "not_sent"; -/** - * `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. - */ -export type TransactionAnchorModeType = "on_chain_only" | "off_chain_only" | "any"; -/** - * Status of the transaction - */ -export type MempoolTransactionStatus = - | "pending" - | "dropped_replace_by_fee" - | "dropped_replace_across_fork" - | "dropped_too_expensive" - | "dropped_stale_garbage_collect" - | "dropped_problematic"; -/** - * Describes representation of a Type-1 Stacks 2.0 transaction. https://github.com/blockstack/stacks-blockchain/blob/master/sip/sip-005-blocks-and-transactions.md#type-1-instantiating-a-smart-contract - */ -export type MempoolSmartContractTransaction = AbstractMempoolTransaction & SmartContractTransactionMetadata; -/** - * Describes representation of a Type 2 Stacks 2.0 transaction: Contract Call - */ -export type MempoolContractCallTransaction = AbstractMempoolTransaction & ContractCallTransactionMetadata; -/** - * Describes representation of a Type 3 Stacks 2.0 transaction: Poison Microblock - */ -export type MempoolPoisonMicroblockTransaction = AbstractMempoolTransaction & PoisonMicroblockTransactionMetadata; -/** - * Describes representation of a Type 3 Stacks 2.0 transaction: Poison Microblock - */ -export type MempoolCoinbaseTransaction = AbstractMempoolTransaction & CoinbaseTransactionMetadata; -/** - * Describes representation of a Type 7 Stacks transaction: Tenure Change - */ -export type MempoolTenureChangeTransaction = AbstractMempoolTransaction & TenureChangeTransactionMetadata; -/** - * Describes all transaction types on Stacks 2.0 blockchain - */ -export type Transaction = - | TokenTransferTransaction - | SmartContractTransaction - | ContractCallTransaction - | PoisonMicroblockTransaction - | CoinbaseTransaction - | TenureChangeTransaction; -/** - * Describes representation of a Type-0 Stacks 2.0 transaction. https://github.com/blockstack/stacks-blockchain/blob/master/sip/sip-005-blocks-and-transactions.md#type-0-transferring-an-asset + * Only present in `smart_contract` and `contract_call` tx types. */ -export type TokenTransferTransaction = AbstractTransaction & TokenTransferTransactionMetadata; +export type SmartContractLogTransactionEvent1 = AbstractTransactionEvent5 & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; + }; +}; /** - * Anchored transaction metadata. All mined/anchored Stacks transactions have these properties. + * Only present in `smart_contract` and `contract_call` tx types. */ -export type AbstractTransaction = BaseTransaction & { - /** - * Hash of the blocked this transactions was associated with - */ - block_hash: string; - /** - * Height of the block this transactions was associated with - */ - block_height: number; - /** - * Unix timestamp (in seconds) indicating when this block was mined. - */ - block_time: number; - /** - * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. - */ - block_time_iso: string; - /** - * Height of the anchor burn block. - */ - burn_block_height: number; - /** - * Unix timestamp (in seconds) indicating when this block was mined - */ - burn_block_time: number; - /** - * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. - */ - burn_block_time_iso: string; - /** - * Unix timestamp (in seconds) indicating when this parent block was mined - */ - parent_burn_block_time: number; - /** - * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. - */ - parent_burn_block_time_iso: string; - /** - * Set to `true` if block corresponds to the canonical chain tip - */ - canonical: boolean; - /** - * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction - */ - tx_index: number; - tx_status: TransactionStatus; - /** - * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. - */ - tx_result: { - /** - * Hex string representing the value fo the transaction result - */ - hex: string; - /** - * Readable string of the transaction result - */ - repr: string; +export type StxLockTransactionEvent1 = AbstractTransactionEvent6 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; }; - /** - * Number of transaction events - */ - event_count: number; - /** - * Hash of the previous block. - */ - parent_block_hash: string; - /** - * True if the transaction is included in a microblock that has not been confirmed by an anchor block. - */ - is_unanchored: boolean; - /** - * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. - */ - microblock_hash: string; - /** - * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). - */ - microblock_sequence: number; - /** - * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. - */ - microblock_canonical: boolean; - /** - * Execution cost read count. - */ - execution_cost_read_count: number; - /** - * Execution cost read length. - */ - execution_cost_read_length: number; - /** - * Execution cost runtime. - */ - execution_cost_runtime: number; - /** - * Execution cost write count. - */ - execution_cost_write_count: number; - /** - * Execution cost write length. - */ - execution_cost_write_length: number; - /** - * List of transaction events - */ - events: TransactionEvent[]; }; /** - * Status of the transaction + * Only present in `smart_contract` and `contract_call` tx types. */ -export type TransactionStatus = "success" | "abort_by_response" | "abort_by_post_condition"; -export type TransactionEvent = - | TransactionEventSmartContractLog - | TransactionEventStxLock - | TransactionEventStxAsset - | TransactionEventFungibleAsset - | TransactionEventNonFungibleAsset; +export type StxAssetTransactionEvent1 = AbstractTransactionEvent7 & { + event_type: "stx_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; +}; +export type FungibleTokenAssetTransactionEvent1 = AbstractTransactionEvent8 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; + }; +}; +export type NonFungibleTokenAssetTransactionEvent1 = AbstractTransactionEvent9 & { + event_type: "non_fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; + }; +}; /** * Only present in `smart_contract` and `contract_call` tx types. */ -export type TransactionEventSmartContractLog = AbstractTransactionEvent & { +export type SmartContractLogTransactionEvent2 = AbstractTransactionEvent10 & { event_type: "smart_contract_log"; tx_id: string; contract_log: { @@ -467,7 +363,7 @@ export type TransactionEventSmartContractLog = AbstractTransactionEvent & { /** * Only present in `smart_contract` and `contract_call` tx types. */ -export type TransactionEventStxLock = AbstractTransactionEvent & { +export type StxLockTransactionEvent2 = AbstractTransactionEvent11 & { event_type: "stx_lock"; tx_id: string; stx_lock_event: { @@ -479,28 +375,33 @@ export type TransactionEventStxLock = AbstractTransactionEvent & { /** * Only present in `smart_contract` and `contract_call` tx types. */ -export type TransactionEventStxAsset = AbstractTransactionEvent & { +export type StxAssetTransactionEvent2 = AbstractTransactionEvent12 & { event_type: "stx_asset"; tx_id: string; - asset: TransactionEventAsset; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; }; -export type TransactionEventAssetType = "transfer" | "mint" | "burn"; -export type TransactionEventFungibleAsset = AbstractTransactionEvent & { +export type FungibleTokenAssetTransactionEvent2 = AbstractTransactionEvent13 & { event_type: "fungible_token_asset"; tx_id: string; asset: { - asset_event_type: string; + asset_event_type: "transfer" | "mint" | "burn"; asset_id: string; sender: string; recipient: string; amount: string; }; }; -export type TransactionEventNonFungibleAsset = AbstractTransactionEvent & { +export type NonFungibleTokenAssetTransactionEvent2 = AbstractTransactionEvent14 & { event_type: "non_fungible_token_asset"; tx_id: string; asset: { - asset_event_type: string; + asset_event_type: "transfer" | "mint" | "burn"; asset_id: string; sender: string; recipient: string; @@ -511,25 +412,203 @@ export type TransactionEventNonFungibleAsset = AbstractTransactionEvent & { }; }; /** - * Describes representation of a Type-1 Stacks 2.0 transaction. https://github.com/blockstack/stacks-blockchain/blob/master/sip/sip-005-blocks-and-transactions.md#type-1-instantiating-a-smart-contract + * Only present in `smart_contract` and `contract_call` tx types. */ -export type SmartContractTransaction = AbstractTransaction & SmartContractTransactionMetadata; +export type SmartContractLogTransactionEvent3 = AbstractTransactionEvent15 & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; + }; +}; /** - * Describes representation of a Type 2 Stacks 2.0 transaction: Contract Call + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type StxLockTransactionEvent3 = AbstractTransactionEvent16 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type StxAssetTransactionEvent3 = AbstractTransactionEvent17 & { + event_type: "stx_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; +}; +export type FungibleTokenAssetTransactionEvent3 = AbstractTransactionEvent18 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; + }; +}; +export type NonFungibleTokenAssetTransactionEvent3 = AbstractTransactionEvent19 & { + event_type: "non_fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type SmartContractLogTransactionEvent4 = AbstractTransactionEvent20 & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. + */ +export type StxLockTransactionEvent4 = AbstractTransactionEvent21 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; + }; +}; +/** + * Only present in `smart_contract` and `contract_call` tx types. */ -export type ContractCallTransaction = AbstractTransaction & ContractCallTransactionMetadata; +export type StxAssetTransactionEvent4 = AbstractTransactionEvent22 & { + event_type: "stx_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; +}; +export type FungibleTokenAssetTransactionEvent4 = AbstractTransactionEvent23 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; + }; +}; +export type NonFungibleTokenAssetTransactionEvent4 = AbstractTransactionEvent24 & { + event_type: "non_fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; + }; +}; /** - * Describes representation of a Type 3 Stacks 2.0 transaction: Poison Microblock + * Only present in `smart_contract` and `contract_call` tx types. */ -export type PoisonMicroblockTransaction = AbstractTransaction & PoisonMicroblockTransactionMetadata; +export type SmartContractLogTransactionEvent5 = AbstractTransactionEvent25 & { + event_type: "smart_contract_log"; + tx_id: string; + contract_log: { + contract_id: string; + topic: string; + value: { + hex: string; + repr: string; + }; + }; +}; /** - * Describes representation of a Type 3 Stacks 2.0 transaction: Poison Microblock + * Only present in `smart_contract` and `contract_call` tx types. */ -export type CoinbaseTransaction = AbstractTransaction & CoinbaseTransactionMetadata; +export type StxLockTransactionEvent5 = AbstractTransactionEvent26 & { + event_type: "stx_lock"; + tx_id: string; + stx_lock_event: { + locked_amount: string; + unlock_height: number; + locked_address: string; + }; +}; /** - * Describes representation of a Type 7 Stacks transaction: Tenure Change + * Only present in `smart_contract` and `contract_call` tx types. */ -export type TenureChangeTransaction = AbstractTransaction & TenureChangeTransactionMetadata; +export type StxAssetTransactionEvent5 = AbstractTransactionEvent27 & { + event_type: "stx_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + sender: string; + recipient: string; + amount: string; + memo?: string; + }; +}; +export type FungibleTokenAssetTransactionEvent5 = AbstractTransactionEvent28 & { + event_type: "fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + amount: string; + }; +}; +export type NonFungibleTokenAssetTransactionEvent5 = AbstractTransactionEvent29 & { + event_type: "non_fungible_token_asset"; + tx_id: string; + asset: { + asset_event_type: "transfer" | "mint" | "burn"; + asset_id: string; + sender: string; + recipient: string; + value: { + hex: string; + repr: string; + }; + }; +}; /** * GET request that returns account transactions @@ -538,12 +617,1256 @@ export interface AddressTransactionsListResponse { limit: number; offset: number; total: number; - results: (MempoolTransaction | Transaction)[]; + results: ( + | TokenTransferTransaction + | SmartContractTransaction + | ContractCallTransaction + | PoisonMicroblockTransaction + | CoinbaseTransaction + | TenureChangeTransaction + )[]; +} +export interface TokenTransferTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { + /** + * Hex string representing the value fo the transaction result + */ + hex: string; + /** + * Readable string of the transaction result + */ + repr: string; + }; + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent + | StxLockTransactionEvent + | StxAssetTransactionEvent + | FungibleTokenAssetTransactionEvent + | NonFungibleTokenAssetTransactionEvent + )[]; + tx_type: "token_transfer"; + token_transfer: { + recipient_address: string; + /** + * Transfer amount as Integer string (64-bit unsigned integer) + */ + amount: string; + /** + * Hex encoded arbitrary message, up to 34 bytes length (should try decoding to an ASCII string) + */ + memo: string; + }; +} +export interface AbstractTransactionEvent { + event_index: number; +} +export interface AbstractTransactionEvent1 { + event_index: number; +} +export interface AbstractTransactionEvent2 { + event_index: number; +} +export interface AbstractTransactionEvent3 { + event_index: number; +} +export interface AbstractTransactionEvent4 { + event_index: number; +} +export interface SmartContractTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { + /** + * Hex string representing the value fo the transaction result + */ + hex: string; + /** + * Readable string of the transaction result + */ + repr: string; + }; + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent1 + | StxLockTransactionEvent1 + | StxAssetTransactionEvent1 + | FungibleTokenAssetTransactionEvent1 + | NonFungibleTokenAssetTransactionEvent1 + )[]; + tx_type: "smart_contract"; + smart_contract: { + clarity_version: number | null; + /** + * Contract identifier formatted as `.` + */ + contract_id: string; + /** + * Clarity code of the smart contract being deployed + */ + source_code: string; + }; +} +export interface AbstractTransactionEvent5 { + event_index: number; +} +export interface AbstractTransactionEvent6 { + event_index: number; +} +export interface AbstractTransactionEvent7 { + event_index: number; +} +export interface AbstractTransactionEvent8 { + event_index: number; +} +export interface AbstractTransactionEvent9 { + event_index: number; +} +export interface ContractCallTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { + /** + * Hex string representing the value fo the transaction result + */ + hex: string; + /** + * Readable string of the transaction result + */ + repr: string; + }; + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent2 + | StxLockTransactionEvent2 + | StxAssetTransactionEvent2 + | FungibleTokenAssetTransactionEvent2 + | NonFungibleTokenAssetTransactionEvent2 + )[]; + tx_type: "contract_call"; + contract_call: { + /** + * Contract identifier formatted as `.` + */ + contract_id: string; + /** + * Name of the Clarity function to be invoked + */ + function_name: string; + /** + * 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; + }[]; + }; +} +export interface AbstractTransactionEvent10 { + event_index: number; +} +export interface AbstractTransactionEvent11 { + event_index: number; +} +export interface AbstractTransactionEvent12 { + event_index: number; +} +export interface AbstractTransactionEvent13 { + event_index: number; +} +export interface AbstractTransactionEvent14 { + event_index: number; +} +export interface PoisonMicroblockTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { + /** + * Hex string representing the value fo the transaction result + */ + hex: string; + /** + * Readable string of the transaction result + */ + repr: string; + }; + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent3 + | StxLockTransactionEvent3 + | StxAssetTransactionEvent3 + | FungibleTokenAssetTransactionEvent3 + | NonFungibleTokenAssetTransactionEvent3 + )[]; + tx_type: "poison_microblock"; + poison_microblock: { + /** + * Hex encoded microblock header + */ + microblock_header_1: string; + /** + * Hex encoded microblock header + */ + microblock_header_2: string; + }; +} +export interface AbstractTransactionEvent15 { + event_index: number; +} +export interface AbstractTransactionEvent16 { + event_index: number; +} +export interface AbstractTransactionEvent17 { + event_index: number; +} +export interface AbstractTransactionEvent18 { + event_index: number; +} +export interface AbstractTransactionEvent19 { + event_index: number; +} +export interface CoinbaseTransaction { + /** + * Transaction ID + */ + tx_id: string; + /** + * 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; + /** + * Transaction fee as Integer string (64-bit unsigned integer). + */ + fee_rate: string; + /** + * Address of the transaction initiator + */ + sender_address: string; + sponsor_nonce?: number; + /** + * 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: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { + /** + * Hex string representing the value fo the transaction result + */ + hex: string; + /** + * Readable string of the transaction result + */ + repr: string; + }; + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent4 + | StxLockTransactionEvent4 + | StxAssetTransactionEvent4 + | FungibleTokenAssetTransactionEvent4 + | NonFungibleTokenAssetTransactionEvent4 + )[]; + tx_type: "coinbase"; + coinbase_payload: { + /** + * Hex encoded 32-byte scratch space for block leader's use + */ + data: string; + alt_recipient?: string | null; + vrf_proof?: string | null; + }; } -/** - * Transaction properties that are available from a raw serialized transactions. These are available for transactions in the mempool as well as mined transactions. - */ -export interface BaseTransaction { +export interface AbstractTransactionEvent20 { + event_index: number; +} +export interface AbstractTransactionEvent21 { + event_index: number; +} +export interface AbstractTransactionEvent22 { + event_index: number; +} +export interface AbstractTransactionEvent23 { + event_index: number; +} +export interface AbstractTransactionEvent24 { + event_index: number; +} +export interface TenureChangeTransaction { /** * Transaction ID */ @@ -566,118 +1889,204 @@ export interface BaseTransaction { */ sponsored: boolean; sponsor_address?: string; - post_condition_mode: PostConditionMode; - post_conditions: PostCondition[]; - anchor_mode: TransactionAnchorModeType; -} -/** - * Metadata associated with token-transfer type transactions - */ -export interface TokenTransferTransactionMetadata { - tx_type: "token_transfer"; - token_transfer: { - recipient_address: string; - /** - * Transfer amount as Integer string (64-bit unsigned integer) - */ - amount: string; - /** - * Hex encoded arbitrary message, up to 34 bytes length (should try decoding to an ASCII string) - */ - memo: string; - }; -} -/** - * Metadata associated with a contract-deploy type transaction. https://github.com/blockstack/stacks-blockchain/blob/master/sip/sip-005-blocks-and-transactions.md#type-1-instantiating-a-smart-contract - */ -export interface SmartContractTransactionMetadata { - tx_type: "smart_contract"; - smart_contract: { - /** - * The Clarity version of the contract, only specified for versioned contract transactions, otherwise null - */ - clarity_version?: number; - /** - * Contract identifier formatted as `.` - */ - contract_id: string; - /** - * Clarity code of the smart contract being deployed - */ - source_code: string; - }; -} -/** - * Metadata associated with a contract-call type transaction - */ -export interface ContractCallTransactionMetadata { - tx_type: "contract_call"; - contract_call: { - /** - * Contract identifier formatted as `.` - */ - contract_id: string; - /** - * Name of the Clarity function to be invoked - */ - function_name: string; - /** - * Function definition, including function name and type as well as parameter names and types - */ - function_signature: string; - /** - * List of arguments used to invoke the function - */ - function_args?: { - hex: string; - repr: string; - name: string; - type: string; - }[]; - }; -} -/** - * Metadata associated with a poison-microblock type transaction - */ -export interface PoisonMicroblockTransactionMetadata { - tx_type: "poison_microblock"; - poison_microblock: { - /** - * Hex encoded microblock header - */ - microblock_header_1: string; - /** - * Hex encoded microblock header - */ - microblock_header_2: string; - }; -} -/** - * Describes representation of a Type 3 Stacks 2.0 transaction: Poison Microblock - */ -export interface CoinbaseTransactionMetadata { - tx_type: "coinbase"; - coinbase_payload: { - /** - * Hex encoded 32-byte scratch space for block leader's use - */ - data: string; + post_condition_mode: "allow" | "deny"; + post_conditions: ( + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "stx"; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: 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; + type: "fungible"; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + | { + principal: + | { + type_id: "principal_origin"; + } + | { + type_id: "principal_standard"; + address: string; + } + | { + type_id: "principal_contract"; + address: string; + contract_name: string; + }; + condition_code: "sent" | "not_sent"; + type: "non_fungible"; + asset_value: { + hex: string; + repr: string; + }; + asset: { + asset_name: string; + contract_address: string; + contract_name: string; + }; + } + )[]; + /** + * `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"; + /** + * Hash of the blocked this transactions was associated with + */ + block_hash: string; + /** + * Height of the block this transactions was associated with + */ + block_height: number; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) indicating when this block was mined. + */ + block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this block was mined. + */ + burn_block_time: number; + /** + * Height of the anchor burn block. + */ + burn_block_height: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this block was mined. + */ + burn_block_time_iso: string; + /** + * Unix timestamp (in seconds) indicating when this parent block was mined + */ + parent_burn_block_time: number; + /** + * An ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) timestamp indicating when this parent block was mined. + */ + parent_burn_block_time_iso: string; + /** + * Set to `true` if block corresponds to the canonical chain tip + */ + canonical: boolean; + /** + * Index of the transaction, indicating the order. Starts at `0` and increases with each transaction + */ + tx_index: number; + /** + * Status of the transaction + */ + tx_status: "success" | "abort_by_response" | "abort_by_post_condition"; + /** + * Result of the transaction. For contract calls, this will show the value returned by the call. For other transaction types, this will return a boolean indicating the success of the transaction. + */ + tx_result: { /** - * A principal that will receive the miner rewards for this coinbase transaction. Can be either a standard principal or contract principal. Only specified for `coinbase-to-alt-recipient` transaction types, otherwise null. + * Hex string representing the value fo the transaction result */ - alt_recipient?: string; + hex: string; /** - * Hex encoded 80-byte VRF proof + * Readable string of the transaction result */ - vrf_proof?: string; + repr: string; }; -} -/** - * Describes representation of a Type 7 Stacks transaction: Tenure Change - */ -export interface TenureChangeTransactionMetadata { + /** + * Number of transaction events + */ + event_count: number; + /** + * Hash of the previous block. + */ + parent_block_hash: string; + /** + * True if the transaction is included in a microblock that has not been confirmed by an anchor block. + */ + is_unanchored: boolean; + /** + * The microblock hash that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be an empty string. + */ + microblock_hash: string; + /** + * The microblock sequence number that this transaction was streamed in. If the transaction was batched in an anchor block (not included within a microblock) then this value will be 2147483647 (0x7fffffff, the max int32 value), this value preserves logical transaction ordering on (block_height, microblock_sequence, tx_index). + */ + microblock_sequence: number; + /** + * Set to `true` if microblock is anchored in the canonical chain tip, `false` if the transaction was orphaned in a micro-fork. + */ + microblock_canonical: boolean; + /** + * Execution cost read count. + */ + execution_cost_read_count: number; + /** + * Execution cost read length. + */ + execution_cost_read_length: number; + /** + * Execution cost runtime. + */ + execution_cost_runtime: number; + /** + * Execution cost write count. + */ + execution_cost_write_count: number; + /** + * Execution cost write length. + */ + execution_cost_write_length: number; + events: ( + | SmartContractLogTransactionEvent5 + | StxLockTransactionEvent5 + | StxAssetTransactionEvent5 + | FungibleTokenAssetTransactionEvent5 + | NonFungibleTokenAssetTransactionEvent5 + )[]; tx_type: "tenure_change"; - tenure_change_payload?: { + tenure_change_payload: { /** * Consensus hash of this tenure. Corresponds to the sortition in which the miner of this block was chosen. */ @@ -708,17 +2117,51 @@ export interface TenureChangeTransactionMetadata { pubkey_hash: string; }; } -export interface AbstractTransactionEvent { +export interface AbstractTransactionEvent25 { + event_index: number; +} +export interface AbstractTransactionEvent26 { + event_index: number; +} +export interface AbstractTransactionEvent27 { + event_index: number; +} +export interface AbstractTransactionEvent28 { + event_index: number; +} +export interface AbstractTransactionEvent29 { event_index: number; } -export interface TransactionEventAsset { - asset_event_type?: TransactionEventAssetType; - asset_id?: string; - sender?: string; - recipient?: string; - amount?: string; - value?: string; - memo?: string; +``` + + + + + + + + + + + + + +```json +{ + "error": "string", + "message": "string" +} +``` + + + + + +```ts +export interface ErrorResponse { + error: string; + message?: string; + [k: string]: unknown; } ``` diff --git a/content/docs/stacks/signer-metrics-api/block-proposals/signer-information-for-a-block.mdx b/content/docs/stacks/signer-metrics-api/block-proposals/signer-information-for-a-block.mdx index b032c4bf2..b41ef1aa2 100644 --- a/content/docs/stacks/signer-metrics-api/block-proposals/signer-information-for-a-block.mdx +++ b/content/docs/stacks/signer-metrics-api/block-proposals/signer-information-for-a-block.mdx @@ -65,7 +65,7 @@ Block hash ```bash -curl -X GET "https://api.hiro.so//signer-metrics/v1/block_proposals/string?limit=25&offset=0" +curl -X GET "https://api.hiro.so/signer-metrics/v1/block_proposals/string?limit=25&offset=0" ``` @@ -73,7 +73,7 @@ curl -X GET "https://api.hiro.so//signer-metrics/v1/block_proposals/string?limit ```js -fetch("https://api.hiro.so//signer-metrics/v1/block_proposals/string?limit=25&offset=0", { +fetch("https://api.hiro.so/signer-metrics/v1/block_proposals/string?limit=25&offset=0", { method: "GET" }); ``` diff --git a/content/docs/stacks/signer-metrics-api/block-proposals/signer-information-for-most-recent-block-proposals.mdx b/content/docs/stacks/signer-metrics-api/block-proposals/signer-information-for-most-recent-block-proposals.mdx index 2634f186f..c9f715928 100644 --- a/content/docs/stacks/signer-metrics-api/block-proposals/signer-information-for-most-recent-block-proposals.mdx +++ b/content/docs/stacks/signer-metrics-api/block-proposals/signer-information-for-most-recent-block-proposals.mdx @@ -55,7 +55,7 @@ Number of results to skip ```bash -curl -X GET "https://api.hiro.so//signer-metrics/v1/block_proposals?limit=25&offset=0" +curl -X GET "https://api.hiro.so/signer-metrics/v1/block_proposals?limit=25&offset=0" ``` @@ -63,7 +63,7 @@ curl -X GET "https://api.hiro.so//signer-metrics/v1/block_proposals?limit=25&off ```js -fetch("https://api.hiro.so//signer-metrics/v1/block_proposals?limit=25&offset=0", { +fetch("https://api.hiro.so/signer-metrics/v1/block_proposals?limit=25&offset=0", { method: "GET" }); ``` diff --git a/content/docs/stacks/signer-metrics-api/blocks/aggregated-signer-information-for-a-block.mdx b/content/docs/stacks/signer-metrics-api/blocks/aggregated-signer-information-for-a-block.mdx index 256944d02..deee661f1 100644 --- a/content/docs/stacks/signer-metrics-api/blocks/aggregated-signer-information-for-a-block.mdx +++ b/content/docs/stacks/signer-metrics-api/blocks/aggregated-signer-information-for-a-block.mdx @@ -39,7 +39,7 @@ Aggregated signer information for a block ```bash -curl -X GET "https://api.hiro.so//signer-metrics/v1/blocks/latest" +curl -X GET "https://api.hiro.so/signer-metrics/v1/blocks/latest" ``` @@ -47,7 +47,7 @@ curl -X GET "https://api.hiro.so//signer-metrics/v1/blocks/latest" ```js -fetch("https://api.hiro.so//signer-metrics/v1/blocks/latest", { +fetch("https://api.hiro.so/signer-metrics/v1/blocks/latest", { method: "GET" }); ``` diff --git a/content/docs/stacks/signer-metrics-api/blocks/aggregated-signer-information-for-most-recent-blocks.mdx b/content/docs/stacks/signer-metrics-api/blocks/aggregated-signer-information-for-most-recent-blocks.mdx index fbaf3584b..697d6cfb8 100644 --- a/content/docs/stacks/signer-metrics-api/blocks/aggregated-signer-information-for-most-recent-blocks.mdx +++ b/content/docs/stacks/signer-metrics-api/blocks/aggregated-signer-information-for-most-recent-blocks.mdx @@ -51,7 +51,7 @@ Number of results to skip ```bash -curl -X GET "https://api.hiro.so//signer-metrics/v1/blocks?limit=100&offset=0" +curl -X GET "https://api.hiro.so/signer-metrics/v1/blocks?limit=100&offset=0" ``` @@ -59,7 +59,7 @@ curl -X GET "https://api.hiro.so//signer-metrics/v1/blocks?limit=100&offset=0" ```js -fetch("https://api.hiro.so//signer-metrics/v1/blocks?limit=100&offset=0", { +fetch("https://api.hiro.so/signer-metrics/v1/blocks?limit=100&offset=0", { method: "GET" }); ``` diff --git a/content/docs/stacks/signer-metrics-api/info/status.mdx b/content/docs/stacks/signer-metrics-api/info/status.mdx index 4506fd9ae..fed7fbed3 100644 --- a/content/docs/stacks/signer-metrics-api/info/status.mdx +++ b/content/docs/stacks/signer-metrics-api/info/status.mdx @@ -33,7 +33,7 @@ Displays the status of the API and its current workload ```bash -curl -X GET "https://api.hiro.so//signer-metrics/" +curl -X GET "https://api.hiro.so/signer-metrics/" ``` @@ -41,7 +41,7 @@ curl -X GET "https://api.hiro.so//signer-metrics/" ```js -fetch("https://api.hiro.so//signer-metrics/", { +fetch("https://api.hiro.so/signer-metrics/", { method: "GET" }); ``` diff --git a/content/docs/stacks/signer-metrics-api/prometheus/metrics.mdx b/content/docs/stacks/signer-metrics-api/prometheus/metrics.mdx index 36e39dcc9..08b5610b1 100644 --- a/content/docs/stacks/signer-metrics-api/prometheus/metrics.mdx +++ b/content/docs/stacks/signer-metrics-api/prometheus/metrics.mdx @@ -33,7 +33,7 @@ Retreives the Prometheus metrics signer and block proposal related data ```bash -curl -X GET "https://api.hiro.so//signer-metrics/metrics" +curl -X GET "https://api.hiro.so/signer-metrics/metrics" ``` @@ -41,7 +41,7 @@ curl -X GET "https://api.hiro.so//signer-metrics/metrics" ```js -fetch("https://api.hiro.so//signer-metrics/metrics", { +fetch("https://api.hiro.so/signer-metrics/metrics", { method: "GET" }); ``` diff --git a/content/docs/stacks/signer-metrics-api/signers/pox-cycle-signer.mdx b/content/docs/stacks/signer-metrics-api/signers/pox-cycle-signer.mdx index e3de21f4f..c6a6d513f 100644 --- a/content/docs/stacks/signer-metrics-api/signers/pox-cycle-signer.mdx +++ b/content/docs/stacks/signer-metrics-api/signers/pox-cycle-signer.mdx @@ -48,7 +48,7 @@ Signer public key (hex encoded) ```bash -curl -X GET "https://api.hiro.so//signer-metrics/v1/cycles/0/signers/string" +curl -X GET "https://api.hiro.so/signer-metrics/v1/cycles/0/signers/string" ``` @@ -56,7 +56,7 @@ curl -X GET "https://api.hiro.so//signer-metrics/v1/cycles/0/signers/string" ```js -fetch("https://api.hiro.so//signer-metrics/v1/cycles/0/signers/string", { +fetch("https://api.hiro.so/signer-metrics/v1/cycles/0/signers/string", { method: "GET" }); ``` diff --git a/content/docs/stacks/signer-metrics-api/signers/pox-cycle-signers.mdx b/content/docs/stacks/signer-metrics-api/signers/pox-cycle-signers.mdx index f8f0a2921..deb45b1ae 100644 --- a/content/docs/stacks/signer-metrics-api/signers/pox-cycle-signers.mdx +++ b/content/docs/stacks/signer-metrics-api/signers/pox-cycle-signers.mdx @@ -71,7 +71,7 @@ PoX cycle number ```bash -curl -X GET "https://api.hiro.so//signer-metrics/v1/cycles/0/signers?from=string&to=string&limit=100&offset=0" +curl -X GET "https://api.hiro.so/signer-metrics/v1/cycles/0/signers?from=string&to=string&limit=100&offset=0" ``` @@ -79,7 +79,7 @@ curl -X GET "https://api.hiro.so//signer-metrics/v1/cycles/0/signers?from=string ```js -fetch("https://api.hiro.so//signer-metrics/v1/cycles/0/signers?from=string&to=string&limit=100&offset=0", { +fetch("https://api.hiro.so/signer-metrics/v1/cycles/0/signers?from=string&to=string&limit=100&offset=0", { method: "GET" }); ```