maestrobitcoingosdk

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

Maestro Bitcoin Go API Library

Go Reference

The Maestro Bitcoin Go library provides convenient access to the Maestro REST API from applications written in Go. The full API of this library can be found in api.md.

Installation

import (
	"github.com/maestro-org/maestro-bitcoin-go-sdk" // imported as maestrobitcoingosdk
)

Or to pin the version:

go get -u 'github.com/maestro-org/maestro-bitcoin-go-sdk@v0.1.0-alpha.5'

Requirements

This library requires Go 1.18+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/maestro-org/maestro-bitcoin-go-sdk"
	"github.com/maestro-org/maestro-bitcoin-go-sdk/option"
)

func main() {
	client := maestrobitcoingosdk.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("API_KEY")
		option.WithEnvironmentMainnet(), // or option.WithEnvironmentTestnet() | option.WithEnvironmentDefault(); defaults to option.WithEnvironmentTestnet()
	)
	paginatedUtxo, err := client.Addresses.Utxos.List(
		context.TODO(),
		"REPLACE_ME",
		maestrobitcoingosdk.AddressUtxoListParams{},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", paginatedUtxo.Data)
}

Request fields

All request parameters are wrapped in a generic Field type, which we use to distinguish zero values from null or omitted fields.

This prevents accidentally sending a zero value if you forget a required parameter, and enables explicitly sending null, false, '', or 0 on optional parameters. Any field not specified is not sent.

To construct fields with values, use the helpers String(), Int(), Float(), or most commonly, the generic F[T](). To send a null, use Null[T](), and to send a nonconforming value, use Raw[T](any). For example:

params := FooParams{
	Name: maestrobitcoingosdk.F("hello"),

	// Explicitly send `"description": null`
	Description: maestrobitcoingosdk.Null[string](),

	Point: maestrobitcoingosdk.F(maestrobitcoingosdk.Point{
		X: maestrobitcoingosdk.Int(0),
		Y: maestrobitcoingosdk.Int(1),

		// In cases where the API specifies a given type,
		// but you want to send something else, use `Raw`:
		Z: maestrobitcoingosdk.Raw[int64](0.01), // sends a float
	}),
}
Response objects

All fields in response structs are value types (not pointers or wrappers).

If a given field is null, not present, or invalid, the corresponding field will simply be its zero value.

All response structs also include a special JSON field, containing more detailed information about each property, which you can use like so:

if res.Name == "" {
	// true if `"name"` is either not present or explicitly null
	res.JSON.Name.IsNull()

	// true if the `"name"` key was not present in the repsonse JSON at all
	res.JSON.Name.IsMissing()

	// When the API returns data that cannot be coerced to the expected type:
	if res.JSON.Name.IsInvalid() {
		raw := res.JSON.Name.Raw()

		legacyName := struct{
			First string `json:"first"`
			Last  string `json:"last"`
		}{}
		json.Unmarshal([]byte(raw), &legacyName)
		name = legacyName.First + " " + legacyName.Last
	}
}

These .JSON structs also include an Extras map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := maestrobitcoingosdk.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Addresses.Utxos.List(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

Errors

When the API returns a non-success status code, we return an error with type *maestrobitcoingosdk.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Addresses.Utxos.List(
	context.TODO(),
	"REPLACE_ME",
	maestrobitcoingosdk.AddressUtxoListParams{},
)
if err != nil {
	var apierr *maestrobitcoingosdk.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/addresses/{address}/utxos": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Addresses.Utxos.List(
	ctx,
	"REPLACE_ME",
	maestrobitcoingosdk.AddressUtxoListParams{},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as param.Field[io.Reader]. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper maestrobitcoingosdk.FileParam(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := maestrobitcoingosdk.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Addresses.Utxos.List(
	context.TODO(),
	"REPLACE_ME",
	maestrobitcoingosdk.AddressUtxoListParams{},
	option.WithMaxRetries(5),
)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]interface{}

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   maestrobitcoingosdk.F("id_xxxx"),
    Data: maestrobitcoingosdk.F(FooNewParamsData{
        FirstName: maestrobitcoingosdk.F("John"),
    }),
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := maestrobitcoingosdk.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals).
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(value bool) param.Field[bool]

Bool is a param field helper which helps specify bools.

func F

func F[T any](value T) param.Field[T]

F is a param field helper used to initialize a param.Field generic struct. This helps specify null, zero values, and overrides, as well as normal values. You can read more about this in our README.

func FileParam

func FileParam(reader io.Reader, filename string, contentType string) param.Field[io.Reader]

FileParam is a param field helper which helps files with a mime content-type.

func Float

func Float(value float64) param.Field[float64]

Float is a param field helper which helps specify floats.

func Int

func Int(value int64) param.Field[int64]

Int is a param field helper which helps specify integers. This is particularly helpful when specifying integer constants for fields.

func Null

func Null[T any]() param.Field[T]

Null is a param field helper which explicitly sends null to the API.

func Raw

func Raw[T any](value any) param.Field[T]

Raw is a param field helper for specifying values for fields when the type you are looking to send is different from the type that is specified in the SDK. For example, if the type of the field is an integer, but you want to send a float, you could do that by setting the corresponding field with Raw[int](0.5).

func String

func String(value string) param.Field[string]

String is a param field helper which helps specify strings.

Types

type AddressBrc20Service

type AddressBrc20Service struct {
	Options []option.RequestOption
}

AddressBrc20Service contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAddressBrc20Service method instead.

func NewAddressBrc20Service

func NewAddressBrc20Service(opts ...option.RequestOption) (r *AddressBrc20Service)

NewAddressBrc20Service generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AddressBrc20Service) List

Map of all BRC20 assets and corresponding total and available balances controlled by the specified address or script pubkey.

type AddressRuneGetParams

type AddressRuneGetParams struct {
	// The max number of results per page
	Count param.Field[int64] `query:"count"`
	// Pagination cursor string, use the cursor included in a page of results to fetch
	// the next page
	Cursor param.Field[string] `query:"cursor"`
	// Return only UTxOs created on or after a specific height
	From param.Field[int64] `query:"from"`
	// The order in which the results are sorted (by height at which UTxO was produced)
	Order param.Field[AddressRuneGetParamsOrder] `query:"order"`
	// Return only UTxOs created on or before a specific height
	To param.Field[int64] `query:"to"`
}

func (AddressRuneGetParams) URLQuery

func (r AddressRuneGetParams) URLQuery() (v url.Values)

URLQuery serializes AddressRuneGetParams's query parameters as `url.Values`.

type AddressRuneGetParamsOrder

type AddressRuneGetParamsOrder string

The order in which the results are sorted (by height at which UTxO was produced)

const (
	AddressRuneGetParamsOrderAsc  AddressRuneGetParamsOrder = "asc"
	AddressRuneGetParamsOrderDesc AddressRuneGetParamsOrder = "desc"
)

func (AddressRuneGetParamsOrder) IsKnown

func (r AddressRuneGetParamsOrder) IsKnown() bool

type AddressRuneService

type AddressRuneService struct {
	Options []option.RequestOption
}

AddressRuneService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAddressRuneService method instead.

func NewAddressRuneService

func NewAddressRuneService(opts ...option.RequestOption) (r *AddressRuneService)

NewAddressRuneService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AddressRuneService) Get

Return all UTxOs controlled by the specified address or script pubkey which contain some of a specific kind of rune.

func (*AddressRuneService) List

func (r *AddressRuneService) List(ctx context.Context, address string, opts ...option.RequestOption) (res *TimestampedRuneQuantities, err error)

Map of all Runes tokens and corresponding amounts in UTxOs controlled by the specified address or script pubkey.

type AddressService

type AddressService struct {
	Options []option.RequestOption
	Brc20   *AddressBrc20Service
	Runes   *AddressRuneService
	Txs     *AddressTxService
	Utxos   *AddressUtxoService
}

AddressService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAddressService method instead.

func NewAddressService

func NewAddressService(opts ...option.RequestOption) (r *AddressService)

NewAddressService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type AddressTxListParams

type AddressTxListParams struct {
	// The max number of results per page
	Count param.Field[int64] `query:"count"`
	// Pagination cursor string, use the cursor included in a page of results to fetch
	// the next page
	Cursor param.Field[string] `query:"cursor"`
	// Return only transactions included on or after a specific height
	From param.Field[int64] `query:"from"`
	// The order in which the results are sorted (by height at which transaction was
	// included in a block)
	Order param.Field[AddressTxListParamsOrder] `query:"order"`
	// Return only transactions included on or before a specific height
	To param.Field[int64] `query:"to"`
}

func (AddressTxListParams) URLQuery

func (r AddressTxListParams) URLQuery() (v url.Values)

URLQuery serializes AddressTxListParams's query parameters as `url.Values`.

type AddressTxListParamsOrder

type AddressTxListParamsOrder string

The order in which the results are sorted (by height at which transaction was included in a block)

const (
	AddressTxListParamsOrderAsc  AddressTxListParamsOrder = "asc"
	AddressTxListParamsOrderDesc AddressTxListParamsOrder = "desc"
)

func (AddressTxListParamsOrder) IsKnown

func (r AddressTxListParamsOrder) IsKnown() bool

type AddressTxService

type AddressTxService struct {
	Options []option.RequestOption
}

AddressTxService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAddressTxService method instead.

func NewAddressTxService

func NewAddressTxService(opts ...option.RequestOption) (r *AddressTxService)

NewAddressTxService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AddressTxService) List

List of all transactions which consumed or produced a UTxO controlled by the specified address or script pubkey.

type AddressUtxoListParams

type AddressUtxoListParams struct {
	// The max number of results per page
	Count param.Field[int64] `query:"count"`
	// Pagination cursor string, use the cursor included in a page of results to fetch
	// the next page
	Cursor param.Field[string] `query:"cursor"`
	// Exclude UTxOs involved in metaprotocols (currently only runes and inscriptions
	// will be discovered, more metaprotocols may be supported in future)
	ExcludeMetaprotocols param.Field[bool] `query:"exclude_metaprotocols"`
	// Ignore UTxOs containing less than 100000 sats
	FilterDust param.Field[bool] `query:"filter_dust"`
	// Ignore UTxOs containing less than specified satoshis
	FilterDustThreshold param.Field[int64] `query:"filter_dust_threshold"`
	// Return only UTxOs created on or after a specific height
	From param.Field[int64] `query:"from"`
	// The order in which the results are sorted (by height at which UTxO was produced)
	Order param.Field[AddressUtxoListParamsOrder] `query:"order"`
	// Return only UTxOs created on or before a specific height
	To param.Field[int64] `query:"to"`
}

func (AddressUtxoListParams) URLQuery

func (r AddressUtxoListParams) URLQuery() (v url.Values)

URLQuery serializes AddressUtxoListParams's query parameters as `url.Values`.

type AddressUtxoListParamsOrder

type AddressUtxoListParamsOrder string

The order in which the results are sorted (by height at which UTxO was produced)

const (
	AddressUtxoListParamsOrderAsc  AddressUtxoListParamsOrder = "asc"
	AddressUtxoListParamsOrderDesc AddressUtxoListParamsOrder = "desc"
)

func (AddressUtxoListParamsOrder) IsKnown

func (r AddressUtxoListParamsOrder) IsKnown() bool

type AddressUtxoService

type AddressUtxoService struct {
	Options []option.RequestOption
}

AddressUtxoService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAddressUtxoService method instead.

func NewAddressUtxoService

func NewAddressUtxoService(opts ...option.RequestOption) (r *AddressUtxoService)

NewAddressUtxoService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AddressUtxoService) List

func (r *AddressUtxoService) List(ctx context.Context, address string, query AddressUtxoListParams, opts ...option.RequestOption) (res *PaginatedUtxo, err error)

List of all UTxOs which reside at the specified address or script pubkey.

type AssetBrc20HolderListParams

type AssetBrc20HolderListParams struct {
	// The max number of results per page
	Count param.Field[int64] `query:"count"`
	// Pagination cursor string, use the cursor included in a page of results to fetch
	// the next page
	Cursor param.Field[string] `query:"cursor"`
}

func (AssetBrc20HolderListParams) URLQuery

func (r AssetBrc20HolderListParams) URLQuery() (v url.Values)

URLQuery serializes AssetBrc20HolderListParams's query parameters as `url.Values`.

type AssetBrc20HolderService

type AssetBrc20HolderService struct {
	Options []option.RequestOption
}

AssetBrc20HolderService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAssetBrc20HolderService method instead.

func NewAssetBrc20HolderService

func NewAssetBrc20HolderService(opts ...option.RequestOption) (r *AssetBrc20HolderService)

NewAssetBrc20HolderService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AssetBrc20HolderService) List

Script pubkeys or addresses that hold the specified BRC20 asset and corresponding total balances.

type AssetBrc20ListParams

type AssetBrc20ListParams struct {
	// The max number of results per page
	Count param.Field[int64] `query:"count"`
	// Pagination cursor string, use the cursor included in a page of results to fetch
	// the next page
	Cursor param.Field[string] `query:"cursor"`
}

func (AssetBrc20ListParams) URLQuery

func (r AssetBrc20ListParams) URLQuery() (v url.Values)

URLQuery serializes AssetBrc20ListParams's query parameters as `url.Values`.

type AssetBrc20Service

type AssetBrc20Service struct {
	Options []option.RequestOption
	Holders *AssetBrc20HolderService
}

AssetBrc20Service contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAssetBrc20Service method instead.

func NewAssetBrc20Service

func NewAssetBrc20Service(opts ...option.RequestOption) (r *AssetBrc20Service)

NewAssetBrc20Service generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AssetBrc20Service) Get

func (r *AssetBrc20Service) Get(ctx context.Context, ticker string, opts ...option.RequestOption) (res *TimestampedBrc20Info, err error)

Information about the specified BRC20 asset.

func (*AssetBrc20Service) List

List of tickers of all deployed BRC20 assets.

type AssetRuneHolderListParams

type AssetRuneHolderListParams struct {
	// The max number of results per page
	Count param.Field[int64] `query:"count"`
	// Pagination cursor string, use the cursor included in a page of results to fetch
	// the next page
	Cursor param.Field[string] `query:"cursor"`
}

func (AssetRuneHolderListParams) URLQuery

func (r AssetRuneHolderListParams) URLQuery() (v url.Values)

URLQuery serializes AssetRuneHolderListParams's query parameters as `url.Values`.

type AssetRuneHolderService

type AssetRuneHolderService struct {
	Options []option.RequestOption
}

AssetRuneHolderService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAssetRuneHolderService method instead.

func NewAssetRuneHolderService

func NewAssetRuneHolderService(opts ...option.RequestOption) (r *AssetRuneHolderService)

NewAssetRuneHolderService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AssetRuneHolderService) List

List of all addresses that hold the specified Rune, together with the respective amount of that rune.

type AssetRuneListParams

type AssetRuneListParams struct {
	// The max number of results per page
	Count param.Field[int64] `query:"count"`
	// Pagination cursor string, use the cursor included in a page of results to fetch
	// the next page
	Cursor param.Field[string] `query:"cursor"`
}

func (AssetRuneListParams) URLQuery

func (r AssetRuneListParams) URLQuery() (v url.Values)

URLQuery serializes AssetRuneListParams's query parameters as `url.Values`.

type AssetRuneService

type AssetRuneService struct {
	Options []option.RequestOption
	Holders *AssetRuneHolderService
	Utxos   *AssetRuneUtxoService
}

AssetRuneService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAssetRuneService method instead.

func NewAssetRuneService

func NewAssetRuneService(opts ...option.RequestOption) (r *AssetRuneService)

NewAssetRuneService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AssetRuneService) Get

func (r *AssetRuneService) Get(ctx context.Context, rune string, opts ...option.RequestOption) (res *TimestampedRuneInfo, err error)

Information about the specified Rune, including etching, current supply and number of holders.

func (*AssetRuneService) List

List of ID and names of all deployed Rune assets.

type AssetRuneUtxoListParams

type AssetRuneUtxoListParams struct {
	// The max number of results per page
	Count param.Field[int64] `query:"count"`
	// Pagination cursor string, use the cursor included in a page of results to fetch
	// the next page
	Cursor param.Field[string] `query:"cursor"`
	// Return only UTxOs created on or after a specific height
	From param.Field[int64] `query:"from"`
	// The order in which the results are sorted (by height at which UTxO was produced)
	Order param.Field[AssetRuneUtxoListParamsOrder] `query:"order"`
	// Return only UTxOs created on or before a specific height
	To param.Field[int64] `query:"to"`
}

func (AssetRuneUtxoListParams) URLQuery

func (r AssetRuneUtxoListParams) URLQuery() (v url.Values)

URLQuery serializes AssetRuneUtxoListParams's query parameters as `url.Values`.

type AssetRuneUtxoListParamsOrder

type AssetRuneUtxoListParamsOrder string

The order in which the results are sorted (by height at which UTxO was produced)

const (
	AssetRuneUtxoListParamsOrderAsc  AssetRuneUtxoListParamsOrder = "asc"
	AssetRuneUtxoListParamsOrderDesc AssetRuneUtxoListParamsOrder = "desc"
)

func (AssetRuneUtxoListParamsOrder) IsKnown

func (r AssetRuneUtxoListParamsOrder) IsKnown() bool

type AssetRuneUtxoService

type AssetRuneUtxoService struct {
	Options []option.RequestOption
}

AssetRuneUtxoService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAssetRuneUtxoService method instead.

func NewAssetRuneUtxoService

func NewAssetRuneUtxoService(opts ...option.RequestOption) (r *AssetRuneUtxoService)

NewAssetRuneUtxoService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AssetRuneUtxoService) List

List of all UTxOs which contain the specified Rune.

type AssetService

type AssetService struct {
	Options []option.RequestOption
	Brc20   *AssetBrc20Service
	Runes   *AssetRuneService
}

AssetService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAssetService method instead.

func NewAssetService

func NewAssetService(opts ...option.RequestOption) (r *AssetService)

NewAssetService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type BlockLatestService

type BlockLatestService struct {
	Options []option.RequestOption
}

BlockLatestService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBlockLatestService method instead.

func NewBlockLatestService

func NewBlockLatestService(opts ...option.RequestOption) (r *BlockLatestService)

NewBlockLatestService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*BlockLatestService) Get

func (r *BlockLatestService) Get(ctx context.Context, opts ...option.RequestOption) (res *TimestampedBlock, err error)

Information about the latest block on the chain.

type BlockService

type BlockService struct {
	Options []option.RequestOption
	Latest  *BlockLatestService
}

BlockService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBlockService method instead.

func NewBlockService

func NewBlockService(opts ...option.RequestOption) (r *BlockService)

NewBlockService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*BlockService) Get

func (r *BlockService) Get(ctx context.Context, blockHash string, opts ...option.RequestOption) (res *TimestampedBlock, err error)

Provides detailed information about a specific block by hash.

type Client

type Client struct {
	Options         []option.RequestOption
	Addresses       *AddressService
	Assets          *AssetService
	Blocks          *BlockService
	General         *GeneralService
	Rpc             *RpcService
	RpcTransactions *RpcTransactionService
	Transactions    *TransactionService
}

Client creates a struct with services and top level methods that help with interacting with the Maestro API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r *Client)

NewClient generates a new client with the default option read from the environment (API_KEY). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type Error

type Error = apierror.Error

type GeneralInfoService

type GeneralInfoService struct {
	Options []option.RequestOption
}

GeneralInfoService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGeneralInfoService method instead.

func NewGeneralInfoService

func NewGeneralInfoService(opts ...option.RequestOption) (r *GeneralInfoService)

NewGeneralInfoService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*GeneralInfoService) Get

Information about the state of the blockchain.

type GeneralService

type GeneralService struct {
	Options []option.RequestOption
	Info    *GeneralInfoService
}

GeneralService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGeneralService method instead.

func NewGeneralService

func NewGeneralService(opts ...option.RequestOption) (r *GeneralService)

NewGeneralService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type PaginatedAddressRuneUtxo

type PaginatedAddressRuneUtxo struct {
	Data        []PaginatedAddressRuneUtxoData      `json:"data,required"`
	LastUpdated PaginatedAddressRuneUtxoLastUpdated `json:"last_updated,required"`
	NextCursor  string                              `json:"next_cursor,nullable"`
	JSON        paginatedAddressRuneUtxoJSON        `json:"-"`
}

func (*PaginatedAddressRuneUtxo) UnmarshalJSON

func (r *PaginatedAddressRuneUtxo) UnmarshalJSON(data []byte) (err error)

type PaginatedAddressRuneUtxoData

type PaginatedAddressRuneUtxoData struct {
	Confirmations int64                            `json:"confirmations,required"`
	Height        int64                            `json:"height,required"`
	RuneAmount    string                           `json:"rune_amount,required"`
	Satoshis      string                           `json:"satoshis,required"`
	Txid          string                           `json:"txid,required"`
	Vout          int64                            `json:"vout,required"`
	JSON          paginatedAddressRuneUtxoDataJSON `json:"-"`
}

func (*PaginatedAddressRuneUtxoData) UnmarshalJSON

func (r *PaginatedAddressRuneUtxoData) UnmarshalJSON(data []byte) (err error)

type PaginatedAddressRuneUtxoLastUpdated

type PaginatedAddressRuneUtxoLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                                   `json:"block_height,required"`
	JSON        paginatedAddressRuneUtxoLastUpdatedJSON `json:"-"`
}

func (*PaginatedAddressRuneUtxoLastUpdated) UnmarshalJSON

func (r *PaginatedAddressRuneUtxoLastUpdated) UnmarshalJSON(data []byte) (err error)

type PaginatedBrc20Holder

type PaginatedBrc20Holder struct {
	Data        []PaginatedBrc20HolderData      `json:"data,required"`
	LastUpdated PaginatedBrc20HolderLastUpdated `json:"last_updated,required"`
	NextCursor  string                          `json:"next_cursor,nullable"`
	JSON        paginatedBrc20HolderJSON        `json:"-"`
}

func (*PaginatedBrc20Holder) UnmarshalJSON

func (r *PaginatedBrc20Holder) UnmarshalJSON(data []byte) (err error)

type PaginatedBrc20HolderData

type PaginatedBrc20HolderData struct {
	Balance      string                       `json:"balance,required"`
	ScriptPubkey string                       `json:"script_pubkey,required"`
	Address      string                       `json:"address,nullable"`
	JSON         paginatedBrc20HolderDataJSON `json:"-"`
}

func (*PaginatedBrc20HolderData) UnmarshalJSON

func (r *PaginatedBrc20HolderData) UnmarshalJSON(data []byte) (err error)

type PaginatedBrc20HolderLastUpdated

type PaginatedBrc20HolderLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                               `json:"block_height,required"`
	JSON        paginatedBrc20HolderLastUpdatedJSON `json:"-"`
}

func (*PaginatedBrc20HolderLastUpdated) UnmarshalJSON

func (r *PaginatedBrc20HolderLastUpdated) UnmarshalJSON(data []byte) (err error)

type PaginatedBrc20Ticker

type PaginatedBrc20Ticker struct {
	Data        []string                        `json:"data,required"`
	LastUpdated PaginatedBrc20TickerLastUpdated `json:"last_updated,required"`
	NextCursor  string                          `json:"next_cursor,nullable"`
	JSON        paginatedBrc20TickerJSON        `json:"-"`
}

func (*PaginatedBrc20Ticker) UnmarshalJSON

func (r *PaginatedBrc20Ticker) UnmarshalJSON(data []byte) (err error)

type PaginatedBrc20TickerLastUpdated

type PaginatedBrc20TickerLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                               `json:"block_height,required"`
	JSON        paginatedBrc20TickerLastUpdatedJSON `json:"-"`
}

func (*PaginatedBrc20TickerLastUpdated) UnmarshalJSON

func (r *PaginatedBrc20TickerLastUpdated) UnmarshalJSON(data []byte) (err error)

type PaginatedInvolvedTransaction

type PaginatedInvolvedTransaction struct {
	Data        []PaginatedInvolvedTransactionData      `json:"data,required"`
	LastUpdated PaginatedInvolvedTransactionLastUpdated `json:"last_updated,required"`
	NextCursor  string                                  `json:"next_cursor,nullable"`
	JSON        paginatedInvolvedTransactionJSON        `json:"-"`
}

func (*PaginatedInvolvedTransaction) UnmarshalJSON

func (r *PaginatedInvolvedTransaction) UnmarshalJSON(data []byte) (err error)

type PaginatedInvolvedTransactionData

type PaginatedInvolvedTransactionData struct {
	// Height of the block which included the transaction
	Height int64 `json:"height,required"`
	// Address/pubkey controlled an input UTxO
	Input bool `json:"input,required"`
	// Address/pubkey controlled an output UTxO
	Output bool `json:"output,required"`
	// The transaction's txid
	TxHash string                               `json:"tx_hash,required"`
	JSON   paginatedInvolvedTransactionDataJSON `json:"-"`
}

func (*PaginatedInvolvedTransactionData) UnmarshalJSON

func (r *PaginatedInvolvedTransactionData) UnmarshalJSON(data []byte) (err error)

type PaginatedInvolvedTransactionLastUpdated

type PaginatedInvolvedTransactionLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                                       `json:"block_height,required"`
	JSON        paginatedInvolvedTransactionLastUpdatedJSON `json:"-"`
}

func (*PaginatedInvolvedTransactionLastUpdated) UnmarshalJSON

func (r *PaginatedInvolvedTransactionLastUpdated) UnmarshalJSON(data []byte) (err error)

type PaginatedRuneHolder

type PaginatedRuneHolder struct {
	Data        []PaginatedRuneHolderData      `json:"data,required"`
	LastUpdated PaginatedRuneHolderLastUpdated `json:"last_updated,required"`
	NextCursor  string                         `json:"next_cursor,nullable"`
	JSON        paginatedRuneHolderJSON        `json:"-"`
}

func (*PaginatedRuneHolder) UnmarshalJSON

func (r *PaginatedRuneHolder) UnmarshalJSON(data []byte) (err error)

type PaginatedRuneHolderData

type PaginatedRuneHolderData struct {
	Balance      string                      `json:"balance,required"`
	ScriptPubkey string                      `json:"script_pubkey,required"`
	Address      string                      `json:"address,nullable"`
	JSON         paginatedRuneHolderDataJSON `json:"-"`
}

func (*PaginatedRuneHolderData) UnmarshalJSON

func (r *PaginatedRuneHolderData) UnmarshalJSON(data []byte) (err error)

type PaginatedRuneHolderLastUpdated

type PaginatedRuneHolderLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                              `json:"block_height,required"`
	JSON        paginatedRuneHolderLastUpdatedJSON `json:"-"`
}

func (*PaginatedRuneHolderLastUpdated) UnmarshalJSON

func (r *PaginatedRuneHolderLastUpdated) UnmarshalJSON(data []byte) (err error)

type PaginatedRuneIDAndName

type PaginatedRuneIDAndName struct {
	Data        []PaginatedRuneIDAndNameData      `json:"data,required"`
	LastUpdated PaginatedRuneIDAndNameLastUpdated `json:"last_updated,required"`
	NextCursor  string                            `json:"next_cursor,nullable"`
	JSON        paginatedRuneIDAndNameJSON        `json:"-"`
}

func (*PaginatedRuneIDAndName) UnmarshalJSON

func (r *PaginatedRuneIDAndName) UnmarshalJSON(data []byte) (err error)

type PaginatedRuneIDAndNameData

type PaginatedRuneIDAndNameData struct {
	ID         string                         `json:"id,required"`
	SpacedName string                         `json:"spaced_name,required"`
	JSON       paginatedRuneIDAndNameDataJSON `json:"-"`
}

func (*PaginatedRuneIDAndNameData) UnmarshalJSON

func (r *PaginatedRuneIDAndNameData) UnmarshalJSON(data []byte) (err error)

type PaginatedRuneIDAndNameLastUpdated

type PaginatedRuneIDAndNameLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                                 `json:"block_height,required"`
	JSON        paginatedRuneIDAndNameLastUpdatedJSON `json:"-"`
}

func (*PaginatedRuneIDAndNameLastUpdated) UnmarshalJSON

func (r *PaginatedRuneIDAndNameLastUpdated) UnmarshalJSON(data []byte) (err error)

type PaginatedRuneUtxo

type PaginatedRuneUtxo struct {
	Data        []PaginatedRuneUtxoData      `json:"data,required"`
	LastUpdated PaginatedRuneUtxoLastUpdated `json:"last_updated,required"`
	NextCursor  string                       `json:"next_cursor,nullable"`
	JSON        paginatedRuneUtxoJSON        `json:"-"`
}

func (*PaginatedRuneUtxo) UnmarshalJSON

func (r *PaginatedRuneUtxo) UnmarshalJSON(data []byte) (err error)

type PaginatedRuneUtxoData

type PaginatedRuneUtxoData struct {
	Confirmations int64                     `json:"confirmations,required"`
	Height        int64                     `json:"height,required"`
	RuneAmount    string                    `json:"rune_amount,required"`
	Satoshis      string                    `json:"satoshis,required"`
	ScriptPubkey  string                    `json:"script_pubkey,required"`
	Txid          string                    `json:"txid,required"`
	Vout          int64                     `json:"vout,required"`
	Address       string                    `json:"address,nullable"`
	JSON          paginatedRuneUtxoDataJSON `json:"-"`
}

func (*PaginatedRuneUtxoData) UnmarshalJSON

func (r *PaginatedRuneUtxoData) UnmarshalJSON(data []byte) (err error)

type PaginatedRuneUtxoLastUpdated

type PaginatedRuneUtxoLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                            `json:"block_height,required"`
	JSON        paginatedRuneUtxoLastUpdatedJSON `json:"-"`
}

func (*PaginatedRuneUtxoLastUpdated) UnmarshalJSON

func (r *PaginatedRuneUtxoLastUpdated) UnmarshalJSON(data []byte) (err error)

type PaginatedUtxo

type PaginatedUtxo struct {
	Data        []PaginatedUtxoData      `json:"data,required"`
	LastUpdated PaginatedUtxoLastUpdated `json:"last_updated,required"`
	NextCursor  string                   `json:"next_cursor,nullable"`
	JSON        paginatedUtxoJSON        `json:"-"`
}

func (*PaginatedUtxo) UnmarshalJSON

func (r *PaginatedUtxo) UnmarshalJSON(data []byte) (err error)

type PaginatedUtxoData

type PaginatedUtxoData struct {
	Confirmations int64                          `json:"confirmations,required"`
	Height        int64                          `json:"height,required"`
	Inscriptions  []PaginatedUtxoDataInscription `json:"inscriptions,required"`
	Runes         []PaginatedUtxoDataRune        `json:"runes,required"`
	Satoshis      string                         `json:"satoshis,required"`
	ScriptPubkey  string                         `json:"script_pubkey,required"`
	Txid          string                         `json:"txid,required"`
	Vout          int64                          `json:"vout,required"`
	Address       string                         `json:"address,nullable"`
	JSON          paginatedUtxoDataJSON          `json:"-"`
}

func (*PaginatedUtxoData) UnmarshalJSON

func (r *PaginatedUtxoData) UnmarshalJSON(data []byte) (err error)

type PaginatedUtxoDataInscription

type PaginatedUtxoDataInscription struct {
	InscriptionID string                           `json:"inscription_id,required"`
	Offset        int64                            `json:"offset,required"`
	JSON          paginatedUtxoDataInscriptionJSON `json:"-"`
}

func (*PaginatedUtxoDataInscription) UnmarshalJSON

func (r *PaginatedUtxoDataInscription) UnmarshalJSON(data []byte) (err error)

type PaginatedUtxoDataRune

type PaginatedUtxoDataRune struct {
	Amount string                    `json:"amount,required"`
	RuneID string                    `json:"rune_id,required"`
	JSON   paginatedUtxoDataRuneJSON `json:"-"`
}

func (*PaginatedUtxoDataRune) UnmarshalJSON

func (r *PaginatedUtxoDataRune) UnmarshalJSON(data []byte) (err error)

type PaginatedUtxoLastUpdated

type PaginatedUtxoLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                        `json:"block_height,required"`
	JSON        paginatedUtxoLastUpdatedJSON `json:"-"`
}

func (*PaginatedUtxoLastUpdated) UnmarshalJSON

func (r *PaginatedUtxoLastUpdated) UnmarshalJSON(data []byte) (err error)

type RpcMempoolInfoService

type RpcMempoolInfoService struct {
	Options []option.RequestOption
}

RpcMempoolInfoService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRpcMempoolInfoService method instead.

func NewRpcMempoolInfoService

func NewRpcMempoolInfoService(opts ...option.RequestOption) (r *RpcMempoolInfoService)

NewRpcMempoolInfoService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RpcMempoolInfoService) Get

Mempool Info

type RpcMempoolService

type RpcMempoolService struct {
	Options      []option.RequestOption
	Info         *RpcMempoolInfoService
	Transactions *RpcMempoolTransactionService
}

RpcMempoolService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRpcMempoolService method instead.

func NewRpcMempoolService

func NewRpcMempoolService(opts ...option.RequestOption) (r *RpcMempoolService)

NewRpcMempoolService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type RpcMempoolTransactionAncestorService

type RpcMempoolTransactionAncestorService struct {
	Options []option.RequestOption
}

RpcMempoolTransactionAncestorService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRpcMempoolTransactionAncestorService method instead.

func NewRpcMempoolTransactionAncestorService

func NewRpcMempoolTransactionAncestorService(opts ...option.RequestOption) (r *RpcMempoolTransactionAncestorService)

NewRpcMempoolTransactionAncestorService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RpcMempoolTransactionAncestorService) List

List Mempool Transaction Ancestors

type RpcMempoolTransactionDescendantService

type RpcMempoolTransactionDescendantService struct {
	Options []option.RequestOption
}

RpcMempoolTransactionDescendantService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRpcMempoolTransactionDescendantService method instead.

func NewRpcMempoolTransactionDescendantService

func NewRpcMempoolTransactionDescendantService(opts ...option.RequestOption) (r *RpcMempoolTransactionDescendantService)

NewRpcMempoolTransactionDescendantService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RpcMempoolTransactionDescendantService) List

List Mempool Transaction Descendants

type RpcMempoolTransactionService

type RpcMempoolTransactionService struct {
	Options     []option.RequestOption
	Ancestors   *RpcMempoolTransactionAncestorService
	Descendants *RpcMempoolTransactionDescendantService
}

RpcMempoolTransactionService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRpcMempoolTransactionService method instead.

func NewRpcMempoolTransactionService

func NewRpcMempoolTransactionService(opts ...option.RequestOption) (r *RpcMempoolTransactionService)

NewRpcMempoolTransactionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RpcMempoolTransactionService) Get

Mempool Transaction Details

func (*RpcMempoolTransactionService) List

List Mempool Transactions

type RpcService

type RpcService struct {
	Options []option.RequestOption
	Mempool *RpcMempoolService
}

RpcService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRpcService method instead.

func NewRpcService

func NewRpcService(opts ...option.RequestOption) (r *RpcService)

NewRpcService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type RpcTransactionService

type RpcTransactionService struct {
	Options []option.RequestOption
}

RpcTransactionService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRpcTransactionService method instead.

func NewRpcTransactionService

func NewRpcTransactionService(opts ...option.RequestOption) (r *RpcTransactionService)

NewRpcTransactionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RpcTransactionService) Get

Transaction Details

type TimestampedBlock

type TimestampedBlock struct {
	Data        TimestampedBlockData        `json:"data,required"`
	LastUpdated TimestampedBlockLastUpdated `json:"last_updated,required"`
	JSON        timestampedBlockJSON        `json:"-"`
}

func (*TimestampedBlock) UnmarshalJSON

func (r *TimestampedBlock) UnmarshalJSON(data []byte) (err error)

type TimestampedBlockData

type TimestampedBlockData struct {
	Header TimestampedBlockDataHeader `json:"header,required"`
	// List of transactions contained in the block
	Txdata []TimestampedBlockDataTxdata `json:"txdata,required"`
	JSON   timestampedBlockDataJSON     `json:"-"`
}

func (*TimestampedBlockData) UnmarshalJSON

func (r *TimestampedBlockData) UnmarshalJSON(data []byte) (err error)

type TimestampedBlockDataHeader

type TimestampedBlockDataHeader struct {
	// The target value below which the blockhash must lie, encoded as a a float (with
	// well-defined rounding, of course)
	Bits int64 `json:"bits,required"`
	// The root hash of the merkle tree of transactions in the block
	MerkleRoot io.Reader `json:"merkle_root,required" format:"binary"`
	// The nonce, selected to obtain a low enough blockhash
	Nonce int64 `json:"nonce,required"`
	// Reference to the previous block in the chain
	PrevBlockhash io.Reader `json:"prev_blockhash,required" format:"binary"`
	// The timestamp of the block, as claimed by the miner
	Time int64 `json:"time,required"`
	// The protocol version. Should always be 1.
	Version int64                          `json:"version,required"`
	JSON    timestampedBlockDataHeaderJSON `json:"-"`
}

func (*TimestampedBlockDataHeader) UnmarshalJSON

func (r *TimestampedBlockDataHeader) UnmarshalJSON(data []byte) (err error)

type TimestampedBlockDataTxdata

type TimestampedBlockDataTxdata struct {
	// List of inputs
	Input []TimestampedBlockDataTxdataInput `json:"input,required"`
	// Block number before which this transaction is valid, or 0 for valid immediately.
	LockTime int64 `json:"lock_time,required"`
	// List of outputs
	Output []TimestampedBlockDataTxdataOutput `json:"output,required"`
	// The protocol version, is currently expected to be 1 or 2 (BIP 68).
	Version int64                          `json:"version,required"`
	JSON    timestampedBlockDataTxdataJSON `json:"-"`
}

func (*TimestampedBlockDataTxdata) UnmarshalJSON

func (r *TimestampedBlockDataTxdata) UnmarshalJSON(data []byte) (err error)

type TimestampedBlockDataTxdataInput

type TimestampedBlockDataTxdataInput struct {
	PreviousOutput TimestampedBlockDataTxdataInputPreviousOutput `json:"previous_output,required"`
	ScriptSig      io.Reader                                     `json:"script_sig,required" format:"binary"`
	// The sequence number, which suggests to miners which of two conflicting
	// transactions should be preferred, or 0xFFFFFFFF to ignore this feature. This is
	// generally never used since the miner behaviour cannot be enforced.
	Sequence int64 `json:"sequence,required"`
	// Witness data: an array of byte-arrays. Note that this field is _not_
	// (de)serialized with the rest of the TxIn in Encodable/Decodable, as it is
	// (de)serialized at the end of the full Transaction. It _is_ (de)serialized with
	// the rest of the TxIn in other (de)serialization routines.
	Witness []io.Reader                         `json:"witness,required" format:"binary"`
	JSON    timestampedBlockDataTxdataInputJSON `json:"-"`
}

func (*TimestampedBlockDataTxdataInput) UnmarshalJSON

func (r *TimestampedBlockDataTxdataInput) UnmarshalJSON(data []byte) (err error)

type TimestampedBlockDataTxdataInputPreviousOutput

type TimestampedBlockDataTxdataInputPreviousOutput struct {
	Txid string `json:"txid,required"`
	// The index of the referenced output in its transaction's vout
	Vout int64                                             `json:"vout,required"`
	JSON timestampedBlockDataTxdataInputPreviousOutputJSON `json:"-"`
}

func (*TimestampedBlockDataTxdataInputPreviousOutput) UnmarshalJSON

func (r *TimestampedBlockDataTxdataInputPreviousOutput) UnmarshalJSON(data []byte) (err error)

type TimestampedBlockDataTxdataOutput

type TimestampedBlockDataTxdataOutput struct {
	ScriptPubkey io.Reader `json:"script_pubkey,required" format:"binary"`
	// The value of the output, in satoshis
	Value int64                                `json:"value,required"`
	JSON  timestampedBlockDataTxdataOutputJSON `json:"-"`
}

func (*TimestampedBlockDataTxdataOutput) UnmarshalJSON

func (r *TimestampedBlockDataTxdataOutput) UnmarshalJSON(data []byte) (err error)

type TimestampedBlockLastUpdated

type TimestampedBlockLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                           `json:"block_height,required"`
	JSON        timestampedBlockLastUpdatedJSON `json:"-"`
}

func (*TimestampedBlockLastUpdated) UnmarshalJSON

func (r *TimestampedBlockLastUpdated) UnmarshalJSON(data []byte) (err error)

type TimestampedBlockchainInfo

type TimestampedBlockchainInfo struct {
	Data        TimestampedBlockchainInfoData        `json:"data,required"`
	LastUpdated TimestampedBlockchainInfoLastUpdated `json:"last_updated,required"`
	JSON        timestampedBlockchainInfoJSON        `json:"-"`
}

func (*TimestampedBlockchainInfo) UnmarshalJSON

func (r *TimestampedBlockchainInfo) UnmarshalJSON(data []byte) (err error)

type TimestampedBlockchainInfoData

type TimestampedBlockchainInfoData struct {
	// The hash of the currently best block
	Bestblockhash string `json:"bestblockhash,required"`
	// The current number of blocks processed in the server
	Blocks int64 `json:"blocks,required"`
	// Current network name as defined in BIP70 (main, test, regtest)
	Chain string `json:"chain,required"`
	// Total amount of work in active chain, in hexadecimal
	Chainwork string `json:"chainwork,required"`
	// The current difficulty
	Difficulty float64 `json:"difficulty,required"`
	// The current number of headers we have validated
	Headers int64 `json:"headers,required"`
	// Estimate of whether this node is in Initial Block Download mode
	Initialblockdownload bool `json:"initialblockdownload,required"`
	// Median time for the current best block
	Mediantime int64 `json:"mediantime,required"`
	// If the blocks are subject to pruning
	Pruned bool `json:"pruned,required"`
	// The estimated size of the block and undo files on disk
	SizeOnDisk int64 `json:"size_on_disk,required"`
	// Status of softforks in progress
	Softforks map[string]TimestampedBlockchainInfoDataSoftfork `json:"softforks,required"`
	// Estimate of verification progress [0..1]
	Verificationprogress float64 `json:"verificationprogress,required"`
	// Any network and blockchain warnings.
	Warnings string `json:"warnings,required"`
	// Whether automatic pruning is enabled (only present if pruning is enabled)
	AutomaticPruning bool `json:"automatic_pruning,nullable"`
	// Lowest-height complete block stored (only present if pruning is enabled)
	PruneHeight int64 `json:"prune_height,nullable"`
	// The target size used by pruning (only present if automatic pruning is enabled)
	PruneTargetSize int64                             `json:"prune_target_size,nullable"`
	JSON            timestampedBlockchainInfoDataJSON `json:"-"`
}

func (*TimestampedBlockchainInfoData) UnmarshalJSON

func (r *TimestampedBlockchainInfoData) UnmarshalJSON(data []byte) (err error)

type TimestampedBlockchainInfoDataSoftfork

type TimestampedBlockchainInfoDataSoftfork struct {
	Active bool                                       `json:"active"`
	Bip9   TimestampedBlockchainInfoDataSoftforksBip9 `json:"bip9,nullable"`
	Height int64                                      `json:"height,nullable"`
	Type   TimestampedBlockchainInfoDataSoftforksType `json:"type,nullable"`
	JSON   timestampedBlockchainInfoDataSoftforkJSON  `json:"-"`
}

func (*TimestampedBlockchainInfoDataSoftfork) UnmarshalJSON

func (r *TimestampedBlockchainInfoDataSoftfork) UnmarshalJSON(data []byte) (err error)

type TimestampedBlockchainInfoDataSoftforksBip9

type TimestampedBlockchainInfoDataSoftforksBip9 struct {
	Since      int64                                                `json:"since,required"`
	StartTime  int64                                                `json:"start_time,required"`
	Status     TimestampedBlockchainInfoDataSoftforksBip9Status     `json:"status,required"`
	Timeout    int64                                                `json:"timeout,required"`
	Bit        int64                                                `json:"bit,nullable"`
	Statistics TimestampedBlockchainInfoDataSoftforksBip9Statistics `json:"statistics,nullable"`
	JSON       timestampedBlockchainInfoDataSoftforksBip9JSON       `json:"-"`
}

func (*TimestampedBlockchainInfoDataSoftforksBip9) UnmarshalJSON

func (r *TimestampedBlockchainInfoDataSoftforksBip9) UnmarshalJSON(data []byte) (err error)

type TimestampedBlockchainInfoDataSoftforksBip9Statistics

type TimestampedBlockchainInfoDataSoftforksBip9Statistics struct {
	Count     int64                                                    `json:"count,required"`
	Elapsed   int64                                                    `json:"elapsed,required"`
	Period    int64                                                    `json:"period,required"`
	Possible  bool                                                     `json:"possible,required"`
	Threshold int64                                                    `json:"threshold,required"`
	JSON      timestampedBlockchainInfoDataSoftforksBip9StatisticsJSON `json:"-"`
}

func (*TimestampedBlockchainInfoDataSoftforksBip9Statistics) UnmarshalJSON

func (r *TimestampedBlockchainInfoDataSoftforksBip9Statistics) UnmarshalJSON(data []byte) (err error)

type TimestampedBlockchainInfoDataSoftforksBip9Status

type TimestampedBlockchainInfoDataSoftforksBip9Status string
const (
	TimestampedBlockchainInfoDataSoftforksBip9StatusDefined  TimestampedBlockchainInfoDataSoftforksBip9Status = "defined"
	TimestampedBlockchainInfoDataSoftforksBip9StatusStarted  TimestampedBlockchainInfoDataSoftforksBip9Status = "started"
	TimestampedBlockchainInfoDataSoftforksBip9StatusLockedIn TimestampedBlockchainInfoDataSoftforksBip9Status = "locked_in"
	TimestampedBlockchainInfoDataSoftforksBip9StatusActive   TimestampedBlockchainInfoDataSoftforksBip9Status = "active"
	TimestampedBlockchainInfoDataSoftforksBip9StatusFailed   TimestampedBlockchainInfoDataSoftforksBip9Status = "failed"
)

func (TimestampedBlockchainInfoDataSoftforksBip9Status) IsKnown

type TimestampedBlockchainInfoDataSoftforksType

type TimestampedBlockchainInfoDataSoftforksType string
const (
	TimestampedBlockchainInfoDataSoftforksTypeBuried TimestampedBlockchainInfoDataSoftforksType = "buried"
	TimestampedBlockchainInfoDataSoftforksTypeBip9   TimestampedBlockchainInfoDataSoftforksType = "bip9"
)

func (TimestampedBlockchainInfoDataSoftforksType) IsKnown

type TimestampedBlockchainInfoLastUpdated

type TimestampedBlockchainInfoLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                                    `json:"block_height,required"`
	JSON        timestampedBlockchainInfoLastUpdatedJSON `json:"-"`
}

func (*TimestampedBlockchainInfoLastUpdated) UnmarshalJSON

func (r *TimestampedBlockchainInfoLastUpdated) UnmarshalJSON(data []byte) (err error)

type TimestampedBrc20Info

type TimestampedBrc20Info struct {
	Data        TimestampedBrc20InfoData        `json:"data,required"`
	LastUpdated TimestampedBrc20InfoLastUpdated `json:"last_updated,required"`
	JSON        timestampedBrc20InfoJSON        `json:"-"`
}

func (*TimestampedBrc20Info) UnmarshalJSON

func (r *TimestampedBrc20Info) UnmarshalJSON(data []byte) (err error)

type TimestampedBrc20InfoData

type TimestampedBrc20InfoData struct {
	DeployInscription string                        `json:"deploy_inscription,required"`
	Holders           int64                         `json:"holders,required"`
	MintedSupply      string                        `json:"minted_supply,required"`
	Terms             TimestampedBrc20InfoDataTerms `json:"terms,required"`
	Ticker            string                        `json:"ticker,required"`
	TickerHex         string                        `json:"ticker_hex,required"`
	JSON              timestampedBrc20InfoDataJSON  `json:"-"`
}

func (*TimestampedBrc20InfoData) UnmarshalJSON

func (r *TimestampedBrc20InfoData) UnmarshalJSON(data []byte) (err error)

type TimestampedBrc20InfoDataTerms

type TimestampedBrc20InfoDataTerms struct {
	Dec      int64                             `json:"dec,required"`
	Limit    string                            `json:"limit,required"`
	Max      string                            `json:"max,required"`
	SelfMint bool                              `json:"self_mint,required"`
	JSON     timestampedBrc20InfoDataTermsJSON `json:"-"`
}

func (*TimestampedBrc20InfoDataTerms) UnmarshalJSON

func (r *TimestampedBrc20InfoDataTerms) UnmarshalJSON(data []byte) (err error)

type TimestampedBrc20InfoLastUpdated

type TimestampedBrc20InfoLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                               `json:"block_height,required"`
	JSON        timestampedBrc20InfoLastUpdatedJSON `json:"-"`
}

func (*TimestampedBrc20InfoLastUpdated) UnmarshalJSON

func (r *TimestampedBrc20InfoLastUpdated) UnmarshalJSON(data []byte) (err error)

type TimestampedBrc20Quantities

type TimestampedBrc20Quantities struct {
	Data        map[string]string                     `json:"data,required"`
	LastUpdated TimestampedBrc20QuantitiesLastUpdated `json:"last_updated,required"`
	JSON        timestampedBrc20QuantitiesJSON        `json:"-"`
}

func (*TimestampedBrc20Quantities) UnmarshalJSON

func (r *TimestampedBrc20Quantities) UnmarshalJSON(data []byte) (err error)

type TimestampedBrc20QuantitiesLastUpdated

type TimestampedBrc20QuantitiesLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                                     `json:"block_height,required"`
	JSON        timestampedBrc20QuantitiesLastUpdatedJSON `json:"-"`
}

func (*TimestampedBrc20QuantitiesLastUpdated) UnmarshalJSON

func (r *TimestampedBrc20QuantitiesLastUpdated) UnmarshalJSON(data []byte) (err error)

type TimestampedMempoolInfo

type TimestampedMempoolInfo struct {
	Data        TimestampedMempoolInfoData        `json:"data,required"`
	LastUpdated TimestampedMempoolInfoLastUpdated `json:"last_updated,required"`
	JSON        timestampedMempoolInfoJSON        `json:"-"`
}

func (*TimestampedMempoolInfo) UnmarshalJSON

func (r *TimestampedMempoolInfo) UnmarshalJSON(data []byte) (err error)

type TimestampedMempoolInfoData

type TimestampedMempoolInfoData struct {
	// Total memory usage for the mempool (in bytes)
	Bytes int64 `json:"bytes,required"`
	// Whether full replace-by-fee (RBF) is enabled
	FullRbf bool `json:"full_rbf,required"`
	// The incremental relay fee setting (in BTC)
	IncrementalRelayFee string `json:"incremental_relay_fee,required"`
	// Whether the mempool is fully loaded
	Loaded bool `json:"loaded,required"`
	// Maximum memory usage for the mempool (in bytes)
	MaxMempool int64 `json:"max_mempool,required"`
	// The minimum fee rate (in BTC/kB) for mempool transactions
	MempoolMinFee string `json:"mempool_min_fee,required"`
	// The minimum fee rate (in BTC/kB) for relaying transactions
	MinRelayTxFee string `json:"min_relay_tx_fee,required"`
	// Number of transactions in the mempool
	Size int64 `json:"size,required"`
	// The total fees (in BTC) in the mempool
	TotalFee string `json:"total_fee,required"`
	// Number of transactions that have not been broadcast
	UnbroadcastCount int64 `json:"unbroadcast_count,required"`
	// Total usage of the mempool (in bytes)
	Usage int64                          `json:"usage,required"`
	JSON  timestampedMempoolInfoDataJSON `json:"-"`
}

func (*TimestampedMempoolInfoData) UnmarshalJSON

func (r *TimestampedMempoolInfoData) UnmarshalJSON(data []byte) (err error)

type TimestampedMempoolInfoLastUpdated

type TimestampedMempoolInfoLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                                 `json:"block_height,required"`
	JSON        timestampedMempoolInfoLastUpdatedJSON `json:"-"`
}

func (*TimestampedMempoolInfoLastUpdated) UnmarshalJSON

func (r *TimestampedMempoolInfoLastUpdated) UnmarshalJSON(data []byte) (err error)

type TimestampedMempoolTransactionAncestors

type TimestampedMempoolTransactionAncestors struct {
	Data        []string                                          `json:"data,required"`
	LastUpdated TimestampedMempoolTransactionAncestorsLastUpdated `json:"last_updated,required"`
	JSON        timestampedMempoolTransactionAncestorsJSON        `json:"-"`
}

func (*TimestampedMempoolTransactionAncestors) UnmarshalJSON

func (r *TimestampedMempoolTransactionAncestors) UnmarshalJSON(data []byte) (err error)

type TimestampedMempoolTransactionAncestorsLastUpdated

type TimestampedMempoolTransactionAncestorsLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                                                 `json:"block_height,required"`
	JSON        timestampedMempoolTransactionAncestorsLastUpdatedJSON `json:"-"`
}

func (*TimestampedMempoolTransactionAncestorsLastUpdated) UnmarshalJSON

func (r *TimestampedMempoolTransactionAncestorsLastUpdated) UnmarshalJSON(data []byte) (err error)

type TimestampedMempoolTransactionDescendants

type TimestampedMempoolTransactionDescendants struct {
	Data        []string                                            `json:"data,required"`
	LastUpdated TimestampedMempoolTransactionDescendantsLastUpdated `json:"last_updated,required"`
	JSON        timestampedMempoolTransactionDescendantsJSON        `json:"-"`
}

func (*TimestampedMempoolTransactionDescendants) UnmarshalJSON

func (r *TimestampedMempoolTransactionDescendants) UnmarshalJSON(data []byte) (err error)

type TimestampedMempoolTransactionDescendantsLastUpdated

type TimestampedMempoolTransactionDescendantsLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                                                   `json:"block_height,required"`
	JSON        timestampedMempoolTransactionDescendantsLastUpdatedJSON `json:"-"`
}

func (*TimestampedMempoolTransactionDescendantsLastUpdated) UnmarshalJSON

func (r *TimestampedMempoolTransactionDescendantsLastUpdated) UnmarshalJSON(data []byte) (err error)

type TimestampedMempoolTransactionDetails

type TimestampedMempoolTransactionDetails struct {
	Data        TimestampedMempoolTransactionDetailsData        `json:"data,required"`
	LastUpdated TimestampedMempoolTransactionDetailsLastUpdated `json:"last_updated,required"`
	JSON        timestampedMempoolTransactionDetailsJSON        `json:"-"`
}

func (*TimestampedMempoolTransactionDetails) UnmarshalJSON

func (r *TimestampedMempoolTransactionDetails) UnmarshalJSON(data []byte) (err error)

type TimestampedMempoolTransactionDetailsData

type TimestampedMempoolTransactionDetailsData struct {
	// Number of ancestors
	AncestorCount int64 `json:"ancestor_count,required"`
	// Size of ancestors
	AncestorSize int64 `json:"ancestor_size,required"`
	// Whether the transaction is BIP 125 replaceable
	Bip125Replaceable bool `json:"bip125_replaceable,required"`
	// Dependencies of the transaction
	Depends []string `json:"depends,required"`
	// Number of descendants
	DescendantCount int64 `json:"descendant_count,required"`
	// Size of descendants
	DescendantSize int64                                        `json:"descendant_size,required"`
	Fees           TimestampedMempoolTransactionDetailsDataFees `json:"fees,required"`
	// Block height
	Height int64 `json:"height,required"`
	// Transactions that spend this one
	SpentBy []string `json:"spent_by,required"`
	// Time of the transaction
	Time int64 `json:"time,required"`
	// Whether the transaction is unbroadcast
	Unbroadcast bool `json:"unbroadcast,required"`
	// Virtual size of the transaction
	Vsize int64 `json:"vsize,required"`
	// Weight of the transaction
	Weight int64 `json:"weight,required"`
	// Witness transaction ID
	WtxID string                                       `json:"wtx_id,required"`
	JSON  timestampedMempoolTransactionDetailsDataJSON `json:"-"`
}

func (*TimestampedMempoolTransactionDetailsData) UnmarshalJSON

func (r *TimestampedMempoolTransactionDetailsData) UnmarshalJSON(data []byte) (err error)

type TimestampedMempoolTransactionDetailsDataFees

type TimestampedMempoolTransactionDetailsDataFees struct {
	// Ancestor fee
	Ancestor string `json:"ancestor,required"`
	// Base fee
	Base string `json:"base,required"`
	// Descendant fee
	Descendant string `json:"descendant,required"`
	// Modified fee
	Modified string                                           `json:"modified,required"`
	JSON     timestampedMempoolTransactionDetailsDataFeesJSON `json:"-"`
}

func (*TimestampedMempoolTransactionDetailsDataFees) UnmarshalJSON

func (r *TimestampedMempoolTransactionDetailsDataFees) UnmarshalJSON(data []byte) (err error)

type TimestampedMempoolTransactionDetailsLastUpdated

type TimestampedMempoolTransactionDetailsLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                                               `json:"block_height,required"`
	JSON        timestampedMempoolTransactionDetailsLastUpdatedJSON `json:"-"`
}

func (*TimestampedMempoolTransactionDetailsLastUpdated) UnmarshalJSON

func (r *TimestampedMempoolTransactionDetailsLastUpdated) UnmarshalJSON(data []byte) (err error)

type TimestampedMempoolTransactions

type TimestampedMempoolTransactions struct {
	Data        TimestampedMempoolTransactionsData        `json:"data,required"`
	LastUpdated TimestampedMempoolTransactionsLastUpdated `json:"last_updated,required"`
	JSON        timestampedMempoolTransactionsJSON        `json:"-"`
}

func (*TimestampedMempoolTransactions) UnmarshalJSON

func (r *TimestampedMempoolTransactions) UnmarshalJSON(data []byte) (err error)

type TimestampedMempoolTransactionsData

type TimestampedMempoolTransactionsData struct {
	// Sequence number of the mempool
	MempoolSequence int64 `json:"mempool_sequence,required"`
	// List of transaction IDs
	TxIDs []string                               `json:"tx_ids,required"`
	JSON  timestampedMempoolTransactionsDataJSON `json:"-"`
}

func (*TimestampedMempoolTransactionsData) UnmarshalJSON

func (r *TimestampedMempoolTransactionsData) UnmarshalJSON(data []byte) (err error)

type TimestampedMempoolTransactionsLastUpdated

type TimestampedMempoolTransactionsLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                                         `json:"block_height,required"`
	JSON        timestampedMempoolTransactionsLastUpdatedJSON `json:"-"`
}

func (*TimestampedMempoolTransactionsLastUpdated) UnmarshalJSON

func (r *TimestampedMempoolTransactionsLastUpdated) UnmarshalJSON(data []byte) (err error)

type TimestampedRuneInfo

type TimestampedRuneInfo struct {
	Data        TimestampedRuneInfoData        `json:"data,required"`
	LastUpdated TimestampedRuneInfoLastUpdated `json:"last_updated,required"`
	JSON        timestampedRuneInfoJSON        `json:"-"`
}

func (*TimestampedRuneInfo) UnmarshalJSON

func (r *TimestampedRuneInfo) UnmarshalJSON(data []byte) (err error)

type TimestampedRuneInfoData

type TimestampedRuneInfoData struct {
	ID                string                       `json:"id,required"`
	CirculatingSupply string                       `json:"circulating_supply,required"`
	EtchingCenotaph   bool                         `json:"etching_cenotaph,required"`
	EtchingHeight     int64                        `json:"etching_height,required"`
	EtchingTx         string                       `json:"etching_tx,required"`
	MaxSupply         string                       `json:"max_supply,required"`
	Mints             int64                        `json:"mints,required"`
	Name              string                       `json:"name,required"`
	SpacedName        string                       `json:"spaced_name,required"`
	Terms             TimestampedRuneInfoDataTerms `json:"terms,required"`
	TotalUtxos        int64                        `json:"total_utxos,required"`
	UniqueHolders     int64                        `json:"unique_holders,required"`
	Divisibility      int64                        `json:"divisibility,nullable"`
	Premine           string                       `json:"premine,nullable"`
	Symbol            string                       `json:"symbol,nullable"`
	JSON              timestampedRuneInfoDataJSON  `json:"-"`
}

func (*TimestampedRuneInfoData) UnmarshalJSON

func (r *TimestampedRuneInfoData) UnmarshalJSON(data []byte) (err error)

type TimestampedRuneInfoDataTerms

type TimestampedRuneInfoDataTerms struct {
	AmountPerMint string                           `json:"amount_per_mint,nullable"`
	EndHeight     string                           `json:"end_height,nullable"`
	EndOffset     string                           `json:"end_offset,nullable"`
	MintTxsCap    string                           `json:"mint_txs_cap,nullable"`
	StartHeight   string                           `json:"start_height,nullable"`
	StartOffset   string                           `json:"start_offset,nullable"`
	JSON          timestampedRuneInfoDataTermsJSON `json:"-"`
}

func (*TimestampedRuneInfoDataTerms) UnmarshalJSON

func (r *TimestampedRuneInfoDataTerms) UnmarshalJSON(data []byte) (err error)

type TimestampedRuneInfoLastUpdated

type TimestampedRuneInfoLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                              `json:"block_height,required"`
	JSON        timestampedRuneInfoLastUpdatedJSON `json:"-"`
}

func (*TimestampedRuneInfoLastUpdated) UnmarshalJSON

func (r *TimestampedRuneInfoLastUpdated) UnmarshalJSON(data []byte) (err error)

type TimestampedRuneQuantities

type TimestampedRuneQuantities struct {
	Data        map[string]string                    `json:"data,required"`
	LastUpdated TimestampedRuneQuantitiesLastUpdated `json:"last_updated,required"`
	JSON        timestampedRuneQuantitiesJSON        `json:"-"`
}

func (*TimestampedRuneQuantities) UnmarshalJSON

func (r *TimestampedRuneQuantities) UnmarshalJSON(data []byte) (err error)

type TimestampedRuneQuantitiesLastUpdated

type TimestampedRuneQuantitiesLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                                    `json:"block_height,required"`
	JSON        timestampedRuneQuantitiesLastUpdatedJSON `json:"-"`
}

func (*TimestampedRuneQuantitiesLastUpdated) UnmarshalJSON

func (r *TimestampedRuneQuantitiesLastUpdated) UnmarshalJSON(data []byte) (err error)

type TimestampedTransactionDetails

type TimestampedTransactionDetails struct {
	// Represents the details of a Bitcoin transaction.
	Data        TimestampedTransactionDetailsData        `json:"data,required"`
	LastUpdated TimestampedTransactionDetailsLastUpdated `json:"last_updated,required"`
	JSON        timestampedTransactionDetailsJSON        `json:"-"`
}

func (*TimestampedTransactionDetails) UnmarshalJSON

func (r *TimestampedTransactionDetails) UnmarshalJSON(data []byte) (err error)

type TimestampedTransactionDetailsData

type TimestampedTransactionDetailsData struct {
	// The hash of the block that contains this transaction.
	BlockHash string `json:"block_hash,required"`
	// The time the block containing this transaction was mined (in UNIX timestamp).
	BlockTime int64 `json:"block_time,required"`
	// The number of confirmations for this transaction.
	Confirmations int64 `json:"confirmations,required"`
	// The transaction hash (TXID).
	Hash string `json:"hash,required"`
	// The raw transaction in hexadecimal form.
	Hex string `json:"hex,required"`
	// The locktime of the transaction, which specifies the earliest time or block when
	// the transaction can be included in a block.
	LockTime int64 `json:"lock_time,required"`
	// The size of the transaction in bytes.
	Size int64 `json:"size,required"`
	// The timestamp when the transaction was included in the block (in UNIX
	// timestamp).
	Time int64 `json:"time,required"`
	// The transaction ID (TXID) of this transaction.
	TxID string `json:"tx_id,required"`
	// The virtual size of the transaction, which accounts for SegWit (witness data)
	// scaling rules.
	VSize int64 `json:"v_size,required"`
	// The version number of the transaction, indicating the format or type of the
	// transaction.
	Version int64 `json:"version,required"`
	// The transaction inputs, which refer to the previous transaction outputs that are
	// being spent.
	Vin []TimestampedTransactionDetailsDataVin `json:"vin,required"`
	// The transaction outputs, which specify how much Bitcoin is being sent to which
	// addresses.
	Vout []TimestampedTransactionDetailsDataVout `json:"vout,required"`
	// The weight of the transaction as defined by SegWit rules (v_size \* 4).
	Weight int64                                 `json:"weight,required"`
	JSON   timestampedTransactionDetailsDataJSON `json:"-"`
}

Represents the details of a Bitcoin transaction.

func (*TimestampedTransactionDetailsData) UnmarshalJSON

func (r *TimestampedTransactionDetailsData) UnmarshalJSON(data []byte) (err error)

type TimestampedTransactionDetailsDataVin

type TimestampedTransactionDetailsDataVin struct {
	// The sequence number for the input, which is used for BIP-125 replace-by-fee
	// (RBF).
	Sequence int64 `json:"sequence,required"`
	// The coinbase transaction data (for block rewards) if this is a coinbase
	// transaction.
	Coinbase string `json:"coinbase,nullable"`
	// The witness data (SegWit) for the transaction input.
	TxinWitness []string                                 `json:"txin_witness,nullable"`
	JSON        timestampedTransactionDetailsDataVinJSON `json:"-"`
}

Represents the input of a Bitcoin transaction.

func (*TimestampedTransactionDetailsDataVin) UnmarshalJSON

func (r *TimestampedTransactionDetailsDataVin) UnmarshalJSON(data []byte) (err error)

type TimestampedTransactionDetailsDataVout

type TimestampedTransactionDetailsDataVout struct {
	// The index of this output in the transaction (0-based).
	N int64 `json:"n,required"`
	// Represents the script used to lock/unlock Bitcoin in an output.
	ScriptPubKey TimestampedTransactionDetailsDataVoutScriptPubKey `json:"script_pub_key,required"`
	// The amount of Bitcoin (in BTC) sent to this output.
	Value float64                                   `json:"value,required"`
	JSON  timestampedTransactionDetailsDataVoutJSON `json:"-"`
}

Represents the output of a Bitcoin transaction.

func (*TimestampedTransactionDetailsDataVout) UnmarshalJSON

func (r *TimestampedTransactionDetailsDataVout) UnmarshalJSON(data []byte) (err error)

type TimestampedTransactionDetailsDataVoutScriptPubKey

type TimestampedTransactionDetailsDataVoutScriptPubKey struct {
	// The assembly (ASM) representation of the script, showing the operation codes and
	// operands.
	Asm string `json:"asm,required"`
	// The detailed descriptor of the scriptPubKey, providing more information about
	// the address and script.
	Desc string `json:"desc,required"`
	// The raw hexadecimal representation of the script.
	Hex string `json:"hex,required"`
	// The type of the script (e.g., "scripthash", "pubkeyhash").
	Type string `json:"type,required"`
	// The Bitcoin address to which this output belongs.
	Address string                                                `json:"address,nullable"`
	JSON    timestampedTransactionDetailsDataVoutScriptPubKeyJSON `json:"-"`
}

Represents the script used to lock/unlock Bitcoin in an output.

func (*TimestampedTransactionDetailsDataVoutScriptPubKey) UnmarshalJSON

func (r *TimestampedTransactionDetailsDataVoutScriptPubKey) UnmarshalJSON(data []byte) (err error)

type TimestampedTransactionDetailsLastUpdated

type TimestampedTransactionDetailsLastUpdated struct {
	// The hash of the block
	BlockHash string `json:"block_hash,required"`
	// The height of the block in the blockchain
	BlockHeight int64                                        `json:"block_height,required"`
	JSON        timestampedTransactionDetailsLastUpdatedJSON `json:"-"`
}

func (*TimestampedTransactionDetailsLastUpdated) UnmarshalJSON

func (r *TimestampedTransactionDetailsLastUpdated) UnmarshalJSON(data []byte) (err error)

type TransactionPsbtDecodeParams

type TransactionPsbtDecodeParams struct {
	Body interface{} `json:"body,required"`
}

func (TransactionPsbtDecodeParams) MarshalJSON

func (r TransactionPsbtDecodeParams) MarshalJSON() (data []byte, err error)

type TransactionPsbtService

type TransactionPsbtService struct {
	Options []option.RequestOption
}

TransactionPsbtService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTransactionPsbtService method instead.

func NewTransactionPsbtService

func NewTransactionPsbtService(opts ...option.RequestOption) (r *TransactionPsbtService)

NewTransactionPsbtService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TransactionPsbtService) Decode

Decode PSBT

type TransactionService

type TransactionService struct {
	Options []option.RequestOption
	Psbt    *TransactionPsbtService
}

TransactionService contains methods and other services that help with interacting with the Maestro API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTransactionService method instead.

func NewTransactionService

func NewTransactionService(opts ...option.RequestOption) (r *TransactionService)

NewTransactionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TransactionService) Get

func (r *TransactionService) Get(ctx context.Context, txHash string, opts ...option.RequestOption) (err error)

Information about a specific transaction.

func (*TransactionService) Submit

func (r *TransactionService) Submit(ctx context.Context, body TransactionSubmitParams, opts ...option.RequestOption) (res *string, err error)

Submits a signed transaction to the network.

type TransactionSubmitParams

type TransactionSubmitParams struct {
	Body interface{} `json:"body,required"`
}

func (TransactionSubmitParams) MarshalJSON

func (r TransactionSubmitParams) MarshalJSON() (data []byte, err error)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL