@rhinestone/deposit-modal 0.1.63 → 0.1.65

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.
@@ -21,7 +21,7 @@ import {
21
21
  saveSessionOwnerToStorage,
22
22
  toEvmCaip2,
23
23
  useLatestRef
24
- } from "./chunk-TDTBAZNO.mjs";
24
+ } from "./chunk-GAHX5RAT.mjs";
25
25
  import {
26
26
  DEFAULT_BACKEND_URL,
27
27
  DEFAULT_SIGNER_ADDRESS,
@@ -65,20 +65,10 @@ function useClickOutside(ref, onClose) {
65
65
  return () => document.removeEventListener("mousedown", handleClick);
66
66
  }, [ref, onClose]);
67
67
  }
68
- function resolvePreferredConnectedRecipient(connectedAddress, fallbackAddress, safeAddress) {
69
- const candidates = [connectedAddress, fallbackAddress].filter(
70
- (value) => Boolean(value)
71
- );
72
- const nonSafe = candidates.find(
73
- (value) => value.toLowerCase() !== safeAddress.toLowerCase()
74
- );
75
- return nonSafe ?? candidates[0] ?? "";
76
- }
77
68
  function WithdrawFormStep({
78
69
  walletClient,
79
70
  publicClient,
80
- address,
81
- connectedAddress,
71
+ connectedRecipient,
82
72
  safeAddress,
83
73
  asset,
84
74
  defaultRecipient,
@@ -95,13 +85,7 @@ function WithdrawFormStep({
95
85
  onSubmit,
96
86
  onBalanceUsdChange
97
87
  }) {
98
- const preferredConnectedRecipient = resolvePreferredConnectedRecipient(
99
- connectedAddress,
100
- address,
101
- safeAddress
102
- );
103
- const seededRecipient = defaultRecipient ?? preferredConnectedRecipient;
104
- const [recipient, setRecipient] = useState(seededRecipient);
88
+ const [recipient, setRecipient] = useState(defaultRecipient ?? "");
105
89
  const [amount, setAmount] = useState(defaultAmount ?? "");
106
90
  const [balance, setBalance] = useState(null);
107
91
  const [isBalanceLoading, setIsBalanceLoading] = useState(true);
@@ -116,6 +100,7 @@ function WithdrawFormStep({
116
100
  const publicClientChainId = publicClient.chain?.id;
117
101
  useClickOutside(chainDropdownRef, () => setShowChainDropdown(false));
118
102
  useClickOutside(tokenDropdownRef, () => setShowTokenDropdown(false));
103
+ const preferredConnectedRecipient = connectedRecipient ?? "";
119
104
  const isRecipientConnected = Boolean(
120
105
  preferredConnectedRecipient && recipient && recipient.toLowerCase() === preferredConnectedRecipient.toLowerCase()
121
106
  );
@@ -125,9 +110,9 @@ function WithdrawFormStep({
125
110
  const targetSymbol = getTokenSymbol(targetToken, targetChain);
126
111
  const targetChainName = getChainName(targetChain);
127
112
  const isBusy = submitting || isSubmitting;
128
- const seededRecipientRef = useRef(seededRecipient);
113
+ const seededRecipientRef = useRef(defaultRecipient ?? "");
129
114
  useEffect(() => {
130
- const nextSeed = defaultRecipient ?? preferredConnectedRecipient;
115
+ const nextSeed = defaultRecipient ?? "";
131
116
  setRecipient((current) => {
132
117
  if (current === seededRecipientRef.current || current === "") {
133
118
  return nextSeed;
@@ -135,7 +120,7 @@ function WithdrawFormStep({
135
120
  return current;
136
121
  });
137
122
  seededRecipientRef.current = nextSeed;
138
- }, [defaultRecipient, preferredConnectedRecipient]);
123
+ }, [defaultRecipient]);
139
124
  useEffect(() => {
140
125
  if (chainMismatch && switchChain && !hasAttemptedSwitch.current) {
141
126
  hasAttemptedSwitch.current = true;
@@ -298,7 +283,7 @@ function WithdrawFormStep({
298
283
  }
299
284
  }
300
285
  ),
301
- address && /* @__PURE__ */ jsx(
286
+ preferredConnectedRecipient && /* @__PURE__ */ jsx(
302
287
  "button",
303
288
  {
304
289
  type: "button",
@@ -1149,6 +1134,7 @@ function WithdrawFlow({
1149
1134
  sessionOwnerAddress: sessionOwner.address,
1150
1135
  targetChain: toEvmCaip2(targetChain),
1151
1136
  targetToken,
1137
+ recipient,
1152
1138
  signerAddress,
1153
1139
  sessionChainIds,
1154
1140
  forceRegister
@@ -1406,12 +1392,13 @@ function WithdrawFlow({
1406
1392
  }
1407
1393
  }, [showConnectStep, isConnectSelectionConfirmed, signerContext]);
1408
1394
  const ownerAddress = signerContext?.ownerAddress;
1395
+ const selectedWalletOption = selectedWalletIdEffective ? walletOptions.find((option) => option.id === selectedWalletIdEffective) ?? null : null;
1409
1396
  const selectedWalletIcon = useMemo2(() => {
1410
- if (!ownerAddress) return reownWallet?.icon;
1397
+ if (!ownerAddress) return void 0;
1411
1398
  const selected = walletOptions.find(
1412
1399
  (o) => o.address?.toLowerCase() === ownerAddress.toLowerCase()
1413
1400
  );
1414
- return selected?.icon ?? reownWallet?.icon;
1401
+ return selected?.kind === "external" ? selected.icon ?? reownWallet?.icon : void 0;
1415
1402
  }, [walletOptions, ownerAddress, reownWallet?.icon]);
1416
1403
  if (showConnectStep) {
1417
1404
  return /* @__PURE__ */ jsx2("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx2(
@@ -1435,9 +1422,7 @@ function WithdrawFlow({
1435
1422
  }
1436
1423
  if (!signerContext) return null;
1437
1424
  if (!onSignTransaction && !signerContext.walletClient) return null;
1438
- const resolvedOwnerAddress = signerContext.ownerAddress;
1439
- const resolvedConnectedAddress = signerContext.walletClient?.account?.address ?? reownWallet?.address ?? dappWalletClient?.account?.address ?? resolvedOwnerAddress;
1440
- const resolvedDefaultRecipient = defaultRecipient ?? resolvedConnectedAddress;
1425
+ const resolvedConnectedRecipient = selectedWalletOption?.kind === "external" ? selectedWalletOption.address : void 0;
1441
1426
  const formPublicClient = signerContext.publicClient ?? getPublicClient(sourceChain);
1442
1427
  return /* @__PURE__ */ jsxs2("div", { className: "rs-modal-body", children: [
1443
1428
  step.type === "form" && /* @__PURE__ */ jsx2(
@@ -1445,11 +1430,10 @@ function WithdrawFlow({
1445
1430
  {
1446
1431
  walletClient: signerContext.walletClient,
1447
1432
  publicClient: formPublicClient,
1448
- address: resolvedOwnerAddress,
1449
- connectedAddress: resolvedConnectedAddress,
1433
+ connectedRecipient: resolvedConnectedRecipient,
1450
1434
  safeAddress,
1451
1435
  asset,
1452
- defaultRecipient: resolvedDefaultRecipient,
1436
+ defaultRecipient,
1453
1437
  defaultAmount,
1454
1438
  targetChain,
1455
1439
  targetToken,
@@ -1491,7 +1475,7 @@ function WithdrawFlow({
1491
1475
  // src/WithdrawModal.tsx
1492
1476
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1493
1477
  var ReownWithdrawInner = lazy(
1494
- () => import("./WithdrawModalReown-2BW5CM3A.mjs").then((m) => ({
1478
+ () => import("./WithdrawModalReown-HVBMAUPM.mjs").then((m) => ({
1495
1479
  default: m.WithdrawModalReown
1496
1480
  }))
1497
1481
  );
package/dist/deposit.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkN3BZTUSJcjs = require('./chunk-N3BZTUSJ.cjs');
4
- require('./chunk-5SR5N75I.cjs');
3
+ var _chunkOWV4KVBMcjs = require('./chunk-OWV4KVBM.cjs');
4
+ require('./chunk-4CZ7W3RS.cjs');
5
5
  require('./chunk-R6U6BHCV.cjs');
6
6
 
7
7
 
8
- exports.DepositModal = _chunkN3BZTUSJcjs.DepositModal;
8
+ exports.DepositModal = _chunkOWV4KVBMcjs.DepositModal;
package/dist/deposit.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DepositModal
3
- } from "./chunk-XVCPUB6K.mjs";
4
- import "./chunk-TDTBAZNO.mjs";
3
+ } from "./chunk-IYZGLNY6.mjs";
4
+ import "./chunk-GAHX5RAT.mjs";
5
5
  import "./chunk-CIXHTOO3.mjs";
6
6
  export {
7
7
  DepositModal
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkN3BZTUSJcjs = require('./chunk-N3BZTUSJ.cjs');
3
+ var _chunkOWV4KVBMcjs = require('./chunk-OWV4KVBM.cjs');
4
4
 
5
5
 
6
- var _chunkOFGBTU45cjs = require('./chunk-OFGBTU45.cjs');
7
- require('./chunk-5SR5N75I.cjs');
6
+ var _chunkMGV75YLVcjs = require('./chunk-MGV75YLV.cjs');
7
+ require('./chunk-4CZ7W3RS.cjs');
8
8
 
9
9
 
10
10
 
@@ -66,4 +66,4 @@ var _chunkR6U6BHCVcjs = require('./chunk-R6U6BHCV.cjs');
66
66
 
67
67
 
68
68
 
69
- exports.CHAIN_BY_ID = _chunkR6U6BHCVcjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkR6U6BHCVcjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkR6U6BHCVcjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal = _chunkN3BZTUSJcjs.DepositModal; exports.NATIVE_TOKEN_ADDRESS = _chunkR6U6BHCVcjs.NATIVE_TOKEN_ADDRESS; exports.SOURCE_CHAINS = _chunkR6U6BHCVcjs.SOURCE_CHAINS; exports.SUPPORTED_CHAINS = _chunkR6U6BHCVcjs.SUPPORTED_CHAINS; exports.WithdrawModal = _chunkOFGBTU45cjs.WithdrawModal; exports.chainRegistry = _chunkR6U6BHCVcjs.chainRegistry; exports.findChainIdForToken = _chunkR6U6BHCVcjs.findChainIdForToken; exports.getChainBadge = _chunkR6U6BHCVcjs.getChainBadge; exports.getChainIcon = _chunkR6U6BHCVcjs.getChainIcon; exports.getChainId = _chunkR6U6BHCVcjs.getChainId; exports.getChainName = _chunkR6U6BHCVcjs.getChainName; exports.getChainObject = _chunkR6U6BHCVcjs.getChainObject; exports.getExplorerName = _chunkR6U6BHCVcjs.getExplorerName; exports.getExplorerTxUrl = _chunkR6U6BHCVcjs.getExplorerTxUrl; exports.getExplorerUrl = _chunkR6U6BHCVcjs.getExplorerUrl; exports.getSupportedChainIds = _chunkR6U6BHCVcjs.getSupportedChainIds; exports.getSupportedTargetTokens = _chunkR6U6BHCVcjs.getSupportedTargetTokens; exports.getSupportedTokenSymbolsForChain = _chunkR6U6BHCVcjs.getSupportedTokenSymbolsForChain; exports.getTargetTokenSymbolsForChain = _chunkR6U6BHCVcjs.getTargetTokenSymbolsForChain; exports.getTokenAddress = _chunkR6U6BHCVcjs.getTokenAddress; exports.getTokenDecimals = _chunkR6U6BHCVcjs.getTokenDecimals; exports.getTokenDecimalsByAddress = _chunkR6U6BHCVcjs.getTokenDecimalsByAddress; exports.getTokenIcon = _chunkR6U6BHCVcjs.getTokenIcon; exports.getTokenSymbol = _chunkR6U6BHCVcjs.getTokenSymbol; exports.getUsdcAddress = _chunkR6U6BHCVcjs.getUsdcAddress; exports.getUsdcDecimals = _chunkR6U6BHCVcjs.getUsdcDecimals; exports.isSupportedTokenAddressForChain = _chunkR6U6BHCVcjs.isSupportedTokenAddressForChain;
69
+ exports.CHAIN_BY_ID = _chunkR6U6BHCVcjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkR6U6BHCVcjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkR6U6BHCVcjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal = _chunkOWV4KVBMcjs.DepositModal; exports.NATIVE_TOKEN_ADDRESS = _chunkR6U6BHCVcjs.NATIVE_TOKEN_ADDRESS; exports.SOURCE_CHAINS = _chunkR6U6BHCVcjs.SOURCE_CHAINS; exports.SUPPORTED_CHAINS = _chunkR6U6BHCVcjs.SUPPORTED_CHAINS; exports.WithdrawModal = _chunkMGV75YLVcjs.WithdrawModal; exports.chainRegistry = _chunkR6U6BHCVcjs.chainRegistry; exports.findChainIdForToken = _chunkR6U6BHCVcjs.findChainIdForToken; exports.getChainBadge = _chunkR6U6BHCVcjs.getChainBadge; exports.getChainIcon = _chunkR6U6BHCVcjs.getChainIcon; exports.getChainId = _chunkR6U6BHCVcjs.getChainId; exports.getChainName = _chunkR6U6BHCVcjs.getChainName; exports.getChainObject = _chunkR6U6BHCVcjs.getChainObject; exports.getExplorerName = _chunkR6U6BHCVcjs.getExplorerName; exports.getExplorerTxUrl = _chunkR6U6BHCVcjs.getExplorerTxUrl; exports.getExplorerUrl = _chunkR6U6BHCVcjs.getExplorerUrl; exports.getSupportedChainIds = _chunkR6U6BHCVcjs.getSupportedChainIds; exports.getSupportedTargetTokens = _chunkR6U6BHCVcjs.getSupportedTargetTokens; exports.getSupportedTokenSymbolsForChain = _chunkR6U6BHCVcjs.getSupportedTokenSymbolsForChain; exports.getTargetTokenSymbolsForChain = _chunkR6U6BHCVcjs.getTargetTokenSymbolsForChain; exports.getTokenAddress = _chunkR6U6BHCVcjs.getTokenAddress; exports.getTokenDecimals = _chunkR6U6BHCVcjs.getTokenDecimals; exports.getTokenDecimalsByAddress = _chunkR6U6BHCVcjs.getTokenDecimalsByAddress; exports.getTokenIcon = _chunkR6U6BHCVcjs.getTokenIcon; exports.getTokenSymbol = _chunkR6U6BHCVcjs.getTokenSymbol; exports.getUsdcAddress = _chunkR6U6BHCVcjs.getUsdcAddress; exports.getUsdcDecimals = _chunkR6U6BHCVcjs.getUsdcDecimals; exports.isSupportedTokenAddressForChain = _chunkR6U6BHCVcjs.isSupportedTokenAddressForChain;
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DepositModal
3
- } from "./chunk-XVCPUB6K.mjs";
3
+ } from "./chunk-IYZGLNY6.mjs";
4
4
  import {
5
5
  WithdrawModal
6
- } from "./chunk-2IFX6ZEE.mjs";
7
- import "./chunk-TDTBAZNO.mjs";
6
+ } from "./chunk-RKRF7ANK.mjs";
7
+ import "./chunk-GAHX5RAT.mjs";
8
8
  import {
9
9
  CHAIN_BY_ID,
10
10
  DEFAULT_BACKEND_URL,
package/dist/reown.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkN3BZTUSJcjs = require('./chunk-N3BZTUSJ.cjs');
3
+ var _chunkOWV4KVBMcjs = require('./chunk-OWV4KVBM.cjs');
4
4
 
5
5
 
6
- var _chunkOFGBTU45cjs = require('./chunk-OFGBTU45.cjs');
7
- require('./chunk-5SR5N75I.cjs');
6
+ var _chunkMGV75YLVcjs = require('./chunk-MGV75YLV.cjs');
7
+ require('./chunk-4CZ7W3RS.cjs');
8
8
  require('./chunk-R6U6BHCV.cjs');
9
9
 
10
10
 
11
11
 
12
- exports.DepositModal = _chunkN3BZTUSJcjs.DepositModal; exports.WithdrawModal = _chunkOFGBTU45cjs.WithdrawModal;
12
+ exports.DepositModal = _chunkOWV4KVBMcjs.DepositModal; exports.WithdrawModal = _chunkMGV75YLVcjs.WithdrawModal;
package/dist/reown.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DepositModal
3
- } from "./chunk-XVCPUB6K.mjs";
3
+ } from "./chunk-IYZGLNY6.mjs";
4
4
  import {
5
5
  WithdrawModal
6
- } from "./chunk-2IFX6ZEE.mjs";
7
- import "./chunk-TDTBAZNO.mjs";
6
+ } from "./chunk-RKRF7ANK.mjs";
7
+ import "./chunk-GAHX5RAT.mjs";
8
8
  import "./chunk-CIXHTOO3.mjs";
9
9
  export {
10
10
  DepositModal,
package/dist/withdraw.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkOFGBTU45cjs = require('./chunk-OFGBTU45.cjs');
4
- require('./chunk-5SR5N75I.cjs');
3
+ var _chunkMGV75YLVcjs = require('./chunk-MGV75YLV.cjs');
4
+ require('./chunk-4CZ7W3RS.cjs');
5
5
  require('./chunk-R6U6BHCV.cjs');
6
6
 
7
7
 
8
- exports.WithdrawModal = _chunkOFGBTU45cjs.WithdrawModal;
8
+ exports.WithdrawModal = _chunkMGV75YLVcjs.WithdrawModal;
package/dist/withdraw.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  WithdrawModal
3
- } from "./chunk-2IFX6ZEE.mjs";
4
- import "./chunk-TDTBAZNO.mjs";
3
+ } from "./chunk-RKRF7ANK.mjs";
4
+ import "./chunk-GAHX5RAT.mjs";
5
5
  import "./chunk-CIXHTOO3.mjs";
6
6
  export {
7
7
  WithdrawModal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhinestone/deposit-modal",
3
- "version": "0.1.63",
3
+ "version": "0.1.65",
4
4
  "description": "React modal component for Rhinestone cross-chain deposits",
5
5
  "author": "Rhinestone <dev@rhinestone.wtf>",
6
6
  "bugs": {