Solana transaction normalizer, parser, and resolver.
pip install soltxs
This library breaks down Solana transaction introspection and analysis into three steps:
- Normalize: Converts a raw JSON RPC payload into a
Transaction
object. - Parse: Routes each instruction in the
Transaction
to the correct program-level parser. Produces objects describing each recognized instruction. - Resolve: Takes the parsed instructions and converts them into a more human-readable format.
- Normalizers
- Standard RPC Response
- Modified YellowStone Geyser Response
- Parsers
- Compute Budget
- System Program
- Token Program
- PumpFun Program
- Raydium AMM Program
- Resolvers
- PumpFun Swap
- Raydium Swap
import soltxs
tx = {"jsonrpc": ..., "result": ..., "id": ...}
# All three steps below can be combined into a single call
# to the 'process' function. The function below is equivalent to:
# resolve(parse(normalize(tx)))
result = soltxs.process(tx)
norm_tx = soltxs.normalize(tx)
# Transaction(
# slot=...,
# blockTime=...,
# signatures=[...],
# message=...,
# meta=...,
# loadedAddresses=...,
# )
prsd_tx = soltxs.parse(norm_tx)
# [
# <ComputeBudget.SetComputeUnitLimit(...)>,
# <ComputeBudget.SetComputeUnitPrice(...)>,
# <SystemProgram.CreateAccount(...)>,
# <TokenProgram.InitAccount(...)>,
# <RaydiumAMM.Swap(...)>,
# <TokenProgram.Unknown(...)>,
# <SystemProgram.Transfer(...)>,
# <UnknownProgram.Unknown(...)>,
# ]
rsvl_tx = soltxs.resolve(prsd_tx)
# Raydium(
# who=...,
# from_token=...,
# from_amount=...,
# to_token=...,
# to_amount=...,
# minimum_amount_out=...
# )