@rhinestone/deposit-modal 0.1.53 → 0.1.55

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 (34) hide show
  1. package/dist/{DepositModalReown-LNZ46L4O.mjs → DepositModalReown-5QKEE7R3.mjs} +3 -3
  2. package/dist/{DepositModalReown-OXAW4Y7O.cjs → DepositModalReown-XKP2Z55X.cjs} +4 -4
  3. package/dist/{WithdrawModalReown-V3ZJESQ5.cjs → WithdrawModalReown-CN2NJUYL.cjs} +4 -4
  4. package/dist/{WithdrawModalReown-EE74V66X.mjs → WithdrawModalReown-K57JK52O.mjs} +3 -3
  5. package/dist/{chunk-ZB5Y2ACC.mjs → chunk-AJUR6FAP.mjs} +23 -8
  6. package/dist/{chunk-ZJQZEIHA.mjs → chunk-CIXHTOO3.mjs} +1 -1
  7. package/dist/{chunk-DBBSH7HP.cjs → chunk-EAEDK474.cjs} +58 -32
  8. package/dist/{chunk-REDAO3MS.mjs → chunk-JQTV5JTB.mjs} +37 -11
  9. package/dist/{chunk-47WDWD6Z.cjs → chunk-QJVXCBUI.cjs} +231 -216
  10. package/dist/{chunk-4BL7RCZB.mjs → chunk-QOEACKBH.mjs} +53 -27
  11. package/dist/{chunk-NELAYNA3.cjs → chunk-R6U6BHCV.cjs} +1 -1
  12. package/dist/{chunk-K57KO3SW.cjs → chunk-XMNGYDDB.cjs} +120 -94
  13. package/dist/constants.cjs +2 -2
  14. package/dist/constants.mjs +1 -1
  15. package/dist/deposit.cjs +4 -4
  16. package/dist/deposit.d.cts +2 -2
  17. package/dist/deposit.d.ts +2 -2
  18. package/dist/deposit.mjs +3 -3
  19. package/dist/index.cjs +5 -5
  20. package/dist/index.d.cts +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.mjs +4 -4
  23. package/dist/reown.cjs +5 -5
  24. package/dist/reown.d.cts +1 -1
  25. package/dist/reown.d.ts +1 -1
  26. package/dist/reown.mjs +4 -4
  27. package/dist/styles.css +45 -55
  28. package/dist/{types-D1nvo2dK.d.ts → types-B7UuWCtD.d.ts} +3 -0
  29. package/dist/{types-DgiqazTb.d.cts → types-CL7ec666.d.cts} +3 -0
  30. package/dist/withdraw.cjs +4 -4
  31. package/dist/withdraw.d.cts +2 -2
  32. package/dist/withdraw.d.ts +2 -2
  33. package/dist/withdraw.mjs +3 -3
  34. package/package.json +1 -1
@@ -20,7 +20,7 @@ import {
20
20
  loadSessionOwnerFromStorage,
21
21
  saveSessionOwnerToStorage,
22
22
  toEvmCaip2
23
- } from "./chunk-REDAO3MS.mjs";
23
+ } from "./chunk-JQTV5JTB.mjs";
24
24
  import {
25
25
  DEFAULT_BACKEND_URL,
26
26
  DEFAULT_SIGNER_ADDRESS,
@@ -33,7 +33,7 @@ import {
33
33
  getTokenDecimalsByAddress,
34
34
  getTokenIcon,
35
35
  getTokenSymbol
36
- } from "./chunk-ZJQZEIHA.mjs";
36
+ } from "./chunk-CIXHTOO3.mjs";
37
37
 
38
38
  // src/WithdrawModal.tsx
39
39
  import {
@@ -282,7 +282,7 @@ function WithdrawFormStep({
282
282
  return /* @__PURE__ */ jsxs("div", { className: "rs-step", children: [
283
283
  /* @__PURE__ */ jsxs("div", { className: "rs-step-body rs-withdraw-form", children: [
284
284
  /* @__PURE__ */ jsxs("div", { className: "rs-withdraw-section", children: [
285
- /* @__PURE__ */ jsx("label", { className: "rs-withdraw-label", children: "Recipient" }),
285
+ /* @__PURE__ */ jsx("label", { className: "rs-withdraw-label", children: "Recipient address" }),
286
286
  /* @__PURE__ */ jsxs("div", { className: "rs-withdraw-input-row", children: [
287
287
  /* @__PURE__ */ jsx(
288
288
  "input",
@@ -304,15 +304,18 @@ function WithdrawFormStep({
304
304
  className: `rs-withdraw-use-connected ${isRecipientConnected ? "rs-withdraw-use-connected--active" : ""}`,
305
305
  onClick: handleUseConnected,
306
306
  title: isRecipientConnected ? "Using connected wallet" : "Use connected wallet",
307
- children: walletIcon ? /* @__PURE__ */ jsx(
308
- "img",
309
- {
310
- src: walletIcon,
311
- alt: "Wallet",
312
- style: { width: 18, height: 18, borderRadius: 4 },
313
- className: "rs-withdraw-use-connected-icon"
314
- }
315
- ) : /* @__PURE__ */ jsxs(Fragment, { children: [
307
+ children: walletIcon ? /* @__PURE__ */ jsxs(Fragment, { children: [
308
+ /* @__PURE__ */ jsx(
309
+ "img",
310
+ {
311
+ src: walletIcon,
312
+ alt: "Wallet",
313
+ style: { width: 18, height: 18, borderRadius: 4 },
314
+ className: "rs-withdraw-use-connected-icon"
315
+ }
316
+ ),
317
+ isRecipientConnected ? null : "Use connected"
318
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
316
319
  /* @__PURE__ */ jsx(
317
320
  "svg",
318
321
  {
@@ -331,7 +334,7 @@ function WithdrawFormStep({
331
334
  )
332
335
  }
333
336
  ),
334
- isRecipientConnected ? null : "Wallet"
337
+ isRecipientConnected ? null : "Use connected"
335
338
  ] })
336
339
  }
337
340
  )
@@ -374,6 +377,7 @@ function WithdrawFormStep({
374
377
  /* @__PURE__ */ jsxs("div", { className: "rs-withdraw-amount-info", children: [
375
378
  /* @__PURE__ */ jsx("span", { className: "rs-withdraw-usd", children: amountUsd !== null ? currencyFormatter.format(amountUsd) : "$0.00" }),
376
379
  /* @__PURE__ */ jsxs("span", { className: "rs-withdraw-balance", children: [
380
+ "Balance: ",
377
381
  formattedBalance,
378
382
  " ",
379
383
  asset.symbol
@@ -382,7 +386,7 @@ function WithdrawFormStep({
382
386
  ] }),
383
387
  /* @__PURE__ */ jsxs("div", { className: "rs-withdraw-receive-row", children: [
384
388
  /* @__PURE__ */ jsxs("div", { className: "rs-withdraw-receive-col", children: [
385
- /* @__PURE__ */ jsx("label", { className: "rs-withdraw-label", children: "Receive" }),
389
+ /* @__PURE__ */ jsx("label", { className: "rs-withdraw-label", children: "Receive token" }),
386
390
  /* @__PURE__ */ jsxs(
387
391
  "div",
388
392
  {
@@ -462,7 +466,7 @@ function WithdrawFormStep({
462
466
  )
463
467
  ] }),
464
468
  /* @__PURE__ */ jsxs("div", { className: "rs-withdraw-receive-col", children: [
465
- /* @__PURE__ */ jsx("label", { className: "rs-withdraw-label", children: "Chain" }),
469
+ /* @__PURE__ */ jsx("label", { className: "rs-withdraw-label", children: "Receive chain" }),
466
470
  /* @__PURE__ */ jsxs(
467
471
  "div",
468
472
  {
@@ -571,7 +575,7 @@ function WithdrawFormStep({
571
575
  fullWidth: true,
572
576
  loading: isBusy,
573
577
  disabled: !recipient || !amount || chainMismatch || isBusy,
574
- children: isBusy ? "Preparing..." : "Withdraw"
578
+ children: isBusy ? "Preparing..." : !recipient ? "Enter Recipient Address" : !amount ? "Enter Withdraw Amount" : "Withdraw"
575
579
  }
576
580
  ) }),
577
581
  /* @__PURE__ */ jsx(PoweredBy, {})
@@ -879,6 +883,7 @@ function WithdrawFlow({
879
883
  recipient: defaultRecipient,
880
884
  amount: defaultAmount,
881
885
  service,
886
+ allowedRoutes,
882
887
  signerAddress = DEFAULT_SIGNER_ADDRESS,
883
888
  sessionChainIds,
884
889
  forceRegister = false,
@@ -1287,15 +1292,29 @@ function WithdrawFlow({
1287
1292
  },
1288
1293
  [logFlowError, onWithdrawFailed]
1289
1294
  );
1290
- const targetChainOptions = useMemo2(() => {
1291
- return SOURCE_CHAINS.filter(
1292
- (chain) => getSupportedTargetTokens(chain.id).length > 0
1293
- );
1294
- }, []);
1295
- const targetTokenOptions = useMemo2(
1296
- () => getSupportedTargetTokens(targetChain),
1297
- [targetChain]
1295
+ const allowedChainSet = useMemo2(
1296
+ () => allowedRoutes?.sourceChains ? new Set(allowedRoutes.sourceChains) : null,
1297
+ [allowedRoutes?.sourceChains]
1298
1298
  );
1299
+ const allowedTokenSet = useMemo2(
1300
+ () => allowedRoutes?.sourceTokens ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
1301
+ [allowedRoutes?.sourceTokens]
1302
+ );
1303
+ const targetChainOptions = useMemo2(() => {
1304
+ return SOURCE_CHAINS.filter((chain) => {
1305
+ if (allowedChainSet && !allowedChainSet.has(chain.id)) return false;
1306
+ const tokens = getSupportedTargetTokens(chain.id);
1307
+ if (allowedTokenSet) {
1308
+ return tokens.some((t) => allowedTokenSet.has(t.symbol.toUpperCase()));
1309
+ }
1310
+ return tokens.length > 0;
1311
+ });
1312
+ }, [allowedChainSet, allowedTokenSet]);
1313
+ const targetTokenOptions = useMemo2(() => {
1314
+ const tokens = getSupportedTargetTokens(targetChain);
1315
+ if (!allowedTokenSet) return tokens;
1316
+ return tokens.filter((t) => allowedTokenSet.has(t.symbol.toUpperCase()));
1317
+ }, [targetChain, allowedTokenSet]);
1299
1318
  useEffect2(() => {
1300
1319
  if (targetTokenOptions.length === 0) return;
1301
1320
  const matches = targetTokenOptions.some(
@@ -1308,7 +1327,10 @@ function WithdrawFlow({
1308
1327
  const handleTargetChainChange = useCallback2(
1309
1328
  (chainId) => {
1310
1329
  setTargetChain(chainId);
1311
- const options = getSupportedTargetTokens(chainId);
1330
+ let options = getSupportedTargetTokens(chainId);
1331
+ if (allowedTokenSet) {
1332
+ options = options.filter((t) => allowedTokenSet.has(t.symbol.toUpperCase()));
1333
+ }
1312
1334
  if (options.length === 0) {
1313
1335
  return;
1314
1336
  }
@@ -1319,7 +1341,7 @@ function WithdrawFlow({
1319
1341
  currentlySupported ? targetToken : options[0].address
1320
1342
  );
1321
1343
  },
1322
- [targetToken]
1344
+ [targetToken, allowedTokenSet]
1323
1345
  );
1324
1346
  const handleTargetTokenChange = useCallback2((token) => {
1325
1347
  setTargetToken(token);
@@ -1431,7 +1453,7 @@ function WithdrawFlow({
1431
1453
  // src/WithdrawModal.tsx
1432
1454
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1433
1455
  var ReownWithdrawInner = lazy(
1434
- () => import("./WithdrawModalReown-EE74V66X.mjs").then((m) => ({
1456
+ () => import("./WithdrawModalReown-K57JK52O.mjs").then((m) => ({
1435
1457
  default: m.WithdrawModalReown
1436
1458
  }))
1437
1459
  );
@@ -1457,6 +1479,8 @@ function WithdrawModalInner({
1457
1479
  isOpen,
1458
1480
  onClose,
1459
1481
  inline,
1482
+ closeOnOverlayClick,
1483
+ allowedRoutes,
1460
1484
  backendUrl = DEFAULT_BACKEND_URL,
1461
1485
  signerAddress = DEFAULT_SIGNER_ADDRESS,
1462
1486
  sessionChainIds,
@@ -1534,6 +1558,7 @@ function WithdrawModalInner({
1534
1558
  onClose,
1535
1559
  className,
1536
1560
  inline,
1561
+ closeOnOverlayClick,
1537
1562
  children: /* @__PURE__ */ jsxs3("div", { ref: modalRef, className: "rs-modal", children: [
1538
1563
  /* @__PURE__ */ jsxs3("div", { className: "rs-modal-header--redesigned", children: [
1539
1564
  /* @__PURE__ */ jsx3("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && /* @__PURE__ */ jsx3(
@@ -1630,6 +1655,7 @@ function WithdrawModalInner({
1630
1655
  recipient,
1631
1656
  amount: defaultAmount,
1632
1657
  service,
1658
+ allowedRoutes,
1633
1659
  signerAddress,
1634
1660
  sessionChainIds,
1635
1661
  forceRegister,
@@ -26,7 +26,7 @@ var SUPPORTED_TOKEN_MATRIX = {
26
26
  ETH: [_chains.mainnet.id, _chains.base.id, _chains.arbitrum.id, _chains.optimism.id, _chains.polygon.id, _chains.soneium.id],
27
27
  WETH: [_chains.mainnet.id, _chains.base.id, _chains.arbitrum.id, _chains.optimism.id, _chains.polygon.id, _chains.soneium.id],
28
28
  USDC: [_chains.mainnet.id, _chains.base.id, _chains.arbitrum.id, _chains.optimism.id, _chains.polygon.id, _chains.soneium.id],
29
- USDT: [_chains.mainnet.id, _chains.arbitrum.id, _chains.polygon.id, _chains.bsc.id, _chains.plasma.id]
29
+ USDT: [_chains.mainnet.id, _chains.arbitrum.id, _chains.optimism.id, _chains.polygon.id, _chains.bsc.id, _chains.plasma.id]
30
30
  };
31
31
  var CHAIN_DISPLAY_ORDER = [
32
32
  _chains.mainnet.id,