@rhinestone/deposit-modal 0.0.0-dev-20260608080045

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 (40) hide show
  1. package/README.md +134 -0
  2. package/dist/DepositModalReown-6SUEC5IU.mjs +60 -0
  3. package/dist/DepositModalReown-DNW4GH6L.cjs +60 -0
  4. package/dist/QRCode-5DXFNKI2.cjs +58 -0
  5. package/dist/QRCode-WUC652SH.mjs +58 -0
  6. package/dist/WithdrawModalReown-7UAGSOSU.mjs +37 -0
  7. package/dist/WithdrawModalReown-OUWBSKSM.cjs +37 -0
  8. package/dist/caip-CsslyHGL.d.cts +62 -0
  9. package/dist/caip-CsslyHGL.d.ts +62 -0
  10. package/dist/chunk-2SMS542Q.cjs +1654 -0
  11. package/dist/chunk-33H6O5UU.cjs +162 -0
  12. package/dist/chunk-6YRDD462.mjs +614 -0
  13. package/dist/chunk-GPSBM66J.mjs +162 -0
  14. package/dist/chunk-KAWJABTW.mjs +3765 -0
  15. package/dist/chunk-KJ2RR2D4.mjs +7619 -0
  16. package/dist/chunk-MILJQWPT.cjs +614 -0
  17. package/dist/chunk-RABZINV3.cjs +3765 -0
  18. package/dist/chunk-TKQYTBU6.mjs +1654 -0
  19. package/dist/chunk-VVJAIMKB.cjs +7619 -0
  20. package/dist/constants.cjs +70 -0
  21. package/dist/constants.d.cts +21 -0
  22. package/dist/constants.d.ts +21 -0
  23. package/dist/constants.mjs +70 -0
  24. package/dist/deposit.cjs +8 -0
  25. package/dist/deposit.d.cts +11 -0
  26. package/dist/deposit.d.ts +11 -0
  27. package/dist/deposit.mjs +8 -0
  28. package/dist/index.cjs +86 -0
  29. package/dist/index.d.cts +11 -0
  30. package/dist/index.d.ts +11 -0
  31. package/dist/index.mjs +86 -0
  32. package/dist/styles.css +5143 -0
  33. package/dist/styles.d.ts +3 -0
  34. package/dist/types-BMcGO5k_.d.cts +432 -0
  35. package/dist/types-BMcGO5k_.d.ts +432 -0
  36. package/dist/withdraw.cjs +8 -0
  37. package/dist/withdraw.d.cts +11 -0
  38. package/dist/withdraw.d.ts +11 -0
  39. package/dist/withdraw.mjs +8 -0
  40. package/package.json +190 -0
@@ -0,0 +1,3 @@
1
+ // Type declaration for CSS side-effect import
2
+ declare const styles: void;
3
+ export default styles;
@@ -0,0 +1,432 @@
1
+ import { Address, Hex, WalletClient, PublicClient, Chain } from 'viem';
2
+
3
+ interface SafeTransactionRequest {
4
+ chainId: number;
5
+ safeAddress: Address;
6
+ safeTxHash: Hex;
7
+ typedData: {
8
+ domain: {
9
+ chainId: number;
10
+ verifyingContract: Address;
11
+ };
12
+ types: typeof SAFE_TX_TYPES;
13
+ primaryType: "SafeTx";
14
+ message: {
15
+ to: Address;
16
+ value: bigint;
17
+ data: Hex;
18
+ operation: number;
19
+ safeTxGas: bigint;
20
+ baseGas: bigint;
21
+ gasPrice: bigint;
22
+ gasToken: Address;
23
+ refundReceiver: Address;
24
+ nonce: bigint;
25
+ };
26
+ };
27
+ }
28
+ declare const SAFE_TX_TYPES: {
29
+ readonly SafeTx: readonly [{
30
+ readonly name: "to";
31
+ readonly type: "address";
32
+ }, {
33
+ readonly name: "value";
34
+ readonly type: "uint256";
35
+ }, {
36
+ readonly name: "data";
37
+ readonly type: "bytes";
38
+ }, {
39
+ readonly name: "operation";
40
+ readonly type: "uint8";
41
+ }, {
42
+ readonly name: "safeTxGas";
43
+ readonly type: "uint256";
44
+ }, {
45
+ readonly name: "baseGas";
46
+ readonly type: "uint256";
47
+ }, {
48
+ readonly name: "gasPrice";
49
+ readonly type: "uint256";
50
+ }, {
51
+ readonly name: "gasToken";
52
+ readonly type: "address";
53
+ }, {
54
+ readonly name: "refundReceiver";
55
+ readonly type: "address";
56
+ }, {
57
+ readonly name: "nonce";
58
+ readonly type: "uint256";
59
+ }];
60
+ };
61
+
62
+ /**
63
+ * Public config shape exposed on DepositModalProps. Each dapp defaults to
64
+ * off — clients must explicitly opt in.
65
+ */
66
+ interface DappImportsConfig {
67
+ polymarket?: boolean;
68
+ }
69
+
70
+ type Caip2ChainId = `eip155:${number}` | `solana:${string}`;
71
+ type ChainId = number | "solana" | Caip2ChainId;
72
+ interface DepositModalTheme {
73
+ mode?: "light" | "dark";
74
+ radius?: "none" | "sm" | "md" | "lg" | "full";
75
+ fontColor?: string;
76
+ iconColor?: string;
77
+ ctaColor?: string;
78
+ ctaHoverColor?: string;
79
+ borderColor?: string;
80
+ backgroundColor?: string;
81
+ }
82
+ interface DepositModalUIConfig {
83
+ showBackButton?: boolean;
84
+ showHistoryButton?: boolean;
85
+ maxDepositUsd?: number;
86
+ minDepositUsd?: number;
87
+ /**
88
+ * When true the network/protocol fee is sponsored — the Review / Processing /
89
+ * Success / Failure screens render the fee line-through and surface a
90
+ * tooltip on the info icon explaining the sponsorship.
91
+ */
92
+ feeSponsored?: boolean;
93
+ /**
94
+ * Custom tooltip copy for the fee info icon. Defaults to a generic
95
+ * "Fees are sponsored" / "Fees apply" message based on `feeSponsored`.
96
+ */
97
+ feeTooltip?: string;
98
+ }
99
+ interface ConnectedEventData {
100
+ address: Address;
101
+ smartAccount: Address;
102
+ }
103
+ interface DepositSubmittedEventData {
104
+ txHash: string;
105
+ sourceChain: ChainId | "unknown";
106
+ amount: string;
107
+ }
108
+ interface DepositCompleteEventData {
109
+ txHash: string;
110
+ destinationTxHash?: string;
111
+ amount: string;
112
+ sourceChain: ChainId | "unknown";
113
+ sourceToken?: string;
114
+ targetChain: number | "solana";
115
+ targetToken: string;
116
+ }
117
+ interface DepositFailedEventData {
118
+ txHash: string;
119
+ error?: string;
120
+ }
121
+ interface WithdrawSubmittedEventData {
122
+ txHash: Hex;
123
+ sourceChain: number;
124
+ amount: string;
125
+ safeAddress: Address;
126
+ }
127
+ interface WithdrawCompleteEventData {
128
+ txHash: Hex;
129
+ destinationTxHash?: Hex;
130
+ amount: string;
131
+ sourceChain: number;
132
+ sourceToken: Address;
133
+ targetChain: number;
134
+ targetToken: Address;
135
+ }
136
+ interface WithdrawFailedEventData {
137
+ txHash: Hex;
138
+ error?: string;
139
+ }
140
+ interface ErrorEventData {
141
+ message: string;
142
+ code?: string;
143
+ }
144
+ interface OutputTokenRule {
145
+ match: {
146
+ chain?: string;
147
+ token?: string;
148
+ symbol?: string;
149
+ };
150
+ outputToken: string;
151
+ }
152
+ interface RouteConfig {
153
+ sourceChains?: number[];
154
+ sourceTokens?: string[];
155
+ }
156
+ interface FiatPaymentMethodOption {
157
+ /**
158
+ * Swapped's `payment_group` value (e.g. `creditcard`, `apple-pay`,
159
+ * `bank-transfer`) from GET /api/v1/merchant/get_payment_methods. This exact
160
+ * value is what the widget URL's `method` param prepopulates from — Apple Pay
161
+ * is `apple-pay`, not `applepay`.
162
+ */
163
+ method: string;
164
+ /** Row label shown in ConnectStep. */
165
+ label: string;
166
+ /** Optional sublabel under the row. */
167
+ sublabel?: string;
168
+ /** Optional icon name: `card` | `apple` | `bank`. Defaults to `card`. */
169
+ icon?: "card" | "apple" | "bank";
170
+ }
171
+ interface DepositModalProps {
172
+ dappWalletClient?: WalletClient | null;
173
+ dappPublicClient?: PublicClient | null;
174
+ dappAddress?: Address | null;
175
+ targetChain: Chain | number | "solana";
176
+ targetToken: Address | string;
177
+ isOpen: boolean;
178
+ onClose: () => void;
179
+ inline?: boolean;
180
+ closeOnOverlayClick?: boolean;
181
+ sourceChain?: Chain | number;
182
+ sourceToken?: Address;
183
+ /**
184
+ * Pre-fills the deposit amount. Either a USD-denominated number string
185
+ * (e.g. "25") or the case-insensitive sentinel `"max"`, which fills the
186
+ * full available balance once it loads (same as the Max preset).
187
+ */
188
+ defaultAmount?: string;
189
+ recipient: Address | string;
190
+ /**
191
+ * The user's current in-app balance, in USD, as the consuming app displays
192
+ * it. When provided, the amount screen shows a "Balance after deposit" row
193
+ * (`appBalanceUsd + amount`) so the user sees their post-deposit app
194
+ * balance. The row is hidden when this is omitted.
195
+ */
196
+ appBalanceUsd?: number;
197
+ postBridgeActions?: PostBridgeAction[];
198
+ outputTokenRules?: OutputTokenRule[];
199
+ rejectUnmapped?: boolean;
200
+ backendUrl?: string;
201
+ solanaRpcUrl?: string;
202
+ rhinestoneApiKey?: string;
203
+ signerAddress?: Address;
204
+ sessionChainIds?: number[];
205
+ forceRegister?: boolean;
206
+ reownAppId?: string;
207
+ enableSolana?: boolean;
208
+ /**
209
+ * Enable importing balances from third-party dapps. Each dapp defaults to
210
+ * off — clients must explicitly opt in. When a dapp is enabled and the
211
+ * connected wallet has a balance there, a new row appears on the deposit
212
+ * entry screen.
213
+ */
214
+ dappImports?: DappImportsConfig;
215
+ /** Show fiat on-ramp option(s) that embed Swapped's iframe. Default: false. */
216
+ enableFiatOnramp?: boolean;
217
+ /** Show the Transfer Crypto / QR row. Default: true. */
218
+ enableQrTransfer?: boolean;
219
+ /**
220
+ * One row per Swapped payment method (Pay with Card / Apple Pay / Bank
221
+ * Transfer). When set, replaces the generic "Pay with Card" row.
222
+ */
223
+ fiatOnrampMethods?: FiatPaymentMethodOption[];
224
+ /**
225
+ * Show a "Fund from Exchange" row that opens Swapped Connect — the user
226
+ * picks their CEX (Coinbase, Binance, Kraken…) or wallet inside the iframe
227
+ * and Swapped pulls the crypto on-chain to the smart account. Default: false.
228
+ */
229
+ enableExchangeConnect?: boolean;
230
+ onRequestConnect?: () => void;
231
+ theme?: DepositModalTheme;
232
+ uiConfig?: DepositModalUIConfig;
233
+ allowedRoutes?: RouteConfig;
234
+ className?: string;
235
+ onReady?: () => void;
236
+ /** Discriminated stream of deposit lifecycle transitions. */
237
+ onLifecycle?: (event: DepositLifecycleEvent) => void;
238
+ onEvent?: (event: DepositAnalyticsEvent) => void;
239
+ onError?: (data: ErrorEventData) => void;
240
+ debug?: boolean;
241
+ }
242
+ interface WithdrawModalProps {
243
+ dappWalletClient?: WalletClient | null;
244
+ dappPublicClient?: PublicClient | null;
245
+ dappAddress?: Address | null;
246
+ safeAddress: Address;
247
+ sourceChain: Chain | number;
248
+ sourceToken: Address;
249
+ targetChain: Chain | number;
250
+ targetToken: Address;
251
+ recipient?: Address;
252
+ defaultAmount?: string;
253
+ isOpen: boolean;
254
+ onClose: () => void;
255
+ inline?: boolean;
256
+ closeOnOverlayClick?: boolean;
257
+ allowedRoutes?: RouteConfig;
258
+ backendUrl?: string;
259
+ rhinestoneApiKey?: string;
260
+ signerAddress?: Address;
261
+ sessionChainIds?: number[];
262
+ forceRegister?: boolean;
263
+ reownAppId?: string;
264
+ onSignTransaction?: (request: SafeTransactionRequest) => Promise<{
265
+ signature: Hex;
266
+ }>;
267
+ onRequestConnect?: () => void;
268
+ theme?: DepositModalTheme;
269
+ uiConfig?: DepositModalUIConfig;
270
+ className?: string;
271
+ onReady?: () => void;
272
+ /** Discriminated stream of withdraw lifecycle transitions. */
273
+ onLifecycle?: (event: WithdrawLifecycleEvent) => void;
274
+ onEvent?: (event: WithdrawAnalyticsEvent) => void;
275
+ onError?: (data: ErrorEventData) => void;
276
+ debug?: boolean;
277
+ }
278
+ interface AssetOption {
279
+ id: string;
280
+ chainId: number;
281
+ token: Address;
282
+ symbol: string;
283
+ name: string;
284
+ decimals: number;
285
+ balance?: string;
286
+ balanceUsd?: number;
287
+ }
288
+ interface OrderBookSwapAction {
289
+ type: "orderbook-swap";
290
+ contract: Address;
291
+ outputToken: Address;
292
+ }
293
+ type PostBridgeAction = OrderBookSwapAction;
294
+ /**
295
+ * Discriminated union covering every deposit flow state transition the
296
+ * consumer can observe. Consumers handle additions in a single switch; the
297
+ * modal can add new event variants without changing the prop surface.
298
+ */
299
+ type DepositLifecycleEvent = {
300
+ type: "connected";
301
+ address: Address;
302
+ smartAccount: Address;
303
+ } | {
304
+ type: "submitted";
305
+ txHash: string;
306
+ sourceChain: ChainId | "unknown";
307
+ /** Source-token base units (e.g. "1100000" for 1.10 USDC). */
308
+ amount: string;
309
+ /**
310
+ * Decimals of the source token, for converting `amount` to a
311
+ * human-readable value. Omitted when the token is not recognised
312
+ * (e.g. a QR deposit of an unlisted token).
313
+ */
314
+ sourceDecimals?: number;
315
+ /**
316
+ * USD equivalent of the deposit as entered in the modal (token units
317
+ * for unpriced non-stablecoins). Omitted for flows without an amount
318
+ * input (QR transfer, fiat onramp, exchange connect).
319
+ */
320
+ amountUsd?: string;
321
+ } | {
322
+ type: "complete";
323
+ txHash: string;
324
+ destinationTxHash?: string;
325
+ /** Source-token base units (e.g. "1100000" for 1.10 USDC). */
326
+ amount: string;
327
+ sourceChain: ChainId | "unknown";
328
+ sourceToken?: string;
329
+ /**
330
+ * Decimals of the source token, for converting `amount` to a
331
+ * human-readable value. Omitted when the token is not recognised
332
+ * (e.g. a QR deposit of an unlisted token).
333
+ */
334
+ sourceDecimals?: number;
335
+ /**
336
+ * USD equivalent of the deposit as entered in the modal (token units
337
+ * for unpriced non-stablecoins). Omitted for flows without an amount
338
+ * input (QR transfer, fiat onramp, exchange connect).
339
+ */
340
+ amountUsd?: string;
341
+ targetChain: number | "solana";
342
+ targetToken: string;
343
+ } | {
344
+ type: "failed";
345
+ txHash: string;
346
+ error?: string;
347
+ } | {
348
+ type: "balance-changed";
349
+ totalUsd: number;
350
+ } | {
351
+ type: "smart-account-changed";
352
+ evm: Address | null;
353
+ solana: string | null;
354
+ };
355
+ type WithdrawLifecycleEvent = {
356
+ type: "connected";
357
+ address: Address;
358
+ smartAccount: Address;
359
+ } | {
360
+ type: "submitted";
361
+ txHash: Hex;
362
+ sourceChain: number;
363
+ amount: string;
364
+ safeAddress: Address;
365
+ } | {
366
+ type: "complete";
367
+ txHash: Hex;
368
+ destinationTxHash?: Hex;
369
+ amount: string;
370
+ sourceChain: number;
371
+ sourceToken: Address;
372
+ targetChain: number;
373
+ targetToken: Address;
374
+ } | {
375
+ type: "failed";
376
+ txHash: Hex;
377
+ error?: string;
378
+ };
379
+ /**
380
+ * Telemetry events fired when screens open or CTAs are clicked.
381
+ * Distinct from {@link DepositLifecycleEvent}, which tracks transaction state.
382
+ */
383
+ type DepositAnalyticsEvent = {
384
+ type: "deposit_modal_connected_wallet_select_source_open";
385
+ total_balance_in_external_wallet: number | null;
386
+ pred_balance: number | null;
387
+ } | {
388
+ type: "deposit_modal_connected_wallet_select_source_cta_click";
389
+ total_balance_in_external_wallet: number | null;
390
+ pred_balance: number | null;
391
+ cta_name: "token_selected";
392
+ token_name: string;
393
+ token_balance: string;
394
+ } | {
395
+ type: "deposit_modal_transfer_crypto_open";
396
+ default_chain: string;
397
+ default_token: string;
398
+ pred_balance: number | null;
399
+ } | {
400
+ type: "deposit_modal_transfer_crypto_cta_click";
401
+ default_chain: string;
402
+ default_token: string;
403
+ pred_balance: number | null;
404
+ cta_name: "copy";
405
+ } | {
406
+ type: "deposit_modal_connected_wallet_enter_value_open";
407
+ send_token: string;
408
+ receive_token: string;
409
+ pred_balance: number | null;
410
+ } | {
411
+ type: "deposit_modal_connected_wallet_enter_value_cta_click";
412
+ send_token: string;
413
+ receive_token: string;
414
+ pred_balance: number | null;
415
+ cta_name: "continue" | "25%" | "50%" | "75%" | "Max";
416
+ };
417
+ type WithdrawAnalyticsEvent = {
418
+ type: "withdraw_modal_select_amount_open";
419
+ pred_balance: number | null;
420
+ default_token: string;
421
+ default_chain: string;
422
+ } | {
423
+ type: "withdraw_modal_select_amount_cta_click";
424
+ pred_balance: number | null;
425
+ selected_token: string;
426
+ selected_chain: string;
427
+ amount: string;
428
+ cta_name: "withdraw";
429
+ };
430
+ type ModalAnalyticsEvent = DepositAnalyticsEvent | WithdrawAnalyticsEvent;
431
+
432
+ export type { AssetOption as A, ChainId as C, DappImportsConfig as D, ErrorEventData as E, ModalAnalyticsEvent as M, OrderBookSwapAction as O, PostBridgeAction as P, RouteConfig as R, SafeTransactionRequest as S, WithdrawAnalyticsEvent as W, ConnectedEventData as a, DepositAnalyticsEvent as b, DepositCompleteEventData as c, DepositFailedEventData as d, DepositLifecycleEvent as e, DepositModalProps as f, DepositModalTheme as g, DepositModalUIConfig as h, DepositSubmittedEventData as i, OutputTokenRule as j, WithdrawCompleteEventData as k, WithdrawFailedEventData as l, WithdrawLifecycleEvent as m, WithdrawModalProps as n, WithdrawSubmittedEventData as o };