@seedprotocol/eas 0.7.9-next.1177.ga3e08ed → 0.7.9-next.1189.g5e63267
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/dist/EasClient/createEasGraphQLClient.d.ts.map +1 -1
- package/dist/{QueryClient-Ns40c8jS.js → QueryClient-vrzrZbSV.js} +164 -86
- package/dist/QueryClient-vrzrZbSV.js.map +1 -0
- package/dist/api.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.js +265 -262
- package/dist/index.js.map +1 -1
- package/dist/node.js +4 -4
- package/dist/node.js.map +1 -1
- package/package.json +1 -1
- 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-vrzrZbSV.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,208 @@ 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"), w = 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"), we = b("\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n"), Te = b("\n query GetStorageTransactionId($where: AttestationWhereInput!) {\n storageTransactionId: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n id\n decodedDataJson\n }\n }\n"), T = b("\n query GetVersions($where: AttestationWhereInput!) {\n itemVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), Ee = 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(T, { 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(Ee, { 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(T, { 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
|
-
if (!
|
|
2518
|
-
let { schemas:
|
|
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
|
+
}, O = async ({ schemaName: e }) => {
|
|
2516
|
+
let n = f.getQueryClient(), r = t.getEasClient();
|
|
2517
|
+
if (!n || !r) return;
|
|
2518
|
+
let { schemas: a } = await i(n, {
|
|
2519
2519
|
queryKey: ["getEasSchemaUidBySchemaName", e],
|
|
2520
|
-
queryFn: async () =>
|
|
2520
|
+
queryFn: async () => r.request(x, { where: { schema: { endsWith: e } } })
|
|
2521
2521
|
});
|
|
2522
|
-
if (
|
|
2523
|
-
},
|
|
2522
|
+
if (a && a.length !== 0) return a[0].id;
|
|
2523
|
+
}, Ne = async ({ schemaName: e }) => {
|
|
2524
2524
|
try {
|
|
2525
|
-
return await
|
|
2525
|
+
return await O({ schemaName: e });
|
|
2526
2526
|
} catch (t) {
|
|
2527
2527
|
process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for schema name ${e}:`, t);
|
|
2528
2528
|
return;
|
|
2529
2529
|
}
|
|
2530
|
-
},
|
|
2531
|
-
let
|
|
2532
|
-
attester: { in:
|
|
2530
|
+
}, Pe = async ({ schemaUids: e, addresses: n, excludeRevoked: r = !0 }) => {
|
|
2531
|
+
let a = {
|
|
2532
|
+
attester: { in: n.map((e) => {
|
|
2533
2533
|
try {
|
|
2534
|
-
return
|
|
2534
|
+
return h(e);
|
|
2535
2535
|
} catch {
|
|
2536
2536
|
return e;
|
|
2537
2537
|
}
|
|
2538
2538
|
}) },
|
|
2539
2539
|
schemaId: { in: e }
|
|
2540
2540
|
};
|
|
2541
|
-
|
|
2542
|
-
let
|
|
2541
|
+
r && (a = v(a));
|
|
2542
|
+
let o = f.getQueryClient(), s = t.getEasClient(), { itemSeeds: c } = await i(o, {
|
|
2543
2543
|
queryKey: [
|
|
2544
2544
|
"getSeedsForAllModels",
|
|
2545
|
-
|
|
2545
|
+
r,
|
|
2546
2546
|
[...e].sort(),
|
|
2547
|
-
[...
|
|
2547
|
+
[...n].sort()
|
|
2548
2548
|
],
|
|
2549
|
-
queryFn: async () =>
|
|
2549
|
+
queryFn: async () => s.request(S, { where: a })
|
|
2550
2550
|
});
|
|
2551
|
-
return
|
|
2552
|
-
},
|
|
2553
|
-
let
|
|
2554
|
-
where:
|
|
2555
|
-
...
|
|
2551
|
+
return c;
|
|
2552
|
+
}, k = async (e, n = 10, r, a) => {
|
|
2553
|
+
let o = r ?? 0, s = a?.uidPrefix, c = {
|
|
2554
|
+
where: v({
|
|
2555
|
+
...s === void 0 ? {} : { id: { startsWith: s } },
|
|
2556
2556
|
schema: { is: { schemaNames: { some: { name: { equals: e } } } } }
|
|
2557
2557
|
}),
|
|
2558
|
-
take:
|
|
2559
|
-
skip:
|
|
2560
|
-
},
|
|
2558
|
+
take: n,
|
|
2559
|
+
skip: o
|
|
2560
|
+
}, l = f.getQueryClient(), u = t.getEasClient(), { itemSeeds: d } = await i(l, {
|
|
2561
2561
|
queryKey: [
|
|
2562
2562
|
"getSeedsBySchemaName",
|
|
2563
2563
|
e,
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2564
|
+
n,
|
|
2565
|
+
o,
|
|
2566
|
+
s ?? null
|
|
2567
2567
|
],
|
|
2568
|
-
queryFn: async () =>
|
|
2568
|
+
queryFn: async () => u.request(C, c)
|
|
2569
2569
|
});
|
|
2570
|
-
return
|
|
2571
|
-
},
|
|
2570
|
+
return d.map((t) => Fe(t, [e]));
|
|
2571
|
+
}, Fe = (e, t) => ({
|
|
2572
2572
|
...e,
|
|
2573
2573
|
schema: { schemaNames: t.map((e) => ({ name: e })) }
|
|
2574
|
-
}),
|
|
2574
|
+
}), A = /* @__PURE__ */ new Map(), Ie = (e) => {
|
|
2575
2575
|
let t = "";
|
|
2576
2576
|
try {
|
|
2577
|
-
t =
|
|
2577
|
+
t = o();
|
|
2578
2578
|
} catch {}
|
|
2579
2579
|
return `${t}\n${e.toLowerCase()}`;
|
|
2580
|
-
},
|
|
2581
|
-
|
|
2582
|
-
},
|
|
2583
|
-
let
|
|
2584
|
-
for (let
|
|
2585
|
-
let e =
|
|
2586
|
-
e ?
|
|
2580
|
+
}, Le = () => {
|
|
2581
|
+
A.clear();
|
|
2582
|
+
}, Re = async (e) => {
|
|
2583
|
+
let n = /* @__PURE__ */ new Map(), r = [];
|
|
2584
|
+
for (let t of new Set(e)) {
|
|
2585
|
+
let e = A.get(Ie(t));
|
|
2586
|
+
e ? n.set(t, e) : r.push(t);
|
|
2587
2587
|
}
|
|
2588
|
-
if (
|
|
2589
|
-
let
|
|
2590
|
-
queryKey: ["getSchemaNamesBySchemaUids", [...
|
|
2591
|
-
queryFn: async () =>
|
|
2592
|
-
}),
|
|
2593
|
-
for (let e of
|
|
2594
|
-
let
|
|
2595
|
-
r &&
|
|
2588
|
+
if (r.length === 0) return n;
|
|
2589
|
+
let a = f.getQueryClient(), o = t.getEasClient(), { schemas: s } = await i(a, {
|
|
2590
|
+
queryKey: ["getSchemaNamesBySchemaUids", [...r].sort()],
|
|
2591
|
+
queryFn: async () => o.request(x, { where: { id: { in: r } } })
|
|
2592
|
+
}), c = new Map(r.map((e) => [e.toLowerCase(), e]));
|
|
2593
|
+
for (let e of s ?? []) {
|
|
2594
|
+
let t = (e.schemaNames ?? []).map((e) => e.name), r = c.get(e.id.toLowerCase());
|
|
2595
|
+
r && t.length !== 0 && (A.set(Ie(r), t), n.set(r, t));
|
|
2596
2596
|
}
|
|
2597
|
-
return
|
|
2598
|
-
},
|
|
2597
|
+
return n;
|
|
2598
|
+
}, ze = async ({ uids: e, excludeRevoked: n = !0 }) => {
|
|
2599
2599
|
if (e.length === 0) return [];
|
|
2600
|
-
let
|
|
2600
|
+
let r = n ? v({ id: { in: e } }) : { id: { in: e } }, a = f.getQueryClient(), o = t.getEasClient(), { itemSeeds: s } = await i(a, {
|
|
2601
2601
|
queryKey: [
|
|
2602
2602
|
"getSeedsByUidsFromEas",
|
|
2603
2603
|
[...e].sort(),
|
|
2604
|
-
|
|
2604
|
+
n
|
|
2605
2605
|
],
|
|
2606
|
-
queryFn: async () =>
|
|
2607
|
-
where:
|
|
2606
|
+
queryFn: async () => o.request(C, {
|
|
2607
|
+
where: r,
|
|
2608
2608
|
take: e.length,
|
|
2609
2609
|
skip: 0
|
|
2610
2610
|
})
|
|
2611
|
-
}),
|
|
2612
|
-
return
|
|
2613
|
-
},
|
|
2614
|
-
let
|
|
2611
|
+
}), c = s ?? [], l = await Re(c.map((e) => e.schemaId));
|
|
2612
|
+
return c.map((e) => Fe(e, l.get(e.schemaId) ?? []));
|
|
2613
|
+
}, Be = 400, Ve = async ({ refUIDs: e, ids: n, since: r }) => {
|
|
2614
|
+
let a = { OR: [{ timeCreated: { gt: r } }, { revocationTime: { gt: r } }] }, o = [], s = (e, t) => {
|
|
2615
2615
|
let n = [...new Set(t)].sort();
|
|
2616
|
-
for (let t = 0; t < n.length; t +=
|
|
2616
|
+
for (let t = 0; t < n.length; t += Be) o.push({ [e]: { in: n.slice(t, t + Be) } });
|
|
2617
2617
|
};
|
|
2618
|
-
if (
|
|
2619
|
-
let
|
|
2618
|
+
if (s("refUID", e), s("id", n), o.length === 0) return [];
|
|
2619
|
+
let c = f.getQueryClient(), l = t.getEasClient(), u = await Promise.all(o.map((e) => i(c, {
|
|
2620
2620
|
queryKey: [
|
|
2621
2621
|
"getAttestationChangesSince",
|
|
2622
2622
|
e,
|
|
2623
|
-
|
|
2623
|
+
r
|
|
2624
2624
|
],
|
|
2625
|
-
queryFn: async () =>
|
|
2626
|
-
}))),
|
|
2627
|
-
for (let { changes: e } of
|
|
2628
|
-
return [...
|
|
2629
|
-
},
|
|
2625
|
+
queryFn: async () => l.request(E, { where: { AND: [e, a] } })
|
|
2626
|
+
}))), d = /* @__PURE__ */ new Map();
|
|
2627
|
+
for (let { changes: e } of u) for (let t of e ?? []) d.set(t.id, t);
|
|
2628
|
+
return [...d.values()];
|
|
2629
|
+
}, He = async (e, t = 10) => (await k(e, t)).map((e) => e.id);
|
|
2630
2630
|
//#endregion
|
|
2631
2631
|
//#region src/easUid.ts
|
|
2632
|
-
function
|
|
2632
|
+
function Ue(e) {
|
|
2633
2633
|
if (e == null || e === "" || e === "NULL") return !0;
|
|
2634
2634
|
let t = e.trim();
|
|
2635
2635
|
return t === "" || t.toLowerCase() === "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
2636
2636
|
}
|
|
2637
|
-
function
|
|
2638
|
-
if (
|
|
2637
|
+
function We(e) {
|
|
2638
|
+
if (Ue(e)) return !1;
|
|
2639
2639
|
let t = String(e).trim();
|
|
2640
2640
|
if (!/^0x/i.test(t)) return !1;
|
|
2641
2641
|
let n = t.slice(2);
|
|
2642
2642
|
return n.length === 64 && /^[0-9a-fA-F]{64}$/.test(n);
|
|
2643
2643
|
}
|
|
2644
|
-
function
|
|
2644
|
+
function j(e) {
|
|
2645
2645
|
if (e == null || e === "") return "";
|
|
2646
2646
|
let t = String(e).trim();
|
|
2647
2647
|
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
2648
|
}
|
|
2649
2649
|
//#endregion
|
|
2650
2650
|
//#region src/domainOwnershipHelpers.ts
|
|
2651
|
-
var
|
|
2652
|
-
function
|
|
2651
|
+
var Ge = "string domain,address claimer,string method,bytes32 challengeHash,uint64 verifiedAt,string registryCreationDate,string registryExpirationDate,bytes32 registryFingerprint,string scope", Ke = "seedprotocol.domainOwnership", qe = "dns-txt-challenge", Je = "registrable", Ye = "hostname", Xe = "_seedprotocol-challenge", Ze = 2592e5, Qe = 31536e6, $e = 31536e3;
|
|
2652
|
+
function et(e) {
|
|
2653
2653
|
return new TextEncoder().encode(e);
|
|
2654
2654
|
}
|
|
2655
|
-
function
|
|
2655
|
+
function M(e) {
|
|
2656
2656
|
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
2657
2657
|
}
|
|
2658
|
-
function
|
|
2658
|
+
function N(e) {
|
|
2659
2659
|
let t = e.trim();
|
|
2660
2660
|
try {
|
|
2661
|
-
return
|
|
2661
|
+
return h(t).toLowerCase();
|
|
2662
2662
|
} catch {
|
|
2663
2663
|
return t.toLowerCase();
|
|
2664
2664
|
}
|
|
2665
2665
|
}
|
|
2666
|
-
function
|
|
2667
|
-
return `${
|
|
2666
|
+
function tt(e) {
|
|
2667
|
+
return `${Xe}.${M(e)}`;
|
|
2668
2668
|
}
|
|
2669
|
-
function
|
|
2670
|
-
let t =
|
|
2669
|
+
function nt(e) {
|
|
2670
|
+
let t = N(e.claimer);
|
|
2671
2671
|
return `token=${e.token},addr=${t},expiry=${e.expiry}`;
|
|
2672
2672
|
}
|
|
2673
|
-
function
|
|
2673
|
+
function rt(e) {
|
|
2674
2674
|
let t = e.replace(/^"+|"+$/g, "").trim(), n = /* @__PURE__ */ new Map();
|
|
2675
2675
|
for (let e of t.split(",")) {
|
|
2676
2676
|
let t = e.indexOf("=");
|
|
@@ -2681,50 +2681,50 @@ function at(e) {
|
|
|
2681
2681
|
let r = n.get("token"), i = n.get("addr") ?? n.get("claimer"), a = n.get("expiry");
|
|
2682
2682
|
return !r || !i || !a ? null : {
|
|
2683
2683
|
token: r,
|
|
2684
|
-
claimer:
|
|
2684
|
+
claimer: N(i),
|
|
2685
2685
|
expiry: a
|
|
2686
2686
|
};
|
|
2687
2687
|
}
|
|
2688
|
-
function
|
|
2689
|
-
let t =
|
|
2690
|
-
return "0x" +
|
|
2688
|
+
function it(e) {
|
|
2689
|
+
let t = M(e.domain), n = N(e.claimer), r = (e.scope ?? "registrable").trim();
|
|
2690
|
+
return "0x" + p(et(`${t}|${n}|${e.token}|${r}`));
|
|
2691
2691
|
}
|
|
2692
|
-
function
|
|
2692
|
+
function at(e) {
|
|
2693
2693
|
let t = {
|
|
2694
|
-
domain:
|
|
2694
|
+
domain: M(e.domain),
|
|
2695
2695
|
creationDate: (e.creationDate ?? "").trim(),
|
|
2696
2696
|
registrarIanaId: (e.registrarIanaId ?? "").trim()
|
|
2697
2697
|
};
|
|
2698
|
-
return "0x" +
|
|
2698
|
+
return "0x" + p(et(JSON.stringify(t)));
|
|
2699
2699
|
}
|
|
2700
|
-
function
|
|
2701
|
-
return typeof e == "string" ?
|
|
2700
|
+
function P(e) {
|
|
2701
|
+
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
2702
|
}
|
|
2703
|
-
function
|
|
2703
|
+
function F(e) {
|
|
2704
2704
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2705
2705
|
}
|
|
2706
|
-
function
|
|
2706
|
+
function ot(e) {
|
|
2707
2707
|
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2708
2708
|
if (typeof e == "bigint") return Number(e);
|
|
2709
2709
|
if (typeof e == "string" && e.trim() !== "") {
|
|
2710
2710
|
let t = Number(e);
|
|
2711
2711
|
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2712
2712
|
}
|
|
2713
|
-
return e && typeof e == "object" && "value" in e ?
|
|
2713
|
+
return e && typeof e == "object" && "value" in e ? ot(e.value) : 0;
|
|
2714
2714
|
}
|
|
2715
|
-
function
|
|
2715
|
+
function st(e) {
|
|
2716
2716
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2717
2717
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2718
2718
|
return {
|
|
2719
|
-
domain:
|
|
2720
|
-
claimer:
|
|
2721
|
-
method:
|
|
2722
|
-
challengeHash:
|
|
2723
|
-
verifiedAt:
|
|
2724
|
-
registryCreationDate:
|
|
2725
|
-
registryExpirationDate:
|
|
2726
|
-
registryFingerprint:
|
|
2727
|
-
scope:
|
|
2719
|
+
domain: M(F(n.get("domain")?.value)),
|
|
2720
|
+
claimer: N(F(n.get("claimer")?.value)),
|
|
2721
|
+
method: F(n.get("method")?.value),
|
|
2722
|
+
challengeHash: P(n.get("challengeHash")?.value),
|
|
2723
|
+
verifiedAt: ot(n.get("verifiedAt")?.value),
|
|
2724
|
+
registryCreationDate: F(n.get("registryCreationDate")?.value),
|
|
2725
|
+
registryExpirationDate: F(n.get("registryExpirationDate")?.value),
|
|
2726
|
+
registryFingerprint: P(n.get("registryFingerprint")?.value),
|
|
2727
|
+
scope: F(n.get("scope")?.value)
|
|
2728
2728
|
};
|
|
2729
2729
|
}
|
|
2730
2730
|
function ct(e) {
|
|
@@ -2742,11 +2742,11 @@ function lt(e) {
|
|
|
2742
2742
|
status: "unknown",
|
|
2743
2743
|
warnings: n
|
|
2744
2744
|
};
|
|
2745
|
-
if (e.registrySnapshot !== void 0) return
|
|
2745
|
+
if (e.registrySnapshot !== void 0) return j(at({
|
|
2746
2746
|
domain: e.decoded.domain,
|
|
2747
2747
|
creationDate: e.registrySnapshot.creationDate,
|
|
2748
2748
|
registrarIanaId: e.registrySnapshot.registrarIanaId
|
|
2749
|
-
})) ===
|
|
2749
|
+
})) === j(e.decoded.registryFingerprint) ? {
|
|
2750
2750
|
status: "valid",
|
|
2751
2751
|
warnings: n
|
|
2752
2752
|
} : (n.push("Registry creation date or registrar IANA id no longer matches attestation fingerprint"), {
|
|
@@ -2768,38 +2768,38 @@ function ut(e) {
|
|
|
2768
2768
|
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
2769
2769
|
}
|
|
2770
2770
|
async function dt(e) {
|
|
2771
|
-
let { toolAddresses:
|
|
2772
|
-
if (!
|
|
2773
|
-
let s =
|
|
2771
|
+
let { toolAddresses: n, domains: r, claimers: i, schemaUid: a, excludeRevoked: o = !0 } = e;
|
|
2772
|
+
if (!n.length) return [];
|
|
2773
|
+
let s = n.map((e) => {
|
|
2774
2774
|
try {
|
|
2775
|
-
return
|
|
2775
|
+
return h(e);
|
|
2776
2776
|
} catch {
|
|
2777
2777
|
return e;
|
|
2778
2778
|
}
|
|
2779
2779
|
}), c = { attester: { in: s } };
|
|
2780
|
-
a ? c.schemaId = { equals: a } : c.schema = { is: { schemaNames: { some: { name: { equals:
|
|
2780
|
+
a ? c.schemaId = { equals: a } : c.schema = { is: { schemaNames: { some: { name: { equals: Ke } } } } }, i?.length && (c.recipient = { in: i.map((e) => {
|
|
2781
2781
|
try {
|
|
2782
|
-
return
|
|
2782
|
+
return h(e);
|
|
2783
2783
|
} catch {
|
|
2784
2784
|
return e;
|
|
2785
2785
|
}
|
|
2786
|
-
}) }), o && (c =
|
|
2787
|
-
let l =
|
|
2786
|
+
}) }), o && (c = v(c));
|
|
2787
|
+
let l = f.getQueryClient(), u = t.getEasClient(), { domainOwnerships: d } = await l.fetchQuery({
|
|
2788
2788
|
queryKey: [
|
|
2789
2789
|
"getDomainOwnershipFromEas",
|
|
2790
2790
|
o,
|
|
2791
2791
|
a ?? "seedprotocol.domainOwnership",
|
|
2792
2792
|
[...s].sort(),
|
|
2793
|
-
[...(
|
|
2794
|
-
[...
|
|
2793
|
+
[...(r ?? []).map(ut)].sort(),
|
|
2794
|
+
[...i ?? []].map((e) => e.toLowerCase()).sort()
|
|
2795
2795
|
],
|
|
2796
|
-
queryFn: async () => u.request(
|
|
2796
|
+
queryFn: async () => u.request(w, { where: c })
|
|
2797
2797
|
});
|
|
2798
|
-
if (!
|
|
2799
|
-
let ee = new Set(
|
|
2798
|
+
if (!r?.length) return d;
|
|
2799
|
+
let ee = new Set(r.map(ut));
|
|
2800
2800
|
return d.filter((e) => {
|
|
2801
2801
|
try {
|
|
2802
|
-
let t =
|
|
2802
|
+
let t = st(e.decodedDataJson ?? "[]");
|
|
2803
2803
|
return ee.has(t.domain);
|
|
2804
2804
|
} catch {
|
|
2805
2805
|
return !1;
|
|
@@ -2809,39 +2809,39 @@ async function dt(e) {
|
|
|
2809
2809
|
//#endregion
|
|
2810
2810
|
//#region src/publishAuthorizationHelpers.ts
|
|
2811
2811
|
var ft = "address identity,address sessionKey,address app,string scopes,uint64 grantedAt,uint64 expiresAt,bytes32 permissionsHash", pt = "seedprotocol.publishAuthorization", mt = "publish,revoke", ht = 31536e3;
|
|
2812
|
-
function
|
|
2812
|
+
function I(e) {
|
|
2813
2813
|
let t = e.trim();
|
|
2814
2814
|
try {
|
|
2815
|
-
return
|
|
2815
|
+
return h(t).toLowerCase();
|
|
2816
2816
|
} catch {
|
|
2817
2817
|
return t.toLowerCase();
|
|
2818
2818
|
}
|
|
2819
2819
|
}
|
|
2820
2820
|
function gt(e) {
|
|
2821
|
-
return typeof e == "string" ?
|
|
2821
|
+
return typeof e == "string" ? j(e) : e && typeof e == "object" && "hex" in e ? j(String(e.hex)) : j(String(e ?? ""));
|
|
2822
2822
|
}
|
|
2823
|
-
function
|
|
2823
|
+
function L(e) {
|
|
2824
2824
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2825
2825
|
}
|
|
2826
|
-
function
|
|
2826
|
+
function R(e) {
|
|
2827
2827
|
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2828
2828
|
if (typeof e == "bigint") return Number(e);
|
|
2829
2829
|
if (typeof e == "string" && e.trim() !== "") {
|
|
2830
2830
|
let t = Number(e);
|
|
2831
2831
|
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2832
2832
|
}
|
|
2833
|
-
return e && typeof e == "object" && "value" in e ?
|
|
2833
|
+
return e && typeof e == "object" && "value" in e ? R(e.value) : 0;
|
|
2834
2834
|
}
|
|
2835
2835
|
function _t(e) {
|
|
2836
2836
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2837
2837
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2838
2838
|
return {
|
|
2839
|
-
identity:
|
|
2840
|
-
sessionKey:
|
|
2841
|
-
app:
|
|
2842
|
-
scopes:
|
|
2843
|
-
grantedAt:
|
|
2844
|
-
expiresAt:
|
|
2839
|
+
identity: I(L(n.get("identity")?.value)),
|
|
2840
|
+
sessionKey: I(L(n.get("sessionKey")?.value)),
|
|
2841
|
+
app: I(L(n.get("app")?.value)),
|
|
2842
|
+
scopes: L(n.get("scopes")?.value),
|
|
2843
|
+
grantedAt: R(n.get("grantedAt")?.value),
|
|
2844
|
+
expiresAt: R(n.get("expiresAt")?.value),
|
|
2845
2845
|
permissionsHash: gt(n.get("permissionsHash")?.value)
|
|
2846
2846
|
};
|
|
2847
2847
|
}
|
|
@@ -2862,38 +2862,38 @@ function vt(e) {
|
|
|
2862
2862
|
});
|
|
2863
2863
|
}
|
|
2864
2864
|
function yt(e) {
|
|
2865
|
-
return "0x" +
|
|
2865
|
+
return "0x" + p(new TextEncoder().encode(e));
|
|
2866
2866
|
}
|
|
2867
2867
|
//#endregion
|
|
2868
2868
|
//#region src/publishAuthorization.ts
|
|
2869
2869
|
async function bt(e = {}) {
|
|
2870
|
-
let { identities:
|
|
2871
|
-
a ? s.schemaId = { equals: a } : s.schema = { is: { schemaNames: { some: { name: { equals: pt } } } } },
|
|
2870
|
+
let { identities: n, sessionKeys: r, apps: i, schemaUid: a, excludeRevoked: o = !0 } = e, s = {};
|
|
2871
|
+
a ? s.schemaId = { equals: a } : s.schema = { is: { schemaNames: { some: { name: { equals: pt } } } } }, n?.length && (s.attester = { in: n.map((e) => {
|
|
2872
2872
|
try {
|
|
2873
|
-
return
|
|
2873
|
+
return h(e);
|
|
2874
2874
|
} catch {
|
|
2875
2875
|
return e;
|
|
2876
2876
|
}
|
|
2877
|
-
}) }),
|
|
2877
|
+
}) }), r?.length && (s.recipient = { in: r.map((e) => {
|
|
2878
2878
|
try {
|
|
2879
|
-
return
|
|
2879
|
+
return h(e);
|
|
2880
2880
|
} catch {
|
|
2881
2881
|
return e;
|
|
2882
2882
|
}
|
|
2883
|
-
}) }), o && (s =
|
|
2884
|
-
let c =
|
|
2883
|
+
}) }), o && (s = v(s));
|
|
2884
|
+
let c = f.getQueryClient(), l = t.getEasClient(), { itemSeeds: u } = await c.fetchQuery({
|
|
2885
2885
|
queryKey: [
|
|
2886
2886
|
"getPublishAuthorizationFromEas",
|
|
2887
2887
|
o,
|
|
2888
2888
|
a ?? "seedprotocol.publishAuthorization",
|
|
2889
|
-
[...t ?? []].map((e) => e.toLowerCase()).sort(),
|
|
2890
2889
|
[...n ?? []].map((e) => e.toLowerCase()).sort(),
|
|
2891
|
-
[...r ?? []].map((e) => e.toLowerCase()).sort()
|
|
2890
|
+
[...r ?? []].map((e) => e.toLowerCase()).sort(),
|
|
2891
|
+
[...i ?? []].map((e) => e.toLowerCase()).sort()
|
|
2892
2892
|
],
|
|
2893
|
-
queryFn: async () => l.request(
|
|
2893
|
+
queryFn: async () => l.request(S, { where: s })
|
|
2894
2894
|
});
|
|
2895
|
-
if (!
|
|
2896
|
-
let d = new Set(
|
|
2895
|
+
if (!i?.length) return u;
|
|
2896
|
+
let d = new Set(i.map((e) => e.toLowerCase()));
|
|
2897
2897
|
return u.filter((e) => {
|
|
2898
2898
|
try {
|
|
2899
2899
|
let t = _t(e.decodedDataJson ?? "[]");
|
|
@@ -2905,25 +2905,25 @@ async function bt(e = {}) {
|
|
|
2905
2905
|
}
|
|
2906
2906
|
//#endregion
|
|
2907
2907
|
//#region src/easNames.ts
|
|
2908
|
-
var
|
|
2908
|
+
var z = (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(), xt = [
|
|
2909
2909
|
"exact",
|
|
2910
2910
|
"normalized",
|
|
2911
2911
|
"fuzzy"
|
|
2912
|
-
],
|
|
2912
|
+
], St = (e) => typeof e == "string" && xt.includes(e), B = {
|
|
2913
2913
|
exact: 0,
|
|
2914
2914
|
normalized: 1,
|
|
2915
2915
|
fuzzy: 2
|
|
2916
|
-
},
|
|
2916
|
+
}, Ct = "fuzzy", V = (e) => e.toLowerCase().replace(/[^a-z0-9]/g, ""), H = (e, t = {}) => {
|
|
2917
2917
|
let n = V(e);
|
|
2918
2918
|
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
2919
|
};
|
|
2920
2920
|
function U(e, t, n = {}) {
|
|
2921
|
-
if (
|
|
2921
|
+
if (z(e) === t) return "exact";
|
|
2922
2922
|
if (V(e) === V(t)) return "normalized";
|
|
2923
2923
|
if (H(e, n) === H(t, n)) return "fuzzy";
|
|
2924
2924
|
}
|
|
2925
2925
|
var W = (e, t) => B[e] <= B[t], G = (e, t) => B[e] - B[t];
|
|
2926
|
-
function
|
|
2926
|
+
function wt(e, t) {
|
|
2927
2927
|
let n, r = [];
|
|
2928
2928
|
for (let i of t) {
|
|
2929
2929
|
let t = U(i.name, e, { relation: i.relation });
|
|
@@ -2939,7 +2939,7 @@ function Ct(e, t) {
|
|
|
2939
2939
|
tier: n
|
|
2940
2940
|
};
|
|
2941
2941
|
}
|
|
2942
|
-
function
|
|
2942
|
+
function Tt(e, t, n = {}) {
|
|
2943
2943
|
let r = typeof n.level == "function" ? n.level : () => n.level ?? "fuzzy", i, a = /* @__PURE__ */ new Set();
|
|
2944
2944
|
for (let o of t) {
|
|
2945
2945
|
let t = U(o, e, { relation: n.relation });
|
|
@@ -2947,73 +2947,76 @@ function wt(e, t, n = {}) {
|
|
|
2947
2947
|
}
|
|
2948
2948
|
return a;
|
|
2949
2949
|
}
|
|
2950
|
-
function
|
|
2950
|
+
function Et(e) {
|
|
2951
2951
|
let t = e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
|
|
2952
2952
|
return [.../* @__PURE__ */ new Set([
|
|
2953
|
-
|
|
2953
|
+
z(e),
|
|
2954
2954
|
t,
|
|
2955
2955
|
V(e)
|
|
2956
2956
|
])];
|
|
2957
2957
|
}
|
|
2958
|
-
function
|
|
2959
|
-
if (t === "exact") return [
|
|
2960
|
-
let n = /* @__PURE__ */ new Set([...
|
|
2958
|
+
function Dt(e, t = Ct) {
|
|
2959
|
+
if (t === "exact") return [z(e)];
|
|
2960
|
+
let n = /* @__PURE__ */ new Set([...Et(e), e]);
|
|
2961
2961
|
if (t === "fuzzy") for (let e of [...n]) n.add(e.endsWith("s") ? e.slice(0, -1) : `${e}s`);
|
|
2962
2962
|
return [...n];
|
|
2963
2963
|
}
|
|
2964
2964
|
//#endregion
|
|
2965
2965
|
//#region src/easValues.ts
|
|
2966
|
-
var
|
|
2967
|
-
function
|
|
2966
|
+
var Ot = /^-?\d+$/, kt = /^(-?)0x([0-9a-f]+)$/i;
|
|
2967
|
+
function At(e) {
|
|
2968
2968
|
return typeof e == "string" && /^u?int\d*$/.test(e);
|
|
2969
2969
|
}
|
|
2970
|
-
function
|
|
2971
|
-
let t =
|
|
2970
|
+
function jt(e) {
|
|
2971
|
+
let t = kt.exec(e.trim());
|
|
2972
2972
|
if (!t) return;
|
|
2973
2973
|
let n = BigInt("0x" + t[2]);
|
|
2974
2974
|
return (t[1] ? -n : n).toString();
|
|
2975
2975
|
}
|
|
2976
|
-
function
|
|
2976
|
+
function Mt(e) {
|
|
2977
2977
|
if (typeof e == "bigint") return e.toString();
|
|
2978
2978
|
if (typeof e == "number") return Number.isFinite(e) ? String(e) : void 0;
|
|
2979
2979
|
if (typeof e == "string") {
|
|
2980
2980
|
let t = e.trim();
|
|
2981
2981
|
if (!t) return;
|
|
2982
|
-
if (
|
|
2983
|
-
if (
|
|
2982
|
+
if (Ot.test(t)) return BigInt(t).toString();
|
|
2983
|
+
if (kt.test(t)) return jt(t);
|
|
2984
2984
|
let n = Number(t);
|
|
2985
2985
|
return Number.isFinite(n) ? String(n) : void 0;
|
|
2986
2986
|
}
|
|
2987
2987
|
if (e && typeof e == "object") {
|
|
2988
2988
|
let t = e.hex ?? e._hex;
|
|
2989
|
-
if (typeof t == "string") return
|
|
2989
|
+
if (typeof t == "string") return jt(t);
|
|
2990
2990
|
}
|
|
2991
2991
|
}
|
|
2992
|
+
function Nt(e, t) {
|
|
2993
|
+
return e === "string" ? t === "" : e === "bytes32" && typeof t == "string" && /^0x0{64}$/i.test(t);
|
|
2994
|
+
}
|
|
2992
2995
|
//#endregion
|
|
2993
2996
|
//#region src/publishedByHelpers.ts
|
|
2994
|
-
var
|
|
2995
|
-
function
|
|
2997
|
+
var Pt = "bytes32 seedUid,bytes32 versionUid,bytes32[] attestationUids,bytes32 batchHash,string toolName,string toolVersion", Ft = "seedprotocol.publishedBy";
|
|
2998
|
+
function It(e) {
|
|
2996
2999
|
let t = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, n = new Uint8Array(t.length / 2);
|
|
2997
3000
|
for (let e = 0; e < n.length; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
|
|
2998
3001
|
return n;
|
|
2999
3002
|
}
|
|
3000
|
-
function
|
|
3001
|
-
let t = [...e].map((e) =>
|
|
3002
|
-
if (t.length === 0) return "0x" +
|
|
3003
|
+
function Lt(e) {
|
|
3004
|
+
let t = [...e].map((e) => j(e)).filter((e) => e !== "" && We(e)).sort();
|
|
3005
|
+
if (t.length === 0) return "0x" + p(/* @__PURE__ */ new Uint8Array());
|
|
3003
3006
|
let n = new Uint8Array(t.length * 32);
|
|
3004
|
-
for (let e = 0; e < t.length; e++) n.set(
|
|
3005
|
-
return "0x" +
|
|
3007
|
+
for (let e = 0; e < t.length; e++) n.set(It(t[e]), e * 32);
|
|
3008
|
+
return "0x" + p(n);
|
|
3006
3009
|
}
|
|
3007
|
-
function
|
|
3008
|
-
return
|
|
3010
|
+
function Rt(e) {
|
|
3011
|
+
return j(Lt(e.attestationUids)) === j(e.batchHash);
|
|
3009
3012
|
}
|
|
3010
3013
|
function K(e) {
|
|
3011
|
-
return typeof e == "string" ?
|
|
3014
|
+
return typeof e == "string" ? j(e) : e && typeof e == "object" && "hex" in e ? j(String(e.hex)) : j(String(e ?? ""));
|
|
3012
3015
|
}
|
|
3013
|
-
function
|
|
3016
|
+
function zt(e) {
|
|
3014
3017
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
3015
3018
|
}
|
|
3016
|
-
function
|
|
3019
|
+
function Bt(e) {
|
|
3017
3020
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
3018
3021
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
3019
3022
|
let r = n.get("attestationUids")?.value, i = [];
|
|
@@ -3022,84 +3025,84 @@ function Rt(e) {
|
|
|
3022
3025
|
versionUid: K(n.get("versionUid")?.value),
|
|
3023
3026
|
attestationUids: i,
|
|
3024
3027
|
batchHash: K(n.get("batchHash")?.value),
|
|
3025
|
-
toolName:
|
|
3026
|
-
toolVersion:
|
|
3028
|
+
toolName: zt(n.get("toolName")?.value),
|
|
3029
|
+
toolVersion: zt(n.get("toolVersion")?.value)
|
|
3027
3030
|
};
|
|
3028
3031
|
}
|
|
3029
3032
|
//#endregion
|
|
3030
3033
|
//#region src/publishedBy.ts
|
|
3031
|
-
async function
|
|
3032
|
-
let { toolAddresses:
|
|
3033
|
-
if (!
|
|
3034
|
-
let o =
|
|
3034
|
+
async function Vt(e) {
|
|
3035
|
+
let { toolAddresses: n, refUIDs: r, schemaUid: i, excludeRevoked: a = !0 } = e;
|
|
3036
|
+
if (!n.length) return [];
|
|
3037
|
+
let o = n.map((e) => {
|
|
3035
3038
|
try {
|
|
3036
|
-
return
|
|
3039
|
+
return h(e);
|
|
3037
3040
|
} catch {
|
|
3038
3041
|
return e;
|
|
3039
3042
|
}
|
|
3040
3043
|
}), s = { attester: { in: o } };
|
|
3041
|
-
|
|
3042
|
-
let c =
|
|
3044
|
+
i ? s.schemaId = { equals: i } : s.schema = { is: { schemaNames: { some: { name: { equals: Ft } } } } }, r?.length && (s.refUID = { in: r }), a && (s = v(s));
|
|
3045
|
+
let c = f.getQueryClient(), l = t.getEasClient(), { itemSeeds: u } = await c.fetchQuery({
|
|
3043
3046
|
queryKey: [
|
|
3044
3047
|
"getPublishedByFromEas",
|
|
3045
3048
|
a,
|
|
3046
|
-
|
|
3049
|
+
i ?? "seedprotocol.publishedBy",
|
|
3047
3050
|
[...o].sort(),
|
|
3048
|
-
[...
|
|
3051
|
+
[...r ?? []].sort()
|
|
3049
3052
|
],
|
|
3050
|
-
queryFn: async () => l.request(
|
|
3053
|
+
queryFn: async () => l.request(S, { where: s })
|
|
3051
3054
|
});
|
|
3052
3055
|
return u;
|
|
3053
3056
|
}
|
|
3054
3057
|
//#endregion
|
|
3055
3058
|
//#region src/default/index.ts
|
|
3056
|
-
function
|
|
3057
|
-
|
|
3059
|
+
function Ht() {
|
|
3060
|
+
t.isConfigured() || t.configure(new ne()), f.isConfigured() || f.configure(new se());
|
|
3058
3061
|
}
|
|
3059
3062
|
//#endregion
|
|
3060
3063
|
//#region src/stores/schemaUidCache.ts
|
|
3061
|
-
var q = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(),
|
|
3064
|
+
var q = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), Ut = 3e5, Y = /* @__PURE__ */ new Map(), X = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map(), Q = 0, Wt = () => {
|
|
3062
3065
|
try {
|
|
3063
|
-
return
|
|
3066
|
+
return o();
|
|
3064
3067
|
} catch {
|
|
3065
3068
|
return "";
|
|
3066
3069
|
}
|
|
3067
|
-
},
|
|
3068
|
-
let n =
|
|
3070
|
+
}, Gt = (e) => `${Wt()}\n${e}`, $ = async (e, t) => {
|
|
3071
|
+
let n = Gt(e), r = X.get(n);
|
|
3069
3072
|
if (r !== void 0) {
|
|
3070
3073
|
if (Date.now() < r) return;
|
|
3071
3074
|
X.delete(n);
|
|
3072
3075
|
}
|
|
3073
3076
|
let i = Z.get(n);
|
|
3074
3077
|
if (i) return i;
|
|
3075
|
-
let a = Q, o = t().then((e) => (!e && a === Q && X.set(n, Date.now() +
|
|
3078
|
+
let a = Q, o = t().then((e) => (!e && a === Q && X.set(n, Date.now() + Ut), e)).finally(() => {
|
|
3076
3079
|
Z.get(n) === o && Z.delete(n);
|
|
3077
3080
|
});
|
|
3078
3081
|
return Z.set(n, o), o;
|
|
3079
|
-
},
|
|
3082
|
+
}, Kt = () => {
|
|
3080
3083
|
Q++, X.clear(), Z.clear();
|
|
3081
|
-
},
|
|
3082
|
-
let t = `${
|
|
3084
|
+
}, qt = (e) => {
|
|
3085
|
+
let t = `${Wt()}\n`, n = (n) => n.startsWith(t) && e(n.slice(t.length)), r = !1;
|
|
3083
3086
|
for (let e of [...X.keys()]) n(e) && X.delete(e);
|
|
3084
3087
|
for (let e of [...Z.keys()]) n(e) && (Z.delete(e), r = !0);
|
|
3085
3088
|
r && Q++;
|
|
3086
|
-
},
|
|
3087
|
-
let t =
|
|
3089
|
+
}, Jt = (e) => {
|
|
3090
|
+
let t = m(e);
|
|
3088
3091
|
return (n) => n === `definition:${e}` || n.startsWith("schemaName:") && t.endsWith(n.slice(11));
|
|
3089
|
-
},
|
|
3090
|
-
q.clear(), J.clear(), Y.clear(),
|
|
3091
|
-
},
|
|
3092
|
-
q.set(
|
|
3093
|
-
},
|
|
3092
|
+
}, Yt = () => {
|
|
3093
|
+
q.clear(), J.clear(), Y.clear(), Kt();
|
|
3094
|
+
}, Xt = ({ text: e, schemaUid: t }) => {
|
|
3095
|
+
q.set(m(e), t), qt(Jt(e));
|
|
3096
|
+
}, Zt = ({ modelName: e, schemaUid: t }) => {
|
|
3094
3097
|
J.set(e.toLowerCase(), t);
|
|
3095
|
-
let n = `model:${
|
|
3096
|
-
|
|
3097
|
-
},
|
|
3098
|
-
let t =
|
|
3098
|
+
let n = `model:${z(e)}`;
|
|
3099
|
+
qt((e) => e === n);
|
|
3100
|
+
}, Qt = (e) => J.get(e.toLowerCase()), $t = (e) => q.get(m(e)), en = async ({ schemaText: e }) => {
|
|
3101
|
+
let t = m(e);
|
|
3099
3102
|
if (!q.has(t)) {
|
|
3100
3103
|
let e;
|
|
3101
3104
|
try {
|
|
3102
|
-
e = await $(`schemaName:${t}`, () =>
|
|
3105
|
+
e = await $(`schemaName:${t}`, () => O({ schemaName: t }));
|
|
3103
3106
|
} catch (e) {
|
|
3104
3107
|
process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for schema name ${t}:`, e);
|
|
3105
3108
|
return;
|
|
@@ -3107,21 +3110,21 @@ var q = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), Vt = 3e5, Y =
|
|
|
3107
3110
|
return e && q.set(t, e), e;
|
|
3108
3111
|
}
|
|
3109
3112
|
return q.get(t);
|
|
3110
|
-
},
|
|
3111
|
-
let
|
|
3112
|
-
if (
|
|
3113
|
-
let
|
|
3114
|
-
if (!
|
|
3113
|
+
}, tn = async (e) => {
|
|
3114
|
+
let n = Gt(e), r = Y.get(n);
|
|
3115
|
+
if (r) return r;
|
|
3116
|
+
let i = f.getQueryClient(), a = t.getEasClient();
|
|
3117
|
+
if (!i || !a) return;
|
|
3115
3118
|
let o = await $(`definition:${e}`, async () => {
|
|
3116
|
-
let t = await
|
|
3119
|
+
let t = await i.fetchQuery({
|
|
3117
3120
|
queryKey: ["getSchemaByDefinition", e],
|
|
3118
|
-
queryFn: async () => a.request(
|
|
3121
|
+
queryFn: async () => a.request(Ce, { where: { schema: { equals: e } } })
|
|
3119
3122
|
}), n = t?.schemas ?? t?.data?.schemas;
|
|
3120
3123
|
return Array.isArray(n) && n.length > 0 ? n[0].id : void 0;
|
|
3121
3124
|
});
|
|
3122
|
-
return o && Y.set(
|
|
3125
|
+
return o && Y.set(n, o), o;
|
|
3123
3126
|
};
|
|
3124
3127
|
//#endregion
|
|
3125
|
-
export {
|
|
3128
|
+
export { t as BaseEasClient, t as EasClient, f as BaseQueryClient, te as DEFAULT_EAS_CHAIN_ID, Ct as DEFAULT_NAME_MATCH_LEVEL, Ze as DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS, $e as DOMAIN_OWNERSHIP_DEFAULT_EXPIRATION_SECS, qe as DOMAIN_OWNERSHIP_METHOD, Ge as DOMAIN_OWNERSHIP_SCHEMA_DEF, Ke as DOMAIN_OWNERSHIP_SCHEMA_NAME, Ye as DOMAIN_OWNERSHIP_SCOPE_HOSTNAME, Je as DOMAIN_OWNERSHIP_SCOPE_REGISTRABLE, Qe as DOMAIN_OWNERSHIP_SOFT_STALE_MS, Xe 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, w as GET_DOMAIN_OWNERSHIPS, Oe as GET_FILES_METADATA, ke as GET_IMAGE_SEEDS, Ae as GET_IMAGE_VERSIONS, Ee as GET_PROPERTIES, x as GET_SCHEMAS, Ce as GET_SCHEMA_BY_NAME, S as GET_SEEDS, C as GET_SEEDS_LEAN, we as GET_SEED_IDS, Te as GET_STORAGE_TRANSACTION_ID, T as GET_VERSIONS, xt as NAME_MATCH_LEVELS, l as OP_STACK_EAS_CONTRACT_ADDRESS, r as OP_STACK_SCHEMA_REGISTRY_ADDRESS, Pt as PUBLISHED_BY_SCHEMA_DEF, Ft as PUBLISHED_BY_SCHEMA_NAME, ht as PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS, ft as PUBLISH_AUTHORIZATION_SCHEMA_DEF, pt as PUBLISH_AUTHORIZATION_SCHEMA_NAME, mt as PUBLISH_AUTHORIZATION_SCOPES, Ut 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, lt as assessDomainOwnership, vt as assessPublishAuthorization, nt as buildDomainOwnershipTxtValue, $ as cachedSchemaLookup, h as checksumAddress, Kt as clearSchemaLookupMisses, G as compareNameMatchTiers, re as configureEasReadChain, d as createEasGraphQLClient, st as decodeDomainOwnershipData, Mt as decodeEasNumber, _t as decodePublishAuthorizationData, Bt as decodePublishedByData, tt as domainOwnershipTxtName, z as easName, Et as easNameVariants, Dt as easNamesToFetch, Ht as ensureEasPlatform, oe as expectEasReadChain, O as fetchEasSchemaUidBySchemaName, H as fuzzyNameKey, Ve as getAttestationChangesSince, Me as getCanonicalItemPropertiesFromEas, dt as getDomainOwnershipFromEas, le as getEasAttestationExplorerUrl, de as getEasChainDeployment, o as getEasEndpoint, ee as getEasReadChainId, Ne as getEasSchemaUidBySchemaName, tn as getEasSchemaUidForExactDefinition, en as getEasSchemaUidForSchemaDefinition, D as getItemPropertiesFromEas, je as getItemVersionsFromEas, bt as getPublishAuthorizationFromEas, Vt as getPublishedByFromEas, Re as getSchemaNamesBySchemaUids, Qt as getSchemaUidForModelFromCache, $t as getSchemaUidForSchemaDefinitionFromCache, He as getSeedUidsBySchemaName, k as getSeedsBySchemaName, ze as getSeedsByUidsFromEas, Pe as getSeedsFromSchemaUids, it as hashDomainOwnershipChallenge, at as hashDomainRegistryFingerprint, yt as hashPublishAuthorizationMaterial, Lt as hashPublishedByBatch, Nt as isEasEmptyValue, ce as isEasReadChainConfigured, s as isEasReadChainSettled, W as isNameMatchAllowed, St as isNameMatchLevel, At as isNumericEasType, Ue as isPlaceholderUid, We as isValidEasAttestationUid, _ as keepAttestationsFromRefAttester, Tt as localNamesInBestMatchTier, wt as matchEasName, U as nameMatchTier, j as normalizeBytes32Hex, V as normalizedNameKey, rt as parseDomainOwnershipTxtValue, ge as partitionByRefAttester, g as pickLatestPropertyAttestationsByRefAndSchema, n as resetEasClientOwnerForTests, c as resetEasReadChain, Le as resetSchemaNamesCache, Yt as resetSchemaUidCaches, a as resolveEasChainDeployment, Zt as setSchemaUidForModel, Xt as setSchemaUidForSchemaDefinition, m as toSnakeCase, Rt as verifyPublishedByBatch, ie as whenEasReadChainSettled, v as withExcludeRevokedFilter };
|
|
3126
3129
|
|
|
3127
3130
|
//# sourceMappingURL=index.js.map
|