web3

package
v0.0.0-...-eaa0a66 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const CHUNK_SIZE = PacketDataSize - 300

CHUNK_SIZE Keep program chunks under PACKET_DATA_SIZE, leaving enough room for the rest of the Transaction fields

TODO: replace 300 with a proper constant for the size of the other Transaction fields

View Source
const DEFAULT_TICKS_PER_SLOT = 64
View Source
const LAMPORTS_PER_SOL uint64 = 1000000000

LAMPORTS_PER_SOL There are 1-billion lamports in one SOL

View Source
const LOOKUP_TABLE_META_SIZE = 56
View Source
const MAX_SEED_LENGTH = 32

MAX_SEED_LENGTH Maximum length of derived pubkey seed

View Source
const MINIMUM_SLOT_PER_EPOCH = 32
View Source
const MS_PER_SLOT = 1000 / NUM_SLOTS_PER_SECOND
View Source
const MaxTransactionBytes = 1232

MaxTransactionBytes https://solana.com/docs/core/transactions#transaction-size This means that the total size of a Solana transaction is limited to 1232 bytes. The combination of the signatures and the message cannot exceed this limit.

View Source
const NUM_TICKS_PER_SECOND = 160
View Source
const PUBLIC_KEY_LENGTH = 32

PUBLIC_KEY_LENGTH Size of public key in bytes

View Source
const PacketDataSize = 1280 - 40 - 8

PacketDataSize Maximum over-the-wire size of a Transaction

1280 is IPv6 minimum MTU
40 bytes is the size of the IPv6 header
8 bytes is the size of the fragment header
View Source
const SignatureLengthInBytes = 64

Variables

View Source
var CommonHTTPHeaders = map[string]string{
	"solana-client": "js/UNKNOWN",
}
View Source
var DefaultPubKey = MustPublicKey("11111111111111111111111111111111")

DefaultPubKey Default public key value. The base58-encoded string representation is all ones (as seen below) The underlying BN number is 32 bytes that are all zeros

View Source
var InvalidType = errors.New("invalid type")
View Source
var Keypair keypair
View Source
var Loader = LoaderImpl{}
View Source
var MessageVersion0Prefix = byte(1 << 7)
View Source
var SPLAssociatedTokenAccountProgramID = MustPublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL")
View Source
var SYSVAR_CLOCK_PUBKEY = MustPublicKey(
	"SysvarC1ock11111111111111111111111111111111",
)
View Source
var SYSVAR_EPOCH_SCHEDULE_PUBKEY = MustPublicKey(
	"SysvarEpochSchedu1e111111111111111111111111",
)
View Source
var SYSVAR_INSTRUCTIONS_PUBKEY = MustPublicKey(
	"Sysvar1nstructions1111111111111111111111111",
)
View Source
var SYSVAR_RECENT_BLOCKHASHES_PUBKEY = MustPublicKey(
	"SysvarRecentB1ockHashes11111111111111111111",
)
View Source
var SYSVAR_RENT_PUBKEY = MustPublicKey(
	"SysvarRent111111111111111111111111111111111",
)
View Source
var SYSVAR_REWARDS_PUBKEY = MustPublicKey(
	"SysvarRewards111111111111111111111111111111",
)
View Source
var SYSVAR_SLOT_HASHES_PUBKEY = MustPublicKey(
	"SysvarS1otHashes111111111111111111111111111",
)
View Source
var SYSVAR_SLOT_HISTORY_PUBKEY = MustPublicKey(
	"SysvarS1otHistory11111111111111111111111111",
)
View Source
var SYSVAR_STAKE_HISTORY_PUBKEY = MustPublicKey(
	"SysvarStakeHistory1111111111111111111111111",
)
View Source
var SystemProgramID = MustPublicKey("11111111111111111111111111111111")
View Source
var SysvarInstructions = MustPublicKey("Sysvar1nstructions1111111111111111111111111")
View Source
var TokenProgram2022ID = MustPublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb")
View Source
var TokenProgramID = MustPublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")
View Source
var VALIDATOR_INFO_KEY = MustPublicKey(
	"Va1idator1nfo111111111111111111111111111111",
)

Functions

func IsOnCurve

func IsOnCurve(pubkey PublicKey) bool

IsOnCurve Check that a pubkey is on the ed25519 curve.

func Ref

func Ref[T any](input T) *T

Types

type AccountBalancePair

type AccountBalancePair struct {
	Address  PublicKey `json:"address"`
	Lamports uint64    `json:"lamports"`
}

AccountBalancePair Pair of an account address and its balance

type AccountInfo

type AccountInfo[T any] struct {
	// `true` if this account's data contains a loaded program
	Executable bool `json:"executable,omitempty"`
	// Identifier of the program that owns the account
	Owner PublicKey `json:"owner,omitempty"`
	// Number of lamports assigned to the account
	Lamports uint64 `json:"lamports,omitempty"`
	// Optional data assigned to the account
	Data T `json:"data,omitempty"`
	// Optional rent epoch info for account
	RentEpoch *uint64 `json:"rentEpoch,omitempty"`
	// The data size of the account
	Space uint64 `json:"space,omitempty"`
}

AccountInfo Information describing an account

type AccountInfoD

type AccountInfoD = AccountInfo[EncodingData]

type AccountKeysFromLookups

type AccountKeysFromLookups = LoadedAddresses

type AccountMeta

type AccountMeta struct {
	Pubkey     PublicKey `json:"pubkey"`
	IsSigner   bool      `json:"isSigner"`
	IsWritable bool      `json:"isWritable"`
}

AccountMeta represents a public key and associated metadata

func Meta

func Meta(
	pubKey PublicKey,
) *AccountMeta

Meta intializes a new AccountMeta with the provided pubKey.

func (*AccountMeta) Equals

func (a *AccountMeta) Equals(other AccountMeta) bool

func (*AccountMeta) SIGNER

func (a *AccountMeta) SIGNER() *AccountMeta

func (*AccountMeta) SignerOR

func (a *AccountMeta) SignerOR(isSigner bool)

func (*AccountMeta) WRITE

func (a *AccountMeta) WRITE() *AccountMeta

func (*AccountMeta) WriteOR

func (a *AccountMeta) WriteOR(isWritable bool)

type AccountMetaSlice

type AccountMetaSlice []AccountMeta

func (AccountMetaSlice) Find

func (s AccountMetaSlice) Find(pub PublicKey) int

func (AccountMetaSlice) MoveToFirst

func (s AccountMetaSlice) MoveToFirst(pub PublicKey) AccountMetaSlice

func (AccountMetaSlice) Sort

func (AccountMetaSlice) ToHeader

func (s AccountMetaSlice) ToHeader() (h MessageHeader)

func (AccountMetaSlice) ToKeys

func (s AccountMetaSlice) ToKeys() (signedKeys []PublicKey, unsignedKeys []PublicKey)

type AccountsModeTransactionRet

type AccountsModeTransactionRet struct {
	AccountKeys []AnnotatedAccountKey `json:"accountKeys,omitempty"`
	Signatures  []string              `json:"signatures,omitempty"`
}

type AddressLookupTableAccount

type AddressLookupTableAccount struct {
	Key   PublicKey
	State AddressLookupTableState
}

func (AddressLookupTableAccount) IsActive

func (a AddressLookupTableAccount) IsActive() bool

type AddressLookupTableState

type AddressLookupTableState struct {
	TypeIndex              uint32
	DeactivationSlot       uint64
	LastExtendedSlot       uint64
	LastExtendedStartIndex uint8
	Authority              *PublicKey
	Addresses              []PublicKey
}

func (*AddressLookupTableState) MarshalWithEncoder

func (obj *AddressLookupTableState) MarshalWithEncoder(encoder *binary.Encoder) (err error)

func (*AddressLookupTableState) UnmarshalWithDecoder

func (obj *AddressLookupTableState) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)

type AnnotatedAccountKey

type AnnotatedAccountKey struct {
	Pubkey   string  `json:"pubkey"`
	Signer   bool    `json:"signer"`
	Writable bool    `json:"writable"`
	Source   *string `json:"source,omitempty"` // transaction,lookupTable
}

type Base58Bytes

type Base58Bytes []byte

func (*Base58Bytes) MarshalJSON

func (c *Base58Bytes) MarshalJSON() ([]byte, error)

func (*Base58Bytes) UnmarshalJSON

func (c *Base58Bytes) UnmarshalJSON(data []byte) (err error)

type BaseConfig

type BaseConfig struct {
	Commitment *Commitment
	// The minimum slot that the request can be evaluated at
	MinContextSlot uint64 `json:"minContextSlot,omitempty"`
}

type BigFloat

type BigFloat big.Float

func (*BigFloat) Raw

func (bf *BigFloat) Raw() *big.Float

func (*BigFloat) UnmarshalJSON

func (bf *BigFloat) UnmarshalJSON(data []byte) error

type BlockProduction

type BlockProduction struct {
	// A dictionary of validator identities, as base-58 encoded strings.
	// Value is a two-element array containing the number of leader slots and the number of blocks produced.
	ByIdentity map[string][2]int `json:"byIdentity"`
	// Block production slot range
	Range struct {
		// First slot to return block production information for (inclusive)
		FirstSlot int `json:"firstSlot"`
		// Last slot to return block production information for (inclusive). If parameter not provided, defaults to the highest slot
		LastSlot *int `json:"lastSlot,omitempty"`
	} `json:"range"`
}

BlockProduction represents recent block production information.

type BlockResponse

type BlockResponse[T any] struct {
	Blockhash         Blockhash                  `json:"blockhash,omitempty"`
	PreviousBlockhash Blockhash                  `json:"previousBlockhash,omitempty"`
	ParentSlot        uint64                     `json:"parentSlot,omitempty"`
	Transactions      []BlockResponseCommonTx[T] `json:"transactions,omitempty"`
	Rewards           []RewardsResult            `json:"rewards,omitempty"`
	BlockTime         int64                      `json:"blockTime,omitempty"`
	BlockHeight       uint64                     `json:"blockHeight,omitempty"`
}

type BlockResponseCommonTx

type BlockResponseCommonTx[T any] struct {
	Transaction T                         `json:"transaction,omitempty"`
	Meta        *ConfirmedTransactionMeta `json:"meta,omitempty"`
	Version     *TransactionVersion       `json:"version,omitempty"`
}

type BlockSignatures

type BlockSignatures struct {
	// Blockhash of this block
	Blockhash Blockhash `json:"blockhash"`
	// Blockhash of this block's parent
	PreviousBlockhash Blockhash `json:"previousBlockhash"`
	// Slot index of this block's parent
	ParentSlot uint64 `json:"parentSlot"`
	// Vector of signatures
	Signatures []string `json:"signatures"`
	// The unix timestamp of when the block was processed (nullable)
	BlockTime int64 `json:"blockTime,omitempty"`
}

BlockSignatures represents a block on the ledger with signatures only.

type Blockhash

type Blockhash = string

type BlockhashWithExpiryBlockHeight

type BlockhashWithExpiryBlockHeight struct {
	Blockhash            Blockhash `json:"blockhash,omitempty"`
	LastValidBlockHeight uint64    `json:"lastValidBlockHeight,omitempty"`
}

type BlockheightBasedTransactionConfirmationStrategy

type BlockheightBasedTransactionConfirmationStrategy struct {
	Signature TransactionSignature
	BlockhashWithExpiryBlockHeight
}

BlockheightBasedTransactionConfirmationStrategy A strategy for confirming transactions that uses the last valid block height for a given blockhash to check for transaction expiration.

type ByPriority

type ByPriority []AccountMeta

func (ByPriority) Len

func (a ByPriority) Len() int

func (ByPriority) Less

func (a ByPriority) Less(i, j int) bool

func (ByPriority) Swap

func (a ByPriority) Swap(i, j int)

type Cluster

type Cluster string
const (
	Devnet      Cluster = "devnet"
	Testnet     Cluster = "testnet"
	MainnetBeta Cluster = "mainnet-beta"
)

func (Cluster) Url

func (c Cluster) Url() string

func (Cluster) UrlWithoutTls

func (c Cluster) UrlWithoutTls() string

type Commitment

type Commitment string

Commitment The level of commitment desired when querying state

'processed': Query the most recent block which has reached 1 confirmation by the connected node
'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
'finalized': Query the most recent block which has been finalized by the cluster
var (
	CommitmentProcessed    Commitment = "processed"
	CommitmentConfirmed    Commitment = "confirmed"
	CommitmentFinalized    Commitment = "finalized"
	CommitmentRecent       Commitment = "recent"       // Deprecated: as of v1.5.5
	CommitmentSingle       Commitment = "single"       // Deprecated: as of v1.5.5
	CommitmentSingleGossip Commitment = "singleGossip" // Deprecated: as of v1.5.5
	CommitmentRoot         Commitment = "root"         // Deprecated: as of v1.5.5
	CommitmentMax          Commitment = "max"          // Deprecated: as of v1.5.5
)

func CommitmentFromString

func CommitmentFromString(str string) *Commitment

type CompileLegacyArgs

type CompileLegacyArgs struct {
	PayerKey        PublicKey
	Instructions    []TransactionInstruction
	RecentBlockhash Blockhash
}

type CompileV0Args

type CompileV0Args struct {
	PayerKey                   PublicKey
	Instructions               []TransactionInstruction
	RecentBlockhash            Blockhash
	AddressLookupTableAccounts []AddressLookupTableAccount
}

type CompiledInnerInstruction

type CompiledInnerInstruction struct {
	Index        uint64                `json:"index,omitempty"`
	Instructions []CompiledInstruction `json:"instructions"`
}

type CompiledInstruction

type CompiledInstruction struct {
	//  Index into the transaction keys array indicating the program account that executes this instruction
	ProgramIdIndex uint8 `json:"programIdIndex,omitempty"`
	// Ordered indices into the transaction keys array indicating which accounts to pass to the program
	Accounts []uint8 `json:"accounts,omitempty"`
	// The program input data encoded as base58
	Data Base58Bytes `json:"data,omitempty"`
}

type CompiledKeyMeta

type CompiledKeyMeta struct {
	IsSigner   bool
	IsWritable bool
	IsInvoked  bool
}

type CompiledKeys

type CompiledKeys struct {
	Payer      PublicKey
	KeyMetaMap KeyMetaMap
}

func NewCompileKeys

func NewCompileKeys(instructions []TransactionInstruction, payer PublicKey) CompiledKeys

type ComplexSigner

type ComplexSigner struct {
	PublicKey PublicKey
	// contains filtered or unexported fields
}

func NewComplexSigner

func NewComplexSigner(sig Signer) ComplexSigner

func NewComplexSignerMulti

func NewComplexSignerMulti(account PublicKey, signers []Signer) ComplexSigner

func (ComplexSigner) Addresses

func (c ComplexSigner) Addresses() []PublicKey

func (ComplexSigner) GetSigner

func (c ComplexSigner) GetSigner(key PublicKey) Signer

func (ComplexSigner) IsMultiSig

func (c ComplexSigner) IsMultiSig() bool

func (ComplexSigner) Signers

func (c ComplexSigner) Signers() []Signer

type ConfirmOptions

type ConfirmOptions struct {
	SkipPreflight       *bool       // Disable transaction verification step
	Commitment          *Commitment // Desired commitment level
	PreflightCommitment *Commitment // Preflight commitment level
	MaxRetries          *uint       // Maximum number of times for the RPC node to retry sending the transaction to the leader.
	MinContextSlot      *uint64     // The minimum slot that the request can be evaluated at
}

ConfirmOptions represents options for confirming transactions

type ConfirmedSignatureInfo

type ConfirmedSignatureInfo struct {
	// The transaction signature
	Signature string `json:"signature"`
	// When the transaction was processed
	Slot int `json:"slot"`
	// Error, if any
	Err TransactionError `json:"err"`
	// Memo associated with the transaction, if any
	Memo string `json:"memo,omitempty"`
	// The Unix timestamp of when the transaction was processed (nullable)
	BlockTime *uint64 `json:"blockTime,omitempty"`
	// Cluster confirmation status, if available. Possible values: `processed`, `confirmed`, `finalized`
	ConfirmationStatus TransactionConfirmationStatus `json:"confirmationStatus,omitempty"`
}

ConfirmedSignatureInfo represents a confirmed signature with its status.

type ConfirmedSignaturesForAddress2Options

type ConfirmedSignaturesForAddress2Options struct {
	Before TransactionSignature // Start searching backwards from this transaction signature.
	Until  TransactionSignature // Search until this transaction signature is reached, if found before `limit`.
	Limit  *int                 // Maximum transaction signatures to return (between 1 and 1,000, default: 1,000).
}

ConfirmedSignaturesForAddress2Options represents options for getConfirmedSignaturesForAddress2

type ConfirmedTransactionMeta

type ConfirmedTransactionMeta struct {
	// The fee charged for processing the transaction
	Fee uint64 `json:"fee,omitempty"`
	// An array of cross program invoked parsed instructions
	InnerInstructions []CompiledInnerInstruction `json:"innerInstructions,omitempty"`
	// The balances of the transaction accounts before processing
	PreBalances []uint64 `json:"preBalances,omitempty"`
	// The balances of the transaction accounts after processing
	PostBalances []int64 `json:"postBalances,omitempty"`
	// An array of program log messages emitted during a transaction
	LogMessages []string `json:"logMessages,omitempty"`
	// The token balances of the transaction accounts before processing
	PreTokenBalances []TokenBalance `json:"preTokenBalances,omitempty"`
	// The token balances of the transaction accounts after processing
	PostTokenBalances []TokenBalance `json:"postTokenBalances,omitempty"`
	// The error result of transaction processing
	Err TransactionError `json:"err,omitempty"`
	// The collection of addresses loaded using address lookup tables
	LoadedAddresses *LoadedAddresses `json:"loadedAddresses,omitempty"`
	// The compute units consumed after processing the transaction
	ComputeUnitsConsumed *uint64 `json:"computeUnitsConsumed,omitempty"`
}

ConfirmedTransactionMeta Metadata for a confirmed transaction on the ledger

type Connection

type Connection struct {
	Debug bool
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(
	endpoint string,
	config *ConnectionConfig,
) (*Connection, error)

func (*Connection) Close

func (c *Connection) Close()

func (*Connection) Commitment

func (c *Connection) Commitment() *Commitment

Commitment The default commitment used for requests

func (*Connection) ConfirmTransaction

func (c *Connection) ConfirmTransaction(
	ctx context.Context,
	strategy any,
	commitment *Commitment,
) (*RpcResponseAndContext[SignatureResult], error)

func (*Connection) GetAccountInfo

func (c *Connection) GetAccountInfo(publicKey PublicKey, config GetAccountInfoConfig) (*AccountInfoD, error)

GetAccountInfo Fetch all the account info for the specified public key

func (*Connection) GetAccountInfoAndContext

func (c *Connection) GetAccountInfoAndContext(publicKey PublicKey, config GetAccountInfoConfig) (*RpcResponseAndContext[*AccountInfoD], error)

GetAccountInfoAndContext Fetch all the account info for the specified public key, return with context

func (*Connection) GetAddressLookupTable

func (c *Connection) GetAddressLookupTable(accountKey PublicKey, config GetAccountInfoConfig) (*RpcResponseAndContext[*AddressLookupTableAccount], error)

func (*Connection) GetBalance

func (c *Connection) GetBalance(publicKey PublicKey, config GetBalanceConfig) (uint64, error)

GetBalance Fetch the balance for the specified public key

func (*Connection) GetBalanceAndContext

func (c *Connection) GetBalanceAndContext(publicKey PublicKey, config GetBalanceConfig) (*RpcResponseAndContext[uint64], error)

GetBalanceAndContext Fetch the balance for the specified public key, return with context

func (*Connection) GetBlock

GetBlock detail: default: full

func (*Connection) GetBlockCtx

GetBlockCtx detail: default: full

func (*Connection) GetBlockHeight

func (c *Connection) GetBlockHeight(config GetBlockHeightConfig) (uint64, error)

func (*Connection) GetBlockProduction

GetBlockProduction Returns recent block production information from the current or previous epoch

func (*Connection) GetBlockSignatures

func (c *Connection) GetBlockSignatures(slot uint64, commitment *Commitment) (*BlockSignatures, error)

GetBlockSignatures Fetch a list of signatures from the cluster for a block, excluding rewards commitment: "confirmed" or "finalized"

func (*Connection) GetBlockTime

func (c *Connection) GetBlockTime(slot int64) (uint64, error)

GetBlockTime Fetch the estimated production time of a block

func (*Connection) GetBlockWithAccounts

func (c *Connection) GetBlockWithAccounts(slot uint64, config GetBlockConfig) (*BlockResponse[AccountsModeTransactionRet], error)

GetBlockWithAccounts Fetch a processed block from the cluster

transactionDetails: // Level of transaction detail to return, either "full", "accounts", "signatures", or "none". If
// parameter not provided, the default detail level is "full". If "accounts" are requested,
// transaction details only include signatures and an annotated list of accounts in each
// transaction. Transaction metadata is limited to only: fee, err, pre_balances, post_balances,
// pre_token_balances, and post_token_balances.

func (*Connection) GetBlockWithNone

func (c *Connection) GetBlockWithNone(slot uint64, config GetBlockConfig) (*BlockResponse[struct{}], error)

GetBlockWithNone Fetch a processed block from the cluster transactions of the response is nil

func (*Connection) GetBlocks

func (c *Connection) GetBlocks(startSlot uint64, endSlot *uint64, commitment *Commitment) ([]uint64, error)

GetBlocks Fetch confirmed blocks between two slots [startSlot, endSlot] commitment: "confirmed" or "finalized" returns an array of slots which contain a block

func (*Connection) GetClusterNodes

func (c *Connection) GetClusterNodes() ([]ContactInfo, error)

GetClusterNodes Return the list of nodes that are currently participating in the cluster

func (*Connection) GetConfirmedBlockSignatures

func (c *Connection) GetConfirmedBlockSignatures(slot uint64, commitment *Commitment) (*BlockSignatures, error)

GetConfirmedBlockSignatures Fetch a list of signatures from the cluster for a confirmed block, excluding rewards Deprecated: since Solana v1.8.0. Please use {@link getBlockSignatures} instead.

func (*Connection) GetEpochInfo

func (c *Connection) GetEpochInfo(config GetEpochInfoConfig) (EpochInfo, error)

GetEpochInfo Fetch the Epoch Info parameters

func (*Connection) GetEpochSchedule

func (c *Connection) GetEpochSchedule() (EpochSchedule, error)

GetEpochSchedule Fetch the Epoch Schedule parameters

func (*Connection) GetFeeForMessage

func (c *Connection) GetFeeForMessage(message VersionedMessage, commitment *Commitment) (*RpcResponseAndContext[*uint64], error)

GetFeeForMessage Fetch the fee for a message from the cluster, return with context

func (*Connection) GetFirstAvailableBlock

func (c *Connection) GetFirstAvailableBlock() (uint64, error)

GetFirstAvailableBlock Fetch the slot of the lowest confirmed block that has not been purged from the ledger

func (*Connection) GetGenesisHash

func (c *Connection) GetGenesisHash() (Blockhash, error)

GetGenesisHash Fetch the genesis hash

func (*Connection) GetInflationGovernor

func (c *Connection) GetInflationGovernor(commitment *Commitment) (*InflationGovernor, error)

GetInflationGovernor Fetch the cluster InflationGovernor parameters

func (*Connection) GetInflationRate

func (c *Connection) GetInflationRate() (InflationRate, error)

GetInflationRate Fetch the specific inflation values for the current epoch

func (*Connection) GetInflationReward

func (c *Connection) GetInflationReward(addresses []PublicKey, config GetInflationRewardConfig) (InflationReward, error)

GetInflationReward Fetch the inflation reward for a list of addresses for an epoch

func (*Connection) GetLargestAccounts

GetLargestAccounts Fetch the 20 largest accounts with their current balances

func (*Connection) GetLatestBlockhash

GetLatestBlockhash Fetch the latest blockhash from the cluster

func (*Connection) GetLatestBlockhashAndContext

GetLatestBlockhashAndContext Fetch the latest blockhash from the cluster

func (*Connection) GetLeaderSchedule

func (c *Connection) GetLeaderSchedule() (LeaderSchedule, error)

GetLeaderSchedule Fetch the leader schedule for the current epoch

func (*Connection) GetMinimumBalanceForRentExemption

func (c *Connection) GetMinimumBalanceForRentExemption(dataLength int, commitment *Commitment) (uint64, error)

GetMinimumBalanceForRentExemption Fetch the minimum balance needed to exempt an account of `dataLength` size from rent

func (*Connection) GetMinimumLedgerSlot

func (c *Connection) GetMinimumLedgerSlot() (uint64, error)

GetMinimumLedgerSlot Fetch the lowest slot that the node has information about in its ledger. This value may increase over time if the node is configured to purge older ledger data

func (*Connection) GetMultipleAccountsInfo

func (c *Connection) GetMultipleAccountsInfo(publicKeys []PublicKey, config GetMultipleAccountsConfig) ([]*AccountInfoD, error)

GetMultipleAccountsInfo Fetch all the account info for multiple accounts specified by an array of public keys publicKeys: up to a maximum of 100

func (*Connection) GetMultipleAccountsInfoAndContext

func (c *Connection) GetMultipleAccountsInfoAndContext(publicKeys []PublicKey, config GetMultipleAccountsConfig) (*RpcResponseAndContext[[]*AccountInfoD], error)

GetMultipleAccountsInfoAndContext Fetch all the account info for multiple accounts specified by an array of public keys, return with context

func (*Connection) GetMultipleParsedAccounts

func (c *Connection) GetMultipleParsedAccounts(publicKeys []PublicKey, config GetMultipleAccountsConfig) (*RpcResponseAndContext[[]*AccountInfo[ParsedAccountDataOrBytes]], error)

GetMultipleParsedAccounts Fetch all the account info for multiple accounts specified by an array of public keys, return with context

func (*Connection) GetNonce

func (c *Connection) GetNonce(nonceAccount PublicKey, config GetNonceConfig) (*system.NonceAccount, error)

GetNonce Fetch the contents of a Nonce account from the cluster

func (*Connection) GetNonceAndContext

func (c *Connection) GetNonceAndContext(
	nonceAccount PublicKey,
	config GetNonceAndContextConfig,
) (*RpcResponseAndContext[*NonceAccount], error)

GetNonceAndContext Fetch the contents of a Nonce account from the cluster, return with context

func (*Connection) GetParsedAccountInfo

GetParsedAccountInfo Fetch parsed account info for the specified public key

func (*Connection) GetParsedProgramAccounts

func (c *Connection) GetParsedProgramAccounts(programId PublicKey, config GetParsedProgramAccountsConfig) ([]struct {
	Pubkey  PublicKey                             `json:"pubkey"`
	Account AccountInfo[ParsedAccountDataOrBytes] `json:"account"`
}, error)

GetParsedProgramAccounts Fetch and parse all the accounts owned by the specified program id

func (*Connection) GetParsedTokenAccountsByOwner

func (c *Connection) GetParsedTokenAccountsByOwner(
	ownerAddress PublicKey,
	filter TokenAccountsFilter,
	commitment *Commitment,
) (*RpcResponseAndContext[[]ParsedAccount], error)

GetParsedTokenAccountsByOwner Fetch parsed token accounts owned by the specified account

func (*Connection) GetProgramAccounts

func (c *Connection) GetProgramAccounts(programId PublicKey, config GetProgramAccountsConfig) ([]GetProgramAccountsResponse, error)

GetProgramAccounts Fetch all the accounts owned by the specified program id

func (*Connection) GetProgramAccountsAndContext

func (c *Connection) GetProgramAccountsAndContext(programId PublicKey, config GetProgramAccountsConfig) (*RpcResponseAndContext[[]GetProgramAccountsResponse], error)

GetProgramAccountsAndContext Fetch all the accounts owned by the specified program id

func (*Connection) GetRecentPerformanceSamples

func (c *Connection) GetRecentPerformanceSamples(limit int) ([]PerfSample, error)

GetRecentPerformanceSamples Fetch recent performance samples

func (*Connection) GetRecentPrioritizationFees

func (c *Connection) GetRecentPrioritizationFees(config GetRecentPrioritizationFeesConfig) ([]RecentPrioritizationFees, error)

GetRecentPrioritizationFees Fetch a list of prioritization fees from recent blocks.

func (*Connection) GetSignatureStatus

func (*Connection) GetSignatureStatuses

func (c *Connection) GetSignatureStatuses(signatures []TransactionSignature, config SignatureStatusConfig) (*RpcResponseAndContext[[]SignatureStatus], error)

func (*Connection) GetSignaturesForAddress

func (c *Connection) GetSignaturesForAddress(address PublicKey, options SignaturesForAddressOptions, commitment *Commitment) (*ConfirmedSignatureInfo, error)

GetSignaturesForAddress Returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block commitment: "confirmed" or "finalized"

func (*Connection) GetSlot

func (c *Connection) GetSlot(config GetSlotConfig) (uint64, error)

GetSlot Fetch the current slot that the node is processing

func (*Connection) GetSlotLeader

func (c *Connection) GetSlotLeader(config GetSlotLeaderConfig) (PublicKey, error)

GetSlotLeader Fetch the current slot leader of the cluster

func (*Connection) GetSlotLeaders

func (c *Connection) GetSlotLeaders(startSlot uint64, limit uint64) ([]PublicKey, error)

GetSlotLeaders Fetch `limit` number of slot leaders starting from `startSlot` @param startSlot fetch slot leaders starting from this slot @param limit number of slot leaders to return

func (*Connection) GetStakeMinimumDelegation

func (c *Connection) GetStakeMinimumDelegation(config GetStakeMinimumDelegationConfig) (*RpcResponseAndContext[uint64], error)

GetStakeMinimumDelegation get the stake minimum delegation

func (*Connection) GetSupply

func (c *Connection) GetSupply(config GetSupplyConfig) (*RpcResponseAndContext[Supply], error)

GetSupply Fetch information about the current supply

func (*Connection) GetTokenAccountBalance

func (c *Connection) GetTokenAccountBalance(tokenAddress PublicKey, commitment *Commitment) (*RpcResponseAndContext[TokenAmount], error)

GetTokenAccountBalance Fetch the current balance of a token account

func (*Connection) GetTokenAccountsByDelegate

GetTokenAccountsByDelegate Returns all SPL Token accounts by approved Delegate.

func (*Connection) GetTokenAccountsByOwner

func (c *Connection) GetTokenAccountsByOwner(
	ownerAddress PublicKey,
	filter TokenAccountsFilter,
	config GetTokenAccountsByOwnerConfig,
) (*RpcResponseAndContext[[]GetProgramAccountsResponse], error)

GetTokenAccountsByOwner Fetch all the token accounts owned by the specified account

func (*Connection) GetTokenLargestAccounts

func (c *Connection) GetTokenLargestAccounts(mintAddress PublicKey, commitment *Commitment) (*RpcResponseAndContext[[]TokenAccountBalancePair], error)

GetTokenLargestAccounts Fetch the 20 largest token accounts with their current balances for a given mint.

func (*Connection) GetTokenSupply

func (c *Connection) GetTokenSupply(tokenMintAddress PublicKey, commitment *Commitment) (*RpcResponseAndContext[TokenAmount], error)

GetTokenSupply Fetch the current supply of a token mint

func (*Connection) GetTotalSupply

func (c *Connection) GetTotalSupply(commitment *Commitment) (uint64, error)

GetTotalSupply Fetch the current total currency supply of the cluster in lamports Deprecated: since v1.2.8. Please use {@link getSupply} instead.

func (*Connection) GetTransaction

func (c *Connection) GetTransaction(signature string, config GetVersionedTransactionConfig) (*VersionedTransactionResponse, error)

GetTransaction Fetch a confirmed or finalized transaction from the cluster.

func (*Connection) GetTransactionCount

func (c *Connection) GetTransactionCount(config GetTransactionCountConfig) (uint64, error)

GetTransactionCount Fetch the current transaction count of the cluster

func (*Connection) GetVersion

func (c *Connection) GetVersion() (Version, error)

GetVersion Fetch the node version

func (*Connection) GetVoteAccounts

func (c *Connection) GetVoteAccounts(commitment *Commitment) (VoteAccountStatus, error)

GetVoteAccounts Return the list of nodes that are currently participating in the cluster

func (*Connection) GetWsClient

func (c *Connection) GetWsClient() *ws.Client

GetWsClient returns a websocket client for subscription

func (*Connection) IsBlockhashValid

func (c *Connection) IsBlockhashValid(blockhash Blockhash, config IsBlockhashValidConfig) (*RpcResponseAndContext[bool], error)

IsBlockhashValid Returns whether a blockhash is still valid or not

func (*Connection) RequestAirdrop

func (c *Connection) RequestAirdrop(to PublicKey, lamports uint64) (TransactionSignature, error)

RequestAirdrop Request an allocation of lamports to the specified address

func (*Connection) RpcEndpoint

func (c *Connection) RpcEndpoint() string

RpcEndpoint The RPC endpoint

func (*Connection) SendAndConfirmTransaction

func (c *Connection) SendAndConfirmTransaction(
	ctx context.Context, tx Transaction, signers []Signer, options ConfirmOptions,
) (TransactionSignature, error)

func (*Connection) SendEncodedTransaction

func (c *Connection) SendEncodedTransaction(encodedTransaction string, options SendOptions) (TransactionSignature, error)

SendEncodedTransaction Send a transaction that has already been signed, serialized into the wire format, and encoded as a base64 string

func (*Connection) SendRawTransaction

func (c *Connection) SendRawTransaction(rawTransaction []byte, options SendOptions) (TransactionSignature, error)

SendRawTransaction Send a transaction that has already been signed and serialized into the wire format

func (*Connection) SendTransaction

func (c *Connection) SendTransaction(
	transaction any,
	signers []Signer,
	options SendOptions,
) (TransactionSignature, error)

SendTransaction Sign and send a transaction

func (*Connection) SimulateTransaction

func (c *Connection) SimulateTransaction(tx Transaction, config SimulateTransactionConfig, signers []Signer) (SimulatedTransactionResponse, error)

func (*Connection) SimulateTransactionV0

func (c *Connection) SimulateTransactionV0(transaction VersionedTransaction) (SimulatedTransactionResponse, error)

type ConnectionConfig

type ConnectionConfig struct {
	Commitment                       *Commitment       // Optional commitment level
	WsEndpoint                       *string           // Optional endpoint URL to the fullnode JSON RPC PubSub WebSocket Endpoint
	HttpHeaders                      map[string]string // Optional HTTP headers object
	DisableRetryOnRateLimit          *bool             // Optional Disable retrying calls when server responds with HTTP 429 (Too Many Requests)
	ConfirmTransactionInitialTimeout *int              // Time to allow for the server to initially process a transaction (in milliseconds)
}

ConnectionConfig represents configuration for instantiating a Connection

type ContactInfo

type ContactInfo struct {
	// Identity public key of the node
	Pubkey string `json:"pubkey"`
	// Gossip network address for the node
	Gossip string `json:"gossip,omitempty"`
	// TPU network address for the node (null if not available)
	TPU string `json:"tpu,omitempty"`
	// JSON RPC network address for the node (null if not available)
	RPC string `json:"rpc,omitempty"`
	// Software version of the node (null if not available)
	Version string `json:"version,omitempty"`
}

ContactInfo represents information describing a cluster node.

type Context

type Context struct {
	ApiVersion string `json:"apiVersion"`
	Slot       uint64 `json:"slot"`
}

Context represents extra contextual information for RPC responses

type CustomClient

type CustomClient struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewCustomClient

func NewCustomClient(endpoint string, httpHeaders map[string]string, disableRetryOnRateLimit bool) *CustomClient

func (*CustomClient) SendRequest

func (client *CustomClient) SendRequest(ctx context.Context, method string, args []any, debug bool) (io.ReadCloser, error)

type DataSizeFilter

type DataSizeFilter struct {
	DataSize *uint64
}

type DataSlice

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

type DecompileArgs

type DecompileArgs struct {
	AccountKeysFromLookups     *AccountKeysFromLookups
	AddressLookupTableAccounts []AddressLookupTableAccount
}

type DurableNonce

type DurableNonce = string

DurableNonce A durable nonce is a 32 byte value encoded as a base58 string.

type DurableNonceTransactionConfirmationStrategy

type DurableNonceTransactionConfirmationStrategy struct {
	Signature TransactionSignature
	// The lowest slot at which to fetch the nonce value from the
	// nonce account. This should be no lower than the slot at
	// which the last-known value of the nonce was fetched.
	MinContextSlot uint64
	// The account where the current value of the nonce is stored.
	NonceAccountPubkey PublicKey
	// The nonce value that was used to sign the transaction
	// for which confirmation is being sought.
	NonceValue DurableNonce
}

DurableNonceTransactionConfirmationStrategy A strategy for confirming durable nonce transactions.

type Encoding

type Encoding string
var (
	EncodingJsonParsed Encoding = "jsonParsed"
	EncodingBase64     Encoding = "base64"
)

type EncodingData

type EncodingData = solana.Data

type EpochInfo

type EpochInfo struct {
	// Epoch number
	Epoch uint64 `json:"epoch"`
	// Slot index within the epoch
	SlotIndex uint64 `json:"slotIndex"`
	// Number of slots in the epoch
	SlotsInEpoch uint64 `json:"slotsInEpoch"`
	// Absolute slot number
	AbsoluteSlot uint64 `json:"absoluteSlot"`
	// Block height (optional)
	BlockHeight *uint64 `json:"blockHeight,omitempty"`
	// Transaction count (optional)
	TransactionCount *uint64 `json:"transactionCount,omitempty"`
}

EpochInfo represents information about the current epoch.

type EpochSchedule

type EpochSchedule struct {
	// The maximum number of slots in each epoch
	SlotsPerEpoch int `json:"slotsPerEpoch,omitempty"`
	// The number of slots before the beginning of an epoch to calculate a leader schedule for that epoch
	LeaderScheduleSlotOffset int `json:"leaderScheduleSlotOffset,omitempty"`
	// Indicates whether epochs start short and grow
	Warmup bool `json:"warmup,omitempty"`
	// The first epoch with `SlotsPerEpoch` slots
	FirstNormalEpoch int `json:"firstNormalEpoch,omitempty"`
	// The first slot of `FirstNormalEpoch`
	FirstNormalSlot int `json:"firstNormalSlot,omitempty"`
}

EpochSchedule represents the epoch schedule.

func NewEpochSchedule

func NewEpochSchedule(slotsPerEpoch, leaderScheduleSlotOffset int, warmup bool, firstNormalEpoch, firstNormalSlot int) *EpochSchedule

func (*EpochSchedule) GetEpoch

func (es *EpochSchedule) GetEpoch(slot int) int

func (*EpochSchedule) GetEpochAndSlotIndex

func (es *EpochSchedule) GetEpochAndSlotIndex(slot int) (int, int)

func (*EpochSchedule) GetFirstSlotInEpoch

func (es *EpochSchedule) GetFirstSlotInEpoch(epoch int) int

func (*EpochSchedule) GetLastSlotInEpoch

func (es *EpochSchedule) GetLastSlotInEpoch(epoch int) int

func (*EpochSchedule) GetSlotsInEpoch

func (es *EpochSchedule) GetSlotsInEpoch(epoch int) int

type ErrorProvider

type ErrorProvider interface {
	GetError() *RpcResponseError
}

type GetAccountInfoConfig

type GetAccountInfoConfig struct {
	//  The level of commitment desired
	Commitment *Commitment
	//  The minimum slot that the request can be evaluated at
	MinContextSlot uint64 `json:"minContextSlot,omitempty"`
	//  Optional data slice to limit the returned account data
	DataSlice *DataSlice `json:"dataSlice,omitempty"`
}

GetAccountInfoConfig Configuration object for changing `getAccountInfo` query behavior

type GetAccountKeysArgs

type GetAccountKeysArgs struct {
	AccountKeysFromLookups     *AccountKeysFromLookups
	AddressLookupTableAccounts []AddressLookupTableAccount
}

type GetBalanceConfig

type GetBalanceConfig struct {
	// The level of commitment desired
	Commitment *Commitment
	// The minimum slot that the request can be evaluated at
	MinContextSlot uint64 `json:"minContextSlot,omitempty"`
}

GetBalanceConfig Configuration object for changing getBalance query behavior

type GetBlockConfig

type GetBlockConfig struct {
	// The level of commitment desired
	Commitment *Commitment
	// The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned
	MaxSupportedTransactionVersion uint64 `json:"maxSupportedTransactionVersion,omitempty"`
	// Whether to populate the rewards array.
	Rewards bool `json:"rewards,omitempty"`
}

type GetBlockHeightConfig

type GetBlockHeightConfig = BaseConfig

GetBlockHeightConfig is the configuration object for changing `getBlockHeight` query behavior.

type GetBlockProductionConfig

type GetBlockProductionConfig struct {
	// Optional commitment level
	Commitment *Commitment
	// Slot range to return block production for. If parameter not provided, defaults to current epoch.
	Range *struct {
		// First slot to return block production information for (inclusive)
		FirstSlot int `json:"firstSlot"`
		// Last slot to return block production information for (inclusive). If parameter not provided, defaults to the highest slot
		LastSlot *int `json:"lastSlot,omitempty"`
	} `json:"range,omitempty"`
	// Only return results for this validator identity (base-58 encoded)
	Identity string `json:"identity,omitempty"`
}

GetBlockProductionConfig is the configuration object for changing `getBlockProduction` query behavior.

type GetEpochInfoConfig

type GetEpochInfoConfig = BaseConfig

type GetInflationRewardConfig

type GetInflationRewardConfig struct {
	// The level of commitment desired
	Commitment *Commitment
	// An epoch for which the reward occurs. If omitted, the previous epoch will be used
	Epoch uint64 `json:"epoch,omitempty"`
	// The minimum slot that the request can be evaluated at
	MinContextSlot uint64 `json:"minContextSlot,omitempty"`
}

GetInflationRewardConfig is the configuration object for changing `getInflationReward` query behavior.

type GetLargestAccountsConfig

type GetLargestAccountsConfig struct {
	// The level of commitment desired
	Commitment *Commitment
	// Filter largest accounts by whether they are part of the circulating supply
	Filter *LargestAccountsFilter `json:"filter"`
}

GetLargestAccountsConfig Configuration object for changing `getLargestAccounts` query behavior

type GetLatestBlockhashConfig

type GetLatestBlockhashConfig = BaseConfig

type GetMultipleAccountsConfig

type GetMultipleAccountsConfig struct {
	//  Optional commitment level
	Commitment *Commitment
	//  The minimum slot that the request can be evaluated at
	MinContextSlot uint64 `json:"minContextSlot,omitempty"`
	//  Optional data slice to limit the returned account data
	DataSlice *DataSlice `json:"dataSlice,omitempty"`
}

GetMultipleAccountsConfig Configuration object for getMultipleAccounts

type GetNonceAndContextConfig

type GetNonceAndContextConfig = BaseConfig

type GetNonceConfig

type GetNonceConfig = BaseConfig

type GetParsedProgramAccountsConfig

type GetParsedProgramAccountsConfig struct {
	// Optional commitment level
	Commitment *Commitment
	// Optional array of filters to apply to accounts
	Filters []GetProgramAccountsFilter `json:"filters,omitempty"`
	// The minimum slot that the request can be evaluated at
	MinContextSlot uint64 `json:"minContextSlot,omitempty"`
}

GetParsedProgramAccountsConfig is the configuration object for getParsedProgramAccounts.

type GetProgramAccountsConfig

type GetProgramAccountsConfig struct {
	// Optional commitment level
	Commitment *Commitment
	// Optional encoding for account data (default base64)
	// To use "jsonParsed" encoding, please refer to `getParsedProgramAccounts` in connection.ts
	Encoding Encoding `json:"encoding,omitempty"`
	// Optional data slice to limit the returned account data
	DataSlice *DataSlice `json:"dataSlice,omitempty"`
	// Optional array of filters to apply to accounts
	Filters []GetProgramAccountsFilter `json:"filters,omitempty"`
	// The minimum slot that the request can be evaluated at
	MinContextSlot uint64 `json:"minContextSlot,omitempty"`
	// wrap the result in an RpcResponse JSON object
	WithContext bool `json:"withContext,omitempty"`
}

GetProgramAccountsConfig Configuration object for getProgramAccounts requests

type GetProgramAccountsFilter

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

type GetProgramAccountsResponse

type GetProgramAccountsResponse struct {
	Account AccountInfoD `json:"account"`
	Pubkey  PublicKey    `json:"pubkey"`
}

type GetRecentPrioritizationFeesConfig

type GetRecentPrioritizationFeesConfig struct {
	// If this parameter is provided, the response will reflect a fee to land a transaction locking
	// all of the provided accounts as writable.
	LockedWritableAccounts []PublicKey `json:"lockedWritableAccounts,omitempty"`
}

GetRecentPrioritizationFeesConfig is the configuration object for changing `getRecentPrioritizationFees` query behavior.

type GetSlotConfig

type GetSlotConfig = BaseConfig

type GetSlotLeaderConfig

type GetSlotLeaderConfig = BaseConfig

type GetStakeActivationConfig

type GetStakeActivationConfig struct {
	//  Optional commitment level
	Commitment *Commitment
	//  Epoch for which to calculate activation details. If parameter not provided, defaults to current epoch
	Epoch uint64 `json:"epoch,omitempty"`
	//  The minimum slot that the request can be evaluated at
	MinContextSlot uint64 `json:"minContextSlot,omitempty"`
}

GetStakeActivationConfig Configuration object for `getStakeActivation`

type GetStakeMinimumDelegationConfig

type GetStakeMinimumDelegationConfig struct {
	Commitment *Commitment
}

type GetSupplyConfig

type GetSupplyConfig struct {
	// The level of commitment desired
	Commitment *Commitment
	// Exclude non circulating accounts list from response
	ExcludeNonCirculatingAccountsList bool `json:"excludeNonCirculatingAccountsList,omitempty"`
}

GetSupplyConfig Configuration object for changing `getSupply` request behavior

type GetTokenAccountsByDelegateConfig

type GetTokenAccountsByDelegateConfig struct {
	// Optional commitment level
	Commitment *Commitment
	// The minimum slot that the request can be evaluated at
	MinContextSlot uint64 `json:"minContextSlot,omitempty"`
}

type GetTokenAccountsByDelegateResponse

type GetTokenAccountsByDelegateResponse struct {
	Pubkey  PublicKey `json:"pubkey,omitempty"`
	Account struct {
		Executable bool            `json:"executable,omitempty"`
		Owner      PublicKey       `json:"owner,omitempty"`
		Lamports   uint64          `json:"lamports,omitempty"`
		Data       json.RawMessage `json:"data,omitempty"`
		RentEpoch  uint64          `json:"rentEpoch,omitempty"`
	} `json:"account"`
}

type GetTokenAccountsByOwnerConfig

type GetTokenAccountsByOwnerConfig struct {
	// Optional commitment level
	Commitment *Commitment
	// The minimum slot that the request can be evaluated at
	MinContextSlot uint64 `json:"minContextSlot,omitempty"`
}

type GetTransactionCountConfig

type GetTransactionCountConfig = BaseConfig

type GetVersionedTransactionConfig

type GetVersionedTransactionConfig struct {
	// The level of finality desired
	Commitment *Commitment
	// The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned
	MaxSupportedTransactionVersion int `json:"maxSupportedTransactionVersion"`
}

GetVersionedTransactionConfig Configuration object for changing `getTransaction` query behavior

type InflationGovernor

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

InflationGovernor Network Inflation (see https://docs.solana.com/implemented-proposals/ed_overview)

type InflationRate

type InflationRate struct {
	// Total inflation
	Total float64 `json:"total"`
	// Inflation allocated to validators
	Validator float64 `json:"validator"`
	// Inflation allocated to the foundation
	Foundation float64 `json:"foundation"`
	// Epoch for which these values are valid
	Epoch uint64 `json:"epoch"`
}

InflationRate represents the inflation rate for an epoch.

type InflationReward

type InflationReward struct {
	// Epoch for which the reward occurs
	Epoch uint64 `json:"epoch"`
	// The slot in which the rewards are effective
	EffectiveSlot uint64 `json:"effectiveSlot"`
	// Reward amount in lamports
	Amount uint64 `json:"amount"`
	// Post balance of the account in lamports
	PostBalance uint64 `json:"postBalance"`
	// Vote account commission when the reward was credited
	Commission *uint64 `json:"commission,omitempty"`
}

InflationReward represents the inflation reward for an epoch.

type Instruction

type Instruction interface {
	ProgramID() PublicKey     // the programID the instruction acts on
	Accounts() []*AccountMeta // returns the list of accounts the instructions requires
	Data() ([]byte, error)    // the binary encoded instructions
}

type IsBlockhashValidConfig

type IsBlockhashValidConfig = BaseConfig

type KeyMetaMap

type KeyMetaMap = map[string]*CompiledKeyMeta

type LargestAccountsFilter

type LargestAccountsFilter string
var (
	LargestAccountsFilterCirculating    LargestAccountsFilter = "circulating"
	LargestAccountsFilterNonCirculating LargestAccountsFilter = "nonCirculating"
)

type LeaderSchedule

type LeaderSchedule map[string][]int

LeaderSchedule represents the leader schedule.

type LoadedAddresses

type LoadedAddresses struct {
	Writable []PublicKey `json:"writable,omitempty"`
	Readonly []PublicKey `json:"readonly,omitempty"`
}

type LoaderImpl

type LoaderImpl struct{}

LoaderImpl Program loader interface

func (LoaderImpl) ChunkSize

func (impl LoaderImpl) ChunkSize() int

func (LoaderImpl) GetMinNumSignatures

func (impl LoaderImpl) GetMinNumSignatures(dataLength int) int

GetMinNumSignatures calculates the minimum number of signatures required to load a program. It does not include retries and can be used to calculate transaction fees.

func (LoaderImpl) Load

func (impl LoaderImpl) Load(connection Connection, payer Signer, program Signer, programId PublicKey, data []byte) (bool, error)

type MemcmpFilter

type MemcmpFilter struct {
	Memcmp *struct {
		// offset into program account data to start comparison
		Offset uint64
		// data to match, as base-58 encoded string and limited to less than 129 bytes
		Bytes string
	}
}

type Message

type Message struct {
	Header          MessageHeader         `json:"header"`
	AccountKeys     []PublicKey           `json:"accountKeys,omitempty"`
	RecentBlockhash Blockhash             `json:"recentBlockhash,omitempty"`
	Instructions    []CompiledInstruction `json:"instructions,omitempty"`
	// contains filtered or unexported fields
}

func NewMessage

func NewMessage(args CompileLegacyArgs) (*Message, error)

func (*Message) AddressTableLookups

func (m *Message) AddressTableLookups() []MessageAddressTableLookup

func (*Message) CompiledInstructions

func (m *Message) CompiledInstructions() []CompiledInstruction

func (*Message) Deserialize

func (m *Message) Deserialize(data []byte) error

func (*Message) GetAccountKeys

func (m *Message) GetAccountKeys() MessageAccountKeys

func (*Message) IsAccountSigner

func (m *Message) IsAccountSigner(index int) bool

func (*Message) IsAccountWritable

func (m *Message) IsAccountWritable(index int) bool

func (*Message) IsProgramId

func (m *Message) IsProgramId(index int) bool

func (*Message) NonProgramIds

func (m *Message) NonProgramIds() []PublicKey

func (*Message) ProgramIds

func (m *Message) ProgramIds() []PublicKey

func (*Message) Serialize

func (m *Message) Serialize() []byte

func (*Message) StaticAccountKeys

func (m *Message) StaticAccountKeys() []PublicKey

func (*Message) Version

func (m *Message) Version() TransactionVersion

type MessageAccountKeys

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

func (MessageAccountKeys) FlatKeySegments

func (m MessageAccountKeys) FlatKeySegments() []PublicKey

func (MessageAccountKeys) Get

func (m MessageAccountKeys) Get(index int) *PublicKey

func (MessageAccountKeys) KeySegments

func (m MessageAccountKeys) KeySegments() [][]PublicKey

func (MessageAccountKeys) Length

func (m MessageAccountKeys) Length() int

type MessageAddressTableLookup

type MessageAddressTableLookup struct {
	AccountKey      PublicKey `json:"accountKey,omitempty"`
	WritableIndexes []uint8   `json:"writableIndexes,omitempty"`
	ReadonlyIndexes []uint8   `json:"readonlyIndexes,omitempty"`
}

MessageAddressTableLookup An address table lookup used to load additional accounts

type MessageHeader

type MessageHeader struct {
	// The number of signatures required for this message to be considered valid. The
	// signatures must match the first `numRequiredSignatures` of `accountKeys`.
	NumRequiredSignatures int `json:"numRequiredSignatures,omitempty"`
	// The last `numReadonlySignedAccounts` of the signed keys are read-only accounts
	NumReadonlySignedAccounts int `json:"numReadonlySignedAccounts,omitempty"`
	// The last `numReadonlySignedAccounts` of the unsigned keys are read-only accounts
	NumReadonlyUnsignedAccounts int `json:"numReadonlyUnsignedAccounts,omitempty"`
}

type MessageSignednessErrors

type MessageSignednessErrors struct {
	Missing []PublicKey
	Invalid []PublicKey
}

type MessageV0

type MessageV0 struct {
	Header               MessageHeader               `json:"header"`
	StaticAccountKeys    []PublicKey                 `json:"accountKeys,omitempty"`
	RecentBlockhash      Blockhash                   `json:"recentBlockhash,omitempty"`
	CompiledInstructions []CompiledInstruction       `json:"instructions,omitempty"`
	AddressTableLookups  []MessageAddressTableLookup `json:"addressTableLookups,omitempty"`
}

func NewMessage0

func NewMessage0(args CompileV0Args) (*MessageV0, error)

func (*MessageV0) Deserialize

func (m *MessageV0) Deserialize(data []byte) error

func (*MessageV0) GetAccountKeys

func (m *MessageV0) GetAccountKeys(args GetAccountKeysArgs) (*MessageAccountKeys, error)

func (*MessageV0) IsAccountSigner

func (m *MessageV0) IsAccountSigner(index int) bool

func (*MessageV0) IsAccountWritable

func (m *MessageV0) IsAccountWritable(index int) bool

func (*MessageV0) NumAccountKeysFromLookups

func (m *MessageV0) NumAccountKeysFromLookups() int

func (*MessageV0) Serialize

func (m *MessageV0) Serialize() []byte

func (*MessageV0) Version

func (m *MessageV0) Version() TransactionVersion

type NonceAccount

type NonceAccount = system.NonceAccount

func NonceAccountFromAccountData

func NonceAccountFromAccountData(buffer []byte) (*NonceAccount, error)

NonceAccountFromAccountData Deserialize NonceAccount from the account data.

type NonceInformation

type NonceInformation struct {
	// The current blockhash stored in the nonce
	Nonce Blockhash
	// AdvanceNonceAccount Instruction
	NonceInstruction TransactionInstruction
}

NonceInformation Nonce information to be used to build an offline Transaction.

type ParsedAccount

type ParsedAccount struct {
	Account AccountInfo[ParsedAccountData] `json:"account"`
	Pubkey  PublicKey                      `json:"pubkey"`
}

type ParsedAccountData

type ParsedAccountData struct {
	// Name of the program that owns this account
	Program string `json:"program,omitempty"`
	// Parsed account data
	Parsed any `json:"parsed,omitempty"`
	// Space used by account data
	Space uint64 `json:"space,omitempty"`
}

ParsedAccountData Parsed account data

type ParsedAccountDataOrBytes

type ParsedAccountDataOrBytes struct {
	ParsedAccountData
	Bytes    []byte
	Encoding string
}

func (*ParsedAccountDataOrBytes) UnmarshalJSON

func (t *ParsedAccountDataOrBytes) UnmarshalJSON(data []byte) (err error)

type PerfSample

type PerfSample struct {
	// Slot number of the sample
	Slot uint64 `json:"slot"`
	// Number of transactions in a sample window
	NumTransactions uint64 `json:"numTransactions"`
	// Number of slots in a sample window
	NumSlots uint64 `json:"numSlots"`
	// Sample window in seconds
	SamplePeriodSecs uint64 `json:"samplePeriodSecs"`
}

PerfSample represents a performance sample.

type PublicKey

type PublicKey [PUBLIC_KEY_LENGTH]byte

func CreateProgramAddress

func CreateProgramAddress(seeds [][]byte, programId PublicKey) (PublicKey, error)

CreateProgramAddress Derive a program address from seeds and a program ID.

func CreateWithSeed

func CreateWithSeed(fromPublicKey PublicKey, seed string, programId PublicKey) PublicKey

CreateWithSeed Derive a public key from another key, a seed, and a program ID. The program ID will also serve as the owner of the public key, giving it permission to write data to the account.

func FindProgramAddress

func FindProgramAddress(seeds [][]byte, programId PublicKey) (address PublicKey, _ uint8, err error)

FindProgramAddress Find a valid program address

Valid program addresses must fall off the ed25519 curve. This function iterates a nonce until it finds one that when combined with the seeds results in a valid program address.

func MustPublicKey

func MustPublicKey(input string) PublicKey

func NewPublicKey

func NewPublicKey(input string) (out PublicKey, _ error)

func NewPublicKeyFromBs

func NewPublicKeyFromBs(bs []byte) (out PublicKey)

func UniquePublicKey

func UniquePublicKey() PublicKey

func (PublicKey) Base58

func (p PublicKey) Base58() string

Base58 Return the base-58 representation of the public key

func (PublicKey) Bytes

func (p PublicKey) Bytes() []byte

Bytes Return the byte array representation of the public key in big endian

func (PublicKey) D

func (p PublicKey) D() solana.PublicKey

func (PublicKey) Equals

func (p PublicKey) Equals(publicKey PublicKey) bool

func (PublicKey) IsZero

func (p PublicKey) IsZero() bool

func (PublicKey) MarshalJSON

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

func (PublicKey) MarshalWithEncoder

func (p PublicKey) MarshalWithEncoder(encoder *binary.Encoder) error

func (*PublicKey) Ref

func (p *PublicKey) Ref() *PublicKey

func (*PublicKey) RefBs

func (p *PublicKey) RefBs() *[32]byte

func (PublicKey) String

func (p PublicKey) String() string

String Return the base-58 representation of the public key

func (*PublicKey) UnmarshalJSON

func (p *PublicKey) UnmarshalJSON(data []byte) error

func (PublicKey) Verify

func (p PublicKey) Verify(message []byte, signature Signature) bool

type RPCFilterMemcmp

type RPCFilterMemcmp struct {
	Offset uint64        `json:"offset"`
	Bytes  solana.Base58 `json:"bytes"`
}

type RPCRequest

type RPCRequest struct {
	Method  string `json:"method"`
	Params  any    `json:"params,omitempty"`
	ID      int    `json:"id"`
	JSONRPC string `json:"jsonrpc"`
}

type RecentPrioritizationFees

type RecentPrioritizationFees struct {
	// Slot in which the fee was observed
	Slot uint64 `json:"slot"`
	// The per-compute-unit fee paid by at least one successfully landed transaction,
	// specified in increments of 0.000001 lamports
	PrioritizationFee float64 `json:"prioritizationFee"`
}

RecentPrioritizationFees represents recent prioritization fees.

type RewardsResult

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

type RpcBatchRequest

type RpcBatchRequest = func(requests []RpcParams) []any

type RpcParams

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

type RpcResponse

type RpcResponse[T any] struct {
	JsonRPC string                    `json:"jsonrpc"`
	Id      int                       `json:"id"`
	Result  *RpcResponseAndContext[T] `json:"result"`
	Error   *RpcResponseError         `json:"error"`
}

func (RpcResponse[T]) GetError

func (r RpcResponse[T]) GetError() *RpcResponseError

type RpcResponseAndContext

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

type RpcResponseError

type RpcResponseError struct {
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data"`
}

type RpcWebSocketClient

type RpcWebSocketClient struct {
}

type SendOptions

type SendOptions struct {
	SkipPreflight       *bool       `json:"skipPreflight,omitempty"`       // Disable transaction verification step
	PreflightCommitment *Commitment `json:"preflightCommitment,omitempty"` // Preflight commitment level
	MaxRetries          *uint       `json:"maxRetries,omitempty"`          // Maximum number of times for the RPC node to retry sending the transaction to the leader.
	MinContextSlot      *uint64     `json:"minContextSlot,omitempty"`      // The minimum slot that the request can be evaluated at
}

SendOptions represents options for sending transactions

type SendTransactionError

type SendTransactionError struct {
	Logs    []string
	Message string
	Code    int
}

func NewSendTransactionError

func NewSendTransactionError(message string, logs []string, code int) SendTransactionError

func (SendTransactionError) Error

func (e SendTransactionError) Error() string

type Signature

type Signature = solana.Signature

func SignatureFromBase58

func SignatureFromBase58(input string) (Signature, error)

func SignatureFromBytes

func SignatureFromBytes(input []byte) Signature

type SignaturePubkeyPair

type SignaturePubkeyPair struct {
	Signature Signature
	PublicKey PublicKey
}

type SignatureResult

type SignatureResult struct {
	Err any `json:"err"`
}

func (SignatureResult) HasErr

func (s SignatureResult) HasErr() bool

type SignatureStatus

type SignatureStatus struct {
	// When the transaction was processed
	Slot uint64 `json:"slot"`
	// The number of blocks that have been confirmed and voted on in the fork containing `Slot`
	Confirmations uint64 `json:"confirmations"`
	// Transaction error, if any
	Err *TransactionError `json:"err"`
	// Cluster confirmation status, if data available.
	// Possible responses: `processed`, `confirmed`, `finalized`
	ConfirmationStatus TransactionConfirmationStatus `json:"confirmationStatus,omitempty"`
}

SignatureStatus represents the signature status.

type SignatureStatusConfig

type SignatureStatusConfig struct {
	// enable searching status history, not needed for recent transactions
	SearchTransactionHistory bool `json:"searchTransactionHistory,omitempty"`
}

SignatureStatusConfig Configuration object for changing query behavior

type SignaturesForAddressOptions

type SignaturesForAddressOptions struct {
	// Start searching backwards from this transaction signature.
	// If not provided, the search starts from the highest max confirmed block.
	Before TransactionSignature `json:"before,omitempty"`
	// Search until this transaction signature is reached, if found before `limit`.
	Until TransactionSignature `json:"until,omitempty"`
	// Maximum transaction signatures to return (between 1 and 1,000, default: 1,000).
	Limit int `json:"limit,omitempty"`
	// The minimum slot that the request can be evaluated at.
	MinContextSlot uint64 `json:"minContextSlot,omitempty"`
}

SignaturesForAddressOptions is the options for getSignaturesForAddress.

type Signer

type Signer interface {
	Sign(data []byte) ([64]byte, error)
	PublicKey() PublicKey
}

type SignerImpl

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

func NewSigner

func NewSigner(secretKey []byte) SignerImpl

func (SignerImpl) PrivateKey

func (s SignerImpl) PrivateKey() solana.Data

func (SignerImpl) PublicKey

func (s SignerImpl) PublicKey() PublicKey

func (SignerImpl) Sign

func (s SignerImpl) Sign(data []byte) (out [64]byte, err error)

type SignerSlice

type SignerSlice []Signer

func (SignerSlice) Addresses

func (s SignerSlice) Addresses() []PublicKey

func (SignerSlice) Len

func (s SignerSlice) Len() int

type SimulateTransactionConfig

type SimulateTransactionConfig struct {
	// Optional parameter used to enable signature verification before simulation
	SigVerify *bool `json:"sigVerify,omitempty"`
	// Optional parameter used to replace the simulated transaction's recent blockhash with the latest blockhash
	ReplaceRecentBlockhash *bool `json:"replaceRecentBlockhash,omitempty"`
	// Optional parameter used to set the commitment level when selecting the latest block
	Commitment *Commitment
	// Optional parameter used to specify a list of account addresses to return post simulation state for
	Accounts []PublicKey
	// Optional parameter used to specify the minimum block slot that can be used for simulation
	MinContextSlot *int64 `json:"minContextSlot,omitempty"`
}

type SimulatedTransactionAccountInfo

type SimulatedTransactionAccountInfo struct {
	// True if this account's data contains a loaded program
	Executable bool `json:"executable"`
	// Identifier of the program that owns the account
	Owner string `json:"owner"`
	// Number of lamports assigned to the account
	Lamports uint64 `json:"lamports"`
	// Optional data assigned to the account
	Data []string `json:"data"`
	// Optional rent epoch info for account
	RentEpoch *uint64 `json:"rentEpoch,omitempty"`
}

type SimulatedTransactionResponse

type SimulatedTransactionResponse struct {
	Err           TransactionError                  `json:"err,omitempty"`
	Logs          []string                          `json:"logs,omitempty"`
	Accounts      []SimulatedTransactionAccountInfo `json:"accounts,omitempty"`
	UnitsConsumed uint64                            `json:"unitsConsumed,omitempty"`
	ReturnData    *TransactionReturnData            `json:"returnData,omitempty"`
}

type SlotRpcResult

type SlotRpcResult[T any] struct {
	JsonRPC string            `json:"jsonrpc"`
	Id      int               `json:"id"`
	Result  *T                `json:"result"`
	Error   *RpcResponseError `json:"error"`
}

func (SlotRpcResult[T]) GetError

func (r SlotRpcResult[T]) GetError() *RpcResponseError

type SolanaJSONRPCError

type SolanaJSONRPCError struct {
	Err           RpcResponseError
	CustomMessage string
}

func (SolanaJSONRPCError) Code

func (e SolanaJSONRPCError) Code() int

func (SolanaJSONRPCError) Error

func (e SolanaJSONRPCError) Error() string

type SolanaJSONRPCErrorCode

type SolanaJSONRPCErrorCode int
const (
	JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP SolanaJSONRPCErrorCode = -(iota + 32001)
	JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE
	JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE
	JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE
	JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY
	JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE
	JSON_RPC_SERVER_ERROR_SLOT_SKIPPED
	JSON_RPC_SERVER_ERROR_NO_SNAPSHOT
	JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED
	JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX
	JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE
	JSON_RPC_SCAN_ERROR
	JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH
	JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET
	JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION
	JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED
)

type StakeActivationData

type StakeActivationData struct {
	// the stake account's activation state
	// 'active' | 'inactive' | 'activating' | 'deactivating'
	State string `json:"state"`
	// stake active during the epoch
	Active uint64 `json:"active"`
	// stake inactive during the epoch
	Inactive uint64 `json:"inactive"`
}

StakeActivationData Stake Activation data

type Supply

type Supply struct {
	// Total supply in lamports
	Total uint64 `json:"total"`
	// Circulating supply in lamports
	Circulating uint64 `json:"circulating"`
	// Non-circulating supply in lamports
	NonCirculating uint64 `json:"nonCirculating"`
	// List of non-circulating account addresses
	NonCirculatingAccounts []PublicKey `json:"nonCirculatingAccounts"`
}

Supply represents the supply information

type TokenAccountBalancePair

type TokenAccountBalancePair struct {
	Address PublicKey `json:"address"`
	TokenAmount
}

TokenAccountBalancePair Token address and balance.

type TokenAccountsFilter

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

func NewTokenAccountsFilter

func NewTokenAccountsFilter(mint PublicKey) TokenAccountsFilter

func NewTokenAccountsFilterProgram

func NewTokenAccountsFilterProgram(programId PublicKey) TokenAccountsFilter

type TokenAmount

type TokenAmount struct {
	// Raw amount of tokens as string ignoring decimals
	Amount string `json:"amount"`
	// Number of decimals configured for the token's mint
	Decimals int `json:"decimals"`
	// Token amount as float, accounts for decimals
	UIAmount *float64 `json:"uiAmount,omitempty"`
	// Token amount as string, accounts for decimals
	UIAmountString *string `json:"uiAmountString,omitempty"`
}

TokenAmount represents a token amount object in different formats for various use cases.

type TokenBalance

type TokenBalance struct {
	AccountIndex  uint64       `json:"accountIndex,omitempty"`
	Mint          PublicKey    `json:"mint,omitempty"`
	Owner         PublicKey    `json:"owner,omitempty"`
	UiTokenAmount *TokenAmount `json:"uiTokenAmount,omitempty"`
}

type Transaction

type Transaction struct {

	//// A
	// the last block chain can advance to before tx is declared expired
	LastValidBlockHeight *uint64
	// A recent transaction id. Must be populated by the caller
	RecentBlockhash *Blockhash

	//// B
	// If this is a nonce transaction this represents the minimum slot from which
	// to evaluate if the nonce has advanced when attempting to confirm the
	// transaction. This protects against a case where the transaction confirmation
	// logic loads the nonce account from an old slot and assumes the mismatch in
	// nonce value implies that the nonce has been advanced.
	MinNonceContextSlot *uint64
	// Optional Nonce information. If populated, transaction will use a durable
	// Nonce hash instead of a recentBlockhash. Must be populated by the caller
	NonceInfo *NonceInformation
	// contains filtered or unexported fields
}

Transaction class

func NewTransactionWithBlock

func NewTransactionWithBlock(recentBlockhash Blockhash, lastValidBlockHeight uint64) *Transaction

func PopulateTransaction

func PopulateTransaction(message Message, signatures []string) (*Transaction, error)

func (*Transaction) AddInsBuilder

func (t *Transaction) AddInsBuilder(builder interface {
	Validate() error
}) error

AddInsBuilder add instruction from builder the builder has method ValidateAndBuild() (Instruction, error)

func (*Transaction) AddInstruction

func (t *Transaction) AddInstruction(keys []AccountMeta, programId PublicKey, data []byte)

func (*Transaction) AddInstructionAny

func (t *Transaction) AddInstructionAny(anyIns any) (err error)

func (*Transaction) AddInstructions

func (t *Transaction) AddInstructions(ins ...TransactionInstruction)

func (*Transaction) ExportIns

func (t *Transaction) ExportIns() []TransactionInstruction

func (*Transaction) Serialize

func (t *Transaction) Serialize() ([]byte, error)

func (*Transaction) SetFeePayer

func (t *Transaction) SetFeePayer(payer PublicKey)

func (*Transaction) Sign

func (t *Transaction) Sign(signers ...Signer) error

func (*Transaction) Signature

func (t *Transaction) Signature() Signature

Signature The first (payer) Transaction signature

type TransactionConfirmationStatus

type TransactionConfirmationStatus string
const (
	TransactionConfirmationStatusProcessed TransactionConfirmationStatus = "processed"
	TransactionConfirmationStatusConfirmed TransactionConfirmationStatus = "confirmed"
	TransactionConfirmationStatusFinalized TransactionConfirmationStatus = "finalized"
)

type TransactionDetail

type TransactionDetail string
const (
	TransactionDetail_Accounts   TransactionDetail = "accounts"
	TransactionDetail_Full       TransactionDetail = "full"
	TransactionDetail_None       TransactionDetail = "none"
	TransactionDetail_Signatures TransactionDetail = "signatures"
)

type TransactionError

type TransactionError = any

type TransactionExpiredBlockheightExceededError

type TransactionExpiredBlockheightExceededError struct {
	Signature string
}

func (TransactionExpiredBlockheightExceededError) Error

type TransactionExpiredNonceInvalidError

type TransactionExpiredNonceInvalidError struct {
	Signature string
}

func (TransactionExpiredNonceInvalidError) Error

type TransactionExpiredTimeoutError

type TransactionExpiredTimeoutError struct {
	Signature string
	// contains filtered or unexported fields
}

func NewTransactionExpiredTimeoutError

func NewTransactionExpiredTimeoutError(signature string, timeoutSeconds int) TransactionExpiredTimeoutError

func (TransactionExpiredTimeoutError) Error

type TransactionInstruction

type TransactionInstruction struct {
	// Public keys to include in this transaction
	// Boolean represents whether this pubkey needs to sign the transaction
	Keys []AccountMeta `json:"keys"`
	// Program Id to execute
	ProgramId PublicKey `json:"programId"`
	// Program input
	Data []byte `json:"data"`
}

TransactionInstruction represents a transaction instruction

func (*TransactionInstruction) Equals

type TransactionInstructionSlice

type TransactionInstructionSlice []TransactionInstruction

func (TransactionInstructionSlice) Metas

func (s TransactionInstructionSlice) Metas() (out []AccountMeta)

type TransactionMessage

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

func NewTransactionMessageFrom

func NewTransactionMessageFrom(message VersionedMessage, args *DecompileArgs) (*TransactionMessage, error)

func (TransactionMessage) CompileToLegacyMessage

func (m TransactionMessage) CompileToLegacyMessage() (*Message, error)

func (TransactionMessage) CompileToV0Message

func (m TransactionMessage) CompileToV0Message(addressLookupTableAccounts []AddressLookupTableAccount) (*MessageV0, error)

func (TransactionMessage) Instructions

func (m TransactionMessage) Instructions() []TransactionInstruction

type TransactionReturnData

type TransactionReturnData struct {
	ProgramId string      `json:"programId"`
	Data      solana.Data `json:"data"`
}

func (*TransactionReturnData) Bytes

func (r *TransactionReturnData) Bytes() []byte

type TransactionSignature

type TransactionSignature string

TransactionSignature represents a transaction signature

func (TransactionSignature) IsZero

func (s TransactionSignature) IsZero() bool

func (TransactionSignature) String

func (s TransactionSignature) String() string

type TransactionVersion

type TransactionVersion int
const (
	TransactionVersionLegacy TransactionVersion = -1
	TransactionVersion0      TransactionVersion = 0
)

func (*TransactionVersion) UnmarshalJSON

func (c *TransactionVersion) UnmarshalJSON(data []byte) (err error)

type ValidatorInfo

type ValidatorInfo struct {
	Key  PublicKey
	Info struct {
		/** validator name */
		Name string `json:"name,omitempty"`
		/** optional, validator website */
		Website *string `json:"website,omitempty"`
		/** optional, extra information the validator chose to share */
		Details *string `json:"details,omitempty"`
		/** optional, used to identify validators on keybase.io */
		KeybaseUsername *string `json:"keybaseUsername,omitempty"`
	}
}

func ValidatorInfoFromConfigData

func ValidatorInfoFromConfigData(buffer []byte) (*ValidatorInfo, error)

ValidatorInfoFromConfigData Deserialize ValidatorInfo from the config account data. Exactly two config keys are required in the data.

type Version

type Version struct {
	// Version of solana-core
	SolanaCore string `json:"solana-core"`
	// Feature set (optional)
	FeatureSet *int `json:"feature-set,omitempty"`
}

Version represents version info for a node.

type VersionedMessage

type VersionedMessage struct {
	Raw any
}

func (*VersionedMessage) CompiledInstructions

func (c *VersionedMessage) CompiledInstructions() []CompiledInstruction

func (*VersionedMessage) Deserialize

func (c *VersionedMessage) Deserialize(data []byte) error

func (*VersionedMessage) GetAccountKeys

func (c *VersionedMessage) GetAccountKeys(args GetAccountKeysArgs) (*MessageAccountKeys, error)

func (*VersionedMessage) Header

func (c *VersionedMessage) Header() MessageHeader

func (*VersionedMessage) MarshalJSON

func (c *VersionedMessage) MarshalJSON() ([]byte, error)

func (*VersionedMessage) RecentBlockhash

func (c *VersionedMessage) RecentBlockhash() Blockhash

func (*VersionedMessage) Serialize

func (c *VersionedMessage) Serialize() []byte

func (*VersionedMessage) StaticAccountKeys

func (c *VersionedMessage) StaticAccountKeys() []PublicKey

func (*VersionedMessage) TransactionMessage

func (c *VersionedMessage) TransactionMessage(args *DecompileArgs) (*TransactionMessage, error)

func (*VersionedMessage) UnmarshalJSON

func (c *VersionedMessage) UnmarshalJSON(data []byte) error

func (*VersionedMessage) Version

func (c *VersionedMessage) Version() TransactionVersion

type VersionedTransaction

type VersionedTransaction struct {
	Signatures [][64]byte
	Message    VersionedMessage
}

func NewVersionedTransaction

func NewVersionedTransaction(message VersionedMessage, signatures [][64]byte) (VersionedTransaction, error)

func (*VersionedTransaction) AddSignature

func (t *VersionedTransaction) AddSignature(publicKey PublicKey, signature [64]byte)

func (*VersionedTransaction) Deserialize

func (t *VersionedTransaction) Deserialize(data []byte) error

func (*VersionedTransaction) Serialize

func (t *VersionedTransaction) Serialize() []byte

func (*VersionedTransaction) Sign

func (t *VersionedTransaction) Sign(signers ...Signer) error

func (*VersionedTransaction) Version

type VersionedTransactionResponse

type VersionedTransactionResponse struct {
	// the slot during which the transaction was processed
	Slot uint64 `json:"slot,omitempty"`
	// the transaction
	Transaction VersionedTransactionRet `json:"transaction"`
	// Metadata produced from the transaction
	Meta *ConfirmedTransactionMeta `json:"meta,omitempty"`
	// The unix timestamp of when the transaction was processed
	BlockTime *uint64 `json:"blockTime,omitempty"`
	// The transaction version
	Version *TransactionVersion `json:"version,omitempty"`
}

VersionedTransactionResponse A processed transaction from the RPC API

func (*VersionedTransactionResponse) UnmarshalJSON

func (v *VersionedTransactionResponse) UnmarshalJSON(data []byte) error

type VersionedTransactionRet

type VersionedTransactionRet struct {
	Message    VersionedMessage `json:"message,omitempty"`
	Signatures []string         `json:"signatures,omitempty"`
}

type VoteAccountInfo

type VoteAccountInfo struct {
	// Public key of the vote account
	VotePubkey string `json:"votePubkey"`
	// Identity public key of the node voting with this account
	NodePubkey string `json:"nodePubkey"`
	// The stake, in lamports, delegated to this vote account and activated
	ActivatedStake int `json:"activatedStake"`
	// Whether the vote account is staked for this epoch
	EpochVoteAccount bool `json:"epochVoteAccount"`
	// Recent epoch voting credit history for this voter
	EpochCredits [][3]int `json:"epochCredits"`
	// A percentage (0-100) of rewards payout owed to the voter
	Commission int `json:"commission"`
	// Most recent slot voted on by this vote account
	LastVote int `json:"lastVote"`
}

VoteAccountInfo represents information describing a vote account.

type VoteAccountStatus

type VoteAccountStatus struct {
	// Active vote accounts
	Current []VoteAccountInfo `json:"current,omitempty"`
	// Inactive vote accounts
	Delinquent []VoteAccountInfo `json:"delinquent,omitempty"`
}

VoteAccountStatus A collection of cluster vote accounts

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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