@metamask/snaps-controllers 2.0.0 → 2.0.1
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 +6 -1
- package/dist/cjs/snaps/SnapController.js +3 -10
- package/dist/cjs/snaps/SnapController.js.map +1 -1
- package/dist/cjs/snaps/endowments/enum.js +0 -1
- package/dist/cjs/snaps/endowments/enum.js.map +1 -1
- package/dist/cjs/snaps/endowments/index.js +0 -2
- package/dist/cjs/snaps/endowments/index.js.map +1 -1
- package/dist/esm/snaps/SnapController.js +4 -11
- package/dist/esm/snaps/SnapController.js.map +1 -1
- package/dist/esm/snaps/endowments/enum.js +0 -1
- package/dist/esm/snaps/endowments/enum.js.map +1 -1
- package/dist/esm/snaps/endowments/index.js +0 -2
- package/dist/esm/snaps/endowments/index.js.map +1 -1
- package/dist/types/snaps/endowments/enum.d.ts +0 -1
- package/dist/types/snaps/endowments/index.d.ts +0 -9
- package/package.json +4 -4
- package/dist/cjs/snaps/endowments/long-running.js +0 -38
- package/dist/cjs/snaps/endowments/long-running.js.map +0 -1
- package/dist/esm/snaps/endowments/long-running.js +0 -28
- package/dist/esm/snaps/endowments/long-running.js.map +0 -1
- package/dist/types/snaps/endowments/long-running.d.ts +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [2.0.1]
|
|
10
|
+
### Changed
|
|
11
|
+
- Remove deprecated `endowment:long-running` ([#1751](https://github.com/MetaMask/snaps/pull/1751))
|
|
12
|
+
|
|
9
13
|
## [2.0.0]
|
|
10
14
|
### Changed
|
|
11
15
|
- Initial stable release from main branch ([#1757](https://github.com/MetaMask/snaps/pull/1757))
|
|
@@ -51,7 +55,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
51
55
|
- The version of the package no longer needs to match the version of all other
|
|
52
56
|
MetaMask Snaps packages.
|
|
53
57
|
|
|
54
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@2.0.
|
|
58
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@2.0.1...HEAD
|
|
59
|
+
[2.0.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@2.0.0...@metamask/snaps-controllers@2.0.1
|
|
55
60
|
[2.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@0.39.0-flask.1...@metamask/snaps-controllers@2.0.0
|
|
56
61
|
[0.39.0-flask.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@0.38.3-flask.1...@metamask/snaps-controllers@0.39.0-flask.1
|
|
57
62
|
[0.38.3-flask.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@0.38.2-flask.1...@metamask/snaps-controllers@0.38.3-flask.1
|
|
@@ -1022,7 +1022,6 @@ class SnapController extends _basecontroller.BaseControllerV2 {
|
|
|
1022
1022
|
* Awaits the specified promise and rejects if the promise doesn't resolve
|
|
1023
1023
|
* before the timeout.
|
|
1024
1024
|
*
|
|
1025
|
-
* @param snapId - The snap id.
|
|
1026
1025
|
* @param promise - The promise to await.
|
|
1027
1026
|
* @param timer - An optional timer object to control the timeout.
|
|
1028
1027
|
* @returns The result of the promise or rejects if the promise times out.
|
|
@@ -1380,7 +1379,7 @@ async function startSnap(snapData) {
|
|
|
1380
1379
|
throw new Error(`Snap "${snapId}" is already started.`);
|
|
1381
1380
|
}
|
|
1382
1381
|
try {
|
|
1383
|
-
const result = await _class_private_method_get(this, _executeWithTimeout, executeWithTimeout).call(this,
|
|
1382
|
+
const result = await _class_private_method_get(this, _executeWithTimeout, executeWithTimeout).call(this, this.messagingSystem.call('ExecutionService:executeSnap', {
|
|
1384
1383
|
...snapData,
|
|
1385
1384
|
endowments: await _class_private_method_get(this, _getEndowments, getEndowments).call(this, snapId)
|
|
1386
1385
|
}));
|
|
@@ -1558,7 +1557,7 @@ function getRpcRequestHandler(snapId) {
|
|
|
1558
1557
|
});
|
|
1559
1558
|
// This will either get the result or reject due to the timeout.
|
|
1560
1559
|
try {
|
|
1561
|
-
const result = await _class_private_method_get(this, _executeWithTimeout, executeWithTimeout).call(this,
|
|
1560
|
+
const result = await _class_private_method_get(this, _executeWithTimeout, executeWithTimeout).call(this, handleRpcRequestPromise, timer);
|
|
1562
1561
|
_class_private_method_get(this, _recordSnapRpcRequestFinish, recordSnapRpcRequestFinish).call(this, snapId, request.id);
|
|
1563
1562
|
return result;
|
|
1564
1563
|
} catch (error) {
|
|
@@ -1569,13 +1568,7 @@ function getRpcRequestHandler(snapId) {
|
|
|
1569
1568
|
runtime.rpcHandler = rpcHandler;
|
|
1570
1569
|
return rpcHandler;
|
|
1571
1570
|
}
|
|
1572
|
-
async function executeWithTimeout(
|
|
1573
|
-
const isLongRunning = this.messagingSystem.call('PermissionController:hasPermission', snapId, _endowments.SnapEndowments.LongRunning);
|
|
1574
|
-
// Long running snaps have timeouts disabled
|
|
1575
|
-
if (isLongRunning) {
|
|
1576
|
-
(0, _snapsutils.logWarning)(`${_endowments.SnapEndowments.LongRunning} will soon be deprecated. For more information please see https://github.com/MetaMask/snaps-monorepo/issues/945.`);
|
|
1577
|
-
return promise;
|
|
1578
|
-
}
|
|
1571
|
+
async function executeWithTimeout(promise, timer) {
|
|
1579
1572
|
const result = await (0, _utils1.withTimeout)(promise, timer ?? this.maxRequestTime);
|
|
1580
1573
|
if (result === _utils1.hasTimedOut) {
|
|
1581
1574
|
throw new Error('The request timed out.');
|