@seedprotocol/eas 0.7.3 → 0.7.4-next.784.g879c6a3
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.map +1 -1
- package/dist/QueryClient/BaseQueryClient.d.ts.map +1 -1
- package/dist/{QueryClient-Ch6F96Za.js → QueryClient-CeTbKOnt.js} +89 -71
- package/dist/QueryClient-CeTbKOnt.js.map +1 -0
- package/dist/api.d.ts +5 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/domainOwnershipHelpers.d.ts +2 -0
- package/dist/domainOwnershipHelpers.d.ts.map +1 -1
- package/dist/easRefAttester.d.ts +26 -0
- package/dist/easRefAttester.d.ts.map +1 -0
- package/dist/graphql/gql/gql.d.ts +5 -0
- package/dist/graphql/gql/gql.d.ts.map +1 -1
- package/dist/graphql/gql/graphql.d.ts +20 -0
- package/dist/graphql/gql/graphql.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +370 -195
- package/dist/index.js.map +1 -1
- package/dist/moduleOwner.d.ts +10 -0
- package/dist/moduleOwner.d.ts.map +1 -0
- package/dist/node.js +1 -1
- package/dist/queries.d.ts +7 -0
- package/dist/queries.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/QueryClient-Ch6F96Za.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { keccak_256 as
|
|
3
|
-
import { bytesToHex as
|
|
1
|
+
import { 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 d, o as te, p as ne, r as re, s as ie, t as ae, u as oe, v as f, x as se, y as p } from "./QueryClient-CeTbKOnt.js";
|
|
2
|
+
import { keccak_256 as ce } from "@noble/hashes/sha3";
|
|
3
|
+
import { bytesToHex as le, utf8ToBytes as ue } from "@noble/hashes/utils";
|
|
4
4
|
//#region src/keccak.ts
|
|
5
|
-
function
|
|
6
|
-
let t = typeof e == "string" ?
|
|
7
|
-
return
|
|
5
|
+
function m(e) {
|
|
6
|
+
let t = typeof e == "string" ? ue(e) : e;
|
|
7
|
+
return le(ce(t));
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/utils.ts
|
|
11
|
-
var
|
|
12
|
-
function
|
|
11
|
+
var h = (e) => e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
|
|
12
|
+
function g(e) {
|
|
13
13
|
let t = e.toLowerCase().replace(/^0x/, "");
|
|
14
14
|
if (t.length !== 40 || !/^[0-9a-f]+$/.test(t)) return e;
|
|
15
|
-
let n =
|
|
15
|
+
let n = m(t), r = "0x";
|
|
16
16
|
for (let e = 0; e < 40; e++) r += parseInt(n[e], 16) >= 8 ? t[e].toUpperCase() : t[e];
|
|
17
17
|
return r;
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/easPropertyCanonical.ts
|
|
21
|
-
var
|
|
21
|
+
var de = (e) => {
|
|
22
22
|
let t = /* @__PURE__ */ new Map();
|
|
23
23
|
for (let n of e) {
|
|
24
24
|
let e = n.schemaId;
|
|
@@ -28,16 +28,16 @@ var se = (e) => {
|
|
|
28
28
|
}
|
|
29
29
|
return t;
|
|
30
30
|
};
|
|
31
|
-
function
|
|
32
|
-
let n =
|
|
31
|
+
function fe(e, t) {
|
|
32
|
+
let n = de(e.filter((e) => !e.revoked));
|
|
33
33
|
if (t?.ifAllRevoked !== "newestRevoked") return [...n.values()];
|
|
34
|
-
let r =
|
|
34
|
+
let r = de(e.filter((e) => e.revoked));
|
|
35
35
|
for (let [e, t] of r) n.has(e) || n.set(e, t);
|
|
36
36
|
return [...n.values()];
|
|
37
37
|
}
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region src/easRevokedFilter.ts
|
|
40
|
-
function
|
|
40
|
+
function _(e) {
|
|
41
41
|
let t = { revoked: { equals: !1 } }, n = Array.isArray(e.AND) ? e.AND : [];
|
|
42
42
|
return {
|
|
43
43
|
...e,
|
|
@@ -46,7 +46,7 @@ function v(e) {
|
|
|
46
46
|
}
|
|
47
47
|
//#endregion
|
|
48
48
|
//#region src/graphql/gql/gql.ts
|
|
49
|
-
var
|
|
49
|
+
var pe = {
|
|
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: [{
|
|
@@ -892,6 +892,163 @@ var le = {
|
|
|
892
892
|
}
|
|
893
893
|
}]
|
|
894
894
|
},
|
|
895
|
+
"\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": {
|
|
896
|
+
kind: "Document",
|
|
897
|
+
definitions: [{
|
|
898
|
+
kind: "OperationDefinition",
|
|
899
|
+
operation: "query",
|
|
900
|
+
name: {
|
|
901
|
+
kind: "Name",
|
|
902
|
+
value: "GetDomainOwnerships"
|
|
903
|
+
},
|
|
904
|
+
variableDefinitions: [{
|
|
905
|
+
kind: "VariableDefinition",
|
|
906
|
+
variable: {
|
|
907
|
+
kind: "Variable",
|
|
908
|
+
name: {
|
|
909
|
+
kind: "Name",
|
|
910
|
+
value: "where"
|
|
911
|
+
}
|
|
912
|
+
},
|
|
913
|
+
type: {
|
|
914
|
+
kind: "NonNullType",
|
|
915
|
+
type: {
|
|
916
|
+
kind: "NamedType",
|
|
917
|
+
name: {
|
|
918
|
+
kind: "Name",
|
|
919
|
+
value: "AttestationWhereInput"
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
}],
|
|
924
|
+
selectionSet: {
|
|
925
|
+
kind: "SelectionSet",
|
|
926
|
+
selections: [{
|
|
927
|
+
kind: "Field",
|
|
928
|
+
alias: {
|
|
929
|
+
kind: "Name",
|
|
930
|
+
value: "domainOwnerships"
|
|
931
|
+
},
|
|
932
|
+
name: {
|
|
933
|
+
kind: "Name",
|
|
934
|
+
value: "attestations"
|
|
935
|
+
},
|
|
936
|
+
arguments: [{
|
|
937
|
+
kind: "Argument",
|
|
938
|
+
name: {
|
|
939
|
+
kind: "Name",
|
|
940
|
+
value: "where"
|
|
941
|
+
},
|
|
942
|
+
value: {
|
|
943
|
+
kind: "Variable",
|
|
944
|
+
name: {
|
|
945
|
+
kind: "Name",
|
|
946
|
+
value: "where"
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}, {
|
|
950
|
+
kind: "Argument",
|
|
951
|
+
name: {
|
|
952
|
+
kind: "Name",
|
|
953
|
+
value: "orderBy"
|
|
954
|
+
},
|
|
955
|
+
value: {
|
|
956
|
+
kind: "ListValue",
|
|
957
|
+
values: [{
|
|
958
|
+
kind: "ObjectValue",
|
|
959
|
+
fields: [{
|
|
960
|
+
kind: "ObjectField",
|
|
961
|
+
name: {
|
|
962
|
+
kind: "Name",
|
|
963
|
+
value: "timeCreated"
|
|
964
|
+
},
|
|
965
|
+
value: {
|
|
966
|
+
kind: "EnumValue",
|
|
967
|
+
value: "desc"
|
|
968
|
+
}
|
|
969
|
+
}]
|
|
970
|
+
}]
|
|
971
|
+
}
|
|
972
|
+
}],
|
|
973
|
+
selectionSet: {
|
|
974
|
+
kind: "SelectionSet",
|
|
975
|
+
selections: [
|
|
976
|
+
{
|
|
977
|
+
kind: "Field",
|
|
978
|
+
name: {
|
|
979
|
+
kind: "Name",
|
|
980
|
+
value: "id"
|
|
981
|
+
}
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
kind: "Field",
|
|
985
|
+
name: {
|
|
986
|
+
kind: "Name",
|
|
987
|
+
value: "decodedDataJson"
|
|
988
|
+
}
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
kind: "Field",
|
|
992
|
+
name: {
|
|
993
|
+
kind: "Name",
|
|
994
|
+
value: "attester"
|
|
995
|
+
}
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
kind: "Field",
|
|
999
|
+
name: {
|
|
1000
|
+
kind: "Name",
|
|
1001
|
+
value: "recipient"
|
|
1002
|
+
}
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
kind: "Field",
|
|
1006
|
+
name: {
|
|
1007
|
+
kind: "Name",
|
|
1008
|
+
value: "refUID"
|
|
1009
|
+
}
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
kind: "Field",
|
|
1013
|
+
name: {
|
|
1014
|
+
kind: "Name",
|
|
1015
|
+
value: "revoked"
|
|
1016
|
+
}
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
kind: "Field",
|
|
1020
|
+
name: {
|
|
1021
|
+
kind: "Name",
|
|
1022
|
+
value: "revocationTime"
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
kind: "Field",
|
|
1027
|
+
name: {
|
|
1028
|
+
kind: "Name",
|
|
1029
|
+
value: "expirationTime"
|
|
1030
|
+
}
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
kind: "Field",
|
|
1034
|
+
name: {
|
|
1035
|
+
kind: "Name",
|
|
1036
|
+
value: "schemaId"
|
|
1037
|
+
}
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
kind: "Field",
|
|
1041
|
+
name: {
|
|
1042
|
+
kind: "Name",
|
|
1043
|
+
value: "timeCreated"
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
]
|
|
1047
|
+
}
|
|
1048
|
+
}]
|
|
1049
|
+
}
|
|
1050
|
+
}]
|
|
1051
|
+
},
|
|
895
1052
|
"\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n": {
|
|
896
1053
|
kind: "Document",
|
|
897
1054
|
definitions: [{
|
|
@@ -2294,77 +2451,77 @@ var le = {
|
|
|
2294
2451
|
}]
|
|
2295
2452
|
}
|
|
2296
2453
|
};
|
|
2297
|
-
function
|
|
2298
|
-
return
|
|
2454
|
+
function v(e) {
|
|
2455
|
+
return pe[e] ?? {};
|
|
2299
2456
|
}
|
|
2300
2457
|
//#endregion
|
|
2301
2458
|
//#region src/queries.ts
|
|
2302
|
-
var
|
|
2303
|
-
let n =
|
|
2459
|
+
var y = v("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), me = v("\n query GetSchemaByName($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), b = v("\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"), x = v("\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 = v("\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 = v("\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n"), _e = v("\n query GetStorageTransactionId($where: AttestationWhereInput!) {\n storageTransactionId: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n id\n decodedDataJson\n }\n }\n"), S = v("\n query GetVersions($where: AttestationWhereInput!) {\n itemVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), ve = v("\n query GetProperties($where: AttestationWhereInput!) {\n itemProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), ye = v("\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\n allProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), be = v("\n query GetFilesMetadata($where: AttestationWhereInput!) {\n filesMetadata: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), xe = v("\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 = v("\n query GetImageVersions($where: AttestationWhereInput!) {\n imageVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), C = v("\n query GetAttestationChanges($where: AttestationWhereInput!) {\n changes: attestations(where: $where) {\n id\n refUID\n timeCreated\n revocationTime\n }\n }\n"), Ce = async ({ seedUids: e, excludeRevoked: t = !0 }) => {
|
|
2460
|
+
let n = f.getQueryClient(), r = p.getEasClient(), i = t ? _({ refUID: { in: e } }) : { refUID: { in: e } }, { itemVersions: a } = await n.fetchQuery({
|
|
2304
2461
|
queryKey: [
|
|
2305
2462
|
"getVersionsForAllModels",
|
|
2306
2463
|
[...e].sort(),
|
|
2307
2464
|
t
|
|
2308
2465
|
],
|
|
2309
|
-
queryFn: async () => r.request(
|
|
2466
|
+
queryFn: async () => r.request(S, { where: i })
|
|
2310
2467
|
});
|
|
2311
2468
|
return a;
|
|
2312
|
-
},
|
|
2313
|
-
let n =
|
|
2469
|
+
}, w = async ({ versionUids: e, excludeRevoked: t = !0 }) => {
|
|
2470
|
+
let n = f.getQueryClient(), r = p.getEasClient(), i = t ? _({ refUID: { in: e } }) : { refUID: { in: e } }, { itemProperties: a } = await n.fetchQuery({
|
|
2314
2471
|
queryKey: [
|
|
2315
2472
|
"getPropertiesForAllModels",
|
|
2316
2473
|
[...e].sort(),
|
|
2317
2474
|
t
|
|
2318
2475
|
],
|
|
2319
|
-
queryFn: async () => r.request(
|
|
2476
|
+
queryFn: async () => r.request(ve, { where: i })
|
|
2320
2477
|
});
|
|
2321
2478
|
return a;
|
|
2322
|
-
},
|
|
2323
|
-
let t =
|
|
2479
|
+
}, we = async (e) => fe(await w(e)), T = async ({ schemaName: e }) => {
|
|
2480
|
+
let t = f.getQueryClient(), n = p.getEasClient();
|
|
2324
2481
|
if (!t || !n) return;
|
|
2325
2482
|
let { schemas: r } = await t.fetchQuery({
|
|
2326
2483
|
queryKey: ["getEasSchemaUidBySchemaName", e],
|
|
2327
|
-
queryFn: async () => n.request(
|
|
2484
|
+
queryFn: async () => n.request(y, { where: { schema: { endsWith: e } } })
|
|
2328
2485
|
});
|
|
2329
2486
|
if (r && r.length !== 0) return r[0].id;
|
|
2330
|
-
},
|
|
2487
|
+
}, Te = async ({ schemaName: e }) => {
|
|
2331
2488
|
try {
|
|
2332
|
-
return await
|
|
2489
|
+
return await T({ schemaName: e });
|
|
2333
2490
|
} catch (t) {
|
|
2334
2491
|
process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for schema name ${e}:`, t);
|
|
2335
2492
|
return;
|
|
2336
2493
|
}
|
|
2337
|
-
},
|
|
2494
|
+
}, Ee = async ({ schemaUids: e, addresses: t, excludeRevoked: n = !0 }) => {
|
|
2338
2495
|
let r = {
|
|
2339
2496
|
attester: { in: t.map((e) => {
|
|
2340
2497
|
try {
|
|
2341
|
-
return
|
|
2498
|
+
return g(e);
|
|
2342
2499
|
} catch {
|
|
2343
2500
|
return e;
|
|
2344
2501
|
}
|
|
2345
2502
|
}) },
|
|
2346
2503
|
schemaId: { in: e }
|
|
2347
2504
|
};
|
|
2348
|
-
n && (r =
|
|
2349
|
-
let i =
|
|
2505
|
+
n && (r = _(r));
|
|
2506
|
+
let i = f.getQueryClient(), a = p.getEasClient(), { itemSeeds: o } = await i.fetchQuery({
|
|
2350
2507
|
queryKey: [
|
|
2351
2508
|
"getSeedsForAllModels",
|
|
2352
2509
|
n,
|
|
2353
2510
|
[...e].sort(),
|
|
2354
2511
|
[...t].sort()
|
|
2355
2512
|
],
|
|
2356
|
-
queryFn: async () => a.request(
|
|
2513
|
+
queryFn: async () => a.request(b, { where: r })
|
|
2357
2514
|
});
|
|
2358
2515
|
return o;
|
|
2359
|
-
},
|
|
2516
|
+
}, E = async (e, t = 10, n, r) => {
|
|
2360
2517
|
let i = n ?? 0, a = r?.uidPrefix, o = {
|
|
2361
|
-
where:
|
|
2518
|
+
where: _({
|
|
2362
2519
|
...a === void 0 ? {} : { id: { startsWith: a } },
|
|
2363
2520
|
schema: { is: { schemaNames: { some: { name: { equals: e } } } } }
|
|
2364
2521
|
}),
|
|
2365
2522
|
take: t,
|
|
2366
2523
|
skip: i
|
|
2367
|
-
}, s =
|
|
2524
|
+
}, s = f.getQueryClient(), c = p.getEasClient(), { itemSeeds: l } = await s.fetchQuery({
|
|
2368
2525
|
queryKey: [
|
|
2369
2526
|
"getSeedsBySchemaName",
|
|
2370
2527
|
e,
|
|
@@ -2372,112 +2529,112 @@ var b = y("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schem
|
|
|
2372
2529
|
i,
|
|
2373
2530
|
a ?? null
|
|
2374
2531
|
],
|
|
2375
|
-
queryFn: async () => c.request(
|
|
2532
|
+
queryFn: async () => c.request(x, o)
|
|
2376
2533
|
});
|
|
2377
|
-
return l.map((t) =>
|
|
2378
|
-
},
|
|
2534
|
+
return l.map((t) => D(t, [e]));
|
|
2535
|
+
}, D = (e, t) => ({
|
|
2379
2536
|
...e,
|
|
2380
2537
|
schema: { schemaNames: t.map((e) => ({ name: e })) }
|
|
2381
|
-
}),
|
|
2382
|
-
let
|
|
2538
|
+
}), O = /* @__PURE__ */ new Map(), k = (e) => {
|
|
2539
|
+
let t = "";
|
|
2383
2540
|
try {
|
|
2384
|
-
|
|
2541
|
+
t = n();
|
|
2385
2542
|
} catch {}
|
|
2386
|
-
return `${
|
|
2387
|
-
},
|
|
2388
|
-
|
|
2389
|
-
},
|
|
2543
|
+
return `${t}\n${e.toLowerCase()}`;
|
|
2544
|
+
}, De = () => {
|
|
2545
|
+
O.clear();
|
|
2546
|
+
}, A = async (e) => {
|
|
2390
2547
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
2391
2548
|
for (let r of new Set(e)) {
|
|
2392
|
-
let e =
|
|
2549
|
+
let e = O.get(k(r));
|
|
2393
2550
|
e ? t.set(r, e) : n.push(r);
|
|
2394
2551
|
}
|
|
2395
2552
|
if (n.length === 0) return t;
|
|
2396
|
-
let r =
|
|
2553
|
+
let r = f.getQueryClient(), i = p.getEasClient(), { schemas: a } = await r.fetchQuery({
|
|
2397
2554
|
queryKey: ["getSchemaNamesBySchemaUids", [...n].sort()],
|
|
2398
|
-
queryFn: async () => i.request(
|
|
2555
|
+
queryFn: async () => i.request(y, { where: { id: { in: n } } })
|
|
2399
2556
|
}), o = new Map(n.map((e) => [e.toLowerCase(), e]));
|
|
2400
2557
|
for (let e of a ?? []) {
|
|
2401
2558
|
let n = (e.schemaNames ?? []).map((e) => e.name), r = o.get(e.id.toLowerCase());
|
|
2402
|
-
r && n.length !== 0 && (
|
|
2559
|
+
r && n.length !== 0 && (O.set(k(r), n), t.set(r, n));
|
|
2403
2560
|
}
|
|
2404
2561
|
return t;
|
|
2405
|
-
},
|
|
2562
|
+
}, Oe = async ({ uids: e, excludeRevoked: t = !0 }) => {
|
|
2406
2563
|
if (e.length === 0) return [];
|
|
2407
|
-
let n = t ?
|
|
2564
|
+
let n = t ? _({ id: { in: e } }) : { id: { in: e } }, r = f.getQueryClient(), i = p.getEasClient(), { itemSeeds: a } = await r.fetchQuery({
|
|
2408
2565
|
queryKey: [
|
|
2409
2566
|
"getSeedsByUidsFromEas",
|
|
2410
2567
|
[...e].sort(),
|
|
2411
2568
|
t
|
|
2412
2569
|
],
|
|
2413
|
-
queryFn: async () => i.request(
|
|
2570
|
+
queryFn: async () => i.request(x, {
|
|
2414
2571
|
where: n,
|
|
2415
2572
|
take: e.length,
|
|
2416
2573
|
skip: 0
|
|
2417
2574
|
})
|
|
2418
|
-
}), o = a ?? [], s = await
|
|
2419
|
-
return o.map((e) =>
|
|
2420
|
-
},
|
|
2575
|
+
}), o = a ?? [], s = await A(o.map((e) => e.schemaId));
|
|
2576
|
+
return o.map((e) => D(e, s.get(e.schemaId) ?? []));
|
|
2577
|
+
}, j = 400, ke = async ({ refUIDs: e, ids: t, since: n }) => {
|
|
2421
2578
|
let r = { OR: [{ timeCreated: { gt: n } }, { revocationTime: { gt: n } }] }, i = [], a = (e, t) => {
|
|
2422
2579
|
let n = [...new Set(t)].sort();
|
|
2423
|
-
for (let t = 0; t < n.length; t +=
|
|
2580
|
+
for (let t = 0; t < n.length; t += j) i.push({ [e]: { in: n.slice(t, t + j) } });
|
|
2424
2581
|
};
|
|
2425
2582
|
if (a("refUID", e), a("id", t), i.length === 0) return [];
|
|
2426
|
-
let o =
|
|
2583
|
+
let o = f.getQueryClient(), s = p.getEasClient(), c = await Promise.all(i.map((e) => o.fetchQuery({
|
|
2427
2584
|
queryKey: [
|
|
2428
2585
|
"getAttestationChangesSince",
|
|
2429
2586
|
e,
|
|
2430
2587
|
n
|
|
2431
2588
|
],
|
|
2432
|
-
queryFn: async () => s.request(
|
|
2589
|
+
queryFn: async () => s.request(C, { where: { AND: [e, r] } })
|
|
2433
2590
|
}))), l = /* @__PURE__ */ new Map();
|
|
2434
2591
|
for (let { changes: e } of c) for (let t of e ?? []) l.set(t.id, t);
|
|
2435
2592
|
return [...l.values()];
|
|
2436
|
-
},
|
|
2593
|
+
}, Ae = async (e, t = 10) => (await E(e, t)).map((e) => e.id), je = "0x0000000000000000000000000000000000000000", Me = "0x", Ne = "0x0000000000000000000000000000000000000000000000000000000000000000", Pe = typeof process < "u" && process.env?.NEXT_PUBLIC_EAS_ENDPOINT || typeof process < "u" && process.env?.EAS_ENDPOINT || "https://optimism-sepolia.easscan.org/graphql";
|
|
2437
2594
|
//#endregion
|
|
2438
2595
|
//#region src/easUid.ts
|
|
2439
|
-
function
|
|
2596
|
+
function M(e) {
|
|
2440
2597
|
if (e == null || e === "" || e === "NULL") return !0;
|
|
2441
2598
|
let t = e.trim();
|
|
2442
2599
|
return t === "" || t.toLowerCase() === "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
2443
2600
|
}
|
|
2444
|
-
function
|
|
2445
|
-
if (
|
|
2601
|
+
function N(e) {
|
|
2602
|
+
if (M(e)) return !1;
|
|
2446
2603
|
let t = String(e).trim();
|
|
2447
2604
|
if (!/^0x/i.test(t)) return !1;
|
|
2448
2605
|
let n = t.slice(2);
|
|
2449
2606
|
return n.length === 64 && /^[0-9a-fA-F]{64}$/.test(n);
|
|
2450
2607
|
}
|
|
2451
|
-
function
|
|
2608
|
+
function P(e) {
|
|
2452
2609
|
if (e == null || e === "") return "";
|
|
2453
2610
|
let t = String(e).trim();
|
|
2454
2611
|
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
2612
|
}
|
|
2456
2613
|
//#endregion
|
|
2457
2614
|
//#region src/domainOwnershipHelpers.ts
|
|
2458
|
-
var
|
|
2459
|
-
function
|
|
2615
|
+
var Fe = "string domain,address claimer,string method,bytes32 challengeHash,uint64 verifiedAt,string registryCreationDate,string registryExpirationDate,bytes32 registryFingerprint,string scope", F = "seedprotocol.domainOwnership", Ie = "dns-txt-challenge", Le = "registrable", Re = "hostname", I = "_seedprotocol-challenge", ze = 2592e5, Be = 31536e6, Ve = 31536e3;
|
|
2616
|
+
function He(e) {
|
|
2460
2617
|
return new TextEncoder().encode(e);
|
|
2461
2618
|
}
|
|
2462
|
-
function
|
|
2619
|
+
function L(e) {
|
|
2463
2620
|
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
2464
2621
|
}
|
|
2465
|
-
function
|
|
2622
|
+
function R(e) {
|
|
2466
2623
|
let t = e.trim();
|
|
2467
2624
|
try {
|
|
2468
|
-
return
|
|
2625
|
+
return g(t).toLowerCase();
|
|
2469
2626
|
} catch {
|
|
2470
2627
|
return t.toLowerCase();
|
|
2471
2628
|
}
|
|
2472
2629
|
}
|
|
2473
|
-
function
|
|
2474
|
-
return `${
|
|
2630
|
+
function Ue(e) {
|
|
2631
|
+
return `${I}.${L(e)}`;
|
|
2475
2632
|
}
|
|
2476
|
-
function
|
|
2477
|
-
let t =
|
|
2633
|
+
function We(e) {
|
|
2634
|
+
let t = R(e.claimer);
|
|
2478
2635
|
return `token=${e.token},addr=${t},expiry=${e.expiry}`;
|
|
2479
2636
|
}
|
|
2480
|
-
function
|
|
2637
|
+
function Ge(e) {
|
|
2481
2638
|
let t = e.replace(/^"+|"+$/g, "").trim(), n = /* @__PURE__ */ new Map();
|
|
2482
2639
|
for (let e of t.split(",")) {
|
|
2483
2640
|
let t = e.indexOf("=");
|
|
@@ -2488,59 +2645,59 @@ function ze(e) {
|
|
|
2488
2645
|
let r = n.get("token"), i = n.get("addr") ?? n.get("claimer"), a = n.get("expiry");
|
|
2489
2646
|
return !r || !i || !a ? null : {
|
|
2490
2647
|
token: r,
|
|
2491
|
-
claimer:
|
|
2648
|
+
claimer: R(i),
|
|
2492
2649
|
expiry: a
|
|
2493
2650
|
};
|
|
2494
2651
|
}
|
|
2495
|
-
function
|
|
2496
|
-
let t =
|
|
2497
|
-
return "0x" +
|
|
2652
|
+
function Ke(e) {
|
|
2653
|
+
let t = L(e.domain), n = R(e.claimer), r = (e.scope ?? "registrable").trim();
|
|
2654
|
+
return "0x" + m(He(`${t}|${n}|${e.token}|${r}`));
|
|
2498
2655
|
}
|
|
2499
|
-
function
|
|
2656
|
+
function qe(e) {
|
|
2500
2657
|
let t = {
|
|
2501
|
-
domain:
|
|
2658
|
+
domain: L(e.domain),
|
|
2502
2659
|
creationDate: (e.creationDate ?? "").trim(),
|
|
2503
2660
|
registrarIanaId: (e.registrarIanaId ?? "").trim()
|
|
2504
2661
|
};
|
|
2505
|
-
return "0x" +
|
|
2662
|
+
return "0x" + m(He(JSON.stringify(t)));
|
|
2506
2663
|
}
|
|
2507
|
-
function
|
|
2508
|
-
return typeof e == "string" ?
|
|
2664
|
+
function z(e) {
|
|
2665
|
+
return typeof e == "string" ? P(e) : e && typeof e == "object" && "hex" in e ? P(String(e.hex)) : e && typeof e == "object" && "value" in e ? z(e.value) : P(String(e ?? ""));
|
|
2509
2666
|
}
|
|
2510
|
-
function
|
|
2667
|
+
function B(e) {
|
|
2511
2668
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2512
2669
|
}
|
|
2513
|
-
function
|
|
2670
|
+
function Je(e) {
|
|
2514
2671
|
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2515
2672
|
if (typeof e == "bigint") return Number(e);
|
|
2516
2673
|
if (typeof e == "string" && e.trim() !== "") {
|
|
2517
2674
|
let t = Number(e);
|
|
2518
2675
|
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2519
2676
|
}
|
|
2520
|
-
return e && typeof e == "object" && "value" in e ?
|
|
2677
|
+
return e && typeof e == "object" && "value" in e ? Je(e.value) : 0;
|
|
2521
2678
|
}
|
|
2522
|
-
function
|
|
2679
|
+
function Ye(e) {
|
|
2523
2680
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2524
2681
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2525
2682
|
return {
|
|
2526
|
-
domain:
|
|
2527
|
-
claimer:
|
|
2528
|
-
method:
|
|
2529
|
-
challengeHash:
|
|
2530
|
-
verifiedAt:
|
|
2531
|
-
registryCreationDate:
|
|
2532
|
-
registryExpirationDate:
|
|
2533
|
-
registryFingerprint:
|
|
2534
|
-
scope:
|
|
2683
|
+
domain: L(B(n.get("domain")?.value)),
|
|
2684
|
+
claimer: R(B(n.get("claimer")?.value)),
|
|
2685
|
+
method: B(n.get("method")?.value),
|
|
2686
|
+
challengeHash: z(n.get("challengeHash")?.value),
|
|
2687
|
+
verifiedAt: Je(n.get("verifiedAt")?.value),
|
|
2688
|
+
registryCreationDate: B(n.get("registryCreationDate")?.value),
|
|
2689
|
+
registryExpirationDate: B(n.get("registryExpirationDate")?.value),
|
|
2690
|
+
registryFingerprint: z(n.get("registryFingerprint")?.value),
|
|
2691
|
+
scope: B(n.get("scope")?.value)
|
|
2535
2692
|
};
|
|
2536
2693
|
}
|
|
2537
|
-
function
|
|
2694
|
+
function Xe(e) {
|
|
2538
2695
|
if (!e?.trim()) return null;
|
|
2539
2696
|
let t = Date.parse(e);
|
|
2540
2697
|
return Number.isFinite(t) ? Math.floor(t / 1e3) : null;
|
|
2541
2698
|
}
|
|
2542
|
-
function
|
|
2543
|
-
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.softStaleMs ?? 31536e6, i = e.expirationTime, a =
|
|
2699
|
+
function Ze(e) {
|
|
2700
|
+
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.softStaleMs ?? 31536e6, i = e.expirationTime, a = Xe(e.decoded.registryExpirationDate);
|
|
2544
2701
|
if (typeof i == "number" && i > 0 && t >= i || a != null && t >= a) return {
|
|
2545
2702
|
status: "expired",
|
|
2546
2703
|
warnings: n
|
|
@@ -2549,11 +2706,11 @@ function Ge(e) {
|
|
|
2549
2706
|
status: "unknown",
|
|
2550
2707
|
warnings: n
|
|
2551
2708
|
};
|
|
2552
|
-
if (e.registrySnapshot !== void 0) return
|
|
2709
|
+
if (e.registrySnapshot !== void 0) return P(qe({
|
|
2553
2710
|
domain: e.decoded.domain,
|
|
2554
2711
|
creationDate: e.registrySnapshot.creationDate,
|
|
2555
2712
|
registrarIanaId: e.registrySnapshot.registrarIanaId
|
|
2556
|
-
})) ===
|
|
2713
|
+
})) === P(e.decoded.registryFingerprint) ? {
|
|
2557
2714
|
status: "valid",
|
|
2558
2715
|
warnings: n
|
|
2559
2716
|
} : (n.push("Registry creation date or registrar IANA id no longer matches attestation fingerprint"), {
|
|
@@ -2571,43 +2728,43 @@ function Ge(e) {
|
|
|
2571
2728
|
}
|
|
2572
2729
|
//#endregion
|
|
2573
2730
|
//#region src/domainOwnership.ts
|
|
2574
|
-
function
|
|
2731
|
+
function Qe(e) {
|
|
2575
2732
|
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
2576
2733
|
}
|
|
2577
|
-
async function
|
|
2734
|
+
async function $e(e) {
|
|
2578
2735
|
let { toolAddresses: t, domains: n, claimers: r, schemaUid: i, excludeRevoked: a = !0 } = e;
|
|
2579
2736
|
if (!t.length) return [];
|
|
2580
2737
|
let o = t.map((e) => {
|
|
2581
2738
|
try {
|
|
2582
|
-
return
|
|
2739
|
+
return g(e);
|
|
2583
2740
|
} catch {
|
|
2584
2741
|
return e;
|
|
2585
2742
|
}
|
|
2586
2743
|
}), s = { attester: { in: o } };
|
|
2587
|
-
i ? s.schemaId = { equals: i } : s.schema = { is: { schemaNames: { some: { name: { equals:
|
|
2744
|
+
i ? s.schemaId = { equals: i } : s.schema = { is: { schemaNames: { some: { name: { equals: F } } } } }, r?.length && (s.recipient = { in: r.map((e) => {
|
|
2588
2745
|
try {
|
|
2589
|
-
return
|
|
2746
|
+
return g(e);
|
|
2590
2747
|
} catch {
|
|
2591
2748
|
return e;
|
|
2592
2749
|
}
|
|
2593
|
-
}) }), a && (s =
|
|
2594
|
-
let c =
|
|
2750
|
+
}) }), a && (s = _(s));
|
|
2751
|
+
let c = f.getQueryClient(), l = p.getEasClient(), { domainOwnerships: u } = await c.fetchQuery({
|
|
2595
2752
|
queryKey: [
|
|
2596
2753
|
"getDomainOwnershipFromEas",
|
|
2597
2754
|
a,
|
|
2598
2755
|
i ?? "seedprotocol.domainOwnership",
|
|
2599
2756
|
[...o].sort(),
|
|
2600
|
-
[...(n ?? []).map(
|
|
2757
|
+
[...(n ?? []).map(Qe)].sort(),
|
|
2601
2758
|
[...r ?? []].map((e) => e.toLowerCase()).sort()
|
|
2602
2759
|
],
|
|
2603
|
-
queryFn: async () => l.request(
|
|
2760
|
+
queryFn: async () => l.request(he, { where: s })
|
|
2604
2761
|
});
|
|
2605
2762
|
if (!n?.length) return u;
|
|
2606
|
-
let
|
|
2763
|
+
let ee = new Set(n.map(Qe));
|
|
2607
2764
|
return u.filter((e) => {
|
|
2608
2765
|
try {
|
|
2609
|
-
let t =
|
|
2610
|
-
return
|
|
2766
|
+
let t = Ye(e.decodedDataJson ?? "[]");
|
|
2767
|
+
return ee.has(t.domain);
|
|
2611
2768
|
} catch {
|
|
2612
2769
|
return !1;
|
|
2613
2770
|
}
|
|
@@ -2615,44 +2772,44 @@ async function qe(e) {
|
|
|
2615
2772
|
}
|
|
2616
2773
|
//#endregion
|
|
2617
2774
|
//#region src/publishAuthorizationHelpers.ts
|
|
2618
|
-
var
|
|
2619
|
-
function
|
|
2775
|
+
var et = "address identity,address sessionKey,address app,string scopes,uint64 grantedAt,uint64 expiresAt,bytes32 permissionsHash", tt = "seedprotocol.publishAuthorization", nt = "publish,revoke", rt = 31536e3;
|
|
2776
|
+
function V(e) {
|
|
2620
2777
|
let t = e.trim();
|
|
2621
2778
|
try {
|
|
2622
|
-
return
|
|
2779
|
+
return g(t).toLowerCase();
|
|
2623
2780
|
} catch {
|
|
2624
2781
|
return t.toLowerCase();
|
|
2625
2782
|
}
|
|
2626
2783
|
}
|
|
2627
|
-
function
|
|
2628
|
-
return typeof e == "string" ?
|
|
2784
|
+
function it(e) {
|
|
2785
|
+
return typeof e == "string" ? P(e) : e && typeof e == "object" && "hex" in e ? P(String(e.hex)) : P(String(e ?? ""));
|
|
2629
2786
|
}
|
|
2630
|
-
function
|
|
2787
|
+
function H(e) {
|
|
2631
2788
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2632
2789
|
}
|
|
2633
|
-
function
|
|
2790
|
+
function U(e) {
|
|
2634
2791
|
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2635
2792
|
if (typeof e == "bigint") return Number(e);
|
|
2636
2793
|
if (typeof e == "string" && e.trim() !== "") {
|
|
2637
2794
|
let t = Number(e);
|
|
2638
2795
|
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2639
2796
|
}
|
|
2640
|
-
return e && typeof e == "object" && "value" in e ?
|
|
2797
|
+
return e && typeof e == "object" && "value" in e ? U(e.value) : 0;
|
|
2641
2798
|
}
|
|
2642
|
-
function
|
|
2799
|
+
function at(e) {
|
|
2643
2800
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2644
2801
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2645
2802
|
return {
|
|
2646
|
-
identity: H(
|
|
2647
|
-
sessionKey: H(
|
|
2648
|
-
app: H(
|
|
2649
|
-
scopes:
|
|
2650
|
-
grantedAt:
|
|
2651
|
-
expiresAt:
|
|
2652
|
-
permissionsHash:
|
|
2803
|
+
identity: V(H(n.get("identity")?.value)),
|
|
2804
|
+
sessionKey: V(H(n.get("sessionKey")?.value)),
|
|
2805
|
+
app: V(H(n.get("app")?.value)),
|
|
2806
|
+
scopes: H(n.get("scopes")?.value),
|
|
2807
|
+
grantedAt: U(n.get("grantedAt")?.value),
|
|
2808
|
+
expiresAt: U(n.get("expiresAt")?.value),
|
|
2809
|
+
permissionsHash: it(n.get("permissionsHash")?.value)
|
|
2653
2810
|
};
|
|
2654
2811
|
}
|
|
2655
|
-
function
|
|
2812
|
+
function ot(e) {
|
|
2656
2813
|
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.expectedScopes ?? "publish,revoke", i = e.expirationTime, a = e.decoded.expiresAt;
|
|
2657
2814
|
return typeof i == "number" && i > 0 && t >= i || a > 0 && t >= a ? {
|
|
2658
2815
|
status: "expired",
|
|
@@ -2668,27 +2825,27 @@ function et(e) {
|
|
|
2668
2825
|
warnings: n
|
|
2669
2826
|
});
|
|
2670
2827
|
}
|
|
2671
|
-
function
|
|
2672
|
-
return "0x" +
|
|
2828
|
+
function st(e) {
|
|
2829
|
+
return "0x" + m(new TextEncoder().encode(e));
|
|
2673
2830
|
}
|
|
2674
2831
|
//#endregion
|
|
2675
2832
|
//#region src/publishAuthorization.ts
|
|
2676
|
-
async function
|
|
2833
|
+
async function ct(e = {}) {
|
|
2677
2834
|
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:
|
|
2835
|
+
i ? o.schemaId = { equals: i } : o.schema = { is: { schemaNames: { some: { name: { equals: tt } } } } }, t?.length && (o.attester = { in: t.map((e) => {
|
|
2679
2836
|
try {
|
|
2680
|
-
return
|
|
2837
|
+
return g(e);
|
|
2681
2838
|
} catch {
|
|
2682
2839
|
return e;
|
|
2683
2840
|
}
|
|
2684
2841
|
}) }), n?.length && (o.recipient = { in: n.map((e) => {
|
|
2685
2842
|
try {
|
|
2686
|
-
return
|
|
2843
|
+
return g(e);
|
|
2687
2844
|
} catch {
|
|
2688
2845
|
return e;
|
|
2689
2846
|
}
|
|
2690
|
-
}) }), a && (o =
|
|
2691
|
-
let s =
|
|
2847
|
+
}) }), a && (o = _(o));
|
|
2848
|
+
let s = f.getQueryClient(), c = p.getEasClient(), { itemSeeds: l } = await s.fetchQuery({
|
|
2692
2849
|
queryKey: [
|
|
2693
2850
|
"getPublishAuthorizationFromEas",
|
|
2694
2851
|
a,
|
|
@@ -2697,13 +2854,13 @@ async function nt(e = {}) {
|
|
|
2697
2854
|
[...n ?? []].map((e) => e.toLowerCase()).sort(),
|
|
2698
2855
|
[...r ?? []].map((e) => e.toLowerCase()).sort()
|
|
2699
2856
|
],
|
|
2700
|
-
queryFn: async () => c.request(
|
|
2857
|
+
queryFn: async () => c.request(b, { where: o })
|
|
2701
2858
|
});
|
|
2702
2859
|
if (!r?.length) return l;
|
|
2703
2860
|
let u = new Set(r.map((e) => e.toLowerCase()));
|
|
2704
2861
|
return l.filter((e) => {
|
|
2705
2862
|
try {
|
|
2706
|
-
let t =
|
|
2863
|
+
let t = at(e.decodedDataJson ?? "[]");
|
|
2707
2864
|
return u.has(t.app.toLowerCase());
|
|
2708
2865
|
} catch {
|
|
2709
2866
|
return !1;
|
|
@@ -2711,56 +2868,74 @@ async function nt(e = {}) {
|
|
|
2711
2868
|
});
|
|
2712
2869
|
}
|
|
2713
2870
|
//#endregion
|
|
2871
|
+
//#region src/easRefAttester.ts
|
|
2872
|
+
function lt(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 ut(e, t) {
|
|
2886
|
+
return lt(e, t).kept;
|
|
2887
|
+
}
|
|
2888
|
+
//#endregion
|
|
2714
2889
|
//#region src/publishedByHelpers.ts
|
|
2715
|
-
var
|
|
2716
|
-
function
|
|
2890
|
+
var dt = "bytes32 seedUid,bytes32 versionUid,bytes32[] attestationUids,bytes32 batchHash,string toolName,string toolVersion", ft = "seedprotocol.publishedBy";
|
|
2891
|
+
function pt(e) {
|
|
2717
2892
|
let t = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, n = new Uint8Array(t.length / 2);
|
|
2718
2893
|
for (let e = 0; e < n.length; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
|
|
2719
2894
|
return n;
|
|
2720
2895
|
}
|
|
2721
|
-
function
|
|
2722
|
-
let t = [...e].map((e) =>
|
|
2723
|
-
if (t.length === 0) return "0x" +
|
|
2896
|
+
function mt(e) {
|
|
2897
|
+
let t = [...e].map((e) => P(e)).filter((e) => e !== "" && N(e)).sort();
|
|
2898
|
+
if (t.length === 0) return "0x" + m(/* @__PURE__ */ new Uint8Array());
|
|
2724
2899
|
let n = new Uint8Array(t.length * 32);
|
|
2725
|
-
for (let e = 0; e < t.length; e++) n.set(
|
|
2726
|
-
return "0x" +
|
|
2900
|
+
for (let e = 0; e < t.length; e++) n.set(pt(t[e]), e * 32);
|
|
2901
|
+
return "0x" + m(n);
|
|
2727
2902
|
}
|
|
2728
|
-
function
|
|
2729
|
-
return
|
|
2903
|
+
function ht(e) {
|
|
2904
|
+
return P(mt(e.attestationUids)) === P(e.batchHash);
|
|
2730
2905
|
}
|
|
2731
|
-
function
|
|
2732
|
-
return typeof e == "string" ?
|
|
2906
|
+
function W(e) {
|
|
2907
|
+
return typeof e == "string" ? P(e) : e && typeof e == "object" && "hex" in e ? P(String(e.hex)) : P(String(e ?? ""));
|
|
2733
2908
|
}
|
|
2734
|
-
function
|
|
2909
|
+
function gt(e) {
|
|
2735
2910
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2736
2911
|
}
|
|
2737
|
-
function
|
|
2912
|
+
function _t(e) {
|
|
2738
2913
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2739
2914
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2740
2915
|
let r = n.get("attestationUids")?.value, i = [];
|
|
2741
|
-
return Array.isArray(r) ? i = r.map((e) =>
|
|
2742
|
-
seedUid:
|
|
2743
|
-
versionUid:
|
|
2916
|
+
return Array.isArray(r) ? i = r.map((e) => W(e)) : r && typeof r == "object" && Array.isArray(r.value) && (i = r.value.map((e) => W(e))), {
|
|
2917
|
+
seedUid: W(n.get("seedUid")?.value),
|
|
2918
|
+
versionUid: W(n.get("versionUid")?.value),
|
|
2744
2919
|
attestationUids: i,
|
|
2745
|
-
batchHash:
|
|
2746
|
-
toolName:
|
|
2747
|
-
toolVersion:
|
|
2920
|
+
batchHash: W(n.get("batchHash")?.value),
|
|
2921
|
+
toolName: gt(n.get("toolName")?.value),
|
|
2922
|
+
toolVersion: gt(n.get("toolVersion")?.value)
|
|
2748
2923
|
};
|
|
2749
2924
|
}
|
|
2750
2925
|
//#endregion
|
|
2751
2926
|
//#region src/publishedBy.ts
|
|
2752
|
-
async function
|
|
2927
|
+
async function vt(e) {
|
|
2753
2928
|
let { toolAddresses: t, refUIDs: n, schemaUid: r, excludeRevoked: i = !0 } = e;
|
|
2754
2929
|
if (!t.length) return [];
|
|
2755
2930
|
let a = t.map((e) => {
|
|
2756
2931
|
try {
|
|
2757
|
-
return
|
|
2932
|
+
return g(e);
|
|
2758
2933
|
} catch {
|
|
2759
2934
|
return e;
|
|
2760
2935
|
}
|
|
2761
2936
|
}), o = { attester: { in: a } };
|
|
2762
|
-
r ? o.schemaId = { equals: r } : o.schema = { is: { schemaNames: { some: { name: { equals:
|
|
2763
|
-
let s =
|
|
2937
|
+
r ? o.schemaId = { equals: r } : o.schema = { is: { schemaNames: { some: { name: { equals: ft } } } } }, n?.length && (o.refUID = { in: n }), i && (o = _(o));
|
|
2938
|
+
let s = f.getQueryClient(), c = p.getEasClient(), { itemSeeds: l } = await s.fetchQuery({
|
|
2764
2939
|
queryKey: [
|
|
2765
2940
|
"getPublishedByFromEas",
|
|
2766
2941
|
i,
|
|
@@ -2768,71 +2943,71 @@ async function ut(e) {
|
|
|
2768
2943
|
[...a].sort(),
|
|
2769
2944
|
[...n ?? []].sort()
|
|
2770
2945
|
],
|
|
2771
|
-
queryFn: async () => c.request(
|
|
2946
|
+
queryFn: async () => c.request(b, { where: o })
|
|
2772
2947
|
});
|
|
2773
2948
|
return l;
|
|
2774
2949
|
}
|
|
2775
2950
|
//#endregion
|
|
2776
2951
|
//#region src/default/index.ts
|
|
2777
|
-
function
|
|
2778
|
-
|
|
2952
|
+
function yt() {
|
|
2953
|
+
p.isConfigured() || p.configure(new d()), f.isConfigured() || f.configure(new ae());
|
|
2779
2954
|
}
|
|
2780
2955
|
//#endregion
|
|
2781
2956
|
//#region src/stores/schemaUidCache.ts
|
|
2782
|
-
var
|
|
2783
|
-
let
|
|
2957
|
+
var G = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), bt = 3e5, q = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map(), X = 0, Z = (e) => {
|
|
2958
|
+
let t = "";
|
|
2784
2959
|
try {
|
|
2785
|
-
|
|
2960
|
+
t = n();
|
|
2786
2961
|
} catch {}
|
|
2787
|
-
return `${
|
|
2962
|
+
return `${t}\n${e}`;
|
|
2788
2963
|
}, Q = async (e, t) => {
|
|
2789
|
-
let n =
|
|
2964
|
+
let n = Z(e), r = J.get(n);
|
|
2790
2965
|
if (r !== void 0) {
|
|
2791
2966
|
if (Date.now() < r) return;
|
|
2792
|
-
|
|
2967
|
+
J.delete(n);
|
|
2793
2968
|
}
|
|
2794
|
-
let i =
|
|
2969
|
+
let i = Y.get(n);
|
|
2795
2970
|
if (i) return i;
|
|
2796
|
-
let a =
|
|
2797
|
-
|
|
2971
|
+
let a = X, o = t().then((e) => (!e && a === X && J.set(n, Date.now() + bt), e)).finally(() => {
|
|
2972
|
+
Y.get(n) === o && Y.delete(n);
|
|
2798
2973
|
});
|
|
2799
|
-
return
|
|
2974
|
+
return Y.set(n, o), o;
|
|
2800
2975
|
}, $ = () => {
|
|
2801
|
-
|
|
2802
|
-
},
|
|
2803
|
-
|
|
2804
|
-
},
|
|
2805
|
-
|
|
2806
|
-
},
|
|
2807
|
-
|
|
2808
|
-
},
|
|
2809
|
-
let t =
|
|
2810
|
-
if (!
|
|
2976
|
+
X++, J.clear(), Y.clear();
|
|
2977
|
+
}, xt = () => {
|
|
2978
|
+
G.clear(), K.clear(), q.clear(), $();
|
|
2979
|
+
}, St = ({ text: e, schemaUid: t }) => {
|
|
2980
|
+
G.set(h(e), t), $();
|
|
2981
|
+
}, Ct = ({ modelName: e, schemaUid: t }) => {
|
|
2982
|
+
K.set(e.toLowerCase(), t), $();
|
|
2983
|
+
}, wt = (e) => K.get(e.toLowerCase()), Tt = async ({ schemaText: e }) => {
|
|
2984
|
+
let t = h(e);
|
|
2985
|
+
if (!G.has(t)) {
|
|
2811
2986
|
let e;
|
|
2812
2987
|
try {
|
|
2813
|
-
e = await Q(`schemaName:${t}`, () =>
|
|
2988
|
+
e = await Q(`schemaName:${t}`, () => T({ schemaName: t }));
|
|
2814
2989
|
} catch (e) {
|
|
2815
2990
|
process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for schema name ${t}:`, e);
|
|
2816
2991
|
return;
|
|
2817
2992
|
}
|
|
2818
|
-
return e &&
|
|
2993
|
+
return e && G.set(t, e), e;
|
|
2819
2994
|
}
|
|
2820
|
-
return
|
|
2821
|
-
},
|
|
2822
|
-
let t =
|
|
2995
|
+
return G.get(t);
|
|
2996
|
+
}, Et = async (e) => {
|
|
2997
|
+
let t = Z(e), n = q.get(t);
|
|
2823
2998
|
if (n) return n;
|
|
2824
|
-
let r =
|
|
2999
|
+
let r = f.getQueryClient(), i = p.getEasClient();
|
|
2825
3000
|
if (!r || !i) return;
|
|
2826
3001
|
let a = await Q(`definition:${e}`, async () => {
|
|
2827
3002
|
let t = await r.fetchQuery({
|
|
2828
3003
|
queryKey: ["getSchemaByDefinition", e],
|
|
2829
|
-
queryFn: async () => i.request(
|
|
3004
|
+
queryFn: async () => i.request(me, { where: { schema: { equals: e } } })
|
|
2830
3005
|
}), n = t?.schemas ?? t?.data?.schemas;
|
|
2831
3006
|
return Array.isArray(n) && n.length > 0 ? n[0].id : void 0;
|
|
2832
3007
|
});
|
|
2833
|
-
return a &&
|
|
3008
|
+
return a && q.set(t, a), a;
|
|
2834
3009
|
};
|
|
2835
3010
|
//#endregion
|
|
2836
|
-
export {
|
|
3011
|
+
export { p as BaseEasClient, p as EasClient, f as BaseQueryClient, a as DEFAULT_EAS_CHAIN_ID, ze as DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS, Ve as DOMAIN_OWNERSHIP_DEFAULT_EXPIRATION_SECS, Ie as DOMAIN_OWNERSHIP_METHOD, Fe as DOMAIN_OWNERSHIP_SCHEMA_DEF, F as DOMAIN_OWNERSHIP_SCHEMA_NAME, Re as DOMAIN_OWNERSHIP_SCOPE_HOSTNAME, Le as DOMAIN_OWNERSHIP_SCOPE_REGISTRABLE, Be as DOMAIN_OWNERSHIP_SOFT_STALE_MS, I as DOMAIN_OWNERSHIP_TXT_LABEL, d as DefaultEasClient, ae as DefaultQueryClient, r as DuplicateEasModuleError, o as EAS_CHAIN_DEPLOYMENTS, Pe as EAS_ENDPOINT, ye as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, C 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, y as GET_SCHEMAS, me as GET_SCHEMA_BY_NAME, b as GET_SEEDS, x as GET_SEEDS_LEAN, ge as GET_SEED_IDS, _e as GET_STORAGE_TRANSACTION_ID, S as GET_VERSIONS, ne as OP_STACK_EAS_CONTRACT_ADDRESS, ee as OP_STACK_SCHEMA_REGISTRY_ADDRESS, dt as PUBLISHED_BY_SCHEMA_DEF, ft as PUBLISHED_BY_SCHEMA_NAME, rt as PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS, et as PUBLISH_AUTHORIZATION_SCHEMA_DEF, tt as PUBLISH_AUTHORIZATION_SCHEMA_NAME, nt as PUBLISH_AUTHORIZATION_SCOPES, bt as SCHEMA_LOOKUP_MISS_TTL_MS, je as ZERO_ADDRESS, Me as ZERO_BYTES, Ne as ZERO_BYTES32, se as assertSingleEasModule, Ze as assessDomainOwnership, ot as assessPublishAuthorization, We as buildDomainOwnershipTxtValue, Q as cachedSchemaLookup, g as checksumAddress, $ as clearSchemaLookupMisses, re as configureEasReadChain, Ye as decodeDomainOwnershipData, at as decodePublishAuthorizationData, _t as decodePublishedByData, Ue as domainOwnershipTxtName, yt as ensureEasPlatform, l as expectEasReadChain, T as fetchEasSchemaUidBySchemaName, ke as getAttestationChangesSince, we as getCanonicalItemPropertiesFromEas, $e as getDomainOwnershipFromEas, c as getEasAttestationExplorerUrl, s as getEasChainDeployment, n as getEasEndpoint, te as getEasReadChainId, Te as getEasSchemaUidBySchemaName, Et as getEasSchemaUidForExactDefinition, Tt as getEasSchemaUidForSchemaDefinition, w as getItemPropertiesFromEas, Ce as getItemVersionsFromEas, ct as getPublishAuthorizationFromEas, vt as getPublishedByFromEas, A as getSchemaNamesBySchemaUids, wt as getSchemaUidForModelFromCache, Ae as getSeedUidsBySchemaName, E as getSeedsBySchemaName, Oe as getSeedsByUidsFromEas, Ee as getSeedsFromSchemaUids, Ke as hashDomainOwnershipChallenge, qe as hashDomainRegistryFingerprint, st as hashPublishAuthorizationMaterial, mt as hashPublishedByBatch, ie as isEasReadChainConfigured, i as isEasReadChainSettled, M as isPlaceholderUid, N as isValidEasAttestationUid, ut as keepAttestationsFromRefAttester, P as normalizeBytes32Hex, Ge as parseDomainOwnershipTxtValue, lt as partitionByRefAttester, fe as pickLatestPropertyAttestationsByRefAndSchema, e as resetEasClientOwnerForTests, u as resetEasReadChain, De as resetSchemaNamesCache, xt as resetSchemaUidCaches, t as resolveEasChainDeployment, Ct as setSchemaUidForModel, St as setSchemaUidForSchemaDefinition, h as toSnakeCase, ht as verifyPublishedByBatch, oe as whenEasReadChainSettled, _ as withExcludeRevokedFilter };
|
|
2837
3012
|
|
|
2838
3013
|
//# sourceMappingURL=index.js.map
|