UNPKG

@metamask/snaps-rpc-methods

Version:
1 lines 1.83 kB
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/restricted/caveats/index.ts"],"names":[],"mappings":";;;AAGA,iEAG8B;AAC9B,6EAGoC;AACpC,2CAA4E;AAC5E,4DAA4D;AAC5D,gEAAgE;AAChE,4DAA4D;AAC5D,kDAAkD;AAErC,QAAA,oBAAoB,GAAG;IAClC,GAAG,sEAA2C;IAC9C,GAAG,0DAAqC;IACxC,GAAG,oCAA0B;CACrB,CAAC;AAEE,QAAA,aAAa,GAGtB;IACF,CAAC,wCAAsB,CAAC,UAAU,CAAC,EAAE,+DAAoC;IACzE,CAAC,4CAAwB,CAAC,UAAU,CAAC,EAAE,+DAAoC;IAC3E,CAAC,wCAAsB,CAAC,UAAU,CAAC,EAAE,mDAA8B;IACnE,CAAC,8BAAiB,CAAC,UAAU,CAAC,EAAE,6BAAmB;CACpD,CAAC","sourcesContent":["import type { PermissionConstraint } from '@metamask/permission-controller';\nimport type { Json } from '@metamask/utils';\n\nimport {\n permittedCoinTypesCaveatMapper,\n PermittedCoinTypesCaveatSpecification,\n} from './permittedCoinTypes';\nimport {\n permittedDerivationPathsCaveatMapper,\n PermittedDerivationPathsCaveatSpecification,\n} from './permittedDerivationPaths';\nimport { snapIdsCaveatMapper, SnapIdsCaveatSpecification } from './snapIds';\nimport { getBip32EntropyBuilder } from '../getBip32Entropy';\nimport { getBip32PublicKeyBuilder } from '../getBip32PublicKey';\nimport { getBip44EntropyBuilder } from '../getBip44Entropy';\nimport { invokeSnapBuilder } from '../invokeSnap';\n\nexport const caveatSpecifications = {\n ...PermittedDerivationPathsCaveatSpecification,\n ...PermittedCoinTypesCaveatSpecification,\n ...SnapIdsCaveatSpecification,\n} as const;\n\nexport const caveatMappers: Record<\n string,\n (value: Json) => Pick<PermissionConstraint, 'caveats'>\n> = {\n [getBip32EntropyBuilder.targetName]: permittedDerivationPathsCaveatMapper,\n [getBip32PublicKeyBuilder.targetName]: permittedDerivationPathsCaveatMapper,\n [getBip44EntropyBuilder.targetName]: permittedCoinTypesCaveatMapper,\n [invokeSnapBuilder.targetName]: snapIdsCaveatMapper,\n};\n"]}