Fix bloomrouter parser
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
rpcURL = "https://staked.helius-rpc.com?api-key=5adcf1f9-5719-43d1-bf3f-c2d4e1e5f94d"
|
rpcURL = "https://staked.helius-rpc.com?api-key=5adcf1f9-5719-43d1-bf3f-c2d4e1e5f94d"
|
||||||
txSignature = "4xkfvs5HrABpZcmbHwvqS6SRY9gYatc9DfqEZ78RCp4bgrMnmfRw4Tv8RSyT7rfDwNzmNAysezAn5TDsVBrbYXy6"
|
txSignature = "4gzWkLRWNLbkBdvyCqg2M4unWA7yg4DdMg8dGTnapw2USsefd9TjXVArhv22qJE9gtex46NwXC4xp1FtNZ1TmjAM"
|
||||||
labelFilter = ""
|
labelFilter = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package shreder
|
|||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/gagliardetto/solana-go"
|
"github.com/gagliardetto/solana-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
var bloomRouterProgramID = solana.MustPublicKeyFromBase58("b1oomGGqPKGD6errbyfbVMBuzSC8WtAAYo8MwNafWW1")
|
var bloomRouterProgramID = solana.MustPublicKeyFromBase58("b1oomGGqPKGD6errbyfbVMBuzSC8WtAAYo8MwNafWW1")
|
||||||
|
var pumpFunAccount = solana.MustPublicKeyFromBase58("4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf")
|
||||||
|
|
||||||
type bloomRouterArgs struct {
|
type bloomRouterArgs struct {
|
||||||
Side uint16
|
Side uint16
|
||||||
@@ -61,22 +61,27 @@ func parseBloomRouterInstruction(tx VersionedTransaction, instructionIndex int)
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var mint solana.PublicKey
|
||||||
mint solana.PublicKey
|
foundPumpFun := false
|
||||||
ok bool
|
for i, acctIdx := range instruction.Accounts {
|
||||||
)
|
|
||||||
for _, acctIdx := range instruction.Accounts {
|
|
||||||
key, err := tx.GetAccount(int(acctIdx))
|
key, err := tx.GetAccount(int(acctIdx))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if strings.HasSuffix(key.String(), "pump") {
|
if key.Equals(pumpFunAccount) {
|
||||||
mint = key
|
if i+2 >= len(instruction.Accounts) {
|
||||||
ok = true
|
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
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !ok {
|
if !foundPumpFun {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user