rpc

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: Apache-2.0 Imports: 13 Imported by: 1,106

Documentation

Overview

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 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 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 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 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 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 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 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 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

View Source
const HealthOk = "ok"

Variables

View Source
var ErrNotConfirmed = errors.New("not confirmed")
View Source
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 bin.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 bin.Uint64 `json:"rentEpoch"`
}

type AccountKey

type AccountKey struct {
	PublicKey solana.PublicKey `json:"pubkey"`
	Signer    bool             `json:"signer"`
	Writable  bool             `json:"writable"`
}

type ActivationStateType

type ActivationStateType string
const (
	ActivationStateActive       ActivationStateType = "active"
	ActivationStateInactive     ActivationStateType = "inactive"
	ActivationStateActivating   ActivationStateType = "activating"
	ActivationStateDeactivating ActivationStateType = "deactivating"
)

type BlockProductionResult

type BlockProductionResult 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 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 bin.Int64 `json:"lamports"`

	// Account balance in lamports after the reward was applied.
	PostBalance bin.Uint64 `json:"postBalance"`

	// Type of reward: "Fee", "Rent", "Voting", "Staking".
	RewardType RewardType `json:"rewardType"`
}

type BlockhashResult

type BlockhashResult struct {
	Blockhash     solana.Hash   `json:"blockhash"`
	FeeCalculator FeeCalculator `json:"feeCalculator"`
}

type BlocksResult

type BlocksResult []bin.Uint64

type CallForClientInterface

type CallForClientInterface interface {
	CallFor(out interface{}, method string, params ...interface{}) error
}

type Client

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

func NewClient

func NewClient(rpcURL string) *Client

func NewClientWithOpts

func NewClientWithOpts(rpcURL string, opts *jsonrpc.RPCClientOpts) *Client

func NewWithCustomRPCClient

func NewWithCustomRPCClient(rpcClient CallForClientInterface) *Client

func (*Client) GetAccountDataIn

func (cl *Client) GetAccountDataIn(ctx context.Context, account solana.PublicKey, inVar interface{}) (err error)

GetAccountDataIn 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

func (cl *Client) GetBlock(
	ctx context.Context,
	slot uint64,
) (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) 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 *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.

NEW: This method is only available in solana-core v1.7 or newer. Please use `getConfirmedBlocks` for solana-core v1.6.

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.

NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlocksWithLimit for solana-core v1.6

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) 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.

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

func (cl *Client) GetFirstAvailableBlock(ctx context.Context) (out uint64, err error)

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

func (*Client) GetGenesisHash

func (cl *Client) GetGenesisHash(ctx context.Context) (out solana.Hash, err error)

GetGenesisHash returns the genesis hash.

func (*Client) GetHealth

func (cl *Client) GetHealth(ctx context.Context) (out string, err error)

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) 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 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) 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

func (cl *Client) GetMaxRetransmitSlot(ctx context.Context) (out uint64, err error)

GetMaxRetransmitSlot returns the max slot seen from retransmit stage.

func (*Client) GetMaxShredInsertSlot

func (cl *Client) GetMaxShredInsertSlot(ctx context.Context) (out uint64, err error)

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 int, 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 *GetAccountInfoOpts,
) (out *GetMultipleAccountsResult, err error)

GetMultipleAccountsWithOpts returns the account information for a list of Pubkeys.

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 *int) (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 current slot the node is processing.

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

func (cl *Client) GetSnapshotSlot(ctx context.Context) (out uint64, err error)

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) 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) MinimumLedgerSlot

func (cl *Client) MinimumLedgerSlot(ctx context.Context) (out uint64, err error)

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) RequestAirdrop

func (cl *Client) RequestAirdrop(
	ctx context.Context,
	account solana.PublicKey,
	lamport uint64,
	commitment CommitmentType,
) (signature solana.Signature, err error)

RequestAirdrop requests an airdrop of lamports to a publicKey. Returns transaction signature of airdrop.

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,
	skipPreflight bool,
	preflightCommitment CommitmentType,
) (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) SetHeader

func (c *Client) SetHeader(k, v string)

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"
	CommitmentRecent       CommitmentType = "recent"
	CommitmentRoot         CommitmentType = "root"
	CommitmentSingle       CommitmentType = "single"
	CommitmentSingleGossip CommitmentType = "singleGossip"
)

type ConfirmationStatusType

type ConfirmationStatusType string
const (
	ConfirmationStatusProcessed ConfirmationStatusType = "processed"
	ConfirmationStatusConfirmed ConfirmationStatusType = "confirmed"
	ConfirmationStatusFinalized ConfirmationStatusType = "finalized"
)

type Context

type Context struct {
	Slot bin.Uint64 `json:"slot"`
}

type DataBytesOrJSON

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

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() json.RawMessage

GetRawJSON returns a json.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 DataSlice

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

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 bin.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 bin.Uint64 `json:"maxLamportsPerSignature"`

	// Smallest value lamportsPerSignature can attain for the next slot.
	MinLamportsPerSignature bin.Uint64 `json:"minLamportsPerSignature"`

	// Desired fee rate for the cluster.
	TargetLamportsPerSignature bin.Uint64 `json:"targetLamportsPerSignature"`

	// Desired signature rate for the cluster.
	TargetSignaturesPerSlot bin.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 bin.Uint64 `json:"lastValidSlot"`

	// Last block height at which a blockhash will be valid.
	LastValidBlockHeight bin.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
}

type GetAccountInfoResult

type GetAccountInfoResult struct {
	RPCContext
	Value *Account `json:"value"`
}

type GetBalanceResult

type GetBalanceResult struct {
	RPCContext
	Value bin.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 []bin.Uint64 `json:"commitment"`

	// TODO: is it bin.Uint64 ???
	// total active stake, in lamports, of the current epoch
	TotalStake bin.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
}

type GetBlockProductionOpts

type GetBlockProductionOpts struct {
	//
	// This parameter is optional.
	Commitment CommitmentType

	// Slot range to return block production for.
	// If parameter not provided, defaults to current epoch.
	//
	// This parameter is optional.
	Range *SlotRangeRequest
}

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 bin.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 *bin.Int64 `json:"blockTime"`

	// The number of blocks beneath this block.
	BlockHeight *bin.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"`

	// TPU network address for the node.
	TPU *string `json:"tpu"`

	// JSON RPC network address for the node, or empty if the JSON RPC service is not enabled.
	RPC *string `json:"rpc"`

	// The software version of the node, or empty if the version information is not available.
	Version *string `json:"version"`

	// TODO: what type is this?
	// The unique identifier of the node's feature set.
	FeatureSet bin.Int64 `json:"featureSet"`

	// The shred version the node has been configured to use.
	ShredVersion bin.Int64 `json:"shredVersion"`
}

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   bin.Uint64            `json:"parentSlot"`
	Transactions []TransactionWithMeta `json:"transactions"`
	Signatures   []solana.Signature    `json:"signatures"`
	Rewards      []BlockReward         `json:"rewards"`
	BlockTime    *bin.Uint64           `json:"blockTime,omitempty"`
}

type GetConfirmedSignaturesForAddress2Opts

type GetConfirmedSignaturesForAddress2Opts struct {
	Limit  uint64 `json:"limit,omitempty"`
	Before string `json:"before,omitempty"`
	Until  string `json:"until,omitempty"`
}

type GetConfirmedSignaturesForAddress2Result

type GetConfirmedSignaturesForAddress2Result []*TransactionSignature

type GetEpochInfoResult

type GetEpochInfoResult struct {
	// The current slot.
	AbsoluteSlot bin.Uint64 `json:"absoluteSlot"`

	// The current block height.
	BlockHeight bin.Uint64 `json:"blockHeight"`

	// The current epoch.
	Epoch bin.Uint64 `json:"epoch"`

	// The current slot relative to the start of the current epoch.
	SlotIndex bin.Uint64 `json:"slotIndex"`

	// The number of slots in this epoch.
	SlotsInEpoch bin.Uint64 `json:"slotsInEpoch"`

	TransactionCount bin.Uint64 `json:"transactionCount"`
}

type GetEpochScheduleResult

type GetEpochScheduleResult struct {
	// The maximum number of slots in each epoch.
	SlotsPerEpoch bin.Uint64 `json:"slotsPerEpoch"`

	// The number of slots before beginning of an epoch to calculate a leader schedule for that epoch.
	LeaderScheduleSlotOffset bin.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 bin.Uint64 `json:"firstNormalEpoch"`

	// MINIMUM_SLOTS_PER_EPOCH * (2.pow(firstNormalEpoch) - 1)
	FirstNormalSlot bin.Uint64 `json:"firstNormalSlot"`
}

type GetFeeCalculatorForBlockhashResult

type GetFeeCalculatorForBlockhashResult struct {
	RPCContext

	// Value will be nil if the query blockhash has expired.
	Value *FeeCalculatorForBlockhashResult `json:"value"`
}

type GetFeeRateGovernorResult

type GetFeeRateGovernorResult struct {
	RPCContext
	Value FeeRateGovernorResult `json:"value"`
}

type GetFeesResult

type GetFeesResult struct {
	RPCContext
	Value *FeesResult `json:"value"`
}

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 bin.JSONFloat64 `json:"initial"`

	// Terminal inflation percentage.
	Terminal bin.JSONFloat64 `json:"terminal"`

	// Rate per year at which inflation is lowered. Rate reduction is derived using the target slot time in genesis config.
	Taper bin.JSONFloat64 `json:"taper"`

	// Percentage of total inflation allocated to the foundation.
	Foundation bin.JSONFloat64 `json:"foundation"`

	// Duration of foundation pool inflation in years.
	FoundationTerm bin.JSONFloat64 `json:"foundationTerm"`
}

type GetInflationRateResult

type GetInflationRateResult struct {
	// Total inflation.
	Total bin.JSONFloat64 `json:"total"`

	// Inflation allocated to validators.
	Validator bin.JSONFloat64 `json:"validator"`

	// Inflation allocated to the foundation.
	Foundation bin.JSONFloat64 `json:"foundation"`

	// Epoch for which these values are valid.
	Epoch bin.JSONFloat64 `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 bin.Uint64 `json:"epoch"`

	// The slot in which the rewards are effective.
	EffectiveSlot bin.Uint64 `json:"effectiveSlot"`

	// Reward amount in lamports.
	Amount bin.Uint64 `json:"amount"`

	// Post balance of the account in lamports.
	PostBalance bin.Uint64 `json:"postBalance"`
}

type GetLargestAccountsResult

type GetLargestAccountsResult struct {
	RPCContext
	Value []LargestAccountsResult `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[string][]bin.Uint64

The result field will be a dictionary of validator identities, as base-58 encoded strings, and their corresponding leader slot indices as values (indices are relative to the first slot in the requested epoch)

type GetMaxShredInsertSlotResult

type GetMaxShredInsertSlotResult struct{}

type GetMultipleAccountsResult

type GetMultipleAccountsResult struct {
	RPCContext
	Value []*Account `json:"value"`
}

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 bin.Uint64 `json:"slot"`

	// Number of transactions in sample.
	NumTransactions bin.Uint64 `json:"numTransactions"`

	// Number of slots in sample.
	NumSlots bin.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"`
}

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 bin.Uint64 `json:"active"`

	// Stake inactive during the epoch.
	Inactive bin.Uint64 `json:"inactive"`
}

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 []*Account `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"`
}

type GetTransactionResult

type GetTransactionResult struct {
	// The slot this transaction was processed in.
	Slot bin.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 *UnixTimeSeconds `json:"blockTime"`

	Transaction *ParsedTransaction `json:"transaction"`
	Meta        *TransactionMeta   `json:"meta,omitempty"`
}

type GetVersionResult

type GetVersionResult struct {
	// Software version of solana-core.
	SolanaCore string `json:"solana-core"`

	// Unique identifier of the current software's feature set.
	FeatureSet bin.Int64 `json:"feature-set"`
}

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"`
}

type GetVoteAccountsResult

type GetVoteAccountsResult struct {
	Current    []VoteAccountsResult `json:"current"`
	Delinquent []VoteAccountsResult `json:"delinquent"`
}

type IdentityToSlotsBlocks

type IdentityToSlotsBlocks map[string][2]int64

type InnerInstruction

type InnerInstruction struct {
	// TODO: <number> == bin.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 InstructionInfo struct {
	Info            map[string]interface{} `json:"info"`
	InstructionType string                 `json:"type"`
}

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 bin.Uint64 `json:"lamports"`
}

type M

type M map[string]interface{}

type Message

type Message struct {
	AccountKeys     []solana.PublicKey   `json:"accountKeys"`
	RecentBlockhash solana.Hash          `json:"recentBlockhash"`
	Instructions    []ParsedInstruction  `json:"instructions"`
	Header          solana.MessageHeader `json:"header"`
}

type ParsedInstruction

type ParsedInstruction struct {
	Accounts       []bin.Int64      `json:"accounts,omitempty"`
	Data           solana.Base58    `json:"data,omitempty"`
	Parsed         *InstructionInfo `json:"parsed,omitempty"`
	Program        string           `json:"program,omitempty"`
	ProgramIDIndex uint16           `json:"programIdIndex"`
}

func (*ParsedInstruction) IsParsed

func (p *ParsedInstruction) IsParsed() bool

type ParsedTransaction

type ParsedTransaction struct {
	Signatures []solana.Signature `json:"signatures"`
	Message    Message            `json:"message"`
}

Parsed Transaction

type RPCContext

type RPCContext struct {
	Context Context `json:"context,omitempty"`
}

type RPCFilter

type RPCFilter struct {
	Memcmp   *RPCFilterMemcmp `json:"memcmp,omitempty"`
	DataSize bin.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 bin.Uint64 `json:"slot"`

	// Number of blocks since signature confirmation, null if rooted, as well as finalized by a supermajority of the cluster.
	Confirmations *bin.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 {
	// 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"`
}

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"`

	// Only return results for this validator identity.
	//
	// This parameter is optional.
	Identity *solana.PublicKey `json:"identity,omitempty"`
}

type SlotRangeResponse

type SlotRangeResponse struct {
	// First slot of the block production information (inclusive)
	FirstSlot bin.Uint64 `json:"firstSlot"`

	// Last slot of block production information (inclusive)
	LastSlot bin.Uint64 `json:"lastSlot"`
}

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.
	NonCirculatingAccounts []solana.PublicKey `json:"nonCirculatingAccounts"`
}

type TokenBalance

type TokenBalance struct {
	// Index of the account in which the token balance is provided for.
	AccountIndex uint16 `json:"accountIndex"`

	// Pubkey of the token's mint.
	Mint          solana.PublicKey `json:"mint"`
	UiTokenAmount *UiTokenAmount   `json:"uiTokenAmount"`
}

type TokenLargestAccountsResult

type TokenLargestAccountsResult struct {
	Address string `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 bin.Uint64 `json:"fee"`

	// Array of u64 account balances from before the transaction was processed
	PreBalances []bin.Uint64 `json:"preBalances"`

	// Array of u64 account balances after the transaction was processed
	PostBalances []bin.Uint64 `json:"postBalances"`

	// List of inner instructions or omitted if inner instruction recording
	// was not yet enabled during this transaction
	InnerInstructions []InnerInstruction `json:"innerInstructions,omitempty"`

	// 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,omitempty"`
}

type TransactionParsed

type TransactionParsed struct {
	Meta        *TransactionMeta   `json:"meta,omitempty"`
	Transaction *ParsedTransaction `json:"transaction"`
}

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 bin.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 *UnixTimeSeconds `json:"blockTime,omitempty"`

	ConfirmationStatus ConfirmationStatusType `json:"confirmationStatus,omitempty"`
}

type TransactionWithMeta

type TransactionWithMeta struct {
	// Transaction status metadata object
	Meta        *TransactionMeta    `json:"meta,omitempty"`
	Transaction *solana.Transaction `json:"transaction"`
}

type UiTokenAmount

type UiTokenAmount struct {
	// Raw amount of tokens as a string, ignoring decimals.
	Amount string `json:"amount"`

	// TODO: <number> == bin.Int64 ???
	// Number of decimals configured for token's mint.
	Decimals uint8 `json:"decimals"`

	// DEPRECATED: Token amount as a float, accounting for decimals.
	UiAmount *bin.JSONFloat64 `json:"uiAmount"`

	// Token amount as a string, accounting for decimals.
	UiAmountString string `json:"uiAmountString"`
}

type UnixTimeSeconds added in v0.3.2

type UnixTimeSeconds int64

Estimated production time, as Unix timestamp (seconds since the Unix epoch)

func (UnixTimeSeconds) Time added in v0.3.2

func (res UnixTimeSeconds) Time() time.Time

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"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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