punm parser
This commit is contained in:
12
budget.go
12
budget.go
@@ -10,31 +10,31 @@ type setComputeData struct {
|
||||
Units uint64
|
||||
}
|
||||
|
||||
func budgetParser(result *RawTx, instr Instruction, innerInstructions InnerInstructions, offset [2]uint, tx *Tx) ([2]uint, error) {
|
||||
func budgetParser(tx *Tx, instr Instruction, _ InnerInstructions, offset [2]uint) ([2]uint, error) {
|
||||
if offset[1] != 0 {
|
||||
return increaseOffset(offset), nil
|
||||
}
|
||||
decode := result.Transaction.Message.Instructions[offset[0]].Data
|
||||
decode := instr.Data
|
||||
discriminator := decode[0]
|
||||
|
||||
switch discriminator {
|
||||
case setComputeUnitLimitDiscriminator:
|
||||
return computeUnitLimitParser(result, offset, tx, decode[1:])
|
||||
return computeUnitLimitParser(offset, tx, decode[1:])
|
||||
case setComputeUnitPriceDiscriminator:
|
||||
return computeUnitPriceParser(result, offset, tx, decode[1:])
|
||||
return computeUnitPriceParser(offset, tx, decode[1:])
|
||||
default:
|
||||
return increaseOffset(offset), nil
|
||||
}
|
||||
}
|
||||
|
||||
func computeUnitLimitParser(_ *RawTx, offset [2]uint, _ *Tx, decodedData []byte) ([2]uint, error) {
|
||||
func computeUnitLimitParser(offset [2]uint, _ *Tx, decodedData []byte) ([2]uint, error) {
|
||||
if len(decodedData) < 8 {
|
||||
return increaseOffset(offset), nil
|
||||
}
|
||||
return increaseOffset(offset), nil
|
||||
}
|
||||
|
||||
func computeUnitPriceParser(_ *RawTx, offset [2]uint, tx *Tx, decodedData []byte) ([2]uint, error) {
|
||||
func computeUnitPriceParser(offset [2]uint, tx *Tx, decodedData []byte) ([2]uint, error) {
|
||||
if len(decodedData) < 8 {
|
||||
return increaseOffset(offset), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user