UNPKG

@metamask/eip-5792-middleware

Version:

Implements the JSON-RPC methods for sending multiple calls from the user's wallet, and checking their status, as referenced in EIP-5792

39 lines 2.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SendCallsStruct = exports.CapabilitiesStruct = exports.GetCapabilitiesStruct = exports.GetCallsStatusStruct = void 0; const superstruct_1 = require("@metamask/superstruct"); const utils_1 = require("@metamask/utils"); // /** Structs **/ // Even though these aren't actually typescript types, these structs essentially represent // runtime types, so we keep them in this file. exports.GetCallsStatusStruct = (0, superstruct_1.tuple)([utils_1.StrictHexStruct]); exports.GetCapabilitiesStruct = (0, superstruct_1.tuple)([ utils_1.HexChecksumAddressStruct, (0, superstruct_1.optional)((0, superstruct_1.array)(utils_1.StrictHexStruct)), ]); const RequiredAssetStruct = (0, superstruct_1.type)({ address: (0, superstruct_1.nonempty)(utils_1.HexChecksumAddressStruct), amount: (0, superstruct_1.nonempty)(utils_1.StrictHexStruct), standard: (0, superstruct_1.nonempty)((0, superstruct_1.string)()), }); exports.CapabilitiesStruct = (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.type)({ optional: (0, superstruct_1.optional)((0, superstruct_1.boolean)()), requiredAssets: (0, superstruct_1.optional)((0, superstruct_1.array)(RequiredAssetStruct)), })); exports.SendCallsStruct = (0, superstruct_1.tuple)([ (0, superstruct_1.object)({ version: (0, superstruct_1.nonempty)((0, superstruct_1.string)()), id: (0, superstruct_1.optional)(utils_1.StrictHexStruct), from: (0, superstruct_1.optional)(utils_1.HexChecksumAddressStruct), chainId: utils_1.StrictHexStruct, atomicRequired: (0, superstruct_1.boolean)(), calls: (0, superstruct_1.array)((0, superstruct_1.object)({ to: (0, superstruct_1.optional)(utils_1.HexChecksumAddressStruct), data: (0, superstruct_1.optional)(utils_1.StrictHexStruct), value: (0, superstruct_1.optional)(utils_1.StrictHexStruct), capabilities: (0, superstruct_1.optional)(exports.CapabilitiesStruct), })), capabilities: (0, superstruct_1.optional)(exports.CapabilitiesStruct), }), ]); //# sourceMappingURL=types.cjs.map