@glacislabs/stablegenie-zerodelta 4.0.0 → 4.1.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 +52 -20
- package/dist/{chunk-ABI6ZH7O.js → chunk-6BYXMDVN.js} +214 -49
- package/dist/{chunk-FJQQLB2K.js → chunk-MQ4XLBVF.js} +167 -16
- package/dist/core/index.cjs +169 -15
- package/dist/core/index.d.cts +25 -4
- package/dist/core/index.d.ts +25 -4
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +381 -65
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{mount-D5k_u92L.d.ts → mount-CoLgvvsE.d.ts} +1 -1
- package/dist/{mount-mcyZAzZc.d.cts → mount-Dz9LffFx.d.cts} +1 -1
- package/dist/mount.cjs +381 -65
- package/dist/mount.d.cts +2 -2
- package/dist/mount.d.ts +2 -2
- package/dist/mount.js +2 -2
- package/dist/standalone.global.js +63 -7
- package/dist/{verify-C9vzpm4T.d.cts → verify-Bdw8-YWZ.d.cts} +74 -3
- package/dist/{verify-C9vzpm4T.d.ts → verify-Bdw8-YWZ.d.ts} +74 -3
- package/package.json +1 -1
package/dist/mount.cjs
CHANGED
|
@@ -544,10 +544,10 @@ function brokenLaneFor(token, source, brokenLanes) {
|
|
|
544
544
|
}
|
|
545
545
|
function destinationAvailability(token, ctx, source) {
|
|
546
546
|
if (brokenLaneFor(token, source ?? void 0, ctx.brokenLanes)) return "unreachable";
|
|
547
|
-
if (
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
return "available";
|
|
547
|
+
if (directLaneOK(token, source ?? void 0, ctx.lanes)) {
|
|
548
|
+
if (ctx.execution.has(Number(token.chainId))) return "available";
|
|
549
|
+
if (token.isChainedDestination === true) return "available";
|
|
550
|
+
if (!isKnownUnbridgeable(token.bridge) && ctx.destination.has(tokenKey(token.chainId, token.address))) return "available";
|
|
551
551
|
}
|
|
552
552
|
return ctx.hubSymbols.has(symbolKey(token.symbol)) ? "hub-only" : "unreachable";
|
|
553
553
|
}
|
|
@@ -597,7 +597,7 @@ function buildCatalogue(input) {
|
|
|
597
597
|
);
|
|
598
598
|
const byId = new Map(enabledChains.map((c) => [Number(c.chainId), c]));
|
|
599
599
|
for (const id of chainIds) if (!byId.has(id)) byId.set(id, { chainId: id, isEnabled: true });
|
|
600
|
-
return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready };
|
|
600
|
+
return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready, vaultIcons: input.vaultIcons ?? /* @__PURE__ */ new Map() };
|
|
601
601
|
}
|
|
602
602
|
|
|
603
603
|
// src/core/options.ts
|
|
@@ -722,10 +722,10 @@ function nativeFeeShortLabel(check, symbol) {
|
|
|
722
722
|
if (!check.short) return null;
|
|
723
723
|
return `Need ${formatNative(check.required)} ${symbol} for the bridge fee`;
|
|
724
724
|
}
|
|
725
|
-
function nativeFeeShortMessage(check, symbol,
|
|
725
|
+
function nativeFeeShortMessage(check, symbol, chainName3) {
|
|
726
726
|
const need = formatNative(check.required);
|
|
727
727
|
const have = formatNative(check.balance ?? 0n);
|
|
728
|
-
const where =
|
|
728
|
+
const where = chainName3 ? ` on ${chainName3}` : "";
|
|
729
729
|
return `This route bridges via LayerZero, which charges a ${need} ${symbol} network fee paid as part of the transaction. Your wallet holds ${have} ${symbol}${where}. Add ${symbol}${where} and try again \u2014 gas is owed on top of this fee.`;
|
|
730
730
|
}
|
|
731
731
|
|
|
@@ -735,7 +735,8 @@ function suppressedLanes(health) {
|
|
|
735
735
|
if (health?.mode !== "enforce" || !Array.isArray(health.lanes)) return EMPTY;
|
|
736
736
|
const out = /* @__PURE__ */ new Map();
|
|
737
737
|
for (const lane of health.lanes) {
|
|
738
|
-
|
|
738
|
+
const firewalled = lane?.status === "unknown" && lane?.kind === "firewalled";
|
|
739
|
+
if (lane?.status !== "broken" && !firewalled) continue;
|
|
739
740
|
const key = typeof lane.laneKey === "string" ? lane.laneKey.toLowerCase() : "";
|
|
740
741
|
if (!key) continue;
|
|
741
742
|
out.set(key, {
|
|
@@ -752,6 +753,8 @@ function brokenLaneReason(lane) {
|
|
|
752
753
|
switch (lane.kind) {
|
|
753
754
|
case "bridge-throttled":
|
|
754
755
|
return "The issuer's bridge for this pair is closed right now.";
|
|
756
|
+
case "firewalled":
|
|
757
|
+
return "This pair is temporarily unavailable.";
|
|
755
758
|
case "vault-closed":
|
|
756
759
|
return "This vault is not accepting deposits right now.";
|
|
757
760
|
default:
|
|
@@ -759,6 +762,34 @@ function brokenLaneReason(lane) {
|
|
|
759
762
|
}
|
|
760
763
|
}
|
|
761
764
|
|
|
765
|
+
// src/core/rwa-icons.ts
|
|
766
|
+
var GATEWAY_ICON_PREFIX = "/api/v1/rwa/icons/";
|
|
767
|
+
var ICON_FILE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}\.(?:png|jpg|jpeg|webp|gif)$/;
|
|
768
|
+
function resolveVaultIcon(apiBase, iconPath) {
|
|
769
|
+
if (typeof iconPath !== "string" || !iconPath.startsWith(GATEWAY_ICON_PREFIX)) return void 0;
|
|
770
|
+
const file = iconPath.slice(GATEWAY_ICON_PREFIX.length);
|
|
771
|
+
if (!ICON_FILE.test(file)) return void 0;
|
|
772
|
+
return `${apiBase.replace(/\/$/, "")}/rwa/icons/${file}`;
|
|
773
|
+
}
|
|
774
|
+
function vaultIconsBySymbol(apiBase, vaults) {
|
|
775
|
+
const out = /* @__PURE__ */ new Map();
|
|
776
|
+
for (const vault of vaults) {
|
|
777
|
+
const key = symbolKey(vault?.symbol);
|
|
778
|
+
if (!key || out.has(key)) continue;
|
|
779
|
+
const url = resolveVaultIcon(apiBase, vault?.iconMiniUrl) ?? resolveVaultIcon(apiBase, vault?.iconUrl);
|
|
780
|
+
if (url) out.set(key, url);
|
|
781
|
+
}
|
|
782
|
+
return out;
|
|
783
|
+
}
|
|
784
|
+
function withVaultArtwork(tokens, icons) {
|
|
785
|
+
if (!icons.size) return tokens;
|
|
786
|
+
return tokens.map((token) => {
|
|
787
|
+
if (token.logoUrl) return token;
|
|
788
|
+
const url = icons.get(symbolKey(token.symbol));
|
|
789
|
+
return url ? { ...token, logoUrl: url } : token;
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
|
|
762
793
|
// src/core/compliance.ts
|
|
763
794
|
var COMPLIANCE_DENY_LABEL = "Compliance check failed";
|
|
764
795
|
function complianceView(compliance, hasQuote = true) {
|
|
@@ -1311,7 +1342,63 @@ function routeLabelFor(option, destinationToken, result) {
|
|
|
1311
1342
|
const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
|
|
1312
1343
|
return `Swap ${option.symbol} to ${destinationToken.symbol} and settle on ZeroDelta${bridge}.`;
|
|
1313
1344
|
}
|
|
1314
|
-
|
|
1345
|
+
function tokenAt(tokens, chainId, address) {
|
|
1346
|
+
const wanted = normalizeAddress(address);
|
|
1347
|
+
if (!wanted || !tokens?.length) return void 0;
|
|
1348
|
+
return tokens.find((t) => Number(t.chainId) === Number(chainId) && normalizeAddress(t.address) === wanted);
|
|
1349
|
+
}
|
|
1350
|
+
function legAmount(raw, decimals) {
|
|
1351
|
+
if (decimals === void 0) return "";
|
|
1352
|
+
try {
|
|
1353
|
+
return formatUnits(raw || "0", decimals);
|
|
1354
|
+
} catch {
|
|
1355
|
+
return "";
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
function buildLegs(orders, ctx) {
|
|
1359
|
+
const legs = [];
|
|
1360
|
+
let fromChainId = ctx.option.chainId;
|
|
1361
|
+
let fromAsset = ctx.option.symbol;
|
|
1362
|
+
let fromDecimals = ctx.option.decimals;
|
|
1363
|
+
for (let index = 0; index < orders.length; index += 1) {
|
|
1364
|
+
const order = orders[index];
|
|
1365
|
+
const isLast = index === orders.length - 1;
|
|
1366
|
+
const toChainId = Number(order.destinationChainId);
|
|
1367
|
+
const askToken = isLast ? ctx.destinationToken : tokenAt(ctx.tokens, toChainId, order.askToken);
|
|
1368
|
+
const toAsset = isLast ? ctx.destinationToken.symbol : askToken?.symbol ?? "";
|
|
1369
|
+
const toDecimals = askToken ? assetDecimals(askToken) : void 0;
|
|
1370
|
+
const executionChainId = Number(order.executionChainId);
|
|
1371
|
+
legs.push({
|
|
1372
|
+
index: index + 1,
|
|
1373
|
+
fromAsset,
|
|
1374
|
+
fromChainId,
|
|
1375
|
+
fromChainName: chainNameOf(fromChainId, ctx.chains),
|
|
1376
|
+
fromAmount: legAmount(order.bidTokenAmount, fromDecimals),
|
|
1377
|
+
toAsset,
|
|
1378
|
+
toChainId,
|
|
1379
|
+
toChainName: chainNameOf(toChainId, ctx.chains),
|
|
1380
|
+
toAmount: legAmount(order.askTokenAmount, toDecimals),
|
|
1381
|
+
executionChainId,
|
|
1382
|
+
executionChainName: chainNameOf(executionChainId, ctx.chains)
|
|
1383
|
+
});
|
|
1384
|
+
fromChainId = toChainId;
|
|
1385
|
+
fromAsset = toAsset;
|
|
1386
|
+
fromDecimals = toDecimals;
|
|
1387
|
+
}
|
|
1388
|
+
return legs;
|
|
1389
|
+
}
|
|
1390
|
+
async function buildRoute({
|
|
1391
|
+
option,
|
|
1392
|
+
destination,
|
|
1393
|
+
destinationToken,
|
|
1394
|
+
chains,
|
|
1395
|
+
tokens,
|
|
1396
|
+
payer,
|
|
1397
|
+
fetchQuote,
|
|
1398
|
+
solve = solveExactOut,
|
|
1399
|
+
amountInRaw,
|
|
1400
|
+
compliance
|
|
1401
|
+
}) {
|
|
1315
1402
|
const result = await solve({ option, destination, destinationToken, payer, fetchQuote, amountInRaw });
|
|
1316
1403
|
const quote = result.quote;
|
|
1317
1404
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -1341,6 +1428,23 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1341
1428
|
},
|
|
1342
1429
|
routeLabel: routeLabelFor(option, destinationToken, result),
|
|
1343
1430
|
deltaLabel: routeDeltaLabel(result, quote),
|
|
1431
|
+
// A direct transfer submits no order at all, but it is still ONE hop and history renders the
|
|
1432
|
+
// same shape for it — an empty `legs` would leave "one order or two?" unanswerable for it alone.
|
|
1433
|
+
legs: [
|
|
1434
|
+
{
|
|
1435
|
+
index: 1,
|
|
1436
|
+
fromAsset: option.symbol,
|
|
1437
|
+
fromChainId: option.chainId,
|
|
1438
|
+
fromChainName: option.chainName,
|
|
1439
|
+
fromAmount: sourceAmount,
|
|
1440
|
+
toAsset: destinationToken.symbol,
|
|
1441
|
+
toChainId: Number(destination.chainId),
|
|
1442
|
+
toChainName: chainNameOf(Number(destination.chainId), chains),
|
|
1443
|
+
toAmount: receiveAmount,
|
|
1444
|
+
executionChainId: option.chainId,
|
|
1445
|
+
executionChainName: option.chainName
|
|
1446
|
+
}
|
|
1447
|
+
],
|
|
1344
1448
|
transactions: [
|
|
1345
1449
|
{
|
|
1346
1450
|
id: "transfer",
|
|
@@ -1414,6 +1518,7 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1414
1518
|
},
|
|
1415
1519
|
routeLabel: routeLabelFor(option, destinationToken, result),
|
|
1416
1520
|
deltaLabel: routeDeltaLabel(result, quote),
|
|
1521
|
+
legs: buildLegs(orders, { option, destinationToken, chains, tokens }),
|
|
1417
1522
|
transactions: [
|
|
1418
1523
|
{
|
|
1419
1524
|
id: "approve",
|
|
@@ -1521,7 +1626,8 @@ function createApiClient(cfg) {
|
|
|
1521
1626
|
chains: null,
|
|
1522
1627
|
tokens: null,
|
|
1523
1628
|
routes: null,
|
|
1524
|
-
health: null
|
|
1629
|
+
health: null,
|
|
1630
|
+
vaults: null
|
|
1525
1631
|
};
|
|
1526
1632
|
const screenCache = /* @__PURE__ */ new Map();
|
|
1527
1633
|
const screenInflight = /* @__PURE__ */ new Map();
|
|
@@ -1605,6 +1711,19 @@ function createApiClient(cfg) {
|
|
|
1605
1711
|
cache.health = { at: Date.now(), value };
|
|
1606
1712
|
return value;
|
|
1607
1713
|
}
|
|
1714
|
+
async function fetchRwaVaults() {
|
|
1715
|
+
if (nowFresh(cache.vaults)) return cache.vaults.value;
|
|
1716
|
+
let value = [];
|
|
1717
|
+
try {
|
|
1718
|
+
const payload = await apiRequest("/rwa/vaults?status=active,coming_soon", { timeoutMs: 8e3 });
|
|
1719
|
+
const rows = Array.isArray(payload) ? payload : payload?.vaults;
|
|
1720
|
+
value = Array.isArray(rows) ? rows.filter((v) => !!v && typeof v === "object") : [];
|
|
1721
|
+
} catch {
|
|
1722
|
+
value = [];
|
|
1723
|
+
}
|
|
1724
|
+
cache.vaults = { at: Date.now(), value };
|
|
1725
|
+
return value;
|
|
1726
|
+
}
|
|
1608
1727
|
async function fetchQuote(body, retries = 1) {
|
|
1609
1728
|
let lastError;
|
|
1610
1729
|
for (let attempt = 0; attempt <= retries; attempt += 1) {
|
|
@@ -1644,7 +1763,7 @@ function createApiClient(cfg) {
|
|
|
1644
1763
|
screenInflight.set(key, request);
|
|
1645
1764
|
return request;
|
|
1646
1765
|
}
|
|
1647
|
-
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchQuote, screenWallet, apiBase };
|
|
1766
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchQuote, screenWallet, apiBase };
|
|
1648
1767
|
}
|
|
1649
1768
|
|
|
1650
1769
|
// src/core/plan.ts
|
|
@@ -1761,7 +1880,16 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1761
1880
|
}
|
|
1762
1881
|
const routeErrors = [];
|
|
1763
1882
|
const routePromises = candidates.map(
|
|
1764
|
-
(option) => buildRoute({
|
|
1883
|
+
(option) => buildRoute({
|
|
1884
|
+
option,
|
|
1885
|
+
destination,
|
|
1886
|
+
destinationToken,
|
|
1887
|
+
chains,
|
|
1888
|
+
tokens,
|
|
1889
|
+
payer,
|
|
1890
|
+
fetchQuote: api.fetchQuote,
|
|
1891
|
+
compliance: option.direct ? directCompliance ?? void 0 : void 0
|
|
1892
|
+
}).catch((error) => {
|
|
1765
1893
|
routeErrors.push(error);
|
|
1766
1894
|
return null;
|
|
1767
1895
|
})
|
|
@@ -1874,7 +2002,7 @@ async function buildSwapPlan(api, swap, payer, wallet = {}) {
|
|
|
1874
2002
|
direct: false
|
|
1875
2003
|
};
|
|
1876
2004
|
const destination = { address: receiver, chainId: v.toChainId, asset: destToken.symbol };
|
|
1877
|
-
const route = await buildRoute({ option, destination, destinationToken: destToken, chains, payer: account, fetchQuote: api.fetchQuote, solve: solveExactIn, amountInRaw });
|
|
2005
|
+
const route = await buildRoute({ option, destination, destinationToken: destToken, chains, tokens, payer: account, fetchQuote: api.fetchQuote, solve: solveExactIn, amountInRaw });
|
|
1878
2006
|
if (route.state === "SHORT") throw new Error("ZeroDelta could not price this swap right now.");
|
|
1879
2007
|
route.recommended = true;
|
|
1880
2008
|
return {
|
|
@@ -2229,6 +2357,24 @@ function resolveConfig(config = {}) {
|
|
|
2229
2357
|
}
|
|
2230
2358
|
|
|
2231
2359
|
// src/core/index.ts
|
|
2360
|
+
function sanitizeLegs(legs) {
|
|
2361
|
+
if (!Array.isArray(legs) || !legs.length) return void 0;
|
|
2362
|
+
const text = (v, max) => String(v ?? "").slice(0, max);
|
|
2363
|
+
const chain = (v) => Number(v) || 0;
|
|
2364
|
+
return legs.slice(0, 8).map((leg, i) => ({
|
|
2365
|
+
index: Number(leg?.index) || i + 1,
|
|
2366
|
+
fromAsset: text(leg?.fromAsset, 12),
|
|
2367
|
+
fromChainId: chain(leg?.fromChainId),
|
|
2368
|
+
fromChainName: text(leg?.fromChainName, 40),
|
|
2369
|
+
fromAmount: text(leg?.fromAmount, 40),
|
|
2370
|
+
toAsset: text(leg?.toAsset, 12),
|
|
2371
|
+
toChainId: chain(leg?.toChainId),
|
|
2372
|
+
toChainName: text(leg?.toChainName, 40),
|
|
2373
|
+
toAmount: text(leg?.toAmount, 40),
|
|
2374
|
+
executionChainId: chain(leg?.executionChainId),
|
|
2375
|
+
executionChainName: text(leg?.executionChainName, 40)
|
|
2376
|
+
}));
|
|
2377
|
+
}
|
|
2232
2378
|
function sanitizeTxEntry(entry) {
|
|
2233
2379
|
return {
|
|
2234
2380
|
kind: entry.kind === "swap" ? "swap" : "payment",
|
|
@@ -2244,7 +2390,8 @@ function sanitizeTxEntry(entry) {
|
|
|
2244
2390
|
recipient: isAddress(entry.recipient) ? normalizeAddress(entry.recipient) : "",
|
|
2245
2391
|
settlement: entry.settlement === "direct" ? "direct" : "escrow",
|
|
2246
2392
|
status: entry.status && ["confirmed", "unconfirmed", "error"].includes(entry.status) ? entry.status : "submitted",
|
|
2247
|
-
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2393
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2394
|
+
legs: sanitizeLegs(entry.legs)
|
|
2248
2395
|
};
|
|
2249
2396
|
}
|
|
2250
2397
|
function createEngine(config = {}) {
|
|
@@ -2261,12 +2408,15 @@ function createEngine(config = {}) {
|
|
|
2261
2408
|
fetchRouteHealth: api.fetchRouteHealth,
|
|
2262
2409
|
fetchQuote: api.fetchQuote,
|
|
2263
2410
|
fetchCatalogue: async (allowedAssets, product) => {
|
|
2264
|
-
const [chains,
|
|
2411
|
+
const [chains, registryTokens, routes, health, vaults] = await Promise.all([
|
|
2265
2412
|
api.fetchChains().catch(() => []),
|
|
2266
2413
|
api.fetchTokens().catch(() => []),
|
|
2267
2414
|
api.fetchRoutes().catch(() => []),
|
|
2268
|
-
api.fetchRouteHealth()
|
|
2415
|
+
api.fetchRouteHealth(),
|
|
2416
|
+
api.fetchRwaVaults()
|
|
2269
2417
|
]);
|
|
2418
|
+
const vaultIcons = vaultIconsBySymbol(api.apiBase, vaults);
|
|
2419
|
+
const tokens = withVaultArtwork(registryTokens, vaultIcons);
|
|
2270
2420
|
const allowed = allowedAssets?.length ? new Set([...allowedAssets].map(symbolKey).filter((a) => SUPPORTED_ASSETS.has(a))) : void 0;
|
|
2271
2421
|
return buildCatalogue({
|
|
2272
2422
|
chains,
|
|
@@ -2275,7 +2425,8 @@ function createEngine(config = {}) {
|
|
|
2275
2425
|
product,
|
|
2276
2426
|
...allowed ? { allowedAssets: allowed } : {},
|
|
2277
2427
|
supportedChainIds: SUPPORTED_CHAIN_IDS,
|
|
2278
|
-
brokenLanes: suppressedLanes(health)
|
|
2428
|
+
brokenLanes: suppressedLanes(health),
|
|
2429
|
+
vaultIcons
|
|
2279
2430
|
});
|
|
2280
2431
|
},
|
|
2281
2432
|
fetchPaymentPlan: (request, payer, wallet) => fetchPaymentPlan(api, request, payer, wallet, verifier.readBalances),
|
|
@@ -2739,7 +2890,10 @@ function useFlow(args) {
|
|
|
2739
2890
|
account,
|
|
2740
2891
|
recipient,
|
|
2741
2892
|
settlement: route.state === "DIRECT" ? "direct" : "escrow",
|
|
2742
|
-
status: v.status === "confirmed" ? "confirmed" : v.status === "mismatch" || v.status === "reverted" ? "error" : "unconfirmed"
|
|
2893
|
+
status: v.status === "confirmed" ? "confirmed" : v.status === "mismatch" || v.status === "reverted" ? "error" : "unconfirmed",
|
|
2894
|
+
// One signature can be several orders. Record them, or the history of a chained RWA trade
|
|
2895
|
+
// reads as a single hop that skipped a chain it demonstrably went through.
|
|
2896
|
+
legs: route.legs
|
|
2743
2897
|
});
|
|
2744
2898
|
setLastTxEntry(entry.hash ? entry : null);
|
|
2745
2899
|
appendTxHistory(account, entry);
|
|
@@ -2960,6 +3114,12 @@ var WIDGET_CSS = `
|
|
|
2960
3114
|
@keyframes sg-shimmer{0%{background-position:100% 0}100%{background-position:-100% 0}}
|
|
2961
3115
|
|
|
2962
3116
|
.sg-foot{margin-top:14px;display:flex;align-items:center;justify-content:center;gap:6px;font-size:11px;color:var(--sg-text-muted);text-align:center}
|
|
3117
|
+
/* display:inline-block is load-bearing, not tidiness. A host running a CSS reset \u2014 Tailwind
|
|
3118
|
+
preflight, which most integrators use and which this repo's own playground applies \u2014 sets
|
|
3119
|
+
svg{display:block}, and the padlock then takes a line of its own above the sentence. Every other
|
|
3120
|
+
glyph in the widget sits in a flex or absolute box where that is harmless; this is the one that
|
|
3121
|
+
lives in normal text flow. (WIDGET_CSS is a template literal: no backticks in these comments.) */
|
|
3122
|
+
.sg-foot svg{display:inline-block;vertical-align:-1px;margin-right:5px}
|
|
2963
3123
|
|
|
2964
3124
|
/* fixed-height variant \u2014 head/foot pinned, body scrolls */
|
|
2965
3125
|
.sg-widget[data-sg-fixed="true"]{display:flex;flex-direction:column}
|
|
@@ -2979,6 +3139,7 @@ var WIDGET_CSS = `
|
|
|
2979
3139
|
.sg-tile:disabled{cursor:default}
|
|
2980
3140
|
.sg-tile-label{font-size:12px;color:var(--sg-text-muted)}
|
|
2981
3141
|
.sg-tile-main{display:flex;align-items:center;gap:10px;min-width:0}
|
|
3142
|
+
.sg-tile-text{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
2982
3143
|
.sg-tile-sym{font-size:16px;font-weight:700;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2983
3144
|
.sg-tile-chain{font-size:11px;color:var(--sg-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2984
3145
|
.sg-tile-empty{color:var(--sg-text-muted);font-size:15px;font-weight:600}
|
|
@@ -3013,7 +3174,9 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
3013
3174
|
.sg-sel-head{display:flex;align-items:center;margin-bottom:14px}
|
|
3014
3175
|
.sg-back{width:32px;height:32px;flex:0 0 auto;border:none;border-radius:999px;background:transparent;color:var(--sg-text);cursor:pointer;font:inherit;display:flex;align-items:center;justify-content:center;transition:background 120ms ease}
|
|
3015
3176
|
.sg-back:hover{background:var(--sg-surface)}
|
|
3016
|
-
.sg-sel-title{flex:1 1 auto;text-align:center;font-size:15px;font-weight:600;margin-right:32px}
|
|
3177
|
+
.sg-sel-title{flex:1 1 auto;min-width:0;text-align:center;font-size:15px;font-weight:600;margin-right:32px}
|
|
3178
|
+
/* Whose transactions these are \u2014 history is per wallet, and the takeover hides the header's pill. */
|
|
3179
|
+
.sg-sel-sub{display:block;font-size:11px;font-weight:600;color:var(--sg-text-muted);margin-top:1px}
|
|
3017
3180
|
/* Scrolls at ~2.5 rows. The catalogue's destination chains outnumber its source chains three to one
|
|
3018
3181
|
(9 escrow chains, ~37 total), so an ungated grid was eight rows tall and pushed the token list \u2014
|
|
3019
3182
|
the thing the panel exists for \u2014 below the fold. The fade is a scroll affordance, not decoration. */
|
|
@@ -3072,6 +3235,53 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
3072
3235
|
.sg-hist{width:32px;height:32px;flex:0 0 auto;border:1px solid var(--sg-border);border-radius:999px;background:transparent;color:var(--sg-text-muted);cursor:pointer;font:inherit;display:flex;align-items:center;justify-content:center;transition:color 120ms ease,border-color 120ms ease}
|
|
3073
3236
|
.sg-hist:hover{color:var(--sg-accent);border-color:var(--sg-accent)}
|
|
3074
3237
|
|
|
3238
|
+
/* transaction history row. NOT the picker's flex row: at 390px that layout wrapped the pair onto two
|
|
3239
|
+
lines and then ellipsised the whole meta line down to "\u2026". A 3-column grid instead, where the meta
|
|
3240
|
+
spans the badge column so it always has the full card width to wrap into. */
|
|
3241
|
+
.sg-txrow{display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:11px;row-gap:3px;align-items:center;width:100%;padding:10px 8px;border:none;border-radius:var(--sg-radius-control);background:transparent;color:var(--sg-text);cursor:pointer;font:inherit;text-align:left;transition:background 120ms ease}
|
|
3242
|
+
.sg-txrow:hover{background:var(--sg-surface)}
|
|
3243
|
+
/* Both ends of the trade, side by side \u2014 the RWA gets a mark of its own. NOT overlapped: each disc
|
|
3244
|
+
carries a chain badge at its bottom-right, and an overlap parks that badge on top of its neighbour. */
|
|
3245
|
+
.sg-txrow-glyphs{grid-column:1;grid-row:1 / span 2;display:flex;align-items:center;gap:9px}
|
|
3246
|
+
/* Each side is its own nowrap span, so a narrow card breaks the line AT THE ARROW, never mid-symbol. */
|
|
3247
|
+
.sg-txrow-pair{grid-column:2;grid-row:1;display:flex;flex-wrap:wrap;align-items:baseline;gap:0 6px;font-size:14px;font-weight:700;line-height:1.35;min-width:0}
|
|
3248
|
+
.sg-txrow-side{white-space:nowrap;display:inline-flex;align-items:center;gap:5px}
|
|
3249
|
+
.sg-txrow-arrow{display:inline-flex;color:var(--sg-text-muted)}
|
|
3250
|
+
/* Meta and status share line 2. The badge sat beside the pair until it squeezed the pair onto two
|
|
3251
|
+
lines at 390px; down here the pair gets the card's full width and the badge still reads at a glance. */
|
|
3252
|
+
/* flex-start, not center: on a phone the meta wraps to two lines, and a centred badge then floats
|
|
3253
|
+
between them. Pinned to the first line it reads as the row's status rather than as a third line. */
|
|
3254
|
+
.sg-txrow-meta{grid-column:2;grid-row:2;display:flex;align-items:flex-start;gap:8px;font-size:11.5px;color:var(--sg-text-muted);line-height:1.4}
|
|
3255
|
+
.sg-txrow-when{flex:1 1 auto;min-width:0;display:flex;flex-wrap:wrap;column-gap:8px}
|
|
3256
|
+
/* The kind+chain+orders unit WRAPS; only the timestamp is unbreakable. Holding both as nowrap made
|
|
3257
|
+
the express card (the narrowest surface) overflow its text straight under the status pill. */
|
|
3258
|
+
.sg-txrow-time{white-space:nowrap}
|
|
3259
|
+
.sg-txrow-what{display:flex;flex-wrap:wrap;column-gap:5px;min-width:0}
|
|
3260
|
+
.sg-txrow-what>span{white-space:nowrap}
|
|
3261
|
+
/* The separator is the literal character, never a CSS unicode escape. WIDGET_CSS is a JS template
|
|
3262
|
+
literal, so a backslash-zero-zero escape in here is a legacy octal sequence and esbuild refuses to
|
|
3263
|
+
build the package at all \u2014 including inside a comment like this one. */
|
|
3264
|
+
.sg-txrow-what>span:not(:last-child)::after{content:"\xB7";margin-left:5px}
|
|
3265
|
+
.sg-txrow-end{flex:0 0 auto;margin-left:auto}
|
|
3266
|
+
|
|
3267
|
+
/* transaction detail: the route, one row per ORDER. A chained (RWA) trade is ONE signature and TWO
|
|
3268
|
+
orders; the numbered rail is what makes the middle hop visible instead of merely implied. */
|
|
3269
|
+
/* The pair's artwork above the anchor amount, same marks the pickers draw. */
|
|
3270
|
+
.sg-panel > .sg-txrow-glyphs{margin-bottom:10px}
|
|
3271
|
+
.sg-legs{margin-top:14px}
|
|
3272
|
+
.sg-legs-head{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:13px;margin-bottom:6px}
|
|
3273
|
+
.sg-leg-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}
|
|
3274
|
+
.sg-leg{display:flex;align-items:flex-start;gap:10px;padding:8px 0;border-bottom:1px solid var(--sg-border)}
|
|
3275
|
+
.sg-leg:last-child{border-bottom:none}
|
|
3276
|
+
/* The step number doubles as the rail: a pseudo-element joins consecutive orders, so two legs read as
|
|
3277
|
+
one continuous path rather than as two unrelated rows. */
|
|
3278
|
+
.sg-leg-n{position:relative;flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-top:1px;border-radius:999px;background:color-mix(in srgb,var(--sg-accent) 14%,transparent);color:var(--sg-accent);font-size:10px;font-weight:700;font-variant-numeric:tabular-nums}
|
|
3279
|
+
.sg-leg:not(:last-child) .sg-leg-n::after{content:"";position:absolute;top:19px;left:50%;width:1px;height:calc(100% + 6px);background:var(--sg-border)}
|
|
3280
|
+
.sg-leg-body{min-width:0;flex:1 1 auto}
|
|
3281
|
+
.sg-leg-line{display:flex;align-items:center;gap:7px;flex-wrap:wrap;font-size:13px;font-weight:600}
|
|
3282
|
+
.sg-leg-arrow{display:inline-flex;color:var(--sg-text-muted)}
|
|
3283
|
+
.sg-leg-sub{margin-top:2px;font-size:11.5px;color:var(--sg-text-muted);line-height:1.45}
|
|
3284
|
+
|
|
3075
3285
|
/* transaction detail: copyable hash row (no external links \u2014 everything stays in-widget) */
|
|
3076
3286
|
.sg-txd-hash{display:flex;align-items:center;gap:8px;margin-top:12px;font-size:13px}
|
|
3077
3287
|
.sg-txd-hash .sg-mono{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
@@ -3461,10 +3671,10 @@ function WidgetShell(props) {
|
|
|
3461
3671
|
] })
|
|
3462
3672
|
] }),
|
|
3463
3673
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-body", children: props.children }),
|
|
3464
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3674
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-foot", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3465
3675
|
/* @__PURE__ */ jsxRuntime.jsx(LockGlyph, {}),
|
|
3466
3676
|
" Your wallet signs every transaction \xB7 Powered by ZeroDelta"
|
|
3467
|
-
] })
|
|
3677
|
+
] }) })
|
|
3468
3678
|
] });
|
|
3469
3679
|
}
|
|
3470
3680
|
function shortAddress2(a) {
|
|
@@ -3960,9 +4170,15 @@ var BUNDLED_TOKEN_LOGO = {
|
|
|
3960
4170
|
function isHttpsUrl(u) {
|
|
3961
4171
|
return typeof u === "string" && /^https:\/\//i.test(u);
|
|
3962
4172
|
}
|
|
4173
|
+
function isSameOriginPath2(u) {
|
|
4174
|
+
return typeof u === "string" && u.startsWith("/") && !u.startsWith("//") && !u.startsWith("/\\");
|
|
4175
|
+
}
|
|
4176
|
+
function isDisplayableImageSrc(u) {
|
|
4177
|
+
return isHttpsUrl(u) || isSameOriginPath2(u);
|
|
4178
|
+
}
|
|
3963
4179
|
function tokenLogoCandidates(symbol, logoUrl) {
|
|
3964
4180
|
const out = [];
|
|
3965
|
-
if (
|
|
4181
|
+
if (isDisplayableImageSrc(logoUrl)) out.push(logoUrl);
|
|
3966
4182
|
const bundled = BUNDLED_TOKEN_LOGO[symbolKey(symbol)];
|
|
3967
4183
|
if (bundled && !out.includes(bundled)) out.push(bundled);
|
|
3968
4184
|
return out;
|
|
@@ -4009,7 +4225,7 @@ function TokenTile(props) {
|
|
|
4009
4225
|
const shown = props.token?.symbol ?? props.pick?.symbol ?? "";
|
|
4010
4226
|
const glyph = props.pick ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4011
4227
|
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: props.pick.symbol, logoUrl: props.token?.logoUrl, chainId: props.pick.chainId }),
|
|
4012
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", {
|
|
4228
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-tile-text", children: [
|
|
4013
4229
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children: shown }),
|
|
4014
4230
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chain", children: CHAIN_LABELS[props.pick.chainId] || `Chain ${props.pick.chainId}` })
|
|
4015
4231
|
] })
|
|
@@ -4197,6 +4413,59 @@ function HistoryButton(props) {
|
|
|
4197
4413
|
function chainLabel(entry) {
|
|
4198
4414
|
return entry.chainId != null && CHAIN_LABELS[entry.chainId] || entry.chainName || (entry.chainId != null ? `Chain ${entry.chainId}` : "Unknown chain");
|
|
4199
4415
|
}
|
|
4416
|
+
function chainName(chainId, fallback) {
|
|
4417
|
+
return CHAIN_LABELS[chainId] || fallback || (chainId ? `Chain ${chainId}` : "Unknown chain");
|
|
4418
|
+
}
|
|
4419
|
+
function legsOf(entry) {
|
|
4420
|
+
if (entry.legs?.length) return entry.legs;
|
|
4421
|
+
const leg = {
|
|
4422
|
+
index: 1,
|
|
4423
|
+
fromAsset: entry.fromAsset,
|
|
4424
|
+
fromChainId: entry.chainId ?? 0,
|
|
4425
|
+
fromChainName: entry.chainName,
|
|
4426
|
+
fromAmount: entry.payAmount,
|
|
4427
|
+
toAsset: entry.toAsset,
|
|
4428
|
+
toChainId: 0,
|
|
4429
|
+
toChainName: "",
|
|
4430
|
+
toAmount: entry.receiveAmount,
|
|
4431
|
+
executionChainId: 0,
|
|
4432
|
+
executionChainName: ""
|
|
4433
|
+
};
|
|
4434
|
+
return [leg];
|
|
4435
|
+
}
|
|
4436
|
+
function ordersLabel(count) {
|
|
4437
|
+
return count === 1 ? "1 order" : `${count} orders`;
|
|
4438
|
+
}
|
|
4439
|
+
function LegArrowGlyph() {
|
|
4440
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
4441
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 12h14" }),
|
|
4442
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m13 6 6 6-6 6" })
|
|
4443
|
+
] });
|
|
4444
|
+
}
|
|
4445
|
+
function TxLegs(props) {
|
|
4446
|
+
const multi = props.legs.length > 1;
|
|
4447
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-legs", "data-multi": multi || void 0, children: [
|
|
4448
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-legs-head", children: [
|
|
4449
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Route" }),
|
|
4450
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", children: ordersLabel(props.legs.length) })
|
|
4451
|
+
] }),
|
|
4452
|
+
/* @__PURE__ */ jsxRuntime.jsx("ol", { className: "sg-leg-list", children: props.legs.map((leg) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "sg-leg", children: [
|
|
4453
|
+
multi ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-leg-n", "aria-hidden": "true", children: leg.index }) : null,
|
|
4454
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-body", children: [
|
|
4455
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-line", children: [
|
|
4456
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-mono", children: `${leg.fromAmount ? `${leg.fromAmount} ` : ""}${leg.fromAsset || "\u2014"}` }),
|
|
4457
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-leg-arrow", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LegArrowGlyph, {}) }),
|
|
4458
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-mono", children: `${leg.toAmount ? `${leg.toAmount} ` : ""}${leg.toAsset || "\u2014"}` })
|
|
4459
|
+
] }),
|
|
4460
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-sub", children: [
|
|
4461
|
+
chainName(leg.fromChainId, leg.fromChainName),
|
|
4462
|
+
leg.toChainId ? ` \u2192 ${chainName(leg.toChainId, leg.toChainName)}` : "",
|
|
4463
|
+
leg.executionChainId && leg.executionChainId !== leg.fromChainId ? ` \xB7 filled on ${chainName(leg.executionChainId, leg.executionChainName)}` : ""
|
|
4464
|
+
] })
|
|
4465
|
+
] })
|
|
4466
|
+
] }, `${leg.index}:${leg.fromChainId}:${leg.toChainId}`)) })
|
|
4467
|
+
] });
|
|
4468
|
+
}
|
|
4200
4469
|
function statusBadge(status) {
|
|
4201
4470
|
if (status === "confirmed")
|
|
4202
4471
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Confirmed" });
|
|
@@ -4206,40 +4475,73 @@ function statusBadge(status) {
|
|
|
4206
4475
|
}
|
|
4207
4476
|
function whenLabel(at) {
|
|
4208
4477
|
const d = new Date(at);
|
|
4209
|
-
|
|
4478
|
+
if (Number.isNaN(d.getTime())) return "";
|
|
4479
|
+
const sameYear = d.getFullYear() === (/* @__PURE__ */ new Date()).getFullYear();
|
|
4480
|
+
try {
|
|
4481
|
+
return d.toLocaleString(void 0, { day: "numeric", month: "short", year: sameYear ? void 0 : "numeric", hour: "2-digit", minute: "2-digit" });
|
|
4482
|
+
} catch {
|
|
4483
|
+
return d.toLocaleString();
|
|
4484
|
+
}
|
|
4485
|
+
}
|
|
4486
|
+
function endpoints(entry) {
|
|
4487
|
+
const legs = entry.legs;
|
|
4488
|
+
return {
|
|
4489
|
+
fromChainId: entry.chainId ?? legs?.[0]?.fromChainId ?? void 0,
|
|
4490
|
+
toChainId: legs?.length ? legs[legs.length - 1].toChainId || void 0 : void 0
|
|
4491
|
+
};
|
|
4492
|
+
}
|
|
4493
|
+
function TxPairGlyphs(props) {
|
|
4494
|
+
const e = props.entry;
|
|
4495
|
+
const { fromChainId, toChainId } = endpoints(e);
|
|
4496
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-glyphs", children: [
|
|
4497
|
+
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: e.fromAsset || "?", logoUrl: logoFor(props.art, e.fromAsset, fromChainId ?? null), chainId: fromChainId, size: "sm" }),
|
|
4498
|
+
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: e.toAsset || "?", logoUrl: logoFor(props.art, e.toAsset, toChainId ?? null), chainId: toChainId, size: "sm" })
|
|
4499
|
+
] });
|
|
4210
4500
|
}
|
|
4211
|
-
function
|
|
4212
|
-
|
|
4501
|
+
function TxPair(props) {
|
|
4502
|
+
const e = props.entry;
|
|
4503
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-pair", children: [
|
|
4504
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-side sg-mono", children: `${e.payAmount} ${e.fromAsset}` }),
|
|
4505
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-side sg-mono", children: [
|
|
4506
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-arrow", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LegArrowGlyph, {}) }),
|
|
4507
|
+
`${e.receiveAmount} ${e.toAsset}`
|
|
4508
|
+
] })
|
|
4509
|
+
] });
|
|
4510
|
+
}
|
|
4511
|
+
function logoFor(art, symbol, chainId) {
|
|
4213
4512
|
const key = symbolKey(symbol);
|
|
4214
4513
|
if (!key) return void 0;
|
|
4215
|
-
const
|
|
4216
|
-
|
|
4514
|
+
const tokens = art.tokens;
|
|
4515
|
+
if (tokens?.length) {
|
|
4516
|
+
const sameChain = chainId == null ? void 0 : tokens.find((t) => Number(t.chainId) === chainId && symbolKey(t.symbol) === key);
|
|
4517
|
+
const found = (sameChain ?? tokens.find((t) => symbolKey(t.symbol) === key))?.logoUrl;
|
|
4518
|
+
if (found) return found;
|
|
4519
|
+
}
|
|
4520
|
+
return art.vaultIcons?.get(key);
|
|
4217
4521
|
}
|
|
4218
4522
|
function TxHistoryList(props) {
|
|
4219
4523
|
if (!props.entries.length) {
|
|
4220
4524
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-sel-empty", children: "No transactions yet \u2014 activity from this wallet will appear here." });
|
|
4221
4525
|
}
|
|
4222
|
-
return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "sg-toklist", "aria-label": "Transaction history", children: props.entries.map((e) =>
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
"
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
whenLabel(e.at) ? ` \xB7 ${whenLabel(e.at)}` : ""
|
|
4526
|
+
return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "sg-toklist", "aria-label": "Transaction history", children: props.entries.map((e) => (
|
|
4527
|
+
// A GRID, not the picker's flex row: the meta line spans the badge column too, so at 390px it
|
|
4528
|
+
// has the full card width to wrap into instead of being ellipsised away to "…".
|
|
4529
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-txrow", onClick: () => props.onPick(e), children: [
|
|
4530
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxPairGlyphs, { entry: e, art: props }),
|
|
4531
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxPair, { entry: e }),
|
|
4532
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-meta", children: [
|
|
4533
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-when", children: [
|
|
4534
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-what", children: [
|
|
4535
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: e.kind === "payment" ? "Payment" : "Swap" }),
|
|
4536
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: chainLabel(e) }),
|
|
4537
|
+
(e.legs?.length ?? 1) > 1 ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: ordersLabel(e.legs.length) }) : null
|
|
4538
|
+
] }),
|
|
4539
|
+
whenLabel(e.at) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-time", children: whenLabel(e.at) }) : null
|
|
4540
|
+
] }),
|
|
4541
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-end", children: statusBadge(e.status) })
|
|
4239
4542
|
] })
|
|
4240
|
-
] })
|
|
4241
|
-
|
|
4242
|
-
] }, `${e.hash}:${e.at}`)) });
|
|
4543
|
+
] }, `${e.hash}:${e.at}`)
|
|
4544
|
+
)) });
|
|
4243
4545
|
}
|
|
4244
4546
|
function TxDetail(props) {
|
|
4245
4547
|
const e = props.entry;
|
|
@@ -4262,6 +4564,7 @@ function TxDetail(props) {
|
|
|
4262
4564
|
}
|
|
4263
4565
|
};
|
|
4264
4566
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", children: [
|
|
4567
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxPairGlyphs, { entry: e, art: props }),
|
|
4265
4568
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor sg-mono", children: [
|
|
4266
4569
|
e.receiveAmount,
|
|
4267
4570
|
" ",
|
|
@@ -4271,6 +4574,7 @@ function TxDetail(props) {
|
|
|
4271
4574
|
e.kind === "payment" ? "Payment" : "Swap",
|
|
4272
4575
|
whenLabel(e.at) ? ` \xB7 ${whenLabel(e.at)}` : ""
|
|
4273
4576
|
] }),
|
|
4577
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxLegs, { legs: legsOf(e) }),
|
|
4274
4578
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta", children: [
|
|
4275
4579
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
4276
4580
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Status" }),
|
|
@@ -4285,7 +4589,7 @@ function TxDetail(props) {
|
|
|
4285
4589
|
] })
|
|
4286
4590
|
] }),
|
|
4287
4591
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
4288
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "
|
|
4592
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Signed on" }),
|
|
4289
4593
|
/* @__PURE__ */ jsxRuntime.jsx("b", { children: chainLabel(e) })
|
|
4290
4594
|
] }),
|
|
4291
4595
|
e.recipient ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
@@ -4304,14 +4608,17 @@ function TxDetail(props) {
|
|
|
4304
4608
|
] })
|
|
4305
4609
|
] });
|
|
4306
4610
|
}
|
|
4307
|
-
function displayableHistory(entries) {
|
|
4308
|
-
|
|
4611
|
+
function displayableHistory(entries, account) {
|
|
4612
|
+
const owner = typeof account === "string" ? account.toLowerCase() : "";
|
|
4613
|
+
return entries.filter((e) => e.txKind !== "approve" && (!e.account || !owner || e.account.toLowerCase() === owner));
|
|
4309
4614
|
}
|
|
4310
4615
|
function TxHistoryPanel(props) {
|
|
4311
|
-
const
|
|
4312
|
-
const
|
|
4616
|
+
const account = props.account;
|
|
4617
|
+
const entries = displayableHistory(useTxHistory(account), account);
|
|
4618
|
+
const deepLink = props.initialEntry && displayableHistory([props.initialEntry], account).length ? props.initialEntry : null;
|
|
4619
|
+
const [selected, setSelected] = react.useState(deepLink);
|
|
4313
4620
|
const backRef = react.useRef(null);
|
|
4314
|
-
react.useEffect(() => setSelected(
|
|
4621
|
+
react.useEffect(() => setSelected(deepLink), [deepLink]);
|
|
4315
4622
|
const pick = (entry) => {
|
|
4316
4623
|
setSelected(entry);
|
|
4317
4624
|
requestAnimationFrame(() => backRef.current?.focus());
|
|
@@ -4319,9 +4626,12 @@ function TxHistoryPanel(props) {
|
|
|
4319
4626
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4320
4627
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-head", children: [
|
|
4321
4628
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", autoFocus: true, ref: backRef, className: "sg-back", onClick: selected ? () => setSelected(null) : props.onBack, "aria-label": "Back", children: /* @__PURE__ */ jsxRuntime.jsx(BackGlyph2, {}) }),
|
|
4322
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4629
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-title", children: [
|
|
4630
|
+
selected ? "Transaction" : "Transaction history",
|
|
4631
|
+
account ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sel-sub sg-mono", children: shortAddress2(account) }) : null
|
|
4632
|
+
] })
|
|
4323
4633
|
] }),
|
|
4324
|
-
selected ? /* @__PURE__ */ jsxRuntime.jsx(TxDetail, { entry: selected }) : /* @__PURE__ */ jsxRuntime.jsx(TxHistoryList, { entries, tokens: props.tokens, onPick: pick })
|
|
4634
|
+
selected ? /* @__PURE__ */ jsxRuntime.jsx(TxDetail, { entry: selected, tokens: props.tokens, vaultIcons: props.vaultIcons }) : /* @__PURE__ */ jsxRuntime.jsx(TxHistoryList, { entries, tokens: props.tokens, vaultIcons: props.vaultIcons, onPick: pick })
|
|
4325
4635
|
] });
|
|
4326
4636
|
}
|
|
4327
4637
|
var IDENTITY_KEY_PREFIX = "sg:link:v1:";
|
|
@@ -4384,7 +4694,7 @@ function forgetIdentity(account) {
|
|
|
4384
4694
|
}
|
|
4385
4695
|
}
|
|
4386
4696
|
var addrEq = (a, b) => String(a || "").toLowerCase() === String(b || "").toLowerCase();
|
|
4387
|
-
var
|
|
4697
|
+
var chainName2 = (id) => id != null ? CHAIN_LABELS[id] || `Chain ${id}` : "";
|
|
4388
4698
|
var STABLES = EXECUTABLE_STABLE_ASSETS;
|
|
4389
4699
|
function BankGlyph() {
|
|
4390
4700
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4900,6 +5210,7 @@ function PaymentIsland(props) {
|
|
|
4900
5210
|
const [expanded, setExpanded] = react.useState(() => Boolean(props.defaultExpanded) || rampMode);
|
|
4901
5211
|
const [view, setView] = react.useState("main");
|
|
4902
5212
|
const [hist, setHist] = react.useState(null);
|
|
5213
|
+
const histBtnRef = react.useRef(null);
|
|
4903
5214
|
const pillRef = react.useRef(null);
|
|
4904
5215
|
const methodRowRef = react.useRef(null);
|
|
4905
5216
|
const exFromTileRef = react.useRef(null);
|
|
@@ -4907,6 +5218,7 @@ function PaymentIsland(props) {
|
|
|
4907
5218
|
const regionRef = react.useRef(null);
|
|
4908
5219
|
const panelId = react.useId();
|
|
4909
5220
|
react.useEffect(() => setView("main"), [wallet.account, payParamsKey]);
|
|
5221
|
+
react.useEffect(() => setHist(null), [wallet.account]);
|
|
4910
5222
|
const firstRender = react.useRef(true);
|
|
4911
5223
|
react.useEffect(() => {
|
|
4912
5224
|
if (firstRender.current) {
|
|
@@ -4930,7 +5242,7 @@ function PaymentIsland(props) {
|
|
|
4930
5242
|
};
|
|
4931
5243
|
const closeHistory = () => {
|
|
4932
5244
|
setHist(null);
|
|
4933
|
-
requestAnimationFrame(() => (methodRowRef.current ?? regionRef.current)?.focus());
|
|
5245
|
+
requestAnimationFrame(() => (histBtnRef.current ?? methodRowRef.current ?? regionRef.current)?.focus());
|
|
4934
5246
|
};
|
|
4935
5247
|
const pickFunding = (pick) => {
|
|
4936
5248
|
const r = visibleRoutes.find((x) => x.source.chainId === pick.chainId && symbolKey(x.source.asset) === symbolKey(pick.symbol));
|
|
@@ -4992,7 +5304,11 @@ function PaymentIsland(props) {
|
|
|
4992
5304
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-word", children: "ZeroDelta" }),
|
|
4993
5305
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "accent", children: "Link" })
|
|
4994
5306
|
] });
|
|
4995
|
-
const
|
|
5307
|
+
const linkMenu = menuItems.length ? /* @__PURE__ */ jsxRuntime.jsx(LinkMenu, { items: menuItems }) : null;
|
|
5308
|
+
const walletSlot = wallet.account || linkMenu ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head-tools", children: [
|
|
5309
|
+
wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }) : null,
|
|
5310
|
+
linkMenu
|
|
5311
|
+
] }) : void 0;
|
|
4996
5312
|
const activeStep = flow.steps.find((s) => s.state === "active");
|
|
4997
5313
|
const liveMsg = flow.status === "loading" ? isPay ? "Finding the best way to pay." : "Finding the best route." : flow.status === "submitting" ? `${activeStep?.label ?? (isPay ? "Processing your payment" : `Processing your ${verb.present.toLowerCase()}`)} \u2014 in progress.` : flow.status === "success" || flow.status === "pending" ? flow.verdict?.status === "confirmed" ? isPay ? "Payment confirmed on-chain \u2014 the merchant has been settled." : `${verb.past} \u2014 confirmed on-chain.` : isPay ? "Payment sent \u2014 confirmation is still pending." : "Submitted \u2014 confirmation is still pending." : "";
|
|
4998
5314
|
const loading = flow.status === "loading";
|
|
@@ -5026,7 +5342,7 @@ function PaymentIsland(props) {
|
|
|
5026
5342
|
] });
|
|
5027
5343
|
let body;
|
|
5028
5344
|
if (hist && wallet.account) {
|
|
5029
|
-
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
5345
|
+
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
5030
5346
|
} else if (isPay && view === "select" && wallet.account) {
|
|
5031
5347
|
body = /* @__PURE__ */ jsxRuntime.jsx(
|
|
5032
5348
|
TokenSelect,
|
|
@@ -5205,7 +5521,7 @@ function PaymentIsland(props) {
|
|
|
5205
5521
|
] }),
|
|
5206
5522
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor-sub", children: [
|
|
5207
5523
|
"on ",
|
|
5208
|
-
|
|
5524
|
+
chainName2(sel.source.chainId),
|
|
5209
5525
|
selBal ? ` \xB7 balance ${selBal.formatted}` : ""
|
|
5210
5526
|
] })
|
|
5211
5527
|
] }) : null,
|
|
@@ -5218,7 +5534,7 @@ function PaymentIsland(props) {
|
|
|
5218
5534
|
] }),
|
|
5219
5535
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor-sub", children: [
|
|
5220
5536
|
"on ",
|
|
5221
|
-
|
|
5537
|
+
chainName2(sel.source.chainId)
|
|
5222
5538
|
] })
|
|
5223
5539
|
] }) : null,
|
|
5224
5540
|
sel && !loading && !quoteError ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
|
|
@@ -5490,7 +5806,7 @@ function StableGeniePay(props) {
|
|
|
5490
5806
|
] })
|
|
5491
5807
|
] }) : void 0;
|
|
5492
5808
|
if (props.variant === "pill") return /* @__PURE__ */ jsxRuntime.jsx(PaymentIsland, { kind: "pay", ...props });
|
|
5493
|
-
return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, children: hist && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5809
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, children: hist && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5494
5810
|
TokenSelect,
|
|
5495
5811
|
{
|
|
5496
5812
|
title: "Pay with",
|
|
@@ -5663,7 +5979,7 @@ function StableGenieSwap(props) {
|
|
|
5663
5979
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-brand", children: "ZeroDelta" })
|
|
5664
5980
|
] }) : void 0;
|
|
5665
5981
|
if (hist && wallet.account) {
|
|
5666
|
-
return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory }) });
|
|
5982
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) });
|
|
5667
5983
|
}
|
|
5668
5984
|
if (flow.status === "success" || flow.status === "pending") {
|
|
5669
5985
|
return /* @__PURE__ */ jsxRuntime.jsxs(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: [
|
|
@@ -5913,7 +6229,7 @@ function StableGenieExchange(props) {
|
|
|
5913
6229
|
if (props.variant === "pill") return /* @__PURE__ */ jsxRuntime.jsx(PaymentIsland, { kind: "exchange", ...props });
|
|
5914
6230
|
let body;
|
|
5915
6231
|
if (hist && connected) {
|
|
5916
|
-
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
6232
|
+
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
5917
6233
|
} else if (view === "from" || view === "to") {
|
|
5918
6234
|
const isFrom = view === "from";
|
|
5919
6235
|
body = /* @__PURE__ */ jsxRuntime.jsx(
|