@@ -222,12 +222,8 @@ them):
222222 input records** — ` swap_many ` implements the recipe; copy it, don't
223223 improvise.
224224
225- Suggested path for a new integrator: (1) ` onboard() ` a profile — it
226- doubles as a test fixture; (2) walk swap → ` collect_all() ` once with the
227- Tier 1 methods so the mechanics are concrete; (3) read the reference below
228- for the surface your app needs; (4) ` tests/integration/ ` and
229- ` scripts/rehearsal.py ` in the repo are working reference implementations
230- of the full journey.
225+ For the funding, swap, and claim flow, see
226+ ` examples/first-swap/ ` .
231227
232228Every write method returns a prepared ` DexCall ` : nothing touches the
233229network until a terminal method — ` .simulate() ` (local, free),
@@ -405,48 +401,54 @@ exhausting it raises — the fail-fast for a systematically wrong program.
405401
406402### Chain methods
407403
408- ### ` swap (self, *, pool_key : 'str', token_in_id: 'str', amount_in: 'int | str | Decimal', slippage_bps: 'int' = 50, expected_out : 'Optional[int | str | Decimal]' = None, sqrt_price_limit: 'Optional[int]' = None, deadline_offset_blocks: 'int' = 10000, nonce: 'Optional[int]' = None, identity: 'Optional[BlindedIdentity]' = None, token_in_program: 'Optional[str]' = None, token_record: 'Optional[str]' = None, record_wait_seconds: ' float' = 0 .0, wrapper_proofs: 'Optional[str]' = None, track: 'bool' = True, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[SwapHandle] '`
404+ ### ` confirm_airdrop (self, *, timeout : 'float' = 600.0, poll_interval : 'float' = 5 .0, account: 'Any' = None) -> 'ConfirmAirdropResult '`
409405
410- Prepare one private swap; submit with `` transact() `` or `` delegate() `` .
406+ Fund the account and wait for its airdrop records to become spendable .
411407
412- Integer `` amount_in `` and `` expected_out `` values are base units.
413- Strings and `` Decimal `` values are token units (`` "1.5" `` means 1.5
414- tokens), converted exactly with registry metadata. Floats, excess
415- precision, non-finite values, and amounts outside u128 are rejected.
416- Returned handle amounts remain in base units.
408+ Requires API authentication and scanner registration. `` timeout `` covers
409+ faucet settlement and scanning. Check `` success `` and `` error `` before
410+ swapping. A record timeout retains the transfer results; inspect those
411+ transactions before requesting another airdrop. Scanner errors propagate.
417412
418- Quote with `` api.get_route `` and pass `` expected_out `` . Without a quote,
419- the spot estimate ignores fees and price impact. Wrapped inputs use
420- underlying token records and route through the swap router automatically.
421- `` record_wait_seconds `` waits for a covering record (default 0);
422- `` token_record `` bypasses scanning. Provider errors propagate.
413+ ### ` quote(self, *, token_in: 'str', token_out: 'str', amount_in: 'str | Decimal', slippage_bps: 'int' = 50) -> 'SwapQuote' `
423414
424- Preparing a call reserves a blinding counter when a journal is attached,
425- even if the call is discarded or only simulated. The journal retains the
426- handle after submission. Without a journal, retain the returned handle
427- for claiming and avoid concurrent swaps: chain probing cannot reserve
428- counters atomically. `` identity `` supplies an explicit identity;
429- `` track=False `` bypasses journal reservation.
415+ Quote a direct or multi-hop swap from two symbols and a token amount.
430416
431- `` deadline_offset_blocks `` defaults to 10,000 (~ 8 hours at 3s/block)
432- to allow delegated proving; an expired deadline rejects at finalize.
417+ Returns the API's best route and final slippage floor; pass it to
418+ `` swap(quote) `` . Requires API authentication. Quoting spends no funds
419+ and needs no record scanning or transaction signature.
433420
434- ### ` claim_swap_output (self, handle : 'SwapHandle' , *, wrapper_proofs: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[ClaimResult ]'`
421+ ### ` swap (self, quote : 'Optional[SwapQuote]' = None , *, pool_key: 'Optional[str]' = None, token_in_id: 'Optional[str]' = None, amount_in: 'Optional[int | str | Decimal]' = None, slippage_bps: 'Optional[int]' = None, expected_out: 'Optional[int | str | Decimal]' = None, sqrt_price_limit: 'Optional[int]' = None, deadline_offset_blocks: 'int' = 10000, nonce: 'Optional[int]' = None, identity: 'Optional[BlindedIdentity]' = None, token_in_program: 'Optional[str]' = None, token_record: 'Optional[str]' = None, wrapper_proofs: 'Optional[str]' = None, track: 'bool' = True, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[SwapHandle ]'`
435422
436- Claim a private swap's output — phase two of the lifecycle.
423+ Prepare a direct or multi-hop swap; submit with transact/delegate.
424+
425+ Pass a `` SwapQuote `` to execute its full route and final slippage floor.
426+ Alternatively pass pool_key, token_in_id, and amount_in for one pool;
427+ trade parameters cannot override a quote. Legacy strings/Decimal use
428+ token units, integers base units. Returned handle amounts are base units.
429+
430+ Wrapped inputs spend underlying records. `` token_record `` bypasses scanning.
431+ Journaled calls reserve a counter during preparation and retain the
432+ submitted handle. Without a journal, save the handle and avoid concurrent
433+ swaps; use an explicit identity for concurrency. `` track=False `` bypasses
434+ journaling. `` deadline_offset_blocks `` defaults to 10,000 (~ 8 hours).
435+
436+ ### ` claim_swap_output(self, handle: 'SwapHandle', *, timeout: 'float' = 0.0, wrapper_proofs: 'Optional[str]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[ClaimResult]' `
437+
438+ Claim a private swap's output.
439+
440+ With a journal, `` delegate(wait=True) `` or `` transact(wait=True) ``
441+ records the confirmed claim automatically.
437442
438443Reads the chain-computed result from `` swap_outputs `` (never an
439444off-chain service — these amounts gate money movement), proves
440- ownership of the blinded identity, and claims. A wrapped output or
441- refund routes automatically through the router, which unwraps to
442- the signer in the same transaction — even for swaps that started
443- as direct core calls. The output and any refund arrive as private
444- records owned by the signer (output first, refund second); the
445- mapping entry is consumed.
446-
447- Raises :class:` SwapOutputNotFinalizedError ` ** at prepare time** when
448- the output is not readable yet (retry after a few blocks) or was
449- already claimed.
445+ ownership of the blinded identity, and claims. Wrapped tokens unwrap
446+ automatically. Output and refunds arrive as private records owned by
447+ the signer; claiming consumes the mapping entry.
448+
449+ After swap confirmation, `` timeout `` sets the maximum wait in seconds
450+ (default 0). Missing output is polled every 2s without submitting. Timeout raises
451+ `` SwapOutputNotFinalizedError `` ; other errors propagate.
450452
451453### ` create_pool(self, *, token0_id: 'str', token1_id: 'str', fee: 'int', initial_tick: 'int', tick_spacing: 'Optional[int]' = None, initial_sqrt_price: 'Optional[int]' = None, imports: 'Optional[dict[str, str]]' = None, account: 'Any' = None) -> 'DexCall[TxResult]' `
452454
0 commit comments