@metamask/snaps-simulation 3.2.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/dist/constants.cjs +2 -0
  3. package/dist/constants.cjs.map +1 -1
  4. package/dist/constants.d.cts.map +1 -1
  5. package/dist/constants.d.mts.map +1 -1
  6. package/dist/constants.mjs +2 -0
  7. package/dist/constants.mjs.map +1 -1
  8. package/dist/methods/hooks/end-trace.cjs +29 -0
  9. package/dist/methods/hooks/end-trace.cjs.map +1 -0
  10. package/dist/methods/hooks/end-trace.d.cts +9 -0
  11. package/dist/methods/hooks/end-trace.d.cts.map +1 -0
  12. package/dist/methods/hooks/end-trace.d.mts +9 -0
  13. package/dist/methods/hooks/end-trace.d.mts.map +1 -0
  14. package/dist/methods/hooks/end-trace.mjs +25 -0
  15. package/dist/methods/hooks/end-trace.mjs.map +1 -0
  16. package/dist/methods/hooks/get-snap.cjs +52 -0
  17. package/dist/methods/hooks/get-snap.cjs.map +1 -0
  18. package/dist/methods/hooks/get-snap.d.cts +11 -0
  19. package/dist/methods/hooks/get-snap.d.cts.map +1 -0
  20. package/dist/methods/hooks/get-snap.d.mts +11 -0
  21. package/dist/methods/hooks/get-snap.d.mts.map +1 -0
  22. package/dist/methods/hooks/get-snap.mjs +48 -0
  23. package/dist/methods/hooks/get-snap.mjs.map +1 -0
  24. package/dist/methods/hooks/index.cjs +5 -0
  25. package/dist/methods/hooks/index.cjs.map +1 -1
  26. package/dist/methods/hooks/index.d.cts +5 -0
  27. package/dist/methods/hooks/index.d.cts.map +1 -1
  28. package/dist/methods/hooks/index.d.mts +5 -0
  29. package/dist/methods/hooks/index.d.mts.map +1 -1
  30. package/dist/methods/hooks/index.mjs +5 -0
  31. package/dist/methods/hooks/index.mjs.map +1 -1
  32. package/dist/methods/hooks/start-trace.cjs +34 -0
  33. package/dist/methods/hooks/start-trace.cjs.map +1 -0
  34. package/dist/methods/hooks/start-trace.d.cts +9 -0
  35. package/dist/methods/hooks/start-trace.d.cts.map +1 -0
  36. package/dist/methods/hooks/start-trace.d.mts +9 -0
  37. package/dist/methods/hooks/start-trace.d.mts.map +1 -0
  38. package/dist/methods/hooks/start-trace.mjs +30 -0
  39. package/dist/methods/hooks/start-trace.mjs.map +1 -0
  40. package/dist/methods/hooks/track-error.cjs +31 -0
  41. package/dist/methods/hooks/track-error.cjs.map +1 -0
  42. package/dist/methods/hooks/track-error.d.cts +9 -0
  43. package/dist/methods/hooks/track-error.d.cts.map +1 -0
  44. package/dist/methods/hooks/track-error.d.mts +9 -0
  45. package/dist/methods/hooks/track-error.d.mts.map +1 -0
  46. package/dist/methods/hooks/track-error.mjs +27 -0
  47. package/dist/methods/hooks/track-error.mjs.map +1 -0
  48. package/dist/methods/hooks/track-event.cjs +29 -0
  49. package/dist/methods/hooks/track-event.cjs.map +1 -0
  50. package/dist/methods/hooks/track-event.d.cts +13 -0
  51. package/dist/methods/hooks/track-event.d.cts.map +1 -0
  52. package/dist/methods/hooks/track-event.d.mts +13 -0
  53. package/dist/methods/hooks/track-event.d.mts.map +1 -0
  54. package/dist/methods/hooks/track-event.mjs +25 -0
  55. package/dist/methods/hooks/track-event.mjs.map +1 -0
  56. package/dist/options.cjs +1 -0
  57. package/dist/options.cjs.map +1 -1
  58. package/dist/options.d.cts +6 -0
  59. package/dist/options.d.cts.map +1 -1
  60. package/dist/options.d.mts +6 -0
  61. package/dist/options.d.mts.map +1 -1
  62. package/dist/options.mjs +1 -0
  63. package/dist/options.mjs.map +1 -1
  64. package/dist/request.cjs +21 -1
  65. package/dist/request.cjs.map +1 -1
  66. package/dist/request.d.cts.map +1 -1
  67. package/dist/request.d.mts.map +1 -1
  68. package/dist/request.mjs +22 -2
  69. package/dist/request.mjs.map +1 -1
  70. package/dist/simulation.cjs +26 -7
  71. package/dist/simulation.cjs.map +1 -1
  72. package/dist/simulation.d.cts +36 -3
  73. package/dist/simulation.d.cts.map +1 -1
  74. package/dist/simulation.d.mts +36 -3
  75. package/dist/simulation.d.mts.map +1 -1
  76. package/dist/simulation.mjs +27 -8
  77. package/dist/simulation.mjs.map +1 -1
  78. package/dist/store/index.cjs +1 -0
  79. package/dist/store/index.cjs.map +1 -1
  80. package/dist/store/index.d.cts +1 -0
  81. package/dist/store/index.d.cts.map +1 -1
  82. package/dist/store/index.d.mts +1 -0
  83. package/dist/store/index.d.mts.map +1 -1
  84. package/dist/store/index.mjs +1 -0
  85. package/dist/store/index.mjs.map +1 -1
  86. package/dist/store/mocks.d.cts +1 -0
  87. package/dist/store/mocks.d.cts.map +1 -1
  88. package/dist/store/mocks.d.mts +1 -0
  89. package/dist/store/mocks.d.mts.map +1 -1
  90. package/dist/store/notifications.d.cts +1 -0
  91. package/dist/store/notifications.d.cts.map +1 -1
  92. package/dist/store/notifications.d.mts +1 -0
  93. package/dist/store/notifications.d.mts.map +1 -1
  94. package/dist/store/state.d.cts +2 -0
  95. package/dist/store/state.d.cts.map +1 -1
  96. package/dist/store/state.d.mts +2 -0
  97. package/dist/store/state.d.mts.map +1 -1
  98. package/dist/store/store.cjs +2 -0
  99. package/dist/store/store.cjs.map +1 -1
  100. package/dist/store/store.d.cts +1 -0
  101. package/dist/store/store.d.cts.map +1 -1
  102. package/dist/store/store.d.mts +1 -0
  103. package/dist/store/store.d.mts.map +1 -1
  104. package/dist/store/store.mjs +2 -0
  105. package/dist/store/store.mjs.map +1 -1
  106. package/dist/store/trackables.cjs +70 -0
  107. package/dist/store/trackables.cjs.map +1 -0
  108. package/dist/store/trackables.d.cts +98 -0
  109. package/dist/store/trackables.d.cts.map +1 -0
  110. package/dist/store/trackables.d.mts +98 -0
  111. package/dist/store/trackables.d.mts.map +1 -0
  112. package/dist/store/trackables.mjs +67 -0
  113. package/dist/store/trackables.mjs.map +1 -0
  114. package/dist/store/ui.d.cts +1 -0
  115. package/dist/store/ui.d.cts.map +1 -1
  116. package/dist/store/ui.d.mts +1 -0
  117. package/dist/store/ui.d.mts.map +1 -1
  118. package/dist/structs.cjs +17 -0
  119. package/dist/structs.cjs.map +1 -1
  120. package/dist/structs.d.cts +182 -12
  121. package/dist/structs.d.cts.map +1 -1
  122. package/dist/structs.d.mts +182 -12
  123. package/dist/structs.d.mts.map +1 -1
  124. package/dist/structs.mjs +18 -1
  125. package/dist/structs.mjs.map +1 -1
  126. package/dist/types.cjs.map +1 -1
  127. package/dist/types.d.cts +11 -1
  128. package/dist/types.d.cts.map +1 -1
  129. package/dist/types.d.mts +11 -1
  130. package/dist/types.d.mts.map +1 -1
  131. package/dist/types.mjs.map +1 -1
  132. package/dist/utils/account.cjs +21 -0
  133. package/dist/utils/account.cjs.map +1 -0
  134. package/dist/utils/account.d.cts +26 -0
  135. package/dist/utils/account.d.cts.map +1 -0
  136. package/dist/utils/account.d.mts +26 -0
  137. package/dist/utils/account.d.mts.map +1 -0
  138. package/dist/utils/account.mjs +17 -0
  139. package/dist/utils/account.mjs.map +1 -0
  140. package/package.json +9 -8
package/CHANGELOG.md CHANGED
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.4.0]
11
+
12
+ ### Added
13
+
14
+ - Add support for `snap_startTrace` and `snap_endTrace` ([#3547](https://github.com/MetaMask/snaps/pull/3547))
15
+ - Add support for `snap_trackError` ([#3546](https://github.com/MetaMask/snaps/pull/3546))
16
+ - Add support for `snap_trackEvent` ([#3546](https://github.com/MetaMask/snaps/pull/3546))
17
+
18
+ ## [3.3.0]
19
+
20
+ ### Added
21
+
22
+ - Add Snap metadata to simulated accounts ([#3528](https://github.com/MetaMask/snaps/pull/3528))
23
+
10
24
  ## [3.2.0]
11
25
 
12
26
  ### Added
@@ -190,7 +204,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
190
204
 
191
205
  - Initial release of `@metamask/snaps-simulation` package ([#2727](https://github.com/MetaMask/snaps/pull/2727))
192
206
 
193
- [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.2.0...HEAD
207
+ [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.4.0...HEAD
208
+ [3.4.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.3.0...@metamask/snaps-simulation@3.4.0
209
+ [3.3.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.2.0...@metamask/snaps-simulation@3.3.0
194
210
  [3.2.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.1.0...@metamask/snaps-simulation@3.2.0
195
211
  [3.1.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@3.0.0...@metamask/snaps-simulation@3.1.0
196
212
  [3.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-simulation@2.7.0...@metamask/snaps-simulation@3.0.0
@@ -33,6 +33,7 @@ exports.DEFAULT_ACCOUNTS = [
33
33
  id: '29bc7513-d1b9-4466-98a6-f5f9e0b90137',
34
34
  scopes: ['eip155:0'],
35
35
  selected: false,
36
+ owned: false,
36
37
  // We don't expose assets for EVM accounts as it's not supported in the AssetSelector.
37
38
  assets: [],
38
39
  },
@@ -45,6 +46,7 @@ exports.DEFAULT_ACCOUNTS = [
45
46
  'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',
46
47
  ],
47
48
  selected: true,
49
+ owned: true,
48
50
  assets: [
49
51
  'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501',
50
52
  'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
@@ -1 +1 @@
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"]}
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,KAAK,EAAE,KAAK;QACZ,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,KAAK,EAAE,IAAI;QACX,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 owned: 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 owned: 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"]}
@@ -1 +1 @@
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"}
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,EAyB/C,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;CAU1B,CAAC"}
@@ -1 +1 @@
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"}
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,EAyB/C,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;CAU1B,CAAC"}
@@ -30,6 +30,7 @@ export const DEFAULT_ACCOUNTS = [
30
30
  id: '29bc7513-d1b9-4466-98a6-f5f9e0b90137',
31
31
  scopes: ['eip155:0'],
32
32
  selected: false,
33
+ owned: false,
33
34
  // We don't expose assets for EVM accounts as it's not supported in the AssetSelector.
34
35
  assets: [],
35
36
  },
@@ -42,6 +43,7 @@ export const DEFAULT_ACCOUNTS = [
42
43
  'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',
43
44
  ],
44
45
  selected: true,
46
+ owned: true,
45
47
  assets: [
46
48
  'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501',
47
49
  'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
@@ -1 +1 @@
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"]}
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,KAAK,EAAE,KAAK;QACZ,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,KAAK,EAAE,IAAI;QACX,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 owned: 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 owned: 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"]}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEndTraceImplementation = void 0;
4
+ const effects_1 = require("redux-saga/effects");
5
+ const store_1 = require("../../store/index.cjs");
6
+ /**
7
+ * End a performance trace.
8
+ *
9
+ * @param event - The performance trace to end.
10
+ * @returns `null`.
11
+ * @yields Adds the completed trace to the store.
12
+ */
13
+ function* endTraceImplementation(event) {
14
+ yield (0, effects_1.put)((0, store_1.endTrace)(event));
15
+ return null;
16
+ }
17
+ /**
18
+ * Get a method that can be used to end a performance trace.
19
+ *
20
+ * @param runSaga - A function to run a saga outside the usual Redux flow.
21
+ * @returns A method that can be used to end a performance trace.
22
+ */
23
+ function getEndTraceImplementation(runSaga) {
24
+ return (...args) => {
25
+ return runSaga(endTraceImplementation, ...args).result();
26
+ };
27
+ }
28
+ exports.getEndTraceImplementation = getEndTraceImplementation;
29
+ //# sourceMappingURL=end-trace.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"end-trace.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/end-trace.ts"],"names":[],"mappings":";;;AAEA,gDAAyC;AAGzC,iDAAuC;AAEvC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,sBAAsB,CAAC,KAAqB;IACpD,MAAM,IAAA,aAAG,EAAC,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,yBAAyB,CAAC,OAAwB;IAChE,OAAO,CAAC,GAAG,IAA+C,EAAE,EAAE;QAC5D,OAAO,OAAO,CAAC,sBAAsB,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC;AAJD,8DAIC","sourcesContent":["import type { EndTraceParams } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { endTrace } from '../../store';\n\n/**\n * End a performance trace.\n *\n * @param event - The performance trace to end.\n * @returns `null`.\n * @yields Adds the completed trace to the store.\n */\nfunction* endTraceImplementation(event: EndTraceParams): SagaIterator {\n yield put(endTrace(event));\n return null;\n}\n\n/**\n * Get a method that can be used to end a performance trace.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to end a performance trace.\n */\nexport function getEndTraceImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof endTraceImplementation>) => {\n return runSaga(endTraceImplementation, ...args).result();\n };\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { RunSagaFunction } from "../../store/index.cjs";
2
+ /**
3
+ * Get a method that can be used to end a performance trace.
4
+ *
5
+ * @param runSaga - A function to run a saga outside the usual Redux flow.
6
+ * @returns A method that can be used to end a performance trace.
7
+ */
8
+ export declare function getEndTraceImplementation(runSaga: RunSagaFunction): (event: import("@metamask/snaps-sdk").EndTraceRequest) => any;
9
+ //# sourceMappingURL=end-trace.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"end-trace.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/end-trace.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAenD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,eAAe,iEAIjE"}
@@ -0,0 +1,9 @@
1
+ import type { RunSagaFunction } from "../../store/index.mjs";
2
+ /**
3
+ * Get a method that can be used to end a performance trace.
4
+ *
5
+ * @param runSaga - A function to run a saga outside the usual Redux flow.
6
+ * @returns A method that can be used to end a performance trace.
7
+ */
8
+ export declare function getEndTraceImplementation(runSaga: RunSagaFunction): (event: import("@metamask/snaps-sdk").EndTraceRequest) => any;
9
+ //# sourceMappingURL=end-trace.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"end-trace.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/end-trace.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAenD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,eAAe,iEAIjE"}
@@ -0,0 +1,25 @@
1
+ import { put } from "redux-saga/effects";
2
+ import { endTrace } from "../../store/index.mjs";
3
+ /**
4
+ * End a performance trace.
5
+ *
6
+ * @param event - The performance trace to end.
7
+ * @returns `null`.
8
+ * @yields Adds the completed trace to the store.
9
+ */
10
+ function* endTraceImplementation(event) {
11
+ yield put(endTrace(event));
12
+ return null;
13
+ }
14
+ /**
15
+ * Get a method that can be used to end a performance trace.
16
+ *
17
+ * @param runSaga - A function to run a saga outside the usual Redux flow.
18
+ * @returns A method that can be used to end a performance trace.
19
+ */
20
+ export function getEndTraceImplementation(runSaga) {
21
+ return (...args) => {
22
+ return runSaga(endTraceImplementation, ...args).result();
23
+ };
24
+ }
25
+ //# sourceMappingURL=end-trace.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"end-trace.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/end-trace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,2BAA2B;AAGzC,OAAO,EAAE,QAAQ,EAAE,8BAAoB;AAEvC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,sBAAsB,CAAC,KAAqB;IACpD,MAAM,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAwB;IAChE,OAAO,CAAC,GAAG,IAA+C,EAAE,EAAE;QAC5D,OAAO,OAAO,CAAC,sBAAsB,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { EndTraceParams } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { endTrace } from '../../store';\n\n/**\n * End a performance trace.\n *\n * @param event - The performance trace to end.\n * @returns `null`.\n * @yields Adds the completed trace to the store.\n */\nfunction* endTraceImplementation(event: EndTraceParams): SagaIterator {\n yield put(endTrace(event));\n return null;\n}\n\n/**\n * Get a method that can be used to end a performance trace.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to end a performance trace.\n */\nexport function getEndTraceImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof endTraceImplementation>) => {\n return runSaga(endTraceImplementation, ...args).result();\n };\n}\n"]}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGetSnapImplementation = void 0;
4
+ const snaps_utils_1 = require("@metamask/snaps-utils");
5
+ /**
6
+ * Get a method that gets a Snap by its ID.
7
+ *
8
+ * @param preinstalled - Whether the Snap is preinstalled. If `true`, the Snap
9
+ * will be returned as a preinstalled Snap.
10
+ * @returns A method that gets a Snap by its ID. It will always return a mock
11
+ * Snap for simulation purposes.
12
+ */
13
+ function getGetSnapImplementation(preinstalled = true) {
14
+ return (_snapId) => {
15
+ // This is a mock Snap for simulation purposes. Most of the fields are not
16
+ // actually used, but returned for type-safety sake.
17
+ return {
18
+ id: 'npm:@metamask/snaps-simulation',
19
+ version: '0.1.0',
20
+ enabled: true,
21
+ blocked: false,
22
+ status: snaps_utils_1.SnapStatus.Running,
23
+ versionHistory: [],
24
+ initialPermissions: {},
25
+ sourceCode: '',
26
+ manifest: {
27
+ version: '0.1.0',
28
+ proposedName: 'Test Snap',
29
+ description: 'A test Snap for simulation purposes.',
30
+ repository: {
31
+ type: 'git',
32
+ url: 'https://github.com/MetaMask/snaps.git',
33
+ },
34
+ source: {
35
+ shasum: 'unused',
36
+ location: {
37
+ npm: {
38
+ filePath: 'dist/index.js',
39
+ packageName: '@metamask/snaps-simulation',
40
+ registry: 'https://registry.npmjs.org',
41
+ },
42
+ },
43
+ },
44
+ initialPermissions: {},
45
+ manifestVersion: '0.1',
46
+ },
47
+ preinstalled,
48
+ };
49
+ };
50
+ }
51
+ exports.getGetSnapImplementation = getGetSnapImplementation;
52
+ //# sourceMappingURL=get-snap.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-snap.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/get-snap.ts"],"names":[],"mappings":";;;AAEA,uDAAmD;AAGnD;;;;;;;GAOG;AACH,SAAgB,wBAAwB,CAAC,eAAwB,IAAI;IACnE,OAAO,CAAC,OAAe,EAAQ,EAAE;QAC/B,0EAA0E;QAC1E,oDAAoD;QACpD,OAAO;YACL,EAAE,EAAE,gCAA0C;YAC9C,OAAO,EAAE,OAAwB;YACjC,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,wBAAU,CAAC,OAAO;YAC1B,cAAc,EAAE,EAAE;YAClB,kBAAkB,EAAE,EAAE;YACtB,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE;gBACR,OAAO,EAAE,OAAwB;gBACjC,YAAY,EAAE,WAAW;gBACzB,WAAW,EAAE,sCAAsC;gBACnD,UAAU,EAAE;oBACV,IAAI,EAAE,KAAK;oBACX,GAAG,EAAE,uCAAuC;iBAC7C;gBACD,MAAM,EAAE;oBACN,MAAM,EAAE,QAAQ;oBAChB,QAAQ,EAAE;wBACR,GAAG,EAAE;4BACH,QAAQ,EAAE,eAAe;4BACzB,WAAW,EAAE,4BAA4B;4BACzC,QAAQ,EAAE,4BAA4B;yBACvC;qBACF;iBACF;gBACD,kBAAkB,EAAE,EAAE;gBACtB,eAAe,EAAE,KAAK;aACvB;YACD,YAAY;SACb,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AArCD,4DAqCC","sourcesContent":["import type { SnapId } from '@metamask/snaps-sdk';\nimport type { Snap } from '@metamask/snaps-utils';\nimport { SnapStatus } from '@metamask/snaps-utils';\nimport type { SemVerVersion } from '@metamask/utils';\n\n/**\n * Get a method that gets a Snap by its ID.\n *\n * @param preinstalled - Whether the Snap is preinstalled. If `true`, the Snap\n * will be returned as a preinstalled Snap.\n * @returns A method that gets a Snap by its ID. It will always return a mock\n * Snap for simulation purposes.\n */\nexport function getGetSnapImplementation(preinstalled: boolean = true) {\n return (_snapId: string): Snap => {\n // This is a mock Snap for simulation purposes. Most of the fields are not\n // actually used, but returned for type-safety sake.\n return {\n id: 'npm:@metamask/snaps-simulation' as SnapId,\n version: '0.1.0' as SemVerVersion,\n enabled: true,\n blocked: false,\n status: SnapStatus.Running,\n versionHistory: [],\n initialPermissions: {},\n sourceCode: '',\n manifest: {\n version: '0.1.0' as SemVerVersion,\n proposedName: 'Test Snap',\n description: 'A test Snap for simulation purposes.',\n repository: {\n type: 'git',\n url: 'https://github.com/MetaMask/snaps.git',\n },\n source: {\n shasum: 'unused',\n location: {\n npm: {\n filePath: 'dist/index.js',\n packageName: '@metamask/snaps-simulation',\n registry: 'https://registry.npmjs.org',\n },\n },\n },\n initialPermissions: {},\n manifestVersion: '0.1',\n },\n preinstalled,\n };\n };\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import type { Snap } from "@metamask/snaps-utils";
2
+ /**
3
+ * Get a method that gets a Snap by its ID.
4
+ *
5
+ * @param preinstalled - Whether the Snap is preinstalled. If `true`, the Snap
6
+ * will be returned as a preinstalled Snap.
7
+ * @returns A method that gets a Snap by its ID. It will always return a mock
8
+ * Snap for simulation purposes.
9
+ */
10
+ export declare function getGetSnapImplementation(preinstalled?: boolean): (_snapId: string) => Snap;
11
+ //# sourceMappingURL=get-snap.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-snap.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/get-snap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,8BAA8B;AAIlD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,GAAE,OAAc,aAClD,MAAM,KAAG,IAAI,CAoC/B"}
@@ -0,0 +1,11 @@
1
+ import type { Snap } from "@metamask/snaps-utils";
2
+ /**
3
+ * Get a method that gets a Snap by its ID.
4
+ *
5
+ * @param preinstalled - Whether the Snap is preinstalled. If `true`, the Snap
6
+ * will be returned as a preinstalled Snap.
7
+ * @returns A method that gets a Snap by its ID. It will always return a mock
8
+ * Snap for simulation purposes.
9
+ */
10
+ export declare function getGetSnapImplementation(preinstalled?: boolean): (_snapId: string) => Snap;
11
+ //# sourceMappingURL=get-snap.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-snap.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/get-snap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,8BAA8B;AAIlD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,GAAE,OAAc,aAClD,MAAM,KAAG,IAAI,CAoC/B"}
@@ -0,0 +1,48 @@
1
+ import { SnapStatus } from "@metamask/snaps-utils";
2
+ /**
3
+ * Get a method that gets a Snap by its ID.
4
+ *
5
+ * @param preinstalled - Whether the Snap is preinstalled. If `true`, the Snap
6
+ * will be returned as a preinstalled Snap.
7
+ * @returns A method that gets a Snap by its ID. It will always return a mock
8
+ * Snap for simulation purposes.
9
+ */
10
+ export function getGetSnapImplementation(preinstalled = true) {
11
+ return (_snapId) => {
12
+ // This is a mock Snap for simulation purposes. Most of the fields are not
13
+ // actually used, but returned for type-safety sake.
14
+ return {
15
+ id: 'npm:@metamask/snaps-simulation',
16
+ version: '0.1.0',
17
+ enabled: true,
18
+ blocked: false,
19
+ status: SnapStatus.Running,
20
+ versionHistory: [],
21
+ initialPermissions: {},
22
+ sourceCode: '',
23
+ manifest: {
24
+ version: '0.1.0',
25
+ proposedName: 'Test Snap',
26
+ description: 'A test Snap for simulation purposes.',
27
+ repository: {
28
+ type: 'git',
29
+ url: 'https://github.com/MetaMask/snaps.git',
30
+ },
31
+ source: {
32
+ shasum: 'unused',
33
+ location: {
34
+ npm: {
35
+ filePath: 'dist/index.js',
36
+ packageName: '@metamask/snaps-simulation',
37
+ registry: 'https://registry.npmjs.org',
38
+ },
39
+ },
40
+ },
41
+ initialPermissions: {},
42
+ manifestVersion: '0.1',
43
+ },
44
+ preinstalled,
45
+ };
46
+ };
47
+ }
48
+ //# sourceMappingURL=get-snap.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-snap.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/get-snap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,8BAA8B;AAGnD;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,eAAwB,IAAI;IACnE,OAAO,CAAC,OAAe,EAAQ,EAAE;QAC/B,0EAA0E;QAC1E,oDAAoD;QACpD,OAAO;YACL,EAAE,EAAE,gCAA0C;YAC9C,OAAO,EAAE,OAAwB;YACjC,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,UAAU,CAAC,OAAO;YAC1B,cAAc,EAAE,EAAE;YAClB,kBAAkB,EAAE,EAAE;YACtB,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE;gBACR,OAAO,EAAE,OAAwB;gBACjC,YAAY,EAAE,WAAW;gBACzB,WAAW,EAAE,sCAAsC;gBACnD,UAAU,EAAE;oBACV,IAAI,EAAE,KAAK;oBACX,GAAG,EAAE,uCAAuC;iBAC7C;gBACD,MAAM,EAAE;oBACN,MAAM,EAAE,QAAQ;oBAChB,QAAQ,EAAE;wBACR,GAAG,EAAE;4BACH,QAAQ,EAAE,eAAe;4BACzB,WAAW,EAAE,4BAA4B;4BACzC,QAAQ,EAAE,4BAA4B;yBACvC;qBACF;iBACF;gBACD,kBAAkB,EAAE,EAAE;gBACtB,eAAe,EAAE,KAAK;aACvB;YACD,YAAY;SACb,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { SnapId } from '@metamask/snaps-sdk';\nimport type { Snap } from '@metamask/snaps-utils';\nimport { SnapStatus } from '@metamask/snaps-utils';\nimport type { SemVerVersion } from '@metamask/utils';\n\n/**\n * Get a method that gets a Snap by its ID.\n *\n * @param preinstalled - Whether the Snap is preinstalled. If `true`, the Snap\n * will be returned as a preinstalled Snap.\n * @returns A method that gets a Snap by its ID. It will always return a mock\n * Snap for simulation purposes.\n */\nexport function getGetSnapImplementation(preinstalled: boolean = true) {\n return (_snapId: string): Snap => {\n // This is a mock Snap for simulation purposes. Most of the fields are not\n // actually used, but returned for type-safety sake.\n return {\n id: 'npm:@metamask/snaps-simulation' as SnapId,\n version: '0.1.0' as SemVerVersion,\n enabled: true,\n blocked: false,\n status: SnapStatus.Running,\n versionHistory: [],\n initialPermissions: {},\n sourceCode: '',\n manifest: {\n version: '0.1.0' as SemVerVersion,\n proposedName: 'Test Snap',\n description: 'A test Snap for simulation purposes.',\n repository: {\n type: 'git',\n url: 'https://github.com/MetaMask/snaps.git',\n },\n source: {\n shasum: 'unused',\n location: {\n npm: {\n filePath: 'dist/index.js',\n packageName: '@metamask/snaps-simulation',\n registry: 'https://registry.npmjs.org',\n },\n },\n },\n initialPermissions: {},\n manifestVersion: '0.1',\n },\n preinstalled,\n };\n };\n}\n"]}
@@ -14,12 +14,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./end-trace.cjs"), exports);
17
18
  __exportStar(require("./get-entropy-sources.cjs"), exports);
18
19
  __exportStar(require("./get-mnemonic.cjs"), exports);
19
20
  __exportStar(require("./get-preferences.cjs"), exports);
21
+ __exportStar(require("./get-snap.cjs"), exports);
20
22
  __exportStar(require("./interface.cjs"), exports);
21
23
  __exportStar(require("./notifications.cjs"), exports);
22
24
  __exportStar(require("./permitted/index.cjs"), exports);
23
25
  __exportStar(require("./request-user-approval.cjs"), exports);
26
+ __exportStar(require("./start-trace.cjs"), exports);
24
27
  __exportStar(require("./state.cjs"), exports);
28
+ __exportStar(require("./track-error.cjs"), exports);
29
+ __exportStar(require("./track-event.cjs"), exports);
25
30
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAAsC;AACtC,qDAA+B;AAC/B,wDAAkC;AAClC,kDAA4B;AAC5B,sDAAgC;AAChC,wDAA4B;AAC5B,8DAAwC;AACxC,8CAAwB","sourcesContent":["export * from './get-entropy-sources';\nexport * from './get-mnemonic';\nexport * from './get-preferences';\nexport * from './interface';\nexport * from './notifications';\nexport * from './permitted';\nexport * from './request-user-approval';\nexport * from './state';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA4B;AAC5B,4DAAsC;AACtC,qDAA+B;AAC/B,wDAAkC;AAClC,iDAA2B;AAC3B,kDAA4B;AAC5B,sDAAgC;AAChC,wDAA4B;AAC5B,8DAAwC;AACxC,oDAA8B;AAC9B,8CAAwB;AACxB,oDAA8B;AAC9B,oDAA8B","sourcesContent":["export * from './end-trace';\nexport * from './get-entropy-sources';\nexport * from './get-mnemonic';\nexport * from './get-preferences';\nexport * from './get-snap';\nexport * from './interface';\nexport * from './notifications';\nexport * from './permitted';\nexport * from './request-user-approval';\nexport * from './start-trace';\nexport * from './state';\nexport * from './track-error';\nexport * from './track-event';\n"]}
@@ -1,9 +1,14 @@
1
+ export * from "./end-trace.cjs";
1
2
  export * from "./get-entropy-sources.cjs";
2
3
  export * from "./get-mnemonic.cjs";
3
4
  export * from "./get-preferences.cjs";
5
+ export * from "./get-snap.cjs";
4
6
  export * from "./interface.cjs";
5
7
  export * from "./notifications.cjs";
6
8
  export * from "./permitted/index.cjs";
7
9
  export * from "./request-user-approval.cjs";
10
+ export * from "./start-trace.cjs";
8
11
  export * from "./state.cjs";
12
+ export * from "./track-error.cjs";
13
+ export * from "./track-event.cjs";
9
14
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,0CAAsC;AACtC,mCAA+B;AAC/B,sCAAkC;AAClC,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,4BAAwB"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,0CAAsC;AACtC,mCAA+B;AAC/B,sCAAkC;AAClC,+BAA2B;AAC3B,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,kCAA8B;AAC9B,4BAAwB;AACxB,kCAA8B;AAC9B,kCAA8B"}
@@ -1,9 +1,14 @@
1
+ export * from "./end-trace.mjs";
1
2
  export * from "./get-entropy-sources.mjs";
2
3
  export * from "./get-mnemonic.mjs";
3
4
  export * from "./get-preferences.mjs";
5
+ export * from "./get-snap.mjs";
4
6
  export * from "./interface.mjs";
5
7
  export * from "./notifications.mjs";
6
8
  export * from "./permitted/index.mjs";
7
9
  export * from "./request-user-approval.mjs";
10
+ export * from "./start-trace.mjs";
8
11
  export * from "./state.mjs";
12
+ export * from "./track-error.mjs";
13
+ export * from "./track-event.mjs";
9
14
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,0CAAsC;AACtC,mCAA+B;AAC/B,sCAAkC;AAClC,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,4BAAwB"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,0CAAsC;AACtC,mCAA+B;AAC/B,sCAAkC;AAClC,+BAA2B;AAC3B,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,kCAA8B;AAC9B,4BAAwB;AACxB,kCAA8B;AAC9B,kCAA8B"}
@@ -1,9 +1,14 @@
1
+ export * from "./end-trace.mjs";
1
2
  export * from "./get-entropy-sources.mjs";
2
3
  export * from "./get-mnemonic.mjs";
3
4
  export * from "./get-preferences.mjs";
5
+ export * from "./get-snap.mjs";
4
6
  export * from "./interface.mjs";
5
7
  export * from "./notifications.mjs";
6
8
  export * from "./permitted/index.mjs";
7
9
  export * from "./request-user-approval.mjs";
10
+ export * from "./start-trace.mjs";
8
11
  export * from "./state.mjs";
12
+ export * from "./track-error.mjs";
13
+ export * from "./track-event.mjs";
9
14
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,0CAAsC;AACtC,mCAA+B;AAC/B,sCAAkC;AAClC,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,4BAAwB","sourcesContent":["export * from './get-entropy-sources';\nexport * from './get-mnemonic';\nexport * from './get-preferences';\nexport * from './interface';\nexport * from './notifications';\nexport * from './permitted';\nexport * from './request-user-approval';\nexport * from './state';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/index.ts"],"names":[],"mappings":"AAAA,gCAA4B;AAC5B,0CAAsC;AACtC,mCAA+B;AAC/B,sCAAkC;AAClC,+BAA2B;AAC3B,gCAA4B;AAC5B,oCAAgC;AAChC,sCAA4B;AAC5B,4CAAwC;AACxC,kCAA8B;AAC9B,4BAAwB;AACxB,kCAA8B;AAC9B,kCAA8B","sourcesContent":["export * from './end-trace';\nexport * from './get-entropy-sources';\nexport * from './get-mnemonic';\nexport * from './get-preferences';\nexport * from './get-snap';\nexport * from './interface';\nexport * from './notifications';\nexport * from './permitted';\nexport * from './request-user-approval';\nexport * from './start-trace';\nexport * from './state';\nexport * from './track-error';\nexport * from './track-event';\n"]}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStartTraceImplementation = void 0;
4
+ const effects_1 = require("redux-saga/effects");
5
+ const store_1 = require("../../store/index.cjs");
6
+ /**
7
+ * Start a performance trace.
8
+ *
9
+ * @param event - The performance trace to start.
10
+ * @returns `null`.
11
+ * @yields Adds the pending trace to the store.
12
+ */
13
+ function* startTraceImplementation(event) {
14
+ yield (0, effects_1.put)((0, store_1.startTrace)(event));
15
+ return {
16
+ /* eslint-disable @typescript-eslint/naming-convention */
17
+ _traceId: 'test-trace-id',
18
+ _spanId: 'test-span-id',
19
+ /* eslint-enable @typescript-eslint/naming-convention */
20
+ };
21
+ }
22
+ /**
23
+ * Get a method that can be used to start a performance trace.
24
+ *
25
+ * @param runSaga - A function to run a saga outside the usual Redux flow.
26
+ * @returns A method that can be used to start a performance trace.
27
+ */
28
+ function getStartTraceImplementation(runSaga) {
29
+ return (...args) => {
30
+ return runSaga(startTraceImplementation, ...args).result();
31
+ };
32
+ }
33
+ exports.getStartTraceImplementation = getStartTraceImplementation;
34
+ //# sourceMappingURL=start-trace.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-trace.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/start-trace.ts"],"names":[],"mappings":";;;AAEA,gDAAyC;AAGzC,iDAAyC;AAEzC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,wBAAwB,CAAC,KAAuB;IACxD,MAAM,IAAA,aAAG,EAAC,IAAA,kBAAU,EAAC,KAAK,CAAC,CAAC,CAAC;IAC7B,OAAO;QACL,yDAAyD;QACzD,QAAQ,EAAE,eAAe;QACzB,OAAO,EAAE,cAAc;QACvB,wDAAwD;KACzD,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,OAAwB;IAClE,OAAO,CAAC,GAAG,IAAiD,EAAE,EAAE;QAC9D,OAAO,OAAO,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC;AAJD,kEAIC","sourcesContent":["import type { StartTraceParams } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { startTrace } from '../../store';\n\n/**\n * Start a performance trace.\n *\n * @param event - The performance trace to start.\n * @returns `null`.\n * @yields Adds the pending trace to the store.\n */\nfunction* startTraceImplementation(event: StartTraceParams): SagaIterator {\n yield put(startTrace(event));\n return {\n /* eslint-disable @typescript-eslint/naming-convention */\n _traceId: 'test-trace-id',\n _spanId: 'test-span-id',\n /* eslint-enable @typescript-eslint/naming-convention */\n };\n}\n\n/**\n * Get a method that can be used to start a performance trace.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to start a performance trace.\n */\nexport function getStartTraceImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof startTraceImplementation>) => {\n return runSaga(startTraceImplementation, ...args).result();\n };\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { RunSagaFunction } from "../../store/index.cjs";
2
+ /**
3
+ * Get a method that can be used to start a performance trace.
4
+ *
5
+ * @param runSaga - A function to run a saga outside the usual Redux flow.
6
+ * @returns A method that can be used to start a performance trace.
7
+ */
8
+ export declare function getStartTraceImplementation(runSaga: RunSagaFunction): (event: import("@metamask/snaps-sdk").TraceRequest) => any;
9
+ //# sourceMappingURL=start-trace.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-trace.d.cts","sourceRoot":"","sources":["../../../src/methods/hooks/start-trace.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAoBnD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,eAAe,8DAInE"}
@@ -0,0 +1,9 @@
1
+ import type { RunSagaFunction } from "../../store/index.mjs";
2
+ /**
3
+ * Get a method that can be used to start a performance trace.
4
+ *
5
+ * @param runSaga - A function to run a saga outside the usual Redux flow.
6
+ * @returns A method that can be used to start a performance trace.
7
+ */
8
+ export declare function getStartTraceImplementation(runSaga: RunSagaFunction): (event: import("@metamask/snaps-sdk").TraceRequest) => any;
9
+ //# sourceMappingURL=start-trace.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-trace.d.mts","sourceRoot":"","sources":["../../../src/methods/hooks/start-trace.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,8BAAoB;AAoBnD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,eAAe,8DAInE"}
@@ -0,0 +1,30 @@
1
+ import { put } from "redux-saga/effects";
2
+ import { startTrace } from "../../store/index.mjs";
3
+ /**
4
+ * Start a performance trace.
5
+ *
6
+ * @param event - The performance trace to start.
7
+ * @returns `null`.
8
+ * @yields Adds the pending trace to the store.
9
+ */
10
+ function* startTraceImplementation(event) {
11
+ yield put(startTrace(event));
12
+ return {
13
+ /* eslint-disable @typescript-eslint/naming-convention */
14
+ _traceId: 'test-trace-id',
15
+ _spanId: 'test-span-id',
16
+ /* eslint-enable @typescript-eslint/naming-convention */
17
+ };
18
+ }
19
+ /**
20
+ * Get a method that can be used to start a performance trace.
21
+ *
22
+ * @param runSaga - A function to run a saga outside the usual Redux flow.
23
+ * @returns A method that can be used to start a performance trace.
24
+ */
25
+ export function getStartTraceImplementation(runSaga) {
26
+ return (...args) => {
27
+ return runSaga(startTraceImplementation, ...args).result();
28
+ };
29
+ }
30
+ //# sourceMappingURL=start-trace.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-trace.mjs","sourceRoot":"","sources":["../../../src/methods/hooks/start-trace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,2BAA2B;AAGzC,OAAO,EAAE,UAAU,EAAE,8BAAoB;AAEzC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,wBAAwB,CAAC,KAAuB;IACxD,MAAM,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7B,OAAO;QACL,yDAAyD;QACzD,QAAQ,EAAE,eAAe;QACzB,OAAO,EAAE,cAAc;QACvB,wDAAwD;KACzD,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAAwB;IAClE,OAAO,CAAC,GAAG,IAAiD,EAAE,EAAE;QAC9D,OAAO,OAAO,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { StartTraceParams } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { startTrace } from '../../store';\n\n/**\n * Start a performance trace.\n *\n * @param event - The performance trace to start.\n * @returns `null`.\n * @yields Adds the pending trace to the store.\n */\nfunction* startTraceImplementation(event: StartTraceParams): SagaIterator {\n yield put(startTrace(event));\n return {\n /* eslint-disable @typescript-eslint/naming-convention */\n _traceId: 'test-trace-id',\n _spanId: 'test-span-id',\n /* eslint-enable @typescript-eslint/naming-convention */\n };\n}\n\n/**\n * Get a method that can be used to start a performance trace.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to start a performance trace.\n */\nexport function getStartTraceImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof startTraceImplementation>) => {\n return runSaga(startTraceImplementation, ...args).result();\n };\n}\n"]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTrackErrorImplementation = void 0;
4
+ const snaps_sdk_1 = require("@metamask/snaps-sdk");
5
+ const effects_1 = require("redux-saga/effects");
6
+ const store_1 = require("../../store/index.cjs");
7
+ /**
8
+ * Track an error.
9
+ *
10
+ * @param error - The error to track.
11
+ * @returns `null`.
12
+ * @yields Adds the error to the store.
13
+ */
14
+ function* trackErrorImplementation(error) {
15
+ const serialisedError = (0, snaps_sdk_1.getJsonError)(error);
16
+ yield (0, effects_1.put)((0, store_1.trackError)(serialisedError));
17
+ return null;
18
+ }
19
+ /**
20
+ * Get a method that can be used to track an error.
21
+ *
22
+ * @param runSaga - A function to run a saga outside the usual Redux flow.
23
+ * @returns A method that can be used to track an error.
24
+ */
25
+ function getTrackErrorImplementation(runSaga) {
26
+ return (...args) => {
27
+ return runSaga(trackErrorImplementation, ...args).result();
28
+ };
29
+ }
30
+ exports.getTrackErrorImplementation = getTrackErrorImplementation;
31
+ //# sourceMappingURL=track-error.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"track-error.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/track-error.ts"],"names":[],"mappings":";;;AAAA,mDAAmD;AAEnD,gDAAyC;AAGzC,iDAAyC;AAEzC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,wBAAwB,CAAC,KAAY;IAC7C,MAAM,eAAe,GAAG,IAAA,wBAAY,EAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,IAAA,aAAG,EAAC,IAAA,kBAAU,EAAC,eAAe,CAAC,CAAC,CAAC;IACvC,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,OAAwB;IAClE,OAAO,CAAC,GAAG,IAAiD,EAAE,EAAE;QAC9D,OAAO,OAAO,CAAC,wBAAwB,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC;AAJD,kEAIC","sourcesContent":["import { getJsonError } from '@metamask/snaps-sdk';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport type { RunSagaFunction } from '../../store';\nimport { trackError } from '../../store';\n\n/**\n * Track an error.\n *\n * @param error - The error to track.\n * @returns `null`.\n * @yields Adds the error to the store.\n */\nfunction* trackErrorImplementation(error: Error): SagaIterator {\n const serialisedError = getJsonError(error);\n yield put(trackError(serialisedError));\n return null;\n}\n\n/**\n * Get a method that can be used to track an error.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to track an error.\n */\nexport function getTrackErrorImplementation(runSaga: RunSagaFunction) {\n return (...args: Parameters<typeof trackErrorImplementation>) => {\n return runSaga(trackErrorImplementation, ...args).result();\n };\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { RunSagaFunction } from "../../store/index.cjs";
2
+ /**
3
+ * Get a method that can be used to track an error.
4
+ *
5
+ * @param runSaga - A function to run a saga outside the usual Redux flow.
6
+ * @returns A method that can be used to track an error.
7
+ */
8
+ export declare function getTrackErrorImplementation(runSaga: RunSagaFunction): (error: Error) => any;
9
+ //# sourceMappingURL=track-error.d.cts.map