@seedprotocol/eas 0.6.7 → 0.6.9

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,25 +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 { keccak_256 as o } from "@noble/hashes/sha3";
3
- import { bytesToHex as s, utf8ToBytes as c } from "@noble/hashes/utils";
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";
4
4
  import "graphql";
5
5
  //#region src/keccak.ts
6
- function l(e) {
7
- let t = typeof e == "string" ? c(e) : e;
8
- return s(o(t));
6
+ function h(e) {
7
+ let t = typeof e == "string" ? ie(e) : e;
8
+ return re(ne(t));
9
9
  }
10
10
  //#endregion
11
11
  //#region src/utils.ts
12
- var u = (e) => e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
13
- function d(e) {
12
+ var g = (e) => e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
13
+ function _(e) {
14
14
  let t = e.toLowerCase().replace(/^0x/, "");
15
15
  if (t.length !== 40 || !/^[0-9a-f]+$/.test(t)) return e;
16
- let n = l(t), r = "0x";
16
+ let n = h(t), r = "0x";
17
17
  for (let e = 0; e < 40; e++) r += parseInt(n[e], 16) >= 8 ? t[e].toUpperCase() : t[e];
18
18
  return r;
19
19
  }
20
20
  //#endregion
21
21
  //#region src/easPropertyCanonical.ts
22
- function f(e) {
22
+ function v(e) {
23
23
  let t = /* @__PURE__ */ new Map();
24
24
  for (let n of e) {
25
25
  let e = n.schemaId;
@@ -31,7 +31,7 @@ function f(e) {
31
31
  }
32
32
  //#endregion
33
33
  //#region src/easRevokedFilter.ts
34
- function p(e) {
34
+ function y(e) {
35
35
  let t = { revoked: { equals: !1 } }, n = Array.isArray(e.AND) ? e.AND : [];
36
36
  return {
37
37
  ...e,
@@ -40,7 +40,7 @@ function p(e) {
40
40
  }
41
41
  //#endregion
42
42
  //#region src/graphql/gql/gql.ts
43
- var m = {
43
+ var ae = {
44
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": {
45
45
  kind: "Document",
46
46
  definitions: [{
@@ -2099,126 +2099,126 @@ var m = {
2099
2099
  }]
2100
2100
  }
2101
2101
  };
2102
- function h(e) {
2103
- return m[e] ?? {};
2102
+ function b(e) {
2103
+ return ae[e] ?? {};
2104
2104
  }
2105
2105
  //#endregion
2106
2106
  //#region src/queries.ts
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({
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({
2109
2109
  queryKey: [
2110
2110
  "getVersionsForAllModels",
2111
2111
  [...t].sort(),
2112
2112
  n
2113
2113
  ],
2114
- queryFn: async () => a.request(y, { where: o })
2114
+ queryFn: async () => i.request(C, { where: o })
2115
2115
  });
2116
2116
  return s;
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({
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({
2119
2119
  queryKey: [
2120
2120
  "getPropertiesForAllModels",
2121
2121
  [...t].sort(),
2122
2122
  n
2123
2123
  ],
2124
- queryFn: async () => a.request(b, { where: o })
2124
+ queryFn: async () => i.request(w, { where: o })
2125
2125
  });
2126
2126
  return s;
2127
- }, se = async (e) => f(await x(e)), S = async ({ schemaName: t }) => {
2127
+ }, me = async (e) => v(await T(e)), E = async ({ schemaName: t }) => {
2128
2128
  try {
2129
- let n = e.getQueryClient(), i = r.getEasClient();
2130
- if (!n || !i) return;
2131
- 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({
2132
2132
  queryKey: ["getEasSchemaUidBySchemaName"],
2133
- queryFn: async () => i.request(g, { where: { schema: { endsWith: t } } })
2133
+ queryFn: async () => r.request(x, { where: { schema: { endsWith: t } } })
2134
2134
  });
2135
- return !a || a.length === 0 ? void 0 : a[0].id;
2135
+ return !i || i.length === 0 ? void 0 : i[0].id;
2136
2136
  } catch (e) {
2137
2137
  process.env.NODE_ENV === "development" && console.warn(`Failed to fetch schema for schema name ${t}:`, e);
2138
2138
  return;
2139
2139
  }
2140
- }, C = async ({ schemaUids: t, addresses: n, excludeRevoked: i = !0 }) => {
2141
- let a = {
2140
+ }, he = async ({ schemaUids: t, addresses: n, excludeRevoked: r = !0 }) => {
2141
+ let i = {
2142
2142
  attester: { in: n.map((e) => {
2143
2143
  try {
2144
- return d(e);
2144
+ return _(e);
2145
2145
  } catch {
2146
2146
  return e;
2147
2147
  }
2148
2148
  }) },
2149
2149
  schemaId: { in: t }
2150
2150
  };
2151
- i && (a = p(a));
2152
- let o = e.getQueryClient(), s = r.getEasClient(), { itemSeeds: c } = await o.fetchQuery({
2151
+ r && (i = y(i));
2152
+ let o = a.getQueryClient(), s = e.getEasClient(), { itemSeeds: c } = await o.fetchQuery({
2153
2153
  queryKey: [
2154
2154
  "getSeedsForAllModels",
2155
- i,
2155
+ r,
2156
2156
  [...t].sort(),
2157
2157
  [...n].sort()
2158
2158
  ],
2159
- queryFn: async () => s.request(_, { where: a })
2159
+ queryFn: async () => s.request(S, { where: i })
2160
2160
  });
2161
2161
  return c;
2162
- }, w = async (t, n = 10, i) => {
2163
- let a = i ?? 0, o = {
2164
- where: p({ schema: { is: { schemaNames: { some: { name: { equals: t } } } } } }),
2162
+ }, D = async (t, n = 10, r) => {
2163
+ let i = r ?? 0, o = {
2164
+ where: y({ schema: { is: { schemaNames: { some: { name: { equals: t } } } } } }),
2165
2165
  take: n,
2166
- skip: a
2167
- }, 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({
2168
2168
  queryKey: [
2169
2169
  "getSeedsBySchemaName",
2170
2170
  t,
2171
2171
  n,
2172
- a
2172
+ i
2173
2173
  ],
2174
- queryFn: async () => c.request(_, o)
2174
+ queryFn: async () => c.request(S, o)
2175
2175
  });
2176
2176
  return l;
2177
- }, T = async (e, t = 10) => (await w(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";
2178
2178
  //#endregion
2179
2179
  //#region src/easUid.ts
2180
- function E(e) {
2180
+ function O(e) {
2181
2181
  if (e == null || e === "" || e === "NULL") return !0;
2182
2182
  let t = e.trim();
2183
2183
  return t === "" || t.toLowerCase() === "0x0000000000000000000000000000000000000000000000000000000000000000";
2184
2184
  }
2185
- function D(e) {
2186
- if (E(e)) return !1;
2185
+ function k(e) {
2186
+ if (O(e)) return !1;
2187
2187
  let t = String(e).trim();
2188
2188
  if (!/^0x/i.test(t)) return !1;
2189
2189
  let n = t.slice(2);
2190
2190
  return n.length === 64 && /^[0-9a-fA-F]{64}$/.test(n);
2191
2191
  }
2192
- function O(e) {
2192
+ function A(e) {
2193
2193
  if (e == null || e === "") return "";
2194
2194
  let t = String(e).trim();
2195
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();
2196
2196
  }
2197
2197
  //#endregion
2198
2198
  //#region src/domainOwnershipHelpers.ts
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) {
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) {
2201
2201
  return new TextEncoder().encode(e);
2202
2202
  }
2203
- function M(e) {
2203
+ function P(e) {
2204
2204
  return e.trim().toLowerCase().replace(/\.$/, "");
2205
2205
  }
2206
- function N(e) {
2206
+ function F(e) {
2207
2207
  let t = e.trim();
2208
2208
  try {
2209
- return d(t).toLowerCase();
2209
+ return _(t).toLowerCase();
2210
2210
  } catch {
2211
2211
  return t.toLowerCase();
2212
2212
  }
2213
2213
  }
2214
- function me(e) {
2215
- return `${A}.${M(e)}`;
2214
+ function De(e) {
2215
+ return `${M}.${P(e)}`;
2216
2216
  }
2217
- function he(e) {
2218
- let t = N(e.claimer);
2217
+ function Oe(e) {
2218
+ let t = F(e.claimer);
2219
2219
  return `token=${e.token},addr=${t},expiry=${e.expiry}`;
2220
2220
  }
2221
- function ge(e) {
2221
+ function ke(e) {
2222
2222
  let t = e.replace(/^"+|"+$/g, "").trim(), n = /* @__PURE__ */ new Map();
2223
2223
  for (let e of t.split(",")) {
2224
2224
  let t = e.indexOf("=");
@@ -2229,59 +2229,59 @@ function ge(e) {
2229
2229
  let r = n.get("token"), i = n.get("addr") ?? n.get("claimer"), a = n.get("expiry");
2230
2230
  return !r || !i || !a ? null : {
2231
2231
  token: r,
2232
- claimer: N(i),
2232
+ claimer: F(i),
2233
2233
  expiry: a
2234
2234
  };
2235
2235
  }
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}`));
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}`));
2239
2239
  }
2240
- function F(e) {
2240
+ function I(e) {
2241
2241
  let t = {
2242
- domain: M(e.domain),
2242
+ domain: P(e.domain),
2243
2243
  creationDate: (e.creationDate ?? "").trim(),
2244
2244
  registrarIanaId: (e.registrarIanaId ?? "").trim()
2245
2245
  };
2246
- return "0x" + l(j(JSON.stringify(t)));
2247
- }
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 ?? ""));
2246
+ return "0x" + h(N(JSON.stringify(t)));
2250
2247
  }
2251
2248
  function L(e) {
2252
- return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
2249
+ return typeof e == "string" ? A(e) : e && typeof e == "object" && "hex" in e ? A(String(e.hex)) : A(String(e ?? ""));
2253
2250
  }
2254
2251
  function R(e) {
2252
+ return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
2253
+ }
2254
+ function z(e) {
2255
2255
  if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
2256
2256
  if (typeof e == "bigint") return Number(e);
2257
2257
  if (typeof e == "string" && e.trim() !== "") {
2258
2258
  let t = Number(e);
2259
2259
  return Number.isFinite(t) ? Math.trunc(t) : 0;
2260
2260
  }
2261
- return e && typeof e == "object" && "value" in e ? R(e.value) : 0;
2261
+ return e && typeof e == "object" && "value" in e ? z(e.value) : 0;
2262
2262
  }
2263
- function z(e) {
2263
+ function B(e) {
2264
2264
  let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
2265
2265
  for (let e of t) e?.name && n.set(e.name, e);
2266
2266
  return {
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)
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)
2276
2276
  };
2277
2277
  }
2278
- function _e(e) {
2278
+ function je(e) {
2279
2279
  if (!e?.trim()) return null;
2280
2280
  let t = Date.parse(e);
2281
2281
  return Number.isFinite(t) ? Math.floor(t / 1e3) : null;
2282
2282
  }
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);
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);
2285
2285
  if (typeof i == "number" && i > 0 && t >= i || a != null && t >= a) return {
2286
2286
  status: "expired",
2287
2287
  warnings: n
@@ -2290,11 +2290,11 @@ function ve(e) {
2290
2290
  status: "unknown",
2291
2291
  warnings: n
2292
2292
  };
2293
- if (e.registrySnapshot !== void 0) return O(F({
2293
+ if (e.registrySnapshot !== void 0) return A(I({
2294
2294
  domain: e.decoded.domain,
2295
2295
  creationDate: e.registrySnapshot.creationDate,
2296
2296
  registrarIanaId: e.registrySnapshot.registrarIanaId
2297
- })) === O(e.decoded.registryFingerprint) ? {
2297
+ })) === A(e.decoded.registryFingerprint) ? {
2298
2298
  status: "valid",
2299
2299
  warnings: n
2300
2300
  } : (n.push("Registry creation date or registrar IANA id no longer matches attestation fingerprint"), {
@@ -2312,43 +2312,43 @@ function ve(e) {
2312
2312
  }
2313
2313
  //#endregion
2314
2314
  //#region src/domainOwnership.ts
2315
- function B(e) {
2315
+ function V(e) {
2316
2316
  return e.trim().toLowerCase().replace(/\.$/, "");
2317
2317
  }
2318
- async function ye(t) {
2319
- 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;
2320
2320
  if (!n.length) return [];
2321
2321
  let c = n.map((e) => {
2322
2322
  try {
2323
- return d(e);
2323
+ return _(e);
2324
2324
  } catch {
2325
2325
  return e;
2326
2326
  }
2327
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) => {
2328
+ o ? l.schemaId = { equals: o } : l.schema = { is: { schemaNames: { some: { name: { equals: j } } } } }, i?.length && (l.recipient = { in: i.map((e) => {
2329
2329
  try {
2330
- return d(e);
2330
+ return _(e);
2331
2331
  } catch {
2332
2332
  return e;
2333
2333
  }
2334
- }) }), s && (l = p(l));
2335
- let u = e.getQueryClient(), f = r.getEasClient(), { itemSeeds: m } = await u.fetchQuery({
2334
+ }) }), s && (l = y(l));
2335
+ let u = a.getQueryClient(), d = e.getEasClient(), { itemSeeds: f } = await u.fetchQuery({
2336
2336
  queryKey: [
2337
2337
  "getDomainOwnershipFromEas",
2338
2338
  s,
2339
2339
  o ?? "seedprotocol.domainOwnership",
2340
2340
  [...c].sort(),
2341
- [...(i ?? []).map(B)].sort(),
2342
- [...a ?? []].map((e) => e.toLowerCase()).sort()
2341
+ [...(r ?? []).map(V)].sort(),
2342
+ [...i ?? []].map((e) => e.toLowerCase()).sort()
2343
2343
  ],
2344
- queryFn: async () => f.request(_, { where: l })
2344
+ queryFn: async () => d.request(S, { where: l })
2345
2345
  });
2346
- if (!i?.length) return m;
2347
- let h = new Set(i.map(B));
2348
- return m.filter((e) => {
2346
+ if (!r?.length) return f;
2347
+ let p = new Set(r.map(V));
2348
+ return f.filter((e) => {
2349
2349
  try {
2350
- let t = z(e.decodedDataJson ?? "[]");
2351
- return h.has(t.domain);
2350
+ let t = B(e.decodedDataJson ?? "[]");
2351
+ return p.has(t.domain);
2352
2352
  } catch {
2353
2353
  return !1;
2354
2354
  }
@@ -2356,44 +2356,44 @@ async function ye(t) {
2356
2356
  }
2357
2357
  //#endregion
2358
2358
  //#region src/publishAuthorizationHelpers.ts
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) {
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) {
2361
2361
  let t = e.trim();
2362
2362
  try {
2363
- return d(t).toLowerCase();
2363
+ return _(t).toLowerCase();
2364
2364
  } catch {
2365
2365
  return t.toLowerCase();
2366
2366
  }
2367
2367
  }
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 ?? ""));
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 ?? ""));
2370
2370
  }
2371
- function U(e) {
2371
+ function W(e) {
2372
2372
  return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
2373
2373
  }
2374
- function W(e) {
2374
+ function G(e) {
2375
2375
  if (typeof e == "number" && Number.isFinite(e)) return Math.trunc(e);
2376
2376
  if (typeof e == "bigint") return Number(e);
2377
2377
  if (typeof e == "string" && e.trim() !== "") {
2378
2378
  let t = Number(e);
2379
2379
  return Number.isFinite(t) ? Math.trunc(t) : 0;
2380
2380
  }
2381
- return e && typeof e == "object" && "value" in e ? W(e.value) : 0;
2381
+ return e && typeof e == "object" && "value" in e ? G(e.value) : 0;
2382
2382
  }
2383
- function G(e) {
2383
+ function K(e) {
2384
2384
  let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
2385
2385
  for (let e of t) e?.name && n.set(e.name, e);
2386
2386
  return {
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
+ 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)
2394
2394
  };
2395
2395
  }
2396
- function we(e) {
2396
+ function Re(e) {
2397
2397
  let t = Math.floor((e.now ?? Date.now()) / 1e3), n = [], r = e.expectedScopes ?? "publish,revoke", i = e.expirationTime, a = e.decoded.expiresAt;
2398
2398
  return typeof i == "number" && i > 0 && t >= i || a > 0 && t >= a ? {
2399
2399
  status: "expired",
@@ -2409,43 +2409,43 @@ function we(e) {
2409
2409
  warnings: n
2410
2410
  });
2411
2411
  }
2412
- function Te(e) {
2413
- return "0x" + l(new TextEncoder().encode(e));
2412
+ function ze(e) {
2413
+ return "0x" + h(new TextEncoder().encode(e));
2414
2414
  }
2415
2415
  //#endregion
2416
2416
  //#region src/publishAuthorization.ts
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) => {
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) => {
2420
2420
  try {
2421
- return d(e);
2421
+ return _(e);
2422
2422
  } catch {
2423
2423
  return e;
2424
2424
  }
2425
- }) }), i?.length && (c.recipient = { in: i.map((e) => {
2425
+ }) }), r?.length && (c.recipient = { in: r.map((e) => {
2426
2426
  try {
2427
- return d(e);
2427
+ return _(e);
2428
2428
  } catch {
2429
2429
  return e;
2430
2430
  }
2431
- }) }), s && (c = p(c));
2432
- let l = e.getQueryClient(), u = r.getEasClient(), { itemSeeds: f } = await l.fetchQuery({
2431
+ }) }), s && (c = y(c));
2432
+ let l = a.getQueryClient(), u = e.getEasClient(), { itemSeeds: d } = await l.fetchQuery({
2433
2433
  queryKey: [
2434
2434
  "getPublishAuthorizationFromEas",
2435
2435
  s,
2436
2436
  o ?? "seedprotocol.publishAuthorization",
2437
2437
  [...n ?? []].map((e) => e.toLowerCase()).sort(),
2438
- [...i ?? []].map((e) => e.toLowerCase()).sort(),
2439
- [...a ?? []].map((e) => e.toLowerCase()).sort()
2438
+ [...r ?? []].map((e) => e.toLowerCase()).sort(),
2439
+ [...i ?? []].map((e) => e.toLowerCase()).sort()
2440
2440
  ],
2441
- queryFn: async () => u.request(_, { where: c })
2441
+ queryFn: async () => u.request(S, { where: c })
2442
2442
  });
2443
- if (!a?.length) return f;
2444
- let m = new Set(a.map((e) => e.toLowerCase()));
2445
- return f.filter((e) => {
2443
+ if (!i?.length) return d;
2444
+ let f = new Set(i.map((e) => e.toLowerCase()));
2445
+ return d.filter((e) => {
2446
2446
  try {
2447
- let t = G(e.decodedDataJson ?? "[]");
2448
- return m.has(t.app.toLowerCase());
2447
+ let t = K(e.decodedDataJson ?? "[]");
2448
+ return f.has(t.app.toLowerCase());
2449
2449
  } catch {
2450
2450
  return !1;
2451
2451
  }
@@ -2453,76 +2453,76 @@ async function Ee(t = {}) {
2453
2453
  }
2454
2454
  //#endregion
2455
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) {
2456
+ var Ve = "bytes32 seedUid,bytes32 versionUid,bytes32[] attestationUids,bytes32 batchHash,string toolName,string toolVersion", q = "seedprotocol.publishedBy";
2457
+ function He(e) {
2458
2458
  let t = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, n = new Uint8Array(t.length / 2);
2459
2459
  for (let e = 0; e < n.length; e++) n[e] = parseInt(t.slice(e * 2, e * 2 + 2), 16);
2460
2460
  return n;
2461
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());
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
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);
2466
+ for (let e = 0; e < t.length; e++) n.set(He(t[e]), e * 32);
2467
+ return "0x" + h(n);
2468
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 ?? ""));
2469
+ function Ue(e) {
2470
+ return A(J(e.attestationUids)) === A(e.batchHash);
2474
2471
  }
2475
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
2476
  return typeof e == "string" ? e : e && typeof e == "object" && "value" in e ? String(e.value ?? "") : String(e ?? "");
2477
2477
  }
2478
- function Ae(e) {
2478
+ function We(e) {
2479
2479
  let t = typeof e == "string" ? JSON.parse(e) : e, n = /* @__PURE__ */ new Map();
2480
2480
  for (let e of t) e?.name && n.set(e.name, e);
2481
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),
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
2485
  attestationUids: i,
2486
- batchHash: J(n.get("batchHash")?.value),
2487
- toolName: Y(n.get("toolName")?.value),
2488
- toolVersion: Y(n.get("toolVersion")?.value)
2486
+ batchHash: Y(n.get("batchHash")?.value),
2487
+ toolName: X(n.get("toolName")?.value),
2488
+ toolVersion: X(n.get("toolVersion")?.value)
2489
2489
  };
2490
2490
  }
2491
2491
  //#endregion
2492
2492
  //#region src/publishedBy.ts
2493
- async function X(t) {
2494
- let { toolAddresses: n, refUIDs: i, schemaUid: a, excludeRevoked: o = !0 } = t;
2493
+ async function Ge(t) {
2494
+ let { toolAddresses: n, refUIDs: r, schemaUid: i, excludeRevoked: o = !0 } = t;
2495
2495
  if (!n.length) return [];
2496
2496
  let s = n.map((e) => {
2497
2497
  try {
2498
- return d(e);
2498
+ return _(e);
2499
2499
  } catch {
2500
2500
  return e;
2501
2501
  }
2502
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({
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
2505
  queryKey: [
2506
2506
  "getPublishedByFromEas",
2507
2507
  o,
2508
- a ?? "seedprotocol.publishedBy",
2508
+ i ?? "seedprotocol.publishedBy",
2509
2509
  [...s].sort(),
2510
- [...i ?? []].sort()
2510
+ [...r ?? []].sort()
2511
2511
  ],
2512
- queryFn: async () => u.request(_, { where: c })
2512
+ queryFn: async () => u.request(S, { where: c })
2513
2513
  });
2514
- return f;
2514
+ return d;
2515
2515
  }
2516
2516
  //#endregion
2517
2517
  //#region src/stores/schemaUidCache.ts
2518
2518
  var Z = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map(), $ = ({ text: e, schemaUid: t }) => {
2519
- Z.set(u(e), t);
2520
- }, je = ({ modelName: e, schemaUid: t }) => {
2519
+ Z.set(g(e), t);
2520
+ }, Ke = ({ modelName: e, schemaUid: t }) => {
2521
2521
  Q.set(e.toLowerCase(), t);
2522
- }, Me = (e) => Q.get(e.toLowerCase()), Ne = async ({ schemaText: e }) => {
2523
- let t = u(e);
2522
+ }, qe = (e) => Q.get(e.toLowerCase()), Je = async ({ schemaText: e }) => {
2523
+ let t = g(e);
2524
2524
  if (!Z.has(t)) {
2525
- let e = await S({ schemaName: t });
2525
+ let e = await E({ schemaName: t });
2526
2526
  return e && $({
2527
2527
  text: t,
2528
2528
  schemaUid: e
@@ -2531,6 +2531,6 @@ var Z = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map(), $ = ({ text: e
2531
2531
  return Z.get(t);
2532
2532
  };
2533
2533
  //#endregion
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 };
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 };
2535
2535
 
2536
2536
  //# sourceMappingURL=index.js.map