@ensnode/ensnode-sdk 1.15.2 → 1.17.0

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/internal.js CHANGED
@@ -509,10 +509,10 @@ function getHighestKnownBlockTimestamp(chains) {
509
509
  "Invariant violation: at least one chain is required to determine the highest known block timestamp"
510
510
  );
511
511
  }
512
- const startBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
513
- const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.rangeType === RangeTypeIds.Bounded).map((chainConfig) => chainConfig.endBlock.timestamp);
514
- const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
515
- const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
512
+ const startBlockTimestamps = chains.map((chain2) => chain2.config.startBlock.timestamp);
513
+ const endBlockTimestamps = chains.map((chain2) => chain2.config).filter((chainConfig) => chainConfig.rangeType === RangeTypeIds.Bounded).map((chainConfig) => chainConfig.endBlock.timestamp);
514
+ const backfillEndBlockTimestamps = chains.filter((chain2) => chain2.chainStatus === ChainIndexingStatusIds.Backfill).map((chain2) => chain2.backfillEndBlock.timestamp);
515
+ const latestKnownBlockTimestamps = chains.filter((chain2) => chain2.chainStatus === ChainIndexingStatusIds.Following).map((chain2) => chain2.latestKnownBlock.timestamp);
516
516
  return Math.max(
517
517
  ...startBlockTimestamps,
518
518
  ...endBlockTimestamps,
@@ -552,26 +552,26 @@ var OmnichainIndexingStatusIds = {
552
552
  Completed: "omnichain-completed"
553
553
  };
554
554
  function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted(chains) {
555
- return chains.every((chain) => chain.chainStatus === ChainIndexingStatusIds.Queued);
555
+ return chains.every((chain2) => chain2.chainStatus === ChainIndexingStatusIds.Queued);
556
556
  }
557
557
  function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotBackfill(chains) {
558
558
  const atLeastOneChainInTargetStatus = chains.some(
559
- (chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill
559
+ (chain2) => chain2.chainStatus === ChainIndexingStatusIds.Backfill
560
560
  );
561
561
  const otherChainsHaveValidStatuses = chains.every(
562
- (chain) => chain.chainStatus === ChainIndexingStatusIds.Queued || chain.chainStatus === ChainIndexingStatusIds.Backfill || chain.chainStatus === ChainIndexingStatusIds.Completed
562
+ (chain2) => chain2.chainStatus === ChainIndexingStatusIds.Queued || chain2.chainStatus === ChainIndexingStatusIds.Backfill || chain2.chainStatus === ChainIndexingStatusIds.Completed
563
563
  );
564
564
  return atLeastOneChainInTargetStatus && otherChainsHaveValidStatuses;
565
565
  }
566
566
  function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotCompleted(chains) {
567
567
  const allChainsHaveValidStatuses = chains.every(
568
- (chain) => chain.chainStatus === ChainIndexingStatusIds.Completed
568
+ (chain2) => chain2.chainStatus === ChainIndexingStatusIds.Completed
569
569
  );
570
570
  return allChainsHaveValidStatuses;
571
571
  }
572
572
  function checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotFollowing(chains) {
573
573
  const allChainsHaveValidStatuses = chains.some(
574
- (chain) => chain.chainStatus === ChainIndexingStatusIds.Following
574
+ (chain2) => chain2.chainStatus === ChainIndexingStatusIds.Following
575
575
  );
576
576
  return allChainsHaveValidStatuses;
577
577
  }
@@ -733,12 +733,12 @@ function invariant_omnichainSnapshotStatusIsConsistentWithChainSnapshot(ctx) {
733
733
  function invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueuedChains(ctx) {
734
734
  const snapshot = ctx.value;
735
735
  const queuedChains = Array.from(snapshot.chains.values()).filter(
736
- (chain) => chain.chainStatus === ChainIndexingStatusIds.Queued
736
+ (chain2) => chain2.chainStatus === ChainIndexingStatusIds.Queued
737
737
  );
738
738
  if (queuedChains.length === 0) {
739
739
  return;
740
740
  }
741
- const queuedChainStartBlocks = queuedChains.map((chain) => chain.config.startBlock.timestamp);
741
+ const queuedChainStartBlocks = queuedChains.map((chain2) => chain2.config.startBlock.timestamp);
742
742
  const queuedChainEarliestStartBlock = Math.min(...queuedChainStartBlocks);
743
743
  if (snapshot.omnichainIndexingCursor >= queuedChainEarliestStartBlock) {
744
744
  ctx.issues.push({
@@ -751,12 +751,12 @@ function invariant_omnichainIndexingCursorLowerThanEarliestStartBlockAcrossQueue
751
751
  function invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlockAcrossBackfillChains(ctx) {
752
752
  const snapshot = ctx.value;
753
753
  const backfillChains = Array.from(snapshot.chains.values()).filter(
754
- (chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill
754
+ (chain2) => chain2.chainStatus === ChainIndexingStatusIds.Backfill
755
755
  );
756
756
  if (backfillChains.length === 0) {
757
757
  return;
758
758
  }
759
- const backfillEndBlocks = backfillChains.map((chain) => chain.backfillEndBlock.timestamp);
759
+ const backfillEndBlocks = backfillChains.map((chain2) => chain2.backfillEndBlock.timestamp);
760
760
  const highestBackfillEndBlock = Math.max(...backfillEndBlocks);
761
761
  if (snapshot.omnichainIndexingCursor > highestBackfillEndBlock) {
762
762
  ctx.issues.push({
@@ -769,13 +769,13 @@ function invariant_omnichainIndexingCursorLowerThanOrEqualToLatestBackfillEndBlo
769
769
  function invariant_omnichainIndexingCursorIsEqualToHighestLatestIndexedBlockAcrossIndexedChain(ctx) {
770
770
  const snapshot = ctx.value;
771
771
  const indexedChains = Array.from(snapshot.chains.values()).filter(
772
- (chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill || chain.chainStatus === ChainIndexingStatusIds.Completed || chain.chainStatus === ChainIndexingStatusIds.Following
772
+ (chain2) => chain2.chainStatus === ChainIndexingStatusIds.Backfill || chain2.chainStatus === ChainIndexingStatusIds.Completed || chain2.chainStatus === ChainIndexingStatusIds.Following
773
773
  );
774
774
  if (indexedChains.length === 0) {
775
775
  return;
776
776
  }
777
777
  const indexedChainLatestIndexedBlocks = indexedChains.map(
778
- (chain) => chain.latestIndexedBlock.timestamp
778
+ (chain2) => chain2.latestIndexedBlock.timestamp
779
779
  );
780
780
  const indexedChainHighestLatestIndexedBlock = Math.max(...indexedChainLatestIndexedBlocks);
781
781
  if (snapshot.omnichainIndexingCursor !== indexedChainHighestLatestIndexedBlock) {
@@ -1603,8 +1603,8 @@ function decodeEncodedReferrer(encodedReferrer) {
1603
1603
  `Encoded referrer value must be represented by ${ENCODED_REFERRER_BYTE_LENGTH} bytes.`
1604
1604
  );
1605
1605
  }
1606
- const padding = slice(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
1607
- if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) return zeroAddress4;
1606
+ const padding2 = slice(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
1607
+ if (padding2 !== EXPECTED_ENCODED_REFERRER_PADDING) return zeroAddress4;
1608
1608
  const decodedReferrer = slice(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
1609
1609
  try {
1610
1610
  return toNormalizedAddress2(decodedReferrer);
@@ -1970,7 +1970,1000 @@ import { DatasourceNames as DatasourceNames2, ENSNamespaceIds as ENSNamespaceIds
1970
1970
 
1971
1971
  // ../integration-test-env/src/devnet/fixtures.ts
1972
1972
  import { getCoderByCoinName } from "@ensdomains/address-encoder";
1973
- import { bytesToHex } from "@ensdomains/address-encoder/utils";
1973
+ import { bytesToHex as bytesToHex2 } from "@ensdomains/address-encoder/utils";
1974
+
1975
+ // ../../node_modules/.pnpm/@ensdomains+content-hash@3.1.0-rc.1/node_modules/@ensdomains/content-hash/dist/esm/utils/coders.js
1976
+ import { decodeArAddress, encodeArAddress } from "@ensdomains/address-encoder/coders";
1977
+
1978
+ // ../../node_modules/.pnpm/@scure+base@1.2.6/node_modules/@scure/base/lib/esm/index.js
1979
+ function isBytes(a) {
1980
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
1981
+ }
1982
+ function isArrayOf(isString, arr) {
1983
+ if (!Array.isArray(arr))
1984
+ return false;
1985
+ if (arr.length === 0)
1986
+ return true;
1987
+ if (isString) {
1988
+ return arr.every((item) => typeof item === "string");
1989
+ } else {
1990
+ return arr.every((item) => Number.isSafeInteger(item));
1991
+ }
1992
+ }
1993
+ function afn(input) {
1994
+ if (typeof input !== "function")
1995
+ throw new Error("function expected");
1996
+ return true;
1997
+ }
1998
+ function astr(label, input) {
1999
+ if (typeof input !== "string")
2000
+ throw new Error(`${label}: string expected`);
2001
+ return true;
2002
+ }
2003
+ function anumber(n) {
2004
+ if (!Number.isSafeInteger(n))
2005
+ throw new Error(`invalid integer: ${n}`);
2006
+ }
2007
+ function aArr(input) {
2008
+ if (!Array.isArray(input))
2009
+ throw new Error("array expected");
2010
+ }
2011
+ function astrArr(label, input) {
2012
+ if (!isArrayOf(true, input))
2013
+ throw new Error(`${label}: array of strings expected`);
2014
+ }
2015
+ function anumArr(label, input) {
2016
+ if (!isArrayOf(false, input))
2017
+ throw new Error(`${label}: array of numbers expected`);
2018
+ }
2019
+ // @__NO_SIDE_EFFECTS__
2020
+ function chain(...args) {
2021
+ const id = (a) => a;
2022
+ const wrap = (a, b) => (c) => a(b(c));
2023
+ const encode2 = args.map((x) => x.encode).reduceRight(wrap, id);
2024
+ const decode2 = args.map((x) => x.decode).reduce(wrap, id);
2025
+ return { encode: encode2, decode: decode2 };
2026
+ }
2027
+ // @__NO_SIDE_EFFECTS__
2028
+ function alphabet(letters) {
2029
+ const lettersA = typeof letters === "string" ? letters.split("") : letters;
2030
+ const len = lettersA.length;
2031
+ astrArr("alphabet", lettersA);
2032
+ const indexes = new Map(lettersA.map((l, i) => [l, i]));
2033
+ return {
2034
+ encode: (digits) => {
2035
+ aArr(digits);
2036
+ return digits.map((i) => {
2037
+ if (!Number.isSafeInteger(i) || i < 0 || i >= len)
2038
+ throw new Error(`alphabet.encode: digit index outside alphabet "${i}". Allowed: ${letters}`);
2039
+ return lettersA[i];
2040
+ });
2041
+ },
2042
+ decode: (input) => {
2043
+ aArr(input);
2044
+ return input.map((letter) => {
2045
+ astr("alphabet.decode", letter);
2046
+ const i = indexes.get(letter);
2047
+ if (i === void 0)
2048
+ throw new Error(`Unknown letter: "${letter}". Allowed: ${letters}`);
2049
+ return i;
2050
+ });
2051
+ }
2052
+ };
2053
+ }
2054
+ // @__NO_SIDE_EFFECTS__
2055
+ function join(separator = "") {
2056
+ astr("join", separator);
2057
+ return {
2058
+ encode: (from) => {
2059
+ astrArr("join.decode", from);
2060
+ return from.join(separator);
2061
+ },
2062
+ decode: (to) => {
2063
+ astr("join.decode", to);
2064
+ return to.split(separator);
2065
+ }
2066
+ };
2067
+ }
2068
+ // @__NO_SIDE_EFFECTS__
2069
+ function padding(bits, chr = "=") {
2070
+ anumber(bits);
2071
+ astr("padding", chr);
2072
+ return {
2073
+ encode(data) {
2074
+ astrArr("padding.encode", data);
2075
+ while (data.length * bits % 8)
2076
+ data.push(chr);
2077
+ return data;
2078
+ },
2079
+ decode(input) {
2080
+ astrArr("padding.decode", input);
2081
+ let end = input.length;
2082
+ if (end * bits % 8)
2083
+ throw new Error("padding: invalid, string should have whole number of bytes");
2084
+ for (; end > 0 && input[end - 1] === chr; end--) {
2085
+ const last = end - 1;
2086
+ const byte = last * bits;
2087
+ if (byte % 8 === 0)
2088
+ throw new Error("padding: invalid, string has too much padding");
2089
+ }
2090
+ return input.slice(0, end);
2091
+ }
2092
+ };
2093
+ }
2094
+ function convertRadix(data, from, to) {
2095
+ if (from < 2)
2096
+ throw new Error(`convertRadix: invalid from=${from}, base cannot be less than 2`);
2097
+ if (to < 2)
2098
+ throw new Error(`convertRadix: invalid to=${to}, base cannot be less than 2`);
2099
+ aArr(data);
2100
+ if (!data.length)
2101
+ return [];
2102
+ let pos = 0;
2103
+ const res = [];
2104
+ const digits = Array.from(data, (d) => {
2105
+ anumber(d);
2106
+ if (d < 0 || d >= from)
2107
+ throw new Error(`invalid integer: ${d}`);
2108
+ return d;
2109
+ });
2110
+ const dlen = digits.length;
2111
+ while (true) {
2112
+ let carry = 0;
2113
+ let done = true;
2114
+ for (let i = pos; i < dlen; i++) {
2115
+ const digit = digits[i];
2116
+ const fromCarry = from * carry;
2117
+ const digitBase = fromCarry + digit;
2118
+ if (!Number.isSafeInteger(digitBase) || fromCarry / from !== carry || digitBase - digit !== fromCarry) {
2119
+ throw new Error("convertRadix: carry overflow");
2120
+ }
2121
+ const div = digitBase / to;
2122
+ carry = digitBase % to;
2123
+ const rounded = Math.floor(div);
2124
+ digits[i] = rounded;
2125
+ if (!Number.isSafeInteger(rounded) || rounded * to + carry !== digitBase)
2126
+ throw new Error("convertRadix: carry overflow");
2127
+ if (!done)
2128
+ continue;
2129
+ else if (!rounded)
2130
+ pos = i;
2131
+ else
2132
+ done = false;
2133
+ }
2134
+ res.push(carry);
2135
+ if (done)
2136
+ break;
2137
+ }
2138
+ for (let i = 0; i < data.length - 1 && data[i] === 0; i++)
2139
+ res.push(0);
2140
+ return res.reverse();
2141
+ }
2142
+ var gcd = (a, b) => b === 0 ? a : gcd(b, a % b);
2143
+ var radix2carry = /* @__NO_SIDE_EFFECTS__ */ (from, to) => from + (to - gcd(from, to));
2144
+ var powers = /* @__PURE__ */ (() => {
2145
+ let res = [];
2146
+ for (let i = 0; i < 40; i++)
2147
+ res.push(2 ** i);
2148
+ return res;
2149
+ })();
2150
+ function convertRadix2(data, from, to, padding2) {
2151
+ aArr(data);
2152
+ if (from <= 0 || from > 32)
2153
+ throw new Error(`convertRadix2: wrong from=${from}`);
2154
+ if (to <= 0 || to > 32)
2155
+ throw new Error(`convertRadix2: wrong to=${to}`);
2156
+ if (/* @__PURE__ */ radix2carry(from, to) > 32) {
2157
+ throw new Error(`convertRadix2: carry overflow from=${from} to=${to} carryBits=${/* @__PURE__ */ radix2carry(from, to)}`);
2158
+ }
2159
+ let carry = 0;
2160
+ let pos = 0;
2161
+ const max = powers[from];
2162
+ const mask = powers[to] - 1;
2163
+ const res = [];
2164
+ for (const n of data) {
2165
+ anumber(n);
2166
+ if (n >= max)
2167
+ throw new Error(`convertRadix2: invalid data word=${n} from=${from}`);
2168
+ carry = carry << from | n;
2169
+ if (pos + from > 32)
2170
+ throw new Error(`convertRadix2: carry overflow pos=${pos} from=${from}`);
2171
+ pos += from;
2172
+ for (; pos >= to; pos -= to)
2173
+ res.push((carry >> pos - to & mask) >>> 0);
2174
+ const pow = powers[pos];
2175
+ if (pow === void 0)
2176
+ throw new Error("invalid carry");
2177
+ carry &= pow - 1;
2178
+ }
2179
+ carry = carry << to - pos & mask;
2180
+ if (!padding2 && pos >= from)
2181
+ throw new Error("Excess padding");
2182
+ if (!padding2 && carry > 0)
2183
+ throw new Error(`Non-zero padding: ${carry}`);
2184
+ if (padding2 && pos > 0)
2185
+ res.push(carry >>> 0);
2186
+ return res;
2187
+ }
2188
+ // @__NO_SIDE_EFFECTS__
2189
+ function radix(num) {
2190
+ anumber(num);
2191
+ const _256 = 2 ** 8;
2192
+ return {
2193
+ encode: (bytes) => {
2194
+ if (!isBytes(bytes))
2195
+ throw new Error("radix.encode input should be Uint8Array");
2196
+ return convertRadix(Array.from(bytes), _256, num);
2197
+ },
2198
+ decode: (digits) => {
2199
+ anumArr("radix.decode", digits);
2200
+ return Uint8Array.from(convertRadix(digits, num, _256));
2201
+ }
2202
+ };
2203
+ }
2204
+ // @__NO_SIDE_EFFECTS__
2205
+ function radix2(bits, revPadding = false) {
2206
+ anumber(bits);
2207
+ if (bits <= 0 || bits > 32)
2208
+ throw new Error("radix2: bits should be in (0..32]");
2209
+ if (/* @__PURE__ */ radix2carry(8, bits) > 32 || /* @__PURE__ */ radix2carry(bits, 8) > 32)
2210
+ throw new Error("radix2: carry overflow");
2211
+ return {
2212
+ encode: (bytes) => {
2213
+ if (!isBytes(bytes))
2214
+ throw new Error("radix2.encode input should be Uint8Array");
2215
+ return convertRadix2(Array.from(bytes), 8, bits, !revPadding);
2216
+ },
2217
+ decode: (digits) => {
2218
+ anumArr("radix2.decode", digits);
2219
+ return Uint8Array.from(convertRadix2(digits, bits, 8, revPadding));
2220
+ }
2221
+ };
2222
+ }
2223
+ function checksum(len, fn) {
2224
+ anumber(len);
2225
+ afn(fn);
2226
+ return {
2227
+ encode(data) {
2228
+ if (!isBytes(data))
2229
+ throw new Error("checksum.encode: input should be Uint8Array");
2230
+ const sum = fn(data).slice(0, len);
2231
+ const res = new Uint8Array(data.length + len);
2232
+ res.set(data);
2233
+ res.set(sum, data.length);
2234
+ return res;
2235
+ },
2236
+ decode(data) {
2237
+ if (!isBytes(data))
2238
+ throw new Error("checksum.decode: input should be Uint8Array");
2239
+ const payload = data.slice(0, -len);
2240
+ const oldChecksum = data.slice(-len);
2241
+ const newChecksum = fn(payload).slice(0, len);
2242
+ for (let i = 0; i < len; i++)
2243
+ if (newChecksum[i] !== oldChecksum[i])
2244
+ throw new Error("Invalid checksum");
2245
+ return payload;
2246
+ }
2247
+ };
2248
+ }
2249
+ var utils = {
2250
+ alphabet,
2251
+ chain,
2252
+ checksum,
2253
+ convertRadix,
2254
+ convertRadix2,
2255
+ radix,
2256
+ radix2,
2257
+ join,
2258
+ padding
2259
+ };
2260
+ var genBase58 = /* @__NO_SIDE_EFFECTS__ */ (abc) => /* @__PURE__ */ chain(/* @__PURE__ */ radix(58), /* @__PURE__ */ alphabet(abc), /* @__PURE__ */ join(""));
2261
+ var base58 = /* @__PURE__ */ genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
2262
+
2263
+ // ../../node_modules/.pnpm/@ensdomains+content-hash@3.1.0-rc.1/node_modules/@ensdomains/content-hash/dist/esm/utils/coders.js
2264
+ var createMultibaseCoder = ({ name, prefix, encode: encodeWithoutPrefix, decode: decodeWithoutPrefix }) => {
2265
+ const encode2 = (bytes) => `${prefix}${encodeWithoutPrefix(bytes)}`;
2266
+ const decode2 = (multibase) => {
2267
+ if (!multibase.startsWith(prefix)) {
2268
+ throw new Error(`Multibase ${name} must start with ${prefix}`);
2269
+ }
2270
+ return decodeWithoutPrefix(multibase.slice(prefix.length));
2271
+ };
2272
+ return {
2273
+ name,
2274
+ prefix,
2275
+ encode: encode2,
2276
+ decode: decode2
2277
+ };
2278
+ };
2279
+ var base58btc = createMultibaseCoder({
2280
+ name: "base58btc",
2281
+ prefix: "z",
2282
+ encode: base58.encode,
2283
+ decode: base58.decode
2284
+ });
2285
+ var customBase32 = utils.chain(utils.radix2(5), utils.alphabet("abcdefghijklmnopqrstuvwxyz234567"), utils.join(""));
2286
+ var base32 = createMultibaseCoder({
2287
+ name: "base32",
2288
+ prefix: "b",
2289
+ encode: (bytes) => customBase32.encode(bytes),
2290
+ decode: (multibase) => customBase32.decode(multibase)
2291
+ });
2292
+ var base36Chain = utils.chain(utils.radix(36), utils.alphabet("0123456789abcdefghijklmnopqrstuvwxyz"), utils.join(""));
2293
+ var base36 = createMultibaseCoder({
2294
+ name: "base36",
2295
+ prefix: "k",
2296
+ encode: base36Chain.encode,
2297
+ decode: base36Chain.decode
2298
+ });
2299
+ var base64url = createMultibaseCoder({
2300
+ name: "base64url",
2301
+ prefix: "u",
2302
+ encode: encodeArAddress,
2303
+ decode: decodeArAddress
2304
+ });
2305
+
2306
+ // ../../node_modules/.pnpm/@ensdomains+content-hash@3.1.0-rc.1/node_modules/@ensdomains/content-hash/dist/esm/utils/coerce.js
2307
+ var coerce = (o) => {
2308
+ if (o instanceof Uint8Array && o.constructor.name === "Uint8Array")
2309
+ return o;
2310
+ if (o instanceof ArrayBuffer)
2311
+ return new Uint8Array(o);
2312
+ if (ArrayBuffer.isView(o)) {
2313
+ return new Uint8Array(o.buffer, o.byteOffset, o.byteLength);
2314
+ }
2315
+ throw new Error("Unknown type, must be binary type");
2316
+ };
2317
+
2318
+ // ../../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/utils.js
2319
+ function equalBytes(a, b) {
2320
+ if (a.length !== b.length)
2321
+ return false;
2322
+ let diff = 0;
2323
+ for (let i = 0; i < a.length; i++)
2324
+ diff |= a[i] ^ b[i];
2325
+ return diff === 0;
2326
+ }
2327
+
2328
+ // ../../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/utils.js
2329
+ var equalBytes2 = equalBytes;
2330
+
2331
+ // ../../node_modules/.pnpm/@ensdomains+content-hash@3.1.0-rc.1/node_modules/@ensdomains/content-hash/dist/esm/utils/varint.js
2332
+ var MSB = 128;
2333
+ var REST = 127;
2334
+ var MSBALL = ~REST;
2335
+ var INT = Math.pow(2, 31);
2336
+ var encodeVarint = (num, out, offset = 0) => {
2337
+ out = out || [];
2338
+ offset = offset || 0;
2339
+ while (num >= INT) {
2340
+ out[offset++] = num & 255 | MSB;
2341
+ num /= 128;
2342
+ }
2343
+ while (num & MSBALL) {
2344
+ out[offset++] = num & 255 | MSB;
2345
+ num >>>= 7;
2346
+ }
2347
+ out[offset] = num | 0;
2348
+ return out;
2349
+ };
2350
+ var MSB$1 = 128;
2351
+ var REST$1 = 127;
2352
+ var decodeVarint = (buf, offset = 0) => {
2353
+ var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf.length;
2354
+ do {
2355
+ if (counter >= l) {
2356
+ read.bytes = 0;
2357
+ throw new RangeError("Could not decode varint");
2358
+ }
2359
+ b = buf[counter++];
2360
+ res += shift < 28 ? (b & REST$1) << shift : (b & REST$1) * Math.pow(2, shift);
2361
+ shift += 7;
2362
+ } while (b >= MSB$1);
2363
+ return [res, counter - offset];
2364
+ };
2365
+ var N1 = Math.pow(2, 7);
2366
+ var N2 = Math.pow(2, 14);
2367
+ var N3 = Math.pow(2, 21);
2368
+ var N4 = Math.pow(2, 28);
2369
+ var N5 = Math.pow(2, 35);
2370
+ var N6 = Math.pow(2, 42);
2371
+ var N7 = Math.pow(2, 49);
2372
+ var N8 = Math.pow(2, 56);
2373
+ var N9 = Math.pow(2, 63);
2374
+ var varintEncodingLength = (value) => {
2375
+ return value < N1 ? 1 : value < N2 ? 2 : value < N3 ? 3 : value < N4 ? 4 : value < N5 ? 5 : value < N6 ? 6 : value < N7 ? 7 : value < N8 ? 8 : value < N9 ? 9 : 10;
2376
+ };
2377
+
2378
+ // ../../node_modules/.pnpm/@ensdomains+content-hash@3.1.0-rc.1/node_modules/@ensdomains/content-hash/dist/esm/utils/digest.js
2379
+ var Digest = class {
2380
+ /**
2381
+ * Creates a multihash digest.
2382
+ */
2383
+ constructor(code, size4, digest, bytes) {
2384
+ Object.defineProperty(this, "code", {
2385
+ enumerable: true,
2386
+ configurable: true,
2387
+ writable: true,
2388
+ value: void 0
2389
+ });
2390
+ Object.defineProperty(this, "size", {
2391
+ enumerable: true,
2392
+ configurable: true,
2393
+ writable: true,
2394
+ value: void 0
2395
+ });
2396
+ Object.defineProperty(this, "digest", {
2397
+ enumerable: true,
2398
+ configurable: true,
2399
+ writable: true,
2400
+ value: void 0
2401
+ });
2402
+ Object.defineProperty(this, "bytes", {
2403
+ enumerable: true,
2404
+ configurable: true,
2405
+ writable: true,
2406
+ value: void 0
2407
+ });
2408
+ this.code = code;
2409
+ this.size = size4;
2410
+ this.digest = digest;
2411
+ this.bytes = bytes;
2412
+ }
2413
+ };
2414
+ var createDigest = (code, digest) => {
2415
+ const size4 = digest.byteLength;
2416
+ const sizeOffset = varintEncodingLength(code);
2417
+ const digestOffset = sizeOffset + varintEncodingLength(size4);
2418
+ const bytes = new Uint8Array(digestOffset + size4);
2419
+ encodeVarint(code, bytes, 0);
2420
+ encodeVarint(size4, bytes, sizeOffset);
2421
+ bytes.set(digest, digestOffset);
2422
+ return new Digest(code, size4, digest, bytes);
2423
+ };
2424
+ var decodeDigest = (multihash) => {
2425
+ const bytes = coerce(multihash);
2426
+ const [code, sizeOffset] = decodeVarint(bytes);
2427
+ const [size4, digestOffset] = decodeVarint(bytes.subarray(sizeOffset));
2428
+ const digest = bytes.subarray(sizeOffset + digestOffset);
2429
+ if (digest.byteLength !== size4) {
2430
+ throw new Error("Incorrect length");
2431
+ }
2432
+ return new Digest(code, size4, digest, bytes);
2433
+ };
2434
+ var digestEquals = (a, b) => {
2435
+ if (a === b) {
2436
+ return true;
2437
+ } else {
2438
+ const data = b;
2439
+ return a.code === data.code && a.size === data.size && data.bytes instanceof Uint8Array && equalBytes2(a.bytes, data.bytes);
2440
+ }
2441
+ };
2442
+
2443
+ // ../../node_modules/.pnpm/@ensdomains+content-hash@3.1.0-rc.1/node_modules/@ensdomains/content-hash/dist/esm/utils/cid.js
2444
+ function format(link, base2) {
2445
+ const { bytes, version } = link;
2446
+ switch (version) {
2447
+ case 0:
2448
+ return toStringV0(bytes, baseCache(link), base2 ?? base58btc.encode);
2449
+ default:
2450
+ return toStringV1(bytes, baseCache(link), base2 ?? base32.encode);
2451
+ }
2452
+ }
2453
+ var cache = /* @__PURE__ */ new WeakMap();
2454
+ function baseCache(cid) {
2455
+ const baseCache2 = cache.get(cid);
2456
+ if (baseCache2 == null) {
2457
+ const baseCache3 = /* @__PURE__ */ new Map();
2458
+ cache.set(cid, baseCache3);
2459
+ return baseCache3;
2460
+ }
2461
+ return baseCache2;
2462
+ }
2463
+ var CID = class _CID {
2464
+ /**
2465
+ * @param version - Version of the CID
2466
+ * @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
2467
+ * @param multihash - (Multi)hash of the of the content.
2468
+ */
2469
+ constructor(version, code, multihash, bytes) {
2470
+ Object.defineProperty(this, "code", {
2471
+ enumerable: true,
2472
+ configurable: true,
2473
+ writable: true,
2474
+ value: void 0
2475
+ });
2476
+ Object.defineProperty(this, "version", {
2477
+ enumerable: true,
2478
+ configurable: true,
2479
+ writable: true,
2480
+ value: void 0
2481
+ });
2482
+ Object.defineProperty(this, "multihash", {
2483
+ enumerable: true,
2484
+ configurable: true,
2485
+ writable: true,
2486
+ value: void 0
2487
+ });
2488
+ Object.defineProperty(this, "bytes", {
2489
+ enumerable: true,
2490
+ configurable: true,
2491
+ writable: true,
2492
+ value: void 0
2493
+ });
2494
+ Object.defineProperty(this, "/", {
2495
+ enumerable: true,
2496
+ configurable: true,
2497
+ writable: true,
2498
+ value: void 0
2499
+ });
2500
+ this.code = code;
2501
+ this.version = version;
2502
+ this.multihash = multihash;
2503
+ this.bytes = bytes;
2504
+ this["/"] = bytes;
2505
+ }
2506
+ /**
2507
+ * Signalling `cid.asCID === cid` has been replaced with `cid['/'] === cid.bytes`
2508
+ * please either use `CID.asCID(cid)` or switch to new signalling mechanism
2509
+ *
2510
+ * @deprecated
2511
+ */
2512
+ get asCID() {
2513
+ return this;
2514
+ }
2515
+ // ArrayBufferView
2516
+ get byteOffset() {
2517
+ return this.bytes.byteOffset;
2518
+ }
2519
+ // ArrayBufferView
2520
+ get byteLength() {
2521
+ return this.bytes.byteLength;
2522
+ }
2523
+ toV0() {
2524
+ switch (this.version) {
2525
+ case 0: {
2526
+ return this;
2527
+ }
2528
+ case 1: {
2529
+ const { code, multihash } = this;
2530
+ if (code !== DAG_PB_CODE) {
2531
+ throw new Error("Cannot convert a non dag-pb CID to CIDv0");
2532
+ }
2533
+ if (multihash.code !== SHA_256_CODE) {
2534
+ throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");
2535
+ }
2536
+ return _CID.createV0(multihash);
2537
+ }
2538
+ default: {
2539
+ throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`);
2540
+ }
2541
+ }
2542
+ }
2543
+ toV1() {
2544
+ switch (this.version) {
2545
+ case 0: {
2546
+ const { code, digest } = this.multihash;
2547
+ const multihash = createDigest(code, digest);
2548
+ return _CID.createV1(this.code, multihash);
2549
+ }
2550
+ case 1: {
2551
+ return this;
2552
+ }
2553
+ default: {
2554
+ throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`);
2555
+ }
2556
+ }
2557
+ }
2558
+ equals(other) {
2559
+ return _CID.equals(this, other);
2560
+ }
2561
+ static equals(self, other) {
2562
+ const unknown = other;
2563
+ return unknown != null && self.code === unknown.code && self.version === unknown.version && digestEquals(self.multihash, unknown.multihash);
2564
+ }
2565
+ toString(base2) {
2566
+ return format(this, base2);
2567
+ }
2568
+ toJSON() {
2569
+ return { "/": format(this) };
2570
+ }
2571
+ link() {
2572
+ return this;
2573
+ }
2574
+ get [Symbol.toStringTag]() {
2575
+ return "CID";
2576
+ }
2577
+ // Legacy
2578
+ [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
2579
+ return `CID(${this.toString()})`;
2580
+ }
2581
+ /**
2582
+ * Takes any input `value` and returns a `CID` instance if it was
2583
+ * a `CID` otherwise returns `null`. If `value` is instanceof `CID`
2584
+ * it will return value back. If `value` is not instance of this CID
2585
+ * class, but is compatible CID it will return new instance of this
2586
+ * `CID` class. Otherwise returns null.
2587
+ *
2588
+ * This allows two different incompatible versions of CID library to
2589
+ * co-exist and interop as long as binary interface is compatible.
2590
+ */
2591
+ static asCID(input) {
2592
+ if (input == null) {
2593
+ return null;
2594
+ }
2595
+ const value = input;
2596
+ if (value instanceof _CID) {
2597
+ return value;
2598
+ } else if (value["/"] != null && value["/"] === value.bytes || value.asCID === value) {
2599
+ const { version, code, multihash, bytes } = value;
2600
+ return new _CID(version, code, multihash, bytes ?? encodeCID(version, code, multihash.bytes));
2601
+ } else if (value[cidSymbol] === true) {
2602
+ const { version, multihash, code } = value;
2603
+ const digest = decodeDigest(multihash);
2604
+ return _CID.create(version, code, digest);
2605
+ } else {
2606
+ return null;
2607
+ }
2608
+ }
2609
+ /**
2610
+ * @param version - Version of the CID
2611
+ * @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
2612
+ * @param digest - (Multi)hash of the of the content.
2613
+ */
2614
+ static create(version, code, digest) {
2615
+ if (typeof code !== "number") {
2616
+ throw new Error("String codecs are no longer supported");
2617
+ }
2618
+ if (!(digest.bytes instanceof Uint8Array)) {
2619
+ throw new Error("Invalid digest");
2620
+ }
2621
+ switch (version) {
2622
+ case 0: {
2623
+ if (code !== DAG_PB_CODE) {
2624
+ throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);
2625
+ } else {
2626
+ return new _CID(version, code, digest, digest.bytes);
2627
+ }
2628
+ }
2629
+ case 1: {
2630
+ const bytes = encodeCID(version, code, digest.bytes);
2631
+ return new _CID(version, code, digest, bytes);
2632
+ }
2633
+ default: {
2634
+ throw new Error("Invalid version");
2635
+ }
2636
+ }
2637
+ }
2638
+ /**
2639
+ * Simplified version of `create` for CIDv0.
2640
+ */
2641
+ static createV0(digest) {
2642
+ return _CID.create(0, DAG_PB_CODE, digest);
2643
+ }
2644
+ /**
2645
+ * Simplified version of `create` for CIDv1.
2646
+ *
2647
+ * @param code - Content encoding format code.
2648
+ * @param digest - Multihash of the content.
2649
+ */
2650
+ static createV1(code, digest) {
2651
+ return _CID.create(1, code, digest);
2652
+ }
2653
+ /**
2654
+ * Decoded a CID from its binary representation. The byte array must contain
2655
+ * only the CID with no additional bytes.
2656
+ *
2657
+ * An error will be thrown if the bytes provided do not contain a valid
2658
+ * binary representation of a CID.
2659
+ */
2660
+ static decode(bytes) {
2661
+ let [cid, remainder] = _CID.decodeFirst(bytes);
2662
+ if (remainder.length !== 0) {
2663
+ [cid, remainder] = _CID.decodeFirst(Uint8Array.from([0, DAG_PB_CODE, ...bytes]));
2664
+ if (remainder.length !== 0)
2665
+ throw new Error("Incorrect length");
2666
+ }
2667
+ return cid;
2668
+ }
2669
+ /**
2670
+ * Decoded a CID from its binary representation at the beginning of a byte
2671
+ * array.
2672
+ *
2673
+ * Returns an array with the first element containing the CID and the second
2674
+ * element containing the remainder of the original byte array. The remainder
2675
+ * will be a zero-length byte array if the provided bytes only contained a
2676
+ * binary CID representation.
2677
+ */
2678
+ static decodeFirst(bytes) {
2679
+ const specs = _CID.inspectBytes(bytes);
2680
+ const prefixSize = specs.size - specs.multihashSize;
2681
+ const multihashBytes = coerce(bytes.subarray(prefixSize, prefixSize + specs.multihashSize));
2682
+ if (multihashBytes.byteLength !== specs.multihashSize) {
2683
+ throw new Error("Incorrect length");
2684
+ }
2685
+ const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize);
2686
+ const digest = new Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes);
2687
+ const cid = specs.version === 0 ? _CID.createV0(digest) : _CID.createV1(specs.codec, digest);
2688
+ return [cid, bytes.subarray(specs.size)];
2689
+ }
2690
+ /**
2691
+ * Inspect the initial bytes of a CID to determine its properties.
2692
+ *
2693
+ * Involves decoding up to 4 varints. Typically this will require only 4 to 6
2694
+ * bytes but for larger multicodec code values and larger multihash digest
2695
+ * lengths these varints can be quite large. It is recommended that at least
2696
+ * 10 bytes be made available in the `initialBytes` argument for a complete
2697
+ * inspection.
2698
+ */
2699
+ static inspectBytes(initialBytes) {
2700
+ let offset = 0;
2701
+ const next = () => {
2702
+ const [i, length] = decodeVarint(initialBytes.subarray(offset));
2703
+ offset += length;
2704
+ return i;
2705
+ };
2706
+ let version = next();
2707
+ let codec = DAG_PB_CODE;
2708
+ if (version === 18) {
2709
+ version = 0;
2710
+ offset = 0;
2711
+ } else {
2712
+ codec = next();
2713
+ }
2714
+ if (version !== 0 && version !== 1) {
2715
+ throw new RangeError(`Invalid CID version ${version}`);
2716
+ }
2717
+ const prefixSize = offset;
2718
+ const multihashCode = next();
2719
+ const digestSize = next();
2720
+ const size4 = offset + digestSize;
2721
+ const multihashSize = size4 - prefixSize;
2722
+ return { version, codec, multihashCode, digestSize, multihashSize, size: size4 };
2723
+ }
2724
+ /**
2725
+ * Takes cid in a string representation and creates an instance. If `base`
2726
+ * decoder is not provided will use a default from the configuration. It will
2727
+ * throw an error if encoding of the CID is not compatible with supplied (or
2728
+ * a default decoder).
2729
+ */
2730
+ static parse(source, base2) {
2731
+ const [prefix, bytes] = parseCIDtoBytes(source, base2);
2732
+ const cid = _CID.decode(bytes);
2733
+ baseCache(cid).set(prefix, source);
2734
+ return cid;
2735
+ }
2736
+ };
2737
+ function parseCIDtoBytes(source, base2) {
2738
+ switch (source[0]) {
2739
+ // CIDv0 is parsed differently
2740
+ case "Q": {
2741
+ const decoder = base2 ?? base58btc;
2742
+ return [
2743
+ base58btc.prefix,
2744
+ decoder.decode(`${base58btc.prefix}${source}`)
2745
+ ];
2746
+ }
2747
+ case base58btc.prefix: {
2748
+ const decoder = base2 ?? base58btc;
2749
+ return [base58btc.prefix, decoder.decode(source)];
2750
+ }
2751
+ case base32.prefix: {
2752
+ const decoder = base2 ?? base32;
2753
+ return [base32.prefix, decoder.decode(source)];
2754
+ }
2755
+ case base36.prefix: {
2756
+ const decoder = base2 ?? base36;
2757
+ return [base36.prefix, decoder.decode(source)];
2758
+ }
2759
+ default: {
2760
+ source = `z${source}`;
2761
+ return [source[0], base58btc.decode(source)];
2762
+ }
2763
+ }
2764
+ }
2765
+ function toStringV0(bytes, cache4, base2) {
2766
+ const { prefix } = base2;
2767
+ if (prefix !== base58btc.prefix) {
2768
+ throw Error(`Cannot string encode V0 in ${base2.name} encoding`);
2769
+ }
2770
+ const cid = cache4.get(prefix);
2771
+ if (cid == null) {
2772
+ const cid2 = base2.encode(bytes).slice(1);
2773
+ cache4.set(prefix, cid2);
2774
+ return cid2;
2775
+ } else {
2776
+ return cid;
2777
+ }
2778
+ }
2779
+ function toStringV1(bytes, cache4, base2) {
2780
+ const { prefix } = base2;
2781
+ const cid = cache4.get(prefix);
2782
+ if (cid == null) {
2783
+ const cid2 = base2.encode(bytes);
2784
+ cache4.set(prefix, cid2);
2785
+ return cid2;
2786
+ } else {
2787
+ return cid;
2788
+ }
2789
+ }
2790
+ var DAG_PB_CODE = 112;
2791
+ var SHA_256_CODE = 18;
2792
+ function encodeCID(version, code, multihash) {
2793
+ const codeOffset = varintEncodingLength(version);
2794
+ const hashOffset = codeOffset + varintEncodingLength(code);
2795
+ const bytes = new Uint8Array(hashOffset + multihash.byteLength);
2796
+ encodeVarint(version, bytes, 0);
2797
+ encodeVarint(code, bytes, codeOffset);
2798
+ bytes.set(multihash, hashOffset);
2799
+ return bytes;
2800
+ }
2801
+ var cidSymbol = /* @__PURE__ */ Symbol.for("@ipld/js-cid/CID");
2802
+
2803
+ // ../../node_modules/.pnpm/@ensdomains+content-hash@3.1.0-rc.1/node_modules/@ensdomains/content-hash/dist/esm/helpers.js
2804
+ var concatUint8Arrays = (array1, array2) => {
2805
+ let result = new Uint8Array(array1.length + array2.length);
2806
+ result.set(array1, 0);
2807
+ result.set(array2, array1.length);
2808
+ return result;
2809
+ };
2810
+
2811
+ // ../../node_modules/.pnpm/@ensdomains+content-hash@3.1.0-rc.1/node_modules/@ensdomains/content-hash/dist/esm/map.js
2812
+ var codeToName = {
2813
+ 227: "ipfs",
2814
+ 229: "ipns",
2815
+ 228: "swarm",
2816
+ 444: "onion",
2817
+ 445: "onion3",
2818
+ 11639056: "skynet",
2819
+ 11704592: "arweave"
2820
+ };
2821
+ var nameToCode = {
2822
+ ipfs: 227,
2823
+ ipns: 229,
2824
+ swarm: 228,
2825
+ onion: 444,
2826
+ onion3: 445,
2827
+ skynet: 11639056,
2828
+ arweave: 11704592
2829
+ };
2830
+
2831
+ // ../../node_modules/.pnpm/@ensdomains+content-hash@3.1.0-rc.1/node_modules/@ensdomains/content-hash/dist/esm/profiles.js
2832
+ import { decodeArAddress as decodeArAddress2, encodeArAddress as encodeArAddress2 } from "@ensdomains/address-encoder/coders";
2833
+ var hexStringToBytes = (hex) => {
2834
+ let value = hex;
2835
+ if (value.startsWith("0x")) {
2836
+ value = value.slice(2);
2837
+ }
2838
+ if (value.length % 2 !== 0) {
2839
+ throw new Error("Invalid hex string");
2840
+ }
2841
+ const bytes = new Uint8Array(value.length / 2);
2842
+ for (let i = 0; i < value.length; i += 2) {
2843
+ bytes[i / 2] = parseInt(value.slice(i, i + 2), 16);
2844
+ }
2845
+ return bytes;
2846
+ };
2847
+ var bytesToHexString = (bytes) => {
2848
+ let hex = "";
2849
+ for (let i = 0; i < bytes.length; i++) {
2850
+ hex += bytes[i].toString(16).padStart(2, "0");
2851
+ }
2852
+ return hex;
2853
+ };
2854
+ var isCryptographicIPNS = (cid) => {
2855
+ try {
2856
+ const { multihash } = cid;
2857
+ if (multihash.size < 38) {
2858
+ const mh = decodeDigest(multihash.bytes);
2859
+ if (mh.code === 0 && mh.size < 36) {
2860
+ return false;
2861
+ }
2862
+ }
2863
+ return true;
2864
+ } catch (_) {
2865
+ return false;
2866
+ }
2867
+ };
2868
+ var base64Decode = (value) => decodeArAddress2(value);
2869
+ var encodes = {
2870
+ skynet: (value) => {
2871
+ return base64Decode(value);
2872
+ },
2873
+ swarm: (value) => {
2874
+ const bytes = hexStringToBytes(value);
2875
+ const multihash = createDigest(27, bytes);
2876
+ return CID.create(1, 250, multihash).bytes;
2877
+ },
2878
+ ipfs: (value) => {
2879
+ return CID.parse(value).toV1().bytes;
2880
+ },
2881
+ ipns: (value) => {
2882
+ const cid = CID.parse(value);
2883
+ return CID.create(1, 114, cid.multihash).bytes;
2884
+ },
2885
+ utf8: (value) => {
2886
+ const encoder = new TextEncoder();
2887
+ return encoder.encode(value);
2888
+ },
2889
+ arweave: (value) => {
2890
+ return base64Decode(value);
2891
+ }
2892
+ };
2893
+ var decodes = {
2894
+ hexMultiHash: (value) => {
2895
+ const cid = CID.decode(value);
2896
+ return bytesToHexString(decodeDigest(cid.multihash.bytes).digest);
2897
+ },
2898
+ ipfs: (value) => {
2899
+ const cid = CID.decode(value).toV1();
2900
+ return cid.toString(cid.code === 114 ? base36 : base32);
2901
+ },
2902
+ ipns: (value) => {
2903
+ const cid = CID.decode(value).toV1();
2904
+ if (!isCryptographicIPNS(cid)) {
2905
+ console.warn("[ensdomains/content-hash] use of non-cryptographic identifiers in ipns-ns is deprecated and will be removed, migrate to ED25519 libp2p-key");
2906
+ return String.fromCodePoint(...CID.decode(value).multihash.digest);
2907
+ }
2908
+ return cid.toString(base36);
2909
+ },
2910
+ utf8: (value) => {
2911
+ const decoder = new TextDecoder();
2912
+ return decoder.decode(value);
2913
+ },
2914
+ base64: (value) => {
2915
+ return encodeArAddress2(value);
2916
+ }
2917
+ };
2918
+ var profiles = {
2919
+ skynet: {
2920
+ encode: encodes.skynet,
2921
+ decode: decodes.base64
2922
+ },
2923
+ swarm: {
2924
+ encode: encodes.swarm,
2925
+ decode: decodes.hexMultiHash
2926
+ },
2927
+ ipfs: {
2928
+ encode: encodes.ipfs,
2929
+ decode: decodes.ipfs
2930
+ },
2931
+ ipns: {
2932
+ encode: encodes.ipns,
2933
+ decode: decodes.ipns
2934
+ },
2935
+ arweave: {
2936
+ encode: encodes.arweave,
2937
+ decode: decodes.base64
2938
+ },
2939
+ default: {
2940
+ encode: encodes.utf8,
2941
+ decode: decodes.utf8
2942
+ }
2943
+ };
2944
+
2945
+ // ../../node_modules/.pnpm/@ensdomains+content-hash@3.1.0-rc.1/node_modules/@ensdomains/content-hash/dist/esm/index.js
2946
+ var decode = (contentHash) => {
2947
+ const bytes = hexStringToBytes(contentHash);
2948
+ const [code, offset] = decodeVarint(bytes);
2949
+ const value = bytes.slice(offset);
2950
+ const name = codeToName[code];
2951
+ let profile = profiles[name];
2952
+ if (!profile)
2953
+ profile = profiles["default"];
2954
+ return profile.decode(value);
2955
+ };
2956
+ var encode = (name, value) => {
2957
+ let profile = profiles[name];
2958
+ if (!profile)
2959
+ profile = profiles["default"];
2960
+ const bytes = profile.encode(value);
2961
+ const code = nameToCode[name];
2962
+ const codeBytes = encodeVarint(code, new Uint8Array(varintEncodingLength(code)));
2963
+ return bytesToHexString(concatUint8Arrays(codeBytes, bytes));
2964
+ };
2965
+
2966
+ // ../integration-test-env/src/devnet/fixtures.ts
1974
2967
  import { asNormalizedAddress, toNormalizedAddress as toNormalizedAddress3 } from "enssdk";
1975
2968
  import { mnemonicToAccount } from "viem/accounts";
1976
2969
  var mnemonic = "test test test test test test test test test test test junk";
@@ -1995,10 +2988,18 @@ var getRawAddress = (coinName, address) => {
1995
2988
  const coder = getCoderByCoinName(coinName);
1996
2989
  return {
1997
2990
  coinType: coder.coinType,
1998
- raw: bytesToHex(coder.decode(address)),
2991
+ raw: bytesToHex2(coder.decode(address)),
1999
2992
  address
2000
2993
  };
2001
2994
  };
2995
+ var getRawContenthash = (codec, input) => {
2996
+ const encoded = encode(codec, input);
2997
+ return {
2998
+ raw: `0x${encoded}`,
2999
+ // decode normalizes values (e.g. IPFS CIDv0 input → CIDv1 decoded, IPNS peer id → base36 CID)
3000
+ decoded: decode(encoded)
3001
+ };
3002
+ };
2002
3003
  var testEthTextRecords = {
2003
3004
  avatar: { key: "avatar", value: "https://example.com/avatar.png" },
2004
3005
  twitter: { key: "com.twitter", value: "ensdomains" },
@@ -2024,10 +3025,54 @@ var fixtures = {
2024
3025
  fourBytesInterface: "0x11100111",
2025
3026
  publicKeyX: `0x${"02".repeat(32)}`,
2026
3027
  publicKeyY: `0x${"03".repeat(32)}`,
2027
- contenthash: `0x${"04".repeat(32)}`,
2028
3028
  rawAddresses,
2029
3029
  textRecords: testEthTextRecords
2030
3030
  };
3031
+ var efpSeedTargets = {
3032
+ /** ADD + ADD_TAG("block") + ADD_TAG("block") -> tags === ["block"] (dedup). */
3033
+ dedup: asNormalizedAddress(`0x${"d1".repeat(20)}`),
3034
+ /** ADD + ADD_TAG("vip") + REMOVE + ADD -> record present, tags === [] (embed cascade + fresh). */
3035
+ cascade: asNormalizedAddress(`0x${"ca".repeat(20)}`),
3036
+ /** ADD + REMOVE(target + junk) -> record gone (canonical 22-byte keying). */
3037
+ junk: asNormalizedAddress(`0x${"1c".repeat(20)}`),
3038
+ /** Anchors a list whose `user` role must survive a storage-location re-point away and back. */
3039
+ durable: asNormalizedAddress(`0x${"d0".repeat(20)}`),
3040
+ /** Followed plainly by the validated {@link efpFollowActorAddress} list — a real follow. */
3041
+ followPlain: asNormalizedAddress(`0x${"f0".repeat(20)}`),
3042
+ /** Followed but `block`-tagged by that list — excluded from `following` / `followers`. */
3043
+ followBlocked: asNormalizedAddress(`0x${"fb".repeat(20)}`)
3044
+ };
3045
+ var efpSeedRoleUser = asNormalizedAddress(`0x${"ab".repeat(20)}`);
3046
+ var efpSeedActorAddress = asNormalizedAddress(
3047
+ "0x976ea74026e726554db657fa54763abd0c3a0aa9"
3048
+ );
3049
+ var efpFollowActorAddress = asNormalizedAddress(
3050
+ "0x14dc79964da2c08b23698b3d3cc7ca32193d9955"
3051
+ );
3052
+ var contenthashFixtures = {
3053
+ // CIDv0 input — decodes back to CIDv1
3054
+ ipfs: getRawContenthash("ipfs", "QmRAQB6YaCyidP37UdDnjFY5vQuiBrcqdyoW1CuDgwxkD4"),
3055
+ swarm: getRawContenthash(
3056
+ "swarm",
3057
+ "d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162"
3058
+ ),
3059
+ ipns: getRawContenthash("ipns", "12D3KooWG4NvqQVczTrWY1H2tvsJmbQf5bbA3xGYXC4FM3wWCfE4"),
3060
+ onion: getRawContenthash("onion", "zqktlwi4fecvo6ri"),
3061
+ onion3: getRawContenthash("onion3", "p53lf57qovyuvwsc6xnrppyply3vtqm7l6pcobkmyqsiofyeznfu5uqd"),
3062
+ skynet: getRawContenthash("skynet", "CABAB_1Dt0FJsxqsu_J4TodNCbCGvtFf1Uys_3EgzOlTcg"),
3063
+ arweave: getRawContenthash("arweave", "ys32Pt8uC7TrVxHdOLByOspfPEq2LO63wREHQIM9SJQ"),
3064
+ empty: { raw: "0x", decoded: null },
3065
+ invalid: { raw: "0xdeadbeef", decoded: null },
3066
+ zero: {
3067
+ raw: "0x0000000000000000000000000000000000000000000000000000000000000000",
3068
+ decoded: null
3069
+ }
3070
+ };
3071
+ var contenthashSubnames = Object.entries(contenthashFixtures).map(([label, fixture]) => ({
3072
+ label,
3073
+ name: `${label}.contenthash.eth`,
3074
+ records: { contenthash: fixture.raw }
3075
+ }));
2031
3076
 
2032
3077
  // src/omnigraph-api/example-queries.ts
2033
3078
  var SEPOLIA_V2_V2_ETH_REGISTRY = getDatasourceContract(
@@ -2053,7 +3098,10 @@ var SEPOLIA_V2_ACCOUNT_WITH_V1_AND_V2 = toNormalizedAddress4(
2053
3098
  var DEVNET_NAME_WITH_OWNED_RESOLVER = asInterpretedName("example.eth");
2054
3099
  var SEPOLIA_V2_NAME = asInterpretedName("roppp.eth");
2055
3100
  var VITALIK_NAME = asInterpretedName("vitalik.eth");
3101
+ var DPERRI_DNS_NAME = asInterpretedName("dperri.com");
2056
3102
  var GREG_NAME = asInterpretedName("gregskril.eth");
3103
+ var GREG_ADDRESS = toNormalizedAddress4("0x179a862703a4adfb29896552df9e307980d19285");
3104
+ var OFFCHAIN_NAME = asInterpretedName("patricio.onpoap.eth");
2057
3105
  var MAINNET_PUBLIC_RESOLVER = getDatasourceContract(
2058
3106
  ENSNamespaceIds3.Mainnet,
2059
3107
  DatasourceNames2.ReverseResolverRoot,
@@ -2083,13 +3131,13 @@ var GRAPHQL_API_EXAMPLE_QUERIES = [
2083
3131
  # Reverse resolve the ENS primary name of the account
2084
3132
  # using a convenient ETHEREUM alias for mainnet.
2085
3133
  primaryName(by: { chainName: ETHEREUM }) {
2086
- # Get the regular interpreted variant of the primary name
2087
- # and also the special beautified variant that optimizes names
3134
+ # Get the regular interpreted variant of the primary name
3135
+ # and also the special beautified variant that optimizes names
2088
3136
  # containing special characters such as emojis for proper display in interfaces.
2089
3137
  name { interpreted beautified }
2090
3138
  resolve {
2091
3139
  # If the account has a primary name on Ethereum (mainnet),
2092
- # forward resolve the interpreted ENS profile of that name in the same query!.
3140
+ # forward resolve the interpreted ENS profile of that name in the same query!
2093
3141
  profile {
2094
3142
  description
2095
3143
  avatar { httpUrl }
@@ -2104,7 +3152,9 @@ var GRAPHQL_API_EXAMPLE_QUERIES = [
2104
3152
  }
2105
3153
 
2106
3154
  # Also load the count of ENSv1 and ENSv2 domains owned by the account
2107
- # to see if they have domains they should upgrade to ENSv2
3155
+ # to see if they have domains they should upgrade to ENSv2.
3156
+ # For simplicity this example query doesn't include additional logic
3157
+ # to filter out domains that have expired.
2108
3158
  v1DomainsCount: domains(where: { version: ENSv1 }) { totalCount }
2109
3159
  v2DomainsCount: domains(where: { version: ENSv2 }) { totalCount }
2110
3160
  }
@@ -2325,6 +3375,78 @@ query DomainProfile($name: InterpretedName!) {
2325
3375
  }`,
2326
3376
  variables: { default: { name: GREG_NAME } }
2327
3377
  },
3378
+ {
3379
+ id: "domain-profile-and-records",
3380
+ query: `
3381
+ query DomainProfileAndRecords($name: InterpretedName!) {
3382
+ domain(by: { name: $name }) {
3383
+ resolve {
3384
+ profile {
3385
+ avatar {
3386
+ httpUrl
3387
+ }
3388
+ addresses {
3389
+ ethereum
3390
+ solana
3391
+ }
3392
+ socials {
3393
+ github {
3394
+ handle
3395
+ httpUrl
3396
+ }
3397
+ twitter {
3398
+ handle
3399
+ httpUrl
3400
+ }
3401
+ }
3402
+ website {
3403
+ httpUrl
3404
+ }
3405
+ }
3406
+ records {
3407
+ addresses(coinTypes: [60, 501]) {
3408
+ coinType
3409
+ address
3410
+ }
3411
+ texts(keys: ["avatar", "com.twitter", "com.github", "url"]) {
3412
+ key
3413
+ value
3414
+ }
3415
+ }
3416
+ }
3417
+ }
3418
+ }`,
3419
+ variables: { default: { name: GREG_NAME } }
3420
+ },
3421
+ ////////////////////////////////////
3422
+ // Offchain Name (UnindexedDomain)
3423
+ ////////////////////////////////////
3424
+ {
3425
+ id: "offchain-name",
3426
+ query: `
3427
+ query OffchainName($name: InterpretedName!) {
3428
+ domain(by: { name: $name }) {
3429
+ # Resolvable-but-unindexed names (offchain / CCIP-Read) surface as UnindexedDomain
3430
+ __typename
3431
+ id
3432
+ canonical { name { interpreted } }
3433
+ resolver {
3434
+ # the wildcard Resolver that ENS Forward Resolution (ENSIP-10) lands on
3435
+ effective {
3436
+ extended
3437
+ contract { chainId address }
3438
+ }
3439
+ }
3440
+ resolve {
3441
+ records {
3442
+ addresses(coinTypes: [60]) { coinType address }
3443
+ texts(keys: ["avatar", "com.twitter", "description"]) { key value }
3444
+ }
3445
+ }
3446
+ }
3447
+ }`,
3448
+ variables: { default: { name: OFFCHAIN_NAME } }
3449
+ },
2328
3450
  //////////////////////
2329
3451
  // Domain Subdomains
2330
3452
  //////////////////////
@@ -2455,9 +3577,39 @@ query AccountDomains(
2455
3577
  // Account Primary Names
2456
3578
  /////////////////////////
2457
3579
  {
2458
- id: "account-primary-name",
3580
+ id: "account-primary-names",
3581
+ query: `
3582
+ query AccountPrimaryNames($address: Address!) {
3583
+ account(by: { address: $address }) {
3584
+ address
3585
+ resolve {
3586
+ # Reverse resolution: given this address + a chain, get the primary
3587
+ # name the address has set for that chain.
3588
+ # primaryName returns the result for a single chain (here, Optimism).
3589
+ # (onePrimaryName / twoPrimaryNames are just GraphQL aliases.)
3590
+ onePrimaryName: primaryName(by: { chainName: OPTIMISM }) {
3591
+ chainName
3592
+ name { interpreted beautified }
3593
+ }
3594
+
3595
+ # primaryNames returns one result per requested chain, in a single call.
3596
+ twoPrimaryNames: primaryNames(where: { chainNames: [ETHEREUM, BASE] }) {
3597
+ chainName
3598
+ name { interpreted beautified }
3599
+ }
3600
+ }
3601
+ }
3602
+ }`,
3603
+ variables: {
3604
+ default: { address: GREG_ADDRESS },
3605
+ [ENSNamespaceIds3.EnsTestEnv]: { address: accounts.owner.address },
3606
+ [ENSNamespaceIds3.SepoliaV2]: { address: SEPOLIA_V2_ACCOUNT }
3607
+ }
3608
+ },
3609
+ {
3610
+ id: "account-primary-name-records",
2459
3611
  query: `
2460
- query AccountPrimaryName($address: Address!) {
3612
+ query AccountPrimaryNameRecords($address: Address!) {
2461
3613
  account(by: { address: $address }) {
2462
3614
  address
2463
3615
  resolve {
@@ -2622,19 +3774,20 @@ query AccountResolverPermissions($address: Address!) {
2622
3774
  query DomainResolver($name: InterpretedName!) {
2623
3775
  domain(by: { name: $name }) {
2624
3776
  resolver {
3777
+ # the Resolver explicitly assigned to this Domain
2625
3778
  assigned {
2626
- contract {
2627
- address
2628
- }
2629
- events(first: 5) {
2630
- edges { node { topics data timestamp } }
2631
- }
3779
+ contract { address }
3780
+ }
3781
+ # the Resolver that ENS Forward Resolution (ENSIP-10) actually lands
3782
+ # on for this Domain \u2014 i.e. its effective Resolver
3783
+ effective {
3784
+ contract { address }
2632
3785
  }
2633
3786
  }
2634
3787
  }
2635
3788
  }`,
2636
3789
  variables: {
2637
- default: { name: VITALIK_NAME },
3790
+ default: { name: DPERRI_DNS_NAME },
2638
3791
  [ENSNamespaceIds3.EnsTestEnv]: { name: DEVNET_NAME_WITH_OWNED_RESOLVER },
2639
3792
  [ENSNamespaceIds3.SepoliaV2]: { name: SEPOLIA_V2_NAME }
2640
3793
  }
@@ -2703,6 +3856,9 @@ query Namegraph {
2703
3856
  query: `
2704
3857
  query AccountMigratedNames($address: Address!) {
2705
3858
  account(by: { address: $address }) {
3859
+ # Count the ENSv1 and ENSv2 domains owned by the account.
3860
+ # For simplicity this example query doesn't include additional logic
3861
+ # to filter out domains that have expired.
2706
3862
  v1DomainsCount: domains(where: { version: ENSv1 }) { totalCount }
2707
3863
  v2DomainsCount: domains(where: { version: ENSv2 }) { totalCount }
2708
3864
  }
@@ -2733,23 +3889,14 @@ query GetEthDomains {
2733
3889
  query AccelerateResolve($address: Address!) {
2734
3890
  account(by: { address: $address }) {
2735
3891
  address
2736
- resolve(accelerate: true) {
2737
- trace
2738
- acceleration {
2739
- requested
2740
- attempted
2741
- }
3892
+ # resolve is automatically accelerated. To disable, resolve(accelerate: false)
3893
+ resolve {
3894
+ acceleration { requested attempted }
2742
3895
  primaryName(by: { chainName: ETHEREUM }) {
2743
3896
  name { interpreted beautified }
2744
3897
  resolve {
2745
- trace
2746
- acceleration {
2747
- requested
2748
- attempted
2749
- }
2750
- profile {
2751
- description
2752
- }
3898
+ acceleration { requested attempted }
3899
+ profile { description }
2753
3900
  }
2754
3901
  }
2755
3902
  }
@@ -3008,29 +4155,29 @@ function buildRpcConfigsFromEnv(env, namespace) {
3008
4155
  );
3009
4156
  const rpcAutoGenMode = buildRpcAutoGenMode(env);
3010
4157
  const rpcConfigs = {};
3011
- for (const chain of chainsInNamespace) {
3012
- const specificValue = env[`RPC_URL_${chain.id}`];
4158
+ for (const chain2 of chainsInNamespace) {
4159
+ const specificValue = env[`RPC_URL_${chain2.id}`];
3013
4160
  if (specificValue) {
3014
- rpcConfigs[serializeChainId(chain.id)] = specificValue;
4161
+ rpcConfigs[serializeChainId(chain2.id)] = specificValue;
3015
4162
  continue;
3016
4163
  }
3017
- if (chain.id === ensTestEnvChain.id) {
4164
+ if (chain2.id === ensTestEnvChain.id) {
3018
4165
  rpcConfigs[serializeChainId(ensTestEnvChain.id)] = ensTestEnvChain.rpcUrls.default.http[0];
3019
4166
  continue;
3020
4167
  }
3021
4168
  const httpUrls = [
3022
4169
  // alchemy, if specified and available
3023
- alchemyApiKey && alchemySupportsChain(chain.id) && `https://${buildAlchemyBaseUrl(chain.id, alchemyApiKey)}`,
4170
+ alchemyApiKey && alchemySupportsChain(chain2.id) && `https://${buildAlchemyBaseUrl(chain2.id, alchemyApiKey)}`,
3024
4171
  // QuickNode, if specified and available
3025
- quickNodeApiKey && quickNodeEndpointName && quickNodeSupportsChain(chain.id) && `https://${buildQuickNodeURL(chain.id, quickNodeApiKey, quickNodeEndpointName)}`,
4172
+ quickNodeApiKey && quickNodeEndpointName && quickNodeSupportsChain(chain2.id) && `https://${buildQuickNodeURL(chain2.id, quickNodeApiKey, quickNodeEndpointName)}`,
3026
4173
  // dRPC, if specified and available
3027
- dRPCKey && dRPCSupportsChain(chain.id) && buildDRPCUrl(chain.id, dRPCKey)
4174
+ dRPCKey && dRPCSupportsChain(chain2.id) && buildDRPCUrl(chain2.id, dRPCKey)
3028
4175
  ];
3029
- const wsUrl = rpcAutoGenMode === RpcAutoGenModes.HttpAndWs && alchemyApiKey && alchemySupportsChain(chain.id) && //
3030
- `wss://${buildAlchemyBaseUrl(chain.id, alchemyApiKey)}`;
4176
+ const wsUrl = rpcAutoGenMode === RpcAutoGenModes.HttpAndWs && alchemyApiKey && alchemySupportsChain(chain2.id) && //
4177
+ `wss://${buildAlchemyBaseUrl(chain2.id, alchemyApiKey)}`;
3031
4178
  const urls = [...httpUrls, wsUrl].filter(Boolean);
3032
4179
  if (urls.length > 0) {
3033
- rpcConfigs[serializeChainId(chain.id)] = urls.join(
4180
+ rpcConfigs[serializeChainId(chain2.id)] = urls.join(
3034
4181
  ","
3035
4182
  );
3036
4183
  }
@@ -3232,6 +4379,10 @@ function interpretTextRecordKey(key) {
3232
4379
  if (key === "") return null;
3233
4380
  return key;
3234
4381
  }
4382
+ function interpretMetadataKey(key) {
4383
+ if (hasNullByte(key)) return null;
4384
+ return key;
4385
+ }
3235
4386
  function interpretTextRecordValue(value) {
3236
4387
  if (hasNullByte(value)) return null;
3237
4388
  if (value === "") return null;
@@ -3393,10 +4544,10 @@ var getContractsByManagedName = (namespace) => {
3393
4544
  }
3394
4545
  };
3395
4546
  };
3396
- var cache = /* @__PURE__ */ new Map();
4547
+ var cache2 = /* @__PURE__ */ new Map();
3397
4548
  var getManagedName = (namespace, contract) => {
3398
4549
  const cacheKey = `${namespace}:${stringifyAccountId(contract)}`;
3399
- const cached = cache.get(cacheKey);
4550
+ const cached = cache2.get(cacheKey);
3400
4551
  if (cached !== void 0) return cached;
3401
4552
  for (const [managedName, group] of Object.entries(getContractsByManagedName(namespace))) {
3402
4553
  const isAnyOfTheContracts = group.contracts.some(
@@ -3407,7 +4558,7 @@ var getManagedName = (namespace, contract) => {
3407
4558
  const name = asInterpretedName2(namespaceSpecific ?? managedName);
3408
4559
  const node = namehashInterpretedName3(name);
3409
4560
  const result = { name, node, registry: group.registry };
3410
- cache.set(cacheKey, result);
4561
+ cache2.set(cacheKey, result);
3411
4562
  return result;
3412
4563
  }
3413
4564
  }
@@ -3426,9 +4577,9 @@ import { DatasourceNames as DatasourceNames6 } from "@ensnode/datasources";
3426
4577
  var getENSv1RootRegistry = (namespace) => getDatasourceContract(namespace, DatasourceNames6.ENSRoot, "ENSv1Registry");
3427
4578
 
3428
4579
  // src/shared/protocol-acceleration/is-bridged-resolver.ts
3429
- var cache2 = /* @__PURE__ */ new Map();
4580
+ var cache3 = /* @__PURE__ */ new Map();
3430
4581
  var getBridgedResolverConfigs = (namespace) => {
3431
- const cached = cache2.get(namespace);
4582
+ const cached = cache3.get(namespace);
3432
4583
  if (cached) return cached;
3433
4584
  const configs = [];
3434
4585
  const basenames = maybeGetDatasource4(namespace, DatasourceNames7.Basenames);
@@ -3463,7 +4614,7 @@ var getBridgedResolverConfigs = (namespace) => {
3463
4614
  targetRegistryId: makeENSv1VirtualRegistryId(registry, node)
3464
4615
  });
3465
4616
  }
3466
- cache2.set(namespace, configs);
4617
+ cache3.set(namespace, configs);
3467
4618
  return configs;
3468
4619
  };
3469
4620
  function isBridgedResolver(namespace, resolver) {
@@ -3587,6 +4738,7 @@ export {
3587
4738
  interpretAddressRecordValue,
3588
4739
  interpretContenthashValue,
3589
4740
  interpretDnszonehashValue,
4741
+ interpretMetadataKey,
3590
4742
  interpretNameRecordValue,
3591
4743
  interpretPubkeyValue,
3592
4744
  interpretTextRecordKey,
@@ -3712,4 +4864,12 @@ export {
3712
4864
  staticResolverImplementsAddressRecordDefaulting,
3713
4865
  stringifyConfig
3714
4866
  };
4867
+ /*! Bundled license information:
4868
+
4869
+ @scure/base/lib/esm/index.js:
4870
+ (*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
4871
+
4872
+ @noble/curves/esm/utils.js:
4873
+ (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
4874
+ */
3715
4875
  //# sourceMappingURL=internal.js.map