@seedprotocol/eas 0.6.5 → 0.6.7
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +189 -120
- package/dist/index.js.map +1 -1
- package/dist/keccak.d.ts +3 -0
- package/dist/keccak.d.ts.map +1 -0
- package/dist/publishedBy.d.ts +19 -0
- package/dist/publishedBy.d.ts.map +1 -0
- package/dist/publishedByHelpers.d.ts +34 -0
- package/dist/publishedByHelpers.d.ts.map +1 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './publishAuthorization.js';
|
|
|
5
5
|
export * from './easPropertyCanonical.js';
|
|
6
6
|
export * from './easRevokedFilter.js';
|
|
7
7
|
export * from './easUid.js';
|
|
8
|
+
export * from './publishedBy.js';
|
|
8
9
|
export * from './queries.js';
|
|
9
10
|
export * from './utils.js';
|
|
10
11
|
export * from './EasClient/BaseEasClient.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,8BAA8B,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAC3D,cAAc,kCAAkC,CAAA;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AAC/E,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACpF,cAAc,4BAA4B,CAAA;AAC1C,YAAY,EACV,WAAW,EACX,MAAM,IAAI,SAAS,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,8BAA8B,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAC3D,cAAc,kCAAkC,CAAA;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AAC/E,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACpF,cAAc,4BAA4B,CAAA;AAC1C,YAAY,EACV,WAAW,EACX,MAAM,IAAI,SAAS,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import { a as e, i as t, n, o as r, r as i, t as a } from "./constants-Ch1B4W2F.js";
|
|
2
|
-
import {
|
|
2
|
+
import { keccak_256 as o } from "@noble/hashes/sha3";
|
|
3
|
+
import { bytesToHex as s, utf8ToBytes as c } from "@noble/hashes/utils";
|
|
3
4
|
import "graphql";
|
|
5
|
+
//#region src/keccak.ts
|
|
6
|
+
function l(e) {
|
|
7
|
+
let t = typeof e == "string" ? c(e) : e;
|
|
8
|
+
return s(o(t));
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
4
11
|
//#region src/utils.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
12
|
+
var u = (e) => e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
|
|
13
|
+
function d(e) {
|
|
7
14
|
let t = e.toLowerCase().replace(/^0x/, "");
|
|
8
15
|
if (t.length !== 40 || !/^[0-9a-f]+$/.test(t)) return e;
|
|
9
|
-
let n =
|
|
16
|
+
let n = l(t), r = "0x";
|
|
10
17
|
for (let e = 0; e < 40; e++) r += parseInt(n[e], 16) >= 8 ? t[e].toUpperCase() : t[e];
|
|
11
18
|
return r;
|
|
12
19
|
}
|
|
13
20
|
//#endregion
|
|
14
21
|
//#region src/easPropertyCanonical.ts
|
|
15
|
-
function
|
|
22
|
+
function f(e) {
|
|
16
23
|
let t = /* @__PURE__ */ new Map();
|
|
17
24
|
for (let n of e) {
|
|
18
25
|
let e = n.schemaId;
|
|
@@ -24,7 +31,7 @@ function l(e) {
|
|
|
24
31
|
}
|
|
25
32
|
//#endregion
|
|
26
33
|
//#region src/easRevokedFilter.ts
|
|
27
|
-
function
|
|
34
|
+
function p(e) {
|
|
28
35
|
let t = { revoked: { equals: !1 } }, n = Array.isArray(e.AND) ? e.AND : [];
|
|
29
36
|
return {
|
|
30
37
|
...e,
|
|
@@ -33,7 +40,7 @@ function u(e) {
|
|
|
33
40
|
}
|
|
34
41
|
//#endregion
|
|
35
42
|
//#region src/graphql/gql/gql.ts
|
|
36
|
-
var
|
|
43
|
+
var m = {
|
|
37
44
|
"\n fragment attestationFields on Attestation {\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": {
|
|
38
45
|
kind: "Document",
|
|
39
46
|
definitions: [{
|
|
@@ -2092,69 +2099,69 @@ var d = {
|
|
|
2092
2099
|
}]
|
|
2093
2100
|
}
|
|
2094
2101
|
};
|
|
2095
|
-
function
|
|
2096
|
-
return
|
|
2102
|
+
function h(e) {
|
|
2103
|
+
return m[e] ?? {};
|
|
2097
2104
|
}
|
|
2098
2105
|
//#endregion
|
|
2099
2106
|
//#region src/queries.ts
|
|
2100
|
-
var
|
|
2101
|
-
let i = e.getQueryClient(), a = r.getEasClient(), o = n ?
|
|
2107
|
+
var g = h("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), ee = h("\n query GetSchemaByName($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), _ = h("\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"), v = h("\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n"), te = h("\n query GetStorageTransactionId($where: AttestationWhereInput!) {\n storageTransactionId: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n id\n decodedDataJson\n }\n }\n"), y = h("\n query GetVersions($where: AttestationWhereInput!) {\n itemVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), b = h("\n query GetProperties($where: AttestationWhereInput!) {\n itemProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), ne = h("\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\n allProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), re = h("\n query GetFilesMetadata($where: AttestationWhereInput!) {\n filesMetadata: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), ie = h("\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"), ae = h("\n query GetImageVersions($where: AttestationWhereInput!) {\n imageVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), oe = async ({ seedUids: t, excludeRevoked: n = !0 }) => {
|
|
2108
|
+
let i = e.getQueryClient(), a = r.getEasClient(), o = n ? p({ refUID: { in: t } }) : { refUID: { in: t } }, { itemVersions: s } = await i.fetchQuery({
|
|
2102
2109
|
queryKey: [
|
|
2103
2110
|
"getVersionsForAllModels",
|
|
2104
2111
|
[...t].sort(),
|
|
2105
2112
|
n
|
|
2106
2113
|
],
|
|
2107
|
-
queryFn: async () => a.request(
|
|
2114
|
+
queryFn: async () => a.request(y, { where: o })
|
|
2108
2115
|
});
|
|
2109
2116
|
return s;
|
|
2110
|
-
},
|
|
2111
|
-
let i = e.getQueryClient(), a = r.getEasClient(), o = n ?
|
|
2117
|
+
}, x = async ({ versionUids: t, excludeRevoked: n = !0 }) => {
|
|
2118
|
+
let i = e.getQueryClient(), a = r.getEasClient(), o = n ? p({ refUID: { in: t } }) : { refUID: { in: t } }, { itemProperties: s } = await i.fetchQuery({
|
|
2112
2119
|
queryKey: [
|
|
2113
2120
|
"getPropertiesForAllModels",
|
|
2114
2121
|
[...t].sort(),
|
|
2115
2122
|
n
|
|
2116
2123
|
],
|
|
2117
|
-
queryFn: async () => a.request(
|
|
2124
|
+
queryFn: async () => a.request(b, { where: o })
|
|
2118
2125
|
});
|
|
2119
2126
|
return s;
|
|
2120
|
-
},
|
|
2127
|
+
}, se = async (e) => f(await x(e)), S = async ({ schemaName: t }) => {
|
|
2121
2128
|
try {
|
|
2122
2129
|
let n = e.getQueryClient(), i = r.getEasClient();
|
|
2123
2130
|
if (!n || !i) return;
|
|
2124
2131
|
let { schemas: a } = await n.fetchQuery({
|
|
2125
2132
|
queryKey: ["getEasSchemaUidBySchemaName"],
|
|
2126
|
-
queryFn: async () => i.request(
|
|
2133
|
+
queryFn: async () => i.request(g, { where: { schema: { endsWith: t } } })
|
|
2127
2134
|
});
|
|
2128
2135
|
return !a || a.length === 0 ? void 0 : a[0].id;
|
|
2129
2136
|
} catch (e) {
|
|
2130
2137
|
process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for schema name ${t}:`, e);
|
|
2131
2138
|
return;
|
|
2132
2139
|
}
|
|
2133
|
-
},
|
|
2140
|
+
}, C = async ({ schemaUids: t, addresses: n, excludeRevoked: i = !0 }) => {
|
|
2134
2141
|
let a = {
|
|
2135
2142
|
attester: { in: n.map((e) => {
|
|
2136
2143
|
try {
|
|
2137
|
-
return
|
|
2144
|
+
return d(e);
|
|
2138
2145
|
} catch {
|
|
2139
2146
|
return e;
|
|
2140
2147
|
}
|
|
2141
2148
|
}) },
|
|
2142
2149
|
schemaId: { in: t }
|
|
2143
2150
|
};
|
|
2144
|
-
i && (a =
|
|
2145
|
-
let o = e.getQueryClient(), s = r.getEasClient(), { itemSeeds:
|
|
2151
|
+
i && (a = p(a));
|
|
2152
|
+
let o = e.getQueryClient(), s = r.getEasClient(), { itemSeeds: c } = await o.fetchQuery({
|
|
2146
2153
|
queryKey: [
|
|
2147
2154
|
"getSeedsForAllModels",
|
|
2148
2155
|
i,
|
|
2149
2156
|
[...t].sort(),
|
|
2150
2157
|
[...n].sort()
|
|
2151
2158
|
],
|
|
2152
|
-
queryFn: async () => s.request(
|
|
2159
|
+
queryFn: async () => s.request(_, { where: a })
|
|
2153
2160
|
});
|
|
2154
|
-
return
|
|
2155
|
-
},
|
|
2161
|
+
return c;
|
|
2162
|
+
}, w = async (t, n = 10, i) => {
|
|
2156
2163
|
let a = i ?? 0, o = {
|
|
2157
|
-
where:
|
|
2164
|
+
where: p({ schema: { is: { schemaNames: { some: { name: { equals: t } } } } } }),
|
|
2158
2165
|
take: n,
|
|
2159
2166
|
skip: a
|
|
2160
2167
|
}, s = e.getQueryClient(), c = r.getEasClient(), { itemSeeds: l } = await s.fetchQuery({
|
|
@@ -2164,54 +2171,54 @@ var p = f("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schem
|
|
|
2164
2171
|
n,
|
|
2165
2172
|
a
|
|
2166
2173
|
],
|
|
2167
|
-
queryFn: async () => c.request(
|
|
2174
|
+
queryFn: async () => c.request(_, o)
|
|
2168
2175
|
});
|
|
2169
2176
|
return l;
|
|
2170
|
-
},
|
|
2177
|
+
}, T = async (e, t = 10) => (await w(e, t)).map((e) => e.id);
|
|
2171
2178
|
//#endregion
|
|
2172
2179
|
//#region src/easUid.ts
|
|
2173
|
-
function
|
|
2180
|
+
function E(e) {
|
|
2174
2181
|
if (e == null || e === "" || e === "NULL") return !0;
|
|
2175
2182
|
let t = e.trim();
|
|
2176
2183
|
return t === "" || t.toLowerCase() === "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
2177
2184
|
}
|
|
2178
|
-
function
|
|
2179
|
-
if (
|
|
2185
|
+
function D(e) {
|
|
2186
|
+
if (E(e)) return !1;
|
|
2180
2187
|
let t = String(e).trim();
|
|
2181
2188
|
if (!/^0x/i.test(t)) return !1;
|
|
2182
2189
|
let n = t.slice(2);
|
|
2183
2190
|
return n.length === 64 && /^[0-9a-fA-F]{64}$/.test(n);
|
|
2184
2191
|
}
|
|
2185
|
-
function
|
|
2192
|
+
function O(e) {
|
|
2186
2193
|
if (e == null || e === "") return "";
|
|
2187
2194
|
let t = String(e).trim();
|
|
2188
2195
|
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();
|
|
2189
2196
|
}
|
|
2190
2197
|
//#endregion
|
|
2191
2198
|
//#region src/domainOwnershipHelpers.ts
|
|
2192
|
-
var
|
|
2193
|
-
function
|
|
2199
|
+
var ce = "string domain,address claimer,string method,bytes32 challengeHash,uint64 verifiedAt,string registryCreationDate,string registryExpirationDate,bytes32 registryFingerprint,string scope", k = "seedprotocol.domainOwnership", le = "dns-txt-challenge", ue = "registrable", A = "_seedprotocol-challenge", de = 2592e5, fe = 31536e6, pe = 31536e3;
|
|
2200
|
+
function j(e) {
|
|
2194
2201
|
return new TextEncoder().encode(e);
|
|
2195
2202
|
}
|
|
2196
|
-
function
|
|
2203
|
+
function M(e) {
|
|
2197
2204
|
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
2198
2205
|
}
|
|
2199
|
-
function
|
|
2206
|
+
function N(e) {
|
|
2200
2207
|
let t = e.trim();
|
|
2201
2208
|
try {
|
|
2202
|
-
return
|
|
2209
|
+
return d(t).toLowerCase();
|
|
2203
2210
|
} catch {
|
|
2204
2211
|
return t.toLowerCase();
|
|
2205
2212
|
}
|
|
2206
2213
|
}
|
|
2207
|
-
function
|
|
2208
|
-
return `${
|
|
2214
|
+
function me(e) {
|
|
2215
|
+
return `${A}.${M(e)}`;
|
|
2209
2216
|
}
|
|
2210
|
-
function
|
|
2211
|
-
let t =
|
|
2217
|
+
function he(e) {
|
|
2218
|
+
let t = N(e.claimer);
|
|
2212
2219
|
return `token=${e.token},addr=${t},expiry=${e.expiry}`;
|
|
2213
2220
|
}
|
|
2214
|
-
function
|
|
2221
|
+
function ge(e) {
|
|
2215
2222
|
let t = e.replace(/^"+|"+$/g, "").trim(), n = /* @__PURE__ */ new Map();
|
|
2216
2223
|
for (let e of t.split(",")) {
|
|
2217
2224
|
let t = e.indexOf("=");
|
|
@@ -2222,59 +2229,59 @@ function L(e) {
|
|
|
2222
2229
|
let r = n.get("token"), i = n.get("addr") ?? n.get("claimer"), a = n.get("expiry");
|
|
2223
2230
|
return !r || !i || !a ? null : {
|
|
2224
2231
|
token: r,
|
|
2225
|
-
claimer:
|
|
2232
|
+
claimer: N(i),
|
|
2226
2233
|
expiry: a
|
|
2227
2234
|
};
|
|
2228
2235
|
}
|
|
2229
|
-
function
|
|
2230
|
-
let t =
|
|
2231
|
-
return "0x" +
|
|
2236
|
+
function P(e) {
|
|
2237
|
+
let t = M(e.domain), n = N(e.claimer), r = (e.scope ?? "registrable").trim();
|
|
2238
|
+
return "0x" + l(j(`${t}|${n}|${e.token}|${r}`));
|
|
2232
2239
|
}
|
|
2233
|
-
function
|
|
2240
|
+
function F(e) {
|
|
2234
2241
|
let t = {
|
|
2235
|
-
domain:
|
|
2242
|
+
domain: M(e.domain),
|
|
2236
2243
|
creationDate: (e.creationDate ?? "").trim(),
|
|
2237
2244
|
registrarIanaId: (e.registrarIanaId ?? "").trim()
|
|
2238
2245
|
};
|
|
2239
|
-
return "0x" +
|
|
2246
|
+
return "0x" + l(j(JSON.stringify(t)));
|
|
2240
2247
|
}
|
|
2241
|
-
function
|
|
2242
|
-
return typeof e == "string" ?
|
|
2248
|
+
function I(e) {
|
|
2249
|
+
return typeof e == "string" ? O(e) : e && typeof e == "object" && "hex" in e ? O(String(e.hex)) : O(String(e ?? ""));
|
|
2243
2250
|
}
|
|
2244
|
-
function
|
|
2251
|
+
function L(e) {
|
|
2245
2252
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2246
2253
|
}
|
|
2247
|
-
function
|
|
2254
|
+
function R(e) {
|
|
2248
2255
|
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2249
2256
|
if (typeof e == "bigint") return Number(e);
|
|
2250
2257
|
if (typeof e == "string" && e.trim() !== "") {
|
|
2251
2258
|
let t = Number(e);
|
|
2252
2259
|
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2253
2260
|
}
|
|
2254
|
-
return e && typeof e == "object" && "value" in e ?
|
|
2261
|
+
return e && typeof e == "object" && "value" in e ? R(e.value) : 0;
|
|
2255
2262
|
}
|
|
2256
|
-
function
|
|
2263
|
+
function z(e) {
|
|
2257
2264
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2258
2265
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2259
2266
|
return {
|
|
2260
|
-
domain:
|
|
2261
|
-
claimer:
|
|
2262
|
-
method:
|
|
2263
|
-
challengeHash:
|
|
2264
|
-
verifiedAt:
|
|
2265
|
-
registryCreationDate:
|
|
2266
|
-
registryExpirationDate:
|
|
2267
|
-
registryFingerprint:
|
|
2268
|
-
scope:
|
|
2267
|
+
domain: M(L(n.get("domain")?.value)),
|
|
2268
|
+
claimer: N(L(n.get("claimer")?.value)),
|
|
2269
|
+
method: L(n.get("method")?.value),
|
|
2270
|
+
challengeHash: I(n.get("challengeHash")?.value),
|
|
2271
|
+
verifiedAt: R(n.get("verifiedAt")?.value),
|
|
2272
|
+
registryCreationDate: L(n.get("registryCreationDate")?.value),
|
|
2273
|
+
registryExpirationDate: L(n.get("registryExpirationDate")?.value),
|
|
2274
|
+
registryFingerprint: I(n.get("registryFingerprint")?.value),
|
|
2275
|
+
scope: L(n.get("scope")?.value)
|
|
2269
2276
|
};
|
|
2270
2277
|
}
|
|
2271
|
-
function
|
|
2278
|
+
function _e(e) {
|
|
2272
2279
|
if (!e?.trim()) return null;
|
|
2273
2280
|
let t = Date.parse(e);
|
|
2274
2281
|
return Number.isFinite(t) ? Math.floor(t / 1e3) : null;
|
|
2275
2282
|
}
|
|
2276
|
-
function
|
|
2277
|
-
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.softStaleMs ?? 31536e6, i = e.expirationTime, a =
|
|
2283
|
+
function ve(e) {
|
|
2284
|
+
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.softStaleMs ?? 31536e6, i = e.expirationTime, a = _e(e.decoded.registryExpirationDate);
|
|
2278
2285
|
if (typeof i == "number" && i > 0 && t >= i || a != null && t >= a) return {
|
|
2279
2286
|
status: "expired",
|
|
2280
2287
|
warnings: n
|
|
@@ -2283,11 +2290,11 @@ function de(e) {
|
|
|
2283
2290
|
status: "unknown",
|
|
2284
2291
|
warnings: n
|
|
2285
2292
|
};
|
|
2286
|
-
if (e.registrySnapshot !== void 0) return
|
|
2293
|
+
if (e.registrySnapshot !== void 0) return O(F({
|
|
2287
2294
|
domain: e.decoded.domain,
|
|
2288
2295
|
creationDate: e.registrySnapshot.creationDate,
|
|
2289
2296
|
registrarIanaId: e.registrySnapshot.registrarIanaId
|
|
2290
|
-
})) ===
|
|
2297
|
+
})) === O(e.decoded.registryFingerprint) ? {
|
|
2291
2298
|
status: "valid",
|
|
2292
2299
|
warnings: n
|
|
2293
2300
|
} : (n.push("Registry creation date or registrar IANA id no longer matches attestation fingerprint"), {
|
|
@@ -2305,43 +2312,43 @@ function de(e) {
|
|
|
2305
2312
|
}
|
|
2306
2313
|
//#endregion
|
|
2307
2314
|
//#region src/domainOwnership.ts
|
|
2308
|
-
function
|
|
2315
|
+
function B(e) {
|
|
2309
2316
|
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
2310
2317
|
}
|
|
2311
|
-
async function
|
|
2318
|
+
async function ye(t) {
|
|
2312
2319
|
let { toolAddresses: n, domains: i, claimers: a, schemaUid: o, excludeRevoked: s = !0 } = t;
|
|
2313
2320
|
if (!n.length) return [];
|
|
2314
|
-
let
|
|
2321
|
+
let c = n.map((e) => {
|
|
2315
2322
|
try {
|
|
2316
|
-
return
|
|
2323
|
+
return d(e);
|
|
2317
2324
|
} catch {
|
|
2318
2325
|
return e;
|
|
2319
2326
|
}
|
|
2320
|
-
}),
|
|
2321
|
-
o ?
|
|
2327
|
+
}), l = { attester: { in: c } };
|
|
2328
|
+
o ? l.schemaId = { equals: o } : l.schema = { is: { schemaNames: { some: { name: { equals: k } } } } }, a?.length && (l.recipient = { in: a.map((e) => {
|
|
2322
2329
|
try {
|
|
2323
|
-
return
|
|
2330
|
+
return d(e);
|
|
2324
2331
|
} catch {
|
|
2325
2332
|
return e;
|
|
2326
2333
|
}
|
|
2327
|
-
}) }), s && (
|
|
2328
|
-
let
|
|
2334
|
+
}) }), s && (l = p(l));
|
|
2335
|
+
let u = e.getQueryClient(), f = r.getEasClient(), { itemSeeds: m } = await u.fetchQuery({
|
|
2329
2336
|
queryKey: [
|
|
2330
2337
|
"getDomainOwnershipFromEas",
|
|
2331
2338
|
s,
|
|
2332
2339
|
o ?? "seedprotocol.domainOwnership",
|
|
2333
|
-
[...
|
|
2334
|
-
[...(i ?? []).map(
|
|
2340
|
+
[...c].sort(),
|
|
2341
|
+
[...(i ?? []).map(B)].sort(),
|
|
2335
2342
|
[...a ?? []].map((e) => e.toLowerCase()).sort()
|
|
2336
2343
|
],
|
|
2337
|
-
queryFn: async () =>
|
|
2344
|
+
queryFn: async () => f.request(_, { where: l })
|
|
2338
2345
|
});
|
|
2339
2346
|
if (!i?.length) return m;
|
|
2340
|
-
let
|
|
2347
|
+
let h = new Set(i.map(B));
|
|
2341
2348
|
return m.filter((e) => {
|
|
2342
2349
|
try {
|
|
2343
|
-
let t =
|
|
2344
|
-
return
|
|
2350
|
+
let t = z(e.decodedDataJson ?? "[]");
|
|
2351
|
+
return h.has(t.domain);
|
|
2345
2352
|
} catch {
|
|
2346
2353
|
return !1;
|
|
2347
2354
|
}
|
|
@@ -2349,44 +2356,44 @@ async function fe(t) {
|
|
|
2349
2356
|
}
|
|
2350
2357
|
//#endregion
|
|
2351
2358
|
//#region src/publishAuthorizationHelpers.ts
|
|
2352
|
-
var
|
|
2353
|
-
function
|
|
2359
|
+
var be = "address identity,address sessionKey,address app,string scopes,uint64 grantedAt,uint64 expiresAt,bytes32 permissionsHash", V = "seedprotocol.publishAuthorization", xe = "publish,revoke", Se = 31536e3;
|
|
2360
|
+
function H(e) {
|
|
2354
2361
|
let t = e.trim();
|
|
2355
2362
|
try {
|
|
2356
|
-
return
|
|
2363
|
+
return d(t).toLowerCase();
|
|
2357
2364
|
} catch {
|
|
2358
2365
|
return t.toLowerCase();
|
|
2359
2366
|
}
|
|
2360
2367
|
}
|
|
2361
|
-
function
|
|
2362
|
-
return typeof e == "string" ?
|
|
2368
|
+
function Ce(e) {
|
|
2369
|
+
return typeof e == "string" ? O(e) : e && typeof e == "object" && "hex" in e ? O(String(e.hex)) : O(String(e ?? ""));
|
|
2363
2370
|
}
|
|
2364
|
-
function
|
|
2371
|
+
function U(e) {
|
|
2365
2372
|
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2366
2373
|
}
|
|
2367
|
-
function
|
|
2374
|
+
function W(e) {
|
|
2368
2375
|
if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
|
|
2369
2376
|
if (typeof e == "bigint") return Number(e);
|
|
2370
2377
|
if (typeof e == "string" && e.trim() !== "") {
|
|
2371
2378
|
let t = Number(e);
|
|
2372
2379
|
return Number.isFinite(t) ? Math.trunc(t) : 0;
|
|
2373
2380
|
}
|
|
2374
|
-
return e && typeof e == "object" && "value" in e ?
|
|
2381
|
+
return e && typeof e == "object" && "value" in e ? W(e.value) : 0;
|
|
2375
2382
|
}
|
|
2376
|
-
function
|
|
2383
|
+
function G(e) {
|
|
2377
2384
|
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2378
2385
|
for (let e of t) e?.name && n.set(e.name, e);
|
|
2379
2386
|
return {
|
|
2380
|
-
identity:
|
|
2381
|
-
sessionKey:
|
|
2382
|
-
app:
|
|
2383
|
-
scopes:
|
|
2384
|
-
grantedAt:
|
|
2385
|
-
expiresAt:
|
|
2386
|
-
permissionsHash:
|
|
2387
|
+
identity: H(U(n.get("identity")?.value)),
|
|
2388
|
+
sessionKey: H(U(n.get("sessionKey")?.value)),
|
|
2389
|
+
app: H(U(n.get("app")?.value)),
|
|
2390
|
+
scopes: U(n.get("scopes")?.value),
|
|
2391
|
+
grantedAt: W(n.get("grantedAt")?.value),
|
|
2392
|
+
expiresAt: W(n.get("expiresAt")?.value),
|
|
2393
|
+
permissionsHash: Ce(n.get("permissionsHash")?.value)
|
|
2387
2394
|
};
|
|
2388
2395
|
}
|
|
2389
|
-
function
|
|
2396
|
+
function we(e) {
|
|
2390
2397
|
let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.expectedScopes ?? "publish,revoke", i = e.expirationTime, a = e.decoded.expiresAt;
|
|
2391
2398
|
return typeof i == "number" && i > 0 && t >= i || a > 0 && t >= a ? {
|
|
2392
2399
|
status: "expired",
|
|
@@ -2402,27 +2409,27 @@ function X(e) {
|
|
|
2402
2409
|
warnings: n
|
|
2403
2410
|
});
|
|
2404
2411
|
}
|
|
2405
|
-
function
|
|
2406
|
-
return "0x" +
|
|
2412
|
+
function Te(e) {
|
|
2413
|
+
return "0x" + l(new TextEncoder().encode(e));
|
|
2407
2414
|
}
|
|
2408
2415
|
//#endregion
|
|
2409
2416
|
//#region src/publishAuthorization.ts
|
|
2410
|
-
async function
|
|
2411
|
-
let { identities: n, sessionKeys: i, apps: a, schemaUid: o, excludeRevoked: s = !0 } = t,
|
|
2412
|
-
o ?
|
|
2417
|
+
async function Ee(t = {}) {
|
|
2418
|
+
let { identities: n, sessionKeys: i, apps: a, schemaUid: o, excludeRevoked: s = !0 } = t, c = {};
|
|
2419
|
+
o ? c.schemaId = { equals: o } : c.schema = { is: { schemaNames: { some: { name: { equals: V } } } } }, n?.length && (c.attester = { in: n.map((e) => {
|
|
2413
2420
|
try {
|
|
2414
|
-
return
|
|
2421
|
+
return d(e);
|
|
2415
2422
|
} catch {
|
|
2416
2423
|
return e;
|
|
2417
2424
|
}
|
|
2418
|
-
}) }), i?.length && (
|
|
2425
|
+
}) }), i?.length && (c.recipient = { in: i.map((e) => {
|
|
2419
2426
|
try {
|
|
2420
|
-
return
|
|
2427
|
+
return d(e);
|
|
2421
2428
|
} catch {
|
|
2422
2429
|
return e;
|
|
2423
2430
|
}
|
|
2424
|
-
}) }), s && (
|
|
2425
|
-
let
|
|
2431
|
+
}) }), s && (c = p(c));
|
|
2432
|
+
let l = e.getQueryClient(), u = r.getEasClient(), { itemSeeds: f } = await l.fetchQuery({
|
|
2426
2433
|
queryKey: [
|
|
2427
2434
|
"getPublishAuthorizationFromEas",
|
|
2428
2435
|
s,
|
|
@@ -2431,13 +2438,13 @@ async function ve(t = {}) {
|
|
|
2431
2438
|
[...i ?? []].map((e) => e.toLowerCase()).sort(),
|
|
2432
2439
|
[...a ?? []].map((e) => e.toLowerCase()).sort()
|
|
2433
2440
|
],
|
|
2434
|
-
queryFn: async () =>
|
|
2441
|
+
queryFn: async () => u.request(_, { where: c })
|
|
2435
2442
|
});
|
|
2436
|
-
if (!a?.length) return
|
|
2443
|
+
if (!a?.length) return f;
|
|
2437
2444
|
let m = new Set(a.map((e) => e.toLowerCase()));
|
|
2438
|
-
return
|
|
2445
|
+
return f.filter((e) => {
|
|
2439
2446
|
try {
|
|
2440
|
-
let t =
|
|
2447
|
+
let t = G(e.decodedDataJson ?? "[]");
|
|
2441
2448
|
return m.has(t.app.toLowerCase());
|
|
2442
2449
|
} catch {
|
|
2443
2450
|
return !1;
|
|
@@ -2445,15 +2452,77 @@ async function ve(t = {}) {
|
|
|
2445
2452
|
});
|
|
2446
2453
|
}
|
|
2447
2454
|
//#endregion
|
|
2455
|
+
//#region src/publishedByHelpers.ts
|
|
2456
|
+
var De = "bytes32 seedUid,bytes32 versionUid,bytes32[] attestationUids,bytes32 batchHash,string toolName,string toolVersion", K = "seedprotocol.publishedBy";
|
|
2457
|
+
function Oe(e) {
|
|
2458
|
+
let t = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, n = new Uint8Array(t.length / 2);
|
|
2459
|
+
for (let e = 0; e < n.length; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
|
|
2460
|
+
return n;
|
|
2461
|
+
}
|
|
2462
|
+
function q(e) {
|
|
2463
|
+
let t = [...e].map((e) => O(e)).filter((e) => e !== "" && D(e)).sort();
|
|
2464
|
+
if (t.length === 0) return "0x" + l(/* @__PURE__ */ new Uint8Array());
|
|
2465
|
+
let n = new Uint8Array(t.length * 32);
|
|
2466
|
+
for (let e = 0; e < t.length; e++) n.set(Oe(t[e]), e * 32);
|
|
2467
|
+
return "0x" + l(n);
|
|
2468
|
+
}
|
|
2469
|
+
function ke(e) {
|
|
2470
|
+
return O(q(e.attestationUids)) === O(e.batchHash);
|
|
2471
|
+
}
|
|
2472
|
+
function J(e) {
|
|
2473
|
+
return typeof e == "string" ? O(e) : e && typeof e == "object" && "hex" in e ? O(String(e.hex)) : O(String(e ?? ""));
|
|
2474
|
+
}
|
|
2475
|
+
function Y(e) {
|
|
2476
|
+
return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
|
|
2477
|
+
}
|
|
2478
|
+
function Ae(e) {
|
|
2479
|
+
let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
|
|
2480
|
+
for (let e of t) e?.name && n.set(e.name, e);
|
|
2481
|
+
let r = n.get("attestationUids")?.value, i = [];
|
|
2482
|
+
return Array.isArray(r) ? i = r.map((e) => J(e)) : r && typeof r == "object" && Array.isArray(r.value) && (i = r.value.map((e) => J(e))), {
|
|
2483
|
+
seedUid: J(n.get("seedUid")?.value),
|
|
2484
|
+
versionUid: J(n.get("versionUid")?.value),
|
|
2485
|
+
attestationUids: i,
|
|
2486
|
+
batchHash: J(n.get("batchHash")?.value),
|
|
2487
|
+
toolName: Y(n.get("toolName")?.value),
|
|
2488
|
+
toolVersion: Y(n.get("toolVersion")?.value)
|
|
2489
|
+
};
|
|
2490
|
+
}
|
|
2491
|
+
//#endregion
|
|
2492
|
+
//#region src/publishedBy.ts
|
|
2493
|
+
async function X(t) {
|
|
2494
|
+
let { toolAddresses: n, refUIDs: i, schemaUid: a, excludeRevoked: o = !0 } = t;
|
|
2495
|
+
if (!n.length) return [];
|
|
2496
|
+
let s = n.map((e) => {
|
|
2497
|
+
try {
|
|
2498
|
+
return d(e);
|
|
2499
|
+
} catch {
|
|
2500
|
+
return e;
|
|
2501
|
+
}
|
|
2502
|
+
}), c = { attester: { in: s } };
|
|
2503
|
+
a ? c.schemaId = { equals: a } : c.schema = { is: { schemaNames: { some: { name: { equals: K } } } } }, i?.length && (c.refUID = { in: i }), o && (c = p(c));
|
|
2504
|
+
let l = e.getQueryClient(), u = r.getEasClient(), { itemSeeds: f } = await l.fetchQuery({
|
|
2505
|
+
queryKey: [
|
|
2506
|
+
"getPublishedByFromEas",
|
|
2507
|
+
o,
|
|
2508
|
+
a ?? "seedprotocol.publishedBy",
|
|
2509
|
+
[...s].sort(),
|
|
2510
|
+
[...i ?? []].sort()
|
|
2511
|
+
],
|
|
2512
|
+
queryFn: async () => u.request(_, { where: c })
|
|
2513
|
+
});
|
|
2514
|
+
return f;
|
|
2515
|
+
}
|
|
2516
|
+
//#endregion
|
|
2448
2517
|
//#region src/stores/schemaUidCache.ts
|
|
2449
2518
|
var Z = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map(), $ = ({ text: e, schemaUid: t }) => {
|
|
2450
|
-
Z.set(
|
|
2451
|
-
},
|
|
2519
|
+
Z.set(u(e), t);
|
|
2520
|
+
}, je = ({ modelName: e, schemaUid: t }) => {
|
|
2452
2521
|
Q.set(e.toLowerCase(), t);
|
|
2453
|
-
},
|
|
2454
|
-
let t =
|
|
2522
|
+
}, Me = (e) => Q.get(e.toLowerCase()), Ne = async ({ schemaText: e }) => {
|
|
2523
|
+
let t = u(e);
|
|
2455
2524
|
if (!Z.has(t)) {
|
|
2456
|
-
let e = await
|
|
2525
|
+
let e = await S({ schemaName: t });
|
|
2457
2526
|
return e && $({
|
|
2458
2527
|
text: t,
|
|
2459
2528
|
schemaUid: e
|
|
@@ -2462,6 +2531,6 @@ var Z = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map(), $ = ({ text: e
|
|
|
2462
2531
|
return Z.get(t);
|
|
2463
2532
|
};
|
|
2464
2533
|
//#endregion
|
|
2465
|
-
export { r as BaseEasClient, r as EasClient, e as BaseQueryClient,
|
|
2534
|
+
export { r as BaseEasClient, r as EasClient, e as BaseQueryClient, de as DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS, pe as DOMAIN_OWNERSHIP_DEFAULT_EXPIRATION_SECS, le as DOMAIN_OWNERSHIP_METHOD, ce as DOMAIN_OWNERSHIP_SCHEMA_DEF, k as DOMAIN_OWNERSHIP_SCHEMA_NAME, ue as DOMAIN_OWNERSHIP_SCOPE_REGISTRABLE, fe as DOMAIN_OWNERSHIP_SOFT_STALE_MS, A as DOMAIN_OWNERSHIP_TXT_LABEL, a as EAS_ENDPOINT, ne as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, re as GET_FILES_METADATA, ie as GET_IMAGE_SEEDS, ae as GET_IMAGE_VERSIONS, b as GET_PROPERTIES, g as GET_SCHEMAS, ee as GET_SCHEMA_BY_NAME, _ as GET_SEEDS, v as GET_SEED_IDS, te as GET_STORAGE_TRANSACTION_ID, y as GET_VERSIONS, De as PUBLISHED_BY_SCHEMA_DEF, K as PUBLISHED_BY_SCHEMA_NAME, Se as PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS, be as PUBLISH_AUTHORIZATION_SCHEMA_DEF, V as PUBLISH_AUTHORIZATION_SCHEMA_NAME, xe as PUBLISH_AUTHORIZATION_SCOPES, n as ZERO_ADDRESS, i as ZERO_BYTES, t as ZERO_BYTES32, ve as assessDomainOwnership, we as assessPublishAuthorization, he as buildDomainOwnershipTxtValue, d as checksumAddress, z as decodeDomainOwnershipData, G as decodePublishAuthorizationData, Ae as decodePublishedByData, me as domainOwnershipTxtName, se as getCanonicalItemPropertiesFromEas, ye as getDomainOwnershipFromEas, S as getEasSchemaUidBySchemaName, Ne as getEasSchemaUidForSchemaDefinition, x as getItemPropertiesFromEas, oe as getItemVersionsFromEas, Ee as getPublishAuthorizationFromEas, X as getPublishedByFromEas, Me as getSchemaUidForModelFromCache, T as getSeedUidsBySchemaName, w as getSeedsBySchemaName, C as getSeedsFromSchemaUids, P as hashDomainOwnershipChallenge, F as hashDomainRegistryFingerprint, Te as hashPublishAuthorizationMaterial, q as hashPublishedByBatch, E as isPlaceholderUid, D as isValidEasAttestationUid, O as normalizeBytes32Hex, ge as parseDomainOwnershipTxtValue, f as pickLatestPropertyAttestationsByRefAndSchema, je as setSchemaUidForModel, $ as setSchemaUidForSchemaDefinition, u as toSnakeCase, ke as verifyPublishedByBatch, p as withExcludeRevokedFilter };
|
|
2466
2535
|
|
|
2467
2536
|
//# sourceMappingURL=index.js.map
|