@metamask/snaps-sdk 8.0.0 → 9.0.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 (122) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/dist/error-wrappers.d.cts +192 -192
  3. package/dist/error-wrappers.d.mts +192 -192
  4. package/dist/errors.cjs +53 -1
  5. package/dist/errors.cjs.map +1 -1
  6. package/dist/errors.d.cts +24 -0
  7. package/dist/errors.d.cts.map +1 -1
  8. package/dist/errors.d.mts +24 -0
  9. package/dist/errors.d.mts.map +1 -1
  10. package/dist/errors.mjs +52 -1
  11. package/dist/errors.mjs.map +1 -1
  12. package/dist/internals/error-wrappers.d.cts +12 -12
  13. package/dist/internals/error-wrappers.d.mts +12 -12
  14. package/dist/internals/errors.cjs +67 -25
  15. package/dist/internals/errors.cjs.map +1 -1
  16. package/dist/internals/errors.d.cts +19 -4
  17. package/dist/internals/errors.d.cts.map +1 -1
  18. package/dist/internals/errors.d.mts +19 -4
  19. package/dist/internals/errors.d.mts.map +1 -1
  20. package/dist/internals/errors.mjs +64 -24
  21. package/dist/internals/errors.mjs.map +1 -1
  22. package/dist/jsx/validation.d.cts +3 -3
  23. package/dist/jsx/validation.d.mts +3 -3
  24. package/dist/types/handlers/assets-conversion.cjs.map +1 -1
  25. package/dist/types/handlers/assets-conversion.d.cts +0 -25
  26. package/dist/types/handlers/assets-conversion.d.cts.map +1 -1
  27. package/dist/types/handlers/assets-conversion.d.mts +0 -25
  28. package/dist/types/handlers/assets-conversion.d.mts.map +1 -1
  29. package/dist/types/handlers/assets-conversion.mjs.map +1 -1
  30. package/dist/types/handlers/assets-market-data.cjs +3 -0
  31. package/dist/types/handlers/assets-market-data.cjs.map +1 -0
  32. package/dist/types/handlers/assets-market-data.d.cts +56 -0
  33. package/dist/types/handlers/assets-market-data.d.cts.map +1 -0
  34. package/dist/types/handlers/assets-market-data.d.mts +56 -0
  35. package/dist/types/handlers/assets-market-data.d.mts.map +1 -0
  36. package/dist/types/handlers/assets-market-data.mjs +2 -0
  37. package/dist/types/handlers/assets-market-data.mjs.map +1 -0
  38. package/dist/types/handlers/index.cjs.map +1 -1
  39. package/dist/types/handlers/index.d.cts +2 -0
  40. package/dist/types/handlers/index.d.cts.map +1 -1
  41. package/dist/types/handlers/index.d.mts +2 -0
  42. package/dist/types/handlers/index.d.mts.map +1 -1
  43. package/dist/types/handlers/index.mjs.map +1 -1
  44. package/dist/types/handlers/lifecycle.cjs.map +1 -1
  45. package/dist/types/handlers/lifecycle.d.cts +12 -0
  46. package/dist/types/handlers/lifecycle.d.cts.map +1 -1
  47. package/dist/types/handlers/lifecycle.d.mts +12 -0
  48. package/dist/types/handlers/lifecycle.d.mts.map +1 -1
  49. package/dist/types/handlers/lifecycle.mjs.map +1 -1
  50. package/dist/types/handlers/user-input.d.cts +6 -6
  51. package/dist/types/handlers/user-input.d.mts +6 -6
  52. package/dist/types/handlers/web-socket-event.cjs +3 -0
  53. package/dist/types/handlers/web-socket-event.cjs.map +1 -0
  54. package/dist/types/handlers/web-socket-event.d.cts +78 -0
  55. package/dist/types/handlers/web-socket-event.d.cts.map +1 -0
  56. package/dist/types/handlers/web-socket-event.d.mts +78 -0
  57. package/dist/types/handlers/web-socket-event.d.mts.map +1 -0
  58. package/dist/types/handlers/web-socket-event.mjs +2 -0
  59. package/dist/types/handlers/web-socket-event.mjs.map +1 -0
  60. package/dist/types/interface.d.cts +5 -5
  61. package/dist/types/interface.d.mts +5 -5
  62. package/dist/types/methods/close-web-socket.cjs +3 -0
  63. package/dist/types/methods/close-web-socket.cjs.map +1 -0
  64. package/dist/types/methods/close-web-socket.d.cts +13 -0
  65. package/dist/types/methods/close-web-socket.d.cts.map +1 -0
  66. package/dist/types/methods/close-web-socket.d.mts +13 -0
  67. package/dist/types/methods/close-web-socket.d.mts.map +1 -0
  68. package/dist/types/methods/close-web-socket.mjs +2 -0
  69. package/dist/types/methods/close-web-socket.mjs.map +1 -0
  70. package/dist/types/methods/get-web-sockets.cjs +3 -0
  71. package/dist/types/methods/get-web-sockets.cjs.map +1 -0
  72. package/dist/types/methods/get-web-sockets.d.cts +15 -0
  73. package/dist/types/methods/get-web-sockets.d.cts.map +1 -0
  74. package/dist/types/methods/get-web-sockets.d.mts +15 -0
  75. package/dist/types/methods/get-web-sockets.d.mts.map +1 -0
  76. package/dist/types/methods/get-web-sockets.mjs +2 -0
  77. package/dist/types/methods/get-web-sockets.mjs.map +1 -0
  78. package/dist/types/methods/index.cjs.map +1 -1
  79. package/dist/types/methods/index.d.cts +5 -0
  80. package/dist/types/methods/index.d.cts.map +1 -1
  81. package/dist/types/methods/index.d.mts +5 -0
  82. package/dist/types/methods/index.d.mts.map +1 -1
  83. package/dist/types/methods/index.mjs.map +1 -1
  84. package/dist/types/methods/methods.cjs.map +1 -1
  85. package/dist/types/methods/methods.d.cts +13 -0
  86. package/dist/types/methods/methods.d.cts.map +1 -1
  87. package/dist/types/methods/methods.d.mts +13 -0
  88. package/dist/types/methods/methods.d.mts.map +1 -1
  89. package/dist/types/methods/methods.mjs.map +1 -1
  90. package/dist/types/methods/open-web-socket.cjs +3 -0
  91. package/dist/types/methods/open-web-socket.cjs.map +1 -0
  92. package/dist/types/methods/open-web-socket.d.cts +15 -0
  93. package/dist/types/methods/open-web-socket.d.cts.map +1 -0
  94. package/dist/types/methods/open-web-socket.d.mts +15 -0
  95. package/dist/types/methods/open-web-socket.d.mts.map +1 -0
  96. package/dist/types/methods/open-web-socket.mjs +2 -0
  97. package/dist/types/methods/open-web-socket.mjs.map +1 -0
  98. package/dist/types/methods/send-web-socket-message.cjs +3 -0
  99. package/dist/types/methods/send-web-socket-message.cjs.map +1 -0
  100. package/dist/types/methods/send-web-socket-message.d.cts +15 -0
  101. package/dist/types/methods/send-web-socket-message.d.cts.map +1 -0
  102. package/dist/types/methods/send-web-socket-message.d.mts +15 -0
  103. package/dist/types/methods/send-web-socket-message.d.mts.map +1 -0
  104. package/dist/types/methods/send-web-socket-message.mjs +2 -0
  105. package/dist/types/methods/send-web-socket-message.mjs.map +1 -0
  106. package/dist/types/methods/track-error.cjs +3 -0
  107. package/dist/types/methods/track-error.cjs.map +1 -0
  108. package/dist/types/methods/track-error.d.cts +41 -0
  109. package/dist/types/methods/track-error.d.cts.map +1 -0
  110. package/dist/types/methods/track-error.d.mts +41 -0
  111. package/dist/types/methods/track-error.d.mts.map +1 -0
  112. package/dist/types/methods/track-error.mjs +2 -0
  113. package/dist/types/methods/track-error.mjs.map +1 -0
  114. package/dist/ui/components/button.d.cts +3 -3
  115. package/dist/ui/components/button.d.mts +3 -3
  116. package/dist/ui/components/form.d.cts +17 -17
  117. package/dist/ui/components/form.d.mts +17 -17
  118. package/dist/ui/components/input.d.cts +3 -3
  119. package/dist/ui/components/input.d.mts +3 -3
  120. package/dist/ui/components/panel.d.cts +25 -25
  121. package/dist/ui/components/panel.d.mts +25 -25
  122. package/package.json +2 -2
@@ -1,6 +1,41 @@
1
1
  import { hasProperty, isObject, isValidJson } from "@metamask/utils";
2
2
  export const SNAP_ERROR_CODE = -31002;
3
3
  export const SNAP_ERROR_MESSAGE = 'Snap Error';
4
+ /**
5
+ * Get a property from an object, or return a fallback value if the property
6
+ * does not exist.
7
+ *
8
+ * @param object - The object to get the property from.
9
+ * @param property - The property to get from the object.
10
+ * @param fallback - The fallback value to return if the property does not
11
+ * exist.
12
+ * @returns The value of the property if it exists, or the fallback value if
13
+ * the property does not exist.
14
+ */
15
+ function getObjectProperty(object, property, fallback = null) {
16
+ if (isObject(object) && hasProperty(object, property)) {
17
+ return object[property];
18
+ }
19
+ return fallback;
20
+ }
21
+ /**
22
+ * Get a string property from an object, or convert the object to a string
23
+ * if the property does not exist or is not a string.
24
+ *
25
+ * @param object - The object to get the property from.
26
+ * @param property - The property to get from the object.
27
+ * @param fallback - The fallback value to return if the property does not exist
28
+ * or is not a string. Defaults to the string representation of the object.
29
+ * @returns The value of the property if it exists and is a string, or the
30
+ * fallback value if it does not exist or is not a string.
31
+ */
32
+ function getObjectStringProperty(object, property, fallback = String(object)) {
33
+ const value = getObjectProperty(object, property);
34
+ if (typeof value === 'string') {
35
+ return value;
36
+ }
37
+ return fallback;
38
+ }
4
39
  /**
5
40
  * Get the error message from an unknown error type.
6
41
  *
@@ -12,12 +47,7 @@ export const SNAP_ERROR_MESSAGE = 'Snap Error';
12
47
  * @internal
13
48
  */
14
49
  export function getErrorMessage(error) {
15
- if (isObject(error) &&
16
- hasProperty(error, 'message') &&
17
- typeof error.message === 'string') {
18
- return error.message;
19
- }
20
- return String(error);
50
+ return getObjectStringProperty(error, 'message');
21
51
  }
22
52
  /**
23
53
  * Get the error stack from an unknown error type.
@@ -28,12 +58,18 @@ export function getErrorMessage(error) {
28
58
  * @internal
29
59
  */
30
60
  export function getErrorStack(error) {
31
- if (isObject(error) &&
32
- hasProperty(error, 'stack') &&
33
- typeof error.stack === 'string') {
34
- return error.stack;
35
- }
36
- return undefined;
61
+ return getObjectStringProperty(error, 'stack', null);
62
+ }
63
+ /**
64
+ * Get the error name from an unknown error type.
65
+ *
66
+ * @param error - The error to get the name from.
67
+ * @returns The error name, or `'Error'` if the error does not have a valid
68
+ * name.
69
+ */
70
+ export function getErrorName(error) {
71
+ const fallbackName = error instanceof Error ? error.name : 'Error';
72
+ return getObjectStringProperty(error, 'name', fallbackName);
37
73
  }
38
74
  /**
39
75
  * Get the error code from an unknown error type.
@@ -43,14 +79,22 @@ export function getErrorStack(error) {
43
79
  * @internal
44
80
  */
45
81
  export function getErrorCode(error) {
46
- if (isObject(error) &&
47
- hasProperty(error, 'code') &&
48
- typeof error.code === 'number' &&
49
- Number.isInteger(error.code)) {
50
- return error.code;
82
+ const value = getObjectProperty(error, 'code');
83
+ if (typeof value === 'number' && Number.isInteger(value)) {
84
+ return value;
51
85
  }
52
86
  return -32603;
53
87
  }
88
+ /**
89
+ * Get the error cause from an unknown error type.
90
+ *
91
+ * @param error - The error to get the cause from.
92
+ * @returns The error cause, or `null` if the error does not have a valid
93
+ * cause.
94
+ */
95
+ export function getErrorCause(error) {
96
+ return getObjectProperty(error, 'cause');
97
+ }
54
98
  /**
55
99
  * Get the error data from an unknown error type.
56
100
  *
@@ -60,13 +104,9 @@ export function getErrorCode(error) {
60
104
  * @internal
61
105
  */
62
106
  export function getErrorData(error) {
63
- if (isObject(error) &&
64
- hasProperty(error, 'data') &&
65
- typeof error.data === 'object' &&
66
- error.data !== null &&
67
- isValidJson(error.data) &&
68
- !Array.isArray(error.data)) {
69
- return error.data;
107
+ const value = getObjectProperty(error, 'data');
108
+ if (value !== null && isValidJson(value) && !Array.isArray(value)) {
109
+ return value;
70
110
  }
71
111
  return {};
72
112
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errors.mjs","sourceRoot":"","sources":["../../src/internals/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB;AAErE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,CAAC;AACtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAE/C;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IACE,QAAQ,CAAC,KAAK,CAAC;QACf,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC;QAC7B,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EACjC,CAAC;QACD,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IACE,QAAQ,CAAC,KAAK,CAAC;QACf,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC;QAC3B,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,EAC/B,CAAC;QACD,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,IACE,QAAQ,CAAC,KAAK,CAAC;QACf,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC;QAC1B,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAC5B,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC;IACpB,CAAC;IAED,OAAO,CAAC,KAAK,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,IACE,QAAQ,CAAC,KAAK,CAAC;QACf,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC;QAC1B,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,KAAK,CAAC,IAAI,KAAK,IAAI;QACnB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;QACvB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAC1B,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC;IACpB,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n"]}
1
+ {"version":3,"file":"errors.mjs","sourceRoot":"","sources":["../../src/internals/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB;AAErE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,CAAC;AACtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,SAAS,iBAAiB,CACxB,MAAe,EACf,QAAgB,EAChB,WAAqB,IAAgB;IAErC,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC;QACtD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,uBAAuB,CAC9B,MAAe,EACf,QAAgB,EAChB,WAAqB,MAAM,CAAC,MAAM,CAAa;IAE/C,MAAM,KAAK,GAAG,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,uBAAuB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;IACnE,OAAO,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CAAC,KAAK,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC/C,IAAI,KAAK,KAAK,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAClE,OAAO,KAA6B,CAAC;IACvC,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import type { Json } from '@metamask/utils';\nimport { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get a property from an object, or return a fallback value if the property\n * does not exist.\n *\n * @param object - The object to get the property from.\n * @param property - The property to get from the object.\n * @param fallback - The fallback value to return if the property does not\n * exist.\n * @returns The value of the property if it exists, or the fallback value if\n * the property does not exist.\n */\nfunction getObjectProperty<Fallback = null>(\n object: unknown,\n property: string,\n fallback: Fallback = null as Fallback,\n): unknown {\n if (isObject(object) && hasProperty(object, property)) {\n return object[property];\n }\n\n return fallback;\n}\n\n/**\n * Get a string property from an object, or convert the object to a string\n * if the property does not exist or is not a string.\n *\n * @param object - The object to get the property from.\n * @param property - The property to get from the object.\n * @param fallback - The fallback value to return if the property does not exist\n * or is not a string. Defaults to the string representation of the object.\n * @returns The value of the property if it exists and is a string, or the\n * fallback value if it does not exist or is not a string.\n */\nfunction getObjectStringProperty<Fallback = string>(\n object: unknown,\n property: string,\n fallback: Fallback = String(object) as Fallback,\n): string | Fallback {\n const value = getObjectProperty(object, property);\n if (typeof value === 'string') {\n return value;\n }\n\n return fallback;\n}\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n return getObjectStringProperty(error, 'message');\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n return getObjectStringProperty(error, 'stack', null);\n}\n\n/**\n * Get the error name from an unknown error type.\n *\n * @param error - The error to get the name from.\n * @returns The error name, or `'Error'` if the error does not have a valid\n * name.\n */\nexport function getErrorName(error: unknown) {\n const fallbackName = error instanceof Error ? error.name : 'Error';\n return getObjectStringProperty(error, 'name', fallbackName);\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n const value = getObjectProperty(error, 'code');\n if (typeof value === 'number' && Number.isInteger(value)) {\n return value;\n }\n\n return -32603;\n}\n\n/**\n * Get the error cause from an unknown error type.\n *\n * @param error - The error to get the cause from.\n * @returns The error cause, or `null` if the error does not have a valid\n * cause.\n */\nexport function getErrorCause(error: unknown) {\n return getObjectProperty(error, 'cause');\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n const value = getObjectProperty(error, 'data');\n if (value !== null && isValidJson(value) && !Array.isArray(value)) {\n return value as Record<string, Json>;\n }\n\n return {};\n}\n"]}
@@ -52,8 +52,8 @@ export declare const GenericInputPropsStruct: Struct<{
52
52
  * A struct for the text type input props.
53
53
  */
54
54
  export declare const TextInputPropsStruct: Struct<{
55
- name: string;
56
55
  type: "text";
56
+ name: string;
57
57
  value?: string | undefined;
58
58
  placeholder?: string | undefined;
59
59
  disabled?: boolean | undefined;
@@ -68,8 +68,8 @@ export declare const TextInputPropsStruct: Struct<{
68
68
  * A struct for the password type input props.
69
69
  */
70
70
  export declare const PasswordInputPropsStruct: Struct<{
71
- name: string;
72
71
  type: "password";
72
+ name: string;
73
73
  value?: string | undefined;
74
74
  placeholder?: string | undefined;
75
75
  disabled?: boolean | undefined;
@@ -84,8 +84,8 @@ export declare const PasswordInputPropsStruct: Struct<{
84
84
  * A struct for the number type input props.
85
85
  */
86
86
  export declare const NumberInputPropsStruct: Struct<{
87
- name: string;
88
87
  type: "number";
88
+ name: string;
89
89
  value?: string | undefined;
90
90
  placeholder?: string | undefined;
91
91
  disabled?: boolean | undefined;
@@ -52,8 +52,8 @@ export declare const GenericInputPropsStruct: Struct<{
52
52
  * A struct for the text type input props.
53
53
  */
54
54
  export declare const TextInputPropsStruct: Struct<{
55
- name: string;
56
55
  type: "text";
56
+ name: string;
57
57
  value?: string | undefined;
58
58
  placeholder?: string | undefined;
59
59
  disabled?: boolean | undefined;
@@ -68,8 +68,8 @@ export declare const TextInputPropsStruct: Struct<{
68
68
  * A struct for the password type input props.
69
69
  */
70
70
  export declare const PasswordInputPropsStruct: Struct<{
71
- name: string;
72
71
  type: "password";
72
+ name: string;
73
73
  value?: string | undefined;
74
74
  placeholder?: string | undefined;
75
75
  disabled?: boolean | undefined;
@@ -84,8 +84,8 @@ export declare const PasswordInputPropsStruct: Struct<{
84
84
  * A struct for the number type input props.
85
85
  */
86
86
  export declare const NumberInputPropsStruct: Struct<{
87
- name: string;
88
87
  type: "number";
88
+ name: string;
89
89
  value?: string | undefined;
90
90
  placeholder?: string | undefined;
91
91
  disabled?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"assets-conversion.cjs","sourceRoot":"","sources":["../../../src/types/handlers/assets-conversion.ts"],"names":[],"mappings":"","sourcesContent":["import { type CaipAssetType } from '@metamask/utils';\n\n/**\n * The market data for an asset.\n *\n * @property marketCap - The market capitalization of the asset.\n * @property totalVolume - The total volume of the asset.\n * @property circulatingSupply - The circulating supply of the asset.\n * @property allTimeHigh - The all-time high price of the asset.\n * @property allTimeLow - The all-time low price of the asset.\n * @property pricePercentChange - The percentage change in price over different intervals.\n * @property pricePercentChange.interval - The time interval for the price change as a ISO 8601 duration\n * or the string \"all\" to represent the all-time change.\n */\nexport type MarketData = {\n marketCap: string;\n totalVolume: string;\n circulatingSupply: string;\n allTimeHigh: string;\n allTimeLow: string;\n pricePercentChange: {\n [interval: string]: number;\n };\n};\n\n/**\n * The conversion rate between two assets.\n *\n * @property rate - The conversion rate between the two assets.\n * @property marketData - The market data for the asset, if requested.\n * @property conversionTime - The time at which the conversion rate was calculated.\n * @property expirationTime - The time at which the conversion rate expires.\n */\nexport type AssetConversion = {\n rate: string;\n marketData?: MarketData;\n conversionTime: number;\n expirationTime?: number;\n};\n\n/**\n * The arguments for the `onAssetsConversion` handler.\n *\n * @property conversions - An array of objects containing the `from` and `to` asset types.\n * @property includeMarketData - Whether to include market data in the response.\n */\nexport type OnAssetsConversionArguments = {\n conversions: { from: CaipAssetType; to: CaipAssetType }[];\n includeMarketData?: boolean;\n};\n\n/**\n * The `onAssetsConversion` handler. This is called by MetaMask when querying about asset conversion on specific chains.\n *\n * @param args - The arguments for the handler.\n * see {@link OnAssetsConversionArguments}.\n * @returns The conversion for each asset. See\n * {@link OnAssetsConversionResponse}.\n */\nexport type OnAssetsConversionHandler = (\n args: OnAssetsConversionArguments,\n) => Promise<OnAssetsConversionResponse>;\n\n/**\n * The response from the conversion query, containing rates about each requested asset pair.\n *\n * @property conversionRates - A nested object with two CAIP-19 keys that contains a conversion rate or null between the two keys.\n */\nexport type OnAssetsConversionResponse = {\n conversionRates: Record<\n CaipAssetType,\n Record<CaipAssetType, AssetConversion | null>\n >;\n};\n"]}
1
+ {"version":3,"file":"assets-conversion.cjs","sourceRoot":"","sources":["../../../src/types/handlers/assets-conversion.ts"],"names":[],"mappings":"","sourcesContent":["import { type CaipAssetType } from '@metamask/utils';\n/**\n * The conversion rate between two assets.\n *\n * @property rate - The conversion rate between the two assets.\n * @property conversionTime - The time at which the conversion rate was calculated.\n * @property expirationTime - The time at which the conversion rate expires.\n */\nexport type AssetConversion = {\n rate: string;\n conversionTime: number;\n expirationTime?: number;\n};\n\n/**\n * The arguments for the `onAssetsConversion` handler.\n *\n * @property conversions - An array of objects containing the `from` and `to` asset types.\n * @property includeMarketData - Whether to include market data in the response.\n */\nexport type OnAssetsConversionArguments = {\n conversions: { from: CaipAssetType; to: CaipAssetType }[];\n};\n\n/**\n * The `onAssetsConversion` handler. This is called by MetaMask when querying about asset conversion on specific chains.\n *\n * @param args - The arguments for the handler.\n * see {@link OnAssetsConversionArguments}.\n * @returns The conversion for each asset. See\n * {@link OnAssetsConversionResponse}.\n */\nexport type OnAssetsConversionHandler = (\n args: OnAssetsConversionArguments,\n) => Promise<OnAssetsConversionResponse>;\n\n/**\n * The response from the conversion query, containing rates about each requested asset pair.\n *\n * @property conversionRates - A nested object with two CAIP-19 keys that contains a conversion rate or null between the two keys.\n */\nexport type OnAssetsConversionResponse = {\n conversionRates: Record<\n CaipAssetType,\n Record<CaipAssetType, AssetConversion | null>\n >;\n};\n"]}
@@ -1,37 +1,13 @@
1
1
  import { type CaipAssetType } from "@metamask/utils";
2
- /**
3
- * The market data for an asset.
4
- *
5
- * @property marketCap - The market capitalization of the asset.
6
- * @property totalVolume - The total volume of the asset.
7
- * @property circulatingSupply - The circulating supply of the asset.
8
- * @property allTimeHigh - The all-time high price of the asset.
9
- * @property allTimeLow - The all-time low price of the asset.
10
- * @property pricePercentChange - The percentage change in price over different intervals.
11
- * @property pricePercentChange.interval - The time interval for the price change as a ISO 8601 duration
12
- * or the string "all" to represent the all-time change.
13
- */
14
- export type MarketData = {
15
- marketCap: string;
16
- totalVolume: string;
17
- circulatingSupply: string;
18
- allTimeHigh: string;
19
- allTimeLow: string;
20
- pricePercentChange: {
21
- [interval: string]: number;
22
- };
23
- };
24
2
  /**
25
3
  * The conversion rate between two assets.
26
4
  *
27
5
  * @property rate - The conversion rate between the two assets.
28
- * @property marketData - The market data for the asset, if requested.
29
6
  * @property conversionTime - The time at which the conversion rate was calculated.
30
7
  * @property expirationTime - The time at which the conversion rate expires.
31
8
  */
32
9
  export type AssetConversion = {
33
10
  rate: string;
34
- marketData?: MarketData;
35
11
  conversionTime: number;
36
12
  expirationTime?: number;
37
13
  };
@@ -46,7 +22,6 @@ export type OnAssetsConversionArguments = {
46
22
  from: CaipAssetType;
47
23
  to: CaipAssetType;
48
24
  }[];
49
- includeMarketData?: boolean;
50
25
  };
51
26
  /**
52
27
  * The `onAssetsConversion` handler. This is called by MetaMask when querying about asset conversion on specific chains.
@@ -1 +1 @@
1
- {"version":3,"file":"assets-conversion.d.cts","sourceRoot":"","sources":["../../../src/types/handlers/assets-conversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,wBAAwB;AAErD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE;QAClB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;KAC5B,CAAC;CACH,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,EAAE;QAAE,IAAI,EAAE,aAAa,CAAC;QAAC,EAAE,EAAE,aAAa,CAAA;KAAE,EAAE,CAAC;IAC1D,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACtC,IAAI,EAAE,2BAA2B,KAC9B,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,eAAe,EAAE,MAAM,CACrB,aAAa,EACb,MAAM,CAAC,aAAa,EAAE,eAAe,GAAG,IAAI,CAAC,CAC9C,CAAC;CACH,CAAC"}
1
+ {"version":3,"file":"assets-conversion.d.cts","sourceRoot":"","sources":["../../../src/types/handlers/assets-conversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,wBAAwB;AACrD;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,EAAE;QAAE,IAAI,EAAE,aAAa,CAAC;QAAC,EAAE,EAAE,aAAa,CAAA;KAAE,EAAE,CAAC;CAC3D,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACtC,IAAI,EAAE,2BAA2B,KAC9B,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,eAAe,EAAE,MAAM,CACrB,aAAa,EACb,MAAM,CAAC,aAAa,EAAE,eAAe,GAAG,IAAI,CAAC,CAC9C,CAAC;CACH,CAAC"}
@@ -1,37 +1,13 @@
1
1
  import { type CaipAssetType } from "@metamask/utils";
2
- /**
3
- * The market data for an asset.
4
- *
5
- * @property marketCap - The market capitalization of the asset.
6
- * @property totalVolume - The total volume of the asset.
7
- * @property circulatingSupply - The circulating supply of the asset.
8
- * @property allTimeHigh - The all-time high price of the asset.
9
- * @property allTimeLow - The all-time low price of the asset.
10
- * @property pricePercentChange - The percentage change in price over different intervals.
11
- * @property pricePercentChange.interval - The time interval for the price change as a ISO 8601 duration
12
- * or the string "all" to represent the all-time change.
13
- */
14
- export type MarketData = {
15
- marketCap: string;
16
- totalVolume: string;
17
- circulatingSupply: string;
18
- allTimeHigh: string;
19
- allTimeLow: string;
20
- pricePercentChange: {
21
- [interval: string]: number;
22
- };
23
- };
24
2
  /**
25
3
  * The conversion rate between two assets.
26
4
  *
27
5
  * @property rate - The conversion rate between the two assets.
28
- * @property marketData - The market data for the asset, if requested.
29
6
  * @property conversionTime - The time at which the conversion rate was calculated.
30
7
  * @property expirationTime - The time at which the conversion rate expires.
31
8
  */
32
9
  export type AssetConversion = {
33
10
  rate: string;
34
- marketData?: MarketData;
35
11
  conversionTime: number;
36
12
  expirationTime?: number;
37
13
  };
@@ -46,7 +22,6 @@ export type OnAssetsConversionArguments = {
46
22
  from: CaipAssetType;
47
23
  to: CaipAssetType;
48
24
  }[];
49
- includeMarketData?: boolean;
50
25
  };
51
26
  /**
52
27
  * The `onAssetsConversion` handler. This is called by MetaMask when querying about asset conversion on specific chains.
@@ -1 +1 @@
1
- {"version":3,"file":"assets-conversion.d.mts","sourceRoot":"","sources":["../../../src/types/handlers/assets-conversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,wBAAwB;AAErD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE;QAClB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;KAC5B,CAAC;CACH,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,EAAE;QAAE,IAAI,EAAE,aAAa,CAAC;QAAC,EAAE,EAAE,aAAa,CAAA;KAAE,EAAE,CAAC;IAC1D,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACtC,IAAI,EAAE,2BAA2B,KAC9B,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,eAAe,EAAE,MAAM,CACrB,aAAa,EACb,MAAM,CAAC,aAAa,EAAE,eAAe,GAAG,IAAI,CAAC,CAC9C,CAAC;CACH,CAAC"}
1
+ {"version":3,"file":"assets-conversion.d.mts","sourceRoot":"","sources":["../../../src/types/handlers/assets-conversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,wBAAwB;AACrD;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,EAAE;QAAE,IAAI,EAAE,aAAa,CAAC;QAAC,EAAE,EAAE,aAAa,CAAA;KAAE,EAAE,CAAC;CAC3D,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACtC,IAAI,EAAE,2BAA2B,KAC9B,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,eAAe,EAAE,MAAM,CACrB,aAAa,EACb,MAAM,CAAC,aAAa,EAAE,eAAe,GAAG,IAAI,CAAC,CAC9C,CAAC;CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"assets-conversion.mjs","sourceRoot":"","sources":["../../../src/types/handlers/assets-conversion.ts"],"names":[],"mappings":"","sourcesContent":["import { type CaipAssetType } from '@metamask/utils';\n\n/**\n * The market data for an asset.\n *\n * @property marketCap - The market capitalization of the asset.\n * @property totalVolume - The total volume of the asset.\n * @property circulatingSupply - The circulating supply of the asset.\n * @property allTimeHigh - The all-time high price of the asset.\n * @property allTimeLow - The all-time low price of the asset.\n * @property pricePercentChange - The percentage change in price over different intervals.\n * @property pricePercentChange.interval - The time interval for the price change as a ISO 8601 duration\n * or the string \"all\" to represent the all-time change.\n */\nexport type MarketData = {\n marketCap: string;\n totalVolume: string;\n circulatingSupply: string;\n allTimeHigh: string;\n allTimeLow: string;\n pricePercentChange: {\n [interval: string]: number;\n };\n};\n\n/**\n * The conversion rate between two assets.\n *\n * @property rate - The conversion rate between the two assets.\n * @property marketData - The market data for the asset, if requested.\n * @property conversionTime - The time at which the conversion rate was calculated.\n * @property expirationTime - The time at which the conversion rate expires.\n */\nexport type AssetConversion = {\n rate: string;\n marketData?: MarketData;\n conversionTime: number;\n expirationTime?: number;\n};\n\n/**\n * The arguments for the `onAssetsConversion` handler.\n *\n * @property conversions - An array of objects containing the `from` and `to` asset types.\n * @property includeMarketData - Whether to include market data in the response.\n */\nexport type OnAssetsConversionArguments = {\n conversions: { from: CaipAssetType; to: CaipAssetType }[];\n includeMarketData?: boolean;\n};\n\n/**\n * The `onAssetsConversion` handler. This is called by MetaMask when querying about asset conversion on specific chains.\n *\n * @param args - The arguments for the handler.\n * see {@link OnAssetsConversionArguments}.\n * @returns The conversion for each asset. See\n * {@link OnAssetsConversionResponse}.\n */\nexport type OnAssetsConversionHandler = (\n args: OnAssetsConversionArguments,\n) => Promise<OnAssetsConversionResponse>;\n\n/**\n * The response from the conversion query, containing rates about each requested asset pair.\n *\n * @property conversionRates - A nested object with two CAIP-19 keys that contains a conversion rate or null between the two keys.\n */\nexport type OnAssetsConversionResponse = {\n conversionRates: Record<\n CaipAssetType,\n Record<CaipAssetType, AssetConversion | null>\n >;\n};\n"]}
1
+ {"version":3,"file":"assets-conversion.mjs","sourceRoot":"","sources":["../../../src/types/handlers/assets-conversion.ts"],"names":[],"mappings":"","sourcesContent":["import { type CaipAssetType } from '@metamask/utils';\n/**\n * The conversion rate between two assets.\n *\n * @property rate - The conversion rate between the two assets.\n * @property conversionTime - The time at which the conversion rate was calculated.\n * @property expirationTime - The time at which the conversion rate expires.\n */\nexport type AssetConversion = {\n rate: string;\n conversionTime: number;\n expirationTime?: number;\n};\n\n/**\n * The arguments for the `onAssetsConversion` handler.\n *\n * @property conversions - An array of objects containing the `from` and `to` asset types.\n * @property includeMarketData - Whether to include market data in the response.\n */\nexport type OnAssetsConversionArguments = {\n conversions: { from: CaipAssetType; to: CaipAssetType }[];\n};\n\n/**\n * The `onAssetsConversion` handler. This is called by MetaMask when querying about asset conversion on specific chains.\n *\n * @param args - The arguments for the handler.\n * see {@link OnAssetsConversionArguments}.\n * @returns The conversion for each asset. See\n * {@link OnAssetsConversionResponse}.\n */\nexport type OnAssetsConversionHandler = (\n args: OnAssetsConversionArguments,\n) => Promise<OnAssetsConversionResponse>;\n\n/**\n * The response from the conversion query, containing rates about each requested asset pair.\n *\n * @property conversionRates - A nested object with two CAIP-19 keys that contains a conversion rate or null between the two keys.\n */\nexport type OnAssetsConversionResponse = {\n conversionRates: Record<\n CaipAssetType,\n Record<CaipAssetType, AssetConversion | null>\n >;\n};\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=assets-market-data.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets-market-data.cjs","sourceRoot":"","sources":["../../../src/types/handlers/assets-market-data.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAssetType } from '@metamask/utils';\n\n/**\n * The market data for a fungible asset.\n *\n * @property fungible - Indicates that this is a fungible asset.\n * This is always `true` for fungible assets.\n * @property marketCap - The market capitalization of the asset.\n * @property totalVolume - The total volume of the asset.\n * @property circulatingSupply - The circulating supply of the asset.\n * @property allTimeHigh - The all-time high price of the asset.\n * @property allTimeLow - The all-time low price of the asset.\n * @property pricePercentChange - The percentage change in price over different intervals.\n * @property pricePercentChange.interval - The time interval for the price change as a ISO 8601 duration\n * or the string \"all\" to represent the all-time change.\n */\nexport type FungibleAssetMarketData = {\n fungible: true;\n marketCap?: string;\n totalVolume?: string;\n circulatingSupply?: string;\n allTimeHigh?: string;\n allTimeLow?: string;\n pricePercentChange?: {\n [interval: string]: number;\n };\n};\n\n/**\n * The arguments for the `onAssetsMarketData` handler.\n *\n * @property assets - An array of objects containing the asset and unit types.\n * @property assets.asset - The CAIP-19 asset type of the asset.\n * @property assets.unit - The CAIP-19 asset type of the unit to use.\n */\nexport type OnAssetsMarketDataArguments = {\n assets: {\n asset: CaipAssetType;\n unit: CaipAssetType;\n }[];\n};\n\n/**\n * The `onAssetsMarketData` handler. This is called by MetaMask when querying about market data for a specific asset.\n *\n * @param args - The arguments for the handler.\n * see {@link OnAssetsMarketDataArguments}.\n * @returns The market data for the asset. See {@link OnAssetsMarketDataResponse}.\n */\nexport type OnAssetsMarketDataHandler = (\n args: OnAssetsMarketDataArguments,\n) => Promise<OnAssetsMarketDataResponse>;\n\n/**\n * The response from the market data query, containing market data for the requested assets.\n *\n * @property marketData - A nested object with two CAIP-19 keys that contains a {@link FungibleAssetMarketData} object or null between the two keys.\n */\nexport type OnAssetsMarketDataResponse = {\n marketData: Record<\n CaipAssetType,\n Record<CaipAssetType, FungibleAssetMarketData | null>\n >;\n};\n"]}
@@ -0,0 +1,56 @@
1
+ import type { CaipAssetType } from "@metamask/utils";
2
+ /**
3
+ * The market data for a fungible asset.
4
+ *
5
+ * @property fungible - Indicates that this is a fungible asset.
6
+ * This is always `true` for fungible assets.
7
+ * @property marketCap - The market capitalization of the asset.
8
+ * @property totalVolume - The total volume of the asset.
9
+ * @property circulatingSupply - The circulating supply of the asset.
10
+ * @property allTimeHigh - The all-time high price of the asset.
11
+ * @property allTimeLow - The all-time low price of the asset.
12
+ * @property pricePercentChange - The percentage change in price over different intervals.
13
+ * @property pricePercentChange.interval - The time interval for the price change as a ISO 8601 duration
14
+ * or the string "all" to represent the all-time change.
15
+ */
16
+ export type FungibleAssetMarketData = {
17
+ fungible: true;
18
+ marketCap?: string;
19
+ totalVolume?: string;
20
+ circulatingSupply?: string;
21
+ allTimeHigh?: string;
22
+ allTimeLow?: string;
23
+ pricePercentChange?: {
24
+ [interval: string]: number;
25
+ };
26
+ };
27
+ /**
28
+ * The arguments for the `onAssetsMarketData` handler.
29
+ *
30
+ * @property assets - An array of objects containing the asset and unit types.
31
+ * @property assets.asset - The CAIP-19 asset type of the asset.
32
+ * @property assets.unit - The CAIP-19 asset type of the unit to use.
33
+ */
34
+ export type OnAssetsMarketDataArguments = {
35
+ assets: {
36
+ asset: CaipAssetType;
37
+ unit: CaipAssetType;
38
+ }[];
39
+ };
40
+ /**
41
+ * The `onAssetsMarketData` handler. This is called by MetaMask when querying about market data for a specific asset.
42
+ *
43
+ * @param args - The arguments for the handler.
44
+ * see {@link OnAssetsMarketDataArguments}.
45
+ * @returns The market data for the asset. See {@link OnAssetsMarketDataResponse}.
46
+ */
47
+ export type OnAssetsMarketDataHandler = (args: OnAssetsMarketDataArguments) => Promise<OnAssetsMarketDataResponse>;
48
+ /**
49
+ * The response from the market data query, containing market data for the requested assets.
50
+ *
51
+ * @property marketData - A nested object with two CAIP-19 keys that contains a {@link FungibleAssetMarketData} object or null between the two keys.
52
+ */
53
+ export type OnAssetsMarketDataResponse = {
54
+ marketData: Record<CaipAssetType, Record<CaipAssetType, FungibleAssetMarketData | null>>;
55
+ };
56
+ //# sourceMappingURL=assets-market-data.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets-market-data.d.cts","sourceRoot":"","sources":["../../../src/types/handlers/assets-market-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE;QACnB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;KAC5B,CAAC;CACH,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,EAAE;QACN,KAAK,EAAE,aAAa,CAAC;QACrB,IAAI,EAAE,aAAa,CAAC;KACrB,EAAE,CAAC;CACL,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACtC,IAAI,EAAE,2BAA2B,KAC9B,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,UAAU,EAAE,MAAM,CAChB,aAAa,EACb,MAAM,CAAC,aAAa,EAAE,uBAAuB,GAAG,IAAI,CAAC,CACtD,CAAC;CACH,CAAC"}
@@ -0,0 +1,56 @@
1
+ import type { CaipAssetType } from "@metamask/utils";
2
+ /**
3
+ * The market data for a fungible asset.
4
+ *
5
+ * @property fungible - Indicates that this is a fungible asset.
6
+ * This is always `true` for fungible assets.
7
+ * @property marketCap - The market capitalization of the asset.
8
+ * @property totalVolume - The total volume of the asset.
9
+ * @property circulatingSupply - The circulating supply of the asset.
10
+ * @property allTimeHigh - The all-time high price of the asset.
11
+ * @property allTimeLow - The all-time low price of the asset.
12
+ * @property pricePercentChange - The percentage change in price over different intervals.
13
+ * @property pricePercentChange.interval - The time interval for the price change as a ISO 8601 duration
14
+ * or the string "all" to represent the all-time change.
15
+ */
16
+ export type FungibleAssetMarketData = {
17
+ fungible: true;
18
+ marketCap?: string;
19
+ totalVolume?: string;
20
+ circulatingSupply?: string;
21
+ allTimeHigh?: string;
22
+ allTimeLow?: string;
23
+ pricePercentChange?: {
24
+ [interval: string]: number;
25
+ };
26
+ };
27
+ /**
28
+ * The arguments for the `onAssetsMarketData` handler.
29
+ *
30
+ * @property assets - An array of objects containing the asset and unit types.
31
+ * @property assets.asset - The CAIP-19 asset type of the asset.
32
+ * @property assets.unit - The CAIP-19 asset type of the unit to use.
33
+ */
34
+ export type OnAssetsMarketDataArguments = {
35
+ assets: {
36
+ asset: CaipAssetType;
37
+ unit: CaipAssetType;
38
+ }[];
39
+ };
40
+ /**
41
+ * The `onAssetsMarketData` handler. This is called by MetaMask when querying about market data for a specific asset.
42
+ *
43
+ * @param args - The arguments for the handler.
44
+ * see {@link OnAssetsMarketDataArguments}.
45
+ * @returns The market data for the asset. See {@link OnAssetsMarketDataResponse}.
46
+ */
47
+ export type OnAssetsMarketDataHandler = (args: OnAssetsMarketDataArguments) => Promise<OnAssetsMarketDataResponse>;
48
+ /**
49
+ * The response from the market data query, containing market data for the requested assets.
50
+ *
51
+ * @property marketData - A nested object with two CAIP-19 keys that contains a {@link FungibleAssetMarketData} object or null between the two keys.
52
+ */
53
+ export type OnAssetsMarketDataResponse = {
54
+ marketData: Record<CaipAssetType, Record<CaipAssetType, FungibleAssetMarketData | null>>;
55
+ };
56
+ //# sourceMappingURL=assets-market-data.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets-market-data.d.mts","sourceRoot":"","sources":["../../../src/types/handlers/assets-market-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE;QACnB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;KAC5B,CAAC;CACH,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,EAAE;QACN,KAAK,EAAE,aAAa,CAAC;QACrB,IAAI,EAAE,aAAa,CAAC;KACrB,EAAE,CAAC;CACL,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACtC,IAAI,EAAE,2BAA2B,KAC9B,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,UAAU,EAAE,MAAM,CAChB,aAAa,EACb,MAAM,CAAC,aAAa,EAAE,uBAAuB,GAAG,IAAI,CAAC,CACtD,CAAC;CACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=assets-market-data.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets-market-data.mjs","sourceRoot":"","sources":["../../../src/types/handlers/assets-market-data.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAssetType } from '@metamask/utils';\n\n/**\n * The market data for a fungible asset.\n *\n * @property fungible - Indicates that this is a fungible asset.\n * This is always `true` for fungible assets.\n * @property marketCap - The market capitalization of the asset.\n * @property totalVolume - The total volume of the asset.\n * @property circulatingSupply - The circulating supply of the asset.\n * @property allTimeHigh - The all-time high price of the asset.\n * @property allTimeLow - The all-time low price of the asset.\n * @property pricePercentChange - The percentage change in price over different intervals.\n * @property pricePercentChange.interval - The time interval for the price change as a ISO 8601 duration\n * or the string \"all\" to represent the all-time change.\n */\nexport type FungibleAssetMarketData = {\n fungible: true;\n marketCap?: string;\n totalVolume?: string;\n circulatingSupply?: string;\n allTimeHigh?: string;\n allTimeLow?: string;\n pricePercentChange?: {\n [interval: string]: number;\n };\n};\n\n/**\n * The arguments for the `onAssetsMarketData` handler.\n *\n * @property assets - An array of objects containing the asset and unit types.\n * @property assets.asset - The CAIP-19 asset type of the asset.\n * @property assets.unit - The CAIP-19 asset type of the unit to use.\n */\nexport type OnAssetsMarketDataArguments = {\n assets: {\n asset: CaipAssetType;\n unit: CaipAssetType;\n }[];\n};\n\n/**\n * The `onAssetsMarketData` handler. This is called by MetaMask when querying about market data for a specific asset.\n *\n * @param args - The arguments for the handler.\n * see {@link OnAssetsMarketDataArguments}.\n * @returns The market data for the asset. See {@link OnAssetsMarketDataResponse}.\n */\nexport type OnAssetsMarketDataHandler = (\n args: OnAssetsMarketDataArguments,\n) => Promise<OnAssetsMarketDataResponse>;\n\n/**\n * The response from the market data query, containing market data for the requested assets.\n *\n * @property marketData - A nested object with two CAIP-19 keys that contains a {@link FungibleAssetMarketData} object or null between the two keys.\n */\nexport type OnAssetsMarketDataResponse = {\n marketData: Record<\n CaipAssetType,\n Record<CaipAssetType, FungibleAssetMarketData | null>\n >;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/types/handlers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,sDAAgC;AAShC,oDAA8B;AAE9B,mDAA6B","sourcesContent":["export type * from './asset-historical-price';\nexport type * from './assets-conversion';\nexport * from './assets-lookup';\nexport type * from './client-request';\nexport type * from './cronjob';\nexport type * from './home-page';\nexport type * from './keyring';\nexport type * from './lifecycle';\nexport type * from './name-lookup';\nexport type * from './protocol';\nexport type * from './rpc-request';\nexport * from './transaction';\nexport type * from './signature';\nexport * from './user-input';\nexport type * from './settings-page';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/types/handlers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,sDAAgC;AAShC,oDAA8B;AAE9B,mDAA6B","sourcesContent":["export type * from './asset-historical-price';\nexport type * from './assets-conversion';\nexport type * from './assets-market-data';\nexport * from './assets-lookup';\nexport type * from './client-request';\nexport type * from './cronjob';\nexport type * from './home-page';\nexport type * from './keyring';\nexport type * from './lifecycle';\nexport type * from './name-lookup';\nexport type * from './protocol';\nexport type * from './rpc-request';\nexport * from './transaction';\nexport type * from './signature';\nexport * from './user-input';\nexport type * from './settings-page';\nexport type * from './web-socket-event';\n"]}
@@ -1,5 +1,6 @@
1
1
  export type * from "./asset-historical-price.cjs";
2
2
  export type * from "./assets-conversion.cjs";
3
+ export type * from "./assets-market-data.cjs";
3
4
  export * from "./assets-lookup.cjs";
4
5
  export type * from "./client-request.cjs";
5
6
  export type * from "./cronjob.cjs";
@@ -13,4 +14,5 @@ export * from "./transaction.cjs";
13
14
  export type * from "./signature.cjs";
14
15
  export * from "./user-input.cjs";
15
16
  export type * from "./settings-page.cjs";
17
+ export type * from "./web-socket-event.cjs";
16
18
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/types/handlers/index.ts"],"names":[],"mappings":"AAAA,kDAA8C;AAC9C,6CAAyC;AACzC,oCAAgC;AAChC,0CAAsC;AACtC,mCAA+B;AAC/B,qCAAiC;AACjC,mCAA+B;AAC/B,qCAAiC;AACjC,uCAAmC;AACnC,oCAAgC;AAChC,uCAAmC;AACnC,kCAA8B;AAC9B,qCAAiC;AACjC,iCAA6B;AAC7B,yCAAqC"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/types/handlers/index.ts"],"names":[],"mappings":"AAAA,kDAA8C;AAC9C,6CAAyC;AACzC,8CAA0C;AAC1C,oCAAgC;AAChC,0CAAsC;AACtC,mCAA+B;AAC/B,qCAAiC;AACjC,mCAA+B;AAC/B,qCAAiC;AACjC,uCAAmC;AACnC,oCAAgC;AAChC,uCAAmC;AACnC,kCAA8B;AAC9B,qCAAiC;AACjC,iCAA6B;AAC7B,yCAAqC;AACrC,4CAAwC"}
@@ -1,5 +1,6 @@
1
1
  export type * from "./asset-historical-price.mjs";
2
2
  export type * from "./assets-conversion.mjs";
3
+ export type * from "./assets-market-data.mjs";
3
4
  export * from "./assets-lookup.mjs";
4
5
  export type * from "./client-request.mjs";
5
6
  export type * from "./cronjob.mjs";
@@ -13,4 +14,5 @@ export * from "./transaction.mjs";
13
14
  export type * from "./signature.mjs";
14
15
  export * from "./user-input.mjs";
15
16
  export type * from "./settings-page.mjs";
17
+ export type * from "./web-socket-event.mjs";
16
18
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/types/handlers/index.ts"],"names":[],"mappings":"AAAA,kDAA8C;AAC9C,6CAAyC;AACzC,oCAAgC;AAChC,0CAAsC;AACtC,mCAA+B;AAC/B,qCAAiC;AACjC,mCAA+B;AAC/B,qCAAiC;AACjC,uCAAmC;AACnC,oCAAgC;AAChC,uCAAmC;AACnC,kCAA8B;AAC9B,qCAAiC;AACjC,iCAA6B;AAC7B,yCAAqC"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/types/handlers/index.ts"],"names":[],"mappings":"AAAA,kDAA8C;AAC9C,6CAAyC;AACzC,8CAA0C;AAC1C,oCAAgC;AAChC,0CAAsC;AACtC,mCAA+B;AAC/B,qCAAiC;AACjC,mCAA+B;AAC/B,qCAAiC;AACjC,uCAAmC;AACnC,oCAAgC;AAChC,uCAAmC;AACnC,kCAA8B;AAC9B,qCAAiC;AACjC,iCAA6B;AAC7B,yCAAqC;AACrC,4CAAwC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/types/handlers/index.ts"],"names":[],"mappings":"AAEA,oCAAgC;AAShC,kCAA8B;AAE9B,iCAA6B","sourcesContent":["export type * from './asset-historical-price';\nexport type * from './assets-conversion';\nexport * from './assets-lookup';\nexport type * from './client-request';\nexport type * from './cronjob';\nexport type * from './home-page';\nexport type * from './keyring';\nexport type * from './lifecycle';\nexport type * from './name-lookup';\nexport type * from './protocol';\nexport type * from './rpc-request';\nexport * from './transaction';\nexport type * from './signature';\nexport * from './user-input';\nexport type * from './settings-page';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/types/handlers/index.ts"],"names":[],"mappings":"AAGA,oCAAgC;AAShC,kCAA8B;AAE9B,iCAA6B","sourcesContent":["export type * from './asset-historical-price';\nexport type * from './assets-conversion';\nexport type * from './assets-market-data';\nexport * from './assets-lookup';\nexport type * from './client-request';\nexport type * from './cronjob';\nexport type * from './home-page';\nexport type * from './keyring';\nexport type * from './lifecycle';\nexport type * from './name-lookup';\nexport type * from './protocol';\nexport type * from './rpc-request';\nexport * from './transaction';\nexport type * from './signature';\nexport * from './user-input';\nexport type * from './settings-page';\nexport type * from './web-socket-event';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.cjs","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A lifecycle event handler. This is called whenever a lifecycle event occurs,\n * such as the Snap being installed or updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type LifecycleEventHandler = (args: {\n origin: string;\n}) => Promise<unknown>;\n\n/**\n * The `onInstall` handler. This is called after the Snap is installed.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnInstallHandler = LifecycleEventHandler;\n\n/**\n * The `onUpdate` handler. This is called after the Snap is updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnUpdateHandler = LifecycleEventHandler;\n"]}
1
+ {"version":3,"file":"lifecycle.cjs","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A lifecycle event handler. This is called whenever a lifecycle event occurs,\n * such as the Snap being installed or updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type LifecycleEventHandler = (args: {\n origin: string;\n}) => Promise<unknown>;\n\n/**\n * The `onInstall` handler. This is called after the Snap is installed.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnInstallHandler = LifecycleEventHandler;\n\n/**\n * The `onUpdate` handler. This is called after the Snap is updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnUpdateHandler = LifecycleEventHandler;\n\n/**\n * The `onStart` handler. This is called when the client is started.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnStartHandler = LifecycleEventHandler;\n"]}
@@ -35,4 +35,16 @@ export type OnInstallHandler = LifecycleEventHandler;
35
35
  * @param args.origin - The origin that triggered the lifecycle event hook.
36
36
  */
37
37
  export type OnUpdateHandler = LifecycleEventHandler;
38
+ /**
39
+ * The `onStart` handler. This is called when the client is started.
40
+ *
41
+ * Note that using this handler requires the `endowment:lifecycle-hooks`
42
+ * permission.
43
+ *
44
+ * This type is an alias for {@link LifecycleEventHandler}.
45
+ *
46
+ * @param args - The request arguments.
47
+ * @param args.origin - The origin that triggered the lifecycle event hook.
48
+ */
49
+ export type OnStartHandler = LifecycleEventHandler;
38
50
  //# sourceMappingURL=lifecycle.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.d.cts","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC"}
1
+ {"version":3,"file":"lifecycle.d.cts","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC"}
@@ -35,4 +35,16 @@ export type OnInstallHandler = LifecycleEventHandler;
35
35
  * @param args.origin - The origin that triggered the lifecycle event hook.
36
36
  */
37
37
  export type OnUpdateHandler = LifecycleEventHandler;
38
+ /**
39
+ * The `onStart` handler. This is called when the client is started.
40
+ *
41
+ * Note that using this handler requires the `endowment:lifecycle-hooks`
42
+ * permission.
43
+ *
44
+ * This type is an alias for {@link LifecycleEventHandler}.
45
+ *
46
+ * @param args - The request arguments.
47
+ * @param args.origin - The origin that triggered the lifecycle event hook.
48
+ */
49
+ export type OnStartHandler = LifecycleEventHandler;
38
50
  //# sourceMappingURL=lifecycle.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.d.mts","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC"}
1
+ {"version":3,"file":"lifecycle.d.mts","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.mjs","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A lifecycle event handler. This is called whenever a lifecycle event occurs,\n * such as the Snap being installed or updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type LifecycleEventHandler = (args: {\n origin: string;\n}) => Promise<unknown>;\n\n/**\n * The `onInstall` handler. This is called after the Snap is installed.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnInstallHandler = LifecycleEventHandler;\n\n/**\n * The `onUpdate` handler. This is called after the Snap is updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnUpdateHandler = LifecycleEventHandler;\n"]}
1
+ {"version":3,"file":"lifecycle.mjs","sourceRoot":"","sources":["../../../src/types/handlers/lifecycle.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A lifecycle event handler. This is called whenever a lifecycle event occurs,\n * such as the Snap being installed or updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type LifecycleEventHandler = (args: {\n origin: string;\n}) => Promise<unknown>;\n\n/**\n * The `onInstall` handler. This is called after the Snap is installed.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnInstallHandler = LifecycleEventHandler;\n\n/**\n * The `onUpdate` handler. This is called after the Snap is updated.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnUpdateHandler = LifecycleEventHandler;\n\n/**\n * The `onStart` handler. This is called when the client is started.\n *\n * Note that using this handler requires the `endowment:lifecycle-hooks`\n * permission.\n *\n * This type is an alias for {@link LifecycleEventHandler}.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin that triggered the lifecycle event hook.\n */\nexport type OnStartHandler = LifecycleEventHandler;\n"]}