6 Commits

Author SHA1 Message Date
thloyi
c20e019b43 update jup enum 2026-03-03 14:25:46 +08:00
cachalots
c7be7cf4fd culimit 2026-02-27 16:45:57 +08:00
cachalots
62c313d4a1 culimit 2026-02-27 15:41:20 +08:00
cachalots
5fa6944a37 culimit 2026-02-27 15:40:18 +08:00
cachalots
5d06d18aa8 culimit 2026-02-27 15:32:36 +08:00
9877794d1c fix: flas buy/sell 2026-02-21 19:03:00 +08:00
4 changed files with 34 additions and 12 deletions

View File

@@ -140,11 +140,11 @@ func parseFlasAmmBuy(tx VersionedTransaction, instructionIndex int) (*TxSignal,
func parseFlasSell(tx VersionedTransaction, instructionIndex int) (*TxSignal, error) {
instruction := tx.Instructions[instructionIndex]
if len(instruction.Accounts) < 9 {
if len(instruction.Accounts) < 11 {
return nil, fmt.Errorf("accounts too short")
}
mint, err := tx.GetAccount(int(instruction.Accounts[8]))
mint, err := tx.GetAccount(int(instruction.Accounts[10]))
if err != nil {
return nil, err
}
@@ -178,15 +178,15 @@ func parseFlasSell(tx VersionedTransaction, instructionIndex int) (*TxSignal, er
func parseFlasBuy(tx VersionedTransaction, instructionIndex int) (*TxSignal, error) {
instruction := tx.Instructions[instructionIndex]
if len(instruction.Accounts) < 9 {
if len(instruction.Accounts) < 11 {
return nil, fmt.Errorf("accounts too short")
}
mint, err := tx.GetAccount(int(instruction.Accounts[8]))
mint, err := tx.GetAccount(int(instruction.Accounts[10]))
if err != nil {
return nil, err
}
user, err := tx.GetAccount(int(instruction.Accounts[0]))
user, err := tx.GetAccount(int(instruction.Accounts[1]))
if err != nil {
return nil, err
}

View File

@@ -160,6 +160,8 @@ const (
Scorch
VaultLiquidUnstake
XOrca
Quantum
WhaleStreetV2
)
var swapKindNames = [122]string{"Saber", "SaberAddDecimalsDeposit", "SaberAddDecimalsWithdraw", "TokenSwap", "Sencha", "Step", "Cropper",
@@ -333,8 +335,20 @@ func decodeSwap(dec *bin.Decoder) (Swap, error) {
case RaydiumLaunchlabBuy, RaydiumLaunchlabSell:
return out, skipU64()
// -------- Side(u8) payload --------
case Serum, Aldrin, AldrinV2, Dradex, Openbook, Phoenix, OpenBookV2, TokenMill, Plasma, TesseraV, Futarchy, WhaleStreet, Manifest:
case Serum, Aldrin, AldrinV2, Dradex, Openbook, Phoenix, OpenBookV2, TokenMill, Plasma, TesseraV, Futarchy,
WhaleStreet, Manifest, Quantum:
return out, skipU8()
case WhaleStreetV2:
if err := skipU8(); err != nil {
return Swap{}, err
}
if err := skipU64(); err != nil {
return Swap{}, err
}
if err := skipU64(); err != nil {
return Swap{}, err
}
return out, nil
// -------- MeteoraDlmmSwapV2: RemainingAccountsInfo --------
case MeteoraDlmmSwapV2:
return out, skipRemaining()

View File

@@ -45,8 +45,10 @@ type TxSignal struct {
IsToken2022 bool `json:"is_token2022"`
IsMayhemMode bool `json:"is_mayhem_mode"`
CUPrice decimal.Decimal `json:"cu_price"`
CULimit uint32 `json:"cu_limit"`
SWQoSAgent string `json:"swqos_agent"`
SWQoSTips decimal.Decimal `json:"swqos_tips"`
TableCnt int `json:"table_cnt"`
ExactSOL bool `json:"exact_in"`

View File

@@ -182,7 +182,8 @@ func ParseTransactionForEntries(ctx context.Context, slot uint64, entriesReader
}
func ParseTransactionWithHandler(ctx context.Context, versioned VersionedTransaction, loader *AddressTables, parsed chan<- TxSignal, handlers map[solana.PublicKey]Handler) {
if loader != nil && len(versioned.AddressTableLookups) > 0 {
tableCnt := len(versioned.AddressTableLookups)
if loader != nil && tableCnt > 0 {
lookupTableOk := true
for _, lookups := range versioned.AddressTableLookups {
lookupTableOk = loader.FillToTx(&versioned, lookups.AccountKey, lookups.WritableIndexes)
@@ -203,16 +204,19 @@ func ParseTransactionWithHandler(ctx context.Context, versioned VersionedTransac
cuPrice := decimal.Zero
swqosAgent := ""
swqosTips := decimal.Zero
cuLimit := uint32(0)
for _, instruction := range versioned.Instructions {
program, err := versioned.GetAccount(int(instruction.ProgramIDIndex))
if err != nil {
continue
}
if program.Equals(ComputeBudgetProgram) &&
len(instruction.Data) == 9 &&
instruction.Data[0] == 0x03 {
if program.Equals(ComputeBudgetProgram) {
if len(instruction.Data) == 9 && instruction.Data[0] == 0x03 {
cuPriceUint64 := binary.LittleEndian.Uint64(instruction.Data[1:9])
cuPrice = formatCUPrice(cuPriceUint64)
} else if len(instruction.Data) == 5 && instruction.Data[0] == 0x02 {
cuLimit = binary.LittleEndian.Uint32(instruction.Data[1:5])
}
}
if program.Equals(solana.SystemProgramID) &&
len(instruction.Data) == 12 &&
@@ -260,8 +264,10 @@ func ParseTransactionWithHandler(ctx context.Context, versioned VersionedTransac
one.Label = handler.Label
one.Block = versioned.Block
one.CUPrice = cuPrice
one.CULimit = cuLimit
one.SWQoSAgent = swqosAgent
one.SWQoSTips = swqosTips
one.TableCnt = tableCnt
select {
case <-ctx.Done():
return