@rhinestone/deposit-modal 0.1.61 → 0.1.62

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.
@@ -25,7 +25,8 @@
25
25
 
26
26
 
27
27
 
28
- var _chunkTQ6IIGRScjs = require('./chunk-TQ6IIGRS.cjs');
28
+
29
+ var _chunkMVFMDKAScjs = require('./chunk-MVFMDKAS.cjs');
29
30
 
30
31
 
31
32
 
@@ -61,15 +62,15 @@ var _react = require('react');
61
62
 
62
63
  var _jsxruntime = require('react/jsx-runtime');
63
64
  async function resolveSessionOwner(eoaAddress) {
64
- const localOwner = _chunkTQ6IIGRScjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
65
+ const localOwner = _chunkMVFMDKAScjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
65
66
  if (localOwner) {
66
67
  return {
67
- account: _chunkTQ6IIGRScjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
68
+ account: _chunkMVFMDKAScjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
68
69
  address: localOwner.address
69
70
  };
70
71
  }
71
- const created = _chunkTQ6IIGRScjs.createSessionOwnerKey.call(void 0, );
72
- _chunkTQ6IIGRScjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
72
+ const created = _chunkMVFMDKAScjs.createSessionOwnerKey.call(void 0, );
73
+ _chunkMVFMDKAScjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
73
74
  return {
74
75
  account: created.account,
75
76
  address: created.address
@@ -106,7 +107,7 @@ function SetupStep({
106
107
  const setup = await service.setupAccount({
107
108
  ownerAddress: address,
108
109
  sessionOwnerAddress: sessionOwner.address,
109
- targetChain: _chunkTQ6IIGRScjs.toEvmCaip2.call(void 0, targetChain),
110
+ targetChain: _chunkMVFMDKAScjs.toEvmCaip2.call(void 0, targetChain),
110
111
  targetToken,
111
112
  signerAddress,
112
113
  sessionChainIds,
@@ -136,7 +137,7 @@ function SetupStep({
136
137
  primaryType: typedData.primaryType,
137
138
  message: typedData.message
138
139
  });
139
- const sessionDetails = _chunkTQ6IIGRScjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
140
+ const sessionDetails = _chunkMVFMDKAScjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
140
141
  setState({ type: "registering" });
141
142
  const registerResult = await service.registerAccount({
142
143
  address: smartAccount,
@@ -148,7 +149,7 @@ function SetupStep({
148
149
  eoaAddress: address,
149
150
  sessionOwner: sessionOwner.address,
150
151
  target: {
151
- chain: _chunkTQ6IIGRScjs.toEvmCaip2.call(void 0, targetChain),
152
+ chain: _chunkMVFMDKAScjs.toEvmCaip2.call(void 0, targetChain),
152
153
  token: targetToken,
153
154
  ...recipient && { recipient },
154
155
  ..._optionalChain([postBridgeActions, 'optionalAccess', _2 => _2.length]) && { postBridgeActions }
@@ -213,7 +214,7 @@ function SetupStep({
213
214
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
214
215
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
215
216
  isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
216
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTQ6IIGRScjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
217
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
217
218
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-text", children: [
218
219
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: renderStateMessage() }),
219
220
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This may take a moment" })
@@ -250,7 +251,7 @@ function SetupStep({
250
251
  ] })
251
252
  ] })
252
253
  ] }),
253
- isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTQ6IIGRScjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
254
+ isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
254
255
  ] });
255
256
  }
256
257
 
@@ -275,7 +276,7 @@ function AssetSelectStep({
275
276
  const [error, setError] = _react.useState.call(void 0, null);
276
277
  const defaultAssetId = _react.useMemo.call(void 0, () => {
277
278
  if (!defaultSourceChain || !defaultSourceToken) return null;
278
- return _chunkTQ6IIGRScjs.getAssetId.call(void 0, {
279
+ return _chunkMVFMDKAScjs.getAssetId.call(void 0, {
279
280
  chainId: defaultSourceChain,
280
281
  token: defaultSourceToken
281
282
  });
@@ -292,7 +293,7 @@ function AssetSelectStep({
292
293
  try {
293
294
  const portfolio = await service.fetchPortfolio(address);
294
295
  if (!active) return;
295
- const portfolioAssets = _chunkTQ6IIGRScjs.portfolioToAssets.call(void 0, portfolio.tokens);
296
+ const portfolioAssets = _chunkMVFMDKAScjs.portfolioToAssets.call(void 0, portfolio.tokens);
296
297
  setAssets(portfolioAssets);
297
298
  const hasNative = portfolioAssets.some(
298
299
  (asset) => asset.token.toLowerCase() === _chunkR6U6BHCVcjs.NATIVE_TOKEN_ADDRESS
@@ -373,7 +374,7 @@ function AssetSelectStep({
373
374
  const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
374
375
  const numeric = Number(raw);
375
376
  if (!Number.isFinite(numeric)) return raw;
376
- return _chunkTQ6IIGRScjs.tokenFormatter.format(numeric);
377
+ return _chunkMVFMDKAScjs.tokenFormatter.format(numeric);
377
378
  } catch (e3) {
378
379
  return asset.balance;
379
380
  }
@@ -387,7 +388,7 @@ function AssetSelectStep({
387
388
  style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
388
389
  children: [
389
390
  loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
390
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTQ6IIGRScjs.Spinner, { className: "rs-text-tertiary" }),
391
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.Spinner, { className: "rs-text-tertiary" }),
391
392
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
392
393
  ] }),
393
394
  error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-alert-text", children: error }) }),
@@ -477,7 +478,7 @@ function AssetSelectStep({
477
478
  ] })
478
479
  ] })
479
480
  ] }),
480
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkTQ6IIGRScjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
481
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkMVFMDKAScjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
481
482
  ]
482
483
  },
483
484
  asset.id
@@ -487,7 +488,7 @@ function AssetSelectStep({
487
488
  }
488
489
  ),
489
490
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
490
- _chunkTQ6IIGRScjs.Button,
491
+ _chunkMVFMDKAScjs.Button,
491
492
  {
492
493
  onClick: () => selectedAsset && onContinue(selectedAsset),
493
494
  disabled: !selectedAsset,
@@ -495,7 +496,7 @@ function AssetSelectStep({
495
496
  children: "Continue"
496
497
  }
497
498
  ) }),
498
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTQ6IIGRScjs.PoweredBy, {})
499
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.PoweredBy, {})
499
500
  ] });
500
501
  }
501
502
  async function fetchNativeAssets(address, publicClient, existing) {
@@ -503,7 +504,7 @@ async function fetchNativeAssets(address, publicClient, existing) {
503
504
  const connectedChainId = _optionalChain([publicClient, 'access', _11 => _11.chain, 'optionalAccess', _12 => _12.id]);
504
505
  if (!connectedChainId) return [];
505
506
  if (!_chunkR6U6BHCVcjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
506
- const id = _chunkTQ6IIGRScjs.getAssetId.call(void 0, {
507
+ const id = _chunkMVFMDKAScjs.getAssetId.call(void 0, {
507
508
  chainId: connectedChainId,
508
509
  token: _chunkR6U6BHCVcjs.NATIVE_TOKEN_ADDRESS
509
510
  });
@@ -590,7 +591,7 @@ function AmountStep({
590
591
  const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
591
592
  if (!balanceTarget || !publicClient) return;
592
593
  try {
593
- const bal = _chunkTQ6IIGRScjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
594
+ const bal = _chunkMVFMDKAScjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
594
595
  address: asset.token,
595
596
  abi: _viem.erc20Abi,
596
597
  functionName: "balanceOf",
@@ -616,7 +617,7 @@ function AmountStep({
616
617
  setIsSwitching(true);
617
618
  switchChain(asset.chainId).catch((err) => {
618
619
  const raw = err instanceof Error ? err.message : "Failed to switch chain";
619
- setError(_chunkTQ6IIGRScjs.formatUserError.call(void 0, raw));
620
+ setError(_chunkMVFMDKAScjs.formatUserError.call(void 0, raw));
620
621
  }).finally(() => {
621
622
  setIsSwitching(false);
622
623
  });
@@ -652,7 +653,7 @@ function AmountStep({
652
653
  const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
653
654
  const numeric = Number(raw);
654
655
  if (!Number.isFinite(numeric)) return raw;
655
- return _chunkTQ6IIGRScjs.tokenFormatter.format(numeric);
656
+ return _chunkMVFMDKAScjs.tokenFormatter.format(numeric);
656
657
  } catch (e8) {
657
658
  return "...";
658
659
  }
@@ -696,7 +697,7 @@ function AmountStep({
696
697
  const usdValue = numericAmount;
697
698
  if (_optionalChain([uiConfig, 'optionalAccess', _17 => _17.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
698
699
  setError(
699
- `Maximum deposit is ${_chunkTQ6IIGRScjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
700
+ `Maximum deposit is ${_chunkMVFMDKAScjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
700
701
  );
701
702
  return;
702
703
  }
@@ -751,7 +752,7 @@ function AmountStep({
751
752
  hasPricing && balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
752
753
  " ",
753
754
  "(",
754
- _chunkTQ6IIGRScjs.currencyFormatter.format(balanceUsd),
755
+ _chunkMVFMDKAScjs.currencyFormatter.format(balanceUsd),
755
756
  ")"
756
757
  ] })
757
758
  ] }) })
@@ -888,7 +889,7 @@ function AmountStep({
888
889
  )
889
890
  ] }),
890
891
  _optionalChain([uiConfig, 'optionalAccess', _20 => _20.minDepositUsd]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-minimum", children: [
891
- _chunkTQ6IIGRScjs.currencyFormatter.format(uiConfig.minDepositUsd),
892
+ _chunkMVFMDKAScjs.currencyFormatter.format(uiConfig.minDepositUsd),
892
893
  " minimum deposit"
893
894
  ] }),
894
895
  error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
@@ -914,7 +915,7 @@ function AmountStep({
914
915
  ] })
915
916
  ] }),
916
917
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
917
- _chunkTQ6IIGRScjs.Button,
918
+ _chunkMVFMDKAScjs.Button,
918
919
  {
919
920
  onClick: handleContinue,
920
921
  fullWidth: true,
@@ -922,7 +923,7 @@ function AmountStep({
922
923
  children: _optionalChain([uiConfig, 'optionalAccess', _21 => _21.minDepositUsd]) && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
923
924
  }
924
925
  ) }),
925
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTQ6IIGRScjs.PoweredBy, {})
926
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.PoweredBy, {})
926
927
  ] });
927
928
  }
928
929
 
@@ -972,7 +973,7 @@ function ConfirmStep({
972
973
  setIsSwitching(true);
973
974
  switchChain(asset.chainId).catch((err) => {
974
975
  const raw = err instanceof Error ? err.message : "Failed to switch chain";
975
- setError(_chunkTQ6IIGRScjs.formatUserError.call(void 0, raw));
976
+ setError(_chunkMVFMDKAScjs.formatUserError.call(void 0, raw));
976
977
  }).finally(() => {
977
978
  setIsSwitching(false);
978
979
  });
@@ -1015,7 +1016,7 @@ function ConfirmStep({
1015
1016
  throw new Error("Wallet not properly connected");
1016
1017
  }
1017
1018
  const transferTo = sameRoute ? recipient : smartAccount;
1018
- const hash = _chunkTQ6IIGRScjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
1019
+ const hash = _chunkMVFMDKAScjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
1019
1020
  account,
1020
1021
  chain,
1021
1022
  to: transferTo,
@@ -1032,7 +1033,7 @@ function ConfirmStep({
1032
1033
  onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
1033
1034
  } catch (err) {
1034
1035
  const raw = err instanceof Error ? err.message : "Transfer failed";
1035
- const message = _chunkTQ6IIGRScjs.formatUserError.call(void 0, raw);
1036
+ const message = _chunkMVFMDKAScjs.formatUserError.call(void 0, raw);
1036
1037
  setError(message);
1037
1038
  _optionalChain([onError, 'optionalCall', _25 => _25(message, "TRANSFER_ERROR")]);
1038
1039
  } finally {
@@ -1161,7 +1162,7 @@ function ConfirmStep({
1161
1162
  ] })
1162
1163
  ] }),
1163
1164
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1164
- _chunkTQ6IIGRScjs.Button,
1165
+ _chunkMVFMDKAScjs.Button,
1165
1166
  {
1166
1167
  onClick: handleConfirm,
1167
1168
  loading: isSubmitting,
@@ -1170,7 +1171,7 @@ function ConfirmStep({
1170
1171
  children: "Confirm Order"
1171
1172
  }
1172
1173
  ) }),
1173
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTQ6IIGRScjs.PoweredBy, {})
1174
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.PoweredBy, {})
1174
1175
  ] });
1175
1176
  }
1176
1177
 
@@ -1582,10 +1583,10 @@ function DepositAddressStep({
1582
1583
  const status = await service.fetchLatestStatus(smartAccount);
1583
1584
  if (cancelled || depositHandledRef.current) return;
1584
1585
  const event = status.lastEvent;
1585
- const eventTxHash = _chunkTQ6IIGRScjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkTQ6IIGRScjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
1586
+ const eventTxHash = _chunkMVFMDKAScjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkMVFMDKAScjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
1586
1587
  if (baselineTxHash === void 0) {
1587
1588
  baselineTxHash = eventTxHash;
1588
- } else if (eventTxHash && (!baselineTxHash || !_chunkTQ6IIGRScjs.txRefsMatch.call(void 0, eventTxHash, baselineTxHash))) {
1589
+ } else if (eventTxHash && (!baselineTxHash || !_chunkMVFMDKAScjs.txRefsMatch.call(void 0, eventTxHash, baselineTxHash))) {
1589
1590
  const details = getDepositEventDetails(event);
1590
1591
  const fallback = sourceSelectionRef.current;
1591
1592
  const chainId = _nullishCoalesce(details.chainId, () => ( fallback.chainId));
@@ -1808,7 +1809,7 @@ function DepositAddressStep({
1808
1809
  ] }),
1809
1810
  pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
1810
1811
  ] }) }),
1811
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTQ6IIGRScjs.PoweredBy, {})
1812
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.PoweredBy, {})
1812
1813
  ] });
1813
1814
  }
1814
1815
  DepositAddressStep.displayName = "DepositAddressStep";
@@ -1839,7 +1840,7 @@ function SolanaTokenSelectStep({
1839
1840
  setError(null);
1840
1841
  const portfolioBySymbol = {};
1841
1842
  try {
1842
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:request", {
1843
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:request", {
1843
1844
  solanaAddress
1844
1845
  });
1845
1846
  const portfolio = await service.fetchSolanaPortfolio(solanaAddress);
@@ -1862,12 +1863,12 @@ function SolanaTokenSelectStep({
1862
1863
  };
1863
1864
  }
1864
1865
  }
1865
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:success", {
1866
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:success", {
1866
1867
  symbols: Object.keys(portfolioBySymbol)
1867
1868
  });
1868
1869
  } catch (err) {
1869
1870
  if (!active) return;
1870
- _chunkTQ6IIGRScjs.debugError.call(void 0, debug, "solana-token-select", "portfolio:failure", err, {
1871
+ _chunkMVFMDKAScjs.debugError.call(void 0, debug, "solana-token-select", "portfolio:failure", err, {
1871
1872
  solanaAddress
1872
1873
  });
1873
1874
  setError(
@@ -1921,7 +1922,7 @@ function SolanaTokenSelectStep({
1921
1922
  style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
1922
1923
  children: [
1923
1924
  loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
1924
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTQ6IIGRScjs.Spinner, { className: "rs-text-tertiary" }),
1925
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.Spinner, { className: "rs-text-tertiary" }),
1925
1926
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
1926
1927
  ] }),
1927
1928
  !loading && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
@@ -1958,7 +1959,7 @@ function SolanaTokenSelectStep({
1958
1959
  try {
1959
1960
  const raw = _viem.formatUnits.call(void 0, entry.balance, entry.token.decimals);
1960
1961
  const numeric = Number(raw);
1961
- formattedBalance = Number.isFinite(numeric) ? _chunkTQ6IIGRScjs.tokenFormatter.format(numeric) : raw;
1962
+ formattedBalance = Number.isFinite(numeric) ? _chunkMVFMDKAScjs.tokenFormatter.format(numeric) : raw;
1962
1963
  } catch (e14) {
1963
1964
  formattedBalance = "...";
1964
1965
  }
@@ -2002,7 +2003,7 @@ function SolanaTokenSelectStep({
2002
2003
  ] })
2003
2004
  ] })
2004
2005
  ] }),
2005
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? _chunkTQ6IIGRScjs.currencyFormatter.format(entry.balanceUsd) : `${formattedBalance} ${entry.token.symbol}` })
2006
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? _chunkMVFMDKAScjs.currencyFormatter.format(entry.balanceUsd) : `${formattedBalance} ${entry.token.symbol}` })
2006
2007
  ]
2007
2008
  },
2008
2009
  entry.token.symbol
@@ -2012,7 +2013,7 @@ function SolanaTokenSelectStep({
2012
2013
  }
2013
2014
  ),
2014
2015
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2015
- _chunkTQ6IIGRScjs.Button,
2016
+ _chunkMVFMDKAScjs.Button,
2016
2017
  {
2017
2018
  onClick: () => selectedEntry && onContinue(
2018
2019
  selectedEntry.token,
@@ -2024,7 +2025,7 @@ function SolanaTokenSelectStep({
2024
2025
  children: "Continue"
2025
2026
  }
2026
2027
  ) }),
2027
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTQ6IIGRScjs.PoweredBy, {})
2028
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.PoweredBy, {})
2028
2029
  ] });
2029
2030
  }
2030
2031
 
@@ -2072,7 +2073,7 @@ function SolanaAmountStep({
2072
2073
  const raw = _viem.formatUnits.call(void 0, balance, token.decimals);
2073
2074
  const numeric = Number(raw);
2074
2075
  if (!Number.isFinite(numeric)) return raw;
2075
- return _chunkTQ6IIGRScjs.tokenFormatter.format(numeric);
2076
+ return _chunkMVFMDKAScjs.tokenFormatter.format(numeric);
2076
2077
  } catch (e16) {
2077
2078
  return "...";
2078
2079
  }
@@ -2090,7 +2091,7 @@ function SolanaAmountStep({
2090
2091
  }, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
2091
2092
  const formattedBalanceUsd = _react.useMemo.call(void 0, () => {
2092
2093
  if (computedBalanceUsd === null || computedBalanceUsd <= 0) return null;
2093
- return _chunkTQ6IIGRScjs.currencyFormatter.format(computedBalanceUsd);
2094
+ return _chunkMVFMDKAScjs.currencyFormatter.format(computedBalanceUsd);
2094
2095
  }, [computedBalanceUsd]);
2095
2096
  const spendableBalance = _react.useMemo.call(void 0, () => {
2096
2097
  if (!isNativeSol(token)) return balance;
@@ -2115,7 +2116,7 @@ function SolanaAmountStep({
2115
2116
  const factor = 10 ** maxDecimals;
2116
2117
  const truncated = Math.floor(value * factor) / factor;
2117
2118
  const formatted = truncated.toFixed(maxDecimals).replace(/\.?0+$/, "");
2118
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "solana-amount", "amount:preset", {
2119
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "solana-amount", "amount:preset", {
2119
2120
  percentage,
2120
2121
  symbol: token.symbol,
2121
2122
  formatted
@@ -2129,7 +2130,7 @@ function SolanaAmountStep({
2129
2130
  const handleContinue = () => {
2130
2131
  const numericAmount = parseFloat(amount);
2131
2132
  if (isNaN(numericAmount) || numericAmount <= 0) {
2132
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
2133
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
2133
2134
  amount,
2134
2135
  reason: "nan-or-non-positive"
2135
2136
  });
@@ -2141,7 +2142,7 @@ function SolanaAmountStep({
2141
2142
  const usdValue = numericAmount;
2142
2143
  if (_optionalChain([uiConfig, 'optionalAccess', _48 => _48.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
2143
2144
  setError(
2144
- `Maximum deposit is ${_chunkTQ6IIGRScjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
2145
+ `Maximum deposit is ${_chunkMVFMDKAScjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
2145
2146
  );
2146
2147
  return;
2147
2148
  }
@@ -2156,7 +2157,7 @@ function SolanaAmountStep({
2156
2157
  try {
2157
2158
  amountInUnits = _viem.parseUnits.call(void 0, sourceAmountStr, token.decimals);
2158
2159
  } catch (e20) {
2159
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
2160
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
2160
2161
  amount,
2161
2162
  sourceAmount: sourceAmountStr,
2162
2163
  reason: "parse-units-failed"
@@ -2166,7 +2167,7 @@ function SolanaAmountStep({
2166
2167
  }
2167
2168
  if (amountInUnits > spendableBalance) {
2168
2169
  const isReserveIssue = isNativeSol(token) && amountInUnits <= balance;
2169
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
2170
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
2170
2171
  amount,
2171
2172
  balance: balance.toString(),
2172
2173
  spendableBalance: spendableBalance.toString(),
@@ -2178,7 +2179,7 @@ function SolanaAmountStep({
2178
2179
  );
2179
2180
  return;
2180
2181
  }
2181
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
2182
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
2182
2183
  symbol: token.symbol,
2183
2184
  inputAmountUsd: amount,
2184
2185
  sourceAmount: sourceAmountStr,
@@ -2247,7 +2248,7 @@ function SolanaAmountStep({
2247
2248
  )
2248
2249
  ] }),
2249
2250
  _optionalChain([uiConfig, 'optionalAccess', _50 => _50.minDepositUsd]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-minimum", children: [
2250
- _chunkTQ6IIGRScjs.currencyFormatter.format(uiConfig.minDepositUsd),
2251
+ _chunkMVFMDKAScjs.currencyFormatter.format(uiConfig.minDepositUsd),
2251
2252
  " minimum deposit"
2252
2253
  ] }),
2253
2254
  error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
@@ -2273,7 +2274,7 @@ function SolanaAmountStep({
2273
2274
  ] })
2274
2275
  ] }),
2275
2276
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2276
- _chunkTQ6IIGRScjs.Button,
2277
+ _chunkMVFMDKAScjs.Button,
2277
2278
  {
2278
2279
  onClick: handleContinue,
2279
2280
  fullWidth: true,
@@ -2281,7 +2282,7 @@ function SolanaAmountStep({
2281
2282
  children: _optionalChain([uiConfig, 'optionalAccess', _51 => _51.minDepositUsd]) && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
2282
2283
  }
2283
2284
  ) }),
2284
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTQ6IIGRScjs.PoweredBy, {})
2285
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.PoweredBy, {})
2285
2286
  ] });
2286
2287
  }
2287
2288
 
@@ -2325,7 +2326,7 @@ function SolanaConfirmStep({
2325
2326
  const receiveAmount = isSameToken ? formattedReceiveAmount : `~ ${formattedReceiveAmount}`;
2326
2327
  const handleConfirm = async () => {
2327
2328
  if (!solanaProvider) {
2328
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
2329
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
2329
2330
  reason: "missing-provider"
2330
2331
  });
2331
2332
  setError("Solana wallet not connected");
@@ -2333,7 +2334,7 @@ function SolanaConfirmStep({
2333
2334
  }
2334
2335
  const parsedAmount = parseFloat(sourceAmount);
2335
2336
  if (isNaN(parsedAmount) || parsedAmount <= 0) {
2336
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
2337
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
2337
2338
  reason: "invalid-amount",
2338
2339
  sourceAmount
2339
2340
  });
@@ -2342,7 +2343,7 @@ function SolanaConfirmStep({
2342
2343
  }
2343
2344
  setError(null);
2344
2345
  setIsSubmitting(true);
2345
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:start", {
2346
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:start", {
2346
2347
  smartAccount,
2347
2348
  solanaAddress,
2348
2349
  solanaDepositAddress,
@@ -2352,7 +2353,7 @@ function SolanaConfirmStep({
2352
2353
  });
2353
2354
  try {
2354
2355
  const check = await service.checkAccount(smartAccount);
2355
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "solana-confirm", "check:success", {
2356
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "solana-confirm", "check:success", {
2356
2357
  smartAccount,
2357
2358
  isRegistered: check.isRegistered,
2358
2359
  targetChain: check.targetChain,
@@ -2365,7 +2366,7 @@ function SolanaConfirmStep({
2365
2366
  }
2366
2367
  const connection = getSolanaConnection();
2367
2368
  const amountUnits = _viem.parseUnits.call(void 0, sourceAmount, token.decimals);
2368
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
2369
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
2369
2370
  token: token.symbol,
2370
2371
  sourceAmount,
2371
2372
  amountUnits: amountUnits.toString()
@@ -2382,7 +2383,7 @@ function SolanaConfirmStep({
2382
2383
  token.mint,
2383
2384
  amountUnits
2384
2385
  );
2385
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
2386
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
2386
2387
  token: token.symbol,
2387
2388
  instructionCount: transaction.instructions.length,
2388
2389
  feePayer: _optionalChain([transaction, 'access', _52 => _52.feePayer, 'optionalAccess', _53 => _53.toBase58, 'call', _54 => _54()]),
@@ -2393,15 +2394,15 @@ function SolanaConfirmStep({
2393
2394
  connection,
2394
2395
  transaction
2395
2396
  );
2396
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:sent", {
2397
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:sent", {
2397
2398
  txHash,
2398
2399
  amountUnits: amountUnits.toString()
2399
2400
  });
2400
2401
  onConfirm(txHash, amountUnits.toString());
2401
2402
  } catch (err) {
2402
2403
  const raw = err instanceof Error ? err.message : "Transfer failed";
2403
- const message = _chunkTQ6IIGRScjs.formatUserError.call(void 0, raw);
2404
- _chunkTQ6IIGRScjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
2404
+ const message = _chunkMVFMDKAScjs.formatUserError.call(void 0, raw);
2405
+ _chunkMVFMDKAScjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
2405
2406
  smartAccount,
2406
2407
  token: token.symbol,
2407
2408
  sourceAmount
@@ -2534,7 +2535,7 @@ function SolanaConfirmStep({
2534
2535
  ] })
2535
2536
  ] }),
2536
2537
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2537
- _chunkTQ6IIGRScjs.Button,
2538
+ _chunkMVFMDKAScjs.Button,
2538
2539
  {
2539
2540
  onClick: handleConfirm,
2540
2541
  loading: isSubmitting,
@@ -2543,7 +2544,7 @@ function SolanaConfirmStep({
2543
2544
  children: "Confirm Order"
2544
2545
  }
2545
2546
  ) }),
2546
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTQ6IIGRScjs.PoweredBy, {})
2547
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.PoweredBy, {})
2547
2548
  ] });
2548
2549
  }
2549
2550
 
@@ -2592,6 +2593,9 @@ function DepositFlow({
2592
2593
  onError,
2593
2594
  debug
2594
2595
  }) {
2596
+ const onStepChangeRef = _chunkMVFMDKAScjs.useLatestRef.call(void 0, onStepChange);
2597
+ const onTotalBalanceChangeRef = _chunkMVFMDKAScjs.useLatestRef.call(void 0, onTotalBalanceChange);
2598
+ const onEventRef = _chunkMVFMDKAScjs.useLatestRef.call(void 0, onEvent);
2595
2599
  const hasInitialReownSession = Boolean(
2596
2600
  enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _56 => _56.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _57 => _57.address]) : _optionalChain([reownWallet, 'optionalAccess', _58 => _58.address])
2597
2601
  );
@@ -2611,13 +2615,13 @@ function DepositFlow({
2611
2615
  flowModeRef.current = flowMode;
2612
2616
  const logFlow = _react.useCallback.call(void 0,
2613
2617
  (message, data) => {
2614
- _chunkTQ6IIGRScjs.debugLog.call(void 0, debug, "deposit-flow", message, data);
2618
+ _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "deposit-flow", message, data);
2615
2619
  },
2616
2620
  [debug]
2617
2621
  );
2618
2622
  const logFlowError = _react.useCallback.call(void 0,
2619
2623
  (message, error, data) => {
2620
- _chunkTQ6IIGRScjs.debugError.call(void 0, debug, "deposit-flow", message, error, data);
2624
+ _chunkMVFMDKAScjs.debugError.call(void 0, debug, "deposit-flow", message, error, data);
2621
2625
  },
2622
2626
  [debug]
2623
2627
  );
@@ -2739,7 +2743,7 @@ function DepositFlow({
2739
2743
  return {
2740
2744
  ownerAddress: dappAddress,
2741
2745
  walletClient: void 0,
2742
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkTQ6IIGRScjs.getPublicClient.call(void 0, targetChain))),
2746
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, targetChain))),
2743
2747
  switchChain: void 0
2744
2748
  };
2745
2749
  }
@@ -2748,7 +2752,7 @@ function DepositFlow({
2748
2752
  return {
2749
2753
  ownerAddress: dappWalletClient.account.address,
2750
2754
  walletClient: dappWalletClient,
2751
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkTQ6IIGRScjs.getPublicClient.call(void 0, fallbackChainId))),
2755
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, fallbackChainId))),
2752
2756
  switchChain: dappSwitchChain
2753
2757
  };
2754
2758
  }
@@ -2762,7 +2766,7 @@ function DepositFlow({
2762
2766
  return {
2763
2767
  ownerAddress: dappAddress,
2764
2768
  walletClient: void 0,
2765
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkTQ6IIGRScjs.getPublicClient.call(void 0, targetChain))),
2769
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, targetChain))),
2766
2770
  switchChain: void 0
2767
2771
  };
2768
2772
  }
@@ -2771,7 +2775,7 @@ function DepositFlow({
2771
2775
  return {
2772
2776
  ownerAddress: dappWalletClient.account.address,
2773
2777
  walletClient: dappWalletClient,
2774
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkTQ6IIGRScjs.getPublicClient.call(void 0, fallbackChainId))),
2778
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, fallbackChainId))),
2775
2779
  switchChain: dappSwitchChain
2776
2780
  };
2777
2781
  }
@@ -2779,7 +2783,7 @@ function DepositFlow({
2779
2783
  return {
2780
2784
  ownerAddress: reownWallet.address,
2781
2785
  walletClient: reownWallet.walletClient,
2782
- publicClient: _nullishCoalesce(reownWallet.publicClient, () => ( _chunkTQ6IIGRScjs.getPublicClient.call(void 0, targetChain))),
2786
+ publicClient: _nullishCoalesce(reownWallet.publicClient, () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, targetChain))),
2783
2787
  switchChain: reownWallet.switchChain
2784
2788
  };
2785
2789
  }
@@ -2817,7 +2821,7 @@ function DepositFlow({
2817
2821
  return {
2818
2822
  ownerAddress: dappAddress,
2819
2823
  walletClient: void 0,
2820
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkTQ6IIGRScjs.getPublicClient.call(void 0, targetChain))),
2824
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, targetChain))),
2821
2825
  switchChain: void 0
2822
2826
  };
2823
2827
  }
@@ -2916,12 +2920,22 @@ function DepositFlow({
2916
2920
  const stepIndex = step.type === "setup" ? 0 : step.type === "deposit-address" ? 1 : step.type === "select-asset" ? 1 : step.type === "solana-token-select" ? 1 : step.type === "solana-amount" ? 2 : step.type === "amount" ? 2 : step.type === "confirm" ? 3 : step.type === "solana-confirm" ? 3 : 4;
2917
2921
  const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "solana-token-select" ? handleBackFromSolanaTokenSelect : step.type === "solana-amount" ? handleBackFromSolanaAmount : step.type === "solana-confirm" ? handleBackFromSolanaConfirm : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
2918
2922
  _react.useEffect.call(void 0, () => {
2919
- _optionalChain([onStepChange, 'optionalCall', _85 => _85(stepIndex, currentBackHandler)]);
2920
- }, [stepIndex, currentBackHandler, onStepChange]);
2923
+ _optionalChain([onStepChangeRef, 'access', _85 => _85.current, 'optionalCall', _86 => _86(stepIndex, currentBackHandler)]);
2924
+ }, [stepIndex, currentBackHandler, onStepChangeRef]);
2921
2925
  const stepSendToken = step.type === "amount" ? step.asset.symbol : null;
2926
+ const stepOpenEventKey = step.type === "select-asset" ? "select-asset" : step.type === "deposit-address" ? "deposit-address" : step.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
2927
+ const lastStepOpenEventKeyRef = _react.useRef.call(void 0, null);
2922
2928
  _react.useEffect.call(void 0, () => {
2929
+ if (!stepOpenEventKey) {
2930
+ lastStepOpenEventKeyRef.current = null;
2931
+ return;
2932
+ }
2933
+ if (lastStepOpenEventKeyRef.current === stepOpenEventKey) {
2934
+ return;
2935
+ }
2936
+ lastStepOpenEventKeyRef.current = stepOpenEventKey;
2923
2937
  if (step.type === "select-asset") {
2924
- _optionalChain([onEvent, 'optionalCall', _86 => _86({
2938
+ _optionalChain([onEventRef, 'access', _87 => _87.current, 'optionalCall', _88 => _88({
2925
2939
  type: "deposit_modal_connected_wallet_select_source_open",
2926
2940
  total_balance_in_external_wallet: totalBalanceUsd,
2927
2941
  pred_balance: totalBalanceUsd
@@ -2929,7 +2943,7 @@ function DepositFlow({
2929
2943
  } else if (step.type === "deposit-address") {
2930
2944
  const chainName = _chunkR6U6BHCVcjs.getChainName.call(void 0, targetChain);
2931
2945
  const tokenSymbol = _chunkR6U6BHCVcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
2932
- _optionalChain([onEvent, 'optionalCall', _87 => _87({
2946
+ _optionalChain([onEventRef, 'access', _89 => _89.current, 'optionalCall', _90 => _90({
2933
2947
  type: "deposit_modal_transfer_crypto_open",
2934
2948
  default_chain: chainName,
2935
2949
  default_token: tokenSymbol,
@@ -2937,14 +2951,22 @@ function DepositFlow({
2937
2951
  })]);
2938
2952
  } else if (step.type === "amount" && stepSendToken) {
2939
2953
  const receiveSymbol = _chunkR6U6BHCVcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
2940
- _optionalChain([onEvent, 'optionalCall', _88 => _88({
2954
+ _optionalChain([onEventRef, 'access', _91 => _91.current, 'optionalCall', _92 => _92({
2941
2955
  type: "deposit_modal_connected_wallet_enter_value_open",
2942
2956
  send_token: stepSendToken,
2943
2957
  receive_token: receiveSymbol,
2944
2958
  pred_balance: totalBalanceUsd
2945
2959
  })]);
2946
2960
  }
2947
- }, [step.type, stepSendToken, onEvent]);
2961
+ }, [
2962
+ step.type,
2963
+ stepOpenEventKey,
2964
+ stepSendToken,
2965
+ targetChain,
2966
+ targetToken,
2967
+ totalBalanceUsd,
2968
+ onEventRef
2969
+ ]);
2948
2970
  _react.useEffect.call(void 0, () => {
2949
2971
  logFlow("state:changed", {
2950
2972
  step: step.type,
@@ -2962,8 +2984,8 @@ function DepositFlow({
2962
2984
  targetToken
2963
2985
  ]);
2964
2986
  _react.useEffect.call(void 0, () => {
2965
- _optionalChain([onTotalBalanceChange, 'optionalCall', _89 => _89(totalBalanceUsd)]);
2966
- }, [totalBalanceUsd, onTotalBalanceChange]);
2987
+ _optionalChain([onTotalBalanceChangeRef, 'access', _93 => _93.current, 'optionalCall', _94 => _94(totalBalanceUsd)]);
2988
+ }, [totalBalanceUsd, onTotalBalanceChangeRef]);
2967
2989
  const isDepositAddressMode = flowMode === "deposit-address";
2968
2990
  const isSolanaWalletMode = flowMode === "solana-wallet";
2969
2991
  const handleSelectProvider = _react.useCallback.call(void 0, () => {
@@ -3004,7 +3026,7 @@ function DepositFlow({
3004
3026
  solanaDepositAddress
3005
3027
  });
3006
3028
  } else {
3007
- _optionalChain([onError, 'optionalCall', _90 => _90({
3029
+ _optionalChain([onError, 'optionalCall', _95 => _95({
3008
3030
  message: "Solana deposit address not available. Please try again.",
3009
3031
  code: "SOLANA_SETUP_FAILED"
3010
3032
  })]);
@@ -3039,7 +3061,7 @@ function DepositFlow({
3039
3061
  directTransfer
3040
3062
  };
3041
3063
  });
3042
- _optionalChain([onDepositSubmitted, 'optionalCall', _91 => _91({ txHash, sourceChain: chainId, amount })]);
3064
+ _optionalChain([onDepositSubmitted, 'optionalCall', _96 => _96({ txHash, sourceChain: chainId, amount })]);
3043
3065
  },
3044
3066
  [onDepositSubmitted, targetChain, targetToken]
3045
3067
  );
@@ -3111,7 +3133,7 @@ function DepositFlow({
3111
3133
  sourceDecimals: prev.token.decimals
3112
3134
  };
3113
3135
  });
3114
- _optionalChain([onDepositSubmitted, 'optionalCall', _92 => _92({
3136
+ _optionalChain([onDepositSubmitted, 'optionalCall', _97 => _97({
3115
3137
  txHash,
3116
3138
  sourceChain: "solana",
3117
3139
  amount: amountUnits
@@ -3121,13 +3143,13 @@ function DepositFlow({
3121
3143
  );
3122
3144
  const handleConnected = _react.useCallback.call(void 0,
3123
3145
  (addr, smartAccount) => {
3124
- _optionalChain([onConnected, 'optionalCall', _93 => _93({ address: addr, smartAccount })]);
3146
+ _optionalChain([onConnected, 'optionalCall', _98 => _98({ address: addr, smartAccount })]);
3125
3147
  },
3126
3148
  [onConnected]
3127
3149
  );
3128
3150
  const handleAssetContinue = _react.useCallback.call(void 0,
3129
3151
  (asset) => {
3130
- _optionalChain([onEvent, 'optionalCall', _94 => _94({
3152
+ _optionalChain([onEvent, 'optionalCall', _99 => _99({
3131
3153
  type: "deposit_modal_connected_wallet_select_source_cta_click",
3132
3154
  total_balance_in_external_wallet: totalBalanceUsd,
3133
3155
  pred_balance: totalBalanceUsd,
@@ -3192,28 +3214,28 @@ function DepositFlow({
3192
3214
  );
3193
3215
  const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
3194
3216
  (txHash, sourceChain, amount) => {
3195
- _optionalChain([onDepositSubmitted, 'optionalCall', _95 => _95({ txHash, sourceChain, amount })]);
3217
+ _optionalChain([onDepositSubmitted, 'optionalCall', _100 => _100({ txHash, sourceChain, amount })]);
3196
3218
  },
3197
3219
  [onDepositSubmitted]
3198
3220
  );
3199
3221
  const handleDepositComplete = _react.useCallback.call(void 0,
3200
3222
  (txHash, destinationTxHash, context) => {
3201
3223
  logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
3202
- _optionalChain([onDepositComplete, 'optionalCall', _96 => _96({ txHash, destinationTxHash, ...context })]);
3224
+ _optionalChain([onDepositComplete, 'optionalCall', _101 => _101({ txHash, destinationTxHash, ...context })]);
3203
3225
  },
3204
3226
  [logFlow, onDepositComplete]
3205
3227
  );
3206
3228
  const handleDepositFailed = _react.useCallback.call(void 0,
3207
3229
  (txHash, error) => {
3208
3230
  logFlowError("deposit:failed", error, { txHash });
3209
- _optionalChain([onDepositFailed, 'optionalCall', _97 => _97({ txHash, error })]);
3231
+ _optionalChain([onDepositFailed, 'optionalCall', _102 => _102({ txHash, error })]);
3210
3232
  },
3211
3233
  [logFlowError, onDepositFailed]
3212
3234
  );
3213
3235
  const handleError = _react.useCallback.call(void 0,
3214
3236
  (message, code) => {
3215
3237
  logFlowError("flow:error", message, { code });
3216
- _optionalChain([onError, 'optionalCall', _98 => _98({ message, code })]);
3238
+ _optionalChain([onError, 'optionalCall', _103 => _103({ message, code })]);
3217
3239
  },
3218
3240
  [logFlowError, onError]
3219
3241
  );
@@ -3270,7 +3292,7 @@ function DepositFlow({
3270
3292
  if (walletId) {
3271
3293
  const selectedOption = walletOptions.find((o) => o.id === walletId);
3272
3294
  setSelectedWalletId(walletId);
3273
- if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _99 => _99.kind]) === "solana") {
3295
+ if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _104 => _104.kind]) === "solana") {
3274
3296
  handleSelectSolanaWallet();
3275
3297
  } else {
3276
3298
  handleSelectProvider();
@@ -3300,7 +3322,7 @@ function DepositFlow({
3300
3322
  ]);
3301
3323
  if (showConnectStep) {
3302
3324
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3303
- _chunkTQ6IIGRScjs.ConnectStep,
3325
+ _chunkMVFMDKAScjs.ConnectStep,
3304
3326
  {
3305
3327
  walletOptions,
3306
3328
  selectedWalletId: selectedWalletIdEffective,
@@ -3319,7 +3341,7 @@ function DepositFlow({
3319
3341
  const selectedOption = walletOptions.find(
3320
3342
  (o) => o.id === selectedWalletIdEffective
3321
3343
  );
3322
- if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _100 => _100.kind]) === "solana") {
3344
+ if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _105 => _105.kind]) === "solana") {
3323
3345
  handleSelectSolanaWallet();
3324
3346
  } else {
3325
3347
  handleSelectProvider();
@@ -3362,7 +3384,7 @@ function DepositFlow({
3362
3384
  onCopyAddress: () => {
3363
3385
  const chainName = _chunkR6U6BHCVcjs.getChainName.call(void 0, targetChain);
3364
3386
  const tokenSymbol = _chunkR6U6BHCVcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
3365
- _optionalChain([onEvent, 'optionalCall', _101 => _101({
3387
+ _optionalChain([onEvent, 'optionalCall', _106 => _106({
3366
3388
  type: "deposit_modal_transfer_crypto_cta_click",
3367
3389
  default_chain: chainName,
3368
3390
  default_token: tokenSymbol,
@@ -3374,7 +3396,7 @@ function DepositFlow({
3374
3396
  }
3375
3397
  ),
3376
3398
  step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3377
- _chunkTQ6IIGRScjs.ProcessingStep,
3399
+ _chunkMVFMDKAScjs.ProcessingStep,
3378
3400
  {
3379
3401
  smartAccount: step.smartAccount,
3380
3402
  txHash: step.txHash,
@@ -3400,8 +3422,8 @@ function DepositFlow({
3400
3422
  }
3401
3423
  if (isSolanaWalletMode) {
3402
3424
  if (!sessionKeyAddress) return null;
3403
- const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _102 => _102.solanaAddress]);
3404
- const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _103 => _103.solanaProvider]);
3425
+ const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _107 => _107.solanaAddress]);
3426
+ const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _108 => _108.solanaProvider]);
3405
3427
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
3406
3428
  step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3407
3429
  SetupStep,
@@ -3497,7 +3519,7 @@ function DepositFlow({
3497
3519
  ) })
3498
3520
  ] }) : null,
3499
3521
  step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3500
- _chunkTQ6IIGRScjs.ProcessingStep,
3522
+ _chunkMVFMDKAScjs.ProcessingStep,
3501
3523
  {
3502
3524
  smartAccount: step.smartAccount,
3503
3525
  txHash: step.txHash,
@@ -3521,16 +3543,16 @@ function DepositFlow({
3521
3543
  )
3522
3544
  ] });
3523
3545
  }
3524
- if (!_optionalChain([signerContext, 'optionalAccess', _104 => _104.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _105 => _105.publicClient])) {
3546
+ if (!_optionalChain([signerContext, 'optionalAccess', _109 => _109.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _110 => _110.publicClient])) {
3525
3547
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-state", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-text", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "Connecting wallet..." }) }) }) }) });
3526
3548
  }
3527
3549
  const ownerAddress = signerContext.ownerAddress;
3528
- const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _106 => _106.walletClient, 'optionalAccess', _107 => _107.chain, 'optionalAccess', _108 => _108.id]), () => ( _optionalChain([signerContext, 'access', _109 => _109.publicClient, 'access', _110 => _110.chain, 'optionalAccess', _111 => _111.id]))), () => ( targetChain));
3550
+ const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _111 => _111.walletClient, 'optionalAccess', _112 => _112.chain, 'optionalAccess', _113 => _113.id]), () => ( _optionalChain([signerContext, 'access', _114 => _114.publicClient, 'access', _115 => _115.chain, 'optionalAccess', _116 => _116.id]))), () => ( targetChain));
3529
3551
  const getReadClientForChain = (chainId) => {
3530
- if (_optionalChain([signerContext, 'access', _112 => _112.publicClient, 'access', _113 => _113.chain, 'optionalAccess', _114 => _114.id]) === chainId) {
3552
+ if (_optionalChain([signerContext, 'access', _117 => _117.publicClient, 'access', _118 => _118.chain, 'optionalAccess', _119 => _119.id]) === chainId) {
3531
3553
  return signerContext.publicClient;
3532
3554
  }
3533
- return _chunkTQ6IIGRScjs.getPublicClient.call(void 0, chainId);
3555
+ return _chunkMVFMDKAScjs.getPublicClient.call(void 0, chainId);
3534
3556
  };
3535
3557
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
3536
3558
  step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -3581,7 +3603,7 @@ function DepositFlow({
3581
3603
  onContinue: handleAmountContinue,
3582
3604
  onCtaClick: (ctaName) => {
3583
3605
  const receiveSymbol = _chunkR6U6BHCVcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
3584
- _optionalChain([onEvent, 'optionalCall', _115 => _115({
3606
+ _optionalChain([onEvent, 'optionalCall', _120 => _120({
3585
3607
  type: "deposit_modal_connected_wallet_enter_value_cta_click",
3586
3608
  send_token: step.asset.symbol,
3587
3609
  receive_token: receiveSymbol,
@@ -3612,7 +3634,7 @@ function DepositFlow({
3612
3634
  }
3613
3635
  ),
3614
3636
  step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3615
- _chunkTQ6IIGRScjs.ProcessingStep,
3637
+ _chunkMVFMDKAScjs.ProcessingStep,
3616
3638
  {
3617
3639
  smartAccount: step.smartAccount,
3618
3640
  txHash: step.txHash,
@@ -3640,7 +3662,7 @@ function DepositFlow({
3640
3662
  // src/DepositModal.tsx
3641
3663
 
3642
3664
  var ReownDepositInner = _react.lazy.call(void 0,
3643
- () => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-BKMRNZNX.cjs"))).then((m) => ({ default: m.DepositModalReown }))
3665
+ () => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-U5ZTK3PW.cjs"))).then((m) => ({ default: m.DepositModalReown }))
3644
3666
  );
3645
3667
  function DepositModal(props) {
3646
3668
  const needsReown = !!props.reownAppId;
@@ -3709,13 +3731,14 @@ function DepositModalInner({
3709
3731
  debug
3710
3732
  }) {
3711
3733
  const modalRef = _react.useRef.call(void 0, null);
3734
+ const onReadyRef = _chunkMVFMDKAScjs.useLatestRef.call(void 0, onReady);
3712
3735
  const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
3713
3736
  const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
3714
3737
  const backHandlerRef = _react.useRef.call(void 0, void 0);
3715
3738
  const targetChain = _chunkR6U6BHCVcjs.getChainId.call(void 0, targetChainProp);
3716
3739
  const sourceChain = sourceChainProp ? _chunkR6U6BHCVcjs.getChainId.call(void 0, sourceChainProp) : void 0;
3717
3740
  const service = _react.useMemo.call(void 0,
3718
- () => _chunkTQ6IIGRScjs.createDepositService.call(void 0, backendUrl, {
3741
+ () => _chunkMVFMDKAScjs.createDepositService.call(void 0, backendUrl, {
3719
3742
  debug,
3720
3743
  debugScope: "service:deposit"
3721
3744
  }),
@@ -3723,7 +3746,7 @@ function DepositModalInner({
3723
3746
  );
3724
3747
  _react.useEffect.call(void 0, () => {
3725
3748
  if (isOpen && modalRef.current) {
3726
- _chunkTQ6IIGRScjs.applyTheme.call(void 0, modalRef.current, theme);
3749
+ _chunkMVFMDKAScjs.applyTheme.call(void 0, modalRef.current, theme);
3727
3750
  }
3728
3751
  }, [isOpen, theme]);
3729
3752
  _react.useEffect.call(void 0, () => {
@@ -3733,9 +3756,9 @@ function DepositModalInner({
3733
3756
  _react.useEffect.call(void 0, () => {
3734
3757
  if (isOpen && !hasCalledReady.current) {
3735
3758
  hasCalledReady.current = true;
3736
- _optionalChain([onReady, 'optionalCall', _116 => _116()]);
3759
+ _optionalChain([onReadyRef, 'access', _121 => _121.current, 'optionalCall', _122 => _122()]);
3737
3760
  }
3738
- }, [isOpen, onReady]);
3761
+ }, [isOpen, onReadyRef]);
3739
3762
  _react.useEffect.call(void 0, () => {
3740
3763
  if (!isOpen) {
3741
3764
  setCurrentStepIndex(0);
@@ -3752,17 +3775,17 @@ function DepositModalInner({
3752
3775
  setTotalBalanceUsd(balance2);
3753
3776
  }, []);
3754
3777
  const handleBack = _react.useCallback.call(void 0, () => {
3755
- _optionalChain([backHandlerRef, 'access', _117 => _117.current, 'optionalCall', _118 => _118()]);
3778
+ _optionalChain([backHandlerRef, 'access', _123 => _123.current, 'optionalCall', _124 => _124()]);
3756
3779
  }, []);
3757
- const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _119 => _119.showLogo]), () => ( false));
3758
- const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _120 => _120.showStepper]), () => ( false));
3759
- const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _121 => _121.showBackButton]), () => ( true));
3760
- const balance = _optionalChain([uiConfig, 'optionalAccess', _122 => _122.balance]);
3761
- const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _123 => _123.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
3762
- const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _124 => _124.title]), () => ( "Deposit"));
3780
+ const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _125 => _125.showLogo]), () => ( false));
3781
+ const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _126 => _126.showStepper]), () => ( false));
3782
+ const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _127 => _127.showBackButton]), () => ( true));
3783
+ const balance = _optionalChain([uiConfig, 'optionalAccess', _128 => _128.balance]);
3784
+ const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _129 => _129.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
3785
+ const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _130 => _130.title]), () => ( "Deposit"));
3763
3786
  const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
3764
3787
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3765
- _chunkTQ6IIGRScjs.Modal,
3788
+ _chunkMVFMDKAScjs.Modal,
3766
3789
  {
3767
3790
  isOpen,
3768
3791
  onClose,
@@ -3855,7 +3878,7 @@ function DepositModalInner({
3855
3878
  balance.title,
3856
3879
  ":"
3857
3880
  ] }),
3858
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkTQ6IIGRScjs.currencyFormatter.format(totalBalanceUsd) : null))) })
3881
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkMVFMDKAScjs.currencyFormatter.format(totalBalanceUsd) : null))) })
3859
3882
  ] })
3860
3883
  ] }),
3861
3884
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,