@rhinestone/deposit-modal 0.1.27 → 0.1.28

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.
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk7MQU2SR7cjs = require('./chunk-7MQU2SR7.cjs');
3
+ var _chunkXJ4G6RO6cjs = require('./chunk-XJ4G6RO6.cjs');
4
4
 
5
5
 
6
6
 
7
7
  var _chunk6VJ2ZTNQcjs = require('./chunk-6VJ2ZTNQ.cjs');
8
- require('./chunk-QWYZJL3L.cjs');
8
+ require('./chunk-VW3QQWEL.cjs');
9
9
  require('./chunk-CEIWN53N.cjs');
10
10
 
11
11
  // src/DepositModalReown.tsx
@@ -17,7 +17,7 @@ function DepositModalWithReown(props) {
17
17
  reown.openConnect();
18
18
  }, [reown.openConnect]);
19
19
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
20
- _chunk7MQU2SR7cjs.DepositModalInner,
20
+ _chunkXJ4G6RO6cjs.DepositModalInner,
21
21
  {
22
22
  ...props,
23
23
  reownWallet: reown,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  DepositModalInner
3
- } from "./chunk-AJALMXW4.mjs";
3
+ } from "./chunk-YXTWMYHK.mjs";
4
4
  import {
5
5
  ReownWalletProvider,
6
6
  useReownWallet
7
7
  } from "./chunk-LBEP3A2Z.mjs";
8
- import "./chunk-YOFGP4FV.mjs";
8
+ import "./chunk-RQSAANC3.mjs";
9
9
  import "./chunk-A6QLADED.mjs";
10
10
 
11
11
  // src/DepositModalReown.tsx
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkXIS33BZ6cjs = require('./chunk-XIS33BZ6.cjs');
3
+ var _chunkLP6DQCKVcjs = require('./chunk-LP6DQCKV.cjs');
4
4
 
5
5
 
6
6
 
7
7
  var _chunk6VJ2ZTNQcjs = require('./chunk-6VJ2ZTNQ.cjs');
8
- require('./chunk-QWYZJL3L.cjs');
8
+ require('./chunk-VW3QQWEL.cjs');
9
9
  require('./chunk-CEIWN53N.cjs');
10
10
 
11
11
  // src/WithdrawModalReown.tsx
@@ -17,7 +17,7 @@ function WithdrawModalWithReown(props) {
17
17
  reown.openConnect();
18
18
  }, [reown.openConnect]);
19
19
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
20
- _chunkXIS33BZ6cjs.WithdrawModalInner,
20
+ _chunkLP6DQCKVcjs.WithdrawModalInner,
21
21
  {
22
22
  ...props,
23
23
  reownWallet: reown,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  WithdrawModalInner
3
- } from "./chunk-QCRZCGAE.mjs";
3
+ } from "./chunk-XF7M4TTT.mjs";
4
4
  import {
5
5
  ReownWalletProvider,
6
6
  useReownWallet
7
7
  } from "./chunk-LBEP3A2Z.mjs";
8
- import "./chunk-YOFGP4FV.mjs";
8
+ import "./chunk-RQSAANC3.mjs";
9
9
  import "./chunk-A6QLADED.mjs";
10
10
 
11
11
  // src/WithdrawModalReown.tsx
@@ -16,7 +16,7 @@
16
16
 
17
17
 
18
18
 
19
- var _chunkQWYZJL3Lcjs = require('./chunk-QWYZJL3L.cjs');
19
+ var _chunkVW3QQWELcjs = require('./chunk-VW3QQWEL.cjs');
20
20
 
21
21
 
22
22
 
@@ -110,7 +110,7 @@ function WithdrawFormStep({
110
110
  setIsSwitching(true);
111
111
  switchChain(asset.chainId).catch((err) => {
112
112
  const raw = err instanceof Error ? err.message : "Failed to switch chain";
113
- setError(_chunkQWYZJL3Lcjs.formatUserError.call(void 0, raw));
113
+ setError(_chunkVW3QQWELcjs.formatUserError.call(void 0, raw));
114
114
  }).finally(() => {
115
115
  setIsSwitching(false);
116
116
  });
@@ -127,7 +127,7 @@ function WithdrawFormStep({
127
127
  return;
128
128
  }
129
129
  try {
130
- const bal = _chunkQWYZJL3Lcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
130
+ const bal = _chunkVW3QQWELcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
131
131
  address: asset.token,
132
132
  abi: _viem.erc20Abi,
133
133
  functionName: "balanceOf",
@@ -229,7 +229,7 @@ function WithdrawFormStep({
229
229
  await onSubmit(recipient, amount);
230
230
  } catch (err) {
231
231
  const raw = err instanceof Error ? err.message : "Withdrawal failed";
232
- setError(_chunkQWYZJL3Lcjs.formatUserError.call(void 0, raw));
232
+ setError(_chunkVW3QQWELcjs.formatUserError.call(void 0, raw));
233
233
  } finally {
234
234
  setIsSubmitting(false);
235
235
  }
@@ -241,7 +241,7 @@ function WithdrawFormStep({
241
241
  await switchChain(asset.chainId);
242
242
  } catch (err) {
243
243
  const raw = err instanceof Error ? err.message : "Failed to switch chain";
244
- setError(_chunkQWYZJL3Lcjs.formatUserError.call(void 0, raw));
244
+ setError(_chunkVW3QQWELcjs.formatUserError.call(void 0, raw));
245
245
  } finally {
246
246
  setIsSwitching(false);
247
247
  }
@@ -331,7 +331,7 @@ function WithdrawFormStep({
331
331
  ] })
332
332
  ] }),
333
333
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-amount-info", children: [
334
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunkQWYZJL3Lcjs.currencyFormatter.format(amountUsd) : "$0.00" }),
334
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunkVW3QQWELcjs.currencyFormatter.format(amountUsd) : "$0.00" }),
335
335
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
336
336
  formattedBalance,
337
337
  " ",
@@ -508,7 +508,7 @@ function WithdrawFormStep({
508
508
  " to continue."
509
509
  ] }),
510
510
  switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
511
- _chunkQWYZJL3Lcjs.Button,
511
+ _chunkVW3QQWELcjs.Button,
512
512
  {
513
513
  variant: "outline",
514
514
  size: "small",
@@ -540,7 +540,7 @@ function WithdrawFormStep({
540
540
  ] })
541
541
  ] }),
542
542
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
543
- _chunkQWYZJL3Lcjs.Button,
543
+ _chunkVW3QQWELcjs.Button,
544
544
  {
545
545
  onClick: handleWithdraw,
546
546
  fullWidth: true,
@@ -549,7 +549,7 @@ function WithdrawFormStep({
549
549
  children: isBusy ? "Preparing..." : "Withdraw"
550
550
  }
551
551
  ) }),
552
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQWYZJL3Lcjs.PoweredBy, {})
552
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVW3QQWELcjs.PoweredBy, {})
553
553
  ] });
554
554
  }
555
555
  WithdrawFormStep.displayName = "WithdrawFormStep";
@@ -923,14 +923,14 @@ function WithdrawFlow({
923
923
  return {
924
924
  ownerAddress: dappAddress,
925
925
  walletClient: _nullishCoalesce(dappWalletClient, () => ( void 0)),
926
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkQWYZJL3Lcjs.getPublicClient.call(void 0, sourceChain))),
926
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkVW3QQWELcjs.getPublicClient.call(void 0, sourceChain))),
927
927
  switchChain: dappSwitchChain
928
928
  };
929
929
  }
930
930
  return {
931
931
  ownerAddress: dappWalletClient.account.address,
932
932
  walletClient: dappWalletClient,
933
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkQWYZJL3Lcjs.getPublicClient.call(void 0, sourceChain))),
933
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkVW3QQWELcjs.getPublicClient.call(void 0, sourceChain))),
934
934
  switchChain: dappSwitchChain
935
935
  };
936
936
  }
@@ -939,7 +939,7 @@ function WithdrawFlow({
939
939
  return {
940
940
  ownerAddress: dappWalletClient.account.address,
941
941
  walletClient: dappWalletClient,
942
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkQWYZJL3Lcjs.getPublicClient.call(void 0, sourceChain))),
942
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkVW3QQWELcjs.getPublicClient.call(void 0, sourceChain))),
943
943
  switchChain: dappSwitchChain
944
944
  };
945
945
  }
@@ -968,7 +968,7 @@ function WithdrawFlow({
968
968
  const symbol = _chunkCEIWN53Ncjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
969
969
  const decimals = _chunkCEIWN53Ncjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
970
970
  return {
971
- id: _chunkQWYZJL3Lcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
971
+ id: _chunkVW3QQWELcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
972
972
  chainId: sourceChain,
973
973
  token: sourceToken,
974
974
  symbol,
@@ -998,15 +998,15 @@ function WithdrawFlow({
998
998
  [onError]
999
999
  );
1000
1000
  const resolveSessionOwner = _react.useCallback.call(void 0, async (eoaAddress) => {
1001
- const localOwner = _chunkQWYZJL3Lcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
1001
+ const localOwner = _chunkVW3QQWELcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
1002
1002
  if (localOwner) {
1003
1003
  return {
1004
- account: _chunkQWYZJL3Lcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
1004
+ account: _chunkVW3QQWELcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
1005
1005
  address: localOwner.address
1006
1006
  };
1007
1007
  }
1008
- const created = _chunkQWYZJL3Lcjs.createSessionOwnerKey.call(void 0, );
1009
- _chunkQWYZJL3Lcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
1008
+ const created = _chunkVW3QQWELcjs.createSessionOwnerKey.call(void 0, );
1009
+ _chunkVW3QQWELcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
1010
1010
  return {
1011
1011
  account: created.account,
1012
1012
  address: created.address
@@ -1024,23 +1024,21 @@ function WithdrawFlow({
1024
1024
  setIsSubmitting(true);
1025
1025
  try {
1026
1026
  const sessionOwner = await resolveSessionOwner(ownerAddress2);
1027
- const computed = await service.computeAddress(
1028
- ownerAddress2,
1029
- sessionOwner.address
1030
- );
1031
- const smartAccount = computed.smartAccount;
1032
- const checkResult = await service.checkAccount(smartAccount);
1033
- const targetMatches = checkResult.targetChain === targetChain && _optionalChain([checkResult, 'access', _24 => _24.targetToken, 'optionalAccess', _25 => _25.toLowerCase, 'call', _26 => _26()]) === targetToken.toLowerCase();
1034
- if (!checkResult.isRegistered || forceRegister || !targetMatches) {
1035
- const prepared = await service.prepareAccount({
1036
- ownerAddress: ownerAddress2,
1037
- sessionOwnerAddress: sessionOwner.address,
1038
- targetChain,
1039
- targetToken,
1040
- signerAddress,
1041
- sessionChainIds
1042
- });
1043
- const typedData = prepared.sessionDetailsUnsigned.data;
1027
+ const setup = await service.setupAccount({
1028
+ ownerAddress: ownerAddress2,
1029
+ sessionOwnerAddress: sessionOwner.address,
1030
+ targetChain,
1031
+ targetToken,
1032
+ signerAddress,
1033
+ sessionChainIds,
1034
+ forceRegister
1035
+ });
1036
+ const smartAccount = setup.smartAccount;
1037
+ if (setup.needsRegistration) {
1038
+ if (!setup.accountParams || !setup.sessionDetailsUnsigned) {
1039
+ throw new Error("Missing registration payload from setup-account");
1040
+ }
1041
+ const typedData = setup.sessionDetailsUnsigned.data;
1044
1042
  if (!sessionOwner.account.signTypedData) {
1045
1043
  throw new Error(
1046
1044
  "Session owner account does not support signTypedData"
@@ -1052,15 +1050,12 @@ function WithdrawFlow({
1052
1050
  primaryType: typedData.primaryType,
1053
1051
  message: typedData.message
1054
1052
  });
1055
- const sessionDetails = _chunkQWYZJL3Lcjs.buildSessionDetails.call(void 0,
1056
- prepared.sessionDetailsUnsigned,
1057
- signature
1058
- );
1053
+ const sessionDetails = _chunkVW3QQWELcjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
1059
1054
  await service.registerAccount({
1060
1055
  address: smartAccount,
1061
1056
  accountParams: {
1062
- factory: prepared.accountParams.factory,
1063
- factoryData: prepared.accountParams.factoryData,
1057
+ factory: setup.accountParams.factory,
1058
+ factoryData: setup.accountParams.factoryData,
1064
1059
  sessionDetails
1065
1060
  },
1066
1061
  eoaAddress: ownerAddress2,
@@ -1074,7 +1069,7 @@ function WithdrawFlow({
1074
1069
  }
1075
1070
  handleConnected(ownerAddress2, smartAccount);
1076
1071
  const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
1077
- const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _27 => _27.publicClient]), () => ( _chunkQWYZJL3Lcjs.getPublicClient.call(void 0, sourceChain)));
1072
+ const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _24 => _24.publicClient]), () => ( _chunkVW3QQWELcjs.getPublicClient.call(void 0, sourceChain)));
1078
1073
  let result;
1079
1074
  if (onSignTransaction) {
1080
1075
  const transferData = isSourceNative ? { to: smartAccount, value: amountUnits, data: "0x" } : {
@@ -1126,7 +1121,7 @@ function WithdrawFlow({
1126
1121
  chainId: sourceChain
1127
1122
  });
1128
1123
  }
1129
- _optionalChain([onWithdrawSubmitted, 'optionalCall', _28 => _28({
1124
+ _optionalChain([onWithdrawSubmitted, 'optionalCall', _25 => _25({
1130
1125
  txHash: result.txHash,
1131
1126
  sourceChain,
1132
1127
  amount: amountUnits.toString(),
@@ -1142,7 +1137,7 @@ function WithdrawFlow({
1142
1137
  });
1143
1138
  } catch (err) {
1144
1139
  const raw = err instanceof Error ? err.message : "Withdraw failed";
1145
- handleError(_chunkQWYZJL3Lcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
1140
+ handleError(_chunkVW3QQWELcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
1146
1141
  throw err;
1147
1142
  } finally {
1148
1143
  setIsSubmitting(false);
@@ -1170,13 +1165,13 @@ function WithdrawFlow({
1170
1165
  );
1171
1166
  const handleWithdrawComplete = _react.useCallback.call(void 0,
1172
1167
  (txHash, destinationTxHash) => {
1173
- _optionalChain([onWithdrawComplete, 'optionalCall', _29 => _29({ txHash, destinationTxHash })]);
1168
+ _optionalChain([onWithdrawComplete, 'optionalCall', _26 => _26({ txHash, destinationTxHash })]);
1174
1169
  },
1175
1170
  [onWithdrawComplete]
1176
1171
  );
1177
1172
  const handleWithdrawFailed = _react.useCallback.call(void 0,
1178
1173
  (txHash, error) => {
1179
- _optionalChain([onWithdrawFailed, 'optionalCall', _30 => _30({ txHash, error })]);
1174
+ _optionalChain([onWithdrawFailed, 'optionalCall', _27 => _27({ txHash, error })]);
1180
1175
  },
1181
1176
  [onWithdrawFailed]
1182
1177
  );
@@ -1234,7 +1229,7 @@ function WithdrawFlow({
1234
1229
  }, [walletOptionsKey, selectedConnectAddressEffective]);
1235
1230
  if (showConnectStep) {
1236
1231
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1237
- _chunkQWYZJL3Lcjs.ConnectStep,
1232
+ _chunkVW3QQWELcjs.ConnectStep,
1238
1233
  {
1239
1234
  walletOptions,
1240
1235
  selectedAddress: selectedConnectAddressEffective,
@@ -1254,7 +1249,7 @@ function WithdrawFlow({
1254
1249
  if (!signerContext) return null;
1255
1250
  if (!onSignTransaction && !signerContext.walletClient) return null;
1256
1251
  const ownerAddress = signerContext.ownerAddress;
1257
- const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkQWYZJL3Lcjs.getPublicClient.call(void 0, sourceChain)));
1252
+ const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkVW3QQWELcjs.getPublicClient.call(void 0, sourceChain)));
1258
1253
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
1259
1254
  step.type === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1260
1255
  WithdrawFormStep,
@@ -1279,7 +1274,7 @@ function WithdrawFlow({
1279
1274
  }
1280
1275
  ),
1281
1276
  step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1282
- _chunkQWYZJL3Lcjs.ProcessingStep,
1277
+ _chunkVW3QQWELcjs.ProcessingStep,
1283
1278
  {
1284
1279
  smartAccount: step.smartAccount,
1285
1280
  txHash: step.txHash,
@@ -1305,7 +1300,7 @@ function WithdrawFlow({
1305
1300
  // src/WithdrawModal.tsx
1306
1301
 
1307
1302
  var ReownWithdrawInner = _react.lazy.call(void 0,
1308
- () => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-BA6ECON3.cjs"))).then((m) => ({
1303
+ () => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-GMIE6AWA.cjs"))).then((m) => ({
1309
1304
  default: m.WithdrawModalReown
1310
1305
  }))
1311
1306
  );
@@ -1359,17 +1354,17 @@ function WithdrawModalInner({
1359
1354
  const backHandlerRef = _react.useRef.call(void 0, void 0);
1360
1355
  const targetChain = _chunkCEIWN53Ncjs.getChainId.call(void 0, targetChainProp);
1361
1356
  const sourceChain = _chunkCEIWN53Ncjs.getChainId.call(void 0, sourceChainProp);
1362
- const service = _react.useMemo.call(void 0, () => _chunkQWYZJL3Lcjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
1357
+ const service = _react.useMemo.call(void 0, () => _chunkVW3QQWELcjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
1363
1358
  _react.useEffect.call(void 0, () => {
1364
1359
  if (isOpen && modalRef.current) {
1365
- _chunkQWYZJL3Lcjs.applyTheme.call(void 0, modalRef.current, theme);
1360
+ _chunkVW3QQWELcjs.applyTheme.call(void 0, modalRef.current, theme);
1366
1361
  }
1367
1362
  }, [isOpen, theme]);
1368
1363
  const hasCalledReady = _react.useRef.call(void 0, false);
1369
1364
  _react.useEffect.call(void 0, () => {
1370
1365
  if (isOpen && !hasCalledReady.current) {
1371
1366
  hasCalledReady.current = true;
1372
- _optionalChain([onReady, 'optionalCall', _31 => _31()]);
1367
+ _optionalChain([onReady, 'optionalCall', _28 => _28()]);
1373
1368
  }
1374
1369
  }, [isOpen, onReady]);
1375
1370
  _react.useEffect.call(void 0, () => {
@@ -1388,17 +1383,17 @@ function WithdrawModalInner({
1388
1383
  setTotalBalanceUsd(balance);
1389
1384
  }, []);
1390
1385
  const handleBack = _react.useCallback.call(void 0, () => {
1391
- _optionalChain([backHandlerRef, 'access', _32 => _32.current, 'optionalCall', _33 => _33()]);
1386
+ _optionalChain([backHandlerRef, 'access', _29 => _29.current, 'optionalCall', _30 => _30()]);
1392
1387
  }, []);
1393
- const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _34 => _34.showLogo]), () => ( false));
1394
- const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _35 => _35.showStepper]), () => ( false));
1395
- const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _36 => _36.showBackButton]), () => ( true));
1396
- const balanceTitle = _optionalChain([uiConfig, 'optionalAccess', _37 => _37.balanceTitle]);
1397
- const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _38 => _38.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
1398
- const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _39 => _39.title]), () => ( "Withdraw"));
1388
+ const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _31 => _31.showLogo]), () => ( false));
1389
+ const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _32 => _32.showStepper]), () => ( false));
1390
+ const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _33 => _33.showBackButton]), () => ( true));
1391
+ const balanceTitle = _optionalChain([uiConfig, 'optionalAccess', _34 => _34.balanceTitle]);
1392
+ const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _35 => _35.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
1393
+ const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _36 => _36.title]), () => ( "Withdraw"));
1399
1394
  const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
1400
1395
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1401
- _chunkQWYZJL3Lcjs.Modal,
1396
+ _chunkVW3QQWELcjs.Modal,
1402
1397
  {
1403
1398
  isOpen,
1404
1399
  onClose,
@@ -1456,7 +1451,7 @@ function WithdrawModalInner({
1456
1451
  ] }),
1457
1452
  balanceTitle && totalBalanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-balance", children: [
1458
1453
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-label", children: balanceTitle }),
1459
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _chunkQWYZJL3Lcjs.currencyFormatter.format(totalBalanceUsd) })
1454
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _chunkVW3QQWELcjs.currencyFormatter.format(totalBalanceUsd) })
1460
1455
  ] })
1461
1456
  ] }),
1462
1457
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -180,12 +180,16 @@ function normalizeSessionTypedData(raw) {
180
180
  }
181
181
  return data;
182
182
  }
183
- function normalizePrepareAccountResponse(raw) {
183
+ function normalizeSetupAccountResponse(raw) {
184
184
  const data = raw;
185
185
  return {
186
186
  smartAccount: data.smartAccount,
187
+ isRegistered: data.isRegistered,
188
+ targetChain: data.targetChain,
189
+ targetToken: data.targetToken,
190
+ needsRegistration: data.needsRegistration,
187
191
  accountParams: data.accountParams,
188
- sessionDetailsUnsigned: {
192
+ sessionDetailsUnsigned: data.sessionDetailsUnsigned ? {
189
193
  hashesAndChainIds: data.sessionDetailsUnsigned.hashesAndChainIds.map(
190
194
  (h) => ({
191
195
  chainId: toBigInt(h.chainId),
@@ -193,7 +197,7 @@ function normalizePrepareAccountResponse(raw) {
193
197
  })
194
198
  ),
195
199
  data: normalizeSessionTypedData(data.sessionDetailsUnsigned.data)
196
- }
200
+ } : void 0
197
201
  };
198
202
  }
199
203
  function buildSessionDetails(unsigned, signature) {
@@ -212,22 +216,8 @@ function createDepositService(baseUrl) {
212
216
  return `${normalizedBaseUrl}${normalizedPath}`;
213
217
  }
214
218
  return {
215
- async computeAddress(ownerAddress, sessionOwnerAddress) {
216
- const response = await fetch(apiUrl("/compute-address"), {
217
- method: "POST",
218
- headers: { "Content-Type": "application/json" },
219
- body: JSON.stringify({ ownerAddress, sessionOwnerAddress })
220
- });
221
- if (!response.ok) {
222
- const error = await response.json().catch(() => ({ error: "Unknown error" }));
223
- throw new Error(
224
- error.error || `Compute address failed: ${response.status}`
225
- );
226
- }
227
- return response.json();
228
- },
229
- async prepareAccount(params) {
230
- const response = await fetch(apiUrl("/prepare-account"), {
219
+ async setupAccount(params) {
220
+ const response = await fetch(apiUrl("/setup-account"), {
231
221
  method: "POST",
232
222
  headers: { "Content-Type": "application/json" },
233
223
  body: JSON.stringify(params)
@@ -235,10 +225,10 @@ function createDepositService(baseUrl) {
235
225
  if (!response.ok) {
236
226
  const error = await response.json().catch(() => ({ error: "Unknown error" }));
237
227
  throw new Error(
238
- error.error || `Prepare account failed: ${response.status}`
228
+ error.error || `Setup account failed: ${response.status}`
239
229
  );
240
230
  }
241
- return normalizePrepareAccountResponse(await response.json());
231
+ return normalizeSetupAccountResponse(await response.json());
242
232
  },
243
233
  async registerAccount(params) {
244
234
  const { eoaAddress, sessionOwner, ...account } = params;
@@ -262,17 +252,6 @@ function createDepositService(baseUrl) {
262
252
  }
263
253
  return response.json();
264
254
  },
265
- async checkAccount(address) {
266
- const response = await fetch(apiUrl(`/check/${address}`), {
267
- method: "GET",
268
- headers: { "Content-Type": "application/json" }
269
- });
270
- if (!response.ok) {
271
- const error = await response.json().catch(() => ({ error: "Unknown error" }));
272
- throw new Error(error.error || `Check failed: ${response.status}`);
273
- }
274
- return response.json();
275
- },
276
255
  async fetchPortfolio(address) {
277
256
  const response = await fetch(apiUrl(`/portfolio/${address}`), {
278
257
  method: "GET",
@@ -180,12 +180,16 @@ function normalizeSessionTypedData(raw) {
180
180
  }
181
181
  return data;
182
182
  }
183
- function normalizePrepareAccountResponse(raw) {
183
+ function normalizeSetupAccountResponse(raw) {
184
184
  const data = raw;
185
185
  return {
186
186
  smartAccount: data.smartAccount,
187
+ isRegistered: data.isRegistered,
188
+ targetChain: data.targetChain,
189
+ targetToken: data.targetToken,
190
+ needsRegistration: data.needsRegistration,
187
191
  accountParams: data.accountParams,
188
- sessionDetailsUnsigned: {
192
+ sessionDetailsUnsigned: data.sessionDetailsUnsigned ? {
189
193
  hashesAndChainIds: data.sessionDetailsUnsigned.hashesAndChainIds.map(
190
194
  (h) => ({
191
195
  chainId: toBigInt(h.chainId),
@@ -193,7 +197,7 @@ function normalizePrepareAccountResponse(raw) {
193
197
  })
194
198
  ),
195
199
  data: normalizeSessionTypedData(data.sessionDetailsUnsigned.data)
196
- }
200
+ } : void 0
197
201
  };
198
202
  }
199
203
  function buildSessionDetails(unsigned, signature) {
@@ -212,22 +216,8 @@ function createDepositService(baseUrl) {
212
216
  return `${normalizedBaseUrl}${normalizedPath}`;
213
217
  }
214
218
  return {
215
- async computeAddress(ownerAddress, sessionOwnerAddress) {
216
- const response = await fetch(apiUrl("/compute-address"), {
217
- method: "POST",
218
- headers: { "Content-Type": "application/json" },
219
- body: JSON.stringify({ ownerAddress, sessionOwnerAddress })
220
- });
221
- if (!response.ok) {
222
- const error = await response.json().catch(() => ({ error: "Unknown error" }));
223
- throw new Error(
224
- error.error || `Compute address failed: ${response.status}`
225
- );
226
- }
227
- return response.json();
228
- },
229
- async prepareAccount(params) {
230
- const response = await fetch(apiUrl("/prepare-account"), {
219
+ async setupAccount(params) {
220
+ const response = await fetch(apiUrl("/setup-account"), {
231
221
  method: "POST",
232
222
  headers: { "Content-Type": "application/json" },
233
223
  body: JSON.stringify(params)
@@ -235,10 +225,10 @@ function createDepositService(baseUrl) {
235
225
  if (!response.ok) {
236
226
  const error = await response.json().catch(() => ({ error: "Unknown error" }));
237
227
  throw new Error(
238
- error.error || `Prepare account failed: ${response.status}`
228
+ error.error || `Setup account failed: ${response.status}`
239
229
  );
240
230
  }
241
- return normalizePrepareAccountResponse(await response.json());
231
+ return normalizeSetupAccountResponse(await response.json());
242
232
  },
243
233
  async registerAccount(params) {
244
234
  const { eoaAddress, sessionOwner, ...account } = params;
@@ -262,17 +252,6 @@ function createDepositService(baseUrl) {
262
252
  }
263
253
  return response.json();
264
254
  },
265
- async checkAccount(address) {
266
- const response = await fetch(apiUrl(`/check/${address}`), {
267
- method: "GET",
268
- headers: { "Content-Type": "application/json" }
269
- });
270
- if (!response.ok) {
271
- const error = await response.json().catch(() => ({ error: "Unknown error" }));
272
- throw new Error(error.error || `Check failed: ${response.status}`);
273
- }
274
- return response.json();
275
- },
276
255
  async fetchPortfolio(address) {
277
256
  const response = await fetch(apiUrl(`/portfolio/${address}`), {
278
257
  method: "GET",
@@ -16,7 +16,7 @@ import {
16
16
  isNativeAsset,
17
17
  loadSessionOwnerFromStorage,
18
18
  saveSessionOwnerToStorage
19
- } from "./chunk-YOFGP4FV.mjs";
19
+ } from "./chunk-RQSAANC3.mjs";
20
20
  import {
21
21
  DEFAULT_BACKEND_URL,
22
22
  DEFAULT_SIGNER_ADDRESS,
@@ -1024,23 +1024,21 @@ function WithdrawFlow({
1024
1024
  setIsSubmitting(true);
1025
1025
  try {
1026
1026
  const sessionOwner = await resolveSessionOwner(ownerAddress2);
1027
- const computed = await service.computeAddress(
1028
- ownerAddress2,
1029
- sessionOwner.address
1030
- );
1031
- const smartAccount = computed.smartAccount;
1032
- const checkResult = await service.checkAccount(smartAccount);
1033
- const targetMatches = checkResult.targetChain === targetChain && checkResult.targetToken?.toLowerCase() === targetToken.toLowerCase();
1034
- if (!checkResult.isRegistered || forceRegister || !targetMatches) {
1035
- const prepared = await service.prepareAccount({
1036
- ownerAddress: ownerAddress2,
1037
- sessionOwnerAddress: sessionOwner.address,
1038
- targetChain,
1039
- targetToken,
1040
- signerAddress,
1041
- sessionChainIds
1042
- });
1043
- const typedData = prepared.sessionDetailsUnsigned.data;
1027
+ const setup = await service.setupAccount({
1028
+ ownerAddress: ownerAddress2,
1029
+ sessionOwnerAddress: sessionOwner.address,
1030
+ targetChain,
1031
+ targetToken,
1032
+ signerAddress,
1033
+ sessionChainIds,
1034
+ forceRegister
1035
+ });
1036
+ const smartAccount = setup.smartAccount;
1037
+ if (setup.needsRegistration) {
1038
+ if (!setup.accountParams || !setup.sessionDetailsUnsigned) {
1039
+ throw new Error("Missing registration payload from setup-account");
1040
+ }
1041
+ const typedData = setup.sessionDetailsUnsigned.data;
1044
1042
  if (!sessionOwner.account.signTypedData) {
1045
1043
  throw new Error(
1046
1044
  "Session owner account does not support signTypedData"
@@ -1052,15 +1050,12 @@ function WithdrawFlow({
1052
1050
  primaryType: typedData.primaryType,
1053
1051
  message: typedData.message
1054
1052
  });
1055
- const sessionDetails = buildSessionDetails(
1056
- prepared.sessionDetailsUnsigned,
1057
- signature
1058
- );
1053
+ const sessionDetails = buildSessionDetails(setup.sessionDetailsUnsigned, signature);
1059
1054
  await service.registerAccount({
1060
1055
  address: smartAccount,
1061
1056
  accountParams: {
1062
- factory: prepared.accountParams.factory,
1063
- factoryData: prepared.accountParams.factoryData,
1057
+ factory: setup.accountParams.factory,
1058
+ factoryData: setup.accountParams.factoryData,
1064
1059
  sessionDetails
1065
1060
  },
1066
1061
  eoaAddress: ownerAddress2,
@@ -1305,7 +1300,7 @@ function WithdrawFlow({
1305
1300
  // src/WithdrawModal.tsx
1306
1301
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1307
1302
  var ReownWithdrawInner = lazy(
1308
- () => import("./WithdrawModalReown-6AAWH35J.mjs").then((m) => ({
1303
+ () => import("./WithdrawModalReown-LIYQG2BW.mjs").then((m) => ({
1309
1304
  default: m.WithdrawModalReown
1310
1305
  }))
1311
1306
  );