chore: support pump create
This commit is contained in:
@@ -29,6 +29,15 @@ type pumpBuyArgs struct {
|
||||
}
|
||||
|
||||
type pumpCreateCoinV2Args struct {
|
||||
Name string
|
||||
Symbol string
|
||||
Uri string
|
||||
Creator solana.PublicKey
|
||||
IsMayhemMode bool
|
||||
IsCashbackEnabled bool
|
||||
}
|
||||
|
||||
type legacyPumpCreateCoinV2Args struct {
|
||||
Name string
|
||||
Symbol string
|
||||
Uri string
|
||||
@@ -37,7 +46,6 @@ type pumpCreateCoinV2Args struct {
|
||||
}
|
||||
|
||||
func parsePumpInstruction(msg VersionedTransaction, instructionIndex int) (TxSignalBatch, error) {
|
||||
|
||||
instruction := msg.Instructions[instructionIndex]
|
||||
if len(instruction.Data) < 8 {
|
||||
return nil, fmt.Errorf("data is empty")
|
||||
@@ -114,7 +122,18 @@ func parsePumpCreateV2(tx VersionedTransaction, instruction Instructions) (*TxSi
|
||||
|
||||
var args pumpCreateCoinV2Args
|
||||
if err := borsh.Deserialize(&args, instruction.Data[8:]); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse create coin v2 args: %w", err)
|
||||
var legacyArgs legacyPumpCreateCoinV2Args
|
||||
if err := borsh.Deserialize(&legacyArgs, instruction.Data[8:]); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse create coin v2 args: %w", err)
|
||||
}
|
||||
args = pumpCreateCoinV2Args{
|
||||
Name: legacyArgs.Name,
|
||||
Symbol: legacyArgs.Symbol,
|
||||
Uri: legacyArgs.Uri,
|
||||
Creator: legacyArgs.Creator,
|
||||
IsMayhemMode: legacyArgs.IsMayhemMode,
|
||||
IsCashbackEnabled: false,
|
||||
}
|
||||
}
|
||||
|
||||
return &TxSignal{
|
||||
@@ -129,6 +148,7 @@ func parsePumpCreateV2(tx VersionedTransaction, instruction Instructions) (*TxSi
|
||||
Event: "create",
|
||||
IsToken2022: tokenProgramKey.String() != tokenProgram,
|
||||
IsMayhemMode: args.IsMayhemMode,
|
||||
IsCashbackEnabled: args.IsCashbackEnabled,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: 0,
|
||||
Token1AmountUint64: 0,
|
||||
|
||||
Reference in New Issue
Block a user