Home

Awesome

Wallet Core

<pre> _ __ ____ __ ______ | | / /___ _/ / /__ / /_ / ____/___ ________ | | /| / / __ `/ / / _ \/ __/ / / / __ \/ ___/ _ \ | |/ |/ / /_/ / / / __/ /_ / /___/ /_/ / / / __/ |__/|__/\__,_/_/_/\___/\__/ \____/\____/_/ \___/ </pre>

master

Wallet Core is a cryptocurrency wallet library in Typescript. It provides an abstracted interface that handles all the necessary internals of a muilti chain wallet. Featuring:

Install

npm install @liquality/wallet-core

yarn add @liquality/wallet-core

Usage

import { setupWallet } from '@liquality/wallet-core';
import defaultOptions from '@liquality/wallet-core/dist/src/walletOptions/defaultOptions' // Default options

const wallet = setupWallet({
  ...defaultOptions,
});

(async () => {
  await wallet.dispatch.createWallet({
    key: 'satoshi',
    mnemonic: 'never gonna give you up never gonna let you down never gonna',
    imported: true,
  });
  await wallet.dispatch.unlockWallet({ key: 'satoshi' });
  await wallet.dispatch.changeActiveNetwork({ network: 'mainnet' });
  console.log(wallet.state); // State will include default accounts
})();

Options

See WalletOptions in types

  {
    initialState?: RootState; // The initial state of the wallet
    crypto: { // Implmenetation for platform specific crypto
      pbkdf2(password: string, salt: string, iterations: number, length: number, digest: string): Promise<string>;
      encrypt(value: string, key: string): Promise<any>;
      decrypt(value: any, key: string): Promise<any>;
    };
    // Handle notifications
    createNotification(notification: Notification): void;
    ...
  }

Examples

How to run tests

Integration tests are written in Jest.

yarn test