minterjs-util

0.25.1 • Public • Published

minterjs-util

NPM Package Build Status Coverage Status License: MIT

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:

Install

npm install minterjs-util

or from browser

<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

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

Dependencies (8)

Dev Dependencies (27)

Package Sidebar

Install

npm i minterjs-util

Weekly Downloads

67

Version

0.25.1

License

MIT

Unpacked Size

1.26 MB

Total Files

27

Last publish

Collaborators

  • shrpne