Skip to content

nolanle/mixlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c60f33e · Apr 25, 2023

History

4 Commits
Apr 24, 2023
Apr 25, 2023
Apr 24, 2023
Apr 24, 2023
Apr 24, 2023
Apr 24, 2023
Apr 24, 2023
Apr 24, 2023
Apr 25, 2023
Apr 24, 2023
Apr 24, 2023
Apr 24, 2023
Apr 24, 2023
Apr 24, 2023

Repository files navigation

npm npm-downloads

Installation

First of all, installation step:

  • With npm
npm install @nolanle/mixlib
  • With yarn
yarn add @nolanle/mixlib

Usages

  • Generate Master Key and Mnemonic
import {create, Network} from '@nolanle/mixlib;

<!-- 12 | 15 | 18 | 21 | 24 -->
const count = 12;

<!-- use this -->
const masterKey = await create('Master Key', count);
console.log(masterKey.mnemonic);
  • Derive master key to accounts
const network = new Network('Ethereum', 'ETH', 18, 60);
const ethAccount = masterKey.derive(network);
  • Working with account
const address = ethAccount.toAddress();
const balance = ethAccount.getBalance();
const privkey = ethAccount.toPrivateKey();