From c9845b6f9549295114994cc81ee7a089601af523 Mon Sep 17 00:00:00 2001 From: mike Date: Tue, 13 May 2025 12:08:24 +0300 Subject: [PATCH 1/3] rename module --- go.mod | 2 +- main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 1cf9564..ffa35fa 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/franco-bianco/solanaswap-go +module github.com/fntz/solanaswap-go go 1.23.2 diff --git a/main.go b/main.go index 4694a44..f69cc4c 100644 --- a/main.go +++ b/main.go @@ -6,7 +6,7 @@ import ( "fmt" "log" - solanaswapgo "github.com/franco-bianco/solanaswap-go/solanaswap-go" + solanaswapgo "github.com/fntz/solanaswap-go/solanaswap-go" "github.com/gagliardetto/solana-go" "github.com/gagliardetto/solana-go/rpc" ) From 15f7e0bd97f6699279023f06543b4fb4d3b147e8 Mon Sep 17 00:00:00 2001 From: mike Date: Tue, 13 May 2025 16:34:06 +0300 Subject: [PATCH 2/3] Revert "rename module" This reverts commit c9845b6f9549295114994cc81ee7a089601af523. --- go.mod | 2 +- main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index ffa35fa..1cf9564 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/fntz/solanaswap-go +module github.com/franco-bianco/solanaswap-go go 1.23.2 diff --git a/main.go b/main.go index 3edfec9..90b1f53 100644 --- a/main.go +++ b/main.go @@ -6,7 +6,7 @@ import ( "fmt" "log" - solanaswapgo "github.com/fntz/solanaswap-go/solanaswap-go" + solanaswapgo "github.com/franco-bianco/solanaswap-go/solanaswap-go" "github.com/gagliardetto/solana-go" "github.com/gagliardetto/solana-go/rpc" ) From 612e080f62845188a7a90de9037f2ed215615cfb Mon Sep 17 00:00:00 2001 From: mike Date: Tue, 13 May 2025 17:10:48 +0300 Subject: [PATCH 3/3] add pumpfun create event support --- solanaswap-go/checks.go | 11 +++++++++++ solanaswap-go/event_pumpfun.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/solanaswap-go/checks.go b/solanaswap-go/checks.go index d277de6..3d72406 100644 --- a/solanaswap-go/checks.go +++ b/solanaswap-go/checks.go @@ -68,6 +68,17 @@ func (p *Parser) isPumpFunTradeEventInstruction(inst solana.CompiledInstruction) return bytes.Equal(decodedBytes[:16], PumpfunTradeEventDiscriminator[:]) } +func (p *Parser) isPumpFunCreateEventInstruction(inst solana.CompiledInstruction) bool { + if !p.allAccountKeys[inst.ProgramIDIndex].Equals(PUMP_FUN_PROGRAM_ID) || len(inst.Data) < 16 { + return false + } + decodedBytes, err := base58.Decode(inst.Data.String()) + if err != nil { + return false + } + return bytes.Equal(decodedBytes[:16], PumpfunCreateEventDiscriminator[:]) +} + func (p *Parser) isJupiterRouteEventInstruction(inst solana.CompiledInstruction) bool { if !p.allAccountKeys[inst.ProgramIDIndex].Equals(JUPITER_PROGRAM_ID) || len(inst.Data) < 16 { return false diff --git a/solanaswap-go/event_pumpfun.go b/solanaswap-go/event_pumpfun.go index a427d3d..5c51244 100644 --- a/solanaswap-go/event_pumpfun.go +++ b/solanaswap-go/event_pumpfun.go @@ -47,6 +47,15 @@ func (p *Parser) processPumpfunSwaps(instructionIndex int) []SwapData { swaps = append(swaps, SwapData{Type: PUMP_FUN, Data: eventData}) } } + if p.isPumpFunCreateEventInstruction(innerInstruction) { + eventData, err := p.parsePumpfunCreateEventInstruction(innerInstruction) + if err != nil { + p.Log.Errorf("error processing Pumpfun create event: %s", err) + } + if eventData != nil { + swaps = append(swaps, SwapData{Type: PUMP_FUN, Data: eventData}) + } + } } } } @@ -94,3 +103,22 @@ func handlePumpfunTradeEvent(decoder *ag_binary.Decoder) (*PumpfunTradeEvent, er return &trade, nil } + +func (p *Parser) parsePumpfunCreateEventInstruction(instruction solana.CompiledInstruction) (*PumpfunCreateEvent, error) { + decodedBytes, err := base58.Decode(instruction.Data.String()) + if err != nil { + return nil, fmt.Errorf("error decoding instruction data: %s", err) + } + decoder := ag_binary.NewBorshDecoder(decodedBytes[16:]) + + return handlePumpfunCreateEvent(decoder) +} + +func handlePumpfunCreateEvent(decoder *ag_binary.Decoder) (*PumpfunCreateEvent, error) { + var trade PumpfunCreateEvent + if err := decoder.Decode(&trade); err != nil { + return nil, fmt.Errorf("error unmarshaling TradeEvent: %s", err) + } + + return &trade, nil +}