@rhinestone/deposit-modal 0.3.0-alpha.9 → 0.3.1

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 (47) hide show
  1. package/README.md +76 -0
  2. package/dist/{DepositModalReown-I7I3KLD2.mjs → DepositModalReown-G7UX4IBZ.mjs} +6 -4
  3. package/dist/{DepositModalReown-XUA47RYZ.cjs → DepositModalReown-MECHBE6P.cjs} +9 -7
  4. package/dist/{QRCode-KG47KTGX.cjs → QRCode-5DXFNKI2.cjs} +1 -1
  5. package/dist/{QRCode-YJ3EGWQS.mjs → QRCode-WUC652SH.mjs} +1 -1
  6. package/dist/{WithdrawModalReown-KN2DGOXR.mjs → WithdrawModalReown-CUJAFUQM.mjs} +5 -4
  7. package/dist/{WithdrawModalReown-JATYMQYP.cjs → WithdrawModalReown-WJ6VBZKK.cjs} +8 -7
  8. package/dist/{constants-DqVn968d.d.ts → caip-CsslyHGL.d.cts} +11 -1
  9. package/dist/{constants-DqVn968d.d.cts → caip-CsslyHGL.d.ts} +11 -1
  10. package/dist/{chunk-TJG2AFPS.mjs → chunk-3C35DVPE.mjs} +1048 -829
  11. package/dist/{chunk-SZIYS42B.mjs → chunk-6YRDD462.mjs} +63 -3
  12. package/dist/chunk-AJHFNHG3.cjs +295 -0
  13. package/dist/chunk-BAEB5AFZ.mjs +212 -0
  14. package/dist/{chunk-KE4MRCFN.mjs → chunk-DZQD3DAV.mjs} +26 -17
  15. package/dist/{chunk-G5Q4QBWX.cjs → chunk-LEL6GMEQ.cjs} +111 -102
  16. package/dist/{chunk-7JIDIX27.cjs → chunk-MILJQWPT.cjs} +73 -13
  17. package/dist/{chunk-MMXUBBGK.cjs → chunk-MQIJZNTP.cjs} +1026 -807
  18. package/dist/{chunk-4BUMVXPS.mjs → chunk-QYSCCX4K.mjs} +2237 -871
  19. package/dist/chunk-R5CPOBCF.cjs +212 -0
  20. package/dist/{chunk-OISMGA2L.mjs → chunk-R5WDHHVM.mjs} +2 -12
  21. package/dist/{chunk-ZVG4JDKZ.cjs → chunk-SPUZLWQS.cjs} +2285 -919
  22. package/dist/chunk-TQ2AYMWS.mjs +295 -0
  23. package/dist/{chunk-KIPKYPNF.cjs → chunk-ULEAK63T.cjs} +6 -16
  24. package/dist/constants.cjs +6 -2
  25. package/dist/constants.d.cts +1 -1
  26. package/dist/constants.d.ts +1 -1
  27. package/dist/constants.mjs +5 -1
  28. package/dist/deposit.cjs +6 -4
  29. package/dist/deposit.d.cts +4 -4
  30. package/dist/deposit.d.ts +4 -4
  31. package/dist/deposit.mjs +5 -3
  32. package/dist/index.cjs +21 -6
  33. package/dist/index.d.cts +4 -3
  34. package/dist/index.d.ts +4 -3
  35. package/dist/index.mjs +22 -7
  36. package/dist/polymarket.cjs +64 -0
  37. package/dist/polymarket.d.cts +57 -0
  38. package/dist/polymarket.d.ts +57 -0
  39. package/dist/polymarket.mjs +64 -0
  40. package/dist/styles.css +719 -75
  41. package/dist/{types-D8Q4TMk7.d.cts → types-RzfAD14B.d.cts} +65 -2
  42. package/dist/{types-D8Q4TMk7.d.ts → types-RzfAD14B.d.ts} +65 -2
  43. package/dist/withdraw.cjs +5 -4
  44. package/dist/withdraw.d.cts +4 -4
  45. package/dist/withdraw.d.ts +4 -4
  46. package/dist/withdraw.mjs +4 -3
  47. package/package.json +55 -18
@@ -153,6 +153,21 @@ interface RouteConfig {
153
153
  sourceChains?: number[];
154
154
  sourceTokens?: string[];
155
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
+ }
156
171
  interface DepositModalProps {
157
172
  dappWalletClient?: WalletClient | null;
158
173
  dappPublicClient?: PublicClient | null;
@@ -188,7 +203,6 @@ interface DepositModalProps {
188
203
  signerAddress?: Address;
189
204
  sessionChainIds?: number[];
190
205
  forceRegister?: boolean;
191
- waitForFinalTx?: boolean;
192
206
  reownAppId?: string;
193
207
  enableSolana?: boolean;
194
208
  /**
@@ -198,6 +212,30 @@ interface DepositModalProps {
198
212
  * entry screen.
199
213
  */
200
214
  dappImports?: DappImportsConfig;
215
+ /**
216
+ * Open the modal pre-routed into a dapp-import provider, skipping the
217
+ * deposit-method home screen. Must name an enabled `dappImports` key
218
+ * (e.g. "polymarket"); disabled/unknown values are a no-op. While the
219
+ * provider's balances are checked the modal shows a loading skeleton;
220
+ * if the flow turns out to be unreachable (no account, no balance, no
221
+ * wallet) it falls back to the home screen.
222
+ */
223
+ initialDappImport?: keyof DappImportsConfig;
224
+ /** Show fiat on-ramp option(s) that embed Swapped's iframe. Default: false. */
225
+ enableFiatOnramp?: boolean;
226
+ /** Show the Transfer Crypto / QR row. Default: true. */
227
+ enableQrTransfer?: boolean;
228
+ /**
229
+ * One row per Swapped payment method (Pay with Card / Apple Pay / Bank
230
+ * Transfer). When set, replaces the generic "Pay with Card" row.
231
+ */
232
+ fiatOnrampMethods?: FiatPaymentMethodOption[];
233
+ /**
234
+ * Show a "Fund from Exchange" row that opens Swapped Connect — the user
235
+ * picks their CEX (Coinbase, Binance, Kraken…) or wallet inside the iframe
236
+ * and Swapped pulls the crypto on-chain to the smart account. Default: false.
237
+ */
238
+ enableExchangeConnect?: boolean;
201
239
  onRequestConnect?: () => void;
202
240
  theme?: DepositModalTheme;
203
241
  uiConfig?: DepositModalUIConfig;
@@ -231,7 +269,6 @@ interface WithdrawModalProps {
231
269
  signerAddress?: Address;
232
270
  sessionChainIds?: number[];
233
271
  forceRegister?: boolean;
234
- waitForFinalTx?: boolean;
235
272
  reownAppId?: string;
236
273
  onSignTransaction?: (request: SafeTransactionRequest) => Promise<{
237
274
  signature: Hex;
@@ -276,14 +313,40 @@ type DepositLifecycleEvent = {
276
313
  type: "submitted";
277
314
  txHash: string;
278
315
  sourceChain: ChainId | "unknown";
316
+ /** Source-token base units (e.g. "1100000" for 1.10 USDC). */
279
317
  amount: string;
318
+ /**
319
+ * Decimals of the source token, for converting `amount` to a
320
+ * human-readable value. Omitted when the token is not recognised
321
+ * (e.g. a QR deposit of an unlisted token).
322
+ */
323
+ sourceDecimals?: number;
324
+ /**
325
+ * USD equivalent of the deposit as entered in the modal (token units
326
+ * for unpriced non-stablecoins). Omitted for flows without an amount
327
+ * input (QR transfer, fiat onramp, exchange connect).
328
+ */
329
+ amountUsd?: string;
280
330
  } | {
281
331
  type: "complete";
282
332
  txHash: string;
283
333
  destinationTxHash?: string;
334
+ /** Source-token base units (e.g. "1100000" for 1.10 USDC). */
284
335
  amount: string;
285
336
  sourceChain: ChainId | "unknown";
286
337
  sourceToken?: string;
338
+ /**
339
+ * Decimals of the source token, for converting `amount` to a
340
+ * human-readable value. Omitted when the token is not recognised
341
+ * (e.g. a QR deposit of an unlisted token).
342
+ */
343
+ sourceDecimals?: number;
344
+ /**
345
+ * USD equivalent of the deposit as entered in the modal (token units
346
+ * for unpriced non-stablecoins). Omitted for flows without an amount
347
+ * input (QR transfer, fiat onramp, exchange connect).
348
+ */
349
+ amountUsd?: string;
287
350
  targetChain: number | "solana";
288
351
  targetToken: string;
289
352
  } | {
@@ -153,6 +153,21 @@ interface RouteConfig {
153
153
  sourceChains?: number[];
154
154
  sourceTokens?: string[];
155
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
+ }
156
171
  interface DepositModalProps {
157
172
  dappWalletClient?: WalletClient | null;
158
173
  dappPublicClient?: PublicClient | null;
@@ -188,7 +203,6 @@ interface DepositModalProps {
188
203
  signerAddress?: Address;
189
204
  sessionChainIds?: number[];
190
205
  forceRegister?: boolean;
191
- waitForFinalTx?: boolean;
192
206
  reownAppId?: string;
193
207
  enableSolana?: boolean;
194
208
  /**
@@ -198,6 +212,30 @@ interface DepositModalProps {
198
212
  * entry screen.
199
213
  */
200
214
  dappImports?: DappImportsConfig;
215
+ /**
216
+ * Open the modal pre-routed into a dapp-import provider, skipping the
217
+ * deposit-method home screen. Must name an enabled `dappImports` key
218
+ * (e.g. "polymarket"); disabled/unknown values are a no-op. While the
219
+ * provider's balances are checked the modal shows a loading skeleton;
220
+ * if the flow turns out to be unreachable (no account, no balance, no
221
+ * wallet) it falls back to the home screen.
222
+ */
223
+ initialDappImport?: keyof DappImportsConfig;
224
+ /** Show fiat on-ramp option(s) that embed Swapped's iframe. Default: false. */
225
+ enableFiatOnramp?: boolean;
226
+ /** Show the Transfer Crypto / QR row. Default: true. */
227
+ enableQrTransfer?: boolean;
228
+ /**
229
+ * One row per Swapped payment method (Pay with Card / Apple Pay / Bank
230
+ * Transfer). When set, replaces the generic "Pay with Card" row.
231
+ */
232
+ fiatOnrampMethods?: FiatPaymentMethodOption[];
233
+ /**
234
+ * Show a "Fund from Exchange" row that opens Swapped Connect — the user
235
+ * picks their CEX (Coinbase, Binance, Kraken…) or wallet inside the iframe
236
+ * and Swapped pulls the crypto on-chain to the smart account. Default: false.
237
+ */
238
+ enableExchangeConnect?: boolean;
201
239
  onRequestConnect?: () => void;
202
240
  theme?: DepositModalTheme;
203
241
  uiConfig?: DepositModalUIConfig;
@@ -231,7 +269,6 @@ interface WithdrawModalProps {
231
269
  signerAddress?: Address;
232
270
  sessionChainIds?: number[];
233
271
  forceRegister?: boolean;
234
- waitForFinalTx?: boolean;
235
272
  reownAppId?: string;
236
273
  onSignTransaction?: (request: SafeTransactionRequest) => Promise<{
237
274
  signature: Hex;
@@ -276,14 +313,40 @@ type DepositLifecycleEvent = {
276
313
  type: "submitted";
277
314
  txHash: string;
278
315
  sourceChain: ChainId | "unknown";
316
+ /** Source-token base units (e.g. "1100000" for 1.10 USDC). */
279
317
  amount: string;
318
+ /**
319
+ * Decimals of the source token, for converting `amount` to a
320
+ * human-readable value. Omitted when the token is not recognised
321
+ * (e.g. a QR deposit of an unlisted token).
322
+ */
323
+ sourceDecimals?: number;
324
+ /**
325
+ * USD equivalent of the deposit as entered in the modal (token units
326
+ * for unpriced non-stablecoins). Omitted for flows without an amount
327
+ * input (QR transfer, fiat onramp, exchange connect).
328
+ */
329
+ amountUsd?: string;
280
330
  } | {
281
331
  type: "complete";
282
332
  txHash: string;
283
333
  destinationTxHash?: string;
334
+ /** Source-token base units (e.g. "1100000" for 1.10 USDC). */
284
335
  amount: string;
285
336
  sourceChain: ChainId | "unknown";
286
337
  sourceToken?: string;
338
+ /**
339
+ * Decimals of the source token, for converting `amount` to a
340
+ * human-readable value. Omitted when the token is not recognised
341
+ * (e.g. a QR deposit of an unlisted token).
342
+ */
343
+ sourceDecimals?: number;
344
+ /**
345
+ * USD equivalent of the deposit as entered in the modal (token units
346
+ * for unpriced non-stablecoins). Omitted for flows without an amount
347
+ * input (QR transfer, fiat onramp, exchange connect).
348
+ */
349
+ amountUsd?: string;
287
350
  targetChain: number | "solana";
288
351
  targetToken: string;
289
352
  } | {
package/dist/withdraw.cjs CHANGED
@@ -1,8 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkG5Q4QBWXcjs = require('./chunk-G5Q4QBWX.cjs');
4
- require('./chunk-MMXUBBGK.cjs');
5
- require('./chunk-7JIDIX27.cjs');
3
+ var _chunkLEL6GMEQcjs = require('./chunk-LEL6GMEQ.cjs');
4
+ require('./chunk-MQIJZNTP.cjs');
5
+ require('./chunk-AJHFNHG3.cjs');
6
+ require('./chunk-MILJQWPT.cjs');
6
7
 
7
8
 
8
- exports.WithdrawModal = _chunkG5Q4QBWXcjs.WithdrawModal;
9
+ exports.WithdrawModal = _chunkLEL6GMEQcjs.WithdrawModal;
@@ -1,9 +1,9 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { n as WithdrawModalProps } from './types-D8Q4TMk7.cjs';
3
- export { A as AssetOption, a as ConnectedEventData, E as ErrorEventData, S as SafeTransactionRequest, k as WithdrawCompleteEventData, l as WithdrawFailedEventData, o as WithdrawSubmittedEventData } from './types-D8Q4TMk7.cjs';
1
+ import * as react from 'react';
2
+ import { n as WithdrawModalProps } from './types-RzfAD14B.cjs';
3
+ export { A as AssetOption, a as ConnectedEventData, E as ErrorEventData, S as SafeTransactionRequest, k as WithdrawCompleteEventData, l as WithdrawFailedEventData, o as WithdrawSubmittedEventData } from './types-RzfAD14B.cjs';
4
4
  import 'viem';
5
5
 
6
- declare function WithdrawModal(props: WithdrawModalProps): react_jsx_runtime.JSX.Element;
6
+ declare function WithdrawModal(props: WithdrawModalProps): react.JSX.Element;
7
7
  declare namespace WithdrawModal {
8
8
  var displayName: string;
9
9
  }
@@ -1,9 +1,9 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { n as WithdrawModalProps } from './types-D8Q4TMk7.js';
3
- export { A as AssetOption, a as ConnectedEventData, E as ErrorEventData, S as SafeTransactionRequest, k as WithdrawCompleteEventData, l as WithdrawFailedEventData, o as WithdrawSubmittedEventData } from './types-D8Q4TMk7.js';
1
+ import * as react from 'react';
2
+ import { n as WithdrawModalProps } from './types-RzfAD14B.js';
3
+ export { A as AssetOption, a as ConnectedEventData, E as ErrorEventData, S as SafeTransactionRequest, k as WithdrawCompleteEventData, l as WithdrawFailedEventData, o as WithdrawSubmittedEventData } from './types-RzfAD14B.js';
4
4
  import 'viem';
5
5
 
6
- declare function WithdrawModal(props: WithdrawModalProps): react_jsx_runtime.JSX.Element;
6
+ declare function WithdrawModal(props: WithdrawModalProps): react.JSX.Element;
7
7
  declare namespace WithdrawModal {
8
8
  var displayName: string;
9
9
  }
package/dist/withdraw.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  WithdrawModal
3
- } from "./chunk-KE4MRCFN.mjs";
4
- import "./chunk-TJG2AFPS.mjs";
5
- import "./chunk-SZIYS42B.mjs";
3
+ } from "./chunk-DZQD3DAV.mjs";
4
+ import "./chunk-3C35DVPE.mjs";
5
+ import "./chunk-TQ2AYMWS.mjs";
6
+ import "./chunk-6YRDD462.mjs";
6
7
  export {
7
8
  WithdrawModal
8
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhinestone/deposit-modal",
3
- "version": "0.3.0-alpha.9",
3
+ "version": "0.3.1",
4
4
  "description": "React modal component for Rhinestone cross-chain deposits",
5
5
  "author": "Rhinestone <dev@rhinestone.wtf>",
6
6
  "bugs": {
@@ -12,24 +12,49 @@
12
12
  "types": "./dist/index.d.ts",
13
13
  "exports": {
14
14
  ".": {
15
- "types": "./dist/index.d.ts",
16
- "import": "./dist/index.mjs",
17
- "require": "./dist/index.cjs"
15
+ "import": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.mjs"
18
+ },
19
+ "require": {
20
+ "types": "./dist/index.d.cts",
21
+ "default": "./dist/index.cjs"
22
+ }
18
23
  },
19
24
  "./deposit": {
20
- "types": "./dist/deposit.d.ts",
21
- "import": "./dist/deposit.mjs",
22
- "require": "./dist/deposit.cjs"
25
+ "import": {
26
+ "types": "./dist/deposit.d.ts",
27
+ "default": "./dist/deposit.mjs"
28
+ },
29
+ "require": {
30
+ "types": "./dist/deposit.d.cts",
31
+ "default": "./dist/deposit.cjs"
32
+ }
23
33
  },
24
34
  "./withdraw": {
25
- "types": "./dist/withdraw.d.ts",
26
- "import": "./dist/withdraw.mjs",
27
- "require": "./dist/withdraw.cjs"
35
+ "import": {
36
+ "types": "./dist/withdraw.d.ts",
37
+ "default": "./dist/withdraw.mjs"
38
+ },
39
+ "require": {
40
+ "types": "./dist/withdraw.d.cts",
41
+ "default": "./dist/withdraw.cjs"
42
+ }
28
43
  },
29
44
  "./constants": {
30
- "types": "./dist/constants.d.ts",
31
- "import": "./dist/constants.mjs",
32
- "require": "./dist/constants.cjs"
45
+ "import": {
46
+ "types": "./dist/constants.d.ts",
47
+ "default": "./dist/constants.mjs"
48
+ },
49
+ "require": {
50
+ "types": "./dist/constants.d.cts",
51
+ "default": "./dist/constants.cjs"
52
+ }
53
+ },
54
+ "./polymarket": {
55
+ "types": "./dist/polymarket.d.ts",
56
+ "import": "./dist/polymarket.mjs",
57
+ "require": "./dist/polymarket.cjs"
33
58
  },
34
59
  "./styles.css": {
35
60
  "types": "./dist/styles.d.ts",
@@ -51,7 +76,10 @@
51
76
  "test": "vitest run",
52
77
  "test:watch": "vitest",
53
78
  "test:coverage": "vitest run --coverage",
54
- "prepublishOnly": "bun run clean && bun run build && bun run typecheck"
79
+ "prepublishOnly": "bun run clean && bun run build && bun run typecheck",
80
+ "changeset": "changeset",
81
+ "changeset:version": "changeset version",
82
+ "changeset:release": "bun run build && changeset publish"
55
83
  },
56
84
  "peerDependencies": {
57
85
  "react": ">=18",
@@ -82,6 +110,7 @@
82
110
  "zustand": "^5"
83
111
  },
84
112
  "devDependencies": {
113
+ "@changesets/cli": "^2.28.1",
85
114
  "@reown/appkit": "1.8.20",
86
115
  "@reown/appkit-adapter-solana": "1.8.20",
87
116
  "@reown/appkit-adapter-wagmi": "1.8.20",
@@ -110,7 +139,7 @@
110
139
  {
111
140
  "name": "Total Bundle (Everything)",
112
141
  "path": "dist/index.mjs",
113
- "limit": "52 kB",
142
+ "limit": "65 kB",
114
143
  "ignore": [
115
144
  "react",
116
145
  "react-dom",
@@ -130,7 +159,7 @@
130
159
  "name": "Deposit & Withdraw Modals Only",
131
160
  "path": "dist/index.mjs",
132
161
  "import": "{ DepositModal, WithdrawModal }",
133
- "limit": "52 kB",
162
+ "limit": "64 kB",
134
163
  "ignore": [
135
164
  "react",
136
165
  "react-dom",
@@ -145,6 +174,14 @@
145
174
  "porto",
146
175
  "porto/internal"
147
176
  ]
177
+ },
178
+ {
179
+ "name": "Headless Polymarket Account",
180
+ "path": "dist/polymarket.mjs",
181
+ "limit": "3 kB",
182
+ "ignore": [
183
+ "viem"
184
+ ]
148
185
  }
149
186
  ],
150
187
  "keywords": [
@@ -158,9 +195,9 @@
158
195
  ],
159
196
  "repository": {
160
197
  "type": "git",
161
- "url": "https://github.com/rhinestonewtf/deposit-modal"
198
+ "url": "git+https://github.com/rhinestonewtf/deposit-modal.git"
162
199
  },
163
200
  "overrides": {
164
201
  "@reown/appkit-common": "1.8.20"
165
202
  }
166
- }
203
+ }