rpc

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 12 Imported by: 1,102

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 (
	CommitmentMax          = CommitmentType("max")
	CommitmentRecent       = CommitmentType("recent")
	CommitmentRoot         = CommitmentType("root")
	CommitmentSingle       = CommitmentType("single")
	CommitmentSingleGossip = CommitmentType("singleGossip")
)
View Source
const HealthOk = "ok"

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type Account

type Account struct {
	Lamports   bin.Uint64       `json:"lamports"`   // number of lamports assigned to this account
	Owner      solana.PublicKey `json:"owner"`      // base-58 encoded Pubkey of the program this account has been assigned to
	Data       *DataBytesOrJSON `json:"data"`       // data associated with the account, either as encoded binary data or JSON format {<program>: <state>}, depending on encoding parameter
	Executable bool             `json:"executable"` // boolean indicating if the account contains a program (and is strictly read-only)
	RentEpoch  bin.Uint64       `json:"rentEpoch"`  // the epoch at which this account will next owe rent
}

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 {
	ByIdentity IdentityToSlotsBlocks `json:"byIdentity"` //  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.
	Range      SlotRangeResponse     `json:"range"`
}

type BlockReward

type BlockReward struct {
	Pubkey      solana.PublicKey `json:"pubkey"`      // The public key, as base-58 encoded string, of the account that received the reward
	Lamports    bin.Int64        `json:"lamports"`    // number of reward lamports credited or debited by the account, as a i64
	PostBalance bin.Uint64       `json:"postBalance"` // account balance in lamports after the reward was applied
	RewardType  RewardType       `json:"rewardType"`  // type of reward: "fee", "rent", "voting", "staking"
}

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)

GetAccountInfo populates the provided `inVar` parameter with all information 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 limit the returned account data with the offset and length parameters. You can specify the encoding of the returned data with the encoding parameter.

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 *GetBlockTimeResult, 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.

NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlocks for solana-core v1.6. 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. NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlocksWithLimit for solana-core v1.6 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,
	encoding string,
) (out *GetConfirmedBlockResult, err error)

DEPRECATED: 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) GetConfirmedSignaturesForAddress2

func (cl *Client) GetConfirmedSignaturesForAddress2(ctx context.Context, address solana.PublicKey, opts *GetConfirmedSignaturesForAddress2Opts) (out GetConfirmedSignaturesForAddress2Result, err error)

DEPRECATED: GetConfirmedSignaturesForAddress2 returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block.

func (*Client) GetConfirmedTransaction

func (cl *Client) GetConfirmedTransaction(
	ctx context.Context,
	signature solana.Signature,
) (out *TransactionWithMeta, err error)

DEPRECATED: 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.

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 int,
	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,
	encoding solana.EncodingType,
	commitment CommitmentType,
	offset *uint,
	length *uint,
) (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 bin.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 bin.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.

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,
	sigVerify bool,
	commitment CommitmentType,
	replaceRecentBlockhash bool,
) (out *SimulateTransactionResponse, err error)

SimulateTransaction simulates sending a transaction.

type CommitmentType

type CommitmentType string

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 {
	FeeCalculator FeeCalculator `json:"feeCalculator"`
}

type FeeRateGovernor

type FeeRateGovernor struct {
	BurnPercent                uint8      `json:"burnPercent"`                // Percentage of fees collected to be destroyed
	MaxLamportsPerSignature    bin.Uint64 `json:"maxLamportsPerSignature"`    // Largest value lamportsPerSignature can attain for the next slot
	MinLamportsPerSignature    bin.Uint64 `json:"minLamportsPerSignature"`    // Smallest value lamportsPerSignature can attain for the next slot
	TargetLamportsPerSignature bin.Uint64 `json:"targetLamportsPerSignature"` // Desired fee rate for the cluster
	TargetSignaturesPerSlot    bin.Uint64 `json:"targetSignaturesPerSlot"`    // Desired signature rate for the cluster
}

type FeeRateGovernorResult

type FeeRateGovernorResult struct {
	FeeRateGovernor FeeRateGovernor `json:"feeRateGovernor"`
}

type FeesResult

type FeesResult struct {
	Blockhash            solana.Hash   `json:"blockhash"`            // a Hash as base-58 encoded string
	FeeCalculator        FeeCalculator `json:"feeCalculator"`        // FeeCalculator object, the fee schedule for this block hash
	LastValidSlot        bin.Uint64    `json:"lastValidSlot"`        // DEPRECATED - this value is inaccurate and should not be relied upon
	LastValidBlockHeight bin.Uint64    `json:"lastValidBlockHeight"` // last block height at which a blockhash will be valid
}

type GetAccountInfoOpts

type GetAccountInfoOpts struct {
	Encoding   solana.EncodingType
	Commitment CommitmentType
	Offset     *uint64
	Length     *uint64
}

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 ???
	TotalStake bin.Uint64 `json:"totalStake"` // total active stake, in lamports, of the current epoch
}

type GetBlockOpts

type GetBlockOpts struct {
	Encoding           solana.EncodingType
	TransactionDetails TransactionDetailsType // level of transaction detail to return. If parameter not provided, the default detail level is "full".
	Rewards            *bool                  // whether to populate the rewards array. If parameter not provided, the default includes rewards.
	Commitment         CommitmentType         // "processed" is not supported. If parameter not provided, the default is "finalized".
}

type GetBlockProductionOpts

type GetBlockProductionOpts struct {
	Commitment CommitmentType
	Range      *SlotRangeRequest // Slot range to return block production for. If parameter not provided, defaults to current epoch.
}

type GetBlockProductionResult

type GetBlockProductionResult struct {
	RPCContext
	Value BlockProductionResult `json:"value"`
}

type GetBlockResult

type GetBlockResult struct {
	// The blockhash of this block, as base-58 encoded string.
	Blockhash solana.Hash `json:"blockhash"`

	// The blockhash of this block's parent, as base-58 encoded string;
	// if the parent block is not available due to ledger cleanup,
	// this field will return "11111111111111111111111111111111".
	PreviousBlockhash solana.Hash `json:"previousBlockhash"` // could be zeroes if ledger was clean-up and this is unavailable

	// 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 strings, 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). null if not available
	BlockTime *bin.Int64 `json:"blockTime"`
	// the number of blocks beneath this block
	BlockHeight *bin.Uint64 `json:"blockHeight"`
}

type GetBlockTimeResult

type GetBlockTimeResult int64

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

type GetClusterNodesResult

type GetClusterNodesResult struct {
	Pubkey solana.PublicKey `json:"pubkey"` // Node public key, as base-58 encoded string
	Gossip *string          `json:"gossip"` // Gossip network address for the node
	TPU    *string          `json:"tpu"`    // TPU network address for the node

	// TODO: "" or nil ?
	RPC          *string   `json:"rpc"`          // JSON RPC network address for the node, or empty if the JSON RPC service is not enabled
	Version      *string   `json:"version"`      // The software version of the node, or empty if the version information is not available
	FeatureSet   bin.Int64 `json:"featureSet"`   // The unique identifier of the node's feature set
	ShredVersion bin.Int64 `json:"shredVersion"` // The shred version the node has been configured to use
}

type GetConfirmedBlockResult

type GetConfirmedBlockResult struct {
	Blockhash         solana.Hash           `json:"blockhash"`
	PreviousBlockhash solana.Hash           `json:"previousBlockhash"` // could be zeroes if ledger was clean-up and this is unavailable
	ParentSlot        bin.Uint64            `json:"parentSlot"`
	Transactions      []TransactionWithMeta `json:"transactions"`
	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 {
	AbsoluteSlot     bin.Uint64 `json:"absoluteSlot"` // the current slot
	BlockHeight      bin.Uint64 `json:"blockHeight"`  // the current block height
	Epoch            bin.Uint64 `json:"epoch"`        // the current epoch
	SlotIndex        bin.Uint64 `json:"slotIndex"`    // the current slot relative to the start of the current epoch
	SlotsInEpoch     bin.Uint64 `json:"slotsInEpoch"` // the number of slots in this epoch
	TransactionCount bin.Uint64 `json:"transactionCount"`
}

type GetEpochScheduleResult

type GetEpochScheduleResult struct {
	SlotsPerEpoch            bin.Uint64 `json:"slotsPerEpoch"`            // the maximum number of slots in each epoch
	LeaderScheduleSlotOffset bin.Uint64 `json:"leaderScheduleSlotOffset"` // the number of slots before beginning of an epoch to calculate a leader schedule for that epoch
	Warmup                   bool       `json:"warmup"`                   // whether epochs start short and grow
	FirstNormalEpoch         bin.Uint64 `json:"firstNormalEpoch"`         // first normal-length epoch, log2(slotsPerEpoch) - log2(MINIMUM_SLOTS_PER_EPOCH)
	FirstNormalSlot          bin.Uint64 `json:"firstNormalSlot"`          // MINIMUM_SLOTS_PER_EPOCH * (2.pow(firstNormalEpoch) - 1)
}

type GetFeeCalculatorForBlockhashResult

type GetFeeCalculatorForBlockhashResult struct {
	RPCContext
	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 GetGenesisHashResult

type GetGenesisHashResult struct{}

type GetIdentityResult

type GetIdentityResult struct {
	Identity solana.PublicKey `json:"identity"` // the identity pubkey of the current node
}

type GetInflationGovernorResult

type GetInflationGovernorResult struct {
	Initial        bin.JSONFloat64 `json:"initial"`        // the initial inflation percentage from time 0
	Terminal       bin.JSONFloat64 `json:"terminal"`       // terminal inflation percentage
	Taper          bin.JSONFloat64 `json:"taper"`          // rate per year at which inflation is lowered. Rate reduction is derived using the target slot time in genesis config
	Foundation     bin.JSONFloat64 `json:"foundation"`     // percentage of total inflation allocated to the foundation
	FoundationTerm bin.JSONFloat64 `json:"foundationTerm"` // duration of foundation pool inflation in years
}

type GetInflationRateResult

type GetInflationRateResult struct {
	Total      bin.JSONFloat64 `json:"total"`      // total inflation
	Validator  bin.JSONFloat64 `json:"validator"`  // inflation allocated to validators
	Foundation bin.JSONFloat64 `json:"foundation"` // inflation allocated to the foundation
	Epoch      bin.JSONFloat64 `json:"epoch"`      // epoch for which these values are valid
}

type GetInflationRewardOpts

type GetInflationRewardOpts struct {
	Commitment CommitmentType
	Epoch      *uint64
}

type GetInflationRewardResult

type GetInflationRewardResult struct {
	Epoch         bin.Uint64 `json:"epoch"`         // epoch for which reward occured
	EffectiveSlot bin.Uint64 `json:"effectiveSlot"` // the slot in which the rewards are effective
	Amount        bin.Uint64 `json:"amount"`        // reward amount in lamports
	PostBalance   bin.Uint64 `json:"postBalance"`   // post balance of the account in lamports
}

type GetLargestAccountsResult

type GetLargestAccountsResult struct {
	RPCContext
	Value []LargestAccountsResult `json:"value"`
}

type GetLeaderScheduleOpts

type GetLeaderScheduleOpts struct {
	Epoch      *uint64 // Fetch the leader schedule for the epoch that corresponds to the provided slot. If unspecified, the leader schedule for the current epoch is fetched
	Commitment CommitmentType
	// TODO: is identity a pubkey?
	Identity string // Only return results for this validator identity (base-58 encoded)
}

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

	DataSlice *DataSlice `json:"dataSlice,omitempty"` // limit the returned account data

	// Filter on accounts, implicit AND between filters
	Filters []RPCFilter `json:"filters,omitempty"` // filter results using various filter objects; account must meet all filter criteria to be included in results

}

type GetProgramAccountsResult

type GetProgramAccountsResult []*KeyedAccount

type GetRecentBlockhashResult

type GetRecentBlockhashResult struct {
	RPCContext
	Value BlockhashResult `json:"value"`
}

type GetRecentPerformanceSamplesResult

type GetRecentPerformanceSamplesResult struct {
	Slot             bin.Uint64 `json:"slot"`             // Slot in which sample was taken at
	NumTransactions  bin.Uint64 `json:"numTransactions"`  // Number of transactions in sample
	NumSlots         bin.Uint64 `json:"numSlots"`         // Number of slots in sample
	SamplePeriodSecs uint16     `json:"samplePeriodSecs"` // Number of seconds in a sample window
}

type GetSignatureStatusesResult

type GetSignatureStatusesResult struct {
	RPCContext
	Value []*SignatureStatusesResult `json:"value"`
}

type GetSignaturesForAddressOpts

type GetSignaturesForAddressOpts struct {
	Limit      *int             `json:"limit,omitempty"`      // (optional) maximum transaction signatures to return (between 1 and 1,000, default: 1,000).
	Before     solana.Signature `json:"before,omitempty"`     // (optional) start searching backwards from this transaction signature. If not provided the search starts from the top of the highest max confirmed block.
	Until      solana.Signature `json:"until,omitempty"`      // (optional) search until this transaction signature, if found before limit reached.
	Commitment CommitmentType   `json:"commitment,omitempty"` // (optional) Commitment; "processed" is not supported. If parameter not provided, the default is "finalized".
}

type GetSnapshotSlotResult

type GetSnapshotSlotResult struct{}

type GetStakeActivationResult

type GetStakeActivationResult struct {
	State    ActivationStateType `json:"state"`    // the stake account's activation state, one of: active, inactive, activating, deactivating
	Active   bin.Uint64          `json:"active"`   // stake active during the epoch
	Inactive bin.Uint64          `json:"inactive"` // stake inactive during the epoch
}

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 {
	Mint solana.PublicKey `json:"mint"` // Pubkey of the specific token Mint to limit accounts to
	// OR:
	ProgramId solana.PublicKey `json:"programId"` // Pubkey of the Token program ID that owns the accounts
}

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"`
	Commitment CommitmentType      `json:"commitment,omitempty"` // "processed" is not supported. If parameter not provided, the default is "finalized".
}

type GetTransactionResult

type GetTransactionResult struct {
	Slot bin.Uint64 `json:"slot"` // the slot this transaction was processed in
	// TODO: int64 as readable time
	BlockTime   bin.Int64          `json:"blockTime"` // estimated production time, as Unix timestamp (seconds since the Unix epoch) of when the transaction was processed. null if not available
	Transaction *ParsedTransaction `json:"transaction"`
	Meta        *TransactionMeta   `json:"meta,omitempty"`
}

type GetVersionResult

type GetVersionResult struct {
	SolanaCore string    `json:"solana-core"` // software version of solana-core
	FeatureSet bin.Int64 `json:"feature-set"` // unique identifier of the current software's feature set
}

type GetVoteAccountsOpts

type GetVoteAccountsOpts struct {
	Commitment CommitmentType   `json:"commitment,omitempty"`
	VotePubkey solana.PublicKey `json:"votePubkey,omitempty"` // (optional) Only return results for this validator vote address
}

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        uint8                        `json:"index"`        // Index of the transaction instruction from which the inner instruction(s) originated
	Instructions []solana.CompiledInstruction `json:"instructions"` // Ordered list of inner program instructions that were invoked during a single transaction instruction.
}

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  solana.PublicKey `json:"address"`  // address of the account
	Lamports bin.Uint64       `json:"lamports"` // number of lamports in the account
}

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 bin.Int64        `json:"programIdIndex"`
}

func (*ParsedInstruction) IsParsed

func (p *ParsedInstruction) IsParsed() bool

type ParsedTransaction

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

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 {
	Slot bin.Uint64 `json:"slot"` // The slot the transaction was processed
	// TODO: what is <usize | null> ???
	Confirmations      *bin.Uint64                     `json:"confirmations"`      // Number of blocks since signature confirmation, null if rooted, as well as finalized by a supermajority of the cluster
	Err                interface{}                     `json:"err"`                // Error if transaction failed, null if transaction succeeded
	ConfirmationStatus ConfirmationStatusType          `json:"confirmationStatus"` // The transaction's cluster confirmation status; either processed, confirmed, or finalized
	Status             DeprecatedTransactionMetaStatus `json:"status"`             // DEPRECATED: Transaction status
}

type SimulateTransactionResponse

type SimulateTransactionResponse struct {
	Err  interface{} `json:"err,omitempty"`
	Logs []string    `json:"logs,omitempty"`
}

type SlotRangeRequest

type SlotRangeRequest struct {
	FirstSlot uint64  `json:"firstSlot"`          // first slot to return block production information for (inclusive)
	LastSlot  *uint64 `json:"lastSlot,omitempty"` // (optional) last slot to return block production information for (inclusive). If parameter not provided, defaults to the highest slot
	Identity  *string `json:"identity,omitempty"` // (optional) Only return results for this validator identity (base-58 encoded)
}

type SlotRangeResponse

type SlotRangeResponse struct {
	FirstSlot bin.Uint64 `json:"firstSlot"` // first slot of the block production information (inclusive)
	LastSlot  bin.Uint64 `json:"lastSlot"`  // last slot of block production information (inclusive)
}

type SupplyResult

type SupplyResult struct {
	// TODO: use bin.Uint64 ???
	Total                  uint64             `json:"total"`                  // Total supply in lamports
	Circulating            uint64             `json:"circulating"`            // Circulating supply in lamports
	NonCirculating         uint64             `json:"nonCirculating"`         // Non-circulating supply in lamports
	NonCirculatingAccounts []solana.PublicKey `json:"nonCirculatingAccounts"` // an array of account addresses of non-circulating accounts, as strings
}

type TokenBalance

type TokenBalance struct {
	// TODO: <number> == bin.Int64 ???
	AccountIndex  uint8            `json:"accountIndex"` // Index of the account in which the token balance is provided for.
	Mint          solana.PublicKey `json:"mint"`         // Pubkey of the token's 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 {
	Err               interface{}        `json:"err"`                         // Error if transaction failed, null if transaction succeeded. https://github.com/solana-labs/solana/blob/master/sdk/src/transaction.rs#L24
	Fee               bin.Uint64         `json:"fee"`                         // fee this transaction was charged
	PreBalances       []bin.Uint64       `json:"preBalances"`                 //  array of u64 account balances from before the transaction was processed
	PostBalances      []bin.Uint64       `json:"postBalances"`                // array of u64 account balances after the transaction was processed
	InnerInstructions []InnerInstruction `json:"innerInstructions,omitempty"` // List of inner instructions or omitted if inner instruction recording was not yet enabled during this transaction

	PreTokenBalances  []TokenBalance `json:"preTokenBalances"`  // List of token balances from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction
	PostTokenBalances []TokenBalance `json:"postTokenBalances"` // List of token balances from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction

	LogMessages []string `json:"logMessages"` // array of string log messages or omitted if log message recording was not yet enabled during this transaction

	Status DeprecatedTransactionMetaStatus `json:"status"` // DEPRECATED: Transaction status.

	Rewards []BlockReward `json:"rewards,omitempty"`
}

type TransactionParsed

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

type TransactionSignature

type TransactionSignature struct {
	Err                interface{}            `json:"err"`                 // Error if transaction failed, null if transaction succeeded
	Memo               *string                `json:"memo"`                // Memo associated with the transaction, null if no memo is present
	Signature          solana.Signature       `json:"signature"`           // transaction signature as base-58 encoded string
	Slot               bin.Uint64             `json:"slot,omitempty"`      // The slot that contains the block with the transaction
	BlockTime          bin.Int64              `json:"blockTime,omitempty"` // estimated production time, as Unix timestamp (seconds since the Unix epoch) of when transaction was processed. null if not available.
	ConfirmationStatus ConfirmationStatusType `json:"confirmationStatus,omitempty"`
}

type TransactionWithMeta

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

type UiTokenAmount

type UiTokenAmount struct {
	Amount string `json:"amount"` // Raw amount of tokens as a string, ignoring decimals.
	// TODO: <number> == bin.Int64 ???
	Decimals       uint8            `json:"decimals"`       // Number of decimals configured for token's mint.
	UiAmount       *bin.JSONFloat64 `json:"uiAmount"`       // DEPRECATED: Token amount as a float, accounting for decimals.
	UiAmountString string           `json:"uiAmountString"` // Token amount as a string, accounting for decimals.
}

type VoteAccountsResult

type VoteAccountsResult struct {
	VotePubkey       solana.PublicKey `json:"votePubkey,omitempty"`       // Vote account address
	NodePubkey       solana.PublicKey `json:"nodePubkey,omitempty"`       // Validator identity
	ActivatedStake   uint64           `json:"activatedStake,omitempty"`   // the stake, in lamports, delegated to this vote account and active in this epoch
	EpochVoteAccount bool             `json:"epochVoteAccount,omitempty"` // whether the vote account is staked for this epoch
	Commission       uint8            `json:"commission,omitempty"`       // percentage (0-100) of rewards payout owed to the vote account
	LastVote         uint64           `json:"lastVote,omitempty"`         // Most recent slot voted on by this vote account
	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