@metamask-previews/user-operation-controller 41.2.9-preview-3866c0ff1 → 41.2.9-preview-e3275932a

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 (159) hide show
  1. package/CHANGELOG.md +0 -4
  2. package/dist/BlockTrackerPollingController.cjs +68 -0
  3. package/dist/BlockTrackerPollingController.cjs.map +1 -0
  4. package/dist/{BlockTrackerPollingController.d.ts → BlockTrackerPollingController.d.cts} +11 -11
  5. package/dist/BlockTrackerPollingController.d.cts.map +1 -0
  6. package/dist/BlockTrackerPollingController.d.mts +41 -0
  7. package/dist/BlockTrackerPollingController.d.mts.map +1 -0
  8. package/dist/{BlockTrackerPollingController.js → BlockTrackerPollingController.mjs} +19 -17
  9. package/dist/BlockTrackerPollingController.mjs.map +1 -0
  10. package/dist/UserOperationController-method-action-types.cjs +7 -0
  11. package/dist/UserOperationController-method-action-types.cjs.map +1 -0
  12. package/dist/{UserOperationController-method-action-types.d.ts → UserOperationController-method-action-types.d.cts} +2 -2
  13. package/dist/UserOperationController-method-action-types.d.cts.map +1 -0
  14. package/dist/UserOperationController-method-action-types.d.mts +57 -0
  15. package/dist/UserOperationController-method-action-types.d.mts.map +1 -0
  16. package/dist/{UserOperationController-method-action-types.js → UserOperationController-method-action-types.mjs} +1 -1
  17. package/dist/UserOperationController-method-action-types.mjs.map +1 -0
  18. package/dist/UserOperationController.cjs +495 -0
  19. package/dist/UserOperationController.cjs.map +1 -0
  20. package/dist/{UserOperationController.d.ts → UserOperationController.d.cts} +15 -13
  21. package/dist/UserOperationController.d.cts.map +1 -0
  22. package/dist/UserOperationController.d.mts +136 -0
  23. package/dist/UserOperationController.d.mts.map +1 -0
  24. package/dist/UserOperationController.mjs +489 -0
  25. package/dist/UserOperationController.mjs.map +1 -0
  26. package/dist/constants.cjs +7 -0
  27. package/dist/constants.cjs.map +1 -0
  28. package/dist/{constants.d.ts → constants.d.cts} +1 -1
  29. package/dist/constants.d.cts.map +1 -0
  30. package/dist/constants.d.mts +4 -0
  31. package/dist/constants.d.mts.map +1 -0
  32. package/dist/{constants.js → constants.mjs} +1 -1
  33. package/dist/constants.mjs.map +1 -0
  34. package/dist/helpers/Bundler.cjs +91 -0
  35. package/dist/helpers/Bundler.cjs.map +1 -0
  36. package/dist/helpers/{Bundler.d.ts → Bundler.d.cts} +2 -2
  37. package/dist/helpers/Bundler.d.cts.map +1 -0
  38. package/dist/helpers/Bundler.d.mts +46 -0
  39. package/dist/helpers/Bundler.d.mts.map +1 -0
  40. package/dist/helpers/Bundler.mjs +87 -0
  41. package/dist/helpers/Bundler.mjs.map +1 -0
  42. package/dist/helpers/PendingUserOperationTracker.cjs +127 -0
  43. package/dist/helpers/PendingUserOperationTracker.cjs.map +1 -0
  44. package/dist/helpers/{PendingUserOperationTracker.d.ts → PendingUserOperationTracker.d.cts} +12 -10
  45. package/dist/helpers/PendingUserOperationTracker.d.cts.map +1 -0
  46. package/dist/helpers/PendingUserOperationTracker.d.mts +51 -0
  47. package/dist/helpers/PendingUserOperationTracker.d.mts.map +1 -0
  48. package/dist/helpers/PendingUserOperationTracker.mjs +127 -0
  49. package/dist/helpers/PendingUserOperationTracker.mjs.map +1 -0
  50. package/dist/helpers/SnapSmartContractAccount.cjs +64 -0
  51. package/dist/helpers/SnapSmartContractAccount.cjs.map +1 -0
  52. package/dist/helpers/{SnapSmartContractAccount.d.ts → SnapSmartContractAccount.d.cts} +3 -3
  53. package/dist/helpers/SnapSmartContractAccount.d.cts.map +1 -0
  54. package/dist/helpers/SnapSmartContractAccount.d.mts +10 -0
  55. package/dist/helpers/SnapSmartContractAccount.d.mts.map +1 -0
  56. package/dist/helpers/SnapSmartContractAccount.mjs +60 -0
  57. package/dist/helpers/SnapSmartContractAccount.mjs.map +1 -0
  58. package/dist/index.cjs +19 -0
  59. package/dist/index.cjs.map +1 -0
  60. package/dist/index.d.cts +4 -0
  61. package/dist/index.d.cts.map +1 -0
  62. package/dist/index.d.mts +4 -0
  63. package/dist/index.d.mts.map +1 -0
  64. package/dist/index.mjs +3 -0
  65. package/dist/index.mjs.map +1 -0
  66. package/dist/logger.cjs +8 -0
  67. package/dist/logger.cjs.map +1 -0
  68. package/dist/logger.d.cts +5 -0
  69. package/dist/logger.d.cts.map +1 -0
  70. package/dist/logger.d.mts +5 -0
  71. package/dist/logger.d.mts.map +1 -0
  72. package/dist/{logger.js → logger.mjs} +2 -2
  73. package/dist/logger.mjs.map +1 -0
  74. package/dist/types.cjs +16 -0
  75. package/dist/types.cjs.map +1 -0
  76. package/dist/{types.d.ts → types.d.cts} +3 -3
  77. package/dist/types.d.cts.map +1 -0
  78. package/dist/types.d.mts +294 -0
  79. package/dist/types.d.mts.map +1 -0
  80. package/dist/{types.js → types.mjs} +1 -1
  81. package/dist/types.mjs.map +1 -0
  82. package/dist/utils/chain-id.cjs +17 -0
  83. package/dist/utils/chain-id.cjs.map +1 -0
  84. package/dist/utils/{chain-id.d.ts → chain-id.d.cts} +1 -1
  85. package/dist/utils/chain-id.d.cts.map +1 -0
  86. package/dist/utils/chain-id.d.mts +8 -0
  87. package/dist/utils/chain-id.d.mts.map +1 -0
  88. package/dist/utils/{chain-id.js → chain-id.mjs} +1 -1
  89. package/dist/utils/chain-id.mjs.map +1 -0
  90. package/dist/utils/gas-fees.cjs +194 -0
  91. package/dist/utils/gas-fees.cjs.map +1 -0
  92. package/dist/utils/{gas-fees.d.ts → gas-fees.d.cts} +6 -6
  93. package/dist/utils/gas-fees.d.cts.map +1 -0
  94. package/dist/utils/gas-fees.d.mts +24 -0
  95. package/dist/utils/gas-fees.d.mts.map +1 -0
  96. package/dist/utils/{gas-fees.js → gas-fees.mjs} +15 -8
  97. package/dist/utils/gas-fees.mjs.map +1 -0
  98. package/dist/utils/gas.cjs +72 -0
  99. package/dist/utils/gas.cjs.map +1 -0
  100. package/dist/utils/{gas.d.ts → gas.d.cts} +2 -2
  101. package/dist/utils/gas.d.cts.map +1 -0
  102. package/dist/utils/gas.d.mts +10 -0
  103. package/dist/utils/gas.d.mts.map +1 -0
  104. package/dist/utils/{gas.js → gas.mjs} +14 -7
  105. package/dist/utils/gas.mjs.map +1 -0
  106. package/dist/utils/transaction.cjs +117 -0
  107. package/dist/utils/transaction.cjs.map +1 -0
  108. package/dist/utils/{transaction.d.ts → transaction.d.cts} +3 -3
  109. package/dist/utils/transaction.d.cts.map +1 -0
  110. package/dist/utils/transaction.d.mts +10 -0
  111. package/dist/utils/transaction.d.mts.map +1 -0
  112. package/dist/utils/{transaction.js → transaction.mjs} +13 -6
  113. package/dist/utils/transaction.mjs.map +1 -0
  114. package/dist/utils/validation.cjs +162 -0
  115. package/dist/utils/validation.cjs.map +1 -0
  116. package/dist/utils/{validation.d.ts → validation.d.cts} +3 -3
  117. package/dist/utils/validation.d.cts.map +1 -0
  118. package/dist/utils/validation.d.mts +33 -0
  119. package/dist/utils/validation.d.mts.map +1 -0
  120. package/dist/utils/{validation.js → validation.mjs} +5 -5
  121. package/dist/utils/validation.mjs.map +1 -0
  122. package/package.json +17 -13
  123. package/dist/BlockTrackerPollingController.d.ts.map +0 -1
  124. package/dist/BlockTrackerPollingController.js.map +0 -1
  125. package/dist/UserOperationController-method-action-types.d.ts.map +0 -1
  126. package/dist/UserOperationController-method-action-types.js.map +0 -1
  127. package/dist/UserOperationController.d.ts.map +0 -1
  128. package/dist/UserOperationController.js +0 -495
  129. package/dist/UserOperationController.js.map +0 -1
  130. package/dist/constants.d.ts.map +0 -1
  131. package/dist/constants.js.map +0 -1
  132. package/dist/helpers/Bundler.d.ts.map +0 -1
  133. package/dist/helpers/Bundler.js +0 -74
  134. package/dist/helpers/Bundler.js.map +0 -1
  135. package/dist/helpers/PendingUserOperationTracker.d.ts.map +0 -1
  136. package/dist/helpers/PendingUserOperationTracker.js +0 -115
  137. package/dist/helpers/PendingUserOperationTracker.js.map +0 -1
  138. package/dist/helpers/SnapSmartContractAccount.d.ts.map +0 -1
  139. package/dist/helpers/SnapSmartContractAccount.js +0 -47
  140. package/dist/helpers/SnapSmartContractAccount.js.map +0 -1
  141. package/dist/index.d.ts +0 -4
  142. package/dist/index.d.ts.map +0 -1
  143. package/dist/index.js +0 -3
  144. package/dist/index.js.map +0 -1
  145. package/dist/logger.d.ts +0 -4
  146. package/dist/logger.d.ts.map +0 -1
  147. package/dist/logger.js.map +0 -1
  148. package/dist/types.d.ts.map +0 -1
  149. package/dist/types.js.map +0 -1
  150. package/dist/utils/chain-id.d.ts.map +0 -1
  151. package/dist/utils/chain-id.js.map +0 -1
  152. package/dist/utils/gas-fees.d.ts.map +0 -1
  153. package/dist/utils/gas-fees.js.map +0 -1
  154. package/dist/utils/gas.d.ts.map +0 -1
  155. package/dist/utils/gas.js.map +0 -1
  156. package/dist/utils/transaction.d.ts.map +0 -1
  157. package/dist/utils/transaction.js.map +0 -1
  158. package/dist/utils/validation.d.ts.map +0 -1
  159. package/dist/utils/validation.js.map +0 -1
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateSignUserOperationResponse = exports.validateUpdateUserOperationResponse = exports.validatePrepareUserOperationResponse = exports.validateAddUserOperationOptions = exports.validateAddUserOperationRequest = void 0;
4
+ const superstruct_1 = require("@metamask/superstruct");
5
+ const transaction_controller_1 = require("@metamask/transaction-controller");
6
+ const utils_1 = require("@metamask/utils");
7
+ const constants_js_1 = require("../constants.cjs");
8
+ /**
9
+ * Validate a request to add a user operation.
10
+ *
11
+ * @param request - The request to validate.
12
+ */
13
+ function validateAddUserOperationRequest(request) {
14
+ const Hex = defineHex();
15
+ const HexOrEmptyBytes = defineHexOrEmptyBytes();
16
+ const ValidRequest = (0, superstruct_1.object)({
17
+ data: (0, superstruct_1.optional)(HexOrEmptyBytes),
18
+ from: Hex,
19
+ maxFeePerGas: (0, superstruct_1.optional)(Hex),
20
+ maxPriorityFeePerGas: (0, superstruct_1.optional)(Hex),
21
+ to: (0, superstruct_1.optional)(Hex),
22
+ value: (0, superstruct_1.optional)(Hex),
23
+ });
24
+ validate(request, ValidRequest, 'Invalid request to add user operation');
25
+ }
26
+ exports.validateAddUserOperationRequest = validateAddUserOperationRequest;
27
+ /**
28
+ * Validate the options when adding a user operation.
29
+ *
30
+ * @param options - The options to validate.
31
+ */
32
+ function validateAddUserOperationOptions(options) {
33
+ const ValidOptions = (0, superstruct_1.object)({
34
+ networkClientId: (0, superstruct_1.string)(),
35
+ origin: (0, superstruct_1.string)(),
36
+ requireApproval: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
37
+ smartContractAccount: (0, superstruct_1.optional)((0, superstruct_1.object)({
38
+ prepareUserOperation: (0, superstruct_1.func)(),
39
+ updateUserOperation: (0, superstruct_1.func)(),
40
+ signUserOperation: (0, superstruct_1.func)(),
41
+ })),
42
+ swaps: (0, superstruct_1.optional)((0, superstruct_1.object)({
43
+ approvalTxId: (0, superstruct_1.optional)((0, superstruct_1.string)()),
44
+ destinationTokenAddress: (0, superstruct_1.optional)((0, superstruct_1.string)()),
45
+ destinationTokenDecimals: (0, superstruct_1.optional)((0, superstruct_1.number)()),
46
+ destinationTokenSymbol: (0, superstruct_1.optional)((0, superstruct_1.string)()),
47
+ estimatedBaseFee: (0, superstruct_1.optional)((0, superstruct_1.string)()),
48
+ sourceTokenSymbol: (0, superstruct_1.optional)((0, superstruct_1.string)()),
49
+ swapMetaData: (0, superstruct_1.optional)((0, superstruct_1.object)()),
50
+ swapTokenValue: (0, superstruct_1.optional)((0, superstruct_1.string)()),
51
+ destinationTokenAmount: (0, superstruct_1.optional)((0, superstruct_1.string)()),
52
+ sourceTokenAddress: (0, superstruct_1.optional)((0, superstruct_1.string)()),
53
+ sourceTokenAmount: (0, superstruct_1.optional)((0, superstruct_1.string)()),
54
+ sourceTokenDecimals: (0, superstruct_1.optional)((0, superstruct_1.number)()),
55
+ swapAndSendRecipient: (0, superstruct_1.optional)((0, superstruct_1.string)()),
56
+ })),
57
+ type: (0, superstruct_1.optional)((0, superstruct_1.enums)(Object.values(transaction_controller_1.TransactionType))),
58
+ });
59
+ validate(options, ValidOptions, 'Invalid options to add user operation');
60
+ }
61
+ exports.validateAddUserOperationOptions = validateAddUserOperationOptions;
62
+ /**
63
+ * Validate the response from a smart contract account when preparing the user operation.
64
+ *
65
+ * @param response - The response to validate.
66
+ */
67
+ function validatePrepareUserOperationResponse(response) {
68
+ const Hex = defineHex();
69
+ const HexOrEmptyBytes = defineHexOrEmptyBytes();
70
+ const ValidResponse = (0, superstruct_1.refine)((0, superstruct_1.object)({
71
+ bundler: (0, superstruct_1.string)(),
72
+ callData: Hex,
73
+ dummyPaymasterAndData: (0, superstruct_1.optional)(HexOrEmptyBytes),
74
+ dummySignature: (0, superstruct_1.optional)(HexOrEmptyBytes),
75
+ gas: (0, superstruct_1.optional)((0, superstruct_1.object)({
76
+ callGasLimit: Hex,
77
+ preVerificationGas: Hex,
78
+ verificationGasLimit: Hex,
79
+ })),
80
+ initCode: (0, superstruct_1.optional)(HexOrEmptyBytes),
81
+ nonce: Hex,
82
+ sender: Hex,
83
+ }), 'ValidPrepareUserOperationResponse', ({ gas, dummySignature }) => {
84
+ if (!gas && (!dummySignature || dummySignature === constants_js_1.EMPTY_BYTES)) {
85
+ return 'Must specify dummySignature if not specifying gas';
86
+ }
87
+ /* istanbul ignore next */
88
+ return true;
89
+ });
90
+ validate(response, ValidResponse, 'Invalid response when preparing user operation');
91
+ }
92
+ exports.validatePrepareUserOperationResponse = validatePrepareUserOperationResponse;
93
+ /**
94
+ * Validate the response from a smart contract account when updating the user operation.
95
+ *
96
+ * @param response - The response to validate.
97
+ */
98
+ function validateUpdateUserOperationResponse(response) {
99
+ const ValidResponse = (0, superstruct_1.optional)((0, superstruct_1.object)({
100
+ paymasterAndData: (0, superstruct_1.optional)(defineHexOrEmptyBytes()),
101
+ callGasLimit: (0, superstruct_1.optional)(defineHexOrEmptyBytes()),
102
+ preVerificationGas: (0, superstruct_1.optional)(defineHexOrEmptyBytes()),
103
+ verificationGasLimit: (0, superstruct_1.optional)(defineHexOrEmptyBytes()),
104
+ }));
105
+ validate(response, ValidResponse, 'Invalid response when updating user operation');
106
+ }
107
+ exports.validateUpdateUserOperationResponse = validateUpdateUserOperationResponse;
108
+ /**
109
+ * Validate the response from a smart contract account when signing the user operation.
110
+ *
111
+ * @param response - The response to validate.
112
+ */
113
+ function validateSignUserOperationResponse(response) {
114
+ const Hex = defineHex();
115
+ const ValidResponse = (0, superstruct_1.object)({
116
+ signature: Hex,
117
+ });
118
+ validate(response, ValidResponse, 'Invalid response when signing user operation');
119
+ }
120
+ exports.validateSignUserOperationResponse = validateSignUserOperationResponse;
121
+ /**
122
+ * Validate data against a struct.
123
+ *
124
+ * @param data - The data to validate.
125
+ * @param struct - The struct to validate against.
126
+ * @param message - The message to throw if validation fails.
127
+ */
128
+ function validate(data, struct, message) {
129
+ try {
130
+ (0, superstruct_1.assert)(data, struct, message);
131
+ }
132
+ catch (error) {
133
+ const causes = error
134
+ .failures()
135
+ .map((failure) => {
136
+ if (!failure.path.length) {
137
+ return failure.message;
138
+ }
139
+ return `${failure.path.join('.')} - ${failure.message}`;
140
+ })
141
+ .join('\n');
142
+ const finalMessage = `${message}\n${causes}`;
143
+ throw new Error(finalMessage);
144
+ }
145
+ }
146
+ /**
147
+ * Define the Hex type used by superstruct.
148
+ *
149
+ * @returns The Hex superstruct type.
150
+ */
151
+ function defineHex() {
152
+ return (0, superstruct_1.define)('Hexadecimal String', (value) => (0, utils_1.isStrictHexString)(value));
153
+ }
154
+ /**
155
+ * Define the HexOrEmptyBytes type used by superstruct.
156
+ *
157
+ * @returns The HexOrEmptyBytes superstruct type.
158
+ */
159
+ function defineHexOrEmptyBytes() {
160
+ return (0, superstruct_1.define)('Hexadecimal String or 0x', (value) => (0, utils_1.isStrictHexString)(value) || value === constants_js_1.EMPTY_BYTES);
161
+ }
162
+ //# sourceMappingURL=validation.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.cjs","sourceRoot":"","sources":["../../src/utils/validation.ts"],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IAAI,KAAK,KAAK,0BAAW,CAC7D,CAAC;AACJ,CAAC","sourcesContent":["import type { Struct, StructError } from '@metamask/superstruct';\nimport {\n assert,\n boolean,\n define,\n enums,\n func,\n number,\n object,\n optional,\n refine,\n string,\n} from '@metamask/superstruct';\nimport { TransactionType } from '@metamask/transaction-controller';\nimport { isStrictHexString } from '@metamask/utils';\n\nimport { EMPTY_BYTES } from '../constants.js';\nimport type {\n PrepareUserOperationResponse,\n SignUserOperationResponse,\n UpdateUserOperationResponse,\n} from '../types.js';\nimport type {\n AddUserOperationOptions,\n AddUserOperationRequest,\n} from '../UserOperationController.js';\n\n/**\n * Validate a request to add a user operation.\n *\n * @param request - The request to validate.\n */\nexport function validateAddUserOperationRequest(\n request: AddUserOperationRequest,\n) {\n const Hex = defineHex();\n const HexOrEmptyBytes = defineHexOrEmptyBytes();\n\n const ValidRequest = object({\n data: optional(HexOrEmptyBytes),\n from: Hex,\n maxFeePerGas: optional(Hex),\n maxPriorityFeePerGas: optional(Hex),\n to: optional(Hex),\n value: optional(Hex),\n });\n\n validate(request, ValidRequest, 'Invalid request to add user operation');\n}\n\n/**\n * Validate the options when adding a user operation.\n *\n * @param options - The options to validate.\n */\nexport function validateAddUserOperationOptions(\n options: AddUserOperationOptions,\n) {\n const ValidOptions = object({\n networkClientId: string(),\n origin: string(),\n requireApproval: optional(boolean()),\n smartContractAccount: optional(\n object({\n prepareUserOperation: func(),\n updateUserOperation: func(),\n signUserOperation: func(),\n }),\n ),\n swaps: optional(\n object({\n approvalTxId: optional(string()),\n destinationTokenAddress: optional(string()),\n destinationTokenDecimals: optional(number()),\n destinationTokenSymbol: optional(string()),\n estimatedBaseFee: optional(string()),\n sourceTokenSymbol: optional(string()),\n swapMetaData: optional(object()),\n swapTokenValue: optional(string()),\n destinationTokenAmount: optional(string()),\n sourceTokenAddress: optional(string()),\n sourceTokenAmount: optional(string()),\n sourceTokenDecimals: optional(number()),\n swapAndSendRecipient: optional(string()),\n }),\n ),\n type: optional(enums(Object.values(TransactionType))),\n });\n\n validate(options, ValidOptions, 'Invalid options to add user operation');\n}\n\n/**\n * Validate the response from a smart contract account when preparing the user operation.\n *\n * @param response - The response to validate.\n */\nexport function validatePrepareUserOperationResponse(\n response: PrepareUserOperationResponse,\n) {\n const Hex = defineHex();\n const HexOrEmptyBytes = defineHexOrEmptyBytes();\n\n const ValidResponse = refine(\n object({\n bundler: string(),\n callData: Hex,\n dummyPaymasterAndData: optional(HexOrEmptyBytes),\n dummySignature: optional(HexOrEmptyBytes),\n gas: optional(\n object({\n callGasLimit: Hex,\n preVerificationGas: Hex,\n verificationGasLimit: Hex,\n }),\n ),\n initCode: optional(HexOrEmptyBytes),\n nonce: Hex,\n sender: Hex,\n }),\n 'ValidPrepareUserOperationResponse',\n ({ gas, dummySignature }) => {\n if (!gas && (!dummySignature || dummySignature === EMPTY_BYTES)) {\n return 'Must specify dummySignature if not specifying gas';\n }\n\n /* istanbul ignore next */\n return true;\n },\n );\n\n validate(\n response,\n ValidResponse,\n 'Invalid response when preparing user operation',\n );\n}\n\n/**\n * Validate the response from a smart contract account when updating the user operation.\n *\n * @param response - The response to validate.\n */\nexport function validateUpdateUserOperationResponse(\n response: UpdateUserOperationResponse,\n) {\n const ValidResponse = optional(\n object({\n paymasterAndData: optional(defineHexOrEmptyBytes()),\n callGasLimit: optional(defineHexOrEmptyBytes()),\n preVerificationGas: optional(defineHexOrEmptyBytes()),\n verificationGasLimit: optional(defineHexOrEmptyBytes()),\n }),\n );\n\n validate(\n response,\n ValidResponse,\n 'Invalid response when updating user operation',\n );\n}\n\n/**\n * Validate the response from a smart contract account when signing the user operation.\n *\n * @param response - The response to validate.\n */\nexport function validateSignUserOperationResponse(\n response: SignUserOperationResponse,\n) {\n const Hex = defineHex();\n\n const ValidResponse = object({\n signature: Hex,\n });\n\n validate(\n response,\n ValidResponse,\n 'Invalid response when signing user operation',\n );\n}\n\n/**\n * Validate data against a struct.\n *\n * @param data - The data to validate.\n * @param struct - The struct to validate against.\n * @param message - The message to throw if validation fails.\n */\nfunction validate<T>(data: unknown, struct: Struct<T>, message: string) {\n try {\n assert(data, struct, message);\n } catch (error) {\n const causes = (error as StructError)\n .failures()\n .map((failure) => {\n if (!failure.path.length) {\n return failure.message;\n }\n\n return `${failure.path.join('.')} - ${failure.message}`;\n })\n .join('\\n');\n\n const finalMessage = `${message}\\n${causes}`;\n\n throw new Error(finalMessage);\n }\n}\n\n/**\n * Define the Hex type used by superstruct.\n *\n * @returns The Hex superstruct type.\n */\nfunction defineHex() {\n return define<string>('Hexadecimal String', (value) =>\n isStrictHexString(value),\n );\n}\n\n/**\n * Define the HexOrEmptyBytes type used by superstruct.\n *\n * @returns The HexOrEmptyBytes superstruct type.\n */\nfunction defineHexOrEmptyBytes() {\n return define<string>(\n 'Hexadecimal String or 0x',\n (value) => isStrictHexString(value) || value === EMPTY_BYTES,\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
- import type { PrepareUserOperationResponse, SignUserOperationResponse, UpdateUserOperationResponse } from '../types.js';
2
- import type { AddUserOperationOptions, AddUserOperationRequest } from '../UserOperationController.js';
1
+ import type { PrepareUserOperationResponse, SignUserOperationResponse, UpdateUserOperationResponse } from "../types.cjs";
2
+ import type { AddUserOperationOptions, AddUserOperationRequest } from "../UserOperationController.cjs";
3
3
  /**
4
4
  * Validate a request to add a user operation.
5
5
  *
@@ -30,4 +30,4 @@ export declare function validateUpdateUserOperationResponse(response: UpdateUser
30
30
  * @param response - The response to validate.
31
31
  */
32
32
  export declare function validateSignUserOperationResponse(response: SignUserOperationResponse): void;
33
- //# sourceMappingURL=validation.d.ts.map
33
+ //# sourceMappingURL=validation.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.cts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC5B,qBAAoB;AACrB,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,uCAAsC;AAEvC;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,uBAAuB,QAejC;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,uBAAuB,QAkCjC;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,4BAA4B,QAsCvC;AAED;;;;GAIG;AACH,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,2BAA2B,QAgBtC;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,yBAAyB,QAapC"}
@@ -0,0 +1,33 @@
1
+ import type { PrepareUserOperationResponse, SignUserOperationResponse, UpdateUserOperationResponse } from "../types.mjs";
2
+ import type { AddUserOperationOptions, AddUserOperationRequest } from "../UserOperationController.mjs";
3
+ /**
4
+ * Validate a request to add a user operation.
5
+ *
6
+ * @param request - The request to validate.
7
+ */
8
+ export declare function validateAddUserOperationRequest(request: AddUserOperationRequest): void;
9
+ /**
10
+ * Validate the options when adding a user operation.
11
+ *
12
+ * @param options - The options to validate.
13
+ */
14
+ export declare function validateAddUserOperationOptions(options: AddUserOperationOptions): void;
15
+ /**
16
+ * Validate the response from a smart contract account when preparing the user operation.
17
+ *
18
+ * @param response - The response to validate.
19
+ */
20
+ export declare function validatePrepareUserOperationResponse(response: PrepareUserOperationResponse): void;
21
+ /**
22
+ * Validate the response from a smart contract account when updating the user operation.
23
+ *
24
+ * @param response - The response to validate.
25
+ */
26
+ export declare function validateUpdateUserOperationResponse(response: UpdateUserOperationResponse): void;
27
+ /**
28
+ * Validate the response from a smart contract account when signing the user operation.
29
+ *
30
+ * @param response - The response to validate.
31
+ */
32
+ export declare function validateSignUserOperationResponse(response: SignUserOperationResponse): void;
33
+ //# sourceMappingURL=validation.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.mts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC5B,qBAAoB;AACrB,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,uCAAsC;AAEvC;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,uBAAuB,QAejC;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,uBAAuB,QAkCjC;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,4BAA4B,QAsCvC;AAED;;;;GAIG;AACH,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,2BAA2B,QAgBtC;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,yBAAyB,QAapC"}
@@ -1,7 +1,7 @@
1
- import { assert, boolean, define, enums, func, number, object, optional, refine, string, } from '@metamask/superstruct';
2
- import { TransactionType } from '@metamask/transaction-controller';
3
- import { isStrictHexString } from '@metamask/utils';
4
- import { EMPTY_BYTES } from '../constants.js';
1
+ import { assert, boolean, define, enums, func, number, object, optional, refine, string } from "@metamask/superstruct";
2
+ import { TransactionType } from "@metamask/transaction-controller";
3
+ import { isStrictHexString } from "@metamask/utils";
4
+ import { EMPTY_BYTES } from "../constants.mjs";
5
5
  /**
6
6
  * Validate a request to add a user operation.
7
7
  *
@@ -151,4 +151,4 @@ function defineHex() {
151
151
  function defineHexOrEmptyBytes() {
152
152
  return define('Hexadecimal String or 0x', (value) => isStrictHexString(value) || value === EMPTY_BYTES);
153
153
  }
154
- //# sourceMappingURL=validation.js.map
154
+ //# sourceMappingURL=validation.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.mjs","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,OAAO,EACP,MAAM,EACN,KAAK,EACL,IAAI,EACJ,MAAM,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAA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ACf,MAAM,MAAM,GAAI,KAAqB;aAClC,QAAQ,EAAE;aACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;YACf,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACzB,OAAO,OAAO,CAAC,OAAO,CAAC;YACzB,CAAC;YAED,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QAC1D,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,MAAM,YAAY,GAAG,GAAG,OAAO,KAAK,MAAM,EAAE,CAAC;QAE7C,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;IAChC,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,SAAS;IAChB,OAAO,MAAM,CAAS,oBAAoB,EAAE,CAAC,KAAK,EAAE,EAAE,CACpD,iBAAiB,CAAC,KAAK,CAAC,CACzB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,qBAAqB;IAC5B,OAAO,MAAM,CACX,0BAA0B,EAC1B,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,WAAW,CAC7D,CAAC;AACJ,CAAC","sourcesContent":["import type { Struct, StructError } from '@metamask/superstruct';\nimport {\n assert,\n boolean,\n define,\n enums,\n func,\n number,\n object,\n optional,\n refine,\n string,\n} from '@metamask/superstruct';\nimport { TransactionType } from '@metamask/transaction-controller';\nimport { isStrictHexString } from '@metamask/utils';\n\nimport { EMPTY_BYTES } from '../constants.js';\nimport type {\n PrepareUserOperationResponse,\n SignUserOperationResponse,\n UpdateUserOperationResponse,\n} from '../types.js';\nimport type {\n AddUserOperationOptions,\n AddUserOperationRequest,\n} from '../UserOperationController.js';\n\n/**\n * Validate a request to add a user operation.\n *\n * @param request - The request to validate.\n */\nexport function validateAddUserOperationRequest(\n request: AddUserOperationRequest,\n) {\n const Hex = defineHex();\n const HexOrEmptyBytes = defineHexOrEmptyBytes();\n\n const ValidRequest = object({\n data: optional(HexOrEmptyBytes),\n from: Hex,\n maxFeePerGas: optional(Hex),\n maxPriorityFeePerGas: optional(Hex),\n to: optional(Hex),\n value: optional(Hex),\n });\n\n validate(request, ValidRequest, 'Invalid request to add user operation');\n}\n\n/**\n * Validate the options when adding a user operation.\n *\n * @param options - The options to validate.\n */\nexport function validateAddUserOperationOptions(\n options: AddUserOperationOptions,\n) {\n const ValidOptions = object({\n networkClientId: string(),\n origin: string(),\n requireApproval: optional(boolean()),\n smartContractAccount: optional(\n object({\n prepareUserOperation: func(),\n updateUserOperation: func(),\n signUserOperation: func(),\n }),\n ),\n swaps: optional(\n object({\n approvalTxId: optional(string()),\n destinationTokenAddress: optional(string()),\n destinationTokenDecimals: optional(number()),\n destinationTokenSymbol: optional(string()),\n estimatedBaseFee: optional(string()),\n sourceTokenSymbol: optional(string()),\n swapMetaData: optional(object()),\n swapTokenValue: optional(string()),\n destinationTokenAmount: optional(string()),\n sourceTokenAddress: optional(string()),\n sourceTokenAmount: optional(string()),\n sourceTokenDecimals: optional(number()),\n swapAndSendRecipient: optional(string()),\n }),\n ),\n type: optional(enums(Object.values(TransactionType))),\n });\n\n validate(options, ValidOptions, 'Invalid options to add user operation');\n}\n\n/**\n * Validate the response from a smart contract account when preparing the user operation.\n *\n * @param response - The response to validate.\n */\nexport function validatePrepareUserOperationResponse(\n response: PrepareUserOperationResponse,\n) {\n const Hex = defineHex();\n const HexOrEmptyBytes = defineHexOrEmptyBytes();\n\n const ValidResponse = refine(\n object({\n bundler: string(),\n callData: Hex,\n dummyPaymasterAndData: optional(HexOrEmptyBytes),\n dummySignature: optional(HexOrEmptyBytes),\n gas: optional(\n object({\n callGasLimit: Hex,\n preVerificationGas: Hex,\n verificationGasLimit: Hex,\n }),\n ),\n initCode: optional(HexOrEmptyBytes),\n nonce: Hex,\n sender: Hex,\n }),\n 'ValidPrepareUserOperationResponse',\n ({ gas, dummySignature }) => {\n if (!gas && (!dummySignature || dummySignature === EMPTY_BYTES)) {\n return 'Must specify dummySignature if not specifying gas';\n }\n\n /* istanbul ignore next */\n return true;\n },\n );\n\n validate(\n response,\n ValidResponse,\n 'Invalid response when preparing user operation',\n );\n}\n\n/**\n * Validate the response from a smart contract account when updating the user operation.\n *\n * @param response - The response to validate.\n */\nexport function validateUpdateUserOperationResponse(\n response: UpdateUserOperationResponse,\n) {\n const ValidResponse = optional(\n object({\n paymasterAndData: optional(defineHexOrEmptyBytes()),\n callGasLimit: optional(defineHexOrEmptyBytes()),\n preVerificationGas: optional(defineHexOrEmptyBytes()),\n verificationGasLimit: optional(defineHexOrEmptyBytes()),\n }),\n );\n\n validate(\n response,\n ValidResponse,\n 'Invalid response when updating user operation',\n );\n}\n\n/**\n * Validate the response from a smart contract account when signing the user operation.\n *\n * @param response - The response to validate.\n */\nexport function validateSignUserOperationResponse(\n response: SignUserOperationResponse,\n) {\n const Hex = defineHex();\n\n const ValidResponse = object({\n signature: Hex,\n });\n\n validate(\n response,\n ValidResponse,\n 'Invalid response when signing user operation',\n );\n}\n\n/**\n * Validate data against a struct.\n *\n * @param data - The data to validate.\n * @param struct - The struct to validate against.\n * @param message - The message to throw if validation fails.\n */\nfunction validate<T>(data: unknown, struct: Struct<T>, message: string) {\n try {\n assert(data, struct, message);\n } catch (error) {\n const causes = (error as StructError)\n .failures()\n .map((failure) => {\n if (!failure.path.length) {\n return failure.message;\n }\n\n return `${failure.path.join('.')} - ${failure.message}`;\n })\n .join('\\n');\n\n const finalMessage = `${message}\\n${causes}`;\n\n throw new Error(finalMessage);\n }\n}\n\n/**\n * Define the Hex type used by superstruct.\n *\n * @returns The Hex superstruct type.\n */\nfunction defineHex() {\n return define<string>('Hexadecimal String', (value) =>\n isStrictHexString(value),\n );\n}\n\n/**\n * Define the HexOrEmptyBytes type used by superstruct.\n *\n * @returns The HexOrEmptyBytes superstruct type.\n */\nfunction defineHexOrEmptyBytes() {\n return define<string>(\n 'Hexadecimal String or 0x',\n (value) => isStrictHexString(value) || value === EMPTY_BYTES,\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/user-operation-controller",
3
- "version": "41.2.9-preview-3866c0ff1",
3
+ "version": "41.2.9-preview-e3275932a",
4
4
  "description": "Creates user operations and manages their life cycle",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -18,12 +18,19 @@
18
18
  "files": [
19
19
  "dist/"
20
20
  ],
21
- "type": "module",
22
21
  "sideEffects": false,
22
+ "main": "./dist/index.cjs",
23
+ "types": "./dist/index.d.cts",
23
24
  "exports": {
24
25
  ".": {
25
- "types": "./dist/index.d.ts",
26
- "default": "./dist/index.js"
26
+ "import": {
27
+ "types": "./dist/index.d.mts",
28
+ "default": "./dist/index.mjs"
29
+ },
30
+ "require": {
31
+ "types": "./dist/index.d.cts",
32
+ "default": "./dist/index.cjs"
33
+ }
27
34
  },
28
35
  "./package.json": "./package.json"
29
36
  },
@@ -32,11 +39,9 @@
32
39
  "registry": "https://registry.npmjs.org/"
33
40
  },
34
41
  "scripts": {
35
- "build": "tsc --project tsconfig.build.json",
36
- "build:all": "tsc --build tsconfig.build.json --verbose",
37
- "build:clean": "yarn build:only-clean && yarn build",
42
+ "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
43
+ "build:all": "ts-bridge --project tsconfig.build.json --verbose --clean",
38
44
  "build:docs": "typedoc",
39
- "build:only-clean": "rimraf './dist' './tsconfig.build.tsbuildinfo'",
40
45
  "changelog:update": "../../scripts/update-changelog.sh @metamask/user-operation-controller",
41
46
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/user-operation-controller",
42
47
  "lint:tsconfigs": "tsx ../../scripts/lint-tsconfigs/lint-tsconfigs.mts",
@@ -66,27 +71,26 @@
66
71
  "@metamask/utils": "^11.11.0",
67
72
  "bn.js": "^5.2.1",
68
73
  "immer": "^9.0.6",
69
- "lodash-es": "^4.17.21",
74
+ "lodash": "^4.17.21",
70
75
  "uuid": "^8.3.2"
71
76
  },
72
77
  "devDependencies": {
73
78
  "@metamask/auto-changelog": "^6.1.0",
74
79
  "@metamask/eth-block-tracker": "^15.0.0",
80
+ "@ts-bridge/cli": "^0.6.4",
75
81
  "@types/jest": "^30.0.0",
76
- "@typescript/native": "npm:typescript@^7.0.2",
77
82
  "deepmerge": "^4.2.2",
78
83
  "jest": "^30.4.2",
79
- "rimraf": "^5.0.5",
80
84
  "ts-jest": "^29.4.11",
81
85
  "tsx": "^4.20.5",
82
86
  "typedoc": "^0.25.13",
83
87
  "typedoc-plugin-missing-exports": "^2.0.0",
84
- "typescript": "npm:@typescript/typescript6@^6.0.2"
88
+ "typescript": "~5.3.3"
85
89
  },
86
90
  "peerDependencies": {
87
91
  "@metamask/eth-block-tracker": ">=9"
88
92
  },
89
93
  "engines": {
90
- "node": "^22.14.0 || ^24"
94
+ "node": "^18.18 || >=20"
91
95
  }
92
96
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"BlockTrackerPollingController.d.ts","sourceRoot":"","sources":["../src/BlockTrackerPollingController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAIL,iBAAiB,EAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AA4EF,cAAM,KAAK;CAAG;AAEd,eAAO,MAAM,iCAAiC,GAC5C,YAAY,SAAS,wBAAwB;+CAnDA,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC;2CAG9C,eAAe,GAC/B,aAAa,GAAG,SAAS;wCAEQ,IAAI;yCAqBH,iBAAiB,GA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,CAAC;gBACnE,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CACb,uDAAuD,KAAK,CAAC,eAAe,EAAE,CAC/E,CAAC;YACJ,CAAC;QACH,CAAC;QAED,+BAA+B,CAAC,GAAsB;YACpD,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5C,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAC9C,eAAkC,CACnC,CAAC;YAEF,IAAI,aAAa,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;gBAC5C,IAAI,QAAQ,EAAE,CAAC;oBACb,gFAAgF;oBAChF,kEAAkE;oBAClE,aAAa,CAAC,YAAY,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBAC9D,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;gBACpC,CAAC;YACH,CAAC;QACH,CAAC;KACF;IAED,OAAO,6BAA6B,CAAC;AACvC,CAAC;AAED,MAAM,KAAK;CAAG;AAEd,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAK7C,EAAE,CAAC,kCAAkC,CAA6B,KAAK,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAKzC,EAAE,CACJ,kCAAkC,CAChC,cAAc,CACf,CAAC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type {\n NetworkClientId,\n NetworkClient,\n} from '@metamask/network-controller';\nimport {\n AbstractPollingControllerBaseMixin,\n getKey,\n Constructor,\n PollingTokenSetId,\n} from '@metamask/polling-controller';\nimport type { Json } from '@metamask/utils';\n\n/**\n * The minimum input required to start polling for a {@link BlockTrackerPollingController}.\n * Implementing classes may provide additional properties.\n */\nexport type BlockTrackerPollingInput = {\n networkClientId: NetworkClientId;\n};\n\n/**\n * BlockTrackerPollingControllerMixin\n * A polling controller that polls using a block tracker.\n *\n * @param Base - The base class to mix onto.\n * @returns The composed class.\n */\n// This is a function that's used as class, and the return type is inferred from\n// the class defined inside the function scope, so this can't be easily typed.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/naming-convention\nfunction BlockTrackerPollingControllerMixin<\n TBase extends Constructor,\n PollingInput extends BlockTrackerPollingInput,\n>(Base: TBase) {\n abstract class BlockTrackerPollingController extends AbstractPollingControllerBaseMixin<\n TBase,\n PollingInput\n >(Base) {\n // This field is public (rather than using `#`) so that declaration\n // emission can describe it. Private/protected members on the class\n // returned by an exported mixin function trigger TS4094, and giving the\n // mixin an explicit return type to work around that breaks consumers\n // that supply the base class's own type arguments via\n // `BlockTrackerPollingController()<Name, State, Messenger>`. The\n // leading underscore signals \"internal, do not use\" without needing\n // true privacy.\n _activeListeners: Record<string, (options: Json) => Promise<void>> = {};\n\n abstract _getNetworkClientById(\n networkClientId: NetworkClientId,\n ): NetworkClient | undefined;\n\n _startPolling(input: PollingInput): void {\n const key = getKey(input);\n\n if (this._activeListeners[key]) {\n return;\n }\n\n const networkClient = this._getNetworkClientById(input.networkClientId);\n if (networkClient) {\n const updateOnNewBlock = this._executePoll.bind(this, input);\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n networkClient.blockTracker.addListener('latest', updateOnNewBlock);\n this._activeListeners[key] = updateOnNewBlock;\n } else {\n throw new Error(\n `Unable to retrieve blockTracker for networkClientId ${input.networkClientId}`,\n );\n }\n }\n\n _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void {\n const { networkClientId } = JSON.parse(key);\n const networkClient = this._getNetworkClientById(\n networkClientId as NetworkClientId,\n );\n\n if (networkClient && this._activeListeners[key]) {\n const listener = this._activeListeners[key];\n if (listener) {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n networkClient.blockTracker.removeListener('latest', listener);\n delete this._activeListeners[key];\n }\n }\n }\n }\n\n return BlockTrackerPollingController;\n}\n\nclass Empty {}\n\nexport const BlockTrackerPollingControllerOnly = <\n PollingInput extends BlockTrackerPollingInput,\n // The return type is inferred from the class defined inside the function\n // scope, so this can't be easily typed.\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n>() => BlockTrackerPollingControllerMixin<typeof Empty, PollingInput>(Empty);\n\nexport const BlockTrackerPollingController = <\n PollingInput extends BlockTrackerPollingInput,\n // The return type is inferred from the class defined inside the function\n // scope, so this can't be easily typed.\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n>() =>\n BlockTrackerPollingControllerMixin<typeof BaseController, PollingInput>(\n BaseController,\n );\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserOperationController-method-action-types.d.ts","sourceRoot":"","sources":["../src/UserOperationController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAE5E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;CACtD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,4DAA4D,GAAG;IACzE,IAAI,EAAE,yDAAyD,CAAC;IAChE,OAAO,EAAE,uBAAuB,CAAC,iCAAiC,CAAC,CAAC;CACrE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,0DAA0D,GAAG;IACvE,IAAI,EAAE,uDAAuD,CAAC;IAC9D,OAAO,EAAE,uBAAuB,CAAC,+BAA+B,CAAC,CAAC;CACnE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAC5C,6CAA6C,GAC7C,4DAA4D,GAC5D,0DAA0D,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserOperationController-method-action-types.js","sourceRoot":"","sources":["../src/UserOperationController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { UserOperationController } from './UserOperationController.js';\n\n/**\n * Create and submit a user operation.\n *\n * @param request - Information required to create a user operation.\n * @param request.data - Data to include in the resulting transaction.\n * @param request.maxFeePerGas - Maximum fee per gas to pay towards the transaction.\n * @param request.maxPriorityFeePerGas - Maximum priority fee per gas to pay towards the transaction.\n * @param request.to - Destination address of the resulting transaction.\n * @param request.value - Value to include in the resulting transaction.\n * @param options - Configuration options when creating a user operation.\n * @param options.networkClientId - ID of the network client used to query the chain.\n * @param options.origin - Origin of the user operation, such as the hostname of a dApp.\n * @param options.requireApproval - Whether to require user approval before submitting the user operation. Defaults to true.\n * @param options.smartContractAccount - Smart contract abstraction to provide the contract specific values such as call data and nonce. Defaults to the current snap account.\n * @param options.swaps - Swap metadata to record with the user operation.\n * @param options.type - Type of the transaction.\n */\nexport type UserOperationControllerAddUserOperationAction = {\n type: `UserOperationController:addUserOperation`;\n handler: UserOperationController['addUserOperation'];\n};\n\n/**\n * Create and submit a user operation equivalent to the provided transaction.\n *\n * @param transaction - Transaction to use as the basis for the user operation.\n * @param options - Configuration options when creating a user operation.\n * @param options.networkClientId - ID of the network client used to query the chain.\n * @param options.origin - Origin of the user operation, such as the hostname of a dApp.\n * @param options.requireApproval - Whether to require user approval before submitting the user operation. Defaults to true.\n * @param options.smartContractAccount - Smart contract abstraction to provide the contract specific values such as call data and nonce. Defaults to the current snap account.\n * @param options.swaps - Swap metadata to record with the user operation.\n * @param options.type - Type of the transaction.\n */\nexport type UserOperationControllerAddUserOperationFromTransactionAction = {\n type: `UserOperationController:addUserOperationFromTransaction`;\n handler: UserOperationController['addUserOperationFromTransaction'];\n};\n\n/**\n * Starts polling for pending user operations on the given network.\n *\n * @param networkClientId - The ID of the network client to poll.\n * @returns The polling token that can be used to stop polling.\n */\nexport type UserOperationControllerStartPollingByNetworkClientIdAction = {\n type: `UserOperationController:startPollingByNetworkClientId`;\n handler: UserOperationController['startPollingByNetworkClientId'];\n};\n\n/**\n * Union of all UserOperationController action types.\n */\nexport type UserOperationControllerMethodActions =\n | UserOperationControllerAddUserOperationAction\n | UserOperationControllerAddUserOperationFromTransactionAction\n | UserOperationControllerStartPollingByNetworkClientIdAction;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserOperationController.d.ts","sourceRoot":"","sources":["../src/UserOperationController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kCAAkC,EAEnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EACV,2CAA2C,EAC3C,yCAAyC,EACzC,wCAAwC,EACzC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EACV,2CAA2C,EAE5C,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,kCAAkC,CAAC;AAI1C,OAAO,YAAY,MAAM,QAAQ,CAAC;AASlC,OAAO,KAAK,EACV,oBAAoB,EAEpB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,kDAAkD,CAAC;AAY7G,QAAA,MAAM,cAAc,4BAA4B,CAAC;AAqBjD,KAAK,MAAM,GAAG;IACZ,qB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