@nucypher/taco
Version:
### [`nucypher/taco-web`](../../README.md)
37 lines • 1.75 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.blockchainParamOrContextParamSchema = exports.paramOrContextParamSchema = exports.contextParamSchema = void 0;
const zod_1 = require("zod");
const const_1 = require("../const");
const common_1 = require("./common");
const UINT256_MAX = BigInt('115792089237316195423570985008687907853269984665640564039457584007913129639935');
const INT256_MIN = BigInt('-57896044618658097711785492504343953926634992332820282019728792003956564819968');
exports.contextParamSchema = zod_1.z
.string()
.regex(const_1.CONTEXT_PARAM_FULL_MATCH_REGEXP)
.describe(`A Context Parameter i.e. a placeholder used within conditions and specified at the encryption time, whose value is provided at decryption time.`);
const paramSchema = zod_1.z.union([
common_1.plainStringSchema,
zod_1.z.boolean(),
zod_1.z.number(),
zod_1.z.bigint(),
]);
const blockchainParamSchema = zod_1.z
.union([
common_1.plainStringSchema,
zod_1.z.boolean(),
zod_1.z.number().int().safe(),
zod_1.z.bigint().lte(UINT256_MAX).gte(INT256_MIN),
])
.describe('Blockchain-compatible parameter values for blockchain RPC API calls and Smart Contracts functions; numbers must be in safe range and bigints must be in the range [-2^255, 2^256-1]).');
exports.paramOrContextParamSchema = zod_1.z.union([
paramSchema,
exports.contextParamSchema,
zod_1.z.lazy(() => zod_1.z.array(exports.paramOrContextParamSchema)),
]);
exports.blockchainParamOrContextParamSchema = zod_1.z.union([
blockchainParamSchema,
exports.contextParamSchema,
zod_1.z.lazy(() => zod_1.z.array(exports.blockchainParamOrContextParamSchema)),
]);
//# sourceMappingURL=context.js.map