punm parser
This commit is contained in:
19
system.go
19
system.go
@@ -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])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user