types

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToUIAmount

func ConvertToUIAmount(amount *big.Int, decimals uint8) float64

ConvertToUIAmount converts raw token amount to human-readable format

func ConvertToUIAmountString

func ConvertToUIAmountString(amountStr string, decimals uint8) float64

ConvertToUIAmountString converts raw token amount string to human-readable format

func ConvertToUIAmountUint64

func ConvertToUIAmountUint64(amount uint64, decimals uint8) float64

ConvertToUIAmountUint64 converts uint64 raw amount to human-readable format

Types

type ALTsFetcher added in v1.2.0

type ALTsFetcher struct {
	// Filter specifies when to invoke the fetcher
	Filter FetchFilterType

	// Fetch resolves ALT references to actual addresses
	// Input: slice of ALT lookup references from transaction
	// Output: map of ALT account key -> LoadedAddresses
	Fetch func(alts []AddressTableLookup) (map[string]*LoadedAddresses, error)
}

ALTsFetcher provides pluggable Address Lookup Table resolution

func NewALTsFetcher added in v1.2.0

func NewALTsFetcher(
	filter FetchFilterType,
	fetcher func(alts []AddressTableLookup) (map[string]*LoadedAddresses, error),
) *ALTsFetcher

NewALTsFetcher creates a new ALTs fetcher with specified filter and function

type AddressTableLookup added in v1.2.0

type AddressTableLookup struct {
	AccountKey      string `json:"accountKey"`
	WritableIndexes []int  `json:"writableIndexes"`
	ReadonlyIndexes []int  `json:"readonlyIndexes"`
}

AddressTableLookup represents an address lookup table reference in transaction

type AltEvent added in v1.2.0

type AltEvent struct {
	// Type is the ALT operation type (CreateLookupTable/FreezeLookupTable/ExtendLookupTable/DeactivateLookupTable/CloseLookupTable)
	Type string `json:"type"`

	// AltAccount is the Address Lookup Table account address
	AltAccount string `json:"altAccount"`

	// AltAuthority is the ALT authority (owner) address
	AltAuthority string `json:"altAuthority"`

	// Recipient is the recipient account for CloseLookupTable
	Recipient string `json:"recipient,omitempty"`

	// NewAddresses contains newly added addresses for ExtendLookupTable
	NewAddresses []string `json:"newAddresses,omitempty"`

	// PayerAccount is the fee payer for CreateLookupTable/ExtendLookupTable
	PayerAccount string `json:"payerAccount,omitempty"`

	// RecentSlot is the recent slot for CreateLookupTable
	RecentSlot uint64 `json:"recentSlot,omitempty"`

	// Idx is the instruction index
	Idx string `json:"idx,omitempty"`
}

AltEvent contains Address Lookup Table event data

type BalanceChange

type BalanceChange struct {
	Pre    TokenAmount `json:"pre"`    // Token balance before transaction execution
	Post   TokenAmount `json:"post"`   // Token balance after transaction execution
	Change TokenAmount `json:"change"` // Net change in token balance (post - pre)
}

BalanceChange represents token balance changes before and after transaction execution

type ClassifiedInstruction

type ClassifiedInstruction struct {
	// Instruction is the raw instruction data
	Instruction interface{} `json:"instruction"`

	// ProgramId is the program ID that owns this instruction
	ProgramId string `json:"programId"`

	// OuterIndex is the outer instruction index in the transaction
	OuterIndex int `json:"outerIndex"`

	// InnerIndex is the inner instruction index (for CPI calls), -1 if not inner
	InnerIndex int `json:"innerIndex"`
}

ClassifiedInstruction represents a classified instruction with its context information

func (*ClassifiedInstruction) GetIdx

func (c *ClassifiedInstruction) GetIdx() string

GetIdx returns the instruction index as string in format "outer-inner" or just "outer"

type DexInfo

type DexInfo struct {
	ProgramId string `json:"programId,omitempty"` // DEX program ID on Solana
	AMM       string `json:"amm,omitempty"`       // Automated Market Maker name
	Route     string `json:"route,omitempty"`     // Router or aggregator name
}

DexInfo contains basic DEX protocol information

type EventParser

type EventParser[T any] struct {
	// Discriminator is the unique byte sequence identifying this event type
	Discriminator []byte

	// Decode decodes raw event data into typed object
	Decode func(data []byte) (T, error)
}

EventParser is a generic event parser configuration for single discriminator events

type EventsParser

type EventsParser[T any] struct {
	// Discriminators are byte sequences identifying related event types
	Discriminators [][]byte

	// Slice is the number of bytes to slice from the beginning of data
	Slice int

	// Decode decodes raw event data with additional options
	Decode func(data []byte, options interface{}) (T, error)
}

EventsParser is a generic event parser configuration for multiple discriminator events

type FeeInfo

type FeeInfo struct {
	Mint      string  `json:"mint"`                // Fee token mint address
	Amount    float64 `json:"amount"`              // Fee amount in UI format
	AmountRaw string  `json:"amountRaw"`           // Raw fee amount
	Decimals  uint8   `json:"decimals"`            // Fee token decimals
	Dex       string  `json:"dex,omitempty"`       // DEX name (e.g., 'Raydium', 'Meteora')
	Type      string  `json:"type,omitempty"`      // Fee type (e.g., 'protocol', 'coinCreator')
	Recipient string  `json:"recipient,omitempty"` // Fee recipient account
}

FeeInfo contains fee information

type FetchFilterType added in v1.2.0

type FetchFilterType string

FetchFilterType specifies when to invoke a fetcher callback

const (
	// FetchFilterAll calls fetcher for all transactions
	FetchFilterAll FetchFilterType = "all"

	// FetchFilterProgram calls fetcher only for transactions matching ParseConfig.ProgramIds
	FetchFilterProgram FetchFilterType = "program"

	// FetchFilterAccount calls fetcher only for transactions matching ParseConfig.AccountInclude
	FetchFilterAccount FetchFilterType = "account"
)

type InstructionParser

type InstructionParser[T any] struct {
	// Discriminator is the unique byte sequence identifying this instruction type
	Discriminator []byte

	// Decode decodes instruction data with additional options
	Decode func(instruction interface{}, options interface{}) (T, error)
}

InstructionParser is a generic instruction parser configuration

type LoadedAddresses added in v1.2.0

type LoadedAddresses struct {
	Writable []string `json:"writable"`
	Readonly []string `json:"readonly"`
}

LoadedAddresses contains resolved addresses from Address Lookup Tables

type MemeEvent

type MemeEvent struct {
	Type      TradeType `json:"type"`      // Type of the event (create/trade/migrate)
	Timestamp int64     `json:"timestamp"` // Event timestamp
	Idx       string    `json:"idx"`       // Event index
	Slot      uint64    `json:"slot"`      // Event slot
	Signature string    `json:"signature"` // Event signature

	// Common fields for all events
	User string `json:"user"` // User/trader address

	BaseMint  string `json:"baseMint"`  // Token mint address
	QuoteMint string `json:"quoteMint"` // Quote mint address

	// Trade-specific fields
	InputToken  *TokenInfo `json:"inputToken,omitempty"`  // Amount in
	OutputToken *TokenInfo `json:"outputToken,omitempty"` // Amount out

	// Token creation fields
	Name        string   `json:"name,omitempty"`        // Token name
	Symbol      string   `json:"symbol,omitempty"`      // Token symbol
	URI         string   `json:"uri,omitempty"`         // Token metadata URI
	Decimals    *uint8   `json:"decimals,omitempty"`    // Token decimals
	TotalSupply *float64 `json:"totalSupply,omitempty"` // Token total supply

	// Fee and economic fields
	Fee         *float64 `json:"fee,omitempty"`         // Fee
	ProtocolFee *float64 `json:"protocolFee,omitempty"` // Protocol fee
	PlatformFee *float64 `json:"platformFee,omitempty"` // Platform fee
	ShareFee    *float64 `json:"shareFee,omitempty"`    // Share fee
	CreatorFee  *float64 `json:"creatorFee,omitempty"`  // Creator fee

	// Protocol-specific addresses
	Protocol       string   `json:"protocol,omitempty"`       // Protocol name
	PlatformConfig string   `json:"platformConfig,omitempty"` // Platform config address
	Creator        string   `json:"creator,omitempty"`        // Token creator address
	BondingCurve   string   `json:"bondingCurve,omitempty"`   // Bonding curve address
	Pool           string   `json:"pool,omitempty"`           // Pool address
	PoolDex        string   `json:"poolDex,omitempty"`        // Pool Dex name
	PoolAReserve   *float64 `json:"poolAReserve,omitempty"`   // Pool A reserve
	PoolBReserve   *float64 `json:"poolBReserve,omitempty"`   // Pool B reserve
	PoolFeeRate    *float64 `json:"poolFeeRate,omitempty"`    // Pool fee rate
}

MemeEvent contains the unified event data for meme token operations

type ParseConfig

type ParseConfig struct {
	// ParseType controls which event types to parse and return
	ParseType ParseType `json:"parseType,omitempty"`

	// TryUnknownDEX if true, will try to parse unknown DEXes (results may be inaccurate)
	TryUnknownDEX bool `json:"tryUnknownDEX,omitempty"`

	// ProgramIds if set, will only parse transactions from these program IDs
	ProgramIds []string `json:"programIds,omitempty"`

	// IgnoreProgramIds if set, will ignore transactions from these program IDs
	IgnoreProgramIds []string `json:"ignoreProgramIds,omitempty"`

	// AccountInclude if set, will only parse transactions that include any of these accounts
	AccountInclude []string `json:"accountInclude,omitempty"`

	// AccountExclude if set, will skip transactions that include any of these accounts
	AccountExclude []string `json:"accountExclude,omitempty"`

	// ThrowError if true, will panic on parse errors instead of returning error state
	ThrowError bool `json:"throwError,omitempty"`

	// AggregateTrades if true, will return the finalSwap record instead of detail route trades
	// Deprecated: Use ParseType.AggregateTrade instead. Kept for backward compatibility.
	AggregateTrades bool `json:"aggregateTrades,omitempty"`

	// ALTsFetcher if set, will use this callback to fetch Address Lookup Table accounts
	ALTsFetcher *ALTsFetcher `json:"-"`

	// TokenAccountsFetcher if set, will use this callback to fetch token account info
	TokenAccountsFetcher *TokenAccountsFetcher `json:"-"`

	// PoolInfoFetcher if set, will use this callback to fetch pool information
	PoolInfoFetcher *PoolInfoFetcher `json:"-"`
}

ParseConfig contains configuration options for transaction parsing

func DefaultParseConfig

func DefaultParseConfig() ParseConfig

DefaultParseConfig returns default parsing configuration with all events enabled

func DefaultParseConfigTradesOnly added in v1.2.0

func DefaultParseConfigTradesOnly() ParseConfig

DefaultParseConfigTradesOnly returns parsing configuration for trades only

func (*ParseConfig) GetEffectiveParseType added in v1.2.0

func (c *ParseConfig) GetEffectiveParseType() ParseType

GetEffectiveParseType returns the effective ParseType, defaulting to ParseAll if not set

func (*ParseConfig) IsParseTypeSet added in v1.2.0

func (c *ParseConfig) IsParseTypeSet() bool

IsParseTypeSet returns true if any ParseType field is explicitly set

func (*ParseConfig) ShouldAggregateTrades added in v1.2.0

func (c *ParseConfig) ShouldAggregateTrades() bool

ShouldAggregateTrades returns true if trades should be aggregated Checks both ParseType.AggregateTrade and legacy AggregateTrades field

type ParseResult

type ParseResult struct {
	// State indicates parsing success status - true if parsing completed successfully
	State bool `json:"state"`

	// Fee is the transaction gas fee paid in SOL
	Fee TokenAmount `json:"fee"`

	// AggregateTrade contains aggregated trade information combining multiple related trades
	AggregateTrade *TradeInfo `json:"aggregateTrade,omitempty"`

	// Trades contains array of individual trade transactions found in the transaction
	Trades []TradeInfo `json:"trades"`

	// Liquidities contains array of liquidity operations (add/remove/create pool)
	Liquidities []PoolEvent `json:"liquidities"`

	// Transfers contains array of token transfer operations not related to trades
	Transfers []TransferData `json:"transfers"`

	// SolBalanceChange contains SOL balance change for the transaction signer
	SolBalanceChange *BalanceChange `json:"solBalanceChange,omitempty"`

	// TokenBalanceChange contains token balance changes mapped by token mint address
	TokenBalanceChange map[string]*BalanceChange `json:"tokenBalanceChange,omitempty"`

	// MemeEvents contains meme platform events (create/buy/sell/migrate/complete)
	MemeEvents []MemeEvent `json:"memeEvents"`

	// AltEvents contains Address Lookup Table events
	AltEvents []AltEvent `json:"altEvents,omitempty"`

	// Slot is the Solana slot number where the transaction was included
	Slot uint64 `json:"slot"`

	// Timestamp is the Unix timestamp when the transaction was processed
	Timestamp int64 `json:"timestamp"`

	// Signature is the unique transaction signature identifier
	Signature string `json:"signature"`

	// Signer contains array of public keys that signed this transaction
	Signer []string `json:"signer"`

	// ComputeUnits indicates compute units consumed by the transaction execution
	ComputeUnits uint64 `json:"computeUnits"`

	// TxStatus indicates final execution status of the transaction
	TxStatus TransactionStatus `json:"txStatus"`

	// Msg contains optional error or status message
	Msg string `json:"msg,omitempty"`

	// Extras contains additional parser-specific data
	Extras interface{} `json:"extras,omitempty"`
}

ParseResult contains complete parsing result with all extracted transaction data

func NewParseResult

func NewParseResult() *ParseResult

NewParseResult creates a new ParseResult with default values

func (*ParseResult) IsArbitrage added in v1.2.0

func (r *ParseResult) IsArbitrage() bool

IsArbitrage returns true if the aggregated trade is an arbitrage (same input and output token mint addresses)

type ParseShredResult

type ParseShredResult struct {
	// State indicates parsing success status - true if shred parsing completed successfully
	State bool `json:"state"`

	// Signature is the transaction signature being analyzed
	Signature string `json:"signature"`

	// Instructions contains parsed instructions grouped by AMM/DEX name (legacy format)
	Instructions map[string][]interface{} `json:"instructions"`

	// ParsedInstructions contains typed parsed instructions (new format)
	ParsedInstructions []ParsedShredInstruction `json:"parsedInstructions,omitempty"`

	// Slot is the block slot number
	Slot uint64 `json:"slot,omitempty"`

	// Timestamp is the Unix timestamp
	Timestamp int64 `json:"timestamp,omitempty"`

	// Signer contains transaction signers
	Signer []string `json:"signer,omitempty"`

	// Msg contains optional error or status message
	Msg string `json:"msg,omitempty"`
}

ParseShredResult contains parsing result for shred-stream data (pre-execution instruction analysis)

type ParseType added in v1.2.0

type ParseType struct {
	// AggregateTrade if true, returns the aggregated trade record for Jupiter routes
	AggregateTrade bool `json:"aggregateTrade,omitempty"`

	// Trade if true, returns individual trade events
	Trade bool `json:"trade,omitempty"`

	// Liquidity if true, returns liquidity pool events (add/remove/create)
	Liquidity bool `json:"liquidity,omitempty"`

	// Transfer if true, returns token transfer events
	Transfer bool `json:"transfer,omitempty"`

	// MemeEvent if true, returns meme platform events (create/buy/sell/migrate)
	MemeEvent bool `json:"memeEvent,omitempty"`

	// AltEvent if true, returns Address Lookup Table events
	AltEvent bool `json:"altEvent,omitempty"`
}

ParseType defines configuration options for parsing output granularity. Each field controls whether to parse and return specific event types.

func ParseAll added in v1.2.0

func ParseAll() ParseType

ParseAll returns a ParseType with all parsing options enabled

func ParseLiquidityOnly added in v1.2.0

func ParseLiquidityOnly() ParseType

ParseLiquidityOnly returns a ParseType for parsing only liquidity events

func ParseTradesOnly added in v1.2.0

func ParseTradesOnly() ParseType

ParseTradesOnly returns a ParseType for parsing only trades

type ParsedShredInstruction added in v1.2.0

type ParsedShredInstruction struct {
	// ProgramID is the program that owns this instruction
	ProgramID string `json:"programId"`

	// ProgramName is the human-readable name of the program
	ProgramName string `json:"programName"`

	// Action is the instruction action type (e.g., "pumpswap_swap", "transfer")
	Action string `json:"action"`

	// Trade contains trade data if this is a trade instruction
	Trade *TradeInfo `json:"trade,omitempty"`

	// Liquidity contains liquidity data if this is a liquidity instruction
	Liquidity *PoolEvent `json:"liquidity,omitempty"`

	// Transfer contains transfer data if this is a transfer instruction
	Transfer *TransferData `json:"transfer,omitempty"`

	// MemeEvent contains meme event data if this is a meme event instruction
	MemeEvent *MemeEvent `json:"memeEvent,omitempty"`

	// Data contains additional instruction-specific data
	Data interface{} `json:"data,omitempty"`

	// Accounts contains the account addresses involved in this instruction
	Accounts []string `json:"accounts"`

	// Idx is the instruction index in format "outer" or "outer-inner"
	Idx string `json:"idx"`
}

ParsedShredInstruction represents a typed parsed shred instruction

type PoolEvent

type PoolEvent struct {
	PoolEventBase

	// PoolId is the AMM pool address (market)
	PoolId string `json:"poolId"`

	// Config is the pool config address (platform config)
	Config string `json:"config,omitempty"`

	// PoolLpMint is the LP mint address
	PoolLpMint string `json:"poolLpMint,omitempty"`

	// Token0Mint is Token A mint address (TOKEN)
	Token0Mint string `json:"token0Mint,omitempty"`

	// Token0Amount is Token A uiAmount (TOKEN)
	Token0Amount *float64 `json:"token0Amount,omitempty"`

	// Token0AmountRaw is Token A raw amount (TOKEN)
	Token0AmountRaw string `json:"token0AmountRaw,omitempty"`

	// Token0BalanceChange is user token0 balance changed amount
	Token0BalanceChange string `json:"token0BalanceChange,omitempty"`

	// Token0Decimals is Token A decimals
	Token0Decimals *uint8 `json:"token0Decimals,omitempty"`

	// Token1Mint is Token B mint address (SOL/USDC/USDT)
	Token1Mint string `json:"token1Mint,omitempty"`

	// Token1Amount is Token B uiAmount (SOL/USDC/USDT)
	Token1Amount *float64 `json:"token1Amount,omitempty"`

	// Token1AmountRaw is Token B raw amount (SOL/USDC/USDT)
	Token1AmountRaw string `json:"token1AmountRaw,omitempty"`

	// Token1BalanceChange is user token1 balance changed amount
	Token1BalanceChange string `json:"token1BalanceChange,omitempty"`

	// Token1Decimals is Token B decimals
	Token1Decimals *uint8 `json:"token1Decimals,omitempty"`

	// LpAmount is the LP token amount (UI)
	LpAmount *float64 `json:"lpAmount,omitempty"`

	// LpAmountRaw is the LP token raw amount
	LpAmountRaw string `json:"lpAmountRaw,omitempty"`
}

PoolEvent represents a liquidity pool event

type PoolEventBase

type PoolEventBase struct {
	User      string        `json:"user"`                // User address
	Type      PoolEventType `json:"type"`                // Event type (CREATE/ADD/REMOVE)
	ProgramId string        `json:"programId,omitempty"` // DEX program ID
	AMM       string        `json:"amm,omitempty"`       // AMM type
	Slot      uint64        `json:"slot"`                // Block slot number
	Timestamp int64         `json:"timestamp"`           // Unix timestamp
	Signature string        `json:"signature"`           // Transaction signature
	Idx       string        `json:"idx"`                 // Instruction indexes
	Signer    []string      `json:"signer,omitempty"`    // Original signer
}

PoolEventBase contains base fields for pool events

type PoolEventType

type PoolEventType string

PoolEventType represents the type of liquidity pool event

const (
	PoolEventTypeCreate PoolEventType = "CREATE"
	PoolEventTypeAdd    PoolEventType = "ADD"
	PoolEventTypeRemove PoolEventType = "REMOVE"
)

type PoolInfoFetcher added in v1.2.0

type PoolInfoFetcher struct {
	// Filter specifies when to invoke the fetcher
	Filter FetchFilterType

	// Fetch retrieves pool information for given pool keys
	// Input: slice of pool public keys
	// Output: slice of pool info (interface{} to support different pool types)
	Fetch func(poolKeys []string) ([]interface{}, error)
}

PoolInfoFetcher provides pluggable pool information resolution

func NewPoolInfoFetcher added in v1.2.0

func NewPoolInfoFetcher(
	filter FetchFilterType,
	fetcher func(poolKeys []string) ([]interface{}, error),
) *PoolInfoFetcher

NewPoolInfoFetcher creates a new pool info fetcher with specified filter and function

type TokenAccountInfo added in v1.2.0

type TokenAccountInfo struct {
	Mint     string `json:"mint"`
	Owner    string `json:"owner"`
	Amount   string `json:"amount"`
	Decimals uint8  `json:"decimals"`
}

TokenAccountInfo contains token account metadata

type TokenAccountsFetcher added in v1.2.0

type TokenAccountsFetcher struct {
	// Filter specifies when to invoke the fetcher
	Filter FetchFilterType

	// Fetch retrieves token account information for given account keys
	// Input: slice of token account public keys
	// Output: slice of TokenAccountInfo (nil for accounts that couldn't be fetched)
	Fetch func(accountKeys []string) ([]*TokenAccountInfo, error)
}

TokenAccountsFetcher provides pluggable token account info resolution

func NewTokenAccountsFetcher added in v1.2.0

func NewTokenAccountsFetcher(
	filter FetchFilterType,
	fetcher func(accountKeys []string) ([]*TokenAccountInfo, error),
) *TokenAccountsFetcher

NewTokenAccountsFetcher creates a new token accounts fetcher with specified filter and function

type TokenAmount

type TokenAmount struct {
	Amount   string   `json:"amount"`   // Raw token amount
	UIAmount *float64 `json:"uiAmount"` // Human-readable amount (can be null)
	Decimals uint8    `json:"decimals"` // Token decimals
}

TokenAmount represents a standard token amount format

type TokenInfo

type TokenInfo struct {
	Mint                  string       `json:"mint"`                            // Token mint address
	Amount                float64      `json:"amount"`                          // Token uiAmount
	AmountRaw             string       `json:"amountRaw"`                       // Raw token amount
	Decimals              uint8        `json:"decimals"`                        // Token decimals
	Authority             string       `json:"authority,omitempty"`             // Token authority (if applicable)
	Destination           string       `json:"destination,omitempty"`           // Destination token account
	DestinationOwner      string       `json:"destinationOwner,omitempty"`      // Owner of destination account
	DestinationBalance    *TokenAmount `json:"destinationBalance,omitempty"`    // Balance after transfer
	DestinationPreBalance *TokenAmount `json:"destinationPreBalance,omitempty"` // Balance before transfer
	Source                string       `json:"source,omitempty"`                // Source token account
	SourceBalance         *TokenAmount `json:"sourceBalance,omitempty"`         // Source balance after transfer
	SourcePreBalance      *TokenAmount `json:"sourcePreBalance,omitempty"`      // Source balance before transfer
	BalanceChange         string       `json:"balanceChange,omitempty"`         // Raw user balance change amount
}

TokenInfo contains token information including balances and accounts

type TradeInfo

type TradeInfo struct {
	User        string      `json:"user"`                  // Signer address (trader)
	Type        TradeType   `json:"type"`                  // Trade direction (BUY/SELL/SWAP)
	Pool        []string    `json:"Pool"`                  // Pool addresses
	InputToken  TokenInfo   `json:"inputToken"`            // Token being sold
	OutputToken TokenInfo   `json:"outputToken"`           // Token being bought
	SlippageBps *int        `json:"slippageBps,omitempty"` // Slippage in basis points
	Fee         *FeeInfo    `json:"fee,omitempty"`         // Fee information (if applicable)
	Fees        []FeeInfo   `json:"fees,omitempty"`        // List of fees (if multiple)
	ProgramId   string      `json:"programId,omitempty"`   // DEX program ID
	AMM         string      `json:"amm,omitempty"`         // AMM type (e.g., 'RaydiumV4', 'Meteora')
	AMMs        []string    `json:"amms,omitempty"`        // List of AMMs (if multiple)
	Route       string      `json:"route,omitempty"`       // Router or Bot name
	Bot         string      `json:"bot,omitempty"`         // Trading bot name (e.g., 'Trojan', 'BONKbot')
	Slot        uint64      `json:"slot"`                  // Block slot number
	Timestamp   int64       `json:"timestamp"`             // Unix timestamp
	Signature   string      `json:"signature"`             // Transaction signature
	Idx         string      `json:"idx"`                   // Instruction indexes
	Signer      []string    `json:"signer,omitempty"`      // Original signer
	Extras      interface{} `json:"extras,omitempty"`      // Additional parser-specific data
}

TradeInfo contains comprehensive trade information

type TradeType

type TradeType string

TradeType represents the direction/type of a trade

const (
	TradeTypeBuy      TradeType = "BUY"
	TradeTypeSell     TradeType = "SELL"
	TradeTypeSwap     TradeType = "SWAP"
	TradeTypeCreate   TradeType = "CREATE"
	TradeTypeMigrate  TradeType = "MIGRATE"
	TradeTypeComplete TradeType = "COMPLETE"
	TradeTypeAdd      TradeType = "ADD"
	TradeTypeRemove   TradeType = "REMOVE"
	TradeTypeLock     TradeType = "LOCK"
	TradeTypeBurn     TradeType = "BURN"
)

type TransactionStatus

type TransactionStatus string

TransactionStatus represents the transaction execution status

const (
	TransactionStatusUnknown TransactionStatus = "unknown"
	TransactionStatusSuccess TransactionStatus = "success"
	TransactionStatusFailed  TransactionStatus = "failed"
)

type TransferData

type TransferData struct {
	Type      string           `json:"type"`            // Transfer instruction type
	ProgramId string           `json:"programId"`       // Token program ID
	Info      TransferDataInfo `json:"info"`            // Transfer details
	Idx       string           `json:"idx"`             // Instruction index
	Timestamp int64            `json:"timestamp"`       // Unix timestamp
	Signature string           `json:"signature"`       // Transaction signature
	IsFee     bool             `json:"isFee,omitempty"` // Whether it's a fee transfer
}

TransferData contains detailed transfer data including account information

type TransferDataInfo

type TransferDataInfo struct {
	Authority             string       `json:"authority,omitempty"`             // Transfer authority
	Destination           string       `json:"destination"`                     // Destination account
	DestinationOwner      string       `json:"destinationOwner,omitempty"`      // Owner of destination account
	Mint                  string       `json:"mint"`                            // Token mint address
	Source                string       `json:"source"`                          // Source account
	TokenAmount           TokenAmount  `json:"tokenAmount"`                     // Amount details
	SourceBalance         *TokenAmount `json:"sourceBalance,omitempty"`         // Source balance after transfer
	SourcePreBalance      *TokenAmount `json:"sourcePreBalance,omitempty"`      // Source balance before transfer
	DestinationBalance    *TokenAmount `json:"destinationBalance,omitempty"`    // Balance after transfer
	DestinationPreBalance *TokenAmount `json:"destinationPreBalance,omitempty"` // Balance before transfer
	SolBalanceChange      string       `json:"solBalanceChange,omitempty"`      // Raw SOL balance change amount
}

TransferDataInfo contains detailed transfer data

type TransferInfo

type TransferInfo struct {
	Type      string    `json:"type"`      // Transfer direction: TRANSFER_IN or TRANSFER_OUT
	Token     TokenInfo `json:"token"`     // Token details
	From      string    `json:"from"`      // Source address
	To        string    `json:"to"`        // Destination address
	Timestamp int64     `json:"timestamp"` // Unix timestamp
	Signature string    `json:"signature"` // Transaction signature
}

TransferInfo contains transfer information for tracking token movements

Jump to

Keyboard shortcuts

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