@ensdomains/ensjs 3.0.0-alpha.21 → 3.0.0-alpha.22
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/cjs/utils/registerHelpers.js +2 -1
- package/dist/esm/utils/registerHelpers.mjs +2 -1
- package/dist/types/functions/commitName.d.ts +1 -1
- package/dist/types/functions/registerName.d.ts +2 -5
- package/dist/types/utils/fuses.d.ts +2 -0
- package/dist/types/utils/registerHelpers.d.ts +13 -9
- package/package.json +1 -1
- package/src/functions/registerName.ts +2 -5
- package/src/utils/fuses.ts +3 -1
- package/src/utils/registerHelpers.ts +18 -9
|
@@ -36,6 +36,7 @@ var import_generateFuseInput = __toESM(require("./generateFuseInput"));
|
|
|
36
36
|
var import_labels = require("./labels");
|
|
37
37
|
var import_normalise = require("./normalise");
|
|
38
38
|
var import_recordHelpers = require("./recordHelpers");
|
|
39
|
+
const MAX_INT_64 = 2n ** 64n - 1n;
|
|
39
40
|
const randomSecret = () => {
|
|
40
41
|
const bytes = Buffer.allocUnsafe(32);
|
|
41
42
|
return `0x${crypto.getRandomValues(bytes).toString("hex")}`;
|
|
@@ -74,7 +75,7 @@ const makeCommitmentData = ({
|
|
|
74
75
|
secret,
|
|
75
76
|
!!reverseRecord,
|
|
76
77
|
fuseData,
|
|
77
|
-
wrapperExpiry ||
|
|
78
|
+
wrapperExpiry || MAX_INT_64
|
|
78
79
|
];
|
|
79
80
|
};
|
|
80
81
|
const makeRegistrationData = (params) => {
|
|
@@ -4,6 +4,7 @@ import generateFuseInput from "./generateFuseInput.mjs";
|
|
|
4
4
|
import { labelhash } from "./labels.mjs";
|
|
5
5
|
import { namehash } from "./normalise.mjs";
|
|
6
6
|
import { generateRecordCallArray } from "./recordHelpers.mjs";
|
|
7
|
+
var MAX_INT_64 = 2n ** 64n - 1n;
|
|
7
8
|
var randomSecret = () => {
|
|
8
9
|
const bytes = Buffer.allocUnsafe(32);
|
|
9
10
|
return `0x${crypto.getRandomValues(bytes).toString("hex")}`;
|
|
@@ -42,7 +43,7 @@ var makeCommitmentData = ({
|
|
|
42
43
|
secret,
|
|
43
44
|
!!reverseRecord,
|
|
44
45
|
fuseData,
|
|
45
|
-
wrapperExpiry ||
|
|
46
|
+
wrapperExpiry || MAX_INT_64
|
|
46
47
|
];
|
|
47
48
|
};
|
|
48
49
|
var makeRegistrationData = (params) => {
|
|
@@ -7,7 +7,7 @@ export default function ({ contracts }: ENSArgs<'contracts'>, name: string, { re
|
|
|
7
7
|
customData: {
|
|
8
8
|
secret: string;
|
|
9
9
|
commitment: string;
|
|
10
|
-
wrapperExpiry:
|
|
10
|
+
wrapperExpiry: import("ethers").BigNumberish;
|
|
11
11
|
};
|
|
12
12
|
to?: string | undefined;
|
|
13
13
|
from?: string | undefined;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { BigNumber } from 'ethers';
|
|
2
2
|
import { ENSArgs } from '..';
|
|
3
|
-
import {
|
|
4
|
-
declare type Params =
|
|
5
|
-
resolverAddress?: string;
|
|
6
|
-
secret: string;
|
|
7
|
-
wrapperExpiry: number;
|
|
3
|
+
import { BaseRegistrationParams } from '../utils/registerHelpers';
|
|
4
|
+
declare type Params = BaseRegistrationParams & {
|
|
8
5
|
value: BigNumber;
|
|
9
6
|
};
|
|
10
7
|
export default function ({ contracts }: ENSArgs<'contracts'>, name: string, { resolverAddress, value, ...params }: Params): Promise<import("ethers").PopulatedTransaction>;
|
|
@@ -21,6 +21,8 @@ declare const fullFuseEnum: {
|
|
|
21
21
|
export declare type FuseObj = typeof fuseEnum;
|
|
22
22
|
export declare type CurrentFuses = {
|
|
23
23
|
[f in keyof FuseObj]: boolean;
|
|
24
|
+
} & {
|
|
25
|
+
CAN_DO_EVERYTHING: boolean;
|
|
24
26
|
};
|
|
25
27
|
export declare type UnnamedFuseType = typeof unnamedFuses;
|
|
26
28
|
export declare type Fuse = keyof FuseObj;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
+
import { BigNumberish } from 'ethers';
|
|
1
2
|
import type { FuseOptions } from '../@types/FuseOptions';
|
|
2
3
|
import type { PublicResolver } from '../generated';
|
|
3
4
|
import { RecordOptions } from './recordHelpers';
|
|
4
|
-
export declare type
|
|
5
|
-
name: string;
|
|
5
|
+
export declare type BaseRegistrationParams = {
|
|
6
6
|
owner: string;
|
|
7
7
|
duration: number;
|
|
8
8
|
secret: string;
|
|
9
|
-
|
|
9
|
+
resolverAddress?: string;
|
|
10
10
|
records?: RecordOptions;
|
|
11
11
|
reverseRecord?: boolean;
|
|
12
12
|
fuses?: FuseOptions;
|
|
13
|
-
wrapperExpiry
|
|
13
|
+
wrapperExpiry?: BigNumberish;
|
|
14
|
+
};
|
|
15
|
+
export declare type RegistrationParams = Omit<BaseRegistrationParams, 'resolverAddress'> & {
|
|
16
|
+
name: string;
|
|
17
|
+
resolver: PublicResolver;
|
|
14
18
|
};
|
|
15
19
|
export declare type CommitmentParams = Omit<RegistrationParams, 'secret' | 'wrapperExpiry'> & {
|
|
16
20
|
secret?: string;
|
|
17
|
-
wrapperExpiry?:
|
|
21
|
+
wrapperExpiry?: BigNumberish;
|
|
18
22
|
};
|
|
19
23
|
export declare type RegistrationTuple = [
|
|
20
24
|
name: string,
|
|
@@ -25,7 +29,7 @@ export declare type RegistrationTuple = [
|
|
|
25
29
|
data: string[],
|
|
26
30
|
reverseRecord: boolean,
|
|
27
31
|
fuses: string,
|
|
28
|
-
wrapperExpiry:
|
|
32
|
+
wrapperExpiry: BigNumberish
|
|
29
33
|
];
|
|
30
34
|
export declare type CommitmentTuple = [
|
|
31
35
|
labelhash: string,
|
|
@@ -36,12 +40,12 @@ export declare type CommitmentTuple = [
|
|
|
36
40
|
secret: string,
|
|
37
41
|
reverseRecord: boolean,
|
|
38
42
|
fuses: string,
|
|
39
|
-
wrapperExpiry:
|
|
43
|
+
wrapperExpiry: BigNumberish
|
|
40
44
|
];
|
|
41
45
|
export declare const randomSecret: () => string;
|
|
42
46
|
export declare const makeCommitmentData: ({ name, owner, duration, resolver, records, reverseRecord, fuses, wrapperExpiry, secret, }: Omit<RegistrationParams, "secret" | "wrapperExpiry"> & {
|
|
43
47
|
secret?: string | undefined;
|
|
44
|
-
wrapperExpiry?:
|
|
48
|
+
wrapperExpiry?: BigNumberish | undefined;
|
|
45
49
|
} & {
|
|
46
50
|
secret: string;
|
|
47
51
|
}) => CommitmentTuple;
|
|
@@ -50,5 +54,5 @@ export declare const _makeCommitment: (params: CommitmentTuple) => string;
|
|
|
50
54
|
export declare const makeCommitment: ({ secret, ...inputParams }: CommitmentParams) => {
|
|
51
55
|
secret: string;
|
|
52
56
|
commitment: string;
|
|
53
|
-
wrapperExpiry:
|
|
57
|
+
wrapperExpiry: BigNumberish;
|
|
54
58
|
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { BigNumber } from 'ethers'
|
|
2
2
|
import { ENSArgs } from '..'
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
BaseRegistrationParams,
|
|
5
5
|
makeRegistrationData,
|
|
6
6
|
} from '../utils/registerHelpers'
|
|
7
7
|
|
|
8
|
-
type Params =
|
|
9
|
-
resolverAddress?: string
|
|
10
|
-
secret: string
|
|
11
|
-
wrapperExpiry: number
|
|
8
|
+
type Params = BaseRegistrationParams & {
|
|
12
9
|
value: BigNumber
|
|
13
10
|
}
|
|
14
11
|
|
package/src/utils/fuses.ts
CHANGED
|
@@ -29,7 +29,9 @@ const fullFuseEnum = {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export type FuseObj = typeof fuseEnum
|
|
32
|
-
export type CurrentFuses = { [f in keyof FuseObj]: boolean }
|
|
32
|
+
export type CurrentFuses = { [f in keyof FuseObj]: boolean } & {
|
|
33
|
+
CAN_DO_EVERYTHING: boolean
|
|
34
|
+
}
|
|
33
35
|
export type UnnamedFuseType = typeof unnamedFuses
|
|
34
36
|
export type Fuse = keyof FuseObj
|
|
35
37
|
export type UnnamedFuseValues = UnnamedFuseType[number]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { utils } from 'ethers'
|
|
1
|
+
import { BigNumberish, utils } from 'ethers'
|
|
2
2
|
import type { FuseOptions } from '../@types/FuseOptions'
|
|
3
3
|
import type { PublicResolver } from '../generated'
|
|
4
4
|
import generateFuseInput from './generateFuseInput'
|
|
@@ -6,16 +6,25 @@ import { labelhash } from './labels'
|
|
|
6
6
|
import { namehash } from './normalise'
|
|
7
7
|
import { generateRecordCallArray, RecordOptions } from './recordHelpers'
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const MAX_INT_64 = 2n ** 64n - 1n
|
|
10
|
+
|
|
11
|
+
export type BaseRegistrationParams = {
|
|
11
12
|
owner: string
|
|
12
13
|
duration: number
|
|
13
14
|
secret: string
|
|
14
|
-
|
|
15
|
+
resolverAddress?: string
|
|
15
16
|
records?: RecordOptions
|
|
16
17
|
reverseRecord?: boolean
|
|
17
18
|
fuses?: FuseOptions
|
|
18
|
-
wrapperExpiry
|
|
19
|
+
wrapperExpiry?: BigNumberish
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type RegistrationParams = Omit<
|
|
23
|
+
BaseRegistrationParams,
|
|
24
|
+
'resolverAddress'
|
|
25
|
+
> & {
|
|
26
|
+
name: string
|
|
27
|
+
resolver: PublicResolver
|
|
19
28
|
}
|
|
20
29
|
|
|
21
30
|
export type CommitmentParams = Omit<
|
|
@@ -23,7 +32,7 @@ export type CommitmentParams = Omit<
|
|
|
23
32
|
'secret' | 'wrapperExpiry'
|
|
24
33
|
> & {
|
|
25
34
|
secret?: string
|
|
26
|
-
wrapperExpiry?:
|
|
35
|
+
wrapperExpiry?: BigNumberish
|
|
27
36
|
}
|
|
28
37
|
|
|
29
38
|
export type RegistrationTuple = [
|
|
@@ -35,7 +44,7 @@ export type RegistrationTuple = [
|
|
|
35
44
|
data: string[],
|
|
36
45
|
reverseRecord: boolean,
|
|
37
46
|
fuses: string,
|
|
38
|
-
wrapperExpiry:
|
|
47
|
+
wrapperExpiry: BigNumberish,
|
|
39
48
|
]
|
|
40
49
|
|
|
41
50
|
export type CommitmentTuple = [
|
|
@@ -47,7 +56,7 @@ export type CommitmentTuple = [
|
|
|
47
56
|
secret: string,
|
|
48
57
|
reverseRecord: boolean,
|
|
49
58
|
fuses: string,
|
|
50
|
-
wrapperExpiry:
|
|
59
|
+
wrapperExpiry: BigNumberish,
|
|
51
60
|
]
|
|
52
61
|
|
|
53
62
|
export const randomSecret = () => {
|
|
@@ -93,7 +102,7 @@ export const makeCommitmentData = ({
|
|
|
93
102
|
secret,
|
|
94
103
|
!!reverseRecord,
|
|
95
104
|
fuseData,
|
|
96
|
-
wrapperExpiry ||
|
|
105
|
+
wrapperExpiry || MAX_INT_64,
|
|
97
106
|
]
|
|
98
107
|
}
|
|
99
108
|
|