WrapSwap2Protocol
Defined in: protocol-swap2-wrap/src/protocol.ts:9
Wrap / unwrap the native coin on one account (ETH ↔ WETH and friends).
Extends
Section titled “Extends”SingleProviderSwap2
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WrapSwap2Protocol(
account,config):WrapSwap2Protocol
Defined in: protocol-swap2-wrap/src/protocol.ts:13
Parameters
Section titled “Parameters”account
Section titled “account”unknown
config
Section titled “config”Returns
Section titled “Returns”WrapSwap2Protocol
Overrides
Section titled “Overrides”SingleProviderSwap2.constructor
Properties
Section titled “Properties”_account
Section titled “_account”
protectedreadonly_account:IWalletAccountReadOnly|IWalletAccount
Defined in: core/dist/index-QWdcwE6y.d.ts:309
Inherited from
Section titled “Inherited from”SingleProviderSwap2._account
_config
Section titled “_config”
protectedreadonly_config:Swap2ProtocolConfig
Defined in: core/dist/index-QWdcwE6y.d.ts:310
Inherited from
Section titled “Inherited from”SingleProviderSwap2._config
fromChain
Section titled “fromChain”
protectedreadonlyfromChain:string
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:215
Inherited from
Section titled “Inherited from”SingleProviderSwap2.fromChain
provider
Section titled “provider”
protectedreadonlyprovider:CrossChainProvider
Defined in: protocol-swap2-wrap/src/protocol.ts:10
Overrides
Section titled “Overrides”SingleProviderSwap2.provider
Methods
Section titled “Methods”assertFeeCaps()
Section titled “assertFeeCaps()”
protectedassertFeeCaps(fees,sourceAmount,sourceToken,config?):void
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:247
Parameters
Section titled “Parameters”readonly Swap2Fee[] | undefined
sourceAmount
Section titled “sourceAmount”bigint
sourceToken
Section titled “sourceToken”string
config?
Section titled “config?”Swap2ProtocolConfig
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”SingleProviderSwap2.assertFeeCaps
assertFeeConfig()
Section titled “assertFeeConfig()”
protectedassertFeeConfig(config?):void
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:246
Parameters
Section titled “Parameters”config?
Section titled “config?”Swap2ProtocolConfig
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”SingleProviderSwap2.assertFeeConfig
assertQuoteFeeCaps()
Section titled “assertQuoteFeeCaps()”
protectedassertQuoteFeeCaps(q,options,config?):void
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:248
Parameters
Section titled “Parameters”options
Section titled “options”Swap2Options
config?
Section titled “config?”Swap2ProtocolConfig
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”SingleProviderSwap2.assertQuoteFeeCaps
bridge()
Section titled “bridge()”bridge(
options):Promise<BridgeResult>
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:302
The inherited bridge() has no floor field: quote first, then bind execution to that quote’s minimum so the inherited convenience API stays safe.
Parameters
Section titled “Parameters”options
Section titled “options”BridgeOptions
Returns
Section titled “Returns”Promise<BridgeResult>
Inherited from
Section titled “Inherited from”SingleProviderSwap2.bridge
chainSupported()
Section titled “chainSupported()”
protectedchainSupported(caip2):boolean
Defined in: protocol-swap2-wrap/src/protocol.ts:19
Whether this protocol can route a chain at all (for support discovery).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
Overrides
Section titled “Overrides”SingleProviderSwap2.chainSupported
claimSwap2()
Section titled “claimSwap2()”claimSwap2(
id,account):Promise<{chain:string;hash:string;id:string; }>
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:295
Two-phase routes (CCTP-style burn-and-mint): once getSwap2Status reports
“action-required”, the delivery needs a second transaction on the
DESTINATION chain, signed there and paid in that chain’s gas. account is
the destination-chain account (the bound source account is not reused:
the chains differ). The provider builds the claim from the attestation; it
is refused when not ready, when it names another chain than the account,
or when it is anything but plain EVM calldata. Returns the claim hash and
the status id to keep polling with.
Parameters
Section titled “Parameters”string
account
Section titled “account”unknown
Returns
Section titled “Returns”Promise<{ chain: string; hash: string; id: string; }>
Inherited from
Section titled “Inherited from”SingleProviderSwap2.claimSwap2
close()
Section titled “close()”close():
void
Defined in: protocol-swap2-core/dist/swap2/single.d.ts:18
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”SingleProviderSwap2.close
describeActivity()
Section titled “describeActivity()”describeActivity(
tx,ctx):ActivityItem|null
Defined in: protocol-swap2-core/dist/swap2/single.d.ts:16
Activity recognition lives on the provider (shared with the router); null when it has none.
Parameters
Section titled “Parameters”ChainTx
DescribeActivityContext
Returns
Section titled “Returns”ActivityItem | null
Inherited from
Section titled “Inherited from”SingleProviderSwap2.describeActivity
emitPhase()
Section titled “emitPhase()”
protectedemitPhase(phase,detail?):void
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:228
Report an execution phase; an observer that throws is ignored.
Parameters
Section titled “Parameters”Swap2ExecutionPhase
detail?
Section titled “detail?”Swap2ExecutionPhaseDetail
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”SingleProviderSwap2.emitPhase
getSupportedChains()
Section titled “getSupportedChains()”getSupportedChains():
Promise<Swap2SupportedChain[]>
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:306
Source chains this protocol can swap from.
Returns
Section titled “Returns”Promise<Swap2SupportedChain[]>
Inherited from
Section titled “Inherited from”SingleProviderSwap2.getSupportedChains
getSupportedTokens()
Section titled “getSupportedTokens()”getSupportedTokens(
options?):Promise<Swap2SupportedToken[]>
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:308
Tokens of the asset catalog on the supported chains, optionally narrowed.
Parameters
Section titled “Parameters”options?
Section titled “options?”Swap2SupportedTokensOptions
Returns
Section titled “Returns”Promise<Swap2SupportedToken[]>
Inherited from
Section titled “Inherited from”SingleProviderSwap2.getSupportedTokens
getSwap2Status()
Section titled “getSwap2Status()”getSwap2Status(
id,_options?):Promise<Swap2StatusResult>
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:284
Status of a swap by the id swap2() returned, asked from the provider that executed it.
Parameters
Section titled “Parameters”string
_options?
Section titled “_options?”Swap2StatusOptions
Returns
Section titled “Returns”Promise<Swap2StatusResult>
Inherited from
Section titled “Inherited from”SingleProviderSwap2.getSwap2Status
noRouteDetail()
Section titled “noRouteDetail()”
protectednoRouteDetail():string
Defined in: protocol-swap2-core/dist/swap2/single.d.ts:13
Why the last resolveQuote came back empty (venue names + reasons), or “”. Rides inside the no-route error so execution failures are diagnosable from the surface that shows them.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”SingleProviderSwap2.noRouteDetail
pairSupported()
Section titled “pairSupported()”
protectedpairSupported(fromChain,toChain):boolean
Defined in: protocol-swap2-wrap/src/protocol.ts:22
Pair-level capability used when discovery specifies both endpoints.
Parameters
Section titled “Parameters”fromChain
Section titled “fromChain”string
toChain
Section titled “toChain”string
Returns
Section titled “Returns”boolean
Overrides
Section titled “Overrides”SingleProviderSwap2.pairSupported
prepareOptions()
Section titled “prepareOptions()”
protectedprepareOptions(options):Promise<Swap2Options>
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:242
Options ready to quote: with allowUnlistedTokens, an unlisted source token gets its decimals,
read from the chain through the account (cached per token) — a caller’s fromTokenDecimals that
disagrees is refused. Listed tokens and every option otherwise pass through unchanged.
Parameters
Section titled “Parameters”options
Section titled “options”Swap2Options
Returns
Section titled “Returns”Promise<Swap2Options>
Inherited from
Section titled “Inherited from”SingleProviderSwap2.prepareOptions
protocolEnabled()
Section titled “protocolEnabled()”
protectedprotocolEnabled():boolean
Defined in: protocol-swap2-core/dist/swap2/single.d.ts:17
Runtime availability used by the public discovery methods.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”SingleProviderSwap2.protocolEnabled
providerFor()
Section titled “providerFor()”
protectedproviderFor(name):CrossChainProvider|undefined
Defined in: protocol-swap2-core/dist/swap2/single.d.ts:14
Look up a provider by name to resume/track an in-flight swap2.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”CrossChainProvider | undefined
Inherited from
Section titled “Inherited from”SingleProviderSwap2.providerFor
quoteBridge()
Section titled “quoteBridge()”quoteBridge(
options):Promise<BridgeQuote>
Defined in: core/dist/index-QWdcwE6y.d.ts:609
The older quoteBridge, run through quoteSwap2.
Parameters
Section titled “Parameters”options
Section titled “options”BridgeOptions
Returns
Section titled “Returns”Promise<BridgeQuote>
Inherited from
Section titled “Inherited from”SingleProviderSwap2.quoteBridge
quoteSwap()
Section titled “quoteSwap()”quoteSwap(
options):Promise<SwapQuote>
Defined in: core/dist/index-QWdcwE6y.d.ts:605
The older quoteSwap, run through quoteSwap2.
Parameters
Section titled “Parameters”options
Section titled “options”SwapOptions
Returns
Section titled “Returns”Promise<SwapQuote>
Inherited from
Section titled “Inherited from”SingleProviderSwap2.quoteSwap
quoteSwap2()
Section titled “quoteSwap2()”quoteSwap2(
options):Promise<Swap2Quote>
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:261
Ask for a quote and check it against the request (amounts, slippage floor, fee ceilings in the protocol config). Works on a read-only account.
Parameters
Section titled “Parameters”options
Section titled “options”Swap2Options
Returns
Section titled “Returns”Promise<Swap2Quote>
Throws
Section titled “Throws”Swap2QuoteError when no route answers, with the provider’s own reason when it gave one.
Inherited from
Section titled “Inherited from”SingleProviderSwap2.quoteSwap2
requireSigningAccount()
Section titled “requireSigningAccount()”
protectedrequireSigningAccount(methodName):IWalletAccount
Defined in: core/dist/index-QWdcwE6y.d.ts:322
The account, narrowed to a signing one, or a ReadOnlyAccountError naming the caller.
Parameters
Section titled “Parameters”methodName
Section titled “methodName”string
Returns
Section titled “Returns”IWalletAccount
Inherited from
Section titled “Inherited from”SingleProviderSwap2.requireSigningAccount
resolveQuote()
Section titled “resolveQuote()”
protectedresolveQuote(params):Promise<Quote|null>
Defined in: protocol-swap2-core/dist/swap2/single.d.ts:12
Quote the route (single provider, or best across the router).
Parameters
Section titled “Parameters”params
Section titled “params”Returns
Section titled “Returns”Promise<Quote | null>
Inherited from
Section titled “Inherited from”SingleProviderSwap2.resolveQuote
routeQuote()
Section titled “routeQuote()”
protectedrouteQuote(q,options):Swap2Quote|null
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:253
A dry route the auction already validated → the public quote, or null when the caller’s floor / fee caps refuse it.
Parameters
Section titled “Parameters”options
Section titled “options”Swap2Options
Returns
Section titled “Returns”Swap2Quote | null
Inherited from
Section titled “Inherited from”SingleProviderSwap2.routeQuote
snapshotOf()
Section titled “snapshotOf()”
protectedsnapshotOf(options):Swap2Options
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:251
A frozen, validated copy of caller options (what every engine path works from).
Parameters
Section titled “Parameters”options
Section titled “options”Swap2Options
Returns
Section titled “Returns”Swap2Options
Inherited from
Section titled “Inherited from”SingleProviderSwap2.snapshotOf
sourceAsset()
Section titled “sourceAsset()”
protectedsourceAsset(options):CcAsset|undefined
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:235
The source asset the options name: the catalog’s, or (allowUnlistedTokens) an unlisted one with its decimals.
Parameters
Section titled “Parameters”options
Section titled “options”Swap2Options
Returns
Section titled “Returns”CcAsset | undefined
Inherited from
Section titled “Inherited from”SingleProviderSwap2.sourceAsset
swap()
Section titled “swap()”swap(
options):Promise<SwapResult>
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:304
Same protection for legacy exact-in swap() calls whose min is optional.
Parameters
Section titled “Parameters”options
Section titled “options”SwapOptions
Returns
Section titled “Returns”Promise<SwapResult>
Inherited from
Section titled “Inherited from”SingleProviderSwap2.swap
swap2()
Section titled “swap2()”swap2(
options,config?):Promise<Swap2Result>
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:271
Re-quote, check the quote, show it to reviewExecution when configured, send any approvals,
then sign and broadcast the source leg. An identical call already in flight on the same account
is refused.
Parameters
Section titled “Parameters”options
Section titled “options”Swap2Options
config?
Section titled “config?”Swap2ProtocolConfig
Returns
Section titled “Returns”Promise<Swap2Result>
Throws
Section titled “Throws”Swap2ExecutionError for a read-only account, Swap2InFlightError for a
double tap, Swap2MaybeSentError when the broadcast outcome is unknown (do not retry;
track hash).
Inherited from
Section titled “Inherited from”SingleProviderSwap2.swap2
toParams()
Section titled “toParams()”
protectedtoParams(given,dry):QuoteParams
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:244
Swap2Options → the engine’s QuoteParams (exact-in only).
Parameters
Section titled “Parameters”Swap2Options
boolean
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”SingleProviderSwap2.toParams
toQuote()
Section titled “toQuote()”
protectedtoQuote(q,options):Swap2Quote
Defined in: protocol-swap2-core/dist/swap2/base.d.ts:249
Parameters
Section titled “Parameters”options
Section titled “options”Swap2Options
Returns
Section titled “Returns”Swap2Quote
Inherited from
Section titled “Inherited from”SingleProviderSwap2.toQuote