utils library

Functions

bufToHex(Uint8List buf) String
Converts a buffer to a hexadecimal representation
getTokenAmountBigInt(double amount, int decimals) BigInt
Converts an amount in double with the appropriate decimals to a BigInt @param {double} amount - representing the amount as a double @param {int} decimals - Number of decimal points the amount has @returns {BigInt}
getTokenAmountString(String amountBigInt, int decimals) String
Converts an amount in BigInt and decimals to a String with correct decimal point placement
hashBuffer(Uint8List msgBuff) BigInt
Poseidon hash of a generic buffer @param {Uint8List} msgBuff @returns {BigInt} - final hash
hexToBuffer(String source) Uint8List
multiHash(List<BigInt> arr) BigInt
Chunks inputs in five elements and hash with Poseidon all them togheter @param {Array} arr - inputs hash @returns {BigInt} - final hash