@stablechain/sdk 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +233 -9
- package/dist/index.cjs +630 -163
- package/dist/index.d.cts +435 -20
- package/dist/index.d.ts +435 -20
- package/dist/index.js +620 -153
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { erc3009Actions } from './erc3009.js';
|
|
2
2
|
export { Authorization, AuthorizationUsage, CancelAuthorizationParameters, ERC3009_ABI, Erc3009DomainOverrides, GetAuthorizationStateParameters, GetAuthorizationUsageParameters, PreparedAuthorizationCall, ReceiveWithAuthorizationParameters, SignReceiveAuthorizationParameters, SignTransferAuthorizationParameters, SignedAuthorization, TransferWithAuthorizationParameters, VerifyAuthorizationParameters, VerifyAuthorizationResult, VerifyFailureReason, cancelAuthorization, getAuthorizationState, getAuthorizationUsage, prepareTransferWithAuthorization, receiveWithAuthorization, signReceiveAuthorization, signTransferAuthorization, transferWithAuthorization, verifyAuthorization } from './erc3009.js';
|
|
3
|
-
import { Account, Transport, WalletClient, Address, BaseError } from 'viem';
|
|
3
|
+
import { Account, Transport, WalletClient, Address, Hex, BaseError } from 'viem';
|
|
4
4
|
|
|
5
5
|
interface EarnConfig {
|
|
6
6
|
/** MetaMorpho V2 vault address */
|
|
@@ -11,6 +11,17 @@ interface StableConfig {
|
|
|
11
11
|
network?: Network;
|
|
12
12
|
/** Optional RPC override — defaults to the public RPC for the selected network */
|
|
13
13
|
rpc?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Per-chain RPC overrides for the cross-chain bridge routes, e.g.
|
|
16
|
+
* `{ [Chain.Ethereum]: "https://..." }`.
|
|
17
|
+
*
|
|
18
|
+
* {@link StableConfig.rpc} covers the Stable chain only — transfers, earn and
|
|
19
|
+
* authorizations. A bridge reads and broadcasts on whichever chain it starts
|
|
20
|
+
* from, and by default that is this SDK's built-in public endpoint for that
|
|
21
|
+
* chain. Override the chains you quote on to keep a backend off a shared
|
|
22
|
+
* rate limit; chains left out keep the public endpoint.
|
|
23
|
+
*/
|
|
24
|
+
rpcOverrides?: Partial<Record<Chain, string>>;
|
|
14
25
|
/** Server-side signing: pass a viem Account, e.g. privateKeyToAccount("0x...") */
|
|
15
26
|
account?: Account;
|
|
16
27
|
/** Browser-wallet signing: pass a viem Transport, e.g. custom(window.ethereum) */
|
|
@@ -103,20 +114,106 @@ declare enum Network {
|
|
|
103
114
|
Testnet = "testnet"
|
|
104
115
|
}
|
|
105
116
|
interface BridgeQuote {
|
|
106
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Amount the recipient is expected to receive on the destination chain.
|
|
119
|
+
*
|
|
120
|
+
* On native OFT routes this is `oft.amountReceivedLD` — the input minus any
|
|
121
|
+
* OFT-level fee and minus dust removed by decimal conversion — and falls back
|
|
122
|
+
* to the input amount when `quoteOFT` could not be read.
|
|
123
|
+
*/
|
|
107
124
|
toAmount?: number;
|
|
108
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* LayerZero messaging fee (wei of the source chain's native token) — only
|
|
127
|
+
* present for native OFT routes. This is the whole `MessagingFee.nativeFee`
|
|
128
|
+
* that `send` must be called with: DVN fees, executor fee and any requested
|
|
129
|
+
* destination native drop, bundled. `quoteSend` returns no breakdown of it.
|
|
130
|
+
*/
|
|
109
131
|
nativeFee?: bigint;
|
|
110
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* The messaging fee a send built from this quote will actually carry, in wei:
|
|
134
|
+
* {@link BridgeQuote.nativeFee} padded by `feeBufferBps`.
|
|
135
|
+
*
|
|
136
|
+
* `nativeFee` is the honest quote and the number to show a user. This is the
|
|
137
|
+
* number to check a native balance against, because it is what leaves the
|
|
138
|
+
* wallet — the endpoint keeps what the pathway costs at inclusion time and
|
|
139
|
+
* refunds the rest. Only present for native OFT routes.
|
|
140
|
+
*/
|
|
141
|
+
nativeFeeMax?: bigint;
|
|
142
|
+
/** LayerZero fee paid in LZ token (wei) — only present for native OFT routes */
|
|
111
143
|
lzTokenFee?: bigint;
|
|
112
144
|
/**
|
|
113
|
-
*
|
|
145
|
+
* OFT-level accounting for the send: what the adapter itself debits, credits
|
|
146
|
+
* and charges, independent of the LayerZero messaging fee. Only present for
|
|
147
|
+
* native OFT routes, and omitted when the `quoteOFT` read failed.
|
|
148
|
+
*/
|
|
149
|
+
oft?: BridgeOftQuote;
|
|
150
|
+
/**
|
|
151
|
+
* Source-chain execution cost of the `send` transaction. Only present for
|
|
152
|
+
* native OFT routes, and omitted when neither simulation nor fallback could
|
|
153
|
+
* produce a number. Excludes {@link BridgeQuote.nativeFee}.
|
|
154
|
+
*/
|
|
155
|
+
srcGas?: BridgeGasEstimate;
|
|
156
|
+
/**
|
|
157
|
+
* Everything the sender pays out of their native balance, in wei:
|
|
158
|
+
* `srcGas.costWei + nativeFee`. Present only when both parts are known.
|
|
159
|
+
*/
|
|
160
|
+
totalCostWei?: bigint;
|
|
161
|
+
/**
|
|
162
|
+
* How long the bridge is expected to take. Only present for native OFT routes,
|
|
114
163
|
* and omitted if the estimate could not be resolved — never treat it as required.
|
|
115
164
|
*/
|
|
116
165
|
estimate?: BridgeTimeEstimate;
|
|
117
166
|
}
|
|
118
167
|
/**
|
|
119
|
-
*
|
|
168
|
+
* One fee the OFT itself reports for a send, from `quoteOFT`'s `oftFeeDetails`.
|
|
169
|
+
*
|
|
170
|
+
* Every pathway in BRIDGE_CHAIN_CONFIGS reported none when checked on 2026-08-20
|
|
171
|
+
* (Ethereum, Stable, Arbitrum and Plasma adapters), so an empty `fees` array is the
|
|
172
|
+
* normal case rather than a failed read. A deployment that does charge at the OFT
|
|
173
|
+
* level — the kind of thing a bridge UI shows as its own fee row — reports it here
|
|
174
|
+
* rather than inside the LayerZero messaging fee.
|
|
175
|
+
*/
|
|
176
|
+
interface BridgeOftFee {
|
|
177
|
+
/** Fee in the source token's smallest unit. Negative means a credit, not a charge. */
|
|
178
|
+
amountLD: bigint;
|
|
179
|
+
/** Human-readable amount, same sign convention as {@link BridgeOftFee.amountLD} */
|
|
180
|
+
amount: number;
|
|
181
|
+
/** Whatever the adapter calls this fee — its own string, shown as-is */
|
|
182
|
+
description: string;
|
|
183
|
+
}
|
|
184
|
+
/** What the OFT adapter reports for a send, read from `quoteOFT`. */
|
|
185
|
+
interface BridgeOftQuote {
|
|
186
|
+
/** Amount debited on the source chain, in the source token's smallest unit */
|
|
187
|
+
amountSentLD: bigint;
|
|
188
|
+
/** Amount credited on the destination chain, in the source token's smallest unit */
|
|
189
|
+
amountReceivedLD: bigint;
|
|
190
|
+
/** Human-readable {@link BridgeOftQuote.amountReceivedLD} */
|
|
191
|
+
amountReceived: number;
|
|
192
|
+
/** Fees the adapter charges. Empty on pathways that charge none. */
|
|
193
|
+
fees: BridgeOftFee[];
|
|
194
|
+
/** Smallest amount this pathway accepts, in the source token's smallest unit */
|
|
195
|
+
minAmountLD: bigint;
|
|
196
|
+
/** Largest amount this pathway accepts, in the source token's smallest unit */
|
|
197
|
+
maxAmountLD: bigint;
|
|
198
|
+
}
|
|
199
|
+
/** Source-chain gas for the OFT `send` transaction. */
|
|
200
|
+
interface BridgeGasEstimate {
|
|
201
|
+
/** Gas units */
|
|
202
|
+
gas: bigint;
|
|
203
|
+
/** Price per gas unit (wei) — `maxFeePerGas` where the chain is EIP-1559 */
|
|
204
|
+
gasPriceWei: bigint;
|
|
205
|
+
/** `gas × gasPriceWei` */
|
|
206
|
+
costWei: bigint;
|
|
207
|
+
/**
|
|
208
|
+
* `"simulated"` means `gas` came from simulating the real `send` — trust it.
|
|
209
|
+
* `"fallback"` means the simulation failed (no allowance or no balance yet is
|
|
210
|
+
* the usual reason when quoting before approving) and `gas` is a typical-send
|
|
211
|
+
* constant, so treat the cost as indicative only.
|
|
212
|
+
*/
|
|
213
|
+
source: "simulated" | "fallback";
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Expected end-to-end delivery time for a native (LayerZero OFT) bridge.
|
|
120
217
|
*
|
|
121
218
|
* Almost all of the wait is source-chain finality: the DVNs securing the pathway
|
|
122
219
|
* refuse to attest until the send transaction is buried under `confirmations`
|
|
@@ -159,13 +256,17 @@ interface BridgeStatus {
|
|
|
159
256
|
}
|
|
160
257
|
/**
|
|
161
258
|
* Bridge route selection:
|
|
162
|
-
* - `"
|
|
163
|
-
*
|
|
259
|
+
* - `"oft"` — force the native LayerZero OFT path for whichever asset the token
|
|
260
|
+
* addresses name, USDT0 or XAUt0 (no protocol fee, just gas + LZ messaging fee;
|
|
261
|
+
* slower). Throws if the chain pair has no adapter for that asset.
|
|
262
|
+
* - `"usdt0"` — deprecated alias for `"oft"`, kept for compatibility. It does not
|
|
263
|
+
* restrict the route to USDT0; the token addresses decide the asset.
|
|
164
264
|
* - `"lifi"` — force the LI.FI aggregator path (fast, charges a fee).
|
|
165
|
-
* - `"auto"` — use
|
|
265
|
+
* - `"auto"` — use the native OFT mesh (USDT0 or XAUt0) when both chains deploy
|
|
266
|
+
* the requested asset and the token addresses match, else LI.FI.
|
|
166
267
|
* This is the default.
|
|
167
268
|
*/
|
|
168
|
-
type BridgeRoute = "auto" | "usdt0" | "lifi";
|
|
269
|
+
type BridgeRoute = "auto" | "oft" | "usdt0" | "lifi";
|
|
169
270
|
interface BridgeParams {
|
|
170
271
|
fromChain: Chain;
|
|
171
272
|
toChain: Chain;
|
|
@@ -174,17 +275,124 @@ interface BridgeParams {
|
|
|
174
275
|
/** Destination token contract address */
|
|
175
276
|
toToken: string;
|
|
176
277
|
amount: number;
|
|
177
|
-
/**
|
|
278
|
+
/**
|
|
279
|
+
* Source token decimals (default: 6). **LI.FI routes only.**
|
|
280
|
+
*
|
|
281
|
+
* Native OFT routes parse the amount with the decimals the token has on the
|
|
282
|
+
* source chain, which the SDK already knows from
|
|
283
|
+
* {@link BRIDGE_CHAIN_CONFIGS}. Passing a value that disagrees with those
|
|
284
|
+
* throws rather than silently sending a different amount.
|
|
285
|
+
*/
|
|
178
286
|
fromDecimals?: number;
|
|
179
287
|
/** Recipient address — defaults to the signer */
|
|
180
288
|
recipient?: string;
|
|
181
289
|
/**
|
|
182
|
-
* Which bridge to use. Defaults to "auto" (
|
|
290
|
+
* Which bridge to use. Defaults to "auto" (native OFT when available, else LI.FI).
|
|
183
291
|
* See {@link BridgeRoute}.
|
|
184
292
|
*/
|
|
185
293
|
route?: BridgeRoute;
|
|
186
|
-
/**
|
|
294
|
+
/**
|
|
295
|
+
* Destination native token (wei) to airdrop to the recipient alongside the
|
|
296
|
+
* tokens — LayerZero's executor native-drop option, what bridge UIs call
|
|
297
|
+
* "gas on destination". Paid for by the sender through a larger
|
|
298
|
+
* {@link BridgeQuote.nativeFee}.
|
|
299
|
+
*
|
|
300
|
+
* Only supported on native OFT routes, and capped per pathway by the
|
|
301
|
+
* executor's configured `nativeCap`: asking for more makes `quoteSend`
|
|
302
|
+
* revert rather than silently clamping.
|
|
303
|
+
*/
|
|
304
|
+
dstNativeDrop?: bigint;
|
|
305
|
+
/**
|
|
306
|
+
* Pre-fetched quote from quoteBridge() — skips the quote fetch when passed to
|
|
307
|
+
* bridge(). Must have been quoted with the same `dstNativeDrop`, since the
|
|
308
|
+
* drop is part of what `nativeFee` pays for.
|
|
309
|
+
*/
|
|
187
310
|
quote?: BridgeQuote;
|
|
311
|
+
/**
|
|
312
|
+
* How much to pad the quoted LayerZero messaging fee by when sending, in basis
|
|
313
|
+
* points (100 = 1%). Defaults to 500 (5%); 0 sends exactly the quoted fee.
|
|
314
|
+
* Native OFT routes only.
|
|
315
|
+
*
|
|
316
|
+
* The fee a send must carry is whatever the pathway costs at the moment it
|
|
317
|
+
* lands, and `send` demands an exact match: too little reverts, and the
|
|
318
|
+
* endpoint refunds the excess to the sender. Between the quote and the
|
|
319
|
+
* signature that number can only have moved, so the buffer trades a refund
|
|
320
|
+
* round trip for not reverting — and a revert costs the gas either way.
|
|
321
|
+
*/
|
|
322
|
+
feeBufferBps?: number;
|
|
323
|
+
/**
|
|
324
|
+
* Where LayerZero returns messaging fee it did not need — the excess left over
|
|
325
|
+
* once the endpoint has taken what the pathway actually cost. Defaults to the
|
|
326
|
+
* sender. Native OFT routes only.
|
|
327
|
+
*/
|
|
328
|
+
refundAddress?: string;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* A bridge to build but not send — see
|
|
332
|
+
* {@link StableClient.prepareBridgeCalldata}.
|
|
333
|
+
*/
|
|
334
|
+
interface PrepareBridgeParams extends BridgeParams {
|
|
335
|
+
/**
|
|
336
|
+
* The address that will sign and send these transactions. Its allowance is
|
|
337
|
+
* what decides whether an approval step is needed, and it is the default
|
|
338
|
+
* recipient and — via {@link BridgeParams.refundAddress} — refund address.
|
|
339
|
+
*/
|
|
340
|
+
from: string;
|
|
341
|
+
}
|
|
342
|
+
/** One transaction to sign and broadcast, as built by an unsigned-build helper. */
|
|
343
|
+
interface BridgeCalldataStep {
|
|
344
|
+
/** The chain this must be sent on — always the bridge's source chain */
|
|
345
|
+
chainId: number;
|
|
346
|
+
to: string;
|
|
347
|
+
data: string;
|
|
348
|
+
/** Native token to attach, in wei: 0 for the approvals, the fee for the send */
|
|
349
|
+
value: bigint;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* A built, unsigned bridge: the transactions, the quote behind them, and the send
|
|
353
|
+
* they encode in readable form.
|
|
354
|
+
*/
|
|
355
|
+
interface BridgeCalldata {
|
|
356
|
+
/**
|
|
357
|
+
* Transactions to send in order, each confirmed before the next: an allowance
|
|
358
|
+
* reset and an approve where the pathway needs them, then the OFT `send`.
|
|
359
|
+
*
|
|
360
|
+
* Approvals appear only when the source chain's adapter pulls the token with
|
|
361
|
+
* `transferFrom` and the current allowance is short. A short but non-zero
|
|
362
|
+
* allowance takes two of them — legacy USDT refuses to overwrite a non-zero
|
|
363
|
+
* allowance with another non-zero value — which is why this is a list and not
|
|
364
|
+
* an optional single approval.
|
|
365
|
+
*/
|
|
366
|
+
steps: BridgeCalldataStep[];
|
|
367
|
+
/** The source chain every step must be sent on */
|
|
368
|
+
chainId: number;
|
|
369
|
+
/** Which OFT mesh this send moves through */
|
|
370
|
+
asset: "usdt0" | "xaut0";
|
|
371
|
+
/** The quote these steps were built from, whether supplied or freshly read */
|
|
372
|
+
quote: BridgeQuote;
|
|
373
|
+
/**
|
|
374
|
+
* The `send` step's arguments, decoded — enough to check the calldata against
|
|
375
|
+
* what was intended without re-deriving the ABI encoding.
|
|
376
|
+
*/
|
|
377
|
+
send: {
|
|
378
|
+
/** LayerZero endpoint ID of the destination chain */
|
|
379
|
+
dstEid: number;
|
|
380
|
+
/** Recipient address on the destination chain */
|
|
381
|
+
recipient: string;
|
|
382
|
+
/** `recipient`, left-padded to the bytes32 the OFT takes */
|
|
383
|
+
to: string;
|
|
384
|
+
/** Amount debited on the source chain, in the token's smallest unit */
|
|
385
|
+
amountLD: bigint;
|
|
386
|
+
/** Slippage floor: what the adapter quoted it would deliver */
|
|
387
|
+
minAmountLD: bigint;
|
|
388
|
+
/** Encoded LayerZero executor options, including any destination native drop */
|
|
389
|
+
extraOptions: string;
|
|
390
|
+
/** Messaging fee the send carries as its `value`, buffer included */
|
|
391
|
+
nativeFee: bigint;
|
|
392
|
+
lzTokenFee: bigint;
|
|
393
|
+
/** Where the endpoint returns unused fee */
|
|
394
|
+
refundAddress: string;
|
|
395
|
+
};
|
|
188
396
|
}
|
|
189
397
|
interface EarnDepositParams {
|
|
190
398
|
/** Amount of underlying assets to deposit (human-readable) */
|
|
@@ -416,11 +624,23 @@ interface StableClient {
|
|
|
416
624
|
quoteBridge(params: BridgeParams): Promise<BridgeQuote>;
|
|
417
625
|
bridge(params: BridgeParams): Promise<OperationResult>;
|
|
418
626
|
/**
|
|
419
|
-
*
|
|
420
|
-
*
|
|
627
|
+
* Build a bridge's transactions without signing or sending them — for a
|
|
628
|
+
* backend that quotes, builds and checks while the holder's wallet only signs.
|
|
629
|
+
*
|
|
630
|
+
* Native OFT routes only: LI.FI hands back its own transaction request from
|
|
631
|
+
* its API, so a pair that resolves to LI.FI throws rather than returning
|
|
632
|
+
* something shaped the same but built elsewhere.
|
|
421
633
|
*/
|
|
422
|
-
|
|
423
|
-
/**
|
|
634
|
+
prepareBridgeCalldata(params: PrepareBridgeParams): Promise<BridgeCalldata>;
|
|
635
|
+
/**
|
|
636
|
+
* Expected delivery time for a native OFT (LayerZero) bridge, before sending.
|
|
637
|
+
* Throws for chain pairs with no OFT adapter — LI.FI carries its own ETA.
|
|
638
|
+
*
|
|
639
|
+
* Pass `fromToken`/`toToken` to estimate a specific asset; omitting them
|
|
640
|
+
* estimates the USDT0 pathway.
|
|
641
|
+
*/
|
|
642
|
+
estimateBridgeTime(params: Pick<BridgeParams, "fromChain" | "toChain"> & Partial<Pick<BridgeParams, "fromToken" | "toToken">>): Promise<BridgeTimeEstimate>;
|
|
643
|
+
/** Delivery status of an in-flight OFT bridge, by source transaction hash. */
|
|
424
644
|
trackBridge(srcTxHash: string): Promise<BridgeStatus>;
|
|
425
645
|
quoteSwap(params: SwapParams): Promise<SwapQuote>;
|
|
426
646
|
swap(params: SwapParams): Promise<OperationResult>;
|
|
@@ -472,7 +692,7 @@ interface StableReader {
|
|
|
472
692
|
};
|
|
473
693
|
};
|
|
474
694
|
}
|
|
475
|
-
declare function createStable({ network, rpc: rpcOverride, account, transport, walletClient, earn: earnConfig, merklApiBase, }: StableConfig): StableClient;
|
|
695
|
+
declare function createStable({ network, rpc: rpcOverride, rpcOverrides, account, transport, walletClient, earn: earnConfig, merklApiBase, }: StableConfig): StableClient;
|
|
476
696
|
declare function createStableReader(config: StableReaderConfig): StableReader;
|
|
477
697
|
|
|
478
698
|
interface ChainConfig {
|
|
@@ -484,9 +704,37 @@ interface ChainConfig {
|
|
|
484
704
|
}
|
|
485
705
|
declare const CHAIN_CONFIGS: Partial<Record<Chain, ChainConfig>>;
|
|
486
706
|
|
|
707
|
+
/** An asset with its own LayerZero OFT mesh. Each has separate adapters per chain. */
|
|
708
|
+
type BridgeAsset = "usdt0" | "xaut0";
|
|
709
|
+
/** One asset's deployment on one chain. */
|
|
710
|
+
interface BridgeTokenConfig {
|
|
711
|
+
/** The ERC-20 a holder owns — what gets debited, and approved when required */
|
|
712
|
+
address: Address;
|
|
713
|
+
/** Decimals of that ERC-20 on this chain */
|
|
714
|
+
decimals: number;
|
|
715
|
+
/** The OFT (or OFT Adapter) that escrows-or-burns on send */
|
|
716
|
+
oftAdapter: Address;
|
|
717
|
+
/**
|
|
718
|
+
* Whether `send` pulls the token via `transferFrom` and so needs an allowance.
|
|
719
|
+
* Only the lockbox chain does; remote deployments burn from the caller directly.
|
|
720
|
+
* Undefined means "approve when the allowance is short" — the safe default.
|
|
721
|
+
*/
|
|
722
|
+
approvalRequired?: boolean;
|
|
723
|
+
/** False when the adapter exists but has no outbound send pathways configured */
|
|
724
|
+
lzOutbound?: boolean;
|
|
725
|
+
}
|
|
487
726
|
interface BridgeChainConfig extends ChainConfig {
|
|
488
727
|
lzEid: number;
|
|
489
|
-
/**
|
|
728
|
+
/**
|
|
729
|
+
* Which OFT assets this chain can bridge. A chain may carry one and not the
|
|
730
|
+
* other — BSC has XAUt0 but no USDT0 deployment.
|
|
731
|
+
*/
|
|
732
|
+
tokens: Partial<Record<BridgeAsset, BridgeTokenConfig>>;
|
|
733
|
+
/**
|
|
734
|
+
* The USDT0 adapter. Predates XAUt0 and is part of the exported
|
|
735
|
+
* BRIDGE_CHAIN_CONFIGS surface, so it still means USDT0 specifically —
|
|
736
|
+
* prefer `tokens[asset].oftAdapter`.
|
|
737
|
+
*/
|
|
490
738
|
oftAdapter?: Address;
|
|
491
739
|
/** False when the OFT adapter exists but has no outbound send pathways configured */
|
|
492
740
|
lzOutbound?: boolean;
|
|
@@ -497,8 +745,175 @@ interface BridgeChainConfig extends ChainConfig {
|
|
|
497
745
|
blockTimeSec?: number;
|
|
498
746
|
}
|
|
499
747
|
declare const BRIDGE_CHAIN_CONFIGS: Partial<Record<Chain, BridgeChainConfig>>;
|
|
748
|
+
/**
|
|
749
|
+
* Which OFT asset a token address refers to on a chain, or undefined when the
|
|
750
|
+
* chain has no OFT deployment matching it.
|
|
751
|
+
*/
|
|
752
|
+
declare function bridgeAssetFor(cfg: BridgeChainConfig, token: string): BridgeAsset | undefined;
|
|
753
|
+
declare const OFT_ADAPTER_ABI: readonly [{
|
|
754
|
+
readonly name: "quoteSend";
|
|
755
|
+
readonly type: "function";
|
|
756
|
+
readonly inputs: readonly [{
|
|
757
|
+
readonly name: "_sendParam";
|
|
758
|
+
readonly type: "tuple";
|
|
759
|
+
readonly components: readonly [{
|
|
760
|
+
readonly name: "dstEid";
|
|
761
|
+
readonly type: "uint32";
|
|
762
|
+
}, {
|
|
763
|
+
readonly name: "to";
|
|
764
|
+
readonly type: "bytes32";
|
|
765
|
+
}, {
|
|
766
|
+
readonly name: "amountLD";
|
|
767
|
+
readonly type: "uint256";
|
|
768
|
+
}, {
|
|
769
|
+
readonly name: "minAmountLD";
|
|
770
|
+
readonly type: "uint256";
|
|
771
|
+
}, {
|
|
772
|
+
readonly name: "extraOptions";
|
|
773
|
+
readonly type: "bytes";
|
|
774
|
+
}, {
|
|
775
|
+
readonly name: "composeMsg";
|
|
776
|
+
readonly type: "bytes";
|
|
777
|
+
}, {
|
|
778
|
+
readonly name: "oftCmd";
|
|
779
|
+
readonly type: "bytes";
|
|
780
|
+
}];
|
|
781
|
+
}, {
|
|
782
|
+
readonly name: "_payInLzToken";
|
|
783
|
+
readonly type: "bool";
|
|
784
|
+
}];
|
|
785
|
+
readonly outputs: readonly [{
|
|
786
|
+
readonly name: "msgFee";
|
|
787
|
+
readonly type: "tuple";
|
|
788
|
+
readonly components: readonly [{
|
|
789
|
+
readonly name: "nativeFee";
|
|
790
|
+
readonly type: "uint256";
|
|
791
|
+
}, {
|
|
792
|
+
readonly name: "lzTokenFee";
|
|
793
|
+
readonly type: "uint256";
|
|
794
|
+
}];
|
|
795
|
+
}];
|
|
796
|
+
readonly stateMutability: "view";
|
|
797
|
+
}, {
|
|
798
|
+
readonly name: "quoteOFT";
|
|
799
|
+
readonly type: "function";
|
|
800
|
+
readonly inputs: readonly [{
|
|
801
|
+
readonly name: "_sendParam";
|
|
802
|
+
readonly type: "tuple";
|
|
803
|
+
readonly components: readonly [{
|
|
804
|
+
readonly name: "dstEid";
|
|
805
|
+
readonly type: "uint32";
|
|
806
|
+
}, {
|
|
807
|
+
readonly name: "to";
|
|
808
|
+
readonly type: "bytes32";
|
|
809
|
+
}, {
|
|
810
|
+
readonly name: "amountLD";
|
|
811
|
+
readonly type: "uint256";
|
|
812
|
+
}, {
|
|
813
|
+
readonly name: "minAmountLD";
|
|
814
|
+
readonly type: "uint256";
|
|
815
|
+
}, {
|
|
816
|
+
readonly name: "extraOptions";
|
|
817
|
+
readonly type: "bytes";
|
|
818
|
+
}, {
|
|
819
|
+
readonly name: "composeMsg";
|
|
820
|
+
readonly type: "bytes";
|
|
821
|
+
}, {
|
|
822
|
+
readonly name: "oftCmd";
|
|
823
|
+
readonly type: "bytes";
|
|
824
|
+
}];
|
|
825
|
+
}];
|
|
826
|
+
readonly outputs: readonly [{
|
|
827
|
+
readonly name: "oftLimit";
|
|
828
|
+
readonly type: "tuple";
|
|
829
|
+
readonly components: readonly [{
|
|
830
|
+
readonly name: "minAmountLD";
|
|
831
|
+
readonly type: "uint256";
|
|
832
|
+
}, {
|
|
833
|
+
readonly name: "maxAmountLD";
|
|
834
|
+
readonly type: "uint256";
|
|
835
|
+
}];
|
|
836
|
+
}, {
|
|
837
|
+
readonly name: "oftFeeDetails";
|
|
838
|
+
readonly type: "tuple[]";
|
|
839
|
+
readonly components: readonly [{
|
|
840
|
+
readonly name: "feeAmountLD";
|
|
841
|
+
readonly type: "int256";
|
|
842
|
+
}, {
|
|
843
|
+
readonly name: "description";
|
|
844
|
+
readonly type: "string";
|
|
845
|
+
}];
|
|
846
|
+
}, {
|
|
847
|
+
readonly name: "oftReceipt";
|
|
848
|
+
readonly type: "tuple";
|
|
849
|
+
readonly components: readonly [{
|
|
850
|
+
readonly name: "amountSentLD";
|
|
851
|
+
readonly type: "uint256";
|
|
852
|
+
}, {
|
|
853
|
+
readonly name: "amountReceivedLD";
|
|
854
|
+
readonly type: "uint256";
|
|
855
|
+
}];
|
|
856
|
+
}];
|
|
857
|
+
readonly stateMutability: "view";
|
|
858
|
+
}, {
|
|
859
|
+
readonly name: "send";
|
|
860
|
+
readonly type: "function";
|
|
861
|
+
readonly inputs: readonly [{
|
|
862
|
+
readonly name: "_sendParam";
|
|
863
|
+
readonly type: "tuple";
|
|
864
|
+
readonly components: readonly [{
|
|
865
|
+
readonly name: "dstEid";
|
|
866
|
+
readonly type: "uint32";
|
|
867
|
+
}, {
|
|
868
|
+
readonly name: "to";
|
|
869
|
+
readonly type: "bytes32";
|
|
870
|
+
}, {
|
|
871
|
+
readonly name: "amountLD";
|
|
872
|
+
readonly type: "uint256";
|
|
873
|
+
}, {
|
|
874
|
+
readonly name: "minAmountLD";
|
|
875
|
+
readonly type: "uint256";
|
|
876
|
+
}, {
|
|
877
|
+
readonly name: "extraOptions";
|
|
878
|
+
readonly type: "bytes";
|
|
879
|
+
}, {
|
|
880
|
+
readonly name: "composeMsg";
|
|
881
|
+
readonly type: "bytes";
|
|
882
|
+
}, {
|
|
883
|
+
readonly name: "oftCmd";
|
|
884
|
+
readonly type: "bytes";
|
|
885
|
+
}];
|
|
886
|
+
}, {
|
|
887
|
+
readonly name: "_fee";
|
|
888
|
+
readonly type: "tuple";
|
|
889
|
+
readonly components: readonly [{
|
|
890
|
+
readonly name: "nativeFee";
|
|
891
|
+
readonly type: "uint256";
|
|
892
|
+
}, {
|
|
893
|
+
readonly name: "lzTokenFee";
|
|
894
|
+
readonly type: "uint256";
|
|
895
|
+
}];
|
|
896
|
+
}, {
|
|
897
|
+
readonly name: "_refundAddress";
|
|
898
|
+
readonly type: "address";
|
|
899
|
+
}];
|
|
900
|
+
readonly outputs: readonly [];
|
|
901
|
+
readonly stateMutability: "payable";
|
|
902
|
+
}];
|
|
500
903
|
/** Drop cached pathway configs and observed timings — forces the next estimate to refetch. */
|
|
501
904
|
declare function clearBridgeEstimateCache(): void;
|
|
905
|
+
/**
|
|
906
|
+
* Encode LayerZero V2 executor options.
|
|
907
|
+
*
|
|
908
|
+
* `gasLimit = 0` tells the executor to use its built-in minimum for lzReceive —
|
|
909
|
+
* matches the Stable bridge tutorial, and is what every plain token transfer wants.
|
|
910
|
+
*
|
|
911
|
+
* A non-zero `nativeDrop` appends the executor's native-drop option: that many wei
|
|
912
|
+
* of the *destination* chain's native token, airdropped to `dropReceiver` when the
|
|
913
|
+
* message is executed. The executor prices it into `quoteSend`'s `nativeFee`, and
|
|
914
|
+
* rejects a drop above the pathway's configured `nativeCap`.
|
|
915
|
+
*/
|
|
916
|
+
declare function buildLzOptions(gasLimit?: bigint, nativeDrop?: bigint, dropReceiver?: Address): Hex;
|
|
502
917
|
|
|
503
918
|
declare const STABLE_USDT_ADDRESS: Address;
|
|
504
919
|
declare const STABLE_VAULT_ADDRESS: Address;
|
|
@@ -560,4 +975,4 @@ declare class StableBulkError extends StableError {
|
|
|
560
975
|
});
|
|
561
976
|
}
|
|
562
977
|
|
|
563
|
-
export { BRIDGE_CHAIN_CONFIGS, type BridgeChainConfig, type BridgeDeliveryState, type BridgeParams, type BridgeQuote, type BridgeRoute, type BridgeStatus, type BridgeTimeEstimate, type BulkDepositOptions, type BulkEarnResult, type BulkEarnResultItem, type BulkWithdrawOptions, CHAIN_CONFIGS, Chain, type ChainConfig, type EarnConfig, type EarnDepositCalldata, type EarnDepositParams, type EarnRedeemParams, type EarnResult, type EarnWithdrawCalldata, type EarnWithdrawParams, type ForceDeallocation, type ForceRedeemParams, type ForceWithdrawParams, type MerklClaimCalldata, type MerklClaimResult, type MerklReward, type MerklRewardToken, type MerklRewardsResult, Network, type OperationResult, STABLE_USDT_ADDRESS, STABLE_VAULT_ADDRESS, StableBulkError, type StableClient, type StableConfig, StableError, StableNetworkError, StableQuoteError, type StableReader, type StableReaderConfig, StableTransactionError, StableValidationError, type SwapParams, type SwapQuote, type TransferParams, type VaultPosition, type VaultYield, type VaultYieldReward, type WithdrawStatus, type YieldPreview, clearBridgeEstimateCache, createStable, createStableReader, erc3009Actions };
|
|
978
|
+
export { BRIDGE_CHAIN_CONFIGS, type BridgeAsset, type BridgeCalldata, type BridgeCalldataStep, type BridgeChainConfig, type BridgeDeliveryState, type BridgeGasEstimate, type BridgeOftFee, type BridgeOftQuote, type BridgeParams, type BridgeQuote, type BridgeRoute, type BridgeStatus, type BridgeTimeEstimate, type BridgeTokenConfig, type BulkDepositOptions, type BulkEarnResult, type BulkEarnResultItem, type BulkWithdrawOptions, CHAIN_CONFIGS, Chain, type ChainConfig, type EarnConfig, type EarnDepositCalldata, type EarnDepositParams, type EarnRedeemParams, type EarnResult, type EarnWithdrawCalldata, type EarnWithdrawParams, type ForceDeallocation, type ForceRedeemParams, type ForceWithdrawParams, type MerklClaimCalldata, type MerklClaimResult, type MerklReward, type MerklRewardToken, type MerklRewardsResult, Network, OFT_ADAPTER_ABI, type OperationResult, type PrepareBridgeParams, STABLE_USDT_ADDRESS, STABLE_VAULT_ADDRESS, StableBulkError, type StableClient, type StableConfig, StableError, StableNetworkError, StableQuoteError, type StableReader, type StableReaderConfig, StableTransactionError, StableValidationError, type SwapParams, type SwapQuote, type TransferParams, type VaultPosition, type VaultYield, type VaultYieldReward, type WithdrawStatus, type YieldPreview, bridgeAssetFor, buildLzOptions, clearBridgeEstimateCache, createStable, createStableReader, erc3009Actions };
|