# @huma-shan/currency

> Currency tools for Request Network packages.

Latest version **0.13.0** (published 2023-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @huma-shan/currency
pnpm add @huma-shan/currency
yarn add @huma-shan/currency
bun add @huma-shan/currency
```

## Health

**Score 40/100 (D)** — status: abandoned.

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.13.0 |
| Published | 2023-02-12 |
| First published | 2023-02-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=16.0.0 |
| Dependencies | 6 |
| Unpacked size | 191.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 385 |
| Maintainers | huma-shan |
| Keywords | requestnetwork, currency, utils |

## Links

- npm: https://www.npmjs.com/package/@huma-shan/currency
- Repository: https://github.com/RequestNetwork/requestNetwork
- Homepage: https://github.com/RequestNetwork/requestNetwork/tree/master/packages/currency#readme
- Issues: https://github.com/RequestNetwork/requestNetwork/issues
- npm.io page: https://npm.io/package/@huma-shan/currency

## Dependencies (6)

- [tslib](https://npm.io/package/tslib.md) 2.5.0
- [node-dijkstra](https://npm.io/package/node-dijkstra.md) 2.5.0
- [@huma-shan/types](https://npm.io/package/@huma-shan/types.md) 0.40.0
- [@huma-shan/utils](https://npm.io/package/@huma-shan/utils.md) 0.40.0
- [@metamask/contract-metadata](https://npm.io/package/@metamask/contract-metadata.md) 1.31.0
- [multicoin-address-validator](https://npm.io/package/multicoin-address-validator.md) 0.5.2

## Recent versions

- 0.13.0 (latest) — 2023-02-12
- 0.12.0 — 2023-02-09
- 0.11.0 — 2023-02-07
- 0.10.8 — 2023-02-07

## README

# @huma-shan/currency

`@huma-shan/currency` is a typescript library part of the [Request Network protocol](https://github.com/RequestNetwork/requestNetwork).
It is a collection of tools for the currencies shared between the @requestnetwork packages.

## Installation

```bash
npm install @huma-shan/currency
```

## Usage

```javascript
import { RequestLogicTypes } from '@huma-shan/types';
import { Currency, Token } from '@huma-shan/currency';

const decimals = new Currency({
  type: RequestLogicTypes.CURRENCY.ETH,
  value: 'ETH',
}).getDecimals();

console.log(decimals); // 18

const ETHHash = new Currency({
  type: RequestLogicTypes.CURRENCY.ETH,
  value: 'ETH',
}).getHash();

console.log(ETHHash); // 0xF5AF88e117747e87fC5929F2ff87221B1447652E

// Get currencies from their symbol
const ETHCurrency: RequestLogicTypes.ICurrency = Currency.from('ETH');
const FAUCurrency: RequestLogicTypes.ICurrency = Currency.from('DAI');
// Get currencies from their address
const DAICurrency: RequestLogicTypes.ICurrency = Currency.from(
  '0x6B175474E89094C44Da98b954EedeAC495271d0F',
);

console.log(FAUCurrency.toString()); // FAU-rinkeby
console.log(DAICurrency.toString()); // DAI

// Get a token symbol from its address
const FAUToken = Token.from('0xFab46E002BbF0b4509813474841E0716E6730136');

console.log(FAUToken.symbol); // FAU
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
[Read the contributing guide](/CONTRIBUTING.md)

## License

[MIT](/LICENSE)

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