UNPKG

@nucypher/taco

Version:

### [`nucypher/taco-web`](../../README.md)

40 lines 2.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.rpcConditionSchema = exports.RpcConditionType = void 0; const shared_1 = require("@nucypher/shared"); const zod_1 = require("zod"); const common_1 = require("./common"); const context_1 = require("./context"); const return_value_test_1 = require("./return-value-test"); exports.RpcConditionType = 'rpc'; const EthAddressOrContextVariableSchema = zod_1.z.union([ shared_1.EthAddressSchema, common_1.UserAddressSchema, context_1.contextParamSchema, ]); const BlockOrContextParamSchema = zod_1.z .union([shared_1.BlockIdentifierSchema, context_1.contextParamSchema]) .describe('A block identifier or a context variable that will be replaced with a block identifier at execution time.'); // eth_getBalance schema specification // - Ethereum spec: https://ethereum.github.io/execution-apis/api-documentation/ // - web3py: https://web3py.readthedocs.io/en/stable/web3.eth.html#web3.eth.Eth.get_balance exports.rpcConditionSchema = common_1.baseConditionSchema .extend({ conditionType: zod_1.z.literal(exports.RpcConditionType).default(exports.RpcConditionType), chain: zod_1.z.number().int().nonnegative(), method: zod_1.z .enum(['eth_getBalance']) .describe("Only 'eth_getBalance' method is supported"), parameters: zod_1.z.union([ // Spec requires 2 parameters: an address and a block identifier zod_1.z .tuple([EthAddressOrContextVariableSchema, BlockOrContextParamSchema]) .describe('Spec requires 2 parameters - an address and a block identifier'), zod_1.z .tuple([EthAddressOrContextVariableSchema]) .describe("Block identifier, which defaults to 'latest' if not specified"), ]), returnValueTest: return_value_test_1.blockchainReturnValueTestSchema, // Update to allow multiple return values after expanding supported methods }) .describe('RPC Condition for calling [Ethereum JSON RPC APIs](https://ethereum.github.io/execution-apis/api-documentation/)'); //# sourceMappingURL=rpc.js.map