@rhinestone/deposit-modal 0.11.0 → 0.11.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 (39) hide show
  1. package/dist/{DepositModalReown-6RVLEM3B.mjs → DepositModalReown-MO5QDLIT.mjs} +5 -5
  2. package/dist/{DepositModalReown-TXTLVZIQ.cjs → DepositModalReown-YGB73NMW.cjs} +13 -13
  3. package/dist/{chunk-XVKBCDZI.cjs → chunk-4FTI3GTB.cjs} +1 -1
  4. package/dist/{chunk-WLDTBKRA.mjs → chunk-5746YXKC.mjs} +1 -1
  5. package/dist/{chunk-ITAYM7SB.mjs → chunk-CWGUBFJL.mjs} +41 -3
  6. package/dist/{chunk-G4FVZQOM.mjs → chunk-EIWOVX53.mjs} +6 -6
  7. package/dist/{chunk-JYKMR6QI.cjs → chunk-FVUXJ3RP.cjs} +3 -3
  8. package/dist/{chunk-HCQWFL3A.cjs → chunk-HUHBNYD3.cjs} +66 -66
  9. package/dist/{chunk-BLJMYCBF.cjs → chunk-LQGYPM5B.cjs} +63 -63
  10. package/dist/{chunk-VRNRRN2U.mjs → chunk-OWYPKCYD.mjs} +3 -3
  11. package/dist/{chunk-7RNEYPI4.cjs → chunk-SSQ27YFB.cjs} +277 -274
  12. package/dist/{chunk-QRR3Y7EK.mjs → chunk-URFSTNRS.mjs} +1 -1
  13. package/dist/{chunk-DYTRG4C7.mjs → chunk-V6T7LORJ.mjs} +1 -1
  14. package/dist/{chunk-TRD2FCAR.mjs → chunk-YELNYILK.mjs} +256 -253
  15. package/dist/{chunk-NPSC5R22.cjs → chunk-ZQR36NCV.cjs} +65 -27
  16. package/dist/{chunk-GWA6GFTI.cjs → chunk-ZRIRCIQM.cjs} +54 -54
  17. package/dist/claim.cjs +5 -5
  18. package/dist/claim.d.cts +2 -2
  19. package/dist/claim.d.ts +2 -2
  20. package/dist/claim.mjs +4 -4
  21. package/dist/constants.cjs +2 -2
  22. package/dist/constants.d.cts +1 -1
  23. package/dist/constants.d.ts +1 -1
  24. package/dist/constants.mjs +1 -1
  25. package/dist/deposit.cjs +6 -6
  26. package/dist/deposit.d.cts +2 -2
  27. package/dist/deposit.d.ts +2 -2
  28. package/dist/deposit.mjs +5 -5
  29. package/dist/index.cjs +8 -8
  30. package/dist/index.d.cts +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.mjs +7 -7
  33. package/dist/{types-C7wag_iL.d.cts → types-CsGa-HxD.d.cts} +6 -0
  34. package/dist/{types-D4b6Cjox.d.ts → types-DdS8OySJ.d.ts} +6 -0
  35. package/dist/withdraw.cjs +5 -5
  36. package/dist/withdraw.d.cts +2 -2
  37. package/dist/withdraw.d.ts +2 -2
  38. package/dist/withdraw.mjs +4 -4
  39. package/package.json +1 -1
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  DepositModalInner
3
- } from "./chunk-TRD2FCAR.mjs";
4
- import "./chunk-WLDTBKRA.mjs";
5
- import "./chunk-DYTRG4C7.mjs";
3
+ } from "./chunk-YELNYILK.mjs";
4
+ import "./chunk-5746YXKC.mjs";
5
+ import "./chunk-V6T7LORJ.mjs";
6
6
  import {
7
7
  isUnsupportedChainSwitchError,
8
8
  peekRuntimeChains,
9
9
  primeRuntimeChains,
10
10
  rpcUrlFor,
11
11
  useStableRpcUrls
12
- } from "./chunk-ITAYM7SB.mjs";
13
- import "./chunk-QRR3Y7EK.mjs";
12
+ } from "./chunk-CWGUBFJL.mjs";
13
+ import "./chunk-URFSTNRS.mjs";
14
14
  import "./chunk-MZ53PDIX.mjs";
15
15
  import {
16
16
  SUPPORTED_CHAINS,
@@ -1,16 +1,16 @@
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
- var _chunk7RNEYPI4cjs = require('./chunk-7RNEYPI4.cjs');
4
- require('./chunk-HCQWFL3A.cjs');
5
- require('./chunk-JYKMR6QI.cjs');
3
+ var _chunkSSQ27YFBcjs = require('./chunk-SSQ27YFB.cjs');
4
+ require('./chunk-HUHBNYD3.cjs');
5
+ require('./chunk-FVUXJ3RP.cjs');
6
6
 
7
7
 
8
8
 
9
9
 
10
10
 
11
11
 
12
- var _chunkNPSC5R22cjs = require('./chunk-NPSC5R22.cjs');
13
- require('./chunk-XVKBCDZI.cjs');
12
+ var _chunkZQR36NCVcjs = require('./chunk-ZQR36NCV.cjs');
13
+ require('./chunk-4FTI3GTB.cjs');
14
14
  require('./chunk-JPRV36DT.cjs');
15
15
 
16
16
 
@@ -91,14 +91,14 @@ function buildTransports(rpcUrls, networks = EVM_NETWORKS) {
91
91
  const transports = {};
92
92
  for (const network of networks) {
93
93
  const id = Number(network.id);
94
- transports[id] = _viem.http.call(void 0, _chunkNPSC5R22cjs.rpcUrlFor.call(void 0, rpcUrls, id));
94
+ transports[id] = _viem.http.call(void 0, _chunkZQR36NCVcjs.rpcUrlFor.call(void 0, rpcUrls, id));
95
95
  }
96
96
  return transports;
97
97
  }
98
98
  function getEvmRpcFingerprint(rpcUrls, networks) {
99
99
  return networks.map((network) => {
100
100
  const id = Number(network.id);
101
- return `${id}=${_nullishCoalesce(_chunkNPSC5R22cjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
101
+ return `${id}=${_nullishCoalesce(_chunkZQR36NCVcjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
102
102
  }).join("|");
103
103
  }
104
104
  var cachedAdapter = null;
@@ -177,7 +177,7 @@ function ReownWalletProvider({
177
177
  backendUrl,
178
178
  children
179
179
  }) {
180
- const rpcUrls = _chunkNPSC5R22cjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
180
+ const rpcUrls = _chunkZQR36NCVcjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
181
181
  const [queryClient] = _react.useState.call(void 0, () => new (0, _reactquery.QueryClient)());
182
182
  const overrides = _react.useMemo.call(void 0, () => {
183
183
  if (!rpcUrls) return void 0;
@@ -189,14 +189,14 @@ function ReownWalletProvider({
189
189
  return out;
190
190
  }, [rpcUrls]);
191
191
  const [state, setState] = _react.useState.call(void 0, () => {
192
- const primed = _chunkNPSC5R22cjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
192
+ const primed = _chunkZQR36NCVcjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
193
193
  return { ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) };
194
194
  });
195
195
  _react.useEffect.call(void 0, () => {
196
196
  let active = true;
197
- const primed = _chunkNPSC5R22cjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
197
+ const primed = _chunkZQR36NCVcjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
198
198
  setState({ ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) });
199
- _chunkNPSC5R22cjs.primeRuntimeChains.call(void 0, backendUrl, overrides).then((chains) => {
199
+ _chunkZQR36NCVcjs.primeRuntimeChains.call(void 0, backendUrl, overrides).then((chains) => {
200
200
  if (active) setState({ ready: true, chains });
201
201
  });
202
202
  return () => {
@@ -258,7 +258,7 @@ function useReownWallet() {
258
258
  await switchChainAsync({ chainId });
259
259
  }
260
260
  } catch (err) {
261
- if (_chunkNPSC5R22cjs.isUnsupportedChainSwitchError.call(void 0, err)) {
261
+ if (_chunkZQR36NCVcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
262
262
  throw new Error(
263
263
  `Switch to ${chainDisplayName(chainId)} in your wallet to continue`
264
264
  );
@@ -292,7 +292,7 @@ function DepositModalWithReown(props) {
292
292
  reown.disconnect();
293
293
  }, [reown.disconnect]);
294
294
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
295
- _chunk7RNEYPI4cjs.DepositModalInner,
295
+ _chunkSSQ27YFBcjs.DepositModalInner,
296
296
  {
297
297
  ...props,
298
298
  reownWallet: reownWithSolana,
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/core/version.ts
2
- var MODAL_VERSION = "0.11.0";
2
+ var MODAL_VERSION = "0.11.1";
3
3
  var SERVICE_HEADERS = {
4
4
  "Content-Type": "application/json",
5
5
  "x-deposit-modal-version": MODAL_VERSION
@@ -24,7 +24,7 @@ import {
24
24
  tokenAmountToNumber,
25
25
  useExplorerTxUrl,
26
26
  useLatestRef
27
- } from "./chunk-ITAYM7SB.mjs";
27
+ } from "./chunk-CWGUBFJL.mjs";
28
28
  import {
29
29
  NATIVE_TOKEN_ADDRESS,
30
30
  cdnIconUrl,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SERVICE_HEADERS
3
- } from "./chunk-QRR3Y7EK.mjs";
3
+ } from "./chunk-URFSTNRS.mjs";
4
4
  import {
5
5
  CHAIN_BY_ID,
6
6
  CHAIN_DISPLAY_ORDER,
@@ -843,6 +843,11 @@ var SwappedConnectFeeChangedError = class extends Error {
843
843
  function parseExchangeFeeBps(value) {
844
844
  return typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 1e4 ? value : void 0;
845
845
  }
846
+ var UNSUPPORTED_CONNECT_EXCHANGES = /* @__PURE__ */ new Set(["kraken", "htx"]);
847
+ var SUPPORTED_CONNECT_EXCHANGE_COUNT = 7;
848
+ function isSupportedConnectExchange(exchange) {
849
+ return !UNSUPPORTED_CONNECT_EXCHANGES.has(exchange.connection.toLowerCase());
850
+ }
846
851
  function resolveAppFeeBps(appFees, sourceChainCaip2, sourceToken) {
847
852
  const override = appFees?.tokens?.[sourceChainCaip2]?.[sourceToken.toLowerCase()];
848
853
  const bps = override ?? appFees?.feeBps ?? 0;
@@ -1594,7 +1599,7 @@ function createDepositService(baseUrl, options) {
1594
1599
  throw new Error("Swapped Connect exchanges: malformed response");
1595
1600
  }
1596
1601
  return {
1597
- exchanges,
1602
+ exchanges: exchanges.filter(isSupportedConnectExchange),
1598
1603
  fetchedAt: body.fetchedAt,
1599
1604
  expiresAt: body.expiresAt,
1600
1605
  stale: body.stale === true ? true : void 0,
@@ -2445,6 +2450,22 @@ function isUnsupportedChainSwitchError(error) {
2445
2450
  const message = (error instanceof Error ? error.message : String(error)).toLowerCase();
2446
2451
  return name === "SwitchChainNotSupportedError" || message.includes("does not support programmatic chain switching") || message.includes("switch chain not supported") || message.includes("method not found") || message.includes("does not exist") || message.includes("is not available");
2447
2452
  }
2453
+ var OPAQUE_REVERT_REASONS = [
2454
+ "unexpected error",
2455
+ "internal error",
2456
+ "unknown error",
2457
+ "internal json-rpc error"
2458
+ ];
2459
+ var DETAIL_SECTION_HEADINGS = [
2460
+ "Request Arguments:",
2461
+ "Raw Call Arguments:",
2462
+ "Request body:",
2463
+ "Contract Call:",
2464
+ "Docs:",
2465
+ "Details:",
2466
+ "Version:",
2467
+ "URL:"
2468
+ ];
2448
2469
  function formatUserError(raw) {
2449
2470
  const lower = raw.toLowerCase();
2450
2471
  if (lower.includes("user rejected") || lower.includes("user denied")) {
@@ -2456,6 +2477,22 @@ function formatUserError(raw) {
2456
2477
  if (lower.includes("nonce too low") || lower.includes("nonce too high")) {
2457
2478
  return "Transaction conflict \u2014 please try again";
2458
2479
  }
2480
+ const revertMarker = "reverted with the following reason:";
2481
+ const revertIdx = lower.indexOf(revertMarker);
2482
+ const revertReason = revertIdx === -1 ? null : raw.slice(revertIdx + revertMarker.length).split(/\n[^\S\n]*\n/)[0].split("\n").map((line) => line.trim()).find(
2483
+ (line) => line.length > 0 && !DETAIL_SECTION_HEADINGS.some(
2484
+ (heading) => line.startsWith(heading)
2485
+ )
2486
+ ) ?? "";
2487
+ if (revertReason !== null) {
2488
+ const reasonLower = revertReason.toLowerCase();
2489
+ if (reasonLower.includes("execution reverted")) {
2490
+ return "Transaction would fail on-chain";
2491
+ }
2492
+ if (revertReason === "" || revertReason === "0x" || OPAQUE_REVERT_REASONS.some((opaque) => reasonLower.includes(opaque))) {
2493
+ return "Your wallet couldn't send the transaction \u2014 please try again";
2494
+ }
2495
+ }
2459
2496
  if (lower.includes("execution reverted")) {
2460
2497
  return "Transaction would fail on-chain";
2461
2498
  }
@@ -2474,7 +2511,7 @@ function formatUserError(raw) {
2474
2511
  if (lower.includes("rate limit") || lower.includes("429")) {
2475
2512
  return "Rate limited \u2014 please try again shortly";
2476
2513
  }
2477
- let cleaned = raw;
2514
+ let cleaned = revertReason || raw;
2478
2515
  const stripMarkers = [
2479
2516
  "\n\nRequest Arguments:",
2480
2517
  "\nRaw Call Arguments:",
@@ -2850,6 +2887,7 @@ export {
2850
2887
  quoteFeeRow,
2851
2888
  quoteFeeGroups,
2852
2889
  SwappedConnectFeeChangedError,
2890
+ SUPPORTED_CONNECT_EXCHANGE_COUNT,
2853
2891
  resolveAppFeeBps,
2854
2892
  createDepositService,
2855
2893
  rpcUrlFor,
@@ -3,7 +3,7 @@ import {
3
3
  deriveAccountSalt,
4
4
  useTokenPrices,
5
5
  warnRemovedProps
6
- } from "./chunk-WLDTBKRA.mjs";
6
+ } from "./chunk-5746YXKC.mjs";
7
7
  import {
8
8
  BodyHeader,
9
9
  Button,
@@ -37,7 +37,7 @@ import {
37
37
  useRpcUrls,
38
38
  useStableRpcUrls,
39
39
  useTargetTokens
40
- } from "./chunk-ITAYM7SB.mjs";
40
+ } from "./chunk-CWGUBFJL.mjs";
41
41
  import {
42
42
  NATIVE_TOKEN_ADDRESS,
43
43
  getChainIcon,
@@ -669,7 +669,7 @@ function WithdrawReviewStep({
669
669
  const raw = err instanceof Error ? err.message : "Withdraw failed";
670
670
  const message = formatUserError(raw);
671
671
  setError(message);
672
- onError?.(message, "WITHDRAW_REVIEW_ERROR");
672
+ onError?.(message, "WITHDRAW_REVIEW_ERROR", raw);
673
673
  } finally {
674
674
  setIsSubmitting(false);
675
675
  }
@@ -971,9 +971,9 @@ function WithdrawFlow({
971
971
  registration.kind
972
972
  ]);
973
973
  const handleError = useCallback2(
974
- (message, code) => {
975
- logFlowError("flow:error", message, { code });
976
- onErrorRef.current?.({ message, code });
974
+ (message, code, cause) => {
975
+ logFlowError("flow:error", cause ?? message, { code });
976
+ onErrorRef.current?.({ message, code, cause });
977
977
  },
978
978
  [logFlowError, onErrorRef]
979
979
  );
@@ -1,7 +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 _chunkNPSC5R22cjs = require('./chunk-NPSC5R22.cjs');
4
+ var _chunkZQR36NCVcjs = require('./chunk-ZQR36NCV.cjs');
5
5
 
6
6
  // src/components/ui/ListRow.tsx
7
7
  var _jsxruntime = require('react/jsx-runtime');
@@ -19,7 +19,7 @@ function ListRow({
19
19
  ...props
20
20
  }) {
21
21
  const inner = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
22
- leadingMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-leading rs-list-row-leading--media", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.CdnIcon, { src: leadingMedia }) }) : leading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-leading", children: leading }) : null,
22
+ leadingMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-leading rs-list-row-leading--media", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZQR36NCVcjs.CdnIcon, { src: leadingMedia }) }) : leading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-leading", children: leading }) : null,
23
23
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-list-row-body", children: [
24
24
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-list-row-text", children: [
25
25
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-title", children: title }),
@@ -39,7 +39,7 @@ function ListRow({
39
39
  }
40
40
  ) : meta && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list-row-meta", children: meta })
41
41
  ] }),
42
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-chevron", children: _nullishCoalesce(trailing, () => ( (disabled ? null : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNPSC5R22cjs.ChevronRightIcon, {})))) })
42
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-chevron", children: _nullishCoalesce(trailing, () => ( (disabled ? null : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZQR36NCVcjs.ChevronRightIcon, {})))) })
43
43
  ] });
44
44
  if (action) {
45
45
  const handleKey = (e) => {