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