@seedprotocol/eas 0.6.6 → 0.6.8

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.js CHANGED
@@ -1,18 +1,25 @@
1
- import { a as e, i as t, n, o as r, r as i, t as a } from "./constants-Ch1B4W2F.js";
2
- import { keccak256 as o } from "js-sha3";
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 f, r as p, s as ee, t as m, u as te } from "./easEndpoint-BYyoBW_s.js";
2
+ import { keccak_256 as ne } from "@noble/hashes/sha3";
3
+ import { bytesToHex as re, utf8ToBytes as ie } from "@noble/hashes/utils";
3
4
  import "graphql";
5
+ //#region src/keccak.ts
6
+ function h(e) {
7
+ let t = typeof e == "string" ? ie(e) : e;
8
+ return re(ne(t));
9
+ }
10
+ //#endregion
4
11
  //#region src/utils.ts
5
- var s = (e) => e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
6
- function c(e) {
12
+ var g = (e) => e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
13
+ function _(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 = o(t), r = "0x";
16
+ let n = h(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 l(e) {
22
+ function v(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 u(e) {
34
+ function y(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 d = {
43
+ var ae = {
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,126 +2099,126 @@ var d = {
2092
2099
  }]
2093
2100
  }
2094
2101
  };
2095
- function f(e) {
2096
- return d[e] ?? {};
2102
+ function b(e) {
2103
+ return ae[e] ?? {};
2097
2104
  }
2098
2105
  //#endregion
2099
2106
  //#region src/queries.ts
2100
- var p = f("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), m = f("\n query GetSchemaByName($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), h = f("\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"), g = f("\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n"), ee = f("\n query GetStorageTransactionId($where: AttestationWhereInput!) {\n storageTransactionId: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n id\n decodedDataJson\n }\n }\n"), _ = f("\n query GetVersions($where: AttestationWhereInput!) {\n itemVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), v = f("\n query GetProperties($where: AttestationWhereInput!) {\n itemProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), te = f("\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\n allProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), y = f("\n query GetFilesMetadata($where: AttestationWhereInput!) {\n filesMetadata: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), b = f("\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"), x = f("\n query GetImageVersions($where: AttestationWhereInput!) {\n imageVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), ne = async ({ seedUids: t, excludeRevoked: n = !0 }) => {
2101
- let i = e.getQueryClient(), a = r.getEasClient(), o = n ? u({ refUID: { in: t } }) : { refUID: { in: t } }, { itemVersions: s } = await i.fetchQuery({
2107
+ var x = b("\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), oe = b("\n query GetSchemaByName($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"), S = b("\n query GetSeeds($where: AttestationWhereInput!, $take: Int, $skip: Int) {\n itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }], take: $take, skip: $skip) {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n revocationTime\n schemaId\n timeCreated\n isOffchain\n }\n }\n"), se = b("\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n"), ce = b("\n query GetStorageTransactionId($where: AttestationWhereInput!) {\n storageTransactionId: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n id\n decodedDataJson\n }\n }\n"), C = b("\n query GetVersions($where: AttestationWhereInput!) {\n itemVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), w = b("\n query GetProperties($where: AttestationWhereInput!) {\n itemProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), le = b("\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\n allProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), ue = b("\n query GetFilesMetadata($where: AttestationWhereInput!) {\n filesMetadata: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), de = b("\n query GetImageSeeds($where: AttestationWhereInput!) {\n imageSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n schemaId\n txid\n timeCreated\n time\n isOffchain\n }\n }\n"), fe = b("\n query GetImageVersions($where: AttestationWhereInput!) {\n imageVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"), pe = async ({ seedUids: t, excludeRevoked: n = !0 }) => {
2108
+ let r = a.getQueryClient(), i = e.getEasClient(), o = n ? y({ refUID: { in: t } }) : { refUID: { in: t } }, { itemVersions: s } = await r.fetchQuery({
2102
2109
  queryKey: [
2103
2110
  "getVersionsForAllModels",
2104
2111
  [...t].sort(),
2105
2112
  n
2106
2113
  ],
2107
- queryFn: async () => a.request(_, { where: o })
2114
+ queryFn: async () => i.request(C, { where: o })
2108
2115
  });
2109
2116
  return s;
2110
- }, S = async ({ versionUids: t, excludeRevoked: n = !0 }) => {
2111
- let i = e.getQueryClient(), a = r.getEasClient(), o = n ? u({ refUID: { in: t } }) : { refUID: { in: t } }, { itemProperties: s } = await i.fetchQuery({
2117
+ }, T = async ({ versionUids: t, excludeRevoked: n = !0 }) => {
2118
+ let r = a.getQueryClient(), i = e.getEasClient(), o = n ? y({ refUID: { in: t } }) : { refUID: { in: t } }, { itemProperties: s } = await r.fetchQuery({
2112
2119
  queryKey: [
2113
2120
  "getPropertiesForAllModels",
2114
2121
  [...t].sort(),
2115
2122
  n
2116
2123
  ],
2117
- queryFn: async () => a.request(v, { where: o })
2124
+ queryFn: async () => i.request(w, { where: o })
2118
2125
  });
2119
2126
  return s;
2120
- }, re = async (e) => l(await S(e)), C = async ({ schemaName: t }) => {
2127
+ }, me = async (e) => v(await T(e)), E = async ({ schemaName: t }) => {
2121
2128
  try {
2122
- let n = e.getQueryClient(), i = r.getEasClient();
2123
- if (!n || !i) return;
2124
- let { schemas: a } = await n.fetchQuery({
2129
+ let n = a.getQueryClient(), r = e.getEasClient();
2130
+ if (!n || !r) return;
2131
+ let { schemas: i } = await n.fetchQuery({
2125
2132
  queryKey: ["getEasSchemaUidBySchemaName"],
2126
- queryFn: async () => i.request(p, { where: { schema: { endsWith: t } } })
2133
+ queryFn: async () => r.request(x, { where: { schema: { endsWith: t } } })
2127
2134
  });
2128
- return !a || a.length === 0 ? void 0 : a[0].id;
2135
+ return !i || i.length === 0 ? void 0 : i[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
- }, w = async ({ schemaUids: t, addresses: n, excludeRevoked: i = !0 }) => {
2134
- let a = {
2140
+ }, he = async ({ schemaUids: t, addresses: n, excludeRevoked: r = !0 }) => {
2141
+ let i = {
2135
2142
  attester: { in: n.map((e) => {
2136
2143
  try {
2137
- return c(e);
2144
+ return _(e);
2138
2145
  } catch {
2139
2146
  return e;
2140
2147
  }
2141
2148
  }) },
2142
2149
  schemaId: { in: t }
2143
2150
  };
2144
- i && (a = u(a));
2145
- let o = e.getQueryClient(), s = r.getEasClient(), { itemSeeds: l } = await o.fetchQuery({
2151
+ r && (i = y(i));
2152
+ let o = a.getQueryClient(), s = e.getEasClient(), { itemSeeds: c } = await o.fetchQuery({
2146
2153
  queryKey: [
2147
2154
  "getSeedsForAllModels",
2148
- i,
2155
+ r,
2149
2156
  [...t].sort(),
2150
2157
  [...n].sort()
2151
2158
  ],
2152
- queryFn: async () => s.request(h, { where: a })
2159
+ queryFn: async () => s.request(S, { where: i })
2153
2160
  });
2154
- return l;
2155
- }, T = async (t, n = 10, i) => {
2156
- let a = i ?? 0, o = {
2157
- where: u({ schema: { is: { schemaNames: { some: { name: { equals: t } } } } } }),
2161
+ return c;
2162
+ }, D = async (t, n = 10, r) => {
2163
+ let i = r ?? 0, o = {
2164
+ where: y({ schema: { is: { schemaNames: { some: { name: { equals: t } } } } } }),
2158
2165
  take: n,
2159
- skip: a
2160
- }, s = e.getQueryClient(), c = r.getEasClient(), { itemSeeds: l } = await s.fetchQuery({
2166
+ skip: i
2167
+ }, s = a.getQueryClient(), c = e.getEasClient(), { itemSeeds: l } = await s.fetchQuery({
2161
2168
  queryKey: [
2162
2169
  "getSeedsBySchemaName",
2163
2170
  t,
2164
2171
  n,
2165
- a
2172
+ i
2166
2173
  ],
2167
- queryFn: async () => c.request(h, o)
2174
+ queryFn: async () => c.request(S, o)
2168
2175
  });
2169
2176
  return l;
2170
- }, E = async (e, t = 10) => (await T(e, t)).map((e) => e.id);
2177
+ }, ge = async (e, t = 10) => (await D(e, t)).map((e) => e.id), _e = "0x0000000000000000000000000000000000000000", ve = "0x", ye = "0x0000000000000000000000000000000000000000000000000000000000000000", be = typeof process < "u" && process.env?.NEXT_PUBLIC_EAS_ENDPOINT || typeof process < "u" && process.env?.EAS_ENDPOINT || "https://optimism-sepolia.easscan.org/graphql";
2171
2178
  //#endregion
2172
2179
  //#region src/easUid.ts
2173
- function D(e) {
2180
+ function O(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 O(e) {
2179
- if (D(e)) return !1;
2185
+ function k(e) {
2186
+ if (O(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 k(e) {
2192
+ function A(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 ie = "string domain,address claimer,string method,bytes32 challengeHash,uint64 verifiedAt,string registryCreationDate,string registryExpirationDate,bytes32 registryFingerprint,string scope", A = "seedprotocol.domainOwnership", ae = "dns-txt-challenge", oe = "registrable", j = "_seedprotocol-challenge", se = 2592e5, ce = 31536e6, le = 31536e3;
2193
- function M(e) {
2199
+ var xe = "string domain,address claimer,string method,bytes32 challengeHash,uint64 verifiedAt,string registryCreationDate,string registryExpirationDate,bytes32 registryFingerprint,string scope", j = "seedprotocol.domainOwnership", Se = "dns-txt-challenge", Ce = "registrable", M = "_seedprotocol-challenge", we = 2592e5, Te = 31536e6, Ee = 31536e3;
2200
+ function N(e) {
2194
2201
  return new TextEncoder().encode(e);
2195
2202
  }
2196
- function N(e) {
2203
+ function P(e) {
2197
2204
  return e.trim().toLowerCase().replace(/\.$/, "");
2198
2205
  }
2199
- function P(e) {
2206
+ function F(e) {
2200
2207
  let t = e.trim();
2201
2208
  try {
2202
- return c(t).toLowerCase();
2209
+ return _(t).toLowerCase();
2203
2210
  } catch {
2204
2211
  return t.toLowerCase();
2205
2212
  }
2206
2213
  }
2207
- function F(e) {
2208
- return `${j}.${N(e)}`;
2214
+ function De(e) {
2215
+ return `${M}.${P(e)}`;
2209
2216
  }
2210
- function I(e) {
2211
- let t = P(e.claimer);
2217
+ function Oe(e) {
2218
+ let t = F(e.claimer);
2212
2219
  return `token=${e.token},addr=${t},expiry=${e.expiry}`;
2213
2220
  }
2214
- function L(e) {
2221
+ function ke(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: P(i),
2232
+ claimer: F(i),
2226
2233
  expiry: a
2227
2234
  };
2228
2235
  }
2229
- function R(e) {
2230
- let t = N(e.domain), n = P(e.claimer), r = (e.scope ?? "registrable").trim(), i = `${t}|${n}|${e.token}|${r}`;
2231
- return "0x" + o(M(i));
2236
+ function Ae(e) {
2237
+ let t = P(e.domain), n = F(e.claimer), r = (e.scope ?? "registrable").trim();
2238
+ return "0x" + h(N(`${t}|${n}|${e.token}|${r}`));
2232
2239
  }
2233
- function z(e) {
2240
+ function I(e) {
2234
2241
  let t = {
2235
- domain: N(e.domain),
2242
+ domain: P(e.domain),
2236
2243
  creationDate: (e.creationDate ?? "").trim(),
2237
2244
  registrarIanaId: (e.registrarIanaId ?? "").trim()
2238
2245
  };
2239
- return "0x" + o(M(JSON.stringify(t)));
2246
+ return "0x" + h(N(JSON.stringify(t)));
2240
2247
  }
2241
- function B(e) {
2242
- return typeof e == "string" ? k(e) : e && typeof e == "object" && "hex" in e ? k(String(e.hex)) : k(String(e ?? ""));
2248
+ function L(e) {
2249
+ return typeof e == "string" ? A(e) : e && typeof e == "object" && "hex" in e ? A(String(e.hex)) : A(String(e ?? ""));
2243
2250
  }
2244
- function V(e) {
2251
+ function R(e) {
2245
2252
  return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
2246
2253
  }
2247
- function H(e) {
2254
+ function z(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 ? H(e.value) : 0;
2261
+ return e && typeof e == "object" && "value" in e ? z(e.value) : 0;
2255
2262
  }
2256
- function U(e) {
2263
+ function B(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: N(V(n.get("domain")?.value)),
2261
- claimer: P(V(n.get("claimer")?.value)),
2262
- method: V(n.get("method")?.value),
2263
- challengeHash: B(n.get("challengeHash")?.value),
2264
- verifiedAt: H(n.get("verifiedAt")?.value),
2265
- registryCreationDate: V(n.get("registryCreationDate")?.value),
2266
- registryExpirationDate: V(n.get("registryExpirationDate")?.value),
2267
- registryFingerprint: B(n.get("registryFingerprint")?.value),
2268
- scope: V(n.get("scope")?.value)
2267
+ domain: P(R(n.get("domain")?.value)),
2268
+ claimer: F(R(n.get("claimer")?.value)),
2269
+ method: R(n.get("method")?.value),
2270
+ challengeHash: L(n.get("challengeHash")?.value),
2271
+ verifiedAt: z(n.get("verifiedAt")?.value),
2272
+ registryCreationDate: R(n.get("registryCreationDate")?.value),
2273
+ registryExpirationDate: R(n.get("registryExpirationDate")?.value),
2274
+ registryFingerprint: L(n.get("registryFingerprint")?.value),
2275
+ scope: R(n.get("scope")?.value)
2269
2276
  };
2270
2277
  }
2271
- function ue(e) {
2278
+ function je(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 de(e) {
2277
- let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.softStaleMs ?? 31536e6, i = e.expirationTime, a = ue(e.decoded.registryExpirationDate);
2283
+ function Me(e) {
2284
+ let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.softStaleMs ?? 31536e6, i = e.expirationTime, a = je(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 k(z({
2293
+ if (e.registrySnapshot !== void 0) return A(I({
2287
2294
  domain: e.decoded.domain,
2288
2295
  creationDate: e.registrySnapshot.creationDate,
2289
2296
  registrarIanaId: e.registrySnapshot.registrarIanaId
2290
- })) === k(e.decoded.registryFingerprint) ? {
2297
+ })) === A(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 W(e) {
2315
+ function V(e) {
2309
2316
  return e.trim().toLowerCase().replace(/\.$/, "");
2310
2317
  }
2311
- async function fe(t) {
2312
- let { toolAddresses: n, domains: i, claimers: a, schemaUid: o, excludeRevoked: s = !0 } = t;
2318
+ async function Ne(t) {
2319
+ let { toolAddresses: n, domains: r, claimers: i, schemaUid: o, excludeRevoked: s = !0 } = t;
2313
2320
  if (!n.length) return [];
2314
- let l = n.map((e) => {
2321
+ let c = n.map((e) => {
2315
2322
  try {
2316
- return c(e);
2323
+ return _(e);
2317
2324
  } catch {
2318
2325
  return e;
2319
2326
  }
2320
- }), d = { attester: { in: l } };
2321
- o ? d.schemaId = { equals: o } : d.schema = { is: { schemaNames: { some: { name: { equals: A } } } } }, a?.length && (d.recipient = { in: a.map((e) => {
2327
+ }), l = { attester: { in: c } };
2328
+ o ? l.schemaId = { equals: o } : l.schema = { is: { schemaNames: { some: { name: { equals: j } } } } }, i?.length && (l.recipient = { in: i.map((e) => {
2322
2329
  try {
2323
- return c(e);
2330
+ return _(e);
2324
2331
  } catch {
2325
2332
  return e;
2326
2333
  }
2327
- }) }), s && (d = u(d));
2328
- let f = e.getQueryClient(), p = r.getEasClient(), { itemSeeds: m } = await f.fetchQuery({
2334
+ }) }), s && (l = y(l));
2335
+ let u = a.getQueryClient(), d = e.getEasClient(), { itemSeeds: f } = await u.fetchQuery({
2329
2336
  queryKey: [
2330
2337
  "getDomainOwnershipFromEas",
2331
2338
  s,
2332
2339
  o ?? "seedprotocol.domainOwnership",
2333
- [...l].sort(),
2334
- [...(i ?? []).map(W)].sort(),
2335
- [...a ?? []].map((e) => e.toLowerCase()).sort()
2340
+ [...c].sort(),
2341
+ [...(r ?? []).map(V)].sort(),
2342
+ [...i ?? []].map((e) => e.toLowerCase()).sort()
2336
2343
  ],
2337
- queryFn: async () => p.request(h, { where: d })
2344
+ queryFn: async () => d.request(S, { where: l })
2338
2345
  });
2339
- if (!i?.length) return m;
2340
- let g = new Set(i.map(W));
2341
- return m.filter((e) => {
2346
+ if (!r?.length) return f;
2347
+ let p = new Set(r.map(V));
2348
+ return f.filter((e) => {
2342
2349
  try {
2343
- let t = U(e.decodedDataJson ?? "[]");
2344
- return g.has(t.domain);
2350
+ let t = B(e.decodedDataJson ?? "[]");
2351
+ return p.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 pe = "address identity,address sessionKey,address app,string scopes,uint64 grantedAt,uint64 expiresAt,bytes32 permissionsHash", G = "seedprotocol.publishAuthorization", me = "publish,revoke", he = 31536e3;
2353
- function K(e) {
2359
+ var Pe = "address identity,address sessionKey,address app,string scopes,uint64 grantedAt,uint64 expiresAt,bytes32 permissionsHash", H = "seedprotocol.publishAuthorization", Fe = "publish,revoke", Ie = 31536e3;
2360
+ function U(e) {
2354
2361
  let t = e.trim();
2355
2362
  try {
2356
- return c(t).toLowerCase();
2363
+ return _(t).toLowerCase();
2357
2364
  } catch {
2358
2365
  return t.toLowerCase();
2359
2366
  }
2360
2367
  }
2361
- function ge(e) {
2362
- return typeof e == "string" ? k(e) : e && typeof e == "object" && "hex" in e ? k(String(e.hex)) : k(String(e ?? ""));
2368
+ function Le(e) {
2369
+ return typeof e == "string" ? A(e) : e && typeof e == "object" && "hex" in e ? A(String(e.hex)) : A(String(e ?? ""));
2363
2370
  }
2364
- function q(e) {
2371
+ function W(e) {
2365
2372
  return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
2366
2373
  }
2367
- function J(e) {
2374
+ function G(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 ? J(e.value) : 0;
2381
+ return e && typeof e == "object" && "value" in e ? G(e.value) : 0;
2375
2382
  }
2376
- function Y(e) {
2383
+ function K(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: K(q(n.get("identity")?.value)),
2381
- sessionKey: K(q(n.get("sessionKey")?.value)),
2382
- app: K(q(n.get("app")?.value)),
2383
- scopes: q(n.get("scopes")?.value),
2384
- grantedAt: J(n.get("grantedAt")?.value),
2385
- expiresAt: J(n.get("expiresAt")?.value),
2386
- permissionsHash: ge(n.get("permissionsHash")?.value)
2387
+ identity: U(W(n.get("identity")?.value)),
2388
+ sessionKey: U(W(n.get("sessionKey")?.value)),
2389
+ app: U(W(n.get("app")?.value)),
2390
+ scopes: W(n.get("scopes")?.value),
2391
+ grantedAt: G(n.get("grantedAt")?.value),
2392
+ expiresAt: G(n.get("expiresAt")?.value),
2393
+ permissionsHash: Le(n.get("permissionsHash")?.value)
2387
2394
  };
2388
2395
  }
2389
- function X(e) {
2396
+ function Re(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,58 +2409,120 @@ function X(e) {
2402
2409
  warnings: n
2403
2410
  });
2404
2411
  }
2405
- function _e(e) {
2406
- return "0x" + o(new TextEncoder().encode(e));
2412
+ function ze(e) {
2413
+ return "0x" + h(new TextEncoder().encode(e));
2407
2414
  }
2408
2415
  //#endregion
2409
2416
  //#region src/publishAuthorization.ts
2410
- async function ve(t = {}) {
2411
- let { identities: n, sessionKeys: i, apps: a, schemaUid: o, excludeRevoked: s = !0 } = t, l = {};
2412
- o ? l.schemaId = { equals: o } : l.schema = { is: { schemaNames: { some: { name: { equals: G } } } } }, n?.length && (l.attester = { in: n.map((e) => {
2417
+ async function Be(t = {}) {
2418
+ let { identities: n, sessionKeys: r, apps: i, schemaUid: o, excludeRevoked: s = !0 } = t, c = {};
2419
+ o ? c.schemaId = { equals: o } : c.schema = { is: { schemaNames: { some: { name: { equals: H } } } } }, n?.length && (c.attester = { in: n.map((e) => {
2413
2420
  try {
2414
- return c(e);
2421
+ return _(e);
2415
2422
  } catch {
2416
2423
  return e;
2417
2424
  }
2418
- }) }), i?.length && (l.recipient = { in: i.map((e) => {
2425
+ }) }), r?.length && (c.recipient = { in: r.map((e) => {
2419
2426
  try {
2420
- return c(e);
2427
+ return _(e);
2421
2428
  } catch {
2422
2429
  return e;
2423
2430
  }
2424
- }) }), s && (l = u(l));
2425
- let d = e.getQueryClient(), f = r.getEasClient(), { itemSeeds: p } = await d.fetchQuery({
2431
+ }) }), s && (c = y(c));
2432
+ let l = a.getQueryClient(), u = e.getEasClient(), { itemSeeds: d } = await l.fetchQuery({
2426
2433
  queryKey: [
2427
2434
  "getPublishAuthorizationFromEas",
2428
2435
  s,
2429
2436
  o ?? "seedprotocol.publishAuthorization",
2430
2437
  [...n ?? []].map((e) => e.toLowerCase()).sort(),
2431
- [...i ?? []].map((e) => e.toLowerCase()).sort(),
2432
- [...a ?? []].map((e) => e.toLowerCase()).sort()
2438
+ [...r ?? []].map((e) => e.toLowerCase()).sort(),
2439
+ [...i ?? []].map((e) => e.toLowerCase()).sort()
2433
2440
  ],
2434
- queryFn: async () => f.request(h, { where: l })
2441
+ queryFn: async () => u.request(S, { where: c })
2435
2442
  });
2436
- if (!a?.length) return p;
2437
- let m = new Set(a.map((e) => e.toLowerCase()));
2438
- return p.filter((e) => {
2443
+ if (!i?.length) return d;
2444
+ let f = new Set(i.map((e) => e.toLowerCase()));
2445
+ return d.filter((e) => {
2439
2446
  try {
2440
- let t = Y(e.decodedDataJson ?? "[]");
2441
- return m.has(t.app.toLowerCase());
2447
+ let t = K(e.decodedDataJson ?? "[]");
2448
+ return f.has(t.app.toLowerCase());
2442
2449
  } catch {
2443
2450
  return !1;
2444
2451
  }
2445
2452
  });
2446
2453
  }
2447
2454
  //#endregion
2455
+ //#region src/publishedByHelpers.ts
2456
+ var Ve = "bytes32 seedUid,bytes32 versionUid,bytes32[] attestationUids,bytes32 batchHash,string toolName,string toolVersion", q = "seedprotocol.publishedBy";
2457
+ function He(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 J(e) {
2463
+ let t = [...e].map((e) => A(e)).filter((e) => e !== "" && k(e)).sort();
2464
+ if (t.length === 0) return "0x" + h(/* @__PURE__ */ new Uint8Array());
2465
+ let n = new Uint8Array(t.length * 32);
2466
+ for (let e = 0; e < t.length; e++) n.set(He(t[e]), e * 32);
2467
+ return "0x" + h(n);
2468
+ }
2469
+ function Ue(e) {
2470
+ return A(J(e.attestationUids)) === A(e.batchHash);
2471
+ }
2472
+ function Y(e) {
2473
+ return typeof e == "string" ? A(e) : e && typeof e == "object" && "hex" in e ? A(String(e.hex)) : A(String(e ?? ""));
2474
+ }
2475
+ function X(e) {
2476
+ return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
2477
+ }
2478
+ function We(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) => Y(e)) : r && typeof r == "object" && Array.isArray(r.value) && (i = r.value.map((e) => Y(e))), {
2483
+ seedUid: Y(n.get("seedUid")?.value),
2484
+ versionUid: Y(n.get("versionUid")?.value),
2485
+ attestationUids: i,
2486
+ batchHash: Y(n.get("batchHash")?.value),
2487
+ toolName: X(n.get("toolName")?.value),
2488
+ toolVersion: X(n.get("toolVersion")?.value)
2489
+ };
2490
+ }
2491
+ //#endregion
2492
+ //#region src/publishedBy.ts
2493
+ async function Ge(t) {
2494
+ let { toolAddresses: n, refUIDs: r, schemaUid: i, excludeRevoked: o = !0 } = t;
2495
+ if (!n.length) return [];
2496
+ let s = n.map((e) => {
2497
+ try {
2498
+ return _(e);
2499
+ } catch {
2500
+ return e;
2501
+ }
2502
+ }), c = { attester: { in: s } };
2503
+ i ? c.schemaId = { equals: i } : c.schema = { is: { schemaNames: { some: { name: { equals: q } } } } }, r?.length && (c.refUID = { in: r }), o && (c = y(c));
2504
+ let l = a.getQueryClient(), u = e.getEasClient(), { itemSeeds: d } = await l.fetchQuery({
2505
+ queryKey: [
2506
+ "getPublishedByFromEas",
2507
+ o,
2508
+ i ?? "seedprotocol.publishedBy",
2509
+ [...s].sort(),
2510
+ [...r ?? []].sort()
2511
+ ],
2512
+ queryFn: async () => u.request(S, { where: c })
2513
+ });
2514
+ return d;
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(s(e), t);
2451
- }, ye = ({ modelName: e, schemaUid: t }) => {
2519
+ Z.set(g(e), t);
2520
+ }, Ke = ({ modelName: e, schemaUid: t }) => {
2452
2521
  Q.set(e.toLowerCase(), t);
2453
- }, be = (e) => Q.get(e.toLowerCase()), xe = async ({ schemaText: e }) => {
2454
- let t = s(e);
2522
+ }, qe = (e) => Q.get(e.toLowerCase()), Je = async ({ schemaText: e }) => {
2523
+ let t = g(e);
2455
2524
  if (!Z.has(t)) {
2456
- let e = await C({ schemaName: t });
2525
+ let e = await E({ 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, se as DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS, le as DOMAIN_OWNERSHIP_DEFAULT_EXPIRATION_SECS, ae as DOMAIN_OWNERSHIP_METHOD, ie as DOMAIN_OWNERSHIP_SCHEMA_DEF, A as DOMAIN_OWNERSHIP_SCHEMA_NAME, oe as DOMAIN_OWNERSHIP_SCOPE_REGISTRABLE, ce as DOMAIN_OWNERSHIP_SOFT_STALE_MS, j as DOMAIN_OWNERSHIP_TXT_LABEL, a as EAS_ENDPOINT, te as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, y as GET_FILES_METADATA, b as GET_IMAGE_SEEDS, x as GET_IMAGE_VERSIONS, v as GET_PROPERTIES, p as GET_SCHEMAS, m as GET_SCHEMA_BY_NAME, h as GET_SEEDS, g as GET_SEED_IDS, ee as GET_STORAGE_TRANSACTION_ID, _ as GET_VERSIONS, he as PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS, pe as PUBLISH_AUTHORIZATION_SCHEMA_DEF, G as PUBLISH_AUTHORIZATION_SCHEMA_NAME, me as PUBLISH_AUTHORIZATION_SCOPES, n as ZERO_ADDRESS, i as ZERO_BYTES, t as ZERO_BYTES32, de as assessDomainOwnership, X as assessPublishAuthorization, I as buildDomainOwnershipTxtValue, c as checksumAddress, U as decodeDomainOwnershipData, Y as decodePublishAuthorizationData, F as domainOwnershipTxtName, re as getCanonicalItemPropertiesFromEas, fe as getDomainOwnershipFromEas, C as getEasSchemaUidBySchemaName, xe as getEasSchemaUidForSchemaDefinition, S as getItemPropertiesFromEas, ne as getItemVersionsFromEas, ve as getPublishAuthorizationFromEas, be as getSchemaUidForModelFromCache, E as getSeedUidsBySchemaName, T as getSeedsBySchemaName, w as getSeedsFromSchemaUids, R as hashDomainOwnershipChallenge, z as hashDomainRegistryFingerprint, _e as hashPublishAuthorizationMaterial, D as isPlaceholderUid, O as isValidEasAttestationUid, k as normalizeBytes32Hex, L as parseDomainOwnershipTxtValue, l as pickLatestPropertyAttestationsByRefAndSchema, ye as setSchemaUidForModel, $ as setSchemaUidForSchemaDefinition, s as toSnakeCase, u as withExcludeRevokedFilter };
2534
+ export { e as BaseEasClient, e as EasClient, a as BaseQueryClient, c as DEFAULT_EAS_CHAIN_ID, we as DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS, Ee as DOMAIN_OWNERSHIP_DEFAULT_EXPIRATION_SECS, Se as DOMAIN_OWNERSHIP_METHOD, xe as DOMAIN_OWNERSHIP_SCHEMA_DEF, j as DOMAIN_OWNERSHIP_SCHEMA_NAME, Ce as DOMAIN_OWNERSHIP_SCOPE_REGISTRABLE, Te as DOMAIN_OWNERSHIP_SOFT_STALE_MS, M as DOMAIN_OWNERSHIP_TXT_LABEL, te as EAS_CHAIN_DEPLOYMENTS, be as EAS_ENDPOINT, le as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, ue as GET_FILES_METADATA, de as GET_IMAGE_SEEDS, fe as GET_IMAGE_VERSIONS, w as GET_PROPERTIES, x as GET_SCHEMAS, oe as GET_SCHEMA_BY_NAME, S as GET_SEEDS, se as GET_SEED_IDS, ce as GET_STORAGE_TRANSACTION_ID, C as GET_VERSIONS, r as OP_STACK_EAS_CONTRACT_ADDRESS, i as OP_STACK_SCHEMA_REGISTRY_ADDRESS, Ve as PUBLISHED_BY_SCHEMA_DEF, q as PUBLISHED_BY_SCHEMA_NAME, Ie as PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS, Pe as PUBLISH_AUTHORIZATION_SCHEMA_DEF, H as PUBLISH_AUTHORIZATION_SCHEMA_NAME, Fe as PUBLISH_AUTHORIZATION_SCOPES, _e as ZERO_ADDRESS, ve as ZERO_BYTES, ye as ZERO_BYTES32, Me as assessDomainOwnership, Re as assessPublishAuthorization, Oe as buildDomainOwnershipTxtValue, _ as checksumAddress, m as configureEasReadChain, B as decodeDomainOwnershipData, K as decodePublishAuthorizationData, We as decodePublishedByData, De as domainOwnershipTxtName, u as expectEasReadChain, me as getCanonicalItemPropertiesFromEas, Ne as getDomainOwnershipFromEas, f as getEasAttestationExplorerUrl, l as getEasChainDeployment, p as getEasEndpoint, s as getEasReadChainId, E as getEasSchemaUidBySchemaName, Je as getEasSchemaUidForSchemaDefinition, T as getItemPropertiesFromEas, pe as getItemVersionsFromEas, Be as getPublishAuthorizationFromEas, Ge as getPublishedByFromEas, qe as getSchemaUidForModelFromCache, ge as getSeedUidsBySchemaName, D as getSeedsBySchemaName, he as getSeedsFromSchemaUids, Ae as hashDomainOwnershipChallenge, I as hashDomainRegistryFingerprint, ze as hashPublishAuthorizationMaterial, J as hashPublishedByBatch, t as isEasReadChainConfigured, d as isEasReadChainSettled, O as isPlaceholderUid, k as isValidEasAttestationUid, A as normalizeBytes32Hex, ke as parseDomainOwnershipTxtValue, v as pickLatestPropertyAttestationsByRefAndSchema, ee as resetEasReadChain, o as resolveEasChainDeployment, Ke as setSchemaUidForModel, $ as setSchemaUidForSchemaDefinition, g as toSnakeCase, Ue as verifyPublishedByBatch, n as whenEasReadChainSettled, y as withExcludeRevokedFilter };
2466
2535
 
2467
2536
  //# sourceMappingURL=index.js.map