Fix bloomrouter parser
This commit is contained in:
@@ -3,12 +3,12 @@ package shreder
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/gagliardetto/solana-go"
|
||||
)
|
||||
|
||||
var bloomRouterProgramID = solana.MustPublicKeyFromBase58("b1oomGGqPKGD6errbyfbVMBuzSC8WtAAYo8MwNafWW1")
|
||||
var pumpFunAccount = solana.MustPublicKeyFromBase58("4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf")
|
||||
|
||||
type bloomRouterArgs struct {
|
||||
Side uint16
|
||||
@@ -61,22 +61,27 @@ func parseBloomRouterInstruction(tx VersionedTransaction, instructionIndex int)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var (
|
||||
mint solana.PublicKey
|
||||
ok bool
|
||||
)
|
||||
for _, acctIdx := range instruction.Accounts {
|
||||
var mint solana.PublicKey
|
||||
foundPumpFun := false
|
||||
for i, acctIdx := range instruction.Accounts {
|
||||
key, err := tx.GetAccount(int(acctIdx))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if strings.HasSuffix(key.String(), "pump") {
|
||||
mint = key
|
||||
ok = true
|
||||
if key.Equals(pumpFunAccount) {
|
||||
if i+2 >= len(instruction.Accounts) {
|
||||
return nil, fmt.Errorf("accounts too short for pumpfun mint, idx=%d len=%d", i, len(instruction.Accounts))
|
||||
}
|
||||
mintKey, err := tx.GetAccount(int(instruction.Accounts[i+2]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mint = mintKey
|
||||
foundPumpFun = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !ok {
|
||||
if !foundPumpFun {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user