@metamask/snaps-controllers 2.0.0 → 2.0.2

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.
@@ -1,7 +1,6 @@
1
1
  export var SnapEndowments;
2
2
  (function(SnapEndowments) {
3
3
  SnapEndowments["NetworkAccess"] = 'endowment:network-access';
4
- SnapEndowments["LongRunning"] = 'endowment:long-running';
5
4
  SnapEndowments["TransactionInsight"] = 'endowment:transaction-insight';
6
5
  SnapEndowments["Cronjob"] = 'endowment:cronjob';
7
6
  SnapEndowments["EthereumProvider"] = 'endowment:ethereum-provider';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/snaps/endowments/enum.ts"],"sourcesContent":["export enum SnapEndowments {\n NetworkAccess = 'endowment:network-access',\n LongRunning = 'endowment:long-running',\n TransactionInsight = 'endowment:transaction-insight',\n Cronjob = 'endowment:cronjob',\n EthereumProvider = 'endowment:ethereum-provider',\n Rpc = 'endowment:rpc',\n WebAssemblyAccess = 'endowment:webassembly',\n NameLookup = 'endowment:name-lookup',\n LifecycleHooks = 'endowment:lifecycle-hooks',\n}\n"],"names":["SnapEndowments","NetworkAccess","LongRunning","TransactionInsight","Cronjob","EthereumProvider","Rpc","WebAssemblyAccess","NameLookup","LifecycleHooks"],"mappings":"WAAO;UAAKA,cAAc;IAAdA,eACVC,mBAAgB;IADND,eAEVE,iBAAc;IAFJF,eAGVG,wBAAqB;IAHXH,eAIVI,aAAU;IAJAJ,eAKVK,sBAAmB;IALTL,eAMVM,SAAM;IANIN,eAOVO,uBAAoB;IAPVP,eAQVQ,gBAAa;IARHR,eASVS,oBAAiB;GATPT,mBAAAA"}
1
+ {"version":3,"sources":["../../../../src/snaps/endowments/enum.ts"],"sourcesContent":["export enum SnapEndowments {\n NetworkAccess = 'endowment:network-access',\n TransactionInsight = 'endowment:transaction-insight',\n Cronjob = 'endowment:cronjob',\n EthereumProvider = 'endowment:ethereum-provider',\n Rpc = 'endowment:rpc',\n WebAssemblyAccess = 'endowment:webassembly',\n NameLookup = 'endowment:name-lookup',\n LifecycleHooks = 'endowment:lifecycle-hooks',\n}\n"],"names":["SnapEndowments","NetworkAccess","TransactionInsight","Cronjob","EthereumProvider","Rpc","WebAssemblyAccess","NameLookup","LifecycleHooks"],"mappings":"WAAO;UAAKA,cAAc;IAAdA,eACVC,mBAAgB;IADND,eAEVE,wBAAqB;IAFXF,eAGVG,aAAU;IAHAH,eAIVI,sBAAmB;IAJTJ,eAKVK,SAAM;IALIL,eAMVM,uBAAoB;IANVN,eAOVO,gBAAa;IAPHP,eAQVQ,oBAAiB;GARPR,mBAAAA"}
@@ -2,7 +2,6 @@ import { HandlerType } from '@metamask/snaps-utils';
2
2
  import { cronjobCaveatSpecifications, cronjobEndowmentBuilder, getCronjobCaveatMapper } from './cronjob';
3
3
  import { ethereumProviderEndowmentBuilder } from './ethereum-provider';
4
4
  import { lifecycleHooksEndowmentBuilder } from './lifecycle-hooks';
5
- import { longRunningEndowmentBuilder } from './long-running';
6
5
  import { getNameLookupCaveatMapper, nameLookupCaveatSpecifications, nameLookupEndowmentBuilder } from './name-lookup';
7
6
  import { networkAccessEndowmentBuilder } from './network-access';
8
7
  import { getRpcCaveatMapper, rpcCaveatSpecifications, rpcEndowmentBuilder } from './rpc';
@@ -10,7 +9,6 @@ import { getTransactionInsightCaveatMapper, transactionInsightCaveatSpecificatio
10
9
  import { webAssemblyEndowmentBuilder } from './web-assembly';
11
10
  export const endowmentPermissionBuilders = {
12
11
  [networkAccessEndowmentBuilder.targetName]: networkAccessEndowmentBuilder,
13
- [longRunningEndowmentBuilder.targetName]: longRunningEndowmentBuilder,
14
12
  [transactionInsightEndowmentBuilder.targetName]: transactionInsightEndowmentBuilder,
15
13
  [cronjobEndowmentBuilder.targetName]: cronjobEndowmentBuilder,
16
14
  [ethereumProviderEndowmentBuilder.targetName]: ethereumProviderEndowmentBuilder,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/snaps/endowments/index.ts"],"sourcesContent":["import type { PermissionConstraint } from '@metamask/permission-controller';\nimport { HandlerType } from '@metamask/snaps-utils';\nimport type { Json } from '@metamask/utils';\n\nimport {\n cronjobCaveatSpecifications,\n cronjobEndowmentBuilder,\n getCronjobCaveatMapper,\n} from './cronjob';\nimport { ethereumProviderEndowmentBuilder } from './ethereum-provider';\nimport { lifecycleHooksEndowmentBuilder } from './lifecycle-hooks';\nimport { longRunningEndowmentBuilder } from './long-running';\nimport {\n getNameLookupCaveatMapper,\n nameLookupCaveatSpecifications,\n nameLookupEndowmentBuilder,\n} from './name-lookup';\nimport { networkAccessEndowmentBuilder } from './network-access';\nimport {\n getRpcCaveatMapper,\n rpcCaveatSpecifications,\n rpcEndowmentBuilder,\n} from './rpc';\nimport {\n getTransactionInsightCaveatMapper,\n transactionInsightCaveatSpecifications,\n transactionInsightEndowmentBuilder,\n} from './transaction-insight';\nimport { webAssemblyEndowmentBuilder } from './web-assembly';\n\nexport const endowmentPermissionBuilders = {\n [networkAccessEndowmentBuilder.targetName]: networkAccessEndowmentBuilder,\n [longRunningEndowmentBuilder.targetName]: longRunningEndowmentBuilder,\n [transactionInsightEndowmentBuilder.targetName]:\n transactionInsightEndowmentBuilder,\n [cronjobEndowmentBuilder.targetName]: cronjobEndowmentBuilder,\n [ethereumProviderEndowmentBuilder.targetName]:\n ethereumProviderEndowmentBuilder,\n [rpcEndowmentBuilder.targetName]: rpcEndowmentBuilder,\n [webAssemblyEndowmentBuilder.targetName]: webAssemblyEndowmentBuilder,\n [nameLookupEndowmentBuilder.targetName]: nameLookupEndowmentBuilder,\n [lifecycleHooksEndowmentBuilder.targetName]: lifecycleHooksEndowmentBuilder,\n} as const;\n\nexport const endowmentCaveatSpecifications = {\n ...cronjobCaveatSpecifications,\n ...transactionInsightCaveatSpecifications,\n ...rpcCaveatSpecifications,\n ...nameLookupCaveatSpecifications,\n};\n\nexport const endowmentCaveatMappers: Record<\n string,\n (value: Json) => Pick<PermissionConstraint, 'caveats'>\n> = {\n [cronjobEndowmentBuilder.targetName]: getCronjobCaveatMapper,\n [transactionInsightEndowmentBuilder.targetName]:\n getTransactionInsightCaveatMapper,\n [rpcEndowmentBuilder.targetName]: getRpcCaveatMapper,\n [nameLookupEndowmentBuilder.targetName]: getNameLookupCaveatMapper,\n};\n\nexport const handlerEndowments: Record<HandlerType, string> = {\n [HandlerType.OnRpcRequest]: rpcEndowmentBuilder.targetName,\n [HandlerType.OnTransaction]: transactionInsightEndowmentBuilder.targetName,\n [HandlerType.OnCronjob]: cronjobEndowmentBuilder.targetName,\n [HandlerType.OnNameLookup]: nameLookupEndowmentBuilder.targetName,\n [HandlerType.OnInstall]: lifecycleHooksEndowmentBuilder.targetName,\n [HandlerType.OnUpdate]: lifecycleHooksEndowmentBuilder.targetName,\n};\n\nexport * from './enum';\nexport { getRpcCaveatOrigins } from './rpc';\nexport { getTransactionOriginCaveat } from './transaction-insight';\nexport { getChainIdsCaveat } from './name-lookup';\n"],"names":["HandlerType","cronjobCaveatSpecifications","cronjobEndowmentBuilder","getCronjobCaveatMapper","ethereumProviderEndowmentBuilder","lifecycleHooksEndowmentBuilder","longRunningEndowmentBuilder","getNameLookupCaveatMapper","nameLookupCaveatSpecifications","nameLookupEndowmentBuilder","networkAccessEndowmentBuilder","getRpcCaveatMapper","rpcCaveatSpecifications","rpcEndowmentBuilder","getTransactionInsightCaveatMapper","transactionInsightCaveatSpecifications","transactionInsightEndowmentBuilder","webAssemblyEndowmentBuilder","endowmentPermissionBuilders","targetName","endowmentCaveatSpecifications","endowmentCaveatMappers","handlerEndowments","OnRpcRequest","OnTransaction","OnCronjob","OnNameLookup","OnInstall","OnUpdate","getRpcCaveatOrigins","getTransactionOriginCaveat","getChainIdsCaveat"],"mappings":"AACA,SAASA,WAAW,QAAQ,wBAAwB;AAGpD,SACEC,2BAA2B,EAC3BC,uBAAuB,EACvBC,sBAAsB,QACjB,YAAY;AACnB,SAASC,gCAAgC,QAAQ,sBAAsB;AACvE,SAASC,8BAA8B,QAAQ,oBAAoB;AACnE,SAASC,2BAA2B,QAAQ,iBAAiB;AAC7D,SACEC,yBAAyB,EACzBC,8BAA8B,EAC9BC,0BAA0B,QACrB,gBAAgB;AACvB,SAASC,6BAA6B,QAAQ,mBAAmB;AACjE,SACEC,kBAAkB,EAClBC,uBAAuB,EACvBC,mBAAmB,QACd,QAAQ;AACf,SACEC,iCAAiC,EACjCC,sCAAsC,EACtCC,kCAAkC,QAC7B,wBAAwB;AAC/B,SAASC,2BAA2B,QAAQ,iBAAiB;AAE7D,OAAO,MAAMC,8BAA8B;IACzC,CAACR,8BAA8BS,UAAU,CAAC,EAAET;IAC5C,CAACJ,4BAA4Ba,UAAU,CAAC,EAAEb;IAC1C,CAACU,mCAAmCG,UAAU,CAAC,EAC7CH;IACF,CAACd,wBAAwBiB,UAAU,CAAC,EAAEjB;IACtC,CAACE,iCAAiCe,UAAU,CAAC,EAC3Cf;IACF,CAACS,oBAAoBM,UAAU,CAAC,EAAEN;IAClC,CAACI,4BAA4BE,UAAU,CAAC,EAAEF;IAC1C,CAACR,2BAA2BU,UAAU,CAAC,EAAEV;IACzC,CAACJ,+BAA+Bc,UAAU,CAAC,EAAEd;AAC/C,EAAW;AAEX,OAAO,MAAMe,gCAAgC;IAC3C,GAAGnB,2BAA2B;IAC9B,GAAGc,sCAAsC;IACzC,GAAGH,uBAAuB;IAC1B,GAAGJ,8BAA8B;AACnC,EAAE;AAEF,OAAO,MAAMa,yBAGT;IACF,CAACnB,wBAAwBiB,UAAU,CAAC,EAAEhB;IACtC,CAACa,mCAAmCG,UAAU,CAAC,EAC7CL;IACF,CAACD,oBAAoBM,UAAU,CAAC,EAAER;IAClC,CAACF,2BAA2BU,UAAU,CAAC,EAAEZ;AAC3C,EAAE;AAEF,OAAO,MAAMe,oBAAiD;IAC5D,CAACtB,YAAYuB,YAAY,CAAC,EAAEV,oBAAoBM,UAAU;IAC1D,CAACnB,YAAYwB,aAAa,CAAC,EAAER,mCAAmCG,UAAU;IAC1E,CAACnB,YAAYyB,SAAS,CAAC,EAAEvB,wBAAwBiB,UAAU;IAC3D,CAACnB,YAAY0B,YAAY,CAAC,EAAEjB,2BAA2BU,UAAU;IACjE,CAACnB,YAAY2B,SAAS,CAAC,EAAEtB,+BAA+Bc,UAAU;IAClE,CAACnB,YAAY4B,QAAQ,CAAC,EAAEvB,+BAA+Bc,UAAU;AACnE,EAAE;AAEF,cAAc,SAAS;AACvB,SAASU,mBAAmB,QAAQ,QAAQ;AAC5C,SAASC,0BAA0B,QAAQ,wBAAwB;AACnE,SAASC,iBAAiB,QAAQ,gBAAgB"}
1
+ {"version":3,"sources":["../../../../src/snaps/endowments/index.ts"],"sourcesContent":["import type { PermissionConstraint } from '@metamask/permission-controller';\nimport { HandlerType } from '@metamask/snaps-utils';\nimport type { Json } from '@metamask/utils';\n\nimport {\n cronjobCaveatSpecifications,\n cronjobEndowmentBuilder,\n getCronjobCaveatMapper,\n} from './cronjob';\nimport { ethereumProviderEndowmentBuilder } from './ethereum-provider';\nimport { lifecycleHooksEndowmentBuilder } from './lifecycle-hooks';\nimport {\n getNameLookupCaveatMapper,\n nameLookupCaveatSpecifications,\n nameLookupEndowmentBuilder,\n} from './name-lookup';\nimport { networkAccessEndowmentBuilder } from './network-access';\nimport {\n getRpcCaveatMapper,\n rpcCaveatSpecifications,\n rpcEndowmentBuilder,\n} from './rpc';\nimport {\n getTransactionInsightCaveatMapper,\n transactionInsightCaveatSpecifications,\n transactionInsightEndowmentBuilder,\n} from './transaction-insight';\nimport { webAssemblyEndowmentBuilder } from './web-assembly';\n\nexport const endowmentPermissionBuilders = {\n [networkAccessEndowmentBuilder.targetName]: networkAccessEndowmentBuilder,\n [transactionInsightEndowmentBuilder.targetName]:\n transactionInsightEndowmentBuilder,\n [cronjobEndowmentBuilder.targetName]: cronjobEndowmentBuilder,\n [ethereumProviderEndowmentBuilder.targetName]:\n ethereumProviderEndowmentBuilder,\n [rpcEndowmentBuilder.targetName]: rpcEndowmentBuilder,\n [webAssemblyEndowmentBuilder.targetName]: webAssemblyEndowmentBuilder,\n [nameLookupEndowmentBuilder.targetName]: nameLookupEndowmentBuilder,\n [lifecycleHooksEndowmentBuilder.targetName]: lifecycleHooksEndowmentBuilder,\n} as const;\n\nexport const endowmentCaveatSpecifications = {\n ...cronjobCaveatSpecifications,\n ...transactionInsightCaveatSpecifications,\n ...rpcCaveatSpecifications,\n ...nameLookupCaveatSpecifications,\n};\n\nexport const endowmentCaveatMappers: Record<\n string,\n (value: Json) => Pick<PermissionConstraint, 'caveats'>\n> = {\n [cronjobEndowmentBuilder.targetName]: getCronjobCaveatMapper,\n [transactionInsightEndowmentBuilder.targetName]:\n getTransactionInsightCaveatMapper,\n [rpcEndowmentBuilder.targetName]: getRpcCaveatMapper,\n [nameLookupEndowmentBuilder.targetName]: getNameLookupCaveatMapper,\n};\n\nexport const handlerEndowments: Record<HandlerType, string> = {\n [HandlerType.OnRpcRequest]: rpcEndowmentBuilder.targetName,\n [HandlerType.OnTransaction]: transactionInsightEndowmentBuilder.targetName,\n [HandlerType.OnCronjob]: cronjobEndowmentBuilder.targetName,\n [HandlerType.OnNameLookup]: nameLookupEndowmentBuilder.targetName,\n [HandlerType.OnInstall]: lifecycleHooksEndowmentBuilder.targetName,\n [HandlerType.OnUpdate]: lifecycleHooksEndowmentBuilder.targetName,\n};\n\nexport * from './enum';\nexport { getRpcCaveatOrigins } from './rpc';\nexport { getTransactionOriginCaveat } from './transaction-insight';\nexport { getChainIdsCaveat } from './name-lookup';\n"],"names":["HandlerType","cronjobCaveatSpecifications","cronjobEndowmentBuilder","getCronjobCaveatMapper","ethereumProviderEndowmentBuilder","lifecycleHooksEndowmentBuilder","getNameLookupCaveatMapper","nameLookupCaveatSpecifications","nameLookupEndowmentBuilder","networkAccessEndowmentBuilder","getRpcCaveatMapper","rpcCaveatSpecifications","rpcEndowmentBuilder","getTransactionInsightCaveatMapper","transactionInsightCaveatSpecifications","transactionInsightEndowmentBuilder","webAssemblyEndowmentBuilder","endowmentPermissionBuilders","targetName","endowmentCaveatSpecifications","endowmentCaveatMappers","handlerEndowments","OnRpcRequest","OnTransaction","OnCronjob","OnNameLookup","OnInstall","OnUpdate","getRpcCaveatOrigins","getTransactionOriginCaveat","getChainIdsCaveat"],"mappings":"AACA,SAASA,WAAW,QAAQ,wBAAwB;AAGpD,SACEC,2BAA2B,EAC3BC,uBAAuB,EACvBC,sBAAsB,QACjB,YAAY;AACnB,SAASC,gCAAgC,QAAQ,sBAAsB;AACvE,SAASC,8BAA8B,QAAQ,oBAAoB;AACnE,SACEC,yBAAyB,EACzBC,8BAA8B,EAC9BC,0BAA0B,QACrB,gBAAgB;AACvB,SAASC,6BAA6B,QAAQ,mBAAmB;AACjE,SACEC,kBAAkB,EAClBC,uBAAuB,EACvBC,mBAAmB,QACd,QAAQ;AACf,SACEC,iCAAiC,EACjCC,sCAAsC,EACtCC,kCAAkC,QAC7B,wBAAwB;AAC/B,SAASC,2BAA2B,QAAQ,iBAAiB;AAE7D,OAAO,MAAMC,8BAA8B;IACzC,CAACR,8BAA8BS,UAAU,CAAC,EAAET;IAC5C,CAACM,mCAAmCG,UAAU,CAAC,EAC7CH;IACF,CAACb,wBAAwBgB,UAAU,CAAC,EAAEhB;IACtC,CAACE,iCAAiCc,UAAU,CAAC,EAC3Cd;IACF,CAACQ,oBAAoBM,UAAU,CAAC,EAAEN;IAClC,CAACI,4BAA4BE,UAAU,CAAC,EAAEF;IAC1C,CAACR,2BAA2BU,UAAU,CAAC,EAAEV;IACzC,CAACH,+BAA+Ba,UAAU,CAAC,EAAEb;AAC/C,EAAW;AAEX,OAAO,MAAMc,gCAAgC;IAC3C,GAAGlB,2BAA2B;IAC9B,GAAGa,sCAAsC;IACzC,GAAGH,uBAAuB;IAC1B,GAAGJ,8BAA8B;AACnC,EAAE;AAEF,OAAO,MAAMa,yBAGT;IACF,CAAClB,wBAAwBgB,UAAU,CAAC,EAAEf;IACtC,CAACY,mCAAmCG,UAAU,CAAC,EAC7CL;IACF,CAACD,oBAAoBM,UAAU,CAAC,EAAER;IAClC,CAACF,2BAA2BU,UAAU,CAAC,EAAEZ;AAC3C,EAAE;AAEF,OAAO,MAAMe,oBAAiD;IAC5D,CAACrB,YAAYsB,YAAY,CAAC,EAAEV,oBAAoBM,UAAU;IAC1D,CAAClB,YAAYuB,aAAa,CAAC,EAAER,mCAAmCG,UAAU;IAC1E,CAAClB,YAAYwB,SAAS,CAAC,EAAEtB,wBAAwBgB,UAAU;IAC3D,CAAClB,YAAYyB,YAAY,CAAC,EAAEjB,2BAA2BU,UAAU;IACjE,CAAClB,YAAY0B,SAAS,CAAC,EAAErB,+BAA+Ba,UAAU;IAClE,CAAClB,YAAY2B,QAAQ,CAAC,EAAEtB,+BAA+Ba,UAAU;AACnE,EAAE;AAEF,cAAc,SAAS;AACvB,SAASU,mBAAmB,QAAQ,QAAQ;AAC5C,SAASC,0BAA0B,QAAQ,wBAAwB;AACnE,SAASC,iBAAiB,QAAQ,gBAAgB"}
@@ -205,7 +205,15 @@ export declare type SnapInstalled = {
205
205
  payload: [snap: TruncatedSnap];
206
206
  };
207
207
  /**
208
- * Emitted when a snap is removed.
208
+ * Emitted when a snap that has previously been fully installed, is uninstalled.
209
+ */
210
+ export declare type SnapUninstalled = {
211
+ type: `${typeof controllerName}:snapUninstalled`;
212
+ payload: [snap: TruncatedSnap];
213
+ };
214
+ /**
215
+ * Emitted when a snap is removed from state, this may happen even
216
+ * if a snap has not fully completed installation.
209
217
  */
210
218
  export declare type SnapRemoved = {
211
219
  type: `${typeof controllerName}:snapRemoved`;
@@ -255,19 +263,11 @@ export declare type SnapDisabled = {
255
263
  type: `${typeof controllerName}:snapDisabled`;
256
264
  payload: [snap: TruncatedSnap];
257
265
  };
258
- export declare type SnapControllerEvents = SnapAdded | SnapBlocked | SnapInstalled | SnapRemoved | SnapStateChange | SnapUnblocked | SnapUpdated | SnapRolledback | SnapTerminated | SnapEnabled | SnapDisabled;
266
+ export declare type SnapControllerEvents = SnapAdded | SnapBlocked | SnapInstalled | SnapUninstalled | SnapRemoved | SnapStateChange | SnapUnblocked | SnapUpdated | SnapRolledback | SnapTerminated | SnapEnabled | SnapDisabled;
259
267
  export declare type AllowedActions = GetEndowments | GetPermissions | GetSubjects | GetSubjectMetadata | HasPermission | HasPermissions | RevokePermissions | RevokeAllPermissions | RevokePermissionForAllSubjects | GrantPermissions | AddApprovalRequest | HandleRpcRequestAction | ExecuteSnapAction | TerminateAllSnapsAction | TerminateSnapAction | UpdateCaveat | UpdateRequestState | GetResult | GetMetadata | Update;
260
268
  export declare type AllowedEvents = ExecutionServiceEvents | SnapInstalled | SnapUpdated;
261
269
  declare type SnapControllerMessenger = RestrictedControllerMessenger<typeof controllerName, SnapControllerActions | AllowedActions, SnapControllerEvents | AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
262
270
  declare type FeatureFlags = {
263
- /**
264
- * We still need to implement new UI approval page in metamask-extension before we can allow
265
- * DApps to update Snaps. After it's added, this flag can be removed.
266
- *
267
- * @see {SNAP_APPROVAL_UPDATE}
268
- * @see {SnapController.processRequestedSnap}
269
- */
270
- dappsCanUpdateSnaps?: true;
271
271
  requireAllowlist?: true;
272
272
  allowLocalSnaps?: true;
273
273
  };
@@ -564,9 +564,10 @@ export declare class SnapController extends BaseController<string, SnapControlle
564
564
  * @param snapId - The id of the Snap to be updated.
565
565
  * @param location - The location implementation of the snap.
566
566
  * @param newVersionRange - A semver version range in which the maximum version will be chosen.
567
+ * @param emitEvent - An optional boolean flag to indicate whether this update should emit an event.
567
568
  * @returns The snap metadata if updated, `null` otherwise.
568
569
  */
569
- updateSnap(origin: string, snapId: ValidatedSnapId, location: SnapLocation, newVersionRange?: string): Promise<TruncatedSnap>;
570
+ updateSnap(origin: string, snapId: ValidatedSnapId, location: SnapLocation, newVersionRange?: string, emitEvent?: boolean): Promise<TruncatedSnap>;
570
571
  /**
571
572
  * Get metadata for the given snap ID.
572
573
  *
@@ -1,6 +1,5 @@
1
1
  export declare enum SnapEndowments {
2
2
  NetworkAccess = "endowment:network-access",
3
- LongRunning = "endowment:long-running",
4
3
  TransactionInsight = "endowment:transaction-insight",
5
4
  Cronjob = "endowment:cronjob",
6
5
  EthereumProvider = "endowment:ethereum-provider",
@@ -11,15 +11,6 @@ export declare const endowmentPermissionBuilders: {
11
11
  allowedCaveats: null;
12
12
  }>;
13
13
  }>;
14
- readonly "endowment:long-running": Readonly<{
15
- readonly targetName: import("./enum").SnapEndowments.LongRunning;
16
- readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.Endowment, any, {
17
- permissionType: import("@metamask/permission-controller").PermissionType.Endowment;
18
- targetName: import("./enum").SnapEndowments.LongRunning;
19
- endowmentGetter: (_options?: any) => undefined;
20
- allowedCaveats: null;
21
- }>;
22
- }>;
23
14
  readonly "endowment:transaction-insight": Readonly<{
24
15
  readonly targetName: import("./enum").SnapEndowments.TransactionInsight;
25
16
  readonly specificationBuilder: import("@metamask/permission-controller").PermissionSpecificationBuilder<import("@metamask/permission-controller").PermissionType.Endowment, any, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/snaps-controllers",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Controllers for MetaMask Snaps.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -49,9 +49,9 @@
49
49
  "@metamask/permission-controller": "^4.1.0",
50
50
  "@metamask/post-message-stream": "^7.0.0",
51
51
  "@metamask/rpc-methods": "^2.0.0",
52
- "@metamask/snaps-execution-environments": "^2.0.0",
52
+ "@metamask/snaps-execution-environments": "^2.0.1",
53
53
  "@metamask/snaps-registry": "^2.0.0",
54
- "@metamask/snaps-utils": "^2.0.0",
54
+ "@metamask/snaps-utils": "^2.0.1",
55
55
  "@metamask/utils": "^8.1.0",
56
56
  "@xstate/fsm": "^2.0.0",
57
57
  "concat-stream": "^2.0.0",
@@ -67,7 +67,7 @@
67
67
  "devDependencies": {
68
68
  "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
69
69
  "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
70
- "@lavamoat/allow-scripts": "^2.3.1",
70
+ "@lavamoat/allow-scripts": "^2.5.1",
71
71
  "@metamask/auto-changelog": "^3.1.0",
72
72
  "@metamask/eslint-config": "^12.1.0",
73
73
  "@metamask/eslint-config-jest": "^12.1.0",
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "longRunningEndowmentBuilder", {
6
- enumerable: true,
7
- get: function() {
8
- return longRunningEndowmentBuilder;
9
- }
10
- });
11
- const _permissioncontroller = require("@metamask/permission-controller");
12
- const _enum = require("./enum");
13
- const permissionName = _enum.SnapEndowments.LongRunning;
14
- /**
15
- * `endowment:long-running` returns nothing; it is intended to be used as a flag
16
- * by the `SnapController` to make it ignore the request processing timeout
17
- * during snap lifecycle management. Essentially, it allows a snap to take an
18
- * infinite amount of time to process a request.
19
- *
20
- * @param _builderOptions - Optional specification builder options.
21
- * @returns The specification for the long-running endowment.
22
- */ const specificationBuilder = (_builderOptions)=>{
23
- return {
24
- permissionType: _permissioncontroller.PermissionType.Endowment,
25
- targetName: permissionName,
26
- allowedCaveats: null,
27
- endowmentGetter: (_getterOptions)=>undefined,
28
- subjectTypes: [
29
- _permissioncontroller.SubjectType.Snap
30
- ]
31
- };
32
- };
33
- const longRunningEndowmentBuilder = Object.freeze({
34
- targetName: permissionName,
35
- specificationBuilder
36
- });
37
-
38
- //# sourceMappingURL=long-running.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/snaps/endowments/long-running.ts"],"sourcesContent":["import type {\n PermissionSpecificationBuilder,\n EndowmentGetterParams,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\n\nimport { SnapEndowments } from './enum';\n\nconst permissionName = SnapEndowments.LongRunning;\n\ntype LongRunningEndowmentSpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.Endowment;\n targetName: typeof permissionName;\n endowmentGetter: (_options?: any) => undefined;\n allowedCaveats: null;\n}>;\n\n/**\n * `endowment:long-running` returns nothing; it is intended to be used as a flag\n * by the `SnapController` to make it ignore the request processing timeout\n * during snap lifecycle management. Essentially, it allows a snap to take an\n * infinite amount of time to process a request.\n *\n * @param _builderOptions - Optional specification builder options.\n * @returns The specification for the long-running endowment.\n */\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.Endowment,\n any,\n LongRunningEndowmentSpecification\n> = (_builderOptions?: any) => {\n return {\n permissionType: PermissionType.Endowment,\n targetName: permissionName,\n allowedCaveats: null,\n endowmentGetter: (_getterOptions?: EndowmentGetterParams) => undefined,\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nexport const longRunningEndowmentBuilder = Object.freeze({\n targetName: permissionName,\n specificationBuilder,\n} as const);\n"],"names":["longRunningEndowmentBuilder","permissionName","SnapEndowments","LongRunning","specificationBuilder","_builderOptions","permissionType","PermissionType","Endowment","targetName","allowedCaveats","endowmentGetter","_getterOptions","undefined","subjectTypes","SubjectType","Snap","Object","freeze"],"mappings":";;;;+BAyCaA;;;eAAAA;;;sCApC+B;sBAEb;AAE/B,MAAMC,iBAAiBC,oBAAc,CAACC,WAAW;AASjD;;;;;;;;CAQC,GACD,MAAMC,uBAIF,CAACC;IACH,OAAO;QACLC,gBAAgBC,oCAAc,CAACC,SAAS;QACxCC,YAAYR;QACZS,gBAAgB;QAChBC,iBAAiB,CAACC,iBAA2CC;QAC7DC,cAAc;YAACC,iCAAW,CAACC,IAAI;SAAC;IAClC;AACF;AAEO,MAAMhB,8BAA8BiB,OAAOC,MAAM,CAAC;IACvDT,YAAYR;IACZG;AACF"}
@@ -1,28 +0,0 @@
1
- import { PermissionType, SubjectType } from '@metamask/permission-controller';
2
- import { SnapEndowments } from './enum';
3
- const permissionName = SnapEndowments.LongRunning;
4
- /**
5
- * `endowment:long-running` returns nothing; it is intended to be used as a flag
6
- * by the `SnapController` to make it ignore the request processing timeout
7
- * during snap lifecycle management. Essentially, it allows a snap to take an
8
- * infinite amount of time to process a request.
9
- *
10
- * @param _builderOptions - Optional specification builder options.
11
- * @returns The specification for the long-running endowment.
12
- */ const specificationBuilder = (_builderOptions)=>{
13
- return {
14
- permissionType: PermissionType.Endowment,
15
- targetName: permissionName,
16
- allowedCaveats: null,
17
- endowmentGetter: (_getterOptions)=>undefined,
18
- subjectTypes: [
19
- SubjectType.Snap
20
- ]
21
- };
22
- };
23
- export const longRunningEndowmentBuilder = Object.freeze({
24
- targetName: permissionName,
25
- specificationBuilder
26
- });
27
-
28
- //# sourceMappingURL=long-running.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/snaps/endowments/long-running.ts"],"sourcesContent":["import type {\n PermissionSpecificationBuilder,\n EndowmentGetterParams,\n ValidPermissionSpecification,\n} from '@metamask/permission-controller';\nimport { PermissionType, SubjectType } from '@metamask/permission-controller';\n\nimport { SnapEndowments } from './enum';\n\nconst permissionName = SnapEndowments.LongRunning;\n\ntype LongRunningEndowmentSpecification = ValidPermissionSpecification<{\n permissionType: PermissionType.Endowment;\n targetName: typeof permissionName;\n endowmentGetter: (_options?: any) => undefined;\n allowedCaveats: null;\n}>;\n\n/**\n * `endowment:long-running` returns nothing; it is intended to be used as a flag\n * by the `SnapController` to make it ignore the request processing timeout\n * during snap lifecycle management. Essentially, it allows a snap to take an\n * infinite amount of time to process a request.\n *\n * @param _builderOptions - Optional specification builder options.\n * @returns The specification for the long-running endowment.\n */\nconst specificationBuilder: PermissionSpecificationBuilder<\n PermissionType.Endowment,\n any,\n LongRunningEndowmentSpecification\n> = (_builderOptions?: any) => {\n return {\n permissionType: PermissionType.Endowment,\n targetName: permissionName,\n allowedCaveats: null,\n endowmentGetter: (_getterOptions?: EndowmentGetterParams) => undefined,\n subjectTypes: [SubjectType.Snap],\n };\n};\n\nexport const longRunningEndowmentBuilder = Object.freeze({\n targetName: permissionName,\n specificationBuilder,\n} as const);\n"],"names":["PermissionType","SubjectType","SnapEndowments","permissionName","LongRunning","specificationBuilder","_builderOptions","permissionType","Endowment","targetName","allowedCaveats","endowmentGetter","_getterOptions","undefined","subjectTypes","Snap","longRunningEndowmentBuilder","Object","freeze"],"mappings":"AAKA,SAASA,cAAc,EAAEC,WAAW,QAAQ,kCAAkC;AAE9E,SAASC,cAAc,QAAQ,SAAS;AAExC,MAAMC,iBAAiBD,eAAeE,WAAW;AASjD;;;;;;;;CAQC,GACD,MAAMC,uBAIF,CAACC;IACH,OAAO;QACLC,gBAAgBP,eAAeQ,SAAS;QACxCC,YAAYN;QACZO,gBAAgB;QAChBC,iBAAiB,CAACC,iBAA2CC;QAC7DC,cAAc;YAACb,YAAYc,IAAI;SAAC;IAClC;AACF;AAEA,OAAO,MAAMC,8BAA8BC,OAAOC,MAAM,CAAC;IACvDT,YAAYN;IACZE;AACF,GAAY"}
@@ -1,14 +0,0 @@
1
- import type { PermissionSpecificationBuilder } from '@metamask/permission-controller';
2
- import { PermissionType } from '@metamask/permission-controller';
3
- import { SnapEndowments } from './enum';
4
- declare const permissionName = SnapEndowments.LongRunning;
5
- export declare const longRunningEndowmentBuilder: Readonly<{
6
- readonly targetName: SnapEndowments.LongRunning;
7
- readonly specificationBuilder: PermissionSpecificationBuilder<PermissionType.Endowment, any, {
8
- permissionType: PermissionType.Endowment;
9
- targetName: typeof permissionName;
10
- endowmentGetter: (_options?: any) => undefined;
11
- allowedCaveats: null;
12
- }>;
13
- }>;
14
- export {};