@glacislabs/stablegenie-zerodelta 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -20
- package/dist/{chunk-ABI6ZH7O.js → chunk-DXUESKNC.js} +214 -49
- package/dist/{chunk-FJQQLB2K.js → chunk-YEYFEQWS.js} +159 -11
- package/dist/core/index.cjs +161 -10
- 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 +373 -60
- 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-BFa37j1u.d.ts} +1 -1
- package/dist/{mount-mcyZAzZc.d.cts → mount-DssudKQ7.d.cts} +1 -1
- package/dist/mount.cjs +373 -60
- 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-Ce6ZtDhi.d.cts} +66 -1
- package/dist/{verify-C9vzpm4T.d.ts → verify-Ce6ZtDhi.d.ts} +66 -1
- package/package.json +1 -1
package/dist/mount.cjs
CHANGED
|
@@ -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
|
|
|
@@ -759,6 +759,34 @@ function brokenLaneReason(lane) {
|
|
|
759
759
|
}
|
|
760
760
|
}
|
|
761
761
|
|
|
762
|
+
// src/core/rwa-icons.ts
|
|
763
|
+
var GATEWAY_ICON_PREFIX = "/api/v1/rwa/icons/";
|
|
764
|
+
var ICON_FILE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}\.(?:png|jpg|jpeg|webp|gif)$/;
|
|
765
|
+
function resolveVaultIcon(apiBase, iconPath) {
|
|
766
|
+
if (typeof iconPath !== "string" || !iconPath.startsWith(GATEWAY_ICON_PREFIX)) return void 0;
|
|
767
|
+
const file = iconPath.slice(GATEWAY_ICON_PREFIX.length);
|
|
768
|
+
if (!ICON_FILE.test(file)) return void 0;
|
|
769
|
+
return `${apiBase.replace(/\/$/, "")}/rwa/icons/${file}`;
|
|
770
|
+
}
|
|
771
|
+
function vaultIconsBySymbol(apiBase, vaults) {
|
|
772
|
+
const out = /* @__PURE__ */ new Map();
|
|
773
|
+
for (const vault of vaults) {
|
|
774
|
+
const key = symbolKey(vault?.symbol);
|
|
775
|
+
if (!key || out.has(key)) continue;
|
|
776
|
+
const url = resolveVaultIcon(apiBase, vault?.iconMiniUrl) ?? resolveVaultIcon(apiBase, vault?.iconUrl);
|
|
777
|
+
if (url) out.set(key, url);
|
|
778
|
+
}
|
|
779
|
+
return out;
|
|
780
|
+
}
|
|
781
|
+
function withVaultArtwork(tokens, icons) {
|
|
782
|
+
if (!icons.size) return tokens;
|
|
783
|
+
return tokens.map((token) => {
|
|
784
|
+
if (token.logoUrl) return token;
|
|
785
|
+
const url = icons.get(symbolKey(token.symbol));
|
|
786
|
+
return url ? { ...token, logoUrl: url } : token;
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
|
|
762
790
|
// src/core/compliance.ts
|
|
763
791
|
var COMPLIANCE_DENY_LABEL = "Compliance check failed";
|
|
764
792
|
function complianceView(compliance, hasQuote = true) {
|
|
@@ -1311,7 +1339,63 @@ function routeLabelFor(option, destinationToken, result) {
|
|
|
1311
1339
|
const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
|
|
1312
1340
|
return `Swap ${option.symbol} to ${destinationToken.symbol} and settle on ZeroDelta${bridge}.`;
|
|
1313
1341
|
}
|
|
1314
|
-
|
|
1342
|
+
function tokenAt(tokens, chainId, address) {
|
|
1343
|
+
const wanted = normalizeAddress(address);
|
|
1344
|
+
if (!wanted || !tokens?.length) return void 0;
|
|
1345
|
+
return tokens.find((t) => Number(t.chainId) === Number(chainId) && normalizeAddress(t.address) === wanted);
|
|
1346
|
+
}
|
|
1347
|
+
function legAmount(raw, decimals) {
|
|
1348
|
+
if (decimals === void 0) return "";
|
|
1349
|
+
try {
|
|
1350
|
+
return formatUnits(raw || "0", decimals);
|
|
1351
|
+
} catch {
|
|
1352
|
+
return "";
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
function buildLegs(orders, ctx) {
|
|
1356
|
+
const legs = [];
|
|
1357
|
+
let fromChainId = ctx.option.chainId;
|
|
1358
|
+
let fromAsset = ctx.option.symbol;
|
|
1359
|
+
let fromDecimals = ctx.option.decimals;
|
|
1360
|
+
for (let index = 0; index < orders.length; index += 1) {
|
|
1361
|
+
const order = orders[index];
|
|
1362
|
+
const isLast = index === orders.length - 1;
|
|
1363
|
+
const toChainId = Number(order.destinationChainId);
|
|
1364
|
+
const askToken = isLast ? ctx.destinationToken : tokenAt(ctx.tokens, toChainId, order.askToken);
|
|
1365
|
+
const toAsset = isLast ? ctx.destinationToken.symbol : askToken?.symbol ?? "";
|
|
1366
|
+
const toDecimals = askToken ? assetDecimals(askToken) : void 0;
|
|
1367
|
+
const executionChainId = Number(order.executionChainId);
|
|
1368
|
+
legs.push({
|
|
1369
|
+
index: index + 1,
|
|
1370
|
+
fromAsset,
|
|
1371
|
+
fromChainId,
|
|
1372
|
+
fromChainName: chainNameOf(fromChainId, ctx.chains),
|
|
1373
|
+
fromAmount: legAmount(order.bidTokenAmount, fromDecimals),
|
|
1374
|
+
toAsset,
|
|
1375
|
+
toChainId,
|
|
1376
|
+
toChainName: chainNameOf(toChainId, ctx.chains),
|
|
1377
|
+
toAmount: legAmount(order.askTokenAmount, toDecimals),
|
|
1378
|
+
executionChainId,
|
|
1379
|
+
executionChainName: chainNameOf(executionChainId, ctx.chains)
|
|
1380
|
+
});
|
|
1381
|
+
fromChainId = toChainId;
|
|
1382
|
+
fromAsset = toAsset;
|
|
1383
|
+
fromDecimals = toDecimals;
|
|
1384
|
+
}
|
|
1385
|
+
return legs;
|
|
1386
|
+
}
|
|
1387
|
+
async function buildRoute({
|
|
1388
|
+
option,
|
|
1389
|
+
destination,
|
|
1390
|
+
destinationToken,
|
|
1391
|
+
chains,
|
|
1392
|
+
tokens,
|
|
1393
|
+
payer,
|
|
1394
|
+
fetchQuote,
|
|
1395
|
+
solve = solveExactOut,
|
|
1396
|
+
amountInRaw,
|
|
1397
|
+
compliance
|
|
1398
|
+
}) {
|
|
1315
1399
|
const result = await solve({ option, destination, destinationToken, payer, fetchQuote, amountInRaw });
|
|
1316
1400
|
const quote = result.quote;
|
|
1317
1401
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -1341,6 +1425,23 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1341
1425
|
},
|
|
1342
1426
|
routeLabel: routeLabelFor(option, destinationToken, result),
|
|
1343
1427
|
deltaLabel: routeDeltaLabel(result, quote),
|
|
1428
|
+
// A direct transfer submits no order at all, but it is still ONE hop and history renders the
|
|
1429
|
+
// same shape for it — an empty `legs` would leave "one order or two?" unanswerable for it alone.
|
|
1430
|
+
legs: [
|
|
1431
|
+
{
|
|
1432
|
+
index: 1,
|
|
1433
|
+
fromAsset: option.symbol,
|
|
1434
|
+
fromChainId: option.chainId,
|
|
1435
|
+
fromChainName: option.chainName,
|
|
1436
|
+
fromAmount: sourceAmount,
|
|
1437
|
+
toAsset: destinationToken.symbol,
|
|
1438
|
+
toChainId: Number(destination.chainId),
|
|
1439
|
+
toChainName: chainNameOf(Number(destination.chainId), chains),
|
|
1440
|
+
toAmount: receiveAmount,
|
|
1441
|
+
executionChainId: option.chainId,
|
|
1442
|
+
executionChainName: option.chainName
|
|
1443
|
+
}
|
|
1444
|
+
],
|
|
1344
1445
|
transactions: [
|
|
1345
1446
|
{
|
|
1346
1447
|
id: "transfer",
|
|
@@ -1414,6 +1515,7 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1414
1515
|
},
|
|
1415
1516
|
routeLabel: routeLabelFor(option, destinationToken, result),
|
|
1416
1517
|
deltaLabel: routeDeltaLabel(result, quote),
|
|
1518
|
+
legs: buildLegs(orders, { option, destinationToken, chains, tokens }),
|
|
1417
1519
|
transactions: [
|
|
1418
1520
|
{
|
|
1419
1521
|
id: "approve",
|
|
@@ -1521,7 +1623,8 @@ function createApiClient(cfg) {
|
|
|
1521
1623
|
chains: null,
|
|
1522
1624
|
tokens: null,
|
|
1523
1625
|
routes: null,
|
|
1524
|
-
health: null
|
|
1626
|
+
health: null,
|
|
1627
|
+
vaults: null
|
|
1525
1628
|
};
|
|
1526
1629
|
const screenCache = /* @__PURE__ */ new Map();
|
|
1527
1630
|
const screenInflight = /* @__PURE__ */ new Map();
|
|
@@ -1605,6 +1708,19 @@ function createApiClient(cfg) {
|
|
|
1605
1708
|
cache.health = { at: Date.now(), value };
|
|
1606
1709
|
return value;
|
|
1607
1710
|
}
|
|
1711
|
+
async function fetchRwaVaults() {
|
|
1712
|
+
if (nowFresh(cache.vaults)) return cache.vaults.value;
|
|
1713
|
+
let value = [];
|
|
1714
|
+
try {
|
|
1715
|
+
const payload = await apiRequest("/rwa/vaults?status=active,coming_soon", { timeoutMs: 8e3 });
|
|
1716
|
+
const rows = Array.isArray(payload) ? payload : payload?.vaults;
|
|
1717
|
+
value = Array.isArray(rows) ? rows.filter((v) => !!v && typeof v === "object") : [];
|
|
1718
|
+
} catch {
|
|
1719
|
+
value = [];
|
|
1720
|
+
}
|
|
1721
|
+
cache.vaults = { at: Date.now(), value };
|
|
1722
|
+
return value;
|
|
1723
|
+
}
|
|
1608
1724
|
async function fetchQuote(body, retries = 1) {
|
|
1609
1725
|
let lastError;
|
|
1610
1726
|
for (let attempt = 0; attempt <= retries; attempt += 1) {
|
|
@@ -1644,7 +1760,7 @@ function createApiClient(cfg) {
|
|
|
1644
1760
|
screenInflight.set(key, request);
|
|
1645
1761
|
return request;
|
|
1646
1762
|
}
|
|
1647
|
-
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchQuote, screenWallet, apiBase };
|
|
1763
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchQuote, screenWallet, apiBase };
|
|
1648
1764
|
}
|
|
1649
1765
|
|
|
1650
1766
|
// src/core/plan.ts
|
|
@@ -1761,7 +1877,16 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1761
1877
|
}
|
|
1762
1878
|
const routeErrors = [];
|
|
1763
1879
|
const routePromises = candidates.map(
|
|
1764
|
-
(option) => buildRoute({
|
|
1880
|
+
(option) => buildRoute({
|
|
1881
|
+
option,
|
|
1882
|
+
destination,
|
|
1883
|
+
destinationToken,
|
|
1884
|
+
chains,
|
|
1885
|
+
tokens,
|
|
1886
|
+
payer,
|
|
1887
|
+
fetchQuote: api.fetchQuote,
|
|
1888
|
+
compliance: option.direct ? directCompliance ?? void 0 : void 0
|
|
1889
|
+
}).catch((error) => {
|
|
1765
1890
|
routeErrors.push(error);
|
|
1766
1891
|
return null;
|
|
1767
1892
|
})
|
|
@@ -1874,7 +1999,7 @@ async function buildSwapPlan(api, swap, payer, wallet = {}) {
|
|
|
1874
1999
|
direct: false
|
|
1875
2000
|
};
|
|
1876
2001
|
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 });
|
|
2002
|
+
const route = await buildRoute({ option, destination, destinationToken: destToken, chains, tokens, payer: account, fetchQuote: api.fetchQuote, solve: solveExactIn, amountInRaw });
|
|
1878
2003
|
if (route.state === "SHORT") throw new Error("ZeroDelta could not price this swap right now.");
|
|
1879
2004
|
route.recommended = true;
|
|
1880
2005
|
return {
|
|
@@ -2229,6 +2354,24 @@ function resolveConfig(config = {}) {
|
|
|
2229
2354
|
}
|
|
2230
2355
|
|
|
2231
2356
|
// src/core/index.ts
|
|
2357
|
+
function sanitizeLegs(legs) {
|
|
2358
|
+
if (!Array.isArray(legs) || !legs.length) return void 0;
|
|
2359
|
+
const text = (v, max) => String(v ?? "").slice(0, max);
|
|
2360
|
+
const chain = (v) => Number(v) || 0;
|
|
2361
|
+
return legs.slice(0, 8).map((leg, i) => ({
|
|
2362
|
+
index: Number(leg?.index) || i + 1,
|
|
2363
|
+
fromAsset: text(leg?.fromAsset, 12),
|
|
2364
|
+
fromChainId: chain(leg?.fromChainId),
|
|
2365
|
+
fromChainName: text(leg?.fromChainName, 40),
|
|
2366
|
+
fromAmount: text(leg?.fromAmount, 40),
|
|
2367
|
+
toAsset: text(leg?.toAsset, 12),
|
|
2368
|
+
toChainId: chain(leg?.toChainId),
|
|
2369
|
+
toChainName: text(leg?.toChainName, 40),
|
|
2370
|
+
toAmount: text(leg?.toAmount, 40),
|
|
2371
|
+
executionChainId: chain(leg?.executionChainId),
|
|
2372
|
+
executionChainName: text(leg?.executionChainName, 40)
|
|
2373
|
+
}));
|
|
2374
|
+
}
|
|
2232
2375
|
function sanitizeTxEntry(entry) {
|
|
2233
2376
|
return {
|
|
2234
2377
|
kind: entry.kind === "swap" ? "swap" : "payment",
|
|
@@ -2244,7 +2387,8 @@ function sanitizeTxEntry(entry) {
|
|
|
2244
2387
|
recipient: isAddress(entry.recipient) ? normalizeAddress(entry.recipient) : "",
|
|
2245
2388
|
settlement: entry.settlement === "direct" ? "direct" : "escrow",
|
|
2246
2389
|
status: entry.status && ["confirmed", "unconfirmed", "error"].includes(entry.status) ? entry.status : "submitted",
|
|
2247
|
-
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2390
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2391
|
+
legs: sanitizeLegs(entry.legs)
|
|
2248
2392
|
};
|
|
2249
2393
|
}
|
|
2250
2394
|
function createEngine(config = {}) {
|
|
@@ -2261,12 +2405,15 @@ function createEngine(config = {}) {
|
|
|
2261
2405
|
fetchRouteHealth: api.fetchRouteHealth,
|
|
2262
2406
|
fetchQuote: api.fetchQuote,
|
|
2263
2407
|
fetchCatalogue: async (allowedAssets, product) => {
|
|
2264
|
-
const [chains,
|
|
2408
|
+
const [chains, registryTokens, routes, health, vaults] = await Promise.all([
|
|
2265
2409
|
api.fetchChains().catch(() => []),
|
|
2266
2410
|
api.fetchTokens().catch(() => []),
|
|
2267
2411
|
api.fetchRoutes().catch(() => []),
|
|
2268
|
-
api.fetchRouteHealth()
|
|
2412
|
+
api.fetchRouteHealth(),
|
|
2413
|
+
api.fetchRwaVaults()
|
|
2269
2414
|
]);
|
|
2415
|
+
const vaultIcons = vaultIconsBySymbol(api.apiBase, vaults);
|
|
2416
|
+
const tokens = withVaultArtwork(registryTokens, vaultIcons);
|
|
2270
2417
|
const allowed = allowedAssets?.length ? new Set([...allowedAssets].map(symbolKey).filter((a) => SUPPORTED_ASSETS.has(a))) : void 0;
|
|
2271
2418
|
return buildCatalogue({
|
|
2272
2419
|
chains,
|
|
@@ -2275,7 +2422,8 @@ function createEngine(config = {}) {
|
|
|
2275
2422
|
product,
|
|
2276
2423
|
...allowed ? { allowedAssets: allowed } : {},
|
|
2277
2424
|
supportedChainIds: SUPPORTED_CHAIN_IDS,
|
|
2278
|
-
brokenLanes: suppressedLanes(health)
|
|
2425
|
+
brokenLanes: suppressedLanes(health),
|
|
2426
|
+
vaultIcons
|
|
2279
2427
|
});
|
|
2280
2428
|
},
|
|
2281
2429
|
fetchPaymentPlan: (request, payer, wallet) => fetchPaymentPlan(api, request, payer, wallet, verifier.readBalances),
|
|
@@ -2739,7 +2887,10 @@ function useFlow(args) {
|
|
|
2739
2887
|
account,
|
|
2740
2888
|
recipient,
|
|
2741
2889
|
settlement: route.state === "DIRECT" ? "direct" : "escrow",
|
|
2742
|
-
status: v.status === "confirmed" ? "confirmed" : v.status === "mismatch" || v.status === "reverted" ? "error" : "unconfirmed"
|
|
2890
|
+
status: v.status === "confirmed" ? "confirmed" : v.status === "mismatch" || v.status === "reverted" ? "error" : "unconfirmed",
|
|
2891
|
+
// One signature can be several orders. Record them, or the history of a chained RWA trade
|
|
2892
|
+
// reads as a single hop that skipped a chain it demonstrably went through.
|
|
2893
|
+
legs: route.legs
|
|
2743
2894
|
});
|
|
2744
2895
|
setLastTxEntry(entry.hash ? entry : null);
|
|
2745
2896
|
appendTxHistory(account, entry);
|
|
@@ -2960,6 +3111,12 @@ var WIDGET_CSS = `
|
|
|
2960
3111
|
@keyframes sg-shimmer{0%{background-position:100% 0}100%{background-position:-100% 0}}
|
|
2961
3112
|
|
|
2962
3113
|
.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}
|
|
3114
|
+
/* display:inline-block is load-bearing, not tidiness. A host running a CSS reset \u2014 Tailwind
|
|
3115
|
+
preflight, which most integrators use and which this repo's own playground applies \u2014 sets
|
|
3116
|
+
svg{display:block}, and the padlock then takes a line of its own above the sentence. Every other
|
|
3117
|
+
glyph in the widget sits in a flex or absolute box where that is harmless; this is the one that
|
|
3118
|
+
lives in normal text flow. (WIDGET_CSS is a template literal: no backticks in these comments.) */
|
|
3119
|
+
.sg-foot svg{display:inline-block;vertical-align:-1px;margin-right:5px}
|
|
2963
3120
|
|
|
2964
3121
|
/* fixed-height variant \u2014 head/foot pinned, body scrolls */
|
|
2965
3122
|
.sg-widget[data-sg-fixed="true"]{display:flex;flex-direction:column}
|
|
@@ -2979,6 +3136,7 @@ var WIDGET_CSS = `
|
|
|
2979
3136
|
.sg-tile:disabled{cursor:default}
|
|
2980
3137
|
.sg-tile-label{font-size:12px;color:var(--sg-text-muted)}
|
|
2981
3138
|
.sg-tile-main{display:flex;align-items:center;gap:10px;min-width:0}
|
|
3139
|
+
.sg-tile-text{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
2982
3140
|
.sg-tile-sym{font-size:16px;font-weight:700;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2983
3141
|
.sg-tile-chain{font-size:11px;color:var(--sg-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2984
3142
|
.sg-tile-empty{color:var(--sg-text-muted);font-size:15px;font-weight:600}
|
|
@@ -3013,7 +3171,9 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
3013
3171
|
.sg-sel-head{display:flex;align-items:center;margin-bottom:14px}
|
|
3014
3172
|
.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
3173
|
.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}
|
|
3174
|
+
.sg-sel-title{flex:1 1 auto;min-width:0;text-align:center;font-size:15px;font-weight:600;margin-right:32px}
|
|
3175
|
+
/* Whose transactions these are \u2014 history is per wallet, and the takeover hides the header's pill. */
|
|
3176
|
+
.sg-sel-sub{display:block;font-size:11px;font-weight:600;color:var(--sg-text-muted);margin-top:1px}
|
|
3017
3177
|
/* Scrolls at ~2.5 rows. The catalogue's destination chains outnumber its source chains three to one
|
|
3018
3178
|
(9 escrow chains, ~37 total), so an ungated grid was eight rows tall and pushed the token list \u2014
|
|
3019
3179
|
the thing the panel exists for \u2014 below the fold. The fade is a scroll affordance, not decoration. */
|
|
@@ -3072,6 +3232,53 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
3072
3232
|
.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
3233
|
.sg-hist:hover{color:var(--sg-accent);border-color:var(--sg-accent)}
|
|
3074
3234
|
|
|
3235
|
+
/* transaction history row. NOT the picker's flex row: at 390px that layout wrapped the pair onto two
|
|
3236
|
+
lines and then ellipsised the whole meta line down to "\u2026". A 3-column grid instead, where the meta
|
|
3237
|
+
spans the badge column so it always has the full card width to wrap into. */
|
|
3238
|
+
.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}
|
|
3239
|
+
.sg-txrow:hover{background:var(--sg-surface)}
|
|
3240
|
+
/* Both ends of the trade, side by side \u2014 the RWA gets a mark of its own. NOT overlapped: each disc
|
|
3241
|
+
carries a chain badge at its bottom-right, and an overlap parks that badge on top of its neighbour. */
|
|
3242
|
+
.sg-txrow-glyphs{grid-column:1;grid-row:1 / span 2;display:flex;align-items:center;gap:9px}
|
|
3243
|
+
/* Each side is its own nowrap span, so a narrow card breaks the line AT THE ARROW, never mid-symbol. */
|
|
3244
|
+
.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}
|
|
3245
|
+
.sg-txrow-side{white-space:nowrap;display:inline-flex;align-items:center;gap:5px}
|
|
3246
|
+
.sg-txrow-arrow{display:inline-flex;color:var(--sg-text-muted)}
|
|
3247
|
+
/* Meta and status share line 2. The badge sat beside the pair until it squeezed the pair onto two
|
|
3248
|
+
lines at 390px; down here the pair gets the card's full width and the badge still reads at a glance. */
|
|
3249
|
+
/* flex-start, not center: on a phone the meta wraps to two lines, and a centred badge then floats
|
|
3250
|
+
between them. Pinned to the first line it reads as the row's status rather than as a third line. */
|
|
3251
|
+
.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}
|
|
3252
|
+
.sg-txrow-when{flex:1 1 auto;min-width:0;display:flex;flex-wrap:wrap;column-gap:8px}
|
|
3253
|
+
/* The kind+chain+orders unit WRAPS; only the timestamp is unbreakable. Holding both as nowrap made
|
|
3254
|
+
the express card (the narrowest surface) overflow its text straight under the status pill. */
|
|
3255
|
+
.sg-txrow-time{white-space:nowrap}
|
|
3256
|
+
.sg-txrow-what{display:flex;flex-wrap:wrap;column-gap:5px;min-width:0}
|
|
3257
|
+
.sg-txrow-what>span{white-space:nowrap}
|
|
3258
|
+
/* The separator is the literal character, never a CSS unicode escape. WIDGET_CSS is a JS template
|
|
3259
|
+
literal, so a backslash-zero-zero escape in here is a legacy octal sequence and esbuild refuses to
|
|
3260
|
+
build the package at all \u2014 including inside a comment like this one. */
|
|
3261
|
+
.sg-txrow-what>span:not(:last-child)::after{content:"\xB7";margin-left:5px}
|
|
3262
|
+
.sg-txrow-end{flex:0 0 auto;margin-left:auto}
|
|
3263
|
+
|
|
3264
|
+
/* transaction detail: the route, one row per ORDER. A chained (RWA) trade is ONE signature and TWO
|
|
3265
|
+
orders; the numbered rail is what makes the middle hop visible instead of merely implied. */
|
|
3266
|
+
/* The pair's artwork above the anchor amount, same marks the pickers draw. */
|
|
3267
|
+
.sg-panel > .sg-txrow-glyphs{margin-bottom:10px}
|
|
3268
|
+
.sg-legs{margin-top:14px}
|
|
3269
|
+
.sg-legs-head{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:13px;margin-bottom:6px}
|
|
3270
|
+
.sg-leg-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}
|
|
3271
|
+
.sg-leg{display:flex;align-items:flex-start;gap:10px;padding:8px 0;border-bottom:1px solid var(--sg-border)}
|
|
3272
|
+
.sg-leg:last-child{border-bottom:none}
|
|
3273
|
+
/* The step number doubles as the rail: a pseudo-element joins consecutive orders, so two legs read as
|
|
3274
|
+
one continuous path rather than as two unrelated rows. */
|
|
3275
|
+
.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}
|
|
3276
|
+
.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)}
|
|
3277
|
+
.sg-leg-body{min-width:0;flex:1 1 auto}
|
|
3278
|
+
.sg-leg-line{display:flex;align-items:center;gap:7px;flex-wrap:wrap;font-size:13px;font-weight:600}
|
|
3279
|
+
.sg-leg-arrow{display:inline-flex;color:var(--sg-text-muted)}
|
|
3280
|
+
.sg-leg-sub{margin-top:2px;font-size:11.5px;color:var(--sg-text-muted);line-height:1.45}
|
|
3281
|
+
|
|
3075
3282
|
/* transaction detail: copyable hash row (no external links \u2014 everything stays in-widget) */
|
|
3076
3283
|
.sg-txd-hash{display:flex;align-items:center;gap:8px;margin-top:12px;font-size:13px}
|
|
3077
3284
|
.sg-txd-hash .sg-mono{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
@@ -3461,10 +3668,10 @@ function WidgetShell(props) {
|
|
|
3461
3668
|
] })
|
|
3462
3669
|
] }),
|
|
3463
3670
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-body", children: props.children }),
|
|
3464
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3671
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-foot", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3465
3672
|
/* @__PURE__ */ jsxRuntime.jsx(LockGlyph, {}),
|
|
3466
3673
|
" Your wallet signs every transaction \xB7 Powered by ZeroDelta"
|
|
3467
|
-
] })
|
|
3674
|
+
] }) })
|
|
3468
3675
|
] });
|
|
3469
3676
|
}
|
|
3470
3677
|
function shortAddress2(a) {
|
|
@@ -3960,9 +4167,15 @@ var BUNDLED_TOKEN_LOGO = {
|
|
|
3960
4167
|
function isHttpsUrl(u) {
|
|
3961
4168
|
return typeof u === "string" && /^https:\/\//i.test(u);
|
|
3962
4169
|
}
|
|
4170
|
+
function isSameOriginPath2(u) {
|
|
4171
|
+
return typeof u === "string" && u.startsWith("/") && !u.startsWith("//") && !u.startsWith("/\\");
|
|
4172
|
+
}
|
|
4173
|
+
function isDisplayableImageSrc(u) {
|
|
4174
|
+
return isHttpsUrl(u) || isSameOriginPath2(u);
|
|
4175
|
+
}
|
|
3963
4176
|
function tokenLogoCandidates(symbol, logoUrl) {
|
|
3964
4177
|
const out = [];
|
|
3965
|
-
if (
|
|
4178
|
+
if (isDisplayableImageSrc(logoUrl)) out.push(logoUrl);
|
|
3966
4179
|
const bundled = BUNDLED_TOKEN_LOGO[symbolKey(symbol)];
|
|
3967
4180
|
if (bundled && !out.includes(bundled)) out.push(bundled);
|
|
3968
4181
|
return out;
|
|
@@ -4009,7 +4222,7 @@ function TokenTile(props) {
|
|
|
4009
4222
|
const shown = props.token?.symbol ?? props.pick?.symbol ?? "";
|
|
4010
4223
|
const glyph = props.pick ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4011
4224
|
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: props.pick.symbol, logoUrl: props.token?.logoUrl, chainId: props.pick.chainId }),
|
|
4012
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", {
|
|
4225
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-tile-text", children: [
|
|
4013
4226
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children: shown }),
|
|
4014
4227
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chain", children: CHAIN_LABELS[props.pick.chainId] || `Chain ${props.pick.chainId}` })
|
|
4015
4228
|
] })
|
|
@@ -4197,6 +4410,59 @@ function HistoryButton(props) {
|
|
|
4197
4410
|
function chainLabel(entry) {
|
|
4198
4411
|
return entry.chainId != null && CHAIN_LABELS[entry.chainId] || entry.chainName || (entry.chainId != null ? `Chain ${entry.chainId}` : "Unknown chain");
|
|
4199
4412
|
}
|
|
4413
|
+
function chainName(chainId, fallback) {
|
|
4414
|
+
return CHAIN_LABELS[chainId] || fallback || (chainId ? `Chain ${chainId}` : "Unknown chain");
|
|
4415
|
+
}
|
|
4416
|
+
function legsOf(entry) {
|
|
4417
|
+
if (entry.legs?.length) return entry.legs;
|
|
4418
|
+
const leg = {
|
|
4419
|
+
index: 1,
|
|
4420
|
+
fromAsset: entry.fromAsset,
|
|
4421
|
+
fromChainId: entry.chainId ?? 0,
|
|
4422
|
+
fromChainName: entry.chainName,
|
|
4423
|
+
fromAmount: entry.payAmount,
|
|
4424
|
+
toAsset: entry.toAsset,
|
|
4425
|
+
toChainId: 0,
|
|
4426
|
+
toChainName: "",
|
|
4427
|
+
toAmount: entry.receiveAmount,
|
|
4428
|
+
executionChainId: 0,
|
|
4429
|
+
executionChainName: ""
|
|
4430
|
+
};
|
|
4431
|
+
return [leg];
|
|
4432
|
+
}
|
|
4433
|
+
function ordersLabel(count) {
|
|
4434
|
+
return count === 1 ? "1 order" : `${count} orders`;
|
|
4435
|
+
}
|
|
4436
|
+
function LegArrowGlyph() {
|
|
4437
|
+
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: [
|
|
4438
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 12h14" }),
|
|
4439
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m13 6 6 6-6 6" })
|
|
4440
|
+
] });
|
|
4441
|
+
}
|
|
4442
|
+
function TxLegs(props) {
|
|
4443
|
+
const multi = props.legs.length > 1;
|
|
4444
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-legs", "data-multi": multi || void 0, children: [
|
|
4445
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-legs-head", children: [
|
|
4446
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Route" }),
|
|
4447
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", children: ordersLabel(props.legs.length) })
|
|
4448
|
+
] }),
|
|
4449
|
+
/* @__PURE__ */ jsxRuntime.jsx("ol", { className: "sg-leg-list", children: props.legs.map((leg) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "sg-leg", children: [
|
|
4450
|
+
multi ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-leg-n", "aria-hidden": "true", children: leg.index }) : null,
|
|
4451
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-body", children: [
|
|
4452
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-line", children: [
|
|
4453
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-mono", children: `${leg.fromAmount ? `${leg.fromAmount} ` : ""}${leg.fromAsset || "\u2014"}` }),
|
|
4454
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-leg-arrow", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LegArrowGlyph, {}) }),
|
|
4455
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-mono", children: `${leg.toAmount ? `${leg.toAmount} ` : ""}${leg.toAsset || "\u2014"}` })
|
|
4456
|
+
] }),
|
|
4457
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-sub", children: [
|
|
4458
|
+
chainName(leg.fromChainId, leg.fromChainName),
|
|
4459
|
+
leg.toChainId ? ` \u2192 ${chainName(leg.toChainId, leg.toChainName)}` : "",
|
|
4460
|
+
leg.executionChainId && leg.executionChainId !== leg.fromChainId ? ` \xB7 filled on ${chainName(leg.executionChainId, leg.executionChainName)}` : ""
|
|
4461
|
+
] })
|
|
4462
|
+
] })
|
|
4463
|
+
] }, `${leg.index}:${leg.fromChainId}:${leg.toChainId}`)) })
|
|
4464
|
+
] });
|
|
4465
|
+
}
|
|
4200
4466
|
function statusBadge(status) {
|
|
4201
4467
|
if (status === "confirmed")
|
|
4202
4468
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Confirmed" });
|
|
@@ -4206,40 +4472,73 @@ function statusBadge(status) {
|
|
|
4206
4472
|
}
|
|
4207
4473
|
function whenLabel(at) {
|
|
4208
4474
|
const d = new Date(at);
|
|
4209
|
-
|
|
4475
|
+
if (Number.isNaN(d.getTime())) return "";
|
|
4476
|
+
const sameYear = d.getFullYear() === (/* @__PURE__ */ new Date()).getFullYear();
|
|
4477
|
+
try {
|
|
4478
|
+
return d.toLocaleString(void 0, { day: "numeric", month: "short", year: sameYear ? void 0 : "numeric", hour: "2-digit", minute: "2-digit" });
|
|
4479
|
+
} catch {
|
|
4480
|
+
return d.toLocaleString();
|
|
4481
|
+
}
|
|
4482
|
+
}
|
|
4483
|
+
function endpoints(entry) {
|
|
4484
|
+
const legs = entry.legs;
|
|
4485
|
+
return {
|
|
4486
|
+
fromChainId: entry.chainId ?? legs?.[0]?.fromChainId ?? void 0,
|
|
4487
|
+
toChainId: legs?.length ? legs[legs.length - 1].toChainId || void 0 : void 0
|
|
4488
|
+
};
|
|
4489
|
+
}
|
|
4490
|
+
function TxPairGlyphs(props) {
|
|
4491
|
+
const e = props.entry;
|
|
4492
|
+
const { fromChainId, toChainId } = endpoints(e);
|
|
4493
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-glyphs", children: [
|
|
4494
|
+
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: e.fromAsset || "?", logoUrl: logoFor(props.art, e.fromAsset, fromChainId ?? null), chainId: fromChainId, size: "sm" }),
|
|
4495
|
+
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: e.toAsset || "?", logoUrl: logoFor(props.art, e.toAsset, toChainId ?? null), chainId: toChainId, size: "sm" })
|
|
4496
|
+
] });
|
|
4210
4497
|
}
|
|
4211
|
-
function
|
|
4212
|
-
|
|
4498
|
+
function TxPair(props) {
|
|
4499
|
+
const e = props.entry;
|
|
4500
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-pair", children: [
|
|
4501
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-side sg-mono", children: `${e.payAmount} ${e.fromAsset}` }),
|
|
4502
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-side sg-mono", children: [
|
|
4503
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-arrow", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LegArrowGlyph, {}) }),
|
|
4504
|
+
`${e.receiveAmount} ${e.toAsset}`
|
|
4505
|
+
] })
|
|
4506
|
+
] });
|
|
4507
|
+
}
|
|
4508
|
+
function logoFor(art, symbol, chainId) {
|
|
4213
4509
|
const key = symbolKey(symbol);
|
|
4214
4510
|
if (!key) return void 0;
|
|
4215
|
-
const
|
|
4216
|
-
|
|
4511
|
+
const tokens = art.tokens;
|
|
4512
|
+
if (tokens?.length) {
|
|
4513
|
+
const sameChain = chainId == null ? void 0 : tokens.find((t) => Number(t.chainId) === chainId && symbolKey(t.symbol) === key);
|
|
4514
|
+
const found = (sameChain ?? tokens.find((t) => symbolKey(t.symbol) === key))?.logoUrl;
|
|
4515
|
+
if (found) return found;
|
|
4516
|
+
}
|
|
4517
|
+
return art.vaultIcons?.get(key);
|
|
4217
4518
|
}
|
|
4218
4519
|
function TxHistoryList(props) {
|
|
4219
4520
|
if (!props.entries.length) {
|
|
4220
4521
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-sel-empty", children: "No transactions yet \u2014 activity from this wallet will appear here." });
|
|
4221
4522
|
}
|
|
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)}` : ""
|
|
4523
|
+
return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "sg-toklist", "aria-label": "Transaction history", children: props.entries.map((e) => (
|
|
4524
|
+
// A GRID, not the picker's flex row: the meta line spans the badge column too, so at 390px it
|
|
4525
|
+
// has the full card width to wrap into instead of being ellipsised away to "…".
|
|
4526
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-txrow", onClick: () => props.onPick(e), children: [
|
|
4527
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxPairGlyphs, { entry: e, art: props }),
|
|
4528
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxPair, { entry: e }),
|
|
4529
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-meta", children: [
|
|
4530
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-when", children: [
|
|
4531
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-what", children: [
|
|
4532
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: e.kind === "payment" ? "Payment" : "Swap" }),
|
|
4533
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: chainLabel(e) }),
|
|
4534
|
+
(e.legs?.length ?? 1) > 1 ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: ordersLabel(e.legs.length) }) : null
|
|
4535
|
+
] }),
|
|
4536
|
+
whenLabel(e.at) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-time", children: whenLabel(e.at) }) : null
|
|
4537
|
+
] }),
|
|
4538
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-end", children: statusBadge(e.status) })
|
|
4239
4539
|
] })
|
|
4240
|
-
] })
|
|
4241
|
-
|
|
4242
|
-
] }, `${e.hash}:${e.at}`)) });
|
|
4540
|
+
] }, `${e.hash}:${e.at}`)
|
|
4541
|
+
)) });
|
|
4243
4542
|
}
|
|
4244
4543
|
function TxDetail(props) {
|
|
4245
4544
|
const e = props.entry;
|
|
@@ -4262,6 +4561,7 @@ function TxDetail(props) {
|
|
|
4262
4561
|
}
|
|
4263
4562
|
};
|
|
4264
4563
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", children: [
|
|
4564
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxPairGlyphs, { entry: e, art: props }),
|
|
4265
4565
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor sg-mono", children: [
|
|
4266
4566
|
e.receiveAmount,
|
|
4267
4567
|
" ",
|
|
@@ -4271,6 +4571,7 @@ function TxDetail(props) {
|
|
|
4271
4571
|
e.kind === "payment" ? "Payment" : "Swap",
|
|
4272
4572
|
whenLabel(e.at) ? ` \xB7 ${whenLabel(e.at)}` : ""
|
|
4273
4573
|
] }),
|
|
4574
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxLegs, { legs: legsOf(e) }),
|
|
4274
4575
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta", children: [
|
|
4275
4576
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
4276
4577
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Status" }),
|
|
@@ -4285,7 +4586,7 @@ function TxDetail(props) {
|
|
|
4285
4586
|
] })
|
|
4286
4587
|
] }),
|
|
4287
4588
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
4288
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "
|
|
4589
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Signed on" }),
|
|
4289
4590
|
/* @__PURE__ */ jsxRuntime.jsx("b", { children: chainLabel(e) })
|
|
4290
4591
|
] }),
|
|
4291
4592
|
e.recipient ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
@@ -4304,14 +4605,17 @@ function TxDetail(props) {
|
|
|
4304
4605
|
] })
|
|
4305
4606
|
] });
|
|
4306
4607
|
}
|
|
4307
|
-
function displayableHistory(entries) {
|
|
4308
|
-
|
|
4608
|
+
function displayableHistory(entries, account) {
|
|
4609
|
+
const owner = typeof account === "string" ? account.toLowerCase() : "";
|
|
4610
|
+
return entries.filter((e) => e.txKind !== "approve" && (!e.account || !owner || e.account.toLowerCase() === owner));
|
|
4309
4611
|
}
|
|
4310
4612
|
function TxHistoryPanel(props) {
|
|
4311
|
-
const
|
|
4312
|
-
const
|
|
4613
|
+
const account = props.account;
|
|
4614
|
+
const entries = displayableHistory(useTxHistory(account), account);
|
|
4615
|
+
const deepLink = props.initialEntry && displayableHistory([props.initialEntry], account).length ? props.initialEntry : null;
|
|
4616
|
+
const [selected, setSelected] = react.useState(deepLink);
|
|
4313
4617
|
const backRef = react.useRef(null);
|
|
4314
|
-
react.useEffect(() => setSelected(
|
|
4618
|
+
react.useEffect(() => setSelected(deepLink), [deepLink]);
|
|
4315
4619
|
const pick = (entry) => {
|
|
4316
4620
|
setSelected(entry);
|
|
4317
4621
|
requestAnimationFrame(() => backRef.current?.focus());
|
|
@@ -4319,9 +4623,12 @@ function TxHistoryPanel(props) {
|
|
|
4319
4623
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4320
4624
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-head", children: [
|
|
4321
4625
|
/* @__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.
|
|
4626
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-title", children: [
|
|
4627
|
+
selected ? "Transaction" : "Transaction history",
|
|
4628
|
+
account ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sel-sub sg-mono", children: shortAddress2(account) }) : null
|
|
4629
|
+
] })
|
|
4323
4630
|
] }),
|
|
4324
|
-
selected ? /* @__PURE__ */ jsxRuntime.jsx(TxDetail, { entry: selected }) : /* @__PURE__ */ jsxRuntime.jsx(TxHistoryList, { entries, tokens: props.tokens, onPick: pick })
|
|
4631
|
+
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
4632
|
] });
|
|
4326
4633
|
}
|
|
4327
4634
|
var IDENTITY_KEY_PREFIX = "sg:link:v1:";
|
|
@@ -4384,7 +4691,7 @@ function forgetIdentity(account) {
|
|
|
4384
4691
|
}
|
|
4385
4692
|
}
|
|
4386
4693
|
var addrEq = (a, b) => String(a || "").toLowerCase() === String(b || "").toLowerCase();
|
|
4387
|
-
var
|
|
4694
|
+
var chainName2 = (id) => id != null ? CHAIN_LABELS[id] || `Chain ${id}` : "";
|
|
4388
4695
|
var STABLES = EXECUTABLE_STABLE_ASSETS;
|
|
4389
4696
|
function BankGlyph() {
|
|
4390
4697
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4900,6 +5207,7 @@ function PaymentIsland(props) {
|
|
|
4900
5207
|
const [expanded, setExpanded] = react.useState(() => Boolean(props.defaultExpanded) || rampMode);
|
|
4901
5208
|
const [view, setView] = react.useState("main");
|
|
4902
5209
|
const [hist, setHist] = react.useState(null);
|
|
5210
|
+
const histBtnRef = react.useRef(null);
|
|
4903
5211
|
const pillRef = react.useRef(null);
|
|
4904
5212
|
const methodRowRef = react.useRef(null);
|
|
4905
5213
|
const exFromTileRef = react.useRef(null);
|
|
@@ -4907,6 +5215,7 @@ function PaymentIsland(props) {
|
|
|
4907
5215
|
const regionRef = react.useRef(null);
|
|
4908
5216
|
const panelId = react.useId();
|
|
4909
5217
|
react.useEffect(() => setView("main"), [wallet.account, payParamsKey]);
|
|
5218
|
+
react.useEffect(() => setHist(null), [wallet.account]);
|
|
4910
5219
|
const firstRender = react.useRef(true);
|
|
4911
5220
|
react.useEffect(() => {
|
|
4912
5221
|
if (firstRender.current) {
|
|
@@ -4930,7 +5239,7 @@ function PaymentIsland(props) {
|
|
|
4930
5239
|
};
|
|
4931
5240
|
const closeHistory = () => {
|
|
4932
5241
|
setHist(null);
|
|
4933
|
-
requestAnimationFrame(() => (methodRowRef.current ?? regionRef.current)?.focus());
|
|
5242
|
+
requestAnimationFrame(() => (histBtnRef.current ?? methodRowRef.current ?? regionRef.current)?.focus());
|
|
4934
5243
|
};
|
|
4935
5244
|
const pickFunding = (pick) => {
|
|
4936
5245
|
const r = visibleRoutes.find((x) => x.source.chainId === pick.chainId && symbolKey(x.source.asset) === symbolKey(pick.symbol));
|
|
@@ -4992,7 +5301,11 @@ function PaymentIsland(props) {
|
|
|
4992
5301
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-word", children: "ZeroDelta" }),
|
|
4993
5302
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "accent", children: "Link" })
|
|
4994
5303
|
] });
|
|
4995
|
-
const
|
|
5304
|
+
const linkMenu = menuItems.length ? /* @__PURE__ */ jsxRuntime.jsx(LinkMenu, { items: menuItems }) : null;
|
|
5305
|
+
const walletSlot = wallet.account || linkMenu ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head-tools", children: [
|
|
5306
|
+
wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }) : null,
|
|
5307
|
+
linkMenu
|
|
5308
|
+
] }) : void 0;
|
|
4996
5309
|
const activeStep = flow.steps.find((s) => s.state === "active");
|
|
4997
5310
|
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
5311
|
const loading = flow.status === "loading";
|
|
@@ -5026,7 +5339,7 @@ function PaymentIsland(props) {
|
|
|
5026
5339
|
] });
|
|
5027
5340
|
let body;
|
|
5028
5341
|
if (hist && wallet.account) {
|
|
5029
|
-
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
5342
|
+
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
5030
5343
|
} else if (isPay && view === "select" && wallet.account) {
|
|
5031
5344
|
body = /* @__PURE__ */ jsxRuntime.jsx(
|
|
5032
5345
|
TokenSelect,
|
|
@@ -5205,7 +5518,7 @@ function PaymentIsland(props) {
|
|
|
5205
5518
|
] }),
|
|
5206
5519
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor-sub", children: [
|
|
5207
5520
|
"on ",
|
|
5208
|
-
|
|
5521
|
+
chainName2(sel.source.chainId),
|
|
5209
5522
|
selBal ? ` \xB7 balance ${selBal.formatted}` : ""
|
|
5210
5523
|
] })
|
|
5211
5524
|
] }) : null,
|
|
@@ -5218,7 +5531,7 @@ function PaymentIsland(props) {
|
|
|
5218
5531
|
] }),
|
|
5219
5532
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor-sub", children: [
|
|
5220
5533
|
"on ",
|
|
5221
|
-
|
|
5534
|
+
chainName2(sel.source.chainId)
|
|
5222
5535
|
] })
|
|
5223
5536
|
] }) : null,
|
|
5224
5537
|
sel && !loading && !quoteError ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
|
|
@@ -5490,7 +5803,7 @@ function StableGeniePay(props) {
|
|
|
5490
5803
|
] })
|
|
5491
5804
|
] }) : void 0;
|
|
5492
5805
|
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(
|
|
5806
|
+
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
5807
|
TokenSelect,
|
|
5495
5808
|
{
|
|
5496
5809
|
title: "Pay with",
|
|
@@ -5663,7 +5976,7 @@ function StableGenieSwap(props) {
|
|
|
5663
5976
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-brand", children: "ZeroDelta" })
|
|
5664
5977
|
] }) : void 0;
|
|
5665
5978
|
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 }) });
|
|
5979
|
+
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
5980
|
}
|
|
5668
5981
|
if (flow.status === "success" || flow.status === "pending") {
|
|
5669
5982
|
return /* @__PURE__ */ jsxRuntime.jsxs(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: [
|
|
@@ -5913,7 +6226,7 @@ function StableGenieExchange(props) {
|
|
|
5913
6226
|
if (props.variant === "pill") return /* @__PURE__ */ jsxRuntime.jsx(PaymentIsland, { kind: "exchange", ...props });
|
|
5914
6227
|
let body;
|
|
5915
6228
|
if (hist && connected) {
|
|
5916
|
-
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
6229
|
+
body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
5917
6230
|
} else if (view === "from" || view === "to") {
|
|
5918
6231
|
const isFrom = view === "from";
|
|
5919
6232
|
body = /* @__PURE__ */ jsxRuntime.jsx(
|