@rhinestone/deposit-modal 0.1.31 → 0.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/{DepositModalReown-S7HER5HU.mjs → DepositModalReown-7ZO7HUN3.mjs} +9 -5
  2. package/dist/{DepositModalReown-N7GCYZF7.cjs → DepositModalReown-VNKZT5A7.cjs} +12 -8
  3. package/dist/{WithdrawModalReown-DMDRLYTE.mjs → WithdrawModalReown-PMPLUJBE.mjs} +9 -5
  4. package/dist/{WithdrawModalReown-DJCJ5U7E.cjs → WithdrawModalReown-YP4PEERJ.cjs} +12 -8
  5. package/dist/{chunk-SZ35G2DT.cjs → chunk-4WXSBBHQ.cjs} +101 -107
  6. package/dist/{chunk-3ICS43XC.mjs → chunk-C6I5TFSL.mjs} +4 -0
  7. package/dist/{chunk-EVU7M7A6.mjs → chunk-DLFUXLAM.mjs} +14 -13
  8. package/dist/{chunk-SLI5FHTT.mjs → chunk-ECLVABYN.mjs} +34 -40
  9. package/dist/{chunk-AWFJFSPH.mjs → chunk-HNDZ6G5K.mjs} +166 -249
  10. package/dist/{chunk-PE6OK3FH.cjs → chunk-S4UBVD3H.cjs} +5 -1
  11. package/dist/{chunk-MU2BOEDN.cjs → chunk-SIGTZB3C.cjs} +244 -327
  12. package/dist/{chunk-CS6UIMCF.mjs → chunk-SJEIKMVO.mjs} +10 -2
  13. package/dist/{chunk-VKQA3FO3.cjs → chunk-V7I5T4SW.cjs} +9 -1
  14. package/dist/{chunk-G2RDCQHL.cjs → chunk-YIHOACM3.cjs} +38 -37
  15. package/dist/constants.cjs +2 -2
  16. package/dist/constants.mjs +1 -1
  17. package/dist/deposit.cjs +4 -4
  18. package/dist/deposit.d.cts +2 -2
  19. package/dist/deposit.d.ts +2 -2
  20. package/dist/deposit.mjs +3 -3
  21. package/dist/index.cjs +5 -5
  22. package/dist/index.d.cts +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.mjs +4 -4
  25. package/dist/reown.cjs +5 -5
  26. package/dist/reown.d.cts +1 -1
  27. package/dist/reown.d.ts +1 -1
  28. package/dist/reown.mjs +4 -4
  29. package/dist/{types-DTBfMH0p.d.ts → types-Bp2n2RQ3.d.ts} +0 -1
  30. package/dist/{types-DELv717e.d.cts → types-CIaQPR6F.d.cts} +0 -1
  31. package/dist/withdraw.cjs +4 -4
  32. package/dist/withdraw.d.cts +2 -2
  33. package/dist/withdraw.d.ts +2 -2
  34. package/dist/withdraw.mjs +3 -3
  35. package/package.json +1 -1
@@ -21,7 +21,7 @@
21
21
 
22
22
 
23
23
 
24
- var _chunkG2RDCQHLcjs = require('./chunk-G2RDCQHL.cjs');
24
+ var _chunkYIHOACM3cjs = require('./chunk-YIHOACM3.cjs');
25
25
 
26
26
 
27
27
 
@@ -36,7 +36,8 @@ var _chunkG2RDCQHLcjs = require('./chunk-G2RDCQHL.cjs');
36
36
 
37
37
 
38
38
 
39
- var _chunkPE6OK3FHcjs = require('./chunk-PE6OK3FH.cjs');
39
+
40
+ var _chunkS4UBVD3Hcjs = require('./chunk-S4UBVD3H.cjs');
40
41
 
41
42
  // src/DepositModal.tsx
42
43
 
@@ -56,15 +57,15 @@ var _react = require('react');
56
57
 
57
58
  var _jsxruntime = require('react/jsx-runtime');
58
59
  async function resolveSessionOwner(eoaAddress) {
59
- const localOwner = _chunkG2RDCQHLcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
60
+ const localOwner = _chunkYIHOACM3cjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
60
61
  if (localOwner) {
61
62
  return {
62
- account: _chunkG2RDCQHLcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
63
+ account: _chunkYIHOACM3cjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
63
64
  address: localOwner.address
64
65
  };
65
66
  }
66
- const created = _chunkG2RDCQHLcjs.createSessionOwnerKey.call(void 0, );
67
- _chunkG2RDCQHLcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
67
+ const created = _chunkYIHOACM3cjs.createSessionOwnerKey.call(void 0, );
68
+ _chunkYIHOACM3cjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
68
69
  return {
69
70
  account: created.account,
70
71
  address: created.address
@@ -126,7 +127,7 @@ function SetupStep({
126
127
  primaryType: typedData.primaryType,
127
128
  message: typedData.message
128
129
  });
129
- const sessionDetails = _chunkG2RDCQHLcjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
130
+ const sessionDetails = _chunkYIHOACM3cjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
130
131
  setState({ type: "registering" });
131
132
  await service.registerAccount({
132
133
  address: smartAccount,
@@ -197,7 +198,7 @@ function SetupStep({
197
198
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
198
199
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
199
200
  isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
200
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG2RDCQHLcjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
201
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
201
202
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-text", children: [
202
203
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: renderStateMessage() }),
203
204
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This may take a moment" })
@@ -234,7 +235,7 @@ function SetupStep({
234
235
  ] })
235
236
  ] })
236
237
  ] }),
237
- isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG2RDCQHLcjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
238
+ isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
238
239
  ] });
239
240
  }
240
241
 
@@ -249,7 +250,8 @@ function AssetSelectStep({
249
250
  defaultSourceToken,
250
251
  service,
251
252
  onContinue,
252
- onTotalBalanceComputed
253
+ onTotalBalanceComputed,
254
+ onAssetsLoaded
253
255
  }) {
254
256
  const [assets, setAssets] = _react.useState.call(void 0, []);
255
257
  const [selectedAssetId, setSelectedAssetId] = _react.useState.call(void 0, null);
@@ -257,7 +259,7 @@ function AssetSelectStep({
257
259
  const [error, setError] = _react.useState.call(void 0, null);
258
260
  const defaultAssetId = _react.useMemo.call(void 0, () => {
259
261
  if (!defaultSourceChain || !defaultSourceToken) return null;
260
- return _chunkG2RDCQHLcjs.getAssetId.call(void 0, {
262
+ return _chunkYIHOACM3cjs.getAssetId.call(void 0, {
261
263
  chainId: defaultSourceChain,
262
264
  token: defaultSourceToken
263
265
  });
@@ -274,10 +276,10 @@ function AssetSelectStep({
274
276
  try {
275
277
  const portfolio = await service.fetchPortfolio(address);
276
278
  if (!active) return;
277
- const portfolioAssets = _chunkG2RDCQHLcjs.portfolioToAssets.call(void 0, portfolio.tokens);
279
+ const portfolioAssets = _chunkYIHOACM3cjs.portfolioToAssets.call(void 0, portfolio.tokens);
278
280
  setAssets(portfolioAssets);
279
281
  const hasNative = portfolioAssets.some(
280
- (asset) => asset.token.toLowerCase() === _chunkPE6OK3FHcjs.NATIVE_TOKEN_ADDRESS
282
+ (asset) => asset.token.toLowerCase() === _chunkS4UBVD3Hcjs.NATIVE_TOKEN_ADDRESS
281
283
  );
282
284
  if (!hasNative) {
283
285
  const nativeAssets = await fetchNativeAssets(
@@ -316,7 +318,8 @@ function AssetSelectStep({
316
318
  0
317
319
  );
318
320
  _optionalChain([onTotalBalanceComputed, 'optionalCall', _4 => _4(total)]);
319
- }, [assets, onTotalBalanceComputed]);
321
+ if (assets.length > 0) _optionalChain([onAssetsLoaded, 'optionalCall', _5 => _5(assets)]);
322
+ }, [assets, onTotalBalanceComputed, onAssetsLoaded]);
320
323
  const rows = _react.useMemo.call(void 0, () => {
321
324
  return assets.filter((a) => {
322
325
  try {
@@ -342,7 +345,7 @@ function AssetSelectStep({
342
345
  const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
343
346
  const numeric = Number(raw);
344
347
  if (!Number.isFinite(numeric)) return raw;
345
- return _chunkG2RDCQHLcjs.tokenFormatter.format(numeric);
348
+ return _chunkYIHOACM3cjs.tokenFormatter.format(numeric);
346
349
  } catch (e3) {
347
350
  return asset.balance;
348
351
  }
@@ -356,7 +359,7 @@ function AssetSelectStep({
356
359
  style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
357
360
  children: [
358
361
  loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
359
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG2RDCQHLcjs.Spinner, { className: "rs-text-tertiary" }),
362
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.Spinner, { className: "rs-text-tertiary" }),
360
363
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
361
364
  ] }),
362
365
  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 }) }),
@@ -389,9 +392,9 @@ function AssetSelectStep({
389
392
  !loading && !error && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((asset) => {
390
393
  const isSelected = selectedAssetId === asset.id;
391
394
  const tokenAmount = formatBalance(asset);
392
- const badge = _chunkPE6OK3FHcjs.getChainBadge.call(void 0, asset.chainId);
393
- const tokenIcon = _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, asset.symbol);
394
- const chainIcon = _chunkPE6OK3FHcjs.getChainIcon.call(void 0, asset.chainId);
395
+ const badge = _chunkS4UBVD3Hcjs.getChainBadge.call(void 0, asset.chainId);
396
+ const tokenIcon = _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol);
397
+ const chainIcon = _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, asset.chainId);
395
398
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
396
399
  "button",
397
400
  {
@@ -415,7 +418,7 @@ function AssetSelectStep({
415
418
  "img",
416
419
  {
417
420
  src: chainIcon,
418
- alt: _chunkPE6OK3FHcjs.getChainName.call(void 0, asset.chainId),
421
+ alt: _chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId),
419
422
  className: "rs-asset-chain-badge"
420
423
  }
421
424
  ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -436,7 +439,7 @@ function AssetSelectStep({
436
439
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-asset-chain", children: [
437
440
  " ",
438
441
  "on ",
439
- _chunkPE6OK3FHcjs.getChainName.call(void 0, asset.chainId)
442
+ _chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)
440
443
  ] })
441
444
  ] }),
442
445
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
@@ -446,7 +449,7 @@ function AssetSelectStep({
446
449
  ] })
447
450
  ] })
448
451
  ] }),
449
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkG2RDCQHLcjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
452
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkYIHOACM3cjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
450
453
  ]
451
454
  },
452
455
  asset.id
@@ -456,7 +459,7 @@ function AssetSelectStep({
456
459
  }
457
460
  ),
458
461
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
459
- _chunkG2RDCQHLcjs.Button,
462
+ _chunkYIHOACM3cjs.Button,
460
463
  {
461
464
  onClick: () => selectedAsset && onContinue(selectedAsset),
462
465
  disabled: !selectedAsset,
@@ -464,17 +467,17 @@ function AssetSelectStep({
464
467
  children: "Continue"
465
468
  }
466
469
  ) }),
467
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG2RDCQHLcjs.PoweredBy, {})
470
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.PoweredBy, {})
468
471
  ] });
469
472
  }
470
473
  async function fetchNativeAssets(address, publicClient, existing) {
471
474
  const existingIds = new Set(existing.map((asset) => asset.id));
472
- const connectedChainId = _optionalChain([publicClient, 'access', _5 => _5.chain, 'optionalAccess', _6 => _6.id]);
475
+ const connectedChainId = _optionalChain([publicClient, 'access', _6 => _6.chain, 'optionalAccess', _7 => _7.id]);
473
476
  if (!connectedChainId) return [];
474
- if (!_chunkPE6OK3FHcjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
475
- const id = _chunkG2RDCQHLcjs.getAssetId.call(void 0, {
477
+ if (!_chunkS4UBVD3Hcjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
478
+ const id = _chunkYIHOACM3cjs.getAssetId.call(void 0, {
476
479
  chainId: connectedChainId,
477
- token: _chunkPE6OK3FHcjs.NATIVE_TOKEN_ADDRESS
480
+ token: _chunkS4UBVD3Hcjs.NATIVE_TOKEN_ADDRESS
478
481
  });
479
482
  if (existingIds.has(id)) return [];
480
483
  try {
@@ -483,7 +486,7 @@ async function fetchNativeAssets(address, publicClient, existing) {
483
486
  {
484
487
  id,
485
488
  chainId: connectedChainId,
486
- token: _chunkPE6OK3FHcjs.NATIVE_TOKEN_ADDRESS,
489
+ token: _chunkS4UBVD3Hcjs.NATIVE_TOKEN_ADDRESS,
487
490
  symbol: "ETH",
488
491
  name: "Ethereum",
489
492
  decimals: 18,
@@ -531,8 +534,10 @@ function AmountStep({
531
534
  const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
532
535
  const hasAttemptedSwitch = _react.useRef.call(void 0, false);
533
536
  const chainMismatch = Boolean(
534
- _optionalChain([walletClient, 'optionalAccess', _7 => _7.chain, 'optionalAccess', _8 => _8.id]) && walletClient.chain.id !== asset.chainId
537
+ _optionalChain([walletClient, 'optionalAccess', _8 => _8.chain, 'optionalAccess', _9 => _9.id]) && walletClient.chain.id !== asset.chainId
535
538
  );
539
+ const targetSymbol = _chunkS4UBVD3Hcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
540
+ const isSourceStablecoin = _chunkS4UBVD3Hcjs.isStablecoinSymbol.call(void 0, asset.symbol);
536
541
  const tokenPriceUsd = _react.useMemo.call(void 0, () => {
537
542
  if (tokenPriceUsdOverride !== void 0 && tokenPriceUsdOverride > 0)
538
543
  return tokenPriceUsdOverride;
@@ -556,7 +561,7 @@ function AmountStep({
556
561
  const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
557
562
  if (!balanceTarget || !publicClient) return;
558
563
  try {
559
- const bal = _chunkG2RDCQHLcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
564
+ const bal = _chunkYIHOACM3cjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
560
565
  address: asset.token,
561
566
  abi: _viem.erc20Abi,
562
567
  functionName: "balanceOf",
@@ -581,26 +586,24 @@ function AmountStep({
581
586
  hasAttemptedSwitch.current = true;
582
587
  setIsSwitching(true);
583
588
  switchChain(asset.chainId).catch((err) => {
584
- const message = err instanceof Error ? err.message : "Failed to switch chain";
585
- setError(message);
589
+ const raw = err instanceof Error ? err.message : "Failed to switch chain";
590
+ setError(_chunkYIHOACM3cjs.formatUserError.call(void 0, raw));
586
591
  }).finally(() => {
587
592
  setIsSwitching(false);
588
593
  });
589
594
  }
590
595
  }, [chainMismatch, switchChain, asset.chainId]);
596
+ _react.useEffect.call(void 0, () => {
597
+ hasAttemptedSwitch.current = false;
598
+ }, [asset.chainId]);
591
599
  _react.useEffect.call(void 0, () => {
592
600
  if (defaultAmount && !amount) {
593
601
  const parsed = Number(defaultAmount);
594
602
  if (Number.isFinite(parsed) && parsed > 0) {
595
- if (hasPricing) {
596
- const usdValue = parsed * tokenPriceUsd;
597
- setAmount(usdValue.toFixed(2));
598
- } else {
599
- setAmount(parsed.toString());
600
- }
603
+ setAmount(parsed.toString());
601
604
  }
602
605
  }
603
- }, [defaultAmount, tokenPriceUsd, hasPricing, amount]);
606
+ }, [defaultAmount, amount]);
604
607
  const balanceUsd = _react.useMemo.call(void 0, () => {
605
608
  if (balance === null || tokenPriceUsd === null) return null;
606
609
  try {
@@ -612,7 +615,7 @@ function AmountStep({
612
615
  }
613
616
  }, [balance, tokenPriceUsd, asset.decimals]);
614
617
  _react.useEffect.call(void 0, () => {
615
- _optionalChain([onBalanceUsdChange, 'optionalCall', _9 => _9(_nullishCoalesce(balanceUsd, () => ( 0)))]);
618
+ _optionalChain([onBalanceUsdChange, 'optionalCall', _10 => _10(_nullishCoalesce(balanceUsd, () => ( 0)))]);
616
619
  }, [balanceUsd, onBalanceUsdChange]);
617
620
  const formattedBalance = _react.useMemo.call(void 0, () => {
618
621
  if (balance === null) return "...";
@@ -620,41 +623,29 @@ function AmountStep({
620
623
  const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
621
624
  const numeric = Number(raw);
622
625
  if (!Number.isFinite(numeric)) return raw;
623
- return _chunkG2RDCQHLcjs.tokenFormatter.format(numeric);
626
+ return _chunkYIHOACM3cjs.tokenFormatter.format(numeric);
624
627
  } catch (e8) {
625
628
  return "...";
626
629
  }
627
630
  }, [balance, asset.decimals]);
628
- const tokenAmount = _react.useMemo.call(void 0, () => {
629
- if (!amount) return null;
630
- if (hasPricing) {
631
- const usd = Number(amount);
632
- if (!Number.isFinite(usd) || usd <= 0) return null;
633
- return usd / tokenPriceUsd;
634
- }
635
- const val = Number(amount);
636
- return Number.isFinite(val) && val > 0 ? val : null;
637
- }, [amount, tokenPriceUsd, hasPricing]);
638
- const formattedTokenAmount = _react.useMemo.call(void 0, () => {
639
- if (tokenAmount === null) return "0.00";
640
- return _chunkG2RDCQHLcjs.tokenFormatter.format(tokenAmount);
641
- }, [tokenAmount]);
642
- const targetSymbol = _chunkPE6OK3FHcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
643
631
  const handlePresetClick = (percentage) => {
644
632
  if (balance === null) return;
645
- if (hasPricing && balanceUsd !== null) {
646
- const value = balanceUsd * percentage / 100;
647
- setAmount(value.toFixed(2));
648
- } else {
649
- try {
650
- const balanceUnits = Number(_viem.formatUnits.call(void 0, balance, asset.decimals));
651
- if (Number.isFinite(balanceUnits)) {
652
- const value = balanceUnits * percentage / 100;
653
- setAmount(value.toString());
654
- }
655
- } catch (e9) {
656
- return;
633
+ try {
634
+ const balanceUnits = Number(_viem.formatUnits.call(void 0, balance, asset.decimals));
635
+ if (!Number.isFinite(balanceUnits)) return;
636
+ let value;
637
+ if (isSourceStablecoin || !hasPricing) {
638
+ value = balanceUnits * percentage / 100;
639
+ } else {
640
+ value = (_nullishCoalesce(balanceUsd, () => ( 0))) * percentage / 100;
657
641
  }
642
+ const maxDecimals = 3;
643
+ const factor = 10 ** maxDecimals;
644
+ const truncated = Math.floor(value * factor) / factor;
645
+ const formatted = truncated.toFixed(maxDecimals).replace(/\.?0+$/, "");
646
+ setAmount(formatted);
647
+ } catch (e9) {
648
+ return;
658
649
  }
659
650
  if (error) setError(null);
660
651
  };
@@ -664,24 +655,28 @@ function AmountStep({
664
655
  setError("Please enter a valid amount");
665
656
  return;
666
657
  }
667
- let tokenAmountStr;
658
+ let sourceAmount;
659
+ if (isSourceStablecoin || !hasPricing) {
660
+ sourceAmount = numericAmount;
661
+ } else {
662
+ sourceAmount = numericAmount / tokenPriceUsd;
663
+ }
668
664
  if (hasPricing) {
669
- if (_optionalChain([uiConfig, 'optionalAccess', _10 => _10.maxDepositUsd]) && numericAmount > uiConfig.maxDepositUsd) {
665
+ const usdValue = numericAmount;
666
+ if (_optionalChain([uiConfig, 'optionalAccess', _11 => _11.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
670
667
  setError(
671
- `Maximum deposit is ${_chunkG2RDCQHLcjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
668
+ `Maximum deposit is ${_chunkYIHOACM3cjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
672
669
  );
673
670
  return;
674
671
  }
675
- if (_optionalChain([uiConfig, 'optionalAccess', _11 => _11.minDepositUsd]) && numericAmount < uiConfig.minDepositUsd) {
672
+ if (_optionalChain([uiConfig, 'optionalAccess', _12 => _12.minDepositUsd]) && usdValue < uiConfig.minDepositUsd) {
676
673
  setError(
677
- `Minimum deposit is ${_chunkG2RDCQHLcjs.currencyFormatter.format(uiConfig.minDepositUsd)}`
674
+ `Minimum deposit is ${_chunkYIHOACM3cjs.currencyFormatter.format(uiConfig.minDepositUsd)}`
678
675
  );
679
676
  return;
680
677
  }
681
- tokenAmountStr = (numericAmount / tokenPriceUsd).toString();
682
- } else {
683
- tokenAmountStr = numericAmount.toString();
684
678
  }
679
+ const tokenAmountStr = sourceAmount.toString();
685
680
  let amountInUnits;
686
681
  try {
687
682
  amountInUnits = _viem.parseUnits.call(void 0, tokenAmountStr, asset.decimals);
@@ -694,24 +689,12 @@ function AmountStep({
694
689
  return;
695
690
  }
696
691
  setError(null);
697
- onContinue(tokenAmountStr, _nullishCoalesce(balance, () => ( void 0)));
698
- };
699
- const handleSwitch = async () => {
700
- if (!asset.chainId || !switchChain) return;
701
- setIsSwitching(true);
702
- try {
703
- await switchChain(asset.chainId);
704
- } catch (err) {
705
- const message = err instanceof Error ? err.message : "Failed to switch chain";
706
- setError(message);
707
- } finally {
708
- setIsSwitching(false);
709
- }
692
+ onContinue(tokenAmountStr, amount, _nullishCoalesce(balance, () => ( void 0)));
710
693
  };
711
694
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
712
695
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
713
696
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
714
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-input-wrapper", children: hasPricing ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
697
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-input-wrapper", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
715
698
  "input",
716
699
  {
717
700
  type: "text",
@@ -728,50 +711,19 @@ function AmountStep({
728
711
  },
729
712
  autoFocus: true
730
713
  }
731
- ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
732
- "input",
733
- {
734
- type: "text",
735
- inputMode: "decimal",
736
- className: "rs-amount-input-large",
737
- placeholder: `0.00 ${asset.symbol}`,
738
- value: amount,
739
- onChange: (e) => {
740
- const raw = e.target.value.replace(/[^0-9.]/g, "");
741
- const parts = raw.split(".");
742
- if (parts.length > 2) return;
743
- setAmount(raw);
744
- if (error) setError(null);
745
- },
746
- autoFocus: true
747
- }
748
714
  ) }),
749
- (_nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _12 => _12.showTokenBalance]), () => ( false))) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
750
- hasPricing ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-token-value", children: [
751
- formattedTokenAmount,
715
+ !isSourceStablecoin && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-available", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-available-value", children: [
716
+ formattedBalance,
717
+ " ",
718
+ asset.symbol,
719
+ " available",
720
+ hasPricing && balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
752
721
  " ",
753
- asset.symbol
754
- ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
755
- "div",
756
- {
757
- className: "rs-amount-token-value",
758
- style: { color: "var(--rs-muted-foreground)" },
759
- children: "Price unavailable"
760
- }
761
- ),
762
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-available", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-available-value", children: [
763
- formattedBalance,
764
- " ",
765
- asset.symbol,
766
- " available",
767
- hasPricing && balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
768
- " ",
769
- "(",
770
- _chunkG2RDCQHLcjs.currencyFormatter.format(balanceUsd),
771
- ")"
772
- ] })
773
- ] }) })
774
- ] })
722
+ "(",
723
+ _chunkYIHOACM3cjs.currencyFormatter.format(balanceUsd),
724
+ ")"
725
+ ] })
726
+ ] }) })
775
727
  ] }),
776
728
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
777
729
  "div",
@@ -782,26 +734,26 @@ function AmountStep({
782
734
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You send" }),
783
735
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
784
736
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token-icon-wrapper", children: [
785
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, asset.symbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
737
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
786
738
  "img",
787
739
  {
788
- src: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, asset.symbol),
740
+ src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol),
789
741
  alt: asset.symbol
790
742
  }
791
743
  ) : asset.symbol.slice(0, 2) }),
792
744
  (() => {
793
- const chainIcon = _chunkPE6OK3FHcjs.getChainIcon.call(void 0, asset.chainId);
745
+ const chainIcon = _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, asset.chainId);
794
746
  if (chainIcon) {
795
747
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
796
748
  "img",
797
749
  {
798
750
  src: chainIcon,
799
- alt: _chunkPE6OK3FHcjs.getChainName.call(void 0, asset.chainId),
751
+ alt: _chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId),
800
752
  className: "rs-flow-pill-chain-badge"
801
753
  }
802
754
  );
803
755
  }
804
- const badge = _chunkPE6OK3FHcjs.getChainBadge.call(void 0, asset.chainId);
756
+ const badge = _chunkS4UBVD3Hcjs.getChainBadge.call(void 0, asset.chainId);
805
757
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
806
758
  "div",
807
759
  {
@@ -839,26 +791,26 @@ function AmountStep({
839
791
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You receive" }),
840
792
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
841
793
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token-icon-wrapper", children: [
842
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, targetSymbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
794
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, targetSymbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
843
795
  "img",
844
796
  {
845
- src: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, targetSymbol),
797
+ src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, targetSymbol),
846
798
  alt: targetSymbol
847
799
  }
848
800
  ) : targetSymbol.slice(0, 2) }),
849
801
  (() => {
850
- const chainIcon = _chunkPE6OK3FHcjs.getChainIcon.call(void 0, targetChain);
802
+ const chainIcon = _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, targetChain);
851
803
  if (chainIcon) {
852
804
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
853
805
  "img",
854
806
  {
855
807
  src: chainIcon,
856
- alt: _chunkPE6OK3FHcjs.getChainName.call(void 0, targetChain),
808
+ alt: _chunkS4UBVD3Hcjs.getChainName.call(void 0, targetChain),
857
809
  className: "rs-flow-pill-chain-badge"
858
810
  }
859
811
  );
860
812
  }
861
- const badge = _chunkPE6OK3FHcjs.getChainBadge.call(void 0, targetChain);
813
+ const badge = _chunkS4UBVD3Hcjs.getChainBadge.call(void 0, targetChain);
862
814
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
863
815
  "div",
864
816
  {
@@ -904,23 +856,7 @@ function AmountStep({
904
856
  }
905
857
  )
906
858
  ] }),
907
- chainMismatch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", style: { marginTop: 16 }, children: [
908
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
909
- "Switch your wallet to ",
910
- _chunkPE6OK3FHcjs.getChainName.call(void 0, asset.chainId),
911
- " to continue."
912
- ] }),
913
- switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
914
- _chunkG2RDCQHLcjs.Button,
915
- {
916
- variant: "outline",
917
- size: "small",
918
- loading: isSwitching,
919
- onClick: handleSwitch,
920
- children: "Switch"
921
- }
922
- )
923
- ] }),
859
+ chainMismatch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch", style: { marginTop: 16 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)}...` : `Switch your wallet to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)} to continue.` }) }),
924
860
  error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
925
861
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
926
862
  "svg",
@@ -944,7 +880,7 @@ function AmountStep({
944
880
  ] })
945
881
  ] }),
946
882
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
947
- _chunkG2RDCQHLcjs.Button,
883
+ _chunkYIHOACM3cjs.Button,
948
884
  {
949
885
  onClick: handleContinue,
950
886
  fullWidth: true,
@@ -952,7 +888,7 @@ function AmountStep({
952
888
  children: "Continue"
953
889
  }
954
890
  ) }),
955
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG2RDCQHLcjs.PoweredBy, {})
891
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.PoweredBy, {})
956
892
  ] });
957
893
  }
958
894
 
@@ -960,7 +896,6 @@ function AmountStep({
960
896
 
961
897
 
962
898
 
963
- var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set(["USDC", "USDT", "DAI"]);
964
899
  function ConfirmStep({
965
900
  walletClient,
966
901
  address,
@@ -968,6 +903,8 @@ function ConfirmStep({
968
903
  recipient,
969
904
  asset,
970
905
  amount,
906
+ targetAmount,
907
+ targetTokenPriceUsd,
971
908
  balance,
972
909
  targetChain,
973
910
  targetToken,
@@ -979,62 +916,44 @@ function ConfirmStep({
979
916
  const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
980
917
  const [error, setError] = _react.useState.call(void 0, null);
981
918
  const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
919
+ const hasAttemptedSwitch = _react.useRef.call(void 0, false);
982
920
  const chainMismatch = _optionalChain([walletClient, 'optionalAccess', _13 => _13.chain, 'optionalAccess', _14 => _14.id]) && walletClient.chain.id !== asset.chainId;
983
921
  const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
984
- const targetSymbol = sameRoute ? asset.symbol : _chunkPE6OK3FHcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
985
- const formattedAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
986
- const tokenPriceUsd = _react.useMemo.call(void 0, () => {
987
- if (asset.balanceUsd === void 0 || !asset.balance) return null;
988
- try {
989
- const balanceUnits = Number(
990
- _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals)
991
- );
992
- if (!Number.isFinite(balanceUnits) || balanceUnits <= 0) return null;
993
- return asset.balanceUsd / balanceUnits;
994
- } catch (e11) {
995
- return null;
996
- }
997
- }, [asset.balanceUsd, asset.balance, asset.decimals]);
998
- const amountUsd = _react.useMemo.call(void 0, () => {
999
- if (!amount || tokenPriceUsd === null) return null;
1000
- const parsed = Number(amount);
1001
- if (!Number.isFinite(parsed) || parsed <= 0) return null;
1002
- return parsed * tokenPriceUsd;
1003
- }, [amount, tokenPriceUsd]);
1004
- const targetTokenPriceUsd = _react.useMemo.call(void 0, () => {
1005
- const targetSym = targetSymbol.toUpperCase();
1006
- const sourceSym = asset.symbol.toUpperCase();
1007
- if (STABLECOIN_SYMBOLS.has(targetSym)) return 1;
1008
- if (targetSym === sourceSym && tokenPriceUsd !== null) return tokenPriceUsd;
1009
- return null;
1010
- }, [targetSymbol, asset.symbol, tokenPriceUsd]);
1011
- const receiveAmountUsd = _react.useMemo.call(void 0, () => {
1012
- if (amountUsd === null) return null;
1013
- return sameRoute ? amountUsd : amountUsd * 0.99;
1014
- }, [amountUsd, sameRoute]);
1015
- const receiveTokenAmount = _react.useMemo.call(void 0, () => {
1016
- if (sameRoute) {
1017
- const parsed = Number(amount);
1018
- return Number.isFinite(parsed) ? parsed : null;
922
+ const targetSymbol = sameRoute ? asset.symbol : _chunkS4UBVD3Hcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
923
+ const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
924
+ const formattedReceiveAmount = (() => {
925
+ if (sameRoute) return formattedSendAmount;
926
+ const dollarValue = Number(targetAmount);
927
+ if (!Number.isFinite(dollarValue) || dollarValue <= 0) return formattedSendAmount;
928
+ if (targetTokenPriceUsd !== null && targetTokenPriceUsd > 0) {
929
+ const tokenAmount = dollarValue / targetTokenPriceUsd;
930
+ return tokenAmount.toLocaleString("en-US", { maximumFractionDigits: 6 });
1019
931
  }
1020
- if (receiveAmountUsd === null || targetTokenPriceUsd === null || targetTokenPriceUsd === 0)
1021
- return null;
1022
- return receiveAmountUsd / targetTokenPriceUsd;
1023
- }, [sameRoute, amount, receiveAmountUsd, targetTokenPriceUsd]);
1024
- const formattedReceiveAmount = _react.useMemo.call(void 0, () => {
1025
- if (receiveTokenAmount === null) return formattedAmount;
1026
- return receiveTokenAmount.toLocaleString("en-US", {
1027
- maximumFractionDigits: 6
1028
- });
1029
- }, [receiveTokenAmount, formattedAmount]);
932
+ return formattedSendAmount;
933
+ })();
1030
934
  const receiveAmount = sameRoute ? formattedReceiveAmount : `~ ${formattedReceiveAmount}`;
935
+ _react.useEffect.call(void 0, () => {
936
+ if (chainMismatch && switchChain && !hasAttemptedSwitch.current) {
937
+ hasAttemptedSwitch.current = true;
938
+ setIsSwitching(true);
939
+ switchChain(asset.chainId).catch((err) => {
940
+ const raw = err instanceof Error ? err.message : "Failed to switch chain";
941
+ setError(_chunkYIHOACM3cjs.formatUserError.call(void 0, raw));
942
+ }).finally(() => {
943
+ setIsSwitching(false);
944
+ });
945
+ }
946
+ }, [chainMismatch, switchChain, asset.chainId]);
947
+ _react.useEffect.call(void 0, () => {
948
+ hasAttemptedSwitch.current = false;
949
+ }, [asset.chainId]);
1031
950
  const handleConfirm = async () => {
1032
951
  if (!address || !walletClient) {
1033
952
  setError("Wallet not connected");
1034
953
  return;
1035
954
  }
1036
955
  if (chainMismatch) {
1037
- setError(`Switch to ${_chunkPE6OK3FHcjs.getChainName.call(void 0, asset.chainId)} to sign`);
956
+ setError(`Switch to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)} to sign`);
1038
957
  return;
1039
958
  }
1040
959
  const parsedAmount = parseFloat(amount);
@@ -1045,7 +964,7 @@ function ConfirmStep({
1045
964
  let amountUnits;
1046
965
  try {
1047
966
  amountUnits = _viem.parseUnits.call(void 0, amount, asset.decimals);
1048
- } catch (e12) {
967
+ } catch (e11) {
1049
968
  setError("Please enter a valid amount");
1050
969
  return;
1051
970
  }
@@ -1062,7 +981,7 @@ function ConfirmStep({
1062
981
  throw new Error("Wallet not properly connected");
1063
982
  }
1064
983
  const transferTo = sameRoute ? recipient : smartAccount;
1065
- const hash = _chunkG2RDCQHLcjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
984
+ const hash = _chunkYIHOACM3cjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
1066
985
  account,
1067
986
  chain,
1068
987
  to: transferTo,
@@ -1079,25 +998,13 @@ function ConfirmStep({
1079
998
  onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
1080
999
  } catch (err) {
1081
1000
  const raw = err instanceof Error ? err.message : "Transfer failed";
1082
- const message = _chunkG2RDCQHLcjs.formatUserError.call(void 0, raw);
1001
+ const message = _chunkYIHOACM3cjs.formatUserError.call(void 0, raw);
1083
1002
  setError(message);
1084
1003
  _optionalChain([onError, 'optionalCall', _16 => _16(message, "TRANSFER_ERROR")]);
1085
1004
  } finally {
1086
1005
  setIsSubmitting(false);
1087
1006
  }
1088
1007
  };
1089
- const handleSwitch = async () => {
1090
- if (!switchChain) return;
1091
- setIsSwitching(true);
1092
- try {
1093
- await switchChain(asset.chainId);
1094
- } catch (err) {
1095
- const raw = err instanceof Error ? err.message : "Failed to switch chain";
1096
- setError(_chunkG2RDCQHLcjs.formatUserError.call(void 0, raw));
1097
- } finally {
1098
- setIsSwitching(false);
1099
- }
1100
- };
1101
1008
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
1102
1009
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { padding: "12px 12px 10px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-title", children: "Review order" }) }),
1103
1010
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-space-y-3", style: { paddingTop: 0 }, children: [
@@ -1110,15 +1017,15 @@ function ConfirmStep({
1110
1017
  className: "rs-card-value",
1111
1018
  style: { display: "flex", alignItems: "center", gap: 8 },
1112
1019
  children: [
1113
- _chunkPE6OK3FHcjs.getChainIcon.call(void 0, asset.chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1020
+ _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, asset.chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1114
1021
  "img",
1115
1022
  {
1116
- src: _chunkPE6OK3FHcjs.getChainIcon.call(void 0, asset.chainId),
1023
+ src: _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, asset.chainId),
1117
1024
  alt: "",
1118
1025
  style: { width: 16, height: 16, borderRadius: 3 }
1119
1026
  }
1120
1027
  ),
1121
- _chunkPE6OK3FHcjs.getChainName.call(void 0, asset.chainId)
1028
+ _chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)
1122
1029
  ]
1123
1030
  }
1124
1031
  )
@@ -1131,15 +1038,15 @@ function ConfirmStep({
1131
1038
  className: "rs-card-value",
1132
1039
  style: { display: "flex", alignItems: "center", gap: 8 },
1133
1040
  children: [
1134
- _chunkPE6OK3FHcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1041
+ _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1135
1042
  "img",
1136
1043
  {
1137
- src: _chunkPE6OK3FHcjs.getChainIcon.call(void 0, targetChain),
1044
+ src: _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, targetChain),
1138
1045
  alt: "",
1139
1046
  style: { width: 16, height: 16, borderRadius: 3 }
1140
1047
  }
1141
1048
  ),
1142
- _chunkPE6OK3FHcjs.getChainName.call(void 0, targetChain)
1049
+ _chunkS4UBVD3Hcjs.getChainName.call(void 0, targetChain)
1143
1050
  ]
1144
1051
  }
1145
1052
  )
@@ -1158,15 +1065,15 @@ function ConfirmStep({
1158
1065
  className: "rs-card-value",
1159
1066
  style: { display: "flex", alignItems: "center", gap: 6 },
1160
1067
  children: [
1161
- _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, asset.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1068
+ _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1162
1069
  "img",
1163
1070
  {
1164
- src: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, asset.symbol),
1071
+ src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol),
1165
1072
  alt: "",
1166
1073
  style: { width: 16, height: 16, borderRadius: "50%" }
1167
1074
  }
1168
1075
  ),
1169
- formattedAmount,
1076
+ formattedSendAmount,
1170
1077
  " ",
1171
1078
  asset.symbol
1172
1079
  ]
@@ -1181,10 +1088,10 @@ function ConfirmStep({
1181
1088
  className: "rs-card-value",
1182
1089
  style: { display: "flex", alignItems: "center", gap: 6 },
1183
1090
  children: [
1184
- _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1091
+ _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1185
1092
  "img",
1186
1093
  {
1187
- src: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, targetSymbol),
1094
+ src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, targetSymbol),
1188
1095
  alt: "",
1189
1096
  style: { width: 16, height: 16, borderRadius: "50%" }
1190
1097
  }
@@ -1195,29 +1102,9 @@ function ConfirmStep({
1195
1102
  ]
1196
1103
  }
1197
1104
  )
1198
- ] }),
1199
- receiveAmountUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
1200
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Value" }),
1201
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value", children: _chunkG2RDCQHLcjs.currencyFormatter.format(receiveAmountUsd) })
1202
1105
  ] })
1203
1106
  ] }),
1204
- chainMismatch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", children: [
1205
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
1206
- "Switch your wallet to ",
1207
- _chunkPE6OK3FHcjs.getChainName.call(void 0, asset.chainId),
1208
- " to sign."
1209
- ] }),
1210
- switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1211
- _chunkG2RDCQHLcjs.Button,
1212
- {
1213
- variant: "outline",
1214
- size: "small",
1215
- loading: isSwitching,
1216
- onClick: handleSwitch,
1217
- children: "Switch"
1218
- }
1219
- )
1220
- ] }),
1107
+ chainMismatch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)}...` : `Switch your wallet to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)} to sign.` }) }),
1221
1108
  error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-alert rs-alert--error", children: [
1222
1109
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1223
1110
  "svg",
@@ -1241,7 +1128,7 @@ function ConfirmStep({
1241
1128
  ] })
1242
1129
  ] }),
1243
1130
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1244
- _chunkG2RDCQHLcjs.Button,
1131
+ _chunkYIHOACM3cjs.Button,
1245
1132
  {
1246
1133
  onClick: handleConfirm,
1247
1134
  loading: isSubmitting,
@@ -1250,7 +1137,7 @@ function ConfirmStep({
1250
1137
  children: "Confirm Order"
1251
1138
  }
1252
1139
  ) }),
1253
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG2RDCQHLcjs.PoweredBy, {})
1140
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.PoweredBy, {})
1254
1141
  ] });
1255
1142
  }
1256
1143
 
@@ -1395,12 +1282,12 @@ function DepositAddressStep({
1395
1282
  onDepositDetected,
1396
1283
  onError
1397
1284
  }) {
1398
- const supportedChainIds = _react.useMemo.call(void 0, () => _chunkPE6OK3FHcjs.getSupportedChainIds.call(void 0, ), []);
1285
+ const supportedChainIds = _react.useMemo.call(void 0, () => _chunkS4UBVD3Hcjs.getSupportedChainIds.call(void 0, ), []);
1399
1286
  const BASE_CHAIN_ID = 8453;
1400
1287
  const defaultChainId = supportedChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : supportedChainIds[0];
1401
1288
  const [sourceChainId, setSourceChainId] = _react.useState.call(void 0, defaultChainId);
1402
1289
  const tokensForChain = _react.useMemo.call(void 0,
1403
- () => _chunkPE6OK3FHcjs.getTargetTokenSymbolsForChain.call(void 0, sourceChainId),
1290
+ () => _chunkS4UBVD3Hcjs.getTargetTokenSymbolsForChain.call(void 0, sourceChainId),
1404
1291
  [sourceChainId]
1405
1292
  );
1406
1293
  const defaultToken = tokensForChain.includes("USDC") ? "USDC" : _nullishCoalesce(tokensForChain[0], () => ( "USDC"));
@@ -1430,7 +1317,7 @@ function DepositAddressStep({
1430
1317
  await navigator.clipboard.writeText(smartAccount);
1431
1318
  setCopied(true);
1432
1319
  setTimeout(() => setCopied(false), 2e3);
1433
- } catch (e13) {
1320
+ } catch (e12) {
1434
1321
  const textarea = document.createElement("textarea");
1435
1322
  textarea.value = smartAccount;
1436
1323
  textarea.style.position = "fixed";
@@ -1455,7 +1342,7 @@ function DepositAddressStep({
1455
1342
  const status = await service.fetchLatestStatus(smartAccount);
1456
1343
  if (cancelled || depositHandledRef.current) return;
1457
1344
  const event = status.lastEvent;
1458
- const eventTxHash = _chunkG2RDCQHLcjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_optionalChain([_chunkG2RDCQHLcjs.getEventTxHash.call(void 0, event), 'optionalAccess', _20 => _20.toLowerCase, 'call', _21 => _21()]), () => ( null)) : null;
1345
+ const eventTxHash = _chunkYIHOACM3cjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_optionalChain([_chunkYIHOACM3cjs.getEventTxHash.call(void 0, event), 'optionalAccess', _20 => _20.toLowerCase, 'call', _21 => _21()]), () => ( null)) : null;
1459
1346
  if (baselineTxHash === void 0) {
1460
1347
  baselineTxHash = eventTxHash;
1461
1348
  } else if (eventTxHash && eventTxHash !== baselineTxHash) {
@@ -1463,7 +1350,7 @@ function DepositAddressStep({
1463
1350
  const fallback = sourceSelectionRef.current;
1464
1351
  const chainId = _nullishCoalesce(details.chainId, () => ( fallback.chainId));
1465
1352
  const amount = _nullishCoalesce(details.amount, () => ( "0"));
1466
- const token = _nullishCoalesce(details.token, () => ( _chunkPE6OK3FHcjs.getTokenAddress.call(void 0, fallback.tokenSymbol, fallback.chainId)));
1353
+ const token = _nullishCoalesce(details.token, () => ( _chunkS4UBVD3Hcjs.getTokenAddress.call(void 0, fallback.tokenSymbol, fallback.chainId)));
1467
1354
  if (token) {
1468
1355
  depositHandledRef.current = true;
1469
1356
  onDepositDetected(eventTxHash, chainId, amount, token);
@@ -1488,7 +1375,7 @@ function DepositAddressStep({
1488
1375
  clearTimeout(timeoutId);
1489
1376
  };
1490
1377
  }, [smartAccount, service, onDepositDetected, onError]);
1491
- const chainIconSrc = _chunkPE6OK3FHcjs.getChainIcon.call(void 0, sourceChainId);
1378
+ const chainIconSrc = _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, sourceChainId);
1492
1379
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
1493
1380
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-body", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address", children: [
1494
1381
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
@@ -1504,10 +1391,10 @@ function DepositAddressStep({
1504
1391
  setChainDropdownOpen(false);
1505
1392
  },
1506
1393
  children: [
1507
- _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, sourceTokenSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1394
+ _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, sourceTokenSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1508
1395
  "img",
1509
1396
  {
1510
- src: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, sourceTokenSymbol),
1397
+ src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, sourceTokenSymbol),
1511
1398
  alt: "",
1512
1399
  className: "rs-deposit-address-dropdown-icon"
1513
1400
  }
@@ -1544,10 +1431,10 @@ function DepositAddressStep({
1544
1431
  setTokenDropdownOpen(false);
1545
1432
  },
1546
1433
  children: [
1547
- _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1434
+ _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1548
1435
  "img",
1549
1436
  {
1550
- src: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, symbol),
1437
+ src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, symbol),
1551
1438
  alt: "",
1552
1439
  className: "rs-deposit-address-dropdown-icon"
1553
1440
  }
@@ -1570,15 +1457,15 @@ function DepositAddressStep({
1570
1457
  setTokenDropdownOpen(false);
1571
1458
  },
1572
1459
  children: [
1573
- _chunkPE6OK3FHcjs.getChainIcon.call(void 0, sourceChainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1460
+ _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, sourceChainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1574
1461
  "img",
1575
1462
  {
1576
- src: _chunkPE6OK3FHcjs.getChainIcon.call(void 0, sourceChainId),
1463
+ src: _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, sourceChainId),
1577
1464
  alt: "",
1578
1465
  className: "rs-deposit-address-dropdown-icon"
1579
1466
  }
1580
1467
  ),
1581
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkPE6OK3FHcjs.getChainName.call(void 0, sourceChainId) }),
1468
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkS4UBVD3Hcjs.getChainName.call(void 0, sourceChainId) }),
1582
1469
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1583
1470
  "svg",
1584
1471
  {
@@ -1610,15 +1497,15 @@ function DepositAddressStep({
1610
1497
  setChainDropdownOpen(false);
1611
1498
  },
1612
1499
  children: [
1613
- _chunkPE6OK3FHcjs.getChainIcon.call(void 0, chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1500
+ _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1614
1501
  "img",
1615
1502
  {
1616
- src: _chunkPE6OK3FHcjs.getChainIcon.call(void 0, chainId),
1503
+ src: _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, chainId),
1617
1504
  alt: "",
1618
1505
  className: "rs-deposit-address-dropdown-icon"
1619
1506
  }
1620
1507
  ),
1621
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkPE6OK3FHcjs.getChainName.call(void 0, chainId) })
1508
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkS4UBVD3Hcjs.getChainName.call(void 0, chainId) })
1622
1509
  ]
1623
1510
  },
1624
1511
  chainId
@@ -1668,7 +1555,7 @@ function DepositAddressStep({
1668
1555
  ] }),
1669
1556
  pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
1670
1557
  ] }) }),
1671
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG2RDCQHLcjs.PoweredBy, {})
1558
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.PoweredBy, {})
1672
1559
  ] });
1673
1560
  }
1674
1561
  DepositAddressStep.displayName = "DepositAddressStep";
@@ -1689,12 +1576,13 @@ function DepositFlow({
1689
1576
  sourceToken: defaultSourceToken,
1690
1577
  amount: defaultAmount,
1691
1578
  recipient,
1692
- signerAddress = _chunkPE6OK3FHcjs.DEFAULT_SIGNER_ADDRESS,
1579
+ signerAddress = _chunkS4UBVD3Hcjs.DEFAULT_SIGNER_ADDRESS,
1693
1580
  sessionChainIds,
1694
1581
  forceRegister = false,
1695
1582
  waitForFinalTx = true,
1696
1583
  reownWallet,
1697
1584
  onConnect,
1585
+ onDisconnect,
1698
1586
  onRequestConnect,
1699
1587
  connectButtonLabel,
1700
1588
  uiConfig,
@@ -1713,6 +1601,23 @@ function DepositFlow({
1713
1601
  const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
1714
1602
  const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
1715
1603
  const [selectedConnectAddress, setSelectedConnectAddress] = _react.useState.call(void 0, null);
1604
+ const portfolioAssetsRef = _react.useRef.call(void 0, []);
1605
+ const handleAssetsLoaded = _react.useCallback.call(void 0, (assets) => {
1606
+ portfolioAssetsRef.current = assets;
1607
+ }, []);
1608
+ const getTokenPriceUsd = _react.useCallback.call(void 0, (symbol) => {
1609
+ const sym = symbol.toLowerCase();
1610
+ for (const asset of portfolioAssetsRef.current) {
1611
+ if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
1612
+ try {
1613
+ const balanceUnits = Number(asset.balance) / 10 ** asset.decimals;
1614
+ if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
1615
+ } catch (e13) {
1616
+ }
1617
+ }
1618
+ }
1619
+ return null;
1620
+ }, []);
1716
1621
  const dappSwitchChain = _react.useMemo.call(void 0, () => {
1717
1622
  if (!_optionalChain([dappWalletClient, 'optionalAccess', _23 => _23.switchChain])) return void 0;
1718
1623
  return async (chainId) => {
@@ -1730,7 +1635,7 @@ function DepositFlow({
1730
1635
  });
1731
1636
  seen.add(dappWalletClient.account.address.toLowerCase());
1732
1637
  }
1733
- if (_optionalChain([reownWallet, 'optionalAccess', _27 => _27.address]) && reownWallet.isConnected && !seen.has(reownWallet.address.toLowerCase())) {
1638
+ if (_optionalChain([reownWallet, 'optionalAccess', _27 => _27.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(reownWallet.address.toLowerCase())) {
1734
1639
  options.push({
1735
1640
  address: reownWallet.address,
1736
1641
  label: "External Wallet",
@@ -1744,10 +1649,13 @@ function DepositFlow({
1744
1649
  dappAddress,
1745
1650
  _optionalChain([reownWallet, 'optionalAccess', _28 => _28.address]),
1746
1651
  _optionalChain([reownWallet, 'optionalAccess', _29 => _29.isConnected]),
1747
- _optionalChain([reownWallet, 'optionalAccess', _30 => _30.icon])
1652
+ _optionalChain([reownWallet, 'optionalAccess', _30 => _30.walletClient]),
1653
+ _optionalChain([reownWallet, 'optionalAccess', _31 => _31.publicClient]),
1654
+ _optionalChain([reownWallet, 'optionalAccess', _32 => _32.icon])
1748
1655
  ]);
1749
- const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _31 => _31.account]) && dappAddress && !reownWallet;
1656
+ const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _33 => _33.account]) && dappAddress && !reownWallet;
1750
1657
  const hasWalletOptions = walletOptions.length > 0;
1658
+ const hasReownSession = Boolean(_optionalChain([reownWallet, 'optionalAccess', _34 => _34.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _35 => _35.address]));
1751
1659
  const showConnectStep = !canAutoLock && !isConnectSelectionConfirmed;
1752
1660
  const signerContext = _react.useMemo.call(void 0, () => {
1753
1661
  if (flowMode === "deposit-address") {
@@ -1755,30 +1663,30 @@ function DepositFlow({
1755
1663
  return {
1756
1664
  ownerAddress: dappAddress,
1757
1665
  walletClient: void 0,
1758
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkG2RDCQHLcjs.getPublicClient.call(void 0, targetChain))),
1666
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, targetChain))),
1759
1667
  switchChain: void 0
1760
1668
  };
1761
1669
  }
1762
1670
  if (canAutoLock) {
1763
- const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _32 => _32.chain, 'optionalAccess', _33 => _33.id]), () => ( targetChain));
1671
+ const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _36 => _36.chain, 'optionalAccess', _37 => _37.id]), () => ( targetChain));
1764
1672
  return {
1765
1673
  ownerAddress: dappWalletClient.account.address,
1766
1674
  walletClient: dappWalletClient,
1767
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkG2RDCQHLcjs.getPublicClient.call(void 0, fallbackChainId))),
1675
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, fallbackChainId))),
1768
1676
  switchChain: dappSwitchChain
1769
1677
  };
1770
1678
  }
1771
1679
  if (!isConnectSelectionConfirmed || !selectedConnectAddress) return null;
1772
- if (_optionalChain([dappWalletClient, 'optionalAccess', _34 => _34.account]) && dappWalletClient.account.address.toLowerCase() === selectedConnectAddress.toLowerCase()) {
1773
- const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _35 => _35.chain, 'optionalAccess', _36 => _36.id]), () => ( targetChain));
1680
+ if (_optionalChain([dappWalletClient, 'optionalAccess', _38 => _38.account]) && dappWalletClient.account.address.toLowerCase() === selectedConnectAddress.toLowerCase()) {
1681
+ const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _39 => _39.chain, 'optionalAccess', _40 => _40.id]), () => ( targetChain));
1774
1682
  return {
1775
1683
  ownerAddress: dappWalletClient.account.address,
1776
1684
  walletClient: dappWalletClient,
1777
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkG2RDCQHLcjs.getPublicClient.call(void 0, fallbackChainId))),
1685
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, fallbackChainId))),
1778
1686
  switchChain: dappSwitchChain
1779
1687
  };
1780
1688
  }
1781
- if (_optionalChain([reownWallet, 'optionalAccess', _37 => _37.address, 'optionalAccess', _38 => _38.toLowerCase, 'call', _39 => _39()]) === selectedConnectAddress.toLowerCase() && reownWallet.walletClient && reownWallet.publicClient) {
1689
+ if (_optionalChain([reownWallet, 'optionalAccess', _41 => _41.address, 'optionalAccess', _42 => _42.toLowerCase, 'call', _43 => _43()]) === selectedConnectAddress.toLowerCase() && reownWallet.walletClient && reownWallet.publicClient) {
1782
1690
  return {
1783
1691
  ownerAddress: reownWallet.address,
1784
1692
  walletClient: reownWallet.walletClient,
@@ -1799,7 +1707,7 @@ function DepositFlow({
1799
1707
  reownWallet,
1800
1708
  targetChain
1801
1709
  ]);
1802
- const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _40 => _40.ownerAddress]))), () => ( null));
1710
+ const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _44 => _44.ownerAddress]))), () => ( null));
1803
1711
  const lastTargetRef = _react.useRef.call(void 0, null);
1804
1712
  _react.useEffect.call(void 0, () => {
1805
1713
  const prev = lastTargetRef.current;
@@ -1836,18 +1744,17 @@ function DepositFlow({
1836
1744
  return {
1837
1745
  type: "amount",
1838
1746
  smartAccount: prev.smartAccount,
1839
- asset: prev.asset,
1840
- amount: prev.amount
1747
+ asset: prev.asset
1841
1748
  };
1842
1749
  });
1843
1750
  }, []);
1844
1751
  const stepIndex = step.type === "setup" ? 0 : step.type === "deposit-address" ? 1 : step.type === "select-asset" ? 1 : step.type === "amount" ? 2 : step.type === "confirm" ? 3 : 4;
1845
1752
  const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
1846
1753
  _react.useEffect.call(void 0, () => {
1847
- _optionalChain([onStepChange, 'optionalCall', _41 => _41(stepIndex, currentBackHandler)]);
1754
+ _optionalChain([onStepChange, 'optionalCall', _45 => _45(stepIndex, currentBackHandler)]);
1848
1755
  }, [stepIndex, currentBackHandler, onStepChange]);
1849
1756
  _react.useEffect.call(void 0, () => {
1850
- _optionalChain([onTotalBalanceChange, 'optionalCall', _42 => _42(totalBalanceUsd)]);
1757
+ _optionalChain([onTotalBalanceChange, 'optionalCall', _46 => _46(totalBalanceUsd)]);
1851
1758
  }, [totalBalanceUsd, onTotalBalanceChange]);
1852
1759
  const isDepositAddressMode = flowMode === "deposit-address";
1853
1760
  const handleSelectProvider = _react.useCallback.call(void 0, () => {
@@ -1885,13 +1792,13 @@ function DepositFlow({
1885
1792
  directTransfer: isSameRoute(chainId, token, targetChain, targetToken)
1886
1793
  };
1887
1794
  });
1888
- _optionalChain([onDepositSubmitted, 'optionalCall', _43 => _43({ txHash, sourceChain: chainId, amount })]);
1795
+ _optionalChain([onDepositSubmitted, 'optionalCall', _47 => _47({ txHash, sourceChain: chainId, amount })]);
1889
1796
  },
1890
1797
  [onDepositSubmitted, targetChain, targetToken]
1891
1798
  );
1892
1799
  const handleConnected = _react.useCallback.call(void 0,
1893
1800
  (addr, smartAccount) => {
1894
- _optionalChain([onConnected, 'optionalCall', _44 => _44({ address: addr, smartAccount })]);
1801
+ _optionalChain([onConnected, 'optionalCall', _48 => _48({ address: addr, smartAccount })]);
1895
1802
  },
1896
1803
  [onConnected]
1897
1804
  );
@@ -1910,7 +1817,10 @@ function DepositFlow({
1910
1817
  [defaultAmount]
1911
1818
  );
1912
1819
  const handleAmountContinue = _react.useCallback.call(void 0,
1913
- (amount, balance) => {
1820
+ (amount, targetAmount, balance) => {
1821
+ const targetSym = _chunkS4UBVD3Hcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
1822
+ const isTargetStable = _chunkS4UBVD3Hcjs.isStablecoinSymbol.call(void 0, targetSym);
1823
+ const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
1914
1824
  setStep((prev) => {
1915
1825
  if (prev.type !== "amount") return prev;
1916
1826
  return {
@@ -1918,11 +1828,13 @@ function DepositFlow({
1918
1828
  smartAccount: prev.smartAccount,
1919
1829
  asset: prev.asset,
1920
1830
  amount,
1831
+ targetAmount,
1832
+ targetTokenPriceUsd,
1921
1833
  balance
1922
1834
  };
1923
1835
  });
1924
1836
  },
1925
- []
1837
+ [targetToken, targetChain, getTokenPriceUsd]
1926
1838
  );
1927
1839
  const handleDepositSubmitted = _react.useCallback.call(void 0,
1928
1840
  (txHash, chainId, amount, token) => {
@@ -1943,25 +1855,25 @@ function DepositFlow({
1943
1855
  );
1944
1856
  const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
1945
1857
  (txHash, sourceChain, amount) => {
1946
- _optionalChain([onDepositSubmitted, 'optionalCall', _45 => _45({ txHash, sourceChain, amount })]);
1858
+ _optionalChain([onDepositSubmitted, 'optionalCall', _49 => _49({ txHash, sourceChain, amount })]);
1947
1859
  },
1948
1860
  [onDepositSubmitted]
1949
1861
  );
1950
1862
  const handleDepositComplete = _react.useCallback.call(void 0,
1951
1863
  (txHash, destinationTxHash) => {
1952
- _optionalChain([onDepositComplete, 'optionalCall', _46 => _46({ txHash, destinationTxHash })]);
1864
+ _optionalChain([onDepositComplete, 'optionalCall', _50 => _50({ txHash, destinationTxHash })]);
1953
1865
  },
1954
1866
  [onDepositComplete]
1955
1867
  );
1956
1868
  const handleDepositFailed = _react.useCallback.call(void 0,
1957
1869
  (txHash, error) => {
1958
- _optionalChain([onDepositFailed, 'optionalCall', _47 => _47({ txHash, error })]);
1870
+ _optionalChain([onDepositFailed, 'optionalCall', _51 => _51({ txHash, error })]);
1959
1871
  },
1960
1872
  [onDepositFailed]
1961
1873
  );
1962
1874
  const handleError = _react.useCallback.call(void 0,
1963
1875
  (message, code) => {
1964
- _optionalChain([onError, 'optionalCall', _48 => _48({ message, code })]);
1876
+ _optionalChain([onError, 'optionalCall', _52 => _52({ message, code })]);
1965
1877
  },
1966
1878
  [onError]
1967
1879
  );
@@ -1996,12 +1908,13 @@ function DepositFlow({
1996
1908
  return;
1997
1909
  }
1998
1910
  }
1999
- if (!hasWalletOptions && dappAddress) {
1911
+ if (!hasWalletOptions && dappAddress && !hasReownSession) {
2000
1912
  handleSelectTransferCrypto();
2001
1913
  setIsConnectSelectionConfirmed(true);
2002
1914
  }
2003
1915
  }, [
2004
1916
  hasWalletOptions,
1917
+ hasReownSession,
2005
1918
  isConnectSelectionConfirmed,
2006
1919
  flowMode,
2007
1920
  selectedConnectAddressEffective,
@@ -2011,7 +1924,7 @@ function DepositFlow({
2011
1924
  ]);
2012
1925
  if (showConnectStep) {
2013
1926
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2014
- _chunkG2RDCQHLcjs.ConnectStep,
1927
+ _chunkYIHOACM3cjs.ConnectStep,
2015
1928
  {
2016
1929
  walletOptions,
2017
1930
  selectedAddress: selectedConnectAddressEffective,
@@ -2022,6 +1935,7 @@ function DepositFlow({
2022
1935
  } : void 0,
2023
1936
  onRequestConnect,
2024
1937
  onConnect,
1938
+ onDisconnect,
2025
1939
  onContinue: () => {
2026
1940
  if (selectedConnectAddressEffective) {
2027
1941
  setSelectedConnectAddress(selectedConnectAddressEffective);
@@ -2062,14 +1976,13 @@ function DepositFlow({
2062
1976
  }
2063
1977
  ),
2064
1978
  step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2065
- _chunkG2RDCQHLcjs.ProcessingStep,
1979
+ _chunkYIHOACM3cjs.ProcessingStep,
2066
1980
  {
2067
1981
  smartAccount: step.smartAccount,
2068
1982
  txHash: step.txHash,
2069
1983
  sourceChain: step.sourceChain,
2070
1984
  sourceToken: step.sourceToken,
2071
1985
  targetChain,
2072
- targetToken,
2073
1986
  amount: step.amount,
2074
1987
  waitForFinalTx,
2075
1988
  service,
@@ -2084,16 +1997,16 @@ function DepositFlow({
2084
1997
  )
2085
1998
  ] });
2086
1999
  }
2087
- if (!_optionalChain([signerContext, 'optionalAccess', _49 => _49.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _50 => _50.publicClient])) {
2000
+ if (!_optionalChain([signerContext, 'optionalAccess', _53 => _53.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _54 => _54.publicClient])) {
2088
2001
  return null;
2089
2002
  }
2090
2003
  const ownerAddress = signerContext.ownerAddress;
2091
- const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _51 => _51.walletClient, 'optionalAccess', _52 => _52.chain, 'optionalAccess', _53 => _53.id]), () => ( _optionalChain([signerContext, 'access', _54 => _54.publicClient, 'access', _55 => _55.chain, 'optionalAccess', _56 => _56.id]))), () => ( targetChain));
2004
+ const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _55 => _55.walletClient, 'optionalAccess', _56 => _56.chain, 'optionalAccess', _57 => _57.id]), () => ( _optionalChain([signerContext, 'access', _58 => _58.publicClient, 'access', _59 => _59.chain, 'optionalAccess', _60 => _60.id]))), () => ( targetChain));
2092
2005
  const getReadClientForChain = (chainId) => {
2093
- if (_optionalChain([signerContext, 'access', _57 => _57.publicClient, 'access', _58 => _58.chain, 'optionalAccess', _59 => _59.id]) === chainId) {
2006
+ if (_optionalChain([signerContext, 'access', _61 => _61.publicClient, 'access', _62 => _62.chain, 'optionalAccess', _63 => _63.id]) === chainId) {
2094
2007
  return signerContext.publicClient;
2095
2008
  }
2096
- return _chunkG2RDCQHLcjs.getPublicClient.call(void 0, chainId);
2009
+ return _chunkYIHOACM3cjs.getPublicClient.call(void 0, chainId);
2097
2010
  };
2098
2011
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
2099
2012
  step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -2122,7 +2035,8 @@ function DepositFlow({
2122
2035
  defaultSourceToken,
2123
2036
  service,
2124
2037
  onContinue: handleAssetContinue,
2125
- onTotalBalanceComputed: handleTotalBalanceComputed
2038
+ onTotalBalanceComputed: handleTotalBalanceComputed,
2039
+ onAssetsLoaded: handleAssetsLoaded
2126
2040
  }
2127
2041
  ),
2128
2042
  step.type === "amount" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -2149,6 +2063,8 @@ function DepositFlow({
2149
2063
  recipient,
2150
2064
  asset: step.asset,
2151
2065
  amount: step.amount,
2066
+ targetAmount: step.targetAmount,
2067
+ targetTokenPriceUsd: step.targetTokenPriceUsd,
2152
2068
  balance: step.balance,
2153
2069
  targetChain,
2154
2070
  targetToken,
@@ -2159,14 +2075,13 @@ function DepositFlow({
2159
2075
  }
2160
2076
  ),
2161
2077
  step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2162
- _chunkG2RDCQHLcjs.ProcessingStep,
2078
+ _chunkYIHOACM3cjs.ProcessingStep,
2163
2079
  {
2164
2080
  smartAccount: step.smartAccount,
2165
2081
  txHash: step.txHash,
2166
2082
  sourceChain: step.sourceChain,
2167
2083
  sourceToken: step.sourceToken,
2168
2084
  targetChain,
2169
- targetToken,
2170
2085
  amount: step.amount,
2171
2086
  waitForFinalTx,
2172
2087
  service,
@@ -2184,7 +2099,7 @@ function DepositFlow({
2184
2099
  // src/DepositModal.tsx
2185
2100
 
2186
2101
  var ReownDepositInner = _react.lazy.call(void 0,
2187
- () => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-N7GCYZF7.cjs"))).then((m) => ({ default: m.DepositModalReown }))
2102
+ () => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-VNKZT5A7.cjs"))).then((m) => ({ default: m.DepositModalReown }))
2188
2103
  );
2189
2104
  function DepositModal(props) {
2190
2105
  const needsReown = !!props.reownAppId;
@@ -2207,13 +2122,14 @@ function DepositModalInner({
2207
2122
  sourceToken,
2208
2123
  defaultAmount,
2209
2124
  recipient,
2210
- backendUrl = _chunkPE6OK3FHcjs.DEFAULT_BACKEND_URL,
2211
- signerAddress = _chunkPE6OK3FHcjs.DEFAULT_SIGNER_ADDRESS,
2125
+ backendUrl = _chunkS4UBVD3Hcjs.DEFAULT_BACKEND_URL,
2126
+ signerAddress = _chunkS4UBVD3Hcjs.DEFAULT_SIGNER_ADDRESS,
2212
2127
  sessionChainIds,
2213
2128
  forceRegister = false,
2214
2129
  waitForFinalTx = true,
2215
2130
  reownWallet,
2216
2131
  onConnect,
2132
+ onDisconnect,
2217
2133
  onRequestConnect,
2218
2134
  connectButtonLabel,
2219
2135
  theme,
@@ -2232,19 +2148,19 @@ function DepositModalInner({
2232
2148
  const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
2233
2149
  const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
2234
2150
  const backHandlerRef = _react.useRef.call(void 0, void 0);
2235
- const targetChain = _chunkPE6OK3FHcjs.getChainId.call(void 0, targetChainProp);
2236
- const sourceChain = sourceChainProp ? _chunkPE6OK3FHcjs.getChainId.call(void 0, sourceChainProp) : void 0;
2237
- const service = _react.useMemo.call(void 0, () => _chunkG2RDCQHLcjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
2151
+ const targetChain = _chunkS4UBVD3Hcjs.getChainId.call(void 0, targetChainProp);
2152
+ const sourceChain = sourceChainProp ? _chunkS4UBVD3Hcjs.getChainId.call(void 0, sourceChainProp) : void 0;
2153
+ const service = _react.useMemo.call(void 0, () => _chunkYIHOACM3cjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
2238
2154
  _react.useEffect.call(void 0, () => {
2239
2155
  if (isOpen && modalRef.current) {
2240
- _chunkG2RDCQHLcjs.applyTheme.call(void 0, modalRef.current, theme);
2156
+ _chunkYIHOACM3cjs.applyTheme.call(void 0, modalRef.current, theme);
2241
2157
  }
2242
2158
  }, [isOpen, theme]);
2243
2159
  const hasCalledReady = _react.useRef.call(void 0, false);
2244
2160
  _react.useEffect.call(void 0, () => {
2245
2161
  if (isOpen && !hasCalledReady.current) {
2246
2162
  hasCalledReady.current = true;
2247
- _optionalChain([onReady, 'optionalCall', _60 => _60()]);
2163
+ _optionalChain([onReady, 'optionalCall', _64 => _64()]);
2248
2164
  }
2249
2165
  }, [isOpen, onReady]);
2250
2166
  _react.useEffect.call(void 0, () => {
@@ -2263,17 +2179,17 @@ function DepositModalInner({
2263
2179
  setTotalBalanceUsd(balance2);
2264
2180
  }, []);
2265
2181
  const handleBack = _react.useCallback.call(void 0, () => {
2266
- _optionalChain([backHandlerRef, 'access', _61 => _61.current, 'optionalCall', _62 => _62()]);
2182
+ _optionalChain([backHandlerRef, 'access', _65 => _65.current, 'optionalCall', _66 => _66()]);
2267
2183
  }, []);
2268
- const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _63 => _63.showLogo]), () => ( false));
2269
- const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _64 => _64.showStepper]), () => ( false));
2270
- const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _65 => _65.showBackButton]), () => ( true));
2271
- const balance = _optionalChain([uiConfig, 'optionalAccess', _66 => _66.balance]);
2272
- const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _67 => _67.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
2273
- const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _68 => _68.title]), () => ( "Deposit"));
2184
+ const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _67 => _67.showLogo]), () => ( false));
2185
+ const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _68 => _68.showStepper]), () => ( false));
2186
+ const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _69 => _69.showBackButton]), () => ( true));
2187
+ const balance = _optionalChain([uiConfig, 'optionalAccess', _70 => _70.balance]);
2188
+ const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _71 => _71.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
2189
+ const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _72 => _72.title]), () => ( "Deposit"));
2274
2190
  const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
2275
2191
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2276
- _chunkG2RDCQHLcjs.Modal,
2192
+ _chunkYIHOACM3cjs.Modal,
2277
2193
  {
2278
2194
  isOpen,
2279
2195
  onClose,
@@ -2334,7 +2250,7 @@ function DepositModalInner({
2334
2250
  balance.title,
2335
2251
  ":"
2336
2252
  ] }),
2337
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkG2RDCQHLcjs.currencyFormatter.format(totalBalanceUsd) : null))) })
2253
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkYIHOACM3cjs.currencyFormatter.format(totalBalanceUsd) : null))) })
2338
2254
  ] })
2339
2255
  ] }),
2340
2256
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -2383,6 +2299,7 @@ function DepositModalInner({
2383
2299
  waitForFinalTx,
2384
2300
  reownWallet,
2385
2301
  onConnect,
2302
+ onDisconnect,
2386
2303
  onRequestConnect,
2387
2304
  connectButtonLabel,
2388
2305
  uiConfig,