@seedprotocol/eas 0.7.9-next.1177.ga3e08ed → 0.7.9-next.1306.g4ff6582
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 +1 -1
- package/dist/EasClient/createEasGraphQLClient.d.ts +8 -1
- package/dist/EasClient/createEasGraphQLClient.d.ts.map +1 -1
- package/dist/{QueryClient-Ns40c8jS.js → QueryClient-D3BW5tJk.js} +171 -86
- package/dist/QueryClient-D3BW5tJk.js.map +1 -0
- package/dist/api.d.ts +0 -10
- package/dist/api.d.ts.map +1 -1
- package/dist/default/EasClient.d.ts +2 -0
- package/dist/default/EasClient.d.ts.map +1 -1
- package/dist/easTiming.d.ts +27 -0
- package/dist/easTiming.d.ts.map +1 -0
- package/dist/easValues.d.ts +7 -0
- package/dist/easValues.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +337 -318
- package/dist/index.js.map +1 -1
- package/dist/modelSchemas.d.ts +33 -0
- package/dist/modelSchemas.d.ts.map +1 -0
- package/dist/node/EasClient.d.ts +17 -0
- package/dist/node/EasClient.d.ts.map +1 -1
- package/dist/node/easDispatcher.d.ts +26 -0
- package/dist/node/easDispatcher.d.ts.map +1 -0
- package/dist/node/index.d.ts +12 -2
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node.js +33 -8
- package/dist/node.js.map +1 -1
- package/dist/stores/schemaUidCache.d.ts +5 -0
- package/dist/stores/schemaUidCache.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/QueryClient-Ns40c8jS.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { C as e, S as t,
|
|
2
|
-
import { keccak_256 as
|
|
3
|
-
import { bytesToHex as
|
|
1
|
+
import { C as e, S as t, T as n, _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as ee, m as te, n as ne, o as re, p as ie, r as ae, s as oe, t as se, u as ce, v as le, w as ue, x as f, y as de } from "./QueryClient-D3BW5tJk.js";
|
|
2
|
+
import { keccak_256 as fe } from "@noble/hashes/sha3";
|
|
3
|
+
import { bytesToHex as pe, utf8ToBytes as me } from "@noble/hashes/utils";
|
|
4
4
|
//#region src/keccak.ts
|
|
5
|
-
function
|
|
6
|
-
let t = typeof e == "string" ?
|
|
7
|
-
return
|
|
5
|
+
function p(e) {
|
|
6
|
+
let t = typeof e == "string" ? me(e) : e;
|
|
7
|
+
return pe(fe(t));
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/utils.ts
|
|
11
|
-
var
|
|
12
|
-
function
|
|
11
|
+
var m = (e) => e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
|
|
12
|
+
function h(e) {
|
|
13
13
|
let t = e.toLowerCase().replace(/^0x/, "");
|
|
14
14
|
if (t.length !== 40 || !/^[0-9a-f]+$/.test(t)) return e;
|
|
15
|
-
let n =
|
|
15
|
+
let n = p(t), r = "0x";
|
|
16
16
|
for (let e = 0; e < 40; e++) r += parseInt(n[e], 16) >= 8 ? t[e].toUpperCase() : t[e];
|
|
17
17
|
return r;
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/easPropertyCanonical.ts
|
|
21
|
-
var
|
|
21
|
+
var he = (e) => {
|
|
22
22
|
let t = /* @__PURE__ */ new Map();
|
|
23
23
|
for (let n of e) {
|
|
24
24
|
let e = n.schemaId;
|
|
@@ -28,16 +28,16 @@ var pe = (e) => {
|
|
|
28
28
|
}
|
|
29
29
|
return t;
|
|
30
30
|
};
|
|
31
|
-
function
|
|
32
|
-
let n =
|
|
31
|
+
function g(e, t) {
|
|
32
|
+
let n = he(e.filter((e) => !e.revoked));
|
|
33
33
|
if (t?.ifAllRevoked !== "newestRevoked") return [...n.values()];
|
|
34
|
-
let r =
|
|
34
|
+
let r = he(e.filter((e) => e.revoked));
|
|
35
35
|
for (let [e, t] of r) n.has(e) || n.set(e, t);
|
|
36
36
|
return [...n.values()];
|
|
37
37
|
}
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region src/easRefAttester.ts
|
|
40
|
-
function
|
|
40
|
+
function ge(e, t) {
|
|
41
41
|
let n = /* @__PURE__ */ new Map();
|
|
42
42
|
for (let e of t) e.attester && n.set(e.id, e.attester.toLowerCase());
|
|
43
43
|
let r = [], i = [];
|
|
@@ -50,12 +50,12 @@ function me(e, t) {
|
|
|
50
50
|
foreign: i
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
return
|
|
53
|
+
function _(e, t) {
|
|
54
|
+
return ge(e, t).kept;
|
|
55
55
|
}
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region src/easRevokedFilter.ts
|
|
58
|
-
function
|
|
58
|
+
function v(e) {
|
|
59
59
|
let t = { revoked: { equals: !1 } }, n = Array.isArray(e.AND) ? e.AND : [];
|
|
60
60
|
return {
|
|
61
61
|
...e,
|
|
@@ -64,7 +64,7 @@ function y(e) {
|
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
66
|
//#region src/constants.ts
|
|
67
|
-
var
|
|
67
|
+
var _e = "0x0000000000000000000000000000000000000000", ve = "0x", ye = "0x0000000000000000000000000000000000000000000000000000000000000000", be = typeof process < "u" && process.env?.NEXT_PUBLIC_EAS_ENDPOINT || typeof process < "u" && process.env?.EAS_ENDPOINT || "https://optimism-sepolia.easscan.org/graphql", xe = "bytes32 version", y = "0x13c0fd59d69dbce40501a41f8b37768d26dd2e2bb0cad64615334d84f7b9bdf6", Se = {
|
|
68
68
|
"\n fragment attestationFields on Attestation {\n id\n decodedDataJson\n attester\n refUID\n revoked\n revocationTime\n schemaId\n txid\n timeCreated\n time\n isOffchain\n }\n": {
|
|
69
69
|
kind: "Document",
|
|
70
70
|
definitions: [{
|
|
@@ -2469,208 +2469,193 @@ var he = "0x0000000000000000000000000000000000000000", ge = "0x", _e = "0x000000
|
|
|
2469
2469
|
}]
|
|
2470
2470
|
}
|
|
2471
2471
|
};
|
|
2472
|
-
function
|
|
2473
|
-
return
|
|
2472
|
+
function b(e) {
|
|
2473
|
+
return Se[e] ?? {};
|
|
2474
2474
|
}
|
|
2475
2475
|
//#endregion
|
|
2476
2476
|
//#region src/queries.ts
|
|
2477
|
-
var
|
|
2478
|
-
let
|
|
2477
|
+
var x = b("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), Ce = b("\n query GetSchemaByName($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), S = b("\n query GetSeeds($where: AttestationWhereInput!, $take: Int, $skip: Int) {\n itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }], take: $take, skip: $skip) {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n revocationTime\n schemaId\n timeCreated\n isOffchain\n }\n }\n"), C = b("\n query GetSeedsLean($where: AttestationWhereInput!, $take: Int, $skip: Int) {\n itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }], take: $take, skip: $skip) {\n id\n decodedDataJson\n attester\n refUID\n revoked\n revocationTime\n schemaId\n timeCreated\n isOffchain\n }\n }\n"), we = b("\n query GetDomainOwnerships($where: AttestationWhereInput!) {\n domainOwnerships: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n decodedDataJson\n attester\n recipient\n refUID\n revoked\n revocationTime\n expirationTime\n schemaId\n timeCreated\n }\n }\n"), Te = b("\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n"), Ee = b("\n query GetStorageTransactionId($where: AttestationWhereInput!) {\n storageTransactionId: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n id\n decodedDataJson\n }\n }\n"), w = b("\n query GetVersions($where: AttestationWhereInput!) {\n itemVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), T = b("\n query GetProperties($where: AttestationWhereInput!) {\n itemProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), De = b("\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\n allProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), Oe = b("\n query GetFilesMetadata($where: AttestationWhereInput!) {\n filesMetadata: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), ke = b("\n query GetImageSeeds($where: AttestationWhereInput!) {\n imageSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n schemaId\n txid\n timeCreated\n time\n isOffchain\n }\n }\n"), Ae = b("\n query GetImageVersions($where: AttestationWhereInput!) {\n imageVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), E = b("\n query GetAttestationChanges($where: AttestationWhereInput!) {\n changes: attestations(where: $where) {\n id\n refUID\n timeCreated\n revocationTime\n }\n }\n"), je = async ({ seedUids: e, excludeRevoked: n = !0 }) => {
|
|
2478
|
+
let r = f.getQueryClient(), a = t.getEasClient(), o = {
|
|
2479
2479
|
refUID: { in: e },
|
|
2480
|
-
schemaId: { equals:
|
|
2481
|
-
},
|
|
2480
|
+
schemaId: { equals: y }
|
|
2481
|
+
}, s = n ? v(o) : o, { itemVersions: c } = await i(r, {
|
|
2482
2482
|
queryKey: [
|
|
2483
2483
|
"getVersionsForAllModels",
|
|
2484
2484
|
[...e].sort(),
|
|
2485
|
-
|
|
2485
|
+
n
|
|
2486
2486
|
],
|
|
2487
|
-
queryFn: async () =>
|
|
2487
|
+
queryFn: async () => a.request(w, { where: s })
|
|
2488
2488
|
});
|
|
2489
|
-
return
|
|
2490
|
-
},
|
|
2491
|
-
let
|
|
2489
|
+
return c;
|
|
2490
|
+
}, D = async ({ versionUids: e, excludeRevoked: n = !0 }) => {
|
|
2491
|
+
let r = f.getQueryClient(), a = t.getEasClient(), o = n ? v({ refUID: { in: e } }) : { refUID: { in: e } }, { itemProperties: s } = await i(r, {
|
|
2492
2492
|
queryKey: [
|
|
2493
2493
|
"getPropertiesForAllModels",
|
|
2494
2494
|
[...e].sort(),
|
|
2495
|
-
|
|
2495
|
+
n
|
|
2496
2496
|
],
|
|
2497
|
-
queryFn: async () =>
|
|
2497
|
+
queryFn: async () => a.request(T, { where: o })
|
|
2498
2498
|
});
|
|
2499
|
-
return
|
|
2500
|
-
},
|
|
2501
|
-
let
|
|
2499
|
+
return s;
|
|
2500
|
+
}, Me = async ({ versionUids: e, excludeRevoked: n, checkAttesters: r = !0 }) => {
|
|
2501
|
+
let i = await D({
|
|
2502
2502
|
versionUids: e,
|
|
2503
|
-
excludeRevoked:
|
|
2503
|
+
excludeRevoked: n
|
|
2504
2504
|
});
|
|
2505
|
-
if (!
|
|
2506
|
-
let
|
|
2507
|
-
id: { in: [...new Set(
|
|
2508
|
-
schemaId: { equals:
|
|
2509
|
-
} }),
|
|
2510
|
-
where: { id: { in:
|
|
2511
|
-
take:
|
|
2505
|
+
if (!r || i.length === 0) return g(i);
|
|
2506
|
+
let a = t.getEasClient(), { itemVersions: o } = await a.request(w, { where: {
|
|
2507
|
+
id: { in: [...new Set(i.map((e) => e.refUID))] },
|
|
2508
|
+
schemaId: { equals: y }
|
|
2509
|
+
} }), s = [...new Set(o.map((e) => e.refUID))], { itemSeeds: c } = await a.request(C, {
|
|
2510
|
+
where: { id: { in: s } },
|
|
2511
|
+
take: s.length,
|
|
2512
2512
|
skip: 0
|
|
2513
|
-
}),
|
|
2514
|
-
return _(
|
|
2515
|
-
},
|
|
2516
|
-
let
|
|
2517
|
-
|
|
2518
|
-
let { schemas: r } = await t.fetchQuery({
|
|
2519
|
-
queryKey: ["getEasSchemaUidBySchemaName", e],
|
|
2520
|
-
queryFn: async () => n.request(S, { where: { schema: { endsWith: e } } })
|
|
2521
|
-
});
|
|
2522
|
-
if (r && r.length !== 0) return r[0].id;
|
|
2523
|
-
}, Pe = async ({ schemaName: e }) => {
|
|
2524
|
-
try {
|
|
2525
|
-
return await E({ schemaName: e });
|
|
2526
|
-
} catch (t) {
|
|
2527
|
-
process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for schema name ${e}:`, t);
|
|
2528
|
-
return;
|
|
2529
|
-
}
|
|
2530
|
-
}, Fe = async ({ schemaUids: e, addresses: t, excludeRevoked: n = !0 }) => {
|
|
2531
|
-
let r = {
|
|
2532
|
-
attester: { in: t.map((e) => {
|
|
2513
|
+
}), l = new Set(c.map((e) => e.id)), u = _(o.filter((e) => l.has(e.refUID)), c), d = new Set(u.map((e) => e.id));
|
|
2514
|
+
return g(_(i.filter((e) => d.has(e.refUID)), u));
|
|
2515
|
+
}, Ne = async ({ schemaUids: e, addresses: n, excludeRevoked: r = !0 }) => {
|
|
2516
|
+
let a = {
|
|
2517
|
+
attester: { in: n.map((e) => {
|
|
2533
2518
|
try {
|
|
2534
|
-
return
|
|
2519
|
+
return h(e);
|
|
2535
2520
|
} catch {
|
|
2536
2521
|
return e;
|
|
2537
2522
|
}
|
|
2538
2523
|
}) },
|
|
2539
2524
|
schemaId: { in: e }
|
|
2540
2525
|
};
|
|
2541
|
-
|
|
2542
|
-
let
|
|
2526
|
+
r && (a = v(a));
|
|
2527
|
+
let o = f.getQueryClient(), s = t.getEasClient(), { itemSeeds: c } = await i(o, {
|
|
2543
2528
|
queryKey: [
|
|
2544
2529
|
"getSeedsForAllModels",
|
|
2545
|
-
|
|
2530
|
+
r,
|
|
2546
2531
|
[...e].sort(),
|
|
2547
|
-
[...
|
|
2532
|
+
[...n].sort()
|
|
2548
2533
|
],
|
|
2549
|
-
queryFn: async () =>
|
|
2534
|
+
queryFn: async () => s.request(S, { where: a })
|
|
2550
2535
|
});
|
|
2551
|
-
return
|
|
2552
|
-
},
|
|
2553
|
-
let
|
|
2554
|
-
where:
|
|
2555
|
-
...
|
|
2536
|
+
return c;
|
|
2537
|
+
}, O = async (e, n = 10, r, a) => {
|
|
2538
|
+
let o = r ?? 0, s = a?.uidPrefix, c = {
|
|
2539
|
+
where: v({
|
|
2540
|
+
...s === void 0 ? {} : { id: { startsWith: s } },
|
|
2556
2541
|
schema: { is: { schemaNames: { some: { name: { equals: e } } } } }
|
|
2557
2542
|
}),
|
|
2558
|
-
take:
|
|
2559
|
-
skip:
|
|
2560
|
-
},
|
|
2543
|
+
take: n,
|
|
2544
|
+
skip: o
|
|
2545
|
+
}, l = f.getQueryClient(), u = t.getEasClient(), { itemSeeds: d } = await i(l, {
|
|
2561
2546
|
queryKey: [
|
|
2562
2547
|
"getSeedsBySchemaName",
|
|
2563
2548
|
e,
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2549
|
+
n,
|
|
2550
|
+
o,
|
|
2551
|
+
s ?? null
|
|
2567
2552
|
],
|
|
2568
|
-
queryFn: async () =>
|
|
2553
|
+
queryFn: async () => u.request(C, c)
|
|
2569
2554
|
});
|
|
2570
|
-
return
|
|
2571
|
-
},
|
|
2555
|
+
return d.map((t) => k(t, [e]));
|
|
2556
|
+
}, k = (e, t) => ({
|
|
2572
2557
|
...e,
|
|
2573
2558
|
schema: { schemaNames: t.map((e) => ({ name: e })) }
|
|
2574
|
-
}),
|
|
2559
|
+
}), A = /* @__PURE__ */ new Map(), Pe = (e) => {
|
|
2575
2560
|
let t = "";
|
|
2576
2561
|
try {
|
|
2577
|
-
t =
|
|
2562
|
+
t = o();
|
|
2578
2563
|
} catch {}
|
|
2579
2564
|
return `${t}\n${e.toLowerCase()}`;
|
|
2580
|
-
},
|
|
2581
|
-
|
|
2582
|
-
},
|
|
2583
|
-
let
|
|
2584
|
-
for (let
|
|
2585
|
-
let e =
|
|
2586
|
-
e ?
|
|
2565
|
+
}, Fe = () => {
|
|
2566
|
+
A.clear();
|
|
2567
|
+
}, Ie = async (e) => {
|
|
2568
|
+
let n = /* @__PURE__ */ new Map(), r = [];
|
|
2569
|
+
for (let t of new Set(e)) {
|
|
2570
|
+
let e = A.get(Pe(t));
|
|
2571
|
+
e ? n.set(t, e) : r.push(t);
|
|
2587
2572
|
}
|
|
2588
|
-
if (
|
|
2589
|
-
let
|
|
2590
|
-
queryKey: ["getSchemaNamesBySchemaUids", [...
|
|
2591
|
-
queryFn: async () =>
|
|
2592
|
-
}),
|
|
2593
|
-
for (let e of
|
|
2594
|
-
let
|
|
2595
|
-
r &&
|
|
2573
|
+
if (r.length === 0) return n;
|
|
2574
|
+
let a = f.getQueryClient(), o = t.getEasClient(), { schemas: s } = await i(a, {
|
|
2575
|
+
queryKey: ["getSchemaNamesBySchemaUids", [...r].sort()],
|
|
2576
|
+
queryFn: async () => o.request(x, { where: { id: { in: r } } })
|
|
2577
|
+
}), c = new Map(r.map((e) => [e.toLowerCase(), e]));
|
|
2578
|
+
for (let e of s ?? []) {
|
|
2579
|
+
let t = (e.schemaNames ?? []).map((e) => e.name), r = c.get(e.id.toLowerCase());
|
|
2580
|
+
r && t.length !== 0 && (A.set(Pe(r), t), n.set(r, t));
|
|
2596
2581
|
}
|
|
2597
|
-
return
|
|
2598
|
-
},
|
|
2582
|
+
return n;
|
|
2583
|
+
}, Le = async ({ uids: e, excludeRevoked: n = !0 }) => {
|
|
2599
2584
|
if (e.length === 0) return [];
|
|
2600
|
-
let
|
|
2585
|
+
let r = n ? v({ id: { in: e } }) : { id: { in: e } }, a = f.getQueryClient(), o = t.getEasClient(), { itemSeeds: s } = await i(a, {
|
|
2601
2586
|
queryKey: [
|
|
2602
2587
|
"getSeedsByUidsFromEas",
|
|
2603
2588
|
[...e].sort(),
|
|
2604
|
-
|
|
2589
|
+
n
|
|
2605
2590
|
],
|
|
2606
|
-
queryFn: async () =>
|
|
2607
|
-
where:
|
|
2591
|
+
queryFn: async () => o.request(C, {
|
|
2592
|
+
where: r,
|
|
2608
2593
|
take: e.length,
|
|
2609
2594
|
skip: 0
|
|
2610
2595
|
})
|
|
2611
|
-
}),
|
|
2612
|
-
return
|
|
2613
|
-
},
|
|
2614
|
-
let
|
|
2596
|
+
}), c = s ?? [], l = await Ie(c.map((e) => e.schemaId));
|
|
2597
|
+
return c.map((e) => k(e, l.get(e.schemaId) ?? []));
|
|
2598
|
+
}, Re = 400, ze = async ({ refUIDs: e, ids: n, since: r }) => {
|
|
2599
|
+
let a = { OR: [{ timeCreated: { gt: r } }, { revocationTime: { gt: r } }] }, o = [], s = (e, t) => {
|
|
2615
2600
|
let n = [...new Set(t)].sort();
|
|
2616
|
-
for (let t = 0; t < n.length; t +=
|
|
2601
|
+
for (let t = 0; t < n.length; t += Re) o.push({ [e]: { in: n.slice(t, t + Re) } });
|
|
2617
2602
|
};
|
|
2618
|
-
if (
|
|
2619
|
-
let
|
|
2603
|
+
if (s("refUID", e), s("id", n), o.length === 0) return [];
|
|
2604
|
+
let c = f.getQueryClient(), l = t.getEasClient(), u = await Promise.all(o.map((e) => i(c, {
|
|
2620
2605
|
queryKey: [
|
|
2621
2606
|
"getAttestationChangesSince",
|
|
2622
2607
|
e,
|
|
2623
|
-
|
|
2608
|
+
r
|
|
2624
2609
|
],
|
|
2625
|
-
queryFn: async () =>
|
|
2626
|
-
}))),
|
|
2627
|
-
for (let { changes: e } of
|
|
2628
|
-
return [...
|
|
2629
|
-
},
|
|
2610
|
+
queryFn: async () => l.request(E, { where: { AND: [e, a] } })
|
|
2611
|
+
}))), d = /* @__PURE__ */ new Map();
|
|
2612
|
+
for (let { changes: e } of u) for (let t of e ?? []) d.set(t.id, t);
|
|
2613
|
+
return [...d.values()];
|
|
2614
|
+
}, Be = async (e, t = 10) => (await O(e, t)).map((e) => e.id);
|
|
2630
2615
|
//#endregion
|
|
2631
2616
|
//#region src/easUid.ts
|
|
2632
|
-
function
|
|
2617
|
+
function Ve(e) {
|
|
2633
2618
|
if (e == null || e === "" || e === "NULL") return !0;
|
|
2634
2619
|
let t = e.trim();
|
|
2635
2620
|
return t === "" || t.toLowerCase() === "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
2636
2621
|
}
|
|
2637
|
-
function
|
|
2638
|
-
if (
|
|
2622
|
+
function He(e) {
|
|
2623
|
+
if (Ve(e)) return !1;
|
|
2639
2624
|
let t = String(e).trim();
|
|
2640
2625
|
if (!/^0x/i.test(t)) return !1;
|
|
2641
2626
|
let n = t.slice(2);
|
|
2642
2627
|
return n.length === 64 && /^[0-9a-fA-F]{64}$/.test(n);
|
|
2643
2628
|
}
|
|
2644
|
-
function
|
|
2629
|
+
function j(e) {
|
|
2645
2630
|
if (e == null || e === "") return "";
|
|
2646
2631
|
let t = String(e).trim();
|
|
2647
2632
|
return ("0x" + (t.startsWith("0x") || t.startsWith("0X") ? t.slice(2) : t).replace(/[^0-9a-fA-F]/g, "0").padStart(64, "0").slice(-64)).toLowerCase();
|
|
2648
2633
|
}
|
|
2649
2634
|
//#endregion
|
|
2650
2635
|
//#region src/domainOwnershipHelpers.ts
|
|
2651
|
-
var
|
|
2652
|
-
function
|
|
2636
|
+
var Ue = "string domain,address claimer,string method,bytes32 challengeHash,uint64 verifiedAt,string registryCreationDate,string registryExpirationDate,bytes32 registryFingerprint,string scope", We = "seedprotocol.domainOwnership", Ge = "dns-txt-challenge", Ke = "registrable", qe = "hostname", Je = "_seedprotocol-challenge", Ye = 2592e5, Xe = 31536e6, Ze = 31536e3;
|
|
2637
|
+
function Qe(e) {
|
|
2653
2638
|
return new TextEncoder().encode(e);
|
|
2654
2639
|
}
|
|
2655
|
-
function
|
|
2640
|
+
function M(e) {
|
|
2656
2641
|
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
2657
2642
|
}
|
|
2658
|
-
function
|
|
2643
|
+
function N(e) {
|
|
2659
2644
|
let t = e.trim();
|
|
2660
2645
|
try {
|
|
2661
|
-
return
|
|
2646
|
+
return h(t).toLowerCase();
|
|
2662
2647
|
} catch {
|
|
2663
2648
|
return t.toLowerCase();
|
|
2664
2649
|
}
|
|
2665
2650
|
}
|
|
2666
|
-
function
|
|
2667
|
-
return `${
|
|
2651
|
+
function $e(e) {
|
|
2652
|
+
return `${Je}.${M(e)}`;
|
|
2668
2653
|
}
|
|
2669
|
-
function
|
|
2670
|
-
let t =
|
|
2654
|
+
function et(e) {
|
|
2655
|
+
let t = N(e.claimer);
|
|
2671
2656
|
return `token=${e.token},addr=${t},expiry=${e.expiry}`;
|
|
2672
2657
|
}
|
|
2673
|
-
function
|
|
2658
|
+
function tt(e) {
|
|
2674
2659
|
let t = e.replace(/^"+|"+$/g, "").trim(), n = /* @__PURE__ */ new Map();
|
|
2675
2660
|
for (let e of t.split(",")) {
|
|
2676
2661
|
let t = e.indexOf("=");
|
|
@@ -2681,59 +2666,59 @@ function at(e) {
|
|
|
2681
2666
|
let r = n.get("token"), i = n.get("addr") ?? n.get("claimer"), a = n.get("expiry");
|
|
2682
2667
|
return !r || !i || !a ? null : {
|
|
2683
2668
|
token: r,
|
|
2684
|
-
claimer:
|
|
2669
|
+
claimer: N(i),
|
|
2685
2670
|
expiry: a
|
|
2686
2671
|
};
|
|
2687
2672
|
}
|
|
2688
|
-
function
|
|
2689
|
-
let t =
|
|
2690
|
-
return "0x" +
|
|
2673
|
+
function nt(e) {
|
|
2674
|
+
let t = M(e.domain), n = N(e.claimer), r = (e.scope ?? "registrable").trim();
|
|
2675
|
+
return "0x" + p(Qe(`${t}|${n}|${e.token}|${r}`));
|
|
2691
2676
|
}
|
|
2692
|
-
function
|
|
2677
|
+
function rt(e) {
|
|
2693
2678
|
let t = {
|
|
2694
|
-
domain:
|
|
2679
|
+
domain: M(e.domain),
|
|
2695
2680
|
creationDate: (e.creationDate ?? "").trim(),
|
|
2696
2681
|
registrarIanaId: (e.registrarIanaId ?? "").trim()
|
|
2697
2682
|
};
|
|
2698
|
-
return "0x" +
|
|
2683
|
+
return "0x" + p(Qe(JSON.stringify(t)));
|
|
2699
2684
|
}
|
|
2700
|
-
function
|
|
2701
|
-
return typeof e == "string" ?
|
|
2685
|
+
function P(e) {
|
|
2686
|
+
return typeof e == "string" ? j(e) : e && typeof e == "object" && "hex" in e ? j(String(e.hex)) : e && typeof e == "object" && "value" in e ? P(e.value) : j(String(e ?? ""));
|
|
2702
2687
|
}
|
|
2703
|
-
function
|
|
2688
|
+
function F(e) {
|
|
2704
2689
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2705
2690
|
}
|
|
2706
|
-
function
|
|
2691
|
+
function it(e) {
|
|
2707
2692
|
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2708
2693
|
if (typeof e == "bigint") return Number(e);
|
|
2709
2694
|
if (typeof e == "string" && e.trim() !== "") {
|
|
2710
2695
|
let t = Number(e);
|
|
2711
2696
|
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2712
2697
|
}
|
|
2713
|
-
return e && typeof e == "object" && "value" in e ?
|
|
2698
|
+
return e && typeof e == "object" && "value" in e ? it(e.value) : 0;
|
|
2714
2699
|
}
|
|
2715
|
-
function
|
|
2700
|
+
function at(e) {
|
|
2716
2701
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2717
2702
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2718
2703
|
return {
|
|
2719
|
-
domain:
|
|
2720
|
-
claimer:
|
|
2721
|
-
method:
|
|
2722
|
-
challengeHash:
|
|
2723
|
-
verifiedAt:
|
|
2724
|
-
registryCreationDate:
|
|
2725
|
-
registryExpirationDate:
|
|
2726
|
-
registryFingerprint:
|
|
2727
|
-
scope:
|
|
2704
|
+
domain: M(F(n.get("domain")?.value)),
|
|
2705
|
+
claimer: N(F(n.get("claimer")?.value)),
|
|
2706
|
+
method: F(n.get("method")?.value),
|
|
2707
|
+
challengeHash: P(n.get("challengeHash")?.value),
|
|
2708
|
+
verifiedAt: it(n.get("verifiedAt")?.value),
|
|
2709
|
+
registryCreationDate: F(n.get("registryCreationDate")?.value),
|
|
2710
|
+
registryExpirationDate: F(n.get("registryExpirationDate")?.value),
|
|
2711
|
+
registryFingerprint: P(n.get("registryFingerprint")?.value),
|
|
2712
|
+
scope: F(n.get("scope")?.value)
|
|
2728
2713
|
};
|
|
2729
2714
|
}
|
|
2730
|
-
function
|
|
2715
|
+
function ot(e) {
|
|
2731
2716
|
if (!e?.trim()) return null;
|
|
2732
2717
|
let t = Date.parse(e);
|
|
2733
2718
|
return Number.isFinite(t) ? Math.floor(t / 1e3) : null;
|
|
2734
2719
|
}
|
|
2735
|
-
function
|
|
2736
|
-
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.softStaleMs ?? 31536e6, i = e.expirationTime, a =
|
|
2720
|
+
function st(e) {
|
|
2721
|
+
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.softStaleMs ?? 31536e6, i = e.expirationTime, a = ot(e.decoded.registryExpirationDate);
|
|
2737
2722
|
if (typeof i == "number" && i > 0 && t >= i || a != null && t >= a) return {
|
|
2738
2723
|
status: "expired",
|
|
2739
2724
|
warnings: n
|
|
@@ -2742,11 +2727,11 @@ function lt(e) {
|
|
|
2742
2727
|
status: "unknown",
|
|
2743
2728
|
warnings: n
|
|
2744
2729
|
};
|
|
2745
|
-
if (e.registrySnapshot !== void 0) return
|
|
2730
|
+
if (e.registrySnapshot !== void 0) return j(rt({
|
|
2746
2731
|
domain: e.decoded.domain,
|
|
2747
2732
|
creationDate: e.registrySnapshot.creationDate,
|
|
2748
2733
|
registrarIanaId: e.registrySnapshot.registrarIanaId
|
|
2749
|
-
})) ===
|
|
2734
|
+
})) === j(e.decoded.registryFingerprint) ? {
|
|
2750
2735
|
status: "valid",
|
|
2751
2736
|
warnings: n
|
|
2752
2737
|
} : (n.push("Registry creation date or registrar IANA id no longer matches attestation fingerprint"), {
|
|
@@ -2764,42 +2749,42 @@ function lt(e) {
|
|
|
2764
2749
|
}
|
|
2765
2750
|
//#endregion
|
|
2766
2751
|
//#region src/domainOwnership.ts
|
|
2767
|
-
function
|
|
2752
|
+
function I(e) {
|
|
2768
2753
|
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
2769
2754
|
}
|
|
2770
|
-
async function
|
|
2771
|
-
let { toolAddresses:
|
|
2772
|
-
if (!
|
|
2773
|
-
let s =
|
|
2755
|
+
async function ct(e) {
|
|
2756
|
+
let { toolAddresses: n, domains: r, claimers: i, schemaUid: a, excludeRevoked: o = !0 } = e;
|
|
2757
|
+
if (!n.length) return [];
|
|
2758
|
+
let s = n.map((e) => {
|
|
2774
2759
|
try {
|
|
2775
|
-
return
|
|
2760
|
+
return h(e);
|
|
2776
2761
|
} catch {
|
|
2777
2762
|
return e;
|
|
2778
2763
|
}
|
|
2779
2764
|
}), c = { attester: { in: s } };
|
|
2780
|
-
a ? c.schemaId = { equals: a } : c.schema = { is: { schemaNames: { some: { name: { equals:
|
|
2765
|
+
a ? c.schemaId = { equals: a } : c.schema = { is: { schemaNames: { some: { name: { equals: We } } } } }, i?.length && (c.recipient = { in: i.map((e) => {
|
|
2781
2766
|
try {
|
|
2782
|
-
return
|
|
2767
|
+
return h(e);
|
|
2783
2768
|
} catch {
|
|
2784
2769
|
return e;
|
|
2785
2770
|
}
|
|
2786
|
-
}) }), o && (c =
|
|
2787
|
-
let l =
|
|
2771
|
+
}) }), o && (c = v(c));
|
|
2772
|
+
let l = f.getQueryClient(), u = t.getEasClient(), { domainOwnerships: d } = await l.fetchQuery({
|
|
2788
2773
|
queryKey: [
|
|
2789
2774
|
"getDomainOwnershipFromEas",
|
|
2790
2775
|
o,
|
|
2791
2776
|
a ?? "seedprotocol.domainOwnership",
|
|
2792
2777
|
[...s].sort(),
|
|
2793
|
-
[...(
|
|
2794
|
-
[...
|
|
2778
|
+
[...(r ?? []).map(I)].sort(),
|
|
2779
|
+
[...i ?? []].map((e) => e.toLowerCase()).sort()
|
|
2795
2780
|
],
|
|
2796
|
-
queryFn: async () => u.request(
|
|
2781
|
+
queryFn: async () => u.request(we, { where: c })
|
|
2797
2782
|
});
|
|
2798
|
-
if (!
|
|
2799
|
-
let ee = new Set(
|
|
2783
|
+
if (!r?.length) return d;
|
|
2784
|
+
let ee = new Set(r.map(I));
|
|
2800
2785
|
return d.filter((e) => {
|
|
2801
2786
|
try {
|
|
2802
|
-
let t =
|
|
2787
|
+
let t = at(e.decodedDataJson ?? "[]");
|
|
2803
2788
|
return ee.has(t.domain);
|
|
2804
2789
|
} catch {
|
|
2805
2790
|
return !1;
|
|
@@ -2808,44 +2793,44 @@ async function dt(e) {
|
|
|
2808
2793
|
}
|
|
2809
2794
|
//#endregion
|
|
2810
2795
|
//#region src/publishAuthorizationHelpers.ts
|
|
2811
|
-
var
|
|
2812
|
-
function
|
|
2796
|
+
var lt = "address identity,address sessionKey,address app,string scopes,uint64 grantedAt,uint64 expiresAt,bytes32 permissionsHash", ut = "seedprotocol.publishAuthorization", dt = "publish,revoke", ft = 31536e3;
|
|
2797
|
+
function L(e) {
|
|
2813
2798
|
let t = e.trim();
|
|
2814
2799
|
try {
|
|
2815
|
-
return
|
|
2800
|
+
return h(t).toLowerCase();
|
|
2816
2801
|
} catch {
|
|
2817
2802
|
return t.toLowerCase();
|
|
2818
2803
|
}
|
|
2819
2804
|
}
|
|
2820
|
-
function
|
|
2821
|
-
return typeof e == "string" ?
|
|
2805
|
+
function pt(e) {
|
|
2806
|
+
return typeof e == "string" ? j(e) : e && typeof e == "object" && "hex" in e ? j(String(e.hex)) : j(String(e ?? ""));
|
|
2822
2807
|
}
|
|
2823
|
-
function
|
|
2808
|
+
function R(e) {
|
|
2824
2809
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2825
2810
|
}
|
|
2826
|
-
function
|
|
2811
|
+
function z(e) {
|
|
2827
2812
|
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2828
2813
|
if (typeof e == "bigint") return Number(e);
|
|
2829
2814
|
if (typeof e == "string" && e.trim() !== "") {
|
|
2830
2815
|
let t = Number(e);
|
|
2831
2816
|
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2832
2817
|
}
|
|
2833
|
-
return e && typeof e == "object" && "value" in e ?
|
|
2818
|
+
return e && typeof e == "object" && "value" in e ? z(e.value) : 0;
|
|
2834
2819
|
}
|
|
2835
|
-
function
|
|
2820
|
+
function mt(e) {
|
|
2836
2821
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2837
2822
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2838
2823
|
return {
|
|
2839
|
-
identity:
|
|
2840
|
-
sessionKey:
|
|
2841
|
-
app:
|
|
2842
|
-
scopes:
|
|
2843
|
-
grantedAt:
|
|
2844
|
-
expiresAt:
|
|
2845
|
-
permissionsHash:
|
|
2824
|
+
identity: L(R(n.get("identity")?.value)),
|
|
2825
|
+
sessionKey: L(R(n.get("sessionKey")?.value)),
|
|
2826
|
+
app: L(R(n.get("app")?.value)),
|
|
2827
|
+
scopes: R(n.get("scopes")?.value),
|
|
2828
|
+
grantedAt: z(n.get("grantedAt")?.value),
|
|
2829
|
+
expiresAt: z(n.get("expiresAt")?.value),
|
|
2830
|
+
permissionsHash: pt(n.get("permissionsHash")?.value)
|
|
2846
2831
|
};
|
|
2847
2832
|
}
|
|
2848
|
-
function
|
|
2833
|
+
function ht(e) {
|
|
2849
2834
|
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.expectedScopes ?? "publish,revoke", i = e.expirationTime, a = e.decoded.expiresAt;
|
|
2850
2835
|
return typeof i == "number" && i > 0 && t >= i || a > 0 && t >= a ? {
|
|
2851
2836
|
status: "expired",
|
|
@@ -2861,42 +2846,42 @@ function vt(e) {
|
|
|
2861
2846
|
warnings: n
|
|
2862
2847
|
});
|
|
2863
2848
|
}
|
|
2864
|
-
function
|
|
2865
|
-
return "0x" +
|
|
2849
|
+
function gt(e) {
|
|
2850
|
+
return "0x" + p(new TextEncoder().encode(e));
|
|
2866
2851
|
}
|
|
2867
2852
|
//#endregion
|
|
2868
2853
|
//#region src/publishAuthorization.ts
|
|
2869
|
-
async function
|
|
2870
|
-
let { identities:
|
|
2871
|
-
a ? s.schemaId = { equals: a } : s.schema = { is: { schemaNames: { some: { name: { equals:
|
|
2854
|
+
async function _t(e = {}) {
|
|
2855
|
+
let { identities: n, sessionKeys: r, apps: i, schemaUid: a, excludeRevoked: o = !0 } = e, s = {};
|
|
2856
|
+
a ? s.schemaId = { equals: a } : s.schema = { is: { schemaNames: { some: { name: { equals: ut } } } } }, n?.length && (s.attester = { in: n.map((e) => {
|
|
2872
2857
|
try {
|
|
2873
|
-
return
|
|
2858
|
+
return h(e);
|
|
2874
2859
|
} catch {
|
|
2875
2860
|
return e;
|
|
2876
2861
|
}
|
|
2877
|
-
}) }),
|
|
2862
|
+
}) }), r?.length && (s.recipient = { in: r.map((e) => {
|
|
2878
2863
|
try {
|
|
2879
|
-
return
|
|
2864
|
+
return h(e);
|
|
2880
2865
|
} catch {
|
|
2881
2866
|
return e;
|
|
2882
2867
|
}
|
|
2883
|
-
}) }), o && (s =
|
|
2884
|
-
let c =
|
|
2868
|
+
}) }), o && (s = v(s));
|
|
2869
|
+
let c = f.getQueryClient(), l = t.getEasClient(), { itemSeeds: u } = await c.fetchQuery({
|
|
2885
2870
|
queryKey: [
|
|
2886
2871
|
"getPublishAuthorizationFromEas",
|
|
2887
2872
|
o,
|
|
2888
2873
|
a ?? "seedprotocol.publishAuthorization",
|
|
2889
|
-
[...t ?? []].map((e) => e.toLowerCase()).sort(),
|
|
2890
2874
|
[...n ?? []].map((e) => e.toLowerCase()).sort(),
|
|
2891
|
-
[...r ?? []].map((e) => e.toLowerCase()).sort()
|
|
2875
|
+
[...r ?? []].map((e) => e.toLowerCase()).sort(),
|
|
2876
|
+
[...i ?? []].map((e) => e.toLowerCase()).sort()
|
|
2892
2877
|
],
|
|
2893
|
-
queryFn: async () => l.request(
|
|
2878
|
+
queryFn: async () => l.request(S, { where: s })
|
|
2894
2879
|
});
|
|
2895
|
-
if (!
|
|
2896
|
-
let d = new Set(
|
|
2880
|
+
if (!i?.length) return u;
|
|
2881
|
+
let d = new Set(i.map((e) => e.toLowerCase()));
|
|
2897
2882
|
return u.filter((e) => {
|
|
2898
2883
|
try {
|
|
2899
|
-
let t =
|
|
2884
|
+
let t = mt(e.decodedDataJson ?? "[]");
|
|
2900
2885
|
return d.has(t.app.toLowerCase());
|
|
2901
2886
|
} catch {
|
|
2902
2887
|
return !1;
|
|
@@ -2905,29 +2890,29 @@ async function bt(e = {}) {
|
|
|
2905
2890
|
}
|
|
2906
2891
|
//#endregion
|
|
2907
2892
|
//#region src/easNames.ts
|
|
2908
|
-
var
|
|
2893
|
+
var B = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/([A-Z])([A-Z][a-z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").replace(/^_+|_+$/g, "").toLowerCase(), vt = [
|
|
2909
2894
|
"exact",
|
|
2910
2895
|
"normalized",
|
|
2911
2896
|
"fuzzy"
|
|
2912
|
-
],
|
|
2897
|
+
], yt = (e) => typeof e == "string" && vt.includes(e), V = {
|
|
2913
2898
|
exact: 0,
|
|
2914
2899
|
normalized: 1,
|
|
2915
2900
|
fuzzy: 2
|
|
2916
|
-
},
|
|
2917
|
-
let n =
|
|
2901
|
+
}, bt = "fuzzy", H = (e) => e.toLowerCase().replace(/[^a-z0-9]/g, ""), U = (e, t = {}) => {
|
|
2902
|
+
let n = H(e);
|
|
2918
2903
|
return t.relation && (n.length > 3 && n.endsWith("ids") ? n = n.slice(0, -3) : n.length > 2 && n.endsWith("id") && (n = n.slice(0, -2))), n.length > 3 && n.endsWith("s") && !n.endsWith("ss") && (n = n.slice(0, -1)), n;
|
|
2919
2904
|
};
|
|
2920
|
-
function
|
|
2921
|
-
if (
|
|
2922
|
-
if (
|
|
2923
|
-
if (
|
|
2905
|
+
function W(e, t, n = {}) {
|
|
2906
|
+
if (B(e) === t) return "exact";
|
|
2907
|
+
if (H(e) === H(t)) return "normalized";
|
|
2908
|
+
if (U(e, n) === U(t, n)) return "fuzzy";
|
|
2924
2909
|
}
|
|
2925
|
-
var
|
|
2926
|
-
function
|
|
2910
|
+
var G = (e, t) => V[e] <= V[t], K = (e, t) => V[e] - V[t];
|
|
2911
|
+
function xt(e, t) {
|
|
2927
2912
|
let n, r = [];
|
|
2928
2913
|
for (let i of t) {
|
|
2929
|
-
let t =
|
|
2930
|
-
t &&
|
|
2914
|
+
let t = W(i.name, e, { relation: i.relation });
|
|
2915
|
+
t && G(t, i.level ?? "fuzzy") && (n === void 0 || K(t, n) < 0 ? (n = t, r = [i.value]) : t === n && r.push(i.value));
|
|
2931
2916
|
}
|
|
2932
2917
|
return n === void 0 ? { kind: "none" } : r.length > 1 ? {
|
|
2933
2918
|
kind: "ambiguous",
|
|
@@ -2939,189 +2924,223 @@ function Ct(e, t) {
|
|
|
2939
2924
|
tier: n
|
|
2940
2925
|
};
|
|
2941
2926
|
}
|
|
2942
|
-
function
|
|
2927
|
+
function St(e, t, n = {}) {
|
|
2943
2928
|
let r = typeof n.level == "function" ? n.level : () => n.level ?? "fuzzy", i, a = /* @__PURE__ */ new Set();
|
|
2944
2929
|
for (let o of t) {
|
|
2945
|
-
let t =
|
|
2946
|
-
t &&
|
|
2930
|
+
let t = W(o, e, { relation: n.relation });
|
|
2931
|
+
t && G(t, r(o)) && (i === void 0 || K(t, i) < 0 ? (i = t, a = /* @__PURE__ */ new Set([o])) : t === i && a.add(o));
|
|
2947
2932
|
}
|
|
2948
2933
|
return a;
|
|
2949
2934
|
}
|
|
2950
|
-
function
|
|
2935
|
+
function Ct(e) {
|
|
2951
2936
|
let t = e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
|
|
2952
2937
|
return [.../* @__PURE__ */ new Set([
|
|
2953
|
-
|
|
2938
|
+
B(e),
|
|
2954
2939
|
t,
|
|
2955
|
-
|
|
2940
|
+
H(e)
|
|
2956
2941
|
])];
|
|
2957
2942
|
}
|
|
2958
|
-
function
|
|
2959
|
-
if (t === "exact") return [
|
|
2960
|
-
let n = /* @__PURE__ */ new Set([...
|
|
2943
|
+
function wt(e, t = bt) {
|
|
2944
|
+
if (t === "exact") return [B(e)];
|
|
2945
|
+
let n = /* @__PURE__ */ new Set([...Ct(e), e]);
|
|
2961
2946
|
if (t === "fuzzy") for (let e of [...n]) n.add(e.endsWith("s") ? e.slice(0, -1) : `${e}s`);
|
|
2962
2947
|
return [...n];
|
|
2963
2948
|
}
|
|
2964
2949
|
//#endregion
|
|
2965
|
-
//#region src/
|
|
2966
|
-
var
|
|
2967
|
-
|
|
2950
|
+
//#region src/modelSchemas.ts
|
|
2951
|
+
var Tt = (e) => `bytes32 ${B(e)}`, Et = "bytes32 ", Dt = (e) => {
|
|
2952
|
+
let t = /* @__PURE__ */ new Map();
|
|
2953
|
+
for (let { name: n, level: r } of e) {
|
|
2954
|
+
if (!n) continue;
|
|
2955
|
+
let e = t.get(n), i = r ?? "fuzzy";
|
|
2956
|
+
(!e || K(i, e) < 0) && t.set(n, i);
|
|
2957
|
+
}
|
|
2958
|
+
return t;
|
|
2959
|
+
}, Ot = async (e) => {
|
|
2960
|
+
let n = Dt(e);
|
|
2961
|
+
if (n.size === 0) return [];
|
|
2962
|
+
let r = f.getQueryClient(), i = t.getEasClient();
|
|
2963
|
+
if (!r || !i) return [];
|
|
2964
|
+
let a = /* @__PURE__ */ new Set();
|
|
2965
|
+
for (let [e, t] of n) for (let n of wt(e, t)) a.add(`${Et}${n}`);
|
|
2966
|
+
let o = [...a].sort();
|
|
2967
|
+
return (await r.fetchQuery({
|
|
2968
|
+
queryKey: ["fetchEasModelSchemas", o],
|
|
2969
|
+
queryFn: async () => i.request(x, { where: { schema: { in: o } } })
|
|
2970
|
+
}))?.schemas ?? [];
|
|
2971
|
+
}, kt = (e, t) => {
|
|
2972
|
+
let n = [...Dt(t)].map(([e, t]) => ({
|
|
2973
|
+
value: e,
|
|
2974
|
+
name: e,
|
|
2975
|
+
level: t
|
|
2976
|
+
})), r = [];
|
|
2977
|
+
for (let t of e) {
|
|
2978
|
+
if (!t.schema?.startsWith(Et)) continue;
|
|
2979
|
+
let e = xt(t.schema.slice(8), n);
|
|
2980
|
+
e.kind === "match" && r.push({
|
|
2981
|
+
schema: t,
|
|
2982
|
+
modelName: e.value,
|
|
2983
|
+
tier: e.tier
|
|
2984
|
+
});
|
|
2985
|
+
}
|
|
2986
|
+
return r;
|
|
2987
|
+
}, At = async (e) => kt(await Ot(e), e), jt = /^-?\d+$/, Mt = /^(-?)0x([0-9a-f]+)$/i;
|
|
2988
|
+
function Nt(e) {
|
|
2968
2989
|
return typeof e == "string" && /^u?int\d*$/.test(e);
|
|
2969
2990
|
}
|
|
2970
|
-
function
|
|
2971
|
-
let t =
|
|
2991
|
+
function Pt(e) {
|
|
2992
|
+
let t = Mt.exec(e.trim());
|
|
2972
2993
|
if (!t) return;
|
|
2973
2994
|
let n = BigInt("0x" + t[2]);
|
|
2974
2995
|
return (t[1] ? -n : n).toString();
|
|
2975
2996
|
}
|
|
2976
|
-
function
|
|
2997
|
+
function Ft(e) {
|
|
2977
2998
|
if (typeof e == "bigint") return e.toString();
|
|
2978
2999
|
if (typeof e == "number") return Number.isFinite(e) ? String(e) : void 0;
|
|
2979
3000
|
if (typeof e == "string") {
|
|
2980
3001
|
let t = e.trim();
|
|
2981
3002
|
if (!t) return;
|
|
2982
|
-
if (
|
|
2983
|
-
if (
|
|
3003
|
+
if (jt.test(t)) return BigInt(t).toString();
|
|
3004
|
+
if (Mt.test(t)) return Pt(t);
|
|
2984
3005
|
let n = Number(t);
|
|
2985
3006
|
return Number.isFinite(n) ? String(n) : void 0;
|
|
2986
3007
|
}
|
|
2987
3008
|
if (e && typeof e == "object") {
|
|
2988
3009
|
let t = e.hex ?? e._hex;
|
|
2989
|
-
if (typeof t == "string") return
|
|
3010
|
+
if (typeof t == "string") return Pt(t);
|
|
2990
3011
|
}
|
|
2991
3012
|
}
|
|
3013
|
+
function It(e, t) {
|
|
3014
|
+
return e === "string" ? t === "" : e === "bytes32" && typeof t == "string" && /^0x0{64}$/i.test(t);
|
|
3015
|
+
}
|
|
2992
3016
|
//#endregion
|
|
2993
3017
|
//#region src/publishedByHelpers.ts
|
|
2994
|
-
var
|
|
2995
|
-
function
|
|
3018
|
+
var Lt = "bytes32 seedUid,bytes32 versionUid,bytes32[] attestationUids,bytes32 batchHash,string toolName,string toolVersion", Rt = "seedprotocol.publishedBy";
|
|
3019
|
+
function zt(e) {
|
|
2996
3020
|
let t = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, n = new Uint8Array(t.length / 2);
|
|
2997
3021
|
for (let e = 0; e < n.length; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
|
|
2998
3022
|
return n;
|
|
2999
3023
|
}
|
|
3000
|
-
function
|
|
3001
|
-
let t = [...e].map((e) =>
|
|
3002
|
-
if (t.length === 0) return "0x" +
|
|
3024
|
+
function Bt(e) {
|
|
3025
|
+
let t = [...e].map((e) => j(e)).filter((e) => e !== "" && He(e)).sort();
|
|
3026
|
+
if (t.length === 0) return "0x" + p(/* @__PURE__ */ new Uint8Array());
|
|
3003
3027
|
let n = new Uint8Array(t.length * 32);
|
|
3004
|
-
for (let e = 0; e < t.length; e++) n.set(
|
|
3005
|
-
return "0x" +
|
|
3028
|
+
for (let e = 0; e < t.length; e++) n.set(zt(t[e]), e * 32);
|
|
3029
|
+
return "0x" + p(n);
|
|
3006
3030
|
}
|
|
3007
|
-
function
|
|
3008
|
-
return
|
|
3031
|
+
function Vt(e) {
|
|
3032
|
+
return j(Bt(e.attestationUids)) === j(e.batchHash);
|
|
3009
3033
|
}
|
|
3010
|
-
function
|
|
3011
|
-
return typeof e == "string" ?
|
|
3034
|
+
function q(e) {
|
|
3035
|
+
return typeof e == "string" ? j(e) : e && typeof e == "object" && "hex" in e ? j(String(e.hex)) : j(String(e ?? ""));
|
|
3012
3036
|
}
|
|
3013
|
-
function
|
|
3037
|
+
function Ht(e) {
|
|
3014
3038
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
3015
3039
|
}
|
|
3016
|
-
function
|
|
3040
|
+
function Ut(e) {
|
|
3017
3041
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
3018
3042
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
3019
3043
|
let r = n.get("attestationUids")?.value, i = [];
|
|
3020
|
-
return Array.isArray(r) ? i = r.map((e) =>
|
|
3021
|
-
seedUid:
|
|
3022
|
-
versionUid:
|
|
3044
|
+
return Array.isArray(r) ? i = r.map((e) => q(e)) : r && typeof r == "object" && Array.isArray(r.value) && (i = r.value.map((e) => q(e))), {
|
|
3045
|
+
seedUid: q(n.get("seedUid")?.value),
|
|
3046
|
+
versionUid: q(n.get("versionUid")?.value),
|
|
3023
3047
|
attestationUids: i,
|
|
3024
|
-
batchHash:
|
|
3025
|
-
toolName:
|
|
3026
|
-
toolVersion:
|
|
3048
|
+
batchHash: q(n.get("batchHash")?.value),
|
|
3049
|
+
toolName: Ht(n.get("toolName")?.value),
|
|
3050
|
+
toolVersion: Ht(n.get("toolVersion")?.value)
|
|
3027
3051
|
};
|
|
3028
3052
|
}
|
|
3029
3053
|
//#endregion
|
|
3030
3054
|
//#region src/publishedBy.ts
|
|
3031
|
-
async function
|
|
3032
|
-
let { toolAddresses:
|
|
3033
|
-
if (!
|
|
3034
|
-
let o =
|
|
3055
|
+
async function Wt(e) {
|
|
3056
|
+
let { toolAddresses: n, refUIDs: r, schemaUid: i, excludeRevoked: a = !0 } = e;
|
|
3057
|
+
if (!n.length) return [];
|
|
3058
|
+
let o = n.map((e) => {
|
|
3035
3059
|
try {
|
|
3036
|
-
return
|
|
3060
|
+
return h(e);
|
|
3037
3061
|
} catch {
|
|
3038
3062
|
return e;
|
|
3039
3063
|
}
|
|
3040
3064
|
}), s = { attester: { in: o } };
|
|
3041
|
-
|
|
3042
|
-
let c =
|
|
3065
|
+
i ? s.schemaId = { equals: i } : s.schema = { is: { schemaNames: { some: { name: { equals: Rt } } } } }, r?.length && (s.refUID = { in: r }), a && (s = v(s));
|
|
3066
|
+
let c = f.getQueryClient(), l = t.getEasClient(), { itemSeeds: u } = await c.fetchQuery({
|
|
3043
3067
|
queryKey: [
|
|
3044
3068
|
"getPublishedByFromEas",
|
|
3045
3069
|
a,
|
|
3046
|
-
|
|
3070
|
+
i ?? "seedprotocol.publishedBy",
|
|
3047
3071
|
[...o].sort(),
|
|
3048
|
-
[...
|
|
3072
|
+
[...r ?? []].sort()
|
|
3049
3073
|
],
|
|
3050
|
-
queryFn: async () => l.request(
|
|
3074
|
+
queryFn: async () => l.request(S, { where: s })
|
|
3051
3075
|
});
|
|
3052
3076
|
return u;
|
|
3053
3077
|
}
|
|
3054
3078
|
//#endregion
|
|
3055
3079
|
//#region src/default/index.ts
|
|
3056
|
-
function
|
|
3057
|
-
|
|
3080
|
+
function Gt() {
|
|
3081
|
+
t.isConfigured() || t.configure(new ne()), f.isConfigured() || f.configure(new se());
|
|
3058
3082
|
}
|
|
3059
3083
|
//#endregion
|
|
3060
3084
|
//#region src/stores/schemaUidCache.ts
|
|
3061
|
-
var
|
|
3085
|
+
var J = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map(), Kt = 3e5, X = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map(), $ = 0, qt = () => {
|
|
3062
3086
|
try {
|
|
3063
|
-
return
|
|
3087
|
+
return o();
|
|
3064
3088
|
} catch {
|
|
3065
3089
|
return "";
|
|
3066
3090
|
}
|
|
3067
|
-
},
|
|
3068
|
-
let n =
|
|
3091
|
+
}, Jt = (e) => `${qt()}\n${e}`, Yt = async (e, t) => {
|
|
3092
|
+
let n = Jt(e), r = Z.get(n);
|
|
3069
3093
|
if (r !== void 0) {
|
|
3070
3094
|
if (Date.now() < r) return;
|
|
3071
|
-
|
|
3095
|
+
Z.delete(n);
|
|
3072
3096
|
}
|
|
3073
|
-
let i =
|
|
3097
|
+
let i = Q.get(n);
|
|
3074
3098
|
if (i) return i;
|
|
3075
|
-
let a =
|
|
3076
|
-
|
|
3099
|
+
let a = $, o = t().then((e) => (!e && a === $ && Z.set(n, Date.now() + Kt), e)).finally(() => {
|
|
3100
|
+
Q.get(n) === o && Q.delete(n);
|
|
3077
3101
|
});
|
|
3078
|
-
return
|
|
3079
|
-
},
|
|
3080
|
-
|
|
3081
|
-
},
|
|
3082
|
-
let t = `${
|
|
3083
|
-
for (let e of [...
|
|
3084
|
-
for (let e of [...
|
|
3085
|
-
r &&
|
|
3086
|
-
},
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
let
|
|
3096
|
-
Gt((e) => e === n);
|
|
3097
|
-
}, Xt = (e) => J.get(e.toLowerCase()), Zt = (e) => q.get(h(e)), Qt = async ({ schemaText: e }) => {
|
|
3098
|
-
let t = h(e);
|
|
3099
|
-
if (!q.has(t)) {
|
|
3100
|
-
let e;
|
|
3101
|
-
try {
|
|
3102
|
-
e = await $(`schemaName:${t}`, () => E({ schemaName: t }));
|
|
3103
|
-
} catch (e) {
|
|
3104
|
-
process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for schema name ${t}:`, e);
|
|
3105
|
-
return;
|
|
3106
|
-
}
|
|
3107
|
-
return e && q.set(t, e), e;
|
|
3108
|
-
}
|
|
3109
|
-
return q.get(t);
|
|
3110
|
-
}, $t = async (e) => {
|
|
3111
|
-
let t = Ut(e), n = Y.get(t);
|
|
3102
|
+
return Q.set(n, o), o;
|
|
3103
|
+
}, Xt = () => {
|
|
3104
|
+
$++, Z.clear(), Q.clear();
|
|
3105
|
+
}, Zt = (e) => {
|
|
3106
|
+
let t = `${qt()}\n`, n = (n) => n.startsWith(t) && e(n.slice(t.length)), r = !1;
|
|
3107
|
+
for (let e of [...Z.keys()]) n(e) && Z.delete(e);
|
|
3108
|
+
for (let e of [...Q.keys()]) n(e) && (Q.delete(e), r = !0);
|
|
3109
|
+
r && $++;
|
|
3110
|
+
}, Qt = (e) => (t) => t === `definition:${e}`, $t = () => {
|
|
3111
|
+
J.clear(), Y.clear(), X.clear(), Xt();
|
|
3112
|
+
}, en = ({ text: e, schemaUid: t }) => {
|
|
3113
|
+
J.set(m(e), t), Zt(Qt(e));
|
|
3114
|
+
}, tn = ({ modelName: e, schemaUid: t }) => {
|
|
3115
|
+
Y.set(e.toLowerCase(), t);
|
|
3116
|
+
let n = `model:${B(e)}`;
|
|
3117
|
+
Zt((e) => e === n);
|
|
3118
|
+
}, nn = (e) => Y.get(e.toLowerCase()), rn = (e) => J.get(m(e)), an = async ({ schemaText: e }) => {
|
|
3119
|
+
let t = m(e), n = J.get(t);
|
|
3112
3120
|
if (n) return n;
|
|
3113
|
-
let r
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3121
|
+
let r;
|
|
3122
|
+
try {
|
|
3123
|
+
r = await on(e);
|
|
3124
|
+
} catch (t) {
|
|
3125
|
+
process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for definition ${e}:`, t);
|
|
3126
|
+
return;
|
|
3127
|
+
}
|
|
3128
|
+
return r && J.set(t, r), r;
|
|
3129
|
+
}, on = async (e) => {
|
|
3130
|
+
let n = Jt(e), r = X.get(n);
|
|
3131
|
+
if (r) return r;
|
|
3132
|
+
let i = f.getQueryClient(), a = t.getEasClient();
|
|
3133
|
+
if (!i || !a) return;
|
|
3134
|
+
let o = await Yt(`definition:${e}`, async () => {
|
|
3135
|
+
let t = await i.fetchQuery({
|
|
3117
3136
|
queryKey: ["getSchemaByDefinition", e],
|
|
3118
|
-
queryFn: async () => a.request(
|
|
3137
|
+
queryFn: async () => a.request(Ce, { where: { schema: { equals: e } } })
|
|
3119
3138
|
}), n = t?.schemas ?? t?.data?.schemas;
|
|
3120
3139
|
return Array.isArray(n) && n.length > 0 ? n[0].id : void 0;
|
|
3121
3140
|
});
|
|
3122
|
-
return o &&
|
|
3141
|
+
return o && X.set(n, o), o;
|
|
3123
3142
|
};
|
|
3124
3143
|
//#endregion
|
|
3125
|
-
export {
|
|
3144
|
+
export { t as BaseEasClient, t as EasClient, f as BaseQueryClient, te as DEFAULT_EAS_CHAIN_ID, bt as DEFAULT_NAME_MATCH_LEVEL, Ye as DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS, Ze as DOMAIN_OWNERSHIP_DEFAULT_EXPIRATION_SECS, Ge as DOMAIN_OWNERSHIP_METHOD, Ue as DOMAIN_OWNERSHIP_SCHEMA_DEF, We as DOMAIN_OWNERSHIP_SCHEMA_NAME, qe as DOMAIN_OWNERSHIP_SCOPE_HOSTNAME, Ke as DOMAIN_OWNERSHIP_SCOPE_REGISTRABLE, Xe as DOMAIN_OWNERSHIP_SOFT_STALE_MS, Je as DOMAIN_OWNERSHIP_TXT_LABEL, ne as DefaultEasClient, se as DefaultQueryClient, e as DuplicateEasModuleError, u as EAS_CHAIN_DEPLOYMENTS, be as EAS_ENDPOINT, ae as EAS_REQUEST_TIMEOUT_MS, De as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, E as GET_ATTESTATION_CHANGES, we as GET_DOMAIN_OWNERSHIPS, Oe as GET_FILES_METADATA, ke as GET_IMAGE_SEEDS, Ae as GET_IMAGE_VERSIONS, T as GET_PROPERTIES, x as GET_SCHEMAS, Ce as GET_SCHEMA_BY_NAME, S as GET_SEEDS, C as GET_SEEDS_LEAN, Te as GET_SEED_IDS, Ee as GET_STORAGE_TRANSACTION_ID, w as GET_VERSIONS, vt as NAME_MATCH_LEVELS, l as OP_STACK_EAS_CONTRACT_ADDRESS, r as OP_STACK_SCHEMA_REGISTRY_ADDRESS, Lt as PUBLISHED_BY_SCHEMA_DEF, Rt as PUBLISHED_BY_SCHEMA_NAME, ft as PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS, lt as PUBLISH_AUTHORIZATION_SCHEMA_DEF, ut as PUBLISH_AUTHORIZATION_SCHEMA_NAME, dt as PUBLISH_AUTHORIZATION_SCOPES, Kt as SCHEMA_LOOKUP_MISS_TTL_MS, xe as VERSION_SCHEMA_DEF, y as VERSION_SCHEMA_UID, _e as ZERO_ADDRESS, ve as ZERO_BYTES, ye as ZERO_BYTES32, ue as assertSingleEasModule, st as assessDomainOwnership, ht as assessPublishAuthorization, et as buildDomainOwnershipTxtValue, Yt as cachedSchemaLookup, h as checksumAddress, Xt as clearSchemaLookupMisses, K as compareNameMatchTiers, re as configureEasReadChain, d as createEasGraphQLClient, at as decodeDomainOwnershipData, Ft as decodeEasNumber, mt as decodePublishAuthorizationData, Ut as decodePublishedByData, $e as domainOwnershipTxtName, B as easName, Ct as easNameVariants, wt as easNamesToFetch, Gt as ensureEasPlatform, oe as expectEasReadChain, Ot as fetchEasModelSchemas, U as fuzzyNameKey, ze as getAttestationChangesSince, Me as getCanonicalItemPropertiesFromEas, ct as getDomainOwnershipFromEas, le as getEasAttestationExplorerUrl, de as getEasChainDeployment, o as getEasEndpoint, At as getEasModelSchemasForNames, ee as getEasReadChainId, on as getEasSchemaUidForExactDefinition, an as getEasSchemaUidForSchemaDefinition, D as getItemPropertiesFromEas, je as getItemVersionsFromEas, _t as getPublishAuthorizationFromEas, Wt as getPublishedByFromEas, Ie as getSchemaNamesBySchemaUids, nn as getSchemaUidForModelFromCache, rn as getSchemaUidForSchemaDefinitionFromCache, Be as getSeedUidsBySchemaName, O as getSeedsBySchemaName, Le as getSeedsByUidsFromEas, Ne as getSeedsFromSchemaUids, nt as hashDomainOwnershipChallenge, rt as hashDomainRegistryFingerprint, gt as hashPublishAuthorizationMaterial, Bt as hashPublishedByBatch, It as isEasEmptyValue, ce as isEasReadChainConfigured, s as isEasReadChainSettled, G as isNameMatchAllowed, yt as isNameMatchLevel, Nt as isNumericEasType, Ve as isPlaceholderUid, He as isValidEasAttestationUid, _ as keepAttestationsFromRefAttester, St as localNamesInBestMatchTier, kt as matchEasModelSchemas, xt as matchEasName, Tt as modelSchemaDefinition, W as nameMatchTier, j as normalizeBytes32Hex, H as normalizedNameKey, tt as parseDomainOwnershipTxtValue, ge as partitionByRefAttester, g as pickLatestPropertyAttestationsByRefAndSchema, n as resetEasClientOwnerForTests, c as resetEasReadChain, Fe as resetSchemaNamesCache, $t as resetSchemaUidCaches, a as resolveEasChainDeployment, tn as setSchemaUidForModel, en as setSchemaUidForSchemaDefinition, m as toSnakeCase, Vt as verifyPublishedByBatch, ie as whenEasReadChainSettled, v as withExcludeRevokedFilter };
|
|
3126
3145
|
|
|
3127
3146
|
//# sourceMappingURL=index.js.map
|