on master help sign in
bridge/src/lib/utils/address.test.ts
19 lines 708 B history raw
1import { mnemonicToSeedSync } from 'bip39';
2import { bip32 } from 'bitcoinjs-lib';
3import { publicToAddress } from './address';
5describe('#bufferedPublicKeyToAddress', () => {
6 // TODO: why does this seemingly work in the Mnemonic login flow, but not in a test?
7 it.skip('derives an address from a public key buffer', () => {
8 const mnemonic =
9 'benefit crew supreme gesture quantum web media hazard theory mercy wing kitten';
10 const hdpath = "m/44'/60'/0'/0/0";
11 const seed = mnemonicToSeedSync(mnemonic);
12 const hd = bip32.fromSeed(seed);
13 const wallet = hd.derivePath(hdpath);
15 const expected = 'foo';
17 expect(publicToAddress(wallet.publicKey)).toEqual(expected);
18 });
19});