@rhinestone/deposit-modal 0.1.69 → 0.1.70

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 @@
21
21
 
22
22
 
23
23
 
24
- var _chunkTCILEYM5cjs = require('./chunk-TCILEYM5.cjs');
24
+ var _chunkXW4M7WDIcjs = require('./chunk-XW4M7WDI.cjs');
25
25
 
26
26
 
27
27
 
@@ -127,7 +127,7 @@ function WithdrawFormStep({
127
127
  setIsSwitching(true);
128
128
  switchChain(asset.chainId).catch((err) => {
129
129
  const raw = err instanceof Error ? err.message : "Failed to switch chain";
130
- setError(_chunkTCILEYM5cjs.formatUserError.call(void 0, raw));
130
+ setError(_chunkXW4M7WDIcjs.formatUserError.call(void 0, raw));
131
131
  }).finally(() => {
132
132
  setIsSwitching(false);
133
133
  });
@@ -147,7 +147,7 @@ function WithdrawFormStep({
147
147
  return;
148
148
  }
149
149
  try {
150
- const bal = _chunkTCILEYM5cjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
150
+ const bal = _chunkXW4M7WDIcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
151
151
  address: asset.token,
152
152
  abi: _viem.erc20Abi,
153
153
  functionName: "balanceOf",
@@ -250,7 +250,7 @@ function WithdrawFormStep({
250
250
  await onSubmit(recipient, amount);
251
251
  } catch (err) {
252
252
  const raw = err instanceof Error ? err.message : "Withdrawal failed";
253
- setError(_chunkTCILEYM5cjs.formatUserError.call(void 0, raw));
253
+ setError(_chunkXW4M7WDIcjs.formatUserError.call(void 0, raw));
254
254
  } finally {
255
255
  setIsSubmitting(false);
256
256
  }
@@ -258,11 +258,11 @@ function WithdrawFormStep({
258
258
  if (isBalanceLoading) {
259
259
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
260
260
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-withdraw-loading", children: [
261
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTCILEYM5cjs.Spinner, { className: "rs-spinner--lg" }),
261
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.Spinner, { className: "rs-spinner--lg" }),
262
262
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-title", children: "Loading on-chain balance" }),
263
263
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: chainMismatch ? `Switch to ${_chunkMUWVDVY4cjs.getChainName.call(void 0, asset.chainId)} to continue.` : "Please wait before withdrawing." })
264
264
  ] }),
265
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTCILEYM5cjs.PoweredBy, {})
265
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.PoweredBy, {})
266
266
  ] });
267
267
  }
268
268
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
@@ -361,7 +361,7 @@ function WithdrawFormStep({
361
361
  ] })
362
362
  ] }),
363
363
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-amount-info", children: [
364
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunkTCILEYM5cjs.currencyFormatter.format(amountUsd) : "$0.00" }),
364
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunkXW4M7WDIcjs.currencyFormatter.format(amountUsd) : "$0.00" }),
365
365
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
366
366
  "Balance: ",
367
367
  formattedBalance,
@@ -555,7 +555,7 @@ function WithdrawFormStep({
555
555
  ] })
556
556
  ] }),
557
557
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
558
- _chunkTCILEYM5cjs.Button,
558
+ _chunkXW4M7WDIcjs.Button,
559
559
  {
560
560
  onClick: handleWithdraw,
561
561
  fullWidth: true,
@@ -564,7 +564,7 @@ function WithdrawFormStep({
564
564
  children: isBusy ? "Preparing..." : !recipient ? "Enter Recipient Address" : !amount ? "Enter Withdraw Amount" : "Withdraw"
565
565
  }
566
566
  ) }),
567
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTCILEYM5cjs.PoweredBy, {})
567
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.PoweredBy, {})
568
568
  ] });
569
569
  }
570
570
  WithdrawFormStep.displayName = "WithdrawFormStep";
@@ -891,27 +891,27 @@ function WithdrawFlow({
891
891
  onError,
892
892
  debug
893
893
  }) {
894
- const onStepChangeRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onStepChange);
895
- const onTotalBalanceChangeRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onTotalBalanceChange);
896
- const onEventRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onEvent);
897
- const onConnectedRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onConnected);
898
- const onWithdrawSubmittedRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onWithdrawSubmitted);
899
- const onWithdrawCompleteRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onWithdrawComplete);
900
- const onWithdrawFailedRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onWithdrawFailed);
901
- const onErrorRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onError);
894
+ const onStepChangeRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onStepChange);
895
+ const onTotalBalanceChangeRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onTotalBalanceChange);
896
+ const onEventRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onEvent);
897
+ const onConnectedRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onConnected);
898
+ const onWithdrawSubmittedRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onWithdrawSubmitted);
899
+ const onWithdrawCompleteRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onWithdrawComplete);
900
+ const onWithdrawFailedRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onWithdrawFailed);
901
+ const onErrorRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onError);
902
902
  const [step, setStep] = _react.useState.call(void 0, { type: "form" });
903
903
  const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
904
904
  const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
905
905
  const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
906
906
  const logFlow = _react.useCallback.call(void 0,
907
907
  (message, data) => {
908
- _chunkTCILEYM5cjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
908
+ _chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
909
909
  },
910
910
  [debug]
911
911
  );
912
912
  const logFlowError = _react.useCallback.call(void 0,
913
913
  (message, error, data) => {
914
- _chunkTCILEYM5cjs.debugError.call(void 0, debug, "withdraw-flow", message, error, data);
914
+ _chunkXW4M7WDIcjs.debugError.call(void 0, debug, "withdraw-flow", message, error, data);
915
915
  },
916
916
  [debug]
917
917
  );
@@ -970,14 +970,14 @@ function WithdrawFlow({
970
970
  return {
971
971
  ownerAddress: dappAddress,
972
972
  walletClient: _nullishCoalesce(dappWalletClient, () => ( void 0)),
973
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkTCILEYM5cjs.getPublicClient.call(void 0, sourceChain))),
973
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkXW4M7WDIcjs.getPublicClient.call(void 0, sourceChain))),
974
974
  switchChain: dappSwitchChain
975
975
  };
976
976
  }
977
977
  return {
978
978
  ownerAddress: dappWalletClient.account.address,
979
979
  walletClient: dappWalletClient,
980
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkTCILEYM5cjs.getPublicClient.call(void 0, sourceChain))),
980
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkXW4M7WDIcjs.getPublicClient.call(void 0, sourceChain))),
981
981
  switchChain: dappSwitchChain
982
982
  };
983
983
  }
@@ -988,7 +988,7 @@ function WithdrawFlow({
988
988
  return {
989
989
  ownerAddress: dappWalletClient.account.address,
990
990
  walletClient: dappWalletClient,
991
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkTCILEYM5cjs.getPublicClient.call(void 0, sourceChain))),
991
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkXW4M7WDIcjs.getPublicClient.call(void 0, sourceChain))),
992
992
  switchChain: dappSwitchChain
993
993
  };
994
994
  }
@@ -1018,7 +1018,7 @@ function WithdrawFlow({
1018
1018
  const symbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
1019
1019
  const decimals = _chunkMUWVDVY4cjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
1020
1020
  return {
1021
- id: _chunkTCILEYM5cjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
1021
+ id: _chunkXW4M7WDIcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
1022
1022
  chainId: sourceChain,
1023
1023
  token: sourceToken,
1024
1024
  symbol,
@@ -1090,15 +1090,15 @@ function WithdrawFlow({
1090
1090
  [logFlowError, onErrorRef]
1091
1091
  );
1092
1092
  const resolveSessionOwner = _react.useCallback.call(void 0, async (eoaAddress) => {
1093
- const localOwner = _chunkTCILEYM5cjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
1093
+ const localOwner = _chunkXW4M7WDIcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
1094
1094
  if (localOwner) {
1095
1095
  return {
1096
- account: _chunkTCILEYM5cjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
1096
+ account: _chunkXW4M7WDIcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
1097
1097
  address: localOwner.address
1098
1098
  };
1099
1099
  }
1100
- const created = _chunkTCILEYM5cjs.createSessionOwnerKey.call(void 0, );
1101
- _chunkTCILEYM5cjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
1100
+ const created = _chunkXW4M7WDIcjs.createSessionOwnerKey.call(void 0, );
1101
+ _chunkXW4M7WDIcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
1102
1102
  return {
1103
1103
  account: created.account,
1104
1104
  address: created.address
@@ -1138,7 +1138,7 @@ function WithdrawFlow({
1138
1138
  const setup = await service.setupAccount({
1139
1139
  ownerAddress: ownerAddress2,
1140
1140
  sessionOwnerAddress: sessionOwner.address,
1141
- targetChain: _chunkTCILEYM5cjs.toEvmCaip2.call(void 0, targetChain),
1141
+ targetChain: _chunkXW4M7WDIcjs.toEvmCaip2.call(void 0, targetChain),
1142
1142
  targetToken,
1143
1143
  recipient,
1144
1144
  signerAddress,
@@ -1166,7 +1166,7 @@ function WithdrawFlow({
1166
1166
  primaryType: typedData.primaryType,
1167
1167
  message: typedData.message
1168
1168
  });
1169
- const sessionDetails = _chunkTCILEYM5cjs.buildSessionDetails.call(void 0,
1169
+ const sessionDetails = _chunkXW4M7WDIcjs.buildSessionDetails.call(void 0,
1170
1170
  setup.sessionDetailsUnsigned,
1171
1171
  signature
1172
1172
  );
@@ -1180,7 +1180,7 @@ function WithdrawFlow({
1180
1180
  eoaAddress: ownerAddress2,
1181
1181
  sessionOwner: sessionOwner.address,
1182
1182
  target: {
1183
- chain: _chunkTCILEYM5cjs.toEvmCaip2.call(void 0, targetChain),
1183
+ chain: _chunkXW4M7WDIcjs.toEvmCaip2.call(void 0, targetChain),
1184
1184
  token: targetToken,
1185
1185
  recipient
1186
1186
  }
@@ -1189,7 +1189,7 @@ function WithdrawFlow({
1189
1189
  }
1190
1190
  handleConnected(ownerAddress2, smartAccount);
1191
1191
  const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
1192
- const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _34 => _34.publicClient]), () => ( _chunkTCILEYM5cjs.getPublicClient.call(void 0, sourceChain)));
1192
+ const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _34 => _34.publicClient]), () => ( _chunkXW4M7WDIcjs.getPublicClient.call(void 0, sourceChain)));
1193
1193
  let result;
1194
1194
  if (onSignTransaction) {
1195
1195
  const transferTarget = isSameRoute ? recipient : smartAccount;
@@ -1213,7 +1213,7 @@ function WithdrawFlow({
1213
1213
  const { signature } = await onSignTransaction(request);
1214
1214
  const relayResult = await service.relayWithdraw({
1215
1215
  smartAccount,
1216
- chainId: _chunkTCILEYM5cjs.toEvmCaip2.call(void 0, sourceChain),
1216
+ chainId: _chunkXW4M7WDIcjs.toEvmCaip2.call(void 0, sourceChain),
1217
1217
  safeAddress,
1218
1218
  safeTransaction: request.typedData.message,
1219
1219
  signature
@@ -1272,7 +1272,7 @@ function WithdrawFlow({
1272
1272
  targetChain,
1273
1273
  targetToken
1274
1274
  });
1275
- handleError(_chunkTCILEYM5cjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
1275
+ handleError(_chunkXW4M7WDIcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
1276
1276
  throw err;
1277
1277
  } finally {
1278
1278
  setIsSubmitting(false);
@@ -1411,7 +1411,7 @@ function WithdrawFlow({
1411
1411
  }, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _51 => _51.icon])]);
1412
1412
  if (showConnectStep) {
1413
1413
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1414
- _chunkTCILEYM5cjs.ConnectStep,
1414
+ _chunkXW4M7WDIcjs.ConnectStep,
1415
1415
  {
1416
1416
  walletOptions,
1417
1417
  selectedWalletId: selectedWalletIdEffective,
@@ -1432,7 +1432,7 @@ function WithdrawFlow({
1432
1432
  if (!signerContext) return null;
1433
1433
  if (!onSignTransaction && !signerContext.walletClient) return null;
1434
1434
  const resolvedConnectedRecipient = _optionalChain([selectedWalletOption, 'optionalAccess', _52 => _52.kind]) === "external" ? selectedWalletOption.address : void 0;
1435
- const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkTCILEYM5cjs.getPublicClient.call(void 0, sourceChain)));
1435
+ const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkXW4M7WDIcjs.getPublicClient.call(void 0, sourceChain)));
1436
1436
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
1437
1437
  step.type === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1438
1438
  WithdrawFormStep,
@@ -1458,7 +1458,7 @@ function WithdrawFlow({
1458
1458
  }
1459
1459
  ),
1460
1460
  step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1461
- _chunkTCILEYM5cjs.ProcessingStep,
1461
+ _chunkXW4M7WDIcjs.ProcessingStep,
1462
1462
  {
1463
1463
  smartAccount: step.smartAccount,
1464
1464
  txHash: step.txHash,
@@ -1485,7 +1485,7 @@ function WithdrawFlow({
1485
1485
  // src/WithdrawModal.tsx
1486
1486
 
1487
1487
  var ReownWithdrawInner = _react.lazy.call(void 0,
1488
- () => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-WIV5IEIW.cjs"))).then((m) => ({
1488
+ () => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-HXTXSZCJ.cjs"))).then((m) => ({
1489
1489
  default: m.WithdrawModalReown
1490
1490
  }))
1491
1491
  );
@@ -1538,19 +1538,19 @@ function WithdrawModalInner({
1538
1538
  debug
1539
1539
  }) {
1540
1540
  const modalRef = _react.useRef.call(void 0, null);
1541
- const onReadyRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onReady);
1541
+ const onReadyRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onReady);
1542
1542
  const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
1543
1543
  const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
1544
1544
  const backHandlerRef = _react.useRef.call(void 0, void 0);
1545
1545
  const targetChain = _chunkMUWVDVY4cjs.getChainId.call(void 0, targetChainProp);
1546
1546
  const sourceChain = _chunkMUWVDVY4cjs.getChainId.call(void 0, sourceChainProp);
1547
1547
  const service = _react.useMemo.call(void 0,
1548
- () => _chunkTCILEYM5cjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:withdraw" }),
1548
+ () => _chunkXW4M7WDIcjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:withdraw" }),
1549
1549
  [backendUrl, debug]
1550
1550
  );
1551
1551
  _react.useEffect.call(void 0, () => {
1552
1552
  if (isOpen && modalRef.current) {
1553
- _chunkTCILEYM5cjs.applyTheme.call(void 0, modalRef.current, theme);
1553
+ _chunkXW4M7WDIcjs.applyTheme.call(void 0, modalRef.current, theme);
1554
1554
  }
1555
1555
  }, [isOpen, theme]);
1556
1556
  _react.useEffect.call(void 0, () => {
@@ -1584,7 +1584,7 @@ function WithdrawModalInner({
1584
1584
  const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _62 => _62.title]), () => ( "Withdraw"));
1585
1585
  const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
1586
1586
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1587
- _chunkTCILEYM5cjs.Modal,
1587
+ _chunkXW4M7WDIcjs.Modal,
1588
1588
  {
1589
1589
  isOpen,
1590
1590
  onClose,
@@ -1643,7 +1643,7 @@ function WithdrawModalInner({
1643
1643
  ] }),
1644
1644
  balance && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-balance", children: [
1645
1645
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-label", children: balance.title }),
1646
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkTCILEYM5cjs.currencyFormatter.format(totalBalanceUsd) : null))) })
1646
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkXW4M7WDIcjs.currencyFormatter.format(totalBalanceUsd) : null))) })
1647
1647
  ] })
1648
1648
  ] }),
1649
1649
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -21,7 +21,7 @@ import {
21
21
  saveSessionOwnerToStorage,
22
22
  toEvmCaip2,
23
23
  useLatestRef
24
- } from "./chunk-DA3XVDNQ.mjs";
24
+ } from "./chunk-3CRG5NPG.mjs";
25
25
  import {
26
26
  DEFAULT_BACKEND_URL,
27
27
  DEFAULT_SIGNER_ADDRESS,
@@ -1485,7 +1485,7 @@ function WithdrawFlow({
1485
1485
  // src/WithdrawModal.tsx
1486
1486
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1487
1487
  var ReownWithdrawInner = lazy(
1488
- () => import("./WithdrawModalReown-6ZBCJOPK.mjs").then((m) => ({
1488
+ () => import("./WithdrawModalReown-URF6AERQ.mjs").then((m) => ({
1489
1489
  default: m.WithdrawModalReown
1490
1490
  }))
1491
1491
  );