Code Monkey home page Code Monkey logo

minterjs-util's Introduction

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

minterjs-util's People

Contributors

shrpne avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

palem1988

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.