punm parser

This commit is contained in:
thloyi
2025-11-21 12:01:44 +08:00
parent a945f3b45d
commit f86c5591c1
13 changed files with 228 additions and 148 deletions

View File

@@ -7,23 +7,10 @@ import (
"github.com/shopspring/decimal"
)
func systemParser(result *RawTx, instr Instruction, innerInstructions InnerInstructions, offset [2]uint, tx *Tx) ([2]uint, error) {
var instruction Instruction
func systemParser(tx *Tx, instruction Instruction, _ InnerInstructions, offset [2]uint) ([2]uint, error) {
var found bool
if offset[1] == 0 {
instruction = result.Transaction.Message.Instructions[offset[0]]
found = true
} else {
for _, innerInstruction := range result.Meta.InnerInstructions {
if innerInstruction.Index == int(offset[0]) {
instruction = innerInstruction.Instructions[offset[1]-1]
found = true
break
}
}
}
if !found {
result := tx.rawTx
if !result.accountList[instruction.ProgramIDIndex].Equals(systemProgram) {
return increaseOffset(offset), fmt.Errorf("system program instruction not found, block: %d, tx: %s, outerIndex: %d, innerIndex: %d", result.Slot, result.TxHash(), offset[0], offset[1])
}