Documentation
¶
Index ¶
- func ParseTransferAmount(data []byte) uint64
- func ParseTransferCheckedAmount(data []byte) uint64
- type AccountKey
- type AddressTableLookup
- type CompiledInstruction
- type InnerInstructionSet
- type LoadedAddresses
- type MessageHeader
- type ParsedData
- type ParsedInstruction
- type SolanaTransaction
- type TokenBalance
- type TransactionAdapter
- func (a *TransactionAdapter) BlockTime() int64
- func (a *TransactionAdapter) ComputeUnits() uint64
- func (a *TransactionAdapter) Fee() types.TokenAmount
- func (a *TransactionAdapter) GetAccountBalance(accountKeys []string) []*types.TokenAmount
- func (a *TransactionAdapter) GetAccountIndex(address string) int
- func (a *TransactionAdapter) GetAccountKey(index int) string
- func (a *TransactionAdapter) GetAccountPreBalance(accountKeys []string) []*types.TokenAmount
- func (a *TransactionAdapter) GetAccountSolBalanceChanges(isOwner bool) map[string]*types.BalanceChange
- func (a *TransactionAdapter) GetAccountTokenBalanceChanges(isOwner bool) map[string]map[string]*types.BalanceChange
- func (a *TransactionAdapter) GetInnerInstruction(outerIndex, innerIndex int) interface{}
- func (a *TransactionAdapter) GetInstruction(instruction interface{}) *UnifiedInstruction
- func (a *TransactionAdapter) GetInstructionAccounts(instruction interface{}) []string
- func (a *TransactionAdapter) GetInstructionData(instruction interface{}) []byte
- func (a *TransactionAdapter) GetInstructionProgramId(instruction interface{}) string
- func (a *TransactionAdapter) GetPoolEventBase(eventType types.PoolEventType, programId string) types.PoolEventBase
- func (a *TransactionAdapter) GetRawTransaction() *SolanaTransaction
- func (a *TransactionAdapter) GetSplTokenMint(tokenAccount string) string
- func (a *TransactionAdapter) GetTokenAccountBalance(accountKeys []string) []*types.TokenAmount
- func (a *TransactionAdapter) GetTokenAccountOwner(accountKey string) string
- func (a *TransactionAdapter) GetTokenAccountPreBalance(accountKeys []string) []*types.TokenAmount
- func (a *TransactionAdapter) GetTokenDecimals(mint string) uint8
- func (a *TransactionAdapter) InnerInstructions() []InnerInstructionSet
- func (a *TransactionAdapter) Instructions() []interface{}
- func (a *TransactionAdapter) IsCompiledInstruction(instruction interface{}) bool
- func (a *TransactionAdapter) IsMessageV0() bool
- func (a *TransactionAdapter) IsSupportedToken(mint string) bool
- func (a *TransactionAdapter) LogMessages() []string
- func (a *TransactionAdapter) PostBalances() []uint64
- func (a *TransactionAdapter) PostTokenBalances() []TokenBalance
- func (a *TransactionAdapter) PreBalances() []uint64
- func (a *TransactionAdapter) PreTokenBalances() []TokenBalance
- func (a *TransactionAdapter) Signature() string
- func (a *TransactionAdapter) Signer() string
- func (a *TransactionAdapter) Signers() []string
- func (a *TransactionAdapter) Slot() uint64
- func (a *TransactionAdapter) TxStatus() types.TransactionStatus
- type TransactionData
- type TransactionMessage
- type TransactionMeta
- type UnifiedInstruction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseTransferAmount ¶
ParseTransferAmount parses the amount from transfer instruction data
func ParseTransferCheckedAmount ¶
ParseTransferCheckedAmount parses the amount from transfer checked instruction data
Types ¶
type AccountKey ¶
type AccountKey struct {
Pubkey string `json:"pubkey,omitempty"`
Signer bool `json:"signer,omitempty"`
Writable bool `json:"writable,omitempty"`
}
AccountKey can be either a string or an object with pubkey and signer fields
func (*AccountKey) UnmarshalJSON ¶
func (a *AccountKey) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom unmarshaling to handle both string and object formats
type AddressTableLookup ¶
type AddressTableLookup struct {
AccountKey string `json:"accountKey"`
WritableIndexes []int `json:"writableIndexes"`
ReadonlyIndexes []int `json:"readonlyIndexes"`
}
AddressTableLookup for address lookup tables
type CompiledInstruction ¶
type CompiledInstruction struct {
ProgramIdIndex int `json:"programIdIndex"`
Accounts []int `json:"accounts,omitempty"`
AccountKeyIndexes []int `json:"accountKeyIndexes,omitempty"`
Data string `json:"data"`
}
CompiledInstruction represents a compiled instruction
type InnerInstructionSet ¶
type InnerInstructionSet struct {
Index int `json:"index"`
Instructions []interface{} `json:"instructions"`
}
InnerInstructionSet contains inner instructions for an outer instruction
type LoadedAddresses ¶
type LoadedAddresses struct {
Writable []string `json:"writable"`
Readonly []string `json:"readonly"`
}
LoadedAddresses contains loaded address lookup table addresses
type MessageHeader ¶
type MessageHeader struct {
NumRequiredSignatures int `json:"numRequiredSignatures"`
NumReadonlySignedAccounts int `json:"numReadonlySignedAccounts"`
NumReadonlyUnsignedAccounts int `json:"numReadonlyUnsignedAccounts"`
}
MessageHeader contains message header information
type ParsedData ¶
ParsedData contains parsed instruction data
type ParsedInstruction ¶
type ParsedInstruction struct {
ProgramId string `json:"programId"`
Program string `json:"program,omitempty"`
Accounts []string `json:"accounts,omitempty"`
Data string `json:"data,omitempty"`
Parsed *ParsedData `json:"parsed,omitempty"`
}
ParsedInstruction represents a parsed instruction
type SolanaTransaction ¶
type SolanaTransaction struct {
Slot uint64 `json:"slot"`
BlockTime *int64 `json:"blockTime"`
Transaction TransactionData `json:"transaction"`
Meta *TransactionMeta `json:"meta"`
Version interface{} `json:"version"` // can be "legacy", 0, or nil
}
SolanaTransaction represents a generic Solana transaction interface This can be either a parsed transaction or a compiled/versioned transaction
type TokenBalance ¶
type TokenBalance struct {
AccountIndex int `json:"accountIndex"`
Mint string `json:"mint"`
Owner string `json:"owner"`
UiTokenAmount types.TokenAmount `json:"uiTokenAmount"`
}
TokenBalance represents a token balance entry
type TransactionAdapter ¶
type TransactionAdapter struct {
Config *types.ParseConfig
AccountKeys []string
SPLTokenMap map[string]types.TokenInfo
SPLDecimalsMap map[string]uint8
// contains filtered or unexported fields
}
TransactionAdapter provides unified access to transaction data
func NewTransactionAdapter ¶
func NewTransactionAdapter(tx *SolanaTransaction, config *types.ParseConfig) *TransactionAdapter
NewTransactionAdapter creates a new TransactionAdapter
func (*TransactionAdapter) BlockTime ¶
func (a *TransactionAdapter) BlockTime() int64
BlockTime returns the transaction block time
func (*TransactionAdapter) ComputeUnits ¶
func (a *TransactionAdapter) ComputeUnits() uint64
ComputeUnits returns the compute units consumed
func (*TransactionAdapter) Fee ¶
func (a *TransactionAdapter) Fee() types.TokenAmount
Fee returns the transaction fee
func (*TransactionAdapter) GetAccountBalance ¶
func (a *TransactionAdapter) GetAccountBalance(accountKeys []string) []*types.TokenAmount
GetAccountBalance returns SOL balances for given accounts
func (*TransactionAdapter) GetAccountIndex ¶
func (a *TransactionAdapter) GetAccountIndex(address string) int
GetAccountIndex returns the index of an account key
func (*TransactionAdapter) GetAccountKey ¶
func (a *TransactionAdapter) GetAccountKey(index int) string
GetAccountKey returns the account key at the given index
func (*TransactionAdapter) GetAccountPreBalance ¶
func (a *TransactionAdapter) GetAccountPreBalance(accountKeys []string) []*types.TokenAmount
GetAccountPreBalance returns pre-transaction SOL balances
func (*TransactionAdapter) GetAccountSolBalanceChanges ¶
func (a *TransactionAdapter) GetAccountSolBalanceChanges(isOwner bool) map[string]*types.BalanceChange
GetAccountSolBalanceChanges returns SOL balance changes for all accounts
func (*TransactionAdapter) GetAccountTokenBalanceChanges ¶
func (a *TransactionAdapter) GetAccountTokenBalanceChanges(isOwner bool) map[string]map[string]*types.BalanceChange
GetAccountTokenBalanceChanges returns token balance changes for all accounts
func (*TransactionAdapter) GetInnerInstruction ¶
func (a *TransactionAdapter) GetInnerInstruction(outerIndex, innerIndex int) interface{}
GetInnerInstruction returns an inner instruction by indices
func (*TransactionAdapter) GetInstruction ¶
func (a *TransactionAdapter) GetInstruction(instruction interface{}) *UnifiedInstruction
GetInstruction returns unified instruction data
func (*TransactionAdapter) GetInstructionAccounts ¶
func (a *TransactionAdapter) GetInstructionAccounts(instruction interface{}) []string
GetInstructionAccounts returns the accounts from an instruction
func (*TransactionAdapter) GetInstructionData ¶
func (a *TransactionAdapter) GetInstructionData(instruction interface{}) []byte
GetInstructionData returns the data from an instruction
func (*TransactionAdapter) GetInstructionProgramId ¶
func (a *TransactionAdapter) GetInstructionProgramId(instruction interface{}) string
GetInstructionProgramId returns the program ID from an instruction
func (*TransactionAdapter) GetPoolEventBase ¶
func (a *TransactionAdapter) GetPoolEventBase(eventType types.PoolEventType, programId string) types.PoolEventBase
GetPoolEventBase creates a base pool event
func (*TransactionAdapter) GetRawTransaction ¶
func (a *TransactionAdapter) GetRawTransaction() *SolanaTransaction
GetRawTransaction returns the underlying transaction
func (*TransactionAdapter) GetSplTokenMint ¶
func (a *TransactionAdapter) GetSplTokenMint(tokenAccount string) string
GetSplTokenMint returns the mint address for a token account
func (*TransactionAdapter) GetTokenAccountBalance ¶
func (a *TransactionAdapter) GetTokenAccountBalance(accountKeys []string) []*types.TokenAmount
GetTokenAccountBalance returns token balances for given accounts
func (*TransactionAdapter) GetTokenAccountOwner ¶
func (a *TransactionAdapter) GetTokenAccountOwner(accountKey string) string
GetTokenAccountOwner returns the owner of a token account
func (*TransactionAdapter) GetTokenAccountPreBalance ¶
func (a *TransactionAdapter) GetTokenAccountPreBalance(accountKeys []string) []*types.TokenAmount
GetTokenAccountPreBalance returns pre-transaction token balances
func (*TransactionAdapter) GetTokenDecimals ¶
func (a *TransactionAdapter) GetTokenDecimals(mint string) uint8
GetTokenDecimals returns the decimals for a token
func (*TransactionAdapter) InnerInstructions ¶
func (a *TransactionAdapter) InnerInstructions() []InnerInstructionSet
InnerInstructions returns inner instructions
func (*TransactionAdapter) Instructions ¶
func (a *TransactionAdapter) Instructions() []interface{}
Instructions returns all outer instructions
func (*TransactionAdapter) IsCompiledInstruction ¶
func (a *TransactionAdapter) IsCompiledInstruction(instruction interface{}) bool
IsCompiledInstruction checks if an instruction is compiled
func (*TransactionAdapter) IsMessageV0 ¶
func (a *TransactionAdapter) IsMessageV0() bool
IsMessageV0 checks if the transaction uses MessageV0 format
func (*TransactionAdapter) IsSupportedToken ¶
func (a *TransactionAdapter) IsSupportedToken(mint string) bool
IsSupportedToken checks if a token is supported
func (*TransactionAdapter) LogMessages ¶
func (a *TransactionAdapter) LogMessages() []string
LogMessages returns the transaction log messages
func (*TransactionAdapter) PostBalances ¶
func (a *TransactionAdapter) PostBalances() []uint64
PostBalances returns post-transaction SOL balances
func (*TransactionAdapter) PostTokenBalances ¶
func (a *TransactionAdapter) PostTokenBalances() []TokenBalance
PostTokenBalances returns post-transaction token balances
func (*TransactionAdapter) PreBalances ¶
func (a *TransactionAdapter) PreBalances() []uint64
PreBalances returns pre-transaction SOL balances
func (*TransactionAdapter) PreTokenBalances ¶
func (a *TransactionAdapter) PreTokenBalances() []TokenBalance
PreTokenBalances returns pre-transaction token balances
func (*TransactionAdapter) Signature ¶
func (a *TransactionAdapter) Signature() string
Signature returns the transaction signature
func (*TransactionAdapter) Signer ¶
func (a *TransactionAdapter) Signer() string
Signer returns the first signer account
func (*TransactionAdapter) Signers ¶
func (a *TransactionAdapter) Signers() []string
Signers returns all signer accounts
func (*TransactionAdapter) Slot ¶
func (a *TransactionAdapter) Slot() uint64
Slot returns the transaction slot
func (*TransactionAdapter) TxStatus ¶
func (a *TransactionAdapter) TxStatus() types.TransactionStatus
TxStatus returns the transaction status
type TransactionData ¶
type TransactionData struct {
Signatures []string `json:"signatures"`
Message TransactionMessage `json:"message"`
}
TransactionData contains the transaction message and signatures
type TransactionMessage ¶
type TransactionMessage struct {
// Legacy message fields
AccountKeys []AccountKey `json:"accountKeys,omitempty"`
// V0 message fields
Header *MessageHeader `json:"header,omitempty"`
StaticAccountKeys []string `json:"staticAccountKeys,omitempty"`
CompiledInstructions []CompiledInstruction `json:"compiledInstructions,omitempty"`
// Shared fields
Instructions []interface{} `json:"instructions,omitempty"`
AddressTableLookups []AddressTableLookup `json:"addressTableLookups,omitempty"`
}
TransactionMessage can be either legacy or v0 format
type TransactionMeta ¶
type TransactionMeta struct {
Err interface{} `json:"err"`
Fee uint64 `json:"fee"`
PreBalances []uint64 `json:"preBalances"`
PostBalances []uint64 `json:"postBalances"`
PreTokenBalances []TokenBalance `json:"preTokenBalances"`
PostTokenBalances []TokenBalance `json:"postTokenBalances"`
InnerInstructions []InnerInstructionSet `json:"innerInstructions"`
LogMessages []string `json:"logMessages"`
LoadedAddresses *LoadedAddresses `json:"loadedAddresses"`
ComputeUnitsConsumed *uint64 `json:"computeUnitsConsumed"`
}
TransactionMeta contains transaction metadata
type UnifiedInstruction ¶
type UnifiedInstruction struct {
ProgramId string
Accounts []string
Data []byte
Parsed *ParsedData
Program string
}
UnifiedInstruction represents a unified instruction format