# Packages
# README
Go API client for stacks_blockchain_api_client
Welcome to the API reference overview for the Stacks Blockchain API.
[Download Postman collection](https://hirosystems.github.io/stacks-blockchain-api/collection.json)
Overview
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: v8.1.2
- Package version: 1.0.0
- Generator version: 7.8.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Installation
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import stacks_blockchain_api_client "github.com/GIT_USER_ID/GIT_REPO_ID"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
Configuration of Server URL
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
Select Server Configuration
For using other server than the one defined on index 0 set context value stacks_blockchain_api_client.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), stacks_blockchain_api_client.ContextServerIndex, 1)
Templated Server URL
Templated server URL is formatted using default variables from configuration or from context value stacks_blockchain_api_client.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), stacks_blockchain_api_client.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Note, enum values are always validated and all unused variables are silently ignored.
URLs Configuration per Operation
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using stacks_blockchain_api_client.ContextOperationServerIndices
and stacks_blockchain_api_client.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), stacks_blockchain_api_client.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), stacks_blockchain_api_client.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
Documentation for API Endpoints
All URIs are relative to https://api.hiro.so
Class | Method | HTTP request | Description |
---|---|---|---|
AccountsAPI | GetAccountAssets | Get /extended/v1/address/{principal}/assets | Get account assets |
AccountsAPI | GetAccountBalance | Get /extended/v1/address/{principal}/balances | Get account balances |
AccountsAPI | GetAccountInbound | Get /extended/v1/address/{principal}/stx_inbound | Get inbound STX transfers |
AccountsAPI | GetAccountNonces | Get /extended/v1/address/{principal}/nonces | Get the latest nonce used by an account |
AccountsAPI | GetAccountStxBalance | Get /extended/v1/address/{principal}/stx | Get account STX balance |
AccountsAPI | GetAccountTransactions | Get /extended/v1/address/{principal}/transactions | Get account transactions |
AccountsAPI | GetAccountTransactionsWithTransfers | Get /extended/v1/address/{principal}/transactions_with_transfers | Get account transactions including STX transfers for each transaction. |
AccountsAPI | GetSingleTransactionWithTransfers | Get /extended/v1/address/{principal}/{tx_id}/with_transfers | Get account transaction information for specific transaction |
BlocksAPI | GetAverageBlockTimes | Get /extended/v2/blocks/average-times | Get average block times |
BlocksAPI | GetBlock | Get /extended/v2/blocks/{height_or_hash} | Get block |
BlocksAPI | GetBlockByBurnBlockHash | Get /extended/v1/block/by_burn_block_hash/{burn_block_hash} | Get block by burnchain block hash |
BlocksAPI | GetBlockByBurnBlockHeight | Get /extended/v1/block/by_burn_block_height/{burn_block_height} | Get block by burnchain height |
BlocksAPI | GetBlockByHash | Get /extended/v1/block/{hash} | Get block by hash |
BlocksAPI | GetBlockByHeight | Get /extended/v1/block/by_height/{height} | Get block by height |
BlocksAPI | GetBlockList | Get /extended/v1/block/ | Get recent blocks |
BlocksAPI | GetBlocks | Get /extended/v2/blocks/ | Get blocks |
BlocksAPI | GetSignerSignaturesForBlock | Get /extended/v2/blocks/{height_or_hash}/signer-signatures | Get signer signatures for block |
BurnBlocksAPI | GetBlocksByBurnBlock | Get /extended/v2/burn-blocks/{height_or_hash}/blocks | Get blocks by burn block |
BurnBlocksAPI | GetBurnBlock | Get /extended/v2/burn-blocks/{height_or_hash} | Get burn block |
BurnBlocksAPI | GetBurnBlocks | Get /extended/v2/burn-blocks/ | Get burn blocks |
FaucetsAPI | GetBtcBalance | Get /extended/v1/faucets/btc/{address} | Get BTC balance for address |
FaucetsAPI | RunFaucetBtc | Post /extended/v1/faucets/btc | Add testnet BTC tokens to address |
FaucetsAPI | RunFaucetStx | Post /extended/v1/faucets/stx | Get STX testnet tokens |
FeesAPI | FetchFeeRate | Post /extended/v1/fee_rate/ | Fetch fee rate |
FungibleTokensAPI | GetFtHolders | Get /extended/v1/tokens/ft/{token}/holders | Fungible token holders |
InfoAPI | GetNetworkBlockTimeByNetwork | Get /extended/v1/info/network_block_time/{network} | Get a given network's target block time |
InfoAPI | GetNetworkBlockTimes | Get /extended/v1/info/network_block_times | Get the network target block time |
InfoAPI | GetStatus | Get /extended | API status |
InfoAPI | GetStxSupply | Get /extended/v1/stx_supply/ | Get total and unlocked STX supply |
InfoAPI | GetStxSupplyCirculatingPlain | Get /extended/v1/stx_supply/circulating/plain | Get circulating STX supply in plain text format |
InfoAPI | GetStxSupplyTotalSupplyPlain | Get /extended/v1/stx_supply/total/plain | Get total STX supply in plain text format |
InfoAPI | GetTotalStxSupplyLegacyFormat | Get /extended/v1/stx_supply/legacy_format | Get total and unlocked STX supply (results formatted the same as the legacy 1.0 API) |
MempoolAPI | GetMempoolFeePriorities | Get /extended/v2/mempool/fees | Get mempool transaction fee priorities |
MicroblocksAPI | GetMicroblockByHash | Get /extended/v1/microblock/{hash} | Get microblock |
MicroblocksAPI | GetMicroblockList | Get /extended/v1/microblock/ | Get recent microblocks |
MicroblocksAPI | GetUnanchoredTxs | Get /extended/v1/microblock/unanchored/txs | Get the list of current transactions that belong to unanchored microblocks |
NamesAPI | FetchSubdomainsListForName | Get /v1/names/{name}/subdomains | Get Name Subdomains |
NamesAPI | FetchZoneFile | Get /v1/names/{name}/zonefile | Get Zone File |
NamesAPI | GetAllNames | Get /v1/names/ | Get All Names |
NamesAPI | GetAllNamespaces | Get /v1/namespaces/ | Get All Namespaces |
NamesAPI | GetHistoricalZoneFile | Get /v1/names/{name}/zonefile/{zoneFileHash} | Get Historical Zone File |
NamesAPI | GetNameInfo | Get /v1/names/{name} | Get Name Details |
NamesAPI | GetNamePrice | Get /v2/prices/names/{name} | Get Name Price |
NamesAPI | GetNamesOwnedByAddress | Get /v1/addresses/{blockchain}/{address} | Get Names Owned by Address |
NamesAPI | GetNamespaceNames | Get /v1/namespaces/{tld}/names | Get Namespace Names |
NamesAPI | GetNamespacePrice | Get /v2/prices/namespaces/{tld} | Get Namespace Price |
NonFungibleTokensAPI | GetNftHistory | Get /extended/v1/tokens/nft/history | Non-Fungible Token history |
NonFungibleTokensAPI | GetNftHoldings | Get /extended/v1/tokens/nft/holdings | Non-Fungible Token holdings |
NonFungibleTokensAPI | GetNftMints | Get /extended/v1/tokens/nft/mints | Non-Fungible Token mints |
ProofOfTransferAPI | GetPoxCycle | Get /extended/v2/pox/cycles/{cycle_number} | Get PoX cycle |
ProofOfTransferAPI | GetPoxCycleSigner | Get /extended/v2/pox/cycles/{cycle_number}/signers/{signer_key} | Get signer in PoX cycle |
ProofOfTransferAPI | GetPoxCycleSignerStackers | Get /extended/v2/pox/cycles/{cycle_number}/signers/{signer_key}/stackers | Get stackers for signer in PoX cycle |
ProofOfTransferAPI | GetPoxCycleSigners | Get /extended/v2/pox/cycles/{cycle_number}/signers | Get signers in PoX cycle |
ProofOfTransferAPI | GetPoxCycles | Get /extended/v2/pox/cycles | Get PoX cycles |
SearchAPI | SearchById | Get /extended/v1/search/{id} | Search |
SmartContractsAPI | GetContractById | Get /extended/v1/contract/{contract_id} | Get contract info |
SmartContractsAPI | GetContractEventsById | Get /extended/v1/contract/{contract_id}/events | Get contract events |
SmartContractsAPI | GetContractsByTrait | Get /extended/v1/contract/by_trait | Get contracts by trait |
SmartContractsAPI | GetSmartContractsStatus | Get /extended/v2/smart-contracts/status | Get smart contracts status |
StackingAPI | ExtendedV1PoxEventsGet | Get /extended/v1/{pox}/events | Get latest PoX events |
StackingAPI | ExtendedV1PoxStackerPrincipalGet | Get /extended/v1/{pox}/stacker/{principal} | Get events for a stacking address |
StackingAPI | ExtendedV1PoxTxTxIdGet | Get /extended/v1/{pox}/tx/{tx_id} | Get PoX events for a transaction |
StackingAPI | GetPoolDelegations | Get /extended/v1/{pox}/{pool_principal}/delegations | Stacking pool members |
StackingRewardsAPI | GetBurnchainRewardList | Get /extended/v1/burnchain/rewards | Get recent burnchain reward recipients |
StackingRewardsAPI | GetBurnchainRewardListByAddress | Get /extended/v1/burnchain/rewards/{address} | Get recent burnchain reward for the given recipient |
StackingRewardsAPI | GetBurnchainRewardSlotHolders | Get /extended/v1/burnchain/reward_slot_holders | Get recent reward slot holders |
StackingRewardsAPI | GetBurnchainRewardSlotHoldersByAddress | Get /extended/v1/burnchain/reward_slot_holders/{address} | Get recent reward slot holder entries for the given address |
StackingRewardsAPI | GetBurnchainRewardsTotalByAddress | Get /extended/v1/burnchain/rewards/{address}/total | Get total burnchain rewards for the given recipient |
TransactionsAPI | GetAddressMempoolTransactions | Get /extended/v1/address/{principal}/mempool | Transactions for address |
TransactionsAPI | GetAddressTransactionEvents | Get /extended/v2/addresses/{address}/transactions/{tx_id}/events | Get events for an address transaction |
TransactionsAPI | GetAddressTransactions | Get /extended/v2/addresses/{address}/transactions | Get address transactions |
TransactionsAPI | GetDroppedMempoolTransactionList | Get /extended/v1/tx/mempool/dropped | Get dropped mempool transactions |
TransactionsAPI | GetFilteredEvents | Get /extended/v1/tx/events | Transaction Events |
TransactionsAPI | GetMempoolTransactionList | Get /extended/v1/tx/mempool | Get mempool transactions |
TransactionsAPI | GetMempoolTransactionStats | Get /extended/v1/tx/mempool/stats | Get statistics for mempool transactions |
TransactionsAPI | GetRawTransactionById | Get /extended/v1/tx/{tx_id}/raw | Get raw transaction |
TransactionsAPI | GetTransactionById | Get /extended/v1/tx/{tx_id} | Get transaction |
TransactionsAPI | GetTransactionList | Get /extended/v1/tx/ | Get recent transactions |
TransactionsAPI | GetTransactionsByBlock | Get /extended/v2/blocks/{height_or_hash}/transactions | Get transactions by block |
TransactionsAPI | GetTransactionsByBlockHash | Get /extended/v1/tx/block/{block_hash} | Transactions by block hash |
TransactionsAPI | GetTransactionsByBlockHeight | Get /extended/v1/tx/block_height/{height} | Transactions by block height |
TransactionsAPI | GetTxListDetails | Get /extended/v1/tx/multiple | Get list of details for transactions |
Documentation For Models
- AddressAssetsListResponse
- AddressBalanceResponse
- AddressNonces
- AddressSearchResult
- AddressStxBalance
- AddressStxInboundListResponse
- AddressTokenOfferingLocked
- AddressTransaction
- AddressTransactionEvent
- AddressTransactionEventAnyOf
- AddressTransactionEventAnyOf1
- AddressTransactionEventAnyOf1Data
- AddressTransactionEventAnyOf2
- AddressTransactionEventAnyOf2Data
- AddressTransactionEventAnyOfData
- AddressTransactionEvents
- AddressTransactionEventsStx
- AddressTransactionWithTransfers
- AddressTransactionWithTransfersFtTransfersInner
- AddressTransactionWithTransfersNftTransfersInner
- AddressTransactionWithTransfersNftTransfersInnerValue
- AddressTransactionWithTransfersStxTransfersInner
- AddressTransactionsListResponse
- AddressTransactionsWithTransfersListResponse
- AddressUnlockSchedule
- ApiStatusResponse
- ApiStatusResponseChainTip
- Block
- BlockListResponse
- BlockSearchResult
- BlockSearchResultBlockData
- BnsError
- BnsError1
- BnsFetchFileZoneResponse
- BnsFetchHistoricalZoneFileResponse
- BnsGetNameInfoResponse
- BnsGetNamePriceResponse
- BnsGetNamespacePriceResponse
- BnsNamesOwnByAddressResponse
- BurnchainReward
- BurnchainRewardSlotHolder
- BurnchainRewardSlotHolderListResponse
- BurnchainRewardsTotal
- CoinbaseMempoolTransaction
- CoinbaseMempoolTransaction1
- CoinbaseTransaction
- CoinbaseTransaction1
- CoinbaseTransactionCoinbasePayload
- ContractCallMempoolTransaction
- ContractCallMempoolTransaction1
- ContractCallTransaction
- ContractCallTransaction1
- ContractCallTransactionContractCall
- ContractCallTransactionContractCallFunctionArgsInner
- ContractListResponse
- ContractSearchResult
- ContractSearchResultTxData
- ErrorResponse
- ExtendedV1PoxEventsGetPoxParameter
- FeeRate
- FeeRateRequest
- FtBalance
- FtHolderEntry
- FungibleTokenAssetTransactionEvent
- FungibleTokenAssetTransactionEvent1
- FungibleTokenAssetTransactionEvent1AllOfAsset
- FungibleTokenAssetTransactionEventAllOfAsset
- GetAddressTransactionEvents200Response
- GetAddressTransactions200Response
- GetAllNamespaces200Response
- GetAverageBlockTimes200Response
- GetBlockHeightOrHashParameter
- GetBlocks200Response
- GetBlocks200ResponseResultsInner
- GetBlocksByBurnBlock200Response
- GetBtcBalance200Response
- GetBurnBlockHeightOrHashParameter
- GetBurnBlocks200Response
- GetBurnBlocks200ResponseResultsInner
- GetBurnchainRewardList200Response
- GetContractEventsById200Response
- GetDroppedMempoolTransactionList200Response
- GetFilteredEventsAddressParameter
- GetFilteredEventsTypeParameterInner
- GetFtHolders200Response
- GetMempoolFeePriorities200Response
- GetMempoolFeePriorities200ResponseAll
- GetMempoolTransactionList200Response
- GetMempoolTransactionList200ResponseResultsInner
- GetNetworkBlockTimeByNetworkNetworkParameter
- GetNftHistory200Response
- GetNftHoldings200Response
- GetPoolDelegations200Response
- GetPoolDelegations200ResponseResultsInner
- GetPoxCycleSignerStackers200Response
- GetPoxCycleSignerStackers200ResponseResultsInner
- GetPoxCycleSignerStackers200ResponseResultsInnerStackerType
- GetPoxCycleSigners200Response
- GetPoxCycleSigners200ResponseResultsInner
- GetPoxCycles200Response
- GetPoxCycles200ResponseResultsInner
- GetRawTransactionResult
- GetSignerSignaturesForBlock200Response
- GetSmartContractsStatus200ResponseValue
- GetSmartContractsStatus200ResponseValueAnyOf
- GetSmartContractsStatus200ResponseValueAnyOf1
- GetSmartContractsStatus200ResponseValueAnyOfResult
- GetSmartContractsStatusContractIdParameter
- GetStxSupplyLegacyFormatResponse
- GetStxSupplyResponse
- GetStxSupplyTotalSupplyPlain200Response
- GetTransactionById200Response
- GetTransactionList200Response
- GetTransactionList200ResponseResultsInner
- GetTransactionListOrderParameter
- GetTransactionListSortByParameter
- GetTransactionListTypeParameterInner
- GetTransactionsByBlock200Response
- GetTxListDetails200ResponseValue
- GetUnanchoredTxs200Response
- InboundStxTransfer
- InboundStxTransferTransferType
- ListOfBurnchainRewardRecipientsAndAmounts
- ListOfEvents
- MempoolTransactionStatsResponse
- MempoolTransactionStatsResponseTxSimpleFeeAveragesValue
- MempoolTxSearchResult
- MempoolTxSearchResultTxData
- Microblock
- MicroblockListResponse
- NetworkBlockTimeResponse
- NetworkBlockTimesResponse
- NetworkBlockTimesResponseMainnet
- NftBalance
- NonFungibleTokenAssetTransactionEvent
- NonFungibleTokenAssetTransactionEvent1
- NonFungibleTokenAssetTransactionEvent1AllOfAsset
- NonFungibleTokenAssetTransactionEventAllOfAsset
- NonFungibleTokenHistoryEvent
- NonFungibleTokenHistoryEventWithTxId
- NonFungibleTokenHistoryEventWithTxMetadata
- NonFungibleTokenHoldingWithTxId
- NonFungibleTokenHoldingWithTxIdValue
- NonFungibleTokenHoldingWithTxMetadata
- NonFungibleTokenHoldingsList
- NonFungibleTokenMint
- NonFungibleTokenMintAnyOf
- NonFungibleTokenMintList
- NonFungibleTokenMintWithTxId
- Order
- OrderBy
- PoisonMicroblockMempoolTransaction
- PoisonMicroblockMempoolTransaction1
- PoisonMicroblockTransaction
- PoisonMicroblockTransaction1
- PoisonMicroblockTransactionPoisonMicroblock
- RunFaucetBtc4XXResponse
- RunFaucetBtcRequest
- RunFaucetResponse
- RunFaucetResponse1
- RunFaucetStx4XXResponse
- RunFaucetStxRequest
- SearchById200Response
- SearchById200ResponseResult
- SearchById404Response
- SearchById404ResponseResult
- SearchById404ResponseResultEntityType
- SmartContract
- SmartContractLogTransactionEvent
- SmartContractLogTransactionEvent1
- SmartContractLogTransactionEventAllOfContractLog
- SmartContractMempoolTransaction
- SmartContractMempoolTransaction1
- SmartContractTransaction
- SmartContractTransaction1
- SmartContractTransactionSmartContract
- StxAssetTransactionEvent
- StxAssetTransactionEvent1
- StxAssetTransactionEvent1AllOfAsset
- StxAssetTransactionEvent1AllOfAssetAssetEventType
- StxAssetTransactionEventAllOfAsset
- StxAssetTransactionEventAllOfAssetAssetEventType
- StxBalance
- StxLockTransactionEvent
- StxLockTransactionEvent1
- StxLockTransactionEventAllOfStxLockEvent
- TenureChangeMempoolTransaction
- TenureChangeMempoolTransaction1
- TenureChangeTransaction
- TenureChangeTransaction1
- TenureChangeTransaction1TenureChangePayload
- TenureChangeTransaction1TenureChangePayloadCause
- TenureChangeTransactionTenureChangePayload
- TenureChangeTransactionTenureChangePayloadCause
- TokenTransferMempoolTransaction
- TokenTransferMempoolTransaction1
- TokenTransferMempoolTransaction1TxStatus
- TokenTransferMempoolTransactionTxStatus
- TokenTransferTransaction
- TokenTransferTransaction1
- TokenTransferTransaction1AnchorMode
- TokenTransferTransaction1EventsInner
- TokenTransferTransaction1PostConditionMode
- TokenTransferTransaction1PostConditionsInner
- TokenTransferTransaction1PostConditionsInnerAnyOf
- TokenTransferTransaction1PostConditionsInnerAnyOf1
- TokenTransferTransaction1PostConditionsInnerAnyOf2
- TokenTransferTransaction1PostConditionsInnerAnyOfConditionCode
- TokenTransferTransaction1PostConditionsInnerAnyOfPrincipal
- TokenTransferTransaction1PostConditionsInnerAnyOfPrincipalAnyOf
- TokenTransferTransaction1PostConditionsInnerAnyOfPrincipalAnyOf1
- TokenTransferTransaction1PostConditionsInnerAnyOfPrincipalAnyOf2
- TokenTransferTransaction1TxStatus
- TokenTransferTransactionAnchorMode
- TokenTransferTransactionEventsInner
- TokenTransferTransactionPostConditionMode
- TokenTransferTransactionPostConditionsInner
- TokenTransferTransactionPostConditionsInnerAnyOf
- TokenTransferTransactionPostConditionsInnerAnyOf1
- TokenTransferTransactionPostConditionsInnerAnyOf1Asset
- TokenTransferTransactionPostConditionsInnerAnyOf2
- TokenTransferTransactionPostConditionsInnerAnyOf2AssetValue
- TokenTransferTransactionPostConditionsInnerAnyOf2ConditionCode
- TokenTransferTransactionPostConditionsInnerAnyOfConditionCode
- TokenTransferTransactionPostConditionsInnerAnyOfPrincipal
- TokenTransferTransactionPostConditionsInnerAnyOfPrincipalAnyOf
- TokenTransferTransactionPostConditionsInnerAnyOfPrincipalAnyOf1
- TokenTransferTransactionPostConditionsInnerAnyOfPrincipalAnyOf2
- TokenTransferTransactionTokenTransfer
- TokenTransferTransactionTxResult
- TokenTransferTransactionTxStatus
- TransactionFound
- TransactionFoundResult
- TransactionFoundResultAnyOf
- TransactionFoundResultAnyOf1
- TransactionNotFound
- TransactionNotFoundResult
- TxSearchResult
- TxSearchResultTxData
Documentation For Authorization
Endpoints do not require authorization.
Documentation for Utility Methods
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime