@trustware/sdk-staging 1.1.9-staging.6 → 1.1.10-staging.0
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/LICENSE +5 -4
- package/README.md +32 -1
- package/THIRD_PARTY_NOTICES.md +118 -0
- package/dist/constants.cjs +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/{core-BTPkApRH.d.cts → core-B7Ez-5-r.d.cts} +3 -2
- package/dist/{core-2oZuxC1J.d.ts → core-BPLiD1UG.d.ts} +3 -2
- package/dist/core.cjs +246 -48
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.mjs +247 -48
- package/dist/core.mjs.map +1 -1
- package/dist/index.cjs +300 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +325 -103
- package/dist/index.mjs.map +1 -1
- package/dist/{manager-BMO1O-cW.d.ts → manager-B6NNV-E_.d.ts} +129 -18
- package/dist/{manager-BZwbtOyf.d.cts → manager-BwjyFjjz.d.cts} +129 -18
- package/dist/{detect-B8xXLwHK.d.ts → metadata-BiTMMvlY.d.ts} +5 -2
- package/dist/{detect-C8xpZRrL.d.cts → metadata-HCflXcsF.d.cts} +5 -2
- package/dist/smart-account.cjs +117 -39
- package/dist/smart-account.cjs.map +1 -1
- package/dist/smart-account.d.cts +235 -222
- package/dist/smart-account.d.ts +235 -222
- package/dist/smart-account.mjs +117 -39
- package/dist/smart-account.mjs.map +1 -1
- package/dist/wallet.cjs +113 -36
- package/dist/wallet.cjs.map +1 -1
- package/dist/wallet.d.cts +4 -7
- package/dist/wallet.d.ts +4 -7
- package/dist/wallet.mjs +113 -36
- package/dist/wallet.mjs.map +1 -1
- package/dist/widget.cjs +239 -54
- package/dist/widget.cjs.map +1 -1
- package/dist/widget.mjs +267 -81
- package/dist/widget.mjs.map +1 -1
- package/package.json +3 -2
|
@@ -187,6 +187,15 @@ type BuildRouteBody = {
|
|
|
187
187
|
slippageBps?: number;
|
|
188
188
|
linkId?: string;
|
|
189
189
|
memo?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Optional bridge-and-call: execute a contract call on the destination
|
|
192
|
+
* chain right after funds land, instead of a plain wallet transfer (e.g.
|
|
193
|
+
* depositing into a vault in the same flow). Fully optional and backward
|
|
194
|
+
* compatible — omit `hooks` entirely and nothing changes.
|
|
195
|
+
*/
|
|
196
|
+
hooks?: {
|
|
197
|
+
postHook?: PostHookRequest;
|
|
198
|
+
};
|
|
190
199
|
};
|
|
191
200
|
type TxRequest = {
|
|
192
201
|
to?: string;
|
|
@@ -199,6 +208,18 @@ type TxRequest = {
|
|
|
199
208
|
chainId?: number | string;
|
|
200
209
|
gasPrice?: string;
|
|
201
210
|
};
|
|
211
|
+
type BuildRouteResponse = {
|
|
212
|
+
intentId?: string;
|
|
213
|
+
route?: RoutePlan;
|
|
214
|
+
sponsorship?: RouteSponsorship;
|
|
215
|
+
data?: {
|
|
216
|
+
intentId?: string;
|
|
217
|
+
route?: RoutePlan;
|
|
218
|
+
sponsorship?: RouteSponsorship;
|
|
219
|
+
};
|
|
220
|
+
error?: string;
|
|
221
|
+
message?: string;
|
|
222
|
+
};
|
|
202
223
|
declare function buildRoute(body: BuildRouteBody, signal?: AbortSignal): Promise<BuildRouteResult>;
|
|
203
224
|
declare function buildDepositAddress(body: BuildRouteBody, signal?: AbortSignal): Promise<{
|
|
204
225
|
intentId: string;
|
|
@@ -210,7 +231,11 @@ declare function buildDepositAddress(body: BuildRouteBody, signal?: AbortSignal)
|
|
|
210
231
|
};
|
|
211
232
|
route: RoutePlan | undefined;
|
|
212
233
|
}>;
|
|
213
|
-
declare function submitReceipt(intentId: string, txHash: string, sponsorshipRequestId?: string
|
|
234
|
+
declare function submitReceipt(intentId: string, txHash: string, sponsorshipRequestId?: string,
|
|
235
|
+
/** Connected wallet (EOA) that originated the payment. Pass when the route
|
|
236
|
+
* executes from a smart account, so the backend records the tx against the
|
|
237
|
+
* address the user actually connects with. */
|
|
238
|
+
eoaAddress?: string): Promise<any>;
|
|
214
239
|
declare function getStatus(intentId: string): Promise<Transaction>;
|
|
215
240
|
declare function pollStatus(intentId: string, { intervalMs, timeoutMs }?: {
|
|
216
241
|
intervalMs?: number | undefined;
|
|
@@ -249,6 +274,9 @@ type Transaction = {
|
|
|
249
274
|
intentId: string;
|
|
250
275
|
fromAddress: string;
|
|
251
276
|
toAddress: string;
|
|
277
|
+
/** Connected wallet (EOA) that originated the payment when the sender is a
|
|
278
|
+
* smart account. Wire field: `origin_eoa`. */
|
|
279
|
+
origin_eoa?: string;
|
|
252
280
|
fromChainId: string | number;
|
|
253
281
|
toChainId: string | number;
|
|
254
282
|
sourceTxHash: string;
|
|
@@ -298,6 +326,60 @@ type RouteSponsorship = {
|
|
|
298
326
|
typedDataHash: string;
|
|
299
327
|
approval: SponsorshipApproval;
|
|
300
328
|
};
|
|
329
|
+
/**
|
|
330
|
+
* A destination-chain contract call to execute automatically once bridged
|
|
331
|
+
* funds land — e.g. depositing straight into a vault instead of a plain
|
|
332
|
+
* wallet transfer. Entirely optional: omit `hooks` on `BuildRouteBody`
|
|
333
|
+
* altogether and nothing about existing `buildRoute`/`buildDepositAddress`
|
|
334
|
+
* behavior changes.
|
|
335
|
+
*
|
|
336
|
+
* There are two ways to tell the backend how much the call should act on:
|
|
337
|
+
* - `fundAmount` (recommended — works with every provider): a fixed amount
|
|
338
|
+
* you already know ahead of time, with `callData` ABI-encoded for that
|
|
339
|
+
* exact number.
|
|
340
|
+
* - `fullAmount: true` + `amountInputPos` (Squid only): lets the backend
|
|
341
|
+
* dynamically patch `callData` with the *actual* landed amount at
|
|
342
|
+
* execution time — useful when the exact bridged amount can't be known in
|
|
343
|
+
* advance. Requests using this mode are only ever routed to a provider
|
|
344
|
+
* that supports it.
|
|
345
|
+
*
|
|
346
|
+
* Pick one of the two amount modes; you don't need both.
|
|
347
|
+
*/
|
|
348
|
+
type PostHookRequest = {
|
|
349
|
+
/** Contract address to call on the destination chain. */
|
|
350
|
+
target: string;
|
|
351
|
+
/** ABI-encoded calldata for the call. */
|
|
352
|
+
callData: string;
|
|
353
|
+
/** msg.value to send with the call, in wei — only for native-value calls. */
|
|
354
|
+
value?: string;
|
|
355
|
+
/** Token the call acts on. Defaults to the route's `toToken`. */
|
|
356
|
+
fundToken?: string;
|
|
357
|
+
/** Fixed amount (wei). Required unless `fullAmount` is set. */
|
|
358
|
+
fundAmount?: string;
|
|
359
|
+
/** Squid-only: dynamically patch `callData` with the actual landed amount. */
|
|
360
|
+
fullAmount?: boolean;
|
|
361
|
+
/** Squid-only: required when `fullAmount` is true — the ABI arg index to patch. */
|
|
362
|
+
amountInputPos?: number;
|
|
363
|
+
/**
|
|
364
|
+
* Gas limit hint for the call. Optional for Squid, but required to keep
|
|
365
|
+
* this request eligible for LiFi — include it unless you're intentionally
|
|
366
|
+
* Squid-only.
|
|
367
|
+
*/
|
|
368
|
+
estimatedGas?: string;
|
|
369
|
+
/**
|
|
370
|
+
* Set this when `target` needs to pull `fundToken` via `transferFrom` (the
|
|
371
|
+
* common ERC20 vault-deposit case) — usually the same address as `target`
|
|
372
|
+
* itself. On Squid, an `approve()` call is automatically prepended before
|
|
373
|
+
* your call (patched with the landed amount too, when `fullAmount` is
|
|
374
|
+
* true). On LiFi, this is passed through as-is; LiFi's own execution
|
|
375
|
+
* engine handles the approval. Leave unset for native-asset calls, which
|
|
376
|
+
* never need an approval.
|
|
377
|
+
*/
|
|
378
|
+
toApprovalAddress?: string;
|
|
379
|
+
/** Where bridged funds go if the call fails (LiFi only). */
|
|
380
|
+
toFallbackAddress?: string;
|
|
381
|
+
description?: string;
|
|
382
|
+
};
|
|
301
383
|
type RouteEstimate = {
|
|
302
384
|
fromAmount?: string;
|
|
303
385
|
toAmount?: string;
|
|
@@ -308,10 +390,23 @@ type RouteEstimate = {
|
|
|
308
390
|
toAmountMinUsd?: string;
|
|
309
391
|
fees?: unknown[];
|
|
310
392
|
};
|
|
393
|
+
/**
|
|
394
|
+
* An ERC20 allowance that must be granted before `execution.transaction` can
|
|
395
|
+
* succeed — e.g. bridging from USDC instead of a native asset. `sendRouteTransaction`
|
|
396
|
+
* checks and grants these automatically; you only need this if you're
|
|
397
|
+
* building the transaction lifecycle yourself.
|
|
398
|
+
*/
|
|
399
|
+
type RouteApproval = {
|
|
400
|
+
chainId?: string;
|
|
401
|
+
tokenAddress?: string;
|
|
402
|
+
spender?: string;
|
|
403
|
+
amount?: string;
|
|
404
|
+
};
|
|
311
405
|
type RoutePlan = {
|
|
312
406
|
estimate?: RouteEstimate;
|
|
313
407
|
execution?: {
|
|
314
408
|
transaction?: TxRequest;
|
|
409
|
+
approvals?: RouteApproval[];
|
|
315
410
|
};
|
|
316
411
|
steps?: unknown[];
|
|
317
412
|
provider?: string;
|
|
@@ -412,23 +507,25 @@ type ResolvedWalletConnectConfig = {
|
|
|
412
507
|
relayUrl?: string;
|
|
413
508
|
showQrModal: boolean;
|
|
414
509
|
};
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
};
|
|
510
|
+
/** Destination/source route defaults. Required in "deposit" mode; optional (and only
|
|
511
|
+
* partially meaningful) in "swap" mode, where chains/tokens are chosen entirely in-widget. */
|
|
512
|
+
type RoutesConfig = {
|
|
513
|
+
toChain: string;
|
|
514
|
+
toToken: string;
|
|
515
|
+
fromToken?: string;
|
|
516
|
+
fromChain?: string;
|
|
517
|
+
fromAddress?: string;
|
|
518
|
+
toAddress?: string;
|
|
519
|
+
defaultSlippage?: number;
|
|
520
|
+
options?: {
|
|
521
|
+
routeRefreshMs?: number;
|
|
522
|
+
fixedFromAmount?: string | number;
|
|
523
|
+
minAmountOut?: string | number;
|
|
524
|
+
maxAmountOut?: string | number;
|
|
431
525
|
};
|
|
526
|
+
};
|
|
527
|
+
type CommonConfigOptions = {
|
|
528
|
+
apiKey: string;
|
|
432
529
|
autoDetectProvider?: boolean;
|
|
433
530
|
theme?: TrustwareTheme;
|
|
434
531
|
messages?: Partial<TrustwareWidgetMessages>;
|
|
@@ -439,8 +536,18 @@ type TrustwareConfigOptions = {
|
|
|
439
536
|
onSuccess?: (transaction: Transaction) => void;
|
|
440
537
|
onEvent?: (event: TrustwareEvent) => void;
|
|
441
538
|
};
|
|
539
|
+
type TrustwareConfigOptions = CommonConfigOptions & ({
|
|
540
|
+
/** Default mode: bridge/top-up to a preconfigured destination chain+token. */
|
|
541
|
+
mode?: "deposit";
|
|
542
|
+
routes: RoutesConfig;
|
|
543
|
+
} | {
|
|
544
|
+
/** Swap mode: from/to chain+token are chosen entirely in-widget; `routes` is not required. */
|
|
545
|
+
mode: "swap";
|
|
546
|
+
routes?: Partial<RoutesConfig>;
|
|
547
|
+
});
|
|
442
548
|
type ResolvedTrustwareConfig = {
|
|
443
549
|
apiKey: string;
|
|
550
|
+
mode: "deposit" | "swap";
|
|
444
551
|
routes: {
|
|
445
552
|
toChain: string;
|
|
446
553
|
toToken: string;
|
|
@@ -476,6 +583,10 @@ type FeatureFlags = {
|
|
|
476
583
|
tokensPagination?: boolean;
|
|
477
584
|
balanceStreaming?: boolean;
|
|
478
585
|
shouldAllowGA4?: boolean;
|
|
586
|
+
/**
|
|
587
|
+
* @deprecated Use top-level `mode: "swap"` on `TrustwareConfigOptions` instead. Still
|
|
588
|
+
* supported for backward compatibility and treated as equivalent to `mode: "swap"`.
|
|
589
|
+
*/
|
|
479
590
|
swapMode?: boolean;
|
|
480
591
|
/**
|
|
481
592
|
* Pre-selects the destination token in swap mode. When set, the widget opens
|
|
@@ -682,4 +793,4 @@ declare function useWalletInfo(wagmi?: WagmiBridge): {
|
|
|
682
793
|
};
|
|
683
794
|
declare function useWalletExternalDisconnect(cb: () => void): void;
|
|
684
795
|
|
|
685
|
-
export {
|
|
796
|
+
export { type WalletConnectConfig as $, type ResolvedWalletConnectConfig as A, type BuildRouteBody as B, type RetryConfig as C, type DetectedWallet as D, type EIP1193 as E, type FeatureFlags as F, type RouteApproval as G, type RouteEstimate as H, IdentityStore as I, type RouteIntent as J, type RouteParams as K, type RoutePlan as L, type RouteSponsorship as M, type RoutesConfig as N, type SimpleWalletInterface as O, type PostHookRequest as P, type SponsorshipApproval as Q, type RateLimitInfo as R, type SolanaProviderLike as S, type TrustwareConfigOptions as T, type SwapTokenRef as U, type TrustwareTheme as V, type WalletMeta as W, type TrustwareWidgetMessages as X, type WalletAddressResolution as Y, type WalletAddressSource as Z, type WalletCategory as _, type WalletId as a, type WalletEcosystem as a0, type WalletIdentity as a1, type WalletIdentityAddress as a2, type WalletIdentityChainLike as a3, buildWalletIdentityAddress as a4, createWalletIdentity as a5, resolveWalletAddressForChain as a6, upsertWalletIdentityAddress as a7, buildRoute as a8, buildDepositAddress as a9, submitReceipt as aa, getStatus as ab, pollStatus as ac, type SolanaWalletInterface as b, type WagmiBridge as c, type WagmiConnector as d, type WalletSnapshot as e, useWalletExternalDisconnect as f, useWalletInfo as g, useWireDetectionIntoManager as h, type WalletInterFaceAPI as i, TrustwareError as j, type Transaction as k, type TrustwareEvent as l, type BuildRouteResponse as m, type BuildRouteResult as n, DEFAULT_AUTO_DETECT_PROVIDER as o, DEFAULT_FEATURE_FLAGS as p, DEFAULT_MESSAGES as q, DEFAULT_RETRY_CONFIG as r, DEFAULT_SLIPPAGE as s, type EIP6963ProviderDetail as t, useWalletConnectConnect as u, type EvmWalletInterface as v, walletManager as w, type ResolvedFeatureFlags as x, type ResolvedRetryConfig as y, type ResolvedTrustwareConfig as z };
|
|
@@ -187,6 +187,15 @@ type BuildRouteBody = {
|
|
|
187
187
|
slippageBps?: number;
|
|
188
188
|
linkId?: string;
|
|
189
189
|
memo?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Optional bridge-and-call: execute a contract call on the destination
|
|
192
|
+
* chain right after funds land, instead of a plain wallet transfer (e.g.
|
|
193
|
+
* depositing into a vault in the same flow). Fully optional and backward
|
|
194
|
+
* compatible — omit `hooks` entirely and nothing changes.
|
|
195
|
+
*/
|
|
196
|
+
hooks?: {
|
|
197
|
+
postHook?: PostHookRequest;
|
|
198
|
+
};
|
|
190
199
|
};
|
|
191
200
|
type TxRequest = {
|
|
192
201
|
to?: string;
|
|
@@ -199,6 +208,18 @@ type TxRequest = {
|
|
|
199
208
|
chainId?: number | string;
|
|
200
209
|
gasPrice?: string;
|
|
201
210
|
};
|
|
211
|
+
type BuildRouteResponse = {
|
|
212
|
+
intentId?: string;
|
|
213
|
+
route?: RoutePlan;
|
|
214
|
+
sponsorship?: RouteSponsorship;
|
|
215
|
+
data?: {
|
|
216
|
+
intentId?: string;
|
|
217
|
+
route?: RoutePlan;
|
|
218
|
+
sponsorship?: RouteSponsorship;
|
|
219
|
+
};
|
|
220
|
+
error?: string;
|
|
221
|
+
message?: string;
|
|
222
|
+
};
|
|
202
223
|
declare function buildRoute(body: BuildRouteBody, signal?: AbortSignal): Promise<BuildRouteResult>;
|
|
203
224
|
declare function buildDepositAddress(body: BuildRouteBody, signal?: AbortSignal): Promise<{
|
|
204
225
|
intentId: string;
|
|
@@ -210,7 +231,11 @@ declare function buildDepositAddress(body: BuildRouteBody, signal?: AbortSignal)
|
|
|
210
231
|
};
|
|
211
232
|
route: RoutePlan | undefined;
|
|
212
233
|
}>;
|
|
213
|
-
declare function submitReceipt(intentId: string, txHash: string, sponsorshipRequestId?: string
|
|
234
|
+
declare function submitReceipt(intentId: string, txHash: string, sponsorshipRequestId?: string,
|
|
235
|
+
/** Connected wallet (EOA) that originated the payment. Pass when the route
|
|
236
|
+
* executes from a smart account, so the backend records the tx against the
|
|
237
|
+
* address the user actually connects with. */
|
|
238
|
+
eoaAddress?: string): Promise<any>;
|
|
214
239
|
declare function getStatus(intentId: string): Promise<Transaction>;
|
|
215
240
|
declare function pollStatus(intentId: string, { intervalMs, timeoutMs }?: {
|
|
216
241
|
intervalMs?: number | undefined;
|
|
@@ -249,6 +274,9 @@ type Transaction = {
|
|
|
249
274
|
intentId: string;
|
|
250
275
|
fromAddress: string;
|
|
251
276
|
toAddress: string;
|
|
277
|
+
/** Connected wallet (EOA) that originated the payment when the sender is a
|
|
278
|
+
* smart account. Wire field: `origin_eoa`. */
|
|
279
|
+
origin_eoa?: string;
|
|
252
280
|
fromChainId: string | number;
|
|
253
281
|
toChainId: string | number;
|
|
254
282
|
sourceTxHash: string;
|
|
@@ -298,6 +326,60 @@ type RouteSponsorship = {
|
|
|
298
326
|
typedDataHash: string;
|
|
299
327
|
approval: SponsorshipApproval;
|
|
300
328
|
};
|
|
329
|
+
/**
|
|
330
|
+
* A destination-chain contract call to execute automatically once bridged
|
|
331
|
+
* funds land — e.g. depositing straight into a vault instead of a plain
|
|
332
|
+
* wallet transfer. Entirely optional: omit `hooks` on `BuildRouteBody`
|
|
333
|
+
* altogether and nothing about existing `buildRoute`/`buildDepositAddress`
|
|
334
|
+
* behavior changes.
|
|
335
|
+
*
|
|
336
|
+
* There are two ways to tell the backend how much the call should act on:
|
|
337
|
+
* - `fundAmount` (recommended — works with every provider): a fixed amount
|
|
338
|
+
* you already know ahead of time, with `callData` ABI-encoded for that
|
|
339
|
+
* exact number.
|
|
340
|
+
* - `fullAmount: true` + `amountInputPos` (Squid only): lets the backend
|
|
341
|
+
* dynamically patch `callData` with the *actual* landed amount at
|
|
342
|
+
* execution time — useful when the exact bridged amount can't be known in
|
|
343
|
+
* advance. Requests using this mode are only ever routed to a provider
|
|
344
|
+
* that supports it.
|
|
345
|
+
*
|
|
346
|
+
* Pick one of the two amount modes; you don't need both.
|
|
347
|
+
*/
|
|
348
|
+
type PostHookRequest = {
|
|
349
|
+
/** Contract address to call on the destination chain. */
|
|
350
|
+
target: string;
|
|
351
|
+
/** ABI-encoded calldata for the call. */
|
|
352
|
+
callData: string;
|
|
353
|
+
/** msg.value to send with the call, in wei — only for native-value calls. */
|
|
354
|
+
value?: string;
|
|
355
|
+
/** Token the call acts on. Defaults to the route's `toToken`. */
|
|
356
|
+
fundToken?: string;
|
|
357
|
+
/** Fixed amount (wei). Required unless `fullAmount` is set. */
|
|
358
|
+
fundAmount?: string;
|
|
359
|
+
/** Squid-only: dynamically patch `callData` with the actual landed amount. */
|
|
360
|
+
fullAmount?: boolean;
|
|
361
|
+
/** Squid-only: required when `fullAmount` is true — the ABI arg index to patch. */
|
|
362
|
+
amountInputPos?: number;
|
|
363
|
+
/**
|
|
364
|
+
* Gas limit hint for the call. Optional for Squid, but required to keep
|
|
365
|
+
* this request eligible for LiFi — include it unless you're intentionally
|
|
366
|
+
* Squid-only.
|
|
367
|
+
*/
|
|
368
|
+
estimatedGas?: string;
|
|
369
|
+
/**
|
|
370
|
+
* Set this when `target` needs to pull `fundToken` via `transferFrom` (the
|
|
371
|
+
* common ERC20 vault-deposit case) — usually the same address as `target`
|
|
372
|
+
* itself. On Squid, an `approve()` call is automatically prepended before
|
|
373
|
+
* your call (patched with the landed amount too, when `fullAmount` is
|
|
374
|
+
* true). On LiFi, this is passed through as-is; LiFi's own execution
|
|
375
|
+
* engine handles the approval. Leave unset for native-asset calls, which
|
|
376
|
+
* never need an approval.
|
|
377
|
+
*/
|
|
378
|
+
toApprovalAddress?: string;
|
|
379
|
+
/** Where bridged funds go if the call fails (LiFi only). */
|
|
380
|
+
toFallbackAddress?: string;
|
|
381
|
+
description?: string;
|
|
382
|
+
};
|
|
301
383
|
type RouteEstimate = {
|
|
302
384
|
fromAmount?: string;
|
|
303
385
|
toAmount?: string;
|
|
@@ -308,10 +390,23 @@ type RouteEstimate = {
|
|
|
308
390
|
toAmountMinUsd?: string;
|
|
309
391
|
fees?: unknown[];
|
|
310
392
|
};
|
|
393
|
+
/**
|
|
394
|
+
* An ERC20 allowance that must be granted before `execution.transaction` can
|
|
395
|
+
* succeed — e.g. bridging from USDC instead of a native asset. `sendRouteTransaction`
|
|
396
|
+
* checks and grants these automatically; you only need this if you're
|
|
397
|
+
* building the transaction lifecycle yourself.
|
|
398
|
+
*/
|
|
399
|
+
type RouteApproval = {
|
|
400
|
+
chainId?: string;
|
|
401
|
+
tokenAddress?: string;
|
|
402
|
+
spender?: string;
|
|
403
|
+
amount?: string;
|
|
404
|
+
};
|
|
311
405
|
type RoutePlan = {
|
|
312
406
|
estimate?: RouteEstimate;
|
|
313
407
|
execution?: {
|
|
314
408
|
transaction?: TxRequest;
|
|
409
|
+
approvals?: RouteApproval[];
|
|
315
410
|
};
|
|
316
411
|
steps?: unknown[];
|
|
317
412
|
provider?: string;
|
|
@@ -412,23 +507,25 @@ type ResolvedWalletConnectConfig = {
|
|
|
412
507
|
relayUrl?: string;
|
|
413
508
|
showQrModal: boolean;
|
|
414
509
|
};
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
};
|
|
510
|
+
/** Destination/source route defaults. Required in "deposit" mode; optional (and only
|
|
511
|
+
* partially meaningful) in "swap" mode, where chains/tokens are chosen entirely in-widget. */
|
|
512
|
+
type RoutesConfig = {
|
|
513
|
+
toChain: string;
|
|
514
|
+
toToken: string;
|
|
515
|
+
fromToken?: string;
|
|
516
|
+
fromChain?: string;
|
|
517
|
+
fromAddress?: string;
|
|
518
|
+
toAddress?: string;
|
|
519
|
+
defaultSlippage?: number;
|
|
520
|
+
options?: {
|
|
521
|
+
routeRefreshMs?: number;
|
|
522
|
+
fixedFromAmount?: string | number;
|
|
523
|
+
minAmountOut?: string | number;
|
|
524
|
+
maxAmountOut?: string | number;
|
|
431
525
|
};
|
|
526
|
+
};
|
|
527
|
+
type CommonConfigOptions = {
|
|
528
|
+
apiKey: string;
|
|
432
529
|
autoDetectProvider?: boolean;
|
|
433
530
|
theme?: TrustwareTheme;
|
|
434
531
|
messages?: Partial<TrustwareWidgetMessages>;
|
|
@@ -439,8 +536,18 @@ type TrustwareConfigOptions = {
|
|
|
439
536
|
onSuccess?: (transaction: Transaction) => void;
|
|
440
537
|
onEvent?: (event: TrustwareEvent) => void;
|
|
441
538
|
};
|
|
539
|
+
type TrustwareConfigOptions = CommonConfigOptions & ({
|
|
540
|
+
/** Default mode: bridge/top-up to a preconfigured destination chain+token. */
|
|
541
|
+
mode?: "deposit";
|
|
542
|
+
routes: RoutesConfig;
|
|
543
|
+
} | {
|
|
544
|
+
/** Swap mode: from/to chain+token are chosen entirely in-widget; `routes` is not required. */
|
|
545
|
+
mode: "swap";
|
|
546
|
+
routes?: Partial<RoutesConfig>;
|
|
547
|
+
});
|
|
442
548
|
type ResolvedTrustwareConfig = {
|
|
443
549
|
apiKey: string;
|
|
550
|
+
mode: "deposit" | "swap";
|
|
444
551
|
routes: {
|
|
445
552
|
toChain: string;
|
|
446
553
|
toToken: string;
|
|
@@ -476,6 +583,10 @@ type FeatureFlags = {
|
|
|
476
583
|
tokensPagination?: boolean;
|
|
477
584
|
balanceStreaming?: boolean;
|
|
478
585
|
shouldAllowGA4?: boolean;
|
|
586
|
+
/**
|
|
587
|
+
* @deprecated Use top-level `mode: "swap"` on `TrustwareConfigOptions` instead. Still
|
|
588
|
+
* supported for backward compatibility and treated as equivalent to `mode: "swap"`.
|
|
589
|
+
*/
|
|
479
590
|
swapMode?: boolean;
|
|
480
591
|
/**
|
|
481
592
|
* Pre-selects the destination token in swap mode. When set, the widget opens
|
|
@@ -682,4 +793,4 @@ declare function useWalletInfo(wagmi?: WagmiBridge): {
|
|
|
682
793
|
};
|
|
683
794
|
declare function useWalletExternalDisconnect(cb: () => void): void;
|
|
684
795
|
|
|
685
|
-
export {
|
|
796
|
+
export { type WalletConnectConfig as $, type ResolvedWalletConnectConfig as A, type BuildRouteBody as B, type RetryConfig as C, type DetectedWallet as D, type EIP1193 as E, type FeatureFlags as F, type RouteApproval as G, type RouteEstimate as H, IdentityStore as I, type RouteIntent as J, type RouteParams as K, type RoutePlan as L, type RouteSponsorship as M, type RoutesConfig as N, type SimpleWalletInterface as O, type PostHookRequest as P, type SponsorshipApproval as Q, type RateLimitInfo as R, type SolanaProviderLike as S, type TrustwareConfigOptions as T, type SwapTokenRef as U, type TrustwareTheme as V, type WalletMeta as W, type TrustwareWidgetMessages as X, type WalletAddressResolution as Y, type WalletAddressSource as Z, type WalletCategory as _, type WalletId as a, type WalletEcosystem as a0, type WalletIdentity as a1, type WalletIdentityAddress as a2, type WalletIdentityChainLike as a3, buildWalletIdentityAddress as a4, createWalletIdentity as a5, resolveWalletAddressForChain as a6, upsertWalletIdentityAddress as a7, buildRoute as a8, buildDepositAddress as a9, submitReceipt as aa, getStatus as ab, pollStatus as ac, type SolanaWalletInterface as b, type WagmiBridge as c, type WagmiConnector as d, type WalletSnapshot as e, useWalletExternalDisconnect as f, useWalletInfo as g, useWireDetectionIntoManager as h, type WalletInterFaceAPI as i, TrustwareError as j, type Transaction as k, type TrustwareEvent as l, type BuildRouteResponse as m, type BuildRouteResult as n, DEFAULT_AUTO_DETECT_PROVIDER as o, DEFAULT_FEATURE_FLAGS as p, DEFAULT_MESSAGES as q, DEFAULT_RETRY_CONFIG as r, DEFAULT_SLIPPAGE as s, type EIP6963ProviderDetail as t, useWalletConnectConnect as u, type EvmWalletInterface as v, walletManager as w, type ResolvedFeatureFlags as x, type ResolvedRetryConfig as y, type ResolvedTrustwareConfig as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as DetectedWallet, c as WagmiBridge, i as WalletInterFaceAPI, E as EIP1193, a as WalletId, t as EIP6963ProviderDetail, W as WalletMeta } from './manager-B6NNV-E_.js';
|
|
2
2
|
|
|
3
3
|
/** Try wagmi bridge first (if provided), otherwise return EIP-1193 adapter. */
|
|
4
4
|
declare function connectDetectedWallet(dw: DetectedWallet, opts?: {
|
|
@@ -32,4 +32,7 @@ declare function useWalletDetection(timeoutMs?: number): {
|
|
|
32
32
|
};
|
|
33
33
|
declare function useIsMobile(): boolean;
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
declare const POPULAR_ORDER: WalletId[];
|
|
36
|
+
declare const WALLETS: WalletMeta[];
|
|
37
|
+
|
|
38
|
+
export { POPULAR_ORDER as P, WALLETS as W, autoDetectWallet as a, buildDetectedWalletFromProvider as b, connectDetectedWallet as c, createWalletConnectEntry as d, useIsMobile as e, useWagmi as f, useWalletDetection as g, toWalletInterfaceFromDetected as t, useEIP1193 as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as DetectedWallet, c as WagmiBridge, i as WalletInterFaceAPI, E as EIP1193, a as WalletId, t as EIP6963ProviderDetail, W as WalletMeta } from './manager-BwjyFjjz.cjs';
|
|
2
2
|
|
|
3
3
|
/** Try wagmi bridge first (if provided), otherwise return EIP-1193 adapter. */
|
|
4
4
|
declare function connectDetectedWallet(dw: DetectedWallet, opts?: {
|
|
@@ -32,4 +32,7 @@ declare function useWalletDetection(timeoutMs?: number): {
|
|
|
32
32
|
};
|
|
33
33
|
declare function useIsMobile(): boolean;
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
declare const POPULAR_ORDER: WalletId[];
|
|
36
|
+
declare const WALLETS: WalletMeta[];
|
|
37
|
+
|
|
38
|
+
export { POPULAR_ORDER as P, WALLETS as W, autoDetectWallet as a, buildDetectedWalletFromProvider as b, connectDetectedWallet as c, createWalletConnectEntry as d, useIsMobile as e, useWagmi as f, useWalletDetection as g, toWalletInterfaceFromDetected as t, useEIP1193 as u };
|