@rhinestone/deposit-modal 0.8.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +193 -29
  2. package/dist/{chunk-4BLOPOVO.mjs → DepositModalReown-6KUAO5ZC.mjs} +56 -4
  3. package/dist/{chunk-5E67UM3V.cjs → DepositModalReown-XC5RIU7Z.cjs} +62 -10
  4. package/dist/{caip-C_ZYFIGa.d.cts → caip-523Zrc3r.d.cts} +1 -3
  5. package/dist/{caip-C_ZYFIGa.d.ts → caip-523Zrc3r.d.ts} +1 -3
  6. package/dist/{chunk-46BRQZ2P.cjs → chunk-22RV33LK.cjs} +2148 -1467
  7. package/dist/chunk-4WB2FHGC.mjs +865 -0
  8. package/dist/chunk-A223BLVC.mjs +801 -0
  9. package/dist/{chunk-3WIHTUQ6.cjs → chunk-DIX7M3SP.cjs} +232 -601
  10. package/dist/{chunk-XK5RH4FZ.mjs → chunk-E4G5BOZP.mjs} +167 -536
  11. package/dist/chunk-H577RJN5.cjs +801 -0
  12. package/dist/{chunk-RARNNVZO.mjs → chunk-ILT2PITN.mjs} +60 -3
  13. package/dist/{chunk-KGZU3BL2.mjs → chunk-KKHLNFSA.mjs} +2397 -1716
  14. package/dist/chunk-LGVJWVSS.mjs +81 -0
  15. package/dist/chunk-NEXUCY4B.cjs +11 -0
  16. package/dist/chunk-NMIMRASD.cjs +1785 -0
  17. package/dist/chunk-OSI2CFGL.mjs +11 -0
  18. package/dist/chunk-PAGMU4RQ.cjs +865 -0
  19. package/dist/chunk-T7LGQFP3.cjs +81 -0
  20. package/dist/chunk-VN4BLZYC.cjs +2273 -0
  21. package/dist/chunk-VOGZAZB2.mjs +2273 -0
  22. package/dist/chunk-WYXBY2MQ.mjs +1785 -0
  23. package/dist/{chunk-ORKEBFMR.cjs → chunk-YEBXUUH3.cjs} +63 -6
  24. package/dist/claim.cjs +10 -0
  25. package/dist/claim.d.cts +8 -0
  26. package/dist/claim.d.ts +8 -0
  27. package/dist/claim.mjs +10 -0
  28. package/dist/constants.cjs +3 -3
  29. package/dist/constants.d.cts +4 -2
  30. package/dist/constants.d.ts +4 -2
  31. package/dist/constants.mjs +5 -5
  32. package/dist/deposit.cjs +8 -6
  33. package/dist/deposit.d.cts +2 -2
  34. package/dist/deposit.d.ts +2 -2
  35. package/dist/deposit.mjs +7 -5
  36. package/dist/index.cjs +22 -12
  37. package/dist/index.d.cts +15 -2
  38. package/dist/index.d.ts +15 -2
  39. package/dist/index.mjs +21 -11
  40. package/dist/polymarket.cjs +5 -6
  41. package/dist/polymarket.mjs +2 -3
  42. package/dist/server.cjs +96 -0
  43. package/dist/server.d.cts +65 -0
  44. package/dist/server.d.ts +65 -0
  45. package/dist/server.mjs +96 -0
  46. package/dist/styles.css +149 -15
  47. package/dist/types-C0SGf-21.d.cts +606 -0
  48. package/dist/types-C0SGf-21.d.ts +606 -0
  49. package/dist/withdraw.cjs +6 -5
  50. package/dist/withdraw.d.cts +3 -6
  51. package/dist/withdraw.d.ts +3 -6
  52. package/dist/withdraw.mjs +5 -4
  53. package/package.json +53 -6
  54. package/dist/DepositModalReown-A2W6R27Q.cjs +0 -63
  55. package/dist/DepositModalReown-IB5WUXVT.mjs +0 -63
  56. package/dist/WithdrawModalReown-A4S4BJHG.mjs +0 -46
  57. package/dist/WithdrawModalReown-KUWNNA2X.cjs +0 -46
  58. package/dist/chunk-2O2FJYRY.mjs +0 -800
  59. package/dist/chunk-DSXMWQYB.cjs +0 -4542
  60. package/dist/chunk-P5T4XSN2.cjs +0 -800
  61. package/dist/chunk-RH6XQHMA.mjs +0 -295
  62. package/dist/chunk-TUSEN26M.mjs +0 -4542
  63. package/dist/chunk-UNVVUULP.cjs +0 -295
  64. package/dist/types--LQWg_4W.d.cts +0 -468
  65. package/dist/types--LQWg_4W.d.ts +0 -468
@@ -1,9 +1,10 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
4
 
5
5
 
6
6
 
7
+ var _chunkNMIMRASDcjs = require('./chunk-NMIMRASD.cjs');
7
8
 
8
9
 
9
10
 
@@ -33,37 +34,20 @@
33
34
 
34
35
 
35
36
 
37
+ var _chunkVN4BLZYCcjs = require('./chunk-VN4BLZYC.cjs');
36
38
 
37
39
 
38
- var _chunkDSXMWQYBcjs = require('./chunk-DSXMWQYB.cjs');
39
40
 
40
41
 
41
42
 
42
43
 
43
- var _chunkUNVVUULPcjs = require('./chunk-UNVVUULP.cjs');
44
44
 
45
45
 
46
46
 
47
47
 
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
- var _chunkP5T4XSN2cjs = require('./chunk-P5T4XSN2.cjs');
48
+ var _chunkH577RJN5cjs = require('./chunk-H577RJN5.cjs');
57
49
 
58
50
  // src/WithdrawModal.tsx
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
51
  var _react = require('react');
68
52
 
69
53
  // src/WithdrawFlow.tsx
@@ -80,8 +64,6 @@ function unreachable(action) {
80
64
  }
81
65
  function applyWithdrawAction(state, action) {
82
66
  switch (action.type) {
83
- case "wallet/id-selected":
84
- return { ...state, selectedWalletId: action.walletId };
85
67
  case "registration/started":
86
68
  return {
87
69
  ...state,
@@ -99,7 +81,7 @@ function applyWithdrawAction(state, action) {
99
81
  smartAccount: action.smartAccount,
100
82
  registeredTarget: action.registeredTarget
101
83
  },
102
- step: state.step === "connect" ? "form" : state.step
84
+ step: state.step
103
85
  };
104
86
  case "registration/failed":
105
87
  return {
@@ -116,7 +98,15 @@ function applyWithdrawAction(state, action) {
116
98
  case "review/back":
117
99
  return { ...state, step: "form" };
118
100
  case "withdraw/submitted":
119
- return { ...state, txHash: action.txHash, step: "processing" };
101
+ return {
102
+ ...state,
103
+ txHash: action.txHash,
104
+ processingSmartAccount: action.smartAccount,
105
+ processingTargetChain: action.targetChain,
106
+ processingTargetToken: action.targetToken,
107
+ processingDirectTransfer: action.directTransfer,
108
+ step: "processing"
109
+ };
120
110
  case "withdraw/complete":
121
111
  return { ...state, step: "complete" };
122
112
  case "withdraw/failed":
@@ -127,17 +117,24 @@ function applyWithdrawAction(state, action) {
127
117
  step: "form",
128
118
  amount: null,
129
119
  recipient: null,
130
- txHash: null
120
+ txHash: null,
121
+ processingSmartAccount: null,
122
+ processingTargetChain: null,
123
+ processingTargetToken: null,
124
+ processingDirectTransfer: null
131
125
  };
132
126
  case "modal/reset":
133
127
  return {
134
128
  ...state,
135
- step: "connect",
136
- selectedWalletId: null,
129
+ step: "form",
137
130
  registration: { kind: "idle" },
138
131
  amount: null,
139
132
  recipient: null,
140
- txHash: null
133
+ txHash: null,
134
+ processingSmartAccount: null,
135
+ processingTargetChain: null,
136
+ processingTargetToken: null,
137
+ processingDirectTransfer: null
141
138
  };
142
139
  default:
143
140
  return unreachable(action);
@@ -145,12 +142,15 @@ function applyWithdrawAction(state, action) {
145
142
  }
146
143
  function createWithdrawStore() {
147
144
  const store = _vanilla.createStore.call(void 0, () => ({
148
- step: "connect",
149
- selectedWalletId: null,
145
+ step: "form",
150
146
  registration: { kind: "idle" },
151
147
  amount: null,
152
148
  recipient: null,
153
- txHash: null
149
+ txHash: null,
150
+ processingSmartAccount: null,
151
+ processingTargetChain: null,
152
+ processingTargetToken: null,
153
+ processingDirectTransfer: null
154
154
  }));
155
155
  return {
156
156
  ...store,
@@ -200,10 +200,8 @@ function useClickOutside(ref, onClose) {
200
200
  }, [ref, onClose]);
201
201
  }
202
202
  function WithdrawFormStep({
203
- walletClient,
204
203
  publicClient,
205
- connectedRecipient,
206
- safeAddress,
204
+ accountAddress,
207
205
  depositAddress,
208
206
  asset,
209
207
  defaultRecipient,
@@ -214,8 +212,6 @@ function WithdrawFormStep({
214
212
  targetTokenOptions,
215
213
  onTargetChainChange,
216
214
  onTargetTokenChange,
217
- switchChain,
218
- walletIcon,
219
215
  submitting = false,
220
216
  registrationPending = false,
221
217
  registrationError = null,
@@ -228,25 +224,16 @@ function WithdrawFormStep({
228
224
  const [balance, setBalance] = _react.useState.call(void 0, null);
229
225
  const [isBalanceLoading, setIsBalanceLoading] = _react.useState.call(void 0, true);
230
226
  const [error, setError] = _react.useState.call(void 0, null);
231
- const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
232
227
  const [showChainDropdown, setShowChainDropdown] = _react.useState.call(void 0, false);
233
228
  const [showTokenDropdown, setShowTokenDropdown] = _react.useState.call(void 0, false);
234
229
  const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
235
- const hasAttemptedSwitch = _react.useRef.call(void 0, false);
236
230
  const chainDropdownRef = _react.useRef.call(void 0, null);
237
231
  const tokenDropdownRef = _react.useRef.call(void 0, null);
238
232
  const publicClientChainId = _optionalChain([publicClient, 'access', _ => _.chain, 'optionalAccess', _2 => _2.id]);
239
233
  useClickOutside(chainDropdownRef, () => setShowChainDropdown(false));
240
234
  useClickOutside(tokenDropdownRef, () => setShowTokenDropdown(false));
241
- const preferredConnectedRecipient = _nullishCoalesce(connectedRecipient, () => ( ""));
242
- const isRecipientConnected = Boolean(
243
- preferredConnectedRecipient && recipient && recipient.toLowerCase() === preferredConnectedRecipient.toLowerCase()
244
- );
245
- const chainMismatch = Boolean(
246
- _optionalChain([walletClient, 'optionalAccess', _3 => _3.chain, 'optionalAccess', _4 => _4.id]) && walletClient.chain.id !== asset.chainId
247
- );
248
- const targetSymbol = _chunkP5T4XSN2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
249
- const targetChainName = _chunkP5T4XSN2cjs.getChainName.call(void 0, targetChain);
235
+ const targetSymbol = _chunkH577RJN5cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
236
+ const targetChainName = _chunkH577RJN5cjs.getChainName.call(void 0, targetChain);
250
237
  const isBusy = submitting || isSubmitting;
251
238
  const seededRecipientRef = _react.useRef.call(void 0, _nullishCoalesce(defaultRecipient, () => ( "")));
252
239
  _react.useEffect.call(void 0, () => {
@@ -259,37 +246,22 @@ function WithdrawFormStep({
259
246
  });
260
247
  seededRecipientRef.current = nextSeed;
261
248
  }, [defaultRecipient]);
262
- _react.useEffect.call(void 0, () => {
263
- if (chainMismatch && switchChain && !hasAttemptedSwitch.current) {
264
- hasAttemptedSwitch.current = true;
265
- setIsSwitching(true);
266
- switchChain(asset.chainId).catch((err) => {
267
- const raw = err instanceof Error ? err.message : "Failed to switch chain";
268
- setError(_chunkDSXMWQYBcjs.formatUserError.call(void 0, raw));
269
- }).finally(() => {
270
- setIsSwitching(false);
271
- });
272
- }
273
- }, [chainMismatch, switchChain, asset.chainId]);
274
- _react.useEffect.call(void 0, () => {
275
- hasAttemptedSwitch.current = false;
276
- }, [asset.chainId]);
277
249
  _react.useEffect.call(void 0, () => {
278
250
  let active = true;
279
251
  let timeoutId;
280
252
  let retryDelayMs = 5e3;
281
253
  async function fetchBalance() {
282
- if (!safeAddress || !publicClient) return;
254
+ if (!accountAddress || !publicClient) return;
283
255
  if (publicClientChainId && publicClientChainId !== asset.chainId) {
284
256
  timeoutId = setTimeout(fetchBalance, 1e3);
285
257
  return;
286
258
  }
287
259
  try {
288
- const bal = _chunkDSXMWQYBcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
260
+ const bal = _chunkVN4BLZYCcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: accountAddress }) : await publicClient.readContract({
289
261
  address: asset.token,
290
262
  abi: _viem.erc20Abi,
291
263
  functionName: "balanceOf",
292
- args: [safeAddress]
264
+ args: [accountAddress]
293
265
  });
294
266
  if (active) {
295
267
  setBalance(bal);
@@ -312,7 +284,7 @@ function WithdrawFormStep({
312
284
  clearTimeout(timeoutId);
313
285
  }
314
286
  };
315
- }, [safeAddress, publicClient, publicClientChainId, asset]);
287
+ }, [accountAddress, publicClient, publicClientChainId, asset]);
316
288
  const formattedBalance = _react.useMemo.call(void 0, () => {
317
289
  if (balance === null) return "...";
318
290
  try {
@@ -334,7 +306,7 @@ function WithdrawFormStep({
334
306
  const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
335
307
  const numeric = Number(raw);
336
308
  if (!Number.isFinite(numeric)) return;
337
- _optionalChain([onBalanceUsdChange, 'optionalCall', _5 => _5(numeric)]);
309
+ _optionalChain([onBalanceUsdChange, 'optionalCall', _3 => _3(numeric)]);
338
310
  } catch (e4) {
339
311
  return;
340
312
  }
@@ -355,19 +327,13 @@ function WithdrawFormStep({
355
327
  setAmount(maxAmount);
356
328
  setError(null);
357
329
  }, [balance, asset.decimals]);
358
- const handleUseConnected = _react.useCallback.call(void 0, () => {
359
- if (!preferredConnectedRecipient) return;
360
- setRecipient(preferredConnectedRecipient);
361
- _optionalChain([onRecipientChange, 'optionalCall', _6 => _6(preferredConnectedRecipient)]);
362
- setError(null);
363
- }, [preferredConnectedRecipient, onRecipientChange]);
364
330
  const handleWithdraw = _react.useCallback.call(void 0, async () => {
365
331
  if (!recipient || !/^0x[a-fA-F0-9]{40}$/.test(recipient)) {
366
332
  setError("Enter a valid recipient address");
367
333
  return;
368
334
  }
369
335
  const lowerRecipient = recipient.toLowerCase();
370
- if (lowerRecipient === safeAddress.toLowerCase() || lowerRecipient === _optionalChain([depositAddress, 'optionalAccess', _7 => _7.toLowerCase, 'call', _8 => _8()])) {
336
+ if (lowerRecipient === accountAddress.toLowerCase() || lowerRecipient === _optionalChain([depositAddress, 'optionalAccess', _4 => _4.toLowerCase, 'call', _5 => _5()])) {
371
337
  setError(
372
338
  "Recipient can't be your own account. Send to a different wallet."
373
339
  );
@@ -396,7 +362,7 @@ function WithdrawFormStep({
396
362
  await onSubmit(recipient, amount);
397
363
  } catch (err) {
398
364
  const raw = err instanceof Error ? err.message : "Withdrawal failed";
399
- setError(_chunkDSXMWQYBcjs.formatUserError.call(void 0, raw));
365
+ setError(_chunkVN4BLZYCcjs.formatUserError.call(void 0, raw));
400
366
  } finally {
401
367
  setIsSubmitting(false);
402
368
  }
@@ -405,23 +371,23 @@ function WithdrawFormStep({
405
371
  amount,
406
372
  balance,
407
373
  asset.decimals,
408
- safeAddress,
374
+ accountAddress,
409
375
  depositAddress,
410
376
  onSubmit
411
377
  ]);
412
378
  if (isBalanceLoading) {
413
379
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
414
380
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-withdraw-loading", children: [
415
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.Spinner, { className: "rs-spinner--lg" }),
381
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.Spinner, { className: "rs-spinner--lg" }),
416
382
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-title", children: "Loading on-chain balance" }),
417
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: chainMismatch ? `Switch to ${_chunkP5T4XSN2cjs.getChainName.call(void 0, asset.chainId)} to continue.` : "Please wait before withdrawing." })
383
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: "Please wait before withdrawing." })
418
384
  ] }),
419
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.PoweredBy, {})
385
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.PoweredBy, {})
420
386
  ] });
421
387
  }
422
388
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
423
389
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
424
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.CircleArrowOutUpLeftIcon, {}), title: "Withdraw" }),
390
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.CircleArrowOutUpLeftIcon, {}), title: "Withdraw" }),
425
391
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-section", children: [
426
392
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
427
393
  "label",
@@ -431,48 +397,22 @@ function WithdrawFormStep({
431
397
  children: "Recipient address"
432
398
  }
433
399
  ),
434
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-input-row", children: [
435
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
436
- "input",
437
- {
438
- id: "rs-withdraw-recipient",
439
- type: "text",
440
- className: "rs-withdraw-input rs-withdraw-input--address",
441
- placeholder: "0x...",
442
- value: recipient,
443
- onChange: (e) => {
444
- const next = e.target.value.trim();
445
- setRecipient(next);
446
- _optionalChain([onRecipientChange, 'optionalCall', _9 => _9(next)]);
447
- if (error) setError(null);
448
- }
449
- }
450
- ),
451
- preferredConnectedRecipient && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
452
- "button",
453
- {
454
- type: "button",
455
- className: `rs-withdraw-use-connected ${isRecipientConnected ? "rs-withdraw-use-connected--active" : ""}`,
456
- onClick: handleUseConnected,
457
- title: isRecipientConnected ? "Using connected wallet" : "Use connected wallet",
458
- children: walletIcon ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
459
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
460
- "img",
461
- {
462
- src: walletIcon,
463
- alt: "Wallet",
464
- style: { width: 18, height: 18, borderRadius: 4 },
465
- className: "rs-withdraw-use-connected-icon"
466
- }
467
- ),
468
- isRecipientConnected ? null : "Use connected"
469
- ] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
470
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.WalletIcon, { className: "rs-withdraw-use-connected-icon" }),
471
- isRecipientConnected ? null : "Use connected"
472
- ] })
400
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-input-row", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
401
+ "input",
402
+ {
403
+ id: "rs-withdraw-recipient",
404
+ type: "text",
405
+ className: "rs-withdraw-input rs-withdraw-input--address",
406
+ placeholder: "0x...",
407
+ value: recipient,
408
+ onChange: (e) => {
409
+ const next = e.target.value.trim();
410
+ setRecipient(next);
411
+ _optionalChain([onRecipientChange, 'optionalCall', _6 => _6(next)]);
412
+ if (error) setError(null);
473
413
  }
474
- )
475
- ] })
414
+ }
415
+ ) })
476
416
  ] }),
477
417
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-section", children: [
478
418
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { className: "rs-withdraw-label", htmlFor: "rs-withdraw-amount", children: "Amount" }),
@@ -507,7 +447,7 @@ function WithdrawFormStep({
507
447
  ) })
508
448
  ] }),
509
449
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-amount-info", children: [
510
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunkDSXMWQYBcjs.currencyFormatter.format(amountUsd) : "$0.00" }),
450
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? `~${_chunkVN4BLZYCcjs.currencyFormatter.format(amountUsd)}` : "$0.00" }),
511
451
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
512
452
  "Balance: ",
513
453
  formattedBalance,
@@ -537,10 +477,10 @@ function WithdrawFormStep({
537
477
  },
538
478
  children: [
539
479
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
540
- _chunkP5T4XSN2cjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
541
- "img",
480
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
481
+ _chunkVN4BLZYCcjs.CdnIcon,
542
482
  {
543
- src: _chunkP5T4XSN2cjs.getChainIcon.call(void 0, targetChain),
483
+ src: _chunkH577RJN5cjs.getChainIcon.call(void 0, targetChain),
544
484
  alt: targetChainName,
545
485
  className: "rs-withdraw-dropdown-icon"
546
486
  }
@@ -548,7 +488,7 @@ function WithdrawFormStep({
548
488
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetChainName })
549
489
  ] }),
550
490
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
551
- _chunkDSXMWQYBcjs.ChevronDownIcon,
491
+ _chunkVN4BLZYCcjs.ChevronDownIcon,
552
492
  {
553
493
  className: "rs-withdraw-dropdown-arrow",
554
494
  style: {
@@ -569,10 +509,10 @@ function WithdrawFormStep({
569
509
  setShowChainDropdown(false);
570
510
  },
571
511
  children: [
572
- _chunkP5T4XSN2cjs.getChainIcon.call(void 0, chain.id) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
573
- "img",
512
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
513
+ _chunkVN4BLZYCcjs.CdnIcon,
574
514
  {
575
- src: _chunkP5T4XSN2cjs.getChainIcon.call(void 0, chain.id),
515
+ src: _chunkH577RJN5cjs.getChainIcon.call(void 0, chain.id),
576
516
  alt: chain.name,
577
517
  className: "rs-withdraw-dropdown-icon"
578
518
  }
@@ -607,7 +547,7 @@ function WithdrawFormStep({
607
547
  children: [
608
548
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
609
549
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
610
- _chunkDSXMWQYBcjs.TokenIcon,
550
+ _chunkVN4BLZYCcjs.TokenIcon,
611
551
  {
612
552
  symbol: targetSymbol,
613
553
  className: "rs-withdraw-dropdown-icon"
@@ -616,7 +556,7 @@ function WithdrawFormStep({
616
556
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetSymbol })
617
557
  ] }),
618
558
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
619
- _chunkDSXMWQYBcjs.ChevronDownIcon,
559
+ _chunkVN4BLZYCcjs.ChevronDownIcon,
620
560
  {
621
561
  className: "rs-withdraw-dropdown-arrow",
622
562
  style: {
@@ -638,7 +578,7 @@ function WithdrawFormStep({
638
578
  },
639
579
  children: [
640
580
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
641
- _chunkDSXMWQYBcjs.TokenIcon,
581
+ _chunkVN4BLZYCcjs.TokenIcon,
642
582
  {
643
583
  symbol: option.symbol,
644
584
  className: "rs-withdraw-dropdown-icon"
@@ -654,21 +594,20 @@ function WithdrawFormStep({
654
594
  )
655
595
  ] })
656
596
  ] }),
657
- chainMismatch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${_chunkP5T4XSN2cjs.getChainName.call(void 0, asset.chainId)}...` : `Switch to ${_chunkP5T4XSN2cjs.getChainName.call(void 0, asset.chainId)} to continue.` }) }),
658
- error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.Callout, { variant: "error", children: error }),
659
- !error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.Callout, { variant: "error", children: registrationError }),
597
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.Callout, { variant: "error", children: error }),
598
+ !error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.Callout, { variant: "error", children: registrationError }),
660
599
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
661
- _chunkDSXMWQYBcjs.Button,
600
+ _chunkVN4BLZYCcjs.Button,
662
601
  {
663
602
  onClick: handleWithdraw,
664
603
  fullWidth: true,
665
604
  loading: isBusy,
666
- disabled: !recipient || !amount || chainMismatch || isBusy || Boolean(registrationError),
605
+ disabled: !recipient || !amount || isBusy || Boolean(registrationError),
667
606
  children: isBusy ? "Preparing..." : registrationPending ? "Preparing session..." : !recipient ? "Enter Recipient Address" : !amount ? "Enter Withdraw Amount" : "Withdraw"
668
607
  }
669
608
  )
670
609
  ] }),
671
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.PoweredBy, {})
610
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.PoweredBy, {})
672
611
  ] });
673
612
  }
674
613
  WithdrawFormStep.displayName = "WithdrawFormStep";
@@ -696,22 +635,22 @@ function WithdrawReviewStep({
696
635
  }) {
697
636
  const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
698
637
  const [error, setError] = _react.useState.call(void 0, null);
699
- const sourceChainName = _chunkP5T4XSN2cjs.getChainName.call(void 0, sourceChain);
700
- const sourceChainIcon = _chunkP5T4XSN2cjs.getChainIcon.call(void 0, sourceChain);
701
- const targetSymbol = _chunkP5T4XSN2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
702
- const targetChainName = _chunkP5T4XSN2cjs.getChainName.call(void 0, targetChain);
703
- const targetChainIcon = _chunkP5T4XSN2cjs.getChainIcon.call(void 0, targetChain);
638
+ const sourceChainName = _chunkH577RJN5cjs.getChainName.call(void 0, sourceChain);
639
+ const sourceChainIcon = _chunkH577RJN5cjs.getChainIcon.call(void 0, sourceChain);
640
+ const targetSymbol = _chunkH577RJN5cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
641
+ const targetChainName = _chunkH577RJN5cjs.getChainName.call(void 0, targetChain);
642
+ const targetChainIcon = _chunkH577RJN5cjs.getChainIcon.call(void 0, targetChain);
704
643
  const amountNumber = Number(amount);
705
- const formattedSendAmount = _nullishCoalesce(_chunkDSXMWQYBcjs.formatTokenAmount.call(void 0, amountNumber, sourceSymbol), () => ( amount));
706
- const prices = _chunkDSXMWQYBcjs.useTokenPrices.call(void 0, service, [
644
+ const formattedSendAmount = _nullishCoalesce(_chunkVN4BLZYCcjs.formatTokenAmount.call(void 0, amountNumber, sourceSymbol), () => ( amount));
645
+ const prices = _chunkNMIMRASDcjs.useTokenPrices.call(void 0, service, [
707
646
  { chainId: sourceChain, address: sourceToken, symbol: sourceSymbol },
708
647
  { chainId: targetChain, address: targetToken, symbol: targetSymbol }
709
648
  ]);
710
- const receiveDisplay = _nullishCoalesce(_chunkDSXMWQYBcjs.formatReceiveEstimate.call(void 0, {
649
+ const receiveDisplay = _nullishCoalesce(_chunkVN4BLZYCcjs.formatReceiveEstimate.call(void 0, {
711
650
  sourceAmount: Number.isFinite(amountNumber) ? amountNumber : void 0,
712
651
  sourceSymbol,
713
652
  targetSymbol,
714
- sourceTrusted: _chunkDSXMWQYBcjs.isRecognizedToken.call(void 0, sourceToken, sourceChain),
653
+ sourceTrusted: _chunkVN4BLZYCcjs.isRecognizedToken.call(void 0, sourceToken, sourceChain),
715
654
  prices
716
655
  }), () => ( // No price for the target token — an honest dash beats a wrong number.
717
656
  "\u2014"));
@@ -722,9 +661,9 @@ function WithdrawReviewStep({
722
661
  await onConfirm();
723
662
  } catch (err) {
724
663
  const raw = err instanceof Error ? err.message : "Withdraw failed";
725
- const message = _chunkDSXMWQYBcjs.formatUserError.call(void 0, raw);
664
+ const message = _chunkVN4BLZYCcjs.formatUserError.call(void 0, raw);
726
665
  setError(message);
727
- _optionalChain([onError, 'optionalCall', _10 => _10(message, "WITHDRAW_REVIEW_ERROR")]);
666
+ _optionalChain([onError, 'optionalCall', _7 => _7(message, "WITHDRAW_REVIEW_ERROR")]);
728
667
  } finally {
729
668
  setIsSubmitting(false);
730
669
  }
@@ -733,9 +672,9 @@ function WithdrawReviewStep({
733
672
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
734
673
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
735
674
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
736
- _chunkDSXMWQYBcjs.BodyHeader,
675
+ _chunkVN4BLZYCcjs.BodyHeader,
737
676
  {
738
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.CircleArrowOutUpLeftIcon, {}),
677
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.CircleArrowOutUpLeftIcon, {}),
739
678
  title: "Review withdrawal"
740
679
  }
741
680
  ),
@@ -748,14 +687,14 @@ function WithdrawReviewStep({
748
687
  " ",
749
688
  sourceSymbol
750
689
  ] }),
751
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.TokenIcon, { symbol: sourceSymbol }) })
690
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.TokenIcon, { symbol: sourceSymbol }) })
752
691
  ] })
753
692
  ] }),
754
693
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
755
694
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
756
695
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
757
696
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceChainName }),
758
- sourceChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: sourceChainIcon, alt: "" }) })
697
+ sourceChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.CdnIcon, { src: sourceChainIcon }) })
759
698
  ] })
760
699
  ] }),
761
700
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
@@ -766,14 +705,14 @@ function WithdrawReviewStep({
766
705
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Receive" }),
767
706
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
768
707
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: receiveDisplay }),
769
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.TokenIcon, { symbol: targetSymbol }) })
708
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.TokenIcon, { symbol: targetSymbol }) })
770
709
  ] })
771
710
  ] }),
772
711
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
773
712
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Destination chain" }),
774
713
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
775
714
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetChainName }),
776
- targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: targetChainIcon, alt: "" }) })
715
+ targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.CdnIcon, { src: targetChainIcon }) })
777
716
  ] })
778
717
  ] }),
779
718
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
@@ -781,10 +720,10 @@ function WithdrawReviewStep({
781
720
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: estimatedTime })
782
721
  ] })
783
722
  ] }),
784
- error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.Callout, { variant: "error", children: error }),
785
- !error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.Callout, { variant: "error", children: registrationError }),
723
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.Callout, { variant: "error", children: error }),
724
+ !error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.Callout, { variant: "error", children: registrationError }),
786
725
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
787
- _chunkDSXMWQYBcjs.Button,
726
+ _chunkVN4BLZYCcjs.Button,
788
727
  {
789
728
  onClick: handleConfirm,
790
729
  loading: isSubmitting,
@@ -795,7 +734,7 @@ function WithdrawReviewStep({
795
734
  }
796
735
  )
797
736
  ] }),
798
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.PoweredBy, {})
737
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.PoweredBy, {})
799
738
  ] });
800
739
  }
801
740
  WithdrawReviewStep.displayName = "WithdrawReviewStep";
@@ -806,27 +745,12 @@ WithdrawReviewStep.displayName = "WithdrawReviewStep";
806
745
  var ADDR_REGEX = /^0x[a-fA-F0-9]{40}$/;
807
746
  var REGISTRATION_DEBOUNCE_MS = 600;
808
747
  var WITHDRAW_INDEXING_DELAY_MS = 2e3;
809
- function resolveSessionOwner(eoaAddress) {
810
- const localOwner = _chunkDSXMWQYBcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
811
- if (localOwner) {
812
- return {
813
- account: _chunkDSXMWQYBcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
814
- address: localOwner.address
815
- };
816
- }
817
- const created = _chunkDSXMWQYBcjs.createSessionOwnerKey.call(void 0, );
818
- _chunkDSXMWQYBcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
819
- return { account: created.account, address: created.address };
820
- }
821
748
  function targetsEqual(a, b) {
822
749
  if (!a) return false;
823
- return a.chain === b.chain && a.token.toLowerCase() === b.token.toLowerCase() && (_nullishCoalesce(_optionalChain([a, 'access', _11 => _11.recipient, 'optionalAccess', _12 => _12.toLowerCase, 'call', _13 => _13()]), () => ( ""))) === (_nullishCoalesce(_optionalChain([b, 'access', _14 => _14.recipient, 'optionalAccess', _15 => _15.toLowerCase, 'call', _16 => _16()]), () => ( "")));
750
+ return a.chain === b.chain && a.token.toLowerCase() === b.token.toLowerCase() && (_nullishCoalesce(_optionalChain([a, 'access', _8 => _8.recipient, 'optionalAccess', _9 => _9.toLowerCase, 'call', _10 => _10()]), () => ( ""))) === (_nullishCoalesce(_optionalChain([b, 'access', _11 => _11.recipient, 'optionalAccess', _12 => _12.toLowerCase, 'call', _13 => _13()]), () => ( "")));
824
751
  }
825
752
  function WithdrawFlow({
826
- dappWalletClient,
827
- dappPublicClient,
828
- dappAddress,
829
- safeAddress,
753
+ accountAddress,
830
754
  sourceChain,
831
755
  sourceToken,
832
756
  targetChain: targetChainProp,
@@ -834,15 +758,8 @@ function WithdrawFlow({
834
758
  recipient: defaultRecipient,
835
759
  amount: defaultAmount,
836
760
  service,
837
- allowedRoutes,
838
- signerAddress = _chunkP5T4XSN2cjs.DEFAULT_SIGNER_ADDRESS,
839
- sessionChainIds,
840
761
  forceRegister = false,
841
- reownWallet,
842
- onConnect,
843
- onDisconnect,
844
- onSignTransaction,
845
- onRequestConnect,
762
+ onSendTransaction,
846
763
  onStepChange,
847
764
  onClose,
848
765
  onLifecycle,
@@ -850,11 +767,11 @@ function WithdrawFlow({
850
767
  onError,
851
768
  debug
852
769
  }) {
853
- const rpcUrls = _chunkDSXMWQYBcjs.useRpcUrls.call(void 0, );
854
- const onStepChangeRef = _chunkDSXMWQYBcjs.useLatestRef.call(void 0, onStepChange);
855
- const onEventRef = _chunkDSXMWQYBcjs.useLatestRef.call(void 0, onEvent);
856
- const onLifecycleRef = _chunkDSXMWQYBcjs.useLatestRef.call(void 0, onLifecycle);
857
- const onErrorRef = _chunkDSXMWQYBcjs.useLatestRef.call(void 0, onError);
770
+ const rpcUrls = _chunkVN4BLZYCcjs.useRpcUrls.call(void 0, );
771
+ const onStepChangeRef = _chunkVN4BLZYCcjs.useLatestRef.call(void 0, onStepChange);
772
+ const onEventRef = _chunkVN4BLZYCcjs.useLatestRef.call(void 0, onEvent);
773
+ const onLifecycleRef = _chunkVN4BLZYCcjs.useLatestRef.call(void 0, onLifecycle);
774
+ const onErrorRef = _chunkVN4BLZYCcjs.useLatestRef.call(void 0, onError);
858
775
  const isFlowActiveRef = _react.useRef.call(void 0, true);
859
776
  const submitGenerationRef = _react.useRef.call(void 0, 0);
860
777
  _react.useEffect.call(void 0, () => {
@@ -865,13 +782,13 @@ function WithdrawFlow({
865
782
  }, []);
866
783
  const logFlow = _react.useCallback.call(void 0,
867
784
  (message, data) => {
868
- _chunkDSXMWQYBcjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
785
+ _chunkVN4BLZYCcjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
869
786
  },
870
787
  [debug]
871
788
  );
872
789
  const logFlowError = _react.useCallback.call(void 0,
873
790
  (message, error, data) => {
874
- _chunkDSXMWQYBcjs.debugError.call(void 0, debug, "withdraw-flow", message, error, data);
791
+ _chunkVN4BLZYCcjs.debugError.call(void 0, debug, "withdraw-flow", message, error, data);
875
792
  },
876
793
  [debug]
877
794
  );
@@ -881,213 +798,81 @@ function WithdrawFlow({
881
798
  _nullishCoalesce(defaultRecipient, () => ( ""))
882
799
  );
883
800
  const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
884
- const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
885
801
  _react.useEffect.call(void 0, () => {
886
802
  setTargetChain(targetChainProp);
803
+ }, [targetChainProp]);
804
+ _react.useEffect.call(void 0, () => {
887
805
  setTargetToken(targetTokenProp);
888
- }, [targetChainProp, targetTokenProp]);
806
+ }, [targetTokenProp]);
889
807
  _react.useEffect.call(void 0, () => {
890
808
  if (defaultRecipient) setRecipientInput(defaultRecipient);
891
809
  }, [defaultRecipient]);
892
- const hasCustomSigner = Boolean(dappAddress && onSignTransaction);
893
- const dappSwitchChain = _react.useMemo.call(void 0, () => {
894
- if (!_optionalChain([dappWalletClient, 'optionalAccess', _17 => _17.switchChain])) return void 0;
895
- return async (chainId) => {
896
- await _optionalChain([dappWalletClient, 'access', _18 => _18.switchChain, 'optionalCall', _19 => _19({ id: chainId })]);
897
- };
898
- }, [dappWalletClient]);
899
- const walletOptions = _react.useMemo.call(void 0, () => {
900
- const options = [];
901
- const seen = /* @__PURE__ */ new Set();
902
- if (_optionalChain([dappWalletClient, 'optionalAccess', _20 => _20.account]) && dappAddress) {
903
- const id = `evm:${dappWalletClient.account.address.toLowerCase()}`;
904
- options.push({
905
- id,
906
- address: dappWalletClient.account.address,
907
- label: "Connected Wallet",
908
- kind: "connected"
909
- });
910
- seen.add(id);
911
- }
912
- if (_optionalChain([reownWallet, 'optionalAccess', _21 => _21.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient) {
913
- const id = `evm:${reownWallet.address.toLowerCase()}`;
914
- if (!seen.has(id)) {
915
- options.push({
916
- id,
917
- address: reownWallet.address,
918
- label: "External Wallet",
919
- kind: "external",
920
- icon: reownWallet.icon
921
- });
922
- }
923
- }
924
- return options;
925
- }, [
926
- dappWalletClient,
927
- dappAddress,
928
- _optionalChain([reownWallet, 'optionalAccess', _22 => _22.address]),
929
- _optionalChain([reownWallet, 'optionalAccess', _23 => _23.isConnected]),
930
- _optionalChain([reownWallet, 'optionalAccess', _24 => _24.walletClient]),
931
- _optionalChain([reownWallet, 'optionalAccess', _25 => _25.publicClient]),
932
- _optionalChain([reownWallet, 'optionalAccess', _26 => _26.icon])
933
- ]);
934
- const canAutoLock = hasCustomSigner || Boolean(_optionalChain([dappWalletClient, 'optionalAccess', _27 => _27.account]) && dappAddress) && !reownWallet;
935
810
  const storeApi = useWithdrawStoreApi();
936
- const selectedWalletId = useWithdrawStore((s) => s.selectedWalletId);
937
811
  const registration = useWithdrawStore((s) => s.registration);
938
812
  const flowStep = useWithdrawStore((s) => s.step);
939
813
  const reviewedRecipient = useWithdrawStore((s) => s.recipient);
940
- const setSelectedWalletId = _react.useCallback.call(void 0,
941
- (walletId) => storeApi.dispatch({ type: "wallet/id-selected", walletId }),
942
- [storeApi]
814
+ const publicClient = _react.useMemo.call(void 0,
815
+ () => _chunkNMIMRASDcjs.getPublicClient.call(void 0, sourceChain, rpcUrls),
816
+ [sourceChain, rpcUrls]
943
817
  );
944
- const signerContext = _react.useMemo.call(void 0, () => {
945
- if (canAutoLock) {
946
- if (hasCustomSigner) {
947
- return {
948
- ownerAddress: dappAddress,
949
- walletClient: _nullishCoalesce(dappWalletClient, () => ( void 0)),
950
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkDSXMWQYBcjs.getPublicClient.call(void 0, sourceChain, rpcUrls))),
951
- switchChain: dappSwitchChain
952
- };
953
- }
954
- return {
955
- ownerAddress: dappWalletClient.account.address,
956
- walletClient: dappWalletClient,
957
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkDSXMWQYBcjs.getPublicClient.call(void 0, sourceChain, rpcUrls))),
958
- switchChain: dappSwitchChain
959
- };
960
- }
961
- if (!isConnectSelectionConfirmed || !selectedWalletId) return null;
962
- const selectedOption = walletOptions.find((o) => o.id === selectedWalletId);
963
- if (!selectedOption || !selectedOption.address) return null;
964
- if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess', _28 => _28.account]) && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
965
- return {
966
- ownerAddress: dappWalletClient.account.address,
967
- walletClient: dappWalletClient,
968
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkDSXMWQYBcjs.getPublicClient.call(void 0, sourceChain, rpcUrls))),
969
- switchChain: dappSwitchChain
970
- };
971
- }
972
- if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess', _29 => _29.address, 'optionalAccess', _30 => _30.toLowerCase, 'call', _31 => _31()]) === selectedOption.address.toLowerCase() && reownWallet.walletClient && reownWallet.publicClient) {
973
- return {
974
- ownerAddress: reownWallet.address,
975
- walletClient: reownWallet.walletClient,
976
- publicClient: reownWallet.publicClient,
977
- switchChain: reownWallet.switchChain
978
- };
979
- }
980
- return null;
981
- }, [
982
- canAutoLock,
983
- hasCustomSigner,
984
- isConnectSelectionConfirmed,
985
- selectedWalletId,
986
- walletOptions,
987
- dappWalletClient,
988
- dappPublicClient,
989
- dappSwitchChain,
990
- dappAddress,
991
- reownWallet,
992
- sourceChain,
993
- rpcUrls
994
- ]);
995
- const ownerAddress = _optionalChain([signerContext, 'optionalAccess', _32 => _32.ownerAddress]);
996
818
  const recipientForRegistration = _react.useMemo.call(void 0, () => {
997
819
  if (!recipientInput) return void 0;
998
820
  return ADDR_REGEX.test(recipientInput) ? recipientInput : void 0;
999
821
  }, [recipientInput]);
1000
822
  _react.useEffect.call(void 0, () => {
1001
- if (!ownerAddress || !recipientForRegistration) return;
823
+ if (!recipientForRegistration) return;
1002
824
  const desiredTarget = {
1003
825
  chain: targetChain,
1004
826
  token: targetToken,
1005
827
  recipient: recipientForRegistration
1006
828
  };
1007
829
  const current = storeApi.getState().registration;
1008
- if (current.kind === "ready" && targetsEqual(current.registeredTarget, desiredTarget)) {
830
+ if (!forceRegister && current.kind === "ready" && targetsEqual(current.registeredTarget, desiredTarget)) {
1009
831
  return;
1010
832
  }
1011
833
  let cancelled = false;
1012
834
  const timeout = setTimeout(async () => {
1013
835
  try {
1014
836
  storeApi.dispatch({ type: "registration/started" });
1015
- const sessionOwner = resolveSessionOwner(ownerAddress);
1016
- if (cancelled) return;
1017
837
  logFlow("auto-register:setup", {
1018
- ownerAddress,
838
+ accountAddress,
1019
839
  targetChain,
1020
840
  targetToken,
1021
841
  recipient: recipientForRegistration
1022
842
  });
1023
- const setup = await service.setupAccount({
1024
- ownerAddress,
1025
- sessionOwnerAddress: sessionOwner.address,
1026
- targetChain: _chunkP5T4XSN2cjs.toEvmCaip2.call(void 0, targetChain),
1027
- targetToken,
843
+ const salt = _chunkNMIMRASDcjs.deriveAccountSalt.call(void 0, {
1028
844
  recipient: recipientForRegistration,
1029
- signerAddress,
1030
- sessionChainIds,
1031
- forceRegister
845
+ targetChain,
846
+ targetToken
1032
847
  });
1033
- if (cancelled) return;
1034
- if (setup.needsRegistration) {
1035
- if (!setup.accountParams || !setup.sessionDetailsUnsigned) {
1036
- throw new Error("Missing registration payload from setup-account");
1037
- }
1038
- const typedData = setup.sessionDetailsUnsigned.data;
1039
- if (!sessionOwner.account.signTypedData) {
1040
- throw new Error(
1041
- "Session owner account does not support signTypedData"
1042
- );
848
+ const { evmDepositAddress } = await service.registerManagedAccount({
849
+ salt,
850
+ target: {
851
+ chain: _chunkH577RJN5cjs.targetChainToCaip2.call(void 0, targetChain),
852
+ token: targetToken,
853
+ recipient: recipientForRegistration
1043
854
  }
1044
- const signature = await sessionOwner.account.signTypedData({
1045
- domain: typedData.domain,
1046
- types: typedData.types,
1047
- primaryType: typedData.primaryType,
1048
- message: typedData.message
1049
- });
1050
- if (cancelled) return;
1051
- const sessionDetails = _chunkDSXMWQYBcjs.buildSessionDetails.call(void 0,
1052
- setup.sessionDetailsUnsigned,
1053
- signature
1054
- );
1055
- await service.registerAccount({
1056
- address: setup.smartAccount,
1057
- accountParams: {
1058
- factory: setup.accountParams.factory,
1059
- factoryData: setup.accountParams.factoryData,
1060
- sessionDetails
1061
- },
1062
- eoaAddress: ownerAddress,
1063
- sessionOwner: sessionOwner.address,
1064
- target: {
1065
- chain: _chunkP5T4XSN2cjs.toEvmCaip2.call(void 0, targetChain),
1066
- token: targetToken,
1067
- recipient: recipientForRegistration
1068
- }
1069
- });
1070
- if (cancelled) return;
1071
- logFlow("auto-register:registered", {
1072
- smartAccount: setup.smartAccount
1073
- });
1074
- }
855
+ });
856
+ if (cancelled) return;
857
+ logFlow("auto-register:registered", {
858
+ smartAccount: evmDepositAddress
859
+ });
1075
860
  storeApi.dispatch({
1076
861
  type: "registration/ready",
1077
- smartAccount: setup.smartAccount,
862
+ smartAccount: evmDepositAddress,
1078
863
  registeredTarget: desiredTarget
1079
864
  });
1080
- _optionalChain([onLifecycleRef, 'access', _33 => _33.current, 'optionalCall', _34 => _34({
865
+ _optionalChain([onLifecycleRef, 'access', _14 => _14.current, 'optionalCall', _15 => _15({
1081
866
  type: "connected",
1082
- address: ownerAddress,
1083
- smartAccount: setup.smartAccount
867
+ address: accountAddress,
868
+ smartAccount: evmDepositAddress
1084
869
  })]);
1085
870
  } catch (err) {
1086
871
  if (cancelled) return;
1087
872
  const raw = err instanceof Error ? err.message : "Registration failed";
1088
- const message = _chunkDSXMWQYBcjs.formatUserError.call(void 0, raw);
873
+ const message = _chunkVN4BLZYCcjs.formatUserError.call(void 0, raw);
1089
874
  logFlowError("auto-register:failed", err, {
1090
- ownerAddress,
875
+ accountAddress,
1091
876
  targetChain,
1092
877
  targetToken
1093
878
  });
@@ -1095,7 +880,7 @@ function WithdrawFlow({
1095
880
  type: "registration/failed",
1096
881
  error: message
1097
882
  });
1098
- _optionalChain([onErrorRef, 'access', _35 => _35.current, 'optionalCall', _36 => _36({ message, code: "WITHDRAW_REGISTER_FAILED" })]);
883
+ _optionalChain([onErrorRef, 'access', _16 => _16.current, 'optionalCall', _17 => _17({ message, code: "WITHDRAW_REGISTER_FAILED" })]);
1099
884
  }
1100
885
  }, REGISTRATION_DEBOUNCE_MS);
1101
886
  return () => {
@@ -1103,13 +888,11 @@ function WithdrawFlow({
1103
888
  clearTimeout(timeout);
1104
889
  };
1105
890
  }, [
1106
- ownerAddress,
891
+ accountAddress,
1107
892
  targetChain,
1108
893
  targetToken,
1109
894
  recipientForRegistration,
1110
895
  service,
1111
- signerAddress,
1112
- sessionChainIds,
1113
896
  forceRegister,
1114
897
  storeApi,
1115
898
  logFlow,
@@ -1118,10 +901,10 @@ function WithdrawFlow({
1118
901
  onErrorRef
1119
902
  ]);
1120
903
  const asset = _react.useMemo.call(void 0, () => {
1121
- const symbol = _chunkP5T4XSN2cjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
1122
- const decimals = _chunkP5T4XSN2cjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
904
+ const symbol = _chunkH577RJN5cjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
905
+ const decimals = _chunkH577RJN5cjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
1123
906
  return {
1124
- id: _chunkDSXMWQYBcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
907
+ id: _chunkVN4BLZYCcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
1125
908
  chainId: sourceChain,
1126
909
  token: sourceToken,
1127
910
  symbol,
@@ -1129,7 +912,7 @@ function WithdrawFlow({
1129
912
  decimals
1130
913
  };
1131
914
  }, [sourceChain, sourceToken]);
1132
- const isSourceNative = sourceToken.toLowerCase() === _chunkP5T4XSN2cjs.NATIVE_TOKEN_ADDRESS.toLowerCase();
915
+ const isSourceNative = sourceToken.toLowerCase() === _chunkH577RJN5cjs.NATIVE_TOKEN_ADDRESS.toLowerCase();
1133
916
  const isSameRoute = targetChain === sourceChain && targetToken.toLowerCase() === sourceToken.toLowerCase();
1134
917
  const reviewedTarget = reviewedRecipient ? {
1135
918
  chain: targetChain,
@@ -1142,7 +925,7 @@ function WithdrawFlow({
1142
925
  storeApi.dispatch({ type: "review/back" });
1143
926
  }, [storeApi]);
1144
927
  _react.useEffect.call(void 0, () => {
1145
- _optionalChain([onStepChangeRef, 'access', _37 => _37.current, 'optionalCall', _38 => _38(
928
+ _optionalChain([onStepChangeRef, 'access', _18 => _18.current, 'optionalCall', _19 => _19(
1146
929
  flowStep === "review" ? reviewBackHandler : void 0
1147
930
  )]);
1148
931
  }, [flowStep, reviewBackHandler, onStepChangeRef]);
@@ -1154,9 +937,9 @@ function WithdrawFlow({
1154
937
  }
1155
938
  if (lastStepOpenEventKeyRef.current === "form") return;
1156
939
  lastStepOpenEventKeyRef.current = "form";
1157
- const tokenSymbol = _chunkP5T4XSN2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
1158
- const chainName = _chunkP5T4XSN2cjs.getChainName.call(void 0, targetChain);
1159
- _optionalChain([onEventRef, 'access', _39 => _39.current, 'optionalCall', _40 => _40({
940
+ const tokenSymbol = _chunkH577RJN5cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
941
+ const chainName = _chunkH577RJN5cjs.getChainName.call(void 0, targetChain);
942
+ _optionalChain([onEventRef, 'access', _20 => _20.current, 'optionalCall', _21 => _21({
1160
943
  type: "withdraw_modal_select_amount_open",
1161
944
  pred_balance: totalBalanceUsd,
1162
945
  default_token: tokenSymbol,
@@ -1170,12 +953,10 @@ function WithdrawFlow({
1170
953
  sourceToken,
1171
954
  targetChain,
1172
955
  targetToken,
1173
- selectedWalletId,
1174
956
  registration: registration.kind
1175
957
  });
1176
958
  }, [
1177
959
  logFlow,
1178
- selectedWalletId,
1179
960
  sourceChain,
1180
961
  sourceToken,
1181
962
  flowStep,
@@ -1186,15 +967,15 @@ function WithdrawFlow({
1186
967
  const handleError = _react.useCallback.call(void 0,
1187
968
  (message, code) => {
1188
969
  logFlowError("flow:error", message, { code });
1189
- _optionalChain([onErrorRef, 'access', _41 => _41.current, 'optionalCall', _42 => _42({ message, code })]);
970
+ _optionalChain([onErrorRef, 'access', _22 => _22.current, 'optionalCall', _23 => _23({ message, code })]);
1190
971
  },
1191
972
  [logFlowError, onErrorRef]
1192
973
  );
1193
974
  const handleFormContinue = _react.useCallback.call(void 0,
1194
975
  (recipient, amountValue) => {
1195
- const tokenSymbol = _chunkP5T4XSN2cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
1196
- const chainName = _chunkP5T4XSN2cjs.getChainName.call(void 0, targetChain);
1197
- _optionalChain([onEventRef, 'access', _43 => _43.current, 'optionalCall', _44 => _44({
976
+ const tokenSymbol = _chunkH577RJN5cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
977
+ const chainName = _chunkH577RJN5cjs.getChainName.call(void 0, targetChain);
978
+ _optionalChain([onEventRef, 'access', _24 => _24.current, 'optionalCall', _25 => _25({
1198
979
  type: "withdraw_modal_select_amount_cta_click",
1199
980
  pred_balance: totalBalanceUsd,
1200
981
  selected_token: tokenSymbol,
@@ -1233,14 +1014,11 @@ function WithdrawFlow({
1233
1014
  }
1234
1015
  const smartAccount = matchingRegistration.smartAccount;
1235
1016
  const lowerRecipient = recipient.toLowerCase();
1236
- if (lowerRecipient === safeAddress.toLowerCase() || lowerRecipient === smartAccount.toLowerCase()) {
1017
+ if (lowerRecipient === accountAddress.toLowerCase() || lowerRecipient === smartAccount.toLowerCase()) {
1237
1018
  throw new Error(
1238
1019
  "Recipient can't be your own account. Send to a different wallet."
1239
1020
  );
1240
1021
  }
1241
- if (!onSignTransaction && !_optionalChain([signerContext, 'optionalAccess', _45 => _45.walletClient])) {
1242
- throw new Error("Wallet not connected");
1243
- }
1244
1022
  const submitGeneration = submitGenerationRef.current += 1;
1245
1023
  const isSubmissionLive = () => isFlowActiveRef.current && submitGenerationRef.current === submitGeneration;
1246
1024
  try {
@@ -1261,71 +1039,19 @@ function WithdrawFlow({
1261
1039
  targetToken
1262
1040
  });
1263
1041
  const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
1264
- const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _46 => _46.publicClient]), () => ( _chunkDSXMWQYBcjs.getPublicClient.call(void 0, sourceChain, rpcUrls)));
1265
- let result;
1266
- if (onSignTransaction) {
1267
- const transferTarget = isSameRoute ? recipient : smartAccount;
1268
- const transferData = isSourceNative ? { to: transferTarget, value: amountUnits, data: "0x" } : {
1269
- to: sourceToken,
1270
- value: 0n,
1271
- data: _viem.encodeFunctionData.call(void 0, {
1272
- abi: _viem.erc20Abi,
1273
- functionName: "transfer",
1274
- args: [transferTarget, amountUnits]
1275
- })
1276
- };
1277
- const request = await _chunkUNVVUULPcjs.buildSafeTransaction.call(void 0, {
1278
- publicClient: pc,
1279
- safeAddress,
1280
- to: transferData.to,
1281
- value: transferData.value,
1282
- data: transferData.data,
1283
- chainId: sourceChain
1284
- });
1285
- if (!isSubmissionLive()) return;
1286
- const { signature } = await onSignTransaction(request);
1287
- if (!isSubmissionLive()) return;
1288
- if (!getMatchingRegistration()) {
1289
- throw new Error("Withdrawal target changed before submission");
1290
- }
1291
- const relayResult = await service.relayWithdraw({
1292
- smartAccount,
1293
- chainId: _chunkP5T4XSN2cjs.toEvmCaip2.call(void 0, sourceChain),
1294
- safeAddress,
1295
- safeTransaction: request.typedData.message,
1296
- signature
1297
- });
1298
- if (!relayResult.txHash) {
1299
- throw new Error("Relay succeeded but no txHash returned");
1300
- }
1301
- result = { txHash: relayResult.txHash };
1302
- } else if (isSourceNative) {
1303
- if (!getMatchingRegistration()) {
1304
- throw new Error("Withdrawal target changed before submission");
1305
- }
1306
- result = await _chunkUNVVUULPcjs.executeSafeEthTransfer.call(void 0, {
1307
- walletClient: signerContext.walletClient,
1308
- publicClient: pc,
1309
- safeAddress,
1310
- recipient: isSameRoute ? recipient : smartAccount,
1311
- amount: amountUnits,
1312
- chainId: sourceChain
1313
- });
1314
- } else {
1315
- if (!getMatchingRegistration()) {
1316
- throw new Error("Withdrawal target changed before submission");
1317
- }
1318
- result = await _chunkUNVVUULPcjs.executeSafeErc20Transfer.call(void 0, {
1319
- walletClient: signerContext.walletClient,
1320
- publicClient: pc,
1321
- safeAddress,
1322
- tokenAddress: sourceToken,
1323
- recipient: isSameRoute ? recipient : smartAccount,
1324
- amount: amountUnits,
1325
- chainId: sourceChain
1326
- });
1327
- }
1042
+ const result = await onSendTransaction({
1043
+ chainId: sourceChain,
1044
+ token: sourceToken,
1045
+ amount: amountUnits,
1046
+ to: isSameRoute ? recipient : smartAccount
1047
+ });
1328
1048
  if (!isSubmissionLive()) return;
1049
+ if (!getMatchingRegistration()) {
1050
+ throw new Error("Withdrawal target changed before submission");
1051
+ }
1052
+ if (!_optionalChain([result, 'optionalAccess', _26 => _26.txHash])) {
1053
+ throw new Error("onSendTransaction did not return a txHash");
1054
+ }
1329
1055
  logFlow("withdraw:submitted", {
1330
1056
  txHash: result.txHash,
1331
1057
  smartAccount,
@@ -1333,14 +1059,23 @@ function WithdrawFlow({
1333
1059
  sourceChain,
1334
1060
  sourceToken
1335
1061
  });
1336
- _optionalChain([onLifecycleRef, 'access', _47 => _47.current, 'optionalCall', _48 => _48({
1062
+ _optionalChain([onLifecycleRef, 'access', _27 => _27.current, 'optionalCall', _28 => _28({
1337
1063
  type: "submitted",
1338
1064
  txHash: result.txHash,
1339
1065
  sourceChain,
1340
1066
  amount: amountUnits.toString(),
1341
- safeAddress
1067
+ accountAddress
1342
1068
  })]);
1343
- storeApi.dispatch({ type: "withdraw/submitted", txHash: result.txHash });
1069
+ storeApi.dispatch({
1070
+ type: "withdraw/submitted",
1071
+ txHash: result.txHash,
1072
+ smartAccount,
1073
+ targetChain,
1074
+ targetToken,
1075
+ // Pin the routing decision this submit actually made — it chose the
1076
+ // transfer target above.
1077
+ directTransfer: isSameRoute
1078
+ });
1344
1079
  } catch (err) {
1345
1080
  const raw = err instanceof Error ? err.message : "Withdraw failed";
1346
1081
  logFlowError("submit:failed", err, {
@@ -1349,34 +1084,30 @@ function WithdrawFlow({
1349
1084
  targetChain,
1350
1085
  targetToken
1351
1086
  });
1352
- handleError(_chunkDSXMWQYBcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
1087
+ handleError(_chunkVN4BLZYCcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
1353
1088
  throw err;
1354
1089
  }
1355
1090
  },
1356
1091
  [
1357
- signerContext,
1358
1092
  targetChain,
1359
1093
  targetToken,
1360
- service,
1361
1094
  asset.decimals,
1362
- safeAddress,
1095
+ accountAddress,
1363
1096
  sourceToken,
1364
1097
  sourceChain,
1365
- onSignTransaction,
1366
- isSourceNative,
1098
+ onSendTransaction,
1367
1099
  isSameRoute,
1368
1100
  handleError,
1369
1101
  logFlow,
1370
1102
  logFlowError,
1371
1103
  onLifecycleRef,
1372
- storeApi,
1373
- rpcUrls
1104
+ storeApi
1374
1105
  ]
1375
1106
  );
1376
1107
  const handleWithdrawComplete = _react.useCallback.call(void 0,
1377
1108
  (txHash, destinationTxHash, context) => {
1378
1109
  logFlow("withdraw:complete", { txHash, destinationTxHash, ...context });
1379
- _optionalChain([onLifecycleRef, 'access', _49 => _49.current, 'optionalCall', _50 => _50({
1110
+ _optionalChain([onLifecycleRef, 'access', _29 => _29.current, 'optionalCall', _30 => _30({
1380
1111
  type: "complete",
1381
1112
  txHash,
1382
1113
  destinationTxHash,
@@ -1397,7 +1128,7 @@ function WithdrawFlow({
1397
1128
  const handleWithdrawFailed = _react.useCallback.call(void 0,
1398
1129
  (txHash, error) => {
1399
1130
  logFlowError("withdraw:failed", error, { txHash });
1400
- _optionalChain([onLifecycleRef, 'access', _51 => _51.current, 'optionalCall', _52 => _52({
1131
+ _optionalChain([onLifecycleRef, 'access', _31 => _31.current, 'optionalCall', _32 => _32({
1401
1132
  type: "failed",
1402
1133
  txHash,
1403
1134
  error
@@ -1406,29 +1137,16 @@ function WithdrawFlow({
1406
1137
  },
1407
1138
  [logFlowError, onLifecycleRef, storeApi]
1408
1139
  );
1409
- const allowedChainSet = _react.useMemo.call(void 0,
1410
- () => _optionalChain([allowedRoutes, 'optionalAccess', _53 => _53.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
1411
- [_optionalChain([allowedRoutes, 'optionalAccess', _54 => _54.sourceChains])]
1140
+ const targetChainOptions = _react.useMemo.call(void 0,
1141
+ () => _chunkH577RJN5cjs.SOURCE_CHAINS.filter(
1142
+ (chain) => _chunkH577RJN5cjs.getSupportedTargetTokens.call(void 0, chain.id).length > 0
1143
+ ),
1144
+ []
1412
1145
  );
1413
- const allowedTokenSet = _react.useMemo.call(void 0,
1414
- () => _optionalChain([allowedRoutes, 'optionalAccess', _55 => _55.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
1415
- [_optionalChain([allowedRoutes, 'optionalAccess', _56 => _56.sourceTokens])]
1146
+ const targetTokenOptions = _react.useMemo.call(void 0,
1147
+ () => _chunkH577RJN5cjs.getSupportedTargetTokens.call(void 0, targetChain),
1148
+ [targetChain]
1416
1149
  );
1417
- const targetChainOptions = _react.useMemo.call(void 0, () => {
1418
- return _chunkP5T4XSN2cjs.SOURCE_CHAINS.filter((chain) => {
1419
- if (allowedChainSet && !allowedChainSet.has(chain.id)) return false;
1420
- const tokens = _chunkP5T4XSN2cjs.getSupportedTargetTokens.call(void 0, chain.id);
1421
- if (allowedTokenSet) {
1422
- return tokens.some((t) => allowedTokenSet.has(t.symbol.toUpperCase()));
1423
- }
1424
- return tokens.length > 0;
1425
- });
1426
- }, [allowedChainSet, allowedTokenSet]);
1427
- const targetTokenOptions = _react.useMemo.call(void 0, () => {
1428
- const tokens = _chunkP5T4XSN2cjs.getSupportedTargetTokens.call(void 0, targetChain);
1429
- if (!allowedTokenSet) return tokens;
1430
- return tokens.filter((t) => allowedTokenSet.has(t.symbol.toUpperCase()));
1431
- }, [targetChain, allowedTokenSet]);
1432
1150
  _react.useEffect.call(void 0, () => {
1433
1151
  if (targetTokenOptions.length === 0) return;
1434
1152
  const matches = targetTokenOptions.some(
@@ -1439,12 +1157,7 @@ function WithdrawFlow({
1439
1157
  const handleTargetChainChange = _react.useCallback.call(void 0,
1440
1158
  (chainId) => {
1441
1159
  setTargetChain(chainId);
1442
- let options = _chunkP5T4XSN2cjs.getSupportedTargetTokens.call(void 0, chainId);
1443
- if (allowedTokenSet) {
1444
- options = options.filter(
1445
- (t) => allowedTokenSet.has(t.symbol.toUpperCase())
1446
- );
1447
- }
1160
+ const options = _chunkH577RJN5cjs.getSupportedTargetTokens.call(void 0, chainId);
1448
1161
  if (options.length === 0) return;
1449
1162
  const currentlySupported = options.some(
1450
1163
  (option) => option.address.toLowerCase() === targetToken.toLowerCase()
@@ -1453,71 +1166,19 @@ function WithdrawFlow({
1453
1166
  currentlySupported ? targetToken : options[0].address
1454
1167
  );
1455
1168
  },
1456
- [targetToken, allowedTokenSet]
1169
+ [targetToken]
1457
1170
  );
1458
1171
  const handleTargetTokenChange = _react.useCallback.call(void 0, (token) => {
1459
1172
  setTargetToken(token);
1460
1173
  }, []);
1461
- const selectedWalletIdEffective = _react.useMemo.call(void 0, () => {
1462
- if (selectedWalletId) return selectedWalletId;
1463
- if (walletOptions.length === 1) return walletOptions[0].id;
1464
- return null;
1465
- }, [selectedWalletId, walletOptions]);
1466
- const walletOptionsKey = _react.useMemo.call(void 0,
1467
- () => walletOptions.map((o) => o.id).join(","),
1468
- [walletOptions]
1469
- );
1470
- const showConnectStep = !canAutoLock && !isConnectSelectionConfirmed;
1471
- _react.useEffect.call(void 0, () => {
1472
- setIsConnectSelectionConfirmed(false);
1473
- }, [walletOptionsKey]);
1474
- const selectedWalletOption = selectedWalletIdEffective ? _nullishCoalesce(walletOptions.find((o) => o.id === selectedWalletIdEffective), () => ( null)) : null;
1475
- const selectedWalletIcon = _react.useMemo.call(void 0, () => {
1476
- if (!ownerAddress) return void 0;
1477
- const selected = walletOptions.find(
1478
- (o) => _optionalChain([o, 'access', _57 => _57.address, 'optionalAccess', _58 => _58.toLowerCase, 'call', _59 => _59()]) === ownerAddress.toLowerCase()
1479
- );
1480
- return _optionalChain([selected, 'optionalAccess', _60 => _60.kind]) === "external" ? _nullishCoalesce(selected.icon, () => ( _optionalChain([reownWallet, 'optionalAccess', _61 => _61.icon]))) : void 0;
1481
- }, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _62 => _62.icon])]);
1482
- if (showConnectStep) {
1483
- const withdrawRows = walletOptions.map((option) => ({
1484
- id: option.id,
1485
- kind: option.kind,
1486
- label: option.label,
1487
- icon: option.icon,
1488
- address: _nullishCoalesce(_nullishCoalesce(option.address, () => ( option.solanaAddress)), () => ( option.id)),
1489
- state: "ready"
1490
- }));
1491
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1492
- _chunkDSXMWQYBcjs.ConnectStep,
1493
- {
1494
- walletRows: withdrawRows,
1495
- onConfirmWallet: (walletId) => {
1496
- setSelectedWalletId(walletId);
1497
- setIsConnectSelectionConfirmed(true);
1498
- },
1499
- onRequestConnect,
1500
- onConnect,
1501
- onDisconnect,
1502
- title: "Withdraw",
1503
- subtitle: "Choose a wallet to continue"
1504
- }
1505
- ) });
1506
- }
1507
- if (!signerContext) return null;
1508
- if (!onSignTransaction && !signerContext.walletClient) return null;
1509
- const resolvedConnectedRecipient = _optionalChain([selectedWalletOption, 'optionalAccess', _63 => _63.kind]) === "external" ? selectedWalletOption.address : void 0;
1510
- const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkDSXMWQYBcjs.getPublicClient.call(void 0, sourceChain, rpcUrls)));
1511
1174
  const depositAddress = registration.kind === "ready" || registration.kind === "stale" ? registration.smartAccount : void 0;
1512
1175
  const stepView = deriveStepView(flowStep, registration);
1513
1176
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
1514
1177
  stepView === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1515
1178
  WithdrawFormStep,
1516
1179
  {
1517
- walletClient: signerContext.walletClient,
1518
- publicClient: formPublicClient,
1519
- connectedRecipient: resolvedConnectedRecipient,
1520
- safeAddress,
1180
+ publicClient,
1181
+ accountAddress,
1521
1182
  depositAddress,
1522
1183
  asset,
1523
1184
  defaultRecipient,
@@ -1528,8 +1189,6 @@ function WithdrawFlow({
1528
1189
  targetTokenOptions,
1529
1190
  onTargetChainChange: handleTargetChainChange,
1530
1191
  onTargetTokenChange: handleTargetTokenChange,
1531
- switchChain: signerContext.switchChain,
1532
- walletIcon: selectedWalletIcon,
1533
1192
  registrationPending: registration.kind === "pending" || registration.kind === "stale",
1534
1193
  registrationError: registration.kind === "failed" ? registration.error : null,
1535
1194
  onRecipientChange: setRecipientInput,
@@ -1555,18 +1214,18 @@ function WithdrawFlow({
1555
1214
  }
1556
1215
  ),
1557
1216
  stepView === "processing" && registration.kind !== "idle" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1558
- _chunkDSXMWQYBcjs.ProcessingStep,
1217
+ _chunkNMIMRASDcjs.ProcessingStep,
1559
1218
  {
1560
- smartAccount: registration.kind === "ready" || registration.kind === "stale" ? registration.smartAccount : "0x0",
1219
+ smartAccount: _nullishCoalesce(storeApi.getState().processingSmartAccount, () => ( (registration.kind === "ready" || registration.kind === "stale" ? registration.smartAccount : "0x0"))),
1561
1220
  txHash: _nullishCoalesce(storeApi.getState().txHash, () => ( "0x0")),
1562
1221
  sourceChain,
1563
1222
  sourceToken,
1564
- targetChain,
1565
- targetToken,
1223
+ targetChain: _nullishCoalesce(storeApi.getState().processingTargetChain, () => ( targetChain)),
1224
+ targetToken: _nullishCoalesce(storeApi.getState().processingTargetToken, () => ( targetToken)),
1566
1225
  amount: toBaseUnits(_nullishCoalesce(storeApi.getState().amount, () => ( "0")), asset.decimals),
1567
1226
  sourceSymbol: asset.symbol,
1568
1227
  sourceDecimals: asset.decimals,
1569
- directTransfer: isSameRoute,
1228
+ directTransfer: _nullishCoalesce(storeApi.getState().processingDirectTransfer, () => ( isSameRoute)),
1570
1229
  service,
1571
1230
  flowLabel: "withdraw",
1572
1231
  onClose,
@@ -1596,24 +1255,8 @@ function deriveStepView(step, _registration) {
1596
1255
 
1597
1256
  // src/WithdrawModal.tsx
1598
1257
 
1599
- var ReownWithdrawInner = _react.lazy.call(void 0,
1600
- () => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-KUWNNA2X.cjs"))).then((m) => ({
1601
- default: m.WithdrawModalReown
1602
- }))
1603
- );
1604
- function WithdrawModal(props) {
1605
- const needsReown = !!props.reownAppId;
1606
- if (needsReown) {
1607
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Suspense, { fallback: null, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ReownWithdrawInner, { ...props }) });
1608
- }
1609
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawModalInner, { ...props });
1610
- }
1611
- WithdrawModal.displayName = "WithdrawModal";
1612
- function WithdrawModalInner({
1613
- dappWalletClient,
1614
- dappPublicClient,
1615
- dappAddress,
1616
- safeAddress,
1258
+ function WithdrawModal({
1259
+ accountAddress,
1617
1260
  sourceChain: sourceChainProp,
1618
1261
  sourceToken,
1619
1262
  targetChain: targetChainProp,
@@ -1624,17 +1267,10 @@ function WithdrawModalInner({
1624
1267
  onClose,
1625
1268
  inline,
1626
1269
  closeOnOverlayClick,
1627
- allowedRoutes,
1628
- backendUrl = _chunkP5T4XSN2cjs.DEFAULT_BACKEND_URL,
1270
+ backendUrl,
1629
1271
  rpcUrls: rpcUrlsProp,
1630
- signerAddress = _chunkP5T4XSN2cjs.DEFAULT_SIGNER_ADDRESS,
1631
- sessionChainIds,
1632
1272
  forceRegister = false,
1633
- reownWallet,
1634
- onConnect,
1635
- onDisconnect,
1636
- onSignTransaction,
1637
- onRequestConnect,
1273
+ onSendTransaction,
1638
1274
  theme,
1639
1275
  uiConfig,
1640
1276
  className,
@@ -1642,38 +1278,44 @@ function WithdrawModalInner({
1642
1278
  onLifecycle,
1643
1279
  onEvent,
1644
1280
  onError,
1645
- debug
1281
+ debug,
1282
+ // Every prop 0.9.0 removed lands here, since none of them is named above.
1283
+ // `uiConfig` is destructured, so its removed nested key isn't scanned — that
1284
+ // one only ever applied to the deposit flow.
1285
+ ...removedProps
1646
1286
  }) {
1287
+ _chunkNMIMRASDcjs.warnRemovedProps.call(void 0, "WithdrawModal", removedProps);
1288
+ _chunkVN4BLZYCcjs.checkBackendUrl.call(void 0, "WithdrawModal", backendUrl);
1647
1289
  const modalRef = _react.useRef.call(void 0, null);
1648
- const onReadyRef = _chunkDSXMWQYBcjs.useLatestRef.call(void 0, onReady);
1290
+ const onReadyRef = _chunkVN4BLZYCcjs.useLatestRef.call(void 0, onReady);
1649
1291
  const [backHandler, setBackHandler] = _react.useState.call(void 0,
1650
1292
  void 0
1651
1293
  );
1652
- const targetChain = _chunkP5T4XSN2cjs.getChainId.call(void 0, targetChainProp);
1653
- const sourceChain = _chunkP5T4XSN2cjs.getChainId.call(void 0, sourceChainProp);
1654
- const rpcUrls = _chunkDSXMWQYBcjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
1294
+ const targetChain = _chunkH577RJN5cjs.getChainId.call(void 0, _nullishCoalesce(targetChainProp, () => ( sourceChainProp)));
1295
+ const sourceChain = _chunkH577RJN5cjs.getChainId.call(void 0, sourceChainProp);
1296
+ const rpcUrls = _chunkVN4BLZYCcjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
1655
1297
  const service = _react.useMemo.call(void 0,
1656
- () => _chunkDSXMWQYBcjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:withdraw" }),
1298
+ () => _chunkVN4BLZYCcjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:withdraw" }),
1657
1299
  [backendUrl, debug]
1658
1300
  );
1659
1301
  const store = _react.useMemo.call(void 0, () => createWithdrawStore(), []);
1660
- const onErrorRef = _chunkDSXMWQYBcjs.useLatestRef.call(void 0, onError);
1302
+ const onErrorRef = _chunkVN4BLZYCcjs.useLatestRef.call(void 0, onError);
1661
1303
  _react.useEffect.call(void 0, () => {
1662
- if (isOpen && onSignTransaction && !dappAddress) {
1663
- _optionalChain([onErrorRef, 'access', _64 => _64.current, 'optionalCall', _65 => _65({
1664
- message: "WithdrawModal requires `dappAddress` when `onSignTransaction` is provided.",
1665
- code: "WITHDRAW_MISSING_DAPP_ADDRESS"
1304
+ if (isOpen && typeof onSendTransaction !== "function") {
1305
+ _optionalChain([onErrorRef, 'access', _33 => _33.current, 'optionalCall', _34 => _34({
1306
+ message: "WithdrawModal requires an `onSendTransaction` function.",
1307
+ code: "WITHDRAW_MISSING_SEND_TRANSACTION"
1666
1308
  })]);
1667
1309
  }
1668
- }, [isOpen, onSignTransaction, dappAddress, onErrorRef]);
1310
+ }, [isOpen, onSendTransaction, onErrorRef]);
1669
1311
  _react.useEffect.call(void 0, () => {
1670
1312
  if (isOpen && modalRef.current) {
1671
- _chunkDSXMWQYBcjs.applyTheme.call(void 0, modalRef.current, theme);
1313
+ _chunkVN4BLZYCcjs.applyTheme.call(void 0, modalRef.current, theme);
1672
1314
  }
1673
1315
  }, [isOpen, theme]);
1674
1316
  _react.useEffect.call(void 0, () => {
1675
1317
  if (isOpen) {
1676
- _optionalChain([onReadyRef, 'access', _66 => _66.current, 'optionalCall', _67 => _67()]);
1318
+ _optionalChain([onReadyRef, 'access', _35 => _35.current, 'optionalCall', _36 => _36()]);
1677
1319
  }
1678
1320
  }, [isOpen, onReadyRef]);
1679
1321
  _react.useEffect.call(void 0, () => {
@@ -1684,10 +1326,10 @@ function WithdrawModalInner({
1684
1326
  const handleStepChange = _react.useCallback.call(void 0, (onBack) => {
1685
1327
  setBackHandler(() => onBack);
1686
1328
  }, []);
1687
- const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _68 => _68.showBackButton]), () => ( true));
1329
+ const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _37 => _37.showBackButton]), () => ( true));
1688
1330
  const canGoBack = backHandler !== void 0;
1689
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawStoreProvider, { store, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1690
- _chunkDSXMWQYBcjs.Modal,
1331
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawStoreProvider, { store, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1332
+ _chunkVN4BLZYCcjs.Modal,
1691
1333
  {
1692
1334
  isOpen,
1693
1335
  onClose,
@@ -1703,7 +1345,7 @@ function WithdrawModalInner({
1703
1345
  className: "rs-modal-header-back",
1704
1346
  "aria-label": "Go back",
1705
1347
  onClick: backHandler,
1706
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.ChevronLeftIcon, {})
1348
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.ChevronLeftIcon, {})
1707
1349
  }
1708
1350
  ) }),
1709
1351
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -1713,33 +1355,23 @@ function WithdrawModalInner({
1713
1355
  onClick: onClose,
1714
1356
  className: "rs-modal-close",
1715
1357
  "aria-label": "Close",
1716
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDSXMWQYBcjs.CloseIcon, {})
1358
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVN4BLZYCcjs.CloseIcon, {})
1717
1359
  }
1718
1360
  ) })
1719
1361
  ] }),
1720
1362
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1721
1363
  WithdrawFlow,
1722
1364
  {
1723
- dappWalletClient,
1724
- dappPublicClient,
1725
- dappAddress,
1726
- safeAddress,
1365
+ accountAddress,
1727
1366
  sourceChain,
1728
1367
  sourceToken,
1729
1368
  targetChain,
1730
- targetToken,
1369
+ targetToken: _nullishCoalesce(targetToken, () => ( sourceToken)),
1731
1370
  recipient,
1732
1371
  amount: defaultAmount,
1733
1372
  service,
1734
- allowedRoutes,
1735
- signerAddress,
1736
- sessionChainIds,
1737
1373
  forceRegister,
1738
- reownWallet,
1739
- onConnect,
1740
- onDisconnect,
1741
- onSignTransaction,
1742
- onRequestConnect,
1374
+ onSendTransaction,
1743
1375
  onStepChange: handleStepChange,
1744
1376
  onClose,
1745
1377
  onLifecycle,
@@ -1755,5 +1387,4 @@ function WithdrawModalInner({
1755
1387
 
1756
1388
 
1757
1389
 
1758
-
1759
- exports.WithdrawModal = WithdrawModal; exports.WithdrawModalInner = WithdrawModalInner;
1390
+ exports.WithdrawModal = WithdrawModal;