42 lines
1.5 KiB
Go
42 lines
1.5 KiB
Go
package pump_parser
|
|
|
|
import (
|
|
"encoding/base64"
|
|
"fmt"
|
|
|
|
agbinary "github.com/gagliardetto/binary"
|
|
"github.com/gagliardetto/solana-go"
|
|
|
|
"testing"
|
|
)
|
|
|
|
type Pool struct {
|
|
Bump uint8 // 1
|
|
Index uint16 // 3
|
|
Creator solana.PublicKey // 35
|
|
BaseMint solana.PublicKey // 67
|
|
QuoteMint solana.PublicKey // 99
|
|
LpMint solana.PublicKey // 131
|
|
PoolBaseTokenAccount solana.PublicKey // 163
|
|
PoolQuoteTokenAccount solana.PublicKey // 195
|
|
LpSupply uint64 // 203
|
|
CoinCreator solana.PublicKey // 235
|
|
IsMayhemMode bool // 236
|
|
}
|
|
|
|
func TestDecodePoolData(t *testing.T) {
|
|
var base64Data = "8ZptBBGxbbz9AAB/+s6++xNrbunrNkEpE9IY0qfortUqEOB5s3kKGSvL+9H0YLudD5fPy6QWG5FDfdl3FQRE3H804Ivg5J2OnSHvBpuIV/6rgYT7aH9jRhjANdrEOdwa6ztVmKDwAAAAAAGcWzgf1bP0MRLCJXxkgXyazv6CfdxoJGAh01hfNVqrkGoU6aOndSrbraRyP929gjNuQ4qg/nj2RjtLlBazO47we2q7UVSLFd69kGDUes9pm4n4dftp/lIZS068RLXhIR1niGtZ0AMAAFC4Q0TJ2zOhAXgWLRoYc4eSeu9nlTcupLKiXLyIDytOAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="
|
|
data, _ := base64.StdEncoding.DecodeString(base64Data)
|
|
var pool Pool
|
|
fmt.Println("data length:", len(data))
|
|
err := agbinary.NewBorshDecoder(data[8:]).Decode(&pool)
|
|
if err != nil {
|
|
t.Errorf("Failed to decode pool data: %v", err)
|
|
}
|
|
fmt.Println(pool)
|
|
}
|
|
|
|
func TestAmmBuyEvent(t *testing.T) {
|
|
fmt.Println(pumpAmmBuyEventDiscriminator)
|
|
}
|