@rhinestone/deposit-modal 0.3.0-alpha.6 → 0.3.0-alpha.8
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-SBSP5ZW2.cjs → DepositModalReown-LWGABUOF.cjs} +12 -9
- package/dist/{DepositModalReown-3N7YYGB4.mjs → DepositModalReown-TYHATVOM.mjs} +9 -6
- package/dist/{WithdrawModalReown-4B6IMTBB.cjs → WithdrawModalReown-FCWED55P.cjs} +7 -7
- package/dist/{WithdrawModalReown-BB3MZAIO.mjs → WithdrawModalReown-H7HA3JP3.mjs} +4 -4
- package/dist/{chunk-CTYKQ4B4.mjs → chunk-5ZS4ZJPW.mjs} +272 -145
- package/dist/chunk-7JIDIX27.cjs +554 -0
- package/dist/{chunk-QI6Q7V6O.mjs → chunk-DW276H63.mjs} +26 -34
- package/dist/{chunk-5YXAQB6A.mjs → chunk-E46WOBZQ.mjs} +56 -16
- package/dist/{chunk-UVIIWUWP.cjs → chunk-GBFOGYMH.cjs} +1193 -862
- package/dist/{chunk-EJH36TH2.mjs → chunk-H7QMSMM5.mjs} +1247 -916
- package/dist/{chunk-YQFH2WSW.cjs → chunk-PKD7W5JG.cjs} +54 -14
- package/dist/chunk-SZIYS42B.mjs +554 -0
- package/dist/{chunk-BB6UVRAV.cjs → chunk-U3OLJZBT.cjs} +110 -118
- package/dist/{chunk-DX2D2TRZ.cjs → chunk-UELVNPGE.cjs} +312 -185
- package/dist/constants-DqVn968d.d.cts +52 -0
- package/dist/constants-DqVn968d.d.ts +52 -0
- package/dist/constants.cjs +8 -2
- package/dist/constants.d.cts +17 -48
- package/dist/constants.d.ts +17 -48
- package/dist/constants.mjs +7 -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 +6 -6
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +5 -5
- package/dist/styles.css +180 -34
- package/dist/{types-xSHZSlrT.d.cts → types-D8Q4TMk7.d.cts} +17 -5
- package/dist/{types-xSHZSlrT.d.ts → types-D8Q4TMk7.d.ts} +17 -5
- 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
- package/dist/chunk-IVTXEYB2.cjs +0 -507
- package/dist/chunk-VA3ANS7D.mjs +0 -507
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunk7JIDIX27cjs = require('./chunk-7JIDIX27.cjs');
|
|
13
15
|
|
|
14
16
|
// src/components/ui/Modal.tsx
|
|
15
17
|
|
|
@@ -174,14 +176,14 @@ function TransferCryptoIcon() {
|
|
|
174
176
|
{
|
|
175
177
|
width: "24",
|
|
176
178
|
height: "24",
|
|
177
|
-
viewBox: "
|
|
179
|
+
viewBox: "8 8 24 24",
|
|
178
180
|
fill: "none",
|
|
179
181
|
xmlns: "http://www.w3.org/2000/svg",
|
|
180
182
|
"aria-hidden": "true",
|
|
181
183
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
182
184
|
"path",
|
|
183
185
|
{
|
|
184
|
-
d: "
|
|
186
|
+
d: "M26.0898 18.3701C27.0352 18.7225 27.8763 19.3076 28.5356 20.0713C29.1949 20.835 29.6509 21.7526 29.8616 22.7392C30.0723 23.7258 30.0307 24.7496 29.7409 25.716C29.451 26.6823 28.9222 27.5599 28.2033 28.2677C27.4844 28.9755 26.5986 29.4906 25.6278 29.7653C24.6571 30.0401 23.6327 30.0656 22.6495 29.8396C21.6663 29.6135 20.756 29.1432 20.0027 28.4721C19.2494 27.801 18.6775 26.9508 18.3398 26.0001M15 14H16V18M24.7098 21.8799L25.4098 22.5899L22.5898 25.4099M22 16C22 19.3137 19.3137 22 16 22C12.6863 22 10 19.3137 10 16C10 12.6863 12.6863 10 16 10C19.3137 10 22 12.6863 22 16Z",
|
|
185
187
|
stroke: "currentColor",
|
|
186
188
|
strokeWidth: "2",
|
|
187
189
|
strokeLinecap: "round",
|
|
@@ -196,7 +198,6 @@ var ChevronLeftIcon = _lucidereact.ChevronLeft;
|
|
|
196
198
|
var ChevronDownIcon = _lucidereact.ChevronDown;
|
|
197
199
|
var CloseIcon = _lucidereact.X;
|
|
198
200
|
var HandCoinsIcon = _lucidereact.HandCoins;
|
|
199
|
-
var CoinsIcon = _lucidereact.Coins;
|
|
200
201
|
var HistoryIcon = _lucidereact.History;
|
|
201
202
|
var InfoIcon = _lucidereact.Info;
|
|
202
203
|
var CopyIcon = _lucidereact.Copy;
|
|
@@ -266,6 +267,9 @@ var SOLANA_MAINNET_CAIP2 = `solana:${SOLANA_MAINNET_GENESIS}`;
|
|
|
266
267
|
function toEvmCaip2(chainId) {
|
|
267
268
|
return `eip155:${chainId}`;
|
|
268
269
|
}
|
|
270
|
+
function targetChainToCaip2(targetChain) {
|
|
271
|
+
return targetChain === "solana" ? SOLANA_MAINNET_CAIP2 : toEvmCaip2(targetChain);
|
|
272
|
+
}
|
|
269
273
|
function parseEvmChainId(value) {
|
|
270
274
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
271
275
|
return value;
|
|
@@ -512,9 +516,9 @@ function createDepositService(baseUrl, options) {
|
|
|
512
516
|
error,
|
|
513
517
|
{ status: response.status, ownerAddress: params.ownerAddress }
|
|
514
518
|
);
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
);
|
|
519
|
+
const detail = Array.isArray(error.details) ? error.details.map((d) => _optionalChain([d, 'optionalAccess', _6 => _6.message])).filter(Boolean).join("; ") : void 0;
|
|
520
|
+
const base = error.error || `Setup account failed: ${response.status}`;
|
|
521
|
+
throw new Error(detail ? `${base}: ${detail}` : base);
|
|
518
522
|
}
|
|
519
523
|
const normalized = normalizeSetupAccountResponse(await response.json());
|
|
520
524
|
debugLog(debug, scope, "setupAccount:success", {
|
|
@@ -564,8 +568,8 @@ function createDepositService(baseUrl, options) {
|
|
|
564
568
|
const result = await response.json();
|
|
565
569
|
debugLog(debug, scope, "registerAccount:success", {
|
|
566
570
|
address: params.address,
|
|
567
|
-
evmDepositAddress: _optionalChain([result, 'optionalAccess',
|
|
568
|
-
hasSolanaDepositAddress: Boolean(_optionalChain([result, 'optionalAccess',
|
|
571
|
+
evmDepositAddress: _optionalChain([result, 'optionalAccess', _7 => _7.evmDepositAddress]),
|
|
572
|
+
hasSolanaDepositAddress: Boolean(_optionalChain([result, 'optionalAccess', _8 => _8.solanaDepositAddress]))
|
|
569
573
|
});
|
|
570
574
|
return result;
|
|
571
575
|
},
|
|
@@ -667,9 +671,9 @@ function createDepositService(baseUrl, options) {
|
|
|
667
671
|
}
|
|
668
672
|
const data = await response.json();
|
|
669
673
|
const result = {
|
|
670
|
-
isRegistered: _optionalChain([data, 'optionalAccess',
|
|
671
|
-
targetChain: _optionalChain([data, 'optionalAccess',
|
|
672
|
-
targetToken: _optionalChain([data, 'optionalAccess',
|
|
674
|
+
isRegistered: _optionalChain([data, 'optionalAccess', _9 => _9.isRegistered]) === true,
|
|
675
|
+
targetChain: _optionalChain([data, 'optionalAccess', _10 => _10.targetChain]),
|
|
676
|
+
targetToken: _optionalChain([data, 'optionalAccess', _11 => _11.targetToken])
|
|
673
677
|
};
|
|
674
678
|
debugLog(debug, scope, "checkAccount:success", {
|
|
675
679
|
address,
|
|
@@ -699,12 +703,12 @@ function createDepositService(baseUrl, options) {
|
|
|
699
703
|
return { lastEvent: void 0 };
|
|
700
704
|
}
|
|
701
705
|
const body = await response.json();
|
|
702
|
-
const row = _optionalChain([body, 'access',
|
|
706
|
+
const row = _optionalChain([body, 'access', _12 => _12.deposits, 'optionalAccess', _13 => _13[0]]);
|
|
703
707
|
const lastEvent = row ? depositRowToEvent(row) : void 0;
|
|
704
708
|
debugLog(debug, scope, "fetchStatus:success", {
|
|
705
709
|
address,
|
|
706
710
|
txHash: shortRef(normalized),
|
|
707
|
-
eventType: _optionalChain([lastEvent, 'optionalAccess',
|
|
711
|
+
eventType: _optionalChain([lastEvent, 'optionalAccess', _14 => _14.type])
|
|
708
712
|
});
|
|
709
713
|
return { lastEvent };
|
|
710
714
|
},
|
|
@@ -725,11 +729,11 @@ function createDepositService(baseUrl, options) {
|
|
|
725
729
|
return { lastEvent: void 0 };
|
|
726
730
|
}
|
|
727
731
|
const body = await response.json();
|
|
728
|
-
const row = _optionalChain([body, 'access',
|
|
732
|
+
const row = _optionalChain([body, 'access', _15 => _15.deposits, 'optionalAccess', _16 => _16[0]]);
|
|
729
733
|
const lastEvent = row ? depositRowToEvent(row) : void 0;
|
|
730
734
|
debugLog(debug, scope, "fetchLatestStatus:success", {
|
|
731
735
|
address,
|
|
732
|
-
eventType: _optionalChain([lastEvent, 'optionalAccess',
|
|
736
|
+
eventType: _optionalChain([lastEvent, 'optionalAccess', _17 => _17.type])
|
|
733
737
|
});
|
|
734
738
|
return { lastEvent };
|
|
735
739
|
},
|
|
@@ -791,7 +795,47 @@ function createDepositService(baseUrl, options) {
|
|
|
791
795
|
smartAccount,
|
|
792
796
|
chainId,
|
|
793
797
|
safeAddress,
|
|
794
|
-
txHash: _optionalChain([result, 'optionalAccess',
|
|
798
|
+
txHash: _optionalChain([result, 'optionalAccess', _18 => _18.txHash]) ? shortRef(result.txHash) : void 0
|
|
799
|
+
});
|
|
800
|
+
return result;
|
|
801
|
+
},
|
|
802
|
+
async submitPolymarketWithdraw(params) {
|
|
803
|
+
const { depositWallet, owner, nonce, deadline, calls, signature } = params;
|
|
804
|
+
const url = apiUrl(`/polymarket/withdraw`);
|
|
805
|
+
debugLog(debug, scope, "submitPolymarketWithdraw:request", {
|
|
806
|
+
url,
|
|
807
|
+
depositWallet,
|
|
808
|
+
owner,
|
|
809
|
+
nonce,
|
|
810
|
+
callCount: calls.length
|
|
811
|
+
});
|
|
812
|
+
const response = await fetch(url, {
|
|
813
|
+
method: "POST",
|
|
814
|
+
headers: { "Content-Type": "application/json" },
|
|
815
|
+
body: JSON.stringify({
|
|
816
|
+
depositWallet,
|
|
817
|
+
owner,
|
|
818
|
+
nonce,
|
|
819
|
+
deadline,
|
|
820
|
+
calls,
|
|
821
|
+
signature
|
|
822
|
+
})
|
|
823
|
+
});
|
|
824
|
+
if (!response.ok) {
|
|
825
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
826
|
+
debugError(debug, scope, "submitPolymarketWithdraw:failed", error, {
|
|
827
|
+
status: response.status,
|
|
828
|
+
depositWallet,
|
|
829
|
+
owner
|
|
830
|
+
});
|
|
831
|
+
throw new Error(
|
|
832
|
+
error.error || `Polymarket withdraw failed: ${response.status}`
|
|
833
|
+
);
|
|
834
|
+
}
|
|
835
|
+
const result = await response.json();
|
|
836
|
+
debugLog(debug, scope, "submitPolymarketWithdraw:success", {
|
|
837
|
+
depositWallet,
|
|
838
|
+
txHash: _optionalChain([result, 'optionalAccess', _19 => _19.txHash]) ? shortRef(result.txHash) : void 0
|
|
795
839
|
});
|
|
796
840
|
return result;
|
|
797
841
|
},
|
|
@@ -826,8 +870,8 @@ function createDepositService(baseUrl, options) {
|
|
|
826
870
|
);
|
|
827
871
|
}
|
|
828
872
|
const data = await response.json();
|
|
829
|
-
const deposits = Array.isArray(_optionalChain([data, 'optionalAccess',
|
|
830
|
-
const nextCursor = _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
873
|
+
const deposits = Array.isArray(_optionalChain([data, 'optionalAccess', _20 => _20.deposits])) ? data.deposits : [];
|
|
874
|
+
const nextCursor = _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _21 => _21.nextCursor]), () => ( _optionalChain([data, 'optionalAccess', _22 => _22.next_cursor]))), () => ( null));
|
|
831
875
|
debugLog(debug, scope, "fetchDepositHistory:success", {
|
|
832
876
|
recipient: shortRef(params.recipient),
|
|
833
877
|
count: deposits.length,
|
|
@@ -836,6 +880,16 @@ function createDepositService(baseUrl, options) {
|
|
|
836
880
|
return { deposits, nextCursor };
|
|
837
881
|
},
|
|
838
882
|
async checkLiquidity(params) {
|
|
883
|
+
if (params.destinationChainId === "solana") {
|
|
884
|
+
const token = _chunk7JIDIX27cjs.getSolanaTokenByMint.call(void 0, params.destinationToken);
|
|
885
|
+
return {
|
|
886
|
+
hasLiquidity: true,
|
|
887
|
+
symbol: _nullishCoalesce(_optionalChain([token, 'optionalAccess', _23 => _23.symbol]), () => ( "Token")),
|
|
888
|
+
decimals: _nullishCoalesce(_optionalChain([token, 'optionalAccess', _24 => _24.decimals]), () => ( 9)),
|
|
889
|
+
unlimited: true,
|
|
890
|
+
maxAmount: null
|
|
891
|
+
};
|
|
892
|
+
}
|
|
839
893
|
const searchParams = new URLSearchParams({
|
|
840
894
|
sourceChainId: String(params.sourceChainId),
|
|
841
895
|
sourceToken: params.sourceToken,
|
|
@@ -878,21 +932,51 @@ function createDepositService(baseUrl, options) {
|
|
|
878
932
|
maxAmount: result.maxAmount
|
|
879
933
|
});
|
|
880
934
|
return result;
|
|
935
|
+
},
|
|
936
|
+
async fetchPrices(symbols) {
|
|
937
|
+
const list = symbols.filter((s) => s.length > 0);
|
|
938
|
+
if (list.length === 0) return {};
|
|
939
|
+
const url = apiUrl(
|
|
940
|
+
`/prices?${new URLSearchParams({ symbols: list.join(",") }).toString()}`
|
|
941
|
+
);
|
|
942
|
+
try {
|
|
943
|
+
const response = await fetch(url, {
|
|
944
|
+
method: "GET",
|
|
945
|
+
headers: { "Content-Type": "application/json" },
|
|
946
|
+
cache: "no-store"
|
|
947
|
+
});
|
|
948
|
+
if (!response.ok) {
|
|
949
|
+
debugError(debug, scope, "fetchPrices:failed", {
|
|
950
|
+
status: response.status
|
|
951
|
+
});
|
|
952
|
+
return {};
|
|
953
|
+
}
|
|
954
|
+
const data = await response.json();
|
|
955
|
+
return Object.fromEntries(
|
|
956
|
+
Object.entries(_nullishCoalesce(data.prices, () => ( {}))).map(([symbol, price]) => [
|
|
957
|
+
symbol.toUpperCase(),
|
|
958
|
+
price
|
|
959
|
+
])
|
|
960
|
+
);
|
|
961
|
+
} catch (err) {
|
|
962
|
+
debugError(debug, scope, "fetchPrices:error", err);
|
|
963
|
+
return {};
|
|
964
|
+
}
|
|
881
965
|
}
|
|
882
966
|
};
|
|
883
967
|
}
|
|
884
968
|
function normalizeDirectPortfolio(data) {
|
|
885
969
|
const rawTokens = _nullishCoalesce(_nullishCoalesce(extractArray(data, "tokens"), () => ( extractArray(
|
|
886
|
-
_optionalChain([data, 'optionalAccess',
|
|
970
|
+
_optionalChain([data, 'optionalAccess', _25 => _25.data]),
|
|
887
971
|
"tokens"
|
|
888
972
|
))), () => ( []));
|
|
889
|
-
const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess',
|
|
973
|
+
const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess', _26 => _26.data]), "totalUsd"))), () => ( 0));
|
|
890
974
|
const tokens = rawTokens.map((token) => normalizeDirectToken(token)).filter((token) => Boolean(token));
|
|
891
975
|
return { tokens, totalUsd };
|
|
892
976
|
}
|
|
893
977
|
function extractOrchestratorPortfolio(data) {
|
|
894
978
|
const portfolio = _nullishCoalesce(extractArray(data, "portfolio"), () => ( extractArray(
|
|
895
|
-
_optionalChain([data, 'optionalAccess',
|
|
979
|
+
_optionalChain([data, 'optionalAccess', _27 => _27.data]),
|
|
896
980
|
"portfolio"
|
|
897
981
|
)));
|
|
898
982
|
if (!portfolio || !Array.isArray(portfolio)) return null;
|
|
@@ -903,17 +987,17 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
903
987
|
for (const tokenData of data.portfolio || []) {
|
|
904
988
|
const chainBalances = _nullishCoalesce(_nullishCoalesce(tokenData.tokenChainBalance, () => ( tokenData.chainBalances)), () => ( []));
|
|
905
989
|
for (const chainBalance of chainBalances) {
|
|
906
|
-
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access',
|
|
990
|
+
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _28 => _28.balance, 'optionalAccess', _29 => _29.unlocked]), () => ( "0"));
|
|
907
991
|
const normalizedName = tokenData.tokenName.trim();
|
|
908
992
|
const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
|
|
909
|
-
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => (
|
|
910
|
-
const resolvedTokenAddress = isNativeSymbol ?
|
|
993
|
+
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => ( _chunk7JIDIX27cjs.getTokenAddress.call(void 0, tokenData.tokenName, chainBalance.chainId)));
|
|
994
|
+
const resolvedTokenAddress = isNativeSymbol ? _chunk7JIDIX27cjs.NATIVE_TOKEN_ADDRESS : tokenAddress;
|
|
911
995
|
if (!resolvedTokenAddress) {
|
|
912
996
|
continue;
|
|
913
997
|
}
|
|
914
|
-
const registrySymbol =
|
|
998
|
+
const registrySymbol = _chunk7JIDIX27cjs.getTokenSymbol.call(void 0, resolvedTokenAddress, chainBalance.chainId);
|
|
915
999
|
const symbol = registrySymbol !== "Token" ? registrySymbol : normalizedName || "Token";
|
|
916
|
-
const decimals = registrySymbol !== "Token" ?
|
|
1000
|
+
const decimals = registrySymbol !== "Token" ? _chunk7JIDIX27cjs.getTokenDecimalsByAddress.call(void 0, resolvedTokenAddress, chainBalance.chainId) : _nullishCoalesce(tokenData.tokenDecimals, () => ( 18));
|
|
917
1001
|
tokens.push({
|
|
918
1002
|
chainId: chainBalance.chainId,
|
|
919
1003
|
address: resolvedTokenAddress,
|
|
@@ -937,19 +1021,19 @@ function normalizeDirectToken(token) {
|
|
|
937
1021
|
if (chainId === null) return null;
|
|
938
1022
|
const symbol = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "symbol"), () => ( extractString(token, "tokenSymbol"))), () => ( extractString(token, "tokenName"))), () => ( extractString(token, "name")));
|
|
939
1023
|
if (!symbol) return null;
|
|
940
|
-
const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call',
|
|
1024
|
+
const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call', _30 => _30(token, "balance"), 'optionalAccess', _31 => _31.toString, 'call', _32 => _32()]))), () => ( _optionalChain([extractNumber, 'call', _33 => _33(token, "amount"), 'optionalAccess', _34 => _34.toString, 'call', _35 => _35()]))), () => ( _optionalChain([extractNumber, 'call', _36 => _36(token, "value"), 'optionalAccess', _37 => _37.toString, 'call', _38 => _38()]))), () => ( _optionalChain([extractNumber, 'call', _39 => _39(token, "rawBalance"), 'optionalAccess', _40 => _40.toString, 'call', _41 => _41()])));
|
|
941
1025
|
if (!balanceValue) return null;
|
|
942
1026
|
const address = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "address"), () => ( extractString(token, "tokenAddress"))), () => ( extractString(
|
|
943
1027
|
token.token,
|
|
944
1028
|
"address"
|
|
945
|
-
))), () => ( (typeof chainId === "number" ?
|
|
1029
|
+
))), () => ( (typeof chainId === "number" ? _chunk7JIDIX27cjs.getTokenAddress.call(void 0, symbol, chainId) : void 0)));
|
|
946
1030
|
if (!address) return null;
|
|
947
1031
|
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));
|
|
948
1032
|
const isSolanaToken = chainId === "solana";
|
|
949
|
-
const registrySymbol = isSolanaToken ? "Token" :
|
|
1033
|
+
const registrySymbol = isSolanaToken ? "Token" : _chunk7JIDIX27cjs.getTokenSymbol.call(void 0, address, chainId);
|
|
950
1034
|
const resolvedSymbol = isSolanaToken ? symbol : registrySymbol !== "Token" ? registrySymbol : symbol;
|
|
951
1035
|
const backendDecimals = _nullishCoalesce(extractNumber(token, "decimals"), () => ( extractNumber(token, "tokenDecimals")));
|
|
952
|
-
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ?
|
|
1036
|
+
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ? _chunk7JIDIX27cjs.getTokenDecimalsByAddress.call(void 0, address, chainId) : _nullishCoalesce(backendDecimals, () => ( 18));
|
|
953
1037
|
return {
|
|
954
1038
|
chainId,
|
|
955
1039
|
address,
|
|
@@ -962,7 +1046,7 @@ function normalizeDirectToken(token) {
|
|
|
962
1046
|
}
|
|
963
1047
|
function extractTokenAddress(tokenData, chainId) {
|
|
964
1048
|
const token = tokenData;
|
|
965
|
-
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access',
|
|
1049
|
+
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access', _42 => _42.addresses, 'optionalAccess', _43 => _43[chainId]]))), () => ( _optionalChain([token, 'access', _44 => _44.token, 'optionalAccess', _45 => _45.address]))), () => ( _optionalChain([token, 'access', _46 => _46.token, 'optionalAccess', _47 => _47.addresses, 'optionalAccess', _48 => _48[chainId]])));
|
|
966
1050
|
}
|
|
967
1051
|
function extractArray(data, key) {
|
|
968
1052
|
if (!data || typeof data !== "object") return null;
|
|
@@ -989,6 +1073,78 @@ function extractNumericString(data, key) {
|
|
|
989
1073
|
return Number.isFinite(parsed) ? parsed : null;
|
|
990
1074
|
}
|
|
991
1075
|
|
|
1076
|
+
// src/core/formatters.ts
|
|
1077
|
+
var currencyFormatter = new Intl.NumberFormat("en-US", {
|
|
1078
|
+
style: "currency",
|
|
1079
|
+
currency: "USD",
|
|
1080
|
+
maximumFractionDigits: 2
|
|
1081
|
+
});
|
|
1082
|
+
var tokenFormatter = new Intl.NumberFormat("en-US", {
|
|
1083
|
+
minimumFractionDigits: 2,
|
|
1084
|
+
maximumFractionDigits: 5
|
|
1085
|
+
});
|
|
1086
|
+
function isUnsupportedChainSwitchError(error) {
|
|
1087
|
+
if (!error) return false;
|
|
1088
|
+
const name = error instanceof Error ? error.name : "";
|
|
1089
|
+
const message = (error instanceof Error ? error.message : String(error)).toLowerCase();
|
|
1090
|
+
return name === "SwitchChainNotSupportedError" || message.includes("does not support programmatic chain switching") || message.includes("switch chain not supported") || message.includes("method not found") || message.includes("does not exist") || message.includes("is not available");
|
|
1091
|
+
}
|
|
1092
|
+
function formatUserError(raw) {
|
|
1093
|
+
const lower = raw.toLowerCase();
|
|
1094
|
+
if (lower.includes("user rejected") || lower.includes("user denied")) {
|
|
1095
|
+
return "Transaction cancelled";
|
|
1096
|
+
}
|
|
1097
|
+
if (lower.includes("insufficient funds")) {
|
|
1098
|
+
return "Insufficient funds for this transaction";
|
|
1099
|
+
}
|
|
1100
|
+
if (lower.includes("nonce too low") || lower.includes("nonce too high")) {
|
|
1101
|
+
return "Transaction conflict \u2014 please try again";
|
|
1102
|
+
}
|
|
1103
|
+
if (lower.includes("execution reverted")) {
|
|
1104
|
+
return "Transaction would fail on-chain";
|
|
1105
|
+
}
|
|
1106
|
+
if (lower.includes("timed out") || lower.includes("took too long")) {
|
|
1107
|
+
return "Request timed out \u2014 please try again";
|
|
1108
|
+
}
|
|
1109
|
+
if (lower.includes("econnrefused") || lower.includes("econnreset") || lower.includes("enotfound") || lower.includes("fetch failed")) {
|
|
1110
|
+
return "Service unavailable \u2014 please try again";
|
|
1111
|
+
}
|
|
1112
|
+
if (lower.includes("recent blockhash") || lower.includes("latest blockhash")) {
|
|
1113
|
+
return "Solana RPC unavailable \u2014 please retry";
|
|
1114
|
+
}
|
|
1115
|
+
if (lower.includes("network") || lower.includes("disconnected")) {
|
|
1116
|
+
return "Network error \u2014 check your connection";
|
|
1117
|
+
}
|
|
1118
|
+
if (lower.includes("rate limit") || lower.includes("429")) {
|
|
1119
|
+
return "Rate limited \u2014 please try again shortly";
|
|
1120
|
+
}
|
|
1121
|
+
let cleaned = raw;
|
|
1122
|
+
const stripMarkers = [
|
|
1123
|
+
"\n\nRequest Arguments:",
|
|
1124
|
+
"\nRaw Call Arguments:",
|
|
1125
|
+
"\nRequest body:",
|
|
1126
|
+
"\nContract Call:",
|
|
1127
|
+
"\nDocs:",
|
|
1128
|
+
"\nDetails:",
|
|
1129
|
+
"\nVersion:",
|
|
1130
|
+
"\nURL:"
|
|
1131
|
+
];
|
|
1132
|
+
for (const marker of stripMarkers) {
|
|
1133
|
+
const idx = cleaned.indexOf(marker);
|
|
1134
|
+
if (idx !== -1) {
|
|
1135
|
+
cleaned = cleaned.slice(0, idx).trim();
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
cleaned = cleaned.replace(/https?:\/\/\S+/g, "").trim();
|
|
1139
|
+
if (cleaned.length === 0) {
|
|
1140
|
+
return "An unexpected error occurred";
|
|
1141
|
+
}
|
|
1142
|
+
if (cleaned.length > 120) {
|
|
1143
|
+
return cleaned.slice(0, 120) + "...";
|
|
1144
|
+
}
|
|
1145
|
+
return cleaned;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
992
1148
|
// src/core/useLatestRef.ts
|
|
993
1149
|
|
|
994
1150
|
function useLatestRef(value) {
|
|
@@ -1101,19 +1257,19 @@ var CUSTOM_PRIMARY_VARS = [
|
|
|
1101
1257
|
function applyTheme(element, theme) {
|
|
1102
1258
|
if (!element) return;
|
|
1103
1259
|
const parent = element.parentElement;
|
|
1104
|
-
const targets = _optionalChain([parent, 'optionalAccess',
|
|
1105
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
1260
|
+
const targets = _optionalChain([parent, 'optionalAccess', _49 => _49.classList, 'access', _50 => _50.contains, 'call', _51 => _51("rs-modal-content")]) ? [element, parent] : [element];
|
|
1261
|
+
if (_optionalChain([theme, 'optionalAccess', _52 => _52.mode])) {
|
|
1106
1262
|
for (const t of targets) t.setAttribute("data-theme", theme.mode);
|
|
1107
1263
|
} else {
|
|
1108
1264
|
for (const t of targets) t.removeAttribute("data-theme");
|
|
1109
1265
|
}
|
|
1110
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
1266
|
+
if (_optionalChain([theme, 'optionalAccess', _53 => _53.fontColor])) {
|
|
1111
1267
|
setVar(targets, "--rs-foreground", theme.fontColor);
|
|
1112
1268
|
}
|
|
1113
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
1269
|
+
if (_optionalChain([theme, 'optionalAccess', _54 => _54.iconColor])) {
|
|
1114
1270
|
setVar(targets, "--rs-icon", theme.iconColor);
|
|
1115
1271
|
}
|
|
1116
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
1272
|
+
if (_optionalChain([theme, 'optionalAccess', _55 => _55.ctaColor])) {
|
|
1117
1273
|
const derived = deriveCustomPrimary(theme.ctaColor);
|
|
1118
1274
|
if (derived) {
|
|
1119
1275
|
setVar(targets, "--rs-primary", derived.base);
|
|
@@ -1138,18 +1294,18 @@ function applyTheme(element, theme) {
|
|
|
1138
1294
|
}
|
|
1139
1295
|
} else {
|
|
1140
1296
|
for (const v of CUSTOM_PRIMARY_VARS) clearVar(targets, v);
|
|
1141
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
1297
|
+
if (_optionalChain([theme, 'optionalAccess', _56 => _56.ctaHoverColor])) {
|
|
1142
1298
|
setVar(targets, "--rs-primary-hover", theme.ctaHoverColor);
|
|
1143
1299
|
}
|
|
1144
1300
|
}
|
|
1145
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
1301
|
+
if (_optionalChain([theme, 'optionalAccess', _57 => _57.borderColor])) {
|
|
1146
1302
|
setVar(targets, "--rs-border", theme.borderColor);
|
|
1147
1303
|
setVar(targets, "--rs-border-surface", theme.borderColor);
|
|
1148
1304
|
}
|
|
1149
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
1305
|
+
if (_optionalChain([theme, 'optionalAccess', _58 => _58.backgroundColor])) {
|
|
1150
1306
|
setVar(targets, "--rs-background", theme.backgroundColor);
|
|
1151
1307
|
}
|
|
1152
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
1308
|
+
if (_optionalChain([theme, 'optionalAccess', _59 => _59.radius])) {
|
|
1153
1309
|
const scale = RADIUS_SCALE[theme.radius];
|
|
1154
1310
|
setVar(targets, "--rs-radius-sm", scale.sm);
|
|
1155
1311
|
setVar(targets, "--rs-radius-md", scale.md);
|
|
@@ -1325,7 +1481,7 @@ function ListRow({
|
|
|
1325
1481
|
if (disabled) return;
|
|
1326
1482
|
if (e.key === "Enter" || e.key === " ") {
|
|
1327
1483
|
e.preventDefault();
|
|
1328
|
-
_optionalChain([onClick, 'optionalCall',
|
|
1484
|
+
_optionalChain([onClick, 'optionalCall', _60 => _60(e)]);
|
|
1329
1485
|
}
|
|
1330
1486
|
};
|
|
1331
1487
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1335,7 +1491,7 @@ function ListRow({
|
|
|
1335
1491
|
role: "button",
|
|
1336
1492
|
tabIndex: disabled ? -1 : 0,
|
|
1337
1493
|
"aria-disabled": disabled || void 0,
|
|
1338
|
-
onClick: disabled ? void 0 : (e) => _optionalChain([onClick, 'optionalCall',
|
|
1494
|
+
onClick: disabled ? void 0 : (e) => _optionalChain([onClick, 'optionalCall', _61 => _61(e)]),
|
|
1339
1495
|
onKeyDown: handleKey,
|
|
1340
1496
|
children: inner
|
|
1341
1497
|
}
|
|
@@ -1630,8 +1786,8 @@ function ConnectStep({
|
|
|
1630
1786
|
const hasReownWallet = rows.some(
|
|
1631
1787
|
(row) => row.kind === "external" || row.kind === "solana"
|
|
1632
1788
|
);
|
|
1633
|
-
const showDappImports = hasReownWallet && (_nullishCoalesce(_optionalChain([dappImports, 'optionalAccess',
|
|
1634
|
-
const extraChainCount = Math.max(0,
|
|
1789
|
+
const showDappImports = hasReownWallet && (_nullishCoalesce(_optionalChain([dappImports, 'optionalAccess', _62 => _62.length]), () => ( 0))) > 0;
|
|
1790
|
+
const extraChainCount = Math.max(0, _chunk7JIDIX27cjs.getSupportedChainIds.call(void 0, ).length - 3);
|
|
1635
1791
|
const chainBadge2 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1636
1792
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChainBadgeIcons, {}),
|
|
1637
1793
|
extraChainCount > 0 ? `+${extraChainCount} chains` : "All chains"
|
|
@@ -1663,14 +1819,14 @@ function ConnectStep({
|
|
|
1663
1819
|
rows.map((row) => {
|
|
1664
1820
|
const collapseToExternal = Boolean(onSelectTransferCrypto) && row.kind !== "solana";
|
|
1665
1821
|
const subtitleText = row.state === "loading" ? "Preparing\u2026" : row.state === "error" ? _nullishCoalesce(row.errorReason, () => ( "Couldn't prepare wallet \u2014 tap to retry")) : shorten(row.address);
|
|
1666
|
-
const showInlineDisconnect =
|
|
1822
|
+
const showInlineDisconnect = Boolean(onSelectTransferCrypto) && Boolean(onDisconnect) && row.state !== "loading";
|
|
1667
1823
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1668
1824
|
ListRow,
|
|
1669
1825
|
{
|
|
1670
1826
|
leading: renderWalletLeading(row),
|
|
1671
1827
|
title: collapseToExternal ? "External wallet" : row.label,
|
|
1672
1828
|
subtitle: subtitleText,
|
|
1673
|
-
onClick: () => _optionalChain([onConfirmWallet, 'optionalCall',
|
|
1829
|
+
onClick: () => _optionalChain([onConfirmWallet, 'optionalCall', _63 => _63(row.id)]),
|
|
1674
1830
|
disabled: row.state === "loading",
|
|
1675
1831
|
trailing: renderRowTrailing(row.state),
|
|
1676
1832
|
action: showInlineDisconnect && onDisconnect ? { label: "Disconnect", onClick: onDisconnect } : void 0
|
|
@@ -1691,7 +1847,7 @@ function ConnectStep({
|
|
|
1691
1847
|
onClick: handleConnect
|
|
1692
1848
|
}
|
|
1693
1849
|
),
|
|
1694
|
-
showDappImports && _optionalChain([dappImports, 'optionalAccess',
|
|
1850
|
+
showDappImports && _optionalChain([dappImports, 'optionalAccess', _64 => _64.map, 'call', _65 => _65((row) => {
|
|
1695
1851
|
if (row.status === "loading") {
|
|
1696
1852
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1697
1853
|
ListRow,
|
|
@@ -1712,7 +1868,7 @@ function ConnectStep({
|
|
|
1712
1868
|
leading: row.icon,
|
|
1713
1869
|
title: row.label,
|
|
1714
1870
|
subtitle: formatBalanceUsd(row.status.balanceUsd),
|
|
1715
|
-
onClick: () => _optionalChain([onSelectDappImport, 'optionalCall',
|
|
1871
|
+
onClick: () => _optionalChain([onSelectDappImport, 'optionalCall', _66 => _66(row.id)])
|
|
1716
1872
|
},
|
|
1717
1873
|
row.id
|
|
1718
1874
|
);
|
|
@@ -1724,7 +1880,7 @@ function ConnectStep({
|
|
|
1724
1880
|
leading: row.icon,
|
|
1725
1881
|
title: row.label,
|
|
1726
1882
|
subtitle: row.status.reason,
|
|
1727
|
-
onClick: () => _optionalChain([onSelectDappImport, 'optionalCall',
|
|
1883
|
+
onClick: () => _optionalChain([onSelectDappImport, 'optionalCall', _67 => _67(row.id)])
|
|
1728
1884
|
},
|
|
1729
1885
|
row.id
|
|
1730
1886
|
);
|
|
@@ -1747,71 +1903,6 @@ function ConnectStep({
|
|
|
1747
1903
|
}
|
|
1748
1904
|
ConnectStep.displayName = "ConnectStep";
|
|
1749
1905
|
|
|
1750
|
-
// src/core/formatters.ts
|
|
1751
|
-
var currencyFormatter = new Intl.NumberFormat("en-US", {
|
|
1752
|
-
style: "currency",
|
|
1753
|
-
currency: "USD",
|
|
1754
|
-
maximumFractionDigits: 2
|
|
1755
|
-
});
|
|
1756
|
-
var tokenFormatter = new Intl.NumberFormat("en-US", {
|
|
1757
|
-
maximumFractionDigits: 6
|
|
1758
|
-
});
|
|
1759
|
-
function formatUserError(raw) {
|
|
1760
|
-
const lower = raw.toLowerCase();
|
|
1761
|
-
if (lower.includes("user rejected") || lower.includes("user denied")) {
|
|
1762
|
-
return "Transaction cancelled";
|
|
1763
|
-
}
|
|
1764
|
-
if (lower.includes("insufficient funds")) {
|
|
1765
|
-
return "Insufficient funds for this transaction";
|
|
1766
|
-
}
|
|
1767
|
-
if (lower.includes("nonce too low") || lower.includes("nonce too high")) {
|
|
1768
|
-
return "Transaction conflict \u2014 please try again";
|
|
1769
|
-
}
|
|
1770
|
-
if (lower.includes("execution reverted")) {
|
|
1771
|
-
return "Transaction would fail on-chain";
|
|
1772
|
-
}
|
|
1773
|
-
if (lower.includes("timed out") || lower.includes("took too long")) {
|
|
1774
|
-
return "Request timed out \u2014 please try again";
|
|
1775
|
-
}
|
|
1776
|
-
if (lower.includes("econnrefused") || lower.includes("econnreset") || lower.includes("enotfound") || lower.includes("fetch failed")) {
|
|
1777
|
-
return "Service unavailable \u2014 please try again";
|
|
1778
|
-
}
|
|
1779
|
-
if (lower.includes("recent blockhash") || lower.includes("latest blockhash")) {
|
|
1780
|
-
return "Solana RPC unavailable \u2014 please retry";
|
|
1781
|
-
}
|
|
1782
|
-
if (lower.includes("network") || lower.includes("disconnected")) {
|
|
1783
|
-
return "Network error \u2014 check your connection";
|
|
1784
|
-
}
|
|
1785
|
-
if (lower.includes("rate limit") || lower.includes("429")) {
|
|
1786
|
-
return "Rate limited \u2014 please try again shortly";
|
|
1787
|
-
}
|
|
1788
|
-
let cleaned = raw;
|
|
1789
|
-
const stripMarkers = [
|
|
1790
|
-
"\n\nRequest Arguments:",
|
|
1791
|
-
"\nRaw Call Arguments:",
|
|
1792
|
-
"\nRequest body:",
|
|
1793
|
-
"\nContract Call:",
|
|
1794
|
-
"\nDocs:",
|
|
1795
|
-
"\nDetails:",
|
|
1796
|
-
"\nVersion:",
|
|
1797
|
-
"\nURL:"
|
|
1798
|
-
];
|
|
1799
|
-
for (const marker of stripMarkers) {
|
|
1800
|
-
const idx = cleaned.indexOf(marker);
|
|
1801
|
-
if (idx !== -1) {
|
|
1802
|
-
cleaned = cleaned.slice(0, idx).trim();
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
cleaned = cleaned.replace(/https?:\/\/\S+/g, "").trim();
|
|
1806
|
-
if (cleaned.length === 0) {
|
|
1807
|
-
return "An unexpected error occurred";
|
|
1808
|
-
}
|
|
1809
|
-
if (cleaned.length > 120) {
|
|
1810
|
-
return cleaned.slice(0, 120) + "...";
|
|
1811
|
-
}
|
|
1812
|
-
return cleaned;
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
1906
|
// src/components/steps/ProcessingStep.tsx
|
|
1816
1907
|
|
|
1817
1908
|
var _viem = require('viem');
|
|
@@ -1885,8 +1976,8 @@ function Tooltip({ content, children, className }) {
|
|
|
1885
1976
|
function handleOutside(event) {
|
|
1886
1977
|
const target = event.target;
|
|
1887
1978
|
if (!target) return;
|
|
1888
|
-
if (_optionalChain([triggerRef, 'access',
|
|
1889
|
-
if (_optionalChain([bubbleRef, 'access',
|
|
1979
|
+
if (_optionalChain([triggerRef, 'access', _68 => _68.current, 'optionalAccess', _69 => _69.contains, 'call', _70 => _70(target)])) return;
|
|
1980
|
+
if (_optionalChain([bubbleRef, 'access', _71 => _71.current, 'optionalAccess', _72 => _72.contains, 'call', _73 => _73(target)])) return;
|
|
1890
1981
|
setOpen(false);
|
|
1891
1982
|
}
|
|
1892
1983
|
function handleKey(event) {
|
|
@@ -1953,6 +2044,46 @@ function Tooltip({ content, children, className }) {
|
|
|
1953
2044
|
}
|
|
1954
2045
|
Tooltip.displayName = "Tooltip";
|
|
1955
2046
|
|
|
2047
|
+
// src/components/ui/Callout.tsx
|
|
2048
|
+
|
|
2049
|
+
function CircleAlertIcon() {
|
|
2050
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2051
|
+
"svg",
|
|
2052
|
+
{
|
|
2053
|
+
width: "16",
|
|
2054
|
+
height: "16",
|
|
2055
|
+
viewBox: "0 0 16 16",
|
|
2056
|
+
fill: "none",
|
|
2057
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2058
|
+
"aria-hidden": "true",
|
|
2059
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2060
|
+
"path",
|
|
2061
|
+
{
|
|
2062
|
+
d: "M10 5.99992L6 9.99992M6 5.99992L10 9.99992M14.6667 7.99992C14.6667 11.6818 11.6819 14.6666 8 14.6666C4.3181 14.6666 1.33333 11.6818 1.33333 7.99992C1.33333 4.31802 4.3181 1.33325 8 1.33325C11.6819 1.33325 14.6667 4.31802 14.6667 7.99992Z",
|
|
2063
|
+
stroke: "currentColor",
|
|
2064
|
+
strokeWidth: "1.33333",
|
|
2065
|
+
strokeLinecap: "round",
|
|
2066
|
+
strokeLinejoin: "round"
|
|
2067
|
+
}
|
|
2068
|
+
)
|
|
2069
|
+
}
|
|
2070
|
+
);
|
|
2071
|
+
}
|
|
2072
|
+
function Callout({ variant = "error", children, role }) {
|
|
2073
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2074
|
+
"div",
|
|
2075
|
+
{
|
|
2076
|
+
className: `rs-callout rs-callout--${variant}`,
|
|
2077
|
+
role: _nullishCoalesce(role, () => ( (variant === "error" ? "alert" : "status"))),
|
|
2078
|
+
children: [
|
|
2079
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-callout-icon", children: variant === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CircleAlertIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertTriangleIcon, {}) }),
|
|
2080
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-callout-text", children })
|
|
2081
|
+
]
|
|
2082
|
+
}
|
|
2083
|
+
);
|
|
2084
|
+
}
|
|
2085
|
+
Callout.displayName = "Callout";
|
|
2086
|
+
|
|
1956
2087
|
// src/core/webhook.ts
|
|
1957
2088
|
function isRecord(value) {
|
|
1958
2089
|
return typeof value === "object" && value !== null;
|
|
@@ -1966,7 +2097,7 @@ function asNumber(value) {
|
|
|
1966
2097
|
const trimmed = value.trim();
|
|
1967
2098
|
if (!trimmed) return void 0;
|
|
1968
2099
|
const caipMatch = trimmed.match(/^eip155:(\d+)$/);
|
|
1969
|
-
if (_optionalChain([caipMatch, 'optionalAccess',
|
|
2100
|
+
if (_optionalChain([caipMatch, 'optionalAccess', _74 => _74[1]])) {
|
|
1970
2101
|
const parsed2 = Number(caipMatch[1]);
|
|
1971
2102
|
return Number.isFinite(parsed2) ? parsed2 : void 0;
|
|
1972
2103
|
}
|
|
@@ -1985,28 +2116,28 @@ function asAddress(value) {
|
|
|
1985
2116
|
return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
|
|
1986
2117
|
}
|
|
1987
2118
|
function getEventTxHash(event) {
|
|
1988
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
2119
|
+
if (!_optionalChain([event, 'optionalAccess', _75 => _75.type])) return void 0;
|
|
1989
2120
|
if (event.type === "deposit-received") {
|
|
1990
|
-
return asString(_optionalChain([event, 'access',
|
|
2121
|
+
return asString(_optionalChain([event, 'access', _76 => _76.data, 'optionalAccess', _77 => _77.transactionHash]));
|
|
1991
2122
|
}
|
|
1992
2123
|
if (event.type === "bridge-started" || event.type === "bridge-complete") {
|
|
1993
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
1994
|
-
const source = isRecord(_optionalChain([event, 'access',
|
|
1995
|
-
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess',
|
|
2124
|
+
const deposit = isRecord(_optionalChain([event, 'access', _78 => _78.data, 'optionalAccess', _79 => _79.deposit])) ? event.data.deposit : void 0;
|
|
2125
|
+
const source = isRecord(_optionalChain([event, 'access', _80 => _80.data, 'optionalAccess', _81 => _81.source])) ? event.data.source : void 0;
|
|
2126
|
+
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _82 => _82.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _83 => _83.transactionHash]))));
|
|
1996
2127
|
}
|
|
1997
2128
|
if (event.type === "bridge-failed" || event.type === "error") {
|
|
1998
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
1999
|
-
const source = isRecord(_optionalChain([event, 'access',
|
|
2000
|
-
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess',
|
|
2129
|
+
const deposit = isRecord(_optionalChain([event, 'access', _84 => _84.data, 'optionalAccess', _85 => _85.deposit])) ? event.data.deposit : void 0;
|
|
2130
|
+
const source = isRecord(_optionalChain([event, 'access', _86 => _86.data, 'optionalAccess', _87 => _87.source])) ? event.data.source : void 0;
|
|
2131
|
+
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _88 => _88.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _89 => _89.transactionHash]))));
|
|
2001
2132
|
}
|
|
2002
2133
|
if (event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed") {
|
|
2003
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
2004
|
-
return asString(_optionalChain([deposit, 'optionalAccess',
|
|
2134
|
+
const deposit = isRecord(_optionalChain([event, 'access', _90 => _90.data, 'optionalAccess', _91 => _91.deposit])) ? event.data.deposit : void 0;
|
|
2135
|
+
return asString(_optionalChain([deposit, 'optionalAccess', _92 => _92.transactionHash]));
|
|
2005
2136
|
}
|
|
2006
2137
|
return void 0;
|
|
2007
2138
|
}
|
|
2008
2139
|
function getEventSourceDetails(event) {
|
|
2009
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
2140
|
+
if (!_optionalChain([event, 'optionalAccess', _93 => _93.type]) || !isRecord(event.data)) return {};
|
|
2010
2141
|
if (event.type === "deposit-received") {
|
|
2011
2142
|
return {
|
|
2012
2143
|
chainId: asNumber(event.data.chain),
|
|
@@ -2018,15 +2149,15 @@ function getEventSourceDetails(event) {
|
|
|
2018
2149
|
const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
|
|
2019
2150
|
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") {
|
|
2020
2151
|
return {
|
|
2021
|
-
chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess',
|
|
2022
|
-
amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess',
|
|
2023
|
-
token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess',
|
|
2152
|
+
chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess', _94 => _94.chain])), () => ( asNumber(_optionalChain([deposit, 'optionalAccess', _95 => _95.chain])))),
|
|
2153
|
+
amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess', _96 => _96.amount])), () => ( asAmount(_optionalChain([deposit, 'optionalAccess', _97 => _97.amount])))),
|
|
2154
|
+
token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess', _98 => _98.asset])), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _99 => _99.asset])))), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _100 => _100.token]))))
|
|
2024
2155
|
};
|
|
2025
2156
|
}
|
|
2026
2157
|
return {};
|
|
2027
2158
|
}
|
|
2028
2159
|
function isDepositEvent(event) {
|
|
2029
|
-
return _optionalChain([event, 'optionalAccess',
|
|
2160
|
+
return _optionalChain([event, 'optionalAccess', _101 => _101.type]) === "deposit-received" || _optionalChain([event, 'optionalAccess', _102 => _102.type]) === "bridge-started" || _optionalChain([event, 'optionalAccess', _103 => _103.type]) === "bridge-complete" || _optionalChain([event, 'optionalAccess', _104 => _104.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _105 => _105.type]) === "post-bridge-swap-complete" || _optionalChain([event, 'optionalAccess', _106 => _106.type]) === "post-bridge-swap-failed" || _optionalChain([event, 'optionalAccess', _107 => _107.type]) === "error";
|
|
2030
2161
|
}
|
|
2031
2162
|
function isHexString(value) {
|
|
2032
2163
|
return value.startsWith("0x") || value.startsWith("0X");
|
|
@@ -2138,7 +2269,7 @@ function isEventForTx(event, txHash) {
|
|
|
2138
2269
|
return txRefsMatch(eventTxHash, txHash);
|
|
2139
2270
|
}
|
|
2140
2271
|
function formatBridgeFailedMessage(event) {
|
|
2141
|
-
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
2272
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _108 => _108.data]), () => ( {}));
|
|
2142
2273
|
const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
|
|
2143
2274
|
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
2144
2275
|
function toUserFacingFailure(raw) {
|
|
@@ -2170,12 +2301,12 @@ function formatBridgeFailedMessage(event) {
|
|
|
2170
2301
|
return { message: "Bridge failed" };
|
|
2171
2302
|
}
|
|
2172
2303
|
function parseWebhookTimestamp(event) {
|
|
2173
|
-
if (typeof _optionalChain([event, 'optionalAccess',
|
|
2304
|
+
if (typeof _optionalChain([event, 'optionalAccess', _109 => _109.time]) !== "string") return void 0;
|
|
2174
2305
|
const timestamp = Date.parse(event.time);
|
|
2175
2306
|
return Number.isFinite(timestamp) ? timestamp : void 0;
|
|
2176
2307
|
}
|
|
2177
2308
|
function syncPhaseTimings(previous, event) {
|
|
2178
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
2309
|
+
if (!_optionalChain([event, 'optionalAccess', _110 => _110.type])) return previous;
|
|
2179
2310
|
const timestamp = _nullishCoalesce(parseWebhookTimestamp(event), () => ( Date.now()));
|
|
2180
2311
|
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;
|
|
2181
2312
|
const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "post-bridge-swap-complete") && previous.bridgingAt === void 0;
|
|
@@ -2216,9 +2347,9 @@ function getCurrentPhaseId(state, phaseTimings, isEarlyComplete) {
|
|
|
2216
2347
|
if (state.type === "complete") {
|
|
2217
2348
|
return void 0;
|
|
2218
2349
|
}
|
|
2219
|
-
if (_optionalChain([state, 'access',
|
|
2350
|
+
if (_optionalChain([state, 'access', _111 => _111.lastEvent, 'optionalAccess', _112 => _112.type]) === "bridge-started" || _optionalChain([state, 'access', _113 => _113.lastEvent, 'optionalAccess', _114 => _114.type]) === "bridge-complete")
|
|
2220
2351
|
return "bridging";
|
|
2221
|
-
if (_optionalChain([state, 'access',
|
|
2352
|
+
if (_optionalChain([state, 'access', _115 => _115.lastEvent, 'optionalAccess', _116 => _116.type]) === "deposit-received") return "received";
|
|
2222
2353
|
return "confirming";
|
|
2223
2354
|
}
|
|
2224
2355
|
function ProcessingStep({
|
|
@@ -2292,7 +2423,7 @@ function ProcessingStep({
|
|
|
2292
2423
|
flowLabel
|
|
2293
2424
|
});
|
|
2294
2425
|
const context = processingContextRef.current;
|
|
2295
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
2426
|
+
_optionalChain([onDepositCompleteRef, 'access', _117 => _117.current, 'optionalCall', _118 => _118(txHash, void 0, {
|
|
2296
2427
|
amount: context.amount,
|
|
2297
2428
|
sourceChain: context.sourceChain,
|
|
2298
2429
|
sourceToken: context.sourceToken,
|
|
@@ -2329,7 +2460,7 @@ function ProcessingStep({
|
|
|
2329
2460
|
_react.useEffect.call(void 0, () => {
|
|
2330
2461
|
if (!state.lastEvent) return;
|
|
2331
2462
|
setPhaseTimings((previous) => syncPhaseTimings(previous, state.lastEvent));
|
|
2332
|
-
}, [_optionalChain([state, 'access',
|
|
2463
|
+
}, [_optionalChain([state, 'access', _119 => _119.lastEvent, 'optionalAccess', _120 => _120.time]), _optionalChain([state, 'access', _121 => _121.lastEvent, 'optionalAccess', _122 => _122.type])]);
|
|
2333
2464
|
_react.useEffect.call(void 0, () => {
|
|
2334
2465
|
savePhaseTimings(txHash, phaseTimings);
|
|
2335
2466
|
}, [txHash, phaseTimings]);
|
|
@@ -2357,21 +2488,21 @@ function ProcessingStep({
|
|
|
2357
2488
|
debugLog(debug, "processing", "poll:event", {
|
|
2358
2489
|
type: lastEvent2.type,
|
|
2359
2490
|
matchesTx: eventMatchesTx,
|
|
2360
|
-
intentId: _optionalChain([eventData, 'optionalAccess',
|
|
2491
|
+
intentId: _optionalChain([eventData, 'optionalAccess', _123 => _123.intentId])
|
|
2361
2492
|
});
|
|
2362
2493
|
}
|
|
2363
2494
|
if (!isMounted) return;
|
|
2364
2495
|
const awaitingPostBridgeSwap = processingContextRef.current.waitForFinalTx && processingContextRef.current.hasPostBridgeActions;
|
|
2365
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
2496
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _124 => _124.type]) === "post-bridge-swap-complete") {
|
|
2366
2497
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
2367
|
-
const swapTxHash = _optionalChain([eventForCurrentTx, 'access',
|
|
2498
|
+
const swapTxHash = _optionalChain([eventForCurrentTx, 'access', _125 => _125.data, 'optionalAccess', _126 => _126.swap, 'optionalAccess', _127 => _127.transactionHash]);
|
|
2368
2499
|
debugLog(debug, "processing", "state:complete", {
|
|
2369
2500
|
txHash,
|
|
2370
2501
|
destinationTxHash: swapTxHash,
|
|
2371
2502
|
event: eventForCurrentTx.type
|
|
2372
2503
|
});
|
|
2373
2504
|
const context = processingContextRef.current;
|
|
2374
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
2505
|
+
_optionalChain([onDepositCompleteRef, 'access', _128 => _128.current, 'optionalCall', _129 => _129(txHash, swapTxHash, {
|
|
2375
2506
|
amount: context.amount,
|
|
2376
2507
|
sourceChain: context.sourceChain,
|
|
2377
2508
|
sourceToken: context.sourceToken,
|
|
@@ -2380,7 +2511,7 @@ function ProcessingStep({
|
|
|
2380
2511
|
})]);
|
|
2381
2512
|
return;
|
|
2382
2513
|
}
|
|
2383
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
2514
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _130 => _130.type]) === "post-bridge-swap-failed") {
|
|
2384
2515
|
const formatted = formatBridgeFailedMessage(eventForCurrentTx);
|
|
2385
2516
|
setState({
|
|
2386
2517
|
type: "failed",
|
|
@@ -2392,19 +2523,19 @@ function ProcessingStep({
|
|
|
2392
2523
|
message: formatted.message,
|
|
2393
2524
|
code: formatted.code
|
|
2394
2525
|
});
|
|
2395
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
2526
|
+
_optionalChain([onDepositFailedRef, 'access', _131 => _131.current, 'optionalCall', _132 => _132(txHash, formatted.message)]);
|
|
2396
2527
|
return;
|
|
2397
2528
|
}
|
|
2398
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
2529
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _133 => _133.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
|
|
2399
2530
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
2400
|
-
const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access',
|
|
2531
|
+
const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access', _134 => _134.data, 'optionalAccess', _135 => _135.destination, 'optionalAccess', _136 => _136.transactionHash]);
|
|
2401
2532
|
debugLog(debug, "processing", "state:complete", {
|
|
2402
2533
|
txHash,
|
|
2403
2534
|
destinationTxHash: destinationTxHash2,
|
|
2404
2535
|
event: eventForCurrentTx.type
|
|
2405
2536
|
});
|
|
2406
2537
|
const context = processingContextRef.current;
|
|
2407
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
2538
|
+
_optionalChain([onDepositCompleteRef, 'access', _137 => _137.current, 'optionalCall', _138 => _138(txHash, destinationTxHash2, {
|
|
2408
2539
|
amount: context.amount,
|
|
2409
2540
|
sourceChain: context.sourceChain,
|
|
2410
2541
|
sourceToken: context.sourceToken,
|
|
@@ -2413,14 +2544,14 @@ function ProcessingStep({
|
|
|
2413
2544
|
})]);
|
|
2414
2545
|
return;
|
|
2415
2546
|
}
|
|
2416
|
-
if (!waitForFinalTx && _optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
2547
|
+
if (!waitForFinalTx && _optionalChain([eventForCurrentTx, 'optionalAccess', _139 => _139.type]) === "bridge-started") {
|
|
2417
2548
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
2418
2549
|
debugLog(debug, "processing", "state:early-complete", {
|
|
2419
2550
|
txHash,
|
|
2420
2551
|
event: eventForCurrentTx.type
|
|
2421
2552
|
});
|
|
2422
2553
|
const context = processingContextRef.current;
|
|
2423
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
2554
|
+
_optionalChain([onDepositCompleteRef, 'access', _140 => _140.current, 'optionalCall', _141 => _141(txHash, void 0, {
|
|
2424
2555
|
amount: context.amount,
|
|
2425
2556
|
sourceChain: context.sourceChain,
|
|
2426
2557
|
sourceToken: context.sourceToken,
|
|
@@ -2429,7 +2560,7 @@ function ProcessingStep({
|
|
|
2429
2560
|
})]);
|
|
2430
2561
|
return;
|
|
2431
2562
|
}
|
|
2432
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
2563
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _142 => _142.type]) === "bridge-failed") {
|
|
2433
2564
|
const formatted = formatBridgeFailedMessage(eventForCurrentTx);
|
|
2434
2565
|
setState({
|
|
2435
2566
|
type: "failed",
|
|
@@ -2441,11 +2572,11 @@ function ProcessingStep({
|
|
|
2441
2572
|
message: formatted.message,
|
|
2442
2573
|
code: formatted.code
|
|
2443
2574
|
});
|
|
2444
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
2575
|
+
_optionalChain([onDepositFailedRef, 'access', _143 => _143.current, 'optionalCall', _144 => _144(txHash, formatted.message)]);
|
|
2445
2576
|
return;
|
|
2446
2577
|
}
|
|
2447
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
2448
|
-
const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access',
|
|
2578
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _145 => _145.type]) === "error") {
|
|
2579
|
+
const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access', _146 => _146.data, 'optionalAccess', _147 => _147.message]), () => ( "Unknown error"));
|
|
2449
2580
|
setState({
|
|
2450
2581
|
type: "failed",
|
|
2451
2582
|
message: errorMessage,
|
|
@@ -2455,7 +2586,7 @@ function ProcessingStep({
|
|
|
2455
2586
|
txHash,
|
|
2456
2587
|
message: errorMessage
|
|
2457
2588
|
});
|
|
2458
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
2589
|
+
_optionalChain([onDepositFailedRef, 'access', _148 => _148.current, 'optionalCall', _149 => _149(txHash, errorMessage)]);
|
|
2459
2590
|
return;
|
|
2460
2591
|
}
|
|
2461
2592
|
setState((previous) => ({
|
|
@@ -2516,7 +2647,7 @@ function ProcessingStep({
|
|
|
2516
2647
|
txHash,
|
|
2517
2648
|
timeoutMs: ESCALATED_DELAY_MS
|
|
2518
2649
|
});
|
|
2519
|
-
_optionalChain([onErrorRef, 'access',
|
|
2650
|
+
_optionalChain([onErrorRef, 'access', _150 => _150.current, 'optionalCall', _151 => _151(message, "PROCESS_TIMEOUT")]);
|
|
2520
2651
|
}, ESCALATED_DELAY_MS);
|
|
2521
2652
|
return () => clearTimeout(timeoutId);
|
|
2522
2653
|
}, [debug, directTransfer, onErrorRef, state.type, txHash]);
|
|
@@ -2525,21 +2656,21 @@ function ProcessingStep({
|
|
|
2525
2656
|
const isProcessing = state.type === "processing";
|
|
2526
2657
|
const lastEvent = state.lastEvent;
|
|
2527
2658
|
const failureMessage = state.type === "failed" ? state.message : void 0;
|
|
2528
|
-
const isEarlyComplete = !waitForFinalTx && _optionalChain([lastEvent, 'optionalAccess',
|
|
2659
|
+
const isEarlyComplete = !waitForFinalTx && _optionalChain([lastEvent, 'optionalAccess', _152 => _152.type]) === "bridge-started";
|
|
2529
2660
|
const timelineNowMs = _nullishCoalesce(phaseTimings.endedAt, () => ( Date.now()));
|
|
2530
2661
|
const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
|
|
2531
2662
|
const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
|
|
2532
|
-
const isPostBridgeSwapEvent = _optionalChain([lastEvent, 'optionalAccess',
|
|
2533
|
-
const destinationTxHash = isPostBridgeSwapEvent ? _optionalChain([lastEvent, 'optionalAccess',
|
|
2663
|
+
const isPostBridgeSwapEvent = _optionalChain([lastEvent, 'optionalAccess', _153 => _153.type]) === "post-bridge-swap-complete" || _optionalChain([lastEvent, 'optionalAccess', _154 => _154.type]) === "post-bridge-swap-failed";
|
|
2664
|
+
const destinationTxHash = isPostBridgeSwapEvent ? _optionalChain([lastEvent, 'optionalAccess', _155 => _155.data, 'optionalAccess', _156 => _156.swap, 'optionalAccess', _157 => _157.transactionHash]) || null : _optionalChain([lastEvent, 'optionalAccess', _158 => _158.data, 'optionalAccess', _159 => _159.destination, 'optionalAccess', _160 => _160.transactionHash]) || null;
|
|
2534
2665
|
const sourceDetails = getEventSourceDetails(lastEvent);
|
|
2535
2666
|
const displaySourceChain = _nullishCoalesce(sourceDetails.chainId, () => ( sourceChain));
|
|
2536
2667
|
const displaySourceToken = _nullishCoalesce(sourceDetails.token, () => ( sourceToken));
|
|
2537
2668
|
const displayAmount = _nullishCoalesce(sourceDetails.amount, () => ( amount));
|
|
2538
|
-
const sourceExplorerUrl =
|
|
2539
|
-
const destExplorerUrl = destinationTxHash ?
|
|
2669
|
+
const sourceExplorerUrl = _chunk7JIDIX27cjs.getExplorerTxUrl.call(void 0, displaySourceChain, txHash);
|
|
2670
|
+
const destExplorerUrl = destinationTxHash ? _chunk7JIDIX27cjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
|
|
2540
2671
|
const isEvmSourceToken = /^0x[a-fA-F0-9]{40}$/.test(displaySourceToken);
|
|
2541
|
-
const sourceSymbol = displaySourceChain === "solana" ? _nullishCoalesce(providedSourceSymbol, () => ( "SOL")) : isEvmSourceToken ?
|
|
2542
|
-
const sourceDecimals = displaySourceChain === "solana" ? _nullishCoalesce(providedSourceDecimals, () => ( 9)) : isEvmSourceToken ?
|
|
2672
|
+
const sourceSymbol = displaySourceChain === "solana" ? _nullishCoalesce(providedSourceSymbol, () => ( "SOL")) : isEvmSourceToken ? _chunk7JIDIX27cjs.getTokenSymbol.call(void 0, displaySourceToken, displaySourceChain) : _nullishCoalesce(providedSourceSymbol, () => ( "Token"));
|
|
2673
|
+
const sourceDecimals = displaySourceChain === "solana" ? _nullishCoalesce(providedSourceDecimals, () => ( 9)) : isEvmSourceToken ? _chunk7JIDIX27cjs.getTokenDecimalsByAddress.call(void 0,
|
|
2543
2674
|
displaySourceToken,
|
|
2544
2675
|
displaySourceChain
|
|
2545
2676
|
) : _nullishCoalesce(providedSourceDecimals, () => ( 18));
|
|
@@ -2562,20 +2693,18 @@ function ProcessingStep({
|
|
|
2562
2693
|
void delayPhaseId;
|
|
2563
2694
|
void hasEscalatedDelay;
|
|
2564
2695
|
const targetSymbol = (() => {
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
}
|
|
2568
|
-
return _nullishCoalesce(providedSourceSymbol, () => ( "USDC"));
|
|
2696
|
+
const resolved = _chunk7JIDIX27cjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
2697
|
+
return resolved !== "Token" ? resolved : _nullishCoalesce(providedSourceSymbol, () => ( "USDC"));
|
|
2569
2698
|
})();
|
|
2570
|
-
const targetTokenIcon =
|
|
2571
|
-
const sourceChainIcon =
|
|
2572
|
-
const targetChainIcon =
|
|
2573
|
-
const sourceTokenIcon =
|
|
2574
|
-
const sourceChainName =
|
|
2575
|
-
const targetChainName =
|
|
2699
|
+
const targetTokenIcon = _chunk7JIDIX27cjs.getTokenIcon.call(void 0, targetSymbol);
|
|
2700
|
+
const sourceChainIcon = _chunk7JIDIX27cjs.getChainIcon.call(void 0, displaySourceChain);
|
|
2701
|
+
const targetChainIcon = _chunk7JIDIX27cjs.getChainIcon.call(void 0, targetChain);
|
|
2702
|
+
const sourceTokenIcon = _chunk7JIDIX27cjs.getTokenIcon.call(void 0, sourceSymbol);
|
|
2703
|
+
const sourceChainName = _chunk7JIDIX27cjs.getChainName.call(void 0, displaySourceChain);
|
|
2704
|
+
const targetChainName = _chunk7JIDIX27cjs.getChainName.call(void 0, targetChain);
|
|
2576
2705
|
const totalTimeText = formatElapsedTime(elapsedSeconds);
|
|
2577
|
-
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2578
|
-
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2706
|
+
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _161 => _161.feeSponsored]), () => ( false));
|
|
2707
|
+
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _162 => _162.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
|
|
2579
2708
|
const stateTitle = isComplete ? `${flowCapitalized} successful` : isFailed ? `${flowCapitalized} failed` : "Processing...";
|
|
2580
2709
|
const handleRetry = _nullishCoalesce(onRetry, () => ( onNewDeposit));
|
|
2581
2710
|
const headerContent = isComplete ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header", children: [
|
|
@@ -2666,17 +2795,14 @@ function ProcessingStep({
|
|
|
2666
2795
|
"span",
|
|
2667
2796
|
{
|
|
2668
2797
|
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
2669
|
-
children: "$0.
|
|
2798
|
+
children: "$0.04"
|
|
2670
2799
|
}
|
|
2671
2800
|
),
|
|
2672
2801
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Tooltip, { content: feeTooltip, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfoIcon, {}) }) })
|
|
2673
2802
|
] })
|
|
2674
2803
|
] })
|
|
2675
2804
|
] }),
|
|
2676
|
-
isFailed && failureMessage && /* @__PURE__ */ _jsxruntime.
|
|
2677
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
|
|
2678
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: failureMessage })
|
|
2679
|
-
] }),
|
|
2805
|
+
isFailed && failureMessage && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Callout, { variant: "error", children: failureMessage }),
|
|
2680
2806
|
isProcessing && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2681
2807
|
Button,
|
|
2682
2808
|
{
|
|
@@ -2781,7 +2907,7 @@ async function executeSafeEthTransfer(params) {
|
|
|
2781
2907
|
throw new Error("Wallet not connected");
|
|
2782
2908
|
}
|
|
2783
2909
|
if (chain.id !== chainId) {
|
|
2784
|
-
throw new Error(`Switch to ${
|
|
2910
|
+
throw new Error(`Switch to ${_chunk7JIDIX27cjs.getChainName.call(void 0, chainId)} to sign`);
|
|
2785
2911
|
}
|
|
2786
2912
|
const isOwner = await publicClient.readContract({
|
|
2787
2913
|
address: safeAddress,
|
|
@@ -2864,7 +2990,7 @@ async function executeSafeErc20Transfer(params) {
|
|
|
2864
2990
|
throw new Error("Wallet not connected");
|
|
2865
2991
|
}
|
|
2866
2992
|
if (chain.id !== chainId) {
|
|
2867
|
-
throw new Error(`Switch to ${
|
|
2993
|
+
throw new Error(`Switch to ${_chunk7JIDIX27cjs.getChainName.call(void 0, chainId)} to sign`);
|
|
2868
2994
|
}
|
|
2869
2995
|
const isOwner = await publicClient.readContract({
|
|
2870
2996
|
address: safeAddress,
|
|
@@ -2994,7 +3120,7 @@ var clientCache = /* @__PURE__ */ new Map();
|
|
|
2994
3120
|
function getPublicClient(chainId) {
|
|
2995
3121
|
let client = clientCache.get(chainId);
|
|
2996
3122
|
if (!client) {
|
|
2997
|
-
const chain =
|
|
3123
|
+
const chain = _chunk7JIDIX27cjs.CHAIN_BY_ID[chainId];
|
|
2998
3124
|
client = _viem.createPublicClient.call(void 0, {
|
|
2999
3125
|
chain,
|
|
3000
3126
|
transport: _viem.http.call(void 0, )
|
|
@@ -3107,4 +3233,5 @@ function accountFromPrivateKey(privateKey) {
|
|
|
3107
3233
|
|
|
3108
3234
|
|
|
3109
3235
|
|
|
3110
|
-
|
|
3236
|
+
|
|
3237
|
+
exports.Modal = Modal; exports.WalletIcon = WalletIcon; exports.ExternalLinkIcon = ExternalLinkIcon; exports.CheckIcon = CheckIcon; exports.TransferCryptoIcon = TransferCryptoIcon; exports.ChevronLeftIcon = ChevronLeftIcon; exports.ChevronDownIcon = ChevronDownIcon; exports.CloseIcon = CloseIcon; exports.HistoryIcon = HistoryIcon; exports.InfoIcon = InfoIcon; exports.CopyIcon = CopyIcon; exports.ArrowUpRightIcon = ArrowUpRightIcon; exports.AlertTriangleIcon = AlertTriangleIcon; exports.PercentIcon = PercentIcon; exports.ClockIcon = ClockIcon; exports.PlusCircleIcon = PlusCircleIcon; exports.CircleArrowOutUpLeftIcon = CircleArrowOutUpLeftIcon; exports.BodyHeader = BodyHeader; exports.PoweredBy = PoweredBy; exports.Spinner = Spinner; exports.ConnectStep = ConnectStep; exports.Button = Button; exports.Callout = Callout; exports.debugLog = debugLog; exports.debugError = debugError; exports.toEvmCaip2 = toEvmCaip2; exports.targetChainToCaip2 = targetChainToCaip2; exports.parseEvmChainId = parseEvmChainId; exports.isSolanaCaip2 = isSolanaCaip2; exports.getAssetId = getAssetId; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.buildSessionDetails = buildSessionDetails; exports.createDepositService = createDepositService; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.isUnsupportedChainSwitchError = isUnsupportedChainSwitchError; exports.formatUserError = formatUserError; exports.Tooltip = Tooltip; exports.getEventTxHash = getEventTxHash; exports.isDepositEvent = isDepositEvent; exports.txRefsMatch = txRefsMatch; exports.useLatestRef = useLatestRef; exports.ProcessingStep = ProcessingStep; exports.SAFE_ABI = SAFE_ABI; exports.executeSafeEthTransfer = executeSafeEthTransfer; exports.executeSafeErc20Transfer = executeSafeErc20Transfer; exports.buildSafeTransaction = buildSafeTransaction; exports.getPublicClient = getPublicClient; exports.loadSessionOwnerFromStorage = loadSessionOwnerFromStorage; exports.saveSessionOwnerToStorage = saveSessionOwnerToStorage; exports.createSessionOwnerKey = createSessionOwnerKey; exports.accountFromPrivateKey = accountFromPrivateKey; exports.applyTheme = applyTheme;
|