@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.
@@ -12,13 +12,16 @@ import {
12
12
  ConnectStep,
13
13
  CopyIcon,
14
14
  ExternalLinkIcon,
15
+ HandCoinsIcon,
15
16
  HistoryIcon,
16
17
  InfoIcon,
18
+ ListRow,
17
19
  Modal,
18
20
  PercentIcon,
19
21
  PlusCircleIcon,
20
22
  PoweredBy,
21
23
  ProcessingStep,
24
+ SAFE_ABI,
22
25
  Spinner,
23
26
  Tooltip,
24
27
  WalletIcon,
@@ -45,7 +48,7 @@ import {
45
48
  tokenFormatter,
46
49
  txRefsMatch,
47
50
  useLatestRef
48
- } from "./chunk-XKDZEIB7.mjs";
51
+ } from "./chunk-TFXIQ7YH.mjs";
49
52
  import {
50
53
  DEFAULT_BACKEND_URL,
51
54
  DEFAULT_SIGNER_ADDRESS,
@@ -69,210 +72,22 @@ import {
69
72
  // src/DepositModal.tsx
70
73
  import {
71
74
  useMemo as useMemo7,
72
- useEffect as useEffect10,
73
- useRef as useRef7,
74
- useState as useState12,
75
- useCallback as useCallback6,
75
+ useEffect as useEffect9,
76
+ useRef as useRef6,
77
+ useState as useState11,
78
+ useCallback as useCallback5,
76
79
  lazy as lazy2,
77
80
  Suspense as Suspense2
78
81
  } from "react";
79
82
 
80
83
  // src/DepositFlow.tsx
81
- import { useState as useState10, useCallback as useCallback4, useMemo as useMemo6, useEffect as useEffect9, useRef as useRef6 } from "react";
82
- import { formatUnits as formatUnits6 } from "viem";
83
-
84
- // src/components/steps/SetupStep.tsx
85
- import { useState, useEffect, useRef, useCallback } from "react";
86
- import { jsx, jsxs } from "react/jsx-runtime";
87
- async function resolveSessionOwner(eoaAddress) {
88
- const localOwner = loadSessionOwnerFromStorage(eoaAddress);
89
- if (localOwner) {
90
- return {
91
- account: accountFromPrivateKey(localOwner.privateKey),
92
- address: localOwner.address
93
- };
94
- }
95
- const created = createSessionOwnerKey();
96
- saveSessionOwnerToStorage(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] = useState({ type: "idle" });
121
- const setupInitiatedRef = useRef(false);
122
- const runSetup = useCallback(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: toEvmCaip2(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
- onConnected?.(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 = buildSessionDetails(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: toEvmCaip2(targetChain),
182
- token: targetToken,
183
- ...recipient && { recipient },
184
- ...postBridgeActions?.length && { postBridgeActions },
185
- ...outputTokenRules?.length && { outputTokenRules },
186
- ...rejectUnmapped != null && { rejectUnmapped }
187
- }
188
- });
189
- setState({ type: "ready", smartAccount });
190
- onConnected?.(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
- onError?.(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
- useEffect(() => {
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__ */ jsxs("div", { className: "rs-step", children: [
248
- /* @__PURE__ */ jsxs("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
249
- isLoading && /* @__PURE__ */ jsx(
250
- BodyHeader,
251
- {
252
- icon: /* @__PURE__ */ jsx(Spinner, { className: "rs-spinner--sm" }),
253
- title: renderStateMessage(),
254
- subtitle: "This may take a moment"
255
- }
256
- ),
257
- isError && /* @__PURE__ */ jsx(
258
- BodyHeader,
259
- {
260
- variant: "error",
261
- icon: /* @__PURE__ */ jsx(AlertTriangleIcon, {}),
262
- title: "Setup failed",
263
- subtitle: state.message
264
- }
265
- )
266
- ] }),
267
- isError && /* @__PURE__ */ jsx("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx(Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) }),
268
- /* @__PURE__ */ jsx(PoweredBy, {})
269
- ] });
270
- }
84
+ import { useState as useState9, useCallback as useCallback3, useMemo as useMemo6, useEffect as useEffect8, useRef as useRef5 } from "react";
85
+ import { formatUnits as formatUnits7 } from "viem";
271
86
 
272
87
  // src/components/steps/AssetSelectStep.tsx
273
- import { useEffect as useEffect2, useMemo, useState as useState2 } from "react";
88
+ import { useEffect, useMemo, useState } from "react";
274
89
  import { formatUnits } from "viem";
275
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
90
+ import { jsx, jsxs } from "react/jsx-runtime";
276
91
  function AssetSelectStep({
277
92
  address,
278
93
  publicClient,
@@ -285,10 +100,10 @@ function AssetSelectStep({
285
100
  onAssetsLoaded,
286
101
  onDisconnect
287
102
  }) {
288
- const [assets, setAssets] = useState2([]);
289
- const [selectedAssetId, setSelectedAssetId] = useState2(null);
290
- const [loading, setLoading] = useState2(true);
291
- const [error, setError] = useState2(null);
103
+ const [assets, setAssets] = useState([]);
104
+ const [selectedAssetId, setSelectedAssetId] = useState(null);
105
+ const [loading, setLoading] = useState(true);
106
+ const [error, setError] = useState(null);
292
107
  const defaultAssetId = useMemo(() => {
293
108
  if (!defaultSourceChain || !defaultSourceToken) return null;
294
109
  return getAssetId({
@@ -296,7 +111,7 @@ function AssetSelectStep({
296
111
  token: defaultSourceToken
297
112
  });
298
113
  }, [defaultSourceChain, defaultSourceToken]);
299
- useEffect2(() => {
114
+ useEffect(() => {
300
115
  let active = true;
301
116
  async function loadPortfolio() {
302
117
  if (!address) {
@@ -338,13 +153,13 @@ function AssetSelectStep({
338
153
  active = false;
339
154
  };
340
155
  }, [address, publicClient, service]);
341
- useEffect2(() => {
156
+ useEffect(() => {
342
157
  if (!defaultAssetId || selectedAssetId) return;
343
158
  if (assets.some((asset) => asset.id === defaultAssetId)) {
344
159
  setSelectedAssetId(defaultAssetId);
345
160
  }
346
161
  }, [assets, defaultAssetId, selectedAssetId]);
347
- useEffect2(() => {
162
+ useEffect(() => {
348
163
  const total = assets.reduce(
349
164
  (sum, asset) => sum + (asset.balanceUsd ?? 0),
350
165
  0
@@ -394,30 +209,30 @@ function AssetSelectStep({
394
209
  return asset.balance;
395
210
  }
396
211
  };
397
- return /* @__PURE__ */ jsxs2("div", { className: "rs-screen", children: [
398
- /* @__PURE__ */ jsxs2("div", { className: "rs-screen-body", children: [
399
- /* @__PURE__ */ jsx2(
212
+ return /* @__PURE__ */ jsxs("div", { className: "rs-screen", children: [
213
+ /* @__PURE__ */ jsxs("div", { className: "rs-screen-body", children: [
214
+ /* @__PURE__ */ jsx(
400
215
  BodyHeader,
401
216
  {
402
- icon: /* @__PURE__ */ jsx2(WalletIcon, {}),
217
+ icon: /* @__PURE__ */ jsx(WalletIcon, {}),
403
218
  title: "Your assets",
404
219
  subtitle: "Select source assets to transfer"
405
220
  }
406
221
  ),
407
- loading && /* @__PURE__ */ jsxs2("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
408
- /* @__PURE__ */ jsx2(Spinner, { className: "rs-text-tertiary" }),
409
- /* @__PURE__ */ jsx2("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
222
+ loading && /* @__PURE__ */ jsxs("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
223
+ /* @__PURE__ */ jsx(Spinner, { className: "rs-text-tertiary" }),
224
+ /* @__PURE__ */ jsx("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
410
225
  ] }),
411
- error && /* @__PURE__ */ jsx2("div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ jsx2("span", { className: "rs-alert-text", children: error }) }),
412
- !loading && !error && rows.length === 0 && /* @__PURE__ */ jsxs2("div", { className: "rs-empty-state", children: [
413
- /* @__PURE__ */ jsx2(WalletIcon, { className: "rs-empty-icon" }),
414
- /* @__PURE__ */ jsx2("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
415
- /* @__PURE__ */ jsxs2("div", { className: "rs-empty-address", children: [
226
+ error && /* @__PURE__ */ jsx("div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ jsx("span", { className: "rs-alert-text", children: error }) }),
227
+ !loading && !error && rows.length === 0 && /* @__PURE__ */ jsxs("div", { className: "rs-empty-state", children: [
228
+ /* @__PURE__ */ jsx(WalletIcon, { className: "rs-empty-icon" }),
229
+ /* @__PURE__ */ jsx("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
230
+ /* @__PURE__ */ jsxs("div", { className: "rs-empty-address", children: [
416
231
  address.slice(0, 6),
417
232
  "...",
418
233
  address.slice(-4)
419
234
  ] }),
420
- onDisconnect && /* @__PURE__ */ jsx2(
235
+ onDisconnect && /* @__PURE__ */ jsx(
421
236
  "button",
422
237
  {
423
238
  type: "button",
@@ -427,13 +242,13 @@ function AssetSelectStep({
427
242
  }
428
243
  )
429
244
  ] }),
430
- !loading && !error && rows.length > 0 && /* @__PURE__ */ jsx2("div", { className: "rs-asset-list", children: rows.map((asset) => {
245
+ !loading && !error && rows.length > 0 && /* @__PURE__ */ jsx("div", { className: "rs-asset-list", children: rows.map((asset) => {
431
246
  const isSelected = selectedAssetId === asset.id;
432
247
  const tokenAmount = formatBalance(asset);
433
248
  const badge = getChainBadge(asset.chainId);
434
249
  const tokenIcon = getTokenIcon(asset.symbol);
435
250
  const chainIcon = getChainIcon(asset.chainId);
436
- return /* @__PURE__ */ jsxs2(
251
+ return /* @__PURE__ */ jsxs(
437
252
  "button",
438
253
  {
439
254
  type: "button",
@@ -441,16 +256,16 @@ function AssetSelectStep({
441
256
  className: `rs-asset-row ${isSelected ? "rs-asset-row--selected" : ""}`,
442
257
  "aria-pressed": isSelected,
443
258
  children: [
444
- /* @__PURE__ */ jsxs2("div", { className: "rs-asset-info", children: [
445
- /* @__PURE__ */ jsxs2("div", { className: "rs-asset-icon-wrapper", children: [
446
- tokenIcon ? /* @__PURE__ */ jsx2("span", { className: "rs-asset-icon", children: /* @__PURE__ */ jsx2("img", { src: tokenIcon, alt: asset.symbol }) }) : /* @__PURE__ */ jsx2("span", { className: "rs-asset-icon", children: asset.symbol.slice(0, 4) }),
447
- chainIcon ? /* @__PURE__ */ jsx2("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx2(
259
+ /* @__PURE__ */ jsxs("div", { className: "rs-asset-info", children: [
260
+ /* @__PURE__ */ jsxs("div", { className: "rs-asset-icon-wrapper", children: [
261
+ tokenIcon ? /* @__PURE__ */ jsx("span", { className: "rs-asset-icon", children: /* @__PURE__ */ jsx("img", { src: tokenIcon, alt: asset.symbol }) }) : /* @__PURE__ */ jsx("span", { className: "rs-asset-icon", children: asset.symbol.slice(0, 4) }),
262
+ chainIcon ? /* @__PURE__ */ jsx("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx(
448
263
  "img",
449
264
  {
450
265
  src: chainIcon,
451
266
  alt: getChainName(asset.chainId)
452
267
  }
453
- ) }) : /* @__PURE__ */ jsx2(
268
+ ) }) : /* @__PURE__ */ jsx(
454
269
  "span",
455
270
  {
456
271
  className: "rs-asset-chain-badge",
@@ -462,28 +277,28 @@ function AssetSelectStep({
462
277
  }
463
278
  )
464
279
  ] }),
465
- /* @__PURE__ */ jsxs2("div", { className: "rs-asset-text", children: [
466
- /* @__PURE__ */ jsxs2("div", { className: "rs-asset-name-row", children: [
467
- /* @__PURE__ */ jsx2("span", { className: "rs-asset-name", children: asset.symbol }),
468
- /* @__PURE__ */ jsxs2("span", { className: "rs-asset-chain", children: [
280
+ /* @__PURE__ */ jsxs("div", { className: "rs-asset-text", children: [
281
+ /* @__PURE__ */ jsxs("div", { className: "rs-asset-name-row", children: [
282
+ /* @__PURE__ */ jsx("span", { className: "rs-asset-name", children: asset.symbol }),
283
+ /* @__PURE__ */ jsxs("span", { className: "rs-asset-chain", children: [
469
284
  "on ",
470
285
  getChainName(asset.chainId)
471
286
  ] })
472
287
  ] }),
473
- /* @__PURE__ */ jsxs2("div", { className: "rs-asset-balance-small", children: [
288
+ /* @__PURE__ */ jsxs("div", { className: "rs-asset-balance-small", children: [
474
289
  tokenAmount,
475
290
  " ",
476
291
  asset.symbol
477
292
  ] })
478
293
  ] })
479
294
  ] }),
480
- /* @__PURE__ */ jsx2("div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
295
+ /* @__PURE__ */ jsx("div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
481
296
  ]
482
297
  },
483
298
  asset.id
484
299
  );
485
300
  }) }),
486
- /* @__PURE__ */ jsx2(
301
+ /* @__PURE__ */ jsx(
487
302
  Button,
488
303
  {
489
304
  onClick: () => selectedAsset && onContinue(selectedAsset),
@@ -493,7 +308,7 @@ function AssetSelectStep({
493
308
  }
494
309
  )
495
310
  ] }),
496
- /* @__PURE__ */ jsx2(PoweredBy, {})
311
+ /* @__PURE__ */ jsx(PoweredBy, {})
497
312
  ] });
498
313
  }
499
314
  async function fetchNativeAssets(address, publicClient, existing) {
@@ -536,9 +351,9 @@ function mergeAssets(existing, incoming) {
536
351
  }
537
352
 
538
353
  // src/components/steps/AmountStep.tsx
539
- import { useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
354
+ import { useEffect as useEffect2, useMemo as useMemo2, useRef, useState as useState2 } from "react";
540
355
  import { erc20Abi, formatUnits as formatUnits2, parseUnits } from "viem";
541
- import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
356
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
542
357
  var PRESETS = [
543
358
  { value: 25, label: "25%" },
544
359
  { value: 50, label: "50%" },
@@ -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,
@@ -571,11 +387,11 @@ function AmountStep({
571
387
  onCtaClick,
572
388
  service
573
389
  }) {
574
- const [amount, setAmount] = useState3("");
575
- const [balance, setBalance] = useState3(null);
576
- const [error, setError] = useState3(null);
577
- const [isCheckingLiquidity, setIsCheckingLiquidity] = useState3(false);
578
- const hasAttemptedSwitch = useRef2(false);
390
+ const [amount, setAmount] = useState2("");
391
+ const [balance, setBalance] = useState2(null);
392
+ const [error, setError] = useState2(null);
393
+ const [isCheckingLiquidity, setIsCheckingLiquidity] = useState2(false);
394
+ const hasAttemptedSwitch = useRef(false);
579
395
  const chainMismatch = Boolean(
580
396
  walletClient?.chain?.id && walletClient.chain.id !== asset.chainId
581
397
  );
@@ -598,7 +414,7 @@ function AmountStep({
598
414
  }
599
415
  }, [tokenPriceUsdOverride, asset.balanceUsd, asset.balance, asset.decimals]);
600
416
  const hasPricing = tokenPriceUsd !== null;
601
- useEffect3(() => {
417
+ useEffect2(() => {
602
418
  let active = true;
603
419
  async function fetchBalance() {
604
420
  const balanceTarget = balanceAddress ?? address;
@@ -620,7 +436,7 @@ function AmountStep({
620
436
  active = false;
621
437
  };
622
438
  }, [address, balanceAddress, publicClient, asset]);
623
- useEffect3(() => {
439
+ useEffect2(() => {
624
440
  if (chainMismatch && switchChain && !hasAttemptedSwitch.current) {
625
441
  hasAttemptedSwitch.current = true;
626
442
  switchChain(asset.chainId).catch((err) => {
@@ -629,10 +445,10 @@ function AmountStep({
629
445
  });
630
446
  }
631
447
  }, [chainMismatch, switchChain, asset.chainId]);
632
- useEffect3(() => {
448
+ useEffect2(() => {
633
449
  hasAttemptedSwitch.current = false;
634
450
  }, [asset.chainId]);
635
- useEffect3(() => {
451
+ useEffect2(() => {
636
452
  if (defaultAmount && !amount) {
637
453
  const parsed = Number(defaultAmount);
638
454
  if (Number.isFinite(parsed) && parsed > 0) {
@@ -650,7 +466,7 @@ function AmountStep({
650
466
  return null;
651
467
  }
652
468
  }, [balance, tokenPriceUsd, asset.decimals]);
653
- useEffect3(() => {
469
+ useEffect2(() => {
654
470
  onBalanceUsdChange?.(balanceUsd ?? 0);
655
471
  }, [balanceUsd, onBalanceUsdChange]);
656
472
  const formattedBalance = useMemo2(() => {
@@ -740,8 +556,8 @@ function AmountStep({
740
556
  let liquidityWarning;
741
557
  try {
742
558
  const liquidity = await service.checkLiquidity({
743
- sourceChainId: asset.chainId,
744
- sourceToken: asset.token,
559
+ sourceChainId: liquiditySource?.chainId ?? asset.chainId,
560
+ sourceToken: liquiditySource?.token ?? asset.token,
745
561
  destinationChainId: targetChain,
746
562
  destinationToken: targetToken,
747
563
  amount: amountInUnits.toString()
@@ -776,14 +592,14 @@ function AmountStep({
776
592
  const targetChainName = getChainName(targetChain);
777
593
  const sourceTokenIcon = getTokenIcon(asset.symbol);
778
594
  const targetTokenIcon = getTokenIcon(targetSymbol);
779
- return /* @__PURE__ */ jsxs3("div", { className: "rs-screen", children: [
780
- /* @__PURE__ */ jsxs3("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
781
- /* @__PURE__ */ jsx3(BodyHeader, { icon: /* @__PURE__ */ jsx3(WalletIcon, {}), title: "Wallet deposit" }),
782
- /* @__PURE__ */ jsxs3("div", { className: "rs-amount-section", children: [
783
- /* @__PURE__ */ jsxs3("div", { className: "rs-amount-display", children: [
784
- /* @__PURE__ */ jsxs3("div", { className: "rs-amount-input-row", children: [
785
- /* @__PURE__ */ jsx3("span", { "aria-hidden": "true", children: "$" }),
786
- /* @__PURE__ */ jsx3(
595
+ return /* @__PURE__ */ jsxs2("div", { className: "rs-screen", children: [
596
+ /* @__PURE__ */ jsxs2("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
597
+ /* @__PURE__ */ jsx2(BodyHeader, { icon: /* @__PURE__ */ jsx2(WalletIcon, {}), title: "Wallet deposit" }),
598
+ /* @__PURE__ */ jsxs2("div", { className: "rs-amount-section", children: [
599
+ /* @__PURE__ */ jsxs2("div", { className: "rs-amount-display", children: [
600
+ /* @__PURE__ */ jsxs2("div", { className: "rs-amount-input-row", children: [
601
+ /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", children: "$" }),
602
+ /* @__PURE__ */ jsx2(
787
603
  "input",
788
604
  {
789
605
  type: "text",
@@ -796,25 +612,25 @@ function AmountStep({
796
612
  }
797
613
  )
798
614
  ] }),
799
- /* @__PURE__ */ jsxs3("div", { className: "rs-amount-meta", children: [
800
- /* @__PURE__ */ jsxs3("span", { className: "rs-amount-meta-balance", children: [
615
+ /* @__PURE__ */ jsxs2("div", { className: "rs-amount-meta", children: [
616
+ /* @__PURE__ */ jsxs2("span", { className: "rs-amount-meta-balance", children: [
801
617
  formattedBalance,
802
618
  " ",
803
619
  asset.symbol,
804
620
  " available",
805
- balanceUsd !== null && /* @__PURE__ */ jsxs3(Fragment, { children: [
621
+ balanceUsd !== null && /* @__PURE__ */ jsxs2(Fragment, { children: [
806
622
  " (~",
807
623
  currencyFormatter.format(balanceUsd),
808
624
  ")"
809
625
  ] })
810
626
  ] }),
811
- minDepositUsd !== null && /* @__PURE__ */ jsxs3("span", { className: "rs-amount-meta-minimum", children: [
627
+ minDepositUsd !== null && /* @__PURE__ */ jsxs2("span", { className: "rs-amount-meta-minimum", children: [
812
628
  "Min. deposit ",
813
629
  currencyFormatter.format(minDepositUsd)
814
630
  ] })
815
631
  ] })
816
632
  ] }),
817
- /* @__PURE__ */ jsx3("div", { className: "rs-amount-presets", children: PRESETS.map((preset) => /* @__PURE__ */ jsx3(
633
+ /* @__PURE__ */ jsx2("div", { className: "rs-amount-presets", children: PRESETS.map((preset) => /* @__PURE__ */ jsx2(
818
634
  "button",
819
635
  {
820
636
  type: "button",
@@ -826,39 +642,39 @@ function AmountStep({
826
642
  preset.value
827
643
  )) })
828
644
  ] }),
829
- /* @__PURE__ */ jsxs3("div", { className: "rs-amount-details", children: [
830
- /* @__PURE__ */ jsxs3("div", { className: "rs-amount-detail-row", children: [
831
- /* @__PURE__ */ jsx3("span", { children: "You send" }),
832
- /* @__PURE__ */ jsxs3("span", { className: "rs-amount-detail-value", children: [
833
- /* @__PURE__ */ jsxs3("span", { children: [
645
+ /* @__PURE__ */ jsxs2("div", { className: "rs-amount-details", children: [
646
+ /* @__PURE__ */ jsxs2("div", { className: "rs-amount-detail-row", children: [
647
+ /* @__PURE__ */ jsx2("span", { children: "You send" }),
648
+ /* @__PURE__ */ jsxs2("span", { className: "rs-amount-detail-value", children: [
649
+ /* @__PURE__ */ jsxs2("span", { children: [
834
650
  sourceChainName,
835
651
  " ",
836
652
  asset.symbol
837
653
  ] }),
838
- sourceTokenIcon && /* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx3("img", { src: sourceTokenIcon, alt: "" }) })
654
+ sourceTokenIcon && /* @__PURE__ */ jsx2("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx2("img", { src: sourceTokenIcon, alt: "" }) })
839
655
  ] })
840
656
  ] }),
841
- /* @__PURE__ */ jsxs3("div", { className: "rs-amount-detail-row", children: [
842
- /* @__PURE__ */ jsx3("span", { children: "Receive" }),
843
- /* @__PURE__ */ jsxs3("span", { className: "rs-amount-detail-value", children: [
844
- /* @__PURE__ */ jsxs3("span", { children: [
657
+ /* @__PURE__ */ jsxs2("div", { className: "rs-amount-detail-row", children: [
658
+ /* @__PURE__ */ jsx2("span", { children: "Receive" }),
659
+ /* @__PURE__ */ jsxs2("span", { className: "rs-amount-detail-value", children: [
660
+ /* @__PURE__ */ jsxs2("span", { children: [
845
661
  targetChainName,
846
662
  " ",
847
663
  targetSymbol
848
664
  ] }),
849
- targetTokenIcon && /* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx3("img", { src: targetTokenIcon, alt: "" }) })
665
+ targetTokenIcon && /* @__PURE__ */ jsx2("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx2("img", { src: targetTokenIcon, alt: "" }) })
850
666
  ] })
851
667
  ] }),
852
- balanceAfterUsd !== null && /* @__PURE__ */ jsxs3("div", { className: "rs-amount-detail-row", children: [
853
- /* @__PURE__ */ jsx3("span", { children: "Balance after deposit" }),
854
- /* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
668
+ balanceAfterUsd !== null && /* @__PURE__ */ jsxs2("div", { className: "rs-amount-detail-row", children: [
669
+ /* @__PURE__ */ jsx2("span", { children: "Balance after deposit" }),
670
+ /* @__PURE__ */ jsx2("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
855
671
  ] })
856
672
  ] }),
857
- error && /* @__PURE__ */ jsxs3("div", { className: "rs-amount-error", role: "alert", children: [
858
- /* @__PURE__ */ jsx3(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
859
- /* @__PURE__ */ jsx3("span", { children: error })
673
+ error && /* @__PURE__ */ jsxs2("div", { className: "rs-amount-error", role: "alert", children: [
674
+ /* @__PURE__ */ jsx2(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
675
+ /* @__PURE__ */ jsx2("span", { children: error })
860
676
  ] }),
861
- /* @__PURE__ */ jsx3(
677
+ /* @__PURE__ */ jsx2(
862
678
  Button,
863
679
  {
864
680
  onClick: handleContinue,
@@ -868,14 +684,21 @@ function AmountStep({
868
684
  }
869
685
  )
870
686
  ] }),
871
- /* @__PURE__ */ jsx3(PoweredBy, {})
687
+ /* @__PURE__ */ jsx2(PoweredBy, {})
872
688
  ] });
873
689
  }
874
690
 
875
691
  // src/components/steps/ConfirmStep.tsx
876
- import { useEffect as useEffect4, useRef as useRef3, useState as useState4 } from "react";
692
+ import { useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
877
693
  import { erc20Abi as erc20Abi2, parseUnits as parseUnits2 } from "viem";
878
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
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
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
879
702
  function ConfirmStep({
880
703
  walletClient,
881
704
  address,
@@ -896,11 +719,12 @@ function ConfirmStep({
896
719
  quotedFeeSymbol,
897
720
  onConfirm,
898
721
  onError,
899
- onDepositSubmitted
722
+ onDepositSubmitted,
723
+ executeTransfer
900
724
  }) {
901
- const [isSubmitting, setIsSubmitting] = useState4(false);
902
- const [error, setError] = useState4(null);
903
- const hasAttemptedSwitch = useRef3(false);
725
+ const [isSubmitting, setIsSubmitting] = useState3(false);
726
+ const [error, setError] = useState3(null);
727
+ const hasAttemptedSwitch = useRef2(false);
904
728
  const chainMismatch = Boolean(
905
729
  walletClient?.chain?.id && walletClient.chain.id !== asset.chainId
906
730
  );
@@ -925,10 +749,9 @@ function ConfirmStep({
925
749
  return formattedSendAmount;
926
750
  })();
927
751
  const receiveAmount = sameRoute ? formattedReceiveAmount : `~${formattedReceiveAmount}`;
928
- const feeSymbol = quotedFeeSymbol ?? asset.symbol;
929
752
  const feeSponsored = uiConfig?.feeSponsored ?? false;
930
753
  const feeTooltip = uiConfig?.feeTooltip ?? (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.");
931
- useEffect4(() => {
754
+ useEffect3(() => {
932
755
  if (chainMismatch && switchChain && !hasAttemptedSwitch.current) {
933
756
  hasAttemptedSwitch.current = true;
934
757
  switchChain(asset.chainId).catch((err) => {
@@ -937,7 +760,7 @@ function ConfirmStep({
937
760
  });
938
761
  }
939
762
  }, [chainMismatch, switchChain, asset.chainId]);
940
- useEffect4(() => {
763
+ useEffect3(() => {
941
764
  hasAttemptedSwitch.current = false;
942
765
  }, [asset.chainId]);
943
766
  const handleConfirm = async () => {
@@ -974,21 +797,31 @@ function ConfirmStep({
974
797
  throw new Error("Wallet not properly connected");
975
798
  }
976
799
  const transferTo = sameRoute ? recipient : smartAccount;
977
- const hash = isNativeAsset(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: erc20Abi2,
987
- functionName: "transfer",
988
- args: [transferTo, amountUnits]
989
- });
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 (isNativeAsset(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: erc20Abi2,
819
+ functionName: "transfer",
820
+ args: [transferTo, amountUnits]
821
+ });
822
+ }
990
823
  onDepositSubmitted?.(hash, asset.chainId, amountUnits.toString());
991
- onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
824
+ onConfirm(hash, asset.chainId, amountUnits.toString(), resolvedSourceToken);
992
825
  } catch (err) {
993
826
  const raw = err instanceof Error ? err.message : "Transfer failed";
994
827
  const message = formatUserError(raw);
@@ -998,77 +831,83 @@ function ConfirmStep({
998
831
  setIsSubmitting(false);
999
832
  }
1000
833
  };
1001
- return /* @__PURE__ */ jsxs4("div", { className: "rs-screen", children: [
1002
- /* @__PURE__ */ jsxs4("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
1003
- /* @__PURE__ */ jsx4(BodyHeader, { icon: /* @__PURE__ */ jsx4(WalletIcon, {}), title: "Review deposit" }),
1004
- /* @__PURE__ */ jsxs4("div", { className: "rs-amount-details", children: [
1005
- /* @__PURE__ */ jsxs4("div", { className: "rs-amount-detail-row", children: [
1006
- /* @__PURE__ */ jsx4("span", { children: "Source chain" }),
1007
- /* @__PURE__ */ jsxs4("span", { className: "rs-amount-detail-value", children: [
1008
- /* @__PURE__ */ jsx4("span", { children: sourceChainName }),
1009
- sourceChainIcon && /* @__PURE__ */ jsx4("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx4("img", { src: sourceChainIcon, alt: "" }) })
834
+ return /* @__PURE__ */ jsxs3("div", { className: "rs-screen", children: [
835
+ /* @__PURE__ */ jsxs3("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
836
+ /* @__PURE__ */ jsx3(BodyHeader, { icon: /* @__PURE__ */ jsx3(WalletIcon, {}), title: "Review deposit" }),
837
+ /* @__PURE__ */ jsxs3("div", { className: "rs-amount-details", children: [
838
+ /* @__PURE__ */ jsxs3("div", { className: "rs-amount-detail-row", children: [
839
+ /* @__PURE__ */ jsx3("span", { children: "Source chain" }),
840
+ /* @__PURE__ */ jsxs3("span", { className: "rs-amount-detail-value", children: [
841
+ /* @__PURE__ */ jsx3("span", { children: sourceChainName }),
842
+ sourceChainIcon && /* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx3("img", { src: sourceChainIcon, alt: "" }) })
1010
843
  ] })
1011
844
  ] }),
1012
- /* @__PURE__ */ jsxs4("div", { className: "rs-amount-detail-row", children: [
1013
- /* @__PURE__ */ jsx4("span", { children: "Destination chain" }),
1014
- /* @__PURE__ */ jsxs4("span", { className: "rs-amount-detail-value", children: [
1015
- /* @__PURE__ */ jsx4("span", { children: targetChainName }),
1016
- targetChainIcon && /* @__PURE__ */ jsx4("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx4("img", { src: targetChainIcon, alt: "" }) })
845
+ /* @__PURE__ */ jsxs3("div", { className: "rs-amount-detail-row", children: [
846
+ /* @__PURE__ */ jsx3("span", { children: "Destination chain" }),
847
+ /* @__PURE__ */ jsxs3("span", { className: "rs-amount-detail-value", children: [
848
+ /* @__PURE__ */ jsx3("span", { children: targetChainName }),
849
+ targetChainIcon && /* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx3("img", { src: targetChainIcon, alt: "" }) })
1017
850
  ] })
1018
851
  ] }),
1019
- /* @__PURE__ */ jsxs4("div", { className: "rs-amount-detail-row", children: [
1020
- /* @__PURE__ */ jsx4("span", { children: "Estimated time" }),
1021
- /* @__PURE__ */ jsx4("span", { className: "rs-amount-detail-value", children: estimatedTime })
852
+ /* @__PURE__ */ jsxs3("div", { className: "rs-amount-detail-row", children: [
853
+ /* @__PURE__ */ jsx3("span", { children: "Estimated time" }),
854
+ /* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-value", children: estimatedTime })
1022
855
  ] }),
1023
- /* @__PURE__ */ jsxs4("div", { className: "rs-amount-detail-row", children: [
1024
- /* @__PURE__ */ jsx4("span", { children: "You send" }),
1025
- /* @__PURE__ */ jsxs4("span", { className: "rs-amount-detail-value", children: [
1026
- /* @__PURE__ */ jsxs4("span", { children: [
856
+ /* @__PURE__ */ jsxs3("div", { className: "rs-amount-detail-row", children: [
857
+ /* @__PURE__ */ jsx3("span", { children: "You send" }),
858
+ /* @__PURE__ */ jsxs3("span", { className: "rs-amount-detail-value", children: [
859
+ /* @__PURE__ */ jsxs3("span", { children: [
1027
860
  formattedSendAmount,
1028
861
  " ",
1029
862
  asset.symbol
1030
863
  ] }),
1031
- sourceTokenIcon && /* @__PURE__ */ jsx4("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx4("img", { src: sourceTokenIcon, alt: "" }) })
864
+ sourceTokenIcon && /* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx3("img", { src: sourceTokenIcon, alt: "" }) })
1032
865
  ] })
1033
866
  ] }),
1034
- /* @__PURE__ */ jsxs4("div", { className: "rs-amount-detail-row", children: [
1035
- /* @__PURE__ */ jsx4("span", { children: "Receive" }),
1036
- /* @__PURE__ */ jsxs4("span", { className: "rs-amount-detail-value", children: [
1037
- /* @__PURE__ */ jsxs4("span", { children: [
867
+ /* @__PURE__ */ jsxs3("div", { className: "rs-amount-detail-row", children: [
868
+ /* @__PURE__ */ jsx3("span", { children: "Receive" }),
869
+ /* @__PURE__ */ jsxs3("span", { className: "rs-amount-detail-value", children: [
870
+ /* @__PURE__ */ jsxs3("span", { children: [
1038
871
  receiveAmount,
1039
872
  " ",
1040
873
  targetSymbol
1041
874
  ] }),
1042
- targetTokenIcon && /* @__PURE__ */ jsx4("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx4("img", { src: targetTokenIcon, alt: "" }) })
875
+ targetTokenIcon && /* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx3("img", { src: targetTokenIcon, alt: "" }) })
1043
876
  ] })
1044
877
  ] }),
1045
- /* @__PURE__ */ jsxs4("div", { className: "rs-amount-detail-row", children: [
1046
- /* @__PURE__ */ jsx4("span", { children: "Fees" }),
1047
- /* @__PURE__ */ jsxs4("span", { className: "rs-amount-detail-value", children: [
1048
- /* @__PURE__ */ jsxs4(
878
+ /* @__PURE__ */ jsxs3("div", { className: "rs-amount-detail-row", children: [
879
+ /* @__PURE__ */ jsx3("span", { children: "Fees" }),
880
+ /* @__PURE__ */ jsxs3("span", { className: "rs-amount-detail-value", children: [
881
+ /* @__PURE__ */ jsx3(
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__ */ jsx4(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx4("span", { className: "rs-amount-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx4(InfoIcon, {}) }) })
888
+ /* @__PURE__ */ jsx3(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx3(InfoIcon, {}) }) })
1060
889
  ] })
1061
890
  ] })
1062
891
  ] }),
1063
- liquidityWarning && (liquidityWarning.kind === "unavailable" || liquidityWarning.kind === "check-failed") && /* @__PURE__ */ jsxs4("div", { className: "rs-amount-error", role: "status", children: [
1064
- /* @__PURE__ */ jsx4(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
1065
- /* @__PURE__ */ jsx4("span", { children: liquidityWarning.kind === "unavailable" ? "Route may be unavailable" : "Liquidity check failed" })
1066
- ] }),
1067
- error && /* @__PURE__ */ jsxs4("div", { className: "rs-amount-error", role: "alert", children: [
1068
- /* @__PURE__ */ jsx4(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
1069
- /* @__PURE__ */ jsx4("span", { children: error })
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__ */ jsxs3("div", { className: "rs-amount-error rs-amount-error--warning", role: "status", children: [
899
+ /* @__PURE__ */ jsx3(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
900
+ /* @__PURE__ */ jsx3("span", { children: "Low liquidity detected \u2014 deposit may take longer" })
901
+ ] })
902
+ ) : /* @__PURE__ */ jsxs3("div", { className: "rs-amount-error", role: "status", children: [
903
+ /* @__PURE__ */ jsx3(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
904
+ /* @__PURE__ */ jsx3("span", { children: liquidityWarning.kind === "unavailable" ? "Route may be unavailable" : "Liquidity check failed" })
905
+ ] })),
906
+ error && /* @__PURE__ */ jsxs3("div", { className: "rs-amount-error", role: "alert", children: [
907
+ /* @__PURE__ */ jsx3(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
908
+ /* @__PURE__ */ jsx3("span", { children: error })
1070
909
  ] }),
1071
- /* @__PURE__ */ jsx4(
910
+ /* @__PURE__ */ jsx3(
1072
911
  Button,
1073
912
  {
1074
913
  onClick: handleConfirm,
@@ -1080,16 +919,16 @@ function ConfirmStep({
1080
919
  }
1081
920
  )
1082
921
  ] }),
1083
- /* @__PURE__ */ jsx4(PoweredBy, {})
922
+ /* @__PURE__ */ jsx3(PoweredBy, {})
1084
923
  ] });
1085
924
  }
1086
925
 
1087
926
  // src/components/steps/DepositAddressStep.tsx
1088
927
  import {
1089
- useState as useState6,
1090
- useEffect as useEffect6,
1091
- useCallback as useCallback3,
1092
- useRef as useRef5,
928
+ useState as useState5,
929
+ useEffect as useEffect5,
930
+ useCallback as useCallback2,
931
+ useRef as useRef4,
1093
932
  useMemo as useMemo3,
1094
933
  lazy,
1095
934
  Suspense
@@ -1097,8 +936,8 @@ import {
1097
936
  import { formatUnits as formatUnits3 } from "viem";
1098
937
 
1099
938
  // src/components/ui/DepositNotification.tsx
1100
- import { useState as useState5, useEffect as useEffect5, useRef as useRef4, useCallback as useCallback2 } from "react";
1101
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
939
+ import { useState as useState4, useEffect as useEffect4, useRef as useRef3, useCallback } from "react";
940
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1102
941
  var INITIAL_POLL_INTERVAL = 3e3;
1103
942
  var MAX_POLL_INTERVAL = 3e4;
1104
943
  var BACKOFF_MULTIPLIER = 1.5;
@@ -1155,7 +994,7 @@ function formatBridgeFailedMessage(event) {
1155
994
  }
1156
995
  return "Bridge failed";
1157
996
  }
1158
- var txLinkIcon = /* @__PURE__ */ jsx5(ExternalLinkIcon, { className: "rs-deposit-notification-link-icon" });
997
+ var txLinkIcon = /* @__PURE__ */ jsx4(ExternalLinkIcon, { className: "rs-deposit-notification-link-icon" });
1159
998
  function DepositNotification({
1160
999
  deposit,
1161
1000
  smartAccount,
@@ -1170,19 +1009,19 @@ function DepositNotification({
1170
1009
  onDismiss
1171
1010
  }) {
1172
1011
  const { txHash, sourceChain, amount, token, detectedAt, directTransfer } = deposit;
1173
- const [status, setStatus] = useState5(
1012
+ const [status, setStatus] = useState4(
1174
1013
  directTransfer ? "complete" : "processing"
1175
1014
  );
1176
- const [expanded, setExpanded] = useState5(false);
1177
- const [completedAt, setCompletedAt] = useState5(
1015
+ const [expanded, setExpanded] = useState4(false);
1016
+ const [completedAt, setCompletedAt] = useState4(
1178
1017
  directTransfer ? detectedAt : null
1179
1018
  );
1180
- const [destinationTxHash, setDestinationTxHash] = useState5(
1019
+ const [destinationTxHash, setDestinationTxHash] = useState4(
1181
1020
  null
1182
1021
  );
1183
- const pollIntervalRef = useRef4(INITIAL_POLL_INTERVAL);
1184
- const pollTimeoutRef = useRef4(null);
1185
- const completedRef = useRef4(directTransfer ?? false);
1022
+ const pollIntervalRef = useRef3(INITIAL_POLL_INTERVAL);
1023
+ const pollTimeoutRef = useRef3(null);
1024
+ const completedRef = useRef3(directTransfer ?? false);
1186
1025
  const depositContextRef = useLatestRef({
1187
1026
  amount,
1188
1027
  sourceChain,
@@ -1194,7 +1033,7 @@ function DepositNotification({
1194
1033
  });
1195
1034
  const onCompleteRef = useLatestRef(onComplete);
1196
1035
  const onFailedRef = useLatestRef(onFailed);
1197
- const handleComplete = useCallback2(
1036
+ const handleComplete = useCallback(
1198
1037
  (destTxHash) => {
1199
1038
  if (completedRef.current) return;
1200
1039
  completedRef.current = true;
@@ -1212,7 +1051,7 @@ function DepositNotification({
1212
1051
  },
1213
1052
  [depositContextRef, onCompleteRef, txHash]
1214
1053
  );
1215
- const handleFailed = useCallback2(
1054
+ const handleFailed = useCallback(
1216
1055
  (error) => {
1217
1056
  if (completedRef.current) return;
1218
1057
  completedRef.current = true;
@@ -1221,7 +1060,7 @@ function DepositNotification({
1221
1060
  },
1222
1061
  [onFailedRef, txHash]
1223
1062
  );
1224
- useEffect5(() => {
1063
+ useEffect4(() => {
1225
1064
  if (directTransfer) {
1226
1065
  handleComplete(void 0);
1227
1066
  return;
@@ -1301,33 +1140,33 @@ function DepositNotification({
1301
1140
  const destExplorerUrl = destinationTxHash ? getExplorerTxUrl(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__ */ jsx5("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ jsx5(CheckIcon, {}) }) : status === "failed" ? /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--failed", children: /* @__PURE__ */ jsx5(CloseIcon, {}) }) : /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ jsx5(Spinner, {}) });
1305
- return /* @__PURE__ */ jsxs5(
1143
+ const statusIcon = status === "complete" ? /* @__PURE__ */ jsx4("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ jsx4(CheckIcon, {}) }) : status === "failed" ? /* @__PURE__ */ jsx4("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--failed", children: /* @__PURE__ */ jsx4(CloseIcon, {}) }) : /* @__PURE__ */ jsx4("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ jsx4(Spinner, {}) });
1144
+ return /* @__PURE__ */ jsxs4(
1306
1145
  "div",
1307
1146
  {
1308
1147
  className: `rs-deposit-notification rs-deposit-notification--${status}`,
1309
1148
  children: [
1310
- /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-header", children: [
1311
- /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-icon", children: statusIcon }),
1312
- /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-content", children: [
1313
- /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-title", children: title }),
1314
- /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-subtitle", children: subtitle })
1149
+ /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-header", children: [
1150
+ /* @__PURE__ */ jsx4("div", { className: "rs-deposit-notification-icon", children: statusIcon }),
1151
+ /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-content", children: [
1152
+ /* @__PURE__ */ jsx4("div", { className: "rs-deposit-notification-title", children: title }),
1153
+ /* @__PURE__ */ jsx4("div", { className: "rs-deposit-notification-subtitle", children: subtitle })
1315
1154
  ] }),
1316
- /* @__PURE__ */ jsx5(
1155
+ /* @__PURE__ */ jsx4(
1317
1156
  "button",
1318
1157
  {
1319
1158
  type: "button",
1320
1159
  className: "rs-deposit-notification-close",
1321
1160
  onClick: () => onDismiss(deposit.id),
1322
1161
  "aria-label": "Dismiss",
1323
- children: /* @__PURE__ */ jsx5(CloseIcon, {})
1162
+ children: /* @__PURE__ */ jsx4(CloseIcon, {})
1324
1163
  }
1325
1164
  )
1326
1165
  ] }),
1327
- expanded && /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-details", children: [
1328
- /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-row", children: [
1329
- /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-label", children: "Deposit tx" }),
1330
- /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-value", children: sourceExplorerUrl ? /* @__PURE__ */ jsxs5(
1166
+ expanded && /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-details", children: [
1167
+ /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-row", children: [
1168
+ /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-label", children: "Deposit tx" }),
1169
+ /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-value", children: sourceExplorerUrl ? /* @__PURE__ */ jsxs4(
1331
1170
  "a",
1332
1171
  {
1333
1172
  href: sourceExplorerUrl,
@@ -1341,9 +1180,9 @@ function DepositNotification({
1341
1180
  }
1342
1181
  ) : truncateHash(txHash) })
1343
1182
  ] }),
1344
- destinationTxHash && /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-row", children: [
1345
- /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-label", children: "Completion tx" }),
1346
- /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-value", children: destExplorerUrl ? /* @__PURE__ */ jsxs5(
1183
+ destinationTxHash && /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-row", children: [
1184
+ /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-label", children: "Completion tx" }),
1185
+ /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-value", children: destExplorerUrl ? /* @__PURE__ */ jsxs4(
1347
1186
  "a",
1348
1187
  {
1349
1188
  href: destExplorerUrl,
@@ -1357,16 +1196,16 @@ function DepositNotification({
1357
1196
  }
1358
1197
  ) : truncateHash(destinationTxHash) })
1359
1198
  ] }),
1360
- /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-row", children: [
1361
- /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-label", children: "Order submitted" }),
1362
- /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-value", children: formatTimestamp(detectedAt) })
1199
+ /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-row", children: [
1200
+ /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-label", children: "Order submitted" }),
1201
+ /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-value", children: formatTimestamp(detectedAt) })
1363
1202
  ] }),
1364
- completedAt && /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-row", children: [
1365
- /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-label", children: "Order filled" }),
1366
- /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-value", children: formatTimestamp(completedAt) })
1203
+ completedAt && /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-row", children: [
1204
+ /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-label", children: "Order filled" }),
1205
+ /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-value", children: formatTimestamp(completedAt) })
1367
1206
  ] })
1368
1207
  ] }),
1369
- /* @__PURE__ */ jsx5(
1208
+ /* @__PURE__ */ jsx4(
1370
1209
  "button",
1371
1210
  {
1372
1211
  type: "button",
@@ -1498,7 +1337,7 @@ async function sendSolanaTransaction(provider, _connection, transaction) {
1498
1337
  }
1499
1338
 
1500
1339
  // src/components/steps/DepositAddressStep.tsx
1501
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1340
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1502
1341
  var QRCode = lazy(
1503
1342
  () => import("./QRCode-YMQTKSSK.mjs").then((m) => ({ default: m.QRCode }))
1504
1343
  );
@@ -1590,6 +1429,7 @@ function DepositAddressStep({
1590
1429
  onDepositComplete,
1591
1430
  onDepositFailed,
1592
1431
  onCopyAddress,
1432
+ onRequestWalletPicker,
1593
1433
  onError
1594
1434
  }) {
1595
1435
  const hasSolana = Boolean(solanaDepositAddress);
@@ -1613,37 +1453,37 @@ function DepositAddressStep({
1613
1453
  }, [evmChainIds, hasSolana]);
1614
1454
  const BASE_CHAIN_ID = 8453;
1615
1455
  const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : evmChainIds[0];
1616
- const [sourceChainId, setSourceChainId] = useState6(defaultChainId);
1456
+ const [sourceChainId, setSourceChainId] = useState5(defaultChainId);
1617
1457
  const isSolana = sourceChainId === "solana";
1618
1458
  const tokensForChain = useMemo3(() => {
1619
1459
  const all = isSolana ? SOLANA_TOKENS.map((t) => t.symbol) : getTargetTokenSymbolsForChain(sourceChainId);
1620
1460
  return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
1621
1461
  }, [sourceChainId, isSolana, allowedTokenSet]);
1622
1462
  const defaultToken = tokensForChain.includes("USDC") ? "USDC" : tokensForChain[0] ?? "USDC";
1623
- const [sourceTokenSymbol, setSourceTokenSymbol] = useState6(defaultToken);
1624
- useEffect6(() => {
1463
+ const [sourceTokenSymbol, setSourceTokenSymbol] = useState5(defaultToken);
1464
+ useEffect5(() => {
1625
1465
  if (!tokensForChain.includes(sourceTokenSymbol)) {
1626
1466
  const fallback = tokensForChain.includes("USDC") ? "USDC" : tokensForChain[0] ?? "USDC";
1627
1467
  setSourceTokenSymbol(fallback);
1628
1468
  }
1629
1469
  }, [tokensForChain, sourceTokenSymbol]);
1630
- const [copied, setCopied] = useState6(false);
1631
- const [pollingError, setPollingError] = useState6(null);
1632
- const [chainDropdownOpen, setChainDropdownOpen] = useState6(false);
1633
- const [tokenDropdownOpen, setTokenDropdownOpen] = useState6(false);
1634
- const [priceImpactExpanded, setPriceImpactExpanded] = useState6(false);
1635
- const chainDropdownRef = useRef5(null);
1636
- const tokenDropdownRef = useRef5(null);
1637
- const [notifications, setNotifications] = useState6([]);
1638
- const isTrackingRef = useRef5(false);
1639
- const baselineTxHashRef = useRef5(void 0);
1640
- const notificationIdRef = useRef5(0);
1641
- const sourceSelectionRef = useRef5({
1470
+ const [copied, setCopied] = useState5(false);
1471
+ const [pollingError, setPollingError] = useState5(null);
1472
+ const [chainDropdownOpen, setChainDropdownOpen] = useState5(false);
1473
+ const [tokenDropdownOpen, setTokenDropdownOpen] = useState5(false);
1474
+ const [priceImpactExpanded, setPriceImpactExpanded] = useState5(false);
1475
+ const chainDropdownRef = useRef4(null);
1476
+ const tokenDropdownRef = useRef4(null);
1477
+ const [notifications, setNotifications] = useState5([]);
1478
+ const isTrackingRef = useRef4(false);
1479
+ const baselineTxHashRef = useRef4(void 0);
1480
+ const notificationIdRef = useRef4(0);
1481
+ const sourceSelectionRef = useRef4({
1642
1482
  chainId: defaultChainId,
1643
1483
  token: typeof defaultChainId === "number" ? getTokenAddress(defaultToken, defaultChainId) : void 0,
1644
1484
  sourceSymbol: defaultToken
1645
1485
  });
1646
- useEffect6(() => {
1486
+ useEffect5(() => {
1647
1487
  if (isSolana) {
1648
1488
  const matched = SOLANA_TOKENS.find((t) => t.symbol === sourceTokenSymbol) ?? SOLANA_TOKENS[0];
1649
1489
  sourceSelectionRef.current = {
@@ -1660,10 +1500,10 @@ function DepositAddressStep({
1660
1500
  sourceSymbol: sourceTokenSymbol
1661
1501
  };
1662
1502
  }, [sourceChainId, sourceTokenSymbol, isSolana]);
1663
- const [liquidityHelper, setLiquidityHelper] = useState6({
1503
+ const [liquidityHelper, setLiquidityHelper] = useState5({
1664
1504
  kind: "idle"
1665
1505
  });
1666
- useEffect6(() => {
1506
+ useEffect5(() => {
1667
1507
  if (isSolana) {
1668
1508
  setLiquidityHelper({ kind: "idle" });
1669
1509
  return;
@@ -1714,7 +1554,7 @@ function DepositAddressStep({
1714
1554
  service
1715
1555
  ]);
1716
1556
  const displayAddress = isSolana && solanaDepositAddress ? solanaDepositAddress : smartAccount;
1717
- useEffect6(() => {
1557
+ useEffect5(() => {
1718
1558
  if (!chainDropdownOpen && !tokenDropdownOpen) return;
1719
1559
  function handlePointerDown(event) {
1720
1560
  const target = event.target;
@@ -1732,7 +1572,7 @@ function DepositAddressStep({
1732
1572
  document.removeEventListener("touchstart", handlePointerDown);
1733
1573
  };
1734
1574
  }, [chainDropdownOpen, tokenDropdownOpen]);
1735
- const handleCopy = useCallback3(async () => {
1575
+ const handleCopy = useCallback2(async () => {
1736
1576
  onCopyAddress?.();
1737
1577
  try {
1738
1578
  await navigator.clipboard.writeText(displayAddress);
@@ -1751,24 +1591,24 @@ function DepositAddressStep({
1751
1591
  setTimeout(() => setCopied(false), 2e3);
1752
1592
  }
1753
1593
  }, [displayAddress, onCopyAddress]);
1754
- useEffect6(() => {
1594
+ useEffect5(() => {
1755
1595
  setCopied(false);
1756
1596
  setChainDropdownOpen(false);
1757
1597
  setTokenDropdownOpen(false);
1758
1598
  }, [sourceChainId]);
1759
- const onDepositSubmittedRef = useRef5(onDepositSubmitted);
1599
+ const onDepositSubmittedRef = useRef4(onDepositSubmitted);
1760
1600
  onDepositSubmittedRef.current = onDepositSubmitted;
1761
- const onDepositCompleteRef = useRef5(onDepositComplete);
1601
+ const onDepositCompleteRef = useRef4(onDepositComplete);
1762
1602
  onDepositCompleteRef.current = onDepositComplete;
1763
- const onDepositFailedRef = useRef5(onDepositFailed);
1603
+ const onDepositFailedRef = useRef4(onDepositFailed);
1764
1604
  onDepositFailedRef.current = onDepositFailed;
1765
- const onErrorRef = useRef5(onError);
1605
+ const onErrorRef = useRef4(onError);
1766
1606
  onErrorRef.current = onError;
1767
- const targetChainRef = useRef5(targetChain);
1607
+ const targetChainRef = useRef4(targetChain);
1768
1608
  targetChainRef.current = targetChain;
1769
- const targetTokenRef = useRef5(targetToken);
1609
+ const targetTokenRef = useRef4(targetToken);
1770
1610
  targetTokenRef.current = targetToken;
1771
- useEffect6(() => {
1611
+ useEffect5(() => {
1772
1612
  baselineTxHashRef.current = void 0;
1773
1613
  isTrackingRef.current = false;
1774
1614
  setPollingError(null);
@@ -1863,31 +1703,31 @@ function DepositAddressStep({
1863
1703
  clearTimeout(timeoutId);
1864
1704
  };
1865
1705
  }, [smartAccount, solanaDepositAddress, service]);
1866
- const handleNotificationComplete = useCallback3(
1706
+ const handleNotificationComplete = useCallback2(
1867
1707
  (txHash, destinationTxHash, context) => {
1868
1708
  isTrackingRef.current = false;
1869
1709
  onDepositCompleteRef.current?.(txHash, destinationTxHash, context);
1870
1710
  },
1871
1711
  []
1872
1712
  );
1873
- const handleNotificationFailed = useCallback3(
1713
+ const handleNotificationFailed = useCallback2(
1874
1714
  (txHash, error) => {
1875
1715
  isTrackingRef.current = false;
1876
1716
  onDepositFailedRef.current?.(txHash, error);
1877
1717
  },
1878
1718
  []
1879
1719
  );
1880
- const handleNotificationDismiss = useCallback3((id) => {
1720
+ const handleNotificationDismiss = useCallback2((id) => {
1881
1721
  setNotifications((prev) => prev.filter((n) => n.id !== id));
1882
1722
  }, []);
1883
1723
  const qrIconSrc = getChainIcon(sourceChainId);
1884
- return /* @__PURE__ */ jsxs6("div", { className: "rs-screen rs-step--with-notifications", children: [
1885
- /* @__PURE__ */ jsxs6("div", { className: "rs-screen-body", children: [
1886
- /* @__PURE__ */ jsx6(BodyHeader, { icon: /* @__PURE__ */ jsx6(CoinsIcon, {}), title: "Transfer crypto" }),
1887
- /* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-selectors", children: [
1888
- /* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
1889
- /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
1890
- /* @__PURE__ */ jsxs6(
1724
+ return /* @__PURE__ */ jsxs5("div", { className: "rs-screen rs-step--with-notifications", children: [
1725
+ /* @__PURE__ */ jsxs5("div", { className: "rs-screen-body", children: [
1726
+ /* @__PURE__ */ jsx5(BodyHeader, { icon: /* @__PURE__ */ jsx5(CoinsIcon, {}), title: "Transfer crypto" }),
1727
+ /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-address-selectors", children: [
1728
+ /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
1729
+ /* @__PURE__ */ jsx5("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
1730
+ /* @__PURE__ */ jsxs5(
1891
1731
  "button",
1892
1732
  {
1893
1733
  type: "button",
@@ -1897,7 +1737,7 @@ function DepositAddressStep({
1897
1737
  setTokenDropdownOpen(false);
1898
1738
  },
1899
1739
  children: [
1900
- getChainIcon(sourceChainId) && /* @__PURE__ */ jsx6(
1740
+ getChainIcon(sourceChainId) && /* @__PURE__ */ jsx5(
1901
1741
  "img",
1902
1742
  {
1903
1743
  src: getChainIcon(sourceChainId),
@@ -1905,12 +1745,12 @@ function DepositAddressStep({
1905
1745
  className: "rs-deposit-address-dropdown-icon"
1906
1746
  }
1907
1747
  ),
1908
- /* @__PURE__ */ jsx6("span", { children: getChainName(sourceChainId) }),
1909
- /* @__PURE__ */ jsx6(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1748
+ /* @__PURE__ */ jsx5("span", { children: getChainName(sourceChainId) }),
1749
+ /* @__PURE__ */ jsx5(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1910
1750
  ]
1911
1751
  }
1912
1752
  ),
1913
- chainDropdownOpen && /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-dropdown-menu", children: chainOptions.map((chainId) => /* @__PURE__ */ jsxs6(
1753
+ chainDropdownOpen && /* @__PURE__ */ jsx5("div", { className: "rs-deposit-address-dropdown-menu", children: chainOptions.map((chainId) => /* @__PURE__ */ jsxs5(
1914
1754
  "button",
1915
1755
  {
1916
1756
  type: "button",
@@ -1920,7 +1760,7 @@ function DepositAddressStep({
1920
1760
  setChainDropdownOpen(false);
1921
1761
  },
1922
1762
  children: [
1923
- getChainIcon(chainId) && /* @__PURE__ */ jsx6(
1763
+ getChainIcon(chainId) && /* @__PURE__ */ jsx5(
1924
1764
  "img",
1925
1765
  {
1926
1766
  src: getChainIcon(chainId),
@@ -1928,19 +1768,19 @@ function DepositAddressStep({
1928
1768
  className: "rs-deposit-address-dropdown-icon"
1929
1769
  }
1930
1770
  ),
1931
- /* @__PURE__ */ jsx6("span", { children: getChainName(chainId) })
1771
+ /* @__PURE__ */ jsx5("span", { children: getChainName(chainId) })
1932
1772
  ]
1933
1773
  },
1934
1774
  String(chainId)
1935
1775
  )) })
1936
1776
  ] }),
1937
- /* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-dropdown", ref: tokenDropdownRef, children: [
1938
- /* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-dropdown-label rs-deposit-address-dropdown-label--with-min", children: [
1939
- /* @__PURE__ */ jsx6("span", { children: "Supported token" }),
1940
- /* @__PURE__ */ jsxs6("span", { className: "rs-deposit-address-min", children: [
1777
+ /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-address-dropdown", ref: tokenDropdownRef, children: [
1778
+ /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-address-dropdown-label rs-deposit-address-dropdown-label--with-min", children: [
1779
+ /* @__PURE__ */ jsx5("span", { children: "Supported token" }),
1780
+ /* @__PURE__ */ jsxs5("span", { className: "rs-deposit-address-min", children: [
1941
1781
  "Min.$",
1942
1782
  uiConfig?.minDepositUsd ?? 0.1,
1943
- /* @__PURE__ */ jsx6(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx6(
1783
+ /* @__PURE__ */ jsx5(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx5(
1944
1784
  InfoIcon,
1945
1785
  {
1946
1786
  className: "rs-deposit-address-min-icon",
@@ -1949,7 +1789,7 @@ function DepositAddressStep({
1949
1789
  ) })
1950
1790
  ] })
1951
1791
  ] }),
1952
- /* @__PURE__ */ jsxs6(
1792
+ /* @__PURE__ */ jsxs5(
1953
1793
  "button",
1954
1794
  {
1955
1795
  type: "button",
@@ -1959,7 +1799,7 @@ function DepositAddressStep({
1959
1799
  setChainDropdownOpen(false);
1960
1800
  },
1961
1801
  children: [
1962
- getTokenIcon(sourceTokenSymbol) && /* @__PURE__ */ jsx6(
1802
+ getTokenIcon(sourceTokenSymbol) && /* @__PURE__ */ jsx5(
1963
1803
  "img",
1964
1804
  {
1965
1805
  src: getTokenIcon(sourceTokenSymbol),
@@ -1967,12 +1807,12 @@ function DepositAddressStep({
1967
1807
  className: "rs-deposit-address-dropdown-icon"
1968
1808
  }
1969
1809
  ),
1970
- /* @__PURE__ */ jsx6("span", { children: sourceTokenSymbol }),
1971
- /* @__PURE__ */ jsx6(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1810
+ /* @__PURE__ */ jsx5("span", { children: sourceTokenSymbol }),
1811
+ /* @__PURE__ */ jsx5(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1972
1812
  ]
1973
1813
  }
1974
1814
  ),
1975
- tokenDropdownOpen && /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-dropdown-menu", children: tokensForChain.map((symbol) => /* @__PURE__ */ jsxs6(
1815
+ tokenDropdownOpen && /* @__PURE__ */ jsx5("div", { className: "rs-deposit-address-dropdown-menu", children: tokensForChain.map((symbol) => /* @__PURE__ */ jsxs5(
1976
1816
  "button",
1977
1817
  {
1978
1818
  type: "button",
@@ -1982,7 +1822,7 @@ function DepositAddressStep({
1982
1822
  setTokenDropdownOpen(false);
1983
1823
  },
1984
1824
  children: [
1985
- getTokenIcon(symbol) && /* @__PURE__ */ jsx6(
1825
+ getTokenIcon(symbol) && /* @__PURE__ */ jsx5(
1986
1826
  "img",
1987
1827
  {
1988
1828
  src: getTokenIcon(symbol),
@@ -1990,23 +1830,23 @@ function DepositAddressStep({
1990
1830
  className: "rs-deposit-address-dropdown-icon"
1991
1831
  }
1992
1832
  ),
1993
- /* @__PURE__ */ jsx6("span", { children: symbol })
1833
+ /* @__PURE__ */ jsx5("span", { children: symbol })
1994
1834
  ]
1995
1835
  },
1996
1836
  symbol
1997
1837
  )) })
1998
1838
  ] })
1999
1839
  ] }),
2000
- /* @__PURE__ */ jsxs6(
1840
+ /* @__PURE__ */ jsxs5(
2001
1841
  "div",
2002
1842
  {
2003
1843
  style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
2004
1844
  children: [
2005
- /* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-well", children: [
2006
- /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx6(
1845
+ /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-address-well", children: [
1846
+ /* @__PURE__ */ jsx5("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx5(
2007
1847
  Suspense,
2008
1848
  {
2009
- fallback: /* @__PURE__ */ jsx6(
1849
+ fallback: /* @__PURE__ */ jsx5(
2010
1850
  "div",
2011
1851
  {
2012
1852
  style: {
@@ -2016,22 +1856,22 @@ function DepositAddressStep({
2016
1856
  alignItems: "center",
2017
1857
  justifyContent: "center"
2018
1858
  },
2019
- children: /* @__PURE__ */ jsx6(Spinner, {})
1859
+ children: /* @__PURE__ */ jsx5(Spinner, {})
2020
1860
  }
2021
1861
  ),
2022
- children: /* @__PURE__ */ jsx6(QRCode, { value: displayAddress, size: 220, iconSrc: qrIconSrc })
1862
+ children: /* @__PURE__ */ jsx5(QRCode, { value: displayAddress, size: 220, iconSrc: qrIconSrc })
2023
1863
  }
2024
1864
  ) }),
2025
- /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-value", children: displayAddress })
1865
+ /* @__PURE__ */ jsx5("div", { className: "rs-deposit-address-value", children: displayAddress })
2026
1866
  ] }),
2027
- /* @__PURE__ */ jsxs6(
1867
+ /* @__PURE__ */ jsxs5(
2028
1868
  "button",
2029
1869
  {
2030
1870
  type: "button",
2031
1871
  className: "rs-deposit-address-copy",
2032
1872
  onClick: handleCopy,
2033
1873
  children: [
2034
- copied ? /* @__PURE__ */ jsx6(CheckIcon, {}) : /* @__PURE__ */ jsx6(CopyIcon, {}),
1874
+ copied ? /* @__PURE__ */ jsx5(CheckIcon, {}) : /* @__PURE__ */ jsx5(CopyIcon, {}),
2035
1875
  copied ? "Copied!" : "Copy address"
2036
1876
  ]
2037
1877
  }
@@ -2039,12 +1879,12 @@ function DepositAddressStep({
2039
1879
  ]
2040
1880
  }
2041
1881
  ),
2042
- /* @__PURE__ */ jsxs6(
1882
+ /* @__PURE__ */ jsxs5(
2043
1883
  "div",
2044
1884
  {
2045
1885
  className: `rs-price-impact ${priceImpactExpanded ? "rs-price-impact--open" : ""}`,
2046
1886
  children: [
2047
- /* @__PURE__ */ jsxs6(
1887
+ /* @__PURE__ */ jsxs5(
2048
1888
  "button",
2049
1889
  {
2050
1890
  type: "button",
@@ -2052,19 +1892,19 @@ function DepositAddressStep({
2052
1892
  onClick: () => setPriceImpactExpanded((v) => !v),
2053
1893
  "aria-expanded": priceImpactExpanded,
2054
1894
  children: [
2055
- /* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-header-left", children: [
2056
- /* @__PURE__ */ jsx6("span", { className: "rs-price-impact-label", children: "Price impact" }),
2057
- /* @__PURE__ */ jsx6("span", { className: "rs-price-impact-label", children: /* @__PURE__ */ jsx6("strong", { children: "0.00%" }) }),
2058
- /* @__PURE__ */ jsx6(
1895
+ /* @__PURE__ */ jsxs5("span", { className: "rs-price-impact-header-left", children: [
1896
+ /* @__PURE__ */ jsx5("span", { className: "rs-price-impact-label", children: "Price impact" }),
1897
+ /* @__PURE__ */ jsx5("span", { className: "rs-price-impact-label", children: /* @__PURE__ */ jsx5("strong", { children: "0.00%" }) }),
1898
+ /* @__PURE__ */ jsx5(
2059
1899
  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__ */ jsx6(InfoIcon, { "aria-hidden": "true" })
1903
+ children: /* @__PURE__ */ jsx5(InfoIcon, { "aria-hidden": "true" })
2064
1904
  }
2065
1905
  )
2066
1906
  ] }),
2067
- /* @__PURE__ */ jsx6(
1907
+ /* @__PURE__ */ jsx5(
2068
1908
  ChevronDownIcon,
2069
1909
  {
2070
1910
  className: "rs-price-impact-chevron",
@@ -2074,35 +1914,35 @@ function DepositAddressStep({
2074
1914
  ]
2075
1915
  }
2076
1916
  ),
2077
- /* @__PURE__ */ jsx6("div", { className: "rs-price-impact-panel", children: /* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-panel-inner", children: [
2078
- /* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-row", children: [
2079
- /* @__PURE__ */ jsx6("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(PercentIcon, {}) }),
2080
- /* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-label", children: [
1917
+ /* @__PURE__ */ jsx5("div", { className: "rs-price-impact-panel", children: /* @__PURE__ */ jsxs5("div", { className: "rs-price-impact-panel-inner", children: [
1918
+ /* @__PURE__ */ jsxs5("div", { className: "rs-price-impact-row", children: [
1919
+ /* @__PURE__ */ jsx5("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(PercentIcon, {}) }),
1920
+ /* @__PURE__ */ jsxs5("span", { className: "rs-price-impact-label", children: [
2081
1921
  "Max slippage: ",
2082
- /* @__PURE__ */ jsx6("strong", { children: "0.2%" })
1922
+ /* @__PURE__ */ jsx5("strong", { children: "0.2%" })
2083
1923
  ] }),
2084
- /* @__PURE__ */ jsx6(
1924
+ /* @__PURE__ */ jsx5(
2085
1925
  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__ */ jsx6(InfoIcon, { "aria-hidden": "true" })
1929
+ children: /* @__PURE__ */ jsx5(InfoIcon, { "aria-hidden": "true" })
2090
1930
  }
2091
1931
  )
2092
1932
  ] }),
2093
- /* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-row", children: [
2094
- /* @__PURE__ */ jsx6("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(ClockIcon, {}) }),
2095
- /* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-label", children: [
1933
+ /* @__PURE__ */ jsxs5("div", { className: "rs-price-impact-row", children: [
1934
+ /* @__PURE__ */ jsx5("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(ClockIcon, {}) }),
1935
+ /* @__PURE__ */ jsxs5("span", { className: "rs-price-impact-label", children: [
2096
1936
  "Processing time: ",
2097
- /* @__PURE__ */ jsx6("strong", { children: "< 1 min" })
1937
+ /* @__PURE__ */ jsx5("strong", { children: "< 1 min" })
2098
1938
  ] })
2099
1939
  ] }),
2100
- /* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-row", children: [
2101
- /* @__PURE__ */ jsx6("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(PlusCircleIcon, {}) }),
2102
- /* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-label", children: [
1940
+ /* @__PURE__ */ jsxs5("div", { className: "rs-price-impact-row", children: [
1941
+ /* @__PURE__ */ jsx5("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(PlusCircleIcon, {}) }),
1942
+ /* @__PURE__ */ jsxs5("span", { className: "rs-price-impact-label", children: [
2103
1943
  "Max deposit:",
2104
1944
  " ",
2105
- /* @__PURE__ */ jsx6("strong", { children: liquidityHelper.kind === "max" ? `${formatUnits3(
1945
+ /* @__PURE__ */ jsx5("strong", { children: liquidityHelper.kind === "max" ? `${formatUnits3(
2106
1946
  BigInt(liquidityHelper.maxAmount),
2107
1947
  liquidityHelper.decimals
2108
1948
  )} ${liquidityHelper.symbol}` : liquidityHelper.kind === "unlimited" ? "Unlimited" : liquidityHelper.kind === "unavailable" ? "Unavailable" : liquidityHelper.kind === "error" ? "\u2014" : "\u2026" })
@@ -2112,9 +1952,18 @@ function DepositAddressStep({
2112
1952
  ]
2113
1953
  }
2114
1954
  ),
2115
- pollingError && /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-error", children: pollingError })
1955
+ pollingError && /* @__PURE__ */ jsx5("div", { className: "rs-deposit-address-error", children: pollingError }),
1956
+ onRequestWalletPicker && /* @__PURE__ */ jsx5(
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
- notifications.length > 0 && /* @__PURE__ */ jsx6("div", { className: "rs-deposit-notifications", children: notifications.map((deposit) => /* @__PURE__ */ jsx6(
1966
+ notifications.length > 0 && /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notifications", children: notifications.map((deposit) => /* @__PURE__ */ jsx5(
2118
1967
  DepositNotification,
2119
1968
  {
2120
1969
  deposit,
@@ -2131,15 +1980,15 @@ function DepositAddressStep({
2131
1980
  },
2132
1981
  deposit.id
2133
1982
  )) }),
2134
- /* @__PURE__ */ jsx6(PoweredBy, {})
1983
+ /* @__PURE__ */ jsx5(PoweredBy, {})
2135
1984
  ] });
2136
1985
  }
2137
1986
  DepositAddressStep.displayName = "DepositAddressStep";
2138
1987
 
2139
1988
  // src/components/steps/SolanaTokenSelectStep.tsx
2140
- import { useState as useState7, useEffect as useEffect7, useMemo as useMemo4 } from "react";
1989
+ import { useState as useState6, useEffect as useEffect6, useMemo as useMemo4 } from "react";
2141
1990
  import { formatUnits as formatUnits4 } from "viem";
2142
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1991
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
2143
1992
  function SolanaTokenSelectStep({
2144
1993
  solanaAddress,
2145
1994
  service,
@@ -2147,11 +1996,11 @@ function SolanaTokenSelectStep({
2147
1996
  onTotalBalanceComputed,
2148
1997
  debug
2149
1998
  }) {
2150
- const [tokenBalances, setTokenBalances] = useState7([]);
2151
- const [selectedSymbol, setSelectedSymbol] = useState7(null);
2152
- const [loading, setLoading] = useState7(true);
2153
- const [error, setError] = useState7(null);
2154
- useEffect7(() => {
1999
+ const [tokenBalances, setTokenBalances] = useState6([]);
2000
+ const [selectedSymbol, setSelectedSymbol] = useState6(null);
2001
+ const [loading, setLoading] = useState6(true);
2002
+ const [error, setError] = useState6(null);
2003
+ useEffect6(() => {
2155
2004
  let active = true;
2156
2005
  async function loadBalances() {
2157
2006
  if (!solanaAddress) {
@@ -2233,37 +2082,37 @@ function SolanaTokenSelectStep({
2233
2082
  );
2234
2083
  const selectedEntry = selectedSymbol ? rows.find((r) => r.token.symbol === selectedSymbol) : null;
2235
2084
  if (error) {
2236
- return /* @__PURE__ */ jsx7("div", { className: "rs-step", children: /* @__PURE__ */ jsx7("div", { className: "rs-step-body", children: /* @__PURE__ */ jsx7("div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ jsx7("span", { className: "rs-alert-text", children: error }) }) }) });
2085
+ return /* @__PURE__ */ jsx6("div", { className: "rs-step", children: /* @__PURE__ */ jsx6("div", { className: "rs-step-body", children: /* @__PURE__ */ jsx6("div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ jsx6("span", { className: "rs-alert-text", children: error }) }) }) });
2237
2086
  }
2238
- return /* @__PURE__ */ jsxs7("div", { className: "rs-step", children: [
2239
- /* @__PURE__ */ jsx7("div", { style: { padding: "0 12px 12px" }, children: /* @__PURE__ */ jsx7(
2087
+ return /* @__PURE__ */ jsxs6("div", { className: "rs-step", children: [
2088
+ /* @__PURE__ */ jsx6("div", { style: { padding: "0 12px 12px" }, children: /* @__PURE__ */ jsx6(
2240
2089
  BodyHeader,
2241
2090
  {
2242
- icon: /* @__PURE__ */ jsx7(CoinsIcon, {}),
2091
+ icon: /* @__PURE__ */ jsx6(CoinsIcon, {}),
2243
2092
  title: "Select asset",
2244
2093
  subtitle: "Pick a Solana token to deposit"
2245
2094
  }
2246
2095
  ) }),
2247
- /* @__PURE__ */ jsxs7(
2096
+ /* @__PURE__ */ jsxs6(
2248
2097
  "div",
2249
2098
  {
2250
2099
  className: "rs-step-body",
2251
2100
  style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
2252
2101
  children: [
2253
- loading && /* @__PURE__ */ jsxs7("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
2254
- /* @__PURE__ */ jsx7(Spinner, { className: "rs-text-tertiary" }),
2255
- /* @__PURE__ */ jsx7("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
2102
+ loading && /* @__PURE__ */ jsxs6("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
2103
+ /* @__PURE__ */ jsx6(Spinner, { className: "rs-text-tertiary" }),
2104
+ /* @__PURE__ */ jsx6("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
2256
2105
  ] }),
2257
- !loading && rows.length === 0 && /* @__PURE__ */ jsxs7("div", { className: "rs-empty-state", children: [
2258
- /* @__PURE__ */ jsx7(WalletIcon, { className: "rs-empty-icon" }),
2259
- /* @__PURE__ */ jsx7("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
2260
- /* @__PURE__ */ jsxs7("div", { className: "rs-empty-address", children: [
2106
+ !loading && rows.length === 0 && /* @__PURE__ */ jsxs6("div", { className: "rs-empty-state", children: [
2107
+ /* @__PURE__ */ jsx6(WalletIcon, { className: "rs-empty-icon" }),
2108
+ /* @__PURE__ */ jsx6("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
2109
+ /* @__PURE__ */ jsxs6("div", { className: "rs-empty-address", children: [
2261
2110
  solanaAddress.slice(0, 6),
2262
2111
  "...",
2263
2112
  solanaAddress.slice(-4)
2264
2113
  ] })
2265
2114
  ] }),
2266
- !loading && rows.length > 0 && /* @__PURE__ */ jsx7("div", { className: "rs-asset-list", children: rows.map((entry) => {
2115
+ !loading && rows.length > 0 && /* @__PURE__ */ jsx6("div", { className: "rs-asset-list", children: rows.map((entry) => {
2267
2116
  const isSelected = selectedSymbol === entry.token.symbol;
2268
2117
  const tokenIcon = getTokenIcon(entry.token.symbol);
2269
2118
  const chainIcon = getChainIcon("solana");
@@ -2275,7 +2124,7 @@ function SolanaTokenSelectStep({
2275
2124
  } catch {
2276
2125
  formattedBalance = "...";
2277
2126
  }
2278
- return /* @__PURE__ */ jsxs7(
2127
+ return /* @__PURE__ */ jsxs6(
2279
2128
  "button",
2280
2129
  {
2281
2130
  type: "button",
@@ -2283,9 +2132,9 @@ function SolanaTokenSelectStep({
2283
2132
  className: `rs-asset-row ${isSelected ? "rs-asset-row--selected" : ""}`,
2284
2133
  style: { textAlign: "left" },
2285
2134
  children: [
2286
- /* @__PURE__ */ jsxs7("div", { className: "rs-asset-info", children: [
2287
- /* @__PURE__ */ jsxs7("div", { className: "rs-asset-icon-wrapper", children: [
2288
- tokenIcon ? /* @__PURE__ */ jsx7(
2135
+ /* @__PURE__ */ jsxs6("div", { className: "rs-asset-info", children: [
2136
+ /* @__PURE__ */ jsxs6("div", { className: "rs-asset-icon-wrapper", children: [
2137
+ tokenIcon ? /* @__PURE__ */ jsx6(
2289
2138
  "img",
2290
2139
  {
2291
2140
  src: tokenIcon,
@@ -2293,8 +2142,8 @@ function SolanaTokenSelectStep({
2293
2142
  className: "rs-asset-icon",
2294
2143
  style: { background: "transparent" }
2295
2144
  }
2296
- ) : /* @__PURE__ */ jsx7("div", { className: "rs-asset-icon", children: entry.token.symbol.slice(0, 4) }),
2297
- chainIcon && /* @__PURE__ */ jsx7(
2145
+ ) : /* @__PURE__ */ jsx6("div", { className: "rs-asset-icon", children: entry.token.symbol.slice(0, 4) }),
2146
+ chainIcon && /* @__PURE__ */ jsx6(
2298
2147
  "img",
2299
2148
  {
2300
2149
  src: chainIcon,
@@ -2303,19 +2152,19 @@ function SolanaTokenSelectStep({
2303
2152
  }
2304
2153
  )
2305
2154
  ] }),
2306
- /* @__PURE__ */ jsxs7("div", { children: [
2307
- /* @__PURE__ */ jsxs7("div", { className: "rs-asset-name", children: [
2155
+ /* @__PURE__ */ jsxs6("div", { children: [
2156
+ /* @__PURE__ */ jsxs6("div", { className: "rs-asset-name", children: [
2308
2157
  entry.token.symbol,
2309
- /* @__PURE__ */ jsx7("span", { className: "rs-asset-chain", children: " on Solana" })
2158
+ /* @__PURE__ */ jsx6("span", { className: "rs-asset-chain", children: " on Solana" })
2310
2159
  ] }),
2311
- /* @__PURE__ */ jsxs7("div", { className: "rs-asset-balance-small", children: [
2160
+ /* @__PURE__ */ jsxs6("div", { className: "rs-asset-balance-small", children: [
2312
2161
  formattedBalance,
2313
2162
  " ",
2314
2163
  entry.token.symbol
2315
2164
  ] })
2316
2165
  ] })
2317
2166
  ] }),
2318
- /* @__PURE__ */ jsx7("div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? currencyFormatter.format(entry.balanceUsd) : `${formattedBalance} ${entry.token.symbol}` })
2167
+ /* @__PURE__ */ jsx6("div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? currencyFormatter.format(entry.balanceUsd) : `${formattedBalance} ${entry.token.symbol}` })
2319
2168
  ]
2320
2169
  },
2321
2170
  entry.token.symbol
@@ -2324,7 +2173,7 @@ function SolanaTokenSelectStep({
2324
2173
  ]
2325
2174
  }
2326
2175
  ),
2327
- /* @__PURE__ */ jsx7("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx7(
2176
+ /* @__PURE__ */ jsx6("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx6(
2328
2177
  Button,
2329
2178
  {
2330
2179
  onClick: () => selectedEntry && onContinue(
@@ -2337,14 +2186,14 @@ function SolanaTokenSelectStep({
2337
2186
  children: "Continue"
2338
2187
  }
2339
2188
  ) }),
2340
- /* @__PURE__ */ jsx7(PoweredBy, {})
2189
+ /* @__PURE__ */ jsx6(PoweredBy, {})
2341
2190
  ] });
2342
2191
  }
2343
2192
 
2344
2193
  // src/components/steps/SolanaAmountStep.tsx
2345
- import { useEffect as useEffect8, useMemo as useMemo5, useState as useState8 } from "react";
2194
+ import { useEffect as useEffect7, useMemo as useMemo5, useState as useState7 } from "react";
2346
2195
  import { formatUnits as formatUnits5, parseUnits as parseUnits3 } from "viem";
2347
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
2196
+ import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
2348
2197
  var SOL_FEE_RESERVE_LAMPORTS = 1000000n;
2349
2198
  var PRESETS2 = [
2350
2199
  { value: 25, label: "25%" },
@@ -2365,8 +2214,8 @@ function SolanaAmountStep({
2365
2214
  onContinue,
2366
2215
  debug
2367
2216
  }) {
2368
- const [amount, setAmount] = useState8("");
2369
- const [error, setError] = useState8(null);
2217
+ const [amount, setAmount] = useState7("");
2218
+ const [error, setError] = useState7(null);
2370
2219
  const isSourceStablecoin = isStablecoinSymbol(token.symbol);
2371
2220
  const tokenPriceUsd = useMemo5(() => {
2372
2221
  if (isSourceStablecoin) return 1;
@@ -2382,7 +2231,7 @@ function SolanaAmountStep({
2382
2231
  }
2383
2232
  }, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
2384
2233
  const hasPricing = tokenPriceUsd !== null;
2385
- useEffect8(() => {
2234
+ useEffect7(() => {
2386
2235
  if (defaultAmount && !amount) {
2387
2236
  const parsed = Number(defaultAmount);
2388
2237
  if (Number.isFinite(parsed) && parsed > 0) {
@@ -2519,14 +2368,14 @@ function SolanaAmountStep({
2519
2368
  const continueLabel = exceedsBalance ? "Insufficient balance" : isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue";
2520
2369
  const continueDisabled = exceedsBalance || numericAmount === 0 && !isBelowMin;
2521
2370
  const sourceTokenIcon = getTokenIcon(token.symbol);
2522
- return /* @__PURE__ */ jsxs8("div", { className: "rs-screen", children: [
2523
- /* @__PURE__ */ jsxs8("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2524
- /* @__PURE__ */ jsx8(BodyHeader, { icon: /* @__PURE__ */ jsx8(WalletIcon, {}), title: "Wallet deposit" }),
2525
- /* @__PURE__ */ jsxs8("div", { className: "rs-amount-section", children: [
2526
- /* @__PURE__ */ jsxs8("div", { className: "rs-amount-display", children: [
2527
- /* @__PURE__ */ jsxs8("div", { className: "rs-amount-input-row", children: [
2528
- /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: "$" }),
2529
- /* @__PURE__ */ jsx8(
2371
+ return /* @__PURE__ */ jsxs7("div", { className: "rs-screen", children: [
2372
+ /* @__PURE__ */ jsxs7("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2373
+ /* @__PURE__ */ jsx7(BodyHeader, { icon: /* @__PURE__ */ jsx7(WalletIcon, {}), title: "Wallet deposit" }),
2374
+ /* @__PURE__ */ jsxs7("div", { className: "rs-amount-section", children: [
2375
+ /* @__PURE__ */ jsxs7("div", { className: "rs-amount-display", children: [
2376
+ /* @__PURE__ */ jsxs7("div", { className: "rs-amount-input-row", children: [
2377
+ /* @__PURE__ */ jsx7("span", { "aria-hidden": "true", children: "$" }),
2378
+ /* @__PURE__ */ jsx7(
2530
2379
  "input",
2531
2380
  {
2532
2381
  type: "text",
@@ -2539,25 +2388,25 @@ function SolanaAmountStep({
2539
2388
  }
2540
2389
  )
2541
2390
  ] }),
2542
- /* @__PURE__ */ jsxs8("div", { className: "rs-amount-meta", children: [
2543
- /* @__PURE__ */ jsxs8("span", { className: "rs-amount-meta-balance", children: [
2391
+ /* @__PURE__ */ jsxs7("div", { className: "rs-amount-meta", children: [
2392
+ /* @__PURE__ */ jsxs7("span", { className: "rs-amount-meta-balance", children: [
2544
2393
  formattedBalance,
2545
2394
  " ",
2546
2395
  token.symbol,
2547
2396
  " available",
2548
- computedBalanceUsd !== null && /* @__PURE__ */ jsxs8(Fragment2, { children: [
2397
+ computedBalanceUsd !== null && /* @__PURE__ */ jsxs7(Fragment2, { children: [
2549
2398
  " (~",
2550
2399
  currencyFormatter.format(computedBalanceUsd),
2551
2400
  ")"
2552
2401
  ] })
2553
2402
  ] }),
2554
- minDepositUsd !== null && /* @__PURE__ */ jsxs8("span", { className: "rs-amount-meta-minimum", children: [
2403
+ minDepositUsd !== null && /* @__PURE__ */ jsxs7("span", { className: "rs-amount-meta-minimum", children: [
2555
2404
  "Min. deposit ",
2556
2405
  currencyFormatter.format(minDepositUsd)
2557
2406
  ] })
2558
2407
  ] })
2559
2408
  ] }),
2560
- /* @__PURE__ */ jsx8("div", { className: "rs-amount-presets", children: PRESETS2.map((preset) => /* @__PURE__ */ jsx8(
2409
+ /* @__PURE__ */ jsx7("div", { className: "rs-amount-presets", children: PRESETS2.map((preset) => /* @__PURE__ */ jsx7(
2561
2410
  "button",
2562
2411
  {
2563
2412
  type: "button",
@@ -2568,38 +2417,38 @@ function SolanaAmountStep({
2568
2417
  preset.value
2569
2418
  )) })
2570
2419
  ] }),
2571
- /* @__PURE__ */ jsxs8("div", { className: "rs-amount-details", children: [
2572
- /* @__PURE__ */ jsxs8("div", { className: "rs-amount-detail-row", children: [
2573
- /* @__PURE__ */ jsx8("span", { children: "You send" }),
2574
- /* @__PURE__ */ jsxs8("span", { className: "rs-amount-detail-value", children: [
2575
- /* @__PURE__ */ jsxs8("span", { children: [
2420
+ /* @__PURE__ */ jsxs7("div", { className: "rs-amount-details", children: [
2421
+ /* @__PURE__ */ jsxs7("div", { className: "rs-amount-detail-row", children: [
2422
+ /* @__PURE__ */ jsx7("span", { children: "You send" }),
2423
+ /* @__PURE__ */ jsxs7("span", { className: "rs-amount-detail-value", children: [
2424
+ /* @__PURE__ */ jsxs7("span", { children: [
2576
2425
  "Solana ",
2577
2426
  token.symbol
2578
2427
  ] }),
2579
- sourceTokenIcon && /* @__PURE__ */ jsx8("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx8("img", { src: sourceTokenIcon, alt: "" }) })
2428
+ sourceTokenIcon && /* @__PURE__ */ jsx7("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx7("img", { src: sourceTokenIcon, alt: "" }) })
2580
2429
  ] })
2581
2430
  ] }),
2582
- targetChainName && targetTokenSymbol && /* @__PURE__ */ jsxs8("div", { className: "rs-amount-detail-row", children: [
2583
- /* @__PURE__ */ jsx8("span", { children: "Receive" }),
2584
- /* @__PURE__ */ jsxs8("span", { className: "rs-amount-detail-value", children: [
2585
- /* @__PURE__ */ jsxs8("span", { children: [
2431
+ targetChainName && targetTokenSymbol && /* @__PURE__ */ jsxs7("div", { className: "rs-amount-detail-row", children: [
2432
+ /* @__PURE__ */ jsx7("span", { children: "Receive" }),
2433
+ /* @__PURE__ */ jsxs7("span", { className: "rs-amount-detail-value", children: [
2434
+ /* @__PURE__ */ jsxs7("span", { children: [
2586
2435
  targetChainName,
2587
2436
  " ",
2588
2437
  targetTokenSymbol
2589
2438
  ] }),
2590
- targetTokenIcon && /* @__PURE__ */ jsx8("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx8("img", { src: targetTokenIcon, alt: "" }) })
2439
+ targetTokenIcon && /* @__PURE__ */ jsx7("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx7("img", { src: targetTokenIcon, alt: "" }) })
2591
2440
  ] })
2592
2441
  ] }),
2593
- balanceAfterUsd !== null && /* @__PURE__ */ jsxs8("div", { className: "rs-amount-detail-row", children: [
2594
- /* @__PURE__ */ jsx8("span", { children: "Balance after deposit" }),
2595
- /* @__PURE__ */ jsx8("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
2442
+ balanceAfterUsd !== null && /* @__PURE__ */ jsxs7("div", { className: "rs-amount-detail-row", children: [
2443
+ /* @__PURE__ */ jsx7("span", { children: "Balance after deposit" }),
2444
+ /* @__PURE__ */ jsx7("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
2596
2445
  ] })
2597
2446
  ] }),
2598
- error && /* @__PURE__ */ jsxs8("div", { className: "rs-amount-error", role: "alert", children: [
2599
- /* @__PURE__ */ jsx8(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
2600
- /* @__PURE__ */ jsx8("span", { children: error })
2447
+ error && /* @__PURE__ */ jsxs7("div", { className: "rs-amount-error", role: "alert", children: [
2448
+ /* @__PURE__ */ jsx7(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
2449
+ /* @__PURE__ */ jsx7("span", { children: error })
2601
2450
  ] }),
2602
- /* @__PURE__ */ jsx8(
2451
+ /* @__PURE__ */ jsx7(
2603
2452
  Button,
2604
2453
  {
2605
2454
  onClick: handleContinue,
@@ -2609,14 +2458,14 @@ function SolanaAmountStep({
2609
2458
  }
2610
2459
  )
2611
2460
  ] }),
2612
- /* @__PURE__ */ jsx8(PoweredBy, {})
2461
+ /* @__PURE__ */ jsx7(PoweredBy, {})
2613
2462
  ] });
2614
2463
  }
2615
2464
 
2616
2465
  // src/components/steps/SolanaConfirmStep.tsx
2617
- import { useState as useState9 } from "react";
2466
+ import { useState as useState8 } from "react";
2618
2467
  import { parseUnits as parseUnits4 } from "viem";
2619
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
2468
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
2620
2469
  function SolanaConfirmStep({
2621
2470
  smartAccount,
2622
2471
  solanaAddress,
@@ -2634,8 +2483,8 @@ function SolanaConfirmStep({
2634
2483
  onError,
2635
2484
  debug
2636
2485
  }) {
2637
- const [isSubmitting, setIsSubmitting] = useState9(false);
2638
- const [error, setError] = useState9(null);
2486
+ const [isSubmitting, setIsSubmitting] = useState8(false);
2487
+ const [error, setError] = useState8(null);
2639
2488
  const targetSymbol = getTokenSymbol(targetToken, targetChain);
2640
2489
  const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
2641
2490
  const formattedAmount = sourceAmount && !Number.isNaN(Number(sourceAmount)) ? Number(sourceAmount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
@@ -2740,19 +2589,19 @@ function SolanaConfirmStep({
2740
2589
  setIsSubmitting(false);
2741
2590
  }
2742
2591
  };
2743
- return /* @__PURE__ */ jsxs9("div", { className: "rs-step", children: [
2744
- /* @__PURE__ */ jsx9("div", { style: { padding: "0 12px 12px" }, children: /* @__PURE__ */ jsx9(BodyHeader, { icon: /* @__PURE__ */ jsx9(WalletIcon, {}), title: "Review deposit" }) }),
2745
- /* @__PURE__ */ jsxs9("div", { className: "rs-step-body rs-space-y-3", style: { paddingTop: 0 }, children: [
2746
- /* @__PURE__ */ jsxs9("div", { className: "rs-card", children: [
2747
- /* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
2748
- /* @__PURE__ */ jsx9("span", { className: "rs-card-label", children: "Source" }),
2749
- /* @__PURE__ */ jsxs9(
2592
+ return /* @__PURE__ */ jsxs8("div", { className: "rs-step", children: [
2593
+ /* @__PURE__ */ jsx8("div", { style: { padding: "0 12px 12px" }, children: /* @__PURE__ */ jsx8(BodyHeader, { icon: /* @__PURE__ */ jsx8(WalletIcon, {}), title: "Review deposit" }) }),
2594
+ /* @__PURE__ */ jsxs8("div", { className: "rs-step-body rs-space-y-3", style: { paddingTop: 0 }, children: [
2595
+ /* @__PURE__ */ jsxs8("div", { className: "rs-card", children: [
2596
+ /* @__PURE__ */ jsxs8("div", { className: "rs-card-row", children: [
2597
+ /* @__PURE__ */ jsx8("span", { className: "rs-card-label", children: "Source" }),
2598
+ /* @__PURE__ */ jsxs8(
2750
2599
  "span",
2751
2600
  {
2752
2601
  className: "rs-card-value",
2753
2602
  style: { display: "flex", alignItems: "center", gap: 8 },
2754
2603
  children: [
2755
- getChainIcon("solana") && /* @__PURE__ */ jsx9(
2604
+ getChainIcon("solana") && /* @__PURE__ */ jsx8(
2756
2605
  "img",
2757
2606
  {
2758
2607
  src: getChainIcon("solana"),
@@ -2765,15 +2614,15 @@ function SolanaConfirmStep({
2765
2614
  }
2766
2615
  )
2767
2616
  ] }),
2768
- /* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
2769
- /* @__PURE__ */ jsx9("span", { className: "rs-card-label", children: "Destination" }),
2770
- /* @__PURE__ */ jsxs9(
2617
+ /* @__PURE__ */ jsxs8("div", { className: "rs-card-row", children: [
2618
+ /* @__PURE__ */ jsx8("span", { className: "rs-card-label", children: "Destination" }),
2619
+ /* @__PURE__ */ jsxs8(
2771
2620
  "span",
2772
2621
  {
2773
2622
  className: "rs-card-value",
2774
2623
  style: { display: "flex", alignItems: "center", gap: 8 },
2775
2624
  children: [
2776
- getChainIcon(targetChain) && /* @__PURE__ */ jsx9(
2625
+ getChainIcon(targetChain) && /* @__PURE__ */ jsx8(
2777
2626
  "img",
2778
2627
  {
2779
2628
  src: getChainIcon(targetChain),
@@ -2786,21 +2635,21 @@ function SolanaConfirmStep({
2786
2635
  }
2787
2636
  )
2788
2637
  ] }),
2789
- /* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
2790
- /* @__PURE__ */ jsx9("span", { className: "rs-card-label", children: "Estimated time" }),
2791
- /* @__PURE__ */ jsx9("span", { className: "rs-card-value", children: "< 1 min" })
2638
+ /* @__PURE__ */ jsxs8("div", { className: "rs-card-row", children: [
2639
+ /* @__PURE__ */ jsx8("span", { className: "rs-card-label", children: "Estimated time" }),
2640
+ /* @__PURE__ */ jsx8("span", { className: "rs-card-value", children: "< 1 min" })
2792
2641
  ] })
2793
2642
  ] }),
2794
- /* @__PURE__ */ jsxs9("div", { className: "rs-card", children: [
2795
- /* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
2796
- /* @__PURE__ */ jsx9("span", { className: "rs-card-label", children: "You send" }),
2797
- /* @__PURE__ */ jsxs9(
2643
+ /* @__PURE__ */ jsxs8("div", { className: "rs-card", children: [
2644
+ /* @__PURE__ */ jsxs8("div", { className: "rs-card-row", children: [
2645
+ /* @__PURE__ */ jsx8("span", { className: "rs-card-label", children: "You send" }),
2646
+ /* @__PURE__ */ jsxs8(
2798
2647
  "span",
2799
2648
  {
2800
2649
  className: "rs-card-value",
2801
2650
  style: { display: "flex", alignItems: "center", gap: 6 },
2802
2651
  children: [
2803
- getTokenIcon(token.symbol) && /* @__PURE__ */ jsx9(
2652
+ getTokenIcon(token.symbol) && /* @__PURE__ */ jsx8(
2804
2653
  "img",
2805
2654
  {
2806
2655
  src: getTokenIcon(token.symbol),
@@ -2815,15 +2664,15 @@ function SolanaConfirmStep({
2815
2664
  }
2816
2665
  )
2817
2666
  ] }),
2818
- /* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
2819
- /* @__PURE__ */ jsx9("span", { className: "rs-card-label", children: "You receive" }),
2820
- /* @__PURE__ */ jsxs9(
2667
+ /* @__PURE__ */ jsxs8("div", { className: "rs-card-row", children: [
2668
+ /* @__PURE__ */ jsx8("span", { className: "rs-card-label", children: "You receive" }),
2669
+ /* @__PURE__ */ jsxs8(
2821
2670
  "span",
2822
2671
  {
2823
2672
  className: "rs-card-value",
2824
2673
  style: { display: "flex", alignItems: "center", gap: 6 },
2825
2674
  children: [
2826
- getTokenIcon(targetSymbol) && /* @__PURE__ */ jsx9(
2675
+ getTokenIcon(targetSymbol) && /* @__PURE__ */ jsx8(
2827
2676
  "img",
2828
2677
  {
2829
2678
  src: getTokenIcon(targetSymbol),
@@ -2839,12 +2688,12 @@ function SolanaConfirmStep({
2839
2688
  )
2840
2689
  ] })
2841
2690
  ] }),
2842
- error && /* @__PURE__ */ jsxs9("div", { className: "rs-alert rs-alert--error", children: [
2843
- /* @__PURE__ */ jsx9(AlertTriangleIcon, { className: "rs-alert-icon" }),
2844
- /* @__PURE__ */ jsx9("span", { className: "rs-alert-text", children: error })
2691
+ error && /* @__PURE__ */ jsxs8("div", { className: "rs-alert rs-alert--error", children: [
2692
+ /* @__PURE__ */ jsx8(AlertTriangleIcon, { className: "rs-alert-icon" }),
2693
+ /* @__PURE__ */ jsx8("span", { className: "rs-alert-text", children: error })
2845
2694
  ] })
2846
2695
  ] }),
2847
- /* @__PURE__ */ jsx9("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx9(
2696
+ /* @__PURE__ */ jsx8("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx8(
2848
2697
  Button,
2849
2698
  {
2850
2699
  onClick: handleConfirm,
@@ -2854,36 +2703,394 @@ function SolanaConfirmStep({
2854
2703
  children: "Continue"
2855
2704
  }
2856
2705
  ) }),
2706
+ /* @__PURE__ */ jsx8(PoweredBy, {})
2707
+ ] });
2708
+ }
2709
+
2710
+ // src/components/steps/DappImportAssetSelectStep.tsx
2711
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
2712
+ function DappImportAssetSelectStep({
2713
+ sourceLabel,
2714
+ assets,
2715
+ onSelect
2716
+ }) {
2717
+ return /* @__PURE__ */ jsxs9("div", { className: "rs-screen", children: [
2718
+ /* @__PURE__ */ jsxs9("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2719
+ /* @__PURE__ */ jsx9(
2720
+ BodyHeader,
2721
+ {
2722
+ icon: /* @__PURE__ */ jsx9(HandCoinsIcon, {}),
2723
+ title: `Transfer from ${sourceLabel}`,
2724
+ subtitle: "Pick the balance to import"
2725
+ }
2726
+ ),
2727
+ /* @__PURE__ */ jsx9("div", { className: "rs-list", children: assets.map((asset) => {
2728
+ const balanceTokens = asset.balance ? tokenFormatter.format(
2729
+ Number(asset.balance) / 10 ** asset.decimals
2730
+ ) : "0";
2731
+ const balanceUsd = asset.balanceUsd && asset.balanceUsd > 0 ? currencyFormatter.format(asset.balanceUsd) : `${balanceTokens} ${asset.symbol}`;
2732
+ const iconSrc = getTokenIcon(asset.symbol);
2733
+ return /* @__PURE__ */ jsx9(
2734
+ ListRow,
2735
+ {
2736
+ leadingMedia: iconSrc || void 0,
2737
+ leading: iconSrc ? void 0 : /* @__PURE__ */ jsx9(HandCoinsIcon, {}),
2738
+ title: asset.symbol,
2739
+ subtitle: `${balanceTokens} on ${getChainName(asset.chainId)}`,
2740
+ meta: balanceUsd,
2741
+ onClick: () => onSelect(asset)
2742
+ },
2743
+ asset.id
2744
+ );
2745
+ }) })
2746
+ ] }),
2857
2747
  /* @__PURE__ */ jsx9(PoweredBy, {})
2858
2748
  ] });
2859
2749
  }
2750
+ DappImportAssetSelectStep.displayName = "DappImportAssetSelectStep";
2860
2751
 
2861
- // src/store/index.ts
2862
- import { createContext, createElement, useContext } from "react";
2863
- import { useStore } from "zustand";
2864
- import { createStore } from "zustand/vanilla";
2752
+ // src/core/dapp-imports/polymarket/index.ts
2753
+ import { createElement } from "react";
2754
+ import { formatUnits as formatUnits6 } from "viem";
2865
2755
 
2866
- // src/store/transitions.ts
2867
- function unreachable(action) {
2868
- throw new Error(
2869
- `[deposit-modal/store] Unhandled action: ${JSON.stringify(action)}`
2870
- );
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
+ import { getAddress, isAddress, zeroAddress } from "viem";
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 {
2773
+ return null;
2774
+ }
2775
+ if (!response.ok) {
2776
+ return null;
2777
+ }
2778
+ let payload;
2779
+ try {
2780
+ payload = await response.json();
2781
+ } catch {
2782
+ return null;
2783
+ }
2784
+ const raw = payload.proxyWallet;
2785
+ if (!raw || !isAddress(raw)) {
2786
+ return null;
2787
+ }
2788
+ const checksummed = getAddress(raw);
2789
+ if (checksummed === zeroAddress) {
2790
+ return null;
2791
+ }
2792
+ return checksummed;
2871
2793
  }
2872
- var RESET_DEPOSIT_FIELDS = {
2873
- selectedAsset: null,
2874
- selectedSolanaToken: null,
2875
- amount: null,
2876
- targetAmount: null,
2877
- targetTokenPriceUsd: null,
2878
- balance: null,
2879
- balanceUsd: null,
2880
- inputAmountUsd: null,
2881
- liquidityWarning: null,
2882
- sourceChain: null,
2883
- sourceToken: null,
2794
+
2795
+ // src/core/dapp-imports/polymarket/safe.ts
2796
+ import {
2797
+ concat,
2798
+ encodeFunctionData,
2799
+ encodePacked,
2800
+ erc20Abi as erc20Abi3,
2801
+ pad,
2802
+ parseAbi,
2803
+ parseEventLogs,
2804
+ toHex,
2805
+ zeroAddress as zeroAddress2
2806
+ } from "viem";
2807
+ var COLLATERAL_OFFRAMP_ABI = parseAbi([
2808
+ "function unwrap(address _asset, address _to, uint256 _amount)"
2809
+ ]);
2810
+ var MULTI_SEND_ABI = parseAbi(["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: erc20Abi3,
2820
+ functionName: "balanceOf",
2821
+ args: [proxyWallet]
2822
+ },
2823
+ {
2824
+ address: POLYMARKET_USDCE_ADDRESS,
2825
+ abi: erc20Abi3,
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 {
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: 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 = concat([
2867
+ pad(account.address, { size: 32 }),
2868
+ pad(toHex(0), { size: 32 }),
2869
+ toHex(1, { size: 1 })
2870
+ ]);
2871
+ const txHash = await walletClient.writeContract({
2872
+ account,
2873
+ chain,
2874
+ address: safeAddress,
2875
+ abi: 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
+ zeroAddress2,
2886
+ zeroAddress2,
2887
+ signature
2888
+ ]
2889
+ });
2890
+ const receipt = await publicClient.waitForTransactionReceipt({
2891
+ hash: txHash
2892
+ });
2893
+ const parsed = parseEventLogs({
2894
+ abi: 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: encodeFunctionData({
2918
+ abi: erc20Abi3,
2919
+ functionName: "transfer",
2920
+ args: [recipient, amount]
2921
+ }),
2922
+ operation: 0
2923
+ };
2924
+ }
2925
+ function buildPusdUnwrapSafeTx(recipient, amount) {
2926
+ const approveData = encodeFunctionData({
2927
+ abi: erc20Abi3,
2928
+ functionName: "approve",
2929
+ args: [POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS, amount]
2930
+ });
2931
+ const unwrapData = encodeFunctionData({
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: encodeFunctionData({
2939
+ abi: MULTI_SEND_ABI,
2940
+ functionName: "multiSend",
2941
+ args: [
2942
+ concat([
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 encodePacked(
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: createElement("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 (signal?.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 (signal?.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 + (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(formatUnits6(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
+ }
3050
+
3051
+ // src/store/index.ts
3052
+ import { createContext, createElement as createElement2, useContext } from "react";
3053
+ import { useStore } from "zustand";
3054
+ import { createStore } from "zustand/vanilla";
3055
+
3056
+ // src/store/transitions.ts
3057
+ function unreachable(action) {
3058
+ throw new Error(
3059
+ `[deposit-modal/store] Unhandled action: ${JSON.stringify(action)}`
3060
+ );
3061
+ }
3062
+ var RESET_DEPOSIT_FIELDS = {
3063
+ selectedAsset: null,
3064
+ selectedSolanaToken: null,
3065
+ amount: null,
3066
+ targetAmount: null,
3067
+ targetTokenPriceUsd: null,
3068
+ balance: null,
3069
+ balanceUsd: null,
3070
+ inputAmountUsd: null,
3071
+ liquidityWarning: null,
3072
+ sourceChain: null,
3073
+ sourceToken: null,
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 = 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: 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: existing?.smartAccount ?? null,
3306
+ sessionOwnerAddress: existing?.sessionOwnerAddress ?? null,
3307
+ solanaDepositAddress: existing?.solanaDepositAddress ?? null,
3308
+ message: null,
3309
+ cacheable: action.cacheable,
3310
+ attemptNonce: existing?.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: 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,13 +3420,86 @@ function applyAction(state, action) {
3112
3420
  },
3113
3421
  flow: { ...state.flow, step: "processing" }
3114
3422
  };
3423
+ case "dapp-import/availability-loading":
3424
+ return {
3425
+ ...state,
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
+ }
3433
+ }
3434
+ };
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
+ };
3115
3488
  case "back/requested":
3116
3489
  return applyBack(state, action.hasWalletOptions);
3117
- case "flow/reset":
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
+ }
3118
3499
  return {
3119
3500
  ...state,
3120
3501
  flow: {
3121
- step: "setup",
3502
+ step: "connect",
3122
3503
  mode: null,
3123
3504
  isConnectSelectionConfirmed: false,
3124
3505
  hasNavigatedBack: false
@@ -3130,9 +3511,18 @@ function applyAction(state, action) {
3130
3511
  processing: {
3131
3512
  txHash: null,
3132
3513
  directTransfer: false
3133
- }
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 }
3134
3523
  };
3135
- case "target/changed":
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 entry ?? { ...IDLE_SETUP_ENTRY, owner };
3618
+ }
3204
3619
 
3205
3620
  // src/store/index.ts
3206
3621
  function createDepositStore(overrides) {
@@ -3217,7 +3632,7 @@ function DepositStoreProvider({
3217
3632
  store,
3218
3633
  children
3219
3634
  }) {
3220
- return createElement(
3635
+ return createElement2(
3221
3636
  DepositStoreContext.Provider,
3222
3637
  { value: store },
3223
3638
  children
@@ -3237,8 +3652,275 @@ function useDepositStore(selector) {
3237
3652
  return useStore(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 = loadSessionOwnerFromStorage(eoaAddress);
3665
+ if (local) {
3666
+ return {
3667
+ account: accountFromPrivateKey(local.privateKey),
3668
+ address: local.address
3669
+ };
3670
+ }
3671
+ const created = createSessionOwnerKey();
3672
+ saveSessionOwnerToStorage(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: input.recipient?.toLowerCase(),
3694
+ outputTokenRules: input.outputTokenRules ?? null,
3695
+ rejectUnmapped: input.rejectUnmapped ?? null,
3696
+ signerAddress: input.signerAddress.toLowerCase(),
3697
+ sessionChainIds: input.sessionChainIds ?? null,
3698
+ enableSolana: input.enableSolana ?? true,
3699
+ forceRegister: input.forceRegister ?? false,
3700
+ postBridgeActions: 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: input.recipient?.toLowerCase(),
3710
+ outputTokenRules: input.outputTokenRules ?? null,
3711
+ rejectUnmapped: input.rejectUnmapped ?? null,
3712
+ signerAddress: input.signerAddress.toLowerCase(),
3713
+ sessionChainIds: input.sessionChainIds ?? null,
3714
+ enableSolana: input.enableSolana ?? true
3715
+ });
3716
+ }
3717
+ function computeIsCacheable(input) {
3718
+ return !input.forceRegister && !(input.postBridgeActions?.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 (existing?.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 = input.enableSolana ?? true;
3733
+ try {
3734
+ const sessionOwner = await resolveSessionOwner(input.ownerAddress);
3735
+ const cacheKey = computeCacheKey(input, sessionOwner.address);
3736
+ debugLog(debug, "account-setup", "setup:start", {
3737
+ owner: input.ownerAddress,
3738
+ sessionOwner: sessionOwner.address,
3739
+ hasPostBridgeActions: Boolean(input.postBridgeActions?.length),
3740
+ forceRegister: input.forceRegister ?? false
3741
+ });
3742
+ const setup = await service.setupAccount({
3743
+ ownerAddress: input.ownerAddress,
3744
+ sessionOwnerAddress: sessionOwner.address,
3745
+ targetChain: toEvmCaip2(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 = buildSessionDetails(
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: toEvmCaip2(input.targetChain),
3799
+ token: input.targetToken,
3800
+ ...input.recipient && { recipient: input.recipient },
3801
+ ...input.postBridgeActions?.length && {
3802
+ postBridgeActions: input.postBridgeActions
3803
+ },
3804
+ ...input.outputTokenRules?.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
+ debugError(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
+ debugLog(deps.debug, "account-setup", "setup:dedupe-hit", {
3832
+ owner: input.ownerAddress,
3833
+ forceRegister: 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
- import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
3894
+ import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
3895
+ function AccountPreparingSkeleton({
3896
+ errorMessage,
3897
+ onRetry
3898
+ }) {
3899
+ return /* @__PURE__ */ jsxs10("div", { className: "rs-step", children: [
3900
+ /* @__PURE__ */ jsx10("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: /* @__PURE__ */ jsx10("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx10("div", { className: "rs-loading-text", children: errorMessage ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
3901
+ /* @__PURE__ */ jsx10("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t prepare account" }),
3902
+ /* @__PURE__ */ jsx10("div", { className: "rs-loading-subtitle", children: errorMessage })
3903
+ ] }) : /* @__PURE__ */ jsx10("div", { className: "rs-loading-title", children: "Preparing\u2026" }) }) }) }),
3904
+ errorMessage && onRetry && /* @__PURE__ */ jsx10("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx10(
3905
+ "button",
3906
+ {
3907
+ type: "button",
3908
+ className: "rs-button rs-button--default rs-button--full-width",
3909
+ onClick: onRetry,
3910
+ children: /* @__PURE__ */ jsx10("span", { children: "Try again" })
3911
+ }
3912
+ ) })
3913
+ ] });
3914
+ }
3915
+ function SetupUpdatingBanner({
3916
+ status,
3917
+ message
3918
+ }) {
3919
+ if (status === "error") {
3920
+ return /* @__PURE__ */ jsx10("div", { className: "rs-deposit-address-error", role: "alert", children: message ?? "Couldn't update deposit details \u2014 please retry." });
3921
+ }
3922
+ return /* @__PURE__ */ jsx10("div", { className: "rs-loading-state", style: { padding: "8px 16px" }, children: /* @__PURE__ */ jsx10("div", { className: "rs-loading-text", children: /* @__PURE__ */ jsx10("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: d.solanaDepositAddress ?? void 0
3943
+ smartAccount,
3944
+ solanaDepositAddress: 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: 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: 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: 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: d.solanaDepositAddress ?? void 0,
4016
+ smartAccount,
4017
+ solanaDepositAddress: 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 ctx.dappAddress ?? null;
4033
+ case "wallet":
4034
+ return ctx.walletOwner ?? null;
4035
+ case "dapp-import":
4036
+ return 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,
@@ -3385,53 +4086,38 @@ 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 = useMemo6(
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 = useCallback4(
3397
- (mode) => storeApi.dispatch({ type: "flow/mode-set", mode }),
3398
- [storeApi]
3399
- );
3400
- const setIsConnectSelectionConfirmed = useCallback4(
3401
- (value) => storeApi.dispatch({ type: "flow/connect-confirmed-set", value }),
3402
- [storeApi]
3403
- );
3404
- const setSelectedWalletId = useCallback4(
3405
- (walletId) => storeApi.dispatch({ type: "wallet/id-selected", walletId }),
3406
- [storeApi]
3407
- );
3408
- const [totalBalanceUsd, setTotalBalanceUsd] = useState10(0);
3409
- const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = useState10(() => !hasInitialWalletHydrationPending);
3410
- const portfolioAssetsRef = useRef6([]);
3411
- const stableWalletSignerRef = useRef6(null);
3412
- const stableWalletSelectionKeyRef = useRef6(null);
3413
- const logFlow = useCallback4(
4094
+ const [totalBalanceUsd, setTotalBalanceUsd] = useState9(0);
4095
+ const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = useState9(() => !hasInitialWalletHydrationPending);
4096
+ const portfolioAssetsRef = useRef5([]);
4097
+ const stableWalletSignerRef = useRef5(null);
4098
+ const stableWalletSelectionKeyRef = useRef5(null);
4099
+ const logFlow = useCallback3(
3414
4100
  (message, data) => {
3415
4101
  debugLog(debug, "deposit-flow", message, data);
3416
4102
  },
3417
4103
  [debug]
3418
4104
  );
3419
- const logFlowError = useCallback4(
4105
+ const logFlowError = useCallback3(
3420
4106
  (message, error, data) => {
3421
4107
  debugError(debug, "deposit-flow", message, error, data);
3422
4108
  },
3423
4109
  [debug]
3424
4110
  );
3425
- const handleAssetsLoaded = useCallback4((assets) => {
4111
+ const handleAssetsLoaded = useCallback3((assets) => {
3426
4112
  portfolioAssetsRef.current = assets;
3427
4113
  }, []);
3428
- const getTokenPriceUsd = useCallback4((symbol) => {
4114
+ const getTokenPriceUsd = useCallback3((symbol) => {
3429
4115
  const sym = symbol.toLowerCase();
3430
4116
  for (const asset of portfolioAssetsRef.current) {
3431
4117
  if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
3432
4118
  try {
3433
4119
  const balanceUnits = Number(
3434
- formatUnits6(BigInt(asset.balance), asset.decimals)
4120
+ formatUnits7(BigInt(asset.balance), asset.decimals)
3435
4121
  );
3436
4122
  if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
3437
4123
  } catch {
@@ -3507,8 +4193,8 @@ function DepositFlow({
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;
3511
- useEffect9(() => {
4196
+ const showConnectStep = flowMode === null && !isConnectSelectionConfirmed;
4197
+ useEffect8(() => {
3512
4198
  if (!isWalletHydrationPending) {
3513
4199
  setHasQrAutoAdvanceGraceElapsed(true);
3514
4200
  return;
@@ -3520,7 +4206,7 @@ function DepositFlow({
3520
4206
  return () => window.clearTimeout(timeout);
3521
4207
  }, [isWalletHydrationPending]);
3522
4208
  const walletSelectionKey = useMemo6(() => {
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
  }
@@ -3599,8 +4285,8 @@ function DepositFlow({
3599
4285
  reownWallet,
3600
4286
  targetChain
3601
4287
  ]);
3602
- useEffect9(() => {
3603
- if (flowMode !== "wallet") {
4288
+ useEffect8(() => {
4289
+ if (flowMode !== "wallet" && flowMode !== "dapp-import") {
3604
4290
  stableWalletSelectionKeyRef.current = null;
3605
4291
  stableWalletSignerRef.current = null;
3606
4292
  return;
@@ -3624,7 +4310,7 @@ function DepositFlow({
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,8 +4328,93 @@ function DepositFlow({
3642
4328
  walletSignerContext,
3643
4329
  walletSelectionKey
3644
4330
  ]);
3645
- const sessionKeyAddress = dappAddress ?? signerContext?.ownerAddress ?? null;
3646
- const handleBack = useCallback4(() => {
4331
+ const selectedEvmWalletOwner = useMemo6(() => {
4332
+ if (!selectedWalletId) return null;
4333
+ const opt = walletOptions.find((o) => o.id === selectedWalletId);
4334
+ if (opt?.kind === "external" && opt.address) {
4335
+ return opt.address;
4336
+ }
4337
+ if (opt?.kind === "connected" && opt.address) {
4338
+ return opt.address;
4339
+ }
4340
+ return null;
4341
+ }, [selectedWalletId, walletOptions]);
4342
+ const dappImportOwner = useMemo6(() => {
4343
+ if (selectedEvmWalletOwner) return selectedEvmWalletOwner;
4344
+ if (reownWallet?.address && reownWallet.isConnected) {
4345
+ return reownWallet.address;
4346
+ }
4347
+ if (connectedWalletAddress) return connectedWalletAddress;
4348
+ return null;
4349
+ }, [
4350
+ selectedEvmWalletOwner,
4351
+ reownWallet?.address,
4352
+ reownWallet?.isConnected,
4353
+ connectedWalletAddress
4354
+ ]);
4355
+ const activeOwner = useMemo6(
4356
+ () => resolveOwnerForMode(flowMode, {
4357
+ dappAddress,
4358
+ walletOwner: signerContext?.ownerAddress ?? (canAutoLock ? connectedWalletAddress : selectedEvmWalletOwner),
4359
+ dappImportOwner
4360
+ }),
4361
+ [
4362
+ flowMode,
4363
+ dappAddress,
4364
+ signerContext?.ownerAddress,
4365
+ canAutoLock,
4366
+ connectedWalletAddress,
4367
+ selectedEvmWalletOwner,
4368
+ dappImportOwner
4369
+ ]
4370
+ );
4371
+ const activeEntry = useMemo6(
4372
+ () => readSetupForOwner(setupSlice, activeOwner),
4373
+ [setupSlice, activeOwner]
4374
+ );
4375
+ const lastActiveSetupLifecycleKeyRef = useRef5(null);
4376
+ useEffect8(() => {
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
+ activeEntry.solanaDepositAddress ?? ""
4388
+ ].join(":");
4389
+ if (lastActiveSetupLifecycleKeyRef.current === lifecycleKey) {
4390
+ return;
4391
+ }
4392
+ lastActiveSetupLifecycleKeyRef.current = lifecycleKey;
4393
+ onLifecycleRef.current?.({
4394
+ type: "smart-account-changed",
4395
+ evm: activeEntry.smartAccount,
4396
+ solana: activeEntry.solanaDepositAddress ?? null
4397
+ });
4398
+ onLifecycleRef.current?.({
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 = useMemo6(
4413
+ () => deriveStep(flowSlice, depositSlice, processingSlice, activeEntry),
4414
+ [flowSlice, depositSlice, processingSlice, activeEntry]
4415
+ );
4416
+ const step = effectiveStep;
4417
+ const handleBack = useCallback3(() => {
3647
4418
  const stepBeforeBack = storeApi.getState().flow.step;
3648
4419
  storeApi.dispatch({
3649
4420
  type: "back/requested",
@@ -3653,16 +4424,16 @@ 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;
3659
- useEffect9(() => {
4429
+ const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
4430
+ useEffect8(() => {
3660
4431
  onStepChangeRef.current?.(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;
3664
- const lastStepOpenEventKeyRef = useRef6(null);
3665
- useEffect9(() => {
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;
4435
+ const lastStepOpenEventKeyRef = useRef5(null);
4436
+ useEffect8(() => {
3666
4437
  if (!stepOpenEventKey) {
3667
4438
  lastStepOpenEventKeyRef.current = null;
3668
4439
  return;
@@ -3671,13 +4442,13 @@ function DepositFlow({
3671
4442
  return;
3672
4443
  }
3673
4444
  lastStepOpenEventKeyRef.current = stepOpenEventKey;
3674
- if (step.type === "select-asset") {
4445
+ if (effectiveStep.type === "select-asset") {
3675
4446
  onEventRef.current?.({
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 = getChainName(targetChain);
3682
4453
  const tokenSymbol = getTokenSymbol(targetToken, targetChain);
3683
4454
  onEventRef.current?.({
@@ -3686,7 +4457,7 @@ function DepositFlow({
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 = getTokenSymbol(targetToken, targetChain);
3691
4462
  onEventRef.current?.({
3692
4463
  type: "deposit_modal_connected_wallet_enter_value_open",
@@ -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,
@@ -3704,9 +4475,9 @@ function DepositFlow({
3704
4475
  totalBalanceUsd,
3705
4476
  onEventRef
3706
4477
  ]);
3707
- useEffect9(() => {
4478
+ useEffect8(() => {
3708
4479
  logFlow("state:changed", {
3709
- step: step.type,
4480
+ step: effectiveStep.type,
3710
4481
  flowMode,
3711
4482
  targetChain,
3712
4483
  targetToken,
@@ -3716,11 +4487,11 @@ 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
- useEffect9(() => {
4494
+ useEffect8(() => {
3724
4495
  onLifecycleRef.current?.({
3725
4496
  type: "balance-changed",
3726
4497
  totalUsd: totalBalanceUsd
@@ -3728,16 +4499,170 @@ function DepositFlow({
3728
4499
  }, [totalBalanceUsd, onLifecycleRef]);
3729
4500
  const isDepositAddressMode = flowMode === "deposit-address";
3730
4501
  const isSolanaWalletMode = flowMode === "solana-wallet";
3731
- const handleSelectProvider = useCallback4(() => {
3732
- setFlowMode("wallet");
3733
- }, [setFlowMode]);
3734
- const handleSelectSolanaWallet = useCallback4(() => {
3735
- setFlowMode("solana-wallet");
3736
- }, [setFlowMode]);
3737
- const handleSelectTransferCrypto = useCallback4(() => {
3738
- setFlowMode("deposit-address");
3739
- }, [setFlowMode]);
3740
- const handleNewDeposit = useCallback4(() => {
4502
+ const isDappImportMode = flowMode === "dapp-import";
4503
+ const handleSelectTransferCrypto = useCallback3(() => {
4504
+ storeApi.dispatch({ type: "connect/transfer-crypto-selected" });
4505
+ }, [storeApi]);
4506
+ const handleConfirmWallet = useCallback3(
4507
+ (walletId) => {
4508
+ const selectedOption = walletOptions.find((o) => o.id === walletId);
4509
+ const mode = enableSolana && selectedOption?.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 = useMemo6(
4519
+ () => getEnabledProviders(dappImports),
4520
+ [dappImports]
4521
+ );
4522
+ const handleSelectDappImport = useCallback3(
4523
+ (providerId) => {
4524
+ const owner = dappImportOwner;
4525
+ if (owner) {
4526
+ const wallet = walletOptions.find(
4527
+ (o) => (o.address ?? null)?.toLowerCase() === 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 = useCallback3(
4544
+ (asset) => {
4545
+ storeApi.dispatch({ type: "dapp-import/asset-selected", asset });
4546
+ },
4547
+ [storeApi]
4548
+ );
4549
+ useEffect8(() => {
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 getPublicClient(chainId);
4566
+ } catch {
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 = useMemo6(
4599
+ () => enabledDappImportProviders.map((provider) => {
4600
+ const availabilityEntry = dappImportOwner && dappImportAvailabilityOwner?.toLowerCase() === 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 = useMemo6(() => {
4646
+ if (!activeDappImportProviderId) return null;
4647
+ return enabledDappImportProviders.find(
4648
+ (p) => p.id === activeDappImportProviderId
4649
+ ) ?? null;
4650
+ }, [activeDappImportProviderId, enabledDappImportProviders]);
4651
+ const activeDappImportAvailability = useMemo6(() => {
4652
+ if (!activeDappImportProviderId) return null;
4653
+ if (!dappImportOwner || dappImportAvailabilityOwner?.toLowerCase() !== 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
+ ]);
4665
+ const handleNewDeposit = useCallback3(() => {
3741
4666
  onLifecycleRef.current?.({
3742
4667
  type: "smart-account-changed",
3743
4668
  evm: null,
@@ -3748,64 +4673,149 @@ function DepositFlow({
3748
4673
  stableWalletSignerRef.current = null;
3749
4674
  stableWalletSelectionKeyRef.current = null;
3750
4675
  }, [onLifecycleRef, storeApi]);
3751
- const handleSetupComplete = useCallback4(
3752
- (smartAccount, solanaDepositAddress) => {
3753
- logFlow("setup:complete", {
3754
- smartAccount,
3755
- hasSolanaDepositAddress: Boolean(solanaDepositAddress),
3756
- flowMode: isDepositAddressMode ? "deposit-address" : isSolanaWalletMode ? "solana-wallet" : "wallet"
3757
- });
3758
- onLifecycleRef.current?.({
3759
- type: "smart-account-changed",
3760
- evm: smartAccount,
3761
- solana: solanaDepositAddress ?? null
3762
- });
3763
- if (isSolanaWalletMode && !solanaDepositAddress) {
3764
- onErrorRef.current?.({
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 = useMemo6(
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
- );
3791
- useEffect9(() => {
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: depositSlice.solanaDepositAddress ?? void 0
3798
- });
3799
- }
4702
+ const desiredOwnersKey = useMemo6(() => {
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(reownWallet?.address);
4715
+ push(dappImportOwner);
4716
+ return owners;
3800
4717
  }, [
3801
- flowSlice.step,
3802
- cachedSetupCompatible,
3803
- depositSlice.smartAccount,
3804
- depositSlice.solanaDepositAddress,
3805
- sessionKeyAddress,
3806
- storeApi
4718
+ dappAddress,
4719
+ connectedWalletAddress,
4720
+ reownWallet?.address,
4721
+ dappImportOwner
3807
4722
  ]);
3808
- const handleDepositAddressSubmitted = useCallback4(
4723
+ useEffect8(() => {
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
+ debugError(
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
+ });
4810
+ }, [
4811
+ desiredOwnersKey,
4812
+ setupInputBase,
4813
+ service,
4814
+ debug,
4815
+ storeApi,
4816
+ setupSlice.byOwner
4817
+ ]);
4818
+ const handleDepositAddressSubmitted = useCallback3(
3809
4819
  (data) => {
3810
4820
  logFlow("deposit-address:detected", {
3811
4821
  txHash: data.txHash,
@@ -3816,7 +4826,7 @@ function DepositFlow({
3816
4826
  },
3817
4827
  [logFlow, onLifecycleRef]
3818
4828
  );
3819
- const handleSolanaTokenContinue = useCallback4(
4829
+ const handleSolanaTokenContinue = useCallback3(
3820
4830
  (token, balance, balanceUsd) => {
3821
4831
  logFlow("solana:token:continue", { token: token.symbol });
3822
4832
  storeApi.dispatch({
@@ -3829,7 +4839,7 @@ function DepositFlow({
3829
4839
  },
3830
4840
  [defaultAmount, logFlow, storeApi]
3831
4841
  );
3832
- const handleSolanaAmountContinue = useCallback4(
4842
+ const handleSolanaAmountContinue = useCallback3(
3833
4843
  (token, sourceAmount, inputAmountUsd) => {
3834
4844
  const targetSym = getTokenSymbol(targetToken, targetChain);
3835
4845
  const isTargetStable = isStablecoinSymbol(targetSym);
@@ -3851,7 +4861,7 @@ function DepositFlow({
3851
4861
  },
3852
4862
  [targetToken, targetChain, getTokenPriceUsd, logFlow, storeApi]
3853
4863
  );
3854
- const handleSolanaConfirmed = useCallback4(
4864
+ const handleSolanaConfirmed = useCallback3(
3855
4865
  (txHash, amountUnits) => {
3856
4866
  const tokenAtSubmit = storeApi.getState().deposit.selectedSolanaToken;
3857
4867
  if (!tokenAtSubmit) return;
@@ -3878,17 +4888,7 @@ function DepositFlow({
3878
4888
  },
3879
4889
  [logFlow, onLifecycleRef, storeApi]
3880
4890
  );
3881
- const handleConnected = useCallback4(
3882
- (addr, smartAccount) => {
3883
- onLifecycleRef.current?.({
3884
- type: "connected",
3885
- address: addr,
3886
- smartAccount
3887
- });
3888
- },
3889
- [onLifecycleRef]
3890
- );
3891
- const handleAssetContinue = useCallback4(
4891
+ const handleAssetContinue = useCallback3(
3892
4892
  (asset) => {
3893
4893
  onEventRef.current?.({
3894
4894
  type: "deposit_modal_connected_wallet_select_source_cta_click",
@@ -3906,8 +4906,13 @@ function DepositFlow({
3906
4906
  },
3907
4907
  [defaultAmount, onEventRef, totalBalanceUsd, storeApi]
3908
4908
  );
3909
- const handleAmountContinue = useCallback4(
4909
+ const handleAmountContinue = useCallback3(
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 = getTokenSymbol(targetToken, targetChain);
3912
4917
  const isTargetStable = isStablecoinSymbol(targetSym);
3913
4918
  const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
@@ -3920,9 +4925,9 @@ function DepositFlow({
3920
4925
  liquidityWarning
3921
4926
  });
3922
4927
  },
3923
- [targetToken, targetChain, getTokenPriceUsd, storeApi]
4928
+ [targetToken, targetChain, getTokenPriceUsd, storeApi, activeOwner]
3924
4929
  );
3925
- const handleDepositSubmitted = useCallback4(
4930
+ const handleDepositSubmitted = useCallback3(
3926
4931
  (txHash, chainId, amount, token) => {
3927
4932
  logFlow("evm:submitted", {
3928
4933
  txHash,
@@ -3930,18 +4935,22 @@ 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: dappImport?.symbol,
4947
+ sourceDecimals: dappImport?.decimals,
4948
+ directTransfer: !dappImport && isSameRoute2(chainId, token, targetChain, targetToken)
3940
4949
  });
3941
4950
  },
3942
4951
  [logFlow, storeApi, targetChain, targetToken]
3943
4952
  );
3944
- const handleDepositSubmittedCallback = useCallback4(
4953
+ const handleDepositSubmittedCallback = useCallback3(
3945
4954
  (txHash, sourceChain, amount) => {
3946
4955
  onLifecycleRef.current?.({
3947
4956
  type: "submitted",
@@ -3952,7 +4961,7 @@ function DepositFlow({
3952
4961
  },
3953
4962
  [onLifecycleRef]
3954
4963
  );
3955
- const handleDepositComplete = useCallback4(
4964
+ const handleDepositComplete = useCallback3(
3956
4965
  (txHash, destinationTxHash, context) => {
3957
4966
  logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
3958
4967
  onLifecycleRef.current?.({
@@ -3964,153 +4973,166 @@ function DepositFlow({
3964
4973
  },
3965
4974
  [logFlow, onLifecycleRef]
3966
4975
  );
3967
- const handleDepositFailed = useCallback4(
4976
+ const handleDepositFailed = useCallback3(
3968
4977
  (txHash, error) => {
3969
4978
  logFlowError("deposit:failed", error, { txHash });
3970
4979
  onLifecycleRef.current?.({ type: "failed", txHash, error });
3971
4980
  },
3972
4981
  [logFlowError, onLifecycleRef]
3973
4982
  );
3974
- const handleError = useCallback4(
4983
+ const handleError = useCallback3(
3975
4984
  (message, code) => {
3976
4985
  logFlowError("flow:error", message, { code });
3977
4986
  onErrorRef.current?.({ message, code });
3978
4987
  },
3979
4988
  [logFlowError, onErrorRef]
3980
4989
  );
3981
- const handleTotalBalanceComputed = useCallback4((total) => {
4990
+ const handleTotalBalanceComputed = useCallback3((total) => {
3982
4991
  setTotalBalanceUsd(total);
3983
4992
  }, []);
3984
- const selectedWalletIdEffective = useMemo6(() => {
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 = useMemo6(
3992
4994
  () => walletOptions.map((option) => option.id).join(","),
3993
4995
  [walletOptions]
3994
4996
  );
3995
- useEffect9(() => {
4997
+ useEffect8(() => {
3996
4998
  if (storeApi.getState().flow.mode) {
3997
4999
  return;
3998
5000
  }
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
- useEffect9(() => {
4006
- if (!showConnectStep && isConnectSelectionConfirmed && flowMode === "wallet" && !signerContext) {
5007
+ useEffect8(() => {
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]);
4010
- useEffect9(() => {
5012
+ useEffect8(() => {
4011
5013
  if (enableSolana || flowMode !== "solana-wallet") {
4012
5014
  return;
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
- useEffect9(() => {
5021
+ useEffect8(() => {
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 && selectedOption?.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 = useMemo6(() => {
5040
+ return walletOptions.map((option) => {
5041
+ const ownerForRow = option.kind === "solana" ? dappAddress : option.address ?? null;
5042
+ const entry = readSetupForOwner(setupSlice, 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: option.address ?? option.solanaAddress ?? option.id,
5050
+ state,
5051
+ errorReason: entry.message ?? void 0
5052
+ };
5053
+ });
5054
+ }, [walletOptions, setupSlice, dappAddress]);
5055
+ const transferCryptoEntry = useMemo6(
5056
+ () => readSetupForOwner(setupSlice, dappAddress),
5057
+ [setupSlice, dappAddress]
5058
+ );
5059
+ const transferCryptoState = transferCryptoEntry.status === "ready" ? "ready" : transferCryptoEntry.status === "error" ? "error" : "loading";
5060
+ const handleRetrySetup = useCallback3(
5061
+ (owner) => {
5062
+ storeApi.dispatch({ type: "setup/retry-requested", owner });
5063
+ },
5064
+ [storeApi]
5065
+ );
4059
5066
  if (showConnectStep) {
4060
5067
  return /* @__PURE__ */ jsx10("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx10(
4061
5068
  ConnectStep,
4062
5069
  {
4063
- walletOptions,
5070
+ walletRows,
5071
+ transferCryptoState: dappAddress ? transferCryptoState : void 0,
5072
+ transferCryptoErrorReason: dappAddress ? 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 : 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 && selectedOption?.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__ */ jsxs10("div", { className: "rs-modal-body", children: [
4089
- step.type === "setup" && !cachedSetupCompatible && /* @__PURE__ */ jsx10(
4090
- SetupStep,
5117
+ showBanner && /* @__PURE__ */ jsx10(
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: activeEntry.message ?? void 0
4107
5122
  }
4108
5123
  ),
4109
- step.type === "deposit-address" && /* @__PURE__ */ jsx10(
5124
+ effectiveStep.type === "setup" && /* @__PURE__ */ jsx10(
5125
+ AccountPreparingSkeleton,
5126
+ {
5127
+ errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
5128
+ onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
5129
+ }
5130
+ ),
5131
+ effectiveStep.type === "deposit-address" && /* @__PURE__ */ jsx10(
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,
@@ -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;
5167
+ if (!dappAddress) return null;
4143
5168
  const solanaAddr = reownWallet?.solanaAddress;
4144
5169
  const solanaProvider = reownWallet?.solanaProvider;
5170
+ const solanaShowBanner = effectiveStep.type !== "setup" && effectiveStep.type !== "processing" && (activeEntry.status === "loading" || activeEntry.status === "error");
4145
5171
  return /* @__PURE__ */ jsxs10("div", { className: "rs-modal-body", children: [
4146
- step.type === "setup" && !cachedSetupCompatible && /* @__PURE__ */ jsx10(
4147
- SetupStep,
5172
+ solanaShowBanner && /* @__PURE__ */ jsx10(
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: activeEntry.message ?? void 0
5177
+ }
5178
+ ),
5179
+ effectiveStep.type === "setup" && /* @__PURE__ */ jsx10(
5180
+ AccountPreparingSkeleton,
5181
+ {
5182
+ errorMessage: activeEntry.status === "error" ? 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__ */ jsx10(
5186
+ effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx10(
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__ */ jsx10(
5196
+ effectiveStep.type === "solana-amount" && /* @__PURE__ */ jsx10(
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: getChainName(targetChain),
4185
5205
  targetTokenSymbol: getTokenSymbol(targetToken, targetChain),
@@ -4190,17 +5210,17 @@ function DepositFlow({
4190
5210
  debug
4191
5211
  }
4192
5212
  ),
4193
- step.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx10(
5213
+ effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx10(
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__ */ jsxs10("div", { className: "rs-step", children: [
5232
+ ) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ jsxs10("div", { className: "rs-step", children: [
4213
5233
  /* @__PURE__ */ jsxs10("div", { className: "rs-loading-state", children: [
4214
5234
  /* @__PURE__ */ jsx10("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx10(
4215
5235
  "svg",
@@ -4243,23 +5263,23 @@ function DepositFlow({
4243
5263
  }
4244
5264
  ) })
4245
5265
  ] }) : null,
4246
- step.type === "processing" && /* @__PURE__ */ jsx10(
5266
+ effectiveStep.type === "processing" && /* @__PURE__ */ jsx10(
4247
5267
  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
5280
  hasPostBridgeActions: Boolean(postBridgeActions?.length),
4261
5281
  service,
4262
- directTransfer: step.directTransfer,
5282
+ directTransfer: effectiveStep.directTransfer,
4263
5283
  onClose,
4264
5284
  onNewDeposit: handleNewDeposit,
4265
5285
  onDepositComplete: handleDepositComplete,
@@ -4281,29 +5301,23 @@ function DepositFlow({
4281
5301
  }
4282
5302
  return getPublicClient(chainId);
4283
5303
  };
5304
+ const walletShowBanner = effectiveStep.type !== "setup" && effectiveStep.type !== "processing" && (activeEntry.status === "loading" || activeEntry.status === "error");
4284
5305
  return /* @__PURE__ */ jsxs10("div", { className: "rs-modal-body", children: [
4285
- step.type === "setup" && !cachedSetupCompatible && /* @__PURE__ */ jsx10(
4286
- SetupStep,
5306
+ walletShowBanner && /* @__PURE__ */ jsx10(
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: activeEntry.message ?? void 0
5311
+ }
5312
+ ),
5313
+ effectiveStep.type === "setup" && /* @__PURE__ */ jsx10(
5314
+ AccountPreparingSkeleton,
5315
+ {
5316
+ errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
5317
+ onRetry: activeEntry.status === "error" ? () => handleRetrySetup(ownerAddress) : void 0
4304
5318
  }
4305
5319
  ),
4306
- step.type === "select-asset" && /* @__PURE__ */ jsx10(
5320
+ effectiveStep.type === "select-asset" && /* @__PURE__ */ jsx10(
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__ */ jsx10(
5338
+ effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ jsx10(
5339
+ DappImportAssetSelectStep,
5340
+ {
5341
+ sourceLabel: activeDappImportAvailability.assets[0]?.sourceLabel ?? activeDappImportProvider.label,
5342
+ assets: activeDappImportAvailability.assets,
5343
+ onSelect: handleDappImportAssetSelected
5344
+ }
5345
+ ),
5346
+ effectiveStep.type === "amount" && /* @__PURE__ */ jsx10(
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: 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: effectiveStep.amount ?? defaultAmount,
4332
5359
  switchChain: signerContext.switchChain,
4333
5360
  targetChain,
4334
5361
  targetToken,
@@ -4339,7 +5366,7 @@ function DepositFlow({
4339
5366
  const receiveSymbol = getTokenSymbol(targetToken, targetChain);
4340
5367
  onEvent?.({
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__ */ jsx10(
5377
+ effectiveStep.type === "confirm" && /* @__PURE__ */ jsx10(
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__ */ jsx10(
5416
+ effectiveStep.type === "processing" && /* @__PURE__ */ jsx10(
4373
5417
  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
5430
  hasPostBridgeActions: Boolean(postBridgeActions?.length),
4387
5431
  service,
4388
- directTransfer: step.directTransfer,
5432
+ directTransfer: effectiveStep.directTransfer,
4389
5433
  uiConfig,
4390
5434
  onClose,
4391
5435
  onNewDeposit: handleNewDeposit,
@@ -4400,7 +5444,7 @@ function DepositFlow({
4400
5444
  }
4401
5445
 
4402
5446
  // src/components/history/DepositHistoryPanel.tsx
4403
- import { useCallback as useCallback5, useState as useState11 } from "react";
5447
+ import { useCallback as useCallback4, useState as useState10 } from "react";
4404
5448
  import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
4405
5449
  function shortenHash(hash) {
4406
5450
  if (hash.length <= 14) return hash;
@@ -4512,7 +5556,7 @@ function DepositHistoryPanel({
4512
5556
  onClose,
4513
5557
  onCloseModal
4514
5558
  }) {
4515
- const handleKeyDown = useCallback5(
5559
+ const handleKeyDown = useCallback4(
4516
5560
  (e) => {
4517
5561
  if (e.key === "Escape") {
4518
5562
  e.stopPropagation();
@@ -4597,7 +5641,7 @@ function DepositHistoryPanel({
4597
5641
  );
4598
5642
  }
4599
5643
  function HistoryCard({ deposit }) {
4600
- const [expanded, setExpanded] = useState11(false);
5644
+ const [expanded, setExpanded] = useState10(false);
4601
5645
  const status = normalizeStatus(deposit.status, deposit.isSpam);
4602
5646
  const sourceChainId = resolveChainId(deposit.chain);
4603
5647
  const targetChainId = resolveChainId(deposit.targetChain);
@@ -4679,7 +5723,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
4679
5723
  // src/DepositModal.tsx
4680
5724
  import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
4681
5725
  var ReownDepositInner = lazy2(
4682
- () => import("./DepositModalReown-VFTXYG2B.mjs").then((m) => ({ default: m.DepositModalReown }))
5726
+ () => import("./DepositModalReown-A2E4QTSF.mjs").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,
@@ -4751,23 +5796,23 @@ function DepositModalInner({
4751
5796
  onError,
4752
5797
  debug
4753
5798
  }) {
4754
- const modalRef = useRef7(null);
5799
+ const modalRef = useRef6(null);
4755
5800
  const onReadyRef = useLatestRef(onReady);
4756
- const [currentScreen, setCurrentScreen] = useState12("connect");
4757
- const [backHandler, setBackHandler] = useState12(
5801
+ const [currentScreen, setCurrentScreen] = useState11("connect");
5802
+ const [backHandler, setBackHandler] = useState11(
4758
5803
  void 0
4759
5804
  );
4760
5805
  const showHistoryButton = uiConfig?.showHistoryButton ?? false;
4761
5806
  const historyButtonVisible = showHistoryButton && (currentScreen === "select-asset" || currentScreen === "deposit-address");
4762
- const [historyOpen, setHistoryOpen] = useState12(false);
4763
- const [historyDeposits, setHistoryDeposits] = useState12([]);
4764
- const [hasMoreHistory, setHasMoreHistory] = useState12(false);
4765
- const [historyLoading, setHistoryLoading] = useState12(false);
4766
- const [historyLoadingMore, setHistoryLoadingMore] = useState12(false);
4767
- const [historyError, setHistoryError] = useState12(null);
4768
- const cursorRef = useRef7(null);
4769
- const historyStaleRef = useRef7(false);
4770
- const historyLoadedRef = useRef7(false);
5807
+ const [historyOpen, setHistoryOpen] = useState11(false);
5808
+ const [historyDeposits, setHistoryDeposits] = useState11([]);
5809
+ const [hasMoreHistory, setHasMoreHistory] = useState11(false);
5810
+ const [historyLoading, setHistoryLoading] = useState11(false);
5811
+ const [historyLoadingMore, setHistoryLoadingMore] = useState11(false);
5812
+ const [historyError, setHistoryError] = useState11(null);
5813
+ const cursorRef = useRef6(null);
5814
+ const historyStaleRef = useRef6(false);
5815
+ const historyLoadedRef = useRef6(false);
4771
5816
  const targetChain = getChainId(targetChainProp);
4772
5817
  const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
4773
5818
  const service = useMemo7(
@@ -4782,30 +5827,30 @@ function DepositModalInner({
4782
5827
  // eslint-disable-next-line react-hooks/exhaustive-deps
4783
5828
  []
4784
5829
  );
4785
- useEffect10(() => {
5830
+ useEffect9(() => {
4786
5831
  store.dispatch({ type: "target/changed", targetChain, targetToken });
4787
5832
  }, [store, targetChain, targetToken]);
4788
- useEffect10(() => {
5833
+ useEffect9(() => {
4789
5834
  if (isOpen && modalRef.current) {
4790
5835
  applyTheme(modalRef.current, theme);
4791
5836
  }
4792
5837
  }, [isOpen, theme]);
4793
- useEffect10(() => {
5838
+ useEffect9(() => {
4794
5839
  configureSolanaRpcUrl(solanaRpcUrl);
4795
5840
  }, [solanaRpcUrl]);
4796
- useEffect10(() => {
5841
+ useEffect9(() => {
4797
5842
  if (isOpen) {
4798
5843
  onReadyRef.current?.();
4799
5844
  }
4800
5845
  }, [isOpen, onReadyRef]);
4801
- const handleStepChange = useCallback6(
5846
+ const handleStepChange = useCallback5(
4802
5847
  (onBack, screen) => {
4803
5848
  setBackHandler(() => onBack);
4804
5849
  if (screen) setCurrentScreen(screen);
4805
5850
  },
4806
5851
  []
4807
5852
  );
4808
- const fetchHistory = useCallback6(
5853
+ const fetchHistory = useCallback5(
4809
5854
  async (mode = "initial") => {
4810
5855
  if (!recipient) return;
4811
5856
  const isInitial = mode === "initial";
@@ -4853,26 +5898,26 @@ function DepositModalInner({
4853
5898
  },
4854
5899
  [recipient, service]
4855
5900
  );
4856
- const handleHistoryOpen = useCallback6(() => {
5901
+ const handleHistoryOpen = useCallback5(() => {
4857
5902
  setHistoryOpen(true);
4858
5903
  if (!historyLoadedRef.current || historyStaleRef.current) {
4859
5904
  fetchHistory("initial");
4860
5905
  }
4861
5906
  }, [fetchHistory]);
4862
- const handleHistoryClose = useCallback6(() => {
5907
+ const handleHistoryClose = useCallback5(() => {
4863
5908
  setHistoryOpen(false);
4864
5909
  }, []);
4865
- const handleHistoryLoadMore = useCallback6(() => {
5910
+ const handleHistoryLoadMore = useCallback5(() => {
4866
5911
  fetchHistory("more");
4867
5912
  }, [fetchHistory]);
4868
- const markHistoryStale = useCallback6(() => {
5913
+ const markHistoryStale = useCallback5(() => {
4869
5914
  historyStaleRef.current = true;
4870
5915
  if (historyOpen) {
4871
5916
  fetchHistory("initial");
4872
5917
  }
4873
5918
  }, [historyOpen, fetchHistory]);
4874
5919
  const onLifecycleRef = useLatestRef(onLifecycle);
4875
- const handleLifecycle = useCallback6(
5920
+ const handleLifecycle = useCallback5(
4876
5921
  (event) => {
4877
5922
  onLifecycleRef.current?.(event);
4878
5923
  if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
@@ -4884,7 +5929,7 @@ function DepositModalInner({
4884
5929
  },
4885
5930
  [onLifecycleRef, showHistoryButton, markHistoryStale]
4886
5931
  );
4887
- useEffect10(() => {
5932
+ useEffect9(() => {
4888
5933
  if (!isOpen) {
4889
5934
  setHistoryOpen(false);
4890
5935
  setHistoryDeposits([]);
@@ -4895,7 +5940,7 @@ function DepositModalInner({
4895
5940
  historyLoadedRef.current = false;
4896
5941
  }
4897
5942
  }, [isOpen]);
4898
- useEffect10(() => {
5943
+ useEffect9(() => {
4899
5944
  if (!isOpen) {
4900
5945
  store.dispatch({ type: "flow/reset" });
4901
5946
  }
@@ -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,