# Packages

No description provided by the author

# 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

ClassMethodHTTP requestDescription
AccountsAPIGetAccountAssetsGet /extended/v1/address/{principal}/assetsGet account assets
AccountsAPIGetAccountBalanceGet /extended/v1/address/{principal}/balancesGet account balances
AccountsAPIGetAccountInboundGet /extended/v1/address/{principal}/stx_inboundGet inbound STX transfers
AccountsAPIGetAccountNoncesGet /extended/v1/address/{principal}/noncesGet the latest nonce used by an account
AccountsAPIGetAccountStxBalanceGet /extended/v1/address/{principal}/stxGet account STX balance
AccountsAPIGetAccountTransactionsGet /extended/v1/address/{principal}/transactionsGet account transactions
AccountsAPIGetAccountTransactionsWithTransfersGet /extended/v1/address/{principal}/transactions_with_transfersGet account transactions including STX transfers for each transaction.
AccountsAPIGetSingleTransactionWithTransfersGet /extended/v1/address/{principal}/{tx_id}/with_transfersGet account transaction information for specific transaction
BlocksAPIGetAverageBlockTimesGet /extended/v2/blocks/average-timesGet average block times
BlocksAPIGetBlockGet /extended/v2/blocks/{height_or_hash}Get block
BlocksAPIGetBlockByBurnBlockHashGet /extended/v1/block/by_burn_block_hash/{burn_block_hash}Get block by burnchain block hash
BlocksAPIGetBlockByBurnBlockHeightGet /extended/v1/block/by_burn_block_height/{burn_block_height}Get block by burnchain height
BlocksAPIGetBlockByHashGet /extended/v1/block/{hash}Get block by hash
BlocksAPIGetBlockByHeightGet /extended/v1/block/by_height/{height}Get block by height
BlocksAPIGetBlockListGet /extended/v1/block/Get recent blocks
BlocksAPIGetBlocksGet /extended/v2/blocks/Get blocks
BlocksAPIGetSignerSignaturesForBlockGet /extended/v2/blocks/{height_or_hash}/signer-signaturesGet signer signatures for block
BurnBlocksAPIGetBlocksByBurnBlockGet /extended/v2/burn-blocks/{height_or_hash}/blocksGet blocks by burn block
BurnBlocksAPIGetBurnBlockGet /extended/v2/burn-blocks/{height_or_hash}Get burn block
BurnBlocksAPIGetBurnBlocksGet /extended/v2/burn-blocks/Get burn blocks
FaucetsAPIGetBtcBalanceGet /extended/v1/faucets/btc/{address}Get BTC balance for address
FaucetsAPIRunFaucetBtcPost /extended/v1/faucets/btcAdd testnet BTC tokens to address
FaucetsAPIRunFaucetStxPost /extended/v1/faucets/stxGet STX testnet tokens
FeesAPIFetchFeeRatePost /extended/v1/fee_rate/Fetch fee rate
FungibleTokensAPIGetFtHoldersGet /extended/v1/tokens/ft/{token}/holdersFungible token holders
InfoAPIGetNetworkBlockTimeByNetworkGet /extended/v1/info/network_block_time/{network}Get a given network's target block time
InfoAPIGetNetworkBlockTimesGet /extended/v1/info/network_block_timesGet the network target block time
InfoAPIGetStatusGet /extendedAPI status
InfoAPIGetStxSupplyGet /extended/v1/stx_supply/Get total and unlocked STX supply
InfoAPIGetStxSupplyCirculatingPlainGet /extended/v1/stx_supply/circulating/plainGet circulating STX supply in plain text format
InfoAPIGetStxSupplyTotalSupplyPlainGet /extended/v1/stx_supply/total/plainGet total STX supply in plain text format
InfoAPIGetTotalStxSupplyLegacyFormatGet /extended/v1/stx_supply/legacy_formatGet total and unlocked STX supply (results formatted the same as the legacy 1.0 API)
MempoolAPIGetMempoolFeePrioritiesGet /extended/v2/mempool/feesGet mempool transaction fee priorities
MicroblocksAPIGetMicroblockByHashGet /extended/v1/microblock/{hash}Get microblock
MicroblocksAPIGetMicroblockListGet /extended/v1/microblock/Get recent microblocks
MicroblocksAPIGetUnanchoredTxsGet /extended/v1/microblock/unanchored/txsGet the list of current transactions that belong to unanchored microblocks
NamesAPIFetchSubdomainsListForNameGet /v1/names/{name}/subdomainsGet Name Subdomains
NamesAPIFetchZoneFileGet /v1/names/{name}/zonefileGet Zone File
NamesAPIGetAllNamesGet /v1/names/Get All Names
NamesAPIGetAllNamespacesGet /v1/namespaces/Get All Namespaces
NamesAPIGetHistoricalZoneFileGet /v1/names/{name}/zonefile/{zoneFileHash}Get Historical Zone File
NamesAPIGetNameInfoGet /v1/names/{name}Get Name Details
NamesAPIGetNamePriceGet /v2/prices/names/{name}Get Name Price
NamesAPIGetNamesOwnedByAddressGet /v1/addresses/{blockchain}/{address}Get Names Owned by Address
NamesAPIGetNamespaceNamesGet /v1/namespaces/{tld}/namesGet Namespace Names
NamesAPIGetNamespacePriceGet /v2/prices/namespaces/{tld}Get Namespace Price
NonFungibleTokensAPIGetNftHistoryGet /extended/v1/tokens/nft/historyNon-Fungible Token history
NonFungibleTokensAPIGetNftHoldingsGet /extended/v1/tokens/nft/holdingsNon-Fungible Token holdings
NonFungibleTokensAPIGetNftMintsGet /extended/v1/tokens/nft/mintsNon-Fungible Token mints
ProofOfTransferAPIGetPoxCycleGet /extended/v2/pox/cycles/{cycle_number}Get PoX cycle
ProofOfTransferAPIGetPoxCycleSignerGet /extended/v2/pox/cycles/{cycle_number}/signers/{signer_key}Get signer in PoX cycle
ProofOfTransferAPIGetPoxCycleSignerStackersGet /extended/v2/pox/cycles/{cycle_number}/signers/{signer_key}/stackersGet stackers for signer in PoX cycle
ProofOfTransferAPIGetPoxCycleSignersGet /extended/v2/pox/cycles/{cycle_number}/signersGet signers in PoX cycle
ProofOfTransferAPIGetPoxCyclesGet /extended/v2/pox/cyclesGet PoX cycles
SearchAPISearchByIdGet /extended/v1/search/{id}Search
SmartContractsAPIGetContractByIdGet /extended/v1/contract/{contract_id}Get contract info
SmartContractsAPIGetContractEventsByIdGet /extended/v1/contract/{contract_id}/eventsGet contract events
SmartContractsAPIGetContractsByTraitGet /extended/v1/contract/by_traitGet contracts by trait
SmartContractsAPIGetSmartContractsStatusGet /extended/v2/smart-contracts/statusGet smart contracts status
StackingAPIExtendedV1PoxEventsGetGet /extended/v1/{pox}/eventsGet latest PoX events
StackingAPIExtendedV1PoxStackerPrincipalGetGet /extended/v1/{pox}/stacker/{principal}Get events for a stacking address
StackingAPIExtendedV1PoxTxTxIdGetGet /extended/v1/{pox}/tx/{tx_id}Get PoX events for a transaction
StackingAPIGetPoolDelegationsGet /extended/v1/{pox}/{pool_principal}/delegationsStacking pool members
StackingRewardsAPIGetBurnchainRewardListGet /extended/v1/burnchain/rewardsGet recent burnchain reward recipients
StackingRewardsAPIGetBurnchainRewardListByAddressGet /extended/v1/burnchain/rewards/{address}Get recent burnchain reward for the given recipient
StackingRewardsAPIGetBurnchainRewardSlotHoldersGet /extended/v1/burnchain/reward_slot_holdersGet recent reward slot holders
StackingRewardsAPIGetBurnchainRewardSlotHoldersByAddressGet /extended/v1/burnchain/reward_slot_holders/{address}Get recent reward slot holder entries for the given address
StackingRewardsAPIGetBurnchainRewardsTotalByAddressGet /extended/v1/burnchain/rewards/{address}/totalGet total burnchain rewards for the given recipient
TransactionsAPIGetAddressMempoolTransactionsGet /extended/v1/address/{principal}/mempoolTransactions for address
TransactionsAPIGetAddressTransactionEventsGet /extended/v2/addresses/{address}/transactions/{tx_id}/eventsGet events for an address transaction
TransactionsAPIGetAddressTransactionsGet /extended/v2/addresses/{address}/transactionsGet address transactions
TransactionsAPIGetDroppedMempoolTransactionListGet /extended/v1/tx/mempool/droppedGet dropped mempool transactions
TransactionsAPIGetFilteredEventsGet /extended/v1/tx/eventsTransaction Events
TransactionsAPIGetMempoolTransactionListGet /extended/v1/tx/mempoolGet mempool transactions
TransactionsAPIGetMempoolTransactionStatsGet /extended/v1/tx/mempool/statsGet statistics for mempool transactions
TransactionsAPIGetRawTransactionByIdGet /extended/v1/tx/{tx_id}/rawGet raw transaction
TransactionsAPIGetTransactionByIdGet /extended/v1/tx/{tx_id}Get transaction
TransactionsAPIGetTransactionListGet /extended/v1/tx/Get recent transactions
TransactionsAPIGetTransactionsByBlockGet /extended/v2/blocks/{height_or_hash}/transactionsGet transactions by block
TransactionsAPIGetTransactionsByBlockHashGet /extended/v1/tx/block/{block_hash}Transactions by block hash
TransactionsAPIGetTransactionsByBlockHeightGet /extended/v1/tx/block_height/{height}Transactions by block height
TransactionsAPIGetTxListDetailsGet /extended/v1/tx/multipleGet list of details for transactions

Documentation For Models

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

Author