\TransactionsAPI

July 14, 2024 ยท View on GitHub

MethodHTTP requestDescription
GetAddressMempoolTransactionsGet /extended/v1/address/{address}/mempoolTransactions for address
GetAddressTransactionEventsGet /extended/v2/addresses/{address}/transactions/{tx_id}/eventsGet events for an address transaction
GetAddressTransactionsGet /extended/v2/addresses/{address}/transactionsGet address transactions
GetDroppedMempoolTransactionListGet /extended/v1/tx/mempool/droppedGet dropped mempool transactions
GetFilteredEventsGet /extended/v1/tx/eventsTransaction Events
GetMempoolTransactionListGet /extended/v1/tx/mempoolGet mempool transactions
GetMempoolTransactionStatsGet /extended/v1/tx/mempool/statsGet statistics for mempool transactions
GetRawTransactionByIdGet /extended/v1/tx/{tx_id}/rawGet Raw Transaction
GetTransactionByIdGet /extended/v1/tx/{tx_id}Get transaction
GetTransactionListGet /extended/v1/txGet recent transactions
GetTransactionsByBlockGet /extended/v2/blocks/{height_or_hash}/transactionsGet transactions by block
GetTransactionsByBlockHashGet /extended/v1/tx/block/{block_hash}Transactions by block hash
GetTransactionsByBlockHeightGet /extended/v1/tx/block_height/{height}Transactions by block height
GetTxListDetailsGet /extended/v1/tx/multipleGet list of details for transactions
PostCoreNodeTransactionsPost /v2/transactionsBroadcast raw transaction

GetAddressMempoolTransactions

MempoolTransactionListResponse GetAddressMempoolTransactions(ctx, address).Limit(limit).Offset(offset).Unanchored(unanchored).Execute()

Transactions for address

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {
	address := "SP197DVH8KTJGX4STM61QN0WJV8Y9QJWXV83ZGNR9" // string | Transactions for the address
	limit := int32(90) // int32 | max number of transactions to fetch (optional)
	offset := int32(42000) // int32 | index of first transaction to fetch (optional)
	unanchored := false // bool | Include transaction data from unanchored (i.e. unconfirmed) microblocks (optional) (default to false)

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.GetAddressMempoolTransactions(context.Background(), address).Limit(limit).Offset(offset).Unanchored(unanchored).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.GetAddressMempoolTransactions``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetAddressMempoolTransactions`: MempoolTransactionListResponse
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetAddressMempoolTransactions`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
addressstringTransactions for the address

Other Parameters

Other parameters are passed through a pointer to a apiGetAddressMempoolTransactionsRequest struct via the builder pattern

NameTypeDescriptionNotes

limit | int32 | max number of transactions to fetch | offset | int32 | index of first transaction to fetch | unanchored | bool | Include transaction data from unanchored (i.e. unconfirmed) microblocks | [default to false]

Return type

MempoolTransactionListResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetAddressTransactionEvents

AddressTransactionEventListResponse GetAddressTransactionEvents(ctx, address, txId).Limit(limit).Offset(offset).Execute()

Get events for an address transaction

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {
	address := "SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0" // string | STX address or Smart Contract ID
	txId := "0x0a411719e3bfde95f9e227a2d7f8fac3d6c646b1e6cc186db0e2838a2c6cd9c0" // string | Transaction ID
	limit := int32(20) // int32 | Number of events to fetch (optional)
	offset := int32(10) // int32 | Index of first event to fetch (optional)

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.GetAddressTransactionEvents(context.Background(), address, txId).Limit(limit).Offset(offset).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.GetAddressTransactionEvents``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetAddressTransactionEvents`: AddressTransactionEventListResponse
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetAddressTransactionEvents`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
addressstringSTX address or Smart Contract ID
txIdstringTransaction ID

Other Parameters

Other parameters are passed through a pointer to a apiGetAddressTransactionEventsRequest struct via the builder pattern

NameTypeDescriptionNotes

limit | int32 | Number of events to fetch | offset | int32 | Index of first event to fetch |

Return type

AddressTransactionEventListResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetAddressTransactions

AddressTransactionsV2ListResponse GetAddressTransactions(ctx, address).Limit(limit).Offset(offset).Execute()

Get address transactions

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {
	address := "SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0" // string | STX address or Smart Contract ID
	limit := int32(20) // int32 | Number of transactions to fetch (optional)
	offset := int32(10) // int32 | Index of first transaction to fetch (optional)

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.GetAddressTransactions(context.Background(), address).Limit(limit).Offset(offset).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.GetAddressTransactions``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetAddressTransactions`: AddressTransactionsV2ListResponse
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetAddressTransactions`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
addressstringSTX address or Smart Contract ID

Other Parameters

Other parameters are passed through a pointer to a apiGetAddressTransactionsRequest struct via the builder pattern

NameTypeDescriptionNotes

limit | int32 | Number of transactions to fetch | offset | int32 | Index of first transaction to fetch |

Return type

AddressTransactionsV2ListResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetDroppedMempoolTransactionList

MempoolTransactionListResponse GetDroppedMempoolTransactionList(ctx).Limit(limit).Offset(offset).Execute()

Get dropped mempool transactions

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {
	limit := int32(56) // int32 | max number of mempool transactions to fetch (optional) (default to 96)
	offset := int32(42000) // int32 | index of first mempool transaction to fetch (optional)

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.GetDroppedMempoolTransactionList(context.Background()).Limit(limit).Offset(offset).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.GetDroppedMempoolTransactionList``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetDroppedMempoolTransactionList`: MempoolTransactionListResponse
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetDroppedMempoolTransactionList`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGetDroppedMempoolTransactionListRequest struct via the builder pattern

NameTypeDescriptionNotes
limitint32max number of mempool transactions to fetch[default to 96]
offsetint32index of first mempool transaction to fetch

Return type

MempoolTransactionListResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetFilteredEvents

TransactionEventsResponse GetFilteredEvents(ctx).TxId(txId).Address(address).Limit(limit).Offset(offset).Type_(type_).Execute()

Transaction Events

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {
	txId := "0x29e25515652dad41ef675bd0670964e3d537b80ec19cf6ca6f1dd65d5bc642c5" // string | Hash of transaction (optional)
	address := "ST1HB64MAJ1MBV4CQ80GF01DZS4T1DSMX20ADCRA4" // string | Stacks address or a Contract identifier (optional)
	limit := int32(100) // int32 | number of items to return (optional)
	offset := int32(42000) // int32 | number of items to skip (optional)
	type_ := []string{"Type_example"} // []string | Filter the events on event type (optional)

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.GetFilteredEvents(context.Background()).TxId(txId).Address(address).Limit(limit).Offset(offset).Type_(type_).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.GetFilteredEvents``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetFilteredEvents`: TransactionEventsResponse
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetFilteredEvents`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGetFilteredEventsRequest struct via the builder pattern

NameTypeDescriptionNotes
txIdstringHash of transaction
addressstringStacks address or a Contract identifier
limitint32number of items to return
offsetint32number of items to skip
type_[]stringFilter the events on event type

Return type

TransactionEventsResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetMempoolTransactionList

MempoolTransactionListResponse GetMempoolTransactionList(ctx).SenderAddress(senderAddress).RecipientAddress(recipientAddress).Address(address).OrderBy(orderBy).Order(order).Limit(limit).Offset(offset).Unanchored(unanchored).Execute()

Get mempool transactions

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {
	senderAddress := "SP1GPBP8NBRXDRJBFQBV7KMAZX1Z7W2RFWJEH0V10" // string | Filter to only return transactions with this sender address. (optional)
	recipientAddress := "recipientAddress_example" // string | Filter to only return transactions with this recipient address (only applicable for STX transfer tx types). (optional)
	address := "address_example" // string | Filter to only return transactions with this address as the sender or recipient (recipient only applicable for STX transfer tx types). (optional)
	orderBy := "fee" // string | Option to sort results by transaction age, size, or fee rate. (optional)
	order := "asc" // string | Option to sort results in ascending or descending order. (optional)
	limit := int32(20) // int32 | max number of mempool transactions to fetch (optional) (default to 20)
	offset := int32(42000) // int32 | index of first mempool transaction to fetch (optional)
	unanchored := false // bool | Include transaction data from unanchored (i.e. unconfirmed) microblocks (optional) (default to false)

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.GetMempoolTransactionList(context.Background()).SenderAddress(senderAddress).RecipientAddress(recipientAddress).Address(address).OrderBy(orderBy).Order(order).Limit(limit).Offset(offset).Unanchored(unanchored).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.GetMempoolTransactionList``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetMempoolTransactionList`: MempoolTransactionListResponse
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetMempoolTransactionList`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGetMempoolTransactionListRequest struct via the builder pattern

NameTypeDescriptionNotes
senderAddressstringFilter to only return transactions with this sender address.
recipientAddressstringFilter to only return transactions with this recipient address (only applicable for STX transfer tx types).
addressstringFilter to only return transactions with this address as the sender or recipient (recipient only applicable for STX transfer tx types).
orderBystringOption to sort results by transaction age, size, or fee rate.
orderstringOption to sort results in ascending or descending order.
limitint32max number of mempool transactions to fetch[default to 20]
offsetint32index of first mempool transaction to fetch
unanchoredboolInclude transaction data from unanchored (i.e. unconfirmed) microblocks[default to false]

Return type

MempoolTransactionListResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetMempoolTransactionStats

MempoolTransactionStatsResponse GetMempoolTransactionStats(ctx).Execute()

Get statistics for mempool transactions

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.GetMempoolTransactionStats(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.GetMempoolTransactionStats``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetMempoolTransactionStats`: MempoolTransactionStatsResponse
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetMempoolTransactionStats`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetMempoolTransactionStatsRequest struct via the builder pattern

Return type

MempoolTransactionStatsResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetRawTransactionById

GetRawTransactionResult GetRawTransactionById(ctx, txId).Execute()

Get Raw Transaction

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {
	txId := "0x0a411719e3bfde95f9e227a2d7f8fac3d6c646b1e6cc186db0e2838a2c6cd9c0" // string | Hash of transaction

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.GetRawTransactionById(context.Background(), txId).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.GetRawTransactionById``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetRawTransactionById`: GetRawTransactionResult
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetRawTransactionById`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
txIdstringHash of transaction

Other Parameters

Other parameters are passed through a pointer to a apiGetRawTransactionByIdRequest struct via the builder pattern

NameTypeDescriptionNotes

Return type

GetRawTransactionResult

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetTransactionById

Transaction GetTransactionById(ctx, txId).EventOffset(eventOffset).EventLimit(eventLimit).Unanchored(unanchored).Execute()

Get transaction

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {
	txId := "0x0a411719e3bfde95f9e227a2d7f8fac3d6c646b1e6cc186db0e2838a2c6cd9c0" // string | Hash of transaction
	eventOffset := int32(56) // int32 | The number of events to skip (optional) (default to 0)
	eventLimit := int32(56) // int32 | The numbers of events to return (optional) (default to 96)
	unanchored := false // bool | Include transaction data from unanchored (i.e. unconfirmed) microblocks (optional) (default to false)

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.GetTransactionById(context.Background(), txId).EventOffset(eventOffset).EventLimit(eventLimit).Unanchored(unanchored).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.GetTransactionById``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetTransactionById`: Transaction
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetTransactionById`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
txIdstringHash of transaction

Other Parameters

Other parameters are passed through a pointer to a apiGetTransactionByIdRequest struct via the builder pattern

NameTypeDescriptionNotes

eventOffset | int32 | The number of events to skip | [default to 0] eventLimit | int32 | The numbers of events to return | [default to 96] unanchored | bool | Include transaction data from unanchored (i.e. unconfirmed) microblocks | [default to false]

Return type

Transaction

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetTransactionList

TransactionResults GetTransactionList(ctx).Limit(limit).Offset(offset).Type_(type_).FromAddress(fromAddress).ToAddress(toAddress).SortBy(sortBy).StartTime(startTime).EndTime(endTime).ContractId(contractId).FunctionName(functionName).Nonce(nonce).Order(order).Unanchored(unanchored).Execute()

Get recent transactions

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {
	limit := int32(100) // int32 | max number of transactions to fetch (optional) (default to 96)
	offset := int32(42000) // int32 | index of first transaction to fetch (optional)
	type_ := []string{"Type_example"} // []string | Filter by transaction type (optional)
	fromAddress := "fromAddress_example" // string | Option to filter results by sender address (optional)
	toAddress := "toAddress_example" // string | Option to filter results by recipient address (optional)
	sortBy := "burn_block_time" // string | Option to sort results by block height, timestamp, or fee (optional) (default to "block_height")
	startTime := int32(1704067200) // int32 | Filter by transactions after this timestamp (unix timestamp in seconds) (optional)
	endTime := int32(1706745599) // int32 | Filter by transactions before this timestamp (unix timestamp in seconds) (optional)
	contractId := "SP000000000000000000002Q6VF78.pox-4" // string | Filter by contract call transactions involving this contract ID (optional)
	functionName := "delegate-stx" // string | Filter by contract call transactions involving this function name (optional)
	nonce := int32(123) // int32 | Filter by transactions with this nonce (optional)
	order := "desc" // string | Option to sort results in ascending or descending order (optional) (default to "desc")
	unanchored := false // bool | Include transaction data from unanchored (i.e. unconfirmed) microblocks (optional) (default to false)

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.GetTransactionList(context.Background()).Limit(limit).Offset(offset).Type_(type_).FromAddress(fromAddress).ToAddress(toAddress).SortBy(sortBy).StartTime(startTime).EndTime(endTime).ContractId(contractId).FunctionName(functionName).Nonce(nonce).Order(order).Unanchored(unanchored).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.GetTransactionList``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetTransactionList`: TransactionResults
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetTransactionList`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGetTransactionListRequest struct via the builder pattern

NameTypeDescriptionNotes
limitint32max number of transactions to fetch[default to 96]
offsetint32index of first transaction to fetch
type_[]stringFilter by transaction type
fromAddressstringOption to filter results by sender address
toAddressstringOption to filter results by recipient address
sortBystringOption to sort results by block height, timestamp, or fee[default to "block_height"]
startTimeint32Filter by transactions after this timestamp (unix timestamp in seconds)
endTimeint32Filter by transactions before this timestamp (unix timestamp in seconds)
contractIdstringFilter by contract call transactions involving this contract ID
functionNamestringFilter by contract call transactions involving this function name
nonceint32Filter by transactions with this nonce
orderstringOption to sort results in ascending or descending order[default to "desc"]
unanchoredboolInclude transaction data from unanchored (i.e. unconfirmed) microblocks[default to false]

Return type

TransactionResults

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetTransactionsByBlock

TransactionResults GetTransactionsByBlock(ctx, heightOrHash).Execute()

Get transactions by block

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {
	heightOrHash := openapiclient.get_burn_block_height_or_hash_parameter{Int32: new(int32)} // GetBurnBlockHeightOrHashParameter | filter by block height, hash, index block hash or the constant `latest` to filter for the most recent block

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.GetTransactionsByBlock(context.Background(), heightOrHash).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.GetTransactionsByBlock``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetTransactionsByBlock`: TransactionResults
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetTransactionsByBlock`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
heightOrHashGetBurnBlockHeightOrHashParameterfilter by block height, hash, index block hash or the constant `latest` to filter for the most recent block

Other Parameters

Other parameters are passed through a pointer to a apiGetTransactionsByBlockRequest struct via the builder pattern

NameTypeDescriptionNotes

Return type

TransactionResults

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetTransactionsByBlockHash

TransactionResults GetTransactionsByBlockHash(ctx, blockHash).Limit(limit).Offset(offset).Execute()

Transactions by block hash

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {
	blockHash := "0x0a83d82a65460a9e711f85a44616350280040b75317dbe486a923c1131b5ff99" // string | Hash of block
	limit := int32(10) // int32 | max number of transactions to fetch (optional)
	offset := int32(42000) // int32 | index of first transaction to fetch (optional)

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.GetTransactionsByBlockHash(context.Background(), blockHash).Limit(limit).Offset(offset).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.GetTransactionsByBlockHash``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetTransactionsByBlockHash`: TransactionResults
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetTransactionsByBlockHash`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
blockHashstringHash of block

Other Parameters

Other parameters are passed through a pointer to a apiGetTransactionsByBlockHashRequest struct via the builder pattern

NameTypeDescriptionNotes

limit | int32 | max number of transactions to fetch | offset | int32 | index of first transaction to fetch |

Return type

TransactionResults

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetTransactionsByBlockHeight

TransactionResults GetTransactionsByBlockHeight(ctx, height).Limit(limit).Offset(offset).Unanchored(unanchored).Execute()

Transactions by block height

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {
	height := int32(66119) // int32 | Height of block
	limit := int32(10) // int32 | max number of transactions to fetch (optional)
	offset := int32(42000) // int32 | index of first transaction to fetch (optional)
	unanchored := false // bool | Include transaction data from unanchored (i.e. unconfirmed) microblocks (optional) (default to false)

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.GetTransactionsByBlockHeight(context.Background(), height).Limit(limit).Offset(offset).Unanchored(unanchored).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.GetTransactionsByBlockHeight``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetTransactionsByBlockHeight`: TransactionResults
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetTransactionsByBlockHeight`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
heightint32Height of block

Other Parameters

Other parameters are passed through a pointer to a apiGetTransactionsByBlockHeightRequest struct via the builder pattern

NameTypeDescriptionNotes

limit | int32 | max number of transactions to fetch | offset | int32 | index of first transaction to fetch | unanchored | bool | Include transaction data from unanchored (i.e. unconfirmed) microblocks | [default to false]

Return type

TransactionResults

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetTxListDetails

map[string]TransactionList GetTxListDetails(ctx).TxId(txId).EventOffset(eventOffset).EventLimit(eventLimit).Unanchored(unanchored).Execute()

Get list of details for transactions

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {
	txId := []string{"Inner_example"} // []string | Array of transaction ids
	eventOffset := int32(56) // int32 | The number of events to skip (optional) (default to 0)
	eventLimit := int32(56) // int32 | The numbers of events to return (optional) (default to 96)
	unanchored := false // bool | Include transaction data from unanchored (i.e. unconfirmed) microblocks (optional) (default to false)

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.GetTxListDetails(context.Background()).TxId(txId).EventOffset(eventOffset).EventLimit(eventLimit).Unanchored(unanchored).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.GetTxListDetails``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetTxListDetails`: map[string]TransactionList
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetTxListDetails`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGetTxListDetailsRequest struct via the builder pattern

NameTypeDescriptionNotes
txId[]stringArray of transaction ids
eventOffsetint32The number of events to skip[default to 0]
eventLimitint32The numbers of events to return[default to 96]
unanchoredboolInclude transaction data from unanchored (i.e. unconfirmed) microblocks[default to false]

Return type

map[string]TransactionList

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostCoreNodeTransactions

string PostCoreNodeTransactions(ctx).Body(body).Execute()

Broadcast raw transaction

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cbadawi/go-stacks"
)

func main() {
	body := os.NewFile(1234, "some_file") // *os.File |  (optional)

	configuration :=config.NewConfiguration()
	apiClient := NewAPIClient(configuration)
	resp, r, err := apiClient.TransactionsAPI.PostCoreNodeTransactions(context.Background()).Body(body).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TransactionsAPI.PostCoreNodeTransactions``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `PostCoreNodeTransactions`: string
	fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.PostCoreNodeTransactions`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiPostCoreNodeTransactionsRequest struct via the builder pattern

NameTypeDescriptionNotes
body*os.File

Return type

string

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/octet-stream
  • Accept: text/plain, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]