symbol / symbol-hd-wallets

Hierarchical-deterministic wallets library for Symbol
BSD 2-Clause "Simplified" License
11 stars 16 forks source link

Refactor implementation for better accessibility #24

Open evias opened 4 years ago

evias commented 4 years ago

It is currently cumbersome to work with this library as it always requires the following:

import {
  ExtendedKey,
  MnemonicPassPhrase,
  Wallet,
} from 'symbol-hd-wallets'

const mnemonic = MnemonicPassPhrase.createRandom()
const xkey = ExtendedKey.createFromSeed(mnemonic.toSeed())
const wallet = new Wallet(xkey)

console.log(`Private Key: ${wallet.getAccount().privateKey}`)
console.log(`Public Key: ${wallet.getAccount().publicKey}`)
console.log(`Address: ${wallet.getAccount().address.plain()}`)

Multiple disadvantages to the above snippet result in following task list: