@ensdomains/ensjs 3.0.0-alpha.51 → 3.0.0-alpha.52
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/fuses.js +3 -2
- package/dist/cjs/utils/normalise.js +17 -9
- package/dist/esm/utils/fuses.mjs +3 -2
- package/dist/esm/utils/normalise.mjs +26 -3
- package/dist/types/contracts/baseRegistrar.d.ts +1 -1
- package/dist/types/contracts/bulkRenewal.d.ts +1 -1
- package/dist/types/contracts/dnsRegistrar.d.ts +1 -1
- package/dist/types/contracts/ethRegistrarController.d.ts +1 -1
- package/dist/types/contracts/multicall.d.ts +1 -1
- package/dist/types/contracts/nameWrapper.d.ts +1 -1
- package/dist/types/contracts/publicResolver.d.ts +1 -1
- package/dist/types/contracts/registry.d.ts +1 -1
- package/dist/types/contracts/reverseRegistrar.d.ts +1 -1
- package/dist/types/contracts/universalResolver.d.ts +1 -1
- package/dist/types/functions/getWrapperData.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/utils/fuses.d.ts +8 -5
- package/dist/types/utils/normalise.d.ts +10 -1
- package/package.json +2 -2
- package/src/functions/getWrapperData.test.ts +7 -1
- package/src/functions/setFuses.test.ts +22 -5
- package/src/utils/fuses.ts +3 -1
- package/src/utils/normalise.ts +42 -3
- package/src/@types/idna-uts46-hx.d.ts +0 -1
package/dist/cjs/utils/fuses.js
CHANGED
|
@@ -46,6 +46,7 @@ const CANNOT_TRANSFER = 4;
|
|
|
46
46
|
const CANNOT_SET_RESOLVER = 8;
|
|
47
47
|
const CANNOT_SET_TTL = 16;
|
|
48
48
|
const CANNOT_CREATE_SUBDOMAIN = 32;
|
|
49
|
+
const CANNOT_APPROVE = 64;
|
|
49
50
|
const PARENT_CANNOT_CONTROL = 65536;
|
|
50
51
|
const IS_DOT_ETH = 131072;
|
|
51
52
|
const CAN_EXTEND_EXPIRY = 262144;
|
|
@@ -59,7 +60,8 @@ const childFuseEnum = {
|
|
|
59
60
|
CANNOT_TRANSFER,
|
|
60
61
|
CANNOT_SET_RESOLVER,
|
|
61
62
|
CANNOT_SET_TTL,
|
|
62
|
-
CANNOT_CREATE_SUBDOMAIN
|
|
63
|
+
CANNOT_CREATE_SUBDOMAIN,
|
|
64
|
+
CANNOT_APPROVE
|
|
63
65
|
};
|
|
64
66
|
const parentFuseEnum = {
|
|
65
67
|
PARENT_CANNOT_CONTROL,
|
|
@@ -79,7 +81,6 @@ const fullFuseEnum = {
|
|
|
79
81
|
CAN_DO_EVERYTHING
|
|
80
82
|
};
|
|
81
83
|
const unnamedChildFuses = [
|
|
82
|
-
64,
|
|
83
84
|
128,
|
|
84
85
|
256,
|
|
85
86
|
512,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,25 +15,28 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
19
|
var normalise_exports = {};
|
|
26
20
|
__export(normalise_exports, {
|
|
21
|
+
beautify: () => beautify,
|
|
22
|
+
emoji: () => emoji,
|
|
23
|
+
isCombiningMark: () => isCombiningMark,
|
|
27
24
|
namehash: () => namehash,
|
|
28
|
-
normalise: () => normalise
|
|
25
|
+
normalise: () => normalise,
|
|
26
|
+
normalizeFragment: () => normalizeFragment,
|
|
27
|
+
shouldEscape: () => shouldEscape,
|
|
28
|
+
split: () => split,
|
|
29
|
+
tokenise: () => tokenise
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(normalise_exports);
|
|
32
|
+
var import_ens_normalize = require("@adraffy/ens-normalize");
|
|
31
33
|
var import_bytes = require("@ethersproject/bytes");
|
|
32
34
|
var import_keccak256 = require("@ethersproject/keccak256");
|
|
33
35
|
var import_strings = require("@ethersproject/strings");
|
|
34
|
-
var import_uts46bundle = __toESM(require("idna-uts46-hx/uts46bundle.js"));
|
|
35
36
|
var import_labels = require("./labels");
|
|
36
37
|
const zeros = new Uint8Array(32);
|
|
37
38
|
zeros.fill(0);
|
|
38
|
-
const normalise = (name) => name ?
|
|
39
|
+
const normalise = (name) => name ? (0, import_ens_normalize.ens_normalize)(name) : name;
|
|
39
40
|
const namehash = (name) => {
|
|
40
41
|
let result = zeros;
|
|
41
42
|
if (name) {
|
|
@@ -55,3 +56,10 @@ const namehash = (name) => {
|
|
|
55
56
|
}
|
|
56
57
|
return result;
|
|
57
58
|
};
|
|
59
|
+
const beautify = import_ens_normalize.ens_beautify;
|
|
60
|
+
const emoji = import_ens_normalize.ens_emoji;
|
|
61
|
+
const normalizeFragment = import_ens_normalize.ens_normalize_fragment;
|
|
62
|
+
const split = import_ens_normalize.ens_split;
|
|
63
|
+
const tokenise = import_ens_normalize.ens_tokenize;
|
|
64
|
+
const isCombiningMark = import_ens_normalize.is_combining_mark;
|
|
65
|
+
const shouldEscape = import_ens_normalize.should_escape;
|
package/dist/esm/utils/fuses.mjs
CHANGED
|
@@ -5,6 +5,7 @@ var CANNOT_TRANSFER = 4;
|
|
|
5
5
|
var CANNOT_SET_RESOLVER = 8;
|
|
6
6
|
var CANNOT_SET_TTL = 16;
|
|
7
7
|
var CANNOT_CREATE_SUBDOMAIN = 32;
|
|
8
|
+
var CANNOT_APPROVE = 64;
|
|
8
9
|
var PARENT_CANNOT_CONTROL = 65536;
|
|
9
10
|
var IS_DOT_ETH = 131072;
|
|
10
11
|
var CAN_EXTEND_EXPIRY = 262144;
|
|
@@ -18,7 +19,8 @@ var childFuseEnum = {
|
|
|
18
19
|
CANNOT_TRANSFER,
|
|
19
20
|
CANNOT_SET_RESOLVER,
|
|
20
21
|
CANNOT_SET_TTL,
|
|
21
|
-
CANNOT_CREATE_SUBDOMAIN
|
|
22
|
+
CANNOT_CREATE_SUBDOMAIN,
|
|
23
|
+
CANNOT_APPROVE
|
|
22
24
|
};
|
|
23
25
|
var parentFuseEnum = {
|
|
24
26
|
PARENT_CANNOT_CONTROL,
|
|
@@ -38,7 +40,6 @@ var fullFuseEnum = {
|
|
|
38
40
|
CAN_DO_EVERYTHING
|
|
39
41
|
};
|
|
40
42
|
var unnamedChildFuses = [
|
|
41
|
-
64,
|
|
42
43
|
128,
|
|
43
44
|
256,
|
|
44
45
|
512,
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
// src/utils/normalise.ts
|
|
2
|
+
import {
|
|
3
|
+
ens_beautify,
|
|
4
|
+
ens_emoji,
|
|
5
|
+
ens_normalize,
|
|
6
|
+
ens_normalize_fragment,
|
|
7
|
+
ens_split,
|
|
8
|
+
ens_tokenize,
|
|
9
|
+
is_combining_mark,
|
|
10
|
+
should_escape
|
|
11
|
+
} from "@adraffy/ens-normalize";
|
|
2
12
|
import { concat, hexlify } from "@ethersproject/bytes";
|
|
3
13
|
import { keccak256 } from "@ethersproject/keccak256";
|
|
4
14
|
import { toUtf8Bytes } from "@ethersproject/strings";
|
|
5
|
-
import uts46 from "idna-uts46-hx/uts46bundle.js";
|
|
6
15
|
import { decodeLabelhash, isEncodedLabelhash } from "./labels.mjs";
|
|
7
16
|
var zeros = new Uint8Array(32);
|
|
8
17
|
zeros.fill(0);
|
|
9
|
-
var normalise = (name) => name ?
|
|
18
|
+
var normalise = (name) => name ? ens_normalize(name) : name;
|
|
10
19
|
var namehash = (name) => {
|
|
11
20
|
let result = zeros;
|
|
12
21
|
if (name) {
|
|
@@ -26,7 +35,21 @@ var namehash = (name) => {
|
|
|
26
35
|
}
|
|
27
36
|
return result;
|
|
28
37
|
};
|
|
38
|
+
var beautify = ens_beautify;
|
|
39
|
+
var emoji = ens_emoji;
|
|
40
|
+
var normalizeFragment = ens_normalize_fragment;
|
|
41
|
+
var split = ens_split;
|
|
42
|
+
var tokenise = ens_tokenize;
|
|
43
|
+
var isCombiningMark = is_combining_mark;
|
|
44
|
+
var shouldEscape = should_escape;
|
|
29
45
|
export {
|
|
46
|
+
beautify,
|
|
47
|
+
emoji,
|
|
48
|
+
isCombiningMark,
|
|
30
49
|
namehash,
|
|
31
|
-
normalise
|
|
50
|
+
normalise,
|
|
51
|
+
normalizeFragment,
|
|
52
|
+
shouldEscape,
|
|
53
|
+
split,
|
|
54
|
+
tokenise
|
|
32
55
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { JsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
-
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated
|
|
2
|
+
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated").BaseRegistrarImplementation;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { JsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
-
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated
|
|
2
|
+
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated").BulkRenewal;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { JsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
-
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated
|
|
2
|
+
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated").DNSRegistrar;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { JsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
-
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated
|
|
2
|
+
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated").ETHRegistrarController;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { JsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
-
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated
|
|
2
|
+
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated").Multicall;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { JsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
-
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated
|
|
2
|
+
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated").NameWrapper;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { JsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
-
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated
|
|
2
|
+
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated").PublicResolver;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { JsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
-
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated
|
|
2
|
+
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated").ENSRegistry;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { JsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
-
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated
|
|
2
|
+
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated").ReverseRegistrar;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { JsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
-
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated
|
|
2
|
+
declare const _default: (provider: JsonRpcProvider, address: string) => import("../generated").UniversalResolver;
|
|
3
3
|
export default _default;
|
|
@@ -32,7 +32,6 @@ declare const _default: {
|
|
|
32
32
|
CAN_DO_EVERYTHING: boolean;
|
|
33
33
|
unnamed: {
|
|
34
34
|
1024: boolean;
|
|
35
|
-
64: boolean;
|
|
36
35
|
128: boolean;
|
|
37
36
|
256: boolean;
|
|
38
37
|
512: boolean;
|
|
@@ -48,6 +47,7 @@ declare const _default: {
|
|
|
48
47
|
CANNOT_SET_RESOLVER: boolean;
|
|
49
48
|
CANNOT_SET_TTL: boolean;
|
|
50
49
|
CANNOT_CREATE_SUBDOMAIN: boolean;
|
|
50
|
+
CANNOT_APPROVE: boolean;
|
|
51
51
|
};
|
|
52
52
|
} | undefined>;
|
|
53
53
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -271,7 +271,6 @@ export declare class ENS {
|
|
|
271
271
|
CAN_DO_EVERYTHING: boolean;
|
|
272
272
|
unnamed: {
|
|
273
273
|
1024: boolean;
|
|
274
|
-
64: boolean;
|
|
275
274
|
128: boolean;
|
|
276
275
|
256: boolean;
|
|
277
276
|
512: boolean;
|
|
@@ -287,6 +286,7 @@ export declare class ENS {
|
|
|
287
286
|
CANNOT_SET_RESOLVER: boolean;
|
|
288
287
|
CANNOT_SET_TTL: boolean;
|
|
289
288
|
CANNOT_CREATE_SUBDOMAIN: boolean;
|
|
289
|
+
CANNOT_APPROVE: boolean;
|
|
290
290
|
};
|
|
291
291
|
} | undefined>;
|
|
292
292
|
}>;
|
|
@@ -508,7 +508,6 @@ export declare class ENS {
|
|
|
508
508
|
CAN_DO_EVERYTHING: boolean;
|
|
509
509
|
unnamed: {
|
|
510
510
|
1024: boolean;
|
|
511
|
-
64: boolean;
|
|
512
511
|
128: boolean;
|
|
513
512
|
256: boolean;
|
|
514
513
|
512: boolean;
|
|
@@ -524,6 +523,7 @@ export declare class ENS {
|
|
|
524
523
|
CANNOT_SET_RESOLVER: boolean;
|
|
525
524
|
CANNOT_SET_TTL: boolean;
|
|
526
525
|
CANNOT_CREATE_SUBDOMAIN: boolean;
|
|
526
|
+
CANNOT_APPROVE: boolean;
|
|
527
527
|
};
|
|
528
528
|
};
|
|
529
529
|
expiryDate: Date;
|
|
@@ -8,6 +8,7 @@ export declare const childFuseEnum: {
|
|
|
8
8
|
readonly CANNOT_SET_RESOLVER: 8;
|
|
9
9
|
readonly CANNOT_SET_TTL: 16;
|
|
10
10
|
readonly CANNOT_CREATE_SUBDOMAIN: 32;
|
|
11
|
+
readonly CANNOT_APPROVE: 64;
|
|
11
12
|
};
|
|
12
13
|
export declare const parentFuseEnum: {
|
|
13
14
|
PARENT_CANNOT_CONTROL: number;
|
|
@@ -27,6 +28,7 @@ export declare const userSettableFuseEnum: {
|
|
|
27
28
|
readonly CANNOT_SET_RESOLVER: 8;
|
|
28
29
|
readonly CANNOT_SET_TTL: 16;
|
|
29
30
|
readonly CANNOT_CREATE_SUBDOMAIN: 32;
|
|
31
|
+
readonly CANNOT_APPROVE: 64;
|
|
30
32
|
};
|
|
31
33
|
export declare const fullFuseEnum: {
|
|
32
34
|
CAN_DO_EVERYTHING: number;
|
|
@@ -39,14 +41,15 @@ export declare const fullFuseEnum: {
|
|
|
39
41
|
CANNOT_SET_RESOLVER: 8;
|
|
40
42
|
CANNOT_SET_TTL: 16;
|
|
41
43
|
CANNOT_CREATE_SUBDOMAIN: 32;
|
|
44
|
+
CANNOT_APPROVE: 64;
|
|
42
45
|
};
|
|
43
|
-
export declare const unnamedChildFuses: readonly [
|
|
46
|
+
export declare const unnamedChildFuses: readonly [128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768];
|
|
44
47
|
export declare const unnamedParentFuses: readonly [524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648];
|
|
45
|
-
export declare const unnamedUserSettableFuses: readonly [
|
|
46
|
-
export declare const childFuseKeys: ("CANNOT_UNWRAP" | "CANNOT_BURN_FUSES" | "CANNOT_TRANSFER" | "CANNOT_SET_RESOLVER" | "CANNOT_SET_TTL" | "CANNOT_CREATE_SUBDOMAIN")[];
|
|
48
|
+
export declare const unnamedUserSettableFuses: readonly [128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648];
|
|
49
|
+
export declare const childFuseKeys: ("CANNOT_UNWRAP" | "CANNOT_BURN_FUSES" | "CANNOT_TRANSFER" | "CANNOT_SET_RESOLVER" | "CANNOT_SET_TTL" | "CANNOT_CREATE_SUBDOMAIN" | "CANNOT_APPROVE")[];
|
|
47
50
|
export declare const parentFuseKeys: ("PARENT_CANNOT_CONTROL" | "CAN_EXTEND_EXPIRY")[];
|
|
48
51
|
export declare const fullParentFuseKeys: ("PARENT_CANNOT_CONTROL" | "CAN_EXTEND_EXPIRY" | "IS_DOT_ETH")[];
|
|
49
|
-
export declare const userSettableFuseKeys: ("CANNOT_UNWRAP" | "CANNOT_BURN_FUSES" | "CANNOT_TRANSFER" | "CANNOT_SET_RESOLVER" | "CANNOT_SET_TTL" | "CANNOT_CREATE_SUBDOMAIN" | "PARENT_CANNOT_CONTROL" | "CAN_EXTEND_EXPIRY")[];
|
|
52
|
+
export declare const userSettableFuseKeys: ("CANNOT_UNWRAP" | "CANNOT_BURN_FUSES" | "CANNOT_TRANSFER" | "CANNOT_SET_RESOLVER" | "CANNOT_SET_TTL" | "CANNOT_CREATE_SUBDOMAIN" | "CANNOT_APPROVE" | "PARENT_CANNOT_CONTROL" | "CAN_EXTEND_EXPIRY")[];
|
|
50
53
|
declare type FuseType<Enum extends Record<string, number>, UnnamedTuple extends readonly number[], CustomFuses extends string = never> = {
|
|
51
54
|
fuse: keyof Enum;
|
|
52
55
|
options: {
|
|
@@ -110,7 +113,6 @@ export declare const decodeFuses: (fuses: number) => {
|
|
|
110
113
|
CAN_DO_EVERYTHING: boolean;
|
|
111
114
|
unnamed: {
|
|
112
115
|
1024: boolean;
|
|
113
|
-
64: boolean;
|
|
114
116
|
128: boolean;
|
|
115
117
|
256: boolean;
|
|
116
118
|
512: boolean;
|
|
@@ -126,6 +128,7 @@ export declare const decodeFuses: (fuses: number) => {
|
|
|
126
128
|
CANNOT_SET_RESOLVER: boolean;
|
|
127
129
|
CANNOT_SET_TTL: boolean;
|
|
128
130
|
CANNOT_CREATE_SUBDOMAIN: boolean;
|
|
131
|
+
CANNOT_APPROVE: boolean;
|
|
129
132
|
};
|
|
130
133
|
};
|
|
131
134
|
export declare const checkPCCBurned: (fuses: number) => boolean;
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { DisallowedToken, EmojiToken, ens_beautify, ens_emoji, ens_normalize_fragment, ens_split, ens_tokenize, IgnoredToken, is_combining_mark, Label, MappedToken, NFCToken, should_escape, StopToken, TextToken, Token, ValidToken } from '@adraffy/ens-normalize';
|
|
2
|
+
export declare const normalise: (name: string) => string;
|
|
2
3
|
export declare const namehash: (name: string) => string;
|
|
4
|
+
export declare const beautify: typeof ens_beautify;
|
|
5
|
+
export declare const emoji: typeof ens_emoji;
|
|
6
|
+
export declare const normalizeFragment: typeof ens_normalize_fragment;
|
|
7
|
+
export declare const split: typeof ens_split;
|
|
8
|
+
export declare const tokenise: typeof ens_tokenize;
|
|
9
|
+
export declare const isCombiningMark: typeof is_combining_mark;
|
|
10
|
+
export declare const shouldEscape: typeof should_escape;
|
|
11
|
+
export type { DisallowedToken, EmojiToken, IgnoredToken, Label, MappedToken, NFCToken, StopToken, TextToken, Token, ValidToken, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ensdomains/ensjs",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.52",
|
|
4
4
|
"description": "ENS javascript library for contract interaction",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"author": "TateB <yo@taytems.xyz>",
|
|
60
60
|
"license": "MIT",
|
|
61
61
|
"dependencies": {
|
|
62
|
+
"@adraffy/ens-normalize": "1.9.0",
|
|
62
63
|
"@ensdomains/address-encoder": "^0.2.18",
|
|
63
64
|
"@ensdomains/content-hash": "^2.5.7",
|
|
64
65
|
"@ensdomains/dnsprovejs": "^0.4.1",
|
|
@@ -67,7 +68,6 @@
|
|
|
67
68
|
"dns-packet": "^5.3.1",
|
|
68
69
|
"graphql": "^16.3.0",
|
|
69
70
|
"graphql-request": "5.1.0",
|
|
70
|
-
"idna-uts46-hx": "3.4.0",
|
|
71
71
|
"pako": "^2.1.0",
|
|
72
72
|
"traverse": "^0.6.6"
|
|
73
73
|
},
|
|
@@ -40,7 +40,12 @@ describe('getWrapperData', () => {
|
|
|
40
40
|
})
|
|
41
41
|
it('should return with other correct fuses', async () => {
|
|
42
42
|
const tx = await ensInstance.setFuses('wrapped.eth', {
|
|
43
|
-
named: [
|
|
43
|
+
named: [
|
|
44
|
+
'CANNOT_UNWRAP',
|
|
45
|
+
'CANNOT_CREATE_SUBDOMAIN',
|
|
46
|
+
'CANNOT_SET_TTL',
|
|
47
|
+
'CANNOT_APPROVE',
|
|
48
|
+
],
|
|
44
49
|
addressOrIndex: 1,
|
|
45
50
|
})
|
|
46
51
|
await tx.wait()
|
|
@@ -52,6 +57,7 @@ describe('getWrapperData', () => {
|
|
|
52
57
|
expect(result.child.CANNOT_UNWRAP).toBe(true)
|
|
53
58
|
expect(result.child.CANNOT_CREATE_SUBDOMAIN).toBe(true)
|
|
54
59
|
expect(result.child.CANNOT_SET_TTL).toBe(true)
|
|
60
|
+
expect(result.child.CANNOT_APPROVE).toBe(true)
|
|
55
61
|
expect(result.parent.IS_DOT_ETH).toBe(true)
|
|
56
62
|
}
|
|
57
63
|
})
|
|
@@ -74,7 +74,12 @@ describe('setFuses', () => {
|
|
|
74
74
|
describe('Array', () => {
|
|
75
75
|
it('should return a setFuses transaction from a named fuse array and succeed', async () => {
|
|
76
76
|
const tx = await ensInstance.setFuses('wrapped.eth', {
|
|
77
|
-
named: [
|
|
77
|
+
named: [
|
|
78
|
+
'CANNOT_UNWRAP',
|
|
79
|
+
'CANNOT_CREATE_SUBDOMAIN',
|
|
80
|
+
'CANNOT_SET_TTL',
|
|
81
|
+
'CANNOT_APPROVE',
|
|
82
|
+
],
|
|
78
83
|
addressOrIndex: accounts[1],
|
|
79
84
|
})
|
|
80
85
|
expect(tx).toBeTruthy()
|
|
@@ -87,6 +92,7 @@ describe('setFuses', () => {
|
|
|
87
92
|
'CANNOT_CREATE_SUBDOMAIN',
|
|
88
93
|
'CANNOT_SET_TTL',
|
|
89
94
|
'PARENT_CANNOT_CONTROL',
|
|
95
|
+
'CANNOT_APPROVE',
|
|
90
96
|
])
|
|
91
97
|
})
|
|
92
98
|
it('should return a setFuses transaction from an unnamed fuse array and succeed', async () => {
|
|
@@ -110,7 +116,12 @@ describe('setFuses', () => {
|
|
|
110
116
|
})
|
|
111
117
|
it('should return a setFuses transaction from both an unnamed and named fuse array and succeed', async () => {
|
|
112
118
|
const tx = await ensInstance.setFuses('wrapped.eth', {
|
|
113
|
-
named: [
|
|
119
|
+
named: [
|
|
120
|
+
'CANNOT_UNWRAP',
|
|
121
|
+
'CANNOT_CREATE_SUBDOMAIN',
|
|
122
|
+
'CANNOT_SET_TTL',
|
|
123
|
+
'CANNOT_APPROVE',
|
|
124
|
+
],
|
|
114
125
|
unnamed: [128, 256, 512],
|
|
115
126
|
addressOrIndex: accounts[1],
|
|
116
127
|
})
|
|
@@ -124,6 +135,7 @@ describe('setFuses', () => {
|
|
|
124
135
|
'CANNOT_CREATE_SUBDOMAIN',
|
|
125
136
|
'CANNOT_SET_TTL',
|
|
126
137
|
'PARENT_CANNOT_CONTROL',
|
|
138
|
+
'CANNOT_APPROVE',
|
|
127
139
|
])
|
|
128
140
|
checkUnnamedFuses(fuses, [128, 256, 512])
|
|
129
141
|
})
|
|
@@ -154,7 +166,7 @@ describe('setFuses', () => {
|
|
|
154
166
|
describe('Number', () => {
|
|
155
167
|
it('should return a setFuses transaction from a number and succeed', async () => {
|
|
156
168
|
const tx = await ensInstance.setFuses('wrapped.eth', {
|
|
157
|
-
number:
|
|
169
|
+
number: 113,
|
|
158
170
|
addressOrIndex: accounts[1],
|
|
159
171
|
})
|
|
160
172
|
expect(tx).toBeTruthy()
|
|
@@ -166,6 +178,7 @@ describe('setFuses', () => {
|
|
|
166
178
|
'CANNOT_UNWRAP',
|
|
167
179
|
'CANNOT_CREATE_SUBDOMAIN',
|
|
168
180
|
'CANNOT_SET_TTL',
|
|
181
|
+
'CANNOT_APPROVE',
|
|
169
182
|
'PARENT_CANNOT_CONTROL',
|
|
170
183
|
])
|
|
171
184
|
})
|
|
@@ -224,7 +237,7 @@ describe('setChildFuses', () => {
|
|
|
224
237
|
const tx = await ensInstance.setChildFuses(
|
|
225
238
|
'test.wrapped-with-subnames.eth',
|
|
226
239
|
{
|
|
227
|
-
fuses: 65537,
|
|
240
|
+
fuses: 65537 + 64,
|
|
228
241
|
addressOrIndex: accounts[1],
|
|
229
242
|
},
|
|
230
243
|
)
|
|
@@ -235,6 +248,10 @@ describe('setChildFuses', () => {
|
|
|
235
248
|
namehash('test.wrapped-with-subnames.eth'),
|
|
236
249
|
)
|
|
237
250
|
|
|
238
|
-
checkFuses(fuses, [
|
|
251
|
+
checkFuses(fuses, [
|
|
252
|
+
'CANNOT_UNWRAP',
|
|
253
|
+
'PARENT_CANNOT_CONTROL',
|
|
254
|
+
'CANNOT_APPROVE',
|
|
255
|
+
])
|
|
239
256
|
})
|
|
240
257
|
})
|
package/src/utils/fuses.ts
CHANGED
|
@@ -5,6 +5,7 @@ const CANNOT_TRANSFER = 4
|
|
|
5
5
|
const CANNOT_SET_RESOLVER = 8
|
|
6
6
|
const CANNOT_SET_TTL = 16
|
|
7
7
|
const CANNOT_CREATE_SUBDOMAIN = 32
|
|
8
|
+
const CANNOT_APPROVE = 64
|
|
8
9
|
|
|
9
10
|
// parent named fuses
|
|
10
11
|
const PARENT_CANNOT_CONTROL = 0x10000
|
|
@@ -26,6 +27,7 @@ export const childFuseEnum = {
|
|
|
26
27
|
CANNOT_SET_RESOLVER,
|
|
27
28
|
CANNOT_SET_TTL,
|
|
28
29
|
CANNOT_CREATE_SUBDOMAIN,
|
|
30
|
+
CANNOT_APPROVE,
|
|
29
31
|
} as const
|
|
30
32
|
|
|
31
33
|
export const parentFuseEnum = {
|
|
@@ -50,7 +52,7 @@ export const fullFuseEnum = {
|
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
export const unnamedChildFuses = [
|
|
53
|
-
|
|
55
|
+
128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768,
|
|
54
56
|
] as const
|
|
55
57
|
|
|
56
58
|
export const unnamedParentFuses = [
|
package/src/utils/normalise.ts
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DisallowedToken,
|
|
3
|
+
EmojiToken,
|
|
4
|
+
ens_beautify,
|
|
5
|
+
ens_emoji,
|
|
6
|
+
ens_normalize,
|
|
7
|
+
ens_normalize_fragment,
|
|
8
|
+
ens_split,
|
|
9
|
+
ens_tokenize,
|
|
10
|
+
IgnoredToken,
|
|
11
|
+
is_combining_mark,
|
|
12
|
+
Label,
|
|
13
|
+
MappedToken,
|
|
14
|
+
NFCToken,
|
|
15
|
+
should_escape,
|
|
16
|
+
StopToken,
|
|
17
|
+
TextToken,
|
|
18
|
+
Token,
|
|
19
|
+
ValidToken,
|
|
20
|
+
} from '@adraffy/ens-normalize'
|
|
1
21
|
import { concat, hexlify } from '@ethersproject/bytes'
|
|
2
22
|
import { keccak256 } from '@ethersproject/keccak256'
|
|
3
23
|
import { toUtf8Bytes } from '@ethersproject/strings'
|
|
4
|
-
import uts46 from 'idna-uts46-hx/uts46bundle.js'
|
|
5
24
|
import { decodeLabelhash, isEncodedLabelhash } from './labels'
|
|
6
25
|
|
|
7
26
|
const zeros = new Uint8Array(32)
|
|
8
27
|
zeros.fill(0)
|
|
9
28
|
|
|
10
|
-
export const normalise = (name: string) =>
|
|
11
|
-
name ? uts46.toUnicode(name, { useStd3ASCII: true }) : name
|
|
29
|
+
export const normalise = (name: string) => (name ? ens_normalize(name) : name)
|
|
12
30
|
|
|
13
31
|
export const namehash = (name: string): string => {
|
|
14
32
|
let result: string | Uint8Array = zeros
|
|
@@ -33,3 +51,24 @@ export const namehash = (name: string): string => {
|
|
|
33
51
|
|
|
34
52
|
return result as string
|
|
35
53
|
}
|
|
54
|
+
|
|
55
|
+
export const beautify = ens_beautify
|
|
56
|
+
export const emoji = ens_emoji
|
|
57
|
+
export const normalizeFragment = ens_normalize_fragment
|
|
58
|
+
export const split = ens_split
|
|
59
|
+
export const tokenise = ens_tokenize
|
|
60
|
+
export const isCombiningMark = is_combining_mark
|
|
61
|
+
export const shouldEscape = should_escape
|
|
62
|
+
|
|
63
|
+
export type {
|
|
64
|
+
DisallowedToken,
|
|
65
|
+
EmojiToken,
|
|
66
|
+
IgnoredToken,
|
|
67
|
+
Label,
|
|
68
|
+
MappedToken,
|
|
69
|
+
NFCToken,
|
|
70
|
+
StopToken,
|
|
71
|
+
TextToken,
|
|
72
|
+
Token,
|
|
73
|
+
ValidToken,
|
|
74
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare module 'idna-uts46-hx/uts46bundle.js'
|