@metamask/snaps-simulation 2.4.1 → 2.6.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/dist/constants.cjs +5 -1
  3. package/dist/constants.cjs.map +1 -1
  4. package/dist/constants.d.cts +4 -0
  5. package/dist/constants.d.cts.map +1 -1
  6. package/dist/constants.d.mts +4 -0
  7. package/dist/constants.d.mts.map +1 -1
  8. package/dist/constants.mjs +4 -0
  9. package/dist/constants.mjs.map +1 -1
  10. package/dist/interface.cjs +20 -3
  11. package/dist/interface.cjs.map +1 -1
  12. package/dist/interface.d.cts.map +1 -1
  13. package/dist/interface.d.mts.map +1 -1
  14. package/dist/interface.mjs +20 -3
  15. package/dist/interface.mjs.map +1 -1
  16. package/dist/methods/hooks/get-preferences.cjs +3 -1
  17. package/dist/methods/hooks/get-preferences.cjs.map +1 -1
  18. package/dist/methods/hooks/get-preferences.d.cts +3 -1
  19. package/dist/methods/hooks/get-preferences.d.cts.map +1 -1
  20. package/dist/methods/hooks/get-preferences.d.mts +3 -1
  21. package/dist/methods/hooks/get-preferences.d.mts.map +1 -1
  22. package/dist/methods/hooks/get-preferences.mjs +3 -1
  23. package/dist/methods/hooks/get-preferences.mjs.map +1 -1
  24. package/dist/middleware/internal-methods/accounts.cjs.map +1 -1
  25. package/dist/middleware/internal-methods/accounts.d.cts +2 -2
  26. package/dist/middleware/internal-methods/accounts.d.cts.map +1 -1
  27. package/dist/middleware/internal-methods/accounts.d.mts +2 -2
  28. package/dist/middleware/internal-methods/accounts.d.mts.map +1 -1
  29. package/dist/middleware/internal-methods/accounts.mjs.map +1 -1
  30. package/dist/middleware/internal-methods/chain-id.cjs.map +1 -1
  31. package/dist/middleware/internal-methods/chain-id.d.cts +2 -2
  32. package/dist/middleware/internal-methods/chain-id.d.cts.map +1 -1
  33. package/dist/middleware/internal-methods/chain-id.d.mts +2 -2
  34. package/dist/middleware/internal-methods/chain-id.d.mts.map +1 -1
  35. package/dist/middleware/internal-methods/chain-id.mjs.map +1 -1
  36. package/dist/middleware/internal-methods/middleware.cjs +2 -0
  37. package/dist/middleware/internal-methods/middleware.cjs.map +1 -1
  38. package/dist/middleware/internal-methods/middleware.d.cts.map +1 -1
  39. package/dist/middleware/internal-methods/middleware.d.mts.map +1 -1
  40. package/dist/middleware/internal-methods/middleware.mjs +2 -0
  41. package/dist/middleware/internal-methods/middleware.mjs.map +1 -1
  42. package/dist/middleware/internal-methods/net-version.cjs.map +1 -1
  43. package/dist/middleware/internal-methods/net-version.d.cts +2 -2
  44. package/dist/middleware/internal-methods/net-version.d.cts.map +1 -1
  45. package/dist/middleware/internal-methods/net-version.d.mts +2 -2
  46. package/dist/middleware/internal-methods/net-version.d.mts.map +1 -1
  47. package/dist/middleware/internal-methods/net-version.mjs.map +1 -1
  48. package/dist/middleware/internal-methods/provider-state.cjs.map +1 -1
  49. package/dist/middleware/internal-methods/provider-state.d.cts +2 -2
  50. package/dist/middleware/internal-methods/provider-state.d.cts.map +1 -1
  51. package/dist/middleware/internal-methods/provider-state.d.mts +2 -2
  52. package/dist/middleware/internal-methods/provider-state.d.mts.map +1 -1
  53. package/dist/middleware/internal-methods/provider-state.mjs.map +1 -1
  54. package/dist/middleware/internal-methods/switch-ethereum-chain.cjs +21 -0
  55. package/dist/middleware/internal-methods/switch-ethereum-chain.cjs.map +1 -0
  56. package/dist/middleware/internal-methods/switch-ethereum-chain.d.cts +16 -0
  57. package/dist/middleware/internal-methods/switch-ethereum-chain.d.cts.map +1 -0
  58. package/dist/middleware/internal-methods/switch-ethereum-chain.d.mts +16 -0
  59. package/dist/middleware/internal-methods/switch-ethereum-chain.d.mts.map +1 -0
  60. package/dist/middleware/internal-methods/switch-ethereum-chain.mjs +17 -0
  61. package/dist/middleware/internal-methods/switch-ethereum-chain.mjs.map +1 -0
  62. package/dist/options.cjs +1 -0
  63. package/dist/options.cjs.map +1 -1
  64. package/dist/options.d.cts +3 -0
  65. package/dist/options.d.cts.map +1 -1
  66. package/dist/options.d.mts +3 -0
  67. package/dist/options.d.mts.map +1 -1
  68. package/dist/options.mjs +1 -0
  69. package/dist/options.mjs.map +1 -1
  70. package/dist/utils/errors.cjs +25 -0
  71. package/dist/utils/errors.cjs.map +1 -0
  72. package/dist/utils/errors.d.cts +8 -0
  73. package/dist/utils/errors.d.cts.map +1 -0
  74. package/dist/utils/errors.d.mts +8 -0
  75. package/dist/utils/errors.d.mts.map +1 -0
  76. package/dist/utils/errors.mjs +21 -0
  77. package/dist/utils/errors.mjs.map +1 -0
  78. package/package.json +14 -14
@@ -1,5 +1,5 @@
1
1
  import type { JsonRpcEngineEndCallback, JsonRpcEngineNextCallback } from "@metamask/json-rpc-engine";
2
- import type { Json, JsonRpcRequest, PendingJsonRpcResponse } from "@metamask/utils";
2
+ import type { JsonRpcRequest, PendingJsonRpcResponse } from "@metamask/utils";
3
3
  /**
4
4
  * A mock handler for net_version that always returns a specific
5
5
  * hardcoded result.
@@ -12,5 +12,5 @@ import type { Json, JsonRpcRequest, PendingJsonRpcResponse } from "@metamask/uti
12
12
  * @param end - The `json-rpc-engine` middleware end handler.
13
13
  * @returns The JSON-RPC response.
14
14
  */
15
- export declare function getNetworkVersionHandler(_request: JsonRpcRequest, response: PendingJsonRpcResponse<Json>, _next: JsonRpcEngineNextCallback, end: JsonRpcEngineEndCallback): Promise<void>;
15
+ export declare function getNetworkVersionHandler(_request: JsonRpcRequest, response: PendingJsonRpcResponse, _next: JsonRpcEngineNextCallback, end: JsonRpcEngineEndCallback): Promise<void>;
16
16
  //# sourceMappingURL=net-version.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"net-version.d.mts","sourceRoot":"","sources":["../../../src/middleware/internal-methods/net-version.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAC1B,kCAAkC;AACnC,OAAO,KAAK,EACV,IAAI,EACJ,cAAc,EACd,sBAAsB,EACvB,wBAAwB;AAEzB;;;;;;;;;;;GAWG;AACH,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,sBAAsB,CAAC,IAAI,CAAC,EACtC,KAAK,EAAE,yBAAyB,EAChC,GAAG,EAAE,wBAAwB,iBAO9B"}
1
+ {"version":3,"file":"net-version.d.mts","sourceRoot":"","sources":["../../../src/middleware/internal-methods/net-version.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAC1B,kCAAkC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,wBAAwB;AAE9E;;;;;;;;;;;GAWG;AACH,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,yBAAyB,EAChC,GAAG,EAAE,wBAAwB,iBAO9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"net-version.mjs","sourceRoot":"","sources":["../../../src/middleware/internal-methods/net-version.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,QAAwB,EACxB,QAAsC,EACtC,KAAgC,EAChC,GAA6B;IAE7B,uEAAuE;IACvE,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC;IAEtB,OAAO,GAAG,EAAE,CAAC;AACf,CAAC","sourcesContent":["import type {\n JsonRpcEngineEndCallback,\n JsonRpcEngineNextCallback,\n} from '@metamask/json-rpc-engine';\nimport type {\n Json,\n JsonRpcRequest,\n PendingJsonRpcResponse,\n} from '@metamask/utils';\n\n/**\n * A mock handler for net_version that always returns a specific\n * hardcoded result.\n *\n * @param _request - Incoming JSON-RPC request. Ignored for this specific\n * handler.\n * @param response - The outgoing JSON-RPC response, modified to return the\n * result.\n * @param _next - The `json-rpc-engine` middleware next handler.\n * @param end - The `json-rpc-engine` middleware end handler.\n * @returns The JSON-RPC response.\n */\nexport async function getNetworkVersionHandler(\n _request: JsonRpcRequest,\n response: PendingJsonRpcResponse<Json>,\n _next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n) {\n // For now this will return a mocked result, this should probably match\n // whatever network the simulation is using.\n response.result = '1';\n\n return end();\n}\n"]}
1
+ {"version":3,"file":"net-version.mjs","sourceRoot":"","sources":["../../../src/middleware/internal-methods/net-version.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,QAAwB,EACxB,QAAgC,EAChC,KAAgC,EAChC,GAA6B;IAE7B,uEAAuE;IACvE,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC;IAEtB,OAAO,GAAG,EAAE,CAAC;AACf,CAAC","sourcesContent":["import type {\n JsonRpcEngineEndCallback,\n JsonRpcEngineNextCallback,\n} from '@metamask/json-rpc-engine';\nimport type { JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils';\n\n/**\n * A mock handler for net_version that always returns a specific\n * hardcoded result.\n *\n * @param _request - Incoming JSON-RPC request. Ignored for this specific\n * handler.\n * @param response - The outgoing JSON-RPC response, modified to return the\n * result.\n * @param _next - The `json-rpc-engine` middleware next handler.\n * @param end - The `json-rpc-engine` middleware end handler.\n * @returns The JSON-RPC response.\n */\nexport async function getNetworkVersionHandler(\n _request: JsonRpcRequest,\n response: PendingJsonRpcResponse,\n _next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n) {\n // For now this will return a mocked result, this should probably match\n // whatever network the simulation is using.\n response.result = '1';\n\n return end();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"provider-state.cjs","sourceRoot":"","sources":["../../../src/middleware/internal-methods/provider-state.ts"],"names":[],"mappings":";;;AAUA;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,uBAAuB,CAC3C,QAAwB,EACxB,QAAsC,EACtC,KAAgC,EAChC,GAA6B;IAE7B,uEAAuE;IACvE,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,GAAG;QAChB,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,MAAM;QACf,cAAc,EAAE,MAAM;QACtB,QAAQ,EAAE,EAAE;KACb,CAAC;IAEF,OAAO,GAAG,EAAE,CAAC;AACf,CAAC;AAhBD,0DAgBC","sourcesContent":["import type {\n JsonRpcEngineEndCallback,\n JsonRpcEngineNextCallback,\n} from '@metamask/json-rpc-engine';\nimport type {\n Json,\n JsonRpcRequest,\n PendingJsonRpcResponse,\n} from '@metamask/utils';\n\n/**\n * A mock handler for metamask_getProviderState that always returns a specific\n * hardcoded result.\n *\n * @param _request - Incoming JSON-RPC request. Ignored for this specific\n * handler.\n * @param response - The outgoing JSON-RPC response, modified to return the\n * result.\n * @param _next - The `json-rpc-engine` middleware next handler.\n * @param end - The `json-rpc-engine` middleware end handler.\n * @returns The JSON-RPC response.\n */\nexport async function getProviderStateHandler(\n _request: JsonRpcRequest,\n response: PendingJsonRpcResponse<Json>,\n _next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n) {\n // For now this will return a mocked result, this should probably match\n // whatever network the simulation is using.\n response.result = {\n isUnlocked: true,\n chainId: '0x01',\n networkVersion: '0x01',\n accounts: [],\n };\n\n return end();\n}\n"]}
1
+ {"version":3,"file":"provider-state.cjs","sourceRoot":"","sources":["../../../src/middleware/internal-methods/provider-state.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,uBAAuB,CAC3C,QAAwB,EACxB,QAAgC,EAChC,KAAgC,EAChC,GAA6B;IAE7B,uEAAuE;IACvE,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,GAAG;QAChB,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,MAAM;QACf,cAAc,EAAE,MAAM;QACtB,QAAQ,EAAE,EAAE;KACb,CAAC;IAEF,OAAO,GAAG,EAAE,CAAC;AACf,CAAC;AAhBD,0DAgBC","sourcesContent":["import type {\n JsonRpcEngineEndCallback,\n JsonRpcEngineNextCallback,\n} from '@metamask/json-rpc-engine';\nimport type { JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils';\n\n/**\n * A mock handler for metamask_getProviderState that always returns a specific\n * hardcoded result.\n *\n * @param _request - Incoming JSON-RPC request. Ignored for this specific\n * handler.\n * @param response - The outgoing JSON-RPC response, modified to return the\n * result.\n * @param _next - The `json-rpc-engine` middleware next handler.\n * @param end - The `json-rpc-engine` middleware end handler.\n * @returns The JSON-RPC response.\n */\nexport async function getProviderStateHandler(\n _request: JsonRpcRequest,\n response: PendingJsonRpcResponse,\n _next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n) {\n // For now this will return a mocked result, this should probably match\n // whatever network the simulation is using.\n response.result = {\n isUnlocked: true,\n chainId: '0x01',\n networkVersion: '0x01',\n accounts: [],\n };\n\n return end();\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { JsonRpcEngineEndCallback, JsonRpcEngineNextCallback } from "@metamask/json-rpc-engine";
2
- import type { Json, JsonRpcRequest, PendingJsonRpcResponse } from "@metamask/utils";
2
+ import type { JsonRpcRequest, PendingJsonRpcResponse } from "@metamask/utils";
3
3
  /**
4
4
  * A mock handler for metamask_getProviderState that always returns a specific
5
5
  * hardcoded result.
@@ -12,5 +12,5 @@ import type { Json, JsonRpcRequest, PendingJsonRpcResponse } from "@metamask/uti
12
12
  * @param end - The `json-rpc-engine` middleware end handler.
13
13
  * @returns The JSON-RPC response.
14
14
  */
15
- export declare function getProviderStateHandler(_request: JsonRpcRequest, response: PendingJsonRpcResponse<Json>, _next: JsonRpcEngineNextCallback, end: JsonRpcEngineEndCallback): Promise<void>;
15
+ export declare function getProviderStateHandler(_request: JsonRpcRequest, response: PendingJsonRpcResponse, _next: JsonRpcEngineNextCallback, end: JsonRpcEngineEndCallback): Promise<void>;
16
16
  //# sourceMappingURL=provider-state.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider-state.d.cts","sourceRoot":"","sources":["../../../src/middleware/internal-methods/provider-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAC1B,kCAAkC;AACnC,OAAO,KAAK,EACV,IAAI,EACJ,cAAc,EACd,sBAAsB,EACvB,wBAAwB;AAEzB;;;;;;;;;;;GAWG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,sBAAsB,CAAC,IAAI,CAAC,EACtC,KAAK,EAAE,yBAAyB,EAChC,GAAG,EAAE,wBAAwB,iBAY9B"}
1
+ {"version":3,"file":"provider-state.d.cts","sourceRoot":"","sources":["../../../src/middleware/internal-methods/provider-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAC1B,kCAAkC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,wBAAwB;AAE9E;;;;;;;;;;;GAWG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,yBAAyB,EAChC,GAAG,EAAE,wBAAwB,iBAY9B"}
@@ -1,5 +1,5 @@
1
1
  import type { JsonRpcEngineEndCallback, JsonRpcEngineNextCallback } from "@metamask/json-rpc-engine";
2
- import type { Json, JsonRpcRequest, PendingJsonRpcResponse } from "@metamask/utils";
2
+ import type { JsonRpcRequest, PendingJsonRpcResponse } from "@metamask/utils";
3
3
  /**
4
4
  * A mock handler for metamask_getProviderState that always returns a specific
5
5
  * hardcoded result.
@@ -12,5 +12,5 @@ import type { Json, JsonRpcRequest, PendingJsonRpcResponse } from "@metamask/uti
12
12
  * @param end - The `json-rpc-engine` middleware end handler.
13
13
  * @returns The JSON-RPC response.
14
14
  */
15
- export declare function getProviderStateHandler(_request: JsonRpcRequest, response: PendingJsonRpcResponse<Json>, _next: JsonRpcEngineNextCallback, end: JsonRpcEngineEndCallback): Promise<void>;
15
+ export declare function getProviderStateHandler(_request: JsonRpcRequest, response: PendingJsonRpcResponse, _next: JsonRpcEngineNextCallback, end: JsonRpcEngineEndCallback): Promise<void>;
16
16
  //# sourceMappingURL=provider-state.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider-state.d.mts","sourceRoot":"","sources":["../../../src/middleware/internal-methods/provider-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAC1B,kCAAkC;AACnC,OAAO,KAAK,EACV,IAAI,EACJ,cAAc,EACd,sBAAsB,EACvB,wBAAwB;AAEzB;;;;;;;;;;;GAWG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,sBAAsB,CAAC,IAAI,CAAC,EACtC,KAAK,EAAE,yBAAyB,EAChC,GAAG,EAAE,wBAAwB,iBAY9B"}
1
+ {"version":3,"file":"provider-state.d.mts","sourceRoot":"","sources":["../../../src/middleware/internal-methods/provider-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAC1B,kCAAkC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,wBAAwB;AAE9E;;;;;;;;;;;GAWG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,yBAAyB,EAChC,GAAG,EAAE,wBAAwB,iBAY9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"provider-state.mjs","sourceRoot":"","sources":["../../../src/middleware/internal-methods/provider-state.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,QAAwB,EACxB,QAAsC,EACtC,KAAgC,EAChC,GAA6B;IAE7B,uEAAuE;IACvE,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,GAAG;QAChB,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,MAAM;QACf,cAAc,EAAE,MAAM;QACtB,QAAQ,EAAE,EAAE;KACb,CAAC;IAEF,OAAO,GAAG,EAAE,CAAC;AACf,CAAC","sourcesContent":["import type {\n JsonRpcEngineEndCallback,\n JsonRpcEngineNextCallback,\n} from '@metamask/json-rpc-engine';\nimport type {\n Json,\n JsonRpcRequest,\n PendingJsonRpcResponse,\n} from '@metamask/utils';\n\n/**\n * A mock handler for metamask_getProviderState that always returns a specific\n * hardcoded result.\n *\n * @param _request - Incoming JSON-RPC request. Ignored for this specific\n * handler.\n * @param response - The outgoing JSON-RPC response, modified to return the\n * result.\n * @param _next - The `json-rpc-engine` middleware next handler.\n * @param end - The `json-rpc-engine` middleware end handler.\n * @returns The JSON-RPC response.\n */\nexport async function getProviderStateHandler(\n _request: JsonRpcRequest,\n response: PendingJsonRpcResponse<Json>,\n _next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n) {\n // For now this will return a mocked result, this should probably match\n // whatever network the simulation is using.\n response.result = {\n isUnlocked: true,\n chainId: '0x01',\n networkVersion: '0x01',\n accounts: [],\n };\n\n return end();\n}\n"]}
1
+ {"version":3,"file":"provider-state.mjs","sourceRoot":"","sources":["../../../src/middleware/internal-methods/provider-state.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,QAAwB,EACxB,QAAgC,EAChC,KAAgC,EAChC,GAA6B;IAE7B,uEAAuE;IACvE,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,GAAG;QAChB,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,MAAM;QACf,cAAc,EAAE,MAAM;QACtB,QAAQ,EAAE,EAAE;KACb,CAAC;IAEF,OAAO,GAAG,EAAE,CAAC;AACf,CAAC","sourcesContent":["import type {\n JsonRpcEngineEndCallback,\n JsonRpcEngineNextCallback,\n} from '@metamask/json-rpc-engine';\nimport type { JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils';\n\n/**\n * A mock handler for metamask_getProviderState that always returns a specific\n * hardcoded result.\n *\n * @param _request - Incoming JSON-RPC request. Ignored for this specific\n * handler.\n * @param response - The outgoing JSON-RPC response, modified to return the\n * result.\n * @param _next - The `json-rpc-engine` middleware next handler.\n * @param end - The `json-rpc-engine` middleware end handler.\n * @returns The JSON-RPC response.\n */\nexport async function getProviderStateHandler(\n _request: JsonRpcRequest,\n response: PendingJsonRpcResponse,\n _next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n) {\n // For now this will return a mocked result, this should probably match\n // whatever network the simulation is using.\n response.result = {\n isUnlocked: true,\n chainId: '0x01',\n networkVersion: '0x01',\n accounts: [],\n };\n\n return end();\n}\n"]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSwitchEthereumChainHandler = void 0;
4
+ /**
5
+ * A mock handler for the `wallet_switchEthereumChain` method that always
6
+ * returns `null`.
7
+ *
8
+ * @param _request - Incoming JSON-RPC request. This is ignored for this
9
+ * specific handler.
10
+ * @param response - The outgoing JSON-RPC response, modified to return the
11
+ * result.
12
+ * @param _next - The `json-rpc-engine` middleware next handler.
13
+ * @param end - The `json-rpc-engine` middleware end handler.
14
+ * @returns The response.
15
+ */
16
+ async function getSwitchEthereumChainHandler(_request, response, _next, end) {
17
+ response.result = null;
18
+ return end();
19
+ }
20
+ exports.getSwitchEthereumChainHandler = getSwitchEthereumChainHandler;
21
+ //# sourceMappingURL=switch-ethereum-chain.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-ethereum-chain.cjs","sourceRoot":"","sources":["../../../src/middleware/internal-methods/switch-ethereum-chain.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,6BAA6B,CACjD,QAAwB,EACxB,QAAgC,EAChC,KAAgC,EAChC,GAA6B;IAE7B,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,GAAG,EAAE,CAAC;AACf,CAAC;AARD,sEAQC","sourcesContent":["import type {\n JsonRpcEngineEndCallback,\n JsonRpcEngineNextCallback,\n} from '@metamask/json-rpc-engine';\nimport type { JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils';\n\n/**\n * A mock handler for the `wallet_switchEthereumChain` method that always\n * returns `null`.\n *\n * @param _request - Incoming JSON-RPC request. This is ignored for this\n * specific handler.\n * @param response - The outgoing JSON-RPC response, modified to return the\n * result.\n * @param _next - The `json-rpc-engine` middleware next handler.\n * @param end - The `json-rpc-engine` middleware end handler.\n * @returns The response.\n */\nexport async function getSwitchEthereumChainHandler(\n _request: JsonRpcRequest,\n response: PendingJsonRpcResponse,\n _next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n) {\n response.result = null;\n return end();\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import type { JsonRpcEngineEndCallback, JsonRpcEngineNextCallback } from "@metamask/json-rpc-engine";
2
+ import type { JsonRpcRequest, PendingJsonRpcResponse } from "@metamask/utils";
3
+ /**
4
+ * A mock handler for the `wallet_switchEthereumChain` method that always
5
+ * returns `null`.
6
+ *
7
+ * @param _request - Incoming JSON-RPC request. This is ignored for this
8
+ * specific handler.
9
+ * @param response - The outgoing JSON-RPC response, modified to return the
10
+ * result.
11
+ * @param _next - The `json-rpc-engine` middleware next handler.
12
+ * @param end - The `json-rpc-engine` middleware end handler.
13
+ * @returns The response.
14
+ */
15
+ export declare function getSwitchEthereumChainHandler(_request: JsonRpcRequest, response: PendingJsonRpcResponse, _next: JsonRpcEngineNextCallback, end: JsonRpcEngineEndCallback): Promise<void>;
16
+ //# sourceMappingURL=switch-ethereum-chain.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-ethereum-chain.d.cts","sourceRoot":"","sources":["../../../src/middleware/internal-methods/switch-ethereum-chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAC1B,kCAAkC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,wBAAwB;AAE9E;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CACjD,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,yBAAyB,EAChC,GAAG,EAAE,wBAAwB,iBAI9B"}
@@ -0,0 +1,16 @@
1
+ import type { JsonRpcEngineEndCallback, JsonRpcEngineNextCallback } from "@metamask/json-rpc-engine";
2
+ import type { JsonRpcRequest, PendingJsonRpcResponse } from "@metamask/utils";
3
+ /**
4
+ * A mock handler for the `wallet_switchEthereumChain` method that always
5
+ * returns `null`.
6
+ *
7
+ * @param _request - Incoming JSON-RPC request. This is ignored for this
8
+ * specific handler.
9
+ * @param response - The outgoing JSON-RPC response, modified to return the
10
+ * result.
11
+ * @param _next - The `json-rpc-engine` middleware next handler.
12
+ * @param end - The `json-rpc-engine` middleware end handler.
13
+ * @returns The response.
14
+ */
15
+ export declare function getSwitchEthereumChainHandler(_request: JsonRpcRequest, response: PendingJsonRpcResponse, _next: JsonRpcEngineNextCallback, end: JsonRpcEngineEndCallback): Promise<void>;
16
+ //# sourceMappingURL=switch-ethereum-chain.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-ethereum-chain.d.mts","sourceRoot":"","sources":["../../../src/middleware/internal-methods/switch-ethereum-chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAC1B,kCAAkC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,wBAAwB;AAE9E;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CACjD,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,sBAAsB,EAChC,KAAK,EAAE,yBAAyB,EAChC,GAAG,EAAE,wBAAwB,iBAI9B"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A mock handler for the `wallet_switchEthereumChain` method that always
3
+ * returns `null`.
4
+ *
5
+ * @param _request - Incoming JSON-RPC request. This is ignored for this
6
+ * specific handler.
7
+ * @param response - The outgoing JSON-RPC response, modified to return the
8
+ * result.
9
+ * @param _next - The `json-rpc-engine` middleware next handler.
10
+ * @param end - The `json-rpc-engine` middleware end handler.
11
+ * @returns The response.
12
+ */
13
+ export async function getSwitchEthereumChainHandler(_request, response, _next, end) {
14
+ response.result = null;
15
+ return end();
16
+ }
17
+ //# sourceMappingURL=switch-ethereum-chain.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-ethereum-chain.mjs","sourceRoot":"","sources":["../../../src/middleware/internal-methods/switch-ethereum-chain.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,QAAwB,EACxB,QAAgC,EAChC,KAAgC,EAChC,GAA6B;IAE7B,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,GAAG,EAAE,CAAC;AACf,CAAC","sourcesContent":["import type {\n JsonRpcEngineEndCallback,\n JsonRpcEngineNextCallback,\n} from '@metamask/json-rpc-engine';\nimport type { JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils';\n\n/**\n * A mock handler for the `wallet_switchEthereumChain` method that always\n * returns `null`.\n *\n * @param _request - Incoming JSON-RPC request. This is ignored for this\n * specific handler.\n * @param response - The outgoing JSON-RPC response, modified to return the\n * result.\n * @param _next - The `json-rpc-engine` middleware next handler.\n * @param end - The `json-rpc-engine` middleware end handler.\n * @returns The response.\n */\nexport async function getSwitchEthereumChainHandler(\n _request: JsonRpcRequest,\n response: PendingJsonRpcResponse,\n _next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n) {\n response.result = null;\n return end();\n}\n"]}
package/dist/options.cjs CHANGED
@@ -18,6 +18,7 @@ const SimulationOptionsStruct = (0, superstruct_1.object)({
18
18
  displayNftMedia: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), true),
19
19
  useNftDetection: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), true),
20
20
  useExternalPricingData: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), true),
21
+ showTestnets: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), true),
21
22
  });
22
23
  /**
23
24
  * Get the options for the simulation.
@@ -1 +1 @@
1
- {"version":3,"file":"options.cjs","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";;;AACA,uDAS+B;AAC/B,2CAA6C;AAE7C,+CAA4E;AAE5E,MAAM,uBAAuB,GAAG,IAAA,oBAAM,EAAC;IACrC,QAAQ,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC,EAAE,4BAAgB,CAAC;IACzD,oBAAoB,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC,EAAE,uBAAW,CAAC;IAChE,MAAM,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC,EAAE,0BAAc,CAAC;IACrD,KAAK,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,sBAAQ,EAAC,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;IACxE,gBAAgB,EAAE,IAAA,uBAAS,EACzB,IAAA,sBAAQ,EAAC,IAAA,sBAAQ,EAAC,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC,CAAC,EAChD,IAAI,CACL;IACD,YAAY,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,KAAK,CAAC;IACnD,iBAAiB,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;IACvD,sBAAsB,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;IAC5D,iBAAiB,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;IACvD,kBAAkB,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;IACxD,eAAe,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;IACrD,eAAe,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;IACrD,sBAAsB,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;CAC7D,CAAC,CAAC;AA4BH;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,OAA8B;IACvD,OAAO,IAAA,oBAAM,EACX,OAAO,EACP,uBAAuB,CACW,CAAC;AACvC,CAAC;AALD,gCAKC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n create,\n defaulted,\n nullable,\n object,\n optional,\n record,\n string,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { DEFAULT_CURRENCY, DEFAULT_LOCALE, DEFAULT_SRP } from './constants';\n\nconst SimulationOptionsStruct = object({\n currency: defaulted(optional(string()), DEFAULT_CURRENCY),\n secretRecoveryPhrase: defaulted(optional(string()), DEFAULT_SRP),\n locale: defaulted(optional(string()), DEFAULT_LOCALE),\n state: defaulted(optional(nullable(record(string(), JsonStruct))), null),\n unencryptedState: defaulted(\n optional(nullable(record(string(), JsonStruct))),\n null,\n ),\n hideBalances: defaulted(optional(boolean()), false),\n useSecurityAlerts: defaulted(optional(boolean()), true),\n simulateOnChainActions: defaulted(optional(boolean()), true),\n useTokenDetection: defaulted(optional(boolean()), true),\n batchCheckBalances: defaulted(optional(boolean()), true),\n displayNftMedia: defaulted(optional(boolean()), true),\n useNftDetection: defaulted(optional(boolean()), true),\n useExternalPricingData: defaulted(optional(boolean()), true),\n});\n\n/**\n * Options for the simulation.\n *\n * @property currency - The currency to use. Defaults to `usd`.\n * @property secretRecoveryPhrase - The secret recovery phrase to use. This is\n * used to derive addresses and private keys. Defaults to a test recovery\n * phrase.\n * @property locale - The locale to use. Defaults to `en`.\n * @property state - The initial state of the Snap, if any. Defaults to `null`.\n * @property useSecurityAlerts - Whether to run transactions and signatures through security providers.\n * @property simulateOnChainActions - Whether to simulate transactions and signatures.\n * @property useTokenDetection - Whether to auto-detect tokens.\n * @property batchCheckBalances - Whether to fetch balances in an aggregated manner.\n * @property displayNftMedia - Whether to display NFT media.\n * @property useNftDetection - Whether to auto-detect NFTs.\n * @property useExternalPricingData - Whether to get token price data from an external source.\n */\nexport type SimulationUserOptions = Infer<typeof SimulationOptionsStruct>;\n\n/**\n * Options for the simulation, with defaults filled in.\n *\n * See {@link SimulationUserOptions} for documentation.\n */\nexport type SimulationOptions = Required<SimulationUserOptions>;\n\n/**\n * Get the options for the simulation.\n *\n * @param options - The user options. Any options not specified will be filled\n * in with default values.\n * @returns The simulation options.\n */\nexport function getOptions(options: SimulationUserOptions): SimulationOptions {\n return create(\n options,\n SimulationOptionsStruct,\n ) as Required<SimulationUserOptions>;\n}\n"]}
1
+ {"version":3,"file":"options.cjs","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";;;AACA,uDAS+B;AAC/B,2CAA6C;AAE7C,+CAA4E;AAE5E,MAAM,uBAAuB,GAAG,IAAA,oBAAM,EAAC;IACrC,QAAQ,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC,EAAE,4BAAgB,CAAC;IACzD,oBAAoB,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC,EAAE,uBAAW,CAAC;IAChE,MAAM,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC,EAAE,0BAAc,CAAC;IACrD,KAAK,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,sBAAQ,EAAC,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;IACxE,gBAAgB,EAAE,IAAA,uBAAS,EACzB,IAAA,sBAAQ,EAAC,IAAA,sBAAQ,EAAC,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC,CAAC,EAChD,IAAI,CACL;IACD,YAAY,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,KAAK,CAAC;IACnD,iBAAiB,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;IACvD,sBAAsB,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;IAC5D,iBAAiB,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;IACvD,kBAAkB,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;IACxD,eAAe,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;IACrD,eAAe,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;IACrD,sBAAsB,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;IAC5D,YAAY,EAAE,IAAA,uBAAS,EAAC,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC,EAAE,IAAI,CAAC;CACnD,CAAC,CAAC;AA6BH;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,OAA8B;IACvD,OAAO,IAAA,oBAAM,EACX,OAAO,EACP,uBAAuB,CACW,CAAC;AACvC,CAAC;AALD,gCAKC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n create,\n defaulted,\n nullable,\n object,\n optional,\n record,\n string,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { DEFAULT_CURRENCY, DEFAULT_LOCALE, DEFAULT_SRP } from './constants';\n\nconst SimulationOptionsStruct = object({\n currency: defaulted(optional(string()), DEFAULT_CURRENCY),\n secretRecoveryPhrase: defaulted(optional(string()), DEFAULT_SRP),\n locale: defaulted(optional(string()), DEFAULT_LOCALE),\n state: defaulted(optional(nullable(record(string(), JsonStruct))), null),\n unencryptedState: defaulted(\n optional(nullable(record(string(), JsonStruct))),\n null,\n ),\n hideBalances: defaulted(optional(boolean()), false),\n useSecurityAlerts: defaulted(optional(boolean()), true),\n simulateOnChainActions: defaulted(optional(boolean()), true),\n useTokenDetection: defaulted(optional(boolean()), true),\n batchCheckBalances: defaulted(optional(boolean()), true),\n displayNftMedia: defaulted(optional(boolean()), true),\n useNftDetection: defaulted(optional(boolean()), true),\n useExternalPricingData: defaulted(optional(boolean()), true),\n showTestnets: defaulted(optional(boolean()), true),\n});\n\n/**\n * Options for the simulation.\n *\n * @property currency - The currency to use. Defaults to `usd`.\n * @property secretRecoveryPhrase - The secret recovery phrase to use. This is\n * used to derive addresses and private keys. Defaults to a test recovery\n * phrase.\n * @property locale - The locale to use. Defaults to `en`.\n * @property state - The initial state of the Snap, if any. Defaults to `null`.\n * @property useSecurityAlerts - Whether to run transactions and signatures through security providers.\n * @property simulateOnChainActions - Whether to simulate transactions and signatures.\n * @property useTokenDetection - Whether to auto-detect tokens.\n * @property batchCheckBalances - Whether to fetch balances in an aggregated manner.\n * @property displayNftMedia - Whether to display NFT media.\n * @property useNftDetection - Whether to auto-detect NFTs.\n * @property useExternalPricingData - Whether to get token price data from an external source.\n * @property showTestnets - Whether to show testnets.\n */\nexport type SimulationUserOptions = Infer<typeof SimulationOptionsStruct>;\n\n/**\n * Options for the simulation, with defaults filled in.\n *\n * See {@link SimulationUserOptions} for documentation.\n */\nexport type SimulationOptions = Required<SimulationUserOptions>;\n\n/**\n * Get the options for the simulation.\n *\n * @param options - The user options. Any options not specified will be filled\n * in with default values.\n * @returns The simulation options.\n */\nexport function getOptions(options: SimulationUserOptions): SimulationOptions {\n return create(\n options,\n SimulationOptionsStruct,\n ) as Required<SimulationUserOptions>;\n}\n"]}
@@ -13,6 +13,7 @@ declare const SimulationOptionsStruct: import("@metamask/superstruct").Struct<{
13
13
  displayNftMedia?: boolean | undefined;
14
14
  useNftDetection?: boolean | undefined;
15
15
  useExternalPricingData?: boolean | undefined;
16
+ showTestnets?: boolean | undefined;
16
17
  }, {
17
18
  currency: import("@metamask/superstruct").Struct<string | undefined, null>;
18
19
  secretRecoveryPhrase: import("@metamask/superstruct").Struct<string | undefined, null>;
@@ -27,6 +28,7 @@ declare const SimulationOptionsStruct: import("@metamask/superstruct").Struct<{
27
28
  displayNftMedia: import("@metamask/superstruct").Struct<boolean | undefined, null>;
28
29
  useNftDetection: import("@metamask/superstruct").Struct<boolean | undefined, null>;
29
30
  useExternalPricingData: import("@metamask/superstruct").Struct<boolean | undefined, null>;
31
+ showTestnets: import("@metamask/superstruct").Struct<boolean | undefined, null>;
30
32
  }>;
31
33
  /**
32
34
  * Options for the simulation.
@@ -44,6 +46,7 @@ declare const SimulationOptionsStruct: import("@metamask/superstruct").Struct<{
44
46
  * @property displayNftMedia - Whether to display NFT media.
45
47
  * @property useNftDetection - Whether to auto-detect NFTs.
46
48
  * @property useExternalPricingData - Whether to get token price data from an external source.
49
+ * @property showTestnets - Whether to show testnets.
47
50
  */
48
51
  export type SimulationUserOptions = Infer<typeof SimulationOptionsStruct>;
49
52
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.cts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAenD,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB3B,CAAC;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,iBAAiB,CAK5E"}
1
+ {"version":3,"file":"options.d.cts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAenD,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkB3B,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,iBAAiB,CAK5E"}
@@ -13,6 +13,7 @@ declare const SimulationOptionsStruct: import("@metamask/superstruct").Struct<{
13
13
  displayNftMedia?: boolean | undefined;
14
14
  useNftDetection?: boolean | undefined;
15
15
  useExternalPricingData?: boolean | undefined;
16
+ showTestnets?: boolean | undefined;
16
17
  }, {
17
18
  currency: import("@metamask/superstruct").Struct<string | undefined, null>;
18
19
  secretRecoveryPhrase: import("@metamask/superstruct").Struct<string | undefined, null>;
@@ -27,6 +28,7 @@ declare const SimulationOptionsStruct: import("@metamask/superstruct").Struct<{
27
28
  displayNftMedia: import("@metamask/superstruct").Struct<boolean | undefined, null>;
28
29
  useNftDetection: import("@metamask/superstruct").Struct<boolean | undefined, null>;
29
30
  useExternalPricingData: import("@metamask/superstruct").Struct<boolean | undefined, null>;
31
+ showTestnets: import("@metamask/superstruct").Struct<boolean | undefined, null>;
30
32
  }>;
31
33
  /**
32
34
  * Options for the simulation.
@@ -44,6 +46,7 @@ declare const SimulationOptionsStruct: import("@metamask/superstruct").Struct<{
44
46
  * @property displayNftMedia - Whether to display NFT media.
45
47
  * @property useNftDetection - Whether to auto-detect NFTs.
46
48
  * @property useExternalPricingData - Whether to get token price data from an external source.
49
+ * @property showTestnets - Whether to show testnets.
47
50
  */
48
51
  export type SimulationUserOptions = Infer<typeof SimulationOptionsStruct>;
49
52
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.mts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAenD,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB3B,CAAC;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,iBAAiB,CAK5E"}
1
+ {"version":3,"file":"options.d.mts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAenD,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkB3B,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,iBAAiB,CAK5E"}
package/dist/options.mjs CHANGED
@@ -15,6 +15,7 @@ const SimulationOptionsStruct = object({
15
15
  displayNftMedia: defaulted(optional(boolean()), true),
16
16
  useNftDetection: defaulted(optional(boolean()), true),
17
17
  useExternalPricingData: defaulted(optional(boolean()), true),
18
+ showTestnets: defaulted(optional(boolean()), true),
18
19
  });
19
20
  /**
20
21
  * Get the options for the simulation.
@@ -1 +1 @@
1
- {"version":3,"file":"options.mjs","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,MAAM,EACN,SAAS,EACT,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAAM,EACP,8BAA8B;AAC/B,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,wBAAoB;AAE5E,MAAM,uBAAuB,GAAG,MAAM,CAAC;IACrC,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,gBAAgB,CAAC;IACzD,oBAAoB,EAAE,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,WAAW,CAAC;IAChE,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,cAAc,CAAC;IACrD,KAAK,EAAE,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;IACxE,gBAAgB,EAAE,SAAS,CACzB,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,EAChD,IAAI,CACL;IACD,YAAY,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC;IACnD,iBAAiB,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;IACvD,sBAAsB,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;IAC5D,iBAAiB,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;IACvD,kBAAkB,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;IACxD,eAAe,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;IACrD,eAAe,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;IACrD,sBAAsB,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;CAC7D,CAAC,CAAC;AA4BH;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,OAA8B;IACvD,OAAO,MAAM,CACX,OAAO,EACP,uBAAuB,CACW,CAAC;AACvC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n create,\n defaulted,\n nullable,\n object,\n optional,\n record,\n string,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { DEFAULT_CURRENCY, DEFAULT_LOCALE, DEFAULT_SRP } from './constants';\n\nconst SimulationOptionsStruct = object({\n currency: defaulted(optional(string()), DEFAULT_CURRENCY),\n secretRecoveryPhrase: defaulted(optional(string()), DEFAULT_SRP),\n locale: defaulted(optional(string()), DEFAULT_LOCALE),\n state: defaulted(optional(nullable(record(string(), JsonStruct))), null),\n unencryptedState: defaulted(\n optional(nullable(record(string(), JsonStruct))),\n null,\n ),\n hideBalances: defaulted(optional(boolean()), false),\n useSecurityAlerts: defaulted(optional(boolean()), true),\n simulateOnChainActions: defaulted(optional(boolean()), true),\n useTokenDetection: defaulted(optional(boolean()), true),\n batchCheckBalances: defaulted(optional(boolean()), true),\n displayNftMedia: defaulted(optional(boolean()), true),\n useNftDetection: defaulted(optional(boolean()), true),\n useExternalPricingData: defaulted(optional(boolean()), true),\n});\n\n/**\n * Options for the simulation.\n *\n * @property currency - The currency to use. Defaults to `usd`.\n * @property secretRecoveryPhrase - The secret recovery phrase to use. This is\n * used to derive addresses and private keys. Defaults to a test recovery\n * phrase.\n * @property locale - The locale to use. Defaults to `en`.\n * @property state - The initial state of the Snap, if any. Defaults to `null`.\n * @property useSecurityAlerts - Whether to run transactions and signatures through security providers.\n * @property simulateOnChainActions - Whether to simulate transactions and signatures.\n * @property useTokenDetection - Whether to auto-detect tokens.\n * @property batchCheckBalances - Whether to fetch balances in an aggregated manner.\n * @property displayNftMedia - Whether to display NFT media.\n * @property useNftDetection - Whether to auto-detect NFTs.\n * @property useExternalPricingData - Whether to get token price data from an external source.\n */\nexport type SimulationUserOptions = Infer<typeof SimulationOptionsStruct>;\n\n/**\n * Options for the simulation, with defaults filled in.\n *\n * See {@link SimulationUserOptions} for documentation.\n */\nexport type SimulationOptions = Required<SimulationUserOptions>;\n\n/**\n * Get the options for the simulation.\n *\n * @param options - The user options. Any options not specified will be filled\n * in with default values.\n * @returns The simulation options.\n */\nexport function getOptions(options: SimulationUserOptions): SimulationOptions {\n return create(\n options,\n SimulationOptionsStruct,\n ) as Required<SimulationUserOptions>;\n}\n"]}
1
+ {"version":3,"file":"options.mjs","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,MAAM,EACN,SAAS,EACT,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAAM,EACP,8BAA8B;AAC/B,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,wBAAoB;AAE5E,MAAM,uBAAuB,GAAG,MAAM,CAAC;IACrC,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,gBAAgB,CAAC;IACzD,oBAAoB,EAAE,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,WAAW,CAAC;IAChE,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,cAAc,CAAC;IACrD,KAAK,EAAE,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;IACxE,gBAAgB,EAAE,SAAS,CACzB,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,EAChD,IAAI,CACL;IACD,YAAY,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC;IACnD,iBAAiB,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;IACvD,sBAAsB,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;IAC5D,iBAAiB,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;IACvD,kBAAkB,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;IACxD,eAAe,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;IACrD,eAAe,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;IACrD,sBAAsB,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;IAC5D,YAAY,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;CACnD,CAAC,CAAC;AA6BH;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,OAA8B;IACvD,OAAO,MAAM,CACX,OAAO,EACP,uBAAuB,CACW,CAAC;AACvC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n create,\n defaulted,\n nullable,\n object,\n optional,\n record,\n string,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { DEFAULT_CURRENCY, DEFAULT_LOCALE, DEFAULT_SRP } from './constants';\n\nconst SimulationOptionsStruct = object({\n currency: defaulted(optional(string()), DEFAULT_CURRENCY),\n secretRecoveryPhrase: defaulted(optional(string()), DEFAULT_SRP),\n locale: defaulted(optional(string()), DEFAULT_LOCALE),\n state: defaulted(optional(nullable(record(string(), JsonStruct))), null),\n unencryptedState: defaulted(\n optional(nullable(record(string(), JsonStruct))),\n null,\n ),\n hideBalances: defaulted(optional(boolean()), false),\n useSecurityAlerts: defaulted(optional(boolean()), true),\n simulateOnChainActions: defaulted(optional(boolean()), true),\n useTokenDetection: defaulted(optional(boolean()), true),\n batchCheckBalances: defaulted(optional(boolean()), true),\n displayNftMedia: defaulted(optional(boolean()), true),\n useNftDetection: defaulted(optional(boolean()), true),\n useExternalPricingData: defaulted(optional(boolean()), true),\n showTestnets: defaulted(optional(boolean()), true),\n});\n\n/**\n * Options for the simulation.\n *\n * @property currency - The currency to use. Defaults to `usd`.\n * @property secretRecoveryPhrase - The secret recovery phrase to use. This is\n * used to derive addresses and private keys. Defaults to a test recovery\n * phrase.\n * @property locale - The locale to use. Defaults to `en`.\n * @property state - The initial state of the Snap, if any. Defaults to `null`.\n * @property useSecurityAlerts - Whether to run transactions and signatures through security providers.\n * @property simulateOnChainActions - Whether to simulate transactions and signatures.\n * @property useTokenDetection - Whether to auto-detect tokens.\n * @property batchCheckBalances - Whether to fetch balances in an aggregated manner.\n * @property displayNftMedia - Whether to display NFT media.\n * @property useNftDetection - Whether to auto-detect NFTs.\n * @property useExternalPricingData - Whether to get token price data from an external source.\n * @property showTestnets - Whether to show testnets.\n */\nexport type SimulationUserOptions = Infer<typeof SimulationOptionsStruct>;\n\n/**\n * Options for the simulation, with defaults filled in.\n *\n * See {@link SimulationUserOptions} for documentation.\n */\nexport type SimulationOptions = Required<SimulationUserOptions>;\n\n/**\n * Get the options for the simulation.\n *\n * @param options - The user options. Any options not specified will be filled\n * in with default values.\n * @returns The simulation options.\n */\nexport function getOptions(options: SimulationUserOptions): SimulationOptions {\n return create(\n options,\n SimulationOptionsStruct,\n ) as Required<SimulationUserOptions>;\n}\n"]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatTypeErrorMessage = void 0;
4
+ /**
5
+ * Format types for error messages based on the number of types.
6
+ *
7
+ * @param types - Array of type names.
8
+ * @returns Formatted string for error message.
9
+ */
10
+ function formatTypeErrorMessage(types) {
11
+ if (types.length === 1) {
12
+ return `"${types[0]}"`;
13
+ }
14
+ if (types.length === 2) {
15
+ return `"${types[0]}" or "${types[1]}"`;
16
+ }
17
+ const lastType = types[types.length - 1];
18
+ const otherTypes = types
19
+ .slice(0, -1)
20
+ .map((type) => `"${type}"`)
21
+ .join(', ');
22
+ return `${otherTypes} or "${lastType}"`;
23
+ }
24
+ exports.formatTypeErrorMessage = formatTypeErrorMessage;
25
+ //# sourceMappingURL=errors.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.cjs","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,KAAe;IACpD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IACzB,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IAC1C,CAAC;IAED,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,MAAM,UAAU,GAAG,KAAK;SACrB,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACZ,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC;SAC1B,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO,GAAG,UAAU,QAAQ,QAAQ,GAAG,CAAC;AAC1C,CAAC;AAhBD,wDAgBC","sourcesContent":["/**\n * Format types for error messages based on the number of types.\n *\n * @param types - Array of type names.\n * @returns Formatted string for error message.\n */\nexport function formatTypeErrorMessage(types: string[]): string {\n if (types.length === 1) {\n return `\"${types[0]}\"`;\n }\n\n if (types.length === 2) {\n return `\"${types[0]}\" or \"${types[1]}\"`;\n }\n\n const lastType = types[types.length - 1];\n const otherTypes = types\n .slice(0, -1)\n .map((type) => `\"${type}\"`)\n .join(', ');\n\n return `${otherTypes} or \"${lastType}\"`;\n}\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Format types for error messages based on the number of types.
3
+ *
4
+ * @param types - Array of type names.
5
+ * @returns Formatted string for error message.
6
+ */
7
+ export declare function formatTypeErrorMessage(types: string[]): string;
8
+ //# sourceMappingURL=errors.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.cts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAgB9D"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Format types for error messages based on the number of types.
3
+ *
4
+ * @param types - Array of type names.
5
+ * @returns Formatted string for error message.
6
+ */
7
+ export declare function formatTypeErrorMessage(types: string[]): string;
8
+ //# sourceMappingURL=errors.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAgB9D"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Format types for error messages based on the number of types.
3
+ *
4
+ * @param types - Array of type names.
5
+ * @returns Formatted string for error message.
6
+ */
7
+ export function formatTypeErrorMessage(types) {
8
+ if (types.length === 1) {
9
+ return `"${types[0]}"`;
10
+ }
11
+ if (types.length === 2) {
12
+ return `"${types[0]}" or "${types[1]}"`;
13
+ }
14
+ const lastType = types[types.length - 1];
15
+ const otherTypes = types
16
+ .slice(0, -1)
17
+ .map((type) => `"${type}"`)
18
+ .join(', ');
19
+ return `${otherTypes} or "${lastType}"`;
20
+ }
21
+ //# sourceMappingURL=errors.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.mjs","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAe;IACpD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IACzB,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IAC1C,CAAC;IAED,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,MAAM,UAAU,GAAG,KAAK;SACrB,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACZ,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC;SAC1B,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO,GAAG,UAAU,QAAQ,QAAQ,GAAG,CAAC;AAC1C,CAAC","sourcesContent":["/**\n * Format types for error messages based on the number of types.\n *\n * @param types - Array of type names.\n * @returns Formatted string for error message.\n */\nexport function formatTypeErrorMessage(types: string[]): string {\n if (types.length === 1) {\n return `\"${types[0]}\"`;\n }\n\n if (types.length === 2) {\n return `\"${types[0]}\" or \"${types[1]}\"`;\n }\n\n const lastType = types[types.length - 1];\n const otherTypes = types\n .slice(0, -1)\n .map((type) => `\"${type}\"`)\n .join(', ');\n\n return `${otherTypes} or \"${lastType}\"`;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/snaps-simulation",
3
- "version": "2.4.1",
3
+ "version": "2.6.0",
4
4
  "description": "A simulation framework for MetaMask Snaps, enabling headless testing of Snaps in a controlled environment",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -55,20 +55,20 @@
55
55
  "test:watch": "jest --watch"
56
56
  },
57
57
  "dependencies": {
58
- "@metamask/base-controller": "^8.0.0",
59
- "@metamask/eth-json-rpc-middleware": "^16.0.1",
58
+ "@metamask/base-controller": "^8.0.1",
59
+ "@metamask/eth-json-rpc-middleware": "^17.0.0",
60
60
  "@metamask/json-rpc-engine": "^10.0.2",
61
61
  "@metamask/json-rpc-middleware-stream": "^8.0.7",
62
62
  "@metamask/key-tree": "^10.1.1",
63
63
  "@metamask/permission-controller": "^11.0.6",
64
- "@metamask/phishing-controller": "^12.4.1",
65
- "@metamask/snaps-controllers": "^11.2.0",
66
- "@metamask/snaps-execution-environments": "^7.2.0",
67
- "@metamask/snaps-rpc-methods": "^12.1.0",
68
- "@metamask/snaps-sdk": "^6.22.0",
69
- "@metamask/snaps-utils": "^9.2.0",
64
+ "@metamask/phishing-controller": "^12.5.0",
65
+ "@metamask/snaps-controllers": "^12.1.0",
66
+ "@metamask/snaps-execution-environments": "^8.1.0",
67
+ "@metamask/snaps-rpc-methods": "^12.3.0",
68
+ "@metamask/snaps-sdk": "^6.24.0",
69
+ "@metamask/snaps-utils": "^9.3.0",
70
70
  "@metamask/superstruct": "^3.2.1",
71
- "@metamask/utils": "^11.2.0",
71
+ "@metamask/utils": "^11.4.0",
72
72
  "@reduxjs/toolkit": "^1.9.5",
73
73
  "fast-deep-equal": "^3.1.3",
74
74
  "mime": "^3.0.0",
@@ -76,17 +76,17 @@
76
76
  "redux-saga": "^1.2.3"
77
77
  },
78
78
  "devDependencies": {
79
- "@lavamoat/allow-scripts": "^3.0.4",
80
- "@metamask/auto-changelog": "^5.0.1",
79
+ "@lavamoat/allow-scripts": "^3.3.3",
80
+ "@metamask/auto-changelog": "^5.0.2",
81
81
  "@ts-bridge/cli": "^0.6.1",
82
- "@types/express": "^4.17.17",
82
+ "@types/express": "^5.0.1",
83
83
  "@types/jest": "^27.5.1",
84
84
  "@types/mime": "^3.0.0",
85
85
  "@types/readable-stream": "^4.0.15",
86
86
  "deepmerge": "^4.2.2",
87
87
  "depcheck": "^1.4.7",
88
88
  "eslint": "^9.11.0",
89
- "express": "^4.21.2",
89
+ "express": "^5.1.0",
90
90
  "jest": "^29.0.2",
91
91
  "jest-it-up": "^2.0.0",
92
92
  "jest-silent-reporter": "^0.6.0",