@erc7824/nitrolite
Version:
The Nitrolite SDK empowers developers to build high-performance, scalable web3 applications using state channels. It's designed to provide near-instant transactions and significantly improved user experiences by minimizing direct blockchain interactions.
24 lines (23 loc) • 961 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.noop = exports.statusEnum = exports.addressSchema = exports.hexSchema = exports.ParserParamsMissingError = void 0;
const zod_1 = require("zod");
const types_1 = require("../types");
class ParserParamsMissingError extends Error {
constructor(method) {
super(`Missing params for ${method} parser`);
this.name = 'ParserParamsMissingError';
}
}
exports.ParserParamsMissingError = ParserParamsMissingError;
exports.hexSchema = zod_1.z.string().refine((val) => /^0x[0-9a-fA-F]*$/.test(val), {
message: 'Must be a 0x-prefixed hex string',
});
exports.addressSchema = zod_1.z.string().refine((val) => /^0x[0-9a-fA-F]{40}$/.test(val), {
message: 'Must be a 0x-prefixed hex string of 40 hex chars (EVM address)',
});
exports.statusEnum = zod_1.z.enum(Object.values(types_1.RPCChannelStatus));
const noop = (_) => {
return {};
};
exports.noop = noop;