Documentation ¶
Overview ¶
Copyright 2021 github.com/gagliardetto This file has been modified by github.com/gagliardetto
Copyright 2020 dfuse Platform Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 github.com/gagliardetto This file has been modified by github.com/gagliardetto
Copyright 2020 dfuse Platform Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 github.com/gagliardetto This file has been modified by github.com/gagliardetto
Copyright 2020 dfuse Platform Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 github.com/gagliardetto This file has been modified by github.com/gagliardetto
Copyright 2020 dfuse Platform Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 github.com/gagliardetto This file has been modified by github.com/gagliardetto
Copyright 2020 dfuse Platform Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 github.com/gagliardetto This file has been modified by github.com/gagliardetto
Copyright 2020 dfuse Platform Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 github.com/gagliardetto This file has been modified by github.com/gagliardetto
Copyright 2020 dfuse Platform Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 github.com/gagliardetto This file has been modified by github.com/gagliardetto
Copyright 2020 dfuse Platform Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 github.com/gagliardetto This file has been modified by github.com/gagliardetto
Copyright 2020 dfuse Platform Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 github.com/gagliardetto This file has been modified by github.com/gagliardetto
Copyright 2020 dfuse Platform Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 github.com/gagliardetto This file has been modified by github.com/gagliardetto
Copyright 2020 dfuse Platform Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 github.com/gagliardetto This file has been modified by github.com/gagliardetto
Copyright 2020 dfuse Platform Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- type Account
- type ActivationStateType
- type BlockProductionResult
- type BlockReward
- type BlockhashResult
- type BlocksResult
- type Client
- func (cl *Client) Close() error
- func (cl *Client) GetAccountDataBorshInto(ctx context.Context, account solana.PublicKey, inVar interface{}) (err error)
- func (cl *Client) GetAccountDataInto(ctx context.Context, account solana.PublicKey, inVar interface{}) (err error)
- func (cl *Client) GetAccountInfo(ctx context.Context, account solana.PublicKey) (out *GetAccountInfoResult, err error)
- func (cl *Client) GetAccountInfoWithOpts(ctx context.Context, account solana.PublicKey, opts *GetAccountInfoOpts) (out *GetAccountInfoResult, err error)
- func (cl *Client) GetBalance(ctx context.Context, publicKey solana.PublicKey, commitment CommitmentType) (out *GetBalanceResult, err error)
- func (cl *Client) GetBlock(ctx context.Context, slot uint64) (out *GetBlockResult, err error)
- func (cl *Client) GetBlockCommitment(ctx context.Context, block uint64) (out *GetBlockCommitmentResult, err error)
- func (cl *Client) GetBlockHeight(ctx context.Context, commitment CommitmentType) (out uint64, err error)
- func (cl *Client) GetBlockProduction(ctx context.Context) (out *GetBlockProductionResult, err error)
- func (cl *Client) GetBlockProductionWithOpts(ctx context.Context, opts *GetBlockProductionOpts) (out *GetBlockProductionResult, err error)
- func (cl *Client) GetBlockTime(ctx context.Context, block uint64) (out *solana.UnixTimeSeconds, err error)
- func (cl *Client) GetBlockWithOpts(ctx context.Context, slot uint64, opts *GetBlockOpts) (out *GetBlockResult, err error)
- func (cl *Client) GetBlocks(ctx context.Context, startSlot uint64, endSlot *uint64, ...) (out BlocksResult, err error)
- func (cl *Client) GetBlocksWithLimit(ctx context.Context, startSlot uint64, limit uint64, commitment CommitmentType) (out *BlocksResult, err error)
- func (cl *Client) GetClusterNodes(ctx context.Context) (out []*GetClusterNodesResult, err error)
- func (cl *Client) GetConfirmedBlock(ctx context.Context, slot uint64) (out *GetConfirmedBlockResult, err error)
- func (cl *Client) GetConfirmedBlockWithOpts(ctx context.Context, slot uint64, opts *GetConfirmedBlockOpts) (out *GetConfirmedBlockResult, err error)
- func (cl *Client) GetConfirmedBlocks(ctx context.Context, startSlot uint64, endSlot *uint64, ...) (out []uint64, err error)
- func (cl *Client) GetConfirmedBlocksWithLimit(ctx context.Context, startSlot uint64, limit uint64, commitment CommitmentType) (out []uint64, err error)
- func (cl *Client) GetConfirmedSignaturesForAddress2(ctx context.Context, address solana.PublicKey, ...) (out GetConfirmedSignaturesForAddress2Result, err error)
- func (cl *Client) GetConfirmedTransaction(ctx context.Context, signature solana.Signature) (out *TransactionWithMeta, err error)
- func (cl *Client) GetConfirmedTransactionWithOpts(ctx context.Context, signature solana.Signature, opts *GetTransactionOpts) (out *TransactionWithMeta, err error)
- func (cl *Client) GetEpochInfo(ctx context.Context, commitment CommitmentType) (out *GetEpochInfoResult, err error)
- func (cl *Client) GetEpochSchedule(ctx context.Context) (out *GetEpochScheduleResult, err error)
- func (cl *Client) GetFeeCalculatorForBlockhash(ctx context.Context, hash solana.Hash, commitment CommitmentType) (out *GetFeeCalculatorForBlockhashResult, err error)
- func (cl *Client) GetFeeForMessage(ctx context.Context, message string, commitment CommitmentType) (out *GetFeeForMessageResult, err error)
- func (cl *Client) GetFeeRateGovernor(ctx context.Context) (out *GetFeeRateGovernorResult, err error)
- func (cl *Client) GetFees(ctx context.Context, commitment CommitmentType) (out *GetFeesResult, err error)
- func (cl *Client) GetFirstAvailableBlock(ctx context.Context) (out uint64, err error)
- func (cl *Client) GetGenesisHash(ctx context.Context) (out solana.Hash, err error)
- func (cl *Client) GetHealth(ctx context.Context) (out string, err error)
- func (cl *Client) GetHighestSnapshotSlot(ctx context.Context) (out *GetHighestSnapshotSlotResult, err error)
- func (cl *Client) GetIdentity(ctx context.Context) (out *GetIdentityResult, err error)
- func (cl *Client) GetInflationGovernor(ctx context.Context, commitment CommitmentType) (out *GetInflationGovernorResult, err error)
- func (cl *Client) GetInflationRate(ctx context.Context) (out *GetInflationRateResult, err error)
- func (cl *Client) GetInflationReward(ctx context.Context, addresses []solana.PublicKey, ...) (out []*GetInflationRewardResult, err error)
- func (cl *Client) GetLargestAccounts(ctx context.Context, commitment CommitmentType, ...) (out *GetLargestAccountsResult, err error)
- func (cl *Client) GetLatestBlockhash(ctx context.Context, commitment CommitmentType) (out *GetLatestBlockhashResult, err error)
- func (cl *Client) GetLeaderSchedule(ctx context.Context) (out GetLeaderScheduleResult, err error)
- func (cl *Client) GetLeaderScheduleWithOpts(ctx context.Context, opts *GetLeaderScheduleOpts) (out GetLeaderScheduleResult, err error)
- func (cl *Client) GetMaxRetransmitSlot(ctx context.Context) (out uint64, err error)
- func (cl *Client) GetMaxShredInsertSlot(ctx context.Context) (out uint64, err error)
- func (cl *Client) GetMinimumBalanceForRentExemption(ctx context.Context, dataSize uint64, commitment CommitmentType) (lamport uint64, err error)
- func (cl *Client) GetMultipleAccounts(ctx context.Context, accounts ...solana.PublicKey) (out *GetMultipleAccountsResult, err error)
- func (cl *Client) GetMultipleAccountsWithOpts(ctx context.Context, accounts []solana.PublicKey, ...) (out *GetMultipleAccountsResult, err error)
- func (cl *Client) GetParsedTransaction(ctx context.Context, txSig solana.Signature, opts *GetParsedTransactionOpts) (out *GetParsedTransactionResult, err error)
- func (cl *Client) GetProgramAccounts(ctx context.Context, publicKey solana.PublicKey) (out GetProgramAccountsResult, err error)
- func (cl *Client) GetProgramAccountsWithOpts(ctx context.Context, publicKey solana.PublicKey, opts *GetProgramAccountsOpts) (out GetProgramAccountsResult, err error)
- func (cl *Client) GetRecentBlockhash(ctx context.Context, commitment CommitmentType) (out *GetRecentBlockhashResult, err error)
- func (cl *Client) GetRecentPerformanceSamples(ctx context.Context, limit *uint) (out []*GetRecentPerformanceSamplesResult, err error)
- func (cl *Client) GetSignatureStatuses(ctx context.Context, searchTransactionHistory bool, ...) (out *GetSignatureStatusesResult, err error)
- func (cl *Client) GetSignaturesForAddress(ctx context.Context, account solana.PublicKey) (out []*TransactionSignature, err error)
- func (cl *Client) GetSignaturesForAddressWithOpts(ctx context.Context, account solana.PublicKey, ...) (out []*TransactionSignature, err error)
- func (cl *Client) GetSlot(ctx context.Context, commitment CommitmentType) (out uint64, err error)
- func (cl *Client) GetSlotLeader(ctx context.Context, commitment CommitmentType) (out solana.PublicKey, err error)
- func (cl *Client) GetSlotLeaders(ctx context.Context, start uint64, limit uint64) (out []solana.PublicKey, err error)
- func (cl *Client) GetSnapshotSlot(ctx context.Context) (out uint64, err error)
- func (cl *Client) GetStakeActivation(ctx context.Context, account solana.PublicKey, commitment CommitmentType, ...) (out *GetStakeActivationResult, err error)
- func (cl *Client) GetSupply(ctx context.Context, commitment CommitmentType) (out *GetSupplyResult, err error)
- func (cl *Client) GetSupplyWithOpts(ctx context.Context, opts *GetSupplyOpts) (out *GetSupplyResult, err error)
- func (cl *Client) GetTokenAccountBalance(ctx context.Context, account solana.PublicKey, commitment CommitmentType) (out *GetTokenAccountBalanceResult, err error)
- func (cl *Client) GetTokenAccountsByDelegate(ctx context.Context, account solana.PublicKey, conf *GetTokenAccountsConfig, ...) (out *GetTokenAccountsResult, err error)
- func (cl *Client) GetTokenAccountsByOwner(ctx context.Context, owner solana.PublicKey, conf *GetTokenAccountsConfig, ...) (out *GetTokenAccountsResult, err error)
- func (cl *Client) GetTokenLargestAccounts(ctx context.Context, tokenMint solana.PublicKey, commitment CommitmentType) (out *GetTokenLargestAccountsResult, err error)
- func (cl *Client) GetTokenSupply(ctx context.Context, tokenMint solana.PublicKey, commitment CommitmentType) (out *GetTokenSupplyResult, err error)
- func (cl *Client) GetTransaction(ctx context.Context, txSig solana.Signature, opts *GetTransactionOpts) (out *GetTransactionResult, err error)
- func (cl *Client) GetTransactionCount(ctx context.Context, commitment CommitmentType) (out uint64, err error)
- func (cl *Client) GetVersion(ctx context.Context) (out *GetVersionResult, err error)
- func (cl *Client) GetVoteAccounts(ctx context.Context, opts *GetVoteAccountsOpts) (out *GetVoteAccountsResult, err error)
- func (cl *Client) IsBlockhashValid(ctx context.Context, blockHash solana.Hash, commitment CommitmentType) (out *IsValidBlockhashResult, err error)
- func (cl *Client) MinimumLedgerSlot(ctx context.Context) (out uint64, err error)
- func (cl *Client) RPCCallForInto(ctx context.Context, out interface{}, method string, params []interface{}) error
- func (cl *Client) RPCCallWithCallback(ctx context.Context, method string, params []interface{}, ...) error
- func (cl *Client) RequestAirdrop(ctx context.Context, account solana.PublicKey, lamports uint64, ...) (signature solana.Signature, err error)
- func (cl *Client) SendEncodedTransaction(ctx context.Context, encodedTx string) (signature solana.Signature, err error)
- func (cl *Client) SendEncodedTransactionWithOpts(ctx context.Context, encodedTx string, opts TransactionOpts) (signature solana.Signature, err error)
- func (cl *Client) SendRawTransaction(ctx context.Context, rawTx []byte) (signature solana.Signature, err error)
- func (cl *Client) SendRawTransactionWithOpts(ctx context.Context, rawTx []byte, opts TransactionOpts) (signature solana.Signature, err error)
- func (cl *Client) SendTransaction(ctx context.Context, transaction *solana.Transaction) (signature solana.Signature, err error)
- func (cl *Client) SendTransactionWithOpts(ctx context.Context, transaction *solana.Transaction, opts TransactionOpts) (signature solana.Signature, err error)
- func (cl *Client) SimulateTransaction(ctx context.Context, transaction *solana.Transaction) (out *SimulateTransactionResponse, err error)
- func (cl *Client) SimulateTransactionWithOpts(ctx context.Context, transaction *solana.Transaction, ...) (out *SimulateTransactionResponse, err error)
- type Cluster
- type CommitmentType
- type CompiledTransaction
- type ConfirmationStatusType
- type Context
- type DataBytesOrJSON
- type DataSlice
- type DeprecatedTransactionMetaStatus
- type FeeCalculator
- type FeeCalculatorForBlockhashResult
- type FeeRateGovernor
- type FeeRateGovernorResult
- type FeesResult
- type GetAccountInfoOpts
- type GetAccountInfoResult
- type GetBalanceResult
- type GetBlockCommitmentResult
- type GetBlockOpts
- type GetBlockProductionOpts
- type GetBlockProductionResult
- type GetBlockResult
- type GetClusterNodesResult
- type GetConfirmedBlockOpts
- type GetConfirmedBlockResult
- type GetConfirmedSignaturesForAddress2Opts
- type GetConfirmedSignaturesForAddress2Result
- type GetEpochInfoResult
- type GetEpochScheduleResult
- type GetFeeCalculatorForBlockhashResult
- type GetFeeForMessageResult
- type GetFeeRateGovernorResult
- type GetFeesResult
- type GetHighestSnapshotSlotResult
- type GetIdentityResult
- type GetInflationGovernorResult
- type GetInflationRateResult
- type GetInflationRewardOpts
- type GetInflationRewardResult
- type GetLargestAccountsResult
- type GetLatestBlockhashResult
- type GetLeaderScheduleOpts
- type GetLeaderScheduleResult
- type GetMultipleAccountsOpts
- type GetMultipleAccountsResult
- type GetParsedTransactionOpts
- type GetParsedTransactionResult
- type GetProgramAccountsOpts
- type GetProgramAccountsResult
- type GetRecentBlockhashResult
- type GetRecentPerformanceSamplesResult
- type GetSignatureStatusesResult
- type GetSignaturesForAddressOpts
- type GetStakeActivationResult
- type GetSupplyOpts
- type GetSupplyResult
- type GetTokenAccountBalanceResult
- type GetTokenAccountsConfig
- type GetTokenAccountsOpts
- type GetTokenAccountsResult
- type GetTokenLargestAccountsResult
- type GetTokenSupplyResult
- type GetTransactionOpts
- type GetTransactionResult
- type GetVersionResult
- type GetVoteAccountsOpts
- type GetVoteAccountsResult
- type IdentityToSlotsBlocks
- type InnerInstruction
- type InstructionInfo
- type InstructionInfoEnvelope
- type IsValidBlockhashResult
- type JSONRPCClient
- type KeyedAccount
- type LargestAccountsFilterType
- type LargestAccountsResult
- type LatestBlockhashResult
- type M
- type ParsedInnerInstruction
- type ParsedInstruction
- type ParsedMessage
- type ParsedMessageAccount
- type ParsedTransaction
- type ParsedTransactionMeta
- type RPCContext
- type RPCFilter
- type RPCFilterMemcmp
- type RewardType
- type SignatureStatusesResult
- type SimulateTransactionAccountsOpts
- type SimulateTransactionOpts
- type SimulateTransactionResponse
- type SimulateTransactionResult
- type SlotRangeRequest
- type SlotRangeResponse
- type SupplyResult
- type TokenAccount
- type TokenBalance
- type TokenLargestAccountsResult
- type TransactionDetailsType
- type TransactionMeta
- type TransactionOpts
- type TransactionParsed
- type TransactionResultEnvelope
- func (dt *TransactionResultEnvelope) GetBinary() []byte
- func (dt *TransactionResultEnvelope) GetData() solana.Data
- func (dt *TransactionResultEnvelope) GetParsedTransaction() *CompiledTransaction
- func (wrap TransactionResultEnvelope) MarshalJSON() ([]byte, error)
- func (obj TransactionResultEnvelope) MarshalWithEncoder(encoder *bin.Encoder) (err error)
- func (wrap *TransactionResultEnvelope) UnmarshalJSON(data []byte) error
- func (obj *TransactionResultEnvelope) UnmarshalWithDecoder(decoder *bin.Decoder) (err error)
- type TransactionSignature
- type TransactionVersion
- type TransactionWithMeta
- type UiTokenAmount
- type VoteAccountsResult
Constants ¶
const ( DevNet_RPC = protocolHTTPS + hostDevNet TestNet_RPC = protocolHTTPS + hostTestNet MainNetBeta_RPC = protocolHTTPS + hostMainNetBeta MainNetBetaSerum_RPC = protocolHTTPS + hostMainNetBetaSerum LocalNet_RPC = "http://127.0.0.1:8899" )
const ( DevNet_WS = protocolWSS + hostDevNet TestNet_WS = protocolWSS + hostTestNet MainNetBeta_WS = protocolWSS + hostMainNetBeta MainNetBetaSerum_WS = protocolWSS + hostMainNetBetaSerum LocalNet_WS = "ws://127.0.0.1:8900" )
const HealthOk = "ok"
Variables ¶
var ( MainNetBeta = Cluster{ Name: "mainnet-beta", RPC: MainNetBeta_RPC, WS: MainNetBeta_WS, } TestNet = Cluster{ Name: "testnet", RPC: TestNet_RPC, WS: TestNet_WS, } DevNet = Cluster{ Name: "devnet", RPC: DevNet_RPC, WS: DevNet_WS, } LocalNet = Cluster{ Name: "localnet", RPC: LocalNet_RPC, WS: LocalNet_WS, } )
var ErrNotConfirmed = errors.New("not confirmed")
var ErrNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { // Number of lamports assigned to this account Lamports uint64 `json:"lamports"` // Pubkey of the program this account has been assigned to Owner solana.PublicKey `json:"owner"` // Data associated with the account, either as encoded binary data or JSON format {<program>: <state>}, depending on encoding parameter Data *DataBytesOrJSON `json:"data"` // Boolean indicating if the account contains a program (and is strictly read-only) Executable bool `json:"executable"` // The epoch at which this account will next owe rent RentEpoch uint64 `json:"rentEpoch"` }
type ActivationStateType ¶
type ActivationStateType string
const ( ActivationStateActive ActivationStateType = "active" ActivationStateInactive ActivationStateType = "inactive" ActivationStateActivating ActivationStateType = "activating" ActivationStateDeactivating ActivationStateType = "deactivating" )
type BlockProductionResult ¶
type BlockProductionResult struct { ByIdentity IdentityToSlotsBlocks `json:"byIdentity"` Range SlotRangeResponse `json:"range"` }
type BlockReward ¶
type BlockReward struct { // The public key of the account that received the reward. Pubkey solana.PublicKey `json:"pubkey"` // Number of reward lamports credited or debited by the account, as a i64. Lamports int64 `json:"lamports"` // Account balance in lamports after the reward was applied. PostBalance uint64 `json:"postBalance"` // Type of reward: "Fee", "Rent", "Voting", "Staking". RewardType RewardType `json:"rewardType"` // Vote account commission when the reward was credited, // only present for voting and staking rewards. Commission *uint8 `json:"commission,omitempty"` }
type BlockhashResult ¶
type BlockhashResult struct { Blockhash solana.Hash `json:"blockhash"` FeeCalculator FeeCalculator `json:"feeCalculator"` }
type BlocksResult ¶
type BlocksResult []uint64
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶ added in v0.3.3
New creates a new Solana JSON RPC client. Client is safe for concurrent use by multiple goroutines.
func NewWithCustomRPCClient ¶
func NewWithCustomRPCClient(rpcClient JSONRPCClient) *Client
NewWithCustomRPCClient creates a new Solana RPC client with the provided RPC client.
func NewWithHeaders ¶ added in v1.5.0
New creates a new Solana JSON RPC client with the provided custom headers. The provided headers will be added to each RPC request sent via this RPC client.
func (*Client) GetAccountDataBorshInto ¶ added in v1.0.1
func (cl *Client) GetAccountDataBorshInto(ctx context.Context, account solana.PublicKey, inVar interface{}) (err error)
GetAccountDataBorshInto decodes the borsh binary data and populates the provided `inVar` parameter with all data associated with the account of provided publicKey.
func (*Client) GetAccountDataInto ¶ added in v1.0.1
func (cl *Client) GetAccountDataInto(ctx context.Context, account solana.PublicKey, inVar interface{}) (err error)
GetAccountDataInto decodes the binary data and populates the provided `inVar` parameter with all data associated with the account of provided publicKey.
func (*Client) GetAccountInfo ¶
func (cl *Client) GetAccountInfo(ctx context.Context, account solana.PublicKey) (out *GetAccountInfoResult, err error)
GetAccountInfo returns all information associated with the account of provided publicKey.
func (*Client) GetAccountInfoWithOpts ¶
func (cl *Client) GetAccountInfoWithOpts( ctx context.Context, account solana.PublicKey, opts *GetAccountInfoOpts, ) (out *GetAccountInfoResult, err error)
GetAccountInfoWithOpts returns all information associated with the account of provided publicKey. You can specify the encoding of the returned data with the encoding parameter. You can limit the returned account data with the offset and length parameters.
func (*Client) GetBalance ¶
func (cl *Client) GetBalance( ctx context.Context, publicKey solana.PublicKey, commitment CommitmentType, ) (out *GetBalanceResult, err error)
GetBalance returns the balance of the account of provided publicKey.
func (*Client) GetBlock ¶
GetBlock returns identity and transaction information about a confirmed block in the ledger.
func (*Client) GetBlockCommitment ¶
func (cl *Client) GetBlockCommitment( ctx context.Context, block uint64, ) (out *GetBlockCommitmentResult, err error)
GetBlockCommitment returns commitment for particular block.
func (*Client) GetBlockHeight ¶
func (cl *Client) GetBlockHeight( ctx context.Context, commitment CommitmentType, ) (out uint64, err error)
GetBlockHeight returns the current block height of the node.
func (*Client) GetBlockProduction ¶
func (cl *Client) GetBlockProduction( ctx context.Context, ) (out *GetBlockProductionResult, err error)
GetBlockProduction returns recent block production information from the current or previous epoch.
func (*Client) GetBlockProductionWithOpts ¶
func (cl *Client) GetBlockProductionWithOpts( ctx context.Context, opts *GetBlockProductionOpts, ) (out *GetBlockProductionResult, err error)
GetBlockProduction returns recent block production information from the current or previous epoch.
func (*Client) GetBlockTime ¶
func (cl *Client) GetBlockTime( ctx context.Context, block uint64, ) (out *solana.UnixTimeSeconds, err error)
GetBlockTime returns the estimated production time of a block.
Each validator reports their UTC time to the ledger on a regular interval by intermittently adding a timestamp to a Vote for a particular block. A requested block's time is calculated from the stake-weighted mean of the Vote timestamps in a set of recent blocks recorded on the ledger.
The result will be an int64 estimated production time, as Unix timestamp (seconds since the Unix epoch), or nil if the timestamp is not available for this block.
func (*Client) GetBlockWithOpts ¶
func (cl *Client) GetBlockWithOpts( ctx context.Context, slot uint64, opts *GetBlockOpts, ) (out *GetBlockResult, err error)
GetBlock returns identity and transaction information about a confirmed block in the ledger.
NEW: This method is only available in solana-core v1.7 or newer. Please use `getConfirmedBlock` for solana-core v1.6
func (*Client) GetBlocks ¶
func (cl *Client) GetBlocks( ctx context.Context, startSlot uint64, endSlot *uint64, commitment CommitmentType, ) (out BlocksResult, err error)
GetBlocks returns a list of confirmed blocks between two slots. The result will be an array of u64 integers listing confirmed blocks between start_slot and either end_slot, if provided, or latest confirmed block, inclusive. Max range allowed is 500,000 slots.
func (*Client) GetBlocksWithLimit ¶
func (cl *Client) GetBlocksWithLimit( ctx context.Context, startSlot uint64, limit uint64, commitment CommitmentType, ) (out *BlocksResult, err error)
GetBlocksWithLimit returns a list of confirmed blocks starting at the given slot. The result field will be an array of u64 integers listing confirmed blocks starting at startSlot for up to limit blocks, inclusive.
func (*Client) GetClusterNodes ¶
func (cl *Client) GetClusterNodes(ctx context.Context) (out []*GetClusterNodesResult, err error)
GetClusterNodes returns information about all the nodes participating in the cluster.
func (*Client) GetConfirmedBlock ¶
func (cl *Client) GetConfirmedBlock( ctx context.Context, slot uint64, ) (out *GetConfirmedBlockResult, err error)
GetConfirmedBlock returns identity and transaction information about a confirmed block in the ledger.
DEPRECATED: Please use `getBlock` instead. This method is expected to be removed in solana-core v1.8
func (*Client) GetConfirmedBlockWithOpts ¶ added in v0.3.2
func (cl *Client) GetConfirmedBlockWithOpts( ctx context.Context, slot uint64, opts *GetConfirmedBlockOpts, ) (out *GetConfirmedBlockResult, err error)
GetConfirmedBlock returns identity and transaction information about a confirmed block in the ledger.
DEPRECATED: Please use `getBlock` instead. This method is expected to be removed in solana-core v1.8
func (*Client) GetConfirmedBlocks ¶ added in v0.3.2
func (cl *Client) GetConfirmedBlocks( ctx context.Context, startSlot uint64, endSlot *uint64, commitment CommitmentType, ) (out []uint64, err error)
GetConfirmedBlocks returns a list of confirmed blocks between two slots.
The result field will be an array of u64 integers listing confirmed blocks between start_slot and either end_slot, if provided, or latest confirmed block, inclusive. Max range allowed is 500,000 slots.
DEPRECATED: Please use `getBlocks` instead. This method is expected to be removed in solana-core v1.8
func (*Client) GetConfirmedBlocksWithLimit ¶ added in v0.3.2
func (cl *Client) GetConfirmedBlocksWithLimit( ctx context.Context, startSlot uint64, limit uint64, commitment CommitmentType, ) (out []uint64, err error)
GetConfirmedBlocksWithLimit returns a list of confirmed blocks starting at the given slot.
DEPRECATED: Please use `getBlocksWithLimit` instead. This method is expected to be removed in solana-core v1.8
func (*Client) GetConfirmedSignaturesForAddress2 ¶
func (cl *Client) GetConfirmedSignaturesForAddress2( ctx context.Context, address solana.PublicKey, opts *GetConfirmedSignaturesForAddress2Opts, ) (out GetConfirmedSignaturesForAddress2Result, err error)
GetConfirmedSignaturesForAddress2 returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block.
DEPRECATED: Please use getSignaturesForAddress instead. This method is expected to be removed in solana-core v1.8
func (*Client) GetConfirmedTransaction ¶
func (cl *Client) GetConfirmedTransaction( ctx context.Context, signature solana.Signature, ) (out *TransactionWithMeta, err error)
GetConfirmedTransaction returns transaction details for a confirmed transaction.
func (*Client) GetConfirmedTransactionWithOpts ¶ added in v0.4.0
func (cl *Client) GetConfirmedTransactionWithOpts( ctx context.Context, signature solana.Signature, opts *GetTransactionOpts, ) (out *TransactionWithMeta, err error)
GetConfirmedTransactionWithOpts returns transaction details for a confirmed transaction.
func (*Client) GetEpochInfo ¶
func (cl *Client) GetEpochInfo( ctx context.Context, commitment CommitmentType, ) (out *GetEpochInfoResult, err error)
GetEpochInfo returns information about the current epoch.
func (*Client) GetEpochSchedule ¶
func (cl *Client) GetEpochSchedule(ctx context.Context) (out *GetEpochScheduleResult, err error)
GetEpochSchedule returns epoch schedule information from this cluster's genesis config.
func (*Client) GetFeeCalculatorForBlockhash ¶
func (cl *Client) GetFeeCalculatorForBlockhash( ctx context.Context, hash solana.Hash, commitment CommitmentType, ) (out *GetFeeCalculatorForBlockhashResult, err error)
GetFeeCalculatorForBlockhash returns the fee calculator associated with the query blockhash, or null if the blockhash has expired.
NOTE: DEPRECATED
func (*Client) GetFeeForMessage ¶ added in v1.3.0
func (cl *Client) GetFeeForMessage( ctx context.Context, message string, commitment CommitmentType, ) (out *GetFeeForMessageResult, err error)
Get the fee the network will charge for a particular Message.
**NEW**: This method is only available in solana-core v1.9 or newer. Please use `getFees` for solana-core v1.8.
func (*Client) GetFeeRateGovernor ¶
func (cl *Client) GetFeeRateGovernor(ctx context.Context) (out *GetFeeRateGovernorResult, err error)
GetFeeRateGovernor returns the fee rate governor information from the root bank.
func (*Client) GetFees ¶
func (cl *Client) GetFees( ctx context.Context, commitment CommitmentType, ) (out *GetFeesResult, err error)
GetFees returns a recent block hash from the ledger, a fee schedule that can be used to compute the cost of submitting a transaction using it, and the last slot in which the blockhash will be valid.
func (*Client) GetFirstAvailableBlock ¶
GetFirstAvailableBlock returns the slot of the lowest confirmed block that has not been purged from the ledger.
func (*Client) GetGenesisHash ¶
GetGenesisHash returns the genesis hash.
func (*Client) GetHealth ¶
GetHealth returns the current health of the node. If one or more --trusted-validator arguments are provided to solana-validator, "ok" is returned when the node has within HEALTH_CHECK_SLOT_DISTANCE slots of the highest trusted validator, otherwise an error is returned. "ok" is always returned if no trusted validators are provided.
- If the node is healthy: "ok"
- If the node is unhealthy, a JSON RPC error response is returned. The specifics of the error response are UNSTABLE and may change in the future.
func (*Client) GetHighestSnapshotSlot ¶ added in v1.3.0
func (cl *Client) GetHighestSnapshotSlot(ctx context.Context) (out *GetHighestSnapshotSlotResult, err error)
Returns the highest slot information that the node has snapshots for. This will find the highest full snapshot slot, and the highest incremental snapshot slot _based on_ the full snapshot slot, if there is one.
**NEW: This method is only available in solana-core v1.9 or newer. Please use `getSnapshotSlot` for solana-core v1.8**
func (*Client) GetIdentity ¶
func (cl *Client) GetIdentity(ctx context.Context) (out *GetIdentityResult, err error)
GetIdentity returns the identity pubkey for the current node.
func (*Client) GetInflationGovernor ¶
func (cl *Client) GetInflationGovernor( ctx context.Context, commitment CommitmentType, ) (out *GetInflationGovernorResult, err error)
GetInflationGovernor returns the current inflation governor.
func (*Client) GetInflationRate ¶
func (cl *Client) GetInflationRate(ctx context.Context) (out *GetInflationRateResult, err error)
GetInflationRate returns the specific inflation values for the current epoch.
func (*Client) GetInflationReward ¶
func (cl *Client) GetInflationReward( ctx context.Context, addresses []solana.PublicKey, opts *GetInflationRewardOpts, ) (out []*GetInflationRewardResult, err error)
GetInflationReward returns the inflation / staking reward for a list of addresses for an epoch.
func (*Client) GetLargestAccounts ¶
func (cl *Client) GetLargestAccounts( ctx context.Context, commitment CommitmentType, filter LargestAccountsFilterType, ) (out *GetLargestAccountsResult, err error)
GetLargestAccounts returns the 20 largest accounts, by lamport balance (results may be cached up to two hours).
func (*Client) GetLatestBlockhash ¶ added in v1.3.0
func (cl *Client) GetLatestBlockhash( ctx context.Context, commitment CommitmentType, ) (out *GetLatestBlockhashResult, err error)
Returns the latest blockhash.
**NEW: This method is only available in solana-core v1.9 or newer. Please use `getRecentBlockhash` for solana-core v1.8**
func (*Client) GetLeaderSchedule ¶
func (cl *Client) GetLeaderSchedule( ctx context.Context, ) (out GetLeaderScheduleResult, err error)
GetLeaderSchedule returns the leader schedule for current epoch.
func (*Client) GetLeaderScheduleWithOpts ¶
func (cl *Client) GetLeaderScheduleWithOpts( ctx context.Context, opts *GetLeaderScheduleOpts, ) (out GetLeaderScheduleResult, err error)
GetLeaderScheduleWithOpts returns the leader schedule for an epoch.
func (*Client) GetMaxRetransmitSlot ¶
GetMaxRetransmitSlot returns the max slot seen from retransmit stage.
func (*Client) GetMaxShredInsertSlot ¶
GetMaxShredInsertSlot returns the max slot seen from after shred insert.
func (*Client) GetMinimumBalanceForRentExemption ¶
func (cl *Client) GetMinimumBalanceForRentExemption( ctx context.Context, dataSize uint64, commitment CommitmentType, ) (lamport uint64, err error)
GetMinimumBalanceForRentExemption returns minimum balance required to make account rent exempt.
func (*Client) GetMultipleAccounts ¶
func (cl *Client) GetMultipleAccounts( ctx context.Context, accounts ...solana.PublicKey, ) (out *GetMultipleAccountsResult, err error)
GetMultipleAccounts returns the account information for a list of Pubkeys.
func (*Client) GetMultipleAccountsWithOpts ¶
func (cl *Client) GetMultipleAccountsWithOpts( ctx context.Context, accounts []solana.PublicKey, opts *GetMultipleAccountsOpts, ) (out *GetMultipleAccountsResult, err error)
GetMultipleAccountsWithOpts returns the account information for a list of Pubkeys.
func (*Client) GetParsedTransaction ¶ added in v1.6.0
func (cl *Client) GetParsedTransaction( ctx context.Context, txSig solana.Signature, opts *GetParsedTransactionOpts, ) (out *GetParsedTransactionResult, err error)
func (*Client) GetProgramAccounts ¶
func (cl *Client) GetProgramAccounts( ctx context.Context, publicKey solana.PublicKey, ) (out GetProgramAccountsResult, err error)
GetProgramAccounts returns all accounts owned by the provided program publicKey.
func (*Client) GetProgramAccountsWithOpts ¶
func (cl *Client) GetProgramAccountsWithOpts( ctx context.Context, publicKey solana.PublicKey, opts *GetProgramAccountsOpts, ) (out GetProgramAccountsResult, err error)
GetProgramAccountsWithOpts returns all accounts owned by the provided program publicKey.
func (*Client) GetRecentBlockhash ¶
func (cl *Client) GetRecentBlockhash( ctx context.Context, commitment CommitmentType, ) (out *GetRecentBlockhashResult, err error)
GetRecentBlockhash returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it.
func (*Client) GetRecentPerformanceSamples ¶
func (cl *Client) GetRecentPerformanceSamples( ctx context.Context, limit *uint, ) (out []*GetRecentPerformanceSamplesResult, err error)
GetRecentPerformanceSamples returns a list of recent performance samples, in reverse slot order. Performance samples are taken every 60 seconds and include the number of transactions and slots that occur in a given time window.
func (*Client) GetSignatureStatuses ¶
func (cl *Client) GetSignatureStatuses( ctx context.Context, searchTransactionHistory bool, transactionSignatures ...solana.Signature, ) (out *GetSignatureStatusesResult, err error)
GetSignatureStatuses Returns the statuses of a list of signatures. Unless the searchTransactionHistory configuration parameter is included,this method only searches the recent status cache of signatures, which retains statuses for all active slots plus MAX_RECENT_BLOCKHASHES rooted slots.
func (*Client) GetSignaturesForAddress ¶
func (cl *Client) GetSignaturesForAddress( ctx context.Context, account solana.PublicKey, ) (out []*TransactionSignature, err error)
GetSignaturesForAddress returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block.
NEW: This method is only available in solana-core v1.7 or newer. Please use `getConfirmedSignaturesForAddress2` for solana-core v1.6
func (*Client) GetSignaturesForAddressWithOpts ¶
func (cl *Client) GetSignaturesForAddressWithOpts( ctx context.Context, account solana.PublicKey, opts *GetSignaturesForAddressOpts, ) (out []*TransactionSignature, err error)
GetSignaturesForAddressWithOpts returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block.
NEW: This method is only available in solana-core v1.7 or newer. Please use `getConfirmedSignaturesForAddress2` for solana-core v1.6
func (*Client) GetSlot ¶
func (cl *Client) GetSlot( ctx context.Context, commitment CommitmentType, ) (out uint64, err error)
GetSlot returns the slot that has reached the given or default commitment level.
func (*Client) GetSlotLeader ¶
func (cl *Client) GetSlotLeader( ctx context.Context, commitment CommitmentType, ) (out solana.PublicKey, err error)
GetSlotLeader returns the current slot leader.
func (*Client) GetSlotLeaders ¶
func (cl *Client) GetSlotLeaders( ctx context.Context, start uint64, limit uint64, ) (out []solana.PublicKey, err error)
GetSlotLeaders returns the slot leaders for a given slot range.
func (*Client) GetSnapshotSlot ¶
GetSnapshotSlot returns the highest slot that the node has a snapshot for.
func (*Client) GetStakeActivation ¶
func (cl *Client) GetStakeActivation( ctx context.Context, account solana.PublicKey, commitment CommitmentType, epoch *uint64, ) (out *GetStakeActivationResult, err error)
GetStakeActivation returns epoch activation information for a stake account.
func (*Client) GetSupply ¶
func (cl *Client) GetSupply(ctx context.Context, commitment CommitmentType) (out *GetSupplyResult, err error)
GetSupply returns information about the current supply.
func (*Client) GetSupplyWithOpts ¶ added in v1.0.3
func (cl *Client) GetSupplyWithOpts( ctx context.Context, opts *GetSupplyOpts, ) (out *GetSupplyResult, err error)
GetSupply returns information about the current supply.
func (*Client) GetTokenAccountBalance ¶
func (cl *Client) GetTokenAccountBalance( ctx context.Context, account solana.PublicKey, commitment CommitmentType, ) (out *GetTokenAccountBalanceResult, err error)
GetTokenAccountBalance returns the token balance of an SPL Token account.
func (*Client) GetTokenAccountsByDelegate ¶
func (cl *Client) GetTokenAccountsByDelegate( ctx context.Context, account solana.PublicKey, conf *GetTokenAccountsConfig, opts *GetTokenAccountsOpts, ) (out *GetTokenAccountsResult, err error)
GetTokenAccountsByDelegate returns all SPL Token accounts by approved Delegate.
func (*Client) GetTokenAccountsByOwner ¶
func (cl *Client) GetTokenAccountsByOwner( ctx context.Context, owner solana.PublicKey, conf *GetTokenAccountsConfig, opts *GetTokenAccountsOpts, ) (out *GetTokenAccountsResult, err error)
GetTokenAccountsByOwner returns all SPL Token accounts by token owner.
func (*Client) GetTokenLargestAccounts ¶
func (cl *Client) GetTokenLargestAccounts( ctx context.Context, tokenMint solana.PublicKey, commitment CommitmentType, ) (out *GetTokenLargestAccountsResult, err error)
GetTokenLargestAccounts returns the 20 largest accounts of a particular SPL Token type.
func (*Client) GetTokenSupply ¶
func (cl *Client) GetTokenSupply( ctx context.Context, tokenMint solana.PublicKey, commitment CommitmentType, ) (out *GetTokenSupplyResult, err error)
GetTokenSupply returns the total supply of an SPL Token type.
func (*Client) GetTransaction ¶
func (cl *Client) GetTransaction( ctx context.Context, txSig solana.Signature, opts *GetTransactionOpts, ) (out *GetTransactionResult, err error)
GetTransaction returns transaction details for a confirmed transaction.
NEW: This method is only available in solana-core v1.7 or newer. Please use `getConfirmedTransaction` for solana-core v1.6
func (*Client) GetTransactionCount ¶
func (cl *Client) GetTransactionCount( ctx context.Context, commitment CommitmentType, ) (out uint64, err error)
GetTransactionCount returns the current Transaction count from the ledger.
func (*Client) GetVersion ¶
func (cl *Client) GetVersion(ctx context.Context) (out *GetVersionResult, err error)
GetVersion returns the current solana versions running on the node.
func (*Client) GetVoteAccounts ¶
func (cl *Client) GetVoteAccounts( ctx context.Context, opts *GetVoteAccountsOpts, ) (out *GetVoteAccountsResult, err error)
GetVoteAccounts returns the account info and associated stake for all the voting accounts in the current bank.
func (*Client) IsBlockhashValid ¶ added in v1.0.3
func (cl *Client) IsBlockhashValid( ctx context.Context, blockHash solana.Hash, commitment CommitmentType, ) (out *IsValidBlockhashResult, err error)
Returns whether a blockhash is still valid or not
**NEW: This method is only available in solana-core v1.9 or newer. Please use `getFeeCalculatorForBlockhash` for solana-core v1.8**
func (*Client) MinimumLedgerSlot ¶
MinimumLedgerSlot returns 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 (*Client) RPCCallForInto ¶ added in v1.0.1
func (cl *Client) RPCCallForInto(ctx context.Context, out interface{}, method string, params []interface{}) error
RPCCallForInto allows to access the raw RPC client and send custom requests.
func (*Client) RPCCallWithCallback ¶ added in v1.0.1
func (*Client) RequestAirdrop ¶
func (cl *Client) RequestAirdrop( ctx context.Context, account solana.PublicKey, lamports uint64, commitment CommitmentType, ) (signature solana.Signature, err error)
RequestAirdrop requests an airdrop of lamports to a publicKey. Returns transaction signature of airdrop.
func (*Client) SendEncodedTransaction ¶ added in v1.0.3
func (cl *Client) SendEncodedTransaction( ctx context.Context, encodedTx string, ) (signature solana.Signature, err error)
SendEncodedTransaction submits a signed base64 encoded transaction to the cluster for processing. The only difference between this function and SignTransaction is that the latter takes a *solana.Transaction value, as the former takes a raw base64 string
func (*Client) SendEncodedTransactionWithOpts ¶ added in v1.0.3
func (cl *Client) SendEncodedTransactionWithOpts( ctx context.Context, encodedTx string, opts TransactionOpts, ) (signature solana.Signature, err error)
SendEncodedTransactionWithOpts submits a signed base64 encoded transaction to the cluster for processing.
func (*Client) SendRawTransaction ¶ added in v1.0.3
func (cl *Client) SendRawTransaction( ctx context.Context, rawTx []byte, ) (signature solana.Signature, err error)
SendRawTransaction submits a signed transaction to the cluster for processing. The only difference between this function and SignTransaction is that the latter takes a *solana.Transaction value, as the former takes a transaction in wire format as a byte array
func (*Client) SendRawTransactionWithOpts ¶ added in v1.0.3
func (cl *Client) SendRawTransactionWithOpts( ctx context.Context, rawTx []byte, opts TransactionOpts, ) (signature solana.Signature, err error)
SendRawTransactionWithOpts submits a raw encoded transaction as a byte array to the cluster for processing.
func (*Client) SendTransaction ¶
func (cl *Client) SendTransaction( ctx context.Context, transaction *solana.Transaction, ) (signature solana.Signature, err error)
SendTransaction submits a signed transaction to the cluster for processing.
func (*Client) SendTransactionWithOpts ¶
func (cl *Client) SendTransactionWithOpts( ctx context.Context, transaction *solana.Transaction, opts TransactionOpts, ) (signature solana.Signature, err error)
SendTransaction submits a signed transaction to the cluster for processing. This method does not alter the transaction in any way; it relays the transaction created by clients to the node as-is.
If the node's rpc service receives the transaction, this method immediately succeeds, without waiting for any confirmations. A successful response from this method does not guarantee the transaction is processed or confirmed by the cluster.
While the rpc service will reasonably retry to submit it, the transaction could be rejected if transaction's recent_blockhash expires before it lands.
Use getSignatureStatuses to ensure a transaction is processed and confirmed.
Before submitting, the following preflight checks are performed:
- The transaction signatures are verified
- The transaction is simulated against the bank slot specified by the preflight commitment. On failure an error will be returned. Preflight checks may be disabled if desired. It is recommended to specify the same commitment and preflight commitment to avoid confusing behavior.
The returned signature is the first signature in the transaction, which is used to identify the transaction (transaction id). This identifier can be easily extracted from the transaction data before submission.
func (*Client) SimulateTransaction ¶
func (cl *Client) SimulateTransaction( ctx context.Context, transaction *solana.Transaction, ) (out *SimulateTransactionResponse, err error)
SimulateTransaction simulates sending a transaction.
func (*Client) SimulateTransactionWithOpts ¶
func (cl *Client) SimulateTransactionWithOpts( ctx context.Context, transaction *solana.Transaction, opts *SimulateTransactionOpts, ) (out *SimulateTransactionResponse, err error)
SimulateTransaction simulates sending a transaction.
type CommitmentType ¶
type CommitmentType string
const ( CommitmentMax CommitmentType = "max" // Deprecated as of v1.5.5 CommitmentRecent CommitmentType = "recent" // Deprecated as of v1.5.5 CommitmentRoot CommitmentType = "root" // Deprecated as of v1.5.5 CommitmentSingle CommitmentType = "single" // Deprecated as of v1.5.5 CommitmentSingleGossip CommitmentType = "singleGossip" // Deprecated as of v1.5.5 // The node will query the most recent block confirmed by supermajority // of the cluster as having reached maximum lockout, // meaning the cluster has recognized this block as finalized. CommitmentFinalized CommitmentType = "finalized" // The node will query the most recent block that has been voted on by supermajority of the cluster. // - It incorporates votes from gossip and replay. // - It does not count votes on descendants of a block, only direct votes on that block. // - This confirmation level also upholds "optimistic confirmation" guarantees in release 1.3 and onwards. CommitmentConfirmed CommitmentType = "confirmed" // The node will query its most recent block. Note that the block may still be skipped by the cluster. CommitmentProcessed CommitmentType = "processed" )
type CompiledTransaction ¶ added in v1.6.0
type CompiledTransaction struct { Signatures []solana.Signature `json:"signatures"` Message solana.Message `json:"message"` }
Parsed Transaction
type ConfirmationStatusType ¶
type ConfirmationStatusType string
const ( ConfirmationStatusProcessed ConfirmationStatusType = "processed" ConfirmationStatusConfirmed ConfirmationStatusType = "confirmed" ConfirmationStatusFinalized ConfirmationStatusType = "finalized" )
type DataBytesOrJSON ¶
type DataBytesOrJSON struct {
// contains filtered or unexported fields
}
func DataBytesOrJSONFromBase64 ¶ added in v1.3.0
func DataBytesOrJSONFromBase64(stringBase64 string) (*DataBytesOrJSON, error)
func DataBytesOrJSONFromBytes ¶ added in v1.5.0
func DataBytesOrJSONFromBytes(data []byte) *DataBytesOrJSON
DataBytesOrJSONFromBytes creates a new `DataBytesOrJSON` from the provided bytes.
func (*DataBytesOrJSON) GetBinary ¶
func (dt *DataBytesOrJSON) GetBinary() []byte
GetBinary returns the decoded bytes if the encoding is "base58", "base64", or "base64+zstd".
func (*DataBytesOrJSON) GetRawJSON ¶
func (dt *DataBytesOrJSON) GetRawJSON() stdjson.RawMessage
GetRawJSON returns a stdjson.RawMessage when the data encoding is "jsonParsed".
func (DataBytesOrJSON) MarshalJSON ¶
func (dt DataBytesOrJSON) MarshalJSON() ([]byte, error)
func (*DataBytesOrJSON) UnmarshalJSON ¶
func (wrap *DataBytesOrJSON) UnmarshalJSON(data []byte) error
type DeprecatedTransactionMetaStatus ¶
type DeprecatedTransactionMetaStatus M
Ok interface{} `json:"Ok"` // <null> Transaction was successful Err interface{} `json:"Err"` // Transaction failed with TransactionError
type FeeCalculator ¶
type FeeCalculator struct {
LamportsPerSignature uint64 `json:"lamportsPerSignature"`
}
type FeeCalculatorForBlockhashResult ¶
type FeeCalculatorForBlockhashResult struct { // Object describing the cluster fee rate at the queried blockhash FeeCalculator FeeCalculator `json:"feeCalculator"` }
type FeeRateGovernor ¶
type FeeRateGovernor struct { // Percentage of fees collected to be destroyed. BurnPercent uint8 `json:"burnPercent"` // Largest value lamportsPerSignature can attain for the next slot. MaxLamportsPerSignature uint64 `json:"maxLamportsPerSignature"` // Smallest value lamportsPerSignature can attain for the next slot. MinLamportsPerSignature uint64 `json:"minLamportsPerSignature"` // Desired fee rate for the cluster. TargetLamportsPerSignature uint64 `json:"targetLamportsPerSignature"` // Desired signature rate for the cluster. TargetSignaturesPerSlot uint64 `json:"targetSignaturesPerSlot"` }
type FeeRateGovernorResult ¶
type FeeRateGovernorResult struct {
FeeRateGovernor FeeRateGovernor `json:"feeRateGovernor"`
}
type FeesResult ¶
type FeesResult struct { // A Hash. Blockhash solana.Hash `json:"blockhash"` // FeeCalculator object, the fee schedule for this block hash. FeeCalculator FeeCalculator `json:"feeCalculator"` // DEPRECATED - this value is inaccurate and should not be relied upon. LastValidSlot uint64 `json:"lastValidSlot"` // Last block height at which a blockhash will be valid. LastValidBlockHeight uint64 `json:"lastValidBlockHeight"` }
type GetAccountInfoOpts ¶
type GetAccountInfoOpts struct { // Encoding for Account data. // Either "base58" (slow), "base64", "base64+zstd", or "jsonParsed". // - "base58" is limited to Account data of less than 129 bytes. // - "base64" will return base64 encoded data for Account data of any size. // - "base64+zstd" compresses the Account data using Zstandard and base64-encodes the result. // - "jsonParsed" encoding attempts to use program-specific state parsers to return more // human-readable and explicit account state data. If "jsonParsed" is requested but a parser // cannot be found, the field falls back to "base64" encoding, // detectable when the data field is type <string>. // // This parameter is optional. Encoding solana.EncodingType // Commitment requirement. // // This parameter is optional. Commitment CommitmentType // dataSlice parameters for limiting returned account data: // Limits the returned account data using the provided offset and length fields; // only available for "base58", "base64" or "base64+zstd" encodings. // // This parameter is optional. DataSlice *DataSlice // The minimum slot that the request can be evaluated at. // This parameter is optional. MinContextSlot *uint64 }
type GetAccountInfoResult ¶
type GetAccountInfoResult struct { RPCContext Value *Account `json:"value"` }
type GetBalanceResult ¶
type GetBalanceResult struct { RPCContext Value uint64 `json:"value"` }
type GetBlockCommitmentResult ¶
type GetBlockCommitmentResult struct { // nil if Unknown block, or array of u64 integers // logging the amount of cluster stake in lamports // that has voted on the block at each depth from 0 to `MAX_LOCKOUT_HISTORY` + 1 Commitment []uint64 `json:"commitment"` // Total active stake, in lamports, of the current epoch. TotalStake uint64 `json:"totalStake"` }
type GetBlockOpts ¶
type GetBlockOpts struct { // Encoding for each returned Transaction, either "json", "jsonParsed", "base58" (slow), "base64". // If parameter not provided, the default encoding is "json". // - "jsonParsed" encoding attempts to use program-specific instruction parsers to return // more human-readable and explicit data in the transaction.message.instructions list. // - If "jsonParsed" is requested but a parser cannot be found, the instruction falls back // to regular JSON encoding (accounts, data, and programIdIndex fields). // // This parameter is optional. Encoding solana.EncodingType // Level of transaction detail to return. // If parameter not provided, the default detail level is "full". // // This parameter is optional. TransactionDetails TransactionDetailsType // Whether to populate the rewards array. // If parameter not provided, the default includes rewards. // // This parameter is optional. Rewards *bool // "processed" is not supported. // If parameter not provided, the default is "finalized". // // This parameter is optional. Commitment CommitmentType // Max transaction version to return in responses. // If the requested block contains a transaction with a higher version, an error will be returned. MaxSupportedTransactionVersion *uint64 }
type GetBlockProductionOpts ¶
type GetBlockProductionOpts struct { // // This parameter is optional. Commitment CommitmentType `json:"commitment,omitempty"` // Slot range to return block production for. // If parameter not provided, defaults to current epoch. // // This parameter is optional. Range *SlotRangeRequest `json:"range,omitempty"` // Only return results for this validator identity. // // This parameter is optional. Identity *solana.PublicKey `json:"identity,omitempty"` }
type GetBlockProductionResult ¶
type GetBlockProductionResult struct { RPCContext Value BlockProductionResult `json:"value"` }
type GetBlockResult ¶
type GetBlockResult struct { // The blockhash of this block. Blockhash solana.Hash `json:"blockhash"` // The blockhash of this block's parent; // if the parent block is not available due to ledger cleanup, // this field will return "11111111111111111111111111111111". PreviousBlockhash solana.Hash `json:"previousBlockhash"` // The slot index of this block's parent. ParentSlot uint64 `json:"parentSlot"` // Present if "full" transaction details are requested. Transactions []TransactionWithMeta `json:"transactions"` // Present if "signatures" are requested for transaction details; // an array of signatures, corresponding to the transaction order in the block. Signatures []solana.Signature `json:"signatures"` // Present if rewards are requested. Rewards []BlockReward `json:"rewards"` // Estimated production time, as Unix timestamp (seconds since the Unix epoch). // Nil if not available. BlockTime *solana.UnixTimeSeconds `json:"blockTime"` // The number of blocks beneath this block. BlockHeight *uint64 `json:"blockHeight"` }
type GetClusterNodesResult ¶
type GetClusterNodesResult struct { // Node public key. Pubkey solana.PublicKey `json:"pubkey"` // Gossip network address for the node. Gossip *string `json:"gossip,omitempty"` // TPU network address for the node. TPU *string `json:"tpu,omitempty"` // JSON RPC network address for the node, or empty if the JSON RPC service is not enabled. RPC *string `json:"rpc,omitempty"` // The software version of the node, or empty if the version information is not available. Version *string `json:"version,omitempty"` // TODO: what type is this? // The unique identifier of the node's feature set. FeatureSet uint32 `json:"featureSet,omitempty"` // The shred version the node has been configured to use. ShredVersion uint16 `json:"shredVersion,omitempty"` }
type GetConfirmedBlockOpts ¶ added in v0.3.2
type GetConfirmedBlockOpts struct { Encoding solana.EncodingType // Level of transaction detail to return. TransactionDetails TransactionDetailsType // Whether to populate the rewards array. If parameter not provided, the default includes rewards. Rewards *bool // Desired commitment; "processed" is not supported. // If parameter not provided, the default is "finalized". Commitment CommitmentType }
type GetConfirmedBlockResult ¶
type GetConfirmedBlockResult struct { Blockhash solana.Hash `json:"blockhash"` // could be zeroes if ledger was clean-up and this is unavailable PreviousBlockhash solana.Hash `json:"previousBlockhash"` ParentSlot uint64 `json:"parentSlot"` Transactions []TransactionWithMeta `json:"transactions"` Signatures []solana.Signature `json:"signatures"` Rewards []BlockReward `json:"rewards"` BlockTime *solana.UnixTimeSeconds `json:"blockTime,omitempty"` }
type GetConfirmedSignaturesForAddress2Opts ¶
type GetConfirmedSignaturesForAddress2Opts struct { Limit *uint64 `json:"limit,omitempty"` Before solana.Signature `json:"before,omitempty"` Until solana.Signature `json:"until,omitempty"` Commitment CommitmentType `json:"commitment,omitempty"` }
type GetConfirmedSignaturesForAddress2Result ¶
type GetConfirmedSignaturesForAddress2Result []*TransactionSignature
type GetEpochInfoResult ¶
type GetEpochInfoResult struct { // The current slot. AbsoluteSlot uint64 `json:"absoluteSlot"` // The current block height. BlockHeight uint64 `json:"blockHeight"` // The current epoch. Epoch uint64 `json:"epoch"` // The current slot relative to the start of the current epoch. SlotIndex uint64 `json:"slotIndex"` // The number of slots in this epoch. SlotsInEpoch uint64 `json:"slotsInEpoch"` TransactionCount *uint64 `json:"transactionCount,omitempty"` }
type GetEpochScheduleResult ¶
type GetEpochScheduleResult struct { // The maximum number of slots in each epoch. SlotsPerEpoch uint64 `json:"slotsPerEpoch"` // The number of slots before beginning of an epoch to calculate a leader schedule for that epoch. LeaderScheduleSlotOffset uint64 `json:"leaderScheduleSlotOffset"` // Whether epochs start short and grow. Warmup bool `json:"warmup"` // First normal-length epoch, log2(slotsPerEpoch) - log2(MINIMUM_SLOTS_PER_EPOCH) FirstNormalEpoch uint64 `json:"firstNormalEpoch"` // MINIMUM_SLOTS_PER_EPOCH * (2.pow(firstNormalEpoch) - 1) FirstNormalSlot uint64 `json:"firstNormalSlot"` }
type GetFeeCalculatorForBlockhashResult ¶
type GetFeeCalculatorForBlockhashResult struct { RPCContext // Value will be nil if the query blockhash has expired. Value *FeeCalculatorForBlockhashResult `json:"value"` }
type GetFeeForMessageResult ¶ added in v1.3.0
type GetFeeForMessageResult struct { RPCContext // Fee corresponding to the message at the specified blockhash. Value *uint64 `json:"value"` }
type GetFeeRateGovernorResult ¶
type GetFeeRateGovernorResult struct { RPCContext Value FeeRateGovernorResult `json:"value"` }
type GetFeesResult ¶
type GetFeesResult struct { RPCContext Value *FeesResult `json:"value"` }
type GetHighestSnapshotSlotResult ¶ added in v1.3.0
type GetIdentityResult ¶
type GetIdentityResult struct {
// The identity pubkey of the current node.
Identity solana.PublicKey `json:"identity"`
}
type GetInflationGovernorResult ¶
type GetInflationGovernorResult struct { // The initial inflation percentage from time 0. Initial float64 `json:"initial"` // Terminal inflation percentage. Terminal float64 `json:"terminal"` // Rate per year at which inflation is lowered. Rate reduction is derived using the target slot time in genesis config. Taper float64 `json:"taper"` // Percentage of total inflation allocated to the foundation. Foundation float64 `json:"foundation"` // Duration of foundation pool inflation in years. FoundationTerm float64 `json:"foundationTerm"` }
type GetInflationRateResult ¶
type GetInflationRateResult 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 float64 `json:"epoch"` }
type GetInflationRewardOpts ¶
type GetInflationRewardOpts struct { Commitment CommitmentType // An epoch for which the reward occurs. // If omitted, the previous epoch will be used. Epoch *uint64 }
type GetInflationRewardResult ¶
type GetInflationRewardResult struct { // Epoch for which reward occured. 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 *uint8 `json:"commission,omitempty"` }
type GetLargestAccountsResult ¶
type GetLargestAccountsResult struct { RPCContext Value []LargestAccountsResult `json:"value"` }
type GetLatestBlockhashResult ¶ added in v1.3.0
type GetLatestBlockhashResult struct { RPCContext Value *LatestBlockhashResult `json:"value"` }
type GetLeaderScheduleOpts ¶
type GetLeaderScheduleOpts struct { Commitment CommitmentType // Fetch the leader schedule for the epoch that corresponds // to the provided slot. // If unspecified, the leader schedule for the current epoch is fetched Epoch *uint64 // TODO: is identity a pubkey? Identity *solana.PublicKey // Only return results for this validator identity }
type GetLeaderScheduleResult ¶
type GetLeaderScheduleResult map[solana.PublicKey][]uint64
The result field will be a dictionary of validator identities, and their corresponding leader slot indices as values (indices are relative to the first slot in the requested epoch).
type GetMultipleAccountsOpts ¶ added in v0.3.5
type GetMultipleAccountsOpts GetAccountInfoOpts
type GetMultipleAccountsResult ¶
type GetMultipleAccountsResult struct { RPCContext Value []*Account `json:"value"` }
type GetParsedTransactionOpts ¶ added in v1.6.0
type GetParsedTransactionOpts struct {
Commitment CommitmentType `json:"commitment,omitempty"`
}
type GetParsedTransactionResult ¶ added in v1.6.0
type GetParsedTransactionResult struct { Slot uint64 BlockTime *solana.UnixTimeSeconds Transaction *ParsedTransaction Meta *ParsedTransactionMeta }
func (GetParsedTransactionResult) MarshalWithEncoder ¶ added in v1.6.0
func (obj GetParsedTransactionResult) MarshalWithEncoder(encoder *bin.Encoder) (err error)
func (GetParsedTransactionResult) UnmarshalWithDecoder ¶ added in v1.6.0
func (obj GetParsedTransactionResult) UnmarshalWithDecoder(decoder *bin.Decoder) (err error)
type GetProgramAccountsOpts ¶
type GetProgramAccountsOpts struct { Commitment CommitmentType `json:"commitment,omitempty"` Encoding solana.EncodingType `json:"encoding,omitempty"` // Limit the returned account data DataSlice *DataSlice `json:"dataSlice,omitempty"` // Filter on accounts, implicit AND between filters. // Filter results using various filter objects; // account must meet all filter criteria to be included in results. Filters []RPCFilter `json:"filters,omitempty"` }
type GetProgramAccountsResult ¶
type GetProgramAccountsResult []*KeyedAccount
type GetRecentBlockhashResult ¶
type GetRecentBlockhashResult struct { RPCContext Value *BlockhashResult `json:"value"` }
type GetRecentPerformanceSamplesResult ¶
type GetRecentPerformanceSamplesResult struct { // Slot in which sample was taken at. Slot uint64 `json:"slot"` // Number of transactions in sample. NumTransactions uint64 `json:"numTransactions"` // Number of slots in sample. NumSlots uint64 `json:"numSlots"` // Number of seconds in a sample window. SamplePeriodSecs uint16 `json:"samplePeriodSecs"` }
type GetSignatureStatusesResult ¶
type GetSignatureStatusesResult struct { RPCContext Value []*SignatureStatusesResult `json:"value"` }
type GetSignaturesForAddressOpts ¶
type GetSignaturesForAddressOpts struct { // (optional) Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). Limit *int `json:"limit,omitempty"` // (optional) Start searching backwards from this transaction signature. // If not provided the search starts from the top of the highest max confirmed block. Before solana.Signature `json:"before,omitempty"` // (optional) Search until this transaction signature, if found before limit reached. Until solana.Signature `json:"until,omitempty"` // (optional) Commitment; "processed" is not supported. // If parameter not provided, the default is "finalized". Commitment CommitmentType `json:"commitment,omitempty"` // The minimum slot that the request can be evaluated at. // This parameter is optional. MinContextSlot *uint64 }
type GetStakeActivationResult ¶
type GetStakeActivationResult struct { // The stake account's activation state, one of: active, inactive, activating, deactivating. State ActivationStateType `json:"state"` // Stake active during the epoch. Active uint64 `json:"active"` // Stake inactive during the epoch. Inactive uint64 `json:"inactive"` }
type GetSupplyOpts ¶ added in v1.0.3
type GetSupplyOpts struct { Commitment CommitmentType `json:"commitment,omitempty"` ExcludeNonCirculatingAccountsList bool `json:"excludeNonCirculatingAccountsList,omitempty"` // exclude non circulating accounts list from response }
type GetSupplyResult ¶
type GetSupplyResult struct { RPCContext Value *SupplyResult `json:"value"` }
type GetTokenAccountBalanceResult ¶
type GetTokenAccountBalanceResult struct { RPCContext Value *UiTokenAmount `json:"value"` }
type GetTokenAccountsConfig ¶
type GetTokenAccountsConfig struct { // Pubkey of the specific token Mint to limit accounts to. Mint *solana.PublicKey `json:"mint"` // Pubkey of the Token program ID that owns the accounts. ProgramId *solana.PublicKey `json:"programId"` }
type GetTokenAccountsOpts ¶
type GetTokenAccountsOpts struct { Commitment CommitmentType `json:"commitment,omitempty"` Encoding solana.EncodingType `json:"encoding,omitempty"` DataSlice *DataSlice `json:"dataSlice,omitempty"` }
type GetTokenAccountsResult ¶
type GetTokenAccountsResult struct { RPCContext Value []*TokenAccount `json:"value"` }
type GetTokenLargestAccountsResult ¶
type GetTokenLargestAccountsResult struct { RPCContext Value []*TokenLargestAccountsResult `json:"value"` }
type GetTokenSupplyResult ¶
type GetTokenSupplyResult struct { RPCContext Value *UiTokenAmount `json:"value"` }
type GetTransactionOpts ¶
type GetTransactionOpts struct { Encoding solana.EncodingType `json:"encoding,omitempty"` // Desired commitment. "processed" is not supported. If parameter not provided, the default is "finalized". Commitment CommitmentType `json:"commitment,omitempty"` // Max transaction version to return in responses. // If the requested block contains a transaction with a higher version, an error will be returned. MaxSupportedTransactionVersion *uint64 }
type GetTransactionResult ¶
type GetTransactionResult struct { // The slot this transaction was processed in. Slot uint64 `json:"slot"` // Estimated production time, as Unix timestamp (seconds since the Unix epoch) // of when the transaction was processed. // Nil if not available. BlockTime *solana.UnixTimeSeconds `json:"blockTime" bin:"optional"` Transaction *TransactionResultEnvelope `json:"transaction" bin:"optional"` Meta *TransactionMeta `json:"meta,omitempty" bin:"optional"` Version TransactionVersion `json:"version"` }
func (GetTransactionResult) MarshalWithEncoder ¶ added in v1.2.0
func (obj GetTransactionResult) MarshalWithEncoder(encoder *bin.Encoder) (err error)
func (*GetTransactionResult) UnmarshalWithDecoder ¶ added in v1.2.0
func (obj *GetTransactionResult) UnmarshalWithDecoder(decoder *bin.Decoder) (err error)
type GetVersionResult ¶
type GetVoteAccountsOpts ¶
type GetVoteAccountsOpts struct { Commitment CommitmentType `json:"commitment,omitempty"` // (optional) Only return results for this validator vote address. VotePubkey *solana.PublicKey `json:"votePubkey,omitempty"` // (optional) Do not filter out delinquent validators with no stake. KeepUnstakedDelinquents *bool `json:"keepUnstakedDelinquents,omitempty"` // (optional) Specify the number of slots behind the tip that // a validator must fall to be considered delinquent. // NOTE: For the sake of consistency between ecosystem products, // it is not recommended that this argument be specified. DelinquentSlotDistance *uint64 `json:"delinquentSlotDistance,omitempty"` }
type GetVoteAccountsResult ¶
type GetVoteAccountsResult struct { Current []VoteAccountsResult `json:"current"` Delinquent []VoteAccountsResult `json:"delinquent"` }
type IdentityToSlotsBlocks ¶
type IdentityToSlotsBlocks map[solana.PublicKey][2]int64
A dictionary of validator identities. Value is a two element array containing the number of leader slots and the number of blocks produced.
type InnerInstruction ¶
type InnerInstruction struct { // TODO: <number> == int64 ??? // Index of the transaction instruction from which the inner instruction(s) originated Index uint16 `json:"index"` // Ordered list of inner program instructions that were invoked during a single transaction instruction. Instructions []solana.CompiledInstruction `json:"instructions"` }
type InstructionInfo ¶
type InstructionInfoEnvelope ¶ added in v1.6.0
type InstructionInfoEnvelope struct {
// contains filtered or unexported fields
}
func (InstructionInfoEnvelope) MarshalJSON ¶ added in v1.6.0
func (wrap InstructionInfoEnvelope) MarshalJSON() ([]byte, error)
func (*InstructionInfoEnvelope) UnmarshalJSON ¶ added in v1.6.0
func (wrap *InstructionInfoEnvelope) UnmarshalJSON(data []byte) error
type IsValidBlockhashResult ¶ added in v1.0.3
type IsValidBlockhashResult struct { RPCContext Value bool `json:"value"` // True if the blockhash is still valid. }
type JSONRPCClient ¶ added in v0.3.3
type JSONRPCClient interface { CallForInto(ctx context.Context, out interface{}, method string, params []interface{}) error CallWithCallback(ctx context.Context, method string, params []interface{}, callback func(*http.Request, *http.Response) error) error }
func NewWithLimiter ¶ added in v1.5.0
func NewWithLimiter( rpcEndpoint string, every rate.Limit, b int, ) JSONRPCClient
NewWithLimiter creates a new rate-limitted Solana RPC client. Example: NewWithLimiter(URL, rate.Every(time.Second), 1)
func NewWithRateLimit ¶ added in v0.3.3
func NewWithRateLimit( rpcEndpoint string, rps int, ) JSONRPCClient
NewWithRateLimit creates a new rate-limitted Solana RPC client.
type KeyedAccount ¶
type KeyedAccount struct { Pubkey solana.PublicKey `json:"pubkey"` Account *Account `json:"account"` }
type LargestAccountsFilterType ¶
type LargestAccountsFilterType string
const ( LargestAccountsFilterCirculating LargestAccountsFilterType = "circulating" LargestAccountsFilterNonCirculating LargestAccountsFilterType = "nonCirculating" )
type LargestAccountsResult ¶
type LargestAccountsResult struct { // Address of the account. Address solana.PublicKey `json:"address"` // Number of lamports in the account. Lamports uint64 `json:"lamports"` }
type LatestBlockhashResult ¶ added in v1.3.0
type LatestBlockhashResult struct { Blockhash solana.Hash `json:"blockhash"` LastValidBlockHeight uint64 `json:"lastValidBlockHeight"` // Slot. }
type ParsedInnerInstruction ¶ added in v1.6.0
type ParsedInnerInstruction struct { Index uint64 `json:"index"` Instructions []*ParsedInstruction `json:"instructions"` }
type ParsedInstruction ¶
type ParsedInstruction struct { Program string `json:"program,omitempty"` ProgramId solana.PublicKey `json:"programId,omitempty"` Parsed *InstructionInfoEnvelope `json:"parsed,omitempty"` Data solana.Base58 `json:"data,omitempty"` Accounts []solana.PublicKey `json:"accounts,omitempty"` }
type ParsedMessage ¶ added in v1.6.0
type ParsedMessage struct { AccountKeys []ParsedMessageAccount `json:"accountKeys"` Instructions []*ParsedInstruction `json:"instructions"` RecentBlockHash string `json:"recentBlockhash"` }
type ParsedMessageAccount ¶ added in v1.6.0
type ParsedTransaction ¶
type ParsedTransaction struct { Signatures []solana.Signature `json:"signatures"` Message ParsedMessage `json:"message"` }
type ParsedTransactionMeta ¶ added in v1.6.0
type ParsedTransactionMeta struct { // Error if transaction failed, null if transaction succeeded. // https://github.com/solana-labs/solana/blob/master/sdk/src/transaction.rs#L24 Err interface{} `json:"err"` // Fee this transaction was charged Fee uint64 `json:"fee"` // Array of u64 account balances from before the transaction was processed PreBalances []uint64 `json:"preBalances"` // Array of u64 account balances after the transaction was processed PostBalances []uint64 `json:"postBalances"` // List of inner instructions or omitted if inner instruction recording // was not yet enabled during this transaction InnerInstructions []ParsedInnerInstruction `json:"innerInstructions"` // List of token balances from before the transaction was processed // or omitted if token balance recording was not yet enabled during this transaction PreTokenBalances []TokenBalance `json:"preTokenBalances"` // List of token balances from after the transaction was processed // or omitted if token balance recording was not yet enabled during this transaction PostTokenBalances []TokenBalance `json:"postTokenBalances"` // Array of string log messages or omitted if log message // recording was not yet enabled during this transaction LogMessages []string `json:"logMessages"` }
type RPCContext ¶
type RPCContext struct {
Context Context `json:"context,omitempty"`
}
type RPCFilter ¶
type RPCFilter struct { Memcmp *RPCFilterMemcmp `json:"memcmp,omitempty"` DataSize uint64 `json:"dataSize,omitempty"` }
type RPCFilterMemcmp ¶
type RPCFilterMemcmp struct { Offset uint64 `json:"offset"` Bytes solana.Base58 `json:"bytes"` }
type RewardType ¶
type RewardType string
const ( RewardTypeFee RewardType = "Fee" RewardTypeRent RewardType = "Rent" RewardTypeVoting RewardType = "Voting" RewardTypeStaking RewardType = "Staking" )
type SignatureStatusesResult ¶
type SignatureStatusesResult struct { // The slot the transaction was processed. Slot uint64 `json:"slot"` // Number of blocks since signature confirmation, // null if rooted or finalized by a supermajority of the cluster. Confirmations *uint64 `json:"confirmations"` // Error if transaction failed, null if transaction succeeded. Err interface{} `json:"err"` // The transaction's cluster confirmation status; either processed, confirmed, or finalized. ConfirmationStatus ConfirmationStatusType `json:"confirmationStatus"` // DEPRECATED: Transaction status. Status DeprecatedTransactionMetaStatus `json:"status"` }
type SimulateTransactionAccountsOpts ¶ added in v0.3.2
type SimulateTransactionAccountsOpts struct { // (optional) Encoding for returned Account data, // either "base64" (default), "base64+zstd" or "jsonParsed". // - "jsonParsed" encoding attempts to use program-specific state parsers // to return more human-readable and explicit account state data. // If "jsonParsed" is requested but a parser cannot be found, // the field falls back to binary encoding, detectable when // the data field is type <string>. Encoding solana.EncodingType // An array of accounts to return. Addresses []solana.PublicKey }
type SimulateTransactionOpts ¶ added in v0.3.2
type SimulateTransactionOpts struct { // If true the transaction signatures will be verified // (default: false, conflicts with ReplaceRecentBlockhash) SigVerify bool // Commitment level to simulate the transaction at. // (default: "finalized"). Commitment CommitmentType // If true the transaction recent blockhash will be replaced with the most recent blockhash. // (default: false, conflicts with SigVerify) ReplaceRecentBlockhash bool Accounts *SimulateTransactionAccountsOpts }
type SimulateTransactionResponse ¶
type SimulateTransactionResponse struct { RPCContext Value *SimulateTransactionResult `json:"value"` }
type SimulateTransactionResult ¶ added in v1.5.0
type SimulateTransactionResult struct { // Error if transaction failed, null if transaction succeeded. Err interface{} `json:"err,omitempty"` // Array of log messages the transaction instructions output during execution, // null if simulation failed before the transaction was able to execute // (for example due to an invalid blockhash or signature verification failure) Logs []string `json:"logs,omitempty"` // Array of accounts with the same length as the accounts.addresses array in the request. Accounts []*Account `json:"accounts"` // The number of compute budget units consumed during the processing of this transaction. UnitsConsumed *uint64 `json:"unitsConsumed,omitempty"` }
type SlotRangeRequest ¶
type SlotRangeRequest struct { // First slot to return block production information for (inclusive) FirstSlot uint64 `json:"firstSlot"` // Last slot to return block production information for (inclusive). // If parameter not provided, defaults to the highest slot // // This parameter is optional. LastSlot *uint64 `json:"lastSlot,omitempty"` }
type SlotRangeResponse ¶
type SupplyResult ¶
type SupplyResult 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"` // An array of account addresses of non-circulating accounts. // If `excludeNonCirculatingAccountsList` is enabled, the returned array will be empty. NonCirculatingAccounts []solana.PublicKey `json:"nonCirculatingAccounts"` }
type TokenAccount ¶ added in v1.0.2
type TokenAccount struct { Pubkey solana.PublicKey `json:"pubkey"` Account Account `json:"account"` }
type TokenBalance ¶
type TokenBalance struct { // Index of the account in which the token balance is provided for. AccountIndex uint16 `json:"accountIndex"` // Pubkey of token balance's owner. Owner *solana.PublicKey `json:"owner,omitempty"` // Pubkey of the token's mint. Mint solana.PublicKey `json:"mint"` UiTokenAmount *UiTokenAmount `json:"uiTokenAmount"` }
type TokenLargestAccountsResult ¶
type TokenLargestAccountsResult struct { Address solana.PublicKey `json:"address"` // the address of the token account UiTokenAmount }
type TransactionDetailsType ¶
type TransactionDetailsType string
const ( TransactionDetailsFull TransactionDetailsType = "full" TransactionDetailsSignatures TransactionDetailsType = "signatures" TransactionDetailsNone TransactionDetailsType = "none" )
type TransactionMeta ¶
type TransactionMeta struct { // Error if transaction failed, null if transaction succeeded. // https://github.com/solana-labs/solana/blob/master/sdk/src/transaction.rs#L24 Err interface{} `json:"err"` // Fee this transaction was charged Fee uint64 `json:"fee"` // Array of u64 account balances from before the transaction was processed PreBalances []uint64 `json:"preBalances"` // Array of u64 account balances after the transaction was processed PostBalances []uint64 `json:"postBalances"` // List of inner instructions or omitted if inner instruction recording // was not yet enabled during this transaction InnerInstructions []InnerInstruction `json:"innerInstructions"` // List of token balances from before the transaction was processed // or omitted if token balance recording was not yet enabled during this transaction PreTokenBalances []TokenBalance `json:"preTokenBalances"` // List of token balances from after the transaction was processed // or omitted if token balance recording was not yet enabled during this transaction PostTokenBalances []TokenBalance `json:"postTokenBalances"` // Array of string log messages or omitted if log message // recording was not yet enabled during this transaction LogMessages []string `json:"logMessages"` // DEPRECATED: Transaction status. Status DeprecatedTransactionMetaStatus `json:"status"` Rewards []BlockReward `json:"rewards"` }
type TransactionOpts ¶ added in v1.5.0
type TransactionOpts struct { Encoding solana.EncodingType `json:"encoding,omitempty"` SkipPreflight bool `json:"skipPreflight,omitempty"` PreflightCommitment CommitmentType `json:"preflightCommitment,omitempty"` MaxRetries *uint `json:"maxRetries"` MinContextSlot *uint64 `json:"minContextSlot"` }
func (*TransactionOpts) ToMap ¶ added in v1.5.0
func (opts *TransactionOpts) ToMap() M
type TransactionParsed ¶
type TransactionParsed struct { Meta *TransactionMeta `json:"meta,omitempty"` Transaction *CompiledTransaction `json:"transaction"` }
type TransactionResultEnvelope ¶ added in v0.3.5
type TransactionResultEnvelope struct {
// contains filtered or unexported fields
}
TransactionResultEnvelope will contain a *CompiledTransaction if the requested encoding is `solana.EncodingJSON` (which is also the default when the encoding is not specified), or a `solana.Data` in case of EncodingBase58, EncodingBase64.
func (*TransactionResultEnvelope) GetBinary ¶ added in v0.3.5
func (dt *TransactionResultEnvelope) GetBinary() []byte
GetBinary returns the decoded bytes if the encoding is "base58", "base64".
func (*TransactionResultEnvelope) GetData ¶ added in v1.2.0
func (dt *TransactionResultEnvelope) GetData() solana.Data
func (*TransactionResultEnvelope) GetParsedTransaction ¶ added in v0.3.5
func (dt *TransactionResultEnvelope) GetParsedTransaction() *CompiledTransaction
GetRawJSON returns a *CompiledTransaction when the data encoding is EncodingJSON.
func (TransactionResultEnvelope) MarshalJSON ¶ added in v0.3.5
func (wrap TransactionResultEnvelope) MarshalJSON() ([]byte, error)
func (TransactionResultEnvelope) MarshalWithEncoder ¶ added in v1.2.0
func (obj TransactionResultEnvelope) MarshalWithEncoder(encoder *bin.Encoder) (err error)
func (*TransactionResultEnvelope) UnmarshalJSON ¶ added in v0.3.5
func (wrap *TransactionResultEnvelope) UnmarshalJSON(data []byte) error
func (*TransactionResultEnvelope) UnmarshalWithDecoder ¶ added in v1.2.0
func (obj *TransactionResultEnvelope) UnmarshalWithDecoder(decoder *bin.Decoder) (err error)
type TransactionSignature ¶
type TransactionSignature struct { // Error if transaction failed, nil if transaction succeeded. Err interface{} `json:"err"` // Memo associated with the transaction, nil if no memo is present. Memo *string `json:"memo"` // Transaction signature. Signature solana.Signature `json:"signature"` // The slot that contains the block with the transaction. Slot uint64 `json:"slot,omitempty"` // Estimated production time, as Unix timestamp (seconds since the Unix epoch) // of when transaction was processed. Nil if not available. BlockTime *solana.UnixTimeSeconds `json:"blockTime,omitempty"` ConfirmationStatus ConfirmationStatusType `json:"confirmationStatus,omitempty"` }
type TransactionVersion ¶ added in v1.7.0
type TransactionVersion int
const (
LegacyTransactionVersion TransactionVersion = -1
)
func (TransactionVersion) MarshalJSON ¶ added in v1.7.0
func (a TransactionVersion) MarshalJSON() ([]byte, error)
func (*TransactionVersion) UnmarshalJSON ¶ added in v1.7.0
func (a *TransactionVersion) UnmarshalJSON(b []byte) error
type TransactionWithMeta ¶
type TransactionWithMeta struct { Transaction *DataBytesOrJSON `json:"transaction"` // Transaction status metadata object Meta *TransactionMeta `json:"meta,omitempty"` Version TransactionVersion `json:"version"` }
func (TransactionWithMeta) GetTransaction ¶ added in v1.3.0
func (twm TransactionWithMeta) GetTransaction() (*solana.Transaction, error)
func (TransactionWithMeta) MustGetTransaction ¶ added in v1.3.0
func (twm TransactionWithMeta) MustGetTransaction() *solana.Transaction
type UiTokenAmount ¶
type UiTokenAmount struct { // Raw amount of tokens as a string, ignoring decimals. Amount string `json:"amount"` // TODO: <number> == int64 ??? // Number of decimals configured for token's mint. Decimals uint8 `json:"decimals"` // DEPRECATED: Token amount as a float, accounting for decimals. UiAmount *float64 `json:"uiAmount"` // Token amount as a string, accounting for decimals. UiAmountString string `json:"uiAmountString"` }
type VoteAccountsResult ¶
type VoteAccountsResult struct { // Vote account address. VotePubkey solana.PublicKey `json:"votePubkey,omitempty"` // Validator identity. NodePubkey solana.PublicKey `json:"nodePubkey,omitempty"` // The stake, in lamports, delegated to this vote account and active in this epoch. ActivatedStake uint64 `json:"activatedStake,omitempty"` // Whether the vote account is staked for this epoch. EpochVoteAccount bool `json:"epochVoteAccount,omitempty"` // Percentage (0-100) of rewards payout owed to the vote account. Commission uint8 `json:"commission,omitempty"` // Most recent slot voted on by this vote account. LastVote uint64 `json:"lastVote,omitempty"` RootSlot uint64 `json:"rootSlot,omitempty"` // // History of how many credits earned by the end of each epoch, // as an array of arrays containing: [epoch, credits, previousCredits] EpochCredits [][]int64 `json:"epochCredits,omitempty"` }
Source Files ¶
- client-with-ratelimit.go
- client-with-ratelimit2.go
- client.go
- deprecated.go
- endpoints.go
- errors.go
- getAccountInfo.go
- getBalance.go
- getBlock.go
- getBlockCommitment.go
- getBlockHeight.go
- getBlockProduction.go
- getBlockTime.go
- getBlocks.go
- getBlocksWithLimit.go
- getClusterNodes.go
- getEpochInfo.go
- getEpochSchedule.go
- getFeeCalculatorForBlockhash.go
- getFeeForMessage.go
- getFeeRateGovernor.go
- getFees.go
- getFirstAvailableBlock.go
- getGenesisHash.go
- getHealth.go
- getHighestSnapshotSlot.go
- getIdentity.go
- getInflationGovernor.go
- getInflationRate.go
- getInflationReward.go
- getLargestAccounts.go
- getLatestBlockhash.go
- getLeaderSchedule.go
- getMaxRetransmitSlot.go
- getMaxShredInsertSlot.go
- getMinimumBalanceForRentExemption.go
- getMultipleAccounts.go
- getParsedTransaction.go
- getProgramAccounts.go
- getRecentBlockhash.go
- getRecentPerformanceSamples.go
- getSignatureStatuses.go
- getSignaturesForAddress.go
- getSlot.go
- getSlotLeader.go
- getSlotLeaders.go
- getSnapshotSlot.go
- getStakeActivation.go
- getSupply.go
- getTokenAccountBalance.go
- getTokenAccountsByDelegate.go
- getTokenAccountsByOwner.go
- getTokenLargestAccounts.go
- getTokenSupply.go
- getTransaction.go
- getTransactionCount.go
- getVersion.go
- getVoteAccounts.go
- isBlockhashValid.go
- json.go
- logging.go
- minimumLedgerSlot.go
- requestAirdrop.go
- sendEncodedTransaction.go
- sendRawTransaction.go
- sendTransaction.go
- simulateTransaction.go
- transaction_version.go
- types.go
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
Package jsonrpc provides a JSON-RPC 2.0 client that sends JSON-RPC requests and receives JSON-RPC responses using HTTP.
|
Package jsonrpc provides a JSON-RPC 2.0 client that sends JSON-RPC requests and receives JSON-RPC responses using HTTP. |