@metamask/snaps-simulation 3.0.0 → 3.2.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 +15 -1
- package/dist/constants.cjs +35 -1
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +12 -0
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts +12 -0
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +34 -0
- package/dist/constants.mjs.map +1 -1
- package/dist/controllers.cjs +4 -0
- package/dist/controllers.cjs.map +1 -1
- package/dist/controllers.d.cts.map +1 -1
- package/dist/controllers.d.mts.map +1 -1
- package/dist/controllers.mjs +4 -0
- package/dist/controllers.mjs.map +1 -1
- package/dist/helpers.cjs +30 -0
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +6 -0
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.mts +6 -0
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +30 -0
- package/dist/helpers.mjs.map +1 -1
- package/dist/interface.cjs +65 -16
- package/dist/interface.cjs.map +1 -1
- package/dist/interface.d.cts +34 -7
- package/dist/interface.d.cts.map +1 -1
- package/dist/interface.d.mts +34 -7
- package/dist/interface.d.mts.map +1 -1
- package/dist/interface.mjs +65 -17
- package/dist/interface.mjs.map +1 -1
- package/dist/options.cjs +13 -0
- package/dist/options.cjs.map +1 -1
- package/dist/options.d.cts +62 -0
- package/dist/options.d.cts.map +1 -1
- package/dist/options.d.mts +62 -0
- package/dist/options.d.mts.map +1 -1
- package/dist/options.mjs +16 -3
- package/dist/options.mjs.map +1 -1
- package/dist/request.cjs +7 -5
- package/dist/request.cjs.map +1 -1
- package/dist/request.d.cts +6 -2
- package/dist/request.d.cts.map +1 -1
- package/dist/request.d.mts +6 -2
- package/dist/request.d.mts.map +1 -1
- package/dist/request.mjs +7 -5
- package/dist/request.mjs.map +1 -1
- package/dist/simulation.cjs +24 -2
- package/dist/simulation.cjs.map +1 -1
- package/dist/simulation.d.cts +3 -2
- package/dist/simulation.d.cts.map +1 -1
- package/dist/simulation.d.mts +3 -2
- package/dist/simulation.d.mts.map +1 -1
- package/dist/simulation.mjs +24 -2
- package/dist/simulation.mjs.map +1 -1
- package/dist/structs.d.cts +14 -14
- package/dist/structs.d.mts +14 -14
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +8 -2
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +8 -2
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [3.2.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add support for `AssetSelector` and `AccountSelector` ([#3462](https://github.com/MetaMask/snaps/pull/3462))
|
|
15
|
+
|
|
16
|
+
## [3.1.0]
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Add support for `onStart` ([#3455](https://github.com/MetaMask/snaps/pull/3455))
|
|
21
|
+
|
|
10
22
|
## [3.0.0]
|
|
11
23
|
|
|
12
24
|
### Added
|
|
@@ -178,7 +190,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
178
190
|
|
|
179
191
|
- Initial release of `@metamask/snaps-simulation` package ([#2727](https://github.com/MetaMask/snaps/pull/2727))
|
|
180
192
|
|
|
181
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.
|
|
193
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.2.0...HEAD
|
|
194
|
+
[3.2.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.1.0...@metamask/snaps-simulation@3.2.0
|
|
195
|
+
[3.1.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.0.0...@metamask/snaps-simulation@3.1.0
|
|
182
196
|
[3.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@2.7.0...@metamask/snaps-simulation@3.0.0
|
|
183
197
|
[2.7.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@2.6.0...@metamask/snaps-simulation@2.7.0
|
|
184
198
|
[2.6.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@2.5.0...@metamask/snaps-simulation@2.6.0
|
package/dist/constants.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TYPEABLE_INPUTS = exports.DEFAULT_JSON_RPC_ENDPOINT = exports.DEFAULT_CURRENCY = exports.DEFAULT_LOCALE = exports.DEFAULT_ALTERNATIVE_SRP = exports.DEFAULT_SRP = void 0;
|
|
3
|
+
exports.DEFAULT_ASSETS = exports.DEFAULT_ACCOUNTS = exports.TYPEABLE_INPUTS = exports.DEFAULT_JSON_RPC_ENDPOINT = exports.DEFAULT_CURRENCY = exports.DEFAULT_LOCALE = exports.DEFAULT_ALTERNATIVE_SRP = exports.DEFAULT_SRP = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* A secret recovery phrase that is used for testing purposes. Do not use this
|
|
6
6
|
* to store any real funds!
|
|
@@ -27,4 +27,38 @@ exports.DEFAULT_JSON_RPC_ENDPOINT = 'https://cloudflare-eth.com/';
|
|
|
27
27
|
* The types of inputs that can be used in the `typeInField` interface action.
|
|
28
28
|
*/
|
|
29
29
|
exports.TYPEABLE_INPUTS = ['Input', 'AddressInput'];
|
|
30
|
+
exports.DEFAULT_ACCOUNTS = [
|
|
31
|
+
{
|
|
32
|
+
address: '0x1234567890abcdef1234567890abcdef12345678',
|
|
33
|
+
id: '29bc7513-d1b9-4466-98a6-f5f9e0b90137',
|
|
34
|
+
scopes: ['eip155:0'],
|
|
35
|
+
selected: false,
|
|
36
|
+
// We don't expose assets for EVM accounts as it's not supported in the AssetSelector.
|
|
37
|
+
assets: [],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
address: '7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv',
|
|
41
|
+
id: 'e051723c-85d0-43a3-b9bf-568a90d3f378',
|
|
42
|
+
scopes: [
|
|
43
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
|
|
44
|
+
'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
|
|
45
|
+
'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',
|
|
46
|
+
],
|
|
47
|
+
selected: true,
|
|
48
|
+
assets: [
|
|
49
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501',
|
|
50
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
exports.DEFAULT_ASSETS = {
|
|
55
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501': {
|
|
56
|
+
name: 'Solana',
|
|
57
|
+
symbol: 'SOL',
|
|
58
|
+
},
|
|
59
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v': {
|
|
60
|
+
name: 'USDC',
|
|
61
|
+
symbol: 'USDC',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
30
64
|
//# sourceMappingURL=constants.cjs.map
|
package/dist/constants.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACU,QAAA,WAAW,GACtB,6DAA6D,CAAC;AAEhE;;;GAGG;AACU,QAAA,uBAAuB,GAClC,+FAA+F,CAAC;AAElG;;GAEG;AACU,QAAA,cAAc,GAAG,IAAI,CAAC;AAEnC;;GAEG;AACU,QAAA,gBAAgB,GAAG,KAAK,CAAC;AAEtC;;GAEG;AACU,QAAA,yBAAyB,GAAG,6BAA6B,CAAC;AAEvE;;GAEG;AACU,QAAA,eAAe,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AAE5C,QAAA,gBAAgB,GAAwB;IACnD;QACE,OAAO,EAAE,4CAA4C;QACrD,EAAE,EAAE,sCAAsC;QAC1C,MAAM,EAAE,CAAC,UAAU,CAAC;QACpB,QAAQ,EAAE,KAAK;QACf,sFAAsF;QACtF,MAAM,EAAE,EAAE;KACX;IACD;QACE,OAAO,EAAE,8CAA8C;QACvD,EAAE,EAAE,sCAAsC;QAC1C,MAAM,EAAE;YACN,yCAAyC;YACzC,yCAAyC;YACzC,yCAAyC;SAC1C;QACD,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE;YACN,oDAAoD;YACpD,4FAA4F;SAC7F;KACF;CACF,CAAC;AAEW,QAAA,cAAc,GAAG;IAC5B,oDAAoD,EAAE;QACpD,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,KAAK;KACd;IACD,4FAA4F,EAC1F;QACE,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,MAAM;KACf;CACJ,CAAC","sourcesContent":["import type { SimulationAccount } from './options';\n\n/**\n * A secret recovery phrase that is used for testing purposes. Do not use this\n * to store any real funds!\n */\nexport const DEFAULT_SRP =\n 'test test test test test test test test test test test ball';\n\n/**\n * An alternative secret recovery phrase that is used for testing purposes. Do\n * not use this to store any real funds!\n */\nexport const DEFAULT_ALTERNATIVE_SRP =\n 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about';\n\n/**\n * The default locale.\n */\nexport const DEFAULT_LOCALE = 'en';\n\n/**\n * The default currency.\n */\nexport const DEFAULT_CURRENCY = 'usd';\n\n/**\n * The default JSON-RPC endpoint for Ethereum requests.\n */\nexport const DEFAULT_JSON_RPC_ENDPOINT = 'https://cloudflare-eth.com/';\n\n/**\n * The types of inputs that can be used in the `typeInField` interface action.\n */\nexport const TYPEABLE_INPUTS = ['Input', 'AddressInput'];\n\nexport const DEFAULT_ACCOUNTS: SimulationAccount[] = [\n {\n address: '0x1234567890abcdef1234567890abcdef12345678',\n id: '29bc7513-d1b9-4466-98a6-f5f9e0b90137',\n scopes: ['eip155:0'],\n selected: false,\n // We don't expose assets for EVM accounts as it's not supported in the AssetSelector.\n assets: [],\n },\n {\n address: '7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv',\n id: 'e051723c-85d0-43a3-b9bf-568a90d3f378',\n scopes: [\n 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',\n 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',\n 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',\n ],\n selected: true,\n assets: [\n 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501',\n 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',\n ],\n },\n];\n\nexport const DEFAULT_ASSETS = {\n 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501': {\n name: 'Solana',\n symbol: 'SOL',\n },\n 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v':\n {\n name: 'USDC',\n symbol: 'USDC',\n },\n};\n"]}
|
package/dist/constants.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SimulationAccount } from "./options.cjs";
|
|
1
2
|
/**
|
|
2
3
|
* A secret recovery phrase that is used for testing purposes. Do not use this
|
|
3
4
|
* to store any real funds!
|
|
@@ -24,4 +25,15 @@ export declare const DEFAULT_JSON_RPC_ENDPOINT = "https://cloudflare-eth.com/";
|
|
|
24
25
|
* The types of inputs that can be used in the `typeInField` interface action.
|
|
25
26
|
*/
|
|
26
27
|
export declare const TYPEABLE_INPUTS: string[];
|
|
28
|
+
export declare const DEFAULT_ACCOUNTS: SimulationAccount[];
|
|
29
|
+
export declare const DEFAULT_ASSETS: {
|
|
30
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501': {
|
|
31
|
+
name: string;
|
|
32
|
+
symbol: string;
|
|
33
|
+
};
|
|
34
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v': {
|
|
35
|
+
name: string;
|
|
36
|
+
symbol: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
27
39
|
//# sourceMappingURL=constants.d.cts.map
|
package/dist/constants.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,gEACuC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,kGAC6D,CAAC;AAElG;;GAEG;AACH,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,yBAAyB,gCAAgC,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,eAAe,UAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAkB;AAEnD;;;GAGG;AACH,eAAO,MAAM,WAAW,gEACuC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,kGAC6D,CAAC;AAElG;;GAEG;AACH,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,yBAAyB,gCAAgC,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,eAAe,UAA4B,CAAC;AAEzD,eAAO,MAAM,gBAAgB,EAAE,iBAAiB,EAuB/C,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;CAU1B,CAAC"}
|
package/dist/constants.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SimulationAccount } from "./options.mjs";
|
|
1
2
|
/**
|
|
2
3
|
* A secret recovery phrase that is used for testing purposes. Do not use this
|
|
3
4
|
* to store any real funds!
|
|
@@ -24,4 +25,15 @@ export declare const DEFAULT_JSON_RPC_ENDPOINT = "https://cloudflare-eth.com/";
|
|
|
24
25
|
* The types of inputs that can be used in the `typeInField` interface action.
|
|
25
26
|
*/
|
|
26
27
|
export declare const TYPEABLE_INPUTS: string[];
|
|
28
|
+
export declare const DEFAULT_ACCOUNTS: SimulationAccount[];
|
|
29
|
+
export declare const DEFAULT_ASSETS: {
|
|
30
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501': {
|
|
31
|
+
name: string;
|
|
32
|
+
symbol: string;
|
|
33
|
+
};
|
|
34
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v': {
|
|
35
|
+
name: string;
|
|
36
|
+
symbol: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
27
39
|
//# sourceMappingURL=constants.d.mts.map
|
package/dist/constants.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,gEACuC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,kGAC6D,CAAC;AAElG;;GAEG;AACH,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,yBAAyB,gCAAgC,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,eAAe,UAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAkB;AAEnD;;;GAGG;AACH,eAAO,MAAM,WAAW,gEACuC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,kGAC6D,CAAC;AAElG;;GAEG;AACH,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,yBAAyB,gCAAgC,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,eAAe,UAA4B,CAAC;AAEzD,eAAO,MAAM,gBAAgB,EAAE,iBAAiB,EAuB/C,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;CAU1B,CAAC"}
|
package/dist/constants.mjs
CHANGED
|
@@ -24,4 +24,38 @@ export const DEFAULT_JSON_RPC_ENDPOINT = 'https://cloudflare-eth.com/';
|
|
|
24
24
|
* The types of inputs that can be used in the `typeInField` interface action.
|
|
25
25
|
*/
|
|
26
26
|
export const TYPEABLE_INPUTS = ['Input', 'AddressInput'];
|
|
27
|
+
export const DEFAULT_ACCOUNTS = [
|
|
28
|
+
{
|
|
29
|
+
address: '0x1234567890abcdef1234567890abcdef12345678',
|
|
30
|
+
id: '29bc7513-d1b9-4466-98a6-f5f9e0b90137',
|
|
31
|
+
scopes: ['eip155:0'],
|
|
32
|
+
selected: false,
|
|
33
|
+
// We don't expose assets for EVM accounts as it's not supported in the AssetSelector.
|
|
34
|
+
assets: [],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
address: '7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv',
|
|
38
|
+
id: 'e051723c-85d0-43a3-b9bf-568a90d3f378',
|
|
39
|
+
scopes: [
|
|
40
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
|
|
41
|
+
'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
|
|
42
|
+
'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',
|
|
43
|
+
],
|
|
44
|
+
selected: true,
|
|
45
|
+
assets: [
|
|
46
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501',
|
|
47
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
export const DEFAULT_ASSETS = {
|
|
52
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501': {
|
|
53
|
+
name: 'Solana',
|
|
54
|
+
symbol: 'SOL',
|
|
55
|
+
},
|
|
56
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v': {
|
|
57
|
+
name: 'USDC',
|
|
58
|
+
symbol: 'USDC',
|
|
59
|
+
},
|
|
60
|
+
};
|
|
27
61
|
//# sourceMappingURL=constants.mjs.map
|
package/dist/constants.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GACtB,6DAA6D,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAClC,+FAA+F,CAAC;AAElG;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,6BAA6B,CAAC;AAEvE;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AAEzD,MAAM,CAAC,MAAM,gBAAgB,GAAwB;IACnD;QACE,OAAO,EAAE,4CAA4C;QACrD,EAAE,EAAE,sCAAsC;QAC1C,MAAM,EAAE,CAAC,UAAU,CAAC;QACpB,QAAQ,EAAE,KAAK;QACf,sFAAsF;QACtF,MAAM,EAAE,EAAE;KACX;IACD;QACE,OAAO,EAAE,8CAA8C;QACvD,EAAE,EAAE,sCAAsC;QAC1C,MAAM,EAAE;YACN,yCAAyC;YACzC,yCAAyC;YACzC,yCAAyC;SAC1C;QACD,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE;YACN,oDAAoD;YACpD,4FAA4F;SAC7F;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,oDAAoD,EAAE;QACpD,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,KAAK;KACd;IACD,4FAA4F,EAC1F;QACE,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,MAAM;KACf;CACJ,CAAC","sourcesContent":["import type { SimulationAccount } from './options';\n\n/**\n * A secret recovery phrase that is used for testing purposes. Do not use this\n * to store any real funds!\n */\nexport const DEFAULT_SRP =\n 'test test test test test test test test test test test ball';\n\n/**\n * An alternative secret recovery phrase that is used for testing purposes. Do\n * not use this to store any real funds!\n */\nexport const DEFAULT_ALTERNATIVE_SRP =\n 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about';\n\n/**\n * The default locale.\n */\nexport const DEFAULT_LOCALE = 'en';\n\n/**\n * The default currency.\n */\nexport const DEFAULT_CURRENCY = 'usd';\n\n/**\n * The default JSON-RPC endpoint for Ethereum requests.\n */\nexport const DEFAULT_JSON_RPC_ENDPOINT = 'https://cloudflare-eth.com/';\n\n/**\n * The types of inputs that can be used in the `typeInField` interface action.\n */\nexport const TYPEABLE_INPUTS = ['Input', 'AddressInput'];\n\nexport const DEFAULT_ACCOUNTS: SimulationAccount[] = [\n {\n address: '0x1234567890abcdef1234567890abcdef12345678',\n id: '29bc7513-d1b9-4466-98a6-f5f9e0b90137',\n scopes: ['eip155:0'],\n selected: false,\n // We don't expose assets for EVM accounts as it's not supported in the AssetSelector.\n assets: [],\n },\n {\n address: '7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv',\n id: 'e051723c-85d0-43a3-b9bf-568a90d3f378',\n scopes: [\n 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',\n 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',\n 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',\n ],\n selected: true,\n assets: [\n 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501',\n 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',\n ],\n },\n];\n\nexport const DEFAULT_ASSETS = {\n 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501': {\n name: 'Solana',\n symbol: 'SOL',\n },\n 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v':\n {\n name: 'USDC',\n symbol: 'USDC',\n },\n};\n"]}
|
package/dist/controllers.cjs
CHANGED
|
@@ -30,6 +30,10 @@ function getControllers(options) {
|
|
|
30
30
|
'PhishingController:testOrigin',
|
|
31
31
|
'ApprovalController:hasRequest',
|
|
32
32
|
'ApprovalController:acceptRequest',
|
|
33
|
+
'AccountsController:getAccountByAddress',
|
|
34
|
+
'AccountsController:getSelectedMultichainAccount',
|
|
35
|
+
'AccountsController:listMultichainAccounts',
|
|
36
|
+
'MultichainAssetsController:getState',
|
|
33
37
|
],
|
|
34
38
|
allowedEvents: [
|
|
35
39
|
'NotificationServicesController:notificationsListUpdated',
|
package/dist/controllers.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controllers.cjs","sourceRoot":"","sources":["../src/controllers.ts"],"names":[],"mappings":";;;AAOA,2EAIyC;AACzC,mEAAsE;AAOtE,mEAIqC;AAGrC,2CAA8C;AAE9C,iDAAwD;AACxD,uDAA2D;AAoC3D;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,OAA8B;IAC3D,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC;IACxC,MAAM,yBAAyB,GAAG,IAAI,iDAAyB,CAAC;QAC9D,SAAS,EAAE,mBAAmB,CAAC,aAAa,CAAC;YAC3C,IAAI,EAAE,2BAA2B;YACjC,cAAc,EAAE,EAAE;YAClB,aAAa,EAAE,EAAE;SAClB,CAAC;QACF,iBAAiB,EAAE,GAAG;KACvB,CAAC,CAAC;IAEH,MAAM,mBAAmB,GAAG,IAAI,2CAAuB,CAAC;QACtD,SAAS,EAAE,mBAAmB,CAAC,aAAa,CAAC;YAC3C,IAAI,EAAE,yBAAyB;YAC/B,cAAc,EAAE;gBACd,+BAA+B;gBAC/B,+BAA+B;gBAC/B,kCAAkC;
|
|
1
|
+
{"version":3,"file":"controllers.cjs","sourceRoot":"","sources":["../src/controllers.ts"],"names":[],"mappings":";;;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gBAClC,kCAAkC;gBAClC,6BAA6B;gBAC7B,wBAAwB;gBACxB,8CAA8C;aAC/C;YACD,aAAa,EAAE,EAAE;SAClB,CAAC;QACF,oBAAoB,EAAE;YACpB,GAAG,wCAA0B;YAC7B,GAAG,iDAAkC;SACtC;QACD,wBAAwB;QACxB,mBAAmB,EAAE,gCAAoB;KAC1C,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,QAAsB,EACtB,EACE,oBAAoB,EACpB,yBAAyB,GACgB;IAE3C,yBAAyB,CAAC,kBAAkB,CAAC;QAC3C,MAAM,EAAE,MAAM;QACd,WAAW,EAAE,mCAAW,CAAC,IAAI;KAC9B,CAAC,CAAC;IAEH,MAAM,mBAAmB,GAAG,IAAA,0CAAsB,EAChD,IAAA,mBAAW,EAAC,QAAQ,CAAC,kBAAkB,CAAC,CACzC,CAAC;IAEF,oBAAoB,CAAC,gBAAgB,CAAC;QACpC,mBAAmB;QACnB,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;QAC3B,2BAA2B,EAAE,KAAK;KACnC,CAAC,CAAC;AACL,CAAC;AAtBD,oCAsBC","sourcesContent":["import type { Messenger } from '@metamask/base-controller';\nimport type {\n CaveatSpecificationConstraint,\n PermissionSpecificationConstraint,\n PermissionControllerActions,\n SubjectMetadataControllerActions,\n} from '@metamask/permission-controller';\nimport {\n PermissionController,\n SubjectMetadataController,\n SubjectType,\n} from '@metamask/permission-controller';\nimport { SnapInterfaceController } from '@metamask/snaps-controllers';\nimport type {\n ExecutionServiceActions,\n SnapInterfaceControllerActions,\n SnapInterfaceControllerAllowedActions,\n SnapInterfaceControllerStateChangeEvent,\n} from '@metamask/snaps-controllers';\nimport {\n caveatSpecifications as snapsCaveatsSpecifications,\n endowmentCaveatSpecifications as snapsEndowmentCaveatSpecifications,\n processSnapPermissions,\n} from '@metamask/snaps-rpc-methods';\nimport type { SnapId } from '@metamask/snaps-sdk';\nimport type { SnapManifest } from '@metamask/snaps-utils';\nimport { getSafeJson } from '@metamask/utils';\n\nimport { getPermissionSpecifications } from './methods';\nimport { UNRESTRICTED_METHODS } from './methods/constants';\nimport type { SimulationOptions } from './options';\nimport type { RestrictedMiddlewareHooks } from './simulation';\nimport type { RunSagaFunction } from './store';\n\nexport type RootControllerAllowedActions =\n | SnapInterfaceControllerActions\n | SnapInterfaceControllerAllowedActions\n | PermissionControllerActions\n | ExecutionServiceActions\n | SubjectMetadataControllerActions;\n\nexport type RootControllerAllowedEvents =\n SnapInterfaceControllerStateChangeEvent;\n\nexport type RootControllerMessenger = Messenger<\n RootControllerAllowedActions,\n RootControllerAllowedEvents\n>;\n\nexport type GetControllersOptions = {\n controllerMessenger: Messenger<any, any>;\n hooks: RestrictedMiddlewareHooks;\n runSaga: RunSagaFunction;\n options: SimulationOptions;\n};\n\nexport type Controllers = {\n permissionController: PermissionController<\n PermissionSpecificationConstraint,\n CaveatSpecificationConstraint\n >;\n subjectMetadataController: SubjectMetadataController;\n interfaceController: SnapInterfaceController;\n};\n\n/**\n * Get the controllers for the Snap.\n *\n * @param options - The options.\n * @returns The controllers for the Snap.\n */\nexport function getControllers(options: GetControllersOptions): Controllers {\n const { controllerMessenger } = options;\n const subjectMetadataController = new SubjectMetadataController({\n messenger: controllerMessenger.getRestricted({\n name: 'SubjectMetadataController',\n allowedActions: [],\n allowedEvents: [],\n }),\n subjectCacheLimit: 100,\n });\n\n const interfaceController = new SnapInterfaceController({\n messenger: controllerMessenger.getRestricted({\n name: 'SnapInterfaceController',\n allowedActions: [\n 'PhishingController:testOrigin',\n 'ApprovalController:hasRequest',\n 'ApprovalController:acceptRequest',\n 'AccountsController:getAccountByAddress',\n 'AccountsController:getSelectedMultichainAccount',\n 'AccountsController:listMultichainAccounts',\n 'MultichainAssetsController:getState',\n ],\n allowedEvents: [\n 'NotificationServicesController:notificationsListUpdated',\n ],\n }),\n });\n\n const permissionController = getPermissionController(options);\n\n return {\n permissionController,\n subjectMetadataController,\n interfaceController,\n };\n}\n\n/**\n * Get the permission controller for the Snap.\n *\n * @param options - The options.\n * @param options.controllerMessenger - The controller messenger.\n * @param options.options - Miscellaneous options.\n * @returns The permission controller for the Snap.\n */\nfunction getPermissionController(options: GetControllersOptions) {\n const { controllerMessenger } = options;\n const permissionSpecifications = getPermissionSpecifications(options);\n return new PermissionController({\n messenger: controllerMessenger.getRestricted({\n name: 'PermissionController',\n allowedActions: [\n `ApprovalController:addRequest`,\n `ApprovalController:hasRequest`,\n `ApprovalController:acceptRequest`,\n `ApprovalController:rejectRequest`,\n `SnapController:getPermitted`,\n `SnapController:install`,\n `SubjectMetadataController:getSubjectMetadata`,\n ],\n allowedEvents: [],\n }),\n caveatSpecifications: {\n ...snapsCaveatsSpecifications,\n ...snapsEndowmentCaveatSpecifications,\n },\n permissionSpecifications,\n unrestrictedMethods: UNRESTRICTED_METHODS,\n });\n}\n\n/**\n * Register the Snap. This sets up the Snap's permissions and subject metadata.\n *\n * @param snapId - The ID of the Snap to install.\n * @param manifest - The parsed manifest.\n * @param controllers - The controllers for the Snap.\n * @param controllers.permissionController - The permission controller.\n * @param controllers.subjectMetadataController - The subject metadata controller.\n */\nexport async function registerSnap(\n snapId: SnapId,\n manifest: SnapManifest,\n {\n permissionController,\n subjectMetadataController,\n }: Omit<Controllers, 'interfaceController'>,\n) {\n subjectMetadataController.addSubjectMetadata({\n origin: snapId,\n subjectType: SubjectType.Snap,\n });\n\n const approvedPermissions = processSnapPermissions(\n getSafeJson(manifest.initialPermissions),\n );\n\n permissionController.grantPermissions({\n approvedPermissions,\n subject: { origin: snapId },\n preserveExistingPermissions: false,\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controllers.d.cts","sourceRoot":"","sources":["../src/controllers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EACV,6BAA6B,EAC7B,iCAAiC,EACjC,2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BAAqB,GAAG;IAClC,mBAAmB,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACzC,KAAK,EAAE,yBAAyB,CAAC;IACjC,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,oBAAoB,EAAE,oBAAoB,CACxC,iCAAiC,EACjC,6BAA6B,CAC9B,CAAC;IACF,yBAAyB,EAAE,yBAAyB,CAAC;IACrD,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,WAAW,CAoC1E;AAoCD;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,YAAY,EACtB,EACE,oBAAoB,EACpB,yBAAyB,GAC1B,EAAE,IAAI,CAAC,WAAW,EAAE,qBAAqB,CAAC,iBAgB5C"}
|
package/dist/controllers.mjs
CHANGED
|
@@ -27,6 +27,10 @@ export function getControllers(options) {
|
|
|
27
27
|
'PhishingController:testOrigin',
|
|
28
28
|
'ApprovalController:hasRequest',
|
|
29
29
|
'ApprovalController:acceptRequest',
|
|
30
|
+
'AccountsController:getAccountByAddress',
|
|
31
|
+
'AccountsController:getSelectedMultichainAccount',
|
|
32
|
+
'AccountsController:listMultichainAccounts',
|
|
33
|
+
'MultichainAssetsController:getState',
|
|
30
34
|
],
|
|
31
35
|
allowedEvents: [
|
|
32
36
|
'NotificationServicesController:notificationsListUpdated',
|
package/dist/controllers.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controllers.mjs","sourceRoot":"","sources":["../src/controllers.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,WAAW,EACZ,wCAAwC;AACzC,OAAO,EAAE,uBAAuB,EAAE,oCAAoC;AAOt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B,EAAE,oBAAoB;KAC1C,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,QAAsB,EACtB,EACE,oBAAoB,EACpB,yBAAyB,GACgB;IAE3C,yBAAyB,CAAC,kBAAkB,CAAC;QAC3C,MAAM,EAAE,MAAM;QACd,WAAW,EAAE,WAAW,CAAC,IAAI;KAC9B,CAAC,CAAC;IAEH,MAAM,mBAAmB,GAAG,sBAAsB,CAChD,WAAW,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CACzC,CAAC;IAEF,oBAAoB,CAAC,gBAAgB,CAAC;QACpC,mBAAmB;QACnB,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;QAC3B,2BAA2B,EAAE,KAAK;KACnC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Messenger } from '@metamask/base-controller';\nimport type {\n CaveatSpecificationConstraint,\n PermissionSpecificationConstraint,\n PermissionControllerActions,\n SubjectMetadataControllerActions,\n} from '@metamask/permission-controller';\nimport {\n PermissionController,\n SubjectMetadataController,\n SubjectType,\n} from '@metamask/permission-controller';\nimport { SnapInterfaceController } from '@metamask/snaps-controllers';\nimport type {\n ExecutionServiceActions,\n SnapInterfaceControllerActions,\n SnapInterfaceControllerAllowedActions,\n SnapInterfaceControllerStateChangeEvent,\n} from '@metamask/snaps-controllers';\nimport {\n caveatSpecifications as snapsCaveatsSpecifications,\n endowmentCaveatSpecifications as snapsEndowmentCaveatSpecifications,\n processSnapPermissions,\n} from '@metamask/snaps-rpc-methods';\nimport type { SnapId } from '@metamask/snaps-sdk';\nimport type { SnapManifest } from '@metamask/snaps-utils';\nimport { getSafeJson } from '@metamask/utils';\n\nimport { getPermissionSpecifications } from './methods';\nimport { UNRESTRICTED_METHODS } from './methods/constants';\nimport type { SimulationOptions } from './options';\nimport type { RestrictedMiddlewareHooks } from './simulation';\nimport type { RunSagaFunction } from './store';\n\nexport type RootControllerAllowedActions =\n | SnapInterfaceControllerActions\n | SnapInterfaceControllerAllowedActions\n | PermissionControllerActions\n | ExecutionServiceActions\n | SubjectMetadataControllerActions;\n\nexport type RootControllerAllowedEvents =\n SnapInterfaceControllerStateChangeEvent;\n\nexport type RootControllerMessenger = Messenger<\n RootControllerAllowedActions,\n RootControllerAllowedEvents\n>;\n\nexport type GetControllersOptions = {\n controllerMessenger: Messenger<any, any>;\n hooks: RestrictedMiddlewareHooks;\n runSaga: RunSagaFunction;\n options: SimulationOptions;\n};\n\nexport type Controllers = {\n permissionController: PermissionController<\n PermissionSpecificationConstraint,\n CaveatSpecificationConstraint\n >;\n subjectMetadataController: SubjectMetadataController;\n interfaceController: SnapInterfaceController;\n};\n\n/**\n * Get the controllers for the Snap.\n *\n * @param options - The options.\n * @returns The controllers for the Snap.\n */\nexport function getControllers(options: GetControllersOptions): Controllers {\n const { controllerMessenger } = options;\n const subjectMetadataController = new SubjectMetadataController({\n messenger: controllerMessenger.getRestricted({\n name: 'SubjectMetadataController',\n allowedActions: [],\n allowedEvents: [],\n }),\n subjectCacheLimit: 100,\n });\n\n const interfaceController = new SnapInterfaceController({\n messenger: controllerMessenger.getRestricted({\n name: 'SnapInterfaceController',\n allowedActions: [\n 'PhishingController:testOrigin',\n 'ApprovalController:hasRequest',\n 'ApprovalController:acceptRequest',\n 'AccountsController:getAccountByAddress',\n 'AccountsController:getSelectedMultichainAccount',\n 'AccountsController:listMultichainAccounts',\n 'MultichainAssetsController:getState',\n ],\n allowedEvents: [\n 'NotificationServicesController:notificationsListUpdated',\n ],\n }),\n });\n\n const permissionController = getPermissionController(options);\n\n return {\n permissionController,\n subjectMetadataController,\n interfaceController,\n };\n}\n\n/**\n * Get the permission controller for the Snap.\n *\n * @param options - The options.\n * @param options.controllerMessenger - The controller messenger.\n * @param options.options - Miscellaneous options.\n * @returns The permission controller for the Snap.\n */\nfunction getPermissionController(options: GetControllersOptions) {\n const { controllerMessenger } = options;\n const permissionSpecifications = getPermissionSpecifications(options);\n return new PermissionController({\n messenger: controllerMessenger.getRestricted({\n name: 'PermissionController',\n allowedActions: [\n `ApprovalController:addRequest`,\n `ApprovalController:hasRequest`,\n `ApprovalController:acceptRequest`,\n `ApprovalController:rejectRequest`,\n `SnapController:getPermitted`,\n `SnapController:install`,\n `SubjectMetadataController:getSubjectMetadata`,\n ],\n allowedEvents: [],\n }),\n caveatSpecifications: {\n ...snapsCaveatsSpecifications,\n ...snapsEndowmentCaveatSpecifications,\n },\n permissionSpecifications,\n unrestrictedMethods: UNRESTRICTED_METHODS,\n });\n}\n\n/**\n * Register the Snap. This sets up the Snap's permissions and subject metadata.\n *\n * @param snapId - The ID of the Snap to install.\n * @param manifest - The parsed manifest.\n * @param controllers - The controllers for the Snap.\n * @param controllers.permissionController - The permission controller.\n * @param controllers.subjectMetadataController - The subject metadata controller.\n */\nexport async function registerSnap(\n snapId: SnapId,\n manifest: SnapManifest,\n {\n permissionController,\n subjectMetadataController,\n }: Omit<Controllers, 'interfaceController'>,\n) {\n subjectMetadataController.addSubjectMetadata({\n origin: snapId,\n subjectType: SubjectType.Snap,\n });\n\n const approvedPermissions = processSnapPermissions(\n getSafeJson(manifest.initialPermissions),\n );\n\n permissionController.grantPermissions({\n approvedPermissions,\n subject: { origin: snapId },\n preserveExistingPermissions: false,\n });\n}\n"]}
|
package/dist/helpers.cjs
CHANGED
|
@@ -31,6 +31,7 @@ function getHelpers({ snapId, store, executionService, runSaga, controllerMessen
|
|
|
31
31
|
executionService,
|
|
32
32
|
runSaga,
|
|
33
33
|
controllerMessenger,
|
|
34
|
+
simulationOptions: options,
|
|
34
35
|
handler: snaps_utils_1.HandlerType.OnTransaction,
|
|
35
36
|
request: {
|
|
36
37
|
method: '',
|
|
@@ -53,6 +54,7 @@ function getHelpers({ snapId, store, executionService, runSaga, controllerMessen
|
|
|
53
54
|
store,
|
|
54
55
|
executionService,
|
|
55
56
|
controllerMessenger,
|
|
57
|
+
simulationOptions: options,
|
|
56
58
|
runSaga,
|
|
57
59
|
handler: snaps_utils_1.HandlerType.OnCronjob,
|
|
58
60
|
request,
|
|
@@ -68,6 +70,7 @@ function getHelpers({ snapId, store, executionService, runSaga, controllerMessen
|
|
|
68
70
|
executionService,
|
|
69
71
|
runSaga,
|
|
70
72
|
controllerMessenger,
|
|
73
|
+
simulationOptions: options,
|
|
71
74
|
handler: snaps_utils_1.HandlerType.OnKeyringRequest,
|
|
72
75
|
request,
|
|
73
76
|
});
|
|
@@ -82,6 +85,7 @@ function getHelpers({ snapId, store, executionService, runSaga, controllerMessen
|
|
|
82
85
|
store,
|
|
83
86
|
executionService,
|
|
84
87
|
controllerMessenger,
|
|
88
|
+
simulationOptions: options,
|
|
85
89
|
runSaga,
|
|
86
90
|
handler: snaps_utils_1.HandlerType.OnRpcRequest,
|
|
87
91
|
request,
|
|
@@ -99,6 +103,7 @@ function getHelpers({ snapId, store, executionService, runSaga, controllerMessen
|
|
|
99
103
|
store,
|
|
100
104
|
executionService,
|
|
101
105
|
controllerMessenger,
|
|
106
|
+
simulationOptions: options,
|
|
102
107
|
runSaga,
|
|
103
108
|
handler: snaps_utils_1.HandlerType.OnInstall,
|
|
104
109
|
request: {
|
|
@@ -116,6 +121,7 @@ function getHelpers({ snapId, store, executionService, runSaga, controllerMessen
|
|
|
116
121
|
store,
|
|
117
122
|
executionService,
|
|
118
123
|
controllerMessenger,
|
|
124
|
+
simulationOptions: options,
|
|
119
125
|
runSaga,
|
|
120
126
|
handler: snaps_utils_1.HandlerType.OnUpdate,
|
|
121
127
|
request: {
|
|
@@ -124,6 +130,24 @@ function getHelpers({ snapId, store, executionService, runSaga, controllerMessen
|
|
|
124
130
|
},
|
|
125
131
|
});
|
|
126
132
|
},
|
|
133
|
+
// This can't be async because it returns a `SnapRequest`.
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
135
|
+
onStart: (request) => {
|
|
136
|
+
log('Running onStart handler.');
|
|
137
|
+
return (0, request_1.handleRequest)({
|
|
138
|
+
snapId,
|
|
139
|
+
store,
|
|
140
|
+
executionService,
|
|
141
|
+
controllerMessenger,
|
|
142
|
+
simulationOptions: options,
|
|
143
|
+
runSaga,
|
|
144
|
+
handler: snaps_utils_1.HandlerType.OnStart,
|
|
145
|
+
request: {
|
|
146
|
+
method: '',
|
|
147
|
+
...request,
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
},
|
|
127
151
|
onNameLookup: async (nameLookupOptions) => {
|
|
128
152
|
log('Requesting name lookup %o.', nameLookupOptions);
|
|
129
153
|
const params = (0, superstruct_1.create)(nameLookupOptions, structs_1.NameLookupOptionsStruct);
|
|
@@ -132,6 +156,7 @@ function getHelpers({ snapId, store, executionService, runSaga, controllerMessen
|
|
|
132
156
|
store,
|
|
133
157
|
executionService,
|
|
134
158
|
controllerMessenger,
|
|
159
|
+
simulationOptions: options,
|
|
135
160
|
runSaga,
|
|
136
161
|
handler: snaps_utils_1.HandlerType.OnNameLookup,
|
|
137
162
|
request: {
|
|
@@ -149,6 +174,7 @@ function getHelpers({ snapId, store, executionService, runSaga, controllerMessen
|
|
|
149
174
|
store,
|
|
150
175
|
executionService,
|
|
151
176
|
controllerMessenger,
|
|
177
|
+
simulationOptions: options,
|
|
152
178
|
runSaga,
|
|
153
179
|
handler: snaps_utils_1.HandlerType.OnSignature,
|
|
154
180
|
request: {
|
|
@@ -172,6 +198,7 @@ function getHelpers({ snapId, store, executionService, runSaga, controllerMessen
|
|
|
172
198
|
store,
|
|
173
199
|
executionService,
|
|
174
200
|
controllerMessenger,
|
|
201
|
+
simulationOptions: options,
|
|
175
202
|
runSaga,
|
|
176
203
|
handler: snaps_utils_1.HandlerType.OnHomePage,
|
|
177
204
|
request: {
|
|
@@ -188,6 +215,7 @@ function getHelpers({ snapId, store, executionService, runSaga, controllerMessen
|
|
|
188
215
|
store,
|
|
189
216
|
executionService,
|
|
190
217
|
controllerMessenger,
|
|
218
|
+
simulationOptions: options,
|
|
191
219
|
runSaga,
|
|
192
220
|
handler: snaps_utils_1.HandlerType.OnSettingsPage,
|
|
193
221
|
request: {
|
|
@@ -210,6 +238,7 @@ function getHelpers({ snapId, store, executionService, runSaga, controllerMessen
|
|
|
210
238
|
store,
|
|
211
239
|
executionService,
|
|
212
240
|
controllerMessenger,
|
|
241
|
+
simulationOptions: options,
|
|
213
242
|
runSaga,
|
|
214
243
|
handler: snaps_utils_1.HandlerType.OnProtocolRequest,
|
|
215
244
|
request: {
|
|
@@ -232,6 +261,7 @@ function getHelpers({ snapId, store, executionService, runSaga, controllerMessen
|
|
|
232
261
|
store,
|
|
233
262
|
executionService,
|
|
234
263
|
controllerMessenger,
|
|
264
|
+
simulationOptions: options,
|
|
235
265
|
runSaga,
|
|
236
266
|
handler: snaps_utils_1.HandlerType.OnClientRequest,
|
|
237
267
|
request,
|
package/dist/helpers.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.cjs","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AACpD,uDAA+C;AAE/C,2CAAqD;AAErD,yCAAsC;AAEtC,2CAA0C;AAE1C,6CAA4D;AAC5D,2CAMmB;AAcnB,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,mBAAU,EAAE,SAAS,CAAC,CAAC;AAmMtD;;;;;;;;;;;GAWG;AACH,SAAgB,UAAU,CAAC,EACzB,MAAM,EACN,KAAK,EACL,gBAAgB,EAChB,OAAO,EACP,mBAAmB,EACnB,OAAO,GACwC;IAC/C,MAAM,aAAa,GAAG,KAAK,EACzB,OAA2B,EACS,EAAE;QACtC,GAAG,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;QAExC,MAAM,EACJ,MAAM,EAAE,iBAAiB,EACzB,OAAO,EACP,GAAG,WAAW,EACf,GAAG,IAAA,oBAAM,EAAC,OAAO,EAAE,kCAAwB,CAAC,CAAC;QAE9C,MAAM,QAAQ,GAAG,MAAM,IAAA,uBAAa,EAAC;YACnC,MAAM;YACN,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EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,oBAAM,EAAC,IAAI,EAAE,kCAAwB,CAAC,CAAC;YAClE,KAAK,CAAC,QAAQ,CAAC,IAAA,sBAAc,EAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;YAEnD,OAAO;gBACL,MAAM;oBACJ,GAAG,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;oBAE5C,KAAK,CAAC,QAAQ,CAAC,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC,CAAC;gBAC5C,CAAC;aACF,CAAC;QACJ,CAAC;QAED,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,GAAG,CAAC,4BAA4B,CAAC,CAAC;YAClC,MAAM,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;QAC7C,CAAC;KACF,CAAC;AACJ,CAAC;AA5SD,gCA4SC","sourcesContent":["import { HandlerType } from '@metamask/snaps-utils';\nimport { create } from '@metamask/superstruct';\nimport type { CaipChainId } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\n\nimport { rootLogger } from './logger';\nimport type { SimulationOptions } from './options';\nimport { handleRequest } from './request';\nimport type { InstalledSnap } from './simulation';\nimport { addJsonRpcMock, removeJsonRpcMock } from './store';\nimport {\n assertIsResponseWithInterface,\n JsonRpcMockOptionsStruct,\n NameLookupOptionsStruct,\n SignatureOptionsStruct,\n TransactionOptionsStruct,\n} from './structs';\nimport type {\n CronjobOptions,\n JsonRpcMockOptions,\n KeyringOptions,\n NameLookupOptions,\n RequestOptions,\n SignatureOptions,\n SnapRequest,\n SnapResponseWithInterface,\n SnapResponseWithoutInterface,\n TransactionOptions,\n} from './types';\n\nconst log = createModuleLogger(rootLogger, 'helpers');\n\n/**\n * This is the main entry point to interact with the snap. It is returned by\n * {@link installSnap}, and has methods to send requests to the snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * const snap = await installSnap();\n * const response = await snap.request({ method: 'hello' });\n *\n * expect(response).toRespondWith('Hello, world!');\n */\nexport type SnapHelpers = {\n /**\n * Send a JSON-RPC request to the snap.\n *\n * @param request - The request. This is similar to a JSON-RPC request, but\n * has an extra `origin` field.\n * @returns The response promise, with extra {@link SnapRequestObject} fields.\n */\n request(request: RequestOptions): SnapRequest;\n\n /**\n * Send a transaction to the snap.\n *\n * @param transaction - The transaction. This is similar to an Ethereum\n * transaction object, but has an extra `origin` field. Any missing fields\n * will be filled in with default values.\n * @returns The response.\n */\n onTransaction(\n transaction?: Partial<TransactionOptions>,\n ): Promise<SnapResponseWithInterface>;\n\n /**\n * Send a transaction to the snap.\n *\n * @param transaction - The transaction. This is similar to an Ethereum\n * transaction object, but has an extra `origin` field. Any missing fields\n * will be filled in with default values.\n * @returns The response.\n * @deprecated Use {@link onTransaction} instead.\n */\n sendTransaction(\n transaction?: Partial<TransactionOptions>,\n ): Promise<SnapResponseWithInterface>;\n\n /**\n * Send a signature request to the snap.\n *\n * @param signature - The signature request object. Contains the params from\n * the various signature methods, but has an extra `origin` and `signatureMethod` field.\n * Any missing fields will be filled in with default values.\n * @returns The response.\n */\n onSignature(\n signature?: Partial<SignatureOptions>,\n ): Promise<SnapResponseWithInterface>;\n\n /**\n * Run a cronjob in the snap. This is similar to {@link request}, but the\n * request will be sent to the `onCronjob` method of the snap.\n *\n * @param cronjob - The cronjob request. This is similar to a JSON-RPC\n * request, and is normally specified in the snap manifest, under the\n * `endowment:cronjob` permission.\n * @returns The response promise, with extra {@link SnapRequestObject} fields.\n */\n onCronjob(cronjob?: Partial<CronjobOptions>): SnapRequest;\n\n /**\n * Run a cronjob in the snap. This is similar to {@link request}, but the\n * request will be sent to the `onCronjob` method of the snap.\n *\n * @param cronjob - The cronjob request. This is similar to a JSON-RPC\n * request, and is normally specified in the snap manifest, under the\n * `endowment:cronjob` permission.\n * @returns The response promise, with extra {@link SnapRequestObject} fields.\n * @deprecated Use {@link onCronjob} instead.\n */\n runCronjob(cronjob: CronjobOptions): SnapRequest;\n\n /**\n * Run a background event in the snap. This is similar to {@link request}, but the\n * request will be sent to the `onCronjob` method of the snap.\n *\n * @param backgroundEvent - The background event request. This is similar to a JSON-RPC\n * request, and is normally specified in the `request` param of the `snap_scheduleBackgroundEvent` method.\n * @returns The response promise, with extra {@link SnapRequestObject} fields.\n */\n onBackgroundEvent(backgroundEvent: CronjobOptions): SnapRequest;\n\n /**\n * Get the response from the snap's `onHomePage` method.\n *\n * @returns The response.\n */\n onHomePage(): Promise<SnapResponseWithInterface>;\n\n /**\n * Get the response from the snap's `onSettingsPage` method.\n *\n * @returns The response.\n */\n onSettingsPage(): Promise<SnapResponseWithInterface>;\n\n /**\n * Send a keyring request to the Snap.\n *\n * @param keyringRequest - Keyring request.\n * @returns The response.\n */\n onKeyringRequest(keyringRequest: KeyringOptions): SnapRequest;\n\n /**\n * Get the response from the Snap's `onInstall` handler.\n *\n * @returns The response.\n */\n onInstall(request?: Pick<RequestOptions, 'origin'>): SnapRequest;\n\n /**\n * Get the response from the Snap's `onUpdate` handler.\n *\n * @returns The response.\n */\n onUpdate(request?: Pick<RequestOptions, 'origin'>): SnapRequest;\n\n /**\n * Get the response from the Snap's `onNameLookup` handler.\n *\n * @returns The response.\n */\n onNameLookup(\n request: NameLookupOptions,\n ): Promise<SnapResponseWithoutInterface>;\n\n /**\n * Send a JSON-RPC protocol request to the Snap.\n *\n * @param scope - A CAIP-2 scope.\n * @param request - The request. This is similar to a JSON-RPC request, but\n * has an extra `origin` field.\n * @returns The response promise, with extra {@link SnapRequestObject} fields.\n */\n onProtocolRequest(\n scope: CaipChainId,\n request: RequestOptions,\n ): Promise<SnapResponseWithoutInterface>;\n\n /**\n * Send a JSON-RPC client request to the Snap.\n *\n * @param request - The JSON-RPC request.\n * @returns The response promise, with extra {@link SnapRequestObject} fields.\n */\n onClientRequest(request: Omit<RequestOptions, 'origin'>): SnapRequest;\n\n /**\n * Mock a JSON-RPC request. This will cause the snap to respond with the\n * specified response when a request with the specified method is sent.\n *\n * @param mock - The mock options.\n * @param mock.method - The JSON-RPC request method.\n * @param mock.result - The JSON-RPC response, which will be returned when a\n * request with the specified method is sent.\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * // In the test\n * const snap = await installSnap();\n * snap.mockJsonRpc({ method: 'eth_accounts', result: ['0x1234'] });\n *\n * // In the Snap\n * const response =\n * await ethereum.request({ method: 'eth_accounts' }); // ['0x1234']\n */\n mockJsonRpc(mock: JsonRpcMockOptions): {\n /**\n * Remove the mock.\n */\n unmock(): void;\n };\n\n /**\n * Close the page running the snap. This is mainly useful for cleaning up\n * the test environment, and calling it is not strictly necessary.\n *\n * @returns A promise that resolves when the page is closed.\n */\n close(): Promise<void>;\n};\n\n/**\n * Get the helper functions for the Snap.\n *\n * @param snap - The installed Snap.\n * @param snap.snapId - The ID of the Snap.\n * @param snap.store - The Redux store.\n * @param snap.executionService - The execution service.\n * @param snap.runSaga - The `runSaga` function.\n * @param snap.controllerMessenger - The controller messenger.\n * @param snap.options - The simulation options.\n * @returns The Snap helpers.\n */\nexport function getHelpers({\n snapId,\n store,\n executionService,\n runSaga,\n controllerMessenger,\n options,\n}: InstalledSnap & { options: SimulationOptions }): SnapHelpers {\n const onTransaction = async (\n request: TransactionOptions,\n ): Promise<SnapResponseWithInterface> => {\n log('Sending transaction %o.', request);\n\n const {\n origin: transactionOrigin,\n chainId,\n ...transaction\n } = create(request, TransactionOptionsStruct);\n\n const response = await handleRequest({\n snapId,\n store,\n executionService,\n runSaga,\n controllerMessenger,\n handler: HandlerType.OnTransaction,\n request: {\n method: '',\n params: {\n chainId,\n transaction,\n transactionOrigin,\n },\n },\n });\n\n assertIsResponseWithInterface(response);\n\n return response;\n };\n\n // This can't be async because it returns a `SnapRequest`.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n const onCronjob = (request: CronjobOptions) => {\n log('Running cronjob %o.', options);\n\n return handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnCronjob,\n request,\n });\n };\n\n // This can't be async because it returns a `SnapRequest`.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n const onKeyringRequest = (request: KeyringOptions) => {\n log('Sending keyring request %o.', request);\n\n return handleRequest({\n snapId,\n store,\n executionService,\n runSaga,\n controllerMessenger,\n handler: HandlerType.OnKeyringRequest,\n request,\n });\n };\n\n return {\n // This can't be async because it returns a `SnapRequest`.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n request: (request) => {\n log('Sending request %o.', request);\n\n return handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnRpcRequest,\n request,\n });\n },\n\n onTransaction,\n sendTransaction: onTransaction,\n\n onKeyringRequest,\n\n // This can't be async because it returns a `SnapRequest`.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n onInstall: (request?: Pick<RequestOptions, 'origin'>) => {\n log('Running onInstall handler.');\n\n return handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnInstall,\n request: {\n method: '',\n ...request,\n },\n });\n },\n\n // This can't be async because it returns a `SnapRequest`.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n onUpdate: (request?: Pick<RequestOptions, 'origin'>) => {\n log('Running onUpdate handler.');\n\n return handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnUpdate,\n request: {\n method: '',\n ...request,\n },\n });\n },\n\n onNameLookup: async (\n nameLookupOptions: NameLookupOptions,\n ): Promise<SnapResponseWithoutInterface> => {\n log('Requesting name lookup %o.', nameLookupOptions);\n\n const params = create(nameLookupOptions, NameLookupOptionsStruct);\n\n const response = await handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnNameLookup,\n request: {\n method: '',\n params,\n },\n });\n\n return response;\n },\n\n onSignature: async (\n request: unknown,\n ): Promise<SnapResponseWithInterface> => {\n log('Requesting signature %o.', request);\n\n const { origin: signatureOrigin, ...signature } = create(\n request,\n SignatureOptionsStruct,\n );\n\n const response = await handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnSignature,\n request: {\n method: '',\n params: {\n signature,\n signatureOrigin,\n },\n },\n });\n\n assertIsResponseWithInterface(response);\n\n return response;\n },\n\n onCronjob,\n runCronjob: onCronjob,\n onBackgroundEvent: onCronjob,\n\n onHomePage: async (): Promise<SnapResponseWithInterface> => {\n log('Rendering home page.');\n\n const response = await handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnHomePage,\n request: {\n method: '',\n },\n });\n\n assertIsResponseWithInterface(response);\n\n return response;\n },\n\n onSettingsPage: async (): Promise<SnapResponseWithInterface> => {\n log('Rendering settings page.');\n\n const response = await handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnSettingsPage,\n request: {\n method: '',\n },\n });\n\n assertIsResponseWithInterface(response);\n\n return response;\n },\n\n onProtocolRequest: async (\n scope,\n rawRequest,\n ): Promise<SnapResponseWithoutInterface> => {\n log('Sending protocol request.');\n\n const request = {\n jsonrpc: '2.0' as const,\n id: rawRequest.id ?? 1,\n method: rawRequest.method,\n ...(rawRequest.params ? { params: rawRequest.params } : {}),\n };\n\n const response = await handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnProtocolRequest,\n request: {\n origin: rawRequest.origin,\n method: '',\n params: {\n scope,\n request,\n },\n },\n });\n\n return response;\n },\n\n // This can't be async because it returns a `SnapRequest`.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n onClientRequest: (request) => {\n log('Sending client request.');\n\n return handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n runSaga,\n handler: HandlerType.OnClientRequest,\n request,\n });\n },\n\n mockJsonRpc(mock: JsonRpcMockOptions) {\n log('Mocking JSON-RPC request %o.', mock);\n\n const { method, result } = create(mock, JsonRpcMockOptionsStruct);\n store.dispatch(addJsonRpcMock({ method, result }));\n\n return {\n unmock() {\n log('Unmocking JSON-RPC request %o.', mock);\n\n store.dispatch(removeJsonRpcMock(method));\n },\n };\n },\n\n close: async () => {\n log('Closing execution service.');\n await executionService.terminateAllSnaps();\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"helpers.cjs","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AACpD,uDAA+C;AAE/C,2CAAqD;AAErD,yCAAsC;AAEtC,2CAA0C;AAE1C,6CAA4D;AAC5D,2CAMmB;AAcnB,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,mBAAU,EAAE,SAAS,CAAC,CAAC;AA0MtD;;;;;;;;;;;GAWG;AACH,SAAgB,UAAU,CAAC,EACzB,MAAM,EACN,KAAK,EACL,gBAAgB,EAChB,OAAO,EACP,mBAAmB,EACnB,OAAO,GACwC;IAC/C,MAAM,aAAa,GAAG,KAAK,EACzB,OAA2B,EACS,EAAE;QACtC,GAAG,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;QAExC,MAAM,EACJ,MAAM,EAAE,iBAAiB,EACzB,OAAO,EACP,GAAG,WAAW,EACf,GAAG,IAAA,oBAAM,EAAC,OAAO,EAAE,kCAAwB,CAAC,CAAC;QAE9C,MAAM,QAAQ,GAAG,MAAM,IAAA,uBAAa,EAAC;YACnC,MAAM;YACN,KAAK;YACL,gBAAgB;YAChB,OAAO;YACP,mBAAmB;YACnB,iBAAiB,EAAE,OAAO;YAC1B,OAAO,EAAE,yBAAW,CAAC,aAAa;YAClC,OAAO,EAAE;gBACP,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE;oBACN,OAAO;oBACP,WAAW;oBACX,iBAAiB;iBAClB;aACF;SACF,CAAC,CAAC;QAEH,IAAA,uCAA6B,EAAC,QAAQ,CAAC,CAAC;QAExC,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF,0DAA0D;IAC1D,qEAAqE;IAC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AAC,OAAO,EAAE,EAAE;YAC3B,GAAG,CAAC,yBAAyB,CAAC,CAAC;YAE/B,OAAO,IAAA,uBAAa,EAAC;gBACnB,MAAM;gBACN,KAAK;gBACL,gBAAgB;gBAChB,mBAAmB;gBACnB,iBAAiB,EAAE,OAAO;gBAC1B,OAAO;gBACP,OAAO,EAAE,yBAAW,CAAC,eAAe;gBACpC,OAAO;aACR,CAAC,CAAC;QACL,CAAC;QAED,WAAW,CAAC,IAAwB;YAClC,GAAG,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;YAE1C,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,oBAAM,EAAC,IAAI,EAAE,kCAAwB,CAAC,CAAC;YAClE,KAAK,CAAC,QAAQ,CAAC,IAAA,sBAAc,EAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;YAEnD,OAAO;gBACL,MAAM;oBACJ,GAAG,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;oBAE5C,KAAK,CAAC,QAAQ,CAAC,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC,CAAC;gBAC5C,CAAC;aACF,CAAC;QACJ,CAAC;QAED,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,GAAG,CAAC,4BAA4B,CAAC,CAAC;YAClC,MAAM,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;QAC7C,CAAC;KACF,CAAC;AACJ,CAAC;AA5UD,gCA4UC","sourcesContent":["import { HandlerType } from '@metamask/snaps-utils';\nimport { create } from '@metamask/superstruct';\nimport type { CaipChainId } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\n\nimport { rootLogger } from './logger';\nimport type { SimulationOptions } from './options';\nimport { handleRequest } from './request';\nimport type { InstalledSnap } from './simulation';\nimport { addJsonRpcMock, removeJsonRpcMock } from './store';\nimport {\n assertIsResponseWithInterface,\n JsonRpcMockOptionsStruct,\n NameLookupOptionsStruct,\n SignatureOptionsStruct,\n TransactionOptionsStruct,\n} from './structs';\nimport type {\n CronjobOptions,\n JsonRpcMockOptions,\n KeyringOptions,\n NameLookupOptions,\n RequestOptions,\n SignatureOptions,\n SnapRequest,\n SnapResponseWithInterface,\n SnapResponseWithoutInterface,\n TransactionOptions,\n} from './types';\n\nconst log = createModuleLogger(rootLogger, 'helpers');\n\n/**\n * This is the main entry point to interact with the snap. It is returned by\n * {@link installSnap}, and has methods to send requests to the snap.\n *\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * const snap = await installSnap();\n * const response = await snap.request({ method: 'hello' });\n *\n * expect(response).toRespondWith('Hello, world!');\n */\nexport type SnapHelpers = {\n /**\n * Send a JSON-RPC request to the snap.\n *\n * @param request - The request. This is similar to a JSON-RPC request, but\n * has an extra `origin` field.\n * @returns The response promise, with extra {@link SnapRequestObject} fields.\n */\n request(request: RequestOptions): SnapRequest;\n\n /**\n * Send a transaction to the snap.\n *\n * @param transaction - The transaction. This is similar to an Ethereum\n * transaction object, but has an extra `origin` field. Any missing fields\n * will be filled in with default values.\n * @returns The response.\n */\n onTransaction(\n transaction?: Partial<TransactionOptions>,\n ): Promise<SnapResponseWithInterface>;\n\n /**\n * Send a transaction to the snap.\n *\n * @param transaction - The transaction. This is similar to an Ethereum\n * transaction object, but has an extra `origin` field. Any missing fields\n * will be filled in with default values.\n * @returns The response.\n * @deprecated Use {@link onTransaction} instead.\n */\n sendTransaction(\n transaction?: Partial<TransactionOptions>,\n ): Promise<SnapResponseWithInterface>;\n\n /**\n * Send a signature request to the snap.\n *\n * @param signature - The signature request object. Contains the params from\n * the various signature methods, but has an extra `origin` and `signatureMethod` field.\n * Any missing fields will be filled in with default values.\n * @returns The response.\n */\n onSignature(\n signature?: Partial<SignatureOptions>,\n ): Promise<SnapResponseWithInterface>;\n\n /**\n * Run a cronjob in the snap. This is similar to {@link request}, but the\n * request will be sent to the `onCronjob` method of the snap.\n *\n * @param cronjob - The cronjob request. This is similar to a JSON-RPC\n * request, and is normally specified in the snap manifest, under the\n * `endowment:cronjob` permission.\n * @returns The response promise, with extra {@link SnapRequestObject} fields.\n */\n onCronjob(cronjob?: Partial<CronjobOptions>): SnapRequest;\n\n /**\n * Run a cronjob in the snap. This is similar to {@link request}, but the\n * request will be sent to the `onCronjob` method of the snap.\n *\n * @param cronjob - The cronjob request. This is similar to a JSON-RPC\n * request, and is normally specified in the snap manifest, under the\n * `endowment:cronjob` permission.\n * @returns The response promise, with extra {@link SnapRequestObject} fields.\n * @deprecated Use {@link onCronjob} instead.\n */\n runCronjob(cronjob: CronjobOptions): SnapRequest;\n\n /**\n * Run a background event in the snap. This is similar to {@link request}, but the\n * request will be sent to the `onCronjob` method of the snap.\n *\n * @param backgroundEvent - The background event request. This is similar to a JSON-RPC\n * request, and is normally specified in the `request` param of the `snap_scheduleBackgroundEvent` method.\n * @returns The response promise, with extra {@link SnapRequestObject} fields.\n */\n onBackgroundEvent(backgroundEvent: CronjobOptions): SnapRequest;\n\n /**\n * Get the response from the snap's `onHomePage` method.\n *\n * @returns The response.\n */\n onHomePage(): Promise<SnapResponseWithInterface>;\n\n /**\n * Get the response from the snap's `onSettingsPage` method.\n *\n * @returns The response.\n */\n onSettingsPage(): Promise<SnapResponseWithInterface>;\n\n /**\n * Send a keyring request to the Snap.\n *\n * @param keyringRequest - Keyring request.\n * @returns The response.\n */\n onKeyringRequest(keyringRequest: KeyringOptions): SnapRequest;\n\n /**\n * Get the response from the Snap's `onInstall` handler.\n *\n * @returns The response.\n */\n onInstall(request?: Pick<RequestOptions, 'origin'>): SnapRequest;\n\n /**\n * Get the response from the Snap's `onUpdate` handler.\n *\n * @returns The response.\n */\n onUpdate(request?: Pick<RequestOptions, 'origin'>): SnapRequest;\n\n /**\n * Get the response from the Snap's `onStart` handler.\n *\n * @returns The response.\n */\n onStart(request?: Pick<RequestOptions, 'origin'>): SnapRequest;\n\n /**\n * Get the response from the Snap's `onNameLookup` handler.\n *\n * @returns The response.\n */\n onNameLookup(\n request: NameLookupOptions,\n ): Promise<SnapResponseWithoutInterface>;\n\n /**\n * Send a JSON-RPC protocol request to the Snap.\n *\n * @param scope - A CAIP-2 scope.\n * @param request - The request. This is similar to a JSON-RPC request, but\n * has an extra `origin` field.\n * @returns The response promise, with extra {@link SnapRequestObject} fields.\n */\n onProtocolRequest(\n scope: CaipChainId,\n request: RequestOptions,\n ): Promise<SnapResponseWithoutInterface>;\n\n /**\n * Send a JSON-RPC client request to the Snap.\n *\n * @param request - The JSON-RPC request.\n * @returns The response promise, with extra {@link SnapRequestObject} fields.\n */\n onClientRequest(request: Omit<RequestOptions, 'origin'>): SnapRequest;\n\n /**\n * Mock a JSON-RPC request. This will cause the snap to respond with the\n * specified response when a request with the specified method is sent.\n *\n * @param mock - The mock options.\n * @param mock.method - The JSON-RPC request method.\n * @param mock.result - The JSON-RPC response, which will be returned when a\n * request with the specified method is sent.\n * @example\n * import { installSnap } from '@metamask/snaps-jest';\n *\n * // In the test\n * const snap = await installSnap();\n * snap.mockJsonRpc({ method: 'eth_accounts', result: ['0x1234'] });\n *\n * // In the Snap\n * const response =\n * await ethereum.request({ method: 'eth_accounts' }); // ['0x1234']\n */\n mockJsonRpc(mock: JsonRpcMockOptions): {\n /**\n * Remove the mock.\n */\n unmock(): void;\n };\n\n /**\n * Close the page running the snap. This is mainly useful for cleaning up\n * the test environment, and calling it is not strictly necessary.\n *\n * @returns A promise that resolves when the page is closed.\n */\n close(): Promise<void>;\n};\n\n/**\n * Get the helper functions for the Snap.\n *\n * @param snap - The installed Snap.\n * @param snap.snapId - The ID of the Snap.\n * @param snap.store - The Redux store.\n * @param snap.executionService - The execution service.\n * @param snap.runSaga - The `runSaga` function.\n * @param snap.controllerMessenger - The controller messenger.\n * @param snap.options - The simulation options.\n * @returns The Snap helpers.\n */\nexport function getHelpers({\n snapId,\n store,\n executionService,\n runSaga,\n controllerMessenger,\n options,\n}: InstalledSnap & { options: SimulationOptions }): SnapHelpers {\n const onTransaction = async (\n request: TransactionOptions,\n ): Promise<SnapResponseWithInterface> => {\n log('Sending transaction %o.', request);\n\n const {\n origin: transactionOrigin,\n chainId,\n ...transaction\n } = create(request, TransactionOptionsStruct);\n\n const response = await handleRequest({\n snapId,\n store,\n executionService,\n runSaga,\n controllerMessenger,\n simulationOptions: options,\n handler: HandlerType.OnTransaction,\n request: {\n method: '',\n params: {\n chainId,\n transaction,\n transactionOrigin,\n },\n },\n });\n\n assertIsResponseWithInterface(response);\n\n return response;\n };\n\n // This can't be async because it returns a `SnapRequest`.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n const onCronjob = (request: CronjobOptions) => {\n log('Running cronjob %o.', options);\n\n return handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n simulationOptions: options,\n runSaga,\n handler: HandlerType.OnCronjob,\n request,\n });\n };\n\n // This can't be async because it returns a `SnapRequest`.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n const onKeyringRequest = (request: KeyringOptions) => {\n log('Sending keyring request %o.', request);\n\n return handleRequest({\n snapId,\n store,\n executionService,\n runSaga,\n controllerMessenger,\n simulationOptions: options,\n handler: HandlerType.OnKeyringRequest,\n request,\n });\n };\n\n return {\n // This can't be async because it returns a `SnapRequest`.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n request: (request) => {\n log('Sending request %o.', request);\n\n return handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n simulationOptions: options,\n runSaga,\n handler: HandlerType.OnRpcRequest,\n request,\n });\n },\n\n onTransaction,\n sendTransaction: onTransaction,\n\n onKeyringRequest,\n\n // This can't be async because it returns a `SnapRequest`.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n onInstall: (request?: Pick<RequestOptions, 'origin'>) => {\n log('Running onInstall handler.');\n\n return handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n simulationOptions: options,\n runSaga,\n handler: HandlerType.OnInstall,\n request: {\n method: '',\n ...request,\n },\n });\n },\n\n // This can't be async because it returns a `SnapRequest`.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n onUpdate: (request?: Pick<RequestOptions, 'origin'>) => {\n log('Running onUpdate handler.');\n\n return handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n simulationOptions: options,\n runSaga,\n handler: HandlerType.OnUpdate,\n request: {\n method: '',\n ...request,\n },\n });\n },\n\n // This can't be async because it returns a `SnapRequest`.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n onStart: (request?: Pick<RequestOptions, 'origin'>) => {\n log('Running onStart handler.');\n\n return handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n simulationOptions: options,\n runSaga,\n handler: HandlerType.OnStart,\n request: {\n method: '',\n ...request,\n },\n });\n },\n\n onNameLookup: async (\n nameLookupOptions: NameLookupOptions,\n ): Promise<SnapResponseWithoutInterface> => {\n log('Requesting name lookup %o.', nameLookupOptions);\n\n const params = create(nameLookupOptions, NameLookupOptionsStruct);\n\n const response = await handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n simulationOptions: options,\n runSaga,\n handler: HandlerType.OnNameLookup,\n request: {\n method: '',\n params,\n },\n });\n\n return response;\n },\n\n onSignature: async (\n request: unknown,\n ): Promise<SnapResponseWithInterface> => {\n log('Requesting signature %o.', request);\n\n const { origin: signatureOrigin, ...signature } = create(\n request,\n SignatureOptionsStruct,\n );\n\n const response = await handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n simulationOptions: options,\n runSaga,\n handler: HandlerType.OnSignature,\n request: {\n method: '',\n params: {\n signature,\n signatureOrigin,\n },\n },\n });\n\n assertIsResponseWithInterface(response);\n\n return response;\n },\n\n onCronjob,\n runCronjob: onCronjob,\n onBackgroundEvent: onCronjob,\n\n onHomePage: async (): Promise<SnapResponseWithInterface> => {\n log('Rendering home page.');\n\n const response = await handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n simulationOptions: options,\n runSaga,\n handler: HandlerType.OnHomePage,\n request: {\n method: '',\n },\n });\n\n assertIsResponseWithInterface(response);\n\n return response;\n },\n\n onSettingsPage: async (): Promise<SnapResponseWithInterface> => {\n log('Rendering settings page.');\n\n const response = await handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n simulationOptions: options,\n runSaga,\n handler: HandlerType.OnSettingsPage,\n request: {\n method: '',\n },\n });\n\n assertIsResponseWithInterface(response);\n\n return response;\n },\n\n onProtocolRequest: async (\n scope,\n rawRequest,\n ): Promise<SnapResponseWithoutInterface> => {\n log('Sending protocol request.');\n\n const request = {\n jsonrpc: '2.0' as const,\n id: rawRequest.id ?? 1,\n method: rawRequest.method,\n ...(rawRequest.params ? { params: rawRequest.params } : {}),\n };\n\n const response = await handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n simulationOptions: options,\n runSaga,\n handler: HandlerType.OnProtocolRequest,\n request: {\n origin: rawRequest.origin,\n method: '',\n params: {\n scope,\n request,\n },\n },\n });\n\n return response;\n },\n\n // This can't be async because it returns a `SnapRequest`.\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n onClientRequest: (request) => {\n log('Sending client request.');\n\n return handleRequest({\n snapId,\n store,\n executionService,\n controllerMessenger,\n simulationOptions: options,\n runSaga,\n handler: HandlerType.OnClientRequest,\n request,\n });\n },\n\n mockJsonRpc(mock: JsonRpcMockOptions) {\n log('Mocking JSON-RPC request %o.', mock);\n\n const { method, result } = create(mock, JsonRpcMockOptionsStruct);\n store.dispatch(addJsonRpcMock({ method, result }));\n\n return {\n unmock() {\n log('Unmocking JSON-RPC request %o.', mock);\n\n store.dispatch(removeJsonRpcMock(method));\n },\n };\n },\n\n close: async () => {\n log('Closing execution service.');\n await executionService.terminateAllSnaps();\n },\n };\n}\n"]}
|
package/dist/helpers.d.cts
CHANGED
|
@@ -112,6 +112,12 @@ export type SnapHelpers = {
|
|
|
112
112
|
* @returns The response.
|
|
113
113
|
*/
|
|
114
114
|
onUpdate(request?: Pick<RequestOptions, 'origin'>): SnapRequest;
|
|
115
|
+
/**
|
|
116
|
+
* Get the response from the Snap's `onStart` handler.
|
|
117
|
+
*
|
|
118
|
+
* @returns The response.
|
|
119
|
+
*/
|
|
120
|
+
onStart(request?: Pick<RequestOptions, 'origin'>): SnapRequest;
|
|
115
121
|
/**
|
|
116
122
|
* Get the response from the Snap's `onNameLookup` handler.
|
|
117
123
|
*
|
package/dist/helpers.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.cts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,wBAAwB;AAInD,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAkB;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAqB;AASlD,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,yBAAyB,EACzB,4BAA4B,EAC5B,kBAAkB,EACnB,oBAAgB;AAIjB;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;;;;;OAMG;IACH,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAAC;IAE9C;;;;;;;OAOG;IACH,aAAa,CACX,WAAW,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GACxC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAEtC;;;;;;;;OAQG;IACH,eAAe,CACb,WAAW,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GACxC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAEtC;;;;;;;OAOG;IACH,WAAW,CACT,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GACpC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAEtC;;;;;;;;OAQG;IACH,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,WAAW,CAAC;IAE1D;;;;;;;;;OASG;IACH,UAAU,CAAC,OAAO,EAAE,cAAc,G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
|
|
114
114
|
onUpdate(request?: Pick<RequestOptions, 'origin'>): SnapRequest;
|
|
115
|
+
/**
|
|
116
|
+
* Get the response from the Snap's `onStart` handler.
|
|
117
|
+
*
|
|
118
|
+
* @returns The response.
|
|
119
|
+
*/
|
|
120
|
+
onStart(request?: Pick<RequestOptions, 'origin'>): SnapRequest;
|
|
115
121
|
/**
|
|
116
122
|
* Get the response from the Snap's `onNameLookup` handler.
|
|
117
123
|
*
|
package/dist/helpers.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.mts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,wBAAwB;AAInD,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAkB;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAqB;AASlD,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,yBAAyB,EACzB,4BAA4B,EAC5B,kBAAkB,EACnB,oBAAgB;AAIjB;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;;;;;OAMG;IACH,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAAC;IAE9C;;;;;;;OAOG;IACH,aAAa,CACX,WAAW,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GACxC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAEtC;;;;;;;;OAQG;IACH,eAAe,CACb,WAAW,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GACxC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAEtC;;;;;;;OAOG;IACH,WAAW,CACT,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GACpC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAEtC;;;;;;;;OAQG;IACH,SAAS,CAAC,OAAO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