@ensdomains/ensjs 3.0.0-alpha.65 → 3.0.0-alpha.67

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) => {
@@ -204,10 +204,10 @@ const getAddr = {
204
204
  };
205
205
  const supportedContentTypes = "0xf";
206
206
  const _getABI = {
207
- raw: async ({ contracts }, name) => {
207
+ raw: async ({ contracts }, name, resolverAddress) => {
208
208
  const publicResolver = await (contracts == null ? void 0 : contracts.getPublicResolver());
209
209
  return {
210
- to: "0x0000000000000000000000000000000000000000",
210
+ to: resolverAddress || "0x0000000000000000000000000000000000000000",
211
211
  data: publicResolver.interface.encodeFunctionData("ABI", [
212
212
  (0, import_normalise.namehash)(name),
213
213
  supportedContentTypes
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) {
@@ -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) => {
@@ -169,10 +169,10 @@ var getAddr = {
169
169
  };
170
170
  var supportedContentTypes = "0xf";
171
171
  var _getABI = {
172
- raw: async ({ contracts }, name) => {
172
+ raw: async ({ contracts }, name, resolverAddress) => {
173
173
  const publicResolver = await contracts?.getPublicResolver();
174
174
  return {
175
- to: "0x0000000000000000000000000000000000000000",
175
+ to: resolverAddress || "0x0000000000000000000000000000000000000000",
176
176
  data: publicResolver.interface.encodeFunctionData("ABI", [
177
177
  namehash(name),
178
178
  supportedContentTypes
@@ -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;
@@ -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';
@@ -72,7 +72,7 @@ export declare const getAddr: {
72
72
  } | undefined>;
73
73
  };
74
74
  export declare const _getABI: {
75
- raw: ({ contracts }: ENSArgs<'contracts'>, name: string) => Promise<{
75
+ raw: ({ contracts }: ENSArgs<'contracts'>, name: string, resolverAddress?: string) => Promise<{
76
76
  to: string;
77
77
  data: string;
78
78
  }>;
@@ -382,7 +382,7 @@ export declare class ENS {
382
382
  } | undefined>;
383
383
  }>;
384
384
  _getABI: GeneratedRawFunction<{
385
- raw: ({ contracts }: ENSArgs<"contracts">, name: string) => Promise<{
385
+ raw: ({ contracts }: ENSArgs<"contracts">, name: string, resolverAddress?: string | undefined) => Promise<{
386
386
  to: string;
387
387
  data: string;
388
388
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ensdomains/ensjs",
3
- "version": "3.0.0-alpha.65",
3
+ "version": "3.0.0-alpha.67",
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'
@@ -238,4 +238,21 @@ describe('getSpecificRecord', () => {
238
238
  expect(result).toBeUndefined()
239
239
  })
240
240
  })
241
+
242
+ describe('_getABI', () => {
243
+ it('should return if resolver address is included', async () => {
244
+ const profile = await ensInstance.getProfile('with-type-1-abi.eth')
245
+ expect(profile?.resolverAddress).toBeTruthy()
246
+ const result = await ensInstance._getABI(
247
+ 'with-type-1-abi.eth',
248
+ profile?.resolverAddress,
249
+ )
250
+ expect(result).toBeTruthy()
251
+ if (result) {
252
+ expect(result.contentType).toBe(1)
253
+ expect(result.decoded).toBe(true)
254
+ expect(result.abi).toMatchObject(dummyABI)
255
+ }
256
+ })
257
+ })
241
258
  })
@@ -245,10 +245,14 @@ export const getAddr = {
245
245
  const supportedContentTypes = '0xf'
246
246
 
247
247
  export const _getABI = {
248
- raw: async ({ contracts }: ENSArgs<'contracts'>, name: string) => {
248
+ raw: async (
249
+ { contracts }: ENSArgs<'contracts'>,
250
+ name: string,
251
+ resolverAddress?: string,
252
+ ) => {
249
253
  const publicResolver = await contracts?.getPublicResolver()!
250
254
  return {
251
- to: '0x0000000000000000000000000000000000000000',
255
+ to: resolverAddress || '0x0000000000000000000000000000000000000000',
252
256
  data: publicResolver.interface.encodeFunctionData('ABI', [
253
257
  namehash(name),
254
258
  supportedContentTypes,
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