chore: enable term
This commit is contained in:
@@ -56,6 +56,9 @@ var (
|
||||
|
||||
jupiterV6ProgramID = solana.MustPublicKeyFromBase58("JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4")
|
||||
jupiterV6ProgramIDString = jupiterV6ProgramID.String()
|
||||
|
||||
gmgnProgramID = solana.MustPublicKeyFromBase58("GMgnVFR8Jb39LoXsEVzb3DvBy3ywCmdmJquHUy1Lrkqb")
|
||||
gmgnProgramIDString = gmgnProgramID.String()
|
||||
)
|
||||
|
||||
type AccountNotFoundError struct {
|
||||
@@ -346,6 +349,9 @@ func ParseTransaction(update *SubscribeUpdateTransaction, loader *AddressTables,
|
||||
case dflowProgramID:
|
||||
txRes, err := parseDFlowInstruction(versioned, i)
|
||||
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",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: true,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: tokenAmount,
|
||||
Token1AmountUint64: solAmount,
|
||||
@@ -1273,6 +1280,7 @@ func parseTermSell(tx *versionedTransaction, instruction *compiledInstruction) (
|
||||
Event: "buy",
|
||||
IsToken2022: false,
|
||||
IsMayhemMode: false,
|
||||
ExactSOL: false,
|
||||
Block: tx.Block,
|
||||
Token0AmountUint64: tokenAmount,
|
||||
Token1AmountUint64: solAmount,
|
||||
@@ -1659,22 +1667,11 @@ func parseTerminalInstruction(tx *versionedTransaction, instructionIndex int) (*
|
||||
return parseTermBuy(tx, &instruction)
|
||||
} else if matchMethod(instruction.Data, terminalSellTokensIX) {
|
||||
return parseTermSell(tx, &instruction)
|
||||
} else if matchMethod(instruction.Data, terminalAmmSellTokensIX) {
|
||||
return parseTermAmmSell(tx, &instruction)
|
||||
}
|
||||
|
||||
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 {
|
||||
if len(data) < len(methods) {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user