@rhinestone/deposit-modal 0.1.40 → 0.1.41

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 (38) hide show
  1. package/dist/{DepositModalReown-ZZKRN6J3.cjs → DepositModalReown-GAQLILGK.cjs} +17 -8
  2. package/dist/{DepositModalReown-3HNOCOOO.mjs → DepositModalReown-WS6WNWJP.mjs} +15 -6
  3. package/dist/{WithdrawModalReown-XXCOZYVU.mjs → WithdrawModalReown-7CSCY55U.mjs} +4 -4
  4. package/dist/{WithdrawModalReown-2CWNDVJD.cjs → WithdrawModalReown-GCOVYZN2.cjs} +7 -7
  5. package/dist/{chunk-K7BHCDJQ.cjs → chunk-37CTMJMO.cjs} +181 -96
  6. package/dist/{chunk-F5S6RHUI.mjs → chunk-6PRJUXTM.mjs} +1488 -301
  7. package/dist/{chunk-CFLZYWX7.mjs → chunk-KWAFKVV6.mjs} +120 -35
  8. package/dist/{chunk-AHOFT42H.cjs → chunk-LT3QKJI2.cjs} +458 -115
  9. package/dist/{chunk-SJEIKMVO.mjs → chunk-MBOH6XW3.mjs} +26 -13
  10. package/dist/{chunk-FLXTBFMZ.cjs → chunk-NELAYNA3.cjs} +11 -0
  11. package/dist/{chunk-3O37UPSC.cjs → chunk-PTSYSG4U.cjs} +1552 -365
  12. package/dist/{chunk-V7I5T4SW.cjs → chunk-PWPW7GFB.cjs} +25 -12
  13. package/dist/{chunk-IC2M2DZ7.mjs → chunk-QIK6ONMQ.mjs} +392 -49
  14. package/dist/{chunk-I7RYTI4G.mjs → chunk-ZJQZEIHA.mjs} +11 -0
  15. package/dist/constants.cjs +2 -2
  16. package/dist/constants.d.cts +6 -6
  17. package/dist/constants.d.ts +6 -6
  18. package/dist/constants.mjs +1 -1
  19. package/dist/deposit.cjs +4 -4
  20. package/dist/deposit.d.cts +2 -2
  21. package/dist/deposit.d.ts +2 -2
  22. package/dist/deposit.mjs +3 -3
  23. package/dist/index.cjs +5 -5
  24. package/dist/index.d.cts +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.mjs +4 -4
  27. package/dist/reown.cjs +5 -5
  28. package/dist/reown.d.cts +1 -1
  29. package/dist/reown.d.ts +1 -1
  30. package/dist/reown.mjs +4 -4
  31. package/dist/styles.css +64 -0
  32. package/dist/{types-CIaQPR6F.d.cts → types-CybmMKTE.d.cts} +9 -7
  33. package/dist/{types-Bp2n2RQ3.d.ts → types-e8CHSm2u.d.ts} +9 -7
  34. package/dist/withdraw.cjs +4 -4
  35. package/dist/withdraw.d.cts +2 -2
  36. package/dist/withdraw.d.ts +2 -2
  37. package/dist/withdraw.mjs +3 -3
  38. package/package.json +18 -1
@@ -22,10 +22,10 @@
22
22
 
23
23
 
24
24
 
25
- var _chunkAHOFT42Hcjs = require('./chunk-AHOFT42H.cjs');
26
25
 
27
26
 
28
27
 
28
+ var _chunkLT3QKJI2cjs = require('./chunk-LT3QKJI2.cjs');
29
29
 
30
30
 
31
31
 
@@ -38,7 +38,10 @@ var _chunkAHOFT42Hcjs = require('./chunk-AHOFT42H.cjs');
38
38
 
39
39
 
40
40
 
41
- var _chunkFLXTBFMZcjs = require('./chunk-FLXTBFMZ.cjs');
41
+
42
+
43
+
44
+ var _chunkNELAYNA3cjs = require('./chunk-NELAYNA3.cjs');
42
45
 
43
46
  // src/DepositModal.tsx
44
47
 
@@ -58,15 +61,15 @@ var _react = require('react');
58
61
 
59
62
  var _jsxruntime = require('react/jsx-runtime');
60
63
  async function resolveSessionOwner(eoaAddress) {
61
- const localOwner = _chunkAHOFT42Hcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
64
+ const localOwner = _chunkLT3QKJI2cjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
62
65
  if (localOwner) {
63
66
  return {
64
- account: _chunkAHOFT42Hcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
67
+ account: _chunkLT3QKJI2cjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
65
68
  address: localOwner.address
66
69
  };
67
70
  }
68
- const created = _chunkAHOFT42Hcjs.createSessionOwnerKey.call(void 0, );
69
- _chunkAHOFT42Hcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
71
+ const created = _chunkLT3QKJI2cjs.createSessionOwnerKey.call(void 0, );
72
+ _chunkLT3QKJI2cjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
70
73
  return {
71
74
  account: created.account,
72
75
  address: created.address
@@ -101,7 +104,7 @@ function SetupStep({
101
104
  const setup = await service.setupAccount({
102
105
  ownerAddress: address,
103
106
  sessionOwnerAddress: sessionOwner.address,
104
- targetChain,
107
+ targetChain: _chunkLT3QKJI2cjs.toEvmCaip2.call(void 0, targetChain),
105
108
  targetToken,
106
109
  signerAddress,
107
110
  sessionChainIds,
@@ -111,7 +114,7 @@ function SetupStep({
111
114
  if (!setup.needsRegistration) {
112
115
  setState({ type: "ready", smartAccount });
113
116
  _optionalChain([onConnected, 'optionalCall', _ => _(address, smartAccount)]);
114
- onSetupComplete(smartAccount);
117
+ onSetupComplete(smartAccount, setup.solanaDepositAddress);
115
118
  return;
116
119
  }
117
120
  setState({ type: "signing-session" });
@@ -128,9 +131,9 @@ function SetupStep({
128
131
  primaryType: typedData.primaryType,
129
132
  message: typedData.message
130
133
  });
131
- const sessionDetails = _chunkAHOFT42Hcjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
134
+ const sessionDetails = _chunkLT3QKJI2cjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
132
135
  setState({ type: "registering" });
133
- await service.registerAccount({
136
+ const registerResult = await service.registerAccount({
134
137
  address: smartAccount,
135
138
  accountParams: {
136
139
  factory: setup.accountParams.factory,
@@ -140,14 +143,14 @@ function SetupStep({
140
143
  eoaAddress: address,
141
144
  sessionOwner: sessionOwner.address,
142
145
  target: {
143
- chain: targetChain,
146
+ chain: _chunkLT3QKJI2cjs.toEvmCaip2.call(void 0, targetChain),
144
147
  token: targetToken,
145
148
  ...recipient && { recipient }
146
149
  }
147
150
  });
148
151
  setState({ type: "ready", smartAccount });
149
152
  _optionalChain([onConnected, 'optionalCall', _2 => _2(address, smartAccount)]);
150
- onSetupComplete(smartAccount);
153
+ onSetupComplete(smartAccount, registerResult.solanaDepositAddress);
151
154
  } catch (error) {
152
155
  const message = error instanceof Error ? error.message : "Setup failed";
153
156
  setState({ type: "error", message });
@@ -199,7 +202,7 @@ function SetupStep({
199
202
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
200
203
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
201
204
  isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
202
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
205
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLT3QKJI2cjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
203
206
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-text", children: [
204
207
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: renderStateMessage() }),
205
208
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This may take a moment" })
@@ -236,7 +239,7 @@ function SetupStep({
236
239
  ] })
237
240
  ] })
238
241
  ] }),
239
- isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
242
+ isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLT3QKJI2cjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
240
243
  ] });
241
244
  }
242
245
 
@@ -260,7 +263,7 @@ function AssetSelectStep({
260
263
  const [error, setError] = _react.useState.call(void 0, null);
261
264
  const defaultAssetId = _react.useMemo.call(void 0, () => {
262
265
  if (!defaultSourceChain || !defaultSourceToken) return null;
263
- return _chunkAHOFT42Hcjs.getAssetId.call(void 0, {
266
+ return _chunkLT3QKJI2cjs.getAssetId.call(void 0, {
264
267
  chainId: defaultSourceChain,
265
268
  token: defaultSourceToken
266
269
  });
@@ -277,10 +280,10 @@ function AssetSelectStep({
277
280
  try {
278
281
  const portfolio = await service.fetchPortfolio(address);
279
282
  if (!active) return;
280
- const portfolioAssets = _chunkAHOFT42Hcjs.portfolioToAssets.call(void 0, portfolio.tokens);
283
+ const portfolioAssets = _chunkLT3QKJI2cjs.portfolioToAssets.call(void 0, portfolio.tokens);
281
284
  setAssets(portfolioAssets);
282
285
  const hasNative = portfolioAssets.some(
283
- (asset) => asset.token.toLowerCase() === _chunkFLXTBFMZcjs.NATIVE_TOKEN_ADDRESS
286
+ (asset) => asset.token.toLowerCase() === _chunkNELAYNA3cjs.NATIVE_TOKEN_ADDRESS
284
287
  );
285
288
  if (!hasNative) {
286
289
  const nativeAssets = await fetchNativeAssets(
@@ -346,7 +349,7 @@ function AssetSelectStep({
346
349
  const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
347
350
  const numeric = Number(raw);
348
351
  if (!Number.isFinite(numeric)) return raw;
349
- return _chunkAHOFT42Hcjs.tokenFormatter.format(numeric);
352
+ return _chunkLT3QKJI2cjs.tokenFormatter.format(numeric);
350
353
  } catch (e3) {
351
354
  return asset.balance;
352
355
  }
@@ -360,7 +363,7 @@ function AssetSelectStep({
360
363
  style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
361
364
  children: [
362
365
  loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
363
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.Spinner, { className: "rs-text-tertiary" }),
366
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLT3QKJI2cjs.Spinner, { className: "rs-text-tertiary" }),
364
367
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
365
368
  ] }),
366
369
  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 }) }),
@@ -393,9 +396,9 @@ function AssetSelectStep({
393
396
  !loading && !error && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((asset) => {
394
397
  const isSelected = selectedAssetId === asset.id;
395
398
  const tokenAmount = formatBalance(asset);
396
- const badge = _chunkFLXTBFMZcjs.getChainBadge.call(void 0, asset.chainId);
397
- const tokenIcon = _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, asset.symbol);
398
- const chainIcon = _chunkFLXTBFMZcjs.getChainIcon.call(void 0, asset.chainId);
399
+ const badge = _chunkNELAYNA3cjs.getChainBadge.call(void 0, asset.chainId);
400
+ const tokenIcon = _chunkNELAYNA3cjs.getTokenIcon.call(void 0, asset.symbol);
401
+ const chainIcon = _chunkNELAYNA3cjs.getChainIcon.call(void 0, asset.chainId);
399
402
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
400
403
  "button",
401
404
  {
@@ -419,7 +422,7 @@ function AssetSelectStep({
419
422
  "img",
420
423
  {
421
424
  src: chainIcon,
422
- alt: _chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId),
425
+ alt: _chunkNELAYNA3cjs.getChainName.call(void 0, asset.chainId),
423
426
  className: "rs-asset-chain-badge"
424
427
  }
425
428
  ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -440,7 +443,7 @@ function AssetSelectStep({
440
443
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-asset-chain", children: [
441
444
  " ",
442
445
  "on ",
443
- _chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)
446
+ _chunkNELAYNA3cjs.getChainName.call(void 0, asset.chainId)
444
447
  ] })
445
448
  ] }),
446
449
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
@@ -450,7 +453,7 @@ function AssetSelectStep({
450
453
  ] })
451
454
  ] })
452
455
  ] }),
453
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkAHOFT42Hcjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
456
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkLT3QKJI2cjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
454
457
  ]
455
458
  },
456
459
  asset.id
@@ -460,7 +463,7 @@ function AssetSelectStep({
460
463
  }
461
464
  ),
462
465
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
463
- _chunkAHOFT42Hcjs.Button,
466
+ _chunkLT3QKJI2cjs.Button,
464
467
  {
465
468
  onClick: () => selectedAsset && onContinue(selectedAsset),
466
469
  disabled: !selectedAsset,
@@ -468,17 +471,17 @@ function AssetSelectStep({
468
471
  children: "Continue"
469
472
  }
470
473
  ) }),
471
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.PoweredBy, {})
474
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLT3QKJI2cjs.PoweredBy, {})
472
475
  ] });
473
476
  }
474
477
  async function fetchNativeAssets(address, publicClient, existing) {
475
478
  const existingIds = new Set(existing.map((asset) => asset.id));
476
479
  const connectedChainId = _optionalChain([publicClient, 'access', _6 => _6.chain, 'optionalAccess', _7 => _7.id]);
477
480
  if (!connectedChainId) return [];
478
- if (!_chunkFLXTBFMZcjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
479
- const id = _chunkAHOFT42Hcjs.getAssetId.call(void 0, {
481
+ if (!_chunkNELAYNA3cjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
482
+ const id = _chunkLT3QKJI2cjs.getAssetId.call(void 0, {
480
483
  chainId: connectedChainId,
481
- token: _chunkFLXTBFMZcjs.NATIVE_TOKEN_ADDRESS
484
+ token: _chunkNELAYNA3cjs.NATIVE_TOKEN_ADDRESS
482
485
  });
483
486
  if (existingIds.has(id)) return [];
484
487
  try {
@@ -487,7 +490,7 @@ async function fetchNativeAssets(address, publicClient, existing) {
487
490
  {
488
491
  id,
489
492
  chainId: connectedChainId,
490
- token: _chunkFLXTBFMZcjs.NATIVE_TOKEN_ADDRESS,
493
+ token: _chunkNELAYNA3cjs.NATIVE_TOKEN_ADDRESS,
491
494
  symbol: "ETH",
492
495
  name: "Ethereum",
493
496
  decimals: 18,
@@ -537,8 +540,8 @@ function AmountStep({
537
540
  const chainMismatch = Boolean(
538
541
  _optionalChain([walletClient, 'optionalAccess', _8 => _8.chain, 'optionalAccess', _9 => _9.id]) && walletClient.chain.id !== asset.chainId
539
542
  );
540
- const targetSymbol = _chunkFLXTBFMZcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
541
- const isSourceStablecoin = _chunkFLXTBFMZcjs.isStablecoinSymbol.call(void 0, asset.symbol);
543
+ const targetSymbol = _chunkNELAYNA3cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
544
+ const isSourceStablecoin = _chunkNELAYNA3cjs.isStablecoinSymbol.call(void 0, asset.symbol);
542
545
  const tokenPriceUsd = _react.useMemo.call(void 0, () => {
543
546
  if (tokenPriceUsdOverride !== void 0 && tokenPriceUsdOverride > 0)
544
547
  return tokenPriceUsdOverride;
@@ -562,7 +565,7 @@ function AmountStep({
562
565
  const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
563
566
  if (!balanceTarget || !publicClient) return;
564
567
  try {
565
- const bal = _chunkAHOFT42Hcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
568
+ const bal = _chunkLT3QKJI2cjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
566
569
  address: asset.token,
567
570
  abi: _viem.erc20Abi,
568
571
  functionName: "balanceOf",
@@ -588,7 +591,7 @@ function AmountStep({
588
591
  setIsSwitching(true);
589
592
  switchChain(asset.chainId).catch((err) => {
590
593
  const raw = err instanceof Error ? err.message : "Failed to switch chain";
591
- setError(_chunkAHOFT42Hcjs.formatUserError.call(void 0, raw));
594
+ setError(_chunkLT3QKJI2cjs.formatUserError.call(void 0, raw));
592
595
  }).finally(() => {
593
596
  setIsSwitching(false);
594
597
  });
@@ -624,7 +627,7 @@ function AmountStep({
624
627
  const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
625
628
  const numeric = Number(raw);
626
629
  if (!Number.isFinite(numeric)) return raw;
627
- return _chunkAHOFT42Hcjs.tokenFormatter.format(numeric);
630
+ return _chunkLT3QKJI2cjs.tokenFormatter.format(numeric);
628
631
  } catch (e8) {
629
632
  return "...";
630
633
  }
@@ -666,13 +669,13 @@ function AmountStep({
666
669
  const usdValue = numericAmount;
667
670
  if (_optionalChain([uiConfig, 'optionalAccess', _11 => _11.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
668
671
  setError(
669
- `Maximum deposit is ${_chunkAHOFT42Hcjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
672
+ `Maximum deposit is ${_chunkLT3QKJI2cjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
670
673
  );
671
674
  return;
672
675
  }
673
676
  if (_optionalChain([uiConfig, 'optionalAccess', _12 => _12.minDepositUsd]) && usdValue < uiConfig.minDepositUsd) {
674
677
  setError(
675
- `Minimum deposit is ${_chunkAHOFT42Hcjs.currencyFormatter.format(uiConfig.minDepositUsd)}`
678
+ `Minimum deposit is ${_chunkLT3QKJI2cjs.currencyFormatter.format(uiConfig.minDepositUsd)}`
676
679
  );
677
680
  return;
678
681
  }
@@ -721,7 +724,7 @@ function AmountStep({
721
724
  hasPricing && balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
722
725
  " ",
723
726
  "(",
724
- _chunkAHOFT42Hcjs.currencyFormatter.format(balanceUsd),
727
+ _chunkLT3QKJI2cjs.currencyFormatter.format(balanceUsd),
725
728
  ")"
726
729
  ] })
727
730
  ] }) })
@@ -735,26 +738,26 @@ function AmountStep({
735
738
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You send" }),
736
739
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
737
740
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token-icon-wrapper", children: [
738
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, asset.symbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
741
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkNELAYNA3cjs.getTokenIcon.call(void 0, asset.symbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
739
742
  "img",
740
743
  {
741
- src: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, asset.symbol),
744
+ src: _chunkNELAYNA3cjs.getTokenIcon.call(void 0, asset.symbol),
742
745
  alt: asset.symbol
743
746
  }
744
747
  ) : asset.symbol.slice(0, 2) }),
745
748
  (() => {
746
- const chainIcon = _chunkFLXTBFMZcjs.getChainIcon.call(void 0, asset.chainId);
749
+ const chainIcon = _chunkNELAYNA3cjs.getChainIcon.call(void 0, asset.chainId);
747
750
  if (chainIcon) {
748
751
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
749
752
  "img",
750
753
  {
751
754
  src: chainIcon,
752
- alt: _chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId),
755
+ alt: _chunkNELAYNA3cjs.getChainName.call(void 0, asset.chainId),
753
756
  className: "rs-flow-pill-chain-badge"
754
757
  }
755
758
  );
756
759
  }
757
- const badge = _chunkFLXTBFMZcjs.getChainBadge.call(void 0, asset.chainId);
760
+ const badge = _chunkNELAYNA3cjs.getChainBadge.call(void 0, asset.chainId);
758
761
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
759
762
  "div",
760
763
  {
@@ -792,26 +795,26 @@ function AmountStep({
792
795
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You receive" }),
793
796
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
794
797
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token-icon-wrapper", children: [
795
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, targetSymbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
798
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkNELAYNA3cjs.getTokenIcon.call(void 0, targetSymbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
796
799
  "img",
797
800
  {
798
- src: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, targetSymbol),
801
+ src: _chunkNELAYNA3cjs.getTokenIcon.call(void 0, targetSymbol),
799
802
  alt: targetSymbol
800
803
  }
801
804
  ) : targetSymbol.slice(0, 2) }),
802
805
  (() => {
803
- const chainIcon = _chunkFLXTBFMZcjs.getChainIcon.call(void 0, targetChain);
806
+ const chainIcon = _chunkNELAYNA3cjs.getChainIcon.call(void 0, targetChain);
804
807
  if (chainIcon) {
805
808
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
806
809
  "img",
807
810
  {
808
811
  src: chainIcon,
809
- alt: _chunkFLXTBFMZcjs.getChainName.call(void 0, targetChain),
812
+ alt: _chunkNELAYNA3cjs.getChainName.call(void 0, targetChain),
810
813
  className: "rs-flow-pill-chain-badge"
811
814
  }
812
815
  );
813
816
  }
814
- const badge = _chunkFLXTBFMZcjs.getChainBadge.call(void 0, targetChain);
817
+ const badge = _chunkNELAYNA3cjs.getChainBadge.call(void 0, targetChain);
815
818
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
816
819
  "div",
817
820
  {
@@ -857,7 +860,7 @@ function AmountStep({
857
860
  }
858
861
  )
859
862
  ] }),
860
- 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 ${_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)}...` : `Switch your wallet to ${_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)} to continue.` }) }),
863
+ 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 ${_chunkNELAYNA3cjs.getChainName.call(void 0, asset.chainId)}...` : `Switch your wallet to ${_chunkNELAYNA3cjs.getChainName.call(void 0, asset.chainId)} to continue.` }) }),
861
864
  error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
862
865
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
863
866
  "svg",
@@ -881,7 +884,7 @@ function AmountStep({
881
884
  ] })
882
885
  ] }),
883
886
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
884
- _chunkAHOFT42Hcjs.Button,
887
+ _chunkLT3QKJI2cjs.Button,
885
888
  {
886
889
  onClick: handleContinue,
887
890
  fullWidth: true,
@@ -889,7 +892,7 @@ function AmountStep({
889
892
  children: "Continue"
890
893
  }
891
894
  ) }),
892
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.PoweredBy, {})
895
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLT3QKJI2cjs.PoweredBy, {})
893
896
  ] });
894
897
  }
895
898
 
@@ -920,7 +923,7 @@ function ConfirmStep({
920
923
  const hasAttemptedSwitch = _react.useRef.call(void 0, false);
921
924
  const chainMismatch = _optionalChain([walletClient, 'optionalAccess', _13 => _13.chain, 'optionalAccess', _14 => _14.id]) && walletClient.chain.id !== asset.chainId;
922
925
  const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
923
- const targetSymbol = sameRoute ? asset.symbol : _chunkFLXTBFMZcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
926
+ const targetSymbol = sameRoute ? asset.symbol : _chunkNELAYNA3cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
924
927
  const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
925
928
  const formattedReceiveAmount = (() => {
926
929
  if (sameRoute) return formattedSendAmount;
@@ -939,7 +942,7 @@ function ConfirmStep({
939
942
  setIsSwitching(true);
940
943
  switchChain(asset.chainId).catch((err) => {
941
944
  const raw = err instanceof Error ? err.message : "Failed to switch chain";
942
- setError(_chunkAHOFT42Hcjs.formatUserError.call(void 0, raw));
945
+ setError(_chunkLT3QKJI2cjs.formatUserError.call(void 0, raw));
943
946
  }).finally(() => {
944
947
  setIsSwitching(false);
945
948
  });
@@ -954,7 +957,7 @@ function ConfirmStep({
954
957
  return;
955
958
  }
956
959
  if (chainMismatch) {
957
- setError(`Switch to ${_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)} to sign`);
960
+ setError(`Switch to ${_chunkNELAYNA3cjs.getChainName.call(void 0, asset.chainId)} to sign`);
958
961
  return;
959
962
  }
960
963
  const parsedAmount = parseFloat(amount);
@@ -982,7 +985,7 @@ function ConfirmStep({
982
985
  throw new Error("Wallet not properly connected");
983
986
  }
984
987
  const transferTo = sameRoute ? recipient : smartAccount;
985
- const hash = _chunkAHOFT42Hcjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
988
+ const hash = _chunkLT3QKJI2cjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
986
989
  account,
987
990
  chain,
988
991
  to: transferTo,
@@ -999,7 +1002,7 @@ function ConfirmStep({
999
1002
  onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
1000
1003
  } catch (err) {
1001
1004
  const raw = err instanceof Error ? err.message : "Transfer failed";
1002
- const message = _chunkAHOFT42Hcjs.formatUserError.call(void 0, raw);
1005
+ const message = _chunkLT3QKJI2cjs.formatUserError.call(void 0, raw);
1003
1006
  setError(message);
1004
1007
  _optionalChain([onError, 'optionalCall', _16 => _16(message, "TRANSFER_ERROR")]);
1005
1008
  } finally {
@@ -1018,15 +1021,15 @@ function ConfirmStep({
1018
1021
  className: "rs-card-value",
1019
1022
  style: { display: "flex", alignItems: "center", gap: 8 },
1020
1023
  children: [
1021
- _chunkFLXTBFMZcjs.getChainIcon.call(void 0, asset.chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1024
+ _chunkNELAYNA3cjs.getChainIcon.call(void 0, asset.chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1022
1025
  "img",
1023
1026
  {
1024
- src: _chunkFLXTBFMZcjs.getChainIcon.call(void 0, asset.chainId),
1027
+ src: _chunkNELAYNA3cjs.getChainIcon.call(void 0, asset.chainId),
1025
1028
  alt: "",
1026
1029
  style: { width: 16, height: 16, borderRadius: 3 }
1027
1030
  }
1028
1031
  ),
1029
- _chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)
1032
+ _chunkNELAYNA3cjs.getChainName.call(void 0, asset.chainId)
1030
1033
  ]
1031
1034
  }
1032
1035
  )
@@ -1039,15 +1042,15 @@ function ConfirmStep({
1039
1042
  className: "rs-card-value",
1040
1043
  style: { display: "flex", alignItems: "center", gap: 8 },
1041
1044
  children: [
1042
- _chunkFLXTBFMZcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1045
+ _chunkNELAYNA3cjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1043
1046
  "img",
1044
1047
  {
1045
- src: _chunkFLXTBFMZcjs.getChainIcon.call(void 0, targetChain),
1048
+ src: _chunkNELAYNA3cjs.getChainIcon.call(void 0, targetChain),
1046
1049
  alt: "",
1047
1050
  style: { width: 16, height: 16, borderRadius: 3 }
1048
1051
  }
1049
1052
  ),
1050
- _chunkFLXTBFMZcjs.getChainName.call(void 0, targetChain)
1053
+ _chunkNELAYNA3cjs.getChainName.call(void 0, targetChain)
1051
1054
  ]
1052
1055
  }
1053
1056
  )
@@ -1066,10 +1069,10 @@ function ConfirmStep({
1066
1069
  className: "rs-card-value",
1067
1070
  style: { display: "flex", alignItems: "center", gap: 6 },
1068
1071
  children: [
1069
- _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, asset.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1072
+ _chunkNELAYNA3cjs.getTokenIcon.call(void 0, asset.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1070
1073
  "img",
1071
1074
  {
1072
- src: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, asset.symbol),
1075
+ src: _chunkNELAYNA3cjs.getTokenIcon.call(void 0, asset.symbol),
1073
1076
  alt: "",
1074
1077
  style: { width: 16, height: 16, borderRadius: "50%" }
1075
1078
  }
@@ -1089,10 +1092,10 @@ function ConfirmStep({
1089
1092
  className: "rs-card-value",
1090
1093
  style: { display: "flex", alignItems: "center", gap: 6 },
1091
1094
  children: [
1092
- _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1095
+ _chunkNELAYNA3cjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1093
1096
  "img",
1094
1097
  {
1095
- src: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, targetSymbol),
1098
+ src: _chunkNELAYNA3cjs.getTokenIcon.call(void 0, targetSymbol),
1096
1099
  alt: "",
1097
1100
  style: { width: 16, height: 16, borderRadius: "50%" }
1098
1101
  }
@@ -1105,7 +1108,7 @@ function ConfirmStep({
1105
1108
  )
1106
1109
  ] })
1107
1110
  ] }),
1108
- 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 ${_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)}...` : `Switch your wallet to ${_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)} to sign.` }) }),
1111
+ 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 ${_chunkNELAYNA3cjs.getChainName.call(void 0, asset.chainId)}...` : `Switch your wallet to ${_chunkNELAYNA3cjs.getChainName.call(void 0, asset.chainId)} to sign.` }) }),
1109
1112
  error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-alert rs-alert--error", children: [
1110
1113
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1111
1114
  "svg",
@@ -1129,7 +1132,7 @@ function ConfirmStep({
1129
1132
  ] })
1130
1133
  ] }),
1131
1134
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1132
- _chunkAHOFT42Hcjs.Button,
1135
+ _chunkLT3QKJI2cjs.Button,
1133
1136
  {
1134
1137
  onClick: handleConfirm,
1135
1138
  loading: isSubmitting,
@@ -1138,7 +1141,7 @@ function ConfirmStep({
1138
1141
  children: "Confirm Order"
1139
1142
  }
1140
1143
  ) }),
1141
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.PoweredBy, {})
1144
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLT3QKJI2cjs.PoweredBy, {})
1142
1145
  ] });
1143
1146
  }
1144
1147
 
@@ -1234,28 +1237,218 @@ function QRCode({ value, size = 200, iconSrc, className }) {
1234
1237
  }
1235
1238
  QRCode.displayName = "QRCode";
1236
1239
 
1240
+ // src/core/solana.ts
1241
+
1242
+
1243
+
1244
+
1245
+
1246
+ var _web3js = require('@solana/web3.js');
1247
+
1248
+
1249
+
1250
+
1251
+ var _spltoken = require('@solana/spl-token');
1252
+ var SOLANA_TOKENS = [
1253
+ { symbol: "SOL", mint: "native", decimals: 9 },
1254
+ {
1255
+ symbol: "USDC",
1256
+ mint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
1257
+ decimals: 6
1258
+ },
1259
+ {
1260
+ symbol: "USDT",
1261
+ mint: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
1262
+ decimals: 6
1263
+ }
1264
+ ];
1265
+ var DEFAULT_SOLANA_RPC_URL = "https://api.mainnet-beta.solana.com";
1266
+ var configuredSolanaRpcUrl = null;
1267
+ var cachedConnections = /* @__PURE__ */ new Map();
1268
+ function getSolanaRpcUrl() {
1269
+ return _nullishCoalesce(configuredSolanaRpcUrl, () => ( DEFAULT_SOLANA_RPC_URL));
1270
+ }
1271
+ function getSolanaConnection() {
1272
+ const rpcUrl = getSolanaRpcUrl();
1273
+ const cached = cachedConnections.get(rpcUrl);
1274
+ if (cached) {
1275
+ return cached;
1276
+ }
1277
+ const next = new (0, _web3js.Connection)(rpcUrl, "confirmed");
1278
+ cachedConnections.set(rpcUrl, next);
1279
+ return next;
1280
+ }
1281
+ function isNativeSol(token) {
1282
+ return token.mint === "native";
1283
+ }
1284
+ async function buildSolTransferTransaction(connection, from, to, lamports) {
1285
+ const fromPubkey = new (0, _web3js.PublicKey)(from);
1286
+ const toPubkey = new (0, _web3js.PublicKey)(to);
1287
+ const tx = new (0, _web3js.Transaction)().add(
1288
+ _web3js.SystemProgram.transfer({
1289
+ fromPubkey,
1290
+ toPubkey,
1291
+ lamports
1292
+ })
1293
+ );
1294
+ const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
1295
+ tx.recentBlockhash = blockhash;
1296
+ tx.lastValidBlockHeight = lastValidBlockHeight;
1297
+ tx.feePayer = fromPubkey;
1298
+ return tx;
1299
+ }
1300
+ async function buildSplTransferTransaction(connection, from, to, mint, amount) {
1301
+ const fromPubkey = new (0, _web3js.PublicKey)(from);
1302
+ const toPubkey = new (0, _web3js.PublicKey)(to);
1303
+ const mintPubkey = new (0, _web3js.PublicKey)(mint);
1304
+ const fromAta = await _spltoken.getAssociatedTokenAddress.call(void 0, mintPubkey, fromPubkey);
1305
+ const toAta = await _spltoken.getAssociatedTokenAddress.call(void 0, mintPubkey, toPubkey, true);
1306
+ const tx = new (0, _web3js.Transaction)();
1307
+ const toAtaInfo = await connection.getAccountInfo(toAta);
1308
+ if (!toAtaInfo) {
1309
+ tx.add(
1310
+ _spltoken.createAssociatedTokenAccountInstruction.call(void 0,
1311
+ fromPubkey,
1312
+ toAta,
1313
+ toPubkey,
1314
+ mintPubkey
1315
+ )
1316
+ );
1317
+ }
1318
+ tx.add(_spltoken.createTransferInstruction.call(void 0, fromAta, toAta, fromPubkey, amount));
1319
+ const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
1320
+ tx.recentBlockhash = blockhash;
1321
+ tx.lastValidBlockHeight = lastValidBlockHeight;
1322
+ tx.feePayer = fromPubkey;
1323
+ return tx;
1324
+ }
1325
+ function extractSignature(value) {
1326
+ if (typeof value === "string") {
1327
+ return value.length > 0 ? value : null;
1328
+ }
1329
+ if (typeof value.signature === "string" && value.signature.length > 0) {
1330
+ return value.signature;
1331
+ }
1332
+ if (typeof value.hash === "string" && value.hash.length > 0) {
1333
+ return value.hash;
1334
+ }
1335
+ if (typeof value.txid === "string" && value.txid.length > 0) {
1336
+ return value.txid;
1337
+ }
1338
+ if (typeof value.transactionId === "string" && value.transactionId.length > 0) {
1339
+ return value.transactionId;
1340
+ }
1341
+ return null;
1342
+ }
1343
+ async function sendSolanaTransaction(provider, _connection, transaction) {
1344
+ const result = await provider.signAndSendTransaction(transaction);
1345
+ const signature = extractSignature(result);
1346
+ if (!signature) {
1347
+ throw new Error("Transaction sent but wallet did not return a signature");
1348
+ }
1349
+ return signature;
1350
+ }
1351
+
1237
1352
  // src/components/steps/DepositAddressStep.tsx
1238
1353
 
1239
1354
  var POLL_INTERVAL_MS = 4e3;
1355
+ function isRecord(value) {
1356
+ return typeof value === "object" && value !== null;
1357
+ }
1358
+ function asNumber(value) {
1359
+ if (typeof value === "number" && Number.isFinite(value)) return value;
1360
+ if (typeof value === "string" && value.trim() !== "") {
1361
+ const parsed = Number(value);
1362
+ return Number.isFinite(parsed) ? parsed : void 0;
1363
+ }
1364
+ return void 0;
1365
+ }
1366
+ function asChainId(value) {
1367
+ if (typeof value === "string") {
1368
+ if (value.startsWith("solana")) return "solana";
1369
+ const eip155Match = value.match(/^eip155:(\d+)$/);
1370
+ if (eip155Match) return Number(eip155Match[1]);
1371
+ }
1372
+ return asNumber(value);
1373
+ }
1374
+ function asAmount(value) {
1375
+ if (typeof value === "string") return value;
1376
+ if (typeof value === "number" && Number.isFinite(value)) {
1377
+ return value.toString();
1378
+ }
1379
+ return void 0;
1380
+ }
1381
+ function asString(value) {
1382
+ return typeof value === "string" ? value : void 0;
1383
+ }
1384
+ function resolveSolanaTokenMeta(token) {
1385
+ if (!token) return {};
1386
+ const normalized = token.toLowerCase();
1387
+ const matched = SOLANA_TOKENS.find(
1388
+ (entry) => entry.mint.toLowerCase() === normalized
1389
+ );
1390
+ if (matched) {
1391
+ return { sourceSymbol: matched.symbol, sourceDecimals: matched.decimals };
1392
+ }
1393
+ if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
1394
+ return { sourceSymbol: "SOL", sourceDecimals: 9 };
1395
+ }
1396
+ return {};
1397
+ }
1398
+ function getDepositEventDetails(event) {
1399
+ if (!_optionalChain([event, 'optionalAccess', _17 => _17.type]) || !isRecord(event.data)) return {};
1400
+ if (event.type === "deposit-received") {
1401
+ const chainId = asChainId(event.data.chain);
1402
+ const token = asString(event.data.token);
1403
+ const solanaMeta = chainId === "solana" ? resolveSolanaTokenMeta(token) : {};
1404
+ return {
1405
+ chainId,
1406
+ amount: asAmount(event.data.amount),
1407
+ token,
1408
+ ...solanaMeta
1409
+ };
1410
+ }
1411
+ if (event.type === "bridge-started") {
1412
+ const source = isRecord(event.data.source) ? event.data.source : void 0;
1413
+ const chainId = asChainId(_optionalChain([source, 'optionalAccess', _18 => _18.chain]));
1414
+ const token = asString(_optionalChain([source, 'optionalAccess', _19 => _19.asset]));
1415
+ const solanaMeta = chainId === "solana" ? resolveSolanaTokenMeta(token) : {};
1416
+ return {
1417
+ chainId,
1418
+ amount: asAmount(_optionalChain([source, 'optionalAccess', _20 => _20.amount])),
1419
+ token,
1420
+ ...solanaMeta
1421
+ };
1422
+ }
1423
+ return {};
1424
+ }
1240
1425
  function DepositAddressStep({
1241
1426
  smartAccount,
1427
+ solanaDepositAddress,
1242
1428
  service,
1243
1429
  onDepositDetected,
1244
1430
  onError
1245
1431
  }) {
1246
- const supportedChainIds = _react.useMemo.call(void 0, () => _chunkFLXTBFMZcjs.getSupportedChainIds.call(void 0, ), []);
1432
+ const hasSolana = Boolean(solanaDepositAddress);
1433
+ const evmChainIds = _react.useMemo.call(void 0, () => _chunkNELAYNA3cjs.getSupportedChainIds.call(void 0, ), []);
1434
+ const chainOptions = _react.useMemo.call(void 0,
1435
+ () => hasSolana ? [...evmChainIds, "solana"] : evmChainIds,
1436
+ [evmChainIds, hasSolana]
1437
+ );
1247
1438
  const BASE_CHAIN_ID = 8453;
1248
- const defaultChainId = supportedChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : supportedChainIds[0];
1439
+ const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : evmChainIds[0];
1249
1440
  const [sourceChainId, setSourceChainId] = _react.useState.call(void 0, defaultChainId);
1441
+ const isSolana = sourceChainId === "solana";
1250
1442
  const tokensForChain = _react.useMemo.call(void 0,
1251
- () => _chunkFLXTBFMZcjs.getTargetTokenSymbolsForChain.call(void 0, sourceChainId),
1252
- [sourceChainId]
1443
+ () => isSolana ? SOLANA_TOKENS.map((t) => t.symbol) : _chunkNELAYNA3cjs.getTargetTokenSymbolsForChain.call(void 0, sourceChainId),
1444
+ [sourceChainId, isSolana]
1253
1445
  );
1254
1446
  const defaultToken = tokensForChain.includes("USDC") ? "USDC" : _nullishCoalesce(tokensForChain[0], () => ( "USDC"));
1255
1447
  const [sourceTokenSymbol, setSourceTokenSymbol] = _react.useState.call(void 0, defaultToken);
1256
1448
  _react.useEffect.call(void 0, () => {
1257
1449
  if (!tokensForChain.includes(sourceTokenSymbol)) {
1258
- setSourceTokenSymbol(_nullishCoalesce(tokensForChain[0], () => ( "USDC")));
1450
+ const fallback = tokensForChain.includes("USDC") ? "USDC" : _nullishCoalesce(tokensForChain[0], () => ( "USDC"));
1451
+ setSourceTokenSymbol(fallback);
1259
1452
  }
1260
1453
  }, [tokensForChain, sourceTokenSymbol]);
1261
1454
  const [copied, setCopied] = _react.useState.call(void 0, false);
@@ -1267,21 +1460,34 @@ function DepositAddressStep({
1267
1460
  const depositHandledRef = _react.useRef.call(void 0, false);
1268
1461
  const sourceSelectionRef = _react.useRef.call(void 0, {
1269
1462
  chainId: defaultChainId,
1270
- tokenSymbol: defaultToken
1463
+ token: typeof defaultChainId === "number" ? _chunkNELAYNA3cjs.getTokenAddress.call(void 0, defaultToken, defaultChainId) : void 0,
1464
+ sourceSymbol: defaultToken
1271
1465
  });
1272
1466
  _react.useEffect.call(void 0, () => {
1467
+ if (isSolana) {
1468
+ const matched = _nullishCoalesce(SOLANA_TOKENS.find((t) => t.symbol === sourceTokenSymbol), () => ( SOLANA_TOKENS[0]));
1469
+ sourceSelectionRef.current = {
1470
+ chainId: "solana",
1471
+ token: _optionalChain([matched, 'optionalAccess', _21 => _21.mint]),
1472
+ sourceSymbol: _optionalChain([matched, 'optionalAccess', _22 => _22.symbol]),
1473
+ sourceDecimals: _optionalChain([matched, 'optionalAccess', _23 => _23.decimals])
1474
+ };
1475
+ return;
1476
+ }
1273
1477
  sourceSelectionRef.current = {
1274
1478
  chainId: sourceChainId,
1275
- tokenSymbol: sourceTokenSymbol
1479
+ token: _chunkNELAYNA3cjs.getTokenAddress.call(void 0, sourceTokenSymbol, sourceChainId),
1480
+ sourceSymbol: sourceTokenSymbol
1276
1481
  };
1277
- }, [sourceChainId, sourceTokenSymbol]);
1482
+ }, [sourceChainId, sourceTokenSymbol, isSolana]);
1483
+ const displayAddress = isSolana && solanaDepositAddress ? solanaDepositAddress : smartAccount;
1278
1484
  _react.useEffect.call(void 0, () => {
1279
1485
  if (!chainDropdownOpen && !tokenDropdownOpen) return;
1280
1486
  function handlePointerDown(event) {
1281
1487
  const target = event.target;
1282
1488
  if (!target) return;
1283
- const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access', _17 => _17.current, 'optionalAccess', _18 => _18.contains, 'call', _19 => _19(target)]);
1284
- const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access', _20 => _20.current, 'optionalAccess', _21 => _21.contains, 'call', _22 => _22(target)]);
1489
+ const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access', _24 => _24.current, 'optionalAccess', _25 => _25.contains, 'call', _26 => _26(target)]);
1490
+ const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.contains, 'call', _29 => _29(target)]);
1285
1491
  if (clickedChainDropdown || clickedTokenDropdown) return;
1286
1492
  setChainDropdownOpen(false);
1287
1493
  setTokenDropdownOpen(false);
@@ -1295,12 +1501,12 @@ function DepositAddressStep({
1295
1501
  }, [chainDropdownOpen, tokenDropdownOpen]);
1296
1502
  const handleCopy = _react.useCallback.call(void 0, async () => {
1297
1503
  try {
1298
- await navigator.clipboard.writeText(smartAccount);
1504
+ await navigator.clipboard.writeText(displayAddress);
1299
1505
  setCopied(true);
1300
1506
  setTimeout(() => setCopied(false), 2e3);
1301
1507
  } catch (e12) {
1302
1508
  const textarea = document.createElement("textarea");
1303
- textarea.value = smartAccount;
1509
+ textarea.value = displayAddress;
1304
1510
  textarea.style.position = "fixed";
1305
1511
  textarea.style.opacity = "0";
1306
1512
  document.body.appendChild(textarea);
@@ -1310,7 +1516,12 @@ function DepositAddressStep({
1310
1516
  setCopied(true);
1311
1517
  setTimeout(() => setCopied(false), 2e3);
1312
1518
  }
1313
- }, [smartAccount]);
1519
+ }, [displayAddress]);
1520
+ _react.useEffect.call(void 0, () => {
1521
+ setCopied(false);
1522
+ setChainDropdownOpen(false);
1523
+ setTokenDropdownOpen(false);
1524
+ }, [sourceChainId]);
1314
1525
  _react.useEffect.call(void 0, () => {
1315
1526
  depositHandledRef.current = false;
1316
1527
  setPollingError(null);
@@ -1323,18 +1534,27 @@ function DepositAddressStep({
1323
1534
  const status = await service.fetchLatestStatus(smartAccount);
1324
1535
  if (cancelled || depositHandledRef.current) return;
1325
1536
  const event = status.lastEvent;
1326
- const eventTxHash = _chunkAHOFT42Hcjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_optionalChain([_chunkAHOFT42Hcjs.getEventTxHash.call(void 0, event), 'optionalAccess', _23 => _23.toLowerCase, 'call', _24 => _24()]), () => ( null)) : null;
1537
+ const eventTxHash = _chunkLT3QKJI2cjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkLT3QKJI2cjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
1327
1538
  if (baselineTxHash === void 0) {
1328
1539
  baselineTxHash = eventTxHash;
1329
- } else if (eventTxHash && eventTxHash !== baselineTxHash) {
1330
- const details = _chunkAHOFT42Hcjs.getEventSourceDetails.call(void 0, event);
1540
+ } else if (eventTxHash && (!baselineTxHash || !_chunkLT3QKJI2cjs.txRefsMatch.call(void 0, eventTxHash, baselineTxHash))) {
1541
+ const details = getDepositEventDetails(event);
1331
1542
  const fallback = sourceSelectionRef.current;
1332
1543
  const chainId = _nullishCoalesce(details.chainId, () => ( fallback.chainId));
1333
1544
  const amount = _nullishCoalesce(details.amount, () => ( "0"));
1334
- const token = _nullishCoalesce(details.token, () => ( _chunkFLXTBFMZcjs.getTokenAddress.call(void 0, fallback.tokenSymbol, fallback.chainId)));
1545
+ const token = _nullishCoalesce(details.token, () => ( fallback.token));
1546
+ const sourceSymbol = _nullishCoalesce(details.sourceSymbol, () => ( fallback.sourceSymbol));
1547
+ const sourceDecimals = _nullishCoalesce(details.sourceDecimals, () => ( fallback.sourceDecimals));
1335
1548
  if (token) {
1336
1549
  depositHandledRef.current = true;
1337
- onDepositDetected(eventTxHash, chainId, amount, token);
1550
+ onDepositDetected(
1551
+ eventTxHash,
1552
+ chainId,
1553
+ amount,
1554
+ token,
1555
+ sourceSymbol,
1556
+ sourceDecimals
1557
+ );
1338
1558
  return;
1339
1559
  }
1340
1560
  }
@@ -1343,7 +1563,7 @@ function DepositAddressStep({
1343
1563
  if (!cancelled) {
1344
1564
  const msg = err instanceof Error ? err.message : "Failed to check status";
1345
1565
  setPollingError(msg);
1346
- _optionalChain([onError, 'optionalCall', _25 => _25(msg, "STATUS_POLL_ERROR")]);
1566
+ _optionalChain([onError, 'optionalCall', _30 => _30(msg, "STATUS_POLL_ERROR")]);
1347
1567
  }
1348
1568
  }
1349
1569
  if (!cancelled && !depositHandledRef.current) {
@@ -1356,31 +1576,31 @@ function DepositAddressStep({
1356
1576
  clearTimeout(timeoutId);
1357
1577
  };
1358
1578
  }, [smartAccount, service, onDepositDetected, onError]);
1359
- const chainIconSrc = _chunkFLXTBFMZcjs.getChainIcon.call(void 0, sourceChainId);
1579
+ const qrIconSrc = _chunkNELAYNA3cjs.getChainIcon.call(void 0, sourceChainId);
1360
1580
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
1361
1581
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-body", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address", children: [
1362
1582
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
1363
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", ref: tokenDropdownRef, children: [
1364
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Supported token" }),
1583
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
1584
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Chain" }),
1365
1585
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1366
1586
  "button",
1367
1587
  {
1368
1588
  type: "button",
1369
1589
  className: "rs-deposit-address-dropdown-trigger",
1370
1590
  onClick: () => {
1371
- setTokenDropdownOpen(!tokenDropdownOpen);
1372
- setChainDropdownOpen(false);
1591
+ setChainDropdownOpen(!chainDropdownOpen);
1592
+ setTokenDropdownOpen(false);
1373
1593
  },
1374
1594
  children: [
1375
- _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, sourceTokenSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1595
+ _chunkNELAYNA3cjs.getChainIcon.call(void 0, sourceChainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1376
1596
  "img",
1377
1597
  {
1378
- src: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, sourceTokenSymbol),
1598
+ src: _chunkNELAYNA3cjs.getChainIcon.call(void 0, sourceChainId),
1379
1599
  alt: "",
1380
1600
  className: "rs-deposit-address-dropdown-icon"
1381
1601
  }
1382
1602
  ),
1383
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceTokenSymbol }),
1603
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkNELAYNA3cjs.getChainName.call(void 0, sourceChainId) }),
1384
1604
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1385
1605
  "svg",
1386
1606
  {
@@ -1402,51 +1622,51 @@ function DepositAddressStep({
1402
1622
  ]
1403
1623
  }
1404
1624
  ),
1405
- tokenDropdownOpen && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-menu", children: tokensForChain.map((symbol) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1625
+ chainDropdownOpen && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-menu", children: chainOptions.map((chainId) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1406
1626
  "button",
1407
1627
  {
1408
1628
  type: "button",
1409
- className: `rs-deposit-address-dropdown-item ${symbol === sourceTokenSymbol ? "rs-deposit-address-dropdown-item--active" : ""}`,
1629
+ className: `rs-deposit-address-dropdown-item ${chainId === sourceChainId ? "rs-deposit-address-dropdown-item--active" : ""}`,
1410
1630
  onClick: () => {
1411
- setSourceTokenSymbol(symbol);
1412
- setTokenDropdownOpen(false);
1631
+ setSourceChainId(chainId);
1632
+ setChainDropdownOpen(false);
1413
1633
  },
1414
1634
  children: [
1415
- _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1635
+ _chunkNELAYNA3cjs.getChainIcon.call(void 0, chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1416
1636
  "img",
1417
1637
  {
1418
- src: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, symbol),
1638
+ src: _chunkNELAYNA3cjs.getChainIcon.call(void 0, chainId),
1419
1639
  alt: "",
1420
1640
  className: "rs-deposit-address-dropdown-icon"
1421
1641
  }
1422
1642
  ),
1423
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: symbol })
1643
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkNELAYNA3cjs.getChainName.call(void 0, chainId) })
1424
1644
  ]
1425
1645
  },
1426
- symbol
1646
+ String(chainId)
1427
1647
  )) })
1428
1648
  ] }),
1429
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
1430
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
1649
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", ref: tokenDropdownRef, children: [
1650
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Token" }),
1431
1651
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1432
1652
  "button",
1433
1653
  {
1434
1654
  type: "button",
1435
1655
  className: "rs-deposit-address-dropdown-trigger",
1436
1656
  onClick: () => {
1437
- setChainDropdownOpen(!chainDropdownOpen);
1438
- setTokenDropdownOpen(false);
1657
+ setTokenDropdownOpen(!tokenDropdownOpen);
1658
+ setChainDropdownOpen(false);
1439
1659
  },
1440
1660
  children: [
1441
- _chunkFLXTBFMZcjs.getChainIcon.call(void 0, sourceChainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1661
+ _chunkNELAYNA3cjs.getTokenIcon.call(void 0, sourceTokenSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1442
1662
  "img",
1443
1663
  {
1444
- src: _chunkFLXTBFMZcjs.getChainIcon.call(void 0, sourceChainId),
1664
+ src: _chunkNELAYNA3cjs.getTokenIcon.call(void 0, sourceTokenSymbol),
1445
1665
  alt: "",
1446
1666
  className: "rs-deposit-address-dropdown-icon"
1447
1667
  }
1448
1668
  ),
1449
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkFLXTBFMZcjs.getChainName.call(void 0, sourceChainId) }),
1669
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceTokenSymbol }),
1450
1670
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1451
1671
  "svg",
1452
1672
  {
@@ -1468,35 +1688,39 @@ function DepositAddressStep({
1468
1688
  ]
1469
1689
  }
1470
1690
  ),
1471
- chainDropdownOpen && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-menu", children: supportedChainIds.map((chainId) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1691
+ tokenDropdownOpen && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-menu", children: tokensForChain.map((symbol) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1472
1692
  "button",
1473
1693
  {
1474
1694
  type: "button",
1475
- className: `rs-deposit-address-dropdown-item ${chainId === sourceChainId ? "rs-deposit-address-dropdown-item--active" : ""}`,
1695
+ className: `rs-deposit-address-dropdown-item ${symbol === sourceTokenSymbol ? "rs-deposit-address-dropdown-item--active" : ""}`,
1476
1696
  onClick: () => {
1477
- setSourceChainId(chainId);
1478
- setChainDropdownOpen(false);
1697
+ setSourceTokenSymbol(symbol);
1698
+ setTokenDropdownOpen(false);
1479
1699
  },
1480
1700
  children: [
1481
- _chunkFLXTBFMZcjs.getChainIcon.call(void 0, chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1701
+ _chunkNELAYNA3cjs.getTokenIcon.call(void 0, symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1482
1702
  "img",
1483
1703
  {
1484
- src: _chunkFLXTBFMZcjs.getChainIcon.call(void 0, chainId),
1704
+ src: _chunkNELAYNA3cjs.getTokenIcon.call(void 0, symbol),
1485
1705
  alt: "",
1486
1706
  className: "rs-deposit-address-dropdown-icon"
1487
1707
  }
1488
1708
  ),
1489
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkFLXTBFMZcjs.getChainName.call(void 0, chainId) })
1709
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: symbol })
1490
1710
  ]
1491
1711
  },
1492
- chainId
1712
+ symbol
1493
1713
  )) })
1494
1714
  ] })
1495
1715
  ] }),
1496
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QRCode, { value: smartAccount, size: 200, iconSrc: chainIconSrc }) }),
1716
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QRCode, { value: displayAddress, size: 200, iconSrc: qrIconSrc }) }),
1497
1717
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-info", children: [
1498
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-label", children: "Your deposit address" }),
1499
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-value", children: smartAccount }),
1718
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-label", children: [
1719
+ "Your ",
1720
+ isSolana ? "Solana" : "EVM",
1721
+ " deposit address"
1722
+ ] }),
1723
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-value", children: displayAddress }),
1500
1724
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1501
1725
  "button",
1502
1726
  {
@@ -1536,184 +1760,886 @@ function DepositAddressStep({
1536
1760
  ] }),
1537
1761
  pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
1538
1762
  ] }) }),
1539
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.PoweredBy, {})
1763
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLT3QKJI2cjs.PoweredBy, {})
1540
1764
  ] });
1541
1765
  }
1542
1766
  DepositAddressStep.displayName = "DepositAddressStep";
1543
1767
 
1544
- // src/DepositFlow.tsx
1768
+ // src/components/steps/SolanaTokenSelectStep.tsx
1545
1769
 
1546
- function isSameRoute(sourceChain, sourceToken, targetChain, targetToken) {
1547
- return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
1548
- }
1549
- function getAddressKey(address) {
1550
- return address ? address.toLowerCase() : null;
1551
- }
1552
- function DepositFlow({
1553
- dappWalletClient,
1554
- dappPublicClient,
1555
- dappAddress,
1556
- targetChain,
1557
- targetToken,
1770
+
1771
+
1772
+ function SolanaTokenSelectStep({
1773
+ solanaAddress,
1558
1774
  service,
1559
- sourceChain: defaultSourceChain,
1560
- sourceToken: defaultSourceToken,
1561
- amount: defaultAmount,
1562
- recipient,
1563
- signerAddress = _chunkFLXTBFMZcjs.DEFAULT_SIGNER_ADDRESS,
1564
- sessionChainIds,
1565
- forceRegister = false,
1566
- waitForFinalTx = true,
1567
- reownWallet,
1568
- onConnect,
1569
- onDisconnect,
1570
- onRequestConnect,
1571
- connectButtonLabel,
1572
- uiConfig,
1573
- onStepChange,
1574
- onTotalBalanceChange,
1575
- onClose,
1576
- onConnected,
1577
- onDepositSubmitted,
1578
- onDepositComplete,
1579
- onDepositFailed,
1580
- onError,
1775
+ onContinue,
1776
+ onTotalBalanceComputed,
1581
1777
  debug
1582
1778
  }) {
1583
- const [step, setStep] = _react.useState.call(void 0, { type: "setup" });
1584
- const [flowMode, setFlowMode] = _react.useState.call(void 0, null);
1585
- const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
1586
- const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
1587
- const [selectedConnectAddress, setSelectedConnectAddress] = _react.useState.call(void 0, null);
1588
- const portfolioAssetsRef = _react.useRef.call(void 0, []);
1589
- const stableWalletSignerRef = _react.useRef.call(void 0, null);
1590
- const stableWalletSelectionKeyRef = _react.useRef.call(void 0, null);
1591
- const hasNavigatedBackRef = _react.useRef.call(void 0, false);
1592
- const handleAssetsLoaded = _react.useCallback.call(void 0, (assets) => {
1593
- portfolioAssetsRef.current = assets;
1594
- }, []);
1595
- const getTokenPriceUsd = _react.useCallback.call(void 0, (symbol) => {
1596
- const sym = symbol.toLowerCase();
1597
- for (const asset of portfolioAssetsRef.current) {
1598
- if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
1599
- try {
1600
- const balanceUnits = Number(asset.balance) / 10 ** asset.decimals;
1601
- if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
1602
- } catch (e13) {
1779
+ const [tokenBalances, setTokenBalances] = _react.useState.call(void 0, []);
1780
+ const [selectedSymbol, setSelectedSymbol] = _react.useState.call(void 0, null);
1781
+ const [loading, setLoading] = _react.useState.call(void 0, true);
1782
+ const [error, setError] = _react.useState.call(void 0, null);
1783
+ _react.useEffect.call(void 0, () => {
1784
+ let active = true;
1785
+ async function loadBalances() {
1786
+ if (!solanaAddress) {
1787
+ setLoading(false);
1788
+ return;
1789
+ }
1790
+ setLoading(true);
1791
+ setError(null);
1792
+ const portfolioBySymbol = {};
1793
+ try {
1794
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:request", {
1795
+ solanaAddress
1796
+ });
1797
+ const portfolio = await service.fetchSolanaPortfolio(solanaAddress);
1798
+ if (!active) return;
1799
+ for (const t of portfolio.tokens) {
1800
+ const symbol = t.symbol.toUpperCase();
1801
+ if (!SOLANA_TOKENS.some((st) => st.symbol === symbol)) continue;
1802
+ let parsed = 0n;
1803
+ try {
1804
+ parsed = BigInt(t.balance || "0");
1805
+ } catch (e13) {
1806
+ parsed = 0n;
1807
+ }
1808
+ if (parsed <= 0n) continue;
1809
+ const existing = portfolioBySymbol[symbol];
1810
+ if (!existing || (_nullishCoalesce(t.balanceUsd, () => ( 0))) > existing.balanceUsd) {
1811
+ portfolioBySymbol[symbol] = {
1812
+ balance: parsed,
1813
+ balanceUsd: _nullishCoalesce(t.balanceUsd, () => ( 0))
1814
+ };
1815
+ }
1816
+ }
1817
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:success", {
1818
+ symbols: Object.keys(portfolioBySymbol)
1819
+ });
1820
+ } catch (err) {
1821
+ if (!active) return;
1822
+ _chunkLT3QKJI2cjs.debugError.call(void 0, debug, "solana-token-select", "portfolio:failure", err, {
1823
+ solanaAddress
1824
+ });
1825
+ setError(
1826
+ err instanceof Error ? err.message : "Failed to load balances"
1827
+ );
1828
+ setTokenBalances([]);
1829
+ setLoading(false);
1830
+ return;
1831
+ }
1832
+ const results = [];
1833
+ for (const token of SOLANA_TOKENS) {
1834
+ const fromPortfolio = portfolioBySymbol[token.symbol];
1835
+ if (fromPortfolio && fromPortfolio.balance > 0n) {
1836
+ results.push({
1837
+ token,
1838
+ balance: fromPortfolio.balance,
1839
+ balanceUsd: fromPortfolio.balanceUsd
1840
+ });
1603
1841
  }
1604
1842
  }
1843
+ if (!active) return;
1844
+ setTokenBalances(results);
1845
+ setLoading(false);
1846
+ const totalUsd = results.reduce((sum, r) => sum + r.balanceUsd, 0);
1847
+ _optionalChain([onTotalBalanceComputed, 'optionalCall', _31 => _31(totalUsd)]);
1605
1848
  }
1606
- return null;
1607
- }, []);
1608
- const dappSwitchChain = _react.useMemo.call(void 0, () => {
1609
- if (!_optionalChain([dappWalletClient, 'optionalAccess', _26 => _26.switchChain])) return void 0;
1610
- return async (chainId) => {
1611
- await _optionalChain([dappWalletClient, 'access', _27 => _27.switchChain, 'optionalCall', _28 => _28({ id: chainId })]);
1849
+ void loadBalances();
1850
+ return () => {
1851
+ active = false;
1612
1852
  };
1613
- }, [dappWalletClient]);
1614
- const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _29 => _29.account, 'optionalAccess', _30 => _30.address]), () => ( null));
1615
- const walletOptions = _react.useMemo.call(void 0, () => {
1616
- const options = [];
1617
- const seen = /* @__PURE__ */ new Set();
1618
- if (connectedWalletAddress && dappAddress) {
1619
- options.push({
1620
- address: connectedWalletAddress,
1621
- label: "Connected Wallet",
1622
- kind: "connected"
1623
- });
1624
- seen.add(connectedWalletAddress.toLowerCase());
1625
- }
1626
- if (_optionalChain([reownWallet, 'optionalAccess', _31 => _31.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(reownWallet.address.toLowerCase())) {
1627
- options.push({
1628
- address: reownWallet.address,
1629
- label: "External Wallet",
1630
- kind: "external",
1631
- icon: reownWallet.icon
1632
- });
1633
- }
1634
- return options;
1635
- }, [
1636
- connectedWalletAddress,
1637
- dappAddress,
1638
- _optionalChain([reownWallet, 'optionalAccess', _32 => _32.address]),
1639
- _optionalChain([reownWallet, 'optionalAccess', _33 => _33.isConnected]),
1640
- _optionalChain([reownWallet, 'optionalAccess', _34 => _34.walletClient]),
1641
- _optionalChain([reownWallet, 'optionalAccess', _35 => _35.publicClient]),
1642
- _optionalChain([reownWallet, 'optionalAccess', _36 => _36.icon])
1643
- ]);
1644
- const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _37 => _37.account]) && dappAddress && !reownWallet;
1645
- const hasWalletOptions = walletOptions.length > 0;
1646
- const hasReownSession = Boolean(
1647
- _optionalChain([reownWallet, 'optionalAccess', _38 => _38.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _39 => _39.address])
1853
+ }, [debug, solanaAddress, service, onTotalBalanceComputed]);
1854
+ const rows = _react.useMemo.call(void 0,
1855
+ () => [...tokenBalances].sort((a, b) => {
1856
+ if (a.balanceUsd !== b.balanceUsd) return b.balanceUsd - a.balanceUsd;
1857
+ if (b.balance > a.balance) return 1;
1858
+ if (b.balance < a.balance) return -1;
1859
+ return 0;
1860
+ }),
1861
+ [tokenBalances]
1648
1862
  );
1649
- const showConnectStep = flowMode === null && !canAutoLock && !isConnectSelectionConfirmed;
1650
- const walletSelectionKey = _react.useMemo.call(void 0, () => {
1651
- if (flowMode !== "wallet") return null;
1652
- if (canAutoLock) {
1653
- return getAddressKey(connectedWalletAddress);
1654
- }
1655
- if (!isConnectSelectionConfirmed) return null;
1656
- return getAddressKey(selectedConnectAddress);
1657
- }, [
1658
- flowMode,
1659
- canAutoLock,
1660
- connectedWalletAddress,
1661
- isConnectSelectionConfirmed,
1662
- selectedConnectAddress
1663
- ]);
1664
- const walletSignerContext = _react.useMemo.call(void 0, () => {
1665
- if (flowMode === "deposit-address") {
1666
- return null;
1667
- }
1668
- if (canAutoLock) {
1669
- const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _40 => _40.chain, 'optionalAccess', _41 => _41.id]), () => ( targetChain));
1670
- return {
1671
- ownerAddress: dappWalletClient.account.address,
1672
- walletClient: dappWalletClient,
1673
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkAHOFT42Hcjs.getPublicClient.call(void 0, fallbackChainId))),
1674
- switchChain: dappSwitchChain
1675
- };
1676
- }
1677
- if (!isConnectSelectionConfirmed || !selectedConnectAddress) return null;
1678
- if (_optionalChain([dappWalletClient, 'optionalAccess', _42 => _42.account]) && dappWalletClient.account.address.toLowerCase() === selectedConnectAddress.toLowerCase()) {
1679
- const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _43 => _43.chain, 'optionalAccess', _44 => _44.id]), () => ( targetChain));
1680
- return {
1681
- ownerAddress: dappWalletClient.account.address,
1682
- walletClient: dappWalletClient,
1683
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkAHOFT42Hcjs.getPublicClient.call(void 0, fallbackChainId))),
1684
- switchChain: dappSwitchChain
1685
- };
1686
- }
1687
- if (_optionalChain([reownWallet, 'optionalAccess', _45 => _45.address, 'optionalAccess', _46 => _46.toLowerCase, 'call', _47 => _47()]) === selectedConnectAddress.toLowerCase() && reownWallet.walletClient && reownWallet.publicClient) {
1688
- return {
1689
- ownerAddress: reownWallet.address,
1690
- walletClient: reownWallet.walletClient,
1691
- publicClient: reownWallet.publicClient,
1692
- switchChain: reownWallet.switchChain
1693
- };
1694
- }
1695
- return null;
1696
- }, [
1697
- canAutoLock,
1698
- isConnectSelectionConfirmed,
1699
- selectedConnectAddress,
1700
- dappWalletClient,
1701
- dappPublicClient,
1702
- dappSwitchChain,
1703
- dappAddress,
1704
- reownWallet,
1705
- targetChain
1706
- ]);
1707
- _react.useEffect.call(void 0, () => {
1708
- if (flowMode !== "wallet") {
1709
- stableWalletSelectionKeyRef.current = null;
1710
- stableWalletSignerRef.current = null;
1711
- return;
1712
- }
1713
- if (walletSelectionKey !== stableWalletSelectionKeyRef.current) {
1714
- stableWalletSelectionKeyRef.current = walletSelectionKey;
1715
- stableWalletSignerRef.current = null;
1716
- }
1863
+ const selectedEntry = selectedSymbol ? rows.find((r) => r.token.symbol === selectedSymbol) : null;
1864
+ if (error) {
1865
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-body", children: /* @__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 }) }) }) });
1866
+ }
1867
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
1868
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { padding: "12px 12px 4px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-title", children: "Select source asset" }) }),
1869
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1870
+ "div",
1871
+ {
1872
+ className: "rs-step-body",
1873
+ style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
1874
+ children: [
1875
+ loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
1876
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLT3QKJI2cjs.Spinner, { className: "rs-text-tertiary" }),
1877
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
1878
+ ] }),
1879
+ !loading && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
1880
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1881
+ "svg",
1882
+ {
1883
+ className: "rs-empty-icon",
1884
+ viewBox: "0 0 24 24",
1885
+ fill: "none",
1886
+ stroke: "currentColor",
1887
+ strokeWidth: "1.5",
1888
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1889
+ "path",
1890
+ {
1891
+ strokeLinecap: "round",
1892
+ strokeLinejoin: "round",
1893
+ d: "M21 12a2.25 2.25 0 00-2.25-2.25H15a3 3 0 11-6 0H5.25A2.25 2.25 0 003 12m18 0v6a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 18v-6m18 0V9M3 12V9m18 0a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 9m18 0V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v3"
1894
+ }
1895
+ )
1896
+ }
1897
+ ),
1898
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
1899
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-address", children: [
1900
+ solanaAddress.slice(0, 6),
1901
+ "...",
1902
+ solanaAddress.slice(-4)
1903
+ ] })
1904
+ ] }),
1905
+ !loading && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((entry) => {
1906
+ const isSelected = selectedSymbol === entry.token.symbol;
1907
+ const tokenIcon = _chunkNELAYNA3cjs.getTokenIcon.call(void 0, entry.token.symbol);
1908
+ const chainIcon = _chunkNELAYNA3cjs.getChainIcon.call(void 0, "solana");
1909
+ let formattedBalance;
1910
+ try {
1911
+ const raw = _viem.formatUnits.call(void 0, entry.balance, entry.token.decimals);
1912
+ const numeric = Number(raw);
1913
+ formattedBalance = Number.isFinite(numeric) ? _chunkLT3QKJI2cjs.tokenFormatter.format(numeric) : raw;
1914
+ } catch (e14) {
1915
+ formattedBalance = "...";
1916
+ }
1917
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1918
+ "button",
1919
+ {
1920
+ type: "button",
1921
+ onClick: () => setSelectedSymbol(entry.token.symbol),
1922
+ className: `rs-asset-row ${isSelected ? "rs-asset-row--selected" : ""}`,
1923
+ style: { textAlign: "left" },
1924
+ children: [
1925
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-info", children: [
1926
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-icon-wrapper", children: [
1927
+ tokenIcon ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1928
+ "img",
1929
+ {
1930
+ src: tokenIcon,
1931
+ alt: entry.token.symbol,
1932
+ className: "rs-asset-icon",
1933
+ style: { background: "transparent" }
1934
+ }
1935
+ ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-icon", children: entry.token.symbol.slice(0, 4) }),
1936
+ chainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1937
+ "img",
1938
+ {
1939
+ src: chainIcon,
1940
+ alt: "Solana",
1941
+ className: "rs-asset-chain-badge"
1942
+ }
1943
+ )
1944
+ ] }),
1945
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
1946
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-name", children: [
1947
+ entry.token.symbol,
1948
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-asset-chain", children: " on Solana" })
1949
+ ] }),
1950
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
1951
+ formattedBalance,
1952
+ " ",
1953
+ entry.token.symbol
1954
+ ] })
1955
+ ] })
1956
+ ] }),
1957
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? _chunkLT3QKJI2cjs.currencyFormatter.format(entry.balanceUsd) : `${formattedBalance} ${entry.token.symbol}` })
1958
+ ]
1959
+ },
1960
+ entry.token.symbol
1961
+ );
1962
+ }) })
1963
+ ]
1964
+ }
1965
+ ),
1966
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1967
+ _chunkLT3QKJI2cjs.Button,
1968
+ {
1969
+ onClick: () => selectedEntry && onContinue(
1970
+ selectedEntry.token,
1971
+ selectedEntry.balance,
1972
+ selectedEntry.balanceUsd
1973
+ ),
1974
+ disabled: !selectedEntry,
1975
+ fullWidth: true,
1976
+ children: "Continue"
1977
+ }
1978
+ ) }),
1979
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLT3QKJI2cjs.PoweredBy, {})
1980
+ ] });
1981
+ }
1982
+
1983
+ // src/components/steps/SolanaAmountStep.tsx
1984
+
1985
+
1986
+
1987
+ var SOL_FEE_RESERVE_LAMPORTS = 1000000n;
1988
+ function SolanaAmountStep({
1989
+ token,
1990
+ balance,
1991
+ balanceUsd,
1992
+ onContinue,
1993
+ debug
1994
+ }) {
1995
+ const [amount, setAmount] = _react.useState.call(void 0, "");
1996
+ const [error, setError] = _react.useState.call(void 0, null);
1997
+ const formattedBalance = _react.useMemo.call(void 0, () => {
1998
+ try {
1999
+ const raw = _viem.formatUnits.call(void 0, balance, token.decimals);
2000
+ const numeric = Number(raw);
2001
+ if (!Number.isFinite(numeric)) return raw;
2002
+ return _chunkLT3QKJI2cjs.tokenFormatter.format(numeric);
2003
+ } catch (e15) {
2004
+ return "...";
2005
+ }
2006
+ }, [balance, token.decimals]);
2007
+ const formattedBalanceUsd = _react.useMemo.call(void 0, () => {
2008
+ if (!Number.isFinite(balanceUsd) || balanceUsd <= 0) return null;
2009
+ return _chunkLT3QKJI2cjs.currencyFormatter.format(balanceUsd);
2010
+ }, [balanceUsd]);
2011
+ const spendableBalance = _react.useMemo.call(void 0, () => {
2012
+ if (!isNativeSol(token)) return balance;
2013
+ return balance > SOL_FEE_RESERVE_LAMPORTS ? balance - SOL_FEE_RESERVE_LAMPORTS : 0n;
2014
+ }, [balance, token]);
2015
+ const handlePresetClick = (percentage) => {
2016
+ try {
2017
+ const spendableUnits = Number(_viem.formatUnits.call(void 0, spendableBalance, token.decimals));
2018
+ if (!Number.isFinite(spendableUnits) || spendableUnits <= 0) return;
2019
+ const value = spendableUnits * percentage / 100;
2020
+ const maxDecimals = token.decimals > 6 ? 6 : token.decimals;
2021
+ const factor = 10 ** maxDecimals;
2022
+ const truncated = Math.floor(value * factor) / factor;
2023
+ const formatted = truncated.toFixed(maxDecimals).replace(/\.?0+$/, "");
2024
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "solana-amount", "amount:preset", {
2025
+ percentage,
2026
+ symbol: token.symbol,
2027
+ formatted
2028
+ });
2029
+ setAmount(formatted);
2030
+ } catch (e16) {
2031
+ return;
2032
+ }
2033
+ if (error) setError(null);
2034
+ };
2035
+ const handleContinue = () => {
2036
+ const numericAmount = parseFloat(amount);
2037
+ if (isNaN(numericAmount) || numericAmount <= 0) {
2038
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
2039
+ amount,
2040
+ reason: "nan-or-non-positive"
2041
+ });
2042
+ setError("Please enter a valid amount");
2043
+ return;
2044
+ }
2045
+ let amountInUnits;
2046
+ try {
2047
+ amountInUnits = _viem.parseUnits.call(void 0, amount, token.decimals);
2048
+ } catch (e17) {
2049
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
2050
+ amount,
2051
+ reason: "parse-units-failed"
2052
+ });
2053
+ setError("Please enter a valid amount");
2054
+ return;
2055
+ }
2056
+ if (amountInUnits > spendableBalance) {
2057
+ const isReserveIssue = isNativeSol(token) && amountInUnits <= balance;
2058
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
2059
+ amount,
2060
+ balance: balance.toString(),
2061
+ spendableBalance: spendableBalance.toString(),
2062
+ amountInUnits: amountInUnits.toString(),
2063
+ reason: isReserveIssue ? "native-buffer" : "insufficient-balance"
2064
+ });
2065
+ setError(
2066
+ isReserveIssue ? "Use a bit less than your full SOL balance" : "Insufficient balance"
2067
+ );
2068
+ return;
2069
+ }
2070
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
2071
+ symbol: token.symbol,
2072
+ amount,
2073
+ amountInUnits: amountInUnits.toString()
2074
+ });
2075
+ setError(null);
2076
+ onContinue(token, amount);
2077
+ };
2078
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
2079
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { padding: "12px 12px 4px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-title", children: "Enter amount" }) }),
2080
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
2081
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
2082
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-input-wrapper", children: [
2083
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2084
+ "input",
2085
+ {
2086
+ type: "text",
2087
+ inputMode: "decimal",
2088
+ className: "rs-amount-input-large",
2089
+ placeholder: "0.00",
2090
+ value: amount,
2091
+ onChange: (e) => {
2092
+ const raw = e.target.value.replace(/[^0-9.]/g, "");
2093
+ const parts = raw.split(".");
2094
+ if (parts.length > 2) return;
2095
+ setAmount(raw);
2096
+ if (error) setError(null);
2097
+ },
2098
+ autoFocus: true
2099
+ }
2100
+ ),
2101
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-token-value", children: token.symbol })
2102
+ ] }),
2103
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-available", children: [
2104
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-available-value", children: [
2105
+ formattedBalance,
2106
+ " ",
2107
+ token.symbol,
2108
+ " available"
2109
+ ] }),
2110
+ formattedBalanceUsd && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-available-value", children: formattedBalanceUsd })
2111
+ ] })
2112
+ ] }),
2113
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-presets", children: [
2114
+ [25, 50, 75].map((pct) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2115
+ "button",
2116
+ {
2117
+ type: "button",
2118
+ className: "rs-amount-preset-btn",
2119
+ onClick: () => handlePresetClick(pct),
2120
+ children: [
2121
+ pct,
2122
+ "%"
2123
+ ]
2124
+ },
2125
+ pct
2126
+ )),
2127
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2128
+ "button",
2129
+ {
2130
+ type: "button",
2131
+ className: "rs-amount-preset-btn",
2132
+ onClick: () => handlePresetClick(100),
2133
+ children: "Max"
2134
+ }
2135
+ )
2136
+ ] }),
2137
+ error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
2138
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2139
+ "svg",
2140
+ {
2141
+ viewBox: "0 0 24 24",
2142
+ fill: "none",
2143
+ stroke: "currentColor",
2144
+ strokeWidth: "2",
2145
+ style: { width: 16, height: 16, flexShrink: 0 },
2146
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2147
+ "path",
2148
+ {
2149
+ strokeLinecap: "round",
2150
+ strokeLinejoin: "round",
2151
+ d: "M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"
2152
+ }
2153
+ )
2154
+ }
2155
+ ),
2156
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: error })
2157
+ ] })
2158
+ ] }),
2159
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2160
+ _chunkLT3QKJI2cjs.Button,
2161
+ {
2162
+ onClick: handleContinue,
2163
+ fullWidth: true,
2164
+ disabled: !amount,
2165
+ children: "Continue"
2166
+ }
2167
+ ) }),
2168
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLT3QKJI2cjs.PoweredBy, {})
2169
+ ] });
2170
+ }
2171
+
2172
+ // src/components/steps/SolanaConfirmStep.tsx
2173
+
2174
+
2175
+
2176
+ function SolanaConfirmStep({
2177
+ smartAccount,
2178
+ solanaAddress,
2179
+ solanaDepositAddress,
2180
+ token,
2181
+ amount,
2182
+ targetChain,
2183
+ targetToken,
2184
+ service,
2185
+ solanaProvider,
2186
+ onConfirm,
2187
+ onError,
2188
+ debug
2189
+ }) {
2190
+ const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
2191
+ const [error, setError] = _react.useState.call(void 0, null);
2192
+ const targetSymbol = _chunkNELAYNA3cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
2193
+ const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
2194
+ const formattedAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
2195
+ const handleConfirm = async () => {
2196
+ if (!solanaProvider) {
2197
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
2198
+ reason: "missing-provider"
2199
+ });
2200
+ setError("Solana wallet not connected");
2201
+ return;
2202
+ }
2203
+ const parsedAmount = parseFloat(amount);
2204
+ if (isNaN(parsedAmount) || parsedAmount <= 0) {
2205
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
2206
+ reason: "invalid-amount",
2207
+ amount
2208
+ });
2209
+ setError("Please enter a valid amount");
2210
+ return;
2211
+ }
2212
+ setError(null);
2213
+ setIsSubmitting(true);
2214
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:start", {
2215
+ smartAccount,
2216
+ solanaAddress,
2217
+ solanaDepositAddress,
2218
+ token: token.symbol,
2219
+ amount
2220
+ });
2221
+ try {
2222
+ const check = await service.checkAccount(smartAccount);
2223
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "solana-confirm", "check:success", {
2224
+ smartAccount,
2225
+ isRegistered: check.isRegistered,
2226
+ targetChain: check.targetChain,
2227
+ targetToken: check.targetToken
2228
+ });
2229
+ if (!check.isRegistered) {
2230
+ throw new Error(
2231
+ "Deposit account is not registered yet. Please restart setup and try again."
2232
+ );
2233
+ }
2234
+ const connection = getSolanaConnection();
2235
+ const amountUnits = _viem.parseUnits.call(void 0, amount, token.decimals);
2236
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
2237
+ token: token.symbol,
2238
+ amount,
2239
+ amountUnits: amountUnits.toString()
2240
+ });
2241
+ const transaction = isNativeSol(token) ? await buildSolTransferTransaction(
2242
+ connection,
2243
+ solanaAddress,
2244
+ solanaDepositAddress,
2245
+ amountUnits
2246
+ ) : await buildSplTransferTransaction(
2247
+ connection,
2248
+ solanaAddress,
2249
+ solanaDepositAddress,
2250
+ token.mint,
2251
+ amountUnits
2252
+ );
2253
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
2254
+ token: token.symbol,
2255
+ instructionCount: transaction.instructions.length,
2256
+ feePayer: _optionalChain([transaction, 'access', _32 => _32.feePayer, 'optionalAccess', _33 => _33.toBase58, 'call', _34 => _34()]),
2257
+ recentBlockhash: transaction.recentBlockhash
2258
+ });
2259
+ const txHash = await sendSolanaTransaction(
2260
+ solanaProvider,
2261
+ connection,
2262
+ transaction
2263
+ );
2264
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:sent", {
2265
+ txHash,
2266
+ amountUnits: amountUnits.toString()
2267
+ });
2268
+ onConfirm(txHash, amountUnits.toString());
2269
+ } catch (err) {
2270
+ const raw = err instanceof Error ? err.message : "Transfer failed";
2271
+ const message = _chunkLT3QKJI2cjs.formatUserError.call(void 0, raw);
2272
+ _chunkLT3QKJI2cjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
2273
+ smartAccount,
2274
+ token: token.symbol,
2275
+ amount
2276
+ });
2277
+ setError(message);
2278
+ _optionalChain([onError, 'optionalCall', _35 => _35(message, "SOLANA_TRANSFER_ERROR")]);
2279
+ } finally {
2280
+ setIsSubmitting(false);
2281
+ }
2282
+ };
2283
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
2284
+ /* @__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" }) }),
2285
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-space-y-3", style: { paddingTop: 0 }, children: [
2286
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card", children: [
2287
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
2288
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Source" }),
2289
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2290
+ "span",
2291
+ {
2292
+ className: "rs-card-value",
2293
+ style: { display: "flex", alignItems: "center", gap: 8 },
2294
+ children: [
2295
+ _chunkNELAYNA3cjs.getChainIcon.call(void 0, "solana") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2296
+ "img",
2297
+ {
2298
+ src: _chunkNELAYNA3cjs.getChainIcon.call(void 0, "solana"),
2299
+ alt: "",
2300
+ style: { width: 16, height: 16, borderRadius: 3 }
2301
+ }
2302
+ ),
2303
+ _chunkNELAYNA3cjs.getChainName.call(void 0, "solana")
2304
+ ]
2305
+ }
2306
+ )
2307
+ ] }),
2308
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
2309
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Destination" }),
2310
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2311
+ "span",
2312
+ {
2313
+ className: "rs-card-value",
2314
+ style: { display: "flex", alignItems: "center", gap: 8 },
2315
+ children: [
2316
+ _chunkNELAYNA3cjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2317
+ "img",
2318
+ {
2319
+ src: _chunkNELAYNA3cjs.getChainIcon.call(void 0, targetChain),
2320
+ alt: "",
2321
+ style: { width: 16, height: 16, borderRadius: 3 }
2322
+ }
2323
+ ),
2324
+ _chunkNELAYNA3cjs.getChainName.call(void 0, targetChain)
2325
+ ]
2326
+ }
2327
+ )
2328
+ ] }),
2329
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
2330
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Estimated time" }),
2331
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value", children: "< 1 min" })
2332
+ ] })
2333
+ ] }),
2334
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card", children: [
2335
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
2336
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "You send" }),
2337
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2338
+ "span",
2339
+ {
2340
+ className: "rs-card-value",
2341
+ style: { display: "flex", alignItems: "center", gap: 6 },
2342
+ children: [
2343
+ _chunkNELAYNA3cjs.getTokenIcon.call(void 0, token.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2344
+ "img",
2345
+ {
2346
+ src: _chunkNELAYNA3cjs.getTokenIcon.call(void 0, token.symbol),
2347
+ alt: "",
2348
+ style: { width: 16, height: 16, borderRadius: "50%" }
2349
+ }
2350
+ ),
2351
+ formattedAmount,
2352
+ " ",
2353
+ token.symbol
2354
+ ]
2355
+ }
2356
+ )
2357
+ ] }),
2358
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
2359
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "You receive" }),
2360
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2361
+ "span",
2362
+ {
2363
+ className: "rs-card-value",
2364
+ style: { display: "flex", alignItems: "center", gap: 6 },
2365
+ children: [
2366
+ _chunkNELAYNA3cjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2367
+ "img",
2368
+ {
2369
+ src: _chunkNELAYNA3cjs.getTokenIcon.call(void 0, targetSymbol),
2370
+ alt: "",
2371
+ style: { width: 16, height: 16, borderRadius: "50%" }
2372
+ }
2373
+ ),
2374
+ isSameToken ? `~ ${formattedAmount} ${targetSymbol}` : `~ equivalent in ${targetSymbol}`
2375
+ ]
2376
+ }
2377
+ )
2378
+ ] })
2379
+ ] }),
2380
+ error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-alert rs-alert--error", children: [
2381
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2382
+ "svg",
2383
+ {
2384
+ className: "rs-alert-icon",
2385
+ viewBox: "0 0 24 24",
2386
+ fill: "none",
2387
+ stroke: "currentColor",
2388
+ strokeWidth: "2",
2389
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2390
+ "path",
2391
+ {
2392
+ strokeLinecap: "round",
2393
+ strokeLinejoin: "round",
2394
+ d: "M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"
2395
+ }
2396
+ )
2397
+ }
2398
+ ),
2399
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-alert-text", children: error })
2400
+ ] })
2401
+ ] }),
2402
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2403
+ _chunkLT3QKJI2cjs.Button,
2404
+ {
2405
+ onClick: handleConfirm,
2406
+ loading: isSubmitting,
2407
+ disabled: !amount || Number(amount) <= 0,
2408
+ fullWidth: true,
2409
+ children: "Confirm Order"
2410
+ }
2411
+ ) }),
2412
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLT3QKJI2cjs.PoweredBy, {})
2413
+ ] });
2414
+ }
2415
+
2416
+ // src/DepositFlow.tsx
2417
+
2418
+ function isSameRoute(sourceChain, sourceToken, targetChain, targetToken) {
2419
+ return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
2420
+ }
2421
+ function getAddressKey(address) {
2422
+ return address ? address.toLowerCase() : null;
2423
+ }
2424
+ function DepositFlow({
2425
+ dappWalletClient,
2426
+ dappPublicClient,
2427
+ dappAddress,
2428
+ targetChain,
2429
+ targetToken,
2430
+ service,
2431
+ sourceChain: defaultSourceChain,
2432
+ sourceToken: defaultSourceToken,
2433
+ amount: defaultAmount,
2434
+ recipient,
2435
+ signerAddress = _chunkNELAYNA3cjs.DEFAULT_SIGNER_ADDRESS,
2436
+ sessionChainIds,
2437
+ forceRegister = false,
2438
+ waitForFinalTx = true,
2439
+ reownWallet,
2440
+ onConnect,
2441
+ onDisconnect,
2442
+ onRequestConnect,
2443
+ connectButtonLabel,
2444
+ uiConfig,
2445
+ onStepChange,
2446
+ onTotalBalanceChange,
2447
+ onClose,
2448
+ onConnected,
2449
+ onDepositSubmitted,
2450
+ onDepositComplete,
2451
+ onDepositFailed,
2452
+ onError,
2453
+ debug
2454
+ }) {
2455
+ const [step, setStep] = _react.useState.call(void 0, { type: "setup" });
2456
+ const [flowMode, setFlowMode] = _react.useState.call(void 0, null);
2457
+ const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
2458
+ const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
2459
+ const [selectedWalletId, setSelectedWalletId] = _react.useState.call(void 0, null);
2460
+ const portfolioAssetsRef = _react.useRef.call(void 0, []);
2461
+ const stableWalletSignerRef = _react.useRef.call(void 0, null);
2462
+ const stableWalletSelectionKeyRef = _react.useRef.call(void 0, null);
2463
+ const logFlow = _react.useCallback.call(void 0,
2464
+ (message, data) => {
2465
+ _chunkLT3QKJI2cjs.debugLog.call(void 0, debug, "deposit-flow", message, data);
2466
+ },
2467
+ [debug]
2468
+ );
2469
+ const logFlowError = _react.useCallback.call(void 0,
2470
+ (message, error, data) => {
2471
+ _chunkLT3QKJI2cjs.debugError.call(void 0, debug, "deposit-flow", message, error, data);
2472
+ },
2473
+ [debug]
2474
+ );
2475
+ const handleAssetsLoaded = _react.useCallback.call(void 0, (assets) => {
2476
+ portfolioAssetsRef.current = assets;
2477
+ }, []);
2478
+ const getTokenPriceUsd = _react.useCallback.call(void 0, (symbol) => {
2479
+ const sym = symbol.toLowerCase();
2480
+ for (const asset of portfolioAssetsRef.current) {
2481
+ if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
2482
+ try {
2483
+ const balanceUnits = Number(asset.balance) / 10 ** asset.decimals;
2484
+ if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
2485
+ } catch (e18) {
2486
+ }
2487
+ }
2488
+ }
2489
+ return null;
2490
+ }, []);
2491
+ const dappSwitchChain = _react.useMemo.call(void 0, () => {
2492
+ if (!_optionalChain([dappWalletClient, 'optionalAccess', _36 => _36.switchChain])) return void 0;
2493
+ return async (chainId) => {
2494
+ await _optionalChain([dappWalletClient, 'access', _37 => _37.switchChain, 'optionalCall', _38 => _38({ id: chainId })]);
2495
+ };
2496
+ }, [dappWalletClient]);
2497
+ const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _39 => _39.account, 'optionalAccess', _40 => _40.address]), () => ( null));
2498
+ const walletOptions = _react.useMemo.call(void 0, () => {
2499
+ const options = [];
2500
+ const seen = /* @__PURE__ */ new Set();
2501
+ if (connectedWalletAddress && dappAddress) {
2502
+ const id = `evm:${connectedWalletAddress.toLowerCase()}`;
2503
+ options.push({
2504
+ id,
2505
+ address: connectedWalletAddress,
2506
+ label: "Connected Wallet",
2507
+ kind: "connected"
2508
+ });
2509
+ seen.add(id);
2510
+ }
2511
+ if (_optionalChain([reownWallet, 'optionalAccess', _41 => _41.isConnected]) && reownWallet.isSolana && reownWallet.solanaAddress && dappAddress) {
2512
+ const id = _nullishCoalesce(reownWallet.caipAddress, () => ( `solana:${reownWallet.solanaAddress}`));
2513
+ if (!seen.has(id)) {
2514
+ options.push({
2515
+ id,
2516
+ solanaAddress: reownWallet.solanaAddress,
2517
+ label: "Solana Wallet",
2518
+ kind: "solana",
2519
+ icon: reownWallet.icon
2520
+ });
2521
+ seen.add(id);
2522
+ }
2523
+ } else if (_optionalChain([reownWallet, 'optionalAccess', _42 => _42.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(`evm:${reownWallet.address.toLowerCase()}`)) {
2524
+ const id = `evm:${reownWallet.address.toLowerCase()}`;
2525
+ if (!seen.has(id)) {
2526
+ options.push({
2527
+ id,
2528
+ address: reownWallet.address,
2529
+ label: "External Wallet",
2530
+ kind: "external",
2531
+ icon: reownWallet.icon
2532
+ });
2533
+ seen.add(id);
2534
+ }
2535
+ }
2536
+ return options;
2537
+ }, [
2538
+ connectedWalletAddress,
2539
+ dappAddress,
2540
+ _optionalChain([reownWallet, 'optionalAccess', _43 => _43.address]),
2541
+ _optionalChain([reownWallet, 'optionalAccess', _44 => _44.isConnected]),
2542
+ _optionalChain([reownWallet, 'optionalAccess', _45 => _45.walletClient]),
2543
+ _optionalChain([reownWallet, 'optionalAccess', _46 => _46.publicClient]),
2544
+ _optionalChain([reownWallet, 'optionalAccess', _47 => _47.icon]),
2545
+ _optionalChain([reownWallet, 'optionalAccess', _48 => _48.isSolana]),
2546
+ _optionalChain([reownWallet, 'optionalAccess', _49 => _49.solanaAddress]),
2547
+ _optionalChain([reownWallet, 'optionalAccess', _50 => _50.caipAddress])
2548
+ ]);
2549
+ const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _51 => _51.account]) && dappAddress && !reownWallet;
2550
+ const hasWalletOptions = walletOptions.length > 0;
2551
+ const hasReownSession = Boolean(
2552
+ _optionalChain([reownWallet, 'optionalAccess', _52 => _52.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _53 => _53.address])
2553
+ );
2554
+ const showConnectStep = flowMode === null && !canAutoLock && !isConnectSelectionConfirmed;
2555
+ const walletSelectionKey = _react.useMemo.call(void 0, () => {
2556
+ if (flowMode !== "wallet") return null;
2557
+ if (canAutoLock) {
2558
+ return getAddressKey(connectedWalletAddress);
2559
+ }
2560
+ if (!isConnectSelectionConfirmed) return null;
2561
+ return selectedWalletId;
2562
+ }, [
2563
+ flowMode,
2564
+ canAutoLock,
2565
+ connectedWalletAddress,
2566
+ isConnectSelectionConfirmed,
2567
+ selectedWalletId
2568
+ ]);
2569
+ const walletSignerContext = _react.useMemo.call(void 0, () => {
2570
+ if (flowMode === "deposit-address") {
2571
+ return null;
2572
+ }
2573
+ if (flowMode === "solana-wallet") {
2574
+ if (!dappAddress) return null;
2575
+ return {
2576
+ ownerAddress: dappAddress,
2577
+ walletClient: void 0,
2578
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkLT3QKJI2cjs.getPublicClient.call(void 0, targetChain))),
2579
+ switchChain: void 0
2580
+ };
2581
+ }
2582
+ if (canAutoLock) {
2583
+ const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _54 => _54.chain, 'optionalAccess', _55 => _55.id]), () => ( targetChain));
2584
+ return {
2585
+ ownerAddress: dappWalletClient.account.address,
2586
+ walletClient: dappWalletClient,
2587
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkLT3QKJI2cjs.getPublicClient.call(void 0, fallbackChainId))),
2588
+ switchChain: dappSwitchChain
2589
+ };
2590
+ }
2591
+ if (!isConnectSelectionConfirmed || !selectedWalletId) return null;
2592
+ const selectedOption = walletOptions.find((option) => option.id === selectedWalletId);
2593
+ if (!selectedOption) return null;
2594
+ if (selectedOption.kind === "solana") {
2595
+ if (!dappAddress) return null;
2596
+ return {
2597
+ ownerAddress: dappAddress,
2598
+ walletClient: void 0,
2599
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkLT3QKJI2cjs.getPublicClient.call(void 0, targetChain))),
2600
+ switchChain: void 0
2601
+ };
2602
+ }
2603
+ if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess', _56 => _56.account]) && selectedOption.address && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
2604
+ const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _57 => _57.chain, 'optionalAccess', _58 => _58.id]), () => ( targetChain));
2605
+ return {
2606
+ ownerAddress: dappWalletClient.account.address,
2607
+ walletClient: dappWalletClient,
2608
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkLT3QKJI2cjs.getPublicClient.call(void 0, fallbackChainId))),
2609
+ switchChain: dappSwitchChain
2610
+ };
2611
+ }
2612
+ if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess', _59 => _59.address]) && selectedOption.address && reownWallet.address.toLowerCase() === selectedOption.address.toLowerCase()) {
2613
+ return {
2614
+ ownerAddress: reownWallet.address,
2615
+ walletClient: reownWallet.walletClient,
2616
+ publicClient: _nullishCoalesce(reownWallet.publicClient, () => ( _chunkLT3QKJI2cjs.getPublicClient.call(void 0, targetChain))),
2617
+ switchChain: reownWallet.switchChain
2618
+ };
2619
+ }
2620
+ return null;
2621
+ }, [
2622
+ canAutoLock,
2623
+ isConnectSelectionConfirmed,
2624
+ selectedWalletId,
2625
+ walletOptions,
2626
+ dappWalletClient,
2627
+ dappPublicClient,
2628
+ dappSwitchChain,
2629
+ dappAddress,
2630
+ reownWallet,
2631
+ targetChain
2632
+ ]);
2633
+ _react.useEffect.call(void 0, () => {
2634
+ if (flowMode !== "wallet") {
2635
+ stableWalletSelectionKeyRef.current = null;
2636
+ stableWalletSignerRef.current = null;
2637
+ return;
2638
+ }
2639
+ if (walletSelectionKey !== stableWalletSelectionKeyRef.current) {
2640
+ stableWalletSelectionKeyRef.current = walletSelectionKey;
2641
+ stableWalletSignerRef.current = null;
2642
+ }
1717
2643
  if (walletSignerContext && walletSelectionKey) {
1718
2644
  stableWalletSelectionKeyRef.current = walletSelectionKey;
1719
2645
  stableWalletSignerRef.current = walletSignerContext;
@@ -1725,7 +2651,7 @@ function DepositFlow({
1725
2651
  return {
1726
2652
  ownerAddress: dappAddress,
1727
2653
  walletClient: void 0,
1728
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkAHOFT42Hcjs.getPublicClient.call(void 0, targetChain))),
2654
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkLT3QKJI2cjs.getPublicClient.call(void 0, targetChain))),
1729
2655
  switchChain: void 0
1730
2656
  };
1731
2657
  }
@@ -1747,7 +2673,7 @@ function DepositFlow({
1747
2673
  walletSignerContext,
1748
2674
  walletSelectionKey
1749
2675
  ]);
1750
- const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _48 => _48.ownerAddress]))), () => ( null));
2676
+ const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _60 => _60.ownerAddress]))), () => ( null));
1751
2677
  const lastTargetRef = _react.useRef.call(void 0, null);
1752
2678
  _react.useEffect.call(void 0, () => {
1753
2679
  const prev = lastTargetRef.current;
@@ -1779,6 +2705,37 @@ function DepositFlow({
1779
2705
  setIsConnectSelectionConfirmed(false);
1780
2706
  }
1781
2707
  }, [hasWalletOptions, reownWallet]);
2708
+ const handleBackFromSolanaTokenSelect = _react.useCallback.call(void 0, () => {
2709
+ setFlowMode(null);
2710
+ setStep({ type: "setup" });
2711
+ if (hasWalletOptions || reownWallet) {
2712
+ hasNavigatedBackRef.current = true;
2713
+ setIsConnectSelectionConfirmed(false);
2714
+ }
2715
+ }, [hasWalletOptions, reownWallet]);
2716
+ const handleBackFromSolanaAmount = _react.useCallback.call(void 0, () => {
2717
+ setStep((prev) => {
2718
+ if (prev.type !== "solana-amount") return prev;
2719
+ return {
2720
+ type: "solana-token-select",
2721
+ smartAccount: prev.smartAccount,
2722
+ solanaDepositAddress: prev.solanaDepositAddress
2723
+ };
2724
+ });
2725
+ }, []);
2726
+ const handleBackFromSolanaConfirm = _react.useCallback.call(void 0, () => {
2727
+ setStep((prev) => {
2728
+ if (prev.type !== "solana-confirm") return prev;
2729
+ return {
2730
+ type: "solana-amount",
2731
+ smartAccount: prev.smartAccount,
2732
+ solanaDepositAddress: prev.solanaDepositAddress,
2733
+ token: prev.token,
2734
+ balance: prev.balance,
2735
+ balanceUsd: prev.balanceUsd
2736
+ };
2737
+ });
2738
+ }, []);
1782
2739
  const handleBackFromConfirm = _react.useCallback.call(void 0, () => {
1783
2740
  setStep((prev) => {
1784
2741
  if (prev.type !== "confirm") return prev;
@@ -1789,50 +2746,79 @@ function DepositFlow({
1789
2746
  };
1790
2747
  });
1791
2748
  }, []);
1792
- 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;
1793
- const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
2749
+ 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;
2750
+ 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;
1794
2751
  _react.useEffect.call(void 0, () => {
1795
- _optionalChain([onStepChange, 'optionalCall', _49 => _49(stepIndex, currentBackHandler)]);
2752
+ _optionalChain([onStepChange, 'optionalCall', _61 => _61(stepIndex, currentBackHandler)]);
1796
2753
  }, [stepIndex, currentBackHandler, onStepChange]);
1797
2754
  _react.useEffect.call(void 0, () => {
1798
- _optionalChain([onTotalBalanceChange, 'optionalCall', _50 => _50(totalBalanceUsd)]);
2755
+ logFlow("state:changed", {
2756
+ step: step.type,
2757
+ flowMode,
2758
+ targetChain,
2759
+ targetToken,
2760
+ selectedWalletId
2761
+ });
2762
+ }, [
2763
+ flowMode,
2764
+ logFlow,
2765
+ selectedWalletId,
2766
+ step.type,
2767
+ targetChain,
2768
+ targetToken
2769
+ ]);
2770
+ _react.useEffect.call(void 0, () => {
2771
+ _optionalChain([onTotalBalanceChange, 'optionalCall', _62 => _62(totalBalanceUsd)]);
1799
2772
  }, [totalBalanceUsd, onTotalBalanceChange]);
1800
2773
  const isDepositAddressMode = flowMode === "deposit-address";
2774
+ const isSolanaWalletMode = flowMode === "solana-wallet";
1801
2775
  const handleSelectProvider = _react.useCallback.call(void 0, () => {
1802
2776
  setFlowMode("wallet");
1803
2777
  }, []);
2778
+ const handleSelectSolanaWallet = _react.useCallback.call(void 0, () => {
2779
+ setFlowMode("solana-wallet");
2780
+ }, []);
1804
2781
  const handleSelectTransferCrypto = _react.useCallback.call(void 0, () => {
1805
2782
  setFlowMode("deposit-address");
1806
2783
  setStep({ type: "setup" });
1807
2784
  }, []);
1808
- const handleResetFlow = _react.useCallback.call(void 0, () => {
1809
- portfolioAssetsRef.current = [];
1810
- stableWalletSignerRef.current = null;
1811
- stableWalletSelectionKeyRef.current = null;
1812
- hasNavigatedBackRef.current = false;
1813
- setTotalBalanceUsd(0);
1814
- setSelectedConnectAddress(null);
1815
- setIsConnectSelectionConfirmed(false);
2785
+ const handleNewDeposit = _react.useCallback.call(void 0, () => {
1816
2786
  setFlowMode(null);
1817
2787
  setStep({ type: "setup" });
1818
2788
  }, []);
1819
- const handleNewDeposit = _react.useCallback.call(void 0, () => {
1820
- handleResetFlow();
1821
- }, [handleResetFlow]);
1822
2789
  const handleSetupComplete = _react.useCallback.call(void 0,
1823
- (smartAccount) => {
2790
+ (smartAccount, solanaDepositAddress) => {
2791
+ logFlow("setup:complete", {
2792
+ smartAccount,
2793
+ hasSolanaDepositAddress: Boolean(solanaDepositAddress),
2794
+ flowMode: isDepositAddressMode ? "deposit-address" : isSolanaWalletMode ? "solana-wallet" : "wallet"
2795
+ });
1824
2796
  if (isDepositAddressMode) {
1825
- setStep({ type: "deposit-address", smartAccount });
2797
+ setStep({ type: "deposit-address", smartAccount, solanaDepositAddress });
2798
+ } else if (isSolanaWalletMode) {
2799
+ if (solanaDepositAddress) {
2800
+ setStep({ type: "solana-token-select", smartAccount, solanaDepositAddress });
2801
+ } else {
2802
+ _optionalChain([onError, 'optionalCall', _63 => _63({ message: "Solana deposit address not available. Please try again.", code: "SOLANA_SETUP_FAILED" })]);
2803
+ }
1826
2804
  } else {
1827
2805
  setStep({ type: "select-asset", smartAccount });
1828
2806
  }
1829
2807
  },
1830
- [isDepositAddressMode]
2808
+ [isDepositAddressMode, isSolanaWalletMode, logFlow]
1831
2809
  );
1832
2810
  const handleDepositAddressDetected = _react.useCallback.call(void 0,
1833
- (txHash, chainId, amount, token) => {
2811
+ (txHash, chainId, amount, token, sourceSymbol, sourceDecimals) => {
2812
+ logFlow("deposit-address:detected", {
2813
+ txHash,
2814
+ sourceChain: chainId,
2815
+ sourceToken: token,
2816
+ amount
2817
+ });
1834
2818
  setStep((prev) => {
1835
2819
  if (prev.type !== "deposit-address") return prev;
2820
+ const isEvmToken = /^0x[a-fA-F0-9]{40}$/.test(token);
2821
+ const directTransfer = typeof chainId === "number" && isEvmToken && isSameRoute(chainId, token, targetChain, targetToken);
1836
2822
  return {
1837
2823
  type: "processing",
1838
2824
  smartAccount: prev.smartAccount,
@@ -1840,16 +2826,84 @@ function DepositFlow({
1840
2826
  sourceChain: chainId,
1841
2827
  sourceToken: token,
1842
2828
  amount,
1843
- directTransfer: isSameRoute(chainId, token, targetChain, targetToken)
2829
+ sourceSymbol,
2830
+ sourceDecimals,
2831
+ directTransfer
1844
2832
  };
1845
2833
  });
1846
- _optionalChain([onDepositSubmitted, 'optionalCall', _51 => _51({ txHash, sourceChain: chainId, amount })]);
2834
+ _optionalChain([onDepositSubmitted, 'optionalCall', _64 => _64({ txHash, sourceChain: chainId, amount })]);
1847
2835
  },
1848
2836
  [onDepositSubmitted, targetChain, targetToken]
1849
2837
  );
2838
+ const handleSolanaTokenContinue = _react.useCallback.call(void 0,
2839
+ (token, balance, balanceUsd) => {
2840
+ logFlow("solana:token:continue", { token: token.symbol });
2841
+ setStep((prev) => {
2842
+ if (prev.type !== "solana-token-select") return prev;
2843
+ return {
2844
+ type: "solana-amount",
2845
+ smartAccount: prev.smartAccount,
2846
+ solanaDepositAddress: prev.solanaDepositAddress,
2847
+ token,
2848
+ balance,
2849
+ balanceUsd
2850
+ };
2851
+ });
2852
+ },
2853
+ [logFlow]
2854
+ );
2855
+ const handleSolanaAmountContinue = _react.useCallback.call(void 0,
2856
+ (token, amount) => {
2857
+ logFlow("solana:amount:continue", {
2858
+ token: token.symbol,
2859
+ amount
2860
+ });
2861
+ setStep((prev) => {
2862
+ if (prev.type !== "solana-amount") return prev;
2863
+ return {
2864
+ type: "solana-confirm",
2865
+ smartAccount: prev.smartAccount,
2866
+ solanaDepositAddress: prev.solanaDepositAddress,
2867
+ token,
2868
+ amount,
2869
+ balance: prev.balance,
2870
+ balanceUsd: prev.balanceUsd
2871
+ };
2872
+ });
2873
+ },
2874
+ [logFlow]
2875
+ );
2876
+ const handleSolanaConfirmed = _react.useCallback.call(void 0,
2877
+ (txHash, amountUnits) => {
2878
+ setStep((prev) => {
2879
+ if (prev.type !== "solana-confirm") return prev;
2880
+ logFlow("solana:submitted", {
2881
+ txHash,
2882
+ amountUnits,
2883
+ token: prev.token.symbol
2884
+ });
2885
+ return {
2886
+ type: "processing",
2887
+ smartAccount: prev.smartAccount,
2888
+ txHash,
2889
+ sourceChain: "solana",
2890
+ sourceToken: prev.token.mint,
2891
+ amount: amountUnits,
2892
+ sourceSymbol: prev.token.symbol,
2893
+ sourceDecimals: prev.token.decimals
2894
+ };
2895
+ });
2896
+ _optionalChain([onDepositSubmitted, 'optionalCall', _65 => _65({
2897
+ txHash,
2898
+ sourceChain: "solana",
2899
+ amount: amountUnits
2900
+ })]);
2901
+ },
2902
+ [logFlow, onDepositSubmitted]
2903
+ );
1850
2904
  const handleConnected = _react.useCallback.call(void 0,
1851
2905
  (addr, smartAccount) => {
1852
- _optionalChain([onConnected, 'optionalCall', _52 => _52({ address: addr, smartAccount })]);
2906
+ _optionalChain([onConnected, 'optionalCall', _66 => _66({ address: addr, smartAccount })]);
1853
2907
  },
1854
2908
  [onConnected]
1855
2909
  );
@@ -1869,8 +2923,8 @@ function DepositFlow({
1869
2923
  );
1870
2924
  const handleAmountContinue = _react.useCallback.call(void 0,
1871
2925
  (amount, targetAmount, balance) => {
1872
- const targetSym = _chunkFLXTBFMZcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
1873
- const isTargetStable = _chunkFLXTBFMZcjs.isStablecoinSymbol.call(void 0, targetSym);
2926
+ const targetSym = _chunkNELAYNA3cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
2927
+ const isTargetStable = _chunkNELAYNA3cjs.isStablecoinSymbol.call(void 0, targetSym);
1874
2928
  const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
1875
2929
  setStep((prev) => {
1876
2930
  if (prev.type !== "amount") return prev;
@@ -1889,6 +2943,12 @@ function DepositFlow({
1889
2943
  );
1890
2944
  const handleDepositSubmitted = _react.useCallback.call(void 0,
1891
2945
  (txHash, chainId, amount, token) => {
2946
+ logFlow("evm:submitted", {
2947
+ txHash,
2948
+ sourceChain: chainId,
2949
+ sourceToken: token,
2950
+ amount
2951
+ });
1892
2952
  setStep((prev) => {
1893
2953
  if (prev.type !== "confirm") return prev;
1894
2954
  return {
@@ -1906,41 +2966,57 @@ function DepositFlow({
1906
2966
  );
1907
2967
  const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
1908
2968
  (txHash, sourceChain, amount) => {
1909
- _optionalChain([onDepositSubmitted, 'optionalCall', _53 => _53({ txHash, sourceChain, amount })]);
2969
+ _optionalChain([onDepositSubmitted, 'optionalCall', _67 => _67({ txHash, sourceChain, amount })]);
1910
2970
  },
1911
2971
  [onDepositSubmitted]
1912
2972
  );
1913
2973
  const handleDepositComplete = _react.useCallback.call(void 0,
1914
2974
  (txHash, destinationTxHash) => {
1915
- _optionalChain([onDepositComplete, 'optionalCall', _54 => _54({ txHash, destinationTxHash })]);
2975
+ logFlow("deposit:complete", { txHash, destinationTxHash });
2976
+ _optionalChain([onDepositComplete, 'optionalCall', _68 => _68({ txHash, destinationTxHash })]);
1916
2977
  },
1917
- [onDepositComplete]
2978
+ [logFlow, onDepositComplete]
1918
2979
  );
1919
2980
  const handleDepositFailed = _react.useCallback.call(void 0,
1920
2981
  (txHash, error) => {
1921
- _optionalChain([onDepositFailed, 'optionalCall', _55 => _55({ txHash, error })]);
2982
+ logFlowError("deposit:failed", error, { txHash });
2983
+ _optionalChain([onDepositFailed, 'optionalCall', _69 => _69({ txHash, error })]);
1922
2984
  },
1923
- [onDepositFailed]
2985
+ [logFlowError, onDepositFailed]
1924
2986
  );
1925
2987
  const handleError = _react.useCallback.call(void 0,
1926
2988
  (message, code) => {
1927
- _optionalChain([onError, 'optionalCall', _56 => _56({ message, code })]);
2989
+ logFlowError("flow:error", message, { code });
2990
+ _optionalChain([onError, 'optionalCall', _70 => _70({ message, code })]);
1928
2991
  },
1929
- [onError]
2992
+ [logFlowError, onError]
1930
2993
  );
1931
2994
  const handleTotalBalanceComputed = _react.useCallback.call(void 0, (total) => {
1932
2995
  setTotalBalanceUsd(total);
1933
2996
  }, []);
1934
- const selectedConnectAddressEffective = _react.useMemo.call(void 0, () => {
1935
- if (selectedConnectAddress) return selectedConnectAddress;
2997
+ const selectedWalletIdEffective = _react.useMemo.call(void 0, () => {
2998
+ if (selectedWalletId) return selectedWalletId;
1936
2999
  if (walletOptions.length === 1) {
1937
- return walletOptions[0].address;
3000
+ return walletOptions[0].id;
1938
3001
  }
1939
3002
  return null;
1940
- }, [selectedConnectAddress, walletOptions]);
3003
+ }, [selectedWalletId, walletOptions]);
3004
+ const walletOptionsKey = _react.useMemo.call(void 0,
3005
+ () => walletOptions.map((option) => option.id).join(","),
3006
+ [walletOptions]
3007
+ );
3008
+ const hasNavigatedBackRef = _react.useRef.call(void 0, false);
3009
+ _react.useEffect.call(void 0, () => {
3010
+ setIsConnectSelectionConfirmed(false);
3011
+ setSelectedWalletId(null);
3012
+ setFlowMode(null);
3013
+ if (step.type !== "processing" && step.type !== "confirm" && step.type !== "solana-confirm" && step.type !== "amount" && step.type !== "solana-amount") {
3014
+ setStep({ type: "setup" });
3015
+ }
3016
+ }, [walletOptionsKey]);
1941
3017
  _react.useEffect.call(void 0, () => {
1942
3018
  if (!showConnectStep && isConnectSelectionConfirmed && flowMode === "wallet" && !signerContext) {
1943
- setSelectedConnectAddress(null);
3019
+ setSelectedWalletId(null);
1944
3020
  setIsConnectSelectionConfirmed(false);
1945
3021
  setFlowMode(null);
1946
3022
  }
@@ -1950,10 +3026,15 @@ function DepositFlow({
1950
3026
  return;
1951
3027
  }
1952
3028
  if (hasWalletOptions) {
1953
- const address = selectedConnectAddressEffective;
1954
- if (address) {
1955
- setSelectedConnectAddress(address);
1956
- handleSelectProvider();
3029
+ const walletId = selectedWalletIdEffective;
3030
+ if (walletId) {
3031
+ const selectedOption = walletOptions.find((o) => o.id === walletId);
3032
+ setSelectedWalletId(walletId);
3033
+ if (_optionalChain([selectedOption, 'optionalAccess', _71 => _71.kind]) === "solana") {
3034
+ handleSelectSolanaWallet();
3035
+ } else {
3036
+ handleSelectProvider();
3037
+ }
1957
3038
  setIsConnectSelectionConfirmed(true);
1958
3039
  return;
1959
3040
  }
@@ -1967,18 +3048,20 @@ function DepositFlow({
1967
3048
  hasReownSession,
1968
3049
  isConnectSelectionConfirmed,
1969
3050
  flowMode,
1970
- selectedConnectAddressEffective,
3051
+ selectedWalletIdEffective,
1971
3052
  dappAddress,
3053
+ walletOptions,
1972
3054
  handleSelectProvider,
3055
+ handleSelectSolanaWallet,
1973
3056
  handleSelectTransferCrypto
1974
3057
  ]);
1975
3058
  if (showConnectStep) {
1976
3059
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1977
- _chunkAHOFT42Hcjs.ConnectStep,
3060
+ _chunkLT3QKJI2cjs.ConnectStep,
1978
3061
  {
1979
3062
  walletOptions,
1980
- selectedAddress: selectedConnectAddressEffective,
1981
- onSelectAddress: setSelectedConnectAddress,
3063
+ selectedWalletId: selectedWalletIdEffective,
3064
+ onSelectWallet: setSelectedWalletId,
1982
3065
  onSelectTransferCrypto: dappAddress ? () => {
1983
3066
  handleSelectTransferCrypto();
1984
3067
  setIsConnectSelectionConfirmed(true);
@@ -1987,10 +3070,17 @@ function DepositFlow({
1987
3070
  onConnect,
1988
3071
  onDisconnect,
1989
3072
  onContinue: () => {
1990
- if (selectedConnectAddressEffective) {
1991
- setSelectedConnectAddress(selectedConnectAddressEffective);
3073
+ if (selectedWalletIdEffective) {
3074
+ setSelectedWalletId(selectedWalletIdEffective);
3075
+ }
3076
+ const selectedOption = walletOptions.find(
3077
+ (o) => o.id === selectedWalletIdEffective
3078
+ );
3079
+ if (_optionalChain([selectedOption, 'optionalAccess', _72 => _72.kind]) === "solana") {
3080
+ handleSelectSolanaWallet();
3081
+ } else {
3082
+ handleSelectProvider();
1992
3083
  }
1993
- handleSelectProvider();
1994
3084
  setIsConnectSelectionConfirmed(true);
1995
3085
  },
1996
3086
  connectButtonLabel
@@ -2020,13 +3110,14 @@ function DepositFlow({
2020
3110
  DepositAddressStep,
2021
3111
  {
2022
3112
  smartAccount: step.smartAccount,
3113
+ solanaDepositAddress: step.solanaDepositAddress,
2023
3114
  service,
2024
3115
  onDepositDetected: handleDepositAddressDetected,
2025
3116
  onError: handleError
2026
3117
  }
2027
3118
  ),
2028
3119
  step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2029
- _chunkAHOFT42Hcjs.ProcessingStep,
3120
+ _chunkLT3QKJI2cjs.ProcessingStep,
2030
3121
  {
2031
3122
  smartAccount: step.smartAccount,
2032
3123
  txHash: step.txHash,
@@ -2034,6 +3125,8 @@ function DepositFlow({
2034
3125
  sourceToken: step.sourceToken,
2035
3126
  targetChain,
2036
3127
  amount: step.amount,
3128
+ sourceSymbol: step.sourceSymbol,
3129
+ sourceDecimals: step.sourceDecimals,
2037
3130
  waitForFinalTx,
2038
3131
  service,
2039
3132
  directTransfer: step.directTransfer,
@@ -2047,16 +3140,107 @@ function DepositFlow({
2047
3140
  )
2048
3141
  ] });
2049
3142
  }
2050
- if (!_optionalChain([signerContext, 'optionalAccess', _57 => _57.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _58 => _58.publicClient])) {
2051
- return null;
3143
+ if (isSolanaWalletMode) {
3144
+ if (!sessionKeyAddress) return null;
3145
+ const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _73 => _73.solanaAddress]);
3146
+ const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _74 => _74.solanaProvider]);
3147
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
3148
+ step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3149
+ SetupStep,
3150
+ {
3151
+ address: sessionKeyAddress,
3152
+ targetChain,
3153
+ targetToken,
3154
+ signerAddress,
3155
+ sessionChainIds,
3156
+ recipient,
3157
+ forceRegister,
3158
+ service,
3159
+ onSetupComplete: handleSetupComplete,
3160
+ onConnected: handleConnected,
3161
+ onError: handleError
3162
+ }
3163
+ ),
3164
+ step.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3165
+ SolanaTokenSelectStep,
3166
+ {
3167
+ solanaAddress: solanaAddr,
3168
+ service,
3169
+ onContinue: handleSolanaTokenContinue,
3170
+ onTotalBalanceComputed: handleTotalBalanceComputed,
3171
+ debug
3172
+ }
3173
+ ),
3174
+ step.type === "solana-amount" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3175
+ SolanaAmountStep,
3176
+ {
3177
+ token: step.token,
3178
+ balance: step.balance,
3179
+ balanceUsd: step.balanceUsd,
3180
+ onContinue: handleSolanaAmountContinue,
3181
+ debug
3182
+ }
3183
+ ),
3184
+ step.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3185
+ SolanaConfirmStep,
3186
+ {
3187
+ smartAccount: step.smartAccount,
3188
+ solanaAddress: solanaAddr,
3189
+ solanaDepositAddress: step.solanaDepositAddress,
3190
+ token: step.token,
3191
+ amount: step.amount,
3192
+ targetChain,
3193
+ targetToken,
3194
+ service,
3195
+ solanaProvider,
3196
+ onConfirm: handleSolanaConfirmed,
3197
+ onError: handleError,
3198
+ debug
3199
+ }
3200
+ ) : step.type === "solana-confirm" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
3201
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
3202
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z" }) }) }),
3203
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-text", children: [
3204
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
3205
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
3206
+ ] })
3207
+ ] }),
3208
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "rs-button rs-button--default rs-button--full-width", onClick: handleBackFromSolanaConfirm, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Go Back" }) }) })
3209
+ ] }) : null,
3210
+ step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3211
+ _chunkLT3QKJI2cjs.ProcessingStep,
3212
+ {
3213
+ smartAccount: step.smartAccount,
3214
+ txHash: step.txHash,
3215
+ sourceChain: step.sourceChain,
3216
+ sourceToken: step.sourceToken,
3217
+ targetChain,
3218
+ amount: step.amount,
3219
+ sourceSymbol: step.sourceSymbol,
3220
+ sourceDecimals: step.sourceDecimals,
3221
+ waitForFinalTx,
3222
+ service,
3223
+ directTransfer: step.directTransfer,
3224
+ onClose,
3225
+ onNewDeposit: handleNewDeposit,
3226
+ onDepositComplete: handleDepositComplete,
3227
+ onDepositFailed: handleDepositFailed,
3228
+ onError: handleError,
3229
+ debug
3230
+ }
3231
+ )
3232
+ ] });
3233
+ }
3234
+ if (!_optionalChain([signerContext, 'optionalAccess', _75 => _75.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _76 => _76.publicClient])) {
3235
+ 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..." }) }) }) }) });
2052
3236
  }
2053
3237
  const ownerAddress = signerContext.ownerAddress;
2054
- const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _59 => _59.walletClient, 'optionalAccess', _60 => _60.chain, 'optionalAccess', _61 => _61.id]), () => ( _optionalChain([signerContext, 'access', _62 => _62.publicClient, 'access', _63 => _63.chain, 'optionalAccess', _64 => _64.id]))), () => ( targetChain));
3238
+ const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _77 => _77.walletClient, 'optionalAccess', _78 => _78.chain, 'optionalAccess', _79 => _79.id]), () => ( _optionalChain([signerContext, 'access', _80 => _80.publicClient, 'access', _81 => _81.chain, 'optionalAccess', _82 => _82.id]))), () => ( targetChain));
2055
3239
  const getReadClientForChain = (chainId) => {
2056
- if (_optionalChain([signerContext, 'access', _65 => _65.publicClient, 'access', _66 => _66.chain, 'optionalAccess', _67 => _67.id]) === chainId) {
3240
+ if (_optionalChain([signerContext, 'access', _83 => _83.publicClient, 'access', _84 => _84.chain, 'optionalAccess', _85 => _85.id]) === chainId) {
2057
3241
  return signerContext.publicClient;
2058
3242
  }
2059
- return _chunkAHOFT42Hcjs.getPublicClient.call(void 0, chainId);
3243
+ return _chunkLT3QKJI2cjs.getPublicClient.call(void 0, chainId);
2060
3244
  };
2061
3245
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
2062
3246
  step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -2125,7 +3309,7 @@ function DepositFlow({
2125
3309
  }
2126
3310
  ),
2127
3311
  step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2128
- _chunkAHOFT42Hcjs.ProcessingStep,
3312
+ _chunkLT3QKJI2cjs.ProcessingStep,
2129
3313
  {
2130
3314
  smartAccount: step.smartAccount,
2131
3315
  txHash: step.txHash,
@@ -2133,6 +3317,8 @@ function DepositFlow({
2133
3317
  sourceToken: step.sourceToken,
2134
3318
  targetChain,
2135
3319
  amount: step.amount,
3320
+ sourceSymbol: step.sourceSymbol,
3321
+ sourceDecimals: step.sourceDecimals,
2136
3322
  waitForFinalTx,
2137
3323
  service,
2138
3324
  directTransfer: step.directTransfer,
@@ -2140,7 +3326,8 @@ function DepositFlow({
2140
3326
  onNewDeposit: handleNewDeposit,
2141
3327
  onDepositComplete: handleDepositComplete,
2142
3328
  onDepositFailed: handleDepositFailed,
2143
- onError: handleError
3329
+ onError: handleError,
3330
+ debug
2144
3331
  }
2145
3332
  )
2146
3333
  ] });
@@ -2149,7 +3336,7 @@ function DepositFlow({
2149
3336
  // src/DepositModal.tsx
2150
3337
 
2151
3338
  var ReownDepositInner = _react.lazy.call(void 0,
2152
- () => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-ZZKRN6J3.cjs"))).then((m) => ({ default: m.DepositModalReown }))
3339
+ () => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-GAQLILGK.cjs"))).then((m) => ({ default: m.DepositModalReown }))
2153
3340
  );
2154
3341
  function DepositModal(props) {
2155
3342
  const needsReown = !!props.reownAppId;
@@ -2172,8 +3359,8 @@ function DepositModalInner({
2172
3359
  sourceToken,
2173
3360
  defaultAmount,
2174
3361
  recipient,
2175
- backendUrl = _chunkFLXTBFMZcjs.DEFAULT_BACKEND_URL,
2176
- signerAddress = _chunkFLXTBFMZcjs.DEFAULT_SIGNER_ADDRESS,
3362
+ backendUrl = _chunkNELAYNA3cjs.DEFAULT_BACKEND_URL,
3363
+ signerAddress = _chunkNELAYNA3cjs.DEFAULT_SIGNER_ADDRESS,
2177
3364
  sessionChainIds,
2178
3365
  forceRegister = false,
2179
3366
  waitForFinalTx = true,
@@ -2198,27 +3385,27 @@ function DepositModalInner({
2198
3385
  const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
2199
3386
  const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
2200
3387
  const backHandlerRef = _react.useRef.call(void 0, void 0);
2201
- const targetChain = _chunkFLXTBFMZcjs.getChainId.call(void 0, targetChainProp);
2202
- const sourceChain = sourceChainProp ? _chunkFLXTBFMZcjs.getChainId.call(void 0, sourceChainProp) : void 0;
2203
- const service = _react.useMemo.call(void 0, () => _chunkAHOFT42Hcjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
3388
+ const targetChain = _chunkNELAYNA3cjs.getChainId.call(void 0, targetChainProp);
3389
+ const sourceChain = sourceChainProp ? _chunkNELAYNA3cjs.getChainId.call(void 0, sourceChainProp) : void 0;
3390
+ const service = _react.useMemo.call(void 0,
3391
+ () => _chunkLT3QKJI2cjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:deposit" }),
3392
+ [backendUrl, debug]
3393
+ );
2204
3394
  _react.useEffect.call(void 0, () => {
2205
3395
  if (isOpen && modalRef.current) {
2206
- _chunkAHOFT42Hcjs.applyTheme.call(void 0, modalRef.current, theme);
3396
+ _chunkLT3QKJI2cjs.applyTheme.call(void 0, modalRef.current, theme);
2207
3397
  }
2208
3398
  }, [isOpen, theme]);
2209
3399
  const hasCalledReady = _react.useRef.call(void 0, false);
2210
3400
  _react.useEffect.call(void 0, () => {
2211
3401
  if (isOpen && !hasCalledReady.current) {
2212
3402
  hasCalledReady.current = true;
2213
- _optionalChain([onReady, 'optionalCall', _68 => _68()]);
3403
+ _optionalChain([onReady, 'optionalCall', _86 => _86()]);
2214
3404
  }
2215
3405
  }, [isOpen, onReady]);
2216
3406
  _react.useEffect.call(void 0, () => {
2217
3407
  if (!isOpen) {
2218
3408
  setCurrentStepIndex(0);
2219
- setTotalBalanceUsd(null);
2220
- backHandlerRef.current = void 0;
2221
- hasCalledReady.current = false;
2222
3409
  }
2223
3410
  }, [isOpen]);
2224
3411
  const handleStepChange = _react.useCallback.call(void 0,
@@ -2232,17 +3419,17 @@ function DepositModalInner({
2232
3419
  setTotalBalanceUsd(balance2);
2233
3420
  }, []);
2234
3421
  const handleBack = _react.useCallback.call(void 0, () => {
2235
- _optionalChain([backHandlerRef, 'access', _69 => _69.current, 'optionalCall', _70 => _70()]);
3422
+ _optionalChain([backHandlerRef, 'access', _87 => _87.current, 'optionalCall', _88 => _88()]);
2236
3423
  }, []);
2237
- const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _71 => _71.showLogo]), () => ( false));
2238
- const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _72 => _72.showStepper]), () => ( false));
2239
- const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _73 => _73.showBackButton]), () => ( true));
2240
- const balance = _optionalChain([uiConfig, 'optionalAccess', _74 => _74.balance]);
2241
- const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _75 => _75.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
2242
- const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _76 => _76.title]), () => ( "Deposit"));
3424
+ const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _89 => _89.showLogo]), () => ( false));
3425
+ const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _90 => _90.showStepper]), () => ( false));
3426
+ const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _91 => _91.showBackButton]), () => ( true));
3427
+ const balance = _optionalChain([uiConfig, 'optionalAccess', _92 => _92.balance]);
3428
+ const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _93 => _93.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
3429
+ const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _94 => _94.title]), () => ( "Deposit"));
2243
3430
  const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
2244
3431
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2245
- _chunkAHOFT42Hcjs.Modal,
3432
+ _chunkLT3QKJI2cjs.Modal,
2246
3433
  {
2247
3434
  isOpen,
2248
3435
  onClose,
@@ -2303,7 +3490,7 @@ function DepositModalInner({
2303
3490
  balance.title,
2304
3491
  ":"
2305
3492
  ] }),
2306
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkAHOFT42Hcjs.currencyFormatter.format(totalBalanceUsd) : null))) })
3493
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkLT3QKJI2cjs.currencyFormatter.format(totalBalanceUsd) : null))) })
2307
3494
  ] })
2308
3495
  ] }),
2309
3496
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,