@metamask/snaps-simulation 3.3.0 → 3.4.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 +10 -1
- package/dist/methods/hooks/end-trace.cjs +29 -0
- package/dist/methods/hooks/end-trace.cjs.map +1 -0
- package/dist/methods/hooks/end-trace.d.cts +9 -0
- package/dist/methods/hooks/end-trace.d.cts.map +1 -0
- package/dist/methods/hooks/end-trace.d.mts +9 -0
- package/dist/methods/hooks/end-trace.d.mts.map +1 -0
- package/dist/methods/hooks/end-trace.mjs +25 -0
- package/dist/methods/hooks/end-trace.mjs.map +1 -0
- package/dist/methods/hooks/get-snap.cjs +52 -0
- package/dist/methods/hooks/get-snap.cjs.map +1 -0
- package/dist/methods/hooks/get-snap.d.cts +11 -0
- package/dist/methods/hooks/get-snap.d.cts.map +1 -0
- package/dist/methods/hooks/get-snap.d.mts +11 -0
- package/dist/methods/hooks/get-snap.d.mts.map +1 -0
- package/dist/methods/hooks/get-snap.mjs +48 -0
- package/dist/methods/hooks/get-snap.mjs.map +1 -0
- package/dist/methods/hooks/index.cjs +5 -0
- package/dist/methods/hooks/index.cjs.map +1 -1
- package/dist/methods/hooks/index.d.cts +5 -0
- package/dist/methods/hooks/index.d.cts.map +1 -1
- package/dist/methods/hooks/index.d.mts +5 -0
- package/dist/methods/hooks/index.d.mts.map +1 -1
- package/dist/methods/hooks/index.mjs +5 -0
- package/dist/methods/hooks/index.mjs.map +1 -1
- package/dist/methods/hooks/start-trace.cjs +34 -0
- package/dist/methods/hooks/start-trace.cjs.map +1 -0
- package/dist/methods/hooks/start-trace.d.cts +9 -0
- package/dist/methods/hooks/start-trace.d.cts.map +1 -0
- package/dist/methods/hooks/start-trace.d.mts +9 -0
- package/dist/methods/hooks/start-trace.d.mts.map +1 -0
- package/dist/methods/hooks/start-trace.mjs +30 -0
- package/dist/methods/hooks/start-trace.mjs.map +1 -0
- package/dist/methods/hooks/track-error.cjs +31 -0
- package/dist/methods/hooks/track-error.cjs.map +1 -0
- package/dist/methods/hooks/track-error.d.cts +9 -0
- package/dist/methods/hooks/track-error.d.cts.map +1 -0
- package/dist/methods/hooks/track-error.d.mts +9 -0
- package/dist/methods/hooks/track-error.d.mts.map +1 -0
- package/dist/methods/hooks/track-error.mjs +27 -0
- package/dist/methods/hooks/track-error.mjs.map +1 -0
- package/dist/methods/hooks/track-event.cjs +29 -0
- package/dist/methods/hooks/track-event.cjs.map +1 -0
- package/dist/methods/hooks/track-event.d.cts +13 -0
- package/dist/methods/hooks/track-event.d.cts.map +1 -0
- package/dist/methods/hooks/track-event.d.mts +13 -0
- package/dist/methods/hooks/track-event.d.mts.map +1 -0
- package/dist/methods/hooks/track-event.mjs +25 -0
- package/dist/methods/hooks/track-event.mjs.map +1 -0
- package/dist/request.cjs +21 -1
- package/dist/request.cjs.map +1 -1
- package/dist/request.d.cts.map +1 -1
- package/dist/request.d.mts.map +1 -1
- package/dist/request.mjs +22 -2
- package/dist/request.mjs.map +1 -1
- package/dist/simulation.cjs +5 -0
- package/dist/simulation.cjs.map +1 -1
- package/dist/simulation.d.cts +34 -2
- package/dist/simulation.d.cts.map +1 -1
- package/dist/simulation.d.mts +34 -2
- package/dist/simulation.d.mts.map +1 -1
- package/dist/simulation.mjs +6 -1
- package/dist/simulation.mjs.map +1 -1
- package/dist/store/index.cjs +1 -0
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +1 -0
- package/dist/store/index.d.cts.map +1 -1
- package/dist/store/index.d.mts +1 -0
- package/dist/store/index.d.mts.map +1 -1
- package/dist/store/index.mjs +1 -0
- package/dist/store/index.mjs.map +1 -1
- package/dist/store/mocks.d.cts +1 -0
- package/dist/store/mocks.d.cts.map +1 -1
- package/dist/store/mocks.d.mts +1 -0
- package/dist/store/mocks.d.mts.map +1 -1
- package/dist/store/notifications.d.cts +1 -0
- package/dist/store/notifications.d.cts.map +1 -1
- package/dist/store/notifications.d.mts +1 -0
- package/dist/store/notifications.d.mts.map +1 -1
- package/dist/store/state.d.cts +2 -0
- package/dist/store/state.d.cts.map +1 -1
- package/dist/store/state.d.mts +2 -0
- package/dist/store/state.d.mts.map +1 -1
- package/dist/store/store.cjs +2 -0
- package/dist/store/store.cjs.map +1 -1
- package/dist/store/store.d.cts +1 -0
- package/dist/store/store.d.cts.map +1 -1
- package/dist/store/store.d.mts +1 -0
- package/dist/store/store.d.mts.map +1 -1
- package/dist/store/store.mjs +2 -0
- package/dist/store/store.mjs.map +1 -1
- package/dist/store/trackables.cjs +70 -0
- package/dist/store/trackables.cjs.map +1 -0
- package/dist/store/trackables.d.cts +98 -0
- package/dist/store/trackables.d.cts.map +1 -0
- package/dist/store/trackables.d.mts +98 -0
- package/dist/store/trackables.d.mts.map +1 -0
- package/dist/store/trackables.mjs +67 -0
- package/dist/store/trackables.mjs.map +1 -0
- package/dist/store/ui.d.cts +1 -0
- package/dist/store/ui.d.cts.map +1 -1
- package/dist/store/ui.d.mts +1 -0
- package/dist/store/ui.d.mts.map +1 -1
- package/dist/structs.cjs +17 -0
- package/dist/structs.cjs.map +1 -1
- package/dist/structs.d.cts +182 -12
- package/dist/structs.d.cts.map +1 -1
- package/dist/structs.d.mts +182 -12
- package/dist/structs.d.mts.map +1 -1
- package/dist/structs.mjs +18 -1
- package/dist/structs.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +11 -1
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +11 -1
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [3.4.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add support for `snap_startTrace` and `snap_endTrace` ([#3547](https://github.com/MetaMask/snaps/pull/3547))
|
|
15
|
+
- Add support for `snap_trackError` ([#3546](https://github.com/MetaMask/snaps/pull/3546))
|
|
16
|
+
- Add support for `snap_trackEvent` ([#3546](https://github.com/MetaMask/snaps/pull/3546))
|
|
17
|
+
|
|
10
18
|
## [3.3.0]
|
|
11
19
|
|
|
12
20
|
### Added
|
|
@@ -196,7 +204,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
196
204
|
|
|
197
205
|
- Initial release of `@metamask/snaps-simulation` package ([#2727](https://github.com/MetaMask/snaps/pull/2727))
|
|
198
206
|
|
|
199
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.
|
|
207
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.4.0...HEAD
|
|
208
|
+
[3.4.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.3.0...@metamask/snaps-simulation@3.4.0
|
|
200
209
|
[3.3.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.2.0...@metamask/snaps-simulation@3.3.0
|
|
201
210
|
[3.2.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.1.0...@metamask/snaps-simulation@3.2.0
|
|
202
211
|
[3.1.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.0.0...@metamask/snaps-simulation@3.1.0
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEndTraceImplementation = void 0;
|
|
4
|
+
const effects_1 = require("redux-saga/effects");
|
|
5
|
+
const store_1 = require("../../store/index.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* End a performance trace.
|
|
8
|
+
*
|
|
9
|
+
* @param event - The performance trace to end.
|
|
10
|
+
* @returns `null`.
|
|
11
|
+
* @yields Adds the completed trace to the store.
|
|
12
|
+
*/
|
|
13
|
+
function* endTraceImplementation(event) {
|
|
14
|
+
yield (0, effects_1.put)((0, store_1.endTrace)(event));
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get a method that can be used to end a performance trace.
|
|
19
|
+
*
|
|
20
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
21
|
+
* @returns A method that can be used to end a performance trace.
|
|
22
|
+
*/
|
|
23
|
+
function getEndTraceImplementation(runSaga) {
|
|
24
|
+
return (...args) => {
|
|
25
|
+
return runSaga(endTraceImplementation, ...args).result();
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.getEndTraceImplementation = getEndTraceImplementation;
|
|
29
|
+
//# sourceMappingURL=end-trace.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"end-trace.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/end-trace.ts"],"names":[],"mappings":";;;AAEA,gDAAyC;AAGzC,iDAAuC;AAEvC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,sBAAsB,CAAC,KAAqB;IACpD,MAAM,IAAA,aAAG,EAAC,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,yBAAyB,CAAC,OAAwB;IAChE,OAAO,CAAC,GAAG,IAA+C,EAAE,EAAE;QAC5D,OAAO,OAAO,CAAC,sBAAsB,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC;AAJD,8DAIC","sourcesContent":["import type { EndTraceParams } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { endTrace } from '../../store';\n\n/**\n * End a performance trace.\n *\n * @param event - The performance trace to end.\n * @returns `null`.\n * @yields Adds the completed trace to the store.\n */\nfunction* endTraceImplementation(event: EndTraceParams): SagaIterator {\n yield put(endTrace(event));\n return null;\n}\n\n/**\n * Get a method that can be used to end a performance trace.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to end a performance trace.\n */\nexport function getEndTraceImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof endTraceImplementation>) => {\n return runSaga(endTraceImplementation, ...args).result();\n };\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RunSagaFunction } from "../../store/index.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Get a method that can be used to end a performance trace.
|
|
4
|
+
*
|
|
5
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
6
|
+
* @returns A method that can be used to end a performance trace.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getEndTraceImplementation(runSaga: RunSagaFunction): (event: import("@metamask/snaps-sdk").EndTraceRequest) => any;
|
|
9
|
+
//# sourceMappingURL=end-trace.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"end-trace.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/end-trace.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAenD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,eAAe,iEAIjE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RunSagaFunction } from "../../store/index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Get a method that can be used to end a performance trace.
|
|
4
|
+
*
|
|
5
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
6
|
+
* @returns A method that can be used to end a performance trace.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getEndTraceImplementation(runSaga: RunSagaFunction): (event: import("@metamask/snaps-sdk").EndTraceRequest) => any;
|
|
9
|
+
//# sourceMappingURL=end-trace.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"end-trace.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/end-trace.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAenD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,eAAe,iEAIjE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { put } from "redux-saga/effects";
|
|
2
|
+
import { endTrace } from "../../store/index.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* End a performance trace.
|
|
5
|
+
*
|
|
6
|
+
* @param event - The performance trace to end.
|
|
7
|
+
* @returns `null`.
|
|
8
|
+
* @yields Adds the completed trace to the store.
|
|
9
|
+
*/
|
|
10
|
+
function* endTraceImplementation(event) {
|
|
11
|
+
yield put(endTrace(event));
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get a method that can be used to end a performance trace.
|
|
16
|
+
*
|
|
17
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
18
|
+
* @returns A method that can be used to end a performance trace.
|
|
19
|
+
*/
|
|
20
|
+
export function getEndTraceImplementation(runSaga) {
|
|
21
|
+
return (...args) => {
|
|
22
|
+
return runSaga(endTraceImplementation, ...args).result();
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=end-trace.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"end-trace.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/end-trace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,2BAA2B;AAGzC,OAAO,EAAE,QAAQ,EAAE,8BAAoB;AAEvC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,sBAAsB,CAAC,KAAqB;IACpD,MAAM,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAwB;IAChE,OAAO,CAAC,GAAG,IAA+C,EAAE,EAAE;QAC5D,OAAO,OAAO,CAAC,sBAAsB,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { EndTraceParams } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { endTrace } from '../../store';\n\n/**\n * End a performance trace.\n *\n * @param event - The performance trace to end.\n * @returns `null`.\n * @yields Adds the completed trace to the store.\n */\nfunction* endTraceImplementation(event: EndTraceParams): SagaIterator {\n yield put(endTrace(event));\n return null;\n}\n\n/**\n * Get a method that can be used to end a performance trace.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to end a performance trace.\n */\nexport function getEndTraceImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof endTraceImplementation>) => {\n return runSaga(endTraceImplementation, ...args).result();\n };\n}\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGetSnapImplementation = void 0;
|
|
4
|
+
const snaps_utils_1 = require("@metamask/snaps-utils");
|
|
5
|
+
/**
|
|
6
|
+
* Get a method that gets a Snap by its ID.
|
|
7
|
+
*
|
|
8
|
+
* @param preinstalled - Whether the Snap is preinstalled. If `true`, the Snap
|
|
9
|
+
* will be returned as a preinstalled Snap.
|
|
10
|
+
* @returns A method that gets a Snap by its ID. It will always return a mock
|
|
11
|
+
* Snap for simulation purposes.
|
|
12
|
+
*/
|
|
13
|
+
function getGetSnapImplementation(preinstalled = true) {
|
|
14
|
+
return (_snapId) => {
|
|
15
|
+
// This is a mock Snap for simulation purposes. Most of the fields are not
|
|
16
|
+
// actually used, but returned for type-safety sake.
|
|
17
|
+
return {
|
|
18
|
+
id: 'npm:@metamask/snaps-simulation',
|
|
19
|
+
version: '0.1.0',
|
|
20
|
+
enabled: true,
|
|
21
|
+
blocked: false,
|
|
22
|
+
status: snaps_utils_1.SnapStatus.Running,
|
|
23
|
+
versionHistory: [],
|
|
24
|
+
initialPermissions: {},
|
|
25
|
+
sourceCode: '',
|
|
26
|
+
manifest: {
|
|
27
|
+
version: '0.1.0',
|
|
28
|
+
proposedName: 'Test Snap',
|
|
29
|
+
description: 'A test Snap for simulation purposes.',
|
|
30
|
+
repository: {
|
|
31
|
+
type: 'git',
|
|
32
|
+
url: 'https://github.com/MetaMask/snaps.git',
|
|
33
|
+
},
|
|
34
|
+
source: {
|
|
35
|
+
shasum: 'unused',
|
|
36
|
+
location: {
|
|
37
|
+
npm: {
|
|
38
|
+
filePath: 'dist/index.js',
|
|
39
|
+
packageName: '@metamask/snaps-simulation',
|
|
40
|
+
registry: 'https://registry.npmjs.org',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
initialPermissions: {},
|
|
45
|
+
manifestVersion: '0.1',
|
|
46
|
+
},
|
|
47
|
+
preinstalled,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
exports.getGetSnapImplementation = getGetSnapImplementation;
|
|
52
|
+
//# sourceMappingURL=get-snap.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-snap.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/get-snap.ts"],"names":[],"mappings":";;;AAEA,uDAAmD;AAGnD;;;;;;;GAOG;AACH,SAAgB,wBAAwB,CAAC,eAAwB,IAAI;IACnE,OAAO,CAAC,OAAe,EAAQ,EAAE;QAC/B,0EAA0E;QAC1E,oDAAoD;QACpD,OAAO;YACL,EAAE,EAAE,gCAA0C;YAC9C,OAAO,EAAE,OAAwB;YACjC,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,wBAAU,CAAC,OAAO;YAC1B,cAAc,EAAE,EAAE;YAClB,kBAAkB,EAAE,EAAE;YACtB,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE;gBACR,OAAO,EAAE,OAAwB;gBACjC,YAAY,EAAE,WAAW;gBACzB,WAAW,EAAE,sCAAsC;gBACnD,UAAU,EAAE;oBACV,IAAI,EAAE,KAAK;oBACX,GAAG,EAAE,uCAAuC;iBAC7C;gBACD,MAAM,EAAE;oBACN,MAAM,EAAE,QAAQ;oBAChB,QAAQ,EAAE;wBACR,GAAG,EAAE;4BACH,QAAQ,EAAE,eAAe;4BACzB,WAAW,EAAE,4BAA4B;4BACzC,QAAQ,EAAE,4BAA4B;yBACvC;qBACF;iBACF;gBACD,kBAAkB,EAAE,EAAE;gBACtB,eAAe,EAAE,KAAK;aACvB;YACD,YAAY;SACb,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AArCD,4DAqCC","sourcesContent":["import type { SnapId } from '@metamask/snaps-sdk';\nimport type { Snap } from '@metamask/snaps-utils';\nimport { SnapStatus } from '@metamask/snaps-utils';\nimport type { SemVerVersion } from '@metamask/utils';\n\n/**\n * Get a method that gets a Snap by its ID.\n *\n * @param preinstalled - Whether the Snap is preinstalled. If `true`, the Snap\n * will be returned as a preinstalled Snap.\n * @returns A method that gets a Snap by its ID. It will always return a mock\n * Snap for simulation purposes.\n */\nexport function getGetSnapImplementation(preinstalled: boolean = true) {\n return (_snapId: string): Snap => {\n // This is a mock Snap for simulation purposes. Most of the fields are not\n // actually used, but returned for type-safety sake.\n return {\n id: 'npm:@metamask/snaps-simulation' as SnapId,\n version: '0.1.0' as SemVerVersion,\n enabled: true,\n blocked: false,\n status: SnapStatus.Running,\n versionHistory: [],\n initialPermissions: {},\n sourceCode: '',\n manifest: {\n version: '0.1.0' as SemVerVersion,\n proposedName: 'Test Snap',\n description: 'A test Snap for simulation purposes.',\n repository: {\n type: 'git',\n url: 'https://github.com/MetaMask/snaps.git',\n },\n source: {\n shasum: 'unused',\n location: {\n npm: {\n filePath: 'dist/index.js',\n packageName: '@metamask/snaps-simulation',\n registry: 'https://registry.npmjs.org',\n },\n },\n },\n initialPermissions: {},\n manifestVersion: '0.1',\n },\n preinstalled,\n };\n };\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snap } from "@metamask/snaps-utils";
|
|
2
|
+
/**
|
|
3
|
+
* Get a method that gets a Snap by its ID.
|
|
4
|
+
*
|
|
5
|
+
* @param preinstalled - Whether the Snap is preinstalled. If `true`, the Snap
|
|
6
|
+
* will be returned as a preinstalled Snap.
|
|
7
|
+
* @returns A method that gets a Snap by its ID. It will always return a mock
|
|
8
|
+
* Snap for simulation purposes.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getGetSnapImplementation(preinstalled?: boolean): (_snapId: string) => Snap;
|
|
11
|
+
//# sourceMappingURL=get-snap.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-snap.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/get-snap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,8BAA8B;AAIlD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,GAAE,OAAc,aAClD,MAAM,KAAG,IAAI,CAoC/B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snap } from "@metamask/snaps-utils";
|
|
2
|
+
/**
|
|
3
|
+
* Get a method that gets a Snap by its ID.
|
|
4
|
+
*
|
|
5
|
+
* @param preinstalled - Whether the Snap is preinstalled. If `true`, the Snap
|
|
6
|
+
* will be returned as a preinstalled Snap.
|
|
7
|
+
* @returns A method that gets a Snap by its ID. It will always return a mock
|
|
8
|
+
* Snap for simulation purposes.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getGetSnapImplementation(preinstalled?: boolean): (_snapId: string) => Snap;
|
|
11
|
+
//# sourceMappingURL=get-snap.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-snap.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/get-snap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,8BAA8B;AAIlD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,GAAE,OAAc,aAClD,MAAM,KAAG,IAAI,CAoC/B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SnapStatus } from "@metamask/snaps-utils";
|
|
2
|
+
/**
|
|
3
|
+
* Get a method that gets a Snap by its ID.
|
|
4
|
+
*
|
|
5
|
+
* @param preinstalled - Whether the Snap is preinstalled. If `true`, the Snap
|
|
6
|
+
* will be returned as a preinstalled Snap.
|
|
7
|
+
* @returns A method that gets a Snap by its ID. It will always return a mock
|
|
8
|
+
* Snap for simulation purposes.
|
|
9
|
+
*/
|
|
10
|
+
export function getGetSnapImplementation(preinstalled = true) {
|
|
11
|
+
return (_snapId) => {
|
|
12
|
+
// This is a mock Snap for simulation purposes. Most of the fields are not
|
|
13
|
+
// actually used, but returned for type-safety sake.
|
|
14
|
+
return {
|
|
15
|
+
id: 'npm:@metamask/snaps-simulation',
|
|
16
|
+
version: '0.1.0',
|
|
17
|
+
enabled: true,
|
|
18
|
+
blocked: false,
|
|
19
|
+
status: SnapStatus.Running,
|
|
20
|
+
versionHistory: [],
|
|
21
|
+
initialPermissions: {},
|
|
22
|
+
sourceCode: '',
|
|
23
|
+
manifest: {
|
|
24
|
+
version: '0.1.0',
|
|
25
|
+
proposedName: 'Test Snap',
|
|
26
|
+
description: 'A test Snap for simulation purposes.',
|
|
27
|
+
repository: {
|
|
28
|
+
type: 'git',
|
|
29
|
+
url: 'https://github.com/MetaMask/snaps.git',
|
|
30
|
+
},
|
|
31
|
+
source: {
|
|
32
|
+
shasum: 'unused',
|
|
33
|
+
location: {
|
|
34
|
+
npm: {
|
|
35
|
+
filePath: 'dist/index.js',
|
|
36
|
+
packageName: '@metamask/snaps-simulation',
|
|
37
|
+
registry: 'https://registry.npmjs.org',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
initialPermissions: {},
|
|
42
|
+
manifestVersion: '0.1',
|
|
43
|
+
},
|
|
44
|
+
preinstalled,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=get-snap.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-snap.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/get-snap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,8BAA8B;AAGnD;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,eAAwB,IAAI;IACnE,OAAO,CAAC,OAAe,EAAQ,EAAE;QAC/B,0EAA0E;QAC1E,oDAAoD;QACpD,OAAO;YACL,EAAE,EAAE,gCAA0C;YAC9C,OAAO,EAAE,OAAwB;YACjC,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,UAAU,CAAC,OAAO;YAC1B,cAAc,EAAE,EAAE;YAClB,kBAAkB,EAAE,EAAE;YACtB,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE;gBACR,OAAO,EAAE,OAAwB;gBACjC,YAAY,EAAE,WAAW;gBACzB,WAAW,EAAE,sCAAsC;gBACnD,UAAU,EAAE;oBACV,IAAI,EAAE,KAAK;oBACX,GAAG,EAAE,uCAAuC;iBAC7C;gBACD,MAAM,EAAE;oBACN,MAAM,EAAE,QAAQ;oBAChB,QAAQ,EAAE;wBACR,GAAG,EAAE;4BACH,QAAQ,EAAE,eAAe;4BACzB,WAAW,EAAE,4BAA4B;4BACzC,QAAQ,EAAE,4BAA4B;yBACvC;qBACF;iBACF;gBACD,kBAAkB,EAAE,EAAE;gBACtB,eAAe,EAAE,KAAK;aACvB;YACD,YAAY;SACb,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { SnapId } from '@metamask/snaps-sdk';\nimport type { Snap } from '@metamask/snaps-utils';\nimport { SnapStatus } from '@metamask/snaps-utils';\nimport type { SemVerVersion } from '@metamask/utils';\n\n/**\n * Get a method that gets a Snap by its ID.\n *\n * @param preinstalled - Whether the Snap is preinstalled. If `true`, the Snap\n * will be returned as a preinstalled Snap.\n * @returns A method that gets a Snap by its ID. It will always return a mock\n * Snap for simulation purposes.\n */\nexport function getGetSnapImplementation(preinstalled: boolean = true) {\n return (_snapId: string): Snap => {\n // This is a mock Snap for simulation purposes. Most of the fields are not\n // actually used, but returned for type-safety sake.\n return {\n id: 'npm:@metamask/snaps-simulation' as SnapId,\n version: '0.1.0' as SemVerVersion,\n enabled: true,\n blocked: false,\n status: SnapStatus.Running,\n versionHistory: [],\n initialPermissions: {},\n sourceCode: '',\n manifest: {\n version: '0.1.0' as SemVerVersion,\n proposedName: 'Test Snap',\n description: 'A test Snap for simulation purposes.',\n repository: {\n type: 'git',\n url: 'https://github.com/MetaMask/snaps.git',\n },\n source: {\n shasum: 'unused',\n location: {\n npm: {\n filePath: 'dist/index.js',\n packageName: '@metamask/snaps-simulation',\n registry: 'https://registry.npmjs.org',\n },\n },\n },\n initialPermissions: {},\n manifestVersion: '0.1',\n },\n preinstalled,\n };\n };\n}\n"]}
|
|
@@ -14,12 +14,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./end-trace.cjs"), exports);
|
|
17
18
|
__exportStar(require("./get-entropy-sources.cjs"), exports);
|
|
18
19
|
__exportStar(require("./get-mnemonic.cjs"), exports);
|
|
19
20
|
__exportStar(require("./get-preferences.cjs"), exports);
|
|
21
|
+
__exportStar(require("./get-snap.cjs"), exports);
|
|
20
22
|
__exportStar(require("./interface.cjs"), exports);
|
|
21
23
|
__exportStar(require("./notifications.cjs"), exports);
|
|
22
24
|
__exportStar(require("./permitted/index.cjs"), exports);
|
|
23
25
|
__exportStar(require("./request-user-approval.cjs"), exports);
|
|
26
|
+
__exportStar(require("./start-trace.cjs"), exports);
|
|
24
27
|
__exportStar(require("./state.cjs"), exports);
|
|
28
|
+
__exportStar(require("./track-error.cjs"), exports);
|
|
29
|
+
__exportStar(require("./track-event.cjs"), exports);
|
|
25
30
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAAsC;AACtC,qDAA+B;AAC/B,wDAAkC;AAClC,kDAA4B;AAC5B,sDAAgC;AAChC,wDAA4B;AAC5B,8DAAwC;AACxC,8CAAwB","sourcesContent":["export * from './get-entropy-sources';\nexport * from './get-mnemonic';\nexport * from './get-preferences';\nexport * from './interface';\nexport * from './notifications';\nexport * from './permitted';\nexport * from './request-user-approval';\nexport * from './state';\n"]}
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA4B;AAC5B,4DAAsC;AACtC,qDAA+B;AAC/B,wDAAkC;AAClC,iDAA2B;AAC3B,kDAA4B;AAC5B,sDAAgC;AAChC,wDAA4B;AAC5B,8DAAwC;AACxC,oDAA8B;AAC9B,8CAAwB;AACxB,oDAA8B;AAC9B,oDAA8B","sourcesContent":["export * from './end-trace';\nexport * from './get-entropy-sources';\nexport * from './get-mnemonic';\nexport * from './get-preferences';\nexport * from './get-snap';\nexport * from './interface';\nexport * from './notifications';\nexport * from './permitted';\nexport * from './request-user-approval';\nexport * from './start-trace';\nexport * from './state';\nexport * from './track-error';\nexport * from './track-event';\n"]}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
export * from "./end-trace.cjs";
|
|
1
2
|
export * from "./get-entropy-sources.cjs";
|
|
2
3
|
export * from "./get-mnemonic.cjs";
|
|
3
4
|
export * from "./get-preferences.cjs";
|
|
5
|
+
export * from "./get-snap.cjs";
|
|
4
6
|
export * from "./interface.cjs";
|
|
5
7
|
export * from "./notifications.cjs";
|
|
6
8
|
export * from "./permitted/index.cjs";
|
|
7
9
|
export * from "./request-user-approval.cjs";
|
|
10
|
+
export * from "./start-trace.cjs";
|
|
8
11
|
export * from "./state.cjs";
|
|
12
|
+
export * from "./track-error.cjs";
|
|
13
|
+
export * from "./track-event.cjs";
|
|
9
14
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,0CAAsC;AACtC,mCAA+B;AAC/B,sCAAkC;AAClC,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,4BAAwB"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,0CAAsC;AACtC,mCAA+B;AAC/B,sCAAkC;AAClC,+BAA2B;AAC3B,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,kCAA8B;AAC9B,4BAAwB;AACxB,kCAA8B;AAC9B,kCAA8B"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
export * from "./end-trace.mjs";
|
|
1
2
|
export * from "./get-entropy-sources.mjs";
|
|
2
3
|
export * from "./get-mnemonic.mjs";
|
|
3
4
|
export * from "./get-preferences.mjs";
|
|
5
|
+
export * from "./get-snap.mjs";
|
|
4
6
|
export * from "./interface.mjs";
|
|
5
7
|
export * from "./notifications.mjs";
|
|
6
8
|
export * from "./permitted/index.mjs";
|
|
7
9
|
export * from "./request-user-approval.mjs";
|
|
10
|
+
export * from "./start-trace.mjs";
|
|
8
11
|
export * from "./state.mjs";
|
|
12
|
+
export * from "./track-error.mjs";
|
|
13
|
+
export * from "./track-event.mjs";
|
|
9
14
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,0CAAsC;AACtC,mCAA+B;AAC/B,sCAAkC;AAClC,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,4BAAwB"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,0CAAsC;AACtC,mCAA+B;AAC/B,sCAAkC;AAClC,+BAA2B;AAC3B,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,kCAA8B;AAC9B,4BAAwB;AACxB,kCAA8B;AAC9B,kCAA8B"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
export * from "./end-trace.mjs";
|
|
1
2
|
export * from "./get-entropy-sources.mjs";
|
|
2
3
|
export * from "./get-mnemonic.mjs";
|
|
3
4
|
export * from "./get-preferences.mjs";
|
|
5
|
+
export * from "./get-snap.mjs";
|
|
4
6
|
export * from "./interface.mjs";
|
|
5
7
|
export * from "./notifications.mjs";
|
|
6
8
|
export * from "./permitted/index.mjs";
|
|
7
9
|
export * from "./request-user-approval.mjs";
|
|
10
|
+
export * from "./start-trace.mjs";
|
|
8
11
|
export * from "./state.mjs";
|
|
12
|
+
export * from "./track-error.mjs";
|
|
13
|
+
export * from "./track-event.mjs";
|
|
9
14
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,0CAAsC;AACtC,mCAA+B;AAC/B,sCAAkC;AAClC,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,4BAAwB","sourcesContent":["export * from './get-entropy-sources';\nexport * from './get-mnemonic';\nexport * from './get-preferences';\nexport * from './interface';\nexport * from './notifications';\nexport * from './permitted';\nexport * from './request-user-approval';\nexport * from './state';\n"]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,0CAAsC;AACtC,mCAA+B;AAC/B,sCAAkC;AAClC,+BAA2B;AAC3B,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,kCAA8B;AAC9B,4BAAwB;AACxB,kCAA8B;AAC9B,kCAA8B","sourcesContent":["export * from './end-trace';\nexport * from './get-entropy-sources';\nexport * from './get-mnemonic';\nexport * from './get-preferences';\nexport * from './get-snap';\nexport * from './interface';\nexport * from './notifications';\nexport * from './permitted';\nexport * from './request-user-approval';\nexport * from './start-trace';\nexport * from './state';\nexport * from './track-error';\nexport * from './track-event';\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStartTraceImplementation = void 0;
|
|
4
|
+
const effects_1 = require("redux-saga/effects");
|
|
5
|
+
const store_1 = require("../../store/index.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* Start a performance trace.
|
|
8
|
+
*
|
|
9
|
+
* @param event - The performance trace to start.
|
|
10
|
+
* @returns `null`.
|
|
11
|
+
* @yields Adds the pending trace to the store.
|
|
12
|
+
*/
|
|
13
|
+
function* startTraceImplementation(event) {
|
|
14
|
+
yield (0, effects_1.put)((0, store_1.startTrace)(event));
|
|
15
|
+
return {
|
|
16
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
17
|
+
_traceId: 'test-trace-id',
|
|
18
|
+
_spanId: 'test-span-id',
|
|
19
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get a method that can be used to start a performance trace.
|
|
24
|
+
*
|
|
25
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
26
|
+
* @returns A method that can be used to start a performance trace.
|
|
27
|
+
*/
|
|
28
|
+
function getStartTraceImplementation(runSaga) {
|
|
29
|
+
return (...args) => {
|
|
30
|
+
return runSaga(startTraceImplementation, ...args).result();
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
exports.getStartTraceImplementation = getStartTraceImplementation;
|
|
34
|
+
//# sourceMappingURL=start-trace.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-trace.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/start-trace.ts"],"names":[],"mappings":";;;AAEA,gDAAyC;AAGzC,iDAAyC;AAEzC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,wBAAwB,CAAC,KAAuB;IACxD,MAAM,IAAA,aAAG,EAAC,IAAA,kBAAU,EAAC,KAAK,CAAC,CAAC,CAAC;IAC7B,OAAO;QACL,yDAAyD;QACzD,QAAQ,EAAE,eAAe;QACzB,OAAO,EAAE,cAAc;QACvB,wDAAwD;KACzD,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,OAAwB;IAClE,OAAO,CAAC,GAAG,IAAiD,EAAE,EAAE;QAC9D,OAAO,OAAO,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC;AAJD,kEAIC","sourcesContent":["import type { StartTraceParams } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { startTrace } from '../../store';\n\n/**\n * Start a performance trace.\n *\n * @param event - The performance trace to start.\n * @returns `null`.\n * @yields Adds the pending trace to the store.\n */\nfunction* startTraceImplementation(event: StartTraceParams): SagaIterator {\n yield put(startTrace(event));\n return {\n /* eslint-disable @typescript-eslint/naming-convention */\n _traceId: 'test-trace-id',\n _spanId: 'test-span-id',\n /* eslint-enable @typescript-eslint/naming-convention */\n };\n}\n\n/**\n * Get a method that can be used to start a performance trace.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to start a performance trace.\n */\nexport function getStartTraceImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof startTraceImplementation>) => {\n return runSaga(startTraceImplementation, ...args).result();\n };\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RunSagaFunction } from "../../store/index.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Get a method that can be used to start a performance trace.
|
|
4
|
+
*
|
|
5
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
6
|
+
* @returns A method that can be used to start a performance trace.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getStartTraceImplementation(runSaga: RunSagaFunction): (event: import("@metamask/snaps-sdk").TraceRequest) => any;
|
|
9
|
+
//# sourceMappingURL=start-trace.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-trace.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/start-trace.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAoBnD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,eAAe,8DAInE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RunSagaFunction } from "../../store/index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Get a method that can be used to start a performance trace.
|
|
4
|
+
*
|
|
5
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
6
|
+
* @returns A method that can be used to start a performance trace.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getStartTraceImplementation(runSaga: RunSagaFunction): (event: import("@metamask/snaps-sdk").TraceRequest) => any;
|
|
9
|
+
//# sourceMappingURL=start-trace.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-trace.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/start-trace.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAoBnD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,eAAe,8DAInE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { put } from "redux-saga/effects";
|
|
2
|
+
import { startTrace } from "../../store/index.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Start a performance trace.
|
|
5
|
+
*
|
|
6
|
+
* @param event - The performance trace to start.
|
|
7
|
+
* @returns `null`.
|
|
8
|
+
* @yields Adds the pending trace to the store.
|
|
9
|
+
*/
|
|
10
|
+
function* startTraceImplementation(event) {
|
|
11
|
+
yield put(startTrace(event));
|
|
12
|
+
return {
|
|
13
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
14
|
+
_traceId: 'test-trace-id',
|
|
15
|
+
_spanId: 'test-span-id',
|
|
16
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get a method that can be used to start a performance trace.
|
|
21
|
+
*
|
|
22
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
23
|
+
* @returns A method that can be used to start a performance trace.
|
|
24
|
+
*/
|
|
25
|
+
export function getStartTraceImplementation(runSaga) {
|
|
26
|
+
return (...args) => {
|
|
27
|
+
return runSaga(startTraceImplementation, ...args).result();
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=start-trace.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-trace.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/start-trace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,2BAA2B;AAGzC,OAAO,EAAE,UAAU,EAAE,8BAAoB;AAEzC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,wBAAwB,CAAC,KAAuB;IACxD,MAAM,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7B,OAAO;QACL,yDAAyD;QACzD,QAAQ,EAAE,eAAe;QACzB,OAAO,EAAE,cAAc;QACvB,wDAAwD;KACzD,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAAwB;IAClE,OAAO,CAAC,GAAG,IAAiD,EAAE,EAAE;QAC9D,OAAO,OAAO,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { StartTraceParams } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { startTrace } from '../../store';\n\n/**\n * Start a performance trace.\n *\n * @param event - The performance trace to start.\n * @returns `null`.\n * @yields Adds the pending trace to the store.\n */\nfunction* startTraceImplementation(event: StartTraceParams): SagaIterator {\n yield put(startTrace(event));\n return {\n /* eslint-disable @typescript-eslint/naming-convention */\n _traceId: 'test-trace-id',\n _spanId: 'test-span-id',\n /* eslint-enable @typescript-eslint/naming-convention */\n };\n}\n\n/**\n * Get a method that can be used to start a performance trace.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to start a performance trace.\n */\nexport function getStartTraceImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof startTraceImplementation>) => {\n return runSaga(startTraceImplementation, ...args).result();\n };\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTrackErrorImplementation = void 0;
|
|
4
|
+
const snaps_sdk_1 = require("@metamask/snaps-sdk");
|
|
5
|
+
const effects_1 = require("redux-saga/effects");
|
|
6
|
+
const store_1 = require("../../store/index.cjs");
|
|
7
|
+
/**
|
|
8
|
+
* Track an error.
|
|
9
|
+
*
|
|
10
|
+
* @param error - The error to track.
|
|
11
|
+
* @returns `null`.
|
|
12
|
+
* @yields Adds the error to the store.
|
|
13
|
+
*/
|
|
14
|
+
function* trackErrorImplementation(error) {
|
|
15
|
+
const serialisedError = (0, snaps_sdk_1.getJsonError)(error);
|
|
16
|
+
yield (0, effects_1.put)((0, store_1.trackError)(serialisedError));
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get a method that can be used to track an error.
|
|
21
|
+
*
|
|
22
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
23
|
+
* @returns A method that can be used to track an error.
|
|
24
|
+
*/
|
|
25
|
+
function getTrackErrorImplementation(runSaga) {
|
|
26
|
+
return (...args) => {
|
|
27
|
+
return runSaga(trackErrorImplementation, ...args).result();
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
exports.getTrackErrorImplementation = getTrackErrorImplementation;
|
|
31
|
+
//# sourceMappingURL=track-error.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track-error.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/track-error.ts"],"names":[],"mappings":";;;AAAA,mDAAmD;AAEnD,gDAAyC;AAGzC,iDAAyC;AAEzC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,wBAAwB,CAAC,KAAY;IAC7C,MAAM,eAAe,GAAG,IAAA,wBAAY,EAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,IAAA,aAAG,EAAC,IAAA,kBAAU,EAAC,eAAe,CAAC,CAAC,CAAC;IACvC,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,OAAwB;IAClE,OAAO,CAAC,GAAG,IAAiD,EAAE,EAAE;QAC9D,OAAO,OAAO,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC;AAJD,kEAIC","sourcesContent":["import { getJsonError } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { trackError } from '../../store';\n\n/**\n * Track an error.\n *\n * @param error - The error to track.\n * @returns `null`.\n * @yields Adds the error to the store.\n */\nfunction* trackErrorImplementation(error: Error): SagaIterator {\n const serialisedError = getJsonError(error);\n yield put(trackError(serialisedError));\n return null;\n}\n\n/**\n * Get a method that can be used to track an error.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to track an error.\n */\nexport function getTrackErrorImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof trackErrorImplementation>) => {\n return runSaga(trackErrorImplementation, ...args).result();\n };\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RunSagaFunction } from "../../store/index.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Get a method that can be used to track an error.
|
|
4
|
+
*
|
|
5
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
6
|
+
* @returns A method that can be used to track an error.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getTrackErrorImplementation(runSaga: RunSagaFunction): (error: Error) => any;
|
|
9
|
+
//# sourceMappingURL=track-error.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track-error.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/track-error.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAgBnD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,eAAe,yBAInE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RunSagaFunction } from "../../store/index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Get a method that can be used to track an error.
|
|
4
|
+
*
|
|
5
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
6
|
+
* @returns A method that can be used to track an error.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getTrackErrorImplementation(runSaga: RunSagaFunction): (error: Error) => any;
|
|
9
|
+
//# sourceMappingURL=track-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track-error.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/track-error.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAgBnD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,eAAe,yBAInE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getJsonError } from "@metamask/snaps-sdk";
|
|
2
|
+
import { put } from "redux-saga/effects";
|
|
3
|
+
import { trackError } from "../../store/index.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Track an error.
|
|
6
|
+
*
|
|
7
|
+
* @param error - The error to track.
|
|
8
|
+
* @returns `null`.
|
|
9
|
+
* @yields Adds the error to the store.
|
|
10
|
+
*/
|
|
11
|
+
function* trackErrorImplementation(error) {
|
|
12
|
+
const serialisedError = getJsonError(error);
|
|
13
|
+
yield put(trackError(serialisedError));
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get a method that can be used to track an error.
|
|
18
|
+
*
|
|
19
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
20
|
+
* @returns A method that can be used to track an error.
|
|
21
|
+
*/
|
|
22
|
+
export function getTrackErrorImplementation(runSaga) {
|
|
23
|
+
return (...args) => {
|
|
24
|
+
return runSaga(trackErrorImplementation, ...args).result();
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=track-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track-error.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/track-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,4BAA4B;AAEnD,OAAO,EAAE,GAAG,EAAE,2BAA2B;AAGzC,OAAO,EAAE,UAAU,EAAE,8BAAoB;AAEzC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,wBAAwB,CAAC,KAAY;IAC7C,MAAM,eAAe,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,GAAG,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;IACvC,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAAwB;IAClE,OAAO,CAAC,GAAG,IAAiD,EAAE,EAAE;QAC9D,OAAO,OAAO,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { getJsonError } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { trackError } from '../../store';\n\n/**\n * Track an error.\n *\n * @param error - The error to track.\n * @returns `null`.\n * @yields Adds the error to the store.\n */\nfunction* trackErrorImplementation(error: Error): SagaIterator {\n const serialisedError = getJsonError(error);\n yield put(trackError(serialisedError));\n return null;\n}\n\n/**\n * Get a method that can be used to track an error.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to track an error.\n */\nexport function getTrackErrorImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof trackErrorImplementation>) => {\n return runSaga(trackErrorImplementation, ...args).result();\n };\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTrackEventImplementation = void 0;
|
|
4
|
+
const effects_1 = require("redux-saga/effects");
|
|
5
|
+
const store_1 = require("../../store/index.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* Track an event.
|
|
8
|
+
*
|
|
9
|
+
* @param event - The event to track.
|
|
10
|
+
* @returns `null`.
|
|
11
|
+
* @yields Adds the event to the store.
|
|
12
|
+
*/
|
|
13
|
+
function* trackEventImplementation(event) {
|
|
14
|
+
yield (0, effects_1.put)((0, store_1.trackEvent)(event));
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get a method that can be used to track an event.
|
|
19
|
+
*
|
|
20
|
+
* @param runSaga - A function to run a saga outside the usual Redux flow.
|
|
21
|
+
* @returns A method that can be used to track an event.
|
|
22
|
+
*/
|
|
23
|
+
function getTrackEventImplementation(runSaga) {
|
|
24
|
+
return (...args) => {
|
|
25
|
+
return runSaga(trackEventImplementation, ...args).result();
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.getTrackEventImplementation = getTrackEventImplementation;
|
|
29
|
+
//# sourceMappingURL=track-event.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track-event.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/track-event.ts"],"names":[],"mappings":";;;AAEA,gDAAyC;AAGzC,iDAAyC;AAEzC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,wBAAwB,CAChC,KAAgC;IAEhC,MAAM,IAAA,aAAG,EAAC,IAAA,kBAAU,EAAC,KAAK,CAAC,CAAC,CAAC;IAC7B,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,OAAwB;IAClE,OAAO,CAAC,GAAG,IAAiD,EAAE,EAAE;QAC9D,OAAO,OAAO,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC;AAJD,kEAIC","sourcesContent":["import type { TrackEventParams } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { trackEvent } from '../../store';\n\n/**\n * Track an event.\n *\n * @param event - The event to track.\n * @returns `null`.\n * @yields Adds the event to the store.\n */\nfunction* trackEventImplementation(\n event: TrackEventParams['event'],\n): SagaIterator {\n yield put(trackEvent(event));\n return null;\n}\n\n/**\n * Get a method that can be used to track an event.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to track an event.\n */\nexport function getTrackEventImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof trackEventImplementation>) => {\n return runSaga(trackEventImplementation, ...args).result();\n };\n}\n"]}
|