(prefix: string, words: number[])
| 89 | } |
| 90 | |
| 91 | function bech32Encode(prefix: string, words: number[]): string { |
| 92 | prefix = prefix.toLowerCase() |
| 93 | let chk = bech32PrefixChk(prefix) |
| 94 | let result = prefix + '1' |
| 95 | for (const w of words) { |
| 96 | chk = bech32PolymodStep(chk) ^ w |
| 97 | result += BECH32_ALPHABET[w] |
| 98 | } |
| 99 | for (let i = 0; i < 6; ++i) { chk = bech32PolymodStep(chk) } |
| 100 | chk ^= 1 |
| 101 | for (let i = 0; i < 6; ++i) { result += BECH32_ALPHABET[(chk >> ((5 - i) * 5)) & 0x1f] } |
| 102 | return result |
| 103 | } |
| 104 | |
| 105 | export const toJSON = (input: any) => JSON.stringify(input) |
| 106 |
no test coverage detected