# minterjs-util

> Utils for Minter

Latest version **0.25.1** (published 2023-04-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install minterjs-util
pnpm add minterjs-util
yarn add minterjs-util
bun add minterjs-util
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: insecure dependencies; abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.25.1 |
| Published | 2023-04-05 |
| First published | 2018-07-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 8 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | MinterTeam |
| Maintainers | shrpne |
| Keywords | minter, blockchain |

## Links

- npm: https://www.npmjs.com/package/minterjs-util
- Repository: https://github.com/MinterTeam/minterjs-util
- Homepage: https://github.com/MinterTeam/minterjs-util#readme
- Issues: https://github.com/MinterTeam/minterjs-util/issues
- npm.io page: https://npm.io/package/minterjs-util

## Dependencies (8)

- [bn.js](https://npm.io/package/bn.js.md) ^5.2.1
- [big.js](https://npm.io/package/big.js.md) ^6.2.1
- [secp256k1](https://npm.io/package/secp256k1.md) ^4.0.3
- [buffer-es6](https://npm.io/package/buffer-es6.md) git+https://git@github.com/shrpne/buffer-es6.git#fix-internal-is-buffer
- [ethjs-util](https://npm.io/package/ethjs-util.md) ^0.1.6
- [pretty-num](https://npm.io/package/pretty-num.md) ^0.5.2
- [ethereumjs-util](https://npm.io/package/ethereumjs-util.md) ^7.1.5
- [ethereum-cryptography](https://npm.io/package/ethereum-cryptography.md) 0.1.3

## Recent versions

- 0.25.1 (latest) — 2023-04-05
- 0.23.0-alpha.6 (next) — 2022-04-04
- 0.25.0 — 2023-04-05
- 0.24.2 — 2022-11-17
- 0.24.1 — 2022-06-03
- 0.24.0 — 2022-06-02
- 0.23.0 — 2022-04-12
- 0.23.0-alpha.5 — 2022-04-01
- 0.23.0-alpha.4 — 2022-03-30
- 0.23.0-alpha.3 — 2022-03-09
- 0.23.0-alpha.2 — 2022-03-07
- 0.23.0-alpha.1 — 2022-02-24
- 0.23.0-alpha.0 — 2022-02-24
- 0.22.0 — 2021-12-01
- 0.22.0-alpha.2 — 2021-08-18
- … 69 more at https://npm.io/package/minterjs-util/versions

## README

# minterjs-util

[![NPM Package](https://img.shields.io/npm/v/minterjs-util.svg?style=flat-square)](https://www.npmjs.org/package/minterjs-util)
[![Build Status](https://img.shields.io/github/workflow/status/MinterTeam/minterjs-util/Test?label=test&style=flat-square)](https://github.com/MinterTeam/minterjs-util/actions/workflows/test-with-coverage.yml)
[![Coverage Status](https://img.shields.io/coveralls/github/MinterTeam/minterjs-util/master.svg?style=flat-square)](https://coveralls.io/github/MinterTeam/minterjs-util?branch=master)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square&label=license)](https://github.com/MinterTeam/minterjs-util/blob/master/LICENSE)

A collection of utility functions for Minter

Please note that this package is under active development and is subject to change.

It is complemented by the following packages:
- [minter-js-sdk](https://github.com/MinterTeam/minter-js-sdk) complete JS solution to work with Minter
- [minterjs-wallet](https://github.com/MinterTeam/minterjs-wallet) take care of BIP39 mnemonic phrase, private key and address

## Install

`npm install minterjs-util`

or from browser

```html
<script src="https://unpkg.com/minterjs-util"></script>
<script>
const pips = minterUtil.convertFromPip(1);
const fee = (new minterUtil.FeePrice({/* ... */})).getFeeValue('0x01');
</script>
```

### FeePrice.getFeeValue()
Params:
- txType: number or string, tx type
- options: object
- options.payload: string or Buffer, tx payload
- options.payloadLength: number, length of payload
- options.coinSymbol: string, coin symbol if tx is coin creation (can be replaced with `coinSymbolLength`)
- options.coinSymbolLength: number, coin symbol length if tx is coin creation (can be replaced with `coinSymbol`)
- options.multisendCount: number, count of recipients if tx is multisend

Full example: [github.com/MinterTeam/minterjs-util/blob/master/test/fee.test.js](https://github.com/MinterTeam/minterjs-util/blob/master/test/fee.test.js)
```
import { FeePrice, TX_TYPE } from 'minterjs-util';
const getFeeValue = (new FeePrice({/* ... */})).getFeeValue;

getFeeValue(TX_TYPE.SEND);
// 0.01

getFeeValue(TX_TYPE.SEND, {payload: 'asé'});
// 0.018

getFeeValue(TX_TYPE.CREATE_COIN, {coinSymbol: 'ABCDEFG'});
// 10000

getFeeValue(TX_TYPE.CREATE_COIN, {coinSymbolLength: 6});
// 100000

getFeeValue(TX_TYPE.MULTISEND, {deltaItemCount: 5});
// 0.035
```

## License

MIT License

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