Documentation ¶
Index ¶
- Constants
- Variables
- func GetTokenBalanceAmountMap(balances []*api.SolanaTokenBalance, accountKeys []*api.AccountKey) (map[string]*big.Int, error)
- func GetTokenBalanceMapKey(mint string, address string) string
- func NewSolanaChecker(params internal.ParserParams) (internal.Checker, error)
- func NewSolanaNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
- func NewSolanaRosettaParser(params internal.ParserParams, nativeParser internal.NativeParser, ...) (internal.RosettaParser, error)
- func ValidateSolanaParsedTransactionId(signatureList []string) (string, error)
- type AccountKey
- type SolanaBlock
- type SolanaBlockLit
- type SolanaBlockV2
- type SolanaInnerInstruction
- type SolanaInnerInstructionV2
- type SolanaInstruction
- type SolanaInstructionV2
- type SolanaLoadedAddresses
- type SolanaMessage
- type SolanaMessageHeader
- type SolanaMessageV2
- type SolanaParsedInstruction
- type SolanaRawInstructionV2
- type SolanaReward
- type SolanaTokenAmount
- type SolanaTokenBalance
- type SolanaTransaction
- type SolanaTransactionError
- type SolanaTransactionLit
- type SolanaTransactionMeta
- type SolanaTransactionMetaV2
- type SolanaTransactionPayload
- type SolanaTransactionPayloadLit
- type SolanaTransactionPayloadV2
- type SolanaTransactionV2
- type SolanaTransactionVersion
- type SplTokenGetAccountDataSizeInstructionInfo
- type SplTokenInitializeImmutableOwnerInstructionInfo
- type SplTokenTransferInstructionInfo
- type StakeDeactivateInstructionInfo
- type StakeDelegateInstructionInfo
- type StakeInitializeInstructionInfo
- type StakeMergeInstructionInfo
- type StakeSplitInstructionInfo
- type StakeWithdrawInstructionInfo
- type SystemCreateAccountInstructionInfo
- type SystemCreateAccountWithSeedInstructionInfo
- type SystemTransferInstructionInfo
- type SystemTransferWithSeedInstructionInfo
- type TableLookup
- type UnknownInstructionInfo
- type VoteCompactUpdateVoteStateInstructionInfo
- type VoteInitializeInstructionInfo
- type VoteVoteInstructionInfo
- type VoteWithdrawInstructionInfo
Constants ¶
const ( AddressLookupTableProgram = "address-lookup-table" BpfLoaderProgram = "bpf-loader" BpfUpgradeableLoaderProgram = "bpf-upgradeable-loader" VoteProgram = "vote" SystemProgram = "system" StakeProgram = "stake" SplMemoProgram = "spl-memo" SplTokenProgram = "spl-token" SplToken2022Program = "spl-token-2022" SplAssociatedTokenAccountProgram = "spl-associated-token-account" UnparsedProgram = "" // Program: vote VoteInitializeInstruction = "initialize" VoteVoteInstruction = "vote" VoteWithdrawInstruction = "withdraw" VoteCompactUpdateVoteState = "compactupdatevotestate" // Program: system SystemCreateAccountInstruction = "createAccount" SystemTransferInstruction = "transfer" SystemCreateAccountWithSeedInstruction = "createAccountWithSeed" SystemTransferWithSeedInstruction = "transferWithSeed" // Program: stake StakeInitializeInstruction = "initialize" StakeDelegateInstruction = "delegate" StakeDeactivateInstruction = "deactivate" StakeMergeInstruction = "merge" StakeSplitInstruction = "split" StakeWithdrawInstruction = "withdraw" // Program: spl-token SplTokenGetAccountDataSizeInstruction = "getAccountDataSize" SplTokenInitializeImmutableOwnerInstruction = "initializeImmutableOwner" SplTokenTransferInstruction = "transfer" )
#nosec G101 These are not credentials
const ( SolanaLegacyVersion = int32(-1) SolanaLegacyVersionStr = "legacy" )
const ( OpStatusFailure = "FAILURE" OpStatusSuccess = "SUCCESS" OpTypeFee = "FEE" OpTypeTransfer = "TRANSFER" OpTypeReward = "REWARD" NativeSymbol = "SOL" UnknownCurrencySymbol = "UNKNOWN_CURRENCY" // TODO: align with other rosetta implementation ContractAddressAmountMetadataKey = "contract_address" )
Variables ¶
var Module = fx.Options( internal.NewParserBuilder("solana", NewSolanaNativeParser). SetRosettaParserFactory(NewSolanaRosettaParser). SetCheckerFactory(NewSolanaChecker). Build(), )
Functions ¶
func GetTokenBalanceAmountMap ¶
func GetTokenBalanceAmountMap(balances []*api.SolanaTokenBalance, accountKeys []*api.AccountKey) (map[string]*big.Int, error)
func GetTokenBalanceMapKey ¶
func NewSolanaChecker ¶
func NewSolanaChecker(params internal.ParserParams) (internal.Checker, error)
func NewSolanaNativeParser ¶
func NewSolanaNativeParser(params internal.ParserParams, opts ...internal.ParserFactoryOption) (internal.NativeParser, error)
func NewSolanaRosettaParser ¶
func NewSolanaRosettaParser( params internal.ParserParams, nativeParser internal.NativeParser, opts ...internal.ParserFactoryOption, ) (internal.RosettaParser, error)
Types ¶
type AccountKey ¶
type SolanaBlock ¶
type SolanaBlock struct { BlockHash string `json:"blockhash"` BlockHeight uint64 `json:"blockHeight"` ParentSlot uint64 `json:"parentSlot"` PreviousBlockHash string `json:"previousBlockhash"` BlockTime int64 `json:"blockTime"` Transactions []SolanaTransaction `json:"transactions"` Rewards []SolanaReward `json:"rewards"` }
type SolanaBlockLit ¶
type SolanaBlockV2 ¶
type SolanaBlockV2 struct { BlockHash string `json:"blockhash"` BlockHeight uint64 `json:"blockHeight"` ParentSlot uint64 `json:"parentSlot"` PreviousBlockHash string `json:"previousBlockhash"` BlockTime int64 `json:"blockTime"` Transactions []SolanaTransactionV2 `json:"transactions"` Rewards []SolanaReward `json:"rewards"` }
type SolanaInnerInstruction ¶
type SolanaInnerInstruction struct { Index uint64 `json:"index"` Instructions []SolanaInstruction `json:"instructions"` }
type SolanaInnerInstructionV2 ¶
type SolanaInnerInstructionV2 struct { Index uint64 `json:"index"` Instructions []SolanaInstructionV2 `json:"instructions"` }
type SolanaInstruction ¶
type SolanaInstructionV2 ¶
type SolanaInstructionV2 struct { Program string `json:"program"` ProgramId string `json:"programId"` ParsedInstruction json.RawMessage `json:"parsed"` SolanaRawInstructionV2 }
type SolanaLoadedAddresses ¶
type SolanaMessage ¶
type SolanaMessage struct { Header SolanaMessageHeader `json:"header"` AccountKeys []string `json:"accountKeys"` RecentBlockHash string `json:"recentBlockhash"` Instructions []SolanaInstruction `json:"instructions"` }
type SolanaMessageHeader ¶
type SolanaMessageV2 ¶
type SolanaMessageV2 struct { AccountKeys []AccountKey `json:"accountKeys"` AddressTableLookups []TableLookup `json:"addressTableLookups"` Instructions []SolanaInstructionV2 `json:"instructions"` RecentBlockHash string `json:"recentBlockhash"` }
type SolanaParsedInstruction ¶
type SolanaParsedInstruction struct { InstructionInfo json.RawMessage `json:"info"` InstructionType string `json:"type"` }
type SolanaRawInstructionV2 ¶
type SolanaReward ¶
type SolanaTokenAmount ¶
type SolanaTokenBalance ¶
type SolanaTokenBalance struct { AccountIndex uint64 `json:"accountIndex"` Mint string `json:"mint"` TokenAmount SolanaTokenAmount `json:"uiTokenAmount"` Owner string `json:"owner"` }
type SolanaTransaction ¶
type SolanaTransaction struct { Payload *SolanaTransactionPayload `json:"transaction"` Meta *SolanaTransactionMeta `json:"meta"` Version *SolanaTransactionVersion `json:"version"` }
type SolanaTransactionError ¶
type SolanaTransactionError = any
type SolanaTransactionLit ¶
type SolanaTransactionLit struct {
Payload *SolanaTransactionPayloadLit `json:"transaction"`
}
type SolanaTransactionMeta ¶
type SolanaTransactionMeta struct { Err SolanaTransactionError `json:"err"` Fee uint64 `json:"fee"` PreBalances []uint64 `json:"preBalances"` PostBalances []uint64 `json:"postBalances"` PreTokenBalances []SolanaTokenBalance `json:"preTokenBalances"` PostTokenBalances []SolanaTokenBalance `json:"postTokenBalances"` InnerInstructions []SolanaInnerInstruction `json:"innerInstructions"` LogMessages []string `json:"logMessages"` Rewards []SolanaReward `json:"rewards"` LoadedAddresses *SolanaLoadedAddresses `json:"loadedAddresses"` }
type SolanaTransactionMetaV2 ¶
type SolanaTransactionMetaV2 struct { Err SolanaTransactionError `json:"err"` Fee uint64 `json:"fee"` PreBalances []uint64 `json:"preBalances"` PostBalances []uint64 `json:"postBalances"` PreTokenBalances []SolanaTokenBalance `json:"preTokenBalances"` PostTokenBalances []SolanaTokenBalance `json:"postTokenBalances"` InnerInstructions []SolanaInnerInstructionV2 `json:"innerInstructions"` LogMessages []string `json:"logMessages"` Rewards []SolanaReward `json:"rewards"` LoadedAddresses *SolanaLoadedAddresses `json:"loadedAddresses"` }
type SolanaTransactionPayload ¶
type SolanaTransactionPayload struct { Signatures []string `json:"signatures"` Message SolanaMessage `json:"message"` }
type SolanaTransactionPayloadLit ¶
type SolanaTransactionPayloadLit struct {
Signatures []string `json:"signatures"`
}
type SolanaTransactionPayloadV2 ¶
type SolanaTransactionPayloadV2 struct { Signatures []string `json:"signatures"` Message SolanaMessageV2 `json:"message"` }
type SolanaTransactionV2 ¶
type SolanaTransactionV2 struct { Payload *SolanaTransactionPayloadV2 `json:"transaction"` Meta *SolanaTransactionMetaV2 `json:"meta"` Version *SolanaTransactionVersion `json:"version"` }
type SolanaTransactionVersion ¶
type SolanaTransactionVersion int32
func (*SolanaTransactionVersion) UnmarshalJSON ¶
func (v *SolanaTransactionVersion) UnmarshalJSON(input []byte) error
func (SolanaTransactionVersion) Value ¶
func (v SolanaTransactionVersion) Value() int32
type SplTokenGetAccountDataSizeInstructionInfo ¶
type SplTokenGetAccountDataSizeInstructionInfo struct { Mint string `json:"mint" validate:"required"` ExtensionTypes []string `json:"extensionTypes"` }
Program: spl-token
type SplTokenInitializeImmutableOwnerInstructionInfo ¶
type SplTokenInitializeImmutableOwnerInstructionInfo struct {
Account string `json:"account" validate:"required"`
}
Instruction reference: https://github.com/solana-labs/solana/blob/master/transaction-status/src/
type SplTokenTransferInstructionInfo ¶
type SplTokenTransferInstructionInfo struct { Source string `json:"source" validate:"required"` Destination string `json:"destination" validate:"required"` Authority string `json:"authority"` Amount string `json:"amount" validate:"required"` }
Instruction reference: https://github.com/solana-labs/solana/blob/master/transaction-status/src/
type StakeDeactivateInstructionInfo ¶
type StakeDeactivateInstructionInfo struct { StakeAccount string `json:"stakeAcount"` ClockSysvar string `json:"clockSysvar" validate:"required"` StakeAuthority string `json:"stakeAuthority" validate:"required"` }
Instruction reference: https://github.com/solana-labs/solana/blob/master/transaction-status/src/
type StakeDelegateInstructionInfo ¶
type StakeDelegateInstructionInfo struct { StakeAccount string `json:"stakeAcount"` VoteAccount string `json:"voteAccount" validate:"required"` ClockSysvar string `json:"clockSysvar" validate:"required"` StakeHistorySysvar string `json:"stakeHistorySysvar" validate:"required"` StakeConfigAccount string `json:"stakeConfigAccount" validate:"required"` StakeAuthority string `json:"stakeAuthority" validate:"required"` }
Instruction reference: https://github.com/solana-labs/solana/blob/master/transaction-status/src/
type StakeInitializeInstructionInfo ¶
type StakeInitializeInstructionInfo struct { StakeAccount string `json:"stakeAcount"` RentSysvar string `json:"rentSysvar" validate:"required"` Authorized struct { Staker string `json:"staker" validate:"required"` Withdrawer string `json:"withdrawer" validate:"required"` } `json:"authorized"` Lockup struct { UnixTimestamp int64 `json:"unixTimestamp"` Epoch uint64 `json:"epoch"` Custodian string `json:"custodian" validate:"required"` } `json:"lockup" validate:"required"` }
Program: stake
type StakeMergeInstructionInfo ¶
type StakeMergeInstructionInfo struct { Destination string `json:"destination" validate:"required"` Source string `json:"source" validate:"required"` ClockSysvar string `json:"clockSysvar" validate:"required"` StakeHistorySysvar string `json:"stakeHistorySysvar" validate:"required"` StakeAuthority string `json:"stakeAuthority" validate:"required"` }
Instruction reference: https://github.com/solana-labs/solana/blob/master/transaction-status/src/
type StakeSplitInstructionInfo ¶
type StakeSplitInstructionInfo struct { StakeAccount string `json:"stakeAcount"` NewSplitAccount string `json:"newSplitAccount" validate:"required"` StakeAuthority string `json:"stakeAuthority" validate:"required"` Lamports uint64 `json:"lamports"` }
Instruction reference: https://github.com/solana-labs/solana/blob/master/transaction-status/src/
type StakeWithdrawInstructionInfo ¶
type StakeWithdrawInstructionInfo struct { StakeAccount string `json:"stakeAcount"` Destination string `json:"destination" validate:"required"` ClockSysvar string `json:"clockSysvar" validate:"required"` StakeHistorySysvar string `json:"stakeHistorySysvar" validate:"required"` WithdrawAuthority string `json:"withdrawAuthority" validate:"required"` Lamports uint64 `json:"lamports"` }
Instruction reference: https://github.com/solana-labs/solana/blob/master/transaction-status/src/
type SystemCreateAccountInstructionInfo ¶
type SystemCreateAccountInstructionInfo struct { Source string `json:"source" validate:"required"` NewAccount string `json:"newAccount" validate:"required"` Lamports uint64 `json:"lamports"` Space uint64 `json:"space"` Owner string `json:"owner" validate:"required"` }
Program: system
type SystemCreateAccountWithSeedInstructionInfo ¶
type SystemCreateAccountWithSeedInstructionInfo struct { Source string `json:"source" validate:"required"` NewAccount string `json:"newAccount" validate:"required"` Base string `json:"base" validate:"required"` Seed string `json:"seed"` Lamports uint64 `json:"lamports"` Space uint64 `json:"space"` Owner string `json:"owner" validate:"required"` }
Instruction reference: https://github.com/solana-labs/solana/blob/master/transaction-status/src/
type SystemTransferInstructionInfo ¶
type SystemTransferInstructionInfo struct { Source string `json:"source" validate:"required"` Destination string `json:"destination" validate:"required"` Lamports uint64 `json:"lamports"` }
Instruction reference: https://github.com/solana-labs/solana/blob/master/transaction-status/src/
type SystemTransferWithSeedInstructionInfo ¶
type SystemTransferWithSeedInstructionInfo struct { Source string `json:"source" validate:"required"` SourceBase string `json:"sourceBase" validate:"required"` Destination string `json:"destination" validate:"required"` Lamports uint64 `json:"lamports"` SourceSeed string `json:"sourceSeed"` SourceOwner string `json:"sourceOwner" validate:"required"` }
Instruction reference: https://github.com/solana-labs/solana/blob/master/transaction-status/src/
type TableLookup ¶
type UnknownInstructionInfo ¶
type UnknownInstructionInfo struct {
Info []byte `json:"info"`
}
Generic
type VoteCompactUpdateVoteStateInstructionInfo ¶
type VoteCompactUpdateVoteStateInstructionInfo struct { VoteAccount string `json:"voteAccount" validate:"required"` VoteAuthority string `json:"voteAuthority" validate:"required"` VoteStateUpdate struct { Lockouts []struct { ConfirmationCount uint64 `json:"confirmation_count"` Slot uint64 `json:"slot"` } `json:"lockouts"` Hash string `json:"hash"` Root uint64 `json:"root"` Timestamp int64 `json:"timestamp"` } `json:"voteStateUpdate" validate:"required"` }
Instruction reference: https://github.com/solana-labs/solana/blob/master/transaction-status/src/
type VoteInitializeInstructionInfo ¶
type VoteInitializeInstructionInfo struct { VoteAccount string `json:"voteAccount" validate:"required"` RentSysvar string `json:"rentSysvar" validate:"required"` ClockSysvar string `json:"clockSysvar" validate:"required"` Node string `json:"node" validate:"required"` AuthorizedVoter string `json:"authorizedVoter" validate:"required"` AuthorizedWithdrawer string `json:"authorizedWithdrawer" validate:"required"` Commission uint8 `json:"commission"` }
Program: vote
type VoteVoteInstructionInfo ¶
type VoteVoteInstructionInfo struct { VoteAccount string `json:"voteAccount" validate:"required"` SlotHashesSysvar string `json:"slotHashesSysvar" validate:"required"` ClockSysvar string `json:"clockSysvar" validate:"required"` VoteAuthority string `json:"voteAuthority" validate:"required"` Vote struct { Hash string `json:"hash" validate:"required"` Slots []uint64 `json:"slots" validate:"required"` Timestamp int64 `json:"timestamp"` } `json:"vote" validate:"required"` }
Instruction reference: https://github.com/solana-labs/solana/blob/master/transaction-status/src/
type VoteWithdrawInstructionInfo ¶
type VoteWithdrawInstructionInfo struct { VoteAccount string `json:"voteAccount" validate:"required"` Destination string `json:"destination" validate:"required"` WithdrawAuthority string `json:"withdrawAuthority" validate:"required"` Lamports uint64 `json:"lamports"` }
Instruction reference: https://github.com/solana-labs/solana/blob/master/transaction-status/src/