UNPKG

1.65 kBTypeScriptView Raw
1/**
2 * A Wordlist represents a collection of language-specific
3 * words used to encode and devoce [[link-bip-39]] encoded data
4 * by mapping words to 11-bit values and vice versa.
5 */
6export declare abstract class Wordlist {
7 locale: string;
8 /**
9 * Creates a new Wordlist instance.
10 *
11 * Sub-classes MUST call this if they provide their own constructor,
12 * passing in the locale string of the language.
13 *
14 * Generally there is no need to create instances of a Wordlist,
15 * since each language-specific Wordlist creates an instance and
16 * there is no state kept internally, so they are safe to share.
17 */
18 constructor(locale: string);
19 /**
20 * Sub-classes may override this to provide a language-specific
21 * method for spliting %%phrase%% into individual words.
22 *
23 * By default, %%phrase%% is split using any sequences of
24 * white-space as defined by regular expressions (i.e. ``/\s+/``).
25 */
26 split(phrase: string): Array<string>;
27 /**
28 * Sub-classes may override this to provider a language-specific
29 * method for joining %%words%% into a phrase.
30 *
31 * By default, %%words%% are joined by a single space.
32 */
33 join(words: Array<string>): string;
34 /**
35 * Maps an 11-bit value into its coresponding word in the list.
36 *
37 * Sub-classes MUST override this.
38 */
39 abstract getWord(index: number): string;
40 /**
41 * Maps a word to its corresponding 11-bit value.
42 *
43 * Sub-classes MUST override this.
44 */
45 abstract getWordIndex(word: string): number;
46}
47//# sourceMappingURL=wordlist.d.ts.map
\No newline at end of file