@rhinestone/deposit-modal 0.19.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 +151 -61
- package/dist/BankOnrampStep-JG32OCM2.mjs +435 -0
- package/dist/BankOnrampStep-NPGXAA7U.cjs +435 -0
- package/dist/{DepositModalReown-XBNY6QCI.mjs → DepositModalReown-3FGTPER6.mjs} +6 -5
- package/dist/{DepositModalReown-UITYXJ6W.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-NITKDXHR.mjs → chunk-247GJH57.mjs} +480 -272
- package/dist/{chunk-FTWKAJGN.mjs → chunk-2FOPO4N5.mjs} +1 -1
- package/dist/{chunk-5NWLS5BQ.mjs → chunk-32ERBFMO.mjs} +1432 -961
- package/dist/chunk-5QUWEFD4.mjs +19 -0
- package/dist/chunk-6CTJFR3T.mjs +113 -0
- package/dist/{chunk-X6N2XPTO.mjs → chunk-B2LZQIGB.mjs} +1 -1
- package/dist/{chunk-EG4H7OMC.cjs → chunk-BTEG2VNZ.cjs} +171 -130
- package/dist/{chunk-HMUGY66O.cjs → chunk-CXRH5MKO.cjs} +1502 -1031
- package/dist/chunk-E7IMWVMN.mjs +346 -0
- package/dist/{chunk-PYOC6K24.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-BIL4ENC3.mjs → chunk-HP7S7AD6.mjs} +73 -32
- package/dist/{chunk-ISLVD5HQ.cjs → chunk-OPT5EW6L.cjs} +10 -5
- package/dist/chunk-PYRXOP2Y.cjs +113 -0
- package/dist/{chunk-ZGHVJ2XM.mjs → chunk-XBJCZYBX.mjs} +8 -3
- package/dist/chunk-YY4ZOAH5.mjs +224 -0
- package/dist/{chunk-OCWSMLOP.cjs → chunk-Z4RBTNKX.cjs} +980 -772
- 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 -33
- package/dist/onramp.d.cts +51 -33
- package/dist/onramp.d.ts +51 -33
- package/dist/onramp.mjs +5 -34
- 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 +255 -0
- package/dist/{types-BShYNpvO.d.cts → types-BxSrazbq.d.ts} +20 -2
- package/dist/{types-BOxa1DE-.d.ts → types-CixUBhrM.d.cts} +20 -2
- 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-DY6A55OA.mjs +0 -11
- package/dist/WithdrawModal-V42OK7L3.cjs +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,
|
|
@@ -719,24 +688,14 @@ function parseFeeLine(raw) {
|
|
|
719
688
|
...line.internal !== void 0 && { internal: line.internal }
|
|
720
689
|
};
|
|
721
690
|
}
|
|
722
|
-
var SwappedConnectFeeChangedError = class extends Error {
|
|
723
|
-
constructor(exchangeFeeBps, message = "The Exchange Fee changed") {
|
|
724
|
-
super(message);
|
|
725
|
-
this.exchangeFeeBps = exchangeFeeBps;
|
|
726
|
-
this.name = "SwappedConnectFeeChangedError";
|
|
727
|
-
}
|
|
728
|
-
};
|
|
729
|
-
function parseExchangeFeeBps(value) {
|
|
730
|
-
return typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 1e4 ? value : void 0;
|
|
731
|
-
}
|
|
732
691
|
var UNSUPPORTED_CONNECT_EXCHANGES = /* @__PURE__ */ new Set(["kraken", "htx"]);
|
|
733
692
|
var SUPPORTED_CONNECT_EXCHANGE_COUNT = 7;
|
|
734
693
|
function isSupportedConnectExchange(exchange) {
|
|
735
694
|
return !UNSUPPORTED_CONNECT_EXCHANGES.has(exchange.connection.toLowerCase());
|
|
736
695
|
}
|
|
737
696
|
function resolveAppFeeBps(appFees, sourceChainCaip2, sourceToken) {
|
|
738
|
-
const override = _optionalChain([appFees, 'optionalAccess',
|
|
739
|
-
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));
|
|
740
699
|
return bps > 0 ? bps : 0;
|
|
741
700
|
}
|
|
742
701
|
function isRawAmount(value) {
|
|
@@ -750,6 +709,10 @@ var DEPOSIT_POLICY_REFUSAL_CODES = [
|
|
|
750
709
|
"BALANCE-3",
|
|
751
710
|
"BALANCE-4"
|
|
752
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/";
|
|
753
716
|
var DEPOSIT_PREFLIGHT_TIMEOUT_MS = 1e4;
|
|
754
717
|
async function readPolicyRefusal(response) {
|
|
755
718
|
if (response.status !== 422) return null;
|
|
@@ -780,8 +743,8 @@ var RegistrationError = class extends Error {
|
|
|
780
743
|
};
|
|
781
744
|
function createDepositService(baseUrl, options) {
|
|
782
745
|
const normalizedBaseUrl = baseUrl.replace(/\/$/, "");
|
|
783
|
-
const debug = _optionalChain([options, 'optionalAccess',
|
|
784
|
-
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"));
|
|
785
748
|
function apiUrl(path) {
|
|
786
749
|
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
787
750
|
return `${normalizedBaseUrl}${normalizedPath}`;
|
|
@@ -790,16 +753,14 @@ function createDepositService(baseUrl, options) {
|
|
|
790
753
|
if (value.length <= 20) return value;
|
|
791
754
|
return `${value.slice(0, 10)}...${value.slice(-8)}`;
|
|
792
755
|
}
|
|
793
|
-
function withPreflightTimeout(label, fallback, run) {
|
|
756
|
+
function withPreflightTimeout(label, fallback, run, timeoutMs = DEPOSIT_PREFLIGHT_TIMEOUT_MS) {
|
|
794
757
|
const controller = new AbortController();
|
|
795
758
|
return new Promise((resolve) => {
|
|
796
759
|
const timer = setTimeout(() => {
|
|
797
|
-
debugLog(debug, scope, `${label}:timeout`, {
|
|
798
|
-
timeoutMs: DEPOSIT_PREFLIGHT_TIMEOUT_MS
|
|
799
|
-
});
|
|
760
|
+
debugLog(debug, scope, `${label}:timeout`, { timeoutMs });
|
|
800
761
|
controller.abort();
|
|
801
762
|
resolve(fallback);
|
|
802
|
-
},
|
|
763
|
+
}, timeoutMs);
|
|
803
764
|
run(controller.signal).then(
|
|
804
765
|
(value) => {
|
|
805
766
|
clearTimeout(timer);
|
|
@@ -814,6 +775,85 @@ function createDepositService(baseUrl, options) {
|
|
|
814
775
|
}
|
|
815
776
|
const PORTFOLIO_CACHE_TTL_MS = 3e4;
|
|
816
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
|
+
}
|
|
817
857
|
let topTokensPromise = null;
|
|
818
858
|
let chainsPromise = null;
|
|
819
859
|
function parseDepositOptions(value) {
|
|
@@ -849,7 +889,7 @@ function createDepositService(baseUrl, options) {
|
|
|
849
889
|
try {
|
|
850
890
|
const response = await fetch(apiUrl("/qr/tokens"), {
|
|
851
891
|
method: "GET",
|
|
852
|
-
headers:
|
|
892
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, )
|
|
853
893
|
});
|
|
854
894
|
if (!response.ok) {
|
|
855
895
|
debugLog(debug, scope, "getTopTokens:unavailable", {
|
|
@@ -876,7 +916,7 @@ function createDepositService(baseUrl, options) {
|
|
|
876
916
|
try {
|
|
877
917
|
const response = await fetch(apiUrl("/chains"), {
|
|
878
918
|
method: "GET",
|
|
879
|
-
headers:
|
|
919
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, )
|
|
880
920
|
});
|
|
881
921
|
if (!response.ok) {
|
|
882
922
|
debugLog(debug, scope, "getChains:unavailable", {
|
|
@@ -907,7 +947,7 @@ function createDepositService(baseUrl, options) {
|
|
|
907
947
|
}
|
|
908
948
|
let promise;
|
|
909
949
|
promise = fetcher().catch((err) => {
|
|
910
|
-
if (_optionalChain([portfolioCache, 'access',
|
|
950
|
+
if (_optionalChain([portfolioCache, 'access', _13 => _13.get, 'call', _14 => _14(key), 'optionalAccess', _15 => _15.promise]) === promise) {
|
|
911
951
|
portfolioCache.delete(key);
|
|
912
952
|
}
|
|
913
953
|
throw err;
|
|
@@ -918,6 +958,39 @@ function createDepositService(baseUrl, options) {
|
|
|
918
958
|
});
|
|
919
959
|
return promise;
|
|
920
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
|
+
}
|
|
921
994
|
return {
|
|
922
995
|
async registerManagedAccount(params) {
|
|
923
996
|
const url = apiUrl("/register-managed");
|
|
@@ -930,7 +1003,7 @@ function createDepositService(baseUrl, options) {
|
|
|
930
1003
|
});
|
|
931
1004
|
const response = await fetch(url, {
|
|
932
1005
|
method: "POST",
|
|
933
|
-
headers:
|
|
1006
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
934
1007
|
body: JSON.stringify({ account: params })
|
|
935
1008
|
});
|
|
936
1009
|
if (!response.ok) {
|
|
@@ -939,7 +1012,7 @@ function createDepositService(baseUrl, options) {
|
|
|
939
1012
|
status: response.status,
|
|
940
1013
|
salt: params.salt
|
|
941
1014
|
});
|
|
942
|
-
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;
|
|
943
1016
|
const base = error.error || `Account registration failed: ${response.status}`;
|
|
944
1017
|
throw new RegistrationError(
|
|
945
1018
|
detail ? `${base}: ${detail}` : base,
|
|
@@ -948,13 +1021,13 @@ function createDepositService(baseUrl, options) {
|
|
|
948
1021
|
}
|
|
949
1022
|
const result = await response.json();
|
|
950
1023
|
debugLog(debug, scope, "registerManagedAccount:success", {
|
|
951
|
-
evmDepositAddress: _optionalChain([result, 'optionalAccess',
|
|
952
|
-
hasSolanaDepositAddress: Boolean(_optionalChain([result, 'optionalAccess',
|
|
953
|
-
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]))
|
|
954
1027
|
});
|
|
955
1028
|
return {
|
|
956
1029
|
...result,
|
|
957
|
-
evmDepositAddress: normalizeEvmAddress(_optionalChain([result, 'optionalAccess',
|
|
1030
|
+
evmDepositAddress: normalizeEvmAddress(_optionalChain([result, 'optionalAccess', _23 => _23.evmDepositAddress]))
|
|
958
1031
|
};
|
|
959
1032
|
},
|
|
960
1033
|
async fetchPortfolio(address, options2) {
|
|
@@ -965,7 +1038,7 @@ function createDepositService(baseUrl, options) {
|
|
|
965
1038
|
debugLog(debug, scope, "fetchPortfolio:request", { url, address });
|
|
966
1039
|
const response = await fetch(url, {
|
|
967
1040
|
method: "GET",
|
|
968
|
-
headers:
|
|
1041
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, )
|
|
969
1042
|
});
|
|
970
1043
|
if (!response.ok) {
|
|
971
1044
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -1002,7 +1075,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1002
1075
|
debugLog(debug, scope, "fetchPortfolio:empty", { address });
|
|
1003
1076
|
return { tokens: [], totalUsd: 0 };
|
|
1004
1077
|
},
|
|
1005
|
-
_optionalChain([options2, 'optionalAccess',
|
|
1078
|
+
_optionalChain([options2, 'optionalAccess', _24 => _24.forceRefresh])
|
|
1006
1079
|
);
|
|
1007
1080
|
},
|
|
1008
1081
|
async fetchSolanaPortfolio(address, options2) {
|
|
@@ -1016,7 +1089,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1016
1089
|
});
|
|
1017
1090
|
const response = await fetch(url, {
|
|
1018
1091
|
method: "GET",
|
|
1019
|
-
headers:
|
|
1092
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, )
|
|
1020
1093
|
});
|
|
1021
1094
|
if (!response.ok) {
|
|
1022
1095
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -1037,7 +1110,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1037
1110
|
});
|
|
1038
1111
|
return normalized;
|
|
1039
1112
|
},
|
|
1040
|
-
_optionalChain([options2, 'optionalAccess',
|
|
1113
|
+
_optionalChain([options2, 'optionalAccess', _25 => _25.forceRefresh])
|
|
1041
1114
|
);
|
|
1042
1115
|
},
|
|
1043
1116
|
async checkAccount(address) {
|
|
@@ -1045,7 +1118,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1045
1118
|
debugLog(debug, scope, "checkAccount:request", { url, address });
|
|
1046
1119
|
const response = await fetch(url, {
|
|
1047
1120
|
method: "GET",
|
|
1048
|
-
headers:
|
|
1121
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, )
|
|
1049
1122
|
});
|
|
1050
1123
|
if (!response.ok) {
|
|
1051
1124
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -1059,9 +1132,9 @@ function createDepositService(baseUrl, options) {
|
|
|
1059
1132
|
}
|
|
1060
1133
|
const data = await response.json();
|
|
1061
1134
|
const result = {
|
|
1062
|
-
isRegistered: _optionalChain([data, 'optionalAccess',
|
|
1063
|
-
targetChain: _optionalChain([data, 'optionalAccess',
|
|
1064
|
-
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])
|
|
1065
1138
|
};
|
|
1066
1139
|
debugLog(debug, scope, "checkAccount:success", {
|
|
1067
1140
|
address,
|
|
@@ -1081,7 +1154,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1081
1154
|
);
|
|
1082
1155
|
const response = await fetch(url, {
|
|
1083
1156
|
method: "GET",
|
|
1084
|
-
headers:
|
|
1157
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1085
1158
|
cache: "no-store"
|
|
1086
1159
|
});
|
|
1087
1160
|
if (!response.ok) {
|
|
@@ -1093,12 +1166,12 @@ function createDepositService(baseUrl, options) {
|
|
|
1093
1166
|
return { lastEvent: void 0 };
|
|
1094
1167
|
}
|
|
1095
1168
|
const body = await response.json();
|
|
1096
|
-
const row = _optionalChain([body, 'access',
|
|
1169
|
+
const row = _optionalChain([body, 'access', _29 => _29.deposits, 'optionalAccess', _30 => _30[0]]);
|
|
1097
1170
|
const lastEvent = row ? depositRowToEvent(row) : void 0;
|
|
1098
1171
|
debugLog(debug, scope, "fetchStatus:success", {
|
|
1099
1172
|
address,
|
|
1100
1173
|
txHash: shortRef(normalized),
|
|
1101
|
-
eventType: _optionalChain([lastEvent, 'optionalAccess',
|
|
1174
|
+
eventType: _optionalChain([lastEvent, 'optionalAccess', _31 => _31.type])
|
|
1102
1175
|
});
|
|
1103
1176
|
return { lastEvent };
|
|
1104
1177
|
},
|
|
@@ -1109,7 +1182,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1109
1182
|
);
|
|
1110
1183
|
const response = await fetch(url, {
|
|
1111
1184
|
method: "GET",
|
|
1112
|
-
headers:
|
|
1185
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1113
1186
|
cache: "no-store"
|
|
1114
1187
|
});
|
|
1115
1188
|
if (!response.ok) {
|
|
@@ -1133,7 +1206,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1133
1206
|
);
|
|
1134
1207
|
const response = await fetch(url, {
|
|
1135
1208
|
method: "GET",
|
|
1136
|
-
headers:
|
|
1209
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1137
1210
|
cache: "no-store"
|
|
1138
1211
|
});
|
|
1139
1212
|
if (!response.ok) {
|
|
@@ -1144,18 +1217,18 @@ function createDepositService(baseUrl, options) {
|
|
|
1144
1217
|
return { lastEvent: void 0 };
|
|
1145
1218
|
}
|
|
1146
1219
|
const body = await response.json();
|
|
1147
|
-
const row = _optionalChain([body, 'access',
|
|
1220
|
+
const row = _optionalChain([body, 'access', _32 => _32.deposits, 'optionalAccess', _33 => _33[0]]);
|
|
1148
1221
|
const lastEvent = row ? depositRowToEvent(row) : void 0;
|
|
1149
1222
|
debugLog(debug, scope, "fetchLatestStatus:success", {
|
|
1150
1223
|
address,
|
|
1151
|
-
eventType: _optionalChain([lastEvent, 'optionalAccess',
|
|
1224
|
+
eventType: _optionalChain([lastEvent, 'optionalAccess', _34 => _34.type])
|
|
1152
1225
|
});
|
|
1153
1226
|
return { lastEvent };
|
|
1154
1227
|
},
|
|
1155
1228
|
async getPositions(address) {
|
|
1156
1229
|
const url = apiUrl(`/positions/${address}`);
|
|
1157
1230
|
debugLog(debug, scope, "getPositions:request", { url, address });
|
|
1158
|
-
const response = await fetch(url, { headers:
|
|
1231
|
+
const response = await fetch(url, { headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ) });
|
|
1159
1232
|
if (!response.ok) {
|
|
1160
1233
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1161
1234
|
debugError(debug, scope, "getPositions:failed", error, {
|
|
@@ -1169,9 +1242,9 @@ function createDepositService(baseUrl, options) {
|
|
|
1169
1242
|
const result = await response.json();
|
|
1170
1243
|
debugLog(debug, scope, "getPositions:success", {
|
|
1171
1244
|
address,
|
|
1172
|
-
count: _nullishCoalesce(_optionalChain([result, 'access',
|
|
1245
|
+
count: _nullishCoalesce(_optionalChain([result, 'access', _35 => _35.positions, 'optionalAccess', _36 => _36.length]), () => ( 0)),
|
|
1173
1246
|
totalUsd: result.totalUsd,
|
|
1174
|
-
failures: _optionalChain([result, 'access',
|
|
1247
|
+
failures: _optionalChain([result, 'access', _37 => _37.failures, 'optionalAccess', _38 => _38.map, 'call', _39 => _39((f) => f.venue)])
|
|
1175
1248
|
});
|
|
1176
1249
|
return result;
|
|
1177
1250
|
},
|
|
@@ -1189,7 +1262,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1189
1262
|
});
|
|
1190
1263
|
const response = await fetch(url, {
|
|
1191
1264
|
method: "POST",
|
|
1192
|
-
headers:
|
|
1265
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1193
1266
|
body: JSON.stringify({ account, market, chainId, asset, amount })
|
|
1194
1267
|
});
|
|
1195
1268
|
if (!response.ok) {
|
|
@@ -1225,7 +1298,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1225
1298
|
});
|
|
1226
1299
|
const response = await fetch(url, {
|
|
1227
1300
|
method: "POST",
|
|
1228
|
-
headers:
|
|
1301
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1229
1302
|
body: JSON.stringify({
|
|
1230
1303
|
depositWallet,
|
|
1231
1304
|
owner,
|
|
@@ -1249,7 +1322,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1249
1322
|
const result = await response.json();
|
|
1250
1323
|
debugLog(debug, scope, "submitPolymarketWithdraw:success", {
|
|
1251
1324
|
depositWallet,
|
|
1252
|
-
txHash: _optionalChain([result, 'optionalAccess',
|
|
1325
|
+
txHash: _optionalChain([result, 'optionalAccess', _40 => _40.txHash]) ? shortRef(result.txHash) : void 0
|
|
1253
1326
|
});
|
|
1254
1327
|
return result;
|
|
1255
1328
|
},
|
|
@@ -1267,7 +1340,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1267
1340
|
});
|
|
1268
1341
|
const response = await fetch(url, {
|
|
1269
1342
|
method: "GET",
|
|
1270
|
-
headers:
|
|
1343
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1271
1344
|
cache: "no-store"
|
|
1272
1345
|
});
|
|
1273
1346
|
if (!response.ok) {
|
|
@@ -1281,8 +1354,8 @@ function createDepositService(baseUrl, options) {
|
|
|
1281
1354
|
);
|
|
1282
1355
|
}
|
|
1283
1356
|
const data = await response.json();
|
|
1284
|
-
const deposits = Array.isArray(_optionalChain([data, 'optionalAccess',
|
|
1285
|
-
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));
|
|
1286
1359
|
debugLog(debug, scope, "fetchDepositHistory:success", {
|
|
1287
1360
|
recipient: shortRef(params.recipient),
|
|
1288
1361
|
count: deposits.length,
|
|
@@ -1291,18 +1364,18 @@ function createDepositService(baseUrl, options) {
|
|
|
1291
1364
|
return { deposits, nextCursor };
|
|
1292
1365
|
},
|
|
1293
1366
|
async checkLiquidity(params) {
|
|
1294
|
-
if (
|
|
1295
|
-
const token =
|
|
1367
|
+
if (_chunkFKJ6EJHHcjs.isSolanaCaip2.call(void 0, params.destinationChainId) || params.destinationChainId === "solana") {
|
|
1368
|
+
const token = resolveSolanaToken(params.destinationToken);
|
|
1296
1369
|
return {
|
|
1297
1370
|
hasLiquidity: true,
|
|
1298
|
-
symbol: _nullishCoalesce(_optionalChain([token, 'optionalAccess',
|
|
1299
|
-
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)),
|
|
1300
1373
|
unlimited: true,
|
|
1301
1374
|
maxAmount: null
|
|
1302
1375
|
};
|
|
1303
1376
|
}
|
|
1304
1377
|
const searchParams = new URLSearchParams({
|
|
1305
|
-
sourceChainId:
|
|
1378
|
+
sourceChainId: _chunkFKJ6EJHHcjs.toEvmCaip2.call(void 0, params.sourceChainId),
|
|
1306
1379
|
sourceToken: params.sourceToken,
|
|
1307
1380
|
destinationChainId: params.destinationChainId,
|
|
1308
1381
|
destinationToken: params.destinationToken,
|
|
@@ -1317,7 +1390,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1317
1390
|
});
|
|
1318
1391
|
const response = await fetch(url, {
|
|
1319
1392
|
method: "GET",
|
|
1320
|
-
headers:
|
|
1393
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1321
1394
|
cache: "no-store"
|
|
1322
1395
|
});
|
|
1323
1396
|
if (!response.ok) {
|
|
@@ -1352,7 +1425,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1352
1425
|
// The branch is unreachable against today's processor whatever venue it
|
|
1353
1426
|
// names: `sourceToken` is validated as a 20-byte 0x address on every
|
|
1354
1427
|
// chain, and a HyperCore source token is a 16-byte Core spot tokenId.
|
|
1355
|
-
sourceChainId: params.sourceChainId === "hypercore" ?
|
|
1428
|
+
sourceChainId: params.sourceChainId === "hypercore" ? _chunkFKJ6EJHHcjs.HYPERCORE_SPOT_CAIP2 : `eip155:${params.sourceChainId}`,
|
|
1356
1429
|
sourceToken: params.sourceToken,
|
|
1357
1430
|
// Each direction carries its own amount field and omits the other, which
|
|
1358
1431
|
// is what the processor's "exactly one of" refinement checks. Sending
|
|
@@ -1371,7 +1444,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1371
1444
|
try {
|
|
1372
1445
|
const response = await fetch(url, {
|
|
1373
1446
|
method: "POST",
|
|
1374
|
-
headers:
|
|
1447
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1375
1448
|
body: JSON.stringify(body),
|
|
1376
1449
|
cache: "no-store",
|
|
1377
1450
|
signal
|
|
@@ -1421,7 +1494,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1421
1494
|
try {
|
|
1422
1495
|
const response = await fetch(url, {
|
|
1423
1496
|
method: "POST",
|
|
1424
|
-
headers:
|
|
1497
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1425
1498
|
body: JSON.stringify({ ...params, kind: "auto" }),
|
|
1426
1499
|
cache: "no-store",
|
|
1427
1500
|
signal
|
|
@@ -1524,7 +1597,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1524
1597
|
try {
|
|
1525
1598
|
response = await fetch(url, {
|
|
1526
1599
|
method: "POST",
|
|
1527
|
-
headers:
|
|
1600
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1528
1601
|
body: JSON.stringify(params)
|
|
1529
1602
|
});
|
|
1530
1603
|
} catch (error) {
|
|
@@ -1546,7 +1619,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1546
1619
|
);
|
|
1547
1620
|
}
|
|
1548
1621
|
const result = await response.json();
|
|
1549
|
-
if (typeof _optionalChain([result, 'optionalAccess',
|
|
1622
|
+
if (typeof _optionalChain([result, 'optionalAccess', _46 => _46.txHash]) !== "string" || result.txHash.length === 0) {
|
|
1550
1623
|
debugError(debug, scope, "submitPermitDeposit:failed", result, {
|
|
1551
1624
|
reason: "missing txHash"
|
|
1552
1625
|
});
|
|
@@ -1566,142 +1639,49 @@ function createDepositService(baseUrl, options) {
|
|
|
1566
1639
|
status: _nullishCoalesce(result.status, () => ( "processing"))
|
|
1567
1640
|
};
|
|
1568
1641
|
},
|
|
1569
|
-
async
|
|
1570
|
-
const
|
|
1571
|
-
if (
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
)
|
|
1575
|
-
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
if (!response.ok) {
|
|
1582
|
-
debugError(debug, scope, "fetchPrices:failed", {
|
|
1583
|
-
status: response.status
|
|
1584
|
-
});
|
|
1585
|
-
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 };
|
|
1586
1654
|
}
|
|
1587
|
-
const
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
symbol.toUpperCase(),
|
|
1591
|
-
price
|
|
1592
|
-
])
|
|
1593
|
-
);
|
|
1594
|
-
} catch (err) {
|
|
1595
|
-
debugError(debug, scope, "fetchPrices:error", err);
|
|
1596
|
-
return {};
|
|
1597
|
-
}
|
|
1598
|
-
},
|
|
1599
|
-
async fetchPricesByAddress(caip2Ids) {
|
|
1600
|
-
const list = caip2Ids.filter((id) => id.length > 0);
|
|
1601
|
-
if (list.length === 0) return {};
|
|
1602
|
-
const url = apiUrl(
|
|
1603
|
-
`/prices?${new URLSearchParams({
|
|
1604
|
-
addresses: list.join(",")
|
|
1605
|
-
}).toString()}`
|
|
1606
|
-
);
|
|
1607
|
-
try {
|
|
1608
|
-
const response = await fetch(url, {
|
|
1609
|
-
method: "GET",
|
|
1610
|
-
headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
|
|
1611
|
-
cache: "no-store"
|
|
1612
|
-
});
|
|
1613
|
-
if (!response.ok) {
|
|
1614
|
-
debugError(debug, scope, "fetchPricesByAddress:failed", {
|
|
1615
|
-
status: response.status
|
|
1616
|
-
});
|
|
1617
|
-
return {};
|
|
1655
|
+
for (const id of batch) {
|
|
1656
|
+
const item = parseAssetItem(outcome.data[id], fields);
|
|
1657
|
+
if (item) items[id] = item;
|
|
1618
1658
|
}
|
|
1619
|
-
const data = await response.json();
|
|
1620
|
-
return _nullishCoalesce(data.prices, () => ( {}));
|
|
1621
|
-
} catch (err) {
|
|
1622
|
-
debugError(debug, scope, "fetchPricesByAddress:error", err);
|
|
1623
|
-
return {};
|
|
1624
1659
|
}
|
|
1660
|
+
return { ok: true, items };
|
|
1625
1661
|
},
|
|
1626
1662
|
async getSwappedWidgetUrl(params) {
|
|
1627
|
-
const
|
|
1663
|
+
const { smartAccount, ...fields } = params;
|
|
1628
1664
|
debugLog(debug, scope, "getSwappedWidgetUrl:request", {
|
|
1629
|
-
smartAccount: shortRef(
|
|
1665
|
+
smartAccount: shortRef(smartAccount),
|
|
1630
1666
|
method: params.method,
|
|
1631
1667
|
methodSelectionSource: params.methodSelectionSource
|
|
1632
1668
|
});
|
|
1633
|
-
|
|
1634
|
-
method: "POST",
|
|
1635
|
-
headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
|
|
1636
|
-
body: JSON.stringify(params)
|
|
1637
|
-
});
|
|
1638
|
-
if (!response.ok) {
|
|
1639
|
-
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1640
|
-
debugError(debug, scope, "getSwappedWidgetUrl:failed", error, {
|
|
1641
|
-
status: response.status
|
|
1642
|
-
});
|
|
1643
|
-
throw new Error(
|
|
1644
|
-
error.error || `Swapped widget URL failed: ${response.status}`
|
|
1645
|
-
);
|
|
1646
|
-
}
|
|
1647
|
-
const body = await response.json();
|
|
1648
|
-
if (typeof body.url !== "string" || typeof body.currencyCode !== "string" || typeof body.externalCustomerId !== "string") {
|
|
1649
|
-
throw new Error("Swapped widget URL: malformed response");
|
|
1650
|
-
}
|
|
1651
|
-
return {
|
|
1652
|
-
url: body.url,
|
|
1653
|
-
currencyCode: body.currencyCode,
|
|
1654
|
-
sandbox: body.sandbox === true,
|
|
1655
|
-
externalCustomerId: body.externalCustomerId,
|
|
1656
|
-
expiresAt: body.expiresAt
|
|
1657
|
-
};
|
|
1669
|
+
return startSwappedCheckout("fiat", smartAccount, fields);
|
|
1658
1670
|
},
|
|
1659
1671
|
async getSwappedConnectUrl(params) {
|
|
1660
|
-
const
|
|
1672
|
+
const { smartAccount, ...fields } = params;
|
|
1661
1673
|
debugLog(debug, scope, "getSwappedConnectUrl:request", {
|
|
1662
|
-
smartAccount: shortRef(
|
|
1674
|
+
smartAccount: shortRef(smartAccount),
|
|
1663
1675
|
connection: params.connection
|
|
1664
1676
|
});
|
|
1665
|
-
|
|
1666
|
-
method: "POST",
|
|
1667
|
-
headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
|
|
1668
|
-
body: JSON.stringify(params)
|
|
1669
|
-
});
|
|
1670
|
-
if (!response.ok) {
|
|
1671
|
-
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1672
|
-
debugError(debug, scope, "getSwappedConnectUrl:failed", error, {
|
|
1673
|
-
status: response.status
|
|
1674
|
-
});
|
|
1675
|
-
const currentFeeBps = parseExchangeFeeBps(error.exchangeFeeBps);
|
|
1676
|
-
if (response.status === 409 && currentFeeBps !== void 0) {
|
|
1677
|
-
throw new SwappedConnectFeeChangedError(
|
|
1678
|
-
currentFeeBps,
|
|
1679
|
-
typeof error.error === "string" ? error.error : void 0
|
|
1680
|
-
);
|
|
1681
|
-
}
|
|
1682
|
-
throw new Error(
|
|
1683
|
-
typeof error.error === "string" && error.error || `Swapped Connect URL failed: ${response.status}`
|
|
1684
|
-
);
|
|
1685
|
-
}
|
|
1686
|
-
const body = await response.json();
|
|
1687
|
-
if (typeof body.url !== "string" || typeof body.currencyCode !== "string" || typeof body.externalCustomerId !== "string") {
|
|
1688
|
-
throw new Error("Swapped Connect URL: malformed response");
|
|
1689
|
-
}
|
|
1690
|
-
return {
|
|
1691
|
-
url: body.url,
|
|
1692
|
-
currencyCode: body.currencyCode,
|
|
1693
|
-
sandbox: body.sandbox === true,
|
|
1694
|
-
externalCustomerId: body.externalCustomerId,
|
|
1695
|
-
expiresAt: body.expiresAt,
|
|
1696
|
-
exchangeFeeBps: parseExchangeFeeBps(body.exchangeFeeBps)
|
|
1697
|
-
};
|
|
1677
|
+
return startSwappedCheckout("exchange", smartAccount, fields);
|
|
1698
1678
|
},
|
|
1699
1679
|
async getSwappedConnectExchanges() {
|
|
1700
|
-
const url = apiUrl("/onramp/swapped
|
|
1680
|
+
const url = apiUrl("/onramp/options?provider=swapped&kind=exchange");
|
|
1701
1681
|
debugLog(debug, scope, "getSwappedConnectExchanges:request");
|
|
1702
1682
|
const response = await fetch(url, {
|
|
1703
1683
|
method: "GET",
|
|
1704
|
-
headers:
|
|
1684
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1705
1685
|
cache: "no-store"
|
|
1706
1686
|
});
|
|
1707
1687
|
if (!response.ok) {
|
|
@@ -1714,7 +1694,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1714
1694
|
);
|
|
1715
1695
|
}
|
|
1716
1696
|
const body = await response.json();
|
|
1717
|
-
const rawExchanges = Array.isArray(body.
|
|
1697
|
+
const rawExchanges = Array.isArray(body.connections) ? body.connections : null;
|
|
1718
1698
|
const exchanges = [];
|
|
1719
1699
|
let hasMalformedExchange = rawExchanges === null;
|
|
1720
1700
|
for (const exchange of _nullishCoalesce(rawExchanges, () => ( []))) {
|
|
@@ -1732,16 +1712,10 @@ function createDepositService(baseUrl, options) {
|
|
|
1732
1712
|
}
|
|
1733
1713
|
exchanges.push({ connection, name, logoUrl });
|
|
1734
1714
|
}
|
|
1735
|
-
if (hasMalformedExchange
|
|
1715
|
+
if (hasMalformedExchange) {
|
|
1736
1716
|
throw new Error("Swapped Connect exchanges: malformed response");
|
|
1737
1717
|
}
|
|
1738
|
-
return {
|
|
1739
|
-
exchanges: exchanges.filter(isSupportedConnectExchange),
|
|
1740
|
-
fetchedAt: body.fetchedAt,
|
|
1741
|
-
expiresAt: body.expiresAt,
|
|
1742
|
-
stale: body.stale === true ? true : void 0,
|
|
1743
|
-
exchangeFeeBps: parseExchangeFeeBps(body.exchangeFeeBps)
|
|
1744
|
-
};
|
|
1718
|
+
return { exchanges: exchanges.filter(isSupportedConnectExchange) };
|
|
1745
1719
|
},
|
|
1746
1720
|
async getSwappedPaymentMethods() {
|
|
1747
1721
|
const empty = {
|
|
@@ -1749,12 +1723,12 @@ function createDepositService(baseUrl, options) {
|
|
|
1749
1723
|
methods: [],
|
|
1750
1724
|
recommendedMethod: null
|
|
1751
1725
|
};
|
|
1752
|
-
const url = apiUrl("/onramp/swapped
|
|
1726
|
+
const url = apiUrl("/onramp/options?provider=swapped&kind=fiat");
|
|
1753
1727
|
debugLog(debug, scope, "getSwappedPaymentMethods:request");
|
|
1754
1728
|
try {
|
|
1755
1729
|
const response = await fetch(url, {
|
|
1756
1730
|
method: "GET",
|
|
1757
|
-
headers:
|
|
1731
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1758
1732
|
cache: "no-store"
|
|
1759
1733
|
});
|
|
1760
1734
|
if (!response.ok) {
|
|
@@ -1842,7 +1816,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1842
1816
|
try {
|
|
1843
1817
|
const response = await fetch(url, {
|
|
1844
1818
|
method: "GET",
|
|
1845
|
-
headers:
|
|
1819
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1846
1820
|
cache: "no-store"
|
|
1847
1821
|
});
|
|
1848
1822
|
if (!response.ok) {
|
|
@@ -1863,63 +1837,99 @@ function createDepositService(baseUrl, options) {
|
|
|
1863
1837
|
return null;
|
|
1864
1838
|
}
|
|
1865
1839
|
},
|
|
1866
|
-
async
|
|
1867
|
-
const url = apiUrl(
|
|
1868
|
-
`/onramp/swapped/status/${encodeURIComponent(smartAccount)}`
|
|
1869
|
-
);
|
|
1840
|
+
async fetchSwappedOrder(orderId) {
|
|
1841
|
+
const url = apiUrl(`/onramp/orders/${encodeURIComponent(orderId)}`);
|
|
1870
1842
|
const response = await fetch(url, {
|
|
1871
1843
|
method: "GET",
|
|
1872
|
-
headers:
|
|
1844
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
1873
1845
|
cache: "no-store"
|
|
1874
1846
|
});
|
|
1875
1847
|
if (!response.ok) return null;
|
|
1876
|
-
let body
|
|
1848
|
+
let body;
|
|
1877
1849
|
try {
|
|
1878
1850
|
body = await response.json();
|
|
1879
1851
|
} catch (e5) {
|
|
1880
1852
|
return null;
|
|
1881
1853
|
}
|
|
1882
|
-
|
|
1883
|
-
const status = typeof body.status === "string" ? body.status : null;
|
|
1884
|
-
const orderId = typeof body.orderId === "string" ? body.orderId : null;
|
|
1885
|
-
if (!status || !orderId) return null;
|
|
1886
|
-
const numericOrNull = (v) => {
|
|
1887
|
-
if (typeof v === "number") {
|
|
1888
|
-
return Number.isFinite(v) ? v : null;
|
|
1889
|
-
}
|
|
1890
|
-
if (typeof v === "string" && v.trim().length > 0) {
|
|
1891
|
-
const parsed = Number(v);
|
|
1892
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
1893
|
-
}
|
|
1894
|
-
return null;
|
|
1895
|
-
};
|
|
1896
|
-
return {
|
|
1897
|
-
orderId,
|
|
1898
|
-
status,
|
|
1899
|
-
orderCrypto: typeof body.orderCrypto === "string" ? body.orderCrypto : null,
|
|
1900
|
-
orderCryptoAmount: typeof body.orderCryptoAmount === "string" ? body.orderCryptoAmount : null,
|
|
1901
|
-
transactionId: typeof body.transactionId === "string" ? body.transactionId : null,
|
|
1902
|
-
receivedAt: typeof body.receivedAt === "string" ? body.receivedAt : null,
|
|
1903
|
-
paidAmountUsd: numericOrNull(body.paidAmountUsd),
|
|
1904
|
-
paidAmountEur: numericOrNull(body.paidAmountEur),
|
|
1905
|
-
onrampFeeUsd: numericOrNull(body.onrampFeeUsd),
|
|
1906
|
-
paymentMethod: typeof body.paymentMethod === "string" ? body.paymentMethod : null
|
|
1907
|
-
};
|
|
1854
|
+
return swappedOrderFromView(orderId, body);
|
|
1908
1855
|
}
|
|
1909
1856
|
};
|
|
1910
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
|
+
}
|
|
1911
1921
|
function normalizeDirectPortfolio(data) {
|
|
1912
1922
|
const rawTokens = _nullishCoalesce(_nullishCoalesce(extractArray(data, "tokens"), () => ( extractArray(
|
|
1913
|
-
_optionalChain([data, 'optionalAccess',
|
|
1923
|
+
_optionalChain([data, 'optionalAccess', _70 => _70.data]),
|
|
1914
1924
|
"tokens"
|
|
1915
1925
|
))), () => ( []));
|
|
1916
|
-
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));
|
|
1917
1927
|
const tokens = rawTokens.map((token) => normalizeDirectToken(token)).filter((token) => Boolean(token));
|
|
1918
1928
|
return { tokens, totalUsd };
|
|
1919
1929
|
}
|
|
1920
1930
|
function extractOrchestratorPortfolio(data) {
|
|
1921
1931
|
const portfolio = _nullishCoalesce(extractArray(data, "portfolio"), () => ( extractArray(
|
|
1922
|
-
_optionalChain([data, 'optionalAccess',
|
|
1932
|
+
_optionalChain([data, 'optionalAccess', _72 => _72.data]),
|
|
1923
1933
|
"portfolio"
|
|
1924
1934
|
)));
|
|
1925
1935
|
if (!portfolio || !Array.isArray(portfolio)) return null;
|
|
@@ -1930,23 +1940,16 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1930
1940
|
for (const tokenData of data.portfolio || []) {
|
|
1931
1941
|
const chainBalances = _nullishCoalesce(_nullishCoalesce(tokenData.tokenChainBalance, () => ( tokenData.chainBalances)), () => ( []));
|
|
1932
1942
|
for (const chainBalance of chainBalances) {
|
|
1933
|
-
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access',
|
|
1943
|
+
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _73 => _73.balance, 'optionalAccess', _74 => _74.unlocked]), () => ( "0"));
|
|
1934
1944
|
const normalizedName = tokenData.tokenName.trim();
|
|
1935
1945
|
const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
|
|
1936
|
-
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => (
|
|
1937
|
-
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;
|
|
1938
1948
|
if (!resolvedTokenAddress) {
|
|
1939
1949
|
continue;
|
|
1940
1950
|
}
|
|
1941
|
-
const
|
|
1942
|
-
|
|
1943
|
-
chainBalance.chainId
|
|
1944
|
-
);
|
|
1945
|
-
const symbol = registrySymbol !== "Token" ? registrySymbol : normalizedName || "Token";
|
|
1946
|
-
const decimals = registrySymbol !== "Token" ? _chunkOY5N3E6Lcjs.getTokenDecimalsByAddress.call(void 0,
|
|
1947
|
-
resolvedTokenAddress,
|
|
1948
|
-
chainBalance.chainId
|
|
1949
|
-
) : _nullishCoalesce(tokenData.tokenDecimals, () => ( 18));
|
|
1951
|
+
const symbol = normalizedName || "Token";
|
|
1952
|
+
const decimals = _nullishCoalesce(tokenData.tokenDecimals, () => ( 18));
|
|
1950
1953
|
tokens.push({
|
|
1951
1954
|
chainId: chainBalance.chainId,
|
|
1952
1955
|
address: resolvedTokenAddress,
|
|
@@ -1966,28 +1969,26 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1966
1969
|
function normalizeDirectToken(token) {
|
|
1967
1970
|
const rawChainId = _nullishCoalesce(extractNumber(token, "chainId"), () => ( extractNumber(token.chain, "id")));
|
|
1968
1971
|
const rawChainString = _nullishCoalesce(extractString(token, "chainId"), () => ( extractString(token.chain, "id")));
|
|
1969
|
-
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ?
|
|
1972
|
+
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ? _chunkFKJ6EJHHcjs.isSolanaCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "solana" ? "solana" : (
|
|
1970
1973
|
// HyperCore is a non-EVM source under its own namespace; keep its
|
|
1971
1974
|
// USDC instead of dropping it as an unparseable chain string.
|
|
1972
|
-
|
|
1975
|
+
_chunkFKJ6EJHHcjs.isHyperCoreCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "hypercore" ? "hypercore" : _chunkFKJ6EJHHcjs.parseEvmChainId.call(void 0, rawChainString)
|
|
1973
1976
|
) : null)));
|
|
1974
1977
|
if (chainId === null) return null;
|
|
1975
|
-
const registryChainId = typeof chainId === "number" ? chainId : chainId === "hypercore" ? _chunkOY5N3E6Lcjs.HYPERCORE_CHAIN_ID : void 0;
|
|
1976
1978
|
const symbol = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "symbol"), () => ( extractString(token, "tokenSymbol"))), () => ( extractString(token, "tokenName"))), () => ( extractString(token, "name")));
|
|
1977
1979
|
if (!symbol) return null;
|
|
1978
|
-
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()])));
|
|
1979
1981
|
if (!balanceValue) return null;
|
|
1980
1982
|
const address = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "address"), () => ( extractString(token, "tokenAddress"))), () => ( extractString(
|
|
1981
1983
|
token.token,
|
|
1982
1984
|
"address"
|
|
1983
|
-
))), () => ( (
|
|
1985
|
+
))), () => ( (chainId === "hypercore" ? _optionalChain([hyperCoreSourceToken, 'call', _87 => _87(void 0, symbol), 'optionalAccess', _88 => _88.address]) : typeof chainId === "number" ? runtimeEvmAddress(chainId, symbol) : void 0)));
|
|
1984
1986
|
if (!address) return null;
|
|
1985
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));
|
|
1986
|
-
const isSolanaToken = chainId === "solana";
|
|
1987
|
-
const registrySymbol = isSolanaToken ? "Token" : _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, address, registryChainId);
|
|
1988
|
-
const resolvedSymbol = isSolanaToken ? symbol : registrySymbol !== "Token" ? registrySymbol : symbol;
|
|
1989
1988
|
const backendDecimals = _nullishCoalesce(extractNumber(token, "decimals"), () => ( extractNumber(token, "tokenDecimals")));
|
|
1990
|
-
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));
|
|
1991
1992
|
return {
|
|
1992
1993
|
chainId,
|
|
1993
1994
|
address,
|
|
@@ -1998,9 +1999,18 @@ function normalizeDirectToken(token) {
|
|
|
1998
1999
|
balanceUsd
|
|
1999
2000
|
};
|
|
2000
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
|
+
}
|
|
2001
2011
|
function extractTokenAddress(tokenData, chainId) {
|
|
2002
2012
|
const token = tokenData;
|
|
2003
|
-
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]])));
|
|
2004
2014
|
}
|
|
2005
2015
|
function extractArray(data, key) {
|
|
2006
2016
|
if (!data || typeof data !== "object") return null;
|
|
@@ -2030,7 +2040,7 @@ function extractNumericString(data, key) {
|
|
|
2030
2040
|
// src/core/rpc.ts
|
|
2031
2041
|
|
|
2032
2042
|
function rpcUrlFor(rpcUrls, chain) {
|
|
2033
|
-
const url = _optionalChain([rpcUrls, 'optionalAccess',
|
|
2043
|
+
const url = _optionalChain([rpcUrls, 'optionalAccess', _98 => _98[chain], 'optionalAccess', _99 => _99.trim, 'call', _100 => _100()]);
|
|
2034
2044
|
return url ? url : void 0;
|
|
2035
2045
|
}
|
|
2036
2046
|
var RpcUrlsContext = _react.createContext.call(void 0, void 0);
|
|
@@ -2040,7 +2050,7 @@ function useRpcUrls() {
|
|
|
2040
2050
|
}
|
|
2041
2051
|
function rpcUrlsKey(rpcUrls) {
|
|
2042
2052
|
if (!rpcUrls) return "";
|
|
2043
|
-
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("|");
|
|
2044
2054
|
}
|
|
2045
2055
|
function useStableRpcUrls(rpcUrls) {
|
|
2046
2056
|
const key = rpcUrlsKey(rpcUrls);
|
|
@@ -2062,15 +2072,15 @@ function useStableRpcUrls(rpcUrls) {
|
|
|
2062
2072
|
|
|
2063
2073
|
function findListed(options, chain, token) {
|
|
2064
2074
|
const normalize2 = (value) => chain === "solana" ? value : value.toLowerCase();
|
|
2065
|
-
return _optionalChain([options, 'access',
|
|
2075
|
+
return _optionalChain([options, 'access', _103 => _103.tokens, 'access', _104 => _104[String(chain)], 'optionalAccess', _105 => _105.find, 'call', _106 => _106(
|
|
2066
2076
|
(listed) => normalize2(listed.address) === normalize2(token)
|
|
2067
2077
|
)]);
|
|
2068
2078
|
}
|
|
2069
2079
|
function isExcludedByRestrictedList(options, chain, token) {
|
|
2070
|
-
return Boolean(_optionalChain([options, 'optionalAccess',
|
|
2080
|
+
return Boolean(_optionalChain([options, 'optionalAccess', _107 => _107.restricted]) && !findListed(options, chain, token));
|
|
2071
2081
|
}
|
|
2072
2082
|
function findDepositBounds(options, chain, token) {
|
|
2073
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
2083
|
+
if (!_optionalChain([options, 'optionalAccess', _108 => _108.restricted])) return void 0;
|
|
2074
2084
|
const entry = findListed(options, chain, token);
|
|
2075
2085
|
if (!entry || entry.minAmount === void 0 && entry.maxAmount === void 0) {
|
|
2076
2086
|
return void 0;
|
|
@@ -2083,7 +2093,7 @@ function findDepositBounds(options, chain, token) {
|
|
|
2083
2093
|
};
|
|
2084
2094
|
}
|
|
2085
2095
|
function boundMessage(bounds, bound) {
|
|
2086
|
-
const raw = _optionalChain([bounds, 'optionalAccess',
|
|
2096
|
+
const raw = _optionalChain([bounds, 'optionalAccess', _109 => _109[bound]]);
|
|
2087
2097
|
if (!bounds || raw === void 0) return null;
|
|
2088
2098
|
const amount = new Intl.NumberFormat("en-US", {
|
|
2089
2099
|
maximumFractionDigits: Math.min(bounds.decimals, 20)
|
|
@@ -2182,7 +2192,7 @@ async function loadViemChains() {
|
|
|
2182
2192
|
viemChainsPromise = Promise.resolve().then(() => _interopRequireWildcard(require("viem/chains"))).then((module) => {
|
|
2183
2193
|
const map = /* @__PURE__ */ new Map();
|
|
2184
2194
|
for (const value of Object.values(module)) {
|
|
2185
|
-
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])) {
|
|
2186
2196
|
const chain = value;
|
|
2187
2197
|
const existing = map.get(chain.id);
|
|
2188
2198
|
if (existing) existing.push(chain);
|
|
@@ -2196,7 +2206,7 @@ async function loadViemChains() {
|
|
|
2196
2206
|
return viemChainsPromise;
|
|
2197
2207
|
}
|
|
2198
2208
|
function pickViemChain(candidates, chain) {
|
|
2199
|
-
if (!_optionalChain([candidates, 'optionalAccess',
|
|
2209
|
+
if (!_optionalChain([candidates, 'optionalAccess', _114 => _114.length])) return void 0;
|
|
2200
2210
|
if (candidates.length === 1) return candidates[0];
|
|
2201
2211
|
const sameNetworkClass = candidates.filter(
|
|
2202
2212
|
(candidate) => Boolean(candidate.testnet) === chain.testnet
|
|
@@ -2212,10 +2222,10 @@ function pickViemChain(candidates, chain) {
|
|
|
2212
2222
|
}
|
|
2213
2223
|
function resolveRpcUrls(chain, override, viemChains) {
|
|
2214
2224
|
const urls = [];
|
|
2215
|
-
if (_optionalChain([override, 'optionalAccess',
|
|
2225
|
+
if (_optionalChain([override, 'optionalAccess', _115 => _115.trim, 'call', _116 => _116()])) urls.push(override.trim());
|
|
2216
2226
|
if (chain.publicRpcUrl) urls.push(chain.publicRpcUrl);
|
|
2217
2227
|
if (chain.chainId !== null && chain.vmType === "evm") {
|
|
2218
|
-
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]);
|
|
2219
2229
|
if (http2) urls.push(...http2);
|
|
2220
2230
|
}
|
|
2221
2231
|
return [...new Set(urls)];
|
|
@@ -2224,7 +2234,7 @@ function toViemChain(chain, override, viemChains) {
|
|
|
2224
2234
|
if (chain.vmType !== "evm" || chain.chainId === null) return null;
|
|
2225
2235
|
const rpcUrls = resolveRpcUrls(chain, override, viemChains);
|
|
2226
2236
|
if (rpcUrls.length === 0) return null;
|
|
2227
|
-
const bundled = pickViemChain(_optionalChain([viemChains, 'optionalAccess',
|
|
2237
|
+
const bundled = pickViemChain(_optionalChain([viemChains, 'optionalAccess', _123 => _123.get, 'call', _124 => _124(chain.chainId)]), chain);
|
|
2228
2238
|
if (bundled) {
|
|
2229
2239
|
if (rpcUrls[0] === bundled.rpcUrls.default.http[0]) return bundled;
|
|
2230
2240
|
return _viem.defineChain.call(void 0, {
|
|
@@ -2255,7 +2265,7 @@ function toViemChains(catalog, overrides, viemChains) {
|
|
|
2255
2265
|
for (const entry of catalog.all) {
|
|
2256
2266
|
const chain = toViemChain(
|
|
2257
2267
|
entry,
|
|
2258
|
-
entry.chainId === null ? void 0 : _optionalChain([overrides, 'optionalAccess',
|
|
2268
|
+
entry.chainId === null ? void 0 : _optionalChain([overrides, 'optionalAccess', _125 => _125[entry.chainId]]),
|
|
2259
2269
|
viemChains
|
|
2260
2270
|
);
|
|
2261
2271
|
if (chain) chains.push(chain);
|
|
@@ -2264,7 +2274,7 @@ function toViemChains(catalog, overrides, viemChains) {
|
|
|
2264
2274
|
}
|
|
2265
2275
|
function needsViemChains(catalog, overrides) {
|
|
2266
2276
|
return catalog.all.some(
|
|
2267
|
-
(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()])
|
|
2268
2278
|
);
|
|
2269
2279
|
}
|
|
2270
2280
|
|
|
@@ -2308,9 +2318,9 @@ function peekRuntimeChains(backendUrl, overrides) {
|
|
|
2308
2318
|
return _nullishCoalesce(resolvedChainsByKey.get(runtimeChainsKey(backendUrl, overrides)), () => ( null));
|
|
2309
2319
|
}
|
|
2310
2320
|
function publishCatalogTokens(catalog) {
|
|
2311
|
-
|
|
2321
|
+
setRuntimeTokens(
|
|
2312
2322
|
catalog.all.flatMap((chain) => {
|
|
2313
|
-
const chainId =
|
|
2323
|
+
const chainId = _chunkFKJ6EJHHcjs.displayChainIdForCaip2.call(void 0, chain.caip2);
|
|
2314
2324
|
if (chainId === null || !Array.isArray(chain.supportedTokens)) return [];
|
|
2315
2325
|
const tokens = chain.supportedTokens.map((token) => ({
|
|
2316
2326
|
chainId,
|
|
@@ -2331,21 +2341,22 @@ function publishCatalogTokens(catalog) {
|
|
|
2331
2341
|
);
|
|
2332
2342
|
}
|
|
2333
2343
|
function publishRuntimeChainMeta(catalog) {
|
|
2334
|
-
|
|
2344
|
+
_chunkFKJ6EJHHcjs.setRuntimeChainMeta.call(void 0,
|
|
2335
2345
|
catalog.all.flatMap((chain) => {
|
|
2336
2346
|
const ids = [];
|
|
2337
2347
|
if (chain.chainId !== null) ids.push(chain.chainId);
|
|
2338
|
-
const sentinel =
|
|
2348
|
+
const sentinel = _chunkFKJ6EJHHcjs.displayChainIdForCaip2.call(void 0, chain.caip2);
|
|
2339
2349
|
if (sentinel !== null && sentinel !== chain.chainId) ids.push(sentinel);
|
|
2340
|
-
if (
|
|
2350
|
+
if (_chunkFKJ6EJHHcjs.isHyperCoreCaip2.call(void 0, chain.caip2)) ids.push(_chunkFKJ6EJHHcjs.HYPERCORE_CHAIN_ID);
|
|
2341
2351
|
return ids.map((chainId) => ({
|
|
2342
2352
|
chainId,
|
|
2343
2353
|
name: chain.name,
|
|
2344
2354
|
iconUrl: _nullishCoalesce(chain.iconUrl, () => ( void 0)),
|
|
2345
2355
|
nativeSymbol: chain.nativeToken.symbol,
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
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])
|
|
2349
2360
|
}));
|
|
2350
2361
|
})
|
|
2351
2362
|
);
|
|
@@ -2395,8 +2406,8 @@ function useDepositChainIds() {
|
|
|
2395
2406
|
!c.testnet
|
|
2396
2407
|
).map((c) => c.chainId);
|
|
2397
2408
|
const rank = (id) => {
|
|
2398
|
-
const i =
|
|
2399
|
-
return i === -1 ?
|
|
2409
|
+
const i = _chunkFKJ6EJHHcjs.CHAIN_DISPLAY_ORDER.indexOf(id);
|
|
2410
|
+
return i === -1 ? _chunkFKJ6EJHHcjs.CHAIN_DISPLAY_ORDER.length : i;
|
|
2400
2411
|
};
|
|
2401
2412
|
return ids.map((id, i) => ({ id, i })).sort((a, b) => rank(a.id) - rank(b.id) || a.i - b.i).map(({ id }) => id);
|
|
2402
2413
|
}, [catalog]);
|
|
@@ -2406,8 +2417,8 @@ function useDestinationChains() {
|
|
|
2406
2417
|
return _react.useMemo.call(void 0, () => {
|
|
2407
2418
|
if (!catalog) return [];
|
|
2408
2419
|
const rank = (id) => {
|
|
2409
|
-
const i =
|
|
2410
|
-
return i === -1 ?
|
|
2420
|
+
const i = _chunkFKJ6EJHHcjs.CHAIN_DISPLAY_ORDER.indexOf(id);
|
|
2421
|
+
return i === -1 ? _chunkFKJ6EJHHcjs.CHAIN_DISPLAY_ORDER.length : i;
|
|
2411
2422
|
};
|
|
2412
2423
|
return catalog.all.filter(
|
|
2413
2424
|
(c) => c.destination && c.vmType === "evm" && c.chainId !== null && !c.testnet
|
|
@@ -2418,7 +2429,7 @@ function useTargetTokens() {
|
|
|
2418
2429
|
const { catalog, shortlist } = useChainCatalog();
|
|
2419
2430
|
return _react.useMemo.call(void 0, () => {
|
|
2420
2431
|
return (chainId) => {
|
|
2421
|
-
const fromShortlist = _optionalChain([shortlist, 'optionalAccess',
|
|
2432
|
+
const fromShortlist = _optionalChain([shortlist, 'optionalAccess', _135 => _135[String(chainId)]]);
|
|
2422
2433
|
if (fromShortlist) {
|
|
2423
2434
|
return fromShortlist.map((token) => ({
|
|
2424
2435
|
symbol: token.symbol,
|
|
@@ -2426,8 +2437,8 @@ function useTargetTokens() {
|
|
|
2426
2437
|
decimals: token.decimals
|
|
2427
2438
|
}));
|
|
2428
2439
|
}
|
|
2429
|
-
const entry = _optionalChain([catalog, 'optionalAccess',
|
|
2430
|
-
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) => ({
|
|
2431
2442
|
symbol: token.symbol,
|
|
2432
2443
|
address: token.address,
|
|
2433
2444
|
decimals: token.decimals
|
|
@@ -2437,12 +2448,12 @@ function useTargetTokens() {
|
|
|
2437
2448
|
}
|
|
2438
2449
|
function createDepositOffer(state, retry) {
|
|
2439
2450
|
const options = state.status === "ready" ? state.options : null;
|
|
2440
|
-
const restricted = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2441
|
-
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)]]);
|
|
2442
2453
|
const isChainOffered = (chain) => {
|
|
2443
2454
|
if (!options) return false;
|
|
2444
2455
|
const entry = listed(chain);
|
|
2445
|
-
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;
|
|
2446
2457
|
};
|
|
2447
2458
|
return {
|
|
2448
2459
|
status: state.status,
|
|
@@ -2489,10 +2500,10 @@ function useChainName() {
|
|
|
2489
2500
|
const { catalog } = useChainCatalog();
|
|
2490
2501
|
return _react.useMemo.call(void 0, () => {
|
|
2491
2502
|
return (chainId) => {
|
|
2492
|
-
if (!catalog) return
|
|
2503
|
+
if (!catalog) return _chunkFKJ6EJHHcjs.getChainName.call(void 0, chainId);
|
|
2493
2504
|
const key = catalogKeyForChain(chainId);
|
|
2494
2505
|
const entry = typeof key === "number" ? catalog.byChainId.get(key) : catalog.byCaip2.get(key);
|
|
2495
|
-
return _nullishCoalesce(_optionalChain([entry, 'optionalAccess',
|
|
2506
|
+
return _nullishCoalesce(_optionalChain([entry, 'optionalAccess', _145 => _145.name]), () => ( _chunkFKJ6EJHHcjs.getChainName.call(void 0, chainId)));
|
|
2496
2507
|
};
|
|
2497
2508
|
}, [catalog]);
|
|
2498
2509
|
}
|
|
@@ -2504,20 +2515,20 @@ function useRuntimeChainsVersion() {
|
|
|
2504
2515
|
);
|
|
2505
2516
|
}
|
|
2506
2517
|
function useReadClient(chainId, rpcUrls) {
|
|
2507
|
-
const
|
|
2518
|
+
const version2 = useRuntimeChainsVersion();
|
|
2508
2519
|
return _react.useMemo.call(void 0,
|
|
2509
2520
|
() => getPublicClient(chainId, rpcUrls),
|
|
2510
|
-
[chainId, rpcUrls,
|
|
2521
|
+
[chainId, rpcUrls, version2]
|
|
2511
2522
|
);
|
|
2512
2523
|
}
|
|
2513
2524
|
function useExplorerTxUrl() {
|
|
2514
2525
|
const { catalog } = useChainCatalog();
|
|
2515
2526
|
return _react.useMemo.call(void 0, () => {
|
|
2516
2527
|
return (chainId, txHash) => {
|
|
2517
|
-
if (chainId === "hypercore") return
|
|
2528
|
+
if (chainId === "hypercore") return _chunkFKJ6EJHHcjs.getExplorerTxUrl.call(void 0, chainId, txHash);
|
|
2518
2529
|
const key = catalog ? catalogKeyForChain(chainId) : void 0;
|
|
2519
|
-
const entry = key === void 0 ? void 0 : typeof key === "number" ? _optionalChain([catalog, 'optionalAccess',
|
|
2520
|
-
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)));
|
|
2521
2532
|
};
|
|
2522
2533
|
}, [catalog]);
|
|
2523
2534
|
}
|
|
@@ -2579,11 +2590,11 @@ function ChainCatalogProvider({
|
|
|
2579
2590
|
service.getTopTokens().then(
|
|
2580
2591
|
(result) => {
|
|
2581
2592
|
if (!active) return;
|
|
2582
|
-
if (!_optionalChain([result, 'optionalAccess',
|
|
2593
|
+
if (!_optionalChain([result, 'optionalAccess', _152 => _152.ok])) {
|
|
2583
2594
|
setDepositOptions({ status: "error" });
|
|
2584
2595
|
return;
|
|
2585
2596
|
}
|
|
2586
|
-
|
|
2597
|
+
publishShortlistTokens(result.options.tokens);
|
|
2587
2598
|
setDepositOptions({ status: "ready", options: result.options });
|
|
2588
2599
|
},
|
|
2589
2600
|
() => {
|
|
@@ -2628,14 +2639,290 @@ function ChainCatalogProvider({
|
|
|
2628
2639
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChainCatalogContext.Provider, { value, children });
|
|
2629
2640
|
}
|
|
2630
2641
|
|
|
2631
|
-
// src/core/
|
|
2642
|
+
// src/core/asset-metadata.tsx
|
|
2643
|
+
|
|
2644
|
+
|
|
2645
|
+
|
|
2632
2646
|
|
|
2633
|
-
|
|
2634
|
-
|
|
2647
|
+
|
|
2648
|
+
|
|
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);
|
|
2635
2898
|
_react.useEffect.call(void 0, () => {
|
|
2636
|
-
|
|
2637
|
-
}, [
|
|
2638
|
-
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]);
|
|
2639
2926
|
}
|
|
2640
2927
|
|
|
2641
2928
|
// src/core/analytics.tsx
|
|
@@ -2704,7 +2991,7 @@ function createIngestTransport(options) {
|
|
|
2704
2991
|
function report(reason, status) {
|
|
2705
2992
|
try {
|
|
2706
2993
|
onFailure({ reason, status, droppedEvents: dropped });
|
|
2707
|
-
} catch (
|
|
2994
|
+
} catch (e7) {
|
|
2708
2995
|
}
|
|
2709
2996
|
}
|
|
2710
2997
|
function drop(batch, reason, status) {
|
|
@@ -2758,10 +3045,10 @@ function createIngestTransport(options) {
|
|
|
2758
3045
|
}
|
|
2759
3046
|
function interruptForUnload() {
|
|
2760
3047
|
for (const wake of [...sleepers]) wake();
|
|
2761
|
-
_optionalChain([mintAbort, 'optionalAccess',
|
|
3048
|
+
_optionalChain([mintAbort, 'optionalAccess', _168 => _168.abort, 'call', _169 => _169()]);
|
|
2762
3049
|
}
|
|
2763
3050
|
function retryDelay(response, attempt) {
|
|
2764
|
-
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")]));
|
|
2765
3052
|
if (Number.isFinite(seconds) && seconds > 0) {
|
|
2766
3053
|
return Math.min(seconds * 1e3, MAX_BACKOFF_MS);
|
|
2767
3054
|
}
|
|
@@ -2776,10 +3063,10 @@ function createIngestTransport(options) {
|
|
|
2776
3063
|
try {
|
|
2777
3064
|
response = await fetchImpl(mintUrl, {
|
|
2778
3065
|
method: "POST",
|
|
2779
|
-
headers:
|
|
2780
|
-
signal: _optionalChain([controller, 'optionalAccess',
|
|
3066
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
3067
|
+
signal: _optionalChain([controller, 'optionalAccess', _173 => _173.signal])
|
|
2781
3068
|
});
|
|
2782
|
-
} catch (
|
|
3069
|
+
} catch (e8) {
|
|
2783
3070
|
if (urgency !== DISMISSAL) {
|
|
2784
3071
|
mintFailures += 1;
|
|
2785
3072
|
mintBackoffUntil = now() + backoff(mintFailures);
|
|
@@ -2807,7 +3094,7 @@ function createIngestTransport(options) {
|
|
|
2807
3094
|
token = { value, expiresAt };
|
|
2808
3095
|
mintFailures = 0;
|
|
2809
3096
|
mintBackoffUntil = 0;
|
|
2810
|
-
} catch (
|
|
3097
|
+
} catch (e9) {
|
|
2811
3098
|
mintUnavailable = true;
|
|
2812
3099
|
report("token_unavailable", response.status);
|
|
2813
3100
|
}
|
|
@@ -2847,7 +3134,7 @@ function createIngestTransport(options) {
|
|
|
2847
3134
|
body: bodyOf(batch),
|
|
2848
3135
|
keepalive: true
|
|
2849
3136
|
});
|
|
2850
|
-
} catch (
|
|
3137
|
+
} catch (e10) {
|
|
2851
3138
|
if (terminal || attempt >= MAX_ATTEMPTS) {
|
|
2852
3139
|
return drop(batch, "network");
|
|
2853
3140
|
}
|
|
@@ -2952,7 +3239,7 @@ function createIngestTransport(options) {
|
|
|
2952
3239
|
}
|
|
2953
3240
|
},
|
|
2954
3241
|
flush(flushOptions) {
|
|
2955
|
-
const dismissal = _nullishCoalesce(_optionalChain([flushOptions, 'optionalAccess',
|
|
3242
|
+
const dismissal = _nullishCoalesce(_optionalChain([flushOptions, 'optionalAccess', _174 => _174.terminal]), () => ( false));
|
|
2956
3243
|
if (disposed && !dismissal) return;
|
|
2957
3244
|
clearFlushTimer();
|
|
2958
3245
|
void run(dismissal ? DISMISSAL : IDLE);
|
|
@@ -2967,11 +3254,11 @@ function createIngestTransport(options) {
|
|
|
2967
3254
|
};
|
|
2968
3255
|
}
|
|
2969
3256
|
function randomUuid() {
|
|
2970
|
-
if (typeof _optionalChain([globalThis, 'access',
|
|
3257
|
+
if (typeof _optionalChain([globalThis, 'access', _175 => _175.crypto, 'optionalAccess', _176 => _176.randomUUID]) === "function") {
|
|
2971
3258
|
return globalThis.crypto.randomUUID();
|
|
2972
3259
|
}
|
|
2973
3260
|
const bytes = new Uint8Array(16);
|
|
2974
|
-
_optionalChain([globalThis, 'access',
|
|
3261
|
+
_optionalChain([globalThis, 'access', _177 => _177.crypto, 'optionalAccess', _178 => _178.getRandomValues, 'optionalCall', _179 => _179(bytes)]);
|
|
2975
3262
|
if (!bytes.some(Boolean)) {
|
|
2976
3263
|
for (let index = 0; index < bytes.length; index += 1) {
|
|
2977
3264
|
bytes[index] = Math.floor(Math.random() * 256);
|
|
@@ -2985,9 +3272,9 @@ function randomUuid() {
|
|
|
2985
3272
|
function resolveProxyOrigin(backendUrl) {
|
|
2986
3273
|
if (!backendUrl.trim()) return null;
|
|
2987
3274
|
try {
|
|
2988
|
-
const { origin } = new URL(backendUrl, _optionalChain([globalThis, 'access',
|
|
3275
|
+
const { origin } = new URL(backendUrl, _optionalChain([globalThis, 'access', _180 => _180.location, 'optionalAccess', _181 => _181.href]));
|
|
2989
3276
|
return origin.startsWith("http") ? origin : null;
|
|
2990
|
-
} catch (
|
|
3277
|
+
} catch (e11) {
|
|
2991
3278
|
return null;
|
|
2992
3279
|
}
|
|
2993
3280
|
}
|
|
@@ -3037,13 +3324,13 @@ function AnalyticsSession(props) {
|
|
|
3037
3324
|
type: "analytics_ingest_failure",
|
|
3038
3325
|
session_id: sessionIdRef.current,
|
|
3039
3326
|
modal,
|
|
3040
|
-
widget_version:
|
|
3327
|
+
widget_version: _chunkEKFXUF5Acjs.MODAL_VERSION,
|
|
3041
3328
|
timestamp: nowRef.current().toISOString(),
|
|
3042
3329
|
reason,
|
|
3043
3330
|
...status === void 0 ? {} : { status },
|
|
3044
3331
|
dropped_events: droppedEvents
|
|
3045
3332
|
};
|
|
3046
|
-
_optionalChain([onEventRef, 'access',
|
|
3333
|
+
_optionalChain([onEventRef, 'access', _182 => _182.current, 'optionalCall', _183 => _183(event)]);
|
|
3047
3334
|
},
|
|
3048
3335
|
[modal]
|
|
3049
3336
|
);
|
|
@@ -3065,7 +3352,7 @@ function AnalyticsSession(props) {
|
|
|
3065
3352
|
proxyOrigin,
|
|
3066
3353
|
sessionId: sessionIdRef.current,
|
|
3067
3354
|
modal,
|
|
3068
|
-
widgetVersion:
|
|
3355
|
+
widgetVersion: _chunkEKFXUF5Acjs.MODAL_VERSION,
|
|
3069
3356
|
sessionProperties: sessionPropertiesRef.current,
|
|
3070
3357
|
onFailure: (failure) => emitFailure(failure),
|
|
3071
3358
|
fetchImpl: props.fetchImpl,
|
|
@@ -3082,10 +3369,10 @@ function AnalyticsSession(props) {
|
|
|
3082
3369
|
const enqueue = _react.useCallback.call(void 0,
|
|
3083
3370
|
(event) => {
|
|
3084
3371
|
try {
|
|
3085
|
-
_optionalChain([ingestRef, 'access',
|
|
3372
|
+
_optionalChain([ingestRef, 'access', _184 => _184.current, 'optionalAccess', _185 => _185.transport, 'optionalAccess', _186 => _186.enqueue, 'call', _187 => _187(
|
|
3086
3373
|
event
|
|
3087
3374
|
)]);
|
|
3088
|
-
} catch (
|
|
3375
|
+
} catch (e12) {
|
|
3089
3376
|
}
|
|
3090
3377
|
},
|
|
3091
3378
|
[]
|
|
@@ -3121,12 +3408,12 @@ function AnalyticsSession(props) {
|
|
|
3121
3408
|
...payload,
|
|
3122
3409
|
session_id: sessionIdRef.current,
|
|
3123
3410
|
modal,
|
|
3124
|
-
widget_version:
|
|
3411
|
+
widget_version: _chunkEKFXUF5Acjs.MODAL_VERSION,
|
|
3125
3412
|
timestamp: nowRef.current().toISOString(),
|
|
3126
3413
|
session_properties: sessionPropertiesRef.current,
|
|
3127
3414
|
funding_method: fundingMethod
|
|
3128
3415
|
};
|
|
3129
|
-
_optionalChain([onEventRef, 'access',
|
|
3416
|
+
_optionalChain([onEventRef, 'access', _188 => _188.current, 'optionalCall', _189 => _189(
|
|
3130
3417
|
event
|
|
3131
3418
|
)]);
|
|
3132
3419
|
enqueue(event);
|
|
@@ -3140,11 +3427,11 @@ function AnalyticsSession(props) {
|
|
|
3140
3427
|
...payload,
|
|
3141
3428
|
session_id: sessionIdRef.current,
|
|
3142
3429
|
modal,
|
|
3143
|
-
widget_version:
|
|
3430
|
+
widget_version: _chunkEKFXUF5Acjs.MODAL_VERSION,
|
|
3144
3431
|
timestamp: nowRef.current().toISOString(),
|
|
3145
3432
|
session_properties: sessionPropertiesRef.current
|
|
3146
3433
|
};
|
|
3147
|
-
_optionalChain([onEventRef, 'access',
|
|
3434
|
+
_optionalChain([onEventRef, 'access', _190 => _190.current, 'optionalCall', _191 => _191(event)]);
|
|
3148
3435
|
enqueue(event);
|
|
3149
3436
|
},
|
|
3150
3437
|
[enqueue, modal, nowRef, onEventRef]
|
|
@@ -3156,11 +3443,11 @@ function AnalyticsSession(props) {
|
|
|
3156
3443
|
...payload,
|
|
3157
3444
|
session_id: sessionIdRef.current,
|
|
3158
3445
|
modal,
|
|
3159
|
-
widget_version:
|
|
3446
|
+
widget_version: _chunkEKFXUF5Acjs.MODAL_VERSION,
|
|
3160
3447
|
timestamp: nowRef.current().toISOString(),
|
|
3161
3448
|
session_properties: sessionPropertiesRef.current
|
|
3162
3449
|
};
|
|
3163
|
-
_optionalChain([onEventRef, 'access',
|
|
3450
|
+
_optionalChain([onEventRef, 'access', _192 => _192.current, 'optionalCall', _193 => _193(event)]);
|
|
3164
3451
|
enqueue(event);
|
|
3165
3452
|
},
|
|
3166
3453
|
[enqueue, modal, nowRef, onEventRef]
|
|
@@ -3191,7 +3478,7 @@ function useClaimAnalyticsEmitter() {
|
|
|
3191
3478
|
|
|
3192
3479
|
var RECOVERABLE_STATUSES = /* @__PURE__ */ new Set(["failed", "rejected"]);
|
|
3193
3480
|
function recoverySigningChainId(row) {
|
|
3194
|
-
return
|
|
3481
|
+
return _chunkFKJ6EJHHcjs.parseEvmChainId.call(void 0, row.targetChain);
|
|
3195
3482
|
}
|
|
3196
3483
|
function sourceDepositTxHash(row) {
|
|
3197
3484
|
return _nullishCoalesce(row.sourceTxHash, () => ( row.txHash));
|
|
@@ -3199,7 +3486,7 @@ function sourceDepositTxHash(row) {
|
|
|
3199
3486
|
function toRecoverableDeposit(row, options = {}) {
|
|
3200
3487
|
if (!row.id) return null;
|
|
3201
3488
|
if (!RECOVERABLE_STATUSES.has((_nullishCoalesce(row.status, () => ( ""))).toLowerCase())) return null;
|
|
3202
|
-
const sourceChainId =
|
|
3489
|
+
const sourceChainId = _chunkFKJ6EJHHcjs.parseEvmChainId.call(void 0, row.chain);
|
|
3203
3490
|
const targetChainId = recoverySigningChainId(row);
|
|
3204
3491
|
if (sourceChainId === null || targetChainId === null) return null;
|
|
3205
3492
|
const signer = row.recipient;
|
|
@@ -3210,7 +3497,6 @@ function toRecoverableDeposit(row, options = {}) {
|
|
|
3210
3497
|
return {
|
|
3211
3498
|
depositId: row.id,
|
|
3212
3499
|
signer,
|
|
3213
|
-
destinationPrefill: signer,
|
|
3214
3500
|
depositAddress: row.depositAddress,
|
|
3215
3501
|
sourceChainId,
|
|
3216
3502
|
targetChainId,
|
|
@@ -3220,7 +3506,7 @@ function toRecoverableDeposit(row, options = {}) {
|
|
|
3220
3506
|
};
|
|
3221
3507
|
}
|
|
3222
3508
|
function isDepositSelfDestination(row, destination) {
|
|
3223
|
-
const depositAddress = _optionalChain([row, 'access',
|
|
3509
|
+
const depositAddress = _optionalChain([row, 'access', _194 => _194.depositAddress, 'optionalAccess', _195 => _195.trim, 'call', _196 => _196()]);
|
|
3224
3510
|
const candidate = destination.trim();
|
|
3225
3511
|
if (!depositAddress || !candidate) return false;
|
|
3226
3512
|
return depositAddress.toLowerCase() === candidate.toLowerCase();
|
|
@@ -3273,7 +3559,7 @@ var STATUS_LABEL = {
|
|
|
3273
3559
|
};
|
|
3274
3560
|
function filterVisibleDeposits(deposits) {
|
|
3275
3561
|
const sourceHashes = new Set(
|
|
3276
|
-
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))
|
|
3277
3563
|
);
|
|
3278
3564
|
return deposits.filter(
|
|
3279
3565
|
(d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
|
|
@@ -3326,22 +3612,23 @@ function historyBadgeAriaLabel(badge) {
|
|
|
3326
3612
|
function HistoryEntryButton({
|
|
3327
3613
|
badge,
|
|
3328
3614
|
onClick,
|
|
3329
|
-
disabled
|
|
3615
|
+
disabled,
|
|
3616
|
+
unread = false
|
|
3330
3617
|
}) {
|
|
3331
3618
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3332
3619
|
"button",
|
|
3333
3620
|
{
|
|
3334
3621
|
type: "button",
|
|
3335
3622
|
className: "rs-modal-header-history",
|
|
3336
|
-
"aria-label": historyBadgeAriaLabel(badge),
|
|
3623
|
+
"aria-label": unread ? "Deposit history \u2014 new bank transfer activity" : historyBadgeAriaLabel(badge),
|
|
3337
3624
|
onClick,
|
|
3338
3625
|
disabled,
|
|
3339
3626
|
children: [
|
|
3340
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, HistoryIcon, {}),
|
|
3341
|
-
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,
|
|
3342
3629
|
"span",
|
|
3343
3630
|
{
|
|
3344
|
-
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"))}`,
|
|
3345
3632
|
"aria-hidden": "true"
|
|
3346
3633
|
}
|
|
3347
3634
|
)
|
|
@@ -3372,7 +3659,7 @@ function preconnectIconCdn() {
|
|
|
3372
3659
|
const link = document.createElement("link");
|
|
3373
3660
|
link.id = "rs-icon-cdn-preconnect";
|
|
3374
3661
|
link.rel = "preconnect";
|
|
3375
|
-
link.href =
|
|
3662
|
+
link.href = _chunkFKJ6EJHHcjs.ICON_CDN;
|
|
3376
3663
|
link.crossOrigin = "anonymous";
|
|
3377
3664
|
document.head.appendChild(link);
|
|
3378
3665
|
}
|
|
@@ -3384,89 +3671,32 @@ function CdnIcon({
|
|
|
3384
3671
|
fallback,
|
|
3385
3672
|
loading = "eager"
|
|
3386
3673
|
}) {
|
|
3387
|
-
const [loadedSrc, setLoadedSrc] = _react.useState.call(void 0, null);
|
|
3388
|
-
const [erroredSrc, setErroredSrc] = _react.useState.call(void 0, null);
|
|
3389
|
-
if (!src || erroredSrc === src) {
|
|
3390
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: fallback });
|
|
3391
|
-
}
|
|
3392
|
-
const isLoading = loadedSrc !== src;
|
|
3393
|
-
const settleIfAlreadyComplete = (el) => {
|
|
3394
|
-
if (_optionalChain([el, 'optionalAccess',
|
|
3395
|
-
};
|
|
3396
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3397
|
-
"img",
|
|
3398
|
-
{
|
|
3399
|
-
ref: settleIfAlreadyComplete,
|
|
3400
|
-
src,
|
|
3401
|
-
alt,
|
|
3402
|
-
className: `rs-cdn-icon ${_nullishCoalesce(className, () => ( ""))}`.trimEnd(),
|
|
3403
|
-
loading,
|
|
3404
|
-
decoding: "async",
|
|
3405
|
-
"data-loading": isLoading ? "" : void 0,
|
|
3406
|
-
onLoad: () => setLoadedSrc(src),
|
|
3407
|
-
onError: () => setErroredSrc(src)
|
|
3408
|
-
},
|
|
3409
|
-
src
|
|
3410
|
-
);
|
|
3411
|
-
}
|
|
3412
|
-
CdnIcon.displayName = "CdnIcon";
|
|
3413
|
-
|
|
3414
|
-
// src/components/ui/BodyHeader.tsx
|
|
3415
|
-
|
|
3416
|
-
function BodyHeader({
|
|
3417
|
-
icon,
|
|
3418
|
-
title,
|
|
3419
|
-
subtitle,
|
|
3420
|
-
variant = "default",
|
|
3421
|
-
aside
|
|
3422
|
-
}) {
|
|
3423
|
-
const iconClasses = [
|
|
3424
|
-
"rs-body-header-icon",
|
|
3425
|
-
variant === "success" ? "rs-body-header-icon--success" : "",
|
|
3426
|
-
variant === "error" ? "rs-body-header-icon--error" : ""
|
|
3427
|
-
].filter(Boolean).join(" ");
|
|
3428
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header", children: [
|
|
3429
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: iconClasses, children: icon }),
|
|
3430
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header-main", children: [
|
|
3431
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header-text", children: [
|
|
3432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "rs-body-header-title", children: title }),
|
|
3433
|
-
subtitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "rs-body-header-subtitle", children: subtitle })
|
|
3434
|
-
] }),
|
|
3435
|
-
aside && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-body-header-aside", children: aside })
|
|
3436
|
-
] })
|
|
3437
|
-
] });
|
|
3438
|
-
}
|
|
3439
|
-
BodyHeader.displayName = "BodyHeader";
|
|
3440
|
-
|
|
3441
|
-
// src/components/ui/Spinner.tsx
|
|
3442
|
-
|
|
3443
|
-
function Spinner({ className }) {
|
|
3444
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3445
|
-
"svg",
|
|
3446
|
-
{
|
|
3447
|
-
className: `rs-spinner ${className || ""}`,
|
|
3448
|
-
fill: "none",
|
|
3449
|
-
viewBox: "0 0 20 21",
|
|
3450
|
-
children: [
|
|
3451
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3452
|
-
"path",
|
|
3453
|
-
{
|
|
3454
|
-
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",
|
|
3455
|
-
fill: "currentColor",
|
|
3456
|
-
opacity: 0.3
|
|
3457
|
-
}
|
|
3458
|
-
),
|
|
3459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3460
|
-
"path",
|
|
3461
|
-
{
|
|
3462
|
-
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",
|
|
3463
|
-
fill: "currentColor"
|
|
3464
|
-
}
|
|
3465
|
-
)
|
|
3466
|
-
]
|
|
3467
|
-
}
|
|
3674
|
+
const [loadedSrc, setLoadedSrc] = _react.useState.call(void 0, null);
|
|
3675
|
+
const [erroredSrc, setErroredSrc] = _react.useState.call(void 0, null);
|
|
3676
|
+
if (!src || erroredSrc === src) {
|
|
3677
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: fallback });
|
|
3678
|
+
}
|
|
3679
|
+
const isLoading = loadedSrc !== src;
|
|
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
|
|
3468
3697
|
);
|
|
3469
3698
|
}
|
|
3699
|
+
CdnIcon.displayName = "CdnIcon";
|
|
3470
3700
|
|
|
3471
3701
|
// src/components/ui/Button.tsx
|
|
3472
3702
|
|
|
@@ -3497,11 +3727,11 @@ function Button({
|
|
|
3497
3727
|
"aria-busy": loading || void 0,
|
|
3498
3728
|
...props,
|
|
3499
3729
|
children: showInlineLoadingText ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-button__loading-row", children: [
|
|
3500
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { className: "rs-spinner--sm" }),
|
|
3730
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.Spinner, { className: "rs-spinner--sm" }),
|
|
3501
3731
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: loadingText })
|
|
3502
3732
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3503
3733
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: loading ? "rs-button__content--hidden" : "", children }),
|
|
3504
|
-
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" }) })
|
|
3505
3735
|
] })
|
|
3506
3736
|
}
|
|
3507
3737
|
);
|
|
@@ -3540,7 +3770,7 @@ function Callout({ variant = "error", children, role }) {
|
|
|
3540
3770
|
className: `rs-callout rs-callout--${variant}`,
|
|
3541
3771
|
role: _nullishCoalesce(role, () => ( (variant === "error" ? "alert" : "status"))),
|
|
3542
3772
|
children: [
|
|
3543
|
-
/* @__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, {}) }),
|
|
3544
3774
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-callout-text", children })
|
|
3545
3775
|
]
|
|
3546
3776
|
}
|
|
@@ -3619,15 +3849,257 @@ function PoweredBy() {
|
|
|
3619
3849
|
}
|
|
3620
3850
|
PoweredBy.displayName = "PoweredBy";
|
|
3621
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
|
+
|
|
3622
4080
|
// src/components/ui/TokenIcon.tsx
|
|
3623
4081
|
|
|
3624
|
-
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
|
+
}
|
|
3625
4097
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3626
4098
|
CdnIcon,
|
|
3627
4099
|
{
|
|
3628
|
-
src:
|
|
3629
|
-
className:
|
|
3630
|
-
fallback
|
|
4100
|
+
src: _optionalChain([entry, 'optionalAccess', _215 => _215.status]) === "ready" ? entry.logo : void 0,
|
|
4101
|
+
className: classes,
|
|
4102
|
+
fallback: badge
|
|
3631
4103
|
}
|
|
3632
4104
|
);
|
|
3633
4105
|
}
|
|
@@ -3707,6 +4179,82 @@ function resolveHistoryTiming({
|
|
|
3707
4179
|
};
|
|
3708
4180
|
}
|
|
3709
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
|
+
|
|
3710
4258
|
// src/components/history/DepositHistoryPanel.tsx
|
|
3711
4259
|
|
|
3712
4260
|
var MAX_TIMER_DELAY_MS = 2147e6;
|
|
@@ -3723,64 +4271,12 @@ function formatDate(iso) {
|
|
|
3723
4271
|
month: "short",
|
|
3724
4272
|
year: "numeric"
|
|
3725
4273
|
});
|
|
3726
|
-
} catch (
|
|
4274
|
+
} catch (e14) {
|
|
3727
4275
|
return iso;
|
|
3728
4276
|
}
|
|
3729
4277
|
}
|
|
3730
|
-
function
|
|
3731
|
-
if (
|
|
3732
|
-
if (typeof value === "number") return value;
|
|
3733
|
-
const display = _chunkOY5N3E6Lcjs.displayChainIdForCaip2.call(void 0, value);
|
|
3734
|
-
if (display !== null) return display;
|
|
3735
|
-
if (value === "solana" || value === "hypercore") return value;
|
|
3736
|
-
const num = Number(value);
|
|
3737
|
-
return Number.isFinite(num) ? num : null;
|
|
3738
|
-
}
|
|
3739
|
-
function resolveTokenSymbol(token, chainId) {
|
|
3740
|
-
if (!token) return "";
|
|
3741
|
-
if (chainId === "solana") {
|
|
3742
|
-
const normalized = token.toLowerCase();
|
|
3743
|
-
const matched = _chunkOY5N3E6Lcjs.SOLANA_TOKENS.find(
|
|
3744
|
-
(entry) => entry.mint.toLowerCase() === normalized
|
|
3745
|
-
);
|
|
3746
|
-
if (matched) return matched.symbol;
|
|
3747
|
-
if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
|
|
3748
|
-
return "SOL";
|
|
3749
|
-
}
|
|
3750
|
-
}
|
|
3751
|
-
if (chainId !== null && chainId !== void 0 && chainId !== "solana" && // Both callers pass the SOURCE chain, and `/chains` reports
|
|
3752
|
-
// `deposit: false` for Tron and Stellar — so neither can appear here, and
|
|
3753
|
-
// neither has an EVM token table to look one up in if it did.
|
|
3754
|
-
chainId !== "tron" && chainId !== "stellar" && /^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
3755
|
-
const evmChainId = chainId === "hypercore" ? _chunkOY5N3E6Lcjs.HYPERCORE_CHAIN_ID : chainId;
|
|
3756
|
-
const sym = _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, token, evmChainId);
|
|
3757
|
-
if (sym !== "Token") return sym;
|
|
3758
|
-
}
|
|
3759
|
-
return shortenHash(token);
|
|
3760
|
-
}
|
|
3761
|
-
function formatAmount(rawAmount, token, chainId) {
|
|
3762
|
-
if (!rawAmount) return "";
|
|
3763
|
-
let decimals = 18;
|
|
3764
|
-
if (token && chainId !== null && chainId !== void 0) {
|
|
3765
|
-
if (chainId === "solana") {
|
|
3766
|
-
const normalized = token.toLowerCase();
|
|
3767
|
-
const matched = _chunkOY5N3E6Lcjs.SOLANA_TOKENS.find(
|
|
3768
|
-
(entry) => entry.mint.toLowerCase() === normalized
|
|
3769
|
-
);
|
|
3770
|
-
if (matched) {
|
|
3771
|
-
decimals = matched.decimals;
|
|
3772
|
-
} else if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
|
|
3773
|
-
decimals = 9;
|
|
3774
|
-
}
|
|
3775
|
-
} else if (
|
|
3776
|
-
// See `resolveTokenSymbol`: this reads the source chain, which Tron and
|
|
3777
|
-
// Stellar cannot be.
|
|
3778
|
-
chainId !== "tron" && chainId !== "stellar" && /^0x[a-fA-F0-9]{40}$/.test(token)
|
|
3779
|
-
) {
|
|
3780
|
-
const evmChainId = chainId === "hypercore" ? _chunkOY5N3E6Lcjs.HYPERCORE_CHAIN_ID : chainId;
|
|
3781
|
-
decimals = _chunkOY5N3E6Lcjs.getTokenDecimalsByAddress.call(void 0, token, evmChainId);
|
|
3782
|
-
}
|
|
3783
|
-
}
|
|
4278
|
+
function formatAmount(rawAmount, decimals) {
|
|
4279
|
+
if (!rawAmount || decimals === void 0) return null;
|
|
3784
4280
|
try {
|
|
3785
4281
|
const raw = BigInt(rawAmount);
|
|
3786
4282
|
const divisor = 10n ** BigInt(decimals);
|
|
@@ -3790,11 +4286,13 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
3790
4286
|
let frac = fracStr.slice(0, 5).replace(/0+$/, "");
|
|
3791
4287
|
if (frac.length < 2) frac = frac.padEnd(2, "0");
|
|
3792
4288
|
return `${whole}.${frac}`;
|
|
3793
|
-
} catch (
|
|
4289
|
+
} catch (e15) {
|
|
3794
4290
|
return rawAmount;
|
|
3795
4291
|
}
|
|
3796
4292
|
}
|
|
3797
4293
|
function DepositHistoryPanel({
|
|
4294
|
+
bankHistory,
|
|
4295
|
+
bankSupportUrl,
|
|
3798
4296
|
deposits,
|
|
3799
4297
|
isLoading,
|
|
3800
4298
|
error,
|
|
@@ -3813,7 +4311,7 @@ function DepositHistoryPanel({
|
|
|
3813
4311
|
}) {
|
|
3814
4312
|
const rootRef = _react.useRef.call(void 0, null);
|
|
3815
4313
|
_react.useEffect.call(void 0, () => {
|
|
3816
|
-
_optionalChain([rootRef, 'access',
|
|
4314
|
+
_optionalChain([rootRef, 'access', _239 => _239.current, 'optionalAccess', _240 => _240.toggleAttribute, 'call', _241 => _241("inert", Boolean(obscured))]);
|
|
3817
4315
|
}, [obscured]);
|
|
3818
4316
|
const handleKeyDown = _react.useCallback.call(void 0,
|
|
3819
4317
|
(e) => {
|
|
@@ -3847,7 +4345,7 @@ function DepositHistoryPanel({
|
|
|
3847
4345
|
_react.useEffect.call(void 0, () => {
|
|
3848
4346
|
const nextBoundary = timingPresentations.reduce(
|
|
3849
4347
|
(earliest, presentation) => {
|
|
3850
|
-
const next = _optionalChain([presentation, 'optionalAccess',
|
|
4348
|
+
const next = _optionalChain([presentation, 'optionalAccess', _242 => _242.nextTransitionAtMs]);
|
|
3851
4349
|
if (next === void 0) return earliest;
|
|
3852
4350
|
return earliest === void 0 || next < earliest ? next : earliest;
|
|
3853
4351
|
},
|
|
@@ -3890,7 +4388,7 @@ function DepositHistoryPanel({
|
|
|
3890
4388
|
"aria-label": backLabel ? `Back to ${backLabel.toLowerCase()}` : "Back",
|
|
3891
4389
|
onClick: onClose,
|
|
3892
4390
|
children: [
|
|
3893
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronLeftIcon, {}),
|
|
4391
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronLeftIcon, {}),
|
|
3894
4392
|
backLabel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: backLabel })
|
|
3895
4393
|
]
|
|
3896
4394
|
}
|
|
@@ -3902,13 +4400,13 @@ function DepositHistoryPanel({
|
|
|
3902
4400
|
className: "rs-modal-close",
|
|
3903
4401
|
"aria-label": "Close",
|
|
3904
4402
|
onClick: onCloseModal,
|
|
3905
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CloseIcon, {})
|
|
4403
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CloseIcon, {})
|
|
3906
4404
|
}
|
|
3907
4405
|
) })
|
|
3908
4406
|
] }),
|
|
3909
4407
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen", children: [
|
|
3910
4408
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen-body", children: [
|
|
3911
|
-
/* @__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 }),
|
|
3912
4410
|
onFindByTxHash && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3913
4411
|
"button",
|
|
3914
4412
|
{
|
|
@@ -3921,40 +4419,82 @@ function DepositHistoryPanel({
|
|
|
3921
4419
|
]
|
|
3922
4420
|
}
|
|
3923
4421
|
),
|
|
3924
|
-
isLoading && deposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
3925
|
-
/* @__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, {}) }),
|
|
3926
4424
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
3927
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { className: "rs-spinner--sm" }),
|
|
4425
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.Spinner, { className: "rs-spinner--sm" }),
|
|
3928
4426
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
|
|
3929
4427
|
] })
|
|
3930
4428
|
] }),
|
|
3931
4429
|
error && !isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
3932
|
-
/* @__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, {}) }),
|
|
3933
4431
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
3934
4432
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
|
|
3935
4433
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: error })
|
|
3936
4434
|
] })
|
|
3937
4435
|
] }),
|
|
3938
|
-
|
|
3939
|
-
|
|
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, {}) }),
|
|
3940
4439
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
3941
4440
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "No deposits yet" }),
|
|
3942
4441
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
|
|
3943
4442
|
] })
|
|
3944
4443
|
] }),
|
|
3945
|
-
visibleDeposits.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-list", children: [
|
|
3946
|
-
|
|
3947
|
-
|
|
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",
|
|
3948
4490
|
{
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
deposit.txHash || i
|
|
3957
|
-
)),
|
|
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
|
+
),
|
|
3958
4498
|
hasMore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3959
4499
|
"button",
|
|
3960
4500
|
{
|
|
@@ -3981,27 +4521,27 @@ function HistoryCard({
|
|
|
3981
4521
|
onRecover,
|
|
3982
4522
|
onRowView
|
|
3983
4523
|
}) {
|
|
3984
|
-
const explorerTxUrl = useExplorerTxUrl();
|
|
3985
4524
|
const [expanded, setExpanded] = _react.useState.call(void 0, false);
|
|
3986
4525
|
const panelId = _react.useId.call(void 0, );
|
|
3987
4526
|
const status = normalizeStatus(deposit.status, deposit.isSpam);
|
|
3988
|
-
const sourceChainId =
|
|
3989
|
-
const targetChainId =
|
|
3990
|
-
const sourceChainName = sourceChainId ?
|
|
3991
|
-
const targetChainName = targetChainId ?
|
|
3992
|
-
const sourceChainIcon = sourceChainId ?
|
|
3993
|
-
const targetChainIcon = targetChainId ?
|
|
3994
|
-
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);
|
|
3995
4536
|
const rawAmount = deposit.sourceAmount && deposit.sourceAmount !== "0" ? deposit.sourceAmount : deposit.amount;
|
|
3996
|
-
const formattedAmount = rawAmount ? formatAmount(rawAmount,
|
|
4537
|
+
const formattedAmount = rawAmount ? formatAmount(rawAmount, tokenDisplay.decimals) : null;
|
|
3997
4538
|
const displayAmount = formattedAmount ? sourceSymbol && /^USD/.test(sourceSymbol) ? `$${Number(formattedAmount).toLocaleString("en-US", {
|
|
3998
4539
|
minimumFractionDigits: 2,
|
|
3999
4540
|
maximumFractionDigits: 2
|
|
4000
|
-
})}` : `${formattedAmount} ${sourceSymbol}` : "\u2014";
|
|
4541
|
+
})}` : `${formattedAmount} ${sourceSymbol}` : rawAmount && tokenDisplay.pending ? "\u2026" : "\u2014";
|
|
4001
4542
|
const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
|
|
4002
4543
|
const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
|
|
4003
4544
|
const srcTxHash = sourceChainId === "hypercore" ? deposit.txHash : deposit.sourceTxHash;
|
|
4004
|
-
const srcTxUrl = srcTxHash && sourceChainId ? explorerTxUrl(sourceChainId, srcTxHash) : null;
|
|
4005
4545
|
const eligible = toRecoverableDeposit(deposit, { recipient });
|
|
4006
4546
|
const recoverable = onRecover ? eligible : null;
|
|
4007
4547
|
const toggleExpanded = () => {
|
|
@@ -4009,7 +4549,7 @@ function HistoryCard({
|
|
|
4009
4549
|
setExpanded(next);
|
|
4010
4550
|
const depositId = _nullishCoalesce(deposit.id, () => ( deposit.txHash));
|
|
4011
4551
|
if (!next || !depositId) return;
|
|
4012
|
-
_optionalChain([onRowView, 'optionalCall',
|
|
4552
|
+
_optionalChain([onRowView, 'optionalCall', _258 => _258({
|
|
4013
4553
|
depositId,
|
|
4014
4554
|
status,
|
|
4015
4555
|
recoverable: eligible !== null,
|
|
@@ -4034,6 +4574,7 @@ function HistoryCard({
|
|
|
4034
4574
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-card-token", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4035
4575
|
TokenIcon,
|
|
4036
4576
|
{
|
|
4577
|
+
token: sourceChainId !== null && sourceToken ? { chain: sourceChainId, address: sourceToken } : void 0,
|
|
4037
4578
|
symbol: sourceSymbol,
|
|
4038
4579
|
fallback: sourceSymbol.slice(0, 2)
|
|
4039
4580
|
}
|
|
@@ -4067,22 +4608,7 @@ function HistoryCard({
|
|
|
4067
4608
|
targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CdnIcon, { src: targetChainIcon }) })
|
|
4068
4609
|
] })
|
|
4069
4610
|
] }),
|
|
4070
|
-
|
|
4071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Transaction details" }),
|
|
4072
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4073
|
-
"a",
|
|
4074
|
-
{
|
|
4075
|
-
href: srcTxUrl,
|
|
4076
|
-
target: "_blank",
|
|
4077
|
-
rel: "noopener noreferrer",
|
|
4078
|
-
className: "rs-history-card-link",
|
|
4079
|
-
children: [
|
|
4080
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: shortenHash(srcTxHash) }),
|
|
4081
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ArrowUpRightIcon, {})
|
|
4082
|
-
]
|
|
4083
|
-
}
|
|
4084
|
-
)
|
|
4085
|
-
] }),
|
|
4611
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, HistoryTransactionLink, { chainId: sourceChainId, txHash: srcTxHash }),
|
|
4086
4612
|
timing && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4087
4613
|
"span",
|
|
4088
4614
|
{
|
|
@@ -4096,7 +4622,7 @@ function HistoryCard({
|
|
|
4096
4622
|
recoverable && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4097
4623
|
Button,
|
|
4098
4624
|
{
|
|
4099
|
-
onClick: () => _optionalChain([onRecover, 'optionalCall',
|
|
4625
|
+
onClick: () => _optionalChain([onRecover, 'optionalCall', _259 => _259(recoverable)]),
|
|
4100
4626
|
fullWidth: true,
|
|
4101
4627
|
className: "rs-history-card-recover",
|
|
4102
4628
|
children: [
|
|
@@ -4104,7 +4630,7 @@ function HistoryCard({
|
|
|
4104
4630
|
"Recover ",
|
|
4105
4631
|
displayAmount
|
|
4106
4632
|
] }),
|
|
4107
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronRightIcon, {})
|
|
4633
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronRightIcon, {})
|
|
4108
4634
|
]
|
|
4109
4635
|
}
|
|
4110
4636
|
)
|
|
@@ -4154,14 +4680,14 @@ function ListRow({
|
|
|
4154
4680
|
}
|
|
4155
4681
|
) : meta && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list-row-meta", children: meta })
|
|
4156
4682
|
] }),
|
|
4157
|
-
/* @__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, {})))) })
|
|
4158
4684
|
] });
|
|
4159
4685
|
if (action) {
|
|
4160
4686
|
const handleKey = (e) => {
|
|
4161
4687
|
if (disabled) return;
|
|
4162
4688
|
if (e.key === "Enter" || e.key === " ") {
|
|
4163
4689
|
e.preventDefault();
|
|
4164
|
-
_optionalChain([onClick, 'optionalCall',
|
|
4690
|
+
_optionalChain([onClick, 'optionalCall', _260 => _260(e)]);
|
|
4165
4691
|
}
|
|
4166
4692
|
};
|
|
4167
4693
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -4171,7 +4697,7 @@ function ListRow({
|
|
|
4171
4697
|
role: "button",
|
|
4172
4698
|
tabIndex: disabled ? -1 : 0,
|
|
4173
4699
|
"aria-disabled": disabled || void 0,
|
|
4174
|
-
onClick: disabled ? void 0 : (e) => _optionalChain([onClick, 'optionalCall',
|
|
4700
|
+
onClick: disabled ? void 0 : (e) => _optionalChain([onClick, 'optionalCall', _261 => _261(e)]),
|
|
4175
4701
|
onKeyDown: handleKey,
|
|
4176
4702
|
children: inner
|
|
4177
4703
|
}
|
|
@@ -4211,7 +4737,7 @@ var Input = _react.forwardRef.call(void 0,
|
|
|
4211
4737
|
}
|
|
4212
4738
|
),
|
|
4213
4739
|
error ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "rs-input-error", children: [
|
|
4214
|
-
/* @__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" }),
|
|
4215
4741
|
error
|
|
4216
4742
|
] }) : hint && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "rs-input-hint", children: hint })
|
|
4217
4743
|
] });
|
|
@@ -4229,7 +4755,7 @@ var RECOVERY_LOOKUP_MISS_COPY = {
|
|
|
4229
4755
|
};
|
|
4230
4756
|
function classifyRecoveryLookup(rows, options = {}) {
|
|
4231
4757
|
const inScope = options.recipient ? rows.filter(
|
|
4232
|
-
(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()])
|
|
4233
4759
|
) : rows;
|
|
4234
4760
|
const eligible = inScope.map((row) => toRecoverableDeposit(row, options)).filter((deposit) => deposit !== null);
|
|
4235
4761
|
return {
|
|
@@ -4252,20 +4778,20 @@ function RecoveryLookupScreen({
|
|
|
4252
4778
|
onInvalid
|
|
4253
4779
|
}) {
|
|
4254
4780
|
const [txHash, setTxHash] = _react.useState.call(void 0, "");
|
|
4255
|
-
const onInvalidRef = useLatestRef(onInvalid);
|
|
4781
|
+
const onInvalidRef = _chunkG264OM23cjs.useLatestRef.call(void 0, onInvalid);
|
|
4256
4782
|
const trimmed = txHash.trim();
|
|
4257
4783
|
const valid = isRecoveryTxHash(trimmed);
|
|
4258
4784
|
_react.useEffect.call(void 0, () => {
|
|
4259
4785
|
if (trimmed.length > 0 && !valid) {
|
|
4260
|
-
_optionalChain([onInvalidRef, 'access',
|
|
4786
|
+
_optionalChain([onInvalidRef, 'access', _268 => _268.current, 'optionalCall', _269 => _269()]);
|
|
4261
4787
|
}
|
|
4262
4788
|
}, [trimmed, valid, onInvalidRef]);
|
|
4263
4789
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
4264
4790
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
4265
4791
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4266
|
-
BodyHeader,
|
|
4792
|
+
_chunkG264OM23cjs.BodyHeader,
|
|
4267
4793
|
{
|
|
4268
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HandCoinsIcon, {}),
|
|
4794
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.HandCoinsIcon, {}),
|
|
4269
4795
|
title,
|
|
4270
4796
|
subtitle
|
|
4271
4797
|
}
|
|
@@ -4319,43 +4845,12 @@ var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set([
|
|
|
4319
4845
|
"BUSD",
|
|
4320
4846
|
"USDE"
|
|
4321
4847
|
]);
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
if (token !== void 0) {
|
|
4325
|
-
if (chain === "solana") {
|
|
4326
|
-
const solanaToken = _chunkOY5N3E6Lcjs.getSolanaTokenByMint.call(void 0, token);
|
|
4327
|
-
if (solanaToken) {
|
|
4328
|
-
return { symbol: solanaToken.symbol, decimals: solanaToken.decimals };
|
|
4329
|
-
}
|
|
4330
|
-
} else if (chain === "hypercore") {
|
|
4331
|
-
const t = _chunkOY5N3E6Lcjs.HYPERCORE_SOURCE_TOKENS.find(
|
|
4332
|
-
(x) => x.address.toLowerCase() === token.toLowerCase()
|
|
4333
|
-
);
|
|
4334
|
-
if (t) return { symbol: t.symbol, decimals: t.decimals };
|
|
4335
|
-
} else if (chain === "tron" || chain === "stellar") {
|
|
4336
|
-
const published = _chunkOY5N3E6Lcjs.getRuntimeTokenByAddress.call(void 0, chain, token);
|
|
4337
|
-
if (published) {
|
|
4338
|
-
return { symbol: published.symbol, decimals: published.decimals };
|
|
4339
|
-
}
|
|
4340
|
-
} else if (EVM_ADDRESS_RE.test(token)) {
|
|
4341
|
-
const symbol = _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, token, chain);
|
|
4342
|
-
const decimals = _chunkOY5N3E6Lcjs.findTokenDecimals.call(void 0, token, chain);
|
|
4343
|
-
if (symbol !== "Token" || decimals !== void 0) {
|
|
4344
|
-
return {
|
|
4345
|
-
symbol: symbol !== "Token" ? symbol : _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _170 => _170.symbol]), () => ( symbol)),
|
|
4346
|
-
decimals: _nullishCoalesce(decimals, () => ( _optionalChain([fallback, 'optionalAccess', _171 => _171.decimals])))
|
|
4347
|
-
};
|
|
4348
|
-
}
|
|
4349
|
-
}
|
|
4350
|
-
}
|
|
4351
|
-
return {
|
|
4352
|
-
symbol: _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _172 => _172.symbol]), () => ( "Token")),
|
|
4353
|
-
decimals: _optionalChain([fallback, 'optionalAccess', _173 => _173.decimals])
|
|
4354
|
-
};
|
|
4848
|
+
function normalizeStableSymbol(symbol) {
|
|
4849
|
+
return symbol.trim().toUpperCase().replace(/₮/g, "T").replace(/\.E$/, "");
|
|
4355
4850
|
}
|
|
4356
4851
|
function maxFractionDigitsFor(symbol) {
|
|
4357
4852
|
if (!symbol) return 6;
|
|
4358
|
-
return STABLECOIN_SYMBOLS.has(symbol
|
|
4853
|
+
return STABLECOIN_SYMBOLS.has(normalizeStableSymbol(symbol)) ? 3 : 6;
|
|
4359
4854
|
}
|
|
4360
4855
|
function formatTokenAmount(amount, symbol) {
|
|
4361
4856
|
if (!Number.isFinite(amount)) return void 0;
|
|
@@ -4369,7 +4864,7 @@ function tokenAmountToNumber(rawAmount, decimals) {
|
|
|
4369
4864
|
try {
|
|
4370
4865
|
const value = Number(_viem.formatUnits.call(void 0, BigInt(rawAmount), decimals));
|
|
4371
4866
|
return Number.isFinite(value) ? value : void 0;
|
|
4372
|
-
} catch (
|
|
4867
|
+
} catch (e16) {
|
|
4373
4868
|
return void 0;
|
|
4374
4869
|
}
|
|
4375
4870
|
}
|
|
@@ -4379,26 +4874,13 @@ function formatRawTokenAmount(rawAmount, token) {
|
|
|
4379
4874
|
return formatTokenAmount(value, token.symbol);
|
|
4380
4875
|
}
|
|
4381
4876
|
function isDisplayStablecoinSymbol(symbol) {
|
|
4382
|
-
return symbol !== void 0 && STABLECOIN_SYMBOLS.has(symbol
|
|
4877
|
+
return symbol !== void 0 && STABLECOIN_SYMBOLS.has(normalizeStableSymbol(symbol));
|
|
4383
4878
|
}
|
|
4384
4879
|
function priceUsdFor(symbol, prices) {
|
|
4385
4880
|
if (!symbol) return void 0;
|
|
4386
4881
|
const quoted = prices[symbol.toUpperCase()];
|
|
4387
4882
|
return typeof quoted === "number" && quoted > 0 ? quoted : void 0;
|
|
4388
4883
|
}
|
|
4389
|
-
function isRecognizedToken(address, chain) {
|
|
4390
|
-
if (address === void 0 || chain === void 0) return false;
|
|
4391
|
-
if (chain === "solana") return _chunkOY5N3E6Lcjs.getSolanaTokenByMint.call(void 0, address) !== void 0;
|
|
4392
|
-
if (chain === "hypercore") {
|
|
4393
|
-
return _chunkOY5N3E6Lcjs.HYPERCORE_SOURCE_TOKENS.some(
|
|
4394
|
-
(t) => t.address.toLowerCase() === address.toLowerCase()
|
|
4395
|
-
);
|
|
4396
|
-
}
|
|
4397
|
-
if (chain === "tron" || chain === "stellar") {
|
|
4398
|
-
return _chunkOY5N3E6Lcjs.getRuntimeTokenByAddress.call(void 0, chain, address) !== void 0;
|
|
4399
|
-
}
|
|
4400
|
-
return EVM_ADDRESS_RE.test(address) && _chunkOY5N3E6Lcjs.isRegistryTokenOnChain.call(void 0, address, chain);
|
|
4401
|
-
}
|
|
4402
4884
|
function estimateReceiveAmount(params) {
|
|
4403
4885
|
const {
|
|
4404
4886
|
sourceAmount,
|
|
@@ -4427,7 +4909,7 @@ function formatQuotedReceive(output, fallbackSymbol) {
|
|
|
4427
4909
|
let raw;
|
|
4428
4910
|
try {
|
|
4429
4911
|
raw = BigInt(output.amount);
|
|
4430
|
-
} catch (
|
|
4912
|
+
} catch (e17) {
|
|
4431
4913
|
return void 0;
|
|
4432
4914
|
}
|
|
4433
4915
|
if (raw <= 0n) return void 0;
|
|
@@ -4450,27 +4932,21 @@ function formatReceiveEstimate(params) {
|
|
|
4450
4932
|
|
|
4451
4933
|
// src/components/recovery/recovery-display.ts
|
|
4452
4934
|
function describeRecoveryDeposit(params) {
|
|
4453
|
-
const token = _nullishCoalesce(params.token, () => ( "0x"));
|
|
4454
|
-
const decimals = _chunkOY5N3E6Lcjs.getTokenDecimalsByAddress.call(void 0, token, params.chainId);
|
|
4455
|
-
const symbol = _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, token, params.chainId);
|
|
4456
|
-
const raw = toBigInt(params.amountRaw);
|
|
4457
|
-
const human = Number(_viem.formatUnits.call(void 0, raw, decimals));
|
|
4458
4935
|
return {
|
|
4459
|
-
symbol,
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
chainName: _chunkOY5N3E6Lcjs.getChainName.call(void 0, params.chainId),
|
|
4463
|
-
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)
|
|
4464
4939
|
};
|
|
4465
4940
|
}
|
|
4466
4941
|
function formatRecoveryAmount(amountRaw, decimals, symbol) {
|
|
4942
|
+
if (decimals === void 0) return "\u2014";
|
|
4467
4943
|
const raw = toBigInt(amountRaw);
|
|
4468
4944
|
return _nullishCoalesce(formatTokenAmount(Number(_viem.formatUnits.call(void 0, raw, decimals)), symbol), () => ( _viem.formatUnits.call(void 0, raw, decimals)));
|
|
4469
4945
|
}
|
|
4470
4946
|
function toBigInt(value) {
|
|
4471
4947
|
try {
|
|
4472
4948
|
return BigInt(value || "0");
|
|
4473
|
-
} catch (
|
|
4949
|
+
} catch (e18) {
|
|
4474
4950
|
return 0n;
|
|
4475
4951
|
}
|
|
4476
4952
|
}
|
|
@@ -4604,7 +5080,7 @@ async function submitSignedRecovery(params) {
|
|
|
4604
5080
|
// The shared const, so recovery carries `x-deposit-modal-version` like
|
|
4605
5081
|
// every other backend call. Without it this path would be invisible in the
|
|
4606
5082
|
// per-client version telemetry the processor records.
|
|
4607
|
-
headers:
|
|
5083
|
+
headers: _chunkEKFXUF5Acjs.serviceHeaders.call(void 0, ),
|
|
4608
5084
|
// `depositId` as a string: it is a uint256 upstream and JSON numbers lose
|
|
4609
5085
|
// precision well before that range.
|
|
4610
5086
|
body: JSON.stringify({ depositId, destination, signature })
|
|
@@ -5023,6 +5499,12 @@ function HistoryFallbackFlow({
|
|
|
5023
5499
|
},
|
|
5024
5500
|
[onBack]
|
|
5025
5501
|
);
|
|
5502
|
+
const matchDisplays = useTokenDisplays(
|
|
5503
|
+
(_nullishCoalesce(matches, () => ( []))).map((match) => ({
|
|
5504
|
+
chain: match.sourceChainId,
|
|
5505
|
+
address: match.token
|
|
5506
|
+
}))
|
|
5507
|
+
);
|
|
5026
5508
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
5027
5509
|
"div",
|
|
5028
5510
|
{
|
|
@@ -5040,7 +5522,7 @@ function HistoryFallbackFlow({
|
|
|
5040
5522
|
"aria-label": "Back to history",
|
|
5041
5523
|
onClick: () => onBack(),
|
|
5042
5524
|
children: [
|
|
5043
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronLeftIcon, {}),
|
|
5525
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronLeftIcon, {}),
|
|
5044
5526
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "History" })
|
|
5045
5527
|
]
|
|
5046
5528
|
}
|
|
@@ -5052,30 +5534,33 @@ function HistoryFallbackFlow({
|
|
|
5052
5534
|
className: "rs-modal-close",
|
|
5053
5535
|
"aria-label": "Close",
|
|
5054
5536
|
onClick: onCloseModal,
|
|
5055
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CloseIcon, {})
|
|
5537
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CloseIcon, {})
|
|
5056
5538
|
}
|
|
5057
5539
|
) })
|
|
5058
5540
|
] }),
|
|
5059
5541
|
matches ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
5060
5542
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5061
5543
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5062
|
-
BodyHeader,
|
|
5544
|
+
_chunkG264OM23cjs.BodyHeader,
|
|
5063
5545
|
{
|
|
5064
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CoinsIcon, {}),
|
|
5546
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CoinsIcon, {}),
|
|
5065
5547
|
title: "Select a deposit",
|
|
5066
5548
|
subtitle: "This transaction produced multiple deposits. Choose the one to recover."
|
|
5067
5549
|
}
|
|
5068
5550
|
),
|
|
5069
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list", children: matches.map((match) => {
|
|
5070
|
-
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({
|
|
5071
5555
|
chainId: match.sourceChainId,
|
|
5072
|
-
|
|
5073
|
-
|
|
5556
|
+
amountRaw: match.amountRaw,
|
|
5557
|
+
symbol,
|
|
5558
|
+
decimals: _optionalChain([display, 'optionalAccess', _271 => _271.decimals])
|
|
5074
5559
|
});
|
|
5075
5560
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5076
5561
|
ListRow,
|
|
5077
5562
|
{
|
|
5078
|
-
leadingMedia:
|
|
5563
|
+
leadingMedia: _optionalChain([display, 'optionalAccess', _272 => _272.logo]),
|
|
5079
5564
|
title: `${amount} ${symbol}`,
|
|
5080
5565
|
subtitle: chainName,
|
|
5081
5566
|
onClick: () => selectMatch(match)
|
|
@@ -5124,9 +5609,9 @@ function RecoveryOutcomeScreen({
|
|
|
5124
5609
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
5125
5610
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5126
5611
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5127
|
-
BodyHeader,
|
|
5612
|
+
_chunkG264OM23cjs.BodyHeader,
|
|
5128
5613
|
{
|
|
5129
|
-
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, {}),
|
|
5130
5615
|
variant: success ? "success" : "error",
|
|
5131
5616
|
title: success ? "Refund submitted" : "Refund failed",
|
|
5132
5617
|
subtitle: success ? "Your funds are being returned on the source chain." : void 0
|
|
@@ -5141,7 +5626,13 @@ function RecoveryOutcomeScreen({
|
|
|
5141
5626
|
" ",
|
|
5142
5627
|
result.symbol
|
|
5143
5628
|
] }),
|
|
5144
|
-
/* @__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
|
+
) })
|
|
5145
5636
|
] })
|
|
5146
5637
|
] }),
|
|
5147
5638
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -5159,7 +5650,7 @@ function RecoveryOutcomeScreen({
|
|
|
5159
5650
|
rel: "noreferrer",
|
|
5160
5651
|
children: [
|
|
5161
5652
|
shortenHash2(result.txHash),
|
|
5162
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {})
|
|
5653
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ExternalLinkIcon, {})
|
|
5163
5654
|
]
|
|
5164
5655
|
}
|
|
5165
5656
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: shortenHash2(result.txHash) })
|
|
@@ -5182,37 +5673,36 @@ function RecoveryReviewScreen({
|
|
|
5182
5673
|
amountRaw,
|
|
5183
5674
|
txHash,
|
|
5184
5675
|
defaultDestination,
|
|
5185
|
-
destinationHint,
|
|
5186
5676
|
depositAddress,
|
|
5187
5677
|
submitting,
|
|
5188
5678
|
onSubmit,
|
|
5189
5679
|
onDestinationInvalid,
|
|
5190
5680
|
onDestinationIsDepositAddress
|
|
5191
5681
|
}) {
|
|
5192
|
-
const { symbol,
|
|
5682
|
+
const { symbol, decimals } = useTokenDisplay(chainId, token);
|
|
5683
|
+
const { amount, chainName, chainIcon } = describeRecoveryDeposit({
|
|
5193
5684
|
chainId,
|
|
5194
|
-
|
|
5195
|
-
|
|
5685
|
+
amountRaw,
|
|
5686
|
+
symbol,
|
|
5687
|
+
decimals
|
|
5196
5688
|
});
|
|
5197
5689
|
const explorerTxUrl = useExplorerTxUrl();
|
|
5198
|
-
const [destination, setDestination] = _react.useState.call(void 0,
|
|
5199
|
-
_nullishCoalesce(defaultDestination, () => ( ""))
|
|
5200
|
-
);
|
|
5690
|
+
const [destination, setDestination] = _react.useState.call(void 0, _nullishCoalesce(defaultDestination, () => ( "")));
|
|
5201
5691
|
const isSelfDestination = isDepositSelfDestination(
|
|
5202
5692
|
{ depositAddress },
|
|
5203
5693
|
destination
|
|
5204
5694
|
);
|
|
5205
5695
|
const destinationValid = _viem.isAddress.call(void 0, destination) && !isSelfDestination;
|
|
5206
|
-
const onDestinationInvalidRef = useLatestRef(onDestinationInvalid);
|
|
5207
|
-
const onDestinationIsDepositAddressRef = useLatestRef(
|
|
5696
|
+
const onDestinationInvalidRef = _chunkG264OM23cjs.useLatestRef.call(void 0, onDestinationInvalid);
|
|
5697
|
+
const onDestinationIsDepositAddressRef = _chunkG264OM23cjs.useLatestRef.call(void 0,
|
|
5208
5698
|
onDestinationIsDepositAddress
|
|
5209
5699
|
);
|
|
5210
5700
|
_react.useEffect.call(void 0, () => {
|
|
5211
5701
|
if (destination.length === 0) return;
|
|
5212
5702
|
if (isSelfDestination) {
|
|
5213
|
-
_optionalChain([onDestinationIsDepositAddressRef, 'access',
|
|
5703
|
+
_optionalChain([onDestinationIsDepositAddressRef, 'access', _273 => _273.current, 'optionalCall', _274 => _274()]);
|
|
5214
5704
|
} else if (!destinationValid) {
|
|
5215
|
-
_optionalChain([onDestinationInvalidRef, 'access',
|
|
5705
|
+
_optionalChain([onDestinationInvalidRef, 'access', _275 => _275.current, 'optionalCall', _276 => _276()]);
|
|
5216
5706
|
}
|
|
5217
5707
|
}, [
|
|
5218
5708
|
destination,
|
|
@@ -5227,9 +5717,9 @@ function RecoveryReviewScreen({
|
|
|
5227
5717
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
5228
5718
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5229
5719
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5230
|
-
BodyHeader,
|
|
5720
|
+
_chunkG264OM23cjs.BodyHeader,
|
|
5231
5721
|
{
|
|
5232
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HandCoinsIcon, {}),
|
|
5722
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.HandCoinsIcon, {}),
|
|
5233
5723
|
title: "Review refund",
|
|
5234
5724
|
subtitle: "This returns the funds on the source chain. It does not retry the original deposit."
|
|
5235
5725
|
}
|
|
@@ -5243,7 +5733,13 @@ function RecoveryReviewScreen({
|
|
|
5243
5733
|
" ",
|
|
5244
5734
|
symbol
|
|
5245
5735
|
] }),
|
|
5246
|
-
/* @__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
|
+
) })
|
|
5247
5743
|
] })
|
|
5248
5744
|
] }),
|
|
5249
5745
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -5264,7 +5760,7 @@ function RecoveryReviewScreen({
|
|
|
5264
5760
|
rel: "noreferrer",
|
|
5265
5761
|
children: [
|
|
5266
5762
|
txShort,
|
|
5267
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {})
|
|
5763
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ExternalLinkIcon, {})
|
|
5268
5764
|
]
|
|
5269
5765
|
}
|
|
5270
5766
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: txShort })
|
|
@@ -5277,7 +5773,7 @@ function RecoveryReviewScreen({
|
|
|
5277
5773
|
placeholder: "0x\u2026",
|
|
5278
5774
|
value: destination,
|
|
5279
5775
|
onChange: (e) => setDestination(e.target.value),
|
|
5280
|
-
hint:
|
|
5776
|
+
hint: `An address you control on ${chainName}.`,
|
|
5281
5777
|
error: isSelfDestination ? selfDestinationError : destination.length > 0 && !destinationValid ? "Enter a valid address" : void 0
|
|
5282
5778
|
}
|
|
5283
5779
|
),
|
|
@@ -5316,6 +5812,7 @@ function HistoryRecoveryFlow({
|
|
|
5316
5812
|
const [outcome, setOutcome] = _react.useState.call(void 0, null);
|
|
5317
5813
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
5318
5814
|
const [retryable, setRetryable] = _react.useState.call(void 0, false);
|
|
5815
|
+
const [destination, setDestination] = _react.useState.call(void 0, );
|
|
5319
5816
|
const lastFailureRef = _react.useRef.call(void 0, null);
|
|
5320
5817
|
_react.useEffect.call(void 0, () => {
|
|
5321
5818
|
if (entrySource === "history_row") {
|
|
@@ -5327,13 +5824,13 @@ function HistoryRecoveryFlow({
|
|
|
5327
5824
|
}
|
|
5328
5825
|
analytics.openStep("review");
|
|
5329
5826
|
}, [analytics, deposit, entrySource]);
|
|
5330
|
-
const { symbol, decimals } =
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
});
|
|
5827
|
+
const { symbol, decimals } = useTokenDisplay(
|
|
5828
|
+
deposit.sourceChainId,
|
|
5829
|
+
deposit.token
|
|
5830
|
+
);
|
|
5335
5831
|
const submit = _react.useCallback.call(void 0,
|
|
5336
|
-
async (
|
|
5832
|
+
async (destination2) => {
|
|
5833
|
+
setDestination(destination2);
|
|
5337
5834
|
setPhase("submitting");
|
|
5338
5835
|
onSubmittingChange(true);
|
|
5339
5836
|
analytics.completeStep("review");
|
|
@@ -5346,14 +5843,14 @@ function HistoryRecoveryFlow({
|
|
|
5346
5843
|
chainId: deposit.targetChainId,
|
|
5347
5844
|
depositId: deposit.depositId,
|
|
5348
5845
|
signer: deposit.signer,
|
|
5349
|
-
destination,
|
|
5846
|
+
destination: destination2,
|
|
5350
5847
|
signRecovery,
|
|
5351
5848
|
debug
|
|
5352
5849
|
});
|
|
5353
5850
|
setOutcome({
|
|
5354
5851
|
// No destination to reconcile: it is inside the signed struct, so the
|
|
5355
5852
|
// processor cannot have paid anywhere else.
|
|
5356
|
-
destination,
|
|
5853
|
+
destination: destination2,
|
|
5357
5854
|
txHash: result.transactionHash,
|
|
5358
5855
|
symbol,
|
|
5359
5856
|
amountDisplay: formatRecoveryAmount(
|
|
@@ -5377,11 +5874,11 @@ function HistoryRecoveryFlow({
|
|
|
5377
5874
|
} catch (err) {
|
|
5378
5875
|
const recoveryError = err instanceof RecoveryError ? err : void 0;
|
|
5379
5876
|
setError(
|
|
5380
|
-
_nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess',
|
|
5877
|
+
_nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _277 => _277.message]), () => ( formatUserError(
|
|
5381
5878
|
err instanceof Error ? err.message : "Recovery failed"
|
|
5382
5879
|
)))
|
|
5383
5880
|
);
|
|
5384
|
-
const canRetry = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess',
|
|
5881
|
+
const canRetry = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _278 => _278.retryable]), () => ( true));
|
|
5385
5882
|
setRetryable(canRetry);
|
|
5386
5883
|
setPhase("failed");
|
|
5387
5884
|
const reason = claimFailureReasonForError(err);
|
|
@@ -5430,7 +5927,7 @@ function HistoryRecoveryFlow({
|
|
|
5430
5927
|
"aria-label": "Back to history",
|
|
5431
5928
|
onClick: onBack,
|
|
5432
5929
|
children: [
|
|
5433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronLeftIcon, {}),
|
|
5930
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronLeftIcon, {}),
|
|
5434
5931
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "History" })
|
|
5435
5932
|
]
|
|
5436
5933
|
}
|
|
@@ -5443,7 +5940,7 @@ function HistoryRecoveryFlow({
|
|
|
5443
5940
|
"aria-label": "Close",
|
|
5444
5941
|
onClick: onCloseModal,
|
|
5445
5942
|
disabled: submitting,
|
|
5446
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CloseIcon, {})
|
|
5943
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CloseIcon, {})
|
|
5447
5944
|
}
|
|
5448
5945
|
) })
|
|
5449
5946
|
] }),
|
|
@@ -5454,8 +5951,7 @@ function HistoryRecoveryFlow({
|
|
|
5454
5951
|
token: deposit.token,
|
|
5455
5952
|
amountRaw: deposit.amountRaw,
|
|
5456
5953
|
txHash: deposit.sourceTxHash,
|
|
5457
|
-
defaultDestination:
|
|
5458
|
-
destinationHint: "Prefilled with the account this deposit was for. Editable.",
|
|
5954
|
+
defaultDestination: destination,
|
|
5459
5955
|
depositAddress: deposit.depositAddress,
|
|
5460
5956
|
submitting,
|
|
5461
5957
|
onSubmit: submit,
|
|
@@ -5469,7 +5965,11 @@ function HistoryRecoveryFlow({
|
|
|
5469
5965
|
phase === "success" && outcome && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5470
5966
|
RecoveryOutcomeScreen,
|
|
5471
5967
|
{
|
|
5472
|
-
result: {
|
|
5968
|
+
result: {
|
|
5969
|
+
...outcome,
|
|
5970
|
+
chainId: deposit.sourceChainId,
|
|
5971
|
+
token: deposit.token
|
|
5972
|
+
},
|
|
5473
5973
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "outline", onClick: onBack, fullWidth: true, children: "Back to history" })
|
|
5474
5974
|
}
|
|
5475
5975
|
),
|
|
@@ -5487,6 +5987,8 @@ HistoryRecoveryFlow.displayName = "HistoryRecoveryFlow";
|
|
|
5487
5987
|
|
|
5488
5988
|
function HistoryOverlay({
|
|
5489
5989
|
controller,
|
|
5990
|
+
bankHistory,
|
|
5991
|
+
bankSupportUrl,
|
|
5490
5992
|
backLabel,
|
|
5491
5993
|
title,
|
|
5492
5994
|
recipient,
|
|
@@ -5527,8 +6029,8 @@ function HistoryOverlay({
|
|
|
5527
6029
|
const endAttempt = _react.useCallback.call(void 0,
|
|
5528
6030
|
(source, reason) => {
|
|
5529
6031
|
const claim = claimControllerRef.current;
|
|
5530
|
-
_optionalChain([claim, 'optionalAccess',
|
|
5531
|
-
_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)]);
|
|
5532
6034
|
claimControllerRef.current = null;
|
|
5533
6035
|
setAttempt(null);
|
|
5534
6036
|
},
|
|
@@ -5586,15 +6088,15 @@ function HistoryOverlay({
|
|
|
5586
6088
|
if (!attempt) return;
|
|
5587
6089
|
return () => {
|
|
5588
6090
|
const claim = claimControllerRef.current;
|
|
5589
|
-
_optionalChain([claim, 'optionalAccess',
|
|
5590
|
-
_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")]);
|
|
5591
6093
|
};
|
|
5592
6094
|
}, [attempt]);
|
|
5593
6095
|
const claimSessionProperties = _react.useMemo.call(void 0,
|
|
5594
6096
|
() => ({
|
|
5595
6097
|
presentation: inline ? "inline" : "overlay",
|
|
5596
6098
|
overlay_close_enabled: !inline && Boolean(closeOnOverlayClick),
|
|
5597
|
-
prefills: { transaction_hash: false, refund_destination:
|
|
6099
|
+
prefills: { transaction_hash: false, refund_destination: false }
|
|
5598
6100
|
}),
|
|
5599
6101
|
[inline, closeOnOverlayClick]
|
|
5600
6102
|
);
|
|
@@ -5613,7 +6115,7 @@ function HistoryOverlay({
|
|
|
5613
6115
|
HistoryRecoveryFlow,
|
|
5614
6116
|
{
|
|
5615
6117
|
deposit: recovering,
|
|
5616
|
-
entrySource: _nullishCoalesce(_optionalChain([attempt, 'optionalAccess',
|
|
6118
|
+
entrySource: _nullishCoalesce(_optionalChain([attempt, 'optionalAccess', _287 => _287.entrySource]), () => ( "history_row")),
|
|
5617
6119
|
backendUrl,
|
|
5618
6120
|
signRecovery,
|
|
5619
6121
|
debug,
|
|
@@ -5628,6 +6130,8 @@ function HistoryOverlay({
|
|
|
5628
6130
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5629
6131
|
DepositHistoryPanel,
|
|
5630
6132
|
{
|
|
6133
|
+
bankHistory,
|
|
6134
|
+
bankSupportUrl,
|
|
5631
6135
|
deposits: controller.deposits,
|
|
5632
6136
|
isLoading: controller.isLoading,
|
|
5633
6137
|
error: controller.error,
|
|
@@ -5767,7 +6271,7 @@ function useHistoryPanel({
|
|
|
5767
6271
|
}, [isOpen, badgeState2.nextExpiryAt]);
|
|
5768
6272
|
const openPanel = _react.useCallback.call(void 0, () => {
|
|
5769
6273
|
setIsPanelOpen(true);
|
|
5770
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
6274
|
+
_optionalChain([analytics, 'optionalAccess', _288 => _288.visitOpened, 'call', _289 => _289(badge)]);
|
|
5771
6275
|
if (!loadedRef.current || staleRef.current) {
|
|
5772
6276
|
fetchHistory("initial");
|
|
5773
6277
|
}
|
|
@@ -5775,10 +6279,10 @@ function useHistoryPanel({
|
|
|
5775
6279
|
const closePanel = _react.useCallback.call(void 0, () => {
|
|
5776
6280
|
if (recovering) return;
|
|
5777
6281
|
setIsPanelOpen(false);
|
|
5778
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
6282
|
+
_optionalChain([analytics, 'optionalAccess', _290 => _290.visitEnded, 'call', _291 => _291()]);
|
|
5779
6283
|
}, [analytics, recovering]);
|
|
5780
6284
|
const loadMore = _react.useCallback.call(void 0, () => {
|
|
5781
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
6285
|
+
_optionalChain([analytics, 'optionalAccess', _292 => _292.loadMore, 'call', _293 => _293(filterVisibleDeposits(deposits).length)]);
|
|
5782
6286
|
fetchHistory("more");
|
|
5783
6287
|
}, [analytics, deposits, fetchHistory]);
|
|
5784
6288
|
const markStale = _react.useCallback.call(void 0, () => {
|
|
@@ -5806,7 +6310,7 @@ function useHistoryPanel({
|
|
|
5806
6310
|
_react.useEffect.call(void 0, () => {
|
|
5807
6311
|
if (isOpen) return;
|
|
5808
6312
|
setIsPanelOpen(false);
|
|
5809
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
6313
|
+
_optionalChain([analytics, 'optionalAccess', _294 => _294.visitEnded, 'call', _295 => _295()]);
|
|
5810
6314
|
setDeposits([]);
|
|
5811
6315
|
setHasMore(false);
|
|
5812
6316
|
setError(null);
|
|
@@ -5965,11 +6469,11 @@ var NOTHING_TO_STOP = () => {
|
|
|
5965
6469
|
};
|
|
5966
6470
|
function resolveThemeMode(mode) {
|
|
5967
6471
|
if (mode !== "system") return mode;
|
|
5968
|
-
return _optionalChain([globalThis, 'access',
|
|
6472
|
+
return _optionalChain([globalThis, 'access', _296 => _296.matchMedia, 'optionalCall', _297 => _297(DARK_SCHEME_QUERY), 'access', _298 => _298.matches]) ? "dark" : "light";
|
|
5969
6473
|
}
|
|
5970
6474
|
function followSystemAppearance(mode, onChange) {
|
|
5971
6475
|
if (mode !== "system") return NOTHING_TO_STOP;
|
|
5972
|
-
const query = _optionalChain([globalThis, 'access',
|
|
6476
|
+
const query = _optionalChain([globalThis, 'access', _299 => _299.matchMedia, 'optionalCall', _300 => _300(DARK_SCHEME_QUERY)]);
|
|
5973
6477
|
if (!query) return NOTHING_TO_STOP;
|
|
5974
6478
|
query.addEventListener("change", onChange);
|
|
5975
6479
|
return () => query.removeEventListener("change", onChange);
|
|
@@ -5977,22 +6481,22 @@ function followSystemAppearance(mode, onChange) {
|
|
|
5977
6481
|
function applyTheme(element, theme) {
|
|
5978
6482
|
if (!element) return NOTHING_TO_STOP;
|
|
5979
6483
|
const parent = element.parentElement;
|
|
5980
|
-
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];
|
|
5981
6485
|
const paintMode = () => {
|
|
5982
|
-
const resolved = resolveThemeMode(_optionalChain([theme, 'optionalAccess',
|
|
6486
|
+
const resolved = resolveThemeMode(_optionalChain([theme, 'optionalAccess', _304 => _304.mode]));
|
|
5983
6487
|
for (const t of targets) {
|
|
5984
6488
|
if (resolved) t.setAttribute("data-theme", resolved);
|
|
5985
6489
|
else t.removeAttribute("data-theme");
|
|
5986
6490
|
}
|
|
5987
6491
|
};
|
|
5988
6492
|
paintMode();
|
|
5989
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6493
|
+
if (_optionalChain([theme, 'optionalAccess', _305 => _305.fontColor])) {
|
|
5990
6494
|
setVar(targets, "--rs-foreground", theme.fontColor);
|
|
5991
6495
|
}
|
|
5992
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6496
|
+
if (_optionalChain([theme, 'optionalAccess', _306 => _306.iconColor])) {
|
|
5993
6497
|
setVar(targets, "--rs-icon", theme.iconColor);
|
|
5994
6498
|
}
|
|
5995
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6499
|
+
if (_optionalChain([theme, 'optionalAccess', _307 => _307.ctaColor])) {
|
|
5996
6500
|
const derived = deriveCustomPrimary(theme.ctaColor);
|
|
5997
6501
|
if (derived) {
|
|
5998
6502
|
setVar(targets, "--rs-primary", derived.base);
|
|
@@ -6017,25 +6521,25 @@ function applyTheme(element, theme) {
|
|
|
6017
6521
|
}
|
|
6018
6522
|
} else {
|
|
6019
6523
|
for (const v of CUSTOM_PRIMARY_VARS) clearVar(targets, v);
|
|
6020
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6524
|
+
if (_optionalChain([theme, 'optionalAccess', _308 => _308.ctaHoverColor])) {
|
|
6021
6525
|
setVar(targets, "--rs-primary-hover", theme.ctaHoverColor);
|
|
6022
6526
|
}
|
|
6023
6527
|
}
|
|
6024
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6528
|
+
if (_optionalChain([theme, 'optionalAccess', _309 => _309.borderColor])) {
|
|
6025
6529
|
setVar(targets, "--rs-border", theme.borderColor);
|
|
6026
6530
|
setVar(targets, "--rs-border-surface", theme.borderColor);
|
|
6027
6531
|
}
|
|
6028
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6532
|
+
if (_optionalChain([theme, 'optionalAccess', _310 => _310.backgroundColor])) {
|
|
6029
6533
|
setVar(targets, "--rs-background", theme.backgroundColor);
|
|
6030
6534
|
}
|
|
6031
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6535
|
+
if (_optionalChain([theme, 'optionalAccess', _311 => _311.radius])) {
|
|
6032
6536
|
const scale = RADIUS_SCALE[theme.radius];
|
|
6033
6537
|
setVar(targets, "--rs-radius-sm", scale.sm);
|
|
6034
6538
|
setVar(targets, "--rs-radius-md", scale.md);
|
|
6035
6539
|
setVar(targets, "--rs-radius-lg", scale.lg);
|
|
6036
6540
|
setVar(targets, "--rs-radius", scale.md);
|
|
6037
6541
|
}
|
|
6038
|
-
return followSystemAppearance(_optionalChain([theme, 'optionalAccess',
|
|
6542
|
+
return followSystemAppearance(_optionalChain([theme, 'optionalAccess', _312 => _312.mode]), paintMode);
|
|
6039
6543
|
}
|
|
6040
6544
|
|
|
6041
6545
|
// src/core/removed-props.ts
|
|
@@ -6068,6 +6572,9 @@ var REMOVED_UI_CONFIG_KEYS = {
|
|
|
6068
6572
|
checkLiquidity: "removed \u2014 the modal no longer surfaces a liquidity cap. Route capacity is enforced when the deposit is processed.",
|
|
6069
6573
|
showHistoryButton: "removed \u2014 deposit history is always offered, from the modal's home screen. There is no way to hide it."
|
|
6070
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
|
+
};
|
|
6071
6578
|
var warned = /* @__PURE__ */ new Set();
|
|
6072
6579
|
function warnOnce(component, key, replacement) {
|
|
6073
6580
|
const id = `${component}.${key}`;
|
|
@@ -6085,6 +6592,18 @@ function warnRemovedProps(component, props) {
|
|
|
6085
6592
|
warnOnce(component, key, table[key]);
|
|
6086
6593
|
}
|
|
6087
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
|
+
}
|
|
6088
6607
|
const uiConfig = props.uiConfig;
|
|
6089
6608
|
if (uiConfig && typeof uiConfig === "object") {
|
|
6090
6609
|
for (const key of Object.keys(REMOVED_UI_CONFIG_KEYS)) {
|
|
@@ -6124,20 +6643,20 @@ function sinkFor(source) {
|
|
|
6124
6643
|
if (source.modal === "deposit") {
|
|
6125
6644
|
const at2 = () => source.controllerRef.current;
|
|
6126
6645
|
return {
|
|
6127
|
-
opened: (detail) => _optionalChain([at2, 'call',
|
|
6128
|
-
rowViewed: (detail) => _optionalChain([at2, 'call',
|
|
6129
|
-
loadMore: (detail) => _optionalChain([at2, 'call',
|
|
6130
|
-
fallbackOpened: (detail) => _optionalChain([at2, 'call',
|
|
6131
|
-
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)])
|
|
6132
6651
|
};
|
|
6133
6652
|
}
|
|
6134
6653
|
const at = () => source.controllerRef.current;
|
|
6135
6654
|
return {
|
|
6136
|
-
opened: (detail) => _optionalChain([at, 'call',
|
|
6137
|
-
rowViewed: (detail) => _optionalChain([at, 'call',
|
|
6138
|
-
loadMore: (detail) => _optionalChain([at, 'call',
|
|
6139
|
-
fallbackOpened: (detail) => _optionalChain([at, 'call',
|
|
6140
|
-
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)])
|
|
6141
6660
|
};
|
|
6142
6661
|
}
|
|
6143
6662
|
function badgeState(badge) {
|
|
@@ -6163,7 +6682,7 @@ function createHistoryAnalytics(source) {
|
|
|
6163
6682
|
sink.opened({
|
|
6164
6683
|
history_visit_id: visitId,
|
|
6165
6684
|
badge: badgeState(badge),
|
|
6166
|
-
badge_count: _nullishCoalesce(_optionalChain([badge, 'optionalAccess',
|
|
6685
|
+
badge_count: _nullishCoalesce(_optionalChain([badge, 'optionalAccess', _347 => _347.count]), () => ( 0))
|
|
6167
6686
|
});
|
|
6168
6687
|
},
|
|
6169
6688
|
visitEnded() {
|
|
@@ -6224,10 +6743,10 @@ function resolveChain(targetChain) {
|
|
|
6224
6743
|
if (typeof targetChain === "number" && !(targetChain > 0 && Number.isInteger(targetChain))) {
|
|
6225
6744
|
return void 0;
|
|
6226
6745
|
}
|
|
6227
|
-
return
|
|
6746
|
+
return _chunkFKJ6EJHHcjs.targetChainToCaip2.call(void 0, targetChain);
|
|
6228
6747
|
}
|
|
6229
6748
|
function resolveToken(targetToken) {
|
|
6230
|
-
const raw = _optionalChain([targetToken, 'optionalAccess',
|
|
6749
|
+
const raw = _optionalChain([targetToken, 'optionalAccess', _348 => _348.trim, 'call', _349 => _349()]);
|
|
6231
6750
|
if (!raw) return void 0;
|
|
6232
6751
|
if (HEX_TOKEN.test(raw)) return raw.toLowerCase();
|
|
6233
6752
|
if (BASE58_TOKEN.test(raw)) return raw;
|
|
@@ -6285,8 +6804,8 @@ function Tooltip({ content, children, className }) {
|
|
|
6285
6804
|
function handleOutside(event) {
|
|
6286
6805
|
const target = event.target;
|
|
6287
6806
|
if (!target) return;
|
|
6288
|
-
if (_optionalChain([triggerRef, 'access',
|
|
6289
|
-
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;
|
|
6290
6809
|
setOpen(false);
|
|
6291
6810
|
}
|
|
6292
6811
|
function handleKey(event) {
|
|
@@ -6363,7 +6882,7 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
6363
6882
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-fees-accordion-summary", children: [
|
|
6364
6883
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-fees-accordion-label", children: [
|
|
6365
6884
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fees" }),
|
|
6366
|
-
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, {}) }) })
|
|
6367
6886
|
] }),
|
|
6368
6887
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6369
6888
|
"button",
|
|
@@ -6381,7 +6900,7 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
6381
6900
|
{
|
|
6382
6901
|
className: `rs-fees-accordion-chevron${open ? " rs-fees-accordion-chevron--open" : ""}`,
|
|
6383
6902
|
"aria-hidden": "true",
|
|
6384
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronDownIcon, {})
|
|
6903
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronDownIcon, {})
|
|
6385
6904
|
}
|
|
6386
6905
|
)
|
|
6387
6906
|
]
|
|
@@ -6403,7 +6922,7 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
6403
6922
|
{
|
|
6404
6923
|
className: "rs-review-detail-info",
|
|
6405
6924
|
"aria-label": `${row.label} info`,
|
|
6406
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfoIcon, {})
|
|
6925
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.InfoIcon, {})
|
|
6407
6926
|
}
|
|
6408
6927
|
) })
|
|
6409
6928
|
] })
|
|
@@ -6420,6 +6939,7 @@ function SwappedReceipt({
|
|
|
6420
6939
|
amountPaid,
|
|
6421
6940
|
depositedAmount,
|
|
6422
6941
|
depositedSymbol,
|
|
6942
|
+
depositedToken,
|
|
6423
6943
|
feesTotal,
|
|
6424
6944
|
feeRows,
|
|
6425
6945
|
feesTooltip,
|
|
@@ -6429,7 +6949,7 @@ function SwappedReceipt({
|
|
|
6429
6949
|
}) {
|
|
6430
6950
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
6431
6951
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
6432
|
-
/* @__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" }),
|
|
6433
6953
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
6434
6954
|
onrampMethod && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
6435
6955
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Onramp method" }),
|
|
@@ -6446,7 +6966,7 @@ function SwappedReceipt({
|
|
|
6446
6966
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Deposited amount" }),
|
|
6447
6967
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
6448
6968
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: depositedAmount }),
|
|
6449
|
-
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 }) })
|
|
6450
6970
|
] })
|
|
6451
6971
|
] }),
|
|
6452
6972
|
feesTotal != null && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -6482,7 +7002,7 @@ var EXCHANGE_SLUGS = [
|
|
|
6482
7002
|
"kucoin"
|
|
6483
7003
|
];
|
|
6484
7004
|
var EXCHANGE_LOGO_SOURCES = Object.fromEntries(
|
|
6485
|
-
EXCHANGE_SLUGS.map((slug) => [slug,
|
|
7005
|
+
EXCHANGE_SLUGS.map((slug) => [slug, _chunkFKJ6EJHHcjs.cdnIconUrl.call(void 0, "exchanges", slug)])
|
|
6486
7006
|
);
|
|
6487
7007
|
var EXCHANGE_LOGO_ALIASES = {
|
|
6488
7008
|
gate: "gateio"
|
|
@@ -6515,7 +7035,7 @@ function asNumber(value) {
|
|
|
6515
7035
|
const trimmed = value.trim();
|
|
6516
7036
|
if (!trimmed) return void 0;
|
|
6517
7037
|
const caipMatch = trimmed.match(/^eip155:(\d+)$/);
|
|
6518
|
-
if (_optionalChain([caipMatch, 'optionalAccess',
|
|
7038
|
+
if (_optionalChain([caipMatch, 'optionalAccess', _356 => _356[1]])) {
|
|
6519
7039
|
const parsed2 = Number(caipMatch[1]);
|
|
6520
7040
|
return Number.isFinite(parsed2) ? parsed2 : void 0;
|
|
6521
7041
|
}
|
|
@@ -6534,24 +7054,24 @@ function asAddress(value) {
|
|
|
6534
7054
|
return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
|
|
6535
7055
|
}
|
|
6536
7056
|
function getEventTxHash(event) {
|
|
6537
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
7057
|
+
if (!_optionalChain([event, 'optionalAccess', _357 => _357.type])) return void 0;
|
|
6538
7058
|
if (event.type === "deposit-received") {
|
|
6539
|
-
return asString(_optionalChain([event, 'access',
|
|
7059
|
+
return asString(_optionalChain([event, 'access', _358 => _358.data, 'optionalAccess', _359 => _359.transactionHash]));
|
|
6540
7060
|
}
|
|
6541
7061
|
if (event.type === "bridge-started" || event.type === "bridge-complete") {
|
|
6542
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
6543
|
-
const source = isRecord(_optionalChain([event, 'access',
|
|
6544
|
-
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]))));
|
|
6545
7065
|
}
|
|
6546
7066
|
if (event.type === "bridge-failed" || event.type === "error") {
|
|
6547
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
6548
|
-
const source = isRecord(_optionalChain([event, 'access',
|
|
6549
|
-
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]))));
|
|
6550
7070
|
}
|
|
6551
7071
|
return void 0;
|
|
6552
7072
|
}
|
|
6553
7073
|
function getEventSourceDetails(event) {
|
|
6554
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
7074
|
+
if (!_optionalChain([event, 'optionalAccess', _372 => _372.type]) || !isRecord(event.data)) return {};
|
|
6555
7075
|
if (event.type === "deposit-received") {
|
|
6556
7076
|
return {
|
|
6557
7077
|
chainId: asNumber(event.data.chain),
|
|
@@ -6563,9 +7083,9 @@ function getEventSourceDetails(event) {
|
|
|
6563
7083
|
const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
|
|
6564
7084
|
if (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error") {
|
|
6565
7085
|
return {
|
|
6566
|
-
chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess',
|
|
6567
|
-
amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess',
|
|
6568
|
-
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]))))
|
|
6569
7089
|
};
|
|
6570
7090
|
}
|
|
6571
7091
|
return {};
|
|
@@ -6579,7 +7099,7 @@ function asChain(value) {
|
|
|
6579
7099
|
return asNumber(value);
|
|
6580
7100
|
}
|
|
6581
7101
|
function getEventDestinationDetails(event) {
|
|
6582
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
7102
|
+
if (!_optionalChain([event, 'optionalAccess', _380 => _380.type]) || !isRecord(event.data)) return {};
|
|
6583
7103
|
if (event.type !== "bridge-started" && event.type !== "bridge-complete") {
|
|
6584
7104
|
return {};
|
|
6585
7105
|
}
|
|
@@ -6589,14 +7109,14 @@ function getEventDestinationDetails(event) {
|
|
|
6589
7109
|
return {
|
|
6590
7110
|
chainId: asChain(destination.chain),
|
|
6591
7111
|
amount: asAmount(destination.amount),
|
|
6592
|
-
token: _optionalChain([token, 'optionalAccess',
|
|
7112
|
+
token: _optionalChain([token, 'optionalAccess', _381 => _381.trim, 'call', _382 => _382()]) || void 0
|
|
6593
7113
|
};
|
|
6594
7114
|
}
|
|
6595
7115
|
function isDepositEvent(event) {
|
|
6596
|
-
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";
|
|
6597
7117
|
}
|
|
6598
7118
|
function isFailedEvent(event) {
|
|
6599
|
-
return _optionalChain([event, 'optionalAccess',
|
|
7119
|
+
return _optionalChain([event, 'optionalAccess', _388 => _388.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _389 => _389.type]) === "error";
|
|
6600
7120
|
}
|
|
6601
7121
|
function isHexString(value) {
|
|
6602
7122
|
return value.startsWith("0x") || value.startsWith("0X");
|
|
@@ -6608,7 +7128,7 @@ function txRefsMatch(a, b) {
|
|
|
6608
7128
|
return a === b;
|
|
6609
7129
|
}
|
|
6610
7130
|
function formatBridgeFailedMessage(event) {
|
|
6611
|
-
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
7131
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _390 => _390.data]), () => ( {}));
|
|
6612
7132
|
const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
|
|
6613
7133
|
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
6614
7134
|
function toUserFacingFailure(raw) {
|
|
@@ -6636,7 +7156,7 @@ function formatBridgeFailedMessage(event) {
|
|
|
6636
7156
|
return { message: "Bridge failed" };
|
|
6637
7157
|
}
|
|
6638
7158
|
function failureMessageForEvent(event) {
|
|
6639
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7159
|
+
if (_optionalChain([event, 'optionalAccess', _391 => _391.type]) === "error") {
|
|
6640
7160
|
const message = isRecord(event.data) ? asString(event.data.message) : void 0;
|
|
6641
7161
|
return _nullishCoalesce(message, () => ( "Unknown error"));
|
|
6642
7162
|
}
|
|
@@ -6645,66 +7165,28 @@ function failureMessageForEvent(event) {
|
|
|
6645
7165
|
|
|
6646
7166
|
// src/core/useTokenPrices.ts
|
|
6647
7167
|
|
|
6648
|
-
var
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
const
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
const caip2 = caip2For(token);
|
|
6671
|
-
if (!caip2) return null;
|
|
6672
|
-
const prices = await service.fetchPricesByAddress([caip2]);
|
|
6673
|
-
const price = prices[caip2];
|
|
6674
|
-
return typeof price === "number" && price > 0 ? price : null;
|
|
6675
|
-
}
|
|
6676
|
-
function useTokenPrices(service, tokens) {
|
|
6677
|
-
const [prices, setPrices] = _react.useState.call(void 0, {});
|
|
6678
|
-
const defined = tokens.filter((t) => Boolean(_optionalChain([t, 'optionalAccess', _293 => _293.symbol])));
|
|
6679
|
-
const entries = [
|
|
6680
|
-
...new Map(
|
|
6681
|
-
defined.flatMap((token) => {
|
|
6682
|
-
const caip2 = caip2For(token);
|
|
6683
|
-
return caip2 ? [{ symbol: token.symbol.toUpperCase(), caip2 }] : [];
|
|
6684
|
-
}).map((entry) => [entry.caip2, entry])
|
|
6685
|
-
).values()
|
|
6686
|
-
].sort((a, b) => a.caip2.localeCompare(b.caip2));
|
|
6687
|
-
const key = JSON.stringify(entries);
|
|
6688
|
-
_react.useEffect.call(void 0, () => {
|
|
6689
|
-
if (key === "[]") return;
|
|
6690
|
-
let cancelled = false;
|
|
6691
|
-
const parsed = JSON.parse(key);
|
|
6692
|
-
const caip2Ids = [...new Set(parsed.map((e) => e.caip2))];
|
|
6693
|
-
service.fetchPricesByAddress(caip2Ids).then((byAddress) => {
|
|
6694
|
-
if (cancelled) return;
|
|
6695
|
-
const merged = {};
|
|
6696
|
-
for (const entry of parsed) {
|
|
6697
|
-
const price = byAddress[entry.caip2];
|
|
6698
|
-
if (typeof price === "number") merged[entry.symbol] = price;
|
|
6699
|
-
}
|
|
6700
|
-
setPrices(merged);
|
|
6701
|
-
}).catch(() => {
|
|
6702
|
-
});
|
|
6703
|
-
return () => {
|
|
6704
|
-
cancelled = true;
|
|
6705
|
-
};
|
|
6706
|
-
}, [service, key]);
|
|
6707
|
-
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]);
|
|
6708
7190
|
}
|
|
6709
7191
|
|
|
6710
7192
|
// src/components/steps/ProcessingStep.tsx
|
|
@@ -6838,7 +7320,7 @@ function loadPhaseTimings(txHash) {
|
|
|
6838
7320
|
const parsed = JSON.parse(raw);
|
|
6839
7321
|
if (typeof parsed.startedAt !== "number") return null;
|
|
6840
7322
|
return parsed;
|
|
6841
|
-
} catch (
|
|
7323
|
+
} catch (e19) {
|
|
6842
7324
|
return null;
|
|
6843
7325
|
}
|
|
6844
7326
|
}
|
|
@@ -6849,7 +7331,7 @@ function savePhaseTimings(txHash, timings) {
|
|
|
6849
7331
|
`${PHASE_TIMINGS_PREFIX}:${txHash}`,
|
|
6850
7332
|
JSON.stringify(timings)
|
|
6851
7333
|
);
|
|
6852
|
-
} catch (
|
|
7334
|
+
} catch (e20) {
|
|
6853
7335
|
}
|
|
6854
7336
|
}
|
|
6855
7337
|
function isEventForTx(event, txHash) {
|
|
@@ -6858,12 +7340,12 @@ function isEventForTx(event, txHash) {
|
|
|
6858
7340
|
return txRefsMatch(eventTxHash, txHash);
|
|
6859
7341
|
}
|
|
6860
7342
|
function parseWebhookTimestamp(event) {
|
|
6861
|
-
if (typeof _optionalChain([event, 'optionalAccess',
|
|
7343
|
+
if (typeof _optionalChain([event, 'optionalAccess', _393 => _393.time]) !== "string") return void 0;
|
|
6862
7344
|
const timestamp = Date.parse(event.time);
|
|
6863
7345
|
return Number.isFinite(timestamp) ? timestamp : void 0;
|
|
6864
7346
|
}
|
|
6865
7347
|
function syncPhaseTimings(previous, event) {
|
|
6866
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
7348
|
+
if (!_optionalChain([event, 'optionalAccess', _394 => _394.type])) return previous;
|
|
6867
7349
|
const timestamp = _nullishCoalesce(parseWebhookTimestamp(event), () => ( Date.now()));
|
|
6868
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;
|
|
6869
7351
|
const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete") && previous.bridgingAt === void 0;
|
|
@@ -6925,52 +7407,52 @@ function getCurrentPhaseId(state, phaseTimings) {
|
|
|
6925
7407
|
if (state.type === "complete") {
|
|
6926
7408
|
return void 0;
|
|
6927
7409
|
}
|
|
6928
|
-
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")
|
|
6929
7411
|
return "bridging";
|
|
6930
|
-
if (_optionalChain([state, 'access',
|
|
7412
|
+
if (_optionalChain([state, 'access', _399 => _399.lastEvent, 'optionalAccess', _400 => _400.type]) === "deposit-received") return "received";
|
|
6931
7413
|
return "confirming";
|
|
6932
7414
|
}
|
|
6933
7415
|
function getCompletionDestinationAmount(event) {
|
|
6934
|
-
const amount = _optionalChain([event, 'optionalAccess',
|
|
7416
|
+
const amount = _optionalChain([event, 'optionalAccess', _401 => _401.data, 'optionalAccess', _402 => _402.destination, 'optionalAccess', _403 => _403.amount]);
|
|
6935
7417
|
return typeof amount === "string" ? amount : void 0;
|
|
6936
7418
|
}
|
|
6937
7419
|
function getCompletionDestinationTxHash(event) {
|
|
6938
|
-
const eventData = _optionalChain([event, 'optionalAccess',
|
|
6939
|
-
const swapTxHash = _optionalChain([eventData, 'optionalAccess',
|
|
6940
|
-
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]);
|
|
6941
7423
|
return _nullishCoalesce(swapTxHash, () => ( destinationTxHash));
|
|
6942
7424
|
}
|
|
6943
7425
|
function getTerminalProcessingOutcome(event) {
|
|
6944
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7426
|
+
if (_optionalChain([event, 'optionalAccess', _409 => _409.type]) === "post-bridge-swap-complete") {
|
|
6945
7427
|
return {
|
|
6946
7428
|
type: "complete",
|
|
6947
7429
|
destinationTxHash: getCompletionDestinationTxHash(event),
|
|
6948
7430
|
destinationAmount: getCompletionDestinationAmount(event)
|
|
6949
7431
|
};
|
|
6950
7432
|
}
|
|
6951
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7433
|
+
if (_optionalChain([event, 'optionalAccess', _410 => _410.type]) === "post-bridge-swap-failed") {
|
|
6952
7434
|
return {
|
|
6953
7435
|
type: "failed",
|
|
6954
7436
|
message: formatBridgeFailedMessage(event).message
|
|
6955
7437
|
};
|
|
6956
7438
|
}
|
|
6957
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7439
|
+
if (_optionalChain([event, 'optionalAccess', _411 => _411.type]) === "bridge-complete") {
|
|
6958
7440
|
return {
|
|
6959
7441
|
type: "complete",
|
|
6960
7442
|
destinationTxHash: getCompletionDestinationTxHash(event),
|
|
6961
7443
|
destinationAmount: getCompletionDestinationAmount(event)
|
|
6962
7444
|
};
|
|
6963
7445
|
}
|
|
6964
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7446
|
+
if (_optionalChain([event, 'optionalAccess', _412 => _412.type]) === "bridge-failed") {
|
|
6965
7447
|
return {
|
|
6966
7448
|
type: "failed",
|
|
6967
7449
|
message: formatBridgeFailedMessage(event).message
|
|
6968
7450
|
};
|
|
6969
7451
|
}
|
|
6970
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7452
|
+
if (_optionalChain([event, 'optionalAccess', _413 => _413.type]) === "error") {
|
|
6971
7453
|
return {
|
|
6972
7454
|
type: "failed",
|
|
6973
|
-
message: _nullishCoalesce(_optionalChain([event, 'access',
|
|
7455
|
+
message: _nullishCoalesce(_optionalChain([event, 'access', _414 => _414.data, 'optionalAccess', _415 => _415.message]), () => ( "Unknown error"))
|
|
6974
7456
|
};
|
|
6975
7457
|
}
|
|
6976
7458
|
return null;
|
|
@@ -6978,10 +7460,10 @@ function getTerminalProcessingOutcome(event) {
|
|
|
6978
7460
|
function getInitialProcessingState(event, txHash) {
|
|
6979
7461
|
if (!event || !isEventForTx(event, txHash)) return null;
|
|
6980
7462
|
const terminal = getTerminalProcessingOutcome(event);
|
|
6981
|
-
if (_optionalChain([terminal, 'optionalAccess',
|
|
7463
|
+
if (_optionalChain([terminal, 'optionalAccess', _416 => _416.type]) === "complete") {
|
|
6982
7464
|
return { type: "complete", lastEvent: event };
|
|
6983
7465
|
}
|
|
6984
|
-
if (_optionalChain([terminal, 'optionalAccess',
|
|
7466
|
+
if (_optionalChain([terminal, 'optionalAccess', _417 => _417.type]) === "failed") {
|
|
6985
7467
|
return { type: "failed", message: terminal.message, lastEvent: event };
|
|
6986
7468
|
}
|
|
6987
7469
|
if (isDepositEvent(event)) {
|
|
@@ -6990,7 +7472,7 @@ function getInitialProcessingState(event, txHash) {
|
|
|
6990
7472
|
return null;
|
|
6991
7473
|
}
|
|
6992
7474
|
function getSettledSourceTxHash(event, fallbackTxHash) {
|
|
6993
|
-
return _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
7475
|
+
return _nullishCoalesce(_optionalChain([event, 'optionalAccess', _418 => _418.data, 'optionalAccess', _419 => _419.source, 'optionalAccess', _420 => _420.transactionHash]), () => ( fallbackTxHash));
|
|
6994
7476
|
}
|
|
6995
7477
|
function ProcessingStep({
|
|
6996
7478
|
smartAccount,
|
|
@@ -7030,7 +7512,7 @@ function ProcessingStep({
|
|
|
7030
7512
|
const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
|
|
7031
7513
|
const pollTimeoutRef = _react.useRef.call(void 0, null);
|
|
7032
7514
|
const escalatedDelayRef = _react.useRef.call(void 0, false);
|
|
7033
|
-
const processingContextRef = useLatestRef({
|
|
7515
|
+
const processingContextRef = _chunkG264OM23cjs.useLatestRef.call(void 0, {
|
|
7034
7516
|
amount,
|
|
7035
7517
|
sourceChain,
|
|
7036
7518
|
sourceToken,
|
|
@@ -7039,9 +7521,9 @@ function ProcessingStep({
|
|
|
7039
7521
|
targetChain,
|
|
7040
7522
|
targetToken
|
|
7041
7523
|
});
|
|
7042
|
-
const onDepositCompleteRef = useLatestRef(onDepositComplete);
|
|
7043
|
-
const onDepositFailedRef = useLatestRef(onDepositFailed);
|
|
7044
|
-
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);
|
|
7045
7527
|
const explorerTxUrl = useExplorerTxUrl();
|
|
7046
7528
|
const initialTerminalEventRef = _react.useRef.call(void 0, null);
|
|
7047
7529
|
const completedDirectTransferTxHashRef = _react.useRef.call(void 0, null);
|
|
@@ -7070,8 +7552,8 @@ function ProcessingStep({
|
|
|
7070
7552
|
const [elapsedSeconds, setElapsedSeconds] = _react.useState.call(void 0,
|
|
7071
7553
|
() => Math.max(0, Math.floor((Date.now() - startTimeRef.current) / 1e3))
|
|
7072
7554
|
);
|
|
7073
|
-
const [latchedTiming, setLatchedTiming] = _react.useState.call(void 0, _optionalChain([quote, 'optionalAccess',
|
|
7074
|
-
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) {
|
|
7075
7557
|
setLatchedTiming(quote.timing);
|
|
7076
7558
|
}
|
|
7077
7559
|
const timingStateRef = _react.useRef.call(void 0, "expected");
|
|
@@ -7102,7 +7584,7 @@ function ProcessingStep({
|
|
|
7102
7584
|
flowLabel
|
|
7103
7585
|
});
|
|
7104
7586
|
const context = processingContextRef.current;
|
|
7105
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
7587
|
+
_optionalChain([onDepositCompleteRef, 'access', _423 => _423.current, 'optionalCall', _424 => _424(txHash, void 0, {
|
|
7106
7588
|
amount: context.amount,
|
|
7107
7589
|
sourceChain: context.sourceChain,
|
|
7108
7590
|
sourceToken: context.sourceToken,
|
|
@@ -7135,7 +7617,7 @@ function ProcessingStep({
|
|
|
7135
7617
|
destinationTxHash: outcome.destinationTxHash,
|
|
7136
7618
|
event: event.type
|
|
7137
7619
|
});
|
|
7138
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
7620
|
+
_optionalChain([onDepositCompleteRef, 'access', _425 => _425.current, 'optionalCall', _426 => _426(
|
|
7139
7621
|
sourceTxHash2,
|
|
7140
7622
|
outcome.destinationTxHash,
|
|
7141
7623
|
{
|
|
@@ -7156,7 +7638,7 @@ function ProcessingStep({
|
|
|
7156
7638
|
message: outcome.message,
|
|
7157
7639
|
event: event.type
|
|
7158
7640
|
});
|
|
7159
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
7641
|
+
_optionalChain([onDepositFailedRef, 'access', _427 => _427.current, 'optionalCall', _428 => _428(txHash, outcome.message)]);
|
|
7160
7642
|
}, [
|
|
7161
7643
|
debug,
|
|
7162
7644
|
onDepositCompleteRef,
|
|
@@ -7167,8 +7649,8 @@ function ProcessingStep({
|
|
|
7167
7649
|
const onSettledChangeRef = _react.useRef.call(void 0, onSettledChange);
|
|
7168
7650
|
onSettledChangeRef.current = onSettledChange;
|
|
7169
7651
|
_react.useEffect.call(void 0, () => {
|
|
7170
|
-
_optionalChain([onSettledChangeRef, 'access',
|
|
7171
|
-
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)]);
|
|
7172
7654
|
}, [state.type]);
|
|
7173
7655
|
_react.useEffect.call(void 0, () => {
|
|
7174
7656
|
if (directTransfer || state.type !== "processing") return;
|
|
@@ -7194,26 +7676,21 @@ function ProcessingStep({
|
|
|
7194
7676
|
updatePhaseTimings(
|
|
7195
7677
|
(previous) => syncPhaseTimings(previous, state.lastEvent)
|
|
7196
7678
|
);
|
|
7197
|
-
}, [_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]);
|
|
7198
7680
|
const [swappedFiatContext, setSwappedFiatContext] = _react.useState.call(void 0, null);
|
|
7199
7681
|
_react.useEffect.call(void 0, () => {
|
|
7200
7682
|
let cancelled = false;
|
|
7201
7683
|
let timeoutId;
|
|
7202
|
-
const isFiatSwappedOrder = isSwappedOrder && _optionalChain([swappedContext, 'optionalAccess',
|
|
7203
|
-
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));
|
|
7204
7686
|
setSwappedFiatContext(null);
|
|
7205
|
-
if (
|
|
7687
|
+
if (!isSwappedOrder || !expectedOrderUuid) {
|
|
7206
7688
|
return () => {
|
|
7207
7689
|
cancelled = true;
|
|
7208
7690
|
};
|
|
7209
7691
|
}
|
|
7692
|
+
const orderId = expectedOrderUuid;
|
|
7210
7693
|
let attempts = 0;
|
|
7211
|
-
const matchesCurrentDeposit = (res) => {
|
|
7212
|
-
if (isFiatSwappedOrder) {
|
|
7213
|
-
return res.orderId === expectedOrderUuid;
|
|
7214
|
-
}
|
|
7215
|
-
return res.transactionId != null && res.transactionId.toLowerCase() === txHash.toLowerCase();
|
|
7216
|
-
};
|
|
7217
7694
|
const scheduleRetry = () => {
|
|
7218
7695
|
if (cancelled || !isFiatSwappedOrder || attempts >= SWAPPED_FIAT_STATUS_MAX_ATTEMPTS) {
|
|
7219
7696
|
return;
|
|
@@ -7226,9 +7703,9 @@ function ProcessingStep({
|
|
|
7226
7703
|
async function fetchContext() {
|
|
7227
7704
|
attempts += 1;
|
|
7228
7705
|
try {
|
|
7229
|
-
const res = await service.
|
|
7706
|
+
const res = await service.fetchSwappedOrder(orderId);
|
|
7230
7707
|
if (cancelled) return;
|
|
7231
|
-
if (!res ||
|
|
7708
|
+
if (!res || res.orderId !== orderId) {
|
|
7232
7709
|
scheduleRetry();
|
|
7233
7710
|
return;
|
|
7234
7711
|
}
|
|
@@ -7236,7 +7713,7 @@ function ProcessingStep({
|
|
|
7236
7713
|
if (isFiatSwappedOrder && !hasFiatReceiptPricing(res)) {
|
|
7237
7714
|
scheduleRetry();
|
|
7238
7715
|
}
|
|
7239
|
-
} catch (
|
|
7716
|
+
} catch (e21) {
|
|
7240
7717
|
scheduleRetry();
|
|
7241
7718
|
}
|
|
7242
7719
|
}
|
|
@@ -7247,11 +7724,9 @@ function ProcessingStep({
|
|
|
7247
7724
|
};
|
|
7248
7725
|
}, [
|
|
7249
7726
|
service,
|
|
7250
|
-
smartAccount,
|
|
7251
|
-
txHash,
|
|
7252
7727
|
isSwappedOrder,
|
|
7253
|
-
_optionalChain([swappedContext, 'optionalAccess',
|
|
7254
|
-
_optionalChain([swappedContext, 'optionalAccess',
|
|
7728
|
+
_optionalChain([swappedContext, 'optionalAccess', _439 => _439.variant]),
|
|
7729
|
+
_optionalChain([swappedContext, 'optionalAccess', _440 => _440.expectedOrderUuid])
|
|
7255
7730
|
]);
|
|
7256
7731
|
_react.useEffect.call(void 0, () => {
|
|
7257
7732
|
if (directTransfer) return;
|
|
@@ -7277,18 +7752,18 @@ function ProcessingStep({
|
|
|
7277
7752
|
debugLog(debug, "processing", "poll:event", {
|
|
7278
7753
|
type: lastEvent2.type,
|
|
7279
7754
|
matchesTx: eventMatchesTx,
|
|
7280
|
-
intentId: _optionalChain([eventData, 'optionalAccess',
|
|
7755
|
+
intentId: _optionalChain([eventData, 'optionalAccess', _441 => _441.intentId])
|
|
7281
7756
|
});
|
|
7282
7757
|
}
|
|
7283
7758
|
if (!isMounted) return;
|
|
7284
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
7759
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _442 => _442.type]) === "bridge-complete") {
|
|
7285
7760
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
7286
7761
|
const sourceTxHash2 = getSettledSourceTxHash(
|
|
7287
7762
|
eventForCurrentTx,
|
|
7288
7763
|
txHash
|
|
7289
7764
|
);
|
|
7290
|
-
const destination = _optionalChain([eventForCurrentTx, 'access',
|
|
7291
|
-
const destinationTxHash2 = _optionalChain([destination, 'optionalAccess',
|
|
7765
|
+
const destination = _optionalChain([eventForCurrentTx, 'access', _443 => _443.data, 'optionalAccess', _444 => _444.destination]);
|
|
7766
|
+
const destinationTxHash2 = _optionalChain([destination, 'optionalAccess', _445 => _445.transactionHash]);
|
|
7292
7767
|
debugLog(debug, "processing", "state:complete", {
|
|
7293
7768
|
txHash,
|
|
7294
7769
|
sourceTxHash: sourceTxHash2,
|
|
@@ -7296,7 +7771,7 @@ function ProcessingStep({
|
|
|
7296
7771
|
event: eventForCurrentTx.type
|
|
7297
7772
|
});
|
|
7298
7773
|
const context = processingContextRef.current;
|
|
7299
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
7774
|
+
_optionalChain([onDepositCompleteRef, 'access', _446 => _446.current, 'optionalCall', _447 => _447(sourceTxHash2, destinationTxHash2, {
|
|
7300
7775
|
amount: context.amount,
|
|
7301
7776
|
sourceChain: context.sourceChain,
|
|
7302
7777
|
sourceToken: context.sourceToken,
|
|
@@ -7304,11 +7779,11 @@ function ProcessingStep({
|
|
|
7304
7779
|
amountUsd: context.amountUsd,
|
|
7305
7780
|
targetChain: context.targetChain,
|
|
7306
7781
|
targetToken: context.targetToken,
|
|
7307
|
-
destinationAmount: typeof _optionalChain([destination, 'optionalAccess',
|
|
7782
|
+
destinationAmount: typeof _optionalChain([destination, 'optionalAccess', _448 => _448.amount]) === "string" ? destination.amount : void 0
|
|
7308
7783
|
})]);
|
|
7309
7784
|
return;
|
|
7310
7785
|
}
|
|
7311
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
7786
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _449 => _449.type]) === "bridge-failed") {
|
|
7312
7787
|
const formatted = formatBridgeFailedMessage(eventForCurrentTx);
|
|
7313
7788
|
setState({
|
|
7314
7789
|
type: "failed",
|
|
@@ -7320,11 +7795,11 @@ function ProcessingStep({
|
|
|
7320
7795
|
message: formatted.message,
|
|
7321
7796
|
code: formatted.code
|
|
7322
7797
|
});
|
|
7323
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
7798
|
+
_optionalChain([onDepositFailedRef, 'access', _450 => _450.current, 'optionalCall', _451 => _451(txHash, formatted.message)]);
|
|
7324
7799
|
return;
|
|
7325
7800
|
}
|
|
7326
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
7327
|
-
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"));
|
|
7328
7803
|
setState({
|
|
7329
7804
|
type: "failed",
|
|
7330
7805
|
message: errorMessage,
|
|
@@ -7334,7 +7809,7 @@ function ProcessingStep({
|
|
|
7334
7809
|
txHash,
|
|
7335
7810
|
message: errorMessage
|
|
7336
7811
|
});
|
|
7337
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
7812
|
+
_optionalChain([onDepositFailedRef, 'access', _455 => _455.current, 'optionalCall', _456 => _456(txHash, errorMessage)]);
|
|
7338
7813
|
return;
|
|
7339
7814
|
}
|
|
7340
7815
|
setState((previous) => ({
|
|
@@ -7392,55 +7867,62 @@ function ProcessingStep({
|
|
|
7392
7867
|
const timelineNowMs = _nullishCoalesce(phaseTimings.endedAt, () => ( Date.now()));
|
|
7393
7868
|
const flowNoun = flowLabel === "withdraw" ? "withdrawal" : flowLabel === "payment" ? "payment" : "deposit";
|
|
7394
7869
|
const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : flowLabel === "payment" ? "Payment" : "Deposit";
|
|
7395
|
-
const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess',
|
|
7870
|
+
const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess', _457 => _457.data, 'optionalAccess', _458 => _458.destination, 'optionalAccess', _459 => _459.transactionHash]) || null;
|
|
7396
7871
|
const sourceTxHash = getSettledSourceTxHash(lastEvent, txHash);
|
|
7397
7872
|
const sourceDetails = getEventSourceDetails(lastEvent);
|
|
7398
7873
|
const displaySourceChain = _nullishCoalesce(sourceDetails.chainId, () => ( sourceChain));
|
|
7399
7874
|
const displaySourceToken = _nullishCoalesce(sourceDetails.token, () => ( sourceToken));
|
|
7400
7875
|
const displayAmount = _nullishCoalesce(sourceDetails.amount, () => ( amount));
|
|
7401
|
-
const targetChainId =
|
|
7402
|
-
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]);
|
|
7403
7878
|
const sourceExplorerHash = _nullishCoalesce(settledSourceTxHash, () => ( (sourceTxHashPending ? null : sourceTxHash)));
|
|
7404
7879
|
_react.useEffect.call(void 0, () => {
|
|
7405
7880
|
if (sourceTxHashPending && settledSourceTxHash) {
|
|
7406
|
-
_optionalChain([onSourceTransactionObserved, 'optionalCall',
|
|
7881
|
+
_optionalChain([onSourceTransactionObserved, 'optionalCall', _463 => _463(settledSourceTxHash)]);
|
|
7407
7882
|
}
|
|
7408
7883
|
}, [onSourceTransactionObserved, settledSourceTxHash, sourceTxHashPending]);
|
|
7409
7884
|
const sourceExplorerUrl = sourceExplorerHash ? explorerTxUrl(displaySourceChain, sourceExplorerHash) : null;
|
|
7410
7885
|
const destExplorerUrl = destinationTxHash ? explorerTxUrl(targetChainId, destinationTxHash) : null;
|
|
7411
|
-
const sourceDisplay = (() => {
|
|
7412
|
-
const resolved = resolveTokenDisplay(displaySourceToken, displaySourceChain, {
|
|
7413
|
-
symbol: _nullishCoalesce(providedSourceSymbol, () => ( (displaySourceChain === "solana" ? "SOL" : "Token"))),
|
|
7414
|
-
decimals: providedSourceDecimals
|
|
7415
|
-
});
|
|
7416
|
-
return {
|
|
7417
|
-
symbol: resolved.symbol,
|
|
7418
|
-
decimals: _nullishCoalesce(resolved.decimals, () => ( (displaySourceChain === "solana" ? 9 : 18)))
|
|
7419
|
-
};
|
|
7420
|
-
})();
|
|
7421
|
-
const sourceSymbol = sourceDisplay.symbol;
|
|
7422
|
-
const formattedSentAmount = _nullishCoalesce(_nullishCoalesce(formatRawTokenAmount(displayAmount, sourceDisplay), () => ( // Not raw base units (e.g. a decimal string) — render the number as-is.
|
|
7423
|
-
formatTokenAmount(Number(displayAmount), sourceDisplay.symbol))), () => ( displayAmount));
|
|
7424
7886
|
const eventDestination = getEventDestinationDetails(lastEvent);
|
|
7425
|
-
const
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
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;
|
|
7432
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;
|
|
7433
7915
|
const formattedDestinationAmount = eventDestination.amount !== void 0 ? formatRawTokenAmount(eventDestination.amount, targetDisplay) : void 0;
|
|
7434
7916
|
const amountUsdNumber = amountUsd !== void 0 && Number(amountUsd) > 0 ? Number(amountUsd) : void 0;
|
|
7435
|
-
const prices = useTokenPrices(
|
|
7917
|
+
const prices = useTokenPrices([
|
|
7436
7918
|
{
|
|
7437
7919
|
chainId: displaySourceChain,
|
|
7438
7920
|
address: displaySourceToken,
|
|
7439
7921
|
symbol: sourceDisplay.symbol
|
|
7440
7922
|
},
|
|
7441
7923
|
{
|
|
7442
|
-
chainId:
|
|
7443
|
-
address:
|
|
7924
|
+
chainId: displayTargetChain,
|
|
7925
|
+
address: displayTargetToken,
|
|
7444
7926
|
symbol: targetDisplay.symbol
|
|
7445
7927
|
}
|
|
7446
7928
|
]);
|
|
@@ -7450,7 +7932,7 @@ function ProcessingStep({
|
|
|
7450
7932
|
sourceSymbol: sourceDisplay.symbol,
|
|
7451
7933
|
targetSymbol: targetDisplay.symbol,
|
|
7452
7934
|
sourceAmountUsd: amountUsdNumber,
|
|
7453
|
-
sourceTrusted:
|
|
7935
|
+
sourceTrusted: sourceDisplay.curated,
|
|
7454
7936
|
prices
|
|
7455
7937
|
});
|
|
7456
7938
|
return estimate !== void 0 ? formatTokenAmount(estimate, targetDisplay.symbol) : void 0;
|
|
@@ -7507,7 +7989,7 @@ function ProcessingStep({
|
|
|
7507
7989
|
timeoutMs: latchedTiming ? resolveServedThresholds(latchedTiming).escalatedMs : FALLBACK_ESCALATED_DELAY_MS,
|
|
7508
7990
|
served: latchedTiming !== void 0
|
|
7509
7991
|
});
|
|
7510
|
-
_optionalChain([onErrorRef, 'access',
|
|
7992
|
+
_optionalChain([onErrorRef, 'access', _464 => _464.current, 'optionalCall', _465 => _465(
|
|
7511
7993
|
"Transfer is taking longer than expected. Your funds are safe and processing will continue automatically.",
|
|
7512
7994
|
"PROCESS_TIMEOUT"
|
|
7513
7995
|
)]);
|
|
@@ -7520,13 +8002,13 @@ function ProcessingStep({
|
|
|
7520
8002
|
timingState,
|
|
7521
8003
|
txHash
|
|
7522
8004
|
]);
|
|
7523
|
-
const sourceChainIcon =
|
|
7524
|
-
const targetChainIcon =
|
|
7525
|
-
const sourceChainName =
|
|
7526
|
-
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);
|
|
7527
8009
|
const timerText = formatTimer(elapsedSeconds);
|
|
7528
|
-
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
7529
|
-
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.")));
|
|
7530
8012
|
const stateTitle = isComplete ? `${flowCapitalized} successful` : isFailed ? `${flowCapitalized} failed` : "Processing...";
|
|
7531
8013
|
const handleRetry = _nullishCoalesce(onRetry, () => ( onNewDeposit));
|
|
7532
8014
|
const headerContent = isComplete ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header", children: [
|
|
@@ -7535,22 +8017,22 @@ function ProcessingStep({
|
|
|
7535
8017
|
] }) : isFailed ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header", children: [
|
|
7536
8018
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, FailedBadge, {}),
|
|
7537
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 }) })
|
|
7538
|
-
] }) : /* @__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 });
|
|
7539
8021
|
if (isComplete && isSwappedOrder) {
|
|
7540
|
-
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));
|
|
7541
8023
|
const onrampMethod = effectivePaymentMethod ? formatPaymentMethod(effectivePaymentMethod) : null;
|
|
7542
|
-
const onrampMethodIcon = _optionalChain([swappedContext, 'optionalAccess',
|
|
8024
|
+
const onrampMethodIcon = _optionalChain([swappedContext, 'optionalAccess', _470 => _470.variant]) === "connect" && effectivePaymentMethod ? getExchangeLogoSrc(
|
|
7543
8025
|
_nullishCoalesce(onrampMethod, () => ( effectivePaymentMethod)),
|
|
7544
8026
|
effectivePaymentMethod
|
|
7545
8027
|
) : null;
|
|
7546
|
-
const connectPaidAmount = _optionalChain([swappedContext, 'optionalAccess',
|
|
7547
|
-
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)));
|
|
7548
8030
|
const depositedAmount = receiveDisplay;
|
|
7549
|
-
const onrampFeeUsd = _nullishCoalesce(_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
8031
|
+
const onrampFeeUsd = _nullishCoalesce(_optionalChain([swappedFiatContext, 'optionalAccess', _473 => _473.onrampFeeUsd]), () => ( null));
|
|
7550
8032
|
const sponsoredFeeTooltip = "This fee is sponsored for this deposit.";
|
|
7551
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.";
|
|
7552
8034
|
const { rows: quoteFeeRows, chargeableUsd } = buildQuoteFeeRows(
|
|
7553
|
-
_optionalChain([quote, 'optionalAccess',
|
|
8035
|
+
_optionalChain([quote, 'optionalAccess', _474 => _474.fees, 'access', _475 => _475.breakdown]),
|
|
7554
8036
|
sponsoredFeeTooltip
|
|
7555
8037
|
);
|
|
7556
8038
|
const feeRows = [];
|
|
@@ -7583,6 +8065,7 @@ function ProcessingStep({
|
|
|
7583
8065
|
amountPaid,
|
|
7584
8066
|
depositedAmount,
|
|
7585
8067
|
depositedSymbol: targetSymbol,
|
|
8068
|
+
depositedToken: targetTokenRef,
|
|
7586
8069
|
feesTotal,
|
|
7587
8070
|
feeRows,
|
|
7588
8071
|
feesTooltip,
|
|
@@ -7609,7 +8092,7 @@ function ProcessingStep({
|
|
|
7609
8092
|
rel: "noopener noreferrer",
|
|
7610
8093
|
className: "rs-review-detail-link",
|
|
7611
8094
|
"aria-label": "View source transaction",
|
|
7612
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {})
|
|
8095
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ExternalLinkIcon, {})
|
|
7613
8096
|
}
|
|
7614
8097
|
)
|
|
7615
8098
|
] })
|
|
@@ -7627,7 +8110,7 @@ function ProcessingStep({
|
|
|
7627
8110
|
rel: "noopener noreferrer",
|
|
7628
8111
|
className: "rs-review-detail-link",
|
|
7629
8112
|
"aria-label": "View destination transaction",
|
|
7630
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {})
|
|
8113
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ExternalLinkIcon, {})
|
|
7631
8114
|
}
|
|
7632
8115
|
)
|
|
7633
8116
|
] })
|
|
@@ -7637,7 +8120,7 @@ function ProcessingStep({
|
|
|
7637
8120
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Ticker, { value: timerText }) })
|
|
7638
8121
|
] }),
|
|
7639
8122
|
isSwappedOrder ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
7640
|
-
_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
8123
|
+
_optionalChain([swappedFiatContext, 'optionalAccess', _476 => _476.paidAmountUsd]) != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
7641
8124
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "You pay" }),
|
|
7642
8125
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
7643
8126
|
"$",
|
|
@@ -7649,7 +8132,7 @@ function ProcessingStep({
|
|
|
7649
8132
|
] })
|
|
7650
8133
|
] })
|
|
7651
8134
|
] }),
|
|
7652
|
-
_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
8135
|
+
_optionalChain([swappedFiatContext, 'optionalAccess', _477 => _477.onrampFeeUsd]) != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
7653
8136
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "On-ramp fee" }),
|
|
7654
8137
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
7655
8138
|
"$",
|
|
@@ -7664,7 +8147,7 @@ function ProcessingStep({
|
|
|
7664
8147
|
" ",
|
|
7665
8148
|
sourceSymbol
|
|
7666
8149
|
] }),
|
|
7667
|
-
/* @__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 }) })
|
|
7668
8151
|
] })
|
|
7669
8152
|
] })
|
|
7670
8153
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -7675,14 +8158,14 @@ function ProcessingStep({
|
|
|
7675
8158
|
" ",
|
|
7676
8159
|
sourceSymbol
|
|
7677
8160
|
] }),
|
|
7678
|
-
/* @__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 }) })
|
|
7679
8162
|
] })
|
|
7680
8163
|
] }),
|
|
7681
8164
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
7682
8165
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: isProcessing ? "Receive" : "Received" }),
|
|
7683
8166
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
7684
8167
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: receiveDisplay }),
|
|
7685
|
-
/* @__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 }) })
|
|
7686
8169
|
] })
|
|
7687
8170
|
] }),
|
|
7688
8171
|
isFailed && balanceAfterUsd !== void 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -7711,12 +8194,12 @@ function ProcessingStep({
|
|
|
7711
8194
|
{
|
|
7712
8195
|
className: "rs-review-detail-info",
|
|
7713
8196
|
"aria-label": "Fee info",
|
|
7714
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfoIcon, {})
|
|
8197
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.InfoIcon, {})
|
|
7715
8198
|
}
|
|
7716
8199
|
) })
|
|
7717
8200
|
] })
|
|
7718
8201
|
] }) : (() => {
|
|
7719
|
-
const { display, struck } = quoteFeeRow(_optionalChain([quote, 'optionalAccess',
|
|
8202
|
+
const { display, struck } = quoteFeeRow(_optionalChain([quote, 'optionalAccess', _478 => _478.fees]));
|
|
7720
8203
|
if (display !== null) {
|
|
7721
8204
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
7722
8205
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fees" }),
|
|
@@ -7823,7 +8306,7 @@ var RECIPIENT_HINTS = {
|
|
|
7823
8306
|
stellar: "A Stellar destination needs a recipient account ID starting with G."
|
|
7824
8307
|
};
|
|
7825
8308
|
function recipientNamespace(targetChain) {
|
|
7826
|
-
return _nullishCoalesce(
|
|
8309
|
+
return _nullishCoalesce(_chunkFKJ6EJHHcjs.targetChainToCaip2.call(void 0, targetChain).split(":")[0], () => ( ""));
|
|
7827
8310
|
}
|
|
7828
8311
|
function recipientMatchesTarget(recipient, targetChain) {
|
|
7829
8312
|
const pattern = RECIPIENT_PATTERNS[recipientNamespace(targetChain)];
|
|
@@ -7833,7 +8316,7 @@ function deriveAccountSalt(input) {
|
|
|
7833
8316
|
return _viem.keccak256.call(void 0,
|
|
7834
8317
|
_viem.concat.call(void 0, [
|
|
7835
8318
|
_viem.keccak256.call(void 0, _viem.toHex.call(void 0, _nullishCoalesce(normalizeKeyToken(input.recipient), () => ( "")))),
|
|
7836
|
-
_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))),
|
|
7837
8320
|
_viem.keccak256.call(void 0, _viem.toHex.call(void 0, _nullishCoalesce(normalizeKeyToken(input.targetToken), () => ( ""))))
|
|
7838
8321
|
])
|
|
7839
8322
|
);
|
|
@@ -7867,7 +8350,7 @@ var setupRequestDedupe = /* @__PURE__ */ new Map();
|
|
|
7867
8350
|
function readDedupedAccountSetupResult(requestKey) {
|
|
7868
8351
|
const now = Date.now();
|
|
7869
8352
|
const existing = setupRequestDedupe.get(requestKey);
|
|
7870
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
8353
|
+
if (_optionalChain([existing, 'optionalAccess', _479 => _479.settled]) && existing.expiresAt > now && existing.result) {
|
|
7871
8354
|
return existing.result;
|
|
7872
8355
|
}
|
|
7873
8356
|
return null;
|
|
@@ -7898,10 +8381,10 @@ async function runAccountSetup(input, deps) {
|
|
|
7898
8381
|
const result = await service.registerManagedAccount({
|
|
7899
8382
|
salt,
|
|
7900
8383
|
target: {
|
|
7901
|
-
chain:
|
|
8384
|
+
chain: _chunkFKJ6EJHHcjs.targetChainToCaip2.call(void 0, input.targetChain),
|
|
7902
8385
|
token: input.targetToken,
|
|
7903
8386
|
recipient: input.recipient,
|
|
7904
|
-
..._optionalChain([input, 'access',
|
|
8387
|
+
..._optionalChain([input, 'access', _480 => _480.outputTokenRules, 'optionalAccess', _481 => _481.length]) && {
|
|
7905
8388
|
outputTokenRules: input.outputTokenRules
|
|
7906
8389
|
},
|
|
7907
8390
|
...input.rejectUnmapped != null && {
|
|
@@ -8076,16 +8559,4 @@ function mapError(error) {
|
|
|
8076
8559
|
|
|
8077
8560
|
|
|
8078
8561
|
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
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;
|