@rhinestone/deposit-modal 0.3.0-alpha.2 → 0.3.0-alpha.4

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.
@@ -45,7 +45,10 @@
45
45
 
46
46
 
47
47
 
48
- var _chunkFTMCKJM4cjs = require('./chunk-FTMCKJM4.cjs');
48
+
49
+
50
+
51
+ var _chunkV6NJIPSScjs = require('./chunk-V6NJIPSS.cjs');
49
52
 
50
53
 
51
54
 
@@ -81,198 +84,10 @@ var _react = require('react');
81
84
 
82
85
  var _viem = require('viem');
83
86
 
84
- // src/components/steps/SetupStep.tsx
85
-
86
- var _jsxruntime = require('react/jsx-runtime');
87
- async function resolveSessionOwner(eoaAddress) {
88
- const localOwner = _chunkFTMCKJM4cjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
89
- if (localOwner) {
90
- return {
91
- account: _chunkFTMCKJM4cjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
92
- address: localOwner.address
93
- };
94
- }
95
- const created = _chunkFTMCKJM4cjs.createSessionOwnerKey.call(void 0, );
96
- _chunkFTMCKJM4cjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
97
- return {
98
- account: created.account,
99
- address: created.address
100
- };
101
- }
102
- function SetupStep({
103
- walletClient,
104
- address,
105
- targetChain,
106
- targetToken,
107
- signerAddress,
108
- sessionChainIds,
109
- recipient,
110
- postBridgeActions,
111
- outputTokenRules,
112
- rejectUnmapped,
113
- forceRegister,
114
- enableSolana = true,
115
- service,
116
- onSetupComplete,
117
- onError,
118
- onConnected
119
- }) {
120
- const [state, setState] = _react.useState.call(void 0, { type: "idle" });
121
- const setupInitiatedRef = _react.useRef.call(void 0, false);
122
- const runSetup = _react.useCallback.call(void 0, async () => {
123
- if (!address) {
124
- return;
125
- }
126
- if (walletClient && !walletClient.account) {
127
- return;
128
- }
129
- try {
130
- setState({ type: "creating-account" });
131
- const sessionOwner = await resolveSessionOwner(address);
132
- const setup = await service.setupAccount({
133
- ownerAddress: address,
134
- sessionOwnerAddress: sessionOwner.address,
135
- targetChain: _chunkFTMCKJM4cjs.toEvmCaip2.call(void 0, targetChain),
136
- targetToken,
137
- recipient,
138
- postBridgeActions,
139
- outputTokenRules,
140
- rejectUnmapped,
141
- signerAddress,
142
- sessionChainIds,
143
- forceRegister
144
- });
145
- const smartAccount = setup.smartAccount;
146
- if (!setup.needsRegistration) {
147
- setState({ type: "ready", smartAccount });
148
- _optionalChain([onConnected, 'optionalCall', _ => _(address, smartAccount)]);
149
- onSetupComplete(
150
- smartAccount,
151
- enableSolana ? setup.solanaDepositAddress : void 0
152
- );
153
- return;
154
- }
155
- setState({ type: "signing-session" });
156
- if (!setup.accountParams || !setup.sessionDetailsUnsigned) {
157
- throw new Error("Missing registration payload from setup-account");
158
- }
159
- if (!sessionOwner.account.signTypedData) {
160
- throw new Error("Session owner account does not support signTypedData");
161
- }
162
- const typedData = setup.sessionDetailsUnsigned.data;
163
- const signature = await sessionOwner.account.signTypedData({
164
- domain: typedData.domain,
165
- types: typedData.types,
166
- primaryType: typedData.primaryType,
167
- message: typedData.message
168
- });
169
- const sessionDetails = _chunkFTMCKJM4cjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
170
- setState({ type: "registering" });
171
- const registerResult = await service.registerAccount({
172
- address: smartAccount,
173
- accountParams: {
174
- factory: setup.accountParams.factory,
175
- factoryData: setup.accountParams.factoryData,
176
- sessionDetails
177
- },
178
- eoaAddress: address,
179
- sessionOwner: sessionOwner.address,
180
- target: {
181
- chain: _chunkFTMCKJM4cjs.toEvmCaip2.call(void 0, targetChain),
182
- token: targetToken,
183
- ...recipient && { recipient },
184
- ..._optionalChain([postBridgeActions, 'optionalAccess', _2 => _2.length]) && { postBridgeActions },
185
- ..._optionalChain([outputTokenRules, 'optionalAccess', _3 => _3.length]) && { outputTokenRules },
186
- ...rejectUnmapped != null && { rejectUnmapped }
187
- }
188
- });
189
- setState({ type: "ready", smartAccount });
190
- _optionalChain([onConnected, 'optionalCall', _4 => _4(address, smartAccount)]);
191
- onSetupComplete(
192
- smartAccount,
193
- enableSolana ? registerResult.solanaDepositAddress : void 0
194
- );
195
- } catch (error) {
196
- const message = error instanceof Error ? error.message : "Setup failed";
197
- setState({ type: "error", message });
198
- _optionalChain([onError, 'optionalCall', _5 => _5(message, "SETUP_ERROR")]);
199
- }
200
- }, [
201
- address,
202
- walletClient,
203
- targetChain,
204
- targetToken,
205
- signerAddress,
206
- sessionChainIds,
207
- recipient,
208
- postBridgeActions,
209
- outputTokenRules,
210
- rejectUnmapped,
211
- forceRegister,
212
- enableSolana,
213
- service,
214
- onSetupComplete,
215
- onError,
216
- onConnected
217
- ]);
218
- _react.useEffect.call(void 0, () => {
219
- const hasWallet = walletClient ? Boolean(walletClient.account) : true;
220
- if (address && hasWallet && !setupInitiatedRef.current && state.type === "idle") {
221
- setupInitiatedRef.current = true;
222
- runSetup();
223
- }
224
- }, [address, walletClient, state.type, runSetup]);
225
- const handleRetry = () => {
226
- setupInitiatedRef.current = false;
227
- setState({ type: "idle" });
228
- };
229
- const renderStateMessage = () => {
230
- switch (state.type) {
231
- case "idle":
232
- return "Preparing...";
233
- case "creating-account":
234
- return "Preparing your deposit account...";
235
- case "signing-session":
236
- return "Authorizing your deposit session...";
237
- case "registering":
238
- return "Finalizing setup...";
239
- case "ready":
240
- return "Account ready!";
241
- case "error":
242
- return state.message;
243
- }
244
- };
245
- const isLoading = state.type === "idle" || state.type === "creating-account" || state.type === "signing-session" || state.type === "registering";
246
- const isError = state.type === "error";
247
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
248
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
249
- isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
250
- _chunkFTMCKJM4cjs.BodyHeader,
251
- {
252
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.Spinner, { className: "rs-spinner--sm" }),
253
- title: renderStateMessage(),
254
- subtitle: "This may take a moment"
255
- }
256
- ),
257
- isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
258
- _chunkFTMCKJM4cjs.BodyHeader,
259
- {
260
- variant: "error",
261
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.AlertTriangleIcon, {}),
262
- title: "Setup failed",
263
- subtitle: state.message
264
- }
265
- )
266
- ] }),
267
- isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) }),
268
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.PoweredBy, {})
269
- ] });
270
- }
271
-
272
87
  // src/components/steps/AssetSelectStep.tsx
273
88
 
274
89
 
275
-
90
+ var _jsxruntime = require('react/jsx-runtime');
276
91
  function AssetSelectStep({
277
92
  address,
278
93
  publicClient,
@@ -291,7 +106,7 @@ function AssetSelectStep({
291
106
  const [error, setError] = _react.useState.call(void 0, null);
292
107
  const defaultAssetId = _react.useMemo.call(void 0, () => {
293
108
  if (!defaultSourceChain || !defaultSourceToken) return null;
294
- return _chunkFTMCKJM4cjs.getAssetId.call(void 0, {
109
+ return _chunkV6NJIPSScjs.getAssetId.call(void 0, {
295
110
  chainId: defaultSourceChain,
296
111
  token: defaultSourceToken
297
112
  });
@@ -308,7 +123,7 @@ function AssetSelectStep({
308
123
  try {
309
124
  const portfolio = await service.fetchPortfolio(address);
310
125
  if (!active) return;
311
- const portfolioAssets = _chunkFTMCKJM4cjs.portfolioToAssets.call(void 0, portfolio.tokens);
126
+ const portfolioAssets = _chunkV6NJIPSScjs.portfolioToAssets.call(void 0, portfolio.tokens);
312
127
  setAssets(portfolioAssets);
313
128
  const hasNative = portfolioAssets.some(
314
129
  (asset) => asset.token.toLowerCase() === _chunkIVTXEYB2cjs.NATIVE_TOKEN_ADDRESS
@@ -349,16 +164,16 @@ function AssetSelectStep({
349
164
  (sum, asset) => sum + (_nullishCoalesce(asset.balanceUsd, () => ( 0))),
350
165
  0
351
166
  );
352
- _optionalChain([onTotalBalanceComputed, 'optionalCall', _6 => _6(total)]);
353
- if (assets.length > 0) _optionalChain([onAssetsLoaded, 'optionalCall', _7 => _7(assets)]);
167
+ _optionalChain([onTotalBalanceComputed, 'optionalCall', _ => _(total)]);
168
+ if (assets.length > 0) _optionalChain([onAssetsLoaded, 'optionalCall', _2 => _2(assets)]);
354
169
  }, [assets, onTotalBalanceComputed, onAssetsLoaded]);
355
170
  const allowedChainSet = _react.useMemo.call(void 0,
356
- () => _optionalChain([allowedRoutes, 'optionalAccess', _8 => _8.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
357
- [_optionalChain([allowedRoutes, 'optionalAccess', _9 => _9.sourceChains])]
171
+ () => _optionalChain([allowedRoutes, 'optionalAccess', _3 => _3.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
172
+ [_optionalChain([allowedRoutes, 'optionalAccess', _4 => _4.sourceChains])]
358
173
  );
359
174
  const allowedTokenSet = _react.useMemo.call(void 0,
360
- () => _optionalChain([allowedRoutes, 'optionalAccess', _10 => _10.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
361
- [_optionalChain([allowedRoutes, 'optionalAccess', _11 => _11.sourceTokens])]
175
+ () => _optionalChain([allowedRoutes, 'optionalAccess', _5 => _5.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
176
+ [_optionalChain([allowedRoutes, 'optionalAccess', _6 => _6.sourceTokens])]
362
177
  );
363
178
  const rows = _react.useMemo.call(void 0, () => {
364
179
  return assets.filter((a) => {
@@ -389,7 +204,7 @@ function AssetSelectStep({
389
204
  const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
390
205
  const numeric = Number(raw);
391
206
  if (!Number.isFinite(numeric)) return raw;
392
- return _chunkFTMCKJM4cjs.tokenFormatter.format(numeric);
207
+ return _chunkV6NJIPSScjs.tokenFormatter.format(numeric);
393
208
  } catch (e3) {
394
209
  return asset.balance;
395
210
  }
@@ -397,20 +212,20 @@ function AssetSelectStep({
397
212
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
398
213
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
399
214
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
400
- _chunkFTMCKJM4cjs.BodyHeader,
215
+ _chunkV6NJIPSScjs.BodyHeader,
401
216
  {
402
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.WalletIcon, {}),
217
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.WalletIcon, {}),
403
218
  title: "Your assets",
404
219
  subtitle: "Select source assets to transfer"
405
220
  }
406
221
  ),
407
222
  loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
408
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.Spinner, { className: "rs-text-tertiary" }),
223
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.Spinner, { className: "rs-text-tertiary" }),
409
224
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
410
225
  ] }),
411
226
  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 }) }),
412
227
  !loading && !error && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
413
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.WalletIcon, { className: "rs-empty-icon" }),
228
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.WalletIcon, { className: "rs-empty-icon" }),
414
229
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
415
230
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-address", children: [
416
231
  address.slice(0, 6),
@@ -477,14 +292,14 @@ function AssetSelectStep({
477
292
  ] })
478
293
  ] })
479
294
  ] }),
480
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkFTMCKJM4cjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
295
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkV6NJIPSScjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
481
296
  ]
482
297
  },
483
298
  asset.id
484
299
  );
485
300
  }) }),
486
301
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
487
- _chunkFTMCKJM4cjs.Button,
302
+ _chunkV6NJIPSScjs.Button,
488
303
  {
489
304
  onClick: () => selectedAsset && onContinue(selectedAsset),
490
305
  disabled: !selectedAsset,
@@ -493,15 +308,15 @@ function AssetSelectStep({
493
308
  }
494
309
  )
495
310
  ] }),
496
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.PoweredBy, {})
311
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
497
312
  ] });
498
313
  }
499
314
  async function fetchNativeAssets(address, publicClient, existing) {
500
315
  const existingIds = new Set(existing.map((asset) => asset.id));
501
- const connectedChainId = _optionalChain([publicClient, 'access', _12 => _12.chain, 'optionalAccess', _13 => _13.id]);
316
+ const connectedChainId = _optionalChain([publicClient, 'access', _7 => _7.chain, 'optionalAccess', _8 => _8.id]);
502
317
  if (!connectedChainId) return [];
503
318
  if (!_chunkIVTXEYB2cjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
504
- const id = _chunkFTMCKJM4cjs.getAssetId.call(void 0, {
319
+ const id = _chunkV6NJIPSScjs.getAssetId.call(void 0, {
505
320
  chainId: connectedChainId,
506
321
  token: _chunkIVTXEYB2cjs.NATIVE_TOKEN_ADDRESS
507
322
  });
@@ -559,6 +374,7 @@ function AmountStep({
559
374
  address,
560
375
  balanceAddress,
561
376
  asset,
377
+ liquiditySource,
562
378
  defaultAmount,
563
379
  switchChain,
564
380
  targetChain,
@@ -577,7 +393,7 @@ function AmountStep({
577
393
  const [isCheckingLiquidity, setIsCheckingLiquidity] = _react.useState.call(void 0, false);
578
394
  const hasAttemptedSwitch = _react.useRef.call(void 0, false);
579
395
  const chainMismatch = Boolean(
580
- _optionalChain([walletClient, 'optionalAccess', _14 => _14.chain, 'optionalAccess', _15 => _15.id]) && walletClient.chain.id !== asset.chainId
396
+ _optionalChain([walletClient, 'optionalAccess', _9 => _9.chain, 'optionalAccess', _10 => _10.id]) && walletClient.chain.id !== asset.chainId
581
397
  );
582
398
  const targetSymbol = _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
583
399
  const isSourceStablecoin = _chunkIVTXEYB2cjs.isStablecoinSymbol.call(void 0, asset.symbol);
@@ -604,7 +420,7 @@ function AmountStep({
604
420
  const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
605
421
  if (!balanceTarget || !publicClient) return;
606
422
  try {
607
- const bal = _chunkFTMCKJM4cjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
423
+ const bal = _chunkV6NJIPSScjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
608
424
  address: asset.token,
609
425
  abi: _viem.erc20Abi,
610
426
  functionName: "balanceOf",
@@ -625,7 +441,7 @@ function AmountStep({
625
441
  hasAttemptedSwitch.current = true;
626
442
  switchChain(asset.chainId).catch((err) => {
627
443
  const raw = err instanceof Error ? err.message : "Failed to switch chain";
628
- setError(_chunkFTMCKJM4cjs.formatUserError.call(void 0, raw));
444
+ setError(_chunkV6NJIPSScjs.formatUserError.call(void 0, raw));
629
445
  });
630
446
  }
631
447
  }, [chainMismatch, switchChain, asset.chainId]);
@@ -651,7 +467,7 @@ function AmountStep({
651
467
  }
652
468
  }, [balance, tokenPriceUsd, asset.decimals]);
653
469
  _react.useEffect.call(void 0, () => {
654
- _optionalChain([onBalanceUsdChange, 'optionalCall', _16 => _16(_nullishCoalesce(balanceUsd, () => ( 0)))]);
470
+ _optionalChain([onBalanceUsdChange, 'optionalCall', _11 => _11(_nullishCoalesce(balanceUsd, () => ( 0)))]);
655
471
  }, [balanceUsd, onBalanceUsdChange]);
656
472
  const formattedBalance = _react.useMemo.call(void 0, () => {
657
473
  if (balance === null) return "\u2026";
@@ -659,7 +475,7 @@ function AmountStep({
659
475
  const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
660
476
  const numeric = Number(raw);
661
477
  if (!Number.isFinite(numeric)) return raw;
662
- return _chunkFTMCKJM4cjs.tokenFormatter.format(numeric);
478
+ return _chunkV6NJIPSScjs.tokenFormatter.format(numeric);
663
479
  } catch (e8) {
664
480
  return "\u2026";
665
481
  }
@@ -678,8 +494,8 @@ function AmountStep({
678
494
  return null;
679
495
  }
680
496
  }, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, asset.decimals]);
681
- const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _17 => _17.minDepositUsd]), () => ( null));
682
- const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _18 => _18.maxDepositUsd]), () => ( null));
497
+ const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _12 => _12.minDepositUsd]), () => ( null));
498
+ const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _13 => _13.maxDepositUsd]), () => ( null));
683
499
  const isBelowMin = minDepositUsd !== null && numericAmount > 0 && amountUsd < minDepositUsd;
684
500
  const isAboveMax = maxDepositUsd !== null && amountUsd > maxDepositUsd;
685
501
  const exceedsBalance = Boolean(
@@ -688,7 +504,7 @@ function AmountStep({
688
504
  const balanceAfterUsd = targetBalanceUsd !== void 0 ? targetBalanceUsd + numericAmount : null;
689
505
  const handlePresetClick = (percentage) => {
690
506
  if (balance === null) return;
691
- _optionalChain([onCtaClick, 'optionalCall', _19 => _19(percentage === 100 ? "Max" : `${percentage}%`)]);
507
+ _optionalChain([onCtaClick, 'optionalCall', _14 => _14(percentage === 100 ? "Max" : `${percentage}%`)]);
692
508
  const next = formatAmountFromBalance(
693
509
  balance,
694
510
  asset.decimals,
@@ -735,13 +551,13 @@ function AmountStep({
735
551
  return;
736
552
  }
737
553
  setError(null);
738
- _optionalChain([onCtaClick, 'optionalCall', _20 => _20("continue")]);
554
+ _optionalChain([onCtaClick, 'optionalCall', _15 => _15("continue")]);
739
555
  setIsCheckingLiquidity(true);
740
556
  let liquidityWarning;
741
557
  try {
742
558
  const liquidity = await service.checkLiquidity({
743
- sourceChainId: asset.chainId,
744
- sourceToken: asset.token,
559
+ sourceChainId: _nullishCoalesce(_optionalChain([liquiditySource, 'optionalAccess', _16 => _16.chainId]), () => ( asset.chainId)),
560
+ sourceToken: _nullishCoalesce(_optionalChain([liquiditySource, 'optionalAccess', _17 => _17.token]), () => ( asset.token)),
745
561
  destinationChainId: targetChain,
746
562
  destinationToken: targetToken,
747
563
  amount: amountInUnits.toString()
@@ -778,7 +594,7 @@ function AmountStep({
778
594
  const targetTokenIcon = _chunkIVTXEYB2cjs.getTokenIcon.call(void 0, targetSymbol);
779
595
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
780
596
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
781
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.WalletIcon, {}), title: "Wallet deposit" }),
597
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.WalletIcon, {}), title: "Wallet deposit" }),
782
598
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-section", children: [
783
599
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
784
600
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-input-row", children: [
@@ -804,13 +620,13 @@ function AmountStep({
804
620
  " available",
805
621
  balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
806
622
  " (~",
807
- _chunkFTMCKJM4cjs.currencyFormatter.format(balanceUsd),
623
+ _chunkV6NJIPSScjs.currencyFormatter.format(balanceUsd),
808
624
  ")"
809
625
  ] })
810
626
  ] }),
811
627
  minDepositUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-meta-minimum", children: [
812
628
  "Min. deposit ",
813
- _chunkFTMCKJM4cjs.currencyFormatter.format(minDepositUsd)
629
+ _chunkV6NJIPSScjs.currencyFormatter.format(minDepositUsd)
814
630
  ] })
815
631
  ] })
816
632
  ] }),
@@ -851,15 +667,15 @@ function AmountStep({
851
667
  ] }),
852
668
  balanceAfterUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
853
669
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Balance after deposit" }),
854
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children: _chunkFTMCKJM4cjs.currencyFormatter.format(balanceAfterUsd) })
670
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children: _chunkV6NJIPSScjs.currencyFormatter.format(balanceAfterUsd) })
855
671
  ] })
856
672
  ] }),
857
673
  error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", role: "alert", children: [
858
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
674
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
859
675
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: error })
860
676
  ] }),
861
677
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
862
- _chunkFTMCKJM4cjs.Button,
678
+ _chunkV6NJIPSScjs.Button,
863
679
  {
864
680
  onClick: handleContinue,
865
681
  fullWidth: true,
@@ -868,7 +684,7 @@ function AmountStep({
868
684
  }
869
685
  )
870
686
  ] }),
871
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.PoweredBy, {})
687
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
872
688
  ] });
873
689
  }
874
690
 
@@ -876,6 +692,13 @@ function AmountStep({
876
692
 
877
693
 
878
694
 
695
+ // src/core/dapp-imports/types.ts
696
+ function isDappImportAsset(asset) {
697
+ return typeof asset.source === "string" && typeof asset.sourceLabel === "string" && "providerMetadata" in asset;
698
+ }
699
+
700
+ // src/components/steps/ConfirmStep.tsx
701
+
879
702
  function ConfirmStep({
880
703
  walletClient,
881
704
  address,
@@ -896,13 +719,14 @@ function ConfirmStep({
896
719
  quotedFeeSymbol,
897
720
  onConfirm,
898
721
  onError,
899
- onDepositSubmitted
722
+ onDepositSubmitted,
723
+ executeTransfer
900
724
  }) {
901
725
  const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
902
726
  const [error, setError] = _react.useState.call(void 0, null);
903
727
  const hasAttemptedSwitch = _react.useRef.call(void 0, false);
904
728
  const chainMismatch = Boolean(
905
- _optionalChain([walletClient, 'optionalAccess', _21 => _21.chain, 'optionalAccess', _22 => _22.id]) && walletClient.chain.id !== asset.chainId
729
+ _optionalChain([walletClient, 'optionalAccess', _18 => _18.chain, 'optionalAccess', _19 => _19.id]) && walletClient.chain.id !== asset.chainId
906
730
  );
907
731
  const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
908
732
  const targetSymbol = sameRoute ? asset.symbol : _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
@@ -925,15 +749,14 @@ function ConfirmStep({
925
749
  return formattedSendAmount;
926
750
  })();
927
751
  const receiveAmount = sameRoute ? formattedReceiveAmount : `~${formattedReceiveAmount}`;
928
- const feeSymbol = _nullishCoalesce(quotedFeeSymbol, () => ( asset.symbol));
929
- const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _23 => _23.feeSponsored]), () => ( false));
930
- const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _24 => _24.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
752
+ const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _20 => _20.feeSponsored]), () => ( false));
753
+ const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _21 => _21.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
931
754
  _react.useEffect.call(void 0, () => {
932
755
  if (chainMismatch && switchChain && !hasAttemptedSwitch.current) {
933
756
  hasAttemptedSwitch.current = true;
934
757
  switchChain(asset.chainId).catch((err) => {
935
758
  const raw = err instanceof Error ? err.message : "Failed to switch chain";
936
- setError(_chunkFTMCKJM4cjs.formatUserError.call(void 0, raw));
759
+ setError(_chunkV6NJIPSScjs.formatUserError.call(void 0, raw));
937
760
  });
938
761
  }
939
762
  }, [chainMismatch, switchChain, asset.chainId]);
@@ -974,33 +797,43 @@ function ConfirmStep({
974
797
  throw new Error("Wallet not properly connected");
975
798
  }
976
799
  const transferTo = sameRoute ? recipient : smartAccount;
977
- const hash = _chunkFTMCKJM4cjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
978
- account,
979
- chain,
980
- to: transferTo,
981
- value: amountUnits
982
- }) : await walletClient.writeContract({
983
- account,
984
- chain,
985
- address: asset.token,
986
- abi: _viem.erc20Abi,
987
- functionName: "transfer",
988
- args: [transferTo, amountUnits]
989
- });
990
- _optionalChain([onDepositSubmitted, 'optionalCall', _25 => _25(hash, asset.chainId, amountUnits.toString())]);
991
- onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
800
+ let hash;
801
+ let resolvedSourceToken = asset.token;
802
+ if (executeTransfer) {
803
+ const result = await executeTransfer(amountUnits);
804
+ hash = result.txHash;
805
+ resolvedSourceToken = result.sourceToken;
806
+ } else if (_chunkV6NJIPSScjs.isNativeAsset.call(void 0, asset)) {
807
+ hash = await walletClient.sendTransaction({
808
+ account,
809
+ chain,
810
+ to: transferTo,
811
+ value: amountUnits
812
+ });
813
+ } else {
814
+ hash = await walletClient.writeContract({
815
+ account,
816
+ chain,
817
+ address: asset.token,
818
+ abi: _viem.erc20Abi,
819
+ functionName: "transfer",
820
+ args: [transferTo, amountUnits]
821
+ });
822
+ }
823
+ _optionalChain([onDepositSubmitted, 'optionalCall', _22 => _22(hash, asset.chainId, amountUnits.toString())]);
824
+ onConfirm(hash, asset.chainId, amountUnits.toString(), resolvedSourceToken);
992
825
  } catch (err) {
993
826
  const raw = err instanceof Error ? err.message : "Transfer failed";
994
- const message = _chunkFTMCKJM4cjs.formatUserError.call(void 0, raw);
827
+ const message = _chunkV6NJIPSScjs.formatUserError.call(void 0, raw);
995
828
  setError(message);
996
- _optionalChain([onError, 'optionalCall', _26 => _26(message, "TRANSFER_ERROR")]);
829
+ _optionalChain([onError, 'optionalCall', _23 => _23(message, "TRANSFER_ERROR")]);
997
830
  } finally {
998
831
  setIsSubmitting(false);
999
832
  }
1000
833
  };
1001
834
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
1002
835
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
1003
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.WalletIcon, {}), title: "Review deposit" }),
836
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.WalletIcon, {}), title: "Review deposit" }),
1004
837
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-details", children: [
1005
838
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
1006
839
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
@@ -1045,31 +878,37 @@ function ConfirmStep({
1045
878
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
1046
879
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fees" }),
1047
880
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-detail-value", children: [
1048
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
881
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1049
882
  "span",
1050
883
  {
1051
884
  style: feeSponsored ? { textDecoration: "line-through" } : void 0,
1052
- children: [
1053
- quotedFeeAmount,
1054
- " ",
1055
- feeSymbol
1056
- ]
885
+ children: "$0.05"
1057
886
  }
1058
887
  ),
1059
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.Tooltip, { content: feeTooltip, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.InfoIcon, {}) }) })
888
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.Tooltip, { content: feeTooltip, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.InfoIcon, {}) }) })
1060
889
  ] })
1061
890
  ] })
1062
891
  ] }),
1063
- liquidityWarning && (liquidityWarning.kind === "unavailable" || liquidityWarning.kind === "check-failed") && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", role: "status", children: [
1064
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
892
+ liquidityWarning && (liquidityWarning.kind === "unavailable" || liquidityWarning.kind === "check-failed") && (isDappImportAsset(asset) ? (
893
+ // Dapp-import sources route through an unwrap before the
894
+ // orchestrator sees funds; the upstream route check often
895
+ // returns "unavailable" for the source token even though the
896
+ // post-unwrap route works. Surface as a soft warning rather
897
+ // than a red blocker until the orchestrator handles it.
898
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error rs-amount-error--warning", role: "status", children: [
899
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
900
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Low liquidity detected \u2014 deposit may take longer" })
901
+ ] })
902
+ ) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", role: "status", children: [
903
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
1065
904
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: liquidityWarning.kind === "unavailable" ? "Route may be unavailable" : "Liquidity check failed" })
1066
- ] }),
905
+ ] })),
1067
906
  error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", role: "alert", children: [
1068
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
907
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
1069
908
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: error })
1070
909
  ] }),
1071
910
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1072
- _chunkFTMCKJM4cjs.Button,
911
+ _chunkV6NJIPSScjs.Button,
1073
912
  {
1074
913
  onClick: handleConfirm,
1075
914
  loading: isSubmitting,
@@ -1080,7 +919,7 @@ function ConfirmStep({
1080
919
  }
1081
920
  )
1082
921
  ] }),
1083
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.PoweredBy, {})
922
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
1084
923
  ] });
1085
924
  }
1086
925
 
@@ -1103,9 +942,9 @@ var INITIAL_POLL_INTERVAL = 3e3;
1103
942
  var MAX_POLL_INTERVAL = 3e4;
1104
943
  var BACKOFF_MULTIPLIER = 1.5;
1105
944
  function isEventForTx(event, txHash) {
1106
- const eventTxHash = _chunkFTMCKJM4cjs.getEventTxHash.call(void 0, event);
945
+ const eventTxHash = _chunkV6NJIPSScjs.getEventTxHash.call(void 0, event);
1107
946
  if (!eventTxHash) return false;
1108
- return _chunkFTMCKJM4cjs.txRefsMatch.call(void 0, eventTxHash, txHash);
947
+ return _chunkV6NJIPSScjs.txRefsMatch.call(void 0, eventTxHash, txHash);
1109
948
  }
1110
949
  function truncateHash(hash) {
1111
950
  return `${hash.slice(0, 4)}\u2026${hash.slice(-4)}`;
@@ -1135,7 +974,7 @@ function formatTimestamp(ms) {
1135
974
  return `${month} ${day}${suffix} \xB7 ${hours}:${minutes}:${seconds}`;
1136
975
  }
1137
976
  function formatBridgeFailedMessage(event) {
1138
- const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _27 => _27.data]), () => ( {}));
977
+ const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _24 => _24.data]), () => ( {}));
1139
978
  const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
1140
979
  if (backendMessage.length > 0) {
1141
980
  const lower = backendMessage.toLowerCase();
@@ -1155,7 +994,7 @@ function formatBridgeFailedMessage(event) {
1155
994
  }
1156
995
  return "Bridge failed";
1157
996
  }
1158
- var txLinkIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.ExternalLinkIcon, { className: "rs-deposit-notification-link-icon" });
997
+ var txLinkIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.ExternalLinkIcon, { className: "rs-deposit-notification-link-icon" });
1159
998
  function DepositNotification({
1160
999
  deposit,
1161
1000
  smartAccount,
@@ -1183,7 +1022,7 @@ function DepositNotification({
1183
1022
  const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
1184
1023
  const pollTimeoutRef = _react.useRef.call(void 0, null);
1185
1024
  const completedRef = _react.useRef.call(void 0, _nullishCoalesce(directTransfer, () => ( false)));
1186
- const depositContextRef = _chunkFTMCKJM4cjs.useLatestRef.call(void 0, {
1025
+ const depositContextRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, {
1187
1026
  amount,
1188
1027
  sourceChain,
1189
1028
  sourceToken: token,
@@ -1192,8 +1031,8 @@ function DepositNotification({
1192
1031
  waitForFinalTx,
1193
1032
  hasPostBridgeActions
1194
1033
  });
1195
- const onCompleteRef = _chunkFTMCKJM4cjs.useLatestRef.call(void 0, onComplete);
1196
- const onFailedRef = _chunkFTMCKJM4cjs.useLatestRef.call(void 0, onFailed);
1034
+ const onCompleteRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onComplete);
1035
+ const onFailedRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onFailed);
1197
1036
  const handleComplete = _react.useCallback.call(void 0,
1198
1037
  (destTxHash) => {
1199
1038
  if (completedRef.current) return;
@@ -1202,7 +1041,7 @@ function DepositNotification({
1202
1041
  setCompletedAt(Date.now());
1203
1042
  setStatus("complete");
1204
1043
  const context = depositContextRef.current;
1205
- _optionalChain([onCompleteRef, 'access', _28 => _28.current, 'optionalCall', _29 => _29(txHash, destTxHash, {
1044
+ _optionalChain([onCompleteRef, 'access', _25 => _25.current, 'optionalCall', _26 => _26(txHash, destTxHash, {
1206
1045
  amount: context.amount,
1207
1046
  sourceChain: context.sourceChain,
1208
1047
  sourceToken: context.sourceToken,
@@ -1217,7 +1056,7 @@ function DepositNotification({
1217
1056
  if (completedRef.current) return;
1218
1057
  completedRef.current = true;
1219
1058
  setStatus("failed");
1220
- _optionalChain([onFailedRef, 'access', _30 => _30.current, 'optionalCall', _31 => _31(txHash, error)]);
1059
+ _optionalChain([onFailedRef, 'access', _27 => _27.current, 'optionalCall', _28 => _28(txHash, error)]);
1221
1060
  },
1222
1061
  [onFailedRef, txHash]
1223
1062
  );
@@ -1236,30 +1075,30 @@ function DepositNotification({
1236
1075
  const lastEvent = data.lastEvent;
1237
1076
  const eventForTx = isEventForTx(lastEvent, txHash) ? lastEvent : void 0;
1238
1077
  const awaitingPostBridgeSwap = depositContextRef.current.waitForFinalTx && depositContextRef.current.hasPostBridgeActions;
1239
- if (_optionalChain([eventForTx, 'optionalAccess', _32 => _32.type]) === "post-bridge-swap-complete") {
1240
- const swapTxHash = _optionalChain([eventForTx, 'access', _33 => _33.data, 'optionalAccess', _34 => _34.swap, 'optionalAccess', _35 => _35.transactionHash]);
1078
+ if (_optionalChain([eventForTx, 'optionalAccess', _29 => _29.type]) === "post-bridge-swap-complete") {
1079
+ const swapTxHash = _optionalChain([eventForTx, 'access', _30 => _30.data, 'optionalAccess', _31 => _31.swap, 'optionalAccess', _32 => _32.transactionHash]);
1241
1080
  handleComplete(swapTxHash);
1242
1081
  return;
1243
1082
  }
1244
- if (_optionalChain([eventForTx, 'optionalAccess', _36 => _36.type]) === "post-bridge-swap-failed") {
1083
+ if (_optionalChain([eventForTx, 'optionalAccess', _33 => _33.type]) === "post-bridge-swap-failed") {
1245
1084
  handleFailed(formatBridgeFailedMessage(eventForTx));
1246
1085
  return;
1247
1086
  }
1248
- if (_optionalChain([eventForTx, 'optionalAccess', _37 => _37.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
1249
- const destTx = _optionalChain([eventForTx, 'access', _38 => _38.data, 'optionalAccess', _39 => _39.destination, 'optionalAccess', _40 => _40.transactionHash]);
1087
+ if (_optionalChain([eventForTx, 'optionalAccess', _34 => _34.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
1088
+ const destTx = _optionalChain([eventForTx, 'access', _35 => _35.data, 'optionalAccess', _36 => _36.destination, 'optionalAccess', _37 => _37.transactionHash]);
1250
1089
  handleComplete(destTx);
1251
1090
  return;
1252
1091
  }
1253
- if (!waitForFinalTx && _optionalChain([eventForTx, 'optionalAccess', _41 => _41.type]) === "bridge-started") {
1092
+ if (!waitForFinalTx && _optionalChain([eventForTx, 'optionalAccess', _38 => _38.type]) === "bridge-started") {
1254
1093
  handleComplete(void 0);
1255
1094
  return;
1256
1095
  }
1257
- if (_optionalChain([eventForTx, 'optionalAccess', _42 => _42.type]) === "bridge-failed") {
1096
+ if (_optionalChain([eventForTx, 'optionalAccess', _39 => _39.type]) === "bridge-failed") {
1258
1097
  handleFailed(formatBridgeFailedMessage(eventForTx));
1259
1098
  return;
1260
1099
  }
1261
- if (_optionalChain([eventForTx, 'optionalAccess', _43 => _43.type]) === "error") {
1262
- const errorMessage = _nullishCoalesce(_optionalChain([eventForTx, 'access', _44 => _44.data, 'optionalAccess', _45 => _45.message]), () => ( "Unknown error"));
1100
+ if (_optionalChain([eventForTx, 'optionalAccess', _40 => _40.type]) === "error") {
1101
+ const errorMessage = _nullishCoalesce(_optionalChain([eventForTx, 'access', _41 => _41.data, 'optionalAccess', _42 => _42.message]), () => ( "Unknown error"));
1263
1102
  handleFailed(errorMessage);
1264
1103
  return;
1265
1104
  }
@@ -1301,7 +1140,7 @@ function DepositNotification({
1301
1140
  const destExplorerUrl = destinationTxHash ? _chunkIVTXEYB2cjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
1302
1141
  const title = status === "complete" ? "Deposit completed" : status === "failed" ? "Deposit failed" : "Deposit received and processing\u2026";
1303
1142
  const subtitle = status === "complete" ? "Your deposit has been credited to your account." : status === "failed" ? "Your deposit could not be processed." : "Your deposit will be credited to your account shortly.";
1304
- const statusIcon = status === "complete" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.CheckIcon, {}) }) : status === "failed" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--failed", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.CloseIcon, {}) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.Spinner, {}) });
1143
+ const statusIcon = status === "complete" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CheckIcon, {}) }) : status === "failed" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--failed", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CloseIcon, {}) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.Spinner, {}) });
1305
1144
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1306
1145
  "div",
1307
1146
  {
@@ -1320,7 +1159,7 @@ function DepositNotification({
1320
1159
  className: "rs-deposit-notification-close",
1321
1160
  onClick: () => onDismiss(deposit.id),
1322
1161
  "aria-label": "Dismiss",
1323
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.CloseIcon, {})
1162
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CloseIcon, {})
1324
1163
  }
1325
1164
  )
1326
1165
  ] }),
@@ -1409,7 +1248,7 @@ var DEFAULT_SOLANA_RPC_URL = "https://api.mainnet.solana.com";
1409
1248
  var configuredSolanaRpcUrl = null;
1410
1249
  var cachedConnections = /* @__PURE__ */ new Map();
1411
1250
  function configureSolanaRpcUrl(rpcUrl) {
1412
- const normalized = _optionalChain([rpcUrl, 'optionalAccess', _46 => _46.trim, 'call', _47 => _47()]);
1251
+ const normalized = _optionalChain([rpcUrl, 'optionalAccess', _43 => _43.trim, 'call', _44 => _44()]);
1413
1252
  configuredSolanaRpcUrl = normalized ? normalized : null;
1414
1253
  cachedConnections.clear();
1415
1254
  }
@@ -1547,7 +1386,7 @@ function resolveSolanaTokenMeta(token) {
1547
1386
  return {};
1548
1387
  }
1549
1388
  function getDepositEventDetails(event) {
1550
- if (!_optionalChain([event, 'optionalAccess', _48 => _48.type]) || !isRecord(event.data)) return {};
1389
+ if (!_optionalChain([event, 'optionalAccess', _45 => _45.type]) || !isRecord(event.data)) return {};
1551
1390
  if (event.type === "deposit-received") {
1552
1391
  const chainId = asChainId(event.data.chain);
1553
1392
  const token = asString(event.data.token);
@@ -1561,12 +1400,12 @@ function getDepositEventDetails(event) {
1561
1400
  }
1562
1401
  if (event.type === "bridge-started") {
1563
1402
  const source = isRecord(event.data.source) ? event.data.source : void 0;
1564
- const chainId = asChainId(_optionalChain([source, 'optionalAccess', _49 => _49.chain]));
1565
- const token = asString(_optionalChain([source, 'optionalAccess', _50 => _50.asset]));
1403
+ const chainId = asChainId(_optionalChain([source, 'optionalAccess', _46 => _46.chain]));
1404
+ const token = asString(_optionalChain([source, 'optionalAccess', _47 => _47.asset]));
1566
1405
  const solanaMeta = chainId === "solana" ? resolveSolanaTokenMeta(token) : {};
1567
1406
  return {
1568
1407
  chainId,
1569
- amount: asAmount(_optionalChain([source, 'optionalAccess', _51 => _51.amount])),
1408
+ amount: asAmount(_optionalChain([source, 'optionalAccess', _48 => _48.amount])),
1570
1409
  token,
1571
1410
  ...solanaMeta
1572
1411
  };
@@ -1590,16 +1429,17 @@ function DepositAddressStep({
1590
1429
  onDepositComplete,
1591
1430
  onDepositFailed,
1592
1431
  onCopyAddress,
1432
+ onRequestWalletPicker,
1593
1433
  onError
1594
1434
  }) {
1595
1435
  const hasSolana = Boolean(solanaDepositAddress);
1596
1436
  const allowedChainSet = _react.useMemo.call(void 0,
1597
- () => _optionalChain([allowedRoutes, 'optionalAccess', _52 => _52.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
1598
- [_optionalChain([allowedRoutes, 'optionalAccess', _53 => _53.sourceChains])]
1437
+ () => _optionalChain([allowedRoutes, 'optionalAccess', _49 => _49.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
1438
+ [_optionalChain([allowedRoutes, 'optionalAccess', _50 => _50.sourceChains])]
1599
1439
  );
1600
1440
  const allowedTokenSet = _react.useMemo.call(void 0,
1601
- () => _optionalChain([allowedRoutes, 'optionalAccess', _54 => _54.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
1602
- [_optionalChain([allowedRoutes, 'optionalAccess', _55 => _55.sourceTokens])]
1441
+ () => _optionalChain([allowedRoutes, 'optionalAccess', _51 => _51.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
1442
+ [_optionalChain([allowedRoutes, 'optionalAccess', _52 => _52.sourceTokens])]
1603
1443
  );
1604
1444
  const evmChainIds = _react.useMemo.call(void 0, () => {
1605
1445
  const all = _chunkIVTXEYB2cjs.getSupportedChainIds.call(void 0, );
@@ -1648,9 +1488,9 @@ function DepositAddressStep({
1648
1488
  const matched = _nullishCoalesce(SOLANA_TOKENS.find((t) => t.symbol === sourceTokenSymbol), () => ( SOLANA_TOKENS[0]));
1649
1489
  sourceSelectionRef.current = {
1650
1490
  chainId: "solana",
1651
- token: _optionalChain([matched, 'optionalAccess', _56 => _56.mint]),
1652
- sourceSymbol: _optionalChain([matched, 'optionalAccess', _57 => _57.symbol]),
1653
- sourceDecimals: _optionalChain([matched, 'optionalAccess', _58 => _58.decimals])
1491
+ token: _optionalChain([matched, 'optionalAccess', _53 => _53.mint]),
1492
+ sourceSymbol: _optionalChain([matched, 'optionalAccess', _54 => _54.symbol]),
1493
+ sourceDecimals: _optionalChain([matched, 'optionalAccess', _55 => _55.decimals])
1654
1494
  };
1655
1495
  return;
1656
1496
  }
@@ -1719,8 +1559,8 @@ function DepositAddressStep({
1719
1559
  function handlePointerDown(event) {
1720
1560
  const target = event.target;
1721
1561
  if (!target) return;
1722
- const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access', _59 => _59.current, 'optionalAccess', _60 => _60.contains, 'call', _61 => _61(target)]);
1723
- const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access', _62 => _62.current, 'optionalAccess', _63 => _63.contains, 'call', _64 => _64(target)]);
1562
+ const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access', _56 => _56.current, 'optionalAccess', _57 => _57.contains, 'call', _58 => _58(target)]);
1563
+ const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access', _59 => _59.current, 'optionalAccess', _60 => _60.contains, 'call', _61 => _61(target)]);
1724
1564
  if (clickedChainDropdown || clickedTokenDropdown) return;
1725
1565
  setChainDropdownOpen(false);
1726
1566
  setTokenDropdownOpen(false);
@@ -1733,7 +1573,7 @@ function DepositAddressStep({
1733
1573
  };
1734
1574
  }, [chainDropdownOpen, tokenDropdownOpen]);
1735
1575
  const handleCopy = _react.useCallback.call(void 0, async () => {
1736
- _optionalChain([onCopyAddress, 'optionalCall', _65 => _65()]);
1576
+ _optionalChain([onCopyAddress, 'optionalCall', _62 => _62()]);
1737
1577
  try {
1738
1578
  await navigator.clipboard.writeText(displayAddress);
1739
1579
  setCopied(true);
@@ -1807,10 +1647,10 @@ function DepositAddressStep({
1807
1647
  return;
1808
1648
  }
1809
1649
  const event = status.lastEvent;
1810
- const eventTxHash = _chunkFTMCKJM4cjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkFTMCKJM4cjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
1650
+ const eventTxHash = _chunkV6NJIPSScjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkV6NJIPSScjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
1811
1651
  if (baselineTxHashRef.current === void 0) {
1812
1652
  baselineTxHashRef.current = eventTxHash;
1813
- } else if (eventTxHash && (!baselineTxHashRef.current || !_chunkFTMCKJM4cjs.txRefsMatch.call(void 0, eventTxHash, baselineTxHashRef.current))) {
1653
+ } else if (eventTxHash && (!baselineTxHashRef.current || !_chunkV6NJIPSScjs.txRefsMatch.call(void 0, eventTxHash, baselineTxHashRef.current))) {
1814
1654
  const details = getDepositEventDetails(event);
1815
1655
  const chainId = _nullishCoalesce(details.chainId, () => ( "unknown"));
1816
1656
  const amount = _nullishCoalesce(details.amount, () => ( "0"));
@@ -1839,7 +1679,7 @@ function DepositAddressStep({
1839
1679
  directTransfer
1840
1680
  };
1841
1681
  setNotifications((prev) => [notification, ...prev]);
1842
- _optionalChain([onDepositSubmittedRef, 'access', _66 => _66.current, 'optionalCall', _67 => _67({
1682
+ _optionalChain([onDepositSubmittedRef, 'access', _63 => _63.current, 'optionalCall', _64 => _64({
1843
1683
  txHash: eventTxHash,
1844
1684
  sourceChain: chainId,
1845
1685
  amount
@@ -1850,7 +1690,7 @@ function DepositAddressStep({
1850
1690
  if (!cancelled) {
1851
1691
  const msg = err instanceof Error ? err.message : "Failed to check status";
1852
1692
  setPollingError(msg);
1853
- _optionalChain([onErrorRef, 'access', _68 => _68.current, 'optionalCall', _69 => _69(msg, "STATUS_POLL_ERROR")]);
1693
+ _optionalChain([onErrorRef, 'access', _65 => _65.current, 'optionalCall', _66 => _66(msg, "STATUS_POLL_ERROR")]);
1854
1694
  }
1855
1695
  }
1856
1696
  if (!cancelled) {
@@ -1866,14 +1706,14 @@ function DepositAddressStep({
1866
1706
  const handleNotificationComplete = _react.useCallback.call(void 0,
1867
1707
  (txHash, destinationTxHash, context) => {
1868
1708
  isTrackingRef.current = false;
1869
- _optionalChain([onDepositCompleteRef, 'access', _70 => _70.current, 'optionalCall', _71 => _71(txHash, destinationTxHash, context)]);
1709
+ _optionalChain([onDepositCompleteRef, 'access', _67 => _67.current, 'optionalCall', _68 => _68(txHash, destinationTxHash, context)]);
1870
1710
  },
1871
1711
  []
1872
1712
  );
1873
1713
  const handleNotificationFailed = _react.useCallback.call(void 0,
1874
1714
  (txHash, error) => {
1875
1715
  isTrackingRef.current = false;
1876
- _optionalChain([onDepositFailedRef, 'access', _72 => _72.current, 'optionalCall', _73 => _73(txHash, error)]);
1716
+ _optionalChain([onDepositFailedRef, 'access', _69 => _69.current, 'optionalCall', _70 => _70(txHash, error)]);
1877
1717
  },
1878
1718
  []
1879
1719
  );
@@ -1883,7 +1723,7 @@ function DepositAddressStep({
1883
1723
  const qrIconSrc = _chunkIVTXEYB2cjs.getChainIcon.call(void 0, sourceChainId);
1884
1724
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen rs-step--with-notifications", children: [
1885
1725
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
1886
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.CoinsIcon, {}), title: "Transfer crypto" }),
1726
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CoinsIcon, {}), title: "Transfer crypto" }),
1887
1727
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
1888
1728
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
1889
1729
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
@@ -1906,7 +1746,7 @@ function DepositAddressStep({
1906
1746
  }
1907
1747
  ),
1908
1748
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkIVTXEYB2cjs.getChainName.call(void 0, sourceChainId) }),
1909
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1749
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1910
1750
  ]
1911
1751
  }
1912
1752
  ),
@@ -1939,9 +1779,9 @@ function DepositAddressStep({
1939
1779
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Supported token" }),
1940
1780
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-deposit-address-min", children: [
1941
1781
  "Min.$",
1942
- _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _74 => _74.minDepositUsd]), () => ( 0.1)),
1943
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1944
- _chunkFTMCKJM4cjs.InfoIcon,
1782
+ _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _71 => _71.minDepositUsd]), () => ( 0.1)),
1783
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1784
+ _chunkV6NJIPSScjs.InfoIcon,
1945
1785
  {
1946
1786
  className: "rs-deposit-address-min-icon",
1947
1787
  "aria-hidden": "true"
@@ -1968,7 +1808,7 @@ function DepositAddressStep({
1968
1808
  }
1969
1809
  ),
1970
1810
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceTokenSymbol }),
1971
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1811
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1972
1812
  ]
1973
1813
  }
1974
1814
  ),
@@ -2016,7 +1856,7 @@ function DepositAddressStep({
2016
1856
  alignItems: "center",
2017
1857
  justifyContent: "center"
2018
1858
  },
2019
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.Spinner, {})
1859
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.Spinner, {})
2020
1860
  }
2021
1861
  ),
2022
1862
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QRCode, { value: displayAddress, size: 220, iconSrc: qrIconSrc })
@@ -2031,7 +1871,7 @@ function DepositAddressStep({
2031
1871
  className: "rs-deposit-address-copy",
2032
1872
  onClick: handleCopy,
2033
1873
  children: [
2034
- copied ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.CopyIcon, {}),
1874
+ copied ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CopyIcon, {}),
2035
1875
  copied ? "Copied!" : "Copy address"
2036
1876
  ]
2037
1877
  }
@@ -2056,16 +1896,16 @@ function DepositAddressStep({
2056
1896
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-label", children: "Price impact" }),
2057
1897
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-label", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.00%" }) }),
2058
1898
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2059
- _chunkFTMCKJM4cjs.Tooltip,
1899
+ _chunkV6NJIPSScjs.Tooltip,
2060
1900
  {
2061
1901
  className: "rs-price-impact-info",
2062
1902
  content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
2063
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.InfoIcon, { "aria-hidden": "true" })
1903
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.InfoIcon, { "aria-hidden": "true" })
2064
1904
  }
2065
1905
  )
2066
1906
  ] }),
2067
1907
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2068
- _chunkFTMCKJM4cjs.ChevronDownIcon,
1908
+ _chunkV6NJIPSScjs.ChevronDownIcon,
2069
1909
  {
2070
1910
  className: "rs-price-impact-chevron",
2071
1911
  "aria-hidden": "true"
@@ -2076,29 +1916,29 @@ function DepositAddressStep({
2076
1916
  ),
2077
1917
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-price-impact-panel", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-panel-inner", children: [
2078
1918
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
2079
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.PercentIcon, {}) }),
1919
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PercentIcon, {}) }),
2080
1920
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
2081
1921
  "Max slippage: ",
2082
1922
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.2%" })
2083
1923
  ] }),
2084
1924
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2085
- _chunkFTMCKJM4cjs.Tooltip,
1925
+ _chunkV6NJIPSScjs.Tooltip,
2086
1926
  {
2087
1927
  className: "rs-price-impact-info",
2088
1928
  content: "Slippage accounts for price changes during execution. Slippage is adjusted per pair to ensure reliable execution.",
2089
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.InfoIcon, { "aria-hidden": "true" })
1929
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.InfoIcon, { "aria-hidden": "true" })
2090
1930
  }
2091
1931
  )
2092
1932
  ] }),
2093
1933
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
2094
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.ClockIcon, {}) }),
1934
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.ClockIcon, {}) }),
2095
1935
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
2096
1936
  "Processing time: ",
2097
1937
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "< 1 min" })
2098
1938
  ] })
2099
1939
  ] }),
2100
1940
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
2101
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.PlusCircleIcon, {}) }),
1941
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PlusCircleIcon, {}) }),
2102
1942
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
2103
1943
  "Max deposit:",
2104
1944
  " ",
@@ -2112,7 +1952,16 @@ function DepositAddressStep({
2112
1952
  ]
2113
1953
  }
2114
1954
  ),
2115
- pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
1955
+ pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError }),
1956
+ onRequestWalletPicker && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1957
+ "button",
1958
+ {
1959
+ type: "button",
1960
+ className: "rs-connect-wallet-manage",
1961
+ onClick: onRequestWalletPicker,
1962
+ children: "Use a wallet to deposit instead"
1963
+ }
1964
+ )
2116
1965
  ] }),
2117
1966
  notifications.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notifications", children: notifications.map((deposit) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2118
1967
  DepositNotification,
@@ -2131,7 +1980,7 @@ function DepositAddressStep({
2131
1980
  },
2132
1981
  deposit.id
2133
1982
  )) }),
2134
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.PoweredBy, {})
1983
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
2135
1984
  ] });
2136
1985
  }
2137
1986
  DepositAddressStep.displayName = "DepositAddressStep";
@@ -2162,7 +2011,7 @@ function SolanaTokenSelectStep({
2162
2011
  setError(null);
2163
2012
  const portfolioBySymbol = {};
2164
2013
  try {
2165
- _chunkFTMCKJM4cjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:request", {
2014
+ _chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:request", {
2166
2015
  solanaAddress
2167
2016
  });
2168
2017
  const portfolio = await service.fetchSolanaPortfolio(solanaAddress);
@@ -2185,12 +2034,12 @@ function SolanaTokenSelectStep({
2185
2034
  };
2186
2035
  }
2187
2036
  }
2188
- _chunkFTMCKJM4cjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:success", {
2037
+ _chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:success", {
2189
2038
  symbols: Object.keys(portfolioBySymbol)
2190
2039
  });
2191
2040
  } catch (err) {
2192
2041
  if (!active) return;
2193
- _chunkFTMCKJM4cjs.debugError.call(void 0, debug, "solana-token-select", "portfolio:failure", err, {
2042
+ _chunkV6NJIPSScjs.debugError.call(void 0, debug, "solana-token-select", "portfolio:failure", err, {
2194
2043
  solanaAddress
2195
2044
  });
2196
2045
  setError(
@@ -2215,7 +2064,7 @@ function SolanaTokenSelectStep({
2215
2064
  setTokenBalances(results);
2216
2065
  setLoading(false);
2217
2066
  const totalUsd = results.reduce((sum, r) => sum + r.balanceUsd, 0);
2218
- _optionalChain([onTotalBalanceComputed, 'optionalCall', _75 => _75(totalUsd)]);
2067
+ _optionalChain([onTotalBalanceComputed, 'optionalCall', _72 => _72(totalUsd)]);
2219
2068
  }
2220
2069
  void loadBalances();
2221
2070
  return () => {
@@ -2237,9 +2086,9 @@ function SolanaTokenSelectStep({
2237
2086
  }
2238
2087
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
2239
2088
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { padding: "0 12px 12px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2240
- _chunkFTMCKJM4cjs.BodyHeader,
2089
+ _chunkV6NJIPSScjs.BodyHeader,
2241
2090
  {
2242
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.CoinsIcon, {}),
2091
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CoinsIcon, {}),
2243
2092
  title: "Select asset",
2244
2093
  subtitle: "Pick a Solana token to deposit"
2245
2094
  }
@@ -2251,11 +2100,11 @@ function SolanaTokenSelectStep({
2251
2100
  style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
2252
2101
  children: [
2253
2102
  loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
2254
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.Spinner, { className: "rs-text-tertiary" }),
2103
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.Spinner, { className: "rs-text-tertiary" }),
2255
2104
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
2256
2105
  ] }),
2257
2106
  !loading && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
2258
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.WalletIcon, { className: "rs-empty-icon" }),
2107
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.WalletIcon, { className: "rs-empty-icon" }),
2259
2108
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
2260
2109
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-address", children: [
2261
2110
  solanaAddress.slice(0, 6),
@@ -2271,7 +2120,7 @@ function SolanaTokenSelectStep({
2271
2120
  try {
2272
2121
  const raw = _viem.formatUnits.call(void 0, entry.balance, entry.token.decimals);
2273
2122
  const numeric = Number(raw);
2274
- formattedBalance = Number.isFinite(numeric) ? _chunkFTMCKJM4cjs.tokenFormatter.format(numeric) : raw;
2123
+ formattedBalance = Number.isFinite(numeric) ? _chunkV6NJIPSScjs.tokenFormatter.format(numeric) : raw;
2275
2124
  } catch (e16) {
2276
2125
  formattedBalance = "...";
2277
2126
  }
@@ -2315,7 +2164,7 @@ function SolanaTokenSelectStep({
2315
2164
  ] })
2316
2165
  ] })
2317
2166
  ] }),
2318
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? _chunkFTMCKJM4cjs.currencyFormatter.format(entry.balanceUsd) : `${formattedBalance} ${entry.token.symbol}` })
2167
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? _chunkV6NJIPSScjs.currencyFormatter.format(entry.balanceUsd) : `${formattedBalance} ${entry.token.symbol}` })
2319
2168
  ]
2320
2169
  },
2321
2170
  entry.token.symbol
@@ -2325,7 +2174,7 @@ function SolanaTokenSelectStep({
2325
2174
  }
2326
2175
  ),
2327
2176
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2328
- _chunkFTMCKJM4cjs.Button,
2177
+ _chunkV6NJIPSScjs.Button,
2329
2178
  {
2330
2179
  onClick: () => selectedEntry && onContinue(
2331
2180
  selectedEntry.token,
@@ -2337,7 +2186,7 @@ function SolanaTokenSelectStep({
2337
2186
  children: "Continue"
2338
2187
  }
2339
2188
  ) }),
2340
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.PoweredBy, {})
2189
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
2341
2190
  ] });
2342
2191
  }
2343
2192
 
@@ -2395,7 +2244,7 @@ function SolanaAmountStep({
2395
2244
  const raw = _viem.formatUnits.call(void 0, balance, token.decimals);
2396
2245
  const numeric = Number(raw);
2397
2246
  if (!Number.isFinite(numeric)) return raw;
2398
- return _chunkFTMCKJM4cjs.tokenFormatter.format(numeric);
2247
+ return _chunkV6NJIPSScjs.tokenFormatter.format(numeric);
2399
2248
  } catch (e18) {
2400
2249
  return "\u2026";
2401
2250
  }
@@ -2438,8 +2287,8 @@ function SolanaAmountStep({
2438
2287
  return null;
2439
2288
  }
2440
2289
  }, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, token.decimals]);
2441
- const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _76 => _76.minDepositUsd]), () => ( null));
2442
- const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _77 => _77.maxDepositUsd]), () => ( null));
2290
+ const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _73 => _73.minDepositUsd]), () => ( null));
2291
+ const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _74 => _74.maxDepositUsd]), () => ( null));
2443
2292
  const isBelowMin = minDepositUsd !== null && numericAmount > 0 && numericAmount < minDepositUsd;
2444
2293
  const isAboveMax = maxDepositUsd !== null && numericAmount > maxDepositUsd;
2445
2294
  const exceedsBalance = Boolean(
@@ -2454,7 +2303,7 @@ function SolanaAmountStep({
2454
2303
  const factor = 1e3;
2455
2304
  const truncated = Math.floor(value * factor) / factor;
2456
2305
  const formatted = truncated.toFixed(3).replace(/\.?0+$/, "");
2457
- _chunkFTMCKJM4cjs.debugLog.call(void 0, debug, "solana-amount", "amount:preset", {
2306
+ _chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-amount", "amount:preset", {
2458
2307
  percentage,
2459
2308
  symbol: token.symbol,
2460
2309
  formatted
@@ -2492,7 +2341,7 @@ function SolanaAmountStep({
2492
2341
  try {
2493
2342
  amountInUnits = _viem.parseUnits.call(void 0, sourceAmountStr, token.decimals);
2494
2343
  } catch (e23) {
2495
- _chunkFTMCKJM4cjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
2344
+ _chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
2496
2345
  amount,
2497
2346
  sourceAmount: sourceAmountStr,
2498
2347
  reason: "parse-units-failed"
@@ -2507,7 +2356,7 @@ function SolanaAmountStep({
2507
2356
  );
2508
2357
  return;
2509
2358
  }
2510
- _chunkFTMCKJM4cjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
2359
+ _chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
2511
2360
  symbol: token.symbol,
2512
2361
  inputAmountUsd: amount,
2513
2362
  sourceAmount: sourceAmountStr,
@@ -2521,7 +2370,7 @@ function SolanaAmountStep({
2521
2370
  const sourceTokenIcon = _chunkIVTXEYB2cjs.getTokenIcon.call(void 0, token.symbol);
2522
2371
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
2523
2372
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2524
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.WalletIcon, {}), title: "Wallet deposit" }),
2373
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.WalletIcon, {}), title: "Wallet deposit" }),
2525
2374
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-section", children: [
2526
2375
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
2527
2376
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-input-row", children: [
@@ -2547,13 +2396,13 @@ function SolanaAmountStep({
2547
2396
  " available",
2548
2397
  computedBalanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2549
2398
  " (~",
2550
- _chunkFTMCKJM4cjs.currencyFormatter.format(computedBalanceUsd),
2399
+ _chunkV6NJIPSScjs.currencyFormatter.format(computedBalanceUsd),
2551
2400
  ")"
2552
2401
  ] })
2553
2402
  ] }),
2554
2403
  minDepositUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-meta-minimum", children: [
2555
2404
  "Min. deposit ",
2556
- _chunkFTMCKJM4cjs.currencyFormatter.format(minDepositUsd)
2405
+ _chunkV6NJIPSScjs.currencyFormatter.format(minDepositUsd)
2557
2406
  ] })
2558
2407
  ] })
2559
2408
  ] }),
@@ -2592,15 +2441,15 @@ function SolanaAmountStep({
2592
2441
  ] }),
2593
2442
  balanceAfterUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
2594
2443
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Balance after deposit" }),
2595
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children: _chunkFTMCKJM4cjs.currencyFormatter.format(balanceAfterUsd) })
2444
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children: _chunkV6NJIPSScjs.currencyFormatter.format(balanceAfterUsd) })
2596
2445
  ] })
2597
2446
  ] }),
2598
2447
  error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", role: "alert", children: [
2599
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
2448
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
2600
2449
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: error })
2601
2450
  ] }),
2602
2451
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2603
- _chunkFTMCKJM4cjs.Button,
2452
+ _chunkV6NJIPSScjs.Button,
2604
2453
  {
2605
2454
  onClick: handleContinue,
2606
2455
  fullWidth: true,
@@ -2609,7 +2458,7 @@ function SolanaAmountStep({
2609
2458
  }
2610
2459
  )
2611
2460
  ] }),
2612
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.PoweredBy, {})
2461
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
2613
2462
  ] });
2614
2463
  }
2615
2464
 
@@ -2653,7 +2502,7 @@ function SolanaConfirmStep({
2653
2502
  const receiveAmount = isSameToken ? formattedReceiveAmount : `~ ${formattedReceiveAmount}`;
2654
2503
  const handleConfirm = async () => {
2655
2504
  if (!solanaProvider) {
2656
- _chunkFTMCKJM4cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
2505
+ _chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
2657
2506
  reason: "missing-provider"
2658
2507
  });
2659
2508
  setError("Solana wallet not connected");
@@ -2661,7 +2510,7 @@ function SolanaConfirmStep({
2661
2510
  }
2662
2511
  const parsedAmount = parseFloat(sourceAmount);
2663
2512
  if (isNaN(parsedAmount) || parsedAmount <= 0) {
2664
- _chunkFTMCKJM4cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
2513
+ _chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
2665
2514
  reason: "invalid-amount",
2666
2515
  sourceAmount
2667
2516
  });
@@ -2670,7 +2519,7 @@ function SolanaConfirmStep({
2670
2519
  }
2671
2520
  setError(null);
2672
2521
  setIsSubmitting(true);
2673
- _chunkFTMCKJM4cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:start", {
2522
+ _chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:start", {
2674
2523
  smartAccount,
2675
2524
  solanaAddress,
2676
2525
  solanaDepositAddress,
@@ -2680,7 +2529,7 @@ function SolanaConfirmStep({
2680
2529
  });
2681
2530
  try {
2682
2531
  const check = await service.checkAccount(smartAccount);
2683
- _chunkFTMCKJM4cjs.debugLog.call(void 0, debug, "solana-confirm", "check:success", {
2532
+ _chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-confirm", "check:success", {
2684
2533
  smartAccount,
2685
2534
  isRegistered: check.isRegistered,
2686
2535
  targetChain: check.targetChain,
@@ -2693,7 +2542,7 @@ function SolanaConfirmStep({
2693
2542
  }
2694
2543
  const connection = getSolanaConnection();
2695
2544
  const amountUnits = _viem.parseUnits.call(void 0, sourceAmount, token.decimals);
2696
- _chunkFTMCKJM4cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
2545
+ _chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
2697
2546
  token: token.symbol,
2698
2547
  sourceAmount,
2699
2548
  amountUnits: amountUnits.toString()
@@ -2710,10 +2559,10 @@ function SolanaConfirmStep({
2710
2559
  token.mint,
2711
2560
  amountUnits
2712
2561
  );
2713
- _chunkFTMCKJM4cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
2562
+ _chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
2714
2563
  token: token.symbol,
2715
2564
  instructionCount: transaction.instructions.length,
2716
- feePayer: _optionalChain([transaction, 'access', _78 => _78.feePayer, 'optionalAccess', _79 => _79.toBase58, 'call', _80 => _80()]),
2565
+ feePayer: _optionalChain([transaction, 'access', _75 => _75.feePayer, 'optionalAccess', _76 => _76.toBase58, 'call', _77 => _77()]),
2717
2566
  recentBlockhash: transaction.recentBlockhash
2718
2567
  });
2719
2568
  const txHash = await sendSolanaTransaction(
@@ -2721,27 +2570,27 @@ function SolanaConfirmStep({
2721
2570
  connection,
2722
2571
  transaction
2723
2572
  );
2724
- _chunkFTMCKJM4cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:sent", {
2573
+ _chunkV6NJIPSScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:sent", {
2725
2574
  txHash,
2726
2575
  amountUnits: amountUnits.toString()
2727
2576
  });
2728
2577
  onConfirm(txHash, amountUnits.toString());
2729
2578
  } catch (err) {
2730
2579
  const raw = err instanceof Error ? err.message : "Transfer failed";
2731
- const message = _chunkFTMCKJM4cjs.formatUserError.call(void 0, raw);
2732
- _chunkFTMCKJM4cjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
2580
+ const message = _chunkV6NJIPSScjs.formatUserError.call(void 0, raw);
2581
+ _chunkV6NJIPSScjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
2733
2582
  smartAccount,
2734
2583
  token: token.symbol,
2735
2584
  sourceAmount
2736
2585
  });
2737
2586
  setError(message);
2738
- _optionalChain([onError, 'optionalCall', _81 => _81(message, "SOLANA_TRANSFER_ERROR")]);
2587
+ _optionalChain([onError, 'optionalCall', _78 => _78(message, "SOLANA_TRANSFER_ERROR")]);
2739
2588
  } finally {
2740
2589
  setIsSubmitting(false);
2741
2590
  }
2742
2591
  };
2743
2592
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
2744
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { padding: "0 12px 12px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.WalletIcon, {}), title: "Review deposit" }) }),
2593
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { padding: "0 12px 12px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.WalletIcon, {}), title: "Review deposit" }) }),
2745
2594
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-space-y-3", style: { paddingTop: 0 }, children: [
2746
2595
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card", children: [
2747
2596
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
@@ -2840,12 +2689,12 @@ function SolanaConfirmStep({
2840
2689
  ] })
2841
2690
  ] }),
2842
2691
  error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-alert rs-alert--error", children: [
2843
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.AlertTriangleIcon, { className: "rs-alert-icon" }),
2692
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.AlertTriangleIcon, { className: "rs-alert-icon" }),
2844
2693
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-alert-text", children: error })
2845
2694
  ] })
2846
2695
  ] }),
2847
2696
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2848
- _chunkFTMCKJM4cjs.Button,
2697
+ _chunkV6NJIPSScjs.Button,
2849
2698
  {
2850
2699
  onClick: handleConfirm,
2851
2700
  loading: isSubmitting,
@@ -2854,9 +2703,350 @@ function SolanaConfirmStep({
2854
2703
  children: "Continue"
2855
2704
  }
2856
2705
  ) }),
2857
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.PoweredBy, {})
2706
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
2707
+ ] });
2708
+ }
2709
+
2710
+ // src/components/steps/DappImportAssetSelectStep.tsx
2711
+
2712
+ function DappImportAssetSelectStep({
2713
+ sourceLabel,
2714
+ assets,
2715
+ onSelect
2716
+ }) {
2717
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
2718
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2719
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2720
+ _chunkV6NJIPSScjs.BodyHeader,
2721
+ {
2722
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.HandCoinsIcon, {}),
2723
+ title: `Transfer from ${sourceLabel}`,
2724
+ subtitle: "Pick the balance to import"
2725
+ }
2726
+ ),
2727
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list", children: assets.map((asset) => {
2728
+ const balanceTokens = asset.balance ? _chunkV6NJIPSScjs.tokenFormatter.format(
2729
+ Number(asset.balance) / 10 ** asset.decimals
2730
+ ) : "0";
2731
+ const balanceUsd = asset.balanceUsd && asset.balanceUsd > 0 ? _chunkV6NJIPSScjs.currencyFormatter.format(asset.balanceUsd) : `${balanceTokens} ${asset.symbol}`;
2732
+ const iconSrc = _chunkIVTXEYB2cjs.getTokenIcon.call(void 0, asset.symbol);
2733
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2734
+ _chunkV6NJIPSScjs.ListRow,
2735
+ {
2736
+ leadingMedia: iconSrc || void 0,
2737
+ leading: iconSrc ? void 0 : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.HandCoinsIcon, {}),
2738
+ title: asset.symbol,
2739
+ subtitle: `${balanceTokens} on ${_chunkIVTXEYB2cjs.getChainName.call(void 0, asset.chainId)}`,
2740
+ meta: balanceUsd,
2741
+ onClick: () => onSelect(asset)
2742
+ },
2743
+ asset.id
2744
+ );
2745
+ }) })
2746
+ ] }),
2747
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
2858
2748
  ] });
2859
2749
  }
2750
+ DappImportAssetSelectStep.displayName = "DappImportAssetSelectStep";
2751
+
2752
+ // src/core/dapp-imports/polymarket/index.ts
2753
+
2754
+
2755
+
2756
+ // src/core/dapp-imports/polymarket/constants.ts
2757
+ var POLYMARKET_POLYGON_CHAIN_ID = 137;
2758
+ var POLYMARKET_PUSD_ADDRESS = "0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB";
2759
+ var POLYMARKET_USDCE_ADDRESS = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174";
2760
+ var POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS = "0x2957922Eb93258b93368531d39fAcCA3B4dC5854";
2761
+ var SAFE_MULTI_SEND_CALL_ONLY_ADDRESS = "0x40A2aCCbd92BCA938b02010E17A5b8929b49130D";
2762
+ var GAMMA_API_PUBLIC_PROFILE = "https://gamma-api.polymarket.com/public-profile";
2763
+ var POLYMARKET_ICON_URL = "data:image/svg+xml,%3Csvg width='512' height='512' viewBox='0 0 512 512' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='512' height='512' fill='%232E5CFF'/%3E%3Cpath d='M375.84 389.422C375.84 403.572 375.84 410.647 371.212 414.154C366.585 417.662 359.773 415.75 346.15 411.927L127.22 350.493C119.012 348.19 114.907 347.038 112.534 343.907C110.161 340.776 110.161 336.513 110.161 327.988V184.012C110.161 175.487 110.161 171.224 112.534 168.093C114.907 164.962 119.012 163.81 127.22 161.507L346.15 100.072C359.773 96.2495 366.585 94.338 371.212 97.8455C375.84 101.353 375.84 108.428 375.84 122.578V389.422ZM164.761 330.463L346.035 381.337V279.595L164.761 330.463ZM139.963 306.862L321.201 256L139.963 205.138V306.862ZM164.759 181.537L346.035 232.406V130.663L164.759 181.537Z' fill='white'/%3E%3C/svg%3E";
2764
+
2765
+ // src/core/dapp-imports/polymarket/gamma-api.ts
2766
+
2767
+ async function fetchPolymarketProxyWallet(eoa, signal) {
2768
+ const url = `${GAMMA_API_PUBLIC_PROFILE}?address=${eoa}`;
2769
+ let response;
2770
+ try {
2771
+ response = await fetch(url, { signal });
2772
+ } catch (e24) {
2773
+ return null;
2774
+ }
2775
+ if (!response.ok) {
2776
+ return null;
2777
+ }
2778
+ let payload;
2779
+ try {
2780
+ payload = await response.json();
2781
+ } catch (e25) {
2782
+ return null;
2783
+ }
2784
+ const raw = payload.proxyWallet;
2785
+ if (!raw || !_viem.isAddress.call(void 0, raw)) {
2786
+ return null;
2787
+ }
2788
+ const checksummed = _viem.getAddress.call(void 0, raw);
2789
+ if (checksummed === _viem.zeroAddress) {
2790
+ return null;
2791
+ }
2792
+ return checksummed;
2793
+ }
2794
+
2795
+ // src/core/dapp-imports/polymarket/safe.ts
2796
+
2797
+
2798
+
2799
+
2800
+
2801
+
2802
+
2803
+
2804
+
2805
+
2806
+
2807
+ var COLLATERAL_OFFRAMP_ABI = _viem.parseAbi.call(void 0, [
2808
+ "function unwrap(address _asset, address _to, uint256 _amount)"
2809
+ ]);
2810
+ var MULTI_SEND_ABI = _viem.parseAbi.call(void 0, ["function multiSend(bytes transactions)"]);
2811
+ async function readPolymarketBalances(params) {
2812
+ const { publicClient, proxyWallet } = params;
2813
+ try {
2814
+ const results = await publicClient.multicall({
2815
+ allowFailure: true,
2816
+ contracts: [
2817
+ {
2818
+ address: POLYMARKET_PUSD_ADDRESS,
2819
+ abi: _viem.erc20Abi,
2820
+ functionName: "balanceOf",
2821
+ args: [proxyWallet]
2822
+ },
2823
+ {
2824
+ address: POLYMARKET_USDCE_ADDRESS,
2825
+ abi: _viem.erc20Abi,
2826
+ functionName: "balanceOf",
2827
+ args: [proxyWallet]
2828
+ }
2829
+ ]
2830
+ });
2831
+ return {
2832
+ pusd: results[0].status === "success" ? results[0].result : 0n,
2833
+ usdce: results[1].status === "success" ? results[1].result : 0n
2834
+ };
2835
+ } catch (e26) {
2836
+ return { pusd: 0n, usdce: 0n };
2837
+ }
2838
+ }
2839
+ async function executePolymarketSafeTransfer(params) {
2840
+ const {
2841
+ walletClient,
2842
+ publicClient,
2843
+ safeAddress,
2844
+ recipient,
2845
+ amount,
2846
+ tokenKind
2847
+ } = params;
2848
+ const account = walletClient.account;
2849
+ const chain = walletClient.chain;
2850
+ if (!account || !chain) {
2851
+ throw new Error("Wallet not connected");
2852
+ }
2853
+ if (chain.id !== POLYMARKET_POLYGON_CHAIN_ID) {
2854
+ throw new Error("Switch to Polygon to sign");
2855
+ }
2856
+ const isOwner = await publicClient.readContract({
2857
+ address: safeAddress,
2858
+ abi: _chunkV6NJIPSScjs.SAFE_ABI,
2859
+ functionName: "isOwner",
2860
+ args: [account.address]
2861
+ });
2862
+ if (!isOwner) {
2863
+ throw new Error("Connected wallet is not a Polymarket Safe owner");
2864
+ }
2865
+ const safeTx = tokenKind === "pusd" ? buildPusdUnwrapSafeTx(recipient, amount) : buildUsdceTransferSafeTx(recipient, amount);
2866
+ const signature = _viem.concat.call(void 0, [
2867
+ _viem.pad.call(void 0, account.address, { size: 32 }),
2868
+ _viem.pad.call(void 0, _viem.toHex.call(void 0, 0), { size: 32 }),
2869
+ _viem.toHex.call(void 0, 1, { size: 1 })
2870
+ ]);
2871
+ const txHash = await walletClient.writeContract({
2872
+ account,
2873
+ chain,
2874
+ address: safeAddress,
2875
+ abi: _chunkV6NJIPSScjs.SAFE_ABI,
2876
+ functionName: "execTransaction",
2877
+ args: [
2878
+ safeTx.to,
2879
+ 0n,
2880
+ safeTx.data,
2881
+ safeTx.operation,
2882
+ 0n,
2883
+ 0n,
2884
+ 0n,
2885
+ _viem.zeroAddress,
2886
+ _viem.zeroAddress,
2887
+ signature
2888
+ ]
2889
+ });
2890
+ const receipt = await publicClient.waitForTransactionReceipt({
2891
+ hash: txHash
2892
+ });
2893
+ const parsed = _viem.parseEventLogs.call(void 0, {
2894
+ abi: _chunkV6NJIPSScjs.SAFE_ABI,
2895
+ logs: receipt.logs.filter(
2896
+ (log) => log.address.toLowerCase() === safeAddress.toLowerCase()
2897
+ ),
2898
+ strict: false
2899
+ });
2900
+ if (parsed.some((log) => log.eventName === "ExecutionFailure")) {
2901
+ throw new Error("Polymarket Safe transaction failed");
2902
+ }
2903
+ if (!parsed.some((log) => log.eventName === "ExecutionSuccess")) {
2904
+ throw new Error("Polymarket Safe transaction status unavailable");
2905
+ }
2906
+ return {
2907
+ txHash,
2908
+ // The smart account always receives USDC.e — pUSD is unwrapped to USDC.e
2909
+ // before it lands at `recipient`.
2910
+ sourceToken: POLYMARKET_USDCE_ADDRESS,
2911
+ sourceSymbol: tokenKind === "pusd" ? "pUSD" : "USDC.e"
2912
+ };
2913
+ }
2914
+ function buildUsdceTransferSafeTx(recipient, amount) {
2915
+ return {
2916
+ to: POLYMARKET_USDCE_ADDRESS,
2917
+ data: _viem.encodeFunctionData.call(void 0, {
2918
+ abi: _viem.erc20Abi,
2919
+ functionName: "transfer",
2920
+ args: [recipient, amount]
2921
+ }),
2922
+ operation: 0
2923
+ };
2924
+ }
2925
+ function buildPusdUnwrapSafeTx(recipient, amount) {
2926
+ const approveData = _viem.encodeFunctionData.call(void 0, {
2927
+ abi: _viem.erc20Abi,
2928
+ functionName: "approve",
2929
+ args: [POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS, amount]
2930
+ });
2931
+ const unwrapData = _viem.encodeFunctionData.call(void 0, {
2932
+ abi: COLLATERAL_OFFRAMP_ABI,
2933
+ functionName: "unwrap",
2934
+ args: [POLYMARKET_USDCE_ADDRESS, recipient, amount]
2935
+ });
2936
+ return {
2937
+ to: SAFE_MULTI_SEND_CALL_ONLY_ADDRESS,
2938
+ data: _viem.encodeFunctionData.call(void 0, {
2939
+ abi: MULTI_SEND_ABI,
2940
+ functionName: "multiSend",
2941
+ args: [
2942
+ _viem.concat.call(void 0, [
2943
+ encodeMultiSendCall(POLYMARKET_PUSD_ADDRESS, approveData),
2944
+ encodeMultiSendCall(POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS, unwrapData)
2945
+ ])
2946
+ ]
2947
+ }),
2948
+ operation: 1
2949
+ };
2950
+ }
2951
+ function encodeMultiSendCall(to, data) {
2952
+ return _viem.encodePacked.call(void 0,
2953
+ ["uint8", "address", "uint256", "uint256", "bytes"],
2954
+ [0, to, 0n, BigInt((data.length - 2) / 2), data]
2955
+ );
2956
+ }
2957
+
2958
+ // src/core/dapp-imports/polymarket/index.ts
2959
+ var PROVIDER_ID = "polymarket";
2960
+ var polymarketProvider = {
2961
+ id: PROVIDER_ID,
2962
+ label: "Transfer from Polymarket",
2963
+ icon: _react.createElement.call(void 0, "img", {
2964
+ src: POLYMARKET_ICON_URL,
2965
+ alt: "Polymarket",
2966
+ style: { width: 24, height: 24, borderRadius: 6 }
2967
+ }),
2968
+ chainId: POLYMARKET_POLYGON_CHAIN_ID,
2969
+ async fetchAvailability({ eoa, getPublicClient: getPublicClient2, signal }) {
2970
+ const proxyWallet = await fetchPolymarketProxyWallet(eoa, signal);
2971
+ if (!proxyWallet) return null;
2972
+ if (_optionalChain([signal, 'optionalAccess', _79 => _79.aborted])) return null;
2973
+ const polygonClient = getPublicClient2(POLYMARKET_POLYGON_CHAIN_ID);
2974
+ if (!polygonClient) return null;
2975
+ const balances = await readPolymarketBalances({
2976
+ publicClient: polygonClient,
2977
+ proxyWallet
2978
+ });
2979
+ if (_optionalChain([signal, 'optionalAccess', _80 => _80.aborted])) return null;
2980
+ if (balances.pusd === 0n && balances.usdce === 0n) return null;
2981
+ const assets = [];
2982
+ if (balances.pusd > 0n) {
2983
+ assets.push(buildAsset({ tokenKind: "pusd", proxyWallet, balance: balances.pusd }));
2984
+ }
2985
+ if (balances.usdce > 0n) {
2986
+ assets.push(buildAsset({ tokenKind: "usdce", proxyWallet, balance: balances.usdce }));
2987
+ }
2988
+ const totalUsd = assets.reduce((sum, a) => sum + (_nullishCoalesce(a.balanceUsd, () => ( 0))), 0);
2989
+ const availability = {
2990
+ providerId: PROVIDER_ID,
2991
+ totalUsd,
2992
+ assets
2993
+ };
2994
+ return availability;
2995
+ },
2996
+ async executeTransfer({ walletClient, publicClient, recipient, asset, amount }) {
2997
+ const metadata = asset.providerMetadata;
2998
+ const result = await executePolymarketSafeTransfer({
2999
+ walletClient,
3000
+ publicClient,
3001
+ safeAddress: metadata.proxyWallet,
3002
+ recipient,
3003
+ amount,
3004
+ tokenKind: metadata.tokenKind
3005
+ });
3006
+ return {
3007
+ txHash: result.txHash,
3008
+ sourceToken: result.sourceToken,
3009
+ sourceSymbol: result.sourceSymbol,
3010
+ sourceDecimals: 6
3011
+ };
3012
+ }
3013
+ };
3014
+ function buildAsset(params) {
3015
+ const { tokenKind, proxyWallet, balance } = params;
3016
+ const isPusd = tokenKind === "pusd";
3017
+ const tokenAddress = isPusd ? POLYMARKET_PUSD_ADDRESS : POLYMARKET_USDCE_ADDRESS;
3018
+ const symbol = isPusd ? "pUSD" : "USDC.e";
3019
+ const balanceUsd = Number(_viem.formatUnits.call(void 0, balance, 6));
3020
+ const metadata = { proxyWallet, tokenKind };
3021
+ return {
3022
+ id: `polymarket:${tokenKind}`,
3023
+ chainId: POLYMARKET_POLYGON_CHAIN_ID,
3024
+ token: tokenAddress,
3025
+ symbol,
3026
+ name: isPusd ? "Polymarket USD" : "Polygon USDC.e",
3027
+ decimals: 6,
3028
+ balance: balance.toString(),
3029
+ balanceUsd: Number.isFinite(balanceUsd) ? balanceUsd : 0,
3030
+ source: PROVIDER_ID,
3031
+ sourceLabel: "Polymarket",
3032
+ reviewLabel: isPusd ? "You send pUSD from Polymarket" : "You send USDC.e from Polymarket",
3033
+ // pUSD unwraps to USDC.e via the offramp; USDC.e is what actually
3034
+ // arrives at the smart account, so it's also what the orchestrator
3035
+ // bridges from.
3036
+ depositToken: POLYMARKET_USDCE_ADDRESS,
3037
+ depositChainId: POLYMARKET_POLYGON_CHAIN_ID,
3038
+ providerMetadata: metadata
3039
+ };
3040
+ }
3041
+
3042
+ // src/core/dapp-imports/registry.ts
3043
+ var DAPP_IMPORT_PROVIDERS = [polymarketProvider];
3044
+ function getEnabledProviders(config) {
3045
+ if (!config) return [];
3046
+ return DAPP_IMPORT_PROVIDERS.filter(
3047
+ (p) => config[p.id] === true
3048
+ );
3049
+ }
2860
3050
 
2861
3051
  // src/store/index.ts
2862
3052
 
@@ -2884,6 +3074,23 @@ var RESET_DEPOSIT_FIELDS = {
2884
3074
  sourceSymbol: null,
2885
3075
  sourceDecimals: null
2886
3076
  };
3077
+ function ownerKey(owner) {
3078
+ return owner.toString().toLowerCase();
3079
+ }
3080
+ function idleEntry(owner) {
3081
+ return {
3082
+ owner,
3083
+ requestKey: null,
3084
+ cacheKey: null,
3085
+ status: "idle",
3086
+ smartAccount: null,
3087
+ sessionOwnerAddress: null,
3088
+ solanaDepositAddress: null,
3089
+ message: null,
3090
+ cacheable: true,
3091
+ attemptNonce: 0
3092
+ };
3093
+ }
2887
3094
  function applyBack(state, hasWalletOptions) {
2888
3095
  const { step, mode } = state.flow;
2889
3096
  switch (step) {
@@ -2898,7 +3105,11 @@ function applyBack(state, hasWalletOptions) {
2898
3105
  balance: null,
2899
3106
  liquidityWarning: null
2900
3107
  },
2901
- flow: { ...state.flow, step: "select-asset", hasNavigatedBack: true }
3108
+ flow: {
3109
+ ...state.flow,
3110
+ step: mode === "dapp-import" ? "dapp-import-asset-select" : "select-asset",
3111
+ hasNavigatedBack: true
3112
+ }
2902
3113
  };
2903
3114
  case "confirm":
2904
3115
  return {
@@ -2940,37 +3151,70 @@ function applyBack(state, hasWalletOptions) {
2940
3151
  case "select-asset":
2941
3152
  case "deposit-address":
2942
3153
  case "solana-token-select":
3154
+ case "dapp-import-asset-select":
2943
3155
  return {
2944
3156
  ...state,
2945
3157
  flow: {
2946
3158
  ...state.flow,
2947
- step: "setup",
3159
+ step: "connect",
2948
3160
  mode: null,
2949
3161
  isConnectSelectionConfirmed: false,
2950
- hasNavigatedBack: hasWalletOptions ? true : state.flow.hasNavigatedBack
3162
+ hasNavigatedBack: true
2951
3163
  },
2952
- deposit: { ...state.deposit, ...RESET_DEPOSIT_FIELDS }
3164
+ deposit: { ...state.deposit, ...RESET_DEPOSIT_FIELDS },
3165
+ dappImport: {
3166
+ ...state.dappImport,
3167
+ activeProviderId: null,
3168
+ selectedAsset: null
3169
+ }
2953
3170
  };
3171
+ case "connect":
2954
3172
  case "setup":
2955
- if (mode !== null && hasWalletOptions) {
3173
+ if (mode !== null) {
2956
3174
  return {
2957
3175
  ...state,
2958
3176
  flow: {
2959
3177
  ...state.flow,
3178
+ step: "connect",
2960
3179
  mode: null,
2961
3180
  isConnectSelectionConfirmed: false,
2962
- hasNavigatedBack: true
3181
+ hasNavigatedBack: hasWalletOptions || state.flow.hasNavigatedBack
2963
3182
  }
2964
3183
  };
2965
3184
  }
2966
3185
  return state;
2967
- case "connect":
2968
3186
  case "processing":
2969
3187
  return state;
2970
3188
  default:
2971
3189
  return unreachable(step);
2972
3190
  }
2973
3191
  }
3192
+ function modeEntryStep(mode) {
3193
+ switch (mode) {
3194
+ case "wallet":
3195
+ return "select-asset";
3196
+ case "deposit-address":
3197
+ return "deposit-address";
3198
+ case "solana-wallet":
3199
+ return "solana-token-select";
3200
+ case "dapp-import":
3201
+ return "dapp-import-asset-select";
3202
+ }
3203
+ }
3204
+ function updateSetupEntry(state, owner, update) {
3205
+ const key = ownerKey(owner);
3206
+ const existing = _nullishCoalesce(state.setup.byOwner[key], () => ( idleEntry(owner)));
3207
+ return {
3208
+ ...state,
3209
+ setup: {
3210
+ ...state.setup,
3211
+ byOwner: {
3212
+ ...state.setup.byOwner,
3213
+ [key]: update(existing)
3214
+ }
3215
+ }
3216
+ };
3217
+ }
2974
3218
  function applyAction(state, action) {
2975
3219
  switch (action.type) {
2976
3220
  case "flow/mode-set":
@@ -2995,16 +3239,22 @@ function applyAction(state, action) {
2995
3239
  mode: null,
2996
3240
  isConnectSelectionConfirmed: false
2997
3241
  },
2998
- wallet: { ...state.wallet, selectedWalletId: null }
3242
+ wallet: { ...state.wallet, selectedWalletId: null },
3243
+ dappImport: {
3244
+ ...state.dappImport,
3245
+ activeProviderId: null,
3246
+ selectedAsset: null
3247
+ }
2999
3248
  };
3000
3249
  case "connect/wallet-confirmed":
3250
+ if (!action.mode) return state;
3001
3251
  return {
3002
3252
  ...state,
3003
3253
  flow: {
3004
3254
  ...state.flow,
3005
3255
  mode: action.mode,
3006
3256
  isConnectSelectionConfirmed: true,
3007
- step: "setup"
3257
+ step: modeEntryStep(action.mode)
3008
3258
  },
3009
3259
  wallet: { ...state.wallet, selectedWalletId: action.walletId }
3010
3260
  };
@@ -3015,7 +3265,7 @@ function applyAction(state, action) {
3015
3265
  ...state.flow,
3016
3266
  mode: "deposit-address",
3017
3267
  isConnectSelectionConfirmed: true,
3018
- step: "setup"
3268
+ step: "deposit-address"
3019
3269
  }
3020
3270
  };
3021
3271
  case "connect/auto-locked":
@@ -3025,23 +3275,81 @@ function applyAction(state, action) {
3025
3275
  ...state.flow,
3026
3276
  mode: "wallet",
3027
3277
  isConnectSelectionConfirmed: true,
3028
- step: "setup"
3278
+ step: "select-asset"
3029
3279
  }
3030
3280
  };
3031
- case "setup/complete":
3281
+ case "connect/wallet-picker-requested":
3032
3282
  return {
3033
3283
  ...state,
3034
- deposit: {
3035
- ...state.deposit,
3036
- smartAccount: action.smartAccount,
3037
- smartAccountOwner: action.smartAccountOwner,
3038
- solanaDepositAddress: _nullishCoalesce(action.solanaDepositAddress, () => ( null))
3039
- },
3040
3284
  flow: {
3041
3285
  ...state.flow,
3042
- step: state.flow.mode === "deposit-address" ? "deposit-address" : state.flow.mode === "solana-wallet" ? "solana-token-select" : "select-asset"
3286
+ step: "connect",
3287
+ mode: null,
3288
+ isConnectSelectionConfirmed: false,
3289
+ hasNavigatedBack: true
3290
+ },
3291
+ deposit: { ...state.deposit, ...RESET_DEPOSIT_FIELDS },
3292
+ dappImport: {
3293
+ ...state.dappImport,
3294
+ activeProviderId: null,
3295
+ selectedAsset: null
3043
3296
  }
3044
3297
  };
3298
+ case "setup/started": {
3299
+ const existing = state.setup.byOwner[ownerKey(action.owner)];
3300
+ return updateSetupEntry(state, action.owner, () => ({
3301
+ owner: action.owner,
3302
+ requestKey: action.requestKey,
3303
+ cacheKey: action.cacheKey,
3304
+ status: "loading",
3305
+ smartAccount: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _81 => _81.smartAccount]), () => ( null)),
3306
+ sessionOwnerAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _82 => _82.sessionOwnerAddress]), () => ( null)),
3307
+ solanaDepositAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _83 => _83.solanaDepositAddress]), () => ( null)),
3308
+ message: null,
3309
+ cacheable: action.cacheable,
3310
+ attemptNonce: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _84 => _84.attemptNonce]), () => ( 0))
3311
+ }));
3312
+ }
3313
+ case "setup/ready": {
3314
+ const key = ownerKey(action.owner);
3315
+ const existing = state.setup.byOwner[key];
3316
+ if (!existing || existing.requestKey !== action.requestKey) {
3317
+ return state;
3318
+ }
3319
+ return updateSetupEntry(state, action.owner, (entry) => ({
3320
+ ...entry,
3321
+ status: "ready",
3322
+ smartAccount: action.result.smartAccount,
3323
+ sessionOwnerAddress: action.result.sessionOwnerAddress,
3324
+ solanaDepositAddress: _nullishCoalesce(action.result.solanaDepositAddress, () => ( null)),
3325
+ cacheKey: action.result.cacheKey,
3326
+ message: null
3327
+ }));
3328
+ }
3329
+ case "setup/failed": {
3330
+ const key = ownerKey(action.owner);
3331
+ const existing = state.setup.byOwner[key];
3332
+ if (!existing || existing.requestKey !== action.requestKey) {
3333
+ return state;
3334
+ }
3335
+ return updateSetupEntry(state, action.owner, (entry) => ({
3336
+ ...entry,
3337
+ status: "error",
3338
+ message: action.message
3339
+ }));
3340
+ }
3341
+ case "setup/retry-requested":
3342
+ return updateSetupEntry(state, action.owner, (entry) => ({
3343
+ ...entry,
3344
+ status: "idle",
3345
+ // Clear requestKey/cacheKey so the BG effect's
3346
+ // "entry.requestKey !== currentRequestKey" check passes even when
3347
+ // inputs haven't changed.
3348
+ requestKey: null,
3349
+ cacheKey: null,
3350
+ message: null,
3351
+ attemptNonce: entry.attemptNonce + 1
3352
+ }));
3045
3353
  case "asset/selected":
3046
3354
  return {
3047
3355
  ...state,
@@ -3112,27 +3420,109 @@ function applyAction(state, action) {
3112
3420
  },
3113
3421
  flow: { ...state.flow, step: "processing" }
3114
3422
  };
3115
- case "back/requested":
3116
- return applyBack(state, action.hasWalletOptions);
3117
- case "flow/reset":
3423
+ case "dapp-import/availability-loading":
3118
3424
  return {
3119
3425
  ...state,
3120
- flow: {
3121
- step: "setup",
3122
- mode: null,
3123
- isConnectSelectionConfirmed: false,
3124
- hasNavigatedBack: false
3125
- },
3126
- wallet: {
3127
- selectedWalletId: null
3128
- },
3129
- deposit: { ...state.deposit, ...RESET_DEPOSIT_FIELDS },
3130
- processing: {
3131
- txHash: null,
3132
- directTransfer: false
3426
+ dappImport: {
3427
+ ...state.dappImport,
3428
+ availabilityOwner: action.owner,
3429
+ availability: {
3430
+ ...state.dappImport.availabilityOwner && ownerKey(state.dappImport.availabilityOwner) === ownerKey(action.owner) ? state.dappImport.availability : {},
3431
+ [action.providerId]: "loading"
3432
+ }
3133
3433
  }
3134
3434
  };
3135
- case "target/changed":
3435
+ case "dapp-import/availability-loaded":
3436
+ if (!state.dappImport.availabilityOwner || ownerKey(state.dappImport.availabilityOwner) !== ownerKey(action.owner)) {
3437
+ return state;
3438
+ }
3439
+ return {
3440
+ ...state,
3441
+ dappImport: {
3442
+ ...state.dappImport,
3443
+ availability: {
3444
+ ...state.dappImport.availability,
3445
+ [action.providerId]: action.availability
3446
+ }
3447
+ }
3448
+ };
3449
+ case "dapp-import/availability-cleared":
3450
+ return {
3451
+ ...state,
3452
+ dappImport: {
3453
+ ...state.dappImport,
3454
+ availabilityOwner: null,
3455
+ availability: {},
3456
+ activeProviderId: null,
3457
+ selectedAsset: null
3458
+ }
3459
+ };
3460
+ case "dapp-import/provider-selected":
3461
+ return {
3462
+ ...state,
3463
+ flow: {
3464
+ ...state.flow,
3465
+ mode: "dapp-import",
3466
+ isConnectSelectionConfirmed: true,
3467
+ step: "dapp-import-asset-select"
3468
+ },
3469
+ dappImport: {
3470
+ ...state.dappImport,
3471
+ activeProviderId: action.providerId,
3472
+ selectedAsset: null
3473
+ }
3474
+ };
3475
+ case "dapp-import/asset-selected":
3476
+ return {
3477
+ ...state,
3478
+ deposit: {
3479
+ ...state.deposit,
3480
+ selectedAsset: action.asset
3481
+ },
3482
+ dappImport: {
3483
+ ...state.dappImport,
3484
+ selectedAsset: action.asset
3485
+ },
3486
+ flow: { ...state.flow, step: "amount" }
3487
+ };
3488
+ case "back/requested":
3489
+ return applyBack(state, action.hasWalletOptions);
3490
+ case "flow/reset": {
3491
+ const preservedByOwner = {};
3492
+ for (const [key, entry] of Object.entries(state.setup.byOwner)) {
3493
+ if (entry.status === "ready" && entry.smartAccount && entry.cacheKey && entry.cacheable) {
3494
+ preservedByOwner[key] = { ...entry, message: null };
3495
+ } else {
3496
+ preservedByOwner[key] = idleEntry(entry.owner);
3497
+ }
3498
+ }
3499
+ return {
3500
+ ...state,
3501
+ flow: {
3502
+ step: "connect",
3503
+ mode: null,
3504
+ isConnectSelectionConfirmed: false,
3505
+ hasNavigatedBack: false
3506
+ },
3507
+ wallet: {
3508
+ selectedWalletId: null
3509
+ },
3510
+ deposit: { ...state.deposit, ...RESET_DEPOSIT_FIELDS },
3511
+ processing: {
3512
+ txHash: null,
3513
+ directTransfer: false
3514
+ },
3515
+ // Preserve fetched availability for its recorded EOA — refetching on
3516
+ // every modal close burns a request. Just clear active selection.
3517
+ dappImport: {
3518
+ ...state.dappImport,
3519
+ activeProviderId: null,
3520
+ selectedAsset: null
3521
+ },
3522
+ setup: { byOwner: preservedByOwner }
3523
+ };
3524
+ }
3525
+ case "target/changed": {
3136
3526
  if (state.flow.step === "processing") {
3137
3527
  return {
3138
3528
  ...state,
@@ -3143,18 +3533,20 @@ function applyAction(state, action) {
3143
3533
  }
3144
3534
  };
3145
3535
  }
3536
+ const nextStep = state.flow.step === "confirm" ? "amount" : state.flow.step;
3146
3537
  return {
3147
3538
  ...state,
3148
3539
  deposit: {
3149
3540
  ...state.deposit,
3150
3541
  targetChain: action.targetChain,
3151
3542
  targetToken: action.targetToken,
3152
- smartAccount: null,
3153
- smartAccountOwner: null,
3154
- solanaDepositAddress: null
3543
+ targetAmount: null,
3544
+ targetTokenPriceUsd: null,
3545
+ liquidityWarning: null
3155
3546
  },
3156
- flow: { ...state.flow, step: "setup" }
3547
+ flow: { ...state.flow, step: nextStep }
3157
3548
  };
3549
+ }
3158
3550
  default:
3159
3551
  return unreachable(action);
3160
3552
  }
@@ -3173,9 +3565,6 @@ function createInitialState(overrides) {
3173
3565
  selectedWalletId: null
3174
3566
  },
3175
3567
  deposit: {
3176
- smartAccount: null,
3177
- smartAccountOwner: null,
3178
- solanaDepositAddress: null,
3179
3568
  targetChain: overrides.targetChain,
3180
3569
  targetToken: overrides.targetToken,
3181
3570
  sourceChain: null,
@@ -3195,12 +3584,38 @@ function createInitialState(overrides) {
3195
3584
  processing: {
3196
3585
  txHash: null,
3197
3586
  directTransfer: false
3587
+ },
3588
+ dappImport: {
3589
+ activeProviderId: null,
3590
+ availabilityOwner: null,
3591
+ availability: {},
3592
+ selectedAsset: null
3593
+ },
3594
+ setup: {
3595
+ byOwner: {}
3198
3596
  }
3199
3597
  };
3200
3598
  }
3201
3599
 
3202
3600
  // src/store/selectors.ts
3203
3601
  var selectedWalletIdSelector = (state) => state.wallet.selectedWalletId;
3602
+ var IDLE_SETUP_ENTRY = {
3603
+ owner: null,
3604
+ requestKey: null,
3605
+ cacheKey: null,
3606
+ status: "idle",
3607
+ smartAccount: null,
3608
+ sessionOwnerAddress: null,
3609
+ solanaDepositAddress: null,
3610
+ message: null,
3611
+ cacheable: true,
3612
+ attemptNonce: 0
3613
+ };
3614
+ function readSetupForOwner(setup, owner) {
3615
+ if (!owner) return IDLE_SETUP_ENTRY;
3616
+ const entry = setup.byOwner[owner.toLowerCase()];
3617
+ return _nullishCoalesce(entry, () => ( { ...IDLE_SETUP_ENTRY, owner }));
3618
+ }
3204
3619
 
3205
3620
  // src/store/index.ts
3206
3621
  function createDepositStore(overrides) {
@@ -3237,8 +3652,275 @@ function useDepositStore(selector) {
3237
3652
  return _zustand.useStore.call(void 0, store, selector);
3238
3653
  }
3239
3654
 
3655
+ // src/core/account-setup.ts
3656
+ var SetupError = class extends Error {
3657
+ constructor(message, category) {
3658
+ super(message);
3659
+ this.category = category;
3660
+ this.name = "SetupError";
3661
+ }
3662
+ };
3663
+ async function resolveSessionOwner(eoaAddress) {
3664
+ const local = _chunkV6NJIPSScjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
3665
+ if (local) {
3666
+ return {
3667
+ account: _chunkV6NJIPSScjs.accountFromPrivateKey.call(void 0, local.privateKey),
3668
+ address: local.address
3669
+ };
3670
+ }
3671
+ const created = _chunkV6NJIPSScjs.createSessionOwnerKey.call(void 0, );
3672
+ _chunkV6NJIPSScjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
3673
+ return { account: created.account, address: created.address };
3674
+ }
3675
+ function stableStringify(value) {
3676
+ if (value === null || typeof value !== "object") {
3677
+ return JSON.stringify(value);
3678
+ }
3679
+ if (Array.isArray(value)) {
3680
+ return `[${value.map(stableStringify).join(",")}]`;
3681
+ }
3682
+ const obj = value;
3683
+ const keys = Object.keys(obj).sort();
3684
+ const entries = keys.filter((k) => obj[k] !== void 0).map((k) => `${JSON.stringify(k)}:${stableStringify(obj[k])}`);
3685
+ return `{${entries.join(",")}}`;
3686
+ }
3687
+ function computeRequestKey(input, sessionOwnerAddress) {
3688
+ return stableStringify({
3689
+ ownerAddress: input.ownerAddress.toLowerCase(),
3690
+ sessionOwnerAddress: sessionOwnerAddress.toLowerCase(),
3691
+ targetChain: input.targetChain,
3692
+ targetToken: input.targetToken.toLowerCase(),
3693
+ recipient: _optionalChain([input, 'access', _85 => _85.recipient, 'optionalAccess', _86 => _86.toLowerCase, 'call', _87 => _87()]),
3694
+ outputTokenRules: _nullishCoalesce(input.outputTokenRules, () => ( null)),
3695
+ rejectUnmapped: _nullishCoalesce(input.rejectUnmapped, () => ( null)),
3696
+ signerAddress: input.signerAddress.toLowerCase(),
3697
+ sessionChainIds: _nullishCoalesce(input.sessionChainIds, () => ( null)),
3698
+ enableSolana: _nullishCoalesce(input.enableSolana, () => ( true)),
3699
+ forceRegister: _nullishCoalesce(input.forceRegister, () => ( false)),
3700
+ postBridgeActions: _nullishCoalesce(input.postBridgeActions, () => ( null))
3701
+ });
3702
+ }
3703
+ function computeCacheKey(input, sessionOwnerAddress) {
3704
+ return stableStringify({
3705
+ ownerAddress: input.ownerAddress.toLowerCase(),
3706
+ sessionOwnerAddress: sessionOwnerAddress.toLowerCase(),
3707
+ targetChain: input.targetChain,
3708
+ targetToken: input.targetToken.toLowerCase(),
3709
+ recipient: _optionalChain([input, 'access', _88 => _88.recipient, 'optionalAccess', _89 => _89.toLowerCase, 'call', _90 => _90()]),
3710
+ outputTokenRules: _nullishCoalesce(input.outputTokenRules, () => ( null)),
3711
+ rejectUnmapped: _nullishCoalesce(input.rejectUnmapped, () => ( null)),
3712
+ signerAddress: input.signerAddress.toLowerCase(),
3713
+ sessionChainIds: _nullishCoalesce(input.sessionChainIds, () => ( null)),
3714
+ enableSolana: _nullishCoalesce(input.enableSolana, () => ( true))
3715
+ });
3716
+ }
3717
+ function computeIsCacheable(input) {
3718
+ return !input.forceRegister && !(_nullishCoalesce(_optionalChain([input, 'access', _91 => _91.postBridgeActions, 'optionalAccess', _92 => _92.length]), () => ( 0)));
3719
+ }
3720
+ var SETUP_REQUEST_DEDUPE_TTL_MS = 3e4;
3721
+ var setupRequestDedupe = /* @__PURE__ */ new Map();
3722
+ function readDedupedAccountSetupResult(requestKey) {
3723
+ const now = Date.now();
3724
+ const existing = setupRequestDedupe.get(requestKey);
3725
+ if (_optionalChain([existing, 'optionalAccess', _93 => _93.settled]) && existing.expiresAt > now && existing.result) {
3726
+ return existing.result;
3727
+ }
3728
+ return null;
3729
+ }
3730
+ async function runAccountSetup(input, deps) {
3731
+ const { service, debug } = deps;
3732
+ const enableSolana = _nullishCoalesce(input.enableSolana, () => ( true));
3733
+ try {
3734
+ const sessionOwner = await resolveSessionOwner(input.ownerAddress);
3735
+ const cacheKey = computeCacheKey(input, sessionOwner.address);
3736
+ _chunkV6NJIPSScjs.debugLog.call(void 0, debug, "account-setup", "setup:start", {
3737
+ owner: input.ownerAddress,
3738
+ sessionOwner: sessionOwner.address,
3739
+ hasPostBridgeActions: Boolean(_optionalChain([input, 'access', _94 => _94.postBridgeActions, 'optionalAccess', _95 => _95.length])),
3740
+ forceRegister: _nullishCoalesce(input.forceRegister, () => ( false))
3741
+ });
3742
+ const setup = await service.setupAccount({
3743
+ ownerAddress: input.ownerAddress,
3744
+ sessionOwnerAddress: sessionOwner.address,
3745
+ targetChain: _chunkV6NJIPSScjs.toEvmCaip2.call(void 0, input.targetChain),
3746
+ targetToken: input.targetToken,
3747
+ recipient: input.recipient,
3748
+ postBridgeActions: input.postBridgeActions,
3749
+ outputTokenRules: input.outputTokenRules,
3750
+ rejectUnmapped: input.rejectUnmapped,
3751
+ signerAddress: input.signerAddress,
3752
+ sessionChainIds: input.sessionChainIds,
3753
+ forceRegister: input.forceRegister
3754
+ });
3755
+ const smartAccount = setup.smartAccount;
3756
+ if (!setup.needsRegistration) {
3757
+ return {
3758
+ smartAccount,
3759
+ sessionOwnerAddress: sessionOwner.address,
3760
+ solanaDepositAddress: enableSolana ? setup.solanaDepositAddress : void 0,
3761
+ cacheKey,
3762
+ isRegistered: true
3763
+ };
3764
+ }
3765
+ if (!setup.accountParams || !setup.sessionDetailsUnsigned) {
3766
+ throw new SetupError(
3767
+ "Couldn't prepare account.",
3768
+ "server"
3769
+ );
3770
+ }
3771
+ if (!sessionOwner.account.signTypedData) {
3772
+ throw new SetupError(
3773
+ "Couldn't prepare account.",
3774
+ "client"
3775
+ );
3776
+ }
3777
+ const typedData = setup.sessionDetailsUnsigned.data;
3778
+ const signature = await sessionOwner.account.signTypedData({
3779
+ domain: typedData.domain,
3780
+ types: typedData.types,
3781
+ primaryType: typedData.primaryType,
3782
+ message: typedData.message
3783
+ });
3784
+ const sessionDetails = _chunkV6NJIPSScjs.buildSessionDetails.call(void 0,
3785
+ setup.sessionDetailsUnsigned,
3786
+ signature
3787
+ );
3788
+ const registerResult = await service.registerAccount({
3789
+ address: smartAccount,
3790
+ accountParams: {
3791
+ factory: setup.accountParams.factory,
3792
+ factoryData: setup.accountParams.factoryData,
3793
+ sessionDetails
3794
+ },
3795
+ eoaAddress: input.ownerAddress,
3796
+ sessionOwner: sessionOwner.address,
3797
+ target: {
3798
+ chain: _chunkV6NJIPSScjs.toEvmCaip2.call(void 0, input.targetChain),
3799
+ token: input.targetToken,
3800
+ ...input.recipient && { recipient: input.recipient },
3801
+ ..._optionalChain([input, 'access', _96 => _96.postBridgeActions, 'optionalAccess', _97 => _97.length]) && {
3802
+ postBridgeActions: input.postBridgeActions
3803
+ },
3804
+ ..._optionalChain([input, 'access', _98 => _98.outputTokenRules, 'optionalAccess', _99 => _99.length]) && {
3805
+ outputTokenRules: input.outputTokenRules
3806
+ },
3807
+ ...input.rejectUnmapped != null && {
3808
+ rejectUnmapped: input.rejectUnmapped
3809
+ }
3810
+ }
3811
+ });
3812
+ return {
3813
+ smartAccount,
3814
+ sessionOwnerAddress: sessionOwner.address,
3815
+ solanaDepositAddress: enableSolana ? registerResult.solanaDepositAddress : void 0,
3816
+ cacheKey,
3817
+ isRegistered: true
3818
+ };
3819
+ } catch (error) {
3820
+ _chunkV6NJIPSScjs.debugError.call(void 0, debug, "account-setup", "setup:failed", error, {
3821
+ owner: input.ownerAddress
3822
+ });
3823
+ if (error instanceof SetupError) throw error;
3824
+ throw mapError(error);
3825
+ }
3826
+ }
3827
+ function runAccountSetupDeduped(input, deps, requestKey) {
3828
+ const now = Date.now();
3829
+ const existing = setupRequestDedupe.get(requestKey);
3830
+ if (existing && (!existing.settled || existing.expiresAt > now)) {
3831
+ _chunkV6NJIPSScjs.debugLog.call(void 0, deps.debug, "account-setup", "setup:dedupe-hit", {
3832
+ owner: input.ownerAddress,
3833
+ forceRegister: _nullishCoalesce(input.forceRegister, () => ( false))
3834
+ });
3835
+ return existing.promise;
3836
+ }
3837
+ const entry = {
3838
+ promise: runAccountSetup(input, deps),
3839
+ settled: false,
3840
+ expiresAt: Number.POSITIVE_INFINITY,
3841
+ result: null
3842
+ };
3843
+ setupRequestDedupe.set(requestKey, entry);
3844
+ entry.promise.then((result) => {
3845
+ entry.settled = true;
3846
+ entry.result = result;
3847
+ entry.expiresAt = Date.now() + SETUP_REQUEST_DEDUPE_TTL_MS;
3848
+ const cleanupTimer = setTimeout(() => {
3849
+ if (setupRequestDedupe.get(requestKey) === entry) {
3850
+ setupRequestDedupe.delete(requestKey);
3851
+ }
3852
+ }, SETUP_REQUEST_DEDUPE_TTL_MS);
3853
+ if (typeof cleanupTimer === "object" && cleanupTimer && "unref" in cleanupTimer && typeof cleanupTimer.unref === "function") {
3854
+ cleanupTimer.unref();
3855
+ }
3856
+ }).catch(() => {
3857
+ if (setupRequestDedupe.get(requestKey) === entry) {
3858
+ setupRequestDedupe.delete(requestKey);
3859
+ }
3860
+ });
3861
+ return entry.promise;
3862
+ }
3863
+ function mapError(error) {
3864
+ if (error instanceof TypeError) {
3865
+ return new SetupError(
3866
+ "Couldn't reach the deposit service. Please check your connection.",
3867
+ "network"
3868
+ );
3869
+ }
3870
+ if (error instanceof Error) {
3871
+ const statusMatch = error.message.match(/\b(4\d{2}|5\d{2})\b/);
3872
+ if (statusMatch) {
3873
+ const status = Number(statusMatch[1]);
3874
+ if (status >= 500) {
3875
+ return new SetupError(
3876
+ "Deposit service is temporarily unavailable. Please try again shortly.",
3877
+ "server"
3878
+ );
3879
+ }
3880
+ return new SetupError("Couldn't prepare account.", "client");
3881
+ }
3882
+ return new SetupError(
3883
+ "Deposit service is temporarily unavailable. Please try again shortly.",
3884
+ "unknown"
3885
+ );
3886
+ }
3887
+ return new SetupError(
3888
+ "Deposit service is temporarily unavailable. Please try again shortly.",
3889
+ "unknown"
3890
+ );
3891
+ }
3892
+
3240
3893
  // src/DepositFlow.tsx
3241
3894
 
3895
+ function AccountPreparingSkeleton({
3896
+ errorMessage,
3897
+ onRetry
3898
+ }) {
3899
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
3900
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-body", style: { paddingTop: 0 }, 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: errorMessage ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
3901
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t prepare account" }),
3902
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: errorMessage })
3903
+ ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "Preparing\u2026" }) }) }) }),
3904
+ errorMessage && onRetry && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3905
+ "button",
3906
+ {
3907
+ type: "button",
3908
+ className: "rs-button rs-button--default rs-button--full-width",
3909
+ onClick: onRetry,
3910
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Try again" })
3911
+ }
3912
+ ) })
3913
+ ] });
3914
+ }
3915
+ function SetupUpdatingBanner({
3916
+ status,
3917
+ message
3918
+ }) {
3919
+ if (status === "error") {
3920
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", role: "alert", children: _nullishCoalesce(message, () => ( "Couldn't update deposit details \u2014 please retry.")) });
3921
+ }
3922
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-state", style: { padding: "8px 16px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-text", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "Updating deposit details\u2026" }) }) });
3923
+ }
3242
3924
  var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
3243
3925
  function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
3244
3926
  return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
@@ -3246,37 +3928,39 @@ function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
3246
3928
  function getAddressKey(address) {
3247
3929
  return address ? address.toLowerCase() : null;
3248
3930
  }
3249
- function deriveStep(flow, d, p) {
3931
+ function deriveStep(flow, d, p, activeEntry) {
3250
3932
  const flowStep = flow.step;
3933
+ const smartAccount = activeEntry.smartAccount;
3934
+ const solanaDepositAddress = activeEntry.solanaDepositAddress;
3251
3935
  switch (flowStep) {
3252
3936
  case "connect":
3253
3937
  case "setup":
3254
3938
  return { type: "setup" };
3255
3939
  case "deposit-address":
3256
- if (!d.smartAccount) return { type: "setup" };
3940
+ if (!smartAccount) return { type: "setup" };
3257
3941
  return {
3258
3942
  type: "deposit-address",
3259
- smartAccount: d.smartAccount,
3260
- solanaDepositAddress: _nullishCoalesce(d.solanaDepositAddress, () => ( void 0))
3943
+ smartAccount,
3944
+ solanaDepositAddress: _nullishCoalesce(solanaDepositAddress, () => ( void 0))
3261
3945
  };
3262
3946
  case "select-asset":
3263
- if (!d.smartAccount) return { type: "setup" };
3264
- return { type: "select-asset", smartAccount: d.smartAccount };
3947
+ if (!smartAccount) return { type: "setup" };
3948
+ return { type: "select-asset", smartAccount };
3265
3949
  case "amount":
3266
- if (!d.smartAccount || !d.selectedAsset) return { type: "setup" };
3950
+ if (!smartAccount || !d.selectedAsset) return { type: "setup" };
3267
3951
  return {
3268
3952
  type: "amount",
3269
- smartAccount: d.smartAccount,
3953
+ smartAccount,
3270
3954
  asset: d.selectedAsset,
3271
3955
  amount: _nullishCoalesce(d.amount, () => ( void 0))
3272
3956
  };
3273
3957
  case "confirm":
3274
- if (!d.smartAccount || !d.selectedAsset || !d.amount || !d.targetAmount) {
3958
+ if (!smartAccount || !d.selectedAsset || !d.amount || !d.targetAmount) {
3275
3959
  return { type: "setup" };
3276
3960
  }
3277
3961
  return {
3278
3962
  type: "confirm",
3279
- smartAccount: d.smartAccount,
3963
+ smartAccount,
3280
3964
  asset: d.selectedAsset,
3281
3965
  amount: d.amount,
3282
3966
  targetAmount: d.targetAmount,
@@ -3285,33 +3969,36 @@ function deriveStep(flow, d, p) {
3285
3969
  liquidityWarning: _nullishCoalesce(d.liquidityWarning, () => ( void 0))
3286
3970
  };
3287
3971
  case "solana-token-select":
3288
- if (!d.smartAccount || !d.solanaDepositAddress) return { type: "setup" };
3972
+ if (!smartAccount || !solanaDepositAddress) return { type: "setup" };
3289
3973
  return {
3290
3974
  type: "solana-token-select",
3291
- smartAccount: d.smartAccount,
3292
- solanaDepositAddress: d.solanaDepositAddress
3975
+ smartAccount,
3976
+ solanaDepositAddress
3293
3977
  };
3294
3978
  case "solana-amount":
3295
- if (!d.smartAccount || !d.solanaDepositAddress || !d.selectedSolanaToken || d.balance === null || d.balanceUsd === null) {
3979
+ if (!smartAccount || !solanaDepositAddress || !d.selectedSolanaToken || d.balance === null || d.balanceUsd === null) {
3296
3980
  return { type: "setup" };
3297
3981
  }
3298
3982
  return {
3299
3983
  type: "solana-amount",
3300
- smartAccount: d.smartAccount,
3301
- solanaDepositAddress: d.solanaDepositAddress,
3984
+ smartAccount,
3985
+ solanaDepositAddress,
3302
3986
  token: d.selectedSolanaToken,
3303
3987
  balance: d.balance,
3304
3988
  balanceUsd: d.balanceUsd,
3305
3989
  inputAmountUsd: _nullishCoalesce(d.inputAmountUsd, () => ( void 0))
3306
3990
  };
3991
+ case "dapp-import-asset-select":
3992
+ if (!smartAccount) return { type: "setup" };
3993
+ return { type: "dapp-import-asset-select", smartAccount };
3307
3994
  case "solana-confirm":
3308
- if (!d.smartAccount || !d.solanaDepositAddress || !d.selectedSolanaToken || !d.amount || !d.inputAmountUsd || !d.targetAmount || d.balance === null || d.balanceUsd === null) {
3995
+ if (!smartAccount || !solanaDepositAddress || !d.selectedSolanaToken || !d.amount || !d.inputAmountUsd || !d.targetAmount || d.balance === null || d.balanceUsd === null) {
3309
3996
  return { type: "setup" };
3310
3997
  }
3311
3998
  return {
3312
3999
  type: "solana-confirm",
3313
- smartAccount: d.smartAccount,
3314
- solanaDepositAddress: d.solanaDepositAddress,
4000
+ smartAccount,
4001
+ solanaDepositAddress,
3315
4002
  token: d.selectedSolanaToken,
3316
4003
  sourceAmount: d.amount,
3317
4004
  inputAmountUsd: d.inputAmountUsd,
@@ -3321,13 +4008,13 @@ function deriveStep(flow, d, p) {
3321
4008
  balanceUsd: d.balanceUsd
3322
4009
  };
3323
4010
  case "processing":
3324
- if (!d.smartAccount || !p.txHash || !d.amount || d.sourceChain === null || d.sourceChain === "unknown" || !d.sourceToken) {
4011
+ if (!smartAccount || !p.txHash || !d.amount || d.sourceChain === null || d.sourceChain === "unknown" || !d.sourceToken) {
3325
4012
  return { type: "setup" };
3326
4013
  }
3327
4014
  return {
3328
4015
  type: "processing",
3329
- smartAccount: d.smartAccount,
3330
- solanaDepositAddress: _nullishCoalesce(d.solanaDepositAddress, () => ( void 0)),
4016
+ smartAccount,
4017
+ solanaDepositAddress: _nullishCoalesce(solanaDepositAddress, () => ( void 0)),
3331
4018
  txHash: p.txHash,
3332
4019
  sourceChain: d.sourceChain,
3333
4020
  sourceToken: d.sourceToken,
@@ -3338,6 +4025,19 @@ function deriveStep(flow, d, p) {
3338
4025
  };
3339
4026
  }
3340
4027
  }
4028
+ function resolveOwnerForMode(mode, ctx) {
4029
+ switch (mode) {
4030
+ case "deposit-address":
4031
+ case "solana-wallet":
4032
+ return _nullishCoalesce(ctx.dappAddress, () => ( null));
4033
+ case "wallet":
4034
+ return _nullishCoalesce(ctx.walletOwner, () => ( null));
4035
+ case "dapp-import":
4036
+ return _nullishCoalesce(ctx.dappImportOwner, () => ( null));
4037
+ default:
4038
+ return null;
4039
+ }
4040
+ }
3341
4041
  function DepositFlow({
3342
4042
  dappWalletClient,
3343
4043
  dappPublicClient,
@@ -3358,6 +4058,7 @@ function DepositFlow({
3358
4058
  forceRegister = false,
3359
4059
  waitForFinalTx = true,
3360
4060
  enableSolana = true,
4061
+ dappImports,
3361
4062
  reownWallet,
3362
4063
  onConnect,
3363
4064
  onDisconnect,
@@ -3371,12 +4072,12 @@ function DepositFlow({
3371
4072
  onError,
3372
4073
  debug
3373
4074
  }) {
3374
- const onStepChangeRef = _chunkFTMCKJM4cjs.useLatestRef.call(void 0, onStepChange);
3375
- const onEventRef = _chunkFTMCKJM4cjs.useLatestRef.call(void 0, onEvent);
3376
- const onLifecycleRef = _chunkFTMCKJM4cjs.useLatestRef.call(void 0, onLifecycle);
3377
- const onErrorRef = _chunkFTMCKJM4cjs.useLatestRef.call(void 0, onError);
4075
+ const onStepChangeRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onStepChange);
4076
+ const onEventRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onEvent);
4077
+ const onLifecycleRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onLifecycle);
4078
+ const onErrorRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onError);
3378
4079
  const hasInitialReownSession = Boolean(
3379
- enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _82 => _82.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _83 => _83.address]) : _optionalChain([reownWallet, 'optionalAccess', _84 => _84.address])
4080
+ enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _100 => _100.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _101 => _101.address]) : _optionalChain([reownWallet, 'optionalAccess', _102 => _102.address])
3380
4081
  );
3381
4082
  const hasInitialWalletHydrationPending = Boolean(
3382
4083
  dappAddress && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasInitialReownSession && !reownWallet.isReady)
@@ -3385,26 +4086,11 @@ function DepositFlow({
3385
4086
  const flowSlice = useDepositStore((s) => s.flow);
3386
4087
  const depositSlice = useDepositStore((s) => s.deposit);
3387
4088
  const processingSlice = useDepositStore((s) => s.processing);
3388
- const step = _react.useMemo.call(void 0,
3389
- () => deriveStep(flowSlice, depositSlice, processingSlice),
3390
- [flowSlice, depositSlice, processingSlice]
3391
- );
4089
+ const setupSlice = useDepositStore((s) => s.setup);
3392
4090
  const flowMode = flowSlice.mode;
3393
4091
  const isConnectSelectionConfirmed = flowSlice.isConnectSelectionConfirmed;
3394
4092
  const hasNavigatedBack = flowSlice.hasNavigatedBack;
3395
4093
  const selectedWalletId = useDepositStore(selectedWalletIdSelector);
3396
- const setFlowMode = _react.useCallback.call(void 0,
3397
- (mode) => storeApi.dispatch({ type: "flow/mode-set", mode }),
3398
- [storeApi]
3399
- );
3400
- const setIsConnectSelectionConfirmed = _react.useCallback.call(void 0,
3401
- (value) => storeApi.dispatch({ type: "flow/connect-confirmed-set", value }),
3402
- [storeApi]
3403
- );
3404
- const setSelectedWalletId = _react.useCallback.call(void 0,
3405
- (walletId) => storeApi.dispatch({ type: "wallet/id-selected", walletId }),
3406
- [storeApi]
3407
- );
3408
4094
  const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
3409
4095
  const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = _react.useState.call(void 0, () => !hasInitialWalletHydrationPending);
3410
4096
  const portfolioAssetsRef = _react.useRef.call(void 0, []);
@@ -3412,13 +4098,13 @@ function DepositFlow({
3412
4098
  const stableWalletSelectionKeyRef = _react.useRef.call(void 0, null);
3413
4099
  const logFlow = _react.useCallback.call(void 0,
3414
4100
  (message, data) => {
3415
- _chunkFTMCKJM4cjs.debugLog.call(void 0, debug, "deposit-flow", message, data);
4101
+ _chunkV6NJIPSScjs.debugLog.call(void 0, debug, "deposit-flow", message, data);
3416
4102
  },
3417
4103
  [debug]
3418
4104
  );
3419
4105
  const logFlowError = _react.useCallback.call(void 0,
3420
4106
  (message, error, data) => {
3421
- _chunkFTMCKJM4cjs.debugError.call(void 0, debug, "deposit-flow", message, error, data);
4107
+ _chunkV6NJIPSScjs.debugError.call(void 0, debug, "deposit-flow", message, error, data);
3422
4108
  },
3423
4109
  [debug]
3424
4110
  );
@@ -3434,19 +4120,19 @@ function DepositFlow({
3434
4120
  _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals)
3435
4121
  );
3436
4122
  if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
3437
- } catch (e24) {
4123
+ } catch (e27) {
3438
4124
  }
3439
4125
  }
3440
4126
  }
3441
4127
  return null;
3442
4128
  }, []);
3443
4129
  const dappSwitchChain = _react.useMemo.call(void 0, () => {
3444
- if (!_optionalChain([dappWalletClient, 'optionalAccess', _85 => _85.switchChain])) return void 0;
4130
+ if (!_optionalChain([dappWalletClient, 'optionalAccess', _103 => _103.switchChain])) return void 0;
3445
4131
  return async (chainId) => {
3446
- await _optionalChain([dappWalletClient, 'access', _86 => _86.switchChain, 'optionalCall', _87 => _87({ id: chainId })]);
4132
+ await _optionalChain([dappWalletClient, 'access', _104 => _104.switchChain, 'optionalCall', _105 => _105({ id: chainId })]);
3447
4133
  };
3448
4134
  }, [dappWalletClient]);
3449
- const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _88 => _88.account, 'optionalAccess', _89 => _89.address]), () => ( null));
4135
+ const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _106 => _106.account, 'optionalAccess', _107 => _107.address]), () => ( null));
3450
4136
  const walletOptions = _react.useMemo.call(void 0, () => {
3451
4137
  const options = [];
3452
4138
  const seen = /* @__PURE__ */ new Set();
@@ -3460,7 +4146,7 @@ function DepositFlow({
3460
4146
  });
3461
4147
  seen.add(id);
3462
4148
  }
3463
- if (enableSolana && _optionalChain([reownWallet, 'optionalAccess', _90 => _90.isConnected]) && reownWallet.isSolana && reownWallet.solanaAddress && dappAddress) {
4149
+ if (enableSolana && _optionalChain([reownWallet, 'optionalAccess', _108 => _108.isConnected]) && reownWallet.isSolana && reownWallet.solanaAddress && dappAddress) {
3464
4150
  const id = _nullishCoalesce(reownWallet.caipAddress, () => ( `solana:${reownWallet.solanaAddress}`));
3465
4151
  if (!seen.has(id)) {
3466
4152
  options.push({
@@ -3472,7 +4158,7 @@ function DepositFlow({
3472
4158
  });
3473
4159
  seen.add(id);
3474
4160
  }
3475
- } else if (_optionalChain([reownWallet, 'optionalAccess', _91 => _91.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(`evm:${reownWallet.address.toLowerCase()}`)) {
4161
+ } else if (_optionalChain([reownWallet, 'optionalAccess', _109 => _109.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(`evm:${reownWallet.address.toLowerCase()}`)) {
3476
4162
  const id = `evm:${reownWallet.address.toLowerCase()}`;
3477
4163
  if (!seen.has(id)) {
3478
4164
  options.push({
@@ -3489,25 +4175,25 @@ function DepositFlow({
3489
4175
  }, [
3490
4176
  connectedWalletAddress,
3491
4177
  dappAddress,
3492
- _optionalChain([reownWallet, 'optionalAccess', _92 => _92.address]),
3493
- _optionalChain([reownWallet, 'optionalAccess', _93 => _93.isConnected]),
3494
- _optionalChain([reownWallet, 'optionalAccess', _94 => _94.walletClient]),
3495
- _optionalChain([reownWallet, 'optionalAccess', _95 => _95.publicClient]),
3496
- _optionalChain([reownWallet, 'optionalAccess', _96 => _96.icon]),
4178
+ _optionalChain([reownWallet, 'optionalAccess', _110 => _110.address]),
4179
+ _optionalChain([reownWallet, 'optionalAccess', _111 => _111.isConnected]),
4180
+ _optionalChain([reownWallet, 'optionalAccess', _112 => _112.walletClient]),
4181
+ _optionalChain([reownWallet, 'optionalAccess', _113 => _113.publicClient]),
4182
+ _optionalChain([reownWallet, 'optionalAccess', _114 => _114.icon]),
3497
4183
  enableSolana,
3498
- _optionalChain([reownWallet, 'optionalAccess', _97 => _97.isSolana]),
3499
- _optionalChain([reownWallet, 'optionalAccess', _98 => _98.solanaAddress]),
3500
- _optionalChain([reownWallet, 'optionalAccess', _99 => _99.caipAddress])
4184
+ _optionalChain([reownWallet, 'optionalAccess', _115 => _115.isSolana]),
4185
+ _optionalChain([reownWallet, 'optionalAccess', _116 => _116.solanaAddress]),
4186
+ _optionalChain([reownWallet, 'optionalAccess', _117 => _117.caipAddress])
3501
4187
  ]);
3502
- const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _100 => _100.account]) && dappAddress && !reownWallet;
4188
+ const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _118 => _118.account]) && dappAddress && !reownWallet;
3503
4189
  const hasWalletOptions = walletOptions.length > 0;
3504
4190
  const hasReownSession = Boolean(
3505
- enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _101 => _101.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _102 => _102.address]) : _optionalChain([reownWallet, 'optionalAccess', _103 => _103.address])
4191
+ enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _119 => _119.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _120 => _120.address]) : _optionalChain([reownWallet, 'optionalAccess', _121 => _121.address])
3506
4192
  );
3507
4193
  const isWalletHydrationPending = Boolean(
3508
4194
  dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
3509
4195
  );
3510
- const showConnectStep = flowMode === null && !canAutoLock && !isConnectSelectionConfirmed;
4196
+ const showConnectStep = flowMode === null && !isConnectSelectionConfirmed;
3511
4197
  _react.useEffect.call(void 0, () => {
3512
4198
  if (!isWalletHydrationPending) {
3513
4199
  setHasQrAutoAdvanceGraceElapsed(true);
@@ -3520,7 +4206,7 @@ function DepositFlow({
3520
4206
  return () => window.clearTimeout(timeout);
3521
4207
  }, [isWalletHydrationPending]);
3522
4208
  const walletSelectionKey = _react.useMemo.call(void 0, () => {
3523
- if (flowMode !== "wallet") return null;
4209
+ if (flowMode !== "wallet" && flowMode !== "dapp-import") return null;
3524
4210
  if (canAutoLock) {
3525
4211
  return getAddressKey(connectedWalletAddress);
3526
4212
  }
@@ -3542,16 +4228,16 @@ function DepositFlow({
3542
4228
  return {
3543
4229
  ownerAddress: dappAddress,
3544
4230
  walletClient: void 0,
3545
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFTMCKJM4cjs.getPublicClient.call(void 0, targetChain))),
4231
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkV6NJIPSScjs.getPublicClient.call(void 0, targetChain))),
3546
4232
  switchChain: void 0
3547
4233
  };
3548
4234
  }
3549
4235
  if (canAutoLock) {
3550
- const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _104 => _104.chain, 'optionalAccess', _105 => _105.id]), () => ( targetChain));
4236
+ const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _122 => _122.chain, 'optionalAccess', _123 => _123.id]), () => ( targetChain));
3551
4237
  return {
3552
4238
  ownerAddress: dappWalletClient.account.address,
3553
4239
  walletClient: dappWalletClient,
3554
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFTMCKJM4cjs.getPublicClient.call(void 0, fallbackChainId))),
4240
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkV6NJIPSScjs.getPublicClient.call(void 0, fallbackChainId))),
3555
4241
  switchChain: dappSwitchChain
3556
4242
  };
3557
4243
  }
@@ -3565,24 +4251,24 @@ function DepositFlow({
3565
4251
  return {
3566
4252
  ownerAddress: dappAddress,
3567
4253
  walletClient: void 0,
3568
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFTMCKJM4cjs.getPublicClient.call(void 0, targetChain))),
4254
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkV6NJIPSScjs.getPublicClient.call(void 0, targetChain))),
3569
4255
  switchChain: void 0
3570
4256
  };
3571
4257
  }
3572
- if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess', _106 => _106.account]) && selectedOption.address && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
3573
- const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _107 => _107.chain, 'optionalAccess', _108 => _108.id]), () => ( targetChain));
4258
+ if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess', _124 => _124.account]) && selectedOption.address && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
4259
+ const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _125 => _125.chain, 'optionalAccess', _126 => _126.id]), () => ( targetChain));
3574
4260
  return {
3575
4261
  ownerAddress: dappWalletClient.account.address,
3576
4262
  walletClient: dappWalletClient,
3577
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFTMCKJM4cjs.getPublicClient.call(void 0, fallbackChainId))),
4263
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkV6NJIPSScjs.getPublicClient.call(void 0, fallbackChainId))),
3578
4264
  switchChain: dappSwitchChain
3579
4265
  };
3580
4266
  }
3581
- if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess', _109 => _109.address]) && selectedOption.address && reownWallet.address.toLowerCase() === selectedOption.address.toLowerCase()) {
4267
+ if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess', _127 => _127.address]) && selectedOption.address && reownWallet.address.toLowerCase() === selectedOption.address.toLowerCase()) {
3582
4268
  return {
3583
4269
  ownerAddress: reownWallet.address,
3584
4270
  walletClient: reownWallet.walletClient,
3585
- publicClient: _nullishCoalesce(reownWallet.publicClient, () => ( _chunkFTMCKJM4cjs.getPublicClient.call(void 0, targetChain))),
4271
+ publicClient: _nullishCoalesce(reownWallet.publicClient, () => ( _chunkV6NJIPSScjs.getPublicClient.call(void 0, targetChain))),
3586
4272
  switchChain: reownWallet.switchChain
3587
4273
  };
3588
4274
  }
@@ -3600,7 +4286,7 @@ function DepositFlow({
3600
4286
  targetChain
3601
4287
  ]);
3602
4288
  _react.useEffect.call(void 0, () => {
3603
- if (flowMode !== "wallet") {
4289
+ if (flowMode !== "wallet" && flowMode !== "dapp-import") {
3604
4290
  stableWalletSelectionKeyRef.current = null;
3605
4291
  stableWalletSignerRef.current = null;
3606
4292
  return;
@@ -3620,11 +4306,11 @@ function DepositFlow({
3620
4306
  return {
3621
4307
  ownerAddress: dappAddress,
3622
4308
  walletClient: void 0,
3623
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFTMCKJM4cjs.getPublicClient.call(void 0, targetChain))),
4309
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkV6NJIPSScjs.getPublicClient.call(void 0, targetChain))),
3624
4310
  switchChain: void 0
3625
4311
  };
3626
4312
  }
3627
- if (flowMode !== "wallet") {
4313
+ if (flowMode !== "wallet" && flowMode !== "dapp-import") {
3628
4314
  return null;
3629
4315
  }
3630
4316
  if (walletSignerContext) {
@@ -3642,7 +4328,92 @@ function DepositFlow({
3642
4328
  walletSignerContext,
3643
4329
  walletSelectionKey
3644
4330
  ]);
3645
- const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _110 => _110.ownerAddress]))), () => ( null));
4331
+ const selectedEvmWalletOwner = _react.useMemo.call(void 0, () => {
4332
+ if (!selectedWalletId) return null;
4333
+ const opt = walletOptions.find((o) => o.id === selectedWalletId);
4334
+ if (_optionalChain([opt, 'optionalAccess', _128 => _128.kind]) === "external" && opt.address) {
4335
+ return opt.address;
4336
+ }
4337
+ if (_optionalChain([opt, 'optionalAccess', _129 => _129.kind]) === "connected" && opt.address) {
4338
+ return opt.address;
4339
+ }
4340
+ return null;
4341
+ }, [selectedWalletId, walletOptions]);
4342
+ const dappImportOwner = _react.useMemo.call(void 0, () => {
4343
+ if (selectedEvmWalletOwner) return selectedEvmWalletOwner;
4344
+ if (_optionalChain([reownWallet, 'optionalAccess', _130 => _130.address]) && reownWallet.isConnected) {
4345
+ return reownWallet.address;
4346
+ }
4347
+ if (connectedWalletAddress) return connectedWalletAddress;
4348
+ return null;
4349
+ }, [
4350
+ selectedEvmWalletOwner,
4351
+ _optionalChain([reownWallet, 'optionalAccess', _131 => _131.address]),
4352
+ _optionalChain([reownWallet, 'optionalAccess', _132 => _132.isConnected]),
4353
+ connectedWalletAddress
4354
+ ]);
4355
+ const activeOwner = _react.useMemo.call(void 0,
4356
+ () => resolveOwnerForMode(flowMode, {
4357
+ dappAddress,
4358
+ walletOwner: _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _133 => _133.ownerAddress]), () => ( (canAutoLock ? connectedWalletAddress : selectedEvmWalletOwner))),
4359
+ dappImportOwner
4360
+ }),
4361
+ [
4362
+ flowMode,
4363
+ dappAddress,
4364
+ _optionalChain([signerContext, 'optionalAccess', _134 => _134.ownerAddress]),
4365
+ canAutoLock,
4366
+ connectedWalletAddress,
4367
+ selectedEvmWalletOwner,
4368
+ dappImportOwner
4369
+ ]
4370
+ );
4371
+ const activeEntry = _react.useMemo.call(void 0,
4372
+ () => readSetupForOwner(setupSlice, activeOwner),
4373
+ [setupSlice, activeOwner]
4374
+ );
4375
+ const lastActiveSetupLifecycleKeyRef = _react.useRef.call(void 0, null);
4376
+ _react.useEffect.call(void 0, () => {
4377
+ if (!flowMode || !isConnectSelectionConfirmed) {
4378
+ lastActiveSetupLifecycleKeyRef.current = null;
4379
+ return;
4380
+ }
4381
+ if (!activeOwner || activeEntry.status !== "ready" || !activeEntry.smartAccount) {
4382
+ return;
4383
+ }
4384
+ const lifecycleKey = [
4385
+ activeOwner.toLowerCase(),
4386
+ activeEntry.smartAccount.toLowerCase(),
4387
+ _nullishCoalesce(activeEntry.solanaDepositAddress, () => ( ""))
4388
+ ].join(":");
4389
+ if (lastActiveSetupLifecycleKeyRef.current === lifecycleKey) {
4390
+ return;
4391
+ }
4392
+ lastActiveSetupLifecycleKeyRef.current = lifecycleKey;
4393
+ _optionalChain([onLifecycleRef, 'access', _135 => _135.current, 'optionalCall', _136 => _136({
4394
+ type: "smart-account-changed",
4395
+ evm: activeEntry.smartAccount,
4396
+ solana: _nullishCoalesce(activeEntry.solanaDepositAddress, () => ( null))
4397
+ })]);
4398
+ _optionalChain([onLifecycleRef, 'access', _137 => _137.current, 'optionalCall', _138 => _138({
4399
+ type: "connected",
4400
+ address: activeOwner,
4401
+ smartAccount: activeEntry.smartAccount
4402
+ })]);
4403
+ }, [
4404
+ flowMode,
4405
+ isConnectSelectionConfirmed,
4406
+ activeOwner,
4407
+ activeEntry.status,
4408
+ activeEntry.smartAccount,
4409
+ activeEntry.solanaDepositAddress,
4410
+ onLifecycleRef
4411
+ ]);
4412
+ const effectiveStep = _react.useMemo.call(void 0,
4413
+ () => deriveStep(flowSlice, depositSlice, processingSlice, activeEntry),
4414
+ [flowSlice, depositSlice, processingSlice, activeEntry]
4415
+ );
4416
+ const step = effectiveStep;
3646
4417
  const handleBack = _react.useCallback.call(void 0, () => {
3647
4418
  const stepBeforeBack = storeApi.getState().flow.step;
3648
4419
  storeApi.dispatch({
@@ -3653,14 +4424,14 @@ function DepositFlow({
3653
4424
  portfolioAssetsRef.current = [];
3654
4425
  }
3655
4426
  }, [storeApi, hasWalletOptions, reownWallet]);
3656
- const canGoBackFromHere = step.type === "deposit-address" || step.type === "solana-token-select" || step.type === "solana-amount" || step.type === "solana-confirm" || step.type === "amount" || step.type === "confirm" || step.type === "select-asset" && signerContext && !canAutoLock;
4427
+ const canGoBackFromHere = effectiveStep.type === "deposit-address" || effectiveStep.type === "solana-token-select" || effectiveStep.type === "solana-amount" || effectiveStep.type === "solana-confirm" || effectiveStep.type === "amount" || effectiveStep.type === "confirm" || effectiveStep.type === "dapp-import-asset-select" || effectiveStep.type === "select-asset" && signerContext && !canAutoLock;
3657
4428
  const currentBackHandler = canGoBackFromHere ? handleBack : void 0;
3658
- const currentScreen = showConnectStep ? "connect" : step.type;
4429
+ const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
3659
4430
  _react.useEffect.call(void 0, () => {
3660
- _optionalChain([onStepChangeRef, 'access', _111 => _111.current, 'optionalCall', _112 => _112(currentBackHandler, currentScreen)]);
4431
+ _optionalChain([onStepChangeRef, 'access', _139 => _139.current, 'optionalCall', _140 => _140(currentBackHandler, currentScreen)]);
3661
4432
  }, [currentBackHandler, currentScreen, onStepChangeRef]);
3662
- const stepSendToken = step.type === "amount" ? step.asset.symbol : null;
3663
- const stepOpenEventKey = step.type === "select-asset" ? "select-asset" : step.type === "deposit-address" ? "deposit-address" : step.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
4433
+ const stepSendToken = effectiveStep.type === "amount" ? effectiveStep.asset.symbol : null;
4434
+ const stepOpenEventKey = effectiveStep.type === "select-asset" ? "select-asset" : effectiveStep.type === "deposit-address" ? "deposit-address" : effectiveStep.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
3664
4435
  const lastStepOpenEventKeyRef = _react.useRef.call(void 0, null);
3665
4436
  _react.useEffect.call(void 0, () => {
3666
4437
  if (!stepOpenEventKey) {
@@ -3671,24 +4442,24 @@ function DepositFlow({
3671
4442
  return;
3672
4443
  }
3673
4444
  lastStepOpenEventKeyRef.current = stepOpenEventKey;
3674
- if (step.type === "select-asset") {
3675
- _optionalChain([onEventRef, 'access', _113 => _113.current, 'optionalCall', _114 => _114({
4445
+ if (effectiveStep.type === "select-asset") {
4446
+ _optionalChain([onEventRef, 'access', _141 => _141.current, 'optionalCall', _142 => _142({
3676
4447
  type: "deposit_modal_connected_wallet_select_source_open",
3677
4448
  total_balance_in_external_wallet: totalBalanceUsd,
3678
4449
  pred_balance: totalBalanceUsd
3679
4450
  })]);
3680
- } else if (step.type === "deposit-address") {
4451
+ } else if (effectiveStep.type === "deposit-address") {
3681
4452
  const chainName = _chunkIVTXEYB2cjs.getChainName.call(void 0, targetChain);
3682
4453
  const tokenSymbol = _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
3683
- _optionalChain([onEventRef, 'access', _115 => _115.current, 'optionalCall', _116 => _116({
4454
+ _optionalChain([onEventRef, 'access', _143 => _143.current, 'optionalCall', _144 => _144({
3684
4455
  type: "deposit_modal_transfer_crypto_open",
3685
4456
  default_chain: chainName,
3686
4457
  default_token: tokenSymbol,
3687
4458
  pred_balance: totalBalanceUsd
3688
4459
  })]);
3689
- } else if (step.type === "amount" && stepSendToken) {
4460
+ } else if (effectiveStep.type === "amount" && stepSendToken) {
3690
4461
  const receiveSymbol = _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
3691
- _optionalChain([onEventRef, 'access', _117 => _117.current, 'optionalCall', _118 => _118({
4462
+ _optionalChain([onEventRef, 'access', _145 => _145.current, 'optionalCall', _146 => _146({
3692
4463
  type: "deposit_modal_connected_wallet_enter_value_open",
3693
4464
  send_token: stepSendToken,
3694
4465
  receive_token: receiveSymbol,
@@ -3696,7 +4467,7 @@ function DepositFlow({
3696
4467
  })]);
3697
4468
  }
3698
4469
  }, [
3699
- step.type,
4470
+ effectiveStep.type,
3700
4471
  stepOpenEventKey,
3701
4472
  stepSendToken,
3702
4473
  targetChain,
@@ -3706,7 +4477,7 @@ function DepositFlow({
3706
4477
  ]);
3707
4478
  _react.useEffect.call(void 0, () => {
3708
4479
  logFlow("state:changed", {
3709
- step: step.type,
4480
+ step: effectiveStep.type,
3710
4481
  flowMode,
3711
4482
  targetChain,
3712
4483
  targetToken,
@@ -3716,29 +4487,183 @@ function DepositFlow({
3716
4487
  flowMode,
3717
4488
  logFlow,
3718
4489
  selectedWalletId,
3719
- step.type,
4490
+ effectiveStep.type,
3720
4491
  targetChain,
3721
4492
  targetToken
3722
4493
  ]);
3723
4494
  _react.useEffect.call(void 0, () => {
3724
- _optionalChain([onLifecycleRef, 'access', _119 => _119.current, 'optionalCall', _120 => _120({
4495
+ _optionalChain([onLifecycleRef, 'access', _147 => _147.current, 'optionalCall', _148 => _148({
3725
4496
  type: "balance-changed",
3726
4497
  totalUsd: totalBalanceUsd
3727
4498
  })]);
3728
4499
  }, [totalBalanceUsd, onLifecycleRef]);
3729
4500
  const isDepositAddressMode = flowMode === "deposit-address";
3730
4501
  const isSolanaWalletMode = flowMode === "solana-wallet";
3731
- const handleSelectProvider = _react.useCallback.call(void 0, () => {
3732
- setFlowMode("wallet");
3733
- }, [setFlowMode]);
3734
- const handleSelectSolanaWallet = _react.useCallback.call(void 0, () => {
3735
- setFlowMode("solana-wallet");
3736
- }, [setFlowMode]);
4502
+ const isDappImportMode = flowMode === "dapp-import";
3737
4503
  const handleSelectTransferCrypto = _react.useCallback.call(void 0, () => {
3738
- setFlowMode("deposit-address");
3739
- }, [setFlowMode]);
4504
+ storeApi.dispatch({ type: "connect/transfer-crypto-selected" });
4505
+ }, [storeApi]);
4506
+ const handleConfirmWallet = _react.useCallback.call(void 0,
4507
+ (walletId) => {
4508
+ const selectedOption = walletOptions.find((o) => o.id === walletId);
4509
+ const mode = enableSolana && _optionalChain([selectedOption, 'optionalAccess', _149 => _149.kind]) === "solana" ? "solana-wallet" : "wallet";
4510
+ storeApi.dispatch({
4511
+ type: "connect/wallet-confirmed",
4512
+ walletId,
4513
+ mode
4514
+ });
4515
+ },
4516
+ [walletOptions, enableSolana, storeApi]
4517
+ );
4518
+ const enabledDappImportProviders = _react.useMemo.call(void 0,
4519
+ () => getEnabledProviders(dappImports),
4520
+ [dappImports]
4521
+ );
4522
+ const handleSelectDappImport = _react.useCallback.call(void 0,
4523
+ (providerId) => {
4524
+ const owner = dappImportOwner;
4525
+ if (owner) {
4526
+ const wallet = walletOptions.find(
4527
+ (o) => _optionalChain([(_nullishCoalesce(o.address, () => ( null))), 'optionalAccess', _150 => _150.toLowerCase, 'call', _151 => _151()]) === owner.toLowerCase()
4528
+ );
4529
+ if (wallet) {
4530
+ storeApi.dispatch({
4531
+ type: "wallet/id-selected",
4532
+ walletId: wallet.id
4533
+ });
4534
+ }
4535
+ }
4536
+ storeApi.dispatch({
4537
+ type: "dapp-import/provider-selected",
4538
+ providerId
4539
+ });
4540
+ },
4541
+ [storeApi, walletOptions, dappImportOwner]
4542
+ );
4543
+ const handleDappImportAssetSelected = _react.useCallback.call(void 0,
4544
+ (asset) => {
4545
+ storeApi.dispatch({ type: "dapp-import/asset-selected", asset });
4546
+ },
4547
+ [storeApi]
4548
+ );
4549
+ _react.useEffect.call(void 0, () => {
4550
+ if (!dappImportOwner || enabledDappImportProviders.length === 0) {
4551
+ storeApi.dispatch({ type: "dapp-import/availability-cleared" });
4552
+ return;
4553
+ }
4554
+ const controller = new AbortController();
4555
+ for (const provider of enabledDappImportProviders) {
4556
+ storeApi.dispatch({
4557
+ type: "dapp-import/availability-loading",
4558
+ providerId: provider.id,
4559
+ owner: dappImportOwner
4560
+ });
4561
+ provider.fetchAvailability({
4562
+ eoa: dappImportOwner,
4563
+ getPublicClient: (chainId) => {
4564
+ try {
4565
+ return _chunkV6NJIPSScjs.getPublicClient.call(void 0, chainId);
4566
+ } catch (e28) {
4567
+ return null;
4568
+ }
4569
+ },
4570
+ signal: controller.signal
4571
+ }).then((availability) => {
4572
+ if (controller.signal.aborted) return;
4573
+ storeApi.dispatch({
4574
+ type: "dapp-import/availability-loaded",
4575
+ providerId: provider.id,
4576
+ owner: dappImportOwner,
4577
+ availability
4578
+ });
4579
+ }).catch(() => {
4580
+ if (controller.signal.aborted) return;
4581
+ storeApi.dispatch({
4582
+ type: "dapp-import/availability-loaded",
4583
+ providerId: provider.id,
4584
+ owner: dappImportOwner,
4585
+ availability: null
4586
+ });
4587
+ });
4588
+ }
4589
+ return () => controller.abort();
4590
+ }, [dappImportOwner, enabledDappImportProviders, storeApi]);
4591
+ const dappImportAvailability = useDepositStore((s) => s.dappImport.availability);
4592
+ const dappImportAvailabilityOwner = useDepositStore(
4593
+ (s) => s.dappImport.availabilityOwner
4594
+ );
4595
+ const activeDappImportProviderId = useDepositStore(
4596
+ (s) => s.dappImport.activeProviderId
4597
+ );
4598
+ const connectStepDappImports = _react.useMemo.call(void 0,
4599
+ () => enabledDappImportProviders.map((provider) => {
4600
+ const availabilityEntry = dappImportOwner && _optionalChain([dappImportAvailabilityOwner, 'optionalAccess', _152 => _152.toLowerCase, 'call', _153 => _153()]) === dappImportOwner.toLowerCase() ? dappImportAvailability[provider.id] : void 0;
4601
+ const dappImportSetup = readSetupForOwner(setupSlice, dappImportOwner);
4602
+ const baseRow = {
4603
+ id: provider.id,
4604
+ label: provider.label,
4605
+ icon: provider.icon
4606
+ };
4607
+ if (availabilityEntry === "loading" || availabilityEntry === void 0) {
4608
+ return { ...baseRow, status: "loading" };
4609
+ }
4610
+ if (availabilityEntry === null) {
4611
+ return {
4612
+ ...baseRow,
4613
+ status: { enabled: false, reason: "No balance" }
4614
+ };
4615
+ }
4616
+ if (dappImportSetup.status === "loading" || !dappImportOwner) {
4617
+ return { ...baseRow, status: "loading" };
4618
+ }
4619
+ if (dappImportSetup.status === "error") {
4620
+ return {
4621
+ ...baseRow,
4622
+ status: {
4623
+ enabled: false,
4624
+ reason: "Couldn't prepare account \u2014 tap to retry",
4625
+ retryable: true
4626
+ }
4627
+ };
4628
+ }
4629
+ return {
4630
+ ...baseRow,
4631
+ status: {
4632
+ enabled: true,
4633
+ balanceUsd: availabilityEntry.totalUsd
4634
+ }
4635
+ };
4636
+ }),
4637
+ [
4638
+ enabledDappImportProviders,
4639
+ dappImportAvailability,
4640
+ dappImportAvailabilityOwner,
4641
+ setupSlice,
4642
+ dappImportOwner
4643
+ ]
4644
+ );
4645
+ const activeDappImportProvider = _react.useMemo.call(void 0, () => {
4646
+ if (!activeDappImportProviderId) return null;
4647
+ return _nullishCoalesce(enabledDappImportProviders.find(
4648
+ (p) => p.id === activeDappImportProviderId
4649
+ ), () => ( null));
4650
+ }, [activeDappImportProviderId, enabledDappImportProviders]);
4651
+ const activeDappImportAvailability = _react.useMemo.call(void 0, () => {
4652
+ if (!activeDappImportProviderId) return null;
4653
+ if (!dappImportOwner || _optionalChain([dappImportAvailabilityOwner, 'optionalAccess', _154 => _154.toLowerCase, 'call', _155 => _155()]) !== dappImportOwner.toLowerCase()) {
4654
+ return null;
4655
+ }
4656
+ const entry = dappImportAvailability[activeDappImportProviderId];
4657
+ if (!entry || entry === "loading") return null;
4658
+ return entry;
4659
+ }, [
4660
+ activeDappImportProviderId,
4661
+ dappImportAvailability,
4662
+ dappImportAvailabilityOwner,
4663
+ dappImportOwner
4664
+ ]);
3740
4665
  const handleNewDeposit = _react.useCallback.call(void 0, () => {
3741
- _optionalChain([onLifecycleRef, 'access', _121 => _121.current, 'optionalCall', _122 => _122({
4666
+ _optionalChain([onLifecycleRef, 'access', _156 => _156.current, 'optionalCall', _157 => _157({
3742
4667
  type: "smart-account-changed",
3743
4668
  evm: null,
3744
4669
  solana: null
@@ -3748,62 +4673,147 @@ function DepositFlow({
3748
4673
  stableWalletSignerRef.current = null;
3749
4674
  stableWalletSelectionKeyRef.current = null;
3750
4675
  }, [onLifecycleRef, storeApi]);
3751
- const handleSetupComplete = _react.useCallback.call(void 0,
3752
- (smartAccount, solanaDepositAddress) => {
3753
- logFlow("setup:complete", {
3754
- smartAccount,
3755
- hasSolanaDepositAddress: Boolean(solanaDepositAddress),
3756
- flowMode: isDepositAddressMode ? "deposit-address" : isSolanaWalletMode ? "solana-wallet" : "wallet"
3757
- });
3758
- _optionalChain([onLifecycleRef, 'access', _123 => _123.current, 'optionalCall', _124 => _124({
3759
- type: "smart-account-changed",
3760
- evm: smartAccount,
3761
- solana: _nullishCoalesce(solanaDepositAddress, () => ( null))
3762
- })]);
3763
- if (isSolanaWalletMode && !solanaDepositAddress) {
3764
- _optionalChain([onErrorRef, 'access', _125 => _125.current, 'optionalCall', _126 => _126({
3765
- message: "Solana deposit address not available. Please try again.",
3766
- code: "SOLANA_SETUP_FAILED"
3767
- })]);
3768
- return;
3769
- }
3770
- if (!sessionKeyAddress) return;
3771
- storeApi.dispatch({
3772
- type: "setup/complete",
3773
- smartAccount,
3774
- smartAccountOwner: sessionKeyAddress,
3775
- solanaDepositAddress
3776
- });
3777
- },
4676
+ const setupInputBase = _react.useMemo.call(void 0,
4677
+ () => ({
4678
+ targetChain,
4679
+ targetToken,
4680
+ signerAddress,
4681
+ sessionChainIds,
4682
+ recipient,
4683
+ postBridgeActions,
4684
+ outputTokenRules,
4685
+ rejectUnmapped,
4686
+ forceRegister,
4687
+ enableSolana
4688
+ }),
3778
4689
  [
3779
- isDepositAddressMode,
3780
- isSolanaWalletMode,
3781
- logFlow,
3782
- onErrorRef,
3783
- onLifecycleRef,
3784
- sessionKeyAddress,
3785
- storeApi
4690
+ targetChain,
4691
+ targetToken,
4692
+ signerAddress,
4693
+ sessionChainIds,
4694
+ recipient,
4695
+ postBridgeActions,
4696
+ outputTokenRules,
4697
+ rejectUnmapped,
4698
+ forceRegister,
4699
+ enableSolana
3786
4700
  ]
3787
4701
  );
3788
- const cachedSetupCompatible = Boolean(
3789
- flowMode && depositSlice.smartAccount && depositSlice.smartAccountOwner && sessionKeyAddress && depositSlice.smartAccountOwner.toLowerCase() === sessionKeyAddress.toLowerCase() && (flowMode !== "solana-wallet" || depositSlice.solanaDepositAddress)
3790
- );
4702
+ const desiredOwnersKey = _react.useMemo.call(void 0, () => {
4703
+ const owners = [];
4704
+ const seen = /* @__PURE__ */ new Set();
4705
+ const push = (addr) => {
4706
+ if (!addr) return;
4707
+ const key = addr.toLowerCase();
4708
+ if (seen.has(key)) return;
4709
+ seen.add(key);
4710
+ owners.push(addr);
4711
+ };
4712
+ push(dappAddress);
4713
+ push(connectedWalletAddress);
4714
+ push(_optionalChain([reownWallet, 'optionalAccess', _158 => _158.address]));
4715
+ push(dappImportOwner);
4716
+ return owners;
4717
+ }, [
4718
+ dappAddress,
4719
+ connectedWalletAddress,
4720
+ _optionalChain([reownWallet, 'optionalAccess', _159 => _159.address]),
4721
+ dappImportOwner
4722
+ ]);
3791
4723
  _react.useEffect.call(void 0, () => {
3792
- if (flowSlice.step === "setup" && cachedSetupCompatible && depositSlice.smartAccount && sessionKeyAddress) {
3793
- storeApi.dispatch({
3794
- type: "setup/complete",
3795
- smartAccount: depositSlice.smartAccount,
3796
- smartAccountOwner: sessionKeyAddress,
3797
- solanaDepositAddress: _nullishCoalesce(depositSlice.solanaDepositAddress, () => ( void 0))
3798
- });
3799
- }
4724
+ desiredOwnersKey.forEach((owner) => {
4725
+ void (async () => {
4726
+ const input = {
4727
+ ownerAddress: owner,
4728
+ ...setupInputBase
4729
+ };
4730
+ let sessionOwner;
4731
+ try {
4732
+ sessionOwner = await resolveSessionOwner(owner);
4733
+ } catch (error) {
4734
+ _chunkV6NJIPSScjs.debugError.call(void 0,
4735
+ debug,
4736
+ "deposit-flow",
4737
+ "session-owner:resolve-failed",
4738
+ error,
4739
+ { owner }
4740
+ );
4741
+ return;
4742
+ }
4743
+ const requestKey = computeRequestKey(input, sessionOwner.address);
4744
+ const cacheKey = computeCacheKey(input, sessionOwner.address);
4745
+ const cacheable = computeIsCacheable(input);
4746
+ const current = readSetupForOwner(
4747
+ storeApi.getState().setup,
4748
+ owner
4749
+ );
4750
+ if (current.requestKey === requestKey) {
4751
+ return;
4752
+ }
4753
+ const dedupedResult = readDedupedAccountSetupResult(requestKey);
4754
+ if (dedupedResult) {
4755
+ storeApi.dispatch({
4756
+ type: "setup/started",
4757
+ owner,
4758
+ requestKey,
4759
+ cacheKey,
4760
+ cacheable
4761
+ });
4762
+ storeApi.dispatch({
4763
+ type: "setup/ready",
4764
+ owner,
4765
+ requestKey,
4766
+ result: {
4767
+ smartAccount: dedupedResult.smartAccount,
4768
+ sessionOwnerAddress: dedupedResult.sessionOwnerAddress,
4769
+ solanaDepositAddress: dedupedResult.solanaDepositAddress,
4770
+ cacheKey: dedupedResult.cacheKey
4771
+ }
4772
+ });
4773
+ return;
4774
+ }
4775
+ storeApi.dispatch({
4776
+ type: "setup/started",
4777
+ owner,
4778
+ requestKey,
4779
+ cacheKey,
4780
+ cacheable
4781
+ });
4782
+ try {
4783
+ const result = await runAccountSetupDeduped(
4784
+ input,
4785
+ { service, debug },
4786
+ requestKey
4787
+ );
4788
+ storeApi.dispatch({
4789
+ type: "setup/ready",
4790
+ owner,
4791
+ requestKey,
4792
+ result: {
4793
+ smartAccount: result.smartAccount,
4794
+ sessionOwnerAddress: result.sessionOwnerAddress,
4795
+ solanaDepositAddress: result.solanaDepositAddress,
4796
+ cacheKey: result.cacheKey
4797
+ }
4798
+ });
4799
+ } catch (error) {
4800
+ const message = error instanceof SetupError ? error.message : "Deposit service is temporarily unavailable. Please try again shortly.";
4801
+ storeApi.dispatch({
4802
+ type: "setup/failed",
4803
+ owner,
4804
+ requestKey,
4805
+ message
4806
+ });
4807
+ }
4808
+ })();
4809
+ });
3800
4810
  }, [
3801
- flowSlice.step,
3802
- cachedSetupCompatible,
3803
- depositSlice.smartAccount,
3804
- depositSlice.solanaDepositAddress,
3805
- sessionKeyAddress,
3806
- storeApi
4811
+ desiredOwnersKey,
4812
+ setupInputBase,
4813
+ service,
4814
+ debug,
4815
+ storeApi,
4816
+ setupSlice.byOwner
3807
4817
  ]);
3808
4818
  const handleDepositAddressSubmitted = _react.useCallback.call(void 0,
3809
4819
  (data) => {
@@ -3812,7 +4822,7 @@ function DepositFlow({
3812
4822
  sourceChain: data.sourceChain,
3813
4823
  amount: data.amount
3814
4824
  });
3815
- _optionalChain([onLifecycleRef, 'access', _127 => _127.current, 'optionalCall', _128 => _128({ type: "submitted", ...data })]);
4825
+ _optionalChain([onLifecycleRef, 'access', _160 => _160.current, 'optionalCall', _161 => _161({ type: "submitted", ...data })]);
3816
4826
  },
3817
4827
  [logFlow, onLifecycleRef]
3818
4828
  );
@@ -3869,7 +4879,7 @@ function DepositFlow({
3869
4879
  sourceSymbol: tokenAtSubmit.symbol,
3870
4880
  sourceDecimals: tokenAtSubmit.decimals
3871
4881
  });
3872
- _optionalChain([onLifecycleRef, 'access', _129 => _129.current, 'optionalCall', _130 => _130({
4882
+ _optionalChain([onLifecycleRef, 'access', _162 => _162.current, 'optionalCall', _163 => _163({
3873
4883
  type: "submitted",
3874
4884
  txHash,
3875
4885
  sourceChain: "solana",
@@ -3878,19 +4888,9 @@ function DepositFlow({
3878
4888
  },
3879
4889
  [logFlow, onLifecycleRef, storeApi]
3880
4890
  );
3881
- const handleConnected = _react.useCallback.call(void 0,
3882
- (addr, smartAccount) => {
3883
- _optionalChain([onLifecycleRef, 'access', _131 => _131.current, 'optionalCall', _132 => _132({
3884
- type: "connected",
3885
- address: addr,
3886
- smartAccount
3887
- })]);
3888
- },
3889
- [onLifecycleRef]
3890
- );
3891
4891
  const handleAssetContinue = _react.useCallback.call(void 0,
3892
4892
  (asset) => {
3893
- _optionalChain([onEventRef, 'access', _133 => _133.current, 'optionalCall', _134 => _134({
4893
+ _optionalChain([onEventRef, 'access', _164 => _164.current, 'optionalCall', _165 => _165({
3894
4894
  type: "deposit_modal_connected_wallet_select_source_cta_click",
3895
4895
  total_balance_in_external_wallet: totalBalanceUsd,
3896
4896
  pred_balance: totalBalanceUsd,
@@ -3908,6 +4908,11 @@ function DepositFlow({
3908
4908
  );
3909
4909
  const handleAmountContinue = _react.useCallback.call(void 0,
3910
4910
  (amount, targetAmount, balance, liquidityWarning) => {
4911
+ const entry = readSetupForOwner(
4912
+ storeApi.getState().setup,
4913
+ activeOwner
4914
+ );
4915
+ if (entry.status !== "ready") return;
3911
4916
  const targetSym = _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
3912
4917
  const isTargetStable = _chunkIVTXEYB2cjs.isStablecoinSymbol.call(void 0, targetSym);
3913
4918
  const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
@@ -3920,7 +4925,7 @@ function DepositFlow({
3920
4925
  liquidityWarning
3921
4926
  });
3922
4927
  },
3923
- [targetToken, targetChain, getTokenPriceUsd, storeApi]
4928
+ [targetToken, targetChain, getTokenPriceUsd, storeApi, activeOwner]
3924
4929
  );
3925
4930
  const handleDepositSubmitted = _react.useCallback.call(void 0,
3926
4931
  (txHash, chainId, amount, token) => {
@@ -3930,20 +4935,24 @@ function DepositFlow({
3930
4935
  sourceToken: token,
3931
4936
  amount
3932
4937
  });
4938
+ const asset = storeApi.getState().deposit.selectedAsset;
4939
+ const dappImport = asset && isDappImportAsset(asset) ? asset : null;
3933
4940
  storeApi.dispatch({
3934
4941
  type: "deposit/submitted",
3935
4942
  txHash,
3936
4943
  sourceChain: chainId,
3937
4944
  sourceToken: token,
3938
4945
  amount,
3939
- directTransfer: isSameRoute2(chainId, token, targetChain, targetToken)
4946
+ sourceSymbol: _optionalChain([dappImport, 'optionalAccess', _166 => _166.symbol]),
4947
+ sourceDecimals: _optionalChain([dappImport, 'optionalAccess', _167 => _167.decimals]),
4948
+ directTransfer: !dappImport && isSameRoute2(chainId, token, targetChain, targetToken)
3940
4949
  });
3941
4950
  },
3942
4951
  [logFlow, storeApi, targetChain, targetToken]
3943
4952
  );
3944
4953
  const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
3945
4954
  (txHash, sourceChain, amount) => {
3946
- _optionalChain([onLifecycleRef, 'access', _135 => _135.current, 'optionalCall', _136 => _136({
4955
+ _optionalChain([onLifecycleRef, 'access', _168 => _168.current, 'optionalCall', _169 => _169({
3947
4956
  type: "submitted",
3948
4957
  txHash,
3949
4958
  sourceChain,
@@ -3955,7 +4964,7 @@ function DepositFlow({
3955
4964
  const handleDepositComplete = _react.useCallback.call(void 0,
3956
4965
  (txHash, destinationTxHash, context) => {
3957
4966
  logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
3958
- _optionalChain([onLifecycleRef, 'access', _137 => _137.current, 'optionalCall', _138 => _138({
4967
+ _optionalChain([onLifecycleRef, 'access', _170 => _170.current, 'optionalCall', _171 => _171({
3959
4968
  type: "complete",
3960
4969
  txHash,
3961
4970
  destinationTxHash,
@@ -3967,27 +4976,20 @@ function DepositFlow({
3967
4976
  const handleDepositFailed = _react.useCallback.call(void 0,
3968
4977
  (txHash, error) => {
3969
4978
  logFlowError("deposit:failed", error, { txHash });
3970
- _optionalChain([onLifecycleRef, 'access', _139 => _139.current, 'optionalCall', _140 => _140({ type: "failed", txHash, error })]);
4979
+ _optionalChain([onLifecycleRef, 'access', _172 => _172.current, 'optionalCall', _173 => _173({ type: "failed", txHash, error })]);
3971
4980
  },
3972
4981
  [logFlowError, onLifecycleRef]
3973
4982
  );
3974
4983
  const handleError = _react.useCallback.call(void 0,
3975
4984
  (message, code) => {
3976
4985
  logFlowError("flow:error", message, { code });
3977
- _optionalChain([onErrorRef, 'access', _141 => _141.current, 'optionalCall', _142 => _142({ message, code })]);
4986
+ _optionalChain([onErrorRef, 'access', _174 => _174.current, 'optionalCall', _175 => _175({ message, code })]);
3978
4987
  },
3979
4988
  [logFlowError, onErrorRef]
3980
4989
  );
3981
4990
  const handleTotalBalanceComputed = _react.useCallback.call(void 0, (total) => {
3982
4991
  setTotalBalanceUsd(total);
3983
4992
  }, []);
3984
- const selectedWalletIdEffective = _react.useMemo.call(void 0, () => {
3985
- if (selectedWalletId) return selectedWalletId;
3986
- if (walletOptions.length === 1) {
3987
- return walletOptions[0].id;
3988
- }
3989
- return null;
3990
- }, [selectedWalletId, walletOptions]);
3991
4993
  const walletOptionsKey = _react.useMemo.call(void 0,
3992
4994
  () => walletOptions.map((option) => option.id).join(","),
3993
4995
  [walletOptions]
@@ -3999,11 +5001,11 @@ function DepositFlow({
3999
5001
  storeApi.dispatch({ type: "wallet/cleared" });
4000
5002
  const currentStep = storeApi.getState().flow.step;
4001
5003
  if (currentStep !== "processing" && currentStep !== "confirm" && currentStep !== "solana-confirm" && currentStep !== "amount" && currentStep !== "solana-amount") {
4002
- storeApi.dispatch({ type: "flow/step-set", step: "setup" });
5004
+ storeApi.dispatch({ type: "flow/step-set", step: "connect" });
4003
5005
  }
4004
5006
  }, [walletOptionsKey]);
4005
5007
  _react.useEffect.call(void 0, () => {
4006
- if (!showConnectStep && isConnectSelectionConfirmed && flowMode === "wallet" && !signerContext) {
5008
+ if (!showConnectStep && isConnectSelectionConfirmed && (flowMode === "wallet" || flowMode === "dapp-import") && !signerContext) {
4007
5009
  storeApi.dispatch({ type: "wallet/cleared" });
4008
5010
  }
4009
5011
  }, [showConnectStep, isConnectSelectionConfirmed, flowMode, signerContext, storeApi]);
@@ -4013,110 +5015,130 @@ function DepositFlow({
4013
5015
  }
4014
5016
  storeApi.dispatch({ type: "wallet/cleared" });
4015
5017
  if (storeApi.getState().flow.step !== "processing") {
4016
- storeApi.dispatch({ type: "flow/step-set", step: "setup" });
5018
+ storeApi.dispatch({ type: "flow/step-set", step: "connect" });
4017
5019
  }
4018
5020
  }, [enableSolana, flowMode, storeApi]);
4019
5021
  _react.useEffect.call(void 0, () => {
4020
5022
  if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode) {
4021
5023
  return;
4022
5024
  }
4023
- if (hasWalletOptions) {
4024
- const walletId = selectedWalletIdEffective;
4025
- if (walletId) {
4026
- const selectedOption = walletOptions.find((o) => o.id === walletId);
4027
- setSelectedWalletId(walletId);
4028
- if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _143 => _143.kind]) === "solana") {
4029
- handleSelectSolanaWallet();
4030
- } else {
4031
- handleSelectProvider();
4032
- }
4033
- setIsConnectSelectionConfirmed(true);
4034
- return;
4035
- }
4036
- }
4037
5025
  if (!hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
4038
5026
  handleSelectTransferCrypto();
4039
- setIsConnectSelectionConfirmed(true);
4040
5027
  }
4041
5028
  }, [
4042
5029
  hasWalletOptions,
4043
5030
  hasReownSession,
4044
5031
  hasQrAutoAdvanceGraceElapsed,
4045
- enableSolana,
4046
5032
  isConnectSelectionConfirmed,
4047
5033
  flowMode,
4048
5034
  hasNavigatedBack,
4049
- selectedWalletIdEffective,
4050
5035
  dappAddress,
4051
5036
  dappWalletClient,
4052
- walletOptions,
4053
- handleSelectProvider,
4054
- handleSelectSolanaWallet,
4055
- handleSelectTransferCrypto,
4056
- setSelectedWalletId,
4057
- setIsConnectSelectionConfirmed
5037
+ handleSelectTransferCrypto
4058
5038
  ]);
5039
+ const walletRows = _react.useMemo.call(void 0, () => {
5040
+ return walletOptions.map((option) => {
5041
+ const ownerForRow = option.kind === "solana" ? dappAddress : _nullishCoalesce(option.address, () => ( null));
5042
+ const entry = readSetupForOwner(setupSlice, _nullishCoalesce(ownerForRow, () => ( null)));
5043
+ const state = entry.status === "ready" ? "ready" : entry.status === "error" ? "error" : "loading";
5044
+ return {
5045
+ id: option.id,
5046
+ kind: option.kind,
5047
+ label: option.label,
5048
+ icon: option.icon,
5049
+ address: _nullishCoalesce(_nullishCoalesce(option.address, () => ( option.solanaAddress)), () => ( option.id)),
5050
+ state,
5051
+ errorReason: _nullishCoalesce(entry.message, () => ( void 0))
5052
+ };
5053
+ });
5054
+ }, [walletOptions, setupSlice, dappAddress]);
5055
+ const transferCryptoEntry = _react.useMemo.call(void 0,
5056
+ () => readSetupForOwner(setupSlice, dappAddress),
5057
+ [setupSlice, dappAddress]
5058
+ );
5059
+ const transferCryptoState = transferCryptoEntry.status === "ready" ? "ready" : transferCryptoEntry.status === "error" ? "error" : "loading";
5060
+ const handleRetrySetup = _react.useCallback.call(void 0,
5061
+ (owner) => {
5062
+ storeApi.dispatch({ type: "setup/retry-requested", owner });
5063
+ },
5064
+ [storeApi]
5065
+ );
4059
5066
  if (showConnectStep) {
4060
5067
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4061
- _chunkFTMCKJM4cjs.ConnectStep,
5068
+ _chunkV6NJIPSScjs.ConnectStep,
4062
5069
  {
4063
- walletOptions,
5070
+ walletRows,
5071
+ transferCryptoState: dappAddress ? transferCryptoState : void 0,
5072
+ transferCryptoErrorReason: dappAddress ? _nullishCoalesce(transferCryptoEntry.message, () => ( void 0)) : void 0,
4064
5073
  onSelectTransferCrypto: dappAddress ? () => {
5074
+ if (transferCryptoState === "error") {
5075
+ handleRetrySetup(dappAddress);
5076
+ return;
5077
+ }
5078
+ if (transferCryptoState !== "ready") return;
4065
5079
  handleSelectTransferCrypto();
4066
- setIsConnectSelectionConfirmed(true);
4067
5080
  } : void 0,
4068
5081
  onRequestConnect,
4069
5082
  onConnect,
4070
5083
  onDisconnect,
4071
5084
  onConfirmWallet: (walletId) => {
4072
- setSelectedWalletId(walletId);
4073
- const selectedOption = walletOptions.find(
4074
- (o) => o.id === walletId
5085
+ const row = walletRows.find((r) => r.id === walletId);
5086
+ const option = walletOptions.find((o) => o.id === walletId);
5087
+ if (!row || !option) return;
5088
+ if (row.state === "error") {
5089
+ const owner = option.kind === "solana" ? dappAddress : _nullishCoalesce(option.address, () => ( null));
5090
+ if (owner) handleRetrySetup(owner);
5091
+ return;
5092
+ }
5093
+ if (row.state !== "ready") return;
5094
+ handleConfirmWallet(walletId);
5095
+ },
5096
+ dappImports: connectStepDappImports,
5097
+ onSelectDappImport: (providerId) => {
5098
+ const dappImportEntry = readSetupForOwner(
5099
+ setupSlice,
5100
+ dappImportOwner
4075
5101
  );
4076
- if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _144 => _144.kind]) === "solana") {
4077
- handleSelectSolanaWallet();
4078
- } else {
4079
- handleSelectProvider();
5102
+ if (dappImportEntry.status === "error" && dappImportOwner) {
5103
+ handleRetrySetup(dappImportOwner);
5104
+ return;
4080
5105
  }
4081
- setIsConnectSelectionConfirmed(true);
5106
+ if (dappImportEntry.status !== "ready") return;
5107
+ handleSelectDappImport(providerId);
4082
5108
  }
4083
5109
  }
4084
5110
  ) });
4085
5111
  }
4086
5112
  if (isDepositAddressMode) {
4087
- if (!dappAddress || !sessionKeyAddress) return null;
5113
+ if (!dappAddress) return null;
5114
+ const isWalletPickerReachable = walletOptions.length > 0 || Boolean(reownWallet) || Boolean(onConnect);
5115
+ const showBanner = effectiveStep.type !== "setup" && (activeEntry.status === "loading" || activeEntry.status === "error");
4088
5116
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
4089
- step.type === "setup" && !cachedSetupCompatible && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4090
- SetupStep,
5117
+ showBanner && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5118
+ SetupUpdatingBanner,
4091
5119
  {
4092
- address: sessionKeyAddress,
4093
- targetChain,
4094
- targetToken,
4095
- signerAddress,
4096
- sessionChainIds,
4097
- recipient,
4098
- postBridgeActions,
4099
- outputTokenRules,
4100
- rejectUnmapped,
4101
- forceRegister,
4102
- enableSolana,
4103
- service,
4104
- onSetupComplete: handleSetupComplete,
4105
- onConnected: handleConnected,
4106
- onError: handleError
5120
+ status: activeEntry.status,
5121
+ message: _nullishCoalesce(activeEntry.message, () => ( void 0))
4107
5122
  }
4108
5123
  ),
4109
- step.type === "deposit-address" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5124
+ effectiveStep.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5125
+ AccountPreparingSkeleton,
5126
+ {
5127
+ errorMessage: activeEntry.status === "error" ? _nullishCoalesce(activeEntry.message, () => ( void 0)) : void 0,
5128
+ onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
5129
+ }
5130
+ ),
5131
+ effectiveStep.type === "deposit-address" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4110
5132
  DepositAddressStep,
4111
5133
  {
4112
- smartAccount: step.smartAccount,
4113
- solanaDepositAddress: enableSolana ? step.solanaDepositAddress : void 0,
5134
+ smartAccount: effectiveStep.smartAccount,
5135
+ solanaDepositAddress: enableSolana ? effectiveStep.solanaDepositAddress : void 0,
4114
5136
  service,
4115
5137
  allowedRoutes,
4116
5138
  targetChain,
4117
5139
  targetToken,
4118
5140
  waitForFinalTx,
4119
- hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _145 => _145.length])),
5141
+ hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _176 => _176.length])),
4120
5142
  uiConfig,
4121
5143
  onDepositSubmitted: handleDepositAddressSubmitted,
4122
5144
  onDepositComplete: handleDepositComplete,
@@ -4124,7 +5146,7 @@ function DepositFlow({
4124
5146
  onCopyAddress: () => {
4125
5147
  const chainName = _chunkIVTXEYB2cjs.getChainName.call(void 0, targetChain);
4126
5148
  const tokenSymbol = _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
4127
- _optionalChain([onEvent, 'optionalCall', _146 => _146({
5149
+ _optionalChain([onEvent, 'optionalCall', _177 => _177({
4128
5150
  type: "deposit_modal_transfer_crypto_cta_click",
4129
5151
  default_chain: chainName,
4130
5152
  default_token: tokenSymbol,
@@ -4132,6 +5154,9 @@ function DepositFlow({
4132
5154
  cta_name: "copy"
4133
5155
  })]);
4134
5156
  },
5157
+ onRequestWalletPicker: isWalletPickerReachable ? () => storeApi.dispatch({
5158
+ type: "connect/wallet-picker-requested"
5159
+ }) : void 0,
4135
5160
  onError: handleError,
4136
5161
  debug
4137
5162
  }
@@ -4139,31 +5164,26 @@ function DepositFlow({
4139
5164
  ] });
4140
5165
  }
4141
5166
  if (isSolanaWalletMode) {
4142
- if (!sessionKeyAddress) return null;
4143
- const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _147 => _147.solanaAddress]);
4144
- const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _148 => _148.solanaProvider]);
5167
+ if (!dappAddress) return null;
5168
+ const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _178 => _178.solanaAddress]);
5169
+ const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _179 => _179.solanaProvider]);
5170
+ const solanaShowBanner = effectiveStep.type !== "setup" && effectiveStep.type !== "processing" && (activeEntry.status === "loading" || activeEntry.status === "error");
4145
5171
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
4146
- step.type === "setup" && !cachedSetupCompatible && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4147
- SetupStep,
5172
+ solanaShowBanner && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5173
+ SetupUpdatingBanner,
4148
5174
  {
4149
- address: sessionKeyAddress,
4150
- targetChain,
4151
- targetToken,
4152
- signerAddress,
4153
- sessionChainIds,
4154
- recipient,
4155
- postBridgeActions,
4156
- outputTokenRules,
4157
- rejectUnmapped,
4158
- forceRegister,
4159
- enableSolana,
4160
- service,
4161
- onSetupComplete: handleSetupComplete,
4162
- onConnected: handleConnected,
4163
- onError: handleError
5175
+ status: activeEntry.status,
5176
+ message: _nullishCoalesce(activeEntry.message, () => ( void 0))
5177
+ }
5178
+ ),
5179
+ effectiveStep.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5180
+ AccountPreparingSkeleton,
5181
+ {
5182
+ errorMessage: activeEntry.status === "error" ? _nullishCoalesce(activeEntry.message, () => ( void 0)) : void 0,
5183
+ onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
4164
5184
  }
4165
5185
  ),
4166
- step.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5186
+ effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4167
5187
  SolanaTokenSelectStep,
4168
5188
  {
4169
5189
  solanaAddress: solanaAddr,
@@ -4173,13 +5193,13 @@ function DepositFlow({
4173
5193
  debug
4174
5194
  }
4175
5195
  ),
4176
- step.type === "solana-amount" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5196
+ effectiveStep.type === "solana-amount" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4177
5197
  SolanaAmountStep,
4178
5198
  {
4179
- token: step.token,
4180
- balance: step.balance,
4181
- balanceUsd: step.balanceUsd,
4182
- defaultAmount: step.inputAmountUsd,
5199
+ token: effectiveStep.token,
5200
+ balance: effectiveStep.balance,
5201
+ balanceUsd: effectiveStep.balanceUsd,
5202
+ defaultAmount: effectiveStep.inputAmountUsd,
4183
5203
  uiConfig,
4184
5204
  targetChainName: _chunkIVTXEYB2cjs.getChainName.call(void 0, targetChain),
4185
5205
  targetTokenSymbol: _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain),
@@ -4190,17 +5210,17 @@ function DepositFlow({
4190
5210
  debug
4191
5211
  }
4192
5212
  ),
4193
- step.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5213
+ effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4194
5214
  SolanaConfirmStep,
4195
5215
  {
4196
- smartAccount: step.smartAccount,
5216
+ smartAccount: effectiveStep.smartAccount,
4197
5217
  solanaAddress: solanaAddr,
4198
- solanaDepositAddress: step.solanaDepositAddress,
4199
- token: step.token,
4200
- sourceAmount: step.sourceAmount,
4201
- inputAmountUsd: step.inputAmountUsd,
4202
- targetAmount: step.targetAmount,
4203
- targetTokenPriceUsd: step.targetTokenPriceUsd,
5218
+ solanaDepositAddress: effectiveStep.solanaDepositAddress,
5219
+ token: effectiveStep.token,
5220
+ sourceAmount: effectiveStep.sourceAmount,
5221
+ inputAmountUsd: effectiveStep.inputAmountUsd,
5222
+ targetAmount: effectiveStep.targetAmount,
5223
+ targetTokenPriceUsd: effectiveStep.targetTokenPriceUsd,
4204
5224
  targetChain,
4205
5225
  targetToken,
4206
5226
  service,
@@ -4209,7 +5229,7 @@ function DepositFlow({
4209
5229
  onError: handleError,
4210
5230
  debug
4211
5231
  }
4212
- ) : step.type === "solana-confirm" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
5232
+ ) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
4213
5233
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
4214
5234
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4215
5235
  "svg",
@@ -4243,23 +5263,23 @@ function DepositFlow({
4243
5263
  }
4244
5264
  ) })
4245
5265
  ] }) : null,
4246
- step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4247
- _chunkFTMCKJM4cjs.ProcessingStep,
5266
+ effectiveStep.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5267
+ _chunkV6NJIPSScjs.ProcessingStep,
4248
5268
  {
4249
- smartAccount: step.smartAccount,
4250
- solanaDepositAddress: step.solanaDepositAddress,
4251
- txHash: step.txHash,
4252
- sourceChain: step.sourceChain,
4253
- sourceToken: step.sourceToken,
5269
+ smartAccount: effectiveStep.smartAccount,
5270
+ solanaDepositAddress: effectiveStep.solanaDepositAddress,
5271
+ txHash: effectiveStep.txHash,
5272
+ sourceChain: effectiveStep.sourceChain,
5273
+ sourceToken: effectiveStep.sourceToken,
4254
5274
  targetChain,
4255
5275
  targetToken,
4256
- amount: step.amount,
4257
- sourceSymbol: step.sourceSymbol,
4258
- sourceDecimals: step.sourceDecimals,
5276
+ amount: effectiveStep.amount,
5277
+ sourceSymbol: effectiveStep.sourceSymbol,
5278
+ sourceDecimals: effectiveStep.sourceDecimals,
4259
5279
  waitForFinalTx,
4260
- hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _149 => _149.length])),
5280
+ hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _180 => _180.length])),
4261
5281
  service,
4262
- directTransfer: step.directTransfer,
5282
+ directTransfer: effectiveStep.directTransfer,
4263
5283
  onClose,
4264
5284
  onNewDeposit: handleNewDeposit,
4265
5285
  onDepositComplete: handleDepositComplete,
@@ -4270,40 +5290,34 @@ function DepositFlow({
4270
5290
  )
4271
5291
  ] });
4272
5292
  }
4273
- if (!_optionalChain([signerContext, 'optionalAccess', _150 => _150.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _151 => _151.publicClient])) {
5293
+ if (!_optionalChain([signerContext, 'optionalAccess', _181 => _181.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _182 => _182.publicClient])) {
4274
5294
  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..." }) }) }) }) });
4275
5295
  }
4276
5296
  const ownerAddress = signerContext.ownerAddress;
4277
- const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _152 => _152.walletClient, 'optionalAccess', _153 => _153.chain, 'optionalAccess', _154 => _154.id]), () => ( _optionalChain([signerContext, 'access', _155 => _155.publicClient, 'access', _156 => _156.chain, 'optionalAccess', _157 => _157.id]))), () => ( targetChain));
5297
+ const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _183 => _183.walletClient, 'optionalAccess', _184 => _184.chain, 'optionalAccess', _185 => _185.id]), () => ( _optionalChain([signerContext, 'access', _186 => _186.publicClient, 'access', _187 => _187.chain, 'optionalAccess', _188 => _188.id]))), () => ( targetChain));
4278
5298
  const getReadClientForChain = (chainId) => {
4279
- if (_optionalChain([signerContext, 'access', _158 => _158.publicClient, 'access', _159 => _159.chain, 'optionalAccess', _160 => _160.id]) === chainId) {
5299
+ if (_optionalChain([signerContext, 'access', _189 => _189.publicClient, 'access', _190 => _190.chain, 'optionalAccess', _191 => _191.id]) === chainId) {
4280
5300
  return signerContext.publicClient;
4281
5301
  }
4282
- return _chunkFTMCKJM4cjs.getPublicClient.call(void 0, chainId);
5302
+ return _chunkV6NJIPSScjs.getPublicClient.call(void 0, chainId);
4283
5303
  };
5304
+ const walletShowBanner = effectiveStep.type !== "setup" && effectiveStep.type !== "processing" && (activeEntry.status === "loading" || activeEntry.status === "error");
4284
5305
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
4285
- step.type === "setup" && !cachedSetupCompatible && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4286
- SetupStep,
5306
+ walletShowBanner && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5307
+ SetupUpdatingBanner,
4287
5308
  {
4288
- walletClient: signerContext.walletClient,
4289
- address: ownerAddress,
4290
- targetChain,
4291
- targetToken,
4292
- signerAddress,
4293
- sessionChainIds,
4294
- recipient,
4295
- postBridgeActions,
4296
- outputTokenRules,
4297
- rejectUnmapped,
4298
- forceRegister,
4299
- enableSolana,
4300
- service,
4301
- onSetupComplete: handleSetupComplete,
4302
- onConnected: handleConnected,
4303
- onError: handleError
5309
+ status: activeEntry.status,
5310
+ message: _nullishCoalesce(activeEntry.message, () => ( void 0))
4304
5311
  }
4305
5312
  ),
4306
- step.type === "select-asset" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5313
+ effectiveStep.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5314
+ AccountPreparingSkeleton,
5315
+ {
5316
+ errorMessage: activeEntry.status === "error" ? _nullishCoalesce(activeEntry.message, () => ( void 0)) : void 0,
5317
+ onRetry: activeEntry.status === "error" ? () => handleRetrySetup(ownerAddress) : void 0
5318
+ }
5319
+ ),
5320
+ effectiveStep.type === "select-asset" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4307
5321
  AssetSelectStep,
4308
5322
  {
4309
5323
  address: ownerAddress,
@@ -4321,14 +5335,27 @@ function DepositFlow({
4321
5335
  } : void 0
4322
5336
  }
4323
5337
  ),
4324
- step.type === "amount" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5338
+ effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5339
+ DappImportAssetSelectStep,
5340
+ {
5341
+ sourceLabel: _nullishCoalesce(_optionalChain([activeDappImportAvailability, 'access', _192 => _192.assets, 'access', _193 => _193[0], 'optionalAccess', _194 => _194.sourceLabel]), () => ( activeDappImportProvider.label)),
5342
+ assets: activeDappImportAvailability.assets,
5343
+ onSelect: handleDappImportAssetSelected
5344
+ }
5345
+ ),
5346
+ effectiveStep.type === "amount" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4325
5347
  AmountStep,
4326
5348
  {
4327
5349
  walletClient: signerContext.walletClient,
4328
- publicClient: getReadClientForChain(step.asset.chainId),
5350
+ publicClient: getReadClientForChain(effectiveStep.asset.chainId),
4329
5351
  address: ownerAddress,
4330
- asset: step.asset,
4331
- defaultAmount: _nullishCoalesce(step.amount, () => ( defaultAmount)),
5352
+ balanceAddress: isDappImportAsset(effectiveStep.asset) ? effectiveStep.asset.providerMetadata.proxyWallet : void 0,
5353
+ asset: effectiveStep.asset,
5354
+ liquiditySource: isDappImportAsset(effectiveStep.asset) ? {
5355
+ chainId: effectiveStep.asset.depositChainId,
5356
+ token: effectiveStep.asset.depositToken
5357
+ } : void 0,
5358
+ defaultAmount: _nullishCoalesce(effectiveStep.amount, () => ( defaultAmount)),
4332
5359
  switchChain: signerContext.switchChain,
4333
5360
  targetChain,
4334
5361
  targetToken,
@@ -4337,9 +5364,9 @@ function DepositFlow({
4337
5364
  onContinue: handleAmountContinue,
4338
5365
  onCtaClick: (ctaName) => {
4339
5366
  const receiveSymbol = _chunkIVTXEYB2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
4340
- _optionalChain([onEvent, 'optionalCall', _161 => _161({
5367
+ _optionalChain([onEvent, 'optionalCall', _195 => _195({
4341
5368
  type: "deposit_modal_connected_wallet_enter_value_cta_click",
4342
- send_token: step.asset.symbol,
5369
+ send_token: effectiveStep.asset.symbol,
4343
5370
  receive_token: receiveSymbol,
4344
5371
  pred_balance: totalBalanceUsd,
4345
5372
  cta_name: ctaName
@@ -4347,45 +5374,62 @@ function DepositFlow({
4347
5374
  }
4348
5375
  }
4349
5376
  ),
4350
- step.type === "confirm" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5377
+ effectiveStep.type === "confirm" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4351
5378
  ConfirmStep,
4352
5379
  {
4353
5380
  walletClient: signerContext.walletClient,
4354
5381
  address: ownerAddress,
4355
- smartAccount: step.smartAccount,
5382
+ smartAccount: effectiveStep.smartAccount,
4356
5383
  recipient,
4357
- asset: step.asset,
4358
- amount: step.amount,
4359
- targetAmount: step.targetAmount,
4360
- targetTokenPriceUsd: step.targetTokenPriceUsd,
4361
- balance: step.balance,
5384
+ asset: effectiveStep.asset,
5385
+ amount: effectiveStep.amount,
5386
+ targetAmount: effectiveStep.targetAmount,
5387
+ targetTokenPriceUsd: effectiveStep.targetTokenPriceUsd,
5388
+ balance: effectiveStep.balance,
4362
5389
  targetChain,
4363
5390
  targetToken,
4364
5391
  switchChain: signerContext.switchChain,
4365
- liquidityWarning: step.liquidityWarning,
5392
+ liquidityWarning: effectiveStep.liquidityWarning,
4366
5393
  uiConfig,
5394
+ executeTransfer: isDappImportMode && activeDappImportProvider && isDappImportAsset(effectiveStep.asset) ? async (amountUnits) => {
5395
+ const result = await activeDappImportProvider.executeTransfer(
5396
+ {
5397
+ walletClient: signerContext.walletClient,
5398
+ publicClient: getReadClientForChain(
5399
+ activeDappImportProvider.chainId
5400
+ ),
5401
+ recipient: effectiveStep.smartAccount,
5402
+ asset: effectiveStep.asset,
5403
+ amount: amountUnits
5404
+ }
5405
+ );
5406
+ return {
5407
+ txHash: result.txHash,
5408
+ sourceToken: result.sourceToken
5409
+ };
5410
+ } : void 0,
4367
5411
  onConfirm: handleDepositSubmitted,
4368
5412
  onDepositSubmitted: handleDepositSubmittedCallback,
4369
5413
  onError: handleError
4370
5414
  }
4371
5415
  ),
4372
- step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4373
- _chunkFTMCKJM4cjs.ProcessingStep,
5416
+ effectiveStep.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5417
+ _chunkV6NJIPSScjs.ProcessingStep,
4374
5418
  {
4375
- smartAccount: step.smartAccount,
4376
- solanaDepositAddress: step.solanaDepositAddress,
4377
- txHash: step.txHash,
4378
- sourceChain: step.sourceChain,
4379
- sourceToken: step.sourceToken,
5419
+ smartAccount: effectiveStep.smartAccount,
5420
+ solanaDepositAddress: effectiveStep.solanaDepositAddress,
5421
+ txHash: effectiveStep.txHash,
5422
+ sourceChain: effectiveStep.sourceChain,
5423
+ sourceToken: effectiveStep.sourceToken,
4380
5424
  targetChain,
4381
5425
  targetToken,
4382
- amount: step.amount,
4383
- sourceSymbol: step.sourceSymbol,
4384
- sourceDecimals: step.sourceDecimals,
5426
+ amount: effectiveStep.amount,
5427
+ sourceSymbol: effectiveStep.sourceSymbol,
5428
+ sourceDecimals: effectiveStep.sourceDecimals,
4385
5429
  waitForFinalTx,
4386
- hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _162 => _162.length])),
5430
+ hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _196 => _196.length])),
4387
5431
  service,
4388
- directTransfer: step.directTransfer,
5432
+ directTransfer: effectiveStep.directTransfer,
4389
5433
  uiConfig,
4390
5434
  onClose,
4391
5435
  onNewDeposit: handleNewDeposit,
@@ -4415,15 +5459,15 @@ function formatDate(iso) {
4415
5459
  month: "short",
4416
5460
  year: "numeric"
4417
5461
  });
4418
- } catch (e25) {
5462
+ } catch (e29) {
4419
5463
  return iso;
4420
5464
  }
4421
5465
  }
4422
5466
  function resolveChainId(value) {
4423
5467
  if (value === void 0 || value === null) return null;
4424
5468
  if (typeof value === "number") return value;
4425
- if (_chunkFTMCKJM4cjs.isSolanaCaip2.call(void 0, value) || value === "solana") return "solana";
4426
- const parsed = _chunkFTMCKJM4cjs.parseEvmChainId.call(void 0, value);
5469
+ if (_chunkV6NJIPSScjs.isSolanaCaip2.call(void 0, value) || value === "solana") return "solana";
5470
+ const parsed = _chunkV6NJIPSScjs.parseEvmChainId.call(void 0, value);
4427
5471
  if (parsed !== null) return parsed;
4428
5472
  const num = Number(value);
4429
5473
  return Number.isFinite(num) ? num : null;
@@ -4474,7 +5518,7 @@ function formatAmount(rawAmount, token, chainId) {
4474
5518
  const trimmed = fracStr.slice(0, 6).replace(/0+$/, "");
4475
5519
  if (!trimmed) return whole.toString();
4476
5520
  return `${whole}.${trimmed}`;
4477
- } catch (e26) {
5521
+ } catch (e30) {
4478
5522
  return rawAmount;
4479
5523
  }
4480
5524
  }
@@ -4537,7 +5581,7 @@ function DepositHistoryPanel({
4537
5581
  className: "rs-modal-header-back",
4538
5582
  "aria-label": "Back",
4539
5583
  onClick: onClose,
4540
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.ChevronLeftIcon, {})
5584
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.ChevronLeftIcon, {})
4541
5585
  }
4542
5586
  ) }),
4543
5587
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-center" }),
@@ -4548,29 +5592,29 @@ function DepositHistoryPanel({
4548
5592
  className: "rs-modal-close",
4549
5593
  "aria-label": "Close",
4550
5594
  onClick: onCloseModal,
4551
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.CloseIcon, {})
5595
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CloseIcon, {})
4552
5596
  }
4553
5597
  ) })
4554
5598
  ] }),
4555
5599
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen", children: [
4556
5600
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen-body", children: [
4557
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.HistoryIcon, {}), title: "History" }),
5601
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.HistoryIcon, {}), title: "History" }),
4558
5602
  isLoading && deposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
4559
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.HistoryIcon, {}) }),
5603
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.HistoryIcon, {}) }),
4560
5604
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
4561
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.Spinner, { className: "rs-spinner--sm" }),
5605
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.Spinner, { className: "rs-spinner--sm" }),
4562
5606
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
4563
5607
  ] })
4564
5608
  ] }),
4565
5609
  error && !isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
4566
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.AlertTriangleIcon, {}) }),
5610
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.AlertTriangleIcon, {}) }),
4567
5611
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
4568
5612
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
4569
5613
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: error })
4570
5614
  ] })
4571
5615
  ] }),
4572
5616
  !isLoading && !error && deposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
4573
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.HistoryIcon, {}) }),
5617
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.HistoryIcon, {}) }),
4574
5618
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
4575
5619
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "No deposits yet" }),
4576
5620
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
@@ -4590,7 +5634,7 @@ function DepositHistoryPanel({
4590
5634
  )
4591
5635
  ] })
4592
5636
  ] }),
4593
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.PoweredBy, {})
5637
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.PoweredBy, {})
4594
5638
  ] })
4595
5639
  ]
4596
5640
  }
@@ -4664,7 +5708,7 @@ function HistoryCard({ deposit }) {
4664
5708
  onClick: (e) => e.stopPropagation(),
4665
5709
  children: [
4666
5710
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: shortenHash(deposit.sourceTxHash) }),
4667
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.ArrowRightIcon, {})
5711
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.ArrowRightIcon, {})
4668
5712
  ]
4669
5713
  }
4670
5714
  )
@@ -4679,7 +5723,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
4679
5723
  // src/DepositModal.tsx
4680
5724
 
4681
5725
  var ReownDepositInner = _react.lazy.call(void 0,
4682
- () => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-B2XLFH4Z.cjs"))).then((m) => ({ default: m.DepositModalReown }))
5726
+ () => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-XV4BEUHT.cjs"))).then((m) => ({ default: m.DepositModalReown }))
4683
5727
  );
4684
5728
  function sortByCreatedAtDesc(items) {
4685
5729
  return [...items].sort((a, b) => {
@@ -4734,6 +5778,7 @@ function DepositModalInner({
4734
5778
  forceRegister = false,
4735
5779
  waitForFinalTx = true,
4736
5780
  enableSolana = true,
5781
+ dappImports,
4737
5782
  postBridgeActions,
4738
5783
  outputTokenRules,
4739
5784
  rejectUnmapped,
@@ -4752,12 +5797,12 @@ function DepositModalInner({
4752
5797
  debug
4753
5798
  }) {
4754
5799
  const modalRef = _react.useRef.call(void 0, null);
4755
- const onReadyRef = _chunkFTMCKJM4cjs.useLatestRef.call(void 0, onReady);
5800
+ const onReadyRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onReady);
4756
5801
  const [currentScreen, setCurrentScreen] = _react.useState.call(void 0, "connect");
4757
5802
  const [backHandler, setBackHandler] = _react.useState.call(void 0,
4758
5803
  void 0
4759
5804
  );
4760
- const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _163 => _163.showHistoryButton]), () => ( false));
5805
+ const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _197 => _197.showHistoryButton]), () => ( false));
4761
5806
  const historyButtonVisible = showHistoryButton && (currentScreen === "select-asset" || currentScreen === "deposit-address");
4762
5807
  const [historyOpen, setHistoryOpen] = _react.useState.call(void 0, false);
4763
5808
  const [historyDeposits, setHistoryDeposits] = _react.useState.call(void 0, []);
@@ -4771,7 +5816,7 @@ function DepositModalInner({
4771
5816
  const targetChain = _chunkIVTXEYB2cjs.getChainId.call(void 0, targetChainProp);
4772
5817
  const sourceChain = sourceChainProp ? _chunkIVTXEYB2cjs.getChainId.call(void 0, sourceChainProp) : void 0;
4773
5818
  const service = _react.useMemo.call(void 0,
4774
- () => _chunkFTMCKJM4cjs.createDepositService.call(void 0, backendUrl, {
5819
+ () => _chunkV6NJIPSScjs.createDepositService.call(void 0, backendUrl, {
4775
5820
  debug,
4776
5821
  debugScope: "service:deposit"
4777
5822
  }),
@@ -4787,7 +5832,7 @@ function DepositModalInner({
4787
5832
  }, [store, targetChain, targetToken]);
4788
5833
  _react.useEffect.call(void 0, () => {
4789
5834
  if (isOpen && modalRef.current) {
4790
- _chunkFTMCKJM4cjs.applyTheme.call(void 0, modalRef.current, theme);
5835
+ _chunkV6NJIPSScjs.applyTheme.call(void 0, modalRef.current, theme);
4791
5836
  }
4792
5837
  }, [isOpen, theme]);
4793
5838
  _react.useEffect.call(void 0, () => {
@@ -4795,7 +5840,7 @@ function DepositModalInner({
4795
5840
  }, [solanaRpcUrl]);
4796
5841
  _react.useEffect.call(void 0, () => {
4797
5842
  if (isOpen) {
4798
- _optionalChain([onReadyRef, 'access', _164 => _164.current, 'optionalCall', _165 => _165()]);
5843
+ _optionalChain([onReadyRef, 'access', _198 => _198.current, 'optionalCall', _199 => _199()]);
4799
5844
  }
4800
5845
  }, [isOpen, onReadyRef]);
4801
5846
  const handleStepChange = _react.useCallback.call(void 0,
@@ -4871,10 +5916,10 @@ function DepositModalInner({
4871
5916
  fetchHistory("initial");
4872
5917
  }
4873
5918
  }, [historyOpen, fetchHistory]);
4874
- const onLifecycleRef = _chunkFTMCKJM4cjs.useLatestRef.call(void 0, onLifecycle);
5919
+ const onLifecycleRef = _chunkV6NJIPSScjs.useLatestRef.call(void 0, onLifecycle);
4875
5920
  const handleLifecycle = _react.useCallback.call(void 0,
4876
5921
  (event) => {
4877
- _optionalChain([onLifecycleRef, 'access', _166 => _166.current, 'optionalCall', _167 => _167(event)]);
5922
+ _optionalChain([onLifecycleRef, 'access', _200 => _200.current, 'optionalCall', _201 => _201(event)]);
4878
5923
  if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
4879
5924
  historyStaleRef.current = true;
4880
5925
  }
@@ -4900,10 +5945,10 @@ function DepositModalInner({
4900
5945
  store.dispatch({ type: "flow/reset" });
4901
5946
  }
4902
5947
  }, [isOpen, store]);
4903
- const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _168 => _168.showBackButton]), () => ( true));
5948
+ const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _202 => _202.showBackButton]), () => ( true));
4904
5949
  const canGoBack = backHandler !== void 0;
4905
5950
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositStoreProvider, { store, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4906
- _chunkFTMCKJM4cjs.Modal,
5951
+ _chunkV6NJIPSScjs.Modal,
4907
5952
  {
4908
5953
  isOpen,
4909
5954
  onClose,
@@ -4919,7 +5964,7 @@ function DepositModalInner({
4919
5964
  className: "rs-modal-header-back",
4920
5965
  "aria-label": "Go back",
4921
5966
  onClick: backHandler,
4922
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.ChevronLeftIcon, {})
5967
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.ChevronLeftIcon, {})
4923
5968
  }
4924
5969
  ) }),
4925
5970
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-nav-right", children: [
@@ -4931,7 +5976,7 @@ function DepositModalInner({
4931
5976
  "aria-label": "Deposit history",
4932
5977
  onClick: handleHistoryOpen,
4933
5978
  disabled: !recipient,
4934
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.HistoryIcon, {})
5979
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.HistoryIcon, {})
4935
5980
  }
4936
5981
  ),
4937
5982
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -4941,7 +5986,7 @@ function DepositModalInner({
4941
5986
  onClick: onClose,
4942
5987
  className: "rs-modal-close",
4943
5988
  "aria-label": "Close",
4944
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFTMCKJM4cjs.CloseIcon, {})
5989
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV6NJIPSScjs.CloseIcon, {})
4945
5990
  }
4946
5991
  )
4947
5992
  ] })
@@ -4968,6 +6013,7 @@ function DepositModalInner({
4968
6013
  forceRegister,
4969
6014
  waitForFinalTx,
4970
6015
  enableSolana,
6016
+ dappImports,
4971
6017
  reownWallet,
4972
6018
  onConnect,
4973
6019
  onDisconnect,