@metamask/gator-permissions-controller 0.7.0 → 1.0.0

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 (62) hide show
  1. package/CHANGELOG.md +30 -2
  2. package/dist/GatorPermissionsController.cjs +30 -48
  3. package/dist/GatorPermissionsController.cjs.map +1 -1
  4. package/dist/GatorPermissionsController.d.cts +2 -7
  5. package/dist/GatorPermissionsController.d.cts.map +1 -1
  6. package/dist/GatorPermissionsController.d.mts +2 -7
  7. package/dist/GatorPermissionsController.d.mts.map +1 -1
  8. package/dist/GatorPermissionsController.mjs +28 -46
  9. package/dist/GatorPermissionsController.mjs.map +1 -1
  10. package/dist/constants.cjs +9 -0
  11. package/dist/constants.cjs.map +1 -0
  12. package/dist/constants.d.cts +6 -0
  13. package/dist/constants.d.cts.map +1 -0
  14. package/dist/constants.d.mts +6 -0
  15. package/dist/constants.d.mts.map +1 -0
  16. package/dist/constants.mjs +6 -0
  17. package/dist/constants.mjs.map +1 -0
  18. package/dist/decodePermission/decodePermission.cjs +58 -13
  19. package/dist/decodePermission/decodePermission.cjs.map +1 -1
  20. package/dist/decodePermission/decodePermission.d.cts +1 -1
  21. package/dist/decodePermission/decodePermission.d.cts.map +1 -1
  22. package/dist/decodePermission/decodePermission.d.mts +1 -1
  23. package/dist/decodePermission/decodePermission.d.mts.map +1 -1
  24. package/dist/decodePermission/decodePermission.mjs +59 -14
  25. package/dist/decodePermission/decodePermission.mjs.map +1 -1
  26. package/dist/decodePermission/types.cjs.map +1 -1
  27. package/dist/decodePermission/types.d.cts +3 -3
  28. package/dist/decodePermission/types.d.cts.map +1 -1
  29. package/dist/decodePermission/types.d.mts +3 -3
  30. package/dist/decodePermission/types.d.mts.map +1 -1
  31. package/dist/decodePermission/types.mjs.map +1 -1
  32. package/dist/decodePermission/utils.cjs +36 -24
  33. package/dist/decodePermission/utils.cjs.map +1 -1
  34. package/dist/decodePermission/utils.d.cts +5 -4
  35. package/dist/decodePermission/utils.d.cts.map +1 -1
  36. package/dist/decodePermission/utils.d.mts +5 -4
  37. package/dist/decodePermission/utils.d.mts.map +1 -1
  38. package/dist/decodePermission/utils.mjs +36 -24
  39. package/dist/decodePermission/utils.mjs.map +1 -1
  40. package/dist/index.cjs +3 -1
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +2 -1
  43. package/dist/index.d.cts.map +1 -1
  44. package/dist/index.d.mts +2 -1
  45. package/dist/index.d.mts.map +1 -1
  46. package/dist/index.mjs +1 -0
  47. package/dist/index.mjs.map +1 -1
  48. package/dist/test/mocks.cjs +25 -50
  49. package/dist/test/mocks.cjs.map +1 -1
  50. package/dist/test/mocks.d.cts +7 -7
  51. package/dist/test/mocks.d.cts.map +1 -1
  52. package/dist/test/mocks.d.mts +7 -7
  53. package/dist/test/mocks.d.mts.map +1 -1
  54. package/dist/test/mocks.mjs +25 -50
  55. package/dist/test/mocks.mjs.map +1 -1
  56. package/dist/types.cjs.map +1 -1
  57. package/dist/types.d.cts +25 -28
  58. package/dist/types.d.cts.map +1 -1
  59. package/dist/types.d.mts +25 -28
  60. package/dist/types.d.mts.map +1 -1
  61. package/dist/types.mjs.map +1 -1
  62. package/package.json +7 -7
@@ -1,11 +1,8 @@
1
1
  export const mockNativeTokenStreamStorageEntry = (chainId) => ({
2
2
  permissionResponse: {
3
- chainId: chainId,
4
- address: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',
5
- signer: {
6
- type: 'account',
7
- data: { address: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' },
8
- },
3
+ chainId,
4
+ from: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',
5
+ to: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63',
9
6
  permission: {
10
7
  type: 'native-token-stream',
11
8
  isAdjustmentAllowed: true,
@@ -18,26 +15,21 @@ export const mockNativeTokenStreamStorageEntry = (chainId) => ({
18
15
  },
19
16
  },
20
17
  context: '0x00000000',
21
- dependencyInfo: [
18
+ dependencies: [
22
19
  {
23
20
  factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',
24
21
  factoryData: '0x0000000',
25
22
  },
26
23
  ],
27
- signerMeta: {
28
- delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',
29
- },
24
+ delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',
30
25
  },
31
26
  siteOrigin: 'http://localhost:8000',
32
27
  });
33
28
  export const mockNativeTokenPeriodicStorageEntry = (chainId) => ({
34
29
  permissionResponse: {
35
- chainId: chainId,
36
- address: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',
37
- signer: {
38
- type: 'account',
39
- data: { address: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' },
40
- },
30
+ chainId,
31
+ from: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',
32
+ to: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63',
41
33
  permission: {
42
34
  type: 'native-token-periodic',
43
35
  isAdjustmentAllowed: true,
@@ -49,26 +41,21 @@ export const mockNativeTokenPeriodicStorageEntry = (chainId) => ({
49
41
  },
50
42
  },
51
43
  context: '0x00000000',
52
- dependencyInfo: [
44
+ dependencies: [
53
45
  {
54
46
  factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',
55
47
  factoryData: '0x0000000',
56
48
  },
57
49
  ],
58
- signerMeta: {
59
- delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',
60
- },
50
+ delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',
61
51
  },
62
52
  siteOrigin: 'http://localhost:8000',
63
53
  });
64
54
  export const mockErc20TokenStreamStorageEntry = (chainId) => ({
65
55
  permissionResponse: {
66
- chainId: chainId,
67
- address: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',
68
- signer: {
69
- type: 'account',
70
- data: { address: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' },
71
- },
56
+ chainId,
57
+ from: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',
58
+ to: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63',
72
59
  permission: {
73
60
  type: 'erc20-token-stream',
74
61
  isAdjustmentAllowed: true,
@@ -82,26 +69,21 @@ export const mockErc20TokenStreamStorageEntry = (chainId) => ({
82
69
  },
83
70
  },
84
71
  context: '0x00000000',
85
- dependencyInfo: [
72
+ dependencies: [
86
73
  {
87
74
  factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',
88
75
  factoryData: '0x0000000',
89
76
  },
90
77
  ],
91
- signerMeta: {
92
- delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',
93
- },
78
+ delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',
94
79
  },
95
80
  siteOrigin: 'http://localhost:8000',
96
81
  });
97
82
  export const mockErc20TokenPeriodicStorageEntry = (chainId) => ({
98
83
  permissionResponse: {
99
- chainId: chainId,
100
- address: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',
101
- signer: {
102
- type: 'account',
103
- data: { address: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' },
104
- },
84
+ chainId,
85
+ from: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',
86
+ to: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63',
105
87
  permission: {
106
88
  type: 'erc20-token-periodic',
107
89
  isAdjustmentAllowed: true,
@@ -114,26 +96,21 @@ export const mockErc20TokenPeriodicStorageEntry = (chainId) => ({
114
96
  },
115
97
  },
116
98
  context: '0x00000000',
117
- dependencyInfo: [
99
+ dependencies: [
118
100
  {
119
101
  factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',
120
102
  factoryData: '0x0000000',
121
103
  },
122
104
  ],
123
- signerMeta: {
124
- delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',
125
- },
105
+ delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',
126
106
  },
127
107
  siteOrigin: 'http://localhost:8000',
128
108
  });
129
109
  export const mockCustomPermissionStorageEntry = (chainId, data) => ({
130
110
  permissionResponse: {
131
- chainId: chainId,
132
- address: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',
133
- signer: {
134
- type: 'account',
135
- data: { address: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' },
136
- },
111
+ chainId,
112
+ from: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',
113
+ to: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63',
137
114
  permission: {
138
115
  type: 'custom',
139
116
  isAdjustmentAllowed: true,
@@ -143,15 +120,13 @@ export const mockCustomPermissionStorageEntry = (chainId, data) => ({
143
120
  },
144
121
  },
145
122
  context: '0x00000000',
146
- dependencyInfo: [
123
+ dependencies: [
147
124
  {
148
125
  factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',
149
126
  factoryData: '0x0000000',
150
127
  },
151
128
  ],
152
- signerMeta: {
153
- delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',
154
- },
129
+ delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',
155
130
  },
156
131
  siteOrigin: 'http://localhost:8000',
157
132
  });
@@ -1 +1 @@
1
- {"version":3,"file":"mocks.mjs","sourceRoot":"","sources":["../../src/test/mocks.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,OAAY,EACuD,EAAE,CAAC,CAAC;IACvE,kBAAkB,EAAE;QAClB,OAAO,EAAE,OAAc;QACvB,OAAO,EAAE,4CAA4C;QACrD,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,EAAE,OAAO,EAAE,4CAA4C,EAAE;SAChE;QACD,UAAU,EAAE;YACV,IAAI,EAA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AAC,CAAC;YACrB,CAAC;QACH,CAAC,CAAC;QAEF,aAAa,CAAC,MAAM,CAAC,iBAAiB,EAAE,GAAG,EAAE,CAC3C,iCAAiC,CAAC,OAAc,CAAC,CAClD,CAAC;QAEF,aAAa,CAAC,MAAM,CAAC,mBAAmB,EAAE,GAAG,EAAE,CAC7C,mCAAmC,CAAC,OAAc,CAAC,CACpD,CAAC;QAEF,aAAa,CAAC,MAAM,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAC1C,gCAAgC,CAAC,OAAc,CAAC,CACjD,CAAC;QAEF,aAAa,CAAC,MAAM,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAC5C,kCAAkC,CAAC,OAAc,CAAC,CACnD,CAAC;QAEF,wBAAwB;QACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7C,MAAM,KAAK,GAAG,gCAAgC,CAC5C,OAAc,EACd,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACtB,CAAC;YACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type {\n AccountSigner,\n Erc20TokenPeriodicPermission,\n Erc20TokenStreamPermission,\n NativeTokenPeriodicPermission,\n NativeTokenStreamPermission,\n} from '@metamask/7715-permission-types';\nimport type { Hex } from '@metamask/utils';\n\nimport type {\n CustomPermission,\n PermissionTypesWithCustom,\n StoredGatorPermission,\n} from '../types';\n\nexport const mockNativeTokenStreamStorageEntry = (\n chainId: Hex,\n): StoredGatorPermission<AccountSigner, NativeTokenStreamPermission> => ({\n permissionResponse: {\n chainId: chainId as Hex,\n address: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',\n signer: {\n type: 'account',\n data: { address: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' },\n },\n permission: {\n type: 'native-token-stream',\n isAdjustmentAllowed: true,\n data: {\n maxAmount: '0x22b1c8c1227a0000',\n initialAmount: '0x6f05b59d3b20000',\n amountPerSecond: '0x6f05b59d3b20000',\n startTime: 1747699200,\n justification:\n 'This is a very important request for streaming allowance for some very important thing',\n },\n },\n context: '0x00000000',\n dependencyInfo: [\n {\n factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',\n factoryData: '0x0000000',\n },\n ],\n signerMeta: {\n delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',\n },\n },\n siteOrigin: 'http://localhost:8000',\n});\n\nexport const mockNativeTokenPeriodicStorageEntry = (\n chainId: Hex,\n): StoredGatorPermission<AccountSigner, NativeTokenPeriodicPermission> => ({\n permissionResponse: {\n chainId: chainId as Hex,\n address: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',\n signer: {\n type: 'account',\n data: { address: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' },\n },\n permission: {\n type: 'native-token-periodic',\n isAdjustmentAllowed: true,\n data: {\n periodAmount: '0x22b1c8c1227a0000',\n periodDuration: 1747699200,\n startTime: 1747699200,\n justification:\n 'This is a very important request for streaming allowance for some very important thing',\n },\n },\n context: '0x00000000',\n dependencyInfo: [\n {\n factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',\n factoryData: '0x0000000',\n },\n ],\n signerMeta: {\n delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',\n },\n },\n siteOrigin: 'http://localhost:8000',\n});\n\nexport const mockErc20TokenStreamStorageEntry = (\n chainId: Hex,\n): StoredGatorPermission<AccountSigner, Erc20TokenStreamPermission> => ({\n permissionResponse: {\n chainId: chainId as Hex,\n address: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',\n signer: {\n type: 'account',\n data: { address: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' },\n },\n permission: {\n type: 'erc20-token-stream',\n isAdjustmentAllowed: true,\n data: {\n initialAmount: '0x22b1c8c1227a0000',\n maxAmount: '0x6f05b59d3b20000',\n amountPerSecond: '0x6f05b59d3b20000',\n startTime: 1747699200,\n tokenAddress: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',\n justification:\n 'This is a very important request for streaming allowance for some very important thing',\n },\n },\n context: '0x00000000',\n dependencyInfo: [\n {\n factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',\n factoryData: '0x0000000',\n },\n ],\n signerMeta: {\n delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',\n },\n },\n siteOrigin: 'http://localhost:8000',\n});\n\nexport const mockErc20TokenPeriodicStorageEntry = (\n chainId: Hex,\n): StoredGatorPermission<AccountSigner, Erc20TokenPeriodicPermission> => ({\n permissionResponse: {\n chainId: chainId as Hex,\n address: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',\n signer: {\n type: 'account',\n data: { address: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' },\n },\n permission: {\n type: 'erc20-token-periodic',\n isAdjustmentAllowed: true,\n data: {\n periodAmount: '0x22b1c8c1227a0000',\n periodDuration: 1747699200,\n startTime: 1747699200,\n tokenAddress: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',\n justification:\n 'This is a very important request for streaming allowance for some very important thing',\n },\n },\n context: '0x00000000',\n dependencyInfo: [\n {\n factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',\n factoryData: '0x0000000',\n },\n ],\n signerMeta: {\n delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',\n },\n },\n siteOrigin: 'http://localhost:8000',\n});\n\nexport const mockCustomPermissionStorageEntry = (\n chainId: Hex,\n data: Record<string, unknown>,\n): StoredGatorPermission<AccountSigner, CustomPermission> => ({\n permissionResponse: {\n chainId: chainId as Hex,\n address: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',\n signer: {\n type: 'account',\n data: { address: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' },\n },\n permission: {\n type: 'custom',\n isAdjustmentAllowed: true,\n data: {\n justification:\n 'This is a very important request for streaming allowance for some very important thing',\n ...data,\n },\n },\n context: '0x00000000',\n dependencyInfo: [\n {\n factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',\n factoryData: '0x0000000',\n },\n ],\n signerMeta: {\n delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',\n },\n },\n siteOrigin: 'http://localhost:8000',\n});\n\nexport type MockGatorPermissionsStorageEntriesConfig = {\n [chainId: string]: {\n nativeTokenStream: number;\n nativeTokenPeriodic: number;\n erc20TokenStream: number;\n erc20TokenPeriodic: number;\n custom: {\n count: number;\n data: Record<string, unknown>[];\n };\n };\n};\n\n/**\n * Creates a mock gator permissions storage entry\n *\n * @param config - The config for the mock gator permissions storage entries.\n * @returns Mock gator permissions storage entry\n */\n/**\n * Creates mock gator permissions storage entries with unique expiry times\n *\n * @param config - The config for the mock gator permissions storage entries.\n * @returns Mock gator permissions storage entries\n */\nexport function mockGatorPermissionsStorageEntriesFactory(\n config: MockGatorPermissionsStorageEntriesConfig,\n): StoredGatorPermission<AccountSigner, PermissionTypesWithCustom>[] {\n const result: StoredGatorPermission<\n AccountSigner,\n PermissionTypesWithCustom\n >[] = [];\n\n Object.entries(config).forEach(([chainId, counts]) => {\n if (counts.custom.count !== counts.custom.data.length) {\n throw new Error('Custom permission count and data length mismatch');\n }\n\n /**\n * Creates a number of entries with unique expiry times\n *\n * @param count - The number of entries to create.\n * @param createEntry - The function to create an entry.\n */\n const createEntries = (\n count: number,\n createEntry: () => StoredGatorPermission<\n AccountSigner,\n PermissionTypesWithCustom\n >,\n ) => {\n for (let i = 0; i < count; i++) {\n const entry = createEntry();\n result.push(entry);\n }\n };\n\n createEntries(counts.nativeTokenStream, () =>\n mockNativeTokenStreamStorageEntry(chainId as Hex),\n );\n\n createEntries(counts.nativeTokenPeriodic, () =>\n mockNativeTokenPeriodicStorageEntry(chainId as Hex),\n );\n\n createEntries(counts.erc20TokenStream, () =>\n mockErc20TokenStreamStorageEntry(chainId as Hex),\n );\n\n createEntries(counts.erc20TokenPeriodic, () =>\n mockErc20TokenPeriodicStorageEntry(chainId as Hex),\n );\n\n // Create custom entries\n for (let i = 0; i < counts.custom.count; i++) {\n const entry = mockCustomPermissionStorageEntry(\n chainId as Hex,\n counts.custom.data[i],\n );\n result.push(entry);\n }\n });\n\n return result;\n}\n"]}
1
+ {"version":3,"file":"mocks.mjs","sourceRoot":"","sources":["../../src/test/mocks.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,OAAY,EACwC,EAAE,CAAC,CAAC;IACxD,kBAAkB,EAAE;QAClB,OAAO;QACP,IAAI,EAAE,4CAA4C;QAClD,EAAE,EAAE,4CAA4C;QAChD,UAAU,EAAE;YACV,IAAI,EAAE,qBAAqB;YAC3B,mBAAmB,EAAE,IAAI;YACzB,IAAI,EAAE;gBACJ,SAAS,EAAE,oBAAoB;gBAC/B,aAAa,EAAE,mBAAmB;gBAClC,eAAe,EAAE,mBAAmB;gBACpC,SAAS,EAAE,UAAU;gBACrB,aAAa,EACX,wFAAwF;aAC3F;SACF;QACD,OAAO,EAAE,YAAY;QACrB,YAAY,EAAE;YACZ;gBACE,OAAO,EAAE,4CAA4C;gBACrD,WAAW,EAAE,WAAW;aACzB;SACF;QACD,iBAAiB,EAAE,4CAA4C;KAChE;IACD,UAAU,EAAE,uBAAuB;CACpC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CACjD,OAAY,EAC0C,EAAE,CAAC,CAAC;IAC1D,kBAAkB,EAAE;QAClB,OAAO;QACP,IAAI,EAAE,4CAA4C;QAClD,EAAE,EAAE,4CAA4C;QAChD,UAAU,EAAE;YACV,IAAI,EAAE,uBAAuB;YAC7B,mBAAmB,EAAE,IAA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E,EAC7D,EAAE;YACR,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/B,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;gBAC5B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACH,CAAC,CAAC;QAEF,aAAa,CAAC,MAAM,CAAC,iBAAiB,EAAE,GAAG,EAAE,CAC3C,iCAAiC,CAAC,OAAc,CAAC,CAClD,CAAC;QAEF,aAAa,CAAC,MAAM,CAAC,mBAAmB,EAAE,GAAG,EAAE,CAC7C,mCAAmC,CAAC,OAAc,CAAC,CACpD,CAAC;QAEF,aAAa,CAAC,MAAM,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAC1C,gCAAgC,CAAC,OAAc,CAAC,CACjD,CAAC;QAEF,aAAa,CAAC,MAAM,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAC5C,kCAAkC,CAAC,OAAc,CAAC,CACnD,CAAC;QAEF,wBAAwB;QACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7C,MAAM,KAAK,GAAG,gCAAgC,CAC5C,OAAc,EACd,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACtB,CAAC;YACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type {\n Erc20TokenPeriodicPermission,\n Erc20TokenStreamPermission,\n NativeTokenPeriodicPermission,\n NativeTokenStreamPermission,\n} from '@metamask/7715-permission-types';\nimport type { Hex } from '@metamask/utils';\n\nimport type {\n CustomPermission,\n PermissionTypesWithCustom,\n StoredGatorPermission,\n} from '../types';\n\nexport const mockNativeTokenStreamStorageEntry = (\n chainId: Hex,\n): StoredGatorPermission<NativeTokenStreamPermission> => ({\n permissionResponse: {\n chainId,\n from: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',\n to: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63',\n permission: {\n type: 'native-token-stream',\n isAdjustmentAllowed: true,\n data: {\n maxAmount: '0x22b1c8c1227a0000',\n initialAmount: '0x6f05b59d3b20000',\n amountPerSecond: '0x6f05b59d3b20000',\n startTime: 1747699200,\n justification:\n 'This is a very important request for streaming allowance for some very important thing',\n },\n },\n context: '0x00000000',\n dependencies: [\n {\n factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',\n factoryData: '0x0000000',\n },\n ],\n delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',\n },\n siteOrigin: 'http://localhost:8000',\n});\n\nexport const mockNativeTokenPeriodicStorageEntry = (\n chainId: Hex,\n): StoredGatorPermission<NativeTokenPeriodicPermission> => ({\n permissionResponse: {\n chainId,\n from: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',\n to: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63',\n permission: {\n type: 'native-token-periodic',\n isAdjustmentAllowed: true,\n data: {\n periodAmount: '0x22b1c8c1227a0000',\n periodDuration: 1747699200,\n startTime: 1747699200,\n justification:\n 'This is a very important request for streaming allowance for some very important thing',\n },\n },\n context: '0x00000000',\n dependencies: [\n {\n factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',\n factoryData: '0x0000000',\n },\n ],\n delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',\n },\n siteOrigin: 'http://localhost:8000',\n});\n\nexport const mockErc20TokenStreamStorageEntry = (\n chainId: Hex,\n): StoredGatorPermission<Erc20TokenStreamPermission> => ({\n permissionResponse: {\n chainId,\n from: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',\n to: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63',\n permission: {\n type: 'erc20-token-stream',\n isAdjustmentAllowed: true,\n data: {\n initialAmount: '0x22b1c8c1227a0000',\n maxAmount: '0x6f05b59d3b20000',\n amountPerSecond: '0x6f05b59d3b20000',\n startTime: 1747699200,\n tokenAddress: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',\n justification:\n 'This is a very important request for streaming allowance for some very important thing',\n },\n },\n context: '0x00000000',\n dependencies: [\n {\n factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',\n factoryData: '0x0000000',\n },\n ],\n delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',\n },\n siteOrigin: 'http://localhost:8000',\n});\n\nexport const mockErc20TokenPeriodicStorageEntry = (\n chainId: Hex,\n): StoredGatorPermission<Erc20TokenPeriodicPermission> => ({\n permissionResponse: {\n chainId,\n from: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',\n to: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63',\n permission: {\n type: 'erc20-token-periodic',\n isAdjustmentAllowed: true,\n data: {\n periodAmount: '0x22b1c8c1227a0000',\n periodDuration: 1747699200,\n startTime: 1747699200,\n tokenAddress: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',\n justification:\n 'This is a very important request for streaming allowance for some very important thing',\n },\n },\n context: '0x00000000',\n dependencies: [\n {\n factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',\n factoryData: '0x0000000',\n },\n ],\n delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',\n },\n siteOrigin: 'http://localhost:8000',\n});\n\nexport const mockCustomPermissionStorageEntry = (\n chainId: Hex,\n data: Record<string, unknown>,\n): StoredGatorPermission<CustomPermission> => ({\n permissionResponse: {\n chainId,\n from: '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778',\n to: '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63',\n permission: {\n type: 'custom',\n isAdjustmentAllowed: true,\n data: {\n justification:\n 'This is a very important request for streaming allowance for some very important thing',\n ...data,\n },\n },\n context: '0x00000000',\n dependencies: [\n {\n factory: '0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c',\n factoryData: '0x0000000',\n },\n ],\n delegationManager: '0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3',\n },\n siteOrigin: 'http://localhost:8000',\n});\n\nexport type MockGatorPermissionsStorageEntriesConfig = {\n [chainId: string]: {\n nativeTokenStream: number;\n nativeTokenPeriodic: number;\n erc20TokenStream: number;\n erc20TokenPeriodic: number;\n custom: {\n count: number;\n data: Record<string, unknown>[];\n };\n };\n};\n\n/**\n * Creates a mock gator permissions storage entry\n *\n * @param config - The config for the mock gator permissions storage entries.\n * @returns Mock gator permissions storage entry\n */\n/**\n * Creates mock gator permissions storage entries with unique expiry times\n *\n * @param config - The config for the mock gator permissions storage entries.\n * @returns Mock gator permissions storage entries\n */\nexport function mockGatorPermissionsStorageEntriesFactory(\n config: MockGatorPermissionsStorageEntriesConfig,\n): StoredGatorPermission<PermissionTypesWithCustom>[] {\n const result: StoredGatorPermission<PermissionTypesWithCustom>[] = [];\n\n Object.entries(config).forEach(([chainId, counts]) => {\n if (counts.custom.count !== counts.custom.data.length) {\n throw new Error('Custom permission count and data length mismatch');\n }\n\n /**\n * Creates a number of entries with unique expiry times\n *\n * @param count - The number of entries to create.\n * @param createEntry - The function to create an entry.\n */\n const createEntries = (\n count: number,\n createEntry: () => StoredGatorPermission<PermissionTypesWithCustom>,\n ): void => {\n for (let i = 0; i < count; i++) {\n const entry = createEntry();\n result.push(entry);\n }\n };\n\n createEntries(counts.nativeTokenStream, () =>\n mockNativeTokenStreamStorageEntry(chainId as Hex),\n );\n\n createEntries(counts.nativeTokenPeriodic, () =>\n mockNativeTokenPeriodicStorageEntry(chainId as Hex),\n );\n\n createEntries(counts.erc20TokenStream, () =>\n mockErc20TokenStreamStorageEntry(chainId as Hex),\n );\n\n createEntries(counts.erc20TokenPeriodic, () =>\n mockErc20TokenPeriodicStorageEntry(chainId as Hex),\n );\n\n // Create custom entries\n for (let i = 0; i < counts.custom.count; i++) {\n const entry = mockCustomPermissionStorageEntry(\n chainId as Hex,\n counts.custom.data[i],\n );\n result.push(entry);\n }\n });\n\n return result;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAcA;;GAEG;AACH,IAAY,mCAOX;AAPD,WAAY,mCAAmC;IAC7C,mGAA4D,CAAA;IAC5D,mGAA4D,CAAA;IAC5D,yGAAkE,CAAA;IAClE,0HAAmF,CAAA;IACnF,4FAAqD,CAAA;IACrD,yFAAkD,CAAA;AACpD,CAAC,EAPW,mCAAmC,mDAAnC,mCAAmC,QAO9C;AAED;;GAEG;AACH,IAAY,6BASX;AATD,WAAY,6BAA6B;IACvC;;OAEG;IACH,sHAAqF,CAAA;IACrF;;OAEG;IACH,4GAA2E,CAAA;AAC7E,CAAC,EATW,6BAA6B,6CAA7B,6BAA6B,QASxC","sourcesContent":["import type {\n PermissionTypes,\n Signer,\n BasePermission,\n NativeTokenStreamPermission,\n NativeTokenPeriodicPermission,\n Erc20TokenStreamPermission,\n Erc20TokenPeriodicPermission,\n Rule,\n MetaMaskBasePermissionData,\n} from '@metamask/7715-permission-types';\nimport type { Delegation } from '@metamask/delegation-core';\nimport type { Hex } from '@metamask/utils';\n\n/**\n * Enum for the error codes of the gator permissions controller.\n */\nexport enum GatorPermissionsControllerErrorCode {\n GatorPermissionsFetchError = 'gator-permissions-fetch-error',\n GatorPermissionsNotEnabled = 'gator-permissions-not-enabled',\n GatorPermissionsProviderError = 'gator-permissions-provider-error',\n GatorPermissionsMapSerializationError = 'gator-permissions-map-serialization-error',\n PermissionDecodingError = 'permission-decoding-error',\n OriginNotAllowedError = 'origin-not-allowed-error',\n}\n\n/**\n * Enum for the RPC methods of the gator permissions provider snap.\n */\nexport enum GatorPermissionsSnapRpcMethod {\n /**\n * This method is used by the metamask to request a permissions provider to get granted permissions for all sites.\n */\n PermissionProviderGetGrantedPermissions = 'permissionsProvider_getGrantedPermissions',\n /**\n * This method is used by the metamask to submit a revocation to the permissions provider.\n */\n PermissionProviderSubmitRevocation = 'permissionsProvider_submitRevocation',\n}\n\n/**\n * Represents a custom permission that are not of the standard ERC-7715 permission types.\n */\nexport type CustomPermission = BasePermission & {\n type: 'custom';\n data: MetaMaskBasePermissionData & Record<string, unknown>;\n};\n\n/**\n * Represents the type of the ERC-7715 permissions that can be granted including custom permissions.\n */\nexport type PermissionTypesWithCustom = PermissionTypes | CustomPermission;\n\n/**\n * Represents a ERC-7715 permission request.\n *\n * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.\n * @template Permission - The type of the permission provided.\n */\nexport type PermissionRequest<\n TSigner extends Signer,\n TPermission extends PermissionTypesWithCustom,\n> = {\n /**\n * hex-encoding of uint256 defined the chain with EIP-155\n */\n chainId: Hex;\n\n /**\n *\n * The account being targeted for this permission request.\n * It is optional to let the user choose which account to grant permission from.\n */\n address?: Hex;\n\n /**\n * An account that is associated with the recipient of the granted 7715 permission or alternatively the wallet will manage the session.\n */\n signer: TSigner;\n\n /**\n * Defines the allowed behavior the signer can do on behalf of the account.\n */\n permission: TPermission;\n\n rules?: Rule[] | null;\n};\n\n/**\n * Represents a ERC-7715 permission response.\n *\n * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.\n * @template Permission - The type of the permission provided.\n */\nexport type PermissionResponse<\n TSigner extends Signer,\n TPermission extends PermissionTypesWithCustom,\n> = PermissionRequest<TSigner, TPermission> & {\n /**\n * Is a catch-all to identify a permission for revoking permissions or submitting\n * Defined in ERC-7710.\n */\n context: Hex;\n\n /**\n * The dependencyInfo field is required and contains information needed to deploy accounts.\n * Each entry specifies a factory contract and its associated deployment data.\n * If no account deployment is needed when redeeming the permission, this array must be empty.\n * When non-empty, DApps MUST deploy the accounts by calling the factory contract with factoryData as the calldata.\n * Defined in ERC-4337.\n */\n dependencyInfo: {\n factory: Hex;\n factoryData: Hex;\n }[];\n\n /**\n * If the signer type is account then delegationManager is required as defined in ERC-7710.\n */\n signerMeta: {\n delegationManager: Hex;\n };\n};\n\n/**\n * Represents a sanitized version of the PermissionResponse type.\n * Some fields have been removed but the fields are still present in profile sync.\n *\n * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.\n * @template Permission - The type of the permission provided.\n */\nexport type PermissionResponseSanitized<\n TSigner extends Signer,\n TPermission extends PermissionTypesWithCustom,\n> = Omit<\n PermissionResponse<TSigner, TPermission>,\n 'dependencyInfo' | 'signer' | 'rules'\n>;\n\n/**\n * Represents a gator ERC-7715 granted(ie. signed by an user account) permission entry that is stored in profile sync.\n *\n * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.\n * @template Permission - The type of the permission provided\n */\nexport type StoredGatorPermission<\n TSigner extends Signer,\n TPermission extends PermissionTypesWithCustom,\n> = {\n permissionResponse: PermissionResponse<TSigner, TPermission>;\n siteOrigin: string;\n /**\n * Flag indicating whether this permission has been revoked.\n */\n isRevoked?: boolean;\n};\n\n/**\n * Represents a sanitized version of the StoredGatorPermission type. Some fields have been removed but the fields are still present in profile sync.\n *\n * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.\n * @template Permission - The type of the permission provided.\n */\nexport type StoredGatorPermissionSanitized<\n TSigner extends Signer,\n TPermission extends PermissionTypesWithCustom,\n> = {\n permissionResponse: PermissionResponseSanitized<TSigner, TPermission>;\n siteOrigin: string;\n /**\n * Flag indicating whether this permission has been revoked.\n */\n isRevoked?: boolean;\n};\n\n/**\n * Represents a map of gator permissions by chainId and permission type.\n */\nexport type GatorPermissionsMap = {\n 'native-token-stream': {\n [chainId: Hex]: StoredGatorPermissionSanitized<\n Signer,\n NativeTokenStreamPermission\n >[];\n };\n 'native-token-periodic': {\n [chainId: Hex]: StoredGatorPermissionSanitized<\n Signer,\n NativeTokenPeriodicPermission\n >[];\n };\n 'erc20-token-stream': {\n [chainId: Hex]: StoredGatorPermissionSanitized<\n Signer,\n Erc20TokenStreamPermission\n >[];\n };\n 'erc20-token-periodic': {\n [chainId: Hex]: StoredGatorPermissionSanitized<\n Signer,\n Erc20TokenPeriodicPermission\n >[];\n };\n other: {\n [chainId: Hex]: StoredGatorPermissionSanitized<Signer, CustomPermission>[];\n };\n};\n\n/**\n * Represents the supported permission type(e.g. 'native-token-stream', 'native-token-periodic', 'erc20-token-stream', 'erc20-token-periodic') of the gator permissions map.\n */\nexport type SupportedGatorPermissionType = keyof GatorPermissionsMap;\n\n/**\n * Represents a map of gator permissions for a given permission type with key of chainId. The value being an array of gator permissions for that chainId.\n */\nexport type GatorPermissionsMapByPermissionType<\n TPermissionType extends SupportedGatorPermissionType,\n> = GatorPermissionsMap[TPermissionType];\n\n/**\n * Represents an array of gator permissions for a given permission type and chainId.\n */\nexport type GatorPermissionsListByPermissionTypeAndChainId<\n TPermissionType extends SupportedGatorPermissionType,\n> = GatorPermissionsMap[TPermissionType][Hex];\n\n/**\n * Represents the details of a delegation, that are required to decode a permission.\n */\nexport type DelegationDetails = Pick<\n Delegation<Hex>,\n 'caveats' | 'delegator' | 'delegate' | 'authority'\n>;\n\n/**\n * Represents the parameters for submitting a revocation.\n */\nexport type RevocationParams = {\n /**\n * The permission context as a hex string that identifies the permission to revoke.\n */\n permissionContext: Hex;\n};\n\n/**\n * Represents the parameters for adding a pending revocation.\n */\nexport type PendingRevocationParams = {\n /**\n * The transaction metadata ID to monitor.\n */\n txId: string;\n /**\n * The permission context as a hex string that identifies the permission to revoke.\n */\n permissionContext: Hex;\n};\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAcA;;GAEG;AACH,IAAY,mCAOX;AAPD,WAAY,mCAAmC;IAC7C,mGAA4D,CAAA;IAC5D,mGAA4D,CAAA;IAC5D,yGAAkE,CAAA;IAClE,0HAAmF,CAAA;IACnF,4FAAqD,CAAA;IACrD,yFAAkD,CAAA;AACpD,CAAC,EAPW,mCAAmC,mDAAnC,mCAAmC,QAO9C;AAED;;GAEG;AACH,IAAY,6BASX;AATD,WAAY,6BAA6B;IACvC;;OAEG;IACH,sHAAqF,CAAA;IACrF;;OAEG;IACH,4GAA2E,CAAA;AAC7E,CAAC,EATW,6BAA6B,6CAA7B,6BAA6B,QASxC","sourcesContent":["import type {\n PermissionTypes,\n BasePermission,\n NativeTokenStreamPermission,\n NativeTokenPeriodicPermission,\n Erc20TokenStreamPermission,\n Erc20TokenPeriodicPermission,\n Rule,\n MetaMaskBasePermissionData,\n Erc20TokenRevocationPermission,\n} from '@metamask/7715-permission-types';\nimport type { Delegation } from '@metamask/delegation-core';\nimport type { Hex } from '@metamask/utils';\n\n/**\n * Enum for the error codes of the gator permissions controller.\n */\nexport enum GatorPermissionsControllerErrorCode {\n GatorPermissionsFetchError = 'gator-permissions-fetch-error',\n GatorPermissionsNotEnabled = 'gator-permissions-not-enabled',\n GatorPermissionsProviderError = 'gator-permissions-provider-error',\n GatorPermissionsMapSerializationError = 'gator-permissions-map-serialization-error',\n PermissionDecodingError = 'permission-decoding-error',\n OriginNotAllowedError = 'origin-not-allowed-error',\n}\n\n/**\n * Enum for the RPC methods of the gator permissions provider snap.\n */\nexport enum GatorPermissionsSnapRpcMethod {\n /**\n * This method is used by the metamask to request a permissions provider to get granted permissions for all sites.\n */\n PermissionProviderGetGrantedPermissions = 'permissionsProvider_getGrantedPermissions',\n /**\n * This method is used by the metamask to submit a revocation to the permissions provider.\n */\n PermissionProviderSubmitRevocation = 'permissionsProvider_submitRevocation',\n}\n\n/**\n * Represents a custom permission that are not of the standard ERC-7715 permission types.\n */\nexport type CustomPermission = BasePermission & {\n type: 'custom';\n data: MetaMaskBasePermissionData & Record<string, unknown>;\n};\n\n/**\n * Represents the type of the ERC-7715 permissions that can be granted including custom permissions.\n */\nexport type PermissionTypesWithCustom = PermissionTypes | CustomPermission;\n\n/**\n * Represents a ERC-7715 permission request.\n *\n * @template to - The type of the signer provided, either an AccountSigner or WalletSigner.\n * @template Permission - The type of the permission provided.\n */\nexport type PermissionRequest<TPermission extends PermissionTypesWithCustom> = {\n /**\n * hex-encoding of uint256 defined the chain with EIP-155\n */\n chainId: Hex;\n\n /**\n *\n * The account being targeted for this permission request.\n * It is optional to let the user choose which account to grant permission from.\n */\n from?: Hex;\n\n /**\n * A field that identifies the DApp session account associated with the permission\n */\n to: Hex;\n\n /**\n * Defines the allowed behavior the `to` account can do on behalf of the `from` account.\n */\n permission: TPermission;\n\n rules?: Rule[] | null;\n};\n\n/**\n * Represents a ERC-7715 permission response.\n *\n * @template Permission - The type of the permission provided.\n */\nexport type PermissionResponse<TPermission extends PermissionTypesWithCustom> =\n PermissionRequest<TPermission> & {\n /**\n * Is a catch-all to identify a permission for revoking permissions or submitting\n * Defined in ERC-7710.\n */\n context: Hex;\n\n /**\n * The dependencyInfo field is required and contains information needed to deploy accounts.\n * Each entry specifies a factory contract and its associated deployment data.\n * If no account deployment is needed when redeeming the permission, this array must be empty.\n * When non-empty, DApps MUST deploy the accounts by calling the factory contract with factoryData as the calldata.\n * Defined in ERC-4337.\n */\n dependencies: {\n factory: Hex;\n factoryData: Hex;\n }[];\n\n /**\n * Is required as defined in ERC-7710.\n */\n delegationManager: Hex;\n };\n\n/**\n * Represents a sanitized version of the PermissionResponse type.\n * Internal fields (dependencies, to) are removed\n *\n * @template Permission - The type of the permission provided.\n */\nexport type PermissionResponseSanitized<\n TPermission extends PermissionTypesWithCustom,\n> = Omit<PermissionResponse<TPermission>, 'dependencies' | 'to'>;\n\n/**\n * Represents a gator ERC-7715 granted(ie. signed by an user account) permission entry that is stored in profile sync.\n *\n * @template Permission - The type of the permission provided\n */\nexport type StoredGatorPermission<\n TPermission extends PermissionTypesWithCustom,\n> = {\n permissionResponse: PermissionResponse<TPermission>;\n siteOrigin: string;\n /**\n * Flag indicating whether this permission has been revoked.\n */\n isRevoked?: boolean;\n};\n\n/**\n * Represents a sanitized version of the StoredGatorPermission type. Some fields have been removed but the fields are still present in profile sync.\n *\n * @template Permission - The type of the permission provided.\n */\nexport type StoredGatorPermissionSanitized<\n TPermission extends PermissionTypesWithCustom,\n> = {\n permissionResponse: PermissionResponseSanitized<TPermission>;\n siteOrigin: string;\n /**\n * Flag indicating whether this permission has been revoked.\n */\n isRevoked?: boolean;\n};\n\n/**\n * Represents a map of gator permissions by chainId and permission type.\n */\nexport type GatorPermissionsMap = {\n 'erc20-token-revocation': {\n [\n chainId: Hex\n ]: StoredGatorPermissionSanitized<Erc20TokenRevocationPermission>[];\n };\n 'native-token-stream': {\n [\n chainId: Hex\n ]: StoredGatorPermissionSanitized<NativeTokenStreamPermission>[];\n };\n 'native-token-periodic': {\n [\n chainId: Hex\n ]: StoredGatorPermissionSanitized<NativeTokenPeriodicPermission>[];\n };\n 'erc20-token-stream': {\n [\n chainId: Hex\n ]: StoredGatorPermissionSanitized<Erc20TokenStreamPermission>[];\n };\n 'erc20-token-periodic': {\n [\n chainId: Hex\n ]: StoredGatorPermissionSanitized<Erc20TokenPeriodicPermission>[];\n };\n other: {\n [chainId: Hex]: StoredGatorPermissionSanitized<CustomPermission>[];\n };\n};\n\n/**\n * Represents the supported permission type(e.g. 'native-token-stream', 'native-token-periodic', 'erc20-token-stream', 'erc20-token-periodic') of the gator permissions map.\n */\nexport type SupportedGatorPermissionType = keyof GatorPermissionsMap;\n\n/**\n * Represents a map of gator permissions for a given permission type with key of chainId. The value being an array of gator permissions for that chainId.\n */\nexport type GatorPermissionsMapByPermissionType<\n TPermissionType extends SupportedGatorPermissionType,\n> = GatorPermissionsMap[TPermissionType];\n\n/**\n * Represents an array of gator permissions for a given permission type and chainId.\n */\nexport type GatorPermissionsListByPermissionTypeAndChainId<\n TPermissionType extends SupportedGatorPermissionType,\n> = GatorPermissionsMap[TPermissionType][Hex];\n\n/**\n * Represents the details of a delegation, that are required to decode a permission.\n */\nexport type DelegationDetails = Pick<\n Delegation<Hex>,\n 'caveats' | 'delegator' | 'delegate' | 'authority'\n>;\n\n/**\n * Represents the parameters for submitting a revocation.\n */\nexport type RevocationParams = {\n /**\n * The permission context as a hex string that identifies the permission to revoke.\n */\n permissionContext: Hex;\n};\n\n/**\n * Represents the parameters for adding a pending revocation.\n */\nexport type PendingRevocationParams = {\n /**\n * The transaction metadata ID to monitor.\n */\n txId: string;\n /**\n * The permission context as a hex string that identifies the permission to revoke.\n */\n permissionContext: Hex;\n};\n"]}
package/dist/types.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import type { PermissionTypes, Signer, BasePermission, NativeTokenStreamPermission, NativeTokenPeriodicPermission, Erc20TokenStreamPermission, Erc20TokenPeriodicPermission, Rule, MetaMaskBasePermissionData } from "@metamask/7715-permission-types";
1
+ import type { PermissionTypes, BasePermission, NativeTokenStreamPermission, NativeTokenPeriodicPermission, Erc20TokenStreamPermission, Erc20TokenPeriodicPermission, Rule, MetaMaskBasePermissionData, Erc20TokenRevocationPermission } from "@metamask/7715-permission-types";
2
2
  import type { Delegation } from "@metamask/delegation-core";
3
3
  import type { Hex } from "@metamask/utils";
4
4
  /**
@@ -39,10 +39,10 @@ export type PermissionTypesWithCustom = PermissionTypes | CustomPermission;
39
39
  /**
40
40
  * Represents a ERC-7715 permission request.
41
41
  *
42
- * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.
42
+ * @template to - The type of the signer provided, either an AccountSigner or WalletSigner.
43
43
  * @template Permission - The type of the permission provided.
44
44
  */
45
- export type PermissionRequest<TSigner extends Signer, TPermission extends PermissionTypesWithCustom> = {
45
+ export type PermissionRequest<TPermission extends PermissionTypesWithCustom> = {
46
46
  /**
47
47
  * hex-encoding of uint256 defined the chain with EIP-155
48
48
  */
@@ -52,13 +52,13 @@ export type PermissionRequest<TSigner extends Signer, TPermission extends Permis
52
52
  * The account being targeted for this permission request.
53
53
  * It is optional to let the user choose which account to grant permission from.
54
54
  */
55
- address?: Hex;
55
+ from?: Hex;
56
56
  /**
57
- * An account that is associated with the recipient of the granted 7715 permission or alternatively the wallet will manage the session.
57
+ * A field that identifies the DApp session account associated with the permission
58
58
  */
59
- signer: TSigner;
59
+ to: Hex;
60
60
  /**
61
- * Defines the allowed behavior the signer can do on behalf of the account.
61
+ * Defines the allowed behavior the `to` account can do on behalf of the `from` account.
62
62
  */
63
63
  permission: TPermission;
64
64
  rules?: Rule[] | null;
@@ -66,10 +66,9 @@ export type PermissionRequest<TSigner extends Signer, TPermission extends Permis
66
66
  /**
67
67
  * Represents a ERC-7715 permission response.
68
68
  *
69
- * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.
70
69
  * @template Permission - The type of the permission provided.
71
70
  */
72
- export type PermissionResponse<TSigner extends Signer, TPermission extends PermissionTypesWithCustom> = PermissionRequest<TSigner, TPermission> & {
71
+ export type PermissionResponse<TPermission extends PermissionTypesWithCustom> = PermissionRequest<TPermission> & {
73
72
  /**
74
73
  * Is a catch-all to identify a permission for revoking permissions or submitting
75
74
  * Defined in ERC-7710.
@@ -82,33 +81,29 @@ export type PermissionResponse<TSigner extends Signer, TPermission extends Permi
82
81
  * When non-empty, DApps MUST deploy the accounts by calling the factory contract with factoryData as the calldata.
83
82
  * Defined in ERC-4337.
84
83
  */
85
- dependencyInfo: {
84
+ dependencies: {
86
85
  factory: Hex;
87
86
  factoryData: Hex;
88
87
  }[];
89
88
  /**
90
- * If the signer type is account then delegationManager is required as defined in ERC-7710.
89
+ * Is required as defined in ERC-7710.
91
90
  */
92
- signerMeta: {
93
- delegationManager: Hex;
94
- };
91
+ delegationManager: Hex;
95
92
  };
96
93
  /**
97
94
  * Represents a sanitized version of the PermissionResponse type.
98
- * Some fields have been removed but the fields are still present in profile sync.
95
+ * Internal fields (dependencies, to) are removed
99
96
  *
100
- * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.
101
97
  * @template Permission - The type of the permission provided.
102
98
  */
103
- export type PermissionResponseSanitized<TSigner extends Signer, TPermission extends PermissionTypesWithCustom> = Omit<PermissionResponse<TSigner, TPermission>, 'dependencyInfo' | 'signer' | 'rules'>;
99
+ export type PermissionResponseSanitized<TPermission extends PermissionTypesWithCustom> = Omit<PermissionResponse<TPermission>, 'dependencies' | 'to'>;
104
100
  /**
105
101
  * Represents a gator ERC-7715 granted(ie. signed by an user account) permission entry that is stored in profile sync.
106
102
  *
107
- * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.
108
103
  * @template Permission - The type of the permission provided
109
104
  */
110
- export type StoredGatorPermission<TSigner extends Signer, TPermission extends PermissionTypesWithCustom> = {
111
- permissionResponse: PermissionResponse<TSigner, TPermission>;
105
+ export type StoredGatorPermission<TPermission extends PermissionTypesWithCustom> = {
106
+ permissionResponse: PermissionResponse<TPermission>;
112
107
  siteOrigin: string;
113
108
  /**
114
109
  * Flag indicating whether this permission has been revoked.
@@ -118,11 +113,10 @@ export type StoredGatorPermission<TSigner extends Signer, TPermission extends Pe
118
113
  /**
119
114
  * Represents a sanitized version of the StoredGatorPermission type. Some fields have been removed but the fields are still present in profile sync.
120
115
  *
121
- * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.
122
116
  * @template Permission - The type of the permission provided.
123
117
  */
124
- export type StoredGatorPermissionSanitized<TSigner extends Signer, TPermission extends PermissionTypesWithCustom> = {
125
- permissionResponse: PermissionResponseSanitized<TSigner, TPermission>;
118
+ export type StoredGatorPermissionSanitized<TPermission extends PermissionTypesWithCustom> = {
119
+ permissionResponse: PermissionResponseSanitized<TPermission>;
126
120
  siteOrigin: string;
127
121
  /**
128
122
  * Flag indicating whether this permission has been revoked.
@@ -133,20 +127,23 @@ export type StoredGatorPermissionSanitized<TSigner extends Signer, TPermission e
133
127
  * Represents a map of gator permissions by chainId and permission type.
134
128
  */
135
129
  export type GatorPermissionsMap = {
130
+ 'erc20-token-revocation': {
131
+ [chainId: Hex]: StoredGatorPermissionSanitized<Erc20TokenRevocationPermission>[];
132
+ };
136
133
  'native-token-stream': {
137
- [chainId: Hex]: StoredGatorPermissionSanitized<Signer, NativeTokenStreamPermission>[];
134
+ [chainId: Hex]: StoredGatorPermissionSanitized<NativeTokenStreamPermission>[];
138
135
  };
139
136
  'native-token-periodic': {
140
- [chainId: Hex]: StoredGatorPermissionSanitized<Signer, NativeTokenPeriodicPermission>[];
137
+ [chainId: Hex]: StoredGatorPermissionSanitized<NativeTokenPeriodicPermission>[];
141
138
  };
142
139
  'erc20-token-stream': {
143
- [chainId: Hex]: StoredGatorPermissionSanitized<Signer, Erc20TokenStreamPermission>[];
140
+ [chainId: Hex]: StoredGatorPermissionSanitized<Erc20TokenStreamPermission>[];
144
141
  };
145
142
  'erc20-token-periodic': {
146
- [chainId: Hex]: StoredGatorPermissionSanitized<Signer, Erc20TokenPeriodicPermission>[];
143
+ [chainId: Hex]: StoredGatorPermissionSanitized<Erc20TokenPeriodicPermission>[];
147
144
  };
148
145
  other: {
149
- [chainId: Hex]: StoredGatorPermissionSanitized<Signer, CustomPermission>[];
146
+ [chainId: Hex]: StoredGatorPermissionSanitized<CustomPermission>[];
150
147
  };
151
148
  };
152
149
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,MAAM,EACN,cAAc,EACd,2BAA2B,EAC3B,6BAA6B,EAC7B,0BAA0B,EAC1B,4BAA4B,EAC5B,IAAI,EACJ,0BAA0B,EAC3B,wCAAwC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,kCAAkC;AAC5D,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE3C;;GAEG;AACH,oBAAY,mCAAmC;IAC7C,0BAA0B,kCAAkC;IAC5D,0BAA0B,kCAAkC;IAC5D,6BAA6B,qCAAqC;IAClE,qCAAqC,8CAA8C;IACnF,uBAAuB,8BAA8B;IACrD,qBAAqB,6BAA6B;CACnD;AAED;;GAEG;AACH,oBAAY,6BAA6B;IACvC;;OAEG;IACH,uCAAuC,8CAA8C;IACrF;;OAEG;IACH,kCAAkC,yCAAyC;CAC5E;AAED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AAC,EACf,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,CACnD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,iBAAiB,EAAE,GAAG,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,iBAAiB,EAAE,GAAG,CAAC;CACxB,CAAC"}
package/dist/types.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import type { PermissionTypes, Signer, BasePermission, NativeTokenStreamPermission, NativeTokenPeriodicPermission, Erc20TokenStreamPermission, Erc20TokenPeriodicPermission, Rule, MetaMaskBasePermissionData } from "@metamask/7715-permission-types";
1
+ import type { PermissionTypes, BasePermission, NativeTokenStreamPermission, NativeTokenPeriodicPermission, Erc20TokenStreamPermission, Erc20TokenPeriodicPermission, Rule, MetaMaskBasePermissionData, Erc20TokenRevocationPermission } from "@metamask/7715-permission-types";
2
2
  import type { Delegation } from "@metamask/delegation-core";
3
3
  import type { Hex } from "@metamask/utils";
4
4
  /**
@@ -39,10 +39,10 @@ export type PermissionTypesWithCustom = PermissionTypes | CustomPermission;
39
39
  /**
40
40
  * Represents a ERC-7715 permission request.
41
41
  *
42
- * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.
42
+ * @template to - The type of the signer provided, either an AccountSigner or WalletSigner.
43
43
  * @template Permission - The type of the permission provided.
44
44
  */
45
- export type PermissionRequest<TSigner extends Signer, TPermission extends PermissionTypesWithCustom> = {
45
+ export type PermissionRequest<TPermission extends PermissionTypesWithCustom> = {
46
46
  /**
47
47
  * hex-encoding of uint256 defined the chain with EIP-155
48
48
  */
@@ -52,13 +52,13 @@ export type PermissionRequest<TSigner extends Signer, TPermission extends Permis
52
52
  * The account being targeted for this permission request.
53
53
  * It is optional to let the user choose which account to grant permission from.
54
54
  */
55
- address?: Hex;
55
+ from?: Hex;
56
56
  /**
57
- * An account that is associated with the recipient of the granted 7715 permission or alternatively the wallet will manage the session.
57
+ * A field that identifies the DApp session account associated with the permission
58
58
  */
59
- signer: TSigner;
59
+ to: Hex;
60
60
  /**
61
- * Defines the allowed behavior the signer can do on behalf of the account.
61
+ * Defines the allowed behavior the `to` account can do on behalf of the `from` account.
62
62
  */
63
63
  permission: TPermission;
64
64
  rules?: Rule[] | null;
@@ -66,10 +66,9 @@ export type PermissionRequest<TSigner extends Signer, TPermission extends Permis
66
66
  /**
67
67
  * Represents a ERC-7715 permission response.
68
68
  *
69
- * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.
70
69
  * @template Permission - The type of the permission provided.
71
70
  */
72
- export type PermissionResponse<TSigner extends Signer, TPermission extends PermissionTypesWithCustom> = PermissionRequest<TSigner, TPermission> & {
71
+ export type PermissionResponse<TPermission extends PermissionTypesWithCustom> = PermissionRequest<TPermission> & {
73
72
  /**
74
73
  * Is a catch-all to identify a permission for revoking permissions or submitting
75
74
  * Defined in ERC-7710.
@@ -82,33 +81,29 @@ export type PermissionResponse<TSigner extends Signer, TPermission extends Permi
82
81
  * When non-empty, DApps MUST deploy the accounts by calling the factory contract with factoryData as the calldata.
83
82
  * Defined in ERC-4337.
84
83
  */
85
- dependencyInfo: {
84
+ dependencies: {
86
85
  factory: Hex;
87
86
  factoryData: Hex;
88
87
  }[];
89
88
  /**
90
- * If the signer type is account then delegationManager is required as defined in ERC-7710.
89
+ * Is required as defined in ERC-7710.
91
90
  */
92
- signerMeta: {
93
- delegationManager: Hex;
94
- };
91
+ delegationManager: Hex;
95
92
  };
96
93
  /**
97
94
  * Represents a sanitized version of the PermissionResponse type.
98
- * Some fields have been removed but the fields are still present in profile sync.
95
+ * Internal fields (dependencies, to) are removed
99
96
  *
100
- * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.
101
97
  * @template Permission - The type of the permission provided.
102
98
  */
103
- export type PermissionResponseSanitized<TSigner extends Signer, TPermission extends PermissionTypesWithCustom> = Omit<PermissionResponse<TSigner, TPermission>, 'dependencyInfo' | 'signer' | 'rules'>;
99
+ export type PermissionResponseSanitized<TPermission extends PermissionTypesWithCustom> = Omit<PermissionResponse<TPermission>, 'dependencies' | 'to'>;
104
100
  /**
105
101
  * Represents a gator ERC-7715 granted(ie. signed by an user account) permission entry that is stored in profile sync.
106
102
  *
107
- * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.
108
103
  * @template Permission - The type of the permission provided
109
104
  */
110
- export type StoredGatorPermission<TSigner extends Signer, TPermission extends PermissionTypesWithCustom> = {
111
- permissionResponse: PermissionResponse<TSigner, TPermission>;
105
+ export type StoredGatorPermission<TPermission extends PermissionTypesWithCustom> = {
106
+ permissionResponse: PermissionResponse<TPermission>;
112
107
  siteOrigin: string;
113
108
  /**
114
109
  * Flag indicating whether this permission has been revoked.
@@ -118,11 +113,10 @@ export type StoredGatorPermission<TSigner extends Signer, TPermission extends Pe
118
113
  /**
119
114
  * Represents a sanitized version of the StoredGatorPermission type. Some fields have been removed but the fields are still present in profile sync.
120
115
  *
121
- * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.
122
116
  * @template Permission - The type of the permission provided.
123
117
  */
124
- export type StoredGatorPermissionSanitized<TSigner extends Signer, TPermission extends PermissionTypesWithCustom> = {
125
- permissionResponse: PermissionResponseSanitized<TSigner, TPermission>;
118
+ export type StoredGatorPermissionSanitized<TPermission extends PermissionTypesWithCustom> = {
119
+ permissionResponse: PermissionResponseSanitized<TPermission>;
126
120
  siteOrigin: string;
127
121
  /**
128
122
  * Flag indicating whether this permission has been revoked.
@@ -133,20 +127,23 @@ export type StoredGatorPermissionSanitized<TSigner extends Signer, TPermission e
133
127
  * Represents a map of gator permissions by chainId and permission type.
134
128
  */
135
129
  export type GatorPermissionsMap = {
130
+ 'erc20-token-revocation': {
131
+ [chainId: Hex]: StoredGatorPermissionSanitized<Erc20TokenRevocationPermission>[];
132
+ };
136
133
  'native-token-stream': {
137
- [chainId: Hex]: StoredGatorPermissionSanitized<Signer, NativeTokenStreamPermission>[];
134
+ [chainId: Hex]: StoredGatorPermissionSanitized<NativeTokenStreamPermission>[];
138
135
  };
139
136
  'native-token-periodic': {
140
- [chainId: Hex]: StoredGatorPermissionSanitized<Signer, NativeTokenPeriodicPermission>[];
137
+ [chainId: Hex]: StoredGatorPermissionSanitized<NativeTokenPeriodicPermission>[];
141
138
  };
142
139
  'erc20-token-stream': {
143
- [chainId: Hex]: StoredGatorPermissionSanitized<Signer, Erc20TokenStreamPermission>[];
140
+ [chainId: Hex]: StoredGatorPermissionSanitized<Erc20TokenStreamPermission>[];
144
141
  };
145
142
  'erc20-token-periodic': {
146
- [chainId: Hex]: StoredGatorPermissionSanitized<Signer, Erc20TokenPeriodicPermission>[];
143
+ [chainId: Hex]: StoredGatorPermissionSanitized<Erc20TokenPeriodicPermission>[];
147
144
  };
148
145
  other: {
149
- [chainId: Hex]: StoredGatorPermissionSanitized<Signer, CustomPermission>[];
146
+ [chainId: Hex]: StoredGatorPermissionSanitized<CustomPermission>[];
150
147
  };
151
148
  };
152
149
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,MAAM,EACN,cAAc,EACd,2BAA2B,EAC3B,6BAA6B,EAC7B,0BAA0B,EAC1B,4BAA4B,EAC5B,IAAI,EACJ,0BAA0B,EAC3B,wCAAwC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,kCAAkC;AAC5D,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE3C;;GAEG;AACH,oBAAY,mCAAmC;IAC7C,0BAA0B,kCAAkC;IAC5D,0BAA0B,kCAAkC;IAC5D,6BAA6B,qCAAqC;IAClE,qCAAqC,8CAA8C;IACnF,uBAAuB,8BAA8B;IACrD,qBAAqB,6BAA6B;CACnD;AAED;;GAEG;AACH,oBAAY,6BAA6B;IACvC;;OAEG;IACH,uCA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,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,UAAU,CAAC,GAAG,CAAC,EACf,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,CACnD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,iBAAiB,EAAE,GAAG,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,iBAAiB,EAAE,GAAG,CAAC;CACxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,MAAM,CAAN,IAAY,mCAOX;AAPD,WAAY,mCAAmC;IAC7C,mGAA4D,CAAA;IAC5D,mGAA4D,CAAA;IAC5D,yGAAkE,CAAA;IAClE,0HAAmF,CAAA;IACnF,4FAAqD,CAAA;IACrD,yFAAkD,CAAA;AACpD,CAAC,EAPW,mCAAmC,KAAnC,mCAAmC,QAO9C;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,6BASX;AATD,WAAY,6BAA6B;IACvC;;OAEG;IACH,sHAAqF,CAAA;IACrF;;OAEG;IACH,4GAA2E,CAAA;AAC7E,CAAC,EATW,6BAA6B,KAA7B,6BAA6B,QASxC","sourcesContent":["import type {\n PermissionTypes,\n Signer,\n BasePermission,\n NativeTokenStreamPermission,\n NativeTokenPeriodicPermission,\n Erc20TokenStreamPermission,\n Erc20TokenPeriodicPermission,\n Rule,\n MetaMaskBasePermissionData,\n} from '@metamask/7715-permission-types';\nimport type { Delegation } from '@metamask/delegation-core';\nimport type { Hex } from '@metamask/utils';\n\n/**\n * Enum for the error codes of the gator permissions controller.\n */\nexport enum GatorPermissionsControllerErrorCode {\n GatorPermissionsFetchError = 'gator-permissions-fetch-error',\n GatorPermissionsNotEnabled = 'gator-permissions-not-enabled',\n GatorPermissionsProviderError = 'gator-permissions-provider-error',\n GatorPermissionsMapSerializationError = 'gator-permissions-map-serialization-error',\n PermissionDecodingError = 'permission-decoding-error',\n OriginNotAllowedError = 'origin-not-allowed-error',\n}\n\n/**\n * Enum for the RPC methods of the gator permissions provider snap.\n */\nexport enum GatorPermissionsSnapRpcMethod {\n /**\n * This method is used by the metamask to request a permissions provider to get granted permissions for all sites.\n */\n PermissionProviderGetGrantedPermissions = 'permissionsProvider_getGrantedPermissions',\n /**\n * This method is used by the metamask to submit a revocation to the permissions provider.\n */\n PermissionProviderSubmitRevocation = 'permissionsProvider_submitRevocation',\n}\n\n/**\n * Represents a custom permission that are not of the standard ERC-7715 permission types.\n */\nexport type CustomPermission = BasePermission & {\n type: 'custom';\n data: MetaMaskBasePermissionData & Record<string, unknown>;\n};\n\n/**\n * Represents the type of the ERC-7715 permissions that can be granted including custom permissions.\n */\nexport type PermissionTypesWithCustom = PermissionTypes | CustomPermission;\n\n/**\n * Represents a ERC-7715 permission request.\n *\n * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.\n * @template Permission - The type of the permission provided.\n */\nexport type PermissionRequest<\n TSigner extends Signer,\n TPermission extends PermissionTypesWithCustom,\n> = {\n /**\n * hex-encoding of uint256 defined the chain with EIP-155\n */\n chainId: Hex;\n\n /**\n *\n * The account being targeted for this permission request.\n * It is optional to let the user choose which account to grant permission from.\n */\n address?: Hex;\n\n /**\n * An account that is associated with the recipient of the granted 7715 permission or alternatively the wallet will manage the session.\n */\n signer: TSigner;\n\n /**\n * Defines the allowed behavior the signer can do on behalf of the account.\n */\n permission: TPermission;\n\n rules?: Rule[] | null;\n};\n\n/**\n * Represents a ERC-7715 permission response.\n *\n * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.\n * @template Permission - The type of the permission provided.\n */\nexport type PermissionResponse<\n TSigner extends Signer,\n TPermission extends PermissionTypesWithCustom,\n> = PermissionRequest<TSigner, TPermission> & {\n /**\n * Is a catch-all to identify a permission for revoking permissions or submitting\n * Defined in ERC-7710.\n */\n context: Hex;\n\n /**\n * The dependencyInfo field is required and contains information needed to deploy accounts.\n * Each entry specifies a factory contract and its associated deployment data.\n * If no account deployment is needed when redeeming the permission, this array must be empty.\n * When non-empty, DApps MUST deploy the accounts by calling the factory contract with factoryData as the calldata.\n * Defined in ERC-4337.\n */\n dependencyInfo: {\n factory: Hex;\n factoryData: Hex;\n }[];\n\n /**\n * If the signer type is account then delegationManager is required as defined in ERC-7710.\n */\n signerMeta: {\n delegationManager: Hex;\n };\n};\n\n/**\n * Represents a sanitized version of the PermissionResponse type.\n * Some fields have been removed but the fields are still present in profile sync.\n *\n * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.\n * @template Permission - The type of the permission provided.\n */\nexport type PermissionResponseSanitized<\n TSigner extends Signer,\n TPermission extends PermissionTypesWithCustom,\n> = Omit<\n PermissionResponse<TSigner, TPermission>,\n 'dependencyInfo' | 'signer' | 'rules'\n>;\n\n/**\n * Represents a gator ERC-7715 granted(ie. signed by an user account) permission entry that is stored in profile sync.\n *\n * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.\n * @template Permission - The type of the permission provided\n */\nexport type StoredGatorPermission<\n TSigner extends Signer,\n TPermission extends PermissionTypesWithCustom,\n> = {\n permissionResponse: PermissionResponse<TSigner, TPermission>;\n siteOrigin: string;\n /**\n * Flag indicating whether this permission has been revoked.\n */\n isRevoked?: boolean;\n};\n\n/**\n * Represents a sanitized version of the StoredGatorPermission type. Some fields have been removed but the fields are still present in profile sync.\n *\n * @template Signer - The type of the signer provided, either an AccountSigner or WalletSigner.\n * @template Permission - The type of the permission provided.\n */\nexport type StoredGatorPermissionSanitized<\n TSigner extends Signer,\n TPermission extends PermissionTypesWithCustom,\n> = {\n permissionResponse: PermissionResponseSanitized<TSigner, TPermission>;\n siteOrigin: string;\n /**\n * Flag indicating whether this permission has been revoked.\n */\n isRevoked?: boolean;\n};\n\n/**\n * Represents a map of gator permissions by chainId and permission type.\n */\nexport type GatorPermissionsMap = {\n 'native-token-stream': {\n [chainId: Hex]: StoredGatorPermissionSanitized<\n Signer,\n NativeTokenStreamPermission\n >[];\n };\n 'native-token-periodic': {\n [chainId: Hex]: StoredGatorPermissionSanitized<\n Signer,\n NativeTokenPeriodicPermission\n >[];\n };\n 'erc20-token-stream': {\n [chainId: Hex]: StoredGatorPermissionSanitized<\n Signer,\n Erc20TokenStreamPermission\n >[];\n };\n 'erc20-token-periodic': {\n [chainId: Hex]: StoredGatorPermissionSanitized<\n Signer,\n Erc20TokenPeriodicPermission\n >[];\n };\n other: {\n [chainId: Hex]: StoredGatorPermissionSanitized<Signer, CustomPermission>[];\n };\n};\n\n/**\n * Represents the supported permission type(e.g. 'native-token-stream', 'native-token-periodic', 'erc20-token-stream', 'erc20-token-periodic') of the gator permissions map.\n */\nexport type SupportedGatorPermissionType = keyof GatorPermissionsMap;\n\n/**\n * Represents a map of gator permissions for a given permission type with key of chainId. The value being an array of gator permissions for that chainId.\n */\nexport type GatorPermissionsMapByPermissionType<\n TPermissionType extends SupportedGatorPermissionType,\n> = GatorPermissionsMap[TPermissionType];\n\n/**\n * Represents an array of gator permissions for a given permission type and chainId.\n */\nexport type GatorPermissionsListByPermissionTypeAndChainId<\n TPermissionType extends SupportedGatorPermissionType,\n> = GatorPermissionsMap[TPermissionType][Hex];\n\n/**\n * Represents the details of a delegation, that are required to decode a permission.\n */\nexport type DelegationDetails = Pick<\n Delegation<Hex>,\n 'caveats' | 'delegator' | 'delegate' | 'authority'\n>;\n\n/**\n * Represents the parameters for submitting a revocation.\n */\nexport type RevocationParams = {\n /**\n * The permission context as a hex string that identifies the permission to revoke.\n */\n permissionContext: Hex;\n};\n\n/**\n * Represents the parameters for adding a pending revocation.\n */\nexport type PendingRevocationParams = {\n /**\n * The transaction metadata ID to monitor.\n */\n txId: string;\n /**\n * The permission context as a hex string that identifies the permission to revoke.\n */\n permissionContext: Hex;\n};\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,MAAM,CAAN,IAAY,mCAOX;AAPD,WAAY,mCAAmC;IAC7C,mGAA4D,CAAA;IAC5D,mGAA4D,CAAA;IAC5D,yGAAkE,CAAA;IAClE,0HAAmF,CAAA;IACnF,4FAAqD,CAAA;IACrD,yFAAkD,CAAA;AACpD,CAAC,EAPW,mCAAmC,KAAnC,mCAAmC,QAO9C;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,6BASX;AATD,WAAY,6BAA6B;IACvC;;OAEG;IACH,sHAAqF,CAAA;IACrF;;OAEG;IACH,4GAA2E,CAAA;AAC7E,CAAC,EATW,6BAA6B,KAA7B,6BAA6B,QASxC","sourcesContent":["import type {\n PermissionTypes,\n BasePermission,\n NativeTokenStreamPermission,\n NativeTokenPeriodicPermission,\n Erc20TokenStreamPermission,\n Erc20TokenPeriodicPermission,\n Rule,\n MetaMaskBasePermissionData,\n Erc20TokenRevocationPermission,\n} from '@metamask/7715-permission-types';\nimport type { Delegation } from '@metamask/delegation-core';\nimport type { Hex } from '@metamask/utils';\n\n/**\n * Enum for the error codes of the gator permissions controller.\n */\nexport enum GatorPermissionsControllerErrorCode {\n GatorPermissionsFetchError = 'gator-permissions-fetch-error',\n GatorPermissionsNotEnabled = 'gator-permissions-not-enabled',\n GatorPermissionsProviderError = 'gator-permissions-provider-error',\n GatorPermissionsMapSerializationError = 'gator-permissions-map-serialization-error',\n PermissionDecodingError = 'permission-decoding-error',\n OriginNotAllowedError = 'origin-not-allowed-error',\n}\n\n/**\n * Enum for the RPC methods of the gator permissions provider snap.\n */\nexport enum GatorPermissionsSnapRpcMethod {\n /**\n * This method is used by the metamask to request a permissions provider to get granted permissions for all sites.\n */\n PermissionProviderGetGrantedPermissions = 'permissionsProvider_getGrantedPermissions',\n /**\n * This method is used by the metamask to submit a revocation to the permissions provider.\n */\n PermissionProviderSubmitRevocation = 'permissionsProvider_submitRevocation',\n}\n\n/**\n * Represents a custom permission that are not of the standard ERC-7715 permission types.\n */\nexport type CustomPermission = BasePermission & {\n type: 'custom';\n data: MetaMaskBasePermissionData & Record<string, unknown>;\n};\n\n/**\n * Represents the type of the ERC-7715 permissions that can be granted including custom permissions.\n */\nexport type PermissionTypesWithCustom = PermissionTypes | CustomPermission;\n\n/**\n * Represents a ERC-7715 permission request.\n *\n * @template to - The type of the signer provided, either an AccountSigner or WalletSigner.\n * @template Permission - The type of the permission provided.\n */\nexport type PermissionRequest<TPermission extends PermissionTypesWithCustom> = {\n /**\n * hex-encoding of uint256 defined the chain with EIP-155\n */\n chainId: Hex;\n\n /**\n *\n * The account being targeted for this permission request.\n * It is optional to let the user choose which account to grant permission from.\n */\n from?: Hex;\n\n /**\n * A field that identifies the DApp session account associated with the permission\n */\n to: Hex;\n\n /**\n * Defines the allowed behavior the `to` account can do on behalf of the `from` account.\n */\n permission: TPermission;\n\n rules?: Rule[] | null;\n};\n\n/**\n * Represents a ERC-7715 permission response.\n *\n * @template Permission - The type of the permission provided.\n */\nexport type PermissionResponse<TPermission extends PermissionTypesWithCustom> =\n PermissionRequest<TPermission> & {\n /**\n * Is a catch-all to identify a permission for revoking permissions or submitting\n * Defined in ERC-7710.\n */\n context: Hex;\n\n /**\n * The dependencyInfo field is required and contains information needed to deploy accounts.\n * Each entry specifies a factory contract and its associated deployment data.\n * If no account deployment is needed when redeeming the permission, this array must be empty.\n * When non-empty, DApps MUST deploy the accounts by calling the factory contract with factoryData as the calldata.\n * Defined in ERC-4337.\n */\n dependencies: {\n factory: Hex;\n factoryData: Hex;\n }[];\n\n /**\n * Is required as defined in ERC-7710.\n */\n delegationManager: Hex;\n };\n\n/**\n * Represents a sanitized version of the PermissionResponse type.\n * Internal fields (dependencies, to) are removed\n *\n * @template Permission - The type of the permission provided.\n */\nexport type PermissionResponseSanitized<\n TPermission extends PermissionTypesWithCustom,\n> = Omit<PermissionResponse<TPermission>, 'dependencies' | 'to'>;\n\n/**\n * Represents a gator ERC-7715 granted(ie. signed by an user account) permission entry that is stored in profile sync.\n *\n * @template Permission - The type of the permission provided\n */\nexport type StoredGatorPermission<\n TPermission extends PermissionTypesWithCustom,\n> = {\n permissionResponse: PermissionResponse<TPermission>;\n siteOrigin: string;\n /**\n * Flag indicating whether this permission has been revoked.\n */\n isRevoked?: boolean;\n};\n\n/**\n * Represents a sanitized version of the StoredGatorPermission type. Some fields have been removed but the fields are still present in profile sync.\n *\n * @template Permission - The type of the permission provided.\n */\nexport type StoredGatorPermissionSanitized<\n TPermission extends PermissionTypesWithCustom,\n> = {\n permissionResponse: PermissionResponseSanitized<TPermission>;\n siteOrigin: string;\n /**\n * Flag indicating whether this permission has been revoked.\n */\n isRevoked?: boolean;\n};\n\n/**\n * Represents a map of gator permissions by chainId and permission type.\n */\nexport type GatorPermissionsMap = {\n 'erc20-token-revocation': {\n [\n chainId: Hex\n ]: StoredGatorPermissionSanitized<Erc20TokenRevocationPermission>[];\n };\n 'native-token-stream': {\n [\n chainId: Hex\n ]: StoredGatorPermissionSanitized<NativeTokenStreamPermission>[];\n };\n 'native-token-periodic': {\n [\n chainId: Hex\n ]: StoredGatorPermissionSanitized<NativeTokenPeriodicPermission>[];\n };\n 'erc20-token-stream': {\n [\n chainId: Hex\n ]: StoredGatorPermissionSanitized<Erc20TokenStreamPermission>[];\n };\n 'erc20-token-periodic': {\n [\n chainId: Hex\n ]: StoredGatorPermissionSanitized<Erc20TokenPeriodicPermission>[];\n };\n other: {\n [chainId: Hex]: StoredGatorPermissionSanitized<CustomPermission>[];\n };\n};\n\n/**\n * Represents the supported permission type(e.g. 'native-token-stream', 'native-token-periodic', 'erc20-token-stream', 'erc20-token-periodic') of the gator permissions map.\n */\nexport type SupportedGatorPermissionType = keyof GatorPermissionsMap;\n\n/**\n * Represents a map of gator permissions for a given permission type with key of chainId. The value being an array of gator permissions for that chainId.\n */\nexport type GatorPermissionsMapByPermissionType<\n TPermissionType extends SupportedGatorPermissionType,\n> = GatorPermissionsMap[TPermissionType];\n\n/**\n * Represents an array of gator permissions for a given permission type and chainId.\n */\nexport type GatorPermissionsListByPermissionTypeAndChainId<\n TPermissionType extends SupportedGatorPermissionType,\n> = GatorPermissionsMap[TPermissionType][Hex];\n\n/**\n * Represents the details of a delegation, that are required to decode a permission.\n */\nexport type DelegationDetails = Pick<\n Delegation<Hex>,\n 'caveats' | 'delegator' | 'delegate' | 'authority'\n>;\n\n/**\n * Represents the parameters for submitting a revocation.\n */\nexport type RevocationParams = {\n /**\n * The permission context as a hex string that identifies the permission to revoke.\n */\n permissionContext: Hex;\n};\n\n/**\n * Represents the parameters for adding a pending revocation.\n */\nexport type PendingRevocationParams = {\n /**\n * The transaction metadata ID to monitor.\n */\n txId: string;\n /**\n * The permission context as a hex string that identifies the permission to revoke.\n */\n permissionContext: Hex;\n};\n"]}