@seedprotocol/eas 0.7.2 → 0.7.3-next.654.g52217f6
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/BaseEasClient.d.ts +2 -0
- package/dist/EasClient/BaseEasClient.d.ts.map +1 -1
- package/dist/QueryClient/BaseQueryClient.d.ts +2 -0
- package/dist/QueryClient/BaseQueryClient.d.ts.map +1 -1
- package/dist/{easEndpoint-BYyoBW_s.js → QueryClient-Ch6F96Za.js} +115 -64
- package/dist/QueryClient-Ch6F96Za.js.map +1 -0
- package/dist/default/EasClient.d.ts +9 -0
- package/dist/default/EasClient.d.ts.map +1 -0
- package/dist/default/QueryClient.d.ts +17 -0
- package/dist/default/QueryClient.d.ts.map +1 -0
- package/dist/default/index.d.ts +8 -0
- package/dist/default/index.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +268 -263
- package/dist/index.js.map +1 -1
- package/dist/node/EasClient.d.ts +2 -6
- package/dist/node/EasClient.d.ts.map +1 -1
- package/dist/node/QueryClient.d.ts +2 -14
- package/dist/node/QueryClient.d.ts.map +1 -1
- package/dist/node.js +8 -50
- package/dist/node.js.map +1 -1
- package/package.json +1 -1
- package/dist/easEndpoint-BYyoBW_s.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as
|
|
2
|
-
import { keccak_256 as
|
|
3
|
-
import { bytesToHex as
|
|
1
|
+
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as ee, r as te, s as ne, t as f, u as re, v as p, y as m } from "./QueryClient-Ch6F96Za.js";
|
|
2
|
+
import { keccak_256 as ie } from "@noble/hashes/sha3";
|
|
3
|
+
import { bytesToHex as ae, utf8ToBytes as oe } from "@noble/hashes/utils";
|
|
4
4
|
//#region src/keccak.ts
|
|
5
|
-
function
|
|
6
|
-
let t = typeof e == "string" ?
|
|
7
|
-
return ie(
|
|
5
|
+
function h(e) {
|
|
6
|
+
let t = typeof e == "string" ? oe(e) : e;
|
|
7
|
+
return ae(ie(t));
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/utils.ts
|
|
11
|
-
var
|
|
12
|
-
function
|
|
11
|
+
var g = (e) => e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
|
|
12
|
+
function _(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 = h(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 se = (e) => {
|
|
22
22
|
let t = /* @__PURE__ */ new Map();
|
|
23
23
|
for (let n of e) {
|
|
24
24
|
let e = n.schemaId;
|
|
@@ -28,10 +28,10 @@ var _ = (e) => {
|
|
|
28
28
|
}
|
|
29
29
|
return t;
|
|
30
30
|
};
|
|
31
|
-
function
|
|
32
|
-
let n =
|
|
31
|
+
function ce(e, t) {
|
|
32
|
+
let n = se(e.filter((e) => !e.revoked));
|
|
33
33
|
if (t?.ifAllRevoked !== "newestRevoked") return [...n.values()];
|
|
34
|
-
let r =
|
|
34
|
+
let r = se(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
|
}
|
|
@@ -46,7 +46,7 @@ function v(e) {
|
|
|
46
46
|
}
|
|
47
47
|
//#endregion
|
|
48
48
|
//#region src/graphql/gql/gql.ts
|
|
49
|
-
var
|
|
49
|
+
var le = {
|
|
50
50
|
"\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": {
|
|
51
51
|
kind: "Document",
|
|
52
52
|
definitions: [{
|
|
@@ -2295,189 +2295,189 @@ var se = {
|
|
|
2295
2295
|
}
|
|
2296
2296
|
};
|
|
2297
2297
|
function y(e) {
|
|
2298
|
-
return
|
|
2298
|
+
return le[e] ?? {};
|
|
2299
2299
|
}
|
|
2300
2300
|
//#endregion
|
|
2301
2301
|
//#region src/queries.ts
|
|
2302
|
-
var b = y("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"),
|
|
2303
|
-
let
|
|
2302
|
+
var b = y("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), x = y("\n query GetSchemaByName($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), S = y("\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 = y("\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"), ue = y("\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n"), de = y("\n query GetStorageTransactionId($where: AttestationWhereInput!) {\n storageTransactionId: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n id\n decodedDataJson\n }\n }\n"), fe = y("\n query GetVersions($where: AttestationWhereInput!) {\n itemVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), pe = y("\n query GetProperties($where: AttestationWhereInput!) {\n itemProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), me = y("\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\n allProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), he = y("\n query GetFilesMetadata($where: AttestationWhereInput!) {\n filesMetadata: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), ge = y("\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"), _e = y("\n query GetImageVersions($where: AttestationWhereInput!) {\n imageVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), w = y("\n query GetAttestationChanges($where: AttestationWhereInput!) {\n changes: attestations(where: $where) {\n id\n refUID\n timeCreated\n revocationTime\n }\n }\n"), ve = async ({ seedUids: e, excludeRevoked: t = !0 }) => {
|
|
2303
|
+
let n = p.getQueryClient(), r = m.getEasClient(), i = t ? v({ refUID: { in: e } }) : { refUID: { in: e } }, { itemVersions: a } = await n.fetchQuery({
|
|
2304
2304
|
queryKey: [
|
|
2305
2305
|
"getVersionsForAllModels",
|
|
2306
|
-
[...
|
|
2307
|
-
|
|
2306
|
+
[...e].sort(),
|
|
2307
|
+
t
|
|
2308
2308
|
],
|
|
2309
|
-
queryFn: async () =>
|
|
2309
|
+
queryFn: async () => r.request(fe, { where: i })
|
|
2310
2310
|
});
|
|
2311
|
-
return
|
|
2312
|
-
},
|
|
2313
|
-
let
|
|
2311
|
+
return a;
|
|
2312
|
+
}, T = async ({ versionUids: e, excludeRevoked: t = !0 }) => {
|
|
2313
|
+
let n = p.getQueryClient(), r = m.getEasClient(), i = t ? v({ refUID: { in: e } }) : { refUID: { in: e } }, { itemProperties: a } = await n.fetchQuery({
|
|
2314
2314
|
queryKey: [
|
|
2315
2315
|
"getPropertiesForAllModels",
|
|
2316
|
-
[...
|
|
2317
|
-
|
|
2316
|
+
[...e].sort(),
|
|
2317
|
+
t
|
|
2318
2318
|
],
|
|
2319
|
-
queryFn: async () =>
|
|
2319
|
+
queryFn: async () => r.request(pe, { where: i })
|
|
2320
2320
|
});
|
|
2321
|
-
return
|
|
2322
|
-
},
|
|
2323
|
-
let
|
|
2324
|
-
if (!
|
|
2325
|
-
let { schemas:
|
|
2326
|
-
queryKey: ["getEasSchemaUidBySchemaName",
|
|
2327
|
-
queryFn: async () =>
|
|
2321
|
+
return a;
|
|
2322
|
+
}, ye = async (e) => ce(await T(e)), E = async ({ schemaName: e }) => {
|
|
2323
|
+
let t = p.getQueryClient(), n = m.getEasClient();
|
|
2324
|
+
if (!t || !n) return;
|
|
2325
|
+
let { schemas: r } = await t.fetchQuery({
|
|
2326
|
+
queryKey: ["getEasSchemaUidBySchemaName", e],
|
|
2327
|
+
queryFn: async () => n.request(b, { where: { schema: { endsWith: e } } })
|
|
2328
2328
|
});
|
|
2329
|
-
if (
|
|
2330
|
-
},
|
|
2329
|
+
if (r && r.length !== 0) return r[0].id;
|
|
2330
|
+
}, be = async ({ schemaName: e }) => {
|
|
2331
2331
|
try {
|
|
2332
2332
|
return await E({ schemaName: e });
|
|
2333
2333
|
} catch (t) {
|
|
2334
2334
|
process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for schema name ${e}:`, t);
|
|
2335
2335
|
return;
|
|
2336
2336
|
}
|
|
2337
|
-
},
|
|
2338
|
-
let
|
|
2339
|
-
attester: { in:
|
|
2337
|
+
}, xe = async ({ schemaUids: e, addresses: t, excludeRevoked: n = !0 }) => {
|
|
2338
|
+
let r = {
|
|
2339
|
+
attester: { in: t.map((e) => {
|
|
2340
2340
|
try {
|
|
2341
|
-
return
|
|
2341
|
+
return _(e);
|
|
2342
2342
|
} catch {
|
|
2343
2343
|
return e;
|
|
2344
2344
|
}
|
|
2345
2345
|
}) },
|
|
2346
|
-
schemaId: { in:
|
|
2346
|
+
schemaId: { in: e }
|
|
2347
2347
|
};
|
|
2348
|
-
|
|
2349
|
-
let
|
|
2348
|
+
n && (r = v(r));
|
|
2349
|
+
let i = p.getQueryClient(), a = m.getEasClient(), { itemSeeds: o } = await i.fetchQuery({
|
|
2350
2350
|
queryKey: [
|
|
2351
2351
|
"getSeedsForAllModels",
|
|
2352
|
-
|
|
2353
|
-
[...
|
|
2354
|
-
[...
|
|
2352
|
+
n,
|
|
2353
|
+
[...e].sort(),
|
|
2354
|
+
[...t].sort()
|
|
2355
2355
|
],
|
|
2356
|
-
queryFn: async () =>
|
|
2356
|
+
queryFn: async () => a.request(S, { where: r })
|
|
2357
2357
|
});
|
|
2358
|
-
return
|
|
2359
|
-
},
|
|
2360
|
-
let
|
|
2358
|
+
return o;
|
|
2359
|
+
}, D = async (e, t = 10, n, r) => {
|
|
2360
|
+
let i = n ?? 0, a = r?.uidPrefix, o = {
|
|
2361
2361
|
where: v({
|
|
2362
|
-
...
|
|
2363
|
-
schema: { is: { schemaNames: { some: { name: { equals:
|
|
2362
|
+
...a === void 0 ? {} : { id: { startsWith: a } },
|
|
2363
|
+
schema: { is: { schemaNames: { some: { name: { equals: e } } } } }
|
|
2364
2364
|
}),
|
|
2365
|
-
take:
|
|
2366
|
-
skip:
|
|
2367
|
-
},
|
|
2365
|
+
take: t,
|
|
2366
|
+
skip: i
|
|
2367
|
+
}, s = p.getQueryClient(), c = m.getEasClient(), { itemSeeds: l } = await s.fetchQuery({
|
|
2368
2368
|
queryKey: [
|
|
2369
2369
|
"getSeedsBySchemaName",
|
|
2370
|
+
e,
|
|
2370
2371
|
t,
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
s ?? null
|
|
2372
|
+
i,
|
|
2373
|
+
a ?? null
|
|
2374
2374
|
],
|
|
2375
|
-
queryFn: async () =>
|
|
2375
|
+
queryFn: async () => c.request(C, o)
|
|
2376
2376
|
});
|
|
2377
|
-
return
|
|
2378
|
-
},
|
|
2377
|
+
return l.map((t) => O(t, [e]));
|
|
2378
|
+
}, O = (e, t) => ({
|
|
2379
2379
|
...e,
|
|
2380
2380
|
schema: { schemaNames: t.map((e) => ({ name: e })) }
|
|
2381
|
-
}),
|
|
2382
|
-
let
|
|
2381
|
+
}), k = /* @__PURE__ */ new Map(), A = (e) => {
|
|
2382
|
+
let n = "";
|
|
2383
2383
|
try {
|
|
2384
|
-
|
|
2384
|
+
n = t();
|
|
2385
2385
|
} catch {}
|
|
2386
|
-
return `${
|
|
2387
|
-
},
|
|
2388
|
-
|
|
2389
|
-
},
|
|
2390
|
-
let
|
|
2391
|
-
for (let
|
|
2392
|
-
let
|
|
2393
|
-
|
|
2386
|
+
return `${n}\n${e.toLowerCase()}`;
|
|
2387
|
+
}, Se = () => {
|
|
2388
|
+
k.clear();
|
|
2389
|
+
}, j = async (e) => {
|
|
2390
|
+
let t = /* @__PURE__ */ new Map(), n = [];
|
|
2391
|
+
for (let r of new Set(e)) {
|
|
2392
|
+
let e = k.get(A(r));
|
|
2393
|
+
e ? t.set(r, e) : n.push(r);
|
|
2394
2394
|
}
|
|
2395
|
-
if (
|
|
2396
|
-
let
|
|
2397
|
-
queryKey: ["getSchemaNamesBySchemaUids", [...
|
|
2398
|
-
queryFn: async () =>
|
|
2399
|
-
}),
|
|
2400
|
-
for (let e of
|
|
2401
|
-
let
|
|
2402
|
-
r &&
|
|
2395
|
+
if (n.length === 0) return t;
|
|
2396
|
+
let r = p.getQueryClient(), i = m.getEasClient(), { schemas: a } = await r.fetchQuery({
|
|
2397
|
+
queryKey: ["getSchemaNamesBySchemaUids", [...n].sort()],
|
|
2398
|
+
queryFn: async () => i.request(b, { where: { id: { in: n } } })
|
|
2399
|
+
}), o = new Map(n.map((e) => [e.toLowerCase(), e]));
|
|
2400
|
+
for (let e of a ?? []) {
|
|
2401
|
+
let n = (e.schemaNames ?? []).map((e) => e.name), r = o.get(e.id.toLowerCase());
|
|
2402
|
+
r && n.length !== 0 && (k.set(A(r), n), t.set(r, n));
|
|
2403
2403
|
}
|
|
2404
|
-
return
|
|
2405
|
-
},
|
|
2406
|
-
if (
|
|
2407
|
-
let
|
|
2404
|
+
return t;
|
|
2405
|
+
}, Ce = async ({ uids: e, excludeRevoked: t = !0 }) => {
|
|
2406
|
+
if (e.length === 0) return [];
|
|
2407
|
+
let n = t ? v({ id: { in: e } }) : { id: { in: e } }, r = p.getQueryClient(), i = m.getEasClient(), { itemSeeds: a } = await r.fetchQuery({
|
|
2408
2408
|
queryKey: [
|
|
2409
2409
|
"getSeedsByUidsFromEas",
|
|
2410
|
-
[...
|
|
2411
|
-
|
|
2410
|
+
[...e].sort(),
|
|
2411
|
+
t
|
|
2412
2412
|
],
|
|
2413
|
-
queryFn: async () =>
|
|
2414
|
-
where:
|
|
2415
|
-
take:
|
|
2413
|
+
queryFn: async () => i.request(C, {
|
|
2414
|
+
where: n,
|
|
2415
|
+
take: e.length,
|
|
2416
2416
|
skip: 0
|
|
2417
2417
|
})
|
|
2418
|
-
}),
|
|
2419
|
-
return
|
|
2420
|
-
},
|
|
2421
|
-
let
|
|
2418
|
+
}), o = a ?? [], s = await j(o.map((e) => e.schemaId));
|
|
2419
|
+
return o.map((e) => O(e, s.get(e.schemaId) ?? []));
|
|
2420
|
+
}, M = 400, we = async ({ refUIDs: e, ids: t, since: n }) => {
|
|
2421
|
+
let r = { OR: [{ timeCreated: { gt: n } }, { revocationTime: { gt: n } }] }, i = [], a = (e, t) => {
|
|
2422
2422
|
let n = [...new Set(t)].sort();
|
|
2423
|
-
for (let t = 0; t < n.length; t +=
|
|
2423
|
+
for (let t = 0; t < n.length; t += M) i.push({ [e]: { in: n.slice(t, t + M) } });
|
|
2424
2424
|
};
|
|
2425
|
-
if (
|
|
2426
|
-
let
|
|
2425
|
+
if (a("refUID", e), a("id", t), i.length === 0) return [];
|
|
2426
|
+
let o = p.getQueryClient(), s = m.getEasClient(), c = await Promise.all(i.map((e) => o.fetchQuery({
|
|
2427
2427
|
queryKey: [
|
|
2428
2428
|
"getAttestationChangesSince",
|
|
2429
2429
|
e,
|
|
2430
|
-
|
|
2430
|
+
n
|
|
2431
2431
|
],
|
|
2432
|
-
queryFn: async () =>
|
|
2433
|
-
}))),
|
|
2434
|
-
for (let { changes: e } of
|
|
2435
|
-
return [...
|
|
2436
|
-
},
|
|
2432
|
+
queryFn: async () => s.request(w, { where: { AND: [e, r] } })
|
|
2433
|
+
}))), l = /* @__PURE__ */ new Map();
|
|
2434
|
+
for (let { changes: e } of c) for (let t of e ?? []) l.set(t.id, t);
|
|
2435
|
+
return [...l.values()];
|
|
2436
|
+
}, Te = async (e, t = 10) => (await D(e, t)).map((e) => e.id), Ee = "0x0000000000000000000000000000000000000000", De = "0x", Oe = "0x0000000000000000000000000000000000000000000000000000000000000000", ke = typeof process < "u" && process.env?.NEXT_PUBLIC_EAS_ENDPOINT || typeof process < "u" && process.env?.EAS_ENDPOINT || "https://optimism-sepolia.easscan.org/graphql";
|
|
2437
2437
|
//#endregion
|
|
2438
2438
|
//#region src/easUid.ts
|
|
2439
|
-
function
|
|
2439
|
+
function N(e) {
|
|
2440
2440
|
if (e == null || e === "" || e === "NULL") return !0;
|
|
2441
2441
|
let t = e.trim();
|
|
2442
2442
|
return t === "" || t.toLowerCase() === "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
2443
2443
|
}
|
|
2444
|
-
function
|
|
2445
|
-
if (
|
|
2444
|
+
function P(e) {
|
|
2445
|
+
if (N(e)) return !1;
|
|
2446
2446
|
let t = String(e).trim();
|
|
2447
2447
|
if (!/^0x/i.test(t)) return !1;
|
|
2448
2448
|
let n = t.slice(2);
|
|
2449
2449
|
return n.length === 64 && /^[0-9a-fA-F]{64}$/.test(n);
|
|
2450
2450
|
}
|
|
2451
|
-
function
|
|
2451
|
+
function F(e) {
|
|
2452
2452
|
if (e == null || e === "") return "";
|
|
2453
2453
|
let t = String(e).trim();
|
|
2454
2454
|
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();
|
|
2455
2455
|
}
|
|
2456
2456
|
//#endregion
|
|
2457
2457
|
//#region src/domainOwnershipHelpers.ts
|
|
2458
|
-
var
|
|
2459
|
-
function
|
|
2458
|
+
var Ae = "string domain,address claimer,string method,bytes32 challengeHash,uint64 verifiedAt,string registryCreationDate,string registryExpirationDate,bytes32 registryFingerprint,string scope", I = "seedprotocol.domainOwnership", je = "dns-txt-challenge", Me = "registrable", L = "_seedprotocol-challenge", Ne = 2592e5, Pe = 31536e6, Fe = 31536e3;
|
|
2459
|
+
function Ie(e) {
|
|
2460
2460
|
return new TextEncoder().encode(e);
|
|
2461
2461
|
}
|
|
2462
|
-
function
|
|
2462
|
+
function R(e) {
|
|
2463
2463
|
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
2464
2464
|
}
|
|
2465
|
-
function
|
|
2465
|
+
function z(e) {
|
|
2466
2466
|
let t = e.trim();
|
|
2467
2467
|
try {
|
|
2468
|
-
return
|
|
2468
|
+
return _(t).toLowerCase();
|
|
2469
2469
|
} catch {
|
|
2470
2470
|
return t.toLowerCase();
|
|
2471
2471
|
}
|
|
2472
2472
|
}
|
|
2473
|
-
function
|
|
2474
|
-
return `${
|
|
2473
|
+
function Le(e) {
|
|
2474
|
+
return `${L}.${R(e)}`;
|
|
2475
2475
|
}
|
|
2476
|
-
function
|
|
2477
|
-
let t =
|
|
2476
|
+
function Re(e) {
|
|
2477
|
+
let t = z(e.claimer);
|
|
2478
2478
|
return `token=${e.token},addr=${t},expiry=${e.expiry}`;
|
|
2479
2479
|
}
|
|
2480
|
-
function
|
|
2480
|
+
function ze(e) {
|
|
2481
2481
|
let t = e.replace(/^"+|"+$/g, "").trim(), n = /* @__PURE__ */ new Map();
|
|
2482
2482
|
for (let e of t.split(",")) {
|
|
2483
2483
|
let t = e.indexOf("=");
|
|
@@ -2488,59 +2488,59 @@ function Ue(e) {
|
|
|
2488
2488
|
let r = n.get("token"), i = n.get("addr") ?? n.get("claimer"), a = n.get("expiry");
|
|
2489
2489
|
return !r || !i || !a ? null : {
|
|
2490
2490
|
token: r,
|
|
2491
|
-
claimer:
|
|
2491
|
+
claimer: z(i),
|
|
2492
2492
|
expiry: a
|
|
2493
2493
|
};
|
|
2494
2494
|
}
|
|
2495
|
-
function
|
|
2496
|
-
let t =
|
|
2497
|
-
return "0x" +
|
|
2495
|
+
function Be(e) {
|
|
2496
|
+
let t = R(e.domain), n = z(e.claimer), r = (e.scope ?? "registrable").trim();
|
|
2497
|
+
return "0x" + h(Ie(`${t}|${n}|${e.token}|${r}`));
|
|
2498
2498
|
}
|
|
2499
|
-
function
|
|
2499
|
+
function B(e) {
|
|
2500
2500
|
let t = {
|
|
2501
|
-
domain:
|
|
2501
|
+
domain: R(e.domain),
|
|
2502
2502
|
creationDate: (e.creationDate ?? "").trim(),
|
|
2503
2503
|
registrarIanaId: (e.registrarIanaId ?? "").trim()
|
|
2504
2504
|
};
|
|
2505
|
-
return "0x" +
|
|
2505
|
+
return "0x" + h(Ie(JSON.stringify(t)));
|
|
2506
2506
|
}
|
|
2507
|
-
function
|
|
2508
|
-
return typeof e == "string" ?
|
|
2507
|
+
function Ve(e) {
|
|
2508
|
+
return typeof e == "string" ? F(e) : e && typeof e == "object" && "hex" in e ? F(String(e.hex)) : F(String(e ?? ""));
|
|
2509
2509
|
}
|
|
2510
|
-
function
|
|
2510
|
+
function V(e) {
|
|
2511
2511
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2512
2512
|
}
|
|
2513
|
-
function
|
|
2513
|
+
function He(e) {
|
|
2514
2514
|
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2515
2515
|
if (typeof e == "bigint") return Number(e);
|
|
2516
2516
|
if (typeof e == "string" && e.trim() !== "") {
|
|
2517
2517
|
let t = Number(e);
|
|
2518
2518
|
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2519
2519
|
}
|
|
2520
|
-
return e && typeof e == "object" && "value" in e ?
|
|
2520
|
+
return e && typeof e == "object" && "value" in e ? He(e.value) : 0;
|
|
2521
2521
|
}
|
|
2522
|
-
function
|
|
2522
|
+
function Ue(e) {
|
|
2523
2523
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2524
2524
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2525
2525
|
return {
|
|
2526
|
-
domain:
|
|
2527
|
-
claimer:
|
|
2528
|
-
method:
|
|
2529
|
-
challengeHash:
|
|
2530
|
-
verifiedAt:
|
|
2531
|
-
registryCreationDate:
|
|
2532
|
-
registryExpirationDate:
|
|
2533
|
-
registryFingerprint:
|
|
2534
|
-
scope:
|
|
2526
|
+
domain: R(V(n.get("domain")?.value)),
|
|
2527
|
+
claimer: z(V(n.get("claimer")?.value)),
|
|
2528
|
+
method: V(n.get("method")?.value),
|
|
2529
|
+
challengeHash: Ve(n.get("challengeHash")?.value),
|
|
2530
|
+
verifiedAt: He(n.get("verifiedAt")?.value),
|
|
2531
|
+
registryCreationDate: V(n.get("registryCreationDate")?.value),
|
|
2532
|
+
registryExpirationDate: V(n.get("registryExpirationDate")?.value),
|
|
2533
|
+
registryFingerprint: Ve(n.get("registryFingerprint")?.value),
|
|
2534
|
+
scope: V(n.get("scope")?.value)
|
|
2535
2535
|
};
|
|
2536
2536
|
}
|
|
2537
|
-
function
|
|
2537
|
+
function We(e) {
|
|
2538
2538
|
if (!e?.trim()) return null;
|
|
2539
2539
|
let t = Date.parse(e);
|
|
2540
2540
|
return Number.isFinite(t) ? Math.floor(t / 1e3) : null;
|
|
2541
2541
|
}
|
|
2542
|
-
function
|
|
2543
|
-
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.softStaleMs ?? 31536e6, i = e.expirationTime, a =
|
|
2542
|
+
function Ge(e) {
|
|
2543
|
+
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.softStaleMs ?? 31536e6, i = e.expirationTime, a = We(e.decoded.registryExpirationDate);
|
|
2544
2544
|
if (typeof i == "number" && i > 0 && t >= i || a != null && t >= a) return {
|
|
2545
2545
|
status: "expired",
|
|
2546
2546
|
warnings: n
|
|
@@ -2549,11 +2549,11 @@ function Ke(e) {
|
|
|
2549
2549
|
status: "unknown",
|
|
2550
2550
|
warnings: n
|
|
2551
2551
|
};
|
|
2552
|
-
if (e.registrySnapshot !== void 0) return
|
|
2552
|
+
if (e.registrySnapshot !== void 0) return F(B({
|
|
2553
2553
|
domain: e.decoded.domain,
|
|
2554
2554
|
creationDate: e.registrySnapshot.creationDate,
|
|
2555
2555
|
registrarIanaId: e.registrySnapshot.registrarIanaId
|
|
2556
|
-
})) ===
|
|
2556
|
+
})) === F(e.decoded.registryFingerprint) ? {
|
|
2557
2557
|
status: "valid",
|
|
2558
2558
|
warnings: n
|
|
2559
2559
|
} : (n.push("Registry creation date or registrar IANA id no longer matches attestation fingerprint"), {
|
|
@@ -2571,43 +2571,43 @@ function Ke(e) {
|
|
|
2571
2571
|
}
|
|
2572
2572
|
//#endregion
|
|
2573
2573
|
//#region src/domainOwnership.ts
|
|
2574
|
-
function
|
|
2574
|
+
function Ke(e) {
|
|
2575
2575
|
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
2576
2576
|
}
|
|
2577
|
-
async function qe(
|
|
2578
|
-
let { toolAddresses:
|
|
2579
|
-
if (!
|
|
2580
|
-
let
|
|
2577
|
+
async function qe(e) {
|
|
2578
|
+
let { toolAddresses: t, domains: n, claimers: r, schemaUid: i, excludeRevoked: a = !0 } = e;
|
|
2579
|
+
if (!t.length) return [];
|
|
2580
|
+
let o = t.map((e) => {
|
|
2581
2581
|
try {
|
|
2582
|
-
return
|
|
2582
|
+
return _(e);
|
|
2583
2583
|
} catch {
|
|
2584
2584
|
return e;
|
|
2585
2585
|
}
|
|
2586
|
-
}),
|
|
2587
|
-
|
|
2586
|
+
}), s = { attester: { in: o } };
|
|
2587
|
+
i ? s.schemaId = { equals: i } : s.schema = { is: { schemaNames: { some: { name: { equals: I } } } } }, r?.length && (s.recipient = { in: r.map((e) => {
|
|
2588
2588
|
try {
|
|
2589
|
-
return
|
|
2589
|
+
return _(e);
|
|
2590
2590
|
} catch {
|
|
2591
2591
|
return e;
|
|
2592
2592
|
}
|
|
2593
|
-
}) }),
|
|
2594
|
-
let
|
|
2593
|
+
}) }), a && (s = v(s));
|
|
2594
|
+
let c = p.getQueryClient(), l = m.getEasClient(), { itemSeeds: u } = await c.fetchQuery({
|
|
2595
2595
|
queryKey: [
|
|
2596
2596
|
"getDomainOwnershipFromEas",
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
[...
|
|
2600
|
-
[...(
|
|
2601
|
-
[...
|
|
2597
|
+
a,
|
|
2598
|
+
i ?? "seedprotocol.domainOwnership",
|
|
2599
|
+
[...o].sort(),
|
|
2600
|
+
[...(n ?? []).map(Ke)].sort(),
|
|
2601
|
+
[...r ?? []].map((e) => e.toLowerCase()).sort()
|
|
2602
2602
|
],
|
|
2603
|
-
queryFn: async () =>
|
|
2603
|
+
queryFn: async () => l.request(S, { where: s })
|
|
2604
2604
|
});
|
|
2605
|
-
if (!
|
|
2606
|
-
let
|
|
2607
|
-
return
|
|
2605
|
+
if (!n?.length) return u;
|
|
2606
|
+
let d = new Set(n.map(Ke));
|
|
2607
|
+
return u.filter((e) => {
|
|
2608
2608
|
try {
|
|
2609
|
-
let t =
|
|
2610
|
-
return
|
|
2609
|
+
let t = Ue(e.decodedDataJson ?? "[]");
|
|
2610
|
+
return d.has(t.domain);
|
|
2611
2611
|
} catch {
|
|
2612
2612
|
return !1;
|
|
2613
2613
|
}
|
|
@@ -2615,44 +2615,44 @@ async function qe(t) {
|
|
|
2615
2615
|
}
|
|
2616
2616
|
//#endregion
|
|
2617
2617
|
//#region src/publishAuthorizationHelpers.ts
|
|
2618
|
-
var Je = "address identity,address sessionKey,address app,string scopes,uint64 grantedAt,uint64 expiresAt,bytes32 permissionsHash",
|
|
2619
|
-
function
|
|
2618
|
+
var Je = "address identity,address sessionKey,address app,string scopes,uint64 grantedAt,uint64 expiresAt,bytes32 permissionsHash", Ye = "seedprotocol.publishAuthorization", Xe = "publish,revoke", Ze = 31536e3;
|
|
2619
|
+
function H(e) {
|
|
2620
2620
|
let t = e.trim();
|
|
2621
2621
|
try {
|
|
2622
|
-
return
|
|
2622
|
+
return _(t).toLowerCase();
|
|
2623
2623
|
} catch {
|
|
2624
2624
|
return t.toLowerCase();
|
|
2625
2625
|
}
|
|
2626
2626
|
}
|
|
2627
|
-
function
|
|
2628
|
-
return typeof e == "string" ?
|
|
2627
|
+
function Qe(e) {
|
|
2628
|
+
return typeof e == "string" ? F(e) : e && typeof e == "object" && "hex" in e ? F(String(e.hex)) : F(String(e ?? ""));
|
|
2629
2629
|
}
|
|
2630
|
-
function
|
|
2630
|
+
function U(e) {
|
|
2631
2631
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2632
2632
|
}
|
|
2633
|
-
function
|
|
2633
|
+
function W(e) {
|
|
2634
2634
|
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2635
2635
|
if (typeof e == "bigint") return Number(e);
|
|
2636
2636
|
if (typeof e == "string" && e.trim() !== "") {
|
|
2637
2637
|
let t = Number(e);
|
|
2638
2638
|
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2639
2639
|
}
|
|
2640
|
-
return e && typeof e == "object" && "value" in e ?
|
|
2640
|
+
return e && typeof e == "object" && "value" in e ? W(e.value) : 0;
|
|
2641
2641
|
}
|
|
2642
|
-
function
|
|
2642
|
+
function $e(e) {
|
|
2643
2643
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2644
2644
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2645
2645
|
return {
|
|
2646
|
-
identity:
|
|
2647
|
-
sessionKey:
|
|
2648
|
-
app:
|
|
2649
|
-
scopes:
|
|
2650
|
-
grantedAt:
|
|
2651
|
-
expiresAt:
|
|
2652
|
-
permissionsHash:
|
|
2646
|
+
identity: H(U(n.get("identity")?.value)),
|
|
2647
|
+
sessionKey: H(U(n.get("sessionKey")?.value)),
|
|
2648
|
+
app: H(U(n.get("app")?.value)),
|
|
2649
|
+
scopes: U(n.get("scopes")?.value),
|
|
2650
|
+
grantedAt: W(n.get("grantedAt")?.value),
|
|
2651
|
+
expiresAt: W(n.get("expiresAt")?.value),
|
|
2652
|
+
permissionsHash: Qe(n.get("permissionsHash")?.value)
|
|
2653
2653
|
};
|
|
2654
2654
|
}
|
|
2655
|
-
function
|
|
2655
|
+
function et(e) {
|
|
2656
2656
|
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.expectedScopes ?? "publish,revoke", i = e.expirationTime, a = e.decoded.expiresAt;
|
|
2657
2657
|
return typeof i == "number" && i > 0 && t >= i || a > 0 && t >= a ? {
|
|
2658
2658
|
status: "expired",
|
|
@@ -2668,43 +2668,43 @@ function $e(e) {
|
|
|
2668
2668
|
warnings: n
|
|
2669
2669
|
});
|
|
2670
2670
|
}
|
|
2671
|
-
function
|
|
2672
|
-
return "0x" +
|
|
2671
|
+
function tt(e) {
|
|
2672
|
+
return "0x" + h(new TextEncoder().encode(e));
|
|
2673
2673
|
}
|
|
2674
2674
|
//#endregion
|
|
2675
2675
|
//#region src/publishAuthorization.ts
|
|
2676
|
-
async function
|
|
2677
|
-
let { identities:
|
|
2678
|
-
|
|
2676
|
+
async function nt(e = {}) {
|
|
2677
|
+
let { identities: t, sessionKeys: n, apps: r, schemaUid: i, excludeRevoked: a = !0 } = e, o = {};
|
|
2678
|
+
i ? o.schemaId = { equals: i } : o.schema = { is: { schemaNames: { some: { name: { equals: Ye } } } } }, t?.length && (o.attester = { in: t.map((e) => {
|
|
2679
2679
|
try {
|
|
2680
|
-
return
|
|
2680
|
+
return _(e);
|
|
2681
2681
|
} catch {
|
|
2682
2682
|
return e;
|
|
2683
2683
|
}
|
|
2684
|
-
}) }),
|
|
2684
|
+
}) }), n?.length && (o.recipient = { in: n.map((e) => {
|
|
2685
2685
|
try {
|
|
2686
|
-
return
|
|
2686
|
+
return _(e);
|
|
2687
2687
|
} catch {
|
|
2688
2688
|
return e;
|
|
2689
2689
|
}
|
|
2690
|
-
}) }),
|
|
2691
|
-
let
|
|
2690
|
+
}) }), a && (o = v(o));
|
|
2691
|
+
let s = p.getQueryClient(), c = m.getEasClient(), { itemSeeds: l } = await s.fetchQuery({
|
|
2692
2692
|
queryKey: [
|
|
2693
2693
|
"getPublishAuthorizationFromEas",
|
|
2694
|
-
|
|
2695
|
-
|
|
2694
|
+
a,
|
|
2695
|
+
i ?? "seedprotocol.publishAuthorization",
|
|
2696
|
+
[...t ?? []].map((e) => e.toLowerCase()).sort(),
|
|
2696
2697
|
[...n ?? []].map((e) => e.toLowerCase()).sort(),
|
|
2697
|
-
[...r ?? []].map((e) => e.toLowerCase()).sort()
|
|
2698
|
-
[...i ?? []].map((e) => e.toLowerCase()).sort()
|
|
2698
|
+
[...r ?? []].map((e) => e.toLowerCase()).sort()
|
|
2699
2699
|
],
|
|
2700
|
-
queryFn: async () =>
|
|
2700
|
+
queryFn: async () => c.request(S, { where: o })
|
|
2701
2701
|
});
|
|
2702
|
-
if (!
|
|
2703
|
-
let
|
|
2704
|
-
return
|
|
2702
|
+
if (!r?.length) return l;
|
|
2703
|
+
let u = new Set(r.map((e) => e.toLowerCase()));
|
|
2704
|
+
return l.filter((e) => {
|
|
2705
2705
|
try {
|
|
2706
|
-
let t =
|
|
2707
|
-
return
|
|
2706
|
+
let t = $e(e.decodedDataJson ?? "[]");
|
|
2707
|
+
return u.has(t.app.toLowerCase());
|
|
2708
2708
|
} catch {
|
|
2709
2709
|
return !1;
|
|
2710
2710
|
}
|
|
@@ -2712,97 +2712,102 @@ async function tt(t = {}) {
|
|
|
2712
2712
|
}
|
|
2713
2713
|
//#endregion
|
|
2714
2714
|
//#region src/publishedByHelpers.ts
|
|
2715
|
-
var
|
|
2716
|
-
function
|
|
2715
|
+
var rt = "bytes32 seedUid,bytes32 versionUid,bytes32[] attestationUids,bytes32 batchHash,string toolName,string toolVersion", it = "seedprotocol.publishedBy";
|
|
2716
|
+
function at(e) {
|
|
2717
2717
|
let t = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, n = new Uint8Array(t.length / 2);
|
|
2718
2718
|
for (let e = 0; e < n.length; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
|
|
2719
2719
|
return n;
|
|
2720
2720
|
}
|
|
2721
|
-
function
|
|
2722
|
-
let t = [...e].map((e) =>
|
|
2723
|
-
if (t.length === 0) return "0x" +
|
|
2721
|
+
function ot(e) {
|
|
2722
|
+
let t = [...e].map((e) => F(e)).filter((e) => e !== "" && P(e)).sort();
|
|
2723
|
+
if (t.length === 0) return "0x" + h(/* @__PURE__ */ new Uint8Array());
|
|
2724
2724
|
let n = new Uint8Array(t.length * 32);
|
|
2725
|
-
for (let e = 0; e < t.length; e++) n.set(
|
|
2726
|
-
return "0x" +
|
|
2725
|
+
for (let e = 0; e < t.length; e++) n.set(at(t[e]), e * 32);
|
|
2726
|
+
return "0x" + h(n);
|
|
2727
2727
|
}
|
|
2728
|
-
function
|
|
2729
|
-
return
|
|
2728
|
+
function st(e) {
|
|
2729
|
+
return F(ot(e.attestationUids)) === F(e.batchHash);
|
|
2730
2730
|
}
|
|
2731
|
-
function
|
|
2732
|
-
return typeof e == "string" ?
|
|
2731
|
+
function G(e) {
|
|
2732
|
+
return typeof e == "string" ? F(e) : e && typeof e == "object" && "hex" in e ? F(String(e.hex)) : F(String(e ?? ""));
|
|
2733
2733
|
}
|
|
2734
|
-
function
|
|
2734
|
+
function ct(e) {
|
|
2735
2735
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2736
2736
|
}
|
|
2737
|
-
function
|
|
2737
|
+
function lt(e) {
|
|
2738
2738
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2739
2739
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2740
2740
|
let r = n.get("attestationUids")?.value, i = [];
|
|
2741
|
-
return Array.isArray(r) ? i = r.map((e) =>
|
|
2742
|
-
seedUid:
|
|
2743
|
-
versionUid:
|
|
2741
|
+
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))), {
|
|
2742
|
+
seedUid: G(n.get("seedUid")?.value),
|
|
2743
|
+
versionUid: G(n.get("versionUid")?.value),
|
|
2744
2744
|
attestationUids: i,
|
|
2745
|
-
batchHash:
|
|
2746
|
-
toolName:
|
|
2747
|
-
toolVersion:
|
|
2745
|
+
batchHash: G(n.get("batchHash")?.value),
|
|
2746
|
+
toolName: ct(n.get("toolName")?.value),
|
|
2747
|
+
toolVersion: ct(n.get("toolVersion")?.value)
|
|
2748
2748
|
};
|
|
2749
2749
|
}
|
|
2750
2750
|
//#endregion
|
|
2751
2751
|
//#region src/publishedBy.ts
|
|
2752
|
-
async function
|
|
2753
|
-
let { toolAddresses:
|
|
2754
|
-
if (!
|
|
2755
|
-
let
|
|
2752
|
+
async function ut(e) {
|
|
2753
|
+
let { toolAddresses: t, refUIDs: n, schemaUid: r, excludeRevoked: i = !0 } = e;
|
|
2754
|
+
if (!t.length) return [];
|
|
2755
|
+
let a = t.map((e) => {
|
|
2756
2756
|
try {
|
|
2757
|
-
return
|
|
2757
|
+
return _(e);
|
|
2758
2758
|
} catch {
|
|
2759
2759
|
return e;
|
|
2760
2760
|
}
|
|
2761
|
-
}),
|
|
2762
|
-
|
|
2763
|
-
let
|
|
2761
|
+
}), o = { attester: { in: a } };
|
|
2762
|
+
r ? o.schemaId = { equals: r } : o.schema = { is: { schemaNames: { some: { name: { equals: it } } } } }, n?.length && (o.refUID = { in: n }), i && (o = v(o));
|
|
2763
|
+
let s = p.getQueryClient(), c = m.getEasClient(), { itemSeeds: l } = await s.fetchQuery({
|
|
2764
2764
|
queryKey: [
|
|
2765
2765
|
"getPublishedByFromEas",
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
[...
|
|
2769
|
-
[...
|
|
2766
|
+
i,
|
|
2767
|
+
r ?? "seedprotocol.publishedBy",
|
|
2768
|
+
[...a].sort(),
|
|
2769
|
+
[...n ?? []].sort()
|
|
2770
2770
|
],
|
|
2771
|
-
queryFn: async () =>
|
|
2771
|
+
queryFn: async () => c.request(S, { where: o })
|
|
2772
2772
|
});
|
|
2773
|
-
return
|
|
2773
|
+
return l;
|
|
2774
|
+
}
|
|
2775
|
+
//#endregion
|
|
2776
|
+
//#region src/default/index.ts
|
|
2777
|
+
function dt() {
|
|
2778
|
+
m.isConfigured() || m.configure(new u()), p.isConfigured() || p.configure(new f());
|
|
2774
2779
|
}
|
|
2775
2780
|
//#endregion
|
|
2776
2781
|
//#region src/stores/schemaUidCache.ts
|
|
2777
|
-
var
|
|
2778
|
-
let
|
|
2782
|
+
var K = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), ft = 3e5, J = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map(), X = /* @__PURE__ */ new Map(), Z = 0, pt = (e) => {
|
|
2783
|
+
let n = "";
|
|
2779
2784
|
try {
|
|
2780
|
-
|
|
2785
|
+
n = t();
|
|
2781
2786
|
} catch {}
|
|
2782
|
-
return `${
|
|
2787
|
+
return `${n}\n${e}`;
|
|
2783
2788
|
}, Q = async (e, t) => {
|
|
2784
|
-
let n =
|
|
2789
|
+
let n = pt(e), r = Y.get(n);
|
|
2785
2790
|
if (r !== void 0) {
|
|
2786
2791
|
if (Date.now() < r) return;
|
|
2787
2792
|
Y.delete(n);
|
|
2788
2793
|
}
|
|
2789
2794
|
let i = X.get(n);
|
|
2790
2795
|
if (i) return i;
|
|
2791
|
-
let a = Z, o = t().then((e) => (!e && a === Z && Y.set(n, Date.now() +
|
|
2796
|
+
let a = Z, o = t().then((e) => (!e && a === Z && Y.set(n, Date.now() + ft), e)).finally(() => {
|
|
2792
2797
|
X.get(n) === o && X.delete(n);
|
|
2793
2798
|
});
|
|
2794
2799
|
return X.set(n, o), o;
|
|
2795
2800
|
}, $ = () => {
|
|
2796
2801
|
Z++, Y.clear(), X.clear();
|
|
2797
|
-
},
|
|
2798
|
-
|
|
2799
|
-
},
|
|
2800
|
-
|
|
2801
|
-
},
|
|
2802
|
-
|
|
2803
|
-
},
|
|
2804
|
-
let t =
|
|
2805
|
-
if (!
|
|
2802
|
+
}, mt = () => {
|
|
2803
|
+
K.clear(), q.clear(), J.clear(), $();
|
|
2804
|
+
}, ht = ({ text: e, schemaUid: t }) => {
|
|
2805
|
+
K.set(g(e), t), $();
|
|
2806
|
+
}, gt = ({ modelName: e, schemaUid: t }) => {
|
|
2807
|
+
q.set(e.toLowerCase(), t), $();
|
|
2808
|
+
}, _t = (e) => q.get(e.toLowerCase()), vt = async ({ schemaText: e }) => {
|
|
2809
|
+
let t = g(e);
|
|
2810
|
+
if (!K.has(t)) {
|
|
2806
2811
|
let e;
|
|
2807
2812
|
try {
|
|
2808
2813
|
e = await Q(`schemaName:${t}`, () => E({ schemaName: t }));
|
|
@@ -2810,24 +2815,24 @@ var G = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), q = 3e5, J = /
|
|
|
2810
2815
|
process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for schema name ${t}:`, e);
|
|
2811
2816
|
return;
|
|
2812
2817
|
}
|
|
2813
|
-
return e &&
|
|
2818
|
+
return e && K.set(t, e), e;
|
|
2814
2819
|
}
|
|
2815
|
-
return
|
|
2816
|
-
},
|
|
2817
|
-
let
|
|
2818
|
-
if (
|
|
2819
|
-
let
|
|
2820
|
-
if (!
|
|
2821
|
-
let
|
|
2822
|
-
let
|
|
2823
|
-
queryKey: ["getSchemaByDefinition",
|
|
2824
|
-
queryFn: async () =>
|
|
2825
|
-
}), n =
|
|
2820
|
+
return K.get(t);
|
|
2821
|
+
}, yt = async (e) => {
|
|
2822
|
+
let t = pt(e), n = J.get(t);
|
|
2823
|
+
if (n) return n;
|
|
2824
|
+
let r = p.getQueryClient(), i = m.getEasClient();
|
|
2825
|
+
if (!r || !i) return;
|
|
2826
|
+
let a = await Q(`definition:${e}`, async () => {
|
|
2827
|
+
let t = await r.fetchQuery({
|
|
2828
|
+
queryKey: ["getSchemaByDefinition", e],
|
|
2829
|
+
queryFn: async () => i.request(x, { where: { schema: { equals: e } } })
|
|
2830
|
+
}), n = t?.schemas ?? t?.data?.schemas;
|
|
2826
2831
|
return Array.isArray(n) && n.length > 0 ? n[0].id : void 0;
|
|
2827
2832
|
});
|
|
2828
|
-
return
|
|
2833
|
+
return a && J.set(t, a), a;
|
|
2829
2834
|
};
|
|
2830
2835
|
//#endregion
|
|
2831
|
-
export {
|
|
2836
|
+
export { m as BaseEasClient, m as EasClient, p as BaseQueryClient, r as DEFAULT_EAS_CHAIN_ID, Ne as DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS, Fe as DOMAIN_OWNERSHIP_DEFAULT_EXPIRATION_SECS, je as DOMAIN_OWNERSHIP_METHOD, Ae as DOMAIN_OWNERSHIP_SCHEMA_DEF, I as DOMAIN_OWNERSHIP_SCHEMA_NAME, Me as DOMAIN_OWNERSHIP_SCOPE_REGISTRABLE, Pe as DOMAIN_OWNERSHIP_SOFT_STALE_MS, L as DOMAIN_OWNERSHIP_TXT_LABEL, u as DefaultEasClient, f as DefaultQueryClient, i as EAS_CHAIN_DEPLOYMENTS, ke as EAS_ENDPOINT, me as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, w as GET_ATTESTATION_CHANGES, he as GET_FILES_METADATA, ge as GET_IMAGE_SEEDS, _e as GET_IMAGE_VERSIONS, pe as GET_PROPERTIES, b as GET_SCHEMAS, x as GET_SCHEMA_BY_NAME, S as GET_SEEDS, C as GET_SEEDS_LEAN, ue as GET_SEED_IDS, de as GET_STORAGE_TRANSACTION_ID, fe as GET_VERSIONS, ee as OP_STACK_EAS_CONTRACT_ADDRESS, l as OP_STACK_SCHEMA_REGISTRY_ADDRESS, rt as PUBLISHED_BY_SCHEMA_DEF, it as PUBLISHED_BY_SCHEMA_NAME, Ze as PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS, Je as PUBLISH_AUTHORIZATION_SCHEMA_DEF, Ye as PUBLISH_AUTHORIZATION_SCHEMA_NAME, Xe as PUBLISH_AUTHORIZATION_SCOPES, ft as SCHEMA_LOOKUP_MISS_TTL_MS, Ee as ZERO_ADDRESS, De as ZERO_BYTES, Oe as ZERO_BYTES32, Ge as assessDomainOwnership, et as assessPublishAuthorization, Re as buildDomainOwnershipTxtValue, Q as cachedSchemaLookup, _ as checksumAddress, $ as clearSchemaLookupMisses, te as configureEasReadChain, Ue as decodeDomainOwnershipData, $e as decodePublishAuthorizationData, lt as decodePublishedByData, Le as domainOwnershipTxtName, dt as ensureEasPlatform, s as expectEasReadChain, E as fetchEasSchemaUidBySchemaName, we as getAttestationChangesSince, ye as getCanonicalItemPropertiesFromEas, qe as getDomainOwnershipFromEas, o as getEasAttestationExplorerUrl, a as getEasChainDeployment, t as getEasEndpoint, d as getEasReadChainId, be as getEasSchemaUidBySchemaName, yt as getEasSchemaUidForExactDefinition, vt as getEasSchemaUidForSchemaDefinition, T as getItemPropertiesFromEas, ve as getItemVersionsFromEas, nt as getPublishAuthorizationFromEas, ut as getPublishedByFromEas, j as getSchemaNamesBySchemaUids, _t as getSchemaUidForModelFromCache, Te as getSeedUidsBySchemaName, D as getSeedsBySchemaName, Ce as getSeedsByUidsFromEas, xe as getSeedsFromSchemaUids, Be as hashDomainOwnershipChallenge, B as hashDomainRegistryFingerprint, tt as hashPublishAuthorizationMaterial, ot as hashPublishedByBatch, ne as isEasReadChainConfigured, n as isEasReadChainSettled, N as isPlaceholderUid, P as isValidEasAttestationUid, F as normalizeBytes32Hex, ze as parseDomainOwnershipTxtValue, ce as pickLatestPropertyAttestationsByRefAndSchema, c as resetEasReadChain, Se as resetSchemaNamesCache, mt as resetSchemaUidCaches, e as resolveEasChainDeployment, gt as setSchemaUidForModel, ht as setSchemaUidForSchemaDefinition, g as toSnakeCase, st as verifyPublishedByBatch, re as whenEasReadChainSettled, v as withExcludeRevokedFilter };
|
|
2832
2837
|
|
|
2833
2838
|
//# sourceMappingURL=index.js.map
|