@metamask/snaps-rpc-methods
Version:
MetaMask Snaps JSON-RPC method implementations
1 lines • 4.77 kB
Source Map (JSON)
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/restricted/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAQA,yCAAyC;AAKzC,2DAA2D;AAK3D,+DAA+D;AAK/D,2DAA2D;AAE3D,iDAAiD;AAEjD,+CAA+C;AAE/C,yDAAyD;AAEzD,iDAAiD;AAEjD,yDAAyD;AAKzD,mDAAmD;AAEnD,yCAAyC;AAGzC,+CAA0D;AAAjD,wHAAA,0BAA0B,OAAA;AACnC,iDAAqD;AAA5C,mHAAA,oBAAoB,OAAA;AAsChB,QAAA,kCAAkC,GAG3C;IACF,CAAC,sBAAa,CAAC,UAAU,CAAC,EAAE,sBAAa;IACzC,CAAC,wCAAsB,CAAC,UAAU,CAAC,EAAE,wCAAsB;IAC3D,CAAC,4CAAwB,CAAC,UAAU,CAAC,EAAE,4CAAwB;IAC/D,CAAC,wCAAsB,CAAC,UAAU,CAAC,EAAE,wCAAsB;IAC3D,CAAC,8BAAiB,CAAC,UAAU,CAAC,EAAE,8BAAiB;IACjD,CAAC,8BAAiB,CAAC,UAAU,CAAC,EAAE,8BAAiB;IACjD,CAAC,gCAAkB,CAAC,UAAU,CAAC,EAAE,gCAAkB;IACnD,CAAC,sBAAa,CAAC,UAAU,CAAC,EAAE,sBAAa;IACzC,CAAC,sCAAqB,CAAC,UAAU,CAAC,EAAE,sCAAqB;IACzD,CAAC,4BAAgB,CAAC,UAAU,CAAC,EAAE,4BAAgB;IAC/C,CAAC,sCAAqB,CAAC,UAAU,CAAC,EAAE,sCAAqB;CACjD,CAAC;AAEX,sDAA0B;AAE1B,uCAAiD;AAAxC,+GAAA,qBAAqB,OAAA","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"]}