\MicroblocksAPI
July 14, 2024 ยท View on GitHub
| Method | HTTP request | Description |
|---|---|---|
| GetMicroblockByHash | Get /extended/v1/microblock/{hash} | Get microblock |
| GetMicroblockList | Get /extended/v1/microblock | Get recent microblocks |
| GetUnanchoredTxs | Get /extended/v1/microblock/unanchored/txs | Get 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
| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| hash | string | Hash of the microblock |
Other Parameters
Other parameters are passed through a pointer to a apiGetMicroblockByHashRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
Return type
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
| Name | Type | Description | Notes |
|---|---|---|---|
| limit | int32 | Max number of microblocks to fetch | [default to 20] |
| offset | int32 | Index of the first microblock to fetch |
Return type
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]