@metamask/snaps-rpc-methods
Version:
MetaMask Snaps JSON-RPC method implementations
1 lines • 5 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/restricted/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,qBAAiB;AAKzC,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAK3D,OAAO,EAAE,wBAAwB,EAAE,gCAA4B;AAK/D,OAAO,EAAE,sBAAsB,EAAE,8BAA0B;AAE3D,OAAO,EAAE,iBAAiB,EAAE,yBAAqB;AAEjD,OAAO,EAAE,gBAAgB,EAAE,wBAAoB;AAE/C,OAAO,EAAE,qBAAqB,EAAE,6BAAyB;AAEzD,OAAO,EAAE,iBAAiB,EAAE,yBAAqB;AAEjD,OAAO,EAAE,qBAAqB,EAAE,6BAAyB;AAKzD,OAAO,EAAE,kBAAkB,EAAE,0BAAsB;AAEnD,OAAO,EAAE,aAAa,EAAE,qBAAiB;AAGzC,OAAO,EAAE,0BAA0B,EAAE,yBAAqB;AAC1D,OAAO,EAAE,oBAAoB,EAAE,0BAAsB;AAsCrD,MAAM,CAAC,MAAM,kCAAkC,GAG3C;IACF,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,aAAa;IACzC,CAAC,sBAAsB,CAAC,UAAU,CAAC,EAAE,sBAAsB;IAC3D,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,wBAAwB;IAC/D,CAAC,sBAAsB,CAAC,UAAU,CAAC,EAAE,sBAAsB;IAC3D,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,iBAAiB;IACjD,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,iBAAiB;IACjD,CAAC,kBAAkB,CAAC,UAAU,CAAC,EAAE,kBAAkB;IACnD,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,aAAa;IACzC,CAAC,qBAAqB,CAAC,UAAU,CAAC,EAAE,qBAAqB;IACzD,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,gBAAgB;IAC/C,CAAC,qBAAqB,CAAC,UAAU,CAAC,EAAE,qBAAqB;CACjD,CAAC;AAEX,oCAA0B;AAE1B,OAAO,EAAE,qBAAqB,EAAE,qBAAiB","sourcesContent":["import type { Messenger } from '@metamask/messenger';\nimport type {\n PermissionSpecificationBuilder,\n PermissionType,\n RestrictedMethodSpecificationConstraint,\n} from '@metamask/permission-controller';\n\nimport type { DialogMessengerActions } from './dialog';\nimport { dialogBuilder } from './dialog';\nimport type {\n GetBip32EntropyMessengerActions,\n GetBip32EntropyMethodHooks,\n} from './getBip32Entropy';\nimport { getBip32EntropyBuilder } from './getBip32Entropy';\nimport type {\n GetBip32PublicKeyMessengerActions,\n GetBip32PublicKeyMethodHooks,\n} from './getBip32PublicKey';\nimport { getBip32PublicKeyBuilder } from './getBip32PublicKey';\nimport type {\n GetBip44EntropyMessengerActions,\n GetBip44EntropyMethodHooks,\n} from './getBip44Entropy';\nimport { getBip44EntropyBuilder } from './getBip44Entropy';\nimport type { GetEntropyHooks, GetEntropyMessengerActions } from './getEntropy';\nimport { getEntropyBuilder } from './getEntropy';\nimport type { GetLocaleMethodHooks } from './getLocale';\nimport { getLocaleBuilder } from './getLocale';\nimport type { GetPreferencesMethodHooks } from './getPreferences';\nimport { getPreferencesBuilder } from './getPreferences';\nimport type { InvokeSnapMessengerActions } from './invokeSnap';\nimport { invokeSnapBuilder } from './invokeSnap';\nimport type { ManageAccountsMethodHooks } from './manageAccounts';\nimport { manageAccountsBuilder } from './manageAccounts';\nimport type {\n ManageStateMessengerActions,\n ManageStateMethodHooks,\n} from './manageState';\nimport { manageStateBuilder } from './manageState';\nimport type { NotifyMessengerActions, NotifyMethodHooks } from './notify';\nimport { notifyBuilder } from './notify';\nimport type { MethodHooksObject } from '../utils';\n\nexport { WALLET_SNAP_PERMISSION_KEY } from './invokeSnap';\nexport { getEncryptionEntropy } from './manageState';\n\nexport type RestrictedMethodActions =\n | DialogMessengerActions\n | GetBip32EntropyMessengerActions\n | GetBip32PublicKeyMessengerActions\n | GetBip44EntropyMessengerActions\n | GetEntropyMessengerActions\n | InvokeSnapMessengerActions\n | ManageStateMessengerActions\n | NotifyMessengerActions;\n\nexport type RestrictedMethodMessenger = Messenger<\n string,\n RestrictedMethodActions\n>;\n\nexport type RestrictedMethodHooks = GetBip32EntropyMethodHooks &\n GetBip32PublicKeyMethodHooks &\n GetBip44EntropyMethodHooks &\n GetEntropyHooks &\n ManageStateMethodHooks &\n NotifyMethodHooks &\n ManageAccountsMethodHooks &\n GetLocaleMethodHooks &\n GetPreferencesMethodHooks;\n\ntype RestrictedMethodPermissionBuilder = {\n targetName: string;\n specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.RestrictedMethod,\n any,\n RestrictedMethodSpecificationConstraint\n >;\n actionNames?: readonly RestrictedMethodActions['type'][];\n methodHooks?: MethodHooksObject<Record<string, unknown>>;\n};\n\nexport const restrictedMethodPermissionBuilders: Record<\n string,\n RestrictedMethodPermissionBuilder\n> = {\n [dialogBuilder.targetName]: dialogBuilder,\n [getBip32EntropyBuilder.targetName]: getBip32EntropyBuilder,\n [getBip32PublicKeyBuilder.targetName]: getBip32PublicKeyBuilder,\n [getBip44EntropyBuilder.targetName]: getBip44EntropyBuilder,\n [getEntropyBuilder.targetName]: getEntropyBuilder,\n [invokeSnapBuilder.targetName]: invokeSnapBuilder,\n [manageStateBuilder.targetName]: manageStateBuilder,\n [notifyBuilder.targetName]: notifyBuilder,\n [manageAccountsBuilder.targetName]: manageAccountsBuilder,\n [getLocaleBuilder.targetName]: getLocaleBuilder,\n [getPreferencesBuilder.targetName]: getPreferencesBuilder,\n} as const;\n\nexport * from './caveats';\nexport type { DialogApprovalTypes } from './dialog';\nexport { DIALOG_APPROVAL_TYPES } from './dialog';\n"]}