@rhinestone/deposit-modal 0.15.0 → 0.16.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 (52) hide show
  1. package/README.md +22 -26
  2. package/dist/{DepositModalReown-R37SSHUF.cjs → DepositModalReown-IFN6YLZJ.cjs} +16 -17
  3. package/dist/{DepositModalReown-KOJ7VEY7.mjs → DepositModalReown-R7UROJPJ.mjs} +3 -4
  4. package/dist/WithdrawModal-SZEAI473.cjs +11 -0
  5. package/dist/{WithdrawModal-QVXHMH43.mjs → WithdrawModal-XKSSHVEJ.mjs} +3 -4
  6. package/dist/{chunk-DTVZUBHI.cjs → chunk-24N4KMJX.cjs} +71 -73
  7. package/dist/{chunk-CXBMIZUF.mjs → chunk-3HCCR54R.mjs} +1 -1
  8. package/dist/{chunk-5P2PVLS4.cjs → chunk-5CM3ZQ5U.cjs} +1 -1
  9. package/dist/{chunk-5VONFVQN.mjs → chunk-EA5CE2UZ.mjs} +3944 -864
  10. package/dist/{chunk-IKUYZA7A.mjs → chunk-F6ROQ6RJ.mjs} +28 -30
  11. package/dist/{chunk-3OOY67VJ.cjs → chunk-H4O22O7Y.cjs} +4930 -1850
  12. package/dist/{chunk-7UQ6OUEE.mjs → chunk-HMB2XQGD.mjs} +13 -15
  13. package/dist/{chunk-VPDCGD2D.cjs → chunk-V466XQSG.cjs} +260 -262
  14. package/dist/constants.cjs +2 -2
  15. package/dist/constants.d.cts +1 -1
  16. package/dist/constants.d.ts +1 -1
  17. package/dist/constants.mjs +1 -1
  18. package/dist/deposit.cjs +4 -5
  19. package/dist/deposit.d.cts +2 -2
  20. package/dist/deposit.d.ts +2 -2
  21. package/dist/deposit.mjs +3 -4
  22. package/dist/embed.cjs +18 -59
  23. package/dist/embed.d.cts +2 -8
  24. package/dist/embed.d.ts +2 -8
  25. package/dist/embed.mjs +9 -50
  26. package/dist/index.cjs +5 -10
  27. package/dist/index.d.cts +1 -3
  28. package/dist/index.d.ts +1 -3
  29. package/dist/index.mjs +4 -9
  30. package/dist/server.d.cts +2 -2
  31. package/dist/server.d.ts +2 -2
  32. package/dist/styles.css +15 -0
  33. package/dist/{types-CQ0NHqCy.d.ts → types-B9SbZQIG.d.ts} +15 -113
  34. package/dist/{types-CxiLX5sv.d.cts → types-SwGGf0eH.d.cts} +15 -113
  35. package/dist/withdraw.cjs +4 -5
  36. package/dist/withdraw.d.cts +31 -3
  37. package/dist/withdraw.d.ts +31 -3
  38. package/dist/withdraw.mjs +3 -4
  39. package/package.json +4 -35
  40. package/dist/ClaimModal-GFDBVCN5.cjs +0 -11
  41. package/dist/ClaimModal-VQS3AKEL.mjs +0 -11
  42. package/dist/WithdrawModal-RY2NMFLE.cjs +0 -12
  43. package/dist/chunk-6HUHVXCY.cjs +0 -704
  44. package/dist/chunk-QJ7RCCU7.mjs +0 -704
  45. package/dist/chunk-UCBUCX2W.mjs +0 -3169
  46. package/dist/chunk-X4D52IZK.cjs +0 -3169
  47. package/dist/claim.cjs +0 -9
  48. package/dist/claim.d.cts +0 -17
  49. package/dist/claim.d.ts +0 -17
  50. package/dist/claim.mjs +0 -9
  51. package/dist/modal-ui-state-OD1RmKkK.d.cts +0 -30
  52. package/dist/modal-ui-state-OD1RmKkK.d.ts +0 -30
package/README.md CHANGED
@@ -5,7 +5,6 @@ React modal for cross-chain deposits and withdrawals via Rhinestone smart accoun
5
5
  **[Documentation](https://docs.rhinestone.dev/deposits/widget/quickstart)** ·
6
6
  [Deposit modal](https://docs.rhinestone.dev/deposits/widget/deposit-modal) ·
7
7
  [Withdraw modal](https://docs.rhinestone.dev/deposits/widget/withdraw-modal) ·
8
- [Claim modal](https://docs.rhinestone.dev/deposits/widget/claim-modal) ·
9
8
  [Backend proxy](https://docs.rhinestone.dev/deposits/widget/backend) ·
10
9
  [Migration guide](https://docs.rhinestone.dev/deposits/widget/migration)
11
10
 
@@ -149,33 +148,27 @@ Once the form holds a valid recipient, the header offers that **destination's**
149
148
 
150
149
  Pass the optional `signRecovery` to let the user recover a failed row from the panel; omit it and the panel is read-only. The signer is the address the user is withdrawing **to**, so only supply it if your users can sign for their withdrawal destinations.
151
150
 
152
- ## Claim a failed deposit
151
+ ## Recovering a failed deposit
153
152
 
154
- `ClaimModal` lets a user get a failed or rejected EVM deposit sent back to them on its source chain. They paste the deposit's transaction hash and name a destination, and there is no chain to pick: the hash is looked up across every chain, including ones the deposit flow itself doesn't list.
153
+ A failed or rejected EVM deposit can be sent back to the user on its source
154
+ chain, and **deposit history is the only surface that offers it**. In the
155
+ deposit modal a failed row expands to a Recover action; in the withdraw modal
156
+ the same panel does, for the destination being withdrawn to. A deposit history
157
+ never lists at all — a spam-flagged one, say — is reachable through the panel's
158
+ "deposit not listed" transaction-hash lookup.
155
159
 
156
- **The modal never runs a connect step** — it has no wallet UI and asks for no provider. It does need a signature from the deposit's `recipient`, which it requests through `signRecovery` using whatever wallet your app already holds for that user. For an embedded wallet that is headless and the user sees nothing but the confirmation your own SDK shows.
157
-
158
- ```tsx
159
- import { ClaimModal } from "@rhinestone/deposit-modal/claim";
160
-
161
- <ClaimModal
162
- isOpen={claimOpen}
163
- onClose={() => setClaimOpen(false)}
164
- signRecovery={({ typedData }) => wallet.signTypedData(typedData)}
165
- backendUrl={process.env.NEXT_PUBLIC_DEPOSIT_PROXY_URL}
166
- // Optional prefills:
167
- defaultTxHash={depositTxHash}
168
- defaultRefundDestination={knownSelfCustodialAddress}
169
- onLifecycle={(event) => console.log(event)}
170
- />;
171
- ```
160
+ Both modals gate the action on the optional `signRecovery` prop: pass it and a
161
+ failed row offers recovery, omit it and the panel is read-only. There is no
162
+ standalone modal to mount ([removed in 0.16.0](./MIGRATION.md)).
172
163
 
173
164
  ### Why the user signs
174
165
 
175
166
  Deposit accounts are owned by the Rhinestone service, so the account holding the
176
167
  funds has no user key and cannot sign for its own refund. But the deposit's
177
168
  `recipient` — the in-app wallet the funds were headed to — _is_ a key your user
178
- holds. So that is what authorizes the recovery.
169
+ holds. So that is what authorizes the recovery. In the withdraw modal the signer
170
+ is therefore the address the user is withdrawing **to**, so only supply
171
+ `signRecovery` if your users can sign for their withdrawal destinations.
179
172
 
180
173
  `signRecovery` is handed the exact typed data to sign plus the `signer` address the
181
174
  processor will verify against, and returns a signature. Return whatever that
@@ -199,17 +192,17 @@ signature, so there is no privilege for a page to borrow.
199
192
  **Your proxy must forward `POST /deposits/recover`**, alongside the `GET /deposits`
200
193
  used for the lookup. Both are in the
201
194
  [reference proxy](https://docs.rhinestone.dev/deposits/widget/backend); a proxy
202
- missing the recover route 404s the claim rather than degrading.
195
+ missing the recover route 404s the recovery rather than degrading.
203
196
 
204
197
  Two properties fall out of signing that are worth knowing:
205
198
 
206
199
  - **The destination is inside the signed struct.** The processor cannot pay anywhere
207
200
  else, so the success screen states what the user signed rather than trusting the
208
- endpoint to report where the money went. `defaultRefundDestination` only _seeds_
209
- the field; whatever the user submits is what they sign.
201
+ endpoint to report where the money went. Whatever the user submits is what they
202
+ sign.
210
203
  - **Failures carry a structured code**, so the modal knows when a retry helps. A
211
204
  verification outage is retryable; a rejected signature or a deposit already
212
- claimed is not. HTTP status alone can't separate those.
205
+ recovered is not. HTTP status alone can't separate those.
213
206
 
214
207
  ### If your users can't sign
215
208
 
@@ -233,7 +226,7 @@ export const POST = createRefundHandler({
233
226
  });
234
227
  ```
235
228
 
236
- The modal does not drive this path — you'd build that UI yourself, or route the user
229
+ No modal drives this path — you'd build that UI yourself, or route the user
237
230
  to support. Do **not** proxy `POST /deposits/refund`: unlike recover it carries no
238
231
  proof of who is asking, so forwarding it with your API key attached would let anyone
239
232
  return any of your recoverable deposits to an address they chose.
@@ -309,7 +302,7 @@ Flow: user picks Fund from Exchange → backend returns supported exchanges + lo
309
302
 
310
303
  ## Analytics
311
304
 
312
- `onEvent` receives the deposit, withdraw and claim funnels as a session-scoped
305
+ `onEvent` receives the deposit, withdraw and recovery funnels as a session-scoped
313
306
  stream:
314
307
  every event carries the session id, the modal, the widget version and a snapshot
315
308
  of the session's configuration.
@@ -334,6 +327,9 @@ far.
334
327
 
335
328
  ## Upgrading
336
329
 
330
+ 0.16.0 removes the standalone claim modal, including the `./claim` subpath and
331
+ the embed page's claim mode. Recovery is reached from deposit history instead.
332
+
337
333
  Upgrading from 0.13.x changes what `onEvent` delivers: the deposit events are
338
334
  replaced by a method-aware taxonomy, the five flat claim events are replaced by
339
335
  a claim funnel, and every event gains a session envelope. A claim-only
@@ -1,8 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkVPDCGD2Dcjs = require('./chunk-VPDCGD2D.cjs');
5
- require('./chunk-X4D52IZK.cjs');
4
+ var _chunkV466XQSGcjs = require('./chunk-V466XQSG.cjs');
6
5
 
7
6
 
8
7
 
@@ -11,8 +10,8 @@ require('./chunk-X4D52IZK.cjs');
11
10
 
12
11
 
13
12
 
14
- var _chunk3OOY67VJcjs = require('./chunk-3OOY67VJ.cjs');
15
- require('./chunk-5P2PVLS4.cjs');
13
+ var _chunkH4O22O7Ycjs = require('./chunk-H4O22O7Y.cjs');
14
+ require('./chunk-5CM3ZQ5U.cjs');
16
15
  require('./chunk-LVCD6RHF.cjs');
17
16
 
18
17
 
@@ -45,7 +44,7 @@ var {
45
44
  unichain,
46
45
  katana,
47
46
  hyperEvm
48
- } = _chunkVPDCGD2Dcjs.getReownDependencies.call(void 0, )[1];
47
+ } = _chunkV466XQSGcjs.getReownDependencies.call(void 0, )[1];
49
48
  var APPKIT_NETWORK_BY_ID = {
50
49
  [mainnet.id]: mainnet,
51
50
  [optimism.id]: optimism,
@@ -77,7 +76,7 @@ function getAppKitNetwork(chainId) {
77
76
 
78
77
  // src/core/reown-theme.ts
79
78
  function mapTheme(theme) {
80
- const themeMode = _chunk3OOY67VJcjs.resolveThemeMode.call(void 0, _optionalChain([theme, 'optionalAccess', _ => _.mode])) === "light" ? "light" : "dark";
79
+ const themeMode = _chunkH4O22O7Ycjs.resolveThemeMode.call(void 0, _optionalChain([theme, 'optionalAccess', _ => _.mode])) === "light" ? "light" : "dark";
81
80
  const themeVariables = {
82
81
  "--apkt-accent": _optionalChain([theme, 'optionalAccess', _2 => _2.ctaColor])
83
82
  };
@@ -94,7 +93,7 @@ function setAppKitTheme(appKit, theme) {
94
93
 
95
94
  // src/core/reown.tsx
96
95
  var _jsxruntime = require('react/jsx-runtime');
97
- var [appKitReact, appKitNetworks, wagmiAdapter, solanaAdapter] = _chunkVPDCGD2Dcjs.getReownDependencies.call(void 0, );
96
+ var [appKitReact, appKitNetworks, wagmiAdapter, solanaAdapter] = _chunkV466XQSGcjs.getReownDependencies.call(void 0, );
98
97
  var {
99
98
  createAppKit,
100
99
  useAppKit,
@@ -110,14 +109,14 @@ function buildTransports(rpcUrls, networks = EVM_NETWORKS) {
110
109
  const transports = {};
111
110
  for (const network of networks) {
112
111
  const id = Number(network.id);
113
- transports[id] = _viem.http.call(void 0, _chunk3OOY67VJcjs.rpcUrlFor.call(void 0, rpcUrls, id));
112
+ transports[id] = _viem.http.call(void 0, _chunkH4O22O7Ycjs.rpcUrlFor.call(void 0, rpcUrls, id));
114
113
  }
115
114
  return transports;
116
115
  }
117
116
  function getEvmRpcFingerprint(rpcUrls, networks) {
118
117
  return networks.map((network) => {
119
118
  const id = Number(network.id);
120
- return `${id}=${_nullishCoalesce(_chunk3OOY67VJcjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
119
+ return `${id}=${_nullishCoalesce(_chunkH4O22O7Ycjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
121
120
  }).join("|");
122
121
  }
123
122
  var cachedAdapter = null;
@@ -188,7 +187,7 @@ function ReownWalletProvider({
188
187
  backendUrl,
189
188
  children
190
189
  }) {
191
- const rpcUrls = _chunk3OOY67VJcjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
190
+ const rpcUrls = _chunkH4O22O7Ycjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
192
191
  const [queryClient] = _react.useState.call(void 0, () => new (0, _reactquery.QueryClient)());
193
192
  const overrides = _react.useMemo.call(void 0, () => {
194
193
  if (!rpcUrls) return void 0;
@@ -200,14 +199,14 @@ function ReownWalletProvider({
200
199
  return out;
201
200
  }, [rpcUrls]);
202
201
  const [state, setState] = _react.useState.call(void 0, () => {
203
- const primed = _chunk3OOY67VJcjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
202
+ const primed = _chunkH4O22O7Ycjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
204
203
  return { ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) };
205
204
  });
206
205
  _react.useEffect.call(void 0, () => {
207
206
  let active = true;
208
- const primed = _chunk3OOY67VJcjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
207
+ const primed = _chunkH4O22O7Ycjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
209
208
  setState({ ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) });
210
- _chunk3OOY67VJcjs.primeRuntimeChains.call(void 0, backendUrl, overrides).then((chains) => {
209
+ _chunkH4O22O7Ycjs.primeRuntimeChains.call(void 0, backendUrl, overrides).then((chains) => {
211
210
  if (active) setState({ ready: true, chains });
212
211
  });
213
212
  return () => {
@@ -216,7 +215,7 @@ function ReownWalletProvider({
216
215
  }, [backendUrl, overrides]);
217
216
  _react.useEffect.call(void 0, () => {
218
217
  setAppKitTheme(appKitReact.modal, theme);
219
- return _chunk3OOY67VJcjs.followSystemAppearance.call(void 0,
218
+ return _chunkH4O22O7Ycjs.followSystemAppearance.call(void 0,
220
219
  _optionalChain([theme, 'optionalAccess', _7 => _7.mode]),
221
220
  () => setAppKitTheme(appKitReact.modal, theme)
222
221
  );
@@ -280,7 +279,7 @@ function useReownWalletSession() {
280
279
  await switchChainAsync({ chainId });
281
280
  }
282
281
  } catch (err) {
283
- if (_chunk3OOY67VJcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
282
+ if (_chunkH4O22O7Ycjs.isUnsupportedChainSwitchError.call(void 0, err)) {
284
283
  throw new Error(
285
284
  `Switch to ${chainDisplayName(chainId)} in your wallet to continue`
286
285
  );
@@ -293,7 +292,7 @@ function useReownWalletSession() {
293
292
 
294
293
  // src/DepositModalReown.tsx
295
294
 
296
- var [appKitReact2, , , , solanaAdapterReact] = _chunkVPDCGD2Dcjs.getReownDependencies.call(void 0, );
295
+ var [appKitReact2, , , , solanaAdapterReact] = _chunkV466XQSGcjs.getReownDependencies.call(void 0, );
297
296
  var { useAppKitProvider } = appKitReact2;
298
297
  var { useAppKitConnection } = solanaAdapterReact;
299
298
  function DepositModalWithReown(props) {
@@ -315,7 +314,7 @@ function DepositModalWithReown(props) {
315
314
  reown.disconnect();
316
315
  }, [reown.disconnect]);
317
316
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
318
- _chunkVPDCGD2Dcjs.DepositModalInner,
317
+ _chunkV466XQSGcjs.DepositModalInner,
319
318
  {
320
319
  ...props,
321
320
  walletSession: reownWithSolana,
@@ -1,8 +1,7 @@
1
1
  import {
2
2
  DepositModalInner,
3
3
  getReownDependencies
4
- } from "./chunk-IKUYZA7A.mjs";
5
- import "./chunk-UCBUCX2W.mjs";
4
+ } from "./chunk-F6ROQ6RJ.mjs";
6
5
  import {
7
6
  followSystemAppearance,
8
7
  isUnsupportedChainSwitchError,
@@ -11,8 +10,8 @@ import {
11
10
  resolveThemeMode,
12
11
  rpcUrlFor,
13
12
  useStableRpcUrls
14
- } from "./chunk-5VONFVQN.mjs";
15
- import "./chunk-CXBMIZUF.mjs";
13
+ } from "./chunk-EA5CE2UZ.mjs";
14
+ import "./chunk-3HCCR54R.mjs";
16
15
  import "./chunk-FTWKAJGN.mjs";
17
16
  import {
18
17
  SUPPORTED_CHAIN_IDS,
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunk24N4KMJXcjs = require('./chunk-24N4KMJX.cjs');
5
+ require('./chunk-H4O22O7Y.cjs');
6
+ require('./chunk-5CM3ZQ5U.cjs');
7
+ require('./chunk-OY5N3E6L.cjs');
8
+
9
+
10
+
11
+ exports.WithdrawModal = _chunk24N4KMJXcjs.WithdrawModal; exports.buildWithdrawAnalyticsSessionProperties = _chunk24N4KMJXcjs.buildWithdrawAnalyticsSessionProperties;
@@ -1,10 +1,9 @@
1
1
  import {
2
2
  WithdrawModal,
3
3
  buildWithdrawAnalyticsSessionProperties
4
- } from "./chunk-7UQ6OUEE.mjs";
5
- import "./chunk-UCBUCX2W.mjs";
6
- import "./chunk-5VONFVQN.mjs";
7
- import "./chunk-CXBMIZUF.mjs";
4
+ } from "./chunk-HMB2XQGD.mjs";
5
+ import "./chunk-EA5CE2UZ.mjs";
6
+ import "./chunk-3HCCR54R.mjs";
8
7
  import "./chunk-EAGMY3QE.mjs";
9
8
  export {
10
9
  WithdrawModal,