chore: add entry contract and improve axiom parse

This commit is contained in:
2026-01-07 12:18:24 +08:00
parent 4afa412231
commit 27dde60e93
2 changed files with 17 additions and 21 deletions

View File

@@ -28,6 +28,7 @@ type TxSignal struct {
IsToken2022 bool `json:"is_token2022"` IsToken2022 bool `json:"is_token2022"`
IsMayhemMode bool `json:"is_mayhem_mode"` IsMayhemMode bool `json:"is_mayhem_mode"`
TxFee decimal.Decimal `json:"tx_fee"` TxFee decimal.Decimal `json:"tx_fee"`
EntryContract string `json:"entry_contract"`
ExactSOL bool `json:"exact_in"` ExactSOL bool `json:"exact_in"`

View File

@@ -161,16 +161,6 @@ type pumpAmmBuyArgs struct {
MaxSolCost uint64 MaxSolCost uint64
} }
type _6hb1BuyArgs struct {
SolAmount uint64
TokenNumber uint64
}
type _8rsrBuyArgs struct {
SolIn uint64
TokenOut uint64
}
type boboBuyArgs struct { type boboBuyArgs struct {
Placeholder1 uint64 Placeholder1 uint64
Placeholder2 uint64 Placeholder2 uint64
@@ -215,46 +205,47 @@ func ParseTransaction(update *SubscribeUpdateTransaction) []*TxSignal {
switch programID { switch programID {
case pumpProgramID: case pumpProgramID:
txRes, err := parsePumpInstruction(versioned, i) txRes, err := parsePumpInstruction(versioned, i)
parsed = appendParsed(parsed, txRes, err, txHash, "pump") parsed = appendParsed(parsed, txRes, err, txHash, "pump", pumpProgramID.String())
case azczProgramID: case azczProgramID:
txRes, err := parseAzczInstruction(versioned, i) txRes, err := parseAzczInstruction(versioned, i)
parsed = appendParsed(parsed, txRes, err, txHash, "azcz") parsed = appendParsed(parsed, txRes, err, txHash, "azcz", azczProgramID.String())
case f5tfProgramID: case f5tfProgramID:
txRes, err := parseF5tfInstruction(versioned, i) txRes, err := parseF5tfInstruction(versioned, i)
parsed = appendParsed(parsed, txRes, err, txHash, "f5tf") parsed = appendParsed(parsed, txRes, err, txHash, "f5tf", f5tfProgramID.String())
case flasProgramID: case flasProgramID:
txRes, err := parseFlasInstruction(versioned, i) txRes, err := parseFlasInstruction(versioned, i)
parsed = appendParsed(parsed, txRes, err, txHash, "flas") parsed = appendParsed(parsed, txRes, err, txHash, "flas", flasProgramID.String())
case photonProgramID: case photonProgramID:
txRes, err := parsePhotonInstruction(versioned, i) txRes, err := parsePhotonInstruction(versioned, i)
parsed = appendParsed(parsed, txRes, err, txHash, "photon") parsed = appendParsed(parsed, txRes, err, txHash, "photon", photonProgramID.String())
case pumpAmmProgramID: case pumpAmmProgramID:
txRes, err := parsePumpAmmInstruction(versioned, i) txRes, err := parsePumpAmmInstruction(versioned, i)
parsed = appendParsed(parsed, txRes, err, txHash, "pumpamm") parsed = appendParsed(parsed, txRes, err, txHash, "pumpamm", pumpAmmProgramID.String())
case boboProgramID: case boboProgramID:
txRes, err := parseBoboInstruction(versioned, i) txRes, err := parseBoboInstruction(versioned, i)
parsed = appendParsed(parsed, txRes, err, txHash, "bobo") parsed = appendParsed(parsed, txRes, err, txHash, "bobo", boboProgramID.String())
case qtkvProgramID: case qtkvProgramID:
txRes, err := parseQtkvInstruction(versioned, i) txRes, err := parseQtkvInstruction(versioned, i)
parsed = appendParsed(parsed, txRes, err, txHash, "qtkv") parsed = appendParsed(parsed, txRes, err, txHash, "qtkv", qtkvProgramID.String())
case fjszProgramID: case fjszProgramID:
txRes, err := parseFjszInstruction(versioned, i) txRes, err := parseFjszInstruction(versioned, i)
parsed = appendParsed(parsed, txRes, err, txHash, "fjsz") parsed = appendParsed(parsed, txRes, err, txHash, "fjsz", fjszProgramID.String())
case terminalProgramID: case terminalProgramID:
txRes, err := parseTermInstruction(versioned, i) txRes, err := parseTermInstruction(versioned, i)
parsed = appendParsed(parsed, txRes, err, txHash, "terminal") parsed = appendParsed(parsed, txRes, err, txHash, "terminal", terminalProgramID.String())
} }
} }
return parsed return parsed
} }
func appendParsed(list []*TxSignal, parsed *TxSignal, err error, txHash [64]byte, label string) []*TxSignal { func appendParsed(list []*TxSignal, parsed *TxSignal, err error, txHash [64]byte, label string, entryContract string) []*TxSignal {
if err != nil { if err != nil {
slog.Error("txparser: failed to parse", "label", label, "instruction", err, "tx_hash", base58.Encode(txHash[:])) slog.Error("txparser: failed to parse", "label", label, "instruction", err, "tx_hash", base58.Encode(txHash[:]))
return list return list
} }
if parsed != nil { if parsed != nil {
parsed.EntryContract = entryContract
list = append(list, parsed) list = append(list, parsed)
} }
return list return list
@@ -859,6 +850,10 @@ func parseFlasBuy(tx *versionedTransaction, instructionIndex int) (*TxSignal, er
return nil, err return nil, err
} }
if len(instruction.Data) > 20 {
instruction.Data = instruction.Data[:20]
}
var args flasBuyArgs var args flasBuyArgs
if err := borsh.Deserialize(&args, instruction.Data[1:]); err != nil { if err := borsh.Deserialize(&args, instruction.Data[1:]); err != nil {
return nil, fmt.Errorf("failed to parse buy tokens args: %w", err) return nil, fmt.Errorf("failed to parse buy tokens args: %w", err)