@melonproject/token-math
Version:
A small helper library to do precision safe calculations
36 lines (35 loc) • 973 B
TypeScript
import TokenInterface from "../token/TokenInterface";
import QuantityInterface from "./QuantityInterface";
/**
* Shortcut to create a quantity. If second argument is a number,
* the according decimals are appended automatically. So shortest call:
*
* ```typescript
* let someMelons = createQuantity('MLN', 2.34);
*
* // results in:
* someMelons = {
* token: {
* symbol: 'MLN',
* decimals: 18
* }
* quantity: new BigInteger('2340000000000000000');
* }
* ```
*
* This only works if the last argument is a number. Otherwise:
*
* ```typescript
* let someMelons = createQuantity('MLN', "234");
*
* // results in
* someMelons = {
* token: {
* symbol: 'MLN',
* decimals: 18
* }
* quantity: new BigInteger('234');
* }
*/
declare const createQuantity: (tokenOrSymbol: string | TokenInterface, quantityArg: import("../bigInteger/ConvertableBigInteger").default) => QuantityInterface;
export default createQuantity;