2025-11-24 17:47:56 +08:00
|
|
|
package pump_parser
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"encoding/hex"
|
2025-11-27 16:39:01 +08:00
|
|
|
"fmt"
|
2025-11-24 17:47:56 +08:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
agbinary "github.com/gagliardetto/binary"
|
2025-11-27 16:39:01 +08:00
|
|
|
"github.com/mr-tron/base58"
|
2025-11-24 17:47:56 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestTradeEvent(t *testing.T) {
|
|
|
|
|
hexData := "e445a52e51cb9a1dbddb7fd34ee661ee051d1834b36cc6f04cc5bd998d53ab2a566a0ca2415bcfad5f9ed6941a851d3f84ecb200000000006c267d17170000000190d2c525ef0ea205f4b4abfdb6eaaf37fcb5a1b1dec2e2689448eecab6ba93b6c922246900000000c314f11a0d000000be71bf9e22080200c368cd1e06000000bed9ac52910901004ac2f8d0dd5cbc97e3289c197cb5062a54f3d956b9ce6e5115f96567aa5cb3e65f000000000000002c6a010000000000c9e17c171227a50a5b62e3a4a3f8ff4fafe0bca9c332bdf7f32eedbc4229604d1e000000000000005f72000000000000010000000000000000000000000000000000000000000000000000000000000000100000006275795f65786163745f736f6c5f696e"
|
|
|
|
|
d, err := hex.DecodeString(hexData)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Errorf("Failed to decode base64 data: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var tradeEvent PumpTradeEvent
|
|
|
|
|
|
|
|
|
|
err = agbinary.NewBorshDecoder(d[16:]).Decode(&tradeEvent)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Errorf("Failed to deserialize trade event: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t.Logf("Trade Event: %+v", tradeEvent)
|
|
|
|
|
|
2025-11-27 16:39:01 +08:00
|
|
|
xx, err := base58.Decode("3Bxs48EzTZB4tzRd")
|
|
|
|
|
fmt.Println(len(xx), err)
|
|
|
|
|
|
2025-11-24 17:47:56 +08:00
|
|
|
}
|