# @burner-wallet/assets

> Colection of asset classes and predefined assets to be used in Burner Wallets, as well as the [Burner Factory](https://burnerfactory.com).

Latest version **1.2.0** (published 2020-08-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @burner-wallet/assets
pnpm add @burner-wallet/assets
yarn add @burner-wallet/assets
bun add @burner-wallet/assets
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2020-08-24 |
| First published | 2019-06-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 37.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | dmihal |

## Links

- npm: https://www.npmjs.com/package/@burner-wallet/assets
- npm.io page: https://npm.io/package/@burner-wallet/assets

## Dependencies (2)

- [web3-utils](https://npm.io/package/web3-utils.md) ^1.2.2
- [isomorphic-fetch](https://npm.io/package/isomorphic-fetch.md) ^2.2.1

## Recent versions

- 1.2.0 (latest) — 2020-08-24
- 1.1.2 (next) — 2020-01-28
- 1.1.0-beta.2 (beta) — 2020-01-24
- 1.1.10 — 2020-04-15
- 1.1.9 — 2020-04-14
- 1.1.8 — 2020-04-10
- 1.1.7 — 2020-04-09
- 1.1.6 — 2020-04-09
- 1.1.5 — 2020-02-06
- 1.1.4 — 2020-02-06
- 1.1.3 — 2020-02-02
- 1.1.1 — 2020-01-28
- 1.1.0 — 2020-01-28
- 1.1.0-beta.1 — 2020-01-24
- 1.0.3 — 2020-01-09
- … 29 more at https://npm.io/package/@burner-wallet/assets/versions

## README

# @burner-wallet/assets

Colection of asset classes and predefined assets to be used in Burner Wallets, as well as the
[Burner Factory](https://burnerfactory.com).

## Predefined assets

The package includes predefined assets for ETH, Dai, xDai, USDC, kETH (Kovan ETH), & kDai (Kovan Dai).

```javascript
import { eth, dai, xdai, usdc, keth, kdai } from '@burner-wallet/assets';

const core = new BurnerCore({
  signers: [new InjectedSigner(), new LocalSigner()],
  gateways: [new InfuraGateway(process.env.REACT_APP_INFURA_KEY), new XDaiGateway()],
  assets: [eth, dai, xdai, usdc, keth, kdai],
});
```

## Asset Classes

This package includes classes for defining your own assets.

Most developers will use the `ERC20Asset` for adding new assets.

### ERC20Asset

```javascript
import { ERC20Asset } from '@burner-wallet/assets';

const dai = new ERC20Asset({
  id: 'dai',
  name: 'Dai',
  network: '1',
  address: '0x6b175474e89094c44da98b954eedeac495271d0f',
  usdPrice: 1, // Optional
  icon: 'https://static.burnerfactory.com/icons/mcd.svg', // Optional
  decimals: 18,  // Optional, default is 18
});
```

### ERC777Asset

This class extends ERC20, and provides additional features, primarily the ability to include notes
in the "data" field.

The interface is the same as ERC20Asset.

### NativeAsset

Native assets represent the native asset of an EVM chain, such as ETH, Kovan ETH or xDai.

```javascript
import { NativeAsset } from '@burner-wallet/assets';

const keth = new NativeAsset({
  id: 'keth',
  name: 'kETH',
  network: '42',
});
```

### Asset

This is the base class, representing any fungible asset.

#### Constructor
  constructor({ id, name, network, usdPrice, priceSymbol }: AssetConstructor);

#### Properties
  public id: string;
  public name: string;
  public network: string;
  public type: string | null;

#### Methods

  setCore(core: any): void;
  getTx(txHash: string): Promise<any>;
  getDisplayValue(value: string, decimals?: number): string;
  getUSDValue(value: string, decimals?: number): string;
  getBalance(account: string): Promise<string>;
  getDisplayBalance(account: string, decimals?: number): Promise<string>;
  send(params: any): Promise<any>;
  supportsMessages(): boolean;
  getWeb3(): any;
  stop(): void;

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