@rhinestone/deposit-modal 0.1.65 → 0.1.67
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/dist/{DepositModalReown-Y4M3RA73.mjs → DepositModalReown-EYIV6APK.mjs} +3 -3
- package/dist/{DepositModalReown-6ZMLUWWD.cjs → DepositModalReown-UPYZN2XA.cjs} +4 -4
- package/dist/{WithdrawModalReown-HVBMAUPM.mjs → WithdrawModalReown-6VYKKKJN.mjs} +3 -3
- package/dist/{WithdrawModalReown-WJ5SHBV4.cjs → WithdrawModalReown-WHPQDJJJ.cjs} +4 -4
- package/dist/{chunk-RKRF7ANK.mjs → chunk-5FDIQNJJ.mjs} +22 -19
- package/dist/{chunk-4CZ7W3RS.cjs → chunk-FLVSQDP4.cjs} +181 -132
- package/dist/{chunk-GAHX5RAT.mjs → chunk-IUW3SJQT.mjs} +103 -54
- package/dist/{chunk-MGV75YLV.cjs → chunk-LTLFJPHO.cjs} +106 -103
- package/dist/{chunk-R6U6BHCV.cjs → chunk-MUWVDVY4.cjs} +13 -1
- package/dist/{chunk-IYZGLNY6.mjs → chunk-NFE5ZLD3.mjs} +1171 -374
- package/dist/{chunk-CIXHTOO3.mjs → chunk-SDZKKUCJ.mjs} +13 -1
- package/dist/{chunk-OWV4KVBM.cjs → chunk-UDKZWFCM.cjs} +1251 -454
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/reown.cjs +5 -5
- package/dist/reown.d.cts +1 -1
- package/dist/reown.d.ts +1 -1
- package/dist/reown.mjs +4 -4
- package/dist/styles.css +696 -34
- package/dist/{types-BLIqLF0c.d.ts → types-DGQzvl6v.d.ts} +12 -1
- package/dist/{types-7IoN8k-P.d.cts → types-DJ1fzNC7.d.cts} +12 -1
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +3 -3
- package/package.json +5 -5
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkMUWVDVY4cjs = require('./chunk-MUWVDVY4.cjs');
|
|
12
12
|
|
|
13
13
|
// src/components/ui/Modal.tsx
|
|
14
14
|
|
|
@@ -595,21 +595,61 @@ function createDepositService(baseUrl, options) {
|
|
|
595
595
|
txHash: _optionalChain([result, 'optionalAccess', _15 => _15.txHash]) ? shortRef(result.txHash) : void 0
|
|
596
596
|
});
|
|
597
597
|
return result;
|
|
598
|
+
},
|
|
599
|
+
async fetchDepositHistory(params) {
|
|
600
|
+
const searchParams = new URLSearchParams({ account: params.account });
|
|
601
|
+
searchParams.set("limit", String(_nullishCoalesce(params.limit, () => ( 20))));
|
|
602
|
+
if (params.cursor) {
|
|
603
|
+
searchParams.set("cursor", params.cursor);
|
|
604
|
+
}
|
|
605
|
+
const url = apiUrl(`/deposits?${searchParams.toString()}`);
|
|
606
|
+
debugLog(debug, scope, "fetchDepositHistory:request", {
|
|
607
|
+
url,
|
|
608
|
+
account: shortRef(params.account),
|
|
609
|
+
cursor: params.cursor
|
|
610
|
+
});
|
|
611
|
+
const response = await fetch(url, {
|
|
612
|
+
method: "GET",
|
|
613
|
+
headers: { "Content-Type": "application/json" },
|
|
614
|
+
cache: "no-store"
|
|
615
|
+
});
|
|
616
|
+
if (!response.ok) {
|
|
617
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
618
|
+
debugError(
|
|
619
|
+
debug,
|
|
620
|
+
scope,
|
|
621
|
+
"fetchDepositHistory:failed",
|
|
622
|
+
error,
|
|
623
|
+
{ status: response.status, account: shortRef(params.account) }
|
|
624
|
+
);
|
|
625
|
+
throw new Error(
|
|
626
|
+
error.error || `Deposit history fetch failed: ${response.status}`
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
const data = await response.json();
|
|
630
|
+
const deposits = Array.isArray(_optionalChain([data, 'optionalAccess', _16 => _16.deposits])) ? data.deposits : [];
|
|
631
|
+
const nextCursor = _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _17 => _17.nextCursor]), () => ( _optionalChain([data, 'optionalAccess', _18 => _18.next_cursor]))), () => ( null));
|
|
632
|
+
debugLog(debug, scope, "fetchDepositHistory:success", {
|
|
633
|
+
account: shortRef(params.account),
|
|
634
|
+
count: deposits.length,
|
|
635
|
+
hasMore: Boolean(nextCursor)
|
|
636
|
+
});
|
|
637
|
+
return { deposits, nextCursor };
|
|
598
638
|
}
|
|
599
639
|
};
|
|
600
640
|
}
|
|
601
641
|
function normalizeDirectPortfolio(data) {
|
|
602
642
|
const rawTokens = _nullishCoalesce(_nullishCoalesce(extractArray(data, "tokens"), () => ( extractArray(
|
|
603
|
-
_optionalChain([data, 'optionalAccess',
|
|
643
|
+
_optionalChain([data, 'optionalAccess', _19 => _19.data]),
|
|
604
644
|
"tokens"
|
|
605
645
|
))), () => ( []));
|
|
606
|
-
const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess',
|
|
646
|
+
const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess', _20 => _20.data]), "totalUsd"))), () => ( 0));
|
|
607
647
|
const tokens = rawTokens.map((token) => normalizeDirectToken(token)).filter((token) => Boolean(token));
|
|
608
648
|
return { tokens, totalUsd };
|
|
609
649
|
}
|
|
610
650
|
function extractOrchestratorPortfolio(data) {
|
|
611
651
|
const portfolio = _nullishCoalesce(extractArray(data, "portfolio"), () => ( extractArray(
|
|
612
|
-
_optionalChain([data, 'optionalAccess',
|
|
652
|
+
_optionalChain([data, 'optionalAccess', _21 => _21.data]),
|
|
613
653
|
"portfolio"
|
|
614
654
|
)));
|
|
615
655
|
if (!portfolio || !Array.isArray(portfolio)) return null;
|
|
@@ -620,17 +660,17 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
620
660
|
for (const tokenData of data.portfolio || []) {
|
|
621
661
|
const chainBalances = _nullishCoalesce(_nullishCoalesce(tokenData.tokenChainBalance, () => ( tokenData.chainBalances)), () => ( []));
|
|
622
662
|
for (const chainBalance of chainBalances) {
|
|
623
|
-
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access',
|
|
663
|
+
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _22 => _22.balance, 'optionalAccess', _23 => _23.unlocked]), () => ( "0"));
|
|
624
664
|
const normalizedName = tokenData.tokenName.trim();
|
|
625
665
|
const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
|
|
626
|
-
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => (
|
|
627
|
-
const resolvedTokenAddress = isNativeSymbol ?
|
|
666
|
+
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => ( _chunkMUWVDVY4cjs.getTokenAddress.call(void 0, tokenData.tokenName, chainBalance.chainId)));
|
|
667
|
+
const resolvedTokenAddress = isNativeSymbol ? _chunkMUWVDVY4cjs.NATIVE_TOKEN_ADDRESS : tokenAddress;
|
|
628
668
|
if (!resolvedTokenAddress) {
|
|
629
669
|
continue;
|
|
630
670
|
}
|
|
631
|
-
const registrySymbol =
|
|
671
|
+
const registrySymbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, resolvedTokenAddress, chainBalance.chainId);
|
|
632
672
|
const symbol = registrySymbol !== "Token" ? registrySymbol : normalizedName || "Token";
|
|
633
|
-
const decimals = registrySymbol !== "Token" ?
|
|
673
|
+
const decimals = registrySymbol !== "Token" ? _chunkMUWVDVY4cjs.getTokenDecimalsByAddress.call(void 0, resolvedTokenAddress, chainBalance.chainId) : _nullishCoalesce(tokenData.tokenDecimals, () => ( 18));
|
|
634
674
|
tokens.push({
|
|
635
675
|
chainId: chainBalance.chainId,
|
|
636
676
|
address: resolvedTokenAddress,
|
|
@@ -654,19 +694,19 @@ function normalizeDirectToken(token) {
|
|
|
654
694
|
if (chainId === null) return null;
|
|
655
695
|
const symbol = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "symbol"), () => ( extractString(token, "tokenSymbol"))), () => ( extractString(token, "tokenName"))), () => ( extractString(token, "name")));
|
|
656
696
|
if (!symbol) return null;
|
|
657
|
-
const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call',
|
|
697
|
+
const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call', _24 => _24(token, "balance"), 'optionalAccess', _25 => _25.toString, 'call', _26 => _26()]))), () => ( _optionalChain([extractNumber, 'call', _27 => _27(token, "amount"), 'optionalAccess', _28 => _28.toString, 'call', _29 => _29()]))), () => ( _optionalChain([extractNumber, 'call', _30 => _30(token, "value"), 'optionalAccess', _31 => _31.toString, 'call', _32 => _32()]))), () => ( _optionalChain([extractNumber, 'call', _33 => _33(token, "rawBalance"), 'optionalAccess', _34 => _34.toString, 'call', _35 => _35()])));
|
|
658
698
|
if (!balanceValue) return null;
|
|
659
699
|
const address = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "address"), () => ( extractString(token, "tokenAddress"))), () => ( extractString(
|
|
660
700
|
token.token,
|
|
661
701
|
"address"
|
|
662
|
-
))), () => ( (typeof chainId === "number" ?
|
|
702
|
+
))), () => ( (typeof chainId === "number" ? _chunkMUWVDVY4cjs.getTokenAddress.call(void 0, symbol, chainId) : void 0)));
|
|
663
703
|
if (!address) return null;
|
|
664
704
|
const balanceUsd = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractNumber(token, "balanceUsd"), () => ( extractNumber(token, "usdValue"))), () => ( extractNumber(token, "valueUsd"))), () => ( extractNumericString(token, "balanceUsd"))), () => ( extractNumericString(token, "usdValue"))), () => ( extractNumericString(token, "valueUsd"))), () => ( 0));
|
|
665
705
|
const isSolanaToken = chainId === "solana";
|
|
666
|
-
const registrySymbol = isSolanaToken ? "Token" :
|
|
706
|
+
const registrySymbol = isSolanaToken ? "Token" : _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, address, chainId);
|
|
667
707
|
const resolvedSymbol = isSolanaToken ? symbol : registrySymbol !== "Token" ? registrySymbol : symbol;
|
|
668
708
|
const backendDecimals = _nullishCoalesce(extractNumber(token, "decimals"), () => ( extractNumber(token, "tokenDecimals")));
|
|
669
|
-
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ?
|
|
709
|
+
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ? _chunkMUWVDVY4cjs.getTokenDecimalsByAddress.call(void 0, address, chainId) : _nullishCoalesce(backendDecimals, () => ( 18));
|
|
670
710
|
return {
|
|
671
711
|
chainId,
|
|
672
712
|
address,
|
|
@@ -679,7 +719,7 @@ function normalizeDirectToken(token) {
|
|
|
679
719
|
}
|
|
680
720
|
function extractTokenAddress(tokenData, chainId) {
|
|
681
721
|
const token = tokenData;
|
|
682
|
-
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access',
|
|
722
|
+
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access', _36 => _36.addresses, 'optionalAccess', _37 => _37[chainId]]))), () => ( _optionalChain([token, 'access', _38 => _38.token, 'optionalAccess', _39 => _39.address]))), () => ( _optionalChain([token, 'access', _40 => _40.token, 'optionalAccess', _41 => _41.addresses, 'optionalAccess', _42 => _42[chainId]])));
|
|
683
723
|
}
|
|
684
724
|
function extractArray(data, key) {
|
|
685
725
|
if (!data || typeof data !== "object") return null;
|
|
@@ -837,19 +877,19 @@ function setVar(targets, prop, value) {
|
|
|
837
877
|
function applyTheme(element, theme) {
|
|
838
878
|
if (!element) return;
|
|
839
879
|
const parent = element.parentElement;
|
|
840
|
-
const targets = _optionalChain([parent, 'optionalAccess',
|
|
841
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
880
|
+
const targets = _optionalChain([parent, 'optionalAccess', _43 => _43.classList, 'access', _44 => _44.contains, 'call', _45 => _45("rs-modal-content")]) ? [element, parent] : [element];
|
|
881
|
+
if (_optionalChain([theme, 'optionalAccess', _46 => _46.mode])) {
|
|
842
882
|
element.setAttribute("data-theme", theme.mode);
|
|
843
883
|
} else {
|
|
844
884
|
element.removeAttribute("data-theme");
|
|
845
885
|
}
|
|
846
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
886
|
+
if (_optionalChain([theme, 'optionalAccess', _47 => _47.fontColor])) {
|
|
847
887
|
setVar(targets, "--rs-foreground", theme.fontColor);
|
|
848
888
|
}
|
|
849
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
889
|
+
if (_optionalChain([theme, 'optionalAccess', _48 => _48.iconColor])) {
|
|
850
890
|
setVar(targets, "--rs-icon", theme.iconColor);
|
|
851
891
|
}
|
|
852
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
892
|
+
if (_optionalChain([theme, 'optionalAccess', _49 => _49.ctaColor])) {
|
|
853
893
|
setVar(targets, "--rs-primary", theme.ctaColor);
|
|
854
894
|
setVar(targets, "--rs-border-accent", theme.ctaColor);
|
|
855
895
|
setVar(
|
|
@@ -857,17 +897,17 @@ function applyTheme(element, theme) {
|
|
|
857
897
|
"--rs-primary-hover",
|
|
858
898
|
_nullishCoalesce(theme.ctaHoverColor, () => ( theme.ctaColor))
|
|
859
899
|
);
|
|
860
|
-
} else if (_optionalChain([theme, 'optionalAccess',
|
|
900
|
+
} else if (_optionalChain([theme, 'optionalAccess', _50 => _50.ctaHoverColor])) {
|
|
861
901
|
setVar(targets, "--rs-primary-hover", theme.ctaHoverColor);
|
|
862
902
|
}
|
|
863
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
903
|
+
if (_optionalChain([theme, 'optionalAccess', _51 => _51.borderColor])) {
|
|
864
904
|
setVar(targets, "--rs-border", theme.borderColor);
|
|
865
905
|
setVar(targets, "--rs-border-surface", theme.borderColor);
|
|
866
906
|
}
|
|
867
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
907
|
+
if (_optionalChain([theme, 'optionalAccess', _52 => _52.backgroundColor])) {
|
|
868
908
|
setVar(targets, "--rs-background", theme.backgroundColor);
|
|
869
909
|
}
|
|
870
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
910
|
+
if (_optionalChain([theme, 'optionalAccess', _53 => _53.radius])) {
|
|
871
911
|
const scale = RADIUS_SCALE[theme.radius];
|
|
872
912
|
setVar(targets, "--rs-radius-sm", scale.sm);
|
|
873
913
|
setVar(targets, "--rs-radius-md", scale.md);
|
|
@@ -983,13 +1023,14 @@ function ExternalLinkIcon() {
|
|
|
983
1023
|
] });
|
|
984
1024
|
}
|
|
985
1025
|
function TransferIcon() {
|
|
986
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { viewBox: "0 0
|
|
1026
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
987
1027
|
"path",
|
|
988
1028
|
{
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1029
|
+
d: "M6.18056 9.99924H10V13.8187M3.13264 9.99924H3.125M6.95208 13.8187H6.94444M10.0076 16.8742H10M16.8826 9.99924H16.875M3.125 13.8187H4.27083M12.6736 9.99924H14.2014M3.125 16.8742H6.94444M10 2.36035V6.94369M14.2778 16.8742H15.6528C16.0806 16.8742 16.2945 16.8742 16.4579 16.791C16.6016 16.7177 16.7185 16.6009 16.7917 16.4572C16.875 16.2937 16.875 16.0798 16.875 15.652V14.277C16.875 13.8492 16.875 13.6353 16.7917 13.4719C16.7185 13.3282 16.6016 13.2113 16.4579 13.1381C16.2945 13.0548 16.0806 13.0548 15.6528 13.0548H14.2778C13.85 13.0548 13.6361 13.0548 13.4726 13.1381C13.3289 13.2113 13.2121 13.3282 13.1388 13.4719C13.0556 13.6353 13.0556 13.8492 13.0556 14.277V15.652C13.0556 16.0798 13.0556 16.2937 13.1388 16.4572C13.2121 16.6009 13.3289 16.7177 13.4726 16.791C13.6361 16.8742 13.85 16.8742 14.2778 16.8742ZM14.2778 6.94369H15.6528C16.0806 6.94369 16.2945 6.94369 16.4579 6.86043C16.6016 6.78719 16.7185 6.67033 16.7917 6.52659C16.875 6.36319 16.875 6.14928 16.875 5.72146V4.34646C16.875 3.91864 16.875 3.70474 16.7917 3.54133C16.7185 3.3976 16.6016 3.28074 16.4579 3.2075C16.2945 3.12424 16.0806 3.12424 15.6528 3.12424H14.2778C13.85 3.12424 13.6361 3.12424 13.4726 3.2075C13.3289 3.28074 13.2121 3.3976 13.1388 3.54133C13.0556 3.70474 13.0556 3.91864 13.0556 4.34646V5.72146C13.0556 6.14928 13.0556 6.36319 13.1388 6.52659C13.2121 6.67033 13.3289 6.78719 13.4726 6.86043C13.6361 6.94369 13.85 6.94369 14.2778 6.94369ZM4.34722 6.94369H5.72222C6.15004 6.94369 6.36395 6.94369 6.52735 6.86043C6.67109 6.78719 6.78795 6.67033 6.86119 6.52659C6.94444 6.36319 6.94444 6.14928 6.94444 5.72146V4.34646C6.94444 3.91864 6.94444 3.70474 6.86119 3.54133C6.78795 3.3976 6.67109 3.28074 6.52735 3.2075C6.36395 3.12424 6.15004 3.12424 5.72222 3.12424H4.34722C3.9194 3.12424 3.7055 3.12424 3.54209 3.2075C3.39836 3.28074 3.2815 3.3976 3.20826 3.54133C3.125 3.70474 3.125 3.91864 3.125 4.34646V5.72146C3.125 6.14928 3.125 6.36319 3.20826 6.52659C3.2815 6.67033 3.39836 6.78719 3.54209 6.86043C3.7055 6.94369 3.9194 6.94369 4.34722 6.94369Z",
|
|
1030
|
+
stroke: "currentColor",
|
|
1031
|
+
strokeWidth: "1.5",
|
|
1032
|
+
strokeLinecap: "round",
|
|
1033
|
+
strokeLinejoin: "round"
|
|
993
1034
|
}
|
|
994
1035
|
) });
|
|
995
1036
|
}
|
|
@@ -1033,16 +1074,16 @@ function ConnectStep({
|
|
|
1033
1074
|
continueButtonLabel = "Continue",
|
|
1034
1075
|
connectButtonLabel = "Connect external wallet"
|
|
1035
1076
|
}) {
|
|
1036
|
-
const hasWalletOptions = (_nullishCoalesce(_optionalChain([walletOptions, 'optionalAccess',
|
|
1077
|
+
const hasWalletOptions = (_nullishCoalesce(_optionalChain([walletOptions, 'optionalAccess', _54 => _54.length]), () => ( 0))) > 0;
|
|
1037
1078
|
if (hasWalletOptions) {
|
|
1038
|
-
const hasReownWallet = _nullishCoalesce(_optionalChain([walletOptions, 'optionalAccess',
|
|
1079
|
+
const hasReownWallet = _nullishCoalesce(_optionalChain([walletOptions, 'optionalAccess', _55 => _55.some, 'call', _56 => _56(
|
|
1039
1080
|
(option) => option.kind === "external" || option.kind === "solana"
|
|
1040
1081
|
)]), () => ( false));
|
|
1041
1082
|
const showConnectDifferentWalletOption = Boolean(onConnect) && !hasReownWallet;
|
|
1042
1083
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
1043
1084
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-connect-centered rs-connect-centered--wallets", children: [
|
|
1044
1085
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-connect-wallet-list", children: [
|
|
1045
|
-
_optionalChain([walletOptions, 'optionalAccess',
|
|
1086
|
+
_optionalChain([walletOptions, 'optionalAccess', _57 => _57.map, 'call', _58 => _58((option) => {
|
|
1046
1087
|
const isSelected = option.id === selectedWalletId;
|
|
1047
1088
|
const rawAddress = _nullishCoalesce(_nullishCoalesce(option.address, () => ( option.solanaAddress)), () => ( option.id));
|
|
1048
1089
|
const shortAddress = rawAddress.length > 12 ? `${rawAddress.slice(0, 6)}...${rawAddress.slice(-4)}` : rawAddress;
|
|
@@ -1051,7 +1092,7 @@ function ConnectStep({
|
|
|
1051
1092
|
{
|
|
1052
1093
|
type: "button",
|
|
1053
1094
|
className: `rs-connect-wallet-row ${isSelected ? "rs-connect-wallet-row--selected" : ""}`,
|
|
1054
|
-
onClick: () => _optionalChain([onSelectWallet, 'optionalCall',
|
|
1095
|
+
onClick: () => _optionalChain([onSelectWallet, 'optionalCall', _59 => _59(option.id)]),
|
|
1055
1096
|
children: [
|
|
1056
1097
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1057
1098
|
"div",
|
|
@@ -1062,7 +1103,7 @@ function ConnectStep({
|
|
|
1062
1103
|
{
|
|
1063
1104
|
src: option.icon,
|
|
1064
1105
|
alt: option.label,
|
|
1065
|
-
style: { width:
|
|
1106
|
+
style: { width: 24, height: 24, borderRadius: 6 }
|
|
1066
1107
|
}
|
|
1067
1108
|
) : rowIcon(option.kind)
|
|
1068
1109
|
}
|
|
@@ -1110,7 +1151,7 @@ function ConnectStep({
|
|
|
1110
1151
|
}
|
|
1111
1152
|
)
|
|
1112
1153
|
] }),
|
|
1113
|
-
(onDisconnect || onConnect) && _optionalChain([walletOptions, 'optionalAccess',
|
|
1154
|
+
(onDisconnect || onConnect) && _optionalChain([walletOptions, 'optionalAccess', _60 => _60.some, 'call', _61 => _61(
|
|
1114
1155
|
(option) => option.kind === "external" || option.kind === "solana"
|
|
1115
1156
|
)]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1116
1157
|
"button",
|
|
@@ -1327,7 +1368,7 @@ function asNumber(value) {
|
|
|
1327
1368
|
const trimmed = value.trim();
|
|
1328
1369
|
if (!trimmed) return void 0;
|
|
1329
1370
|
const caipMatch = trimmed.match(/^eip155:(\d+)$/);
|
|
1330
|
-
if (_optionalChain([caipMatch, 'optionalAccess',
|
|
1371
|
+
if (_optionalChain([caipMatch, 'optionalAccess', _62 => _62[1]])) {
|
|
1331
1372
|
const parsed2 = Number(caipMatch[1]);
|
|
1332
1373
|
return Number.isFinite(parsed2) ? parsed2 : void 0;
|
|
1333
1374
|
}
|
|
@@ -1346,28 +1387,28 @@ function asAddress(value) {
|
|
|
1346
1387
|
return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
|
|
1347
1388
|
}
|
|
1348
1389
|
function getEventTxHash(event) {
|
|
1349
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1390
|
+
if (!_optionalChain([event, 'optionalAccess', _63 => _63.type])) return void 0;
|
|
1350
1391
|
if (event.type === "deposit-received") {
|
|
1351
|
-
return asString(_optionalChain([event, 'access',
|
|
1392
|
+
return asString(_optionalChain([event, 'access', _64 => _64.data, 'optionalAccess', _65 => _65.transactionHash]));
|
|
1352
1393
|
}
|
|
1353
1394
|
if (event.type === "bridge-started" || event.type === "bridge-complete") {
|
|
1354
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
1355
|
-
const source = isRecord(_optionalChain([event, 'access',
|
|
1356
|
-
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess',
|
|
1395
|
+
const deposit = isRecord(_optionalChain([event, 'access', _66 => _66.data, 'optionalAccess', _67 => _67.deposit])) ? event.data.deposit : void 0;
|
|
1396
|
+
const source = isRecord(_optionalChain([event, 'access', _68 => _68.data, 'optionalAccess', _69 => _69.source])) ? event.data.source : void 0;
|
|
1397
|
+
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _70 => _70.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _71 => _71.transactionHash]))));
|
|
1357
1398
|
}
|
|
1358
1399
|
if (event.type === "bridge-failed" || event.type === "error") {
|
|
1359
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
1360
|
-
const source = isRecord(_optionalChain([event, 'access',
|
|
1361
|
-
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess',
|
|
1400
|
+
const deposit = isRecord(_optionalChain([event, 'access', _72 => _72.data, 'optionalAccess', _73 => _73.deposit])) ? event.data.deposit : void 0;
|
|
1401
|
+
const source = isRecord(_optionalChain([event, 'access', _74 => _74.data, 'optionalAccess', _75 => _75.source])) ? event.data.source : void 0;
|
|
1402
|
+
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _76 => _76.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _77 => _77.transactionHash]))));
|
|
1362
1403
|
}
|
|
1363
1404
|
if (event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed") {
|
|
1364
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
1365
|
-
return asString(_optionalChain([deposit, 'optionalAccess',
|
|
1405
|
+
const deposit = isRecord(_optionalChain([event, 'access', _78 => _78.data, 'optionalAccess', _79 => _79.deposit])) ? event.data.deposit : void 0;
|
|
1406
|
+
return asString(_optionalChain([deposit, 'optionalAccess', _80 => _80.transactionHash]));
|
|
1366
1407
|
}
|
|
1367
1408
|
return void 0;
|
|
1368
1409
|
}
|
|
1369
1410
|
function getEventSourceDetails(event) {
|
|
1370
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1411
|
+
if (!_optionalChain([event, 'optionalAccess', _81 => _81.type]) || !isRecord(event.data)) return {};
|
|
1371
1412
|
if (event.type === "deposit-received") {
|
|
1372
1413
|
return {
|
|
1373
1414
|
chainId: asNumber(event.data.chain),
|
|
@@ -1379,15 +1420,15 @@ function getEventSourceDetails(event) {
|
|
|
1379
1420
|
const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
|
|
1380
1421
|
if (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error" || event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed") {
|
|
1381
1422
|
return {
|
|
1382
|
-
chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess',
|
|
1383
|
-
amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess',
|
|
1384
|
-
token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess',
|
|
1423
|
+
chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess', _82 => _82.chain])), () => ( asNumber(_optionalChain([deposit, 'optionalAccess', _83 => _83.chain])))),
|
|
1424
|
+
amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess', _84 => _84.amount])), () => ( asAmount(_optionalChain([deposit, 'optionalAccess', _85 => _85.amount])))),
|
|
1425
|
+
token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess', _86 => _86.asset])), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _87 => _87.asset])))), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _88 => _88.token]))))
|
|
1385
1426
|
};
|
|
1386
1427
|
}
|
|
1387
1428
|
return {};
|
|
1388
1429
|
}
|
|
1389
1430
|
function isDepositEvent(event) {
|
|
1390
|
-
return _optionalChain([event, 'optionalAccess',
|
|
1431
|
+
return _optionalChain([event, 'optionalAccess', _89 => _89.type]) === "deposit-received" || _optionalChain([event, 'optionalAccess', _90 => _90.type]) === "bridge-started" || _optionalChain([event, 'optionalAccess', _91 => _91.type]) === "bridge-complete" || _optionalChain([event, 'optionalAccess', _92 => _92.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _93 => _93.type]) === "post-bridge-swap-complete" || _optionalChain([event, 'optionalAccess', _94 => _94.type]) === "post-bridge-swap-failed" || _optionalChain([event, 'optionalAccess', _95 => _95.type]) === "error";
|
|
1391
1432
|
}
|
|
1392
1433
|
function isHexString(value) {
|
|
1393
1434
|
return value.startsWith("0x") || value.startsWith("0X");
|
|
@@ -1442,7 +1483,7 @@ function isEventForTx(event, txHash) {
|
|
|
1442
1483
|
return txRefsMatch(eventTxHash, txHash);
|
|
1443
1484
|
}
|
|
1444
1485
|
function formatBridgeFailedMessage(event) {
|
|
1445
|
-
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
1486
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _96 => _96.data]), () => ( {}));
|
|
1446
1487
|
const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
|
|
1447
1488
|
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
1448
1489
|
function toUserFacingFailure(raw) {
|
|
@@ -1474,12 +1515,12 @@ function formatBridgeFailedMessage(event) {
|
|
|
1474
1515
|
return { message: "Bridge failed" };
|
|
1475
1516
|
}
|
|
1476
1517
|
function parseWebhookTimestamp(event) {
|
|
1477
|
-
if (typeof _optionalChain([event, 'optionalAccess',
|
|
1518
|
+
if (typeof _optionalChain([event, 'optionalAccess', _97 => _97.time]) !== "string") return void 0;
|
|
1478
1519
|
const timestamp = Date.parse(event.time);
|
|
1479
1520
|
return Number.isFinite(timestamp) ? timestamp : void 0;
|
|
1480
1521
|
}
|
|
1481
1522
|
function syncPhaseTimings(previous, event) {
|
|
1482
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1523
|
+
if (!_optionalChain([event, 'optionalAccess', _98 => _98.type])) return previous;
|
|
1483
1524
|
const timestamp = _nullishCoalesce(parseWebhookTimestamp(event), () => ( Date.now()));
|
|
1484
1525
|
const setReceived = (event.type === "deposit-received" || event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed" || event.type === "error") && previous.receivedAt === void 0;
|
|
1485
1526
|
const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "post-bridge-swap-complete") && previous.bridgingAt === void 0;
|
|
@@ -1520,9 +1561,9 @@ function getCurrentPhaseId(state, phaseTimings, isEarlyComplete) {
|
|
|
1520
1561
|
if (state.type === "complete") {
|
|
1521
1562
|
return void 0;
|
|
1522
1563
|
}
|
|
1523
|
-
if (_optionalChain([state, 'access',
|
|
1564
|
+
if (_optionalChain([state, 'access', _99 => _99.lastEvent, 'optionalAccess', _100 => _100.type]) === "bridge-started" || _optionalChain([state, 'access', _101 => _101.lastEvent, 'optionalAccess', _102 => _102.type]) === "bridge-complete")
|
|
1524
1565
|
return "bridging";
|
|
1525
|
-
if (_optionalChain([state, 'access',
|
|
1566
|
+
if (_optionalChain([state, 'access', _103 => _103.lastEvent, 'optionalAccess', _104 => _104.type]) === "deposit-received") return "received";
|
|
1526
1567
|
return "confirming";
|
|
1527
1568
|
}
|
|
1528
1569
|
function ProcessingStep({
|
|
@@ -1551,6 +1592,18 @@ function ProcessingStep({
|
|
|
1551
1592
|
const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
|
|
1552
1593
|
const pollTimeoutRef = _react.useRef.call(void 0, null);
|
|
1553
1594
|
const escalatedDelayRef = _react.useRef.call(void 0, false);
|
|
1595
|
+
const processingContextRef = useLatestRef({
|
|
1596
|
+
amount,
|
|
1597
|
+
sourceChain,
|
|
1598
|
+
sourceToken,
|
|
1599
|
+
targetChain,
|
|
1600
|
+
targetToken,
|
|
1601
|
+
waitForFinalTx,
|
|
1602
|
+
hasPostBridgeActions
|
|
1603
|
+
});
|
|
1604
|
+
const onDepositCompleteRef = useLatestRef(onDepositComplete);
|
|
1605
|
+
const onDepositFailedRef = useLatestRef(onDepositFailed);
|
|
1606
|
+
const onErrorRef = useLatestRef(onError);
|
|
1554
1607
|
const [state, setState] = _react.useState.call(void 0,
|
|
1555
1608
|
directTransfer ? { type: "complete" } : { type: "processing" }
|
|
1556
1609
|
);
|
|
@@ -1576,23 +1629,20 @@ function ProcessingStep({
|
|
|
1576
1629
|
txHash,
|
|
1577
1630
|
flowLabel
|
|
1578
1631
|
});
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1632
|
+
const context = processingContextRef.current;
|
|
1633
|
+
_optionalChain([onDepositCompleteRef, 'access', _105 => _105.current, 'optionalCall', _106 => _106(txHash, void 0, {
|
|
1634
|
+
amount: context.amount,
|
|
1635
|
+
sourceChain: context.sourceChain,
|
|
1636
|
+
sourceToken: context.sourceToken,
|
|
1637
|
+
targetChain: context.targetChain,
|
|
1638
|
+
targetToken: context.targetToken
|
|
1585
1639
|
})]);
|
|
1586
1640
|
}, [
|
|
1587
|
-
amount,
|
|
1588
1641
|
debug,
|
|
1589
1642
|
directTransfer,
|
|
1590
1643
|
flowLabel,
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
sourceToken,
|
|
1594
|
-
targetChain,
|
|
1595
|
-
targetToken,
|
|
1644
|
+
onDepositCompleteRef,
|
|
1645
|
+
processingContextRef,
|
|
1596
1646
|
txHash
|
|
1597
1647
|
]);
|
|
1598
1648
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1617,7 +1667,7 @@ function ProcessingStep({
|
|
|
1617
1667
|
_react.useEffect.call(void 0, () => {
|
|
1618
1668
|
if (!state.lastEvent) return;
|
|
1619
1669
|
setPhaseTimings((previous) => syncPhaseTimings(previous, state.lastEvent));
|
|
1620
|
-
}, [_optionalChain([state, 'access',
|
|
1670
|
+
}, [_optionalChain([state, 'access', _107 => _107.lastEvent, 'optionalAccess', _108 => _108.time]), _optionalChain([state, 'access', _109 => _109.lastEvent, 'optionalAccess', _110 => _110.type])]);
|
|
1621
1671
|
_react.useEffect.call(void 0, () => {
|
|
1622
1672
|
savePhaseTimings(txHash, phaseTimings);
|
|
1623
1673
|
}, [txHash, phaseTimings]);
|
|
@@ -1644,29 +1694,30 @@ function ProcessingStep({
|
|
|
1644
1694
|
debugLog(debug, "processing", "poll:event", {
|
|
1645
1695
|
type: lastEvent2.type,
|
|
1646
1696
|
matchesTx: eventMatchesTx,
|
|
1647
|
-
intentId: _optionalChain([eventData, 'optionalAccess',
|
|
1697
|
+
intentId: _optionalChain([eventData, 'optionalAccess', _111 => _111.intentId])
|
|
1648
1698
|
});
|
|
1649
1699
|
}
|
|
1650
1700
|
if (!isMounted) return;
|
|
1651
|
-
const awaitingPostBridgeSwap = waitForFinalTx && hasPostBridgeActions;
|
|
1652
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1701
|
+
const awaitingPostBridgeSwap = processingContextRef.current.waitForFinalTx && processingContextRef.current.hasPostBridgeActions;
|
|
1702
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _112 => _112.type]) === "post-bridge-swap-complete") {
|
|
1653
1703
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
1654
|
-
const swapTxHash = _optionalChain([eventForCurrentTx, 'access',
|
|
1704
|
+
const swapTxHash = _optionalChain([eventForCurrentTx, 'access', _113 => _113.data, 'optionalAccess', _114 => _114.swap, 'optionalAccess', _115 => _115.transactionHash]);
|
|
1655
1705
|
debugLog(debug, "processing", "state:complete", {
|
|
1656
1706
|
txHash,
|
|
1657
1707
|
destinationTxHash: swapTxHash,
|
|
1658
1708
|
event: eventForCurrentTx.type
|
|
1659
1709
|
});
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1710
|
+
const context = processingContextRef.current;
|
|
1711
|
+
_optionalChain([onDepositCompleteRef, 'access', _116 => _116.current, 'optionalCall', _117 => _117(txHash, swapTxHash, {
|
|
1712
|
+
amount: context.amount,
|
|
1713
|
+
sourceChain: context.sourceChain,
|
|
1714
|
+
sourceToken: context.sourceToken,
|
|
1715
|
+
targetChain: context.targetChain,
|
|
1716
|
+
targetToken: context.targetToken
|
|
1666
1717
|
})]);
|
|
1667
1718
|
return;
|
|
1668
1719
|
}
|
|
1669
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1720
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _118 => _118.type]) === "post-bridge-swap-failed") {
|
|
1670
1721
|
const formatted = formatBridgeFailedMessage(eventForCurrentTx);
|
|
1671
1722
|
setState({
|
|
1672
1723
|
type: "failed",
|
|
@@ -1678,42 +1729,44 @@ function ProcessingStep({
|
|
|
1678
1729
|
message: formatted.message,
|
|
1679
1730
|
code: formatted.code
|
|
1680
1731
|
});
|
|
1681
|
-
_optionalChain([
|
|
1732
|
+
_optionalChain([onDepositFailedRef, 'access', _119 => _119.current, 'optionalCall', _120 => _120(txHash, formatted.message)]);
|
|
1682
1733
|
return;
|
|
1683
1734
|
}
|
|
1684
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1735
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _121 => _121.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
|
|
1685
1736
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
1686
|
-
const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access',
|
|
1737
|
+
const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access', _122 => _122.data, 'optionalAccess', _123 => _123.destination, 'optionalAccess', _124 => _124.transactionHash]);
|
|
1687
1738
|
debugLog(debug, "processing", "state:complete", {
|
|
1688
1739
|
txHash,
|
|
1689
1740
|
destinationTxHash: destinationTxHash2,
|
|
1690
1741
|
event: eventForCurrentTx.type
|
|
1691
1742
|
});
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1743
|
+
const context = processingContextRef.current;
|
|
1744
|
+
_optionalChain([onDepositCompleteRef, 'access', _125 => _125.current, 'optionalCall', _126 => _126(txHash, destinationTxHash2, {
|
|
1745
|
+
amount: context.amount,
|
|
1746
|
+
sourceChain: context.sourceChain,
|
|
1747
|
+
sourceToken: context.sourceToken,
|
|
1748
|
+
targetChain: context.targetChain,
|
|
1749
|
+
targetToken: context.targetToken
|
|
1698
1750
|
})]);
|
|
1699
1751
|
return;
|
|
1700
1752
|
}
|
|
1701
|
-
if (!waitForFinalTx && _optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1753
|
+
if (!waitForFinalTx && _optionalChain([eventForCurrentTx, 'optionalAccess', _127 => _127.type]) === "bridge-started") {
|
|
1702
1754
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
1703
1755
|
debugLog(debug, "processing", "state:early-complete", {
|
|
1704
1756
|
txHash,
|
|
1705
1757
|
event: eventForCurrentTx.type
|
|
1706
1758
|
});
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1759
|
+
const context = processingContextRef.current;
|
|
1760
|
+
_optionalChain([onDepositCompleteRef, 'access', _128 => _128.current, 'optionalCall', _129 => _129(txHash, void 0, {
|
|
1761
|
+
amount: context.amount,
|
|
1762
|
+
sourceChain: context.sourceChain,
|
|
1763
|
+
sourceToken: context.sourceToken,
|
|
1764
|
+
targetChain: context.targetChain,
|
|
1765
|
+
targetToken: context.targetToken
|
|
1713
1766
|
})]);
|
|
1714
1767
|
return;
|
|
1715
1768
|
}
|
|
1716
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1769
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _130 => _130.type]) === "bridge-failed") {
|
|
1717
1770
|
const formatted = formatBridgeFailedMessage(eventForCurrentTx);
|
|
1718
1771
|
setState({
|
|
1719
1772
|
type: "failed",
|
|
@@ -1725,11 +1778,11 @@ function ProcessingStep({
|
|
|
1725
1778
|
message: formatted.message,
|
|
1726
1779
|
code: formatted.code
|
|
1727
1780
|
});
|
|
1728
|
-
_optionalChain([
|
|
1781
|
+
_optionalChain([onDepositFailedRef, 'access', _131 => _131.current, 'optionalCall', _132 => _132(txHash, formatted.message)]);
|
|
1729
1782
|
return;
|
|
1730
1783
|
}
|
|
1731
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1732
|
-
const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access',
|
|
1784
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _133 => _133.type]) === "error") {
|
|
1785
|
+
const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access', _134 => _134.data, 'optionalAccess', _135 => _135.message]), () => ( "Unknown error"));
|
|
1733
1786
|
setState({
|
|
1734
1787
|
type: "failed",
|
|
1735
1788
|
message: errorMessage,
|
|
@@ -1739,7 +1792,7 @@ function ProcessingStep({
|
|
|
1739
1792
|
txHash,
|
|
1740
1793
|
message: errorMessage
|
|
1741
1794
|
});
|
|
1742
|
-
_optionalChain([
|
|
1795
|
+
_optionalChain([onDepositFailedRef, 'access', _136 => _136.current, 'optionalCall', _137 => _137(txHash, errorMessage)]);
|
|
1743
1796
|
return;
|
|
1744
1797
|
}
|
|
1745
1798
|
setState((previous) => ({
|
|
@@ -1777,21 +1830,15 @@ function ProcessingStep({
|
|
|
1777
1830
|
}
|
|
1778
1831
|
};
|
|
1779
1832
|
}, [
|
|
1780
|
-
amount,
|
|
1781
1833
|
debug,
|
|
1782
1834
|
directTransfer,
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1835
|
+
onDepositCompleteRef,
|
|
1836
|
+
onDepositFailedRef,
|
|
1837
|
+
processingContextRef,
|
|
1786
1838
|
service,
|
|
1787
1839
|
smartAccount,
|
|
1788
|
-
sourceChain,
|
|
1789
|
-
sourceToken,
|
|
1790
1840
|
state.type,
|
|
1791
|
-
|
|
1792
|
-
targetToken,
|
|
1793
|
-
txHash,
|
|
1794
|
-
waitForFinalTx
|
|
1841
|
+
txHash
|
|
1795
1842
|
]);
|
|
1796
1843
|
_react.useEffect.call(void 0, () => {
|
|
1797
1844
|
if (directTransfer || state.type !== "processing") return;
|
|
@@ -1804,32 +1851,32 @@ function ProcessingStep({
|
|
|
1804
1851
|
txHash,
|
|
1805
1852
|
timeoutMs: ESCALATED_DELAY_MS
|
|
1806
1853
|
});
|
|
1807
|
-
_optionalChain([
|
|
1854
|
+
_optionalChain([onErrorRef, 'access', _138 => _138.current, 'optionalCall', _139 => _139(message, "PROCESS_TIMEOUT")]);
|
|
1808
1855
|
}, ESCALATED_DELAY_MS);
|
|
1809
1856
|
return () => clearTimeout(timeoutId);
|
|
1810
|
-
}, [debug, directTransfer,
|
|
1857
|
+
}, [debug, directTransfer, onErrorRef, state.type, txHash]);
|
|
1811
1858
|
const isComplete = state.type === "complete";
|
|
1812
1859
|
const isFailed = state.type === "failed";
|
|
1813
1860
|
const isProcessing = state.type === "processing";
|
|
1814
1861
|
const lastEvent = state.lastEvent;
|
|
1815
1862
|
const failureMessage = state.type === "failed" ? state.message : void 0;
|
|
1816
|
-
const isEarlyComplete = !waitForFinalTx && _optionalChain([lastEvent, 'optionalAccess',
|
|
1863
|
+
const isEarlyComplete = !waitForFinalTx && _optionalChain([lastEvent, 'optionalAccess', _140 => _140.type]) === "bridge-started";
|
|
1817
1864
|
const timelineNowMs = _nullishCoalesce(phaseTimings.endedAt, () => ( Date.now()));
|
|
1818
1865
|
const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
|
|
1819
1866
|
const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
|
|
1820
|
-
const isPostBridgeSwapEvent = _optionalChain([lastEvent, 'optionalAccess',
|
|
1821
|
-
const destinationTxHash = isPostBridgeSwapEvent ? _optionalChain([lastEvent, 'optionalAccess',
|
|
1822
|
-
const bridgeTxHash = isPostBridgeSwapEvent ? _optionalChain([lastEvent, 'optionalAccess',
|
|
1867
|
+
const isPostBridgeSwapEvent = _optionalChain([lastEvent, 'optionalAccess', _141 => _141.type]) === "post-bridge-swap-complete" || _optionalChain([lastEvent, 'optionalAccess', _142 => _142.type]) === "post-bridge-swap-failed";
|
|
1868
|
+
const destinationTxHash = isPostBridgeSwapEvent ? _optionalChain([lastEvent, 'optionalAccess', _143 => _143.data, 'optionalAccess', _144 => _144.swap, 'optionalAccess', _145 => _145.transactionHash]) || null : _optionalChain([lastEvent, 'optionalAccess', _146 => _146.data, 'optionalAccess', _147 => _147.destination, 'optionalAccess', _148 => _148.transactionHash]) || null;
|
|
1869
|
+
const bridgeTxHash = isPostBridgeSwapEvent ? _optionalChain([lastEvent, 'optionalAccess', _149 => _149.data, 'optionalAccess', _150 => _150.bridge, 'optionalAccess', _151 => _151.transactionHash]) || null : null;
|
|
1823
1870
|
const sourceDetails = getEventSourceDetails(lastEvent);
|
|
1824
1871
|
const displaySourceChain = _nullishCoalesce(sourceDetails.chainId, () => ( sourceChain));
|
|
1825
1872
|
const displaySourceToken = _nullishCoalesce(sourceDetails.token, () => ( sourceToken));
|
|
1826
1873
|
const displayAmount = _nullishCoalesce(sourceDetails.amount, () => ( amount));
|
|
1827
|
-
const sourceExplorerUrl =
|
|
1828
|
-
const bridgeExplorerUrl = bridgeTxHash ?
|
|
1829
|
-
const destExplorerUrl = destinationTxHash ?
|
|
1874
|
+
const sourceExplorerUrl = _chunkMUWVDVY4cjs.getExplorerTxUrl.call(void 0, displaySourceChain, txHash);
|
|
1875
|
+
const bridgeExplorerUrl = bridgeTxHash ? _chunkMUWVDVY4cjs.getExplorerTxUrl.call(void 0, targetChain, bridgeTxHash) : null;
|
|
1876
|
+
const destExplorerUrl = destinationTxHash ? _chunkMUWVDVY4cjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
|
|
1830
1877
|
const isEvmSourceToken = /^0x[a-fA-F0-9]{40}$/.test(displaySourceToken);
|
|
1831
|
-
const sourceSymbol = displaySourceChain === "solana" ? _nullishCoalesce(providedSourceSymbol, () => ( "SOL")) : isEvmSourceToken ?
|
|
1832
|
-
const sourceDecimals = displaySourceChain === "solana" ? _nullishCoalesce(providedSourceDecimals, () => ( 9)) : isEvmSourceToken ?
|
|
1878
|
+
const sourceSymbol = displaySourceChain === "solana" ? _nullishCoalesce(providedSourceSymbol, () => ( "SOL")) : isEvmSourceToken ? _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, displaySourceToken, displaySourceChain) : _nullishCoalesce(providedSourceSymbol, () => ( "Token"));
|
|
1879
|
+
const sourceDecimals = displaySourceChain === "solana" ? _nullishCoalesce(providedSourceDecimals, () => ( 9)) : isEvmSourceToken ? _chunkMUWVDVY4cjs.getTokenDecimalsByAddress.call(void 0,
|
|
1833
1880
|
displaySourceToken,
|
|
1834
1881
|
displaySourceChain
|
|
1835
1882
|
) : _nullishCoalesce(providedSourceDecimals, () => ( 18));
|
|
@@ -1850,7 +1897,7 @@ function ProcessingStep({
|
|
|
1850
1897
|
const activePhaseElapsedMs = isProcessing && activePhaseStartedAt !== void 0 ? timelineNowMs - activePhaseStartedAt : 0;
|
|
1851
1898
|
const delayPhaseId = isProcessing && currentPhaseId && activePhaseElapsedMs >= SOFT_DELAY_MS[currentPhaseId] ? currentPhaseId : void 0;
|
|
1852
1899
|
const headerTitle = isFailed ? `${flowCapitalized} could not be completed` : isComplete ? isEarlyComplete ? `${flowCapitalized} confirmed` : `${flowCapitalized} successful` : delayPhaseId === "received" ? "Bridge pending" : delayPhaseId === "bridging" ? "Bridge delayed" : delayPhaseId === "confirming" ? `Confirming ${flowNoun}` : `Submitting transaction...`;
|
|
1853
|
-
const headerDescription = isFailed ? _nullishCoalesce(failureMessage, () => ( "The transfer could not be completed.")) : isComplete ? directTransfer ? "Your transfer is complete." : isEarlyComplete ? "The bridge has started. Funds will arrive shortly." : "Your funds were successfully deposited." : delayPhaseId === "received" ? "Funds are in. We are still waiting for the bridge transaction to begin." : delayPhaseId === "bridging" ? "The bridge has started but settlement is taking longer than expected." : delayPhaseId === "confirming" ? "The source transaction has not been picked up yet, but we are still polling automatically." : _optionalChain([state, 'access',
|
|
1900
|
+
const headerDescription = isFailed ? _nullishCoalesce(failureMessage, () => ( "The transfer could not be completed.")) : isComplete ? directTransfer ? "Your transfer is complete." : isEarlyComplete ? "The bridge has started. Funds will arrive shortly." : "Your funds were successfully deposited." : delayPhaseId === "received" ? "Funds are in. We are still waiting for the bridge transaction to begin." : delayPhaseId === "bridging" ? "The bridge has started but settlement is taking longer than expected." : delayPhaseId === "confirming" ? "The source transaction has not been picked up yet, but we are still polling automatically." : _optionalChain([state, 'access', _152 => _152.lastEvent, 'optionalAccess', _153 => _153.type]) === "deposit-received" ? "Transfer received. Preparing bridge execution." : _optionalChain([state, 'access', _154 => _154.lastEvent, 'optionalAccess', _155 => _155.type]) === "bridge-started" ? `Bridge started. Sending funds to ${_chunkMUWVDVY4cjs.getChainName.call(void 0, targetChain)}.` : "Filling your transaction on the blockchain.";
|
|
1854
1901
|
const showAlert = !isFailed && (delayPhaseId !== void 0 || hasEscalatedDelay);
|
|
1855
1902
|
const alertMessage = hasEscalatedDelay ? "Taking longer than expected. You can close this window \u2014 processing continues in the background." : "This step is slower than usual but still processing.";
|
|
1856
1903
|
const fillStatus = isComplete ? "Successful" : isFailed ? "Failed" : "Processing";
|
|
@@ -1932,15 +1979,15 @@ function ProcessingStep({
|
|
|
1932
1979
|
className: "rs-card-value",
|
|
1933
1980
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1934
1981
|
children: [
|
|
1935
|
-
|
|
1982
|
+
_chunkMUWVDVY4cjs.getChainIcon.call(void 0, displaySourceChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1936
1983
|
"img",
|
|
1937
1984
|
{
|
|
1938
|
-
src:
|
|
1985
|
+
src: _chunkMUWVDVY4cjs.getChainIcon.call(void 0, displaySourceChain),
|
|
1939
1986
|
alt: "",
|
|
1940
1987
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
1941
1988
|
}
|
|
1942
1989
|
),
|
|
1943
|
-
|
|
1990
|
+
_chunkMUWVDVY4cjs.getChainName.call(void 0, displaySourceChain),
|
|
1944
1991
|
sourceExplorerUrl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1945
1992
|
"a",
|
|
1946
1993
|
{
|
|
@@ -1963,15 +2010,15 @@ function ProcessingStep({
|
|
|
1963
2010
|
className: "rs-card-value",
|
|
1964
2011
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1965
2012
|
children: [
|
|
1966
|
-
|
|
2013
|
+
_chunkMUWVDVY4cjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1967
2014
|
"img",
|
|
1968
2015
|
{
|
|
1969
|
-
src:
|
|
2016
|
+
src: _chunkMUWVDVY4cjs.getChainIcon.call(void 0, targetChain),
|
|
1970
2017
|
alt: "",
|
|
1971
2018
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
1972
2019
|
}
|
|
1973
2020
|
),
|
|
1974
|
-
|
|
2021
|
+
_chunkMUWVDVY4cjs.getChainName.call(void 0, targetChain),
|
|
1975
2022
|
destExplorerUrl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1976
2023
|
"a",
|
|
1977
2024
|
{
|
|
@@ -1995,10 +2042,10 @@ function ProcessingStep({
|
|
|
1995
2042
|
className: "rs-card-value",
|
|
1996
2043
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1997
2044
|
children: [
|
|
1998
|
-
|
|
2045
|
+
_chunkMUWVDVY4cjs.getTokenIcon.call(void 0, sourceSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1999
2046
|
"img",
|
|
2000
2047
|
{
|
|
2001
|
-
src:
|
|
2048
|
+
src: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, sourceSymbol),
|
|
2002
2049
|
alt: "",
|
|
2003
2050
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
2004
2051
|
}
|
|
@@ -2130,7 +2177,7 @@ var clientCache = /* @__PURE__ */ new Map();
|
|
|
2130
2177
|
function getPublicClient(chainId) {
|
|
2131
2178
|
let client = clientCache.get(chainId);
|
|
2132
2179
|
if (!client) {
|
|
2133
|
-
const chain =
|
|
2180
|
+
const chain = _chunkMUWVDVY4cjs.CHAIN_BY_ID[chainId];
|
|
2134
2181
|
client = _viem.createPublicClient.call(void 0, {
|
|
2135
2182
|
chain,
|
|
2136
2183
|
transport: _viem.http.call(void 0, )
|
|
@@ -2168,4 +2215,6 @@ function getPublicClient(chainId) {
|
|
|
2168
2215
|
|
|
2169
2216
|
|
|
2170
2217
|
|
|
2171
|
-
|
|
2218
|
+
|
|
2219
|
+
|
|
2220
|
+
exports.Modal = Modal; exports.Spinner = Spinner; exports.Button = Button; exports.ConnectStep = ConnectStep; exports.debugLog = debugLog; exports.debugError = debugError; exports.toEvmCaip2 = toEvmCaip2; exports.parseEvmChainId = parseEvmChainId; exports.isSolanaCaip2 = isSolanaCaip2; exports.buildSessionDetails = buildSessionDetails; exports.createDepositService = createDepositService; exports.getAssetId = getAssetId; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.loadSessionOwnerFromStorage = loadSessionOwnerFromStorage; exports.saveSessionOwnerToStorage = saveSessionOwnerToStorage; exports.createSessionOwnerKey = createSessionOwnerKey; exports.accountFromPrivateKey = accountFromPrivateKey; exports.PoweredBy = PoweredBy; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.formatUserError = formatUserError; exports.getEventTxHash = getEventTxHash; exports.isDepositEvent = isDepositEvent; exports.txRefsMatch = txRefsMatch; exports.useLatestRef = useLatestRef; exports.ProcessingStep = ProcessingStep; exports.getPublicClient = getPublicClient; exports.applyTheme = applyTheme;
|