@latchprotocol/widgets 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -1
- package/dist/chunks/{SwapWidget-DgyHAVc8.js → SwapWidget-CwkRtOfn.js} +58 -66
- package/dist/chunks/SwapWidget-CwkRtOfn.js.map +1 -0
- package/dist/chunks/{useLocker-D1c_NTk-.js → useLocker-CGpgCh75.js} +641 -641
- package/dist/chunks/{useLocker-D1c_NTk-.js.map → useLocker-CGpgCh75.js.map} +1 -1
- package/dist/components/LaunchWidget.d.ts.map +1 -1
- package/dist/embed.js +12 -12
- package/dist/embed.js.map +1 -1
- package/dist/headless.js +1 -1
- package/dist/index.js +87 -87
- package/dist/index.js.map +1 -1
- package/dist/latch-embed.js +1 -1
- package/dist/latch-embed.js.map +1 -1
- package/dist/latch-embed.mjs +4 -5
- package/dist/latch-embed.mjs.map +1 -1
- package/dist/trust/model.d.ts +4 -3
- package/dist/trust/model.d.ts.map +1 -1
- package/package.json +1 -5
- package/dist/chunks/SwapWidget-DgyHAVc8.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { ay as
|
|
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
|
|
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-
|
|
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-
|
|
5
|
-
import { i as se } from "./chunks/SwapWidget-
|
|
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-
|
|
1
|
+
import { ay as $, aD as w, ax as C, av as j, bi as _e, bL as te, bw as $e, V as Re, 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 Ct, F as It, G as St, J as Pt, K as xt, R as Et, X as Bt, _ as $t, $ as Rt, 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 Cl, aS as Il, aT as Sl, aU as Pl, aW as xl, aX as El, aY as Bl, aZ as $l, a_ as Rl, 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 Cn, bS as In, bT as Sn, bU as Pn, bV as xn, bW as En, bX as Bn, bY as $n } 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-CGpgCh75.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-CGpgCh75.js";
|
|
5
|
+
import { i as se } from "./chunks/SwapWidget-CwkRtOfn.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-CwkRtOfn.js";
|
|
7
7
|
import { jsxs as t, jsx as a, Fragment as U } from "react/jsx-runtime";
|
|
8
8
|
import { useState as A, useMemo as be, useId as ce, useEffect as q, useCallback as sa } from "react";
|
|
9
9
|
import { isAddress as J, getAddress as ee, zeroAddress as pe, erc20Abi as F } from "viem";
|
|
10
10
|
import { CL_POSITION_MANAGER_ABI as ke } from "@latchprotocol/sdk";
|
|
11
11
|
import { LAUNCH_GUARD_HOOK_ABI as fs, LAUNCH_GUARD_HOOK_BLOCK_ABI as bs, poolKeyToTuple as ps } from "@latchprotocol/sdk";
|
|
12
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%" :
|
|
13
|
+
const z = (e) => e.bps === 0 && e.nonZero ? "<0.01%" : $(e.bps);
|
|
14
14
|
function oe({ view: e, label: n, keyed: i = !0 }) {
|
|
15
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"}, ${
|
|
16
|
+
return /* @__PURE__ */ t("div", { className: "latch-sharebar", role: "img", "aria-label": `${n}: ${o || "nothing locked"}, ${$(e.restBps)} not locked, ${e.of}`, children: [
|
|
17
17
|
/* @__PURE__ */ a("div", { className: "latch-sharebar__track", children: /* @__PURE__ */ a("div", { className: "latch-sharebar__grow", children: e.parts.map((s) => /* @__PURE__ */ a(
|
|
18
18
|
"span",
|
|
19
19
|
{
|
|
@@ -31,7 +31,7 @@ function oe({ view: e, label: n, keyed: i = !0 }) {
|
|
|
31
31
|
] }, s.key)) }) : null
|
|
32
32
|
] });
|
|
33
33
|
}
|
|
34
|
-
const V = 240,
|
|
34
|
+
const V = 240, R = 44;
|
|
35
35
|
function ye({
|
|
36
36
|
points: e,
|
|
37
37
|
total: n,
|
|
@@ -40,7 +40,7 @@ function ye({
|
|
|
40
40
|
}) {
|
|
41
41
|
const [s, c] = A(null), l = be(() => {
|
|
42
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) =>
|
|
43
|
+
const b = Number(e[0].t), h = Number(e[e.length - 1].t), p = (k) => (Number(k) - b) / (h - b) * V, r = (k) => R - 3 - Number(k * 10000n / n) / 1e4 * (R - 6);
|
|
44
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
45
|
}, [e, n]);
|
|
46
46
|
if (l === null) return null;
|
|
@@ -57,27 +57,27 @@ function ye({
|
|
|
57
57
|
"svg",
|
|
58
58
|
{
|
|
59
59
|
className: "latch-spark__svg",
|
|
60
|
-
viewBox: `0 0 ${V} ${
|
|
60
|
+
viewBox: `0 0 ${V} ${R}`,
|
|
61
61
|
preserveAspectRatio: "none",
|
|
62
62
|
tabIndex: 0,
|
|
63
63
|
role: "img",
|
|
64
|
-
"aria-label": `Release schedule from ${w(u.t)} to ${w(d.t)}, ${
|
|
64
|
+
"aria-label": `Release schedule from ${w(u.t)} to ${w(d.t)}, ${C(n, o)} in all. Arrow keys read points.`,
|
|
65
65
|
onPointerMove: N,
|
|
66
66
|
onPointerLeave: () => c(null),
|
|
67
67
|
onKeyDown: v,
|
|
68
68
|
onBlur: () => c(null),
|
|
69
69
|
children: [
|
|
70
|
-
/* @__PURE__ */ a("line", { className: "latch-spark__base", x1: 0, x2: V, y1:
|
|
70
|
+
/* @__PURE__ */ a("line", { className: "latch-spark__base", x1: 0, x2: V, y1: R - 3, y2: R - 3, vectorEffect: "non-scaling-stroke" }),
|
|
71
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:
|
|
73
|
-
L !== null ? /* @__PURE__ */ a("line", { className: "latch-spark__cross", x1: l.x(L.t), x2: l.x(L.t), y1: 1, y2:
|
|
72
|
+
g !== null ? /* @__PURE__ */ a("line", { className: "latch-spark__now", x1: g, x2: g, y1: 1, y2: R - 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: R - 3, vectorEffect: "non-scaling-stroke" }) : null
|
|
74
74
|
]
|
|
75
75
|
}
|
|
76
76
|
),
|
|
77
77
|
/* @__PURE__ */ a("figcaption", { className: "latch-spark__cap", "aria-live": "polite", children: L !== null ? /* @__PURE__ */ t(U, { children: [
|
|
78
78
|
/* @__PURE__ */ a("span", { className: "latch-locks__timer", children: w(L.t) }),
|
|
79
79
|
" · ",
|
|
80
|
-
|
|
80
|
+
C(L.vested, o),
|
|
81
81
|
" vested"
|
|
82
82
|
] }) : /* @__PURE__ */ t(U, { children: [
|
|
83
83
|
"Release schedule ",
|
|
@@ -117,10 +117,10 @@ function ae({ props: e }) {
|
|
|
117
117
|
}
|
|
118
118
|
function we(e, n = "default") {
|
|
119
119
|
if (e.res.data === null) return null;
|
|
120
|
-
if (n === "embed" && e.kind === "token") return
|
|
120
|
+
if (n === "embed" && e.kind === "token") return $e(e.res.data);
|
|
121
121
|
if (e.kind === "pool") {
|
|
122
122
|
const s = e.res.data;
|
|
123
|
-
return s.bin !== null ?
|
|
123
|
+
return s.bin !== null ? Re(s.bin, s.currency0, s.currency1) : Ue(s.summary);
|
|
124
124
|
}
|
|
125
125
|
const i = e.res.data, o = { locks: [], totalHeld: 0n, unvested: 0n, heldBps: null, unvestedBps: null, nextCliffOrEnd: null, lastEnd: null, totalSupply: null };
|
|
126
126
|
return Me(i.summary ?? o, i.token, i.permanent);
|
|
@@ -138,9 +138,9 @@ function Ae({ l: e, target: n }) {
|
|
|
138
138
|
return ya(n) === null ? /* @__PURE__ */ t("p", { className: "latch-locks__headline", children: [
|
|
139
139
|
/* @__PURE__ */ a("span", { className: "latch-locks__dot latch-locks__dot--none", "aria-hidden": "true" }),
|
|
140
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: "
|
|
141
|
+
] }) : e.res.status === "error" && e.res.data === null ? /* @__PURE__ */ a("p", { className: "latch-locks__headline latch-locks__headline--error", role: "status", children: "Couldn’t load locks. Try again." }) : e.res.data === null ? /* @__PURE__ */ a("p", { className: "latch-locks__headline latch-locks__headline--muted", role: "status", children: "Loading locks…" }) : null;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function Ra(e) {
|
|
144
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
145
|
return /* @__PURE__ */ t(
|
|
146
146
|
"div",
|
|
@@ -163,7 +163,7 @@ function $a(e) {
|
|
|
163
163
|
] }),
|
|
164
164
|
e.brandMarkUrl !== void 0 ? /* @__PURE__ */ t("p", { className: "latch-brand", children: [
|
|
165
165
|
/* @__PURE__ */ a("img", { className: "latch-brand__mark", src: e.brandMarkUrl, width: 665, height: 765, alt: "Latch" }),
|
|
166
|
-
/* @__PURE__ */ a("span", { children: "
|
|
166
|
+
/* @__PURE__ */ a("span", { children: "Live from the chain" }),
|
|
167
167
|
/* @__PURE__ */ a("span", { className: "latch-brand__spacer" }),
|
|
168
168
|
/* @__PURE__ */ a(ae, { props: e })
|
|
169
169
|
] }) : /* @__PURE__ */ a(ae, { props: e })
|
|
@@ -199,7 +199,7 @@ function Ua(e) {
|
|
|
199
199
|
l !== null && o.kind === "token" ? /* @__PURE__ */ a(ye, { points: l.points, total: l.total, now: d, token: o.res.data.token }) : null,
|
|
200
200
|
o.kind === "pool" ? /* @__PURE__ */ a(va, { data: o.res.data, now: d }) : /* @__PURE__ */ a(La, { data: o.res.data, now: d })
|
|
201
201
|
] }),
|
|
202
|
-
/* @__PURE__ */ a("p", { className: "latch-footer latch-footer--brand", children: "
|
|
202
|
+
/* @__PURE__ */ a("p", { className: "latch-footer latch-footer--brand", children: "Live from the chain" })
|
|
203
203
|
]
|
|
204
204
|
}
|
|
205
205
|
);
|
|
@@ -230,9 +230,9 @@ function va({ data: e, now: n }) {
|
|
|
230
230
|
l.amount0 !== null && l.amount1 !== null ? /* @__PURE__ */ t("div", { children: [
|
|
231
231
|
/* @__PURE__ */ a("dt", { children: "Holds now" }),
|
|
232
232
|
/* @__PURE__ */ t("dd", { title: `Liquidity ${l.liquidity.toLocaleString("en-US")}`, children: [
|
|
233
|
-
|
|
233
|
+
C(l.amount0, e.currency0),
|
|
234
234
|
" + ",
|
|
235
|
-
|
|
235
|
+
C(l.amount1, e.currency1),
|
|
236
236
|
l.inRange === !1 ? " · out of range" : ""
|
|
237
237
|
] })
|
|
238
238
|
] }) : /* @__PURE__ */ t("div", { children: [
|
|
@@ -245,7 +245,7 @@ function va({ data: e, now: n }) {
|
|
|
245
245
|
] }),
|
|
246
246
|
/* @__PURE__ */ t("div", { children: [
|
|
247
247
|
/* @__PURE__ */ a("dt", { children: "Share of active" }),
|
|
248
|
-
/* @__PURE__ */ a("dd", { children: u === null ? "—" :
|
|
248
|
+
/* @__PURE__ */ a("dd", { children: u === null ? "—" : $(u) })
|
|
249
249
|
] }),
|
|
250
250
|
/* @__PURE__ */ t("div", { children: [
|
|
251
251
|
/* @__PURE__ */ a("dt", { children: "Unlocks" }),
|
|
@@ -273,9 +273,9 @@ function va({ data: e, now: n }) {
|
|
|
273
273
|
/* @__PURE__ */ t("div", { children: [
|
|
274
274
|
/* @__PURE__ */ a("dt", { children: "Holds now" }),
|
|
275
275
|
/* @__PURE__ */ t("dd", { children: [
|
|
276
|
-
|
|
276
|
+
C(l.amount0, e.currency0),
|
|
277
277
|
" + ",
|
|
278
|
-
|
|
278
|
+
C(l.amount1, e.currency1)
|
|
279
279
|
] })
|
|
280
280
|
] }),
|
|
281
281
|
/* @__PURE__ */ t("div", { children: [
|
|
@@ -302,9 +302,9 @@ function va({ data: e, now: n }) {
|
|
|
302
302
|
l.amount0 !== null && l.amount1 !== null ? /* @__PURE__ */ t("div", { children: [
|
|
303
303
|
/* @__PURE__ */ a("dt", { children: "Holds now" }),
|
|
304
304
|
/* @__PURE__ */ t("dd", { title: l.liquidity === null ? void 0 : `Liquidity ${l.liquidity.toLocaleString("en-US")}`, children: [
|
|
305
|
-
|
|
305
|
+
C(l.amount0, e.currency0),
|
|
306
306
|
" + ",
|
|
307
|
-
|
|
307
|
+
C(l.amount1, e.currency1),
|
|
308
308
|
l.inRange === !1 ? " · out of range" : ""
|
|
309
309
|
] })
|
|
310
310
|
] }) : /* @__PURE__ */ t("div", { children: [
|
|
@@ -316,7 +316,7 @@ function va({ data: e, now: n }) {
|
|
|
316
316
|
] }),
|
|
317
317
|
/* @__PURE__ */ t("div", { children: [
|
|
318
318
|
/* @__PURE__ */ a("dt", { children: "Share of active" }),
|
|
319
|
-
/* @__PURE__ */ a("dd", { children: u === null ? "—" :
|
|
319
|
+
/* @__PURE__ */ a("dd", { children: u === null ? "—" : $(u) })
|
|
320
320
|
] }),
|
|
321
321
|
/* @__PURE__ */ t("div", { children: [
|
|
322
322
|
/* @__PURE__ */ a("dt", { children: "Unlocks" }),
|
|
@@ -355,8 +355,8 @@ function La({ data: e, now: n }) {
|
|
|
355
355
|
" in the locked liquidity"
|
|
356
356
|
] }),
|
|
357
357
|
/* @__PURE__ */ t("dd", { children: [
|
|
358
|
-
|
|
359
|
-
s !== null && s > 0n ? ` · ${
|
|
358
|
+
C(c.amount, e.token),
|
|
359
|
+
s !== null && s > 0n ? ` · ${$(Number(c.amount * 10000n / s))} of supply` : ""
|
|
360
360
|
] })
|
|
361
361
|
] }),
|
|
362
362
|
/* @__PURE__ */ t("div", { children: [
|
|
@@ -386,13 +386,13 @@ function La({ data: e, now: n }) {
|
|
|
386
386
|
] }),
|
|
387
387
|
/* @__PURE__ */ t("div", { children: [
|
|
388
388
|
/* @__PURE__ */ a("dt", { children: "Amount" }),
|
|
389
|
-
/* @__PURE__ */ a("dd", { children:
|
|
389
|
+
/* @__PURE__ */ a("dd", { children: C(c.amount, e.token) })
|
|
390
390
|
] }),
|
|
391
391
|
/* @__PURE__ */ t("div", { children: [
|
|
392
392
|
/* @__PURE__ */ a("dt", { children: "Still held" }),
|
|
393
393
|
/* @__PURE__ */ t("dd", { children: [
|
|
394
|
-
|
|
395
|
-
u !== null ? ` · ${
|
|
394
|
+
C(l, e.token),
|
|
395
|
+
u !== null ? ` · ${$(u)} of supply` : ""
|
|
396
396
|
] })
|
|
397
397
|
] }),
|
|
398
398
|
/* @__PURE__ */ t("div", { children: [
|
|
@@ -406,12 +406,12 @@ function La({ data: e, now: n }) {
|
|
|
406
406
|
] })
|
|
407
407
|
] })
|
|
408
408
|
] }),
|
|
409
|
-
/* @__PURE__ */ a("div", { className: "latch-progress", role: "img", "aria-label": `${
|
|
409
|
+
/* @__PURE__ */ a("div", { className: "latch-progress", role: "img", "aria-label": `${$(g)} vested`, children: /* @__PURE__ */ a("div", { className: "latch-progress-fill", style: { width: `${g / 100}%` } }) })
|
|
410
410
|
] }, c.lockId.toString());
|
|
411
411
|
})
|
|
412
412
|
] });
|
|
413
413
|
}
|
|
414
|
-
function
|
|
414
|
+
function Ce(e) {
|
|
415
415
|
return e === void 0 || e === "_self" ? {} : { target: e, rel: "noopener noreferrer" };
|
|
416
416
|
}
|
|
417
417
|
function G({ r: e, props: n }) {
|
|
@@ -426,7 +426,7 @@ function G({ r: e, props: n }) {
|
|
|
426
426
|
e.detail !== null ? /* @__PURE__ */ a("p", { className: "latch-trust__detail", children: e.detail }) : null,
|
|
427
427
|
e.sources.length > 0 ? /* @__PURE__ */ a("p", { className: "latch-trust__source", children: e.sources.map((i, o) => {
|
|
428
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, ...
|
|
429
|
+
return /* @__PURE__ */ a("span", { className: "latch-trust__source-item", children: s === null ? c : /* @__PURE__ */ a("a", { href: s, ...Ce(n.linkTarget ?? "_blank"), children: c }) }, `${i.address}${o}`);
|
|
430
430
|
}) }) : null
|
|
431
431
|
] })
|
|
432
432
|
] });
|
|
@@ -439,10 +439,10 @@ function Ma(e) {
|
|
|
439
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
440
|
let u;
|
|
441
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
|
-
"
|
|
442
|
+
"Couldn’t load. Try again.",
|
|
443
443
|
" ",
|
|
444
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: "
|
|
445
|
+
] }) : l === null ? u = /* @__PURE__ */ a("p", { className: "latch-trust__state", role: "status", children: "Loading…" }) : u = /* @__PURE__ */ t(U, { children: [
|
|
446
446
|
/* @__PURE__ */ t("dl", { className: "latch-trust__list", children: [
|
|
447
447
|
/* @__PURE__ */ a(G, { r: l.launch, props: e }),
|
|
448
448
|
/* @__PURE__ */ a(G, { r: l.tokenLocks, props: e }),
|
|
@@ -459,7 +459,7 @@ function Ma(e) {
|
|
|
459
459
|
"…",
|
|
460
460
|
d.poolId.slice(-6)
|
|
461
461
|
] }),
|
|
462
|
-
g !== null ? /* @__PURE__ */ a("a", { className: "latch-trust__link", href: g, ...
|
|
462
|
+
g !== null ? /* @__PURE__ */ a("a", { className: "latch-trust__link", href: g, ...Ce(e.linkTarget), children: "Locks →" }) : null
|
|
463
463
|
] }),
|
|
464
464
|
/* @__PURE__ */ a("p", { className: "latch-trust__found", children: d.foundBy }),
|
|
465
465
|
/* @__PURE__ */ a("dl", { className: "latch-trust__list", children: d.rows.map((N) => /* @__PURE__ */ a(G, { r: N, props: e }, N.key)) })
|
|
@@ -496,9 +496,9 @@ function ie({ state: e, explorerTxUrl: n }) {
|
|
|
496
496
|
] })
|
|
497
497
|
] });
|
|
498
498
|
}
|
|
499
|
-
function
|
|
500
|
-
if (e === void 0) return /* @__PURE__ */ a("p", { className: "latch-locker__fee", children: "
|
|
501
|
-
if (e === null) return /* @__PURE__ */ a("p", { className: "latch-locker__fee", children: "
|
|
499
|
+
function Ie({ terms: e, native: n }) {
|
|
500
|
+
if (e === void 0) return /* @__PURE__ */ a("p", { className: "latch-locker__fee", children: "Loading the fee…" });
|
|
501
|
+
if (e === null) return /* @__PURE__ */ a("p", { className: "latch-locker__fee", children: "Couldn’t load the fee. Try again." });
|
|
502
502
|
const i = na(e, n);
|
|
503
503
|
return /* @__PURE__ */ t("p", { className: "latch-locker__fee", children: [
|
|
504
504
|
/* @__PURE__ */ t("span", { children: [
|
|
@@ -514,13 +514,13 @@ function Se({ terms: e, native: n }) {
|
|
|
514
514
|
function wa(e) {
|
|
515
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
516
|
async () => {
|
|
517
|
-
const m = await ca(n, o), B = N, [M,
|
|
517
|
+
const m = await ca(n, o), B = N, [M, S, O, D] = await Promise.all([
|
|
518
518
|
n.readContract({ address: m.positionManager, abi: ke, functionName: "ownerOf", args: [B] }).catch(() => null),
|
|
519
519
|
n.readContract({ address: m.positionManager, abi: ke, functionName: "positions", args: [B] }).catch(() => null),
|
|
520
520
|
e.account === null ? Promise.resolve(!1) : oa(n, { positionManager: m.positionManager, lock: o, tokenId: B, owner: e.account }).catch(() => !1),
|
|
521
521
|
ge(n)
|
|
522
522
|
]);
|
|
523
|
-
return { ctx: m, nftOwner: M, liquidity:
|
|
523
|
+
return { ctx: m, nftOwner: M, liquidity: S === null ? null : S[3], approved: O, now: D };
|
|
524
524
|
},
|
|
525
525
|
[n, o, N, e.account],
|
|
526
526
|
{ enabled: N !== null }
|
|
@@ -550,7 +550,7 @@ function wa(e) {
|
|
|
550
550
|
h.liquidity.toLocaleString("en-US"),
|
|
551
551
|
h.approved ? " · already approved to the lock" : ""
|
|
552
552
|
] }) : null,
|
|
553
|
-
b.status === "error" ? /* @__PURE__ */ a("p", { className: "latch-locker__status", "data-kind": "error", children: "
|
|
553
|
+
b.status === "error" ? /* @__PURE__ */ a("p", { className: "latch-locker__status", "data-kind": "error", children: "Couldn’t load the position. Try again." }) : null,
|
|
554
554
|
/* @__PURE__ */ t("div", { className: "latch-locker__row2", children: [
|
|
555
555
|
/* @__PURE__ */ t("label", { className: "latch-locker__field", children: [
|
|
556
556
|
/* @__PURE__ */ a("span", { children: "Unlock (UTC)" }),
|
|
@@ -562,16 +562,16 @@ function wa(e) {
|
|
|
562
562
|
] })
|
|
563
563
|
] }),
|
|
564
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(
|
|
565
|
+
/* @__PURE__ */ a(Ie, { terms: e.fee, native: e.props.native ?? re }),
|
|
566
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
567
|
/* @__PURE__ */ a("button", { type: "button", className: "latch-cta", disabled: !k, onClick: T, children: y.length > 1 ? "Approve and lock" : "Lock position" }),
|
|
568
568
|
/* @__PURE__ */ a(ie, { state: r.state, explorerTxUrl: e.props.explorerTxUrl })
|
|
569
569
|
] });
|
|
570
570
|
}
|
|
571
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"),
|
|
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"), S = 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
573
|
async () => {
|
|
574
|
-
const f =
|
|
574
|
+
const f = S, [W, Pe, xe, Ee, Be] = await Promise.all([
|
|
575
575
|
c ? Promise.resolve(s.symbol) : n.readContract({ address: f, abi: F, functionName: "symbol" }),
|
|
576
576
|
c ? Promise.resolve(s.decimals) : n.readContract({ address: f, abi: F, functionName: "decimals" }),
|
|
577
577
|
e.account === null ? Promise.resolve(null) : c ? n.getBalance({ address: e.account }) : n.readContract({ address: f, abi: F, functionName: "balanceOf", args: [e.account] }),
|
|
@@ -580,22 +580,22 @@ function Ta(e) {
|
|
|
580
580
|
]);
|
|
581
581
|
return { symbol: W, decimals: Number(Pe), balance: xe, allowance: Ee, now: Be };
|
|
582
582
|
},
|
|
583
|
-
[n,
|
|
584
|
-
{ enabled:
|
|
583
|
+
[n, S, c, e.account, o],
|
|
584
|
+
{ enabled: S !== null }
|
|
585
585
|
), _ = D.data;
|
|
586
586
|
q(() => {
|
|
587
587
|
_ !== null && (p === "" && r(K(_.now + 30n * 86400n)), k === "" && y(K(_.now + 3600n)));
|
|
588
588
|
}, [_, p, k]);
|
|
589
|
-
const
|
|
590
|
-
if (!c && u.trim() !== "" &&
|
|
591
|
-
if (g.trim() !== "" &&
|
|
592
|
-
else if (
|
|
589
|
+
const I = _ === 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() !== "" && S === 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() !== "" && I === null && x.push(`Enter an amount with at most ${_.decimals} decimals.`), I !== null && _.balance !== null && I > _.balance && x.push(`The connected wallet holds ${C(_.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 (I !== null) for (const f of da({ currency: S, amount: I, beneficiary: O ?? "", schedule: P, nowSeconds: _.now, lock: o })) x.push(f.message);
|
|
593
593
|
}
|
|
594
|
-
const X = ne(n, e.wallet, e.account, e.onDone), Q = _ !== null &&
|
|
594
|
+
const X = ne(n, e.wallet, e.account, e.onDone), Q = _ !== null && I !== null && I > 0n && P !== null && O !== null && x.length === 0 && e.account !== null && X.state.k !== "running", de = Q ? ea({ native: c, allowance: _.allowance, amount: I, amountText: g.trim(), symbol: _.symbol }) : [], Se = () => {
|
|
595
595
|
if (!Q) return;
|
|
596
596
|
const f = de.map((W) => ({
|
|
597
597
|
label: W.label,
|
|
598
|
-
build: W.key === "approve" ? async () => ma({ token:
|
|
598
|
+
build: W.key === "approve" ? async () => ma({ token: S, spender: o, amount: I }) : async () => ka({ lock: o, currency: S, amount: I, beneficiary: O, schedule: P, terms: await Ne(n, o) })
|
|
599
599
|
}));
|
|
600
600
|
X.run(f);
|
|
601
601
|
};
|
|
@@ -630,7 +630,7 @@ function Ta(e) {
|
|
|
630
630
|
] }),
|
|
631
631
|
_ !== null && _.balance !== null ? /* @__PURE__ */ t("p", { className: "latch-note", children: [
|
|
632
632
|
"Balance ",
|
|
633
|
-
|
|
633
|
+
C(_.balance, { symbol: _.symbol, decimals: _.decimals })
|
|
634
634
|
] }) : null,
|
|
635
635
|
/* @__PURE__ */ t("div", { className: "latch-locker__choice", role: "radiogroup", "aria-label": "Schedule", children: [
|
|
636
636
|
/* @__PURE__ */ t("label", { children: [
|
|
@@ -668,14 +668,14 @@ function Ta(e) {
|
|
|
668
668
|
w(P.end),
|
|
669
669
|
"."
|
|
670
670
|
] }) : null,
|
|
671
|
-
P !== null && b === "vesting" && _ !== null &&
|
|
672
|
-
const f = _e([{ ...P, amount:
|
|
671
|
+
P !== null && b === "vesting" && _ !== null && I !== null && I > 0n ? (() => {
|
|
672
|
+
const f = _e([{ ...P, amount: I }], _.now);
|
|
673
673
|
return f === null ? null : /* @__PURE__ */ a(ye, { points: f.points, total: f.total, now: _.now, token: { symbol: _.symbol, decimals: _.decimals } });
|
|
674
674
|
})() : null,
|
|
675
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(
|
|
676
|
+
/* @__PURE__ */ a(Ie, { terms: e.fee, native: s }),
|
|
677
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:
|
|
678
|
+
/* @__PURE__ */ a("button", { type: "button", className: "latch-cta", disabled: !Q, onClick: Se, children: de.length > 1 ? "Approve and lock" : "Lock tokens" }),
|
|
679
679
|
/* @__PURE__ */ a(ie, { state: X.state, explorerTxUrl: e.props.explorerTxUrl })
|
|
680
680
|
] });
|
|
681
681
|
}
|
|
@@ -702,10 +702,10 @@ function Aa(e) {
|
|
|
702
702
|
if (e.account === null) return /* @__PURE__ */ a("p", { className: "latch-trust__state", children: "Connect a wallet to see its locks." });
|
|
703
703
|
if (o.data === null)
|
|
704
704
|
return o.status === "error" ? /* @__PURE__ */ t("p", { className: "latch-locker__status", "data-kind": "error", children: [
|
|
705
|
-
"
|
|
705
|
+
"Couldn’t load the locks.",
|
|
706
706
|
" ",
|
|
707
707
|
/* @__PURE__ */ a("button", { type: "button", className: "latch-trust__retry", onClick: o.refetch, children: "Retry" })
|
|
708
|
-
] }) : /* @__PURE__ */ a("p", { className: "latch-trust__state", children: "
|
|
708
|
+
] }) : /* @__PURE__ */ a("p", { className: "latch-trust__state", children: "Loading your locks…" });
|
|
709
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
710
|
return /* @__PURE__ */ t("div", { className: "latch-locker__form", children: [
|
|
711
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,
|
|
@@ -757,11 +757,11 @@ function Aa(e) {
|
|
|
757
757
|
] }),
|
|
758
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
759
|
] }),
|
|
760
|
-
/* @__PURE__ */ a("div", { className: "latch-progress", role: "img", "aria-label": `${
|
|
760
|
+
/* @__PURE__ */ a("div", { className: "latch-progress", role: "img", "aria-label": `${$(Y(r))} vested`, children: /* @__PURE__ */ a("div", { className: "latch-progress-fill", style: { width: `${Y(r) / 100}%` } }) }),
|
|
761
761
|
/* @__PURE__ */ t("p", { className: "latch-note", children: [
|
|
762
|
-
|
|
762
|
+
C(r.amount, k),
|
|
763
763
|
" · claimable ",
|
|
764
|
-
|
|
764
|
+
C(r.claimable, k),
|
|
765
765
|
" · ",
|
|
766
766
|
r.start === r.end ? `unlocks ${w(r.end)}` : `vests ${w(r.start)} → ${w(r.end)}`
|
|
767
767
|
] }),
|
|
@@ -840,7 +840,7 @@ export {
|
|
|
840
840
|
as as LaunchWidget,
|
|
841
841
|
ts as LiquidityWidget,
|
|
842
842
|
Oa as LockerWidget,
|
|
843
|
-
|
|
843
|
+
Ra as LocksBadge,
|
|
844
844
|
Ua as LocksPanel,
|
|
845
845
|
lt as MAX_INTEGRATOR_FEE_BPS,
|
|
846
846
|
nt as MAX_SLIPPAGE_BPS,
|
|
@@ -884,17 +884,17 @@ export {
|
|
|
884
884
|
Tt as WidgetProvider,
|
|
885
885
|
ms as WidgetShell,
|
|
886
886
|
At as ZERO_ADDRESS,
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
887
|
+
Ct as adjustRange,
|
|
888
|
+
It as advanceChainNow,
|
|
889
|
+
St as amountsForLiquidity,
|
|
890
890
|
Pt as assertTickMathSelfConsistent,
|
|
891
891
|
xt as assertValidChainConfig,
|
|
892
892
|
Et as balancePortion,
|
|
893
|
-
|
|
893
|
+
Re as binPoolBadgeView,
|
|
894
894
|
Bt as binShareAmounts,
|
|
895
895
|
Oe as binShareBar,
|
|
896
|
-
|
|
897
|
-
|
|
896
|
+
$t as binStepOf,
|
|
897
|
+
Rt as binTokenId,
|
|
898
898
|
Ut as blockWindows,
|
|
899
899
|
On as buildBinAddCall,
|
|
900
900
|
Fn as buildBinRemoveCall,
|
|
@@ -933,8 +933,8 @@ export {
|
|
|
933
933
|
il as formatBps,
|
|
934
934
|
j as formatCountdown,
|
|
935
935
|
dl as formatDuration,
|
|
936
|
-
|
|
937
|
-
|
|
936
|
+
C as formatLockAmount,
|
|
937
|
+
$ as formatLockBps,
|
|
938
938
|
ul as formatPercentFromBps,
|
|
939
939
|
hl as formatPercentFromPips,
|
|
940
940
|
ml as formatRate,
|
|
@@ -954,9 +954,9 @@ export {
|
|
|
954
954
|
wl as isLaunchConfigured,
|
|
955
955
|
Tl as isLaunchKitNotConfigured,
|
|
956
956
|
Al as isLaunchpadNotConfigured,
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
957
|
+
Cl as isTokenListUrl,
|
|
958
|
+
Il as launchFeeAt,
|
|
959
|
+
Sl as launchGuardAbiFor,
|
|
960
960
|
Pl as launchScheduleAt,
|
|
961
961
|
De as lockPageUrl,
|
|
962
962
|
Je as lockSchedule,
|
|
@@ -964,8 +964,8 @@ export {
|
|
|
964
964
|
xl as maximumSpent,
|
|
965
965
|
El as minimumReceived,
|
|
966
966
|
Bl as nextBlockClock,
|
|
967
|
-
|
|
968
|
-
|
|
967
|
+
$l as normalizePair,
|
|
968
|
+
Rl as normalizePortions,
|
|
969
969
|
Ul as oppositeSide,
|
|
970
970
|
Ml as orientPair,
|
|
971
971
|
Ol as pairEntryAddress,
|
|
@@ -1007,7 +1007,7 @@ export {
|
|
|
1007
1007
|
rn as tickSpacingOf,
|
|
1008
1008
|
K as toUtcInput,
|
|
1009
1009
|
Me as tokenBadgeView,
|
|
1010
|
-
|
|
1010
|
+
$e as tokenEmbedView,
|
|
1011
1011
|
la as tokenLockActions,
|
|
1012
1012
|
qe as tokenShareBar,
|
|
1013
1013
|
je as tokenTrustView,
|
|
@@ -1037,16 +1037,16 @@ export {
|
|
|
1037
1037
|
wn as usePositions,
|
|
1038
1038
|
Tn as useProtocolAdapter,
|
|
1039
1039
|
An as useRemoveLiquidity,
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1040
|
+
Cn as useSlippageSetting,
|
|
1041
|
+
In as useSwapExecute,
|
|
1042
|
+
Sn as useSwapQuote,
|
|
1043
1043
|
Pn as useTokenBalance,
|
|
1044
1044
|
xn as useTokenList,
|
|
1045
1045
|
En as useTokenLists,
|
|
1046
1046
|
He as useTokenLocks,
|
|
1047
1047
|
Ke as useTokenTrust,
|
|
1048
1048
|
Bn as useWidgetContext,
|
|
1049
|
-
|
|
1049
|
+
$n as validateIntegratorConfig,
|
|
1050
1050
|
Y as vestedBps
|
|
1051
1051
|
};
|
|
1052
1052
|
//# sourceMappingURL=index.js.map
|