StargateSwap2Config
Defined in: protocol-swap2-stargate/src/protocol.ts:5
Extends
Section titled “Extends”Swap2EngineConfigStargateProviderConfig
Properties
Section titled “Properties”accountChain?
Section titled “accountChain?”
optionalaccountChain?:string
Defined in: protocol-swap2-core/dist/base-6gRdyyWr.d.ts:164
Optional account chain identity when the account does not expose a provider.
Inherited from
Section titled “Inherited from”Swap2EngineConfig.accountChain
allowanceReuse?
Section titled “allowanceReuse?”
optionalallowanceReuse?:Swap2AllowanceReuse
Defined in: protocol-swap2-core/dist/base-6gRdyyWr.d.ts:259
What an ERC-20 swap does with an allowance already in place for its spender (README, “Approvals”); swap2()’s
second argument overrides it per execution (Swap2ExecutionConfig).
"exact"(default, the 0.17.0 behaviour): the allowance is set to exactly the input unless it already equals it (a Permit2 allowance covering the input is left as it is); a different one is overwritten in one approval (mainnet USDT: reset to 0 first) and, when the swap does not go out, revoked to 0."sufficient": an allowance that covers the input is used as it is — no approval, nothing raised or lowered, never revoked; the swap spends exactly the input from it, and the plan and the result say so (reusedAllowance). A smaller one is set to exactly the input as in"exact", and when the swap does not go out it is put back to what it was (not to 0): only what this execution granted is taken back. One that cannot be read is refused before the review, nothing sent (Swap2ExecutionError,upstream_unavailable, when the read failed;Swap2ConfigurationErrorwhen the account has nogetAllowance): whether the user’s allowance covers the input is then unknown, and approving the input could lower it. A Permit2 spender keeps the"exact"rule for an unread allowance (approved to the input; a Permit2 allowance is never revoked).
Pins, calldata checks, simulations and the gas and price checks are the same in both modes: the spender must still
be the route’s pinned approvalAddress. CoW orders keep their own allowance target either way. What
"sufficient" gives up: under "exact" the token contract caps what the swap’s call can pull at the input; with a
reused larger allowance that cap is the allowance, and that the call pulls only the input rests on the module’s
own check of its calldata (README, “Approvals”). A provider that declares
CrossChainProvider.exactAllowanceOnly for the chain is held to "exact".
Inherited from
Section titled “Inherited from”Swap2EngineConfig.allowanceReuse
allowUnlistedTokens?
Section titled “allowUnlistedTokens?”
optionalallowUnlistedTokens?:boolean
Defined in: protocol-swap2-core/dist/base-6gRdyyWr.d.ts:235
Accept tokens the swap catalog does not list, named by their contract (EVM) or mint (Solana):
tokens the user added at their own risk. Off by default. The source token’s decimals are read
with the account’s getTokenInfo (a fromTokenDecimals that disagrees is refused); an account
without it must be given fromTokenDecimals. Only providers that trade any token (LI.FI,
Uniswap, Balancer, Fynd, Jupiter) quote them, and they have no USD value: the router cannot
judge their price, so show the user the amounts.
Inherited from
Section titled “Inherited from”Swap2EngineConfig.allowUnlistedTokens
busLogPages?
Section titled “busLogPages?”
optionalbusLogPages?:number
Defined in: protocol-swap2-stargate/src/tracking.ts:26
Inherited from
Section titled “Inherited from”StargateProviderConfig.busLogPages
busLogPageSize?
Section titled “busLogPageSize?”
optionalbusLogPageSize?:number
Defined in: protocol-swap2-stargate/src/tracking.ts:25
Bounded default log discovery. Older queues can use the indexer callbacks below.
Inherited from
Section titled “Inherited from”StargateProviderConfig.busLogPageSize
compose?
Section titled “compose?”
optionalcompose?:StargateComposeConfig
Defined in: protocol-swap2-stargate/src/provider.ts:16
Executable compose (routeId: "compose"): opt in here and in the client pins. Default off.
Inherited from
Section titled “Inherited from”StargateProviderConfig.compose
composeRetryAfterS?
Section titled “composeRetryAfterS?”
optionalcomposeRetryAfterS?:number
Defined in: protocol-swap2-stargate/src/tracking.ts:21
Seconds after the compose delivery before a manual lzCompose retry is offered. Default 600.
Inherited from
Section titled “Inherited from”StargateProviderConfig.composeRetryAfterS
confirmations?
Section titled “confirmations?”
optionalconfirmations?:Readonly<Record<string,number>>
Defined in: protocol-swap2-stargate/src/tracking.ts:19
Default: RPC finalized block. Explicit depths are an app finality policy, not universal finality.
Inherited from
Section titled “Inherited from”StargateProviderConfig.confirmations
decodeTonBody?
Section titled “decodeTonBody?”
optionaldecodeTonBody?: (bocBase64) =>unknown
Defined in: protocol-swap2-core/dist/base-6gRdyyWr.d.ts:172
Decodes a base64 BoC into a TON Cell for deposits that carry a cell body
(e.g. Omniston escrow payloads). The package deliberately does not depend on
@ton/core; the caller supplies e.g. (b) => Cell.fromBase64(b). Without
it, cell-body deposits fail closed — a TON account treats a string body
as a TEXT COMMENT, which would strand the swap.
Parameters
Section titled “Parameters”bocBase64
Section titled “bocBase64”string
Returns
Section titled “Returns”unknown
Inherited from
Section titled “Inherited from”Swap2EngineConfig.decodeTonBody
defaultMode?
Section titled “defaultMode?”
optionaldefaultMode?:StargateMode
Defined in: protocol-swap2-stargate/src/provider.ts:20
Taxi only for new transfers. A retired Bus selector is refused, without fallback.
Inherited from
Section titled “Inherited from”StargateProviderConfig.defaultMode
enabled?
Section titled “enabled?”
optionalenabled?:boolean
Defined in: protocol-swap2-stargate/src/provider.ts:18
Explicit opt-in until funded end-to-end validation is complete. Default false.
Inherited from
Section titled “Inherited from”StargateProviderConfig.enabled
feeHeadroomBps?
Section titled “feeHeadroomBps?”
optionalfeeHeadroomBps?:number
Defined in: protocol-swap2-stargate/src/quote.ts:77
Integer 0..10000, default 2500. This is a cap, not an additional charged fee.
Inherited from
Section titled “Inherited from”StargateProviderConfig.feeHeadroomBps
fetchImpl?
Section titled “fetchImpl?”
optionalfetchImpl?: {(input,init?):Promise<Response>; (input,init?):Promise<Response>; }
Defined in: protocol-swap2-stargate/src/rpc.ts:12
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”URL | RequestInfo
RequestInit
Returns
Section titled “Returns”Promise<Response>
Call Signature
Section titled “Call Signature”(
input,init?):Promise<Response>
Parameters
Section titled “Parameters”string | URL | Request
RequestInit
Returns
Section titled “Returns”Promise<Response>
Inherited from
Section titled “Inherited from”StargateProviderConfig.fetchImpl
findBusDrive?
Section titled “findBusDrive?”
optionalfindBusDrive?: (ticket) =>Promise<readonly`0x${string}`[]>
Defined in: protocol-swap2-stargate/src/tracking.ts:28
Untrusted discovery hints: every candidate is authenticated against a source receipt/packet.
Parameters
Section titled “Parameters”ticket
Section titled “ticket”Readonly<StargateBusTicket>
Returns
Section titled “Returns”Promise<readonly `0x${string}`[]>
Inherited from
Section titled “Inherited from”StargateProviderConfig.findBusDrive
fromChain
Section titled “fromChain”fromChain:
string
Defined in: protocol-swap2-core/dist/base-6gRdyyWr.d.ts:158
CAIP-2 of the chain the bound account lives on (the swap2 source).
Inherited from
Section titled “Inherited from”Swap2EngineConfig.fromChain
maxNetworkFeeBps?
Section titled “maxNetworkFeeBps?”
optionalmaxNetworkFeeBps?:number|bigint
Defined in: core/dist/index-i6xtgDlq.d.ts:437
Maximum acceptable network fee, basis points of the input amount.
Inherited from
Section titled “Inherited from”Swap2EngineConfig.maxNetworkFeeBps
maxProtocolFeeBps?
Section titled “maxProtocolFeeBps?”
optionalmaxProtocolFeeBps?:number|bigint
Defined in: core/dist/index-i6xtgDlq.d.ts:439
Maximum acceptable protocol fee, basis points of the input amount.
Inherited from
Section titled “Inherited from”Swap2EngineConfig.maxProtocolFeeBps
nativeDrop?
Section titled “nativeDrop?”
optionalnativeDrop?:object
Defined in: protocol-swap2-stargate/src/provider.ts:22
Taxi native drop is opt-in. The legacy bus field cannot enable retired Bus quotes.
optionalbus?:boolean
optionaltaxi?:bigint
Inherited from
Section titled “Inherited from”StargateProviderConfig.nativeDrop
nativeFeeCeiling?
Section titled “nativeFeeCeiling?”
optionalnativeFeeCeiling?: (ctx) =>bigint|undefined
Defined in: protocol-swap2-core/dist/base-6gRdyyWr.d.ts:215
The app’s native-fee ceiling for a route. A route may charge native coin on top of the input (a bridge’s messaging fee, declared by the quote); the engine refuses a fee above its per-chain cap (0.005 ETH on Ethereum and on chains without a row, 100 CELO on Celo, …). This hook is asked for every execution pass whose quote declares a native fee, before that pass’s review and approvals (once, unless the quote expires during an approval and the engine re-quotes: the fresh quote is asked again; a refusal then revokes the allowance just granted):
- a non-negative
bigintis the cap for that execution, in place of the chain’s own (higher or lower;0nrefuses any fee). It may be at most NATIVE_FEE_CEILING_MAX_MULTIPLE × the chain’s cap (ctx.maxCeiling); undefinedkeeps the chain’s cap, exactly as without the hook;- anything else (a number, a string,
null, a Promise), a value abovectx.maxCeiling, or a throw refuses the execution (Swap2ConfigurationError). There is no answer that removes the cap. The option itself is a function or left out: any other value (nullincluded) refuses every execution that declares a native fee.
Route policy is the app’s: match the provider, the destination and the intent id, and leave every other route to the default. USDT0 Legacy Mesh into Tron (LayerZero eid 30420; its fee, 0.0053 ETH / 170 CELO on 2026-11-12 plus the provider’s 25 % headroom, is above the default caps):
const TRON_MESH = new Map([["eip155:1", 10n ** 16n], ["eip155:42161", 10n ** 16n], ["eip155:42220", 300n * 10n ** 18n]]);nativeFeeCeiling: ({provider, intentId, fromChain, destChain}) => provider === "usdt0" && destChain === "tron:728126428" && /^usdt0-mesh:\d+:30420(?:~|$)/.test(intentId) ? TRON_MESH.get(fromChain) // 0.01 ETH on Ethereum and Arbitrum, 300 CELO on Celo; other sources: the default : undefinedOnly execution (swap2()) applies a native-fee cap: quoteSwap2 and the router’s route list do not check one, so
they list a route whose fee is above the cap, and its swap2() refuses it.
Parameters
Section titled “Parameters”Swap2NativeFeeCeilingContext
Returns
Section titled “Returns”bigint | undefined
Inherited from
Section titled “Inherited from”Swap2EngineConfig.nativeFeeCeiling
onExecutionPhase?
Section titled “onExecutionPhase?”
optionalonExecutionPhase?: (phase,detail?) =>void
Defined in: protocol-swap2-core/dist/base-6gRdyyWr.d.ts:160
Progress observer, see Swap2ExecutionPhase.
Parameters
Section titled “Parameters”Swap2ExecutionPhase
detail?
Section titled “detail?”Swap2ExecutionPhaseDetail
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Swap2EngineConfig.onExecutionPhase
operationStore?
Section titled “operationStore?”
optionaloperationStore?:Swap2OperationStore
Defined in: protocol-swap2-core/dist/base-6gRdyyWr.d.ts:156
Durable app-owned journal. When configured, each swap must supply a fresh operationId.
Inherited from
Section titled “Inherited from”Swap2EngineConfig.operationStore
queuedBusPassengers?
Section titled “queuedBusPassengers?”
optionalqueuedBusPassengers?: (query) =>Promise<readonlyobject[]>
Defined in: protocol-swap2-stargate/src/tracking.ts:30
Untrusted queue bytes: the current on-chain passenger hash chain must match.
Parameters
Section titled “Parameters”blockNumber
Section titled “blockNumber”bigint
string
number
dstEid
Section titled “dstEid”number
firstTicketId
Section titled “firstTicketId”bigint
tokenMessaging
Section titled “tokenMessaging”`0x${string}`
Returns
Section titled “Returns”Promise<readonly object[]>
Inherited from
Section titled “Inherited from”StargateProviderConfig.queuedBusPassengers
quoteTtlMs?
Section titled “quoteTtlMs?”
optionalquoteTtlMs?:number
Defined in: protocol-swap2-stargate/src/quote.ts:75
Inherited from
Section titled “Inherited from”StargateProviderConfig.quoteTtlMs
registry?
Section titled “registry?”
optionalregistry?:StargateRegistry
Defined in: protocol-swap2-stargate/src/quote.ts:74
Locally reviewed pins; never populate this from an untrusted discovery API.
Inherited from
Section titled “Inherited from”StargateProviderConfig.registry
reviewExecution?
Section titled “reviewExecution?”
optionalreviewExecution?: (plan) =>void|Promise<void>
Defined in: protocol-swap2-core/dist/base-6gRdyyWr.d.ts:226
Review gate: called once the live quote is built and every payload/value
check has passed, BEFORE any approval or signature. It receives a copy of
exactly what will be signed; throwing (the user cancelled) aborts with
nothing sent. A quote that expires while the gate is open is refused
before the first approval. When the quote expires while the engine’s own
approval is being mined, the engine re-quotes once; if the fresh quote
differs from the reviewed one (payload, gas, a worse output) the gate is
called again with requoted: true, and throwing then revokes the allowance.
Parameters
Section titled “Parameters”Swap2ExecutionPlan
Returns
Section titled “Returns”void | Promise<void>
Inherited from
Section titled “Inherited from”Swap2EngineConfig.reviewExecution
revokeUnspentApproval?
Section titled “revokeUnspentApproval?”
optionalrevokeUnspentApproval?:boolean
Defined in: protocol-swap2-core/dist/base-6gRdyyWr.d.ts:269
Whether an allowance this execution granted and did not spend is revoked (default true, the 0.17.0 behaviour):
the swap did not go out after the one re-quote on it, the second review was cancelled, a preflight or dry run
failed. false leaves it in place — no revoke transaction — and the error says what is left (leftAllowance, read
with leftAllowanceOf). The re-quote on a mined approval is unchanged. An allowance that was there before
the execution and that it did not replace is never revoked in any mode; a Permit2 allowance spent only by
signature transfer is left in place either way, as before. swap2()’s second argument overrides it. A provider
that declares CrossChainProvider.exactAllowanceOnly for the chain is held to true.
Inherited from
Section titled “Inherited from”Swap2EngineConfig.revokeUnspentApproval
rpcUrls
Section titled “rpcUrls”rpcUrls:
Readonly<Record<string,string| readonlystring[]>>
Defined in: protocol-swap2-stargate/src/rpc.ts:11
Both source and destination RPCs are required. URLs are never included in errors.
Inherited from
Section titled “Inherited from”StargateProviderConfig.rpcUrls
scanUrl?
Section titled “scanUrl?”
optionalscanUrl?:string
Defined in: protocol-swap2-stargate/src/tracking.ts:17
Inherited from
Section titled “Inherited from”StargateProviderConfig.scanUrl
serializedNativeAllowance?
Section titled “serializedNativeAllowance?”
optionalserializedNativeAllowance?:string|number|bigint
Defined in: protocol-swap2-core/dist/base-6gRdyyWr.d.ts:179
Provider-SERIALIZED legs (a swap aggregator’s fully built Solana transaction): how much native coin, in base units, the account may lose on top of the swap input — rent for a destination token account, wrapped SOL juggling, priority fees. Default 20 000 000 lamports (0.02 SOL).
Inherited from
Section titled “Inherited from”Swap2EngineConfig.serializedNativeAllowance
skipAccountChainCheck?
Section titled “skipAccountChainCheck?”
optionalskipAccountChainCheck?:boolean
Defined in: protocol-swap2-core/dist/base-6gRdyyWr.d.ts:162
Explicit escape hatch for adapters that can prove chain binding elsewhere.
Inherited from
Section titled “Inherited from”Swap2EngineConfig.skipAccountChainCheck
taxiExecutors?
Section titled “taxiExecutors?”
optionaltaxiExecutors?:Readonly<Record<string, readonly`0x${string}`[]>>
Defined in: protocol-swap2-stargate/src/tracking.ts:23
Explicit reviewed executor pins for Taxi native-drop evidence. Default: verified Base executor only.
Inherited from
Section titled “Inherited from”StargateProviderConfig.taxiExecutors
tonGasCeiling?
Section titled “tonGasCeiling?”
optionaltonGasCeiling?:string|number|bigint
Defined in: protocol-swap2-core/dist/base-6gRdyyWr.d.ts:185
The most nanoTON a TON cell-body deposit may attach as gas: on top of the input for a native source, the whole attached value for a jetton source (default 1 TON; live Omniston swaps attach 0.1–0.4). A build attaching more is refused (scan 2026-10-27 modules, F7).
Inherited from
Section titled “Inherited from”Swap2EngineConfig.tonGasCeiling