@rhinestone/deposit-modal 0.10.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 (49) hide show
  1. package/dist/{DepositModalReown-MTWT6Y66.mjs → DepositModalReown-MO5QDLIT.mjs} +96 -26
  2. package/dist/{DepositModalReown-S3DSFXTX.cjs → DepositModalReown-YGB73NMW.cjs} +97 -27
  3. package/dist/caip-D8aRWdEY.d.cts +40 -0
  4. package/dist/caip-D8aRWdEY.d.ts +40 -0
  5. package/dist/{chunk-NF4NBRUP.cjs → chunk-4FTI3GTB.cjs} +1 -1
  6. package/dist/{chunk-A223BLVC.mjs → chunk-53IFZGSF.mjs} +177 -21
  7. package/dist/{chunk-VDGT6NZQ.mjs → chunk-5746YXKC.mjs} +14 -31
  8. package/dist/{chunk-7TV7GLJB.mjs → chunk-CWGUBFJL.mjs} +763 -169
  9. package/dist/{chunk-LR7MKHYV.mjs → chunk-EIWOVX53.mjs} +27 -25
  10. package/dist/{chunk-VTVOHNXM.cjs → chunk-FVUXJ3RP.cjs} +3 -3
  11. package/dist/{chunk-A42XAHIB.cjs → chunk-HUHBNYD3.cjs} +84 -101
  12. package/dist/{chunk-YEBXUUH3.cjs → chunk-JPRV36DT.cjs} +2 -2
  13. package/dist/{chunk-UMCDZJMG.cjs → chunk-LQGYPM5B.cjs} +96 -94
  14. package/dist/{chunk-ILT2PITN.mjs → chunk-MZ53PDIX.mjs} +1 -1
  15. package/dist/{chunk-5NJYW5FT.mjs → chunk-OWYPKCYD.mjs} +12 -9
  16. package/dist/{chunk-W4YAOJPG.cjs → chunk-SSQ27YFB.cjs} +625 -568
  17. package/dist/{chunk-H577RJN5.cjs → chunk-TENL4H64.cjs} +186 -30
  18. package/dist/{chunk-5OEWGJR4.mjs → chunk-URFSTNRS.mjs} +1 -1
  19. package/dist/{chunk-KW32UBUQ.mjs → chunk-V6T7LORJ.mjs} +1 -1
  20. package/dist/{chunk-MHIOMTMM.mjs → chunk-YELNYILK.mjs} +391 -334
  21. package/dist/{chunk-PUJHXHRA.cjs → chunk-ZQR36NCV.cjs} +845 -251
  22. package/dist/{chunk-DEF767BA.cjs → chunk-ZRIRCIQM.cjs} +66 -63
  23. package/dist/claim.cjs +6 -6
  24. package/dist/claim.d.cts +3 -2
  25. package/dist/claim.d.ts +3 -2
  26. package/dist/claim.mjs +5 -5
  27. package/dist/{caip-523Zrc3r.d.cts → constants-FuzG3h4m.d.cts} +1 -18
  28. package/dist/{caip-523Zrc3r.d.ts → constants-FuzG3h4m.d.ts} +1 -18
  29. package/dist/constants.cjs +5 -3
  30. package/dist/constants.d.cts +3 -2
  31. package/dist/constants.d.ts +3 -2
  32. package/dist/constants.mjs +4 -2
  33. package/dist/deposit.cjs +8 -8
  34. package/dist/deposit.d.cts +3 -2
  35. package/dist/deposit.d.ts +3 -2
  36. package/dist/deposit.mjs +7 -7
  37. package/dist/index.cjs +12 -10
  38. package/dist/index.d.cts +3 -2
  39. package/dist/index.d.ts +3 -2
  40. package/dist/index.mjs +11 -9
  41. package/dist/polymarket.cjs +5 -5
  42. package/dist/polymarket.mjs +2 -2
  43. package/dist/{types-C0SGf-21.d.cts → types-CsGa-HxD.d.cts} +10 -3
  44. package/dist/{types-C0SGf-21.d.ts → types-DdS8OySJ.d.ts} +10 -3
  45. package/dist/withdraw.cjs +6 -6
  46. package/dist/withdraw.d.cts +3 -2
  47. package/dist/withdraw.d.ts +3 -2
  48. package/dist/withdraw.mjs +5 -5
  49. package/package.json +1 -1
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  ProcessingStep,
3
3
  deriveAccountSalt,
4
- getPublicClient,
5
4
  useTokenPrices,
6
5
  warnRemovedProps
7
- } from "./chunk-VDGT6NZQ.mjs";
6
+ } from "./chunk-5746YXKC.mjs";
8
7
  import {
9
8
  BodyHeader,
10
9
  Button,
11
10
  Callout,
12
11
  CdnIcon,
12
+ ChainCatalogProvider,
13
13
  ChevronDownIcon,
14
14
  ChevronLeftIcon,
15
15
  CircleArrowOutUpLeftIcon,
@@ -29,23 +29,24 @@ import {
29
29
  formatTokenAmount,
30
30
  formatUserError,
31
31
  getAssetId,
32
+ getPublicClient,
32
33
  isNativeAsset,
33
34
  isRecognizedToken,
35
+ useDestinationChains,
34
36
  useLatestRef,
35
37
  useRpcUrls,
36
- useStableRpcUrls
37
- } from "./chunk-7TV7GLJB.mjs";
38
+ useStableRpcUrls,
39
+ useTargetTokens
40
+ } from "./chunk-CWGUBFJL.mjs";
38
41
  import {
39
42
  NATIVE_TOKEN_ADDRESS,
40
- SOURCE_CHAINS,
41
43
  getChainIcon,
42
44
  getChainId,
43
45
  getChainName,
44
- getSupportedTargetTokens,
45
46
  getTokenDecimalsByAddress,
46
47
  getTokenSymbol,
47
48
  targetChainToCaip2
48
- } from "./chunk-A223BLVC.mjs";
49
+ } from "./chunk-53IFZGSF.mjs";
49
50
 
50
51
  // src/WithdrawModal.tsx
51
52
  import { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo3, useRef as useRef3, useState as useState4 } from "react";
@@ -602,8 +603,13 @@ function WithdrawFormStep({
602
603
  onClick: handleWithdraw,
603
604
  fullWidth: true,
604
605
  loading: isBusy,
605
- disabled: !recipient || !amount || isBusy || Boolean(registrationError),
606
- children: isBusy ? "Preparing..." : registrationPending ? "Preparing session..." : !recipient ? "Enter Recipient Address" : !amount ? "Enter Withdraw Amount" : "Withdraw"
606
+ disabled: !recipient || !amount || isBusy || Boolean(registrationError) || // No token list for the selected chain yet. A destination published
607
+ // at runtime becomes selectable as soon as `/chains` resolves, which
608
+ // can precede its addresses; submitting in that window would send
609
+ // the previously selected chain's token address to a chain it does
610
+ // not exist on.
611
+ targetTokenOptions.length === 0,
612
+ children: isBusy ? "Preparing..." : registrationPending ? "Preparing session..." : targetTokenOptions.length === 0 ? "Loading tokens..." : !recipient ? "Enter Recipient Address" : !amount ? "Enter Withdraw Amount" : "Withdraw"
607
613
  }
608
614
  )
609
615
  ] }),
@@ -663,7 +669,7 @@ function WithdrawReviewStep({
663
669
  const raw = err instanceof Error ? err.message : "Withdraw failed";
664
670
  const message = formatUserError(raw);
665
671
  setError(message);
666
- onError?.(message, "WITHDRAW_REVIEW_ERROR");
672
+ onError?.(message, "WITHDRAW_REVIEW_ERROR", raw);
667
673
  } finally {
668
674
  setIsSubmitting(false);
669
675
  }
@@ -965,9 +971,9 @@ function WithdrawFlow({
965
971
  registration.kind
966
972
  ]);
967
973
  const handleError = useCallback2(
968
- (message, code) => {
969
- logFlowError("flow:error", message, { code });
970
- onErrorRef.current?.({ message, code });
974
+ (message, code, cause) => {
975
+ logFlowError("flow:error", cause ?? message, { code });
976
+ onErrorRef.current?.({ message, code, cause });
971
977
  },
972
978
  [logFlowError, onErrorRef]
973
979
  );
@@ -1137,15 +1143,11 @@ function WithdrawFlow({
1137
1143
  },
1138
1144
  [logFlowError, onLifecycleRef, storeApi]
1139
1145
  );
1140
- const targetChainOptions = useMemo2(
1141
- () => SOURCE_CHAINS.filter(
1142
- (chain) => getSupportedTargetTokens(chain.id).length > 0
1143
- ),
1144
- []
1145
- );
1146
+ const targetChainOptions = useDestinationChains();
1147
+ const targetTokensFor = useTargetTokens();
1146
1148
  const targetTokenOptions = useMemo2(
1147
- () => getSupportedTargetTokens(targetChain),
1148
- [targetChain]
1149
+ () => targetTokensFor(targetChain),
1150
+ [targetChain, targetTokensFor]
1149
1151
  );
1150
1152
  useEffect2(() => {
1151
1153
  if (targetTokenOptions.length === 0) return;
@@ -1157,7 +1159,7 @@ function WithdrawFlow({
1157
1159
  const handleTargetChainChange = useCallback2(
1158
1160
  (chainId) => {
1159
1161
  setTargetChain(chainId);
1160
- const options = getSupportedTargetTokens(chainId);
1162
+ const options = targetTokensFor(chainId);
1161
1163
  if (options.length === 0) return;
1162
1164
  const currentlySupported = options.some(
1163
1165
  (option) => option.address.toLowerCase() === targetToken.toLowerCase()
@@ -1166,7 +1168,7 @@ function WithdrawFlow({
1166
1168
  currentlySupported ? targetToken : options[0].address
1167
1169
  );
1168
1170
  },
1169
- [targetToken]
1171
+ [targetToken, targetTokensFor]
1170
1172
  );
1171
1173
  const handleTargetTokenChange = useCallback2((token) => {
1172
1174
  setTargetToken(token);
@@ -1328,7 +1330,7 @@ function WithdrawModal({
1328
1330
  }, []);
1329
1331
  const showBackButton = uiConfig?.showBackButton ?? true;
1330
1332
  const canGoBack = backHandler !== void 0;
1331
- return /* @__PURE__ */ jsx4(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx4(WithdrawStoreProvider, { store, children: /* @__PURE__ */ jsx4(
1333
+ return /* @__PURE__ */ jsx4(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx4(ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ jsx4(WithdrawStoreProvider, { store, children: /* @__PURE__ */ jsx4(
1332
1334
  Modal,
1333
1335
  {
1334
1336
  isOpen,
@@ -1382,7 +1384,7 @@ function WithdrawModal({
1382
1384
  )
1383
1385
  ] })
1384
1386
  }
1385
- ) }) });
1387
+ ) }) }) });
1386
1388
  }
1387
1389
 
1388
1390
  export {
@@ -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 _chunkPUJHXHRAcjs = require('./chunk-PUJHXHRA.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, _chunkPUJHXHRAcjs.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, _chunkPUJHXHRAcjs.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) => {