mainnet-js 2.7.27 → 2.7.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.
@@ -1,81 +0,0 @@
1
- import { Config } from "./config.js";
2
- import { WORDLIST_CHECKSUMS } from "./constant.js";
3
- import { sha256, binToHex, utf8ToBin } from "@bitauth/libauth";
4
- import { wordlist as czech } from "@scure/bip39/wordlists/czech";
5
- import { wordlist as english } from "@scure/bip39/wordlists/english";
6
- import { wordlist as french } from "@scure/bip39/wordlists/french";
7
- import { wordlist as italian } from "@scure/bip39/wordlists/italian";
8
- import { wordlist as japanese } from "@scure/bip39/wordlists/japanese";
9
- import { wordlist as korean } from "@scure/bip39/wordlists/korean";
10
- import { wordlist as portuguese } from "@scure/bip39/wordlists/portuguese";
11
- import { wordlist as simplifiedChinese } from "@scure/bip39/wordlists/simplified-chinese";
12
- import { wordlist as spanish } from "@scure/bip39/wordlists/spanish";
13
- import { wordlist as traditionalChinese } from "@scure/bip39/wordlists/traditional-chinese";
14
-
15
- test("Should check wordlist checksums", () => {
16
- let wordlists = {
17
- czech: czech,
18
- english: english,
19
- french: french,
20
- italian: italian,
21
- japanese: japanese,
22
- korean: korean,
23
- portuguese: portuguese,
24
- simplifiedChinese: simplifiedChinese,
25
- spanish: spanish,
26
- traditionalChinese: traditionalChinese,
27
- };
28
- for (let l in wordlists) {
29
- let checksum = binToHex(sha256.hash(utf8ToBin(wordlists[l].join(" "))));
30
- expect(WORDLIST_CHECKSUMS[l]).toBe(checksum);
31
- }
32
- });
33
-
34
- test("Should get the default wordlist", () => {
35
- expect(Config.getWordlist().shift()).toBe("abandon");
36
- expect(Config.getWordlist().shift()).toBe("abandon");
37
- expect(Config.getWordlist().pop()).toBe("zoo");
38
- expect(Config.getWordlist().pop()).toBe("zoo");
39
- });
40
-
41
- test("Should get the default wordlist", () => {
42
- Config.setWordlist(czech);
43
- expect(Config.getWordlist().shift()).toBe("abdikace");
44
- expect(Config.getWordlist().pop()).toBe("zvyk");
45
- });
46
-
47
- test("Expect Error setting a bad wordlist to the config", async () => {
48
- expect.assertions(1);
49
- try {
50
- let badList = [...english];
51
- badList.pop();
52
- expect(Config.setWordlist(badList));
53
- } catch (e: any) {
54
- expect(e.message).toBe(
55
- "Error matching provided wordlist to a known list, see @scure/bip39/wordlists"
56
- );
57
- }
58
- });
59
-
60
- test("Should get the default wordlist", () => {
61
- Config.setWordlist(czech);
62
- expect(Config.getWordlist().shift()).toBe("abdikace");
63
- Config.setWordlist(english);
64
- expect(Config.getWordlist().shift()).toBe("abandon");
65
- Config.setWordlist(french);
66
- expect(Config.getWordlist().shift()).toBe("abaisser");
67
- Config.setWordlist(italian);
68
- expect(Config.getWordlist().shift()).toBe("abaco");
69
- Config.setWordlist(japanese);
70
- expect(Config.getWordlist().shift()).toBe("あいこくしん");
71
- Config.setWordlist(korean);
72
- expect(Config.getWordlist().shift()).toBe("가격");
73
- Config.setWordlist(portuguese);
74
- expect(Config.getWordlist().shift()).toBe("abacate");
75
- Config.setWordlist(simplifiedChinese);
76
- expect(Config.getWordlist().shift()).toBe("的");
77
- Config.setWordlist(spanish);
78
- expect(Config.getWordlist().shift()).toBe("ábaco");
79
- Config.setWordlist(traditionalChinese);
80
- expect(Config.getWordlist().shift()).toBe("的");
81
- });