@ensdomains/ensjs 3.0.0-alpha.64 → 3.0.0-alpha.66

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.
@@ -24,7 +24,8 @@ module.exports = __toCommonJS(getContractAddress_exports);
24
24
  const addresses = {
25
25
  BaseRegistrarImplementation: {
26
26
  "1": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
27
- "5": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85"
27
+ "5": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
28
+ "11155111": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85"
28
29
  },
29
30
  DNSRegistrar: {
30
31
  "1": "0x58774Bb8acD458A640aF0B88238369A167546ef2",
@@ -32,32 +33,39 @@ const addresses = {
32
33
  },
33
34
  ETHRegistrarController: {
34
35
  "1": "0x253553366Da8546fC250F225fe3d25d0C782303b",
35
- "5": "0xCc5e7dB10E65EED1BBD105359e7268aa660f6734"
36
+ "5": "0xCc5e7dB10E65EED1BBD105359e7268aa660f6734",
37
+ "11155111": "0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72"
36
38
  },
37
39
  Multicall: "0xcA11bde05977b3631167028862bE2a173976CA11",
38
40
  NameWrapper: {
39
41
  "1": "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401",
40
- "5": "0x114D4603199df73e7D157787f8778E21fCd13066"
42
+ "5": "0x114D4603199df73e7D157787f8778E21fCd13066",
43
+ "11155111": "0x0635513f179D50A207757E05759CbD106d7dFcE8"
41
44
  },
42
45
  PublicResolver: {
43
46
  "1": "0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63",
44
- "5": "0xd7a4F6473f32aC2Af804B3686AE8F1932bC35750"
47
+ "5": "0xd7a4F6473f32aC2Af804B3686AE8F1932bC35750",
48
+ "11155111": "0x8FADE66B79cC9f707aB26799354482EB93a5B7dD"
45
49
  },
46
50
  ENSRegistry: {
47
51
  "1": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e",
48
- "5": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e"
52
+ "5": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e",
53
+ "11155111": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
49
54
  },
50
55
  ReverseRegistrar: {
51
56
  "1": "0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb",
52
- "5": "0x4f7A657451358a22dc397d5eE7981FfC526cd856"
57
+ "5": "0x4f7A657451358a22dc397d5eE7981FfC526cd856",
58
+ "11155111": "0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6"
53
59
  },
54
60
  UniversalResolver: {
55
61
  "1": "0xc0497e381f536be9ce14b0dd3817cbcae57d2f62",
56
- "5": "0x56522d00c410a43bffdf00a9a569489297385790"
62
+ "5": "0x56522d00c410a43bffdf00a9a569489297385790",
63
+ "11155111": "0x21B000Fd62a880b2125A61e36a284BB757b76025"
57
64
  },
58
65
  BulkRenewal: {
59
66
  "1": "0xa12159e5131b1eEf6B4857EEE3e1954744b5033A",
60
- "5": "0xeA64C81d0d718620daBC02D61f3B255C641f475F"
67
+ "5": "0xeA64C81d0d718620daBC02D61f3B255C641f475F",
68
+ "11155111": "0x4EF77b90762Eddb33C8Eba5B5a19558DaE53D7a1"
61
69
  }
62
70
  };
63
71
  const getContractAddress = (networkId) => (contractName) => {
@@ -26,7 +26,7 @@ var import_format = require("../utils/format");
26
26
  var import_fuses = require("../utils/fuses");
27
27
  var import_labels = require("../utils/labels");
28
28
  var import_normalise = require("../utils/normalise");
29
- const largeQuery = async ({ gqlInstance }, {
29
+ const largeQuery = async ({ gqlInstance, contracts }, {
30
30
  name,
31
31
  pageSize = 10,
32
32
  orderDirection,
@@ -34,6 +34,8 @@ const largeQuery = async ({ gqlInstance }, {
34
34
  lastSubnames = [],
35
35
  search = ""
36
36
  }) => {
37
+ const nameWrapper = await (contracts == null ? void 0 : contracts.getNameWrapper());
38
+ const nameWrapperAddress = nameWrapper == null ? void 0 : nameWrapper.address.toLowerCase();
37
39
  const { client } = gqlInstance;
38
40
  const lastSubname = lastSubnames == null ? void 0 : lastSubnames[lastSubnames.length - 1];
39
41
  const lastCreatedAt = lastSubname == null ? void 0 : lastSubname.createdAt;
@@ -121,7 +123,7 @@ const largeQuery = async ({ gqlInstance }, {
121
123
  owner: subname.owner.id,
122
124
  type: "domain"
123
125
  };
124
- if (wrappedDomain) {
126
+ if (wrappedDomain && obj.owner === nameWrapperAddress) {
125
127
  obj.type = "wrappedDomain";
126
128
  const expiryDateAsDate = wrappedDomain.expiryDate && wrappedDomain.expiryDate !== "0" ? new Date(parseInt(wrappedDomain.expiryDate) * 1e3) : void 0;
127
129
  const hasExpired = expiryDateAsDate && expiryDateAsDate < new Date();
package/dist/cjs/index.js CHANGED
@@ -35,9 +35,8 @@ var import_singleCall = __toESM(require("./utils/singleCall"));
35
35
  var import_writeTx = __toESM(require("./utils/writeTx"));
36
36
  const graphURIEndpoints = {
37
37
  1: "https://api.thegraph.com/subgraphs/name/ensdomains/ens",
38
- 3: "https://api.thegraph.com/subgraphs/name/ensdomains/ensropsten",
39
- 4: "https://api.thegraph.com/subgraphs/name/ensdomains/ensrinkeby",
40
- 5: "https://api.thegraph.com/subgraphs/name/ensdomains/ensgoerli"
38
+ 5: "https://api.thegraph.com/subgraphs/name/ensdomains/ensgoerli",
39
+ 11155111: "https://api.studio.thegraph.com/query/49574/enssepolia/version/latest"
41
40
  };
42
41
  class ENS {
43
42
  constructor(options) {
@@ -247,7 +246,7 @@ class ENS {
247
246
  );
248
247
  this.getSubnames = this.generateFunction(
249
248
  "initialGetters",
250
- ["gqlInstance"],
249
+ ["gqlInstance", "contracts"],
251
250
  "getSubnames"
252
251
  );
253
252
  this.getNames = this.generateFunction(
@@ -2,7 +2,8 @@
2
2
  var addresses = {
3
3
  BaseRegistrarImplementation: {
4
4
  "1": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
5
- "5": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85"
5
+ "5": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
6
+ "11155111": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85"
6
7
  },
7
8
  DNSRegistrar: {
8
9
  "1": "0x58774Bb8acD458A640aF0B88238369A167546ef2",
@@ -10,32 +11,39 @@ var addresses = {
10
11
  },
11
12
  ETHRegistrarController: {
12
13
  "1": "0x253553366Da8546fC250F225fe3d25d0C782303b",
13
- "5": "0xCc5e7dB10E65EED1BBD105359e7268aa660f6734"
14
+ "5": "0xCc5e7dB10E65EED1BBD105359e7268aa660f6734",
15
+ "11155111": "0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72"
14
16
  },
15
17
  Multicall: "0xcA11bde05977b3631167028862bE2a173976CA11",
16
18
  NameWrapper: {
17
19
  "1": "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401",
18
- "5": "0x114D4603199df73e7D157787f8778E21fCd13066"
20
+ "5": "0x114D4603199df73e7D157787f8778E21fCd13066",
21
+ "11155111": "0x0635513f179D50A207757E05759CbD106d7dFcE8"
19
22
  },
20
23
  PublicResolver: {
21
24
  "1": "0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63",
22
- "5": "0xd7a4F6473f32aC2Af804B3686AE8F1932bC35750"
25
+ "5": "0xd7a4F6473f32aC2Af804B3686AE8F1932bC35750",
26
+ "11155111": "0x8FADE66B79cC9f707aB26799354482EB93a5B7dD"
23
27
  },
24
28
  ENSRegistry: {
25
29
  "1": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e",
26
- "5": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e"
30
+ "5": "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e",
31
+ "11155111": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
27
32
  },
28
33
  ReverseRegistrar: {
29
34
  "1": "0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb",
30
- "5": "0x4f7A657451358a22dc397d5eE7981FfC526cd856"
35
+ "5": "0x4f7A657451358a22dc397d5eE7981FfC526cd856",
36
+ "11155111": "0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6"
31
37
  },
32
38
  UniversalResolver: {
33
39
  "1": "0xc0497e381f536be9ce14b0dd3817cbcae57d2f62",
34
- "5": "0x56522d00c410a43bffdf00a9a569489297385790"
40
+ "5": "0x56522d00c410a43bffdf00a9a569489297385790",
41
+ "11155111": "0x21B000Fd62a880b2125A61e36a284BB757b76025"
35
42
  },
36
43
  BulkRenewal: {
37
44
  "1": "0xa12159e5131b1eEf6B4857EEE3e1954744b5033A",
38
- "5": "0xeA64C81d0d718620daBC02D61f3B255C641f475F"
45
+ "5": "0xeA64C81d0d718620daBC02D61f3B255C641f475F",
46
+ "11155111": "0x4EF77b90762Eddb33C8Eba5B5a19558DaE53D7a1"
39
47
  }
40
48
  };
41
49
  var getContractAddress = (networkId) => (contractName) => {
@@ -8,7 +8,7 @@ import { truncateFormat } from "../utils/format.mjs";
8
8
  import { checkPCCBurned, decodeFuses } from "../utils/fuses.mjs";
9
9
  import { decryptName } from "../utils/labels.mjs";
10
10
  import { namehash } from "../utils/normalise.mjs";
11
- var largeQuery = async ({ gqlInstance }, {
11
+ var largeQuery = async ({ gqlInstance, contracts }, {
12
12
  name,
13
13
  pageSize = 10,
14
14
  orderDirection,
@@ -16,6 +16,8 @@ var largeQuery = async ({ gqlInstance }, {
16
16
  lastSubnames = [],
17
17
  search = ""
18
18
  }) => {
19
+ const nameWrapper = await contracts?.getNameWrapper();
20
+ const nameWrapperAddress = nameWrapper?.address.toLowerCase();
19
21
  const { client } = gqlInstance;
20
22
  const lastSubname = lastSubnames?.[lastSubnames.length - 1];
21
23
  const lastCreatedAt = lastSubname?.createdAt;
@@ -103,7 +105,7 @@ var largeQuery = async ({ gqlInstance }, {
103
105
  owner: subname.owner.id,
104
106
  type: "domain"
105
107
  };
106
- if (wrappedDomain) {
108
+ if (wrappedDomain && obj.owner === nameWrapperAddress) {
107
109
  obj.type = "wrappedDomain";
108
110
  const expiryDateAsDate = wrappedDomain.expiryDate && wrappedDomain.expiryDate !== "0" ? new Date(parseInt(wrappedDomain.expiryDate) * 1e3) : void 0;
109
111
  const hasExpired = expiryDateAsDate && expiryDateAsDate < new Date();
@@ -6,9 +6,8 @@ import singleCall from "./utils/singleCall.mjs";
6
6
  import writeTx from "./utils/writeTx.mjs";
7
7
  var graphURIEndpoints = {
8
8
  1: "https://api.thegraph.com/subgraphs/name/ensdomains/ens",
9
- 3: "https://api.thegraph.com/subgraphs/name/ensdomains/ensropsten",
10
- 4: "https://api.thegraph.com/subgraphs/name/ensdomains/ensrinkeby",
11
- 5: "https://api.thegraph.com/subgraphs/name/ensdomains/ensgoerli"
9
+ 5: "https://api.thegraph.com/subgraphs/name/ensdomains/ensgoerli",
10
+ 11155111: "https://api.studio.thegraph.com/query/49574/enssepolia/version/latest"
12
11
  };
13
12
  var ENS = class {
14
13
  options;
@@ -224,7 +223,7 @@ var ENS = class {
224
223
  );
225
224
  getSubnames = this.generateFunction(
226
225
  "initialGetters",
227
- ["gqlInstance"],
226
+ ["gqlInstance", "contracts"],
228
227
  "getSubnames"
229
228
  );
230
229
  getNames = this.generateFunction(
@@ -1,2 +1,2 @@
1
- export declare type SupportedNetworkId = '1' | '3' | '4' | '5' | '1337';
1
+ export declare type SupportedNetworkId = '1' | '5' | '11155111' | '1337';
2
2
  export declare type ContractName = 'BaseRegistrarImplementation' | 'ETHRegistrarController' | 'Multicall' | 'NameWrapper' | 'DNSRegistrar' | 'PublicResolver' | 'ENSRegistry' | 'ReverseRegistrar' | 'UniversalResolver' | 'BulkRenewal';
@@ -35,5 +35,5 @@ declare type Params = {
35
35
  lastSubnames?: Array<any>;
36
36
  search?: string;
37
37
  };
38
- declare const getSubnames: (injected: ENSArgs<'gqlInstance'>, functionArgs: Params) => Promise<ReturnData>;
38
+ declare const getSubnames: (injected: ENSArgs<'gqlInstance' | 'contracts'>, functionArgs: Params) => Promise<ReturnData>;
39
39
  export default getSubnames;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ensdomains/ensjs",
3
- "version": "3.0.0-alpha.64",
3
+ "version": "3.0.0-alpha.66",
4
4
  "description": "ENS javascript library for contract interaction",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",
@@ -8,6 +8,7 @@ const addresses: Record<
8
8
  BaseRegistrarImplementation: {
9
9
  '1': '0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85',
10
10
  '5': '0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85',
11
+ '11155111': '0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85',
11
12
  },
12
13
  DNSRegistrar: {
13
14
  '1': '0x58774Bb8acD458A640aF0B88238369A167546ef2',
@@ -16,31 +17,38 @@ const addresses: Record<
16
17
  ETHRegistrarController: {
17
18
  '1': '0x253553366Da8546fC250F225fe3d25d0C782303b',
18
19
  '5': '0xCc5e7dB10E65EED1BBD105359e7268aa660f6734',
20
+ '11155111': '0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72',
19
21
  },
20
22
  Multicall: '0xcA11bde05977b3631167028862bE2a173976CA11',
21
23
  NameWrapper: {
22
24
  '1': '0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401',
23
25
  '5': '0x114D4603199df73e7D157787f8778E21fCd13066',
26
+ '11155111': '0x0635513f179D50A207757E05759CbD106d7dFcE8',
24
27
  },
25
28
  PublicResolver: {
26
29
  '1': '0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63',
27
30
  '5': '0xd7a4F6473f32aC2Af804B3686AE8F1932bC35750',
31
+ '11155111': '0x8FADE66B79cC9f707aB26799354482EB93a5B7dD',
28
32
  },
29
33
  ENSRegistry: {
30
34
  '1': '0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e',
31
35
  '5': '0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e',
36
+ '11155111': '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
32
37
  },
33
38
  ReverseRegistrar: {
34
39
  '1': '0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb',
35
40
  '5': '0x4f7A657451358a22dc397d5eE7981FfC526cd856',
41
+ '11155111': '0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6',
36
42
  },
37
43
  UniversalResolver: {
38
44
  '1': '0xc0497e381f536be9ce14b0dd3817cbcae57d2f62',
39
45
  '5': '0x56522d00c410a43bffdf00a9a569489297385790',
46
+ '11155111': '0x21B000Fd62a880b2125A61e36a284BB757b76025',
40
47
  },
41
48
  BulkRenewal: {
42
49
  '1': '0xa12159e5131b1eEf6B4857EEE3e1954744b5033A',
43
50
  '5': '0xeA64C81d0d718620daBC02D61f3B255C641f475F',
51
+ '11155111': '0x4EF77b90762Eddb33C8Eba5B5a19558DaE53D7a1',
44
52
  },
45
53
  /* eslint-enable @typescript-eslint/naming-convention */
46
54
  }
@@ -1,4 +1,4 @@
1
- export type SupportedNetworkId = '1' | '3' | '4' | '5' | '1337'
1
+ export type SupportedNetworkId = '1' | '5' | '11155111' | '1337'
2
2
 
3
3
  export type ContractName =
4
4
  | 'BaseRegistrarImplementation'
@@ -52,7 +52,7 @@ type Params = {
52
52
  }
53
53
 
54
54
  const largeQuery = async (
55
- { gqlInstance }: ENSArgs<'gqlInstance'>,
55
+ { gqlInstance, contracts }: ENSArgs<'gqlInstance' | 'contracts'>,
56
56
  {
57
57
  name,
58
58
  pageSize = 10,
@@ -62,6 +62,9 @@ const largeQuery = async (
62
62
  search = '',
63
63
  }: Params,
64
64
  ) => {
65
+ const nameWrapper = await contracts?.getNameWrapper()
66
+ const nameWrapperAddress = nameWrapper?.address.toLowerCase()
67
+
65
68
  const { client } = gqlInstance
66
69
 
67
70
  const lastSubname = lastSubnames?.[lastSubnames.length - 1]
@@ -165,7 +168,8 @@ const largeQuery = async (
165
168
  type: 'domain',
166
169
  } as Subname
167
170
 
168
- if (wrappedDomain) {
171
+ // If the subname is wrapped, we need to verfiy that it is wrapped by checking the registry owner
172
+ if (wrappedDomain && obj.owner === nameWrapperAddress) {
169
173
  obj.type = 'wrappedDomain'
170
174
  const expiryDateAsDate =
171
175
  wrappedDomain.expiryDate && wrappedDomain.expiryDate !== '0'
@@ -194,7 +198,7 @@ const largeQuery = async (
194
198
  }
195
199
 
196
200
  const getSubnames = (
197
- injected: ENSArgs<'gqlInstance'>,
201
+ injected: ENSArgs<'gqlInstance' | 'contracts'>,
198
202
  functionArgs: Params,
199
203
  ): Promise<ReturnData> => {
200
204
  return largeQuery(injected, functionArgs)
package/src/index.ts CHANGED
@@ -78,9 +78,9 @@ interface WriteFunction<F extends (...args: any) => any> extends Function {
78
78
  /* eslint-disable @typescript-eslint/naming-convention */
79
79
  export const graphURIEndpoints: Record<string, string> = {
80
80
  1: 'https://api.thegraph.com/subgraphs/name/ensdomains/ens',
81
- 3: 'https://api.thegraph.com/subgraphs/name/ensdomains/ensropsten',
82
- 4: 'https://api.thegraph.com/subgraphs/name/ensdomains/ensrinkeby',
83
81
  5: 'https://api.thegraph.com/subgraphs/name/ensdomains/ensgoerli',
82
+ 11155111:
83
+ 'https://api.studio.thegraph.com/query/49574/enssepolia/version/latest',
84
84
  }
85
85
  /* eslint-enable @typescript-eslint/naming-convention */
86
86
 
@@ -510,7 +510,7 @@ export class ENS {
510
510
 
511
511
  public getSubnames = this.generateFunction<FunctionTypes['getSubnames']>(
512
512
  'initialGetters',
513
- ['gqlInstance'],
513
+ ['gqlInstance', 'contracts'],
514
514
  'getSubnames',
515
515
  )
516
516