@metamask/snaps-rpc-methods
Version:
MetaMask Snaps JSON-RPC method implementations
32 lines • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ethereumProviderEndowmentBuilder = void 0;
const permission_controller_1 = require("@metamask/permission-controller");
const enum_1 = require("./enum.cjs");
const permissionName = enum_1.SnapEndowments.EthereumProvider;
/**
* `endowment:ethereum-provider` returns the name of the ethereum global browser API.
* This is intended to populate the endowments of the
* SES Compartment in which a Snap executes.
*
* This populates the global scope with an EIP-1193 provider, which DOES NOT implement all legacy functionality exposed to dapps.
*
* @param _builderOptions - Optional specification builder options.
* @returns The specification for the network endowment.
*/
const specificationBuilder = (_builderOptions) => {
return {
permissionType: permission_controller_1.PermissionType.Endowment,
targetName: permissionName,
allowedCaveats: null,
endowmentGetter: (_getterOptions) => {
return ['ethereum'];
},
subjectTypes: [permission_controller_1.SubjectType.Snap],
};
};
exports.ethereumProviderEndowmentBuilder = Object.freeze({
targetName: permissionName,
specificationBuilder,
});
//# sourceMappingURL=ethereum-provider.cjs.map