@rhinestone/deposit-modal 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/bridge-transcript.json +14 -0
- package/dist/ClaimModal-GFDBVCN5.cjs +11 -0
- package/dist/ClaimModal-VQS3AKEL.mjs +11 -0
- package/dist/{DepositModalReown-Q2JMLT47.mjs → DepositModalReown-KOJ7VEY7.mjs} +30 -29
- package/dist/{DepositModalReown-46LPVFB6.cjs → DepositModalReown-R37SSHUF.cjs} +79 -78
- package/dist/WithdrawModal-QVXHMH43.mjs +12 -0
- package/dist/WithdrawModal-RY2NMFLE.cjs +12 -0
- package/dist/{caip-D8aRWdEY.d.cts → caip-BMi-9t09.d.cts} +27 -3
- package/dist/{caip-D8aRWdEY.d.ts → caip-BMi-9t09.d.ts} +27 -3
- package/dist/{chunk-V2OBGLJD.cjs → chunk-3OOY67VJ.cjs} +1103 -253
- package/dist/{chunk-6KG642KH.cjs → chunk-5P2PVLS4.cjs} +1 -1
- package/dist/{chunk-IN77XSWO.mjs → chunk-5VONFVQN.mjs} +976 -126
- package/dist/chunk-6HUHVXCY.cjs +704 -0
- package/dist/{chunk-PKML3XVS.mjs → chunk-7UQ6OUEE.mjs} +166 -45
- package/dist/{chunk-K4H6TGBE.mjs → chunk-CXBMIZUF.mjs} +1 -1
- package/dist/{chunk-MTFJSE52.cjs → chunk-DTVZUBHI.cjs} +236 -115
- package/dist/{chunk-VUATPOWJ.mjs → chunk-EAGMY3QE.mjs} +74 -17
- package/dist/{chunk-RN5VKWI6.mjs → chunk-FTWKAJGN.mjs} +1 -1
- package/dist/{chunk-KTUVSKR4.mjs → chunk-IKUYZA7A.mjs} +265 -523
- package/dist/{chunk-DW2EQA2U.cjs → chunk-LVCD6RHF.cjs} +2 -2
- package/dist/{chunk-4KCSH4T3.cjs → chunk-OY5N3E6L.cjs} +86 -29
- package/dist/chunk-QJ7RCCU7.mjs +704 -0
- package/dist/chunk-UCBUCX2W.mjs +3169 -0
- package/dist/{chunk-YCQZJQO6.cjs → chunk-VPDCGD2D.cjs} +622 -880
- package/dist/{chunk-7ICSHJFE.cjs → chunk-X4D52IZK.cjs} +1501 -176
- package/dist/claim.cjs +5 -7
- package/dist/claim.d.cts +3 -3
- package/dist/claim.d.ts +3 -3
- package/dist/claim.mjs +4 -6
- package/dist/{constants-DBrWhJWE.d.cts → constants-BT4ctuHo.d.cts} +7 -6
- package/dist/{constants-DBrWhJWE.d.ts → constants-D21ZdNOP.d.ts} +7 -6
- package/dist/constants.cjs +3 -3
- package/dist/constants.d.cts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants.mjs +2 -2
- package/dist/deposit.cjs +7 -8
- package/dist/deposit.d.cts +3 -3
- package/dist/deposit.d.ts +3 -3
- package/dist/deposit.mjs +6 -7
- package/dist/embed.cjs +135 -44
- package/dist/embed.d.cts +2 -2
- package/dist/embed.d.ts +2 -2
- package/dist/embed.mjs +116 -25
- package/dist/index.cjs +13 -11
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +12 -10
- package/dist/polymarket.cjs +6 -6
- package/dist/polymarket.mjs +2 -2
- package/dist/styles.css +132 -100
- package/dist/{types-Bho4OA03.d.ts → types-CQ0NHqCy.d.ts} +146 -11
- package/dist/{types-DP_3KwlD.d.cts → types-CxiLX5sv.d.cts} +146 -11
- package/dist/withdraw.cjs +6 -6
- package/dist/withdraw.d.cts +4 -4
- package/dist/withdraw.d.ts +4 -4
- package/dist/withdraw.mjs +5 -5
- package/package.json +7 -6
- package/dist/ClaimModal-IKTJU43Y.cjs +0 -13
- package/dist/ClaimModal-SEKNWRMA.mjs +0 -13
- package/dist/WithdrawModal-5ICGD4HJ.mjs +0 -12
- package/dist/WithdrawModal-VP6PMIRO.cjs +0 -12
- package/dist/chunk-7SR7ENVJ.mjs +0 -1844
- package/dist/chunk-CFKC77SV.mjs +0 -1062
- package/dist/chunk-LZFRL2AL.cjs +0 -81
- package/dist/chunk-WUJIKCFU.mjs +0 -81
- package/dist/chunk-X2IPAPXU.cjs +0 -163
- package/dist/chunk-YWMWI7PZ.cjs +0 -1062
- package/dist/chunk-ZEO6ADM3.mjs +0 -163
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var _chunkV2OBGLJDcjs = require('./chunk-V2OBGLJD.cjs');
|
|
28
27
|
|
|
29
28
|
|
|
30
29
|
|
|
@@ -34,7 +33,1214 @@ var _chunkV2OBGLJDcjs = require('./chunk-V2OBGLJD.cjs');
|
|
|
34
33
|
|
|
35
34
|
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
var _chunk3OOY67VJcjs = require('./chunk-3OOY67VJ.cjs');
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
var _chunkOY5N3E6Lcjs = require('./chunk-OY5N3E6L.cjs');
|
|
71
|
+
|
|
72
|
+
// src/core/history-status.ts
|
|
73
|
+
function normalizeStatus(raw, isSpam) {
|
|
74
|
+
const lower = raw.toLowerCase();
|
|
75
|
+
if (lower === "completed" || lower === "complete" || lower === "bridge-complete" || lower === "processed")
|
|
76
|
+
return "completed";
|
|
77
|
+
if (lower === "failed" || lower === "error" || lower === "bridge-failed" || lower === "rejected") {
|
|
78
|
+
return isSpam ? "spam" : "failed";
|
|
79
|
+
}
|
|
80
|
+
if (lower === "refunded") return "refunded";
|
|
81
|
+
if (lower === "processing" || lower === "submitted" || lower === "bridging")
|
|
82
|
+
return "processing";
|
|
83
|
+
return "pending";
|
|
84
|
+
}
|
|
85
|
+
var STATUS_LABEL = {
|
|
86
|
+
pending: "Pending",
|
|
87
|
+
processing: "Processing",
|
|
88
|
+
completed: "Completed",
|
|
89
|
+
failed: "Failed",
|
|
90
|
+
refunded: "Refunded",
|
|
91
|
+
spam: "Spam token"
|
|
92
|
+
};
|
|
93
|
+
function filterVisibleDeposits(deposits) {
|
|
94
|
+
const sourceHashes = new Set(
|
|
95
|
+
deposits.map((d) => _optionalChain([d, 'access', _ => _.sourceTxHash, 'optionalAccess', _2 => _2.toLowerCase, 'call', _3 => _3()])).filter((h) => Boolean(h))
|
|
96
|
+
);
|
|
97
|
+
return deposits.filter(
|
|
98
|
+
(d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/core/history-badge.ts
|
|
103
|
+
function deriveHistoryBadge(deposits, { recipient, canRecover }) {
|
|
104
|
+
const visible = filterVisibleDeposits(deposits);
|
|
105
|
+
if (canRecover) {
|
|
106
|
+
const needsYou = visible.filter(
|
|
107
|
+
(row) => _chunk3OOY67VJcjs.toRecoverableDeposit.call(void 0, row, { recipient }) !== null
|
|
108
|
+
).length;
|
|
109
|
+
if (needsYou > 0) return { state: "needs-you", count: needsYou };
|
|
110
|
+
}
|
|
111
|
+
const inProgress = visible.filter((row) => {
|
|
112
|
+
const status = normalizeStatus(row.status, row.isSpam);
|
|
113
|
+
return status === "pending" || status === "processing";
|
|
114
|
+
}).length;
|
|
115
|
+
if (inProgress > 0) return { state: "progress", count: inProgress };
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
function historyBadgeAriaLabel(badge) {
|
|
119
|
+
if (!badge) return "Deposit history";
|
|
120
|
+
const single = badge.count === 1;
|
|
121
|
+
const noun = single ? "deposit" : "deposits";
|
|
122
|
+
const state = badge.state === "needs-you" ? single ? "needs you" : "need you" : "in progress";
|
|
123
|
+
return `Deposit history \u2014 ${badge.count} ${noun} ${state}`;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// src/components/history/HistoryEntryButton.tsx
|
|
127
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
128
|
+
function HistoryEntryButton({
|
|
129
|
+
badge,
|
|
130
|
+
onClick,
|
|
131
|
+
disabled
|
|
132
|
+
}) {
|
|
133
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
134
|
+
"button",
|
|
135
|
+
{
|
|
136
|
+
type: "button",
|
|
137
|
+
className: "rs-modal-header-history",
|
|
138
|
+
"aria-label": historyBadgeAriaLabel(badge),
|
|
139
|
+
onClick,
|
|
140
|
+
disabled,
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.HistoryIcon, {}),
|
|
143
|
+
badge && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
144
|
+
"span",
|
|
145
|
+
{
|
|
146
|
+
className: `rs-history-dot rs-history-dot--${badge.state}`,
|
|
147
|
+
"aria-hidden": "true"
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// src/components/history/HistoryOverlay.tsx
|
|
156
|
+
var _react = require('react');
|
|
157
|
+
|
|
158
|
+
// src/components/history/DepositHistoryPanel.tsx
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
function shortenHash(hash) {
|
|
169
|
+
if (hash.length <= 14) return hash;
|
|
170
|
+
return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
|
|
171
|
+
}
|
|
172
|
+
function formatDate(iso) {
|
|
173
|
+
try {
|
|
174
|
+
const date = new Date(iso);
|
|
175
|
+
if (Number.isNaN(date.getTime())) return iso;
|
|
176
|
+
return date.toLocaleDateString("en-US", {
|
|
177
|
+
day: "numeric",
|
|
178
|
+
month: "short",
|
|
179
|
+
year: "numeric"
|
|
180
|
+
});
|
|
181
|
+
} catch (e2) {
|
|
182
|
+
return iso;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function resolveChainId(value) {
|
|
186
|
+
if (value === void 0 || value === null) return null;
|
|
187
|
+
if (typeof value === "number") return value;
|
|
188
|
+
const display = _chunkOY5N3E6Lcjs.displayChainIdForCaip2.call(void 0, value);
|
|
189
|
+
if (display !== null) return display;
|
|
190
|
+
if (value === "solana" || value === "hypercore") return value;
|
|
191
|
+
const num = Number(value);
|
|
192
|
+
return Number.isFinite(num) ? num : null;
|
|
193
|
+
}
|
|
194
|
+
function resolveTokenSymbol(token, chainId) {
|
|
195
|
+
if (!token) return "";
|
|
196
|
+
if (chainId === "solana") {
|
|
197
|
+
const normalized = token.toLowerCase();
|
|
198
|
+
const matched = _chunkOY5N3E6Lcjs.SOLANA_TOKENS.find(
|
|
199
|
+
(entry) => entry.mint.toLowerCase() === normalized
|
|
200
|
+
);
|
|
201
|
+
if (matched) return matched.symbol;
|
|
202
|
+
if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
|
|
203
|
+
return "SOL";
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (chainId !== null && chainId !== void 0 && chainId !== "solana" && // Both callers pass the SOURCE chain, and `/chains` reports
|
|
207
|
+
// `deposit: false` for Tron and Stellar — so neither can appear here, and
|
|
208
|
+
// neither has an EVM token table to look one up in if it did.
|
|
209
|
+
chainId !== "tron" && chainId !== "stellar" && /^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
210
|
+
const evmChainId = chainId === "hypercore" ? _chunkOY5N3E6Lcjs.HYPERCORE_CHAIN_ID : chainId;
|
|
211
|
+
const sym = _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, token, evmChainId);
|
|
212
|
+
if (sym !== "Token") return sym;
|
|
213
|
+
}
|
|
214
|
+
return shortenHash(token);
|
|
215
|
+
}
|
|
216
|
+
function formatAmount(rawAmount, token, chainId) {
|
|
217
|
+
if (!rawAmount) return "";
|
|
218
|
+
let decimals = 18;
|
|
219
|
+
if (token && chainId !== null && chainId !== void 0) {
|
|
220
|
+
if (chainId === "solana") {
|
|
221
|
+
const normalized = token.toLowerCase();
|
|
222
|
+
const matched = _chunkOY5N3E6Lcjs.SOLANA_TOKENS.find(
|
|
223
|
+
(entry) => entry.mint.toLowerCase() === normalized
|
|
224
|
+
);
|
|
225
|
+
if (matched) {
|
|
226
|
+
decimals = matched.decimals;
|
|
227
|
+
} else if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
|
|
228
|
+
decimals = 9;
|
|
229
|
+
}
|
|
230
|
+
} else if (
|
|
231
|
+
// See `resolveTokenSymbol`: this reads the source chain, which Tron and
|
|
232
|
+
// Stellar cannot be.
|
|
233
|
+
chainId !== "tron" && chainId !== "stellar" && /^0x[a-fA-F0-9]{40}$/.test(token)
|
|
234
|
+
) {
|
|
235
|
+
const evmChainId = chainId === "hypercore" ? _chunkOY5N3E6Lcjs.HYPERCORE_CHAIN_ID : chainId;
|
|
236
|
+
decimals = _chunkOY5N3E6Lcjs.getTokenDecimalsByAddress.call(void 0, token, evmChainId);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
try {
|
|
240
|
+
const raw = BigInt(rawAmount);
|
|
241
|
+
const divisor = 10n ** BigInt(decimals);
|
|
242
|
+
const whole = raw / divisor;
|
|
243
|
+
const remainder = raw % divisor;
|
|
244
|
+
const fracStr = remainder.toString().padStart(decimals, "0");
|
|
245
|
+
let frac = fracStr.slice(0, 5).replace(/0+$/, "");
|
|
246
|
+
if (frac.length < 2) frac = frac.padEnd(2, "0");
|
|
247
|
+
return `${whole}.${frac}`;
|
|
248
|
+
} catch (e3) {
|
|
249
|
+
return rawAmount;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function DepositHistoryPanel({
|
|
253
|
+
deposits,
|
|
254
|
+
isLoading,
|
|
255
|
+
error,
|
|
256
|
+
hasMore,
|
|
257
|
+
isLoadingMore,
|
|
258
|
+
onLoadMore,
|
|
259
|
+
onClose,
|
|
260
|
+
onCloseModal,
|
|
261
|
+
backLabel,
|
|
262
|
+
title = "History",
|
|
263
|
+
recipient,
|
|
264
|
+
onRecover,
|
|
265
|
+
onFindByTxHash,
|
|
266
|
+
onRowView,
|
|
267
|
+
obscured
|
|
268
|
+
}) {
|
|
269
|
+
const rootRef = _react.useRef.call(void 0, null);
|
|
270
|
+
_react.useEffect.call(void 0, () => {
|
|
271
|
+
_optionalChain([rootRef, 'access', _4 => _4.current, 'optionalAccess', _5 => _5.toggleAttribute, 'call', _6 => _6("inert", Boolean(obscured))]);
|
|
272
|
+
}, [obscured]);
|
|
273
|
+
const handleKeyDown = _react.useCallback.call(void 0,
|
|
274
|
+
(e) => {
|
|
275
|
+
if (obscured) return;
|
|
276
|
+
if (e.key === "Escape") {
|
|
277
|
+
e.stopPropagation();
|
|
278
|
+
onClose();
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
[onClose, obscured]
|
|
282
|
+
);
|
|
283
|
+
const visibleDeposits = _react.useMemo.call(void 0,
|
|
284
|
+
() => filterVisibleDeposits(deposits),
|
|
285
|
+
[deposits]
|
|
286
|
+
);
|
|
287
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
288
|
+
"div",
|
|
289
|
+
{
|
|
290
|
+
ref: rootRef,
|
|
291
|
+
className: "rs-history-panel",
|
|
292
|
+
role: "dialog",
|
|
293
|
+
"aria-label": "Deposit history",
|
|
294
|
+
"aria-hidden": obscured || void 0,
|
|
295
|
+
onKeyDown: handleKeyDown,
|
|
296
|
+
children: [
|
|
297
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header--redesigned", children: [
|
|
298
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
299
|
+
"button",
|
|
300
|
+
{
|
|
301
|
+
type: "button",
|
|
302
|
+
className: `rs-modal-header-back${backLabel ? " rs-modal-header-back--labelled" : ""}`,
|
|
303
|
+
"aria-label": backLabel ? `Back to ${backLabel.toLowerCase()}` : "Back",
|
|
304
|
+
onClick: onClose,
|
|
305
|
+
children: [
|
|
306
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.ChevronLeftIcon, {}),
|
|
307
|
+
backLabel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: backLabel })
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
) }),
|
|
311
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
312
|
+
"button",
|
|
313
|
+
{
|
|
314
|
+
type: "button",
|
|
315
|
+
className: "rs-modal-close",
|
|
316
|
+
"aria-label": "Close",
|
|
317
|
+
onClick: onCloseModal,
|
|
318
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.CloseIcon, {})
|
|
319
|
+
}
|
|
320
|
+
) })
|
|
321
|
+
] }),
|
|
322
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen", children: [
|
|
323
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen-body", children: [
|
|
324
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.HistoryIcon, {}), title }),
|
|
325
|
+
onFindByTxHash && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
326
|
+
"button",
|
|
327
|
+
{
|
|
328
|
+
type: "button",
|
|
329
|
+
className: "rs-history-hint",
|
|
330
|
+
onClick: onFindByTxHash,
|
|
331
|
+
children: [
|
|
332
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Deposit missing?" }),
|
|
333
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "Find it by transaction hash" })
|
|
334
|
+
]
|
|
335
|
+
}
|
|
336
|
+
),
|
|
337
|
+
isLoading && deposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
338
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.HistoryIcon, {}) }),
|
|
339
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
340
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.Spinner, { className: "rs-spinner--sm" }),
|
|
341
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
|
|
342
|
+
] })
|
|
343
|
+
] }),
|
|
344
|
+
error && !isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
345
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.AlertTriangleIcon, {}) }),
|
|
346
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
347
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
|
|
348
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: error })
|
|
349
|
+
] })
|
|
350
|
+
] }),
|
|
351
|
+
!isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
352
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.HistoryIcon, {}) }),
|
|
353
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
354
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "No deposits yet" }),
|
|
355
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
|
|
356
|
+
] })
|
|
357
|
+
] }),
|
|
358
|
+
visibleDeposits.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-list", children: [
|
|
359
|
+
visibleDeposits.map((deposit, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
360
|
+
HistoryCard,
|
|
361
|
+
{
|
|
362
|
+
deposit,
|
|
363
|
+
position: i,
|
|
364
|
+
recipient,
|
|
365
|
+
onRecover,
|
|
366
|
+
onRowView
|
|
367
|
+
},
|
|
368
|
+
deposit.txHash || i
|
|
369
|
+
)),
|
|
370
|
+
hasMore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
371
|
+
"button",
|
|
372
|
+
{
|
|
373
|
+
type: "button",
|
|
374
|
+
className: "rs-history-load-more",
|
|
375
|
+
onClick: onLoadMore,
|
|
376
|
+
disabled: isLoadingMore,
|
|
377
|
+
children: isLoadingMore ? "Loading\u2026" : "Load more"
|
|
378
|
+
}
|
|
379
|
+
)
|
|
380
|
+
] })
|
|
381
|
+
] }),
|
|
382
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.PoweredBy, {})
|
|
383
|
+
] })
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
function HistoryCard({
|
|
389
|
+
deposit,
|
|
390
|
+
position,
|
|
391
|
+
recipient,
|
|
392
|
+
onRecover,
|
|
393
|
+
onRowView
|
|
394
|
+
}) {
|
|
395
|
+
const explorerTxUrl = _chunk3OOY67VJcjs.useExplorerTxUrl.call(void 0, );
|
|
396
|
+
const [expanded, setExpanded] = _react.useState.call(void 0, false);
|
|
397
|
+
const panelId = _react.useId.call(void 0, );
|
|
398
|
+
const status = normalizeStatus(deposit.status, deposit.isSpam);
|
|
399
|
+
const sourceChainId = resolveChainId(deposit.chain);
|
|
400
|
+
const targetChainId = resolveChainId(deposit.targetChain);
|
|
401
|
+
const sourceChainName = sourceChainId ? _chunkOY5N3E6Lcjs.getChainName.call(void 0, sourceChainId) : null;
|
|
402
|
+
const targetChainName = targetChainId ? _chunkOY5N3E6Lcjs.getChainName.call(void 0, targetChainId) : null;
|
|
403
|
+
const sourceChainIcon = sourceChainId ? _chunkOY5N3E6Lcjs.getChainIcon.call(void 0, sourceChainId) : void 0;
|
|
404
|
+
const targetChainIcon = targetChainId ? _chunkOY5N3E6Lcjs.getChainIcon.call(void 0, targetChainId) : void 0;
|
|
405
|
+
const sourceSymbol = resolveTokenSymbol(deposit.token, sourceChainId);
|
|
406
|
+
const rawAmount = deposit.sourceAmount && deposit.sourceAmount !== "0" ? deposit.sourceAmount : deposit.amount;
|
|
407
|
+
const formattedAmount = rawAmount ? formatAmount(rawAmount, deposit.token, sourceChainId) : null;
|
|
408
|
+
const displayAmount = formattedAmount ? sourceSymbol && /^USD/.test(sourceSymbol) ? `$${Number(formattedAmount).toLocaleString("en-US", {
|
|
409
|
+
minimumFractionDigits: 2,
|
|
410
|
+
maximumFractionDigits: 2
|
|
411
|
+
})}` : `${formattedAmount} ${sourceSymbol}` : "\u2014";
|
|
412
|
+
const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
|
|
413
|
+
const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
|
|
414
|
+
const srcTxHash = sourceChainId === "hypercore" ? deposit.txHash : deposit.sourceTxHash;
|
|
415
|
+
const srcTxUrl = srcTxHash && sourceChainId ? explorerTxUrl(sourceChainId, srcTxHash) : null;
|
|
416
|
+
const eligible = _chunk3OOY67VJcjs.toRecoverableDeposit.call(void 0, deposit, { recipient });
|
|
417
|
+
const recoverable = onRecover ? eligible : null;
|
|
418
|
+
const toggleExpanded = () => {
|
|
419
|
+
const next = !expanded;
|
|
420
|
+
setExpanded(next);
|
|
421
|
+
const depositId = _nullishCoalesce(deposit.id, () => ( deposit.txHash));
|
|
422
|
+
if (!next || !depositId) return;
|
|
423
|
+
_optionalChain([onRowView, 'optionalCall', _7 => _7({
|
|
424
|
+
depositId,
|
|
425
|
+
status,
|
|
426
|
+
recoverable: eligible !== null,
|
|
427
|
+
position
|
|
428
|
+
})]);
|
|
429
|
+
};
|
|
430
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
431
|
+
"div",
|
|
432
|
+
{
|
|
433
|
+
className: `rs-history-card ${expanded ? "rs-history-card--expanded" : ""}`,
|
|
434
|
+
children: [
|
|
435
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
436
|
+
"button",
|
|
437
|
+
{
|
|
438
|
+
type: "button",
|
|
439
|
+
className: "rs-history-card-trigger",
|
|
440
|
+
onClick: toggleExpanded,
|
|
441
|
+
"aria-expanded": expanded,
|
|
442
|
+
"aria-controls": panelId,
|
|
443
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-card-row", children: [
|
|
444
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-card-icons", children: [
|
|
445
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-card-token", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
446
|
+
_chunk3OOY67VJcjs.TokenIcon,
|
|
447
|
+
{
|
|
448
|
+
symbol: sourceSymbol,
|
|
449
|
+
fallback: sourceSymbol.slice(0, 2)
|
|
450
|
+
}
|
|
451
|
+
) }),
|
|
452
|
+
sourceChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-card-chain", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.CdnIcon, { src: sourceChainIcon }) })
|
|
453
|
+
] }),
|
|
454
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-card-text", children: [
|
|
455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-card-title", children: txTypeLabel }),
|
|
456
|
+
date && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-card-date", children: date })
|
|
457
|
+
] }),
|
|
458
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-card-side", children: [
|
|
459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-card-amount", children: displayAmount }),
|
|
460
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
|
|
461
|
+
] })
|
|
462
|
+
] })
|
|
463
|
+
}
|
|
464
|
+
),
|
|
465
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-history-card-panel", id: panelId, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-history-card-panel-inner", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-card-details", children: [
|
|
466
|
+
(status === "failed" || recoverable) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.Callout, { variant: "error", children: _chunk3OOY67VJcjs.recoveryFailureCause.call(void 0, sourceChainName) }),
|
|
467
|
+
sourceChainName && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
468
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
469
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-detail-value", children: [
|
|
470
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceChainName }),
|
|
471
|
+
sourceChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.CdnIcon, { src: sourceChainIcon }) })
|
|
472
|
+
] })
|
|
473
|
+
] }),
|
|
474
|
+
targetChainName && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
475
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Destination chain" }),
|
|
476
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-detail-value", children: [
|
|
477
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetChainName }),
|
|
478
|
+
targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.CdnIcon, { src: targetChainIcon }) })
|
|
479
|
+
] })
|
|
480
|
+
] }),
|
|
481
|
+
srcTxUrl && srcTxHash && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
482
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Transaction details" }),
|
|
483
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
484
|
+
"a",
|
|
485
|
+
{
|
|
486
|
+
href: srcTxUrl,
|
|
487
|
+
target: "_blank",
|
|
488
|
+
rel: "noopener noreferrer",
|
|
489
|
+
className: "rs-history-card-link",
|
|
490
|
+
children: [
|
|
491
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: shortenHash(srcTxHash) }),
|
|
492
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.ArrowUpRightIcon, {})
|
|
493
|
+
]
|
|
494
|
+
}
|
|
495
|
+
)
|
|
496
|
+
] }),
|
|
497
|
+
recoverable && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
498
|
+
_chunk3OOY67VJcjs.Button,
|
|
499
|
+
{
|
|
500
|
+
onClick: () => _optionalChain([onRecover, 'optionalCall', _8 => _8(recoverable)]),
|
|
501
|
+
fullWidth: true,
|
|
502
|
+
className: "rs-history-card-recover",
|
|
503
|
+
children: [
|
|
504
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
|
|
505
|
+
"Recover ",
|
|
506
|
+
displayAmount
|
|
507
|
+
] }),
|
|
508
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.ChevronRightIcon, {})
|
|
509
|
+
]
|
|
510
|
+
}
|
|
511
|
+
)
|
|
512
|
+
] }) }) })
|
|
513
|
+
]
|
|
514
|
+
}
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
518
|
+
|
|
519
|
+
// src/components/history/HistoryFallbackFlow.tsx
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
function HistoryFallbackFlow({
|
|
523
|
+
service,
|
|
524
|
+
recipient,
|
|
525
|
+
onBack,
|
|
526
|
+
onCloseModal,
|
|
527
|
+
onFound
|
|
528
|
+
}) {
|
|
529
|
+
const analytics = _chunk3OOY67VJcjs.useClaimAnalyticsController.call(void 0, );
|
|
530
|
+
const [loading, setLoading] = _react.useState.call(void 0, false);
|
|
531
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
|
532
|
+
const [matches, setMatches] = _react.useState.call(void 0, null);
|
|
533
|
+
_react.useEffect.call(void 0, () => {
|
|
534
|
+
analytics.openStep("lookup");
|
|
535
|
+
}, [analytics]);
|
|
536
|
+
const epochRef = _react.useRef.call(void 0, 0);
|
|
537
|
+
_react.useEffect.call(void 0, () => {
|
|
538
|
+
setMatches(null);
|
|
539
|
+
setError(null);
|
|
540
|
+
setLoading(false);
|
|
541
|
+
return () => {
|
|
542
|
+
epochRef.current += 1;
|
|
543
|
+
};
|
|
544
|
+
}, [recipient]);
|
|
545
|
+
const reportSelection = _react.useCallback.call(void 0,
|
|
546
|
+
(match, autoSelected) => {
|
|
547
|
+
analytics.selectDeposit({
|
|
548
|
+
depositId: match.depositId,
|
|
549
|
+
transactionHash: _nullishCoalesce(match.sourceTxHash, () => ( null)),
|
|
550
|
+
autoSelected
|
|
551
|
+
});
|
|
552
|
+
},
|
|
553
|
+
[analytics]
|
|
554
|
+
);
|
|
555
|
+
const lookup = _react.useCallback.call(void 0,
|
|
556
|
+
async (txHash) => {
|
|
557
|
+
const epoch = epochRef.current;
|
|
558
|
+
const isCurrentLookup = () => epochRef.current === epoch;
|
|
559
|
+
setError(null);
|
|
560
|
+
setLoading(true);
|
|
561
|
+
analytics.rearmStep("lookup");
|
|
562
|
+
try {
|
|
563
|
+
const rows = await service.lookupRecoverableDeposits({ txHash });
|
|
564
|
+
if (!isCurrentLookup()) return;
|
|
565
|
+
const outcome = _chunk3OOY67VJcjs.classifyRecoveryLookup.call(void 0, newestFirst(rows), {
|
|
566
|
+
recipient
|
|
567
|
+
});
|
|
568
|
+
const { eligible, miss } = outcome;
|
|
569
|
+
analytics.lookupResult(outcome.rows.length, eligible.length);
|
|
570
|
+
if (miss) {
|
|
571
|
+
analytics.friction(
|
|
572
|
+
miss === "not_found" ? "lookup_no_deposits_found" : "lookup_no_eligible_deposits",
|
|
573
|
+
"lookup"
|
|
574
|
+
);
|
|
575
|
+
setError(_chunk3OOY67VJcjs.RECOVERY_LOOKUP_MISS_COPY[miss]);
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
analytics.completeStep("lookup");
|
|
579
|
+
if (eligible.length === 1) {
|
|
580
|
+
reportSelection(eligible[0], true);
|
|
581
|
+
onFound(eligible[0]);
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
analytics.openStep("select");
|
|
585
|
+
setMatches(eligible);
|
|
586
|
+
} catch (err) {
|
|
587
|
+
if (!isCurrentLookup()) return;
|
|
588
|
+
analytics.failure("lookup_failed", true, "lookup");
|
|
589
|
+
setError(
|
|
590
|
+
_chunk3OOY67VJcjs.formatUserError.call(void 0, err instanceof Error ? err.message : "Lookup failed")
|
|
591
|
+
);
|
|
592
|
+
} finally {
|
|
593
|
+
if (isCurrentLookup()) setLoading(false);
|
|
594
|
+
}
|
|
595
|
+
},
|
|
596
|
+
[analytics, service, recipient, onFound, reportSelection]
|
|
597
|
+
);
|
|
598
|
+
const selectMatch = _react.useCallback.call(void 0,
|
|
599
|
+
(match) => {
|
|
600
|
+
analytics.completeStep("select");
|
|
601
|
+
reportSelection(match, false);
|
|
602
|
+
onFound(match);
|
|
603
|
+
},
|
|
604
|
+
[analytics, onFound, reportSelection]
|
|
605
|
+
);
|
|
606
|
+
const handleKeyDown = _react.useCallback.call(void 0,
|
|
607
|
+
(e) => {
|
|
608
|
+
if (e.key === "Escape") {
|
|
609
|
+
e.stopPropagation();
|
|
610
|
+
onBack("escape");
|
|
611
|
+
}
|
|
612
|
+
},
|
|
613
|
+
[onBack]
|
|
614
|
+
);
|
|
615
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
616
|
+
"div",
|
|
617
|
+
{
|
|
618
|
+
className: "rs-history-lookup",
|
|
619
|
+
role: "dialog",
|
|
620
|
+
"aria-label": "Find a deposit",
|
|
621
|
+
onKeyDown: handleKeyDown,
|
|
622
|
+
children: [
|
|
623
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header--redesigned", children: [
|
|
624
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
625
|
+
"button",
|
|
626
|
+
{
|
|
627
|
+
type: "button",
|
|
628
|
+
className: "rs-modal-header-back rs-modal-header-back--labelled",
|
|
629
|
+
"aria-label": "Back to history",
|
|
630
|
+
onClick: () => onBack(),
|
|
631
|
+
children: [
|
|
632
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.ChevronLeftIcon, {}),
|
|
633
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "History" })
|
|
634
|
+
]
|
|
635
|
+
}
|
|
636
|
+
) }),
|
|
637
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
638
|
+
"button",
|
|
639
|
+
{
|
|
640
|
+
type: "button",
|
|
641
|
+
className: "rs-modal-close",
|
|
642
|
+
"aria-label": "Close",
|
|
643
|
+
onClick: onCloseModal,
|
|
644
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.CloseIcon, {})
|
|
645
|
+
}
|
|
646
|
+
) })
|
|
647
|
+
] }),
|
|
648
|
+
matches ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
649
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
650
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
651
|
+
_chunk3OOY67VJcjs.BodyHeader,
|
|
652
|
+
{
|
|
653
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.CoinsIcon, {}),
|
|
654
|
+
title: "Select a deposit",
|
|
655
|
+
subtitle: "This transaction produced multiple deposits. Choose the one to recover."
|
|
656
|
+
}
|
|
657
|
+
),
|
|
658
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list", children: matches.map((match) => {
|
|
659
|
+
const { symbol, amount, chainName } = _chunk3OOY67VJcjs.describeRecoveryDeposit.call(void 0, {
|
|
660
|
+
chainId: match.sourceChainId,
|
|
661
|
+
token: match.token,
|
|
662
|
+
amountRaw: match.amountRaw
|
|
663
|
+
});
|
|
664
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
665
|
+
_chunk3OOY67VJcjs.ListRow,
|
|
666
|
+
{
|
|
667
|
+
leadingMedia: _chunkOY5N3E6Lcjs.tokenIconUrl.call(void 0, symbol),
|
|
668
|
+
title: `${amount} ${symbol}`,
|
|
669
|
+
subtitle: chainName,
|
|
670
|
+
onClick: () => selectMatch(match)
|
|
671
|
+
},
|
|
672
|
+
match.depositId
|
|
673
|
+
);
|
|
674
|
+
}) })
|
|
675
|
+
] }),
|
|
676
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.PoweredBy, {})
|
|
677
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
678
|
+
_chunk3OOY67VJcjs.RecoveryLookupScreen,
|
|
679
|
+
{
|
|
680
|
+
title: "Find a deposit",
|
|
681
|
+
subtitle: "Some deposits don't appear in your history. Look one up by the transaction that sent the funds.",
|
|
682
|
+
hint: "The transaction hash from the wallet or exchange you sent from.",
|
|
683
|
+
loading,
|
|
684
|
+
error,
|
|
685
|
+
onSubmit: lookup,
|
|
686
|
+
onInvalid: () => analytics.friction("lookup_transaction_hash_invalid", "lookup")
|
|
687
|
+
}
|
|
688
|
+
)
|
|
689
|
+
]
|
|
690
|
+
}
|
|
691
|
+
);
|
|
692
|
+
}
|
|
693
|
+
function newestFirst(rows) {
|
|
694
|
+
return [...rows].sort(
|
|
695
|
+
(a, b) => (b.createdAt ? Date.parse(b.createdAt) : 0) - (a.createdAt ? Date.parse(a.createdAt) : 0)
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
HistoryFallbackFlow.displayName = "HistoryFallbackFlow";
|
|
699
|
+
|
|
700
|
+
// src/components/history/HistoryRecoveryFlow.tsx
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
function HistoryRecoveryFlow({
|
|
704
|
+
deposit,
|
|
705
|
+
entrySource,
|
|
706
|
+
backendUrl,
|
|
707
|
+
signRecovery,
|
|
708
|
+
debug,
|
|
709
|
+
onBack,
|
|
710
|
+
onCloseModal,
|
|
711
|
+
onSubmittingChange,
|
|
712
|
+
onRecovered
|
|
713
|
+
}) {
|
|
714
|
+
const analytics = _chunk3OOY67VJcjs.useClaimAnalyticsController.call(void 0, );
|
|
715
|
+
const [phase, setPhase] = _react.useState.call(void 0, "review");
|
|
716
|
+
const [outcome, setOutcome] = _react.useState.call(void 0, null);
|
|
717
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
|
718
|
+
const [retryable, setRetryable] = _react.useState.call(void 0, false);
|
|
719
|
+
const lastFailureRef = _react.useRef.call(void 0, null);
|
|
720
|
+
_react.useEffect.call(void 0, () => {
|
|
721
|
+
if (entrySource === "history_row") {
|
|
722
|
+
analytics.selectDeposit({
|
|
723
|
+
depositId: deposit.depositId,
|
|
724
|
+
transactionHash: _nullishCoalesce(deposit.sourceTxHash, () => ( null)),
|
|
725
|
+
autoSelected: true
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
analytics.openStep("review");
|
|
729
|
+
}, [analytics, deposit, entrySource]);
|
|
730
|
+
const { symbol, decimals } = _chunk3OOY67VJcjs.describeRecoveryDeposit.call(void 0, {
|
|
731
|
+
chainId: deposit.sourceChainId,
|
|
732
|
+
token: deposit.token,
|
|
733
|
+
amountRaw: deposit.amountRaw
|
|
734
|
+
});
|
|
735
|
+
const submit = _react.useCallback.call(void 0,
|
|
736
|
+
async (destination) => {
|
|
737
|
+
setPhase("submitting");
|
|
738
|
+
onSubmittingChange(true);
|
|
739
|
+
analytics.completeStep("review");
|
|
740
|
+
analytics.openStep("submit");
|
|
741
|
+
try {
|
|
742
|
+
const result = await _chunk3OOY67VJcjs.submitSignedRecovery.call(void 0, {
|
|
743
|
+
backendUrl,
|
|
744
|
+
// The target chain: the processor verifies where the recipient wallet
|
|
745
|
+
// lives, not where the refund pays out.
|
|
746
|
+
chainId: deposit.targetChainId,
|
|
747
|
+
depositId: deposit.depositId,
|
|
748
|
+
signer: deposit.signer,
|
|
749
|
+
destination,
|
|
750
|
+
signRecovery,
|
|
751
|
+
debug
|
|
752
|
+
});
|
|
753
|
+
setOutcome({
|
|
754
|
+
// No destination to reconcile: it is inside the signed struct, so the
|
|
755
|
+
// processor cannot have paid anywhere else.
|
|
756
|
+
destination,
|
|
757
|
+
txHash: result.transactionHash,
|
|
758
|
+
symbol,
|
|
759
|
+
amountDisplay: _chunk3OOY67VJcjs.formatRecoveryAmount.call(void 0,
|
|
760
|
+
_nullishCoalesce(result.amount, () => ( deposit.amountRaw)),
|
|
761
|
+
decimals,
|
|
762
|
+
symbol
|
|
763
|
+
)
|
|
764
|
+
});
|
|
765
|
+
setPhase("success");
|
|
766
|
+
analytics.handoff(
|
|
767
|
+
{
|
|
768
|
+
depositId: deposit.depositId,
|
|
769
|
+
transactionHash: _nullishCoalesce(deposit.sourceTxHash, () => ( null)),
|
|
770
|
+
refundTransactionHash: result.transactionHash
|
|
771
|
+
},
|
|
772
|
+
"submit"
|
|
773
|
+
);
|
|
774
|
+
analytics.completeStep("submit");
|
|
775
|
+
analytics.outcome("completed");
|
|
776
|
+
onRecovered();
|
|
777
|
+
} catch (err) {
|
|
778
|
+
const recoveryError = err instanceof _chunk3OOY67VJcjs.RecoveryError ? err : void 0;
|
|
779
|
+
setError(
|
|
780
|
+
_nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _9 => _9.message]), () => ( _chunk3OOY67VJcjs.formatUserError.call(void 0,
|
|
781
|
+
err instanceof Error ? err.message : "Recovery failed"
|
|
782
|
+
)))
|
|
783
|
+
);
|
|
784
|
+
const canRetry = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _10 => _10.retryable]), () => ( true));
|
|
785
|
+
setRetryable(canRetry);
|
|
786
|
+
setPhase("failed");
|
|
787
|
+
const reason = _chunk3OOY67VJcjs.claimFailureReasonForError.call(void 0, err);
|
|
788
|
+
lastFailureRef.current = canRetry ? reason : null;
|
|
789
|
+
analytics.failure(reason, canRetry, "submit");
|
|
790
|
+
analytics.outcome("failed");
|
|
791
|
+
} finally {
|
|
792
|
+
onSubmittingChange(false);
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
[
|
|
796
|
+
analytics,
|
|
797
|
+
backendUrl,
|
|
798
|
+
debug,
|
|
799
|
+
decimals,
|
|
800
|
+
deposit,
|
|
801
|
+
onRecovered,
|
|
802
|
+
onSubmittingChange,
|
|
803
|
+
signRecovery,
|
|
804
|
+
symbol
|
|
805
|
+
]
|
|
806
|
+
);
|
|
807
|
+
const retry = _react.useCallback.call(void 0, () => {
|
|
808
|
+
const reason = lastFailureRef.current;
|
|
809
|
+
if (reason) {
|
|
810
|
+
lastFailureRef.current = null;
|
|
811
|
+
analytics.retry(reason, "submit");
|
|
812
|
+
}
|
|
813
|
+
setError(null);
|
|
814
|
+
setPhase("review");
|
|
815
|
+
}, [analytics]);
|
|
816
|
+
const submitting = phase === "submitting";
|
|
817
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
818
|
+
"div",
|
|
819
|
+
{
|
|
820
|
+
className: "rs-history-recovery",
|
|
821
|
+
role: "dialog",
|
|
822
|
+
"aria-label": "Recover deposit",
|
|
823
|
+
children: [
|
|
824
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header--redesigned", children: [
|
|
825
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-left", children: !submitting && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
826
|
+
"button",
|
|
827
|
+
{
|
|
828
|
+
type: "button",
|
|
829
|
+
className: "rs-modal-header-back rs-modal-header-back--labelled",
|
|
830
|
+
"aria-label": "Back to history",
|
|
831
|
+
onClick: onBack,
|
|
832
|
+
children: [
|
|
833
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.ChevronLeftIcon, {}),
|
|
834
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "History" })
|
|
835
|
+
]
|
|
836
|
+
}
|
|
837
|
+
) }),
|
|
838
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
839
|
+
"button",
|
|
840
|
+
{
|
|
841
|
+
type: "button",
|
|
842
|
+
className: "rs-modal-close",
|
|
843
|
+
"aria-label": "Close",
|
|
844
|
+
onClick: onCloseModal,
|
|
845
|
+
disabled: submitting,
|
|
846
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.CloseIcon, {})
|
|
847
|
+
}
|
|
848
|
+
) })
|
|
849
|
+
] }),
|
|
850
|
+
(phase === "review" || submitting) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
851
|
+
_chunk3OOY67VJcjs.RecoveryReviewScreen,
|
|
852
|
+
{
|
|
853
|
+
chainId: deposit.sourceChainId,
|
|
854
|
+
token: deposit.token,
|
|
855
|
+
amountRaw: deposit.amountRaw,
|
|
856
|
+
txHash: deposit.sourceTxHash,
|
|
857
|
+
defaultDestination: deposit.destinationPrefill,
|
|
858
|
+
destinationHint: "Prefilled with the account this deposit was for. Editable.",
|
|
859
|
+
submitting,
|
|
860
|
+
onSubmit: submit,
|
|
861
|
+
onDestinationInvalid: () => analytics.friction("refund_destination_invalid", "review")
|
|
862
|
+
}
|
|
863
|
+
),
|
|
864
|
+
phase === "success" && outcome && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
865
|
+
_chunk3OOY67VJcjs.RecoveryOutcomeScreen,
|
|
866
|
+
{
|
|
867
|
+
result: { ...outcome, chainId: deposit.sourceChainId },
|
|
868
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.Button, { variant: "outline", onClick: onBack, fullWidth: true, children: "Back to history" })
|
|
869
|
+
}
|
|
870
|
+
),
|
|
871
|
+
phase === "failed" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk3OOY67VJcjs.RecoveryOutcomeScreen, { error, children: [
|
|
872
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.Button, { variant: "outline", onClick: onBack, fullWidth: true, children: "Back to history" }),
|
|
873
|
+
retryable && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.Button, { onClick: retry, fullWidth: true, children: "Try again" })
|
|
874
|
+
] })
|
|
875
|
+
]
|
|
876
|
+
}
|
|
877
|
+
);
|
|
878
|
+
}
|
|
879
|
+
HistoryRecoveryFlow.displayName = "HistoryRecoveryFlow";
|
|
880
|
+
|
|
881
|
+
// src/components/history/HistoryOverlay.tsx
|
|
882
|
+
|
|
883
|
+
function HistoryOverlay({
|
|
884
|
+
controller,
|
|
885
|
+
backLabel,
|
|
886
|
+
title,
|
|
887
|
+
recipient,
|
|
888
|
+
backendUrl,
|
|
889
|
+
service,
|
|
890
|
+
signRecovery,
|
|
891
|
+
debug,
|
|
892
|
+
onCloseModal,
|
|
893
|
+
analytics,
|
|
894
|
+
inline,
|
|
895
|
+
closeOnOverlayClick,
|
|
896
|
+
enableAnalyticsIngest,
|
|
897
|
+
analyticsIngestUrl,
|
|
898
|
+
onEvent
|
|
899
|
+
}) {
|
|
900
|
+
const recovering = signRecovery ? controller.recovering : null;
|
|
901
|
+
const [fallbackOpen, setFallbackOpen] = _react.useState.call(void 0, false);
|
|
902
|
+
const [attempt, setAttempt] = _react.useState.call(void 0, null);
|
|
903
|
+
const claimControllerRef = _react.useRef.call(void 0, null);
|
|
904
|
+
const beginAttempt = _react.useCallback.call(void 0,
|
|
905
|
+
(entrySource) => {
|
|
906
|
+
const id = _chunk3OOY67VJcjs.randomUuid.call(void 0, );
|
|
907
|
+
const started = {
|
|
908
|
+
id,
|
|
909
|
+
entrySource,
|
|
910
|
+
correlation: {
|
|
911
|
+
entry_source: entrySource,
|
|
912
|
+
...analytics.sourceSessionId ? { source_session_id: analytics.sourceSessionId } : {},
|
|
913
|
+
...analytics.visitId ? { history_visit_id: analytics.visitId } : {},
|
|
914
|
+
claim_attempt_id: id
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
setAttempt(started);
|
|
918
|
+
return started;
|
|
919
|
+
},
|
|
920
|
+
[analytics]
|
|
921
|
+
);
|
|
922
|
+
const endAttempt = _react.useCallback.call(void 0,
|
|
923
|
+
(source, reason) => {
|
|
924
|
+
const claim = claimControllerRef.current;
|
|
925
|
+
_optionalChain([claim, 'optionalAccess', _11 => _11.abandon, 'call', _12 => _12(reason)]);
|
|
926
|
+
_optionalChain([claim, 'optionalAccess', _13 => _13.close, 'call', _14 => _14(source)]);
|
|
927
|
+
claimControllerRef.current = null;
|
|
928
|
+
setAttempt(null);
|
|
929
|
+
},
|
|
930
|
+
[]
|
|
931
|
+
);
|
|
932
|
+
const openFallback = _react.useCallback.call(void 0, () => {
|
|
933
|
+
const started = beginAttempt("history_fallback");
|
|
934
|
+
analytics.fallbackOpened(started.id);
|
|
935
|
+
setFallbackOpen(true);
|
|
936
|
+
}, [analytics, beginAttempt]);
|
|
937
|
+
const closeFallback = _react.useCallback.call(void 0,
|
|
938
|
+
(via) => {
|
|
939
|
+
endAttempt(via === "escape" ? "escape" : "history_back", "back");
|
|
940
|
+
setFallbackOpen(false);
|
|
941
|
+
},
|
|
942
|
+
[endAttempt]
|
|
943
|
+
);
|
|
944
|
+
const canLookup = Boolean(signRecovery) && Boolean(recipient);
|
|
945
|
+
_react.useEffect.call(void 0, () => {
|
|
946
|
+
if (canLookup) return;
|
|
947
|
+
setFallbackOpen(false);
|
|
948
|
+
if (fallbackOpen && !recovering) endAttempt("host_controlled", "back");
|
|
949
|
+
}, [canLookup, fallbackOpen, recovering, endAttempt]);
|
|
950
|
+
const startRecoveryFromRow = _react.useCallback.call(void 0,
|
|
951
|
+
(deposit) => {
|
|
952
|
+
const started = beginAttempt("history_row");
|
|
953
|
+
analytics.recoveryStarted(started.id, "history_row", deposit.depositId);
|
|
954
|
+
controller.startRecovery(deposit);
|
|
955
|
+
},
|
|
956
|
+
[analytics, beginAttempt, controller]
|
|
957
|
+
);
|
|
958
|
+
const startRecoveryFromLookup = _react.useCallback.call(void 0,
|
|
959
|
+
(deposit) => {
|
|
960
|
+
if (attempt) {
|
|
961
|
+
analytics.recoveryStarted(
|
|
962
|
+
attempt.id,
|
|
963
|
+
attempt.entrySource,
|
|
964
|
+
deposit.depositId
|
|
965
|
+
);
|
|
966
|
+
}
|
|
967
|
+
setFallbackOpen(false);
|
|
968
|
+
controller.startRecovery(deposit);
|
|
969
|
+
},
|
|
970
|
+
[analytics, attempt, controller]
|
|
971
|
+
);
|
|
972
|
+
const cancelRecovery = _react.useCallback.call(void 0, () => {
|
|
973
|
+
endAttempt("history_back", "back");
|
|
974
|
+
controller.cancelRecovery();
|
|
975
|
+
}, [controller, endAttempt]);
|
|
976
|
+
const closeModal = _react.useCallback.call(void 0, () => {
|
|
977
|
+
endAttempt("header_button", "modal_close");
|
|
978
|
+
onCloseModal();
|
|
979
|
+
}, [endAttempt, onCloseModal]);
|
|
980
|
+
_react.useEffect.call(void 0, () => {
|
|
981
|
+
if (!attempt) return;
|
|
982
|
+
return () => {
|
|
983
|
+
const claim = claimControllerRef.current;
|
|
984
|
+
_optionalChain([claim, 'optionalAccess', _15 => _15.abandon, 'call', _16 => _16("modal_close")]);
|
|
985
|
+
_optionalChain([claim, 'optionalAccess', _17 => _17.close, 'call', _18 => _18("host_controlled")]);
|
|
986
|
+
};
|
|
987
|
+
}, [attempt]);
|
|
988
|
+
const claimSessionProperties = _react.useMemo.call(void 0,
|
|
989
|
+
() => ({
|
|
990
|
+
presentation: inline ? "inline" : "overlay",
|
|
991
|
+
overlay_close_enabled: !inline && Boolean(closeOnOverlayClick),
|
|
992
|
+
prefills: { transaction_hash: false, refund_destination: true }
|
|
993
|
+
}),
|
|
994
|
+
[inline, closeOnOverlayClick]
|
|
995
|
+
);
|
|
996
|
+
const layers = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
997
|
+
fallbackOpen && recipient && !recovering && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
998
|
+
HistoryFallbackFlow,
|
|
999
|
+
{
|
|
1000
|
+
service,
|
|
1001
|
+
recipient,
|
|
1002
|
+
onBack: closeFallback,
|
|
1003
|
+
onCloseModal: closeModal,
|
|
1004
|
+
onFound: startRecoveryFromLookup
|
|
1005
|
+
}
|
|
1006
|
+
),
|
|
1007
|
+
recovering && signRecovery && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1008
|
+
HistoryRecoveryFlow,
|
|
1009
|
+
{
|
|
1010
|
+
deposit: recovering,
|
|
1011
|
+
entrySource: _nullishCoalesce(_optionalChain([attempt, 'optionalAccess', _19 => _19.entrySource]), () => ( "history_row")),
|
|
1012
|
+
backendUrl,
|
|
1013
|
+
signRecovery,
|
|
1014
|
+
debug,
|
|
1015
|
+
onBack: cancelRecovery,
|
|
1016
|
+
onCloseModal: closeModal,
|
|
1017
|
+
onSubmittingChange: controller.setRecoverySubmitting,
|
|
1018
|
+
onRecovered: controller.markStale
|
|
1019
|
+
}
|
|
1020
|
+
)
|
|
1021
|
+
] });
|
|
1022
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1023
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1024
|
+
DepositHistoryPanel,
|
|
1025
|
+
{
|
|
1026
|
+
deposits: controller.deposits,
|
|
1027
|
+
isLoading: controller.isLoading,
|
|
1028
|
+
error: controller.error,
|
|
1029
|
+
hasMore: controller.hasMore,
|
|
1030
|
+
isLoadingMore: controller.isLoadingMore,
|
|
1031
|
+
onLoadMore: controller.loadMore,
|
|
1032
|
+
onClose: controller.closePanel,
|
|
1033
|
+
onCloseModal: closeModal,
|
|
1034
|
+
backLabel,
|
|
1035
|
+
title,
|
|
1036
|
+
recipient,
|
|
1037
|
+
onRecover: signRecovery ? startRecoveryFromRow : void 0,
|
|
1038
|
+
onFindByTxHash: canLookup ? openFallback : void 0,
|
|
1039
|
+
onRowView: analytics.rowViewed,
|
|
1040
|
+
obscured: Boolean(recovering) || fallbackOpen
|
|
1041
|
+
}
|
|
1042
|
+
),
|
|
1043
|
+
attempt ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1044
|
+
_chunk3OOY67VJcjs.AnalyticsSession,
|
|
1045
|
+
{
|
|
1046
|
+
modal: "claim",
|
|
1047
|
+
sessionProperties: claimSessionProperties,
|
|
1048
|
+
onEvent,
|
|
1049
|
+
backendUrl,
|
|
1050
|
+
enableIngest: enableAnalyticsIngest,
|
|
1051
|
+
ingestUrl: analyticsIngestUrl,
|
|
1052
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1053
|
+
_chunk3OOY67VJcjs.ClaimAnalyticsControllerProvider,
|
|
1054
|
+
{
|
|
1055
|
+
controllerRef: claimControllerRef,
|
|
1056
|
+
correlation: attempt.correlation,
|
|
1057
|
+
children: layers
|
|
1058
|
+
}
|
|
1059
|
+
)
|
|
1060
|
+
},
|
|
1061
|
+
attempt.id
|
|
1062
|
+
) : layers
|
|
1063
|
+
] });
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
// src/components/history/useHistoryPanel.ts
|
|
1067
|
+
|
|
1068
|
+
function sortByCreatedAtDesc(items) {
|
|
1069
|
+
return [...items].sort((a, b) => {
|
|
1070
|
+
const at = a.createdAt ? Date.parse(a.createdAt) : 0;
|
|
1071
|
+
const bt = b.createdAt ? Date.parse(b.createdAt) : 0;
|
|
1072
|
+
return bt - at;
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
function useHistoryPanel({
|
|
1076
|
+
isOpen,
|
|
1077
|
+
recipient,
|
|
1078
|
+
service,
|
|
1079
|
+
canRecover,
|
|
1080
|
+
analytics
|
|
1081
|
+
}) {
|
|
1082
|
+
const [isPanelOpen, setIsPanelOpen] = _react.useState.call(void 0, false);
|
|
1083
|
+
const [deposits, setDeposits] = _react.useState.call(void 0, []);
|
|
1084
|
+
const [hasMore, setHasMore] = _react.useState.call(void 0, false);
|
|
1085
|
+
const [isLoading, setIsLoading] = _react.useState.call(void 0, false);
|
|
1086
|
+
const [isLoadingMore, setIsLoadingMore] = _react.useState.call(void 0, false);
|
|
1087
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
|
1088
|
+
const cursorRef = _react.useRef.call(void 0, null);
|
|
1089
|
+
const staleRef = _react.useRef.call(void 0, false);
|
|
1090
|
+
const loadedRef = _react.useRef.call(void 0, false);
|
|
1091
|
+
const recipientRef = _react.useRef.call(void 0, recipient);
|
|
1092
|
+
const requestRef = _react.useRef.call(void 0, 0);
|
|
1093
|
+
const [recovering, setRecovering] = _react.useState.call(void 0, null);
|
|
1094
|
+
const [recoverySubmitting, setRecoverySubmitting] = _react.useState.call(void 0, false);
|
|
1095
|
+
const fetchHistory = _react.useCallback.call(void 0,
|
|
1096
|
+
async (mode = "initial") => {
|
|
1097
|
+
if (!recipient) return;
|
|
1098
|
+
const isInitial = mode === "initial";
|
|
1099
|
+
const requestId = isInitial ? ++requestRef.current : requestRef.current;
|
|
1100
|
+
const isCurrent = () => recipientRef.current === recipient && requestId === requestRef.current;
|
|
1101
|
+
if (isInitial) {
|
|
1102
|
+
setIsLoading(true);
|
|
1103
|
+
} else {
|
|
1104
|
+
setIsLoadingMore(true);
|
|
1105
|
+
}
|
|
1106
|
+
setError(null);
|
|
1107
|
+
try {
|
|
1108
|
+
const cursor = isInitial ? null : cursorRef.current;
|
|
1109
|
+
if (!isInitial && !cursor) {
|
|
1110
|
+
setHasMore(false);
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1113
|
+
const result = await service.fetchDepositHistory({
|
|
1114
|
+
recipient,
|
|
1115
|
+
limit: 20,
|
|
1116
|
+
cursor: _nullishCoalesce(cursor, () => ( void 0))
|
|
1117
|
+
});
|
|
1118
|
+
if (!isCurrent()) return;
|
|
1119
|
+
const incoming = result.deposits;
|
|
1120
|
+
const nextCursor = _nullishCoalesce(result.nextCursor, () => ( null));
|
|
1121
|
+
if (isInitial) {
|
|
1122
|
+
setDeposits(sortByCreatedAtDesc(incoming));
|
|
1123
|
+
} else {
|
|
1124
|
+
setDeposits((prev) => sortByCreatedAtDesc([...prev, ...incoming]));
|
|
1125
|
+
}
|
|
1126
|
+
cursorRef.current = nextCursor;
|
|
1127
|
+
setHasMore(Boolean(nextCursor));
|
|
1128
|
+
staleRef.current = false;
|
|
1129
|
+
loadedRef.current = true;
|
|
1130
|
+
} catch (err) {
|
|
1131
|
+
if (!isCurrent()) return;
|
|
1132
|
+
setError(err instanceof Error ? err.message : "Failed to load history");
|
|
1133
|
+
} finally {
|
|
1134
|
+
if (isCurrent()) {
|
|
1135
|
+
if (isInitial) {
|
|
1136
|
+
setIsLoading(false);
|
|
1137
|
+
} else {
|
|
1138
|
+
setIsLoadingMore(false);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
},
|
|
1143
|
+
[recipient, service]
|
|
1144
|
+
);
|
|
1145
|
+
const badge = _react.useMemo.call(void 0,
|
|
1146
|
+
() => deriveHistoryBadge(deposits, { recipient, canRecover }),
|
|
1147
|
+
[deposits, recipient, canRecover]
|
|
1148
|
+
);
|
|
1149
|
+
const openPanel = _react.useCallback.call(void 0, () => {
|
|
1150
|
+
setIsPanelOpen(true);
|
|
1151
|
+
_optionalChain([analytics, 'optionalAccess', _20 => _20.visitOpened, 'call', _21 => _21(badge)]);
|
|
1152
|
+
if (!loadedRef.current || staleRef.current) {
|
|
1153
|
+
fetchHistory("initial");
|
|
1154
|
+
}
|
|
1155
|
+
}, [analytics, badge, fetchHistory]);
|
|
1156
|
+
const closePanel = _react.useCallback.call(void 0, () => {
|
|
1157
|
+
if (recovering) return;
|
|
1158
|
+
setIsPanelOpen(false);
|
|
1159
|
+
_optionalChain([analytics, 'optionalAccess', _22 => _22.visitEnded, 'call', _23 => _23()]);
|
|
1160
|
+
}, [analytics, recovering]);
|
|
1161
|
+
const loadMore = _react.useCallback.call(void 0, () => {
|
|
1162
|
+
_optionalChain([analytics, 'optionalAccess', _24 => _24.loadMore, 'call', _25 => _25(filterVisibleDeposits(deposits).length)]);
|
|
1163
|
+
fetchHistory("more");
|
|
1164
|
+
}, [analytics, deposits, fetchHistory]);
|
|
1165
|
+
const markStale = _react.useCallback.call(void 0, () => {
|
|
1166
|
+
staleRef.current = true;
|
|
1167
|
+
if (isOpen) {
|
|
1168
|
+
fetchHistory("initial");
|
|
1169
|
+
}
|
|
1170
|
+
}, [isOpen, fetchHistory]);
|
|
1171
|
+
_react.useEffect.call(void 0, () => {
|
|
1172
|
+
if (recipientRef.current === recipient) return;
|
|
1173
|
+
recipientRef.current = recipient;
|
|
1174
|
+
setDeposits([]);
|
|
1175
|
+
setHasMore(false);
|
|
1176
|
+
setError(null);
|
|
1177
|
+
cursorRef.current = null;
|
|
1178
|
+
staleRef.current = false;
|
|
1179
|
+
loadedRef.current = false;
|
|
1180
|
+
}, [recipient]);
|
|
1181
|
+
_react.useEffect.call(void 0, () => {
|
|
1182
|
+
if (!isOpen || !recipient) return;
|
|
1183
|
+
if (!loadedRef.current || staleRef.current) {
|
|
1184
|
+
fetchHistory("initial");
|
|
1185
|
+
}
|
|
1186
|
+
}, [isOpen, recipient, fetchHistory]);
|
|
1187
|
+
_react.useEffect.call(void 0, () => {
|
|
1188
|
+
if (isOpen) return;
|
|
1189
|
+
setIsPanelOpen(false);
|
|
1190
|
+
_optionalChain([analytics, 'optionalAccess', _26 => _26.visitEnded, 'call', _27 => _27()]);
|
|
1191
|
+
setDeposits([]);
|
|
1192
|
+
setHasMore(false);
|
|
1193
|
+
setError(null);
|
|
1194
|
+
cursorRef.current = null;
|
|
1195
|
+
staleRef.current = false;
|
|
1196
|
+
loadedRef.current = false;
|
|
1197
|
+
requestRef.current += 1;
|
|
1198
|
+
setRecovering(null);
|
|
1199
|
+
setRecoverySubmitting(false);
|
|
1200
|
+
}, [isOpen, analytics]);
|
|
1201
|
+
const invalidate = _react.useCallback.call(void 0, () => {
|
|
1202
|
+
staleRef.current = true;
|
|
1203
|
+
}, []);
|
|
1204
|
+
const cancelRecovery = _react.useCallback.call(void 0, () => setRecovering(null), []);
|
|
1205
|
+
return _react.useMemo.call(void 0,
|
|
1206
|
+
() => ({
|
|
1207
|
+
deposits,
|
|
1208
|
+
isLoading,
|
|
1209
|
+
isLoadingMore,
|
|
1210
|
+
error,
|
|
1211
|
+
hasMore,
|
|
1212
|
+
badge,
|
|
1213
|
+
isPanelOpen,
|
|
1214
|
+
openPanel,
|
|
1215
|
+
closePanel,
|
|
1216
|
+
loadMore,
|
|
1217
|
+
markStale,
|
|
1218
|
+
invalidate,
|
|
1219
|
+
recovering,
|
|
1220
|
+
startRecovery: setRecovering,
|
|
1221
|
+
cancelRecovery,
|
|
1222
|
+
recoverySubmitting,
|
|
1223
|
+
setRecoverySubmitting
|
|
1224
|
+
}),
|
|
1225
|
+
[
|
|
1226
|
+
deposits,
|
|
1227
|
+
isLoading,
|
|
1228
|
+
isLoadingMore,
|
|
1229
|
+
error,
|
|
1230
|
+
hasMore,
|
|
1231
|
+
badge,
|
|
1232
|
+
isPanelOpen,
|
|
1233
|
+
openPanel,
|
|
1234
|
+
closePanel,
|
|
1235
|
+
loadMore,
|
|
1236
|
+
markStale,
|
|
1237
|
+
invalidate,
|
|
1238
|
+
recovering,
|
|
1239
|
+
cancelRecovery,
|
|
1240
|
+
recoverySubmitting
|
|
1241
|
+
]
|
|
1242
|
+
);
|
|
1243
|
+
}
|
|
38
1244
|
|
|
39
1245
|
// src/core/removed-props.ts
|
|
40
1246
|
var MANAGED_ACCOUNT_REMOVALS = {
|
|
@@ -97,6 +1303,104 @@ function warnRemovedProps(component, props) {
|
|
|
97
1303
|
}
|
|
98
1304
|
}
|
|
99
1305
|
|
|
1306
|
+
// src/core/history-entry.ts
|
|
1307
|
+
var PROVIDER_SCREENS = /* @__PURE__ */ new Set(["fiat-onramp", "exchange-connect"]);
|
|
1308
|
+
function isHistoryEntryVisible(input) {
|
|
1309
|
+
if (input.submitting) return false;
|
|
1310
|
+
if (input.screen === "processing") return input.settled;
|
|
1311
|
+
if (PROVIDER_SCREENS.has(input.screen)) return false;
|
|
1312
|
+
return true;
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
// src/core/history-analytics.ts
|
|
1316
|
+
function sinkFor(source) {
|
|
1317
|
+
if (source.modal === "deposit") {
|
|
1318
|
+
const at2 = () => source.controllerRef.current;
|
|
1319
|
+
return {
|
|
1320
|
+
opened: (detail) => _optionalChain([at2, 'call', _28 => _28(), 'optionalAccess', _29 => _29.historyOpened, 'call', _30 => _30({ ...detail, step: _nullishCoalesce(_optionalChain([at2, 'call', _31 => _31(), 'optionalAccess', _32 => _32.step]), () => ( null)) })]),
|
|
1321
|
+
rowViewed: (detail) => _optionalChain([at2, 'call', _33 => _33(), 'optionalAccess', _34 => _34.historyRowViewed, 'call', _35 => _35(detail)]),
|
|
1322
|
+
loadMore: (detail) => _optionalChain([at2, 'call', _36 => _36(), 'optionalAccess', _37 => _37.historyLoadMore, 'call', _38 => _38(detail)]),
|
|
1323
|
+
fallbackOpened: (detail) => _optionalChain([at2, 'call', _39 => _39(), 'optionalAccess', _40 => _40.historyFallbackOpened, 'call', _41 => _41(detail)]),
|
|
1324
|
+
recoveryStarted: (detail) => _optionalChain([at2, 'call', _42 => _42(), 'optionalAccess', _43 => _43.historyRecoveryStarted, 'call', _44 => _44(detail)])
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
const at = () => source.controllerRef.current;
|
|
1328
|
+
return {
|
|
1329
|
+
opened: (detail) => _optionalChain([at, 'call', _45 => _45(), 'optionalAccess', _46 => _46.historyOpened, 'call', _47 => _47({ ...detail, step: _nullishCoalesce(_optionalChain([at, 'call', _48 => _48(), 'optionalAccess', _49 => _49.step]), () => ( null)) })]),
|
|
1330
|
+
rowViewed: (detail) => _optionalChain([at, 'call', _50 => _50(), 'optionalAccess', _51 => _51.historyRowViewed, 'call', _52 => _52(detail)]),
|
|
1331
|
+
loadMore: (detail) => _optionalChain([at, 'call', _53 => _53(), 'optionalAccess', _54 => _54.historyLoadMore, 'call', _55 => _55(detail)]),
|
|
1332
|
+
fallbackOpened: (detail) => _optionalChain([at, 'call', _56 => _56(), 'optionalAccess', _57 => _57.historyFallbackOpened, 'call', _58 => _58(detail)]),
|
|
1333
|
+
recoveryStarted: (detail) => _optionalChain([at, 'call', _59 => _59(), 'optionalAccess', _60 => _60.historyRecoveryStarted, 'call', _61 => _61(detail)])
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1336
|
+
function badgeState(badge) {
|
|
1337
|
+
if (!badge) return "none";
|
|
1338
|
+
return badge.state === "needs-you" ? "needs_you" : "progress";
|
|
1339
|
+
}
|
|
1340
|
+
function createHistoryAnalytics(source) {
|
|
1341
|
+
const sink = sinkFor(source);
|
|
1342
|
+
let visitId = null;
|
|
1343
|
+
let loadMorePresses = 0;
|
|
1344
|
+
let viewedRows = /* @__PURE__ */ new Set();
|
|
1345
|
+
return {
|
|
1346
|
+
get sourceSessionId() {
|
|
1347
|
+
return source.sessionIdRef.current;
|
|
1348
|
+
},
|
|
1349
|
+
get visitId() {
|
|
1350
|
+
return visitId;
|
|
1351
|
+
},
|
|
1352
|
+
visitOpened(badge) {
|
|
1353
|
+
visitId = _chunk3OOY67VJcjs.randomUuid.call(void 0, );
|
|
1354
|
+
loadMorePresses = 0;
|
|
1355
|
+
viewedRows = /* @__PURE__ */ new Set();
|
|
1356
|
+
sink.opened({
|
|
1357
|
+
history_visit_id: visitId,
|
|
1358
|
+
badge: badgeState(badge),
|
|
1359
|
+
badge_count: _nullishCoalesce(_optionalChain([badge, 'optionalAccess', _62 => _62.count]), () => ( 0))
|
|
1360
|
+
});
|
|
1361
|
+
},
|
|
1362
|
+
visitEnded() {
|
|
1363
|
+
visitId = null;
|
|
1364
|
+
},
|
|
1365
|
+
rowViewed({ depositId, status, recoverable, position }) {
|
|
1366
|
+
if (!visitId || viewedRows.has(depositId)) return;
|
|
1367
|
+
viewedRows.add(depositId);
|
|
1368
|
+
sink.rowViewed({
|
|
1369
|
+
history_visit_id: visitId,
|
|
1370
|
+
deposit_id: depositId,
|
|
1371
|
+
status,
|
|
1372
|
+
recoverable,
|
|
1373
|
+
position
|
|
1374
|
+
});
|
|
1375
|
+
},
|
|
1376
|
+
loadMore(loadedRows) {
|
|
1377
|
+
if (!visitId) return;
|
|
1378
|
+
loadMorePresses += 1;
|
|
1379
|
+
sink.loadMore({
|
|
1380
|
+
history_visit_id: visitId,
|
|
1381
|
+
page: loadMorePresses,
|
|
1382
|
+
loaded_rows: loadedRows
|
|
1383
|
+
});
|
|
1384
|
+
},
|
|
1385
|
+
fallbackOpened(claimAttemptId) {
|
|
1386
|
+
if (!visitId) return;
|
|
1387
|
+
sink.fallbackOpened({
|
|
1388
|
+
history_visit_id: visitId,
|
|
1389
|
+
claim_attempt_id: claimAttemptId
|
|
1390
|
+
});
|
|
1391
|
+
},
|
|
1392
|
+
recoveryStarted(claimAttemptId, entrySource, depositId) {
|
|
1393
|
+
if (!visitId) return;
|
|
1394
|
+
sink.recoveryStarted({
|
|
1395
|
+
history_visit_id: visitId,
|
|
1396
|
+
claim_attempt_id: claimAttemptId,
|
|
1397
|
+
entry_source: entrySource,
|
|
1398
|
+
deposit_id: depositId
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
};
|
|
1402
|
+
}
|
|
1403
|
+
|
|
100
1404
|
// src/core/analytics-target.ts
|
|
101
1405
|
var HEX_TOKEN = /^0x(?:[0-9a-f]{32}|[0-9a-f]{40})$/i;
|
|
102
1406
|
var BASE58_TOKEN = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
@@ -113,10 +1417,10 @@ function resolveChain(targetChain) {
|
|
|
113
1417
|
if (typeof targetChain === "number" && !(targetChain > 0 && Number.isInteger(targetChain))) {
|
|
114
1418
|
return void 0;
|
|
115
1419
|
}
|
|
116
|
-
return
|
|
1420
|
+
return _chunkOY5N3E6Lcjs.targetChainToCaip2.call(void 0, targetChain);
|
|
117
1421
|
}
|
|
118
1422
|
function resolveToken(targetToken) {
|
|
119
|
-
const raw = _optionalChain([targetToken, 'optionalAccess',
|
|
1423
|
+
const raw = _optionalChain([targetToken, 'optionalAccess', _63 => _63.trim, 'call', _64 => _64()]);
|
|
120
1424
|
if (!raw) return void 0;
|
|
121
1425
|
if (HEX_TOKEN.test(raw)) return raw.toLowerCase();
|
|
122
1426
|
if (BASE58_TOKEN.test(raw)) return raw;
|
|
@@ -143,7 +1447,7 @@ function isSubmissionUncertain(error) {
|
|
|
143
1447
|
}
|
|
144
1448
|
|
|
145
1449
|
// src/components/steps/ProcessingStep.tsx
|
|
146
|
-
|
|
1450
|
+
|
|
147
1451
|
|
|
148
1452
|
// src/components/ui/Tooltip.tsx
|
|
149
1453
|
|
|
@@ -153,7 +1457,7 @@ var _react = require('react');
|
|
|
153
1457
|
|
|
154
1458
|
|
|
155
1459
|
var _reactdom = require('react-dom');
|
|
156
|
-
|
|
1460
|
+
|
|
157
1461
|
function Tooltip({ content, children, className }) {
|
|
158
1462
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
159
1463
|
const [position, setPosition] = _react.useState.call(void 0, null);
|
|
@@ -174,8 +1478,8 @@ function Tooltip({ content, children, className }) {
|
|
|
174
1478
|
function handleOutside(event) {
|
|
175
1479
|
const target = event.target;
|
|
176
1480
|
if (!target) return;
|
|
177
|
-
if (_optionalChain([triggerRef, 'access',
|
|
178
|
-
if (_optionalChain([bubbleRef, 'access',
|
|
1481
|
+
if (_optionalChain([triggerRef, 'access', _65 => _65.current, 'optionalAccess', _66 => _66.contains, 'call', _67 => _67(target)])) return;
|
|
1482
|
+
if (_optionalChain([bubbleRef, 'access', _68 => _68.current, 'optionalAccess', _69 => _69.contains, 'call', _70 => _70(target)])) return;
|
|
179
1483
|
setOpen(false);
|
|
180
1484
|
}
|
|
181
1485
|
function handleKey(event) {
|
|
@@ -252,7 +1556,7 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
252
1556
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-fees-accordion-summary", children: [
|
|
253
1557
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-fees-accordion-label", children: [
|
|
254
1558
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fees" }),
|
|
255
|
-
tooltip && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Tooltip, { content: tooltip, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-info", "aria-label": "Fees info", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1559
|
+
tooltip && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Tooltip, { content: tooltip, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-info", "aria-label": "Fees info", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.InfoIcon, {}) }) })
|
|
256
1560
|
] }),
|
|
257
1561
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
258
1562
|
"button",
|
|
@@ -270,7 +1574,7 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
270
1574
|
{
|
|
271
1575
|
className: `rs-fees-accordion-chevron${open ? " rs-fees-accordion-chevron--open" : ""}`,
|
|
272
1576
|
"aria-hidden": "true",
|
|
273
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1577
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.ChevronDownIcon, {})
|
|
274
1578
|
}
|
|
275
1579
|
)
|
|
276
1580
|
]
|
|
@@ -292,7 +1596,7 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
292
1596
|
{
|
|
293
1597
|
className: "rs-review-detail-info",
|
|
294
1598
|
"aria-label": `${row.label} info`,
|
|
295
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1599
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.InfoIcon, {})
|
|
296
1600
|
}
|
|
297
1601
|
) })
|
|
298
1602
|
] })
|
|
@@ -318,13 +1622,13 @@ function SwappedReceipt({
|
|
|
318
1622
|
}) {
|
|
319
1623
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
320
1624
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
321
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1625
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.CheckIcon, {}), title: "Deposit successful" }),
|
|
322
1626
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
323
1627
|
onrampMethod && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
324
1628
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Onramp method" }),
|
|
325
1629
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
326
1630
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: onrampMethod }),
|
|
327
|
-
onrampMethodIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon rs-review-detail-icon--square", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1631
|
+
onrampMethodIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon rs-review-detail-icon--square", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.CdnIcon, { src: onrampMethodIcon }) })
|
|
328
1632
|
] })
|
|
329
1633
|
] }),
|
|
330
1634
|
amountPaid && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -335,7 +1639,7 @@ function SwappedReceipt({
|
|
|
335
1639
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Deposited amount" }),
|
|
336
1640
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
337
1641
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: depositedAmount }),
|
|
338
|
-
depositedSymbol && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1642
|
+
depositedSymbol && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.TokenIcon, { symbol: depositedSymbol }) })
|
|
339
1643
|
] })
|
|
340
1644
|
] }),
|
|
341
1645
|
feesTotal != null && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -348,11 +1652,11 @@ function SwappedReceipt({
|
|
|
348
1652
|
)
|
|
349
1653
|
] }),
|
|
350
1654
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-button-row", children: [
|
|
351
|
-
onNewDeposit && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
352
|
-
onClose && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1655
|
+
onNewDeposit && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.Button, { variant: "outline", onClick: onNewDeposit, fullWidth: true, children: newLabel }),
|
|
1656
|
+
onClose && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.Button, { onClick: onClose, fullWidth: true, children: "Done" })
|
|
353
1657
|
] })
|
|
354
1658
|
] }),
|
|
355
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1659
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.PoweredBy, {})
|
|
356
1660
|
] });
|
|
357
1661
|
}
|
|
358
1662
|
SwappedReceipt.displayName = "SwappedReceipt";
|
|
@@ -371,7 +1675,7 @@ var EXCHANGE_SLUGS = [
|
|
|
371
1675
|
"kucoin"
|
|
372
1676
|
];
|
|
373
1677
|
var EXCHANGE_LOGO_SOURCES = Object.fromEntries(
|
|
374
|
-
EXCHANGE_SLUGS.map((slug) => [slug,
|
|
1678
|
+
EXCHANGE_SLUGS.map((slug) => [slug, _chunkOY5N3E6Lcjs.cdnIconUrl.call(void 0, "exchanges", slug)])
|
|
375
1679
|
);
|
|
376
1680
|
var EXCHANGE_LOGO_ALIASES = {
|
|
377
1681
|
gate: "gateio"
|
|
@@ -388,7 +1692,7 @@ function getExchangeLogoSrc(name, connection) {
|
|
|
388
1692
|
}
|
|
389
1693
|
function getExchangeLogo(name, connection) {
|
|
390
1694
|
const src = getExchangeLogoSrc(name, connection);
|
|
391
|
-
return src ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1695
|
+
return src ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.CdnIcon, { src }) : null;
|
|
392
1696
|
}
|
|
393
1697
|
|
|
394
1698
|
// src/core/webhook.ts
|
|
@@ -404,7 +1708,7 @@ function asNumber(value) {
|
|
|
404
1708
|
const trimmed = value.trim();
|
|
405
1709
|
if (!trimmed) return void 0;
|
|
406
1710
|
const caipMatch = trimmed.match(/^eip155:(\d+)$/);
|
|
407
|
-
if (_optionalChain([caipMatch, 'optionalAccess',
|
|
1711
|
+
if (_optionalChain([caipMatch, 'optionalAccess', _71 => _71[1]])) {
|
|
408
1712
|
const parsed2 = Number(caipMatch[1]);
|
|
409
1713
|
return Number.isFinite(parsed2) ? parsed2 : void 0;
|
|
410
1714
|
}
|
|
@@ -423,24 +1727,24 @@ function asAddress(value) {
|
|
|
423
1727
|
return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
|
|
424
1728
|
}
|
|
425
1729
|
function getEventTxHash(event) {
|
|
426
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1730
|
+
if (!_optionalChain([event, 'optionalAccess', _72 => _72.type])) return void 0;
|
|
427
1731
|
if (event.type === "deposit-received") {
|
|
428
|
-
return asString(_optionalChain([event, 'access',
|
|
1732
|
+
return asString(_optionalChain([event, 'access', _73 => _73.data, 'optionalAccess', _74 => _74.transactionHash]));
|
|
429
1733
|
}
|
|
430
1734
|
if (event.type === "bridge-started" || event.type === "bridge-complete") {
|
|
431
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
432
|
-
const source = isRecord(_optionalChain([event, 'access',
|
|
433
|
-
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess',
|
|
1735
|
+
const deposit = isRecord(_optionalChain([event, 'access', _75 => _75.data, 'optionalAccess', _76 => _76.deposit])) ? event.data.deposit : void 0;
|
|
1736
|
+
const source = isRecord(_optionalChain([event, 'access', _77 => _77.data, 'optionalAccess', _78 => _78.source])) ? event.data.source : void 0;
|
|
1737
|
+
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _79 => _79.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _80 => _80.transactionHash]))));
|
|
434
1738
|
}
|
|
435
1739
|
if (event.type === "bridge-failed" || event.type === "error") {
|
|
436
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
437
|
-
const source = isRecord(_optionalChain([event, 'access',
|
|
438
|
-
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess',
|
|
1740
|
+
const deposit = isRecord(_optionalChain([event, 'access', _81 => _81.data, 'optionalAccess', _82 => _82.deposit])) ? event.data.deposit : void 0;
|
|
1741
|
+
const source = isRecord(_optionalChain([event, 'access', _83 => _83.data, 'optionalAccess', _84 => _84.source])) ? event.data.source : void 0;
|
|
1742
|
+
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _85 => _85.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _86 => _86.transactionHash]))));
|
|
439
1743
|
}
|
|
440
1744
|
return void 0;
|
|
441
1745
|
}
|
|
442
1746
|
function getEventSourceDetails(event) {
|
|
443
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1747
|
+
if (!_optionalChain([event, 'optionalAccess', _87 => _87.type]) || !isRecord(event.data)) return {};
|
|
444
1748
|
if (event.type === "deposit-received") {
|
|
445
1749
|
return {
|
|
446
1750
|
chainId: asNumber(event.data.chain),
|
|
@@ -452,9 +1756,9 @@ function getEventSourceDetails(event) {
|
|
|
452
1756
|
const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
|
|
453
1757
|
if (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error") {
|
|
454
1758
|
return {
|
|
455
|
-
chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess',
|
|
456
|
-
amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess',
|
|
457
|
-
token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess',
|
|
1759
|
+
chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess', _88 => _88.chain])), () => ( asNumber(_optionalChain([deposit, 'optionalAccess', _89 => _89.chain])))),
|
|
1760
|
+
amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess', _90 => _90.amount])), () => ( asAmount(_optionalChain([deposit, 'optionalAccess', _91 => _91.amount])))),
|
|
1761
|
+
token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess', _92 => _92.asset])), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _93 => _93.asset])))), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _94 => _94.token]))))
|
|
458
1762
|
};
|
|
459
1763
|
}
|
|
460
1764
|
return {};
|
|
@@ -468,7 +1772,7 @@ function asChain(value) {
|
|
|
468
1772
|
return asNumber(value);
|
|
469
1773
|
}
|
|
470
1774
|
function getEventDestinationDetails(event) {
|
|
471
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1775
|
+
if (!_optionalChain([event, 'optionalAccess', _95 => _95.type]) || !isRecord(event.data)) return {};
|
|
472
1776
|
if (event.type !== "bridge-started" && event.type !== "bridge-complete") {
|
|
473
1777
|
return {};
|
|
474
1778
|
}
|
|
@@ -478,14 +1782,14 @@ function getEventDestinationDetails(event) {
|
|
|
478
1782
|
return {
|
|
479
1783
|
chainId: asChain(destination.chain),
|
|
480
1784
|
amount: asAmount(destination.amount),
|
|
481
|
-
token: _optionalChain([token, 'optionalAccess',
|
|
1785
|
+
token: _optionalChain([token, 'optionalAccess', _96 => _96.trim, 'call', _97 => _97()]) || void 0
|
|
482
1786
|
};
|
|
483
1787
|
}
|
|
484
1788
|
function isDepositEvent(event) {
|
|
485
|
-
return _optionalChain([event, 'optionalAccess',
|
|
1789
|
+
return _optionalChain([event, 'optionalAccess', _98 => _98.type]) === "deposit-received" || _optionalChain([event, 'optionalAccess', _99 => _99.type]) === "bridge-started" || _optionalChain([event, 'optionalAccess', _100 => _100.type]) === "bridge-complete" || _optionalChain([event, 'optionalAccess', _101 => _101.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _102 => _102.type]) === "error";
|
|
486
1790
|
}
|
|
487
1791
|
function isFailedEvent(event) {
|
|
488
|
-
return _optionalChain([event, 'optionalAccess',
|
|
1792
|
+
return _optionalChain([event, 'optionalAccess', _103 => _103.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _104 => _104.type]) === "error";
|
|
489
1793
|
}
|
|
490
1794
|
function isHexString(value) {
|
|
491
1795
|
return value.startsWith("0x") || value.startsWith("0X");
|
|
@@ -497,7 +1801,7 @@ function txRefsMatch(a, b) {
|
|
|
497
1801
|
return a === b;
|
|
498
1802
|
}
|
|
499
1803
|
function formatBridgeFailedMessage(event) {
|
|
500
|
-
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
1804
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _105 => _105.data]), () => ( {}));
|
|
501
1805
|
const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
|
|
502
1806
|
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
503
1807
|
function toUserFacingFailure(raw) {
|
|
@@ -525,7 +1829,7 @@ function formatBridgeFailedMessage(event) {
|
|
|
525
1829
|
return { message: "Bridge failed" };
|
|
526
1830
|
}
|
|
527
1831
|
function failureMessageForEvent(event) {
|
|
528
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
1832
|
+
if (_optionalChain([event, 'optionalAccess', _106 => _106.type]) === "error") {
|
|
529
1833
|
const message = isRecord(event.data) ? asString(event.data.message) : void 0;
|
|
530
1834
|
return _nullishCoalesce(message, () => ( "Unknown error"));
|
|
531
1835
|
}
|
|
@@ -544,16 +1848,16 @@ function isSolanaNativeAddress(address) {
|
|
|
544
1848
|
}
|
|
545
1849
|
function isNativeAddress(address) {
|
|
546
1850
|
if (!address) return true;
|
|
547
|
-
return address.toLowerCase() ===
|
|
1851
|
+
return address.toLowerCase() === _chunkOY5N3E6Lcjs.NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
548
1852
|
}
|
|
549
1853
|
function caip2For(token) {
|
|
550
1854
|
if (token.chainId === "solana") {
|
|
551
1855
|
const mint = isSolanaNativeAddress(token.address) ? WRAPPED_SOL_MINT : token.address;
|
|
552
|
-
return mint ? `${
|
|
1856
|
+
return mint ? `${_chunkOY5N3E6Lcjs.SOLANA_MAINNET_CAIP2}:${mint}` : void 0;
|
|
553
1857
|
}
|
|
554
1858
|
if (typeof token.chainId !== "number") return void 0;
|
|
555
1859
|
const address = isNativeAddress(token.address) ? PRICE_SERVICE_NATIVE : token.address;
|
|
556
|
-
return `${
|
|
1860
|
+
return `${_chunkOY5N3E6Lcjs.toEvmCaip2.call(void 0, token.chainId)}:${address.toLowerCase()}`;
|
|
557
1861
|
}
|
|
558
1862
|
async function fetchTokenPriceUsd(service, token) {
|
|
559
1863
|
const caip2 = caip2For(token);
|
|
@@ -564,7 +1868,7 @@ async function fetchTokenPriceUsd(service, token) {
|
|
|
564
1868
|
}
|
|
565
1869
|
function useTokenPrices(service, tokens) {
|
|
566
1870
|
const [prices, setPrices] = _react.useState.call(void 0, {});
|
|
567
|
-
const defined = tokens.filter((t) => Boolean(_optionalChain([t, 'optionalAccess',
|
|
1871
|
+
const defined = tokens.filter((t) => Boolean(_optionalChain([t, 'optionalAccess', _107 => _107.symbol])));
|
|
568
1872
|
const entries = [
|
|
569
1873
|
...new Map(
|
|
570
1874
|
defined.flatMap((token) => {
|
|
@@ -697,14 +2001,14 @@ function buildQuoteFeeRows(breakdown, sponsoredTooltip) {
|
|
|
697
2001
|
if (!breakdown) return { rows: [], chargeableUsd: 0 };
|
|
698
2002
|
const rows = [];
|
|
699
2003
|
let chargeableUsd = 0;
|
|
700
|
-
for (const group of
|
|
2004
|
+
for (const group of _chunk3OOY67VJcjs.quoteFeeGroups.call(void 0, breakdown)) {
|
|
701
2005
|
if (group.chargedUsd > 0) {
|
|
702
2006
|
chargeableUsd += group.chargedUsd;
|
|
703
|
-
rows.push({ label: group.label, value:
|
|
2007
|
+
rows.push({ label: group.label, value: _chunk3OOY67VJcjs.formatFeeUsd.call(void 0, group.chargedUsd) });
|
|
704
2008
|
} else if (group.sponsoredUsd > 0) {
|
|
705
2009
|
rows.push({
|
|
706
2010
|
label: group.label,
|
|
707
|
-
value:
|
|
2011
|
+
value: _chunk3OOY67VJcjs.formatFeeUsd.call(void 0, group.sponsoredUsd),
|
|
708
2012
|
strike: true,
|
|
709
2013
|
tooltip: sponsoredTooltip
|
|
710
2014
|
});
|
|
@@ -733,7 +2037,7 @@ function loadPhaseTimings(txHash) {
|
|
|
733
2037
|
const parsed = JSON.parse(raw);
|
|
734
2038
|
if (typeof parsed.startedAt !== "number") return null;
|
|
735
2039
|
return parsed;
|
|
736
|
-
} catch (
|
|
2040
|
+
} catch (e4) {
|
|
737
2041
|
return null;
|
|
738
2042
|
}
|
|
739
2043
|
}
|
|
@@ -744,7 +2048,7 @@ function savePhaseTimings(txHash, timings) {
|
|
|
744
2048
|
`${PHASE_TIMINGS_PREFIX}:${txHash}`,
|
|
745
2049
|
JSON.stringify(timings)
|
|
746
2050
|
);
|
|
747
|
-
} catch (
|
|
2051
|
+
} catch (e5) {
|
|
748
2052
|
}
|
|
749
2053
|
}
|
|
750
2054
|
function isEventForTx(event, txHash) {
|
|
@@ -753,12 +2057,12 @@ function isEventForTx(event, txHash) {
|
|
|
753
2057
|
return txRefsMatch(eventTxHash, txHash);
|
|
754
2058
|
}
|
|
755
2059
|
function parseWebhookTimestamp(event) {
|
|
756
|
-
if (typeof _optionalChain([event, 'optionalAccess',
|
|
2060
|
+
if (typeof _optionalChain([event, 'optionalAccess', _108 => _108.time]) !== "string") return void 0;
|
|
757
2061
|
const timestamp = Date.parse(event.time);
|
|
758
2062
|
return Number.isFinite(timestamp) ? timestamp : void 0;
|
|
759
2063
|
}
|
|
760
2064
|
function syncPhaseTimings(previous, event) {
|
|
761
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
2065
|
+
if (!_optionalChain([event, 'optionalAccess', _109 => _109.type])) return previous;
|
|
762
2066
|
const timestamp = _nullishCoalesce(parseWebhookTimestamp(event), () => ( Date.now()));
|
|
763
2067
|
const setReceived = (event.type === "deposit-received" || event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error") && previous.receivedAt === void 0;
|
|
764
2068
|
const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete") && previous.bridgingAt === void 0;
|
|
@@ -820,46 +2124,46 @@ function getCurrentPhaseId(state, phaseTimings) {
|
|
|
820
2124
|
if (state.type === "complete") {
|
|
821
2125
|
return void 0;
|
|
822
2126
|
}
|
|
823
|
-
if (_optionalChain([state, 'access',
|
|
2127
|
+
if (_optionalChain([state, 'access', _110 => _110.lastEvent, 'optionalAccess', _111 => _111.type]) === "bridge-started" || _optionalChain([state, 'access', _112 => _112.lastEvent, 'optionalAccess', _113 => _113.type]) === "bridge-complete")
|
|
824
2128
|
return "bridging";
|
|
825
|
-
if (_optionalChain([state, 'access',
|
|
2129
|
+
if (_optionalChain([state, 'access', _114 => _114.lastEvent, 'optionalAccess', _115 => _115.type]) === "deposit-received") return "received";
|
|
826
2130
|
return "confirming";
|
|
827
2131
|
}
|
|
828
2132
|
function getCompletionDestinationTxHash(event) {
|
|
829
|
-
const eventData = _optionalChain([event, 'optionalAccess',
|
|
830
|
-
const swapTxHash = _optionalChain([eventData, 'optionalAccess',
|
|
831
|
-
const destinationTxHash = _optionalChain([eventData, 'optionalAccess',
|
|
2133
|
+
const eventData = _optionalChain([event, 'optionalAccess', _116 => _116.data]);
|
|
2134
|
+
const swapTxHash = _optionalChain([eventData, 'optionalAccess', _117 => _117.swap, 'optionalAccess', _118 => _118.transactionHash]);
|
|
2135
|
+
const destinationTxHash = _optionalChain([eventData, 'optionalAccess', _119 => _119.destination, 'optionalAccess', _120 => _120.transactionHash]);
|
|
832
2136
|
return _nullishCoalesce(swapTxHash, () => ( destinationTxHash));
|
|
833
2137
|
}
|
|
834
2138
|
function getTerminalProcessingOutcome(event) {
|
|
835
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
2139
|
+
if (_optionalChain([event, 'optionalAccess', _121 => _121.type]) === "post-bridge-swap-complete") {
|
|
836
2140
|
return {
|
|
837
2141
|
type: "complete",
|
|
838
2142
|
destinationTxHash: getCompletionDestinationTxHash(event)
|
|
839
2143
|
};
|
|
840
2144
|
}
|
|
841
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
2145
|
+
if (_optionalChain([event, 'optionalAccess', _122 => _122.type]) === "post-bridge-swap-failed") {
|
|
842
2146
|
return {
|
|
843
2147
|
type: "failed",
|
|
844
2148
|
message: formatBridgeFailedMessage(event).message
|
|
845
2149
|
};
|
|
846
2150
|
}
|
|
847
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
2151
|
+
if (_optionalChain([event, 'optionalAccess', _123 => _123.type]) === "bridge-complete") {
|
|
848
2152
|
return {
|
|
849
2153
|
type: "complete",
|
|
850
2154
|
destinationTxHash: getCompletionDestinationTxHash(event)
|
|
851
2155
|
};
|
|
852
2156
|
}
|
|
853
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
2157
|
+
if (_optionalChain([event, 'optionalAccess', _124 => _124.type]) === "bridge-failed") {
|
|
854
2158
|
return {
|
|
855
2159
|
type: "failed",
|
|
856
2160
|
message: formatBridgeFailedMessage(event).message
|
|
857
2161
|
};
|
|
858
2162
|
}
|
|
859
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
2163
|
+
if (_optionalChain([event, 'optionalAccess', _125 => _125.type]) === "error") {
|
|
860
2164
|
return {
|
|
861
2165
|
type: "failed",
|
|
862
|
-
message: _nullishCoalesce(_optionalChain([event, 'access',
|
|
2166
|
+
message: _nullishCoalesce(_optionalChain([event, 'access', _126 => _126.data, 'optionalAccess', _127 => _127.message]), () => ( "Unknown error"))
|
|
863
2167
|
};
|
|
864
2168
|
}
|
|
865
2169
|
return null;
|
|
@@ -867,10 +2171,10 @@ function getTerminalProcessingOutcome(event) {
|
|
|
867
2171
|
function getInitialProcessingState(event, txHash) {
|
|
868
2172
|
if (!event || !isEventForTx(event, txHash)) return null;
|
|
869
2173
|
const terminal = getTerminalProcessingOutcome(event);
|
|
870
|
-
if (_optionalChain([terminal, 'optionalAccess',
|
|
2174
|
+
if (_optionalChain([terminal, 'optionalAccess', _128 => _128.type]) === "complete") {
|
|
871
2175
|
return { type: "complete", lastEvent: event };
|
|
872
2176
|
}
|
|
873
|
-
if (_optionalChain([terminal, 'optionalAccess',
|
|
2177
|
+
if (_optionalChain([terminal, 'optionalAccess', _129 => _129.type]) === "failed") {
|
|
874
2178
|
return { type: "failed", message: terminal.message, lastEvent: event };
|
|
875
2179
|
}
|
|
876
2180
|
if (isDepositEvent(event)) {
|
|
@@ -879,7 +2183,7 @@ function getInitialProcessingState(event, txHash) {
|
|
|
879
2183
|
return null;
|
|
880
2184
|
}
|
|
881
2185
|
function getSettledSourceTxHash(event, fallbackTxHash) {
|
|
882
|
-
return _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
2186
|
+
return _nullishCoalesce(_optionalChain([event, 'optionalAccess', _130 => _130.data, 'optionalAccess', _131 => _131.source, 'optionalAccess', _132 => _132.transactionHash]), () => ( fallbackTxHash));
|
|
883
2187
|
}
|
|
884
2188
|
function ProcessingStep({
|
|
885
2189
|
smartAccount,
|
|
@@ -912,13 +2216,14 @@ function ProcessingStep({
|
|
|
912
2216
|
onDepositComplete,
|
|
913
2217
|
onDepositFailed,
|
|
914
2218
|
onSourceTransactionObserved,
|
|
2219
|
+
onSettledChange,
|
|
915
2220
|
onError
|
|
916
2221
|
}) {
|
|
917
2222
|
const startTimeRef = _react.useRef.call(void 0, Date.now());
|
|
918
2223
|
const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
|
|
919
2224
|
const pollTimeoutRef = _react.useRef.call(void 0, null);
|
|
920
2225
|
const escalatedDelayRef = _react.useRef.call(void 0, false);
|
|
921
|
-
const processingContextRef =
|
|
2226
|
+
const processingContextRef = _chunk3OOY67VJcjs.useLatestRef.call(void 0, {
|
|
922
2227
|
amount,
|
|
923
2228
|
sourceChain,
|
|
924
2229
|
sourceToken,
|
|
@@ -927,11 +2232,12 @@ function ProcessingStep({
|
|
|
927
2232
|
targetChain,
|
|
928
2233
|
targetToken
|
|
929
2234
|
});
|
|
930
|
-
const onDepositCompleteRef =
|
|
931
|
-
const onDepositFailedRef =
|
|
932
|
-
const onErrorRef =
|
|
933
|
-
const explorerTxUrl =
|
|
2235
|
+
const onDepositCompleteRef = _chunk3OOY67VJcjs.useLatestRef.call(void 0, onDepositComplete);
|
|
2236
|
+
const onDepositFailedRef = _chunk3OOY67VJcjs.useLatestRef.call(void 0, onDepositFailed);
|
|
2237
|
+
const onErrorRef = _chunk3OOY67VJcjs.useLatestRef.call(void 0, onError);
|
|
2238
|
+
const explorerTxUrl = _chunk3OOY67VJcjs.useExplorerTxUrl.call(void 0, );
|
|
934
2239
|
const initialTerminalEventRef = _react.useRef.call(void 0, null);
|
|
2240
|
+
const completedDirectTransferTxHashRef = _react.useRef.call(void 0, null);
|
|
935
2241
|
const [state, setState] = _react.useState.call(void 0, () => {
|
|
936
2242
|
if (directTransfer) return { type: "complete" };
|
|
937
2243
|
const initial = getInitialProcessingState(
|
|
@@ -967,19 +2273,22 @@ function ProcessingStep({
|
|
|
967
2273
|
[txHash]
|
|
968
2274
|
);
|
|
969
2275
|
_react.useEffect.call(void 0, () => {
|
|
970
|
-
if (!directTransfer)
|
|
2276
|
+
if (!directTransfer || completedDirectTransferTxHashRef.current === txHash) {
|
|
2277
|
+
return;
|
|
2278
|
+
}
|
|
2279
|
+
completedDirectTransferTxHashRef.current = txHash;
|
|
971
2280
|
const completedAt = Date.now();
|
|
972
2281
|
updatePhaseTimings(() => ({
|
|
973
2282
|
startedAt: startTimeRef.current,
|
|
974
2283
|
completedAt,
|
|
975
2284
|
endedAt: completedAt
|
|
976
2285
|
}));
|
|
977
|
-
|
|
2286
|
+
_chunk3OOY67VJcjs.debugLog.call(void 0, debug, "processing", "direct-transfer:complete", {
|
|
978
2287
|
txHash,
|
|
979
2288
|
flowLabel
|
|
980
2289
|
});
|
|
981
2290
|
const context = processingContextRef.current;
|
|
982
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
2291
|
+
_optionalChain([onDepositCompleteRef, 'access', _133 => _133.current, 'optionalCall', _134 => _134(txHash, void 0, {
|
|
983
2292
|
amount: context.amount,
|
|
984
2293
|
sourceChain: context.sourceChain,
|
|
985
2294
|
sourceToken: context.sourceToken,
|
|
@@ -1006,13 +2315,13 @@ function ProcessingStep({
|
|
|
1006
2315
|
if (outcome.type === "complete") {
|
|
1007
2316
|
const context = processingContextRef.current;
|
|
1008
2317
|
const sourceTxHash2 = getSettledSourceTxHash(event, txHash);
|
|
1009
|
-
|
|
2318
|
+
_chunk3OOY67VJcjs.debugLog.call(void 0, debug, "processing", "initial-event:complete", {
|
|
1010
2319
|
txHash,
|
|
1011
2320
|
sourceTxHash: sourceTxHash2,
|
|
1012
2321
|
destinationTxHash: outcome.destinationTxHash,
|
|
1013
2322
|
event: event.type
|
|
1014
2323
|
});
|
|
1015
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
2324
|
+
_optionalChain([onDepositCompleteRef, 'access', _135 => _135.current, 'optionalCall', _136 => _136(
|
|
1016
2325
|
sourceTxHash2,
|
|
1017
2326
|
outcome.destinationTxHash,
|
|
1018
2327
|
{
|
|
@@ -1027,12 +2336,12 @@ function ProcessingStep({
|
|
|
1027
2336
|
)]);
|
|
1028
2337
|
return;
|
|
1029
2338
|
}
|
|
1030
|
-
|
|
2339
|
+
_chunk3OOY67VJcjs.debugLog.call(void 0, debug, "processing", "initial-event:failed", {
|
|
1031
2340
|
txHash,
|
|
1032
2341
|
message: outcome.message,
|
|
1033
2342
|
event: event.type
|
|
1034
2343
|
});
|
|
1035
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
2344
|
+
_optionalChain([onDepositFailedRef, 'access', _137 => _137.current, 'optionalCall', _138 => _138(txHash, outcome.message)]);
|
|
1036
2345
|
}, [
|
|
1037
2346
|
debug,
|
|
1038
2347
|
onDepositCompleteRef,
|
|
@@ -1040,6 +2349,12 @@ function ProcessingStep({
|
|
|
1040
2349
|
processingContextRef,
|
|
1041
2350
|
txHash
|
|
1042
2351
|
]);
|
|
2352
|
+
const onSettledChangeRef = _react.useRef.call(void 0, onSettledChange);
|
|
2353
|
+
onSettledChangeRef.current = onSettledChange;
|
|
2354
|
+
_react.useEffect.call(void 0, () => {
|
|
2355
|
+
_optionalChain([onSettledChangeRef, 'access', _139 => _139.current, 'optionalCall', _140 => _140(state.type !== "processing")]);
|
|
2356
|
+
return () => _optionalChain([onSettledChangeRef, 'access', _141 => _141.current, 'optionalCall', _142 => _142(false)]);
|
|
2357
|
+
}, [state.type]);
|
|
1043
2358
|
_react.useEffect.call(void 0, () => {
|
|
1044
2359
|
if (directTransfer || state.type !== "processing") return;
|
|
1045
2360
|
const updateElapsed = () => {
|
|
@@ -1064,13 +2379,13 @@ function ProcessingStep({
|
|
|
1064
2379
|
updatePhaseTimings(
|
|
1065
2380
|
(previous) => syncPhaseTimings(previous, state.lastEvent)
|
|
1066
2381
|
);
|
|
1067
|
-
}, [_optionalChain([state, 'access',
|
|
2382
|
+
}, [_optionalChain([state, 'access', _143 => _143.lastEvent, 'optionalAccess', _144 => _144.time]), _optionalChain([state, 'access', _145 => _145.lastEvent, 'optionalAccess', _146 => _146.type]), updatePhaseTimings]);
|
|
1068
2383
|
const [swappedFiatContext, setSwappedFiatContext] = _react.useState.call(void 0, null);
|
|
1069
2384
|
_react.useEffect.call(void 0, () => {
|
|
1070
2385
|
let cancelled = false;
|
|
1071
2386
|
let timeoutId;
|
|
1072
|
-
const isFiatSwappedOrder = isSwappedOrder && _optionalChain([swappedContext, 'optionalAccess',
|
|
1073
|
-
const expectedOrderUuid = _nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess',
|
|
2387
|
+
const isFiatSwappedOrder = isSwappedOrder && _optionalChain([swappedContext, 'optionalAccess', _147 => _147.variant]) === "fiat";
|
|
2388
|
+
const expectedOrderUuid = _nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess', _148 => _148.expectedOrderUuid]), () => ( null));
|
|
1074
2389
|
setSwappedFiatContext(null);
|
|
1075
2390
|
if (isFiatSwappedOrder && !expectedOrderUuid) {
|
|
1076
2391
|
return () => {
|
|
@@ -1106,7 +2421,7 @@ function ProcessingStep({
|
|
|
1106
2421
|
if (isFiatSwappedOrder && !hasFiatReceiptPricing(res)) {
|
|
1107
2422
|
scheduleRetry();
|
|
1108
2423
|
}
|
|
1109
|
-
} catch (
|
|
2424
|
+
} catch (e6) {
|
|
1110
2425
|
scheduleRetry();
|
|
1111
2426
|
}
|
|
1112
2427
|
}
|
|
@@ -1120,8 +2435,8 @@ function ProcessingStep({
|
|
|
1120
2435
|
smartAccount,
|
|
1121
2436
|
txHash,
|
|
1122
2437
|
isSwappedOrder,
|
|
1123
|
-
_optionalChain([swappedContext, 'optionalAccess',
|
|
1124
|
-
_optionalChain([swappedContext, 'optionalAccess',
|
|
2438
|
+
_optionalChain([swappedContext, 'optionalAccess', _149 => _149.variant]),
|
|
2439
|
+
_optionalChain([swappedContext, 'optionalAccess', _150 => _150.expectedOrderUuid])
|
|
1125
2440
|
]);
|
|
1126
2441
|
_react.useEffect.call(void 0, () => {
|
|
1127
2442
|
if (directTransfer) return;
|
|
@@ -1133,7 +2448,7 @@ function ProcessingStep({
|
|
|
1133
2448
|
async function pollStatus() {
|
|
1134
2449
|
try {
|
|
1135
2450
|
const account = sourceChain === "solana" && solanaDepositAddress ? solanaDepositAddress : smartAccount;
|
|
1136
|
-
|
|
2451
|
+
_chunk3OOY67VJcjs.debugLog.call(void 0, debug, "processing", "poll:request", {
|
|
1137
2452
|
account,
|
|
1138
2453
|
txHash,
|
|
1139
2454
|
intervalMs: pollIntervalRef.current
|
|
@@ -1144,28 +2459,28 @@ function ProcessingStep({
|
|
|
1144
2459
|
const eventForCurrentTx = eventMatchesTx ? lastEvent2 : void 0;
|
|
1145
2460
|
if (lastEvent2) {
|
|
1146
2461
|
const eventData = lastEvent2.data;
|
|
1147
|
-
|
|
2462
|
+
_chunk3OOY67VJcjs.debugLog.call(void 0, debug, "processing", "poll:event", {
|
|
1148
2463
|
type: lastEvent2.type,
|
|
1149
2464
|
matchesTx: eventMatchesTx,
|
|
1150
|
-
intentId: _optionalChain([eventData, 'optionalAccess',
|
|
2465
|
+
intentId: _optionalChain([eventData, 'optionalAccess', _151 => _151.intentId])
|
|
1151
2466
|
});
|
|
1152
2467
|
}
|
|
1153
2468
|
if (!isMounted) return;
|
|
1154
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
2469
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _152 => _152.type]) === "bridge-complete") {
|
|
1155
2470
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
1156
2471
|
const sourceTxHash2 = getSettledSourceTxHash(
|
|
1157
2472
|
eventForCurrentTx,
|
|
1158
2473
|
txHash
|
|
1159
2474
|
);
|
|
1160
|
-
const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access',
|
|
1161
|
-
|
|
2475
|
+
const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access', _153 => _153.data, 'optionalAccess', _154 => _154.destination, 'optionalAccess', _155 => _155.transactionHash]);
|
|
2476
|
+
_chunk3OOY67VJcjs.debugLog.call(void 0, debug, "processing", "state:complete", {
|
|
1162
2477
|
txHash,
|
|
1163
2478
|
sourceTxHash: sourceTxHash2,
|
|
1164
2479
|
destinationTxHash: destinationTxHash2,
|
|
1165
2480
|
event: eventForCurrentTx.type
|
|
1166
2481
|
});
|
|
1167
2482
|
const context = processingContextRef.current;
|
|
1168
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
2483
|
+
_optionalChain([onDepositCompleteRef, 'access', _156 => _156.current, 'optionalCall', _157 => _157(sourceTxHash2, destinationTxHash2, {
|
|
1169
2484
|
amount: context.amount,
|
|
1170
2485
|
sourceChain: context.sourceChain,
|
|
1171
2486
|
sourceToken: context.sourceToken,
|
|
@@ -1176,33 +2491,33 @@ function ProcessingStep({
|
|
|
1176
2491
|
})]);
|
|
1177
2492
|
return;
|
|
1178
2493
|
}
|
|
1179
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
2494
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _158 => _158.type]) === "bridge-failed") {
|
|
1180
2495
|
const formatted = formatBridgeFailedMessage(eventForCurrentTx);
|
|
1181
2496
|
setState({
|
|
1182
2497
|
type: "failed",
|
|
1183
2498
|
message: formatted.message,
|
|
1184
2499
|
lastEvent: eventForCurrentTx
|
|
1185
2500
|
});
|
|
1186
|
-
|
|
2501
|
+
_chunk3OOY67VJcjs.debugLog.call(void 0, debug, "processing", "state:failed", {
|
|
1187
2502
|
txHash,
|
|
1188
2503
|
message: formatted.message,
|
|
1189
2504
|
code: formatted.code
|
|
1190
2505
|
});
|
|
1191
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
2506
|
+
_optionalChain([onDepositFailedRef, 'access', _159 => _159.current, 'optionalCall', _160 => _160(txHash, formatted.message)]);
|
|
1192
2507
|
return;
|
|
1193
2508
|
}
|
|
1194
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1195
|
-
const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access',
|
|
2509
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _161 => _161.type]) === "error") {
|
|
2510
|
+
const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access', _162 => _162.data, 'optionalAccess', _163 => _163.message]), () => ( "Unknown error"));
|
|
1196
2511
|
setState({
|
|
1197
2512
|
type: "failed",
|
|
1198
2513
|
message: errorMessage,
|
|
1199
2514
|
lastEvent: eventForCurrentTx
|
|
1200
2515
|
});
|
|
1201
|
-
|
|
2516
|
+
_chunk3OOY67VJcjs.debugLog.call(void 0, debug, "processing", "state:error-event", {
|
|
1202
2517
|
txHash,
|
|
1203
2518
|
message: errorMessage
|
|
1204
2519
|
});
|
|
1205
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
2520
|
+
_optionalChain([onDepositFailedRef, 'access', _164 => _164.current, 'optionalCall', _165 => _165(txHash, errorMessage)]);
|
|
1206
2521
|
return;
|
|
1207
2522
|
}
|
|
1208
2523
|
setState((previous) => ({
|
|
@@ -1211,7 +2526,7 @@ function ProcessingStep({
|
|
|
1211
2526
|
}));
|
|
1212
2527
|
scheduleNextPoll();
|
|
1213
2528
|
} catch (error) {
|
|
1214
|
-
|
|
2529
|
+
_chunk3OOY67VJcjs.debugError.call(void 0, debug, "processing", "poll:failure", error, {
|
|
1215
2530
|
smartAccount,
|
|
1216
2531
|
txHash,
|
|
1217
2532
|
intervalMs: pollIntervalRef.current
|
|
@@ -1226,7 +2541,7 @@ function ProcessingStep({
|
|
|
1226
2541
|
pollIntervalRef.current * BACKOFF_MULTIPLIER,
|
|
1227
2542
|
MAX_POLL_INTERVAL
|
|
1228
2543
|
);
|
|
1229
|
-
|
|
2544
|
+
_chunk3OOY67VJcjs.debugLog.call(void 0, debug, "processing", "poll:scheduled", {
|
|
1230
2545
|
nextIntervalMs: pollIntervalRef.current
|
|
1231
2546
|
});
|
|
1232
2547
|
pollStatus();
|
|
@@ -1259,11 +2574,11 @@ function ProcessingStep({
|
|
|
1259
2574
|
escalatedDelayRef.current = true;
|
|
1260
2575
|
setHasEscalatedDelay(true);
|
|
1261
2576
|
const message = "Transfer is taking longer than expected. Your funds are safe and processing will continue automatically.";
|
|
1262
|
-
|
|
2577
|
+
_chunk3OOY67VJcjs.debugLog.call(void 0, debug, "processing", "state:delay-escalated", {
|
|
1263
2578
|
txHash,
|
|
1264
2579
|
timeoutMs: ESCALATED_DELAY_MS
|
|
1265
2580
|
});
|
|
1266
|
-
_optionalChain([onErrorRef, 'access',
|
|
2581
|
+
_optionalChain([onErrorRef, 'access', _166 => _166.current, 'optionalCall', _167 => _167(message, "PROCESS_TIMEOUT")]);
|
|
1267
2582
|
}, ESCALATED_DELAY_MS);
|
|
1268
2583
|
return () => clearTimeout(timeoutId);
|
|
1269
2584
|
}, [debug, directTransfer, onErrorRef, state.type, txHash]);
|
|
@@ -1275,24 +2590,24 @@ function ProcessingStep({
|
|
|
1275
2590
|
const timelineNowMs = _nullishCoalesce(phaseTimings.endedAt, () => ( Date.now()));
|
|
1276
2591
|
const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
|
|
1277
2592
|
const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
|
|
1278
|
-
const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess',
|
|
2593
|
+
const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess', _168 => _168.data, 'optionalAccess', _169 => _169.destination, 'optionalAccess', _170 => _170.transactionHash]) || null;
|
|
1279
2594
|
const sourceTxHash = getSettledSourceTxHash(lastEvent, txHash);
|
|
1280
2595
|
const sourceDetails = getEventSourceDetails(lastEvent);
|
|
1281
2596
|
const displaySourceChain = _nullishCoalesce(sourceDetails.chainId, () => ( sourceChain));
|
|
1282
2597
|
const displaySourceToken = _nullishCoalesce(sourceDetails.token, () => ( sourceToken));
|
|
1283
2598
|
const displayAmount = _nullishCoalesce(sourceDetails.amount, () => ( amount));
|
|
1284
|
-
const targetChainId =
|
|
1285
|
-
const settledSourceTxHash = _optionalChain([lastEvent, 'optionalAccess',
|
|
2599
|
+
const targetChainId = _chunkOY5N3E6Lcjs.targetChainToChainId.call(void 0, targetChain);
|
|
2600
|
+
const settledSourceTxHash = _optionalChain([lastEvent, 'optionalAccess', _171 => _171.data, 'optionalAccess', _172 => _172.source, 'optionalAccess', _173 => _173.transactionHash]);
|
|
1286
2601
|
const sourceExplorerHash = _nullishCoalesce(settledSourceTxHash, () => ( (sourceTxHashPending ? null : sourceTxHash)));
|
|
1287
2602
|
_react.useEffect.call(void 0, () => {
|
|
1288
2603
|
if (sourceTxHashPending && settledSourceTxHash) {
|
|
1289
|
-
_optionalChain([onSourceTransactionObserved, 'optionalCall',
|
|
2604
|
+
_optionalChain([onSourceTransactionObserved, 'optionalCall', _174 => _174(settledSourceTxHash)]);
|
|
1290
2605
|
}
|
|
1291
2606
|
}, [onSourceTransactionObserved, settledSourceTxHash, sourceTxHashPending]);
|
|
1292
2607
|
const sourceExplorerUrl = sourceExplorerHash ? explorerTxUrl(displaySourceChain, sourceExplorerHash) : null;
|
|
1293
2608
|
const destExplorerUrl = destinationTxHash ? explorerTxUrl(targetChainId, destinationTxHash) : null;
|
|
1294
2609
|
const sourceDisplay = (() => {
|
|
1295
|
-
const resolved =
|
|
2610
|
+
const resolved = _chunk3OOY67VJcjs.resolveTokenDisplay.call(void 0, displaySourceToken, displaySourceChain, {
|
|
1296
2611
|
symbol: _nullishCoalesce(providedSourceSymbol, () => ( (displaySourceChain === "solana" ? "SOL" : "Token"))),
|
|
1297
2612
|
decimals: providedSourceDecimals
|
|
1298
2613
|
});
|
|
@@ -1302,10 +2617,10 @@ function ProcessingStep({
|
|
|
1302
2617
|
};
|
|
1303
2618
|
})();
|
|
1304
2619
|
const sourceSymbol = sourceDisplay.symbol;
|
|
1305
|
-
const formattedSentAmount = _nullishCoalesce(_nullishCoalesce(
|
|
1306
|
-
|
|
2620
|
+
const formattedSentAmount = _nullishCoalesce(_nullishCoalesce(_chunk3OOY67VJcjs.formatRawTokenAmount.call(void 0, displayAmount, sourceDisplay), () => ( // Not raw base units (e.g. a decimal string) — render the number as-is.
|
|
2621
|
+
_chunk3OOY67VJcjs.formatTokenAmount.call(void 0, Number(displayAmount), sourceDisplay.symbol))), () => ( displayAmount));
|
|
1307
2622
|
const eventDestination = getEventDestinationDetails(lastEvent);
|
|
1308
|
-
const targetDisplay =
|
|
2623
|
+
const targetDisplay = _chunk3OOY67VJcjs.resolveTokenDisplay.call(void 0,
|
|
1309
2624
|
_nullishCoalesce(eventDestination.token, () => ( targetToken)),
|
|
1310
2625
|
_nullishCoalesce(eventDestination.chainId, () => ( targetChainId)),
|
|
1311
2626
|
// Dapp deposits default to USDC targets; mirror the source symbol last so
|
|
@@ -1313,7 +2628,7 @@ function ProcessingStep({
|
|
|
1313
2628
|
{ symbol: _nullishCoalesce(providedSourceSymbol, () => ( "USDC")) }
|
|
1314
2629
|
);
|
|
1315
2630
|
const targetSymbol = targetDisplay.symbol;
|
|
1316
|
-
const formattedDestinationAmount = eventDestination.amount !== void 0 ?
|
|
2631
|
+
const formattedDestinationAmount = eventDestination.amount !== void 0 ? _chunk3OOY67VJcjs.formatRawTokenAmount.call(void 0, eventDestination.amount, targetDisplay) : void 0;
|
|
1317
2632
|
const amountUsdNumber = amountUsd !== void 0 && Number(amountUsd) > 0 ? Number(amountUsd) : void 0;
|
|
1318
2633
|
const prices = useTokenPrices(service, [
|
|
1319
2634
|
{
|
|
@@ -1328,17 +2643,17 @@ function ProcessingStep({
|
|
|
1328
2643
|
}
|
|
1329
2644
|
]);
|
|
1330
2645
|
const estimatedReceiveAmount = (() => {
|
|
1331
|
-
const estimate =
|
|
1332
|
-
sourceAmount:
|
|
2646
|
+
const estimate = _chunk3OOY67VJcjs.estimateReceiveAmount.call(void 0, {
|
|
2647
|
+
sourceAmount: _chunk3OOY67VJcjs.tokenAmountToNumber.call(void 0, displayAmount, sourceDisplay.decimals),
|
|
1333
2648
|
sourceSymbol: sourceDisplay.symbol,
|
|
1334
2649
|
targetSymbol: targetDisplay.symbol,
|
|
1335
2650
|
sourceAmountUsd: amountUsdNumber,
|
|
1336
|
-
sourceTrusted:
|
|
2651
|
+
sourceTrusted: _chunk3OOY67VJcjs.isRecognizedToken.call(void 0, displaySourceToken, displaySourceChain),
|
|
1337
2652
|
prices
|
|
1338
2653
|
});
|
|
1339
|
-
return estimate !== void 0 ?
|
|
2654
|
+
return estimate !== void 0 ? _chunk3OOY67VJcjs.formatTokenAmount.call(void 0, estimate, targetDisplay.symbol) : void 0;
|
|
1340
2655
|
})();
|
|
1341
|
-
const quotedReceive = quote ?
|
|
2656
|
+
const quotedReceive = quote ? _chunk3OOY67VJcjs.formatQuotedReceive.call(void 0, quote.output, targetSymbol) : void 0;
|
|
1342
2657
|
const receiveDisplay = formattedDestinationAmount ? (
|
|
1343
2658
|
// The delivered amount, once the bridge reports it — actual, not an
|
|
1344
2659
|
// estimate, so it wins over the quote and carries no "~".
|
|
@@ -1352,12 +2667,12 @@ function ProcessingStep({
|
|
|
1352
2667
|
if (sourceSymbol.toUpperCase() !== targetSymbol.toUpperCase()) {
|
|
1353
2668
|
return void 0;
|
|
1354
2669
|
}
|
|
1355
|
-
const sentValue =
|
|
1356
|
-
const receivedValue = eventDestination.amount !== void 0 ?
|
|
2670
|
+
const sentValue = _chunk3OOY67VJcjs.tokenAmountToNumber.call(void 0, displayAmount, sourceDisplay.decimals);
|
|
2671
|
+
const receivedValue = eventDestination.amount !== void 0 ? _chunk3OOY67VJcjs.tokenAmountToNumber.call(void 0, eventDestination.amount, targetDisplay.decimals) : void 0;
|
|
1357
2672
|
if (sentValue === void 0 || receivedValue === void 0 || sentValue <= receivedValue) {
|
|
1358
2673
|
return void 0;
|
|
1359
2674
|
}
|
|
1360
|
-
const formatted =
|
|
2675
|
+
const formatted = _chunk3OOY67VJcjs.formatTokenAmount.call(void 0, sentValue - receivedValue, sourceSymbol);
|
|
1361
2676
|
if (formatted === void 0 || Number(formatted.replace(/,/g, "")) === 0) {
|
|
1362
2677
|
return void 0;
|
|
1363
2678
|
}
|
|
@@ -1369,13 +2684,13 @@ function ProcessingStep({
|
|
|
1369
2684
|
const delayPhaseId = isProcessing && currentPhaseId && activePhaseElapsedMs >= SOFT_DELAY_MS[currentPhaseId] ? currentPhaseId : void 0;
|
|
1370
2685
|
void delayPhaseId;
|
|
1371
2686
|
void hasEscalatedDelay;
|
|
1372
|
-
const sourceChainIcon =
|
|
1373
|
-
const targetChainIcon =
|
|
1374
|
-
const sourceChainName =
|
|
1375
|
-
const targetChainName =
|
|
2687
|
+
const sourceChainIcon = _chunkOY5N3E6Lcjs.getChainIcon.call(void 0, displaySourceChain);
|
|
2688
|
+
const targetChainIcon = _chunkOY5N3E6Lcjs.getChainIcon.call(void 0, targetChainId);
|
|
2689
|
+
const sourceChainName = _chunkOY5N3E6Lcjs.getChainName.call(void 0, displaySourceChain);
|
|
2690
|
+
const targetChainName = _chunkOY5N3E6Lcjs.getChainName.call(void 0, targetChainId);
|
|
1376
2691
|
const timerText = formatTimer(elapsedSeconds);
|
|
1377
|
-
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1378
|
-
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2692
|
+
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _175 => _175.feeSponsored]), () => ( false));
|
|
2693
|
+
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _176 => _176.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
|
|
1379
2694
|
const stateTitle = isComplete ? `${flowCapitalized} successful` : isFailed ? `${flowCapitalized} failed` : "Processing...";
|
|
1380
2695
|
const handleRetry = _nullishCoalesce(onRetry, () => ( onNewDeposit));
|
|
1381
2696
|
const headerContent = isComplete ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header", children: [
|
|
@@ -1384,29 +2699,29 @@ function ProcessingStep({
|
|
|
1384
2699
|
] }) : isFailed ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header", children: [
|
|
1385
2700
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, FailedBadge, {}),
|
|
1386
2701
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-body-header-text", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "rs-body-header-title", children: stateTitle }) })
|
|
1387
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2702
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.WalletIcon, {}), title: stateTitle });
|
|
1388
2703
|
if (isComplete && isSwappedOrder) {
|
|
1389
|
-
const effectivePaymentMethod = _nullishCoalesce(_nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess',
|
|
2704
|
+
const effectivePaymentMethod = _nullishCoalesce(_nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess', _177 => _177.method]), () => ( _optionalChain([swappedFiatContext, 'optionalAccess', _178 => _178.paymentMethod]))), () => ( null));
|
|
1390
2705
|
const onrampMethod = effectivePaymentMethod ? formatPaymentMethod(effectivePaymentMethod) : null;
|
|
1391
|
-
const onrampMethodIcon = _optionalChain([swappedContext, 'optionalAccess',
|
|
2706
|
+
const onrampMethodIcon = _optionalChain([swappedContext, 'optionalAccess', _179 => _179.variant]) === "connect" && effectivePaymentMethod ? getExchangeLogoSrc(
|
|
1392
2707
|
_nullishCoalesce(onrampMethod, () => ( effectivePaymentMethod)),
|
|
1393
2708
|
effectivePaymentMethod
|
|
1394
2709
|
) : null;
|
|
1395
|
-
const connectPaidAmount = _optionalChain([swappedContext, 'optionalAccess',
|
|
1396
|
-
const amountPaid = _nullishCoalesce(connectPaidAmount, () => ( (_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
2710
|
+
const connectPaidAmount = _optionalChain([swappedContext, 'optionalAccess', _180 => _180.variant]) === "connect" ? `${formattedSentAmount} ${sourceSymbol}` : null;
|
|
2711
|
+
const amountPaid = _nullishCoalesce(connectPaidAmount, () => ( (_optionalChain([swappedFiatContext, 'optionalAccess', _181 => _181.paidAmountUsd]) != null ? `$${swappedFiatContext.paidAmountUsd.toFixed(2)}` : null)));
|
|
1397
2712
|
const depositedAmount = receiveDisplay;
|
|
1398
|
-
const onrampFeeUsd = _nullishCoalesce(_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
2713
|
+
const onrampFeeUsd = _nullishCoalesce(_optionalChain([swappedFiatContext, 'optionalAccess', _182 => _182.onrampFeeUsd]), () => ( null));
|
|
1399
2714
|
const sponsoredFeeTooltip = "This fee is sponsored for this deposit.";
|
|
1400
2715
|
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.";
|
|
1401
2716
|
const { rows: quoteFeeRows, chargeableUsd } = buildQuoteFeeRows(
|
|
1402
|
-
_optionalChain([quote, 'optionalAccess',
|
|
2717
|
+
_optionalChain([quote, 'optionalAccess', _183 => _183.fees, 'access', _184 => _184.breakdown]),
|
|
1403
2718
|
sponsoredFeeTooltip
|
|
1404
2719
|
);
|
|
1405
2720
|
const feeRows = [];
|
|
1406
2721
|
if (onrampFeeUsd != null) {
|
|
1407
2722
|
feeRows.push({
|
|
1408
2723
|
label: "On-ramp fee",
|
|
1409
|
-
value:
|
|
2724
|
+
value: _chunk3OOY67VJcjs.formatFeeUsd.call(void 0, onrampFeeUsd)
|
|
1410
2725
|
});
|
|
1411
2726
|
}
|
|
1412
2727
|
const hasFallbackFee = quoteFeeRows.length === 0 && quotedFeeAmount !== void 0 && Number.isFinite(Number(quotedFeeAmount));
|
|
@@ -1415,13 +2730,13 @@ function ProcessingStep({
|
|
|
1415
2730
|
} else if (hasFallbackFee) {
|
|
1416
2731
|
feeRows.push({
|
|
1417
2732
|
label: "Network fee",
|
|
1418
|
-
value:
|
|
2733
|
+
value: _chunk3OOY67VJcjs.formatFeeUsd.call(void 0, Number(quotedFeeAmount)),
|
|
1419
2734
|
strike: feeSponsored,
|
|
1420
2735
|
tooltip: feeSponsored ? sponsoredFeeTooltip : void 0
|
|
1421
2736
|
});
|
|
1422
2737
|
}
|
|
1423
2738
|
const fallbackChargeableUsd = hasFallbackFee && !feeSponsored ? Number(quotedFeeAmount) : 0;
|
|
1424
|
-
const feesTotal = feeRows.length > 0 ?
|
|
2739
|
+
const feesTotal = feeRows.length > 0 ? _chunk3OOY67VJcjs.formatFeeUsd.call(void 0,
|
|
1425
2740
|
(_nullishCoalesce(onrampFeeUsd, () => ( 0))) + chargeableUsd + fallbackChargeableUsd
|
|
1426
2741
|
) : null;
|
|
1427
2742
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1449,7 +2764,7 @@ function ProcessingStep({
|
|
|
1449
2764
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
1450
2765
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
1451
2766
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceChainName }),
|
|
1452
|
-
sourceChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2767
|
+
sourceChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.CdnIcon, { src: sourceChainIcon }) }),
|
|
1453
2768
|
sourceExplorerUrl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1454
2769
|
"a",
|
|
1455
2770
|
{
|
|
@@ -1458,7 +2773,7 @@ function ProcessingStep({
|
|
|
1458
2773
|
rel: "noopener noreferrer",
|
|
1459
2774
|
className: "rs-review-detail-link",
|
|
1460
2775
|
"aria-label": "View source transaction",
|
|
1461
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2776
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.ExternalLinkIcon, {})
|
|
1462
2777
|
}
|
|
1463
2778
|
)
|
|
1464
2779
|
] })
|
|
@@ -1467,7 +2782,7 @@ function ProcessingStep({
|
|
|
1467
2782
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Destination chain" }),
|
|
1468
2783
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
1469
2784
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetChainName }),
|
|
1470
|
-
targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2785
|
+
targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.CdnIcon, { src: targetChainIcon }) }),
|
|
1471
2786
|
destExplorerUrl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1472
2787
|
"a",
|
|
1473
2788
|
{
|
|
@@ -1476,7 +2791,7 @@ function ProcessingStep({
|
|
|
1476
2791
|
rel: "noopener noreferrer",
|
|
1477
2792
|
className: "rs-review-detail-link",
|
|
1478
2793
|
"aria-label": "View destination transaction",
|
|
1479
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2794
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.ExternalLinkIcon, {})
|
|
1480
2795
|
}
|
|
1481
2796
|
)
|
|
1482
2797
|
] })
|
|
@@ -1486,7 +2801,7 @@ function ProcessingStep({
|
|
|
1486
2801
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Ticker, { value: timerText }) })
|
|
1487
2802
|
] }),
|
|
1488
2803
|
isSwappedOrder ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1489
|
-
_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
2804
|
+
_optionalChain([swappedFiatContext, 'optionalAccess', _185 => _185.paidAmountUsd]) != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
1490
2805
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "You pay" }),
|
|
1491
2806
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
1492
2807
|
"$",
|
|
@@ -1498,7 +2813,7 @@ function ProcessingStep({
|
|
|
1498
2813
|
] })
|
|
1499
2814
|
] })
|
|
1500
2815
|
] }),
|
|
1501
|
-
_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
2816
|
+
_optionalChain([swappedFiatContext, 'optionalAccess', _186 => _186.onrampFeeUsd]) != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
1502
2817
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "On-ramp fee" }),
|
|
1503
2818
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
1504
2819
|
"$",
|
|
@@ -1513,7 +2828,7 @@ function ProcessingStep({
|
|
|
1513
2828
|
" ",
|
|
1514
2829
|
sourceSymbol
|
|
1515
2830
|
] }),
|
|
1516
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2831
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.TokenIcon, { symbol: sourceSymbol }) })
|
|
1517
2832
|
] })
|
|
1518
2833
|
] })
|
|
1519
2834
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -1524,14 +2839,14 @@ function ProcessingStep({
|
|
|
1524
2839
|
" ",
|
|
1525
2840
|
sourceSymbol
|
|
1526
2841
|
] }),
|
|
1527
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2842
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.TokenIcon, { symbol: sourceSymbol }) })
|
|
1528
2843
|
] })
|
|
1529
2844
|
] }),
|
|
1530
2845
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
1531
2846
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: isProcessing ? "Receive" : "Received" }),
|
|
1532
2847
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
1533
2848
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: receiveDisplay }),
|
|
1534
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2849
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.TokenIcon, { symbol: targetSymbol }) })
|
|
1535
2850
|
] })
|
|
1536
2851
|
] }),
|
|
1537
2852
|
isFailed && balanceAfterUsd !== void 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -1560,12 +2875,12 @@ function ProcessingStep({
|
|
|
1560
2875
|
{
|
|
1561
2876
|
className: "rs-review-detail-info",
|
|
1562
2877
|
"aria-label": "Fee info",
|
|
1563
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2878
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.InfoIcon, {})
|
|
1564
2879
|
}
|
|
1565
2880
|
) })
|
|
1566
2881
|
] })
|
|
1567
2882
|
] }) : (() => {
|
|
1568
|
-
const { display, struck } =
|
|
2883
|
+
const { display, struck } = _chunk3OOY67VJcjs.quoteFeeRow.call(void 0, _optionalChain([quote, 'optionalAccess', _187 => _187.fees]));
|
|
1569
2884
|
if (display !== null) {
|
|
1570
2885
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
1571
2886
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fees" }),
|
|
@@ -1596,9 +2911,9 @@ function ProcessingStep({
|
|
|
1596
2911
|
] });
|
|
1597
2912
|
})()
|
|
1598
2913
|
] }),
|
|
1599
|
-
isFailed && failureMessage && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2914
|
+
isFailed && failureMessage && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.Callout, { variant: "error", children: failureMessage }),
|
|
1600
2915
|
isProcessing && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1601
|
-
|
|
2916
|
+
_chunk3OOY67VJcjs.Button,
|
|
1602
2917
|
{
|
|
1603
2918
|
fullWidth: true,
|
|
1604
2919
|
disabled: true,
|
|
@@ -1608,15 +2923,15 @@ function ProcessingStep({
|
|
|
1608
2923
|
}
|
|
1609
2924
|
),
|
|
1610
2925
|
isComplete && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-button-row", children: [
|
|
1611
|
-
onNewDeposit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2926
|
+
onNewDeposit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk3OOY67VJcjs.Button, { variant: "outline", onClick: onNewDeposit, fullWidth: true, children: [
|
|
1612
2927
|
"New ",
|
|
1613
2928
|
flowNoun
|
|
1614
2929
|
] }),
|
|
1615
|
-
onClose && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2930
|
+
onClose && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.Button, { onClick: () => onClose("success_done"), fullWidth: true, children: "Done" })
|
|
1616
2931
|
] }),
|
|
1617
2932
|
isFailed && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-button-row", children: [
|
|
1618
2933
|
onClose && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1619
|
-
|
|
2934
|
+
_chunk3OOY67VJcjs.Button,
|
|
1620
2935
|
{
|
|
1621
2936
|
variant: "outline",
|
|
1622
2937
|
onClick: () => onClose("failure_cancel"),
|
|
@@ -1624,10 +2939,10 @@ function ProcessingStep({
|
|
|
1624
2939
|
children: "Cancel"
|
|
1625
2940
|
}
|
|
1626
2941
|
),
|
|
1627
|
-
handleRetry && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2942
|
+
handleRetry && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.Button, { onClick: handleRetry, fullWidth: true, children: "Try again" })
|
|
1628
2943
|
] })
|
|
1629
2944
|
] }),
|
|
1630
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2945
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3OOY67VJcjs.PoweredBy, {})
|
|
1631
2946
|
] });
|
|
1632
2947
|
}
|
|
1633
2948
|
|
|
@@ -1656,15 +2971,28 @@ function normalizeKeyToken(value) {
|
|
|
1656
2971
|
if (value === void 0) return void 0;
|
|
1657
2972
|
return value.startsWith("0x") ? value.toLowerCase() : value;
|
|
1658
2973
|
}
|
|
1659
|
-
var
|
|
2974
|
+
var RECIPIENT_PATTERNS = {
|
|
2975
|
+
solana: /^[1-9A-HJ-NP-Za-km-z]{32,44}$/,
|
|
2976
|
+
tron: /^T[1-9A-HJ-NP-Za-km-z]{33}$/,
|
|
2977
|
+
stellar: /^G[A-Z2-7]{55}$/
|
|
2978
|
+
};
|
|
2979
|
+
var RECIPIENT_HINTS = {
|
|
2980
|
+
solana: "A Solana destination needs a base58 recipient address.",
|
|
2981
|
+
tron: "A Tron destination needs a base58 recipient address starting with T.",
|
|
2982
|
+
stellar: "A Stellar destination needs a recipient account ID starting with G."
|
|
2983
|
+
};
|
|
2984
|
+
function recipientNamespace(targetChain) {
|
|
2985
|
+
return _nullishCoalesce(_chunkOY5N3E6Lcjs.targetChainToCaip2.call(void 0, targetChain).split(":")[0], () => ( ""));
|
|
2986
|
+
}
|
|
1660
2987
|
function recipientMatchesTarget(recipient, targetChain) {
|
|
1661
|
-
|
|
2988
|
+
const pattern = RECIPIENT_PATTERNS[recipientNamespace(targetChain)];
|
|
2989
|
+
return pattern ? pattern.test(recipient) : _viem.isAddress.call(void 0, recipient);
|
|
1662
2990
|
}
|
|
1663
2991
|
function deriveAccountSalt(input) {
|
|
1664
2992
|
return _viem.keccak256.call(void 0,
|
|
1665
2993
|
_viem.concat.call(void 0, [
|
|
1666
2994
|
_viem.keccak256.call(void 0, _viem.toHex.call(void 0, _nullishCoalesce(normalizeKeyToken(input.recipient), () => ( "")))),
|
|
1667
|
-
_viem.keccak256.call(void 0, _viem.toHex.call(void 0,
|
|
2995
|
+
_viem.keccak256.call(void 0, _viem.toHex.call(void 0, _chunkOY5N3E6Lcjs.targetChainToCaip2.call(void 0, input.targetChain))),
|
|
1668
2996
|
_viem.keccak256.call(void 0, _viem.toHex.call(void 0, _nullishCoalesce(normalizeKeyToken(input.targetToken), () => ( ""))))
|
|
1669
2997
|
])
|
|
1670
2998
|
);
|
|
@@ -1696,7 +3024,7 @@ var setupRequestDedupe = /* @__PURE__ */ new Map();
|
|
|
1696
3024
|
function readDedupedAccountSetupResult(requestKey) {
|
|
1697
3025
|
const now = Date.now();
|
|
1698
3026
|
const existing = setupRequestDedupe.get(requestKey);
|
|
1699
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
3027
|
+
if (_optionalChain([existing, 'optionalAccess', _188 => _188.settled]) && existing.expiresAt > now && existing.result) {
|
|
1700
3028
|
return existing.result;
|
|
1701
3029
|
}
|
|
1702
3030
|
return null;
|
|
@@ -1712,13 +3040,13 @@ async function runAccountSetup(input, deps) {
|
|
|
1712
3040
|
}
|
|
1713
3041
|
if (!recipientMatchesTarget(input.recipient, input.targetChain)) {
|
|
1714
3042
|
throw new SetupError(
|
|
1715
|
-
input.targetChain
|
|
3043
|
+
_nullishCoalesce(RECIPIENT_HINTS[recipientNamespace(input.targetChain)], () => ( "An EVM destination needs a 0x recipient address.")),
|
|
1716
3044
|
"client"
|
|
1717
3045
|
);
|
|
1718
3046
|
}
|
|
1719
3047
|
try {
|
|
1720
3048
|
const salt = deriveAccountSalt(input);
|
|
1721
|
-
|
|
3049
|
+
_chunk3OOY67VJcjs.debugLog.call(void 0, debug, "account-setup", "setup:start", {
|
|
1722
3050
|
salt,
|
|
1723
3051
|
recipient: input.recipient,
|
|
1724
3052
|
targetChain: input.targetChain,
|
|
@@ -1727,10 +3055,10 @@ async function runAccountSetup(input, deps) {
|
|
|
1727
3055
|
const result = await service.registerManagedAccount({
|
|
1728
3056
|
salt,
|
|
1729
3057
|
target: {
|
|
1730
|
-
chain:
|
|
3058
|
+
chain: _chunkOY5N3E6Lcjs.targetChainToCaip2.call(void 0, input.targetChain),
|
|
1731
3059
|
token: input.targetToken,
|
|
1732
3060
|
recipient: input.recipient,
|
|
1733
|
-
..._optionalChain([input, 'access',
|
|
3061
|
+
..._optionalChain([input, 'access', _189 => _189.outputTokenRules, 'optionalAccess', _190 => _190.length]) && {
|
|
1734
3062
|
outputTokenRules: input.outputTokenRules
|
|
1735
3063
|
},
|
|
1736
3064
|
...input.rejectUnmapped != null && {
|
|
@@ -1744,7 +3072,7 @@ async function runAccountSetup(input, deps) {
|
|
|
1744
3072
|
cacheKey
|
|
1745
3073
|
};
|
|
1746
3074
|
} catch (error) {
|
|
1747
|
-
|
|
3075
|
+
_chunk3OOY67VJcjs.debugError.call(void 0, debug, "account-setup", "setup:failed", error, {
|
|
1748
3076
|
recipient: input.recipient
|
|
1749
3077
|
});
|
|
1750
3078
|
if (error instanceof SetupError) throw error;
|
|
@@ -1755,7 +3083,7 @@ function runAccountSetupDeduped(input, deps, requestKey) {
|
|
|
1755
3083
|
const now = Date.now();
|
|
1756
3084
|
const existing = setupRequestDedupe.get(requestKey);
|
|
1757
3085
|
if (existing && (!existing.settled || existing.expiresAt > now)) {
|
|
1758
|
-
|
|
3086
|
+
_chunk3OOY67VJcjs.debugLog.call(void 0, deps.debug, "account-setup", "setup:dedupe-hit", {
|
|
1759
3087
|
recipient: input.recipient,
|
|
1760
3088
|
forceRegister: _nullishCoalesce(input.forceRegister, () => ( false))
|
|
1761
3089
|
});
|
|
@@ -1794,22 +3122,14 @@ function mapError(error) {
|
|
|
1794
3122
|
"network"
|
|
1795
3123
|
);
|
|
1796
3124
|
}
|
|
1797
|
-
if (error instanceof
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
"Deposit service is temporarily unavailable. Please try again shortly.",
|
|
1804
|
-
"server"
|
|
1805
|
-
);
|
|
1806
|
-
}
|
|
1807
|
-
return new SetupError(error.message, "client");
|
|
3125
|
+
if (error instanceof _chunk3OOY67VJcjs.RegistrationError) {
|
|
3126
|
+
if (error.status >= 500) {
|
|
3127
|
+
return new SetupError(
|
|
3128
|
+
"Deposit service is temporarily unavailable. Please try again shortly.",
|
|
3129
|
+
"server"
|
|
3130
|
+
);
|
|
1808
3131
|
}
|
|
1809
|
-
return new SetupError(
|
|
1810
|
-
"Deposit service is temporarily unavailable. Please try again shortly.",
|
|
1811
|
-
"unknown"
|
|
1812
|
-
);
|
|
3132
|
+
return new SetupError(error.message, "client");
|
|
1813
3133
|
}
|
|
1814
3134
|
return new SetupError(
|
|
1815
3135
|
"Deposit service is temporarily unavailable. Please try again shortly.",
|
|
@@ -1841,4 +3161,9 @@ function mapError(error) {
|
|
|
1841
3161
|
|
|
1842
3162
|
|
|
1843
3163
|
|
|
1844
|
-
|
|
3164
|
+
|
|
3165
|
+
|
|
3166
|
+
|
|
3167
|
+
|
|
3168
|
+
|
|
3169
|
+
exports.getExchangeLogoSrc = getExchangeLogoSrc; exports.getExchangeLogo = getExchangeLogo; exports.Tooltip = Tooltip; exports.markSubmissionUncertain = markSubmissionUncertain; exports.isSubmissionUncertain = isSubmissionUncertain; exports.getEventTxHash = getEventTxHash; exports.getEventSourceDetails = getEventSourceDetails; exports.isDepositEvent = isDepositEvent; exports.isFailedEvent = isFailedEvent; exports.txRefsMatch = txRefsMatch; exports.failureMessageForEvent = failureMessageForEvent; exports.fetchTokenPriceUsd = fetchTokenPriceUsd; exports.useTokenPrices = useTokenPrices; exports.ProcessingStep = ProcessingStep; exports.SetupError = SetupError; exports.deriveAccountSalt = deriveAccountSalt; exports.computeRequestKey = computeRequestKey; exports.computeCacheKey = computeCacheKey; exports.computeIsCacheable = computeIsCacheable; exports.readDedupedAccountSetupResult = readDedupedAccountSetupResult; exports.runAccountSetupDeduped = runAccountSetupDeduped; exports.HistoryEntryButton = HistoryEntryButton; exports.HistoryOverlay = HistoryOverlay; exports.useHistoryPanel = useHistoryPanel; exports.warnRemovedProps = warnRemovedProps; exports.isHistoryEntryVisible = isHistoryEntryVisible; exports.createHistoryAnalytics = createHistoryAnalytics; exports.analyticsTargetProperties = analyticsTargetProperties;
|