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