@metamask-previews/chain-agnostic-permission 0.3.0-preview-363db98c → 0.3.0-preview-d987e9b2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +0 -8
  2. package/dist/adapters/caip-permission-adapter-accounts.cjs +26 -143
  3. package/dist/adapters/caip-permission-adapter-accounts.cjs.map +1 -1
  4. package/dist/adapters/caip-permission-adapter-accounts.d.cts +1 -46
  5. package/dist/adapters/caip-permission-adapter-accounts.d.cts.map +1 -1
  6. package/dist/adapters/caip-permission-adapter-accounts.d.mts +1 -46
  7. package/dist/adapters/caip-permission-adapter-accounts.d.mts.map +1 -1
  8. package/dist/adapters/caip-permission-adapter-accounts.mjs +24 -137
  9. package/dist/adapters/caip-permission-adapter-accounts.mjs.map +1 -1
  10. package/dist/adapters/caip-permission-adapter-permittedChains.cjs +31 -125
  11. package/dist/adapters/caip-permission-adapter-permittedChains.cjs.map +1 -1
  12. package/dist/adapters/caip-permission-adapter-permittedChains.d.cts +4 -45
  13. package/dist/adapters/caip-permission-adapter-permittedChains.d.cts.map +1 -1
  14. package/dist/adapters/caip-permission-adapter-permittedChains.d.mts +4 -45
  15. package/dist/adapters/caip-permission-adapter-permittedChains.d.mts.map +1 -1
  16. package/dist/adapters/caip-permission-adapter-permittedChains.mjs +28 -118
  17. package/dist/adapters/caip-permission-adapter-permittedChains.mjs.map +1 -1
  18. package/dist/caip25Permission.cjs +3 -14
  19. package/dist/caip25Permission.cjs.map +1 -1
  20. package/dist/caip25Permission.d.cts +0 -16
  21. package/dist/caip25Permission.d.cts.map +1 -1
  22. package/dist/caip25Permission.d.mts +0 -16
  23. package/dist/caip25Permission.d.mts.map +1 -1
  24. package/dist/caip25Permission.mjs +4 -14
  25. package/dist/caip25Permission.mjs.map +1 -1
  26. package/dist/index.cjs +4 -14
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +5 -5
  29. package/dist/index.d.cts.map +1 -1
  30. package/dist/index.d.mts +5 -5
  31. package/dist/index.d.mts.map +1 -1
  32. package/dist/index.mjs +5 -5
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/scope/authorization.cjs +1 -16
  35. package/dist/scope/authorization.cjs.map +1 -1
  36. package/dist/scope/authorization.d.cts +1 -9
  37. package/dist/scope/authorization.d.cts.map +1 -1
  38. package/dist/scope/authorization.d.mts +1 -9
  39. package/dist/scope/authorization.d.mts.map +1 -1
  40. package/dist/scope/authorization.mjs +0 -14
  41. package/dist/scope/authorization.mjs.map +1 -1
  42. package/dist/scope/constants.cjs +1 -11
  43. package/dist/scope/constants.cjs.map +1 -1
  44. package/dist/scope/constants.d.cts +0 -7
  45. package/dist/scope/constants.d.cts.map +1 -1
  46. package/dist/scope/constants.d.mts +0 -7
  47. package/dist/scope/constants.d.mts.map +1 -1
  48. package/dist/scope/constants.mjs +0 -9
  49. package/dist/scope/constants.mjs.map +1 -1
  50. package/package.json +3 -4
@@ -88,13 +88,4 @@ export var KnownSessionProperties;
88
88
  (function (KnownSessionProperties) {
89
89
  KnownSessionProperties["SolanaAccountChangedNotifications"] = "solana_accountChanged_notifications";
90
90
  })(KnownSessionProperties || (KnownSessionProperties = {}));
91
- /**
92
- * Checks if a given value is a known session property.
93
- *
94
- * @param value - The value to check.
95
- * @returns `true` if the value is a known session property, otherwise `false`.
96
- */
97
- export function isKnownSessionPropertyValue(value) {
98
- return Object.values(KnownSessionProperties).includes(value);
99
- }
100
91
  //# sourceMappingURL=constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../src/scope/constants.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,wBAAuB,4BAA4B;;AAI1D;;GAEG;AACH,MAAM,CAAN,IAAY,sBAEX;AAFD,WAAY,sBAAsB;IAChC,kDAAwB,CAAA;AAC1B,CAAC,EAFW,sBAAsB,KAAtB,sBAAsB,QAEjC;AAED;;GAEG;AACH,MAAM,CA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CAAC,MAAM,kBAAkB,GAC7B;IACE,MAAM,EAAE,CAAC,kBAAkB,CAAC;IAC5B,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;CACX,CAAC;AAEJ;;GAEG;AACH,MAAM,CAAN,IAAY,sBAEX;AAFD,WAAY,sBAAsB;IAChC,mGAAyE,CAAA;AAC3E,CAAC,EAFW,sBAAsB,KAAtB,sBAAsB,QAEjC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAAa;IAEb,OAAO,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,QAAQ,CACnD,KAA+B,CAChC,CAAC;AACJ,CAAC","sourcesContent":["import MetaMaskOpenRPCDocument from '@metamask/api-specs';\n\nimport type { NonWalletKnownCaipNamespace } from './types';\n\n/**\n * ScopeStrings for offchain methods that are not specific to a chainId but are specific to a CAIP namespace.\n */\nexport enum KnownWalletScopeString {\n Eip155 = 'wallet:eip155',\n}\n\n/**\n * Regexes defining how references must be formed for non-wallet known CAIP namespaces\n */\nexport const CaipReferenceRegexes: Record<NonWalletKnownCaipNamespace, RegExp> =\n {\n eip155: /^(0|[1-9][0-9]*)$/u,\n bip122: /.*/u,\n solana: /.*/u,\n };\n\n/**\n * Methods that do not belong exclusively to any CAIP namespace.\n */\nexport const KnownWalletRpcMethods: string[] = [\n 'wallet_registerOnboarding',\n 'wallet_scanQRCode',\n];\n\n/**\n * Methods that belong to the `wallet:eip155` scope.\n */\nconst WalletEip155Methods = ['wallet_addEthereumChain'];\n\n/**\n * Methods that are only supported via the EIP-1193 API.\n */\nexport const Eip1193OnlyMethods = [\n 'wallet_switchEthereumChain',\n 'wallet_getPermissions',\n 'wallet_requestPermissions',\n 'wallet_revokePermissions',\n 'eth_requestAccounts',\n 'eth_accounts',\n 'eth_coinbase',\n 'net_version',\n 'metamask_logWeb3ShimUsage',\n 'metamask_getProviderState',\n 'metamask_sendDomainMetadata',\n 'wallet_registerOnboarding',\n];\n\n/**\n * All MetaMask methods, except for ones we have specified in the constants above.\n */\nconst Eip155Methods = MetaMaskOpenRPCDocument.methods\n .map(({ name }: { name: string }) => name)\n .filter((method: string) => !WalletEip155Methods.includes(method))\n .filter((method: string) => !KnownWalletRpcMethods.includes(method))\n .filter((method: string) => !Eip1193OnlyMethods.includes(method));\n\n/**\n * Methods by ecosystem that are chain specific.\n */\nexport const KnownRpcMethods: Record<NonWalletKnownCaipNamespace, string[]> = {\n eip155: Eip155Methods,\n bip122: [],\n solana: [],\n};\n\n/**\n * Methods for CAIP namespaces that aren't chain specific.\n */\nexport const KnownWalletNamespaceRpcMethods: Record<\n NonWalletKnownCaipNamespace,\n string[]\n> = {\n eip155: WalletEip155Methods,\n bip122: [],\n solana: [],\n};\n\n/**\n * Notifications for known CAIP namespaces.\n */\nexport const KnownNotifications: Record<NonWalletKnownCaipNamespace, string[]> =\n {\n eip155: ['eth_subscription'],\n bip122: [],\n solana: [],\n };\n\n/**\n * Session properties for known CAIP namespaces.\n */\nexport enum KnownSessionProperties {\n SolanaAccountChangedNotifications = 'solana_accountChanged_notifications',\n}\n\n/**\n * Checks if a given value is a known session property.\n *\n * @param value - The value to check.\n * @returns `true` if the value is a known session property, otherwise `false`.\n */\nexport function isKnownSessionPropertyValue(\n value: string,\n): value is KnownSessionProperties {\n return Object.values(KnownSessionProperties).includes(\n value as KnownSessionProperties,\n );\n}\n"]}
1
+ {"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../src/scope/constants.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,wBAAuB,4BAA4B;;AAI1D;;GAEG;AACH,MAAM,CAAN,IAAY,sBAEX;AAFD,WAAY,sBAAsB;IAChC,kDAAwB,CAAA;AAC1B,CAAC,EAFW,sBAAsB,KAAtB,sBAAsB,QAEjC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAC/B;IACE,MAAM,EAAE,oBAAoB;IAC5B,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;CACd,CAAC;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AE;CACX,CAAC;AAEJ;;GAEG;AACH,MAAM,CAAN,IAAY,sBAEX;AAFD,WAAY,sBAAsB;IAChC,mGAAyE,CAAA;AAC3E,CAAC,EAFW,sBAAsB,KAAtB,sBAAsB,QAEjC","sourcesContent":["import MetaMaskOpenRPCDocument from '@metamask/api-specs';\n\nimport type { NonWalletKnownCaipNamespace } from './types';\n\n/**\n * ScopeStrings for offchain methods that are not specific to a chainId but are specific to a CAIP namespace.\n */\nexport enum KnownWalletScopeString {\n Eip155 = 'wallet:eip155',\n}\n\n/**\n * Regexes defining how references must be formed for non-wallet known CAIP namespaces\n */\nexport const CaipReferenceRegexes: Record<NonWalletKnownCaipNamespace, RegExp> =\n {\n eip155: /^(0|[1-9][0-9]*)$/u,\n bip122: /.*/u,\n solana: /.*/u,\n };\n\n/**\n * Methods that do not belong exclusively to any CAIP namespace.\n */\nexport const KnownWalletRpcMethods: string[] = [\n 'wallet_registerOnboarding',\n 'wallet_scanQRCode',\n];\n\n/**\n * Methods that belong to the `wallet:eip155` scope.\n */\nconst WalletEip155Methods = ['wallet_addEthereumChain'];\n\n/**\n * Methods that are only supported via the EIP-1193 API.\n */\nexport const Eip1193OnlyMethods = [\n 'wallet_switchEthereumChain',\n 'wallet_getPermissions',\n 'wallet_requestPermissions',\n 'wallet_revokePermissions',\n 'eth_requestAccounts',\n 'eth_accounts',\n 'eth_coinbase',\n 'net_version',\n 'metamask_logWeb3ShimUsage',\n 'metamask_getProviderState',\n 'metamask_sendDomainMetadata',\n 'wallet_registerOnboarding',\n];\n\n/**\n * All MetaMask methods, except for ones we have specified in the constants above.\n */\nconst Eip155Methods = MetaMaskOpenRPCDocument.methods\n .map(({ name }: { name: string }) => name)\n .filter((method: string) => !WalletEip155Methods.includes(method))\n .filter((method: string) => !KnownWalletRpcMethods.includes(method))\n .filter((method: string) => !Eip1193OnlyMethods.includes(method));\n\n/**\n * Methods by ecosystem that are chain specific.\n */\nexport const KnownRpcMethods: Record<NonWalletKnownCaipNamespace, string[]> = {\n eip155: Eip155Methods,\n bip122: [],\n solana: [],\n};\n\n/**\n * Methods for CAIP namespaces that aren't chain specific.\n */\nexport const KnownWalletNamespaceRpcMethods: Record<\n NonWalletKnownCaipNamespace,\n string[]\n> = {\n eip155: WalletEip155Methods,\n bip122: [],\n solana: [],\n};\n\n/**\n * Notifications for known CAIP namespaces.\n */\nexport const KnownNotifications: Record<NonWalletKnownCaipNamespace, string[]> =\n {\n eip155: ['eth_subscription'],\n bip122: [],\n solana: [],\n };\n\n/**\n * Session properties for known CAIP namespaces.\n */\nexport enum KnownSessionProperties {\n SolanaAccountChangedNotifications = 'solana_accountChanged_notifications',\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/chain-agnostic-permission",
3
- "version": "0.3.0-preview-363db98c",
3
+ "version": "0.3.0-preview-d987e9b2",
4
4
  "description": "Defines a CAIP-25 based endowment permission and helpers for interfacing with it",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -48,8 +48,8 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@metamask/api-specs": "^0.10.12",
51
- "@metamask/controller-utils": "^11.7.0",
52
- "@metamask/network-controller": "^23.2.0",
51
+ "@metamask/controller-utils": "^11.7.1-backport",
52
+ "@metamask/network-controller": "^23.2.1-backport",
53
53
  "@metamask/permission-controller": "^11.0.6",
54
54
  "@metamask/rpc-errors": "^7.0.2",
55
55
  "@metamask/utils": "^11.2.0",
@@ -57,7 +57,6 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@metamask/auto-changelog": "^3.4.4",
60
- "@metamask/keyring-internal-api": "^6.0.1",
61
60
  "@types/jest": "^27.4.1",
62
61
  "deepmerge": "^4.2.2",
63
62
  "jest": "^27.5.1",