# @liquality/cryptoassets

> Common library for liquality wallet

Latest version **2.12.0** (published 2023-12-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @liquality/cryptoassets
pnpm add @liquality/cryptoassets
yarn add @liquality/cryptoassets
bun add @liquality/cryptoassets
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.12.0 |
| Published | 2023-12-07 |
| First published | 2019-04-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 391 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 21 |
| Author | monokh <mnokhb@gmail.com> |
| Maintainers | koderholic, johannafransn, harshjv, liquality-bot, bradley.suira |

## Links

- npm: https://www.npmjs.com/package/@liquality/cryptoassets
- Repository: git@github.com:liquality/wallet-core.git
- npm.io page: https://npm.io/package/@liquality/cryptoassets

## Dependencies (7)

- [bs58](https://npm.io/package/bs58.md) 5.0.0
- [lodash](https://npm.io/package/lodash.md) 4.17.21
- [@types/bs58](https://npm.io/package/@types/bs58.md) 4.0.1
- [bignumber.js](https://npm.io/package/bignumber.js.md) ^9.0.2
- [ethereumjs-util](https://npm.io/package/ethereumjs-util.md) 7.1.5
- [@ethersproject/address](https://npm.io/package/@ethersproject/address.md) 5.7.0
- [bitcoin-address-validation](https://npm.io/package/bitcoin-address-validation.md) 2.2.1

## Recent versions

- 2.12.0 (latest) — 2023-12-07
- 2.3.0 (beta) — 2023-01-27
- 2.11.0 — 2023-05-04
- 2.10.0 — 2023-05-02
- 2.9.0 — 2023-04-20
- 2.8.0 — 2023-03-17
- 2.7.0 — 2023-03-03
- 2.6.0 — 2023-03-03
- 2.5.0 — 2023-03-01
- 2.4.0 — 2023-02-13
- 2.3.1 — 2023-01-30
- 2.2.0 — 2023-01-18
- 2.1.0 — 2022-12-06
- 2.1.0-next.2 — 2022-11-29
- 2.1.0-next.1 — 2022-11-28
- … 116 more at https://npm.io/package/@liquality/cryptoassets/versions

## README

# Wallet Core

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

![](https://img.shields.io/npm/v/@liquality/wallet-core?label=wallet-core)
![master](https://github.com/liquality/wallet-core/actions/workflows/build-test.yml/badge.svg?branch=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.

# Features

- State management
- Seed management and security
- Account management
- Blockchain communication under a common interface, powered by [Chainify](https://github.com/liquality/chainify)
- Retriving balances
- Sending transactions
- Intra and cross chain swaps supporting a host of decentralised exchanges - Liquality, Thorchain, Uniswap, 1inch, Sovryn, Astroport etc.
- Hardware wallet support

# Install

`npm install @liquality/wallet-core`

`yarn add @liquality/wallet-core`

## Usage

```typescript
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](src/types.ts)

```typescript
  {
    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

- [Add Custom Token](https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/store/actions/addCustomToken.test.ts)
- [Export Private Key](https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/store/actions/exportPrivateKey.test.ts)
- [Send Transaction](https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/store/actions/sendTransaction.test.ts)
- [Update Fees](https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/store/actions/updateFees.test.ts)
- [Update Balance](https://github.com/liquality/wallet-core/blob/develop/packages/wallet-core/src/store/actions/updateBalances.test.ts)

## How to run tests

Integration tests are written in [Jest](https://jestjs.io/).

```angular2html
yarn test
```

---
_Source: https://npm.io/package/@liquality/cryptoassets · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
