@swaptoshi/dex-module
Version:
Klayr decentralized exchange (dex) on-chain module
10 lines • 487 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toAsciiString = toAsciiString;
const int_1 = require("../int");
function toAsciiString(addr, len) {
if (!int_1.Uint256.from(len).mod(2).eq(0) || int_1.Uint256.from(len).lte(0) || int_1.Uint256.from(len).gt(40))
throw new Error('AddressStringUtil: INVALID_LEN');
return addr.toString('hex').substring(0, parseInt(len, 10)).toUpperCase();
}
//# sourceMappingURL=address_string_util.js.map