@rhinestone/deposit-modal 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DepositModalReown-ICBGUVAA.cjs → DepositModalReown-J5YFZKFS.cjs} +9 -9
- package/dist/{DepositModalReown-IVRDXQAA.mjs → DepositModalReown-RZ6VSMKP.mjs} +6 -6
- package/dist/{WithdrawModalReown-O7PR343Z.mjs → WithdrawModalReown-4YUV2WWV.mjs} +5 -5
- package/dist/{WithdrawModalReown-6XWURPFZ.cjs → WithdrawModalReown-B6BGY52S.cjs} +8 -8
- package/dist/caip-C_ZYFIGa.d.cts +77 -0
- package/dist/caip-C_ZYFIGa.d.ts +77 -0
- package/dist/{chunk-NRNJAQUA.cjs → chunk-4IOQIWDY.cjs} +4 -4
- package/dist/{chunk-TCLBFO3S.mjs → chunk-5S5BQ2GM.mjs} +304 -115
- package/dist/{chunk-N73D3WN4.mjs → chunk-7JJ4EFDY.mjs} +13 -17
- package/dist/{chunk-VPWWFWZT.cjs → chunk-IRI34U6N.cjs} +331 -117
- package/dist/{chunk-SITLCMTI.cjs → chunk-JRFPKFL6.cjs} +102 -106
- package/dist/{chunk-7Q26RR6J.mjs → chunk-LXTAAHPC.mjs} +6 -4
- package/dist/{chunk-ABVRVW3P.cjs → chunk-PUMTR35E.cjs} +85 -31
- package/dist/{chunk-GBOCV2LQ.mjs → chunk-RXWJ267K.mjs} +366 -152
- package/dist/{chunk-WJX3TJFK.mjs → chunk-SX52FXKH.mjs} +84 -30
- package/dist/{chunk-F7P4MV72.mjs → chunk-TYB6AA6D.mjs} +1 -1
- package/dist/{chunk-VVKJRGX3.cjs → chunk-VURI4G2Z.cjs} +10 -8
- package/dist/{chunk-UEKPBRBY.cjs → chunk-WL7AXYQ4.cjs} +3 -3
- package/dist/{chunk-IZPUHIIN.cjs → chunk-XLXJW44N.cjs} +743 -554
- package/dist/{chunk-FJWLC4AM.mjs → chunk-YLIPI3NU.mjs} +1 -1
- package/dist/constants.cjs +4 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +5 -3
- package/dist/deposit.cjs +6 -6
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +5 -5
- package/dist/index.cjs +11 -7
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +12 -8
- package/dist/polymarket.cjs +6 -6
- package/dist/polymarket.mjs +3 -3
- package/dist/styles.css +86 -12
- package/dist/{types-6ROxwyfG.d.cts → types--LQWg_4W.d.cts} +1 -1
- package/dist/{types-6ROxwyfG.d.ts → types--LQWg_4W.d.ts} +1 -1
- package/dist/withdraw.cjs +5 -5
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +4 -4
- package/package.json +1 -1
- package/dist/caip-CsslyHGL.d.cts +0 -62
- package/dist/caip-CsslyHGL.d.ts +0 -62
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CHAIN_BY_ID,
|
|
3
|
+
HYPERCORE_CHAIN_ID,
|
|
4
|
+
HYPERCORE_MAINNET_CAIP2,
|
|
5
|
+
HYPERCORE_SOURCE_TOKENS,
|
|
3
6
|
NATIVE_TOKEN_ADDRESS,
|
|
4
7
|
findTokenDecimals,
|
|
5
8
|
getChainIcon,
|
|
@@ -9,11 +12,12 @@ import {
|
|
|
9
12
|
getSupportedChainIds,
|
|
10
13
|
getTokenAddress,
|
|
11
14
|
getTokenDecimalsByAddress,
|
|
12
|
-
getTokenIcon,
|
|
13
15
|
getTokenSymbol,
|
|
16
|
+
isHyperCoreCaip2,
|
|
14
17
|
isSolanaCaip2,
|
|
15
|
-
parseEvmChainId
|
|
16
|
-
|
|
18
|
+
parseEvmChainId,
|
|
19
|
+
tokenIconUrl
|
|
20
|
+
} from "./chunk-SX52FXKH.mjs";
|
|
17
21
|
|
|
18
22
|
// src/components/ui/Modal.tsx
|
|
19
23
|
import {
|
|
@@ -538,6 +542,7 @@ function createDepositService(baseUrl, options) {
|
|
|
538
542
|
}
|
|
539
543
|
const PORTFOLIO_CACHE_TTL_MS = 3e4;
|
|
540
544
|
const portfolioCache = /* @__PURE__ */ new Map();
|
|
545
|
+
let topTokensPromise = null;
|
|
541
546
|
function cachedPortfolio(key, fetcher, forceRefresh = false) {
|
|
542
547
|
const now = Date.now();
|
|
543
548
|
const entry = portfolioCache.get(key);
|
|
@@ -642,7 +647,7 @@ function createDepositService(baseUrl, options) {
|
|
|
642
647
|
},
|
|
643
648
|
async fetchPortfolio(address, options2) {
|
|
644
649
|
return cachedPortfolio(`evm:${address.toLowerCase()}`, async () => {
|
|
645
|
-
const url = apiUrl(`/portfolio/${address}`);
|
|
650
|
+
const url = apiUrl(`/portfolio/${address}?includeUnsupported=true`);
|
|
646
651
|
debugLog(debug, scope, "fetchPortfolio:request", { url, address });
|
|
647
652
|
const response = await fetch(url, {
|
|
648
653
|
method: "GET",
|
|
@@ -1004,7 +1009,8 @@ function createDepositService(baseUrl, options) {
|
|
|
1004
1009
|
const url = apiUrl("/quotes/preview");
|
|
1005
1010
|
const body = {
|
|
1006
1011
|
account: params.account,
|
|
1007
|
-
|
|
1012
|
+
// HyperCore has its own CAIP-2 namespace — never the eip155 placeholder.
|
|
1013
|
+
sourceChainId: params.sourceChainId === "hypercore" ? HYPERCORE_MAINNET_CAIP2 : `eip155:${params.sourceChainId}`,
|
|
1008
1014
|
sourceToken: params.sourceToken,
|
|
1009
1015
|
amount: params.amount
|
|
1010
1016
|
};
|
|
@@ -1178,6 +1184,60 @@ function createDepositService(baseUrl, options) {
|
|
|
1178
1184
|
stale: body.stale === true ? true : void 0
|
|
1179
1185
|
};
|
|
1180
1186
|
},
|
|
1187
|
+
getTopTokens() {
|
|
1188
|
+
if (!topTokensPromise) {
|
|
1189
|
+
topTokensPromise = (async () => {
|
|
1190
|
+
try {
|
|
1191
|
+
const response = await fetch(apiUrl("/tokens"), {
|
|
1192
|
+
method: "GET",
|
|
1193
|
+
headers: { "Content-Type": "application/json" }
|
|
1194
|
+
});
|
|
1195
|
+
if (!response.ok) {
|
|
1196
|
+
debugLog(debug, scope, "getTopTokens:unavailable", {
|
|
1197
|
+
status: response.status
|
|
1198
|
+
});
|
|
1199
|
+
return null;
|
|
1200
|
+
}
|
|
1201
|
+
const data = await response.json();
|
|
1202
|
+
const tokens = data.tokens ?? null;
|
|
1203
|
+
debugLog(debug, scope, "getTopTokens:success", {
|
|
1204
|
+
chains: tokens ? Object.keys(tokens).length : 0
|
|
1205
|
+
});
|
|
1206
|
+
return tokens;
|
|
1207
|
+
} catch (error) {
|
|
1208
|
+
debugError(debug, scope, "getTopTokens:error", error);
|
|
1209
|
+
return null;
|
|
1210
|
+
}
|
|
1211
|
+
})();
|
|
1212
|
+
}
|
|
1213
|
+
return topTokensPromise;
|
|
1214
|
+
},
|
|
1215
|
+
async getSetup() {
|
|
1216
|
+
const url = apiUrl("/setup");
|
|
1217
|
+
try {
|
|
1218
|
+
const response = await fetch(url, {
|
|
1219
|
+
method: "GET",
|
|
1220
|
+
headers: { "Content-Type": "application/json" },
|
|
1221
|
+
cache: "no-store"
|
|
1222
|
+
});
|
|
1223
|
+
if (!response.ok) {
|
|
1224
|
+
debugLog(debug, scope, "getSetup:unavailable", {
|
|
1225
|
+
status: response.status
|
|
1226
|
+
});
|
|
1227
|
+
return null;
|
|
1228
|
+
}
|
|
1229
|
+
const data = await response.json();
|
|
1230
|
+
debugLog(debug, scope, "getSetup:success", {
|
|
1231
|
+
hasWhitelist: Boolean(data.depositWhitelist),
|
|
1232
|
+
whitelistChains: data.depositWhitelist ? Object.keys(data.depositWhitelist).length : 0,
|
|
1233
|
+
minDepositUsd: data.minDepositUsd
|
|
1234
|
+
});
|
|
1235
|
+
return data;
|
|
1236
|
+
} catch (error) {
|
|
1237
|
+
debugError(debug, scope, "getSetup:error", error);
|
|
1238
|
+
return null;
|
|
1239
|
+
}
|
|
1240
|
+
},
|
|
1181
1241
|
async fetchSwappedOrderStatus(smartAccount) {
|
|
1182
1242
|
const url = apiUrl(
|
|
1183
1243
|
`/onramp/swapped/status/${encodeURIComponent(smartAccount)}`
|
|
@@ -1198,7 +1258,16 @@ function createDepositService(baseUrl, options) {
|
|
|
1198
1258
|
const status = typeof body.status === "string" ? body.status : null;
|
|
1199
1259
|
const orderId = typeof body.orderId === "string" ? body.orderId : null;
|
|
1200
1260
|
if (!status || !orderId) return null;
|
|
1201
|
-
const numericOrNull = (v) =>
|
|
1261
|
+
const numericOrNull = (v) => {
|
|
1262
|
+
if (typeof v === "number") {
|
|
1263
|
+
return Number.isFinite(v) ? v : null;
|
|
1264
|
+
}
|
|
1265
|
+
if (typeof v === "string" && v.trim().length > 0) {
|
|
1266
|
+
const parsed = Number(v);
|
|
1267
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
1268
|
+
}
|
|
1269
|
+
return null;
|
|
1270
|
+
};
|
|
1202
1271
|
return {
|
|
1203
1272
|
orderId,
|
|
1204
1273
|
status,
|
|
@@ -1266,8 +1335,13 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1266
1335
|
function normalizeDirectToken(token) {
|
|
1267
1336
|
const rawChainId = extractNumber(token, "chainId") ?? extractNumber(token.chain, "id");
|
|
1268
1337
|
const rawChainString = extractString(token, "chainId") ?? extractString(token.chain, "id");
|
|
1269
|
-
const chainId = rawChainId ?? (rawChainString ? isSolanaCaip2(rawChainString) || rawChainString.toLowerCase() === "solana" ? "solana" :
|
|
1338
|
+
const chainId = rawChainId ?? (rawChainString ? isSolanaCaip2(rawChainString) || rawChainString.toLowerCase() === "solana" ? "solana" : (
|
|
1339
|
+
// HyperCore (`hypercore:mainnet`) is a non-EVM source; keep its USDC
|
|
1340
|
+
// instead of dropping it as an unparseable chain string.
|
|
1341
|
+
isHyperCoreCaip2(rawChainString) || rawChainString.toLowerCase() === "hypercore" ? "hypercore" : parseEvmChainId(rawChainString)
|
|
1342
|
+
) : null);
|
|
1270
1343
|
if (chainId === null) return null;
|
|
1344
|
+
const registryChainId = typeof chainId === "number" ? chainId : chainId === "hypercore" ? HYPERCORE_CHAIN_ID : void 0;
|
|
1271
1345
|
const symbol = extractString(token, "symbol") ?? extractString(token, "tokenSymbol") ?? extractString(token, "tokenName") ?? extractString(token, "name");
|
|
1272
1346
|
if (!symbol) return null;
|
|
1273
1347
|
const balanceValue = extractString(token, "balance") ?? extractString(token, "amount") ?? extractString(token, "value") ?? extractString(token, "rawBalance") ?? extractNumber(token, "balance")?.toString() ?? extractNumber(token, "amount")?.toString() ?? extractNumber(token, "value")?.toString() ?? extractNumber(token, "rawBalance")?.toString();
|
|
@@ -1275,14 +1349,14 @@ function normalizeDirectToken(token) {
|
|
|
1275
1349
|
const address = extractString(token, "address") ?? extractString(token, "tokenAddress") ?? extractString(
|
|
1276
1350
|
token.token,
|
|
1277
1351
|
"address"
|
|
1278
|
-
) ?? (
|
|
1352
|
+
) ?? (registryChainId !== void 0 ? getTokenAddress(symbol, registryChainId) : void 0);
|
|
1279
1353
|
if (!address) return null;
|
|
1280
1354
|
const balanceUsd = extractNumber(token, "balanceUsd") ?? extractNumber(token, "usdValue") ?? extractNumber(token, "valueUsd") ?? extractNumericString(token, "balanceUsd") ?? extractNumericString(token, "usdValue") ?? extractNumericString(token, "valueUsd") ?? 0;
|
|
1281
1355
|
const isSolanaToken = chainId === "solana";
|
|
1282
|
-
const registrySymbol = isSolanaToken ? "Token" : getTokenSymbol(address,
|
|
1356
|
+
const registrySymbol = isSolanaToken ? "Token" : getTokenSymbol(address, registryChainId);
|
|
1283
1357
|
const resolvedSymbol = isSolanaToken ? symbol : registrySymbol !== "Token" ? registrySymbol : symbol;
|
|
1284
1358
|
const backendDecimals = extractNumber(token, "decimals") ?? extractNumber(token, "tokenDecimals");
|
|
1285
|
-
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ? getTokenDecimalsByAddress(address,
|
|
1359
|
+
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ? getTokenDecimalsByAddress(address, registryChainId) : backendDecimals ?? 18;
|
|
1286
1360
|
return {
|
|
1287
1361
|
chainId,
|
|
1288
1362
|
address,
|
|
@@ -2231,7 +2305,7 @@ function VisaMark() {
|
|
|
2231
2305
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2232
2306
|
"aria-hidden": "true",
|
|
2233
2307
|
children: [
|
|
2234
|
-
/* @__PURE__ */ jsx17("rect", { width: "
|
|
2308
|
+
/* @__PURE__ */ jsx17("rect", { width: "38", height: "24", rx: "4.2985", fill: "white" }),
|
|
2235
2309
|
/* @__PURE__ */ jsx17(
|
|
2236
2310
|
"path",
|
|
2237
2311
|
{
|
|
@@ -2254,7 +2328,7 @@ function MastercardMark() {
|
|
|
2254
2328
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2255
2329
|
"aria-hidden": "true",
|
|
2256
2330
|
children: [
|
|
2257
|
-
/* @__PURE__ */ jsx17("rect", { width: "
|
|
2331
|
+
/* @__PURE__ */ jsx17("rect", { width: "38", height: "24", rx: "4.2985", fill: "white" }),
|
|
2258
2332
|
/* @__PURE__ */ jsx17(
|
|
2259
2333
|
"path",
|
|
2260
2334
|
{
|
|
@@ -2298,7 +2372,7 @@ function AmexMark() {
|
|
|
2298
2372
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2299
2373
|
"aria-hidden": "true",
|
|
2300
2374
|
children: [
|
|
2301
|
-
/* @__PURE__ */ jsx17("rect", { width: "
|
|
2375
|
+
/* @__PURE__ */ jsx17("rect", { width: "38", height: "24", rx: "4.2985", fill: "#006FCF" }),
|
|
2302
2376
|
/* @__PURE__ */ jsx17(
|
|
2303
2377
|
"path",
|
|
2304
2378
|
{
|
|
@@ -2683,11 +2757,33 @@ function ConnectStep({
|
|
|
2683
2757
|
}
|
|
2684
2758
|
ConnectStep.displayName = "ConnectStep";
|
|
2685
2759
|
|
|
2760
|
+
// src/components/ui/TokenIcon.tsx
|
|
2761
|
+
import { useState as useState2 } from "react";
|
|
2762
|
+
import { Fragment as Fragment3, jsx as jsx19 } from "react/jsx-runtime";
|
|
2763
|
+
function TokenIcon({ symbol, className, fallback }) {
|
|
2764
|
+
const [failedSymbol, setFailedSymbol] = useState2(null);
|
|
2765
|
+
if (failedSymbol === symbol) {
|
|
2766
|
+
return /* @__PURE__ */ jsx19(Fragment3, { children: fallback });
|
|
2767
|
+
}
|
|
2768
|
+
return /* @__PURE__ */ jsx19(
|
|
2769
|
+
"img",
|
|
2770
|
+
{
|
|
2771
|
+
src: tokenIconUrl(symbol),
|
|
2772
|
+
alt: "",
|
|
2773
|
+
className,
|
|
2774
|
+
loading: "lazy",
|
|
2775
|
+
decoding: "async",
|
|
2776
|
+
onError: () => setFailedSymbol(symbol)
|
|
2777
|
+
}
|
|
2778
|
+
);
|
|
2779
|
+
}
|
|
2780
|
+
TokenIcon.displayName = "TokenIcon";
|
|
2781
|
+
|
|
2686
2782
|
// src/components/steps/ProcessingStep.tsx
|
|
2687
|
-
import { useCallback as useCallback3, useEffect as useEffect6, useRef as useRef4, useState as
|
|
2783
|
+
import { useCallback as useCallback3, useEffect as useEffect6, useRef as useRef4, useState as useState6 } from "react";
|
|
2688
2784
|
|
|
2689
2785
|
// src/components/ui/Button.tsx
|
|
2690
|
-
import { Fragment as
|
|
2786
|
+
import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2691
2787
|
function Button({
|
|
2692
2788
|
children,
|
|
2693
2789
|
variant = "accent",
|
|
@@ -2707,7 +2803,7 @@ function Button({
|
|
|
2707
2803
|
className
|
|
2708
2804
|
].filter(Boolean).join(" ");
|
|
2709
2805
|
const showInlineLoadingText = loading && loadingText !== void 0;
|
|
2710
|
-
return /* @__PURE__ */
|
|
2806
|
+
return /* @__PURE__ */ jsx20(
|
|
2711
2807
|
"button",
|
|
2712
2808
|
{
|
|
2713
2809
|
className: classes,
|
|
@@ -2715,11 +2811,11 @@ function Button({
|
|
|
2715
2811
|
"aria-busy": loading || void 0,
|
|
2716
2812
|
...props,
|
|
2717
2813
|
children: showInlineLoadingText ? /* @__PURE__ */ jsxs17("span", { className: "rs-button__loading-row", children: [
|
|
2718
|
-
/* @__PURE__ */
|
|
2719
|
-
/* @__PURE__ */
|
|
2720
|
-
] }) : /* @__PURE__ */ jsxs17(
|
|
2721
|
-
/* @__PURE__ */
|
|
2722
|
-
loading && /* @__PURE__ */
|
|
2814
|
+
/* @__PURE__ */ jsx20(Spinner, { className: "rs-spinner--sm" }),
|
|
2815
|
+
/* @__PURE__ */ jsx20("span", { children: loadingText })
|
|
2816
|
+
] }) : /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
2817
|
+
/* @__PURE__ */ jsx20("span", { className: loading ? "rs-button__content--hidden" : "", children }),
|
|
2818
|
+
loading && /* @__PURE__ */ jsx20("span", { className: "rs-button__spinner", children: /* @__PURE__ */ jsx20(Spinner, { className: "rs-spinner--sm" }) })
|
|
2723
2819
|
] })
|
|
2724
2820
|
}
|
|
2725
2821
|
);
|
|
@@ -2728,16 +2824,16 @@ Button.displayName = "Button";
|
|
|
2728
2824
|
|
|
2729
2825
|
// src/components/ui/Tooltip.tsx
|
|
2730
2826
|
import {
|
|
2731
|
-
useState as
|
|
2827
|
+
useState as useState3,
|
|
2732
2828
|
useRef as useRef3,
|
|
2733
2829
|
useEffect as useEffect4,
|
|
2734
2830
|
useCallback as useCallback2
|
|
2735
2831
|
} from "react";
|
|
2736
2832
|
import { createPortal as createPortal2 } from "react-dom";
|
|
2737
|
-
import { jsx as
|
|
2833
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2738
2834
|
function Tooltip({ content, children, className }) {
|
|
2739
|
-
const [open, setOpen] =
|
|
2740
|
-
const [position, setPosition] =
|
|
2835
|
+
const [open, setOpen] = useState3(false);
|
|
2836
|
+
const [position, setPosition] = useState3(null);
|
|
2741
2837
|
const triggerRef = useRef3(null);
|
|
2742
2838
|
const bubbleRef = useRef3(null);
|
|
2743
2839
|
const updatePosition = useCallback2(() => {
|
|
@@ -2783,7 +2879,7 @@ function Tooltip({ content, children, className }) {
|
|
|
2783
2879
|
onMouseEnter: () => setOpen(true),
|
|
2784
2880
|
onMouseLeave: () => setOpen(false),
|
|
2785
2881
|
children: [
|
|
2786
|
-
/* @__PURE__ */
|
|
2882
|
+
/* @__PURE__ */ jsx21(
|
|
2787
2883
|
"span",
|
|
2788
2884
|
{
|
|
2789
2885
|
className: "rs-tooltip-trigger",
|
|
@@ -2805,7 +2901,7 @@ function Tooltip({ content, children, className }) {
|
|
|
2805
2901
|
}
|
|
2806
2902
|
),
|
|
2807
2903
|
open && position && typeof document !== "undefined" && createPortal2(
|
|
2808
|
-
/* @__PURE__ */
|
|
2904
|
+
/* @__PURE__ */ jsx21(
|
|
2809
2905
|
"span",
|
|
2810
2906
|
{
|
|
2811
2907
|
ref: bubbleRef,
|
|
@@ -2824,88 +2920,116 @@ function Tooltip({ content, children, className }) {
|
|
|
2824
2920
|
Tooltip.displayName = "Tooltip";
|
|
2825
2921
|
|
|
2826
2922
|
// src/components/ui/FeesAccordion.tsx
|
|
2827
|
-
import { useState as
|
|
2828
|
-
import { jsx as
|
|
2829
|
-
function FeesAccordion({ total, rows }) {
|
|
2830
|
-
const [open, setOpen] =
|
|
2923
|
+
import { useState as useState4 } from "react";
|
|
2924
|
+
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2925
|
+
function FeesAccordion({ total, rows, tooltip }) {
|
|
2926
|
+
const [open, setOpen] = useState4(false);
|
|
2831
2927
|
const expandable = rows.length > 0;
|
|
2832
2928
|
return /* @__PURE__ */ jsxs19("div", { className: "rs-fees-accordion", children: [
|
|
2833
|
-
/* @__PURE__ */ jsxs19(
|
|
2834
|
-
"
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2929
|
+
/* @__PURE__ */ jsxs19("div", { className: "rs-fees-accordion-summary", children: [
|
|
2930
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-fees-accordion-label", children: [
|
|
2931
|
+
/* @__PURE__ */ jsx22("span", { children: "Fees" }),
|
|
2932
|
+
tooltip && /* @__PURE__ */ jsx22(Tooltip, { content: tooltip, children: /* @__PURE__ */ jsx22("span", { className: "rs-review-detail-info", "aria-label": "Fees info", children: /* @__PURE__ */ jsx22(InfoIcon, {}) }) })
|
|
2933
|
+
] }),
|
|
2934
|
+
/* @__PURE__ */ jsxs19(
|
|
2935
|
+
"button",
|
|
2936
|
+
{
|
|
2937
|
+
type: "button",
|
|
2938
|
+
className: "rs-fees-accordion-toggle",
|
|
2939
|
+
"aria-label": "Fees",
|
|
2940
|
+
"aria-expanded": expandable ? open : void 0,
|
|
2941
|
+
disabled: !expandable,
|
|
2942
|
+
onClick: () => expandable && setOpen((o) => !o),
|
|
2943
|
+
children: [
|
|
2944
|
+
/* @__PURE__ */ jsx22("span", { children: total }),
|
|
2945
|
+
expandable && /* @__PURE__ */ jsx22(
|
|
2846
2946
|
"span",
|
|
2847
2947
|
{
|
|
2848
2948
|
className: `rs-fees-accordion-chevron${open ? " rs-fees-accordion-chevron--open" : ""}`,
|
|
2849
2949
|
"aria-hidden": "true",
|
|
2850
|
-
children: /* @__PURE__ */
|
|
2950
|
+
children: /* @__PURE__ */ jsx22(ChevronDownIcon, {})
|
|
2851
2951
|
}
|
|
2852
2952
|
)
|
|
2853
|
-
]
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
),
|
|
2857
|
-
expandable && open && /* @__PURE__ */
|
|
2858
|
-
/* @__PURE__ */
|
|
2859
|
-
/* @__PURE__ */
|
|
2953
|
+
]
|
|
2954
|
+
}
|
|
2955
|
+
)
|
|
2956
|
+
] }),
|
|
2957
|
+
expandable && open && /* @__PURE__ */ jsx22("div", { className: "rs-fees-accordion-rows", children: rows.map((row, i) => /* @__PURE__ */ jsxs19("div", { className: "rs-fees-accordion-row", children: [
|
|
2958
|
+
/* @__PURE__ */ jsx22("span", { children: row.label }),
|
|
2959
|
+
/* @__PURE__ */ jsxs19("span", { className: "rs-review-detail-value", children: [
|
|
2960
|
+
/* @__PURE__ */ jsx22(
|
|
2961
|
+
"span",
|
|
2962
|
+
{
|
|
2963
|
+
className: row.strike ? "rs-review-detail-value--strike" : void 0,
|
|
2964
|
+
children: row.value
|
|
2965
|
+
}
|
|
2966
|
+
),
|
|
2967
|
+
row.tooltip && /* @__PURE__ */ jsx22(Tooltip, { content: row.tooltip, children: /* @__PURE__ */ jsx22(
|
|
2968
|
+
"span",
|
|
2969
|
+
{
|
|
2970
|
+
className: "rs-review-detail-info",
|
|
2971
|
+
"aria-label": `${row.label} info`,
|
|
2972
|
+
children: /* @__PURE__ */ jsx22(InfoIcon, {})
|
|
2973
|
+
}
|
|
2974
|
+
) })
|
|
2975
|
+
] })
|
|
2860
2976
|
] }, `${row.label}-${i}`)) })
|
|
2861
2977
|
] });
|
|
2862
2978
|
}
|
|
2863
2979
|
FeesAccordion.displayName = "FeesAccordion";
|
|
2864
2980
|
|
|
2865
2981
|
// src/components/steps/SwappedReceipt.tsx
|
|
2866
|
-
import { jsx as
|
|
2982
|
+
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2867
2983
|
function SwappedReceipt({
|
|
2868
2984
|
onrampMethod,
|
|
2869
2985
|
onrampMethodIcon,
|
|
2870
2986
|
amountPaid,
|
|
2871
2987
|
depositedAmount,
|
|
2872
|
-
|
|
2988
|
+
depositedSymbol,
|
|
2873
2989
|
feesTotal,
|
|
2874
2990
|
feeRows,
|
|
2991
|
+
feesTooltip,
|
|
2875
2992
|
newLabel,
|
|
2876
2993
|
onNewDeposit,
|
|
2877
2994
|
onClose
|
|
2878
2995
|
}) {
|
|
2879
2996
|
return /* @__PURE__ */ jsxs20("div", { className: "rs-screen", children: [
|
|
2880
2997
|
/* @__PURE__ */ jsxs20("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2881
|
-
/* @__PURE__ */
|
|
2998
|
+
/* @__PURE__ */ jsx23(BodyHeader, { icon: /* @__PURE__ */ jsx23(CheckIcon, {}), title: "Deposit successful" }),
|
|
2882
2999
|
/* @__PURE__ */ jsxs20("div", { className: "rs-review-details", children: [
|
|
2883
3000
|
onrampMethod && /* @__PURE__ */ jsxs20("div", { className: "rs-review-detail-row", children: [
|
|
2884
|
-
/* @__PURE__ */
|
|
3001
|
+
/* @__PURE__ */ jsx23("span", { children: "Onramp method" }),
|
|
2885
3002
|
/* @__PURE__ */ jsxs20("span", { className: "rs-review-detail-value", children: [
|
|
2886
|
-
/* @__PURE__ */
|
|
2887
|
-
onrampMethodIcon && /* @__PURE__ */
|
|
3003
|
+
/* @__PURE__ */ jsx23("span", { children: onrampMethod }),
|
|
3004
|
+
onrampMethodIcon && /* @__PURE__ */ jsx23("span", { className: "rs-review-detail-icon rs-review-detail-icon--square", children: /* @__PURE__ */ jsx23("img", { src: onrampMethodIcon, alt: "" }) })
|
|
2888
3005
|
] })
|
|
2889
3006
|
] }),
|
|
2890
3007
|
amountPaid && /* @__PURE__ */ jsxs20("div", { className: "rs-review-detail-row", children: [
|
|
2891
|
-
/* @__PURE__ */
|
|
2892
|
-
/* @__PURE__ */
|
|
3008
|
+
/* @__PURE__ */ jsx23("span", { children: "Amount paid" }),
|
|
3009
|
+
/* @__PURE__ */ jsx23("span", { className: "rs-review-detail-value", children: amountPaid })
|
|
2893
3010
|
] }),
|
|
2894
3011
|
/* @__PURE__ */ jsxs20("div", { className: "rs-review-detail-row", children: [
|
|
2895
|
-
/* @__PURE__ */
|
|
3012
|
+
/* @__PURE__ */ jsx23("span", { children: "Deposited amount" }),
|
|
2896
3013
|
/* @__PURE__ */ jsxs20("span", { className: "rs-review-detail-value", children: [
|
|
2897
|
-
/* @__PURE__ */
|
|
2898
|
-
|
|
3014
|
+
/* @__PURE__ */ jsx23("span", { children: depositedAmount }),
|
|
3015
|
+
depositedSymbol && /* @__PURE__ */ jsx23("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx23(TokenIcon, { symbol: depositedSymbol }) })
|
|
2899
3016
|
] })
|
|
2900
3017
|
] }),
|
|
2901
|
-
feesTotal != null && /* @__PURE__ */
|
|
3018
|
+
feesTotal != null && /* @__PURE__ */ jsx23(
|
|
3019
|
+
FeesAccordion,
|
|
3020
|
+
{
|
|
3021
|
+
total: feesTotal,
|
|
3022
|
+
rows: feeRows ?? [],
|
|
3023
|
+
tooltip: feesTooltip ?? void 0
|
|
3024
|
+
}
|
|
3025
|
+
)
|
|
2902
3026
|
] }),
|
|
2903
3027
|
/* @__PURE__ */ jsxs20("div", { className: "rs-screen-button-row", children: [
|
|
2904
|
-
onNewDeposit && /* @__PURE__ */
|
|
2905
|
-
onClose && /* @__PURE__ */
|
|
3028
|
+
onNewDeposit && /* @__PURE__ */ jsx23(Button, { variant: "outline", onClick: onNewDeposit, fullWidth: true, children: newLabel }),
|
|
3029
|
+
onClose && /* @__PURE__ */ jsx23(Button, { onClick: onClose, fullWidth: true, children: "Done" })
|
|
2906
3030
|
] })
|
|
2907
3031
|
] }),
|
|
2908
|
-
/* @__PURE__ */
|
|
3032
|
+
/* @__PURE__ */ jsx23(PoweredBy, {})
|
|
2909
3033
|
] });
|
|
2910
3034
|
}
|
|
2911
3035
|
SwappedReceipt.displayName = "SwappedReceipt";
|
|
@@ -2979,8 +3103,10 @@ function getEventSourceDetails(event) {
|
|
|
2979
3103
|
return {};
|
|
2980
3104
|
}
|
|
2981
3105
|
function asChain(value) {
|
|
2982
|
-
if (typeof value === "string"
|
|
2983
|
-
|
|
3106
|
+
if (typeof value === "string") {
|
|
3107
|
+
const trimmed = value.trim();
|
|
3108
|
+
if (trimmed.startsWith("solana")) return "solana";
|
|
3109
|
+
if (trimmed.startsWith("hypercore")) return "hypercore";
|
|
2984
3110
|
}
|
|
2985
3111
|
return asNumber(value);
|
|
2986
3112
|
}
|
|
@@ -3074,6 +3200,11 @@ function resolveTokenDisplay(token, chain, fallback) {
|
|
|
3074
3200
|
if (solanaToken) {
|
|
3075
3201
|
return { symbol: solanaToken.symbol, decimals: solanaToken.decimals };
|
|
3076
3202
|
}
|
|
3203
|
+
} else if (chain === "hypercore") {
|
|
3204
|
+
const t = HYPERCORE_SOURCE_TOKENS.find(
|
|
3205
|
+
(x) => x.address.toLowerCase() === token.toLowerCase()
|
|
3206
|
+
);
|
|
3207
|
+
if (t) return { symbol: t.symbol, decimals: t.decimals };
|
|
3077
3208
|
} else if (EVM_ADDRESS_RE.test(token)) {
|
|
3078
3209
|
const symbol = getTokenSymbol(token, chain);
|
|
3079
3210
|
const decimals = findTokenDecimals(token, chain);
|
|
@@ -3163,9 +3294,9 @@ function formatReceiveEstimate(params) {
|
|
|
3163
3294
|
}
|
|
3164
3295
|
|
|
3165
3296
|
// src/core/useTokenPrices.ts
|
|
3166
|
-
import { useEffect as useEffect5, useState as
|
|
3297
|
+
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
3167
3298
|
function useTokenPrices(service, symbols) {
|
|
3168
|
-
const [prices, setPrices] =
|
|
3299
|
+
const [prices, setPrices] = useState5({});
|
|
3169
3300
|
const symbolsKey = [
|
|
3170
3301
|
...new Set(
|
|
3171
3302
|
symbols.filter((symbol) => Boolean(symbol)).map((symbol) => symbol.toUpperCase())
|
|
@@ -3188,7 +3319,7 @@ function useTokenPrices(service, symbols) {
|
|
|
3188
3319
|
}
|
|
3189
3320
|
|
|
3190
3321
|
// src/components/steps/ProcessingStep.tsx
|
|
3191
|
-
import { Fragment as
|
|
3322
|
+
import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3192
3323
|
function SuccessBadge() {
|
|
3193
3324
|
return /* @__PURE__ */ jsxs21(
|
|
3194
3325
|
"svg",
|
|
@@ -3200,7 +3331,7 @@ function SuccessBadge() {
|
|
|
3200
3331
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3201
3332
|
"aria-hidden": "true",
|
|
3202
3333
|
children: [
|
|
3203
|
-
/* @__PURE__ */
|
|
3334
|
+
/* @__PURE__ */ jsx24(
|
|
3204
3335
|
"rect",
|
|
3205
3336
|
{
|
|
3206
3337
|
width: "40",
|
|
@@ -3209,7 +3340,7 @@ function SuccessBadge() {
|
|
|
3209
3340
|
fill: "var(--rs-icon-wrapper-bg)"
|
|
3210
3341
|
}
|
|
3211
3342
|
),
|
|
3212
|
-
/* @__PURE__ */
|
|
3343
|
+
/* @__PURE__ */ jsx24(
|
|
3213
3344
|
"path",
|
|
3214
3345
|
{
|
|
3215
3346
|
d: "M28 14L17 25L12 20",
|
|
@@ -3234,8 +3365,8 @@ function FailedBadge() {
|
|
|
3234
3365
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3235
3366
|
"aria-hidden": "true",
|
|
3236
3367
|
children: [
|
|
3237
|
-
/* @__PURE__ */
|
|
3238
|
-
/* @__PURE__ */
|
|
3368
|
+
/* @__PURE__ */ jsx24("rect", { width: "40", height: "40", rx: "8", fill: "#FB2C36" }),
|
|
3369
|
+
/* @__PURE__ */ jsx24(
|
|
3239
3370
|
"path",
|
|
3240
3371
|
{
|
|
3241
3372
|
d: "M26 14L14 26M14 14L26 26",
|
|
@@ -3252,6 +3383,8 @@ function FailedBadge() {
|
|
|
3252
3383
|
var INITIAL_POLL_INTERVAL = 3e3;
|
|
3253
3384
|
var MAX_POLL_INTERVAL = 3e4;
|
|
3254
3385
|
var BACKOFF_MULTIPLIER = 1.5;
|
|
3386
|
+
var SWAPPED_RECEIPT_STATUS_RETRY_INTERVAL_MS = 1e3;
|
|
3387
|
+
var SWAPPED_FIAT_STATUS_MAX_ATTEMPTS = 12;
|
|
3255
3388
|
var ESCALATED_DELAY_MS = 10 * 60 * 1e3;
|
|
3256
3389
|
var SOFT_DELAY_MS = {
|
|
3257
3390
|
confirming: 90 * 1e3,
|
|
@@ -3282,6 +3415,36 @@ function formatPaymentMethod(method) {
|
|
|
3282
3415
|
if (PAYMENT_METHOD_LABELS[key]) return PAYMENT_METHOD_LABELS[key];
|
|
3283
3416
|
return key.replace(/[-_]+/g, " ").split(" ").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
3284
3417
|
}
|
|
3418
|
+
function normalizeFeeUsd(value) {
|
|
3419
|
+
return Number.isFinite(value) ? Math.max(0, value) : null;
|
|
3420
|
+
}
|
|
3421
|
+
function formatUsdFee(value) {
|
|
3422
|
+
return `$${normalizeFeeUsd(value)?.toFixed(2) ?? "0.00"}`;
|
|
3423
|
+
}
|
|
3424
|
+
function getMarketNetworkFees(breakdown) {
|
|
3425
|
+
if (!breakdown) return null;
|
|
3426
|
+
const gasUsd = normalizeFeeUsd(breakdown.gasUsd);
|
|
3427
|
+
const bridgeUsd = normalizeFeeUsd(breakdown.bridgeUsd);
|
|
3428
|
+
const swapUsd = normalizeFeeUsd(breakdown.swapUsd);
|
|
3429
|
+
if (gasUsd === null || bridgeUsd === null || swapUsd === null) return null;
|
|
3430
|
+
return {
|
|
3431
|
+
marketUsd: bridgeUsd + swapUsd,
|
|
3432
|
+
networkUsd: gasUsd
|
|
3433
|
+
};
|
|
3434
|
+
}
|
|
3435
|
+
function toSwappedFiatContext(status) {
|
|
3436
|
+
return {
|
|
3437
|
+
orderCrypto: status.orderCrypto,
|
|
3438
|
+
orderCryptoAmount: status.orderCryptoAmount,
|
|
3439
|
+
paidAmountUsd: status.paidAmountUsd,
|
|
3440
|
+
paidAmountEur: status.paidAmountEur,
|
|
3441
|
+
onrampFeeUsd: status.onrampFeeUsd,
|
|
3442
|
+
paymentMethod: status.paymentMethod
|
|
3443
|
+
};
|
|
3444
|
+
}
|
|
3445
|
+
function hasFiatReceiptPricing(status) {
|
|
3446
|
+
return status.paidAmountUsd != null && status.onrampFeeUsd != null;
|
|
3447
|
+
}
|
|
3285
3448
|
function loadPhaseTimings(txHash) {
|
|
3286
3449
|
if (typeof window === "undefined") return null;
|
|
3287
3450
|
try {
|
|
@@ -3335,9 +3498,9 @@ function formatTimer(seconds) {
|
|
|
3335
3498
|
return `${mins}:${String(secs).padStart(2, "0")}`;
|
|
3336
3499
|
}
|
|
3337
3500
|
function TickerChar({ value }) {
|
|
3338
|
-
const [current, setCurrent] =
|
|
3339
|
-
const [previous, setPrevious] =
|
|
3340
|
-
const [animKey, setAnimKey] =
|
|
3501
|
+
const [current, setCurrent] = useState6(value);
|
|
3502
|
+
const [previous, setPrevious] = useState6(null);
|
|
3503
|
+
const [animKey, setAnimKey] = useState6(0);
|
|
3341
3504
|
useEffect6(() => {
|
|
3342
3505
|
if (value === current) return;
|
|
3343
3506
|
setPrevious(current);
|
|
@@ -3347,15 +3510,15 @@ function TickerChar({ value }) {
|
|
|
3347
3510
|
return () => clearTimeout(timeout);
|
|
3348
3511
|
}, [value, current]);
|
|
3349
3512
|
return /* @__PURE__ */ jsxs21("span", { className: "rs-ticker-slot", children: [
|
|
3350
|
-
previous !== null && /* @__PURE__ */
|
|
3351
|
-
/* @__PURE__ */
|
|
3513
|
+
previous !== null && /* @__PURE__ */ jsx24("span", { className: "rs-ticker-out", children: previous }, `out-${animKey}`),
|
|
3514
|
+
/* @__PURE__ */ jsx24("span", { className: "rs-ticker-in", children: current }, `in-${animKey}`)
|
|
3352
3515
|
] });
|
|
3353
3516
|
}
|
|
3354
3517
|
function Ticker({ value }) {
|
|
3355
|
-
return /* @__PURE__ */
|
|
3518
|
+
return /* @__PURE__ */ jsx24("span", { className: "rs-ticker", "aria-label": value, children: value.split("").map((char, index) => (
|
|
3356
3519
|
// Position-stable key so each slot keeps its own animation state.
|
|
3357
3520
|
// eslint-disable-next-line react/no-array-index-key
|
|
3358
|
-
/* @__PURE__ */
|
|
3521
|
+
/* @__PURE__ */ jsx24(TickerChar, { value: char }, index)
|
|
3359
3522
|
)) });
|
|
3360
3523
|
}
|
|
3361
3524
|
function getPhaseStartTime(phaseId, phaseTimings) {
|
|
@@ -3455,6 +3618,7 @@ function ProcessingStep({
|
|
|
3455
3618
|
uiConfig,
|
|
3456
3619
|
quotedFeeAmount,
|
|
3457
3620
|
quotedFeeSymbol,
|
|
3621
|
+
quoteFeeBreakdown,
|
|
3458
3622
|
balanceAfterUsd,
|
|
3459
3623
|
isSwappedOrder,
|
|
3460
3624
|
swappedContext,
|
|
@@ -3482,7 +3646,7 @@ function ProcessingStep({
|
|
|
3482
3646
|
const onDepositFailedRef = useLatestRef(onDepositFailed);
|
|
3483
3647
|
const onErrorRef = useLatestRef(onError);
|
|
3484
3648
|
const initialTerminalEventRef = useRef4(null);
|
|
3485
|
-
const [state, setState] =
|
|
3649
|
+
const [state, setState] = useState6(() => {
|
|
3486
3650
|
if (directTransfer) return { type: "complete" };
|
|
3487
3651
|
const initial = getInitialProcessingState(
|
|
3488
3652
|
initialEvent,
|
|
@@ -3496,8 +3660,8 @@ function ProcessingStep({
|
|
|
3496
3660
|
}
|
|
3497
3661
|
return { type: "processing" };
|
|
3498
3662
|
});
|
|
3499
|
-
const [elapsedSeconds, setElapsedSeconds] =
|
|
3500
|
-
const [phaseTimings, setPhaseTimings] =
|
|
3663
|
+
const [elapsedSeconds, setElapsedSeconds] = useState6(0);
|
|
3664
|
+
const [phaseTimings, setPhaseTimings] = useState6(() => {
|
|
3501
3665
|
const saved = loadPhaseTimings(txHash);
|
|
3502
3666
|
if (saved) {
|
|
3503
3667
|
startTimeRef.current = saved.startedAt;
|
|
@@ -3505,7 +3669,7 @@ function ProcessingStep({
|
|
|
3505
3669
|
}
|
|
3506
3670
|
return { startedAt: startTimeRef.current };
|
|
3507
3671
|
});
|
|
3508
|
-
const [hasEscalatedDelay, setHasEscalatedDelay] =
|
|
3672
|
+
const [hasEscalatedDelay, setHasEscalatedDelay] = useState6(false);
|
|
3509
3673
|
const updatePhaseTimings = useCallback3(
|
|
3510
3674
|
(updater) => {
|
|
3511
3675
|
setPhaseTimings((previous) => {
|
|
@@ -3609,30 +3773,64 @@ function ProcessingStep({
|
|
|
3609
3773
|
(previous) => syncPhaseTimings(previous, state.lastEvent)
|
|
3610
3774
|
);
|
|
3611
3775
|
}, [state.lastEvent?.time, state.lastEvent?.type, updatePhaseTimings]);
|
|
3612
|
-
const [swappedFiatContext, setSwappedFiatContext] =
|
|
3776
|
+
const [swappedFiatContext, setSwappedFiatContext] = useState6(null);
|
|
3613
3777
|
useEffect6(() => {
|
|
3614
3778
|
let cancelled = false;
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3779
|
+
let timeoutId;
|
|
3780
|
+
const isFiatSwappedOrder = isSwappedOrder && swappedContext?.variant === "fiat";
|
|
3781
|
+
const expectedOrderUuid = swappedContext?.expectedOrderUuid ?? null;
|
|
3782
|
+
setSwappedFiatContext(null);
|
|
3783
|
+
if (isFiatSwappedOrder && !expectedOrderUuid) {
|
|
3784
|
+
return () => {
|
|
3785
|
+
cancelled = true;
|
|
3786
|
+
};
|
|
3787
|
+
}
|
|
3788
|
+
let attempts = 0;
|
|
3789
|
+
const matchesCurrentDeposit = (res) => {
|
|
3790
|
+
if (isFiatSwappedOrder) {
|
|
3791
|
+
return res.orderId === expectedOrderUuid;
|
|
3792
|
+
}
|
|
3793
|
+
return res.transactionId != null && res.transactionId.toLowerCase() === txHash.toLowerCase();
|
|
3794
|
+
};
|
|
3795
|
+
const scheduleRetry = () => {
|
|
3796
|
+
if (cancelled || !isFiatSwappedOrder || attempts >= SWAPPED_FIAT_STATUS_MAX_ATTEMPTS) {
|
|
3620
3797
|
return;
|
|
3621
3798
|
}
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3799
|
+
timeoutId = setTimeout(
|
|
3800
|
+
fetchContext,
|
|
3801
|
+
SWAPPED_RECEIPT_STATUS_RETRY_INTERVAL_MS
|
|
3802
|
+
);
|
|
3803
|
+
};
|
|
3804
|
+
async function fetchContext() {
|
|
3805
|
+
attempts += 1;
|
|
3806
|
+
try {
|
|
3807
|
+
const res = await service.fetchSwappedOrderStatus(smartAccount);
|
|
3808
|
+
if (cancelled) return;
|
|
3809
|
+
if (!res || !matchesCurrentDeposit(res)) {
|
|
3810
|
+
scheduleRetry();
|
|
3811
|
+
return;
|
|
3812
|
+
}
|
|
3813
|
+
setSwappedFiatContext(toSwappedFiatContext(res));
|
|
3814
|
+
if (isFiatSwappedOrder && !hasFiatReceiptPricing(res)) {
|
|
3815
|
+
scheduleRetry();
|
|
3816
|
+
}
|
|
3817
|
+
} catch {
|
|
3818
|
+
scheduleRetry();
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
fetchContext();
|
|
3632
3822
|
return () => {
|
|
3633
3823
|
cancelled = true;
|
|
3824
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
3634
3825
|
};
|
|
3635
|
-
}, [
|
|
3826
|
+
}, [
|
|
3827
|
+
service,
|
|
3828
|
+
smartAccount,
|
|
3829
|
+
txHash,
|
|
3830
|
+
isSwappedOrder,
|
|
3831
|
+
swappedContext?.variant,
|
|
3832
|
+
swappedContext?.expectedOrderUuid
|
|
3833
|
+
]);
|
|
3636
3834
|
useEffect6(() => {
|
|
3637
3835
|
if (directTransfer) return;
|
|
3638
3836
|
if (state.type !== "processing") {
|
|
@@ -3851,10 +4049,8 @@ function ProcessingStep({
|
|
|
3851
4049
|
const delayPhaseId = isProcessing && currentPhaseId && activePhaseElapsedMs >= SOFT_DELAY_MS[currentPhaseId] ? currentPhaseId : void 0;
|
|
3852
4050
|
void delayPhaseId;
|
|
3853
4051
|
void hasEscalatedDelay;
|
|
3854
|
-
const targetTokenIcon = getTokenIcon(targetSymbol);
|
|
3855
4052
|
const sourceChainIcon = getChainIcon(displaySourceChain);
|
|
3856
4053
|
const targetChainIcon = getChainIcon(targetChain);
|
|
3857
|
-
const sourceTokenIcon = getTokenIcon(sourceSymbol);
|
|
3858
4054
|
const sourceChainName = getChainName(displaySourceChain);
|
|
3859
4055
|
const targetChainName = getChainName(targetChain);
|
|
3860
4056
|
const timerText = formatTimer(elapsedSeconds);
|
|
@@ -3863,12 +4059,12 @@ function ProcessingStep({
|
|
|
3863
4059
|
const stateTitle = isComplete ? `${flowCapitalized} successful` : isFailed ? `${flowCapitalized} failed` : "Processing...";
|
|
3864
4060
|
const handleRetry = onRetry ?? onNewDeposit;
|
|
3865
4061
|
const headerContent = isComplete ? /* @__PURE__ */ jsxs21("div", { className: "rs-body-header", children: [
|
|
3866
|
-
/* @__PURE__ */
|
|
3867
|
-
/* @__PURE__ */
|
|
4062
|
+
/* @__PURE__ */ jsx24(SuccessBadge, {}),
|
|
4063
|
+
/* @__PURE__ */ jsx24("div", { className: "rs-body-header-text", children: /* @__PURE__ */ jsx24("h2", { className: "rs-body-header-title", children: stateTitle }) })
|
|
3868
4064
|
] }) : isFailed ? /* @__PURE__ */ jsxs21("div", { className: "rs-body-header", children: [
|
|
3869
|
-
/* @__PURE__ */
|
|
3870
|
-
/* @__PURE__ */
|
|
3871
|
-
] }) : /* @__PURE__ */
|
|
4065
|
+
/* @__PURE__ */ jsx24(FailedBadge, {}),
|
|
4066
|
+
/* @__PURE__ */ jsx24("div", { className: "rs-body-header-text", children: /* @__PURE__ */ jsx24("h2", { className: "rs-body-header-title", children: stateTitle }) })
|
|
4067
|
+
] }) : /* @__PURE__ */ jsx24(BodyHeader, { icon: /* @__PURE__ */ jsx24(WalletIcon, {}), title: stateTitle });
|
|
3872
4068
|
if (isComplete && isSwappedOrder) {
|
|
3873
4069
|
const effectivePaymentMethod = swappedContext?.method ?? swappedFiatContext?.paymentMethod ?? null;
|
|
3874
4070
|
const onrampMethod = effectivePaymentMethod ? formatPaymentMethod(effectivePaymentMethod) : null;
|
|
@@ -3880,31 +4076,48 @@ function ProcessingStep({
|
|
|
3880
4076
|
const amountPaid = connectPaidAmount ?? (swappedFiatContext?.paidAmountUsd != null ? `$${swappedFiatContext.paidAmountUsd.toFixed(2)}` : null);
|
|
3881
4077
|
const depositedAmount = receiveDisplay;
|
|
3882
4078
|
const onrampFeeUsd = swappedFiatContext?.onrampFeeUsd ?? null;
|
|
3883
|
-
const
|
|
4079
|
+
const quoteFees = getMarketNetworkFees(quoteFeeBreakdown);
|
|
4080
|
+
const fallbackNetworkFeeUsd = quoteFees === null && quotedFeeAmount !== void 0 && Number.isFinite(Number(quotedFeeAmount)) ? Number(quotedFeeAmount) : null;
|
|
4081
|
+
const marketFeeUsd = quoteFees?.marketUsd ?? null;
|
|
4082
|
+
const networkFeeUsd = quoteFees?.networkUsd ?? fallbackNetworkFeeUsd;
|
|
4083
|
+
const sponsoredFeeTooltip = "This fee is sponsored for this deposit.";
|
|
4084
|
+
const feesTooltip = feeSponsored ? "On-ramp fees are charged by the payment provider. Market and network fees are sponsored for this deposit." : "Fees include on-ramp, market, and network costs for this deposit.";
|
|
3884
4085
|
const feeRows = [];
|
|
3885
4086
|
if (onrampFeeUsd != null) {
|
|
3886
4087
|
feeRows.push({
|
|
3887
4088
|
label: "On-ramp fee",
|
|
3888
|
-
value:
|
|
4089
|
+
value: formatUsdFee(onrampFeeUsd)
|
|
4090
|
+
});
|
|
4091
|
+
}
|
|
4092
|
+
if (marketFeeUsd != null) {
|
|
4093
|
+
feeRows.push({
|
|
4094
|
+
label: "Market fee",
|
|
4095
|
+
value: formatUsdFee(marketFeeUsd),
|
|
4096
|
+
strike: feeSponsored,
|
|
4097
|
+
tooltip: feeSponsored ? sponsoredFeeTooltip : void 0
|
|
3889
4098
|
});
|
|
3890
4099
|
}
|
|
3891
4100
|
if (networkFeeUsd != null) {
|
|
3892
4101
|
feeRows.push({
|
|
3893
4102
|
label: "Network fee",
|
|
3894
|
-
value:
|
|
4103
|
+
value: formatUsdFee(networkFeeUsd),
|
|
4104
|
+
strike: feeSponsored,
|
|
4105
|
+
tooltip: feeSponsored ? sponsoredFeeTooltip : void 0
|
|
3895
4106
|
});
|
|
3896
4107
|
}
|
|
3897
|
-
const
|
|
3898
|
-
|
|
4108
|
+
const chargeableQuoteFeeUsd = feeSponsored ? 0 : (marketFeeUsd ?? 0) + (networkFeeUsd ?? 0);
|
|
4109
|
+
const feesTotal = feeRows.length > 0 ? formatUsdFee((onrampFeeUsd ?? 0) + chargeableQuoteFeeUsd) : null;
|
|
4110
|
+
return /* @__PURE__ */ jsx24(
|
|
3899
4111
|
SwappedReceipt,
|
|
3900
4112
|
{
|
|
3901
4113
|
onrampMethod,
|
|
3902
4114
|
onrampMethodIcon,
|
|
3903
4115
|
amountPaid,
|
|
3904
4116
|
depositedAmount,
|
|
3905
|
-
|
|
4117
|
+
depositedSymbol: targetSymbol,
|
|
3906
4118
|
feesTotal,
|
|
3907
4119
|
feeRows,
|
|
4120
|
+
feesTooltip,
|
|
3908
4121
|
newLabel: `New ${flowNoun}`,
|
|
3909
4122
|
onNewDeposit,
|
|
3910
4123
|
onClose
|
|
@@ -3916,11 +4129,11 @@ function ProcessingStep({
|
|
|
3916
4129
|
headerContent,
|
|
3917
4130
|
/* @__PURE__ */ jsxs21("div", { className: "rs-review-details", children: [
|
|
3918
4131
|
/* @__PURE__ */ jsxs21("div", { className: "rs-review-detail-row", children: [
|
|
3919
|
-
/* @__PURE__ */
|
|
4132
|
+
/* @__PURE__ */ jsx24("span", { children: "Source chain" }),
|
|
3920
4133
|
/* @__PURE__ */ jsxs21("span", { className: "rs-review-detail-value", children: [
|
|
3921
|
-
/* @__PURE__ */
|
|
3922
|
-
sourceChainIcon && /* @__PURE__ */
|
|
3923
|
-
sourceExplorerUrl && /* @__PURE__ */
|
|
4134
|
+
/* @__PURE__ */ jsx24("span", { children: sourceChainName }),
|
|
4135
|
+
sourceChainIcon && /* @__PURE__ */ jsx24("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx24("img", { src: sourceChainIcon, alt: "" }) }),
|
|
4136
|
+
sourceExplorerUrl && /* @__PURE__ */ jsx24(
|
|
3924
4137
|
"a",
|
|
3925
4138
|
{
|
|
3926
4139
|
href: sourceExplorerUrl,
|
|
@@ -3928,17 +4141,17 @@ function ProcessingStep({
|
|
|
3928
4141
|
rel: "noopener noreferrer",
|
|
3929
4142
|
className: "rs-review-detail-link",
|
|
3930
4143
|
"aria-label": "View source transaction",
|
|
3931
|
-
children: /* @__PURE__ */
|
|
4144
|
+
children: /* @__PURE__ */ jsx24(ExternalLinkIcon, {})
|
|
3932
4145
|
}
|
|
3933
4146
|
)
|
|
3934
4147
|
] })
|
|
3935
4148
|
] }),
|
|
3936
4149
|
/* @__PURE__ */ jsxs21("div", { className: "rs-review-detail-row", children: [
|
|
3937
|
-
/* @__PURE__ */
|
|
4150
|
+
/* @__PURE__ */ jsx24("span", { children: "Destination chain" }),
|
|
3938
4151
|
/* @__PURE__ */ jsxs21("span", { className: "rs-review-detail-value", children: [
|
|
3939
|
-
/* @__PURE__ */
|
|
3940
|
-
targetChainIcon && /* @__PURE__ */
|
|
3941
|
-
destExplorerUrl && /* @__PURE__ */
|
|
4152
|
+
/* @__PURE__ */ jsx24("span", { children: targetChainName }),
|
|
4153
|
+
targetChainIcon && /* @__PURE__ */ jsx24("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx24("img", { src: targetChainIcon, alt: "" }) }),
|
|
4154
|
+
destExplorerUrl && /* @__PURE__ */ jsx24(
|
|
3942
4155
|
"a",
|
|
3943
4156
|
{
|
|
3944
4157
|
href: destExplorerUrl,
|
|
@@ -3946,18 +4159,18 @@ function ProcessingStep({
|
|
|
3946
4159
|
rel: "noopener noreferrer",
|
|
3947
4160
|
className: "rs-review-detail-link",
|
|
3948
4161
|
"aria-label": "View destination transaction",
|
|
3949
|
-
children: /* @__PURE__ */
|
|
4162
|
+
children: /* @__PURE__ */ jsx24(ExternalLinkIcon, {})
|
|
3950
4163
|
}
|
|
3951
4164
|
)
|
|
3952
4165
|
] })
|
|
3953
4166
|
] }),
|
|
3954
4167
|
/* @__PURE__ */ jsxs21("div", { className: "rs-review-detail-row", children: [
|
|
3955
|
-
/* @__PURE__ */
|
|
3956
|
-
/* @__PURE__ */
|
|
4168
|
+
/* @__PURE__ */ jsx24("span", { children: isProcessing ? "Time elapsed" : "Total time" }),
|
|
4169
|
+
/* @__PURE__ */ jsx24("span", { className: "rs-review-detail-value", children: /* @__PURE__ */ jsx24(Ticker, { value: timerText }) })
|
|
3957
4170
|
] }),
|
|
3958
|
-
isSwappedOrder ? /* @__PURE__ */ jsxs21(
|
|
4171
|
+
isSwappedOrder ? /* @__PURE__ */ jsxs21(Fragment5, { children: [
|
|
3959
4172
|
swappedFiatContext?.paidAmountUsd != null && /* @__PURE__ */ jsxs21("div", { className: "rs-review-detail-row", children: [
|
|
3960
|
-
/* @__PURE__ */
|
|
4173
|
+
/* @__PURE__ */ jsx24("span", { children: "You pay" }),
|
|
3961
4174
|
/* @__PURE__ */ jsxs21("span", { className: "rs-review-detail-value", children: [
|
|
3962
4175
|
"$",
|
|
3963
4176
|
swappedFiatContext.paidAmountUsd.toFixed(2),
|
|
@@ -3969,50 +4182,50 @@ function ProcessingStep({
|
|
|
3969
4182
|
] })
|
|
3970
4183
|
] }),
|
|
3971
4184
|
swappedFiatContext?.onrampFeeUsd != null && /* @__PURE__ */ jsxs21("div", { className: "rs-review-detail-row", children: [
|
|
3972
|
-
/* @__PURE__ */
|
|
4185
|
+
/* @__PURE__ */ jsx24("span", { children: "On-ramp fee" }),
|
|
3973
4186
|
/* @__PURE__ */ jsxs21("span", { className: "rs-review-detail-value", children: [
|
|
3974
4187
|
"$",
|
|
3975
4188
|
swappedFiatContext.onrampFeeUsd.toFixed(2)
|
|
3976
4189
|
] })
|
|
3977
4190
|
] }),
|
|
3978
4191
|
formattedBridgingCost && /* @__PURE__ */ jsxs21("div", { className: "rs-review-detail-row", children: [
|
|
3979
|
-
/* @__PURE__ */
|
|
4192
|
+
/* @__PURE__ */ jsx24("span", { children: "Bridging cost" }),
|
|
3980
4193
|
/* @__PURE__ */ jsxs21("span", { className: "rs-review-detail-value", children: [
|
|
3981
4194
|
/* @__PURE__ */ jsxs21("span", { children: [
|
|
3982
4195
|
formattedBridgingCost,
|
|
3983
4196
|
" ",
|
|
3984
4197
|
sourceSymbol
|
|
3985
4198
|
] }),
|
|
3986
|
-
|
|
4199
|
+
/* @__PURE__ */ jsx24("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx24(TokenIcon, { symbol: sourceSymbol }) })
|
|
3987
4200
|
] })
|
|
3988
4201
|
] })
|
|
3989
4202
|
] }) : /* @__PURE__ */ jsxs21("div", { className: "rs-review-detail-row", children: [
|
|
3990
|
-
/* @__PURE__ */
|
|
4203
|
+
/* @__PURE__ */ jsx24("span", { children: isProcessing ? "You send" : "You sent" }),
|
|
3991
4204
|
/* @__PURE__ */ jsxs21("span", { className: "rs-review-detail-value", children: [
|
|
3992
4205
|
/* @__PURE__ */ jsxs21("span", { children: [
|
|
3993
4206
|
formattedSentAmount,
|
|
3994
4207
|
" ",
|
|
3995
4208
|
sourceSymbol
|
|
3996
4209
|
] }),
|
|
3997
|
-
|
|
4210
|
+
/* @__PURE__ */ jsx24("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx24(TokenIcon, { symbol: sourceSymbol }) })
|
|
3998
4211
|
] })
|
|
3999
4212
|
] }),
|
|
4000
4213
|
/* @__PURE__ */ jsxs21("div", { className: "rs-review-detail-row", children: [
|
|
4001
|
-
/* @__PURE__ */
|
|
4214
|
+
/* @__PURE__ */ jsx24("span", { children: isProcessing ? "Receive" : "Received" }),
|
|
4002
4215
|
/* @__PURE__ */ jsxs21("span", { className: "rs-review-detail-value", children: [
|
|
4003
|
-
/* @__PURE__ */
|
|
4004
|
-
|
|
4216
|
+
/* @__PURE__ */ jsx24("span", { children: receiveDisplay }),
|
|
4217
|
+
/* @__PURE__ */ jsx24("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx24(TokenIcon, { symbol: targetSymbol }) })
|
|
4005
4218
|
] })
|
|
4006
4219
|
] }),
|
|
4007
4220
|
isFailed && balanceAfterUsd !== void 0 && /* @__PURE__ */ jsxs21("div", { className: "rs-review-detail-row", children: [
|
|
4008
|
-
/* @__PURE__ */
|
|
4221
|
+
/* @__PURE__ */ jsx24("span", { children: "Balance" }),
|
|
4009
4222
|
/* @__PURE__ */ jsxs21("span", { className: "rs-review-detail-value", children: [
|
|
4010
4223
|
"$",
|
|
4011
4224
|
balanceAfterUsd.toFixed(2)
|
|
4012
4225
|
] })
|
|
4013
4226
|
] }),
|
|
4014
4227
|
isSwappedOrder ? quotedFeeAmount !== void 0 && /* @__PURE__ */ jsxs21("div", { className: "rs-review-detail-row", children: [
|
|
4015
|
-
/* @__PURE__ */
|
|
4228
|
+
/* @__PURE__ */ jsx24("span", { children: "Fees" }),
|
|
4016
4229
|
/* @__PURE__ */ jsxs21("span", { className: "rs-review-detail-value", children: [
|
|
4017
4230
|
/* @__PURE__ */ jsxs21(
|
|
4018
4231
|
"span",
|
|
@@ -4025,12 +4238,12 @@ function ProcessingStep({
|
|
|
4025
4238
|
]
|
|
4026
4239
|
}
|
|
4027
4240
|
),
|
|
4028
|
-
/* @__PURE__ */
|
|
4241
|
+
/* @__PURE__ */ jsx24(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx24(
|
|
4029
4242
|
"span",
|
|
4030
4243
|
{
|
|
4031
4244
|
className: "rs-review-detail-info",
|
|
4032
4245
|
"aria-label": "Fee info",
|
|
4033
|
-
children: /* @__PURE__ */
|
|
4246
|
+
children: /* @__PURE__ */ jsx24(InfoIcon, {})
|
|
4034
4247
|
}
|
|
4035
4248
|
) })
|
|
4036
4249
|
] })
|
|
@@ -4038,7 +4251,7 @@ function ProcessingStep({
|
|
|
4038
4251
|
const feeValue = quotedFeeAmount ?? formattedBridgingCost;
|
|
4039
4252
|
if (feeValue === void 0) return null;
|
|
4040
4253
|
return /* @__PURE__ */ jsxs21("div", { className: "rs-review-detail-row", children: [
|
|
4041
|
-
/* @__PURE__ */
|
|
4254
|
+
/* @__PURE__ */ jsx24("span", { children: "Fees" }),
|
|
4042
4255
|
/* @__PURE__ */ jsxs21("span", { className: "rs-review-detail-value", children: [
|
|
4043
4256
|
/* @__PURE__ */ jsxs21(
|
|
4044
4257
|
"span",
|
|
@@ -4051,20 +4264,20 @@ function ProcessingStep({
|
|
|
4051
4264
|
]
|
|
4052
4265
|
}
|
|
4053
4266
|
),
|
|
4054
|
-
/* @__PURE__ */
|
|
4267
|
+
/* @__PURE__ */ jsx24(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx24(
|
|
4055
4268
|
"span",
|
|
4056
4269
|
{
|
|
4057
4270
|
className: "rs-review-detail-info",
|
|
4058
4271
|
"aria-label": "Fee info",
|
|
4059
|
-
children: /* @__PURE__ */
|
|
4272
|
+
children: /* @__PURE__ */ jsx24(InfoIcon, {})
|
|
4060
4273
|
}
|
|
4061
4274
|
) })
|
|
4062
4275
|
] })
|
|
4063
4276
|
] });
|
|
4064
4277
|
})()
|
|
4065
4278
|
] }),
|
|
4066
|
-
isFailed && failureMessage && /* @__PURE__ */
|
|
4067
|
-
isProcessing && /* @__PURE__ */
|
|
4279
|
+
isFailed && failureMessage && /* @__PURE__ */ jsx24(Callout, { variant: "error", children: failureMessage }),
|
|
4280
|
+
isProcessing && /* @__PURE__ */ jsx24(
|
|
4068
4281
|
Button,
|
|
4069
4282
|
{
|
|
4070
4283
|
fullWidth: true,
|
|
@@ -4079,14 +4292,14 @@ function ProcessingStep({
|
|
|
4079
4292
|
"New ",
|
|
4080
4293
|
flowNoun
|
|
4081
4294
|
] }),
|
|
4082
|
-
onClose && /* @__PURE__ */
|
|
4295
|
+
onClose && /* @__PURE__ */ jsx24(Button, { onClick: onClose, fullWidth: true, children: "Done" })
|
|
4083
4296
|
] }),
|
|
4084
4297
|
isFailed && /* @__PURE__ */ jsxs21("div", { className: "rs-screen-button-row", children: [
|
|
4085
|
-
onClose && /* @__PURE__ */
|
|
4086
|
-
handleRetry && /* @__PURE__ */
|
|
4298
|
+
onClose && /* @__PURE__ */ jsx24(Button, { variant: "outline", onClick: onClose, fullWidth: true, children: "Cancel" }),
|
|
4299
|
+
handleRetry && /* @__PURE__ */ jsx24(Button, { onClick: handleRetry, fullWidth: true, children: "Try again" })
|
|
4087
4300
|
] })
|
|
4088
4301
|
] }),
|
|
4089
|
-
/* @__PURE__ */
|
|
4302
|
+
/* @__PURE__ */ jsx24(PoweredBy, {})
|
|
4090
4303
|
] });
|
|
4091
4304
|
}
|
|
4092
4305
|
|
|
@@ -4168,6 +4381,7 @@ export {
|
|
|
4168
4381
|
ConnectStep,
|
|
4169
4382
|
useLatestRef,
|
|
4170
4383
|
Button,
|
|
4384
|
+
TokenIcon,
|
|
4171
4385
|
debugLog,
|
|
4172
4386
|
debugError,
|
|
4173
4387
|
getAssetId,
|