How to create a Simple Wallet

/**
 * nem-library 0.3.0
 */

import {SimpleWallet, Password, NetworkTypes, NEMLibrary} from "nem-library";

// Initialize NEMLibrary for TEST_NET Network
NEMLibrary.bootstrap(NetworkTypes.TEST_NET);

const password = new Password("password");
const simpleWallet = SimpleWallet.create("simple wallet", password);

Source code

How to create a Brain Wallet

/**
 * nem-library 0.3.0
 */

import {BrainWallet, BrainPassword, NetworkTypes, NEMLibrary} from "nem-library";

// Initialize NEMLibrary for TEST_NET Network
NEMLibrary.bootstrap(NetworkTypes.TEST_NET);

const brainPassword =  new BrainPassword("entertain destruction sassy impartial morning electric limit glib bait grape icy measure")
const brainWallet = BrainWallet.create("brain wallet", brainPassword);

Source code

How to create a Simple Wallet from a private key

/**
 * nem-library 0.3.0
 */

import {SimpleWallet, Password, NetworkTypes, NEMLibrary} from "nem-library";
declare let process: any;

// Initialize NEMLibrary for TEST_NET Network
NEMLibrary.bootstrap(NetworkTypes.TEST_NET);

const privateKey: string = process.env.PRIVATE_KEY;


const password = new Password("password");
const simpleWallet = SimpleWallet.createWithPrivateKey("simple wallet", password, privateKey);

Source code

How to open a Wallet

/**
 * nem-library 0.3.0
 */

import {SimpleWallet, Password, NetworkTypes, NEMLibrary} from "nem-library";
declare let process: any;

// Initialize NEMLibrary for TEST_NET Network
NEMLibrary.bootstrap(NetworkTypes.TEST_NET);

const privateKey: string = process.env.PRIVATE_KEY;


const password = new Password("password");
const simpleWallet = SimpleWallet.createWithPrivateKey("simple wallet", password, privateKey);
const account = simpleWallet.open(password);

Source code