@trustware/sdk-staging 1.1.9-staging.7 → 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.
@@ -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;
@@ -305,6 +326,60 @@ type RouteSponsorship = {
305
326
  typedDataHash: string;
306
327
  approval: SponsorshipApproval;
307
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
+ };
308
383
  type RouteEstimate = {
309
384
  fromAmount?: string;
310
385
  toAmount?: string;
@@ -315,10 +390,23 @@ type RouteEstimate = {
315
390
  toAmountMinUsd?: string;
316
391
  fees?: unknown[];
317
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
+ };
318
405
  type RoutePlan = {
319
406
  estimate?: RouteEstimate;
320
407
  execution?: {
321
408
  transaction?: TxRequest;
409
+ approvals?: RouteApproval[];
322
410
  };
323
411
  steps?: unknown[];
324
412
  provider?: string;
@@ -705,4 +793,4 @@ declare function useWalletInfo(wagmi?: WagmiBridge): {
705
793
  };
706
794
  declare function useWalletExternalDisconnect(cb: () => void): void;
707
795
 
708
- export { useWalletInfo as $, type TrustwareWidgetMessages as A, type BuildRouteResult as B, type WagmiBridge as C, DEFAULT_AUTO_DETECT_PROVIDER as D, type EIP1193 as E, type FeatureFlags as F, type WagmiConnector as G, type WalletAddressResolution as H, IdentityStore as I, type WalletAddressSource as J, type WalletCategory as K, type WalletConnectConfig as L, type WalletEcosystem as M, type WalletId as N, type WalletIdentity as O, type WalletIdentityAddress as P, type WalletIdentityChainLike as Q, type RateLimitInfo as R, type SimpleWalletInterface as S, type TrustwareConfigOptions as T, type WalletMeta as U, buildWalletIdentityAddress as V, type WalletInterFaceAPI as W, createWalletIdentity as X, resolveWalletAddressForChain as Y, upsertWalletIdentityAddress as Z, useWalletExternalDisconnect as _, TrustwareError as a, useWireDetectionIntoManager as a0, walletManager as a1, type WalletSnapshot as a2, useWalletConnectConnect as a3, buildRoute as a4, buildDepositAddress as a5, submitReceipt as a6, getStatus as a7, pollStatus as a8, type Transaction as b, type TrustwareEvent as c, DEFAULT_FEATURE_FLAGS as d, DEFAULT_MESSAGES as e, DEFAULT_RETRY_CONFIG as f, DEFAULT_SLIPPAGE as g, type DetectedWallet as h, type EIP6963ProviderDetail as i, type EvmWalletInterface as j, type ResolvedFeatureFlags as k, type ResolvedRetryConfig as l, type ResolvedTrustwareConfig as m, type ResolvedWalletConnectConfig as n, type RetryConfig as o, type RouteEstimate as p, type RouteIntent as q, type RouteParams as r, type RoutePlan as s, type RouteSponsorship as t, type RoutesConfig as u, type SolanaProviderLike as v, type SolanaWalletInterface as w, type SponsorshipApproval as x, type SwapTokenRef as y, type TrustwareTheme as z };
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;
@@ -305,6 +326,60 @@ type RouteSponsorship = {
305
326
  typedDataHash: string;
306
327
  approval: SponsorshipApproval;
307
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
+ };
308
383
  type RouteEstimate = {
309
384
  fromAmount?: string;
310
385
  toAmount?: string;
@@ -315,10 +390,23 @@ type RouteEstimate = {
315
390
  toAmountMinUsd?: string;
316
391
  fees?: unknown[];
317
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
+ };
318
405
  type RoutePlan = {
319
406
  estimate?: RouteEstimate;
320
407
  execution?: {
321
408
  transaction?: TxRequest;
409
+ approvals?: RouteApproval[];
322
410
  };
323
411
  steps?: unknown[];
324
412
  provider?: string;
@@ -705,4 +793,4 @@ declare function useWalletInfo(wagmi?: WagmiBridge): {
705
793
  };
706
794
  declare function useWalletExternalDisconnect(cb: () => void): void;
707
795
 
708
- export { useWalletInfo as $, type TrustwareWidgetMessages as A, type BuildRouteResult as B, type WagmiBridge as C, DEFAULT_AUTO_DETECT_PROVIDER as D, type EIP1193 as E, type FeatureFlags as F, type WagmiConnector as G, type WalletAddressResolution as H, IdentityStore as I, type WalletAddressSource as J, type WalletCategory as K, type WalletConnectConfig as L, type WalletEcosystem as M, type WalletId as N, type WalletIdentity as O, type WalletIdentityAddress as P, type WalletIdentityChainLike as Q, type RateLimitInfo as R, type SimpleWalletInterface as S, type TrustwareConfigOptions as T, type WalletMeta as U, buildWalletIdentityAddress as V, type WalletInterFaceAPI as W, createWalletIdentity as X, resolveWalletAddressForChain as Y, upsertWalletIdentityAddress as Z, useWalletExternalDisconnect as _, TrustwareError as a, useWireDetectionIntoManager as a0, walletManager as a1, type WalletSnapshot as a2, useWalletConnectConnect as a3, buildRoute as a4, buildDepositAddress as a5, submitReceipt as a6, getStatus as a7, pollStatus as a8, type Transaction as b, type TrustwareEvent as c, DEFAULT_FEATURE_FLAGS as d, DEFAULT_MESSAGES as e, DEFAULT_RETRY_CONFIG as f, DEFAULT_SLIPPAGE as g, type DetectedWallet as h, type EIP6963ProviderDetail as i, type EvmWalletInterface as j, type ResolvedFeatureFlags as k, type ResolvedRetryConfig as l, type ResolvedTrustwareConfig as m, type ResolvedWalletConnectConfig as n, type RetryConfig as o, type RouteEstimate as p, type RouteIntent as q, type RouteParams as r, type RoutePlan as s, type RouteSponsorship as t, type RoutesConfig as u, type SolanaProviderLike as v, type SolanaWalletInterface as w, type SponsorshipApproval as x, type SwapTokenRef as y, type TrustwareTheme as z };
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 { h as DetectedWallet, C as WagmiBridge, W as WalletInterFaceAPI, E as EIP1193, N as WalletId, i as EIP6963ProviderDetail } from './manager-Dn4muk74.js';
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
- export { useWagmi as a, useWalletDetection as b, connectDetectedWallet as c, autoDetectWallet as d, buildDetectedWalletFromProvider as e, createWalletConnectEntry as f, useIsMobile as g, toWalletInterfaceFromDetected as t, useEIP1193 as u };
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 { h as DetectedWallet, C as WagmiBridge, W as WalletInterFaceAPI, E as EIP1193, N as WalletId, i as EIP6963ProviderDetail } from './manager-DWFNyouP.cjs';
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
- export { useWagmi as a, useWalletDetection as b, connectDetectedWallet as c, autoDetectWallet as d, buildDetectedWalletFromProvider as e, createWalletConnectEntry as f, useIsMobile as g, toWalletInterfaceFromDetected as t, useEIP1193 as u };
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 };
@@ -12265,7 +12265,7 @@ var init_constants = __esm({
12265
12265
  "src/constants.ts"() {
12266
12266
  "use strict";
12267
12267
  SDK_NAME = "@trustware/sdk";
12268
- SDK_VERSION = "1.1.9-staging.7";
12268
+ SDK_VERSION = "1.1.10-staging.0";
12269
12269
  API_ROOT = "https://bv-staging-api.trustware.io";
12270
12270
  API_PREFIX = "/api";
12271
12271
  }