@nexus-cross/dapp-ui 1.3.10-beta.8 → 1.3.10

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/dist/index.d.cts CHANGED
@@ -3,6 +3,7 @@ import * as React from 'react';
3
3
  import { Component, ReactNode, ErrorInfo, CSSProperties } from 'react';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
+ import { UseQueryOptions } from '@tanstack/react-query';
6
7
 
7
8
  type Environment = "dev" | "stage" | "production";
8
9
  type Theme = "dark" | "light";
@@ -54,7 +55,7 @@ interface InitDappUiSentryOptions {
54
55
  enabled?: boolean;
55
56
  /** Override DSN (tests / self-hosted relay). */
56
57
  dsn?: string;
57
- /** 0–1 sample rate for ui:/funnel: analytics events (default 1). Errors are never sampled. */
58
+ /** 0–1 sample rate for ui:/funnel: analytics events (default 0.1). Errors are never sampled. */
58
59
  analyticsSampleRate?: number;
59
60
  }
60
61
  /**
@@ -2158,6 +2159,14 @@ interface RelayWalletProps {
2158
2159
  waitForReceipt?: WaitForReceiptFn;
2159
2160
  getBalance?: GetBalanceFn;
2160
2161
  }
2162
+ /** A recovery transaction confirmed successfully on BNB Smart Chain. */
2163
+ interface RecoverySuccessResult {
2164
+ action: "execute" | "sweep";
2165
+ forwarder: string;
2166
+ actionTxHash: string;
2167
+ /** Present only when this attempt first had to deploy the forwarder. */
2168
+ deployTxHash?: string;
2169
+ }
2161
2170
  type RelayTheme = "dark" | "light";
2162
2171
  type RelayDrawerDirection = "bottom" | "left" | "right" | "top";
2163
2172
  /**
@@ -2238,6 +2247,8 @@ interface RelayDepositProps extends RelayWalletProps {
2238
2247
  * watch `depositState` (phase/txHash/reverted) for those. Safe to treat as
2239
2248
  * "the funds moved" (upstream 83845fb). */
2240
2249
  onDeposited?: (txHash: string) => void;
2250
+ /** Fired once after a recovery action receipt confirms successfully. */
2251
+ onRecoverySuccess?: (result: RecoverySuccessResult) => void;
2241
2252
  onError?: (error: Error) => void;
2242
2253
  /** Called by the `Connect Wallet` CTA under the locked card that stands in for the QR
2243
2254
  * while the required connected wallet (or, in low-level public-address mode,
@@ -2302,6 +2313,8 @@ interface RelayRecoveryProps extends RelayWalletProps {
2302
2313
  * `RelayDepositProps.trustedFactories`.
2303
2314
  */
2304
2315
  trustedFactories?: readonly string[];
2316
+ /** Fired once after a recovery action receipt confirms successfully. */
2317
+ onRecoverySuccess?: (result: RecoverySuccessResult) => void;
2305
2318
  onError?: (e: Error) => void;
2306
2319
  /** Extra class name(s) for the modal/drawer content element. */
2307
2320
  className?: string;
@@ -2499,6 +2512,140 @@ declare const RelayRecovery: typeof RelayRecoveryRoot & {
2499
2512
  Content: typeof RelayRecoveryContent;
2500
2513
  };
2501
2514
 
2515
+ interface UseRelayOrdersOptions {
2516
+ client: RelayClient;
2517
+ /** Valid EVM address, or undefined -- undefined clears the list and stops polling. */
2518
+ recipient?: string;
2519
+ /** Gate: wait for truthy before the first fetch (RelayDeposit passes rawCatalog). Default true. */
2520
+ enabled?: boolean;
2521
+ /** REST safety-net cadence in milliseconds. Defaults to 30s; the open Deposit popup uses 1s
2522
+ * so completion still appears promptly when the SSE event is absent. */
2523
+ refetchInterval?: number;
2524
+ /** @deprecated Use `refetchInterval`. Retained for compatibility. */
2525
+ fallbackPollMs?: number;
2526
+ onError?: (e: Error) => void;
2527
+ }
2528
+ interface UseRelayOrdersResult {
2529
+ /** Every order swept from deposits to this recipient so far, newest-first
2530
+ * as served by the API. Polled continuously once `recipient` is a valid address. */
2531
+ orders: OrderSummary[];
2532
+ ordersLoading: boolean;
2533
+ ordersError?: Error;
2534
+ /** Recipient the current snapshot belongs to. Undefined while a new
2535
+ * subscription is waiting for its first accepted fetch, so consumers never
2536
+ * baseline a previous recipient's rows as fresh deposits. */
2537
+ ordersForRecipient?: string;
2538
+ /** Increments after every accepted fetch, even when the client returns the
2539
+ * same array reference or the request fails. Consumers use this as a
2540
+ * low-frequency refresh signal for related read models such as /recovery. */
2541
+ ordersRevision: number;
2542
+ /** True once at least one fetch has COMPLETED (success or failure) for the
2543
+ * current (recipient, enabled) subscription; false again when it resets.
2544
+ * Distinct from `!ordersLoading`, which is also true BEFORE the first fetch
2545
+ * has even started -- consumers that snapshot the list (e.g. the deposit
2546
+ * wizard's new-order watch) must wait for this, or they baseline against
2547
+ * the initial empty state and misread every existing order as new. */
2548
+ ordersInitialized: boolean;
2549
+ }
2550
+ declare function useRelayOrders(opts: UseRelayOrdersOptions): UseRelayOrdersResult;
2551
+
2552
+ interface UseRelayConfigOptions {
2553
+ /** Pre-built client. Takes precedence over apiBaseUrl. */
2554
+ client?: RelayClient;
2555
+ /** Used to build a client when `client` is not supplied. */
2556
+ apiBaseUrl?: string;
2557
+ /** Stops the request and clears the current snapshot. Defaults to true. */
2558
+ enabled?: boolean;
2559
+ /** Optional automatic REST refresh cadence in milliseconds. Disabled when omitted or <= 0. */
2560
+ refetchInterval?: number;
2561
+ onError?: (error: Error) => void;
2562
+ }
2563
+ interface UseRelayConfigResult {
2564
+ /** Latest GET /v1/config response. */
2565
+ config?: Catalog;
2566
+ loading: boolean;
2567
+ error?: Error;
2568
+ /** Re-fetches GET /v1/config using the current client. */
2569
+ refresh: () => void;
2570
+ }
2571
+ /**
2572
+ * Public read-only hook for Relay's origin/destination/target catalog.
2573
+ *
2574
+ * The response is a normal REST snapshot, not an SSE stream. Use
2575
+ * `refetchInterval` for periodic refreshes or call `refresh` for an immediate
2576
+ * read without replacing the client or remounting the component.
2577
+ */
2578
+ declare function useRelayConfig(opts?: UseRelayConfigOptions): UseRelayConfigResult;
2579
+
2580
+ type RecoveryAction = "execute" | "sweep";
2581
+ /** Per-attempt progress for `recover()`. "switching" = prompting a chain switch to BSC;
2582
+ * "deploying" = the factory.deploy() write is in flight/confirming (only needed when the
2583
+ * forwarder wasn't deployed yet); "recovering" = the execute()/sweepToUser() write is in
2584
+ * flight/confirming; "done"/"error" are terminal for this attempt. */
2585
+ type RecoveryStep = "idle" | "switching" | "deploying" | "recovering" | "done" | "error";
2586
+ interface RecoveryState {
2587
+ step: RecoveryStep;
2588
+ /** Tx hash of the factory.deploy() write -- only set when this attempt needed one. */
2589
+ deployTxHash?: string;
2590
+ /** Tx hash of the execute()/sweepToUser() write. */
2591
+ actionTxHash?: string;
2592
+ error?: string;
2593
+ }
2594
+
2595
+ type RelayRecoveryQueryKey = readonly [
2596
+ "relay",
2597
+ "recovery",
2598
+ number,
2599
+ string | null,
2600
+ string | null
2601
+ ];
2602
+ /**
2603
+ * React Query policies accepted by useRelayRecovery. The SDK owns the request
2604
+ * identity and response shape, so callers cannot replace queryKey/queryFn or
2605
+ * inject/select recovery balances.
2606
+ */
2607
+ type RelayRecoveryQueryOptions = Omit<UseQueryOptions<RecoveryInfo, Error, RecoveryInfo, RelayRecoveryQueryKey>, "queryKey" | "queryFn" | "select" | "initialData" | "initialDataUpdatedAt" | "placeholderData">;
2608
+ interface UseRelayRecoveryOptions {
2609
+ /** Pre-built client. Takes precedence over apiBaseUrl. */
2610
+ client?: RelayClient;
2611
+ /** Used to build a client via createRelayClient when client isn't passed. */
2612
+ apiBaseUrl?: string;
2613
+ /** Connected EVM wallet whose recoverable forwarder balances are queried. */
2614
+ recipient?: string;
2615
+ /** Optional CROSS delivery target passed to GET /v1/recovery. */
2616
+ target?: string;
2617
+ /** React Query lifecycle, cache, retry, and refetch policies. */
2618
+ query?: RelayRecoveryQueryOptions;
2619
+ /** Optional wallet capabilities. Read-only consumers may omit this. */
2620
+ wallet?: RelayWalletProps;
2621
+ /** Called when GET /v1/recovery returns 401. */
2622
+ onUnauthorized?: () => void;
2623
+ /** Called after a terminal query or recovery-action error. */
2624
+ onError?: (error: Error) => void;
2625
+ /** Called once after a recovery transaction confirms successfully. */
2626
+ onRecoverySuccess?: (result: RecoverySuccessResult) => void;
2627
+ /** Trusted factory override for a self-hosted deployment. */
2628
+ trustedFactories?: readonly string[];
2629
+ }
2630
+ interface UseRelayRecoveryResult {
2631
+ info?: RecoveryInfo;
2632
+ loading: boolean;
2633
+ error?: Error;
2634
+ /** True for background refetches as well as the first request. */
2635
+ isFetching: boolean;
2636
+ /** Invalidates no identities; immediately refetches this hook's fixed query. */
2637
+ refresh: () => void;
2638
+ /** Signs a recovery transaction for the currently fetched info. */
2639
+ recover: (action: RecoveryAction, tokenAddress?: string) => Promise<void>;
2640
+ recoveryState: RecoveryState;
2641
+ }
2642
+ /**
2643
+ * Public Recovery API hook. Unlike the widget-internal useRecovery fetch, this
2644
+ * hook uses the host QueryClient and accepts React Query policies through
2645
+ * `query`. queryKey/queryFn and balance-shaping options remain SDK-owned.
2646
+ */
2647
+ declare function useRelayRecovery(opts?: UseRelayRecoveryOptions): UseRelayRecoveryResult;
2648
+
2502
2649
  interface StatusTrackerProps {
2503
2650
  orderId: string;
2504
2651
  /** Latest polled order (steps/txs) from GET /v1/orders/{orderId}, owned by the caller. */
@@ -2522,4 +2669,4 @@ declare function StatusTracker({ orderId, order, error }: StatusTrackerProps): r
2522
2669
  * the old ones. */
2523
2670
  declare const DEFAULT_TRUSTED_FACTORIES: readonly string[];
2524
2671
 
2525
- export { APPLE_ICON, AppLauncher, AppLauncherContent, type AppLauncherContentProps, type AppLauncherProps, AppLauncherTrigger, type AppLauncherTriggerProps, type AppLauncherTriggerStyle, type AppLauncherUsageMode, BINANCE_ICON, type BridgeAmountSource, type BridgeApprovalInfo, type BridgeApproveFn, type BridgeFailedInfo, BridgeFlow, type BridgeFlowProps, type BridgeGetApprovalFn, type BridgeGetToTokensFn, type BridgeHistoryItem, type BridgeInfoRow, type BridgeInfoTokenRef, type BridgeLiquidityInfo, type BridgePathType, type BridgeQuoteFn, type BridgeQuoteInput, type BridgeQuoteResult, type BridgeStatus, type BridgeStep, type BridgeSubmitFn, type BridgeSubmittedInfo, type BridgeToken, type BridgeTxSummary, CHAINS_CONFIG_FILE, CONNECTOR_REGISTRY, CROSSX_ICON, type Catalog, type ChainDisplayMeta, type ChainId, type ChainsConfig, ConnectButton, type ConnectButtonProps, type ConnectButtonStyle, ConnectorId, type ConnectorMeta, type CrossdPosition, type CrossdPositionDetail, type CrossdPositionPoolRef, type CrossdPositionTokenRef, DEFAULT_SKILLS_HREF, DEFAULT_TRUSTED_FACTORIES, DappUiErrorBoundary, type DappUiErrorBoundaryProps, type DappUiFailureReason, type DappUiFeature, type DappUiFlow, type DepositAddressResult, type DrawerDirection$1 as DrawerDirection, type Environment, type EstimateGasArgs, type EstimateGasFn, GOOGLE_ICON, type GameSwapPool, type GameSwapTokenRef, type GasEstimate, type GetBalanceFn, type GetTransactionReceiptArgs, type GetTransactionReceiptFn, type GlobalMenu, type GlobalMenuItem, type GlobalMenuItemAssetUrl, type GlobalMenuItemServiceStatus, type GlobalMenuItemUrl, type InitDappUiSentryOptions, type LpBalanceInfo, type LpBalanceReaderFn, METAMASK_ICON, type OnOutlink, type OrderSummary, type OriginOption, type OutlinkCategory, type OutlinkContext, type OutlinkOrigin, PORTFOLIO_SECTIONS, type PortfolioSection, type PreferredToken, type QuoteResult, type ReadContractFn, type RecentSendAddress, type RecoveryInfo, RelayApiError, type RelayBalance, type RelayClient, type RelayClientOptions, type RelayContractCall, RelayDeposit, type RelayDepositContentProps, type RelayDepositProps, type RelayDepositTriggerProps, type RelayDrawerDirection, type Hex as RelayHex, RelayHistory, type RelayHistoryContentProps, type RelayHistoryProps, type RelayHistoryTriggerProps, RelayRecovery, type RelayRecoveryContentProps, type RelayRecoveryProps, type RelayRecoveryTriggerProps, type SendTransactionFn as RelaySendTransactionFn, type RelayTheme, type RelayTxRequest, type RelayWalletProps, SOCIAL_REGISTRY, type SendAccount, type SendAsset, SendFlow, type SendFlowProps, type SendPageProps, type SendStatus, type SendTransactionArgs, type SendTransactionFn$1 as SendTransactionFn, SkillsButton, type SkillsButtonProps, type SkillsButtonStyle, type SocialConfig, type SocialHandlers, type SocialId, type StakingRewardsInfo, type StakingRewardsReaderFn, StatusTracker, type StatusTrackerProps, type SwitchChainFn, TOKEN_STATS_QUERY_KEY, type Theme, type TokenBalance, type TokenBalanceResponse, type TokenStats, type TokenStatsResponse, type TrackDappUiFunnelOptions, type TransactionReceiptResult, USER_BALANCE_QUERY_KEY, WALLET_REGISTRY, type WaitForReceiptFn, type WalletConfig, WalletConnectModal, type WalletConnectModalContentProps, type WalletConnectModalProps, type WalletConnectModalStyle, type WalletConnectModalTriggerProps, type WalletHandlers, type WalletId, WalletInfo, type WalletInfoContentProps, type WalletInfoFooterProps, type WalletInfoNavProps, type WalletInfoProps, type WalletInfoStyle, type WalletInfoTriggerProps, WalletPortfolio, WalletPortfolioBody, type WalletPortfolioBodyProps, type WalletPortfolioContentProps, type WalletPortfolioProps, type WalletPortfolioTriggerProps, type WalletProvider, type WriteContractFn, announceAppLauncherUsage, captureDappUiException, createRelayClient, getChainDisplay, getDappUiSentryScope, initDappUiSentry, normalizeFailureReason, resolveEnvironment, setDappUiAnalyticsUser, trackDappUiEvent, trackDappUiFunnel, useChainDisplay, useChainsConfig, useGlobalMenu, useTokenBalance, useTokenStats, useWalletDetect };
2672
+ export { APPLE_ICON, AppLauncher, AppLauncherContent, type AppLauncherContentProps, type AppLauncherProps, AppLauncherTrigger, type AppLauncherTriggerProps, type AppLauncherTriggerStyle, type AppLauncherUsageMode, BINANCE_ICON, type BridgeAmountSource, type BridgeApprovalInfo, type BridgeApproveFn, type BridgeFailedInfo, BridgeFlow, type BridgeFlowProps, type BridgeGetApprovalFn, type BridgeGetToTokensFn, type BridgeHistoryItem, type BridgeInfoRow, type BridgeInfoTokenRef, type BridgeLiquidityInfo, type BridgePathType, type BridgeQuoteFn, type BridgeQuoteInput, type BridgeQuoteResult, type BridgeStatus, type BridgeStep, type BridgeSubmitFn, type BridgeSubmittedInfo, type BridgeToken, type BridgeTxSummary, CHAINS_CONFIG_FILE, CONNECTOR_REGISTRY, CROSSX_ICON, type Catalog, type ChainDisplayMeta, type ChainId, type ChainsConfig, ConnectButton, type ConnectButtonProps, type ConnectButtonStyle, ConnectorId, type ConnectorMeta, type CrossdPosition, type CrossdPositionDetail, type CrossdPositionPoolRef, type CrossdPositionTokenRef, DEFAULT_SKILLS_HREF, DEFAULT_TRUSTED_FACTORIES, DappUiErrorBoundary, type DappUiErrorBoundaryProps, type DappUiFailureReason, type DappUiFeature, type DappUiFlow, type DepositAddressResult, type DrawerDirection$1 as DrawerDirection, type Environment, type EstimateGasArgs, type EstimateGasFn, GOOGLE_ICON, type GameSwapPool, type GameSwapTokenRef, type GasEstimate, type GetBalanceFn, type GetTransactionReceiptArgs, type GetTransactionReceiptFn, type GlobalMenu, type GlobalMenuItem, type GlobalMenuItemAssetUrl, type GlobalMenuItemServiceStatus, type GlobalMenuItemUrl, type InitDappUiSentryOptions, type LpBalanceInfo, type LpBalanceReaderFn, METAMASK_ICON, type OnOutlink, type OrderSummary, type OriginOption, type OutlinkCategory, type OutlinkContext, type OutlinkOrigin, PORTFOLIO_SECTIONS, type PortfolioSection, type PreferredToken, type QuoteResult, type ReadContractFn, type RecentSendAddress, type RecoveryInfo, type RecoverySuccessResult, RelayApiError, type RelayBalance, type RelayClient, type RelayClientOptions, type RelayContractCall, RelayDeposit, type RelayDepositContentProps, type RelayDepositProps, type RelayDepositTriggerProps, type RelayDrawerDirection, type Hex as RelayHex, RelayHistory, type RelayHistoryContentProps, type RelayHistoryProps, type RelayHistoryTriggerProps, RelayRecovery, type RecoveryAction as RelayRecoveryAction, type RelayRecoveryContentProps, type RelayRecoveryProps, type RelayRecoveryQueryKey, type RelayRecoveryQueryOptions, type RecoveryState as RelayRecoveryState, type RecoveryStep as RelayRecoveryStep, type RelayRecoveryTriggerProps, type SendTransactionFn as RelaySendTransactionFn, type RelayTheme, type RelayTxRequest, type RelayWalletProps, SOCIAL_REGISTRY, type SendAccount, type SendAsset, SendFlow, type SendFlowProps, type SendPageProps, type SendStatus, type SendTransactionArgs, type SendTransactionFn$1 as SendTransactionFn, SkillsButton, type SkillsButtonProps, type SkillsButtonStyle, type SocialConfig, type SocialHandlers, type SocialId, type StakingRewardsInfo, type StakingRewardsReaderFn, StatusTracker, type StatusTrackerProps, type SwitchChainFn, TOKEN_STATS_QUERY_KEY, type Theme, type TokenBalance, type TokenBalanceResponse, type TokenStats, type TokenStatsResponse, type TrackDappUiFunnelOptions, type TransactionReceiptResult, USER_BALANCE_QUERY_KEY, type UseRelayConfigOptions, type UseRelayConfigResult, type UseRelayOrdersOptions, type UseRelayOrdersResult, type UseRelayRecoveryOptions, type UseRelayRecoveryResult, WALLET_REGISTRY, type WaitForReceiptFn, type WalletConfig, WalletConnectModal, type WalletConnectModalContentProps, type WalletConnectModalProps, type WalletConnectModalStyle, type WalletConnectModalTriggerProps, type WalletHandlers, type WalletId, WalletInfo, type WalletInfoContentProps, type WalletInfoFooterProps, type WalletInfoNavProps, type WalletInfoProps, type WalletInfoStyle, type WalletInfoTriggerProps, WalletPortfolio, WalletPortfolioBody, type WalletPortfolioBodyProps, type WalletPortfolioContentProps, type WalletPortfolioProps, type WalletPortfolioTriggerProps, type WalletProvider, type WriteContractFn, announceAppLauncherUsage, captureDappUiException, createRelayClient, getChainDisplay, getDappUiSentryScope, initDappUiSentry, normalizeFailureReason, resolveEnvironment, setDappUiAnalyticsUser, trackDappUiEvent, trackDappUiFunnel, useChainDisplay, useChainsConfig, useGlobalMenu, useRelayConfig, useRelayOrders, useRelayRecovery, useTokenBalance, useTokenStats, useWalletDetect };
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import * as React from 'react';
3
3
  import { Component, ReactNode, ErrorInfo, CSSProperties } from 'react';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
+ import { UseQueryOptions } from '@tanstack/react-query';
6
7
 
7
8
  type Environment = "dev" | "stage" | "production";
8
9
  type Theme = "dark" | "light";
@@ -54,7 +55,7 @@ interface InitDappUiSentryOptions {
54
55
  enabled?: boolean;
55
56
  /** Override DSN (tests / self-hosted relay). */
56
57
  dsn?: string;
57
- /** 0–1 sample rate for ui:/funnel: analytics events (default 1). Errors are never sampled. */
58
+ /** 0–1 sample rate for ui:/funnel: analytics events (default 0.1). Errors are never sampled. */
58
59
  analyticsSampleRate?: number;
59
60
  }
60
61
  /**
@@ -2158,6 +2159,14 @@ interface RelayWalletProps {
2158
2159
  waitForReceipt?: WaitForReceiptFn;
2159
2160
  getBalance?: GetBalanceFn;
2160
2161
  }
2162
+ /** A recovery transaction confirmed successfully on BNB Smart Chain. */
2163
+ interface RecoverySuccessResult {
2164
+ action: "execute" | "sweep";
2165
+ forwarder: string;
2166
+ actionTxHash: string;
2167
+ /** Present only when this attempt first had to deploy the forwarder. */
2168
+ deployTxHash?: string;
2169
+ }
2161
2170
  type RelayTheme = "dark" | "light";
2162
2171
  type RelayDrawerDirection = "bottom" | "left" | "right" | "top";
2163
2172
  /**
@@ -2238,6 +2247,8 @@ interface RelayDepositProps extends RelayWalletProps {
2238
2247
  * watch `depositState` (phase/txHash/reverted) for those. Safe to treat as
2239
2248
  * "the funds moved" (upstream 83845fb). */
2240
2249
  onDeposited?: (txHash: string) => void;
2250
+ /** Fired once after a recovery action receipt confirms successfully. */
2251
+ onRecoverySuccess?: (result: RecoverySuccessResult) => void;
2241
2252
  onError?: (error: Error) => void;
2242
2253
  /** Called by the `Connect Wallet` CTA under the locked card that stands in for the QR
2243
2254
  * while the required connected wallet (or, in low-level public-address mode,
@@ -2302,6 +2313,8 @@ interface RelayRecoveryProps extends RelayWalletProps {
2302
2313
  * `RelayDepositProps.trustedFactories`.
2303
2314
  */
2304
2315
  trustedFactories?: readonly string[];
2316
+ /** Fired once after a recovery action receipt confirms successfully. */
2317
+ onRecoverySuccess?: (result: RecoverySuccessResult) => void;
2305
2318
  onError?: (e: Error) => void;
2306
2319
  /** Extra class name(s) for the modal/drawer content element. */
2307
2320
  className?: string;
@@ -2499,6 +2512,140 @@ declare const RelayRecovery: typeof RelayRecoveryRoot & {
2499
2512
  Content: typeof RelayRecoveryContent;
2500
2513
  };
2501
2514
 
2515
+ interface UseRelayOrdersOptions {
2516
+ client: RelayClient;
2517
+ /** Valid EVM address, or undefined -- undefined clears the list and stops polling. */
2518
+ recipient?: string;
2519
+ /** Gate: wait for truthy before the first fetch (RelayDeposit passes rawCatalog). Default true. */
2520
+ enabled?: boolean;
2521
+ /** REST safety-net cadence in milliseconds. Defaults to 30s; the open Deposit popup uses 1s
2522
+ * so completion still appears promptly when the SSE event is absent. */
2523
+ refetchInterval?: number;
2524
+ /** @deprecated Use `refetchInterval`. Retained for compatibility. */
2525
+ fallbackPollMs?: number;
2526
+ onError?: (e: Error) => void;
2527
+ }
2528
+ interface UseRelayOrdersResult {
2529
+ /** Every order swept from deposits to this recipient so far, newest-first
2530
+ * as served by the API. Polled continuously once `recipient` is a valid address. */
2531
+ orders: OrderSummary[];
2532
+ ordersLoading: boolean;
2533
+ ordersError?: Error;
2534
+ /** Recipient the current snapshot belongs to. Undefined while a new
2535
+ * subscription is waiting for its first accepted fetch, so consumers never
2536
+ * baseline a previous recipient's rows as fresh deposits. */
2537
+ ordersForRecipient?: string;
2538
+ /** Increments after every accepted fetch, even when the client returns the
2539
+ * same array reference or the request fails. Consumers use this as a
2540
+ * low-frequency refresh signal for related read models such as /recovery. */
2541
+ ordersRevision: number;
2542
+ /** True once at least one fetch has COMPLETED (success or failure) for the
2543
+ * current (recipient, enabled) subscription; false again when it resets.
2544
+ * Distinct from `!ordersLoading`, which is also true BEFORE the first fetch
2545
+ * has even started -- consumers that snapshot the list (e.g. the deposit
2546
+ * wizard's new-order watch) must wait for this, or they baseline against
2547
+ * the initial empty state and misread every existing order as new. */
2548
+ ordersInitialized: boolean;
2549
+ }
2550
+ declare function useRelayOrders(opts: UseRelayOrdersOptions): UseRelayOrdersResult;
2551
+
2552
+ interface UseRelayConfigOptions {
2553
+ /** Pre-built client. Takes precedence over apiBaseUrl. */
2554
+ client?: RelayClient;
2555
+ /** Used to build a client when `client` is not supplied. */
2556
+ apiBaseUrl?: string;
2557
+ /** Stops the request and clears the current snapshot. Defaults to true. */
2558
+ enabled?: boolean;
2559
+ /** Optional automatic REST refresh cadence in milliseconds. Disabled when omitted or <= 0. */
2560
+ refetchInterval?: number;
2561
+ onError?: (error: Error) => void;
2562
+ }
2563
+ interface UseRelayConfigResult {
2564
+ /** Latest GET /v1/config response. */
2565
+ config?: Catalog;
2566
+ loading: boolean;
2567
+ error?: Error;
2568
+ /** Re-fetches GET /v1/config using the current client. */
2569
+ refresh: () => void;
2570
+ }
2571
+ /**
2572
+ * Public read-only hook for Relay's origin/destination/target catalog.
2573
+ *
2574
+ * The response is a normal REST snapshot, not an SSE stream. Use
2575
+ * `refetchInterval` for periodic refreshes or call `refresh` for an immediate
2576
+ * read without replacing the client or remounting the component.
2577
+ */
2578
+ declare function useRelayConfig(opts?: UseRelayConfigOptions): UseRelayConfigResult;
2579
+
2580
+ type RecoveryAction = "execute" | "sweep";
2581
+ /** Per-attempt progress for `recover()`. "switching" = prompting a chain switch to BSC;
2582
+ * "deploying" = the factory.deploy() write is in flight/confirming (only needed when the
2583
+ * forwarder wasn't deployed yet); "recovering" = the execute()/sweepToUser() write is in
2584
+ * flight/confirming; "done"/"error" are terminal for this attempt. */
2585
+ type RecoveryStep = "idle" | "switching" | "deploying" | "recovering" | "done" | "error";
2586
+ interface RecoveryState {
2587
+ step: RecoveryStep;
2588
+ /** Tx hash of the factory.deploy() write -- only set when this attempt needed one. */
2589
+ deployTxHash?: string;
2590
+ /** Tx hash of the execute()/sweepToUser() write. */
2591
+ actionTxHash?: string;
2592
+ error?: string;
2593
+ }
2594
+
2595
+ type RelayRecoveryQueryKey = readonly [
2596
+ "relay",
2597
+ "recovery",
2598
+ number,
2599
+ string | null,
2600
+ string | null
2601
+ ];
2602
+ /**
2603
+ * React Query policies accepted by useRelayRecovery. The SDK owns the request
2604
+ * identity and response shape, so callers cannot replace queryKey/queryFn or
2605
+ * inject/select recovery balances.
2606
+ */
2607
+ type RelayRecoveryQueryOptions = Omit<UseQueryOptions<RecoveryInfo, Error, RecoveryInfo, RelayRecoveryQueryKey>, "queryKey" | "queryFn" | "select" | "initialData" | "initialDataUpdatedAt" | "placeholderData">;
2608
+ interface UseRelayRecoveryOptions {
2609
+ /** Pre-built client. Takes precedence over apiBaseUrl. */
2610
+ client?: RelayClient;
2611
+ /** Used to build a client via createRelayClient when client isn't passed. */
2612
+ apiBaseUrl?: string;
2613
+ /** Connected EVM wallet whose recoverable forwarder balances are queried. */
2614
+ recipient?: string;
2615
+ /** Optional CROSS delivery target passed to GET /v1/recovery. */
2616
+ target?: string;
2617
+ /** React Query lifecycle, cache, retry, and refetch policies. */
2618
+ query?: RelayRecoveryQueryOptions;
2619
+ /** Optional wallet capabilities. Read-only consumers may omit this. */
2620
+ wallet?: RelayWalletProps;
2621
+ /** Called when GET /v1/recovery returns 401. */
2622
+ onUnauthorized?: () => void;
2623
+ /** Called after a terminal query or recovery-action error. */
2624
+ onError?: (error: Error) => void;
2625
+ /** Called once after a recovery transaction confirms successfully. */
2626
+ onRecoverySuccess?: (result: RecoverySuccessResult) => void;
2627
+ /** Trusted factory override for a self-hosted deployment. */
2628
+ trustedFactories?: readonly string[];
2629
+ }
2630
+ interface UseRelayRecoveryResult {
2631
+ info?: RecoveryInfo;
2632
+ loading: boolean;
2633
+ error?: Error;
2634
+ /** True for background refetches as well as the first request. */
2635
+ isFetching: boolean;
2636
+ /** Invalidates no identities; immediately refetches this hook's fixed query. */
2637
+ refresh: () => void;
2638
+ /** Signs a recovery transaction for the currently fetched info. */
2639
+ recover: (action: RecoveryAction, tokenAddress?: string) => Promise<void>;
2640
+ recoveryState: RecoveryState;
2641
+ }
2642
+ /**
2643
+ * Public Recovery API hook. Unlike the widget-internal useRecovery fetch, this
2644
+ * hook uses the host QueryClient and accepts React Query policies through
2645
+ * `query`. queryKey/queryFn and balance-shaping options remain SDK-owned.
2646
+ */
2647
+ declare function useRelayRecovery(opts?: UseRelayRecoveryOptions): UseRelayRecoveryResult;
2648
+
2502
2649
  interface StatusTrackerProps {
2503
2650
  orderId: string;
2504
2651
  /** Latest polled order (steps/txs) from GET /v1/orders/{orderId}, owned by the caller. */
@@ -2522,4 +2669,4 @@ declare function StatusTracker({ orderId, order, error }: StatusTrackerProps): r
2522
2669
  * the old ones. */
2523
2670
  declare const DEFAULT_TRUSTED_FACTORIES: readonly string[];
2524
2671
 
2525
- export { APPLE_ICON, AppLauncher, AppLauncherContent, type AppLauncherContentProps, type AppLauncherProps, AppLauncherTrigger, type AppLauncherTriggerProps, type AppLauncherTriggerStyle, type AppLauncherUsageMode, BINANCE_ICON, type BridgeAmountSource, type BridgeApprovalInfo, type BridgeApproveFn, type BridgeFailedInfo, BridgeFlow, type BridgeFlowProps, type BridgeGetApprovalFn, type BridgeGetToTokensFn, type BridgeHistoryItem, type BridgeInfoRow, type BridgeInfoTokenRef, type BridgeLiquidityInfo, type BridgePathType, type BridgeQuoteFn, type BridgeQuoteInput, type BridgeQuoteResult, type BridgeStatus, type BridgeStep, type BridgeSubmitFn, type BridgeSubmittedInfo, type BridgeToken, type BridgeTxSummary, CHAINS_CONFIG_FILE, CONNECTOR_REGISTRY, CROSSX_ICON, type Catalog, type ChainDisplayMeta, type ChainId, type ChainsConfig, ConnectButton, type ConnectButtonProps, type ConnectButtonStyle, ConnectorId, type ConnectorMeta, type CrossdPosition, type CrossdPositionDetail, type CrossdPositionPoolRef, type CrossdPositionTokenRef, DEFAULT_SKILLS_HREF, DEFAULT_TRUSTED_FACTORIES, DappUiErrorBoundary, type DappUiErrorBoundaryProps, type DappUiFailureReason, type DappUiFeature, type DappUiFlow, type DepositAddressResult, type DrawerDirection$1 as DrawerDirection, type Environment, type EstimateGasArgs, type EstimateGasFn, GOOGLE_ICON, type GameSwapPool, type GameSwapTokenRef, type GasEstimate, type GetBalanceFn, type GetTransactionReceiptArgs, type GetTransactionReceiptFn, type GlobalMenu, type GlobalMenuItem, type GlobalMenuItemAssetUrl, type GlobalMenuItemServiceStatus, type GlobalMenuItemUrl, type InitDappUiSentryOptions, type LpBalanceInfo, type LpBalanceReaderFn, METAMASK_ICON, type OnOutlink, type OrderSummary, type OriginOption, type OutlinkCategory, type OutlinkContext, type OutlinkOrigin, PORTFOLIO_SECTIONS, type PortfolioSection, type PreferredToken, type QuoteResult, type ReadContractFn, type RecentSendAddress, type RecoveryInfo, RelayApiError, type RelayBalance, type RelayClient, type RelayClientOptions, type RelayContractCall, RelayDeposit, type RelayDepositContentProps, type RelayDepositProps, type RelayDepositTriggerProps, type RelayDrawerDirection, type Hex as RelayHex, RelayHistory, type RelayHistoryContentProps, type RelayHistoryProps, type RelayHistoryTriggerProps, RelayRecovery, type RelayRecoveryContentProps, type RelayRecoveryProps, type RelayRecoveryTriggerProps, type SendTransactionFn as RelaySendTransactionFn, type RelayTheme, type RelayTxRequest, type RelayWalletProps, SOCIAL_REGISTRY, type SendAccount, type SendAsset, SendFlow, type SendFlowProps, type SendPageProps, type SendStatus, type SendTransactionArgs, type SendTransactionFn$1 as SendTransactionFn, SkillsButton, type SkillsButtonProps, type SkillsButtonStyle, type SocialConfig, type SocialHandlers, type SocialId, type StakingRewardsInfo, type StakingRewardsReaderFn, StatusTracker, type StatusTrackerProps, type SwitchChainFn, TOKEN_STATS_QUERY_KEY, type Theme, type TokenBalance, type TokenBalanceResponse, type TokenStats, type TokenStatsResponse, type TrackDappUiFunnelOptions, type TransactionReceiptResult, USER_BALANCE_QUERY_KEY, WALLET_REGISTRY, type WaitForReceiptFn, type WalletConfig, WalletConnectModal, type WalletConnectModalContentProps, type WalletConnectModalProps, type WalletConnectModalStyle, type WalletConnectModalTriggerProps, type WalletHandlers, type WalletId, WalletInfo, type WalletInfoContentProps, type WalletInfoFooterProps, type WalletInfoNavProps, type WalletInfoProps, type WalletInfoStyle, type WalletInfoTriggerProps, WalletPortfolio, WalletPortfolioBody, type WalletPortfolioBodyProps, type WalletPortfolioContentProps, type WalletPortfolioProps, type WalletPortfolioTriggerProps, type WalletProvider, type WriteContractFn, announceAppLauncherUsage, captureDappUiException, createRelayClient, getChainDisplay, getDappUiSentryScope, initDappUiSentry, normalizeFailureReason, resolveEnvironment, setDappUiAnalyticsUser, trackDappUiEvent, trackDappUiFunnel, useChainDisplay, useChainsConfig, useGlobalMenu, useTokenBalance, useTokenStats, useWalletDetect };
2672
+ export { APPLE_ICON, AppLauncher, AppLauncherContent, type AppLauncherContentProps, type AppLauncherProps, AppLauncherTrigger, type AppLauncherTriggerProps, type AppLauncherTriggerStyle, type AppLauncherUsageMode, BINANCE_ICON, type BridgeAmountSource, type BridgeApprovalInfo, type BridgeApproveFn, type BridgeFailedInfo, BridgeFlow, type BridgeFlowProps, type BridgeGetApprovalFn, type BridgeGetToTokensFn, type BridgeHistoryItem, type BridgeInfoRow, type BridgeInfoTokenRef, type BridgeLiquidityInfo, type BridgePathType, type BridgeQuoteFn, type BridgeQuoteInput, type BridgeQuoteResult, type BridgeStatus, type BridgeStep, type BridgeSubmitFn, type BridgeSubmittedInfo, type BridgeToken, type BridgeTxSummary, CHAINS_CONFIG_FILE, CONNECTOR_REGISTRY, CROSSX_ICON, type Catalog, type ChainDisplayMeta, type ChainId, type ChainsConfig, ConnectButton, type ConnectButtonProps, type ConnectButtonStyle, ConnectorId, type ConnectorMeta, type CrossdPosition, type CrossdPositionDetail, type CrossdPositionPoolRef, type CrossdPositionTokenRef, DEFAULT_SKILLS_HREF, DEFAULT_TRUSTED_FACTORIES, DappUiErrorBoundary, type DappUiErrorBoundaryProps, type DappUiFailureReason, type DappUiFeature, type DappUiFlow, type DepositAddressResult, type DrawerDirection$1 as DrawerDirection, type Environment, type EstimateGasArgs, type EstimateGasFn, GOOGLE_ICON, type GameSwapPool, type GameSwapTokenRef, type GasEstimate, type GetBalanceFn, type GetTransactionReceiptArgs, type GetTransactionReceiptFn, type GlobalMenu, type GlobalMenuItem, type GlobalMenuItemAssetUrl, type GlobalMenuItemServiceStatus, type GlobalMenuItemUrl, type InitDappUiSentryOptions, type LpBalanceInfo, type LpBalanceReaderFn, METAMASK_ICON, type OnOutlink, type OrderSummary, type OriginOption, type OutlinkCategory, type OutlinkContext, type OutlinkOrigin, PORTFOLIO_SECTIONS, type PortfolioSection, type PreferredToken, type QuoteResult, type ReadContractFn, type RecentSendAddress, type RecoveryInfo, type RecoverySuccessResult, RelayApiError, type RelayBalance, type RelayClient, type RelayClientOptions, type RelayContractCall, RelayDeposit, type RelayDepositContentProps, type RelayDepositProps, type RelayDepositTriggerProps, type RelayDrawerDirection, type Hex as RelayHex, RelayHistory, type RelayHistoryContentProps, type RelayHistoryProps, type RelayHistoryTriggerProps, RelayRecovery, type RecoveryAction as RelayRecoveryAction, type RelayRecoveryContentProps, type RelayRecoveryProps, type RelayRecoveryQueryKey, type RelayRecoveryQueryOptions, type RecoveryState as RelayRecoveryState, type RecoveryStep as RelayRecoveryStep, type RelayRecoveryTriggerProps, type SendTransactionFn as RelaySendTransactionFn, type RelayTheme, type RelayTxRequest, type RelayWalletProps, SOCIAL_REGISTRY, type SendAccount, type SendAsset, SendFlow, type SendFlowProps, type SendPageProps, type SendStatus, type SendTransactionArgs, type SendTransactionFn$1 as SendTransactionFn, SkillsButton, type SkillsButtonProps, type SkillsButtonStyle, type SocialConfig, type SocialHandlers, type SocialId, type StakingRewardsInfo, type StakingRewardsReaderFn, StatusTracker, type StatusTrackerProps, type SwitchChainFn, TOKEN_STATS_QUERY_KEY, type Theme, type TokenBalance, type TokenBalanceResponse, type TokenStats, type TokenStatsResponse, type TrackDappUiFunnelOptions, type TransactionReceiptResult, USER_BALANCE_QUERY_KEY, type UseRelayConfigOptions, type UseRelayConfigResult, type UseRelayOrdersOptions, type UseRelayOrdersResult, type UseRelayRecoveryOptions, type UseRelayRecoveryResult, WALLET_REGISTRY, type WaitForReceiptFn, type WalletConfig, WalletConnectModal, type WalletConnectModalContentProps, type WalletConnectModalProps, type WalletConnectModalStyle, type WalletConnectModalTriggerProps, type WalletHandlers, type WalletId, WalletInfo, type WalletInfoContentProps, type WalletInfoFooterProps, type WalletInfoNavProps, type WalletInfoProps, type WalletInfoStyle, type WalletInfoTriggerProps, WalletPortfolio, WalletPortfolioBody, type WalletPortfolioBodyProps, type WalletPortfolioContentProps, type WalletPortfolioProps, type WalletPortfolioTriggerProps, type WalletProvider, type WriteContractFn, announceAppLauncherUsage, captureDappUiException, createRelayClient, getChainDisplay, getDappUiSentryScope, initDappUiSentry, normalizeFailureReason, resolveEnvironment, setDappUiAnalyticsUser, trackDappUiEvent, trackDappUiFunnel, useChainDisplay, useChainsConfig, useGlobalMenu, useRelayConfig, useRelayOrders, useRelayRecovery, useTokenBalance, useTokenStats, useWalletDetect };