Fix jupitor
This commit is contained in:
@@ -1396,6 +1396,13 @@ func parseJupiterV6Instruction(tx VersionedTransaction, instructionIndex int) (T
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
if bytes.Equal(disc, jupiterRoute) {
|
if bytes.Equal(disc, jupiterRoute) {
|
||||||
|
pumpMint, ok, err := findPumpFunMint(tx, instruction.Accounts)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if !ok {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
if len(instruction.Accounts) < 13 {
|
if len(instruction.Accounts) < 13 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
@@ -1411,10 +1418,6 @@ func parseJupiterV6Instruction(tx VersionedTransaction, instructionIndex int) (T
|
|||||||
if !pumpKey.Equals(pumpProgramID) {
|
if !pumpKey.Equals(pumpProgramID) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
token0Mint, err := tx.GetAccount(int(instruction.Accounts[12]))
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
token0Amount := decimal.Zero
|
token0Amount := decimal.Zero
|
||||||
if routeIn > 0 {
|
if routeIn > 0 {
|
||||||
token0Amount = formatTokenAmount(routeIn)
|
token0Amount = formatTokenAmount(routeIn)
|
||||||
@@ -1422,7 +1425,7 @@ func parseJupiterV6Instruction(tx VersionedTransaction, instructionIndex int) (T
|
|||||||
return TxSignalBatch{&TxSignal{
|
return TxSignalBatch{&TxSignal{
|
||||||
TxHash: tx.Signatures[0].String(),
|
TxHash: tx.Signatures[0].String(),
|
||||||
Maker: tx.StaticAccountKeys[0].String(),
|
Maker: tx.StaticAccountKeys[0].String(),
|
||||||
Token0Address: token0Mint.String(),
|
Token0Address: pumpMint.String(),
|
||||||
Token1Address: destMint.String(),
|
Token1Address: destMint.String(),
|
||||||
Token0Amount: token0Amount,
|
Token0Amount: token0Amount,
|
||||||
Token1Amount: decimal.Zero,
|
Token1Amount: decimal.Zero,
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package shreder
|
|||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/gagliardetto/solana-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDecodeRouteV2Arg(t *testing.T) {
|
func TestDecodeRouteV2Arg(t *testing.T) {
|
||||||
@@ -90,3 +92,70 @@ func TestDecodeRouteArg(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestParseJupiterV6RouteDoesNotMisclassifyMeteoraDlmmAsPump(t *testing.T) {
|
||||||
|
instrData, err := hex.DecodeString("e517cb977ae3ad2a0100000026640001b9fe480300000000187dbe35000000002c0100")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to decode instruction data: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
accountStrs := []string{
|
||||||
|
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
|
||||||
|
"7Ubi7vPnj5E2WdMtpA21mQoZmpY2TnrDqWpHJg2j2k7z",
|
||||||
|
"F7GdscGrjA8YwmiRaJNnbFAtmU6pmncwJX2Q6TNEVtWJ",
|
||||||
|
"4tBgpAzd4QRCSKDkmSaRVqWpnKmRJjT5djjhaspNxUWR",
|
||||||
|
"JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4",
|
||||||
|
"CreiuhfwdWCN5mJbMJtA9bBpYQrQF2tCBuZwSPWfpump",
|
||||||
|
"JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4",
|
||||||
|
"D8cy77BBepLMngZx6ZukaTff5hCt1HrWyKk3Hnd9oitf",
|
||||||
|
"JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4",
|
||||||
|
"LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo",
|
||||||
|
"6bh2zL833toG7TnbBn2HEi6vLBbMTEwREk6YPZYQThDK",
|
||||||
|
"7Arfi1EzAiSMdbbwsEwUzndDGQzw1bHrVHir2cZmYi96",
|
||||||
|
"8SQXJSUGrwRuh1fRtta2pGTXSKztboatnDjV9hdi7Kon",
|
||||||
|
"G6SuCjTPhddLpUd7uUh5NJCpEhfg5oeN5vKxYmvnDX6i",
|
||||||
|
"F7GdscGrjA8YwmiRaJNnbFAtmU6pmncwJX2Q6TNEVtWJ",
|
||||||
|
"4tBgpAzd4QRCSKDkmSaRVqWpnKmRJjT5djjhaspNxUWR",
|
||||||
|
"CreiuhfwdWCN5mJbMJtA9bBpYQrQF2tCBuZwSPWfpump",
|
||||||
|
"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
|
||||||
|
"9CuRuTiaNQjKyX73iPGY2n3qUZmP2Fyk4RvXKaHEksqj",
|
||||||
|
"LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo",
|
||||||
|
"7Ubi7vPnj5E2WdMtpA21mQoZmpY2TnrDqWpHJg2j2k7z",
|
||||||
|
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
|
||||||
|
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
|
||||||
|
"D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6",
|
||||||
|
"LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo",
|
||||||
|
"BAxxa7cjHvqbSGpowcpinGxNKN66B9vwsMhSNzUWuS69",
|
||||||
|
"99nHJNiPJBBupPfK7jdEsvx9KoHxSbeqSAfyn2qgboFA",
|
||||||
|
"JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4",
|
||||||
|
}
|
||||||
|
|
||||||
|
accounts := make([]solana.PublicKey, 0, len(accountStrs))
|
||||||
|
accountIndexes := make([]uint8, 0, len(accountStrs))
|
||||||
|
for i, account := range accountStrs {
|
||||||
|
accounts = append(accounts, solana.MustPublicKeyFromBase58(account))
|
||||||
|
accountIndexes = append(accountIndexes, uint8(i))
|
||||||
|
}
|
||||||
|
|
||||||
|
tx := VersionedTransaction{
|
||||||
|
Signatures: []solana.Signature{
|
||||||
|
solana.MustSignatureFromBase58("3AJSh1Dv4MHQL8UKLiVRkbAX2D45VRtNro68am9Dd66kh89khuFQGtsf8x1yx6m3pGSXU8vagb7Q4YfGXsfMzgEy"),
|
||||||
|
},
|
||||||
|
StaticAccountKeys: accounts,
|
||||||
|
Instructions: []Instructions{
|
||||||
|
{
|
||||||
|
ProgramIDIndex: 4,
|
||||||
|
Accounts: accountIndexes,
|
||||||
|
Data: instrData,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
signals, err := parseJupiterV6Instruction(tx, 0)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("parseJupiterV6Instruction returned error: %v", err)
|
||||||
|
}
|
||||||
|
if len(signals) != 0 {
|
||||||
|
t.Fatalf("expected no signal for Meteora DLMM route, got %+v", signals)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user