@latchprotocol/widgets 0.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/LICENSE +21 -0
- package/README.md +649 -0
- package/dist/adapters/binDistribution.d.ts +19 -0
- package/dist/adapters/binDistribution.d.ts.map +1 -0
- package/dist/adapters/protocol.d.ts +409 -0
- package/dist/adapters/protocol.d.ts.map +1 -0
- package/dist/adapters/sale.d.ts +142 -0
- package/dist/adapters/sale.d.ts.map +1 -0
- package/dist/adapters/viem.d.ts +89 -0
- package/dist/adapters/viem.d.ts.map +1 -0
- package/dist/callpath/constants.d.ts +218 -0
- package/dist/callpath/constants.d.ts.map +1 -0
- package/dist/callpath/launch.d.ts +1979 -0
- package/dist/callpath/launch.d.ts.map +1 -0
- package/dist/callpath/liquidity.d.ts +103 -0
- package/dist/callpath/liquidity.d.ts.map +1 -0
- package/dist/callpath/plan.d.ts +34 -0
- package/dist/callpath/plan.d.ts.map +1 -0
- package/dist/callpath/swap.d.ts +129 -0
- package/dist/callpath/swap.d.ts.map +1 -0
- package/dist/chunks/SwapWidget-DgyHAVc8.js +2404 -0
- package/dist/chunks/SwapWidget-DgyHAVc8.js.map +1 -0
- package/dist/chunks/scan-Dhu7f4Nl.js +2497 -0
- package/dist/chunks/scan-Dhu7f4Nl.js.map +1 -0
- package/dist/chunks/useLocker-D1c_NTk-.js +1613 -0
- package/dist/chunks/useLocker-D1c_NTk-.js.map +1 -0
- package/dist/components/LaunchWidget.d.ts +117 -0
- package/dist/components/LaunchWidget.d.ts.map +1 -0
- package/dist/components/LiquidityWidget.d.ts +33 -0
- package/dist/components/LiquidityWidget.d.ts.map +1 -0
- package/dist/components/LockerWidget.d.ts +51 -0
- package/dist/components/LockerWidget.d.ts.map +1 -0
- package/dist/components/LocksWidgets.d.ts +61 -0
- package/dist/components/LocksWidgets.d.ts.map +1 -0
- package/dist/components/SwapWidget.d.ts +165 -0
- package/dist/components/SwapWidget.d.ts.map +1 -0
- package/dist/components/TokenTrustPanel.d.ts +32 -0
- package/dist/components/TokenTrustPanel.d.ts.map +1 -0
- package/dist/components/lockCharts.d.ts +29 -0
- package/dist/components/lockCharts.d.ts.map +1 -0
- package/dist/components/portal.d.ts +10 -0
- package/dist/components/portal.d.ts.map +1 -0
- package/dist/components/primitives.d.ts +139 -0
- package/dist/components/primitives.d.ts.map +1 -0
- package/dist/components/swap/SwapSettings.d.ts +12 -0
- package/dist/components/swap/SwapSettings.d.ts.map +1 -0
- package/dist/components/swap/TokenSelect.d.ts +61 -0
- package/dist/components/swap/TokenSelect.d.ts.map +1 -0
- package/dist/components/swap/state.d.ts +208 -0
- package/dist/components/swap/state.d.ts.map +1 -0
- package/dist/config/chain.d.ts +163 -0
- package/dist/config/chain.d.ts.map +1 -0
- package/dist/config/integrator.d.ts +121 -0
- package/dist/config/integrator.d.ts.map +1 -0
- package/dist/context/WidgetProvider.d.ts +78 -0
- package/dist/context/WidgetProvider.d.ts.map +1 -0
- package/dist/core/clMath.d.ts +98 -0
- package/dist/core/clMath.d.ts.map +1 -0
- package/dist/core/errors.d.ts +18 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/format.d.ts +47 -0
- package/dist/core/format.d.ts.map +1 -0
- package/dist/core/liquidityGuards.d.ts +53 -0
- package/dist/core/liquidityGuards.d.ts.map +1 -0
- package/dist/core/liquidityRefresh.d.ts +35 -0
- package/dist/core/liquidityRefresh.d.ts.map +1 -0
- package/dist/core/math.d.ts +129 -0
- package/dist/core/math.d.ts.map +1 -0
- package/dist/core/pool.d.ts +33 -0
- package/dist/core/pool.d.ts.map +1 -0
- package/dist/core/tokenLists.d.ts +46 -0
- package/dist/core/tokenLists.d.ts.map +1 -0
- package/dist/embed/iframe.d.ts +185 -0
- package/dist/embed/iframe.d.ts.map +1 -0
- package/dist/embed/lockBadge.d.ts +55 -0
- package/dist/embed/lockBadge.d.ts.map +1 -0
- package/dist/embed/webComponent.d.ts +83 -0
- package/dist/embed/webComponent.d.ts.map +1 -0
- package/dist/embed.d.ts +25 -0
- package/dist/embed.d.ts.map +1 -0
- package/dist/embed.js +543 -0
- package/dist/embed.js.map +1 -0
- package/dist/headless.d.ts +60 -0
- package/dist/headless.d.ts.map +1 -0
- package/dist/headless.js +223 -0
- package/dist/headless.js.map +1 -0
- package/dist/hooks/useAsyncResource.d.ts +38 -0
- package/dist/hooks/useAsyncResource.d.ts.map +1 -0
- package/dist/hooks/useLaunch.d.ts +140 -0
- package/dist/hooks/useLaunch.d.ts.map +1 -0
- package/dist/hooks/useLiquidity.d.ts +91 -0
- package/dist/hooks/useLiquidity.d.ts.map +1 -0
- package/dist/hooks/useLocker.d.ts +77 -0
- package/dist/hooks/useLocker.d.ts.map +1 -0
- package/dist/hooks/useLocks.d.ts +33 -0
- package/dist/hooks/useLocks.d.ts.map +1 -0
- package/dist/hooks/useSwapExecute.d.ts +46 -0
- package/dist/hooks/useSwapExecute.d.ts.map +1 -0
- package/dist/hooks/useSwapQuote.d.ts +51 -0
- package/dist/hooks/useSwapQuote.d.ts.map +1 -0
- package/dist/hooks/useTokenLists.d.ts +26 -0
- package/dist/hooks/useTokenLists.d.ts.map +1 -0
- package/dist/hooks/useTokenTrust.d.ts +40 -0
- package/dist/hooks/useTokenTrust.d.ts.map +1 -0
- package/dist/hooks/useTokens.d.ts +15 -0
- package/dist/hooks/useTokens.d.ts.map +1 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1052 -0
- package/dist/index.js.map +1 -0
- package/dist/latch-embed.d.ts +19 -0
- package/dist/latch-embed.d.ts.map +1 -0
- package/dist/latch-embed.js +950 -0
- package/dist/latch-embed.js.map +1 -0
- package/dist/latch-embed.mjs +13162 -0
- package/dist/latch-embed.mjs.map +1 -0
- package/dist/locker/model.d.ts +73 -0
- package/dist/locker/model.d.ts.map +1 -0
- package/dist/locks/embedModel.d.ts +22 -0
- package/dist/locks/embedModel.d.ts.map +1 -0
- package/dist/locks/fetch.d.ts +60 -0
- package/dist/locks/fetch.d.ts.map +1 -0
- package/dist/locks/model.d.ts +143 -0
- package/dist/locks/model.d.ts.map +1 -0
- package/dist/locks/scan.d.ts +25 -0
- package/dist/locks/scan.d.ts.map +1 -0
- package/dist/styles/css.d.ts +32 -0
- package/dist/styles/css.d.ts.map +1 -0
- package/dist/styles.css +895 -0
- package/dist/trust/model.d.ts +48 -0
- package/dist/trust/model.d.ts.map +1 -0
- package/package.json +102 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1052 @@
|
|
|
1
|
+
import { ay as R, aD as w, ax as I, av as j, bi as _e, bL as te, bw as Re, V as $e, b7 as Ue, bv as Me, Y as Oe, ba as Fe, bx as qe, aV as De, br as Z, v as We, bZ as Y, T as Ve, bF as le } from "./chunks/scan-Dhu7f4Nl.js";
|
|
2
|
+
import { A as Da, a as Wa, b as Va, B as Ga, c as Ha, d as Ka, C as ja, e as Xa, f as Qa, D as za, g as Za, E as Ya, H as Ja, I as et, i as at, L as tt, M as lt, j as nt, k as st, l as ct, m as ot, n as rt, o as it, p as dt, N as ut, q as ht, r as mt, O as kt, P as _t, s as ft, t as bt, u as pt, Q as gt, S as Nt, U as yt, w as vt, W as Lt, x as wt, y as Tt, Z as At, z as It, F as St, G as Ct, J as Pt, K as xt, R as Et, X as Bt, _ as Rt, $ as $t, a0 as Ut, a1 as Mt, a2 as Ot, a3 as Ft, a4 as qt, a5 as Dt, a6 as Wt, a8 as Vt, a9 as Gt, aa as Ht, ab as Kt, ac as jt, ad as Xt, ae as Qt, af as zt, ag as Zt, ah as Yt, aj as Jt, ak as el, al, am as tl, an as ll, ao as nl, ap as sl, ar as cl, as as ol, at as rl, au as il, aw as dl, az as ul, aA as hl, aB as ml, aC as kl, aE as _l, aF as fl, aG as bl, aH as pl, aI as gl, aJ as Nl, aK as yl, aL as vl, aM as Ll, aN as wl, aO as Tl, aP as Al, aR as Il, aS as Sl, aT as Cl, aU as Pl, aW as xl, aX as El, aY as Bl, aZ as Rl, a_ as $l, a$ as Ul, b0 as Ml, b1 as Ol, b2 as Fl, b3 as ql, b4 as Dl, b5 as Wl, b6 as Vl, b8 as Gl, b9 as Hl, bb as Kl, bc as jl, bd as Xl, be as Ql, bf as zl, bg as Zl, bj as Yl, bk as Jl, bl as en, bm as an, bn as tn, bo as ln, bp as nn, bq as sn, bs as cn, bt as on, bu as rn, by as dn, bz as un, bA as hn, bB as mn, bC as kn, bD as _n, bE as fn, bG as bn, bH as pn, bI as gn, bJ as Nn, bK as yn, bM as vn, bN as Ln, bO as wn, bP as Tn, bQ as An, bR as In, bS as Sn, bT as Cn, bU as Pn, bV as xn, bW as En, bX as Bn, bY as Rn } from "./chunks/scan-Dhu7f4Nl.js";
|
|
3
|
+
import { v as fe, B as Ge, C as He, D as Ke, u as je, z as Xe, w as Qe, x as ze, m as H, t as K, y as ne, n as Ze, k as Ye, l as Je, p as ue, o as ea, A as aa, q as ta, P as he, r as la, T as me, j as na } from "./chunks/useLocker-D1c_NTk-.js";
|
|
4
|
+
import { N as Un, a as Mn, b as On, c as Fn, d as qn, e as Dn, f as Wn, g as Vn, h as Gn, i as Hn, s as Kn } from "./chunks/useLocker-D1c_NTk-.js";
|
|
5
|
+
import { i as se } from "./chunks/SwapWidget-DgyHAVc8.js";
|
|
6
|
+
import { A as Xn, b as Qn, E as zn, F as Zn, c as Yn, d as Jn, e as es, L as as, a as ts, M as ls, f as ns, P as ss, R as cs, g as os, h as rs, j as is, k as ds, S as us, W as hs, l as ms, m as ks } from "./chunks/SwapWidget-DgyHAVc8.js";
|
|
7
|
+
import { jsxs as t, jsx as a, Fragment as U } from "react/jsx-runtime";
|
|
8
|
+
import { useState as A, useMemo as be, useId as ce, useEffect as q, useCallback as sa } from "react";
|
|
9
|
+
import { isAddress as J, getAddress as ee, zeroAddress as pe, erc20Abi as F } from "viem";
|
|
10
|
+
import { CL_POSITION_MANAGER_ABI as ke } from "@latchprotocol/sdk";
|
|
11
|
+
import { LAUNCH_GUARD_HOOK_ABI as fs, LAUNCH_GUARD_HOOK_BLOCK_ABI as bs, poolKeyToTuple as ps } from "@latchprotocol/sdk";
|
|
12
|
+
import { readPositionLockContext as ca, readPositionApproval as oa, readChainNow as ge, validatePositionLock as ra, readErc20Allowance as ia, validateTokenLock as da, buildApprovePositionForLock as ua, buildLockPosition as ha, readFeeGate as Ne, buildErc20Approve as ma, buildTokenLock as ka, buildCollectLockedFees as _a, buildExtendPositionLock as fa, buildWithdrawPosition as ba, buildAcceptLockOwner as pa, buildClaimTokenLock as ga, buildAcceptBeneficiary as Na } from "@latchprotocol/sdk/lock";
|
|
13
|
+
const z = (e) => e.bps === 0 && e.nonZero ? "<0.01%" : R(e.bps);
|
|
14
|
+
function oe({ view: e, label: n, keyed: i = !0 }) {
|
|
15
|
+
const o = e.parts.map((s) => `${s.label} ${z(s)}`).join(", ");
|
|
16
|
+
return /* @__PURE__ */ t("div", { className: "latch-sharebar", role: "img", "aria-label": `${n}: ${o || "nothing locked"}, ${R(e.restBps)} not locked, ${e.of}`, children: [
|
|
17
|
+
/* @__PURE__ */ a("div", { className: "latch-sharebar__track", children: /* @__PURE__ */ a("div", { className: "latch-sharebar__grow", children: e.parts.map((s) => /* @__PURE__ */ a(
|
|
18
|
+
"span",
|
|
19
|
+
{
|
|
20
|
+
className: `latch-sharebar__part latch-sharebar__part--${s.key}`,
|
|
21
|
+
style: { width: s.bps === 0 ? "2px" : `${s.bps / 100}%` },
|
|
22
|
+
title: `${s.label}: ${z(s)} ${e.of}`
|
|
23
|
+
},
|
|
24
|
+
s.key
|
|
25
|
+
)) }) }),
|
|
26
|
+
i && e.parts.length > 1 ? /* @__PURE__ */ a("ul", { className: "latch-sharebar__key", "aria-hidden": "true", children: e.parts.map((s) => /* @__PURE__ */ t("li", { children: [
|
|
27
|
+
/* @__PURE__ */ a("span", { className: `latch-sharebar__sw latch-sharebar__part--${s.key}` }),
|
|
28
|
+
s.label,
|
|
29
|
+
" ",
|
|
30
|
+
z(s)
|
|
31
|
+
] }, s.key)) }) : null
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
const V = 240, $ = 44;
|
|
35
|
+
function ye({
|
|
36
|
+
points: e,
|
|
37
|
+
total: n,
|
|
38
|
+
now: i,
|
|
39
|
+
token: o
|
|
40
|
+
}) {
|
|
41
|
+
const [s, c] = A(null), l = be(() => {
|
|
42
|
+
if (e.length < 2 || n === 0n) return null;
|
|
43
|
+
const b = Number(e[0].t), h = Number(e[e.length - 1].t), p = (k) => (Number(k) - b) / (h - b) * V, r = (k) => $ - 3 - Number(k * 10000n / n) / 1e4 * ($ - 6);
|
|
44
|
+
return { x: p, y: r, d: e.map((k, y) => `${y === 0 ? "M" : "L"}${p(k.t).toFixed(1)} ${r(k.vested).toFixed(1)}`).join(" ") };
|
|
45
|
+
}, [e, n]);
|
|
46
|
+
if (l === null) return null;
|
|
47
|
+
const u = e[0], d = e[e.length - 1], g = i !== null && i > u.t && i < d.t ? l.x(i) : null, N = (b) => {
|
|
48
|
+
const h = b.currentTarget.getBoundingClientRect(), p = (b.clientX - h.left) / h.width * V;
|
|
49
|
+
let r = 0;
|
|
50
|
+
for (let k = 1; k < e.length; k++) Math.abs(l.x(e[k].t) - p) < Math.abs(l.x(e[r].t) - p) && (r = k);
|
|
51
|
+
c(r);
|
|
52
|
+
}, v = (b) => {
|
|
53
|
+
b.key !== "ArrowLeft" && b.key !== "ArrowRight" || (b.preventDefault(), c((h) => Math.max(0, Math.min(e.length - 1, (h ?? (b.key === "ArrowLeft" ? e.length : -1)) + (b.key === "ArrowLeft" ? -1 : 1)))));
|
|
54
|
+
}, L = s === null ? null : e[s];
|
|
55
|
+
return /* @__PURE__ */ t("figure", { className: "latch-spark", children: [
|
|
56
|
+
/* @__PURE__ */ t(
|
|
57
|
+
"svg",
|
|
58
|
+
{
|
|
59
|
+
className: "latch-spark__svg",
|
|
60
|
+
viewBox: `0 0 ${V} ${$}`,
|
|
61
|
+
preserveAspectRatio: "none",
|
|
62
|
+
tabIndex: 0,
|
|
63
|
+
role: "img",
|
|
64
|
+
"aria-label": `Release schedule from ${w(u.t)} to ${w(d.t)}, ${I(n, o)} in all. Arrow keys read points.`,
|
|
65
|
+
onPointerMove: N,
|
|
66
|
+
onPointerLeave: () => c(null),
|
|
67
|
+
onKeyDown: v,
|
|
68
|
+
onBlur: () => c(null),
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ a("line", { className: "latch-spark__base", x1: 0, x2: V, y1: $ - 3, y2: $ - 3, vectorEffect: "non-scaling-stroke" }),
|
|
71
|
+
/* @__PURE__ */ a("path", { className: "latch-spark__line", d: l.d, fill: "none", vectorEffect: "non-scaling-stroke" }),
|
|
72
|
+
g !== null ? /* @__PURE__ */ a("line", { className: "latch-spark__now", x1: g, x2: g, y1: 1, y2: $ - 3, vectorEffect: "non-scaling-stroke" }) : null,
|
|
73
|
+
L !== null ? /* @__PURE__ */ a("line", { className: "latch-spark__cross", x1: l.x(L.t), x2: l.x(L.t), y1: 1, y2: $ - 3, vectorEffect: "non-scaling-stroke" }) : null
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ a("figcaption", { className: "latch-spark__cap", "aria-live": "polite", children: L !== null ? /* @__PURE__ */ t(U, { children: [
|
|
78
|
+
/* @__PURE__ */ a("span", { className: "latch-locks__timer", children: w(L.t) }),
|
|
79
|
+
" · ",
|
|
80
|
+
I(L.vested, o),
|
|
81
|
+
" vested"
|
|
82
|
+
] }) : /* @__PURE__ */ t(U, { children: [
|
|
83
|
+
"Release schedule ",
|
|
84
|
+
w(u.t).slice(0, 10),
|
|
85
|
+
" → ",
|
|
86
|
+
w(d.t).slice(0, 10),
|
|
87
|
+
g !== null ? " · dashed line = now" : ""
|
|
88
|
+
] }) })
|
|
89
|
+
] });
|
|
90
|
+
}
|
|
91
|
+
function ve(e) {
|
|
92
|
+
const n = e.target, o = { lp: {
|
|
93
|
+
...n.lpLocker !== void 0 ? { lpLocker: n.lpLocker } : {},
|
|
94
|
+
...n.binLpLocker !== void 0 ? { binLpLocker: n.binLpLocker } : {},
|
|
95
|
+
...n.lpLockerTokenIds !== void 0 ? { lpLockerTokenIds: n.lpLockerTokenIds } : {},
|
|
96
|
+
...n.lpLockerFromBlock !== void 0 ? { lpLockerFromBlock: n.lpLockerFromBlock } : {},
|
|
97
|
+
...n.poolType !== void 0 ? { poolType: n.poolType } : {}
|
|
98
|
+
}, ...e.native ? { native: e.native } : {}, ...e.refetchIntervalMs !== void 0 ? { refetchIntervalMs: e.refetchIntervalMs } : {} }, s = Ge(e.client, n.kind === "pool" ? n.positionLock : null, n.kind === "pool" ? n.poolId : "0x", o), c = He(e.client, n.kind === "token" ? n.tokenLock : null, n.kind === "token" ? n.token : "0x0000000000000000000000000000000000000000", o);
|
|
99
|
+
return n.kind === "pool" ? { kind: "pool", res: s } : { kind: "token", res: c };
|
|
100
|
+
}
|
|
101
|
+
function ya(e) {
|
|
102
|
+
return e.kind === "pool" && e.poolType === "bin" ? e.binLpLocker ?? null : (e.kind === "pool" ? e.positionLock : e.tokenLock) ?? e.lpLocker ?? e.binLpLocker ?? null;
|
|
103
|
+
}
|
|
104
|
+
function Le(e) {
|
|
105
|
+
const n = te();
|
|
106
|
+
return q(() => {
|
|
107
|
+
se();
|
|
108
|
+
}, []), e ?? n?.theme ?? "system";
|
|
109
|
+
}
|
|
110
|
+
function ae({ props: e }) {
|
|
111
|
+
if (e.siteUrl === void 0) return null;
|
|
112
|
+
const n = e.target, i = De(e.siteUrl, n.kind === "pool" ? { kind: "pool", poolId: n.poolId } : { kind: "token", token: n.token }, {
|
|
113
|
+
...e.lockPathBase !== void 0 ? { pathBase: e.lockPathBase } : {},
|
|
114
|
+
...e.lockQuery !== void 0 ? { query: e.lockQuery } : {}
|
|
115
|
+
});
|
|
116
|
+
return /* @__PURE__ */ a("a", { className: "latch-locks__link", href: i, ...e.linkTarget === void 0 || e.linkTarget === "_self" ? {} : { target: e.linkTarget, rel: "noopener noreferrer" }, children: n.kind === "pool" ? "Locks for this pool →" : "Locks for this token →" });
|
|
117
|
+
}
|
|
118
|
+
function we(e, n = "default") {
|
|
119
|
+
if (e.res.data === null) return null;
|
|
120
|
+
if (n === "embed" && e.kind === "token") return Re(e.res.data);
|
|
121
|
+
if (e.kind === "pool") {
|
|
122
|
+
const s = e.res.data;
|
|
123
|
+
return s.bin !== null ? $e(s.bin, s.currency0, s.currency1) : Ue(s.summary);
|
|
124
|
+
}
|
|
125
|
+
const i = e.res.data, o = { locks: [], totalHeld: 0n, unvested: 0n, heldBps: null, unvestedBps: null, nextCliffOrEnd: null, lastEnd: null, totalSupply: null };
|
|
126
|
+
return Me(i.summary ?? o, i.token, i.permanent);
|
|
127
|
+
}
|
|
128
|
+
function Te(e) {
|
|
129
|
+
if (e.res.data === null) return null;
|
|
130
|
+
if (e.kind === "pool") {
|
|
131
|
+
const i = e.res.data;
|
|
132
|
+
return i.bin !== null ? Oe(i.bin) : Fe(i.summary);
|
|
133
|
+
}
|
|
134
|
+
const n = e.res.data;
|
|
135
|
+
return n.summary === null ? null : qe(n.summary, n.permanent?.total ?? null);
|
|
136
|
+
}
|
|
137
|
+
function Ae({ l: e, target: n }) {
|
|
138
|
+
return ya(n) === null ? /* @__PURE__ */ t("p", { className: "latch-locks__headline", children: [
|
|
139
|
+
/* @__PURE__ */ a("span", { className: "latch-locks__dot latch-locks__dot--none", "aria-hidden": "true" }),
|
|
140
|
+
n.kind === "pool" ? "Latch liquidity locks are coming soon on this chain" : "Latch token locks are coming soon on this chain"
|
|
141
|
+
] }) : e.res.status === "error" && e.res.data === null ? /* @__PURE__ */ a("p", { className: "latch-locks__headline latch-locks__headline--error", role: "status", children: "Locks could not be read: the chain did not answer." }) : e.res.data === null ? /* @__PURE__ */ a("p", { className: "latch-locks__headline latch-locks__headline--muted", role: "status", children: "Reading locks…" }) : null;
|
|
142
|
+
}
|
|
143
|
+
function $a(e) {
|
|
144
|
+
const n = Le(e.theme), i = ve(e), o = we(i, e.wording), s = Te(i), c = i.res.data, l = fe(c?.chainNow ?? null, c?.readAtMs ?? null), u = /* @__PURE__ */ a(Ae, { l: i, target: e.target });
|
|
145
|
+
return /* @__PURE__ */ t(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
className: `latch-widget latch-locks latch-locks--badge${e.className ? ` ${e.className}` : ""}`,
|
|
149
|
+
"data-latch-theme": n,
|
|
150
|
+
"data-tone": o?.tone ?? "none",
|
|
151
|
+
children: [
|
|
152
|
+
o === null ? u : /* @__PURE__ */ t(U, { children: [
|
|
153
|
+
/* @__PURE__ */ t("p", { className: "latch-locks__headline", children: [
|
|
154
|
+
/* @__PURE__ */ a("span", { className: `latch-locks__dot latch-locks__dot--${o.tone}`, "aria-hidden": "true" }),
|
|
155
|
+
/* @__PURE__ */ a("span", { children: o.headline })
|
|
156
|
+
] }),
|
|
157
|
+
s !== null ? /* @__PURE__ */ a(oe, { view: s, label: o.headline, keyed: !1 }) : null,
|
|
158
|
+
o.countdownTo !== null && l !== null ? /* @__PURE__ */ t("p", { className: "latch-locks__countdown", children: [
|
|
159
|
+
/* @__PURE__ */ a("span", { className: "latch-locks__timer", children: j(o.countdownTo - l) }),
|
|
160
|
+
" to ",
|
|
161
|
+
o.countdownLabel
|
|
162
|
+
] }) : null
|
|
163
|
+
] }),
|
|
164
|
+
e.brandMarkUrl !== void 0 ? /* @__PURE__ */ t("p", { className: "latch-brand", children: [
|
|
165
|
+
/* @__PURE__ */ a("img", { className: "latch-brand__mark", src: e.brandMarkUrl, width: 665, height: 765, alt: "Latch" }),
|
|
166
|
+
/* @__PURE__ */ a("span", { children: "Read from chain" }),
|
|
167
|
+
/* @__PURE__ */ a("span", { className: "latch-brand__spacer" }),
|
|
168
|
+
/* @__PURE__ */ a(ae, { props: e })
|
|
169
|
+
] }) : /* @__PURE__ */ a(ae, { props: e })
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
function Ua(e) {
|
|
175
|
+
const n = Le(e.theme), i = ce(), o = ve(e), s = we(o), c = Te(o), l = o.kind === "token" && o.res.data !== null ? _e(o.res.data.summary?.locks ?? [], o.res.data.chainNow) : null, u = o.res.data, d = fe(u?.chainNow ?? null, u?.readAtMs ?? null);
|
|
176
|
+
return /* @__PURE__ */ t(
|
|
177
|
+
"section",
|
|
178
|
+
{
|
|
179
|
+
className: `latch-widget latch-locks latch-locks--panel${e.className ? ` ${e.className}` : ""}`,
|
|
180
|
+
"data-latch-theme": n,
|
|
181
|
+
"aria-labelledby": i,
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ t("header", { className: "latch-header", children: [
|
|
184
|
+
/* @__PURE__ */ a("h2", { id: i, className: "latch-title", children: e.title ?? "Locks" }),
|
|
185
|
+
/* @__PURE__ */ a(ae, { props: e })
|
|
186
|
+
] }),
|
|
187
|
+
s === null ? /* @__PURE__ */ a(Ae, { l: o, target: e.target }) : /* @__PURE__ */ t(U, { children: [
|
|
188
|
+
/* @__PURE__ */ t("p", { className: "latch-locks__headline", children: [
|
|
189
|
+
/* @__PURE__ */ a("span", { className: `latch-locks__dot latch-locks__dot--${s.tone}`, "aria-hidden": "true" }),
|
|
190
|
+
/* @__PURE__ */ a("span", { children: s.headline })
|
|
191
|
+
] }),
|
|
192
|
+
c !== null ? /* @__PURE__ */ a(oe, { view: c, label: s.headline }) : null,
|
|
193
|
+
s.detail !== null ? /* @__PURE__ */ a("p", { className: "latch-note", children: s.detail }) : null,
|
|
194
|
+
s.countdownTo !== null && d !== null ? /* @__PURE__ */ t("p", { className: "latch-locks__countdown", children: [
|
|
195
|
+
/* @__PURE__ */ a("span", { className: "latch-locks__timer", children: j(s.countdownTo - d) }),
|
|
196
|
+
" to ",
|
|
197
|
+
s.countdownLabel
|
|
198
|
+
] }) : null,
|
|
199
|
+
l !== null && o.kind === "token" ? /* @__PURE__ */ a(ye, { points: l.points, total: l.total, now: d, token: o.res.data.token }) : null,
|
|
200
|
+
o.kind === "pool" ? /* @__PURE__ */ a(va, { data: o.res.data, now: d }) : /* @__PURE__ */ a(La, { data: o.res.data, now: d })
|
|
201
|
+
] }),
|
|
202
|
+
/* @__PURE__ */ a("p", { className: "latch-footer latch-footer--brand", children: "Read from chain · countdowns on the chain’s clock" })
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
function va({ data: e, now: n }) {
|
|
208
|
+
const i = e.summary.locks, o = e.summary.permanent, s = e.bin?.locks ?? [];
|
|
209
|
+
if (i.length === 0 && o.length === 0 && s.length === 0) return null;
|
|
210
|
+
const c = e.summary.pool?.activeLiquidity ?? 0n;
|
|
211
|
+
return /* @__PURE__ */ t("ul", { className: "latch-locks__list", children: [
|
|
212
|
+
o.map((l) => {
|
|
213
|
+
const u = l.inRange === !0 && c > 0n ? Number(l.liquidity * 10000n / c) : null;
|
|
214
|
+
return /* @__PURE__ */ t("li", { className: "latch-locks__item", "data-status": "permanent", children: [
|
|
215
|
+
/* @__PURE__ */ t("div", { className: "latch-locks__row", children: [
|
|
216
|
+
/* @__PURE__ */ t("strong", { children: [
|
|
217
|
+
"Position #",
|
|
218
|
+
l.tokenId.toString()
|
|
219
|
+
] }),
|
|
220
|
+
/* @__PURE__ */ a("span", { className: "latch-locks__status latch-locks__status--permanent", children: "Locked permanently (LP locker)" })
|
|
221
|
+
] }),
|
|
222
|
+
/* @__PURE__ */ t("dl", { className: "latch-locks__facts", children: [
|
|
223
|
+
/* @__PURE__ */ t("div", { children: [
|
|
224
|
+
/* @__PURE__ */ a("dt", { children: "Fees to" }),
|
|
225
|
+
/* @__PURE__ */ t("dd", { title: l.creator, children: [
|
|
226
|
+
Z(l.creator),
|
|
227
|
+
" (creator)"
|
|
228
|
+
] })
|
|
229
|
+
] }),
|
|
230
|
+
l.amount0 !== null && l.amount1 !== null ? /* @__PURE__ */ t("div", { children: [
|
|
231
|
+
/* @__PURE__ */ a("dt", { children: "Holds now" }),
|
|
232
|
+
/* @__PURE__ */ t("dd", { title: `Liquidity ${l.liquidity.toLocaleString("en-US")}`, children: [
|
|
233
|
+
I(l.amount0, e.currency0),
|
|
234
|
+
" + ",
|
|
235
|
+
I(l.amount1, e.currency1),
|
|
236
|
+
l.inRange === !1 ? " · out of range" : ""
|
|
237
|
+
] })
|
|
238
|
+
] }) : /* @__PURE__ */ t("div", { children: [
|
|
239
|
+
/* @__PURE__ */ a("dt", { children: "Liquidity" }),
|
|
240
|
+
/* @__PURE__ */ t("dd", { children: [
|
|
241
|
+
"L ",
|
|
242
|
+
l.liquidity.toLocaleString("en-US"),
|
|
243
|
+
l.inRange === !1 ? " · out of range" : ""
|
|
244
|
+
] })
|
|
245
|
+
] }),
|
|
246
|
+
/* @__PURE__ */ t("div", { children: [
|
|
247
|
+
/* @__PURE__ */ a("dt", { children: "Share of active" }),
|
|
248
|
+
/* @__PURE__ */ a("dd", { children: u === null ? "—" : R(u) })
|
|
249
|
+
] }),
|
|
250
|
+
/* @__PURE__ */ t("div", { children: [
|
|
251
|
+
/* @__PURE__ */ a("dt", { children: "Unlocks" }),
|
|
252
|
+
/* @__PURE__ */ a("dd", { children: "never: the LP locker has no withdraw path" })
|
|
253
|
+
] })
|
|
254
|
+
] })
|
|
255
|
+
] }, `lp${l.tokenId}`);
|
|
256
|
+
}),
|
|
257
|
+
s.map((l) => /* @__PURE__ */ t("li", { className: "latch-locks__item", "data-status": "permanent", children: [
|
|
258
|
+
/* @__PURE__ */ t("div", { className: "latch-locks__row", children: [
|
|
259
|
+
/* @__PURE__ */ t("strong", { children: [
|
|
260
|
+
"Bin lock #",
|
|
261
|
+
l.lockId.toString()
|
|
262
|
+
] }),
|
|
263
|
+
/* @__PURE__ */ a("span", { className: "latch-locks__status latch-locks__status--permanent", children: "Locked permanently (LP locker)" })
|
|
264
|
+
] }),
|
|
265
|
+
/* @__PURE__ */ t("dl", { className: "latch-locks__facts", children: [
|
|
266
|
+
/* @__PURE__ */ t("div", { children: [
|
|
267
|
+
/* @__PURE__ */ a("dt", { children: "Bins" }),
|
|
268
|
+
/* @__PURE__ */ t("dd", { children: [
|
|
269
|
+
l.bins.length.toLocaleString("en-US"),
|
|
270
|
+
l.bins.length > 0 ? ` (ids ${l.bins[0].binId}–${l.bins[l.bins.length - 1].binId})` : ""
|
|
271
|
+
] })
|
|
272
|
+
] }),
|
|
273
|
+
/* @__PURE__ */ t("div", { children: [
|
|
274
|
+
/* @__PURE__ */ a("dt", { children: "Holds now" }),
|
|
275
|
+
/* @__PURE__ */ t("dd", { children: [
|
|
276
|
+
I(l.amount0, e.currency0),
|
|
277
|
+
" + ",
|
|
278
|
+
I(l.amount1, e.currency1)
|
|
279
|
+
] })
|
|
280
|
+
] }),
|
|
281
|
+
/* @__PURE__ */ t("div", { children: [
|
|
282
|
+
/* @__PURE__ */ a("dt", { children: "Unlocks" }),
|
|
283
|
+
/* @__PURE__ */ a("dd", { children: "never: the LP locker has no withdraw path" })
|
|
284
|
+
] })
|
|
285
|
+
] })
|
|
286
|
+
] }, `bin${l.lockId}`)),
|
|
287
|
+
i.map((l) => {
|
|
288
|
+
const u = l.inRange === !0 && l.liquidity !== null && c > 0n && l.status === "locked" ? Number(l.liquidity * 10000n / c) : null;
|
|
289
|
+
return /* @__PURE__ */ t("li", { className: "latch-locks__item", "data-status": l.status, children: [
|
|
290
|
+
/* @__PURE__ */ t("div", { className: "latch-locks__row", children: [
|
|
291
|
+
/* @__PURE__ */ t("strong", { children: [
|
|
292
|
+
"Position #",
|
|
293
|
+
l.tokenId.toString()
|
|
294
|
+
] }),
|
|
295
|
+
/* @__PURE__ */ a("span", { className: `latch-locks__status latch-locks__status--${l.status}`, children: We[l.status] })
|
|
296
|
+
] }),
|
|
297
|
+
/* @__PURE__ */ t("dl", { className: "latch-locks__facts", children: [
|
|
298
|
+
/* @__PURE__ */ t("div", { children: [
|
|
299
|
+
/* @__PURE__ */ a("dt", { children: "Lock owner" }),
|
|
300
|
+
/* @__PURE__ */ a("dd", { title: l.owner, children: Z(l.owner) })
|
|
301
|
+
] }),
|
|
302
|
+
l.amount0 !== null && l.amount1 !== null ? /* @__PURE__ */ t("div", { children: [
|
|
303
|
+
/* @__PURE__ */ a("dt", { children: "Holds now" }),
|
|
304
|
+
/* @__PURE__ */ t("dd", { title: l.liquidity === null ? void 0 : `Liquidity ${l.liquidity.toLocaleString("en-US")}`, children: [
|
|
305
|
+
I(l.amount0, e.currency0),
|
|
306
|
+
" + ",
|
|
307
|
+
I(l.amount1, e.currency1),
|
|
308
|
+
l.inRange === !1 ? " · out of range" : ""
|
|
309
|
+
] })
|
|
310
|
+
] }) : /* @__PURE__ */ t("div", { children: [
|
|
311
|
+
/* @__PURE__ */ a("dt", { children: "Liquidity" }),
|
|
312
|
+
/* @__PURE__ */ t("dd", { children: [
|
|
313
|
+
l.liquidity === null ? "—" : `L ${l.liquidity.toLocaleString("en-US")}`,
|
|
314
|
+
l.inRange === !1 ? " · out of range" : ""
|
|
315
|
+
] })
|
|
316
|
+
] }),
|
|
317
|
+
/* @__PURE__ */ t("div", { children: [
|
|
318
|
+
/* @__PURE__ */ a("dt", { children: "Share of active" }),
|
|
319
|
+
/* @__PURE__ */ a("dd", { children: u === null ? "—" : R(u) })
|
|
320
|
+
] }),
|
|
321
|
+
/* @__PURE__ */ t("div", { children: [
|
|
322
|
+
/* @__PURE__ */ a("dt", { children: "Unlocks" }),
|
|
323
|
+
/* @__PURE__ */ t("dd", { children: [
|
|
324
|
+
w(l.unlockAt),
|
|
325
|
+
l.status === "locked" && n !== null ? /* @__PURE__ */ t("span", { className: "latch-locks__timer", children: [
|
|
326
|
+
" · ",
|
|
327
|
+
j(l.unlockAt - n)
|
|
328
|
+
] }) : null
|
|
329
|
+
] })
|
|
330
|
+
] })
|
|
331
|
+
] })
|
|
332
|
+
] }, l.tokenId.toString());
|
|
333
|
+
})
|
|
334
|
+
] });
|
|
335
|
+
}
|
|
336
|
+
function La({ data: e, now: n }) {
|
|
337
|
+
const i = e.summary?.locks ?? [], o = e.permanent?.pools ?? [];
|
|
338
|
+
if (i.length === 0 && o.length === 0) return null;
|
|
339
|
+
const s = e.summary?.totalSupply ?? null;
|
|
340
|
+
return /* @__PURE__ */ t("ul", { className: "latch-locks__list", children: [
|
|
341
|
+
o.map((c) => /* @__PURE__ */ t("li", { className: "latch-locks__item", "data-status": "permanent", children: [
|
|
342
|
+
/* @__PURE__ */ t("div", { className: "latch-locks__row", children: [
|
|
343
|
+
/* @__PURE__ */ t("strong", { children: [
|
|
344
|
+
c.kind === "cl-lp-locker" ? "CL" : "Bin",
|
|
345
|
+
" pool ",
|
|
346
|
+
c.poolId.slice(0, 10),
|
|
347
|
+
"…"
|
|
348
|
+
] }),
|
|
349
|
+
/* @__PURE__ */ a("span", { className: "latch-locks__status latch-locks__status--permanent", children: "Locked permanently (LP locker)" })
|
|
350
|
+
] }),
|
|
351
|
+
/* @__PURE__ */ t("dl", { className: "latch-locks__facts", children: [
|
|
352
|
+
/* @__PURE__ */ t("div", { children: [
|
|
353
|
+
/* @__PURE__ */ t("dt", { children: [
|
|
354
|
+
e.token.symbol,
|
|
355
|
+
" in the locked liquidity"
|
|
356
|
+
] }),
|
|
357
|
+
/* @__PURE__ */ t("dd", { children: [
|
|
358
|
+
I(c.amount, e.token),
|
|
359
|
+
s !== null && s > 0n ? ` · ${R(Number(c.amount * 10000n / s))} of supply` : ""
|
|
360
|
+
] })
|
|
361
|
+
] }),
|
|
362
|
+
/* @__PURE__ */ t("div", { children: [
|
|
363
|
+
/* @__PURE__ */ a("dt", { children: "Locks" }),
|
|
364
|
+
/* @__PURE__ */ a("dd", { children: c.locks.toLocaleString("en-US") })
|
|
365
|
+
] }),
|
|
366
|
+
/* @__PURE__ */ t("div", { children: [
|
|
367
|
+
/* @__PURE__ */ a("dt", { children: "Unlocks" }),
|
|
368
|
+
/* @__PURE__ */ a("dd", { children: "never: the LP locker has no withdraw path" })
|
|
369
|
+
] })
|
|
370
|
+
] })
|
|
371
|
+
] }, `${c.kind}${c.poolId}`)),
|
|
372
|
+
i.map((c) => {
|
|
373
|
+
const l = c.amount - c.claimed, u = s === null || s === 0n ? null : Number(l * 10000n / s), d = c.status === "cliff" ? c.cliff : c.status === "vesting" ? c.end : null, g = Y(c);
|
|
374
|
+
return /* @__PURE__ */ t("li", { className: "latch-locks__item", "data-status": c.status, children: [
|
|
375
|
+
/* @__PURE__ */ t("div", { className: "latch-locks__row", children: [
|
|
376
|
+
/* @__PURE__ */ t("strong", { children: [
|
|
377
|
+
"Lock #",
|
|
378
|
+
c.lockId.toString()
|
|
379
|
+
] }),
|
|
380
|
+
/* @__PURE__ */ a("span", { className: `latch-locks__status latch-locks__status--${c.status}`, children: Ve[c.status] })
|
|
381
|
+
] }),
|
|
382
|
+
/* @__PURE__ */ t("dl", { className: "latch-locks__facts", children: [
|
|
383
|
+
/* @__PURE__ */ t("div", { children: [
|
|
384
|
+
/* @__PURE__ */ a("dt", { children: "Beneficiary" }),
|
|
385
|
+
/* @__PURE__ */ a("dd", { title: c.beneficiary, children: Z(c.beneficiary) })
|
|
386
|
+
] }),
|
|
387
|
+
/* @__PURE__ */ t("div", { children: [
|
|
388
|
+
/* @__PURE__ */ a("dt", { children: "Amount" }),
|
|
389
|
+
/* @__PURE__ */ a("dd", { children: I(c.amount, e.token) })
|
|
390
|
+
] }),
|
|
391
|
+
/* @__PURE__ */ t("div", { children: [
|
|
392
|
+
/* @__PURE__ */ a("dt", { children: "Still held" }),
|
|
393
|
+
/* @__PURE__ */ t("dd", { children: [
|
|
394
|
+
I(l, e.token),
|
|
395
|
+
u !== null ? ` · ${R(u)} of supply` : ""
|
|
396
|
+
] })
|
|
397
|
+
] }),
|
|
398
|
+
/* @__PURE__ */ t("div", { children: [
|
|
399
|
+
/* @__PURE__ */ a("dt", { children: c.start === c.end ? "Unlocks" : "Vesting" }),
|
|
400
|
+
/* @__PURE__ */ t("dd", { children: [
|
|
401
|
+
c.start === c.end ? w(c.end) : `${w(c.start)} → ${w(c.end)}${c.cliff > c.start ? `, cliff ${w(c.cliff)}` : ""}`,
|
|
402
|
+
d !== null && n !== null ? /* @__PURE__ */ t("span", { className: "latch-locks__timer", children: [
|
|
403
|
+
" · ",
|
|
404
|
+
j(d - n)
|
|
405
|
+
] }) : null
|
|
406
|
+
] })
|
|
407
|
+
] })
|
|
408
|
+
] }),
|
|
409
|
+
/* @__PURE__ */ a("div", { className: "latch-progress", role: "img", "aria-label": `${R(g)} vested`, children: /* @__PURE__ */ a("div", { className: "latch-progress-fill", style: { width: `${g / 100}%` } }) })
|
|
410
|
+
] }, c.lockId.toString());
|
|
411
|
+
})
|
|
412
|
+
] });
|
|
413
|
+
}
|
|
414
|
+
function Ie(e) {
|
|
415
|
+
return e === void 0 || e === "_self" ? {} : { target: e, rel: "noopener noreferrer" };
|
|
416
|
+
}
|
|
417
|
+
function G({ r: e, props: n }) {
|
|
418
|
+
return /* @__PURE__ */ t("div", { className: "latch-trust__row", "data-tone": e.tone, children: [
|
|
419
|
+
/* @__PURE__ */ a("dt", { className: "latch-trust__label", children: e.label }),
|
|
420
|
+
/* @__PURE__ */ t("dd", { className: "latch-trust__value", children: [
|
|
421
|
+
/* @__PURE__ */ t("p", { className: "latch-trust__headline", children: [
|
|
422
|
+
/* @__PURE__ */ a("span", { className: `latch-trust__dot latch-trust__dot--${e.tone}`, "aria-hidden": "true" }),
|
|
423
|
+
/* @__PURE__ */ a("span", { children: e.headline })
|
|
424
|
+
] }),
|
|
425
|
+
e.share ? /* @__PURE__ */ a(oe, { view: e.share, label: `${e.label}: ${e.headline}` }) : null,
|
|
426
|
+
e.detail !== null ? /* @__PURE__ */ a("p", { className: "latch-trust__detail", children: e.detail }) : null,
|
|
427
|
+
e.sources.length > 0 ? /* @__PURE__ */ a("p", { className: "latch-trust__source", children: e.sources.map((i, o) => {
|
|
428
|
+
const s = n.explorerAddressUrl?.(i.address) ?? null, c = e.provenance[o] ?? i.contract;
|
|
429
|
+
return /* @__PURE__ */ a("span", { className: "latch-trust__source-item", children: s === null ? c : /* @__PURE__ */ a("a", { href: s, ...Ie(n.linkTarget ?? "_blank"), children: c }) }, `${i.address}${o}`);
|
|
430
|
+
}) }) : null
|
|
431
|
+
] })
|
|
432
|
+
] });
|
|
433
|
+
}
|
|
434
|
+
function Ma(e) {
|
|
435
|
+
const n = te(), i = e.theme ?? n?.theme ?? "system", o = ce();
|
|
436
|
+
q(() => {
|
|
437
|
+
se();
|
|
438
|
+
}, []);
|
|
439
|
+
const s = Ke(e.client, e, e.refetchIntervalMs === void 0 ? {} : { refetchIntervalMs: e.refetchIntervalMs }), c = s.data, l = c === null ? null : je(c.trust, c.symbols);
|
|
440
|
+
let u;
|
|
441
|
+
return e.contracts === null ? u = /* @__PURE__ */ a("p", { className: "latch-trust__state", role: "status", children: "Latch is coming soon on this chain, so nothing about this token can be read from its contracts yet." }) : l === null && s.status === "error" ? u = /* @__PURE__ */ t("p", { className: "latch-trust__state latch-trust__state--error", role: "alert", children: [
|
|
442
|
+
"Could not be read: the chain did not answer.",
|
|
443
|
+
" ",
|
|
444
|
+
/* @__PURE__ */ a("button", { type: "button", className: "latch-trust__retry", onClick: s.refetch, children: "Retry" })
|
|
445
|
+
] }) : l === null ? u = /* @__PURE__ */ a("p", { className: "latch-trust__state", role: "status", children: "Reading the lock, launch, fee and registry contracts…" }) : u = /* @__PURE__ */ t(U, { children: [
|
|
446
|
+
/* @__PURE__ */ t("dl", { className: "latch-trust__list", children: [
|
|
447
|
+
/* @__PURE__ */ a(G, { r: l.launch, props: e }),
|
|
448
|
+
/* @__PURE__ */ a(G, { r: l.tokenLocks, props: e }),
|
|
449
|
+
/* @__PURE__ */ a(G, { r: l.creatorTax, props: e })
|
|
450
|
+
] }),
|
|
451
|
+
/* @__PURE__ */ a("h3", { className: "latch-trust__subhead", children: "Pools" }),
|
|
452
|
+
l.pools.length === 0 ? /* @__PURE__ */ a("p", { className: "latch-trust__state", children: "No pool of this token was found through a Latch launch, lock or this page’s pool list." }) : l.pools.map((d) => {
|
|
453
|
+
const g = e.poolLockUrl?.(d.poolId) ?? null;
|
|
454
|
+
return /* @__PURE__ */ t("section", { className: "latch-trust__pool", "aria-label": d.title, children: [
|
|
455
|
+
/* @__PURE__ */ t("header", { className: "latch-trust__pool-head", children: [
|
|
456
|
+
/* @__PURE__ */ a("strong", { children: d.title }),
|
|
457
|
+
/* @__PURE__ */ t("code", { title: d.poolId, children: [
|
|
458
|
+
d.poolId.slice(0, 10),
|
|
459
|
+
"…",
|
|
460
|
+
d.poolId.slice(-6)
|
|
461
|
+
] }),
|
|
462
|
+
g !== null ? /* @__PURE__ */ a("a", { className: "latch-trust__link", href: g, ...Ie(e.linkTarget), children: "Locks →" }) : null
|
|
463
|
+
] }),
|
|
464
|
+
/* @__PURE__ */ a("p", { className: "latch-trust__found", children: d.foundBy }),
|
|
465
|
+
/* @__PURE__ */ a("dl", { className: "latch-trust__list", children: d.rows.map((N) => /* @__PURE__ */ a(G, { r: N, props: e }, N.key)) })
|
|
466
|
+
] }, d.poolId);
|
|
467
|
+
}),
|
|
468
|
+
l.failedPools.map((d) => /* @__PURE__ */ a("p", { className: "latch-trust__state latch-trust__state--error", children: d }, d)),
|
|
469
|
+
/* @__PURE__ */ a("p", { className: "latch-note", children: l.discoveryNote }),
|
|
470
|
+
s.status === "error" ? /* @__PURE__ */ a("p", { className: "latch-note latch-note--warn", children: "The last refresh failed; these rows are from the previous read." }) : null,
|
|
471
|
+
/* @__PURE__ */ a("p", { className: "latch-footer latch-footer--brand", children: l.readAtNote })
|
|
472
|
+
] }), /* @__PURE__ */ t("section", { className: `latch-widget latch-trust${e.className ? ` ${e.className}` : ""}`, "data-latch-theme": i, "aria-labelledby": o, children: [
|
|
473
|
+
/* @__PURE__ */ a("header", { className: "latch-header", children: /* @__PURE__ */ a("h2", { id: o, className: "latch-title", children: e.title ?? "What the contracts say" }) }),
|
|
474
|
+
u
|
|
475
|
+
] });
|
|
476
|
+
}
|
|
477
|
+
const re = { symbol: "ETH", decimals: 18 }, E = (e) => `${e.slice(0, 6)}…${e.slice(-4)}`;
|
|
478
|
+
function ie({ state: e, explorerTxUrl: n }) {
|
|
479
|
+
if (e.k === "idle") return null;
|
|
480
|
+
const i = e.labels, o = e.k === "done" ? i.length : e.active;
|
|
481
|
+
return /* @__PURE__ */ t("div", { role: "status", "aria-live": "polite", children: [
|
|
482
|
+
/* @__PURE__ */ a("ol", { className: "latch-locker__steps", children: i.map((s, c) => /* @__PURE__ */ a("li", { "data-state": c < o ? "done" : c === o && e.k === "running" ? "active" : "pending", children: s }, s)) }),
|
|
483
|
+
e.k === "running" ? /* @__PURE__ */ a("p", { className: "latch-locker__status", children: e.phase === "simulating" ? "Simulating the exact transaction…" : e.phase === "signing" ? "Confirm in your wallet…" : "Waiting for the receipt…" }) : e.k === "failed" ? /* @__PURE__ */ a("p", { className: "latch-locker__status", "data-kind": "error", children: e.message }) : /* @__PURE__ */ t("p", { className: "latch-locker__status", "data-kind": "success", children: [
|
|
484
|
+
"Done: every receipt succeeded.",
|
|
485
|
+
" ",
|
|
486
|
+
e.hashes.map((s) => {
|
|
487
|
+
const c = n?.(s) ?? null;
|
|
488
|
+
return c === null ? /* @__PURE__ */ t("code", { children: [
|
|
489
|
+
E(s),
|
|
490
|
+
" "
|
|
491
|
+
] }, s) : /* @__PURE__ */ t("a", { href: c, target: "_blank", rel: "noopener noreferrer", children: [
|
|
492
|
+
E(s),
|
|
493
|
+
" "
|
|
494
|
+
] }, s);
|
|
495
|
+
})
|
|
496
|
+
] })
|
|
497
|
+
] });
|
|
498
|
+
}
|
|
499
|
+
function Se({ terms: e, native: n }) {
|
|
500
|
+
if (e === void 0) return /* @__PURE__ */ a("p", { className: "latch-locker__fee", children: "Reading the fee…" });
|
|
501
|
+
if (e === null) return /* @__PURE__ */ a("p", { className: "latch-locker__fee", children: "The fee could not be read." });
|
|
502
|
+
const i = na(e, n);
|
|
503
|
+
return /* @__PURE__ */ t("p", { className: "latch-locker__fee", children: [
|
|
504
|
+
/* @__PURE__ */ t("span", { children: [
|
|
505
|
+
"Fee ",
|
|
506
|
+
/* @__PURE__ */ a("strong", { children: i.fee }),
|
|
507
|
+
", sends ",
|
|
508
|
+
/* @__PURE__ */ a("strong", { children: i.sends })
|
|
509
|
+
] }),
|
|
510
|
+
i.pending !== null ? /* @__PURE__ */ a("span", { children: i.pending }) : null,
|
|
511
|
+
/* @__PURE__ */ a("span", { className: "latch-note", children: i.note })
|
|
512
|
+
] });
|
|
513
|
+
}
|
|
514
|
+
function wa(e) {
|
|
515
|
+
const { client: n, contracts: i } = e.props, o = i.positionLock, [s, c] = A(""), [l, u] = A(""), [d, g] = A(""), N = /^\d+$/.test(s.trim()) ? BigInt(s.trim()) : null, v = H(l), L = d.trim() === "" ? e.account : J(d.trim(), { strict: !1 }) ? ee(d.trim()) : null, b = le(
|
|
516
|
+
async () => {
|
|
517
|
+
const m = await ca(n, o), B = N, [M, C, O, D] = await Promise.all([
|
|
518
|
+
n.readContract({ address: m.positionManager, abi: ke, functionName: "ownerOf", args: [B] }).catch(() => null),
|
|
519
|
+
n.readContract({ address: m.positionManager, abi: ke, functionName: "positions", args: [B] }).catch(() => null),
|
|
520
|
+
e.account === null ? Promise.resolve(!1) : oa(n, { positionManager: m.positionManager, lock: o, tokenId: B, owner: e.account }).catch(() => !1),
|
|
521
|
+
ge(n)
|
|
522
|
+
]);
|
|
523
|
+
return { ctx: m, nftOwner: M, liquidity: C === null ? null : C[3], approved: O, now: D };
|
|
524
|
+
},
|
|
525
|
+
[n, o, N, e.account],
|
|
526
|
+
{ enabled: N !== null }
|
|
527
|
+
), h = b.data;
|
|
528
|
+
q(() => {
|
|
529
|
+
l === "" && h !== null && u(K(h.now + 30n * 86400n));
|
|
530
|
+
}, [h, l]);
|
|
531
|
+
const p = [];
|
|
532
|
+
if (s.trim() !== "" && N === null && p.push("The position id is a whole number."), h !== null && N !== null)
|
|
533
|
+
if (h.nftOwner === null ? p.push(`Position #${N} does not exist on this position manager.`) : e.account !== null && h.nftOwner.toLowerCase() !== e.account.toLowerCase() && p.push(`Position #${N} is owned by ${E(h.nftOwner)}, not the connected wallet.`), h.liquidity === 0n && p.push("The position holds no liquidity."), v === null) p.push("Choose an unlock date.");
|
|
534
|
+
else for (const m of ra({ unlockAt: v, owner: L ?? "", nowSeconds: h.now, lock: o })) p.push(m.message);
|
|
535
|
+
const r = ne(n, e.wallet, e.account, e.onDone), k = h !== null && N !== null && v !== null && L !== null && p.length === 0 && e.account !== null && r.state.k !== "running", y = k ? Ze({ tokenId: N, approved: h.approved, unlockAt: v }) : [], T = () => {
|
|
536
|
+
if (!k) return;
|
|
537
|
+
const m = N, B = y.map((M) => ({
|
|
538
|
+
label: M.label,
|
|
539
|
+
build: M.key === "approve" ? async () => ua({ positionManager: h.ctx.positionManager, lock: o, tokenId: m }) : async () => ha({ lock: o, tokenId: m, unlockAt: v, owner: L, terms: await Ne(n, o) })
|
|
540
|
+
}));
|
|
541
|
+
r.run(B);
|
|
542
|
+
};
|
|
543
|
+
return /* @__PURE__ */ t("div", { className: "latch-locker__form", children: [
|
|
544
|
+
/* @__PURE__ */ t("label", { className: "latch-locker__field", children: [
|
|
545
|
+
/* @__PURE__ */ a("span", { children: "Position id (CL position NFT)" }),
|
|
546
|
+
/* @__PURE__ */ a("input", { className: "latch-locker__input", inputMode: "numeric", value: s, onChange: (m) => c(m.target.value), placeholder: "Position id" })
|
|
547
|
+
] }),
|
|
548
|
+
h !== null && h.liquidity !== null ? /* @__PURE__ */ t("p", { className: "latch-note", children: [
|
|
549
|
+
"Liquidity L ",
|
|
550
|
+
h.liquidity.toLocaleString("en-US"),
|
|
551
|
+
h.approved ? " · already approved to the lock" : ""
|
|
552
|
+
] }) : null,
|
|
553
|
+
b.status === "error" ? /* @__PURE__ */ a("p", { className: "latch-locker__status", "data-kind": "error", children: "The position could not be read: the chain did not answer." }) : null,
|
|
554
|
+
/* @__PURE__ */ t("div", { className: "latch-locker__row2", children: [
|
|
555
|
+
/* @__PURE__ */ t("label", { className: "latch-locker__field", children: [
|
|
556
|
+
/* @__PURE__ */ a("span", { children: "Unlock (UTC)" }),
|
|
557
|
+
/* @__PURE__ */ a("input", { className: "latch-locker__input", type: "datetime-local", value: l, onChange: (m) => u(m.target.value) })
|
|
558
|
+
] }),
|
|
559
|
+
/* @__PURE__ */ t("label", { className: "latch-locker__field", children: [
|
|
560
|
+
/* @__PURE__ */ a("span", { children: "Lock owner" }),
|
|
561
|
+
/* @__PURE__ */ a("input", { className: "latch-locker__input", value: d, onChange: (m) => g(m.target.value), placeholder: e.account === null ? "0x…" : `${E(e.account)} (you)` })
|
|
562
|
+
] })
|
|
563
|
+
] }),
|
|
564
|
+
p.length > 0 ? /* @__PURE__ */ a("ul", { className: "latch-locker__issues", children: p.map((m) => /* @__PURE__ */ a("li", { children: m }, m)) }) : null,
|
|
565
|
+
/* @__PURE__ */ a(Se, { terms: e.fee, native: e.props.native ?? re }),
|
|
566
|
+
/* @__PURE__ */ a("p", { className: "latch-note", children: "Until the unlock date nobody can remove the liquidity or move the NFT. The lock owner keeps collecting its swap fees and withdraws after the date. A lock can be extended, never shortened." }),
|
|
567
|
+
/* @__PURE__ */ a("button", { type: "button", className: "latch-cta", disabled: !k, onClick: T, children: y.length > 1 ? "Approve and lock" : "Lock position" }),
|
|
568
|
+
/* @__PURE__ */ a(ie, { state: r.state, explorerTxUrl: e.props.explorerTxUrl })
|
|
569
|
+
] });
|
|
570
|
+
}
|
|
571
|
+
function Ta(e) {
|
|
572
|
+
const { client: n, contracts: i } = e.props, o = i.tokenLock, s = e.props.native ?? re, [c, l] = A(!1), [u, d] = A(e.props.defaultToken ?? ""), [g, N] = A(""), [v, L] = A(""), [b, h] = A("timelock"), [p, r] = A(""), [k, y] = A(""), [T, m] = A("0"), [B, M] = A("365"), C = c ? pe : J(u.trim(), { strict: !1 }) ? ee(u.trim()) : null, O = v.trim() === "" ? e.account : J(v.trim(), { strict: !1 }) ? ee(v.trim()) : null, D = le(
|
|
573
|
+
async () => {
|
|
574
|
+
const f = C, [W, Pe, xe, Ee, Be] = await Promise.all([
|
|
575
|
+
c ? Promise.resolve(s.symbol) : n.readContract({ address: f, abi: F, functionName: "symbol" }),
|
|
576
|
+
c ? Promise.resolve(s.decimals) : n.readContract({ address: f, abi: F, functionName: "decimals" }),
|
|
577
|
+
e.account === null ? Promise.resolve(null) : c ? n.getBalance({ address: e.account }) : n.readContract({ address: f, abi: F, functionName: "balanceOf", args: [e.account] }),
|
|
578
|
+
e.account === null || c ? Promise.resolve(0n) : ia(n, f, e.account, o),
|
|
579
|
+
ge(n)
|
|
580
|
+
]);
|
|
581
|
+
return { symbol: W, decimals: Number(Pe), balance: xe, allowance: Ee, now: Be };
|
|
582
|
+
},
|
|
583
|
+
[n, C, c, e.account, o],
|
|
584
|
+
{ enabled: C !== null }
|
|
585
|
+
), _ = D.data;
|
|
586
|
+
q(() => {
|
|
587
|
+
_ !== null && (p === "" && r(K(_.now + 30n * 86400n)), k === "" && y(K(_.now + 3600n)));
|
|
588
|
+
}, [_, p, k]);
|
|
589
|
+
const S = _ === null ? null : Ye(g, _.decimals), P = Je(b, { unlockAt: H(p), start: H(k), cliffDays: ue(T), durationDays: ue(B) }), x = [];
|
|
590
|
+
if (!c && u.trim() !== "" && C === null && x.push("The token is not an address."), D.status === "error" && _ === null && x.push("The token could not be read: is it an ERC-20 on this chain?"), _ !== null) {
|
|
591
|
+
if (g.trim() !== "" && S === null && x.push(`Enter an amount with at most ${_.decimals} decimals.`), S !== null && _.balance !== null && S > _.balance && x.push(`The connected wallet holds ${I(_.balance, { symbol: _.symbol, decimals: _.decimals })}.`), P === null) x.push(b === "timelock" ? "Choose an unlock date." : "Set a start date, a cliff and a duration in whole days.");
|
|
592
|
+
else if (S !== null) for (const f of da({ currency: C, amount: S, beneficiary: O ?? "", schedule: P, nowSeconds: _.now, lock: o })) x.push(f.message);
|
|
593
|
+
}
|
|
594
|
+
const X = ne(n, e.wallet, e.account, e.onDone), Q = _ !== null && S !== null && S > 0n && P !== null && O !== null && x.length === 0 && e.account !== null && X.state.k !== "running", de = Q ? ea({ native: c, allowance: _.allowance, amount: S, amountText: g.trim(), symbol: _.symbol }) : [], Ce = () => {
|
|
595
|
+
if (!Q) return;
|
|
596
|
+
const f = de.map((W) => ({
|
|
597
|
+
label: W.label,
|
|
598
|
+
build: W.key === "approve" ? async () => ma({ token: C, spender: o, amount: S }) : async () => ka({ lock: o, currency: C, amount: S, beneficiary: O, schedule: P, terms: await Ne(n, o) })
|
|
599
|
+
}));
|
|
600
|
+
X.run(f);
|
|
601
|
+
};
|
|
602
|
+
return /* @__PURE__ */ t("div", { className: "latch-locker__form", children: [
|
|
603
|
+
/* @__PURE__ */ t("div", { className: "latch-locker__choice", role: "radiogroup", "aria-label": "Currency", children: [
|
|
604
|
+
/* @__PURE__ */ t("label", { children: [
|
|
605
|
+
/* @__PURE__ */ a("input", { type: "radio", checked: !c, onChange: () => l(!1) }),
|
|
606
|
+
" ERC-20 token"
|
|
607
|
+
] }),
|
|
608
|
+
/* @__PURE__ */ t("label", { children: [
|
|
609
|
+
/* @__PURE__ */ a("input", { type: "radio", checked: c, onChange: () => l(!0) }),
|
|
610
|
+
" Native ",
|
|
611
|
+
s.symbol
|
|
612
|
+
] })
|
|
613
|
+
] }),
|
|
614
|
+
c ? null : /* @__PURE__ */ t("label", { className: "latch-locker__field", children: [
|
|
615
|
+
/* @__PURE__ */ a("span", { children: "Token address" }),
|
|
616
|
+
/* @__PURE__ */ a("input", { className: "latch-locker__input", value: u, onChange: (f) => d(f.target.value), placeholder: "0x…", spellCheck: !1 })
|
|
617
|
+
] }),
|
|
618
|
+
/* @__PURE__ */ t("div", { className: "latch-locker__row2", children: [
|
|
619
|
+
/* @__PURE__ */ t("label", { className: "latch-locker__field", children: [
|
|
620
|
+
/* @__PURE__ */ t("span", { children: [
|
|
621
|
+
"Amount",
|
|
622
|
+
_ !== null ? ` (${_.symbol})` : ""
|
|
623
|
+
] }),
|
|
624
|
+
/* @__PURE__ */ a("input", { className: "latch-locker__input", inputMode: "decimal", value: g, onChange: (f) => N(f.target.value), placeholder: "0.0" })
|
|
625
|
+
] }),
|
|
626
|
+
/* @__PURE__ */ t("label", { className: "latch-locker__field", children: [
|
|
627
|
+
/* @__PURE__ */ a("span", { children: "Beneficiary" }),
|
|
628
|
+
/* @__PURE__ */ a("input", { className: "latch-locker__input", value: v, onChange: (f) => L(f.target.value), placeholder: e.account === null ? "0x…" : `${E(e.account)} (you)`, spellCheck: !1 })
|
|
629
|
+
] })
|
|
630
|
+
] }),
|
|
631
|
+
_ !== null && _.balance !== null ? /* @__PURE__ */ t("p", { className: "latch-note", children: [
|
|
632
|
+
"Balance ",
|
|
633
|
+
I(_.balance, { symbol: _.symbol, decimals: _.decimals })
|
|
634
|
+
] }) : null,
|
|
635
|
+
/* @__PURE__ */ t("div", { className: "latch-locker__choice", role: "radiogroup", "aria-label": "Schedule", children: [
|
|
636
|
+
/* @__PURE__ */ t("label", { children: [
|
|
637
|
+
/* @__PURE__ */ a("input", { type: "radio", checked: b === "timelock", onChange: () => h("timelock") }),
|
|
638
|
+
" Time lock (all at one date)"
|
|
639
|
+
] }),
|
|
640
|
+
/* @__PURE__ */ t("label", { children: [
|
|
641
|
+
/* @__PURE__ */ a("input", { type: "radio", checked: b === "vesting", onChange: () => h("vesting") }),
|
|
642
|
+
" Vesting (cliff, then linear)"
|
|
643
|
+
] })
|
|
644
|
+
] }),
|
|
645
|
+
b === "timelock" ? /* @__PURE__ */ t("label", { className: "latch-locker__field", children: [
|
|
646
|
+
/* @__PURE__ */ a("span", { children: "Unlock (UTC)" }),
|
|
647
|
+
/* @__PURE__ */ a("input", { className: "latch-locker__input", type: "datetime-local", value: p, onChange: (f) => r(f.target.value) })
|
|
648
|
+
] }) : /* @__PURE__ */ t(U, { children: [
|
|
649
|
+
/* @__PURE__ */ t("label", { className: "latch-locker__field", children: [
|
|
650
|
+
/* @__PURE__ */ a("span", { children: "Vesting starts (UTC)" }),
|
|
651
|
+
/* @__PURE__ */ a("input", { className: "latch-locker__input", type: "datetime-local", value: k, onChange: (f) => y(f.target.value) })
|
|
652
|
+
] }),
|
|
653
|
+
/* @__PURE__ */ t("div", { className: "latch-locker__row2", children: [
|
|
654
|
+
/* @__PURE__ */ t("label", { className: "latch-locker__field", children: [
|
|
655
|
+
/* @__PURE__ */ a("span", { children: "Cliff (days after start)" }),
|
|
656
|
+
/* @__PURE__ */ a("input", { className: "latch-locker__input", inputMode: "numeric", value: T, onChange: (f) => m(f.target.value) })
|
|
657
|
+
] }),
|
|
658
|
+
/* @__PURE__ */ t("label", { className: "latch-locker__field", children: [
|
|
659
|
+
/* @__PURE__ */ a("span", { children: "Fully vested (days after start)" }),
|
|
660
|
+
/* @__PURE__ */ a("input", { className: "latch-locker__input", inputMode: "numeric", value: B, onChange: (f) => M(f.target.value) })
|
|
661
|
+
] })
|
|
662
|
+
] })
|
|
663
|
+
] }),
|
|
664
|
+
P !== null && b === "vesting" ? /* @__PURE__ */ t("p", { className: "latch-note", children: [
|
|
665
|
+
"Nothing claimable before ",
|
|
666
|
+
w(P.cliff),
|
|
667
|
+
"; everything vested at ",
|
|
668
|
+
w(P.end),
|
|
669
|
+
"."
|
|
670
|
+
] }) : null,
|
|
671
|
+
P !== null && b === "vesting" && _ !== null && S !== null && S > 0n ? (() => {
|
|
672
|
+
const f = _e([{ ...P, amount: S }], _.now);
|
|
673
|
+
return f === null ? null : /* @__PURE__ */ a(ye, { points: f.points, total: f.total, now: _.now, token: { symbol: _.symbol, decimals: _.decimals } });
|
|
674
|
+
})() : null,
|
|
675
|
+
x.length > 0 ? /* @__PURE__ */ a("ul", { className: "latch-locker__issues", children: x.map((f) => /* @__PURE__ */ a("li", { children: f }, f)) }) : null,
|
|
676
|
+
/* @__PURE__ */ a(Se, { terms: e.fee, native: s }),
|
|
677
|
+
/* @__PURE__ */ a("p", { className: "latch-note", children: "The schedule is fixed at creation: no key can shorten, revoke or redirect it. The beneficiary claims what has vested, to any address." }),
|
|
678
|
+
/* @__PURE__ */ a("button", { type: "button", className: "latch-cta", disabled: !Q, onClick: Ce, children: de.length > 1 ? "Approve and lock" : "Lock tokens" }),
|
|
679
|
+
/* @__PURE__ */ a(ie, { state: X.state, explorerTxUrl: e.props.explorerTxUrl })
|
|
680
|
+
] });
|
|
681
|
+
}
|
|
682
|
+
function Aa(e) {
|
|
683
|
+
const { client: n, contracts: i } = e.props, o = aa(n, i, e.account), s = ne(n, e.wallet, e.account, o.refetch), [c, l] = A({}), u = e.props.native ?? re, d = le(
|
|
684
|
+
async () => {
|
|
685
|
+
const r = [...new Set((o.data?.tokens ?? []).map((y) => y.currency.toLowerCase()))], k = {};
|
|
686
|
+
return await Promise.all(
|
|
687
|
+
r.map(async (y) => {
|
|
688
|
+
if (y === pe) k[y] = u;
|
|
689
|
+
else {
|
|
690
|
+
const [T, m] = await Promise.all([
|
|
691
|
+
n.readContract({ address: y, abi: F, functionName: "symbol" }).catch(() => E(y)),
|
|
692
|
+
n.readContract({ address: y, abi: F, functionName: "decimals" }).catch(() => null)
|
|
693
|
+
]);
|
|
694
|
+
k[y] = { symbol: T, decimals: m === null ? null : Number(m) };
|
|
695
|
+
}
|
|
696
|
+
})
|
|
697
|
+
), k;
|
|
698
|
+
},
|
|
699
|
+
[n, (o.data?.tokens ?? []).map((r) => r.currency).join(",")],
|
|
700
|
+
{ enabled: (o.data?.tokens.length ?? 0) > 0 }
|
|
701
|
+
);
|
|
702
|
+
if (e.account === null) return /* @__PURE__ */ a("p", { className: "latch-trust__state", children: "Connect a wallet to see its locks." });
|
|
703
|
+
if (o.data === null)
|
|
704
|
+
return o.status === "error" ? /* @__PURE__ */ t("p", { className: "latch-locker__status", "data-kind": "error", children: [
|
|
705
|
+
"The locks could not be read: the chain did not answer.",
|
|
706
|
+
" ",
|
|
707
|
+
/* @__PURE__ */ a("button", { type: "button", className: "latch-trust__retry", onClick: o.refetch, children: "Retry" })
|
|
708
|
+
] }) : /* @__PURE__ */ a("p", { className: "latch-trust__state", children: "Reading this wallet’s locks…" });
|
|
709
|
+
const { positions: g, tokens: N, now: v } = o.data, L = s.state.k === "running", b = (r, k) => void s.run([{ label: r, build: k }]), h = i.positionLock, p = i.tokenLock;
|
|
710
|
+
return /* @__PURE__ */ t("div", { className: "latch-locker__form", children: [
|
|
711
|
+
g.length === 0 && N.length === 0 ? /* @__PURE__ */ a("p", { className: "latch-trust__state", children: "This wallet owns no lock and has been offered none." }) : null,
|
|
712
|
+
h !== null && g.length > 0 ? /* @__PURE__ */ a("ul", { className: "latch-locks__list", children: g.map((r) => {
|
|
713
|
+
const k = ta(r, e.account, v), y = r.tokenId.toString(), T = H(c[y] ?? "");
|
|
714
|
+
return /* @__PURE__ */ t("li", { className: "latch-locks__item", "data-status": r.withdrawn ? "withdrawn" : v < r.unlockAt ? "locked" : "unlockable", children: [
|
|
715
|
+
/* @__PURE__ */ t("div", { className: "latch-locks__row", children: [
|
|
716
|
+
/* @__PURE__ */ t("strong", { children: [
|
|
717
|
+
"Position #",
|
|
718
|
+
y
|
|
719
|
+
] }),
|
|
720
|
+
/* @__PURE__ */ a("span", { className: "latch-locks__status", children: r.withdrawn ? "Withdrawn" : v < r.unlockAt ? "Locked" : "Unlockable" })
|
|
721
|
+
] }),
|
|
722
|
+
/* @__PURE__ */ t("p", { className: "latch-note", children: [
|
|
723
|
+
"Unlocks ",
|
|
724
|
+
w(r.unlockAt),
|
|
725
|
+
" · pool ",
|
|
726
|
+
r.poolId.slice(0, 10),
|
|
727
|
+
"…",
|
|
728
|
+
r.pendingOwner !== null ? ` · offered to ${E(r.pendingOwner)}` : ""
|
|
729
|
+
] }),
|
|
730
|
+
k.includes("extend") ? /* @__PURE__ */ t("label", { className: "latch-locker__field", children: [
|
|
731
|
+
/* @__PURE__ */ a("span", { children: "New unlock (UTC), later than the current one" }),
|
|
732
|
+
/* @__PURE__ */ a("input", { className: "latch-locker__input", type: "datetime-local", value: c[y] ?? K(r.unlockAt), onChange: (m) => l({ ...c, [y]: m.target.value }) })
|
|
733
|
+
] }) : null,
|
|
734
|
+
/* @__PURE__ */ a("div", { className: "latch-locker__actions", children: k.map((m) => /* @__PURE__ */ a(
|
|
735
|
+
"button",
|
|
736
|
+
{
|
|
737
|
+
type: "button",
|
|
738
|
+
className: "latch-locker__btn",
|
|
739
|
+
disabled: L || m === "extend" && (T === null || T <= r.unlockAt),
|
|
740
|
+
onClick: () => b(
|
|
741
|
+
`${he[m]}: position #${y}`,
|
|
742
|
+
async () => m === "collect" ? _a({ lock: h, tokenId: r.tokenId }) : m === "extend" ? fa({ lock: h, tokenId: r.tokenId, newUnlockAt: T }) : m === "withdraw" ? ba({ lock: h, tokenId: r.tokenId, to: e.account }) : pa({ lock: h, tokenId: r.tokenId })
|
|
743
|
+
),
|
|
744
|
+
children: he[m]
|
|
745
|
+
},
|
|
746
|
+
m
|
|
747
|
+
)) })
|
|
748
|
+
] }, y);
|
|
749
|
+
}) }) : null,
|
|
750
|
+
p !== null && N.length > 0 ? /* @__PURE__ */ a("ul", { className: "latch-locks__list", children: N.map((r) => {
|
|
751
|
+
const k = d.data?.[r.currency.toLowerCase()] ?? { symbol: E(r.currency), decimals: null }, y = la(r, e.account);
|
|
752
|
+
return /* @__PURE__ */ t("li", { className: "latch-locks__item", "data-status": r.status, children: [
|
|
753
|
+
/* @__PURE__ */ t("div", { className: "latch-locks__row", children: [
|
|
754
|
+
/* @__PURE__ */ t("strong", { children: [
|
|
755
|
+
"Lock #",
|
|
756
|
+
r.lockId.toString()
|
|
757
|
+
] }),
|
|
758
|
+
/* @__PURE__ */ a("span", { className: "latch-locks__status", children: r.status === "cliff" ? "Before cliff" : r.status === "vesting" ? "Vesting" : r.status === "vested" ? "Fully vested" : "Claimed" })
|
|
759
|
+
] }),
|
|
760
|
+
/* @__PURE__ */ a("div", { className: "latch-progress", role: "img", "aria-label": `${R(Y(r))} vested`, children: /* @__PURE__ */ a("div", { className: "latch-progress-fill", style: { width: `${Y(r) / 100}%` } }) }),
|
|
761
|
+
/* @__PURE__ */ t("p", { className: "latch-note", children: [
|
|
762
|
+
I(r.amount, k),
|
|
763
|
+
" · claimable ",
|
|
764
|
+
I(r.claimable, k),
|
|
765
|
+
" · ",
|
|
766
|
+
r.start === r.end ? `unlocks ${w(r.end)}` : `vests ${w(r.start)} → ${w(r.end)}`
|
|
767
|
+
] }),
|
|
768
|
+
/* @__PURE__ */ a("div", { className: "latch-locker__actions", children: y.map((T) => /* @__PURE__ */ a(
|
|
769
|
+
"button",
|
|
770
|
+
{
|
|
771
|
+
type: "button",
|
|
772
|
+
className: "latch-locker__btn",
|
|
773
|
+
disabled: L,
|
|
774
|
+
onClick: () => b(
|
|
775
|
+
`${me[T]}: lock #${r.lockId}`,
|
|
776
|
+
async () => T === "claim" ? ga({ lock: p, lockId: r.lockId, to: e.account }) : Na({ lock: p, lockId: r.lockId })
|
|
777
|
+
),
|
|
778
|
+
children: me[T]
|
|
779
|
+
},
|
|
780
|
+
T
|
|
781
|
+
)) })
|
|
782
|
+
] }, r.lockId.toString());
|
|
783
|
+
}) }) : null,
|
|
784
|
+
/* @__PURE__ */ a(ie, { state: s.state, explorerTxUrl: e.props.explorerTxUrl })
|
|
785
|
+
] });
|
|
786
|
+
}
|
|
787
|
+
function Oa(e) {
|
|
788
|
+
const n = te(), i = e.theme ?? n?.theme ?? "system", o = ce();
|
|
789
|
+
q(() => {
|
|
790
|
+
se();
|
|
791
|
+
}, []);
|
|
792
|
+
const s = Xe(e.wallet), l = Qe(s).data ?? null, u = ze(e.client, e.contracts), d = e.contracts.positionLock !== null, g = e.contracts.tokenLock !== null, [N, v] = A(e.defaultTab ?? (d ? "position" : "token")), L = sa(() => u.refetch(), [u.refetch]), b = e.onConnectRequest ?? n?.onConnectRequest, h = be(() => {
|
|
793
|
+
const r = [];
|
|
794
|
+
return d && r.push({ key: "position", label: "Lock liquidity" }), g && r.push({ key: "token", label: "Lock tokens" }), r.push({ key: "mine", label: "My locks" }), r;
|
|
795
|
+
}, [d, g]), p = (r) => u.data === null ? u.status === "error" ? null : void 0 : u.data[r];
|
|
796
|
+
return /* @__PURE__ */ t("section", { className: `latch-widget latch-locker${e.className ? ` ${e.className}` : ""}`, "data-latch-theme": i, "aria-labelledby": o, children: [
|
|
797
|
+
/* @__PURE__ */ t("header", { className: "latch-header latch-brand", children: [
|
|
798
|
+
e.brandMarkUrl !== void 0 ? /* @__PURE__ */ a("img", { className: "latch-brand__mark", src: e.brandMarkUrl, width: 665, height: 765, alt: "" }) : null,
|
|
799
|
+
/* @__PURE__ */ a("h2", { id: o, className: "latch-title", children: e.title ?? "Lock with Latch" })
|
|
800
|
+
] }),
|
|
801
|
+
!d && !g ? /* @__PURE__ */ a("p", { className: "latch-trust__state", role: "status", children: "Latch locks are coming soon on this chain." }) : /* @__PURE__ */ t(U, { children: [
|
|
802
|
+
/* @__PURE__ */ a("div", { className: "latch-locker__tabs", role: "tablist", children: h.map((r) => /* @__PURE__ */ a("button", { type: "button", role: "tab", className: "latch-locker__tab", "aria-selected": N === r.key, onClick: () => v(r.key), children: r.label }, r.key)) }),
|
|
803
|
+
l === null ? /* @__PURE__ */ a("button", { type: "button", className: "latch-cta", disabled: b === void 0, onClick: b, children: "Connect wallet" }) : /* @__PURE__ */ t("p", { className: "latch-note", children: [
|
|
804
|
+
"Connected ",
|
|
805
|
+
E(l)
|
|
806
|
+
] }),
|
|
807
|
+
N === "position" && d ? /* @__PURE__ */ a(wa, { props: e, account: l, wallet: s, fee: p("position"), onDone: L }) : null,
|
|
808
|
+
N === "token" && g ? /* @__PURE__ */ a(Ta, { props: e, account: l, wallet: s, fee: p("token"), onDone: L }) : null,
|
|
809
|
+
N === "mine" ? /* @__PURE__ */ a(Aa, { props: e, account: l, wallet: s }) : null
|
|
810
|
+
] }),
|
|
811
|
+
/* @__PURE__ */ a("p", { className: "latch-footer latch-footer--brand", children: "Fees read live from the lock contracts · every call simulated first" })
|
|
812
|
+
] });
|
|
813
|
+
}
|
|
814
|
+
export {
|
|
815
|
+
Da as ACTIONS,
|
|
816
|
+
Wa as ADDRESS_THIS,
|
|
817
|
+
Xn as ActionButton,
|
|
818
|
+
Va as ActionPlan,
|
|
819
|
+
Qn as AmountField,
|
|
820
|
+
Ga as BIN_DISTRIBUTION_SCALE,
|
|
821
|
+
Ha as BPS,
|
|
822
|
+
Ka as BPS_DENOMINATOR,
|
|
823
|
+
ja as COMMANDS,
|
|
824
|
+
Xa as CONTRACT_BALANCE,
|
|
825
|
+
Qa as ChainConfigError,
|
|
826
|
+
za as DEFAULT_PORTIONS,
|
|
827
|
+
Za as DEFAULT_SLIPPAGE_BPS,
|
|
828
|
+
Ya as ERC20_ABI,
|
|
829
|
+
zn as ErrorPanel,
|
|
830
|
+
Zn as FeeDecayChart,
|
|
831
|
+
Ja as HIGH_PRICE_IMPACT_BPS,
|
|
832
|
+
et as INITIAL_SWAP_STATE,
|
|
833
|
+
at as IntegratorConfigError,
|
|
834
|
+
tt as LAUNCH_FEE_DENOMINATOR,
|
|
835
|
+
fs as LAUNCH_GUARD_HOOK_ABI,
|
|
836
|
+
bs as LAUNCH_GUARD_HOOK_BLOCK_ABI,
|
|
837
|
+
Yn as LaunchSchedulePanel,
|
|
838
|
+
Jn as LaunchUnavailable,
|
|
839
|
+
es as LaunchV2Widget,
|
|
840
|
+
as as LaunchWidget,
|
|
841
|
+
ts as LiquidityWidget,
|
|
842
|
+
Oa as LockerWidget,
|
|
843
|
+
$a as LocksBadge,
|
|
844
|
+
Ua as LocksPanel,
|
|
845
|
+
lt as MAX_INTEGRATOR_FEE_BPS,
|
|
846
|
+
nt as MAX_SLIPPAGE_BPS,
|
|
847
|
+
st as MAX_TICK,
|
|
848
|
+
ct as MAX_UINT160,
|
|
849
|
+
ot as MAX_UINT256,
|
|
850
|
+
rt as MAX_UINT48,
|
|
851
|
+
it as MIN_TICK,
|
|
852
|
+
dt as MSG_SENDER,
|
|
853
|
+
ls as MaxBuyNotice,
|
|
854
|
+
ns as MockBanner,
|
|
855
|
+
ut as NATIVE_SENTINEL,
|
|
856
|
+
ht as NO_INTEGRATOR_FEE,
|
|
857
|
+
mt as NoRouteError,
|
|
858
|
+
Un as NoSaleAdapterError,
|
|
859
|
+
kt as OPEN_DELTA,
|
|
860
|
+
_t as PERMIT2_ABI,
|
|
861
|
+
ft as PIPS,
|
|
862
|
+
bt as POOL_KEY_COMPONENTS,
|
|
863
|
+
he as POSITION_ACTION_LABEL,
|
|
864
|
+
pt as POSITION_MANAGER_ABI,
|
|
865
|
+
We as POSITION_STATUS_LABEL,
|
|
866
|
+
ss as ProgressBar,
|
|
867
|
+
gt as Q96,
|
|
868
|
+
cs as RouteSummary,
|
|
869
|
+
Nt as SEVERE_PRICE_IMPACT_BPS,
|
|
870
|
+
os as SegmentedControl,
|
|
871
|
+
rs as StatusRegion,
|
|
872
|
+
is as SummaryList,
|
|
873
|
+
ds as SummaryRow,
|
|
874
|
+
us as SwapWidget,
|
|
875
|
+
me as TOKEN_ACTION_LABEL,
|
|
876
|
+
Ve as TOKEN_STATUS_LABEL,
|
|
877
|
+
Ma as TokenTrustPanel,
|
|
878
|
+
Mn as TransactionRevertedError,
|
|
879
|
+
yt as UNIVERSAL_ROUTER_ABI,
|
|
880
|
+
vt as UnsupportedOperationError,
|
|
881
|
+
hs as WIDGET_CSS,
|
|
882
|
+
Lt as WalletNotConnectedError,
|
|
883
|
+
wt as WidgetContext,
|
|
884
|
+
Tt as WidgetProvider,
|
|
885
|
+
ms as WidgetShell,
|
|
886
|
+
At as ZERO_ADDRESS,
|
|
887
|
+
It as adjustRange,
|
|
888
|
+
St as advanceChainNow,
|
|
889
|
+
Ct as amountsForLiquidity,
|
|
890
|
+
Pt as assertTickMathSelfConsistent,
|
|
891
|
+
xt as assertValidChainConfig,
|
|
892
|
+
Et as balancePortion,
|
|
893
|
+
$e as binPoolBadgeView,
|
|
894
|
+
Bt as binShareAmounts,
|
|
895
|
+
Oe as binShareBar,
|
|
896
|
+
Rt as binStepOf,
|
|
897
|
+
$t as binTokenId,
|
|
898
|
+
Ut as blockWindows,
|
|
899
|
+
On as buildBinAddCall,
|
|
900
|
+
Fn as buildBinRemoveCall,
|
|
901
|
+
qn as buildCLDecreaseCall,
|
|
902
|
+
Dn as buildCLMintCall,
|
|
903
|
+
Mt as buildLaunchBuyCall,
|
|
904
|
+
Ot as buildLaunchView,
|
|
905
|
+
Ft as buildQuoteBreakdown,
|
|
906
|
+
qt as buildSwapCall,
|
|
907
|
+
Dt as buildSwapPlan,
|
|
908
|
+
Wt as buildSwapQuoteView,
|
|
909
|
+
Wn as buildUniformBinDistribution,
|
|
910
|
+
Vt as calculateIntegratorFee,
|
|
911
|
+
Gt as ceilTickToSpacing,
|
|
912
|
+
Ht as chainDeadline,
|
|
913
|
+
Kt as clRangeSide,
|
|
914
|
+
jt as clampBigInt,
|
|
915
|
+
Xt as combineTokens,
|
|
916
|
+
ks as connectCtaProps,
|
|
917
|
+
Vn as createViemAdapter,
|
|
918
|
+
Qt as decodeLaunchGuard,
|
|
919
|
+
zt as decodeRevertName,
|
|
920
|
+
Zt as defaultDeadline,
|
|
921
|
+
Yt as defaultRangeFor,
|
|
922
|
+
Jt as describeError,
|
|
923
|
+
el as describeRange,
|
|
924
|
+
al as evaluateLaunchBuy,
|
|
925
|
+
tl as exchangeRate,
|
|
926
|
+
ll as explorerTxUrl,
|
|
927
|
+
nl as fetchPoolLocks,
|
|
928
|
+
sl as fetchTokenLocks,
|
|
929
|
+
Gn as fetchTokenTrust,
|
|
930
|
+
cl as findToken,
|
|
931
|
+
ol as floorTickToSpacing,
|
|
932
|
+
rl as formatAmount,
|
|
933
|
+
il as formatBps,
|
|
934
|
+
j as formatCountdown,
|
|
935
|
+
dl as formatDuration,
|
|
936
|
+
I as formatLockAmount,
|
|
937
|
+
R as formatLockBps,
|
|
938
|
+
ul as formatPercentFromBps,
|
|
939
|
+
hl as formatPercentFromPips,
|
|
940
|
+
ml as formatRate,
|
|
941
|
+
kl as formatTimestamp,
|
|
942
|
+
w as formatUtc,
|
|
943
|
+
_l as getAmount0Delta,
|
|
944
|
+
fl as getAmount1Delta,
|
|
945
|
+
bl as getLiquidityForAmount0,
|
|
946
|
+
pl as getLiquidityForAmount1,
|
|
947
|
+
gl as getLiquidityForAmounts,
|
|
948
|
+
Nl as getSqrtRatioAtTick,
|
|
949
|
+
yl as groupBySource,
|
|
950
|
+
Hn as hasSaleAdapter,
|
|
951
|
+
vl as hopIsLaunchBuy,
|
|
952
|
+
Ll as initialSwapState,
|
|
953
|
+
se as injectWidgetStyles,
|
|
954
|
+
wl as isLaunchConfigured,
|
|
955
|
+
Tl as isLaunchKitNotConfigured,
|
|
956
|
+
Al as isLaunchpadNotConfigured,
|
|
957
|
+
Il as isTokenListUrl,
|
|
958
|
+
Sl as launchFeeAt,
|
|
959
|
+
Cl as launchGuardAbiFor,
|
|
960
|
+
Pl as launchScheduleAt,
|
|
961
|
+
De as lockPageUrl,
|
|
962
|
+
Je as lockSchedule,
|
|
963
|
+
na as lockerFeeView,
|
|
964
|
+
xl as maximumSpent,
|
|
965
|
+
El as minimumReceived,
|
|
966
|
+
Bl as nextBlockClock,
|
|
967
|
+
Rl as normalizePair,
|
|
968
|
+
$l as normalizePortions,
|
|
969
|
+
Ul as oppositeSide,
|
|
970
|
+
Ml as orientPair,
|
|
971
|
+
Ol as pairEntryAddress,
|
|
972
|
+
Fl as pairKey,
|
|
973
|
+
ql as pairedAmountForRange,
|
|
974
|
+
Dl as parseAmount,
|
|
975
|
+
ue as parseDays,
|
|
976
|
+
Ye as parseLockAmount,
|
|
977
|
+
H as parseUtcInput,
|
|
978
|
+
Wl as pipsOf,
|
|
979
|
+
Vl as plan,
|
|
980
|
+
Ze as planPositionLock,
|
|
981
|
+
ea as planTokenLock,
|
|
982
|
+
Ue as poolBadgeView,
|
|
983
|
+
Gl as poolEmbedView,
|
|
984
|
+
ps as poolKeyToTuple,
|
|
985
|
+
Hl as poolLocksEnabled,
|
|
986
|
+
Fe as poolShareBar,
|
|
987
|
+
Kl as portionAmountText,
|
|
988
|
+
jl as portionLabel,
|
|
989
|
+
Xl as portionOf,
|
|
990
|
+
ta as positionLockActions,
|
|
991
|
+
Ql as priceImpactBps,
|
|
992
|
+
zl as priceImpactSeverity,
|
|
993
|
+
Zl as progressPercent,
|
|
994
|
+
_e as releaseSchedule,
|
|
995
|
+
Yl as requireContract,
|
|
996
|
+
Jl as resolveIntegratorConfig,
|
|
997
|
+
en as resolveLaunchDataState,
|
|
998
|
+
an as resolveLogoUrl,
|
|
999
|
+
tn as resolvePairEntry,
|
|
1000
|
+
ln as routeSymbols,
|
|
1001
|
+
nn as scanClLpLockerTokenIds,
|
|
1002
|
+
sn as shareBarFromBps,
|
|
1003
|
+
Z as shortAddress,
|
|
1004
|
+
Kn as simulateSendConfirm,
|
|
1005
|
+
cn as splitIntegratorFee,
|
|
1006
|
+
on as swapWidgetReducer,
|
|
1007
|
+
rn as tickSpacingOf,
|
|
1008
|
+
K as toUtcInput,
|
|
1009
|
+
Me as tokenBadgeView,
|
|
1010
|
+
Re as tokenEmbedView,
|
|
1011
|
+
la as tokenLockActions,
|
|
1012
|
+
qe as tokenShareBar,
|
|
1013
|
+
je as tokenTrustView,
|
|
1014
|
+
dn as tokensFromLists,
|
|
1015
|
+
un as tokensFromMergedList,
|
|
1016
|
+
hn as uncollectedFees,
|
|
1017
|
+
mn as unorientPair,
|
|
1018
|
+
kn as useAccount,
|
|
1019
|
+
_n as useAddLiquidityExecute,
|
|
1020
|
+
fn as useAddLiquidityQuote,
|
|
1021
|
+
le as useAsyncResource,
|
|
1022
|
+
fe as useChainClock,
|
|
1023
|
+
bn as useIntegrator,
|
|
1024
|
+
pn as useLaunch,
|
|
1025
|
+
gn as useLaunchBuy,
|
|
1026
|
+
Nn as useLaunchList,
|
|
1027
|
+
yn as useLaunchesForToken,
|
|
1028
|
+
Qe as useLockerAccount,
|
|
1029
|
+
ze as useLockerFees,
|
|
1030
|
+
ne as useLockerRunner,
|
|
1031
|
+
Xe as useLockerWallet,
|
|
1032
|
+
aa as useMyLocks,
|
|
1033
|
+
te as useOptionalWidgetContext,
|
|
1034
|
+
Ge as usePoolLocks,
|
|
1035
|
+
vn as usePoolState,
|
|
1036
|
+
Ln as usePools,
|
|
1037
|
+
wn as usePositions,
|
|
1038
|
+
Tn as useProtocolAdapter,
|
|
1039
|
+
An as useRemoveLiquidity,
|
|
1040
|
+
In as useSlippageSetting,
|
|
1041
|
+
Sn as useSwapExecute,
|
|
1042
|
+
Cn as useSwapQuote,
|
|
1043
|
+
Pn as useTokenBalance,
|
|
1044
|
+
xn as useTokenList,
|
|
1045
|
+
En as useTokenLists,
|
|
1046
|
+
He as useTokenLocks,
|
|
1047
|
+
Ke as useTokenTrust,
|
|
1048
|
+
Bn as useWidgetContext,
|
|
1049
|
+
Rn as validateIntegratorConfig,
|
|
1050
|
+
Y as vestedBps
|
|
1051
|
+
};
|
|
1052
|
+
//# sourceMappingURL=index.js.map
|