UNPKG

@ledgerhq/coin-tron

Version:
14 lines 732 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hexToAscii = exports.abiEncodeTrc20Transfer = void 0; // see: https://solidity.readthedocs.io/en/v0.6.1/abi-spec.html#function-selector-and-argument-encoding const abiEncodeTrc20Transfer = (address, amount) => { const encodedAddress = address.padStart(64, "0"); const hexAmount = amount.toNumber().toString(16); // convert to hexadecimal const encodedAmount = hexAmount.padStart(64, "0"); return encodedAddress.concat(encodedAmount); }; exports.abiEncodeTrc20Transfer = abiEncodeTrc20Transfer; const hexToAscii = (hex) => Buffer.from(hex, "hex").toString("ascii"); exports.hexToAscii = hexToAscii; //# sourceMappingURL=utils.js.map