@rhinestone/deposit-modal 0.19.0 → 0.20.1
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 +154 -61
- package/dist/BankOnrampStep-3SNUX6V2.cjs +435 -0
- package/dist/BankOnrampStep-4D24HVHV.mjs +435 -0
- package/dist/{DepositModalReown-UITYXJ6W.cjs → DepositModalReown-7EHOJTFW.cjs} +21 -20
- package/dist/{DepositModalReown-XBNY6QCI.mjs → DepositModalReown-SYQ2SCHC.mjs} +6 -5
- package/dist/WithdrawModal-LLJLEYXZ.cjs +12 -0
- package/dist/WithdrawModal-LXDIT4UV.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-FTWKAJGN.mjs → chunk-2FOPO4N5.mjs} +1 -1
- package/dist/{chunk-EG4H7OMC.cjs → chunk-CIVFT5KR.cjs} +171 -130
- package/dist/{chunk-PYOC6K24.cjs → chunk-D3R3O4CY.cjs} +1 -1
- package/dist/chunk-E7IMWVMN.mjs +346 -0
- package/dist/chunk-EJDBIWNH.mjs +113 -0
- package/dist/chunk-FKJ6EJHH.cjs +346 -0
- package/dist/{chunk-LVCD6RHF.cjs → chunk-FVJKUTHF.cjs} +2 -2
- package/dist/{chunk-NITKDXHR.mjs → chunk-FW7ZMXQS.mjs} +849 -674
- package/dist/chunk-G264OM23.cjs +224 -0
- package/dist/chunk-IPHKBBUV.cjs +113 -0
- package/dist/{chunk-BIL4ENC3.mjs → chunk-IPKT3FU6.mjs} +73 -32
- package/dist/chunk-JPX4MEHV.mjs +19 -0
- package/dist/{chunk-HMUGY66O.cjs → chunk-KXSU24RU.cjs} +1569 -1019
- package/dist/{chunk-ISLVD5HQ.cjs → chunk-LVMNNMOZ.cjs} +10 -5
- package/dist/chunk-O5OW4S7L.cjs +19 -0
- package/dist/{chunk-5NWLS5BQ.mjs → chunk-OZPMRTW3.mjs} +1511 -961
- package/dist/{chunk-OCWSMLOP.cjs → chunk-PVFEZ3UG.cjs} +1164 -989
- package/dist/{chunk-ZGHVJ2XM.mjs → chunk-YQCRXJIL.mjs} +8 -3
- package/dist/chunk-YY4ZOAH5.mjs +224 -0
- package/dist/{chunk-X6N2XPTO.mjs → chunk-ZOJMB5TZ.mjs} +1 -1
- 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-BOxa1DE-.d.ts → types-BEEMfNi2.d.cts} +24 -4
- package/dist/{types-BShYNpvO.d.cts → types-DQDUqzsZ.d.ts} +24 -4
- 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 _chunkD3R3O4CYcjs = require('./chunk-D3R3O4CY.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,24 +405,72 @@ 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
|
|
|
426
|
+
// src/core/hosted-order.ts
|
|
427
|
+
var RANK = {
|
|
428
|
+
awaiting_payment: 0,
|
|
429
|
+
paying: 1,
|
|
430
|
+
paid: 2,
|
|
431
|
+
sent: 3
|
|
432
|
+
};
|
|
433
|
+
function hostedOrderState(order) {
|
|
434
|
+
const { receipt, conversion, delivery } = order.stages;
|
|
435
|
+
const deliveryTxHash = "txHash" in delivery ? delivery.txHash : null;
|
|
436
|
+
const outcome = order.status === "refunded" ? "refunded" : order.status === "failed" && !deliveryTxHash ? receipt.status === "failed" && receipt.reason === "cancelled" ? "cancelled" : "failed" : null;
|
|
437
|
+
const progress = deliveryTxHash ? "sent" : receipt.status === "completed" || conversion.status !== "not_started" ? "paid" : receipt.status === "processing" || receipt.status === "on_hold" ? "paying" : "awaiting_payment";
|
|
438
|
+
return { progress, outcome, deliveryTxHash };
|
|
439
|
+
}
|
|
440
|
+
function hostedOrderStateFromSwapped(status, txHash) {
|
|
441
|
+
const deliveryTxHash = _nullishCoalesce(txHash, () => ( null));
|
|
442
|
+
switch (status) {
|
|
443
|
+
case "payment_pending":
|
|
444
|
+
return { progress: "awaiting_payment", outcome: null, deliveryTxHash };
|
|
445
|
+
case "wallet_order_registered":
|
|
446
|
+
case "wallet_order_confirmed":
|
|
447
|
+
return { progress: "paying", outcome: null, deliveryTxHash };
|
|
448
|
+
case "order_completed":
|
|
449
|
+
return {
|
|
450
|
+
progress: deliveryTxHash ? "sent" : "paid",
|
|
451
|
+
outcome: null,
|
|
452
|
+
deliveryTxHash
|
|
453
|
+
};
|
|
454
|
+
case "order_broadcasted":
|
|
455
|
+
return { progress: "sent", outcome: null, deliveryTxHash };
|
|
456
|
+
case "order_cancelled":
|
|
457
|
+
return { progress: "awaiting_payment", outcome: "cancelled", deliveryTxHash };
|
|
458
|
+
default:
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function mergeHostedOrderState(previous, next) {
|
|
463
|
+
if (!previous) return next;
|
|
464
|
+
return {
|
|
465
|
+
progress: RANK[next.progress] >= RANK[previous.progress] ? next.progress : previous.progress,
|
|
466
|
+
outcome: _nullishCoalesce(next.outcome, () => ( previous.outcome)),
|
|
467
|
+
deliveryTxHash: _nullishCoalesce(next.deliveryTxHash, () => ( previous.deliveryTxHash))
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
function hasReached(state, progress) {
|
|
471
|
+
return state ? RANK[state.progress] >= RANK[progress] : false;
|
|
472
|
+
}
|
|
473
|
+
|
|
457
474
|
// src/core/deposit-asset-helpers.ts
|
|
458
475
|
function getAssetId(asset) {
|
|
459
476
|
return `${asset.chainId}:${asset.token.toLowerCase()}`;
|
|
@@ -598,7 +615,7 @@ function quoteFeeGroups(breakdown) {
|
|
|
598
615
|
const groups = /* @__PURE__ */ new Map();
|
|
599
616
|
for (const [category, line] of Object.entries(breakdown)) {
|
|
600
617
|
if (line.internal || !Number.isFinite(line.usd) || line.usd < 0) continue;
|
|
601
|
-
const label = _optionalChain([line, 'access',
|
|
618
|
+
const label = _optionalChain([line, 'access', _3 => _3.label, 'optionalAccess', _4 => _4.trim, 'call', _5 => _5()]) || titleCaseFeeCategory(category);
|
|
602
619
|
const group = _nullishCoalesce(groups.get(label), () => ( {
|
|
603
620
|
label,
|
|
604
621
|
chargedUsd: 0,
|
|
@@ -719,24 +736,14 @@ function parseFeeLine(raw) {
|
|
|
719
736
|
...line.internal !== void 0 && { internal: line.internal }
|
|
720
737
|
};
|
|
721
738
|
}
|
|
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
739
|
var UNSUPPORTED_CONNECT_EXCHANGES = /* @__PURE__ */ new Set(["kraken", "htx"]);
|
|
733
740
|
var SUPPORTED_CONNECT_EXCHANGE_COUNT = 7;
|
|
734
741
|
function isSupportedConnectExchange(exchange) {
|
|
735
742
|
return !UNSUPPORTED_CONNECT_EXCHANGES.has(exchange.connection.toLowerCase());
|
|
736
743
|
}
|
|
737
744
|
function resolveAppFeeBps(appFees, sourceChainCaip2, sourceToken) {
|
|
738
|
-
const override = _optionalChain([appFees, 'optionalAccess',
|
|
739
|
-
const bps = _nullishCoalesce(_nullishCoalesce(override, () => ( _optionalChain([appFees, 'optionalAccess',
|
|
745
|
+
const override = _optionalChain([appFees, 'optionalAccess', _6 => _6.tokens, 'optionalAccess', _7 => _7[sourceChainCaip2], 'optionalAccess', _8 => _8[sourceToken.toLowerCase()]]);
|
|
746
|
+
const bps = _nullishCoalesce(_nullishCoalesce(override, () => ( _optionalChain([appFees, 'optionalAccess', _9 => _9.feeBps]))), () => ( 0));
|
|
740
747
|
return bps > 0 ? bps : 0;
|
|
741
748
|
}
|
|
742
749
|
function isRawAmount(value) {
|
|
@@ -750,6 +757,10 @@ var DEPOSIT_POLICY_REFUSAL_CODES = [
|
|
|
750
757
|
"BALANCE-3",
|
|
751
758
|
"BALANCE-4"
|
|
752
759
|
];
|
|
760
|
+
var ASSET_LOOKUP_MAX_IDS = 100;
|
|
761
|
+
var ASSET_LOOKUP_MAX_URL_LENGTH = 2e3;
|
|
762
|
+
var ASSET_LOOKUP_TIMEOUT_MS = 8e3;
|
|
763
|
+
var ASSET_LOGO_PREFIX = "https://s3.rhinestone.dev/";
|
|
753
764
|
var DEPOSIT_PREFLIGHT_TIMEOUT_MS = 1e4;
|
|
754
765
|
async function readPolicyRefusal(response) {
|
|
755
766
|
if (response.status !== 422) return null;
|
|
@@ -780,8 +791,8 @@ var RegistrationError = class extends Error {
|
|
|
780
791
|
};
|
|
781
792
|
function createDepositService(baseUrl, options) {
|
|
782
793
|
const normalizedBaseUrl = baseUrl.replace(/\/$/, "");
|
|
783
|
-
const debug = _optionalChain([options, 'optionalAccess',
|
|
784
|
-
const scope = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
794
|
+
const debug = _optionalChain([options, 'optionalAccess', _10 => _10.debug]) === true;
|
|
795
|
+
const scope = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _11 => _11.debugScope]), () => ( "service"));
|
|
785
796
|
function apiUrl(path) {
|
|
786
797
|
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
787
798
|
return `${normalizedBaseUrl}${normalizedPath}`;
|
|
@@ -790,16 +801,14 @@ function createDepositService(baseUrl, options) {
|
|
|
790
801
|
if (value.length <= 20) return value;
|
|
791
802
|
return `${value.slice(0, 10)}...${value.slice(-8)}`;
|
|
792
803
|
}
|
|
793
|
-
function withPreflightTimeout(label, fallback, run) {
|
|
804
|
+
function withPreflightTimeout(label, fallback, run, timeoutMs = DEPOSIT_PREFLIGHT_TIMEOUT_MS) {
|
|
794
805
|
const controller = new AbortController();
|
|
795
806
|
return new Promise((resolve) => {
|
|
796
807
|
const timer = setTimeout(() => {
|
|
797
|
-
debugLog(debug, scope, `${label}:timeout`, {
|
|
798
|
-
timeoutMs: DEPOSIT_PREFLIGHT_TIMEOUT_MS
|
|
799
|
-
});
|
|
808
|
+
debugLog(debug, scope, `${label}:timeout`, { timeoutMs });
|
|
800
809
|
controller.abort();
|
|
801
810
|
resolve(fallback);
|
|
802
|
-
},
|
|
811
|
+
}, timeoutMs);
|
|
803
812
|
run(controller.signal).then(
|
|
804
813
|
(value) => {
|
|
805
814
|
clearTimeout(timer);
|
|
@@ -814,6 +823,85 @@ function createDepositService(baseUrl, options) {
|
|
|
814
823
|
}
|
|
815
824
|
const PORTFOLIO_CACHE_TTL_MS = 3e4;
|
|
816
825
|
const portfolioCache = /* @__PURE__ */ new Map();
|
|
826
|
+
let assetsRouteMissing = false;
|
|
827
|
+
let assetsQueryUnsupported = false;
|
|
828
|
+
function assetsGetUrl(ids, fields) {
|
|
829
|
+
return apiUrl(
|
|
830
|
+
`/assets?${new URLSearchParams({
|
|
831
|
+
ids: ids.join(","),
|
|
832
|
+
fields: fields.join(",")
|
|
833
|
+
}).toString()}`
|
|
834
|
+
);
|
|
835
|
+
}
|
|
836
|
+
function requestAssets(method, ids, fields) {
|
|
837
|
+
const failed = { ok: false, status: null };
|
|
838
|
+
return withPreflightTimeout(
|
|
839
|
+
`lookupAssets:${method}`,
|
|
840
|
+
failed,
|
|
841
|
+
async (signal) => {
|
|
842
|
+
const response = await fetch(
|
|
843
|
+
method === "GET" ? assetsGetUrl(ids, fields) : apiUrl("/assets"),
|
|
844
|
+
{
|
|
845
|
+
method,
|
|
846
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
847
|
+
body: method === "QUERY" ? JSON.stringify({ ids, fields }) : void 0,
|
|
848
|
+
cache: "no-store",
|
|
849
|
+
signal
|
|
850
|
+
}
|
|
851
|
+
);
|
|
852
|
+
if (response.status !== 200) {
|
|
853
|
+
debugError(debug, scope, "lookupAssets:failed", {
|
|
854
|
+
method,
|
|
855
|
+
status: response.status
|
|
856
|
+
});
|
|
857
|
+
return { ok: false, status: response.status };
|
|
858
|
+
}
|
|
859
|
+
const body = await response.json().catch(() => null);
|
|
860
|
+
const data = _optionalChain([body, 'optionalAccess', _12 => _12.data]);
|
|
861
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) {
|
|
862
|
+
debugError(debug, scope, "lookupAssets:malformed", { method });
|
|
863
|
+
return failed;
|
|
864
|
+
}
|
|
865
|
+
return { ok: true, data };
|
|
866
|
+
},
|
|
867
|
+
ASSET_LOOKUP_TIMEOUT_MS
|
|
868
|
+
);
|
|
869
|
+
}
|
|
870
|
+
function chunkForGet(ids, fields) {
|
|
871
|
+
const chunks = [];
|
|
872
|
+
let current = [];
|
|
873
|
+
for (const id of ids) {
|
|
874
|
+
const next = [...current, id];
|
|
875
|
+
if (current.length > 0 && assetsGetUrl(next, fields).length > ASSET_LOOKUP_MAX_URL_LENGTH) {
|
|
876
|
+
chunks.push(current);
|
|
877
|
+
current = [id];
|
|
878
|
+
} else {
|
|
879
|
+
current = next;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
if (current.length > 0) chunks.push(current);
|
|
883
|
+
return chunks;
|
|
884
|
+
}
|
|
885
|
+
async function lookupAssetsViaGet(ids, fields) {
|
|
886
|
+
const data = {};
|
|
887
|
+
for (const chunk of chunkForGet(ids, fields)) {
|
|
888
|
+
const outcome = await requestAssets("GET", chunk, fields);
|
|
889
|
+
if (!outcome.ok) return outcome;
|
|
890
|
+
Object.assign(data, outcome.data);
|
|
891
|
+
}
|
|
892
|
+
return { ok: true, data };
|
|
893
|
+
}
|
|
894
|
+
async function lookupAssetsBatch(ids, fields) {
|
|
895
|
+
const fitsGet = assetsGetUrl(ids, fields).length <= ASSET_LOOKUP_MAX_URL_LENGTH;
|
|
896
|
+
if (fitsGet || assetsQueryUnsupported) {
|
|
897
|
+
return lookupAssetsViaGet(ids, fields);
|
|
898
|
+
}
|
|
899
|
+
const viaQuery = await requestAssets("QUERY", ids, fields);
|
|
900
|
+
if (viaQuery.ok) return viaQuery;
|
|
901
|
+
const viaGet = await lookupAssetsViaGet(ids, fields);
|
|
902
|
+
if (viaGet.ok) assetsQueryUnsupported = true;
|
|
903
|
+
return viaGet;
|
|
904
|
+
}
|
|
817
905
|
let topTokensPromise = null;
|
|
818
906
|
let chainsPromise = null;
|
|
819
907
|
function parseDepositOptions(value) {
|
|
@@ -849,7 +937,7 @@ function createDepositService(baseUrl, options) {
|
|
|
849
937
|
try {
|
|
850
938
|
const response = await fetch(apiUrl("/qr/tokens"), {
|
|
851
939
|
method: "GET",
|
|
852
|
-
headers:
|
|
940
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, )
|
|
853
941
|
});
|
|
854
942
|
if (!response.ok) {
|
|
855
943
|
debugLog(debug, scope, "getTopTokens:unavailable", {
|
|
@@ -876,7 +964,7 @@ function createDepositService(baseUrl, options) {
|
|
|
876
964
|
try {
|
|
877
965
|
const response = await fetch(apiUrl("/chains"), {
|
|
878
966
|
method: "GET",
|
|
879
|
-
headers:
|
|
967
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, )
|
|
880
968
|
});
|
|
881
969
|
if (!response.ok) {
|
|
882
970
|
debugLog(debug, scope, "getChains:unavailable", {
|
|
@@ -907,7 +995,7 @@ function createDepositService(baseUrl, options) {
|
|
|
907
995
|
}
|
|
908
996
|
let promise;
|
|
909
997
|
promise = fetcher().catch((err) => {
|
|
910
|
-
if (_optionalChain([portfolioCache, 'access',
|
|
998
|
+
if (_optionalChain([portfolioCache, 'access', _13 => _13.get, 'call', _14 => _14(key), 'optionalAccess', _15 => _15.promise]) === promise) {
|
|
911
999
|
portfolioCache.delete(key);
|
|
912
1000
|
}
|
|
913
1001
|
throw err;
|
|
@@ -918,6 +1006,39 @@ function createDepositService(baseUrl, options) {
|
|
|
918
1006
|
});
|
|
919
1007
|
return promise;
|
|
920
1008
|
}
|
|
1009
|
+
async function startSwappedCheckout(kind, account, fields) {
|
|
1010
|
+
const label = kind === "fiat" ? "Swapped widget URL" : "Swapped Connect URL";
|
|
1011
|
+
const response = await fetch(apiUrl("/onramp/orders"), {
|
|
1012
|
+
method: "POST",
|
|
1013
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1014
|
+
body: JSON.stringify({
|
|
1015
|
+
provider: "swapped",
|
|
1016
|
+
kind,
|
|
1017
|
+
account,
|
|
1018
|
+
...fields
|
|
1019
|
+
})
|
|
1020
|
+
});
|
|
1021
|
+
if (!response.ok) {
|
|
1022
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1023
|
+
debugError(debug, scope, "startSwappedCheckout:failed", error, {
|
|
1024
|
+
status: response.status,
|
|
1025
|
+
kind
|
|
1026
|
+
});
|
|
1027
|
+
throw new Error(
|
|
1028
|
+
typeof error.error === "string" && error.error || `${label} failed: ${response.status}`
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
1031
|
+
const body = await response.json().catch(() => null);
|
|
1032
|
+
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") {
|
|
1033
|
+
throw new Error(`${label}: malformed response`);
|
|
1034
|
+
}
|
|
1035
|
+
return {
|
|
1036
|
+
orderId: body.orderId,
|
|
1037
|
+
url: body.nextAction.url,
|
|
1038
|
+
externalCustomerId: `${account.toLowerCase()}:${body.orderId}`,
|
|
1039
|
+
expiresAt: typeof body.expiresAt === "string" ? body.expiresAt : void 0
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
921
1042
|
return {
|
|
922
1043
|
async registerManagedAccount(params) {
|
|
923
1044
|
const url = apiUrl("/register-managed");
|
|
@@ -930,7 +1051,7 @@ function createDepositService(baseUrl, options) {
|
|
|
930
1051
|
});
|
|
931
1052
|
const response = await fetch(url, {
|
|
932
1053
|
method: "POST",
|
|
933
|
-
headers:
|
|
1054
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
934
1055
|
body: JSON.stringify({ account: params })
|
|
935
1056
|
});
|
|
936
1057
|
if (!response.ok) {
|
|
@@ -939,7 +1060,7 @@ function createDepositService(baseUrl, options) {
|
|
|
939
1060
|
status: response.status,
|
|
940
1061
|
salt: params.salt
|
|
941
1062
|
});
|
|
942
|
-
const detail = Array.isArray(error.details) ? error.details.map((d) => _optionalChain([d, 'optionalAccess',
|
|
1063
|
+
const detail = Array.isArray(error.details) ? error.details.map((d) => _optionalChain([d, 'optionalAccess', _19 => _19.message])).filter(Boolean).join("; ") : void 0;
|
|
943
1064
|
const base = error.error || `Account registration failed: ${response.status}`;
|
|
944
1065
|
throw new RegistrationError(
|
|
945
1066
|
detail ? `${base}: ${detail}` : base,
|
|
@@ -948,13 +1069,13 @@ function createDepositService(baseUrl, options) {
|
|
|
948
1069
|
}
|
|
949
1070
|
const result = await response.json();
|
|
950
1071
|
debugLog(debug, scope, "registerManagedAccount:success", {
|
|
951
|
-
evmDepositAddress: _optionalChain([result, 'optionalAccess',
|
|
952
|
-
hasSolanaDepositAddress: Boolean(_optionalChain([result, 'optionalAccess',
|
|
953
|
-
hasTronDepositAddress: Boolean(_optionalChain([result, 'optionalAccess',
|
|
1072
|
+
evmDepositAddress: _optionalChain([result, 'optionalAccess', _20 => _20.evmDepositAddress]),
|
|
1073
|
+
hasSolanaDepositAddress: Boolean(_optionalChain([result, 'optionalAccess', _21 => _21.solanaDepositAddress])),
|
|
1074
|
+
hasTronDepositAddress: Boolean(_optionalChain([result, 'optionalAccess', _22 => _22.tronDepositAddress]))
|
|
954
1075
|
});
|
|
955
1076
|
return {
|
|
956
1077
|
...result,
|
|
957
|
-
evmDepositAddress: normalizeEvmAddress(_optionalChain([result, 'optionalAccess',
|
|
1078
|
+
evmDepositAddress: normalizeEvmAddress(_optionalChain([result, 'optionalAccess', _23 => _23.evmDepositAddress]))
|
|
958
1079
|
};
|
|
959
1080
|
},
|
|
960
1081
|
async fetchPortfolio(address, options2) {
|
|
@@ -965,7 +1086,7 @@ function createDepositService(baseUrl, options) {
|
|
|
965
1086
|
debugLog(debug, scope, "fetchPortfolio:request", { url, address });
|
|
966
1087
|
const response = await fetch(url, {
|
|
967
1088
|
method: "GET",
|
|
968
|
-
headers:
|
|
1089
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, )
|
|
969
1090
|
});
|
|
970
1091
|
if (!response.ok) {
|
|
971
1092
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -1002,7 +1123,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1002
1123
|
debugLog(debug, scope, "fetchPortfolio:empty", { address });
|
|
1003
1124
|
return { tokens: [], totalUsd: 0 };
|
|
1004
1125
|
},
|
|
1005
|
-
_optionalChain([options2, 'optionalAccess',
|
|
1126
|
+
_optionalChain([options2, 'optionalAccess', _24 => _24.forceRefresh])
|
|
1006
1127
|
);
|
|
1007
1128
|
},
|
|
1008
1129
|
async fetchSolanaPortfolio(address, options2) {
|
|
@@ -1016,7 +1137,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1016
1137
|
});
|
|
1017
1138
|
const response = await fetch(url, {
|
|
1018
1139
|
method: "GET",
|
|
1019
|
-
headers:
|
|
1140
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, )
|
|
1020
1141
|
});
|
|
1021
1142
|
if (!response.ok) {
|
|
1022
1143
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -1037,7 +1158,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1037
1158
|
});
|
|
1038
1159
|
return normalized;
|
|
1039
1160
|
},
|
|
1040
|
-
_optionalChain([options2, 'optionalAccess',
|
|
1161
|
+
_optionalChain([options2, 'optionalAccess', _25 => _25.forceRefresh])
|
|
1041
1162
|
);
|
|
1042
1163
|
},
|
|
1043
1164
|
async checkAccount(address) {
|
|
@@ -1045,7 +1166,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1045
1166
|
debugLog(debug, scope, "checkAccount:request", { url, address });
|
|
1046
1167
|
const response = await fetch(url, {
|
|
1047
1168
|
method: "GET",
|
|
1048
|
-
headers:
|
|
1169
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, )
|
|
1049
1170
|
});
|
|
1050
1171
|
if (!response.ok) {
|
|
1051
1172
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -1059,9 +1180,9 @@ function createDepositService(baseUrl, options) {
|
|
|
1059
1180
|
}
|
|
1060
1181
|
const data = await response.json();
|
|
1061
1182
|
const result = {
|
|
1062
|
-
isRegistered: _optionalChain([data, 'optionalAccess',
|
|
1063
|
-
targetChain: _optionalChain([data, 'optionalAccess',
|
|
1064
|
-
targetToken: _optionalChain([data, 'optionalAccess',
|
|
1183
|
+
isRegistered: _optionalChain([data, 'optionalAccess', _26 => _26.isRegistered]) === true,
|
|
1184
|
+
targetChain: _optionalChain([data, 'optionalAccess', _27 => _27.targetChain]),
|
|
1185
|
+
targetToken: _optionalChain([data, 'optionalAccess', _28 => _28.targetToken])
|
|
1065
1186
|
};
|
|
1066
1187
|
debugLog(debug, scope, "checkAccount:success", {
|
|
1067
1188
|
address,
|
|
@@ -1081,7 +1202,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1081
1202
|
);
|
|
1082
1203
|
const response = await fetch(url, {
|
|
1083
1204
|
method: "GET",
|
|
1084
|
-
headers:
|
|
1205
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1085
1206
|
cache: "no-store"
|
|
1086
1207
|
});
|
|
1087
1208
|
if (!response.ok) {
|
|
@@ -1093,12 +1214,12 @@ function createDepositService(baseUrl, options) {
|
|
|
1093
1214
|
return { lastEvent: void 0 };
|
|
1094
1215
|
}
|
|
1095
1216
|
const body = await response.json();
|
|
1096
|
-
const row = _optionalChain([body, 'access',
|
|
1217
|
+
const row = _optionalChain([body, 'access', _29 => _29.deposits, 'optionalAccess', _30 => _30[0]]);
|
|
1097
1218
|
const lastEvent = row ? depositRowToEvent(row) : void 0;
|
|
1098
1219
|
debugLog(debug, scope, "fetchStatus:success", {
|
|
1099
1220
|
address,
|
|
1100
1221
|
txHash: shortRef(normalized),
|
|
1101
|
-
eventType: _optionalChain([lastEvent, 'optionalAccess',
|
|
1222
|
+
eventType: _optionalChain([lastEvent, 'optionalAccess', _31 => _31.type])
|
|
1102
1223
|
});
|
|
1103
1224
|
return { lastEvent };
|
|
1104
1225
|
},
|
|
@@ -1109,7 +1230,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1109
1230
|
);
|
|
1110
1231
|
const response = await fetch(url, {
|
|
1111
1232
|
method: "GET",
|
|
1112
|
-
headers:
|
|
1233
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1113
1234
|
cache: "no-store"
|
|
1114
1235
|
});
|
|
1115
1236
|
if (!response.ok) {
|
|
@@ -1133,7 +1254,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1133
1254
|
);
|
|
1134
1255
|
const response = await fetch(url, {
|
|
1135
1256
|
method: "GET",
|
|
1136
|
-
headers:
|
|
1257
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1137
1258
|
cache: "no-store"
|
|
1138
1259
|
});
|
|
1139
1260
|
if (!response.ok) {
|
|
@@ -1144,18 +1265,18 @@ function createDepositService(baseUrl, options) {
|
|
|
1144
1265
|
return { lastEvent: void 0 };
|
|
1145
1266
|
}
|
|
1146
1267
|
const body = await response.json();
|
|
1147
|
-
const row = _optionalChain([body, 'access',
|
|
1268
|
+
const row = _optionalChain([body, 'access', _32 => _32.deposits, 'optionalAccess', _33 => _33[0]]);
|
|
1148
1269
|
const lastEvent = row ? depositRowToEvent(row) : void 0;
|
|
1149
1270
|
debugLog(debug, scope, "fetchLatestStatus:success", {
|
|
1150
1271
|
address,
|
|
1151
|
-
eventType: _optionalChain([lastEvent, 'optionalAccess',
|
|
1272
|
+
eventType: _optionalChain([lastEvent, 'optionalAccess', _34 => _34.type])
|
|
1152
1273
|
});
|
|
1153
1274
|
return { lastEvent };
|
|
1154
1275
|
},
|
|
1155
1276
|
async getPositions(address) {
|
|
1156
1277
|
const url = apiUrl(`/positions/${address}`);
|
|
1157
1278
|
debugLog(debug, scope, "getPositions:request", { url, address });
|
|
1158
|
-
const response = await fetch(url, { headers:
|
|
1279
|
+
const response = await fetch(url, { headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ) });
|
|
1159
1280
|
if (!response.ok) {
|
|
1160
1281
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1161
1282
|
debugError(debug, scope, "getPositions:failed", error, {
|
|
@@ -1169,9 +1290,9 @@ function createDepositService(baseUrl, options) {
|
|
|
1169
1290
|
const result = await response.json();
|
|
1170
1291
|
debugLog(debug, scope, "getPositions:success", {
|
|
1171
1292
|
address,
|
|
1172
|
-
count: _nullishCoalesce(_optionalChain([result, 'access',
|
|
1293
|
+
count: _nullishCoalesce(_optionalChain([result, 'access', _35 => _35.positions, 'optionalAccess', _36 => _36.length]), () => ( 0)),
|
|
1173
1294
|
totalUsd: result.totalUsd,
|
|
1174
|
-
failures: _optionalChain([result, 'access',
|
|
1295
|
+
failures: _optionalChain([result, 'access', _37 => _37.failures, 'optionalAccess', _38 => _38.map, 'call', _39 => _39((f) => f.venue)])
|
|
1175
1296
|
});
|
|
1176
1297
|
return result;
|
|
1177
1298
|
},
|
|
@@ -1189,7 +1310,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1189
1310
|
});
|
|
1190
1311
|
const response = await fetch(url, {
|
|
1191
1312
|
method: "POST",
|
|
1192
|
-
headers:
|
|
1313
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1193
1314
|
body: JSON.stringify({ account, market, chainId, asset, amount })
|
|
1194
1315
|
});
|
|
1195
1316
|
if (!response.ok) {
|
|
@@ -1225,7 +1346,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1225
1346
|
});
|
|
1226
1347
|
const response = await fetch(url, {
|
|
1227
1348
|
method: "POST",
|
|
1228
|
-
headers:
|
|
1349
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1229
1350
|
body: JSON.stringify({
|
|
1230
1351
|
depositWallet,
|
|
1231
1352
|
owner,
|
|
@@ -1249,7 +1370,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1249
1370
|
const result = await response.json();
|
|
1250
1371
|
debugLog(debug, scope, "submitPolymarketWithdraw:success", {
|
|
1251
1372
|
depositWallet,
|
|
1252
|
-
txHash: _optionalChain([result, 'optionalAccess',
|
|
1373
|
+
txHash: _optionalChain([result, 'optionalAccess', _40 => _40.txHash]) ? shortRef(result.txHash) : void 0
|
|
1253
1374
|
});
|
|
1254
1375
|
return result;
|
|
1255
1376
|
},
|
|
@@ -1267,7 +1388,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1267
1388
|
});
|
|
1268
1389
|
const response = await fetch(url, {
|
|
1269
1390
|
method: "GET",
|
|
1270
|
-
headers:
|
|
1391
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1271
1392
|
cache: "no-store"
|
|
1272
1393
|
});
|
|
1273
1394
|
if (!response.ok) {
|
|
@@ -1281,8 +1402,8 @@ function createDepositService(baseUrl, options) {
|
|
|
1281
1402
|
);
|
|
1282
1403
|
}
|
|
1283
1404
|
const data = await response.json();
|
|
1284
|
-
const deposits = Array.isArray(_optionalChain([data, 'optionalAccess',
|
|
1285
|
-
const nextCursor = _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
1405
|
+
const deposits = Array.isArray(_optionalChain([data, 'optionalAccess', _41 => _41.deposits])) ? data.deposits.map(normalizeHistoryTiming) : [];
|
|
1406
|
+
const nextCursor = _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _42 => _42.nextCursor]), () => ( _optionalChain([data, 'optionalAccess', _43 => _43.next_cursor]))), () => ( null));
|
|
1286
1407
|
debugLog(debug, scope, "fetchDepositHistory:success", {
|
|
1287
1408
|
recipient: shortRef(params.recipient),
|
|
1288
1409
|
count: deposits.length,
|
|
@@ -1291,18 +1412,18 @@ function createDepositService(baseUrl, options) {
|
|
|
1291
1412
|
return { deposits, nextCursor };
|
|
1292
1413
|
},
|
|
1293
1414
|
async checkLiquidity(params) {
|
|
1294
|
-
if (
|
|
1295
|
-
const token =
|
|
1415
|
+
if (_chunkFKJ6EJHHcjs.isSolanaCaip2.call(void 0, params.destinationChainId) || params.destinationChainId === "solana") {
|
|
1416
|
+
const token = resolveSolanaToken(params.destinationToken);
|
|
1296
1417
|
return {
|
|
1297
1418
|
hasLiquidity: true,
|
|
1298
|
-
symbol: _nullishCoalesce(_optionalChain([token, 'optionalAccess',
|
|
1299
|
-
decimals: _nullishCoalesce(_optionalChain([token, 'optionalAccess',
|
|
1419
|
+
symbol: _nullishCoalesce(_optionalChain([token, 'optionalAccess', _44 => _44.symbol]), () => ( "Token")),
|
|
1420
|
+
decimals: _nullishCoalesce(_optionalChain([token, 'optionalAccess', _45 => _45.decimals]), () => ( 9)),
|
|
1300
1421
|
unlimited: true,
|
|
1301
1422
|
maxAmount: null
|
|
1302
1423
|
};
|
|
1303
1424
|
}
|
|
1304
1425
|
const searchParams = new URLSearchParams({
|
|
1305
|
-
sourceChainId:
|
|
1426
|
+
sourceChainId: _chunkFKJ6EJHHcjs.toEvmCaip2.call(void 0, params.sourceChainId),
|
|
1306
1427
|
sourceToken: params.sourceToken,
|
|
1307
1428
|
destinationChainId: params.destinationChainId,
|
|
1308
1429
|
destinationToken: params.destinationToken,
|
|
@@ -1317,7 +1438,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1317
1438
|
});
|
|
1318
1439
|
const response = await fetch(url, {
|
|
1319
1440
|
method: "GET",
|
|
1320
|
-
headers:
|
|
1441
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1321
1442
|
cache: "no-store"
|
|
1322
1443
|
});
|
|
1323
1444
|
if (!response.ok) {
|
|
@@ -1352,7 +1473,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1352
1473
|
// The branch is unreachable against today's processor whatever venue it
|
|
1353
1474
|
// names: `sourceToken` is validated as a 20-byte 0x address on every
|
|
1354
1475
|
// chain, and a HyperCore source token is a 16-byte Core spot tokenId.
|
|
1355
|
-
sourceChainId: params.sourceChainId === "hypercore" ?
|
|
1476
|
+
sourceChainId: params.sourceChainId === "hypercore" ? _chunkFKJ6EJHHcjs.HYPERCORE_SPOT_CAIP2 : `eip155:${params.sourceChainId}`,
|
|
1356
1477
|
sourceToken: params.sourceToken,
|
|
1357
1478
|
// Each direction carries its own amount field and omits the other, which
|
|
1358
1479
|
// is what the processor's "exactly one of" refinement checks. Sending
|
|
@@ -1371,7 +1492,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1371
1492
|
try {
|
|
1372
1493
|
const response = await fetch(url, {
|
|
1373
1494
|
method: "POST",
|
|
1374
|
-
headers:
|
|
1495
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1375
1496
|
body: JSON.stringify(body),
|
|
1376
1497
|
cache: "no-store",
|
|
1377
1498
|
signal
|
|
@@ -1421,7 +1542,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1421
1542
|
try {
|
|
1422
1543
|
const response = await fetch(url, {
|
|
1423
1544
|
method: "POST",
|
|
1424
|
-
headers:
|
|
1545
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1425
1546
|
body: JSON.stringify({ ...params, kind: "auto" }),
|
|
1426
1547
|
cache: "no-store",
|
|
1427
1548
|
signal
|
|
@@ -1524,7 +1645,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1524
1645
|
try {
|
|
1525
1646
|
response = await fetch(url, {
|
|
1526
1647
|
method: "POST",
|
|
1527
|
-
headers:
|
|
1648
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1528
1649
|
body: JSON.stringify(params)
|
|
1529
1650
|
});
|
|
1530
1651
|
} catch (error) {
|
|
@@ -1546,7 +1667,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1546
1667
|
);
|
|
1547
1668
|
}
|
|
1548
1669
|
const result = await response.json();
|
|
1549
|
-
if (typeof _optionalChain([result, 'optionalAccess',
|
|
1670
|
+
if (typeof _optionalChain([result, 'optionalAccess', _46 => _46.txHash]) !== "string" || result.txHash.length === 0) {
|
|
1550
1671
|
debugError(debug, scope, "submitPermitDeposit:failed", result, {
|
|
1551
1672
|
reason: "missing txHash"
|
|
1552
1673
|
});
|
|
@@ -1566,142 +1687,49 @@ function createDepositService(baseUrl, options) {
|
|
|
1566
1687
|
status: _nullishCoalesce(result.status, () => ( "processing"))
|
|
1567
1688
|
};
|
|
1568
1689
|
},
|
|
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 {};
|
|
1690
|
+
async lookupAssets(ids, fields) {
|
|
1691
|
+
const unique = [...new Set(ids.filter((id) => id.length > 0))];
|
|
1692
|
+
if (unique.length === 0) return { ok: true, items: {} };
|
|
1693
|
+
if (assetsRouteMissing) return { ok: false, routeMissing: true };
|
|
1694
|
+
const items = {};
|
|
1695
|
+
for (let i = 0; i < unique.length; i += ASSET_LOOKUP_MAX_IDS) {
|
|
1696
|
+
const batch = unique.slice(i, i + ASSET_LOOKUP_MAX_IDS);
|
|
1697
|
+
const outcome = await lookupAssetsBatch(batch, fields);
|
|
1698
|
+
if (!outcome.ok) {
|
|
1699
|
+
const routeMissing = outcome.status === 404 || outcome.status === 405;
|
|
1700
|
+
if (routeMissing) assetsRouteMissing = true;
|
|
1701
|
+
return { ok: false, routeMissing };
|
|
1586
1702
|
}
|
|
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 {};
|
|
1703
|
+
for (const id of batch) {
|
|
1704
|
+
const item = parseAssetItem(outcome.data[id], fields);
|
|
1705
|
+
if (item) items[id] = item;
|
|
1618
1706
|
}
|
|
1619
|
-
const data = await response.json();
|
|
1620
|
-
return _nullishCoalesce(data.prices, () => ( {}));
|
|
1621
|
-
} catch (err) {
|
|
1622
|
-
debugError(debug, scope, "fetchPricesByAddress:error", err);
|
|
1623
|
-
return {};
|
|
1624
1707
|
}
|
|
1708
|
+
return { ok: true, items };
|
|
1625
1709
|
},
|
|
1626
1710
|
async getSwappedWidgetUrl(params) {
|
|
1627
|
-
const
|
|
1711
|
+
const { smartAccount, ...fields } = params;
|
|
1628
1712
|
debugLog(debug, scope, "getSwappedWidgetUrl:request", {
|
|
1629
|
-
smartAccount: shortRef(
|
|
1713
|
+
smartAccount: shortRef(smartAccount),
|
|
1630
1714
|
method: params.method,
|
|
1631
1715
|
methodSelectionSource: params.methodSelectionSource
|
|
1632
1716
|
});
|
|
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
|
-
};
|
|
1717
|
+
return startSwappedCheckout("fiat", smartAccount, fields);
|
|
1658
1718
|
},
|
|
1659
1719
|
async getSwappedConnectUrl(params) {
|
|
1660
|
-
const
|
|
1720
|
+
const { smartAccount, ...fields } = params;
|
|
1661
1721
|
debugLog(debug, scope, "getSwappedConnectUrl:request", {
|
|
1662
|
-
smartAccount: shortRef(
|
|
1722
|
+
smartAccount: shortRef(smartAccount),
|
|
1663
1723
|
connection: params.connection
|
|
1664
1724
|
});
|
|
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
|
-
};
|
|
1725
|
+
return startSwappedCheckout("exchange", smartAccount, fields);
|
|
1698
1726
|
},
|
|
1699
1727
|
async getSwappedConnectExchanges() {
|
|
1700
|
-
const url = apiUrl("/onramp/swapped
|
|
1728
|
+
const url = apiUrl("/onramp/options?provider=swapped&kind=exchange");
|
|
1701
1729
|
debugLog(debug, scope, "getSwappedConnectExchanges:request");
|
|
1702
1730
|
const response = await fetch(url, {
|
|
1703
1731
|
method: "GET",
|
|
1704
|
-
headers:
|
|
1732
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1705
1733
|
cache: "no-store"
|
|
1706
1734
|
});
|
|
1707
1735
|
if (!response.ok) {
|
|
@@ -1714,7 +1742,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1714
1742
|
);
|
|
1715
1743
|
}
|
|
1716
1744
|
const body = await response.json();
|
|
1717
|
-
const rawExchanges = Array.isArray(body.
|
|
1745
|
+
const rawExchanges = Array.isArray(body.connections) ? body.connections : null;
|
|
1718
1746
|
const exchanges = [];
|
|
1719
1747
|
let hasMalformedExchange = rawExchanges === null;
|
|
1720
1748
|
for (const exchange of _nullishCoalesce(rawExchanges, () => ( []))) {
|
|
@@ -1732,16 +1760,36 @@ function createDepositService(baseUrl, options) {
|
|
|
1732
1760
|
}
|
|
1733
1761
|
exchanges.push({ connection, name, logoUrl });
|
|
1734
1762
|
}
|
|
1735
|
-
if (hasMalformedExchange
|
|
1763
|
+
if (hasMalformedExchange) {
|
|
1736
1764
|
throw new Error("Swapped Connect exchanges: malformed response");
|
|
1737
1765
|
}
|
|
1738
|
-
return {
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1766
|
+
return { exchanges: exchanges.filter(isSupportedConnectExchange) };
|
|
1767
|
+
},
|
|
1768
|
+
async getOnrampProviders() {
|
|
1769
|
+
try {
|
|
1770
|
+
const response = await fetch(apiUrl("/onramp/providers"), {
|
|
1771
|
+
method: "GET",
|
|
1772
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1773
|
+
cache: "no-store"
|
|
1774
|
+
});
|
|
1775
|
+
if (!response.ok) return null;
|
|
1776
|
+
const body = await response.json();
|
|
1777
|
+
if (!Array.isArray(body.providers)) return null;
|
|
1778
|
+
return body.providers.flatMap((raw) => {
|
|
1779
|
+
const p = raw;
|
|
1780
|
+
return (p.provider === "swapped" || p.provider === "noah") && (p.flow === "hosted" || p.flow === "funding_account") && Array.isArray(p.kinds) ? [
|
|
1781
|
+
{
|
|
1782
|
+
provider: p.provider,
|
|
1783
|
+
flow: p.flow,
|
|
1784
|
+
kinds: p.kinds.filter(
|
|
1785
|
+
(k) => k === "fiat" || k === "exchange"
|
|
1786
|
+
)
|
|
1787
|
+
}
|
|
1788
|
+
] : [];
|
|
1789
|
+
});
|
|
1790
|
+
} catch (e5) {
|
|
1791
|
+
return null;
|
|
1792
|
+
}
|
|
1745
1793
|
},
|
|
1746
1794
|
async getSwappedPaymentMethods() {
|
|
1747
1795
|
const empty = {
|
|
@@ -1749,12 +1797,12 @@ function createDepositService(baseUrl, options) {
|
|
|
1749
1797
|
methods: [],
|
|
1750
1798
|
recommendedMethod: null
|
|
1751
1799
|
};
|
|
1752
|
-
const url = apiUrl("/onramp/swapped
|
|
1800
|
+
const url = apiUrl("/onramp/options?provider=swapped&kind=fiat");
|
|
1753
1801
|
debugLog(debug, scope, "getSwappedPaymentMethods:request");
|
|
1754
1802
|
try {
|
|
1755
1803
|
const response = await fetch(url, {
|
|
1756
1804
|
method: "GET",
|
|
1757
|
-
headers:
|
|
1805
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1758
1806
|
cache: "no-store"
|
|
1759
1807
|
});
|
|
1760
1808
|
if (!response.ok) {
|
|
@@ -1842,7 +1890,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1842
1890
|
try {
|
|
1843
1891
|
const response = await fetch(url, {
|
|
1844
1892
|
method: "GET",
|
|
1845
|
-
headers:
|
|
1893
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1846
1894
|
cache: "no-store"
|
|
1847
1895
|
});
|
|
1848
1896
|
if (!response.ok) {
|
|
@@ -1863,63 +1911,101 @@ function createDepositService(baseUrl, options) {
|
|
|
1863
1911
|
return null;
|
|
1864
1912
|
}
|
|
1865
1913
|
},
|
|
1866
|
-
async
|
|
1867
|
-
const url = apiUrl(
|
|
1868
|
-
`/onramp/swapped/status/${encodeURIComponent(smartAccount)}`
|
|
1869
|
-
);
|
|
1914
|
+
async fetchSwappedOrder(orderId) {
|
|
1915
|
+
const url = apiUrl(`/onramp/orders/${encodeURIComponent(orderId)}`);
|
|
1870
1916
|
const response = await fetch(url, {
|
|
1871
1917
|
method: "GET",
|
|
1872
|
-
headers:
|
|
1918
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
1873
1919
|
cache: "no-store"
|
|
1874
1920
|
});
|
|
1875
1921
|
if (!response.ok) return null;
|
|
1876
|
-
let body
|
|
1922
|
+
let body;
|
|
1877
1923
|
try {
|
|
1878
1924
|
body = await response.json();
|
|
1879
|
-
} catch (
|
|
1925
|
+
} catch (e6) {
|
|
1880
1926
|
return null;
|
|
1881
1927
|
}
|
|
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
|
-
};
|
|
1928
|
+
return swappedOrderFromView(orderId, body);
|
|
1908
1929
|
}
|
|
1909
1930
|
};
|
|
1910
1931
|
}
|
|
1932
|
+
function swappedOrderFromView(orderId, raw) {
|
|
1933
|
+
if (!raw || typeof raw !== "object") return null;
|
|
1934
|
+
const view = raw;
|
|
1935
|
+
if (view.provider !== "swapped" || !isOrderShape(view)) return null;
|
|
1936
|
+
const number = (v) => {
|
|
1937
|
+
const n = typeof v === "string" && v.trim() ? Number(v) : v;
|
|
1938
|
+
return typeof n === "number" && Number.isFinite(n) ? n : null;
|
|
1939
|
+
};
|
|
1940
|
+
const text = (v) => typeof v === "string" && v.length > 0 ? v : null;
|
|
1941
|
+
const railName = (v) => {
|
|
1942
|
+
const name = text(v);
|
|
1943
|
+
return name === "provider_selected" || name === "unknown" ? null : name;
|
|
1944
|
+
};
|
|
1945
|
+
const usdTotal = number(_optionalChain([view, 'access', _47 => _47.fiat, 'optionalAccess', _48 => _48.usd, 'optionalAccess', _49 => _49.total]));
|
|
1946
|
+
const usdNet = number(_optionalChain([view, 'access', _50 => _50.fiat, 'optionalAccess', _51 => _51.usd, 'optionalAccess', _52 => _52.net]));
|
|
1947
|
+
return {
|
|
1948
|
+
orderId,
|
|
1949
|
+
...hostedOrderState(view),
|
|
1950
|
+
orderCrypto: text(_optionalChain([view, 'access', _53 => _53.crypto, 'optionalAccess', _54 => _54.asset])),
|
|
1951
|
+
orderCryptoAmount: text(_optionalChain([view, 'access', _55 => _55.crypto, 'optionalAccess', _56 => _56.amount])),
|
|
1952
|
+
receivedAt: text(view.updatedAt),
|
|
1953
|
+
paidAmountUsd: _nullishCoalesce(usdTotal, () => ( usdNet)),
|
|
1954
|
+
paidAmountEur: _nullishCoalesce(number(_optionalChain([view, 'access', _57 => _57.fiat, 'optionalAccess', _58 => _58.eur, 'optionalAccess', _59 => _59.total])), () => ( number(_optionalChain([view, 'access', _60 => _60.fiat, 'optionalAccess', _61 => _61.eur, 'optionalAccess', _62 => _62.net])))),
|
|
1955
|
+
onrampFeeUsd: usdTotal !== null && usdNet !== null && usdTotal > usdNet ? Number((usdTotal - usdNet).toFixed(2)) : null,
|
|
1956
|
+
paymentMethod: railName(_nullishCoalesce(_optionalChain([view, 'access', _63 => _63.rail, 'optionalAccess', _64 => _64.method]), () => ( _optionalChain([view, 'access', _65 => _65.rail, 'optionalAccess', _66 => _66.connection]))))
|
|
1957
|
+
};
|
|
1958
|
+
}
|
|
1959
|
+
var ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
1960
|
+
"pending",
|
|
1961
|
+
"processing",
|
|
1962
|
+
"completed",
|
|
1963
|
+
"failed",
|
|
1964
|
+
"refunded"
|
|
1965
|
+
]);
|
|
1966
|
+
function isOrderShape(view) {
|
|
1967
|
+
const stages = view.stages;
|
|
1968
|
+
return ORDER_STATUSES.has(view.status) && ["receipt", "conversion", "delivery"].every(
|
|
1969
|
+
(name) => typeof _optionalChain([stages, 'optionalAccess', _67 => _67[name], 'optionalAccess', _68 => _68.status]) === "string"
|
|
1970
|
+
);
|
|
1971
|
+
}
|
|
1972
|
+
function parseAssetItem(raw, fields) {
|
|
1973
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
1974
|
+
const record = raw;
|
|
1975
|
+
const item = {};
|
|
1976
|
+
if (fields.includes("symbol")) {
|
|
1977
|
+
const symbol = record.symbol;
|
|
1978
|
+
item.symbol = typeof symbol === "string" && symbol.trim().length > 0 ? symbol.trim() : null;
|
|
1979
|
+
}
|
|
1980
|
+
if (fields.includes("decimals")) {
|
|
1981
|
+
const decimals = record.decimals;
|
|
1982
|
+
item.decimals = typeof decimals === "number" && Number.isInteger(decimals) && decimals >= 0 && decimals <= 255 ? decimals : null;
|
|
1983
|
+
}
|
|
1984
|
+
if (fields.includes("logo")) {
|
|
1985
|
+
const logo = record.logo;
|
|
1986
|
+
item.logo = typeof logo === "string" && logo.startsWith(ASSET_LOGO_PREFIX) ? logo : null;
|
|
1987
|
+
}
|
|
1988
|
+
if (fields.includes("price")) {
|
|
1989
|
+
const price = record.price;
|
|
1990
|
+
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;
|
|
1991
|
+
item.priceUsd = Number.isFinite(usd) && usd > 0 ? usd : null;
|
|
1992
|
+
}
|
|
1993
|
+
const error = record.error;
|
|
1994
|
+
item.error = error && typeof error === "object" && typeof error.code === "string" ? { code: error.code } : null;
|
|
1995
|
+
return item;
|
|
1996
|
+
}
|
|
1911
1997
|
function normalizeDirectPortfolio(data) {
|
|
1912
1998
|
const rawTokens = _nullishCoalesce(_nullishCoalesce(extractArray(data, "tokens"), () => ( extractArray(
|
|
1913
|
-
_optionalChain([data, 'optionalAccess',
|
|
1999
|
+
_optionalChain([data, 'optionalAccess', _69 => _69.data]),
|
|
1914
2000
|
"tokens"
|
|
1915
2001
|
))), () => ( []));
|
|
1916
|
-
const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess',
|
|
2002
|
+
const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess', _70 => _70.data]), "totalUsd"))), () => ( 0));
|
|
1917
2003
|
const tokens = rawTokens.map((token) => normalizeDirectToken(token)).filter((token) => Boolean(token));
|
|
1918
2004
|
return { tokens, totalUsd };
|
|
1919
2005
|
}
|
|
1920
2006
|
function extractOrchestratorPortfolio(data) {
|
|
1921
2007
|
const portfolio = _nullishCoalesce(extractArray(data, "portfolio"), () => ( extractArray(
|
|
1922
|
-
_optionalChain([data, 'optionalAccess',
|
|
2008
|
+
_optionalChain([data, 'optionalAccess', _71 => _71.data]),
|
|
1923
2009
|
"portfolio"
|
|
1924
2010
|
)));
|
|
1925
2011
|
if (!portfolio || !Array.isArray(portfolio)) return null;
|
|
@@ -1930,23 +2016,16 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1930
2016
|
for (const tokenData of data.portfolio || []) {
|
|
1931
2017
|
const chainBalances = _nullishCoalesce(_nullishCoalesce(tokenData.tokenChainBalance, () => ( tokenData.chainBalances)), () => ( []));
|
|
1932
2018
|
for (const chainBalance of chainBalances) {
|
|
1933
|
-
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access',
|
|
2019
|
+
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _72 => _72.balance, 'optionalAccess', _73 => _73.unlocked]), () => ( "0"));
|
|
1934
2020
|
const normalizedName = tokenData.tokenName.trim();
|
|
1935
2021
|
const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
|
|
1936
|
-
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => (
|
|
1937
|
-
const resolvedTokenAddress = isNativeSymbol ?
|
|
2022
|
+
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => ( runtimeEvmAddress(chainBalance.chainId, normalizedName)));
|
|
2023
|
+
const resolvedTokenAddress = isNativeSymbol ? _chunkFKJ6EJHHcjs.NATIVE_TOKEN_ADDRESS : tokenAddress;
|
|
1938
2024
|
if (!resolvedTokenAddress) {
|
|
1939
2025
|
continue;
|
|
1940
2026
|
}
|
|
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));
|
|
2027
|
+
const symbol = normalizedName || "Token";
|
|
2028
|
+
const decimals = _nullishCoalesce(tokenData.tokenDecimals, () => ( 18));
|
|
1950
2029
|
tokens.push({
|
|
1951
2030
|
chainId: chainBalance.chainId,
|
|
1952
2031
|
address: resolvedTokenAddress,
|
|
@@ -1966,28 +2045,26 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1966
2045
|
function normalizeDirectToken(token) {
|
|
1967
2046
|
const rawChainId = _nullishCoalesce(extractNumber(token, "chainId"), () => ( extractNumber(token.chain, "id")));
|
|
1968
2047
|
const rawChainString = _nullishCoalesce(extractString(token, "chainId"), () => ( extractString(token.chain, "id")));
|
|
1969
|
-
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ?
|
|
2048
|
+
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ? _chunkFKJ6EJHHcjs.isSolanaCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "solana" ? "solana" : (
|
|
1970
2049
|
// HyperCore is a non-EVM source under its own namespace; keep its
|
|
1971
2050
|
// USDC instead of dropping it as an unparseable chain string.
|
|
1972
|
-
|
|
2051
|
+
_chunkFKJ6EJHHcjs.isHyperCoreCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "hypercore" ? "hypercore" : _chunkFKJ6EJHHcjs.parseEvmChainId.call(void 0, rawChainString)
|
|
1973
2052
|
) : null)));
|
|
1974
2053
|
if (chainId === null) return null;
|
|
1975
|
-
const registryChainId = typeof chainId === "number" ? chainId : chainId === "hypercore" ? _chunkOY5N3E6Lcjs.HYPERCORE_CHAIN_ID : void 0;
|
|
1976
2054
|
const symbol = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "symbol"), () => ( extractString(token, "tokenSymbol"))), () => ( extractString(token, "tokenName"))), () => ( extractString(token, "name")));
|
|
1977
2055
|
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',
|
|
2056
|
+
const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call', _74 => _74(token, "balance"), 'optionalAccess', _75 => _75.toString, 'call', _76 => _76()]))), () => ( _optionalChain([extractNumber, 'call', _77 => _77(token, "amount"), 'optionalAccess', _78 => _78.toString, 'call', _79 => _79()]))), () => ( _optionalChain([extractNumber, 'call', _80 => _80(token, "value"), 'optionalAccess', _81 => _81.toString, 'call', _82 => _82()]))), () => ( _optionalChain([extractNumber, 'call', _83 => _83(token, "rawBalance"), 'optionalAccess', _84 => _84.toString, 'call', _85 => _85()])));
|
|
1979
2057
|
if (!balanceValue) return null;
|
|
1980
2058
|
const address = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "address"), () => ( extractString(token, "tokenAddress"))), () => ( extractString(
|
|
1981
2059
|
token.token,
|
|
1982
2060
|
"address"
|
|
1983
|
-
))), () => ( (
|
|
2061
|
+
))), () => ( (chainId === "hypercore" ? _optionalChain([hyperCoreSourceToken, 'call', _86 => _86(void 0, symbol), 'optionalAccess', _87 => _87.address]) : typeof chainId === "number" ? runtimeEvmAddress(chainId, symbol) : void 0)));
|
|
1984
2062
|
if (!address) return null;
|
|
1985
2063
|
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
2064
|
const backendDecimals = _nullishCoalesce(extractNumber(token, "decimals"), () => ( extractNumber(token, "tokenDecimals")));
|
|
1990
|
-
const
|
|
2065
|
+
const hyperCore = chainId === "hypercore" ? hyperCoreSourceToken(address, symbol) : void 0;
|
|
2066
|
+
const resolvedSymbol = _nullishCoalesce(_optionalChain([hyperCore, 'optionalAccess', _88 => _88.symbol]), () => ( symbol));
|
|
2067
|
+
const resolvedDecimals = _nullishCoalesce(_nullishCoalesce(_optionalChain([hyperCore, 'optionalAccess', _89 => _89.decimals]), () => ( backendDecimals)), () => ( 18));
|
|
1991
2068
|
return {
|
|
1992
2069
|
chainId,
|
|
1993
2070
|
address,
|
|
@@ -1998,9 +2075,18 @@ function normalizeDirectToken(token) {
|
|
|
1998
2075
|
balanceUsd
|
|
1999
2076
|
};
|
|
2000
2077
|
}
|
|
2078
|
+
function runtimeEvmAddress(chainId, symbol) {
|
|
2079
|
+
const token = getRuntimeToken(chainId, symbol);
|
|
2080
|
+
return token && /^0x[a-fA-F0-9]{40}$/.test(token.address) ? token.address : void 0;
|
|
2081
|
+
}
|
|
2082
|
+
function hyperCoreSourceToken(address, symbol) {
|
|
2083
|
+
return _chunkFKJ6EJHHcjs.HYPERCORE_SOURCE_TOKENS.find(
|
|
2084
|
+
(t) => address ? t.address.toLowerCase() === address.toLowerCase() : t.symbol.toUpperCase() === symbol.trim().toUpperCase()
|
|
2085
|
+
);
|
|
2086
|
+
}
|
|
2001
2087
|
function extractTokenAddress(tokenData, chainId) {
|
|
2002
2088
|
const token = tokenData;
|
|
2003
|
-
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access',
|
|
2089
|
+
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access', _90 => _90.addresses, 'optionalAccess', _91 => _91[chainId]]))), () => ( _optionalChain([token, 'access', _92 => _92.token, 'optionalAccess', _93 => _93.address]))), () => ( _optionalChain([token, 'access', _94 => _94.token, 'optionalAccess', _95 => _95.addresses, 'optionalAccess', _96 => _96[chainId]])));
|
|
2004
2090
|
}
|
|
2005
2091
|
function extractArray(data, key) {
|
|
2006
2092
|
if (!data || typeof data !== "object") return null;
|
|
@@ -2030,7 +2116,7 @@ function extractNumericString(data, key) {
|
|
|
2030
2116
|
// src/core/rpc.ts
|
|
2031
2117
|
|
|
2032
2118
|
function rpcUrlFor(rpcUrls, chain) {
|
|
2033
|
-
const url = _optionalChain([rpcUrls, 'optionalAccess',
|
|
2119
|
+
const url = _optionalChain([rpcUrls, 'optionalAccess', _97 => _97[chain], 'optionalAccess', _98 => _98.trim, 'call', _99 => _99()]);
|
|
2034
2120
|
return url ? url : void 0;
|
|
2035
2121
|
}
|
|
2036
2122
|
var RpcUrlsContext = _react.createContext.call(void 0, void 0);
|
|
@@ -2040,7 +2126,7 @@ function useRpcUrls() {
|
|
|
2040
2126
|
}
|
|
2041
2127
|
function rpcUrlsKey(rpcUrls) {
|
|
2042
2128
|
if (!rpcUrls) return "";
|
|
2043
|
-
return Object.entries(rpcUrls).map(([chain, url]) => [chain, _nullishCoalesce(_optionalChain([url, 'optionalAccess',
|
|
2129
|
+
return Object.entries(rpcUrls).map(([chain, url]) => [chain, _nullishCoalesce(_optionalChain([url, 'optionalAccess', _100 => _100.trim, 'call', _101 => _101()]), () => ( ""))]).filter(([, url]) => url !== "").map(([chain, url]) => `${chain}=${url}`).sort().join("|");
|
|
2044
2130
|
}
|
|
2045
2131
|
function useStableRpcUrls(rpcUrls) {
|
|
2046
2132
|
const key = rpcUrlsKey(rpcUrls);
|
|
@@ -2062,15 +2148,15 @@ function useStableRpcUrls(rpcUrls) {
|
|
|
2062
2148
|
|
|
2063
2149
|
function findListed(options, chain, token) {
|
|
2064
2150
|
const normalize2 = (value) => chain === "solana" ? value : value.toLowerCase();
|
|
2065
|
-
return _optionalChain([options, 'access',
|
|
2151
|
+
return _optionalChain([options, 'access', _102 => _102.tokens, 'access', _103 => _103[String(chain)], 'optionalAccess', _104 => _104.find, 'call', _105 => _105(
|
|
2066
2152
|
(listed) => normalize2(listed.address) === normalize2(token)
|
|
2067
2153
|
)]);
|
|
2068
2154
|
}
|
|
2069
2155
|
function isExcludedByRestrictedList(options, chain, token) {
|
|
2070
|
-
return Boolean(_optionalChain([options, 'optionalAccess',
|
|
2156
|
+
return Boolean(_optionalChain([options, 'optionalAccess', _106 => _106.restricted]) && !findListed(options, chain, token));
|
|
2071
2157
|
}
|
|
2072
2158
|
function findDepositBounds(options, chain, token) {
|
|
2073
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
2159
|
+
if (!_optionalChain([options, 'optionalAccess', _107 => _107.restricted])) return void 0;
|
|
2074
2160
|
const entry = findListed(options, chain, token);
|
|
2075
2161
|
if (!entry || entry.minAmount === void 0 && entry.maxAmount === void 0) {
|
|
2076
2162
|
return void 0;
|
|
@@ -2083,7 +2169,7 @@ function findDepositBounds(options, chain, token) {
|
|
|
2083
2169
|
};
|
|
2084
2170
|
}
|
|
2085
2171
|
function boundMessage(bounds, bound) {
|
|
2086
|
-
const raw = _optionalChain([bounds, 'optionalAccess',
|
|
2172
|
+
const raw = _optionalChain([bounds, 'optionalAccess', _108 => _108[bound]]);
|
|
2087
2173
|
if (!bounds || raw === void 0) return null;
|
|
2088
2174
|
const amount = new Intl.NumberFormat("en-US", {
|
|
2089
2175
|
maximumFractionDigits: Math.min(bounds.decimals, 20)
|
|
@@ -2182,7 +2268,7 @@ async function loadViemChains() {
|
|
|
2182
2268
|
viemChainsPromise = Promise.resolve().then(() => _interopRequireWildcard(require("viem/chains"))).then((module) => {
|
|
2183
2269
|
const map = /* @__PURE__ */ new Map();
|
|
2184
2270
|
for (const value of Object.values(module)) {
|
|
2185
|
-
if (value && typeof value === "object" && typeof value.id === "number" && _optionalChain([value, 'access',
|
|
2271
|
+
if (value && typeof value === "object" && typeof value.id === "number" && _optionalChain([value, 'access', _109 => _109.rpcUrls, 'optionalAccess', _110 => _110.default, 'optionalAccess', _111 => _111.http, 'optionalAccess', _112 => _112.length])) {
|
|
2186
2272
|
const chain = value;
|
|
2187
2273
|
const existing = map.get(chain.id);
|
|
2188
2274
|
if (existing) existing.push(chain);
|
|
@@ -2196,7 +2282,7 @@ async function loadViemChains() {
|
|
|
2196
2282
|
return viemChainsPromise;
|
|
2197
2283
|
}
|
|
2198
2284
|
function pickViemChain(candidates, chain) {
|
|
2199
|
-
if (!_optionalChain([candidates, 'optionalAccess',
|
|
2285
|
+
if (!_optionalChain([candidates, 'optionalAccess', _113 => _113.length])) return void 0;
|
|
2200
2286
|
if (candidates.length === 1) return candidates[0];
|
|
2201
2287
|
const sameNetworkClass = candidates.filter(
|
|
2202
2288
|
(candidate) => Boolean(candidate.testnet) === chain.testnet
|
|
@@ -2212,10 +2298,10 @@ function pickViemChain(candidates, chain) {
|
|
|
2212
2298
|
}
|
|
2213
2299
|
function resolveRpcUrls(chain, override, viemChains) {
|
|
2214
2300
|
const urls = [];
|
|
2215
|
-
if (_optionalChain([override, 'optionalAccess',
|
|
2301
|
+
if (_optionalChain([override, 'optionalAccess', _114 => _114.trim, 'call', _115 => _115()])) urls.push(override.trim());
|
|
2216
2302
|
if (chain.publicRpcUrl) urls.push(chain.publicRpcUrl);
|
|
2217
2303
|
if (chain.chainId !== null && chain.vmType === "evm") {
|
|
2218
|
-
const http2 = _optionalChain([pickViemChain, 'call',
|
|
2304
|
+
const http2 = _optionalChain([pickViemChain, 'call', _116 => _116(_optionalChain([viemChains, 'optionalAccess', _117 => _117.get, 'call', _118 => _118(chain.chainId)]), chain), 'optionalAccess', _119 => _119.rpcUrls, 'optionalAccess', _120 => _120.default, 'optionalAccess', _121 => _121.http]);
|
|
2219
2305
|
if (http2) urls.push(...http2);
|
|
2220
2306
|
}
|
|
2221
2307
|
return [...new Set(urls)];
|
|
@@ -2224,7 +2310,7 @@ function toViemChain(chain, override, viemChains) {
|
|
|
2224
2310
|
if (chain.vmType !== "evm" || chain.chainId === null) return null;
|
|
2225
2311
|
const rpcUrls = resolveRpcUrls(chain, override, viemChains);
|
|
2226
2312
|
if (rpcUrls.length === 0) return null;
|
|
2227
|
-
const bundled = pickViemChain(_optionalChain([viemChains, 'optionalAccess',
|
|
2313
|
+
const bundled = pickViemChain(_optionalChain([viemChains, 'optionalAccess', _122 => _122.get, 'call', _123 => _123(chain.chainId)]), chain);
|
|
2228
2314
|
if (bundled) {
|
|
2229
2315
|
if (rpcUrls[0] === bundled.rpcUrls.default.http[0]) return bundled;
|
|
2230
2316
|
return _viem.defineChain.call(void 0, {
|
|
@@ -2255,7 +2341,7 @@ function toViemChains(catalog, overrides, viemChains) {
|
|
|
2255
2341
|
for (const entry of catalog.all) {
|
|
2256
2342
|
const chain = toViemChain(
|
|
2257
2343
|
entry,
|
|
2258
|
-
entry.chainId === null ? void 0 : _optionalChain([overrides, 'optionalAccess',
|
|
2344
|
+
entry.chainId === null ? void 0 : _optionalChain([overrides, 'optionalAccess', _124 => _124[entry.chainId]]),
|
|
2259
2345
|
viemChains
|
|
2260
2346
|
);
|
|
2261
2347
|
if (chain) chains.push(chain);
|
|
@@ -2264,7 +2350,7 @@ function toViemChains(catalog, overrides, viemChains) {
|
|
|
2264
2350
|
}
|
|
2265
2351
|
function needsViemChains(catalog, overrides) {
|
|
2266
2352
|
return catalog.all.some(
|
|
2267
|
-
(chain) => chain.vmType === "evm" && chain.chainId !== null && !chain.publicRpcUrl && !_optionalChain([overrides, 'optionalAccess',
|
|
2353
|
+
(chain) => chain.vmType === "evm" && chain.chainId !== null && !chain.publicRpcUrl && !_optionalChain([overrides, 'optionalAccess', _125 => _125[chain.chainId], 'optionalAccess', _126 => _126.trim, 'call', _127 => _127()])
|
|
2268
2354
|
);
|
|
2269
2355
|
}
|
|
2270
2356
|
|
|
@@ -2308,9 +2394,9 @@ function peekRuntimeChains(backendUrl, overrides) {
|
|
|
2308
2394
|
return _nullishCoalesce(resolvedChainsByKey.get(runtimeChainsKey(backendUrl, overrides)), () => ( null));
|
|
2309
2395
|
}
|
|
2310
2396
|
function publishCatalogTokens(catalog) {
|
|
2311
|
-
|
|
2397
|
+
setRuntimeTokens(
|
|
2312
2398
|
catalog.all.flatMap((chain) => {
|
|
2313
|
-
const chainId =
|
|
2399
|
+
const chainId = _chunkFKJ6EJHHcjs.displayChainIdForCaip2.call(void 0, chain.caip2);
|
|
2314
2400
|
if (chainId === null || !Array.isArray(chain.supportedTokens)) return [];
|
|
2315
2401
|
const tokens = chain.supportedTokens.map((token) => ({
|
|
2316
2402
|
chainId,
|
|
@@ -2331,21 +2417,22 @@ function publishCatalogTokens(catalog) {
|
|
|
2331
2417
|
);
|
|
2332
2418
|
}
|
|
2333
2419
|
function publishRuntimeChainMeta(catalog) {
|
|
2334
|
-
|
|
2420
|
+
_chunkFKJ6EJHHcjs.setRuntimeChainMeta.call(void 0,
|
|
2335
2421
|
catalog.all.flatMap((chain) => {
|
|
2336
2422
|
const ids = [];
|
|
2337
2423
|
if (chain.chainId !== null) ids.push(chain.chainId);
|
|
2338
|
-
const sentinel =
|
|
2424
|
+
const sentinel = _chunkFKJ6EJHHcjs.displayChainIdForCaip2.call(void 0, chain.caip2);
|
|
2339
2425
|
if (sentinel !== null && sentinel !== chain.chainId) ids.push(sentinel);
|
|
2340
|
-
if (
|
|
2426
|
+
if (_chunkFKJ6EJHHcjs.isHyperCoreCaip2.call(void 0, chain.caip2)) ids.push(_chunkFKJ6EJHHcjs.HYPERCORE_CHAIN_ID);
|
|
2341
2427
|
return ids.map((chainId) => ({
|
|
2342
2428
|
chainId,
|
|
2343
2429
|
name: chain.name,
|
|
2344
2430
|
iconUrl: _nullishCoalesce(chain.iconUrl, () => ( void 0)),
|
|
2345
2431
|
nativeSymbol: chain.nativeToken.symbol,
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2432
|
+
nativeDecimals: chain.nativeToken.decimals,
|
|
2433
|
+
explorerUrl: _optionalChain([chain, 'access', _128 => _128.explorer, 'optionalAccess', _129 => _129.url]),
|
|
2434
|
+
explorerTxPath: _optionalChain([chain, 'access', _130 => _130.explorer, 'optionalAccess', _131 => _131.txPath]),
|
|
2435
|
+
explorerAddressPath: _optionalChain([chain, 'access', _132 => _132.explorer, 'optionalAccess', _133 => _133.addressPath])
|
|
2349
2436
|
}));
|
|
2350
2437
|
})
|
|
2351
2438
|
);
|
|
@@ -2395,8 +2482,8 @@ function useDepositChainIds() {
|
|
|
2395
2482
|
!c.testnet
|
|
2396
2483
|
).map((c) => c.chainId);
|
|
2397
2484
|
const rank = (id) => {
|
|
2398
|
-
const i =
|
|
2399
|
-
return i === -1 ?
|
|
2485
|
+
const i = _chunkFKJ6EJHHcjs.CHAIN_DISPLAY_ORDER.indexOf(id);
|
|
2486
|
+
return i === -1 ? _chunkFKJ6EJHHcjs.CHAIN_DISPLAY_ORDER.length : i;
|
|
2400
2487
|
};
|
|
2401
2488
|
return ids.map((id, i) => ({ id, i })).sort((a, b) => rank(a.id) - rank(b.id) || a.i - b.i).map(({ id }) => id);
|
|
2402
2489
|
}, [catalog]);
|
|
@@ -2406,8 +2493,8 @@ function useDestinationChains() {
|
|
|
2406
2493
|
return _react.useMemo.call(void 0, () => {
|
|
2407
2494
|
if (!catalog) return [];
|
|
2408
2495
|
const rank = (id) => {
|
|
2409
|
-
const i =
|
|
2410
|
-
return i === -1 ?
|
|
2496
|
+
const i = _chunkFKJ6EJHHcjs.CHAIN_DISPLAY_ORDER.indexOf(id);
|
|
2497
|
+
return i === -1 ? _chunkFKJ6EJHHcjs.CHAIN_DISPLAY_ORDER.length : i;
|
|
2411
2498
|
};
|
|
2412
2499
|
return catalog.all.filter(
|
|
2413
2500
|
(c) => c.destination && c.vmType === "evm" && c.chainId !== null && !c.testnet
|
|
@@ -2418,7 +2505,7 @@ function useTargetTokens() {
|
|
|
2418
2505
|
const { catalog, shortlist } = useChainCatalog();
|
|
2419
2506
|
return _react.useMemo.call(void 0, () => {
|
|
2420
2507
|
return (chainId) => {
|
|
2421
|
-
const fromShortlist = _optionalChain([shortlist, 'optionalAccess',
|
|
2508
|
+
const fromShortlist = _optionalChain([shortlist, 'optionalAccess', _134 => _134[String(chainId)]]);
|
|
2422
2509
|
if (fromShortlist) {
|
|
2423
2510
|
return fromShortlist.map((token) => ({
|
|
2424
2511
|
symbol: token.symbol,
|
|
@@ -2426,8 +2513,8 @@ function useTargetTokens() {
|
|
|
2426
2513
|
decimals: token.decimals
|
|
2427
2514
|
}));
|
|
2428
2515
|
}
|
|
2429
|
-
const entry = _optionalChain([catalog, 'optionalAccess',
|
|
2430
|
-
return Array.isArray(_optionalChain([entry, 'optionalAccess',
|
|
2516
|
+
const entry = _optionalChain([catalog, 'optionalAccess', _135 => _135.byChainId, 'access', _136 => _136.get, 'call', _137 => _137(chainId)]);
|
|
2517
|
+
return Array.isArray(_optionalChain([entry, 'optionalAccess', _138 => _138.supportedTokens])) ? entry.supportedTokens.map((token) => ({
|
|
2431
2518
|
symbol: token.symbol,
|
|
2432
2519
|
address: token.address,
|
|
2433
2520
|
decimals: token.decimals
|
|
@@ -2437,12 +2524,12 @@ function useTargetTokens() {
|
|
|
2437
2524
|
}
|
|
2438
2525
|
function createDepositOffer(state, retry) {
|
|
2439
2526
|
const options = state.status === "ready" ? state.options : null;
|
|
2440
|
-
const restricted = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2441
|
-
const listed = (chain) => _optionalChain([options, 'optionalAccess',
|
|
2527
|
+
const restricted = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _139 => _139.restricted]), () => ( false));
|
|
2528
|
+
const listed = (chain) => _optionalChain([options, 'optionalAccess', _140 => _140.tokens, 'access', _141 => _141[String(chain)]]);
|
|
2442
2529
|
const isChainOffered = (chain) => {
|
|
2443
2530
|
if (!options) return false;
|
|
2444
2531
|
const entry = listed(chain);
|
|
2445
|
-
return restricted ? (_nullishCoalesce(_optionalChain([entry, 'optionalAccess',
|
|
2532
|
+
return restricted ? (_nullishCoalesce(_optionalChain([entry, 'optionalAccess', _142 => _142.length]), () => ( 0))) > 0 : _optionalChain([entry, 'optionalAccess', _143 => _143.length]) !== 0;
|
|
2446
2533
|
};
|
|
2447
2534
|
return {
|
|
2448
2535
|
status: state.status,
|
|
@@ -2489,10 +2576,10 @@ function useChainName() {
|
|
|
2489
2576
|
const { catalog } = useChainCatalog();
|
|
2490
2577
|
return _react.useMemo.call(void 0, () => {
|
|
2491
2578
|
return (chainId) => {
|
|
2492
|
-
if (!catalog) return
|
|
2579
|
+
if (!catalog) return _chunkFKJ6EJHHcjs.getChainName.call(void 0, chainId);
|
|
2493
2580
|
const key = catalogKeyForChain(chainId);
|
|
2494
2581
|
const entry = typeof key === "number" ? catalog.byChainId.get(key) : catalog.byCaip2.get(key);
|
|
2495
|
-
return _nullishCoalesce(_optionalChain([entry, 'optionalAccess',
|
|
2582
|
+
return _nullishCoalesce(_optionalChain([entry, 'optionalAccess', _144 => _144.name]), () => ( _chunkFKJ6EJHHcjs.getChainName.call(void 0, chainId)));
|
|
2496
2583
|
};
|
|
2497
2584
|
}, [catalog]);
|
|
2498
2585
|
}
|
|
@@ -2504,20 +2591,20 @@ function useRuntimeChainsVersion() {
|
|
|
2504
2591
|
);
|
|
2505
2592
|
}
|
|
2506
2593
|
function useReadClient(chainId, rpcUrls) {
|
|
2507
|
-
const
|
|
2594
|
+
const version2 = useRuntimeChainsVersion();
|
|
2508
2595
|
return _react.useMemo.call(void 0,
|
|
2509
2596
|
() => getPublicClient(chainId, rpcUrls),
|
|
2510
|
-
[chainId, rpcUrls,
|
|
2597
|
+
[chainId, rpcUrls, version2]
|
|
2511
2598
|
);
|
|
2512
2599
|
}
|
|
2513
2600
|
function useExplorerTxUrl() {
|
|
2514
2601
|
const { catalog } = useChainCatalog();
|
|
2515
2602
|
return _react.useMemo.call(void 0, () => {
|
|
2516
2603
|
return (chainId, txHash) => {
|
|
2517
|
-
if (chainId === "hypercore") return
|
|
2604
|
+
if (chainId === "hypercore") return _chunkFKJ6EJHHcjs.getExplorerTxUrl.call(void 0, chainId, txHash);
|
|
2518
2605
|
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), () => (
|
|
2606
|
+
const entry = key === void 0 ? void 0 : typeof key === "number" ? _optionalChain([catalog, 'optionalAccess', _145 => _145.byChainId, 'access', _146 => _146.get, 'call', _147 => _147(key)]) : _optionalChain([catalog, 'optionalAccess', _148 => _148.byCaip2, 'access', _149 => _149.get, 'call', _150 => _150(key)]);
|
|
2607
|
+
return _nullishCoalesce(catalogExplorerTxUrl(entry, txHash), () => ( _chunkFKJ6EJHHcjs.getExplorerTxUrl.call(void 0, chainId, txHash)));
|
|
2521
2608
|
};
|
|
2522
2609
|
}, [catalog]);
|
|
2523
2610
|
}
|
|
@@ -2579,11 +2666,11 @@ function ChainCatalogProvider({
|
|
|
2579
2666
|
service.getTopTokens().then(
|
|
2580
2667
|
(result) => {
|
|
2581
2668
|
if (!active) return;
|
|
2582
|
-
if (!_optionalChain([result, 'optionalAccess',
|
|
2669
|
+
if (!_optionalChain([result, 'optionalAccess', _151 => _151.ok])) {
|
|
2583
2670
|
setDepositOptions({ status: "error" });
|
|
2584
2671
|
return;
|
|
2585
2672
|
}
|
|
2586
|
-
|
|
2673
|
+
publishShortlistTokens(result.options.tokens);
|
|
2587
2674
|
setDepositOptions({ status: "ready", options: result.options });
|
|
2588
2675
|
},
|
|
2589
2676
|
() => {
|
|
@@ -2628,14 +2715,290 @@ function ChainCatalogProvider({
|
|
|
2628
2715
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChainCatalogContext.Provider, { value, children });
|
|
2629
2716
|
}
|
|
2630
2717
|
|
|
2631
|
-
// src/core/
|
|
2718
|
+
// src/core/asset-metadata.tsx
|
|
2719
|
+
|
|
2720
|
+
|
|
2632
2721
|
|
|
2633
|
-
|
|
2634
|
-
|
|
2722
|
+
|
|
2723
|
+
|
|
2724
|
+
|
|
2725
|
+
|
|
2726
|
+
|
|
2727
|
+
// src/core/asset-id.ts
|
|
2728
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
2729
|
+
var EVM_ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
|
|
2730
|
+
var BASE58_RE = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
2731
|
+
var SOLANA_SYSTEM_PROGRAM2 = "11111111111111111111111111111111";
|
|
2732
|
+
function isNativeSpelling(chain, address) {
|
|
2733
|
+
if (chain === "solana") {
|
|
2734
|
+
return address === "native" || address === SOLANA_SYSTEM_PROGRAM2;
|
|
2735
|
+
}
|
|
2736
|
+
if (chain === "stellar") return address === "native";
|
|
2737
|
+
if (chain === "tron") return address === "native" || address === ZERO_ADDRESS;
|
|
2738
|
+
return address.toLowerCase() === ZERO_ADDRESS;
|
|
2739
|
+
}
|
|
2740
|
+
function assetIdFor(chain, address) {
|
|
2741
|
+
if (chain === void 0 || !address) return void 0;
|
|
2742
|
+
const native = isNativeSpelling(chain, address);
|
|
2743
|
+
if (chain === "hypercore" || chain === _chunkFKJ6EJHHcjs.HYPERCORE_CHAIN_ID) {
|
|
2744
|
+
if (!EVM_ADDRESS_RE.test(address)) return void 0;
|
|
2745
|
+
return `${_chunkFKJ6EJHHcjs.HYPERCORE_SPOT_CAIP2}:${native ? "native" : address.toLowerCase()}`;
|
|
2746
|
+
}
|
|
2747
|
+
if (typeof chain === "number") {
|
|
2748
|
+
if (!EVM_ADDRESS_RE.test(address)) return void 0;
|
|
2749
|
+
return `${_chunkFKJ6EJHHcjs.toEvmCaip2.call(void 0, chain)}:${native ? "native" : address.toLowerCase()}`;
|
|
2750
|
+
}
|
|
2751
|
+
if (chain === "solana") {
|
|
2752
|
+
if (native) return `${_chunkFKJ6EJHHcjs.SOLANA_MAINNET_CAIP2}:native`;
|
|
2753
|
+
return BASE58_RE.test(address) ? `${_chunkFKJ6EJHHcjs.SOLANA_MAINNET_CAIP2}:${address}` : void 0;
|
|
2754
|
+
}
|
|
2755
|
+
const caip2 = chain === "tron" ? _chunkFKJ6EJHHcjs.TRON_MAINNET_CAIP2 : _chunkFKJ6EJHHcjs.STELLAR_PUBNET_CAIP2;
|
|
2756
|
+
return `${caip2}:${native ? "native" : address}`;
|
|
2757
|
+
}
|
|
2758
|
+
function assetIdForRef(ref) {
|
|
2759
|
+
return ref ? assetIdFor(ref.chain, ref.address) : void 0;
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2762
|
+
// src/core/asset-metadata.tsx
|
|
2763
|
+
|
|
2764
|
+
var ASSET_RETRY_MS = 6e4;
|
|
2765
|
+
var ASSET_PRICE_TTL_MS = 6e4;
|
|
2766
|
+
var META_FIELDS = ["symbol", "decimals", "logo"];
|
|
2767
|
+
var PRICE_FIELDS = ["price"];
|
|
2768
|
+
var TERMINAL_ITEM_ERRORS = /* @__PURE__ */ new Set([
|
|
2769
|
+
"not_found",
|
|
2770
|
+
"unsupported_chain",
|
|
2771
|
+
"invalid_id"
|
|
2772
|
+
]);
|
|
2773
|
+
function createAssetStore(service, now = Date.now) {
|
|
2774
|
+
const meta = /* @__PURE__ */ new Map();
|
|
2775
|
+
const prices = /* @__PURE__ */ new Map();
|
|
2776
|
+
const metaInFlight = /* @__PURE__ */ new Set();
|
|
2777
|
+
const priceInFlight = /* @__PURE__ */ new Set();
|
|
2778
|
+
let metaQueue = /* @__PURE__ */ new Set();
|
|
2779
|
+
let priceQueue = /* @__PURE__ */ new Set();
|
|
2780
|
+
let flushScheduled = false;
|
|
2781
|
+
let routeMissing = false;
|
|
2782
|
+
let version2 = 0;
|
|
2783
|
+
const listeners2 = /* @__PURE__ */ new Set();
|
|
2784
|
+
function notify() {
|
|
2785
|
+
version2 += 1;
|
|
2786
|
+
for (const listener of [...listeners2]) listener();
|
|
2787
|
+
}
|
|
2788
|
+
function idsFor(refs) {
|
|
2789
|
+
const ids = [];
|
|
2790
|
+
for (const ref of refs) {
|
|
2791
|
+
const id = assetIdForRef(ref);
|
|
2792
|
+
if (!id) continue;
|
|
2793
|
+
ids.push(id);
|
|
2794
|
+
}
|
|
2795
|
+
return ids;
|
|
2796
|
+
}
|
|
2797
|
+
function scheduleFlush() {
|
|
2798
|
+
if (flushScheduled) return;
|
|
2799
|
+
flushScheduled = true;
|
|
2800
|
+
queueMicrotask(() => {
|
|
2801
|
+
flushScheduled = false;
|
|
2802
|
+
const metaIds = [...metaQueue];
|
|
2803
|
+
const priceIds = [...priceQueue];
|
|
2804
|
+
metaQueue = /* @__PURE__ */ new Set();
|
|
2805
|
+
priceQueue = /* @__PURE__ */ new Set();
|
|
2806
|
+
if (metaIds.length > 0) void flushMeta(metaIds);
|
|
2807
|
+
if (priceIds.length > 0) void flushPrices(priceIds);
|
|
2808
|
+
});
|
|
2809
|
+
}
|
|
2810
|
+
function needsMeta(id) {
|
|
2811
|
+
if (metaInFlight.has(id) || metaQueue.has(id)) return false;
|
|
2812
|
+
const entry = meta.get(id);
|
|
2813
|
+
if (!entry) return true;
|
|
2814
|
+
if (entry.status === "missing" || entry.status === "pending") return false;
|
|
2815
|
+
if (entry.status === "failed" && routeMissing) return false;
|
|
2816
|
+
return entry.retryAt !== void 0 && now() >= entry.retryAt;
|
|
2817
|
+
}
|
|
2818
|
+
function needsPrice(id) {
|
|
2819
|
+
if (priceInFlight.has(id) || priceQueue.has(id)) return false;
|
|
2820
|
+
const entry = prices.get(id);
|
|
2821
|
+
return !entry || now() - entry.at >= ASSET_PRICE_TTL_MS;
|
|
2822
|
+
}
|
|
2823
|
+
async function lookup2(ids, fields) {
|
|
2824
|
+
try {
|
|
2825
|
+
return await service.lookupAssets(ids, fields);
|
|
2826
|
+
} catch (e7) {
|
|
2827
|
+
return { ok: false, routeMissing: false };
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
async function flushMeta(ids) {
|
|
2831
|
+
for (const id of ids) metaInFlight.add(id);
|
|
2832
|
+
const result = await lookup2(ids, META_FIELDS);
|
|
2833
|
+
const at = now();
|
|
2834
|
+
for (const id of ids) {
|
|
2835
|
+
metaInFlight.delete(id);
|
|
2836
|
+
const previous = meta.get(id);
|
|
2837
|
+
if (!result.ok) {
|
|
2838
|
+
if (result.routeMissing) routeMissing = true;
|
|
2839
|
+
meta.set(id, {
|
|
2840
|
+
...previous,
|
|
2841
|
+
status: _optionalChain([previous, 'optionalAccess', _152 => _152.status]) === "ready" ? "ready" : "failed",
|
|
2842
|
+
retryAt: at + ASSET_RETRY_MS
|
|
2843
|
+
});
|
|
2844
|
+
continue;
|
|
2845
|
+
}
|
|
2846
|
+
const item = result.items[id];
|
|
2847
|
+
const code = _optionalChain([item, 'optionalAccess', _153 => _153.error, 'optionalAccess', _154 => _154.code]);
|
|
2848
|
+
if (!item || code && TERMINAL_ITEM_ERRORS.has(code)) {
|
|
2849
|
+
meta.set(id, { status: "missing" });
|
|
2850
|
+
continue;
|
|
2851
|
+
}
|
|
2852
|
+
meta.set(id, {
|
|
2853
|
+
status: "ready",
|
|
2854
|
+
symbol: _nullishCoalesce(item.symbol, () => ( _optionalChain([previous, 'optionalAccess', _155 => _155.symbol]))),
|
|
2855
|
+
decimals: _nullishCoalesce(item.decimals, () => ( _optionalChain([previous, 'optionalAccess', _156 => _156.decimals]))),
|
|
2856
|
+
logo: _nullishCoalesce(item.logo, () => ( _optionalChain([previous, 'optionalAccess', _157 => _157.logo]))),
|
|
2857
|
+
retryAt: code ? at + ASSET_RETRY_MS : void 0
|
|
2858
|
+
});
|
|
2859
|
+
}
|
|
2860
|
+
notify();
|
|
2861
|
+
}
|
|
2862
|
+
async function flushPrices(ids) {
|
|
2863
|
+
for (const id of ids) priceInFlight.add(id);
|
|
2864
|
+
const result = await lookup2(ids, PRICE_FIELDS);
|
|
2865
|
+
const at = now();
|
|
2866
|
+
for (const id of ids) {
|
|
2867
|
+
priceInFlight.delete(id);
|
|
2868
|
+
prices.set(id, {
|
|
2869
|
+
usd: result.ok ? _nullishCoalesce(_optionalChain([result, 'access', _158 => _158.items, 'access', _159 => _159[id], 'optionalAccess', _160 => _160.priceUsd]), () => ( null)) : null,
|
|
2870
|
+
at
|
|
2871
|
+
});
|
|
2872
|
+
}
|
|
2873
|
+
notify();
|
|
2874
|
+
}
|
|
2875
|
+
function requestMeta(refs) {
|
|
2876
|
+
let queued = false;
|
|
2877
|
+
for (const id of idsFor(refs)) {
|
|
2878
|
+
if (!needsMeta(id)) continue;
|
|
2879
|
+
metaQueue.add(id);
|
|
2880
|
+
queued = true;
|
|
2881
|
+
}
|
|
2882
|
+
if (queued) scheduleFlush();
|
|
2883
|
+
}
|
|
2884
|
+
function requestPrices(refs) {
|
|
2885
|
+
let queued = false;
|
|
2886
|
+
for (const id of idsFor(refs)) {
|
|
2887
|
+
if (!needsPrice(id)) continue;
|
|
2888
|
+
priceQueue.add(id);
|
|
2889
|
+
queued = true;
|
|
2890
|
+
}
|
|
2891
|
+
if (queued) scheduleFlush();
|
|
2892
|
+
}
|
|
2893
|
+
function settled(test) {
|
|
2894
|
+
if (test()) return Promise.resolve();
|
|
2895
|
+
return new Promise((resolve) => {
|
|
2896
|
+
const unsubscribe = subscribe(() => {
|
|
2897
|
+
if (!test()) return;
|
|
2898
|
+
unsubscribe();
|
|
2899
|
+
resolve();
|
|
2900
|
+
});
|
|
2901
|
+
});
|
|
2902
|
+
}
|
|
2903
|
+
function subscribe(listener) {
|
|
2904
|
+
listeners2.add(listener);
|
|
2905
|
+
return () => {
|
|
2906
|
+
listeners2.delete(listener);
|
|
2907
|
+
};
|
|
2908
|
+
}
|
|
2909
|
+
function peekMeta(id) {
|
|
2910
|
+
const entry = meta.get(id);
|
|
2911
|
+
if (!entry) {
|
|
2912
|
+
return metaInFlight.has(id) || metaQueue.has(id) ? { status: "pending" } : void 0;
|
|
2913
|
+
}
|
|
2914
|
+
const { retryAt: _retryAt, ...rest } = entry;
|
|
2915
|
+
return rest;
|
|
2916
|
+
}
|
|
2917
|
+
return {
|
|
2918
|
+
subscribe,
|
|
2919
|
+
getVersion: () => version2,
|
|
2920
|
+
requestMeta,
|
|
2921
|
+
requestPrices,
|
|
2922
|
+
peekMeta,
|
|
2923
|
+
peekPrice: (id) => _optionalChain([prices, 'access', _161 => _161.get, 'call', _162 => _162(id), 'optionalAccess', _163 => _163.usd]),
|
|
2924
|
+
async resolveMeta(refs) {
|
|
2925
|
+
const ids = idsFor(refs);
|
|
2926
|
+
requestMeta(refs);
|
|
2927
|
+
await settled(
|
|
2928
|
+
() => ids.every((id) => !metaInFlight.has(id) && !metaQueue.has(id))
|
|
2929
|
+
);
|
|
2930
|
+
return Object.fromEntries(
|
|
2931
|
+
ids.map((id) => [id, _nullishCoalesce(peekMeta(id), () => ( { status: "missing" }))])
|
|
2932
|
+
);
|
|
2933
|
+
},
|
|
2934
|
+
async resolvePrice(ref) {
|
|
2935
|
+
const [id] = idsFor([ref]);
|
|
2936
|
+
if (!id) return null;
|
|
2937
|
+
requestPrices([ref]);
|
|
2938
|
+
await settled(() => !priceInFlight.has(id) && !priceQueue.has(id));
|
|
2939
|
+
return _nullishCoalesce(_optionalChain([prices, 'access', _164 => _164.get, 'call', _165 => _165(id), 'optionalAccess', _166 => _166.usd]), () => ( null));
|
|
2940
|
+
}
|
|
2941
|
+
};
|
|
2942
|
+
}
|
|
2943
|
+
var AssetStoreContext = _react.createContext.call(void 0, null);
|
|
2944
|
+
function AssetMetadataProvider({
|
|
2945
|
+
service,
|
|
2946
|
+
children
|
|
2947
|
+
}) {
|
|
2948
|
+
const store = _react.useMemo.call(void 0, () => createAssetStore(service), [service]);
|
|
2949
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssetStoreContext.Provider, { value: store, children });
|
|
2950
|
+
}
|
|
2951
|
+
function useAssetStore() {
|
|
2952
|
+
return _react.useContext.call(void 0, AssetStoreContext);
|
|
2953
|
+
}
|
|
2954
|
+
var noopSubscribe = () => () => {
|
|
2955
|
+
};
|
|
2956
|
+
var zero = () => 0;
|
|
2957
|
+
function useStoreVersion(store) {
|
|
2958
|
+
return _react.useSyncExternalStore.call(void 0,
|
|
2959
|
+
store ? store.subscribe : noopSubscribe,
|
|
2960
|
+
store ? store.getVersion : zero,
|
|
2961
|
+
store ? store.getVersion : zero
|
|
2962
|
+
);
|
|
2963
|
+
}
|
|
2964
|
+
function refsKey(refs) {
|
|
2965
|
+
return refs.map((ref) => _nullishCoalesce(assetIdForRef(ref), () => ( ""))).filter(Boolean).join("|");
|
|
2966
|
+
}
|
|
2967
|
+
function definedRefs(refs) {
|
|
2968
|
+
return refs.filter((ref) => Boolean(ref));
|
|
2969
|
+
}
|
|
2970
|
+
function useAssetMetadata(refs) {
|
|
2971
|
+
const store = useAssetStore();
|
|
2972
|
+
const version2 = useStoreVersion(store);
|
|
2973
|
+
const key = refsKey(refs);
|
|
2635
2974
|
_react.useEffect.call(void 0, () => {
|
|
2636
|
-
|
|
2637
|
-
}, [
|
|
2638
|
-
return
|
|
2975
|
+
if (store && key) store.requestMeta(definedRefs(refs));
|
|
2976
|
+
}, [store, key]);
|
|
2977
|
+
return _react.useMemo.call(void 0, () => {
|
|
2978
|
+
const out = {};
|
|
2979
|
+
if (!store || !key) return out;
|
|
2980
|
+
for (const id of key.split("|")) {
|
|
2981
|
+
out[id] = _nullishCoalesce(store.peekMeta(id), () => ( { status: "pending" }));
|
|
2982
|
+
}
|
|
2983
|
+
return out;
|
|
2984
|
+
}, [store, key, version2]);
|
|
2985
|
+
}
|
|
2986
|
+
function useAssetPrices(refs) {
|
|
2987
|
+
const store = useAssetStore();
|
|
2988
|
+
const version2 = useStoreVersion(store);
|
|
2989
|
+
const key = refsKey(refs);
|
|
2990
|
+
_react.useEffect.call(void 0, () => {
|
|
2991
|
+
if (store && key) store.requestPrices(definedRefs(refs));
|
|
2992
|
+
}, [store, key]);
|
|
2993
|
+
return _react.useMemo.call(void 0, () => {
|
|
2994
|
+
const out = {};
|
|
2995
|
+
if (!store || !key) return out;
|
|
2996
|
+
for (const id of key.split("|")) {
|
|
2997
|
+
const usd = store.peekPrice(id);
|
|
2998
|
+
if (typeof usd === "number") out[id] = usd;
|
|
2999
|
+
}
|
|
3000
|
+
return out;
|
|
3001
|
+
}, [store, key, version2]);
|
|
2639
3002
|
}
|
|
2640
3003
|
|
|
2641
3004
|
// src/core/analytics.tsx
|
|
@@ -2704,7 +3067,7 @@ function createIngestTransport(options) {
|
|
|
2704
3067
|
function report(reason, status) {
|
|
2705
3068
|
try {
|
|
2706
3069
|
onFailure({ reason, status, droppedEvents: dropped });
|
|
2707
|
-
} catch (
|
|
3070
|
+
} catch (e8) {
|
|
2708
3071
|
}
|
|
2709
3072
|
}
|
|
2710
3073
|
function drop(batch, reason, status) {
|
|
@@ -2758,10 +3121,10 @@ function createIngestTransport(options) {
|
|
|
2758
3121
|
}
|
|
2759
3122
|
function interruptForUnload() {
|
|
2760
3123
|
for (const wake of [...sleepers]) wake();
|
|
2761
|
-
_optionalChain([mintAbort, 'optionalAccess',
|
|
3124
|
+
_optionalChain([mintAbort, 'optionalAccess', _167 => _167.abort, 'call', _168 => _168()]);
|
|
2762
3125
|
}
|
|
2763
3126
|
function retryDelay(response, attempt) {
|
|
2764
|
-
const seconds = Number(_optionalChain([response, 'access',
|
|
3127
|
+
const seconds = Number(_optionalChain([response, 'access', _169 => _169.headers, 'optionalAccess', _170 => _170.get, 'optionalCall', _171 => _171("Retry-After")]));
|
|
2765
3128
|
if (Number.isFinite(seconds) && seconds > 0) {
|
|
2766
3129
|
return Math.min(seconds * 1e3, MAX_BACKOFF_MS);
|
|
2767
3130
|
}
|
|
@@ -2776,10 +3139,10 @@ function createIngestTransport(options) {
|
|
|
2776
3139
|
try {
|
|
2777
3140
|
response = await fetchImpl(mintUrl, {
|
|
2778
3141
|
method: "POST",
|
|
2779
|
-
headers:
|
|
2780
|
-
signal: _optionalChain([controller, 'optionalAccess',
|
|
3142
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
3143
|
+
signal: _optionalChain([controller, 'optionalAccess', _172 => _172.signal])
|
|
2781
3144
|
});
|
|
2782
|
-
} catch (
|
|
3145
|
+
} catch (e9) {
|
|
2783
3146
|
if (urgency !== DISMISSAL) {
|
|
2784
3147
|
mintFailures += 1;
|
|
2785
3148
|
mintBackoffUntil = now() + backoff(mintFailures);
|
|
@@ -2807,7 +3170,7 @@ function createIngestTransport(options) {
|
|
|
2807
3170
|
token = { value, expiresAt };
|
|
2808
3171
|
mintFailures = 0;
|
|
2809
3172
|
mintBackoffUntil = 0;
|
|
2810
|
-
} catch (
|
|
3173
|
+
} catch (e10) {
|
|
2811
3174
|
mintUnavailable = true;
|
|
2812
3175
|
report("token_unavailable", response.status);
|
|
2813
3176
|
}
|
|
@@ -2847,7 +3210,7 @@ function createIngestTransport(options) {
|
|
|
2847
3210
|
body: bodyOf(batch),
|
|
2848
3211
|
keepalive: true
|
|
2849
3212
|
});
|
|
2850
|
-
} catch (
|
|
3213
|
+
} catch (e11) {
|
|
2851
3214
|
if (terminal || attempt >= MAX_ATTEMPTS) {
|
|
2852
3215
|
return drop(batch, "network");
|
|
2853
3216
|
}
|
|
@@ -2952,7 +3315,7 @@ function createIngestTransport(options) {
|
|
|
2952
3315
|
}
|
|
2953
3316
|
},
|
|
2954
3317
|
flush(flushOptions) {
|
|
2955
|
-
const dismissal = _nullishCoalesce(_optionalChain([flushOptions, 'optionalAccess',
|
|
3318
|
+
const dismissal = _nullishCoalesce(_optionalChain([flushOptions, 'optionalAccess', _173 => _173.terminal]), () => ( false));
|
|
2956
3319
|
if (disposed && !dismissal) return;
|
|
2957
3320
|
clearFlushTimer();
|
|
2958
3321
|
void run(dismissal ? DISMISSAL : IDLE);
|
|
@@ -2967,11 +3330,11 @@ function createIngestTransport(options) {
|
|
|
2967
3330
|
};
|
|
2968
3331
|
}
|
|
2969
3332
|
function randomUuid() {
|
|
2970
|
-
if (typeof _optionalChain([globalThis, 'access',
|
|
3333
|
+
if (typeof _optionalChain([globalThis, 'access', _174 => _174.crypto, 'optionalAccess', _175 => _175.randomUUID]) === "function") {
|
|
2971
3334
|
return globalThis.crypto.randomUUID();
|
|
2972
3335
|
}
|
|
2973
3336
|
const bytes = new Uint8Array(16);
|
|
2974
|
-
_optionalChain([globalThis, 'access',
|
|
3337
|
+
_optionalChain([globalThis, 'access', _176 => _176.crypto, 'optionalAccess', _177 => _177.getRandomValues, 'optionalCall', _178 => _178(bytes)]);
|
|
2975
3338
|
if (!bytes.some(Boolean)) {
|
|
2976
3339
|
for (let index = 0; index < bytes.length; index += 1) {
|
|
2977
3340
|
bytes[index] = Math.floor(Math.random() * 256);
|
|
@@ -2985,9 +3348,9 @@ function randomUuid() {
|
|
|
2985
3348
|
function resolveProxyOrigin(backendUrl) {
|
|
2986
3349
|
if (!backendUrl.trim()) return null;
|
|
2987
3350
|
try {
|
|
2988
|
-
const { origin } = new URL(backendUrl, _optionalChain([globalThis, 'access',
|
|
3351
|
+
const { origin } = new URL(backendUrl, _optionalChain([globalThis, 'access', _179 => _179.location, 'optionalAccess', _180 => _180.href]));
|
|
2989
3352
|
return origin.startsWith("http") ? origin : null;
|
|
2990
|
-
} catch (
|
|
3353
|
+
} catch (e12) {
|
|
2991
3354
|
return null;
|
|
2992
3355
|
}
|
|
2993
3356
|
}
|
|
@@ -3037,13 +3400,13 @@ function AnalyticsSession(props) {
|
|
|
3037
3400
|
type: "analytics_ingest_failure",
|
|
3038
3401
|
session_id: sessionIdRef.current,
|
|
3039
3402
|
modal,
|
|
3040
|
-
widget_version:
|
|
3403
|
+
widget_version: _chunkD3R3O4CYcjs.MODAL_VERSION,
|
|
3041
3404
|
timestamp: nowRef.current().toISOString(),
|
|
3042
3405
|
reason,
|
|
3043
3406
|
...status === void 0 ? {} : { status },
|
|
3044
3407
|
dropped_events: droppedEvents
|
|
3045
3408
|
};
|
|
3046
|
-
_optionalChain([onEventRef, 'access',
|
|
3409
|
+
_optionalChain([onEventRef, 'access', _181 => _181.current, 'optionalCall', _182 => _182(event)]);
|
|
3047
3410
|
},
|
|
3048
3411
|
[modal]
|
|
3049
3412
|
);
|
|
@@ -3065,7 +3428,7 @@ function AnalyticsSession(props) {
|
|
|
3065
3428
|
proxyOrigin,
|
|
3066
3429
|
sessionId: sessionIdRef.current,
|
|
3067
3430
|
modal,
|
|
3068
|
-
widgetVersion:
|
|
3431
|
+
widgetVersion: _chunkD3R3O4CYcjs.MODAL_VERSION,
|
|
3069
3432
|
sessionProperties: sessionPropertiesRef.current,
|
|
3070
3433
|
onFailure: (failure) => emitFailure(failure),
|
|
3071
3434
|
fetchImpl: props.fetchImpl,
|
|
@@ -3082,10 +3445,10 @@ function AnalyticsSession(props) {
|
|
|
3082
3445
|
const enqueue = _react.useCallback.call(void 0,
|
|
3083
3446
|
(event) => {
|
|
3084
3447
|
try {
|
|
3085
|
-
_optionalChain([ingestRef, 'access',
|
|
3448
|
+
_optionalChain([ingestRef, 'access', _183 => _183.current, 'optionalAccess', _184 => _184.transport, 'optionalAccess', _185 => _185.enqueue, 'call', _186 => _186(
|
|
3086
3449
|
event
|
|
3087
3450
|
)]);
|
|
3088
|
-
} catch (
|
|
3451
|
+
} catch (e13) {
|
|
3089
3452
|
}
|
|
3090
3453
|
},
|
|
3091
3454
|
[]
|
|
@@ -3121,12 +3484,12 @@ function AnalyticsSession(props) {
|
|
|
3121
3484
|
...payload,
|
|
3122
3485
|
session_id: sessionIdRef.current,
|
|
3123
3486
|
modal,
|
|
3124
|
-
widget_version:
|
|
3487
|
+
widget_version: _chunkD3R3O4CYcjs.MODAL_VERSION,
|
|
3125
3488
|
timestamp: nowRef.current().toISOString(),
|
|
3126
3489
|
session_properties: sessionPropertiesRef.current,
|
|
3127
3490
|
funding_method: fundingMethod
|
|
3128
3491
|
};
|
|
3129
|
-
_optionalChain([onEventRef, 'access',
|
|
3492
|
+
_optionalChain([onEventRef, 'access', _187 => _187.current, 'optionalCall', _188 => _188(
|
|
3130
3493
|
event
|
|
3131
3494
|
)]);
|
|
3132
3495
|
enqueue(event);
|
|
@@ -3140,11 +3503,11 @@ function AnalyticsSession(props) {
|
|
|
3140
3503
|
...payload,
|
|
3141
3504
|
session_id: sessionIdRef.current,
|
|
3142
3505
|
modal,
|
|
3143
|
-
widget_version:
|
|
3506
|
+
widget_version: _chunkD3R3O4CYcjs.MODAL_VERSION,
|
|
3144
3507
|
timestamp: nowRef.current().toISOString(),
|
|
3145
3508
|
session_properties: sessionPropertiesRef.current
|
|
3146
3509
|
};
|
|
3147
|
-
_optionalChain([onEventRef, 'access',
|
|
3510
|
+
_optionalChain([onEventRef, 'access', _189 => _189.current, 'optionalCall', _190 => _190(event)]);
|
|
3148
3511
|
enqueue(event);
|
|
3149
3512
|
},
|
|
3150
3513
|
[enqueue, modal, nowRef, onEventRef]
|
|
@@ -3156,11 +3519,11 @@ function AnalyticsSession(props) {
|
|
|
3156
3519
|
...payload,
|
|
3157
3520
|
session_id: sessionIdRef.current,
|
|
3158
3521
|
modal,
|
|
3159
|
-
widget_version:
|
|
3522
|
+
widget_version: _chunkD3R3O4CYcjs.MODAL_VERSION,
|
|
3160
3523
|
timestamp: nowRef.current().toISOString(),
|
|
3161
3524
|
session_properties: sessionPropertiesRef.current
|
|
3162
3525
|
};
|
|
3163
|
-
_optionalChain([onEventRef, 'access',
|
|
3526
|
+
_optionalChain([onEventRef, 'access', _191 => _191.current, 'optionalCall', _192 => _192(event)]);
|
|
3164
3527
|
enqueue(event);
|
|
3165
3528
|
},
|
|
3166
3529
|
[enqueue, modal, nowRef, onEventRef]
|
|
@@ -3191,7 +3554,7 @@ function useClaimAnalyticsEmitter() {
|
|
|
3191
3554
|
|
|
3192
3555
|
var RECOVERABLE_STATUSES = /* @__PURE__ */ new Set(["failed", "rejected"]);
|
|
3193
3556
|
function recoverySigningChainId(row) {
|
|
3194
|
-
return
|
|
3557
|
+
return _chunkFKJ6EJHHcjs.parseEvmChainId.call(void 0, row.targetChain);
|
|
3195
3558
|
}
|
|
3196
3559
|
function sourceDepositTxHash(row) {
|
|
3197
3560
|
return _nullishCoalesce(row.sourceTxHash, () => ( row.txHash));
|
|
@@ -3199,7 +3562,7 @@ function sourceDepositTxHash(row) {
|
|
|
3199
3562
|
function toRecoverableDeposit(row, options = {}) {
|
|
3200
3563
|
if (!row.id) return null;
|
|
3201
3564
|
if (!RECOVERABLE_STATUSES.has((_nullishCoalesce(row.status, () => ( ""))).toLowerCase())) return null;
|
|
3202
|
-
const sourceChainId =
|
|
3565
|
+
const sourceChainId = _chunkFKJ6EJHHcjs.parseEvmChainId.call(void 0, row.chain);
|
|
3203
3566
|
const targetChainId = recoverySigningChainId(row);
|
|
3204
3567
|
if (sourceChainId === null || targetChainId === null) return null;
|
|
3205
3568
|
const signer = row.recipient;
|
|
@@ -3210,7 +3573,6 @@ function toRecoverableDeposit(row, options = {}) {
|
|
|
3210
3573
|
return {
|
|
3211
3574
|
depositId: row.id,
|
|
3212
3575
|
signer,
|
|
3213
|
-
destinationPrefill: signer,
|
|
3214
3576
|
depositAddress: row.depositAddress,
|
|
3215
3577
|
sourceChainId,
|
|
3216
3578
|
targetChainId,
|
|
@@ -3220,7 +3582,7 @@ function toRecoverableDeposit(row, options = {}) {
|
|
|
3220
3582
|
};
|
|
3221
3583
|
}
|
|
3222
3584
|
function isDepositSelfDestination(row, destination) {
|
|
3223
|
-
const depositAddress = _optionalChain([row, 'access',
|
|
3585
|
+
const depositAddress = _optionalChain([row, 'access', _193 => _193.depositAddress, 'optionalAccess', _194 => _194.trim, 'call', _195 => _195()]);
|
|
3224
3586
|
const candidate = destination.trim();
|
|
3225
3587
|
if (!depositAddress || !candidate) return false;
|
|
3226
3588
|
return depositAddress.toLowerCase() === candidate.toLowerCase();
|
|
@@ -3273,7 +3635,7 @@ var STATUS_LABEL = {
|
|
|
3273
3635
|
};
|
|
3274
3636
|
function filterVisibleDeposits(deposits) {
|
|
3275
3637
|
const sourceHashes = new Set(
|
|
3276
|
-
deposits.map((d) => _optionalChain([d, 'access',
|
|
3638
|
+
deposits.map((d) => _optionalChain([d, 'access', _196 => _196.sourceTxHash, 'optionalAccess', _197 => _197.toLowerCase, 'call', _198 => _198()])).filter((h) => Boolean(h))
|
|
3277
3639
|
);
|
|
3278
3640
|
return deposits.filter(
|
|
3279
3641
|
(d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
|
|
@@ -3326,22 +3688,23 @@ function historyBadgeAriaLabel(badge) {
|
|
|
3326
3688
|
function HistoryEntryButton({
|
|
3327
3689
|
badge,
|
|
3328
3690
|
onClick,
|
|
3329
|
-
disabled
|
|
3691
|
+
disabled,
|
|
3692
|
+
unread = false
|
|
3330
3693
|
}) {
|
|
3331
3694
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3332
3695
|
"button",
|
|
3333
3696
|
{
|
|
3334
3697
|
type: "button",
|
|
3335
3698
|
className: "rs-modal-header-history",
|
|
3336
|
-
"aria-label": historyBadgeAriaLabel(badge),
|
|
3699
|
+
"aria-label": unread ? "Deposit history \u2014 new bank transfer activity" : historyBadgeAriaLabel(badge),
|
|
3337
3700
|
onClick,
|
|
3338
3701
|
disabled,
|
|
3339
3702
|
children: [
|
|
3340
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, HistoryIcon, {}),
|
|
3341
|
-
badge && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3703
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.HistoryIcon, {}),
|
|
3704
|
+
(badge || unread) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3342
3705
|
"span",
|
|
3343
3706
|
{
|
|
3344
|
-
className: `rs-history-dot rs-history-dot--${badge.state}`,
|
|
3707
|
+
className: `rs-history-dot rs-history-dot--${_nullishCoalesce(_optionalChain([badge, 'optionalAccess', _199 => _199.state]), () => ( "progress"))}`,
|
|
3345
3708
|
"aria-hidden": "true"
|
|
3346
3709
|
}
|
|
3347
3710
|
)
|
|
@@ -3372,7 +3735,7 @@ function preconnectIconCdn() {
|
|
|
3372
3735
|
const link = document.createElement("link");
|
|
3373
3736
|
link.id = "rs-icon-cdn-preconnect";
|
|
3374
3737
|
link.rel = "preconnect";
|
|
3375
|
-
link.href =
|
|
3738
|
+
link.href = _chunkFKJ6EJHHcjs.ICON_CDN;
|
|
3376
3739
|
link.crossOrigin = "anonymous";
|
|
3377
3740
|
document.head.appendChild(link);
|
|
3378
3741
|
}
|
|
@@ -3391,82 +3754,25 @@ function CdnIcon({
|
|
|
3391
3754
|
}
|
|
3392
3755
|
const isLoading = loadedSrc !== src;
|
|
3393
3756
|
const settleIfAlreadyComplete = (el) => {
|
|
3394
|
-
if (_optionalChain([el, 'optionalAccess',
|
|
3757
|
+
if (_optionalChain([el, 'optionalAccess', _200 => _200.complete])) setLoadedSrc(src);
|
|
3395
3758
|
};
|
|
3396
3759
|
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",
|
|
3760
|
+
"img",
|
|
3446
3761
|
{
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
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
|
-
}
|
|
3762
|
+
ref: settleIfAlreadyComplete,
|
|
3763
|
+
src,
|
|
3764
|
+
alt,
|
|
3765
|
+
className: `rs-cdn-icon ${_nullishCoalesce(className, () => ( ""))}`.trimEnd(),
|
|
3766
|
+
loading,
|
|
3767
|
+
decoding: "async",
|
|
3768
|
+
"data-loading": isLoading ? "" : void 0,
|
|
3769
|
+
onLoad: () => setLoadedSrc(src),
|
|
3770
|
+
onError: () => setErroredSrc(src)
|
|
3771
|
+
},
|
|
3772
|
+
src
|
|
3468
3773
|
);
|
|
3469
3774
|
}
|
|
3775
|
+
CdnIcon.displayName = "CdnIcon";
|
|
3470
3776
|
|
|
3471
3777
|
// src/components/ui/Button.tsx
|
|
3472
3778
|
|
|
@@ -3497,11 +3803,11 @@ function Button({
|
|
|
3497
3803
|
"aria-busy": loading || void 0,
|
|
3498
3804
|
...props,
|
|
3499
3805
|
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" }),
|
|
3806
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.Spinner, { className: "rs-spinner--sm" }),
|
|
3501
3807
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: loadingText })
|
|
3502
3808
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3503
3809
|
/* @__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" }) })
|
|
3810
|
+
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
3811
|
] })
|
|
3506
3812
|
}
|
|
3507
3813
|
);
|
|
@@ -3540,7 +3846,7 @@ function Callout({ variant = "error", children, role }) {
|
|
|
3540
3846
|
className: `rs-callout rs-callout--${variant}`,
|
|
3541
3847
|
role: _nullishCoalesce(role, () => ( (variant === "error" ? "alert" : "status"))),
|
|
3542
3848
|
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, {}) }),
|
|
3849
|
+
/* @__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
3850
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-callout-text", children })
|
|
3545
3851
|
]
|
|
3546
3852
|
}
|
|
@@ -3619,15 +3925,257 @@ function PoweredBy() {
|
|
|
3619
3925
|
}
|
|
3620
3926
|
PoweredBy.displayName = "PoweredBy";
|
|
3621
3927
|
|
|
3928
|
+
// src/components/history/BankOrderCard.tsx
|
|
3929
|
+
|
|
3930
|
+
|
|
3931
|
+
// src/components/history/HistoryTransactionLink.tsx
|
|
3932
|
+
|
|
3933
|
+
function resolveHistoryChainId(value) {
|
|
3934
|
+
if (value === void 0 || value === null) return null;
|
|
3935
|
+
if (typeof value === "number") return value;
|
|
3936
|
+
const display = _chunkFKJ6EJHHcjs.displayChainIdForCaip2.call(void 0, value);
|
|
3937
|
+
if (display !== null) return display;
|
|
3938
|
+
if (value === "solana" || value === "hypercore") return value;
|
|
3939
|
+
const number = Number(value);
|
|
3940
|
+
return Number.isFinite(number) ? number : null;
|
|
3941
|
+
}
|
|
3942
|
+
function HistoryTransactionLink({
|
|
3943
|
+
chainId,
|
|
3944
|
+
txHash,
|
|
3945
|
+
label = "Transaction details"
|
|
3946
|
+
}) {
|
|
3947
|
+
const explorerTxUrl = useExplorerTxUrl();
|
|
3948
|
+
const chain = resolveHistoryChainId(chainId);
|
|
3949
|
+
const url = chain !== null && txHash ? explorerTxUrl(chain, txHash) : void 0;
|
|
3950
|
+
if (!url || !txHash) return null;
|
|
3951
|
+
const text = txHash.length > 14 ? `${txHash.slice(0, 6)}\u2026${txHash.slice(-4)}` : txHash;
|
|
3952
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
3953
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: label }),
|
|
3954
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3955
|
+
"a",
|
|
3956
|
+
{
|
|
3957
|
+
href: url,
|
|
3958
|
+
target: "_blank",
|
|
3959
|
+
rel: "noopener noreferrer",
|
|
3960
|
+
className: "rs-history-card-link",
|
|
3961
|
+
"aria-label": `${label}: ${txHash}`,
|
|
3962
|
+
children: [
|
|
3963
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: text }),
|
|
3964
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ArrowUpRightIcon, {})
|
|
3965
|
+
]
|
|
3966
|
+
}
|
|
3967
|
+
)
|
|
3968
|
+
] });
|
|
3969
|
+
}
|
|
3970
|
+
|
|
3971
|
+
// src/core/bank-onramp-progress.ts
|
|
3972
|
+
function toPaymentProgress(order) {
|
|
3973
|
+
const { receipt, conversion, delivery } = order.stages;
|
|
3974
|
+
const stages = [receipt.status, conversion.status, delivery.status];
|
|
3975
|
+
if (stages.includes("on_hold")) return "on_hold";
|
|
3976
|
+
if (order.stages.return.status !== "none") return "returned";
|
|
3977
|
+
if (stages.includes("failed")) return "failed";
|
|
3978
|
+
if (delivery.status === "completed") return "delivered";
|
|
3979
|
+
if (delivery.status !== "not_started") return "sending";
|
|
3980
|
+
if (conversion.status === "completed") return "sending";
|
|
3981
|
+
if (conversion.status !== "not_started") return "converting";
|
|
3982
|
+
if (receipt.status === "completed") return "received";
|
|
3983
|
+
return "awaiting_transfer";
|
|
3984
|
+
}
|
|
3985
|
+
var TERMINAL = /* @__PURE__ */ new Set([
|
|
3986
|
+
"delivered",
|
|
3987
|
+
"returned",
|
|
3988
|
+
"failed"
|
|
3989
|
+
]);
|
|
3990
|
+
function toPaymentView(order) {
|
|
3991
|
+
const progress = toPaymentProgress(order);
|
|
3992
|
+
return {
|
|
3993
|
+
id: order.id,
|
|
3994
|
+
amount: _nullishCoalesce(_optionalChain([order, 'access', _201 => _201.fiat, 'access', _202 => _202.charged, 'optionalAccess', _203 => _203.total]), () => ( "")),
|
|
3995
|
+
currency: _nullishCoalesce(_optionalChain([order, 'access', _204 => _204.fiat, 'access', _205 => _205.charged, 'optionalAccess', _206 => _206.currency]), () => ( "")),
|
|
3996
|
+
progress,
|
|
3997
|
+
terminal: TERMINAL.has(progress)
|
|
3998
|
+
};
|
|
3999
|
+
}
|
|
4000
|
+
var BANK_ONRAMP_COPY = {
|
|
4001
|
+
awaiting_transfer: {
|
|
4002
|
+
title: "Waiting for your transfer",
|
|
4003
|
+
subtitle: "Send the transfer from your bank using the details above."
|
|
4004
|
+
},
|
|
4005
|
+
received: {
|
|
4006
|
+
title: "Transfer received",
|
|
4007
|
+
subtitle: "Your bank transfer has arrived and is being processed."
|
|
4008
|
+
},
|
|
4009
|
+
converting: {
|
|
4010
|
+
title: "Converting",
|
|
4011
|
+
subtitle: "Your money is being converted to crypto."
|
|
4012
|
+
},
|
|
4013
|
+
sending: {
|
|
4014
|
+
title: "Sending to your account",
|
|
4015
|
+
subtitle: "The crypto is on its way. This usually takes a few minutes."
|
|
4016
|
+
},
|
|
4017
|
+
delivered: {
|
|
4018
|
+
title: "Funds delivered",
|
|
4019
|
+
subtitle: "The crypto has arrived in your account."
|
|
4020
|
+
},
|
|
4021
|
+
on_hold: {
|
|
4022
|
+
title: "Under review",
|
|
4023
|
+
subtitle: "Your provider is reviewing this transfer and may contact you for more information."
|
|
4024
|
+
},
|
|
4025
|
+
returned: {
|
|
4026
|
+
title: "Transfer returned",
|
|
4027
|
+
subtitle: "This transfer was returned. Contact support if unexpected."
|
|
4028
|
+
},
|
|
4029
|
+
failed: {
|
|
4030
|
+
title: "Transfer failed",
|
|
4031
|
+
subtitle: "This transfer could not be completed. Contact support."
|
|
4032
|
+
}
|
|
4033
|
+
};
|
|
4034
|
+
|
|
4035
|
+
// src/components/history/BankOrderCard.tsx
|
|
4036
|
+
|
|
4037
|
+
function bankSupportHref(value) {
|
|
4038
|
+
if (!value) return void 0;
|
|
4039
|
+
try {
|
|
4040
|
+
const url = new URL(value);
|
|
4041
|
+
return ["https:", "mailto:"].includes(url.protocol) ? url.href : void 0;
|
|
4042
|
+
} catch (e14) {
|
|
4043
|
+
return void 0;
|
|
4044
|
+
}
|
|
4045
|
+
}
|
|
4046
|
+
function BankOrderCard({
|
|
4047
|
+
order,
|
|
4048
|
+
supportUrl,
|
|
4049
|
+
children,
|
|
4050
|
+
deposit
|
|
4051
|
+
}) {
|
|
4052
|
+
const [expanded, setExpanded] = _react.useState.call(void 0, false);
|
|
4053
|
+
const panelId = _react.useId.call(void 0, );
|
|
4054
|
+
const view = toPaymentView(order);
|
|
4055
|
+
const subFee = [order.stages.conversion, order.stages.delivery].some(
|
|
4056
|
+
(stage) => stage.status === "failed" && stage.reason === "sub_fee"
|
|
4057
|
+
);
|
|
4058
|
+
const support = bankSupportHref(supportUrl);
|
|
4059
|
+
const { delivery } = order.stages;
|
|
4060
|
+
const deliveryTxHash = "txHash" in delivery ? delivery.txHash : void 0;
|
|
4061
|
+
const needsHelp = ["failed", "returned", "on_hold"].includes(view.progress);
|
|
4062
|
+
const settlement = deposit ? normalizeStatus(deposit.status, deposit.isSpam) : null;
|
|
4063
|
+
let status = "pending";
|
|
4064
|
+
let label = "Detected";
|
|
4065
|
+
if (view.progress === "failed" || settlement === "failed" || settlement === "spam") {
|
|
4066
|
+
status = "failed";
|
|
4067
|
+
label = "Failed";
|
|
4068
|
+
} else if (view.progress === "returned" || settlement === "refunded") {
|
|
4069
|
+
status = "refunded";
|
|
4070
|
+
label = "Returned";
|
|
4071
|
+
} else if (settlement === "completed") {
|
|
4072
|
+
status = "completed";
|
|
4073
|
+
label = "Completed";
|
|
4074
|
+
} else if (view.progress === "on_hold") {
|
|
4075
|
+
status = "processing";
|
|
4076
|
+
label = "Under review";
|
|
4077
|
+
} else if (view.progress === "delivered") {
|
|
4078
|
+
status = "processing";
|
|
4079
|
+
label = "Settled";
|
|
4080
|
+
} else if (view.progress !== "awaiting_transfer" && view.progress !== "received") {
|
|
4081
|
+
status = "processing";
|
|
4082
|
+
label = "Settling";
|
|
4083
|
+
}
|
|
4084
|
+
const amount = view.amount && Number.isFinite(Number(view.amount)) ? `${Number(view.amount).toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${view.currency}` : "\u2014";
|
|
4085
|
+
const date = new Date(order.createdAt).toLocaleDateString(void 0, {
|
|
4086
|
+
day: "numeric",
|
|
4087
|
+
month: "short",
|
|
4088
|
+
year: "numeric"
|
|
4089
|
+
});
|
|
4090
|
+
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;
|
|
4091
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4092
|
+
"div",
|
|
4093
|
+
{
|
|
4094
|
+
className: `rs-history-card${expanded ? " rs-history-card--expanded" : ""}`,
|
|
4095
|
+
children: [
|
|
4096
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4097
|
+
"button",
|
|
4098
|
+
{
|
|
4099
|
+
type: "button",
|
|
4100
|
+
className: "rs-history-card-trigger",
|
|
4101
|
+
onClick: () => setExpanded(!expanded),
|
|
4102
|
+
"aria-expanded": expanded,
|
|
4103
|
+
"aria-controls": panelId,
|
|
4104
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-card-row", children: [
|
|
4105
|
+
/* @__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, {}) }) }),
|
|
4106
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-card-text", children: [
|
|
4107
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-card-title", children: "Bank transfer" }),
|
|
4108
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "time", { className: "rs-history-card-date", dateTime: order.createdAt, children: date })
|
|
4109
|
+
] }),
|
|
4110
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-card-side", children: [
|
|
4111
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-card-amount", children: amount }),
|
|
4112
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `rs-history-badge rs-history-badge--${status}`, children: label })
|
|
4113
|
+
] })
|
|
4114
|
+
] })
|
|
4115
|
+
}
|
|
4116
|
+
),
|
|
4117
|
+
/* @__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: [
|
|
4118
|
+
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 }),
|
|
4119
|
+
order.crypto && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
4120
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Converted amount" }),
|
|
4121
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-detail-value", children: [
|
|
4122
|
+
order.crypto.amount,
|
|
4123
|
+
" ",
|
|
4124
|
+
order.crypto.asset
|
|
4125
|
+
] })
|
|
4126
|
+
] }),
|
|
4127
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4128
|
+
HistoryTransactionLink,
|
|
4129
|
+
{
|
|
4130
|
+
chainId: _nullishCoalesce(_optionalChain([deposit, 'optionalAccess', _207 => _207.chain]), () => ( order.deliveryChain)),
|
|
4131
|
+
txHash: _nullishCoalesce(_optionalChain([deposit, 'optionalAccess', _208 => _208.txHash]), () => ( deliveryTxHash)),
|
|
4132
|
+
label: "Crypto deposit"
|
|
4133
|
+
}
|
|
4134
|
+
),
|
|
4135
|
+
_optionalChain([deposit, 'optionalAccess', _209 => _209.destinationTxHash]) !== _optionalChain([deposit, 'optionalAccess', _210 => _210.txHash]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HistoryTransactionLink, { chainId: _optionalChain([deposit, 'optionalAccess', _211 => _211.targetChain]), txHash: _optionalChain([deposit, 'optionalAccess', _212 => _212.destinationTxHash]), label: "Final settlement" }),
|
|
4136
|
+
(needsHelp || status === "failed") && support && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4137
|
+
"a",
|
|
4138
|
+
{
|
|
4139
|
+
className: "rs-history-card-link",
|
|
4140
|
+
href: support,
|
|
4141
|
+
target: "_blank",
|
|
4142
|
+
rel: "noopener noreferrer",
|
|
4143
|
+
children: [
|
|
4144
|
+
"Contact support ",
|
|
4145
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ArrowUpRightIcon, {})
|
|
4146
|
+
]
|
|
4147
|
+
}
|
|
4148
|
+
),
|
|
4149
|
+
children
|
|
4150
|
+
] }) }) })
|
|
4151
|
+
]
|
|
4152
|
+
}
|
|
4153
|
+
);
|
|
4154
|
+
}
|
|
4155
|
+
|
|
3622
4156
|
// src/components/ui/TokenIcon.tsx
|
|
3623
4157
|
|
|
3624
|
-
function TokenIcon({ symbol, className, fallback }) {
|
|
4158
|
+
function TokenIcon({ token, symbol, className, fallback }) {
|
|
4159
|
+
const id = assetIdForRef(token);
|
|
4160
|
+
const entry = useAssetMetadata([token])[_nullishCoalesce(id, () => ( ""))];
|
|
4161
|
+
const classes = `rs-token-icon ${_nullishCoalesce(className, () => ( ""))}`.trimEnd();
|
|
4162
|
+
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() })));
|
|
4163
|
+
if (_optionalChain([entry, 'optionalAccess', _213 => _213.status]) === "pending") {
|
|
4164
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4165
|
+
"span",
|
|
4166
|
+
{
|
|
4167
|
+
className: `${classes} rs-token-icon--pending`,
|
|
4168
|
+
"data-loading": "",
|
|
4169
|
+
"aria-hidden": "true"
|
|
4170
|
+
}
|
|
4171
|
+
);
|
|
4172
|
+
}
|
|
3625
4173
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3626
4174
|
CdnIcon,
|
|
3627
4175
|
{
|
|
3628
|
-
src:
|
|
3629
|
-
className:
|
|
3630
|
-
fallback
|
|
4176
|
+
src: _optionalChain([entry, 'optionalAccess', _214 => _214.status]) === "ready" ? entry.logo : void 0,
|
|
4177
|
+
className: classes,
|
|
4178
|
+
fallback: badge
|
|
3631
4179
|
}
|
|
3632
4180
|
);
|
|
3633
4181
|
}
|
|
@@ -3707,6 +4255,82 @@ function resolveHistoryTiming({
|
|
|
3707
4255
|
};
|
|
3708
4256
|
}
|
|
3709
4257
|
|
|
4258
|
+
// src/core/token-display.ts
|
|
4259
|
+
|
|
4260
|
+
function isHyperCore(chain) {
|
|
4261
|
+
return chain === "hypercore" || chain === _chunkFKJ6EJHHcjs.HYPERCORE_CHAIN_ID;
|
|
4262
|
+
}
|
|
4263
|
+
function resolveCuratedToken(token, chain) {
|
|
4264
|
+
if (isHyperCore(chain)) {
|
|
4265
|
+
const listed = _chunkFKJ6EJHHcjs.HYPERCORE_SOURCE_TOKENS.find(
|
|
4266
|
+
(t) => t.address.toLowerCase() === token.toLowerCase()
|
|
4267
|
+
);
|
|
4268
|
+
return listed ? { symbol: listed.symbol, decimals: listed.decimals } : void 0;
|
|
4269
|
+
}
|
|
4270
|
+
const published = getRuntimeTokenByAddress(chain, token);
|
|
4271
|
+
if (published) {
|
|
4272
|
+
return { symbol: published.symbol, decimals: published.decimals };
|
|
4273
|
+
}
|
|
4274
|
+
if (chain === "solana") return resolveSolanaToken(token);
|
|
4275
|
+
if (isNativeSpelling(chain, token)) {
|
|
4276
|
+
const symbol = _chunkFKJ6EJHHcjs.getRuntimeNativeSymbol.call(void 0, chain);
|
|
4277
|
+
const decimals = _nullishCoalesce(_chunkFKJ6EJHHcjs.getRuntimeNativeDecimals.call(void 0, chain), () => ( (typeof chain === "number" ? 18 : void 0)));
|
|
4278
|
+
return symbol ? { symbol, decimals } : void 0;
|
|
4279
|
+
}
|
|
4280
|
+
return void 0;
|
|
4281
|
+
}
|
|
4282
|
+
function resolveTokenDisplay(token, chain, asset, fallback) {
|
|
4283
|
+
const pending = _optionalChain([asset, 'optionalAccess', _215 => _215.status]) === "pending";
|
|
4284
|
+
const curated = token !== void 0 && chain !== void 0 ? resolveCuratedToken(token, chain) : void 0;
|
|
4285
|
+
const fromAsset = _optionalChain([asset, 'optionalAccess', _216 => _216.status]) === "ready" ? asset : void 0;
|
|
4286
|
+
const hyperCore = chain !== void 0 && isHyperCore(chain);
|
|
4287
|
+
const native = token !== void 0 && chain !== void 0 && isNativeSpelling(chain, token);
|
|
4288
|
+
const curatedSymbol = native ? _nullishCoalesce(_optionalChain([curated, 'optionalAccess', _217 => _217.symbol]), () => ( _optionalChain([fromAsset, 'optionalAccess', _218 => _218.symbol]))) : _nullishCoalesce(_optionalChain([fromAsset, 'optionalAccess', _219 => _219.symbol]), () => ( _optionalChain([curated, 'optionalAccess', _220 => _220.symbol])));
|
|
4289
|
+
const decimals = _nullishCoalesce(_nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _221 => _221.decimals]), () => ( _optionalChain([curated, 'optionalAccess', _222 => _222.decimals]))), () => ( (hyperCore ? void 0 : _optionalChain([fromAsset, 'optionalAccess', _223 => _223.decimals]))));
|
|
4290
|
+
return {
|
|
4291
|
+
symbol: _nullishCoalesce(_nullishCoalesce(curatedSymbol, () => ( _optionalChain([fallback, 'optionalAccess', _224 => _224.symbol]))), () => ( "Token")),
|
|
4292
|
+
decimals,
|
|
4293
|
+
logo: _optionalChain([fromAsset, 'optionalAccess', _225 => _225.logo]),
|
|
4294
|
+
curated: curatedSymbol !== void 0,
|
|
4295
|
+
pending
|
|
4296
|
+
};
|
|
4297
|
+
}
|
|
4298
|
+
function toAssetRef(ref) {
|
|
4299
|
+
return _optionalChain([ref, 'optionalAccess', _226 => _226.chain]) !== void 0 && ref.address ? { chain: ref.chain, address: ref.address } : void 0;
|
|
4300
|
+
}
|
|
4301
|
+
function useTokenDisplays(refs) {
|
|
4302
|
+
const { catalog } = useChainCatalog();
|
|
4303
|
+
const tokensVersion = _react.useSyncExternalStore.call(void 0,
|
|
4304
|
+
subscribeToRuntimeTokens,
|
|
4305
|
+
getRuntimeTokensVersion,
|
|
4306
|
+
getRuntimeTokensVersion
|
|
4307
|
+
);
|
|
4308
|
+
const assets = useAssetMetadata(refs.map(toAssetRef));
|
|
4309
|
+
const key = refs.map(
|
|
4310
|
+
(ref) => `${String(_optionalChain([ref, 'optionalAccess', _227 => _227.chain]))}:${_nullishCoalesce(_optionalChain([ref, 'optionalAccess', _228 => _228.address]), () => ( ""))}:${_nullishCoalesce(_optionalChain([ref, 'optionalAccess', _229 => _229.fallback, 'optionalAccess', _230 => _230.symbol]), () => ( ""))}:${_nullishCoalesce(_optionalChain([ref, 'optionalAccess', _231 => _231.fallback, 'optionalAccess', _232 => _232.decimals]), () => ( ""))}`
|
|
4311
|
+
).join("|");
|
|
4312
|
+
return _react.useMemo.call(void 0,
|
|
4313
|
+
() => refs.map((ref) => {
|
|
4314
|
+
const id = assetIdFor(_optionalChain([ref, 'optionalAccess', _233 => _233.chain]), _optionalChain([ref, 'optionalAccess', _234 => _234.address]));
|
|
4315
|
+
return resolveTokenDisplay(
|
|
4316
|
+
_optionalChain([ref, 'optionalAccess', _235 => _235.address]),
|
|
4317
|
+
_optionalChain([ref, 'optionalAccess', _236 => _236.chain]),
|
|
4318
|
+
id ? assets[id] : void 0,
|
|
4319
|
+
_optionalChain([ref, 'optionalAccess', _237 => _237.fallback])
|
|
4320
|
+
);
|
|
4321
|
+
}),
|
|
4322
|
+
// `refs` enters through `key`.
|
|
4323
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4324
|
+
[key, assets, catalog, tokensVersion]
|
|
4325
|
+
);
|
|
4326
|
+
}
|
|
4327
|
+
function useTokenDisplay(chain, address, fallback) {
|
|
4328
|
+
return useTokenDisplays([{ chain, address, fallback }])[0];
|
|
4329
|
+
}
|
|
4330
|
+
function useIsRecognizedToken(chain, address) {
|
|
4331
|
+
return useTokenDisplay(chain, address).curated;
|
|
4332
|
+
}
|
|
4333
|
+
|
|
3710
4334
|
// src/components/history/DepositHistoryPanel.tsx
|
|
3711
4335
|
|
|
3712
4336
|
var MAX_TIMER_DELAY_MS = 2147e6;
|
|
@@ -3723,64 +4347,12 @@ function formatDate(iso) {
|
|
|
3723
4347
|
month: "short",
|
|
3724
4348
|
year: "numeric"
|
|
3725
4349
|
});
|
|
3726
|
-
} catch (
|
|
4350
|
+
} catch (e15) {
|
|
3727
4351
|
return iso;
|
|
3728
4352
|
}
|
|
3729
4353
|
}
|
|
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
|
-
}
|
|
4354
|
+
function formatAmount(rawAmount, decimals) {
|
|
4355
|
+
if (!rawAmount || decimals === void 0) return null;
|
|
3784
4356
|
try {
|
|
3785
4357
|
const raw = BigInt(rawAmount);
|
|
3786
4358
|
const divisor = 10n ** BigInt(decimals);
|
|
@@ -3790,11 +4362,13 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
3790
4362
|
let frac = fracStr.slice(0, 5).replace(/0+$/, "");
|
|
3791
4363
|
if (frac.length < 2) frac = frac.padEnd(2, "0");
|
|
3792
4364
|
return `${whole}.${frac}`;
|
|
3793
|
-
} catch (
|
|
4365
|
+
} catch (e16) {
|
|
3794
4366
|
return rawAmount;
|
|
3795
4367
|
}
|
|
3796
4368
|
}
|
|
3797
4369
|
function DepositHistoryPanel({
|
|
4370
|
+
bankHistory,
|
|
4371
|
+
bankSupportUrl,
|
|
3798
4372
|
deposits,
|
|
3799
4373
|
isLoading,
|
|
3800
4374
|
error,
|
|
@@ -3813,7 +4387,7 @@ function DepositHistoryPanel({
|
|
|
3813
4387
|
}) {
|
|
3814
4388
|
const rootRef = _react.useRef.call(void 0, null);
|
|
3815
4389
|
_react.useEffect.call(void 0, () => {
|
|
3816
|
-
_optionalChain([rootRef, 'access',
|
|
4390
|
+
_optionalChain([rootRef, 'access', _238 => _238.current, 'optionalAccess', _239 => _239.toggleAttribute, 'call', _240 => _240("inert", Boolean(obscured))]);
|
|
3817
4391
|
}, [obscured]);
|
|
3818
4392
|
const handleKeyDown = _react.useCallback.call(void 0,
|
|
3819
4393
|
(e) => {
|
|
@@ -3847,7 +4421,7 @@ function DepositHistoryPanel({
|
|
|
3847
4421
|
_react.useEffect.call(void 0, () => {
|
|
3848
4422
|
const nextBoundary = timingPresentations.reduce(
|
|
3849
4423
|
(earliest, presentation) => {
|
|
3850
|
-
const next = _optionalChain([presentation, 'optionalAccess',
|
|
4424
|
+
const next = _optionalChain([presentation, 'optionalAccess', _241 => _241.nextTransitionAtMs]);
|
|
3851
4425
|
if (next === void 0) return earliest;
|
|
3852
4426
|
return earliest === void 0 || next < earliest ? next : earliest;
|
|
3853
4427
|
},
|
|
@@ -3890,7 +4464,7 @@ function DepositHistoryPanel({
|
|
|
3890
4464
|
"aria-label": backLabel ? `Back to ${backLabel.toLowerCase()}` : "Back",
|
|
3891
4465
|
onClick: onClose,
|
|
3892
4466
|
children: [
|
|
3893
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronLeftIcon, {}),
|
|
4467
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronLeftIcon, {}),
|
|
3894
4468
|
backLabel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: backLabel })
|
|
3895
4469
|
]
|
|
3896
4470
|
}
|
|
@@ -3902,13 +4476,13 @@ function DepositHistoryPanel({
|
|
|
3902
4476
|
className: "rs-modal-close",
|
|
3903
4477
|
"aria-label": "Close",
|
|
3904
4478
|
onClick: onCloseModal,
|
|
3905
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CloseIcon, {})
|
|
4479
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CloseIcon, {})
|
|
3906
4480
|
}
|
|
3907
4481
|
) })
|
|
3908
4482
|
] }),
|
|
3909
4483
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen", children: [
|
|
3910
4484
|
/* @__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 }),
|
|
4485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.HistoryIcon, {}), title }),
|
|
3912
4486
|
onFindByTxHash && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3913
4487
|
"button",
|
|
3914
4488
|
{
|
|
@@ -3921,40 +4495,82 @@ function DepositHistoryPanel({
|
|
|
3921
4495
|
]
|
|
3922
4496
|
}
|
|
3923
4497
|
),
|
|
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, {}) }),
|
|
4498
|
+
(isLoading || _optionalChain([bankHistory, 'optionalAccess', _242 => _242.loading])) && deposits.length === 0 && !_optionalChain([bankHistory, 'optionalAccess', _243 => _243.orders, 'access', _244 => _244.length]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
4499
|
+
/* @__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
4500
|
/* @__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" }),
|
|
4501
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.Spinner, { className: "rs-spinner--sm" }),
|
|
3928
4502
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
|
|
3929
4503
|
] })
|
|
3930
4504
|
] }),
|
|
3931
4505
|
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, {}) }),
|
|
4506
|
+
/* @__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
4507
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
3934
4508
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
|
|
3935
4509
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: error })
|
|
3936
4510
|
] })
|
|
3937
4511
|
] }),
|
|
3938
|
-
|
|
3939
|
-
|
|
4512
|
+
_optionalChain([bankHistory, 'optionalAccess', _245 => _245.error]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "status", children: bankHistory.error }),
|
|
4513
|
+
!isLoading && !error && !_optionalChain([bankHistory, 'optionalAccess', _246 => _246.loading]) && !_optionalChain([bankHistory, 'optionalAccess', _247 => _247.error]) && !_optionalChain([bankHistory, 'optionalAccess', _248 => _248.orders, 'access', _249 => _249.length]) && visibleDeposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
4514
|
+
/* @__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
4515
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
3941
4516
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "No deposits yet" }),
|
|
3942
4517
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
|
|
3943
4518
|
] })
|
|
3944
4519
|
] }),
|
|
3945
|
-
visibleDeposits.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-list", children: [
|
|
3946
|
-
|
|
3947
|
-
|
|
4520
|
+
(visibleDeposits.length > 0 || Boolean(_optionalChain([bankHistory, 'optionalAccess', _250 => _250.orders, 'access', _251 => _251.length]))) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-list", children: [
|
|
4521
|
+
[
|
|
4522
|
+
...visibleDeposits.filter(
|
|
4523
|
+
(deposit) => !_optionalChain([bankHistory, 'optionalAccess', _252 => _252.orders, 'access', _253 => _253.some, 'call', _254 => _254(
|
|
4524
|
+
(order) => order.stages.delivery.status === "completed" && order.stages.delivery.depositId === deposit.id
|
|
4525
|
+
)])
|
|
4526
|
+
).map((deposit, i) => ({
|
|
4527
|
+
id: `deposit:${_nullishCoalesce(deposit.id, () => ( deposit.txHash))}`,
|
|
4528
|
+
createdAt: _nullishCoalesce(deposit.createdAt, () => ( "")),
|
|
4529
|
+
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4530
|
+
HistoryCard,
|
|
4531
|
+
{
|
|
4532
|
+
deposit,
|
|
4533
|
+
timing: timingPresentations[visibleDeposits.indexOf(deposit)],
|
|
4534
|
+
position: i,
|
|
4535
|
+
recipient,
|
|
4536
|
+
onRecover,
|
|
4537
|
+
onRowView
|
|
4538
|
+
},
|
|
4539
|
+
deposit.txHash || i
|
|
4540
|
+
)
|
|
4541
|
+
})),
|
|
4542
|
+
...(_nullishCoalesce(_optionalChain([bankHistory, 'optionalAccess', _255 => _255.orders]), () => ( []))).map((order) => {
|
|
4543
|
+
const delivery = order.stages.delivery;
|
|
4544
|
+
const linked = delivery.status === "completed" ? visibleDeposits.find(
|
|
4545
|
+
(deposit) => deposit.id === delivery.depositId
|
|
4546
|
+
) : void 0;
|
|
4547
|
+
return {
|
|
4548
|
+
id: `bank:${order.id}`,
|
|
4549
|
+
createdAt: order.createdAt,
|
|
4550
|
+
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,
|
|
4551
|
+
HistoryCard,
|
|
4552
|
+
{
|
|
4553
|
+
deposit: linked,
|
|
4554
|
+
position: visibleDeposits.indexOf(linked),
|
|
4555
|
+
recipient,
|
|
4556
|
+
onRecover,
|
|
4557
|
+
onRowView,
|
|
4558
|
+
timing: timingPresentations[visibleDeposits.indexOf(linked)]
|
|
4559
|
+
}
|
|
4560
|
+
) })
|
|
4561
|
+
};
|
|
4562
|
+
})
|
|
4563
|
+
].sort((a, b) => b.createdAt.localeCompare(a.createdAt)).map((entry) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: entry.content }, entry.id)),
|
|
4564
|
+
_optionalChain([bankHistory, 'optionalAccess', _256 => _256.hasMore]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4565
|
+
"button",
|
|
3948
4566
|
{
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
deposit.txHash || i
|
|
3957
|
-
)),
|
|
4567
|
+
type: "button",
|
|
4568
|
+
className: "rs-history-load-more",
|
|
4569
|
+
disabled: bankHistory.loading,
|
|
4570
|
+
onClick: bankHistory.loadMore,
|
|
4571
|
+
children: "Load older bank transfers"
|
|
4572
|
+
}
|
|
4573
|
+
),
|
|
3958
4574
|
hasMore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3959
4575
|
"button",
|
|
3960
4576
|
{
|
|
@@ -3981,27 +4597,27 @@ function HistoryCard({
|
|
|
3981
4597
|
onRecover,
|
|
3982
4598
|
onRowView
|
|
3983
4599
|
}) {
|
|
3984
|
-
const explorerTxUrl = useExplorerTxUrl();
|
|
3985
4600
|
const [expanded, setExpanded] = _react.useState.call(void 0, false);
|
|
3986
4601
|
const panelId = _react.useId.call(void 0, );
|
|
3987
4602
|
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
|
|
4603
|
+
const sourceChainId = resolveHistoryChainId(deposit.chain);
|
|
4604
|
+
const targetChainId = resolveHistoryChainId(deposit.targetChain);
|
|
4605
|
+
const sourceChainName = sourceChainId ? _chunkFKJ6EJHHcjs.getChainName.call(void 0, sourceChainId) : null;
|
|
4606
|
+
const targetChainName = targetChainId ? _chunkFKJ6EJHHcjs.getChainName.call(void 0, targetChainId) : null;
|
|
4607
|
+
const sourceChainIcon = sourceChainId ? _chunkFKJ6EJHHcjs.getChainIcon.call(void 0, sourceChainId) : void 0;
|
|
4608
|
+
const targetChainIcon = targetChainId ? _chunkFKJ6EJHHcjs.getChainIcon.call(void 0, targetChainId) : void 0;
|
|
4609
|
+
const sourceToken = _nullishCoalesce(deposit.token, () => ( void 0));
|
|
4610
|
+
const tokenDisplay = useTokenDisplay(_nullishCoalesce(sourceChainId, () => ( void 0)), sourceToken);
|
|
4611
|
+
const sourceSymbol = !sourceToken ? "" : tokenDisplay.curated ? tokenDisplay.symbol : shortenHash(sourceToken);
|
|
3995
4612
|
const rawAmount = deposit.sourceAmount && deposit.sourceAmount !== "0" ? deposit.sourceAmount : deposit.amount;
|
|
3996
|
-
const formattedAmount = rawAmount ? formatAmount(rawAmount,
|
|
4613
|
+
const formattedAmount = rawAmount ? formatAmount(rawAmount, tokenDisplay.decimals) : null;
|
|
3997
4614
|
const displayAmount = formattedAmount ? sourceSymbol && /^USD/.test(sourceSymbol) ? `$${Number(formattedAmount).toLocaleString("en-US", {
|
|
3998
4615
|
minimumFractionDigits: 2,
|
|
3999
4616
|
maximumFractionDigits: 2
|
|
4000
|
-
})}` : `${formattedAmount} ${sourceSymbol}` : "\u2014";
|
|
4617
|
+
})}` : `${formattedAmount} ${sourceSymbol}` : rawAmount && tokenDisplay.pending ? "\u2026" : "\u2014";
|
|
4001
4618
|
const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
|
|
4002
4619
|
const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
|
|
4003
4620
|
const srcTxHash = sourceChainId === "hypercore" ? deposit.txHash : deposit.sourceTxHash;
|
|
4004
|
-
const srcTxUrl = srcTxHash && sourceChainId ? explorerTxUrl(sourceChainId, srcTxHash) : null;
|
|
4005
4621
|
const eligible = toRecoverableDeposit(deposit, { recipient });
|
|
4006
4622
|
const recoverable = onRecover ? eligible : null;
|
|
4007
4623
|
const toggleExpanded = () => {
|
|
@@ -4009,7 +4625,7 @@ function HistoryCard({
|
|
|
4009
4625
|
setExpanded(next);
|
|
4010
4626
|
const depositId = _nullishCoalesce(deposit.id, () => ( deposit.txHash));
|
|
4011
4627
|
if (!next || !depositId) return;
|
|
4012
|
-
_optionalChain([onRowView, 'optionalCall',
|
|
4628
|
+
_optionalChain([onRowView, 'optionalCall', _257 => _257({
|
|
4013
4629
|
depositId,
|
|
4014
4630
|
status,
|
|
4015
4631
|
recoverable: eligible !== null,
|
|
@@ -4034,6 +4650,7 @@ function HistoryCard({
|
|
|
4034
4650
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-card-token", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4035
4651
|
TokenIcon,
|
|
4036
4652
|
{
|
|
4653
|
+
token: sourceChainId !== null && sourceToken ? { chain: sourceChainId, address: sourceToken } : void 0,
|
|
4037
4654
|
symbol: sourceSymbol,
|
|
4038
4655
|
fallback: sourceSymbol.slice(0, 2)
|
|
4039
4656
|
}
|
|
@@ -4067,22 +4684,7 @@ function HistoryCard({
|
|
|
4067
4684
|
targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CdnIcon, { src: targetChainIcon }) })
|
|
4068
4685
|
] })
|
|
4069
4686
|
] }),
|
|
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
|
-
] }),
|
|
4687
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, HistoryTransactionLink, { chainId: sourceChainId, txHash: srcTxHash }),
|
|
4086
4688
|
timing && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4087
4689
|
"span",
|
|
4088
4690
|
{
|
|
@@ -4096,7 +4698,7 @@ function HistoryCard({
|
|
|
4096
4698
|
recoverable && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4097
4699
|
Button,
|
|
4098
4700
|
{
|
|
4099
|
-
onClick: () => _optionalChain([onRecover, 'optionalCall',
|
|
4701
|
+
onClick: () => _optionalChain([onRecover, 'optionalCall', _258 => _258(recoverable)]),
|
|
4100
4702
|
fullWidth: true,
|
|
4101
4703
|
className: "rs-history-card-recover",
|
|
4102
4704
|
children: [
|
|
@@ -4104,7 +4706,7 @@ function HistoryCard({
|
|
|
4104
4706
|
"Recover ",
|
|
4105
4707
|
displayAmount
|
|
4106
4708
|
] }),
|
|
4107
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronRightIcon, {})
|
|
4709
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronRightIcon, {})
|
|
4108
4710
|
]
|
|
4109
4711
|
}
|
|
4110
4712
|
)
|
|
@@ -4154,14 +4756,14 @@ function ListRow({
|
|
|
4154
4756
|
}
|
|
4155
4757
|
) : meta && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list-row-meta", children: meta })
|
|
4156
4758
|
] }),
|
|
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, {})))) })
|
|
4759
|
+
/* @__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
4760
|
] });
|
|
4159
4761
|
if (action) {
|
|
4160
4762
|
const handleKey = (e) => {
|
|
4161
4763
|
if (disabled) return;
|
|
4162
4764
|
if (e.key === "Enter" || e.key === " ") {
|
|
4163
4765
|
e.preventDefault();
|
|
4164
|
-
_optionalChain([onClick, 'optionalCall',
|
|
4766
|
+
_optionalChain([onClick, 'optionalCall', _259 => _259(e)]);
|
|
4165
4767
|
}
|
|
4166
4768
|
};
|
|
4167
4769
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -4171,7 +4773,7 @@ function ListRow({
|
|
|
4171
4773
|
role: "button",
|
|
4172
4774
|
tabIndex: disabled ? -1 : 0,
|
|
4173
4775
|
"aria-disabled": disabled || void 0,
|
|
4174
|
-
onClick: disabled ? void 0 : (e) => _optionalChain([onClick, 'optionalCall',
|
|
4776
|
+
onClick: disabled ? void 0 : (e) => _optionalChain([onClick, 'optionalCall', _260 => _260(e)]),
|
|
4175
4777
|
onKeyDown: handleKey,
|
|
4176
4778
|
children: inner
|
|
4177
4779
|
}
|
|
@@ -4211,7 +4813,7 @@ var Input = _react.forwardRef.call(void 0,
|
|
|
4211
4813
|
}
|
|
4212
4814
|
),
|
|
4213
4815
|
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" }),
|
|
4816
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.AlertTriangleIcon, { className: "rs-input-error-icon" }),
|
|
4215
4817
|
error
|
|
4216
4818
|
] }) : hint && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "rs-input-hint", children: hint })
|
|
4217
4819
|
] });
|
|
@@ -4229,7 +4831,7 @@ var RECOVERY_LOOKUP_MISS_COPY = {
|
|
|
4229
4831
|
};
|
|
4230
4832
|
function classifyRecoveryLookup(rows, options = {}) {
|
|
4231
4833
|
const inScope = options.recipient ? rows.filter(
|
|
4232
|
-
(row) => _optionalChain([row, 'access',
|
|
4834
|
+
(row) => _optionalChain([row, 'access', _261 => _261.recipient, 'optionalAccess', _262 => _262.toLowerCase, 'call', _263 => _263()]) === _optionalChain([options, 'access', _264 => _264.recipient, 'optionalAccess', _265 => _265.toLowerCase, 'call', _266 => _266()])
|
|
4233
4835
|
) : rows;
|
|
4234
4836
|
const eligible = inScope.map((row) => toRecoverableDeposit(row, options)).filter((deposit) => deposit !== null);
|
|
4235
4837
|
return {
|
|
@@ -4252,20 +4854,20 @@ function RecoveryLookupScreen({
|
|
|
4252
4854
|
onInvalid
|
|
4253
4855
|
}) {
|
|
4254
4856
|
const [txHash, setTxHash] = _react.useState.call(void 0, "");
|
|
4255
|
-
const onInvalidRef = useLatestRef(onInvalid);
|
|
4857
|
+
const onInvalidRef = _chunkG264OM23cjs.useLatestRef.call(void 0, onInvalid);
|
|
4256
4858
|
const trimmed = txHash.trim();
|
|
4257
4859
|
const valid = isRecoveryTxHash(trimmed);
|
|
4258
4860
|
_react.useEffect.call(void 0, () => {
|
|
4259
4861
|
if (trimmed.length > 0 && !valid) {
|
|
4260
|
-
_optionalChain([onInvalidRef, 'access',
|
|
4862
|
+
_optionalChain([onInvalidRef, 'access', _267 => _267.current, 'optionalCall', _268 => _268()]);
|
|
4261
4863
|
}
|
|
4262
4864
|
}, [trimmed, valid, onInvalidRef]);
|
|
4263
4865
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
4264
4866
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
4265
4867
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4266
|
-
BodyHeader,
|
|
4868
|
+
_chunkG264OM23cjs.BodyHeader,
|
|
4267
4869
|
{
|
|
4268
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HandCoinsIcon, {}),
|
|
4870
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.HandCoinsIcon, {}),
|
|
4269
4871
|
title,
|
|
4270
4872
|
subtitle
|
|
4271
4873
|
}
|
|
@@ -4319,43 +4921,12 @@ var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set([
|
|
|
4319
4921
|
"BUSD",
|
|
4320
4922
|
"USDE"
|
|
4321
4923
|
]);
|
|
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
|
-
};
|
|
4924
|
+
function normalizeStableSymbol(symbol) {
|
|
4925
|
+
return symbol.trim().toUpperCase().replace(/₮/g, "T").replace(/\.E$/, "");
|
|
4355
4926
|
}
|
|
4356
4927
|
function maxFractionDigitsFor(symbol) {
|
|
4357
4928
|
if (!symbol) return 6;
|
|
4358
|
-
return STABLECOIN_SYMBOLS.has(symbol
|
|
4929
|
+
return STABLECOIN_SYMBOLS.has(normalizeStableSymbol(symbol)) ? 3 : 6;
|
|
4359
4930
|
}
|
|
4360
4931
|
function formatTokenAmount(amount, symbol) {
|
|
4361
4932
|
if (!Number.isFinite(amount)) return void 0;
|
|
@@ -4369,7 +4940,7 @@ function tokenAmountToNumber(rawAmount, decimals) {
|
|
|
4369
4940
|
try {
|
|
4370
4941
|
const value = Number(_viem.formatUnits.call(void 0, BigInt(rawAmount), decimals));
|
|
4371
4942
|
return Number.isFinite(value) ? value : void 0;
|
|
4372
|
-
} catch (
|
|
4943
|
+
} catch (e17) {
|
|
4373
4944
|
return void 0;
|
|
4374
4945
|
}
|
|
4375
4946
|
}
|
|
@@ -4379,26 +4950,13 @@ function formatRawTokenAmount(rawAmount, token) {
|
|
|
4379
4950
|
return formatTokenAmount(value, token.symbol);
|
|
4380
4951
|
}
|
|
4381
4952
|
function isDisplayStablecoinSymbol(symbol) {
|
|
4382
|
-
return symbol !== void 0 && STABLECOIN_SYMBOLS.has(symbol
|
|
4953
|
+
return symbol !== void 0 && STABLECOIN_SYMBOLS.has(normalizeStableSymbol(symbol));
|
|
4383
4954
|
}
|
|
4384
4955
|
function priceUsdFor(symbol, prices) {
|
|
4385
4956
|
if (!symbol) return void 0;
|
|
4386
4957
|
const quoted = prices[symbol.toUpperCase()];
|
|
4387
4958
|
return typeof quoted === "number" && quoted > 0 ? quoted : void 0;
|
|
4388
4959
|
}
|
|
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
4960
|
function estimateReceiveAmount(params) {
|
|
4403
4961
|
const {
|
|
4404
4962
|
sourceAmount,
|
|
@@ -4427,7 +4985,7 @@ function formatQuotedReceive(output, fallbackSymbol) {
|
|
|
4427
4985
|
let raw;
|
|
4428
4986
|
try {
|
|
4429
4987
|
raw = BigInt(output.amount);
|
|
4430
|
-
} catch (
|
|
4988
|
+
} catch (e18) {
|
|
4431
4989
|
return void 0;
|
|
4432
4990
|
}
|
|
4433
4991
|
if (raw <= 0n) return void 0;
|
|
@@ -4450,27 +5008,21 @@ function formatReceiveEstimate(params) {
|
|
|
4450
5008
|
|
|
4451
5009
|
// src/components/recovery/recovery-display.ts
|
|
4452
5010
|
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
5011
|
return {
|
|
4459
|
-
symbol,
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
chainName: _chunkOY5N3E6Lcjs.getChainName.call(void 0, params.chainId),
|
|
4463
|
-
chainIcon: _chunkOY5N3E6Lcjs.getChainIcon.call(void 0, params.chainId)
|
|
5012
|
+
amount: formatRecoveryAmount(params.amountRaw, params.decimals, params.symbol),
|
|
5013
|
+
chainName: _chunkFKJ6EJHHcjs.getChainName.call(void 0, params.chainId),
|
|
5014
|
+
chainIcon: _chunkFKJ6EJHHcjs.getChainIcon.call(void 0, params.chainId)
|
|
4464
5015
|
};
|
|
4465
5016
|
}
|
|
4466
5017
|
function formatRecoveryAmount(amountRaw, decimals, symbol) {
|
|
5018
|
+
if (decimals === void 0) return "\u2014";
|
|
4467
5019
|
const raw = toBigInt(amountRaw);
|
|
4468
5020
|
return _nullishCoalesce(formatTokenAmount(Number(_viem.formatUnits.call(void 0, raw, decimals)), symbol), () => ( _viem.formatUnits.call(void 0, raw, decimals)));
|
|
4469
5021
|
}
|
|
4470
5022
|
function toBigInt(value) {
|
|
4471
5023
|
try {
|
|
4472
5024
|
return BigInt(value || "0");
|
|
4473
|
-
} catch (
|
|
5025
|
+
} catch (e19) {
|
|
4474
5026
|
return 0n;
|
|
4475
5027
|
}
|
|
4476
5028
|
}
|
|
@@ -4604,7 +5156,7 @@ async function submitSignedRecovery(params) {
|
|
|
4604
5156
|
// The shared const, so recovery carries `x-deposit-modal-version` like
|
|
4605
5157
|
// every other backend call. Without it this path would be invisible in the
|
|
4606
5158
|
// per-client version telemetry the processor records.
|
|
4607
|
-
headers:
|
|
5159
|
+
headers: _chunkD3R3O4CYcjs.serviceHeaders.call(void 0, ),
|
|
4608
5160
|
// `depositId` as a string: it is a uint256 upstream and JSON numbers lose
|
|
4609
5161
|
// precision well before that range.
|
|
4610
5162
|
body: JSON.stringify({ depositId, destination, signature })
|
|
@@ -5023,6 +5575,12 @@ function HistoryFallbackFlow({
|
|
|
5023
5575
|
},
|
|
5024
5576
|
[onBack]
|
|
5025
5577
|
);
|
|
5578
|
+
const matchDisplays = useTokenDisplays(
|
|
5579
|
+
(_nullishCoalesce(matches, () => ( []))).map((match) => ({
|
|
5580
|
+
chain: match.sourceChainId,
|
|
5581
|
+
address: match.token
|
|
5582
|
+
}))
|
|
5583
|
+
);
|
|
5026
5584
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
5027
5585
|
"div",
|
|
5028
5586
|
{
|
|
@@ -5040,7 +5598,7 @@ function HistoryFallbackFlow({
|
|
|
5040
5598
|
"aria-label": "Back to history",
|
|
5041
5599
|
onClick: () => onBack(),
|
|
5042
5600
|
children: [
|
|
5043
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronLeftIcon, {}),
|
|
5601
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronLeftIcon, {}),
|
|
5044
5602
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "History" })
|
|
5045
5603
|
]
|
|
5046
5604
|
}
|
|
@@ -5052,30 +5610,33 @@ function HistoryFallbackFlow({
|
|
|
5052
5610
|
className: "rs-modal-close",
|
|
5053
5611
|
"aria-label": "Close",
|
|
5054
5612
|
onClick: onCloseModal,
|
|
5055
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CloseIcon, {})
|
|
5613
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CloseIcon, {})
|
|
5056
5614
|
}
|
|
5057
5615
|
) })
|
|
5058
5616
|
] }),
|
|
5059
5617
|
matches ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
5060
5618
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5061
5619
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5062
|
-
BodyHeader,
|
|
5620
|
+
_chunkG264OM23cjs.BodyHeader,
|
|
5063
5621
|
{
|
|
5064
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CoinsIcon, {}),
|
|
5622
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CoinsIcon, {}),
|
|
5065
5623
|
title: "Select a deposit",
|
|
5066
5624
|
subtitle: "This transaction produced multiple deposits. Choose the one to recover."
|
|
5067
5625
|
}
|
|
5068
5626
|
),
|
|
5069
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list", children: matches.map((match) => {
|
|
5070
|
-
const
|
|
5627
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list", children: matches.map((match, i) => {
|
|
5628
|
+
const display = matchDisplays[i];
|
|
5629
|
+
const symbol = _nullishCoalesce(_optionalChain([display, 'optionalAccess', _269 => _269.symbol]), () => ( "Token"));
|
|
5630
|
+
const { amount, chainName } = describeRecoveryDeposit({
|
|
5071
5631
|
chainId: match.sourceChainId,
|
|
5072
|
-
|
|
5073
|
-
|
|
5632
|
+
amountRaw: match.amountRaw,
|
|
5633
|
+
symbol,
|
|
5634
|
+
decimals: _optionalChain([display, 'optionalAccess', _270 => _270.decimals])
|
|
5074
5635
|
});
|
|
5075
5636
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5076
5637
|
ListRow,
|
|
5077
5638
|
{
|
|
5078
|
-
leadingMedia:
|
|
5639
|
+
leadingMedia: _optionalChain([display, 'optionalAccess', _271 => _271.logo]),
|
|
5079
5640
|
title: `${amount} ${symbol}`,
|
|
5080
5641
|
subtitle: chainName,
|
|
5081
5642
|
onClick: () => selectMatch(match)
|
|
@@ -5124,9 +5685,9 @@ function RecoveryOutcomeScreen({
|
|
|
5124
5685
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
5125
5686
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5126
5687
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5127
|
-
BodyHeader,
|
|
5688
|
+
_chunkG264OM23cjs.BodyHeader,
|
|
5128
5689
|
{
|
|
5129
|
-
icon: success ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertTriangleIcon, {}),
|
|
5690
|
+
icon: success ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.AlertTriangleIcon, {}),
|
|
5130
5691
|
variant: success ? "success" : "error",
|
|
5131
5692
|
title: success ? "Refund submitted" : "Refund failed",
|
|
5132
5693
|
subtitle: success ? "Your funds are being returned on the source chain." : void 0
|
|
@@ -5141,7 +5702,13 @@ function RecoveryOutcomeScreen({
|
|
|
5141
5702
|
" ",
|
|
5142
5703
|
result.symbol
|
|
5143
5704
|
] }),
|
|
5144
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5705
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5706
|
+
TokenIcon,
|
|
5707
|
+
{
|
|
5708
|
+
token: result.token ? { chain: result.chainId, address: result.token } : void 0,
|
|
5709
|
+
symbol: result.symbol
|
|
5710
|
+
}
|
|
5711
|
+
) })
|
|
5145
5712
|
] })
|
|
5146
5713
|
] }),
|
|
5147
5714
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -5159,7 +5726,7 @@ function RecoveryOutcomeScreen({
|
|
|
5159
5726
|
rel: "noreferrer",
|
|
5160
5727
|
children: [
|
|
5161
5728
|
shortenHash2(result.txHash),
|
|
5162
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {})
|
|
5729
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ExternalLinkIcon, {})
|
|
5163
5730
|
]
|
|
5164
5731
|
}
|
|
5165
5732
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: shortenHash2(result.txHash) })
|
|
@@ -5182,37 +5749,36 @@ function RecoveryReviewScreen({
|
|
|
5182
5749
|
amountRaw,
|
|
5183
5750
|
txHash,
|
|
5184
5751
|
defaultDestination,
|
|
5185
|
-
destinationHint,
|
|
5186
5752
|
depositAddress,
|
|
5187
5753
|
submitting,
|
|
5188
5754
|
onSubmit,
|
|
5189
5755
|
onDestinationInvalid,
|
|
5190
5756
|
onDestinationIsDepositAddress
|
|
5191
5757
|
}) {
|
|
5192
|
-
const { symbol,
|
|
5758
|
+
const { symbol, decimals } = useTokenDisplay(chainId, token);
|
|
5759
|
+
const { amount, chainName, chainIcon } = describeRecoveryDeposit({
|
|
5193
5760
|
chainId,
|
|
5194
|
-
|
|
5195
|
-
|
|
5761
|
+
amountRaw,
|
|
5762
|
+
symbol,
|
|
5763
|
+
decimals
|
|
5196
5764
|
});
|
|
5197
5765
|
const explorerTxUrl = useExplorerTxUrl();
|
|
5198
|
-
const [destination, setDestination] = _react.useState.call(void 0,
|
|
5199
|
-
_nullishCoalesce(defaultDestination, () => ( ""))
|
|
5200
|
-
);
|
|
5766
|
+
const [destination, setDestination] = _react.useState.call(void 0, _nullishCoalesce(defaultDestination, () => ( "")));
|
|
5201
5767
|
const isSelfDestination = isDepositSelfDestination(
|
|
5202
5768
|
{ depositAddress },
|
|
5203
5769
|
destination
|
|
5204
5770
|
);
|
|
5205
5771
|
const destinationValid = _viem.isAddress.call(void 0, destination) && !isSelfDestination;
|
|
5206
|
-
const onDestinationInvalidRef = useLatestRef(onDestinationInvalid);
|
|
5207
|
-
const onDestinationIsDepositAddressRef = useLatestRef(
|
|
5772
|
+
const onDestinationInvalidRef = _chunkG264OM23cjs.useLatestRef.call(void 0, onDestinationInvalid);
|
|
5773
|
+
const onDestinationIsDepositAddressRef = _chunkG264OM23cjs.useLatestRef.call(void 0,
|
|
5208
5774
|
onDestinationIsDepositAddress
|
|
5209
5775
|
);
|
|
5210
5776
|
_react.useEffect.call(void 0, () => {
|
|
5211
5777
|
if (destination.length === 0) return;
|
|
5212
5778
|
if (isSelfDestination) {
|
|
5213
|
-
_optionalChain([onDestinationIsDepositAddressRef, 'access',
|
|
5779
|
+
_optionalChain([onDestinationIsDepositAddressRef, 'access', _272 => _272.current, 'optionalCall', _273 => _273()]);
|
|
5214
5780
|
} else if (!destinationValid) {
|
|
5215
|
-
_optionalChain([onDestinationInvalidRef, 'access',
|
|
5781
|
+
_optionalChain([onDestinationInvalidRef, 'access', _274 => _274.current, 'optionalCall', _275 => _275()]);
|
|
5216
5782
|
}
|
|
5217
5783
|
}, [
|
|
5218
5784
|
destination,
|
|
@@ -5227,9 +5793,9 @@ function RecoveryReviewScreen({
|
|
|
5227
5793
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
5228
5794
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
5229
5795
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5230
|
-
BodyHeader,
|
|
5796
|
+
_chunkG264OM23cjs.BodyHeader,
|
|
5231
5797
|
{
|
|
5232
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HandCoinsIcon, {}),
|
|
5798
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.HandCoinsIcon, {}),
|
|
5233
5799
|
title: "Review refund",
|
|
5234
5800
|
subtitle: "This returns the funds on the source chain. It does not retry the original deposit."
|
|
5235
5801
|
}
|
|
@@ -5243,7 +5809,13 @@ function RecoveryReviewScreen({
|
|
|
5243
5809
|
" ",
|
|
5244
5810
|
symbol
|
|
5245
5811
|
] }),
|
|
5246
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5812
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5813
|
+
TokenIcon,
|
|
5814
|
+
{
|
|
5815
|
+
token: token ? { chain: chainId, address: token } : void 0,
|
|
5816
|
+
symbol
|
|
5817
|
+
}
|
|
5818
|
+
) })
|
|
5247
5819
|
] })
|
|
5248
5820
|
] }),
|
|
5249
5821
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -5264,7 +5836,7 @@ function RecoveryReviewScreen({
|
|
|
5264
5836
|
rel: "noreferrer",
|
|
5265
5837
|
children: [
|
|
5266
5838
|
txShort,
|
|
5267
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {})
|
|
5839
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ExternalLinkIcon, {})
|
|
5268
5840
|
]
|
|
5269
5841
|
}
|
|
5270
5842
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: txShort })
|
|
@@ -5277,7 +5849,7 @@ function RecoveryReviewScreen({
|
|
|
5277
5849
|
placeholder: "0x\u2026",
|
|
5278
5850
|
value: destination,
|
|
5279
5851
|
onChange: (e) => setDestination(e.target.value),
|
|
5280
|
-
hint:
|
|
5852
|
+
hint: `An address you control on ${chainName}.`,
|
|
5281
5853
|
error: isSelfDestination ? selfDestinationError : destination.length > 0 && !destinationValid ? "Enter a valid address" : void 0
|
|
5282
5854
|
}
|
|
5283
5855
|
),
|
|
@@ -5316,6 +5888,7 @@ function HistoryRecoveryFlow({
|
|
|
5316
5888
|
const [outcome, setOutcome] = _react.useState.call(void 0, null);
|
|
5317
5889
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
5318
5890
|
const [retryable, setRetryable] = _react.useState.call(void 0, false);
|
|
5891
|
+
const [destination, setDestination] = _react.useState.call(void 0, );
|
|
5319
5892
|
const lastFailureRef = _react.useRef.call(void 0, null);
|
|
5320
5893
|
_react.useEffect.call(void 0, () => {
|
|
5321
5894
|
if (entrySource === "history_row") {
|
|
@@ -5327,13 +5900,13 @@ function HistoryRecoveryFlow({
|
|
|
5327
5900
|
}
|
|
5328
5901
|
analytics.openStep("review");
|
|
5329
5902
|
}, [analytics, deposit, entrySource]);
|
|
5330
|
-
const { symbol, decimals } =
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
});
|
|
5903
|
+
const { symbol, decimals } = useTokenDisplay(
|
|
5904
|
+
deposit.sourceChainId,
|
|
5905
|
+
deposit.token
|
|
5906
|
+
);
|
|
5335
5907
|
const submit = _react.useCallback.call(void 0,
|
|
5336
|
-
async (
|
|
5908
|
+
async (destination2) => {
|
|
5909
|
+
setDestination(destination2);
|
|
5337
5910
|
setPhase("submitting");
|
|
5338
5911
|
onSubmittingChange(true);
|
|
5339
5912
|
analytics.completeStep("review");
|
|
@@ -5346,14 +5919,14 @@ function HistoryRecoveryFlow({
|
|
|
5346
5919
|
chainId: deposit.targetChainId,
|
|
5347
5920
|
depositId: deposit.depositId,
|
|
5348
5921
|
signer: deposit.signer,
|
|
5349
|
-
destination,
|
|
5922
|
+
destination: destination2,
|
|
5350
5923
|
signRecovery,
|
|
5351
5924
|
debug
|
|
5352
5925
|
});
|
|
5353
5926
|
setOutcome({
|
|
5354
5927
|
// No destination to reconcile: it is inside the signed struct, so the
|
|
5355
5928
|
// processor cannot have paid anywhere else.
|
|
5356
|
-
destination,
|
|
5929
|
+
destination: destination2,
|
|
5357
5930
|
txHash: result.transactionHash,
|
|
5358
5931
|
symbol,
|
|
5359
5932
|
amountDisplay: formatRecoveryAmount(
|
|
@@ -5377,11 +5950,11 @@ function HistoryRecoveryFlow({
|
|
|
5377
5950
|
} catch (err) {
|
|
5378
5951
|
const recoveryError = err instanceof RecoveryError ? err : void 0;
|
|
5379
5952
|
setError(
|
|
5380
|
-
_nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess',
|
|
5953
|
+
_nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _276 => _276.message]), () => ( formatUserError(
|
|
5381
5954
|
err instanceof Error ? err.message : "Recovery failed"
|
|
5382
5955
|
)))
|
|
5383
5956
|
);
|
|
5384
|
-
const canRetry = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess',
|
|
5957
|
+
const canRetry = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _277 => _277.retryable]), () => ( true));
|
|
5385
5958
|
setRetryable(canRetry);
|
|
5386
5959
|
setPhase("failed");
|
|
5387
5960
|
const reason = claimFailureReasonForError(err);
|
|
@@ -5430,7 +6003,7 @@ function HistoryRecoveryFlow({
|
|
|
5430
6003
|
"aria-label": "Back to history",
|
|
5431
6004
|
onClick: onBack,
|
|
5432
6005
|
children: [
|
|
5433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronLeftIcon, {}),
|
|
6006
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronLeftIcon, {}),
|
|
5434
6007
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "History" })
|
|
5435
6008
|
]
|
|
5436
6009
|
}
|
|
@@ -5443,7 +6016,7 @@ function HistoryRecoveryFlow({
|
|
|
5443
6016
|
"aria-label": "Close",
|
|
5444
6017
|
onClick: onCloseModal,
|
|
5445
6018
|
disabled: submitting,
|
|
5446
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CloseIcon, {})
|
|
6019
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CloseIcon, {})
|
|
5447
6020
|
}
|
|
5448
6021
|
) })
|
|
5449
6022
|
] }),
|
|
@@ -5454,8 +6027,7 @@ function HistoryRecoveryFlow({
|
|
|
5454
6027
|
token: deposit.token,
|
|
5455
6028
|
amountRaw: deposit.amountRaw,
|
|
5456
6029
|
txHash: deposit.sourceTxHash,
|
|
5457
|
-
defaultDestination:
|
|
5458
|
-
destinationHint: "Prefilled with the account this deposit was for. Editable.",
|
|
6030
|
+
defaultDestination: destination,
|
|
5459
6031
|
depositAddress: deposit.depositAddress,
|
|
5460
6032
|
submitting,
|
|
5461
6033
|
onSubmit: submit,
|
|
@@ -5469,7 +6041,11 @@ function HistoryRecoveryFlow({
|
|
|
5469
6041
|
phase === "success" && outcome && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5470
6042
|
RecoveryOutcomeScreen,
|
|
5471
6043
|
{
|
|
5472
|
-
result: {
|
|
6044
|
+
result: {
|
|
6045
|
+
...outcome,
|
|
6046
|
+
chainId: deposit.sourceChainId,
|
|
6047
|
+
token: deposit.token
|
|
6048
|
+
},
|
|
5473
6049
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "outline", onClick: onBack, fullWidth: true, children: "Back to history" })
|
|
5474
6050
|
}
|
|
5475
6051
|
),
|
|
@@ -5487,6 +6063,8 @@ HistoryRecoveryFlow.displayName = "HistoryRecoveryFlow";
|
|
|
5487
6063
|
|
|
5488
6064
|
function HistoryOverlay({
|
|
5489
6065
|
controller,
|
|
6066
|
+
bankHistory,
|
|
6067
|
+
bankSupportUrl,
|
|
5490
6068
|
backLabel,
|
|
5491
6069
|
title,
|
|
5492
6070
|
recipient,
|
|
@@ -5527,8 +6105,8 @@ function HistoryOverlay({
|
|
|
5527
6105
|
const endAttempt = _react.useCallback.call(void 0,
|
|
5528
6106
|
(source, reason) => {
|
|
5529
6107
|
const claim = claimControllerRef.current;
|
|
5530
|
-
_optionalChain([claim, 'optionalAccess',
|
|
5531
|
-
_optionalChain([claim, 'optionalAccess',
|
|
6108
|
+
_optionalChain([claim, 'optionalAccess', _278 => _278.abandon, 'call', _279 => _279(reason)]);
|
|
6109
|
+
_optionalChain([claim, 'optionalAccess', _280 => _280.close, 'call', _281 => _281(source)]);
|
|
5532
6110
|
claimControllerRef.current = null;
|
|
5533
6111
|
setAttempt(null);
|
|
5534
6112
|
},
|
|
@@ -5586,15 +6164,15 @@ function HistoryOverlay({
|
|
|
5586
6164
|
if (!attempt) return;
|
|
5587
6165
|
return () => {
|
|
5588
6166
|
const claim = claimControllerRef.current;
|
|
5589
|
-
_optionalChain([claim, 'optionalAccess',
|
|
5590
|
-
_optionalChain([claim, 'optionalAccess',
|
|
6167
|
+
_optionalChain([claim, 'optionalAccess', _282 => _282.abandon, 'call', _283 => _283("modal_close")]);
|
|
6168
|
+
_optionalChain([claim, 'optionalAccess', _284 => _284.close, 'call', _285 => _285("host_controlled")]);
|
|
5591
6169
|
};
|
|
5592
6170
|
}, [attempt]);
|
|
5593
6171
|
const claimSessionProperties = _react.useMemo.call(void 0,
|
|
5594
6172
|
() => ({
|
|
5595
6173
|
presentation: inline ? "inline" : "overlay",
|
|
5596
6174
|
overlay_close_enabled: !inline && Boolean(closeOnOverlayClick),
|
|
5597
|
-
prefills: { transaction_hash: false, refund_destination:
|
|
6175
|
+
prefills: { transaction_hash: false, refund_destination: false }
|
|
5598
6176
|
}),
|
|
5599
6177
|
[inline, closeOnOverlayClick]
|
|
5600
6178
|
);
|
|
@@ -5613,7 +6191,7 @@ function HistoryOverlay({
|
|
|
5613
6191
|
HistoryRecoveryFlow,
|
|
5614
6192
|
{
|
|
5615
6193
|
deposit: recovering,
|
|
5616
|
-
entrySource: _nullishCoalesce(_optionalChain([attempt, 'optionalAccess',
|
|
6194
|
+
entrySource: _nullishCoalesce(_optionalChain([attempt, 'optionalAccess', _286 => _286.entrySource]), () => ( "history_row")),
|
|
5617
6195
|
backendUrl,
|
|
5618
6196
|
signRecovery,
|
|
5619
6197
|
debug,
|
|
@@ -5628,6 +6206,8 @@ function HistoryOverlay({
|
|
|
5628
6206
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5629
6207
|
DepositHistoryPanel,
|
|
5630
6208
|
{
|
|
6209
|
+
bankHistory,
|
|
6210
|
+
bankSupportUrl,
|
|
5631
6211
|
deposits: controller.deposits,
|
|
5632
6212
|
isLoading: controller.isLoading,
|
|
5633
6213
|
error: controller.error,
|
|
@@ -5767,7 +6347,7 @@ function useHistoryPanel({
|
|
|
5767
6347
|
}, [isOpen, badgeState2.nextExpiryAt]);
|
|
5768
6348
|
const openPanel = _react.useCallback.call(void 0, () => {
|
|
5769
6349
|
setIsPanelOpen(true);
|
|
5770
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
6350
|
+
_optionalChain([analytics, 'optionalAccess', _287 => _287.visitOpened, 'call', _288 => _288(badge)]);
|
|
5771
6351
|
if (!loadedRef.current || staleRef.current) {
|
|
5772
6352
|
fetchHistory("initial");
|
|
5773
6353
|
}
|
|
@@ -5775,10 +6355,10 @@ function useHistoryPanel({
|
|
|
5775
6355
|
const closePanel = _react.useCallback.call(void 0, () => {
|
|
5776
6356
|
if (recovering) return;
|
|
5777
6357
|
setIsPanelOpen(false);
|
|
5778
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
6358
|
+
_optionalChain([analytics, 'optionalAccess', _289 => _289.visitEnded, 'call', _290 => _290()]);
|
|
5779
6359
|
}, [analytics, recovering]);
|
|
5780
6360
|
const loadMore = _react.useCallback.call(void 0, () => {
|
|
5781
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
6361
|
+
_optionalChain([analytics, 'optionalAccess', _291 => _291.loadMore, 'call', _292 => _292(filterVisibleDeposits(deposits).length)]);
|
|
5782
6362
|
fetchHistory("more");
|
|
5783
6363
|
}, [analytics, deposits, fetchHistory]);
|
|
5784
6364
|
const markStale = _react.useCallback.call(void 0, () => {
|
|
@@ -5806,7 +6386,7 @@ function useHistoryPanel({
|
|
|
5806
6386
|
_react.useEffect.call(void 0, () => {
|
|
5807
6387
|
if (isOpen) return;
|
|
5808
6388
|
setIsPanelOpen(false);
|
|
5809
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
6389
|
+
_optionalChain([analytics, 'optionalAccess', _293 => _293.visitEnded, 'call', _294 => _294()]);
|
|
5810
6390
|
setDeposits([]);
|
|
5811
6391
|
setHasMore(false);
|
|
5812
6392
|
setError(null);
|
|
@@ -5965,11 +6545,11 @@ var NOTHING_TO_STOP = () => {
|
|
|
5965
6545
|
};
|
|
5966
6546
|
function resolveThemeMode(mode) {
|
|
5967
6547
|
if (mode !== "system") return mode;
|
|
5968
|
-
return _optionalChain([globalThis, 'access',
|
|
6548
|
+
return _optionalChain([globalThis, 'access', _295 => _295.matchMedia, 'optionalCall', _296 => _296(DARK_SCHEME_QUERY), 'access', _297 => _297.matches]) ? "dark" : "light";
|
|
5969
6549
|
}
|
|
5970
6550
|
function followSystemAppearance(mode, onChange) {
|
|
5971
6551
|
if (mode !== "system") return NOTHING_TO_STOP;
|
|
5972
|
-
const query = _optionalChain([globalThis, 'access',
|
|
6552
|
+
const query = _optionalChain([globalThis, 'access', _298 => _298.matchMedia, 'optionalCall', _299 => _299(DARK_SCHEME_QUERY)]);
|
|
5973
6553
|
if (!query) return NOTHING_TO_STOP;
|
|
5974
6554
|
query.addEventListener("change", onChange);
|
|
5975
6555
|
return () => query.removeEventListener("change", onChange);
|
|
@@ -5977,22 +6557,22 @@ function followSystemAppearance(mode, onChange) {
|
|
|
5977
6557
|
function applyTheme(element, theme) {
|
|
5978
6558
|
if (!element) return NOTHING_TO_STOP;
|
|
5979
6559
|
const parent = element.parentElement;
|
|
5980
|
-
const targets = _optionalChain([parent, 'optionalAccess',
|
|
6560
|
+
const targets = _optionalChain([parent, 'optionalAccess', _300 => _300.classList, 'access', _301 => _301.contains, 'call', _302 => _302("rs-modal-content")]) ? [element, parent] : [element];
|
|
5981
6561
|
const paintMode = () => {
|
|
5982
|
-
const resolved = resolveThemeMode(_optionalChain([theme, 'optionalAccess',
|
|
6562
|
+
const resolved = resolveThemeMode(_optionalChain([theme, 'optionalAccess', _303 => _303.mode]));
|
|
5983
6563
|
for (const t of targets) {
|
|
5984
6564
|
if (resolved) t.setAttribute("data-theme", resolved);
|
|
5985
6565
|
else t.removeAttribute("data-theme");
|
|
5986
6566
|
}
|
|
5987
6567
|
};
|
|
5988
6568
|
paintMode();
|
|
5989
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6569
|
+
if (_optionalChain([theme, 'optionalAccess', _304 => _304.fontColor])) {
|
|
5990
6570
|
setVar(targets, "--rs-foreground", theme.fontColor);
|
|
5991
6571
|
}
|
|
5992
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6572
|
+
if (_optionalChain([theme, 'optionalAccess', _305 => _305.iconColor])) {
|
|
5993
6573
|
setVar(targets, "--rs-icon", theme.iconColor);
|
|
5994
6574
|
}
|
|
5995
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6575
|
+
if (_optionalChain([theme, 'optionalAccess', _306 => _306.ctaColor])) {
|
|
5996
6576
|
const derived = deriveCustomPrimary(theme.ctaColor);
|
|
5997
6577
|
if (derived) {
|
|
5998
6578
|
setVar(targets, "--rs-primary", derived.base);
|
|
@@ -6017,25 +6597,25 @@ function applyTheme(element, theme) {
|
|
|
6017
6597
|
}
|
|
6018
6598
|
} else {
|
|
6019
6599
|
for (const v of CUSTOM_PRIMARY_VARS) clearVar(targets, v);
|
|
6020
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6600
|
+
if (_optionalChain([theme, 'optionalAccess', _307 => _307.ctaHoverColor])) {
|
|
6021
6601
|
setVar(targets, "--rs-primary-hover", theme.ctaHoverColor);
|
|
6022
6602
|
}
|
|
6023
6603
|
}
|
|
6024
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6604
|
+
if (_optionalChain([theme, 'optionalAccess', _308 => _308.borderColor])) {
|
|
6025
6605
|
setVar(targets, "--rs-border", theme.borderColor);
|
|
6026
6606
|
setVar(targets, "--rs-border-surface", theme.borderColor);
|
|
6027
6607
|
}
|
|
6028
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6608
|
+
if (_optionalChain([theme, 'optionalAccess', _309 => _309.backgroundColor])) {
|
|
6029
6609
|
setVar(targets, "--rs-background", theme.backgroundColor);
|
|
6030
6610
|
}
|
|
6031
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
6611
|
+
if (_optionalChain([theme, 'optionalAccess', _310 => _310.radius])) {
|
|
6032
6612
|
const scale = RADIUS_SCALE[theme.radius];
|
|
6033
6613
|
setVar(targets, "--rs-radius-sm", scale.sm);
|
|
6034
6614
|
setVar(targets, "--rs-radius-md", scale.md);
|
|
6035
6615
|
setVar(targets, "--rs-radius-lg", scale.lg);
|
|
6036
6616
|
setVar(targets, "--rs-radius", scale.md);
|
|
6037
6617
|
}
|
|
6038
|
-
return followSystemAppearance(_optionalChain([theme, 'optionalAccess',
|
|
6618
|
+
return followSystemAppearance(_optionalChain([theme, 'optionalAccess', _311 => _311.mode]), paintMode);
|
|
6039
6619
|
}
|
|
6040
6620
|
|
|
6041
6621
|
// src/core/removed-props.ts
|
|
@@ -6068,6 +6648,9 @@ var REMOVED_UI_CONFIG_KEYS = {
|
|
|
6068
6648
|
checkLiquidity: "removed \u2014 the modal no longer surfaces a liquidity cap. Route capacity is enforced when the deposit is processed.",
|
|
6069
6649
|
showHistoryButton: "removed \u2014 deposit history is always offered, from the modal's home screen. There is no way to hide it."
|
|
6070
6650
|
};
|
|
6651
|
+
var REMOVED_BANK_ONRAMP_KEYS = {
|
|
6652
|
+
currency: "removed \u2014 the currency follows the residence the customer declares at verification: EUR inside SEPA, USD elsewhere."
|
|
6653
|
+
};
|
|
6071
6654
|
var warned = /* @__PURE__ */ new Set();
|
|
6072
6655
|
function warnOnce(component, key, replacement) {
|
|
6073
6656
|
const id = `${component}.${key}`;
|
|
@@ -6085,6 +6668,18 @@ function warnRemovedProps(component, props) {
|
|
|
6085
6668
|
warnOnce(component, key, table[key]);
|
|
6086
6669
|
}
|
|
6087
6670
|
}
|
|
6671
|
+
const bankOnramp = props.bankOnramp;
|
|
6672
|
+
if (bankOnramp && typeof bankOnramp === "object") {
|
|
6673
|
+
for (const key of Object.keys(REMOVED_BANK_ONRAMP_KEYS)) {
|
|
6674
|
+
if (Object.prototype.hasOwnProperty.call(bankOnramp, key)) {
|
|
6675
|
+
warnOnce(
|
|
6676
|
+
component,
|
|
6677
|
+
`bankOnramp.${key}`,
|
|
6678
|
+
REMOVED_BANK_ONRAMP_KEYS[key]
|
|
6679
|
+
);
|
|
6680
|
+
}
|
|
6681
|
+
}
|
|
6682
|
+
}
|
|
6088
6683
|
const uiConfig = props.uiConfig;
|
|
6089
6684
|
if (uiConfig && typeof uiConfig === "object") {
|
|
6090
6685
|
for (const key of Object.keys(REMOVED_UI_CONFIG_KEYS)) {
|
|
@@ -6124,20 +6719,20 @@ function sinkFor(source) {
|
|
|
6124
6719
|
if (source.modal === "deposit") {
|
|
6125
6720
|
const at2 = () => source.controllerRef.current;
|
|
6126
6721
|
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',
|
|
6722
|
+
opened: (detail) => _optionalChain([at2, 'call', _312 => _312(), 'optionalAccess', _313 => _313.historyOpened, 'call', _314 => _314({ ...detail, step: _nullishCoalesce(_optionalChain([at2, 'call', _315 => _315(), 'optionalAccess', _316 => _316.step]), () => ( null)) })]),
|
|
6723
|
+
rowViewed: (detail) => _optionalChain([at2, 'call', _317 => _317(), 'optionalAccess', _318 => _318.historyRowViewed, 'call', _319 => _319(detail)]),
|
|
6724
|
+
loadMore: (detail) => _optionalChain([at2, 'call', _320 => _320(), 'optionalAccess', _321 => _321.historyLoadMore, 'call', _322 => _322(detail)]),
|
|
6725
|
+
fallbackOpened: (detail) => _optionalChain([at2, 'call', _323 => _323(), 'optionalAccess', _324 => _324.historyFallbackOpened, 'call', _325 => _325(detail)]),
|
|
6726
|
+
recoveryStarted: (detail) => _optionalChain([at2, 'call', _326 => _326(), 'optionalAccess', _327 => _327.historyRecoveryStarted, 'call', _328 => _328(detail)])
|
|
6132
6727
|
};
|
|
6133
6728
|
}
|
|
6134
6729
|
const at = () => source.controllerRef.current;
|
|
6135
6730
|
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',
|
|
6731
|
+
opened: (detail) => _optionalChain([at, 'call', _329 => _329(), 'optionalAccess', _330 => _330.historyOpened, 'call', _331 => _331({ ...detail, step: _nullishCoalesce(_optionalChain([at, 'call', _332 => _332(), 'optionalAccess', _333 => _333.step]), () => ( null)) })]),
|
|
6732
|
+
rowViewed: (detail) => _optionalChain([at, 'call', _334 => _334(), 'optionalAccess', _335 => _335.historyRowViewed, 'call', _336 => _336(detail)]),
|
|
6733
|
+
loadMore: (detail) => _optionalChain([at, 'call', _337 => _337(), 'optionalAccess', _338 => _338.historyLoadMore, 'call', _339 => _339(detail)]),
|
|
6734
|
+
fallbackOpened: (detail) => _optionalChain([at, 'call', _340 => _340(), 'optionalAccess', _341 => _341.historyFallbackOpened, 'call', _342 => _342(detail)]),
|
|
6735
|
+
recoveryStarted: (detail) => _optionalChain([at, 'call', _343 => _343(), 'optionalAccess', _344 => _344.historyRecoveryStarted, 'call', _345 => _345(detail)])
|
|
6141
6736
|
};
|
|
6142
6737
|
}
|
|
6143
6738
|
function badgeState(badge) {
|
|
@@ -6163,7 +6758,7 @@ function createHistoryAnalytics(source) {
|
|
|
6163
6758
|
sink.opened({
|
|
6164
6759
|
history_visit_id: visitId,
|
|
6165
6760
|
badge: badgeState(badge),
|
|
6166
|
-
badge_count: _nullishCoalesce(_optionalChain([badge, 'optionalAccess',
|
|
6761
|
+
badge_count: _nullishCoalesce(_optionalChain([badge, 'optionalAccess', _346 => _346.count]), () => ( 0))
|
|
6167
6762
|
});
|
|
6168
6763
|
},
|
|
6169
6764
|
visitEnded() {
|
|
@@ -6224,10 +6819,10 @@ function resolveChain(targetChain) {
|
|
|
6224
6819
|
if (typeof targetChain === "number" && !(targetChain > 0 && Number.isInteger(targetChain))) {
|
|
6225
6820
|
return void 0;
|
|
6226
6821
|
}
|
|
6227
|
-
return
|
|
6822
|
+
return _chunkFKJ6EJHHcjs.targetChainToCaip2.call(void 0, targetChain);
|
|
6228
6823
|
}
|
|
6229
6824
|
function resolveToken(targetToken) {
|
|
6230
|
-
const raw = _optionalChain([targetToken, 'optionalAccess',
|
|
6825
|
+
const raw = _optionalChain([targetToken, 'optionalAccess', _347 => _347.trim, 'call', _348 => _348()]);
|
|
6231
6826
|
if (!raw) return void 0;
|
|
6232
6827
|
if (HEX_TOKEN.test(raw)) return raw.toLowerCase();
|
|
6233
6828
|
if (BASE58_TOKEN.test(raw)) return raw;
|
|
@@ -6285,8 +6880,8 @@ function Tooltip({ content, children, className }) {
|
|
|
6285
6880
|
function handleOutside(event) {
|
|
6286
6881
|
const target = event.target;
|
|
6287
6882
|
if (!target) return;
|
|
6288
|
-
if (_optionalChain([triggerRef, 'access',
|
|
6289
|
-
if (_optionalChain([bubbleRef, 'access',
|
|
6883
|
+
if (_optionalChain([triggerRef, 'access', _349 => _349.current, 'optionalAccess', _350 => _350.contains, 'call', _351 => _351(target)])) return;
|
|
6884
|
+
if (_optionalChain([bubbleRef, 'access', _352 => _352.current, 'optionalAccess', _353 => _353.contains, 'call', _354 => _354(target)])) return;
|
|
6290
6885
|
setOpen(false);
|
|
6291
6886
|
}
|
|
6292
6887
|
function handleKey(event) {
|
|
@@ -6363,7 +6958,7 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
6363
6958
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-fees-accordion-summary", children: [
|
|
6364
6959
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-fees-accordion-label", children: [
|
|
6365
6960
|
/* @__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, {}) }) })
|
|
6961
|
+
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
6962
|
] }),
|
|
6368
6963
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6369
6964
|
"button",
|
|
@@ -6381,7 +6976,7 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
6381
6976
|
{
|
|
6382
6977
|
className: `rs-fees-accordion-chevron${open ? " rs-fees-accordion-chevron--open" : ""}`,
|
|
6383
6978
|
"aria-hidden": "true",
|
|
6384
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronDownIcon, {})
|
|
6979
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ChevronDownIcon, {})
|
|
6385
6980
|
}
|
|
6386
6981
|
)
|
|
6387
6982
|
]
|
|
@@ -6403,7 +6998,7 @@ function FeesAccordion({ total, rows, tooltip }) {
|
|
|
6403
6998
|
{
|
|
6404
6999
|
className: "rs-review-detail-info",
|
|
6405
7000
|
"aria-label": `${row.label} info`,
|
|
6406
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfoIcon, {})
|
|
7001
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.InfoIcon, {})
|
|
6407
7002
|
}
|
|
6408
7003
|
) })
|
|
6409
7004
|
] })
|
|
@@ -6420,6 +7015,7 @@ function SwappedReceipt({
|
|
|
6420
7015
|
amountPaid,
|
|
6421
7016
|
depositedAmount,
|
|
6422
7017
|
depositedSymbol,
|
|
7018
|
+
depositedToken,
|
|
6423
7019
|
feesTotal,
|
|
6424
7020
|
feeRows,
|
|
6425
7021
|
feesTooltip,
|
|
@@ -6429,7 +7025,7 @@ function SwappedReceipt({
|
|
|
6429
7025
|
}) {
|
|
6430
7026
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
6431
7027
|
/* @__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" }),
|
|
7028
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.CheckIcon, {}), title: "Deposit successful" }),
|
|
6433
7029
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
6434
7030
|
onrampMethod && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
6435
7031
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Onramp method" }),
|
|
@@ -6446,7 +7042,7 @@ function SwappedReceipt({
|
|
|
6446
7042
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Deposited amount" }),
|
|
6447
7043
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
6448
7044
|
/* @__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 }) })
|
|
7045
|
+
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
7046
|
] })
|
|
6451
7047
|
] }),
|
|
6452
7048
|
feesTotal != null && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -6482,7 +7078,7 @@ var EXCHANGE_SLUGS = [
|
|
|
6482
7078
|
"kucoin"
|
|
6483
7079
|
];
|
|
6484
7080
|
var EXCHANGE_LOGO_SOURCES = Object.fromEntries(
|
|
6485
|
-
EXCHANGE_SLUGS.map((slug) => [slug,
|
|
7081
|
+
EXCHANGE_SLUGS.map((slug) => [slug, _chunkFKJ6EJHHcjs.cdnIconUrl.call(void 0, "exchanges", slug)])
|
|
6486
7082
|
);
|
|
6487
7083
|
var EXCHANGE_LOGO_ALIASES = {
|
|
6488
7084
|
gate: "gateio"
|
|
@@ -6515,7 +7111,7 @@ function asNumber(value) {
|
|
|
6515
7111
|
const trimmed = value.trim();
|
|
6516
7112
|
if (!trimmed) return void 0;
|
|
6517
7113
|
const caipMatch = trimmed.match(/^eip155:(\d+)$/);
|
|
6518
|
-
if (_optionalChain([caipMatch, 'optionalAccess',
|
|
7114
|
+
if (_optionalChain([caipMatch, 'optionalAccess', _355 => _355[1]])) {
|
|
6519
7115
|
const parsed2 = Number(caipMatch[1]);
|
|
6520
7116
|
return Number.isFinite(parsed2) ? parsed2 : void 0;
|
|
6521
7117
|
}
|
|
@@ -6534,24 +7130,24 @@ function asAddress(value) {
|
|
|
6534
7130
|
return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
|
|
6535
7131
|
}
|
|
6536
7132
|
function getEventTxHash(event) {
|
|
6537
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
7133
|
+
if (!_optionalChain([event, 'optionalAccess', _356 => _356.type])) return void 0;
|
|
6538
7134
|
if (event.type === "deposit-received") {
|
|
6539
|
-
return asString(_optionalChain([event, 'access',
|
|
7135
|
+
return asString(_optionalChain([event, 'access', _357 => _357.data, 'optionalAccess', _358 => _358.transactionHash]));
|
|
6540
7136
|
}
|
|
6541
7137
|
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',
|
|
7138
|
+
const deposit = isRecord(_optionalChain([event, 'access', _359 => _359.data, 'optionalAccess', _360 => _360.deposit])) ? event.data.deposit : void 0;
|
|
7139
|
+
const source = isRecord(_optionalChain([event, 'access', _361 => _361.data, 'optionalAccess', _362 => _362.source])) ? event.data.source : void 0;
|
|
7140
|
+
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _363 => _363.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _364 => _364.transactionHash]))));
|
|
6545
7141
|
}
|
|
6546
7142
|
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',
|
|
7143
|
+
const deposit = isRecord(_optionalChain([event, 'access', _365 => _365.data, 'optionalAccess', _366 => _366.deposit])) ? event.data.deposit : void 0;
|
|
7144
|
+
const source = isRecord(_optionalChain([event, 'access', _367 => _367.data, 'optionalAccess', _368 => _368.source])) ? event.data.source : void 0;
|
|
7145
|
+
return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _369 => _369.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _370 => _370.transactionHash]))));
|
|
6550
7146
|
}
|
|
6551
7147
|
return void 0;
|
|
6552
7148
|
}
|
|
6553
7149
|
function getEventSourceDetails(event) {
|
|
6554
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
7150
|
+
if (!_optionalChain([event, 'optionalAccess', _371 => _371.type]) || !isRecord(event.data)) return {};
|
|
6555
7151
|
if (event.type === "deposit-received") {
|
|
6556
7152
|
return {
|
|
6557
7153
|
chainId: asNumber(event.data.chain),
|
|
@@ -6563,9 +7159,9 @@ function getEventSourceDetails(event) {
|
|
|
6563
7159
|
const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
|
|
6564
7160
|
if (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error") {
|
|
6565
7161
|
return {
|
|
6566
|
-
chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess',
|
|
6567
|
-
amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess',
|
|
6568
|
-
token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess',
|
|
7162
|
+
chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess', _372 => _372.chain])), () => ( asNumber(_optionalChain([deposit, 'optionalAccess', _373 => _373.chain])))),
|
|
7163
|
+
amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess', _374 => _374.amount])), () => ( asAmount(_optionalChain([deposit, 'optionalAccess', _375 => _375.amount])))),
|
|
7164
|
+
token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess', _376 => _376.asset])), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _377 => _377.asset])))), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _378 => _378.token]))))
|
|
6569
7165
|
};
|
|
6570
7166
|
}
|
|
6571
7167
|
return {};
|
|
@@ -6579,7 +7175,7 @@ function asChain(value) {
|
|
|
6579
7175
|
return asNumber(value);
|
|
6580
7176
|
}
|
|
6581
7177
|
function getEventDestinationDetails(event) {
|
|
6582
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
7178
|
+
if (!_optionalChain([event, 'optionalAccess', _379 => _379.type]) || !isRecord(event.data)) return {};
|
|
6583
7179
|
if (event.type !== "bridge-started" && event.type !== "bridge-complete") {
|
|
6584
7180
|
return {};
|
|
6585
7181
|
}
|
|
@@ -6589,14 +7185,14 @@ function getEventDestinationDetails(event) {
|
|
|
6589
7185
|
return {
|
|
6590
7186
|
chainId: asChain(destination.chain),
|
|
6591
7187
|
amount: asAmount(destination.amount),
|
|
6592
|
-
token: _optionalChain([token, 'optionalAccess',
|
|
7188
|
+
token: _optionalChain([token, 'optionalAccess', _380 => _380.trim, 'call', _381 => _381()]) || void 0
|
|
6593
7189
|
};
|
|
6594
7190
|
}
|
|
6595
7191
|
function isDepositEvent(event) {
|
|
6596
|
-
return _optionalChain([event, 'optionalAccess',
|
|
7192
|
+
return _optionalChain([event, 'optionalAccess', _382 => _382.type]) === "deposit-received" || _optionalChain([event, 'optionalAccess', _383 => _383.type]) === "bridge-started" || _optionalChain([event, 'optionalAccess', _384 => _384.type]) === "bridge-complete" || _optionalChain([event, 'optionalAccess', _385 => _385.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _386 => _386.type]) === "error";
|
|
6597
7193
|
}
|
|
6598
7194
|
function isFailedEvent(event) {
|
|
6599
|
-
return _optionalChain([event, 'optionalAccess',
|
|
7195
|
+
return _optionalChain([event, 'optionalAccess', _387 => _387.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _388 => _388.type]) === "error";
|
|
6600
7196
|
}
|
|
6601
7197
|
function isHexString(value) {
|
|
6602
7198
|
return value.startsWith("0x") || value.startsWith("0X");
|
|
@@ -6608,7 +7204,7 @@ function txRefsMatch(a, b) {
|
|
|
6608
7204
|
return a === b;
|
|
6609
7205
|
}
|
|
6610
7206
|
function formatBridgeFailedMessage(event) {
|
|
6611
|
-
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
7207
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _389 => _389.data]), () => ( {}));
|
|
6612
7208
|
const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
|
|
6613
7209
|
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
6614
7210
|
function toUserFacingFailure(raw) {
|
|
@@ -6636,7 +7232,7 @@ function formatBridgeFailedMessage(event) {
|
|
|
6636
7232
|
return { message: "Bridge failed" };
|
|
6637
7233
|
}
|
|
6638
7234
|
function failureMessageForEvent(event) {
|
|
6639
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7235
|
+
if (_optionalChain([event, 'optionalAccess', _390 => _390.type]) === "error") {
|
|
6640
7236
|
const message = isRecord(event.data) ? asString(event.data.message) : void 0;
|
|
6641
7237
|
return _nullishCoalesce(message, () => ( "Unknown error"));
|
|
6642
7238
|
}
|
|
@@ -6645,66 +7241,28 @@ function failureMessageForEvent(event) {
|
|
|
6645
7241
|
|
|
6646
7242
|
// src/core/useTokenPrices.ts
|
|
6647
7243
|
|
|
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;
|
|
7244
|
+
var ZERO_ADDRESS2 = "0x0000000000000000000000000000000000000000";
|
|
7245
|
+
function addressFor(token) {
|
|
7246
|
+
if (token.address) return token.address;
|
|
7247
|
+
return token.chainId === "solana" ? "native" : ZERO_ADDRESS2;
|
|
7248
|
+
}
|
|
7249
|
+
function useTokenPrices(tokens) {
|
|
7250
|
+
const defined = tokens.filter((t) => Boolean(_optionalChain([t, 'optionalAccess', _391 => _391.symbol])));
|
|
7251
|
+
const refs = defined.map((token) => ({
|
|
7252
|
+
chain: token.chainId,
|
|
7253
|
+
address: addressFor(token)
|
|
7254
|
+
}));
|
|
7255
|
+
const byId = useAssetPrices(refs);
|
|
7256
|
+
const key = defined.map((t) => `${String(t.chainId)}:${addressFor(t)}:${t.symbol}`).join("|");
|
|
7257
|
+
return _react.useMemo.call(void 0, () => {
|
|
7258
|
+
const out = {};
|
|
7259
|
+
for (const token of defined) {
|
|
7260
|
+
const id = assetIdFor(token.chainId, addressFor(token));
|
|
7261
|
+
const usd = id ? byId[id] : void 0;
|
|
7262
|
+
if (typeof usd === "number") out[token.symbol.toUpperCase()] = usd;
|
|
7263
|
+
}
|
|
7264
|
+
return out;
|
|
7265
|
+
}, [key, byId]);
|
|
6708
7266
|
}
|
|
6709
7267
|
|
|
6710
7268
|
// src/components/steps/ProcessingStep.tsx
|
|
@@ -6838,7 +7396,7 @@ function loadPhaseTimings(txHash) {
|
|
|
6838
7396
|
const parsed = JSON.parse(raw);
|
|
6839
7397
|
if (typeof parsed.startedAt !== "number") return null;
|
|
6840
7398
|
return parsed;
|
|
6841
|
-
} catch (
|
|
7399
|
+
} catch (e20) {
|
|
6842
7400
|
return null;
|
|
6843
7401
|
}
|
|
6844
7402
|
}
|
|
@@ -6849,7 +7407,7 @@ function savePhaseTimings(txHash, timings) {
|
|
|
6849
7407
|
`${PHASE_TIMINGS_PREFIX}:${txHash}`,
|
|
6850
7408
|
JSON.stringify(timings)
|
|
6851
7409
|
);
|
|
6852
|
-
} catch (
|
|
7410
|
+
} catch (e21) {
|
|
6853
7411
|
}
|
|
6854
7412
|
}
|
|
6855
7413
|
function isEventForTx(event, txHash) {
|
|
@@ -6858,12 +7416,12 @@ function isEventForTx(event, txHash) {
|
|
|
6858
7416
|
return txRefsMatch(eventTxHash, txHash);
|
|
6859
7417
|
}
|
|
6860
7418
|
function parseWebhookTimestamp(event) {
|
|
6861
|
-
if (typeof _optionalChain([event, 'optionalAccess',
|
|
7419
|
+
if (typeof _optionalChain([event, 'optionalAccess', _392 => _392.time]) !== "string") return void 0;
|
|
6862
7420
|
const timestamp = Date.parse(event.time);
|
|
6863
7421
|
return Number.isFinite(timestamp) ? timestamp : void 0;
|
|
6864
7422
|
}
|
|
6865
7423
|
function syncPhaseTimings(previous, event) {
|
|
6866
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
7424
|
+
if (!_optionalChain([event, 'optionalAccess', _393 => _393.type])) return previous;
|
|
6867
7425
|
const timestamp = _nullishCoalesce(parseWebhookTimestamp(event), () => ( Date.now()));
|
|
6868
7426
|
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
7427
|
const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete") && previous.bridgingAt === void 0;
|
|
@@ -6925,52 +7483,52 @@ function getCurrentPhaseId(state, phaseTimings) {
|
|
|
6925
7483
|
if (state.type === "complete") {
|
|
6926
7484
|
return void 0;
|
|
6927
7485
|
}
|
|
6928
|
-
if (_optionalChain([state, 'access',
|
|
7486
|
+
if (_optionalChain([state, 'access', _394 => _394.lastEvent, 'optionalAccess', _395 => _395.type]) === "bridge-started" || _optionalChain([state, 'access', _396 => _396.lastEvent, 'optionalAccess', _397 => _397.type]) === "bridge-complete")
|
|
6929
7487
|
return "bridging";
|
|
6930
|
-
if (_optionalChain([state, 'access',
|
|
7488
|
+
if (_optionalChain([state, 'access', _398 => _398.lastEvent, 'optionalAccess', _399 => _399.type]) === "deposit-received") return "received";
|
|
6931
7489
|
return "confirming";
|
|
6932
7490
|
}
|
|
6933
7491
|
function getCompletionDestinationAmount(event) {
|
|
6934
|
-
const amount = _optionalChain([event, 'optionalAccess',
|
|
7492
|
+
const amount = _optionalChain([event, 'optionalAccess', _400 => _400.data, 'optionalAccess', _401 => _401.destination, 'optionalAccess', _402 => _402.amount]);
|
|
6935
7493
|
return typeof amount === "string" ? amount : void 0;
|
|
6936
7494
|
}
|
|
6937
7495
|
function getCompletionDestinationTxHash(event) {
|
|
6938
|
-
const eventData = _optionalChain([event, 'optionalAccess',
|
|
6939
|
-
const swapTxHash = _optionalChain([eventData, 'optionalAccess',
|
|
6940
|
-
const destinationTxHash = _optionalChain([eventData, 'optionalAccess',
|
|
7496
|
+
const eventData = _optionalChain([event, 'optionalAccess', _403 => _403.data]);
|
|
7497
|
+
const swapTxHash = _optionalChain([eventData, 'optionalAccess', _404 => _404.swap, 'optionalAccess', _405 => _405.transactionHash]);
|
|
7498
|
+
const destinationTxHash = _optionalChain([eventData, 'optionalAccess', _406 => _406.destination, 'optionalAccess', _407 => _407.transactionHash]);
|
|
6941
7499
|
return _nullishCoalesce(swapTxHash, () => ( destinationTxHash));
|
|
6942
7500
|
}
|
|
6943
7501
|
function getTerminalProcessingOutcome(event) {
|
|
6944
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7502
|
+
if (_optionalChain([event, 'optionalAccess', _408 => _408.type]) === "post-bridge-swap-complete") {
|
|
6945
7503
|
return {
|
|
6946
7504
|
type: "complete",
|
|
6947
7505
|
destinationTxHash: getCompletionDestinationTxHash(event),
|
|
6948
7506
|
destinationAmount: getCompletionDestinationAmount(event)
|
|
6949
7507
|
};
|
|
6950
7508
|
}
|
|
6951
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7509
|
+
if (_optionalChain([event, 'optionalAccess', _409 => _409.type]) === "post-bridge-swap-failed") {
|
|
6952
7510
|
return {
|
|
6953
7511
|
type: "failed",
|
|
6954
7512
|
message: formatBridgeFailedMessage(event).message
|
|
6955
7513
|
};
|
|
6956
7514
|
}
|
|
6957
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7515
|
+
if (_optionalChain([event, 'optionalAccess', _410 => _410.type]) === "bridge-complete") {
|
|
6958
7516
|
return {
|
|
6959
7517
|
type: "complete",
|
|
6960
7518
|
destinationTxHash: getCompletionDestinationTxHash(event),
|
|
6961
7519
|
destinationAmount: getCompletionDestinationAmount(event)
|
|
6962
7520
|
};
|
|
6963
7521
|
}
|
|
6964
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7522
|
+
if (_optionalChain([event, 'optionalAccess', _411 => _411.type]) === "bridge-failed") {
|
|
6965
7523
|
return {
|
|
6966
7524
|
type: "failed",
|
|
6967
7525
|
message: formatBridgeFailedMessage(event).message
|
|
6968
7526
|
};
|
|
6969
7527
|
}
|
|
6970
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
7528
|
+
if (_optionalChain([event, 'optionalAccess', _412 => _412.type]) === "error") {
|
|
6971
7529
|
return {
|
|
6972
7530
|
type: "failed",
|
|
6973
|
-
message: _nullishCoalesce(_optionalChain([event, 'access',
|
|
7531
|
+
message: _nullishCoalesce(_optionalChain([event, 'access', _413 => _413.data, 'optionalAccess', _414 => _414.message]), () => ( "Unknown error"))
|
|
6974
7532
|
};
|
|
6975
7533
|
}
|
|
6976
7534
|
return null;
|
|
@@ -6978,10 +7536,10 @@ function getTerminalProcessingOutcome(event) {
|
|
|
6978
7536
|
function getInitialProcessingState(event, txHash) {
|
|
6979
7537
|
if (!event || !isEventForTx(event, txHash)) return null;
|
|
6980
7538
|
const terminal = getTerminalProcessingOutcome(event);
|
|
6981
|
-
if (_optionalChain([terminal, 'optionalAccess',
|
|
7539
|
+
if (_optionalChain([terminal, 'optionalAccess', _415 => _415.type]) === "complete") {
|
|
6982
7540
|
return { type: "complete", lastEvent: event };
|
|
6983
7541
|
}
|
|
6984
|
-
if (_optionalChain([terminal, 'optionalAccess',
|
|
7542
|
+
if (_optionalChain([terminal, 'optionalAccess', _416 => _416.type]) === "failed") {
|
|
6985
7543
|
return { type: "failed", message: terminal.message, lastEvent: event };
|
|
6986
7544
|
}
|
|
6987
7545
|
if (isDepositEvent(event)) {
|
|
@@ -6990,7 +7548,7 @@ function getInitialProcessingState(event, txHash) {
|
|
|
6990
7548
|
return null;
|
|
6991
7549
|
}
|
|
6992
7550
|
function getSettledSourceTxHash(event, fallbackTxHash) {
|
|
6993
|
-
return _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
7551
|
+
return _nullishCoalesce(_optionalChain([event, 'optionalAccess', _417 => _417.data, 'optionalAccess', _418 => _418.source, 'optionalAccess', _419 => _419.transactionHash]), () => ( fallbackTxHash));
|
|
6994
7552
|
}
|
|
6995
7553
|
function ProcessingStep({
|
|
6996
7554
|
smartAccount,
|
|
@@ -7030,7 +7588,7 @@ function ProcessingStep({
|
|
|
7030
7588
|
const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
|
|
7031
7589
|
const pollTimeoutRef = _react.useRef.call(void 0, null);
|
|
7032
7590
|
const escalatedDelayRef = _react.useRef.call(void 0, false);
|
|
7033
|
-
const processingContextRef = useLatestRef({
|
|
7591
|
+
const processingContextRef = _chunkG264OM23cjs.useLatestRef.call(void 0, {
|
|
7034
7592
|
amount,
|
|
7035
7593
|
sourceChain,
|
|
7036
7594
|
sourceToken,
|
|
@@ -7039,9 +7597,9 @@ function ProcessingStep({
|
|
|
7039
7597
|
targetChain,
|
|
7040
7598
|
targetToken
|
|
7041
7599
|
});
|
|
7042
|
-
const onDepositCompleteRef = useLatestRef(onDepositComplete);
|
|
7043
|
-
const onDepositFailedRef = useLatestRef(onDepositFailed);
|
|
7044
|
-
const onErrorRef = useLatestRef(onError);
|
|
7600
|
+
const onDepositCompleteRef = _chunkG264OM23cjs.useLatestRef.call(void 0, onDepositComplete);
|
|
7601
|
+
const onDepositFailedRef = _chunkG264OM23cjs.useLatestRef.call(void 0, onDepositFailed);
|
|
7602
|
+
const onErrorRef = _chunkG264OM23cjs.useLatestRef.call(void 0, onError);
|
|
7045
7603
|
const explorerTxUrl = useExplorerTxUrl();
|
|
7046
7604
|
const initialTerminalEventRef = _react.useRef.call(void 0, null);
|
|
7047
7605
|
const completedDirectTransferTxHashRef = _react.useRef.call(void 0, null);
|
|
@@ -7070,8 +7628,8 @@ function ProcessingStep({
|
|
|
7070
7628
|
const [elapsedSeconds, setElapsedSeconds] = _react.useState.call(void 0,
|
|
7071
7629
|
() => Math.max(0, Math.floor((Date.now() - startTimeRef.current) / 1e3))
|
|
7072
7630
|
);
|
|
7073
|
-
const [latchedTiming, setLatchedTiming] = _react.useState.call(void 0, _optionalChain([quote, 'optionalAccess',
|
|
7074
|
-
if (latchedTiming === void 0 && _optionalChain([quote, 'optionalAccess',
|
|
7631
|
+
const [latchedTiming, setLatchedTiming] = _react.useState.call(void 0, _optionalChain([quote, 'optionalAccess', _420 => _420.timing]));
|
|
7632
|
+
if (latchedTiming === void 0 && _optionalChain([quote, 'optionalAccess', _421 => _421.timing]) !== void 0) {
|
|
7075
7633
|
setLatchedTiming(quote.timing);
|
|
7076
7634
|
}
|
|
7077
7635
|
const timingStateRef = _react.useRef.call(void 0, "expected");
|
|
@@ -7102,7 +7660,7 @@ function ProcessingStep({
|
|
|
7102
7660
|
flowLabel
|
|
7103
7661
|
});
|
|
7104
7662
|
const context = processingContextRef.current;
|
|
7105
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
7663
|
+
_optionalChain([onDepositCompleteRef, 'access', _422 => _422.current, 'optionalCall', _423 => _423(txHash, void 0, {
|
|
7106
7664
|
amount: context.amount,
|
|
7107
7665
|
sourceChain: context.sourceChain,
|
|
7108
7666
|
sourceToken: context.sourceToken,
|
|
@@ -7135,7 +7693,7 @@ function ProcessingStep({
|
|
|
7135
7693
|
destinationTxHash: outcome.destinationTxHash,
|
|
7136
7694
|
event: event.type
|
|
7137
7695
|
});
|
|
7138
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
7696
|
+
_optionalChain([onDepositCompleteRef, 'access', _424 => _424.current, 'optionalCall', _425 => _425(
|
|
7139
7697
|
sourceTxHash2,
|
|
7140
7698
|
outcome.destinationTxHash,
|
|
7141
7699
|
{
|
|
@@ -7156,7 +7714,7 @@ function ProcessingStep({
|
|
|
7156
7714
|
message: outcome.message,
|
|
7157
7715
|
event: event.type
|
|
7158
7716
|
});
|
|
7159
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
7717
|
+
_optionalChain([onDepositFailedRef, 'access', _426 => _426.current, 'optionalCall', _427 => _427(txHash, outcome.message)]);
|
|
7160
7718
|
}, [
|
|
7161
7719
|
debug,
|
|
7162
7720
|
onDepositCompleteRef,
|
|
@@ -7167,8 +7725,8 @@ function ProcessingStep({
|
|
|
7167
7725
|
const onSettledChangeRef = _react.useRef.call(void 0, onSettledChange);
|
|
7168
7726
|
onSettledChangeRef.current = onSettledChange;
|
|
7169
7727
|
_react.useEffect.call(void 0, () => {
|
|
7170
|
-
_optionalChain([onSettledChangeRef, 'access',
|
|
7171
|
-
return () => _optionalChain([onSettledChangeRef, 'access',
|
|
7728
|
+
_optionalChain([onSettledChangeRef, 'access', _428 => _428.current, 'optionalCall', _429 => _429(state.type !== "processing")]);
|
|
7729
|
+
return () => _optionalChain([onSettledChangeRef, 'access', _430 => _430.current, 'optionalCall', _431 => _431(false)]);
|
|
7172
7730
|
}, [state.type]);
|
|
7173
7731
|
_react.useEffect.call(void 0, () => {
|
|
7174
7732
|
if (directTransfer || state.type !== "processing") return;
|
|
@@ -7194,26 +7752,21 @@ function ProcessingStep({
|
|
|
7194
7752
|
updatePhaseTimings(
|
|
7195
7753
|
(previous) => syncPhaseTimings(previous, state.lastEvent)
|
|
7196
7754
|
);
|
|
7197
|
-
}, [_optionalChain([state, 'access',
|
|
7755
|
+
}, [_optionalChain([state, 'access', _432 => _432.lastEvent, 'optionalAccess', _433 => _433.time]), _optionalChain([state, 'access', _434 => _434.lastEvent, 'optionalAccess', _435 => _435.type]), updatePhaseTimings]);
|
|
7198
7756
|
const [swappedFiatContext, setSwappedFiatContext] = _react.useState.call(void 0, null);
|
|
7199
7757
|
_react.useEffect.call(void 0, () => {
|
|
7200
7758
|
let cancelled = false;
|
|
7201
7759
|
let timeoutId;
|
|
7202
|
-
const isFiatSwappedOrder = isSwappedOrder && _optionalChain([swappedContext, 'optionalAccess',
|
|
7203
|
-
const expectedOrderUuid = _nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess',
|
|
7760
|
+
const isFiatSwappedOrder = isSwappedOrder && _optionalChain([swappedContext, 'optionalAccess', _436 => _436.variant]) === "fiat";
|
|
7761
|
+
const expectedOrderUuid = _nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess', _437 => _437.expectedOrderUuid]), () => ( null));
|
|
7204
7762
|
setSwappedFiatContext(null);
|
|
7205
|
-
if (
|
|
7763
|
+
if (!isSwappedOrder || !expectedOrderUuid) {
|
|
7206
7764
|
return () => {
|
|
7207
7765
|
cancelled = true;
|
|
7208
7766
|
};
|
|
7209
7767
|
}
|
|
7768
|
+
const orderId = expectedOrderUuid;
|
|
7210
7769
|
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
7770
|
const scheduleRetry = () => {
|
|
7218
7771
|
if (cancelled || !isFiatSwappedOrder || attempts >= SWAPPED_FIAT_STATUS_MAX_ATTEMPTS) {
|
|
7219
7772
|
return;
|
|
@@ -7226,9 +7779,9 @@ function ProcessingStep({
|
|
|
7226
7779
|
async function fetchContext() {
|
|
7227
7780
|
attempts += 1;
|
|
7228
7781
|
try {
|
|
7229
|
-
const res = await service.
|
|
7782
|
+
const res = await service.fetchSwappedOrder(orderId);
|
|
7230
7783
|
if (cancelled) return;
|
|
7231
|
-
if (!res ||
|
|
7784
|
+
if (!res || res.orderId !== orderId) {
|
|
7232
7785
|
scheduleRetry();
|
|
7233
7786
|
return;
|
|
7234
7787
|
}
|
|
@@ -7236,7 +7789,7 @@ function ProcessingStep({
|
|
|
7236
7789
|
if (isFiatSwappedOrder && !hasFiatReceiptPricing(res)) {
|
|
7237
7790
|
scheduleRetry();
|
|
7238
7791
|
}
|
|
7239
|
-
} catch (
|
|
7792
|
+
} catch (e22) {
|
|
7240
7793
|
scheduleRetry();
|
|
7241
7794
|
}
|
|
7242
7795
|
}
|
|
@@ -7247,11 +7800,9 @@ function ProcessingStep({
|
|
|
7247
7800
|
};
|
|
7248
7801
|
}, [
|
|
7249
7802
|
service,
|
|
7250
|
-
smartAccount,
|
|
7251
|
-
txHash,
|
|
7252
7803
|
isSwappedOrder,
|
|
7253
|
-
_optionalChain([swappedContext, 'optionalAccess',
|
|
7254
|
-
_optionalChain([swappedContext, 'optionalAccess',
|
|
7804
|
+
_optionalChain([swappedContext, 'optionalAccess', _438 => _438.variant]),
|
|
7805
|
+
_optionalChain([swappedContext, 'optionalAccess', _439 => _439.expectedOrderUuid])
|
|
7255
7806
|
]);
|
|
7256
7807
|
_react.useEffect.call(void 0, () => {
|
|
7257
7808
|
if (directTransfer) return;
|
|
@@ -7277,18 +7828,18 @@ function ProcessingStep({
|
|
|
7277
7828
|
debugLog(debug, "processing", "poll:event", {
|
|
7278
7829
|
type: lastEvent2.type,
|
|
7279
7830
|
matchesTx: eventMatchesTx,
|
|
7280
|
-
intentId: _optionalChain([eventData, 'optionalAccess',
|
|
7831
|
+
intentId: _optionalChain([eventData, 'optionalAccess', _440 => _440.intentId])
|
|
7281
7832
|
});
|
|
7282
7833
|
}
|
|
7283
7834
|
if (!isMounted) return;
|
|
7284
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
7835
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _441 => _441.type]) === "bridge-complete") {
|
|
7285
7836
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
7286
7837
|
const sourceTxHash2 = getSettledSourceTxHash(
|
|
7287
7838
|
eventForCurrentTx,
|
|
7288
7839
|
txHash
|
|
7289
7840
|
);
|
|
7290
|
-
const destination = _optionalChain([eventForCurrentTx, 'access',
|
|
7291
|
-
const destinationTxHash2 = _optionalChain([destination, 'optionalAccess',
|
|
7841
|
+
const destination = _optionalChain([eventForCurrentTx, 'access', _442 => _442.data, 'optionalAccess', _443 => _443.destination]);
|
|
7842
|
+
const destinationTxHash2 = _optionalChain([destination, 'optionalAccess', _444 => _444.transactionHash]);
|
|
7292
7843
|
debugLog(debug, "processing", "state:complete", {
|
|
7293
7844
|
txHash,
|
|
7294
7845
|
sourceTxHash: sourceTxHash2,
|
|
@@ -7296,7 +7847,7 @@ function ProcessingStep({
|
|
|
7296
7847
|
event: eventForCurrentTx.type
|
|
7297
7848
|
});
|
|
7298
7849
|
const context = processingContextRef.current;
|
|
7299
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
7850
|
+
_optionalChain([onDepositCompleteRef, 'access', _445 => _445.current, 'optionalCall', _446 => _446(sourceTxHash2, destinationTxHash2, {
|
|
7300
7851
|
amount: context.amount,
|
|
7301
7852
|
sourceChain: context.sourceChain,
|
|
7302
7853
|
sourceToken: context.sourceToken,
|
|
@@ -7304,11 +7855,11 @@ function ProcessingStep({
|
|
|
7304
7855
|
amountUsd: context.amountUsd,
|
|
7305
7856
|
targetChain: context.targetChain,
|
|
7306
7857
|
targetToken: context.targetToken,
|
|
7307
|
-
destinationAmount: typeof _optionalChain([destination, 'optionalAccess',
|
|
7858
|
+
destinationAmount: typeof _optionalChain([destination, 'optionalAccess', _447 => _447.amount]) === "string" ? destination.amount : void 0
|
|
7308
7859
|
})]);
|
|
7309
7860
|
return;
|
|
7310
7861
|
}
|
|
7311
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
7862
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _448 => _448.type]) === "bridge-failed") {
|
|
7312
7863
|
const formatted = formatBridgeFailedMessage(eventForCurrentTx);
|
|
7313
7864
|
setState({
|
|
7314
7865
|
type: "failed",
|
|
@@ -7320,11 +7871,11 @@ function ProcessingStep({
|
|
|
7320
7871
|
message: formatted.message,
|
|
7321
7872
|
code: formatted.code
|
|
7322
7873
|
});
|
|
7323
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
7874
|
+
_optionalChain([onDepositFailedRef, 'access', _449 => _449.current, 'optionalCall', _450 => _450(txHash, formatted.message)]);
|
|
7324
7875
|
return;
|
|
7325
7876
|
}
|
|
7326
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
7327
|
-
const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access',
|
|
7877
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _451 => _451.type]) === "error") {
|
|
7878
|
+
const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access', _452 => _452.data, 'optionalAccess', _453 => _453.message]), () => ( "Unknown error"));
|
|
7328
7879
|
setState({
|
|
7329
7880
|
type: "failed",
|
|
7330
7881
|
message: errorMessage,
|
|
@@ -7334,7 +7885,7 @@ function ProcessingStep({
|
|
|
7334
7885
|
txHash,
|
|
7335
7886
|
message: errorMessage
|
|
7336
7887
|
});
|
|
7337
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
7888
|
+
_optionalChain([onDepositFailedRef, 'access', _454 => _454.current, 'optionalCall', _455 => _455(txHash, errorMessage)]);
|
|
7338
7889
|
return;
|
|
7339
7890
|
}
|
|
7340
7891
|
setState((previous) => ({
|
|
@@ -7392,55 +7943,62 @@ function ProcessingStep({
|
|
|
7392
7943
|
const timelineNowMs = _nullishCoalesce(phaseTimings.endedAt, () => ( Date.now()));
|
|
7393
7944
|
const flowNoun = flowLabel === "withdraw" ? "withdrawal" : flowLabel === "payment" ? "payment" : "deposit";
|
|
7394
7945
|
const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : flowLabel === "payment" ? "Payment" : "Deposit";
|
|
7395
|
-
const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess',
|
|
7946
|
+
const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess', _456 => _456.data, 'optionalAccess', _457 => _457.destination, 'optionalAccess', _458 => _458.transactionHash]) || null;
|
|
7396
7947
|
const sourceTxHash = getSettledSourceTxHash(lastEvent, txHash);
|
|
7397
7948
|
const sourceDetails = getEventSourceDetails(lastEvent);
|
|
7398
7949
|
const displaySourceChain = _nullishCoalesce(sourceDetails.chainId, () => ( sourceChain));
|
|
7399
7950
|
const displaySourceToken = _nullishCoalesce(sourceDetails.token, () => ( sourceToken));
|
|
7400
7951
|
const displayAmount = _nullishCoalesce(sourceDetails.amount, () => ( amount));
|
|
7401
|
-
const targetChainId =
|
|
7402
|
-
const settledSourceTxHash = _optionalChain([lastEvent, 'optionalAccess',
|
|
7952
|
+
const targetChainId = _chunkFKJ6EJHHcjs.targetChainToChainId.call(void 0, targetChain);
|
|
7953
|
+
const settledSourceTxHash = _optionalChain([lastEvent, 'optionalAccess', _459 => _459.data, 'optionalAccess', _460 => _460.source, 'optionalAccess', _461 => _461.transactionHash]);
|
|
7403
7954
|
const sourceExplorerHash = _nullishCoalesce(settledSourceTxHash, () => ( (sourceTxHashPending ? null : sourceTxHash)));
|
|
7404
7955
|
_react.useEffect.call(void 0, () => {
|
|
7405
7956
|
if (sourceTxHashPending && settledSourceTxHash) {
|
|
7406
|
-
_optionalChain([onSourceTransactionObserved, 'optionalCall',
|
|
7957
|
+
_optionalChain([onSourceTransactionObserved, 'optionalCall', _462 => _462(settledSourceTxHash)]);
|
|
7407
7958
|
}
|
|
7408
7959
|
}, [onSourceTransactionObserved, settledSourceTxHash, sourceTxHashPending]);
|
|
7409
7960
|
const sourceExplorerUrl = sourceExplorerHash ? explorerTxUrl(displaySourceChain, sourceExplorerHash) : null;
|
|
7410
7961
|
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
7962
|
const eventDestination = getEventDestinationDetails(lastEvent);
|
|
7425
|
-
const
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7963
|
+
const displayTargetChain = _nullishCoalesce(eventDestination.chainId, () => ( targetChainId));
|
|
7964
|
+
const displayTargetToken = _nullishCoalesce(eventDestination.token, () => ( targetToken));
|
|
7965
|
+
const [sourceDisplay, targetDisplay] = useTokenDisplays([
|
|
7966
|
+
{
|
|
7967
|
+
chain: displaySourceChain,
|
|
7968
|
+
address: displaySourceToken,
|
|
7969
|
+
fallback: {
|
|
7970
|
+
symbol: _nullishCoalesce(providedSourceSymbol, () => ( (displaySourceChain === "solana" ? "SOL" : "Token"))),
|
|
7971
|
+
decimals: providedSourceDecimals
|
|
7972
|
+
}
|
|
7973
|
+
},
|
|
7974
|
+
{
|
|
7975
|
+
chain: displayTargetChain,
|
|
7976
|
+
address: displayTargetToken,
|
|
7977
|
+
// Dapp deposits default to USDC targets; mirror the source symbol last
|
|
7978
|
+
// so unresolvable same-token routes still label sensibly.
|
|
7979
|
+
fallback: { symbol: _nullishCoalesce(providedSourceSymbol, () => ( "USDC")) }
|
|
7980
|
+
}
|
|
7981
|
+
]);
|
|
7982
|
+
const sourceSymbol = sourceDisplay.symbol;
|
|
7432
7983
|
const targetSymbol = targetDisplay.symbol;
|
|
7984
|
+
const formattedSentAmount = _nullishCoalesce(formatRawTokenAmount(displayAmount, sourceDisplay), () => ( // Unknown decimals: no figure rather than a guess off by 10^12.
|
|
7985
|
+
(sourceDisplay.decimals === void 0 ? "\u2014" : (
|
|
7986
|
+
// Not raw base units (e.g. a decimal string) — render the number as-is.
|
|
7987
|
+
_nullishCoalesce(formatTokenAmount(Number(displayAmount), sourceDisplay.symbol), () => ( displayAmount))
|
|
7988
|
+
))));
|
|
7989
|
+
const sourceTokenRef = displaySourceToken ? { chain: displaySourceChain, address: displaySourceToken } : void 0;
|
|
7990
|
+
const targetTokenRef = displayTargetToken ? { chain: displayTargetChain, address: displayTargetToken } : void 0;
|
|
7433
7991
|
const formattedDestinationAmount = eventDestination.amount !== void 0 ? formatRawTokenAmount(eventDestination.amount, targetDisplay) : void 0;
|
|
7434
7992
|
const amountUsdNumber = amountUsd !== void 0 && Number(amountUsd) > 0 ? Number(amountUsd) : void 0;
|
|
7435
|
-
const prices = useTokenPrices(
|
|
7993
|
+
const prices = useTokenPrices([
|
|
7436
7994
|
{
|
|
7437
7995
|
chainId: displaySourceChain,
|
|
7438
7996
|
address: displaySourceToken,
|
|
7439
7997
|
symbol: sourceDisplay.symbol
|
|
7440
7998
|
},
|
|
7441
7999
|
{
|
|
7442
|
-
chainId:
|
|
7443
|
-
address:
|
|
8000
|
+
chainId: displayTargetChain,
|
|
8001
|
+
address: displayTargetToken,
|
|
7444
8002
|
symbol: targetDisplay.symbol
|
|
7445
8003
|
}
|
|
7446
8004
|
]);
|
|
@@ -7450,7 +8008,7 @@ function ProcessingStep({
|
|
|
7450
8008
|
sourceSymbol: sourceDisplay.symbol,
|
|
7451
8009
|
targetSymbol: targetDisplay.symbol,
|
|
7452
8010
|
sourceAmountUsd: amountUsdNumber,
|
|
7453
|
-
sourceTrusted:
|
|
8011
|
+
sourceTrusted: sourceDisplay.curated,
|
|
7454
8012
|
prices
|
|
7455
8013
|
});
|
|
7456
8014
|
return estimate !== void 0 ? formatTokenAmount(estimate, targetDisplay.symbol) : void 0;
|
|
@@ -7507,7 +8065,7 @@ function ProcessingStep({
|
|
|
7507
8065
|
timeoutMs: latchedTiming ? resolveServedThresholds(latchedTiming).escalatedMs : FALLBACK_ESCALATED_DELAY_MS,
|
|
7508
8066
|
served: latchedTiming !== void 0
|
|
7509
8067
|
});
|
|
7510
|
-
_optionalChain([onErrorRef, 'access',
|
|
8068
|
+
_optionalChain([onErrorRef, 'access', _463 => _463.current, 'optionalCall', _464 => _464(
|
|
7511
8069
|
"Transfer is taking longer than expected. Your funds are safe and processing will continue automatically.",
|
|
7512
8070
|
"PROCESS_TIMEOUT"
|
|
7513
8071
|
)]);
|
|
@@ -7520,13 +8078,13 @@ function ProcessingStep({
|
|
|
7520
8078
|
timingState,
|
|
7521
8079
|
txHash
|
|
7522
8080
|
]);
|
|
7523
|
-
const sourceChainIcon =
|
|
7524
|
-
const targetChainIcon =
|
|
7525
|
-
const sourceChainName =
|
|
7526
|
-
const targetChainName =
|
|
8081
|
+
const sourceChainIcon = _chunkFKJ6EJHHcjs.getChainIcon.call(void 0, displaySourceChain);
|
|
8082
|
+
const targetChainIcon = _chunkFKJ6EJHHcjs.getChainIcon.call(void 0, targetChainId);
|
|
8083
|
+
const sourceChainName = _chunkFKJ6EJHHcjs.getChainName.call(void 0, displaySourceChain);
|
|
8084
|
+
const targetChainName = _chunkFKJ6EJHHcjs.getChainName.call(void 0, targetChainId);
|
|
7527
8085
|
const timerText = formatTimer(elapsedSeconds);
|
|
7528
|
-
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
7529
|
-
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
8086
|
+
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _465 => _465.feeSponsored]), () => ( false));
|
|
8087
|
+
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _466 => _466.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
|
|
7530
8088
|
const stateTitle = isComplete ? `${flowCapitalized} successful` : isFailed ? `${flowCapitalized} failed` : "Processing...";
|
|
7531
8089
|
const handleRetry = _nullishCoalesce(onRetry, () => ( onNewDeposit));
|
|
7532
8090
|
const headerContent = isComplete ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header", children: [
|
|
@@ -7535,22 +8093,22 @@ function ProcessingStep({
|
|
|
7535
8093
|
] }) : isFailed ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header", children: [
|
|
7536
8094
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, FailedBadge, {}),
|
|
7537
8095
|
/* @__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 });
|
|
8096
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.WalletIcon, {}), title: stateTitle });
|
|
7539
8097
|
if (isComplete && isSwappedOrder) {
|
|
7540
|
-
const effectivePaymentMethod = _nullishCoalesce(_nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess',
|
|
8098
|
+
const effectivePaymentMethod = _nullishCoalesce(_nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess', _467 => _467.method]), () => ( _optionalChain([swappedFiatContext, 'optionalAccess', _468 => _468.paymentMethod]))), () => ( null));
|
|
7541
8099
|
const onrampMethod = effectivePaymentMethod ? formatPaymentMethod(effectivePaymentMethod) : null;
|
|
7542
|
-
const onrampMethodIcon = _optionalChain([swappedContext, 'optionalAccess',
|
|
8100
|
+
const onrampMethodIcon = _optionalChain([swappedContext, 'optionalAccess', _469 => _469.variant]) === "connect" && effectivePaymentMethod ? getExchangeLogoSrc(
|
|
7543
8101
|
_nullishCoalesce(onrampMethod, () => ( effectivePaymentMethod)),
|
|
7544
8102
|
effectivePaymentMethod
|
|
7545
8103
|
) : null;
|
|
7546
|
-
const connectPaidAmount = _optionalChain([swappedContext, 'optionalAccess',
|
|
7547
|
-
const amountPaid = _nullishCoalesce(connectPaidAmount, () => ( (_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
8104
|
+
const connectPaidAmount = _optionalChain([swappedContext, 'optionalAccess', _470 => _470.variant]) === "connect" ? `${formattedSentAmount} ${sourceSymbol}` : null;
|
|
8105
|
+
const amountPaid = _nullishCoalesce(connectPaidAmount, () => ( (_optionalChain([swappedFiatContext, 'optionalAccess', _471 => _471.paidAmountUsd]) != null ? `$${swappedFiatContext.paidAmountUsd.toFixed(2)}` : null)));
|
|
7548
8106
|
const depositedAmount = receiveDisplay;
|
|
7549
|
-
const onrampFeeUsd = _nullishCoalesce(_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
8107
|
+
const onrampFeeUsd = _nullishCoalesce(_optionalChain([swappedFiatContext, 'optionalAccess', _472 => _472.onrampFeeUsd]), () => ( null));
|
|
7550
8108
|
const sponsoredFeeTooltip = "This fee is sponsored for this deposit.";
|
|
7551
8109
|
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
8110
|
const { rows: quoteFeeRows, chargeableUsd } = buildQuoteFeeRows(
|
|
7553
|
-
_optionalChain([quote, 'optionalAccess',
|
|
8111
|
+
_optionalChain([quote, 'optionalAccess', _473 => _473.fees, 'access', _474 => _474.breakdown]),
|
|
7554
8112
|
sponsoredFeeTooltip
|
|
7555
8113
|
);
|
|
7556
8114
|
const feeRows = [];
|
|
@@ -7583,6 +8141,7 @@ function ProcessingStep({
|
|
|
7583
8141
|
amountPaid,
|
|
7584
8142
|
depositedAmount,
|
|
7585
8143
|
depositedSymbol: targetSymbol,
|
|
8144
|
+
depositedToken: targetTokenRef,
|
|
7586
8145
|
feesTotal,
|
|
7587
8146
|
feeRows,
|
|
7588
8147
|
feesTooltip,
|
|
@@ -7609,7 +8168,7 @@ function ProcessingStep({
|
|
|
7609
8168
|
rel: "noopener noreferrer",
|
|
7610
8169
|
className: "rs-review-detail-link",
|
|
7611
8170
|
"aria-label": "View source transaction",
|
|
7612
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {})
|
|
8171
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ExternalLinkIcon, {})
|
|
7613
8172
|
}
|
|
7614
8173
|
)
|
|
7615
8174
|
] })
|
|
@@ -7627,7 +8186,7 @@ function ProcessingStep({
|
|
|
7627
8186
|
rel: "noopener noreferrer",
|
|
7628
8187
|
className: "rs-review-detail-link",
|
|
7629
8188
|
"aria-label": "View destination transaction",
|
|
7630
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {})
|
|
8189
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.ExternalLinkIcon, {})
|
|
7631
8190
|
}
|
|
7632
8191
|
)
|
|
7633
8192
|
] })
|
|
@@ -7637,7 +8196,7 @@ function ProcessingStep({
|
|
|
7637
8196
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Ticker, { value: timerText }) })
|
|
7638
8197
|
] }),
|
|
7639
8198
|
isSwappedOrder ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
7640
|
-
_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
8199
|
+
_optionalChain([swappedFiatContext, 'optionalAccess', _475 => _475.paidAmountUsd]) != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
7641
8200
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "You pay" }),
|
|
7642
8201
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
7643
8202
|
"$",
|
|
@@ -7649,7 +8208,7 @@ function ProcessingStep({
|
|
|
7649
8208
|
] })
|
|
7650
8209
|
] })
|
|
7651
8210
|
] }),
|
|
7652
|
-
_optionalChain([swappedFiatContext, 'optionalAccess',
|
|
8211
|
+
_optionalChain([swappedFiatContext, 'optionalAccess', _476 => _476.onrampFeeUsd]) != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
7653
8212
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "On-ramp fee" }),
|
|
7654
8213
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
7655
8214
|
"$",
|
|
@@ -7664,7 +8223,7 @@ function ProcessingStep({
|
|
|
7664
8223
|
" ",
|
|
7665
8224
|
sourceSymbol
|
|
7666
8225
|
] }),
|
|
7667
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenIcon, { symbol: sourceSymbol }) })
|
|
8226
|
+
/* @__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
8227
|
] })
|
|
7669
8228
|
] })
|
|
7670
8229
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -7675,14 +8234,14 @@ function ProcessingStep({
|
|
|
7675
8234
|
" ",
|
|
7676
8235
|
sourceSymbol
|
|
7677
8236
|
] }),
|
|
7678
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenIcon, { symbol: sourceSymbol }) })
|
|
8237
|
+
/* @__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
8238
|
] })
|
|
7680
8239
|
] }),
|
|
7681
8240
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
7682
8241
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: isProcessing ? "Receive" : "Received" }),
|
|
7683
8242
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
7684
8243
|
/* @__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 }) })
|
|
8244
|
+
/* @__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
8245
|
] })
|
|
7687
8246
|
] }),
|
|
7688
8247
|
isFailed && balanceAfterUsd !== void 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -7711,12 +8270,12 @@ function ProcessingStep({
|
|
|
7711
8270
|
{
|
|
7712
8271
|
className: "rs-review-detail-info",
|
|
7713
8272
|
"aria-label": "Fee info",
|
|
7714
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfoIcon, {})
|
|
8273
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG264OM23cjs.InfoIcon, {})
|
|
7715
8274
|
}
|
|
7716
8275
|
) })
|
|
7717
8276
|
] })
|
|
7718
8277
|
] }) : (() => {
|
|
7719
|
-
const { display, struck } = quoteFeeRow(_optionalChain([quote, 'optionalAccess',
|
|
8278
|
+
const { display, struck } = quoteFeeRow(_optionalChain([quote, 'optionalAccess', _477 => _477.fees]));
|
|
7720
8279
|
if (display !== null) {
|
|
7721
8280
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
7722
8281
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fees" }),
|
|
@@ -7823,7 +8382,7 @@ var RECIPIENT_HINTS = {
|
|
|
7823
8382
|
stellar: "A Stellar destination needs a recipient account ID starting with G."
|
|
7824
8383
|
};
|
|
7825
8384
|
function recipientNamespace(targetChain) {
|
|
7826
|
-
return _nullishCoalesce(
|
|
8385
|
+
return _nullishCoalesce(_chunkFKJ6EJHHcjs.targetChainToCaip2.call(void 0, targetChain).split(":")[0], () => ( ""));
|
|
7827
8386
|
}
|
|
7828
8387
|
function recipientMatchesTarget(recipient, targetChain) {
|
|
7829
8388
|
const pattern = RECIPIENT_PATTERNS[recipientNamespace(targetChain)];
|
|
@@ -7833,7 +8392,7 @@ function deriveAccountSalt(input) {
|
|
|
7833
8392
|
return _viem.keccak256.call(void 0,
|
|
7834
8393
|
_viem.concat.call(void 0, [
|
|
7835
8394
|
_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,
|
|
8395
|
+
_viem.keccak256.call(void 0, _viem.toHex.call(void 0, _chunkFKJ6EJHHcjs.targetChainToCaip2.call(void 0, input.targetChain))),
|
|
7837
8396
|
_viem.keccak256.call(void 0, _viem.toHex.call(void 0, _nullishCoalesce(normalizeKeyToken(input.targetToken), () => ( ""))))
|
|
7838
8397
|
])
|
|
7839
8398
|
);
|
|
@@ -7867,7 +8426,7 @@ var setupRequestDedupe = /* @__PURE__ */ new Map();
|
|
|
7867
8426
|
function readDedupedAccountSetupResult(requestKey) {
|
|
7868
8427
|
const now = Date.now();
|
|
7869
8428
|
const existing = setupRequestDedupe.get(requestKey);
|
|
7870
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
8429
|
+
if (_optionalChain([existing, 'optionalAccess', _478 => _478.settled]) && existing.expiresAt > now && existing.result) {
|
|
7871
8430
|
return existing.result;
|
|
7872
8431
|
}
|
|
7873
8432
|
return null;
|
|
@@ -7898,10 +8457,10 @@ async function runAccountSetup(input, deps) {
|
|
|
7898
8457
|
const result = await service.registerManagedAccount({
|
|
7899
8458
|
salt,
|
|
7900
8459
|
target: {
|
|
7901
|
-
chain:
|
|
8460
|
+
chain: _chunkFKJ6EJHHcjs.targetChainToCaip2.call(void 0, input.targetChain),
|
|
7902
8461
|
token: input.targetToken,
|
|
7903
8462
|
recipient: input.recipient,
|
|
7904
|
-
..._optionalChain([input, 'access',
|
|
8463
|
+
..._optionalChain([input, 'access', _479 => _479.outputTokenRules, 'optionalAccess', _480 => _480.length]) && {
|
|
7905
8464
|
outputTokenRules: input.outputTokenRules
|
|
7906
8465
|
},
|
|
7907
8466
|
...input.rejectUnmapped != null && {
|
|
@@ -8079,13 +8638,4 @@ function mapError(error) {
|
|
|
8079
8638
|
|
|
8080
8639
|
|
|
8081
8640
|
|
|
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;
|
|
8641
|
+
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.hostedOrderStateFromSwapped = hostedOrderStateFromSwapped; exports.mergeHostedOrderState = mergeHostedOrderState; exports.hasReached = hasReached; 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;
|