Skip to content

Latest commit

 

History

History
65 lines (35 loc) · 8.29 KB

cross-language-sync.md

File metadata and controls

65 lines (35 loc) · 8.29 KB

Cross-language synchronization

The SDK and examples use their own language. All replays below run offline; no parser, price tracker, or cached quote hot path requests RPC.

Trade evidence and wrappers

RPC/gRPC uses supplied execution metadata and CPI instructions. Trade events expose optional third_program provenance. Instruction budgets and minimum outputs are not fills; missing execution amounts remain unknown even if the transaction succeeded.

For unknown Shred wrappers whose own account list references Pump.fun, the default callback is PumpFunTrade with unknown trade fields. Only a candidate is known: direction, method, mint, pool and amounts remain defaults. A Pump.fun account reference does not prove a CPI occurred. Count candidates separately from confirmed trades. A missing ALT address remains null and cannot establish a Pump.fun reference.

third_program contains the outer program_id, instruction_index, ordered accounts (including duplicates/nulls), original account_indices, and byte-array instruction_data. Event metadata retains transaction position and receive time. Entries positions are local to a message, not slot-wide execution ordering.

Direction-only subscriptions do not receive unresolved candidates. RawInstruction and PumpRouteIntent callbacks have been removed; subscribe to PumpFunTrade and inspect third_program and instruction inputs. Unknown non-Pump routers do not become confirmed swaps from account references alone. RPC/gRPC decodes supported native CPI swaps normally.

Wrapper input remains opaque. The SDK does not reconstruct third-party instruction arguments or install wrapper rules. See callback and migration details.

Native Pump.fun ALT inputs remain parseable without resolving every declared address. Missing quote/token-program fields stay unknown. The existing PumpFunCreateV2 language variant retains ix_name=create_v2; a raw create scan preserves is_created_buy even with a trade-only filter. Official PumpSwap multi_hop_swap emits one input-only PumpFunTrade per canonical bonding-curve hop. A fixed Pump program account alone is insufficient: all-AMM routes must not emit curve trades. Direction follows unambiguous connected mint pairs; ambiguous direction remains unknown. Route budgets and minimums are not per-hop fills. Original route inputs remain in third_program.

Stock catalog and prices

Both parser and trade SDKs ship the same historical stock-token/pool catalog as Rust. Opt in through the screened catalog API and extend your owned copy. The catalog records fee/reserve observations; it is not live liquidity, a guaranteed executable depth, or a current tax quote. Pool preference reflects historical fees. Revalidate current state before trading.

The parser's StockPriceTracker consumes existing transaction events and produces notifications containing mint, symbol, pool, DEX, quote mint, reported execution price, optional SOL/USDC conversion, and optional supplied liquidity. It requires confirmed execution evidence and validates protocol-specific fields. Unresolved Shred placeholders never produce prices.

The SOL/USDC reference must precede the stock transaction, be fresh, and match the configured reference pool/protocol. Same-transaction conversion is withheld. A stale or missing reference leaves the unavailable denomination null. Supply coherent liquidity separately; unknown liquidity stays null. Reset the tracker on disconnect, dropped events, or a selected-fork change. Offline capture timestamps are replay inputs, not current market time.

Conversion-leg matching checks successful execution, protocol, program ID, pool and both mints. It returns independent matching legs, not a guaranteed connected path. StonkFun naming is retained. Pump.fun/StonkFun/PumpSwap launch origin does not restrict the conversion venue to Raydium or PumpSwap.

Cached trade preparation

Trade SDKs expose a reusable CandidateRouteGraph: construct once when pool identities change and reuse for multiple searches. It owns topology, yields independent paths, enforces budgets and preserves deterministic breadth-first ordering. The compatibility route functions still build a graph per call.

Observed snapshots provide a separate observation watermark without changing actual account slot/write version. Only attest observation after a coherent baseline and continuous provider coverage of every dependency. Account replay, local time and unrelated slot heartbeats do not establish this. Readiness loss invalidates snapshots. Ordinary snapshots retain their conservative age checks.

Native examples

Pump.fun ALT and official multi-hop replay: python examples/pump_execution_replay.py. The offline default includes the three reported create_v2 transactions and the official multi_hop_swap transaction. Pass a signature to fetch a different transaction. Static-key Shred, resolved-ALT Shred, and execution replay are printed separately; tx_index=888 and receive time in this example are caller-supplied demonstration values. Creation callbacks precede their buys, including when the subscription uses the generic create/trade filter. This language retains the PumpFunCreateV2 event name with ix_name=create_v2. Identifiable curve hops emit PumpFunTrade, ix_name=multi_hop_swap, and the original route in third_program. Shred has no per-hop execution amounts, so those fields stay zero. gRPC/RPC retain actual fills and non-SOL quote_amount; sol_amount=0 is valid for a non-SOL quote.

Run from the repository root after installing its development dependencies:

.venv/bin/python examples/stock_price_replay.py
.venv/bin/python examples/stock_route_replay.py
.venv/bin/python examples/pump_execution_replay.py

Stock examples accept --fixture FILE. Parser captures are dated 2026-10-20; trade examples replay normalized legs from those same signatures. Historical wrapper captures remain regression evidence and are not labeled live transactions.

Source changes after 0.10.0 (unreleased)

TradeParseStatus and trade parse_status fields are removed. Keep third_program to inspect original router inputs. Stock prices still require protocol-specific execution fields; unknown Shred inputs cannot produce a price.

Both Pump creation variants now expose optional transaction_version (legacy, v0, v1) and alt_addresses (ALT account keys in original message order, including duplicates). These fields describe the whole transaction, not the Pump instruction version. Without transaction context they remain absent/null. No ALT lookup is performed to obtain them.

Shred subscriptions accept optional auth_token (AuthToken in Go), trim it and send nonblank values as x-token. Examples read SHREDSTREAM_X_TOKEN. Invalid metadata is rejected without including the credential in the error.

Cache resolver callbacks receive (transaction, slot, recv_us, tx_index, event_type_filter) in that order. Update former two-argument callbacks. Callbacks must use prewarmed data; a miss can be handled locally or skipped. tx_index is local to the received batch; recv_us is the caller's receive timestamp.

The wrapper replay now includes the two reported GMGN ALT transactions (2EUPDVEH… and 38NiGzWa…). Each has zero static-key candidates and three candidates after ALT expansion. gRPC/RPC can verify the three executed Pump buys. The saved metadata is offline replay evidence, not a live Shred subscription.

Python: with_address_lookup_resolver returns (writable, readonly) or None. Exceptions reach the subscription error callback and skip that transaction. Protobuf source is checked in as sol_parser/solana-storage.proto; regenerate with grpcio-tools 1.73.1 to retain the protobuf 6.31 runtime floor.

CLMM swap / swap_v2 preserve ix_name, amount, other_amount_threshold, sqrt_price_limit_x64 and is_base_input separately from executed state, matching Rust. Exact-input mode is not swap direction; a price limit is not the ending price. Log/instruction merging preserves actual execution values.

Both public RPC-to-protobuf conversion functions use the same implementation and retain V1 config presence, CPI stack heights, token balances (including owner/program and exact raw amounts), and compute units. convert_rpc_to_grpc keeps its (meta, transaction, error) return order. Invalid CLMM swap boolean bytes are rejected consistently across languages.