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)
}
Output:
Index ¶
- Constants
- func CheckEndpoint(endpoint string, schemes ...string) error
- func Methods() []string
- func NoRedirects(hc *http.Client) *http.Client
- func Ptr[T any](v T) *T
- func RESTRoutes() []string
- func RedactSecrets(text string) string
- func RetryAfterHeader(h http.Header) (time.Duration, bool)
- func Subscriptions() []string
- type AccountDataEncoding
- type AccountInfo
- type AccountInfoConfig
- type AccountKeySource
- type AddressHistoryDetails
- type AddressTransaction
- type BatchCall
- type BatchResult
- type BinaryEncoding
- type Block
- type BlockCommitment
- type BlockConfig
- type BlockEncoding
- type BlockNotification
- type BlockProduction
- type BlockProductionConfig
- type BlockProductionConfigRange
- type BlockProductionCount
- type BlockProductionRange
- type BlockSubscribeDetails
- type BlockTransaction
- type Client
- func (cl *Client) Batch(ctx context.Context, calls []BatchCall) ([]BatchResult, error)
- func (cl *Client) Call(ctx context.Context, method string, params any, out any) error
- func (cl *Client) Cq1Quote(ctx context.Context, params Cq1QuoteParams) (*Cq1Quote, error)
- func (cl *Client) Endpoint() string
- func (cl *Client) Format(f fmt.State, verb rune)
- func (c *Client) GetAccountInfo(ctx context.Context, pubkey string, config *AccountInfoConfig) (*WithContext[*AccountInfo], error)
- func (c *Client) GetAgGenesisCert(ctx context.Context) (json.RawMessage, error)
- func (c *Client) GetAsset(ctx context.Context, params GetAssetParams) (*DASAsset, error)
- func (c *Client) GetAssetBatch(ctx context.Context, params GetAssetsParams) ([]*DASAsset, error)
- func (c *Client) GetAssets(ctx context.Context, params GetAssetsParams) ([]*DASAsset, error)
- func (c *Client) GetAssetsByAuthority(ctx context.Context, params GetAssetsByAuthorityParams) (*DASAssetList, error)
- func (c *Client) GetAssetsByCreator(ctx context.Context, params GetAssetsByCreatorParams) (*DASAssetList, error)
- func (c *Client) GetAssetsByGroup(ctx context.Context, params GetAssetsByGroupParams) (*DASAssetList, error)
- func (c *Client) GetAssetsByOwner(ctx context.Context, params GetAssetsByOwnerParams) (*DASAssetList, error)
- func (c *Client) GetBalance(ctx context.Context, pubkey string, config *CommitmentConfig) (*WithContext[uint64], error)
- func (c *Client) GetBlock(ctx context.Context, slot uint64, config *BlockConfig) (*Block, error)
- func (c *Client) GetBlockCommitment(ctx context.Context, slot uint64) (*BlockCommitment, error)
- func (c *Client) GetBlockHeight(ctx context.Context, config *CommitmentConfig) (uint64, error)
- func (c *Client) GetBlockProduction(ctx context.Context, config *BlockProductionConfig) (*WithContext[BlockProduction], error)
- func (c *Client) GetBlockTime(ctx context.Context, slot uint64) (*int64, error)
- func (c *Client) GetBlocks(ctx context.Context, startSlot uint64, endSlot *uint64, ...) ([]uint64, error)
- func (c *Client) GetBlocksWithLimit(ctx context.Context, startSlot uint64, limit uint64, ...) ([]uint64, error)
- func (c *Client) GetClusterNodes(ctx context.Context) ([]ClusterNode, error)
- func (c *Client) GetEpochInfo(ctx context.Context, config *CommitmentConfig) (*EpochInfo, error)
- func (c *Client) GetEpochSchedule(ctx context.Context) (*EpochSchedule, error)
- func (c *Client) GetFeeForMessage(ctx context.Context, message string, config *CommitmentConfig) (*WithContext[*uint64], error)
- func (c *Client) GetFirstAvailableBlock(ctx context.Context) (uint64, error)
- func (c *Client) GetGenesisHash(ctx context.Context) (string, error)
- func (c *Client) GetHealth(ctx context.Context) (string, error)
- func (c *Client) GetHighestSnapshotSlot(ctx context.Context) (*HighestSnapshotSlot, error)
- func (c *Client) GetIdentity(ctx context.Context) (*GetIdentityResult, error)
- func (c *Client) GetInflationGovernor(ctx context.Context, config *CommitmentOnlyConfig) (*InflationGovernor, error)
- func (c *Client) GetInflationRate(ctx context.Context) (*InflationRate, error)
- func (c *Client) GetInflationReward(ctx context.Context, addresses []string, config *GetInflationRewardConfig) ([]*InflationReward, error)
- func (c *Client) GetLargestAccounts(ctx context.Context, config *CommitmentConfig) (*WithContext[[]LargestAccount], error)
- func (c *Client) GetLatestBlockhash(ctx context.Context, config *CommitmentConfig) (*WithContext[LatestBlockhash], error)
- func (c *Client) GetLeaderSchedule(ctx context.Context, slot *uint64, config *LeaderScheduleConfig) (map[string][]uint64, error)
- func (c *Client) GetMaxRetransmitSlot(ctx context.Context) (uint64, error)
- func (c *Client) GetMaxShredInsertSlot(ctx context.Context) (uint64, error)
- func (c *Client) GetMinimumBalanceForRentExemption(ctx context.Context, dataLength uint64, config *CommitmentOnlyConfig) (uint64, error)
- func (c *Client) GetMultipleAccounts(ctx context.Context, pubkeys []string, config *AccountInfoConfig) (*WithContext[[]*AccountInfo], error)
- func (c *Client) GetNFTEditions(ctx context.Context, params GetNFTEditionsParams) (*DASEditionList, error)
- func (c *Client) GetPriorityFeeEstimate(ctx context.Context, params PriorityFeeEstimateParams) (*PriorityFeeEstimate, error)
- func (c *Client) GetProgramAccounts(ctx context.Context, programID string, config *ProgramAccountsConfig) (*ProgramAccounts, error)
- func (c *Client) GetRecentPerformanceSamples(ctx context.Context, limit *uint64) ([]PerformanceSample, error)
- func (c *Client) GetRecentPrioritizationFees(ctx context.Context, addresses []string) ([]PrioritizationFee, error)
- func (c *Client) GetSignatureStatuses(ctx context.Context, signatures []string, config *GetSignatureStatusesConfig) (*WithContext[[]*SignatureStatus], error)
- func (c *Client) GetSignaturesForAddress(ctx context.Context, address string, config *SignaturesForAddressConfig) ([]SignatureInfo, error)
- func (c *Client) GetSlot(ctx context.Context, config *CommitmentConfig) (uint64, error)
- func (c *Client) GetSlotLeader(ctx context.Context, config *CommitmentConfig) (string, error)
- func (c *Client) GetSlotLeaders(ctx context.Context, startSlot uint64, limit uint64) ([]string, error)
- func (c *Client) GetStakeMinimumDelegation(ctx context.Context, config *CommitmentOnlyConfig) (*WithContext[uint64], error)
- func (c *Client) GetSupply(ctx context.Context, config *GetSupplyConfig) (*WithContext[Supply], error)
- func (c *Client) GetTokenAccountBalance(ctx context.Context, tokenAccount string, config *CommitmentOnlyConfig) (*WithContext[TokenAmount], error)
- func (c *Client) GetTokenAccounts(ctx context.Context, params GetTokenAccountsParams) (*DASTokenAccountList, error)
- func (c *Client) GetTokenAccountsByDelegate(ctx context.Context, delegate string, filter TokenAccountsFilter, ...) (*WithContext[[]KeyedAccount], error)
- func (c *Client) GetTokenAccountsByOwner(ctx context.Context, owner string, filter TokenAccountsFilter, ...) (*WithContext[[]KeyedAccount], error)
- func (c *Client) GetTokenSupply(ctx context.Context, mint string, config *CommitmentOnlyConfig) (*WithContext[TokenAmount], error)
- func (c *Client) GetTransaction(ctx context.Context, signature string, config *TransactionConfig) (*TransactionWithMeta, error)
- func (c *Client) GetTransactionCount(ctx context.Context, config *CommitmentConfig) (uint64, error)
- func (c *Client) GetTransactionsForAddress(ctx context.Context, address string, config *TransactionsForAddressConfig) (*TransactionsForAddress, error)
- func (c *Client) GetVersion(ctx context.Context) (*VersionInfo, error)
- func (c *Client) GetVoteAccounts(ctx context.Context, config *VoteAccountsConfig) (*VoteAccounts, error)
- func (cl *Client) GoString() string
- func (c *Client) Health(ctx context.Context) (*QuoteHealth, error)
- func (c *Client) IsBlockhashValid(ctx context.Context, blockhash string, config *CommitmentConfig) (*WithContext[bool], error)
- func (c *Client) MinimumLedgerSlot(ctx context.Context) (uint64, error)
- func (c *Client) Prices(ctx context.Context, params PricesParams) (*Prices, error)
- func (c *Client) QnEstimatePriorityFees(ctx context.Context, params QnPriorityFeesParams) (*QnPriorityFees, error)
- func (c *Client) Quote(ctx context.Context, params QuoteParams) (*Quote, error)
- func (c *Client) SearchAssets(ctx context.Context, params SearchAssetsParams) (*DASAssetList, error)
- func (c *Client) SendTransaction(ctx context.Context, signedTransaction string, config *SendTransactionConfig) (string, error)
- func (c *Client) SimulateTransaction(ctx context.Context, transaction string, config *SimulateTransactionConfig) (*WithContext[SimulateTransactionResult], error)
- func (cl *Client) String() string
- func (c *Client) Swap(ctx context.Context, params SwapParams) (*Swap, error)
- type ClusterNode
- type Commitment
- type CommitmentConfig
- type CommitmentOnlyConfig
- type Context
- type Cq1Quote
- type Cq1QuoteParams
- type Cq1RouteLeg
- type Cq1SwapInfo
- type DASAsset
- type DASAssetAuthority
- type DASAssetCreator
- type DASAssetGroupingItem
- type DASAssetList
- type DASAssetListNativeBalance
- type DASAssetOwnership
- type DASDisplayOptions
- type DASEdition
- type DASEditionList
- type DASGrouping
- type DASSort
- type DASSortBy
- type DASTokenAccount
- type DASTokenAccountList
- type DASTokenType
- type DataSlice
- type Decimal
- type EncodedData
- type EncodedTransaction
- type Encoding
- type EpochInfo
- type EpochSchedule
- type Error
- type ErrorInit
- type ErrorKind
- type GetAssetParams
- type GetAssetsByAuthorityParams
- type GetAssetsByCreatorParams
- type GetAssetsByGroupParams
- type GetAssetsByOwnerParams
- type GetAssetsParams
- type GetIdentityResult
- type GetInflationRewardConfig
- type GetNFTEditionsParams
- type GetSignatureStatusesConfig
- type GetSupplyConfig
- type GetTokenAccountsParams
- type GetTokenAccountsParamsOptions
- type HighestSnapshotSlot
- type HistoryStatusFilter
- type HistoryTokenAccounts
- type InflationGovernor
- type InflationRate
- type InflationReward
- type InnerInstructions
- type KeyedAccount
- type LargestAccount
- type LatestBlockhash
- type LeaderScheduleConfig
- type LoadedAddresses
- type LogsNotification
- type MemcmpEncoding
- type MethodSpec
- type Options
- type ParsedData
- type PerformanceSample
- type Prices
- type PricesParams
- type PricesRow
- type PrioritizationFee
- type PriorityFeeEstimate
- type PriorityFeeEstimateParams
- type PriorityFeeEstimateParamsOptions
- type PriorityFeeEstimatePriorityFeeLevels
- type PriorityLevel
- type ProgramAccounts
- type ProgramAccountsConfig
- type ProgramAccountsFilter
- type ProgramAccountsFilterMemcmp
- type ProgramSubscribeFilter
- type ProgramSubscribeFilterMemcmp
- type QnPriorityFeeLevels
- type QnPriorityFees
- type QnPriorityFeesContext
- type QnPriorityFeesParams
- type Quote
- type QuoteHealth
- type QuoteParams
- type QuotePlatformFee
- type ReturnData
- type Reward
- type RouteLeg
- type RouteLegSwapInfo
- type SearchAssetsParams
- type Secret
- type SendTransactionConfig
- type SettledCommitment
- type SignatureInfo
- type SignatureNotification
- type SignatureStatus
- type SignaturesForAddressConfig
- type SimulateTransactionConfig
- type SimulateTransactionConfigAccounts
- type SimulateTransactionResult
- type SlotRange
- type SortOrder
- type Supply
- type Swap
- type SwapParams
- type SwapRouteRerouted
- type TokenAccountsFilter
- type TokenAmount
- type TokenBalance
- type TransactionAccountKey
- type TransactionConfig
- type TransactionDetails
- type TransactionEncoding
- type TransactionError
- type TransactionMeta
- type TransactionWithMeta
- type TransactionsForAddress
- type TransactionsForAddressConfig
- type TransactionsForAddressConfigFilters
- type TransactionsForAddressConfigFiltersTokenTransfer
- type TransferDirection
- type TxStatus
- type TxVersion
- type VersionInfo
- type VoteAccount
- type VoteAccountEpochCredit
- type VoteAccounts
- type VoteAccountsConfig
- type WithContext
Examples ¶
Constants ¶
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.
const DefaultEndpoint = "https://services.carbium.sh"
DefaultEndpoint is where the client sends calls unless Options.Endpoint says otherwise.
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 ¶
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 NoRedirects ¶
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 ¶
RedactSecrets replaces service keys, account keys, webhook secrets and key-bearing URL parts with a placeholder.
func RetryAfterHeader ¶
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 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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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) 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 ¶
GetAgGenesisCert calls getAgGenesisCert.
func (*Client) GetAssetBatch ¶
GetAssetBatch calls getAssetBatch. It shares a batch only with other DAS methods.
func (*Client) GetAssets ¶
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 ¶
GetBlock calls getBlock. maxSupportedTransactionVersion is sent as 1 unless config sets it.
func (*Client) GetBlockCommitment ¶
GetBlockCommitment calls getBlockCommitment.
func (*Client) GetBlockHeight ¶
GetBlockHeight calls getBlockHeight.
func (*Client) GetBlockProduction ¶
func (c *Client) GetBlockProduction(ctx context.Context, config *BlockProductionConfig) (*WithContext[BlockProduction], error)
GetBlockProduction calls getBlockProduction.
func (*Client) GetBlockTime ¶
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 ¶
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 ¶
GetFirstAvailableBlock calls getFirstAvailableBlock.
func (*Client) GetGenesisHash ¶
GetGenesisHash calls getGenesisHash.
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 ¶
GetMaxRetransmitSlot calls getMaxRetransmitSlot.
func (*Client) GetMaxShredInsertSlot ¶
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) GetSlotLeader ¶
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 ¶
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) 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 ¶
MinimumLedgerSlot calls minimumLedgerSlot.
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) 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.
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 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 ¶
DASAssetAuthority is sent or received as the spec's DasAsset.authorities[].
type DASAssetCreator ¶
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 ¶
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.
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 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 (*Decimal) UnmarshalJSON ¶
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.
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 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) Format ¶
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 ¶
MarshalJSON writes the fields in the names the TypeScript SDK uses.
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 ¶
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 ¶
PricesRow travels as a JSON array of 4 items; items after them are ignored.
func (PricesRow) MarshalJSON ¶
func (*PricesRow) UnmarshalJSON ¶
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 ¶
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) MarshalJSON ¶
MarshalJSON writes the placeholder, so logging an answer as JSON never writes the secret.
func (Secret) String ¶
String is the placeholder: the label before the value (c_serv_, c_acct_, whsec_) and an ellipsis.
func (*Secret) UnmarshalJSON ¶
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.
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 (*TxStatus) UnmarshalJSON ¶
type TxVersion ¶
type TxVersion string
TxVersion is a transaction's version: "legacy", "0" or "1". The service sends the numbers as JSON numbers.
func (TxVersion) MarshalJSON ¶
func (*TxVersion) UnmarshalJSON ¶
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 ¶
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 ¶
WithContext is an answer that carries the slot it was read at.
Source Files
¶
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. |