carbium

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 16 Imported by: 0

README

carbium-go

Typed Go client for Carbium's Solana services on services.carbium.sh: JSON-RPC (every served method, DAS included), the quote plane and its REST quote, WebSocket subscriptions, the account API, webhook signature checks, the DCA API on the dex, the token API, and Carbon Stream in its own module. Standard library only, plus one WebSocket package. Go 1.26 or later.

The module never holds a private key, signs or sends on its own: swap and DCA calls return one unsigned transaction for your own wallet to sign, and SendTransaction takes bytes you signed. Every method the module offers is served; what the services do not serve is not here.

go get github.com/carbium-sh/carbium-go

Quick start

A service key (c_serv_…) comes from the dashboard at carbium.sh. Keep it in CARBIUM_KEY. Without one the call reaches the service and is refused with 401, which the quick start prints.

package main

import (
	"context"
	"errors"
	"fmt"
	"os"

	carbium "github.com/carbium-sh/carbium-go"
)

func main() {
	c, err := carbium.NewClient(os.Getenv("CARBIUM_KEY"), nil)
	if err != nil {
		panic(err)
	}
	bh, err := c.GetLatestBlockhash(context.Background(), nil)
	var e *carbium.Error
	if errors.As(err, &e) {
		fmt.Println(e.Kind, e.HTTPStatus, e.Code, e.Reason, e.Message)
		return
	}
	fmt.Println("blockhash", bh.Value.Blockhash, "valid until block height", bh.Value.LastValidBlockHeight, "at slot", bh.Context.Slot)
}

RPC, DAS and the quote plane

Every served method is a method on *carbium.Client that takes a context.Context first. Addresses and signatures are plain strings. Optional configs are pointers; pass nil to leave them out.

ctx := context.Background()

// Standard Solana methods take positional params, as on the wire.
bal, err := c.GetBalance(ctx, "So11111111111111111111111111111111111111112", nil)
accts, err := c.GetMultipleAccounts(ctx, []string{a, b}, &carbium.AccountInfoConfig{Encoding: carbium.EncodingBase64})
fees, err := c.GetPriorityFeeEstimate(ctx, carbium.PriorityFeeEstimateParams{AccountKeys: []string{a}})

// DAS methods take one params struct in Helius field names.
asset, err := c.GetAsset(ctx, carbium.GetAssetParams{ID: mint})
page, err := c.GetAssetsByOwner(ctx, carbium.GetAssetsByOwnerParams{OwnerAddress: owner, Limit: carbium.Ptr[uint64](1000)})

// Any served method by name, decoded into your own value.
var slot uint64
err = c.Call(ctx, "getSlot", []any{map[string]string{"commitment": "confirmed"}}, &slot)

// A JSON-RPC batch: 1 to 100 calls, at most two permit methods, DAS only with DAS. Scans, getSupply,
// getLargestAccounts, the fee extras, getTransactionsForAddress and the quote plane never batch.
res, err := c.Batch(ctx, []carbium.BatchCall{{Method: "getSlot"}, {Method: "getHealth"}})
err = res[0].Decode(&slot)

getTransaction and getBlock send maxSupportedTransactionVersion: 1 unless your config sets it.

Token scans (getTokenAccountsByOwner, getTokenAccountsByDelegate) are billed by rows, up to 100,005 credits; getProgramAccounts costs 505; a getTransactionsForAddress walk costs 55 plus 50 per upstream call, up to 51,255 at limit 1000. Name a mint, keep limit small, and read the method notes at https://carbium.sh/skill.md before running one in a loop.

Swap: quote, build, sign with your own wallet, send

The quote plane needs the account's quote module (free plan) and a key with the quote scope.

q, err := c.Quote(ctx, carbium.QuoteParams{SrcMint: sol, DstMint: usdc, AmountIn: "100000000", SlippageBps: 50})
swap, err := c.Swap(ctx, carbium.SwapParams{QuoteID: q.QuoteID, UserPubkey: wallet})
// swap.Transaction is one unsigned v0 transaction, base64; your wallet is its only signer.
// Sign it with your own wallet library, then:
sig, err := c.SendTransaction(ctx, signedBase64, &carbium.SendTransactionConfig{Encoding: carbium.BinaryEncodingBase64, SkipPreflight: carbium.Ptr(true)})

Then poll GetSignatureStatuses and resend the same bytes until the block height passes swap.LastValidBlockHeight. The module never retries SendTransaction. Quote again (never re-sign the old message) when the blockhash expires or when Swap answers a route error that asks for a new quote.

The REST form of the quote is Cq1Quote, on the same key, scope and rate as Quote:

rq, err := c.Cq1Quote(ctx, carbium.Cq1QuoteParams{SrcMint: sol, DstMint: usdc, AmountIn: 100000000, SlippageBps: 50})

Errors and retries

Every failure is a *carbium.Error; check it with errors.As.

Field Meaning
Kind auth, credits, rate_limit, request, upstream, node, route, transport, socket, stream, account, dca, tokens, webhook
HTTPStatus the HTTP status, 0 when nothing answered
Code the JSON-RPC code or a close code
ErrorCode the account, DCA or token API's error string
Reason the service's error.data.reason, a close reason or a webhook check's reason
Retryable whether waiting and sending the same request can change the answer
RetryAfter the server's wait hint
RequestID x-request-id, to quote to support
Data error.data as served

The retry policy is the one published in skill.md and applies to every HTTP call on services.carbium.sh: wait the larger of the server's hint (retry-after-ms, else retryAfterMs in the error's data, else Retry-After) and 250 ms doubling to 4 s, plus up to 250 ms of jitter; a hint is never cut, and a hint over MaxHint (30 s by default) is not waited for: the error comes back at once with it in RetryAfter; at most 4 attempts unless the published row says otherwise (a scan index behind: about 6 from 100 ms). SendTransaction, 401, 402 (credits exhausted), 403, bad params (apart from GetTransactionsForAddress's -32602 "the walk read no history", which is retried), unknown methods and every answer marked retryable: false are never retried. Options{MaxAttempts: 1} turns retries off; MaxAttempts lowers the attempt count. Each attempt times out after 100 s by default.

Keys never appear in error messages, data, URLs or formatted output: %v, %+v and %#v of a client or an error show a placeholder. A key in an endpoint URL is refused.

WebSocket subscriptions

import "github.com/carbium-sh/carbium-go/ws"

s, err := ws.New(os.Getenv("CARBIUM_KEY"), &ws.Options{OnReseed: func(last ws.CloseInfo, gap bool) { reloadStateOverRPC() }})
sub, err := s.AccountSubscribe(pubkey, &ws.AccountConfig{Commitment: carbium.CommitmentConfirmed},
	func(n carbium.WithContext[carbium.AccountInfo]) { fmt.Println(n.Context.Slot, n.Value.Lamports) })
id, err := sub.Ready(ctx)
err = sub.Unsubscribe(ctx)

All eight served subscriptions have a method (AccountSubscribe, ProgramSubscribe, LogsSubscribe, SignatureSubscribe, SlotSubscribe, RootSubscribe, SlotsUpdatesSubscribe, BlockSubscribe). The socket follows the server's close codes: it reconnects and binds every live subscription again after 1013, 1012, 1001 and network drops, reconnects once after 1008 credits_exhausted, and stops with OnFatal on a key refusal. Nothing is replayed by the server after a disconnect: OnReseed runs after every reconnect so you read again what you may have missed (gap is true after stream_gap_reseed_required). SignatureSubscribe fires once; after a reconnect, check GetSignatureStatuses. Callbacks run on the socket's reader and must not block.

The key travels in the x-api-key handshake header by default; Carrier: "subprotocol" sends it in Sec-WebSocket-Protocol instead, the form browsers need. Unsubscribe returns before its frame is necessarily written, so a program that exits at once may not have told the server (closing the socket ends its subscriptions either way). A refused handshake comes to both OnFatal and Ready, so a caller that prints in both prints twice.

Carbon Stream (Yellowstone gRPC)

Carbon Stream is its own module, so gRPC never enters this one: go get github.com/carbium-sh/carbium-go/stream. The key needs the grpc scope and a plan with streams; it travels as x-token metadata.

import (
	"github.com/carbium-sh/carbium-go/stream"
	"github.com/carbium-sh/carbium-go/stream/geyserpb"
	"google.golang.org/protobuf/proto"
)

sc, err := stream.Connect(os.Getenv("CARBIUM_KEY"), nil)
live, err := sc.SubscribeWithReconnect(ctx, stream.Filters{
	Transactions: map[string]*geyserpb.SubscribeRequestFilterTransactions{"pool": {AccountInclude: []string{programID}, Vote: proto.Bool(false)}},
}, stream.Handlers{
	OnUpdate: func(u *geyserpb.SubscribeUpdate) { /* must not block */ },
	OnReseed: func(ctx context.Context, lastSlot *uint64) { reloadOverRPC() },
})
// later
live.Close()

SubscribeWithReconnect puts the whole filter set in the first message (a filter change needs a new stream), pings every 10 s, retries with the published waits, re-seeds through OnReseed on OUT_OF_RANGE, and resumes from the last slot when the retained floor allows. A replay can start one slot before from_slot and overlap what you already have: dedupe transactions on (slot, signature) and accounts on (pubkey, slot, writeVersion). Fields the service refuses (token_accounts, cuckoo filters, include_update_parent) are caught before any call. The seven unary calls (GetSlot, GetBlockHeight, GetLatestBlockhash, IsBlockhashValid, GetVersion, Ping, SubscribeReplayInfo) are on the same client. The geyserpb types are generated from the upstream Yellowstone protos (Apache-2.0, see stream/NOTICE).

Webhooks

import "github.com/carbium-sh/carbium-go/webhooks"

// in your HTTPS handler, with the RAW body bytes (never a re-encoded JSON string)
events, err := webhooks.Verify(rawBody, r.Header, os.Getenv("CARBIUM_WEBHOOK_SECRET"), nil)

Standard Webhooks: HMAC-SHA256 over webhook-id.webhook-timestamp.body with the secret's base64 after whsec_, v1, entries in webhook-signature (two during a rotation), compared in constant time, 300 s of clock tolerance. Header names match in any case, from an http.Header or a plain map. A timestamp or clock that cannot be compared is refused as stale. Errors are kind webhook with reason missing_header, bad_timestamp, stale, bad_secret, no_match or bad_json. Dedupe on webhook-id: it stays the same across retries.

Account API

An account API key (c_acct_…, made on the dashboard; keep it in CARBIUM_ACCOUNT_KEY) runs the account by API: service keys, webhooks, usage and records. Calls cost no credits; 600 per 10 minutes per key. Nothing here is retried, because creates are not safe to repeat.

import "github.com/carbium-sh/carbium-go/account"

a, err := account.New(os.Getenv("CARBIUM_ACCOUNT_KEY"), nil)
keys, err := a.Keys.List(ctx)
created, err := a.Webhooks.Create(ctx, account.WebhooksCreateReq{KeyID: keys[0].KeyID, URL: "https://hooks.example.com/carbium", Addresses: []string{wallet}})
result, err := a.Webhooks.Test(ctx, created.Webhook.WebhookID) // read result.Outcome
secret := created.Secret.Reveal() // shown once: store it

Groups: Keys (List, Create, Rotate, Revoke, Delete, Rename, SetScope, SetCaps, SetAllowlist, SetLimits), Webhooks (List, Get, Deliveries, Create, Update, Delete, RotateSecret, Test), Usage (Daily, PerKey, Load, Hourly, Latency), Account (Get, Balance, Invoices, Payments, Modules, CryptoIntent), Modules.EnableFree, Self, Activity. A key or secret the service shows once comes back as carbium.Secret, which prints as a placeholder; Reveal returns it. account.Session and the sign-in functions cover the dashboard session calls. Payments, plan changes and closing the account stay on the dashboard.

DCA API

import "github.com/carbium-sh/carbium-go/dca"

d, err := dca.New(nil)
q, err := d.Quote(ctx, dca.QuoteRequest{InputMint: usdc, OutputMint: sol, Amount: 1000000})
per := dca.U64(1000000)
build, err := d.Open(ctx, dca.OpenRequest{Owner: owner, InputMint: usdc, OutputMint: sol, Cycles: 10, AmountPerCycle: &per, Frequency: "daily"})
// build.TxnBase64 is unsigned: sign it with the owner's wallet, then send it yourself or relay it:
sent, err := d.Send(ctx, dca.SendRequest{TxnBase64: signedBase64})

Reads: Quote, Positions, History, Position, Health. Builders: Open, Update, Withdraw, Close. Send relays bytes the owner signed, once. Server side only: a browser page is refused with forbidden_origin. Errors are kind dca with the API's err string as ErrorCode.

Token API

import "github.com/carbium-sh/carbium-go/tokens"

t, err := tokens.New(nil)
sol, err := t.Lookup(ctx, "So11111111111111111111111111111111111111112") // nil when unknown
top, err := t.Search(ctx, "", &tokens.SearchOptions{Limit: 20})
b, err := t.Batch(ctx, mints) // up to 500
src := t.ImageURL(mint)

Keyless, 300 requests a minute per client. These four calls are the token API's public routes.

Limits checked before sending

Body 51,200 bytes; batch 1 to 100 calls with at most two permit methods; DAS only with DAS; methods that never batch are refused in a batch; a method the services do not serve is refused before it is sent; token Batch up to 500 mints.

Working on this module

go generate ./... rewrites methods_gen.go from spec/openrpc.json and account/account_gen.go from spec/account-openapi.json, and fails on anything it cannot type; CI checks both are current. Run git config core.hooksPath hooks once per clone: the pre-push hook runs scripts/leak-check.sh.

MIT. Issues: https://github.com/carbium-sh/carbium-go/issues. Docs: https://carbium.sh/docs and https://carbium.sh/skill.md.

Documentation

Overview

Package carbium is a typed Go client for Carbium's Solana services on services.carbium.sh: every served JSON-RPC method (Solana RPC, DAS and the quote plane) as a method on Client, with the published retry rules and the service's limits checked before a request is sent.

The module never holds a private key, signs or sends on its own. Swap and the DCA builders return one unsigned transaction for the caller's own wallet; SendTransaction relays bytes the caller already signed, once.

Sub-packages: account (the account API on carbium.sh), dca (the DCA API), tokens (the token API), webhooks (the delivery signature check) and ws (WebSocket subscriptions). Carbon Stream is the separate module github.com/carbium-sh/carbium-go/stream, so gRPC stays out of this module's dependencies.

Every failure is an *Error; check it with errors.As. A key never appears in an error, a URL or formatted output.

Example

The README's quick start, as pkg.go.dev shows it. It needs a key and the network, so it has no Output line and is never run by go test; TestEveryGoBlockInTheReadmeVets compiles the README's own copy.

package main

import (
	"context"
	"errors"
	"fmt"
	"os"

	carbium "github.com/carbium-sh/carbium-go"
)

func main() {
	c, err := carbium.NewClient(os.Getenv("CARBIUM_KEY"), nil)
	if err != nil {
		panic(err)
	}
	bh, err := c.GetLatestBlockhash(context.Background(), nil)
	var e *carbium.Error
	if errors.As(err, &e) {
		fmt.Println(e.Kind, e.HTTPStatus, e.Code, e.Reason, e.Message)
		return
	}
	fmt.Println("blockhash", bh.Value.Blockhash, "valid until block height", bh.Value.LastValidBlockHeight, "at slot", bh.Context.Slot)
}

Index

Examples

Constants

View Source
const (
	// MaxBodyBytes is the largest request body; a bigger one is refused with 413.
	MaxBodyBytes = 51200
	// MaxBatch is the most calls in one JSON-RPC batch.
	MaxBatch = 100
	// MaxPermitPerBatch is the most methods holding a node slot (MethodSpec.Permit) in one batch.
	MaxPermitPerBatch = 2
)

Wire limits of services.carbium.sh, checked before a request is sent.

View Source
const DefaultEndpoint = "https://services.carbium.sh"

DefaultEndpoint is where the client sends calls unless Options.Endpoint says otherwise.

View Source
const Version = "0.1.0"

Version is this module's version, sent in the solana-client header.

Variables

This section is empty.

Functions

func CheckEndpoint

func CheckEndpoint(endpoint string, schemes ...string) error

CheckEndpoint refuses an endpoint that carries a key or is not an http, https, ws or wss URL. The sub-packages use it; the endpoint itself is never echoed, since it may hold a key.

func Methods

func Methods() []string

Methods lists every served JSON-RPC method, sorted.

func NoRedirects

func NoRedirects(hc *http.Client) *http.Client

NoRedirects returns a copy of hc (a new client when nil) that never follows a redirect: a 3xx comes back as the answer, so a key header never reaches another host. Every client in this module uses it.

func Ptr

func Ptr[T any](v T) *T

Ptr returns a pointer to v, for the optional numbers and flags of a config.

func RESTRoutes

func RESTRoutes() []string

RESTRoutes lists every served REST route on the services endpoint, sorted.

func RedactSecrets

func RedactSecrets(text string) string

RedactSecrets replaces service keys, account keys, webhook secrets and key-bearing URL parts with a placeholder.

func RetryAfterHeader

func RetryAfterHeader(h http.Header) (time.Duration, bool)

RetryAfterHeader reads a Retry-After header (whole seconds or an HTTP date) as a wait. The sub-packages use it.

func Subscriptions

func Subscriptions() []string

Subscriptions lists every served WebSocket subscription, sorted.

Types

type AccountDataEncoding

type AccountDataEncoding string

AccountDataEncoding is one of: base58, base64, base64+zstd. A value not listed here is kept as sent.

const (
	AccountDataEncodingBase58     AccountDataEncoding = "base58"
	AccountDataEncodingBase64     AccountDataEncoding = "base64"
	AccountDataEncodingBase64Zstd AccountDataEncoding = "base64+zstd"
)

type AccountInfo

type AccountInfo struct {
	Lamports   uint64      `json:"lamports"`
	Owner      string      `json:"owner"`
	Data       EncodedData `json:"data"`
	Executable bool        `json:"executable"`
	RentEpoch  uint64      `json:"rentEpoch"`
	Space      *uint64     `json:"space,omitempty"`
}

AccountInfo is sent or received as the spec's AccountInfo.

type AccountInfoConfig

type AccountInfoConfig struct {
	Commitment     Commitment `json:"commitment,omitempty"`
	MinContextSlot *uint64    `json:"minContextSlot,omitempty"`
	Encoding       Encoding   `json:"encoding,omitempty"`
	DataSlice      *DataSlice `json:"dataSlice,omitempty"`
}

AccountInfoConfig is sent or received as the spec's AccountInfoConfig.

type AccountKeySource

type AccountKeySource string

AccountKeySource is one of: transaction, lookupTable. A value not listed here is kept as sent.

const (
	AccountKeySourceTransaction AccountKeySource = "transaction"
	AccountKeySourceLookupTable AccountKeySource = "lookupTable"
)

type AddressHistoryDetails

type AddressHistoryDetails string

AddressHistoryDetails is one of: signatures, full. A value not listed here is kept as sent.

const (
	AddressHistoryDetailsSignatures AddressHistoryDetails = "signatures"
	AddressHistoryDetailsFull       AddressHistoryDetails = "full"
)

type AddressTransaction

type AddressTransaction struct {
	Signature          string              `json:"signature,omitempty"`
	Slot               uint64              `json:"slot"`
	Err                TransactionError    `json:"err,omitempty"`
	Memo               *string             `json:"memo,omitempty"`
	BlockTime          *int64              `json:"blockTime,omitempty"`
	ConfirmationStatus *Commitment         `json:"confirmationStatus,omitempty"`
	TransactionIndex   *uint64             `json:"transactionIndex,omitempty"`
	Transaction        *EncodedTransaction `json:"transaction,omitempty"`
	Meta               *TransactionMeta    `json:"meta,omitempty"`
	Version            TxVersion           `json:"version,omitempty"`
}

AddressTransaction is sent or received as the spec's TransactionsForAddress.data[]. One of these shapes: {signature, slot, err, memo, blockTime} or {meta, slot, transaction, transactionIndex}.

type BatchCall

type BatchCall struct {
	Method string
	Params any
}

BatchCall is one call of a batch.

type BatchResult

type BatchResult struct {
	Result json.RawMessage
	Err    *Error
}

BatchResult is the answer to one call of a batch: Result, or Err when that call failed.

func (BatchResult) Decode

func (r BatchResult) Decode(out any) error

Decode reads the result into out, or returns the call's error.

type BinaryEncoding

type BinaryEncoding string

BinaryEncoding is one of: base58, base64. A value not listed here is kept as sent.

const (
	BinaryEncodingBase58 BinaryEncoding = "base58"
	BinaryEncodingBase64 BinaryEncoding = "base64"
)

type Block

type Block struct {
	Blockhash           string             `json:"blockhash"`
	PreviousBlockhash   string             `json:"previousBlockhash"`
	ParentSlot          uint64             `json:"parentSlot"`
	BlockHeight         *uint64            `json:"blockHeight"`
	BlockTime           *int64             `json:"blockTime"`
	Transactions        []BlockTransaction `json:"transactions,omitempty"`
	Signatures          []string           `json:"signatures,omitempty"`
	Rewards             []Reward           `json:"rewards,omitempty"`
	NumRewardPartitions *uint64            `json:"numRewardPartitions,omitempty"`
}

Block is sent or received as the spec's Block.

type BlockCommitment

type BlockCommitment struct {
	Commitment []uint64 `json:"commitment"`
	TotalStake uint64   `json:"totalStake"`
}

BlockCommitment is sent or received as the spec's BlockCommitment.

type BlockConfig

type BlockConfig struct {
	Commitment                     Commitment          `json:"commitment,omitempty"`
	MinContextSlot                 *uint64             `json:"minContextSlot,omitempty"`
	Encoding                       TransactionEncoding `json:"encoding,omitempty"`
	MaxSupportedTransactionVersion *uint64             `json:"maxSupportedTransactionVersion,omitempty"`
	TransactionDetails             TransactionDetails  `json:"transactionDetails,omitempty"`
	Rewards                        *bool               `json:"rewards,omitempty"`
}

BlockConfig is sent or received as the spec's BlockConfig.

type BlockEncoding

type BlockEncoding string

BlockEncoding is one of: json, base64, base58. A value not listed here is kept as sent.

const (
	BlockEncodingJSON   BlockEncoding = "json"
	BlockEncodingBase64 BlockEncoding = "base64"
	BlockEncodingBase58 BlockEncoding = "base58"
)

type BlockNotification

type BlockNotification struct {
	Slot  uint64           `json:"slot"`
	Err   TransactionError `json:"err"`
	Block *Block           `json:"block"`
}

BlockNotification is sent or received as the spec's WithContext_BlockNotification.value.

type BlockProduction

type BlockProduction struct {
	ByIdentity map[string]BlockProductionCount `json:"byIdentity"`
	Range      BlockProductionRange            `json:"range"`
}

BlockProduction is sent or received as the spec's BlockProduction.

type BlockProductionConfig

type BlockProductionConfig struct {
	Commitment Commitment                  `json:"commitment,omitempty"`
	Identity   string                      `json:"identity,omitempty"`
	Range      *BlockProductionConfigRange `json:"range,omitempty"`
}

BlockProductionConfig is sent or received as the spec's BlockProductionConfig.

type BlockProductionConfigRange

type BlockProductionConfigRange struct {
	FirstSlot uint64  `json:"firstSlot"`
	LastSlot  *uint64 `json:"lastSlot,omitempty"`
}

BlockProductionConfigRange is sent or received as the spec's BlockProductionConfig.range.

type BlockProductionCount

type BlockProductionCount struct {
	LeaderSlots    uint64
	BlocksProduced uint64
}

BlockProductionCount travels as a JSON array of 2 items; items after them are ignored.

func (BlockProductionCount) MarshalJSON

func (t BlockProductionCount) MarshalJSON() ([]byte, error)

func (*BlockProductionCount) UnmarshalJSON

func (t *BlockProductionCount) UnmarshalJSON(b []byte) error

type BlockProductionRange

type BlockProductionRange struct {
	FirstSlot uint64 `json:"firstSlot"`
	LastSlot  uint64 `json:"lastSlot"`
}

BlockProductionRange is sent or received as the spec's BlockProduction.range.

type BlockSubscribeDetails

type BlockSubscribeDetails string

BlockSubscribeDetails is one of: full, signatures, none. A value not listed here is kept as sent.

const (
	BlockSubscribeDetailsFull       BlockSubscribeDetails = "full"
	BlockSubscribeDetailsSignatures BlockSubscribeDetails = "signatures"
	BlockSubscribeDetailsNone       BlockSubscribeDetails = "none"
)

type BlockTransaction

type BlockTransaction struct {
	Transaction EncodedTransaction `json:"transaction"`
	Meta        *TransactionMeta   `json:"meta"`
	Version     TxVersion          `json:"version,omitempty"`
}

BlockTransaction is sent or received as the spec's Block.transactions[].

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client calls services.carbium.sh: every served JSON-RPC method (Solana RPC, DAS and the quote plane), with the published retry rules. It is safe for concurrent use. Make it with NewClient: the zero value refuses every call. It never prints its key: %v, %+v and %#v show a placeholder.

func NewClient

func NewClient(apiKey string, opts *Options) (*Client, error)

NewClient makes a Client for a service key (c_serv_…, shown once on the dashboard). An empty key makes a keyless client, which the service answers with 401. An account key (c_acct_…) is refused: it is for package account.

func (*Client) Batch

func (cl *Client) Batch(ctx context.Context, calls []BatchCall) ([]BatchResult, error)

Batch sends 1 to 100 calls in one JSON-RPC batch and returns their answers in the order sent. A batch the service would refuse is refused before it is sent: a name it does not serve, a method that never batches, DAS mixed with other methods, more than two permit methods, or a body over 51,200 bytes. A refusal of the whole batch is returned as the error; a failed call comes back in its BatchResult.

func (*Client) Call

func (cl *Client) Call(ctx context.Context, method string, params any, out any) error

Call sends any served method by name with params as given (a slice for positional params, a struct or map for by-name ones) and decodes the result into out, which may be nil. A name the services do not serve is refused before anything is sent.

func (*Client) Cq1Quote

func (cl *Client) Cq1Quote(ctx context.Context, params Cq1QuoteParams) (*Cq1Quote, error)

Cq1Quote calls GET /cq1/quote, the REST form of the quote. It is admitted as the quote method (same scope, plan and rate) and follows the same retry rules. A parameter fault comes back as kind request with the service's text as the message; a pair with no route (HTTP 422) is kind route. Neither is retried.

func (*Client) Endpoint

func (cl *Client) Endpoint() string

Endpoint is the URL the client sends calls to.

func (*Client) Format

func (cl *Client) Format(f fmt.State, verb rune)

Format prints the client with every verb, with the key as a placeholder.

func (*Client) GetAccountInfo

func (c *Client) GetAccountInfo(ctx context.Context, pubkey string, config *AccountInfoConfig) (*WithContext[*AccountInfo], error)

GetAccountInfo calls getAccountInfo. A batch holds at most two methods of its class.

func (*Client) GetAgGenesisCert

func (c *Client) GetAgGenesisCert(ctx context.Context) (json.RawMessage, error)

GetAgGenesisCert calls getAgGenesisCert.

func (*Client) GetAsset

func (c *Client) GetAsset(ctx context.Context, params GetAssetParams) (*DASAsset, error)

GetAsset calls getAsset. It shares a batch only with other DAS methods.

func (*Client) GetAssetBatch

func (c *Client) GetAssetBatch(ctx context.Context, params GetAssetsParams) ([]*DASAsset, error)

GetAssetBatch calls getAssetBatch. It shares a batch only with other DAS methods.

func (*Client) GetAssets

func (c *Client) GetAssets(ctx context.Context, params GetAssetsParams) ([]*DASAsset, error)

GetAssets calls getAssets. It shares a batch only with other DAS methods.

func (*Client) GetAssetsByAuthority

func (c *Client) GetAssetsByAuthority(ctx context.Context, params GetAssetsByAuthorityParams) (*DASAssetList, error)

GetAssetsByAuthority calls getAssetsByAuthority. It shares a batch only with other DAS methods.

func (*Client) GetAssetsByCreator

func (c *Client) GetAssetsByCreator(ctx context.Context, params GetAssetsByCreatorParams) (*DASAssetList, error)

GetAssetsByCreator calls getAssetsByCreator. It shares a batch only with other DAS methods.

func (*Client) GetAssetsByGroup

func (c *Client) GetAssetsByGroup(ctx context.Context, params GetAssetsByGroupParams) (*DASAssetList, error)

GetAssetsByGroup calls getAssetsByGroup. It shares a batch only with other DAS methods.

func (*Client) GetAssetsByOwner

func (c *Client) GetAssetsByOwner(ctx context.Context, params GetAssetsByOwnerParams) (*DASAssetList, error)

GetAssetsByOwner calls getAssetsByOwner. It shares a batch only with other DAS methods.

func (*Client) GetBalance

func (c *Client) GetBalance(ctx context.Context, pubkey string, config *CommitmentConfig) (*WithContext[uint64], error)

GetBalance calls getBalance.

func (*Client) GetBlock

func (c *Client) GetBlock(ctx context.Context, slot uint64, config *BlockConfig) (*Block, error)

GetBlock calls getBlock. maxSupportedTransactionVersion is sent as 1 unless config sets it.

func (*Client) GetBlockCommitment

func (c *Client) GetBlockCommitment(ctx context.Context, slot uint64) (*BlockCommitment, error)

GetBlockCommitment calls getBlockCommitment.

func (*Client) GetBlockHeight

func (c *Client) GetBlockHeight(ctx context.Context, config *CommitmentConfig) (uint64, error)

GetBlockHeight calls getBlockHeight.

func (*Client) GetBlockProduction

func (c *Client) GetBlockProduction(ctx context.Context, config *BlockProductionConfig) (*WithContext[BlockProduction], error)

GetBlockProduction calls getBlockProduction.

func (*Client) GetBlockTime

func (c *Client) GetBlockTime(ctx context.Context, slot uint64) (*int64, error)

GetBlockTime calls getBlockTime.

func (*Client) GetBlocks

func (c *Client) GetBlocks(ctx context.Context, startSlot uint64, endSlot *uint64, config *CommitmentOnlyConfig) ([]uint64, error)

GetBlocks calls getBlocks. A batch holds at most two methods of its class.

func (*Client) GetBlocksWithLimit

func (c *Client) GetBlocksWithLimit(ctx context.Context, startSlot uint64, limit uint64, config *CommitmentOnlyConfig) ([]uint64, error)

GetBlocksWithLimit calls getBlocksWithLimit. A batch holds at most two methods of its class.

func (*Client) GetClusterNodes

func (c *Client) GetClusterNodes(ctx context.Context) ([]ClusterNode, error)

GetClusterNodes calls getClusterNodes.

func (*Client) GetEpochInfo

func (c *Client) GetEpochInfo(ctx context.Context, config *CommitmentConfig) (*EpochInfo, error)

GetEpochInfo calls getEpochInfo.

func (*Client) GetEpochSchedule

func (c *Client) GetEpochSchedule(ctx context.Context) (*EpochSchedule, error)

GetEpochSchedule calls getEpochSchedule.

func (*Client) GetFeeForMessage

func (c *Client) GetFeeForMessage(ctx context.Context, message string, config *CommitmentConfig) (*WithContext[*uint64], error)

GetFeeForMessage calls getFeeForMessage.

func (*Client) GetFirstAvailableBlock

func (c *Client) GetFirstAvailableBlock(ctx context.Context) (uint64, error)

GetFirstAvailableBlock calls getFirstAvailableBlock.

func (*Client) GetGenesisHash

func (c *Client) GetGenesisHash(ctx context.Context) (string, error)

GetGenesisHash calls getGenesisHash.

func (*Client) GetHealth

func (c *Client) GetHealth(ctx context.Context) (string, error)

GetHealth calls getHealth.

func (*Client) GetHighestSnapshotSlot

func (c *Client) GetHighestSnapshotSlot(ctx context.Context) (*HighestSnapshotSlot, error)

GetHighestSnapshotSlot calls getHighestSnapshotSlot.

func (*Client) GetIdentity

func (c *Client) GetIdentity(ctx context.Context) (*GetIdentityResult, error)

GetIdentity calls getIdentity.

func (*Client) GetInflationGovernor

func (c *Client) GetInflationGovernor(ctx context.Context, config *CommitmentOnlyConfig) (*InflationGovernor, error)

GetInflationGovernor calls getInflationGovernor.

func (*Client) GetInflationRate

func (c *Client) GetInflationRate(ctx context.Context) (*InflationRate, error)

GetInflationRate calls getInflationRate.

func (*Client) GetInflationReward

func (c *Client) GetInflationReward(ctx context.Context, addresses []string, config *GetInflationRewardConfig) ([]*InflationReward, error)

GetInflationReward calls getInflationReward. A batch holds at most two methods of its class.

func (*Client) GetLargestAccounts

func (c *Client) GetLargestAccounts(ctx context.Context, config *CommitmentConfig) (*WithContext[[]LargestAccount], error)

GetLargestAccounts calls getLargestAccounts. It never shares a batch.

func (*Client) GetLatestBlockhash

func (c *Client) GetLatestBlockhash(ctx context.Context, config *CommitmentConfig) (*WithContext[LatestBlockhash], error)

GetLatestBlockhash calls getLatestBlockhash.

func (*Client) GetLeaderSchedule

func (c *Client) GetLeaderSchedule(ctx context.Context, slot *uint64, config *LeaderScheduleConfig) (map[string][]uint64, error)

GetLeaderSchedule calls getLeaderSchedule. A batch holds at most two methods of its class.

func (*Client) GetMaxRetransmitSlot

func (c *Client) GetMaxRetransmitSlot(ctx context.Context) (uint64, error)

GetMaxRetransmitSlot calls getMaxRetransmitSlot.

func (*Client) GetMaxShredInsertSlot

func (c *Client) GetMaxShredInsertSlot(ctx context.Context) (uint64, error)

GetMaxShredInsertSlot calls getMaxShredInsertSlot.

func (*Client) GetMinimumBalanceForRentExemption

func (c *Client) GetMinimumBalanceForRentExemption(ctx context.Context, dataLength uint64, config *CommitmentOnlyConfig) (uint64, error)

GetMinimumBalanceForRentExemption calls getMinimumBalanceForRentExemption.

func (*Client) GetMultipleAccounts

func (c *Client) GetMultipleAccounts(ctx context.Context, pubkeys []string, config *AccountInfoConfig) (*WithContext[[]*AccountInfo], error)

GetMultipleAccounts calls getMultipleAccounts. A batch holds at most two methods of its class.

func (*Client) GetNFTEditions

func (c *Client) GetNFTEditions(ctx context.Context, params GetNFTEditionsParams) (*DASEditionList, error)

GetNFTEditions calls getNftEditions. It shares a batch only with other DAS methods.

func (*Client) GetPriorityFeeEstimate

func (c *Client) GetPriorityFeeEstimate(ctx context.Context, params PriorityFeeEstimateParams) (*PriorityFeeEstimate, error)

GetPriorityFeeEstimate calls getPriorityFeeEstimate. It never shares a batch.

func (*Client) GetProgramAccounts

func (c *Client) GetProgramAccounts(ctx context.Context, programID string, config *ProgramAccountsConfig) (*ProgramAccounts, error)

GetProgramAccounts calls getProgramAccounts. It never shares a batch.

func (*Client) GetRecentPerformanceSamples

func (c *Client) GetRecentPerformanceSamples(ctx context.Context, limit *uint64) ([]PerformanceSample, error)

GetRecentPerformanceSamples calls getRecentPerformanceSamples.

func (*Client) GetRecentPrioritizationFees

func (c *Client) GetRecentPrioritizationFees(ctx context.Context, addresses []string) ([]PrioritizationFee, error)

GetRecentPrioritizationFees calls getRecentPrioritizationFees.

func (*Client) GetSignatureStatuses

func (c *Client) GetSignatureStatuses(ctx context.Context, signatures []string, config *GetSignatureStatusesConfig) (*WithContext[[]*SignatureStatus], error)

GetSignatureStatuses calls getSignatureStatuses.

func (*Client) GetSignaturesForAddress

func (c *Client) GetSignaturesForAddress(ctx context.Context, address string, config *SignaturesForAddressConfig) ([]SignatureInfo, error)

GetSignaturesForAddress calls getSignaturesForAddress. A batch holds at most two methods of its class.

func (*Client) GetSlot

func (c *Client) GetSlot(ctx context.Context, config *CommitmentConfig) (uint64, error)

GetSlot calls getSlot.

func (*Client) GetSlotLeader

func (c *Client) GetSlotLeader(ctx context.Context, config *CommitmentConfig) (string, error)

GetSlotLeader calls getSlotLeader.

func (*Client) GetSlotLeaders

func (c *Client) GetSlotLeaders(ctx context.Context, startSlot uint64, limit uint64) ([]string, error)

GetSlotLeaders calls getSlotLeaders. A batch holds at most two methods of its class.

func (*Client) GetStakeMinimumDelegation

func (c *Client) GetStakeMinimumDelegation(ctx context.Context, config *CommitmentOnlyConfig) (*WithContext[uint64], error)

GetStakeMinimumDelegation calls getStakeMinimumDelegation.

func (*Client) GetSupply

func (c *Client) GetSupply(ctx context.Context, config *GetSupplyConfig) (*WithContext[Supply], error)

GetSupply calls getSupply. It never shares a batch.

func (*Client) GetTokenAccountBalance

func (c *Client) GetTokenAccountBalance(ctx context.Context, tokenAccount string, config *CommitmentOnlyConfig) (*WithContext[TokenAmount], error)

GetTokenAccountBalance calls getTokenAccountBalance. A batch holds at most two methods of its class.

func (*Client) GetTokenAccounts

func (c *Client) GetTokenAccounts(ctx context.Context, params GetTokenAccountsParams) (*DASTokenAccountList, error)

GetTokenAccounts calls getTokenAccounts. It shares a batch only with other DAS methods.

func (*Client) GetTokenAccountsByDelegate

func (c *Client) GetTokenAccountsByDelegate(ctx context.Context, delegate string, filter TokenAccountsFilter, config *AccountInfoConfig) (*WithContext[[]KeyedAccount], error)

GetTokenAccountsByDelegate calls getTokenAccountsByDelegate. It never shares a batch.

func (*Client) GetTokenAccountsByOwner

func (c *Client) GetTokenAccountsByOwner(ctx context.Context, owner string, filter TokenAccountsFilter, config *AccountInfoConfig) (*WithContext[[]KeyedAccount], error)

GetTokenAccountsByOwner calls getTokenAccountsByOwner. It never shares a batch.

func (*Client) GetTokenSupply

func (c *Client) GetTokenSupply(ctx context.Context, mint string, config *CommitmentOnlyConfig) (*WithContext[TokenAmount], error)

GetTokenSupply calls getTokenSupply. A batch holds at most two methods of its class.

func (*Client) GetTransaction

func (c *Client) GetTransaction(ctx context.Context, signature string, config *TransactionConfig) (*TransactionWithMeta, error)

GetTransaction calls getTransaction. A batch holds at most two methods of its class. maxSupportedTransactionVersion is sent as 1 unless config sets it.

func (*Client) GetTransactionCount

func (c *Client) GetTransactionCount(ctx context.Context, config *CommitmentConfig) (uint64, error)

GetTransactionCount calls getTransactionCount.

func (*Client) GetTransactionsForAddress

func (c *Client) GetTransactionsForAddress(ctx context.Context, address string, config *TransactionsForAddressConfig) (*TransactionsForAddress, error)

GetTransactionsForAddress calls getTransactionsForAddress. It never shares a batch. A batch holds at most two methods of its class.

func (*Client) GetVersion

func (c *Client) GetVersion(ctx context.Context) (*VersionInfo, error)

GetVersion calls getVersion.

func (*Client) GetVoteAccounts

func (c *Client) GetVoteAccounts(ctx context.Context, config *VoteAccountsConfig) (*VoteAccounts, error)

GetVoteAccounts calls getVoteAccounts.

func (*Client) GoString

func (cl *Client) GoString() string

func (*Client) Health

func (c *Client) Health(ctx context.Context) (*QuoteHealth, error)

Health calls health. It never shares a batch.

func (*Client) IsBlockhashValid

func (c *Client) IsBlockhashValid(ctx context.Context, blockhash string, config *CommitmentConfig) (*WithContext[bool], error)

IsBlockhashValid calls isBlockhashValid.

func (*Client) MinimumLedgerSlot

func (c *Client) MinimumLedgerSlot(ctx context.Context) (uint64, error)

MinimumLedgerSlot calls minimumLedgerSlot.

func (*Client) Prices

func (c *Client) Prices(ctx context.Context, params PricesParams) (*Prices, error)

Prices calls prices. It never shares a batch.

func (*Client) QnEstimatePriorityFees

func (c *Client) QnEstimatePriorityFees(ctx context.Context, params QnPriorityFeesParams) (*QnPriorityFees, error)

QnEstimatePriorityFees calls qn_estimatePriorityFees. It never shares a batch.

func (*Client) Quote

func (c *Client) Quote(ctx context.Context, params QuoteParams) (*Quote, error)

Quote calls quote. It never shares a batch.

func (*Client) SearchAssets

func (c *Client) SearchAssets(ctx context.Context, params SearchAssetsParams) (*DASAssetList, error)

SearchAssets calls searchAssets. It shares a batch only with other DAS methods.

func (*Client) SendTransaction

func (c *Client) SendTransaction(ctx context.Context, signedTransaction string, config *SendTransactionConfig) (string, error)

SendTransaction calls sendTransaction. It relays a transaction the caller already signed, once: it is never retried.

func (*Client) SimulateTransaction

func (c *Client) SimulateTransaction(ctx context.Context, transaction string, config *SimulateTransactionConfig) (*WithContext[SimulateTransactionResult], error)

SimulateTransaction calls simulateTransaction.

func (*Client) String

func (cl *Client) String() string

func (*Client) Swap

func (c *Client) Swap(ctx context.Context, params SwapParams) (*Swap, error)

Swap calls swap. It never shares a batch.

type ClusterNode

type ClusterNode struct {
	Pubkey       string  `json:"pubkey"`
	Gossip       *string `json:"gossip"`
	TPU          *string `json:"tpu"`
	TPUQUIC      *string `json:"tpuQuic,omitempty"`
	RPC          *string `json:"rpc"`
	Pubsub       *string `json:"pubsub,omitempty"`
	Version      *string `json:"version"`
	FeatureSet   *uint64 `json:"featureSet"`
	ShredVersion *uint64 `json:"shredVersion"`
}

ClusterNode is sent or received as the spec's ClusterNode.

type Commitment

type Commitment string

Commitment is one of: processed, confirmed, finalized. A value not listed here is kept as sent.

const (
	CommitmentProcessed Commitment = "processed"
	CommitmentConfirmed Commitment = "confirmed"
	CommitmentFinalized Commitment = "finalized"
)

type CommitmentConfig

type CommitmentConfig struct {
	Commitment     Commitment `json:"commitment,omitempty"`
	MinContextSlot *uint64    `json:"minContextSlot,omitempty"`
}

CommitmentConfig is sent or received as the spec's CommitmentConfig.

type CommitmentOnlyConfig

type CommitmentOnlyConfig struct {
	Commitment Commitment `json:"commitment,omitempty"`
}

CommitmentOnlyConfig is sent or received as the spec's getBlocks(config).

type Context

type Context struct {
	Slot       uint64 `json:"slot"`
	APIVersion string `json:"apiVersion,omitempty"`
}

Context is sent or received as the spec's Context.

type Cq1Quote

type Cq1Quote struct {
	SrcAmountIn               string        `json:"srcAmountIn"`
	DestAmountOut             string        `json:"destAmountOut"`
	DestAmountOutMin          string        `json:"destAmountOutMin"`
	SwapMode                  string        `json:"swapMode"`
	Slippage                  string        `json:"slippage"`
	PriceImpactPct            string        `json:"priceImpactPct"`
	RoutePlan                 []Cq1RouteLeg `json:"routePlan"`
	FeeMint                   string        `json:"feeMint"`
	FeeBps                    string        `json:"feeBps"`
	SignatureFeeLamports      string        `json:"signatureFeeLamports"`
	PrioritizationFeeLamports string        `json:"prioritizationFeeLamports"`
	RentFeeLamports           string        `json:"rentFeeLamports"`
	InputMint                 string        `json:"inputMint"`
	OutputMint                string        `json:"outputMint"`
	SwapType                  string        `json:"swapType"`
	Router                    string        `json:"router"`
	RequestID                 string        `json:"requestId"`
	PriceImpact               string        `json:"priceImpact"`
}

Cq1Quote is the answer of GET /cq1/quote: one JSON object, every value a string. Keys not listed here are dropped, so a field the route adds later does not break the call.

type Cq1QuoteParams

type Cq1QuoteParams struct {
	// SrcMint and DstMint are base58 mint addresses.
	SrcMint string
	DstMint string
	// AmountIn is in the source mint's base units, sent as decimal digits.
	AmountIn uint64
	// SlippageBps is the slippage in basis points.
	SlippageBps uint64
}

Cq1QuoteParams are the four query parameters of GET /cq1/quote, all required.

type Cq1RouteLeg

type Cq1RouteLeg struct {
	SwapInfo Cq1SwapInfo `json:"swapInfo"`
	Percent  string      `json:"percent"`
	Bps      string      `json:"bps"`
}

Cq1RouteLeg is one leg of a Cq1Quote route.

type Cq1SwapInfo

type Cq1SwapInfo struct {
	AmmKey     string `json:"ammKey"`
	Label      string `json:"label"`
	InputMint  string `json:"inputMint"`
	OutputMint string `json:"outputMint"`
	InAmount   string `json:"inAmount"`
	OutAmount  string `json:"outAmount"`
	FeeAmount  string `json:"feeAmount"`
	FeeMint    string `json:"feeMint"`
}

Cq1SwapInfo is the pool a Cq1RouteLeg trades through.

type DASAsset

type DASAsset struct {
	Interface       string                     `json:"interface"`
	ID              string                     `json:"id"`
	Content         map[string]json.RawMessage `json:"content,omitempty"`
	Authorities     []DASAssetAuthority        `json:"authorities,omitempty"`
	Compression     map[string]json.RawMessage `json:"compression,omitempty"`
	Grouping        []DASAssetGroupingItem     `json:"grouping,omitempty"`
	Royalty         map[string]json.RawMessage `json:"royalty,omitempty"`
	Creators        []DASAssetCreator          `json:"creators,omitempty"`
	Ownership       DASAssetOwnership          `json:"ownership"`
	Supply          map[string]json.RawMessage `json:"supply,omitempty"`
	Mutable         bool                       `json:"mutable"`
	Burnt           bool                       `json:"burnt"`
	TokenInfo       map[string]json.RawMessage `json:"token_info,omitempty"`
	MintExtensions  map[string]json.RawMessage `json:"mint_extensions,omitempty"`
	Plugins         map[string]json.RawMessage `json:"plugins,omitempty"`
	ExternalPlugins []json.RawMessage          `json:"external_plugins,omitempty"`
	MplCoreInfo     map[string]json.RawMessage `json:"mpl_core_info,omitempty"`
	Inscription     map[string]json.RawMessage `json:"inscription,omitempty"`
}

DASAsset is sent or received as the spec's DasAsset. The service may add keys; ones not listed here are dropped.

type DASAssetAuthority

type DASAssetAuthority struct {
	Address string   `json:"address"`
	Scopes  []string `json:"scopes"`
}

DASAssetAuthority is sent or received as the spec's DasAsset.authorities[].

type DASAssetCreator

type DASAssetCreator struct {
	Address  string `json:"address"`
	Share    uint64 `json:"share"`
	Verified bool   `json:"verified"`
}

DASAssetCreator is sent or received as the spec's DasAsset.creators[].

type DASAssetGroupingItem

type DASAssetGroupingItem struct {
	GroupKey   string `json:"group_key"`
	GroupValue string `json:"group_value"`
	Verified   *bool  `json:"verified,omitempty"`
}

DASAssetGroupingItem is sent or received as the spec's DasAsset.grouping[].

type DASAssetList

type DASAssetList struct {
	Total           uint64                     `json:"total"`
	Limit           uint64                     `json:"limit"`
	Page            *uint64                    `json:"page,omitempty"`
	Cursor          string                     `json:"cursor,omitempty"`
	Before          string                     `json:"before,omitempty"`
	After           string                     `json:"after,omitempty"`
	Items           []DASAsset                 `json:"items"`
	GrandTotal      *uint64                    `json:"grand_total,omitempty"`
	NativeBalance   *DASAssetListNativeBalance `json:"nativeBalance,omitempty"`
	LastIndexedSlot *uint64                    `json:"last_indexed_slot,omitempty"`
}

DASAssetList is sent or received as the spec's DasAssetList.

type DASAssetListNativeBalance

type DASAssetListNativeBalance struct {
	Lamports uint64 `json:"lamports"`
}

DASAssetListNativeBalance is sent or received as the spec's DasAssetList.nativeBalance.

type DASAssetOwnership

type DASAssetOwnership struct {
	Frozen         bool    `json:"frozen"`
	Delegated      bool    `json:"delegated"`
	Delegate       *string `json:"delegate"`
	OwnershipModel string  `json:"ownership_model"`
	Owner          string  `json:"owner"`
}

DASAssetOwnership is sent or received as the spec's DasAsset.ownership.

type DASDisplayOptions

type DASDisplayOptions struct {
	ShowFungible              *bool `json:"showFungible,omitempty"`
	ShowNativeBalance         *bool `json:"showNativeBalance,omitempty"`
	ShowZeroBalance           *bool `json:"showZeroBalance,omitempty"`
	ShowCollectionMetadata    *bool `json:"showCollectionMetadata,omitempty"`
	ShowUnverifiedCollections *bool `json:"showUnverifiedCollections,omitempty"`
	ShowGrandTotal            *bool `json:"showGrandTotal,omitempty"`
	ShowInscription           *bool `json:"showInscription,omitempty"`
	ShowRawData               *bool `json:"showRawData,omitempty"`
	RequireFullIndex          *bool `json:"requireFullIndex,omitempty"`
	ShowSystemMetadata        *bool `json:"showSystemMetadata,omitempty"`
	ShowClosedAccounts        *bool `json:"showClosedAccounts,omitempty"`
}

DASDisplayOptions is sent or received as the spec's DasDisplayOptions.

type DASEdition

type DASEdition struct {
	Mint           string `json:"mint"`
	EditionAddress string `json:"edition_address"`
	Edition        uint64 `json:"edition"`
}

DASEdition is sent or received as the spec's DasEdition.

type DASEditionList

type DASEditionList struct {
	Total                uint64       `json:"total"`
	Limit                uint64       `json:"limit"`
	Page                 uint64       `json:"page"`
	MasterEditionAddress string       `json:"master_edition_address"`
	Supply               uint64       `json:"supply"`
	MaxSupply            *uint64      `json:"max_supply"`
	Editions             []DASEdition `json:"editions"`
}

DASEditionList is sent or received as the spec's DasEditionList.

type DASGrouping

type DASGrouping struct {
	Key   string
	Value string
}

DASGrouping limits searchAssets to one group, for example Key "collection" and Value the collection address. It is sent as [key, value]; the {collection} and {group_key, group_value} forms are read too.

func (DASGrouping) MarshalJSON

func (g DASGrouping) MarshalJSON() ([]byte, error)

func (*DASGrouping) UnmarshalJSON

func (g *DASGrouping) UnmarshalJSON(b []byte) error

type DASSort

type DASSort struct {
	SortBy        DASSortBy `json:"sortBy"`
	SortDirection SortOrder `json:"sortDirection,omitempty"`
}

DASSort is sent or received as the spec's DasSort.

type DASSortBy

type DASSortBy string

DASSortBy is one of: id, created, updated, recent_action, none. A value not listed here is kept as sent.

const (
	DASSortByID           DASSortBy = "id"
	DASSortByCreated      DASSortBy = "created"
	DASSortByUpdated      DASSortBy = "updated"
	DASSortByRecentAction DASSortBy = "recent_action"
	DASSortByNone         DASSortBy = "none"
)

type DASTokenAccount

type DASTokenAccount struct {
	Address         string `json:"address"`
	Mint            string `json:"mint"`
	Owner           string `json:"owner"`
	Amount          uint64 `json:"amount"`
	DelegatedAmount uint64 `json:"delegated_amount"`
	Frozen          bool   `json:"frozen"`
}

DASTokenAccount is sent or received as the spec's DasTokenAccount. The service may add keys; ones not listed here are dropped.

type DASTokenAccountList

type DASTokenAccountList struct {
	Total           uint64            `json:"total"`
	Limit           uint64            `json:"limit"`
	Page            *uint64           `json:"page,omitempty"`
	Cursor          string            `json:"cursor,omitempty"`
	TokenAccounts   []DASTokenAccount `json:"token_accounts"`
	LastIndexedSlot *uint64           `json:"last_indexed_slot,omitempty"`
}

DASTokenAccountList is sent or received as the spec's DasTokenAccountList.

type DASTokenType

type DASTokenType string

DASTokenType is one of: fungible, nonFungible, regularNft, compressedNft, all. A value not listed here is kept as sent.

const (
	DASTokenTypeFungible      DASTokenType = "fungible"
	DASTokenTypeNonFungible   DASTokenType = "nonFungible"
	DASTokenTypeRegularNFT    DASTokenType = "regularNft"
	DASTokenTypeCompressedNFT DASTokenType = "compressedNft"
	DASTokenTypeAll           DASTokenType = "all"
)

type DataSlice

type DataSlice struct {
	Offset uint64 `json:"offset"`
	Length uint64 `json:"length"`
}

DataSlice is sent or received as the spec's DataSlice.

type Decimal

type Decimal string

Decimal is a u64 amount as decimal digits. It is sent as a JSON string and read from a string or a number, so no amount above 2^53 is rounded.

func (Decimal) MarshalJSON

func (d Decimal) MarshalJSON() ([]byte, error)

func (*Decimal) UnmarshalJSON

func (d *Decimal) UnmarshalJSON(b []byte) error

type EncodedData

type EncodedData struct {
	Data     string
	Encoding AccountDataEncoding
	Parsed   *ParsedData
}

EncodedData is an account's data: Data and Encoding for base58, base64 and base64+zstd, or Parsed for jsonParsed. The bare string the service sends when no encoding was asked for reads as base58 Data.

func (EncodedData) MarshalJSON

func (d EncodedData) MarshalJSON() ([]byte, error)

func (*EncodedData) UnmarshalJSON

func (d *EncodedData) UnmarshalJSON(b []byte) error

type EncodedTransaction

type EncodedTransaction struct {
	Data        string
	Encoding    BinaryEncoding
	Signatures  []string
	Message     map[string]json.RawMessage
	AccountKeys []TransactionAccountKey
}

EncodedTransaction is a transaction as sent back: Data and Encoding for base58 and base64; Signatures and Message for json and jsonParsed; Signatures and AccountKeys for a block read with transactionDetails "accounts".

func (EncodedTransaction) MarshalJSON

func (t EncodedTransaction) MarshalJSON() ([]byte, error)

func (*EncodedTransaction) UnmarshalJSON

func (t *EncodedTransaction) UnmarshalJSON(b []byte) error

type Encoding

type Encoding string

Encoding is one of: base58, base64, base64+zstd, jsonParsed. A value not listed here is kept as sent.

const (
	EncodingBase58     Encoding = "base58"
	EncodingBase64     Encoding = "base64"
	EncodingBase64Zstd Encoding = "base64+zstd"
	EncodingJSONParsed Encoding = "jsonParsed"
)

type EpochInfo

type EpochInfo struct {
	AbsoluteSlot     uint64  `json:"absoluteSlot"`
	BlockHeight      uint64  `json:"blockHeight"`
	Epoch            uint64  `json:"epoch"`
	SlotIndex        uint64  `json:"slotIndex"`
	SlotsInEpoch     uint64  `json:"slotsInEpoch"`
	TransactionCount *uint64 `json:"transactionCount"`
}

EpochInfo is sent or received as the spec's EpochInfo.

type EpochSchedule

type EpochSchedule struct {
	SlotsPerEpoch            uint64 `json:"slotsPerEpoch"`
	LeaderScheduleSlotOffset uint64 `json:"leaderScheduleSlotOffset"`
	Warmup                   bool   `json:"warmup"`
	FirstNormalEpoch         uint64 `json:"firstNormalEpoch"`
	FirstNormalSlot          uint64 `json:"firstNormalSlot"`
}

EpochSchedule is sent or received as the spec's EpochSchedule.

type Error

type Error struct {
	Kind ErrorKind
	// Message is the service's own message, redacted, with " (x-request-id: <id>)" added when the answer had one.
	Message string
	// HTTPStatus is the status of the answer; 0 when nothing answered.
	HTTPStatus int
	// Code is the JSON-RPC error code, a WebSocket close code or a gRPC status code; 0 when there was none.
	Code int
	// ErrorCode is the error string of the account, DCA or token API ("rate_limited"); empty for JSON-RPC.
	ErrorCode string
	// Reason is the service's error.data.reason (UPPER_SNAKE), a close reason or a webhook check's reason.
	Reason string
	// Retryable says whether waiting and sending the same request again can change the answer.
	Retryable bool
	// RetryAfter is the wait the service asked for; 0 when it gave none.
	RetryAfter time.Duration
	// RequestID is the answer's x-request-id, to quote to support.
	RequestID string
	// Method is the method, route or subscription the error belongs to.
	Method string
	// Data is the error's data object as served, redacted.
	Data json.RawMessage
	// contains filtered or unexported fields
}

Error is the one error type of this module. Check for it with errors.As. Message, Data and the cause never hold an API key, an account key or a webhook secret: they are cut out before the Error is made.

func NewError

func NewError(in ErrorInit) *Error

NewError makes an Error with every secret cut out of its message, data and cause.

func RPCError

func RPCError(method string, errorObject json.RawMessage) *Error

RPCError builds the Error for one JSON-RPC error object as the service sent it, at HTTP 200. Package ws uses it for refusals that arrive on the socket.

func (*Error) Error

func (e *Error) Error() string

func (Error) Format

func (e Error) Format(f fmt.State, verb rune)

Format prints the error with every verb, never a secret: %v and %s print Error(), %+v adds the fields, %#v prints them as Go syntax. It has a value receiver so a dereferenced Error prints the same way.

func (*Error) MarshalJSON

func (e *Error) MarshalJSON() ([]byte, error)

MarshalJSON writes the fields in the names the TypeScript SDK uses.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the cause with its text redacted. errors.Is and errors.As still reach the original cause.

type ErrorInit

type ErrorInit struct {
	Kind       ErrorKind
	Message    string
	HTTPStatus int
	Code       int
	ErrorCode  string
	Reason     string
	Retryable  bool
	RetryAfter time.Duration
	RequestID  string
	Method     string
	Data       []byte
	Cause      error
}

ErrorInit holds the fields of a new Error; NewError redacts them. The sub-packages of this module use it.

type ErrorKind

type ErrorKind string

ErrorKind is the coarse category of an Error. Code and Reason carry the service's own detail.

const (
	// KindAuth: 401 or 403. The key is unknown, suspended or revoked, lacks the plane or module, or the address is
	// not allowed. Also a key of the wrong shape, refused before any call.
	KindAuth ErrorKind = "auth"
	// KindCredits: 402, credits exhausted. Waiting never helps.
	KindCredits ErrorKind = "credits"
	// KindRateLimit: 429, a rate, slot or load refusal, or credits still loading. Waiting helps.
	KindRateLimit ErrorKind = "rate_limit"
	// KindRequest: the request itself must change (bad params, an unknown method, a body or batch over a cap).
	KindRequest ErrorKind = "request"
	// KindUpstream: a 5xx, or an answer that is not JSON-RPC.
	KindUpstream ErrorKind = "upstream"
	// KindNode: HTTP 200 with an error from the node, the index or the DAS store.
	KindNode ErrorKind = "node"
	// KindRoute: the quote and swap plane found no route, or the quote expired.
	KindRoute ErrorKind = "route"
	// KindTransport: no HTTP answer at all (a network error or a timeout).
	KindTransport ErrorKind = "transport"
	// KindSocket: a WebSocket refusal or a terminal close.
	KindSocket ErrorKind = "socket"
	// KindStream: a Carbon Stream refusal that ends the stream. The stream module reports it in its own error
	// type, so gRPC stays out of this module.
	KindStream ErrorKind = "stream"
	// KindAccount: the account API on carbium.sh answered with an error.
	KindAccount ErrorKind = "account"
	// KindDCA: the DCA API answered ok:false or an error status.
	KindDCA ErrorKind = "dca"
	// KindTokens: the token API answered with an error.
	KindTokens ErrorKind = "tokens"
	// KindWebhook: a webhook delivery failed its signature check.
	KindWebhook ErrorKind = "webhook"
)

type GetAssetParams

type GetAssetParams struct {
	ID             string             `json:"id"`
	Options        *DASDisplayOptions `json:"options,omitempty"`
	DisplayOptions *DASDisplayOptions `json:"displayOptions,omitempty"`
}

GetAssetParams is sent or received as the spec's getAsset().

type GetAssetsByAuthorityParams

type GetAssetsByAuthorityParams struct {
	AuthorityAddress string             `json:"authorityAddress"`
	Page             *uint64            `json:"page,omitempty"`
	Limit            *uint64            `json:"limit,omitempty"`
	Cursor           string             `json:"cursor,omitempty"`
	Before           string             `json:"before,omitempty"`
	After            string             `json:"after,omitempty"`
	SortBy           *DASSort           `json:"sortBy,omitempty"`
	Options          *DASDisplayOptions `json:"options,omitempty"`
	DisplayOptions   *DASDisplayOptions `json:"displayOptions,omitempty"`
}

GetAssetsByAuthorityParams is sent or received as the spec's getAssetsByAuthority().

type GetAssetsByCreatorParams

type GetAssetsByCreatorParams struct {
	CreatorAddress string             `json:"creatorAddress"`
	OnlyVerified   *bool              `json:"onlyVerified,omitempty"`
	Page           *uint64            `json:"page,omitempty"`
	Limit          *uint64            `json:"limit,omitempty"`
	Cursor         string             `json:"cursor,omitempty"`
	Before         string             `json:"before,omitempty"`
	After          string             `json:"after,omitempty"`
	SortBy         *DASSort           `json:"sortBy,omitempty"`
	Options        *DASDisplayOptions `json:"options,omitempty"`
	DisplayOptions *DASDisplayOptions `json:"displayOptions,omitempty"`
}

GetAssetsByCreatorParams is sent or received as the spec's getAssetsByCreator().

type GetAssetsByGroupParams

type GetAssetsByGroupParams struct {
	GroupKey       string             `json:"groupKey"`
	GroupValue     string             `json:"groupValue"`
	Page           *uint64            `json:"page,omitempty"`
	Limit          *uint64            `json:"limit,omitempty"`
	Cursor         string             `json:"cursor,omitempty"`
	Before         string             `json:"before,omitempty"`
	After          string             `json:"after,omitempty"`
	SortBy         *DASSort           `json:"sortBy,omitempty"`
	Options        *DASDisplayOptions `json:"options,omitempty"`
	DisplayOptions *DASDisplayOptions `json:"displayOptions,omitempty"`
}

GetAssetsByGroupParams is sent or received as the spec's getAssetsByGroup().

type GetAssetsByOwnerParams

type GetAssetsByOwnerParams struct {
	OwnerAddress   string             `json:"ownerAddress"`
	Page           *uint64            `json:"page,omitempty"`
	Limit          *uint64            `json:"limit,omitempty"`
	Cursor         string             `json:"cursor,omitempty"`
	Before         string             `json:"before,omitempty"`
	After          string             `json:"after,omitempty"`
	SortBy         *DASSort           `json:"sortBy,omitempty"`
	Options        *DASDisplayOptions `json:"options,omitempty"`
	DisplayOptions *DASDisplayOptions `json:"displayOptions,omitempty"`
}

GetAssetsByOwnerParams is sent or received as the spec's getAssetsByOwner().

type GetAssetsParams

type GetAssetsParams struct {
	IDs            []string           `json:"ids"`
	Options        *DASDisplayOptions `json:"options,omitempty"`
	DisplayOptions *DASDisplayOptions `json:"displayOptions,omitempty"`
}

GetAssetsParams is sent or received as the spec's getAssetBatch().

type GetIdentityResult

type GetIdentityResult struct {
	Identity string `json:"identity"`
}

GetIdentityResult is sent or received as the spec's getIdentity->.

type GetInflationRewardConfig

type GetInflationRewardConfig struct {
	Commitment     Commitment `json:"commitment,omitempty"`
	Epoch          *uint64    `json:"epoch,omitempty"`
	MinContextSlot *uint64    `json:"minContextSlot,omitempty"`
}

GetInflationRewardConfig is sent or received as the spec's getInflationReward(config).

type GetNFTEditionsParams

type GetNFTEditionsParams struct {
	Mint  string  `json:"mint"`
	Page  *uint64 `json:"page,omitempty"`
	Limit *uint64 `json:"limit,omitempty"`
}

GetNFTEditionsParams is sent or received as the spec's getNftEditions().

type GetSignatureStatusesConfig

type GetSignatureStatusesConfig struct {
	SearchTransactionHistory *bool `json:"searchTransactionHistory,omitempty"`
}

GetSignatureStatusesConfig is sent or received as the spec's getSignatureStatuses(config).

type GetSupplyConfig

type GetSupplyConfig struct {
	ExcludeNonCirculatingAccountsList *bool      `json:"excludeNonCirculatingAccountsList,omitempty"`
	Commitment                        Commitment `json:"commitment,omitempty"`
	MinContextSlot                    *uint64    `json:"minContextSlot,omitempty"`
}

GetSupplyConfig is sent or received as the spec's getSupply(config).

type GetTokenAccountsParams

type GetTokenAccountsParams struct {
	Owner   string                         `json:"owner,omitempty"`
	Mint    string                         `json:"mint,omitempty"`
	Page    *uint64                        `json:"page,omitempty"`
	Limit   *uint64                        `json:"limit,omitempty"`
	Cursor  string                         `json:"cursor,omitempty"`
	Options *GetTokenAccountsParamsOptions `json:"options,omitempty"`
}

GetTokenAccountsParams is sent or received as the spec's getTokenAccounts().

type GetTokenAccountsParamsOptions

type GetTokenAccountsParamsOptions struct {
	ShowZeroBalance *bool `json:"showZeroBalance,omitempty"`
}

GetTokenAccountsParamsOptions is sent or received as the spec's getTokenAccounts().options.

type HighestSnapshotSlot

type HighestSnapshotSlot struct {
	Full        uint64  `json:"full"`
	Incremental *uint64 `json:"incremental"`
}

HighestSnapshotSlot is sent or received as the spec's HighestSnapshotSlot.

type HistoryStatusFilter

type HistoryStatusFilter string

HistoryStatusFilter is one of: succeeded, failed, any. A value not listed here is kept as sent.

const (
	HistoryStatusFilterSucceeded HistoryStatusFilter = "succeeded"
	HistoryStatusFilterFailed    HistoryStatusFilter = "failed"
	HistoryStatusFilterAny       HistoryStatusFilter = "any"
)

type HistoryTokenAccounts

type HistoryTokenAccounts string

HistoryTokenAccounts is one of: none, balanceChanged, all. A value not listed here is kept as sent.

const (
	HistoryTokenAccountsNone           HistoryTokenAccounts = "none"
	HistoryTokenAccountsBalanceChanged HistoryTokenAccounts = "balanceChanged"
	HistoryTokenAccountsAll            HistoryTokenAccounts = "all"
)

type InflationGovernor

type InflationGovernor struct {
	Initial        float64 `json:"initial"`
	Terminal       float64 `json:"terminal"`
	Taper          float64 `json:"taper"`
	Foundation     float64 `json:"foundation"`
	FoundationTerm float64 `json:"foundationTerm"`
}

InflationGovernor is sent or received as the spec's InflationGovernor.

type InflationRate

type InflationRate struct {
	Total      float64 `json:"total"`
	Validator  float64 `json:"validator"`
	Foundation float64 `json:"foundation"`
	Epoch      uint64  `json:"epoch"`
}

InflationRate is sent or received as the spec's InflationRate.

type InflationReward

type InflationReward struct {
	Epoch         uint64  `json:"epoch"`
	EffectiveSlot uint64  `json:"effectiveSlot"`
	Amount        uint64  `json:"amount"`
	PostBalance   uint64  `json:"postBalance"`
	Commission    *uint64 `json:"commission,omitempty"`
}

InflationReward is sent or received as the spec's InflationReward.

type InnerInstructions

type InnerInstructions struct {
	Index        uint64            `json:"index"`
	Instructions []json.RawMessage `json:"instructions"`
}

InnerInstructions is sent or received as the spec's InnerInstructions.

type KeyedAccount

type KeyedAccount struct {
	Pubkey  string      `json:"pubkey"`
	Account AccountInfo `json:"account"`
}

KeyedAccount is sent or received as the spec's KeyedAccount.

type LargestAccount

type LargestAccount struct {
	Address  string `json:"address"`
	Lamports uint64 `json:"lamports"`
}

LargestAccount is sent or received as the spec's LargestAccount.

type LatestBlockhash

type LatestBlockhash struct {
	Blockhash            string `json:"blockhash"`
	LastValidBlockHeight uint64 `json:"lastValidBlockHeight"`
}

LatestBlockhash is sent or received as the spec's LatestBlockhash.

type LeaderScheduleConfig

type LeaderScheduleConfig struct {
	Commitment Commitment `json:"commitment,omitempty"`
	Identity   string     `json:"identity,omitempty"`
}

LeaderScheduleConfig is sent or received as the spec's LeaderScheduleConfig.

type LoadedAddresses

type LoadedAddresses struct {
	Writable []string `json:"writable"`
	Readonly []string `json:"readonly"`
}

LoadedAddresses is sent or received as the spec's LoadedAddresses.

type LogsNotification

type LogsNotification struct {
	Signature string           `json:"signature"`
	Err       TransactionError `json:"err"`
	Logs      []string         `json:"logs"`
}

LogsNotification is sent or received as the spec's WithContext_LogsNotification.value.

type MemcmpEncoding

type MemcmpEncoding string

MemcmpEncoding is one of: base58, base64, bytes. A value not listed here is kept as sent.

const (
	MemcmpEncodingBase58 MemcmpEncoding = "base58"
	MemcmpEncodingBase64 MemcmpEncoding = "base64"
	MemcmpEncodingBytes  MemcmpEncoding = "bytes"
)

type MethodSpec

type MethodSpec struct {
	// Plane is the part of the service that answers: "rpc", "das" or "quote".
	Plane string
	// ByName is true when params are one object, false when they are a positional array.
	ByName bool
	// Batch says whether the method may share a batch: "any", "das" (only with other DAS methods) or "never".
	Batch string
	// Permit is true for a method that holds a node slot; a batch holds at most MaxPermitPerBatch of them.
	Permit bool
	// GoName is the typed method on *Client.
	GoName string
}

MethodSpec describes one served JSON-RPC method.

func LookupMethod

func LookupMethod(name string) (MethodSpec, bool)

LookupMethod returns the spec of a served method; ok is false for any name the services do not serve.

type Options

type Options struct {
	// Endpoint defaults to https://services.carbium.sh. A key in the URL is refused: it goes in the x-api-key header.
	Endpoint string
	// HTTPClient defaults to a client with no timeout of its own; Timeout bounds each attempt. The client uses a
	// copy that never follows a redirect.
	HTTPClient *http.Client
	// Timeout bounds each attempt. Default 100 s, above the service's own 95 s gateway deadline.
	Timeout time.Duration
	// MaxAttempts caps the calls made for one request, the first included. 0 keeps each retry rule's own count
	// (4 for most, 6 for a scan index behind); 1 turns retries off. It can only lower a rule's count.
	MaxAttempts int
	// MaxHint is the longest server wait hint the client waits for; a longer one is returned at once in
	// Error.RetryAfter. Default 30 s.
	MaxHint time.Duration
}

Options tune a Client. The zero value is the default.

type ParsedData

type ParsedData struct {
	Program string          `json:"program"`
	Parsed  json.RawMessage `json:"parsed"`
	Space   uint64          `json:"space"`
}

ParsedData is sent or received as the spec's ParsedData.

type PerformanceSample

type PerformanceSample struct {
	Slot                   uint64  `json:"slot"`
	NumTransactions        uint64  `json:"numTransactions"`
	NumNonVoteTransactions *uint64 `json:"numNonVoteTransactions,omitempty"`
	NumSlots               uint64  `json:"numSlots"`
	SamplePeriodSecs       uint64  `json:"samplePeriodSecs"`
}

PerformanceSample is sent or received as the spec's PerformanceSample.

type Prices

type Prices struct {
	SolUSD    float64     `json:"solUsd"`
	BuiltUnix int64       `json:"builtUnix"`
	Priced    uint64      `json:"priced"`
	Stale     uint64      `json:"stale"`
	Noroute   uint64      `json:"noroute"`
	Total     uint64      `json:"total"`
	Rows      []PricesRow `json:"rows"`
}

Prices is sent or received as the spec's Prices.

type PricesParams

type PricesParams struct {
	Mints []string `json:"mints,omitempty"`
}

PricesParams is sent or received as the spec's PricesParams.

type PricesRow

type PricesRow struct {
	Mint      string
	PriceUSD  *float64
	TVLUSD    float64
	QuoteMint string
}

PricesRow travels as a JSON array of 4 items; items after them are ignored.

func (PricesRow) MarshalJSON

func (t PricesRow) MarshalJSON() ([]byte, error)

func (*PricesRow) UnmarshalJSON

func (t *PricesRow) UnmarshalJSON(b []byte) error

type PrioritizationFee

type PrioritizationFee struct {
	Slot              uint64 `json:"slot"`
	PrioritizationFee uint64 `json:"prioritizationFee"`
}

PrioritizationFee is sent or received as the spec's PrioritizationFee.

type PriorityFeeEstimate

type PriorityFeeEstimate struct {
	PriorityFeeEstimate *float64                              `json:"priorityFeeEstimate,omitempty"`
	PriorityFeeLevels   *PriorityFeeEstimatePriorityFeeLevels `json:"priorityFeeLevels,omitempty"`
}

PriorityFeeEstimate is sent or received as the spec's PriorityFeeEstimate.

type PriorityFeeEstimateParams

type PriorityFeeEstimateParams struct {
	AccountKeys []string                          `json:"accountKeys,omitempty"`
	Transaction string                            `json:"transaction,omitempty"`
	Options     *PriorityFeeEstimateParamsOptions `json:"options,omitempty"`
}

PriorityFeeEstimateParams is sent or received as the spec's PriorityFeeEstimateParams.

type PriorityFeeEstimateParamsOptions

type PriorityFeeEstimateParamsOptions struct {
	PriorityLevel               PriorityLevel  `json:"priorityLevel,omitempty"`
	IncludeAllPriorityFeeLevels *bool          `json:"includeAllPriorityFeeLevels,omitempty"`
	Recommended                 *bool          `json:"recommended,omitempty"`
	LookbackSlots               *uint64        `json:"lookbackSlots,omitempty"`
	TransactionEncoding         BinaryEncoding `json:"transactionEncoding,omitempty"`
}

PriorityFeeEstimateParamsOptions is sent or received as the spec's PriorityFeeEstimateParams.options.

type PriorityFeeEstimatePriorityFeeLevels

type PriorityFeeEstimatePriorityFeeLevels struct {
	Min       float64 `json:"min"`
	Low       float64 `json:"low"`
	Medium    float64 `json:"medium"`
	High      float64 `json:"high"`
	VeryHigh  float64 `json:"veryHigh"`
	UnsafeMax float64 `json:"unsafeMax"`
}

PriorityFeeEstimatePriorityFeeLevels is sent or received as the spec's PriorityFeeEstimate.priorityFeeLevels.

type PriorityLevel

type PriorityLevel string

PriorityLevel is one of: Min, Low, Medium, High, VeryHigh, UnsafeMax. A value not listed here is kept as sent.

const (
	PriorityLevelMin       PriorityLevel = "Min"
	PriorityLevelLow       PriorityLevel = "Low"
	PriorityLevelMedium    PriorityLevel = "Medium"
	PriorityLevelHigh      PriorityLevel = "High"
	PriorityLevelVeryHigh  PriorityLevel = "VeryHigh"
	PriorityLevelUnsafeMax PriorityLevel = "UnsafeMax"
)

type ProgramAccounts

type ProgramAccounts struct {
	Context *Context
	Value   []KeyedAccount
}

ProgramAccounts is the getProgramAccounts answer. Value holds the accounts; Context is set only when the config asked for withContext.

func (ProgramAccounts) MarshalJSON

func (p ProgramAccounts) MarshalJSON() ([]byte, error)

func (*ProgramAccounts) UnmarshalJSON

func (p *ProgramAccounts) UnmarshalJSON(b []byte) error

type ProgramAccountsConfig

type ProgramAccountsConfig struct {
	Commitment     Commitment              `json:"commitment,omitempty"`
	MinContextSlot *uint64                 `json:"minContextSlot,omitempty"`
	Encoding       Encoding                `json:"encoding,omitempty"`
	DataSlice      *DataSlice              `json:"dataSlice,omitempty"`
	Filters        []ProgramAccountsFilter `json:"filters,omitempty"`
	WithContext    *bool                   `json:"withContext,omitempty"`
}

ProgramAccountsConfig is sent or received as the spec's ProgramAccountsConfig.

type ProgramAccountsFilter

type ProgramAccountsFilter struct {
	Memcmp   *ProgramAccountsFilterMemcmp `json:"memcmp,omitempty"`
	DataSize *uint64                      `json:"dataSize,omitempty"`
}

ProgramAccountsFilter is sent or received as the spec's ProgramAccountsFilter.

type ProgramAccountsFilterMemcmp

type ProgramAccountsFilterMemcmp struct {
	Offset   uint64         `json:"offset"`
	Bytes    string         `json:"bytes"`
	Encoding BinaryEncoding `json:"encoding,omitempty"`
}

ProgramAccountsFilterMemcmp is sent or received as the spec's ProgramAccountsFilter.memcmp.

type ProgramSubscribeFilter

type ProgramSubscribeFilter struct {
	DataSize *uint64                       `json:"dataSize,omitempty"`
	Memcmp   *ProgramSubscribeFilterMemcmp `json:"memcmp,omitempty"`
}

ProgramSubscribeFilter is sent or received as the spec's ProgramSubscribeFilter. One of these shapes: {dataSize} or {memcmp}.

type ProgramSubscribeFilterMemcmp

type ProgramSubscribeFilterMemcmp struct {
	Offset   uint64         `json:"offset"`
	Bytes    string         `json:"bytes"`
	Encoding MemcmpEncoding `json:"encoding,omitempty"`
}

ProgramSubscribeFilterMemcmp is sent or received as the spec's ProgramSubscribeFilter branch 1.memcmp.

type QnPriorityFeeLevels

type QnPriorityFeeLevels struct {
	Extreme     float64            `json:"extreme"`
	High        float64            `json:"high"`
	Medium      float64            `json:"medium"`
	Low         float64            `json:"low"`
	Percentiles map[string]float64 `json:"percentiles"`
}

QnPriorityFeeLevels is sent or received as the spec's QnPriorityFeeLevels.

type QnPriorityFees

type QnPriorityFees struct {
	Context        QnPriorityFeesContext `json:"context"`
	PerComputeUnit QnPriorityFeeLevels   `json:"per_compute_unit"`
	PerTransaction QnPriorityFeeLevels   `json:"per_transaction"`
	Recommended    float64               `json:"recommended"`
}

QnPriorityFees is sent or received as the spec's QnPriorityFees.

type QnPriorityFeesContext

type QnPriorityFeesContext struct {
	Slot uint64 `json:"slot"`
}

QnPriorityFeesContext is sent or received as the spec's QnPriorityFees.context.

type QnPriorityFeesParams

type QnPriorityFeesParams struct {
	LastNBlocks *uint64 `json:"last_n_blocks,omitempty"`
	Account     string  `json:"account,omitempty"`
	APIVersion  *uint64 `json:"api_version,omitempty"`
}

QnPriorityFeesParams is sent or received as the spec's QnPriorityFeesParams.

type Quote

type Quote struct {
	SrcAmountIn       string            `json:"srcAmountIn"`
	DestAmountOut     string            `json:"destAmountOut"`
	MinAmountOut      string            `json:"minAmountOut"`
	SlippageBps       uint64            `json:"slippageBps"`
	SwapMode          string            `json:"swapMode"`
	InputMint         string            `json:"inputMint"`
	OutputMint        string            `json:"outputMint"`
	RoutePlan         []RouteLeg        `json:"routePlan"`
	QuoteID           string            `json:"quoteId"`
	PlatformFee       *QuotePlatformFee `json:"platformFee,omitempty"`
	TxVersion         *uint64           `json:"txVersion,omitempty"`
	SwapTag           *uint64           `json:"swapTag,omitempty"`
	Partial           *bool             `json:"partial,omitempty"`
	RequestedAmountIn string            `json:"requestedAmountIn,omitempty"`
}

Quote is sent or received as the spec's Quote. The service may add keys; ones not listed here are dropped.

type QuoteHealth

type QuoteHealth struct {
	OK                bool            `json:"ok"`
	QuoteUpstream     json.RawMessage `json:"quoteUpstream"`
	CanBuild          bool            `json:"canBuild"`
	Families          []string        `json:"families"`
	PoolStore         json.RawMessage `json:"poolStore"`
	ChainRPC          json.RawMessage `json:"chainRpc"`
	Priced            uint64          `json:"priced"`
	Total             uint64          `json:"total"`
	Stale             uint64          `json:"stale"`
	TableAgeSecs      float64         `json:"tableAgeSecs"`
	QuoteRefusalRatio float64         `json:"quote_refusal_ratio"`
}

QuoteHealth is sent or received as the spec's QuoteHealth. The service may add keys; ones not listed here are dropped.

type QuoteParams

type QuoteParams struct {
	SrcMint     string   `json:"src_mint"`
	DstMint     string   `json:"dst_mint"`
	AmountIn    Decimal  `json:"amount_in"`
	SlippageBps uint64   `json:"slippage_bps"`
	Dex         []string `json:"dex,omitempty"`
	Dexes       []string `json:"dexes,omitempty"`
	TxVersion   *uint64  `json:"txVersion,omitempty"`
	SwapTag     *uint64  `json:"swapTag,omitempty"`
}

QuoteParams is sent or received as the spec's QuoteParams.

type QuotePlatformFee

type QuotePlatformFee struct {
	Amount string `json:"amount"`
	FeeBps uint64 `json:"feeBps"`
	Mint   string `json:"mint"`
}

QuotePlatformFee is sent or received as the spec's Quote.platformFee.

type ReturnData

type ReturnData struct {
	ProgramID string    `json:"programId"`
	Data      [2]string `json:"data"`
}

ReturnData is sent or received as the spec's TransactionMeta.returnData.

type Reward

type Reward struct {
	Pubkey      string  `json:"pubkey"`
	Lamports    int64   `json:"lamports"`
	PostBalance uint64  `json:"postBalance"`
	RewardType  *string `json:"rewardType"`
	Commission  *uint64 `json:"commission,omitempty"`
}

Reward is sent or received as the spec's Reward.

type RouteLeg

type RouteLeg struct {
	Hop      uint64           `json:"hop"`
	Percent  string           `json:"percent"`
	SwapInfo RouteLegSwapInfo `json:"swapInfo"`
}

RouteLeg is sent or received as the spec's RouteLeg.

type RouteLegSwapInfo

type RouteLegSwapInfo struct {
	AMMKey     string `json:"ammKey"`
	Label      string `json:"label"`
	InputMint  string `json:"inputMint"`
	OutputMint string `json:"outputMint"`
	InAmount   string `json:"inAmount"`
	OutAmount  string `json:"outAmount"`
}

RouteLegSwapInfo is sent or received as the spec's RouteLeg.swapInfo.

type SearchAssetsParams

type SearchAssetsParams struct {
	Page             *uint64            `json:"page,omitempty"`
	Limit            *uint64            `json:"limit,omitempty"`
	Cursor           string             `json:"cursor,omitempty"`
	Before           string             `json:"before,omitempty"`
	After            string             `json:"after,omitempty"`
	SortBy           *DASSort           `json:"sortBy,omitempty"`
	Options          *DASDisplayOptions `json:"options,omitempty"`
	DisplayOptions   *DASDisplayOptions `json:"displayOptions,omitempty"`
	OwnerAddress     string             `json:"ownerAddress,omitempty"`
	CreatorAddress   string             `json:"creatorAddress,omitempty"`
	CreatorVerified  *bool              `json:"creatorVerified,omitempty"`
	AuthorityAddress string             `json:"authorityAddress,omitempty"`
	Grouping         *DASGrouping       `json:"grouping,omitempty"`
	Interface        string             `json:"interface,omitempty"`
	TokenType        DASTokenType       `json:"tokenType,omitempty"`
	Frozen           *bool              `json:"frozen,omitempty"`
	Delegate         string             `json:"delegate,omitempty"`
	Burnt            *bool              `json:"burnt,omitempty"`
	Compressed       *bool              `json:"compressed,omitempty"`
	Negate           *bool              `json:"negate,omitempty"`
	ConditionType    string             `json:"conditionType,omitempty"`
}

SearchAssetsParams is sent or received as the spec's SearchAssetsParams.

type Secret

type Secret string

Secret is a key, secret or token the service shows once, such as a new key's raw_key or a webhook's whsec_ secret. It prints, formats and encodes as a placeholder that keeps only its label; Reveal returns the value, to store it.

func (Secret) Format

func (s Secret) Format(f fmt.State, verb rune)

func (Secret) GoString

func (s Secret) GoString() string

func (Secret) MarshalJSON

func (s Secret) MarshalJSON() ([]byte, error)

MarshalJSON writes the placeholder, so logging an answer as JSON never writes the secret.

func (Secret) Reveal

func (s Secret) Reveal() string

Reveal returns the secret itself.

func (Secret) String

func (s Secret) String() string

String is the placeholder: the label before the value (c_serv_, c_acct_, whsec_) and an ellipsis.

func (*Secret) UnmarshalJSON

func (s *Secret) UnmarshalJSON(b []byte) error

UnmarshalJSON reads the secret as the service sends it.

type SendTransactionConfig

type SendTransactionConfig struct {
	Encoding            BinaryEncoding `json:"encoding,omitempty"`
	SkipPreflight       *bool          `json:"skipPreflight,omitempty"`
	PreflightCommitment Commitment     `json:"preflightCommitment,omitempty"`
	MaxRetries          *uint64        `json:"maxRetries,omitempty"`
	MinContextSlot      *uint64        `json:"minContextSlot,omitempty"`
}

SendTransactionConfig is sent or received as the spec's SendTransactionConfig.

type SettledCommitment

type SettledCommitment string

SettledCommitment is one of: confirmed, finalized. A value not listed here is kept as sent.

const (
	SettledCommitmentConfirmed SettledCommitment = "confirmed"
	SettledCommitmentFinalized SettledCommitment = "finalized"
)

type SignatureInfo

type SignatureInfo struct {
	Signature          string           `json:"signature"`
	Slot               uint64           `json:"slot"`
	Err                TransactionError `json:"err"`
	Memo               *string          `json:"memo"`
	BlockTime          *int64           `json:"blockTime"`
	ConfirmationStatus *Commitment      `json:"confirmationStatus,omitempty"`
}

SignatureInfo is sent or received as the spec's SignatureInfo.

type SignatureNotification

type SignatureNotification struct {
	Err TransactionError `json:"err"`
}

SignatureNotification is sent or received as the spec's WithContext_SignatureNotification.value.

type SignatureStatus

type SignatureStatus struct {
	Slot               uint64           `json:"slot"`
	Confirmations      *uint64          `json:"confirmations"`
	Err                TransactionError `json:"err"`
	ConfirmationStatus *Commitment      `json:"confirmationStatus"`
	Status             *TxStatus        `json:"status,omitempty"`
}

SignatureStatus is sent or received as the spec's SignatureStatus.

type SignaturesForAddressConfig

type SignaturesForAddressConfig struct {
	Commitment     Commitment `json:"commitment,omitempty"`
	MinContextSlot *uint64    `json:"minContextSlot,omitempty"`
	Limit          *uint64    `json:"limit,omitempty"`
	Before         string     `json:"before,omitempty"`
	Until          string     `json:"until,omitempty"`
}

SignaturesForAddressConfig is sent or received as the spec's SignaturesForAddressConfig.

type SimulateTransactionConfig

type SimulateTransactionConfig struct {
	SigVerify              *bool                              `json:"sigVerify,omitempty"`
	Commitment             Commitment                         `json:"commitment,omitempty"`
	Encoding               BinaryEncoding                     `json:"encoding,omitempty"`
	ReplaceRecentBlockhash *bool                              `json:"replaceRecentBlockhash,omitempty"`
	MinContextSlot         *uint64                            `json:"minContextSlot,omitempty"`
	InnerInstructions      *bool                              `json:"innerInstructions,omitempty"`
	Accounts               *SimulateTransactionConfigAccounts `json:"accounts,omitempty"`
}

SimulateTransactionConfig is sent or received as the spec's SimulateTransactionConfig.

type SimulateTransactionConfigAccounts

type SimulateTransactionConfigAccounts struct {
	Addresses []string `json:"addresses"`
	Encoding  Encoding `json:"encoding,omitempty"`
}

SimulateTransactionConfigAccounts is sent or received as the spec's SimulateTransactionConfig.accounts.

type SimulateTransactionResult

type SimulateTransactionResult struct {
	Err                  TransactionError    `json:"err"`
	Logs                 []string            `json:"logs"`
	Accounts             []*AccountInfo      `json:"accounts,omitempty"`
	UnitsConsumed        *uint64             `json:"unitsConsumed,omitempty"`
	ReturnData           *ReturnData         `json:"returnData,omitempty"`
	InnerInstructions    []InnerInstructions `json:"innerInstructions,omitempty"`
	ReplacementBlockhash *LatestBlockhash    `json:"replacementBlockhash,omitempty"`
}

SimulateTransactionResult is sent or received as the spec's SimulateTransactionResult.

type SlotRange

type SlotRange struct {
	Gte *uint64 `json:"gte,omitempty"`
	Gt  *uint64 `json:"gt,omitempty"`
	Lte *uint64 `json:"lte,omitempty"`
	Lt  *uint64 `json:"lt,omitempty"`
	Eq  *uint64 `json:"eq,omitempty"`
}

SlotRange is sent or received as the spec's SlotRange.

type SortOrder

type SortOrder string

SortOrder is one of: asc, desc. A value not listed here is kept as sent.

const (
	SortOrderAsc  SortOrder = "asc"
	SortOrderDesc SortOrder = "desc"
)

type Supply

type Supply struct {
	Total                  uint64   `json:"total"`
	Circulating            uint64   `json:"circulating"`
	NonCirculating         uint64   `json:"nonCirculating"`
	NonCirculatingAccounts []string `json:"nonCirculatingAccounts"`
}

Supply is sent or received as the spec's Supply.

type Swap

type Swap struct {
	Transaction          string             `json:"transaction"`
	Blockhash            string             `json:"blockhash"`
	LastValidBlockHeight uint64             `json:"lastValidBlockHeight"`
	MinAmountOut         string             `json:"minAmountOut"`
	ComputeUnitLimit     uint64             `json:"computeUnitLimit"`
	PriorityFeeLamports  string             `json:"priorityFeeLamports"`
	RentLamports         *string            `json:"rentLamports"`
	AtaCreates           uint64             `json:"ataCreates"`
	TxVersion            *uint64            `json:"txVersion,omitempty"`
	SwapTag              *uint64            `json:"swapTag,omitempty"`
	RouteRerouted        *SwapRouteRerouted `json:"routeRerouted,omitempty"`
}

Swap is sent or received as the spec's Swap. The service may add keys; ones not listed here are dropped.

type SwapParams

type SwapParams struct {
	QuoteID                       string  `json:"quote_id"`
	UserPubkey                    string  `json:"user_pubkey"`
	ComputeUnitPriceMicroLamports *uint64 `json:"compute_unit_price_micro_lamports,omitempty"`
}

SwapParams is sent or received as the spec's SwapParams.

type SwapRouteRerouted

type SwapRouteRerouted struct {
	Why         string `json:"why"`
	DeadPool    string `json:"deadPool,omitempty"`
	QuotedOut   string `json:"quotedOut"`
	ReroutedOut string `json:"reroutedOut"`
	Floor       string `json:"floor"`
}

SwapRouteRerouted is sent or received as the spec's Swap.routeRerouted.

type TokenAccountsFilter

type TokenAccountsFilter struct {
	Mint      string `json:"mint,omitempty"`
	ProgramID string `json:"programId,omitempty"`
}

TokenAccountsFilter is sent or received as the spec's TokenAccountsFilter. One of these shapes: {mint} or {programId}.

type TokenAmount

type TokenAmount struct {
	Amount         string   `json:"amount"`
	Decimals       uint64   `json:"decimals"`
	UIAmount       *float64 `json:"uiAmount"`
	UIAmountString string   `json:"uiAmountString"`
}

TokenAmount is sent or received as the spec's TokenAmount.

type TokenBalance

type TokenBalance struct {
	AccountIndex  uint64      `json:"accountIndex"`
	Mint          string      `json:"mint"`
	Owner         string      `json:"owner,omitempty"`
	ProgramID     string      `json:"programId,omitempty"`
	UITokenAmount TokenAmount `json:"uiTokenAmount"`
}

TokenBalance is sent or received as the spec's TokenBalance.

type TransactionAccountKey

type TransactionAccountKey struct {
	Pubkey   string           `json:"pubkey"`
	Signer   bool             `json:"signer"`
	Writable bool             `json:"writable"`
	Source   AccountKeySource `json:"source"`
}

TransactionAccountKey is sent or received as the spec's TransactionAccountKey.

type TransactionConfig

type TransactionConfig struct {
	Commitment                     Commitment          `json:"commitment,omitempty"`
	MinContextSlot                 *uint64             `json:"minContextSlot,omitempty"`
	Encoding                       TransactionEncoding `json:"encoding,omitempty"`
	MaxSupportedTransactionVersion *uint64             `json:"maxSupportedTransactionVersion,omitempty"`
}

TransactionConfig is sent or received as the spec's TransactionConfig.

type TransactionDetails

type TransactionDetails string

TransactionDetails is one of: full, accounts, signatures, none. A value not listed here is kept as sent.

const (
	TransactionDetailsFull       TransactionDetails = "full"
	TransactionDetailsAccounts   TransactionDetails = "accounts"
	TransactionDetailsSignatures TransactionDetails = "signatures"
	TransactionDetailsNone       TransactionDetails = "none"
)

type TransactionEncoding

type TransactionEncoding string

TransactionEncoding is one of: json, jsonParsed, base58, base64. A value not listed here is kept as sent.

const (
	TransactionEncodingJSON       TransactionEncoding = "json"
	TransactionEncodingJSONParsed TransactionEncoding = "jsonParsed"
	TransactionEncodingBase58     TransactionEncoding = "base58"
	TransactionEncodingBase64     TransactionEncoding = "base64"
)

type TransactionError

type TransactionError json.RawMessage

TransactionError is why a transaction failed, kept as the service sent it: a string such as "AccountInUse" or an object such as {"InstructionError":[0,{"Custom":1}]}. nil means the transaction did not fail.

func (TransactionError) MarshalJSON

func (e TransactionError) MarshalJSON() ([]byte, error)

func (TransactionError) String

func (e TransactionError) String() string

func (*TransactionError) UnmarshalJSON

func (e *TransactionError) UnmarshalJSON(b []byte) error

type TransactionMeta

type TransactionMeta struct {
	Err                  TransactionError    `json:"err"`
	Fee                  uint64              `json:"fee"`
	PreBalances          []uint64            `json:"preBalances"`
	PostBalances         []uint64            `json:"postBalances"`
	InnerInstructions    []InnerInstructions `json:"innerInstructions,omitempty"`
	PreTokenBalances     []TokenBalance      `json:"preTokenBalances,omitempty"`
	PostTokenBalances    []TokenBalance      `json:"postTokenBalances,omitempty"`
	LogMessages          []string            `json:"logMessages,omitempty"`
	LoadedAddresses      *LoadedAddresses    `json:"loadedAddresses,omitempty"`
	ReturnData           *ReturnData         `json:"returnData,omitempty"`
	ComputeUnitsConsumed *uint64             `json:"computeUnitsConsumed,omitempty"`
	CostUnits            *uint64             `json:"costUnits,omitempty"`
	Rewards              []Reward            `json:"rewards,omitempty"`
	Status               *TxStatus           `json:"status,omitempty"`
}

TransactionMeta is sent or received as the spec's TransactionMeta.

type TransactionWithMeta

type TransactionWithMeta struct {
	Slot        uint64             `json:"slot"`
	Transaction EncodedTransaction `json:"transaction"`
	Meta        *TransactionMeta   `json:"meta"`
	BlockTime   *int64             `json:"blockTime,omitempty"`
	Version     TxVersion          `json:"version,omitempty"`
}

TransactionWithMeta is sent or received as the spec's TransactionWithMeta.

type TransactionsForAddress

type TransactionsForAddress struct {
	Data            []AddressTransaction `json:"data"`
	PaginationToken *string              `json:"paginationToken"`
	HistoryFloor    *uint64              `json:"historyFloor,omitempty"`
	DroppedRows     *uint64              `json:"droppedRows,omitempty"`
}

TransactionsForAddress is sent or received as the spec's TransactionsForAddress.

type TransactionsForAddressConfig

type TransactionsForAddressConfig struct {
	Commitment                     Commitment                           `json:"commitment,omitempty"`
	MinContextSlot                 *uint64                              `json:"minContextSlot,omitempty"`
	Encoding                       TransactionEncoding                  `json:"encoding,omitempty"`
	MaxSupportedTransactionVersion *uint64                              `json:"maxSupportedTransactionVersion,omitempty"`
	Limit                          *uint64                              `json:"limit,omitempty"`
	TransactionDetails             AddressHistoryDetails                `json:"transactionDetails,omitempty"`
	SortOrder                      SortOrder                            `json:"sortOrder,omitempty"`
	PaginationToken                string                               `json:"paginationToken,omitempty"`
	Filters                        *TransactionsForAddressConfigFilters `json:"filters,omitempty"`
}

TransactionsForAddressConfig is sent or received as the spec's TransactionsForAddressConfig.

type TransactionsForAddressConfigFilters

type TransactionsForAddressConfigFilters struct {
	Slot          *SlotRange                                        `json:"slot,omitempty"`
	BlockTime     *SlotRange                                        `json:"blockTime,omitempty"`
	Status        HistoryStatusFilter                               `json:"status,omitempty"`
	TokenAccounts HistoryTokenAccounts                              `json:"tokenAccounts,omitempty"`
	TokenTransfer *TransactionsForAddressConfigFiltersTokenTransfer `json:"tokenTransfer,omitempty"`
}

TransactionsForAddressConfigFilters is sent or received as the spec's TransactionsForAddressConfig.filters.

type TransactionsForAddressConfigFiltersTokenTransfer

type TransactionsForAddressConfigFiltersTokenTransfer struct {
	With      string            `json:"with,omitempty"`
	Mint      string            `json:"mint,omitempty"`
	Direction TransferDirection `json:"direction,omitempty"`
	Amount    *SlotRange        `json:"amount,omitempty"`
}

TransactionsForAddressConfigFiltersTokenTransfer is sent or received as the spec's TransactionsForAddressConfig.filters.tokenTransfer.

type TransferDirection

type TransferDirection string

TransferDirection is one of: in, out, any. A value not listed here is kept as sent.

const (
	TransferDirectionIn  TransferDirection = "in"
	TransferDirectionOut TransferDirection = "out"
	TransferDirectionAny TransferDirection = "any"
)

type TxStatus

type TxStatus struct {
	Err TransactionError
}

TxStatus is the older status form, {"Ok": null} or {"Err": ...}. Err is nil when the transaction succeeded.

func (TxStatus) MarshalJSON

func (s TxStatus) MarshalJSON() ([]byte, error)

func (TxStatus) OK

func (s TxStatus) OK() bool

OK reports whether the transaction succeeded.

func (*TxStatus) UnmarshalJSON

func (s *TxStatus) UnmarshalJSON(b []byte) error

type TxVersion

type TxVersion string

TxVersion is a transaction's version: "legacy", "0" or "1". The service sends the numbers as JSON numbers.

const (
	TxVersionLegacy TxVersion = "legacy"
	TxVersion0      TxVersion = "0"
	TxVersion1      TxVersion = "1"
)

func (TxVersion) MarshalJSON

func (v TxVersion) MarshalJSON() ([]byte, error)

func (*TxVersion) UnmarshalJSON

func (v *TxVersion) UnmarshalJSON(b []byte) error

type VersionInfo

type VersionInfo struct {
	SolanaCore string  `json:"solana-core"`
	FeatureSet *uint64 `json:"feature-set,omitempty"`
}

VersionInfo is sent or received as the spec's Version.

type VoteAccount

type VoteAccount struct {
	VotePubkey       string                   `json:"votePubkey"`
	NodePubkey       string                   `json:"nodePubkey"`
	ActivatedStake   uint64                   `json:"activatedStake"`
	EpochVoteAccount bool                     `json:"epochVoteAccount"`
	Commission       uint64                   `json:"commission"`
	LastVote         uint64                   `json:"lastVote"`
	EpochCredits     []VoteAccountEpochCredit `json:"epochCredits"`
	RootSlot         uint64                   `json:"rootSlot"`
}

VoteAccount is sent or received as the spec's VoteAccount.

type VoteAccountEpochCredit

type VoteAccountEpochCredit struct {
	Epoch           uint64
	Credits         uint64
	PreviousCredits uint64
}

VoteAccountEpochCredit travels as a JSON array of 3 items; items after them are ignored.

func (VoteAccountEpochCredit) MarshalJSON

func (t VoteAccountEpochCredit) MarshalJSON() ([]byte, error)

func (*VoteAccountEpochCredit) UnmarshalJSON

func (t *VoteAccountEpochCredit) UnmarshalJSON(b []byte) error

type VoteAccounts

type VoteAccounts struct {
	Current    []VoteAccount `json:"current"`
	Delinquent []VoteAccount `json:"delinquent"`
}

VoteAccounts is sent or received as the spec's VoteAccounts.

type VoteAccountsConfig

type VoteAccountsConfig struct {
	Commitment              Commitment `json:"commitment,omitempty"`
	VotePubkey              string     `json:"votePubkey,omitempty"`
	KeepUnstakedDelinquents *bool      `json:"keepUnstakedDelinquents,omitempty"`
	DelinquentSlotDistance  *uint64    `json:"delinquentSlotDistance,omitempty"`
}

VoteAccountsConfig is sent or received as the spec's VoteAccountsConfig.

type WithContext

type WithContext[T any] struct {
	Context Context `json:"context"`
	Value   T       `json:"value"`
}

WithContext is an answer that carries the slot it was read at.

Directories

Path Synopsis
Package account runs a Carbium account by API on carbium.sh: service keys and their policies, webhooks, usage and the account's records, with an account API key (c_acct_…, made on the dashboard; keep it in CARBIUM_ACCOUNT_KEY).
Package account runs a Carbium account by API on carbium.sh: service keys and their policies, webhooks, usage and the account's records, with an account API key (c_acct_…, made on the dashboard; keep it in CARBIUM_ACCOUNT_KEY).
Package dca calls the DCA API on the dex (dex.carbium.io/api/dca).
Package dca calls the DCA API on the dex (dex.carbium.io/api/dca).
internal
gen command
Command gen writes the typed JSON-RPC surface of package carbium from the spec's openrpc.json: the result and config types, the method table and one typed method per served method.
Command gen writes the typed JSON-RPC surface of package carbium from the spec's openrpc.json: the result and config types, the method table and one typed method per served method.
genaccount command
Command genaccount writes package account's types and calls from the account API's OpenAPI description: every operation the TypeScript SDK offers, and none that it leaves to the dashboard.
Command genaccount writes package account's types and calls from the account API's OpenAPI description: every operation the TypeScript SDK offers, and none that it leaves to the dashboard.
httpx
Package httpx is the one JSON HTTP exchange the account, DCA and token clients share.
Package httpx is the one JSON HTTP exchange the account, DCA and token clients share.
planted
Package planted is a scripted local HTTP server for the sub-packages' tests: it answers from a script and records what it was sent.
Package planted is a scripted local HTTP server for the sub-packages' tests: it answers from a script and records what it was sent.
stream module
Package tokens calls the four public routes of the token metadata API at tokens.carbium.io: search, lookup, batch and the image address.
Package tokens calls the four public routes of the token metadata API at tokens.carbium.io: search, lookup, batch and the image address.
Package webhooks checks that a webhook delivery came from Carbium.
Package webhooks checks that a webhook delivery came from Carbium.
Package ws holds JSON-RPC subscriptions over wss://services.carbium.sh with the published reconnect rules: every live subscription is bound again after a reconnect, server ids are remapped, and OnReseed tells the caller to read again what it may have missed.
Package ws holds JSON-RPC subscriptions over wss://services.carbium.sh with the published reconnect rules: every live subscription is bound again after a reconnect, server ids are remapped, and OnReseed tells the caller to read again what it may have missed.

Jump to

Keyboard shortcuts

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