\MicroblocksAPI

July 14, 2024 ยท View on GitHub

MethodHTTP requestDescription
GetMicroblockByHashGet /extended/v1/microblock/{hash}Get microblock
GetMicroblockListGet /extended/v1/microblockGet recent microblocks
GetUnanchoredTxsGet /extended/v1/microblock/unanchored/txsGet the list of current transactions that belong to unanchored microblocks

GetMicroblockByHash

Microblock GetMicroblockByHash(ctx, hash).Execute()

Get microblock

Example

package main

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

func main() {
	hash := "0x3bfcdf84b3012adb544cf0f6df4835f93418c2269a3881885e27b3d58eb82d47" // string | Hash of the microblock

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

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
hashstringHash of the microblock

Other Parameters

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

NameTypeDescriptionNotes

Return type

Microblock

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]

GetMicroblockList

MicroblockListResponse GetMicroblockList(ctx).Limit(limit).Offset(offset).Execute()

Get recent microblocks

Example

package main

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

func main() {
	limit := int32(100) // int32 | Max number of microblocks to fetch (optional) (default to 20)
	offset := int32(42000) // int32 | Index of the first microblock to fetch (optional)

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

Path Parameters

Other Parameters

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

NameTypeDescriptionNotes
limitint32Max number of microblocks to fetch[default to 20]
offsetint32Index of the first microblock to fetch

Return type

MicroblockListResponse

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]

GetUnanchoredTxs

UnanchoredTransactionListResponse GetUnanchoredTxs(ctx).Execute()

Get the list of current transactions that belong to unanchored microblocks

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.MicroblocksAPI.GetUnanchoredTxs(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MicroblocksAPI.GetUnanchoredTxs``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetUnanchoredTxs`: UnanchoredTransactionListResponse
	fmt.Fprintf(os.Stdout, "Response from `MicroblocksAPI.GetUnanchoredTxs`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

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

Return type

UnanchoredTransactionListResponse

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]