1// import * as bip32 from 'bip32';
2import * as bip39 from 'bip39';
3import { bip32 } from 'bitcoinjs-lib';
4import { Just, Nothing } from 'folktale/maybe';
5import * as kg from 'urbit-key-generation';
6import BridgeWallet from './types/BridgeWallet';
7import { publicToAddress } from './utils/address';
9export const urbitWalletFromTicket = async (
14 return await kg.generateWallet({
17 passphrase: passphrase,
21export const walletFromMnemonic = (
25 skipMnemonicCheck?: boolean
28 skipMnemonicCheck || bip39.validateMnemonic(mnemonic)
29 ? Just(bip39.mnemonicToSeedSync(mnemonic, passphrase))
32 const toWallet = (sd: Buffer, path: string) => {
33 let wal: BridgeWallet;
34 const hd = bip32.fromSeed(sd);
35 // tsc complains because address is not available; it is set on the next line
37 wal = hd.derivePath(path);
38 wal.address = publicToAddress(wal.publicKey);
39 wal.passphrase = passphrase || '';
44 const wallet = seed.chain((sd: Buffer) => toWallet(sd, hdpath));
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list