@metamask/snaps-rpc-methods
Version:
MetaMask Snaps JSON-RPC method implementations
86 lines • 5.95 kB
JavaScript
import { HandlerType } from "@metamask/snaps-utils";
import { assetsEndowmentBuilder, getAssetsCaveatMapper } from "./assets.mjs";
import { createMaxRequestTimeMapper, getMaxRequestTimeCaveatMapper, maxRequestTimeCaveatSpecifications } from "./caveats/index.mjs";
import { cronjobCaveatSpecifications, cronjobEndowmentBuilder, getCronjobCaveatMapper } from "./cronjob.mjs";
import { ethereumProviderEndowmentBuilder } from "./ethereum-provider.mjs";
import { homePageEndowmentBuilder } from "./home-page.mjs";
import { getKeyringCaveatMapper, keyringCaveatSpecifications, keyringEndowmentBuilder } from "./keyring.mjs";
import { lifecycleHooksEndowmentBuilder } from "./lifecycle-hooks.mjs";
import { getNameLookupCaveatMapper, nameLookupCaveatSpecifications, nameLookupEndowmentBuilder } from "./name-lookup.mjs";
import { networkAccessEndowmentBuilder } from "./network-access.mjs";
import { getProtocolCaveatMapper, protocolCaveatSpecifications, protocolEndowmentBuilder } from "./protocol.mjs";
import { getRpcCaveatMapper, rpcCaveatSpecifications, rpcEndowmentBuilder } from "./rpc.mjs";
import { settingsPageEndowmentBuilder } from "./settings-page.mjs";
import { getSignatureInsightCaveatMapper, signatureInsightCaveatSpecifications, signatureInsightEndowmentBuilder } from "./signature-insight.mjs";
import { getTransactionInsightCaveatMapper, transactionInsightCaveatSpecifications, transactionInsightEndowmentBuilder } from "./transaction-insight.mjs";
import { webAssemblyEndowmentBuilder } from "./web-assembly.mjs";
export const endowmentPermissionBuilders = {
[]: networkAccessEndowmentBuilder,
[]: transactionInsightEndowmentBuilder,
[]: cronjobEndowmentBuilder,
[]: ethereumProviderEndowmentBuilder,
[]: rpcEndowmentBuilder,
[]: webAssemblyEndowmentBuilder,
[]: nameLookupEndowmentBuilder,
[]: lifecycleHooksEndowmentBuilder,
[]: keyringEndowmentBuilder,
[]: settingsPageEndowmentBuilder,
[]: protocolEndowmentBuilder,
[]: homePageEndowmentBuilder,
[]: signatureInsightEndowmentBuilder,
[]: assetsEndowmentBuilder,
};
export const endowmentCaveatSpecifications = {
...cronjobCaveatSpecifications,
...transactionInsightCaveatSpecifications,
...rpcCaveatSpecifications,
...nameLookupCaveatSpecifications,
...keyringCaveatSpecifications,
...signatureInsightCaveatSpecifications,
...maxRequestTimeCaveatSpecifications,
...protocolCaveatSpecifications,
};
export const endowmentCaveatMappers = {
[]: createMaxRequestTimeMapper(getCronjobCaveatMapper),
[]: createMaxRequestTimeMapper(getTransactionInsightCaveatMapper),
[]: createMaxRequestTimeMapper(getRpcCaveatMapper),
[]: createMaxRequestTimeMapper(getNameLookupCaveatMapper),
[]: createMaxRequestTimeMapper(getKeyringCaveatMapper),
[]: createMaxRequestTimeMapper(getProtocolCaveatMapper),
[]: createMaxRequestTimeMapper(getSignatureInsightCaveatMapper),
[]: getMaxRequestTimeCaveatMapper,
[]: getMaxRequestTimeCaveatMapper,
[]: getMaxRequestTimeCaveatMapper,
[]: createMaxRequestTimeMapper(getAssetsCaveatMapper),
};
// We allow null because a permitted handler does not have an endowment
export const handlerEndowments = {
[]: rpcEndowmentBuilder.targetName,
[]: transactionInsightEndowmentBuilder.targetName,
[]: cronjobEndowmentBuilder.targetName,
[]: nameLookupEndowmentBuilder.targetName,
[]: lifecycleHooksEndowmentBuilder.targetName,
[]: lifecycleHooksEndowmentBuilder.targetName,
[]: lifecycleHooksEndowmentBuilder.targetName,
[]: keyringEndowmentBuilder.targetName,
[]: homePageEndowmentBuilder.targetName,
[]: settingsPageEndowmentBuilder.targetName,
[]: signatureInsightEndowmentBuilder.targetName,
[]: null,
[]: assetsEndowmentBuilder.targetName,
[]: assetsEndowmentBuilder.targetName,
[]: assetsEndowmentBuilder.targetName,
[]: protocolEndowmentBuilder.targetName,
[]: null,
[]: networkAccessEndowmentBuilder.targetName,
};
export * from "./enum.mjs";
export { getRpcCaveatOrigins } from "./rpc.mjs";
export { getSignatureOriginCaveat } from "./signature-insight.mjs";
export { getTransactionOriginCaveat } from "./transaction-insight.mjs";
export { getChainIdsCaveat, getLookupMatchersCaveat } from "./name-lookup.mjs";
export { getKeyringCaveatOrigins } from "./keyring.mjs";
export { getMaxRequestTimeCaveat } from "./caveats/index.mjs";
export { getCronjobCaveatJobs } from "./cronjob.mjs";
export { getProtocolCaveatScopes } from "./protocol.mjs";
//# sourceMappingURL=index.mjs.map