1
This commit is contained in:
11
parser.go
11
parser.go
@@ -17,6 +17,17 @@ var actionPrograms = map[solana.PublicKey]actionParser{
|
|||||||
budgGetProgram: budgetParser,
|
budgGetProgram: budgetParser,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ParseRawTx(rawTx *RawTx) (*Tx, error) {
|
||||||
|
tx := &Tx{
|
||||||
|
rawTx: rawTx,
|
||||||
|
}
|
||||||
|
err := tx.Parser()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return tx, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (tx *Tx) Parser() error {
|
func (tx *Tx) Parser() error {
|
||||||
if tx.rawTx == nil {
|
if tx.rawTx == nil {
|
||||||
return errors.New("rawTx is nil")
|
return errors.New("rawTx is nil")
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ package pump_parser
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
agbinary "github.com/gagliardetto/binary"
|
agbinary "github.com/gagliardetto/binary"
|
||||||
|
"github.com/mr-tron/base58"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTradeEvent(t *testing.T) {
|
func TestTradeEvent(t *testing.T) {
|
||||||
@@ -23,4 +25,7 @@ func TestTradeEvent(t *testing.T) {
|
|||||||
|
|
||||||
t.Logf("Trade Event: %+v", tradeEvent)
|
t.Logf("Trade Event: %+v", tradeEvent)
|
||||||
|
|
||||||
|
xx, err := base58.Decode("3Bxs48EzTZB4tzRd")
|
||||||
|
fmt.Println(len(xx), err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user