@metamask/gator-permissions-controller 1.0.0 → 1.1.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.
- package/CHANGELOG.md +13 -1
- package/dist/GatorPermissionsController.cjs +21 -1
- package/dist/GatorPermissionsController.cjs.map +1 -1
- package/dist/GatorPermissionsController.d.cts.map +1 -1
- package/dist/GatorPermissionsController.d.mts.map +1 -1
- package/dist/GatorPermissionsController.mjs +21 -1
- package/dist/GatorPermissionsController.mjs.map +1 -1
- package/dist/decodePermission/utils.cjs +2 -2
- package/dist/decodePermission/utils.cjs.map +1 -1
- package/dist/decodePermission/utils.d.cts +10 -10
- package/dist/decodePermission/utils.d.cts.map +1 -1
- package/dist/decodePermission/utils.d.mts +10 -10
- package/dist/decodePermission/utils.d.mts.map +1 -1
- package/dist/decodePermission/utils.mjs +2 -2
- package/dist/decodePermission/utils.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +15 -10
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +15 -10
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +2 -2
package/dist/types.d.cts
CHANGED
|
@@ -98,17 +98,14 @@ export type PermissionResponse<TPermission extends PermissionTypesWithCustom> =
|
|
|
98
98
|
*/
|
|
99
99
|
export type PermissionResponseSanitized<TPermission extends PermissionTypesWithCustom> = Omit<PermissionResponse<TPermission>, 'dependencies' | 'to'>;
|
|
100
100
|
/**
|
|
101
|
-
* Represents a gator ERC-7715 granted(ie. signed by
|
|
101
|
+
* Represents a gator ERC-7715 granted(ie. signed by a user's account) permission entry that is stored in profile sync.
|
|
102
102
|
*
|
|
103
103
|
* @template Permission - The type of the permission provided
|
|
104
104
|
*/
|
|
105
105
|
export type StoredGatorPermission<TPermission extends PermissionTypesWithCustom> = {
|
|
106
106
|
permissionResponse: PermissionResponse<TPermission>;
|
|
107
107
|
siteOrigin: string;
|
|
108
|
-
|
|
109
|
-
* Flag indicating whether this permission has been revoked.
|
|
110
|
-
*/
|
|
111
|
-
isRevoked?: boolean;
|
|
108
|
+
revocationMetadata?: RevocationMetadata;
|
|
112
109
|
};
|
|
113
110
|
/**
|
|
114
111
|
* Represents a sanitized version of the StoredGatorPermission type. Some fields have been removed but the fields are still present in profile sync.
|
|
@@ -118,10 +115,7 @@ export type StoredGatorPermission<TPermission extends PermissionTypesWithCustom>
|
|
|
118
115
|
export type StoredGatorPermissionSanitized<TPermission extends PermissionTypesWithCustom> = {
|
|
119
116
|
permissionResponse: PermissionResponseSanitized<TPermission>;
|
|
120
117
|
siteOrigin: string;
|
|
121
|
-
|
|
122
|
-
* Flag indicating whether this permission has been revoked.
|
|
123
|
-
*/
|
|
124
|
-
isRevoked?: boolean;
|
|
118
|
+
revocationMetadata?: RevocationMetadata;
|
|
125
119
|
};
|
|
126
120
|
/**
|
|
127
121
|
* Represents a map of gator permissions by chainId and permission type.
|
|
@@ -163,13 +157,24 @@ export type GatorPermissionsListByPermissionTypeAndChainId<TPermissionType exten
|
|
|
163
157
|
*/
|
|
164
158
|
export type DelegationDetails = Pick<Delegation<Hex>, 'caveats' | 'delegator' | 'delegate' | 'authority'>;
|
|
165
159
|
/**
|
|
166
|
-
* Represents the
|
|
160
|
+
* Represents the metadata for confirmed transaction revocation.
|
|
161
|
+
*/
|
|
162
|
+
export type RevocationMetadata = {
|
|
163
|
+
recordedAt: number;
|
|
164
|
+
txHash?: Hex | undefined;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Parameters for the `permissionsProvider_submitRevocation` method
|
|
167
168
|
*/
|
|
168
169
|
export type RevocationParams = {
|
|
169
170
|
/**
|
|
170
171
|
* The permission context as a hex string that identifies the permission to revoke.
|
|
171
172
|
*/
|
|
172
173
|
permissionContext: Hex;
|
|
174
|
+
/**
|
|
175
|
+
* The hash of the transaction that was used to revoke the permission. Optional because we might not have submitted the transaction ourselves.
|
|
176
|
+
*/
|
|
177
|
+
txHash: Hex | undefined;
|
|
173
178
|
};
|
|
174
179
|
/**
|
|
175
180
|
* Represents the parameters for adding a pending revocation.
|
package/dist/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,2BAA2B,EAC3B,6BAA6B,EAC7B,0BAA0B,EAC1B,4BAA4B,EAC5B,IAAI,EACJ,0BAA0B,EAC1B,8BAA8B,EAC/B,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;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG;IAC9C,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,CAAC,WAAW,SAAS,yBAAyB,IAAI;IAC7E;;OAEG;IACH,OAAO,EAAE,GAAG,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AAM,mCAAmC,CAC7C,eAAe,SAAS,4BAA4B,IAClD,mBAAmB,CAAC,eAAe,CAAC,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,8CAA8C,CACxD,eAAe,SAAS,4BAA4B,IAClD,mBAAmB,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC;AAE9C;;GAEG;AACH,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,kBAAkB,GAAG;IAE/B,UAAU,EAAE,MAAM,CAAC;IAEnB,MAAM,CAAC,EAAE,GAAG,GAAG,SAAS,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,iBAAiB,EAAE,GAAG,CAAC;IAEvB;;OAEG;IACH,MAAM,EAAE,GAAG,GAAG,SAAS,CAAC;CACzB,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
|
@@ -98,17 +98,14 @@ export type PermissionResponse<TPermission extends PermissionTypesWithCustom> =
|
|
|
98
98
|
*/
|
|
99
99
|
export type PermissionResponseSanitized<TPermission extends PermissionTypesWithCustom> = Omit<PermissionResponse<TPermission>, 'dependencies' | 'to'>;
|
|
100
100
|
/**
|
|
101
|
-
* Represents a gator ERC-7715 granted(ie. signed by
|
|
101
|
+
* Represents a gator ERC-7715 granted(ie. signed by a user's account) permission entry that is stored in profile sync.
|
|
102
102
|
*
|
|
103
103
|
* @template Permission - The type of the permission provided
|
|
104
104
|
*/
|
|
105
105
|
export type StoredGatorPermission<TPermission extends PermissionTypesWithCustom> = {
|
|
106
106
|
permissionResponse: PermissionResponse<TPermission>;
|
|
107
107
|
siteOrigin: string;
|
|
108
|
-
|
|
109
|
-
* Flag indicating whether this permission has been revoked.
|
|
110
|
-
*/
|
|
111
|
-
isRevoked?: boolean;
|
|
108
|
+
revocationMetadata?: RevocationMetadata;
|
|
112
109
|
};
|
|
113
110
|
/**
|
|
114
111
|
* Represents a sanitized version of the StoredGatorPermission type. Some fields have been removed but the fields are still present in profile sync.
|
|
@@ -118,10 +115,7 @@ export type StoredGatorPermission<TPermission extends PermissionTypesWithCustom>
|
|
|
118
115
|
export type StoredGatorPermissionSanitized<TPermission extends PermissionTypesWithCustom> = {
|
|
119
116
|
permissionResponse: PermissionResponseSanitized<TPermission>;
|
|
120
117
|
siteOrigin: string;
|
|
121
|
-
|
|
122
|
-
* Flag indicating whether this permission has been revoked.
|
|
123
|
-
*/
|
|
124
|
-
isRevoked?: boolean;
|
|
118
|
+
revocationMetadata?: RevocationMetadata;
|
|
125
119
|
};
|
|
126
120
|
/**
|
|
127
121
|
* Represents a map of gator permissions by chainId and permission type.
|
|
@@ -163,13 +157,24 @@ export type GatorPermissionsListByPermissionTypeAndChainId<TPermissionType exten
|
|
|
163
157
|
*/
|
|
164
158
|
export type DelegationDetails = Pick<Delegation<Hex>, 'caveats' | 'delegator' | 'delegate' | 'authority'>;
|
|
165
159
|
/**
|
|
166
|
-
* Represents the
|
|
160
|
+
* Represents the metadata for confirmed transaction revocation.
|
|
161
|
+
*/
|
|
162
|
+
export type RevocationMetadata = {
|
|
163
|
+
recordedAt: number;
|
|
164
|
+
txHash?: Hex | undefined;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Parameters for the `permissionsProvider_submitRevocation` method
|
|
167
168
|
*/
|
|
168
169
|
export type RevocationParams = {
|
|
169
170
|
/**
|
|
170
171
|
* The permission context as a hex string that identifies the permission to revoke.
|
|
171
172
|
*/
|
|
172
173
|
permissionContext: Hex;
|
|
174
|
+
/**
|
|
175
|
+
* The hash of the transaction that was used to revoke the permission. Optional because we might not have submitted the transaction ourselves.
|
|
176
|
+
*/
|
|
177
|
+
txHash: Hex | undefined;
|
|
173
178
|
};
|
|
174
179
|
/**
|
|
175
180
|
* Represents the parameters for adding a pending revocation.
|
package/dist/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,2BAA2B,EAC3B,6BAA6B,EAC7B,0BAA0B,EAC1B,4BAA4B,EAC5B,IAAI,EACJ,0BAA0B,EAC1B,8BAA8B,EAC/B,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;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG;IAC9C,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,CAAC,WAAW,SAAS,yBAAyB,IAAI;IAC7E;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC;IAEb;;;;OAIG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC;IAEX;;OAEG;IACH,EAAE,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AEzC;;GAEG;AACH,MAAM,MAAM,8CAA8C,CACxD,eAAe,SAAS,4BAA4B,IAClD,mBAAmB,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC;AAE9C;;GAEG;AACH,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,kBAAkB,GAAG;IAE/B,UAAU,EAAE,MAAM,CAAC;IAEnB,MAAM,CAAC,EAAE,GAAG,GAAG,SAAS,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,iBAAiB,EAAE,GAAG,CAAC;IAEvB;;OAEG;IACH,MAAM,EAAE,GAAG,GAAG,SAAS,CAAC;CACzB,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.mjs.map
CHANGED
|
@@ -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 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
|
|
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 a user's 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 revocationMetadata?: RevocationMetadata;\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 revocationMetadata?: RevocationMetadata;\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 metadata for confirmed transaction revocation.\n */\nexport type RevocationMetadata = {\n // The timestamp at which the revocation was recorded in storage.\n recordedAt: number;\n // The hash of the transaction that was used to revoke the permission. Optional because we might not have submitted the transaction ourselves.\n txHash?: Hex | undefined;\n};\n\n/**\n * Parameters for the `permissionsProvider_submitRevocation` method\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 * The hash of the transaction that was used to revoke the permission. Optional because we might not have submitted the transaction ourselves.\n */\n txHash: Hex | undefined;\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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/gator-permissions-controller",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Controller for managing gator permissions with profile sync integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@metamask/snaps-controllers": "^17.2.0",
|
|
57
57
|
"@metamask/snaps-sdk": "^10.3.0",
|
|
58
58
|
"@metamask/snaps-utils": "^11.7.0",
|
|
59
|
-
"@metamask/transaction-controller": "^62.9.
|
|
59
|
+
"@metamask/transaction-controller": "^62.9.2",
|
|
60
60
|
"@metamask/utils": "^11.9.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|