@rhinestone/deposit-modal 0.8.1 → 0.9.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 (65) hide show
  1. package/README.md +193 -29
  2. package/dist/{chunk-2JPB3PLB.mjs → DepositModalReown-6KUAO5ZC.mjs} +56 -4
  3. package/dist/{chunk-Q3W53BKR.cjs → DepositModalReown-XC5RIU7Z.cjs} +62 -10
  4. package/dist/{caip-C_ZYFIGa.d.cts → caip-523Zrc3r.d.cts} +1 -3
  5. package/dist/{caip-C_ZYFIGa.d.ts → caip-523Zrc3r.d.ts} +1 -3
  6. package/dist/{chunk-D3Y7ZBED.cjs → chunk-22RV33LK.cjs} +2170 -1460
  7. package/dist/chunk-4WB2FHGC.mjs +865 -0
  8. package/dist/chunk-A223BLVC.mjs +801 -0
  9. package/dist/{chunk-HQWZCOMS.cjs → chunk-DIX7M3SP.cjs} +232 -601
  10. package/dist/{chunk-T43VUEJH.mjs → chunk-E4G5BOZP.mjs} +167 -536
  11. package/dist/chunk-H577RJN5.cjs +801 -0
  12. package/dist/{chunk-DABKCJVL.mjs → chunk-ILT2PITN.mjs} +60 -3
  13. package/dist/{chunk-7KHEIMWD.mjs → chunk-KKHLNFSA.mjs} +2436 -1726
  14. package/dist/chunk-LGVJWVSS.mjs +81 -0
  15. package/dist/chunk-NEXUCY4B.cjs +11 -0
  16. package/dist/chunk-NMIMRASD.cjs +1785 -0
  17. package/dist/chunk-OSI2CFGL.mjs +11 -0
  18. package/dist/chunk-PAGMU4RQ.cjs +865 -0
  19. package/dist/chunk-T7LGQFP3.cjs +81 -0
  20. package/dist/chunk-VN4BLZYC.cjs +2273 -0
  21. package/dist/chunk-VOGZAZB2.mjs +2273 -0
  22. package/dist/chunk-WYXBY2MQ.mjs +1785 -0
  23. package/dist/{chunk-4NN7UTWQ.cjs → chunk-YEBXUUH3.cjs} +63 -6
  24. package/dist/claim.cjs +10 -0
  25. package/dist/claim.d.cts +8 -0
  26. package/dist/claim.d.ts +8 -0
  27. package/dist/claim.mjs +10 -0
  28. package/dist/constants.cjs +3 -3
  29. package/dist/constants.d.cts +4 -2
  30. package/dist/constants.d.ts +4 -2
  31. package/dist/constants.mjs +5 -5
  32. package/dist/deposit.cjs +8 -6
  33. package/dist/deposit.d.cts +2 -2
  34. package/dist/deposit.d.ts +2 -2
  35. package/dist/deposit.mjs +7 -5
  36. package/dist/index.cjs +22 -12
  37. package/dist/index.d.cts +15 -2
  38. package/dist/index.d.ts +15 -2
  39. package/dist/index.mjs +21 -11
  40. package/dist/polymarket.cjs +5 -6
  41. package/dist/polymarket.mjs +2 -3
  42. package/dist/server.cjs +96 -0
  43. package/dist/server.d.cts +65 -0
  44. package/dist/server.d.ts +65 -0
  45. package/dist/server.mjs +96 -0
  46. package/dist/styles.css +263 -12
  47. package/dist/types-C0SGf-21.d.cts +606 -0
  48. package/dist/types-C0SGf-21.d.ts +606 -0
  49. package/dist/withdraw.cjs +6 -5
  50. package/dist/withdraw.d.cts +3 -6
  51. package/dist/withdraw.d.ts +3 -6
  52. package/dist/withdraw.mjs +5 -4
  53. package/package.json +53 -6
  54. package/dist/DepositModalReown-4BSHOQ5Y.mjs +0 -63
  55. package/dist/DepositModalReown-UND3DEJH.cjs +0 -63
  56. package/dist/WithdrawModalReown-FVXSSGY5.mjs +0 -46
  57. package/dist/WithdrawModalReown-TVZWJKQI.cjs +0 -46
  58. package/dist/chunk-7OKA6GNA.cjs +0 -4537
  59. package/dist/chunk-NASHLEVQ.mjs +0 -4537
  60. package/dist/chunk-O5OKA27M.mjs +0 -800
  61. package/dist/chunk-U7SVYWVD.cjs +0 -800
  62. package/dist/chunk-WK5AFRSP.mjs +0 -295
  63. package/dist/chunk-XRWQMIBY.cjs +0 -295
  64. package/dist/types--LQWg_4W.d.cts +0 -468
  65. package/dist/types--LQWg_4W.d.ts +0 -468
@@ -0,0 +1,606 @@
1
+ import { TypedDataDefinition, Address, Hex, WalletClient, PublicClient, Chain } from 'viem';
2
+
3
+ /**
4
+ * Public config shape exposed on DepositModalProps. Each provider defaults to
5
+ * off — clients must explicitly opt in.
6
+ *
7
+ * A key controls VISIBILITY only. A provider that is enabled but has no
8
+ * implementation yet renders as a disabled "Coming soon" row; one that is not
9
+ * enabled is not shown at all.
10
+ */
11
+ interface AssetMigrationsConfig {
12
+ polymarket?: boolean;
13
+ hyperliquid?: boolean;
14
+ aave?: boolean;
15
+ morpho?: boolean;
16
+ }
17
+
18
+ declare const RECOVER_TYPES: {
19
+ readonly RecoverDeposit: readonly [{
20
+ readonly name: "depositId";
21
+ readonly type: "uint256";
22
+ }, {
23
+ readonly name: "destination";
24
+ readonly type: "address";
25
+ }];
26
+ };
27
+ /** What `signRecovery` is handed. */
28
+ interface SignRecoveryPayload {
29
+ /**
30
+ * Sign this exactly. Pass it to `signTypedData` on the wallet that owns
31
+ * `signer` — or to your account SDK, if `signer` is a smart account.
32
+ */
33
+ typedData: TypedDataDefinition<typeof RECOVER_TYPES, "RecoverDeposit">;
34
+ /**
35
+ * The address whose signature the processor will verify: the deposit's
36
+ * `recipient`. Whatever you return must be a signature this address's own
37
+ * verifier accepts.
38
+ */
39
+ signer: Address;
40
+ /** Deposit being recovered, for your own logging or confirmation UI. */
41
+ depositId: string;
42
+ /** Where the funds will go. Covered by the signature. */
43
+ destination: Address;
44
+ }
45
+ /**
46
+ * Produces a signature the recipient's verifier accepts.
47
+ *
48
+ * - **embedded EOA** (Privy, Turnkey, Dynamic): `signTypedData` and return the raw
49
+ * 65-byte result.
50
+ * - **deployed smart account**: return a signature valid under its ERC-1271
51
+ * `isValidSignature`. A raw owner signature is usually *not* enough — a Safe, for
52
+ * instance, expects its own message wrapping — so go through your account SDK.
53
+ * - **undeployed smart account**: wrap it per ERC-6492 so the processor can verify
54
+ * counterfactually. `ox/erc6492`'s `SignatureErc6492.wrap` does this, and ships
55
+ * with viem already.
56
+ */
57
+ type SignRecovery = (payload: SignRecoveryPayload) => Promise<Hex>;
58
+ /** Structured code from the processor; drives copy and whether a retry helps. */
59
+ type RecoveryErrorCode = "DEPOSIT_NOT_RECOVERABLE" | "RECOVERY_UNSUPPORTED" | "SIGNATURE_INVALID" | "VERIFICATION_UNAVAILABLE" | "REFUND_RECONCILIATION_REQUIRED" | "REFUND_FAILED";
60
+
61
+ /**
62
+ * Consumer-supplied RPC URL overrides, scoped to a single modal instance (see
63
+ * {@link RpcUrlsProvider}). Threaded into every client the modal builds — EVM
64
+ * public clients (`public-client.ts`), the wallet adapter's transports
65
+ * (`reown.tsx`), and the Solana connection (`solana.ts`).
66
+ *
67
+ * Keyed by the same `number | "solana"` chain identifier the rest of the modal
68
+ * uses (see `core/constants.ts`), so a single `rpcUrls` prop covers every
69
+ * chain — EVM mainnets, Polygon (137, also feeds Polymarket reads), HyperEVM
70
+ * (999), and Solana.
71
+ */
72
+ type ChainKey = number | "solana";
73
+ type RpcUrlMap = Partial<Record<ChainKey, string>>;
74
+
75
+ type Caip2ChainId = `eip155:${number}` | `solana:${string}`;
76
+ type ChainId = number | "solana" | "hypercore" | Caip2ChainId;
77
+ interface DepositModalTheme {
78
+ mode?: "light" | "dark";
79
+ radius?: "none" | "sm" | "md" | "lg" | "full";
80
+ fontColor?: string;
81
+ iconColor?: string;
82
+ ctaColor?: string;
83
+ ctaHoverColor?: string;
84
+ borderColor?: string;
85
+ backgroundColor?: string;
86
+ }
87
+ interface DepositModalUIConfig {
88
+ showBackButton?: boolean;
89
+ showHistoryButton?: boolean;
90
+ maxDepositUsd?: number;
91
+ minDepositUsd?: number;
92
+ /**
93
+ * When true the network/protocol fee is sponsored — the Review / Processing /
94
+ * Success / Failure screens render the fee line-through and surface a
95
+ * tooltip on the info icon explaining the sponsorship.
96
+ */
97
+ feeSponsored?: boolean;
98
+ /**
99
+ * Custom tooltip copy for the fee info icon. Defaults to a generic
100
+ * "Fees are sponsored" / "Fees apply" message based on `feeSponsored`.
101
+ */
102
+ feeTooltip?: string;
103
+ }
104
+ interface ConnectedEventData {
105
+ address: Address;
106
+ smartAccount: Address;
107
+ }
108
+ interface DepositSubmittedEventData {
109
+ txHash: string;
110
+ sourceChain: ChainId | "unknown";
111
+ amount: string;
112
+ }
113
+ interface DepositCompleteEventData {
114
+ txHash: string;
115
+ destinationTxHash?: string;
116
+ amount: string;
117
+ sourceChain: ChainId | "unknown";
118
+ sourceToken?: string;
119
+ targetChain: number | "solana";
120
+ targetToken: string;
121
+ }
122
+ interface DepositFailedEventData {
123
+ txHash: string;
124
+ error?: string;
125
+ }
126
+ interface WithdrawSubmittedEventData {
127
+ txHash: Hex;
128
+ sourceChain: number;
129
+ amount: string;
130
+ accountAddress: Address;
131
+ }
132
+ interface WithdrawCompleteEventData {
133
+ txHash: Hex;
134
+ destinationTxHash?: Hex;
135
+ amount: string;
136
+ sourceChain: number;
137
+ sourceToken: Address;
138
+ targetChain: number;
139
+ targetToken: Address;
140
+ }
141
+ interface WithdrawFailedEventData {
142
+ txHash: Hex;
143
+ error?: string;
144
+ }
145
+ interface ErrorEventData {
146
+ message: string;
147
+ code?: string;
148
+ }
149
+ interface OutputTokenRule {
150
+ match: {
151
+ chain?: string;
152
+ token?: string;
153
+ symbol?: string;
154
+ };
155
+ outputToken: string;
156
+ }
157
+ /**
158
+ * Which Swapped payment groups the fiat on-ramp offers. Keys are Swapped
159
+ * `payment_group` values; omit the object to offer all of them.
160
+ *
161
+ * Deliberately booleans rather than a list of row descriptors: the label,
162
+ * sublabel and icon belong to the modal, so subsetting cannot drift from — or
163
+ * freeze a stale copy of — Swapped's own limits and naming.
164
+ */
165
+ interface FiatMethodsConfig {
166
+ creditcard?: boolean;
167
+ "bank-transfer"?: boolean;
168
+ "apple-pay"?: boolean;
169
+ }
170
+ interface DepositModalProps {
171
+ /**
172
+ * A wallet the host app already has connected. Pass this to reuse the user's
173
+ * existing session — the modal reads the address off `.account`, so it cannot
174
+ * disagree with what your app thinks the user is. Also what lets the modal
175
+ * skip its own connect step when the wallet is the only funding feature.
176
+ *
177
+ * Omit it and pass `reownAppId` instead to have the modal connect a wallet
178
+ * itself.
179
+ */
180
+ walletClient?: WalletClient | null;
181
+ /** Read client paired with `walletClient`. Defaults to the modal's own. */
182
+ publicClient?: PublicClient | null;
183
+ targetChain: Chain | number | "solana";
184
+ targetToken: Address | string;
185
+ isOpen: boolean;
186
+ onClose: () => void;
187
+ inline?: boolean;
188
+ closeOnOverlayClick?: boolean;
189
+ sourceChain?: Chain | number;
190
+ sourceToken?: Address;
191
+ /**
192
+ * Pre-fills the deposit amount. Either a USD-denominated number string
193
+ * (e.g. "25") or the case-insensitive sentinel `"max"`, which fills the
194
+ * full available balance once it loads (same as the Max preset).
195
+ */
196
+ defaultAmount?: string;
197
+ recipient: Address | string;
198
+ /**
199
+ * The user's current in-app balance, in USD, as the consuming app displays
200
+ * it. When provided, the amount screen shows a "Balance after deposit" row
201
+ * (`appBalanceUsd + amount`) so the user sees their post-deposit app
202
+ * balance. The row is hidden when this is omitted.
203
+ */
204
+ appBalanceUsd?: number;
205
+ outputTokenRules?: OutputTokenRule[];
206
+ rejectUnmapped?: boolean;
207
+ backendUrl: string;
208
+ /**
209
+ * Per-chain RPC URL overrides, keyed by EVM chain id plus the literal
210
+ * `"solana"` key. Applied everywhere the modal reads chain state — EVM
211
+ * public clients, the connected wallet's transports (avoiding the
212
+ * rate-limited public defaults), Polygon/Polymarket reads, HyperEVM (999),
213
+ * and the Solana connection. Chains left unset use their default RPC.
214
+ */
215
+ rpcUrls?: RpcUrlMap;
216
+ forceRegister?: boolean;
217
+ reownAppId?: string;
218
+ /**
219
+ * Enable importing balances from third-party dapps. Each dapp defaults to
220
+ * off — clients must explicitly opt in. When a dapp is enabled and the
221
+ * connected wallet has a balance there, a new row appears on the deposit
222
+ * entry screen.
223
+ */
224
+ assetMigrations?: AssetMigrationsConfig;
225
+ /**
226
+ * Open the modal pre-routed into a dapp-import provider, skipping the
227
+ * deposit-method home screen. Must name an enabled `assetMigrations` key
228
+ * (e.g. "polymarket"); disabled/unknown values are a no-op. While the
229
+ * provider's balances are checked the modal shows a loading skeleton;
230
+ * if the flow turns out to be unreachable (no account, no balance, no
231
+ * wallet) it falls back to the home screen.
232
+ */
233
+ initialAssetMigration?: keyof AssetMigrationsConfig;
234
+ /** Show fiat on-ramp option(s) that embed Swapped's iframe. Default: false. */
235
+ /**
236
+ * Offer the connected wallet as a funding source. Default: true. Turn off to
237
+ * present a wallet-free flow (QR / fiat / exchange only) even when a wallet
238
+ * client or `reownAppId` is supplied.
239
+ */
240
+ enableWallet?: boolean;
241
+ enableFiatOnramp?: boolean;
242
+ /** Show the Transfer Crypto / QR row. Default: true. */
243
+ enableQrTransfer?: boolean;
244
+ /**
245
+ * Restrict Cash to an exact subset of the standard payment groups. Providing
246
+ * the map opts this modal instance out of regional personalization; omit it
247
+ * to use backend-resolved methods with the built-in global fallback.
248
+ * An empty or all-false map disables Cash.
249
+ */
250
+ fiatMethods?: FiatMethodsConfig;
251
+ /**
252
+ * Show a "Connect exchange" row that opens Swapped Connect — the user
253
+ * picks their CEX (Coinbase, Binance, Kraken…) or wallet inside the iframe
254
+ * and Swapped pulls the crypto on-chain to the smart account. Default: false.
255
+ */
256
+ enableExchangeConnect?: boolean;
257
+ onRequestConnect?: () => void;
258
+ theme?: DepositModalTheme;
259
+ uiConfig?: DepositModalUIConfig;
260
+ className?: string;
261
+ onReady?: () => void;
262
+ /** Discriminated stream of deposit lifecycle transitions. */
263
+ onLifecycle?: (event: DepositLifecycleEvent) => void;
264
+ onEvent?: (event: DepositAnalyticsEvent) => void;
265
+ onError?: (data: ErrorEventData) => void;
266
+ debug?: boolean;
267
+ }
268
+ /**
269
+ * One transfer the host app must execute to fund a withdrawal.
270
+ *
271
+ * `to` is authoritative: it is the Rhinestone deposit account the processor
272
+ * watches, except on a same-route withdrawal (source chain+token identical to
273
+ * the target) where the modal skips the bridge and `to` is the end recipient.
274
+ * Either way the app's job is identical — move `amount` of `token` to `to` on
275
+ * `chainId` — so it must never substitute an address of its own.
276
+ */
277
+ interface WithdrawTransferRequest {
278
+ /** Source chain to send from. */
279
+ chainId: number;
280
+ /** Source token; `NATIVE_TOKEN_ADDRESS` for the chain's native asset. */
281
+ token: Address;
282
+ /** Amount in the token's base units. */
283
+ amount: bigint;
284
+ /** Destination for this transfer. Send here. */
285
+ to: Address;
286
+ }
287
+ interface WithdrawModalProps {
288
+ /**
289
+ * Account holding the funds being withdrawn. Used to read the withdrawable
290
+ * balance and to keep the user from sending to themselves; the modal never
291
+ * transacts from it — `onSendTransaction` does.
292
+ */
293
+ accountAddress: Address;
294
+ sourceChain: Chain | number;
295
+ sourceToken: Address;
296
+ /**
297
+ * Initial destination, not a constraint. The withdraw form lets the user pick
298
+ * any supported chain/token/recipient, so these only seed the fields — pass
299
+ * them to open on a particular destination, omit them to let the user choose.
300
+ */
301
+ targetChain?: Chain | number;
302
+ targetToken?: Address;
303
+ recipient?: Address;
304
+ defaultAmount?: string;
305
+ isOpen: boolean;
306
+ onClose: () => void;
307
+ inline?: boolean;
308
+ closeOnOverlayClick?: boolean;
309
+ backendUrl: string;
310
+ /**
311
+ * Per-chain RPC URL overrides, keyed by EVM chain id plus the literal
312
+ * `"solana"` key. Applied to every chain read (EVM public clients and the
313
+ * connected wallet's transports). Chains left unset use their default RPC.
314
+ */
315
+ rpcUrls?: RpcUrlMap;
316
+ forceRegister?: boolean;
317
+ /**
318
+ * Executes the transfer that funds the withdrawal, using whatever account
319
+ * model the host app has (EOA, smart account, in-app wallet, relayer).
320
+ *
321
+ * Must resolve with the **on-chain transaction hash** — not a userOp hash or
322
+ * bundler id. Progress is tracked by looking the deposit up by that hash, so
323
+ * anything else leaves the modal waiting on a withdrawal that already
324
+ * succeeded. Reject to surface a failure in the modal.
325
+ */
326
+ onSendTransaction: (request: WithdrawTransferRequest) => Promise<{
327
+ txHash: Hex;
328
+ }>;
329
+ theme?: DepositModalTheme;
330
+ uiConfig?: DepositModalUIConfig;
331
+ className?: string;
332
+ onReady?: () => void;
333
+ /** Discriminated stream of withdraw lifecycle transitions. */
334
+ onLifecycle?: (event: WithdrawLifecycleEvent) => void;
335
+ onEvent?: (event: WithdrawAnalyticsEvent) => void;
336
+ onError?: (data: ErrorEventData) => void;
337
+ debug?: boolean;
338
+ }
339
+ /**
340
+ * Self-service recovery modal. Returns a failed or rejected deposit's
341
+ * source-chain funds to an address the user names. The deposit is looked up by
342
+ * transaction hash.
343
+ *
344
+ * The user's own wallet authorizes it: the deposit's `recipient` — the in-app
345
+ * wallet the funds were headed to — signs an EIP-712 struct naming the deposit and
346
+ * the destination, and the processor verifies that signature against the same
347
+ * `recipient` before moving anything. Your app needs no backend and no shared
348
+ * secret; the request goes from the browser through your `deposit-widget-proxy`,
349
+ * which adds only the project API key.
350
+ *
351
+ * Note the signer is the recipient, not the deposit account — deposit accounts are
352
+ * service-owned and cannot sign for themselves.
353
+ */
354
+ interface ClaimModalProps {
355
+ /**
356
+ * Signs the recovery authorization. Called with the exact typed data to sign and
357
+ * the `signer` address whose signature the processor will verify — the deposit's
358
+ * `recipient`.
359
+ *
360
+ * Return whatever that address's own verifier accepts:
361
+ * - **embedded EOA** (Privy, Turnkey, Dynamic) — `signTypedData`, raw 65-byte
362
+ * result.
363
+ * - **deployed smart account** — a signature valid under its ERC-1271
364
+ * `isValidSignature`. A raw owner signature is usually not enough; a Safe, for
365
+ * one, expects its own message wrapping, so go through your account SDK.
366
+ * - **undeployed smart account** — wrap per ERC-6492 so it can be verified
367
+ * counterfactually. `SignatureErc6492.wrap` from `ox/erc6492` does this and
368
+ * ships with viem already.
369
+ *
370
+ * Throwing (or returning nothing) is treated as the user declining, which is
371
+ * retryable.
372
+ *
373
+ * If your users can't sign — a lost embedded wallet, or a recipient your app
374
+ * controls rather than the user — use `createRefundHandler` from
375
+ * `@rhinestone/deposit-modal/server` against your own backend instead, and drive
376
+ * your own UI. That path authorizes on your say-so rather than a signature.
377
+ */
378
+ signRecovery: SignRecovery;
379
+ isOpen: boolean;
380
+ onClose: () => void;
381
+ inline?: boolean;
382
+ closeOnOverlayClick?: boolean;
383
+ backendUrl: string;
384
+ rpcUrls?: RpcUrlMap;
385
+ /** Optional prefills for the lookup form and destination. */
386
+ defaultTxHash?: string;
387
+ /**
388
+ * Prefills the refund destination. Left empty otherwise — the modal
389
+ * deliberately does NOT default to the deposit's sender, because returning
390
+ * funds to an exchange's hot wallet can lose them.
391
+ *
392
+ * Matches `refundDestination` on `RefundAuthorization` in `./server`, which
393
+ * is the authoritative version: this one only seeds the field and the user can
394
+ * edit it. Not related to the deposit's `recipient`.
395
+ */
396
+ defaultRefundDestination?: Address;
397
+ theme?: DepositModalTheme;
398
+ uiConfig?: DepositModalUIConfig;
399
+ className?: string;
400
+ onReady?: () => void;
401
+ onLifecycle?: (event: ClaimLifecycleEvent) => void;
402
+ onEvent?: (event: ClaimAnalyticsEvent) => void;
403
+ onError?: (data: ErrorEventData) => void;
404
+ debug?: boolean;
405
+ }
406
+ interface AssetOption {
407
+ id: string;
408
+ chainId: number;
409
+ token: Address;
410
+ symbol: string;
411
+ name: string;
412
+ decimals: number;
413
+ balance?: string;
414
+ balanceUsd?: number;
415
+ }
416
+ /**
417
+ * Discriminated union covering every deposit flow state transition the
418
+ * consumer can observe. Consumers handle additions in a single switch; the
419
+ * modal can add new event variants without changing the prop surface.
420
+ */
421
+ type DepositLifecycleEvent = {
422
+ type: "connected";
423
+ address: Address;
424
+ smartAccount: Address;
425
+ } | {
426
+ type: "submitted";
427
+ txHash: string;
428
+ sourceChain: ChainId | "unknown";
429
+ /** Source-token base units (e.g. "1100000" for 1.10 USDC). */
430
+ amount: string;
431
+ /**
432
+ * Decimals of the source token, for converting `amount` to a
433
+ * human-readable value. Omitted when the token is not recognised
434
+ * (e.g. a QR deposit of an unlisted token).
435
+ */
436
+ sourceDecimals?: number;
437
+ /**
438
+ * USD equivalent of the deposit as entered in the modal (token units
439
+ * for unpriced non-stablecoins). Omitted for flows without an amount
440
+ * input (QR transfer, fiat onramp, exchange connect).
441
+ */
442
+ amountUsd?: string;
443
+ } | {
444
+ type: "complete";
445
+ txHash: string;
446
+ destinationTxHash?: string;
447
+ /** Source-token base units (e.g. "1100000" for 1.10 USDC). */
448
+ amount: string;
449
+ sourceChain: ChainId | "unknown";
450
+ sourceToken?: string;
451
+ /**
452
+ * Decimals of the source token, for converting `amount` to a
453
+ * human-readable value. Omitted when the token is not recognised
454
+ * (e.g. a QR deposit of an unlisted token).
455
+ */
456
+ sourceDecimals?: number;
457
+ /**
458
+ * USD equivalent of the deposit as entered in the modal (token units
459
+ * for unpriced non-stablecoins). Omitted for flows without an amount
460
+ * input (QR transfer, fiat onramp, exchange connect).
461
+ */
462
+ amountUsd?: string;
463
+ targetChain: number | "solana";
464
+ targetToken: string;
465
+ } | {
466
+ type: "failed";
467
+ txHash: string;
468
+ error?: string;
469
+ } | {
470
+ type: "balance-changed";
471
+ totalUsd: number;
472
+ } | {
473
+ type: "smart-account-changed";
474
+ evm: Address | null;
475
+ solana: string | null;
476
+ };
477
+ type WithdrawLifecycleEvent =
478
+ /** The deposit account for the chosen target is registered and fundable. */
479
+ {
480
+ type: "connected";
481
+ address: Address;
482
+ smartAccount: Address;
483
+ } | {
484
+ type: "submitted";
485
+ txHash: Hex;
486
+ sourceChain: number;
487
+ amount: string;
488
+ accountAddress: Address;
489
+ } | {
490
+ type: "complete";
491
+ txHash: Hex;
492
+ destinationTxHash?: Hex;
493
+ amount: string;
494
+ sourceChain: number;
495
+ sourceToken: Address;
496
+ targetChain: number;
497
+ targetToken: Address;
498
+ } | {
499
+ type: "failed";
500
+ txHash: Hex;
501
+ error?: string;
502
+ };
503
+ type ClaimLifecycleEvent = {
504
+ type: "lookup";
505
+ txHash: string;
506
+ matches: number;
507
+ } | {
508
+ type: "refund_requested";
509
+ account: Address;
510
+ /** Where the funds were asked to go, on the source chain. */
511
+ destination: Address;
512
+ chain: number;
513
+ } | {
514
+ type: "complete";
515
+ txHash: string;
516
+ account: Address;
517
+ destination: Address;
518
+ chain: number;
519
+ token: string;
520
+ amount: string;
521
+ } | {
522
+ type: "failed";
523
+ /** HTTP status from the refund endpoint; 0 if it was unreachable. */
524
+ status?: number;
525
+ error?: string;
526
+ };
527
+ /**
528
+ * Telemetry events fired when screens open or CTAs are clicked.
529
+ * Distinct from {@link DepositLifecycleEvent}, which tracks transaction state.
530
+ */
531
+ type DepositAnalyticsEvent = {
532
+ type: "deposit_modal_fiat_methods_rendered";
533
+ country: string | null;
534
+ payment_methods: string[];
535
+ source: "personalized" | "fallback" | "configured";
536
+ } | {
537
+ type: "deposit_modal_fiat_method_click";
538
+ country: string | null;
539
+ payment_method: string;
540
+ source: "personalized" | "fallback" | "configured";
541
+ } | {
542
+ type: "deposit_modal_connected_wallet_select_source_open";
543
+ total_balance_in_external_wallet: number | null;
544
+ pred_balance: number | null;
545
+ } | {
546
+ type: "deposit_modal_connected_wallet_select_source_cta_click";
547
+ total_balance_in_external_wallet: number | null;
548
+ pred_balance: number | null;
549
+ cta_name: "token_selected";
550
+ token_name: string;
551
+ token_balance: string;
552
+ } | {
553
+ type: "deposit_modal_transfer_crypto_open";
554
+ default_chain: string;
555
+ default_token: string;
556
+ pred_balance: number | null;
557
+ } | {
558
+ type: "deposit_modal_transfer_crypto_cta_click";
559
+ default_chain: string;
560
+ default_token: string;
561
+ pred_balance: number | null;
562
+ cta_name: "copy";
563
+ } | {
564
+ type: "deposit_modal_connected_wallet_enter_value_open";
565
+ send_token: string;
566
+ receive_token: string;
567
+ pred_balance: number | null;
568
+ } | {
569
+ type: "deposit_modal_connected_wallet_enter_value_cta_click";
570
+ send_token: string;
571
+ receive_token: string;
572
+ pred_balance: number | null;
573
+ cta_name: "continue" | "25%" | "50%" | "75%" | "Max";
574
+ };
575
+ type WithdrawAnalyticsEvent = {
576
+ type: "withdraw_modal_select_amount_open";
577
+ pred_balance: number | null;
578
+ default_token: string;
579
+ default_chain: string;
580
+ } | {
581
+ type: "withdraw_modal_select_amount_cta_click";
582
+ pred_balance: number | null;
583
+ selected_token: string;
584
+ selected_chain: string;
585
+ amount: string;
586
+ cta_name: "withdraw";
587
+ };
588
+ type ClaimAnalyticsEvent = {
589
+ type: "claim_modal_open";
590
+ } | {
591
+ type: "claim_modal_lookup";
592
+ matches: number;
593
+ } | {
594
+ type: "claim_modal_refund_click";
595
+ chain: string;
596
+ } | {
597
+ type: "claim_modal_complete";
598
+ chain: string;
599
+ } | {
600
+ type: "claim_modal_failed";
601
+ chain: string;
602
+ status?: number;
603
+ };
604
+ type ModalAnalyticsEvent = DepositAnalyticsEvent | WithdrawAnalyticsEvent | ClaimAnalyticsEvent;
605
+
606
+ export type { AssetMigrationsConfig as A, ChainId as C, DepositAnalyticsEvent as D, ErrorEventData as E, FiatMethodsConfig as F, ModalAnalyticsEvent as M, OutputTokenRule as O, RpcUrlMap as R, SignRecovery as S, WithdrawAnalyticsEvent as W, AssetOption as a, ClaimAnalyticsEvent as b, ClaimLifecycleEvent as c, ClaimModalProps as d, ConnectedEventData as e, DepositCompleteEventData as f, DepositFailedEventData as g, DepositLifecycleEvent as h, DepositModalProps as i, DepositModalTheme as j, DepositModalUIConfig as k, DepositSubmittedEventData as l, WithdrawCompleteEventData as m, WithdrawFailedEventData as n, WithdrawLifecycleEvent as o, WithdrawModalProps as p, WithdrawSubmittedEventData as q, WithdrawTransferRequest as r, RecoveryErrorCode as s, SignRecoveryPayload as t };
package/dist/withdraw.cjs CHANGED
@@ -1,9 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkHQWZCOMScjs = require('./chunk-HQWZCOMS.cjs');
4
- require('./chunk-7OKA6GNA.cjs');
5
- require('./chunk-XRWQMIBY.cjs');
6
- require('./chunk-U7SVYWVD.cjs');
3
+ var _chunkDIX7M3SPcjs = require('./chunk-DIX7M3SP.cjs');
4
+ require('./chunk-NMIMRASD.cjs');
5
+ require('./chunk-VN4BLZYC.cjs');
6
+ require('./chunk-NEXUCY4B.cjs');
7
+ require('./chunk-H577RJN5.cjs');
7
8
 
8
9
 
9
- exports.WithdrawModal = _chunkHQWZCOMScjs.WithdrawModal;
10
+ exports.WithdrawModal = _chunkDIX7M3SPcjs.WithdrawModal;
@@ -1,11 +1,8 @@
1
1
  import * as react from 'react';
2
- import { n as WithdrawModalProps } from './types--LQWg_4W.cjs';
3
- export { A as AssetOption, a as ConnectedEventData, E as ErrorEventData, j as RpcUrlMap, S as SafeTransactionRequest, k as WithdrawCompleteEventData, l as WithdrawFailedEventData, o as WithdrawSubmittedEventData } from './types--LQWg_4W.cjs';
2
+ import { p as WithdrawModalProps } from './types-C0SGf-21.cjs';
3
+ export { a as AssetOption, e as ConnectedEventData, E as ErrorEventData, R as RpcUrlMap, m as WithdrawCompleteEventData, n as WithdrawFailedEventData, q as WithdrawSubmittedEventData, r as WithdrawTransferRequest } from './types-C0SGf-21.cjs';
4
4
  import 'viem';
5
5
 
6
- declare function WithdrawModal(props: WithdrawModalProps): react.JSX.Element;
7
- declare namespace WithdrawModal {
8
- var displayName: string;
9
- }
6
+ declare function WithdrawModal({ accountAddress, sourceChain: sourceChainProp, sourceToken, targetChain: targetChainProp, targetToken, recipient, defaultAmount, isOpen, onClose, inline, closeOnOverlayClick, backendUrl, rpcUrls: rpcUrlsProp, forceRegister, onSendTransaction, theme, uiConfig, className, onReady, onLifecycle, onEvent, onError, debug, ...removedProps }: WithdrawModalProps): react.JSX.Element;
10
7
 
11
8
  export { WithdrawModal, WithdrawModalProps };
@@ -1,11 +1,8 @@
1
1
  import * as react from 'react';
2
- import { n as WithdrawModalProps } from './types--LQWg_4W.js';
3
- export { A as AssetOption, a as ConnectedEventData, E as ErrorEventData, j as RpcUrlMap, S as SafeTransactionRequest, k as WithdrawCompleteEventData, l as WithdrawFailedEventData, o as WithdrawSubmittedEventData } from './types--LQWg_4W.js';
2
+ import { p as WithdrawModalProps } from './types-C0SGf-21.js';
3
+ export { a as AssetOption, e as ConnectedEventData, E as ErrorEventData, R as RpcUrlMap, m as WithdrawCompleteEventData, n as WithdrawFailedEventData, q as WithdrawSubmittedEventData, r as WithdrawTransferRequest } from './types-C0SGf-21.js';
4
4
  import 'viem';
5
5
 
6
- declare function WithdrawModal(props: WithdrawModalProps): react.JSX.Element;
7
- declare namespace WithdrawModal {
8
- var displayName: string;
9
- }
6
+ declare function WithdrawModal({ accountAddress, sourceChain: sourceChainProp, sourceToken, targetChain: targetChainProp, targetToken, recipient, defaultAmount, isOpen, onClose, inline, closeOnOverlayClick, backendUrl, rpcUrls: rpcUrlsProp, forceRegister, onSendTransaction, theme, uiConfig, className, onReady, onLifecycle, onEvent, onError, debug, ...removedProps }: WithdrawModalProps): react.JSX.Element;
10
7
 
11
8
  export { WithdrawModal, WithdrawModalProps };
package/dist/withdraw.mjs CHANGED
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  WithdrawModal
3
- } from "./chunk-T43VUEJH.mjs";
4
- import "./chunk-NASHLEVQ.mjs";
5
- import "./chunk-WK5AFRSP.mjs";
6
- import "./chunk-O5OKA27M.mjs";
3
+ } from "./chunk-E4G5BOZP.mjs";
4
+ import "./chunk-WYXBY2MQ.mjs";
5
+ import "./chunk-VOGZAZB2.mjs";
6
+ import "./chunk-OSI2CFGL.mjs";
7
+ import "./chunk-A223BLVC.mjs";
7
8
  export {
8
9
  WithdrawModal
9
10
  };