@rhinestone/deposit-modal 0.13.0 → 0.14.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.
- package/README.md +43 -2
- package/bridge-transcript.json +653 -0
- package/dist/ClaimModal-IKTJU43Y.cjs +13 -0
- package/dist/ClaimModal-SEKNWRMA.mjs +13 -0
- package/dist/{DepositModalReown-YNNHLAV2.cjs → DepositModalReown-46LPVFB6.cjs} +16 -15
- package/dist/{DepositModalReown-3H75G3XQ.mjs → DepositModalReown-Q2JMLT47.mjs} +6 -5
- package/dist/WithdrawModal-5ICGD4HJ.mjs +12 -0
- package/dist/WithdrawModal-VP6PMIRO.cjs +12 -0
- package/dist/{chunk-GACIGCSN.cjs → chunk-6KG642KH.cjs} +1 -1
- package/dist/{chunk-RAADLTSW.cjs → chunk-7ICSHJFE.cjs} +179 -138
- package/dist/{chunk-COCBCQQC.mjs → chunk-7SR7ENVJ.mjs} +46 -5
- package/dist/{chunk-OLCD75JK.mjs → chunk-CFKC77SV.mjs} +451 -131
- package/dist/{chunk-EOMT5LKX.mjs → chunk-IN77XSWO.mjs} +526 -3
- package/dist/{chunk-FZ5FZFIG.mjs → chunk-K4H6TGBE.mjs} +1 -1
- package/dist/{chunk-DSIZNRWA.mjs → chunk-KTUVSKR4.mjs} +979 -360
- package/dist/{chunk-HOGZKHHY.cjs → chunk-LZFRL2AL.cjs} +3 -3
- package/dist/{chunk-7N77GIP4.cjs → chunk-MTFJSE52.cjs} +465 -171
- package/dist/{chunk-LTMMETAB.mjs → chunk-PKML3XVS.mjs} +404 -110
- package/dist/{chunk-ZMT4ATHR.cjs → chunk-V2OBGLJD.cjs} +564 -41
- package/dist/{chunk-XYJFEN5D.mjs → chunk-WUJIKCFU.mjs} +1 -1
- package/dist/{chunk-CVGNCUVU.cjs → chunk-X2IPAPXU.cjs} +22 -13
- package/dist/{chunk-2G2EIN4A.cjs → chunk-YCQZJQO6.cjs} +1272 -653
- package/dist/{chunk-5NUIKYSF.cjs → chunk-YWMWI7PZ.cjs} +458 -138
- package/dist/{chunk-YREVFB64.mjs → chunk-ZEO6ADM3.mjs} +16 -7
- package/dist/claim.cjs +6 -6
- package/dist/claim.d.cts +3 -3
- package/dist/claim.d.ts +3 -3
- package/dist/claim.mjs +5 -5
- package/dist/constants.cjs +2 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +6 -6
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +5 -5
- package/dist/embed.cjs +310 -102
- package/dist/embed.d.cts +7 -1
- package/dist/embed.d.ts +7 -1
- package/dist/embed.mjs +285 -77
- package/dist/index.cjs +9 -9
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +8 -8
- package/dist/types-Bho4OA03.d.ts +982 -0
- package/dist/types-DP_3KwlD.d.cts +982 -0
- package/dist/withdraw.cjs +5 -5
- package/dist/withdraw.d.cts +3 -3
- package/dist/withdraw.d.ts +3 -3
- package/dist/withdraw.mjs +4 -4
- package/package.json +28 -7
- package/dist/ClaimModal-CREZO27I.mjs +0 -11
- package/dist/ClaimModal-JRIA32U2.cjs +0 -11
- package/dist/WithdrawModal-NVRX44IZ.mjs +0 -10
- package/dist/WithdrawModal-YYSBPCJJ.cjs +0 -10
- package/dist/types-B89I8_8H.d.ts +0 -638
- package/dist/types-nnDR4tqA.d.cts +0 -638
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var _chunkRAADLTSWcjs = require('./chunk-RAADLTSW.cjs');
|
|
8
7
|
|
|
8
|
+
var _chunk7ICSHJFEcjs = require('./chunk-7ICSHJFE.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -38,7 +38,10 @@ var _chunkRAADLTSWcjs = require('./chunk-RAADLTSW.cjs');
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
var _chunkV2OBGLJDcjs = require('./chunk-V2OBGLJD.cjs');
|
|
42
45
|
|
|
43
46
|
|
|
44
47
|
|
|
@@ -219,7 +222,7 @@ function WithdrawFormStep({
|
|
|
219
222
|
registrationError = null,
|
|
220
223
|
onRecipientChange,
|
|
221
224
|
onSubmit,
|
|
222
|
-
|
|
225
|
+
onFriction
|
|
223
226
|
}) {
|
|
224
227
|
const [recipient, setRecipient] = _react.useState.call(void 0, _nullishCoalesce(defaultRecipient, () => ( "")));
|
|
225
228
|
const [amount, setAmount] = _react.useState.call(void 0, _nullishCoalesce(defaultAmount, () => ( "")));
|
|
@@ -232,6 +235,7 @@ function WithdrawFormStep({
|
|
|
232
235
|
const chainDropdownRef = _react.useRef.call(void 0, null);
|
|
233
236
|
const tokenDropdownRef = _react.useRef.call(void 0, null);
|
|
234
237
|
const publicClientChainId = _optionalChain([publicClient, 'access', _ => _.chain, 'optionalAccess', _2 => _2.id]);
|
|
238
|
+
const onFrictionRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onFriction);
|
|
235
239
|
useClickOutside(chainDropdownRef, () => setShowChainDropdown(false));
|
|
236
240
|
useClickOutside(tokenDropdownRef, () => setShowTokenDropdown(false));
|
|
237
241
|
const targetSymbol = _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
@@ -259,7 +263,7 @@ function WithdrawFormStep({
|
|
|
259
263
|
return;
|
|
260
264
|
}
|
|
261
265
|
try {
|
|
262
|
-
const bal =
|
|
266
|
+
const bal = _chunkV2OBGLJDcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: accountAddress }) : await publicClient.readContract({
|
|
263
267
|
address: asset.token,
|
|
264
268
|
abi: _viem.erc20Abi,
|
|
265
269
|
functionName: "balanceOf",
|
|
@@ -272,6 +276,7 @@ function WithdrawFormStep({
|
|
|
272
276
|
} catch (e2) {
|
|
273
277
|
if (active) {
|
|
274
278
|
setBalance(null);
|
|
279
|
+
_optionalChain([onFrictionRef, 'access', _3 => _3.current, 'optionalCall', _4 => _4("wallet_balance_unavailable")]);
|
|
275
280
|
timeoutId = setTimeout(fetchBalance, retryDelayMs);
|
|
276
281
|
retryDelayMs = Math.min(Math.round(retryDelayMs * 1.5), 3e4);
|
|
277
282
|
}
|
|
@@ -286,7 +291,7 @@ function WithdrawFormStep({
|
|
|
286
291
|
clearTimeout(timeoutId);
|
|
287
292
|
}
|
|
288
293
|
};
|
|
289
|
-
}, [accountAddress, publicClient, publicClientChainId, asset]);
|
|
294
|
+
}, [accountAddress, publicClient, publicClientChainId, asset, onFrictionRef]);
|
|
290
295
|
const formattedBalance = _react.useMemo.call(void 0, () => {
|
|
291
296
|
if (balance === null) return "...";
|
|
292
297
|
try {
|
|
@@ -301,18 +306,9 @@ function WithdrawFormStep({
|
|
|
301
306
|
}
|
|
302
307
|
}, [balance, asset.decimals]);
|
|
303
308
|
_react.useEffect.call(void 0, () => {
|
|
304
|
-
if (
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
try {
|
|
308
|
-
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
309
|
-
const numeric = Number(raw);
|
|
310
|
-
if (!Number.isFinite(numeric)) return;
|
|
311
|
-
_optionalChain([onBalanceUsdChange, 'optionalCall', _3 => _3(numeric)]);
|
|
312
|
-
} catch (e4) {
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
}, [balance, asset.decimals, asset.symbol, onBalanceUsdChange]);
|
|
309
|
+
if (targetTokenOptions.length > 0 || !recipient || !amount) return;
|
|
310
|
+
_optionalChain([onFrictionRef, 'access', _5 => _5.current, 'optionalCall', _6 => _6("route_target_tokens_unavailable")]);
|
|
311
|
+
}, [targetTokenOptions.length, recipient, amount, onFrictionRef]);
|
|
316
312
|
const amountUsd = _react.useMemo.call(void 0, () => {
|
|
317
313
|
if (!amount) return null;
|
|
318
314
|
const parsed = Number(amount);
|
|
@@ -332,18 +328,21 @@ function WithdrawFormStep({
|
|
|
332
328
|
const handleWithdraw = _react.useCallback.call(void 0, async () => {
|
|
333
329
|
if (!recipient || !/^0x[a-fA-F0-9]{40}$/.test(recipient)) {
|
|
334
330
|
setError("Enter a valid recipient address");
|
|
331
|
+
_optionalChain([onFriction, 'optionalCall', _7 => _7("recipient_invalid")]);
|
|
335
332
|
return;
|
|
336
333
|
}
|
|
337
334
|
const lowerRecipient = recipient.toLowerCase();
|
|
338
|
-
if (lowerRecipient === accountAddress.toLowerCase() || lowerRecipient === _optionalChain([depositAddress, 'optionalAccess',
|
|
335
|
+
if (lowerRecipient === accountAddress.toLowerCase() || lowerRecipient === _optionalChain([depositAddress, 'optionalAccess', _8 => _8.toLowerCase, 'call', _9 => _9()])) {
|
|
339
336
|
setError(
|
|
340
337
|
"Recipient can't be your own account. Send to a different wallet."
|
|
341
338
|
);
|
|
339
|
+
_optionalChain([onFriction, 'optionalCall', _10 => _10("recipient_not_allowed")]);
|
|
342
340
|
return;
|
|
343
341
|
}
|
|
344
342
|
const parsed = Number(amount);
|
|
345
343
|
if (!amount || !Number.isFinite(parsed) || parsed <= 0) {
|
|
346
344
|
setError("Enter a valid amount");
|
|
345
|
+
_optionalChain([onFriction, 'optionalCall', _11 => _11("amount_invalid")]);
|
|
347
346
|
return;
|
|
348
347
|
}
|
|
349
348
|
if (balance !== null) {
|
|
@@ -351,10 +350,12 @@ function WithdrawFormStep({
|
|
|
351
350
|
const amountInUnits = _viem.parseUnits.call(void 0, amount, asset.decimals);
|
|
352
351
|
if (amountInUnits > balance) {
|
|
353
352
|
setError("Insufficient balance");
|
|
353
|
+
_optionalChain([onFriction, 'optionalCall', _12 => _12("amount_insufficient_balance")]);
|
|
354
354
|
return;
|
|
355
355
|
}
|
|
356
|
-
} catch (
|
|
356
|
+
} catch (e4) {
|
|
357
357
|
setError("Invalid amount");
|
|
358
|
+
_optionalChain([onFriction, 'optionalCall', _13 => _13("amount_invalid")]);
|
|
358
359
|
return;
|
|
359
360
|
}
|
|
360
361
|
}
|
|
@@ -364,7 +365,7 @@ function WithdrawFormStep({
|
|
|
364
365
|
await onSubmit(recipient, amount);
|
|
365
366
|
} catch (err) {
|
|
366
367
|
const raw = err instanceof Error ? err.message : "Withdrawal failed";
|
|
367
|
-
setError(
|
|
368
|
+
setError(_chunkV2OBGLJDcjs.formatUserError.call(void 0, raw));
|
|
368
369
|
} finally {
|
|
369
370
|
setIsSubmitting(false);
|
|
370
371
|
}
|
|
@@ -375,21 +376,22 @@ function WithdrawFormStep({
|
|
|
375
376
|
asset.decimals,
|
|
376
377
|
accountAddress,
|
|
377
378
|
depositAddress,
|
|
378
|
-
onSubmit
|
|
379
|
+
onSubmit,
|
|
380
|
+
onFriction
|
|
379
381
|
]);
|
|
380
382
|
if (isBalanceLoading) {
|
|
381
383
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
382
384
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-withdraw-loading", children: [
|
|
383
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
385
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Spinner, { className: "rs-spinner--lg" }),
|
|
384
386
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-title", children: "Loading on-chain balance" }),
|
|
385
387
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: "Please wait before withdrawing." })
|
|
386
388
|
] }),
|
|
387
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
389
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.PoweredBy, {})
|
|
388
390
|
] });
|
|
389
391
|
}
|
|
390
392
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
391
393
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
392
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
394
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CircleArrowOutUpLeftIcon, {}), title: "Withdraw" }),
|
|
393
395
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-section", children: [
|
|
394
396
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
395
397
|
"label",
|
|
@@ -410,7 +412,7 @@ function WithdrawFormStep({
|
|
|
410
412
|
onChange: (e) => {
|
|
411
413
|
const next = e.target.value.trim();
|
|
412
414
|
setRecipient(next);
|
|
413
|
-
_optionalChain([onRecipientChange, 'optionalCall',
|
|
415
|
+
_optionalChain([onRecipientChange, 'optionalCall', _14 => _14(next)]);
|
|
414
416
|
if (error) setError(null);
|
|
415
417
|
}
|
|
416
418
|
}
|
|
@@ -449,7 +451,7 @@ function WithdrawFormStep({
|
|
|
449
451
|
) })
|
|
450
452
|
] }),
|
|
451
453
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-amount-info", children: [
|
|
452
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? `~${
|
|
454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? `~${_chunkV2OBGLJDcjs.currencyFormatter.format(amountUsd)}` : "$0.00" }),
|
|
453
455
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
|
|
454
456
|
"Balance: ",
|
|
455
457
|
formattedBalance,
|
|
@@ -480,7 +482,7 @@ function WithdrawFormStep({
|
|
|
480
482
|
children: [
|
|
481
483
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
|
|
482
484
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
483
|
-
|
|
485
|
+
_chunkV2OBGLJDcjs.CdnIcon,
|
|
484
486
|
{
|
|
485
487
|
src: _chunk4KCSH4T3cjs.getChainIcon.call(void 0, targetChain),
|
|
486
488
|
alt: targetChainName,
|
|
@@ -490,7 +492,7 @@ function WithdrawFormStep({
|
|
|
490
492
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetChainName })
|
|
491
493
|
] }),
|
|
492
494
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
493
|
-
|
|
495
|
+
_chunkV2OBGLJDcjs.ChevronDownIcon,
|
|
494
496
|
{
|
|
495
497
|
className: "rs-withdraw-dropdown-arrow",
|
|
496
498
|
style: {
|
|
@@ -512,7 +514,7 @@ function WithdrawFormStep({
|
|
|
512
514
|
},
|
|
513
515
|
children: [
|
|
514
516
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
515
|
-
|
|
517
|
+
_chunkV2OBGLJDcjs.CdnIcon,
|
|
516
518
|
{
|
|
517
519
|
src: _chunk4KCSH4T3cjs.getChainIcon.call(void 0, chain.id),
|
|
518
520
|
alt: chain.name,
|
|
@@ -549,7 +551,7 @@ function WithdrawFormStep({
|
|
|
549
551
|
children: [
|
|
550
552
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
|
|
551
553
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
552
|
-
|
|
554
|
+
_chunkV2OBGLJDcjs.TokenIcon,
|
|
553
555
|
{
|
|
554
556
|
symbol: targetSymbol,
|
|
555
557
|
className: "rs-withdraw-dropdown-icon"
|
|
@@ -558,7 +560,7 @@ function WithdrawFormStep({
|
|
|
558
560
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetSymbol })
|
|
559
561
|
] }),
|
|
560
562
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
561
|
-
|
|
563
|
+
_chunkV2OBGLJDcjs.ChevronDownIcon,
|
|
562
564
|
{
|
|
563
565
|
className: "rs-withdraw-dropdown-arrow",
|
|
564
566
|
style: {
|
|
@@ -580,7 +582,7 @@ function WithdrawFormStep({
|
|
|
580
582
|
},
|
|
581
583
|
children: [
|
|
582
584
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
583
|
-
|
|
585
|
+
_chunkV2OBGLJDcjs.TokenIcon,
|
|
584
586
|
{
|
|
585
587
|
symbol: option.symbol,
|
|
586
588
|
className: "rs-withdraw-dropdown-icon"
|
|
@@ -596,10 +598,10 @@ function WithdrawFormStep({
|
|
|
596
598
|
)
|
|
597
599
|
] })
|
|
598
600
|
] }),
|
|
599
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
600
|
-
!error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
601
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Callout, { variant: "error", children: error }),
|
|
602
|
+
!error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Callout, { variant: "error", children: registrationError }),
|
|
601
603
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
602
|
-
|
|
604
|
+
_chunkV2OBGLJDcjs.Button,
|
|
603
605
|
{
|
|
604
606
|
onClick: handleWithdraw,
|
|
605
607
|
fullWidth: true,
|
|
@@ -614,7 +616,7 @@ function WithdrawFormStep({
|
|
|
614
616
|
}
|
|
615
617
|
)
|
|
616
618
|
] }),
|
|
617
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
619
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.PoweredBy, {})
|
|
618
620
|
] });
|
|
619
621
|
}
|
|
620
622
|
WithdrawFormStep.displayName = "WithdrawFormStep";
|
|
@@ -648,16 +650,16 @@ function WithdrawReviewStep({
|
|
|
648
650
|
const targetChainName = _chunk4KCSH4T3cjs.getChainName.call(void 0, targetChain);
|
|
649
651
|
const targetChainIcon = _chunk4KCSH4T3cjs.getChainIcon.call(void 0, targetChain);
|
|
650
652
|
const amountNumber = Number(amount);
|
|
651
|
-
const formattedSendAmount = _nullishCoalesce(
|
|
652
|
-
const prices =
|
|
653
|
+
const formattedSendAmount = _nullishCoalesce(_chunkV2OBGLJDcjs.formatTokenAmount.call(void 0, amountNumber, sourceSymbol), () => ( amount));
|
|
654
|
+
const prices = _chunk7ICSHJFEcjs.useTokenPrices.call(void 0, service, [
|
|
653
655
|
{ chainId: sourceChain, address: sourceToken, symbol: sourceSymbol },
|
|
654
656
|
{ chainId: targetChain, address: targetToken, symbol: targetSymbol }
|
|
655
657
|
]);
|
|
656
|
-
const receiveDisplay = _nullishCoalesce(
|
|
658
|
+
const receiveDisplay = _nullishCoalesce(_chunkV2OBGLJDcjs.formatReceiveEstimate.call(void 0, {
|
|
657
659
|
sourceAmount: Number.isFinite(amountNumber) ? amountNumber : void 0,
|
|
658
660
|
sourceSymbol,
|
|
659
661
|
targetSymbol,
|
|
660
|
-
sourceTrusted:
|
|
662
|
+
sourceTrusted: _chunkV2OBGLJDcjs.isRecognizedToken.call(void 0, sourceToken, sourceChain),
|
|
661
663
|
prices
|
|
662
664
|
}), () => ( // No price for the target token — an honest dash beats a wrong number.
|
|
663
665
|
"\u2014"));
|
|
@@ -669,11 +671,11 @@ function WithdrawReviewStep({
|
|
|
669
671
|
await onConfirm();
|
|
670
672
|
} catch (err) {
|
|
671
673
|
const raw = err instanceof Error ? err.message : "Withdraw failed";
|
|
672
|
-
const uncertain =
|
|
673
|
-
const message = uncertain ? "Withdrawal status is uncertain. Check your activity before trying again." :
|
|
674
|
+
const uncertain = _chunk7ICSHJFEcjs.isSubmissionUncertain.call(void 0, err);
|
|
675
|
+
const message = uncertain ? "Withdrawal status is uncertain. Check your activity before trying again." : _chunkV2OBGLJDcjs.formatUserError.call(void 0, raw);
|
|
674
676
|
if (uncertain) setSubmissionUncertain(true);
|
|
675
677
|
setError(message);
|
|
676
|
-
_optionalChain([onError, 'optionalCall',
|
|
678
|
+
_optionalChain([onError, 'optionalCall', _15 => _15(message, "WITHDRAW_REVIEW_ERROR", raw)]);
|
|
677
679
|
} finally {
|
|
678
680
|
setIsSubmitting(false);
|
|
679
681
|
}
|
|
@@ -682,9 +684,9 @@ function WithdrawReviewStep({
|
|
|
682
684
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
683
685
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
684
686
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
685
|
-
|
|
687
|
+
_chunkV2OBGLJDcjs.BodyHeader,
|
|
686
688
|
{
|
|
687
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
689
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CircleArrowOutUpLeftIcon, {}),
|
|
688
690
|
title: "Review withdrawal"
|
|
689
691
|
}
|
|
690
692
|
),
|
|
@@ -697,14 +699,14 @@ function WithdrawReviewStep({
|
|
|
697
699
|
" ",
|
|
698
700
|
sourceSymbol
|
|
699
701
|
] }),
|
|
700
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
702
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.TokenIcon, { symbol: sourceSymbol }) })
|
|
701
703
|
] })
|
|
702
704
|
] }),
|
|
703
705
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
704
706
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
705
707
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
706
708
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceChainName }),
|
|
707
|
-
sourceChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
709
|
+
sourceChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CdnIcon, { src: sourceChainIcon }) })
|
|
708
710
|
] })
|
|
709
711
|
] }),
|
|
710
712
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -715,14 +717,14 @@ function WithdrawReviewStep({
|
|
|
715
717
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Receive" }),
|
|
716
718
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
717
719
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: receiveDisplay }),
|
|
718
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
720
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.TokenIcon, { symbol: targetSymbol }) })
|
|
719
721
|
] })
|
|
720
722
|
] }),
|
|
721
723
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
722
724
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Destination chain" }),
|
|
723
725
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
724
726
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetChainName }),
|
|
725
|
-
targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
727
|
+
targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CdnIcon, { src: targetChainIcon }) })
|
|
726
728
|
] })
|
|
727
729
|
] }),
|
|
728
730
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -730,10 +732,10 @@ function WithdrawReviewStep({
|
|
|
730
732
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: estimatedTime })
|
|
731
733
|
] })
|
|
732
734
|
] }),
|
|
733
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
734
|
-
!error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
735
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Callout, { variant: "error", children: error }),
|
|
736
|
+
!error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.Callout, { variant: "error", children: registrationError }),
|
|
735
737
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
736
|
-
|
|
738
|
+
_chunkV2OBGLJDcjs.Button,
|
|
737
739
|
{
|
|
738
740
|
onClick: handleConfirm,
|
|
739
741
|
loading: isSubmitting,
|
|
@@ -744,7 +746,7 @@ function WithdrawReviewStep({
|
|
|
744
746
|
}
|
|
745
747
|
)
|
|
746
748
|
] }),
|
|
747
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
749
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.PoweredBy, {})
|
|
748
750
|
] });
|
|
749
751
|
}
|
|
750
752
|
WithdrawReviewStep.displayName = "WithdrawReviewStep";
|
|
@@ -752,12 +754,176 @@ WithdrawReviewStep.displayName = "WithdrawReviewStep";
|
|
|
752
754
|
// src/WithdrawFlow.tsx
|
|
753
755
|
|
|
754
756
|
|
|
757
|
+
// src/core/withdraw-analytics.tsx
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
function withdrawFailureReasonForError(error) {
|
|
765
|
+
if (_chunk7ICSHJFEcjs.isSubmissionUncertain.call(void 0, error)) return "submission_uncertain";
|
|
766
|
+
const message = (error instanceof Error ? error.message : String(_nullishCoalesce(error, () => ( "")))).toLowerCase();
|
|
767
|
+
if (message.includes("changed before submission")) {
|
|
768
|
+
return "registration_target_changed";
|
|
769
|
+
}
|
|
770
|
+
if (message.includes("did not return a txhash")) {
|
|
771
|
+
return "submission_missing_hash";
|
|
772
|
+
}
|
|
773
|
+
if (message.includes("reject") || message.includes("denied")) {
|
|
774
|
+
return "submission_rejected";
|
|
775
|
+
}
|
|
776
|
+
return "submission_failed";
|
|
777
|
+
}
|
|
778
|
+
function createWithdrawAnalyticsController(emit) {
|
|
779
|
+
let step = null;
|
|
780
|
+
let afterHandoff = false;
|
|
781
|
+
let sameRoute = null;
|
|
782
|
+
let opened = false;
|
|
783
|
+
let closed = false;
|
|
784
|
+
const dedupe = /* @__PURE__ */ new Set();
|
|
785
|
+
const stamp = (payload) => sameRoute === null ? payload : { ...payload, same_route: sameRoute };
|
|
786
|
+
const send = (payload) => {
|
|
787
|
+
controller.openSession();
|
|
788
|
+
emit(stamp(payload));
|
|
789
|
+
};
|
|
790
|
+
const emitOnce = (key, payload) => {
|
|
791
|
+
if (dedupe.has(key)) return;
|
|
792
|
+
dedupe.add(key);
|
|
793
|
+
send(payload);
|
|
794
|
+
};
|
|
795
|
+
const controller = {
|
|
796
|
+
openSession() {
|
|
797
|
+
if (opened) return;
|
|
798
|
+
opened = true;
|
|
799
|
+
emit({ type: "withdraw_modal_open" });
|
|
800
|
+
},
|
|
801
|
+
openStep(nextStep) {
|
|
802
|
+
controller.openSession();
|
|
803
|
+
if (step === nextStep) return;
|
|
804
|
+
step = nextStep;
|
|
805
|
+
emitOnce(`step-open:${nextStep}`, {
|
|
806
|
+
type: "withdraw_modal_step_open",
|
|
807
|
+
step: nextStep
|
|
808
|
+
});
|
|
809
|
+
},
|
|
810
|
+
completeStep(completedStep = _nullishCoalesce(step, () => ( void 0))) {
|
|
811
|
+
if (!completedStep) return;
|
|
812
|
+
emitOnce(`step-complete:${completedStep}`, {
|
|
813
|
+
type: "withdraw_modal_step_complete",
|
|
814
|
+
step: completedStep
|
|
815
|
+
});
|
|
816
|
+
},
|
|
817
|
+
friction(reason, eventStep = _nullishCoalesce(step, () => ( void 0))) {
|
|
818
|
+
if (!eventStep) return;
|
|
819
|
+
emitOnce(`friction:${eventStep}:${reason}`, {
|
|
820
|
+
type: "withdraw_modal_friction",
|
|
821
|
+
step: eventStep,
|
|
822
|
+
reason
|
|
823
|
+
});
|
|
824
|
+
},
|
|
825
|
+
failure(reason, retryable, eventStep = _nullishCoalesce(step, () => ( void 0))) {
|
|
826
|
+
if (!eventStep) return;
|
|
827
|
+
emitOnce(`failure:${eventStep}:${reason}`, {
|
|
828
|
+
type: "withdraw_modal_failure",
|
|
829
|
+
step: eventStep,
|
|
830
|
+
reason,
|
|
831
|
+
retryable
|
|
832
|
+
});
|
|
833
|
+
},
|
|
834
|
+
retry(reason, eventStep = _nullishCoalesce(step, () => ( void 0))) {
|
|
835
|
+
if (!eventStep) return;
|
|
836
|
+
send({ type: "withdraw_modal_retry", step: eventStep, reason });
|
|
837
|
+
for (const key of [...dedupe]) {
|
|
838
|
+
if (key.includes(`:${eventStep}:`)) dedupe.delete(key);
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
handoff({ transactionHash, managedAccount, sameRoute: route }, eventStep) {
|
|
842
|
+
const handoffStep = _nullishCoalesce(_nullishCoalesce(eventStep, () => ( step)), () => ( "submit"));
|
|
843
|
+
if (step !== handoffStep) controller.openStep(handoffStep);
|
|
844
|
+
sameRoute = route;
|
|
845
|
+
afterHandoff = true;
|
|
846
|
+
emitOnce(`handoff:${transactionHash}`, {
|
|
847
|
+
type: "withdraw_modal_handoff",
|
|
848
|
+
step: handoffStep,
|
|
849
|
+
transaction_hash: transactionHash,
|
|
850
|
+
managed_account: managedAccount,
|
|
851
|
+
same_route: route
|
|
852
|
+
});
|
|
853
|
+
},
|
|
854
|
+
outcome(outcome) {
|
|
855
|
+
if (!step) return;
|
|
856
|
+
emitOnce(`outcome:${outcome}`, {
|
|
857
|
+
type: "withdraw_modal_ui_outcome",
|
|
858
|
+
step,
|
|
859
|
+
outcome
|
|
860
|
+
});
|
|
861
|
+
},
|
|
862
|
+
abandon(reason) {
|
|
863
|
+
if (!step || afterHandoff) return;
|
|
864
|
+
emitOnce(`abandon:${step}:${reason}`, {
|
|
865
|
+
type: "withdraw_modal_abandoned",
|
|
866
|
+
step,
|
|
867
|
+
reason
|
|
868
|
+
});
|
|
869
|
+
},
|
|
870
|
+
close(source) {
|
|
871
|
+
if (closed) return;
|
|
872
|
+
closed = true;
|
|
873
|
+
send({
|
|
874
|
+
type: "withdraw_modal_close",
|
|
875
|
+
source,
|
|
876
|
+
step,
|
|
877
|
+
after_handoff: afterHandoff
|
|
878
|
+
});
|
|
879
|
+
},
|
|
880
|
+
/** "New withdrawal" on the terminal screen: a fresh attempt in the same
|
|
881
|
+
* session, so the envelope and its session id stay. */
|
|
882
|
+
resetAttempt() {
|
|
883
|
+
step = null;
|
|
884
|
+
afterHandoff = false;
|
|
885
|
+
sameRoute = null;
|
|
886
|
+
dedupe.clear();
|
|
887
|
+
},
|
|
888
|
+
get step() {
|
|
889
|
+
return step;
|
|
890
|
+
},
|
|
891
|
+
get afterHandoff() {
|
|
892
|
+
return afterHandoff;
|
|
893
|
+
},
|
|
894
|
+
get sameRoute() {
|
|
895
|
+
return sameRoute;
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
return controller;
|
|
899
|
+
}
|
|
900
|
+
var WithdrawAnalyticsControllerContext = _react.createContext.call(void 0, null);
|
|
901
|
+
var noopController = createWithdrawAnalyticsController(() => {
|
|
902
|
+
});
|
|
903
|
+
function WithdrawAnalyticsControllerProvider({
|
|
904
|
+
children,
|
|
905
|
+
controllerRef
|
|
906
|
+
}) {
|
|
907
|
+
const emit = _chunkV2OBGLJDcjs.useWithdrawAnalyticsEmitter.call(void 0, );
|
|
908
|
+
const controller = _react.useMemo.call(void 0,
|
|
909
|
+
() => createWithdrawAnalyticsController(emit),
|
|
910
|
+
[emit]
|
|
911
|
+
);
|
|
912
|
+
if (controllerRef) controllerRef.current = controller;
|
|
913
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawAnalyticsControllerContext.Provider, { value: controller, children });
|
|
914
|
+
}
|
|
915
|
+
function useWithdrawAnalyticsController() {
|
|
916
|
+
return _nullishCoalesce(_react.useContext.call(void 0, WithdrawAnalyticsControllerContext), () => ( noopController));
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
// src/WithdrawFlow.tsx
|
|
920
|
+
|
|
755
921
|
var ADDR_REGEX = /^0x[a-fA-F0-9]{40}$/;
|
|
756
922
|
var REGISTRATION_DEBOUNCE_MS = 600;
|
|
757
923
|
var WITHDRAW_INDEXING_DELAY_MS = 2e3;
|
|
758
924
|
function targetsEqual(a, b) {
|
|
759
925
|
if (!a) return false;
|
|
760
|
-
return a.chain === b.chain && a.token.toLowerCase() === b.token.toLowerCase() && (_nullishCoalesce(_optionalChain([a, 'access',
|
|
926
|
+
return a.chain === b.chain && a.token.toLowerCase() === b.token.toLowerCase() && (_nullishCoalesce(_optionalChain([a, 'access', _16 => _16.recipient, 'optionalAccess', _17 => _17.toLowerCase, 'call', _18 => _18()]), () => ( ""))) === (_nullishCoalesce(_optionalChain([b, 'access', _19 => _19.recipient, 'optionalAccess', _20 => _20.toLowerCase, 'call', _21 => _21()]), () => ( "")));
|
|
761
927
|
}
|
|
762
928
|
function WithdrawFlow({
|
|
763
929
|
accountAddress,
|
|
@@ -773,17 +939,19 @@ function WithdrawFlow({
|
|
|
773
939
|
onStepChange,
|
|
774
940
|
onClose,
|
|
775
941
|
onLifecycle,
|
|
776
|
-
onEvent,
|
|
777
942
|
onError,
|
|
778
943
|
debug
|
|
779
944
|
}) {
|
|
780
|
-
const rpcUrls =
|
|
781
|
-
const onStepChangeRef =
|
|
782
|
-
const
|
|
783
|
-
const onLifecycleRef =
|
|
784
|
-
const onErrorRef =
|
|
945
|
+
const rpcUrls = _chunkV2OBGLJDcjs.useRpcUrls.call(void 0, );
|
|
946
|
+
const onStepChangeRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onStepChange);
|
|
947
|
+
const analytics = useWithdrawAnalyticsController();
|
|
948
|
+
const onLifecycleRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onLifecycle);
|
|
949
|
+
const onErrorRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onError);
|
|
785
950
|
const isFlowActiveRef = _react.useRef.call(void 0, true);
|
|
786
951
|
const submitGenerationRef = _react.useRef.call(void 0, 0);
|
|
952
|
+
const lastSubmitFailureRef = _react.useRef.call(void 0,
|
|
953
|
+
null
|
|
954
|
+
);
|
|
787
955
|
_react.useEffect.call(void 0, () => {
|
|
788
956
|
isFlowActiveRef.current = true;
|
|
789
957
|
return () => {
|
|
@@ -792,13 +960,13 @@ function WithdrawFlow({
|
|
|
792
960
|
}, []);
|
|
793
961
|
const logFlow = _react.useCallback.call(void 0,
|
|
794
962
|
(message, data) => {
|
|
795
|
-
|
|
963
|
+
_chunkV2OBGLJDcjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
|
|
796
964
|
},
|
|
797
965
|
[debug]
|
|
798
966
|
);
|
|
799
967
|
const logFlowError = _react.useCallback.call(void 0,
|
|
800
968
|
(message, error, data) => {
|
|
801
|
-
|
|
969
|
+
_chunkV2OBGLJDcjs.debugError.call(void 0, debug, "withdraw-flow", message, error, data);
|
|
802
970
|
},
|
|
803
971
|
[debug]
|
|
804
972
|
);
|
|
@@ -807,7 +975,6 @@ function WithdrawFlow({
|
|
|
807
975
|
const [recipientInput, setRecipientInput] = _react.useState.call(void 0,
|
|
808
976
|
_nullishCoalesce(defaultRecipient, () => ( ""))
|
|
809
977
|
);
|
|
810
|
-
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
|
|
811
978
|
_react.useEffect.call(void 0, () => {
|
|
812
979
|
setTargetChain(targetChainProp);
|
|
813
980
|
}, [targetChainProp]);
|
|
@@ -821,7 +988,7 @@ function WithdrawFlow({
|
|
|
821
988
|
const registration = useWithdrawStore((s) => s.registration);
|
|
822
989
|
const flowStep = useWithdrawStore((s) => s.step);
|
|
823
990
|
const reviewedRecipient = useWithdrawStore((s) => s.recipient);
|
|
824
|
-
const publicClient =
|
|
991
|
+
const publicClient = _chunkV2OBGLJDcjs.useReadClient.call(void 0, sourceChain, rpcUrls);
|
|
825
992
|
const recipientForRegistration = _react.useMemo.call(void 0, () => {
|
|
826
993
|
if (!recipientInput) return void 0;
|
|
827
994
|
return ADDR_REGEX.test(recipientInput) ? recipientInput : void 0;
|
|
@@ -847,7 +1014,7 @@ function WithdrawFlow({
|
|
|
847
1014
|
targetToken,
|
|
848
1015
|
recipient: recipientForRegistration
|
|
849
1016
|
});
|
|
850
|
-
const salt =
|
|
1017
|
+
const salt = _chunk7ICSHJFEcjs.deriveAccountSalt.call(void 0, {
|
|
851
1018
|
recipient: recipientForRegistration,
|
|
852
1019
|
targetChain,
|
|
853
1020
|
targetToken
|
|
@@ -869,7 +1036,7 @@ function WithdrawFlow({
|
|
|
869
1036
|
smartAccount: evmDepositAddress,
|
|
870
1037
|
registeredTarget: desiredTarget
|
|
871
1038
|
});
|
|
872
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
1039
|
+
_optionalChain([onLifecycleRef, 'access', _22 => _22.current, 'optionalCall', _23 => _23({
|
|
873
1040
|
type: "connected",
|
|
874
1041
|
address: accountAddress,
|
|
875
1042
|
smartAccount: evmDepositAddress
|
|
@@ -877,7 +1044,7 @@ function WithdrawFlow({
|
|
|
877
1044
|
} catch (err) {
|
|
878
1045
|
if (cancelled) return;
|
|
879
1046
|
const raw = err instanceof Error ? err.message : "Registration failed";
|
|
880
|
-
const message =
|
|
1047
|
+
const message = _chunkV2OBGLJDcjs.formatUserError.call(void 0, raw);
|
|
881
1048
|
logFlowError("auto-register:failed", err, {
|
|
882
1049
|
accountAddress,
|
|
883
1050
|
targetChain,
|
|
@@ -887,7 +1054,7 @@ function WithdrawFlow({
|
|
|
887
1054
|
type: "registration/failed",
|
|
888
1055
|
error: message
|
|
889
1056
|
});
|
|
890
|
-
_optionalChain([onErrorRef, 'access',
|
|
1057
|
+
_optionalChain([onErrorRef, 'access', _24 => _24.current, 'optionalCall', _25 => _25({ message, code: "WITHDRAW_REGISTER_FAILED" })]);
|
|
891
1058
|
}
|
|
892
1059
|
}, REGISTRATION_DEBOUNCE_MS);
|
|
893
1060
|
return () => {
|
|
@@ -911,7 +1078,7 @@ function WithdrawFlow({
|
|
|
911
1078
|
const symbol = _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
|
|
912
1079
|
const decimals = _chunk4KCSH4T3cjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
|
|
913
1080
|
return {
|
|
914
|
-
id:
|
|
1081
|
+
id: _chunkV2OBGLJDcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
|
|
915
1082
|
chainId: sourceChain,
|
|
916
1083
|
token: sourceToken,
|
|
917
1084
|
symbol,
|
|
@@ -927,33 +1094,35 @@ function WithdrawFlow({
|
|
|
927
1094
|
recipient: reviewedRecipient
|
|
928
1095
|
} : null;
|
|
929
1096
|
const isReviewedTargetReady = registration.kind === "ready" && reviewedTarget !== null && targetsEqual(registration.registeredTarget, reviewedTarget);
|
|
1097
|
+
_react.useEffect.call(void 0, () => {
|
|
1098
|
+
if (flowStep !== "review") return;
|
|
1099
|
+
if (registration.kind !== "ready" || isReviewedTargetReady) return;
|
|
1100
|
+
analytics.friction("registration_stale", "review");
|
|
1101
|
+
}, [analytics, flowStep, registration.kind, isReviewedTargetReady]);
|
|
930
1102
|
const reviewBackHandler = _react.useCallback.call(void 0, () => {
|
|
931
1103
|
submitGenerationRef.current += 1;
|
|
1104
|
+
analytics.abandon("back");
|
|
932
1105
|
storeApi.dispatch({ type: "review/back" });
|
|
933
|
-
}, [storeApi]);
|
|
1106
|
+
}, [analytics, storeApi]);
|
|
934
1107
|
_react.useEffect.call(void 0, () => {
|
|
935
|
-
_optionalChain([onStepChangeRef, 'access',
|
|
1108
|
+
_optionalChain([onStepChangeRef, 'access', _26 => _26.current, 'optionalCall', _27 => _27(
|
|
936
1109
|
flowStep === "review" ? reviewBackHandler : void 0,
|
|
937
1110
|
flowStep
|
|
938
1111
|
)]);
|
|
939
1112
|
}, [flowStep, reviewBackHandler, onStepChangeRef]);
|
|
940
|
-
const lastStepOpenEventKeyRef = _react.useRef.call(void 0, null);
|
|
941
1113
|
_react.useEffect.call(void 0, () => {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1114
|
+
analytics.openSession();
|
|
1115
|
+
analytics.openStep(analyticsStepForFlowStep(flowStep));
|
|
1116
|
+
}, [analytics, flowStep]);
|
|
1117
|
+
_react.useEffect.call(void 0, () => {
|
|
1118
|
+
if (registration.kind === "pending") {
|
|
1119
|
+
analytics.friction("registration_pending");
|
|
1120
|
+
} else if (registration.kind === "stale") {
|
|
1121
|
+
analytics.friction("registration_stale");
|
|
1122
|
+
} else if (registration.kind === "failed") {
|
|
1123
|
+
analytics.failure("registration_failed", true);
|
|
945
1124
|
}
|
|
946
|
-
|
|
947
|
-
lastStepOpenEventKeyRef.current = "form";
|
|
948
|
-
const tokenSymbol = _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
949
|
-
const chainName = _chunk4KCSH4T3cjs.getChainName.call(void 0, targetChain);
|
|
950
|
-
_optionalChain([onEventRef, 'access', _20 => _20.current, 'optionalCall', _21 => _21({
|
|
951
|
-
type: "withdraw_modal_select_amount_open",
|
|
952
|
-
pred_balance: totalBalanceUsd,
|
|
953
|
-
default_token: tokenSymbol,
|
|
954
|
-
default_chain: chainName
|
|
955
|
-
})]);
|
|
956
|
-
}, [flowStep, targetToken, targetChain, totalBalanceUsd, onEventRef]);
|
|
1125
|
+
}, [analytics, registration.kind]);
|
|
957
1126
|
_react.useEffect.call(void 0, () => {
|
|
958
1127
|
logFlow("state:changed", {
|
|
959
1128
|
step: flowStep,
|
|
@@ -974,33 +1143,34 @@ function WithdrawFlow({
|
|
|
974
1143
|
]);
|
|
975
1144
|
const handleError = _react.useCallback.call(void 0,
|
|
976
1145
|
(message, code, cause) => {
|
|
1146
|
+
if (code === "PROCESS_TIMEOUT") {
|
|
1147
|
+
analytics.friction("processor_status_poll_failed", "processing");
|
|
1148
|
+
}
|
|
977
1149
|
logFlowError("flow:error", _nullishCoalesce(cause, () => ( message)), { code });
|
|
978
|
-
_optionalChain([onErrorRef, 'access',
|
|
1150
|
+
_optionalChain([onErrorRef, 'access', _28 => _28.current, 'optionalCall', _29 => _29({ message, code, cause })]);
|
|
979
1151
|
},
|
|
980
|
-
[logFlowError, onErrorRef]
|
|
1152
|
+
[analytics, logFlowError, onErrorRef]
|
|
981
1153
|
);
|
|
982
1154
|
const handleFormContinue = _react.useCallback.call(void 0,
|
|
983
1155
|
(recipient, amountValue) => {
|
|
984
|
-
|
|
985
|
-
const chainName = _chunk4KCSH4T3cjs.getChainName.call(void 0, targetChain);
|
|
986
|
-
_optionalChain([onEventRef, 'access', _24 => _24.current, 'optionalCall', _25 => _25({
|
|
987
|
-
type: "withdraw_modal_select_amount_cta_click",
|
|
988
|
-
pred_balance: totalBalanceUsd,
|
|
989
|
-
selected_token: tokenSymbol,
|
|
990
|
-
selected_chain: chainName,
|
|
991
|
-
amount: amountValue,
|
|
992
|
-
cta_name: "withdraw"
|
|
993
|
-
})]);
|
|
1156
|
+
analytics.completeStep("form");
|
|
994
1157
|
storeApi.dispatch({
|
|
995
1158
|
type: "form/continue",
|
|
996
1159
|
amount: amountValue,
|
|
997
1160
|
recipient
|
|
998
1161
|
});
|
|
999
1162
|
},
|
|
1000
|
-
[
|
|
1163
|
+
[analytics, storeApi]
|
|
1001
1164
|
);
|
|
1002
1165
|
const handleReviewConfirm = _react.useCallback.call(void 0,
|
|
1003
1166
|
async () => {
|
|
1167
|
+
const previousFailure = lastSubmitFailureRef.current;
|
|
1168
|
+
if (previousFailure) {
|
|
1169
|
+
lastSubmitFailureRef.current = null;
|
|
1170
|
+
analytics.retry(previousFailure, "submit");
|
|
1171
|
+
}
|
|
1172
|
+
analytics.completeStep("review");
|
|
1173
|
+
analytics.openStep("submit");
|
|
1004
1174
|
const state = storeApi.getState();
|
|
1005
1175
|
const recipient = state.recipient;
|
|
1006
1176
|
const amountValue = state.amount;
|
|
@@ -1018,11 +1188,13 @@ function WithdrawFlow({
|
|
|
1018
1188
|
};
|
|
1019
1189
|
const matchingRegistration = getMatchingRegistration();
|
|
1020
1190
|
if (!matchingRegistration) {
|
|
1191
|
+
analytics.failure("registration_target_changed", true, "submit");
|
|
1021
1192
|
throw new Error("Withdrawal target is still being prepared");
|
|
1022
1193
|
}
|
|
1023
1194
|
const smartAccount = matchingRegistration.smartAccount;
|
|
1024
1195
|
const lowerRecipient = recipient.toLowerCase();
|
|
1025
1196
|
if (lowerRecipient === accountAddress.toLowerCase() || lowerRecipient === smartAccount.toLowerCase()) {
|
|
1197
|
+
analytics.failure("recipient_not_allowed", false, "submit");
|
|
1026
1198
|
throw new Error(
|
|
1027
1199
|
"Recipient can't be your own account. Send to a different wallet."
|
|
1028
1200
|
);
|
|
@@ -1057,9 +1229,18 @@ function WithdrawFlow({
|
|
|
1057
1229
|
if (!getMatchingRegistration()) {
|
|
1058
1230
|
throw new Error("Withdrawal target changed before submission");
|
|
1059
1231
|
}
|
|
1060
|
-
if (!_optionalChain([result, 'optionalAccess',
|
|
1232
|
+
if (!_optionalChain([result, 'optionalAccess', _30 => _30.txHash])) {
|
|
1061
1233
|
throw new Error("onSendTransaction did not return a txHash");
|
|
1062
1234
|
}
|
|
1235
|
+
analytics.handoff(
|
|
1236
|
+
{
|
|
1237
|
+
transactionHash: result.txHash,
|
|
1238
|
+
managedAccount: smartAccount,
|
|
1239
|
+
sameRoute: isSameRoute
|
|
1240
|
+
},
|
|
1241
|
+
"submit"
|
|
1242
|
+
);
|
|
1243
|
+
analytics.completeStep("submit");
|
|
1063
1244
|
logFlow("withdraw:submitted", {
|
|
1064
1245
|
txHash: result.txHash,
|
|
1065
1246
|
smartAccount,
|
|
@@ -1067,7 +1248,7 @@ function WithdrawFlow({
|
|
|
1067
1248
|
sourceChain,
|
|
1068
1249
|
sourceToken
|
|
1069
1250
|
});
|
|
1070
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
1251
|
+
_optionalChain([onLifecycleRef, 'access', _31 => _31.current, 'optionalCall', _32 => _32({
|
|
1071
1252
|
type: "submitted",
|
|
1072
1253
|
txHash: result.txHash,
|
|
1073
1254
|
sourceChain,
|
|
@@ -1086,17 +1267,21 @@ function WithdrawFlow({
|
|
|
1086
1267
|
});
|
|
1087
1268
|
} catch (err) {
|
|
1088
1269
|
const raw = err instanceof Error ? err.message : "Withdraw failed";
|
|
1270
|
+
const reason = withdrawFailureReasonForError(err);
|
|
1271
|
+
lastSubmitFailureRef.current = reason;
|
|
1272
|
+
analytics.failure(reason, reason !== "submission_uncertain", "submit");
|
|
1089
1273
|
logFlowError("submit:failed", err, {
|
|
1090
1274
|
sourceChain,
|
|
1091
1275
|
sourceToken,
|
|
1092
1276
|
targetChain,
|
|
1093
1277
|
targetToken
|
|
1094
1278
|
});
|
|
1095
|
-
handleError(
|
|
1279
|
+
handleError(_chunkV2OBGLJDcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
|
|
1096
1280
|
throw err;
|
|
1097
1281
|
}
|
|
1098
1282
|
},
|
|
1099
1283
|
[
|
|
1284
|
+
analytics,
|
|
1100
1285
|
targetChain,
|
|
1101
1286
|
targetToken,
|
|
1102
1287
|
asset.decimals,
|
|
@@ -1114,8 +1299,10 @@ function WithdrawFlow({
|
|
|
1114
1299
|
);
|
|
1115
1300
|
const handleWithdrawComplete = _react.useCallback.call(void 0,
|
|
1116
1301
|
(txHash, destinationTxHash, context) => {
|
|
1302
|
+
analytics.openStep("processing");
|
|
1303
|
+
analytics.outcome("completed");
|
|
1117
1304
|
logFlow("withdraw:complete", { txHash, destinationTxHash, ...context });
|
|
1118
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
1305
|
+
_optionalChain([onLifecycleRef, 'access', _33 => _33.current, 'optionalCall', _34 => _34({
|
|
1119
1306
|
type: "complete",
|
|
1120
1307
|
txHash,
|
|
1121
1308
|
destinationTxHash,
|
|
@@ -1131,22 +1318,25 @@ function WithdrawFlow({
|
|
|
1131
1318
|
})]);
|
|
1132
1319
|
storeApi.dispatch({ type: "withdraw/complete" });
|
|
1133
1320
|
},
|
|
1134
|
-
[logFlow, onLifecycleRef, storeApi]
|
|
1321
|
+
[analytics, logFlow, onLifecycleRef, storeApi]
|
|
1135
1322
|
);
|
|
1136
1323
|
const handleWithdrawFailed = _react.useCallback.call(void 0,
|
|
1137
1324
|
(txHash, error) => {
|
|
1325
|
+
analytics.openStep("processing");
|
|
1326
|
+
analytics.outcome("failed");
|
|
1327
|
+
analytics.failure("processor_failed", false, "processing");
|
|
1138
1328
|
logFlowError("withdraw:failed", error, { txHash });
|
|
1139
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
1329
|
+
_optionalChain([onLifecycleRef, 'access', _35 => _35.current, 'optionalCall', _36 => _36({
|
|
1140
1330
|
type: "failed",
|
|
1141
1331
|
txHash,
|
|
1142
1332
|
error
|
|
1143
1333
|
})]);
|
|
1144
1334
|
storeApi.dispatch({ type: "withdraw/failed" });
|
|
1145
1335
|
},
|
|
1146
|
-
[logFlowError, onLifecycleRef, storeApi]
|
|
1336
|
+
[analytics, logFlowError, onLifecycleRef, storeApi]
|
|
1147
1337
|
);
|
|
1148
|
-
const targetChainOptions =
|
|
1149
|
-
const targetTokensFor =
|
|
1338
|
+
const targetChainOptions = _chunkV2OBGLJDcjs.useDestinationChains.call(void 0, );
|
|
1339
|
+
const targetTokensFor = _chunkV2OBGLJDcjs.useTargetTokens.call(void 0, );
|
|
1150
1340
|
const targetTokenOptions = _react.useMemo.call(void 0,
|
|
1151
1341
|
() => targetTokensFor(targetChain),
|
|
1152
1342
|
[targetChain, targetTokensFor]
|
|
@@ -1175,6 +1365,12 @@ function WithdrawFlow({
|
|
|
1175
1365
|
const handleTargetTokenChange = _react.useCallback.call(void 0, (token) => {
|
|
1176
1366
|
setTargetToken(token);
|
|
1177
1367
|
}, []);
|
|
1368
|
+
const handleFormFriction = _react.useCallback.call(void 0,
|
|
1369
|
+
(reason) => {
|
|
1370
|
+
analytics.friction(reason, "form");
|
|
1371
|
+
},
|
|
1372
|
+
[analytics]
|
|
1373
|
+
);
|
|
1178
1374
|
const depositAddress = registration.kind === "ready" || registration.kind === "stale" ? registration.smartAccount : void 0;
|
|
1179
1375
|
const stepView = deriveStepView(flowStep, registration);
|
|
1180
1376
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
@@ -1197,7 +1393,7 @@ function WithdrawFlow({
|
|
|
1197
1393
|
registrationError: registration.kind === "failed" ? registration.error : null,
|
|
1198
1394
|
onRecipientChange: setRecipientInput,
|
|
1199
1395
|
onSubmit: async (r, a) => handleFormContinue(r, a),
|
|
1200
|
-
|
|
1396
|
+
onFriction: handleFormFriction
|
|
1201
1397
|
}
|
|
1202
1398
|
),
|
|
1203
1399
|
stepView === "review" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1218,7 +1414,7 @@ function WithdrawFlow({
|
|
|
1218
1414
|
}
|
|
1219
1415
|
),
|
|
1220
1416
|
stepView === "processing" && registration.kind !== "idle" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1221
|
-
|
|
1417
|
+
_chunk7ICSHJFEcjs.ProcessingStep,
|
|
1222
1418
|
{
|
|
1223
1419
|
smartAccount: _nullishCoalesce(storeApi.getState().processingSmartAccount, () => ( (registration.kind === "ready" || registration.kind === "stale" ? registration.smartAccount : "0x0"))),
|
|
1224
1420
|
txHash: _nullishCoalesce(storeApi.getState().txHash, () => ( "0x0")),
|
|
@@ -1233,7 +1429,10 @@ function WithdrawFlow({
|
|
|
1233
1429
|
service,
|
|
1234
1430
|
flowLabel: "withdraw",
|
|
1235
1431
|
onClose,
|
|
1236
|
-
onNewDeposit: () =>
|
|
1432
|
+
onNewDeposit: () => {
|
|
1433
|
+
analytics.resetAttempt();
|
|
1434
|
+
storeApi.dispatch({ type: "flow/reset" });
|
|
1435
|
+
},
|
|
1237
1436
|
onDepositComplete: handleWithdrawComplete,
|
|
1238
1437
|
onDepositFailed: handleWithdrawFailed,
|
|
1239
1438
|
onError: handleError,
|
|
@@ -1245,10 +1444,17 @@ function WithdrawFlow({
|
|
|
1245
1444
|
function toBaseUnits(amount, decimals) {
|
|
1246
1445
|
try {
|
|
1247
1446
|
return _viem.parseUnits.call(void 0, amount, decimals).toString();
|
|
1248
|
-
} catch (
|
|
1447
|
+
} catch (e5) {
|
|
1249
1448
|
return "0";
|
|
1250
1449
|
}
|
|
1251
1450
|
}
|
|
1451
|
+
function analyticsStepForFlowStep(step) {
|
|
1452
|
+
if (step === "review") return "review";
|
|
1453
|
+
if (step === "processing" || step === "complete" || step === "failed") {
|
|
1454
|
+
return "processing";
|
|
1455
|
+
}
|
|
1456
|
+
return "form";
|
|
1457
|
+
}
|
|
1252
1458
|
function deriveStepView(step, _registration) {
|
|
1253
1459
|
if (step === "review") return "review";
|
|
1254
1460
|
if (step === "processing" || step === "complete" || step === "failed") {
|
|
@@ -1259,6 +1465,31 @@ function deriveStepView(step, _registration) {
|
|
|
1259
1465
|
|
|
1260
1466
|
// src/WithdrawModal.tsx
|
|
1261
1467
|
|
|
1468
|
+
function buildWithdrawAnalyticsSessionProperties({
|
|
1469
|
+
inline = false,
|
|
1470
|
+
closeOnOverlayClick = false,
|
|
1471
|
+
targetChain,
|
|
1472
|
+
targetToken,
|
|
1473
|
+
recipient,
|
|
1474
|
+
defaultAmount,
|
|
1475
|
+
seedTargetChain,
|
|
1476
|
+
seedTargetToken
|
|
1477
|
+
}) {
|
|
1478
|
+
return {
|
|
1479
|
+
presentation: inline ? "inline" : "overlay",
|
|
1480
|
+
overlay_close_enabled: !inline && closeOnOverlayClick,
|
|
1481
|
+
prefills: {
|
|
1482
|
+
target_chain: targetChain !== void 0,
|
|
1483
|
+
target_token: targetToken !== void 0,
|
|
1484
|
+
recipient: recipient !== void 0,
|
|
1485
|
+
amount: defaultAmount !== void 0
|
|
1486
|
+
},
|
|
1487
|
+
..._chunk7ICSHJFEcjs.analyticsTargetProperties.call(void 0, {
|
|
1488
|
+
targetChain: seedTargetChain,
|
|
1489
|
+
targetToken: seedTargetToken
|
|
1490
|
+
})
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1262
1493
|
function WithdrawModal({
|
|
1263
1494
|
accountAddress,
|
|
1264
1495
|
sourceChain: sourceChainProp,
|
|
@@ -1282,6 +1513,8 @@ function WithdrawModal({
|
|
|
1282
1513
|
onLifecycle,
|
|
1283
1514
|
onEvent,
|
|
1284
1515
|
onError,
|
|
1516
|
+
enableAnalyticsIngest,
|
|
1517
|
+
analyticsIngestUrl,
|
|
1285
1518
|
debug,
|
|
1286
1519
|
// Every prop 0.9.0 removed lands here, since none of them is named above.
|
|
1287
1520
|
// `uiConfig` is destructured, so its removed nested key isn't scanned — that
|
|
@@ -1291,39 +1524,73 @@ function WithdrawModal({
|
|
|
1291
1524
|
onUiState,
|
|
1292
1525
|
...removedProps
|
|
1293
1526
|
}) {
|
|
1294
|
-
|
|
1295
|
-
|
|
1527
|
+
_chunk7ICSHJFEcjs.warnRemovedProps.call(void 0, "WithdrawModal", removedProps);
|
|
1528
|
+
_chunkV2OBGLJDcjs.checkBackendUrl.call(void 0, "WithdrawModal", backendUrl);
|
|
1296
1529
|
const modalRef = _react.useRef.call(void 0, null);
|
|
1297
|
-
const onReadyRef =
|
|
1530
|
+
const onReadyRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onReady);
|
|
1531
|
+
const analyticsControllerRef = _react.useRef.call(void 0,
|
|
1532
|
+
null
|
|
1533
|
+
);
|
|
1534
|
+
const previousOpenRef = _react.useRef.call(void 0, isOpen);
|
|
1298
1535
|
const [backHandler, setBackHandler] = _react.useState.call(void 0,
|
|
1299
1536
|
void 0
|
|
1300
1537
|
);
|
|
1301
1538
|
const [screen, setScreen] = _react.useState.call(void 0, "form");
|
|
1302
|
-
const onUiStateRef =
|
|
1539
|
+
const onUiStateRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onUiState);
|
|
1303
1540
|
const targetChain = _chunk4KCSH4T3cjs.getChainId.call(void 0, _nullishCoalesce(targetChainProp, () => ( sourceChainProp)));
|
|
1304
1541
|
const sourceChain = _chunk4KCSH4T3cjs.getChainId.call(void 0, sourceChainProp);
|
|
1305
|
-
const rpcUrls =
|
|
1542
|
+
const rpcUrls = _chunkV2OBGLJDcjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
|
|
1306
1543
|
const service = _react.useMemo.call(void 0,
|
|
1307
|
-
() =>
|
|
1544
|
+
() => _chunkV2OBGLJDcjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:withdraw" }),
|
|
1308
1545
|
[backendUrl, debug]
|
|
1309
1546
|
);
|
|
1310
1547
|
const store = _react.useMemo.call(void 0, () => createWithdrawStore(), []);
|
|
1311
|
-
const onErrorRef =
|
|
1548
|
+
const onErrorRef = _chunkV2OBGLJDcjs.useLatestRef.call(void 0, onError);
|
|
1312
1549
|
_react.useEffect.call(void 0, () => {
|
|
1313
1550
|
if (isOpen && typeof onSendTransaction !== "function") {
|
|
1314
|
-
_optionalChain([onErrorRef, 'access',
|
|
1551
|
+
_optionalChain([onErrorRef, 'access', _37 => _37.current, 'optionalCall', _38 => _38({
|
|
1315
1552
|
message: "WithdrawModal requires an `onSendTransaction` function.",
|
|
1316
1553
|
code: "WITHDRAW_MISSING_SEND_TRANSACTION"
|
|
1317
1554
|
})]);
|
|
1555
|
+
_optionalChain([analyticsControllerRef, 'access', _39 => _39.current, 'optionalAccess', _40 => _40.failure, 'call', _41 => _41(
|
|
1556
|
+
"submission_handler_missing",
|
|
1557
|
+
false,
|
|
1558
|
+
"form"
|
|
1559
|
+
)]);
|
|
1318
1560
|
}
|
|
1319
1561
|
}, [isOpen, onSendTransaction, onErrorRef]);
|
|
1562
|
+
const closeWithSource = _react.useCallback.call(void 0,
|
|
1563
|
+
(source) => {
|
|
1564
|
+
const analytics = analyticsControllerRef.current;
|
|
1565
|
+
_optionalChain([analytics, 'optionalAccess', _42 => _42.abandon, 'call', _43 => _43("modal_close")]);
|
|
1566
|
+
_optionalChain([analytics, 'optionalAccess', _44 => _44.close, 'call', _45 => _45(source)]);
|
|
1567
|
+
onClose();
|
|
1568
|
+
},
|
|
1569
|
+
[onClose]
|
|
1570
|
+
);
|
|
1571
|
+
const handleModalDismiss = _react.useCallback.call(void 0,
|
|
1572
|
+
(reason) => {
|
|
1573
|
+
closeWithSource(
|
|
1574
|
+
reason === "escape" ? "escape" : reason === "overlay" ? "overlay" : "header_button"
|
|
1575
|
+
);
|
|
1576
|
+
},
|
|
1577
|
+
[closeWithSource]
|
|
1578
|
+
);
|
|
1579
|
+
_react.useEffect.call(void 0, () => {
|
|
1580
|
+
if (previousOpenRef.current && !isOpen) {
|
|
1581
|
+
const analytics = analyticsControllerRef.current;
|
|
1582
|
+
_optionalChain([analytics, 'optionalAccess', _46 => _46.abandon, 'call', _47 => _47("modal_close")]);
|
|
1583
|
+
_optionalChain([analytics, 'optionalAccess', _48 => _48.close, 'call', _49 => _49("host_controlled")]);
|
|
1584
|
+
}
|
|
1585
|
+
previousOpenRef.current = isOpen;
|
|
1586
|
+
}, [isOpen]);
|
|
1320
1587
|
_react.useEffect.call(void 0, () => {
|
|
1321
1588
|
if (!isOpen || !modalRef.current) return;
|
|
1322
|
-
return
|
|
1589
|
+
return _chunkV2OBGLJDcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
1323
1590
|
}, [isOpen, theme]);
|
|
1324
1591
|
_react.useEffect.call(void 0, () => {
|
|
1325
1592
|
if (isOpen) {
|
|
1326
|
-
_optionalChain([onReadyRef, 'access',
|
|
1593
|
+
_optionalChain([onReadyRef, 'access', _50 => _50.current, 'optionalCall', _51 => _51()]);
|
|
1327
1594
|
}
|
|
1328
1595
|
}, [isOpen, onReadyRef]);
|
|
1329
1596
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1336,71 +1603,98 @@ function WithdrawModal({
|
|
|
1336
1603
|
if (next) setScreen(next);
|
|
1337
1604
|
}, []);
|
|
1338
1605
|
_react.useEffect.call(void 0, () => {
|
|
1339
|
-
_optionalChain([onUiStateRef, 'access',
|
|
1606
|
+
_optionalChain([onUiStateRef, 'access', _52 => _52.current, 'optionalCall', _53 => _53({
|
|
1340
1607
|
screen,
|
|
1341
1608
|
back: backHandler,
|
|
1342
1609
|
submitting: false
|
|
1343
1610
|
})]);
|
|
1344
1611
|
}, [screen, backHandler, onUiStateRef]);
|
|
1345
|
-
const
|
|
1612
|
+
const analyticsSessionProperties = buildWithdrawAnalyticsSessionProperties({
|
|
1613
|
+
inline,
|
|
1614
|
+
closeOnOverlayClick,
|
|
1615
|
+
targetChain: targetChainProp,
|
|
1616
|
+
targetToken,
|
|
1617
|
+
recipient,
|
|
1618
|
+
defaultAmount,
|
|
1619
|
+
seedTargetChain: targetChain,
|
|
1620
|
+
seedTargetToken: _nullishCoalesce(targetToken, () => ( sourceToken))
|
|
1621
|
+
});
|
|
1622
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _54 => _54.showBackButton]), () => ( true));
|
|
1346
1623
|
const canGoBack = backHandler !== void 0;
|
|
1347
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1348
|
-
|
|
1624
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawStoreProvider, { store, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1625
|
+
_chunkV2OBGLJDcjs.Modal,
|
|
1349
1626
|
{
|
|
1350
1627
|
isOpen,
|
|
1351
|
-
onClose,
|
|
1628
|
+
onClose: handleModalDismiss,
|
|
1352
1629
|
className,
|
|
1353
1630
|
inline,
|
|
1354
1631
|
closeOnOverlayClick,
|
|
1355
|
-
children: /* @__PURE__ */ _jsxruntime.
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
) }),
|
|
1367
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1368
|
-
"button",
|
|
1632
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1633
|
+
_chunkV2OBGLJDcjs.AnalyticsSession,
|
|
1634
|
+
{
|
|
1635
|
+
modal: "withdraw",
|
|
1636
|
+
sessionProperties: analyticsSessionProperties,
|
|
1637
|
+
onEvent,
|
|
1638
|
+
backendUrl,
|
|
1639
|
+
enableIngest: enableAnalyticsIngest,
|
|
1640
|
+
ingestUrl: analyticsIngestUrl,
|
|
1641
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1642
|
+
WithdrawAnalyticsControllerProvider,
|
|
1369
1643
|
{
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1644
|
+
controllerRef: analyticsControllerRef,
|
|
1645
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: modalRef, className: "rs-modal", children: [
|
|
1646
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header--redesigned", children: [
|
|
1647
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1648
|
+
"button",
|
|
1649
|
+
{
|
|
1650
|
+
type: "button",
|
|
1651
|
+
className: "rs-modal-header-back",
|
|
1652
|
+
"aria-label": "Go back",
|
|
1653
|
+
onClick: backHandler,
|
|
1654
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.ChevronLeftIcon, {})
|
|
1655
|
+
}
|
|
1656
|
+
) }),
|
|
1657
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1658
|
+
"button",
|
|
1659
|
+
{
|
|
1660
|
+
type: "button",
|
|
1661
|
+
onClick: () => closeWithSource("header_button"),
|
|
1662
|
+
className: "rs-modal-close",
|
|
1663
|
+
"aria-label": "Close",
|
|
1664
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV2OBGLJDcjs.CloseIcon, {})
|
|
1665
|
+
}
|
|
1666
|
+
) })
|
|
1667
|
+
] }),
|
|
1668
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1669
|
+
WithdrawFlow,
|
|
1670
|
+
{
|
|
1671
|
+
accountAddress,
|
|
1672
|
+
sourceChain,
|
|
1673
|
+
sourceToken,
|
|
1674
|
+
targetChain,
|
|
1675
|
+
targetToken: _nullishCoalesce(targetToken, () => ( sourceToken)),
|
|
1676
|
+
recipient,
|
|
1677
|
+
amount: defaultAmount,
|
|
1678
|
+
service,
|
|
1679
|
+
forceRegister,
|
|
1680
|
+
onSendTransaction,
|
|
1681
|
+
onStepChange: handleStepChange,
|
|
1682
|
+
onClose: closeWithSource,
|
|
1683
|
+
onLifecycle,
|
|
1684
|
+
onError,
|
|
1685
|
+
debug
|
|
1686
|
+
}
|
|
1687
|
+
)
|
|
1688
|
+
] })
|
|
1375
1689
|
}
|
|
1376
|
-
)
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
WithdrawFlow,
|
|
1380
|
-
{
|
|
1381
|
-
accountAddress,
|
|
1382
|
-
sourceChain,
|
|
1383
|
-
sourceToken,
|
|
1384
|
-
targetChain,
|
|
1385
|
-
targetToken: _nullishCoalesce(targetToken, () => ( sourceToken)),
|
|
1386
|
-
recipient,
|
|
1387
|
-
amount: defaultAmount,
|
|
1388
|
-
service,
|
|
1389
|
-
forceRegister,
|
|
1390
|
-
onSendTransaction,
|
|
1391
|
-
onStepChange: handleStepChange,
|
|
1392
|
-
onClose,
|
|
1393
|
-
onLifecycle,
|
|
1394
|
-
onEvent,
|
|
1395
|
-
onError,
|
|
1396
|
-
debug
|
|
1397
|
-
}
|
|
1398
|
-
)
|
|
1399
|
-
] })
|
|
1690
|
+
)
|
|
1691
|
+
}
|
|
1692
|
+
)
|
|
1400
1693
|
}
|
|
1401
1694
|
) }) }) });
|
|
1402
1695
|
}
|
|
1403
1696
|
|
|
1404
1697
|
|
|
1405
1698
|
|
|
1406
|
-
|
|
1699
|
+
|
|
1700
|
+
exports.buildWithdrawAnalyticsSessionProperties = buildWithdrawAnalyticsSessionProperties; exports.WithdrawModal = WithdrawModal;
|