@rhinestone/deposit-modal 0.3.0-alpha.12 → 0.3.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/dist/{DepositModalReown-EC4DJ3EC.cjs → DepositModalReown-CXPRZRXL.cjs} +6 -6
- package/dist/{DepositModalReown-QOTUF4JC.mjs → DepositModalReown-HBAWSK6K.mjs} +3 -3
- package/dist/{WithdrawModalReown-QEQPCSWT.mjs → WithdrawModalReown-EEWQRENY.mjs} +3 -3
- package/dist/{WithdrawModalReown-Z5JVENP6.cjs → WithdrawModalReown-T3TPJIME.cjs} +6 -6
- package/dist/{chunk-WVE3JN3C.mjs → chunk-6K4JHM2D.mjs} +343 -50
- package/dist/{chunk-YI63OMXN.cjs → chunk-6RCOF3XU.cjs} +57 -57
- package/dist/{chunk-2TWQGPPB.cjs → chunk-DZNXG5JK.cjs} +372 -79
- package/dist/{chunk-7MZNQ4C2.mjs → chunk-EC63ZHY4.mjs} +2 -2
- package/dist/{chunk-HR6BABPX.mjs → chunk-HZBO2SIZ.mjs} +1389 -393
- package/dist/{chunk-FGVSNARE.cjs → chunk-PWV2UJP3.cjs} +2 -2
- package/dist/{chunk-I5G5ULRP.cjs → chunk-SEOQ66FW.cjs} +1281 -285
- package/dist/{chunk-QXIJLRKC.mjs → chunk-YB3JPWJW.mjs} +1 -1
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +3 -3
- package/dist/styles.css +465 -1
- package/dist/{types-D6wrO4Ow.d.cts → types-C8i2ebY1.d.cts} +25 -0
- package/dist/{types-D6wrO4Ow.d.ts → types-C8i2ebY1.d.ts} +25 -0
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +2 -2
- package/package.json +3 -3
|
@@ -62,14 +62,14 @@ function Modal({
|
|
|
62
62
|
}
|
|
63
63
|
}, [isOpen]);
|
|
64
64
|
useEffect(() => {
|
|
65
|
-
if (isOpen) {
|
|
65
|
+
if (isOpen && !inline) {
|
|
66
66
|
const originalOverflow = document.body.style.overflow;
|
|
67
67
|
document.body.style.overflow = "hidden";
|
|
68
68
|
return () => {
|
|
69
69
|
document.body.style.overflow = originalOverflow;
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
}, [isOpen]);
|
|
72
|
+
}, [isOpen, inline]);
|
|
73
73
|
const handleKeyDown = useCallback(
|
|
74
74
|
(event) => {
|
|
75
75
|
if (event.key === "Escape") {
|
|
@@ -164,7 +164,10 @@ import {
|
|
|
164
164
|
Percent,
|
|
165
165
|
Clock,
|
|
166
166
|
CirclePlus,
|
|
167
|
-
CircleArrowOutUpLeft
|
|
167
|
+
CircleArrowOutUpLeft,
|
|
168
|
+
CreditCard,
|
|
169
|
+
Landmark,
|
|
170
|
+
Apple
|
|
168
171
|
} from "lucide-react";
|
|
169
172
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
170
173
|
var WalletIcon = Wallet;
|
|
@@ -207,6 +210,9 @@ var PercentIcon = Percent;
|
|
|
207
210
|
var ClockIcon = Clock;
|
|
208
211
|
var PlusCircleIcon = CirclePlus;
|
|
209
212
|
var CircleArrowOutUpLeftIcon = CircleArrowOutUpLeft;
|
|
213
|
+
var CardIcon = CreditCard;
|
|
214
|
+
var BankIcon = Landmark;
|
|
215
|
+
var AppleIcon = Apple;
|
|
210
216
|
|
|
211
217
|
// src/core/useLatestRef.ts
|
|
212
218
|
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
@@ -972,6 +978,150 @@ function createDepositService(baseUrl, options) {
|
|
|
972
978
|
debugError(debug, scope, "fetchPrices:error", err);
|
|
973
979
|
return {};
|
|
974
980
|
}
|
|
981
|
+
},
|
|
982
|
+
async getSwappedWidgetUrl(params) {
|
|
983
|
+
const url = apiUrl("/onramp/swapped/widget-url");
|
|
984
|
+
debugLog(debug, scope, "getSwappedWidgetUrl:request", {
|
|
985
|
+
smartAccount: shortRef(params.smartAccount),
|
|
986
|
+
method: params.method
|
|
987
|
+
});
|
|
988
|
+
const response = await fetch(url, {
|
|
989
|
+
method: "POST",
|
|
990
|
+
headers: { "Content-Type": "application/json" },
|
|
991
|
+
body: JSON.stringify(params)
|
|
992
|
+
});
|
|
993
|
+
if (!response.ok) {
|
|
994
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
995
|
+
debugError(debug, scope, "getSwappedWidgetUrl:failed", error, {
|
|
996
|
+
status: response.status
|
|
997
|
+
});
|
|
998
|
+
throw new Error(
|
|
999
|
+
error.error || `Swapped widget URL failed: ${response.status}`
|
|
1000
|
+
);
|
|
1001
|
+
}
|
|
1002
|
+
const body = await response.json();
|
|
1003
|
+
if (typeof body.url !== "string" || typeof body.currencyCode !== "string" || typeof body.externalCustomerId !== "string") {
|
|
1004
|
+
throw new Error("Swapped widget URL: malformed response");
|
|
1005
|
+
}
|
|
1006
|
+
return {
|
|
1007
|
+
url: body.url,
|
|
1008
|
+
currencyCode: body.currencyCode,
|
|
1009
|
+
sandbox: body.sandbox === true,
|
|
1010
|
+
externalCustomerId: body.externalCustomerId,
|
|
1011
|
+
expiresAt: body.expiresAt
|
|
1012
|
+
};
|
|
1013
|
+
},
|
|
1014
|
+
async getSwappedConnectUrl(params) {
|
|
1015
|
+
const url = apiUrl("/onramp/swapped/connect-url");
|
|
1016
|
+
debugLog(debug, scope, "getSwappedConnectUrl:request", {
|
|
1017
|
+
smartAccount: shortRef(params.smartAccount),
|
|
1018
|
+
connection: params.connection
|
|
1019
|
+
});
|
|
1020
|
+
const response = await fetch(url, {
|
|
1021
|
+
method: "POST",
|
|
1022
|
+
headers: { "Content-Type": "application/json" },
|
|
1023
|
+
body: JSON.stringify(params)
|
|
1024
|
+
});
|
|
1025
|
+
if (!response.ok) {
|
|
1026
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1027
|
+
debugError(debug, scope, "getSwappedConnectUrl:failed", error, {
|
|
1028
|
+
status: response.status
|
|
1029
|
+
});
|
|
1030
|
+
throw new Error(
|
|
1031
|
+
error.error || `Swapped Connect URL failed: ${response.status}`
|
|
1032
|
+
);
|
|
1033
|
+
}
|
|
1034
|
+
const body = await response.json();
|
|
1035
|
+
if (typeof body.url !== "string" || typeof body.currencyCode !== "string" || typeof body.externalCustomerId !== "string") {
|
|
1036
|
+
throw new Error("Swapped Connect URL: malformed response");
|
|
1037
|
+
}
|
|
1038
|
+
return {
|
|
1039
|
+
url: body.url,
|
|
1040
|
+
currencyCode: body.currencyCode,
|
|
1041
|
+
sandbox: body.sandbox === true,
|
|
1042
|
+
externalCustomerId: body.externalCustomerId,
|
|
1043
|
+
expiresAt: body.expiresAt
|
|
1044
|
+
};
|
|
1045
|
+
},
|
|
1046
|
+
async getSwappedConnectExchanges() {
|
|
1047
|
+
const url = apiUrl("/onramp/swapped/connect-exchanges");
|
|
1048
|
+
debugLog(debug, scope, "getSwappedConnectExchanges:request");
|
|
1049
|
+
const response = await fetch(url, {
|
|
1050
|
+
method: "GET",
|
|
1051
|
+
headers: { "Content-Type": "application/json" },
|
|
1052
|
+
cache: "no-store"
|
|
1053
|
+
});
|
|
1054
|
+
if (!response.ok) {
|
|
1055
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1056
|
+
debugError(debug, scope, "getSwappedConnectExchanges:failed", error, {
|
|
1057
|
+
status: response.status
|
|
1058
|
+
});
|
|
1059
|
+
throw new Error(
|
|
1060
|
+
error.error || `Swapped Connect exchanges failed: ${response.status}`
|
|
1061
|
+
);
|
|
1062
|
+
}
|
|
1063
|
+
const body = await response.json();
|
|
1064
|
+
const rawExchanges = Array.isArray(body.exchanges) ? body.exchanges : null;
|
|
1065
|
+
const exchanges = [];
|
|
1066
|
+
let hasMalformedExchange = rawExchanges === null;
|
|
1067
|
+
for (const exchange of rawExchanges ?? []) {
|
|
1068
|
+
if (!exchange || typeof exchange !== "object") {
|
|
1069
|
+
hasMalformedExchange = true;
|
|
1070
|
+
continue;
|
|
1071
|
+
}
|
|
1072
|
+
const raw = exchange;
|
|
1073
|
+
const connection = typeof raw.connection === "string" ? raw.connection : "";
|
|
1074
|
+
const name = typeof raw.name === "string" ? raw.name : "";
|
|
1075
|
+
const logoUrl = typeof raw.logoUrl === "string" || raw.logoUrl === null ? raw.logoUrl : null;
|
|
1076
|
+
if (!connection || !name) {
|
|
1077
|
+
hasMalformedExchange = true;
|
|
1078
|
+
continue;
|
|
1079
|
+
}
|
|
1080
|
+
exchanges.push({ connection, name, logoUrl });
|
|
1081
|
+
}
|
|
1082
|
+
if (hasMalformedExchange || typeof body.fetchedAt !== "string" || typeof body.expiresAt !== "string") {
|
|
1083
|
+
throw new Error("Swapped Connect exchanges: malformed response");
|
|
1084
|
+
}
|
|
1085
|
+
return {
|
|
1086
|
+
exchanges,
|
|
1087
|
+
fetchedAt: body.fetchedAt,
|
|
1088
|
+
expiresAt: body.expiresAt,
|
|
1089
|
+
stale: body.stale === true ? true : void 0
|
|
1090
|
+
};
|
|
1091
|
+
},
|
|
1092
|
+
async fetchSwappedOrderStatus(smartAccount) {
|
|
1093
|
+
const url = apiUrl(
|
|
1094
|
+
`/onramp/swapped/status/${encodeURIComponent(smartAccount)}`
|
|
1095
|
+
);
|
|
1096
|
+
const response = await fetch(url, {
|
|
1097
|
+
method: "GET",
|
|
1098
|
+
headers: { "Content-Type": "application/json" },
|
|
1099
|
+
cache: "no-store"
|
|
1100
|
+
});
|
|
1101
|
+
if (!response.ok) return null;
|
|
1102
|
+
let body = null;
|
|
1103
|
+
try {
|
|
1104
|
+
body = await response.json();
|
|
1105
|
+
} catch {
|
|
1106
|
+
return null;
|
|
1107
|
+
}
|
|
1108
|
+
if (!body || body.ok !== true) return null;
|
|
1109
|
+
const status = typeof body.status === "string" ? body.status : null;
|
|
1110
|
+
const orderId = typeof body.orderId === "string" ? body.orderId : null;
|
|
1111
|
+
if (!status || !orderId) return null;
|
|
1112
|
+
const numericOrNull = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
1113
|
+
return {
|
|
1114
|
+
orderId,
|
|
1115
|
+
status,
|
|
1116
|
+
orderCrypto: typeof body.orderCrypto === "string" ? body.orderCrypto : null,
|
|
1117
|
+
orderCryptoAmount: typeof body.orderCryptoAmount === "string" ? body.orderCryptoAmount : null,
|
|
1118
|
+
transactionId: typeof body.transactionId === "string" ? body.transactionId : null,
|
|
1119
|
+
receivedAt: typeof body.receivedAt === "string" ? body.receivedAt : null,
|
|
1120
|
+
paidAmountUsd: numericOrNull(body.paidAmountUsd),
|
|
1121
|
+
paidAmountEur: numericOrNull(body.paidAmountEur),
|
|
1122
|
+
onrampFeeUsd: numericOrNull(body.onrampFeeUsd),
|
|
1123
|
+
paymentMethod: typeof body.paymentMethod === "string" ? body.paymentMethod : null
|
|
1124
|
+
};
|
|
975
1125
|
}
|
|
976
1126
|
};
|
|
977
1127
|
}
|
|
@@ -1833,6 +1983,11 @@ function formatBalanceUsd(value) {
|
|
|
1833
1983
|
if (!Number.isFinite(value) || value <= 0) return "$0.00";
|
|
1834
1984
|
return `$${value.toFixed(2)}`;
|
|
1835
1985
|
}
|
|
1986
|
+
function fiatIcon(name) {
|
|
1987
|
+
if (name === "apple") return /* @__PURE__ */ jsx14(AppleIcon, {});
|
|
1988
|
+
if (name === "bank") return /* @__PURE__ */ jsx14(BankIcon, {});
|
|
1989
|
+
return /* @__PURE__ */ jsx14(CardIcon, {});
|
|
1990
|
+
}
|
|
1836
1991
|
function shorten(addr) {
|
|
1837
1992
|
return addr.length > 12 ? `${addr.slice(0, 6)}...${addr.slice(-4)}` : addr;
|
|
1838
1993
|
}
|
|
@@ -1873,6 +2028,10 @@ function ConnectStep({
|
|
|
1873
2028
|
onSelectTransferCrypto,
|
|
1874
2029
|
transferCryptoState,
|
|
1875
2030
|
transferCryptoErrorReason,
|
|
2031
|
+
onSelectPayWithCard,
|
|
2032
|
+
fiatPaymentMethods,
|
|
2033
|
+
onSelectFiatMethod,
|
|
2034
|
+
onSelectFundFromExchange,
|
|
1876
2035
|
onRequestConnect,
|
|
1877
2036
|
onConnect,
|
|
1878
2037
|
onDisconnect,
|
|
@@ -1911,6 +2070,33 @@ function ConnectStep({
|
|
|
1911
2070
|
trailing: transferCryptoState === "loading" ? SMALL_SPINNER : void 0
|
|
1912
2071
|
}
|
|
1913
2072
|
),
|
|
2073
|
+
fiatPaymentMethods && fiatPaymentMethods.length > 0 && onSelectFiatMethod ? fiatPaymentMethods.map((opt) => /* @__PURE__ */ jsx14(
|
|
2074
|
+
ListRow,
|
|
2075
|
+
{
|
|
2076
|
+
leading: fiatIcon(opt.icon),
|
|
2077
|
+
title: opt.label,
|
|
2078
|
+
subtitle: opt.sublabel,
|
|
2079
|
+
onClick: () => onSelectFiatMethod(opt.method)
|
|
2080
|
+
},
|
|
2081
|
+
opt.method
|
|
2082
|
+
)) : onSelectPayWithCard && /* @__PURE__ */ jsx14(
|
|
2083
|
+
ListRow,
|
|
2084
|
+
{
|
|
2085
|
+
leading: /* @__PURE__ */ jsx14(CardIcon, {}),
|
|
2086
|
+
title: "Pay with Card",
|
|
2087
|
+
subtitle: "Buy crypto with card or bank",
|
|
2088
|
+
onClick: onSelectPayWithCard
|
|
2089
|
+
}
|
|
2090
|
+
),
|
|
2091
|
+
onSelectFundFromExchange && /* @__PURE__ */ jsx14(
|
|
2092
|
+
ListRow,
|
|
2093
|
+
{
|
|
2094
|
+
leading: /* @__PURE__ */ jsx14(BankIcon, {}),
|
|
2095
|
+
title: "Fund from Exchange",
|
|
2096
|
+
subtitle: "Use Coinbase, Binance, MetaMask\u2026",
|
|
2097
|
+
onClick: onSelectFundFromExchange
|
|
2098
|
+
}
|
|
2099
|
+
),
|
|
1914
2100
|
rows.map((row) => {
|
|
1915
2101
|
const collapseToExternal = Boolean(onSelectTransferCrypto) && row.kind !== "solana";
|
|
1916
2102
|
const subtitleText = row.state === "loading" ? "Preparing\u2026" : row.state === "error" ? row.errorReason ?? "Couldn't prepare wallet \u2014 tap to retry" : shorten(row.address);
|
|
@@ -2271,6 +2457,9 @@ function getEventSourceDetails(event) {
|
|
|
2271
2457
|
function isDepositEvent(event) {
|
|
2272
2458
|
return 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";
|
|
2273
2459
|
}
|
|
2460
|
+
function isFailedEvent(event) {
|
|
2461
|
+
return event?.type === "bridge-failed" || event?.type === "post-bridge-swap-failed" || event?.type === "error";
|
|
2462
|
+
}
|
|
2274
2463
|
function isHexString(value) {
|
|
2275
2464
|
return value.startsWith("0x") || value.startsWith("0X");
|
|
2276
2465
|
}
|
|
@@ -2280,6 +2469,41 @@ function txRefsMatch(a, b) {
|
|
|
2280
2469
|
}
|
|
2281
2470
|
return a === b;
|
|
2282
2471
|
}
|
|
2472
|
+
function formatBridgeFailedMessage(event) {
|
|
2473
|
+
const eventData = event?.data ?? {};
|
|
2474
|
+
const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
|
|
2475
|
+
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
2476
|
+
function toUserFacingFailure(raw) {
|
|
2477
|
+
const lower = raw.toLowerCase();
|
|
2478
|
+
if (lower.includes("insufficient funds")) {
|
|
2479
|
+
return "Deposit was received, but processing could not continue due to insufficient funds. Please retry.";
|
|
2480
|
+
}
|
|
2481
|
+
if (lower.includes("no valid quote available")) {
|
|
2482
|
+
return "No bridge route is currently available for this transfer. Please try again shortly.";
|
|
2483
|
+
}
|
|
2484
|
+
if (lower.includes("simulation failed")) {
|
|
2485
|
+
return "Transfer processing failed during simulation. Please retry.";
|
|
2486
|
+
}
|
|
2487
|
+
if (raw.length > 220) {
|
|
2488
|
+
return "Transfer processing failed. Please retry.";
|
|
2489
|
+
}
|
|
2490
|
+
return raw;
|
|
2491
|
+
}
|
|
2492
|
+
if (backendMessage.length > 0) {
|
|
2493
|
+
return { message: toUserFacingFailure(backendMessage), code };
|
|
2494
|
+
}
|
|
2495
|
+
if (code) {
|
|
2496
|
+
return { message: `Bridge failed (${code})`, code };
|
|
2497
|
+
}
|
|
2498
|
+
return { message: "Bridge failed" };
|
|
2499
|
+
}
|
|
2500
|
+
function failureMessageForEvent(event) {
|
|
2501
|
+
if (event?.type === "error") {
|
|
2502
|
+
const message = isRecord(event.data) ? asString(event.data.message) : void 0;
|
|
2503
|
+
return message ?? "Unknown error";
|
|
2504
|
+
}
|
|
2505
|
+
return formatBridgeFailedMessage(event).message;
|
|
2506
|
+
}
|
|
2283
2507
|
|
|
2284
2508
|
// src/components/steps/ProcessingStep.tsx
|
|
2285
2509
|
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
@@ -2353,6 +2577,24 @@ var SOFT_DELAY_MS = {
|
|
|
2353
2577
|
bridging: 4 * 60 * 1e3
|
|
2354
2578
|
};
|
|
2355
2579
|
var PHASE_TIMINGS_PREFIX = "rhinestone:phase-timings";
|
|
2580
|
+
var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set([
|
|
2581
|
+
"USDC",
|
|
2582
|
+
"USDT",
|
|
2583
|
+
"DAI",
|
|
2584
|
+
"FRAX",
|
|
2585
|
+
"PYUSD",
|
|
2586
|
+
"USDP",
|
|
2587
|
+
"TUSD",
|
|
2588
|
+
"GUSD",
|
|
2589
|
+
"USDS",
|
|
2590
|
+
"LUSD",
|
|
2591
|
+
"BUSD",
|
|
2592
|
+
"USDE"
|
|
2593
|
+
]);
|
|
2594
|
+
function maxFractionDigitsFor(symbol) {
|
|
2595
|
+
if (!symbol) return 6;
|
|
2596
|
+
return STABLECOIN_SYMBOLS.has(symbol.toUpperCase()) ? 3 : 6;
|
|
2597
|
+
}
|
|
2356
2598
|
function loadPhaseTimings(txHash) {
|
|
2357
2599
|
if (typeof window === "undefined") return null;
|
|
2358
2600
|
try {
|
|
@@ -2380,38 +2622,6 @@ function isEventForTx(event, txHash) {
|
|
|
2380
2622
|
if (!eventTxHash) return false;
|
|
2381
2623
|
return txRefsMatch(eventTxHash, txHash);
|
|
2382
2624
|
}
|
|
2383
|
-
function formatBridgeFailedMessage(event) {
|
|
2384
|
-
const eventData = event?.data ?? {};
|
|
2385
|
-
const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
|
|
2386
|
-
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
2387
|
-
function toUserFacingFailure(raw) {
|
|
2388
|
-
const lower = raw.toLowerCase();
|
|
2389
|
-
if (lower.includes("insufficient funds")) {
|
|
2390
|
-
return "Deposit was received, but processing could not continue due to insufficient funds. Please retry.";
|
|
2391
|
-
}
|
|
2392
|
-
if (lower.includes("no valid quote available")) {
|
|
2393
|
-
return "No bridge route is currently available for this transfer. Please try again shortly.";
|
|
2394
|
-
}
|
|
2395
|
-
if (lower.includes("simulation failed")) {
|
|
2396
|
-
return "Transfer processing failed during simulation. Please retry.";
|
|
2397
|
-
}
|
|
2398
|
-
if (raw.length > 220) {
|
|
2399
|
-
return "Transfer processing failed. Please retry.";
|
|
2400
|
-
}
|
|
2401
|
-
return raw;
|
|
2402
|
-
}
|
|
2403
|
-
if (backendMessage.length > 0) {
|
|
2404
|
-
const userMessage = toUserFacingFailure(backendMessage);
|
|
2405
|
-
return {
|
|
2406
|
-
message: userMessage,
|
|
2407
|
-
code
|
|
2408
|
-
};
|
|
2409
|
-
}
|
|
2410
|
-
if (code) {
|
|
2411
|
-
return { message: `Bridge failed (${code})`, code };
|
|
2412
|
-
}
|
|
2413
|
-
return { message: "Bridge failed" };
|
|
2414
|
-
}
|
|
2415
2625
|
function parseWebhookTimestamp(event) {
|
|
2416
2626
|
if (typeof event?.time !== "string") return void 0;
|
|
2417
2627
|
const timestamp = Date.parse(event.time);
|
|
@@ -2502,7 +2712,7 @@ function ProcessingStep({
|
|
|
2502
2712
|
debug,
|
|
2503
2713
|
targetToken,
|
|
2504
2714
|
uiConfig,
|
|
2505
|
-
quotedFeeAmount
|
|
2715
|
+
quotedFeeAmount,
|
|
2506
2716
|
quotedFeeSymbol,
|
|
2507
2717
|
balanceAfterUsd,
|
|
2508
2718
|
onClose,
|
|
@@ -2604,6 +2814,25 @@ function ProcessingStep({
|
|
|
2604
2814
|
(previous) => syncPhaseTimings(previous, state.lastEvent)
|
|
2605
2815
|
);
|
|
2606
2816
|
}, [state.lastEvent?.time, state.lastEvent?.type, updatePhaseTimings]);
|
|
2817
|
+
const [swappedFiatContext, setSwappedFiatContext] = useState2(null);
|
|
2818
|
+
useEffect4(() => {
|
|
2819
|
+
let cancelled = false;
|
|
2820
|
+
service.fetchSwappedOrderStatus(smartAccount).then((res) => {
|
|
2821
|
+
if (cancelled || !res) return;
|
|
2822
|
+
if (!res.transactionId) return;
|
|
2823
|
+
if (res.transactionId.toLowerCase() !== txHash.toLowerCase()) return;
|
|
2824
|
+
setSwappedFiatContext({
|
|
2825
|
+
paidAmountUsd: res.paidAmountUsd,
|
|
2826
|
+
paidAmountEur: res.paidAmountEur,
|
|
2827
|
+
onrampFeeUsd: res.onrampFeeUsd,
|
|
2828
|
+
paymentMethod: res.paymentMethod
|
|
2829
|
+
});
|
|
2830
|
+
}).catch(() => {
|
|
2831
|
+
});
|
|
2832
|
+
return () => {
|
|
2833
|
+
cancelled = true;
|
|
2834
|
+
};
|
|
2835
|
+
}, [service, smartAccount, txHash]);
|
|
2607
2836
|
useEffect4(() => {
|
|
2608
2837
|
if (directTransfer) return;
|
|
2609
2838
|
if (state.type !== "processing") {
|
|
@@ -2797,6 +3026,7 @@ function ProcessingStep({
|
|
|
2797
3026
|
displaySourceToken,
|
|
2798
3027
|
displaySourceChain
|
|
2799
3028
|
) : providedSourceDecimals ?? 18;
|
|
3029
|
+
const amountMaxDigits = maxFractionDigitsFor(sourceSymbol);
|
|
2800
3030
|
const formattedReceivedAmount = (() => {
|
|
2801
3031
|
try {
|
|
2802
3032
|
const raw = formatUnits(BigInt(displayAmount), sourceDecimals);
|
|
@@ -2804,15 +3034,56 @@ function ProcessingStep({
|
|
|
2804
3034
|
if (!Number.isFinite(numeric)) return raw;
|
|
2805
3035
|
return numeric.toLocaleString("en-US", {
|
|
2806
3036
|
minimumFractionDigits: 2,
|
|
2807
|
-
maximumFractionDigits:
|
|
3037
|
+
maximumFractionDigits: amountMaxDigits
|
|
2808
3038
|
});
|
|
2809
3039
|
} catch {
|
|
2810
3040
|
return Number(displayAmount).toLocaleString("en-US", {
|
|
2811
3041
|
minimumFractionDigits: 2,
|
|
2812
|
-
maximumFractionDigits:
|
|
3042
|
+
maximumFractionDigits: amountMaxDigits
|
|
2813
3043
|
});
|
|
2814
3044
|
}
|
|
2815
3045
|
})();
|
|
3046
|
+
const destinationAmountRaw = (() => {
|
|
3047
|
+
const dest = lastEvent?.data?.destination;
|
|
3048
|
+
if (!dest || dest.amount === void 0) return void 0;
|
|
3049
|
+
try {
|
|
3050
|
+
return BigInt(dest.amount);
|
|
3051
|
+
} catch {
|
|
3052
|
+
return void 0;
|
|
3053
|
+
}
|
|
3054
|
+
})();
|
|
3055
|
+
const sourceAmountRaw = (() => {
|
|
3056
|
+
try {
|
|
3057
|
+
return BigInt(displayAmount);
|
|
3058
|
+
} catch {
|
|
3059
|
+
return void 0;
|
|
3060
|
+
}
|
|
3061
|
+
})();
|
|
3062
|
+
const bridgingCostRaw = sourceAmountRaw !== void 0 && destinationAmountRaw !== void 0 && sourceAmountRaw > destinationAmountRaw ? sourceAmountRaw - destinationAmountRaw : void 0;
|
|
3063
|
+
const formattedDestinationAmount = destinationAmountRaw !== void 0 ? (() => {
|
|
3064
|
+
try {
|
|
3065
|
+
const raw = formatUnits(destinationAmountRaw, sourceDecimals);
|
|
3066
|
+
const numeric = Number(raw);
|
|
3067
|
+
if (!Number.isFinite(numeric)) return raw;
|
|
3068
|
+
return numeric.toLocaleString("en-US", {
|
|
3069
|
+
maximumFractionDigits: amountMaxDigits
|
|
3070
|
+
});
|
|
3071
|
+
} catch {
|
|
3072
|
+
return void 0;
|
|
3073
|
+
}
|
|
3074
|
+
})() : void 0;
|
|
3075
|
+
const formattedBridgingCost = bridgingCostRaw !== void 0 ? (() => {
|
|
3076
|
+
try {
|
|
3077
|
+
const raw = formatUnits(bridgingCostRaw, sourceDecimals);
|
|
3078
|
+
const numeric = Number(raw);
|
|
3079
|
+
if (!Number.isFinite(numeric)) return raw;
|
|
3080
|
+
return numeric.toLocaleString("en-US", {
|
|
3081
|
+
maximumFractionDigits: amountMaxDigits
|
|
3082
|
+
});
|
|
3083
|
+
} catch {
|
|
3084
|
+
return void 0;
|
|
3085
|
+
}
|
|
3086
|
+
})() : void 0;
|
|
2816
3087
|
const currentPhaseId = getCurrentPhaseId(state, phaseTimings);
|
|
2817
3088
|
const activePhaseStartedAt = currentPhaseId ? getPhaseStartTime(currentPhaseId, phaseTimings) : void 0;
|
|
2818
3089
|
const activePhaseElapsedMs = isProcessing && activePhaseStartedAt !== void 0 ? timelineNowMs - activePhaseStartedAt : 0;
|
|
@@ -2885,11 +3156,29 @@ function ProcessingStep({
|
|
|
2885
3156
|
/* @__PURE__ */ jsx18("span", { children: isProcessing ? "Time elapsed" : "Total time" }),
|
|
2886
3157
|
/* @__PURE__ */ jsx18("span", { className: "rs-review-detail-value", children: /* @__PURE__ */ jsx18(Ticker, { value: timerText }) })
|
|
2887
3158
|
] }),
|
|
2888
|
-
/* @__PURE__ */ jsxs16("div", { className: "rs-review-detail-row", children: [
|
|
2889
|
-
/* @__PURE__ */ jsx18("span", { children: "
|
|
3159
|
+
swappedFiatContext?.paidAmountUsd != null && /* @__PURE__ */ jsxs16("div", { className: "rs-review-detail-row", children: [
|
|
3160
|
+
/* @__PURE__ */ jsx18("span", { children: "Paid" }),
|
|
3161
|
+
/* @__PURE__ */ jsxs16("span", { className: "rs-review-detail-value", children: [
|
|
3162
|
+
"$",
|
|
3163
|
+
swappedFiatContext.paidAmountUsd.toFixed(2),
|
|
3164
|
+
swappedFiatContext.paymentMethod && /* @__PURE__ */ jsxs16("span", { style: { color: "#71717b", marginLeft: 6 }, children: [
|
|
3165
|
+
"via ",
|
|
3166
|
+
swappedFiatContext.paymentMethod
|
|
3167
|
+
] })
|
|
3168
|
+
] })
|
|
3169
|
+
] }),
|
|
3170
|
+
swappedFiatContext?.onrampFeeUsd != null && /* @__PURE__ */ jsxs16("div", { className: "rs-review-detail-row", children: [
|
|
3171
|
+
/* @__PURE__ */ jsx18("span", { children: "On-ramp fee" }),
|
|
3172
|
+
/* @__PURE__ */ jsxs16("span", { className: "rs-review-detail-value", children: [
|
|
3173
|
+
"$",
|
|
3174
|
+
swappedFiatContext.onrampFeeUsd.toFixed(2)
|
|
3175
|
+
] })
|
|
3176
|
+
] }),
|
|
3177
|
+
formattedBridgingCost && /* @__PURE__ */ jsxs16("div", { className: "rs-review-detail-row", children: [
|
|
3178
|
+
/* @__PURE__ */ jsx18("span", { children: "Bridging cost" }),
|
|
2890
3179
|
/* @__PURE__ */ jsxs16("span", { className: "rs-review-detail-value", children: [
|
|
2891
3180
|
/* @__PURE__ */ jsxs16("span", { children: [
|
|
2892
|
-
|
|
3181
|
+
formattedBridgingCost,
|
|
2893
3182
|
" ",
|
|
2894
3183
|
sourceSymbol
|
|
2895
3184
|
] }),
|
|
@@ -2899,12 +3188,7 @@ function ProcessingStep({
|
|
|
2899
3188
|
/* @__PURE__ */ jsxs16("div", { className: "rs-review-detail-row", children: [
|
|
2900
3189
|
/* @__PURE__ */ jsx18("span", { children: "Receive" }),
|
|
2901
3190
|
/* @__PURE__ */ jsxs16("span", { className: "rs-review-detail-value", children: [
|
|
2902
|
-
/* @__PURE__ */
|
|
2903
|
-
"~",
|
|
2904
|
-
formattedReceivedAmount,
|
|
2905
|
-
" ",
|
|
2906
|
-
targetSymbol
|
|
2907
|
-
] }),
|
|
3191
|
+
/* @__PURE__ */ jsx18("span", { children: formattedDestinationAmount ? `${formattedDestinationAmount} ${targetSymbol}` : `~${formattedReceivedAmount} ${targetSymbol}` }),
|
|
2908
3192
|
targetTokenIcon && /* @__PURE__ */ jsx18("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx18("img", { src: targetTokenIcon, alt: "" }) })
|
|
2909
3193
|
] })
|
|
2910
3194
|
] }),
|
|
@@ -2915,14 +3199,18 @@ function ProcessingStep({
|
|
|
2915
3199
|
balanceAfterUsd.toFixed(2)
|
|
2916
3200
|
] })
|
|
2917
3201
|
] }),
|
|
2918
|
-
/* @__PURE__ */ jsxs16("div", { className: "rs-review-detail-row", children: [
|
|
3202
|
+
quotedFeeAmount !== void 0 && /* @__PURE__ */ jsxs16("div", { className: "rs-review-detail-row", children: [
|
|
2919
3203
|
/* @__PURE__ */ jsx18("span", { children: "Fees" }),
|
|
2920
3204
|
/* @__PURE__ */ jsxs16("span", { className: "rs-review-detail-value", children: [
|
|
2921
|
-
/* @__PURE__ */
|
|
3205
|
+
/* @__PURE__ */ jsxs16(
|
|
2922
3206
|
"span",
|
|
2923
3207
|
{
|
|
2924
3208
|
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
2925
|
-
children:
|
|
3209
|
+
children: [
|
|
3210
|
+
quotedFeeAmount,
|
|
3211
|
+
" ",
|
|
3212
|
+
quotedFeeSymbol ?? sourceSymbol
|
|
3213
|
+
]
|
|
2926
3214
|
}
|
|
2927
3215
|
),
|
|
2928
3216
|
/* @__PURE__ */ jsx18(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx18("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx18(InfoIcon, {}) }) })
|
|
@@ -3315,6 +3603,7 @@ export {
|
|
|
3315
3603
|
ChevronLeftIcon,
|
|
3316
3604
|
ChevronDownIcon,
|
|
3317
3605
|
CloseIcon,
|
|
3606
|
+
HandCoinsIcon,
|
|
3318
3607
|
HistoryIcon,
|
|
3319
3608
|
InfoIcon,
|
|
3320
3609
|
CopyIcon,
|
|
@@ -3324,6 +3613,7 @@ export {
|
|
|
3324
3613
|
ClockIcon,
|
|
3325
3614
|
PlusCircleIcon,
|
|
3326
3615
|
CircleArrowOutUpLeftIcon,
|
|
3616
|
+
BankIcon,
|
|
3327
3617
|
BodyHeader,
|
|
3328
3618
|
PoweredBy,
|
|
3329
3619
|
Spinner,
|
|
@@ -3348,8 +3638,11 @@ export {
|
|
|
3348
3638
|
formatUserError,
|
|
3349
3639
|
Tooltip,
|
|
3350
3640
|
getEventTxHash,
|
|
3641
|
+
getEventSourceDetails,
|
|
3351
3642
|
isDepositEvent,
|
|
3643
|
+
isFailedEvent,
|
|
3352
3644
|
txRefsMatch,
|
|
3645
|
+
failureMessageForEvent,
|
|
3353
3646
|
ProcessingStep,
|
|
3354
3647
|
SAFE_ABI,
|
|
3355
3648
|
executeSafeEthTransfer,
|