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