petcrypt-js-lite
Version:
Universal sdk for PET functionalities
50 lines • 2.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TYPE_LIMIT_MESSAGE = exports.TYPE_LIMIT = exports.PlaintextType = void 0;
var PlaintextType;
(function (PlaintextType) {
PlaintextType[PlaintextType["uint8"] = 0] = "uint8";
PlaintextType[PlaintextType["uint16"] = 1] = "uint16";
PlaintextType[PlaintextType["uint32"] = 2] = "uint32";
PlaintextType[PlaintextType["uint64"] = 3] = "uint64";
PlaintextType[PlaintextType["uint128"] = 4] = "uint128";
PlaintextType[PlaintextType["address"] = 5] = "address";
PlaintextType[PlaintextType["uint256"] = 6] = "uint256";
PlaintextType[PlaintextType["string"] = 7] = "string";
PlaintextType[PlaintextType["bytes2"] = 8] = "bytes2";
PlaintextType[PlaintextType["bytes4"] = 9] = "bytes4";
PlaintextType[PlaintextType["bytes8"] = 10] = "bytes8";
PlaintextType[PlaintextType["bytes16"] = 11] = "bytes16";
PlaintextType[PlaintextType["bytes32"] = 12] = "bytes32";
})(PlaintextType || (exports.PlaintextType = PlaintextType = {}));
(function (PlaintextType) {
function isUint(type) {
return type >= PlaintextType.uint8 && type <= PlaintextType.uint256;
}
PlaintextType.isUint = isUint;
function isBytes(type) {
return type >= PlaintextType.bytes2 && type <= PlaintextType.bytes32;
}
PlaintextType.isBytes = isBytes;
function isString(type) {
return type === PlaintextType.string;
}
PlaintextType.isString = isString;
})(PlaintextType || (exports.PlaintextType = PlaintextType = {}));
exports.TYPE_LIMIT = {
[PlaintextType.uint8]: 255,
[PlaintextType.uint16]: 65535,
[PlaintextType.uint32]: 4294967295,
[PlaintextType.uint64]: BigInt("18446744073709551615"),
[PlaintextType.uint128]: BigInt("340282366920938463463374607431768211455"),
[PlaintextType.uint256]: BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),
};
exports.TYPE_LIMIT_MESSAGE = {
[PlaintextType.uint8]: 'Uint8 must be less than 256',
[PlaintextType.uint16]: 'Uint16 must be less than 65536',
[PlaintextType.uint32]: 'Uint32 must be less than 4294967296',
[PlaintextType.uint64]: 'Uint64 must be less than 18446744073709551616',
[PlaintextType.uint128]: 'Uint128 must be less than 340282366920938463463374607431768211456',
[PlaintextType.uint256]: 'Uint256 must be less than 115792089237316195423570985008687907853269984665640564039457584007913129639936',
};
//# sourceMappingURL=index.js.map