fix ignore failed metaora swap

This commit is contained in:
thloyi
2026-04-22 11:16:26 +08:00
parent bb858c643e
commit 273e87b8ad
2 changed files with 28 additions and 2 deletions

View File

@@ -16,8 +16,8 @@ type metaoraPoolInitializePoolData struct {
} }
type metaoraPoolSwapArgs struct { type metaoraPoolSwapArgs struct {
InAmount uint64 InAmount uint64
MinimumOutAmount uint64 MinimumOutAmount uint64
} }
var ( var (
@@ -855,6 +855,9 @@ func metaoraPoolSwap(tx *Tx, instruction Instruction, innerInstructions InnerIns
} }
} }
if !baseFound || !quoteFound { if !baseFound || !quoteFound {
if args.InAmount == 0 {
return nil, increaseOffset(offset), InstructionIgnoredError
}
return nil, increaseOffset(offset), fmt.Errorf("failed to find meteora pool event in inner instructions") return nil, increaseOffset(offset), fmt.Errorf("failed to find meteora pool event in inner instructions")
} }

23
orcawhirpool_test.go Normal file
View File

@@ -0,0 +1,23 @@
package pump_parser
import "testing"
func TestOrcaWhirlpoolRemoveLiquidityPreservesLargeUint64TransferAmounts(t *testing.T) {
EnableAllParsers()
tx := mustParseRPCFixtureTx(t, "4sj82GCLtgTDExq7B8YrBsrrqPcE4FqT5Y1gKWmE4cHMDxs7wkCV1hik73dSZ99gZm3K4wyBZQ6U8Nmf48rM9Jri")
if len(tx.Swaps) == 0 {
t.Fatal("expected parsed swaps")
}
swap := tx.Swaps[0]
if swap.Program != SolProgramOrcaWhirPool {
t.Fatalf("program = %s, want %s", swap.Program, SolProgramOrcaWhirPool)
}
if swap.Event != TxEventRemoveLiquidity {
t.Fatalf("event = %s, want %s", swap.Event, TxEventRemoveLiquidity)
}
assertDecimalString(t, "base_amount", swap.BaseAmount, "101086439062")
assertDecimalString(t, "quote_amount", swap.QuoteAmount, "9863327902766042414")
}