@rhinestone/deposit-modal 0.18.0 → 0.20.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 +179 -48
- package/dist/BankOnrampStep-JG32OCM2.mjs +435 -0
- package/dist/BankOnrampStep-NPGXAA7U.cjs +435 -0
- package/dist/{DepositModalReown-VCY65DJX.mjs → DepositModalReown-3FGTPER6.mjs} +6 -5
- package/dist/{DepositModalReown-TVO3ZQQK.cjs → DepositModalReown-ALVWADG7.cjs} +21 -20
- package/dist/WithdrawModal-5YWFJSYY.cjs +12 -0
- package/dist/WithdrawModal-LL4Z5WZP.mjs +12 -0
- package/dist/{bearer-transport-CVHNBgoV.d.cts → bearer-transport-DZyeDG64.d.cts} +5 -1
- package/dist/{bearer-transport-CVHNBgoV.d.ts → bearer-transport-DZyeDG64.d.ts} +5 -1
- package/dist/{caip-BMi-9t09.d.cts → caip-nwFFL46o.d.cts} +2 -2
- package/dist/{caip-BMi-9t09.d.ts → caip-nwFFL46o.d.ts} +2 -2
- package/dist/{chunk-EKC2IRQG.mjs → chunk-247GJH57.mjs} +687 -299
- package/dist/{chunk-FTWKAJGN.mjs → chunk-2FOPO4N5.mjs} +1 -1
- package/dist/{chunk-AIZKGFVA.mjs → chunk-32ERBFMO.mjs} +1499 -978
- package/dist/chunk-5QUWEFD4.mjs +19 -0
- package/dist/chunk-6CTJFR3T.mjs +113 -0
- package/dist/{chunk-3TEVMP76.mjs → chunk-B2LZQIGB.mjs} +1 -1
- package/dist/{chunk-34JVJZEZ.cjs → chunk-BTEG2VNZ.cjs} +171 -130
- package/dist/{chunk-N3AAT6BS.cjs → chunk-CXRH5MKO.cjs} +1556 -1035
- package/dist/chunk-E7IMWVMN.mjs +346 -0
- package/dist/{chunk-N6JJG57R.cjs → chunk-EKFXUF5A.cjs} +1 -1
- package/dist/chunk-FKJ6EJHH.cjs +346 -0
- package/dist/chunk-FMUSY563.cjs +19 -0
- package/dist/{chunk-LVCD6RHF.cjs → chunk-FVJKUTHF.cjs} +2 -2
- package/dist/chunk-G264OM23.cjs +224 -0
- package/dist/{chunk-R2B6VD4E.mjs → chunk-HP7S7AD6.mjs} +73 -32
- package/dist/{chunk-O4JZKKCZ.cjs → chunk-OPT5EW6L.cjs} +10 -5
- package/dist/chunk-PYRXOP2Y.cjs +113 -0
- package/dist/{chunk-X4EUXBHJ.mjs → chunk-XBJCZYBX.mjs} +8 -3
- package/dist/chunk-YY4ZOAH5.mjs +224 -0
- package/dist/{chunk-JV5OGG53.cjs → chunk-Z4RBTNKX.cjs} +1202 -814
- package/dist/compliance.cjs +4 -7
- package/dist/compliance.d.cts +26 -3
- package/dist/compliance.d.ts +26 -3
- package/dist/compliance.mjs +6 -9
- package/dist/constants-BQDxVNgr.d.cts +29 -0
- package/dist/constants-DjGQW5N5.d.ts +29 -0
- package/dist/constants.cjs +3 -37
- package/dist/constants.d.cts +4 -20
- package/dist/constants.d.ts +4 -20
- package/dist/constants.mjs +4 -38
- package/dist/deposit.cjs +7 -6
- package/dist/deposit.d.cts +5 -3
- package/dist/deposit.d.ts +5 -3
- package/dist/deposit.mjs +6 -5
- package/dist/embed.cjs +21 -20
- package/dist/embed.d.cts +3 -2
- package/dist/embed.d.ts +3 -2
- package/dist/embed.mjs +7 -6
- package/dist/index.cjs +8 -35
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +9 -36
- package/dist/onramp.cjs +4 -20
- package/dist/onramp.d.cts +59 -23
- package/dist/onramp.d.ts +59 -23
- package/dist/onramp.mjs +5 -21
- package/dist/polymarket.cjs +6 -6
- package/dist/polymarket.mjs +2 -2
- package/dist/ramp-types-HYWd7CW0.d.cts +108 -0
- package/dist/ramp-types-HYWd7CW0.d.ts +108 -0
- package/dist/styles.css +280 -0
- package/dist/{types-CbUs4boj.d.cts → types-BxSrazbq.d.ts} +56 -3
- package/dist/{types-CZYypODQ.d.ts → types-CixUBhrM.d.cts} +56 -3
- package/dist/withdraw.cjs +6 -5
- package/dist/withdraw.d.cts +4 -3
- package/dist/withdraw.d.ts +4 -3
- package/dist/withdraw.mjs +5 -4
- package/package.json +9 -17
- package/dist/WithdrawModal-GR3HLYXU.cjs +0 -11
- package/dist/WithdrawModal-RMCYJJ4S.mjs +0 -11
- package/dist/chunk-ADEWTBSN.cjs +0 -19
- package/dist/chunk-EAGMY3QE.mjs +0 -962
- package/dist/chunk-OY5N3E6L.cjs +0 -962
- package/dist/chunk-PP4QE32S.mjs +0 -19
- package/dist/constants-BT4ctuHo.d.cts +0 -64
- package/dist/constants-D21ZdNOP.d.ts +0 -64
- package/dist/offramp.cjs +0 -25
- package/dist/offramp.d.cts +0 -28
- package/dist/offramp.d.ts +0 -28
- package/dist/offramp.mjs +0 -25
- package/dist/ramp-types-C6aUz4SZ.d.cts +0 -43
- package/dist/ramp-types-C6aUz4SZ.d.ts +0 -43
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
var _chunkG264OM23cjs = require('./chunk-G264OM23.cjs');
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
|
|
@@ -31,11 +32,20 @@
|
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
|
|
34
|
-
var _chunkOY5N3E6Lcjs = require('./chunk-OY5N3E6L.cjs');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
var _chunkFKJ6EJHHcjs = require('./chunk-FKJ6EJHH.cjs');
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
var _chunkEKFXUF5Acjs = require('./chunk-EKFXUF5A.cjs');
|
|
39
49
|
|
|
40
50
|
// src/components/ui/Modal.tsx
|
|
41
51
|
|
|
@@ -164,139 +174,72 @@ function Modal({
|
|
|
164
174
|
}
|
|
165
175
|
Modal.displayName = "Modal";
|
|
166
176
|
|
|
167
|
-
// src/
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
var _lucidereact = require('lucide-react');
|
|
177
|
+
// src/core/deposit-service.ts
|
|
178
|
+
var _viem = require('viem');
|
|
189
179
|
|
|
190
|
-
|
|
191
|
-
var
|
|
192
|
-
var
|
|
193
|
-
function
|
|
194
|
-
return
|
|
195
|
-
"svg",
|
|
196
|
-
{
|
|
197
|
-
width: "24",
|
|
198
|
-
height: "24",
|
|
199
|
-
viewBox: "8 8 24 24",
|
|
200
|
-
fill: "none",
|
|
201
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
202
|
-
"aria-hidden": "true",
|
|
203
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
204
|
-
"path",
|
|
205
|
-
{
|
|
206
|
-
d: "M26.08 18.37C27.03 18.72 27.87 19.30 28.53 20.07C29.19 20.83 29.65 21.75 29.86 22.73C30.07 23.72 30.03 24.74 29.74 25.71C29.45 26.68 28.92 27.55 28.20 28.26C27.48 28.97 26.59 29.49 25.62 29.76C24.65 30.04 23.63 30.06 22.64 29.83C21.66 29.61 20.75 29.14 20.00 28.47C19.24 27.80 18.67 26.95 18.33 26.00M15 14H16V18M24.70 21.87L25.40 22.58L22.58 25.40M22 16C22 19.31 19.31 22 16 22C12.68 22 10 19.31 10 16C10 12.68 12.68 10 16 10C19.31 10 22 12.68 22 16Z",
|
|
207
|
-
stroke: "currentColor",
|
|
208
|
-
strokeWidth: "2",
|
|
209
|
-
strokeLinecap: "round",
|
|
210
|
-
strokeLinejoin: "round"
|
|
211
|
-
}
|
|
212
|
-
)
|
|
213
|
-
}
|
|
214
|
-
);
|
|
180
|
+
// src/core/runtime-token-meta.ts
|
|
181
|
+
var bySymbol = /* @__PURE__ */ new Map();
|
|
182
|
+
var byAddress = /* @__PURE__ */ new Map();
|
|
183
|
+
function symbolKey(chainId, symbol) {
|
|
184
|
+
return `${chainId}:${symbol.trim().toUpperCase()}`;
|
|
215
185
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
var
|
|
221
|
-
var
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
function
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
fill: "none",
|
|
239
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
240
|
-
"aria-hidden": "true",
|
|
241
|
-
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
242
|
-
"g",
|
|
243
|
-
{
|
|
244
|
-
stroke: "currentColor",
|
|
245
|
-
strokeWidth: "2",
|
|
246
|
-
strokeLinecap: "round",
|
|
247
|
-
strokeLinejoin: "round",
|
|
248
|
-
children: [
|
|
249
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
250
|
-
"path",
|
|
251
|
-
{
|
|
252
|
-
d: "M19 4.344V3C19 2.46957 18.7893 1.96086 18.4142 1.58579C18.0391 1.21071 17.5304 1 17 1H3C2.46957 1 1.96086 1.21071 1.58579 1.58579C1.21071 1.96086 1 2.46957 1 3V17C1 17.5304 1.21071 18.0391 1.58579 18.4142C1.96086 18.7893 2.46957 19 3 19H17C17.5304 19 18.0391 18.7893 18.4142 18.4142C18.7893 18.0391 19 17.5304 19 17V15.656",
|
|
253
|
-
transform: "translate(2 2)"
|
|
254
|
-
}
|
|
255
|
-
),
|
|
256
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M1 1H12", transform: "translate(9 11)" }),
|
|
257
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M1 9L5 5L1 1", transform: "translate(16 7)" })
|
|
258
|
-
]
|
|
259
|
-
}
|
|
260
|
-
)
|
|
186
|
+
function addressKey(chainId, address) {
|
|
187
|
+
const key = address.startsWith("0x") ? address.toLowerCase() : address;
|
|
188
|
+
return `${chainId}:${key}`;
|
|
189
|
+
}
|
|
190
|
+
var version = 0;
|
|
191
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
192
|
+
function subscribeToRuntimeTokens(listener) {
|
|
193
|
+
listeners.add(listener);
|
|
194
|
+
return () => {
|
|
195
|
+
listeners.delete(listener);
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function getRuntimeTokensVersion() {
|
|
199
|
+
return version;
|
|
200
|
+
}
|
|
201
|
+
function setRuntimeTokens(tokens) {
|
|
202
|
+
let changed = false;
|
|
203
|
+
for (const token of tokens) {
|
|
204
|
+
const sKey = symbolKey(token.chainId, token.symbol);
|
|
205
|
+
if (!bySymbol.has(sKey)) {
|
|
206
|
+
bySymbol.set(sKey, token);
|
|
207
|
+
changed = true;
|
|
261
208
|
}
|
|
262
|
-
|
|
209
|
+
const aKey = addressKey(token.chainId, token.address);
|
|
210
|
+
const previous = byAddress.get(aKey);
|
|
211
|
+
if (_optionalChain([previous, 'optionalAccess', _ => _.symbol]) !== token.symbol || previous.decimals !== token.decimals) {
|
|
212
|
+
changed = true;
|
|
213
|
+
}
|
|
214
|
+
byAddress.set(aKey, token);
|
|
215
|
+
}
|
|
216
|
+
if (!changed) return;
|
|
217
|
+
version += 1;
|
|
218
|
+
for (const listener of [...listeners]) listener();
|
|
263
219
|
}
|
|
264
|
-
function
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
{
|
|
278
|
-
d: "M16.36 1.43c0 1.14-.49 2.27-1.18 3.08-.74.9-1.99 1.57-2.98 1.57-.12 0-.23-.02-.3-.03-.01-.06-.04-.22-.04-.39 0-1.15.57-2.27 1.2-2.98.8-.94 2.15-1.64 3.25-1.68.03.13.05.28.05.43z",
|
|
279
|
-
stroke: "currentColor",
|
|
280
|
-
strokeWidth: "1.6",
|
|
281
|
-
strokeLinejoin: "round"
|
|
282
|
-
}
|
|
283
|
-
),
|
|
284
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
285
|
-
"path",
|
|
286
|
-
{
|
|
287
|
-
d: "M20.93 17.14c-.03.07-.46 1.58-1.52 3.12-.94 1.34-1.94 2.71-3.43 2.71-1.51 0-1.9-.88-3.63-.88-1.7 0-2.3.91-3.67.91-1.38 0-2.33-1.26-3.43-2.8-1.29-1.82-2.32-4.63-2.32-7.28 0-4.28 2.8-6.55 5.55-6.55 1.45 0 2.68.95 3.6.95.86 0 2.22-1.01 3.9-1.01.61 0 2.89.06 4.37 2.19-.13.09-2.38 1.37-2.38 4.19 0 3.26 2.85 4.42 2.96 4.45z",
|
|
288
|
-
stroke: "currentColor",
|
|
289
|
-
strokeWidth: "1.6",
|
|
290
|
-
strokeLinejoin: "round"
|
|
291
|
-
}
|
|
292
|
-
)
|
|
293
|
-
]
|
|
220
|
+
function publishShortlistTokens(shortlist) {
|
|
221
|
+
const tokens = [];
|
|
222
|
+
for (const [chainKey, entries] of Object.entries(shortlist)) {
|
|
223
|
+
const chainId = Number(chainKey);
|
|
224
|
+
if (!Number.isInteger(chainId)) continue;
|
|
225
|
+
for (const entry of entries) {
|
|
226
|
+
if (!/^0x[a-fA-F0-9]{40}$/.test(entry.address)) continue;
|
|
227
|
+
tokens.push({
|
|
228
|
+
chainId,
|
|
229
|
+
symbol: entry.symbol,
|
|
230
|
+
address: entry.address,
|
|
231
|
+
decimals: entry.decimals
|
|
232
|
+
});
|
|
294
233
|
}
|
|
295
|
-
|
|
234
|
+
}
|
|
235
|
+
setRuntimeTokens(tokens);
|
|
236
|
+
}
|
|
237
|
+
function getRuntimeToken(chainId, symbol) {
|
|
238
|
+
return bySymbol.get(symbolKey(chainId, symbol));
|
|
239
|
+
}
|
|
240
|
+
function getRuntimeTokenByAddress(chainId, address) {
|
|
241
|
+
return byAddress.get(addressKey(chainId, address));
|
|
296
242
|
}
|
|
297
|
-
|
|
298
|
-
// src/core/deposit-service.ts
|
|
299
|
-
var _viem = require('viem');
|
|
300
243
|
|
|
301
244
|
// src/core/debug.ts
|
|
302
245
|
function truncateString(value, max = 240) {
|
|
@@ -351,6 +294,32 @@ function debugError(enabled, scope, message, error, data) {
|
|
|
351
294
|
console.error(`[deposit-modal:${scope}] ${message}`, payload);
|
|
352
295
|
}
|
|
353
296
|
|
|
297
|
+
// src/core/solana-tokens.ts
|
|
298
|
+
var SOLANA_TOKENS = [
|
|
299
|
+
{ symbol: "SOL", mint: "native", decimals: 9 },
|
|
300
|
+
{
|
|
301
|
+
symbol: "USDC",
|
|
302
|
+
mint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
303
|
+
decimals: 6
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
symbol: "USDT",
|
|
307
|
+
mint: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
|
|
308
|
+
decimals: 6
|
|
309
|
+
}
|
|
310
|
+
];
|
|
311
|
+
var SOLANA_SYSTEM_PROGRAM = "11111111111111111111111111111111";
|
|
312
|
+
function resolveSolanaToken(mint) {
|
|
313
|
+
if (mint === "native" || mint === SOLANA_SYSTEM_PROGRAM) {
|
|
314
|
+
return { symbol: "SOL", decimals: 9 };
|
|
315
|
+
}
|
|
316
|
+
const token = SOLANA_TOKENS.find((t) => t.mint === mint);
|
|
317
|
+
return token ? { symbol: token.symbol, decimals: token.decimals } : void 0;
|
|
318
|
+
}
|
|
319
|
+
function isNativeSol(token) {
|
|
320
|
+
return token.mint === "native";
|
|
321
|
+
}
|
|
322
|
+
|
|
354
323
|
// src/core/chain-catalog.ts
|
|
355
324
|
function parseToken(value) {
|
|
356
325
|
if (typeof value !== "object" || value === null) return null;
|
|
@@ -403,7 +372,7 @@ function parseChain(caip2, value) {
|
|
|
403
372
|
// `parseEvmChainId` returns null for `solana:`/`tron:`/`hypercore:` keys,
|
|
404
373
|
// which is the intended answer — those chains have no numeric id, and the
|
|
405
374
|
// modal addresses them by their CAIP-2 string or a sentinel.
|
|
406
|
-
chainId:
|
|
375
|
+
chainId: _chunkFKJ6EJHHcjs.parseEvmChainId.call(void 0, caip2),
|
|
407
376
|
name,
|
|
408
377
|
testnet,
|
|
409
378
|
deposit,
|
|
@@ -436,21 +405,21 @@ function parseChainCatalog(body) {
|
|
|
436
405
|
return { all, byCaip2, byChainId };
|
|
437
406
|
}
|
|
438
407
|
function aliasHyperCoreOrigin(byCaip2, all) {
|
|
439
|
-
if (byCaip2.has(
|
|
440
|
-
const origin = _nullishCoalesce(all.find((c) =>
|
|
441
|
-
if (origin) byCaip2.set(
|
|
408
|
+
if (byCaip2.has(_chunkFKJ6EJHHcjs.HYPERCORE_SPOT_CAIP2)) return;
|
|
409
|
+
const origin = _nullishCoalesce(all.find((c) => _chunkFKJ6EJHHcjs.isHyperCoreCaip2.call(void 0, c.caip2) && c.deposit), () => ( all.find((c) => _chunkFKJ6EJHHcjs.isHyperCoreCaip2.call(void 0, c.caip2))));
|
|
410
|
+
if (origin) byCaip2.set(_chunkFKJ6EJHHcjs.HYPERCORE_SPOT_CAIP2, origin);
|
|
442
411
|
}
|
|
443
412
|
function catalogKeyForChain(chainId) {
|
|
444
|
-
if (chainId === "solana") return
|
|
445
|
-
if (chainId === "tron") return
|
|
446
|
-
if (chainId === "stellar") return
|
|
447
|
-
if (chainId === "hypercore" || chainId ===
|
|
448
|
-
return
|
|
413
|
+
if (chainId === "solana") return _chunkFKJ6EJHHcjs.SOLANA_MAINNET_CAIP2;
|
|
414
|
+
if (chainId === "tron") return _chunkFKJ6EJHHcjs.TRON_MAINNET_CAIP2;
|
|
415
|
+
if (chainId === "stellar") return _chunkFKJ6EJHHcjs.STELLAR_PUBNET_CAIP2;
|
|
416
|
+
if (chainId === "hypercore" || chainId === _chunkFKJ6EJHHcjs.HYPERCORE_CHAIN_ID) {
|
|
417
|
+
return _chunkFKJ6EJHHcjs.HYPERCORE_SPOT_CAIP2;
|
|
449
418
|
}
|
|
450
419
|
return chainId;
|
|
451
420
|
}
|
|
452
421
|
function catalogExplorerTxUrl(chain, txHash) {
|
|
453
|
-
if (!_optionalChain([chain, 'optionalAccess',
|
|
422
|
+
if (!_optionalChain([chain, 'optionalAccess', _2 => _2.explorer])) return void 0;
|
|
454
423
|
return `${chain.explorer.url}${chain.explorer.txPath}${txHash}`;
|
|
455
424
|
}
|
|
456
425
|
|
|
@@ -598,7 +567,7 @@ function quoteFeeGroups(breakdown) {
|
|
|
598
567
|
const groups = /* @__PURE__ */ new Map();
|
|
599
568
|
for (const [category, line] of Object.entries(breakdown)) {
|
|
600
569
|
if (line.internal || !Number.isFinite(line.usd) || line.usd < 0) continue;
|
|
601
|
-
const label = _optionalChain([line, 'access',
|
|
570
|
+
const label = _optionalChain([line, 'access', _3 => _3.label, 'optionalAccess', _4 => _4.trim, 'call', _5 => _5()]) || titleCaseFeeCategory(category);
|
|
602
571
|
const group = _nullishCoalesce(groups.get(label), () => ( {
|
|
603
572
|
label,
|
|
604
573
|
chargedUsd: 0,
|
|
@@ -625,6 +594,8 @@ function parseQuotePreview(raw) {
|
|
|
625
594
|
}
|
|
626
595
|
const output = parseQuoteOutput(obj.output);
|
|
627
596
|
if (!output) return null;
|
|
597
|
+
const input = obj.input === void 0 ? void 0 : parseQuoteOutput(obj.input);
|
|
598
|
+
if (obj.input !== void 0 && !input) return null;
|
|
628
599
|
const fees = obj.fees;
|
|
629
600
|
if (typeof fees !== "object" || fees === null) return null;
|
|
630
601
|
const total = fees.total;
|
|
@@ -657,6 +628,7 @@ function parseQuotePreview(raw) {
|
|
|
657
628
|
estimatedFillTimeSeconds: obj.estimatedFillTimeSeconds,
|
|
658
629
|
fees: { total: { usd: totalUsd }, breakdown },
|
|
659
630
|
output,
|
|
631
|
+
...input ? { input } : {},
|
|
660
632
|
...timing ? { timing } : {}
|
|
661
633
|
};
|
|
662
634
|
}
|
|
@@ -716,24 +688,14 @@ function parseFeeLine(raw) {
|
|
|
716
688
|
...line.internal !== void 0 && { internal: line.internal }
|
|
717
689
|
};
|
|
718
690
|
}
|
|
719
|
-
var SwappedConnectFeeChangedError = class extends Error {
|
|
720
|
-
constructor(exchangeFeeBps, message = "The Exchange Fee changed") {
|
|
721
|
-
super(message);
|
|
722
|
-
this.exchangeFeeBps = exchangeFeeBps;
|
|
723
|
-
this.name = "SwappedConnectFeeChangedError";
|
|
724
|
-
}
|
|
725
|
-
};
|
|
726
|
-
function parseExchangeFeeBps(value) {
|
|
727
|
-
return typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 1e4 ? value : void 0;
|
|
728
|
-
}
|
|
729
691
|
var UNSUPPORTED_CONNECT_EXCHANGES = /* @__PURE__ */ new Set(["kraken", "htx"]);
|
|
730
692
|
var SUPPORTED_CONNECT_EXCHANGE_COUNT = 7;
|
|
731
693
|
function isSupportedConnectExchange(exchange) {
|
|
732
694
|
return !UNSUPPORTED_CONNECT_EXCHANGES.has(exchange.connection.toLowerCase());
|
|
733
695
|
}
|
|
734
696
|
function resolveAppFeeBps(appFees, sourceChainCaip2, sourceToken) {
|
|
735
|
-
const override = _optionalChain([appFees, 'optionalAccess',
|
|
736
|
-
const bps = _nullishCoalesce(_nullishCoalesce(override, () => ( _optionalChain([appFees, 'optionalAccess',
|
|
697
|
+
const override = _optionalChain([appFees, 'optionalAccess', _6 => _6.tokens, 'optionalAccess', _7 => _7[sourceChainCaip2], 'optionalAccess', _8 => _8[sourceToken.toLowerCase()]]);
|
|
698
|
+
const bps = _nullishCoalesce(_nullishCoalesce(override, () => ( _optionalChain([appFees, 'optionalAccess', _9 => _9.feeBps]))), () => ( 0));
|
|
737
699
|
return bps > 0 ? bps : 0;
|
|
738
700
|
}
|
|
739
701
|
function isRawAmount(value) {
|
|
@@ -747,6 +709,10 @@ var DEPOSIT_POLICY_REFUSAL_CODES = [
|
|
|
747
709
|
"BALANCE-3",
|
|
748
710
|
"BALANCE-4"
|
|
749
711
|
];
|
|
712
|
+
var ASSET_LOOKUP_MAX_IDS = 100;
|
|
713
|
+
var ASSET_LOOKUP_MAX_URL_LENGTH = 2e3;
|
|
714
|
+
var ASSET_LOOKUP_TIMEOUT_MS = 8e3;
|
|
715
|
+
var ASSET_LOGO_PREFIX = "https://s3.rhinestone.dev/";
|
|
750
716
|
var DEPOSIT_PREFLIGHT_TIMEOUT_MS = 1e4;
|
|
751
717
|
async function readPolicyRefusal(response) {
|
|
752
718
|
if (response.status !== 422) return null;
|
|
@@ -777,8 +743,8 @@ var RegistrationError = class extends Error {
|
|
|
777
743
|
};
|
|
778
744
|
function createDepositService(baseUrl, options) {
|
|
779
745
|
const normalizedBaseUrl = baseUrl.replace(/\/$/, "");
|
|
780
|
-
const debug = _optionalChain([options, 'optionalAccess',
|
|
781
|
-
const scope = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
746
|
+
const debug = _optionalChain([options, 'optionalAccess', _10 => _10.debug]) === true;
|
|
747
|
+
const scope = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _11 => _11.debugScope]), () => ( "service"));
|
|
782
748
|
function apiUrl(path) {
|
|
783
749
|
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
784
750
|
return `${normalizedBaseUrl}${normalizedPath}`;
|
|
@@ -787,16 +753,14 @@ function createDepositService(baseUrl, options) {
|
|
|
787
753
|
if (value.length <= 20) return value;
|
|
788
754
|
return `${value.slice(0, 10)}...${value.slice(-8)}`;
|
|
789
755
|
}
|
|
790
|
-
function withPreflightTimeout(label, fallback, run) {
|
|
756
|
+
function withPreflightTimeout(label, fallback, run, timeoutMs = DEPOSIT_PREFLIGHT_TIMEOUT_MS) {
|
|
791
757
|
const controller = new AbortController();
|
|
792
758
|
return new Promise((resolve) => {
|
|
793
759
|
const timer = setTimeout(() => {
|
|
794
|
-
debugLog(debug, scope, `${label}:timeout`, {
|
|
795
|
-
timeoutMs: DEPOSIT_PREFLIGHT_TIMEOUT_MS
|
|
796
|
-
});
|
|
760
|
+
debugLog(debug, scope, `${label}:timeout`, { timeoutMs });
|
|
797
761
|
controller.abort();
|
|
798
762
|
resolve(fallback);
|
|
799
|
-
},
|
|
763
|
+
}, timeoutMs);
|
|
800
764
|
run(controller.signal).then(
|
|
801
765
|
(value) => {
|
|
802
766
|
clearTimeout(timer);
|
|
@@ -811,6 +775,85 @@ function createDepositService(baseUrl, options) {
|
|
|
811
775
|
}
|
|
812
776
|
const PORTFOLIO_CACHE_TTL_MS = 3e4;
|
|
813
777
|
const portfolioCache = /* @__PURE__ */ new Map();
|
|
778
|
+
let assetsRouteMissing = false;
|
|
779
|
+
let assetsQueryUnsupported = false;
|
|
780
|
+
function assetsGetUrl(ids, fields) {
|
|
781
|
+
return apiUrl(
|
|
782
|
+
`/assets?${new URLSearchParams({
|
|
783
|
+
ids: ids.join(","),
|
|
784
|
+
fields: fields.join(",")
|
|
785
|
+
}).toString()}`
|
|
786
|
+
);
|
|
787
|
+
}
|
|
788
|
+
function requestAssets(method, ids, fields) {
|
|
789
|
+
const failed = { ok: false, status: null };
|
|
790
|
+
return withPreflightTimeout(
|
|
791
|
+
`lookupAssets:${method}`,
|
|
792
|
+
failed,
|
|
793
|
+
async (signal) => {
|
|
794
|
+
const response = await fetch(
|
|
795
|
+
method === "GET" ? assetsGetUrl(ids, fields) : apiUrl("/assets"),
|
|
796
|
+
{
|
|
797
|
+
method,
|
|
798
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
799
|
+
body: method === "QUERY" ? JSON.stringify({ ids, fields }) : void 0,
|
|
800
|
+
cache: "no-store",
|
|
801
|
+
signal
|
|
802
|
+
}
|
|
803
|
+
);
|
|
804
|
+
if (response.status !== 200) {
|
|
805
|
+
debugError(debug, scope, "lookupAssets:failed", {
|
|
806
|
+
method,
|
|
807
|
+
status: response.status
|
|
808
|
+
});
|
|
809
|
+
return { ok: false, status: response.status };
|
|
810
|
+
}
|
|
811
|
+
const body = await response.json().catch(() => null);
|
|
812
|
+
const data = _optionalChain([body, 'optionalAccess', _12 => _12.data]);
|
|
813
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) {
|
|
814
|
+
debugError(debug, scope, "lookupAssets:malformed", { method });
|
|
815
|
+
return failed;
|
|
816
|
+
}
|
|
817
|
+
return { ok: true, data };
|
|
818
|
+
},
|
|
819
|
+
ASSET_LOOKUP_TIMEOUT_MS
|
|
820
|
+
);
|
|
821
|
+
}
|
|
822
|
+
function chunkForGet(ids, fields) {
|
|
823
|
+
const chunks = [];
|
|
824
|
+
let current = [];
|
|
825
|
+
for (const id of ids) {
|
|
826
|
+
const next = [...current, id];
|
|
827
|
+
if (current.length > 0 && assetsGetUrl(next, fields).length > ASSET_LOOKUP_MAX_URL_LENGTH) {
|
|
828
|
+
chunks.push(current);
|
|
829
|
+
current = [id];
|
|
830
|
+
} else {
|
|
831
|
+
current = next;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
if (current.length > 0) chunks.push(current);
|
|
835
|
+
return chunks;
|
|
836
|
+
}
|
|
837
|
+
async function lookupAssetsViaGet(ids, fields) {
|
|
838
|
+
const data = {};
|
|
839
|
+
for (const chunk of chunkForGet(ids, fields)) {
|
|
840
|
+
const outcome = await requestAssets("GET", chunk, fields);
|
|
841
|
+
if (!outcome.ok) return outcome;
|
|
842
|
+
Object.assign(data, outcome.data);
|
|
843
|
+
}
|
|
844
|
+
return { ok: true, data };
|
|
845
|
+
}
|
|
846
|
+
async function lookupAssetsBatch(ids, fields) {
|
|
847
|
+
const fitsGet = assetsGetUrl(ids, fields).length <= ASSET_LOOKUP_MAX_URL_LENGTH;
|
|
848
|
+
if (fitsGet || assetsQueryUnsupported) {
|
|
849
|
+
return lookupAssetsViaGet(ids, fields);
|
|
850
|
+
}
|
|
851
|
+
const viaQuery = await requestAssets("QUERY", ids, fields);
|
|
852
|
+
if (viaQuery.ok) return viaQuery;
|
|
853
|
+
const viaGet = await lookupAssetsViaGet(ids, fields);
|
|
854
|
+
if (viaGet.ok) assetsQueryUnsupported = true;
|
|
855
|
+
return viaGet;
|
|
856
|
+
}
|
|
814
857
|
let topTokensPromise = null;
|
|
815
858
|
let chainsPromise = null;
|
|
816
859
|
function parseDepositOptions(value) {
|
|
@@ -846,7 +889,7 @@ function createDepositService(baseUrl, options) {
|
|
|
846
889
|
try {
|
|
847
890
|
const response = await fetch(apiUrl("/qr/tokens"), {
|
|
848
891
|
method: "GET",
|
|
849
|
-
headers:
|
|
892
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, )
|
|
850
893
|
});
|
|
851
894
|
if (!response.ok) {
|
|
852
895
|
debugLog(debug, scope, "getTopTokens:unavailable", {
|
|
@@ -873,7 +916,7 @@ function createDepositService(baseUrl, options) {
|
|
|
873
916
|
try {
|
|
874
917
|
const response = await fetch(apiUrl("/chains"), {
|
|
875
918
|
method: "GET",
|
|
876
|
-
headers:
|
|
919
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, )
|
|
877
920
|
});
|
|
878
921
|
if (!response.ok) {
|
|
879
922
|
debugLog(debug, scope, "getChains:unavailable", {
|
|
@@ -904,7 +947,7 @@ function createDepositService(baseUrl, options) {
|
|
|
904
947
|
}
|
|
905
948
|
let promise;
|
|
906
949
|
promise = fetcher().catch((err) => {
|
|
907
|
-
if (_optionalChain([portfolioCache, 'access',
|
|
950
|
+
if (_optionalChain([portfolioCache, 'access', _13 => _13.get, 'call', _14 => _14(key), 'optionalAccess', _15 => _15.promise]) === promise) {
|
|
908
951
|
portfolioCache.delete(key);
|
|
909
952
|
}
|
|
910
953
|
throw err;
|
|
@@ -915,6 +958,39 @@ function createDepositService(baseUrl, options) {
|
|
|
915
958
|
});
|
|
916
959
|
return promise;
|
|
917
960
|
}
|
|
961
|
+
async function startSwappedCheckout(kind, account, fields) {
|
|
962
|
+
const label = kind === "fiat" ? "Swapped widget URL" : "Swapped Connect URL";
|
|
963
|
+
const response = await fetch(apiUrl("/onramp/orders"), {
|
|
964
|
+
method: "POST",
|
|
965
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
966
|
+
body: JSON.stringify({
|
|
967
|
+
provider: "swapped",
|
|
968
|
+
kind,
|
|
969
|
+
account,
|
|
970
|
+
...fields
|
|
971
|
+
})
|
|
972
|
+
});
|
|
973
|
+
if (!response.ok) {
|
|
974
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
975
|
+
debugError(debug, scope, "startSwappedCheckout:failed", error, {
|
|
976
|
+
status: response.status,
|
|
977
|
+
kind
|
|
978
|
+
});
|
|
979
|
+
throw new Error(
|
|
980
|
+
typeof error.error === "string" && error.error || `${label} failed: ${response.status}`
|
|
981
|
+
);
|
|
982
|
+
}
|
|
983
|
+
const body = await response.json().catch(() => null);
|
|
984
|
+
if (typeof _optionalChain([body, 'optionalAccess', _16 => _16.orderId]) !== "string" || _optionalChain([body, 'access', _17 => _17.nextAction, 'optionalAccess', _18 => _18.type]) !== "hosted" || typeof body.nextAction.url !== "string") {
|
|
985
|
+
throw new Error(`${label}: malformed response`);
|
|
986
|
+
}
|
|
987
|
+
return {
|
|
988
|
+
orderId: body.orderId,
|
|
989
|
+
url: body.nextAction.url,
|
|
990
|
+
externalCustomerId: `${account.toLowerCase()}:${body.orderId}`,
|
|
991
|
+
expiresAt: typeof body.expiresAt === "string" ? body.expiresAt : void 0
|
|
992
|
+
};
|
|
993
|
+
}
|
|
918
994
|
return {
|
|
919
995
|
async registerManagedAccount(params) {
|
|
920
996
|
const url = apiUrl("/register-managed");
|
|
@@ -927,7 +1003,7 @@ function createDepositService(baseUrl, options) {
|
|
|
927
1003
|
});
|
|
928
1004
|
const response = await fetch(url, {
|
|
929
1005
|
method: "POST",
|
|
930
|
-
headers:
|
|
1006
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
931
1007
|
body: JSON.stringify({ account: params })
|
|
932
1008
|
});
|
|
933
1009
|
if (!response.ok) {
|
|
@@ -936,7 +1012,7 @@ function createDepositService(baseUrl, options) {
|
|
|
936
1012
|
status: response.status,
|
|
937
1013
|
salt: params.salt
|
|
938
1014
|
});
|
|
939
|
-
const detail = Array.isArray(error.details) ? error.details.map((d) => _optionalChain([d, 'optionalAccess',
|
|
1015
|
+
const detail = Array.isArray(error.details) ? error.details.map((d) => _optionalChain([d, 'optionalAccess', _19 => _19.message])).filter(Boolean).join("; ") : void 0;
|
|
940
1016
|
const base = error.error || `Account registration failed: ${response.status}`;
|
|
941
1017
|
throw new RegistrationError(
|
|
942
1018
|
detail ? `${base}: ${detail}` : base,
|
|
@@ -945,13 +1021,13 @@ function createDepositService(baseUrl, options) {
|
|
|
945
1021
|
}
|
|
946
1022
|
const result = await response.json();
|
|
947
1023
|
debugLog(debug, scope, "registerManagedAccount:success", {
|
|
948
|
-
evmDepositAddress: _optionalChain([result, 'optionalAccess',
|
|
949
|
-
hasSolanaDepositAddress: Boolean(_optionalChain([result, 'optionalAccess',
|
|
950
|
-
hasTronDepositAddress: Boolean(_optionalChain([result, 'optionalAccess',
|
|
1024
|
+
evmDepositAddress: _optionalChain([result, 'optionalAccess', _20 => _20.evmDepositAddress]),
|
|
1025
|
+
hasSolanaDepositAddress: Boolean(_optionalChain([result, 'optionalAccess', _21 => _21.solanaDepositAddress])),
|
|
1026
|
+
hasTronDepositAddress: Boolean(_optionalChain([result, 'optionalAccess', _22 => _22.tronDepositAddress]))
|
|
951
1027
|
});
|
|
952
1028
|
return {
|
|
953
1029
|
...result,
|
|
954
|
-
evmDepositAddress: normalizeEvmAddress(_optionalChain([result, 'optionalAccess',
|
|
1030
|
+
evmDepositAddress: normalizeEvmAddress(_optionalChain([result, 'optionalAccess', _23 => _23.evmDepositAddress]))
|
|
955
1031
|
};
|
|
956
1032
|
},
|
|
957
1033
|
async fetchPortfolio(address, options2) {
|
|
@@ -962,7 +1038,7 @@ function createDepositService(baseUrl, options) {
|
|
|
962
1038
|
debugLog(debug, scope, "fetchPortfolio:request", { url, address });
|
|
963
1039
|
const response = await fetch(url, {
|
|
964
1040
|
method: "GET",
|
|
965
|
-
headers:
|
|
1041
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, )
|
|
966
1042
|
});
|
|
967
1043
|
if (!response.ok) {
|
|
968
1044
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -999,7 +1075,7 @@ function createDepositService(baseUrl, options) {
|
|
|
999
1075
|
debugLog(debug, scope, "fetchPortfolio:empty", { address });
|
|
1000
1076
|
return { tokens: [], totalUsd: 0 };
|
|
1001
1077
|
},
|
|
1002
|
-
_optionalChain([options2, 'optionalAccess',
|
|
1078
|
+
_optionalChain([options2, 'optionalAccess', _24 => _24.forceRefresh])
|
|
1003
1079
|
);
|
|
1004
1080
|
},
|
|
1005
1081
|
async fetchSolanaPortfolio(address, options2) {
|
|
@@ -1013,7 +1089,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1013
1089
|
});
|
|
1014
1090
|
const response = await fetch(url, {
|
|
1015
1091
|
method: "GET",
|
|
1016
|
-
headers:
|
|
1092
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, )
|
|
1017
1093
|
});
|
|
1018
1094
|
if (!response.ok) {
|
|
1019
1095
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -1034,7 +1110,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1034
1110
|
});
|
|
1035
1111
|
return normalized;
|
|
1036
1112
|
},
|
|
1037
|
-
_optionalChain([options2, 'optionalAccess',
|
|
1113
|
+
_optionalChain([options2, 'optionalAccess', _25 => _25.forceRefresh])
|
|
1038
1114
|
);
|
|
1039
1115
|
},
|
|
1040
1116
|
async checkAccount(address) {
|
|
@@ -1042,7 +1118,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1042
1118
|
debugLog(debug, scope, "checkAccount:request", { url, address });
|
|
1043
1119
|
const response = await fetch(url, {
|
|
1044
1120
|
method: "GET",
|
|
1045
|
-
headers:
|
|
1121
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, )
|
|
1046
1122
|
});
|
|
1047
1123
|
if (!response.ok) {
|
|
1048
1124
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -1056,9 +1132,9 @@ function createDepositService(baseUrl, options) {
|
|
|
1056
1132
|
}
|
|
1057
1133
|
const data = await response.json();
|
|
1058
1134
|
const result = {
|
|
1059
|
-
isRegistered: _optionalChain([data, 'optionalAccess',
|
|
1060
|
-
targetChain: _optionalChain([data, 'optionalAccess',
|
|
1061
|
-
targetToken: _optionalChain([data, 'optionalAccess',
|
|
1135
|
+
isRegistered: _optionalChain([data, 'optionalAccess', _26 => _26.isRegistered]) === true,
|
|
1136
|
+
targetChain: _optionalChain([data, 'optionalAccess', _27 => _27.targetChain]),
|
|
1137
|
+
targetToken: _optionalChain([data, 'optionalAccess', _28 => _28.targetToken])
|
|
1062
1138
|
};
|
|
1063
1139
|
debugLog(debug, scope, "checkAccount:success", {
|
|
1064
1140
|
address,
|
|
@@ -1078,7 +1154,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1078
1154
|
);
|
|
1079
1155
|
const response = await fetch(url, {
|
|
1080
1156
|
method: "GET",
|
|
1081
|
-
headers:
|
|
1157
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1082
1158
|
cache: "no-store"
|
|
1083
1159
|
});
|
|
1084
1160
|
if (!response.ok) {
|
|
@@ -1090,12 +1166,12 @@ function createDepositService(baseUrl, options) {
|
|
|
1090
1166
|
return { lastEvent: void 0 };
|
|
1091
1167
|
}
|
|
1092
1168
|
const body = await response.json();
|
|
1093
|
-
const row = _optionalChain([body, 'access',
|
|
1169
|
+
const row = _optionalChain([body, 'access', _29 => _29.deposits, 'optionalAccess', _30 => _30[0]]);
|
|
1094
1170
|
const lastEvent = row ? depositRowToEvent(row) : void 0;
|
|
1095
1171
|
debugLog(debug, scope, "fetchStatus:success", {
|
|
1096
1172
|
address,
|
|
1097
1173
|
txHash: shortRef(normalized),
|
|
1098
|
-
eventType: _optionalChain([lastEvent, 'optionalAccess',
|
|
1174
|
+
eventType: _optionalChain([lastEvent, 'optionalAccess', _31 => _31.type])
|
|
1099
1175
|
});
|
|
1100
1176
|
return { lastEvent };
|
|
1101
1177
|
},
|
|
@@ -1106,7 +1182,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1106
1182
|
);
|
|
1107
1183
|
const response = await fetch(url, {
|
|
1108
1184
|
method: "GET",
|
|
1109
|
-
headers:
|
|
1185
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1110
1186
|
cache: "no-store"
|
|
1111
1187
|
});
|
|
1112
1188
|
if (!response.ok) {
|
|
@@ -1130,7 +1206,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1130
1206
|
);
|
|
1131
1207
|
const response = await fetch(url, {
|
|
1132
1208
|
method: "GET",
|
|
1133
|
-
headers:
|
|
1209
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1134
1210
|
cache: "no-store"
|
|
1135
1211
|
});
|
|
1136
1212
|
if (!response.ok) {
|
|
@@ -1141,18 +1217,18 @@ function createDepositService(baseUrl, options) {
|
|
|
1141
1217
|
return { lastEvent: void 0 };
|
|
1142
1218
|
}
|
|
1143
1219
|
const body = await response.json();
|
|
1144
|
-
const row = _optionalChain([body, 'access',
|
|
1220
|
+
const row = _optionalChain([body, 'access', _32 => _32.deposits, 'optionalAccess', _33 => _33[0]]);
|
|
1145
1221
|
const lastEvent = row ? depositRowToEvent(row) : void 0;
|
|
1146
1222
|
debugLog(debug, scope, "fetchLatestStatus:success", {
|
|
1147
1223
|
address,
|
|
1148
|
-
eventType: _optionalChain([lastEvent, 'optionalAccess',
|
|
1224
|
+
eventType: _optionalChain([lastEvent, 'optionalAccess', _34 => _34.type])
|
|
1149
1225
|
});
|
|
1150
1226
|
return { lastEvent };
|
|
1151
1227
|
},
|
|
1152
1228
|
async getPositions(address) {
|
|
1153
1229
|
const url = apiUrl(`/positions/${address}`);
|
|
1154
1230
|
debugLog(debug, scope, "getPositions:request", { url, address });
|
|
1155
|
-
const response = await fetch(url, { headers:
|
|
1231
|
+
const response = await fetch(url, { headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ) });
|
|
1156
1232
|
if (!response.ok) {
|
|
1157
1233
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1158
1234
|
debugError(debug, scope, "getPositions:failed", error, {
|
|
@@ -1166,9 +1242,9 @@ function createDepositService(baseUrl, options) {
|
|
|
1166
1242
|
const result = await response.json();
|
|
1167
1243
|
debugLog(debug, scope, "getPositions:success", {
|
|
1168
1244
|
address,
|
|
1169
|
-
count: _nullishCoalesce(_optionalChain([result, 'access',
|
|
1245
|
+
count: _nullishCoalesce(_optionalChain([result, 'access', _35 => _35.positions, 'optionalAccess', _36 => _36.length]), () => ( 0)),
|
|
1170
1246
|
totalUsd: result.totalUsd,
|
|
1171
|
-
failures: _optionalChain([result, 'access',
|
|
1247
|
+
failures: _optionalChain([result, 'access', _37 => _37.failures, 'optionalAccess', _38 => _38.map, 'call', _39 => _39((f) => f.venue)])
|
|
1172
1248
|
});
|
|
1173
1249
|
return result;
|
|
1174
1250
|
},
|
|
@@ -1186,7 +1262,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1186
1262
|
});
|
|
1187
1263
|
const response = await fetch(url, {
|
|
1188
1264
|
method: "POST",
|
|
1189
|
-
headers:
|
|
1265
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1190
1266
|
body: JSON.stringify({ account, market, chainId, asset, amount })
|
|
1191
1267
|
});
|
|
1192
1268
|
if (!response.ok) {
|
|
@@ -1222,7 +1298,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1222
1298
|
});
|
|
1223
1299
|
const response = await fetch(url, {
|
|
1224
1300
|
method: "POST",
|
|
1225
|
-
headers:
|
|
1301
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1226
1302
|
body: JSON.stringify({
|
|
1227
1303
|
depositWallet,
|
|
1228
1304
|
owner,
|
|
@@ -1246,7 +1322,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1246
1322
|
const result = await response.json();
|
|
1247
1323
|
debugLog(debug, scope, "submitPolymarketWithdraw:success", {
|
|
1248
1324
|
depositWallet,
|
|
1249
|
-
txHash: _optionalChain([result, 'optionalAccess',
|
|
1325
|
+
txHash: _optionalChain([result, 'optionalAccess', _40 => _40.txHash]) ? shortRef(result.txHash) : void 0
|
|
1250
1326
|
});
|
|
1251
1327
|
return result;
|
|
1252
1328
|
},
|
|
@@ -1264,7 +1340,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1264
1340
|
});
|
|
1265
1341
|
const response = await fetch(url, {
|
|
1266
1342
|
method: "GET",
|
|
1267
|
-
headers:
|
|
1343
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1268
1344
|
cache: "no-store"
|
|
1269
1345
|
});
|
|
1270
1346
|
if (!response.ok) {
|
|
@@ -1278,8 +1354,8 @@ function createDepositService(baseUrl, options) {
|
|
|
1278
1354
|
);
|
|
1279
1355
|
}
|
|
1280
1356
|
const data = await response.json();
|
|
1281
|
-
const deposits = Array.isArray(_optionalChain([data, 'optionalAccess',
|
|
1282
|
-
const nextCursor = _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
1357
|
+
const deposits = Array.isArray(_optionalChain([data, 'optionalAccess', _41 => _41.deposits])) ? data.deposits.map(normalizeHistoryTiming) : [];
|
|
1358
|
+
const nextCursor = _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _42 => _42.nextCursor]), () => ( _optionalChain([data, 'optionalAccess', _43 => _43.next_cursor]))), () => ( null));
|
|
1283
1359
|
debugLog(debug, scope, "fetchDepositHistory:success", {
|
|
1284
1360
|
recipient: shortRef(params.recipient),
|
|
1285
1361
|
count: deposits.length,
|
|
@@ -1288,18 +1364,18 @@ function createDepositService(baseUrl, options) {
|
|
|
1288
1364
|
return { deposits, nextCursor };
|
|
1289
1365
|
},
|
|
1290
1366
|
async checkLiquidity(params) {
|
|
1291
|
-
if (
|
|
1292
|
-
const token =
|
|
1367
|
+
if (_chunkFKJ6EJHHcjs.isSolanaCaip2.call(void 0, params.destinationChainId) || params.destinationChainId === "solana") {
|
|
1368
|
+
const token = resolveSolanaToken(params.destinationToken);
|
|
1293
1369
|
return {
|
|
1294
1370
|
hasLiquidity: true,
|
|
1295
|
-
symbol: _nullishCoalesce(_optionalChain([token, 'optionalAccess',
|
|
1296
|
-
decimals: _nullishCoalesce(_optionalChain([token, 'optionalAccess',
|
|
1371
|
+
symbol: _nullishCoalesce(_optionalChain([token, 'optionalAccess', _44 => _44.symbol]), () => ( "Token")),
|
|
1372
|
+
decimals: _nullishCoalesce(_optionalChain([token, 'optionalAccess', _45 => _45.decimals]), () => ( 9)),
|
|
1297
1373
|
unlimited: true,
|
|
1298
1374
|
maxAmount: null
|
|
1299
1375
|
};
|
|
1300
1376
|
}
|
|
1301
1377
|
const searchParams = new URLSearchParams({
|
|
1302
|
-
sourceChainId:
|
|
1378
|
+
sourceChainId: _chunkFKJ6EJHHcjs.toEvmCaip2.call(void 0, params.sourceChainId),
|
|
1303
1379
|
sourceToken: params.sourceToken,
|
|
1304
1380
|
destinationChainId: params.destinationChainId,
|
|
1305
1381
|
destinationToken: params.destinationToken,
|
|
@@ -1314,7 +1390,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1314
1390
|
});
|
|
1315
1391
|
const response = await fetch(url, {
|
|
1316
1392
|
method: "GET",
|
|
1317
|
-
headers:
|
|
1393
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1318
1394
|
cache: "no-store"
|
|
1319
1395
|
});
|
|
1320
1396
|
if (!response.ok) {
|
|
@@ -1349,21 +1425,26 @@ function createDepositService(baseUrl, options) {
|
|
|
1349
1425
|
// The branch is unreachable against today's processor whatever venue it
|
|
1350
1426
|
// names: `sourceToken` is validated as a 20-byte 0x address on every
|
|
1351
1427
|
// chain, and a HyperCore source token is a 16-byte Core spot tokenId.
|
|
1352
|
-
sourceChainId: params.sourceChainId === "hypercore" ?
|
|
1428
|
+
sourceChainId: params.sourceChainId === "hypercore" ? _chunkFKJ6EJHHcjs.HYPERCORE_SPOT_CAIP2 : `eip155:${params.sourceChainId}`,
|
|
1353
1429
|
sourceToken: params.sourceToken,
|
|
1354
|
-
amount
|
|
1430
|
+
// Each direction carries its own amount field and omits the other, which
|
|
1431
|
+
// is what the processor's "exactly one of" refinement checks. Sending
|
|
1432
|
+
// both is a 400, so spread rather than always emitting `amount`.
|
|
1433
|
+
...params.direction === "exactOut" ? { direction: "exactOut", amountOut: params.amountOut } : { amount: params.amount }
|
|
1355
1434
|
};
|
|
1356
1435
|
debugLog(debug, scope, "getQuotePreview:request", {
|
|
1357
1436
|
url,
|
|
1358
1437
|
sourceChainId: body.sourceChainId,
|
|
1359
1438
|
sourceToken: params.sourceToken,
|
|
1360
|
-
|
|
1439
|
+
direction: _nullishCoalesce(params.direction, () => ( "exactIn")),
|
|
1440
|
+
amount: params.amount,
|
|
1441
|
+
amountOut: params.amountOut
|
|
1361
1442
|
});
|
|
1362
1443
|
return withPreflightTimeout("getQuotePreview", null, async (signal) => {
|
|
1363
1444
|
try {
|
|
1364
1445
|
const response = await fetch(url, {
|
|
1365
1446
|
method: "POST",
|
|
1366
|
-
headers:
|
|
1447
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1367
1448
|
body: JSON.stringify(body),
|
|
1368
1449
|
cache: "no-store",
|
|
1369
1450
|
signal
|
|
@@ -1413,7 +1494,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1413
1494
|
try {
|
|
1414
1495
|
const response = await fetch(url, {
|
|
1415
1496
|
method: "POST",
|
|
1416
|
-
headers:
|
|
1497
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1417
1498
|
body: JSON.stringify({ ...params, kind: "auto" }),
|
|
1418
1499
|
cache: "no-store",
|
|
1419
1500
|
signal
|
|
@@ -1516,7 +1597,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1516
1597
|
try {
|
|
1517
1598
|
response = await fetch(url, {
|
|
1518
1599
|
method: "POST",
|
|
1519
|
-
headers:
|
|
1600
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1520
1601
|
body: JSON.stringify(params)
|
|
1521
1602
|
});
|
|
1522
1603
|
} catch (error) {
|
|
@@ -1538,7 +1619,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1538
1619
|
);
|
|
1539
1620
|
}
|
|
1540
1621
|
const result = await response.json();
|
|
1541
|
-
if (typeof _optionalChain([result, 'optionalAccess',
|
|
1622
|
+
if (typeof _optionalChain([result, 'optionalAccess', _46 => _46.txHash]) !== "string" || result.txHash.length === 0) {
|
|
1542
1623
|
debugError(debug, scope, "submitPermitDeposit:failed", result, {
|
|
1543
1624
|
reason: "missing txHash"
|
|
1544
1625
|
});
|
|
@@ -1558,142 +1639,49 @@ function createDepositService(baseUrl, options) {
|
|
|
1558
1639
|
status: _nullishCoalesce(result.status, () => ( "processing"))
|
|
1559
1640
|
};
|
|
1560
1641
|
},
|
|
1561
|
-
async
|
|
1562
|
-
const
|
|
1563
|
-
if (
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
)
|
|
1567
|
-
|
|
1568
|
-
const
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
if (!response.ok) {
|
|
1574
|
-
debugError(debug, scope, "fetchPrices:failed", {
|
|
1575
|
-
status: response.status
|
|
1576
|
-
});
|
|
1577
|
-
return {};
|
|
1642
|
+
async lookupAssets(ids, fields) {
|
|
1643
|
+
const unique = [...new Set(ids.filter((id) => id.length > 0))];
|
|
1644
|
+
if (unique.length === 0) return { ok: true, items: {} };
|
|
1645
|
+
if (assetsRouteMissing) return { ok: false, routeMissing: true };
|
|
1646
|
+
const items = {};
|
|
1647
|
+
for (let i = 0; i < unique.length; i += ASSET_LOOKUP_MAX_IDS) {
|
|
1648
|
+
const batch = unique.slice(i, i + ASSET_LOOKUP_MAX_IDS);
|
|
1649
|
+
const outcome = await lookupAssetsBatch(batch, fields);
|
|
1650
|
+
if (!outcome.ok) {
|
|
1651
|
+
const routeMissing = outcome.status === 404 || outcome.status === 405;
|
|
1652
|
+
if (routeMissing) assetsRouteMissing = true;
|
|
1653
|
+
return { ok: false, routeMissing };
|
|
1578
1654
|
}
|
|
1579
|
-
const
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
symbol.toUpperCase(),
|
|
1583
|
-
price
|
|
1584
|
-
])
|
|
1585
|
-
);
|
|
1586
|
-
} catch (err) {
|
|
1587
|
-
debugError(debug, scope, "fetchPrices:error", err);
|
|
1588
|
-
return {};
|
|
1589
|
-
}
|
|
1590
|
-
},
|
|
1591
|
-
async fetchPricesByAddress(caip2Ids) {
|
|
1592
|
-
const list = caip2Ids.filter((id) => id.length > 0);
|
|
1593
|
-
if (list.length === 0) return {};
|
|
1594
|
-
const url = apiUrl(
|
|
1595
|
-
`/prices?${new URLSearchParams({
|
|
1596
|
-
addresses: list.join(",")
|
|
1597
|
-
}).toString()}`
|
|
1598
|
-
);
|
|
1599
|
-
try {
|
|
1600
|
-
const response = await fetch(url, {
|
|
1601
|
-
method: "GET",
|
|
1602
|
-
headers: _chunkN6JJG57Rcjs.serviceHeaders.call(void 0, ),
|
|
1603
|
-
cache: "no-store"
|
|
1604
|
-
});
|
|
1605
|
-
if (!response.ok) {
|
|
1606
|
-
debugError(debug, scope, "fetchPricesByAddress:failed", {
|
|
1607
|
-
status: response.status
|
|
1608
|
-
});
|
|
1609
|
-
return {};
|
|
1655
|
+
for (const id of batch) {
|
|
1656
|
+
const item = parseAssetItem(outcome.data[id], fields);
|
|
1657
|
+
if (item) items[id] = item;
|
|
1610
1658
|
}
|
|
1611
|
-
const data = await response.json();
|
|
1612
|
-
return _nullishCoalesce(data.prices, () => ( {}));
|
|
1613
|
-
} catch (err) {
|
|
1614
|
-
debugError(debug, scope, "fetchPricesByAddress:error", err);
|
|
1615
|
-
return {};
|
|
1616
1659
|
}
|
|
1660
|
+
return { ok: true, items };
|
|
1617
1661
|
},
|
|
1618
1662
|
async getSwappedWidgetUrl(params) {
|
|
1619
|
-
const
|
|
1663
|
+
const { smartAccount, ...fields } = params;
|
|
1620
1664
|
debugLog(debug, scope, "getSwappedWidgetUrl:request", {
|
|
1621
|
-
smartAccount: shortRef(
|
|
1665
|
+
smartAccount: shortRef(smartAccount),
|
|
1622
1666
|
method: params.method,
|
|
1623
1667
|
methodSelectionSource: params.methodSelectionSource
|
|
1624
1668
|
});
|
|
1625
|
-
|
|
1626
|
-
method: "POST",
|
|
1627
|
-
headers: _chunkN6JJG57Rcjs.serviceHeaders.call(void 0, ),
|
|
1628
|
-
body: JSON.stringify(params)
|
|
1629
|
-
});
|
|
1630
|
-
if (!response.ok) {
|
|
1631
|
-
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1632
|
-
debugError(debug, scope, "getSwappedWidgetUrl:failed", error, {
|
|
1633
|
-
status: response.status
|
|
1634
|
-
});
|
|
1635
|
-
throw new Error(
|
|
1636
|
-
error.error || `Swapped widget URL failed: ${response.status}`
|
|
1637
|
-
);
|
|
1638
|
-
}
|
|
1639
|
-
const body = await response.json();
|
|
1640
|
-
if (typeof body.url !== "string" || typeof body.currencyCode !== "string" || typeof body.externalCustomerId !== "string") {
|
|
1641
|
-
throw new Error("Swapped widget URL: malformed response");
|
|
1642
|
-
}
|
|
1643
|
-
return {
|
|
1644
|
-
url: body.url,
|
|
1645
|
-
currencyCode: body.currencyCode,
|
|
1646
|
-
sandbox: body.sandbox === true,
|
|
1647
|
-
externalCustomerId: body.externalCustomerId,
|
|
1648
|
-
expiresAt: body.expiresAt
|
|
1649
|
-
};
|
|
1669
|
+
return startSwappedCheckout("fiat", smartAccount, fields);
|
|
1650
1670
|
},
|
|
1651
1671
|
async getSwappedConnectUrl(params) {
|
|
1652
|
-
const
|
|
1672
|
+
const { smartAccount, ...fields } = params;
|
|
1653
1673
|
debugLog(debug, scope, "getSwappedConnectUrl:request", {
|
|
1654
|
-
smartAccount: shortRef(
|
|
1674
|
+
smartAccount: shortRef(smartAccount),
|
|
1655
1675
|
connection: params.connection
|
|
1656
1676
|
});
|
|
1657
|
-
|
|
1658
|
-
method: "POST",
|
|
1659
|
-
headers: _chunkN6JJG57Rcjs.serviceHeaders.call(void 0, ),
|
|
1660
|
-
body: JSON.stringify(params)
|
|
1661
|
-
});
|
|
1662
|
-
if (!response.ok) {
|
|
1663
|
-
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1664
|
-
debugError(debug, scope, "getSwappedConnectUrl:failed", error, {
|
|
1665
|
-
status: response.status
|
|
1666
|
-
});
|
|
1667
|
-
const currentFeeBps = parseExchangeFeeBps(error.exchangeFeeBps);
|
|
1668
|
-
if (response.status === 409 && currentFeeBps !== void 0) {
|
|
1669
|
-
throw new SwappedConnectFeeChangedError(
|
|
1670
|
-
currentFeeBps,
|
|
1671
|
-
typeof error.error === "string" ? error.error : void 0
|
|
1672
|
-
);
|
|
1673
|
-
}
|
|
1674
|
-
throw new Error(
|
|
1675
|
-
typeof error.error === "string" && error.error || `Swapped Connect URL failed: ${response.status}`
|
|
1676
|
-
);
|
|
1677
|
-
}
|
|
1678
|
-
const body = await response.json();
|
|
1679
|
-
if (typeof body.url !== "string" || typeof body.currencyCode !== "string" || typeof body.externalCustomerId !== "string") {
|
|
1680
|
-
throw new Error("Swapped Connect URL: malformed response");
|
|
1681
|
-
}
|
|
1682
|
-
return {
|
|
1683
|
-
url: body.url,
|
|
1684
|
-
currencyCode: body.currencyCode,
|
|
1685
|
-
sandbox: body.sandbox === true,
|
|
1686
|
-
externalCustomerId: body.externalCustomerId,
|
|
1687
|
-
expiresAt: body.expiresAt,
|
|
1688
|
-
exchangeFeeBps: parseExchangeFeeBps(body.exchangeFeeBps)
|
|
1689
|
-
};
|
|
1677
|
+
return startSwappedCheckout("exchange", smartAccount, fields);
|
|
1690
1678
|
},
|
|
1691
1679
|
async getSwappedConnectExchanges() {
|
|
1692
|
-
const url = apiUrl("/onramp/swapped
|
|
1680
|
+
const url = apiUrl("/onramp/options?provider=swapped&kind=exchange");
|
|
1693
1681
|
debugLog(debug, scope, "getSwappedConnectExchanges:request");
|
|
1694
1682
|
const response = await fetch(url, {
|
|
1695
1683
|
method: "GET",
|
|
1696
|
-
headers:
|
|
1684
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1697
1685
|
cache: "no-store"
|
|
1698
1686
|
});
|
|
1699
1687
|
if (!response.ok) {
|
|
@@ -1706,7 +1694,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1706
1694
|
);
|
|
1707
1695
|
}
|
|
1708
1696
|
const body = await response.json();
|
|
1709
|
-
const rawExchanges = Array.isArray(body.
|
|
1697
|
+
const rawExchanges = Array.isArray(body.connections) ? body.connections : null;
|
|
1710
1698
|
const exchanges = [];
|
|
1711
1699
|
let hasMalformedExchange = rawExchanges === null;
|
|
1712
1700
|
for (const exchange of _nullishCoalesce(rawExchanges, () => ( []))) {
|
|
@@ -1724,16 +1712,10 @@ function createDepositService(baseUrl, options) {
|
|
|
1724
1712
|
}
|
|
1725
1713
|
exchanges.push({ connection, name, logoUrl });
|
|
1726
1714
|
}
|
|
1727
|
-
if (hasMalformedExchange
|
|
1715
|
+
if (hasMalformedExchange) {
|
|
1728
1716
|
throw new Error("Swapped Connect exchanges: malformed response");
|
|
1729
1717
|
}
|
|
1730
|
-
return {
|
|
1731
|
-
exchanges: exchanges.filter(isSupportedConnectExchange),
|
|
1732
|
-
fetchedAt: body.fetchedAt,
|
|
1733
|
-
expiresAt: body.expiresAt,
|
|
1734
|
-
stale: body.stale === true ? true : void 0,
|
|
1735
|
-
exchangeFeeBps: parseExchangeFeeBps(body.exchangeFeeBps)
|
|
1736
|
-
};
|
|
1718
|
+
return { exchanges: exchanges.filter(isSupportedConnectExchange) };
|
|
1737
1719
|
},
|
|
1738
1720
|
async getSwappedPaymentMethods() {
|
|
1739
1721
|
const empty = {
|
|
@@ -1741,12 +1723,12 @@ function createDepositService(baseUrl, options) {
|
|
|
1741
1723
|
methods: [],
|
|
1742
1724
|
recommendedMethod: null
|
|
1743
1725
|
};
|
|
1744
|
-
const url = apiUrl("/onramp/swapped
|
|
1726
|
+
const url = apiUrl("/onramp/options?provider=swapped&kind=fiat");
|
|
1745
1727
|
debugLog(debug, scope, "getSwappedPaymentMethods:request");
|
|
1746
1728
|
try {
|
|
1747
1729
|
const response = await fetch(url, {
|
|
1748
1730
|
method: "GET",
|
|
1749
|
-
headers:
|
|
1731
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1750
1732
|
cache: "no-store"
|
|
1751
1733
|
});
|
|
1752
1734
|
if (!response.ok) {
|
|
@@ -1834,7 +1816,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1834
1816
|
try {
|
|
1835
1817
|
const response = await fetch(url, {
|
|
1836
1818
|
method: "GET",
|
|
1837
|
-
headers:
|
|
1819
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1838
1820
|
cache: "no-store"
|
|
1839
1821
|
});
|
|
1840
1822
|
if (!response.ok) {
|
|
@@ -1855,63 +1837,99 @@ function createDepositService(baseUrl, options) {
|
|
|
1855
1837
|
return null;
|
|
1856
1838
|
}
|
|
1857
1839
|
},
|
|
1858
|
-
async
|
|
1859
|
-
const url = apiUrl(
|
|
1860
|
-
`/onramp/swapped/status/${encodeURIComponent(smartAccount)}`
|
|
1861
|
-
);
|
|
1840
|
+
async fetchSwappedOrder(orderId) {
|
|
1841
|
+
const url = apiUrl(`/onramp/orders/${encodeURIComponent(orderId)}`);
|
|
1862
1842
|
const response = await fetch(url, {
|
|
1863
1843
|
method: "GET",
|
|
1864
|
-
headers:
|
|
1844
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1865
1845
|
cache: "no-store"
|
|
1866
1846
|
});
|
|
1867
1847
|
if (!response.ok) return null;
|
|
1868
|
-
let body
|
|
1848
|
+
let body;
|
|
1869
1849
|
try {
|
|
1870
1850
|
body = await response.json();
|
|
1871
1851
|
} catch (e5) {
|
|
1872
1852
|
return null;
|
|
1873
1853
|
}
|
|
1874
|
-
|
|
1875
|
-
const status = typeof body.status === "string" ? body.status : null;
|
|
1876
|
-
const orderId = typeof body.orderId === "string" ? body.orderId : null;
|
|
1877
|
-
if (!status || !orderId) return null;
|
|
1878
|
-
const numericOrNull = (v) => {
|
|
1879
|
-
if (typeof v === "number") {
|
|
1880
|
-
return Number.isFinite(v) ? v : null;
|
|
1881
|
-
}
|
|
1882
|
-
if (typeof v === "string" && v.trim().length > 0) {
|
|
1883
|
-
const parsed = Number(v);
|
|
1884
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
1885
|
-
}
|
|
1886
|
-
return null;
|
|
1887
|
-
};
|
|
1888
|
-
return {
|
|
1889
|
-
orderId,
|
|
1890
|
-
status,
|
|
1891
|
-
orderCrypto: typeof body.orderCrypto === "string" ? body.orderCrypto : null,
|
|
1892
|
-
orderCryptoAmount: typeof body.orderCryptoAmount === "string" ? body.orderCryptoAmount : null,
|
|
1893
|
-
transactionId: typeof body.transactionId === "string" ? body.transactionId : null,
|
|
1894
|
-
receivedAt: typeof body.receivedAt === "string" ? body.receivedAt : null,
|
|
1895
|
-
paidAmountUsd: numericOrNull(body.paidAmountUsd),
|
|
1896
|
-
paidAmountEur: numericOrNull(body.paidAmountEur),
|
|
1897
|
-
onrampFeeUsd: numericOrNull(body.onrampFeeUsd),
|
|
1898
|
-
paymentMethod: typeof body.paymentMethod === "string" ? body.paymentMethod : null
|
|
1899
|
-
};
|
|
1854
|
+
return swappedOrderFromView(orderId, body);
|
|
1900
1855
|
}
|
|
1901
1856
|
};
|
|
1902
1857
|
}
|
|
1858
|
+
var SWAPPED_ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
1859
|
+
"payment_pending",
|
|
1860
|
+
"order_completed",
|
|
1861
|
+
"order_broadcasted",
|
|
1862
|
+
"order_cancelled"
|
|
1863
|
+
]);
|
|
1864
|
+
function swappedOrderFromView(orderId, raw) {
|
|
1865
|
+
if (!raw || typeof raw !== "object") return null;
|
|
1866
|
+
const view = raw;
|
|
1867
|
+
if (view.provider !== "swapped") return null;
|
|
1868
|
+
const status = view.providerStatus;
|
|
1869
|
+
if (typeof status !== "string" || !SWAPPED_ORDER_STATUSES.has(status)) {
|
|
1870
|
+
return null;
|
|
1871
|
+
}
|
|
1872
|
+
const number = (v) => {
|
|
1873
|
+
const n = typeof v === "string" && v.trim() ? Number(v) : v;
|
|
1874
|
+
return typeof n === "number" && Number.isFinite(n) ? n : null;
|
|
1875
|
+
};
|
|
1876
|
+
const text = (v) => typeof v === "string" && v.length > 0 ? v : null;
|
|
1877
|
+
const railName = (v) => {
|
|
1878
|
+
const name = text(v);
|
|
1879
|
+
return name === "provider_selected" || name === "unknown" ? null : name;
|
|
1880
|
+
};
|
|
1881
|
+
const usdTotal = number(_optionalChain([view, 'access', _47 => _47.fiat, 'optionalAccess', _48 => _48.usd, 'optionalAccess', _49 => _49.total]));
|
|
1882
|
+
const usdNet = number(_optionalChain([view, 'access', _50 => _50.fiat, 'optionalAccess', _51 => _51.usd, 'optionalAccess', _52 => _52.net]));
|
|
1883
|
+
return {
|
|
1884
|
+
orderId,
|
|
1885
|
+
status,
|
|
1886
|
+
orderCrypto: text(_optionalChain([view, 'access', _53 => _53.crypto, 'optionalAccess', _54 => _54.asset])),
|
|
1887
|
+
orderCryptoAmount: text(_optionalChain([view, 'access', _55 => _55.crypto, 'optionalAccess', _56 => _56.amount])),
|
|
1888
|
+
transactionId: text(_optionalChain([view, 'access', _57 => _57.stages, 'optionalAccess', _58 => _58.delivery, 'optionalAccess', _59 => _59.txHash])),
|
|
1889
|
+
receivedAt: text(view.updatedAt),
|
|
1890
|
+
paidAmountUsd: _nullishCoalesce(usdTotal, () => ( usdNet)),
|
|
1891
|
+
paidAmountEur: _nullishCoalesce(number(_optionalChain([view, 'access', _60 => _60.fiat, 'optionalAccess', _61 => _61.eur, 'optionalAccess', _62 => _62.total])), () => ( number(_optionalChain([view, 'access', _63 => _63.fiat, 'optionalAccess', _64 => _64.eur, 'optionalAccess', _65 => _65.net])))),
|
|
1892
|
+
onrampFeeUsd: usdTotal !== null && usdNet !== null && usdTotal > usdNet ? Number((usdTotal - usdNet).toFixed(2)) : null,
|
|
1893
|
+
paymentMethod: railName(_nullishCoalesce(_optionalChain([view, 'access', _66 => _66.rail, 'optionalAccess', _67 => _67.method]), () => ( _optionalChain([view, 'access', _68 => _68.rail, 'optionalAccess', _69 => _69.connection]))))
|
|
1894
|
+
};
|
|
1895
|
+
}
|
|
1896
|
+
function parseAssetItem(raw, fields) {
|
|
1897
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
1898
|
+
const record = raw;
|
|
1899
|
+
const item = {};
|
|
1900
|
+
if (fields.includes("symbol")) {
|
|
1901
|
+
const symbol = record.symbol;
|
|
1902
|
+
item.symbol = typeof symbol === "string" && symbol.trim().length > 0 ? symbol.trim() : null;
|
|
1903
|
+
}
|
|
1904
|
+
if (fields.includes("decimals")) {
|
|
1905
|
+
const decimals = record.decimals;
|
|
1906
|
+
item.decimals = typeof decimals === "number" && Number.isInteger(decimals) && decimals >= 0 && decimals <= 255 ? decimals : null;
|
|
1907
|
+
}
|
|
1908
|
+
if (fields.includes("logo")) {
|
|
1909
|
+
const logo = record.logo;
|
|
1910
|
+
item.logo = typeof logo === "string" && logo.startsWith(ASSET_LOGO_PREFIX) ? logo : null;
|
|
1911
|
+
}
|
|
1912
|
+
if (fields.includes("price")) {
|
|
1913
|
+
const price = record.price;
|
|
1914
|
+
const usd = price && typeof price === "object" ? typeof price.usd === "string" && price.usd.trim() !== "" ? Number(price.usd) : typeof price.usd === "number" ? price.usd : Number.NaN : Number.NaN;
|
|
1915
|
+
item.priceUsd = Number.isFinite(usd) && usd > 0 ? usd : null;
|
|
1916
|
+
}
|
|
1917
|
+
const error = record.error;
|
|
1918
|
+
item.error = error && typeof error === "object" && typeof error.code === "string" ? { code: error.code } : null;
|
|
1919
|
+
return item;
|
|
1920
|
+
}
|
|
1903
1921
|
function normalizeDirectPortfolio(data) {
|
|
1904
1922
|
const rawTokens = _nullishCoalesce(_nullishCoalesce(extractArray(data, "tokens"), () => ( extractArray(
|
|
1905
|
-
_optionalChain([data, 'optionalAccess',
|
|
1923
|
+
_optionalChain([data, 'optionalAccess', _70 => _70.data]),
|
|
1906
1924
|
"tokens"
|
|
1907
1925
|
))), () => ( []));
|
|
1908
|
-
const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess',
|
|
1926
|
+
const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess', _71 => _71.data]), "totalUsd"))), () => ( 0));
|
|
1909
1927
|
const tokens = rawTokens.map((token) => normalizeDirectToken(token)).filter((token) => Boolean(token));
|
|
1910
1928
|
return { tokens, totalUsd };
|
|
1911
1929
|
}
|
|
1912
1930
|
function extractOrchestratorPortfolio(data) {
|
|
1913
1931
|
const portfolio = _nullishCoalesce(extractArray(data, "portfolio"), () => ( extractArray(
|
|
1914
|
-
_optionalChain([data, 'optionalAccess',
|
|
1932
|
+
_optionalChain([data, 'optionalAccess', _72 => _72.data]),
|
|
1915
1933
|
"portfolio"
|
|
1916
1934
|
)));
|
|
1917
1935
|
if (!portfolio || !Array.isArray(portfolio)) return null;
|
|
@@ -1922,23 +1940,16 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1922
1940
|
for (const tokenData of data.portfolio || []) {
|
|
1923
1941
|
const chainBalances = _nullishCoalesce(_nullishCoalesce(tokenData.tokenChainBalance, () => ( tokenData.chainBalances)), () => ( []));
|
|
1924
1942
|
for (const chainBalance of chainBalances) {
|
|
1925
|
-
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access',
|
|
1943
|
+
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _73 => _73.balance, 'optionalAccess', _74 => _74.unlocked]), () => ( "0"));
|
|
1926
1944
|
const normalizedName = tokenData.tokenName.trim();
|
|
1927
1945
|
const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
|
|
1928
|
-
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => (
|
|
1929
|
-
const resolvedTokenAddress = isNativeSymbol ?
|
|
1946
|
+
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => ( runtimeEvmAddress(chainBalance.chainId, normalizedName)));
|
|
1947
|
+
const resolvedTokenAddress = isNativeSymbol ? _chunkFKJ6EJHHcjs.NATIVE_TOKEN_ADDRESS : tokenAddress;
|
|
1930
1948
|
if (!resolvedTokenAddress) {
|
|
1931
1949
|
continue;
|
|
1932
1950
|
}
|
|
1933
|
-
const
|
|
1934
|
-
|
|
1935
|
-
chainBalance.chainId
|
|
1936
|
-
);
|
|
1937
|
-
const symbol = registrySymbol !== "Token" ? registrySymbol : normalizedName || "Token";
|
|
1938
|
-
const decimals = registrySymbol !== "Token" ? _chunkOY5N3E6Lcjs.getTokenDecimalsByAddress.call(void 0,
|
|
1939
|
-
resolvedTokenAddress,
|
|
1940
|
-
chainBalance.chainId
|
|
1941
|
-
) : _nullishCoalesce(tokenData.tokenDecimals, () => ( 18));
|
|
1951
|
+
const symbol = normalizedName || "Token";
|
|
1952
|
+
const decimals = _nullishCoalesce(tokenData.tokenDecimals, () => ( 18));
|
|
1942
1953
|
tokens.push({
|
|
1943
1954
|
chainId: chainBalance.chainId,
|
|
1944
1955
|
address: resolvedTokenAddress,
|
|
@@ -1958,28 +1969,26 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1958
1969
|
function normalizeDirectToken(token) {
|
|
1959
1970
|
const rawChainId = _nullishCoalesce(extractNumber(token, "chainId"), () => ( extractNumber(token.chain, "id")));
|
|
1960
1971
|
const rawChainString = _nullishCoalesce(extractString(token, "chainId"), () => ( extractString(token.chain, "id")));
|
|
1961
|
-
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ?
|
|
1972
|
+
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ? _chunkFKJ6EJHHcjs.isSolanaCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "solana" ? "solana" : (
|
|
1962
1973
|
// HyperCore is a non-EVM source under its own namespace; keep its
|
|
1963
1974
|
// USDC instead of dropping it as an unparseable chain string.
|
|
1964
|
-
|
|
1975
|
+
_chunkFKJ6EJHHcjs.isHyperCoreCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "hypercore" ? "hypercore" : _chunkFKJ6EJHHcjs.parseEvmChainId.call(void 0, rawChainString)
|
|
1965
1976
|
) : null)));
|
|
1966
1977
|
if (chainId === null) return null;
|
|
1967
|
-
const registryChainId = typeof chainId === "number" ? chainId : chainId === "hypercore" ? _chunkOY5N3E6Lcjs.HYPERCORE_CHAIN_ID : void 0;
|
|
1968
1978
|
const symbol = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "symbol"), () => ( extractString(token, "tokenSymbol"))), () => ( extractString(token, "tokenName"))), () => ( extractString(token, "name")));
|
|
1969
1979
|
if (!symbol) return null;
|
|
1970
|
-
const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call',
|
|
1980
|
+
const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call', _75 => _75(token, "balance"), 'optionalAccess', _76 => _76.toString, 'call', _77 => _77()]))), () => ( _optionalChain([extractNumber, 'call', _78 => _78(token, "amount"), 'optionalAccess', _79 => _79.toString, 'call', _80 => _80()]))), () => ( _optionalChain([extractNumber, 'call', _81 => _81(token, "value"), 'optionalAccess', _82 => _82.toString, 'call', _83 => _83()]))), () => ( _optionalChain([extractNumber, 'call', _84 => _84(token, "rawBalance"), 'optionalAccess', _85 => _85.toString, 'call', _86 => _86()])));
|
|
1971
1981
|
if (!balanceValue) return null;
|
|
1972
1982
|
const address = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "address"), () => ( extractString(token, "tokenAddress"))), () => ( extractString(
|
|
1973
1983
|
token.token,
|
|
1974
1984
|
"address"
|
|
1975
|
-
))), () => ( (
|
|
1985
|
+
))), () => ( (chainId === "hypercore" ? _optionalChain([hyperCoreSourceToken, 'call', _87 => _87(void 0, symbol), 'optionalAccess', _88 => _88.address]) : typeof chainId === "number" ? runtimeEvmAddress(chainId, symbol) : void 0)));
|
|
1976
1986
|
if (!address) return null;
|
|
1977
1987
|
const balanceUsd = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractNumber(token, "balanceUsd"), () => ( extractNumber(token, "usdValue"))), () => ( extractNumber(token, "valueUsd"))), () => ( extractNumericString(token, "balanceUsd"))), () => ( extractNumericString(token, "usdValue"))), () => ( extractNumericString(token, "valueUsd"))), () => ( 0));
|
|
1978
|
-
const isSolanaToken = chainId === "solana";
|
|
1979
|
-
const registrySymbol = isSolanaToken ? "Token" : _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, address, registryChainId);
|
|
1980
|
-
const resolvedSymbol = isSolanaToken ? symbol : registrySymbol !== "Token" ? registrySymbol : symbol;
|
|
1981
1988
|
const backendDecimals = _nullishCoalesce(extractNumber(token, "decimals"), () => ( extractNumber(token, "tokenDecimals")));
|
|
1982
|
-
const
|
|
1989
|
+
const hyperCore = chainId === "hypercore" ? hyperCoreSourceToken(address, symbol) : void 0;
|
|
1990
|
+
const resolvedSymbol = _nullishCoalesce(_optionalChain([hyperCore, 'optionalAccess', _89 => _89.symbol]), () => ( symbol));
|
|
1991
|
+
const resolvedDecimals = _nullishCoalesce(_nullishCoalesce(_optionalChain([hyperCore, 'optionalAccess', _90 => _90.decimals]), () => ( backendDecimals)), () => ( 18));
|
|
1983
1992
|
return {
|
|
1984
1993
|
chainId,
|
|
1985
1994
|
address,
|
|
@@ -1990,9 +1999,18 @@ function normalizeDirectToken(token) {
|
|
|
1990
1999
|
balanceUsd
|
|
1991
2000
|
};
|
|
1992
2001
|
}
|
|
2002
|
+
function runtimeEvmAddress(chainId, symbol) {
|
|
2003
|
+
const token = getRuntimeToken(chainId, symbol);
|
|
2004
|
+
return token && /^0x[a-fA-F0-9]{40}$/.test(token.address) ? token.address : void 0;
|
|
2005
|
+
}
|
|
2006
|
+
function hyperCoreSourceToken(address, symbol) {
|
|
2007
|
+
return _chunkFKJ6EJHHcjs.HYPERCORE_SOURCE_TOKENS.find(
|
|
2008
|
+
(t) => address ? t.address.toLowerCase() === address.toLowerCase() : t.symbol.toUpperCase() === symbol.trim().toUpperCase()
|
|
2009
|
+
);
|
|
2010
|
+
}
|
|
1993
2011
|
function extractTokenAddress(tokenData, chainId) {
|
|
1994
2012
|
const token = tokenData;
|
|
1995
|
-
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access',
|
|
2013
|
+
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access', _91 => _91.addresses, 'optionalAccess', _92 => _92[chainId]]))), () => ( _optionalChain([token, 'access', _93 => _93.token, 'optionalAccess', _94 => _94.address]))), () => ( _optionalChain([token, 'access', _95 => _95.token, 'optionalAccess', _96 => _96.addresses, 'optionalAccess', _97 => _97[chainId]])));
|
|
1996
2014
|
}
|
|
1997
2015
|
function extractArray(data, key) {
|
|
1998
2016
|
if (!data || typeof data !== "object") return null;
|
|
@@ -2022,7 +2040,7 @@ function extractNumericString(data, key) {
|
|
|
2022
2040
|
// src/core/rpc.ts
|
|
2023
2041
|
|
|
2024
2042
|
function rpcUrlFor(rpcUrls, chain) {
|
|
2025
|
-
const url = _optionalChain([rpcUrls, 'optionalAccess',
|
|
2043
|
+
const url = _optionalChain([rpcUrls, 'optionalAccess', _98 => _98[chain], 'optionalAccess', _99 => _99.trim, 'call', _100 => _100()]);
|
|
2026
2044
|
return url ? url : void 0;
|
|
2027
2045
|
}
|
|
2028
2046
|
var RpcUrlsContext = _react.createContext.call(void 0, void 0);
|
|
@@ -2032,7 +2050,7 @@ function useRpcUrls() {
|
|
|
2032
2050
|
}
|
|
2033
2051
|
function rpcUrlsKey(rpcUrls) {
|
|
2034
2052
|
if (!rpcUrls) return "";
|
|
2035
|
-
return Object.entries(rpcUrls).map(([chain, url]) => [chain, _nullishCoalesce(_optionalChain([url, 'optionalAccess',
|
|
2053
|
+
return Object.entries(rpcUrls).map(([chain, url]) => [chain, _nullishCoalesce(_optionalChain([url, 'optionalAccess', _101 => _101.trim, 'call', _102 => _102()]), () => ( ""))]).filter(([, url]) => url !== "").map(([chain, url]) => `${chain}=${url}`).sort().join("|");
|
|
2036
2054
|
}
|
|
2037
2055
|
function useStableRpcUrls(rpcUrls) {
|
|
2038
2056
|
const key = rpcUrlsKey(rpcUrls);
|
|
@@ -2054,15 +2072,15 @@ function useStableRpcUrls(rpcUrls) {
|
|
|
2054
2072
|
|
|
2055
2073
|
function findListed(options, chain, token) {
|
|
2056
2074
|
const normalize2 = (value) => chain === "solana" ? value : value.toLowerCase();
|
|
2057
|
-
return _optionalChain([options, 'access',
|
|
2075
|
+
return _optionalChain([options, 'access', _103 => _103.tokens, 'access', _104 => _104[String(chain)], 'optionalAccess', _105 => _105.find, 'call', _106 => _106(
|
|
2058
2076
|
(listed) => normalize2(listed.address) === normalize2(token)
|
|
2059
2077
|
)]);
|
|
2060
2078
|
}
|
|
2061
2079
|
function isExcludedByRestrictedList(options, chain, token) {
|
|
2062
|
-
return Boolean(_optionalChain([options, 'optionalAccess',
|
|
2080
|
+
return Boolean(_optionalChain([options, 'optionalAccess', _107 => _107.restricted]) && !findListed(options, chain, token));
|
|
2063
2081
|
}
|
|
2064
2082
|
function findDepositBounds(options, chain, token) {
|
|
2065
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
2083
|
+
if (!_optionalChain([options, 'optionalAccess', _108 => _108.restricted])) return void 0;
|
|
2066
2084
|
const entry = findListed(options, chain, token);
|
|
2067
2085
|
if (!entry || entry.minAmount === void 0 && entry.maxAmount === void 0) {
|
|
2068
2086
|
return void 0;
|
|
@@ -2075,7 +2093,7 @@ function findDepositBounds(options, chain, token) {
|
|
|
2075
2093
|
};
|
|
2076
2094
|
}
|
|
2077
2095
|
function boundMessage(bounds, bound) {
|
|
2078
|
-
const raw = _optionalChain([bounds, 'optionalAccess',
|
|
2096
|
+
const raw = _optionalChain([bounds, 'optionalAccess', _109 => _109[bound]]);
|
|
2079
2097
|
if (!bounds || raw === void 0) return null;
|
|
2080
2098
|
const amount = new Intl.NumberFormat("en-US", {
|
|
2081
2099
|
maximumFractionDigits: Math.min(bounds.decimals, 20)
|
|
@@ -2174,7 +2192,7 @@ async function loadViemChains() {
|
|
|
2174
2192
|
viemChainsPromise = Promise.resolve().then(() => _interopRequireWildcard(require("viem/chains"))).then((module) => {
|
|
2175
2193
|
const map = /* @__PURE__ */ new Map();
|
|
2176
2194
|
for (const value of Object.values(module)) {
|
|
2177
|
-
if (value && typeof value === "object" && typeof value.id === "number" && _optionalChain([value, 'access',
|
|
2195
|
+
if (value && typeof value === "object" && typeof value.id === "number" && _optionalChain([value, 'access', _110 => _110.rpcUrls, 'optionalAccess', _111 => _111.default, 'optionalAccess', _112 => _112.http, 'optionalAccess', _113 => _113.length])) {
|
|
2178
2196
|
const chain = value;
|
|
2179
2197
|
const existing = map.get(chain.id);
|
|
2180
2198
|
if (existing) existing.push(chain);
|
|
@@ -2188,7 +2206,7 @@ async function loadViemChains() {
|
|
|
2188
2206
|
return viemChainsPromise;
|
|
2189
2207
|
}
|
|
2190
2208
|
function pickViemChain(candidates, chain) {
|
|
2191
|
-
if (!_optionalChain([candidates, 'optionalAccess',
|
|
2209
|
+
if (!_optionalChain([candidates, 'optionalAccess', _114 => _114.length])) return void 0;
|
|
2192
2210
|
if (candidates.length === 1) return candidates[0];
|
|
2193
2211
|
const sameNetworkClass = candidates.filter(
|
|
2194
2212
|
(candidate) => Boolean(candidate.testnet) === chain.testnet
|
|
@@ -2204,10 +2222,10 @@ function pickViemChain(candidates, chain) {
|
|
|
2204
2222
|
}
|
|
2205
2223
|
function resolveRpcUrls(chain, override, viemChains) {
|
|
2206
2224
|
const urls = [];
|
|
2207
|
-
if (_optionalChain([override, 'optionalAccess',
|
|
2225
|
+
if (_optionalChain([override, 'optionalAccess', _115 => _115.trim, 'call', _116 => _116()])) urls.push(override.trim());
|
|
2208
2226
|
if (chain.publicRpcUrl) urls.push(chain.publicRpcUrl);
|
|
2209
2227
|
if (chain.chainId !== null && chain.vmType === "evm") {
|
|
2210
|
-
const http2 = _optionalChain([pickViemChain, 'call',
|
|
2228
|
+
const http2 = _optionalChain([pickViemChain, 'call', _117 => _117(_optionalChain([viemChains, 'optionalAccess', _118 => _118.get, 'call', _119 => _119(chain.chainId)]), chain), 'optionalAccess', _120 => _120.rpcUrls, 'optionalAccess', _121 => _121.default, 'optionalAccess', _122 => _122.http]);
|
|
2211
2229
|
if (http2) urls.push(...http2);
|
|
2212
2230
|
}
|
|
2213
2231
|
return [...new Set(urls)];
|
|
@@ -2216,7 +2234,7 @@ function toViemChain(chain, override, viemChains) {
|
|
|
2216
2234
|
if (chain.vmType !== "evm" || chain.chainId === null) return null;
|
|
2217
2235
|
const rpcUrls = resolveRpcUrls(chain, override, viemChains);
|
|
2218
2236
|
if (rpcUrls.length === 0) return null;
|
|
2219
|
-
const bundled = pickViemChain(_optionalChain([viemChains, 'optionalAccess',
|
|
2237
|
+
const bundled = pickViemChain(_optionalChain([viemChains, 'optionalAccess', _123 => _123.get, 'call', _124 => _124(chain.chainId)]), chain);
|
|
2220
2238
|
if (bundled) {
|
|
2221
2239
|
if (rpcUrls[0] === bundled.rpcUrls.default.http[0]) return bundled;
|
|
2222
2240
|
return _viem.defineChain.call(void 0, {
|
|
@@ -2247,7 +2265,7 @@ function toViemChains(catalog, overrides, viemChains) {
|
|
|
2247
2265
|
for (const entry of catalog.all) {
|
|
2248
2266
|
const chain = toViemChain(
|
|
2249
2267
|
entry,
|
|
2250
|
-
entry.chainId === null ? void 0 : _optionalChain([overrides, 'optionalAccess',
|
|
2268
|
+
entry.chainId === null ? void 0 : _optionalChain([overrides, 'optionalAccess', _125 => _125[entry.chainId]]),
|
|
2251
2269
|
viemChains
|
|
2252
2270
|
);
|
|
2253
2271
|
if (chain) chains.push(chain);
|
|
@@ -2256,7 +2274,7 @@ function toViemChains(catalog, overrides, viemChains) {
|
|
|
2256
2274
|
}
|
|
2257
2275
|
function needsViemChains(catalog, overrides) {
|
|
2258
2276
|
return catalog.all.some(
|
|
2259
|
-
(chain) => chain.vmType === "evm" && chain.chainId !== null && !chain.publicRpcUrl && !_optionalChain([overrides, 'optionalAccess',
|
|
2277
|
+
(chain) => chain.vmType === "evm" && chain.chainId !== null && !chain.publicRpcUrl && !_optionalChain([overrides, 'optionalAccess', _126 => _126[chain.chainId], 'optionalAccess', _127 => _127.trim, 'call', _128 => _128()])
|
|
2260
2278
|
);
|
|
2261
2279
|
}
|
|
2262
2280
|
|
|
@@ -2300,9 +2318,9 @@ function peekRuntimeChains(backendUrl, overrides) {
|
|
|
2300
2318
|
return _nullishCoalesce(resolvedChainsByKey.get(runtimeChainsKey(backendUrl, overrides)), () => ( null));
|
|
2301
2319
|
}
|
|
2302
2320
|
function publishCatalogTokens(catalog) {
|
|
2303
|
-
|
|
2321
|
+
setRuntimeTokens(
|
|
2304
2322
|
catalog.all.flatMap((chain) => {
|
|
2305
|
-
const chainId =
|
|
2323
|
+
const chainId = _chunkFKJ6EJHHcjs.displayChainIdForCaip2.call(void 0, chain.caip2);
|
|
2306
2324
|
if (chainId === null || !Array.isArray(chain.supportedTokens)) return [];
|
|
2307
2325
|
const tokens = chain.supportedTokens.map((token) => ({
|
|
2308
2326
|
chainId,
|
|
@@ -2323,21 +2341,22 @@ function publishCatalogTokens(catalog) {
|
|
|
2323
2341
|
);
|
|
2324
2342
|
}
|
|
2325
2343
|
function publishRuntimeChainMeta(catalog) {
|
|
2326
|
-
|
|
2344
|
+
_chunkFKJ6EJHHcjs.setRuntimeChainMeta.call(void 0,
|
|
2327
2345
|
catalog.all.flatMap((chain) => {
|
|
2328
2346
|
const ids = [];
|
|
2329
2347
|
if (chain.chainId !== null) ids.push(chain.chainId);
|
|
2330
|
-
const sentinel =
|
|
2348
|
+
const sentinel = _chunkFKJ6EJHHcjs.displayChainIdForCaip2.call(void 0, chain.caip2);
|
|
2331
2349
|
if (sentinel !== null && sentinel !== chain.chainId) ids.push(sentinel);
|
|
2332
|
-
if (
|
|
2350
|
+
if (_chunkFKJ6EJHHcjs.isHyperCoreCaip2.call(void 0, chain.caip2)) ids.push(_chunkFKJ6EJHHcjs.HYPERCORE_CHAIN_ID);
|
|
2333
2351
|
return ids.map((chainId) => ({
|
|
2334
2352
|
chainId,
|
|
2335
2353
|
name: chain.name,
|
|
2336
2354
|
iconUrl: _nullishCoalesce(chain.iconUrl, () => ( void 0)),
|
|
2337
2355
|
nativeSymbol: chain.nativeToken.symbol,
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2356
|
+
nativeDecimals: chain.nativeToken.decimals,
|
|
2357
|
+
explorerUrl: _optionalChain([chain, 'access', _129 => _129.explorer, 'optionalAccess', _130 => _130.url]),
|
|
2358
|
+
explorerTxPath: _optionalChain([chain, 'access', _131 => _131.explorer, 'optionalAccess', _132 => _132.txPath]),
|
|
2359
|
+
explorerAddressPath: _optionalChain([chain, 'access', _133 => _133.explorer, 'optionalAccess', _134 => _134.addressPath])
|
|
2341
2360
|
}));
|
|
2342
2361
|
})
|
|
2343
2362
|
);
|
|
@@ -2387,8 +2406,8 @@ function useDepositChainIds() {
|
|
|
2387
2406
|
!c.testnet
|
|
2388
2407
|
).map((c) => c.chainId);
|
|
2389
2408
|
const rank = (id) => {
|
|
2390
|
-
const i =
|
|
2391
|
-
return i === -1 ?
|
|
2409
|
+
const i = _chunkFKJ6EJHHcjs.CHAIN_DISPLAY_ORDER.indexOf(id);
|
|
2410
|
+
return i === -1 ? _chunkFKJ6EJHHcjs.CHAIN_DISPLAY_ORDER.length : i;
|
|
2392
2411
|
};
|
|
2393
2412
|
return ids.map((id, i) => ({ id, i })).sort((a, b) => rank(a.id) - rank(b.id) || a.i - b.i).map(({ id }) => id);
|
|
2394
2413
|
}, [catalog]);
|
|
@@ -2398,8 +2417,8 @@ function useDestinationChains() {
|
|
|
2398
2417
|
return _react.useMemo.call(void 0, () => {
|
|
2399
2418
|
if (!catalog) return [];
|
|
2400
2419
|
const rank = (id) => {
|
|
2401
|
-
const i =
|
|
2402
|
-
return i === -1 ?
|
|
2420
|
+
const i = _chunkFKJ6EJHHcjs.CHAIN_DISPLAY_ORDER.indexOf(id);
|
|
2421
|
+
return i === -1 ? _chunkFKJ6EJHHcjs.CHAIN_DISPLAY_ORDER.length : i;
|
|
2403
2422
|
};
|
|
2404
2423
|
return catalog.all.filter(
|
|
2405
2424
|
(c) => c.destination && c.vmType === "evm" && c.chainId !== null && !c.testnet
|
|
@@ -2410,7 +2429,7 @@ function useTargetTokens() {
|
|
|
2410
2429
|
const { catalog, shortlist } = useChainCatalog();
|
|
2411
2430
|
return _react.useMemo.call(void 0, () => {
|
|
2412
2431
|
return (chainId) => {
|
|
2413
|
-
const fromShortlist = _optionalChain([shortlist, 'optionalAccess',
|
|
2432
|
+
const fromShortlist = _optionalChain([shortlist, 'optionalAccess', _135 => _135[String(chainId)]]);
|
|
2414
2433
|
if (fromShortlist) {
|
|
2415
2434
|
return fromShortlist.map((token) => ({
|
|
2416
2435
|
symbol: token.symbol,
|
|
@@ -2418,8 +2437,8 @@ function useTargetTokens() {
|
|
|
2418
2437
|
decimals: token.decimals
|
|
2419
2438
|
}));
|
|
2420
2439
|
}
|
|
2421
|
-
const entry = _optionalChain([catalog, 'optionalAccess',
|
|
2422
|
-
return Array.isArray(_optionalChain([entry, 'optionalAccess',
|
|
2440
|
+
const entry = _optionalChain([catalog, 'optionalAccess', _136 => _136.byChainId, 'access', _137 => _137.get, 'call', _138 => _138(chainId)]);
|
|
2441
|
+
return Array.isArray(_optionalChain([entry, 'optionalAccess', _139 => _139.supportedTokens])) ? entry.supportedTokens.map((token) => ({
|
|
2423
2442
|
symbol: token.symbol,
|
|
2424
2443
|
address: token.address,
|
|
2425
2444
|
decimals: token.decimals
|
|
@@ -2429,12 +2448,12 @@ function useTargetTokens() {
|
|
|
2429
2448
|
}
|
|
2430
2449
|
function createDepositOffer(state, retry) {
|
|
2431
2450
|
const options = state.status === "ready" ? state.options : null;
|
|
2432
|
-
const restricted = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2433
|
-
const listed = (chain) => _optionalChain([options, 'optionalAccess',
|
|
2451
|
+
const restricted = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _140 => _140.restricted]), () => ( false));
|
|
2452
|
+
const listed = (chain) => _optionalChain([options, 'optionalAccess', _141 => _141.tokens, 'access', _142 => _142[String(chain)]]);
|
|
2434
2453
|
const isChainOffered = (chain) => {
|
|
2435
2454
|
if (!options) return false;
|
|
2436
2455
|
const entry = listed(chain);
|
|
2437
|
-
return restricted ? (_nullishCoalesce(_optionalChain([entry, 'optionalAccess',
|
|
2456
|
+
return restricted ? (_nullishCoalesce(_optionalChain([entry, 'optionalAccess', _143 => _143.length]), () => ( 0))) > 0 : _optionalChain([entry, 'optionalAccess', _144 => _144.length]) !== 0;
|
|
2438
2457
|
};
|
|
2439
2458
|
return {
|
|
2440
2459
|
status: state.status,
|
|
@@ -2481,10 +2500,10 @@ function useChainName() {
|
|
|
2481
2500
|
const { catalog } = useChainCatalog();
|
|
2482
2501
|
return _react.useMemo.call(void 0, () => {
|
|
2483
2502
|
return (chainId) => {
|
|
2484
|
-
if (!catalog) return
|
|
2503
|
+
if (!catalog) return _chunkFKJ6EJHHcjs.getChainName.call(void 0, chainId);
|
|
2485
2504
|
const key = catalogKeyForChain(chainId);
|
|
2486
2505
|
const entry = typeof key === "number" ? catalog.byChainId.get(key) : catalog.byCaip2.get(key);
|
|
2487
|
-
return _nullishCoalesce(_optionalChain([entry, 'optionalAccess',
|
|
2506
|
+
return _nullishCoalesce(_optionalChain([entry, 'optionalAccess', _145 => _145.name]), () => ( _chunkFKJ6EJHHcjs.getChainName.call(void 0, chainId)));
|
|
2488
2507
|
};
|
|
2489
2508
|
}, [catalog]);
|
|
2490
2509
|
}
|
|
@@ -2496,20 +2515,20 @@ function useRuntimeChainsVersion() {
|
|
|
2496
2515
|
);
|
|
2497
2516
|
}
|
|
2498
2517
|
function useReadClient(chainId, rpcUrls) {
|
|
2499
|
-
const
|
|
2518
|
+
const version2 = useRuntimeChainsVersion();
|
|
2500
2519
|
return _react.useMemo.call(void 0,
|
|
2501
2520
|
() => getPublicClient(chainId, rpcUrls),
|
|
2502
|
-
[chainId, rpcUrls,
|
|
2521
|
+
[chainId, rpcUrls, version2]
|
|
2503
2522
|
);
|
|
2504
2523
|
}
|
|
2505
2524
|
function useExplorerTxUrl() {
|
|
2506
2525
|
const { catalog } = useChainCatalog();
|
|
2507
2526
|
return _react.useMemo.call(void 0, () => {
|
|
2508
2527
|
return (chainId, txHash) => {
|
|
2509
|
-
if (chainId === "hypercore") return
|
|
2528
|
+
if (chainId === "hypercore") return _chunkFKJ6EJHHcjs.getExplorerTxUrl.call(void 0, chainId, txHash);
|
|
2510
2529
|
const key = catalog ? catalogKeyForChain(chainId) : void 0;
|
|
2511
|
-
const entry = key === void 0 ? void 0 : typeof key === "number" ? _optionalChain([catalog, 'optionalAccess',
|
|
2512
|
-
return _nullishCoalesce(catalogExplorerTxUrl(entry, txHash), () => (
|
|
2530
|
+
const entry = key === void 0 ? void 0 : typeof key === "number" ? _optionalChain([catalog, 'optionalAccess', _146 => _146.byChainId, 'access', _147 => _147.get, 'call', _148 => _148(key)]) : _optionalChain([catalog, 'optionalAccess', _149 => _149.byCaip2, 'access', _150 => _150.get, 'call', _151 => _151(key)]);
|
|
2531
|
+
return _nullishCoalesce(catalogExplorerTxUrl(entry, txHash), () => ( _chunkFKJ6EJHHcjs.getExplorerTxUrl.call(void 0, chainId, txHash)));
|
|
2513
2532
|
};
|
|
2514
2533
|
}, [catalog]);
|
|
2515
2534
|
}
|
|
@@ -2571,11 +2590,11 @@ function ChainCatalogProvider({
|
|
|
2571
2590
|
service.getTopTokens().then(
|
|
2572
2591
|
(result) => {
|
|
2573
2592
|
if (!active) return;
|
|
2574
|
-
if (!_optionalChain([result, 'optionalAccess',
|
|
2593
|
+
if (!_optionalChain([result, 'optionalAccess', _152 => _152.ok])) {
|
|
2575
2594
|
setDepositOptions({ status: "error" });
|
|
2576
2595
|
return;
|
|
2577
2596
|
}
|
|
2578
|
-
|
|
2597
|
+
publishShortlistTokens(result.options.tokens);
|
|
2579
2598
|
setDepositOptions({ status: "ready", options: result.options });
|
|
2580
2599
|
},
|
|
2581
2600
|
() => {
|
|
@@ -2620,14 +2639,290 @@ function ChainCatalogProvider({
|
|
|
2620
2639
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChainCatalogContext.Provider, { value, children });
|
|
2621
2640
|
}
|
|
2622
2641
|
|
|
2623
|
-
// src/core/
|
|
2642
|
+
// src/core/asset-metadata.tsx
|
|
2643
|
+
|
|
2644
|
+
|
|
2645
|
+
|
|
2646
|
+
|
|
2647
|
+
|
|
2624
2648
|
|
|
2625
|
-
|
|
2626
|
-
|
|
2649
|
+
|
|
2650
|
+
|
|
2651
|
+
// src/core/asset-id.ts
|
|
2652
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
2653
|
+
var EVM_ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
|
|
2654
|
+
var BASE58_RE = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
2655
|
+
var SOLANA_SYSTEM_PROGRAM2 = "11111111111111111111111111111111";
|
|
2656
|
+
function isNativeSpelling(chain, address) {
|
|
2657
|
+
if (chain === "solana") {
|
|
2658
|
+
return address === "native" || address === SOLANA_SYSTEM_PROGRAM2;
|
|
2659
|
+
}
|
|
2660
|
+
if (chain === "stellar") return address === "native";
|
|
2661
|
+
if (chain === "tron") return address === "native" || address === ZERO_ADDRESS;
|
|
2662
|
+
return address.toLowerCase() === ZERO_ADDRESS;
|
|
2663
|
+
}
|
|
2664
|
+
function assetIdFor(chain, address) {
|
|
2665
|
+
if (chain === void 0 || !address) return void 0;
|
|
2666
|
+
const native = isNativeSpelling(chain, address);
|
|
2667
|
+
if (chain === "hypercore" || chain === _chunkFKJ6EJHHcjs.HYPERCORE_CHAIN_ID) {
|
|
2668
|
+
if (!EVM_ADDRESS_RE.test(address)) return void 0;
|
|
2669
|
+
return `${_chunkFKJ6EJHHcjs.HYPERCORE_SPOT_CAIP2}:${native ? "native" : address.toLowerCase()}`;
|
|
2670
|
+
}
|
|
2671
|
+
if (typeof chain === "number") {
|
|
2672
|
+
if (!EVM_ADDRESS_RE.test(address)) return void 0;
|
|
2673
|
+
return `${_chunkFKJ6EJHHcjs.toEvmCaip2.call(void 0, chain)}:${native ? "native" : address.toLowerCase()}`;
|
|
2674
|
+
}
|
|
2675
|
+
if (chain === "solana") {
|
|
2676
|
+
if (native) return `${_chunkFKJ6EJHHcjs.SOLANA_MAINNET_CAIP2}:native`;
|
|
2677
|
+
return BASE58_RE.test(address) ? `${_chunkFKJ6EJHHcjs.SOLANA_MAINNET_CAIP2}:${address}` : void 0;
|
|
2678
|
+
}
|
|
2679
|
+
const caip2 = chain === "tron" ? _chunkFKJ6EJHHcjs.TRON_MAINNET_CAIP2 : _chunkFKJ6EJHHcjs.STELLAR_PUBNET_CAIP2;
|
|
2680
|
+
return `${caip2}:${native ? "native" : address}`;
|
|
2681
|
+
}
|
|
2682
|
+
function assetIdForRef(ref) {
|
|
2683
|
+
return ref ? assetIdFor(ref.chain, ref.address) : void 0;
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
// src/core/asset-metadata.tsx
|
|
2687
|
+
|
|
2688
|
+
var ASSET_RETRY_MS = 6e4;
|
|
2689
|
+
var ASSET_PRICE_TTL_MS = 6e4;
|
|
2690
|
+
var META_FIELDS = ["symbol", "decimals", "logo"];
|
|
2691
|
+
var PRICE_FIELDS = ["price"];
|
|
2692
|
+
var TERMINAL_ITEM_ERRORS = /* @__PURE__ */ new Set([
|
|
2693
|
+
"not_found",
|
|
2694
|
+
"unsupported_chain",
|
|
2695
|
+
"invalid_id"
|
|
2696
|
+
]);
|
|
2697
|
+
function createAssetStore(service, now = Date.now) {
|
|
2698
|
+
const meta = /* @__PURE__ */ new Map();
|
|
2699
|
+
const prices = /* @__PURE__ */ new Map();
|
|
2700
|
+
const metaInFlight = /* @__PURE__ */ new Set();
|
|
2701
|
+
const priceInFlight = /* @__PURE__ */ new Set();
|
|
2702
|
+
let metaQueue = /* @__PURE__ */ new Set();
|
|
2703
|
+
let priceQueue = /* @__PURE__ */ new Set();
|
|
2704
|
+
let flushScheduled = false;
|
|
2705
|
+
let routeMissing = false;
|
|
2706
|
+
let version2 = 0;
|
|
2707
|
+
const listeners2 = /* @__PURE__ */ new Set();
|
|
2708
|
+
function notify() {
|
|
2709
|
+
version2 += 1;
|
|
2710
|
+
for (const listener of [...listeners2]) listener();
|
|
2711
|
+
}
|
|
2712
|
+
function idsFor(refs) {
|
|
2713
|
+
const ids = [];
|
|
2714
|
+
for (const ref of refs) {
|
|
2715
|
+
const id = assetIdForRef(ref);
|
|
2716
|
+
if (!id) continue;
|
|
2717
|
+
ids.push(id);
|
|
2718
|
+
}
|
|
2719
|
+
return ids;
|
|
2720
|
+
}
|
|
2721
|
+
function scheduleFlush() {
|
|
2722
|
+
if (flushScheduled) return;
|
|
2723
|
+
flushScheduled = true;
|
|
2724
|
+
queueMicrotask(() => {
|
|
2725
|
+
flushScheduled = false;
|
|
2726
|
+
const metaIds = [...metaQueue];
|
|
2727
|
+
const priceIds = [...priceQueue];
|
|
2728
|
+
metaQueue = /* @__PURE__ */ new Set();
|
|
2729
|
+
priceQueue = /* @__PURE__ */ new Set();
|
|
2730
|
+
if (metaIds.length > 0) void flushMeta(metaIds);
|
|
2731
|
+
if (priceIds.length > 0) void flushPrices(priceIds);
|
|
2732
|
+
});
|
|
2733
|
+
}
|
|
2734
|
+
function needsMeta(id) {
|
|
2735
|
+
if (metaInFlight.has(id) || metaQueue.has(id)) return false;
|
|
2736
|
+
const entry = meta.get(id);
|
|
2737
|
+
if (!entry) return true;
|
|
2738
|
+
if (entry.status === "missing" || entry.status === "pending") return false;
|
|
2739
|
+
if (entry.status === "failed" && routeMissing) return false;
|
|
2740
|
+
return entry.retryAt !== void 0 && now() >= entry.retryAt;
|
|
2741
|
+
}
|
|
2742
|
+
function needsPrice(id) {
|
|
2743
|
+
if (priceInFlight.has(id) || priceQueue.has(id)) return false;
|
|
2744
|
+
const entry = prices.get(id);
|
|
2745
|
+
return !entry || now() - entry.at >= ASSET_PRICE_TTL_MS;
|
|
2746
|
+
}
|
|
2747
|
+
async function lookup2(ids, fields) {
|
|
2748
|
+
try {
|
|
2749
|
+
return await service.lookupAssets(ids, fields);
|
|
2750
|
+
} catch (e6) {
|
|
2751
|
+
return { ok: false, routeMissing: false };
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
async function flushMeta(ids) {
|
|
2755
|
+
for (const id of ids) metaInFlight.add(id);
|
|
2756
|
+
const result = await lookup2(ids, META_FIELDS);
|
|
2757
|
+
const at = now();
|
|
2758
|
+
for (const id of ids) {
|
|
2759
|
+
metaInFlight.delete(id);
|
|
2760
|
+
const previous = meta.get(id);
|
|
2761
|
+
if (!result.ok) {
|
|
2762
|
+
if (result.routeMissing) routeMissing = true;
|
|
2763
|
+
meta.set(id, {
|
|
2764
|
+
...previous,
|
|
2765
|
+
status: _optionalChain([previous, 'optionalAccess', _153 => _153.status]) === "ready" ? "ready" : "failed",
|
|
2766
|
+
retryAt: at + ASSET_RETRY_MS
|
|
2767
|
+
});
|
|
2768
|
+
continue;
|
|
2769
|
+
}
|
|
2770
|
+
const item = result.items[id];
|
|
2771
|
+
const code = _optionalChain([item, 'optionalAccess', _154 => _154.error, 'optionalAccess', _155 => _155.code]);
|
|
2772
|
+
if (!item || code && TERMINAL_ITEM_ERRORS.has(code)) {
|
|
2773
|
+
meta.set(id, { status: "missing" });
|
|
2774
|
+
continue;
|
|
2775
|
+
}
|
|
2776
|
+
meta.set(id, {
|
|
2777
|
+
status: "ready",
|
|
2778
|
+
symbol: _nullishCoalesce(item.symbol, () => ( _optionalChain([previous, 'optionalAccess', _156 => _156.symbol]))),
|
|
2779
|
+
decimals: _nullishCoalesce(item.decimals, () => ( _optionalChain([previous, 'optionalAccess', _157 => _157.decimals]))),
|
|
2780
|
+
logo: _nullishCoalesce(item.logo, () => ( _optionalChain([previous, 'optionalAccess', _158 => _158.logo]))),
|
|
2781
|
+
retryAt: code ? at + ASSET_RETRY_MS : void 0
|
|
2782
|
+
});
|
|
2783
|
+
}
|
|
2784
|
+
notify();
|
|
2785
|
+
}
|
|
2786
|
+
async function flushPrices(ids) {
|
|
2787
|
+
for (const id of ids) priceInFlight.add(id);
|
|
2788
|
+
const result = await lookup2(ids, PRICE_FIELDS);
|
|
2789
|
+
const at = now();
|
|
2790
|
+
for (const id of ids) {
|
|
2791
|
+
priceInFlight.delete(id);
|
|
2792
|
+
prices.set(id, {
|
|
2793
|
+
usd: result.ok ? _nullishCoalesce(_optionalChain([result, 'access', _159 => _159.items, 'access', _160 => _160[id], 'optionalAccess', _161 => _161.priceUsd]), () => ( null)) : null,
|
|
2794
|
+
at
|
|
2795
|
+
});
|
|
2796
|
+
}
|
|
2797
|
+
notify();
|
|
2798
|
+
}
|
|
2799
|
+
function requestMeta(refs) {
|
|
2800
|
+
let queued = false;
|
|
2801
|
+
for (const id of idsFor(refs)) {
|
|
2802
|
+
if (!needsMeta(id)) continue;
|
|
2803
|
+
metaQueue.add(id);
|
|
2804
|
+
queued = true;
|
|
2805
|
+
}
|
|
2806
|
+
if (queued) scheduleFlush();
|
|
2807
|
+
}
|
|
2808
|
+
function requestPrices(refs) {
|
|
2809
|
+
let queued = false;
|
|
2810
|
+
for (const id of idsFor(refs)) {
|
|
2811
|
+
if (!needsPrice(id)) continue;
|
|
2812
|
+
priceQueue.add(id);
|
|
2813
|
+
queued = true;
|
|
2814
|
+
}
|
|
2815
|
+
if (queued) scheduleFlush();
|
|
2816
|
+
}
|
|
2817
|
+
function settled(test) {
|
|
2818
|
+
if (test()) return Promise.resolve();
|
|
2819
|
+
return new Promise((resolve) => {
|
|
2820
|
+
const unsubscribe = subscribe(() => {
|
|
2821
|
+
if (!test()) return;
|
|
2822
|
+
unsubscribe();
|
|
2823
|
+
resolve();
|
|
2824
|
+
});
|
|
2825
|
+
});
|
|
2826
|
+
}
|
|
2827
|
+
function subscribe(listener) {
|
|
2828
|
+
listeners2.add(listener);
|
|
2829
|
+
return () => {
|
|
2830
|
+
listeners2.delete(listener);
|
|
2831
|
+
};
|
|
2832
|
+
}
|
|
2833
|
+
function peekMeta(id) {
|
|
2834
|
+
const entry = meta.get(id);
|
|
2835
|
+
if (!entry) {
|
|
2836
|
+
return metaInFlight.has(id) || metaQueue.has(id) ? { status: "pending" } : void 0;
|
|
2837
|
+
}
|
|
2838
|
+
const { retryAt: _retryAt, ...rest } = entry;
|
|
2839
|
+
return rest;
|
|
2840
|
+
}
|
|
2841
|
+
return {
|
|
2842
|
+
subscribe,
|
|
2843
|
+
getVersion: () => version2,
|
|
2844
|
+
requestMeta,
|
|
2845
|
+
requestPrices,
|
|
2846
|
+
peekMeta,
|
|
2847
|
+
peekPrice: (id) => _optionalChain([prices, 'access', _162 => _162.get, 'call', _163 => _163(id), 'optionalAccess', _164 => _164.usd]),
|
|
2848
|
+
async resolveMeta(refs) {
|
|
2849
|
+
const ids = idsFor(refs);
|
|
2850
|
+
requestMeta(refs);
|
|
2851
|
+
await settled(
|
|
2852
|
+
() => ids.every((id) => !metaInFlight.has(id) && !metaQueue.has(id))
|
|
2853
|
+
);
|
|
2854
|
+
return Object.fromEntries(
|
|
2855
|
+
ids.map((id) => [id, _nullishCoalesce(peekMeta(id), () => ( { status: "missing" }))])
|
|
2856
|
+
);
|
|
2857
|
+
},
|
|
2858
|
+
async resolvePrice(ref) {
|
|
2859
|
+
const [id] = idsFor([ref]);
|
|
2860
|
+
if (!id) return null;
|
|
2861
|
+
requestPrices([ref]);
|
|
2862
|
+
await settled(() => !priceInFlight.has(id) && !priceQueue.has(id));
|
|
2863
|
+
return _nullishCoalesce(_optionalChain([prices, 'access', _165 => _165.get, 'call', _166 => _166(id), 'optionalAccess', _167 => _167.usd]), () => ( null));
|
|
2864
|
+
}
|
|
2865
|
+
};
|
|
2866
|
+
}
|
|
2867
|
+
var AssetStoreContext = _react.createContext.call(void 0, null);
|
|
2868
|
+
function AssetMetadataProvider({
|
|
2869
|
+
service,
|
|
2870
|
+
children
|
|
2871
|
+
}) {
|
|
2872
|
+
const store = _react.useMemo.call(void 0, () => createAssetStore(service), [service]);
|
|
2873
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssetStoreContext.Provider, { value: store, children });
|
|
2874
|
+
}
|
|
2875
|
+
function useAssetStore() {
|
|
2876
|
+
return _react.useContext.call(void 0, AssetStoreContext);
|
|
2877
|
+
}
|
|
2878
|
+
var noopSubscribe = () => () => {
|
|
2879
|
+
};
|
|
2880
|
+
var zero = () => 0;
|
|
2881
|
+
function useStoreVersion(store) {
|
|
2882
|
+
return _react.useSyncExternalStore.call(void 0,
|
|
2883
|
+
store ? store.subscribe : noopSubscribe,
|
|
2884
|
+
store ? store.getVersion : zero,
|
|
2885
|
+
store ? store.getVersion : zero
|
|
2886
|
+
);
|
|
2887
|
+
}
|
|
2888
|
+
function refsKey(refs) {
|
|
2889
|
+
return refs.map((ref) => _nullishCoalesce(assetIdForRef(ref), () => ( ""))).filter(Boolean).join("|");
|
|
2890
|
+
}
|
|
2891
|
+
function definedRefs(refs) {
|
|
2892
|
+
return refs.filter((ref) => Boolean(ref));
|
|
2893
|
+
}
|
|
2894
|
+
function useAssetMetadata(refs) {
|
|
2895
|
+
const store = useAssetStore();
|
|
2896
|
+
const version2 = useStoreVersion(store);
|
|
2897
|
+
const key = refsKey(refs);
|
|
2627
2898
|
_react.useEffect.call(void 0, () => {
|
|
2628
|
-
|
|
2629
|
-
}, [
|
|
2630
|
-
return
|
|
2899
|
+
if (store && key) store.requestMeta(definedRefs(refs));
|
|
2900
|
+
}, [store, key]);
|
|
2901
|
+
return _react.useMemo.call(void 0, () => {
|
|
2902
|
+
const out = {};
|
|
2903
|
+
if (!store || !key) return out;
|
|
2904
|
+
for (const id of key.split("|")) {
|
|
2905
|
+
out[id] = _nullishCoalesce(store.peekMeta(id), () => ( { status: "pending" }));
|
|
2906
|
+
}
|
|
2907
|
+
return out;
|
|
2908
|
+
}, [store, key, version2]);
|
|
2909
|
+
}
|
|
2910
|
+
function useAssetPrices(refs) {
|
|
2911
|
+
const store = useAssetStore();
|
|
2912
|
+
const version2 = useStoreVersion(store);
|
|
2913
|
+
const key = refsKey(refs);
|
|
2914
|
+
_react.useEffect.call(void 0, () => {
|
|
2915
|
+
if (store && key) store.requestPrices(definedRefs(refs));
|
|
2916
|
+
}, [store, key]);
|
|
2917
|
+
return _react.useMemo.call(void 0, () => {
|
|
2918
|
+
const out = {};
|
|
2919
|
+
if (!store || !key) return out;
|
|
2920
|
+
for (const id of key.split("|")) {
|
|
2921
|
+
const usd = store.peekPrice(id);
|
|
2922
|
+
if (typeof usd === "number") out[id] = usd;
|
|
2923
|
+
}
|
|
2924
|
+
return out;
|
|
2925
|
+
}, [store, key, version2]);
|
|
2631
2926
|
}
|
|
2632
2927
|
|
|
2633
2928
|
// src/core/analytics.tsx
|
|
@@ -2696,7 +2991,7 @@ function createIngestTransport(options) {
|
|
|
2696
2991
|
function report(reason, status) {
|
|
2697
2992
|
try {
|
|
2698
2993
|
onFailure({ reason, status, droppedEvents: dropped });
|
|
2699
|
-
} catch (
|
|
2994
|
+
} catch (e7) {
|
|
2700
2995
|
}
|
|
2701
2996
|
}
|
|
2702
2997
|
function drop(batch, reason, status) {
|
|
@@ -2750,10 +3045,10 @@ function createIngestTransport(options) {
|
|
|
2750
3045
|
}
|
|
2751
3046
|
function interruptForUnload() {
|
|
2752
3047
|
for (const wake of [...sleepers]) wake();
|
|
2753
|
-
_optionalChain([mintAbort, 'optionalAccess',
|
|
3048
|
+
_optionalChain([mintAbort, 'optionalAccess', _168 => _168.abort, 'call', _169 => _169()]);
|
|
2754
3049
|
}
|
|
2755
3050
|
function retryDelay(response, attempt) {
|
|
2756
|
-
const seconds = Number(_optionalChain([response, 'access',
|
|
3051
|
+
const seconds = Number(_optionalChain([response, 'access', _170 => _170.headers, 'optionalAccess', _171 => _171.get, 'optionalCall', _172 => _172("Retry-After")]));
|
|
2757
3052
|
if (Number.isFinite(seconds) && seconds > 0) {
|
|
2758
3053
|
return Math.min(seconds * 1e3, MAX_BACKOFF_MS);
|
|
2759
3054
|
}
|
|
@@ -2768,10 +3063,10 @@ function createIngestTransport(options) {
|
|
|
2768
3063
|
try {
|
|
2769
3064
|
response = await fetchImpl(mintUrl, {
|
|
2770
3065
|
method: "POST",
|
|
2771
|
-
headers:
|
|
2772
|
-
signal: _optionalChain([controller, 'optionalAccess',
|
|
3066
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
3067
|
+
signal: _optionalChain([controller, 'optionalAccess', _173 => _173.signal])
|
|
2773
3068
|
});
|
|
2774
|
-
} catch (
|
|
3069
|
+
} catch (e8) {
|
|
2775
3070
|
if (urgency !== DISMISSAL) {
|
|
2776
3071
|
mintFailures += 1;
|
|
2777
3072
|
mintBackoffUntil = now() + backoff(mintFailures);
|
|
@@ -2799,7 +3094,7 @@ function createIngestTransport(options) {
|
|
|
2799
3094
|
token = { value, expiresAt };
|
|
2800
3095
|
mintFailures = 0;
|
|
2801
3096
|
mintBackoffUntil = 0;
|
|
2802
|
-
} catch (
|
|
3097
|
+
} catch (e9) {
|
|
2803
3098
|
mintUnavailable = true;
|
|
2804
3099
|
report("token_unavailable", response.status);
|
|
2805
3100
|
}
|
|
@@ -2839,7 +3134,7 @@ function createIngestTransport(options) {
|
|
|
2839
3134
|
body: bodyOf(batch),
|
|
2840
3135
|
keepalive: true
|
|
2841
3136
|
});
|
|
2842
|
-
} catch (
|
|
3137
|
+
} catch (e10) {
|
|
2843
3138
|
if (terminal || attempt >= MAX_ATTEMPTS) {
|
|
2844
3139
|
return drop(batch, "network");
|
|
2845
3140
|
}
|
|
@@ -2944,7 +3239,7 @@ function createIngestTransport(options) {
|
|
|
2944
3239
|
}
|
|
2945
3240
|
},
|
|
2946
3241
|
flush(flushOptions) {
|
|
2947
|
-
const dismissal = _nullishCoalesce(_optionalChain([flushOptions, 'optionalAccess',
|
|
3242
|
+
const dismissal = _nullishCoalesce(_optionalChain([flushOptions, 'optionalAccess', _174 => _174.terminal]), () => ( false));
|
|
2948
3243
|
if (disposed && !dismissal) return;
|
|
2949
3244
|
clearFlushTimer();
|
|
2950
3245
|
void run(dismissal ? DISMISSAL : IDLE);
|
|
@@ -2959,11 +3254,11 @@ function createIngestTransport(options) {
|
|
|
2959
3254
|
};
|
|
2960
3255
|
}
|
|
2961
3256
|
function randomUuid() {
|
|
2962
|
-
if (typeof _optionalChain([globalThis, 'access',
|
|
3257
|
+
if (typeof _optionalChain([globalThis, 'access', _175 => _175.crypto, 'optionalAccess', _176 => _176.randomUUID]) === "function") {
|
|
2963
3258
|
return globalThis.crypto.randomUUID();
|
|
2964
3259
|
}
|
|
2965
3260
|
const bytes = new Uint8Array(16);
|
|
2966
|
-
_optionalChain([globalThis, 'access',
|
|
3261
|
+
_optionalChain([globalThis, 'access', _177 => _177.crypto, 'optionalAccess', _178 => _178.getRandomValues, 'optionalCall', _179 => _179(bytes)]);
|
|
2967
3262
|
if (!bytes.some(Boolean)) {
|
|
2968
3263
|
for (let index = 0; index < bytes.length; index += 1) {
|
|
2969
3264
|
bytes[index] = Math.floor(Math.random() * 256);
|
|
@@ -2977,9 +3272,9 @@ function randomUuid() {
|
|
|
2977
3272
|
function resolveProxyOrigin(backendUrl) {
|
|
2978
3273
|
if (!backendUrl.trim()) return null;
|
|
2979
3274
|
try {
|
|
2980
|
-
const { origin } = new URL(backendUrl, _optionalChain([globalThis, 'access',
|
|
3275
|
+
const { origin } = new URL(backendUrl, _optionalChain([globalThis, 'access', _180 => _180.location, 'optionalAccess', _181 => _181.href]));
|
|
2981
3276
|
return origin.startsWith("http") ? origin : null;
|
|
2982
|
-
} catch (
|
|
3277
|
+
} catch (e11) {
|
|
2983
3278
|
return null;
|
|
2984
3279
|
}
|
|
2985
3280
|
}
|
|
@@ -3029,13 +3324,13 @@ function AnalyticsSession(props) {
|
|
|
3029
3324
|
type: "analytics_ingest_failure",
|
|
3030
3325
|
session_id: sessionIdRef.current,
|
|
3031
3326
|
modal,
|
|
3032
|
-
widget_version:
|
|
3327
|
+
widget_version: _chunkEKFXUF5Acjs.MODAL_VERSION,
|
|
3033
3328
|
timestamp: nowRef.current().toISOString(),
|
|
3034
3329
|
reason,
|
|
3035
3330
|
...status === void 0 ? {} : { status },
|
|
3036
3331
|
dropped_events: droppedEvents
|
|
3037
3332
|
};
|
|
3038
|
-
_optionalChain([onEventRef, 'access',
|
|
3333
|
+
_optionalChain([onEventRef, 'access', _182 => _182.current, 'optionalCall', _183 => _183(event)]);
|
|
3039
3334
|
},
|
|
3040
3335
|
[modal]
|
|
3041
3336
|
);
|
|
@@ -3057,7 +3352,7 @@ function AnalyticsSession(props) {
|
|
|
3057
3352
|
proxyOrigin,
|
|
3058
3353
|
sessionId: sessionIdRef.current,
|
|
3059
3354
|
modal,
|
|
3060
|
-
widgetVersion:
|
|
3355
|
+
widgetVersion: _chunkEKFXUF5Acjs.MODAL_VERSION,
|
|
3061
3356
|
sessionProperties: sessionPropertiesRef.current,
|
|
3062
3357
|
onFailure: (failure) => emitFailure(failure),
|
|
3063
3358
|
fetchImpl: props.fetchImpl,
|
|
@@ -3074,10 +3369,10 @@ function AnalyticsSession(props) {
|
|
|
3074
3369
|
const enqueue = _react.useCallback.call(void 0,
|
|
3075
3370
|
(event) => {
|
|
3076
3371
|
try {
|
|
3077
|
-
_optionalChain([ingestRef, 'access',
|
|
3372
|
+
_optionalChain([ingestRef, 'access', _184 => _184.current, 'optionalAccess', _185 => _185.transport, 'optionalAccess', _186 => _186.enqueue, 'call', _187 => _187(
|
|
3078
3373
|
event
|
|
3079
3374
|
)]);
|
|
3080
|
-
} catch (
|
|
3375
|
+
} catch (e12) {
|
|
3081
3376
|
}
|
|
3082
3377
|
},
|
|
3083
3378
|
[]
|
|
@@ -3113,12 +3408,12 @@ function AnalyticsSession(props) {
|
|
|
3113
3408
|
...payload,
|
|
3114
3409
|
session_id: sessionIdRef.current,
|
|
3115
3410
|
modal,
|
|
3116
|
-
widget_version:
|
|
3411
|
+
widget_version: _chunkEKFXUF5Acjs.MODAL_VERSION,
|
|
3117
3412
|
timestamp: nowRef.current().toISOString(),
|
|
3118
3413
|
session_properties: sessionPropertiesRef.current,
|
|
3119
3414
|
funding_method: fundingMethod
|
|
3120
3415
|
};
|
|
3121
|
-
_optionalChain([onEventRef, 'access',
|
|
3416
|
+
_optionalChain([onEventRef, 'access', _188 => _188.current, 'optionalCall', _189 => _189(
|
|
3122
3417
|
event
|
|
3123
3418
|
)]);
|
|
3124
3419
|
enqueue(event);
|
|
@@ -3132,11 +3427,11 @@ function AnalyticsSession(props) {
|
|
|
3132
3427
|
...payload,
|
|
3133
3428
|
session_id: sessionIdRef.current,
|
|
3134
3429
|
modal,
|
|
3135
|
-
widget_version:
|
|
3430
|
+
widget_version: _chunkEKFXUF5Acjs.MODAL_VERSION,
|
|
3136
3431
|
timestamp: nowRef.current().toISOString(),
|
|
3137
3432
|
session_properties: sessionPropertiesRef.current
|
|
3138
3433
|
};
|
|
3139
|
-
_optionalChain([onEventRef, 'access',
|
|
3434
|
+
_optionalChain([onEventRef, 'access', _190 => _190.current, 'optionalCall', _191 => _191(event)]);
|
|
3140
3435
|
enqueue(event);
|
|
3141
3436
|
},
|
|
3142
3437
|
[enqueue, modal, nowRef, onEventRef]
|
|
@@ -3148,11 +3443,11 @@ function AnalyticsSession(props) {
|
|
|
3148
3443
|
...payload,
|
|
3149
3444
|
session_id: sessionIdRef.current,
|
|
3150
3445
|
modal,
|
|
3151
|
-
widget_version:
|
|
3446
|
+
widget_version: _chunkEKFXUF5Acjs.MODAL_VERSION,
|
|
3152
3447
|
timestamp: nowRef.current().toISOString(),
|
|
3153
3448
|
session_properties: sessionPropertiesRef.current
|
|
3154
3449
|
};
|
|
3155
|
-
_optionalChain([onEventRef, 'access',
|
|
3450
|
+
_optionalChain([onEventRef, 'access', _192 => _192.current, 'optionalCall', _193 => _193(event)]);
|
|
3156
3451
|
enqueue(event);
|
|
3157
3452
|
},
|
|
3158
3453
|
[enqueue, modal, nowRef, onEventRef]
|
|
@@ -3183,7 +3478,7 @@ function useClaimAnalyticsEmitter() {
|
|
|
3183
3478
|
|
|
3184
3479
|
var RECOVERABLE_STATUSES = /* @__PURE__ */ new Set(["failed", "rejected"]);
|
|
3185
3480
|
function recoverySigningChainId(row) {
|
|
3186
|
-
return
|
|
3481
|
+
return _chunkFKJ6EJHHcjs.parseEvmChainId.call(void 0, row.targetChain);
|
|
3187
3482
|
}
|
|
3188
3483
|
function sourceDepositTxHash(row) {
|
|
3189
3484
|
return _nullishCoalesce(row.sourceTxHash, () => ( row.txHash));
|
|
@@ -3191,7 +3486,7 @@ function sourceDepositTxHash(row) {
|
|
|
3191
3486
|
function toRecoverableDeposit(row, options = {}) {
|
|
3192
3487
|
if (!row.id) return null;
|
|
3193
3488
|
if (!RECOVERABLE_STATUSES.has((_nullishCoalesce(row.status, () => ( ""))).toLowerCase())) return null;
|
|
3194
|
-
const sourceChainId =
|
|
3489
|
+
const sourceChainId = _chunkFKJ6EJHHcjs.parseEvmChainId.call(void 0, row.chain);
|
|
3195
3490
|
const targetChainId = recoverySigningChainId(row);
|
|
3196
3491
|
if (sourceChainId === null || targetChainId === null) return null;
|
|
3197
3492
|
const signer = row.recipient;
|
|
@@ -3202,7 +3497,7 @@ function toRecoverableDeposit(row, options = {}) {
|
|
|
3202
3497
|
return {
|
|
3203
3498
|
depositId: row.id,
|
|
3204
3499
|
signer,
|
|
3205
|
-
|
|
3500
|
+
depositAddress: row.depositAddress,
|
|
3206
3501
|
sourceChainId,
|
|
3207
3502
|
targetChainId,
|
|
3208
3503
|
token: row.token,
|
|
@@ -3210,6 +3505,12 @@ function toRecoverableDeposit(row, options = {}) {
|
|
|
3210
3505
|
sourceTxHash: sourceDepositTxHash(row)
|
|
3211
3506
|
};
|
|
3212
3507
|
}
|
|
3508
|
+
function isDepositSelfDestination(row, destination) {
|
|
3509
|
+
const depositAddress = _optionalChain([row, 'access', _194 => _194.depositAddress, 'optionalAccess', _195 => _195.trim, 'call', _196 => _196()]);
|
|
3510
|
+
const candidate = destination.trim();
|
|
3511
|
+
if (!depositAddress || !candidate) return false;
|
|
3512
|
+
return depositAddress.toLowerCase() === candidate.toLowerCase();
|
|
3513
|
+
}
|
|
3213
3514
|
function recoveryFailureCause(sourceChainName) {
|
|
3214
3515
|
return sourceChainName ? `This deposit couldn't be completed. Your funds are still on ${sourceChainName}.` : "This deposit couldn't be completed and your funds were not moved.";
|
|
3215
3516
|
}
|
|
@@ -3258,7 +3559,7 @@ var STATUS_LABEL = {
|
|
|
3258
3559
|
};
|
|
3259
3560
|
function filterVisibleDeposits(deposits) {
|
|
3260
3561
|
const sourceHashes = new Set(
|
|
3261
|
-
deposits.map((d) => _optionalChain([d, 'access',
|
|
3562
|
+
deposits.map((d) => _optionalChain([d, 'access', _197 => _197.sourceTxHash, 'optionalAccess', _198 => _198.toLowerCase, 'call', _199 => _199()])).filter((h) => Boolean(h))
|
|
3262
3563
|
);
|
|
3263
3564
|
return deposits.filter(
|
|
3264
3565
|
(d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
|
|
@@ -3311,22 +3612,23 @@ function historyBadgeAriaLabel(badge) {
|
|
|
3311
3612
|
function HistoryEntryButton({
|
|
3312
3613
|
badge,
|
|
3313
3614
|
onClick,
|
|
3314
|
-
disabled
|
|
3615
|
+
disabled,
|
|
3616
|
+
unread = false
|
|
3315
3617
|
}) {
|
|
3316
3618
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3317
3619
|
"button",
|
|
3318
3620
|
{
|
|
3319
3621
|
type: "button",
|
|
3320
3622
|
className: "rs-modal-header-history",
|
|
3321
|
-
"aria-label": historyBadgeAriaLabel(badge),
|
|
3623
|
+
"aria-label": unread ? "Deposit history \u2014 new bank transfer activity" : historyBadgeAriaLabel(badge),
|
|
3322
3624
|
onClick,
|
|
3323
3625
|
disabled,
|
|
3324
3626
|
children: [
|
|
3325
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, HistoryIcon, {}),
|
|
3326
|
-
badge && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3627
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.HistoryIcon, {}),
|
|
3628
|
+
(badge || unread) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3327
3629
|
"span",
|
|
3328
3630
|
{
|
|
3329
|
-
className: `rs-history-dot rs-history-dot--${badge.state}`,
|
|
3631
|
+
className: `rs-history-dot rs-history-dot--${_nullishCoalesce(_optionalChain([badge, 'optionalAccess', _200 => _200.state]), () => ( "progress"))}`,
|
|
3330
3632
|
"aria-hidden": "true"
|
|
3331
3633
|
}
|
|
3332
3634
|
)
|
|
@@ -3357,7 +3659,7 @@ function preconnectIconCdn() {
|
|
|
3357
3659
|
const link = document.createElement("link");
|
|
3358
3660
|
link.id = "rs-icon-cdn-preconnect";
|
|
3359
3661
|
link.rel = "preconnect";
|
|
3360
|
-
link.href =
|
|
3662
|
+
link.href = _chunkFKJ6EJHHcjs.ICON_CDN;
|
|
3361
3663
|
link.crossOrigin = "anonymous";
|
|
3362
3664
|
document.head.appendChild(link);
|
|
3363
3665
|
}
|
|
@@ -3375,83 +3677,26 @@ function CdnIcon({
|
|
|
3375
3677
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: fallback });
|
|
3376
3678
|
}
|
|
3377
3679
|
const isLoading = loadedSrc !== src;
|
|
3378
|
-
const settleIfAlreadyComplete = (el) => {
|
|
3379
|
-
if (_optionalChain([el, 'optionalAccess',
|
|
3380
|
-
};
|
|
3381
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3382
|
-
"img",
|
|
3383
|
-
{
|
|
3384
|
-
ref: settleIfAlreadyComplete,
|
|
3385
|
-
src,
|
|
3386
|
-
alt,
|
|
3387
|
-
className: `rs-cdn-icon ${_nullishCoalesce(className, () => ( ""))}`.trimEnd(),
|
|
3388
|
-
loading,
|
|
3389
|
-
decoding: "async",
|
|
3390
|
-
"data-loading": isLoading ? "" : void 0,
|
|
3391
|
-
onLoad: () => setLoadedSrc(src),
|
|
3392
|
-
onError: () => setErroredSrc(src)
|
|
3393
|
-
},
|
|
3394
|
-
src
|
|
3395
|
-
);
|
|
3396
|
-
}
|
|
3397
|
-
CdnIcon.displayName = "CdnIcon";
|
|
3398
|
-
|
|
3399
|
-
// src/components/ui/BodyHeader.tsx
|
|
3400
|
-
|
|
3401
|
-
function BodyHeader({
|
|
3402
|
-
icon,
|
|
3403
|
-
title,
|
|
3404
|
-
subtitle,
|
|
3405
|
-
variant = "default",
|
|
3406
|
-
aside
|
|
3407
|
-
}) {
|
|
3408
|
-
const iconClasses = [
|
|
3409
|
-
"rs-body-header-icon",
|
|
3410
|
-
variant === "success" ? "rs-body-header-icon--success" : "",
|
|
3411
|
-
variant === "error" ? "rs-body-header-icon--error" : ""
|
|
3412
|
-
].filter(Boolean).join(" ");
|
|
3413
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header", children: [
|
|
3414
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: iconClasses, children: icon }),
|
|
3415
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header-main", children: [
|
|
3416
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header-text", children: [
|
|
3417
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "rs-body-header-title", children: title }),
|
|
3418
|
-
subtitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "rs-body-header-subtitle", children: subtitle })
|
|
3419
|
-
] }),
|
|
3420
|
-
aside && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-body-header-aside", children: aside })
|
|
3421
|
-
] })
|
|
3422
|
-
] });
|
|
3423
|
-
}
|
|
3424
|
-
BodyHeader.displayName = "BodyHeader";
|
|
3425
|
-
|
|
3426
|
-
// src/components/ui/Spinner.tsx
|
|
3427
|
-
|
|
3428
|
-
function Spinner({ className }) {
|
|
3429
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3430
|
-
"svg",
|
|
3431
|
-
{
|
|
3432
|
-
className: `rs-spinner ${className || ""}`,
|
|
3433
|
-
fill: "none",
|
|
3434
|
-
viewBox: "0 0 20 21",
|
|
3435
|
-
children: [
|
|
3436
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3437
|
-
"path",
|
|
3438
|
-
{
|
|
3439
|
-
d: "M10 0.5C8.02 0.5 6.08 1.08 4.44 2.18C2.79 3.28 1.51 4.84 0.76 6.67C0.00 8.50 -0.19 10.51 0.19 12.45C0.57 14.39 1.53 16.17 2.92 17.57C4.32 18.96 6.10 19.92 8.04 20.30C9.98 20.69 11.99 20.49 13.82 19.73C15.65 18.98 17.21 17.70 18.31 16.05C19.41 14.41 20 12.47 20 10.5C20 7.84 18.94 5.30 17.07 3.42C15.19 1.55 12.65 0.5 10 0.5ZM10 17.77C8.56 17.77 7.15 17.34 5.95 16.54C4.76 15.74 3.83 14.61 3.28 13.28C2.73 11.95 2.58 10.49 2.86 9.08C3.14 7.67 3.84 6.37 4.85 5.35C5.87 4.34 7.17 3.64 8.58 3.36C9.99 3.08 11.45 3.23 12.78 3.78C14.11 4.33 15.24 5.26 16.04 6.45C16.84 7.65 17.27 9.06 17.27 10.5C17.27 12.42 16.50 14.27 15.14 15.64C13.77 17.00 11.92 17.77 10 17.77Z",
|
|
3440
|
-
fill: "currentColor",
|
|
3441
|
-
opacity: 0.3
|
|
3442
|
-
}
|
|
3443
|
-
),
|
|
3444
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3445
|
-
"path",
|
|
3446
|
-
{
|
|
3447
|
-
d: "M10 3.22C11.74 3.22 13.42 3.84 14.75 4.95C16.08 6.07 16.96 7.61 17.25 9.31C17.30 9.64 17.46 9.94 17.71 10.15C17.96 10.37 18.28 10.49 18.62 10.5C18.82 10.50 19.01 10.45 19.20 10.37C19.38 10.29 19.54 10.16 19.67 10.01C19.80 9.86 19.89 9.68 19.95 9.49C20.00 9.30 20.01 9.10 19.98 8.90C19.59 6.56 18.38 4.42 16.55 2.88C14.72 1.34 12.40 0.5 10 0.5C7.59 0.5 5.27 1.34 3.44 2.88C1.61 4.42 0.40 6.56 0.01 8.90C-0.01 9.10 -0.00 9.30 0.04 9.49C0.10 9.68 0.19 9.86 0.32 10.01C0.45 10.16 0.61 10.29 0.79 10.37C0.98 10.45 1.17 10.50 1.37 10.5C1.71 10.49 2.03 10.37 2.28 10.15C2.53 9.94 2.69 9.64 2.74 9.31C3.03 7.61 3.91 6.07 5.24 4.95C6.57 3.84 8.25 3.22 10 3.22Z",
|
|
3448
|
-
fill: "currentColor"
|
|
3449
|
-
}
|
|
3450
|
-
)
|
|
3451
|
-
]
|
|
3452
|
-
}
|
|
3680
|
+
const settleIfAlreadyComplete = (el) => {
|
|
3681
|
+
if (_optionalChain([el, 'optionalAccess', _201 => _201.complete])) setLoadedSrc(src);
|
|
3682
|
+
};
|
|
3683
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3684
|
+
"img",
|
|
3685
|
+
{
|
|
3686
|
+
ref: settleIfAlreadyComplete,
|
|
3687
|
+
src,
|
|
3688
|
+
alt,
|
|
3689
|
+
className: `rs-cdn-icon ${_nullishCoalesce(className, () => ( ""))}`.trimEnd(),
|
|
3690
|
+
loading,
|
|
3691
|
+
decoding: "async",
|
|
3692
|
+
"data-loading": isLoading ? "" : void 0,
|
|
3693
|
+
onLoad: () => setLoadedSrc(src),
|
|
3694
|
+
onError: () => setErroredSrc(src)
|
|
3695
|
+
},
|
|
3696
|
+
src
|
|
3453
3697
|
);
|
|
3454
3698
|
}
|
|
3699
|
+
CdnIcon.displayName = "CdnIcon";
|
|
3455
3700
|
|
|
3456
3701
|
// src/components/ui/Button.tsx
|
|
3457
3702
|
|
|
@@ -3482,11 +3727,11 @@ function Button({
|
|
|
3482
3727
|
"aria-busy": loading || void 0,
|
|
3483
3728
|
...props,
|
|
3484
3729
|
children: showInlineLoadingText ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-button__loading-row", children: [
|
|
3485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { className: "rs-spinner--sm" }),
|
|
3730
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.Spinner, { className: "rs-spinner--sm" }),
|
|
3486
3731
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: loadingText })
|
|
3487
3732
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3488
3733
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: loading ? "rs-button__content--hidden" : "", children }),
|
|
3489
|
-
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-button__spinner", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { className: "rs-spinner--sm" }) })
|
|
3734
|
+
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-button__spinner", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.Spinner, { className: "rs-spinner--sm" }) })
|
|
3490
3735
|
] })
|
|
3491
3736
|
}
|
|
3492
3737
|
);
|
|
@@ -3525,7 +3770,7 @@ function Callout({ variant = "error", children, role }) {
|
|
|
3525
3770
|
className: `rs-callout rs-callout--${variant}`,
|
|
3526
3771
|
role: _nullishCoalesce(role, () => ( (variant === "error" ? "alert" : "status"))),
|
|
3527
3772
|
children: [
|
|
3528
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-callout-icon", children: variant === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CircleAlertIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertTriangleIcon, {}) }),
|
|
3773
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-callout-icon", children: variant === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CircleAlertIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.AlertTriangleIcon, {}) }),
|
|
3529
3774
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-callout-text", children })
|
|
3530
3775
|
]
|
|
3531
3776
|
}
|
|
@@ -3604,15 +3849,257 @@ function PoweredBy() {
|
|
|
3604
3849
|
}
|
|
3605
3850
|
PoweredBy.displayName = "PoweredBy";
|
|
3606
3851
|
|
|
3852
|
+
// src/components/history/BankOrderCard.tsx
|
|
3853
|
+
|
|
3854
|
+
|
|
3855
|
+
// src/components/history/HistoryTransactionLink.tsx
|
|
3856
|
+
|
|
3857
|
+
function resolveHistoryChainId(value) {
|
|
3858
|
+
if (value === void 0 || value === null) return null;
|
|
3859
|
+
if (typeof value === "number") return value;
|
|
3860
|
+
const display = _chunkFKJ6EJHHcjs.displayChainIdForCaip2.call(void 0, value);
|
|
3861
|
+
if (display !== null) return display;
|
|
3862
|
+
if (value === "solana" || value === "hypercore") return value;
|
|
3863
|
+
const number = Number(value);
|
|
3864
|
+
return Number.isFinite(number) ? number : null;
|
|
3865
|
+
}
|
|
3866
|
+
function HistoryTransactionLink({
|
|
3867
|
+
chainId,
|
|
3868
|
+
txHash,
|
|
3869
|
+
label = "Transaction details"
|
|
3870
|
+
}) {
|
|
3871
|
+
const explorerTxUrl = useExplorerTxUrl();
|
|
3872
|
+
const chain = resolveHistoryChainId(chainId);
|
|
3873
|
+
const url = chain !== null && txHash ? explorerTxUrl(chain, txHash) : void 0;
|
|
3874
|
+
if (!url || !txHash) return null;
|
|
3875
|
+
const text = txHash.length > 14 ? `${txHash.slice(0, 6)}\u2026${txHash.slice(-4)}` : txHash;
|
|
3876
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
3877
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: label }),
|
|
3878
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3879
|
+
"a",
|
|
3880
|
+
{
|
|
3881
|
+
href: url,
|
|
3882
|
+
target: "_blank",
|
|
3883
|
+
rel: "noopener noreferrer",
|
|
3884
|
+
className: "rs-history-card-link",
|
|
3885
|
+
"aria-label": `${label}: ${txHash}`,
|
|
3886
|
+
children: [
|
|
3887
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: text }),
|
|
3888
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ArrowUpRightIcon, {})
|
|
3889
|
+
]
|
|
3890
|
+
}
|
|
3891
|
+
)
|
|
3892
|
+
] });
|
|
3893
|
+
}
|
|
3894
|
+
|
|
3895
|
+
// src/core/bank-onramp-progress.ts
|
|
3896
|
+
function toPaymentProgress(order) {
|
|
3897
|
+
const { receipt, conversion, delivery } = order.stages;
|
|
3898
|
+
const stages = [receipt.status, conversion.status, delivery.status];
|
|
3899
|
+
if (stages.includes("on_hold")) return "on_hold";
|
|
3900
|
+
if (order.stages.return.status !== "none") return "returned";
|
|
3901
|
+
if (stages.includes("failed")) return "failed";
|
|
3902
|
+
if (delivery.status === "completed") return "delivered";
|
|
3903
|
+
if (delivery.status !== "not_started") return "sending";
|
|
3904
|
+
if (conversion.status === "completed") return "sending";
|
|
3905
|
+
if (conversion.status !== "not_started") return "converting";
|
|
3906
|
+
if (receipt.status === "completed") return "received";
|
|
3907
|
+
return "awaiting_transfer";
|
|
3908
|
+
}
|
|
3909
|
+
var TERMINAL = /* @__PURE__ */ new Set([
|
|
3910
|
+
"delivered",
|
|
3911
|
+
"returned",
|
|
3912
|
+
"failed"
|
|
3913
|
+
]);
|
|
3914
|
+
function toPaymentView(order) {
|
|
3915
|
+
const progress = toPaymentProgress(order);
|
|
3916
|
+
return {
|
|
3917
|
+
id: order.id,
|
|
3918
|
+
amount: _nullishCoalesce(_optionalChain([order, 'access', _202 => _202.fiat, 'access', _203 => _203.charged, 'optionalAccess', _204 => _204.total]), () => ( "")),
|
|
3919
|
+
currency: _nullishCoalesce(_optionalChain([order, 'access', _205 => _205.fiat, 'access', _206 => _206.charged, 'optionalAccess', _207 => _207.currency]), () => ( "")),
|
|
3920
|
+
progress,
|
|
3921
|
+
terminal: TERMINAL.has(progress)
|
|
3922
|
+
};
|
|
3923
|
+
}
|
|
3924
|
+
var BANK_ONRAMP_COPY = {
|
|
3925
|
+
awaiting_transfer: {
|
|
3926
|
+
title: "Waiting for your transfer",
|
|
3927
|
+
subtitle: "Send the transfer from your bank using the details above."
|
|
3928
|
+
},
|
|
3929
|
+
received: {
|
|
3930
|
+
title: "Transfer received",
|
|
3931
|
+
subtitle: "Your bank transfer has arrived and is being processed."
|
|
3932
|
+
},
|
|
3933
|
+
converting: {
|
|
3934
|
+
title: "Converting",
|
|
3935
|
+
subtitle: "Your money is being converted to crypto."
|
|
3936
|
+
},
|
|
3937
|
+
sending: {
|
|
3938
|
+
title: "Sending to your account",
|
|
3939
|
+
subtitle: "The crypto is on its way. This usually takes a few minutes."
|
|
3940
|
+
},
|
|
3941
|
+
delivered: {
|
|
3942
|
+
title: "Funds delivered",
|
|
3943
|
+
subtitle: "The crypto has arrived in your account."
|
|
3944
|
+
},
|
|
3945
|
+
on_hold: {
|
|
3946
|
+
title: "Under review",
|
|
3947
|
+
subtitle: "Your provider is reviewing this transfer and may contact you for more information."
|
|
3948
|
+
},
|
|
3949
|
+
returned: {
|
|
3950
|
+
title: "Transfer returned",
|
|
3951
|
+
subtitle: "This transfer was returned. Contact support if unexpected."
|
|
3952
|
+
},
|
|
3953
|
+
failed: {
|
|
3954
|
+
title: "Transfer failed",
|
|
3955
|
+
subtitle: "This transfer could not be completed. Contact support."
|
|
3956
|
+
}
|
|
3957
|
+
};
|
|
3958
|
+
|
|
3959
|
+
// src/components/history/BankOrderCard.tsx
|
|
3960
|
+
|
|
3961
|
+
function bankSupportHref(value) {
|
|
3962
|
+
if (!value) return void 0;
|
|
3963
|
+
try {
|
|
3964
|
+
const url = new URL(value);
|
|
3965
|
+
return ["https:", "mailto:"].includes(url.protocol) ? url.href : void 0;
|
|
3966
|
+
} catch (e13) {
|
|
3967
|
+
return void 0;
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3970
|
+
function BankOrderCard({
|
|
3971
|
+
order,
|
|
3972
|
+
supportUrl,
|
|
3973
|
+
children,
|
|
3974
|
+
deposit
|
|
3975
|
+
}) {
|
|
3976
|
+
const [expanded, setExpanded] = _react.useState.call(void 0, false);
|
|
3977
|
+
const panelId = _react.useId.call(void 0, );
|
|
3978
|
+
const view = toPaymentView(order);
|
|
3979
|
+
const subFee = [order.stages.conversion, order.stages.delivery].some(
|
|
3980
|
+
(stage) => stage.status === "failed" && stage.reason === "sub_fee"
|
|
3981
|
+
);
|
|
3982
|
+
const support = bankSupportHref(supportUrl);
|
|
3983
|
+
const { delivery } = order.stages;
|
|
3984
|
+
const deliveryTxHash = "txHash" in delivery ? delivery.txHash : void 0;
|
|
3985
|
+
const needsHelp = ["failed", "returned", "on_hold"].includes(view.progress);
|
|
3986
|
+
const settlement = deposit ? normalizeStatus(deposit.status, deposit.isSpam) : null;
|
|
3987
|
+
let status = "pending";
|
|
3988
|
+
let label = "Detected";
|
|
3989
|
+
if (view.progress === "failed" || settlement === "failed" || settlement === "spam") {
|
|
3990
|
+
status = "failed";
|
|
3991
|
+
label = "Failed";
|
|
3992
|
+
} else if (view.progress === "returned" || settlement === "refunded") {
|
|
3993
|
+
status = "refunded";
|
|
3994
|
+
label = "Returned";
|
|
3995
|
+
} else if (settlement === "completed") {
|
|
3996
|
+
status = "completed";
|
|
3997
|
+
label = "Completed";
|
|
3998
|
+
} else if (view.progress === "on_hold") {
|
|
3999
|
+
status = "processing";
|
|
4000
|
+
label = "Under review";
|
|
4001
|
+
} else if (view.progress === "delivered") {
|
|
4002
|
+
status = "processing";
|
|
4003
|
+
label = "Settled";
|
|
4004
|
+
} else if (view.progress !== "awaiting_transfer" && view.progress !== "received") {
|
|
4005
|
+
status = "processing";
|
|
4006
|
+
label = "Settling";
|
|
4007
|
+
}
|
|
4008
|
+
const amount = view.amount && Number.isFinite(Number(view.amount)) ? `${Number(view.amount).toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${view.currency}` : "\u2014";
|
|
4009
|
+
const date = new Date(order.createdAt).toLocaleDateString(void 0, {
|
|
4010
|
+
day: "numeric",
|
|
4011
|
+
month: "short",
|
|
4012
|
+
year: "numeric"
|
|
4013
|
+
});
|
|
4014
|
+
const description = subFee ? "The transfer was consumed by the provider\u2019s fees. No crypto was delivered." : label === "Failed" && deposit ? "Crypto arrived, but settlement to your destination could not be completed." : label === "Completed" ? "Your bank transfer has completed and the crypto reached its destination." : label === "Settled" ? "Your bank transfer has settled into crypto. Final delivery is being confirmed." : label === "Settling" ? "Your bank transfer is being settled into crypto." : label === "Detected" ? "Your bank transfer was detected and is awaiting settlement." : BANK_ONRAMP_COPY[view.progress].subtitle;
|
|
4015
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4016
|
+
"div",
|
|
4017
|
+
{
|
|
4018
|
+
className: `rs-history-card${expanded ? " rs-history-card--expanded" : ""}`,
|
|
4019
|
+
children: [
|
|
4020
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4021
|
+
"button",
|
|
4022
|
+
{
|
|
4023
|
+
type: "button",
|
|
4024
|
+
className: "rs-history-card-trigger",
|
|
4025
|
+
onClick: () => setExpanded(!expanded),
|
|
4026
|
+
"aria-expanded": expanded,
|
|
4027
|
+
"aria-controls": panelId,
|
|
4028
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-card-row", children: [
|
|
4029
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-history-card-icons", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-card-token", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.BankIcon, {}) }) }),
|
|
4030
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-card-text", children: [
|
|
4031
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-card-title", children: "Bank transfer" }),
|
|
4032
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "time", { className: "rs-history-card-date", dateTime: order.createdAt, children: date })
|
|
4033
|
+
] }),
|
|
4034
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-card-side", children: [
|
|
4035
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-card-amount", children: amount }),
|
|
4036
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `rs-history-badge rs-history-badge--${status}`, children: label })
|
|
4037
|
+
] })
|
|
4038
|
+
] })
|
|
4039
|
+
}
|
|
4040
|
+
),
|
|
4041
|
+
/* @__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: [
|
|
4042
|
+
subFee || status === "failed" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Callout, { variant: "error", children: description }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "rs-history-empty-hint", children: description }),
|
|
4043
|
+
order.crypto && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
4044
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Converted amount" }),
|
|
4045
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-detail-value", children: [
|
|
4046
|
+
order.crypto.amount,
|
|
4047
|
+
" ",
|
|
4048
|
+
order.crypto.asset
|
|
4049
|
+
] })
|
|
4050
|
+
] }),
|
|
4051
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4052
|
+
HistoryTransactionLink,
|
|
4053
|
+
{
|
|
4054
|
+
chainId: _nullishCoalesce(_optionalChain([deposit, 'optionalAccess', _208 => _208.chain]), () => ( order.deliveryChain)),
|
|
4055
|
+
txHash: _nullishCoalesce(_optionalChain([deposit, 'optionalAccess', _209 => _209.txHash]), () => ( deliveryTxHash)),
|
|
4056
|
+
label: "Crypto deposit"
|
|
4057
|
+
}
|
|
4058
|
+
),
|
|
4059
|
+
_optionalChain([deposit, 'optionalAccess', _210 => _210.destinationTxHash]) !== _optionalChain([deposit, 'optionalAccess', _211 => _211.txHash]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HistoryTransactionLink, { chainId: _optionalChain([deposit, 'optionalAccess', _212 => _212.targetChain]), txHash: _optionalChain([deposit, 'optionalAccess', _213 => _213.destinationTxHash]), label: "Final settlement" }),
|
|
4060
|
+
(needsHelp || status === "failed") && support && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4061
|
+
"a",
|
|
4062
|
+
{
|
|
4063
|
+
className: "rs-history-card-link",
|
|
4064
|
+
href: support,
|
|
4065
|
+
target: "_blank",
|
|
4066
|
+
rel: "noopener noreferrer",
|
|
4067
|
+
children: [
|
|
4068
|
+
"Contact support ",
|
|
4069
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ArrowUpRightIcon, {})
|
|
4070
|
+
]
|
|
4071
|
+
}
|
|
4072
|
+
),
|
|
4073
|
+
children
|
|
4074
|
+
] }) }) })
|
|
4075
|
+
]
|
|
4076
|
+
}
|
|
4077
|
+
);
|
|
4078
|
+
}
|
|
4079
|
+
|
|
3607
4080
|
// src/components/ui/TokenIcon.tsx
|
|
3608
4081
|
|
|
3609
|
-
function TokenIcon({ symbol, className, fallback }) {
|
|
4082
|
+
function TokenIcon({ token, symbol, className, fallback }) {
|
|
4083
|
+
const id = assetIdForRef(token);
|
|
4084
|
+
const entry = useAssetMetadata([token])[_nullishCoalesce(id, () => ( ""))];
|
|
4085
|
+
const classes = `rs-token-icon ${_nullishCoalesce(className, () => ( ""))}`.trimEnd();
|
|
4086
|
+
const badge = _nullishCoalesce(fallback, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-token-initials", "aria-hidden": "true", children: (_nullishCoalesce(symbol, () => ( ""))).trim().slice(0, 1).toUpperCase() })));
|
|
4087
|
+
if (_optionalChain([entry, 'optionalAccess', _214 => _214.status]) === "pending") {
|
|
4088
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4089
|
+
"span",
|
|
4090
|
+
{
|
|
4091
|
+
className: `${classes} rs-token-icon--pending`,
|
|
4092
|
+
"data-loading": "",
|
|
4093
|
+
"aria-hidden": "true"
|
|
4094
|
+
}
|
|
4095
|
+
);
|
|
4096
|
+
}
|
|
3610
4097
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3611
4098
|
CdnIcon,
|
|
3612
4099
|
{
|
|
3613
|
-
src:
|
|
3614
|
-
className:
|
|
3615
|
-
fallback
|
|
4100
|
+
src: _optionalChain([entry, 'optionalAccess', _215 => _215.status]) === "ready" ? entry.logo : void 0,
|
|
4101
|
+
className: classes,
|
|
4102
|
+
fallback: badge
|
|
3616
4103
|
}
|
|
3617
4104
|
);
|
|
3618
4105
|
}
|
|
@@ -3692,6 +4179,82 @@ function resolveHistoryTiming({
|
|
|
3692
4179
|
};
|
|
3693
4180
|
}
|
|
3694
4181
|
|
|
4182
|
+
// src/core/token-display.ts
|
|
4183
|
+
|
|
4184
|
+
function isHyperCore(chain) {
|
|
4185
|
+
return chain === "hypercore" || chain === _chunkFKJ6EJHHcjs.HYPERCORE_CHAIN_ID;
|
|
4186
|
+
}
|
|
4187
|
+
function resolveCuratedToken(token, chain) {
|
|
4188
|
+
if (isHyperCore(chain)) {
|
|
4189
|
+
const listed = _chunkFKJ6EJHHcjs.HYPERCORE_SOURCE_TOKENS.find(
|
|
4190
|
+
(t) => t.address.toLowerCase() === token.toLowerCase()
|
|
4191
|
+
);
|
|
4192
|
+
return listed ? { symbol: listed.symbol, decimals: listed.decimals } : void 0;
|
|
4193
|
+
}
|
|
4194
|
+
const published = getRuntimeTokenByAddress(chain, token);
|
|
4195
|
+
if (published) {
|
|
4196
|
+
return { symbol: published.symbol, decimals: published.decimals };
|
|
4197
|
+
}
|
|
4198
|
+
if (chain === "solana") return resolveSolanaToken(token);
|
|
4199
|
+
if (isNativeSpelling(chain, token)) {
|
|
4200
|
+
const symbol = _chunkFKJ6EJHHcjs.getRuntimeNativeSymbol.call(void 0, chain);
|
|
4201
|
+
const decimals = _nullishCoalesce(_chunkFKJ6EJHHcjs.getRuntimeNativeDecimals.call(void 0, chain), () => ( (typeof chain === "number" ? 18 : void 0)));
|
|
4202
|
+
return symbol ? { symbol, decimals } : void 0;
|
|
4203
|
+
}
|
|
4204
|
+
return void 0;
|
|
4205
|
+
}
|
|
4206
|
+
function resolveTokenDisplay(token, chain, asset, fallback) {
|
|
4207
|
+
const pending = _optionalChain([asset, 'optionalAccess', _216 => _216.status]) === "pending";
|
|
4208
|
+
const curated = token !== void 0 && chain !== void 0 ? resolveCuratedToken(token, chain) : void 0;
|
|
4209
|
+
const fromAsset = _optionalChain([asset, 'optionalAccess', _217 => _217.status]) === "ready" ? asset : void 0;
|
|
4210
|
+
const hyperCore = chain !== void 0 && isHyperCore(chain);
|
|
4211
|
+
const native = token !== void 0 && chain !== void 0 && isNativeSpelling(chain, token);
|
|
4212
|
+
const curatedSymbol = native ? _nullishCoalesce(_optionalChain([curated, 'optionalAccess', _218 => _218.symbol]), () => ( _optionalChain([fromAsset, 'optionalAccess', _219 => _219.symbol]))) : _nullishCoalesce(_optionalChain([fromAsset, 'optionalAccess', _220 => _220.symbol]), () => ( _optionalChain([curated, 'optionalAccess', _221 => _221.symbol])));
|
|
4213
|
+
const decimals = _nullishCoalesce(_nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _222 => _222.decimals]), () => ( _optionalChain([curated, 'optionalAccess', _223 => _223.decimals]))), () => ( (hyperCore ? void 0 : _optionalChain([fromAsset, 'optionalAccess', _224 => _224.decimals]))));
|
|
4214
|
+
return {
|
|
4215
|
+
symbol: _nullishCoalesce(_nullishCoalesce(curatedSymbol, () => ( _optionalChain([fallback, 'optionalAccess', _225 => _225.symbol]))), () => ( "Token")),
|
|
4216
|
+
decimals,
|
|
4217
|
+
logo: _optionalChain([fromAsset, 'optionalAccess', _226 => _226.logo]),
|
|
4218
|
+
curated: curatedSymbol !== void 0,
|
|
4219
|
+
pending
|
|
4220
|
+
};
|
|
4221
|
+
}
|
|
4222
|
+
function toAssetRef(ref) {
|
|
4223
|
+
return _optionalChain([ref, 'optionalAccess', _227 => _227.chain]) !== void 0 && ref.address ? { chain: ref.chain, address: ref.address } : void 0;
|
|
4224
|
+
}
|
|
4225
|
+
function useTokenDisplays(refs) {
|
|
4226
|
+
const { catalog } = useChainCatalog();
|
|
4227
|
+
const tokensVersion = _react.useSyncExternalStore.call(void 0,
|
|
4228
|
+
subscribeToRuntimeTokens,
|
|
4229
|
+
getRuntimeTokensVersion,
|
|
4230
|
+
getRuntimeTokensVersion
|
|
4231
|
+
);
|
|
4232
|
+
const assets = useAssetMetadata(refs.map(toAssetRef));
|
|
4233
|
+
const key = refs.map(
|
|
4234
|
+
(ref) => `${String(_optionalChain([ref, 'optionalAccess', _228 => _228.chain]))}:${_nullishCoalesce(_optionalChain([ref, 'optionalAccess', _229 => _229.address]), () => ( ""))}:${_nullishCoalesce(_optionalChain([ref, 'optionalAccess', _230 => _230.fallback, 'optionalAccess', _231 => _231.symbol]), () => ( ""))}:${_nullishCoalesce(_optionalChain([ref, 'optionalAccess', _232 => _232.fallback, 'optionalAccess', _233 => _233.decimals]), () => ( ""))}`
|
|
4235
|
+
).join("|");
|
|
4236
|
+
return _react.useMemo.call(void 0,
|
|
4237
|
+
() => refs.map((ref) => {
|
|
4238
|
+
const id = assetIdFor(_optionalChain([ref, 'optionalAccess', _234 => _234.chain]), _optionalChain([ref, 'optionalAccess', _235 => _235.address]));
|
|
4239
|
+
return resolveTokenDisplay(
|
|
4240
|
+
_optionalChain([ref, 'optionalAccess', _236 => _236.address]),
|
|
4241
|
+
_optionalChain([ref, 'optionalAccess', _237 => _237.chain]),
|
|
4242
|
+
id ? assets[id] : void 0,
|
|
4243
|
+
_optionalChain([ref, 'optionalAccess', _238 => _238.fallback])
|
|
4244
|
+
);
|
|
4245
|
+
}),
|
|
4246
|
+
// `refs` enters through `key`.
|
|
4247
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4248
|
+
[key, assets, catalog, tokensVersion]
|
|
4249
|
+
);
|
|
4250
|
+
}
|
|
4251
|
+
function useTokenDisplay(chain, address, fallback) {
|
|
4252
|
+
return useTokenDisplays([{ chain, address, fallback }])[0];
|
|
4253
|
+
}
|
|
4254
|
+
function useIsRecognizedToken(chain, address) {
|
|
4255
|
+
return useTokenDisplay(chain, address).curated;
|
|
4256
|
+
}
|
|
4257
|
+
|
|
3695
4258
|
// src/components/history/DepositHistoryPanel.tsx
|
|
3696
4259
|
|
|
3697
4260
|
var MAX_TIMER_DELAY_MS = 2147e6;
|
|
@@ -3708,64 +4271,12 @@ function formatDate(iso) {
|
|
|
3708
4271
|
month: "short",
|
|
3709
4272
|
year: "numeric"
|
|
3710
4273
|
});
|
|
3711
|
-
} catch (
|
|
4274
|
+
} catch (e14) {
|
|
3712
4275
|
return iso;
|
|
3713
4276
|
}
|
|
3714
4277
|
}
|
|
3715
|
-
function
|
|
3716
|
-
if (
|
|
3717
|
-
if (typeof value === "number") return value;
|
|
3718
|
-
const display = _chunkOY5N3E6Lcjs.displayChainIdForCaip2.call(void 0, value);
|
|
3719
|
-
if (display !== null) return display;
|
|
3720
|
-
if (value === "solana" || value === "hypercore") return value;
|
|
3721
|
-
const num = Number(value);
|
|
3722
|
-
return Number.isFinite(num) ? num : null;
|
|
3723
|
-
}
|
|
3724
|
-
function resolveTokenSymbol(token, chainId) {
|
|
3725
|
-
if (!token) return "";
|
|
3726
|
-
if (chainId === "solana") {
|
|
3727
|
-
const normalized = token.toLowerCase();
|
|
3728
|
-
const matched = _chunkOY5N3E6Lcjs.SOLANA_TOKENS.find(
|
|
3729
|
-
(entry) => entry.mint.toLowerCase() === normalized
|
|
3730
|
-
);
|
|
3731
|
-
if (matched) return matched.symbol;
|
|
3732
|
-
if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
|
|
3733
|
-
return "SOL";
|
|
3734
|
-
}
|
|
3735
|
-
}
|
|
3736
|
-
if (chainId !== null && chainId !== void 0 && chainId !== "solana" && // Both callers pass the SOURCE chain, and `/chains` reports
|
|
3737
|
-
// `deposit: false` for Tron and Stellar — so neither can appear here, and
|
|
3738
|
-
// neither has an EVM token table to look one up in if it did.
|
|
3739
|
-
chainId !== "tron" && chainId !== "stellar" && /^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
3740
|
-
const evmChainId = chainId === "hypercore" ? _chunkOY5N3E6Lcjs.HYPERCORE_CHAIN_ID : chainId;
|
|
3741
|
-
const sym = _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, token, evmChainId);
|
|
3742
|
-
if (sym !== "Token") return sym;
|
|
3743
|
-
}
|
|
3744
|
-
return shortenHash(token);
|
|
3745
|
-
}
|
|
3746
|
-
function formatAmount(rawAmount, token, chainId) {
|
|
3747
|
-
if (!rawAmount) return "";
|
|
3748
|
-
let decimals = 18;
|
|
3749
|
-
if (token && chainId !== null && chainId !== void 0) {
|
|
3750
|
-
if (chainId === "solana") {
|
|
3751
|
-
const normalized = token.toLowerCase();
|
|
3752
|
-
const matched = _chunkOY5N3E6Lcjs.SOLANA_TOKENS.find(
|
|
3753
|
-
(entry) => entry.mint.toLowerCase() === normalized
|
|
3754
|
-
);
|
|
3755
|
-
if (matched) {
|
|
3756
|
-
decimals = matched.decimals;
|
|
3757
|
-
} else if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
|
|
3758
|
-
decimals = 9;
|
|
3759
|
-
}
|
|
3760
|
-
} else if (
|
|
3761
|
-
// See `resolveTokenSymbol`: this reads the source chain, which Tron and
|
|
3762
|
-
// Stellar cannot be.
|
|
3763
|
-
chainId !== "tron" && chainId !== "stellar" && /^0x[a-fA-F0-9]{40}$/.test(token)
|
|
3764
|
-
) {
|
|
3765
|
-
const evmChainId = chainId === "hypercore" ? _chunkOY5N3E6Lcjs.HYPERCORE_CHAIN_ID : chainId;
|
|
3766
|
-
decimals = _chunkOY5N3E6Lcjs.getTokenDecimalsByAddress.call(void 0, token, evmChainId);
|
|
3767
|
-
}
|
|
3768
|
-
}
|
|
4278
|
+
function formatAmount(rawAmount, decimals) {
|
|
4279
|
+
if (!rawAmount || decimals === void 0) return null;
|
|
3769
4280
|
try {
|
|
3770
4281
|
const raw = BigInt(rawAmount);
|
|
3771
4282
|
const divisor = 10n ** BigInt(decimals);
|
|
@@ -3775,11 +4286,13 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
3775
4286
|
let frac = fracStr.slice(0, 5).replace(/0+$/, "");
|
|
3776
4287
|
if (frac.length < 2) frac = frac.padEnd(2, "0");
|
|
3777
4288
|
return `${whole}.${frac}`;
|
|
3778
|
-
} catch (
|
|
4289
|
+
} catch (e15) {
|
|
3779
4290
|
return rawAmount;
|
|
3780
4291
|
}
|
|
3781
4292
|
}
|
|
3782
4293
|
function DepositHistoryPanel({
|
|
4294
|
+
bankHistory,
|
|
4295
|
+
bankSupportUrl,
|
|
3783
4296
|
deposits,
|
|
3784
4297
|
isLoading,
|
|
3785
4298
|
error,
|
|
@@ -3798,7 +4311,7 @@ function DepositHistoryPanel({
|
|
|
3798
4311
|
}) {
|
|
3799
4312
|
const rootRef = _react.useRef.call(void 0, null);
|
|
3800
4313
|
_react.useEffect.call(void 0, () => {
|
|
3801
|
-
_optionalChain([rootRef, 'access',
|
|
4314
|
+
_optionalChain([rootRef, 'access', _239 => _239.current, 'optionalAccess', _240 => _240.toggleAttribute, 'call', _241 => _241("inert", Boolean(obscured))]);
|
|
3802
4315
|
}, [obscured]);
|
|
3803
4316
|
const handleKeyDown = _react.useCallback.call(void 0,
|
|
3804
4317
|
(e) => {
|
|
@@ -3832,7 +4345,7 @@ function DepositHistoryPanel({
|
|
|
3832
4345
|
_react.useEffect.call(void 0, () => {
|
|
3833
4346
|
const nextBoundary = timingPresentations.reduce(
|
|
3834
4347
|
(earliest, presentation) => {
|
|
3835
|
-
const next = _optionalChain([presentation, 'optionalAccess',
|
|
4348
|
+
const next = _optionalChain([presentation, 'optionalAccess', _242 => _242.nextTransitionAtMs]);
|
|
3836
4349
|
if (next === void 0) return earliest;
|
|
3837
4350
|
return earliest === void 0 || next < earliest ? next : earliest;
|
|
3838
4351
|
},
|
|
@@ -3875,7 +4388,7 @@ function DepositHistoryPanel({
|
|
|
3875
4388
|
"aria-label": backLabel ? `Back to ${backLabel.toLowerCase()}` : "Back",
|
|
3876
4389
|
onClick: onClose,
|
|
3877
4390
|
children: [
|
|
3878
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronLeftIcon, {}),
|
|
4391
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronLeftIcon, {}),
|
|
3879
4392
|
backLabel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: backLabel })
|
|
3880
4393
|
]
|
|
3881
4394
|
}
|
|
@@ -3887,13 +4400,13 @@ function DepositHistoryPanel({
|
|
|
3887
4400
|
className: "rs-modal-close",
|
|
3888
4401
|
"aria-label": "Close",
|
|
3889
4402
|
onClick: onCloseModal,
|
|
3890
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CloseIcon, {})
|
|
4403
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CloseIcon, {})
|
|
3891
4404
|
}
|
|
3892
4405
|
) })
|
|
3893
4406
|
] }),
|
|
3894
4407
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen", children: [
|
|
3895
4408
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen-body", children: [
|
|
3896
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HistoryIcon, {}), title }),
|
|
4409
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.HistoryIcon, {}), title }),
|
|
3897
4410
|
onFindByTxHash && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3898
4411
|
"button",
|
|
3899
4412
|
{
|
|
@@ -3906,40 +4419,82 @@ function DepositHistoryPanel({
|
|
|
3906
4419
|
]
|
|
3907
4420
|
}
|
|
3908
4421
|
),
|
|
3909
|
-
isLoading && deposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
3910
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HistoryIcon, {}) }),
|
|
4422
|
+
(isLoading || _optionalChain([bankHistory, 'optionalAccess', _243 => _243.loading])) && deposits.length === 0 && !_optionalChain([bankHistory, 'optionalAccess', _244 => _244.orders, 'access', _245 => _245.length]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
4423
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.HistoryIcon, {}) }),
|
|
3911
4424
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
3912
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { className: "rs-spinner--sm" }),
|
|
4425
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.Spinner, { className: "rs-spinner--sm" }),
|
|
3913
4426
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
|
|
3914
4427
|
] })
|
|
3915
4428
|
] }),
|
|
3916
4429
|
error && !isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
3917
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertTriangleIcon, {}) }),
|
|
4430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.AlertTriangleIcon, {}) }),
|
|
3918
4431
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
3919
4432
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
|
|
3920
4433
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: error })
|
|
3921
4434
|
] })
|
|
3922
4435
|
] }),
|
|
3923
|
-
|
|
3924
|
-
|
|
4436
|
+
_optionalChain([bankHistory, 'optionalAccess', _246 => _246.error]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "status", children: bankHistory.error }),
|
|
4437
|
+
!isLoading && !error && !_optionalChain([bankHistory, 'optionalAccess', _247 => _247.loading]) && !_optionalChain([bankHistory, 'optionalAccess', _248 => _248.error]) && !_optionalChain([bankHistory, 'optionalAccess', _249 => _249.orders, 'access', _250 => _250.length]) && visibleDeposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
4438
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.HistoryIcon, {}) }),
|
|
3925
4439
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
3926
4440
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "No deposits yet" }),
|
|
3927
4441
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
|
|
3928
4442
|
] })
|
|
3929
4443
|
] }),
|
|
3930
|
-
visibleDeposits.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-list", children: [
|
|
3931
|
-
|
|
3932
|
-
|
|
4444
|
+
(visibleDeposits.length > 0 || Boolean(_optionalChain([bankHistory, 'optionalAccess', _251 => _251.orders, 'access', _252 => _252.length]))) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-list", children: [
|
|
4445
|
+
[
|
|
4446
|
+
...visibleDeposits.filter(
|
|
4447
|
+
(deposit) => !_optionalChain([bankHistory, 'optionalAccess', _253 => _253.orders, 'access', _254 => _254.some, 'call', _255 => _255(
|
|
4448
|
+
(order) => order.stages.delivery.status === "completed" && order.stages.delivery.depositId === deposit.id
|
|
4449
|
+
)])
|
|
4450
|
+
).map((deposit, i) => ({
|
|
4451
|
+
id: `deposit:${_nullishCoalesce(deposit.id, () => ( deposit.txHash))}`,
|
|
4452
|
+
createdAt: _nullishCoalesce(deposit.createdAt, () => ( "")),
|
|
4453
|
+
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4454
|
+
HistoryCard,
|
|
4455
|
+
{
|
|
4456
|
+
deposit,
|
|
4457
|
+
timing: timingPresentations[visibleDeposits.indexOf(deposit)],
|
|
4458
|
+
position: i,
|
|
4459
|
+
recipient,
|
|
4460
|
+
onRecover,
|
|
4461
|
+
onRowView
|
|
4462
|
+
},
|
|
4463
|
+
deposit.txHash || i
|
|
4464
|
+
)
|
|
4465
|
+
})),
|
|
4466
|
+
...(_nullishCoalesce(_optionalChain([bankHistory, 'optionalAccess', _256 => _256.orders]), () => ( []))).map((order) => {
|
|
4467
|
+
const delivery = order.stages.delivery;
|
|
4468
|
+
const linked = delivery.status === "completed" ? visibleDeposits.find(
|
|
4469
|
+
(deposit) => deposit.id === delivery.depositId
|
|
4470
|
+
) : void 0;
|
|
4471
|
+
return {
|
|
4472
|
+
id: `bank:${order.id}`,
|
|
4473
|
+
createdAt: order.createdAt,
|
|
4474
|
+
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BankOrderCard, { order, deposit: linked, supportUrl: bankSupportUrl, children: linked && normalizeStatus(linked.status) === "failed" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4475
|
+
HistoryCard,
|
|
4476
|
+
{
|
|
4477
|
+
deposit: linked,
|
|
4478
|
+
position: visibleDeposits.indexOf(linked),
|
|
4479
|
+
recipient,
|
|
4480
|
+
onRecover,
|
|
4481
|
+
onRowView,
|
|
4482
|
+
timing: timingPresentations[visibleDeposits.indexOf(linked)]
|
|
4483
|
+
}
|
|
4484
|
+
) })
|
|
4485
|
+
};
|
|
4486
|
+
})
|
|
4487
|
+
].sort((a, b) => b.createdAt.localeCompare(a.createdAt)).map((entry) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: entry.content }, entry.id)),
|
|
4488
|
+
_optionalChain([bankHistory, 'optionalAccess', _257 => _257.hasMore]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4489
|
+
"button",
|
|
3933
4490
|
{
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
deposit.txHash || i
|
|
3942
|
-
)),
|
|
4491
|
+
type: "button",
|
|
4492
|
+
className: "rs-history-load-more",
|
|
4493
|
+
disabled: bankHistory.loading,
|
|
4494
|
+
onClick: bankHistory.loadMore,
|
|
4495
|
+
children: "Load older bank transfers"
|
|
4496
|
+
}
|
|
4497
|
+
),
|
|
3943
4498
|
hasMore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3944
4499
|
"button",
|
|
3945
4500
|
{
|
|
@@ -3966,27 +4521,27 @@ function HistoryCard({
|
|
|
3966
4521
|
onRecover,
|
|
3967
4522
|
onRowView
|
|
3968
4523
|
}) {
|
|
3969
|
-
const explorerTxUrl = useExplorerTxUrl();
|
|
3970
4524
|
const [expanded, setExpanded] = _react.useState.call(void 0, false);
|
|
3971
4525
|
const panelId = _react.useId.call(void 0, );
|
|
3972
4526
|
const status = normalizeStatus(deposit.status, deposit.isSpam);
|
|
3973
|
-
const sourceChainId =
|
|
3974
|
-
const targetChainId =
|
|
3975
|
-
const sourceChainName = sourceChainId ?
|
|
3976
|
-
const targetChainName = targetChainId ?
|
|
3977
|
-
const sourceChainIcon = sourceChainId ?
|
|
3978
|
-
const targetChainIcon = targetChainId ?
|
|
3979
|
-
const
|
|
4527
|
+
const sourceChainId = resolveHistoryChainId(deposit.chain);
|
|
4528
|
+
const targetChainId = resolveHistoryChainId(deposit.targetChain);
|
|
4529
|
+
const sourceChainName = sourceChainId ? _chunkFKJ6EJHHcjs.getChainName.call(void 0, sourceChainId) : null;
|
|
4530
|
+
const targetChainName = targetChainId ? _chunkFKJ6EJHHcjs.getChainName.call(void 0, targetChainId) : null;
|
|
4531
|
+
const sourceChainIcon = sourceChainId ? _chunkFKJ6EJHHcjs.getChainIcon.call(void 0, sourceChainId) : void 0;
|
|
4532
|
+
const targetChainIcon = targetChainId ? _chunkFKJ6EJHHcjs.getChainIcon.call(void 0, targetChainId) : void 0;
|
|
4533
|
+
const sourceToken = _nullishCoalesce(deposit.token, () => ( void 0));
|
|
4534
|
+
const tokenDisplay = useTokenDisplay(_nullishCoalesce(sourceChainId, () => ( void 0)), sourceToken);
|
|
4535
|
+
const sourceSymbol = !sourceToken ? "" : tokenDisplay.curated ? tokenDisplay.symbol : shortenHash(sourceToken);
|
|
3980
4536
|
const rawAmount = deposit.sourceAmount && deposit.sourceAmount !== "0" ? deposit.sourceAmount : deposit.amount;
|
|
3981
|
-
const formattedAmount = rawAmount ? formatAmount(rawAmount,
|
|
4537
|
+
const formattedAmount = rawAmount ? formatAmount(rawAmount, tokenDisplay.decimals) : null;
|
|
3982
4538
|
const displayAmount = formattedAmount ? sourceSymbol && /^USD/.test(sourceSymbol) ? `$${Number(formattedAmount).toLocaleString("en-US", {
|
|
3983
4539
|
minimumFractionDigits: 2,
|
|
3984
4540
|
maximumFractionDigits: 2
|
|
3985
|
-
})}` : `${formattedAmount} ${sourceSymbol}` : "\u2014";
|
|
4541
|
+
})}` : `${formattedAmount} ${sourceSymbol}` : rawAmount && tokenDisplay.pending ? "\u2026" : "\u2014";
|
|
3986
4542
|
const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
|
|
3987
4543
|
const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
|
|
3988
4544
|
const srcTxHash = sourceChainId === "hypercore" ? deposit.txHash : deposit.sourceTxHash;
|
|
3989
|
-
const srcTxUrl = srcTxHash && sourceChainId ? explorerTxUrl(sourceChainId, srcTxHash) : null;
|
|
3990
4545
|
const eligible = toRecoverableDeposit(deposit, { recipient });
|
|
3991
4546
|
const recoverable = onRecover ? eligible : null;
|
|
3992
4547
|
const toggleExpanded = () => {
|
|
@@ -3994,7 +4549,7 @@ function HistoryCard({
|
|
|
3994
4549
|
setExpanded(next);
|
|
3995
4550
|
const depositId = _nullishCoalesce(deposit.id, () => ( deposit.txHash));
|
|
3996
4551
|
if (!next || !depositId) return;
|
|
3997
|
-
_optionalChain([onRowView, 'optionalCall',
|
|
4552
|
+
_optionalChain([onRowView, 'optionalCall', _258 => _258({
|
|
3998
4553
|
depositId,
|
|
3999
4554
|
status,
|
|
4000
4555
|
recoverable: eligible !== null,
|
|
@@ -4019,6 +4574,7 @@ function HistoryCard({
|
|
|
4019
4574
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-card-token", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4020
4575
|
TokenIcon,
|
|
4021
4576
|
{
|
|
4577
|
+
token: sourceChainId !== null && sourceToken ? { chain: sourceChainId, address: sourceToken } : void 0,
|
|
4022
4578
|
symbol: sourceSymbol,
|
|
4023
4579
|
fallback: sourceSymbol.slice(0, 2)
|
|
4024
4580
|
}
|
|
@@ -4052,22 +4608,7 @@ function HistoryCard({
|
|
|
4052
4608
|
targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CdnIcon, { src: targetChainIcon }) })
|
|
4053
4609
|
] })
|
|
4054
4610
|
] }),
|
|
4055
|
-
|
|
4056
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Transaction details" }),
|
|
4057
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4058
|
-
"a",
|
|
4059
|
-
{
|
|
4060
|
-
href: srcTxUrl,
|
|
4061
|
-
target: "_blank",
|
|
4062
|
-
rel: "noopener noreferrer",
|
|
4063
|
-
className: "rs-history-card-link",
|
|
4064
|
-
children: [
|
|
4065
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: shortenHash(srcTxHash) }),
|
|
4066
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ArrowUpRightIcon, {})
|
|
4067
|
-
]
|
|
4068
|
-
}
|
|
4069
|
-
)
|
|
4070
|
-
] }),
|
|
4611
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, HistoryTransactionLink, { chainId: sourceChainId, txHash: srcTxHash }),
|
|
4071
4612
|
timing && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4072
4613
|
"span",
|
|
4073
4614
|
{
|
|
@@ -4081,7 +4622,7 @@ function HistoryCard({
|
|
|
4081
4622
|
recoverable && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4082
4623
|
Button,
|
|
4083
4624
|
{
|
|
4084
|
-
onClick: () => _optionalChain([onRecover, 'optionalCall',
|
|
4625
|
+
onClick: () => _optionalChain([onRecover, 'optionalCall', _259 => _259(recoverable)]),
|
|
4085
4626
|
fullWidth: true,
|
|
4086
4627
|
className: "rs-history-card-recover",
|
|
4087
4628
|
children: [
|
|
@@ -4089,7 +4630,7 @@ function HistoryCard({
|
|
|
4089
4630
|
"Recover ",
|
|
4090
4631
|
displayAmount
|
|
4091
4632
|
] }),
|
|
4092
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronRightIcon, {})
|
|
4633
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronRightIcon, {})
|
|
4093
4634
|
]
|
|
4094
4635
|
}
|
|
4095
4636
|
)
|
|
@@ -4139,14 +4680,14 @@ function ListRow({
|
|
|
4139
4680
|
}
|
|
4140
4681
|
) : meta && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list-row-meta", children: meta })
|
|
4141
4682
|
] }),
|
|
4142
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-chevron", children: _nullishCoalesce(trailing, () => ( (disabled ? null : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronRightIcon, {})))) })
|
|
4683
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-chevron", children: _nullishCoalesce(trailing, () => ( (disabled ? null : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronRightIcon, {})))) })
|
|
4143
4684
|
] });
|
|
4144
4685
|
if (action) {
|
|
4145
4686
|
const handleKey = (e) => {
|
|
4146
4687
|
if (disabled) return;
|
|
4147
4688
|
if (e.key === "Enter" || e.key === " ") {
|
|
4148
4689
|
e.preventDefault();
|
|
4149
|
-
_optionalChain([onClick, 'optionalCall',
|
|
4690
|
+
_optionalChain([onClick, 'optionalCall', _260 => _260(e)]);
|
|
4150
4691
|
}
|
|
4151
4692
|
};
|
|
4152
4693
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -4156,7 +4697,7 @@ function ListRow({
|
|
|
4156
4697
|
role: "button",
|
|
4157
4698
|
tabIndex: disabled ? -1 : 0,
|
|
4158
4699
|
"aria-disabled": disabled || void 0,
|
|
4159
|
-
onClick: disabled ? void 0 : (e) => _optionalChain([onClick, 'optionalCall',
|
|
4700
|
+
onClick: disabled ? void 0 : (e) => _optionalChain([onClick, 'optionalCall', _261 => _261(e)]),
|
|
4160
4701
|
onKeyDown: handleKey,
|
|
4161
4702
|
children: inner
|
|
4162
4703
|
}
|
|
@@ -4196,7 +4737,7 @@ var Input = _react.forwardRef.call(void 0,
|
|
|
4196
4737
|
}
|
|
4197
4738
|
),
|
|
4198
4739
|
error ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "rs-input-error", children: [
|
|
4199
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertTriangleIcon, { className: "rs-input-error-icon" }),
|
|
4740
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.AlertTriangleIcon, { className: "rs-input-error-icon" }),
|
|
4200
4741
|
error
|
|
4201
4742
|
] }) : hint && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "rs-input-hint", children: hint })
|
|
4202
4743
|
] });
|
|
@@ -4214,7 +4755,7 @@ var RECOVERY_LOOKUP_MISS_COPY = {
|
|
|
4214
4755
|
};
|
|
4215
4756
|
function classifyRecoveryLookup(rows, options = {}) {
|
|
4216
4757
|
const inScope = options.recipient ? rows.filter(
|
|
4217
|
-
(row) => _optionalChain([row, 'access',
|
|
4758
|
+
(row) => _optionalChain([row, 'access', _262 => _262.recipient, 'optionalAccess', _263 => _263.toLowerCase, 'call', _264 => _264()]) === _optionalChain([options, 'access', _265 => _265.recipient, 'optionalAccess', _266 => _266.toLowerCase, 'call', _267 => _267()])
|
|
4218
4759
|
) : rows;
|
|
4219
4760
|
const eligible = inScope.map((row) => toRecoverableDeposit(row, options)).filter((deposit) => deposit !== null);
|
|
4220
4761
|
return {
|
|
@@ -4237,20 +4778,20 @@ function RecoveryLookupScreen({
|
|
|
4237
4778
|
onInvalid
|
|
4238
4779
|
}) {
|
|
4239
4780
|
const [txHash, setTxHash] = _react.useState.call(void 0, "");
|
|
4240
|
-
const onInvalidRef = useLatestRef(onInvalid);
|
|
4781
|
+
const onInvalidRef = _chunkG264OM23cjs.useLatestRef.call(void 0, onInvalid);
|
|
4241
4782
|
const trimmed = txHash.trim();
|
|
4242
4783
|
const valid = isRecoveryTxHash(trimmed);
|
|
4243
4784
|
_react.useEffect.call(void 0, () => {
|
|
4244
4785
|
if (trimmed.length > 0 && !valid) {
|
|
4245
|
-
_optionalChain([onInvalidRef, 'access',
|
|
4786
|
+
_optionalChain([onInvalidRef, 'access', _268 => _268.current, 'optionalCall', _269 => _269()]);
|
|
4246
4787
|
}
|
|
4247
4788
|
}, [trimmed, valid, onInvalidRef]);
|
|
4248
4789
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
4249
4790
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
4250
4791
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4251
|
-
BodyHeader,
|
|
4792
|
+
_chunkG264OM23cjs.BodyHeader,
|
|
4252
4793
|
{
|
|
4253
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HandCoinsIcon, {}),
|
|
4794
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.HandCoinsIcon, {}),
|
|
4254
4795
|
title,
|
|
4255
4796
|
subtitle
|
|
4256
4797
|
}
|
|
@@ -4304,43 +4845,12 @@ var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set([
|
|
|
4304
4845
|
"BUSD",
|
|
4305
4846
|
"USDE"
|
|
4306
4847
|
]);
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
if (token !== void 0) {
|
|
4310
|
-
if (chain === "solana") {
|
|
4311
|
-
const solanaToken = _chunkOY5N3E6Lcjs.getSolanaTokenByMint.call(void 0, token);
|
|
4312
|
-
if (solanaToken) {
|
|
4313
|
-
return { symbol: solanaToken.symbol, decimals: solanaToken.decimals };
|
|
4314
|
-
}
|
|
4315
|
-
} else if (chain === "hypercore") {
|
|
4316
|
-
const t = _chunkOY5N3E6Lcjs.HYPERCORE_SOURCE_TOKENS.find(
|
|
4317
|
-
(x) => x.address.toLowerCase() === token.toLowerCase()
|
|
4318
|
-
);
|
|
4319
|
-
if (t) return { symbol: t.symbol, decimals: t.decimals };
|
|
4320
|
-
} else if (chain === "tron" || chain === "stellar") {
|
|
4321
|
-
const published = _chunkOY5N3E6Lcjs.getRuntimeTokenByAddress.call(void 0, chain, token);
|
|
4322
|
-
if (published) {
|
|
4323
|
-
return { symbol: published.symbol, decimals: published.decimals };
|
|
4324
|
-
}
|
|
4325
|
-
} else if (EVM_ADDRESS_RE.test(token)) {
|
|
4326
|
-
const symbol = _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, token, chain);
|
|
4327
|
-
const decimals = _chunkOY5N3E6Lcjs.findTokenDecimals.call(void 0, token, chain);
|
|
4328
|
-
if (symbol !== "Token" || decimals !== void 0) {
|
|
4329
|
-
return {
|
|
4330
|
-
symbol: symbol !== "Token" ? symbol : _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _167 => _167.symbol]), () => ( symbol)),
|
|
4331
|
-
decimals: _nullishCoalesce(decimals, () => ( _optionalChain([fallback, 'optionalAccess', _168 => _168.decimals])))
|
|
4332
|
-
};
|
|
4333
|
-
}
|
|
4334
|
-
}
|
|
4335
|
-
}
|
|
4336
|
-
return {
|
|
4337
|
-
symbol: _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _169 => _169.symbol]), () => ( "Token")),
|
|
4338
|
-
decimals: _optionalChain([fallback, 'optionalAccess', _170 => _170.decimals])
|
|
4339
|
-
};
|
|
4848
|
+
function normalizeStableSymbol(symbol) {
|
|
4849
|
+
return symbol.trim().toUpperCase().replace(/₮/g, "T").replace(/\.E$/, "");
|
|
4340
4850
|
}
|
|
4341
4851
|
function maxFractionDigitsFor(symbol) {
|
|
4342
4852
|
if (!symbol) return 6;
|
|
4343
|
-
return STABLECOIN_SYMBOLS.has(symbol
|
|
4853
|
+
return STABLECOIN_SYMBOLS.has(normalizeStableSymbol(symbol)) ? 3 : 6;
|
|
4344
4854
|
}
|
|
4345
4855
|
function formatTokenAmount(amount, symbol) {
|
|
4346
4856
|
if (!Number.isFinite(amount)) return void 0;
|
|
@@ -4354,7 +4864,7 @@ function tokenAmountToNumber(rawAmount, decimals) {
|
|
|
4354
4864
|
try {
|
|
4355
4865
|
const value = Number(_viem.formatUnits.call(void 0, BigInt(rawAmount), decimals));
|
|
4356
4866
|
return Number.isFinite(value) ? value : void 0;
|
|
4357
|
-
} catch (
|
|
4867
|
+
} catch (e16) {
|
|
4358
4868
|
return void 0;
|
|
4359
4869
|
}
|
|
4360
4870
|
}
|
|
@@ -4364,26 +4874,13 @@ function formatRawTokenAmount(rawAmount, token) {
|
|
|
4364
4874
|
return formatTokenAmount(value, token.symbol);
|
|
4365
4875
|
}
|
|
4366
4876
|
function isDisplayStablecoinSymbol(symbol) {
|
|
4367
|
-
return symbol !== void 0 && STABLECOIN_SYMBOLS.has(symbol
|
|
4877
|
+
return symbol !== void 0 && STABLECOIN_SYMBOLS.has(normalizeStableSymbol(symbol));
|
|
4368
4878
|
}
|
|
4369
4879
|
function priceUsdFor(symbol, prices) {
|
|
4370
4880
|
if (!symbol) return void 0;
|
|
4371
4881
|
const quoted = prices[symbol.toUpperCase()];
|
|
4372
4882
|
return typeof quoted === "number" && quoted > 0 ? quoted : void 0;
|
|
4373
4883
|
}
|
|
4374
|
-
function isRecognizedToken(address, chain) {
|
|
4375
|
-
if (address === void 0 || chain === void 0) return false;
|
|
4376
|
-
if (chain === "solana") return _chunkOY5N3E6Lcjs.getSolanaTokenByMint.call(void 0, address) !== void 0;
|
|
4377
|
-
if (chain === "hypercore") {
|
|
4378
|
-
return _chunkOY5N3E6Lcjs.HYPERCORE_SOURCE_TOKENS.some(
|
|
4379
|
-
(t) => t.address.toLowerCase() === address.toLowerCase()
|
|
4380
|
-
);
|
|
4381
|
-
}
|
|
4382
|
-
if (chain === "tron" || chain === "stellar") {
|
|
4383
|
-
return _chunkOY5N3E6Lcjs.getRuntimeTokenByAddress.call(void 0, chain, address) !== void 0;
|
|
4384
|
-
}
|
|
4385
|
-
return EVM_ADDRESS_RE.test(address) && _chunkOY5N3E6Lcjs.isRegistryTokenOnChain.call(void 0, address, chain);
|
|
4386
|
-
}
|
|
4387
4884
|
function estimateReceiveAmount(params) {
|
|
4388
4885
|
const {
|
|
4389
4886
|
sourceAmount,
|
|
@@ -4412,7 +4909,7 @@ function formatQuotedReceive(output, fallbackSymbol) {
|
|
|
4412
4909
|
let raw;
|
|
4413
4910
|
try {
|
|
4414
4911
|
raw = BigInt(output.amount);
|
|
4415
|
-
} catch (
|
|
4912
|
+
} catch (e17) {
|
|
4416
4913
|
return void 0;
|
|
4417
4914
|
}
|
|
4418
4915
|
if (raw <= 0n) return void 0;
|
|
@@ -4435,27 +4932,21 @@ function formatReceiveEstimate(params) {
|
|
|
4435
4932
|
|
|
4436
4933
|
// src/components/recovery/recovery-display.ts
|
|
4437
4934
|
function describeRecoveryDeposit(params) {
|
|
4438
|
-
const token = _nullishCoalesce(params.token, () => ( "0x"));
|
|
4439
|
-
const decimals = _chunkOY5N3E6Lcjs.getTokenDecimalsByAddress.call(void 0, token, params.chainId);
|
|
4440
|
-
const symbol = _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, token, params.chainId);
|
|
4441
|
-
const raw = toBigInt(params.amountRaw);
|
|
4442
|
-
const human = Number(_viem.formatUnits.call(void 0, raw, decimals));
|
|
4443
4935
|
return {
|
|
4444
|
-
symbol,
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
chainName: _chunkOY5N3E6Lcjs.getChainName.call(void 0, params.chainId),
|
|
4448
|
-
chainIcon: _chunkOY5N3E6Lcjs.getChainIcon.call(void 0, params.chainId)
|
|
4936
|
+
amount: formatRecoveryAmount(params.amountRaw, params.decimals, params.symbol),
|
|
4937
|
+
chainName: _chunkFKJ6EJHHcjs.getChainName.call(void 0, params.chainId),
|
|
4938
|
+
chainIcon: _chunkFKJ6EJHHcjs.getChainIcon.call(void 0, params.chainId)
|
|
4449
4939
|
};
|
|
4450
4940
|
}
|
|
4451
4941
|
function formatRecoveryAmount(amountRaw, decimals, symbol) {
|
|
4942
|
+
if (decimals === void 0) return "\u2014";
|
|
4452
4943
|
const raw = toBigInt(amountRaw);
|
|
4453
4944
|
return _nullishCoalesce(formatTokenAmount(Number(_viem.formatUnits.call(void 0, raw, decimals)), symbol), () => ( _viem.formatUnits.call(void 0, raw, decimals)));
|
|
4454
4945
|
}
|
|
4455
4946
|
function toBigInt(value) {
|
|
4456
4947
|
try {
|
|
4457
4948
|
return BigInt(value || "0");
|
|
4458
|
-
} catch (
|
|
4949
|
+
} catch (e18) {
|
|
4459
4950
|
return 0n;
|
|
4460
4951
|
}
|
|
4461
4952
|
}
|
|
@@ -4589,7 +5080,7 @@ async function submitSignedRecovery(params) {
|
|
|
4589
5080
|
// The shared const, so recovery carries `x-deposit-modal-version` like
|
|
4590
5081
|
// every other backend call. Without it this path would be invisible in the
|
|
4591
5082
|
// per-client version telemetry the processor records.
|
|
4592
|
-
headers:
|
|
5083
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
4593
5084
|
// `depositId` as a string: it is a uint256 upstream and JSON numbers lose
|
|
4594
5085
|
// precision well before that range.
|
|
4595
5086
|
body: JSON.stringify({ depositId, destination, signature })
|
|
@@ -5008,6 +5499,12 @@ function HistoryFallbackFlow({
|
|
|
5008
5499
|
},
|
|
5009
5500
|
[onBack]
|
|
5010
5501
|
);
|
|
5502
|
+
const matchDisplays = useTokenDisplays(
|
|
5503
|
+
(_nullishCoalesce(matches, () => ( []))).map((match) => ({
|
|
5504
|
+
chain: match.sourceChainId,
|
|
5505
|
+
address: match.token
|
|
5506
|
+
}))
|
|
5507
|
+
);
|
|
5011
5508
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
5012
5509
|
"div",
|
|
5013
5510
|
{
|
|
@@ -5025,7 +5522,7 @@ function HistoryFallbackFlow({
|
|
|
5025
5522
|
"aria-label": "Back to history",
|
|
5026
5523
|
onClick: () => onBack(),
|
|
5027
5524
|
children: [
|
|
5028
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronLeftIcon, {}),
|
|
5525
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronLeftIcon, {}),
|
|
5029
5526
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "History" })
|
|
5030
5527
|
]
|
|
5031
5528
|
}
|
|
@@ -5037,30 +5534,33 @@ function HistoryFallbackFlow({
|
|
|
5037
5534
|
className: "rs-modal-close",
|
|
5038
5535
|
"aria-label": "Close",
|
|
5039
5536
|
onClick: onCloseModal,
|
|
5040
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CloseIcon, {})
|
|
5537
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CloseIcon, {})
|
|
5041
5538
|
}
|
|
5042
5539
|
) })
|
|
5043
5540
|
] }),
|
|
5044
5541
|
matches ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
5045
5542
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5046
5543
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5047
|
-
BodyHeader,
|
|
5544
|
+
_chunkG264OM23cjs.BodyHeader,
|
|
5048
5545
|
{
|
|
5049
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CoinsIcon, {}),
|
|
5546
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CoinsIcon, {}),
|
|
5050
5547
|
title: "Select a deposit",
|
|
5051
5548
|
subtitle: "This transaction produced multiple deposits. Choose the one to recover."
|
|
5052
5549
|
}
|
|
5053
5550
|
),
|
|
5054
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list", children: matches.map((match) => {
|
|
5055
|
-
const
|
|
5551
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list", children: matches.map((match, i) => {
|
|
5552
|
+
const display = matchDisplays[i];
|
|
5553
|
+
const symbol = _nullishCoalesce(_optionalChain([display, 'optionalAccess', _270 => _270.symbol]), () => ( "Token"));
|
|
5554
|
+
const { amount, chainName } = describeRecoveryDeposit({
|
|
5056
5555
|
chainId: match.sourceChainId,
|
|
5057
|
-
|
|
5058
|
-
|
|
5556
|
+
amountRaw: match.amountRaw,
|
|
5557
|
+
symbol,
|
|
5558
|
+
decimals: _optionalChain([display, 'optionalAccess', _271 => _271.decimals])
|
|
5059
5559
|
});
|
|
5060
5560
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5061
5561
|
ListRow,
|
|
5062
5562
|
{
|
|
5063
|
-
leadingMedia:
|
|
5563
|
+
leadingMedia: _optionalChain([display, 'optionalAccess', _272 => _272.logo]),
|
|
5064
5564
|
title: `${amount} ${symbol}`,
|
|
5065
5565
|
subtitle: chainName,
|
|
5066
5566
|
onClick: () => selectMatch(match)
|
|
@@ -5109,9 +5609,9 @@ function RecoveryOutcomeScreen({
|
|
|
5109
5609
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
5110
5610
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5111
5611
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5112
|
-
BodyHeader,
|
|
5612
|
+
_chunkG264OM23cjs.BodyHeader,
|
|
5113
5613
|
{
|
|
5114
|
-
icon: success ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertTriangleIcon, {}),
|
|
5614
|
+
icon: success ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.AlertTriangleIcon, {}),
|
|
5115
5615
|
variant: success ? "success" : "error",
|
|
5116
5616
|
title: success ? "Refund submitted" : "Refund failed",
|
|
5117
5617
|
subtitle: success ? "Your funds are being returned on the source chain." : void 0
|
|
@@ -5126,7 +5626,13 @@ function RecoveryOutcomeScreen({
|
|
|
5126
5626
|
" ",
|
|
5127
5627
|
result.symbol
|
|
5128
5628
|
] }),
|
|
5129
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5629
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5630
|
+
TokenIcon,
|
|
5631
|
+
{
|
|
5632
|
+
token: result.token ? { chain: result.chainId, address: result.token } : void 0,
|
|
5633
|
+
symbol: result.symbol
|
|
5634
|
+
}
|
|
5635
|
+
) })
|
|
5130
5636
|
] })
|
|
5131
5637
|
] }),
|
|
5132
5638
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -5144,7 +5650,7 @@ function RecoveryOutcomeScreen({
|
|
|
5144
5650
|
rel: "noreferrer",
|
|
5145
5651
|
children: [
|
|
5146
5652
|
shortenHash2(result.txHash),
|
|
5147
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {})
|
|
5653
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ExternalLinkIcon, {})
|
|
5148
5654
|
]
|
|
5149
5655
|
}
|
|
5150
5656
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: shortenHash2(result.txHash) })
|
|
@@ -5167,35 +5673,53 @@ function RecoveryReviewScreen({
|
|
|
5167
5673
|
amountRaw,
|
|
5168
5674
|
txHash,
|
|
5169
5675
|
defaultDestination,
|
|
5170
|
-
|
|
5676
|
+
depositAddress,
|
|
5171
5677
|
submitting,
|
|
5172
5678
|
onSubmit,
|
|
5173
|
-
onDestinationInvalid
|
|
5679
|
+
onDestinationInvalid,
|
|
5680
|
+
onDestinationIsDepositAddress
|
|
5174
5681
|
}) {
|
|
5175
|
-
const { symbol,
|
|
5682
|
+
const { symbol, decimals } = useTokenDisplay(chainId, token);
|
|
5683
|
+
const { amount, chainName, chainIcon } = describeRecoveryDeposit({
|
|
5176
5684
|
chainId,
|
|
5177
|
-
|
|
5178
|
-
|
|
5685
|
+
amountRaw,
|
|
5686
|
+
symbol,
|
|
5687
|
+
decimals
|
|
5179
5688
|
});
|
|
5180
5689
|
const explorerTxUrl = useExplorerTxUrl();
|
|
5181
|
-
const [destination, setDestination] = _react.useState.call(void 0,
|
|
5182
|
-
|
|
5690
|
+
const [destination, setDestination] = _react.useState.call(void 0, _nullishCoalesce(defaultDestination, () => ( "")));
|
|
5691
|
+
const isSelfDestination = isDepositSelfDestination(
|
|
5692
|
+
{ depositAddress },
|
|
5693
|
+
destination
|
|
5694
|
+
);
|
|
5695
|
+
const destinationValid = _viem.isAddress.call(void 0, destination) && !isSelfDestination;
|
|
5696
|
+
const onDestinationInvalidRef = _chunkG264OM23cjs.useLatestRef.call(void 0, onDestinationInvalid);
|
|
5697
|
+
const onDestinationIsDepositAddressRef = _chunkG264OM23cjs.useLatestRef.call(void 0,
|
|
5698
|
+
onDestinationIsDepositAddress
|
|
5183
5699
|
);
|
|
5184
|
-
const destinationValid = _viem.isAddress.call(void 0, destination);
|
|
5185
|
-
const onDestinationInvalidRef = useLatestRef(onDestinationInvalid);
|
|
5186
5700
|
_react.useEffect.call(void 0, () => {
|
|
5187
|
-
if (destination.length
|
|
5188
|
-
|
|
5701
|
+
if (destination.length === 0) return;
|
|
5702
|
+
if (isSelfDestination) {
|
|
5703
|
+
_optionalChain([onDestinationIsDepositAddressRef, 'access', _273 => _273.current, 'optionalCall', _274 => _274()]);
|
|
5704
|
+
} else if (!destinationValid) {
|
|
5705
|
+
_optionalChain([onDestinationInvalidRef, 'access', _275 => _275.current, 'optionalCall', _276 => _276()]);
|
|
5189
5706
|
}
|
|
5190
|
-
}, [
|
|
5707
|
+
}, [
|
|
5708
|
+
destination,
|
|
5709
|
+
destinationValid,
|
|
5710
|
+
isSelfDestination,
|
|
5711
|
+
onDestinationInvalidRef,
|
|
5712
|
+
onDestinationIsDepositAddressRef
|
|
5713
|
+
]);
|
|
5714
|
+
const selfDestinationError = `${shortenAddress(destination)} is this deposit's own address. Enter a different address.`;
|
|
5191
5715
|
const txUrl = txHash ? explorerTxUrl(chainId, txHash) : null;
|
|
5192
5716
|
const txShort = txHash ? shortenHash2(txHash) : "\u2014";
|
|
5193
5717
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
5194
5718
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5195
5719
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5196
|
-
BodyHeader,
|
|
5720
|
+
_chunkG264OM23cjs.BodyHeader,
|
|
5197
5721
|
{
|
|
5198
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HandCoinsIcon, {}),
|
|
5722
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.HandCoinsIcon, {}),
|
|
5199
5723
|
title: "Review refund",
|
|
5200
5724
|
subtitle: "This returns the funds on the source chain. It does not retry the original deposit."
|
|
5201
5725
|
}
|
|
@@ -5209,7 +5733,13 @@ function RecoveryReviewScreen({
|
|
|
5209
5733
|
" ",
|
|
5210
5734
|
symbol
|
|
5211
5735
|
] }),
|
|
5212
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5736
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5737
|
+
TokenIcon,
|
|
5738
|
+
{
|
|
5739
|
+
token: token ? { chain: chainId, address: token } : void 0,
|
|
5740
|
+
symbol
|
|
5741
|
+
}
|
|
5742
|
+
) })
|
|
5213
5743
|
] })
|
|
5214
5744
|
] }),
|
|
5215
5745
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -5230,7 +5760,7 @@ function RecoveryReviewScreen({
|
|
|
5230
5760
|
rel: "noreferrer",
|
|
5231
5761
|
children: [
|
|
5232
5762
|
txShort,
|
|
5233
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {})
|
|
5763
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ExternalLinkIcon, {})
|
|
5234
5764
|
]
|
|
5235
5765
|
}
|
|
5236
5766
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: txShort })
|
|
@@ -5243,8 +5773,8 @@ function RecoveryReviewScreen({
|
|
|
5243
5773
|
placeholder: "0x\u2026",
|
|
5244
5774
|
value: destination,
|
|
5245
5775
|
onChange: (e) => setDestination(e.target.value),
|
|
5246
|
-
hint:
|
|
5247
|
-
error: destination.length > 0 && !destinationValid ? "Enter a valid address" : void 0
|
|
5776
|
+
hint: `An address you control on ${chainName}.`,
|
|
5777
|
+
error: isSelfDestination ? selfDestinationError : destination.length > 0 && !destinationValid ? "Enter a valid address" : void 0
|
|
5248
5778
|
}
|
|
5249
5779
|
),
|
|
5250
5780
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -5282,6 +5812,7 @@ function HistoryRecoveryFlow({
|
|
|
5282
5812
|
const [outcome, setOutcome] = _react.useState.call(void 0, null);
|
|
5283
5813
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
5284
5814
|
const [retryable, setRetryable] = _react.useState.call(void 0, false);
|
|
5815
|
+
const [destination, setDestination] = _react.useState.call(void 0, );
|
|
5285
5816
|
const lastFailureRef = _react.useRef.call(void 0, null);
|
|
5286
5817
|
_react.useEffect.call(void 0, () => {
|
|
5287
5818
|
if (entrySource === "history_row") {
|
|
@@ -5293,13 +5824,13 @@ function HistoryRecoveryFlow({
|
|
|
5293
5824
|
}
|
|
5294
5825
|
analytics.openStep("review");
|
|
5295
5826
|
}, [analytics, deposit, entrySource]);
|
|
5296
|
-
const { symbol, decimals } =
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
});
|
|
5827
|
+
const { symbol, decimals } = useTokenDisplay(
|
|
5828
|
+
deposit.sourceChainId,
|
|
5829
|
+
deposit.token
|
|
5830
|
+
);
|
|
5301
5831
|
const submit = _react.useCallback.call(void 0,
|
|
5302
|
-
async (
|
|
5832
|
+
async (destination2) => {
|
|
5833
|
+
setDestination(destination2);
|
|
5303
5834
|
setPhase("submitting");
|
|
5304
5835
|
onSubmittingChange(true);
|
|
5305
5836
|
analytics.completeStep("review");
|
|
@@ -5312,14 +5843,14 @@ function HistoryRecoveryFlow({
|
|
|
5312
5843
|
chainId: deposit.targetChainId,
|
|
5313
5844
|
depositId: deposit.depositId,
|
|
5314
5845
|
signer: deposit.signer,
|
|
5315
|
-
destination,
|
|
5846
|
+
destination: destination2,
|
|
5316
5847
|
signRecovery,
|
|
5317
5848
|
debug
|
|
5318
5849
|
});
|
|
5319
5850
|
setOutcome({
|
|
5320
5851
|
// No destination to reconcile: it is inside the signed struct, so the
|
|
5321
5852
|
// processor cannot have paid anywhere else.
|
|
5322
|
-
destination,
|
|
5853
|
+
destination: destination2,
|
|
5323
5854
|
txHash: result.transactionHash,
|
|
5324
5855
|
symbol,
|
|
5325
5856
|
amountDisplay: formatRecoveryAmount(
|
|
@@ -5343,11 +5874,11 @@ function HistoryRecoveryFlow({
|
|
|
5343
5874
|
} catch (err) {
|
|
5344
5875
|
const recoveryError = err instanceof RecoveryError ? err : void 0;
|
|
5345
5876
|
setError(
|
|
5346
|
-
_nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess',
|
|
5877
|
+
_nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _277 => _277.message]), () => ( formatUserError(
|
|
5347
5878
|
err instanceof Error ? err.message : "Recovery failed"
|
|
5348
5879
|
)))
|
|
5349
5880
|
);
|
|
5350
|
-
const canRetry = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess',
|
|
5881
|
+
const canRetry = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _278 => _278.retryable]), () => ( true));
|
|
5351
5882
|
setRetryable(canRetry);
|
|
5352
5883
|
setPhase("failed");
|
|
5353
5884
|
const reason = claimFailureReasonForError(err);
|
|
@@ -5396,7 +5927,7 @@ function HistoryRecoveryFlow({
|
|
|
5396
5927
|
"aria-label": "Back to history",
|
|
5397
5928
|
onClick: onBack,
|
|
5398
5929
|
children: [
|
|
5399
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronLeftIcon, {}),
|
|
5930
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronLeftIcon, {}),
|
|
5400
5931
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "History" })
|
|
5401
5932
|
]
|
|
5402
5933
|
}
|
|
@@ -5409,7 +5940,7 @@ function HistoryRecoveryFlow({
|
|
|
5409
5940
|
"aria-label": "Close",
|
|
5410
5941
|
onClick: onCloseModal,
|
|
5411
5942
|
disabled: submitting,
|
|
5412
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CloseIcon, {})
|
|
5943
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CloseIcon, {})
|
|
5413
5944
|
}
|
|
5414
5945
|
) })
|
|
5415
5946
|
] }),
|
|
@@ -5420,17 +5951,25 @@ function HistoryRecoveryFlow({
|
|
|
5420
5951
|
token: deposit.token,
|
|
5421
5952
|
amountRaw: deposit.amountRaw,
|
|
5422
5953
|
txHash: deposit.sourceTxHash,
|
|
5423
|
-
defaultDestination:
|
|
5424
|
-
|
|
5954
|
+
defaultDestination: destination,
|
|
5955
|
+
depositAddress: deposit.depositAddress,
|
|
5425
5956
|
submitting,
|
|
5426
5957
|
onSubmit: submit,
|
|
5427
|
-
onDestinationInvalid: () => analytics.friction("refund_destination_invalid", "review")
|
|
5958
|
+
onDestinationInvalid: () => analytics.friction("refund_destination_invalid", "review"),
|
|
5959
|
+
onDestinationIsDepositAddress: () => analytics.friction(
|
|
5960
|
+
"refund_destination_is_deposit_address",
|
|
5961
|
+
"review"
|
|
5962
|
+
)
|
|
5428
5963
|
}
|
|
5429
5964
|
),
|
|
5430
5965
|
phase === "success" && outcome && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5431
5966
|
RecoveryOutcomeScreen,
|
|
5432
5967
|
{
|
|
5433
|
-
result: {
|
|
5968
|
+
result: {
|
|
5969
|
+
...outcome,
|
|
5970
|
+
chainId: deposit.sourceChainId,
|
|
5971
|
+
token: deposit.token
|
|
5972
|
+
},
|
|
5434
5973
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "outline", onClick: onBack, fullWidth: true, children: "Back to history" })
|
|
5435
5974
|
}
|
|
5436
5975
|
),
|
|
@@ -5448,6 +5987,8 @@ HistoryRecoveryFlow.displayName = "HistoryRecoveryFlow";
|
|
|
5448
5987
|
|
|
5449
5988
|
function HistoryOverlay({
|
|
5450
5989
|
controller,
|
|
5990
|
+
bankHistory,
|
|
5991
|
+
bankSupportUrl,
|
|
5451
5992
|
backLabel,
|
|
5452
5993
|
title,
|
|
5453
5994
|
recipient,
|
|
@@ -5488,8 +6029,8 @@ function HistoryOverlay({
|
|
|
5488
6029
|
const endAttempt = _react.useCallback.call(void 0,
|
|
5489
6030
|
(source, reason) => {
|
|
5490
6031
|
const claim = claimControllerRef.current;
|
|
5491
|
-
_optionalChain([claim, 'optionalAccess',
|
|
5492
|
-
_optionalChain([claim, 'optionalAccess',
|
|
6032
|
+
_optionalChain([claim, 'optionalAccess', _279 => _279.abandon, 'call', _280 => _280(reason)]);
|
|
6033
|
+
_optionalChain([claim, 'optionalAccess', _281 => _281.close, 'call', _282 => _282(source)]);
|
|
5493
6034
|
claimControllerRef.current = null;
|
|
5494
6035
|
setAttempt(null);
|
|
5495
6036
|
},
|
|
@@ -5547,15 +6088,15 @@ function HistoryOverlay({
|
|
|
5547
6088
|
if (!attempt) return;
|
|
5548
6089
|
return () => {
|
|
5549
6090
|
const claim = claimControllerRef.current;
|
|
5550
|
-
_optionalChain([claim, 'optionalAccess',
|
|
5551
|
-
_optionalChain([claim, 'optionalAccess',
|
|
6091
|
+
_optionalChain([claim, 'optionalAccess', _283 => _283.abandon, 'call', _284 => _284("modal_close")]);
|
|
6092
|
+
_optionalChain([claim, 'optionalAccess', _285 => _285.close, 'call', _286 => _286("host_controlled")]);
|
|
5552
6093
|
};
|
|
5553
6094
|
}, [attempt]);
|
|
5554
6095
|
const claimSessionProperties = _react.useMemo.call(void 0,
|
|
5555
6096
|
() => ({
|
|
5556
6097
|
presentation: inline ? "inline" : "overlay",
|
|
5557
6098
|
overlay_close_enabled: !inline && Boolean(closeOnOverlayClick),
|
|
5558
|
-
prefills: { transaction_hash: false, refund_destination:
|
|
6099
|
+
prefills: { transaction_hash: false, refund_destination: false }
|
|
5559
6100
|
}),
|
|
5560
6101
|
[inline, closeOnOverlayClick]
|
|
5561
6102
|
);
|
|
@@ -5574,7 +6115,7 @@ function HistoryOverlay({
|
|
|
5574
6115
|
HistoryRecoveryFlow,
|
|
5575
6116
|
{
|
|
5576
6117
|
deposit: recovering,
|
|
5577
|
-
entrySource: _nullishCoalesce(_optionalChain([attempt, 'optionalAccess',
|
|
6118
|
+
entrySource: _nullishCoalesce(_optionalChain([attempt, 'optionalAccess', _287 => _287.entrySource]), () => ( "history_row")),
|
|
5578
6119
|
backendUrl,
|
|
5579
6120
|
signRecovery,
|
|
5580
6121
|
debug,
|
|
@@ -5589,6 +6130,8 @@ function HistoryOverlay({
|
|
|
5589
6130
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5590
6131
|
DepositHistoryPanel,
|
|
5591
6132
|
{
|
|
6133
|
+
bankHistory,
|
|
6134
|
+
bankSupportUrl,
|
|
5592
6135
|
deposits: controller.deposits,
|
|
5593
6136
|
isLoading: controller.isLoading,
|
|
5594
6137
|
error: controller.error,
|
|
@@ -5728,7 +6271,7 @@ function useHistoryPanel({
|
|
|
5728
6271
|
}, [isOpen, badgeState2.nextExpiryAt]);
|
|
5729
6272
|
const openPanel = _react.useCallback.call(void 0, () => {
|
|
5730
6273
|
setIsPanelOpen(true);
|
|
5731
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
6274
|
+
_optionalChain([analytics, 'optionalAccess', _288 => _288.visitOpened, 'call', _289 => _289(badge)]);
|
|
5732
6275
|
if (!loadedRef.current || staleRef.current) {
|
|
5733
6276
|
fetchHistory("initial");
|
|
5734
6277
|
}
|
|
@@ -5736,10 +6279,10 @@ function useHistoryPanel({
|
|
|
5736
6279
|
const closePanel = _react.useCallback.call(void 0, () => {
|
|
5737
6280
|
if (recovering) return;
|
|
5738
6281
|
setIsPanelOpen(false);
|
|
5739
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
6282
|
+
_optionalChain([analytics, 'optionalAccess', _290 => _290.visitEnded, 'call', _291 => _291()]);
|
|
5740
6283
|
}, [analytics, recovering]);
|
|
5741
6284
|
const loadMore = _react.useCallback.call(void 0, () => {
|
|
5742
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
6285
|
+
_optionalChain([analytics, 'optionalAccess', _292 => _292.loadMore, 'call', _293 => _293(filterVisibleDeposits(deposits).length)]);
|
|
5743
6286
|
fetchHistory("more");
|
|
5744
6287
|
}, [analytics, deposits, fetchHistory]);
|
|
5745
6288
|
const markStale = _react.useCallback.call(void 0, () => {
|
|
@@ -5767,7 +6310,7 @@ function useHistoryPanel({
|
|
|
5767
6310
|
_react.useEffect.call(void 0, () => {
|
|
5768
6311
|
if (isOpen) return;
|
|
5769
6312
|
setIsPanelOpen(false);
|
|
5770
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
6313
|
+
_optionalChain([analytics, 'optionalAccess', _294 => _294.visitEnded, 'call', _295 => _295()]);
|
|
5771
6314
|
setDeposits([]);
|
|
5772
6315
|
setHasMore(false);
|
|
5773
6316
|
setError(null);
|
|
@@ -5926,11 +6469,11 @@ var NOTHING_TO_STOP = () => {
|
|
|
5926
6469
|
};
|
|
5927
6470
|
function resolveThemeMode(mode) {
|
|
5928
6471
|
if (mode !== "system") return mode;
|
|
5929
|
-
return _optionalChain([globalThis, 'access',
|
|
6472
|
+
return _optionalChain([globalThis, 'access', _296 => _296.matchMedia, 'optionalCall', _297 => _297(DARK_SCHEME_QUERY), 'access', _298 => _298.matches]) ? "dark" : "light";
|
|
5930
6473
|
}
|
|
5931
6474
|
function followSystemAppearance(mode, onChange) {
|
|
5932
6475
|
if (mode !== "system") return NOTHING_TO_STOP;
|
|
5933
|
-
const query = _optionalChain([globalThis, 'access',
|
|
6476
|
+
const query = _optionalChain([globalThis, 'access', _299 => _299.matchMedia, 'optionalCall', _300 => _300(DARK_SCHEME_QUERY)]);
|
|
5934
6477
|
if (!query) return NOTHING_TO_STOP;
|
|
5935
6478
|
query.addEventListener("change", onChange);
|
|
5936
6479
|
return () => query.removeEventListener("change", onChange);
|
|
@@ -5938,22 +6481,22 @@ function followSystemAppearance(mode, onChange) {
|
|
|
5938
6481
|
function applyTheme(element, theme) {
|
|
5939
6482
|
if (!element) return NOTHING_TO_STOP;
|
|
5940
6483
|
const parent = element.parentElement;
|
|
5941
|
-
const targets = _optionalChain([parent, 'optionalAccess',
|
|
6484
|
+
const targets = _optionalChain([parent, 'optionalAccess', _301 => _301.classList, 'access', _302 => _302.contains, 'call', _303 => _303("rs-modal-content")]) ? [element, parent] : [element];
|
|
5942
6485
|
const paintMode = () => {
|
|
5943
|
-
const resolved = resolveThemeMode(_optionalChain([theme, 'optionalAccess',
|
|
6486
|
+
const resolved = resolveThemeMode(_optionalChain([theme, 'optionalAccess', _304 => _304.mode]));
|
|
5944
6487
|
for (const t of targets) {
|
|
5945
6488
|
if (resolved) t.setAttribute("data-theme", resolved);
|
|
5946
6489
|
else t.removeAttribute("data-theme");
|
|
5947
6490
|
}
|
|
5948
6491
|
};
|
|
5949
6492
|
paintMode();
|
|
5950
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6493
|
+
if (_optionalChain([theme, 'optionalAccess', _305 => _305.fontColor])) {
|
|
5951
6494
|
setVar(targets, "--rs-foreground", theme.fontColor);
|
|
5952
6495
|
}
|
|
5953
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6496
|
+
if (_optionalChain([theme, 'optionalAccess', _306 => _306.iconColor])) {
|
|
5954
6497
|
setVar(targets, "--rs-icon", theme.iconColor);
|
|
5955
6498
|
}
|
|
5956
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6499
|
+
if (_optionalChain([theme, 'optionalAccess', _307 => _307.ctaColor])) {
|
|
5957
6500
|
const derived = deriveCustomPrimary(theme.ctaColor);
|
|
5958
6501
|
if (derived) {
|
|
5959
6502
|
setVar(targets, "--rs-primary", derived.base);
|
|
@@ -5978,25 +6521,25 @@ function applyTheme(element, theme) {
|
|
|
5978
6521
|
}
|
|
5979
6522
|
} else {
|
|
5980
6523
|
for (const v of CUSTOM_PRIMARY_VARS) clearVar(targets, v);
|
|
5981
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6524
|
+
if (_optionalChain([theme, 'optionalAccess', _308 => _308.ctaHoverColor])) {
|
|
5982
6525
|
setVar(targets, "--rs-primary-hover", theme.ctaHoverColor);
|
|
5983
6526
|
}
|
|
5984
6527
|
}
|
|
5985
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6528
|
+
if (_optionalChain([theme, 'optionalAccess', _309 => _309.borderColor])) {
|
|
5986
6529
|
setVar(targets, "--rs-border", theme.borderColor);
|
|
5987
6530
|
setVar(targets, "--rs-border-surface", theme.borderColor);
|
|
5988
6531
|
}
|
|
5989
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6532
|
+
if (_optionalChain([theme, 'optionalAccess', _310 => _310.backgroundColor])) {
|
|
5990
6533
|
setVar(targets, "--rs-background", theme.backgroundColor);
|
|
5991
6534
|
}
|
|
5992
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6535
|
+
if (_optionalChain([theme, 'optionalAccess', _311 => _311.radius])) {
|
|
5993
6536
|
const scale = RADIUS_SCALE[theme.radius];
|
|
5994
6537
|
setVar(targets, "--rs-radius-sm", scale.sm);
|
|
5995
6538
|
setVar(targets, "--rs-radius-md", scale.md);
|
|
5996
6539
|
setVar(targets, "--rs-radius-lg", scale.lg);
|
|
5997
6540
|
setVar(targets, "--rs-radius", scale.md);
|
|
5998
6541
|
}
|
|
5999
|
-
return followSystemAppearance(_optionalChain([theme, 'optionalAccess',
|
|
6542
|
+
return followSystemAppearance(_optionalChain([theme, 'optionalAccess', _312 => _312.mode]), paintMode);
|
|
6000
6543
|
}
|
|
6001
6544
|
|
|
6002
6545
|
// src/core/removed-props.ts
|
|
@@ -6029,6 +6572,9 @@ var REMOVED_UI_CONFIG_KEYS = {
|
|
|
6029
6572
|
checkLiquidity: "removed \u2014 the modal no longer surfaces a liquidity cap. Route capacity is enforced when the deposit is processed.",
|
|
6030
6573
|
showHistoryButton: "removed \u2014 deposit history is always offered, from the modal's home screen. There is no way to hide it."
|
|
6031
6574
|
};
|
|
6575
|
+
var REMOVED_BANK_ONRAMP_KEYS = {
|
|
6576
|
+
currency: "removed \u2014 the currency follows the residence the customer declares at verification: EUR inside SEPA, USD elsewhere."
|
|
6577
|
+
};
|
|
6032
6578
|
var warned = /* @__PURE__ */ new Set();
|
|
6033
6579
|
function warnOnce(component, key, replacement) {
|
|
6034
6580
|
const id = `${component}.${key}`;
|
|
@@ -6046,6 +6592,18 @@ function warnRemovedProps(component, props) {
|
|
|
6046
6592
|
warnOnce(component, key, table[key]);
|
|
6047
6593
|
}
|
|
6048
6594
|
}
|
|
6595
|
+
const bankOnramp = props.bankOnramp;
|
|
6596
|
+
if (bankOnramp && typeof bankOnramp === "object") {
|
|
6597
|
+
for (const key of Object.keys(REMOVED_BANK_ONRAMP_KEYS)) {
|
|
6598
|
+
if (Object.prototype.hasOwnProperty.call(bankOnramp, key)) {
|
|
6599
|
+
warnOnce(
|
|
6600
|
+
component,
|
|
6601
|
+
`bankOnramp.${key}`,
|
|
6602
|
+
REMOVED_BANK_ONRAMP_KEYS[key]
|
|
6603
|
+
);
|
|
6604
|
+
}
|
|
6605
|
+
}
|
|
6606
|
+
}
|
|
6049
6607
|
const uiConfig = props.uiConfig;
|
|
6050
6608
|
if (uiConfig && typeof uiConfig === "object") {
|
|
6051
6609
|
for (const key of Object.keys(REMOVED_UI_CONFIG_KEYS)) {
|
|
@@ -6085,20 +6643,20 @@ function sinkFor(source) {
|
|
|
6085
6643
|
if (source.modal === "deposit") {
|
|
6086
6644
|
const at2 = () => source.controllerRef.current;
|
|
6087
6645
|
return {
|
|
6088
|
-
opened: (detail) => _optionalChain([at2, 'call',
|
|
6089
|
-
rowViewed: (detail) => _optionalChain([at2, 'call',
|
|
6090
|
-
loadMore: (detail) => _optionalChain([at2, 'call',
|
|
6091
|
-
fallbackOpened: (detail) => _optionalChain([at2, 'call',
|
|
6092
|
-
recoveryStarted: (detail) => _optionalChain([at2, 'call',
|
|
6646
|
+
opened: (detail) => _optionalChain([at2, 'call', _313 => _313(), 'optionalAccess', _314 => _314.historyOpened, 'call', _315 => _315({ ...detail, step: _nullishCoalesce(_optionalChain([at2, 'call', _316 => _316(), 'optionalAccess', _317 => _317.step]), () => ( null)) })]),
|
|
6647
|
+
rowViewed: (detail) => _optionalChain([at2, 'call', _318 => _318(), 'optionalAccess', _319 => _319.historyRowViewed, 'call', _320 => _320(detail)]),
|
|
6648
|
+
loadMore: (detail) => _optionalChain([at2, 'call', _321 => _321(), 'optionalAccess', _322 => _322.historyLoadMore, 'call', _323 => _323(detail)]),
|
|
6649
|
+
fallbackOpened: (detail) => _optionalChain([at2, 'call', _324 => _324(), 'optionalAccess', _325 => _325.historyFallbackOpened, 'call', _326 => _326(detail)]),
|
|
6650
|
+
recoveryStarted: (detail) => _optionalChain([at2, 'call', _327 => _327(), 'optionalAccess', _328 => _328.historyRecoveryStarted, 'call', _329 => _329(detail)])
|
|
6093
6651
|
};
|
|
6094
6652
|
}
|
|
6095
6653
|
const at = () => source.controllerRef.current;
|
|
6096
6654
|
return {
|
|
6097
|
-
opened: (detail) => _optionalChain([at, 'call',
|
|
6098
|
-
rowViewed: (detail) => _optionalChain([at, 'call',
|
|
6099
|
-
loadMore: (detail) => _optionalChain([at, 'call',
|
|
6100
|
-
fallbackOpened: (detail) => _optionalChain([at, 'call',
|
|
6101
|
-
recoveryStarted: (detail) => _optionalChain([at, 'call',
|
|
6655
|
+
opened: (detail) => _optionalChain([at, 'call', _330 => _330(), 'optionalAccess', _331 => _331.historyOpened, 'call', _332 => _332({ ...detail, step: _nullishCoalesce(_optionalChain([at, 'call', _333 => _333(), 'optionalAccess', _334 => _334.step]), () => ( null)) })]),
|
|
6656
|
+
rowViewed: (detail) => _optionalChain([at, 'call', _335 => _335(), 'optionalAccess', _336 => _336.historyRowViewed, 'call', _337 => _337(detail)]),
|
|
6657
|
+
loadMore: (detail) => _optionalChain([at, 'call', _338 => _338(), 'optionalAccess', _339 => _339.historyLoadMore, 'call', _340 => _340(detail)]),
|
|
6658
|
+
fallbackOpened: (detail) => _optionalChain([at, 'call', _341 => _341(), 'optionalAccess', _342 => _342.historyFallbackOpened, 'call', _343 => _343(detail)]),
|
|
6659
|
+
recoveryStarted: (detail) => _optionalChain([at, 'call', _344 => _344(), 'optionalAccess', _345 => _345.historyRecoveryStarted, 'call', _346 => _346(detail)])
|
|
6102
6660
|
};
|
|
6103
6661
|
}
|
|
6104
6662
|
function badgeState(badge) {
|
|
@@ -6124,7 +6682,7 @@ function createHistoryAnalytics(source) {
|
|
|
6124
6682
|
sink.opened({
|
|
6125
6683
|
history_visit_id: visitId,
|
|
6126
6684
|
badge: badgeState(badge),
|
|
6127
|
-
badge_count: _nullishCoalesce(_optionalChain([badge, 'optionalAccess',
|
|
6685
|
+
badge_count: _nullishCoalesce(_optionalChain([badge, 'optionalAccess', _347 => _347.count]), () => ( 0))
|
|
6128
6686
|
});
|
|
6129
6687
|
},
|
|
6130
6688
|
visitEnded() {
|
|
@@ -6185,10 +6743,10 @@ function resolveChain(targetChain) {
|
|
|
6185
6743
|
if (typeof targetChain === "number" && !(targetChain > 0 && Number.isInteger(targetChain))) {
|
|
6186
6744
|
return void 0;
|
|
6187
6745
|
}
|
|
6188
|
-
return
|
|
6746
|
+
return _chunkFKJ6EJHHcjs.targetChainToCaip2.call(void 0, targetChain);
|
|
6189
6747
|
}
|
|
6190
6748
|
function resolveToken(targetToken) {
|
|
6191
|
-
const raw = _optionalChain([targetToken, 'optionalAccess',
|
|
6749
|
+
const raw = _optionalChain([targetToken, 'optionalAccess', _348 => _348.trim, 'call', _349 => _349()]);
|
|
6192
6750
|
if (!raw) return void 0;
|
|
6193
6751
|
if (HEX_TOKEN.test(raw)) return raw.toLowerCase();
|
|
6194
6752
|
if (BASE58_TOKEN.test(raw)) return raw;
|
|
@@ -6246,8 +6804,8 @@ function Tooltip({ content, children, className }) {
|
|
|
6246
6804
|
function handleOutside(event) {
|
|
6247
6805
|
const target = event.target;
|
|
6248
6806
|
if (!target) return;
|
|
6249
|
-
if (_optionalChain([triggerRef, 'access',
|
|
6250
|
-
if (_optionalChain([bubbleRef, 'access',
|
|
6807
|
+
if (_optionalChain([triggerRef, 'access', _350 => _350.current, 'optionalAccess', _351 => _351.contains, 'call', _352 => _352(target)])) return;
|
|
6808
|
+
if (_optionalChain([bubbleRef, 'access', _353 => _353.current, 'optionalAccess', _354 => _354.contains, 'call', _355 => _355(target)])) return;
|
|
6251
6809
|
setOpen(false);
|
|
6252
6810
|
}
|
|
6253
6811
|
function handleKey(event) {
|
|
@@ -6324,7 +6882,7 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
6324
6882
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-fees-accordion-summary", children: [
|
|
6325
6883
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-fees-accordion-label", children: [
|
|
6326
6884
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fees" }),
|
|
6327
|
-
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, InfoIcon, {}) }) })
|
|
6885
|
+
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, _chunkG264OM23cjs.InfoIcon, {}) }) })
|
|
6328
6886
|
] }),
|
|
6329
6887
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6330
6888
|
"button",
|
|
@@ -6342,7 +6900,7 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
6342
6900
|
{
|
|
6343
6901
|
className: `rs-fees-accordion-chevron${open ? " rs-fees-accordion-chevron--open" : ""}`,
|
|
6344
6902
|
"aria-hidden": "true",
|
|
6345
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronDownIcon, {})
|
|
6903
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronDownIcon, {})
|
|
6346
6904
|
}
|
|
6347
6905
|
)
|
|
6348
6906
|
]
|
|
@@ -6364,7 +6922,7 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
6364
6922
|
{
|
|
6365
6923
|
className: "rs-review-detail-info",
|
|
6366
6924
|
"aria-label": `${row.label} info`,
|
|
6367
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfoIcon, {})
|
|
6925
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.InfoIcon, {})
|
|
6368
6926
|
}
|
|
6369
6927
|
) })
|
|
6370
6928
|
] })
|
|
@@ -6381,6 +6939,7 @@ function SwappedReceipt({
|
|
|
6381
6939
|
amountPaid,
|
|
6382
6940
|
depositedAmount,
|
|
6383
6941
|
depositedSymbol,
|
|
6942
|
+
depositedToken,
|
|
6384
6943
|
feesTotal,
|
|
6385
6944
|
feeRows,
|
|
6386
6945
|
feesTooltip,
|
|
@@ -6390,7 +6949,7 @@ function SwappedReceipt({
|
|
|
6390
6949
|
}) {
|
|
6391
6950
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
6392
6951
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
6393
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CheckIcon, {}), title: "Deposit successful" }),
|
|
6952
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CheckIcon, {}), title: "Deposit successful" }),
|
|
6394
6953
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
6395
6954
|
onrampMethod && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
6396
6955
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Onramp method" }),
|
|
@@ -6407,7 +6966,7 @@ function SwappedReceipt({
|
|
|
6407
6966
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Deposited amount" }),
|
|
6408
6967
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
6409
6968
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: depositedAmount }),
|
|
6410
|
-
depositedSymbol && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenIcon, { symbol: depositedSymbol }) })
|
|
6969
|
+
depositedSymbol && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenIcon, { token: depositedToken, symbol: depositedSymbol }) })
|
|
6411
6970
|
] })
|
|
6412
6971
|
] }),
|
|
6413
6972
|
feesTotal != null && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -6443,7 +7002,7 @@ var EXCHANGE_SLUGS = [
|
|
|
6443
7002
|
"kucoin"
|
|
6444
7003
|
];
|
|
6445
7004
|
var EXCHANGE_LOGO_SOURCES = Object.fromEntries(
|
|
6446
|
-
EXCHANGE_SLUGS.map((slug) => [slug,
|
|
7005
|
+
EXCHANGE_SLUGS.map((slug) => [slug, _chunkFKJ6EJHHcjs.cdnIconUrl.call(void 0, "exchanges", slug)])
|
|
6447
7006
|
);
|
|
6448
7007
|
var EXCHANGE_LOGO_ALIASES = {
|
|
6449
7008
|
gate: "gateio"
|
|
@@ -6476,7 +7035,7 @@ function asNumber(value) {
|
|
|
6476
7035
|
const trimmed = value.trim();
|
|
6477
7036
|
if (!trimmed) return void 0;
|
|
6478
7037
|
const caipMatch = trimmed.match(/^eip155:(\d+)$/);
|
|
6479
|
-
if (_optionalChain([caipMatch, 'optionalAccess',
|
|
7038
|
+
if (_optionalChain([caipMatch, 'optionalAccess', _356 => _356[1]])) {
|
|
6480
7039
|
const parsed2 = Number(caipMatch[1]);
|
|
6481
7040
|
return Number.isFinite(parsed2) ? parsed2 : void 0;
|
|
6482
7041
|
}
|
|
@@ -6495,24 +7054,24 @@ function asAddress(value) {
|
|
|
6495
7054
|
return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
|
|
6496
7055
|
}
|
|
6497
7056
|
function getEventTxHash(event) {
|
|
6498
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
7057
|
+
if (!_optionalChain([event, 'optionalAccess', _357 => _357.type])) return void 0;
|
|
6499
7058
|
if (event.type === "deposit-received") {
|
|
6500
|
-
return asString(_optionalChain([event, 'access',
|
|
7059
|
+
return asString(_optionalChain([event, 'access', _358 => _358.data, 'optionalAccess', _359 => _359.transactionHash]));
|
|
6501
7060
|
}
|
|
6502
7061
|
if (event.type === "bridge-started" || event.type === "bridge-complete") {
|
|
6503
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
6504
|
-
const source = isRecord(_optionalChain([event, 'access',
|
|
6505
|
-
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess',
|
|
7062
|
+
const deposit = isRecord(_optionalChain([event, 'access', _360 => _360.data, 'optionalAccess', _361 => _361.deposit])) ? event.data.deposit : void 0;
|
|
7063
|
+
const source = isRecord(_optionalChain([event, 'access', _362 => _362.data, 'optionalAccess', _363 => _363.source])) ? event.data.source : void 0;
|
|
7064
|
+
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _364 => _364.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _365 => _365.transactionHash]))));
|
|
6506
7065
|
}
|
|
6507
7066
|
if (event.type === "bridge-failed" || event.type === "error") {
|
|
6508
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
6509
|
-
const source = isRecord(_optionalChain([event, 'access',
|
|
6510
|
-
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess',
|
|
7067
|
+
const deposit = isRecord(_optionalChain([event, 'access', _366 => _366.data, 'optionalAccess', _367 => _367.deposit])) ? event.data.deposit : void 0;
|
|
7068
|
+
const source = isRecord(_optionalChain([event, 'access', _368 => _368.data, 'optionalAccess', _369 => _369.source])) ? event.data.source : void 0;
|
|
7069
|
+
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _370 => _370.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _371 => _371.transactionHash]))));
|
|
6511
7070
|
}
|
|
6512
7071
|
return void 0;
|
|
6513
7072
|
}
|
|
6514
7073
|
function getEventSourceDetails(event) {
|
|
6515
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
7074
|
+
if (!_optionalChain([event, 'optionalAccess', _372 => _372.type]) || !isRecord(event.data)) return {};
|
|
6516
7075
|
if (event.type === "deposit-received") {
|
|
6517
7076
|
return {
|
|
6518
7077
|
chainId: asNumber(event.data.chain),
|
|
@@ -6524,9 +7083,9 @@ function getEventSourceDetails(event) {
|
|
|
6524
7083
|
const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
|
|
6525
7084
|
if (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error") {
|
|
6526
7085
|
return {
|
|
6527
|
-
chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess',
|
|
6528
|
-
amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess',
|
|
6529
|
-
token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess',
|
|
7086
|
+
chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess', _373 => _373.chain])), () => ( asNumber(_optionalChain([deposit, 'optionalAccess', _374 => _374.chain])))),
|
|
7087
|
+
amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess', _375 => _375.amount])), () => ( asAmount(_optionalChain([deposit, 'optionalAccess', _376 => _376.amount])))),
|
|
7088
|
+
token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess', _377 => _377.asset])), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _378 => _378.asset])))), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _379 => _379.token]))))
|
|
6530
7089
|
};
|
|
6531
7090
|
}
|
|
6532
7091
|
return {};
|
|
@@ -6540,7 +7099,7 @@ function asChain(value) {
|
|
|
6540
7099
|
return asNumber(value);
|
|
6541
7100
|
}
|
|
6542
7101
|
function getEventDestinationDetails(event) {
|
|
6543
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
7102
|
+
if (!_optionalChain([event, 'optionalAccess', _380 => _380.type]) || !isRecord(event.data)) return {};
|
|
6544
7103
|
if (event.type !== "bridge-started" && event.type !== "bridge-complete") {
|
|
6545
7104
|
return {};
|
|
6546
7105
|
}
|
|
@@ -6550,14 +7109,14 @@ function getEventDestinationDetails(event) {
|
|
|
6550
7109
|
return {
|
|
6551
7110
|
chainId: asChain(destination.chain),
|
|
6552
7111
|
amount: asAmount(destination.amount),
|
|
6553
|
-
token: _optionalChain([token, 'optionalAccess',
|
|
7112
|
+
token: _optionalChain([token, 'optionalAccess', _381 => _381.trim, 'call', _382 => _382()]) || void 0
|
|
6554
7113
|
};
|
|
6555
7114
|
}
|
|
6556
7115
|
function isDepositEvent(event) {
|
|
6557
|
-
return _optionalChain([event, 'optionalAccess',
|
|
7116
|
+
return _optionalChain([event, 'optionalAccess', _383 => _383.type]) === "deposit-received" || _optionalChain([event, 'optionalAccess', _384 => _384.type]) === "bridge-started" || _optionalChain([event, 'optionalAccess', _385 => _385.type]) === "bridge-complete" || _optionalChain([event, 'optionalAccess', _386 => _386.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _387 => _387.type]) === "error";
|
|
6558
7117
|
}
|
|
6559
7118
|
function isFailedEvent(event) {
|
|
6560
|
-
return _optionalChain([event, 'optionalAccess',
|
|
7119
|
+
return _optionalChain([event, 'optionalAccess', _388 => _388.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _389 => _389.type]) === "error";
|
|
6561
7120
|
}
|
|
6562
7121
|
function isHexString(value) {
|
|
6563
7122
|
return value.startsWith("0x") || value.startsWith("0X");
|
|
@@ -6569,7 +7128,7 @@ function txRefsMatch(a, b) {
|
|
|
6569
7128
|
return a === b;
|
|
6570
7129
|
}
|
|
6571
7130
|
function formatBridgeFailedMessage(event) {
|
|
6572
|
-
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
7131
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _390 => _390.data]), () => ( {}));
|
|
6573
7132
|
const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
|
|
6574
7133
|
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
6575
7134
|
function toUserFacingFailure(raw) {
|
|
@@ -6597,7 +7156,7 @@ function formatBridgeFailedMessage(event) {
|
|
|
6597
7156
|
return { message: "Bridge failed" };
|
|
6598
7157
|
}
|
|
6599
7158
|
function failureMessageForEvent(event) {
|
|
6600
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7159
|
+
if (_optionalChain([event, 'optionalAccess', _391 => _391.type]) === "error") {
|
|
6601
7160
|
const message = isRecord(event.data) ? asString(event.data.message) : void 0;
|
|
6602
7161
|
return _nullishCoalesce(message, () => ( "Unknown error"));
|
|
6603
7162
|
}
|
|
@@ -6606,66 +7165,28 @@ function failureMessageForEvent(event) {
|
|
|
6606
7165
|
|
|
6607
7166
|
// src/core/useTokenPrices.ts
|
|
6608
7167
|
|
|
6609
|
-
var
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
const
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
const caip2 = caip2For(token);
|
|
6632
|
-
if (!caip2) return null;
|
|
6633
|
-
const prices = await service.fetchPricesByAddress([caip2]);
|
|
6634
|
-
const price = prices[caip2];
|
|
6635
|
-
return typeof price === "number" && price > 0 ? price : null;
|
|
6636
|
-
}
|
|
6637
|
-
function useTokenPrices(service, tokens) {
|
|
6638
|
-
const [prices, setPrices] = _react.useState.call(void 0, {});
|
|
6639
|
-
const defined = tokens.filter((t) => Boolean(_optionalChain([t, 'optionalAccess', _288 => _288.symbol])));
|
|
6640
|
-
const entries = [
|
|
6641
|
-
...new Map(
|
|
6642
|
-
defined.flatMap((token) => {
|
|
6643
|
-
const caip2 = caip2For(token);
|
|
6644
|
-
return caip2 ? [{ symbol: token.symbol.toUpperCase(), caip2 }] : [];
|
|
6645
|
-
}).map((entry) => [entry.caip2, entry])
|
|
6646
|
-
).values()
|
|
6647
|
-
].sort((a, b) => a.caip2.localeCompare(b.caip2));
|
|
6648
|
-
const key = JSON.stringify(entries);
|
|
6649
|
-
_react.useEffect.call(void 0, () => {
|
|
6650
|
-
if (key === "[]") return;
|
|
6651
|
-
let cancelled = false;
|
|
6652
|
-
const parsed = JSON.parse(key);
|
|
6653
|
-
const caip2Ids = [...new Set(parsed.map((e) => e.caip2))];
|
|
6654
|
-
service.fetchPricesByAddress(caip2Ids).then((byAddress) => {
|
|
6655
|
-
if (cancelled) return;
|
|
6656
|
-
const merged = {};
|
|
6657
|
-
for (const entry of parsed) {
|
|
6658
|
-
const price = byAddress[entry.caip2];
|
|
6659
|
-
if (typeof price === "number") merged[entry.symbol] = price;
|
|
6660
|
-
}
|
|
6661
|
-
setPrices(merged);
|
|
6662
|
-
}).catch(() => {
|
|
6663
|
-
});
|
|
6664
|
-
return () => {
|
|
6665
|
-
cancelled = true;
|
|
6666
|
-
};
|
|
6667
|
-
}, [service, key]);
|
|
6668
|
-
return prices;
|
|
7168
|
+
var ZERO_ADDRESS2 = "0x0000000000000000000000000000000000000000";
|
|
7169
|
+
function addressFor(token) {
|
|
7170
|
+
if (token.address) return token.address;
|
|
7171
|
+
return token.chainId === "solana" ? "native" : ZERO_ADDRESS2;
|
|
7172
|
+
}
|
|
7173
|
+
function useTokenPrices(tokens) {
|
|
7174
|
+
const defined = tokens.filter((t) => Boolean(_optionalChain([t, 'optionalAccess', _392 => _392.symbol])));
|
|
7175
|
+
const refs = defined.map((token) => ({
|
|
7176
|
+
chain: token.chainId,
|
|
7177
|
+
address: addressFor(token)
|
|
7178
|
+
}));
|
|
7179
|
+
const byId = useAssetPrices(refs);
|
|
7180
|
+
const key = defined.map((t) => `${String(t.chainId)}:${addressFor(t)}:${t.symbol}`).join("|");
|
|
7181
|
+
return _react.useMemo.call(void 0, () => {
|
|
7182
|
+
const out = {};
|
|
7183
|
+
for (const token of defined) {
|
|
7184
|
+
const id = assetIdFor(token.chainId, addressFor(token));
|
|
7185
|
+
const usd = id ? byId[id] : void 0;
|
|
7186
|
+
if (typeof usd === "number") out[token.symbol.toUpperCase()] = usd;
|
|
7187
|
+
}
|
|
7188
|
+
return out;
|
|
7189
|
+
}, [key, byId]);
|
|
6669
7190
|
}
|
|
6670
7191
|
|
|
6671
7192
|
// src/components/steps/ProcessingStep.tsx
|
|
@@ -6799,7 +7320,7 @@ function loadPhaseTimings(txHash) {
|
|
|
6799
7320
|
const parsed = JSON.parse(raw);
|
|
6800
7321
|
if (typeof parsed.startedAt !== "number") return null;
|
|
6801
7322
|
return parsed;
|
|
6802
|
-
} catch (
|
|
7323
|
+
} catch (e19) {
|
|
6803
7324
|
return null;
|
|
6804
7325
|
}
|
|
6805
7326
|
}
|
|
@@ -6810,7 +7331,7 @@ function savePhaseTimings(txHash, timings) {
|
|
|
6810
7331
|
`${PHASE_TIMINGS_PREFIX}:${txHash}`,
|
|
6811
7332
|
JSON.stringify(timings)
|
|
6812
7333
|
);
|
|
6813
|
-
} catch (
|
|
7334
|
+
} catch (e20) {
|
|
6814
7335
|
}
|
|
6815
7336
|
}
|
|
6816
7337
|
function isEventForTx(event, txHash) {
|
|
@@ -6819,12 +7340,12 @@ function isEventForTx(event, txHash) {
|
|
|
6819
7340
|
return txRefsMatch(eventTxHash, txHash);
|
|
6820
7341
|
}
|
|
6821
7342
|
function parseWebhookTimestamp(event) {
|
|
6822
|
-
if (typeof _optionalChain([event, 'optionalAccess',
|
|
7343
|
+
if (typeof _optionalChain([event, 'optionalAccess', _393 => _393.time]) !== "string") return void 0;
|
|
6823
7344
|
const timestamp = Date.parse(event.time);
|
|
6824
7345
|
return Number.isFinite(timestamp) ? timestamp : void 0;
|
|
6825
7346
|
}
|
|
6826
7347
|
function syncPhaseTimings(previous, event) {
|
|
6827
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
7348
|
+
if (!_optionalChain([event, 'optionalAccess', _394 => _394.type])) return previous;
|
|
6828
7349
|
const timestamp = _nullishCoalesce(parseWebhookTimestamp(event), () => ( Date.now()));
|
|
6829
7350
|
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;
|
|
6830
7351
|
const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete") && previous.bridgingAt === void 0;
|
|
@@ -6886,46 +7407,52 @@ function getCurrentPhaseId(state, phaseTimings) {
|
|
|
6886
7407
|
if (state.type === "complete") {
|
|
6887
7408
|
return void 0;
|
|
6888
7409
|
}
|
|
6889
|
-
if (_optionalChain([state, 'access',
|
|
7410
|
+
if (_optionalChain([state, 'access', _395 => _395.lastEvent, 'optionalAccess', _396 => _396.type]) === "bridge-started" || _optionalChain([state, 'access', _397 => _397.lastEvent, 'optionalAccess', _398 => _398.type]) === "bridge-complete")
|
|
6890
7411
|
return "bridging";
|
|
6891
|
-
if (_optionalChain([state, 'access',
|
|
7412
|
+
if (_optionalChain([state, 'access', _399 => _399.lastEvent, 'optionalAccess', _400 => _400.type]) === "deposit-received") return "received";
|
|
6892
7413
|
return "confirming";
|
|
6893
7414
|
}
|
|
7415
|
+
function getCompletionDestinationAmount(event) {
|
|
7416
|
+
const amount = _optionalChain([event, 'optionalAccess', _401 => _401.data, 'optionalAccess', _402 => _402.destination, 'optionalAccess', _403 => _403.amount]);
|
|
7417
|
+
return typeof amount === "string" ? amount : void 0;
|
|
7418
|
+
}
|
|
6894
7419
|
function getCompletionDestinationTxHash(event) {
|
|
6895
|
-
const eventData = _optionalChain([event, 'optionalAccess',
|
|
6896
|
-
const swapTxHash = _optionalChain([eventData, 'optionalAccess',
|
|
6897
|
-
const destinationTxHash = _optionalChain([eventData, 'optionalAccess',
|
|
7420
|
+
const eventData = _optionalChain([event, 'optionalAccess', _404 => _404.data]);
|
|
7421
|
+
const swapTxHash = _optionalChain([eventData, 'optionalAccess', _405 => _405.swap, 'optionalAccess', _406 => _406.transactionHash]);
|
|
7422
|
+
const destinationTxHash = _optionalChain([eventData, 'optionalAccess', _407 => _407.destination, 'optionalAccess', _408 => _408.transactionHash]);
|
|
6898
7423
|
return _nullishCoalesce(swapTxHash, () => ( destinationTxHash));
|
|
6899
7424
|
}
|
|
6900
7425
|
function getTerminalProcessingOutcome(event) {
|
|
6901
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7426
|
+
if (_optionalChain([event, 'optionalAccess', _409 => _409.type]) === "post-bridge-swap-complete") {
|
|
6902
7427
|
return {
|
|
6903
7428
|
type: "complete",
|
|
6904
|
-
destinationTxHash: getCompletionDestinationTxHash(event)
|
|
7429
|
+
destinationTxHash: getCompletionDestinationTxHash(event),
|
|
7430
|
+
destinationAmount: getCompletionDestinationAmount(event)
|
|
6905
7431
|
};
|
|
6906
7432
|
}
|
|
6907
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7433
|
+
if (_optionalChain([event, 'optionalAccess', _410 => _410.type]) === "post-bridge-swap-failed") {
|
|
6908
7434
|
return {
|
|
6909
7435
|
type: "failed",
|
|
6910
7436
|
message: formatBridgeFailedMessage(event).message
|
|
6911
7437
|
};
|
|
6912
7438
|
}
|
|
6913
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7439
|
+
if (_optionalChain([event, 'optionalAccess', _411 => _411.type]) === "bridge-complete") {
|
|
6914
7440
|
return {
|
|
6915
7441
|
type: "complete",
|
|
6916
|
-
destinationTxHash: getCompletionDestinationTxHash(event)
|
|
7442
|
+
destinationTxHash: getCompletionDestinationTxHash(event),
|
|
7443
|
+
destinationAmount: getCompletionDestinationAmount(event)
|
|
6917
7444
|
};
|
|
6918
7445
|
}
|
|
6919
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7446
|
+
if (_optionalChain([event, 'optionalAccess', _412 => _412.type]) === "bridge-failed") {
|
|
6920
7447
|
return {
|
|
6921
7448
|
type: "failed",
|
|
6922
7449
|
message: formatBridgeFailedMessage(event).message
|
|
6923
7450
|
};
|
|
6924
7451
|
}
|
|
6925
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7452
|
+
if (_optionalChain([event, 'optionalAccess', _413 => _413.type]) === "error") {
|
|
6926
7453
|
return {
|
|
6927
7454
|
type: "failed",
|
|
6928
|
-
message: _nullishCoalesce(_optionalChain([event, 'access',
|
|
7455
|
+
message: _nullishCoalesce(_optionalChain([event, 'access', _414 => _414.data, 'optionalAccess', _415 => _415.message]), () => ( "Unknown error"))
|
|
6929
7456
|
};
|
|
6930
7457
|
}
|
|
6931
7458
|
return null;
|
|
@@ -6933,10 +7460,10 @@ function getTerminalProcessingOutcome(event) {
|
|
|
6933
7460
|
function getInitialProcessingState(event, txHash) {
|
|
6934
7461
|
if (!event || !isEventForTx(event, txHash)) return null;
|
|
6935
7462
|
const terminal = getTerminalProcessingOutcome(event);
|
|
6936
|
-
if (_optionalChain([terminal, 'optionalAccess',
|
|
7463
|
+
if (_optionalChain([terminal, 'optionalAccess', _416 => _416.type]) === "complete") {
|
|
6937
7464
|
return { type: "complete", lastEvent: event };
|
|
6938
7465
|
}
|
|
6939
|
-
if (_optionalChain([terminal, 'optionalAccess',
|
|
7466
|
+
if (_optionalChain([terminal, 'optionalAccess', _417 => _417.type]) === "failed") {
|
|
6940
7467
|
return { type: "failed", message: terminal.message, lastEvent: event };
|
|
6941
7468
|
}
|
|
6942
7469
|
if (isDepositEvent(event)) {
|
|
@@ -6945,7 +7472,7 @@ function getInitialProcessingState(event, txHash) {
|
|
|
6945
7472
|
return null;
|
|
6946
7473
|
}
|
|
6947
7474
|
function getSettledSourceTxHash(event, fallbackTxHash) {
|
|
6948
|
-
return _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
7475
|
+
return _nullishCoalesce(_optionalChain([event, 'optionalAccess', _418 => _418.data, 'optionalAccess', _419 => _419.source, 'optionalAccess', _420 => _420.transactionHash]), () => ( fallbackTxHash));
|
|
6949
7476
|
}
|
|
6950
7477
|
function ProcessingStep({
|
|
6951
7478
|
smartAccount,
|
|
@@ -6985,7 +7512,7 @@ function ProcessingStep({
|
|
|
6985
7512
|
const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
|
|
6986
7513
|
const pollTimeoutRef = _react.useRef.call(void 0, null);
|
|
6987
7514
|
const escalatedDelayRef = _react.useRef.call(void 0, false);
|
|
6988
|
-
const processingContextRef = useLatestRef({
|
|
7515
|
+
const processingContextRef = _chunkG264OM23cjs.useLatestRef.call(void 0, {
|
|
6989
7516
|
amount,
|
|
6990
7517
|
sourceChain,
|
|
6991
7518
|
sourceToken,
|
|
@@ -6994,9 +7521,9 @@ function ProcessingStep({
|
|
|
6994
7521
|
targetChain,
|
|
6995
7522
|
targetToken
|
|
6996
7523
|
});
|
|
6997
|
-
const onDepositCompleteRef = useLatestRef(onDepositComplete);
|
|
6998
|
-
const onDepositFailedRef = useLatestRef(onDepositFailed);
|
|
6999
|
-
const onErrorRef = useLatestRef(onError);
|
|
7524
|
+
const onDepositCompleteRef = _chunkG264OM23cjs.useLatestRef.call(void 0, onDepositComplete);
|
|
7525
|
+
const onDepositFailedRef = _chunkG264OM23cjs.useLatestRef.call(void 0, onDepositFailed);
|
|
7526
|
+
const onErrorRef = _chunkG264OM23cjs.useLatestRef.call(void 0, onError);
|
|
7000
7527
|
const explorerTxUrl = useExplorerTxUrl();
|
|
7001
7528
|
const initialTerminalEventRef = _react.useRef.call(void 0, null);
|
|
7002
7529
|
const completedDirectTransferTxHashRef = _react.useRef.call(void 0, null);
|
|
@@ -7025,8 +7552,8 @@ function ProcessingStep({
|
|
|
7025
7552
|
const [elapsedSeconds, setElapsedSeconds] = _react.useState.call(void 0,
|
|
7026
7553
|
() => Math.max(0, Math.floor((Date.now() - startTimeRef.current) / 1e3))
|
|
7027
7554
|
);
|
|
7028
|
-
const [latchedTiming, setLatchedTiming] = _react.useState.call(void 0, _optionalChain([quote, 'optionalAccess',
|
|
7029
|
-
if (latchedTiming === void 0 && _optionalChain([quote, 'optionalAccess',
|
|
7555
|
+
const [latchedTiming, setLatchedTiming] = _react.useState.call(void 0, _optionalChain([quote, 'optionalAccess', _421 => _421.timing]));
|
|
7556
|
+
if (latchedTiming === void 0 && _optionalChain([quote, 'optionalAccess', _422 => _422.timing]) !== void 0) {
|
|
7030
7557
|
setLatchedTiming(quote.timing);
|
|
7031
7558
|
}
|
|
7032
7559
|
const timingStateRef = _react.useRef.call(void 0, "expected");
|
|
@@ -7057,7 +7584,7 @@ function ProcessingStep({
|
|
|
7057
7584
|
flowLabel
|
|
7058
7585
|
});
|
|
7059
7586
|
const context = processingContextRef.current;
|
|
7060
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
7587
|
+
_optionalChain([onDepositCompleteRef, 'access', _423 => _423.current, 'optionalCall', _424 => _424(txHash, void 0, {
|
|
7061
7588
|
amount: context.amount,
|
|
7062
7589
|
sourceChain: context.sourceChain,
|
|
7063
7590
|
sourceToken: context.sourceToken,
|
|
@@ -7090,7 +7617,7 @@ function ProcessingStep({
|
|
|
7090
7617
|
destinationTxHash: outcome.destinationTxHash,
|
|
7091
7618
|
event: event.type
|
|
7092
7619
|
});
|
|
7093
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
7620
|
+
_optionalChain([onDepositCompleteRef, 'access', _425 => _425.current, 'optionalCall', _426 => _426(
|
|
7094
7621
|
sourceTxHash2,
|
|
7095
7622
|
outcome.destinationTxHash,
|
|
7096
7623
|
{
|
|
@@ -7100,7 +7627,8 @@ function ProcessingStep({
|
|
|
7100
7627
|
sourceDecimals: context.sourceDecimals,
|
|
7101
7628
|
amountUsd: context.amountUsd,
|
|
7102
7629
|
targetChain: context.targetChain,
|
|
7103
|
-
targetToken: context.targetToken
|
|
7630
|
+
targetToken: context.targetToken,
|
|
7631
|
+
destinationAmount: outcome.destinationAmount
|
|
7104
7632
|
}
|
|
7105
7633
|
)]);
|
|
7106
7634
|
return;
|
|
@@ -7110,7 +7638,7 @@ function ProcessingStep({
|
|
|
7110
7638
|
message: outcome.message,
|
|
7111
7639
|
event: event.type
|
|
7112
7640
|
});
|
|
7113
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
7641
|
+
_optionalChain([onDepositFailedRef, 'access', _427 => _427.current, 'optionalCall', _428 => _428(txHash, outcome.message)]);
|
|
7114
7642
|
}, [
|
|
7115
7643
|
debug,
|
|
7116
7644
|
onDepositCompleteRef,
|
|
@@ -7121,8 +7649,8 @@ function ProcessingStep({
|
|
|
7121
7649
|
const onSettledChangeRef = _react.useRef.call(void 0, onSettledChange);
|
|
7122
7650
|
onSettledChangeRef.current = onSettledChange;
|
|
7123
7651
|
_react.useEffect.call(void 0, () => {
|
|
7124
|
-
_optionalChain([onSettledChangeRef, 'access',
|
|
7125
|
-
return () => _optionalChain([onSettledChangeRef, 'access',
|
|
7652
|
+
_optionalChain([onSettledChangeRef, 'access', _429 => _429.current, 'optionalCall', _430 => _430(state.type !== "processing")]);
|
|
7653
|
+
return () => _optionalChain([onSettledChangeRef, 'access', _431 => _431.current, 'optionalCall', _432 => _432(false)]);
|
|
7126
7654
|
}, [state.type]);
|
|
7127
7655
|
_react.useEffect.call(void 0, () => {
|
|
7128
7656
|
if (directTransfer || state.type !== "processing") return;
|
|
@@ -7148,26 +7676,21 @@ function ProcessingStep({
|
|
|
7148
7676
|
updatePhaseTimings(
|
|
7149
7677
|
(previous) => syncPhaseTimings(previous, state.lastEvent)
|
|
7150
7678
|
);
|
|
7151
|
-
}, [_optionalChain([state, 'access',
|
|
7679
|
+
}, [_optionalChain([state, 'access', _433 => _433.lastEvent, 'optionalAccess', _434 => _434.time]), _optionalChain([state, 'access', _435 => _435.lastEvent, 'optionalAccess', _436 => _436.type]), updatePhaseTimings]);
|
|
7152
7680
|
const [swappedFiatContext, setSwappedFiatContext] = _react.useState.call(void 0, null);
|
|
7153
7681
|
_react.useEffect.call(void 0, () => {
|
|
7154
7682
|
let cancelled = false;
|
|
7155
7683
|
let timeoutId;
|
|
7156
|
-
const isFiatSwappedOrder = isSwappedOrder && _optionalChain([swappedContext, 'optionalAccess',
|
|
7157
|
-
const expectedOrderUuid = _nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess',
|
|
7684
|
+
const isFiatSwappedOrder = isSwappedOrder && _optionalChain([swappedContext, 'optionalAccess', _437 => _437.variant]) === "fiat";
|
|
7685
|
+
const expectedOrderUuid = _nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess', _438 => _438.expectedOrderUuid]), () => ( null));
|
|
7158
7686
|
setSwappedFiatContext(null);
|
|
7159
|
-
if (
|
|
7687
|
+
if (!isSwappedOrder || !expectedOrderUuid) {
|
|
7160
7688
|
return () => {
|
|
7161
7689
|
cancelled = true;
|
|
7162
7690
|
};
|
|
7163
7691
|
}
|
|
7692
|
+
const orderId = expectedOrderUuid;
|
|
7164
7693
|
let attempts = 0;
|
|
7165
|
-
const matchesCurrentDeposit = (res) => {
|
|
7166
|
-
if (isFiatSwappedOrder) {
|
|
7167
|
-
return res.orderId === expectedOrderUuid;
|
|
7168
|
-
}
|
|
7169
|
-
return res.transactionId != null && res.transactionId.toLowerCase() === txHash.toLowerCase();
|
|
7170
|
-
};
|
|
7171
7694
|
const scheduleRetry = () => {
|
|
7172
7695
|
if (cancelled || !isFiatSwappedOrder || attempts >= SWAPPED_FIAT_STATUS_MAX_ATTEMPTS) {
|
|
7173
7696
|
return;
|
|
@@ -7180,9 +7703,9 @@ function ProcessingStep({
|
|
|
7180
7703
|
async function fetchContext() {
|
|
7181
7704
|
attempts += 1;
|
|
7182
7705
|
try {
|
|
7183
|
-
const res = await service.
|
|
7706
|
+
const res = await service.fetchSwappedOrder(orderId);
|
|
7184
7707
|
if (cancelled) return;
|
|
7185
|
-
if (!res ||
|
|
7708
|
+
if (!res || res.orderId !== orderId) {
|
|
7186
7709
|
scheduleRetry();
|
|
7187
7710
|
return;
|
|
7188
7711
|
}
|
|
@@ -7190,7 +7713,7 @@ function ProcessingStep({
|
|
|
7190
7713
|
if (isFiatSwappedOrder && !hasFiatReceiptPricing(res)) {
|
|
7191
7714
|
scheduleRetry();
|
|
7192
7715
|
}
|
|
7193
|
-
} catch (
|
|
7716
|
+
} catch (e21) {
|
|
7194
7717
|
scheduleRetry();
|
|
7195
7718
|
}
|
|
7196
7719
|
}
|
|
@@ -7201,11 +7724,9 @@ function ProcessingStep({
|
|
|
7201
7724
|
};
|
|
7202
7725
|
}, [
|
|
7203
7726
|
service,
|
|
7204
|
-
smartAccount,
|
|
7205
|
-
txHash,
|
|
7206
7727
|
isSwappedOrder,
|
|
7207
|
-
_optionalChain([swappedContext, 'optionalAccess',
|
|
7208
|
-
_optionalChain([swappedContext, 'optionalAccess',
|
|
7728
|
+
_optionalChain([swappedContext, 'optionalAccess', _439 => _439.variant]),
|
|
7729
|
+
_optionalChain([swappedContext, 'optionalAccess', _440 => _440.expectedOrderUuid])
|
|
7209
7730
|
]);
|
|
7210
7731
|
_react.useEffect.call(void 0, () => {
|
|
7211
7732
|
if (directTransfer) return;
|
|
@@ -7231,17 +7752,18 @@ function ProcessingStep({
|
|
|
7231
7752
|
debugLog(debug, "processing", "poll:event", {
|
|
7232
7753
|
type: lastEvent2.type,
|
|
7233
7754
|
matchesTx: eventMatchesTx,
|
|
7234
|
-
intentId: _optionalChain([eventData, 'optionalAccess',
|
|
7755
|
+
intentId: _optionalChain([eventData, 'optionalAccess', _441 => _441.intentId])
|
|
7235
7756
|
});
|
|
7236
7757
|
}
|
|
7237
7758
|
if (!isMounted) return;
|
|
7238
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
7759
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _442 => _442.type]) === "bridge-complete") {
|
|
7239
7760
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
7240
7761
|
const sourceTxHash2 = getSettledSourceTxHash(
|
|
7241
7762
|
eventForCurrentTx,
|
|
7242
7763
|
txHash
|
|
7243
7764
|
);
|
|
7244
|
-
const
|
|
7765
|
+
const destination = _optionalChain([eventForCurrentTx, 'access', _443 => _443.data, 'optionalAccess', _444 => _444.destination]);
|
|
7766
|
+
const destinationTxHash2 = _optionalChain([destination, 'optionalAccess', _445 => _445.transactionHash]);
|
|
7245
7767
|
debugLog(debug, "processing", "state:complete", {
|
|
7246
7768
|
txHash,
|
|
7247
7769
|
sourceTxHash: sourceTxHash2,
|
|
@@ -7249,18 +7771,19 @@ function ProcessingStep({
|
|
|
7249
7771
|
event: eventForCurrentTx.type
|
|
7250
7772
|
});
|
|
7251
7773
|
const context = processingContextRef.current;
|
|
7252
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
7774
|
+
_optionalChain([onDepositCompleteRef, 'access', _446 => _446.current, 'optionalCall', _447 => _447(sourceTxHash2, destinationTxHash2, {
|
|
7253
7775
|
amount: context.amount,
|
|
7254
7776
|
sourceChain: context.sourceChain,
|
|
7255
7777
|
sourceToken: context.sourceToken,
|
|
7256
7778
|
sourceDecimals: context.sourceDecimals,
|
|
7257
7779
|
amountUsd: context.amountUsd,
|
|
7258
7780
|
targetChain: context.targetChain,
|
|
7259
|
-
targetToken: context.targetToken
|
|
7781
|
+
targetToken: context.targetToken,
|
|
7782
|
+
destinationAmount: typeof _optionalChain([destination, 'optionalAccess', _448 => _448.amount]) === "string" ? destination.amount : void 0
|
|
7260
7783
|
})]);
|
|
7261
7784
|
return;
|
|
7262
7785
|
}
|
|
7263
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
7786
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _449 => _449.type]) === "bridge-failed") {
|
|
7264
7787
|
const formatted = formatBridgeFailedMessage(eventForCurrentTx);
|
|
7265
7788
|
setState({
|
|
7266
7789
|
type: "failed",
|
|
@@ -7272,11 +7795,11 @@ function ProcessingStep({
|
|
|
7272
7795
|
message: formatted.message,
|
|
7273
7796
|
code: formatted.code
|
|
7274
7797
|
});
|
|
7275
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
7798
|
+
_optionalChain([onDepositFailedRef, 'access', _450 => _450.current, 'optionalCall', _451 => _451(txHash, formatted.message)]);
|
|
7276
7799
|
return;
|
|
7277
7800
|
}
|
|
7278
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
7279
|
-
const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access',
|
|
7801
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _452 => _452.type]) === "error") {
|
|
7802
|
+
const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access', _453 => _453.data, 'optionalAccess', _454 => _454.message]), () => ( "Unknown error"));
|
|
7280
7803
|
setState({
|
|
7281
7804
|
type: "failed",
|
|
7282
7805
|
message: errorMessage,
|
|
@@ -7286,7 +7809,7 @@ function ProcessingStep({
|
|
|
7286
7809
|
txHash,
|
|
7287
7810
|
message: errorMessage
|
|
7288
7811
|
});
|
|
7289
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
7812
|
+
_optionalChain([onDepositFailedRef, 'access', _455 => _455.current, 'optionalCall', _456 => _456(txHash, errorMessage)]);
|
|
7290
7813
|
return;
|
|
7291
7814
|
}
|
|
7292
7815
|
setState((previous) => ({
|
|
@@ -7342,57 +7865,64 @@ function ProcessingStep({
|
|
|
7342
7865
|
const lastEvent = state.lastEvent;
|
|
7343
7866
|
const failureMessage = state.type === "failed" ? state.message : void 0;
|
|
7344
7867
|
const timelineNowMs = _nullishCoalesce(phaseTimings.endedAt, () => ( Date.now()));
|
|
7345
|
-
const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
|
|
7346
|
-
const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
|
|
7347
|
-
const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess',
|
|
7868
|
+
const flowNoun = flowLabel === "withdraw" ? "withdrawal" : flowLabel === "payment" ? "payment" : "deposit";
|
|
7869
|
+
const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : flowLabel === "payment" ? "Payment" : "Deposit";
|
|
7870
|
+
const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess', _457 => _457.data, 'optionalAccess', _458 => _458.destination, 'optionalAccess', _459 => _459.transactionHash]) || null;
|
|
7348
7871
|
const sourceTxHash = getSettledSourceTxHash(lastEvent, txHash);
|
|
7349
7872
|
const sourceDetails = getEventSourceDetails(lastEvent);
|
|
7350
7873
|
const displaySourceChain = _nullishCoalesce(sourceDetails.chainId, () => ( sourceChain));
|
|
7351
7874
|
const displaySourceToken = _nullishCoalesce(sourceDetails.token, () => ( sourceToken));
|
|
7352
7875
|
const displayAmount = _nullishCoalesce(sourceDetails.amount, () => ( amount));
|
|
7353
|
-
const targetChainId =
|
|
7354
|
-
const settledSourceTxHash = _optionalChain([lastEvent, 'optionalAccess',
|
|
7876
|
+
const targetChainId = _chunkFKJ6EJHHcjs.targetChainToChainId.call(void 0, targetChain);
|
|
7877
|
+
const settledSourceTxHash = _optionalChain([lastEvent, 'optionalAccess', _460 => _460.data, 'optionalAccess', _461 => _461.source, 'optionalAccess', _462 => _462.transactionHash]);
|
|
7355
7878
|
const sourceExplorerHash = _nullishCoalesce(settledSourceTxHash, () => ( (sourceTxHashPending ? null : sourceTxHash)));
|
|
7356
7879
|
_react.useEffect.call(void 0, () => {
|
|
7357
7880
|
if (sourceTxHashPending && settledSourceTxHash) {
|
|
7358
|
-
_optionalChain([onSourceTransactionObserved, 'optionalCall',
|
|
7881
|
+
_optionalChain([onSourceTransactionObserved, 'optionalCall', _463 => _463(settledSourceTxHash)]);
|
|
7359
7882
|
}
|
|
7360
7883
|
}, [onSourceTransactionObserved, settledSourceTxHash, sourceTxHashPending]);
|
|
7361
7884
|
const sourceExplorerUrl = sourceExplorerHash ? explorerTxUrl(displaySourceChain, sourceExplorerHash) : null;
|
|
7362
7885
|
const destExplorerUrl = destinationTxHash ? explorerTxUrl(targetChainId, destinationTxHash) : null;
|
|
7363
|
-
const sourceDisplay = (() => {
|
|
7364
|
-
const resolved = resolveTokenDisplay(displaySourceToken, displaySourceChain, {
|
|
7365
|
-
symbol: _nullishCoalesce(providedSourceSymbol, () => ( (displaySourceChain === "solana" ? "SOL" : "Token"))),
|
|
7366
|
-
decimals: providedSourceDecimals
|
|
7367
|
-
});
|
|
7368
|
-
return {
|
|
7369
|
-
symbol: resolved.symbol,
|
|
7370
|
-
decimals: _nullishCoalesce(resolved.decimals, () => ( (displaySourceChain === "solana" ? 9 : 18)))
|
|
7371
|
-
};
|
|
7372
|
-
})();
|
|
7373
|
-
const sourceSymbol = sourceDisplay.symbol;
|
|
7374
|
-
const formattedSentAmount = _nullishCoalesce(_nullishCoalesce(formatRawTokenAmount(displayAmount, sourceDisplay), () => ( // Not raw base units (e.g. a decimal string) — render the number as-is.
|
|
7375
|
-
formatTokenAmount(Number(displayAmount), sourceDisplay.symbol))), () => ( displayAmount));
|
|
7376
7886
|
const eventDestination = getEventDestinationDetails(lastEvent);
|
|
7377
|
-
const
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7887
|
+
const displayTargetChain = _nullishCoalesce(eventDestination.chainId, () => ( targetChainId));
|
|
7888
|
+
const displayTargetToken = _nullishCoalesce(eventDestination.token, () => ( targetToken));
|
|
7889
|
+
const [sourceDisplay, targetDisplay] = useTokenDisplays([
|
|
7890
|
+
{
|
|
7891
|
+
chain: displaySourceChain,
|
|
7892
|
+
address: displaySourceToken,
|
|
7893
|
+
fallback: {
|
|
7894
|
+
symbol: _nullishCoalesce(providedSourceSymbol, () => ( (displaySourceChain === "solana" ? "SOL" : "Token"))),
|
|
7895
|
+
decimals: providedSourceDecimals
|
|
7896
|
+
}
|
|
7897
|
+
},
|
|
7898
|
+
{
|
|
7899
|
+
chain: displayTargetChain,
|
|
7900
|
+
address: displayTargetToken,
|
|
7901
|
+
// Dapp deposits default to USDC targets; mirror the source symbol last
|
|
7902
|
+
// so unresolvable same-token routes still label sensibly.
|
|
7903
|
+
fallback: { symbol: _nullishCoalesce(providedSourceSymbol, () => ( "USDC")) }
|
|
7904
|
+
}
|
|
7905
|
+
]);
|
|
7906
|
+
const sourceSymbol = sourceDisplay.symbol;
|
|
7384
7907
|
const targetSymbol = targetDisplay.symbol;
|
|
7908
|
+
const formattedSentAmount = _nullishCoalesce(formatRawTokenAmount(displayAmount, sourceDisplay), () => ( // Unknown decimals: no figure rather than a guess off by 10^12.
|
|
7909
|
+
(sourceDisplay.decimals === void 0 ? "\u2014" : (
|
|
7910
|
+
// Not raw base units (e.g. a decimal string) — render the number as-is.
|
|
7911
|
+
_nullishCoalesce(formatTokenAmount(Number(displayAmount), sourceDisplay.symbol), () => ( displayAmount))
|
|
7912
|
+
))));
|
|
7913
|
+
const sourceTokenRef = displaySourceToken ? { chain: displaySourceChain, address: displaySourceToken } : void 0;
|
|
7914
|
+
const targetTokenRef = displayTargetToken ? { chain: displayTargetChain, address: displayTargetToken } : void 0;
|
|
7385
7915
|
const formattedDestinationAmount = eventDestination.amount !== void 0 ? formatRawTokenAmount(eventDestination.amount, targetDisplay) : void 0;
|
|
7386
7916
|
const amountUsdNumber = amountUsd !== void 0 && Number(amountUsd) > 0 ? Number(amountUsd) : void 0;
|
|
7387
|
-
const prices = useTokenPrices(
|
|
7917
|
+
const prices = useTokenPrices([
|
|
7388
7918
|
{
|
|
7389
7919
|
chainId: displaySourceChain,
|
|
7390
7920
|
address: displaySourceToken,
|
|
7391
7921
|
symbol: sourceDisplay.symbol
|
|
7392
7922
|
},
|
|
7393
7923
|
{
|
|
7394
|
-
chainId:
|
|
7395
|
-
address:
|
|
7924
|
+
chainId: displayTargetChain,
|
|
7925
|
+
address: displayTargetToken,
|
|
7396
7926
|
symbol: targetDisplay.symbol
|
|
7397
7927
|
}
|
|
7398
7928
|
]);
|
|
@@ -7402,7 +7932,7 @@ function ProcessingStep({
|
|
|
7402
7932
|
sourceSymbol: sourceDisplay.symbol,
|
|
7403
7933
|
targetSymbol: targetDisplay.symbol,
|
|
7404
7934
|
sourceAmountUsd: amountUsdNumber,
|
|
7405
|
-
sourceTrusted:
|
|
7935
|
+
sourceTrusted: sourceDisplay.curated,
|
|
7406
7936
|
prices
|
|
7407
7937
|
});
|
|
7408
7938
|
return estimate !== void 0 ? formatTokenAmount(estimate, targetDisplay.symbol) : void 0;
|
|
@@ -7459,7 +7989,7 @@ function ProcessingStep({
|
|
|
7459
7989
|
timeoutMs: latchedTiming ? resolveServedThresholds(latchedTiming).escalatedMs : FALLBACK_ESCALATED_DELAY_MS,
|
|
7460
7990
|
served: latchedTiming !== void 0
|
|
7461
7991
|
});
|
|
7462
|
-
_optionalChain([onErrorRef, 'access',
|
|
7992
|
+
_optionalChain([onErrorRef, 'access', _464 => _464.current, 'optionalCall', _465 => _465(
|
|
7463
7993
|
"Transfer is taking longer than expected. Your funds are safe and processing will continue automatically.",
|
|
7464
7994
|
"PROCESS_TIMEOUT"
|
|
7465
7995
|
)]);
|
|
@@ -7472,13 +8002,13 @@ function ProcessingStep({
|
|
|
7472
8002
|
timingState,
|
|
7473
8003
|
txHash
|
|
7474
8004
|
]);
|
|
7475
|
-
const sourceChainIcon =
|
|
7476
|
-
const targetChainIcon =
|
|
7477
|
-
const sourceChainName =
|
|
7478
|
-
const targetChainName =
|
|
8005
|
+
const sourceChainIcon = _chunkFKJ6EJHHcjs.getChainIcon.call(void 0, displaySourceChain);
|
|
8006
|
+
const targetChainIcon = _chunkFKJ6EJHHcjs.getChainIcon.call(void 0, targetChainId);
|
|
8007
|
+
const sourceChainName = _chunkFKJ6EJHHcjs.getChainName.call(void 0, displaySourceChain);
|
|
8008
|
+
const targetChainName = _chunkFKJ6EJHHcjs.getChainName.call(void 0, targetChainId);
|
|
7479
8009
|
const timerText = formatTimer(elapsedSeconds);
|
|
7480
|
-
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
7481
|
-
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
8010
|
+
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _466 => _466.feeSponsored]), () => ( false));
|
|
8011
|
+
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _467 => _467.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
|
|
7482
8012
|
const stateTitle = isComplete ? `${flowCapitalized} successful` : isFailed ? `${flowCapitalized} failed` : "Processing...";
|
|
7483
8013
|
const handleRetry = _nullishCoalesce(onRetry, () => ( onNewDeposit));
|
|
7484
8014
|
const headerContent = isComplete ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header", children: [
|
|
@@ -7487,22 +8017,22 @@ function ProcessingStep({
|
|
|
7487
8017
|
] }) : isFailed ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header", children: [
|
|
7488
8018
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, FailedBadge, {}),
|
|
7489
8019
|
/* @__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 }) })
|
|
7490
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WalletIcon, {}), title: stateTitle });
|
|
8020
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.WalletIcon, {}), title: stateTitle });
|
|
7491
8021
|
if (isComplete && isSwappedOrder) {
|
|
7492
|
-
const effectivePaymentMethod = _nullishCoalesce(_nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess',
|
|
8022
|
+
const effectivePaymentMethod = _nullishCoalesce(_nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess', _468 => _468.method]), () => ( _optionalChain([swappedFiatContext, 'optionalAccess', _469 => _469.paymentMethod]))), () => ( null));
|
|
7493
8023
|
const onrampMethod = effectivePaymentMethod ? formatPaymentMethod(effectivePaymentMethod) : null;
|
|
7494
|
-
const onrampMethodIcon = _optionalChain([swappedContext, 'optionalAccess',
|
|
8024
|
+
const onrampMethodIcon = _optionalChain([swappedContext, 'optionalAccess', _470 => _470.variant]) === "connect" && effectivePaymentMethod ? getExchangeLogoSrc(
|
|
7495
8025
|
_nullishCoalesce(onrampMethod, () => ( effectivePaymentMethod)),
|
|
7496
8026
|
effectivePaymentMethod
|
|
7497
8027
|
) : null;
|
|
7498
|
-
const connectPaidAmount = _optionalChain([swappedContext, 'optionalAccess',
|
|
7499
|
-
const amountPaid = _nullishCoalesce(connectPaidAmount, () => ( (_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
8028
|
+
const connectPaidAmount = _optionalChain([swappedContext, 'optionalAccess', _471 => _471.variant]) === "connect" ? `${formattedSentAmount} ${sourceSymbol}` : null;
|
|
8029
|
+
const amountPaid = _nullishCoalesce(connectPaidAmount, () => ( (_optionalChain([swappedFiatContext, 'optionalAccess', _472 => _472.paidAmountUsd]) != null ? `$${swappedFiatContext.paidAmountUsd.toFixed(2)}` : null)));
|
|
7500
8030
|
const depositedAmount = receiveDisplay;
|
|
7501
|
-
const onrampFeeUsd = _nullishCoalesce(_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
8031
|
+
const onrampFeeUsd = _nullishCoalesce(_optionalChain([swappedFiatContext, 'optionalAccess', _473 => _473.onrampFeeUsd]), () => ( null));
|
|
7502
8032
|
const sponsoredFeeTooltip = "This fee is sponsored for this deposit.";
|
|
7503
8033
|
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.";
|
|
7504
8034
|
const { rows: quoteFeeRows, chargeableUsd } = buildQuoteFeeRows(
|
|
7505
|
-
_optionalChain([quote, 'optionalAccess',
|
|
8035
|
+
_optionalChain([quote, 'optionalAccess', _474 => _474.fees, 'access', _475 => _475.breakdown]),
|
|
7506
8036
|
sponsoredFeeTooltip
|
|
7507
8037
|
);
|
|
7508
8038
|
const feeRows = [];
|
|
@@ -7535,6 +8065,7 @@ function ProcessingStep({
|
|
|
7535
8065
|
amountPaid,
|
|
7536
8066
|
depositedAmount,
|
|
7537
8067
|
depositedSymbol: targetSymbol,
|
|
8068
|
+
depositedToken: targetTokenRef,
|
|
7538
8069
|
feesTotal,
|
|
7539
8070
|
feeRows,
|
|
7540
8071
|
feesTooltip,
|
|
@@ -7561,7 +8092,7 @@ function ProcessingStep({
|
|
|
7561
8092
|
rel: "noopener noreferrer",
|
|
7562
8093
|
className: "rs-review-detail-link",
|
|
7563
8094
|
"aria-label": "View source transaction",
|
|
7564
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {})
|
|
8095
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ExternalLinkIcon, {})
|
|
7565
8096
|
}
|
|
7566
8097
|
)
|
|
7567
8098
|
] })
|
|
@@ -7579,7 +8110,7 @@ function ProcessingStep({
|
|
|
7579
8110
|
rel: "noopener noreferrer",
|
|
7580
8111
|
className: "rs-review-detail-link",
|
|
7581
8112
|
"aria-label": "View destination transaction",
|
|
7582
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {})
|
|
8113
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ExternalLinkIcon, {})
|
|
7583
8114
|
}
|
|
7584
8115
|
)
|
|
7585
8116
|
] })
|
|
@@ -7589,7 +8120,7 @@ function ProcessingStep({
|
|
|
7589
8120
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Ticker, { value: timerText }) })
|
|
7590
8121
|
] }),
|
|
7591
8122
|
isSwappedOrder ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
7592
|
-
_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
8123
|
+
_optionalChain([swappedFiatContext, 'optionalAccess', _476 => _476.paidAmountUsd]) != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
7593
8124
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "You pay" }),
|
|
7594
8125
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
7595
8126
|
"$",
|
|
@@ -7601,7 +8132,7 @@ function ProcessingStep({
|
|
|
7601
8132
|
] })
|
|
7602
8133
|
] })
|
|
7603
8134
|
] }),
|
|
7604
|
-
_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
8135
|
+
_optionalChain([swappedFiatContext, 'optionalAccess', _477 => _477.onrampFeeUsd]) != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
7605
8136
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "On-ramp fee" }),
|
|
7606
8137
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
7607
8138
|
"$",
|
|
@@ -7616,7 +8147,7 @@ function ProcessingStep({
|
|
|
7616
8147
|
" ",
|
|
7617
8148
|
sourceSymbol
|
|
7618
8149
|
] }),
|
|
7619
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenIcon, { symbol: sourceSymbol }) })
|
|
8150
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenIcon, { token: sourceTokenRef, symbol: sourceSymbol }) })
|
|
7620
8151
|
] })
|
|
7621
8152
|
] })
|
|
7622
8153
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -7627,14 +8158,14 @@ function ProcessingStep({
|
|
|
7627
8158
|
" ",
|
|
7628
8159
|
sourceSymbol
|
|
7629
8160
|
] }),
|
|
7630
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenIcon, { symbol: sourceSymbol }) })
|
|
8161
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenIcon, { token: sourceTokenRef, symbol: sourceSymbol }) })
|
|
7631
8162
|
] })
|
|
7632
8163
|
] }),
|
|
7633
8164
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
7634
8165
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: isProcessing ? "Receive" : "Received" }),
|
|
7635
8166
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
7636
8167
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: receiveDisplay }),
|
|
7637
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenIcon, { symbol: targetSymbol }) })
|
|
8168
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenIcon, { token: targetTokenRef, symbol: targetSymbol }) })
|
|
7638
8169
|
] })
|
|
7639
8170
|
] }),
|
|
7640
8171
|
isFailed && balanceAfterUsd !== void 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -7663,12 +8194,12 @@ function ProcessingStep({
|
|
|
7663
8194
|
{
|
|
7664
8195
|
className: "rs-review-detail-info",
|
|
7665
8196
|
"aria-label": "Fee info",
|
|
7666
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfoIcon, {})
|
|
8197
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.InfoIcon, {})
|
|
7667
8198
|
}
|
|
7668
8199
|
) })
|
|
7669
8200
|
] })
|
|
7670
8201
|
] }) : (() => {
|
|
7671
|
-
const { display, struck } = quoteFeeRow(_optionalChain([quote, 'optionalAccess',
|
|
8202
|
+
const { display, struck } = quoteFeeRow(_optionalChain([quote, 'optionalAccess', _478 => _478.fees]));
|
|
7672
8203
|
if (display !== null) {
|
|
7673
8204
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
7674
8205
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fees" }),
|
|
@@ -7775,7 +8306,7 @@ var RECIPIENT_HINTS = {
|
|
|
7775
8306
|
stellar: "A Stellar destination needs a recipient account ID starting with G."
|
|
7776
8307
|
};
|
|
7777
8308
|
function recipientNamespace(targetChain) {
|
|
7778
|
-
return _nullishCoalesce(
|
|
8309
|
+
return _nullishCoalesce(_chunkFKJ6EJHHcjs.targetChainToCaip2.call(void 0, targetChain).split(":")[0], () => ( ""));
|
|
7779
8310
|
}
|
|
7780
8311
|
function recipientMatchesTarget(recipient, targetChain) {
|
|
7781
8312
|
const pattern = RECIPIENT_PATTERNS[recipientNamespace(targetChain)];
|
|
@@ -7785,7 +8316,7 @@ function deriveAccountSalt(input) {
|
|
|
7785
8316
|
return _viem.keccak256.call(void 0,
|
|
7786
8317
|
_viem.concat.call(void 0, [
|
|
7787
8318
|
_viem.keccak256.call(void 0, _viem.toHex.call(void 0, _nullishCoalesce(normalizeKeyToken(input.recipient), () => ( "")))),
|
|
7788
|
-
_viem.keccak256.call(void 0, _viem.toHex.call(void 0,
|
|
8319
|
+
_viem.keccak256.call(void 0, _viem.toHex.call(void 0, _chunkFKJ6EJHHcjs.targetChainToCaip2.call(void 0, input.targetChain))),
|
|
7789
8320
|
_viem.keccak256.call(void 0, _viem.toHex.call(void 0, _nullishCoalesce(normalizeKeyToken(input.targetToken), () => ( ""))))
|
|
7790
8321
|
])
|
|
7791
8322
|
);
|
|
@@ -7797,7 +8328,8 @@ function computeRequestKey(input) {
|
|
|
7797
8328
|
recipient: normalizeKeyToken(input.recipient),
|
|
7798
8329
|
outputTokenRules: _nullishCoalesce(input.outputTokenRules, () => ( null)),
|
|
7799
8330
|
rejectUnmapped: _nullishCoalesce(input.rejectUnmapped, () => ( null)),
|
|
7800
|
-
forceRegister: _nullishCoalesce(input.forceRegister, () => ( false))
|
|
8331
|
+
forceRegister: _nullishCoalesce(input.forceRegister, () => ( false)),
|
|
8332
|
+
salt: _nullishCoalesce(input.salt, () => ( null))
|
|
7801
8333
|
});
|
|
7802
8334
|
}
|
|
7803
8335
|
function computeCacheKey(input) {
|
|
@@ -7806,7 +8338,8 @@ function computeCacheKey(input) {
|
|
|
7806
8338
|
targetToken: normalizeKeyToken(input.targetToken),
|
|
7807
8339
|
recipient: normalizeKeyToken(input.recipient),
|
|
7808
8340
|
outputTokenRules: _nullishCoalesce(input.outputTokenRules, () => ( null)),
|
|
7809
|
-
rejectUnmapped: _nullishCoalesce(input.rejectUnmapped, () => ( null))
|
|
8341
|
+
rejectUnmapped: _nullishCoalesce(input.rejectUnmapped, () => ( null)),
|
|
8342
|
+
salt: _nullishCoalesce(input.salt, () => ( null))
|
|
7810
8343
|
});
|
|
7811
8344
|
}
|
|
7812
8345
|
function computeIsCacheable(input) {
|
|
@@ -7817,7 +8350,7 @@ var setupRequestDedupe = /* @__PURE__ */ new Map();
|
|
|
7817
8350
|
function readDedupedAccountSetupResult(requestKey) {
|
|
7818
8351
|
const now = Date.now();
|
|
7819
8352
|
const existing = setupRequestDedupe.get(requestKey);
|
|
7820
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
8353
|
+
if (_optionalChain([existing, 'optionalAccess', _479 => _479.settled]) && existing.expiresAt > now && existing.result) {
|
|
7821
8354
|
return existing.result;
|
|
7822
8355
|
}
|
|
7823
8356
|
return null;
|
|
@@ -7838,7 +8371,7 @@ async function runAccountSetup(input, deps) {
|
|
|
7838
8371
|
);
|
|
7839
8372
|
}
|
|
7840
8373
|
try {
|
|
7841
|
-
const salt = deriveAccountSalt(input);
|
|
8374
|
+
const salt = _nullishCoalesce(input.salt, () => ( deriveAccountSalt(input)));
|
|
7842
8375
|
debugLog(debug, "account-setup", "setup:start", {
|
|
7843
8376
|
salt,
|
|
7844
8377
|
recipient: input.recipient,
|
|
@@ -7848,10 +8381,10 @@ async function runAccountSetup(input, deps) {
|
|
|
7848
8381
|
const result = await service.registerManagedAccount({
|
|
7849
8382
|
salt,
|
|
7850
8383
|
target: {
|
|
7851
|
-
chain:
|
|
8384
|
+
chain: _chunkFKJ6EJHHcjs.targetChainToCaip2.call(void 0, input.targetChain),
|
|
7852
8385
|
token: input.targetToken,
|
|
7853
8386
|
recipient: input.recipient,
|
|
7854
|
-
..._optionalChain([input, 'access',
|
|
8387
|
+
..._optionalChain([input, 'access', _480 => _480.outputTokenRules, 'optionalAccess', _481 => _481.length]) && {
|
|
7855
8388
|
outputTokenRules: input.outputTokenRules
|
|
7856
8389
|
},
|
|
7857
8390
|
...input.rejectUnmapped != null && {
|
|
@@ -8026,16 +8559,4 @@ function mapError(error) {
|
|
|
8026
8559
|
|
|
8027
8560
|
|
|
8028
8561
|
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
exports.Modal = Modal; exports.WalletIcon = WalletIcon; exports.ExternalLinkIcon = ExternalLinkIcon; exports.CheckIcon = CheckIcon; exports.TransferCryptoIcon = TransferCryptoIcon; exports.ChevronLeftIcon = ChevronLeftIcon; exports.ChevronDownIcon = ChevronDownIcon; exports.CloseIcon = CloseIcon; exports.HandCoinsIcon = HandCoinsIcon; exports.InfoIcon = InfoIcon; exports.CopyIcon = CopyIcon; exports.CircleArrowOutUpLeftIcon = CircleArrowOutUpLeftIcon; exports.CardIcon = CardIcon; exports.BankIcon = BankIcon; exports.UnplugIcon = UnplugIcon; exports.MigrateAssetsIcon = MigrateAssetsIcon; exports.AppleIcon = AppleIcon; exports.BodyHeader = BodyHeader; exports.CdnIcon = CdnIcon; exports.ListRow = ListRow; exports.PoweredBy = PoweredBy; exports.Spinner = Spinner; exports.catalogKeyForChain = catalogKeyForChain; exports.debugLog = debugLog; exports.debugError = debugError; exports.getAssetId = getAssetId; exports.chainIdsByValue = chainIdsByValue; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.quoteFeeRow = quoteFeeRow; exports.SwappedConnectFeeChangedError = SwappedConnectFeeChangedError; exports.SUPPORTED_CONNECT_EXCHANGE_COUNT = SUPPORTED_CONNECT_EXCHANGE_COUNT; exports.resolveAppFeeBps = resolveAppFeeBps; exports.isDepositPolicyRefusal = isDepositPolicyRefusal; exports.PermitDepositSubmitError = PermitDepositSubmitError; exports.createDepositService = createDepositService; exports.depositBoundsViolation = depositBoundsViolation; exports.describePolicyRefusal = describePolicyRefusal; exports.rpcUrlFor = rpcUrlFor; exports.RpcUrlsProvider = RpcUrlsProvider; exports.useRpcUrls = useRpcUrls; exports.useStableRpcUrls = useStableRpcUrls; exports.getPublicClient = getPublicClient; exports.peekRuntimeChains = peekRuntimeChains; exports.primeRuntimeChains = primeRuntimeChains; exports.useChainCatalog = useChainCatalog; exports.useCatalogChain = useCatalogChain; exports.useDepositChainIds = useDepositChainIds; exports.useDestinationChains = useDestinationChains; exports.useTargetTokens = useTargetTokens; exports.useDepositOffer = useDepositOffer; exports.useDepositBounds = useDepositBounds; exports.useRestrictedListExclusion = useRestrictedListExclusion; exports.useIsDepositChain = useIsDepositChain; exports.useChainName = useChainName; exports.useReadClient = useReadClient; exports.useExplorerTxUrl = useExplorerTxUrl; exports.ChainCatalogProvider = ChainCatalogProvider; exports.getExchangeLogoSrc = getExchangeLogoSrc; exports.getExchangeLogo = getExchangeLogo; exports.useLatestRef = useLatestRef; exports.Button = Button; exports.Callout = Callout; exports.TokenIcon = TokenIcon; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.isUnsupportedChainSwitchError = isUnsupportedChainSwitchError; exports.formatUserError = formatUserError; exports.Tooltip = Tooltip; exports.formatExpectedDuration = formatExpectedDuration; exports.markSubmissionUncertain = markSubmissionUncertain; exports.isSubmissionUncertain = isSubmissionUncertain; exports.formatTokenAmount = formatTokenAmount; exports.isDisplayStablecoinSymbol = isDisplayStablecoinSymbol; exports.isRecognizedToken = isRecognizedToken; exports.formatQuotedReceive = formatQuotedReceive; exports.formatReceiveEstimate = formatReceiveEstimate; 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.AnalyticsSession = AnalyticsSession; exports.useDepositAnalyticsEmitter = useDepositAnalyticsEmitter; exports.useWithdrawAnalyticsEmitter = useWithdrawAnalyticsEmitter; 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.resolveThemeMode = resolveThemeMode; exports.followSystemAppearance = followSystemAppearance; exports.applyTheme = applyTheme; exports.warnRemovedProps = warnRemovedProps; exports.checkBackendUrl = checkBackendUrl; exports.isHistoryEntryVisible = isHistoryEntryVisible; exports.createHistoryAnalytics = createHistoryAnalytics; exports.analyticsTargetProperties = analyticsTargetProperties;
|
|
8562
|
+
exports.Modal = Modal; exports.Callout = Callout; exports.CdnIcon = CdnIcon; exports.ListRow = ListRow; exports.PoweredBy = PoweredBy; exports.catalogKeyForChain = catalogKeyForChain; exports.debugLog = debugLog; exports.debugError = debugError; exports.SOLANA_TOKENS = SOLANA_TOKENS; exports.resolveSolanaToken = resolveSolanaToken; exports.isNativeSol = isNativeSol; exports.getAssetId = getAssetId; exports.chainIdsByValue = chainIdsByValue; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.quoteFeeRow = quoteFeeRow; exports.SUPPORTED_CONNECT_EXCHANGE_COUNT = SUPPORTED_CONNECT_EXCHANGE_COUNT; exports.resolveAppFeeBps = resolveAppFeeBps; exports.isDepositPolicyRefusal = isDepositPolicyRefusal; exports.PermitDepositSubmitError = PermitDepositSubmitError; exports.createDepositService = createDepositService; exports.depositBoundsViolation = depositBoundsViolation; exports.describePolicyRefusal = describePolicyRefusal; exports.rpcUrlFor = rpcUrlFor; exports.RpcUrlsProvider = RpcUrlsProvider; exports.useRpcUrls = useRpcUrls; exports.useStableRpcUrls = useStableRpcUrls; exports.getPublicClient = getPublicClient; exports.peekRuntimeChains = peekRuntimeChains; exports.primeRuntimeChains = primeRuntimeChains; exports.useChainCatalog = useChainCatalog; exports.useCatalogChain = useCatalogChain; exports.useDepositChainIds = useDepositChainIds; exports.useDestinationChains = useDestinationChains; exports.useTargetTokens = useTargetTokens; exports.useDepositOffer = useDepositOffer; exports.useDepositBounds = useDepositBounds; exports.useRestrictedListExclusion = useRestrictedListExclusion; exports.useIsDepositChain = useIsDepositChain; exports.useChainName = useChainName; exports.useReadClient = useReadClient; exports.useExplorerTxUrl = useExplorerTxUrl; exports.ChainCatalogProvider = ChainCatalogProvider; exports.getExchangeLogoSrc = getExchangeLogoSrc; exports.getExchangeLogo = getExchangeLogo; exports.Button = Button; exports.assetIdFor = assetIdFor; exports.AssetMetadataProvider = AssetMetadataProvider; exports.useAssetStore = useAssetStore; exports.TokenIcon = TokenIcon; exports.resolveCuratedToken = resolveCuratedToken; exports.useTokenDisplays = useTokenDisplays; exports.useTokenDisplay = useTokenDisplay; exports.useIsRecognizedToken = useIsRecognizedToken; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.isUnsupportedChainSwitchError = isUnsupportedChainSwitchError; exports.formatUserError = formatUserError; exports.Tooltip = Tooltip; exports.formatExpectedDuration = formatExpectedDuration; exports.markSubmissionUncertain = markSubmissionUncertain; exports.isSubmissionUncertain = isSubmissionUncertain; exports.formatTokenAmount = formatTokenAmount; exports.isDisplayStablecoinSymbol = isDisplayStablecoinSymbol; exports.formatQuotedReceive = formatQuotedReceive; exports.formatReceiveEstimate = formatReceiveEstimate; exports.getEventTxHash = getEventTxHash; exports.getEventSourceDetails = getEventSourceDetails; exports.isDepositEvent = isDepositEvent; exports.isFailedEvent = isFailedEvent; exports.txRefsMatch = txRefsMatch; exports.failureMessageForEvent = failureMessageForEvent; exports.useTokenPrices = useTokenPrices; exports.ProcessingStep = ProcessingStep; exports.AnalyticsSession = AnalyticsSession; exports.useDepositAnalyticsEmitter = useDepositAnalyticsEmitter; exports.useWithdrawAnalyticsEmitter = useWithdrawAnalyticsEmitter; 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.resolveThemeMode = resolveThemeMode; exports.followSystemAppearance = followSystemAppearance; exports.applyTheme = applyTheme; exports.warnRemovedProps = warnRemovedProps; exports.checkBackendUrl = checkBackendUrl; exports.isHistoryEntryVisible = isHistoryEntryVisible; exports.createHistoryAnalytics = createHistoryAnalytics; exports.analyticsTargetProperties = analyticsTargetProperties;
|