@naculus/connect-appkit-react 0.1.9 → 0.2.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.
Files changed (94) hide show
  1. package/README.md +4 -4
  2. package/dist/client.cjs +1 -1
  3. package/dist/client.cjs.map +1 -1
  4. package/dist/client.d.cts +144 -0
  5. package/dist/client.d.ts +144 -0
  6. package/dist/client.js +1 -1
  7. package/dist/client.js.map +1 -1
  8. package/dist/index.cjs +2 -1
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +2270 -0
  11. package/dist/index.d.ts +2270 -0
  12. package/dist/index.js +2 -1
  13. package/dist/index.js.map +1 -1
  14. package/package.json +30 -12
  15. package/api-extractor.json +0 -21
  16. package/src/chain-abstraction/index.ts +0 -8
  17. package/src/chain-abstraction/useCompareCosts.ts +0 -137
  18. package/src/chain-abstraction/useExecuteRoute.ts +0 -129
  19. package/src/chain-abstraction/useRouteQuote.ts +0 -168
  20. package/src/client.test.ts +0 -242
  21. package/src/client.ts +0 -265
  22. package/src/hooks/useAccount.test.ts +0 -67
  23. package/src/hooks/useAccount.ts +0 -37
  24. package/src/hooks/useBalance.test.ts +0 -459
  25. package/src/hooks/useBalance.ts +0 -170
  26. package/src/hooks/useChain.test.ts +0 -160
  27. package/src/hooks/useChain.ts +0 -53
  28. package/src/hooks/useConnect.test.ts +0 -112
  29. package/src/hooks/useConnect.ts +0 -29
  30. package/src/hooks/useDisconnect.test.ts +0 -75
  31. package/src/hooks/useDisconnect.ts +0 -32
  32. package/src/hooks/useERC20Allowance.ts +0 -93
  33. package/src/hooks/useERC20Approve.ts +0 -220
  34. package/src/hooks/useERC20Transfer.ts +0 -134
  35. package/src/hooks/useERC20TransferSimulation.ts +0 -147
  36. package/src/hooks/useEmbeddedWallet.test.ts +0 -266
  37. package/src/hooks/useEmbeddedWallet.ts +0 -181
  38. package/src/hooks/useLastTx.test.ts +0 -117
  39. package/src/hooks/useLastTx.ts +0 -73
  40. package/src/hooks/useLookupAddress.ts +0 -131
  41. package/src/hooks/useNotification.ts +0 -308
  42. package/src/hooks/useResolveName.ts +0 -128
  43. package/src/hooks/useSIWxLogin.test.ts +0 -307
  44. package/src/hooks/useSIWxLogin.ts +0 -163
  45. package/src/hooks/useSIWxSession.test.ts +0 -481
  46. package/src/hooks/useSIWxSession.ts +0 -290
  47. package/src/hooks/useSendCalls.ts +0 -103
  48. package/src/hooks/useSendTransaction.test.ts +0 -175
  49. package/src/hooks/useSendTransaction.ts +0 -80
  50. package/src/hooks/useSendUserOperation.ts +0 -313
  51. package/src/hooks/useSession.ts +0 -96
  52. package/src/hooks/useSessionKeys.ts +0 -356
  53. package/src/hooks/useSignInWithEthereum.test.ts +0 -224
  54. package/src/hooks/useSignInWithEthereum.ts +0 -46
  55. package/src/hooks/useSignInWithX.test.ts +0 -210
  56. package/src/hooks/useSignInWithX.ts +0 -141
  57. package/src/hooks/useSignMessage.test.ts +0 -151
  58. package/src/hooks/useSignMessage.ts +0 -65
  59. package/src/hooks/useSimulateTransfer.ts +0 -165
  60. package/src/hooks/useSiwxAuthSession.test.ts +0 -456
  61. package/src/hooks/useSiwxAuthSession.ts +0 -163
  62. package/src/hooks/useSmartAccount.ts +0 -194
  63. package/src/hooks/useSwitchChain.ts +0 -68
  64. package/src/hooks/useTokenBalance.test.ts +0 -337
  65. package/src/hooks/useTokenBalance.ts +0 -210
  66. package/src/hooks/useTransactionSimulation.ts +0 -401
  67. package/src/hooks/useTxHistory.test.ts +0 -108
  68. package/src/hooks/useTxHistory.ts +0 -83
  69. package/src/hooks/useTxMonitor.test.ts +0 -127
  70. package/src/hooks/useTxMonitor.ts +0 -178
  71. package/src/hooks/useUserOpStatus.ts +0 -245
  72. package/src/hooks/useValidateDestination.test.ts +0 -96
  73. package/src/hooks/useValidateDestination.ts +0 -72
  74. package/src/hooks/useViemClient.test.ts +0 -155
  75. package/src/hooks/useViemClient.ts +0 -65
  76. package/src/hooks/useWallet.test.ts +0 -133
  77. package/src/hooks/useWallet.ts +0 -39
  78. package/src/hooks/useWeb3ErrorHandler.ts +0 -102
  79. package/src/index.ts +0 -186
  80. package/src/provider/Web3ConnectProvider.test.tsx +0 -178
  81. package/src/provider/Web3ConnectProvider.tsx +0 -530
  82. package/src/token-list/TokenSelector.tsx +0 -351
  83. package/src/token-list/defaults.ts +0 -39
  84. package/src/token-list/index.ts +0 -14
  85. package/src/token-list/useTokenList.ts +0 -119
  86. package/src/token-list/useTokenSearch.ts +0 -99
  87. package/src/types/index.ts +0 -99
  88. package/src/utils/chains.ts +0 -115
  89. package/src/utils/errorMessages.ts +0 -142
  90. package/src/utils/i18n.ts +0 -90
  91. package/src/wc-generated/components.ts +0 -377
  92. package/test/setup.ts +0 -17
  93. package/test/test-utils.tsx +0 -78
  94. package/tsup.config.ts +0 -18
@@ -0,0 +1,2270 @@
1
+ import * as _naculus_connect_core from '@naculus/connect-core';
2
+ import { UniversalWalletSession, WalletCapabilities, DelegationStatus, ExecutionPlan, AtomicityRequirement, BatchCall, SessionKeyInfo, ScopeCheckResult, SessionKeyTransaction, Hex, SessionKeyManagerConfig, SessionKeyScope, TokenConfig, NameResolverConfig, NameResult, InAppChannel, NotificationItem, NotificationSettings, PassphraseRequest, PassphraseGate, AddressResult, ExecutionStrategy, CallsStatus, Address as Address$1, Call, SendUserOpOptions, UserOperationResponse, UserOperationReceipt, ActiveSessionBundle, ChainSession, SmartAccountInfo, SolanaBalance, SolanaConfirmationStatus, SessionManager, TokenListSource, TokenListEntry, TokenSearchResult } from '@naculus/connect-core';
3
+ export { LAMPORTS_PER_SOL, PassphraseCancelledError, PassphraseGate, PassphraseIntent, PassphraseRequest, SolanaBalance, SolanaConfirmationStatus, SolanaRpcError, formatSol, getLatestBlockhash, getSignatureStatus, getSolanaBalance, parseSol } from '@naculus/connect-core';
4
+ import { PocketConfig, WalletAccount, WalletNamespace, WalletData, StorageSecurityReport } from '@naculus/connector-embedded';
5
+ export { StorageSecurityFinding, StorageSecurityReport, WalletAccount, WalletData, WalletNamespace } from '@naculus/connector-embedded';
6
+ import { Web3Client } from './client.js';
7
+ export { ClientConfig, clearClient, createClient, getClient } from './client.js';
8
+ import * as _naculus_connect_appkit_core from '@naculus/connect-appkit-core';
9
+ import { Web3State, WalletChain, ChainInfo } from '@naculus/connect-appkit-core';
10
+ export { ChainInfo, ConnectionStatus, WalletChain, Web3State } from '@naculus/connect-appkit-core';
11
+ import { Address, PublicClient, WalletClient } from 'viem';
12
+ import { SimulationResult } from '@naculus/wallet-engine';
13
+ export { ApprovalChange, BalanceChange, GasInfo, RiskAssessment, RiskLevel, RiskWarning, SimulationResult, SimulationStatus } from '@naculus/wallet-engine';
14
+ import * as React from 'react';
15
+ import React__default from 'react';
16
+ import { SiwxResult, SiwxSession } from '@naculus/siwx';
17
+ import { StencilReactComponent, EventName } from '@stencil/react-output-target/runtime';
18
+ import { AppkitAccordionCustomEvent, AppkitAlertDialogCustomEvent, AppkitCheckboxCustomEvent, AppkitCollapsibleCustomEvent, AppkitConnectButtonCustomEvent, AppkitDialogCustomEvent, AppkitDropdownMenuCustomEvent, AppkitInputCustomEvent, AppkitPopoverCustomEvent, AppkitSelectCustomEvent, AppkitSwitchCustomEvent, AppkitTabsCustomEvent, AppkitToggleGroupCustomEvent } from '@naculus/connect-appkit-wc';
19
+ import { Components } from '@naculus/connect-appkit-wc/dist/components';
20
+ import { AppkitAccordion as AppkitAccordion$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-accordion.js';
21
+ import { AppkitAccountButton as AppkitAccountButton$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-account-button.js';
22
+ import { AppkitAlertDialog as AppkitAlertDialog$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-alert-dialog.js';
23
+ import { AppkitAvatar as AppkitAvatar$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-avatar.js';
24
+ import { AppkitBadge as AppkitBadge$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-badge.js';
25
+ import { AppkitButton as AppkitButton$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-button.js';
26
+ import { AppkitCardContent as AppkitCardContent$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-card-content.js';
27
+ import { AppkitCardDescription as AppkitCardDescription$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-card-description.js';
28
+ import { AppkitCardFooter as AppkitCardFooter$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-card-footer.js';
29
+ import { AppkitCardHeader as AppkitCardHeader$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-card-header.js';
30
+ import { AppkitCardTitle as AppkitCardTitle$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-card-title.js';
31
+ import { AppkitCard as AppkitCard$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-card.js';
32
+ import { AppkitCheckbox as AppkitCheckbox$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-checkbox.js';
33
+ import { AppkitCollapsible as AppkitCollapsible$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-collapsible.js';
34
+ import { AppkitConnectButton as AppkitConnectButton$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-connect-button.js';
35
+ import { AppkitDialog as AppkitDialog$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-dialog.js';
36
+ import { AppkitDropdownMenu as AppkitDropdownMenu$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-dropdown-menu.js';
37
+ import { AppkitInput as AppkitInput$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-input.js';
38
+ import { AppkitPopover as AppkitPopover$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-popover.js';
39
+ import { AppkitProgress as AppkitProgress$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-progress.js';
40
+ import { AppkitScrollArea as AppkitScrollArea$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-scroll-area.js';
41
+ import { AppkitSelect as AppkitSelect$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-select.js';
42
+ import { AppkitSeparator as AppkitSeparator$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-separator.js';
43
+ import { AppkitSkeleton as AppkitSkeleton$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-skeleton.js';
44
+ import { AppkitSwitch as AppkitSwitch$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-switch.js';
45
+ import { AppkitTabs as AppkitTabs$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-tabs.js';
46
+ import { AppkitToggleGroup as AppkitToggleGroup$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-toggle-group.js';
47
+ import { AppkitTooltip as AppkitTooltip$1 } from '@naculus/connect-appkit-wc/dist/components/appkit-tooltip.js';
48
+ import '@naculus/connector-passkeys';
49
+ import '@naculus/connector-walletconnect';
50
+
51
+ /**
52
+ * useCompareCosts — React hook for comparing operation costs across chains.
53
+ *
54
+ * Provides reactive state for comparing gas costs, fees, and estimated
55
+ * times for a given operation across multiple chains.
56
+ *
57
+ * @example
58
+ * ```tsx
59
+ * import { useCompareCosts } from "@naculus/connect-appkit-react";
60
+ *
61
+ * function CostComparisonPanel() {
62
+ * const { comparisons, loading, error, refresh } = useCompareCosts({
63
+ * operation: "send_erc20",
64
+ * chains: ["eip155:1", "eip155:137", "eip155:10"],
65
+ * });
66
+ *
67
+ * if (loading) return <div>Loading...</div>;
68
+ *
69
+ * return (
70
+ * <div>
71
+ * {comparisons.map(c => (
72
+ * <div key={c.chain}>
73
+ * {c.chainName}: ${c.totalCost} (gas: ${c.gasCost})
74
+ * </div>
75
+ * ))}
76
+ * </div>
77
+ * );
78
+ * }
79
+ * ```
80
+ */
81
+ interface CostComparison {
82
+ chain: string;
83
+ chainName: string;
84
+ totalCost: string;
85
+ gasCost: string;
86
+ estimatedTimeMs: number;
87
+ }
88
+ type CostComparisonOperation = "send_erc20" | "swap" | "bridge" | (string & {});
89
+ interface CostComparisonOptions {
90
+ amount?: string;
91
+ token?: string;
92
+ [key: string]: unknown;
93
+ }
94
+ interface UseCompareCostsInput {
95
+ operation: CostComparisonOperation;
96
+ chains: string[];
97
+ options?: CostComparisonOptions;
98
+ }
99
+ interface UseCompareCostsReturn {
100
+ /** Sorted cost comparisons (cheapest first) */
101
+ comparisons: CostComparison[];
102
+ /** Whether a comparison request is in flight */
103
+ loading: boolean;
104
+ /** Error that occurred during the last request */
105
+ error: Error | null;
106
+ /** Manually trigger a refresh */
107
+ refresh: () => Promise<void>;
108
+ }
109
+ declare function useCompareCosts(input: UseCompareCostsInput, compareCostsFn?: (operation: string, chains: string[], options?: CostComparisonOptions) => Promise<CostComparison[]>): UseCompareCostsReturn;
110
+
111
+ /**
112
+ * useExecuteRoute — React hook for executing cross-chain routes.
113
+ *
114
+ * Manages the execution lifecycle of a cross-chain transfer.
115
+ * Tracks execution status, bridge reference, and completion state.
116
+ *
117
+ * @example
118
+ * ```tsx
119
+ * import { useExecuteRoute } from "@naculus/connect-appkit-react";
120
+ *
121
+ * function RouteExecutionPanel({ quote }) {
122
+ * const { execute, executing, result, error } = useExecuteRoute();
123
+ *
124
+ * return (
125
+ * <div>
126
+ * <button onClick={() => execute(quote, "0xRecipient")} disabled={executing}>
127
+ * {executing ? "Executing..." : "Execute Route"}
128
+ * </button>
129
+ * {result && <div>Tx: {result.fromTxHash}</div>}
130
+ * {error && <div>Error: {error.message}</div>}
131
+ * </div>
132
+ * );
133
+ * }
134
+ * ```
135
+ */
136
+ interface Quote$1 {
137
+ routeId: string;
138
+ provider: string;
139
+ totalCost?: bigint;
140
+ estimatedTimeMs?: number;
141
+ /**
142
+ * CAIP-2 chain the funds arrive on.
143
+ *
144
+ * Optional, and the only thing that makes `recipient` checkable. Without it
145
+ * this hook cannot know whether "0x…" or a base58 string is the right shape,
146
+ * so it does not guess — an EVM-looking check here would reject every
147
+ * legitimate Solana and XRPL recipient. Supply it and the recipient is
148
+ * validated for that namespace before anything is sent.
149
+ *
150
+ * Note that `Quote` as exported from the package root is `useRouteQuote`'s
151
+ * type, which has different fields. A quote from that hook satisfies this
152
+ * one structurally, so `totalCost` and `estimatedTimeMs` arrive undefined
153
+ * and `toChain` has to be supplied by the caller.
154
+ */
155
+ toChain?: string;
156
+ }
157
+ interface ExecuteRouteResult {
158
+ fromTxHash: string;
159
+ toTxHash?: string;
160
+ }
161
+ interface ExecuteOptions {
162
+ timeoutMs?: number;
163
+ gasLimit?: bigint;
164
+ }
165
+ interface UseExecuteRouteReturn {
166
+ /**
167
+ * Execute a route. Resolves with the result, or null if it failed.
168
+ *
169
+ * The result is returned as well as stored because `result` on this object
170
+ * belongs to the render that produced it: a caller awaiting `execute` cannot
171
+ * read it, and for a cross-chain transfer "did the funds move" is not a
172
+ * question to answer on the next render.
173
+ */
174
+ execute: (quote: Quote$1, recipient: string, options?: ExecuteOptions) => Promise<ExecuteRouteResult | null>;
175
+ /** Whether execution is in progress */
176
+ executing: boolean;
177
+ /** The execution result (populated after successful execution) */
178
+ result: ExecuteRouteResult | null;
179
+ /** Error that occurred during execution */
180
+ error: ExecuteError | null;
181
+ /** Reset execution state back to initial */
182
+ reset: () => void;
183
+ }
184
+ interface ExecuteError {
185
+ code: string;
186
+ message: string;
187
+ details?: Record<string, unknown>;
188
+ }
189
+ /**
190
+ * Hook for executing a cross-chain route.
191
+ *
192
+ * Manages the full lifecycle from calling executeRoute to
193
+ * tracking the result. For auto-approve flows, handles the
194
+ * approve → cross-chain sequence.
195
+ *
196
+ * @param executeRouteFn - Function that performs the actual route execution
197
+ */
198
+ declare function useExecuteRoute(executeRouteFn?: (quote: Quote$1, recipient: string, options?: ExecuteOptions) => Promise<ExecuteRouteResult>): UseExecuteRouteReturn;
199
+
200
+ /**
201
+ * useRouteQuote — React hook for cross-chain route quoting.
202
+ *
203
+ * Provides reactive state for discovering routes and getting quotes
204
+ * from the RouteEngine. Returns loading, error, and result states.
205
+ *
206
+ * @example
207
+ * ```tsx
208
+ * import { useRouteQuote } from "@naculus/connect-appkit-react";
209
+ *
210
+ * function QuotePanel() {
211
+ * const { quotes, loading, error, refresh } = useRouteQuote({
212
+ * fromChain: "eip155:1",
213
+ * toChain: "eip155:137",
214
+ * fromToken: "USDC",
215
+ * amount: "1000000",
216
+ * });
217
+ *
218
+ * if (loading) return <div>Loading quotes...</div>;
219
+ * if (error) return <div>Error: {error.message}</div>;
220
+ *
221
+ * return (
222
+ * <div>
223
+ * {quotes.map(q => (
224
+ * <div key={q.routeId}>
225
+ * {q.provider} — {q.netReceiveFormatted} {q.toTokenSymbol}
226
+ * </div>
227
+ * ))}
228
+ * </div>
229
+ * );
230
+ * }
231
+ * ```
232
+ */
233
+ interface Quote {
234
+ routeId: string;
235
+ provider: string;
236
+ netReceiveFormatted: string;
237
+ toTokenSymbol: string;
238
+ }
239
+ interface QuoteOptions {
240
+ sortBy?: "cost" | "time" | "balance";
241
+ maxSlippage?: number;
242
+ }
243
+ interface UseRouteQuoteInput {
244
+ fromChain: string;
245
+ toChain: string;
246
+ fromToken: string;
247
+ toToken?: string;
248
+ amount: string;
249
+ options?: QuoteOptions;
250
+ }
251
+ interface UseRouteQuoteReturn {
252
+ /** Current list of quotes (sorted by options.sortBy) */
253
+ quotes: Quote[];
254
+ /** Whether a quote request is in flight */
255
+ loading: boolean;
256
+ /** Error that occurred during the last request */
257
+ error: Error | null;
258
+ /** Manually trigger a refresh (re-fetches quotes) */
259
+ refresh: () => Promise<void>;
260
+ /** Clear the current quotes and error state */
261
+ clear: () => void;
262
+ }
263
+ /**
264
+ * Hook for fetching cross-chain route quotes.
265
+ *
266
+ * Automatically re-fetches when input parameters change.
267
+ * Debounces rapid changes to avoid excessive API calls.
268
+ *
269
+ * @param input - Quote request parameters
270
+ * @param getQuoteFn - Function that performs the actual quote fetch
271
+ */
272
+ declare function useRouteQuote(input: UseRouteQuoteInput, getQuoteFn?: (from: string, to: string, token: string, amount: string, options?: QuoteOptions,
273
+ /**
274
+ * Destination token for a cross-token route. Appended so existing
275
+ * implementations stay assignable; `toToken` was declared on the input and
276
+ * then dropped, so a USDC→USDT quote silently asked for USDC→USDC.
277
+ */
278
+ toToken?: string) => Promise<Quote[]>): UseRouteQuoteReturn;
279
+
280
+ interface AccountEntry {
281
+ /** As the session reports it: CAIP-10 for most wallets, bare hex for some. */
282
+ address: string;
283
+ /** The namespace, when the entry was CAIP-10. Null for a bare address. */
284
+ namespace: string | null;
285
+ isEVM: boolean;
286
+ }
287
+ /**
288
+ * The connected accounts, split by what they actually are.
289
+ *
290
+ * Reads the namespace from the CAIP-10 form rather than inferring it from
291
+ * address shape wherever it can, and falls back to shape only for a bare
292
+ * address. A bare 0x-40-hex value is unambiguously EVM; a bare base58 string
293
+ * is not unambiguously anything.
294
+ */
295
+ declare function useAccount(): {
296
+ accounts: AccountEntry[] | null;
297
+ evmAccount: string | null;
298
+ primaryAccount: string;
299
+ isConnected: boolean;
300
+ count: number;
301
+ };
302
+
303
+ /** SIWx (Sign-In With X) CAIP-122 configuration */
304
+ interface SIWxConfig {
305
+ /** Called after wallet connects to build the message to sign */
306
+ createMessage: (params: {
307
+ address: string;
308
+ chainId: string;
309
+ }) => Promise<string>;
310
+ /** Called after the user signs the message */
311
+ handleSignComplete?: (params: {
312
+ message: string;
313
+ signature: string;
314
+ }) => Promise<void>;
315
+ /** Whether SIWx is required. If true, wallet disconnects on sign failure (default: true) */
316
+ required?: boolean;
317
+ /**
318
+ * Whether an authenticated session already exists, asked on reconnect.
319
+ *
320
+ * `autoConnect` restores a stored wallet session on every page load, and
321
+ * that path used to report `connected` without SIWx ever running — so
322
+ * `required: true`, the strongest setting, was enforced on first connect
323
+ * and skipped on every refresh afterwards.
324
+ *
325
+ * Reconnect now re-authenticates when SIWx is required. Supply this to say
326
+ * "the user is already signed in, do not prompt again": return true from
327
+ * your own session check — `useSIWxSession` tracks expiry for exactly this.
328
+ *
329
+ * Absent means unknown, and unknown re-authenticates. A signature prompt is
330
+ * a nuisance; treating an unverified session as signed in is not.
331
+ */
332
+ hasValidSession?: () => boolean | Promise<boolean>;
333
+ }
334
+ interface Web3ConnectConfig {
335
+ projectId: string;
336
+ metadata: {
337
+ name: string;
338
+ description: string;
339
+ url: string;
340
+ icons: string[];
341
+ };
342
+ chains?: WalletChain[];
343
+ /** SIWx (Sign-In With X) post-connection authentication */
344
+ siwx?: SIWxConfig;
345
+ storageKey?: string;
346
+ /** Enable embedded self-custodial wallet */
347
+ enableEmbedded?: boolean;
348
+ /** Configuration forwarded to the embedded wallet engine. */
349
+ embeddedConfig?: PocketConfig;
350
+ /** Enable passkeys (WebAuthn) connector */
351
+ enablePasskeys?: boolean;
352
+ /** Enable Solana injected wallet connector (Phantom, Solflare) */
353
+ enableSolana?: boolean;
354
+ /** Default Solana chain for injected wallet connections (e.g. "solana:0"). */
355
+ solanaDefaultChain?: string;
356
+ /** Connection timeout in milliseconds (default: 30000) */
357
+ connectionTimeout?: number;
358
+ /** Max retry attempts for reconnection (default: 2) */
359
+ maxRetries?: number;
360
+ /** Refresh fee data after a chain switch (default: true). */
361
+ autoRefreshFeeOnSwitch?: boolean;
362
+ /**
363
+ * Optional AES-256-GCM encryption key for session persistence.
364
+ * When provided, session data is encrypted at rest in localStorage. This
365
+ * key is frontend runtime data, not a secret boundary; never use a PaaS
366
+ * root credential, signing key, or private API token here.
367
+ * When omitted, existing backward-compatible plaintext storage is used.
368
+ */
369
+ encryptionKey?: string;
370
+ }
371
+ interface Web3Actions {
372
+ startPairing: () => Promise<string>;
373
+ /**
374
+ * Abandon an in-flight pairing.
375
+ *
376
+ * WalletConnect cannot withdraw a proposal once the URI is displayed, so
377
+ * this refuses the resulting session and disconnects it if the wallet
378
+ * approves anyway. A user who cancels must not end up connected.
379
+ */
380
+ cancelPairing: () => void;
381
+ completePairing: () => Promise<UniversalWalletSession>;
382
+ connect: () => Promise<void>;
383
+ connectInjected: (walletId?: string) => Promise<void>;
384
+ /** Connect via embedded self-custodial wallet */
385
+ connectEmbedded: () => Promise<void>;
386
+ /** Connect via passkeys (WebAuthn) */
387
+ connectPasskeys: () => Promise<void>;
388
+ disconnect: () => Promise<void>;
389
+ reconnect: () => Promise<void>;
390
+ switchChain: (chainId: string) => Promise<void>;
391
+ /** Clear the current error state without triggering reconnection */
392
+ clearError: () => void;
393
+ }
394
+ interface UseWalletReturn extends Web3State, Web3Actions {
395
+ }
396
+ type EvmTransaction = {
397
+ to: string;
398
+ from?: string;
399
+ value?: string;
400
+ data?: string;
401
+ gas?: string;
402
+ gasPrice?: string;
403
+ nonce?: string;
404
+ chainId?: number;
405
+ };
406
+
407
+ interface UseBalanceOptions {
408
+ /** Auto-refresh interval in milliseconds. Default: undefined (no auto-refresh). */
409
+ refreshInterval?: number;
410
+ }
411
+ interface UseBalanceResult {
412
+ /** Raw balance in wei (string), or null if not connected / error */
413
+ balance: string | null;
414
+ /** Human-readable formatted balance in ETH (or native token), or null */
415
+ formatted: string | null;
416
+ /** Native token symbol (e.g. "ETH", "MATIC") */
417
+ /**
418
+ * The native currency symbol, or null when it is not known.
419
+ *
420
+ * Null rather than "ETH". This is rendered beside the number, so a fallback
421
+ * labels 1.5 MATIC or 1.5 SOL as ether. Show the amount without a unit, or
422
+ * hide it, but do not name the wrong one.
423
+ */
424
+ symbol: string | null;
425
+ /** USD price of one native token, or null if unavailable */
426
+ usdPrice: number | null;
427
+ /** Formatted USD value of the balance (e.g. "$1,234.56"), or null */
428
+ usdValue: string | null;
429
+ isLoading: boolean;
430
+ error: Error | null;
431
+ refetch: () => Promise<void>;
432
+ chain: WalletChain | null;
433
+ }
434
+ declare function useBalance(options?: UseBalanceOptions): UseBalanceResult;
435
+
436
+ /**
437
+ * Whether a wallet can execute a batch atomically.
438
+ *
439
+ * Three values, not two. A wallet that does not implement
440
+ * `wallet_getCapabilities` has not said no — it has said nothing, and EIP-5792
441
+ * is explicit that absence is not a denial. Collapsing that into `false` sends
442
+ * every such wallet down the sequential path, which is the one where an
443
+ * approve can land and the swap it was for can fail.
444
+ */
445
+ type AtomicSupport = "supported" | "unsupported" | "unknown";
446
+ interface ChainCapabilities {
447
+ /** CAIP-2 chain this describes. */
448
+ chainId: string;
449
+ atomic: AtomicSupport;
450
+ /** Largest batch the wallet will accept, when it says. */
451
+ maxBatchSize?: number;
452
+ /** The raw entry, for capabilities this SDK does not model. */
453
+ raw: WalletCapabilities;
454
+ }
455
+ interface UseCapabilitiesReturn {
456
+ /** Per-chain, keyed by CAIP-2. Null until a query has actually returned. */
457
+ capabilities: Record<string, ChainCapabilities> | null;
458
+ /** The connected chain's entry, for the common case. */
459
+ current: ChainCapabilities | null;
460
+ /**
461
+ * Atomic support on the connected chain.
462
+ *
463
+ * `"unknown"` while loading, when the wallet does not implement the method,
464
+ * and when the query failed — all three are "we have not been told", and a
465
+ * caller deciding between an atomic and a sequential path needs to know that
466
+ * rather than be handed a confident `false`.
467
+ */
468
+ atomic: AtomicSupport;
469
+ isFetching: boolean;
470
+ error: Error | null;
471
+ refetch: () => Promise<void>;
472
+ }
473
+ /**
474
+ * What the connected wallet says it can do — EIP-5792
475
+ * `wallet_getCapabilities`.
476
+ *
477
+ * This is the query a dApp makes *before* choosing how to execute: ask whether
478
+ * the wallet batches atomically, then send one batch or a sequence, rather
479
+ * than sending a batch and discovering the answer from a rejection.
480
+ */
481
+ declare function useCapabilities(): UseCapabilitiesReturn;
482
+
483
+ /**
484
+ * The connected chain, and the chains it is possible to switch to.
485
+ *
486
+ * All the judgement lives in `core/chain-selection.ts`, which imports no
487
+ * framework — the Vue binding for this is the same three calls.
488
+ */
489
+ declare function useChain(): {
490
+ chainId: string | null;
491
+ currentChain: WalletChain | null;
492
+ chainInfo: ChainInfo | null;
493
+ availableChains: WalletChain[];
494
+ chains: WalletChain[];
495
+ isEvm: boolean;
496
+ switchChain: (chainId: string) => Promise<void>;
497
+ };
498
+
499
+ declare function useConnect(): {
500
+ connect: () => Promise<void>;
501
+ isConnecting: boolean;
502
+ error: Error | null;
503
+ };
504
+
505
+ interface UseDelegationReturn extends DelegationStatus {
506
+ isFetching: boolean;
507
+ error: Error | null;
508
+ refetch: () => Promise<void>;
509
+ }
510
+ /**
511
+ * Whether the connected EOA currently delegates to contract code — EIP-7702.
512
+ *
513
+ * A delegated account executes like a contract account: it can run several
514
+ * calls in one transaction, which is the thing that decides whether batching
515
+ * is possible at all for an ordinary address.
516
+ *
517
+ * `delegated` is `null` until the code has actually been read, and stays null
518
+ * when the read fails. That is not the same as `false`: treating a failed RPC
519
+ * as "no delegation" is how an account that can batch gets sent down the path
520
+ * for one that cannot.
521
+ */
522
+ declare function useDelegation(): UseDelegationReturn;
523
+
524
+ /** Which executor actually runs the calls. */
525
+ type ExecutionRoute = "wallet-batch" | "user-operation" | "sequential";
526
+ interface ExecutionPreview extends ExecutionPlan {
527
+ route: ExecutionRoute | null;
528
+ }
529
+ interface UseExecuteCallsOptions {
530
+ /** Default requirement for `execute`. Per-call override is also accepted. */
531
+ atomicity?: AtomicityRequirement;
532
+ /**
533
+ * Whether gas must be covered by a paymaster.
534
+ *
535
+ * A separate axis from atomicity: it answers who pays, not whether the calls
536
+ * land together, and either can end in a refusal on its own. A route that
537
+ * executes perfectly but charges a user who was promised sponsored gas is
538
+ * still the wrong route, and signing is too late to find out.
539
+ */
540
+ sponsorship?: AtomicityRequirement;
541
+ /**
542
+ * ERC-7677 service passed to `wallet_sendCalls` when the wallet advertises
543
+ * paymaster support. Advertising support alone does not sponsor a call: the
544
+ * service URL (and optional context) is the executable configuration.
545
+ */
546
+ paymasterService?: {
547
+ url: string;
548
+ context?: Record<string, unknown>;
549
+ };
550
+ /**
551
+ * A smart-account executor, typically `sendUserOp` from
552
+ * `useSendUserOperation`.
553
+ *
554
+ * A UserOperation carries its calls in one on-chain execution, so it is
555
+ * atomic by construction. Supplying this gives a wallet that cannot batch a
556
+ * route that still satisfies `"required"` instead of a refusal.
557
+ */
558
+ userOperation?: (calls: BatchCall[]) => Promise<string>;
559
+ /** Whether the supplied UserOperation executor is configured to sponsor gas. */
560
+ userOperationSponsored?: boolean;
561
+ }
562
+ interface UseExecuteCallsReturn {
563
+ /**
564
+ * What would happen for this many calls, without sending anything.
565
+ *
566
+ * This is the query EIP-5792 exists for. An application can show "these two
567
+ * will land together" or "these will be sent one by one" before the user
568
+ * commits, rather than discovering it from a half-executed batch.
569
+ */
570
+ preview: (callCount: number, atomicity?: AtomicityRequirement) => ExecutionPreview;
571
+ execute: (calls: BatchCall[], atomicity?: AtomicityRequirement) => Promise<string>;
572
+ isExecuting: boolean;
573
+ error: Error | null;
574
+ /** The route the last `execute` took. */
575
+ lastRoute: ExecutionRoute | null;
576
+ reset: () => void;
577
+ }
578
+ /**
579
+ * Route a set of calls to whichever executor can honour the caller's
580
+ * atomicity requirement — and refuse when none can.
581
+ *
582
+ * `useSendCalls` already picks between an EIP-5792 batch and a sequential
583
+ * fallback, but it picks silently and always sends something. A caller that
584
+ * batched an approve with the swap it pays for cannot tell the difference
585
+ * between "these landed together" and "the approve landed and the swap did
586
+ * not", which is the outcome that leaves an approval standing to a contract
587
+ * the user never transacted with.
588
+ */
589
+ declare function useExecuteCalls(options?: UseExecuteCallsOptions): UseExecuteCallsReturn;
590
+
591
+ interface DelegationPolicyPreview {
592
+ policy: SessionKeyInfo | null;
593
+ scope: ScopeCheckResult;
594
+ execution: ExecutionPreview;
595
+ signerMatches: boolean;
596
+ /** The stored signature still matches the persisted scope, signer, and origin. */
597
+ authorizationVerified: boolean;
598
+ /** Policy and route preflight passed; this does not imply broadcast. */
599
+ ready: boolean;
600
+ /** False until a session-signature-aware AA/7702 broadcaster is attached. */
601
+ broadcastReady: boolean;
602
+ /** The concrete on-chain route, when one has proved the policy is installed. */
603
+ broadcastRoute: PolicyExecutionRoute | null;
604
+ /** Whether that route has verified on-chain authorization for this policy. */
605
+ onchainAuthorizationVerified: boolean;
606
+ /** Guaranteed gas payer status for the configured broadcast route. */
607
+ broadcastSponsored: boolean | null;
608
+ /** Whether submission can proceed without invoking the main wallet again. */
609
+ broadcastPromptless: boolean;
610
+ reason: string;
611
+ }
612
+ type PolicyExecutionRoute = "erc4337" | "eip7702";
613
+ interface PolicyExecutionCheck {
614
+ /** True only after the adapter has checked its live account/module state. */
615
+ ready: boolean;
616
+ /** True only when the session policy is enforceable by the target account. */
617
+ authorizationInstalled: boolean;
618
+ /** Whether this route guarantees the user will not pay gas. */
619
+ sponsored: boolean;
620
+ /** True only when submission does not invoke the main wallet again. */
621
+ promptless: boolean;
622
+ /** EIP-7702 delegate observed/configured by the adapter. */
623
+ executorAddress?: `0x${string}`;
624
+ reason: string;
625
+ }
626
+ interface PreparedPolicyExecution {
627
+ /** Exact digest the configured account/module validates on chain. */
628
+ digest: Hex;
629
+ /** Authoritative facts used for the final locked policy check. */
630
+ transaction: SessionKeyTransaction;
631
+ /** Adapter-private payload passed back unchanged for submission. */
632
+ payload: unknown;
633
+ }
634
+ interface PolicyExecutionSubmission {
635
+ route: PolicyExecutionRoute;
636
+ /** UserOperation hash for ERC-4337, transaction hash for EIP-7702. */
637
+ hash: Hex;
638
+ /** A hash proves submission, not inclusion. */
639
+ status: "submitted";
640
+ }
641
+ /**
642
+ * Account-specific bridge between a signed Naculus policy and on-chain code.
643
+ *
644
+ * ERC-4337 does not standardize session keys, and EIP-7702 only delegates code;
645
+ * the selected account/module still defines the signature envelope and policy
646
+ * storage. The adapter therefore has to prove that authorization is installed,
647
+ * prepare the exact digest that code validates, and broadcast that same payload.
648
+ */
649
+ interface PolicyExecutionAdapter {
650
+ route: PolicyExecutionRoute;
651
+ check: (request: {
652
+ policy: SessionKeyInfo;
653
+ transaction: SessionKeyTransaction;
654
+ }) => Promise<PolicyExecutionCheck>;
655
+ prepare: (request: {
656
+ policy: SessionKeyInfo;
657
+ transaction: SessionKeyTransaction;
658
+ }) => Promise<PreparedPolicyExecution>;
659
+ broadcast: (request: {
660
+ policy: SessionKeyInfo;
661
+ prepared: PreparedPolicyExecution;
662
+ signature: Hex;
663
+ }) => Promise<PolicyExecutionSubmission>;
664
+ }
665
+ interface UseDelegationPolicyOptions {
666
+ /** Must include a host-provided encryptionKey before a policy can be created. */
667
+ managerConfig?: SessionKeyManagerConfig;
668
+ execution?: UseExecuteCallsOptions;
669
+ /** Domain shown in the signed policy. Defaults to the browser origin. */
670
+ origin?: string;
671
+ /** Concrete AA-module or EIP-7702 executor for promptless submissions. */
672
+ adapter?: PolicyExecutionAdapter;
673
+ }
674
+ interface UseDelegationPolicyReturn {
675
+ policies: SessionKeyInfo[];
676
+ /** Active policies whose persisted signature still verifies. */
677
+ activePolicies: SessionKeyInfo[];
678
+ storageAvailable: boolean;
679
+ loading: boolean;
680
+ isBusy: boolean;
681
+ error: Error | null;
682
+ delegation: ReturnType<typeof useDelegation>;
683
+ createPolicy: (scope: Partial<SessionKeyScope>) => Promise<SessionKeyInfo>;
684
+ revokePolicy: (policyId: string) => Promise<void>;
685
+ previewPolicyExecution: (policyId: string, tx: SessionKeyTransaction, callCount?: number, atomicity?: AtomicityRequirement) => Promise<DelegationPolicyPreview>;
686
+ /**
687
+ * Sign one 32-byte execution digest after enforcing the persisted policy.
688
+ * This returns a signature only; an AA/7702 adapter must still broadcast it.
689
+ */
690
+ signPolicyDigest: (policyId: string, digest: `0x${string}`, tx: SessionKeyTransaction) => Promise<`0x${string}`>;
691
+ /** Prepare, policy-check, session-sign, and submit one exact operation. */
692
+ executePolicy: (policyId: string, tx: SessionKeyTransaction) => Promise<PolicyExecutionSubmission>;
693
+ refresh: () => Promise<void>;
694
+ clearError: () => void;
695
+ }
696
+ /** Build the exact, deterministic message the main wallet authorizes. */
697
+ declare function buildDelegationPolicyMessage(policy: SessionKeyInfo, origin: string): string;
698
+ /**
699
+ * Complete product flow for local, signed, persistent session policies.
700
+ *
701
+ * This intentionally supports `offchain` mode only. Creating an EIP-7702 or
702
+ * AA-module policy requires a real on-chain executor; accepting those modes
703
+ * here would turn a local record into a false delegation claim.
704
+ */
705
+ declare function useDelegationPolicy(options?: UseDelegationPolicyOptions): UseDelegationPolicyReturn;
706
+
707
+ declare function useDisconnect(): {
708
+ disconnect: () => Promise<void>;
709
+ isDisconnecting: boolean;
710
+ error: Error | null;
711
+ cleanup: () => void;
712
+ };
713
+
714
+ /** Public account metadata. Signing material never enters React state. */
715
+ type EmbeddedWalletAccountView = Omit<WalletAccount, "privateKey">;
716
+ /**
717
+ * Public wallet metadata safe to render or pass through application state.
718
+ *
719
+ * `WalletData` is deliberately still returned by explicit create/import
720
+ * calls because those are recovery workflows. The long-lived `wallet` state
721
+ * must never retain the mnemonic or account private keys.
722
+ */
723
+ interface EmbeddedWalletView {
724
+ accounts: EmbeddedWalletAccountView[];
725
+ activeNamespace: WalletNamespace;
726
+ createdAt: number;
727
+ chainId?: string;
728
+ version?: 2;
729
+ /** Whether the stored record can derive missing namespace accounts. */
730
+ recoveryAvailable: boolean;
731
+ readonly address?: string;
732
+ }
733
+ interface UseEmbeddedWalletReturn {
734
+ connectEmbedded: () => Promise<void>;
735
+ /** Load an existing wallet without creating or connecting a new one. */
736
+ restoreWallet: () => Promise<boolean>;
737
+ generateWallet: () => Promise<WalletData | null>;
738
+ importFromMnemonic: (mnemonic: string) => Promise<WalletData | null>;
739
+ /**
740
+ * Import a raw key in whatever form the user has it.
741
+ *
742
+ * Accepts the forms MetaMask, Phantom and `solana-keygen` export, and works
743
+ * out which chain it belongs to rather than asking. Only that namespace is
744
+ * enabled: a key is on exactly one curve, so an account for the other would
745
+ * be an address the key cannot control and the user cannot recover.
746
+ */
747
+ importFromPrivateKey: (pk: string) => Promise<WalletData | null>;
748
+ wipe: () => Promise<void>;
749
+ wallet: EmbeddedWalletView | null;
750
+ hasWallet: boolean;
751
+ /** The active account's address. See `accounts` for the rest. */
752
+ address: string | null;
753
+ /**
754
+ * Every account this wallet holds, one per namespace.
755
+ *
756
+ * A phrase derives an independent key per BIP-44 coin type, so a wallet
757
+ * created from one holds both an EVM and a Solana account. They are not
758
+ * variants of one key — holding one does not reveal the other.
759
+ */
760
+ accounts: EmbeddedWalletAccountView[];
761
+ /** Which account signs when no namespace is named. */
762
+ activeNamespace: WalletNamespace | null;
763
+ /**
764
+ * Choose which account signs.
765
+ *
766
+ * Rejects a namespace this wallet holds no account for, rather than leaving
767
+ * it pointing at nothing — a wallet imported from a raw key has only the
768
+ * namespace that key belongs to.
769
+ */
770
+ setActiveNamespace: (namespace: WalletNamespace) => void;
771
+ /**
772
+ * Derive accounts the phrase produces but this record does not yet hold.
773
+ *
774
+ * A wallet created before multi-namespace support already owns its Solana
775
+ * account — the same phrase in Phantom shows the balance — so this makes it
776
+ * visible here rather than leaving funds reachable everywhere except in this
777
+ * app. Leaves the active namespace alone: someone who had an Ethereum wallet
778
+ * yesterday should not find themselves on Solana today.
779
+ */
780
+ backfillAccounts: () => Promise<EmbeddedWalletAccountView[]>;
781
+ /** @deprecated Use getSeedPhrase() instead. This field will be removed. */
782
+ seedPhrase: string | null;
783
+ /** Get seed phrase once and clear from memory. Returns mnemonic or null. */
784
+ getSeedPhrase: () => string | null;
785
+ /** Read the active private key only for an explicit backup/export action. */
786
+ getPrivateKey: () => string | null;
787
+ backupPending: boolean;
788
+ confirmBackup: () => void;
789
+ isBusy: boolean;
790
+ error: Error | null;
791
+ clearError: () => void;
792
+ /**
793
+ * Storage security tier (1-4).
794
+ * 1 = IndexedDB + AES-GCM, 2 = IndexedDB,
795
+ * 3 = localStorage + AES-GCM, 4 = localStorage plaintext
796
+ */
797
+ storageSecurityLevel: number;
798
+ /**
799
+ * The same tier as a score with the findings behind it, or null before a
800
+ * wallet exists.
801
+ *
802
+ * Null rather than a worst-case report: the storage backend is chosen when
803
+ * the wallet is created, so warning about it beforehand would describe a
804
+ * state that has not happened.
805
+ */
806
+ securityReport: StorageSecurityReport | null;
807
+ }
808
+ declare function useEmbeddedWallet(): UseEmbeddedWalletReturn;
809
+
810
+ interface UseERC20AllowanceOptions {
811
+ token: TokenConfig;
812
+ owner: Address;
813
+ spender: Address;
814
+ refreshInterval?: number;
815
+ }
816
+ interface UseERC20AllowanceReturn {
817
+ allowance: string | null;
818
+ allowanceRaw: bigint | null;
819
+ isFetching: boolean;
820
+ error: Error | null;
821
+ refetch: () => Promise<void>;
822
+ }
823
+ declare function useERC20Allowance(options: UseERC20AllowanceOptions): UseERC20AllowanceReturn;
824
+
825
+ interface UseERC20ApproveOptions {
826
+ token: TokenConfig;
827
+ spender: Address;
828
+ }
829
+ interface UseERC20ApproveReturn {
830
+ /** Approve a specific amount */
831
+ approve: (amount: string) => Promise<`0x${string}`>;
832
+ /** Approve max (type(uint256).max — infinite approval) */
833
+ approveMax: () => Promise<`0x${string}`>;
834
+ /** Current allowance as raw bigint */
835
+ allowanceRaw: bigint | null;
836
+ /** Current allowance as human-readable string */
837
+ allowance: string | null;
838
+ /** Check if allowance >= required amount */
839
+ hasAllowance: (required: string) => Promise<boolean>;
840
+ isApproving: boolean;
841
+ isFetchingAllowance: boolean;
842
+ error: Error | null;
843
+ /**
844
+ * Re-read the allowance and return it.
845
+ *
846
+ * The value is returned because reading `allowanceRaw` immediately after
847
+ * awaiting this does not work: that binding belongs to the render that
848
+ * created the callback, and setState does not rewrite it.
849
+ */
850
+ refetchAllowance: () => Promise<bigint | null>;
851
+ }
852
+ declare function useERC20Approve(options: UseERC20ApproveOptions): UseERC20ApproveReturn;
853
+
854
+ interface UseERC20TransferOptions {
855
+ token: TokenConfig;
856
+ }
857
+ interface UseERC20TransferReturn {
858
+ /** Send a transfer. Returns tx hash on success. */
859
+ sendTransfer: (to: Address, amount: string) => Promise<`0x${string}`>;
860
+ isSending: boolean;
861
+ error: Error | null;
862
+ }
863
+ declare function useERC20Transfer(options: UseERC20TransferOptions): UseERC20TransferReturn;
864
+
865
+ interface UseTransactionSimulationReturn {
866
+ /** Current simulation result (undefined until first run) */
867
+ result: SimulationResult | undefined;
868
+ /** Whether a simulation is in progress */
869
+ isSimulating: boolean;
870
+ /** Error from the last simulation attempt */
871
+ error: Error | null;
872
+ /** Manually trigger a simulation */
873
+ simulate: () => Promise<SimulationResult>;
874
+ /** Reset the simulation state */
875
+ reset: () => void;
876
+ }
877
+ declare function useTransactionSimulation(tx: EvmTransaction | undefined, chainId?: number): UseTransactionSimulationReturn;
878
+
879
+ /**
880
+ * useERC20TransferSimulation — React hook for simulating ERC-20 token
881
+ * transfers before signing/submitting.
882
+ *
883
+ * Wraps useTransactionSimulation with ERC-20 transfer calldata building,
884
+ * so callers only need the token, recipient, and amount.
885
+ *
886
+ * @see /docs/features/transaction-simulation.md
887
+ */
888
+
889
+ interface UseERC20TransferSimulationOptions {
890
+ /** Token configuration (address, decimals, chainId) */
891
+ token: TokenConfig;
892
+ /** Recipient address */
893
+ to: `0x${string}`;
894
+ /** Amount in human-readable units (e.g. "1.50" for 1.5 USDC) */
895
+ amount: string;
896
+ }
897
+ interface UseERC20TransferSimulationReturn extends Omit<UseTransactionSimulationReturn, "simulate"> {
898
+ /** Simulation result for the built ERC-20 transfer */
899
+ result: SimulationResult | undefined;
900
+ /** Whether a simulation is in progress */
901
+ isSimulating: boolean;
902
+ /** Error from the last simulation attempt */
903
+ error: Error | null;
904
+ /** Re-run the simulation with current parameters */
905
+ reSimulate: () => Promise<SimulationResult>;
906
+ /** Reset simulation state */
907
+ reset: () => void;
908
+ }
909
+ declare function useERC20TransferSimulation(options: UseERC20TransferSimulationOptions): UseERC20TransferSimulationReturn;
910
+
911
+ type TxStatus = "pending" | "mined" | "confirmed" | "failed" | "unknown";
912
+ interface TxStatusEntry {
913
+ hash: string;
914
+ chainId: number;
915
+ from: string;
916
+ to: string;
917
+ value: string;
918
+ data?: string;
919
+ nonce?: number;
920
+ status: TxStatus;
921
+ blockNumber?: number;
922
+ blockHash?: string;
923
+ gasUsed?: string;
924
+ effectiveGasPrice?: string;
925
+ createdAt: number;
926
+ confirmedAt?: number;
927
+ updatedAt: number;
928
+ error?: string;
929
+ label?: string;
930
+ memo?: string;
931
+ replacementCount?: number;
932
+ }
933
+ /** Minimal TxMonitor interface for React hooks */
934
+ interface TxMonitorLike {
935
+ watchTx(hash: string, chainId: number, options?: {
936
+ requiredConfirmations?: number;
937
+ pollInterval?: number;
938
+ label?: string;
939
+ memo?: string;
940
+ initialEntry?: Partial<TxStatusEntry>;
941
+ }): Promise<TxStatusEntry>;
942
+ stopWatching(hash: string, chainId?: number): void;
943
+ getTxStatus(hash: string, chainId?: number): TxStatusEntry | null;
944
+ getTxHistory(address?: string, chainId?: number): Promise<TxStatusEntry[]>;
945
+ refreshTx(hash: string, chainId?: number): Promise<void>;
946
+ on(event: "statusChange", listener: (entry: TxStatusEntry) => void): this;
947
+ on(event: "confirmed", listener: (entry: TxStatusEntry) => void): this;
948
+ on(event: "failed", listener: (entry: TxStatusEntry) => void): this;
949
+ off(event: string, listener: Function): this;
950
+ }
951
+ declare const TxMonitorContext: React.Context<TxMonitorLike | null>;
952
+ interface UseTxMonitorResult {
953
+ entry: TxStatusEntry | null;
954
+ status: TxStatus | "idle";
955
+ isLoading: boolean;
956
+ isWatching: boolean;
957
+ error: Error | null;
958
+ refresh: () => Promise<void>;
959
+ stopWatching: () => void;
960
+ }
961
+ /**
962
+ * Monitor a single transaction's lifecycle.
963
+ * When hash changes, automatically stops old watch and starts new one.
964
+ */
965
+ declare function useTxMonitor(hash?: string, chainId?: number, monitor?: TxMonitorLike): UseTxMonitorResult;
966
+
967
+ interface UseLastTxResult {
968
+ /** Most recent transaction by createdAt */
969
+ lastTx: TxStatusEntry | null;
970
+ /** Most recent confirmed transaction */
971
+ lastConfirmedTx: TxStatusEntry | null;
972
+ /** Most recent failed transaction */
973
+ lastFailedTx: TxStatusEntry | null;
974
+ /** Clear cached lastTx state */
975
+ clear: () => void;
976
+ }
977
+ /**
978
+ * Track the most recent transaction.
979
+ * Automatically updates when a new transaction is sent (via statusChange events).
980
+ */
981
+ declare function useLastTx(monitor?: TxMonitorLike): UseLastTxResult;
982
+
983
+ /**
984
+ * Result of a reverse resolution query.
985
+ */
986
+ interface UseLookupAddressResult {
987
+ /** Resolved name, or null if not found / not started. */
988
+ data: NameResult | null;
989
+ /** Whether the lookup is in progress. */
990
+ isLoading: boolean;
991
+ /** Error that occurred during lookup, if any. */
992
+ error: Error | null;
993
+ /** Manually trigger re-lookup of the current address. */
994
+ refetch: () => void;
995
+ }
996
+ /**
997
+ * Options for the useLookupAddress hook.
998
+ */
999
+ interface UseLookupAddressOptions {
1000
+ /** Chain to resolve against, CAIP-2. */
1001
+ chainId?: string;
1002
+ /** Whether to skip the lookup (e.g. if the input is incomplete). */
1003
+ skip?: boolean;
1004
+ /** Custom resolver configuration (overrides default RPC URLs). */
1005
+ resolverConfig?: NameResolverConfig;
1006
+ }
1007
+ /**
1008
+ * React hook to resolve a blockchain address to a human-readable name.
1009
+ *
1010
+ * Reverse resolution for ENS and SNS.
1011
+ *
1012
+ * @example
1013
+ * ```tsx
1014
+ * function AccountLabel({ address }) {
1015
+ * const { data } = useLookupAddress(address);
1016
+ * return <span>{data?.name ?? address}</span>;
1017
+ * }
1018
+ * ```
1019
+ */
1020
+ declare function useLookupAddress(address: string, options?: UseLookupAddressOptions): UseLookupAddressResult;
1021
+
1022
+ /**
1023
+ * useNotification — React hook for push notification state.
1024
+ *
1025
+ * Provides notifications, settings, and control methods for the
1026
+ * in-app notification center.
1027
+ *
1028
+ * @example
1029
+ * ```tsx
1030
+ * import { useNotification } from "@naculus/connect-appkit-react";
1031
+ *
1032
+ * function NotificationCenter() {
1033
+ * const { notifications, unreadCount, clear, markAsRead } = useNotification();
1034
+ * return (
1035
+ * <div>
1036
+ * <span>Unread: {unreadCount}</span>
1037
+ * <ul>
1038
+ * {notifications.map(n => (
1039
+ * <li key={n.id} onClick={() => markAsRead(n.id)}>
1040
+ * {n.title} — {n.body}
1041
+ * </li>
1042
+ * ))}
1043
+ * </ul>
1044
+ * <button onClick={clear}>Clear all</button>
1045
+ * </div>
1046
+ * );
1047
+ * }
1048
+ * ```
1049
+ */
1050
+
1051
+ /**
1052
+ * Hook for consuming in-app notifications in React components.
1053
+ *
1054
+ * Uses InAppChannel internally to manage the notification queue.
1055
+ * All persistent state is stored via localStorage.
1056
+ */
1057
+ declare function useNotification(options?: {
1058
+ /** External InAppChannel instance (for sharing between hooks). If omitted, creates one. */
1059
+ channel?: InAppChannel;
1060
+ /** Custom storage for settings (defaults to localStorage) */
1061
+ storage?: {
1062
+ getItem: <T>(key: string) => Promise<T | null>;
1063
+ setItem: <T>(key: string, value: T) => Promise<void>;
1064
+ removeItem: (key: string) => Promise<void>;
1065
+ };
1066
+ }): {
1067
+ /** All in-app notifications (newest last) */
1068
+ notifications: NotificationItem[];
1069
+ /** Number of unread notifications */
1070
+ unreadCount: number;
1071
+ /** Add a single notification manually */
1072
+ addNotification: (item: Omit<NotificationItem, "id" | "timestamp">) => void;
1073
+ /** Clear all in-app notifications */
1074
+ clear: () => void;
1075
+ /** Clear a single notification */
1076
+ clearOne: (id: string) => void;
1077
+ /** Mark a notification as read */
1078
+ markAsRead: (id: string) => void;
1079
+ /** Mark all as read */
1080
+ markAllAsRead: () => void;
1081
+ /** Current notification settings */
1082
+ settings: NotificationSettings;
1083
+ /** Update notification settings */
1084
+ updateSettings: (update: Partial<NotificationSettings>) => void;
1085
+ /** Set active channels by id */
1086
+ setChannels: (channels: string[]) => void;
1087
+ /** Mute a chain */
1088
+ muteChain: (chainId: string) => void;
1089
+ /** Unmute a chain */
1090
+ unmuteChain: (chainId: string) => void;
1091
+ };
1092
+
1093
+ interface UsePassphraseGateReturn {
1094
+ /**
1095
+ * The open request, or null when nothing is being asked.
1096
+ *
1097
+ * Also null when no gate exists — an app that supplies its own
1098
+ * `encryptionPassphrase`, or one with encryption off entirely. A dialog can
1099
+ * render against this unconditionally.
1100
+ */
1101
+ request: PassphraseRequest | null;
1102
+ /** Answer the open request. */
1103
+ submit: (passphrase: string) => void;
1104
+ /** Abandon it, failing the load or save that asked. */
1105
+ cancel: () => void;
1106
+ /** Drop the held passphrase, so the next operation asks again. */
1107
+ forget: (reason?: string) => void;
1108
+ /** Whether a passphrase is held for this session. */
1109
+ isUnlocked: boolean;
1110
+ gate: PassphraseGate | null;
1111
+ }
1112
+ /**
1113
+ * Drives the passphrase prompt for the embedded wallet's encrypted storage.
1114
+ *
1115
+ * The gate belongs to the client, so a dialog mounted anywhere under the
1116
+ * provider answers whichever load or save is currently blocked on it.
1117
+ */
1118
+ declare function usePassphraseGate(): UsePassphraseGateReturn;
1119
+
1120
+ /**
1121
+ * Result of a name resolution query.
1122
+ */
1123
+ interface UseResolveNameResult {
1124
+ /** Resolved address, or null if not found / not started. */
1125
+ data: AddressResult | null;
1126
+ /** Whether the resolution is in progress. */
1127
+ isLoading: boolean;
1128
+ /** Error that occurred during resolution, if any. */
1129
+ error: Error | null;
1130
+ /** Manually trigger re-resolution of the current name. */
1131
+ refetch: () => void;
1132
+ }
1133
+ /**
1134
+ * Options for the useResolveName hook.
1135
+ */
1136
+ interface UseResolveNameOptions {
1137
+ /** Whether to skip resolution (e.g. if input is invalid). Default: false. */
1138
+ skip?: boolean;
1139
+ /** Custom resolver configuration (overrides default RPC URLs). */
1140
+ resolverConfig?: NameResolverConfig;
1141
+ }
1142
+ /**
1143
+ * React hook to resolve a human-readable name to a blockchain address.
1144
+ *
1145
+ * Supports ENS (.eth) and SNS (.sol) names.
1146
+ * Automatically detects the name service from the suffix.
1147
+ *
1148
+ * @example
1149
+ * ```tsx
1150
+ * function AddressInput() {
1151
+ * const { data, isLoading, error } = useResolveName('vitalik.eth');
1152
+ * return <div>{data?.address ?? 'Enter a name'}</div>;
1153
+ * }
1154
+ * ```
1155
+ */
1156
+ declare function useResolveName(name: string, options?: UseResolveNameOptions): UseResolveNameResult;
1157
+
1158
+ /**
1159
+ * Where a batch has got to.
1160
+ *
1161
+ * `"submitted"` was `"confirmed"`, which this hook is two steps away from
1162
+ * knowing. `wallet_sendCalls` answers with a bundle identifier, and a bundle
1163
+ * identifier does not even promise the calls were broadcast — EIP-5792 lets a
1164
+ * wallet accept them and send later. The sequential fallback returns the last
1165
+ * transaction hash, which promises broadcast and nothing more.
1166
+ *
1167
+ * `getCallsStatus` is what turns a bundle identifier into an outcome.
1168
+ */
1169
+ type SendCallsStatus = "idle" | "awaiting_approval" | "submitted" | "failed";
1170
+ declare function useSendCalls(): {
1171
+ sendCalls: (calls: BatchCall[], options?: {
1172
+ chainId?: string;
1173
+ strategy?: ExecutionStrategy;
1174
+ paymasterService?: {
1175
+ url: string;
1176
+ context?: Record<string, unknown>;
1177
+ };
1178
+ }) => Promise<string>;
1179
+ getCallsStatus: (hash?: string) => Promise<CallsStatus>;
1180
+ showCallsStatus: (hash?: string) => Promise<boolean>;
1181
+ status: SendCallsStatus;
1182
+ error: Error | null;
1183
+ batchHash: string | null;
1184
+ callsStatus: CallsStatus | null;
1185
+ /**
1186
+ * How the last send was actually executed, or null before one runs.
1187
+ *
1188
+ * "sequential" means the calls were sent one at a time and are NOT atomic:
1189
+ * an earlier call can land while a later one fails. Surfaced rather than
1190
+ * hidden because a caller batching an approve + swap needs to know which
1191
+ * guarantee it got.
1192
+ */
1193
+ execution: ExecutionStrategy | null;
1194
+ reset: () => void;
1195
+ isSending: boolean;
1196
+ };
1197
+
1198
+ /**
1199
+ * Where a send has got to.
1200
+ *
1201
+ * `"submitted"` was `"confirmed"`, which was a claim the hook could not
1202
+ * support: `sendTransaction` resolves with a transaction hash, and a hash
1203
+ * means the wallet broadcast it — not that it was mined, and not that it
1204
+ * succeeded. An interface showing "confirmed" at that moment tells someone
1205
+ * their payment went through while it can still revert or never be included.
1206
+ *
1207
+ * To reach an actual confirmation, watch the returned hash with
1208
+ * `useTxMonitor`, where `"confirmed"` is established by a receipt.
1209
+ */
1210
+ type SendTransactionStatus = "idle" | "awaiting_approval" | "submitted" | "failed";
1211
+ declare function useSendTransaction(): {
1212
+ sendTransaction: (transaction: EvmTransaction) => Promise<string>;
1213
+ status: SendTransactionStatus;
1214
+ error: Error | null;
1215
+ reset: () => void;
1216
+ isSending: boolean;
1217
+ };
1218
+
1219
+ /**
1220
+ * useSendUserOperation
1221
+ *
1222
+ * React hook for sending ERC-4337 UserOperations.
1223
+ * Uses the core SmartAccountManager so address derivation, deployment,
1224
+ * nonce reads, gas estimation, signing, and bundler serialization stay on one
1225
+ * implementation path.
1226
+ */
1227
+
1228
+ interface UseSendUserOperationOptions {
1229
+ /** RPC URL for the target chain */
1230
+ rpcUrl?: string;
1231
+ /** Bundler RPC URL */
1232
+ bundlerUrl?: string;
1233
+ /** Chain ID (CAIP-2 format) */
1234
+ chainId?: string;
1235
+ /** EntryPoint contract address */
1236
+ entryPoint?: Address$1;
1237
+ /** Smart account implementation type (default: "simple") */
1238
+ accountType?: "simple" | "light" | "kernel" | "safe";
1239
+ /** Optional salt for deterministic smart account address */
1240
+ salt?: bigint;
1241
+ /** Override the connected EVM account as the smart account owner */
1242
+ owner?: Address$1;
1243
+ /**
1244
+ * Optional signer for the UserOperation hash. A custom signer is assumed to
1245
+ * apply the signature scheme selected by `signerMode`.
1246
+ */
1247
+ signer?: (hash: Hex) => Promise<Hex> | Hex;
1248
+ /** Signature hash format expected by the account implementation */
1249
+ signerMode?: "raw" | "eip191";
1250
+ }
1251
+ interface UseSendUserOperationReturn {
1252
+ /** Send a UserOperation with the given calls */
1253
+ sendUserOp: (calls: Call[], options?: SendUserOpOptions) => Promise<UserOperationResponse | null>;
1254
+ /** The userOpHash from the last send */
1255
+ userOpHash: Hex | null;
1256
+ /** The receipt from the last UserOperation (null while pending) */
1257
+ receipt: UserOperationReceipt | null;
1258
+ /** Whether a UserOperation is currently being sent */
1259
+ isPending: boolean;
1260
+ /** Loading state for gas estimation and submission */
1261
+ isEstimating: boolean;
1262
+ /** Error state */
1263
+ error: Error | null;
1264
+ /** Reset state */
1265
+ reset: () => void;
1266
+ }
1267
+ /**
1268
+ * Hook for sending ERC-4337 UserOperations to a bundler.
1269
+ *
1270
+ * The connected EVM account is used as the smart-account owner. The hook uses
1271
+ * the active wallet's raw `personal_sign` request for WalletConnect and
1272
+ * injected wallets; embedded/passkey users must provide a raw-hash signer until
1273
+ * those connectors expose one.
1274
+ */
1275
+ declare function useSendUserOperation(options?: UseSendUserOperationOptions): UseSendUserOperationReturn;
1276
+
1277
+ interface UseSessionReturn {
1278
+ /** The raw wallet session (from the active bundle) */
1279
+ session: ActiveSessionBundle["walletSession"] | null;
1280
+ /** All chain sessions within the active bundle */
1281
+ chainSessions: ChainSession[];
1282
+ /** The currently active chain ID */
1283
+ activeChainId: string | null;
1284
+ /** Whether a wallet is connected */
1285
+ isConnected: boolean;
1286
+ /** The connector/wallet type (e.g., "eip6963", "walletconnect") */
1287
+ connectorId: string | null;
1288
+ }
1289
+ declare function useSession(sessionManager?: _naculus_connect_core.SessionManager | null): UseSessionReturn;
1290
+
1291
+ interface UseSessionKeysReturn {
1292
+ /** All session keys (active, revoked, expired) */
1293
+ sessions: SessionKeyInfo[];
1294
+ /** Only active session keys */
1295
+ activeSessions: SessionKeyInfo[];
1296
+ /** Whether data is loading */
1297
+ loading: boolean;
1298
+ /** Error from last operation */
1299
+ error: Error | null;
1300
+ /** Refresh the session list from storage */
1301
+ refresh: () => Promise<void>;
1302
+ /** Clear any error */
1303
+ clearError: () => void;
1304
+ /** Whether the storage backend is available */
1305
+ storageAvailable: boolean;
1306
+ }
1307
+ /**
1308
+ * Hook to list and manage session keys.
1309
+ *
1310
+ * @example
1311
+ * ```tsx
1312
+ * const { sessions, activeSessions, refresh } = useSessionKeys();
1313
+ * ```
1314
+ */
1315
+ declare function useSessionKeys(config?: SessionKeyManagerConfig): UseSessionKeysReturn;
1316
+ interface UseCreateSessionKeyReturn {
1317
+ /** Create a new session key */
1318
+ createSessionKey: (scope?: Partial<SessionKeyScope>, signerAddress?: `0x${string}`) => Promise<SessionKeyInfo>;
1319
+ /** The last created session key info */
1320
+ lastCreated: SessionKeyInfo | null;
1321
+ /** Whether creation is in progress */
1322
+ isCreating: boolean;
1323
+ /** Error from last creation */
1324
+ error: Error | null;
1325
+ /** Clear error */
1326
+ clearError: () => void;
1327
+ }
1328
+ /**
1329
+ * Hook to create new session keys.
1330
+ *
1331
+ * @example
1332
+ * ```tsx
1333
+ * const { createSessionKey, lastCreated, isCreating } = useCreateSessionKey();
1334
+ *
1335
+ * const handleCreate = async () => {
1336
+ * const session = await createSessionKey({
1337
+ * expiry: Math.floor(Date.now() / 1000) + 1800, // 30 min
1338
+ * maxTotalValue: parseEther("0.1"),
1339
+ * });
1340
+ * };
1341
+ * ```
1342
+ */
1343
+ declare function useCreateSessionKey(config?: SessionKeyManagerConfig): UseCreateSessionKeyReturn;
1344
+ interface UseRevokeSessionReturn {
1345
+ /** Revoke a session key by ID */
1346
+ revokeSession: (sessionId: string) => Promise<void>;
1347
+ /** Whether revoking is in progress */
1348
+ isRevoking: boolean;
1349
+ /** Error from last operation */
1350
+ error: Error | null;
1351
+ /** Clear error */
1352
+ clearError: () => void;
1353
+ }
1354
+ /**
1355
+ * Hook to revoke a session key.
1356
+ *
1357
+ * @example
1358
+ * ```tsx
1359
+ * const { revokeSession, isRevoking } = useRevokeSession();
1360
+ * await revokeSession(sessionId);
1361
+ * ```
1362
+ */
1363
+ declare function useRevokeSession(config?: SessionKeyManagerConfig): UseRevokeSessionReturn;
1364
+ interface UseSendWithSessionReturn {
1365
+ /** Sign a transaction hash after enforcing the transaction scope */
1366
+ signWithSession: (sessionId: string, messageHash: `0x${string}`, tx: SessionKeyTransaction) => Promise<`0x${string}`>;
1367
+ /** Check if a transaction is within a session's scope */
1368
+ checkScope: (sessionId: string, tx: {
1369
+ to?: string;
1370
+ value?: string;
1371
+ data?: string;
1372
+ chainId?: number;
1373
+ gas?: string;
1374
+ }) => Promise<{
1375
+ valid: boolean;
1376
+ reason?: string;
1377
+ remainingGas?: bigint;
1378
+ remainingValue?: bigint;
1379
+ remainingTxCount?: number;
1380
+ }>;
1381
+ /** Whether an operation is in progress */
1382
+ isBusy: boolean;
1383
+ /** Error from last operation */
1384
+ error: Error | null;
1385
+ /** Clear error */
1386
+ clearError: () => void;
1387
+ }
1388
+ /**
1389
+ * Hook to sign transactions using session keys and check scope.
1390
+ *
1391
+ * @example
1392
+ * ```tsx
1393
+ * const { signWithSession, checkScope } = useSendWithSession();
1394
+ *
1395
+ * const check = await checkScope(sessionId, tx);
1396
+ * if (check.valid) {
1397
+ * const sig = await signWithSession(sessionId, messageHash, tx);
1398
+ * }
1399
+ * ```
1400
+ */
1401
+ declare function useSendWithSession(config?: SessionKeyManagerConfig): UseSendWithSessionReturn;
1402
+ /**
1403
+ * Reset the global session key manager (useful for testing / cleanup).
1404
+ */
1405
+ declare function resetSessionKeyManager(): void;
1406
+
1407
+ /**
1408
+ * useSIWxLogin — Trigger a SIWx sign-in flow.
1409
+ *
1410
+ * A simplified hook for initiating wallet sign-in.
1411
+ * Returns a `signIn()` function and loading/error state.
1412
+ */
1413
+
1414
+ interface UseSIWxLoginOptions {
1415
+ /** Originating domain (default: window.location.host) */
1416
+ domain?: string;
1417
+ /** Human-readable statement */
1418
+ statement?: string;
1419
+ /** RFC 3986 URI (default: window.location.origin) */
1420
+ uri?: string;
1421
+ /** CAIP-2 chain ID (default: current chain from Web3 context) */
1422
+ chainId?: string;
1423
+ /** Session lifetime in seconds (default: 86400 = 24h) */
1424
+ expirySeconds?: number;
1425
+ /** URIs of resources the identity wishes to access */
1426
+ resources?: string[];
1427
+ /** CAIP-74 request ID */
1428
+ requestId?: string;
1429
+ }
1430
+ interface UseSIWxLoginReturn {
1431
+ /** Trigger the SIWx sign-in flow */
1432
+ signIn: (options?: UseSIWxLoginOptions) => Promise<SiwxResult>;
1433
+ /** Whether a sign-in is in progress */
1434
+ isSigningIn: boolean;
1435
+ /** Last sign-in error */
1436
+ error: Error | null;
1437
+ /** Clear the last error */
1438
+ clearError: () => void;
1439
+ }
1440
+ declare function useSIWxLogin(): UseSIWxLoginReturn;
1441
+
1442
+ /**
1443
+ * useSIWxSession — Unified SIWx session management hook.
1444
+ *
1445
+ * Combines the sign-in flow with session persistence, expiry tracking,
1446
+ * and automatic restoration. Replaces the older useSiwxAuthSession.
1447
+ *
1448
+ * Provides:
1449
+ * - signIn / signOut / refresh lifecycle
1450
+ * - Auto-restore from storage on mount
1451
+ * - isExpired / timeUntilExpiry query
1452
+ * - Loading/error state
1453
+ */
1454
+
1455
+ interface UseSIWxSessionOptions {
1456
+ /** Storage key prefix (default: "naculus_") */
1457
+ storagePrefix?: string;
1458
+ /** Auto-restore session from storage on mount (default: true) */
1459
+ autoRestore?: boolean;
1460
+ /** Default chain ID when signing in (default: current chain from context) */
1461
+ defaultChainId?: string;
1462
+ /** Default session lifetime in seconds (default: 86400 = 24h) */
1463
+ defaultExpirySeconds?: number;
1464
+ }
1465
+ interface UseSIWxSessionReturn {
1466
+ /** The current SIWx session, or null */
1467
+ session: SiwxSession | null;
1468
+ /** Whether a valid session exists */
1469
+ isAuthenticated: boolean;
1470
+ /** Whether we're still checking persisted auth on mount */
1471
+ isRestoring: boolean;
1472
+ /** Whether a sign-in is in progress */
1473
+ isSigningIn: boolean;
1474
+ /** Whether the current session has expired */
1475
+ isExpired: boolean;
1476
+ /** Milliseconds until session expires, or null */
1477
+ timeUntilExpiry: number | null;
1478
+ /** Sign in with optional overrides */
1479
+ signIn: (options?: UseSIWxLoginOptions) => Promise<SiwxSession>;
1480
+ /** Sign out: clears session from memory and storage */
1481
+ signOut: () => Promise<void>;
1482
+ /** Refresh the current session */
1483
+ refresh: () => Promise<SiwxSession>;
1484
+ /** Last error */
1485
+ error: Error | null;
1486
+ /** Clear the last error */
1487
+ clearError: () => void;
1488
+ }
1489
+ declare function useSIWxSession(options?: UseSIWxSessionOptions): UseSIWxSessionReturn;
1490
+
1491
+ interface UseSignInWithXOptions {
1492
+ domain?: string;
1493
+ statement?: string;
1494
+ uri?: string;
1495
+ chainId?: string;
1496
+ expirySeconds?: number;
1497
+ resources?: string[];
1498
+ requestId?: string;
1499
+ }
1500
+ interface UseSignInWithXReturn {
1501
+ signIn: (options?: UseSignInWithXOptions) => Promise<SiwxResult>;
1502
+ isSigningIn: boolean;
1503
+ result: SiwxResult | null;
1504
+ error: Error | null;
1505
+ clearError: () => void;
1506
+ }
1507
+ declare function useSignInWithX(): UseSignInWithXReturn;
1508
+
1509
+ interface UseSignInWithEthereumOptions extends UseSignInWithXOptions {
1510
+ }
1511
+ interface UseSignInWithEthereumReturn extends UseSignInWithXReturn {
1512
+ }
1513
+ declare function useSignInWithEthereum(): UseSignInWithEthereumReturn;
1514
+
1515
+ declare function useSignMessage(): {
1516
+ signMessage: (message: string) => Promise<string>;
1517
+ isSigning: boolean;
1518
+ error: Error | null;
1519
+ };
1520
+
1521
+ /**
1522
+ * useSimulateTransfer — React hook for simulating ERC-20 token transfers.
1523
+ *
1524
+ * Wraps SimulationManager.simulateERC20Transfer in a React hook with
1525
+ * reactive state for loading, result, and error.
1526
+ *
1527
+ * @example
1528
+ * ```tsx
1529
+ * import { useSimulateTransfer } from "@naculus/connect-appkit-react";
1530
+ *
1531
+ * function SendForm({ token, to, amount }) {
1532
+ * const { result, simulate, loading } = useSimulateTransfer({
1533
+ * rpcUrl: "https://eth.llamarpc.com",
1534
+ * });
1535
+ *
1536
+ * return (
1537
+ * <div>
1538
+ * <button onClick={() => simulate(token, to, amount)} disabled={loading}>
1539
+ * Simulate Transfer
1540
+ * </button>
1541
+ * {result && <p>Result: {result.status}</p>}
1542
+ * </div>
1543
+ * );
1544
+ * }
1545
+ * ```
1546
+ */
1547
+
1548
+ interface UseSimulateTransferOptions {
1549
+ /** RPC URL for eth_call simulation */
1550
+ rpcUrl?: string;
1551
+ /** Default chain ID */
1552
+ chainId?: number;
1553
+ }
1554
+ interface UseSimulateTransferReturn {
1555
+ /** Current simulation result */
1556
+ result: SimulationResult | null;
1557
+ /** Whether a simulation is in progress */
1558
+ loading: boolean;
1559
+ /** Last error (null if no error) */
1560
+ error: Error | null;
1561
+ /**
1562
+ * Simulate an ERC-20 transfer.
1563
+ *
1564
+ * @param tokenAddress - ERC-20 token contract address
1565
+ * @param from - Sender address
1566
+ * @param to - Recipient address
1567
+ * @param amount - Human-readable amount (e.g. "1.50")
1568
+ * @param options - Optional chainId, rpcUrl, decimals override
1569
+ */
1570
+ simulate: (tokenAddress: `0x${string}`, from: `0x${string}`, to: `0x${string}`, amount: string, options?: {
1571
+ chainId?: number;
1572
+ rpcUrl?: string;
1573
+ decimals?: number;
1574
+ }) => Promise<SimulationResult>;
1575
+ /** Reset result and error state */
1576
+ reset: () => void;
1577
+ }
1578
+ /**
1579
+ * Hook for simulating an ERC-20 token transfer.
1580
+ *
1581
+ * Creates a SimulationManager internally and provides a `simulate`
1582
+ * function that builds transfer calldata automatically.
1583
+ *
1584
+ * @param options - Configuration for the underlying SimulationManager
1585
+ */
1586
+ declare function useSimulateTransfer(options?: UseSimulateTransferOptions): UseSimulateTransferReturn;
1587
+
1588
+ interface UseSiwxAuthSessionOptions {
1589
+ /** Storage key prefix (default: "naculus_") */
1590
+ storagePrefix?: string;
1591
+ /** Auto-restore auth from storage on mount (default: true) */
1592
+ autoRestore?: boolean;
1593
+ }
1594
+ interface UseSiwxAuthSessionReturn {
1595
+ /** Whether a valid SIWx auth session exists */
1596
+ isSignedIn: boolean;
1597
+ /** Whether we're still checking persisted auth on mount */
1598
+ isRestoring: boolean;
1599
+ /** The persisted SIWx result, or null if not signed in */
1600
+ siwxResult: SiwxResult | null;
1601
+ /** Whether a sign-in is in progress */
1602
+ isSigningIn: boolean;
1603
+ /** Last sign-in error */
1604
+ error: Error | null;
1605
+ /** Sign in with optional overrides. Persists result to storage on success. */
1606
+ signIn: (options?: UseSignInWithXOptions) => Promise<SiwxResult>;
1607
+ /** Sign out: clears persisted auth and resets state */
1608
+ signOut: () => void;
1609
+ /** Clear the last error */
1610
+ clearError: () => void;
1611
+ }
1612
+ declare function useSiwxAuthSession(options?: UseSiwxAuthSessionOptions): UseSiwxAuthSessionReturn;
1613
+
1614
+ /**
1615
+ * useSmartAccount
1616
+ *
1617
+ * React hook for ERC-4337 Smart Account lifecycle management.
1618
+ * Provides create, deploy, and address lookup for smart contract wallets.
1619
+ *
1620
+ * @example
1621
+ * ```tsx
1622
+ * const { address, isDeployed, createWallet, deployWallet, isLoading } = useSmartAccount({
1623
+ * rpcUrl: "https://eth.llamarpc.com",
1624
+ * bundlerUrl: "https://api.pimlico.io/v2/1/rpc?apikey=...",
1625
+ * });
1626
+ * ```
1627
+ */
1628
+
1629
+ interface UseSmartAccountOptions {
1630
+ /** RPC URL for the target chain */
1631
+ rpcUrl?: string;
1632
+ /** Bundler RPC URL */
1633
+ bundlerUrl?: string;
1634
+ /** Chain ID (CAIP-2 format) */
1635
+ chainId?: string;
1636
+ /** ERC-4337 EntryPoint address for the selected supported chain */
1637
+ entryPoint?: Address$1;
1638
+ /** Account type (default: "simple") */
1639
+ accountType?: "simple" | "light" | "kernel" | "safe";
1640
+ /** Optional salt for deterministic address */
1641
+ salt?: bigint;
1642
+ }
1643
+ interface UseSmartAccountReturn {
1644
+ /** Smart account address (null if not created) */
1645
+ address: Address$1 | null;
1646
+ /** Whether the account is deployed on-chain */
1647
+ isDeployed: boolean;
1648
+ /** Smart account info object */
1649
+ accountInfo: SmartAccountInfo | null;
1650
+ /** Loading state */
1651
+ isLoading: boolean;
1652
+ /** Error state */
1653
+ error: Error | null;
1654
+ /** Create a new smart account (compute address) */
1655
+ createWallet: () => Promise<SmartAccountInfo | null>;
1656
+ /** Deploy the smart account to chain */
1657
+ deployWallet: () => Promise<Address$1 | null>;
1658
+ /** Get the counterfactual address without creating */
1659
+ getAddress: () => Promise<Address$1 | null>;
1660
+ }
1661
+ /**
1662
+ * Hook for managing a ERC-4337 Smart Contract Wallet lifecycle.
1663
+ *
1664
+ * @param options - Smart account configuration options
1665
+ * @returns Smart account state and actions
1666
+ */
1667
+ declare function useSmartAccount(options?: UseSmartAccountOptions): UseSmartAccountReturn;
1668
+
1669
+ interface UseSolanaAccountReturn {
1670
+ /** The bare base58 address, or null when no Solana account is connected. */
1671
+ address: string | null;
1672
+ /** The CAIP-10 form, which carries which cluster it is on. */
1673
+ caip10: string | null;
1674
+ /** The CAIP-2 cluster, e.g. `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`. */
1675
+ chainId: string | null;
1676
+ isConnected: boolean;
1677
+ }
1678
+ /**
1679
+ * The connected Solana account, whichever wallet supplied it.
1680
+ *
1681
+ * Read off the session's namespaces rather than from the embedded connector,
1682
+ * so an injected wallet (Phantom, Solflare) and the embedded wallet answer the
1683
+ * same way.
1684
+ *
1685
+ * Matched on the `solana:` namespace, never on address shape. A base58 string
1686
+ * is not distinguishable from other base58 strings by inspection, and guessing
1687
+ * would eventually call something a Solana address that is not one.
1688
+ */
1689
+ declare function useSolanaAccount(): UseSolanaAccountReturn;
1690
+
1691
+ interface UseSolanaBalanceOptions {
1692
+ /** Defaults to the connected Solana account. */
1693
+ address?: string;
1694
+ /** Defaults to the client's `solanaRpcUrl`. */
1695
+ rpcUrl?: string;
1696
+ /** Milliseconds between refreshes. Off by default. */
1697
+ refreshInterval?: number;
1698
+ }
1699
+ interface UseSolanaBalanceReturn {
1700
+ /** Null until a balance has actually been read. Never a fabricated zero. */
1701
+ balance: SolanaBalance | null;
1702
+ isFetching: boolean;
1703
+ error: Error | null;
1704
+ /** Absent when no RPC endpoint is configured — a different fact from a
1705
+ * balance of zero, and the only one a caller can act on. */
1706
+ isConfigured: boolean;
1707
+ refetch: () => Promise<void>;
1708
+ }
1709
+ /**
1710
+ * The SOL balance of the connected Solana account.
1711
+ *
1712
+ * `balance` stays null until a read succeeds. A zero placeholder while
1713
+ * loading, or after a failure, is a number a user reads as their balance.
1714
+ */
1715
+ declare function useSolanaBalance(options?: UseSolanaBalanceOptions): UseSolanaBalanceReturn;
1716
+
1717
+ interface UseSolanaTransactionReturn {
1718
+ /**
1719
+ * Sign a serialized transaction and return the signed bytes.
1720
+ *
1721
+ * Build and serialize it with `@solana/kit` or `@solana/web3.js` first —
1722
+ * the wallet's job is the signature, not the instructions. base64 or raw
1723
+ * bytes both work.
1724
+ */
1725
+ signTransaction: (transaction: Uint8Array | string) => Promise<Uint8Array>;
1726
+ /** Sign and submit, returning the base58 signature the cluster reports. */
1727
+ sendTransaction: (transaction: Uint8Array | string) => Promise<string>;
1728
+ /** Poll a signature. `"unknown"` is its own answer, not a failure. */
1729
+ getStatus: (signature: string) => Promise<{
1730
+ status: SolanaConfirmationStatus;
1731
+ error: string | null;
1732
+ }>;
1733
+ isSigning: boolean;
1734
+ isSending: boolean;
1735
+ error: Error | null;
1736
+ reset: () => void;
1737
+ }
1738
+ /**
1739
+ * Sign and send Solana transactions through whichever wallet is connected.
1740
+ *
1741
+ * The wallet is not asked to understand the transaction. It fills its own
1742
+ * signature slot and, for send, hands the bytes to a cluster.
1743
+ */
1744
+ declare function useSolanaTransaction(): UseSolanaTransactionReturn;
1745
+
1746
+ /**
1747
+ * useSwitchChain Hook
1748
+ *
1749
+ * Provides the switchChain method with loading/error state tracking.
1750
+ *
1751
+ * @see SRS-009 §7.2
1752
+ */
1753
+ interface UseSwitchChainReturn {
1754
+ /** Switch the active chain for the current session */
1755
+ switchChain: (chainId: string) => Promise<void>;
1756
+ /** Whether a chain switch is in progress */
1757
+ isSwitching: boolean;
1758
+ /** The currently active chain ID */
1759
+ currentChainId: string | null;
1760
+ /** The last error that occurred during chain switch (if any) */
1761
+ error: Error | null;
1762
+ /** Clear the error state */
1763
+ clearError: () => void;
1764
+ }
1765
+ declare function useSwitchChain(): UseSwitchChainReturn;
1766
+
1767
+ interface TokenInfo {
1768
+ /** ERC-20 token contract address */
1769
+ address: Address;
1770
+ /** Token symbol (e.g. "USDC", "LINK") */
1771
+ symbol: string;
1772
+ /** Token decimals (e.g. 6 for USDC, 18 for most) */
1773
+ decimals: number;
1774
+ /** Optional display name */
1775
+ name?: string;
1776
+ }
1777
+ interface UseTokenBalanceOptions {
1778
+ /** ERC-20 token(s) to query */
1779
+ tokens: TokenInfo[];
1780
+ /** Auto-refresh interval in milliseconds. Default: undefined (no auto-refresh). */
1781
+ refreshInterval?: number;
1782
+ }
1783
+ interface TokenBalanceResult {
1784
+ address: Address;
1785
+ symbol: string;
1786
+ decimals: number;
1787
+ name?: string;
1788
+ /** Raw balance as string (in smallest unit), or null if not loaded */
1789
+ balance: string | null;
1790
+ /** Human-readable formatted balance, or null if not loaded */
1791
+ formatted: string | null;
1792
+ }
1793
+ declare function useTokenBalance(options: UseTokenBalanceOptions): {
1794
+ /** Array of token balance results */
1795
+ tokenBalances: TokenBalanceResult[];
1796
+ isLoading: boolean;
1797
+ error: Error | null;
1798
+ /** Re-fetch all token balances */
1799
+ refetch: () => Promise<void>;
1800
+ /** Get a specific token balance by contract address */
1801
+ getTokenBalance: (tokenAddress: Address) => TokenBalanceResult | undefined;
1802
+ chain: _naculus_connect_appkit_core.WalletChain | null;
1803
+ };
1804
+
1805
+ interface UseTxHistoryResult {
1806
+ entries: TxStatusEntry[];
1807
+ isLoading: boolean;
1808
+ error: Error | null;
1809
+ refresh: () => Promise<void>;
1810
+ summary: {
1811
+ pending: number;
1812
+ confirmed: number;
1813
+ failed: number;
1814
+ };
1815
+ }
1816
+ /**
1817
+ * Query transaction history.
1818
+ * address defaults to current wallet address; chainId defaults to current chain.
1819
+ */
1820
+ declare function useTxHistory(address?: string, chainId?: number, monitor?: TxMonitorLike): UseTxHistoryResult;
1821
+
1822
+ /**
1823
+ * useUserOpStatus
1824
+ *
1825
+ * React hook for tracking ERC-4337 UserOperation lifecycle.
1826
+ * Polls the bundler for UserOperation receipt and reports status transitions.
1827
+ *
1828
+ * @example
1829
+ * ```tsx
1830
+ * const { userOpHash, status, receipt, error } = useUserOpStatus({
1831
+ * userOpHash: "0x...",
1832
+ * bundlerUrl: "https://api.pimlico.io/v2/1/rpc?apikey=...",
1833
+ * pollInterval: 2000,
1834
+ * });
1835
+ *
1836
+ * if (status === "confirmed") {
1837
+ * console.log("UserOp included in block!");
1838
+ * }
1839
+ * ```
1840
+ */
1841
+
1842
+ type UserOpStatus = "idle" | "pending" | "confirmed" | "failed" | "not_found";
1843
+ interface UseUserOpStatusOptions {
1844
+ /** The UserOperation hash to track */
1845
+ userOpHash?: Hex | null;
1846
+ /** Bundler RPC URL */
1847
+ bundlerUrl?: string;
1848
+ /** Polling interval in milliseconds (default: 2000) */
1849
+ pollInterval?: number;
1850
+ /** Maximum number of retries (default: 30) */
1851
+ maxRetries?: number;
1852
+ /** Auto-start polling when userOpHash is provided */
1853
+ autoStart?: boolean;
1854
+ }
1855
+ interface UseUserOpStatusReturn {
1856
+ /** Current status of the UserOperation */
1857
+ status: UserOpStatus;
1858
+ /** UserOperation receipt (available when confirmed or failed) */
1859
+ receipt: UserOperationReceipt | null;
1860
+ /** The userOpHash being tracked */
1861
+ userOpHash: Hex | null;
1862
+ /** Error state */
1863
+ error: Error | null;
1864
+ /** Whether polling is active */
1865
+ isPolling: boolean;
1866
+ /** Time elapsed since tracking started (ms) */
1867
+ elapsedMs: number;
1868
+ /** Number of poll attempts made */
1869
+ attempts: number;
1870
+ /** Start tracking a UserOperation */
1871
+ start: (hash: Hex) => void;
1872
+ /** Stop tracking */
1873
+ stop: () => void;
1874
+ /** Reset state */
1875
+ reset: () => void;
1876
+ }
1877
+ /**
1878
+ * Hook for tracking the lifecycle of an ERC-4337 UserOperation.
1879
+ *
1880
+ * @param options - Configuration for polling behavior
1881
+ * @returns UserOperation status, receipt, and lifecycle controls
1882
+ */
1883
+ declare function useUserOpStatus(options?: UseUserOpStatusOptions): UseUserOpStatusReturn;
1884
+
1885
+ /**
1886
+ * useValidateDestination — address blackhole prevention hook.
1887
+ *
1888
+ * Validates that a destination address is not a known burn/zero address
1889
+ * before sending a transaction. Returns { isValid, warning, level }.
1890
+ *
1891
+ * Level: "ok" | "warning" | "blocked"
1892
+ */
1893
+ /**
1894
+ * What the four syntactic checks below found.
1895
+ *
1896
+ * `"ok"` was `"safe"`, which this function is in no position to say. It checks
1897
+ * that an address is non-empty, well-formed, and not the zero or a burn
1898
+ * address — nothing about whether the recipient is who the user thinks. It
1899
+ * cannot see an address-poisoning lookalike, a contract that will not release
1900
+ * the funds, or a known-malicious destination. Labelling that "safe" put a
1901
+ * green tick beside a scammer's address.
1902
+ */
1903
+ type AddressValidationLevel = "ok" | "warning" | "blocked";
1904
+ interface AddressValidationResult {
1905
+ isValid: boolean;
1906
+ level: AddressValidationLevel;
1907
+ warning: string | null;
1908
+ }
1909
+ declare function validateDestination(address: string): AddressValidationResult;
1910
+ interface UseValidateDestinationOptions {
1911
+ address: string;
1912
+ }
1913
+ interface UseValidateDestinationReturn {
1914
+ validation: AddressValidationResult;
1915
+ }
1916
+ declare function useValidateDestination({ address }: UseValidateDestinationOptions): UseValidateDestinationReturn;
1917
+
1918
+ declare function useViemClient(): {
1919
+ publicClient: PublicClient | null;
1920
+ walletClient: WalletClient | null;
1921
+ chains: WalletChain[];
1922
+ };
1923
+
1924
+ declare function useWallet(): {
1925
+ status: _naculus_connect_appkit_core.ConnectionStatus;
1926
+ session: _naculus_connect_core.UniversalWalletSession | null;
1927
+ accounts: string[];
1928
+ chainId: string | null;
1929
+ error: Error | null;
1930
+ isConnected: boolean;
1931
+ isConnecting: boolean;
1932
+ isReconnecting: boolean;
1933
+ isDisconnected: boolean;
1934
+ currentAccount: string;
1935
+ connect: () => Promise<void>;
1936
+ disconnect: () => Promise<void>;
1937
+ reconnect: () => Promise<void>;
1938
+ switchChain: (chainId: string) => Promise<void>;
1939
+ };
1940
+
1941
+ interface UserFriendlyError {
1942
+ title: string;
1943
+ description: string;
1944
+ code?: string;
1945
+ }
1946
+ interface UseWeb3ErrorHandlerReturn {
1947
+ /** Current error from the provider */
1948
+ error: Error | null;
1949
+ /** User-friendly representation of the current error */
1950
+ friendlyError: UserFriendlyError | null;
1951
+ /** Clear the current error */
1952
+ clearError: () => void;
1953
+ /** Check if current error is retryable */
1954
+ isRetryable: boolean;
1955
+ /** Get a user-friendly version of any error */
1956
+ formatError: (error: unknown) => UserFriendlyError;
1957
+ /** Wraps an async function with error formatting */
1958
+ wrapAsync: <T>(fn: () => Promise<T>) => () => Promise<T>;
1959
+ }
1960
+ /**
1961
+ * Hook that provides user-friendly error handling for web3 operations.
1962
+ *
1963
+ * Features:
1964
+ * - Maps WalletError codes to human-readable messages
1965
+ * - Provides retry detection for transient errors
1966
+ * - Wraps async operations with consistent error formatting
1967
+ * - Exposes the current error state from Web3ConnectProvider
1968
+ *
1969
+ * @example
1970
+ * ```tsx
1971
+ * const { friendlyError, clearError, isRetryable, wrapAsync } = useWeb3ErrorHandler();
1972
+ *
1973
+ * // Show error in UI
1974
+ * if (friendlyError) {
1975
+ * return <ErrorDisplay title={friendlyError.title} message={friendlyError.description} />;
1976
+ * }
1977
+ *
1978
+ * // Wrap an operation
1979
+ * const safeConnect = wrapAsync(() => connect());
1980
+ * await safeConnect();
1981
+ * ```
1982
+ */
1983
+ declare function useWeb3ErrorHandler(): UseWeb3ErrorHandlerReturn;
1984
+
1985
+ interface Web3ContextValue extends Web3State, Web3Actions {
1986
+ isConnected: boolean;
1987
+ chains: WalletChain[];
1988
+ /** Client owned by this provider instance. */
1989
+ client: Web3Client;
1990
+ /** SessionManager instance for multi-chain session management */
1991
+ sessionManager: SessionManager | null;
1992
+ }
1993
+ declare const Web3Context: React__default.Context<Web3ContextValue | null>;
1994
+ interface Web3ConnectProviderProps {
1995
+ children: React__default.ReactNode;
1996
+ config: Web3ConnectConfig;
1997
+ autoConnect?: boolean;
1998
+ }
1999
+ declare function Web3ConnectProvider({ children, config, autoConnect, }: Web3ConnectProviderProps): React__default.JSX.Element;
2000
+ declare function useWeb3(): Web3ContextValue;
2001
+
2002
+ /**
2003
+ * useTokenList — React hook for loading token lists.
2004
+ *
2005
+ * Manages TokenListManager lifecycle and provides reactive
2006
+ * token data scoped to a specific chain.
2007
+ */
2008
+
2009
+ interface UseTokenListOptions {
2010
+ /** Auto-load on mount (default: true) */
2011
+ autoLoad?: boolean;
2012
+ /** Custom sources (overrides defaults) */
2013
+ sources?: TokenListSource[];
2014
+ }
2015
+ interface UseTokenListReturn {
2016
+ /** Loaded tokens for the specified chain */
2017
+ tokens: TokenListEntry[];
2018
+ /** Whether the initial load is in progress */
2019
+ isLoading: boolean;
2020
+ /** Whether tokens have been loaded at least once */
2021
+ isLoaded: boolean;
2022
+ /** Last error, if any */
2023
+ error: Error | null;
2024
+ /** Force a full refresh from all sources */
2025
+ refetch: () => Promise<void>;
2026
+ }
2027
+ /**
2028
+ * React hook for accessing token lists for a specific chain.
2029
+ *
2030
+ * @example
2031
+ * const { tokens, isLoading } = useTokenList("eip155:1");
2032
+ * // tokens → [WETH, USDC, USDT, DAI, ...]
2033
+ */
2034
+ declare function useTokenList(chainId?: string, options?: UseTokenListOptions): UseTokenListReturn;
2035
+
2036
+ /**
2037
+ * useTokenSearch — React hook for searching tokens.
2038
+ *
2039
+ * Debounced search over loaded token lists.
2040
+ * Returns structured results (exact + fuzzy matches).
2041
+ */
2042
+
2043
+ interface UseTokenSearchReturn {
2044
+ /** Structured search results */
2045
+ results: TokenSearchResult;
2046
+ /** Whether a search is currently running */
2047
+ isSearching: boolean;
2048
+ }
2049
+ /**
2050
+ * React hook for searching tokens by symbol, name, or address.
2051
+ *
2052
+ * Debounced 300ms to avoid excessive re-renders during typing.
2053
+ *
2054
+ * @example
2055
+ * const { results, isSearching } = useTokenSearch("USDC");
2056
+ * // results.exact → [USDC on ETH]
2057
+ * // results.fuzzy → [USDC.e on AVAX]
2058
+ */
2059
+ declare function useTokenSearch(query: string, chainId?: string): UseTokenSearchReturn;
2060
+
2061
+ /**
2062
+ * TokenSelector — chain-aware, searchable token selection component.
2063
+ *
2064
+ * Features:
2065
+ * - Loads token list for the given chain
2066
+ * - Search by symbol, name, or address
2067
+ * - Displays token logo, symbol, name, and decimals
2068
+ * - Calls onSelect when a token is chosen
2069
+ */
2070
+
2071
+ interface TokenSelectorProps {
2072
+ /** Chain ID in CAIP-2 format (e.g. "eip155:1") */
2073
+ chainId: string;
2074
+ /** Called when a token is selected */
2075
+ onSelect: (token: TokenListEntry) => void;
2076
+ /** Called to close/dismiss the selector */
2077
+ onClose: () => void;
2078
+ /** Optional configuration */
2079
+ options?: {
2080
+ /** Show popular/recommended tokens (default: true) */
2081
+ showRecommendations?: boolean;
2082
+ /** Custom filter for tokens */
2083
+ filter?: (token: TokenListEntry) => boolean;
2084
+ };
2085
+ }
2086
+ /**
2087
+ * TokenSelector — a dropdown/modal component for selecting tokens.
2088
+ *
2089
+ * @example
2090
+ * <TokenSelector
2091
+ * chainId="eip155:1"
2092
+ * onSelect={(token) => setSelectedToken(token)}
2093
+ * onClose={() => setOpen(false)}
2094
+ * />
2095
+ */
2096
+ declare function TokenSelector({ chainId, onSelect, onClose, options, }: TokenSelectorProps): React__default.JSX.Element;
2097
+
2098
+ declare const DEFAULT_EVM_CHAINS: WalletChain[];
2099
+ /**
2100
+ * The configured chain for a CAIP-2 id.
2101
+ *
2102
+ * Delegates rather than parsing again. The version this replaces did
2103
+ * `parseInt(chainId.split(":")[1])`, which answers 5 for
2104
+ * `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`.
2105
+ */
2106
+ declare function getChainById(chains: WalletChain[], chainId: string): WalletChain | undefined;
2107
+ declare function getDefaultChains(): WalletChain[];
2108
+
2109
+ /**
2110
+ * User-friendly error messages for WalletError codes and common errors.
2111
+ * Maps internal error codes to human-readable messages that can be shown in toasts/UI.
2112
+ */
2113
+ /**
2114
+ * User-friendly title for each WalletError code.
2115
+ */
2116
+ declare const WALLET_ERROR_TITLES: Record<string, string>;
2117
+ /**
2118
+ * User-friendly description for each WalletError code.
2119
+ */
2120
+ declare const WALLET_ERROR_DESCRIPTIONS: Record<string, string>;
2121
+ /**
2122
+ * Get a user-friendly error message object from any error.
2123
+ */
2124
+ declare function getUserFriendlyError(error: unknown): {
2125
+ title: string;
2126
+ description: string;
2127
+ code?: string;
2128
+ };
2129
+ /**
2130
+ * Check if an error is retryable (transient).
2131
+ */
2132
+ declare function isRetryableError(error: unknown): boolean;
2133
+
2134
+ /**
2135
+ * i18n — ponytail approach: static key-value map, no framework dependency.
2136
+ *
2137
+ * All UI strings go through here. No hardcoded text in components.
2138
+ * To add a language: copy this file and translate the values.
2139
+ */
2140
+ type Locale = "en" | "zh";
2141
+ declare const en: {
2142
+ readonly "storage.critical.title": "Insecure Storage Detected";
2143
+ readonly "storage.critical.body": "Your browser does not support IndexedDB. Wallet data is stored in plaintext in localStorage and could be exposed to XSS attacks. We strongly recommend switching to a modern browser.";
2144
+ readonly "storage.warning.title": "Storage Security Warning";
2145
+ readonly "storage.warning.body": "Your browser does not support IndexedDB, but your wallet data is encrypted with AES-256-GCM. Consider switching browsers for better origin isolation.";
2146
+ readonly "address.empty": "Address is empty";
2147
+ readonly "address.invalid_format": "Invalid address format (expected 0x + 40 hex chars)";
2148
+ readonly "address.zero_address": "Address is the zero address — funds would be permanently lost";
2149
+ readonly "address.burn_address": "Address appears to be a burn address — funds would be permanently lost";
2150
+ readonly "wallet.connect": "Connect Wallet";
2151
+ readonly "wallet.disconnect": "Disconnect";
2152
+ readonly "wallet.connecting": "Connecting...";
2153
+ readonly "wallet.copy_address": "Copy address";
2154
+ readonly "wallet.copied": "Copied!";
2155
+ readonly "wallet.view_on_explorer": "View on Explorer";
2156
+ readonly "wallet.retry": "Retry";
2157
+ readonly "wallet.connection_failed": "Connection failed";
2158
+ readonly "wallet.scan_qr": "Scan with your wallet app";
2159
+ readonly "embedded.generate": "Create Wallet";
2160
+ readonly "embedded.import": "Import Wallet";
2161
+ readonly "embedded.backup_seed": "Back up your seed phrase";
2162
+ readonly "embedded.backup_warning": "Anyone with your seed phrase can access your funds. Store it securely.";
2163
+ readonly "embedded.backup_done": "I've saved my seed phrase";
2164
+ readonly "embedded.wipe": "Remove Wallet";
2165
+ readonly "embedded.wipe_confirm": "Are you sure? This cannot be undone.";
2166
+ };
2167
+ declare function setLocale(locale: Locale): void;
2168
+ declare function getLocale(): Locale;
2169
+ declare function t(key: keyof typeof en): string;
2170
+
2171
+ /**
2172
+ * This file was automatically generated by the Stencil React Output Target.
2173
+ * Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
2174
+ */
2175
+
2176
+ type AppkitAccordionEvents = {
2177
+ onAppkitToggle: EventName<AppkitAccordionCustomEvent<boolean>>;
2178
+ };
2179
+ declare const AppkitAccordion: StencilReactComponent<AppkitAccordion$1, AppkitAccordionEvents, Components.AppkitAccordion>;
2180
+ type AppkitAccountButtonEvents = NonNullable<unknown>;
2181
+ declare const AppkitAccountButton: StencilReactComponent<AppkitAccountButton$1, AppkitAccountButtonEvents, Components.AppkitAccountButton>;
2182
+ type AppkitAlertDialogEvents = {
2183
+ onAppkitClose: EventName<AppkitAlertDialogCustomEvent<void>>;
2184
+ onAppkitOpenChange: EventName<AppkitAlertDialogCustomEvent<boolean>>;
2185
+ };
2186
+ declare const AppkitAlertDialog: StencilReactComponent<AppkitAlertDialog$1, AppkitAlertDialogEvents, Components.AppkitAlertDialog>;
2187
+ type AppkitAvatarEvents = NonNullable<unknown>;
2188
+ declare const AppkitAvatar: StencilReactComponent<AppkitAvatar$1, AppkitAvatarEvents, Components.AppkitAvatar>;
2189
+ type AppkitBadgeEvents = NonNullable<unknown>;
2190
+ declare const AppkitBadge: StencilReactComponent<AppkitBadge$1, AppkitBadgeEvents, Components.AppkitBadge>;
2191
+ type AppkitButtonEvents = NonNullable<unknown>;
2192
+ declare const AppkitButton: StencilReactComponent<AppkitButton$1, AppkitButtonEvents, Components.AppkitButton>;
2193
+ type AppkitCardEvents = NonNullable<unknown>;
2194
+ declare const AppkitCard: StencilReactComponent<AppkitCard$1, AppkitCardEvents, Components.AppkitCard>;
2195
+ type AppkitCardContentEvents = NonNullable<unknown>;
2196
+ declare const AppkitCardContent: StencilReactComponent<AppkitCardContent$1, AppkitCardContentEvents, Components.AppkitCardContent>;
2197
+ type AppkitCardDescriptionEvents = NonNullable<unknown>;
2198
+ declare const AppkitCardDescription: StencilReactComponent<AppkitCardDescription$1, AppkitCardDescriptionEvents, Components.AppkitCardDescription>;
2199
+ type AppkitCardFooterEvents = NonNullable<unknown>;
2200
+ declare const AppkitCardFooter: StencilReactComponent<AppkitCardFooter$1, AppkitCardFooterEvents, Components.AppkitCardFooter>;
2201
+ type AppkitCardHeaderEvents = NonNullable<unknown>;
2202
+ declare const AppkitCardHeader: StencilReactComponent<AppkitCardHeader$1, AppkitCardHeaderEvents, Components.AppkitCardHeader>;
2203
+ type AppkitCardTitleEvents = NonNullable<unknown>;
2204
+ declare const AppkitCardTitle: StencilReactComponent<AppkitCardTitle$1, AppkitCardTitleEvents, Components.AppkitCardTitle>;
2205
+ type AppkitCheckboxEvents = {
2206
+ onAppkitChange: EventName<AppkitCheckboxCustomEvent<boolean>>;
2207
+ };
2208
+ declare const AppkitCheckbox: StencilReactComponent<AppkitCheckbox$1, AppkitCheckboxEvents, Components.AppkitCheckbox>;
2209
+ type AppkitCollapsibleEvents = {
2210
+ onAppkitToggle: EventName<AppkitCollapsibleCustomEvent<boolean>>;
2211
+ };
2212
+ declare const AppkitCollapsible: StencilReactComponent<AppkitCollapsible$1, AppkitCollapsibleEvents, Components.AppkitCollapsible>;
2213
+ type AppkitConnectButtonEvents = {
2214
+ onAppkitConnect: EventName<AppkitConnectButtonCustomEvent<{
2215
+ kind: string;
2216
+ walletId?: string;
2217
+ }>>;
2218
+ onAppkitDisconnect: EventName<AppkitConnectButtonCustomEvent<void>>;
2219
+ onAppkitStartPairing: EventName<AppkitConnectButtonCustomEvent<void>>;
2220
+ onAppkitRetry: EventName<AppkitConnectButtonCustomEvent<void>>;
2221
+ onAppkitCancelPairing: EventName<AppkitConnectButtonCustomEvent<void>>;
2222
+ onAppkitMobileDeepLink: EventName<AppkitConnectButtonCustomEvent<void>>;
2223
+ onAppkitCopyAddress: EventName<AppkitConnectButtonCustomEvent<string>>;
2224
+ };
2225
+ declare const AppkitConnectButton: StencilReactComponent<AppkitConnectButton$1, AppkitConnectButtonEvents, Components.AppkitConnectButton>;
2226
+ type AppkitDialogEvents = {
2227
+ onAppkitClose: EventName<AppkitDialogCustomEvent<void>>;
2228
+ onAppkitOpenChange: EventName<AppkitDialogCustomEvent<boolean>>;
2229
+ };
2230
+ declare const AppkitDialog: StencilReactComponent<AppkitDialog$1, AppkitDialogEvents, Components.AppkitDialog>;
2231
+ type AppkitDropdownMenuEvents = {
2232
+ onAppkitSelect: EventName<AppkitDropdownMenuCustomEvent<string>>;
2233
+ };
2234
+ declare const AppkitDropdownMenu: StencilReactComponent<AppkitDropdownMenu$1, AppkitDropdownMenuEvents, Components.AppkitDropdownMenu>;
2235
+ type AppkitInputEvents = {
2236
+ onAppkitChange: EventName<AppkitInputCustomEvent<string>>;
2237
+ };
2238
+ declare const AppkitInput: StencilReactComponent<AppkitInput$1, AppkitInputEvents, Components.AppkitInput>;
2239
+ type AppkitPopoverEvents = {
2240
+ onAppkitOpenChange: EventName<AppkitPopoverCustomEvent<boolean>>;
2241
+ };
2242
+ declare const AppkitPopover: StencilReactComponent<AppkitPopover$1, AppkitPopoverEvents, Components.AppkitPopover>;
2243
+ type AppkitProgressEvents = NonNullable<unknown>;
2244
+ declare const AppkitProgress: StencilReactComponent<AppkitProgress$1, AppkitProgressEvents, Components.AppkitProgress>;
2245
+ type AppkitScrollAreaEvents = NonNullable<unknown>;
2246
+ declare const AppkitScrollArea: StencilReactComponent<AppkitScrollArea$1, AppkitScrollAreaEvents, Components.AppkitScrollArea>;
2247
+ type AppkitSelectEvents = {
2248
+ onAppkitChange: EventName<AppkitSelectCustomEvent<string>>;
2249
+ };
2250
+ declare const AppkitSelect: StencilReactComponent<AppkitSelect$1, AppkitSelectEvents, Components.AppkitSelect>;
2251
+ type AppkitSeparatorEvents = NonNullable<unknown>;
2252
+ declare const AppkitSeparator: StencilReactComponent<AppkitSeparator$1, AppkitSeparatorEvents, Components.AppkitSeparator>;
2253
+ type AppkitSkeletonEvents = NonNullable<unknown>;
2254
+ declare const AppkitSkeleton: StencilReactComponent<AppkitSkeleton$1, AppkitSkeletonEvents, Components.AppkitSkeleton>;
2255
+ type AppkitSwitchEvents = {
2256
+ onAppkitChange: EventName<AppkitSwitchCustomEvent<boolean>>;
2257
+ };
2258
+ declare const AppkitSwitch: StencilReactComponent<AppkitSwitch$1, AppkitSwitchEvents, Components.AppkitSwitch>;
2259
+ type AppkitTabsEvents = {
2260
+ onAppkitTabChange: EventName<AppkitTabsCustomEvent<string>>;
2261
+ };
2262
+ declare const AppkitTabs: StencilReactComponent<AppkitTabs$1, AppkitTabsEvents, Components.AppkitTabs>;
2263
+ type AppkitToggleGroupEvents = {
2264
+ onAppkitChange: EventName<AppkitToggleGroupCustomEvent<string[]>>;
2265
+ };
2266
+ declare const AppkitToggleGroup: StencilReactComponent<AppkitToggleGroup$1, AppkitToggleGroupEvents, Components.AppkitToggleGroup>;
2267
+ type AppkitTooltipEvents = NonNullable<unknown>;
2268
+ declare const AppkitTooltip: StencilReactComponent<AppkitTooltip$1, AppkitTooltipEvents, Components.AppkitTooltip>;
2269
+
2270
+ export { type AddressValidationLevel, type AddressValidationResult, AppkitAccordion, type AppkitAccordionEvents, AppkitAccountButton, type AppkitAccountButtonEvents, AppkitAlertDialog, type AppkitAlertDialogEvents, AppkitAvatar, type AppkitAvatarEvents, AppkitBadge, type AppkitBadgeEvents, AppkitButton, type AppkitButtonEvents, AppkitCard, AppkitCardContent, type AppkitCardContentEvents, AppkitCardDescription, type AppkitCardDescriptionEvents, type AppkitCardEvents, AppkitCardFooter, type AppkitCardFooterEvents, AppkitCardHeader, type AppkitCardHeaderEvents, AppkitCardTitle, type AppkitCardTitleEvents, AppkitCheckbox, type AppkitCheckboxEvents, AppkitCollapsible, type AppkitCollapsibleEvents, AppkitConnectButton, type AppkitConnectButtonEvents, AppkitDialog, type AppkitDialogEvents, AppkitDropdownMenu, type AppkitDropdownMenuEvents, AppkitInput, type AppkitInputEvents, AppkitPopover, type AppkitPopoverEvents, AppkitProgress, type AppkitProgressEvents, AppkitScrollArea, type AppkitScrollAreaEvents, AppkitSelect, type AppkitSelectEvents, AppkitSeparator, type AppkitSeparatorEvents, AppkitSkeleton, type AppkitSkeletonEvents, AppkitSwitch, type AppkitSwitchEvents, AppkitTabs, type AppkitTabsEvents, AppkitToggleGroup, type AppkitToggleGroupEvents, AppkitTooltip, type AppkitTooltipEvents, type AtomicSupport, type ChainCapabilities, type CostComparison, type CostComparisonOperation, type CostComparisonOptions, DEFAULT_EVM_CHAINS, type DelegationPolicyPreview, type EmbeddedWalletAccountView, type EmbeddedWalletView, type EvmTransaction, type ExecuteError, type ExecuteOptions, type ExecuteRouteResult, type ExecutionPreview, type ExecutionRoute, type Locale, type PolicyExecutionAdapter, type PolicyExecutionCheck, type PolicyExecutionRoute, type PolicyExecutionSubmission, type PreparedPolicyExecution, type Quote, type QuoteOptions, type SIWxConfig, type SendCallsStatus, type TokenBalanceResult, type TokenInfo, TokenSelector, type TokenSelectorProps, TxMonitorContext, type TxMonitorLike, type TxStatus, type TxStatusEntry, type UseCapabilitiesReturn, type UseCompareCostsInput, type UseCompareCostsReturn, type UseCreateSessionKeyReturn, type UseDelegationPolicyOptions, type UseDelegationPolicyReturn, type UseDelegationReturn, type UseERC20AllowanceOptions, type UseERC20AllowanceReturn, type UseERC20ApproveOptions, type UseERC20ApproveReturn, type UseERC20TransferOptions, type UseERC20TransferReturn, type UseERC20TransferSimulationOptions, type UseERC20TransferSimulationReturn, type UseEmbeddedWalletReturn, type UseExecuteCallsOptions, type UseExecuteCallsReturn, type UseExecuteRouteReturn, type UseLastTxResult, type UseLookupAddressOptions, type UseLookupAddressResult, type UsePassphraseGateReturn, type UseResolveNameOptions, type UseResolveNameResult, type UseRevokeSessionReturn, type UseRouteQuoteInput, type UseRouteQuoteReturn, type UseSIWxLoginOptions, type UseSIWxLoginReturn, type UseSIWxSessionOptions, type UseSIWxSessionReturn, type UseSendUserOperationOptions, type UseSendUserOperationReturn, type UseSendWithSessionReturn, type UseSessionKeysReturn, type UseSessionReturn, type UseSignInWithEthereumOptions, type UseSignInWithEthereumReturn, type UseSignInWithXOptions, type UseSignInWithXReturn, type UseSimulateTransferOptions, type UseSimulateTransferReturn, type UseSiwxAuthSessionOptions, type UseSiwxAuthSessionReturn, type UseSmartAccountOptions, type UseSmartAccountReturn, type UseSolanaAccountReturn, type UseSolanaBalanceOptions, type UseSolanaBalanceReturn, type UseSolanaTransactionReturn, type UseSwitchChainReturn, type UseTokenBalanceOptions, type UseTokenListOptions, type UseTokenListReturn, type UseTokenSearchReturn, type UseTransactionSimulationReturn, type UseTxHistoryResult, type UseTxMonitorResult, type UseUserOpStatusOptions, type UseUserOpStatusReturn, type UseValidateDestinationOptions, type UseValidateDestinationReturn, type UseWalletReturn, type UseWeb3ErrorHandlerReturn, type UserFriendlyError, type UserOpStatus, WALLET_ERROR_DESCRIPTIONS, WALLET_ERROR_TITLES, type Web3Actions, Web3Client, type Web3ConnectConfig, Web3ConnectProvider, type Web3ConnectProviderProps, Web3Context, buildDelegationPolicyMessage, getChainById, getDefaultChains, getLocale, getUserFriendlyError, isRetryableError, resetSessionKeyManager, setLocale, t, useAccount, useBalance, useCapabilities, useChain, useCompareCosts, useConnect, useCreateSessionKey, useDelegation, useDelegationPolicy, useDisconnect, useERC20Allowance, useERC20Approve, useERC20Transfer, useERC20TransferSimulation, useEmbeddedWallet, useExecuteCalls, useExecuteRoute, useLastTx, useLookupAddress, useNotification, usePassphraseGate, useResolveName, useRevokeSession, useRouteQuote, useSIWxLogin, useSIWxSession, useSendCalls, useSendTransaction, useSendUserOperation, useSendWithSession, useSession, useSessionKeys, useSignInWithEthereum, useSignInWithX, useSignMessage, useSimulateTransfer, useSiwxAuthSession, useSmartAccount, useSolanaAccount, useSolanaBalance, useSolanaTransaction, useSwitchChain, useTokenBalance, useTokenList, useTokenSearch, useTransactionSimulation, useTxHistory, useTxMonitor, useUserOpStatus, useValidateDestination, useViemClient, useWallet, useWeb3, useWeb3ErrorHandler, validateDestination };