chore: enable term
This commit is contained in:
@@ -56,6 +56,9 @@ var (
|
|||||||
|
|
||||||
jupiterV6ProgramID = solana.MustPublicKeyFromBase58("JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4")
|
jupiterV6ProgramID = solana.MustPublicKeyFromBase58("JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4")
|
||||||
jupiterV6ProgramIDString = jupiterV6ProgramID.String()
|
jupiterV6ProgramIDString = jupiterV6ProgramID.String()
|
||||||
|
|
||||||
|
gmgnProgramID = solana.MustPublicKeyFromBase58("GMgnVFR8Jb39LoXsEVzb3DvBy3ywCmdmJquHUy1Lrkqb")
|
||||||
|
gmgnProgramIDString = gmgnProgramID.String()
|
||||||
)
|
)
|
||||||
|
|
||||||
type AccountNotFoundError struct {
|
type AccountNotFoundError struct {
|
||||||
@@ -346,6 +349,9 @@ func ParseTransaction(update *SubscribeUpdateTransaction, loader *AddressTables,
|
|||||||
case dflowProgramID:
|
case dflowProgramID:
|
||||||
txRes, err := parseDFlowInstruction(versioned, i)
|
txRes, err := parseDFlowInstruction(versioned, i)
|
||||||
parsed = appendParsed(now, parsed, txRes, err, txHash, "dflow", dflowProgramString)
|
parsed = appendParsed(now, parsed, txRes, err, txHash, "dflow", dflowProgramString)
|
||||||
|
case terminalProgramID:
|
||||||
|
txRes, err := parseTerminalInstruction(versioned, i)
|
||||||
|
parsed = appendParsed(now, parsed, txRes, err, txHash, "padre", terminalProgramIDString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1238,6 +1244,7 @@ func parseTermBuy(tx *versionedTransaction, instruction *compiledInstruction) (*
|
|||||||
Event: "buy",
|
Event: "buy",
|
||||||
IsToken2022: false,
|
IsToken2022: false,
|
||||||
IsMayhemMode: false,
|
IsMayhemMode: false,
|
||||||
|
ExactSOL: true,
|
||||||
Block: tx.Block,
|
Block: tx.Block,
|
||||||
Token0AmountUint64: tokenAmount,
|
Token0AmountUint64: tokenAmount,
|
||||||
Token1AmountUint64: solAmount,
|
Token1AmountUint64: solAmount,
|
||||||
@@ -1273,6 +1280,7 @@ func parseTermSell(tx *versionedTransaction, instruction *compiledInstruction) (
|
|||||||
Event: "buy",
|
Event: "buy",
|
||||||
IsToken2022: false,
|
IsToken2022: false,
|
||||||
IsMayhemMode: false,
|
IsMayhemMode: false,
|
||||||
|
ExactSOL: false,
|
||||||
Block: tx.Block,
|
Block: tx.Block,
|
||||||
Token0AmountUint64: tokenAmount,
|
Token0AmountUint64: tokenAmount,
|
||||||
Token1AmountUint64: solAmount,
|
Token1AmountUint64: solAmount,
|
||||||
@@ -1659,22 +1667,11 @@ func parseTerminalInstruction(tx *versionedTransaction, instructionIndex int) (*
|
|||||||
return parseTermBuy(tx, &instruction)
|
return parseTermBuy(tx, &instruction)
|
||||||
} else if matchMethod(instruction.Data, terminalSellTokensIX) {
|
} else if matchMethod(instruction.Data, terminalSellTokensIX) {
|
||||||
return parseTermSell(tx, &instruction)
|
return parseTermSell(tx, &instruction)
|
||||||
} else if matchMethod(instruction.Data, terminalAmmSellTokensIX) {
|
|
||||||
return parseTermAmmSell(tx, &instruction)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func indexOf(haystack []uint8, needle uint8) int {
|
|
||||||
for i, v := range haystack {
|
|
||||||
if v == needle {
|
|
||||||
return i
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
func matchMethod(data []byte, methods []byte) bool {
|
func matchMethod(data []byte, methods []byte) bool {
|
||||||
if len(data) < len(methods) {
|
if len(data) < len(methods) {
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user