@ensdomains/ensjs 3.0.0-alpha.30 → 3.0.0-alpha.31
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/README.md +5 -0
- package/dist/cjs/functions/getNames.js +6 -0
- package/dist/esm/functions/getNames.mjs +6 -0
- package/dist/types/functions/createSubname.d.ts +1 -1
- package/dist/types/functions/getNames.d.ts +4 -0
- package/dist/types/functions/wrapName.d.ts +1 -1
- package/dist/types/utils/fuses.d.ts +3 -0
- package/dist/types/utils/generateFuseInput.d.ts +1 -1
- package/dist/types/utils/registerHelpers.d.ts +1 -1
- package/package.json +1 -1
- package/src/functions/createSubname.ts +1 -1
- package/src/functions/getNames.ts +10 -0
- package/src/functions/wrapName.test.ts +2 -2
- package/src/functions/wrapName.ts +1 -1
- package/src/utils/fuses.ts +2 -0
- package/src/utils/generateFuseInput.ts +1 -2
- package/src/utils/registerHelpers.ts +1 -1
- package/src/@types/FuseOptions.d.ts +0 -9
package/README.md
CHANGED
|
@@ -253,6 +253,11 @@ It allows `withProvider` to act as a new ENS instance without having to await a
|
|
|
253
253
|
|
|
254
254
|
## Individual Functions
|
|
255
255
|
|
|
256
|
+
### Utils
|
|
257
|
+
|
|
258
|
+
Utils can be imported at follows
|
|
259
|
+
`import { encodeContenthash } from '@ensdomains/ensjs/utils/contentHash'`
|
|
260
|
+
|
|
256
261
|
### getFuses
|
|
257
262
|
|
|
258
263
|
Gets the fuses for a specified wrapped name.
|
|
@@ -36,6 +36,12 @@ const mapDomain = (domain) => {
|
|
|
36
36
|
};
|
|
37
37
|
const mapWrappedDomain = (wrappedDomain) => {
|
|
38
38
|
const domain = mapDomain(wrappedDomain.domain);
|
|
39
|
+
if (domain.registration) {
|
|
40
|
+
domain.registration = {
|
|
41
|
+
expiryDate: new Date(parseInt(domain.registration.expiryDate) * 1e3),
|
|
42
|
+
registrationDate: new Date(domain.registration.registrationDate * 1e3)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
39
45
|
return {
|
|
40
46
|
expiryDate: new Date(parseInt(wrappedDomain.expiryDate) * 1e3),
|
|
41
47
|
fuses: (0, import_fuses.decodeFuses)(wrappedDomain.fuses),
|
|
@@ -14,6 +14,12 @@ var mapDomain = (domain) => {
|
|
|
14
14
|
};
|
|
15
15
|
var mapWrappedDomain = (wrappedDomain) => {
|
|
16
16
|
const domain = mapDomain(wrappedDomain.domain);
|
|
17
|
+
if (domain.registration) {
|
|
18
|
+
domain.registration = {
|
|
19
|
+
expiryDate: new Date(parseInt(domain.registration.expiryDate) * 1e3),
|
|
20
|
+
registrationDate: new Date(domain.registration.registrationDate * 1e3)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
17
23
|
return {
|
|
18
24
|
expiryDate: new Date(parseInt(wrappedDomain.expiryDate) * 1e3),
|
|
19
25
|
fuses: decodeFuses(wrappedDomain.fuses),
|
|
@@ -14,6 +14,10 @@ export declare type Name = {
|
|
|
14
14
|
registrationDate?: Date;
|
|
15
15
|
expiryDate?: Date;
|
|
16
16
|
fuses?: CurrentFuses;
|
|
17
|
+
registration?: {
|
|
18
|
+
expiryDate: Date;
|
|
19
|
+
registrationDate: Date;
|
|
20
|
+
};
|
|
17
21
|
type: 'domain' | 'registration' | 'wrappedDomain';
|
|
18
22
|
};
|
|
19
23
|
declare type BaseParams = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
2
|
import { ENSArgs } from '..';
|
|
3
|
-
import
|
|
3
|
+
import { FuseOptions } from '../utils/fuses';
|
|
4
4
|
import { Expiry } from '../utils/wrapper';
|
|
5
5
|
export default function ({ contracts, signer, getExpiry, }: ENSArgs<'contracts' | 'signer' | 'getExpiry'>, name: string, { wrappedOwner, fuseOptions, expiry, resolverAddress, }: {
|
|
6
6
|
wrappedOwner: string;
|
|
@@ -8,6 +8,9 @@ export declare const fuseEnum: {
|
|
|
8
8
|
readonly CANNOT_CREATE_SUBDOMAIN: 32;
|
|
9
9
|
readonly PARENT_CANNOT_CONTROL: 64;
|
|
10
10
|
};
|
|
11
|
+
export declare type FuseOptions = {
|
|
12
|
+
-readonly [K in keyof typeof fuseEnum]?: boolean;
|
|
13
|
+
};
|
|
11
14
|
export declare const unnamedFuses: readonly [128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296];
|
|
12
15
|
declare const fullFuseEnum: {
|
|
13
16
|
CAN_DO_EVERYTHING: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BigNumberish } from 'ethers';
|
|
2
|
-
import type { FuseOptions } from '../@types/FuseOptions';
|
|
3
2
|
import type { PublicResolver } from '../generated';
|
|
3
|
+
import { FuseOptions } from './fuses';
|
|
4
4
|
import { RecordOptions } from './recordHelpers';
|
|
5
5
|
export declare const MAX_INT_64: bigint;
|
|
6
6
|
export declare type BaseRegistrationParams = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BigNumber, ethers } from 'ethers'
|
|
2
2
|
import { ENSArgs } from '..'
|
|
3
|
-
import { FuseOptions } from '
|
|
3
|
+
import { FuseOptions } from '../utils/fuses'
|
|
4
4
|
import generateFuseInput from '../utils/generateFuseInput'
|
|
5
5
|
import { namehash } from '../utils/normalise'
|
|
6
6
|
import { Expiry, makeExpiry, wrappedLabelLengthCheck } from '../utils/wrapper'
|
|
@@ -17,6 +17,10 @@ export type Name = {
|
|
|
17
17
|
registrationDate?: Date
|
|
18
18
|
expiryDate?: Date
|
|
19
19
|
fuses?: CurrentFuses
|
|
20
|
+
registration?: {
|
|
21
|
+
expiryDate: Date
|
|
22
|
+
registrationDate: Date
|
|
23
|
+
}
|
|
20
24
|
type: 'domain' | 'registration' | 'wrappedDomain'
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -66,6 +70,12 @@ const mapDomain = (domain: any) => {
|
|
|
66
70
|
|
|
67
71
|
const mapWrappedDomain = (wrappedDomain: any) => {
|
|
68
72
|
const domain = mapDomain(wrappedDomain.domain)
|
|
73
|
+
if (domain.registration) {
|
|
74
|
+
domain.registration = {
|
|
75
|
+
expiryDate: new Date(parseInt(domain.registration.expiryDate) * 1000),
|
|
76
|
+
registrationDate: new Date(domain.registration.registrationDate * 1000),
|
|
77
|
+
}
|
|
78
|
+
}
|
|
69
79
|
return {
|
|
70
80
|
expiryDate: new Date(parseInt(wrappedDomain.expiryDate) * 1000),
|
|
71
81
|
fuses: decodeFuses(wrappedDomain.fuses),
|
|
@@ -53,8 +53,8 @@ describe('wrapName', () => {
|
|
|
53
53
|
const tx = await ensInstance.wrapName('test123.eth', {
|
|
54
54
|
wrappedOwner: accounts[2],
|
|
55
55
|
fuseOptions: {
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
CANNOT_UNWRAP: true,
|
|
57
|
+
CANNOT_SET_TTL: true,
|
|
58
58
|
},
|
|
59
59
|
addressOrIndex: 1,
|
|
60
60
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BigNumber, ethers } from 'ethers'
|
|
2
2
|
import { ENSArgs } from '..'
|
|
3
|
-
import
|
|
3
|
+
import { FuseOptions } from '../utils/fuses'
|
|
4
4
|
import generateFuseInput from '../utils/generateFuseInput'
|
|
5
5
|
import { hexEncodeName } from '../utils/hexEncodedName'
|
|
6
6
|
import { Expiry, makeExpiry, wrappedLabelLengthCheck } from '../utils/wrapper'
|
package/src/utils/fuses.ts
CHANGED
|
@@ -19,6 +19,8 @@ export const fuseEnum = {
|
|
|
19
19
|
PARENT_CANNOT_CONTROL,
|
|
20
20
|
} as const
|
|
21
21
|
|
|
22
|
+
export type FuseOptions = { -readonly [K in keyof typeof fuseEnum]?: boolean }
|
|
23
|
+
|
|
22
24
|
export const unnamedFuses = [
|
|
23
25
|
128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144,
|
|
24
26
|
524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BigNumberish, utils } from 'ethers'
|
|
2
|
-
import type { FuseOptions } from '../@types/FuseOptions'
|
|
3
2
|
import type { PublicResolver } from '../generated'
|
|
3
|
+
import { FuseOptions } from './fuses'
|
|
4
4
|
import generateFuseInput from './generateFuseInput'
|
|
5
5
|
import { labelhash } from './labels'
|
|
6
6
|
import { namehash } from './normalise'
|