@rhinestone/deposit-modal 0.17.0 → 0.18.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 (61) hide show
  1. package/README.md +68 -0
  2. package/dist/{DepositModalReown-6CXXGQ7X.cjs → DepositModalReown-TVO3ZQQK.cjs} +17 -17
  3. package/dist/{DepositModalReown-ELDSTIME.mjs → DepositModalReown-VCY65DJX.mjs} +4 -4
  4. package/dist/WithdrawModal-GR3HLYXU.cjs +11 -0
  5. package/dist/{WithdrawModal-QRMDR5T4.mjs → WithdrawModal-RMCYJJ4S.mjs} +3 -3
  6. package/dist/bearer-transport-CVHNBgoV.d.cts +14 -0
  7. package/dist/bearer-transport-CVHNBgoV.d.ts +14 -0
  8. package/dist/{chunk-2W4BJ5I3.cjs → chunk-34JVJZEZ.cjs} +71 -71
  9. package/dist/{chunk-XCBDJPBD.mjs → chunk-3TEVMP76.mjs} +1 -1
  10. package/dist/chunk-ADEWTBSN.cjs +19 -0
  11. package/dist/{chunk-QMGEK623.mjs → chunk-AIZKGFVA.mjs} +468 -207
  12. package/dist/{chunk-H66WM5AO.mjs → chunk-EKC2IRQG.mjs} +180 -67
  13. package/dist/{chunk-XJMDCBHS.cjs → chunk-JV5OGG53.cjs} +629 -516
  14. package/dist/{chunk-QGNJFDEO.cjs → chunk-N3AAT6BS.cjs} +623 -362
  15. package/dist/{chunk-JCWJ6HW7.cjs → chunk-N6JJG57R.cjs} +1 -1
  16. package/dist/chunk-O4JZKKCZ.cjs +41 -0
  17. package/dist/chunk-PP4QE32S.mjs +19 -0
  18. package/dist/{chunk-ZHX4QROC.mjs → chunk-R2B6VD4E.mjs} +1 -1
  19. package/dist/chunk-X4EUXBHJ.mjs +41 -0
  20. package/dist/compliance.cjs +14 -0
  21. package/dist/compliance.d.cts +10 -0
  22. package/dist/compliance.d.ts +10 -0
  23. package/dist/compliance.mjs +14 -0
  24. package/dist/constants.cjs +3 -3
  25. package/dist/constants.d.cts +1 -1
  26. package/dist/constants.d.ts +1 -1
  27. package/dist/constants.mjs +3 -3
  28. package/dist/deposit.cjs +4 -4
  29. package/dist/deposit.d.cts +2 -2
  30. package/dist/deposit.d.ts +2 -2
  31. package/dist/deposit.mjs +3 -3
  32. package/dist/embed.cjs +16 -16
  33. package/dist/embed.d.cts +1 -1
  34. package/dist/embed.d.ts +1 -1
  35. package/dist/embed.mjs +8 -8
  36. package/dist/index.cjs +5 -5
  37. package/dist/index.d.cts +1 -1
  38. package/dist/index.d.ts +1 -1
  39. package/dist/index.mjs +4 -4
  40. package/dist/offramp.cjs +25 -0
  41. package/dist/offramp.d.cts +28 -0
  42. package/dist/offramp.d.ts +28 -0
  43. package/dist/offramp.mjs +25 -0
  44. package/dist/onramp.cjs +27 -0
  45. package/dist/onramp.d.cts +37 -0
  46. package/dist/onramp.d.ts +37 -0
  47. package/dist/onramp.mjs +27 -0
  48. package/dist/ramp-types-C6aUz4SZ.d.cts +43 -0
  49. package/dist/ramp-types-C6aUz4SZ.d.ts +43 -0
  50. package/dist/server.cjs +54 -2
  51. package/dist/server.d.cts +13 -1
  52. package/dist/server.d.ts +13 -1
  53. package/dist/server.mjs +52 -0
  54. package/dist/{types-B9SbZQIG.d.ts → types-CZYypODQ.d.ts} +3 -2
  55. package/dist/{types-SwGGf0eH.d.cts → types-CbUs4boj.d.cts} +3 -2
  56. package/dist/withdraw.cjs +4 -4
  57. package/dist/withdraw.d.cts +2 -2
  58. package/dist/withdraw.d.ts +2 -2
  59. package/dist/withdraw.mjs +3 -3
  60. package/package.json +35 -5
  61. package/dist/WithdrawModal-QB2U756L.cjs +0 -11
package/README.md CHANGED
@@ -347,3 +347,71 @@ Local setup, the release process and where the docs live are in
347
347
  ## License
348
348
 
349
349
  MIT
350
+
351
+ ## Onramp and offramp services
352
+
353
+ Deploy an updated `deposit-widget-proxy` before enabling these opt-in clients.
354
+ Custom proxies must allow Authorization in CORS and forward customer routes
355
+ without injecting `x-api-key`. Never proxy `POST /compliance/sessions` publicly.
356
+
357
+ On your server, import `createCustomerSessionHandler` from
358
+ `@rhinestone/deposit-modal/server`. Supply your server-held `apiKey` and an
359
+ `authorize(request)` callback that authenticates the user, enforces CSRF policy,
360
+ and returns `{ externalCustomerId, smartAccount? }` from trusted server state.
361
+ Mount its returned handler on your authenticated POST endpoint. It returns only
362
+ the 15-minute `token` and `expiresAt`, with no-store response headers.
363
+
364
+ Use separate scoped clients for onramp and offramp. The transport is internal;
365
+ the package does not expose a generic customer service or arbitrary request method.
366
+
367
+ ```ts
368
+ import { createOnrampService } from '@rhinestone/deposit-modal/onramp';
369
+ import { createOfframpService } from '@rhinestone/deposit-modal/offramp';
370
+ import { getComplianceStatus } from '@rhinestone/deposit-modal/compliance';
371
+
372
+ const options = {
373
+ backendUrl: proxyUrl,
374
+ getSession: () => authenticatedSessionClient.getCustomerSession(),
375
+ };
376
+ const onramp = createOnrampService(options);
377
+ const offramp = createOfframpService(options);
378
+ const interaction = await onramp.createSession({
379
+ purpose: 'account_setup',
380
+ country: 'DE',
381
+ currency: 'EUR',
382
+ paymentMethod: 'bank_transfer',
383
+ });
384
+ // The hosted journey handles verification through interaction.nextAction.
385
+ const status = await getComplianceStatus(options);
386
+ ```
387
+
388
+ The onramp client has `createSession`, `getSession`, `getOptions`, `listAccounts`,
389
+ `getAccount`, `listPayments` and `getPayment`. The offramp client has the same
390
+ session/options/payment methods, without accounts. `getComplianceStatus` retains
391
+ the existing `/compliance/status` read separately; it is not a preliminary step.
392
+ Shared types include `RampSession`, `RampOption` and `RampCurrency`.
393
+ `CustomerSession` remains the browser bearer/expiry pair. Catch `ScopedRequestError`
394
+ and inspect its `status` for HTTP failures; response bodies are not included.
395
+
396
+ The three lightweight subpaths replace the unpublished `/customer` entry point.
397
+ They do not import React, wallet connectors or the server-only token helper.
398
+
399
+ `getSession` is called per request. Keep tokens in memory, scoped to the logged-in
400
+ user, and refresh them through your authenticated server. The clients reject
401
+ expired sessions and never fall back to an application key. They make no calls
402
+ until explicitly invoked, so existing modals and Swapped flows remain unchanged.
403
+ There is no preliminary capability request. Support/recovery methods belong to
404
+ the future provider lifecycle implementation and are not exposed here.
405
+
406
+ The initial contracts support EUR/USD bank transfers only. Onramp hosted setup
407
+ uses `purpose: 'account_setup'` without an amount; the actual transfer determines
408
+ fiat sent. Offramp hosted beneficiary collection uses
409
+ `purpose: 'beneficiary_collection'`, separately from quoting and funding.
410
+ Offramp options use `amount` as decimal fiat major units the recipient receives.
411
+ No crypto-input quoting is exposed. Accounts return safe references/config/status,
412
+ not bank instructions. Hosted interaction completion never means payment
413
+ settlement; funding, payout and late returns have independent status fields.
414
+
415
+ The provider adapter and journey execution are not connected by this release.
416
+ Expect 503 until those implementations are deployed. Render hosted URLs only
417
+ after the journey's iframe presentation has been verified; do not log/store URLs.
@@ -1,7 +1,8 @@
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 _chunkXJMDCBHScjs = require('./chunk-XJMDCBHS.cjs');
4
+ var _chunkJV5OGG53cjs = require('./chunk-JV5OGG53.cjs');
5
+ require('./chunk-LVCD6RHF.cjs');
5
6
 
6
7
 
7
8
 
@@ -10,13 +11,12 @@ var _chunkXJMDCBHScjs = require('./chunk-XJMDCBHS.cjs');
10
11
 
11
12
 
12
13
 
13
- var _chunkQGNJFDEOcjs = require('./chunk-QGNJFDEO.cjs');
14
- require('./chunk-JCWJ6HW7.cjs');
15
- require('./chunk-LVCD6RHF.cjs');
14
+ var _chunkN3AAT6BScjs = require('./chunk-N3AAT6BS.cjs');
16
15
 
17
16
 
18
17
 
19
18
  var _chunkOY5N3E6Lcjs = require('./chunk-OY5N3E6L.cjs');
19
+ require('./chunk-N6JJG57R.cjs');
20
20
 
21
21
  // src/DepositModalReown.tsx
22
22
  var _react = require('react');
@@ -44,7 +44,7 @@ var {
44
44
  unichain,
45
45
  katana,
46
46
  hyperEvm
47
- } = _chunkXJMDCBHScjs.getReownDependencies.call(void 0, )[1];
47
+ } = _chunkJV5OGG53cjs.getReownDependencies.call(void 0, )[1];
48
48
  var APPKIT_NETWORK_BY_ID = {
49
49
  [mainnet.id]: mainnet,
50
50
  [optimism.id]: optimism,
@@ -76,7 +76,7 @@ function getAppKitNetwork(chainId) {
76
76
 
77
77
  // src/core/reown-theme.ts
78
78
  function mapTheme(theme) {
79
- const themeMode = _chunkQGNJFDEOcjs.resolveThemeMode.call(void 0, _optionalChain([theme, 'optionalAccess', _ => _.mode])) === "light" ? "light" : "dark";
79
+ const themeMode = _chunkN3AAT6BScjs.resolveThemeMode.call(void 0, _optionalChain([theme, 'optionalAccess', _ => _.mode])) === "light" ? "light" : "dark";
80
80
  const themeVariables = {
81
81
  "--apkt-accent": _optionalChain([theme, 'optionalAccess', _2 => _2.ctaColor])
82
82
  };
@@ -93,7 +93,7 @@ function setAppKitTheme(appKit, theme) {
93
93
 
94
94
  // src/core/reown.tsx
95
95
  var _jsxruntime = require('react/jsx-runtime');
96
- var [appKitReact, appKitNetworks, wagmiAdapter, solanaAdapter] = _chunkXJMDCBHScjs.getReownDependencies.call(void 0, );
96
+ var [appKitReact, appKitNetworks, wagmiAdapter, solanaAdapter] = _chunkJV5OGG53cjs.getReownDependencies.call(void 0, );
97
97
  var {
98
98
  createAppKit,
99
99
  useAppKit,
@@ -109,14 +109,14 @@ function buildTransports(rpcUrls, networks = EVM_NETWORKS) {
109
109
  const transports = {};
110
110
  for (const network of networks) {
111
111
  const id = Number(network.id);
112
- transports[id] = _viem.http.call(void 0, _chunkQGNJFDEOcjs.rpcUrlFor.call(void 0, rpcUrls, id));
112
+ transports[id] = _viem.http.call(void 0, _chunkN3AAT6BScjs.rpcUrlFor.call(void 0, rpcUrls, id));
113
113
  }
114
114
  return transports;
115
115
  }
116
116
  function getEvmRpcFingerprint(rpcUrls, networks) {
117
117
  return networks.map((network) => {
118
118
  const id = Number(network.id);
119
- return `${id}=${_nullishCoalesce(_chunkQGNJFDEOcjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
119
+ return `${id}=${_nullishCoalesce(_chunkN3AAT6BScjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
120
120
  }).join("|");
121
121
  }
122
122
  var cachedAdapter = null;
@@ -187,7 +187,7 @@ function ReownWalletProvider({
187
187
  backendUrl,
188
188
  children
189
189
  }) {
190
- const rpcUrls = _chunkQGNJFDEOcjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
190
+ const rpcUrls = _chunkN3AAT6BScjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
191
191
  const [queryClient] = _react.useState.call(void 0, () => new (0, _reactquery.QueryClient)());
192
192
  const overrides = _react.useMemo.call(void 0, () => {
193
193
  if (!rpcUrls) return void 0;
@@ -199,14 +199,14 @@ function ReownWalletProvider({
199
199
  return out;
200
200
  }, [rpcUrls]);
201
201
  const [state, setState] = _react.useState.call(void 0, () => {
202
- const primed = _chunkQGNJFDEOcjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
202
+ const primed = _chunkN3AAT6BScjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
203
203
  return { ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) };
204
204
  });
205
205
  _react.useEffect.call(void 0, () => {
206
206
  let active = true;
207
- const primed = _chunkQGNJFDEOcjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
207
+ const primed = _chunkN3AAT6BScjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
208
208
  setState({ ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) });
209
- _chunkQGNJFDEOcjs.primeRuntimeChains.call(void 0, backendUrl, overrides).then((chains) => {
209
+ _chunkN3AAT6BScjs.primeRuntimeChains.call(void 0, backendUrl, overrides).then((chains) => {
210
210
  if (active) setState({ ready: true, chains });
211
211
  });
212
212
  return () => {
@@ -215,7 +215,7 @@ function ReownWalletProvider({
215
215
  }, [backendUrl, overrides]);
216
216
  _react.useEffect.call(void 0, () => {
217
217
  setAppKitTheme(appKitReact.modal, theme);
218
- return _chunkQGNJFDEOcjs.followSystemAppearance.call(void 0,
218
+ return _chunkN3AAT6BScjs.followSystemAppearance.call(void 0,
219
219
  _optionalChain([theme, 'optionalAccess', _7 => _7.mode]),
220
220
  () => setAppKitTheme(appKitReact.modal, theme)
221
221
  );
@@ -279,7 +279,7 @@ function useReownWalletSession() {
279
279
  await switchChainAsync({ chainId });
280
280
  }
281
281
  } catch (err) {
282
- if (_chunkQGNJFDEOcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
282
+ if (_chunkN3AAT6BScjs.isUnsupportedChainSwitchError.call(void 0, err)) {
283
283
  throw new Error(
284
284
  `Switch to ${chainDisplayName(chainId)} in your wallet to continue`
285
285
  );
@@ -292,7 +292,7 @@ function useReownWalletSession() {
292
292
 
293
293
  // src/DepositModalReown.tsx
294
294
 
295
- var [appKitReact2, , , , solanaAdapterReact] = _chunkXJMDCBHScjs.getReownDependencies.call(void 0, );
295
+ var [appKitReact2, , , , solanaAdapterReact] = _chunkJV5OGG53cjs.getReownDependencies.call(void 0, );
296
296
  var { useAppKitProvider } = appKitReact2;
297
297
  var { useAppKitConnection } = solanaAdapterReact;
298
298
  function DepositModalWithReown(props) {
@@ -314,7 +314,7 @@ function DepositModalWithReown(props) {
314
314
  reown.disconnect();
315
315
  }, [reown.disconnect]);
316
316
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
317
- _chunkXJMDCBHScjs.DepositModalInner,
317
+ _chunkJV5OGG53cjs.DepositModalInner,
318
318
  {
319
319
  ...props,
320
320
  walletSession: reownWithSolana,
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  DepositModalInner,
3
3
  getReownDependencies
4
- } from "./chunk-H66WM5AO.mjs";
4
+ } from "./chunk-EKC2IRQG.mjs";
5
+ import "./chunk-FTWKAJGN.mjs";
5
6
  import {
6
7
  followSystemAppearance,
7
8
  isUnsupportedChainSwitchError,
@@ -10,13 +11,12 @@ import {
10
11
  resolveThemeMode,
11
12
  rpcUrlFor,
12
13
  useStableRpcUrls
13
- } from "./chunk-QMGEK623.mjs";
14
- import "./chunk-XCBDJPBD.mjs";
15
- import "./chunk-FTWKAJGN.mjs";
14
+ } from "./chunk-AIZKGFVA.mjs";
16
15
  import {
17
16
  SUPPORTED_CHAIN_IDS,
18
17
  getChainName
19
18
  } from "./chunk-EAGMY3QE.mjs";
19
+ import "./chunk-3TEVMP76.mjs";
20
20
 
21
21
  // src/DepositModalReown.tsx
22
22
  import { useCallback, useMemo as useMemo2 } from "react";
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunk34JVJZEZcjs = require('./chunk-34JVJZEZ.cjs');
5
+ require('./chunk-N3AAT6BS.cjs');
6
+ require('./chunk-OY5N3E6L.cjs');
7
+ require('./chunk-N6JJG57R.cjs');
8
+
9
+
10
+
11
+ exports.WithdrawModal = _chunk34JVJZEZcjs.WithdrawModal; exports.buildWithdrawAnalyticsSessionProperties = _chunk34JVJZEZcjs.buildWithdrawAnalyticsSessionProperties;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  WithdrawModal,
3
3
  buildWithdrawAnalyticsSessionProperties
4
- } from "./chunk-ZHX4QROC.mjs";
5
- import "./chunk-QMGEK623.mjs";
6
- import "./chunk-XCBDJPBD.mjs";
4
+ } from "./chunk-R2B6VD4E.mjs";
5
+ import "./chunk-AIZKGFVA.mjs";
7
6
  import "./chunk-EAGMY3QE.mjs";
7
+ import "./chunk-3TEVMP76.mjs";
8
8
  export {
9
9
  WithdrawModal,
10
10
  buildWithdrawAnalyticsSessionProperties
@@ -0,0 +1,14 @@
1
+ interface CustomerSession {
2
+ token: string;
3
+ expiresAt: string;
4
+ }
5
+ interface CustomerSessionOptions {
6
+ backendUrl: string;
7
+ getSession: () => CustomerSession | Promise<CustomerSession>;
8
+ }
9
+ declare class ScopedRequestError extends Error {
10
+ readonly status: number;
11
+ constructor(status: number);
12
+ }
13
+
14
+ export { type CustomerSessionOptions as C, ScopedRequestError as S, type CustomerSession as a };
@@ -0,0 +1,14 @@
1
+ interface CustomerSession {
2
+ token: string;
3
+ expiresAt: string;
4
+ }
5
+ interface CustomerSessionOptions {
6
+ backendUrl: string;
7
+ getSession: () => CustomerSession | Promise<CustomerSession>;
8
+ }
9
+ declare class ScopedRequestError extends Error {
10
+ readonly status: number;
11
+ constructor(status: number);
12
+ }
13
+
14
+ export { type CustomerSessionOptions as C, ScopedRequestError as S, type CustomerSession as a };