Documentation
¶
Index ¶
- func AbsBigInt(value *big.Int) *big.Int
- func ContainsAny(slice []string, values ...string) bool
- func DecodeInstructionData(data interface{}) ([]byte, error)
- func FindAssociatedTokenAddress(wallet, mint string) (standard, token2022 string, err error)
- func FormatDedupeKey(idx, signature string) string
- func FormatIdx(outerIndex int, innerIndex int) string
- func FormatTransferKey(programId string, outer, inner int) string
- func GetAMMs(transferActionKeys []string) []string
- func GetAccountTradeType(userAccount, baseMint, inputUserAccount, outputUserAccount string) types.TradeType
- func GetFinalSwap(trades []types.TradeInfo, dexInfo *types.DexInfo) *types.TradeInfo
- func GetPrevInstructionByIndex(instructions []types.ClassifiedInstruction, outerIndex, innerIndex int) *types.ClassifiedInstruction
- func GetProgramName(programId string) string
- func GetPubkeyString(value interface{}) string
- func GetTradeType(inMint, outMint string) types.TradeType
- func GetTransferTokenMint(token1, token2 string) string
- func HexToBytes(hexStr string) ([]byte, error)
- func IsCompiledExtraAction(ix *adapter.UnifiedInstruction, actionType string) bool
- func IsCompiledNativeTransfer(ix *adapter.UnifiedInstruction) bool
- func IsCompiledTransfer(ix *adapter.UnifiedInstruction) bool
- func IsCompiledTransferCheck(ix *adapter.UnifiedInstruction) bool
- func IsExtraAction(ix *adapter.UnifiedInstruction, actionType string) bool
- func IsNativeTransfer(ix *adapter.UnifiedInstruction) bool
- func IsTransfer(ix *adapter.UnifiedInstruction) bool
- func IsTransferCheck(ix *adapter.UnifiedInstruction) bool
- func ProcessCompiledExtraAction(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter, ...) *types.TransferData
- func ProcessCompiledNativeTransfer(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter) *types.TransferData
- func ProcessCompiledTransfer(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter) *types.TransferData
- func ProcessCompiledTransferCheck(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter) *types.TransferData
- func ProcessExtraAction(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter, ...) *types.TransferData
- func ProcessNativeTransfer(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter) *types.TransferData
- func ProcessTransfer(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter) *types.TransferData
- func ProcessTransferCheck(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter) *types.TransferData
- func Ptr[T any](v T) *T
- func SortByIdx[T interface{ ... }](items []T) []T
- func SortTradesByIdx(trades []types.TradeInfo) []types.TradeInfo
- type BinaryReader
- func (r *BinaryReader) Error() error
- func (r *BinaryReader) GetBuffer() []byte
- func (r *BinaryReader) GetOffset() int
- func (r *BinaryReader) HasError() bool
- func (r *BinaryReader) ReadBool() (bool, error)
- func (r *BinaryReader) ReadFixedArray(length int) ([]byte, error)
- func (r *BinaryReader) ReadI128() (lo uint64, hi int64, err error)
- func (r *BinaryReader) ReadI64() (int64, error)
- func (r *BinaryReader) ReadPubkey() (string, error)
- func (r *BinaryReader) ReadString() (string, error)
- func (r *BinaryReader) ReadU128() (lo, hi uint64, err error)
- func (r *BinaryReader) ReadU128AsBigInt() *big.Int
- func (r *BinaryReader) ReadU16() (uint16, error)
- func (r *BinaryReader) ReadU32() (uint32, error)
- func (r *BinaryReader) ReadU64() (uint64, error)
- func (r *BinaryReader) ReadU64AsBigInt() *big.Int
- func (r *BinaryReader) ReadU8() (uint8, error)
- func (r *BinaryReader) Release()
- func (r *BinaryReader) Remaining() int
- func (r *BinaryReader) SetOffset(offset int) error
- func (r *BinaryReader) Skip(n int) error
- func (r *BinaryReader) Slice(length int) ([]byte, error)
- type TransactionUtils
- func (tu *TransactionUtils) AttachTokenTransferInfo(trade *types.TradeInfo, transferActions map[string][]types.TransferData) *types.TradeInfo
- func (tu *TransactionUtils) AttachTradeFee(trade *types.TradeInfo) *types.TradeInfo
- func (tu *TransactionUtils) AttachUserBalanceToLPs(liquidities []types.PoolEvent) []types.PoolEvent
- func (tu *TransactionUtils) DetectBot(trade *types.TradeInfo)
- func (tu *TransactionUtils) FilterTransfersForInstruction(transferActions map[string][]types.TransferData, programId string, ...) []types.TransferData
- func (tu *TransactionUtils) GetAdapter() *adapter.TransactionAdapter
- func (tu *TransactionUtils) GetDexInfo(classifier *classifier.InstructionClassifier) types.DexInfo
- func (tu *TransactionUtils) GetLPTransfers(transfers []types.TransferData) []types.TransferData
- func (tu *TransactionUtils) GetTransferActions(extraTypes []string) map[string][]types.TransferData
- func (tu *TransactionUtils) GetTransferInfo(transferData types.TransferData, timestamp int64, signature string) *types.TransferInfo
- func (tu *TransactionUtils) GetTransferInfoList(transferDataList []types.TransferData) []types.TransferInfo
- func (tu *TransactionUtils) GetTransferTokenInfo(transfer *types.TransferData) *types.TokenInfo
- func (tu *TransactionUtils) GetTransfersForInstruction(transferActions map[string][]types.TransferData, programId string, ...) []types.TransferData
- func (tu *TransactionUtils) ParseInstructionAction(instruction interface{}, idx string, extraTypes []string) *types.TransferData
- func (tu *TransactionUtils) ProcessMemeTransferData(ci types.ClassifiedInstruction, event *types.MemeEvent, baseMint string, ...) *types.MemeEvent
- func (tu *TransactionUtils) ProcessSwapData(transfers []types.TransferData, dexInfo types.DexInfo, skipNative bool) *types.TradeInfo
- func (tu *TransactionUtils) ProcessTransferInstructions(outerIndex int, extraTypes []string) []types.TransferData
- func (tu *TransactionUtils) UpdateMemeTokenInfo(event *types.MemeEvent, trade *types.TradeInfo)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsAny ¶
ContainsAny checks if any of the values exist in the slice
func DecodeInstructionData ¶
DecodeInstructionData decodes instruction data from various formats
func FindAssociatedTokenAddress ¶
FindAssociatedTokenAddress computes the associated token address for a wallet and mint
func FormatDedupeKey ¶
FormatDedupeKey formats a deduplication key for trades as "idx-signature"
func FormatTransferKey ¶
FormatTransferKey formats a transfer key as "programId:outer" or "programId:outer-inner"
func GetAccountTradeType ¶
func GetAccountTradeType(userAccount, baseMint, inputUserAccount, outputUserAccount string) types.TradeType
GetAccountTradeType determines trade type based on user's token accounts
func GetFinalSwap ¶
GetFinalSwap aggregates multiple trades into a single final swap
func GetPrevInstructionByIndex ¶
func GetPrevInstructionByIndex(instructions []types.ClassifiedInstruction, outerIndex, innerIndex int) *types.ClassifiedInstruction
GetPrevInstructionByIndex finds the previous instruction in a list
func GetProgramName ¶
GetProgramName returns the name of a program by its ID
func GetPubkeyString ¶
func GetPubkeyString(value interface{}) string
GetPubkeyString converts various pubkey representations to string
func GetTradeType ¶
GetTradeType determines the trade type based on input/output mints
func GetTransferTokenMint ¶
GetTransferTokenMint determines the token mint from two options
func HexToBytes ¶
HexToBytes converts a hex string to byte slice
func IsCompiledExtraAction ¶
func IsCompiledExtraAction(ix *adapter.UnifiedInstruction, actionType string) bool
IsCompiledExtraAction checks if a compiled instruction is an extra action
func IsCompiledNativeTransfer ¶
func IsCompiledNativeTransfer(ix *adapter.UnifiedInstruction) bool
IsCompiledNativeTransfer checks if a compiled instruction is a native SOL transfer
func IsCompiledTransfer ¶
func IsCompiledTransfer(ix *adapter.UnifiedInstruction) bool
IsCompiledTransfer checks if a compiled instruction is a transfer
func IsCompiledTransferCheck ¶
func IsCompiledTransferCheck(ix *adapter.UnifiedInstruction) bool
IsCompiledTransferCheck checks if a compiled instruction is a transferChecked
func IsExtraAction ¶
func IsExtraAction(ix *adapter.UnifiedInstruction, actionType string) bool
IsExtraAction checks if instruction is an extra action type
func IsNativeTransfer ¶
func IsNativeTransfer(ix *adapter.UnifiedInstruction) bool
IsNativeTransfer checks if instruction is a native SOL transfer
func IsTransfer ¶
func IsTransfer(ix *adapter.UnifiedInstruction) bool
IsTransfer checks if instruction is a transfer instruction
func IsTransferCheck ¶
func IsTransferCheck(ix *adapter.UnifiedInstruction) bool
IsTransferCheck checks if instruction is a transferChecked instruction
func ProcessCompiledExtraAction ¶
func ProcessCompiledExtraAction(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter, actionType string) *types.TransferData
ProcessCompiledExtraAction processes compiled extra actions
func ProcessCompiledNativeTransfer ¶
func ProcessCompiledNativeTransfer(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter) *types.TransferData
ProcessCompiledNativeTransfer processes a compiled native SOL transfer
func ProcessCompiledTransfer ¶
func ProcessCompiledTransfer(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter) *types.TransferData
ProcessCompiledTransfer processes a compiled transfer instruction
func ProcessCompiledTransferCheck ¶
func ProcessCompiledTransferCheck(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter) *types.TransferData
ProcessCompiledTransferCheck processes a compiled transferChecked instruction
func ProcessExtraAction ¶
func ProcessExtraAction(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter, actionType string) *types.TransferData
ProcessExtraAction processes extra actions like mintTo, burn, etc.
func ProcessNativeTransfer ¶
func ProcessNativeTransfer(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter) *types.TransferData
ProcessNativeTransfer processes a native SOL transfer instruction
func ProcessTransfer ¶
func ProcessTransfer(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter) *types.TransferData
ProcessTransfer processes a parsed transfer instruction
func ProcessTransferCheck ¶
func ProcessTransferCheck(ix *adapter.UnifiedInstruction, idx string, adapt *adapter.TransactionAdapter) *types.TransferData
ProcessTransferCheck processes a transferChecked instruction
Types ¶
type BinaryReader ¶
type BinaryReader struct {
// contains filtered or unexported fields
}
BinaryReader provides methods for reading binary data with offset tracking
func GetBinaryReader ¶
func GetBinaryReader(buffer []byte) *BinaryReader
GetBinaryReader gets a BinaryReader from the pool and initializes it
func NewBinaryReader ¶
func NewBinaryReader(buffer []byte) *BinaryReader
NewBinaryReader creates a new BinaryReader from a byte slice
func (*BinaryReader) Error ¶
func (r *BinaryReader) Error() error
Error returns any accumulated error
func (*BinaryReader) GetBuffer ¶
func (r *BinaryReader) GetBuffer() []byte
GetBuffer returns the underlying buffer
func (*BinaryReader) GetOffset ¶
func (r *BinaryReader) GetOffset() int
GetOffset returns the current read position
func (*BinaryReader) HasError ¶
func (r *BinaryReader) HasError() bool
HasError returns true if an error has occurred
func (*BinaryReader) ReadBool ¶
func (r *BinaryReader) ReadBool() (bool, error)
ReadBool reads a boolean value (1 byte)
func (*BinaryReader) ReadFixedArray ¶
func (r *BinaryReader) ReadFixedArray(length int) ([]byte, error)
ReadFixedArray reads a fixed-length byte array
func (*BinaryReader) ReadI128 ¶
func (r *BinaryReader) ReadI128() (lo uint64, hi int64, err error)
ReadI128 reads a signed 128-bit little-endian integer as two int64
func (*BinaryReader) ReadI64 ¶
func (r *BinaryReader) ReadI64() (int64, error)
ReadI64 reads a signed 64-bit little-endian integer
func (*BinaryReader) ReadPubkey ¶
func (r *BinaryReader) ReadPubkey() (string, error)
ReadPubkey reads a 32-byte public key and returns it as base58 string
func (*BinaryReader) ReadString ¶
func (r *BinaryReader) ReadString() (string, error)
ReadString reads a Borsh-encoded string (4-byte length prefix + UTF-8 data)
func (*BinaryReader) ReadU128 ¶
func (r *BinaryReader) ReadU128() (lo, hi uint64, err error)
ReadU128 reads an unsigned 128-bit little-endian integer as two uint64
func (*BinaryReader) ReadU128AsBigInt ¶
func (r *BinaryReader) ReadU128AsBigInt() *big.Int
ReadU128AsBigInt reads a u128 and returns it as *big.Int (convenience method)
func (*BinaryReader) ReadU16 ¶
func (r *BinaryReader) ReadU16() (uint16, error)
ReadU16 reads an unsigned 16-bit little-endian integer
func (*BinaryReader) ReadU32 ¶
func (r *BinaryReader) ReadU32() (uint32, error)
ReadU32 reads an unsigned 32-bit little-endian integer
func (*BinaryReader) ReadU64 ¶
func (r *BinaryReader) ReadU64() (uint64, error)
ReadU64 reads an unsigned 64-bit little-endian integer
func (*BinaryReader) ReadU64AsBigInt ¶
func (r *BinaryReader) ReadU64AsBigInt() *big.Int
ReadU64AsBigInt reads a u64 and returns it as *big.Int (convenience method)
func (*BinaryReader) ReadU8 ¶
func (r *BinaryReader) ReadU8() (uint8, error)
ReadU8 reads an unsigned 8-bit integer
func (*BinaryReader) Release ¶
func (r *BinaryReader) Release()
Release returns the BinaryReader to the pool
func (*BinaryReader) Remaining ¶
func (r *BinaryReader) Remaining() int
Remaining returns the number of unread bytes
func (*BinaryReader) SetOffset ¶
func (r *BinaryReader) SetOffset(offset int) error
SetOffset sets the read position
func (*BinaryReader) Skip ¶
func (r *BinaryReader) Skip(n int) error
Skip advances the offset by n bytes
type TransactionUtils ¶
type TransactionUtils struct {
// contains filtered or unexported fields
}
TransactionUtils provides utility functions for transaction processing
func NewTransactionUtils ¶
func NewTransactionUtils(adapter *adapter.TransactionAdapter) *TransactionUtils
NewTransactionUtils creates a new TransactionUtils instance
func (*TransactionUtils) AttachTokenTransferInfo ¶
func (tu *TransactionUtils) AttachTokenTransferInfo(trade *types.TradeInfo, transferActions map[string][]types.TransferData) *types.TradeInfo
AttachTokenTransferInfo attaches token transfer info to trade
func (*TransactionUtils) AttachTradeFee ¶
func (tu *TransactionUtils) AttachTradeFee(trade *types.TradeInfo) *types.TradeInfo
AttachTradeFee attaches fee information to trade
func (*TransactionUtils) AttachUserBalanceToLPs ¶
func (tu *TransactionUtils) AttachUserBalanceToLPs(liquidities []types.PoolEvent) []types.PoolEvent
AttachUserBalanceToLPs attaches user balance changes to liquidities
func (*TransactionUtils) DetectBot ¶ added in v1.2.0
func (tu *TransactionUtils) DetectBot(trade *types.TradeInfo)
DetectBot detects trading bot from SOL transfers to known bot fee accounts
func (*TransactionUtils) FilterTransfersForInstruction ¶
func (tu *TransactionUtils) FilterTransfersForInstruction(transferActions map[string][]types.TransferData, programId string, outerIndex int, innerIndex int, filterTypes []string) []types.TransferData
FilterTransfersForInstruction filters transfers for a specific instruction
func (*TransactionUtils) GetAdapter ¶
func (tu *TransactionUtils) GetAdapter() *adapter.TransactionAdapter
GetAdapter returns the underlying adapter
func (*TransactionUtils) GetDexInfo ¶
func (tu *TransactionUtils) GetDexInfo(classifier *classifier.InstructionClassifier) types.DexInfo
GetDexInfo extracts DEX information from transaction
func (*TransactionUtils) GetLPTransfers ¶
func (tu *TransactionUtils) GetLPTransfers(transfers []types.TransferData) []types.TransferData
GetLPTransfers sorts and gets LP tokens
func (*TransactionUtils) GetTransferActions ¶
func (tu *TransactionUtils) GetTransferActions(extraTypes []string) map[string][]types.TransferData
GetTransferActions extracts transfer actions from transaction
func (*TransactionUtils) GetTransferInfo ¶
func (tu *TransactionUtils) GetTransferInfo(transferData types.TransferData, timestamp int64, signature string) *types.TransferInfo
GetTransferInfo converts TransferData to TransferInfo format
func (*TransactionUtils) GetTransferInfoList ¶
func (tu *TransactionUtils) GetTransferInfoList(transferDataList []types.TransferData) []types.TransferInfo
GetTransferInfoList converts a list of TransferData to TransferInfo list
func (*TransactionUtils) GetTransferTokenInfo ¶
func (tu *TransactionUtils) GetTransferTokenInfo(transfer *types.TransferData) *types.TokenInfo
GetTransferTokenInfo gets token info from transfer data
func (*TransactionUtils) GetTransfersForInstruction ¶
func (tu *TransactionUtils) GetTransfersForInstruction(transferActions map[string][]types.TransferData, programId string, outerIndex int, innerIndex int, extraTypes []string) []types.TransferData
GetTransfersForInstruction gets transfers for a specific instruction
func (*TransactionUtils) ParseInstructionAction ¶
func (tu *TransactionUtils) ParseInstructionAction(instruction interface{}, idx string, extraTypes []string) *types.TransferData
ParseInstructionAction parses instruction action for transfers
func (*TransactionUtils) ProcessMemeTransferData ¶
func (tu *TransactionUtils) ProcessMemeTransferData( ci types.ClassifiedInstruction, event *types.MemeEvent, baseMint string, skipNative bool, transferStartIdx int, transferActions map[string][]types.TransferData, ) *types.MemeEvent
ProcessMemeTransferData processes transfer data for meme token events
func (*TransactionUtils) ProcessSwapData ¶
func (tu *TransactionUtils) ProcessSwapData(transfers []types.TransferData, dexInfo types.DexInfo, skipNative bool) *types.TradeInfo
ProcessSwapData processes swap data from transfers
func (*TransactionUtils) ProcessTransferInstructions ¶
func (tu *TransactionUtils) ProcessTransferInstructions(outerIndex int, extraTypes []string) []types.TransferData
ProcessTransferInstructions processes transfer instructions for an outer index
func (*TransactionUtils) UpdateMemeTokenInfo ¶
func (tu *TransactionUtils) UpdateMemeTokenInfo(event *types.MemeEvent, trade *types.TradeInfo)
UpdateMemeTokenInfo updates meme event token information from trade data