@metamask-previews/user-operation-controller 40.0.0-preview-9941fe9 → 40.0.0-preview-ba016213

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 (63) hide show
  1. package/dist/UserOperationController.cjs +4 -0
  2. package/dist/UserOperationController.cjs.map +1 -1
  3. package/dist/UserOperationController.d.cts.map +1 -1
  4. package/dist/UserOperationController.d.mts.map +1 -1
  5. package/dist/UserOperationController.mjs +4 -0
  6. package/dist/UserOperationController.mjs.map +1 -1
  7. package/dist/helpers/Bundler.cjs +5 -3
  8. package/dist/helpers/Bundler.cjs.map +1 -1
  9. package/dist/helpers/Bundler.d.cts +0 -2
  10. package/dist/helpers/Bundler.d.cts.map +1 -1
  11. package/dist/helpers/Bundler.d.mts +0 -2
  12. package/dist/helpers/Bundler.d.mts.map +1 -1
  13. package/dist/helpers/Bundler.mjs +5 -3
  14. package/dist/helpers/Bundler.mjs.map +1 -1
  15. package/dist/helpers/PendingUserOperationTracker.cjs +1 -1
  16. package/dist/helpers/PendingUserOperationTracker.cjs.map +1 -1
  17. package/dist/helpers/PendingUserOperationTracker.d.cts +1 -1
  18. package/dist/helpers/PendingUserOperationTracker.d.cts.map +1 -1
  19. package/dist/helpers/PendingUserOperationTracker.d.mts +1 -1
  20. package/dist/helpers/PendingUserOperationTracker.d.mts.map +1 -1
  21. package/dist/helpers/PendingUserOperationTracker.mjs +1 -1
  22. package/dist/helpers/PendingUserOperationTracker.mjs.map +1 -1
  23. package/dist/helpers/SnapSmartContractAccount.cjs.map +1 -1
  24. package/dist/helpers/SnapSmartContractAccount.mjs.map +1 -1
  25. package/dist/types.cjs.map +1 -1
  26. package/dist/types.d.cts +0 -3
  27. package/dist/types.d.cts.map +1 -1
  28. package/dist/types.d.mts +0 -3
  29. package/dist/types.d.mts.map +1 -1
  30. package/dist/types.mjs.map +1 -1
  31. package/dist/utils/gas-fees.cjs +0 -7
  32. package/dist/utils/gas-fees.cjs.map +1 -1
  33. package/dist/utils/gas-fees.d.cts +0 -1
  34. package/dist/utils/gas-fees.d.cts.map +1 -1
  35. package/dist/utils/gas-fees.d.mts +0 -1
  36. package/dist/utils/gas-fees.d.mts.map +1 -1
  37. package/dist/utils/gas-fees.mjs +0 -7
  38. package/dist/utils/gas-fees.mjs.map +1 -1
  39. package/dist/utils/gas.cjs +0 -2
  40. package/dist/utils/gas.cjs.map +1 -1
  41. package/dist/utils/gas.d.cts +0 -1
  42. package/dist/utils/gas.d.cts.map +1 -1
  43. package/dist/utils/gas.d.mts +0 -1
  44. package/dist/utils/gas.d.mts.map +1 -1
  45. package/dist/utils/gas.mjs +0 -2
  46. package/dist/utils/gas.mjs.map +1 -1
  47. package/dist/utils/transaction.cjs +0 -2
  48. package/dist/utils/transaction.cjs.map +1 -1
  49. package/dist/utils/transaction.d.cts +0 -1
  50. package/dist/utils/transaction.d.cts.map +1 -1
  51. package/dist/utils/transaction.d.mts +0 -1
  52. package/dist/utils/transaction.d.mts.map +1 -1
  53. package/dist/utils/transaction.mjs +0 -2
  54. package/dist/utils/transaction.mjs.map +1 -1
  55. package/dist/utils/validation.cjs +2 -8
  56. package/dist/utils/validation.cjs.map +1 -1
  57. package/dist/utils/validation.d.cts +0 -5
  58. package/dist/utils/validation.d.cts.map +1 -1
  59. package/dist/utils/validation.d.mts +0 -5
  60. package/dist/utils/validation.d.mts.map +1 -1
  61. package/dist/utils/validation.mjs +2 -8
  62. package/dist/utils/validation.mjs.map +1 -1
  63. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ /* eslint-disable jsdoc/require-jsdoc */
1
2
  var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
3
  if (kind === "m") throw new TypeError("Private method is not writable");
3
4
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
@@ -36,7 +37,6 @@ export class Bundler {
36
37
  }
37
38
  /**
38
39
  * Retrieve the receipt for a user operation.
39
- *
40
40
  * @param hash - The hash of the user operation.
41
41
  * @returns The receipt for the user operation, or `undefined` if the user operation is pending.
42
42
  */
@@ -46,7 +46,6 @@ export class Bundler {
46
46
  }
47
47
  /**
48
48
  * Submit a user operation to the bundler.
49
- *
50
49
  * @param userOperation - The signed user operation to submit.
51
50
  * @param entrypoint - The address of entrypoint to use for the user operation.
52
51
  * @returns The hash of the user operation.
@@ -65,7 +64,10 @@ export class Bundler {
65
64
  return hash;
66
65
  }
67
66
  }
68
- _Bundler_url = new WeakMap(), _Bundler_instances = new WeakSet(), _Bundler_query = async function _Bundler_query(method, params) {
67
+ _Bundler_url = new WeakMap(), _Bundler_instances = new WeakSet(), _Bundler_query =
68
+ // TODO: Either fix this lint violation or explain why it's necessary to ignore.
69
+ // eslint-disable-next-line @typescript-eslint/naming-convention
70
+ async function _Bundler_query(method, params) {
69
71
  const request = {
70
72
  method: 'POST',
71
73
  headers: {
@@ -1 +1 @@
1
- {"version":3,"file":"Bundler.mjs","sourceRoot":"","sources":["../../src/helpers/Bundler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,sBAAkB;AAG9D,MAAM,GAAG,GAAG,kBAAkB,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AAoBzD;;GAEG;AACH,MAAM,OAAO,OAAO;IAGlB,YAAY,GAAW;;QAFd,+BAAa;QAGpB,uBAAA,IAAI,gBAAQ,GAAG,MAAA,CAAC;IAClB,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,wBAAwB,CAC5B,aAA4B,EAC5B,UAAkB;QAElB,GAAG,CAAC,gBAAgB,EAAE,EAAE,GAAG,EAAE,uBAAA,IAAI,oBAAK,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAC;QAErE,MAAM,QAAQ,GAA4C,MAAM,uBAAA,IAAI,0CAAO,MAAX,IAAI,EAClE,8BAA8B,EAC9B,CAAC,aAAa,EAAE,UAAU,CAAC,CAC5B,CAAC;QAEF,GAAG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,KAAK,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;QAEzE,KAA2C,CAAC,IAAI;YAC/C,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;QAE1B,MAAM,KAAK,CAAC;IACd,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,CAAC;AAC7B,CAAC","sourcesContent":["import { createModuleLogger, projectLogger } from '../logger';\nimport type { UserOperation, UserOperationReceipt } from '../types';\n\nconst log = createModuleLogger(projectLogger, 'bundler');\n\n/**\n * Response from the `eth_estimateUserOperationGas` bundler method.\n * Includes the estimated gas limits required by a user operation.\n */\nexport type BundlerEstimateUserOperationGasResponse = {\n /** Estimated gas required to compensate the bundler for any pre-verification. */\n preVerificationGas: number | string;\n\n /** Estimated gas required to verify the user operation. */\n verificationGas?: number | string;\n\n /** Estimated gas required to verify the user operation. */\n verificationGasLimit?: number | string;\n\n /** Estimated gas required for the execution of the user operation. */\n callGasLimit: number | string;\n};\n\n/**\n * A helper class for interacting with a bundler.\n */\nexport class Bundler {\n readonly #url: string;\n\n constructor(url: string) {\n this.#url = url;\n }\n\n /**\n * Estimate the gas required to execute a user operation.\n *\n * @param userOperation - The user operation to estimate gas for.\n * @param entrypoint - The address of entrypoint to use for the user operation.\n * @returns The estimated gas limits for the user operation.\n */\n async estimateUserOperationGas(\n userOperation: UserOperation,\n entrypoint: string,\n ): Promise<BundlerEstimateUserOperationGasResponse> {\n log('Estimating gas', { url: this.#url, userOperation, entrypoint });\n\n const response: BundlerEstimateUserOperationGasResponse = await this.#query(\n 'eth_estimateUserOperationGas',\n [userOperation, entrypoint],\n );\n\n log('Estimated gas', { response });\n\n return response;\n }\n\n /**\n * Retrieve the receipt for a user operation.\n *\n * @param hash - The hash of the user operation.\n * @returns The receipt for the user operation, or `undefined` if the user operation is pending.\n */\n async getUserOperationReceipt(\n hash?: string,\n ): Promise<UserOperationReceipt | undefined> {\n log('Getting user operation receipt', { url: this.#url, hash });\n\n return await this.#query<UserOperationReceipt | undefined>(\n 'eth_getUserOperationReceipt',\n [hash],\n );\n }\n\n /**\n * Submit a user operation to the bundler.\n *\n * @param userOperation - The signed user operation to submit.\n * @param entrypoint - The address of entrypoint to use for the user operation.\n * @returns The hash of the user operation.\n */\n async sendUserOperation(\n userOperation: UserOperation,\n entrypoint: string,\n ): Promise<string> {\n log('Sending user operation', {\n url: this.#url,\n userOperation,\n entrypoint,\n });\n\n const hash: string = await this.#query('eth_sendUserOperation', [\n userOperation,\n entrypoint,\n ]);\n\n log('Sent user operation', hash);\n\n return hash;\n }\n\n async #query<T>(method: string, params: unknown[]): Promise<T> {\n const request = {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params }),\n };\n\n const response = await fetch(this.#url, request);\n const responseJson = await response.json();\n\n if (responseJson.error) {\n const error = new Error(responseJson.error.message || responseJson.error);\n\n (error as unknown as Record<string, string>).code =\n responseJson.error.code;\n\n throw error;\n }\n\n return responseJson.result;\n }\n}\n"]}
1
+ {"version":3,"file":"Bundler.mjs","sourceRoot":"","sources":["../../src/helpers/Bundler.ts"],"names":[],"mappings":"AAAA,wCAAwC;;;;;;;;;;;;;AAExC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,sBAAkB;AAG9D,MAAM,GAAG,GAAG,kBAAkB,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AAoBzD;;GAEG;AACH,MAAM,OAAO,OAAO;IAGlB,YAAY,GAAW;;QAFvB,+BAAa;QAGX,uBAAA,IAAI,gBAAQ,GAAG,MAAA,CAAC;IAClB,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,wBAAwB,CAC5B,aAA4B,EAC5B,UAAkB;QAElB,GAAG,CAAC,gBAAgB,EAAE,EAAE,GAAG,EAAE,uBAAA,IAAI,oBAAK,EAAE,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MAAM,EAAE,CAAC;KAChE,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,uBAAA,IAAI,oBAAK,EAAE,OAAO,CAAC,CAAC;IACjD,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAE3C,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;QAEzE,KAA2C,CAAC,IAAI;YAC/C,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;QAE1B,MAAM,KAAK,CAAC;IACd,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,CAAC;AAC7B,CAAC","sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\n\nimport { createModuleLogger, projectLogger } from '../logger';\nimport type { UserOperation, UserOperationReceipt } from '../types';\n\nconst log = createModuleLogger(projectLogger, 'bundler');\n\n/**\n * Response from the `eth_estimateUserOperationGas` bundler method.\n * Includes the estimated gas limits required by a user operation.\n */\nexport type BundlerEstimateUserOperationGasResponse = {\n /** Estimated gas required to compensate the bundler for any pre-verification. */\n preVerificationGas: number | string;\n\n /** Estimated gas required to verify the user operation. */\n verificationGas?: number | string;\n\n /** Estimated gas required to verify the user operation. */\n verificationGasLimit?: number | string;\n\n /** Estimated gas required for the execution of the user operation. */\n callGasLimit: number | string;\n};\n\n/**\n * A helper class for interacting with a bundler.\n */\nexport class Bundler {\n #url: string;\n\n constructor(url: string) {\n this.#url = url;\n }\n\n /**\n * Estimate the gas required to execute a user operation.\n *\n * @param userOperation - The user operation to estimate gas for.\n * @param entrypoint - The address of entrypoint to use for the user operation.\n * @returns The estimated gas limits for the user operation.\n */\n async estimateUserOperationGas(\n userOperation: UserOperation,\n entrypoint: string,\n ): Promise<BundlerEstimateUserOperationGasResponse> {\n log('Estimating gas', { url: this.#url, userOperation, entrypoint });\n\n const response: BundlerEstimateUserOperationGasResponse = await this.#query(\n 'eth_estimateUserOperationGas',\n [userOperation, entrypoint],\n );\n\n log('Estimated gas', { response });\n\n return response;\n }\n\n /**\n * Retrieve the receipt for a user operation.\n * @param hash - The hash of the user operation.\n * @returns The receipt for the user operation, or `undefined` if the user operation is pending.\n */\n async getUserOperationReceipt(\n hash?: string,\n ): Promise<UserOperationReceipt | undefined> {\n log('Getting user operation receipt', { url: this.#url, hash });\n\n return await this.#query<UserOperationReceipt | undefined>(\n 'eth_getUserOperationReceipt',\n [hash],\n );\n }\n\n /**\n * Submit a user operation to the bundler.\n * @param userOperation - The signed user operation to submit.\n * @param entrypoint - The address of entrypoint to use for the user operation.\n * @returns The hash of the user operation.\n */\n async sendUserOperation(\n userOperation: UserOperation,\n entrypoint: string,\n ): Promise<string> {\n log('Sending user operation', {\n url: this.#url,\n userOperation,\n entrypoint,\n });\n\n const hash: string = await this.#query('eth_sendUserOperation', [\n userOperation,\n entrypoint,\n ]);\n\n log('Sent user operation', hash);\n\n return hash;\n }\n\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n async #query<T>(method: string, params: unknown[]): Promise<T> {\n const request = {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params }),\n };\n\n const response = await fetch(this.#url, request);\n const responseJson = await response.json();\n\n if (responseJson.error) {\n const error = new Error(responseJson.error.message || responseJson.error);\n\n (error as unknown as Record<string, string>).code =\n responseJson.error.code;\n\n throw error;\n }\n\n return responseJson.result;\n }\n}\n"]}
@@ -23,9 +23,9 @@ const utils_1 = require("@metamask/utils");
23
23
  // This package purposefully relies on Node's EventEmitter module.
24
24
  // eslint-disable-next-line import-x/no-nodejs-modules
25
25
  const events_1 = __importDefault(require("events"));
26
- const Bundler_1 = require("./Bundler.cjs");
27
26
  const logger_1 = require("../logger.cjs");
28
27
  const types_1 = require("../types.cjs");
28
+ const Bundler_1 = require("./Bundler.cjs");
29
29
  const log = (0, utils_1.createModuleLogger)(logger_1.projectLogger, 'pending-user-operations');
30
30
  /**
31
31
  * A helper class to periodically query the bundlers
@@ -1 +1 @@
1
- {"version":3,"file":"PendingUserOperationTracker.cjs","sourceRoot":"","sources":["../../src/helpers/PendingUserOperationTracker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iEAA0D;AAC1D,oEAA2C;AAM3C,qEAAiF;AACjF,2CAA+D;AAC/D,kEAAkE;AAClE,sDAAsD;AACtD,oDAAkC;AAElC,2CAAoC;AACpC,0CAA0C;AAE1C,wCAA+C;AAG/C,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,sBAAa,EAAE,yBAAyB,CAAC,CAAC;AA2BzE;;;GAGG;AACH,MAAa,2BAA4B,SAAQ,IAAA,sDAAiC,GAAoC;IAOpH,YAAY,EACV,iBAAiB,EACjB,SAAS,GAIV;QACC,KAAK,EAAE,CAAC;;QAXD,iEAAkD;QAElD,yDAA6C;QAWpD,IAAI,CAAC,GAAG,GAAG,IAAI,gBAAY,EAA6C,CAAC;QAEzE,uBAAA,IAAI,kDAAsB,iBAAiB,MAAA,CAAC;QAC5C,uBAAA,IAAI,0CAAc,SAAS,MAAA,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,EAAE,eAAe,EAAoC;QACtE,IAAI,CAAC;YACH,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,GAC7C,IAAI,CAAC,qBAAqB,CAAC,eAAe,CAAkB,CAAC;YAE/D,GAAG,CAAC,SAAS,EAAE;gBACb,WAAW,EAAE,YAAY,CAAC,eAAe,EAAE;gBAC3C,OAAO,EAAE,aAAa,CAAC,OAAO;aAC/B,CAAC,CAAC;YAEH,MAAM,uBAAA,IAAI,gGAAqB,MAAzB,IAAI,EAAsB,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACnE,CAAC;QAAC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AAK,EAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { query, toHex } from '@metamask/controller-utils';\nimport EthQuery from '@metamask/eth-query';\nimport type {\n NetworkClient,\n NetworkClientId,\n Provider,\n} from '@metamask/network-controller';\nimport { BlockTrackerPollingControllerOnly } from '@metamask/polling-controller';\nimport { createModuleLogger, type Hex } from '@metamask/utils';\n// This package purposefully relies on Node's EventEmitter module.\n// eslint-disable-next-line import-x/no-nodejs-modules\nimport EventEmitter from 'events';\n\nimport { Bundler } from './Bundler';\nimport { projectLogger } from '../logger';\nimport type { UserOperationMetadata, UserOperationReceipt } from '../types';\nimport { UserOperationStatus } from '../types';\nimport type { UserOperationControllerMessenger } from '../UserOperationController';\n\nconst log = createModuleLogger(projectLogger, 'pending-user-operations');\n\ntype Events = {\n 'user-operation-confirmed': [metadata: UserOperationMetadata];\n 'user-operation-failed': [txMeta: UserOperationMetadata, error: Error];\n 'user-operation-updated': [txMeta: UserOperationMetadata];\n};\n\nexport type PendingUserOperationTrackerEventEmitter = EventEmitter & {\n on<T extends keyof Events>(\n eventName: T,\n listener: (...args: Events[T]) => void,\n ): PendingUserOperationTrackerEventEmitter;\n\n once<T extends keyof Events>(\n eventName: T,\n listener: (...args: Events[T]) => void,\n ): PendingUserOperationTrackerEventEmitter;\n\n emit<T extends keyof Events>(eventName: T, ...args: Events[T]): boolean;\n};\n\n/** The input to start polling for the {@link PendingUserOperationTracker} */\ntype PendingUserOperationPollingInput = {\n networkClientId: NetworkClientId;\n};\n\n/**\n * A helper class to periodically query the bundlers\n * and update the status of any submitted user operations.\n */\nexport class PendingUserOperationTracker extends BlockTrackerPollingControllerOnly<PendingUserOperationPollingInput>() {\n hub: PendingUserOperationTrackerEventEmitter;\n\n readonly #getUserOperations: () => UserOperationMetadata[];\n\n readonly #messenger: UserOperationControllerMessenger;\n\n constructor({\n getUserOperations,\n messenger,\n }: {\n getUserOperations: () => UserOperationMetadata[];\n messenger: UserOperationControllerMessenger;\n }) {\n super();\n\n this.hub = new EventEmitter() as PendingUserOperationTrackerEventEmitter;\n\n this.#getUserOperations = getUserOperations;\n this.#messenger = messenger;\n }\n\n async _executePoll({ networkClientId }: PendingUserOperationPollingInput) {\n try {\n const { blockTracker, configuration, provider } =\n this._getNetworkClientById(networkClientId) as NetworkClient;\n\n log('Polling', {\n blockNumber: blockTracker.getCurrentBlock(),\n chainId: configuration.chainId,\n });\n\n await this.#checkUserOperations(configuration.chainId, provider);\n } catch (error) {\n /* istanbul ignore next */\n log('Failed to check user operations', error);\n }\n }\n\n _getNetworkClientById(networkClientId: string): NetworkClient | undefined {\n return this.#messenger.call(\n 'NetworkController:getNetworkClientById',\n networkClientId,\n );\n }\n\n async #checkUserOperations(chainId: string, provider: Provider) {\n const pendingUserOperations = this.#getPendingUserOperations().filter(\n (metadata) => metadata.chainId === chainId,\n );\n\n if (!pendingUserOperations.length) {\n log('No pending user operations to check');\n return;\n }\n\n log('Found pending user operations to check', {\n count: pendingUserOperations.length,\n ids: pendingUserOperations.map((userOperation) => userOperation.id),\n });\n\n await Promise.all(\n pendingUserOperations.map((userOperation) =>\n this.#checkUserOperation(userOperation, provider),\n ),\n );\n }\n\n async #checkUserOperation(\n metadata: UserOperationMetadata,\n provider: Provider,\n ) {\n const { bundlerUrl, hash, id } = metadata;\n\n if (!hash || !bundlerUrl) {\n log('Skipping user operation as missing hash or bundler', id);\n return;\n }\n\n try {\n const receipt = await this.#getUserOperationReceipt(hash, bundlerUrl);\n const isSuccess = receipt?.success;\n\n if (receipt && !isSuccess) {\n this.#onUserOperationFailed(metadata, receipt);\n return;\n }\n\n if (isSuccess) {\n await this.#onUserOperationConfirmed(metadata, receipt, provider);\n return;\n }\n\n log('No receipt found for user operation', { id, hash });\n } catch (error) {\n log('Failed to check user operation', id, error);\n }\n }\n\n async #onUserOperationConfirmed(\n metadata: UserOperationMetadata,\n receipt: UserOperationReceipt,\n provider: Provider,\n ) {\n const { id } = metadata;\n\n const {\n actualGasCost,\n actualGasUsed,\n receipt: { blockHash, transactionHash },\n } = receipt;\n\n log('User operation confirmed', id, transactionHash);\n\n const { baseFeePerGas } = await query(\n new EthQuery(provider),\n 'getBlockByHash',\n [blockHash, false],\n );\n\n metadata.actualGasCost = this.#normalizeGasValue(actualGasCost);\n metadata.actualGasUsed = this.#normalizeGasValue(actualGasUsed);\n metadata.baseFeePerGas = baseFeePerGas;\n metadata.status = UserOperationStatus.Confirmed;\n metadata.transactionHash = transactionHash;\n\n this.#updateUserOperation(metadata);\n\n this.hub.emit('user-operation-confirmed', metadata);\n }\n\n #onUserOperationFailed(\n metadata: UserOperationMetadata,\n _receipt: UserOperationReceipt,\n ) {\n const { id } = metadata;\n\n log('User operation failed', id);\n\n metadata.status = UserOperationStatus.Failed;\n\n this.#updateUserOperation(metadata);\n\n this.hub.emit(\n 'user-operation-failed',\n metadata,\n new Error('User operation receipt has failed status'),\n );\n }\n\n #getPendingUserOperations(): UserOperationMetadata[] {\n return this.#getUserOperations().filter(\n (userOperation) => userOperation.status === UserOperationStatus.Submitted,\n );\n }\n\n #updateUserOperation(metadata: UserOperationMetadata) {\n this.hub.emit('user-operation-updated', metadata);\n }\n\n async #getUserOperationReceipt(\n hash: string,\n bundlerUrl: string,\n ): Promise<UserOperationReceipt | undefined> {\n const bundler = new Bundler(bundlerUrl);\n return bundler.getUserOperationReceipt(hash);\n }\n\n #normalizeGasValue(gasValue: Hex | number): string {\n if (typeof gasValue === 'number') {\n return toHex(gasValue);\n }\n return gasValue;\n }\n}\n"]}
1
+ {"version":3,"file":"PendingUserOperationTracker.cjs","sourceRoot":"","sources":["../../src/helpers/PendingUserOperationTracker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iEAA0D;AAC1D,oEAA2C;AAM3C,qEAAiF;AACjF,2CAA+D;AAC/D,kEAAkE;AAClE,sDAAsD;AACtD,oDAAkC;AAElC,0CAA0C;AAE1C,wCAA+C;AAE/C,2CAAo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,GAAG,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;IAEjC,QAAQ,CAAC,MAAM,GAAG,2BAAmB,CAAC,MAAM,CAAC;IAE7C,uBAAA,IAAI,gGAAqB,MAAzB,IAAI,EAAsB,QAAQ,CAAC,CAAC;IAEpC,IAAI,CAAC,GAAG,CAAC,IAAI,CACX,uBAAuB,EACvB,QAAQ,EACR,IAAI,KAAK,CAAC,0CAA0C,CAAC,CACtD,CAAC;AACJ,CAAC;IAGC,OAAO,uBAAA,IAAI,sDAAmB,MAAvB,IAAI,CAAqB,CAAC,MAAM,CACrC,CAAC,aAAa,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,KAAK,2BAAmB,CAAC,SAAS,CAC1E,CAAC;AACJ,CAAC,+GAEoB,QAA+B;IAClD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAAC;AACpD,CAAC,yDAED,KAAK,+DACH,IAAY,EACZ,UAAkB;IAElB,MAAM,OAAO,GAAG,IAAI,iBAAO,CAAC,UAAU,CAAC,CAAC;IACxC,OAAO,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC,2GAEkB,QAAsB;IACvC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,IAAA,wBAAK,EAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { query, toHex } from '@metamask/controller-utils';\nimport EthQuery from '@metamask/eth-query';\nimport type {\n NetworkClient,\n NetworkClientId,\n Provider,\n} from '@metamask/network-controller';\nimport { BlockTrackerPollingControllerOnly } from '@metamask/polling-controller';\nimport { createModuleLogger, type Hex } from '@metamask/utils';\n// This package purposefully relies on Node's EventEmitter module.\n// eslint-disable-next-line import-x/no-nodejs-modules\nimport EventEmitter from 'events';\n\nimport { projectLogger } from '../logger';\nimport type { UserOperationMetadata, UserOperationReceipt } from '../types';\nimport { UserOperationStatus } from '../types';\nimport type { UserOperationControllerMessenger } from '../UserOperationController';\nimport { Bundler } from './Bundler';\n\nconst log = createModuleLogger(projectLogger, 'pending-user-operations');\n\ntype Events = {\n 'user-operation-confirmed': [metadata: UserOperationMetadata];\n 'user-operation-failed': [txMeta: UserOperationMetadata, error: Error];\n 'user-operation-updated': [txMeta: UserOperationMetadata];\n};\n\nexport type PendingUserOperationTrackerEventEmitter = EventEmitter & {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n on<T extends keyof Events>(\n eventName: T,\n listener: (...args: Events[T]) => void,\n ): PendingUserOperationTrackerEventEmitter;\n\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n once<T extends keyof Events>(\n eventName: T,\n listener: (...args: Events[T]) => void,\n ): PendingUserOperationTrackerEventEmitter;\n\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n emit<T extends keyof Events>(eventName: T, ...args: Events[T]): boolean;\n};\n\n/** The input to start polling for the {@link PendingUserOperationTracker} */\ntype PendingUserOperationPollingInput = {\n networkClientId: NetworkClientId;\n};\n\n/**\n * A helper class to periodically query the bundlers\n * and update the status of any submitted user operations.\n */\nexport class PendingUserOperationTracker extends BlockTrackerPollingControllerOnly<PendingUserOperationPollingInput>() {\n hub: PendingUserOperationTrackerEventEmitter;\n\n #getUserOperations: () => UserOperationMetadata[];\n\n #messenger: UserOperationControllerMessenger;\n\n constructor({\n getUserOperations,\n messenger,\n }: {\n getUserOperations: () => UserOperationMetadata[];\n messenger: UserOperationControllerMessenger;\n }) {\n super();\n\n this.hub = new EventEmitter() as PendingUserOperationTrackerEventEmitter;\n\n this.#getUserOperations = getUserOperations;\n this.#messenger = messenger;\n }\n\n async _executePoll({ networkClientId }: PendingUserOperationPollingInput) {\n try {\n const { blockTracker, configuration, provider } =\n this._getNetworkClientById(networkClientId) as NetworkClient;\n\n log('Polling', {\n blockNumber: blockTracker.getCurrentBlock(),\n chainId: configuration.chainId,\n });\n\n await this.#checkUserOperations(configuration.chainId, provider);\n } catch (error) {\n /* istanbul ignore next */\n log('Failed to check user operations', error);\n }\n }\n\n _getNetworkClientById(networkClientId: string): NetworkClient | undefined {\n return this.#messenger.call(\n 'NetworkController:getNetworkClientById',\n networkClientId,\n );\n }\n\n async #checkUserOperations(chainId: string, provider: Provider) {\n const pendingUserOperations = this.#getPendingUserOperations().filter(\n (metadata) => metadata.chainId === chainId,\n );\n\n if (!pendingUserOperations.length) {\n log('No pending user operations to check');\n return;\n }\n\n log('Found pending user operations to check', {\n count: pendingUserOperations.length,\n ids: pendingUserOperations.map((userOperation) => userOperation.id),\n });\n\n await Promise.all(\n pendingUserOperations.map((userOperation) =>\n this.#checkUserOperation(userOperation, provider),\n ),\n );\n }\n\n async #checkUserOperation(\n metadata: UserOperationMetadata,\n provider: Provider,\n ) {\n const { bundlerUrl, hash, id } = metadata;\n\n if (!hash || !bundlerUrl) {\n log('Skipping user operation as missing hash or bundler', id);\n return;\n }\n\n try {\n const receipt = await this.#getUserOperationReceipt(hash, bundlerUrl);\n const isSuccess = receipt?.success;\n\n if (receipt && !isSuccess) {\n this.#onUserOperationFailed(metadata, receipt);\n return;\n }\n\n if (isSuccess) {\n await this.#onUserOperationConfirmed(metadata, receipt, provider);\n return;\n }\n\n log('No receipt found for user operation', { id, hash });\n } catch (error) {\n log('Failed to check user operation', id, error);\n }\n }\n\n async #onUserOperationConfirmed(\n metadata: UserOperationMetadata,\n receipt: UserOperationReceipt,\n provider: Provider,\n ) {\n const { id } = metadata;\n\n const {\n actualGasCost,\n actualGasUsed,\n receipt: { blockHash, transactionHash },\n } = receipt;\n\n log('User operation confirmed', id, transactionHash);\n\n const { baseFeePerGas } = await query(\n new EthQuery(provider),\n 'getBlockByHash',\n [blockHash, false],\n );\n\n metadata.actualGasCost = this.#normalizeGasValue(actualGasCost);\n metadata.actualGasUsed = this.#normalizeGasValue(actualGasUsed);\n metadata.baseFeePerGas = baseFeePerGas;\n metadata.status = UserOperationStatus.Confirmed;\n metadata.transactionHash = transactionHash;\n\n this.#updateUserOperation(metadata);\n\n this.hub.emit('user-operation-confirmed', metadata);\n }\n\n #onUserOperationFailed(\n metadata: UserOperationMetadata,\n _receipt: UserOperationReceipt,\n ) {\n const { id } = metadata;\n\n log('User operation failed', id);\n\n metadata.status = UserOperationStatus.Failed;\n\n this.#updateUserOperation(metadata);\n\n this.hub.emit(\n 'user-operation-failed',\n metadata,\n new Error('User operation receipt has failed status'),\n );\n }\n\n #getPendingUserOperations(): UserOperationMetadata[] {\n return this.#getUserOperations().filter(\n (userOperation) => userOperation.status === UserOperationStatus.Submitted,\n );\n }\n\n #updateUserOperation(metadata: UserOperationMetadata) {\n this.hub.emit('user-operation-updated', metadata);\n }\n\n async #getUserOperationReceipt(\n hash: string,\n bundlerUrl: string,\n ): Promise<UserOperationReceipt | undefined> {\n const bundler = new Bundler(bundlerUrl);\n return bundler.getUserOperationReceipt(hash);\n }\n\n #normalizeGasValue(gasValue: Hex | number): string {\n if (typeof gasValue === 'number') {\n return toHex(gasValue);\n }\n return gasValue;\n }\n}\n"]}
@@ -23,7 +23,7 @@ declare const PendingUserOperationTracker_base: (abstract new (...args: any[]) =
23
23
  _startPolling(input: PendingUserOperationPollingInput): void;
24
24
  _stopPollingByPollingTokenSetId(key: string): void;
25
25
  readonly "__#3@#pollingTokenSets": Map<string, Set<string>>;
26
- readonly "__#3@#callbacks": Map<string, Set<(input: PendingUserOperationPollingInput) => void>>;
26
+ "__#3@#callbacks": Map<string, Set<(input: PendingUserOperationPollingInput) => void>>;
27
27
  _executePoll(input: PendingUserOperationPollingInput): Promise<void>;
28
28
  startPolling(input: PendingUserOperationPollingInput): string;
29
29
  stopAllPolling(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"PendingUserOperationTracker.d.cts","sourceRoot":"","sources":["../../src/helpers/PendingUserOper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C7E,KAAK,gCAAgC,GAAG;IACtC,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;;;;;;;;;;;;;;;;AAEF;;;GAGG;AACH,qBAAa,2BAA4B,SAAQ,gCAAqE;;IACpH,GAAG,EAAE,uCAAuC,CAAC;gBAMjC,EACV,iBAAiB,EACjB,SAAS,GACV,EAAE;QACD,iBAAiB,EAAE,MAAM,qBAAqB,EAAE,CAAC;QACjD,SAAS,EAAE,gCAAgC,CAAC;KAC7C;IASK,YAAY,CAAC,EAAE,eAAe,EAAE,EAAE,gCAAgC;IAiBxE,qBAAqB,CAAC,eAAe,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;CAuI1E"}
@@ -23,7 +23,7 @@ declare const PendingUserOperationTracker_base: (abstract new (...args: any[]) =
23
23
  _startPolling(input: PendingUserOperationPollingInput): void;
24
24
  _stopPollingByPollingTokenSetId(key: string): void;
25
25
  readonly "__#3@#pollingTokenSets": Map<string, Set<string>>;
26
- readonly "__#3@#callbacks": Map<string, Set<(input: PendingUserOperationPollingInput) => void>>;
26
+ "__#3@#callbacks": Map<string, Set<(input: PendingUserOperationPollingInput) => void>>;
27
27
  _executePoll(input: PendingUserOperationPollingInput): Promise<void>;
28
28
  startPolling(input: PendingUserOperationPollingInput): string;
29
29
  stopAllPolling(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"PendingUserOperationTracker.d.mts","sourceRoot":"","sources":["../../src/helpers/PendingUserOperationTracker.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAEhB,qCAAqC;AAKtC,OAAO,YAAY,eAAe;AAIlC,OAAO,KAAK,EAAE,qBAAqB,EAAwB,qBAAiB;AAE5E,OAAO,KAAK,EAAE,gCAAgC,EAAE,uCAAmC;AAInF,KAAK,MAAM,GAAG;IACZ,0BAA0B,EAAE,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;IAC9D,uBAAuB,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,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gCAAgC;IAiBxE,qBAAqB,CAAC,eAAe,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;CAuI1E"}
@@ -24,9 +24,9 @@ import { createModuleLogger } from "@metamask/utils";
24
24
  // This package purposefully relies on Node's EventEmitter module.
25
25
  // eslint-disable-next-line import-x/no-nodejs-modules
26
26
  import EventEmitter from "events";
27
- import { Bundler } from "./Bundler.mjs";
28
27
  import { projectLogger } from "../logger.mjs";
29
28
  import { UserOperationStatus } from "../types.mjs";
29
+ import { Bundler } from "./Bundler.mjs";
30
30
  const log = createModuleLogger(projectLogger, 'pending-user-operations');
31
31
  /**
32
32
  * A helper class to periodically query the bundlers
@@ -1 +1 @@
1
- {"version":3,"file":"PendingUserOperationTracker.mjs","sourceRoot":"","sources":["../../src/helpers/PendingUserOperationTracker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,mCAAmC;AAC1D,OAAO,SAAQ,4BAA4B;;AAM3C,OAAO,EAAE,iCAAiC,EAAE,qCAAqC;AACjF,OAAO,EAAE,kBAAkB,EAAY,wBAAwB;AAC/D,kEAAkE;AAClE,sDAAsD;AACtD,OAAO,YAAY,eAAe;AAElC,OAAO,EAAE,OAAO,EAAE,sBAAkB;AACpC,OAAO,EAAE,aAAa,EAAE,sBAAkB;AAE1C,OAAO,EAAE,mBAAmB,EAAE,qBAAiB;AAG/C,MAAM,GAAG,GAAG,kBAAkB,CAAC,aAAa,EAAE,yBAAyB,CAAC,CAAC;AA2BzE;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,iCAAiC,EAAoC;IAOpH,YAAY,EACV,iBAAiB,EACjB,SAAS,GAIV;QACC,KAAK,EAAE,CAAC;;QAXD,iEAAkD;QAElD,yDAA6C;QAWpD,IAAI,CAAC,GAAG,GAAG,IAAI,YAAY,EAA6C,CAAC;QAEzE,uBAAA,IAAI,kDAAsB,iBAAiB,MAAA,CAAC;QAC5C,uBAAA,IAA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,CAAC,aAAa,CAAC,MAAM,KAAK,mBAAmB,CAAC,SAAS,CAC1E,CAAC;AACJ,CAAC,+GAEoB,QAA+B;IAClD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAAC;AACpD,CAAC,yDAED,KAAK,+DACH,IAAY,EACZ,UAAkB;IAElB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,OAAO,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC,2GAEkB,QAAsB;IACvC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { query, toHex } from '@metamask/controller-utils';\nimport EthQuery from '@metamask/eth-query';\nimport type {\n NetworkClient,\n NetworkClientId,\n Provider,\n} from '@metamask/network-controller';\nimport { BlockTrackerPollingControllerOnly } from '@metamask/polling-controller';\nimport { createModuleLogger, type Hex } from '@metamask/utils';\n// This package purposefully relies on Node's EventEmitter module.\n// eslint-disable-next-line import-x/no-nodejs-modules\nimport EventEmitter from 'events';\n\nimport { Bundler } from './Bundler';\nimport { projectLogger } from '../logger';\nimport type { UserOperationMetadata, UserOperationReceipt } from '../types';\nimport { UserOperationStatus } from '../types';\nimport type { UserOperationControllerMessenger } from '../UserOperationController';\n\nconst log = createModuleLogger(projectLogger, 'pending-user-operations');\n\ntype Events = {\n 'user-operation-confirmed': [metadata: UserOperationMetadata];\n 'user-operation-failed': [txMeta: UserOperationMetadata, error: Error];\n 'user-operation-updated': [txMeta: UserOperationMetadata];\n};\n\nexport type PendingUserOperationTrackerEventEmitter = EventEmitter & {\n on<T extends keyof Events>(\n eventName: T,\n listener: (...args: Events[T]) => void,\n ): PendingUserOperationTrackerEventEmitter;\n\n once<T extends keyof Events>(\n eventName: T,\n listener: (...args: Events[T]) => void,\n ): PendingUserOperationTrackerEventEmitter;\n\n emit<T extends keyof Events>(eventName: T, ...args: Events[T]): boolean;\n};\n\n/** The input to start polling for the {@link PendingUserOperationTracker} */\ntype PendingUserOperationPollingInput = {\n networkClientId: NetworkClientId;\n};\n\n/**\n * A helper class to periodically query the bundlers\n * and update the status of any submitted user operations.\n */\nexport class PendingUserOperationTracker extends BlockTrackerPollingControllerOnly<PendingUserOperationPollingInput>() {\n hub: PendingUserOperationTrackerEventEmitter;\n\n readonly #getUserOperations: () => UserOperationMetadata[];\n\n readonly #messenger: UserOperationControllerMessenger;\n\n constructor({\n getUserOperations,\n messenger,\n }: {\n getUserOperations: () => UserOperationMetadata[];\n messenger: UserOperationControllerMessenger;\n }) {\n super();\n\n this.hub = new EventEmitter() as PendingUserOperationTrackerEventEmitter;\n\n this.#getUserOperations = getUserOperations;\n this.#messenger = messenger;\n }\n\n async _executePoll({ networkClientId }: PendingUserOperationPollingInput) {\n try {\n const { blockTracker, configuration, provider } =\n this._getNetworkClientById(networkClientId) as NetworkClient;\n\n log('Polling', {\n blockNumber: blockTracker.getCurrentBlock(),\n chainId: configuration.chainId,\n });\n\n await this.#checkUserOperations(configuration.chainId, provider);\n } catch (error) {\n /* istanbul ignore next */\n log('Failed to check user operations', error);\n }\n }\n\n _getNetworkClientById(networkClientId: string): NetworkClient | undefined {\n return this.#messenger.call(\n 'NetworkController:getNetworkClientById',\n networkClientId,\n );\n }\n\n async #checkUserOperations(chainId: string, provider: Provider) {\n const pendingUserOperations = this.#getPendingUserOperations().filter(\n (metadata) => metadata.chainId === chainId,\n );\n\n if (!pendingUserOperations.length) {\n log('No pending user operations to check');\n return;\n }\n\n log('Found pending user operations to check', {\n count: pendingUserOperations.length,\n ids: pendingUserOperations.map((userOperation) => userOperation.id),\n });\n\n await Promise.all(\n pendingUserOperations.map((userOperation) =>\n this.#checkUserOperation(userOperation, provider),\n ),\n );\n }\n\n async #checkUserOperation(\n metadata: UserOperationMetadata,\n provider: Provider,\n ) {\n const { bundlerUrl, hash, id } = metadata;\n\n if (!hash || !bundlerUrl) {\n log('Skipping user operation as missing hash or bundler', id);\n return;\n }\n\n try {\n const receipt = await this.#getUserOperationReceipt(hash, bundlerUrl);\n const isSuccess = receipt?.success;\n\n if (receipt && !isSuccess) {\n this.#onUserOperationFailed(metadata, receipt);\n return;\n }\n\n if (isSuccess) {\n await this.#onUserOperationConfirmed(metadata, receipt, provider);\n return;\n }\n\n log('No receipt found for user operation', { id, hash });\n } catch (error) {\n log('Failed to check user operation', id, error);\n }\n }\n\n async #onUserOperationConfirmed(\n metadata: UserOperationMetadata,\n receipt: UserOperationReceipt,\n provider: Provider,\n ) {\n const { id } = metadata;\n\n const {\n actualGasCost,\n actualGasUsed,\n receipt: { blockHash, transactionHash },\n } = receipt;\n\n log('User operation confirmed', id, transactionHash);\n\n const { baseFeePerGas } = await query(\n new EthQuery(provider),\n 'getBlockByHash',\n [blockHash, false],\n );\n\n metadata.actualGasCost = this.#normalizeGasValue(actualGasCost);\n metadata.actualGasUsed = this.#normalizeGasValue(actualGasUsed);\n metadata.baseFeePerGas = baseFeePerGas;\n metadata.status = UserOperationStatus.Confirmed;\n metadata.transactionHash = transactionHash;\n\n this.#updateUserOperation(metadata);\n\n this.hub.emit('user-operation-confirmed', metadata);\n }\n\n #onUserOperationFailed(\n metadata: UserOperationMetadata,\n _receipt: UserOperationReceipt,\n ) {\n const { id } = metadata;\n\n log('User operation failed', id);\n\n metadata.status = UserOperationStatus.Failed;\n\n this.#updateUserOperation(metadata);\n\n this.hub.emit(\n 'user-operation-failed',\n metadata,\n new Error('User operation receipt has failed status'),\n );\n }\n\n #getPendingUserOperations(): UserOperationMetadata[] {\n return this.#getUserOperations().filter(\n (userOperation) => userOperation.status === UserOperationStatus.Submitted,\n );\n }\n\n #updateUserOperation(metadata: UserOperationMetadata) {\n this.hub.emit('user-operation-updated', metadata);\n }\n\n async #getUserOperationReceipt(\n hash: string,\n bundlerUrl: string,\n ): Promise<UserOperationReceipt | undefined> {\n const bundler = new Bundler(bundlerUrl);\n return bundler.getUserOperationReceipt(hash);\n }\n\n #normalizeGasValue(gasValue: Hex | number): string {\n if (typeof gasValue === 'number') {\n return toHex(gasValue);\n }\n return gasValue;\n }\n}\n"]}
1
+ {"version":3,"file":"PendingUserOperationTracker.mjs","sourceRoot":"","sources":["../../src/helpers/PendingUserOperationTracker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,mCAAmC;AAC1D,OAAO,SAAQ,4BAA4B;;AAM3C,OAAO,EAAE,iCAAiC,EAAE,qCAAqC;AACjF,OAAO,EAAE,kBAAkB,EAAY,wBAAwB;AAC/D,kEAAkE;AAClE,sDAAsD;AACtD,OAAO,YAAY,eAAe;AAElC,OAAO,EAAE,aAAa,EAAE,sBAAkB;AAE1C,OAAO,EAAE,mBAAmB,EAAE,qBAAiB;AAE/C,OAAO,EAAE,OAAO,EAAE,sBAAkB;AAEpC,MAAM,GAAG,GAAG,kBAAkB,CAAC,aAAa,EAAE,yBAAyB,CAAC,CAAC;AAiCzE;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,iCAAiC,EAAoC;IAOpH,YAAY,EACV,iBAAiB,EACjB,SAAS,GAIV;QACC,KAAK,EAAE,CAAC;;QAXV,iEAAkD;QAElD,yDAA6C;QAW3C,IAAI,CAAC,GAAG,GAAG,IAAI,YAAY,EAA6C,CAAC;QAEzE,uBAAA,IAAI,kDAAsB,iBAAiB,MAAA,CAAC;QAC5C,uBAAA,IAAI,0CAAc,SAAS,MAAA,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,EAAE,eAAe,EAAoC;QACtE,IAAI,CAAC;YACH,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,GAC7C,IAAI,CAAC,qBAAqB,CAAC,eAAe,CAAkB,CAAC;YAE/D,GAAG,CAAC,SAAS,EAAE;gBACb,WAAW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AC,UAAU,CAAC,CAAC;IACxC,OAAO,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC,2GAEkB,QAAsB;IACvC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { query, toHex } from '@metamask/controller-utils';\nimport EthQuery from '@metamask/eth-query';\nimport type {\n NetworkClient,\n NetworkClientId,\n Provider,\n} from '@metamask/network-controller';\nimport { BlockTrackerPollingControllerOnly } from '@metamask/polling-controller';\nimport { createModuleLogger, type Hex } from '@metamask/utils';\n// This package purposefully relies on Node's EventEmitter module.\n// eslint-disable-next-line import-x/no-nodejs-modules\nimport EventEmitter from 'events';\n\nimport { projectLogger } from '../logger';\nimport type { UserOperationMetadata, UserOperationReceipt } from '../types';\nimport { UserOperationStatus } from '../types';\nimport type { UserOperationControllerMessenger } from '../UserOperationController';\nimport { Bundler } from './Bundler';\n\nconst log = createModuleLogger(projectLogger, 'pending-user-operations');\n\ntype Events = {\n 'user-operation-confirmed': [metadata: UserOperationMetadata];\n 'user-operation-failed': [txMeta: UserOperationMetadata, error: Error];\n 'user-operation-updated': [txMeta: UserOperationMetadata];\n};\n\nexport type PendingUserOperationTrackerEventEmitter = EventEmitter & {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n on<T extends keyof Events>(\n eventName: T,\n listener: (...args: Events[T]) => void,\n ): PendingUserOperationTrackerEventEmitter;\n\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n once<T extends keyof Events>(\n eventName: T,\n listener: (...args: Events[T]) => void,\n ): PendingUserOperationTrackerEventEmitter;\n\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n emit<T extends keyof Events>(eventName: T, ...args: Events[T]): boolean;\n};\n\n/** The input to start polling for the {@link PendingUserOperationTracker} */\ntype PendingUserOperationPollingInput = {\n networkClientId: NetworkClientId;\n};\n\n/**\n * A helper class to periodically query the bundlers\n * and update the status of any submitted user operations.\n */\nexport class PendingUserOperationTracker extends BlockTrackerPollingControllerOnly<PendingUserOperationPollingInput>() {\n hub: PendingUserOperationTrackerEventEmitter;\n\n #getUserOperations: () => UserOperationMetadata[];\n\n #messenger: UserOperationControllerMessenger;\n\n constructor({\n getUserOperations,\n messenger,\n }: {\n getUserOperations: () => UserOperationMetadata[];\n messenger: UserOperationControllerMessenger;\n }) {\n super();\n\n this.hub = new EventEmitter() as PendingUserOperationTrackerEventEmitter;\n\n this.#getUserOperations = getUserOperations;\n this.#messenger = messenger;\n }\n\n async _executePoll({ networkClientId }: PendingUserOperationPollingInput) {\n try {\n const { blockTracker, configuration, provider } =\n this._getNetworkClientById(networkClientId) as NetworkClient;\n\n log('Polling', {\n blockNumber: blockTracker.getCurrentBlock(),\n chainId: configuration.chainId,\n });\n\n await this.#checkUserOperations(configuration.chainId, provider);\n } catch (error) {\n /* istanbul ignore next */\n log('Failed to check user operations', error);\n }\n }\n\n _getNetworkClientById(networkClientId: string): NetworkClient | undefined {\n return this.#messenger.call(\n 'NetworkController:getNetworkClientById',\n networkClientId,\n );\n }\n\n async #checkUserOperations(chainId: string, provider: Provider) {\n const pendingUserOperations = this.#getPendingUserOperations().filter(\n (metadata) => metadata.chainId === chainId,\n );\n\n if (!pendingUserOperations.length) {\n log('No pending user operations to check');\n return;\n }\n\n log('Found pending user operations to check', {\n count: pendingUserOperations.length,\n ids: pendingUserOperations.map((userOperation) => userOperation.id),\n });\n\n await Promise.all(\n pendingUserOperations.map((userOperation) =>\n this.#checkUserOperation(userOperation, provider),\n ),\n );\n }\n\n async #checkUserOperation(\n metadata: UserOperationMetadata,\n provider: Provider,\n ) {\n const { bundlerUrl, hash, id } = metadata;\n\n if (!hash || !bundlerUrl) {\n log('Skipping user operation as missing hash or bundler', id);\n return;\n }\n\n try {\n const receipt = await this.#getUserOperationReceipt(hash, bundlerUrl);\n const isSuccess = receipt?.success;\n\n if (receipt && !isSuccess) {\n this.#onUserOperationFailed(metadata, receipt);\n return;\n }\n\n if (isSuccess) {\n await this.#onUserOperationConfirmed(metadata, receipt, provider);\n return;\n }\n\n log('No receipt found for user operation', { id, hash });\n } catch (error) {\n log('Failed to check user operation', id, error);\n }\n }\n\n async #onUserOperationConfirmed(\n metadata: UserOperationMetadata,\n receipt: UserOperationReceipt,\n provider: Provider,\n ) {\n const { id } = metadata;\n\n const {\n actualGasCost,\n actualGasUsed,\n receipt: { blockHash, transactionHash },\n } = receipt;\n\n log('User operation confirmed', id, transactionHash);\n\n const { baseFeePerGas } = await query(\n new EthQuery(provider),\n 'getBlockByHash',\n [blockHash, false],\n );\n\n metadata.actualGasCost = this.#normalizeGasValue(actualGasCost);\n metadata.actualGasUsed = this.#normalizeGasValue(actualGasUsed);\n metadata.baseFeePerGas = baseFeePerGas;\n metadata.status = UserOperationStatus.Confirmed;\n metadata.transactionHash = transactionHash;\n\n this.#updateUserOperation(metadata);\n\n this.hub.emit('user-operation-confirmed', metadata);\n }\n\n #onUserOperationFailed(\n metadata: UserOperationMetadata,\n _receipt: UserOperationReceipt,\n ) {\n const { id } = metadata;\n\n log('User operation failed', id);\n\n metadata.status = UserOperationStatus.Failed;\n\n this.#updateUserOperation(metadata);\n\n this.hub.emit(\n 'user-operation-failed',\n metadata,\n new Error('User operation receipt has failed status'),\n );\n }\n\n #getPendingUserOperations(): UserOperationMetadata[] {\n return this.#getUserOperations().filter(\n (userOperation) => userOperation.status === UserOperationStatus.Submitted,\n );\n }\n\n #updateUserOperation(metadata: UserOperationMetadata) {\n this.hub.emit('user-operation-updated', metadata);\n }\n\n async #getUserOperationReceipt(\n hash: string,\n bundlerUrl: string,\n ): Promise<UserOperationReceipt | undefined> {\n const bundler = new Bundler(bundlerUrl);\n return bundler.getUserOperationReceipt(hash);\n }\n\n #normalizeGasValue(gasValue: Hex | number): string {\n if (typeof gasValue === 'number') {\n return toHex(gasValue);\n }\n return gasValue;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SnapSmartContractAccount.cjs","sourceRoot":"","sources":["../../src/helpers/SnapSmartContractAccount.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAqE;AAWrE,oDAAoD;AAEpD,MAAa,wBAAwB;IAGnC,YAAY,SAA2C;QAF9C,sDAA6C;QAGpD,uBAAA,IAAI,uCAAc,SAAS,MAAA,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,OAAoC;QAEpC,MAAM,EACJ,OAAO,EACP,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,SAAS,EACb,KAAK,EAAE,YAAY,GACpB,GAAG,OAAO,CAAC;QAEZ,MAAM,IAAI,GAAG,WAAW,IAAI,uBAAW,CAAC;QACxC,MAAM,EAAE,GAAG,SAAS,IAAI,wBAAY,CAAC;QACrC,MAAM,KAAK,GAAG,YAAY,IAAI,sBAAU,CAAC;QAEzC,MAAM,QAAQ,GAAG,MAAM,uBAAA,IAAI,2CAAW,CAAC,IAAI,CACzC,wCAAwC,EACxC,MAAM,EACN,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EACrB,EAAE,OAAO,EAAE,IAAA,0BAAe,EAAC,OAAO,CAAC,EAAE,CACtC,CAAC;QAEF,MAAM,EACJ,UAAU,EAAE,OAAO,EACnB,QAAQ,EACR,qBAAqB,EACrB,cAAc,EACd,SAAS,EAAE,GAAG,EACd,QAAQ,EACR,KAAK,GACN,GAAG,QAAQ,CAAC;QAEb,OAAO;YACL,OAAO;YACP,QAAQ;YACR,qBAAqB;YACrB,cAAc;YACd,GAAG;YACH,QAAQ;YACR,KAAK;YACL,MAAM;SACP,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,OAAmC;QAEnC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC;QAEjC,MAAM,EACJ,gBAAgB,EAAE,wBAAwB,EAC1C,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,GACb,GAAG,MAAM,uBAAA,IAAI,2CAAW,CAAC,IAAI,CAC5B,sCAAsC,EACtC,MAAM,EACN,aAAa,EACb,EAAE,OAAO,EAAE,IAAA,0BAAe,EAAC,OAAO,CAAC,EAAE,CACtC,CAAC;QAEF,MAAM,gBAAgB,GACpB,wBAAwB,KAAK,uBAAW;YACtC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,wBAAwB,CAAC;QAE/B,OAAO;YACL,gBAAgB;YAChB,oBAAoB;YACpB,kBAAkB;YAClB,YAAY;SACb,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,OAAiC;QAEjC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC;QAEjC,MAAM,SAAS,GAAG,MAAM,uBAAA,IAAI,2CAAW,CAAC,IAAI,CAC1C,qCAAqC,EACrC,MAAM,EACN,aAAa,EACb,EAAE,OAAO,EAAE,IAAA,0BAAe,EAAC,OAAO,CAAC,EAAE,CACtC,CAAC;QAEF,OAAO,EAAE,SAAS,EAAE,CAAC;IACvB,CAAC;CACF;AAjGD,4DAiGC","sourcesContent":["import { ADDRESS_ZERO, EMPTY_BYTES, VALUE_ZERO } from '../constants';\nimport type {\n PrepareUserOperationRequest,\n PrepareUserOperationResponse,\n SignUserOperationRequest,\n SignUserOperationResponse,\n SmartContractAccount,\n UpdateUserOperationRequest,\n UpdateUserOperationResponse,\n} from '../types';\nimport type { UserOperationControllerMessenger } from '../UserOperationController';\nimport { toEip155ChainId } from '../utils/chain-id';\n\nexport class SnapSmartContractAccount implements SmartContractAccount {\n readonly #messenger: UserOperationControllerMessenger;\n\n constructor(messenger: UserOperationControllerMessenger) {\n this.#messenger = messenger;\n }\n\n async prepareUserOperation(\n request: PrepareUserOperationRequest,\n ): Promise<PrepareUserOperationResponse> {\n const {\n chainId,\n data: requestData,\n from: sender,\n to: requestTo,\n value: requestValue,\n } = request;\n\n const data = requestData ?? EMPTY_BYTES;\n const to = requestTo ?? ADDRESS_ZERO;\n const value = requestValue ?? VALUE_ZERO;\n\n const response = await this.#messenger.call(\n 'KeyringController:prepareUserOperation',\n sender,\n [{ data, to, value }],\n { chainId: toEip155ChainId(chainId) },\n );\n\n const {\n bundlerUrl: bundler,\n callData,\n dummyPaymasterAndData,\n dummySignature,\n gasLimits: gas,\n initCode,\n nonce,\n } = response;\n\n return {\n bundler,\n callData,\n dummyPaymasterAndData,\n dummySignature,\n gas,\n initCode,\n nonce,\n sender,\n };\n }\n\n async updateUserOperation(\n request: UpdateUserOperationRequest,\n ): Promise<UpdateUserOperationResponse> {\n const { userOperation, chainId } = request;\n const { sender } = userOperation;\n\n const {\n paymasterAndData: responsePaymasterAndData,\n verificationGasLimit,\n preVerificationGas,\n callGasLimit,\n } = await this.#messenger.call(\n 'KeyringController:patchUserOperation',\n sender,\n userOperation,\n { chainId: toEip155ChainId(chainId) },\n );\n\n const paymasterAndData =\n responsePaymasterAndData === EMPTY_BYTES\n ? undefined\n : responsePaymasterAndData;\n\n return {\n paymasterAndData,\n verificationGasLimit,\n preVerificationGas,\n callGasLimit,\n };\n }\n\n async signUserOperation(\n request: SignUserOperationRequest,\n ): Promise<SignUserOperationResponse> {\n const { userOperation, chainId } = request;\n const { sender } = userOperation;\n\n const signature = await this.#messenger.call(\n 'KeyringController:signUserOperation',\n sender,\n userOperation,\n { chainId: toEip155ChainId(chainId) },\n );\n\n return { signature };\n }\n}\n"]}
1
+ {"version":3,"file":"SnapSmartContractAccount.cjs","sourceRoot":"","sources":["../../src/helpers/SnapSmartContractAccount.ts"],"names":[],"m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,GAAG,MAAM,uBAAA,IAAI,2CAAW,CAAC,IAAI,CAC5B,sCAAsC,EACtC,MAAM,EACN,aAAa,EACb,EAAE,OAAO,EAAE,IAAA,0BAAe,EAAC,OAAO,CAAC,EAAE,CACtC,CAAC;QAEF,MAAM,gBAAgB,GACpB,wBAAwB,KAAK,uBAAW;YACtC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,wBAAwB,CAAC;QAE/B,OAAO;YACL,gBAAgB;YAChB,oBAAoB;YACpB,kBAAkB;YAClB,YAAY;SACb,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,OAAiC;QAEjC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC;QAEjC,MAAM,SAAS,GAAG,MAAM,uBAAA,IAAI,2CAAW,CAAC,IAAI,CAC1C,qCAAqC,EACrC,MAAM,EACN,aAAa,EACb,EAAE,OAAO,EAAE,IAAA,0BAAe,EAAC,OAAO,CAAC,EAAE,CACtC,CAAC;QAEF,OAAO,EAAE,SAAS,EAAE,CAAC;IACvB,CAAC;CACF;AAjGD,4DAiGC","sourcesContent":["import { ADDRESS_ZERO, EMPTY_BYTES, VALUE_ZERO } from '../constants';\nimport type {\n PrepareUserOperationRequest,\n PrepareUserOperationResponse,\n SignUserOperationRequest,\n SignUserOperationResponse,\n SmartContractAccount,\n UpdateUserOperationRequest,\n UpdateUserOperationResponse,\n} from '../types';\nimport type { UserOperationControllerMessenger } from '../UserOperationController';\nimport { toEip155ChainId } from '../utils/chain-id';\n\nexport class SnapSmartContractAccount implements SmartContractAccount {\n #messenger: UserOperationControllerMessenger;\n\n constructor(messenger: UserOperationControllerMessenger) {\n this.#messenger = messenger;\n }\n\n async prepareUserOperation(\n request: PrepareUserOperationRequest,\n ): Promise<PrepareUserOperationResponse> {\n const {\n chainId,\n data: requestData,\n from: sender,\n to: requestTo,\n value: requestValue,\n } = request;\n\n const data = requestData ?? EMPTY_BYTES;\n const to = requestTo ?? ADDRESS_ZERO;\n const value = requestValue ?? VALUE_ZERO;\n\n const response = await this.#messenger.call(\n 'KeyringController:prepareUserOperation',\n sender,\n [{ data, to, value }],\n { chainId: toEip155ChainId(chainId) },\n );\n\n const {\n bundlerUrl: bundler,\n callData,\n dummyPaymasterAndData,\n dummySignature,\n gasLimits: gas,\n initCode,\n nonce,\n } = response;\n\n return {\n bundler,\n callData,\n dummyPaymasterAndData,\n dummySignature,\n gas,\n initCode,\n nonce,\n sender,\n };\n }\n\n async updateUserOperation(\n request: UpdateUserOperationRequest,\n ): Promise<UpdateUserOperationResponse> {\n const { userOperation, chainId } = request;\n const { sender } = userOperation;\n\n const {\n paymasterAndData: responsePaymasterAndData,\n verificationGasLimit,\n preVerificationGas,\n callGasLimit,\n } = await this.#messenger.call(\n 'KeyringController:patchUserOperation',\n sender,\n userOperation,\n { chainId: toEip155ChainId(chainId) },\n );\n\n const paymasterAndData =\n responsePaymasterAndData === EMPTY_BYTES\n ? undefined\n : responsePaymasterAndData;\n\n return {\n paymasterAndData,\n verificationGasLimit,\n preVerificationGas,\n callGasLimit,\n };\n }\n\n async signUserOperation(\n request: SignUserOperationRequest,\n ): Promise<SignUserOperationResponse> {\n const { userOperation, chainId } = request;\n const { sender } = userOperation;\n\n const signature = await this.#messenger.call(\n 'KeyringController:signUserOperation',\n sender,\n userOperation,\n { chainId: toEip155ChainId(chainId) },\n );\n\n return { signature };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SnapSmartContractAccount.mjs","sourceRoot":"","sources":["../../src/helpers/SnapSmartContractAccount.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,yBAAqB;AAWrE,OAAO,EAAE,eAAe,EAAE,8BAA0B;AAEpD,MAAM,OAAO,wBAAwB;IAGnC,YAAY,SAA2C;QAF9C,sDAA6C;QAGpD,uBAAA,I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,CACtC,CAAC;QAEF,MAAM,gBAAgB,GACpB,wBAAwB,KAAK,WAAW;YACtC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,wBAAwB,CAAC;QAE/B,OAAO;YACL,gBAAgB;YAChB,oBAAoB;YACpB,kBAAkB;YAClB,YAAY;SACb,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,OAAiC;QAEjC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC;QAEjC,MAAM,SAAS,GAAG,MAAM,uBAAA,IAAI,2CAAW,CAAC,IAAI,CAC1C,qCAAqC,EACrC,MAAM,EACN,aAAa,EACb,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,CACtC,CAAC;QAEF,OAAO,EAAE,SAAS,EAAE,CAAC;IACvB,CAAC;CACF","sourcesContent":["import { ADDRESS_ZERO, EMPTY_BYTES, VALUE_ZERO } from '../constants';\nimport type {\n PrepareUserOperationRequest,\n PrepareUserOperationResponse,\n SignUserOperationRequest,\n SignUserOperationResponse,\n SmartContractAccount,\n UpdateUserOperationRequest,\n UpdateUserOperationResponse,\n} from '../types';\nimport type { UserOperationControllerMessenger } from '../UserOperationController';\nimport { toEip155ChainId } from '../utils/chain-id';\n\nexport class SnapSmartContractAccount implements SmartContractAccount {\n readonly #messenger: UserOperationControllerMessenger;\n\n constructor(messenger: UserOperationControllerMessenger) {\n this.#messenger = messenger;\n }\n\n async prepareUserOperation(\n request: PrepareUserOperationRequest,\n ): Promise<PrepareUserOperationResponse> {\n const {\n chainId,\n data: requestData,\n from: sender,\n to: requestTo,\n value: requestValue,\n } = request;\n\n const data = requestData ?? EMPTY_BYTES;\n const to = requestTo ?? ADDRESS_ZERO;\n const value = requestValue ?? VALUE_ZERO;\n\n const response = await this.#messenger.call(\n 'KeyringController:prepareUserOperation',\n sender,\n [{ data, to, value }],\n { chainId: toEip155ChainId(chainId) },\n );\n\n const {\n bundlerUrl: bundler,\n callData,\n dummyPaymasterAndData,\n dummySignature,\n gasLimits: gas,\n initCode,\n nonce,\n } = response;\n\n return {\n bundler,\n callData,\n dummyPaymasterAndData,\n dummySignature,\n gas,\n initCode,\n nonce,\n sender,\n };\n }\n\n async updateUserOperation(\n request: UpdateUserOperationRequest,\n ): Promise<UpdateUserOperationResponse> {\n const { userOperation, chainId } = request;\n const { sender } = userOperation;\n\n const {\n paymasterAndData: responsePaymasterAndData,\n verificationGasLimit,\n preVerificationGas,\n callGasLimit,\n } = await this.#messenger.call(\n 'KeyringController:patchUserOperation',\n sender,\n userOperation,\n { chainId: toEip155ChainId(chainId) },\n );\n\n const paymasterAndData =\n responsePaymasterAndData === EMPTY_BYTES\n ? undefined\n : responsePaymasterAndData;\n\n return {\n paymasterAndData,\n verificationGasLimit,\n preVerificationGas,\n callGasLimit,\n };\n }\n\n async signUserOperation(\n request: SignUserOperationRequest,\n ): Promise<SignUserOperationResponse> {\n const { userOperation, chainId } = request;\n const { sender } = userOperation;\n\n const signature = await this.#messenger.call(\n 'KeyringController:signUserOperation',\n sender,\n userOperation,\n { chainId: toEip155ChainId(chainId) },\n );\n\n return { signature };\n }\n}\n"]}
1
+ {"version":3,"file":"SnapSmartContractAccount.mjs","sourceRoot":"","sources":["../../src/helpers/SnapSmartContractAccount.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,yBAAqB;AAWrE,OAAO,EAAE,eAAe,EAAE,8BAA0B;AAEpD,MAAM,OAAO,wBAAwB;IAGnC,YAAY,SAA2C;QAFvD,sDAA6C;QAG3C,uBAAA,IAAI,uCAAc,SAAS,MAAA,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,OAAoC;QAEpC,MAAM,EACJ,OAAO,EACP,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,SAAS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YAAY;SACb,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,OAAiC;QAEjC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC;QAEjC,MAAM,SAAS,GAAG,MAAM,uBAAA,IAAI,2CAAW,CAAC,IAAI,CAC1C,qCAAqC,EACrC,MAAM,EACN,aAAa,EACb,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,CACtC,CAAC;QAEF,OAAO,EAAE,SAAS,EAAE,CAAC;IACvB,CAAC;CACF","sourcesContent":["import { ADDRESS_ZERO, EMPTY_BYTES, VALUE_ZERO } from '../constants';\nimport type {\n PrepareUserOperationRequest,\n PrepareUserOperationResponse,\n SignUserOperationRequest,\n SignUserOperationResponse,\n SmartContractAccount,\n UpdateUserOperationRequest,\n UpdateUserOperationResponse,\n} from '../types';\nimport type { UserOperationControllerMessenger } from '../UserOperationController';\nimport { toEip155ChainId } from '../utils/chain-id';\n\nexport class SnapSmartContractAccount implements SmartContractAccount {\n #messenger: UserOperationControllerMessenger;\n\n constructor(messenger: UserOperationControllerMessenger) {\n this.#messenger = messenger;\n }\n\n async prepareUserOperation(\n request: PrepareUserOperationRequest,\n ): Promise<PrepareUserOperationResponse> {\n const {\n chainId,\n data: requestData,\n from: sender,\n to: requestTo,\n value: requestValue,\n } = request;\n\n const data = requestData ?? EMPTY_BYTES;\n const to = requestTo ?? ADDRESS_ZERO;\n const value = requestValue ?? VALUE_ZERO;\n\n const response = await this.#messenger.call(\n 'KeyringController:prepareUserOperation',\n sender,\n [{ data, to, value }],\n { chainId: toEip155ChainId(chainId) },\n );\n\n const {\n bundlerUrl: bundler,\n callData,\n dummyPaymasterAndData,\n dummySignature,\n gasLimits: gas,\n initCode,\n nonce,\n } = response;\n\n return {\n bundler,\n callData,\n dummyPaymasterAndData,\n dummySignature,\n gas,\n initCode,\n nonce,\n sender,\n };\n }\n\n async updateUserOperation(\n request: UpdateUserOperationRequest,\n ): Promise<UpdateUserOperationResponse> {\n const { userOperation, chainId } = request;\n const { sender } = userOperation;\n\n const {\n paymasterAndData: responsePaymasterAndData,\n verificationGasLimit,\n preVerificationGas,\n callGasLimit,\n } = await this.#messenger.call(\n 'KeyringController:patchUserOperation',\n sender,\n userOperation,\n { chainId: toEip155ChainId(chainId) },\n );\n\n const paymasterAndData =\n responsePaymasterAndData === EMPTY_BYTES\n ? undefined\n : responsePaymasterAndData;\n\n return {\n paymasterAndData,\n verificationGasLimit,\n preVerificationGas,\n callGasLimit,\n };\n }\n\n async signUserOperation(\n request: SignUserOperationRequest,\n ): Promise<SignUserOperationResponse> {\n const { userOperation, chainId } = request;\n const { sender } = userOperation;\n\n const signature = await this.#messenger.call(\n 'KeyringController:signUserOperation',\n sender,\n userOperation,\n { chainId: toEip155ChainId(chainId) },\n );\n\n return { signature };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA0DA;;GAEG;AACH,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,gDAAyB,CAAA;IACzB,4CAAqB,CAAA;IACrB,wCAAiB,CAAA;IACjB,8CAAuB,CAAA;IACvB,wCAAiB,CAAA;IACjB,8CAAuB,CAAA;AACzB,CAAC,EAPW,mBAAmB,mCAAnB,mBAAmB,QAO9B","sourcesContent":["import type {\n TransactionParams,\n TransactionType,\n UserFeeLevel,\n} from '@metamask/transaction-controller';\nimport type { Hex } from '@metamask/utils';\n\n/**\n * A complete user operation to be submitted to a bundler.\n * Defined in EIP-4337.\n */\nexport type UserOperation = {\n /** The data to pass to the sender during the main execution call. */\n callData: string;\n\n /** The amount of gas to allocate the main execution call. */\n callGasLimit: string;\n\n /**\n * The initCode of the account.\n * Needed if and only if the account is not yet on-chain and needs to be created.\n */\n initCode: string;\n\n /**\n * Maximum fee per gas.\n * Similar to EIP-1559 max_fee_per_gas.\n */\n maxFeePerGas: string;\n\n /**\n * Maximum priority fee per gas.\n * Similar to EIP-1559 max_priority_fee_per_gas.\n */\n maxPriorityFeePerGas: string;\n\n /** Anti-replay parameter. */\n nonce: string;\n\n /**\n * Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster.\n * Empty for self-sponsored transactions.\n */\n paymasterAndData: string;\n\n /** The amount of gas to pay to compensate the bundler for pre-verification execution, calldata and any gas overhead that cannot be tracked on-chain. */\n preVerificationGas: string;\n\n /** The account making the operation. */\n sender: string;\n\n /** Data passed into the account along with the nonce during the verification step. */\n signature: string;\n\n /** The amount of gas to allocate for the verification step. */\n verificationGasLimit: string;\n};\n\n/**\n * The possible statuses of a single user operation.\n */\nexport enum UserOperationStatus {\n Unapproved = 'unapproved',\n Approved = 'approved',\n Signed = 'signed',\n Submitted = 'submitted',\n Failed = 'failed',\n Confirmed = 'confirmed',\n}\n\n/** Information concerning an error while creating a user operation. */\nexport type UserOperationError = {\n /**\n * A descriptive error name.\n */\n name: string;\n\n /**\n * A descriptive error message providing details about the encountered error.\n */\n message: string;\n\n /**\n * The stack trace associated with the error, if available.\n */\n stack: string | null;\n\n /**\n * An optional error code associated with the error.\n */\n code: string | null;\n\n /**\n * Additional information related to the error.\n */\n rpc: string | null;\n};\n\n/**\n * Metadata concerning a single user operation, stored in the client state.\n */\nexport type UserOperationMetadata = {\n /** Confirmed total cost of the gas for the user operation. */\n actualGasCost: string | null;\n\n /** Confirmed total amount of gas used by the user operation. */\n actualGasUsed: string | null;\n\n /** Base fee of the transaction block as a hex value. */\n baseFeePerGas: string | null;\n\n /** URL of the bundler that the operation was submitted to. */\n bundlerUrl: string | null;\n\n /** Hexadecimal chain ID of the target network. */\n chainId: string;\n\n /** An error that occurred while creating the operation. */\n error: UserOperationError | null;\n\n /** Hash of the user operation, generated by the bundler. */\n hash: string | null;\n\n /** A unique ID used to identify a user operation in the client. */\n id: string;\n\n /** The origin of the user operation, such as the hostname of a dApp. */\n origin: string;\n\n /** Current status of the user operation. */\n status: UserOperationStatus;\n\n /** Metadata specific to swap transactions. */\n swapsMetadata: SwapsMetadata | null;\n\n /** Timestamp of when the user operation was created. */\n time: number;\n\n /** Hash of the transaction that submitted the user operation to the entrypoint. */\n transactionHash: string | null;\n\n /** The initial transaction parameters that the user operation was created from. */\n transactionParams: Required<TransactionParams> | null;\n\n /** The type of transaction that the user operation will create. */\n transactionType: TransactionType | null;\n\n /** The origin of the gas fee values. */\n userFeeLevel: UserFeeLevel | null;\n\n /** Resulting user operation object to be submitted to the bundler. */\n userOperation: UserOperation;\n};\n\n/**\n * The data provided to the smart contract account when preparing a user operation.\n */\nexport type PrepareUserOperationRequest = {\n /** The hexadecimal chain ID of the target network. */\n chainId: string;\n\n /** The data to include in the resulting transaction. */\n data?: string;\n\n /** Address of the account requesting the user operation. */\n from: string;\n\n /** The destination address of the resulting transaction. */\n to?: string;\n\n /** The value to send in the resulting transaction. */\n value?: string;\n};\n\n/**\n * The data provided to the smart contract account when updating a user operation.\n */\nexport type UpdateUserOperationRequest = {\n /** The user operation to update including the dummy signature and dummy paymasterAndData values. */\n userOperation: UserOperation;\n\n /** The hexadecimal chain ID of the target network. */\n chainId: string;\n};\n\n/**\n * The data provided to the smart contract account when signing a user operation.\n */\nexport type SignUserOperationRequest = {\n /** The user operation to sign including the dummy signature and final paymasterAndData values. */\n userOperation: UserOperation;\n\n /** The hexadecimal chain ID of the target network. */\n chainId: string;\n};\n\n/**\n * The data returned by the smart contract account when preparing a user operation.\n */\nexport type PrepareUserOperationResponse = {\n /** The URL of the bundler to submit the user operation to. */\n bundler: string;\n\n /** The data to pass to the sender during the main execution call. */\n callData: string;\n\n /**\n * A dummy paymasterAndData value required to estimate gas using the bundler.\n * Only required if the smart contract account is not providing gas values.\n */\n dummyPaymasterAndData?: string;\n\n /**\n * A dummy signature value required to estimate gas using the bundler.\n * Only required if the smart contract account is not providing gas values.\n */\n dummySignature?: string;\n\n /**\n * The estimated gas limits for the user operation.\n * Gas is automatically estimated using the bundler if not provided.\n */\n gas?: {\n /** The amount of gas to allocate to the main execution call. */\n callGasLimit: string;\n\n /** The amount of gas to pay to compensate the bundler for pre-verification execution, calldata and any gas overhead that cannot be tracked on-chain. */\n preVerificationGas: string;\n\n /** The amount of gas to allocate for the verification step. */\n verificationGasLimit: string;\n };\n\n /**\n * The initCode to include in the user operation.\n * Required only if the smart contract is not yet deployed.\n */\n initCode?: string;\n\n /**\n * The nonce to include in the user operation, specific to the smart contract account.\n */\n nonce: string;\n\n /**\n * The address of the smart contract account creating the user operation.\n */\n sender: string;\n};\n\n/**\n * The data returned by the smart contract account when updating a user operation.\n */\nexport type UpdateUserOperationResponse = {\n /**\n * The final paymasterAndData to include in the user operation.\n * Not required if a paymaster is not sponsoring the transaction.\n */\n paymasterAndData?: string;\n\n /**\n * The final gas limits for the user operation suggested by the smart contract account.\n * The simulated gas limits may be different after the bundler estimates gas with the use\n * of the paymaster.\n */\n callGasLimit?: string;\n preVerificationGas?: string;\n verificationGasLimit?: string;\n};\n\n/**\n * The data returned by the smart contract account when signing a user operation.\n */\nexport type SignUserOperationResponse = {\n /** The final signature of the user operation. */\n signature: string;\n};\n\n/**\n * An abstraction to provide smart contract and paymaster specific data when creating a user operation.\n * This will typically communicate with an account snap installed in the client.\n */\nexport type SmartContractAccount = {\n /**\n * Retrieve the initial values required to create a user operation.\n *\n * @param request - The data needed by the smart contract account to provide the initial user operation values.\n * @returns The initial values required to create a user operation.\n */\n prepareUserOperation: (\n request: PrepareUserOperationRequest,\n ) => Promise<PrepareUserOperationResponse>;\n\n /**\n * Retrieve additional data required to create a user operation, such as the paymasterAndData value.\n * If gas values were not provided in the prepare response, this will be called after estimating gas using the bundler.\n *\n * @param request - The data needed by the smart contract account to provide the additional user operation values.\n * @returns The additional values required to create a user operation.\n */\n updateUserOperation: (\n request: UpdateUserOperationRequest,\n ) => Promise<UpdateUserOperationResponse>;\n\n /**\n * Sign the final user operation.\n *\n * @param request - The data needed by the smart contract account to generate the signature.\n * @returns The final values required to sign a user operation.\n */\n signUserOperation: (\n request: SignUserOperationRequest,\n ) => Promise<SignUserOperationResponse>;\n};\n\n/**\n * Response from the `eth_getUserOperationReceipt` bundler method.\n * Includes the status of a completed user operation and the receipt of the transaction that submitted it.\n */\nexport type UserOperationReceipt = {\n /** Confirmed total cost of the gas for the user operation. */\n actualGasCost: Hex | number;\n\n /** Confirmed total amount of gas used by the user operation. */\n actualGasUsed: Hex | number;\n\n /** True if the user operation was successfully confirmed on chain. */\n success: boolean;\n\n /** Receipt for the associated transaction. */\n receipt: {\n /** Hash of the block the transaction was added to. */\n blockHash: string;\n\n /** Hash of the confirmed transaction. */\n transactionHash: string;\n };\n};\n\n/** Information specific to user operations created from swap transactions. */\nexport type SwapsMetadata = {\n /** ID of the associated approval transaction. */\n approvalTxId: string | null;\n\n /** Address of the destination token. */\n destinationTokenAddress: string | null;\n\n /** Number of decimals of the destination token. */\n destinationTokenDecimals: number | null;\n\n /** Symbol of the destination token. */\n destinationTokenSymbol: string | null;\n\n /** Amount of the destination token. */\n destinationTokenAmount: string | null;\n\n /** Estimated base fee of the swap. */\n estimatedBaseFee: string | null;\n\n /** Address of the source token. */\n sourceTokenAddress: string | null;\n\n /** Amount of the source token. */\n sourceTokenAmount: string | null;\n\n /** Number of decimals of the source token. */\n sourceTokenDecimals: number | null;\n\n /** Symbol of the source token. */\n sourceTokenSymbol: string | null;\n\n /** Recipient of the swap and send transaction. */\n swapAndSendRecipient: string | null;\n\n /** Untyped raw metadata values. */\n swapMetaData: Record<string, never> | null;\n\n /** Value of the token being swapped. */\n swapTokenValue: string | null;\n};\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA0DA;;GAEG;AACH,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,gDAAyB,CAAA;IACzB,4CAAqB,CAAA;IACrB,wCAAiB,CAAA;IACjB,8CAAuB,CAAA;IACvB,wCAAiB,CAAA;IACjB,8CAAuB,CAAA;AACzB,CAAC,EAPW,mBAAmB,mCAAnB,mBAAmB,QAO9B","sourcesContent":["import type {\n TransactionParams,\n TransactionType,\n UserFeeLevel,\n} from '@metamask/transaction-controller';\nimport type { Hex } from '@metamask/utils';\n\n/**\n * A complete user operation to be submitted to a bundler.\n * Defined in EIP-4337.\n */\nexport type UserOperation = {\n /** The data to pass to the sender during the main execution call. */\n callData: string;\n\n /** The amount of gas to allocate the main execution call. */\n callGasLimit: string;\n\n /**\n * The initCode of the account.\n * Needed if and only if the account is not yet on-chain and needs to be created.\n */\n initCode: string;\n\n /**\n * Maximum fee per gas.\n * Similar to EIP-1559 max_fee_per_gas.\n */\n maxFeePerGas: string;\n\n /**\n * Maximum priority fee per gas.\n * Similar to EIP-1559 max_priority_fee_per_gas.\n */\n maxPriorityFeePerGas: string;\n\n /** Anti-replay parameter. */\n nonce: string;\n\n /**\n * Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster.\n * Empty for self-sponsored transactions.\n */\n paymasterAndData: string;\n\n /** The amount of gas to pay to compensate the bundler for pre-verification execution, calldata and any gas overhead that cannot be tracked on-chain. */\n preVerificationGas: string;\n\n /** The account making the operation. */\n sender: string;\n\n /** Data passed into the account along with the nonce during the verification step. */\n signature: string;\n\n /** The amount of gas to allocate for the verification step. */\n verificationGasLimit: string;\n};\n\n/**\n * The possible statuses of a single user operation.\n */\nexport enum UserOperationStatus {\n Unapproved = 'unapproved',\n Approved = 'approved',\n Signed = 'signed',\n Submitted = 'submitted',\n Failed = 'failed',\n Confirmed = 'confirmed',\n}\n\n/** Information concerning an error while creating a user operation. */\nexport type UserOperationError = {\n /**\n * A descriptive error name.\n */\n name: string;\n\n /**\n * A descriptive error message providing details about the encountered error.\n */\n message: string;\n\n /**\n * The stack trace associated with the error, if available.\n */\n stack: string | null;\n\n /**\n * An optional error code associated with the error.\n */\n code: string | null;\n\n /**\n * Additional information related to the error.\n */\n rpc: string | null;\n};\n\n/**\n * Metadata concerning a single user operation, stored in the client state.\n */\nexport type UserOperationMetadata = {\n /** Confirmed total cost of the gas for the user operation. */\n actualGasCost: string | null;\n\n /** Confirmed total amount of gas used by the user operation. */\n actualGasUsed: string | null;\n\n /** Base fee of the transaction block as a hex value. */\n baseFeePerGas: string | null;\n\n /** URL of the bundler that the operation was submitted to. */\n bundlerUrl: string | null;\n\n /** Hexadecimal chain ID of the target network. */\n chainId: string;\n\n /** An error that occurred while creating the operation. */\n error: UserOperationError | null;\n\n /** Hash of the user operation, generated by the bundler. */\n hash: string | null;\n\n /** A unique ID used to identify a user operation in the client. */\n id: string;\n\n /** The origin of the user operation, such as the hostname of a dApp. */\n origin: string;\n\n /** Current status of the user operation. */\n status: UserOperationStatus;\n\n /** Metadata specific to swap transactions. */\n swapsMetadata: SwapsMetadata | null;\n\n /** Timestamp of when the user operation was created. */\n time: number;\n\n /** Hash of the transaction that submitted the user operation to the entrypoint. */\n transactionHash: string | null;\n\n /** The initial transaction parameters that the user operation was created from. */\n transactionParams: Required<TransactionParams> | null;\n\n /** The type of transaction that the user operation will create. */\n transactionType: TransactionType | null;\n\n /** The origin of the gas fee values. */\n userFeeLevel: UserFeeLevel | null;\n\n /** Resulting user operation object to be submitted to the bundler. */\n userOperation: UserOperation;\n};\n\n/**\n * The data provided to the smart contract account when preparing a user operation.\n */\nexport type PrepareUserOperationRequest = {\n /** The hexadecimal chain ID of the target network. */\n chainId: string;\n\n /** The data to include in the resulting transaction. */\n data?: string;\n\n /** Address of the account requesting the user operation. */\n from: string;\n\n /** The destination address of the resulting transaction. */\n to?: string;\n\n /** The value to send in the resulting transaction. */\n value?: string;\n};\n\n/**\n * The data provided to the smart contract account when updating a user operation.\n */\nexport type UpdateUserOperationRequest = {\n /** The user operation to update including the dummy signature and dummy paymasterAndData values. */\n userOperation: UserOperation;\n\n /** The hexadecimal chain ID of the target network. */\n chainId: string;\n};\n\n/**\n * The data provided to the smart contract account when signing a user operation.\n */\nexport type SignUserOperationRequest = {\n /** The user operation to sign including the dummy signature and final paymasterAndData values. */\n userOperation: UserOperation;\n\n /** The hexadecimal chain ID of the target network. */\n chainId: string;\n};\n\n/**\n * The data returned by the smart contract account when preparing a user operation.\n */\nexport type PrepareUserOperationResponse = {\n /** The URL of the bundler to submit the user operation to. */\n bundler: string;\n\n /** The data to pass to the sender during the main execution call. */\n callData: string;\n\n /**\n * A dummy paymasterAndData value required to estimate gas using the bundler.\n * Only required if the smart contract account is not providing gas values.\n */\n dummyPaymasterAndData?: string;\n\n /**\n * A dummy signature value required to estimate gas using the bundler.\n * Only required if the smart contract account is not providing gas values.\n */\n dummySignature?: string;\n\n /**\n * The estimated gas limits for the user operation.\n * Gas is automatically estimated using the bundler if not provided.\n */\n gas?: {\n /** The amount of gas to allocate to the main execution call. */\n callGasLimit: string;\n\n /** The amount of gas to pay to compensate the bundler for pre-verification execution, calldata and any gas overhead that cannot be tracked on-chain. */\n preVerificationGas: string;\n\n /** The amount of gas to allocate for the verification step. */\n verificationGasLimit: string;\n };\n\n /**\n * The initCode to include in the user operation.\n * Required only if the smart contract is not yet deployed.\n */\n initCode?: string;\n\n /**\n * The nonce to include in the user operation, specific to the smart contract account.\n */\n nonce: string;\n\n /**\n * The address of the smart contract account creating the user operation.\n */\n sender: string;\n};\n\n/**\n * The data returned by the smart contract account when updating a user operation.\n */\nexport type UpdateUserOperationResponse = {\n /**\n * The final paymasterAndData to include in the user operation.\n * Not required if a paymaster is not sponsoring the transaction.\n */\n paymasterAndData?: string;\n\n /**\n * The final gas limits for the user operation suggested by the smart contract account.\n * The simulated gas limits may be different after the bundler estimates gas with the use\n * of the paymaster.\n */\n callGasLimit?: string;\n preVerificationGas?: string;\n verificationGasLimit?: string;\n};\n\n/**\n * The data returned by the smart contract account when signing a user operation.\n */\nexport type SignUserOperationResponse = {\n /** The final signature of the user operation. */\n signature: string;\n};\n\n/**\n * An abstraction to provide smart contract and paymaster specific data when creating a user operation.\n * This will typically communicate with an account snap installed in the client.\n */\nexport type SmartContractAccount = {\n /**\n * Retrieve the initial values required to create a user operation.\n * @param request - The data needed by the smart contract account to provide the initial user operation values.\n * @returns The initial values required to create a user operation.\n */\n prepareUserOperation: (\n request: PrepareUserOperationRequest,\n ) => Promise<PrepareUserOperationResponse>;\n\n /**\n * Retrieve additional data required to create a user operation, such as the paymasterAndData value.\n * If gas values were not provided in the prepare response, this will be called after estimating gas using the bundler.\n * @param request - The data needed by the smart contract account to provide the additional user operation values.\n * @returns The additional values required to create a user operation.\n */\n updateUserOperation: (\n request: UpdateUserOperationRequest,\n ) => Promise<UpdateUserOperationResponse>;\n\n /**\n * Sign the final user operation.\n * @param request - The data needed by the smart contract account to generate the signature.\n * @returns The final values required to sign a user operation.\n */\n signUserOperation: (\n request: SignUserOperationRequest,\n ) => Promise<SignUserOperationResponse>;\n};\n\n/**\n * Response from the `eth_getUserOperationReceipt` bundler method.\n * Includes the status of a completed user operation and the receipt of the transaction that submitted it.\n */\nexport type UserOperationReceipt = {\n /** Confirmed total cost of the gas for the user operation. */\n actualGasCost: Hex | number;\n\n /** Confirmed total amount of gas used by the user operation. */\n actualGasUsed: Hex | number;\n\n /** True if the user operation was successfully confirmed on chain. */\n success: boolean;\n\n /** Receipt for the associated transaction. */\n receipt: {\n /** Hash of the block the transaction was added to. */\n blockHash: string;\n\n /** Hash of the confirmed transaction. */\n transactionHash: string;\n };\n};\n\n/** Information specific to user operations created from swap transactions. */\nexport type SwapsMetadata = {\n /** ID of the associated approval transaction. */\n approvalTxId: string | null;\n\n /** Address of the destination token. */\n destinationTokenAddress: string | null;\n\n /** Number of decimals of the destination token. */\n destinationTokenDecimals: number | null;\n\n /** Symbol of the destination token. */\n destinationTokenSymbol: string | null;\n\n /** Amount of the destination token. */\n destinationTokenAmount: string | null;\n\n /** Estimated base fee of the swap. */\n estimatedBaseFee: string | null;\n\n /** Address of the source token. */\n sourceTokenAddress: string | null;\n\n /** Amount of the source token. */\n sourceTokenAmount: string | null;\n\n /** Number of decimals of the source token. */\n sourceTokenDecimals: number | null;\n\n /** Symbol of the source token. */\n sourceTokenSymbol: string | null;\n\n /** Recipient of the swap and send transaction. */\n swapAndSendRecipient: string | null;\n\n /** Untyped raw metadata values. */\n swapMetaData: Record<string, never> | null;\n\n /** Value of the token being swapped. */\n swapTokenValue: string | null;\n};\n"]}
package/dist/types.d.cts CHANGED
@@ -222,7 +222,6 @@ export type SignUserOperationResponse = {
222
222
  export type SmartContractAccount = {
223
223
  /**
224
224
  * Retrieve the initial values required to create a user operation.
225
- *
226
225
  * @param request - The data needed by the smart contract account to provide the initial user operation values.
227
226
  * @returns The initial values required to create a user operation.
228
227
  */
@@ -230,14 +229,12 @@ export type SmartContractAccount = {
230
229
  /**
231
230
  * Retrieve additional data required to create a user operation, such as the paymasterAndData value.
232
231
  * If gas values were not provided in the prepare response, this will be called after estimating gas using the bundler.
233
- *
234
232
  * @param request - The data needed by the smart contract account to provide the additional user operation values.
235
233
  * @returns The additional values required to create a user operation.
236
234
  */
237
235
  updateUserOperation: (request: UpdateUserOperationRequest) => Promise<UpdateUserOperationResponse>;
238
236
  /**
239
237
  * Sign the final user operation.
240
- *
241
238
  * @param request - The data needed by the smart contract account to generate the signature.
242
239
  * @returns The final values required to sign a user operation.
243
240
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,YAAY,EACb,yCAAyC;AAC1C,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE3C;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IAEjB,6DAA6D;IAC7D,YAAY,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B,6BAA6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nC,kCAAkC;IAClC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC,kDAAkD;IAClD,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC,mCAAmC;IACnC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;IAE3C,wCAAwC;IACxC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC"}
package/dist/types.d.mts CHANGED
@@ -222,7 +222,6 @@ export type SignUserOperationResponse = {
222
222
  export type SmartContractAccount = {
223
223
  /**
224
224
  * Retrieve the initial values required to create a user operation.
225
- *
226
225
  * @param request - The data needed by the smart contract account to provide the initial user operation values.
227
226
  * @returns The initial values required to create a user operation.
228
227
  */
@@ -230,14 +229,12 @@ export type SmartContractAccount = {
230
229
  /**
231
230
  * Retrieve additional data required to create a user operation, such as the paymasterAndData value.
232
231
  * If gas values were not provided in the prepare response, this will be called after estimating gas using the bundler.
233
- *
234
232
  * @param request - The data needed by the smart contract account to provide the additional user operation values.
235
233
  * @returns The additional values required to create a user operation.
236
234
  */
237
235
  updateUserOperation: (request: UpdateUserOperationRequest) => Promise<UpdateUserOperationResponse>;
238
236
  /**
239
237
  * Sign the final user operation.
240
- *
241
238
  * @param request - The data needed by the smart contract account to generate the signature.
242
239
  * @returns The final values required to sign a user operation.
243
240
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,YAAY,EACb,yCAAyC;AAC1C,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE3C;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IAEjB,6DAA6D;IAC7D,YAAY,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEj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iB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC,8CAA8C;IAC9C,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC,kCAAkC;IAClC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC,kDAAkD;IAClD,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC,mCAAmC;IACnC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;IAE3C,wCAAwC;IACxC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA0DA;;GAEG;AACH,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,gDAAyB,CAAA;IACzB,4CAAqB,CAAA;IACrB,wCAAiB,CAAA;IACjB,8CAAuB,CAAA;IACvB,wCAAiB,CAAA;IACjB,8CAAuB,CAAA;AACzB,CAAC,EAPW,mBAAmB,KAAnB,mBAAmB,QAO9B","sourcesContent":["import type {\n TransactionParams,\n TransactionType,\n UserFeeLevel,\n} from '@metamask/transaction-controller';\nimport type { Hex } from '@metamask/utils';\n\n/**\n * A complete user operation to be submitted to a bundler.\n * Defined in EIP-4337.\n */\nexport type UserOperation = {\n /** The data to pass to the sender during the main execution call. */\n callData: string;\n\n /** The amount of gas to allocate the main execution call. */\n callGasLimit: string;\n\n /**\n * The initCode of the account.\n * Needed if and only if the account is not yet on-chain and needs to be created.\n */\n initCode: string;\n\n /**\n * Maximum fee per gas.\n * Similar to EIP-1559 max_fee_per_gas.\n */\n maxFeePerGas: string;\n\n /**\n * Maximum priority fee per gas.\n * Similar to EIP-1559 max_priority_fee_per_gas.\n */\n maxPriorityFeePerGas: string;\n\n /** Anti-replay parameter. */\n nonce: string;\n\n /**\n * Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster.\n * Empty for self-sponsored transactions.\n */\n paymasterAndData: string;\n\n /** The amount of gas to pay to compensate the bundler for pre-verification execution, calldata and any gas overhead that cannot be tracked on-chain. */\n preVerificationGas: string;\n\n /** The account making the operation. */\n sender: string;\n\n /** Data passed into the account along with the nonce during the verification step. */\n signature: string;\n\n /** The amount of gas to allocate for the verification step. */\n verificationGasLimit: string;\n};\n\n/**\n * The possible statuses of a single user operation.\n */\nexport enum UserOperationStatus {\n Unapproved = 'unapproved',\n Approved = 'approved',\n Signed = 'signed',\n Submitted = 'submitted',\n Failed = 'failed',\n Confirmed = 'confirmed',\n}\n\n/** Information concerning an error while creating a user operation. */\nexport type UserOperationError = {\n /**\n * A descriptive error name.\n */\n name: string;\n\n /**\n * A descriptive error message providing details about the encountered error.\n */\n message: string;\n\n /**\n * The stack trace associated with the error, if available.\n */\n stack: string | null;\n\n /**\n * An optional error code associated with the error.\n */\n code: string | null;\n\n /**\n * Additional information related to the error.\n */\n rpc: string | null;\n};\n\n/**\n * Metadata concerning a single user operation, stored in the client state.\n */\nexport type UserOperationMetadata = {\n /** Confirmed total cost of the gas for the user operation. */\n actualGasCost: string | null;\n\n /** Confirmed total amount of gas used by the user operation. */\n actualGasUsed: string | null;\n\n /** Base fee of the transaction block as a hex value. */\n baseFeePerGas: string | null;\n\n /** URL of the bundler that the operation was submitted to. */\n bundlerUrl: string | null;\n\n /** Hexadecimal chain ID of the target network. */\n chainId: string;\n\n /** An error that occurred while creating the operation. */\n error: UserOperationError | null;\n\n /** Hash of the user operation, generated by the bundler. */\n hash: string | null;\n\n /** A unique ID used to identify a user operation in the client. */\n id: string;\n\n /** The origin of the user operation, such as the hostname of a dApp. */\n origin: string;\n\n /** Current status of the user operation. */\n status: UserOperationStatus;\n\n /** Metadata specific to swap transactions. */\n swapsMetadata: SwapsMetadata | null;\n\n /** Timestamp of when the user operation was created. */\n time: number;\n\n /** Hash of the transaction that submitted the user operation to the entrypoint. */\n transactionHash: string | null;\n\n /** The initial transaction parameters that the user operation was created from. */\n transactionParams: Required<TransactionParams> | null;\n\n /** The type of transaction that the user operation will create. */\n transactionType: TransactionType | null;\n\n /** The origin of the gas fee values. */\n userFeeLevel: UserFeeLevel | null;\n\n /** Resulting user operation object to be submitted to the bundler. */\n userOperation: UserOperation;\n};\n\n/**\n * The data provided to the smart contract account when preparing a user operation.\n */\nexport type PrepareUserOperationRequest = {\n /** The hexadecimal chain ID of the target network. */\n chainId: string;\n\n /** The data to include in the resulting transaction. */\n data?: string;\n\n /** Address of the account requesting the user operation. */\n from: string;\n\n /** The destination address of the resulting transaction. */\n to?: string;\n\n /** The value to send in the resulting transaction. */\n value?: string;\n};\n\n/**\n * The data provided to the smart contract account when updating a user operation.\n */\nexport type UpdateUserOperationRequest = {\n /** The user operation to update including the dummy signature and dummy paymasterAndData values. */\n userOperation: UserOperation;\n\n /** The hexadecimal chain ID of the target network. */\n chainId: string;\n};\n\n/**\n * The data provided to the smart contract account when signing a user operation.\n */\nexport type SignUserOperationRequest = {\n /** The user operation to sign including the dummy signature and final paymasterAndData values. */\n userOperation: UserOperation;\n\n /** The hexadecimal chain ID of the target network. */\n chainId: string;\n};\n\n/**\n * The data returned by the smart contract account when preparing a user operation.\n */\nexport type PrepareUserOperationResponse = {\n /** The URL of the bundler to submit the user operation to. */\n bundler: string;\n\n /** The data to pass to the sender during the main execution call. */\n callData: string;\n\n /**\n * A dummy paymasterAndData value required to estimate gas using the bundler.\n * Only required if the smart contract account is not providing gas values.\n */\n dummyPaymasterAndData?: string;\n\n /**\n * A dummy signature value required to estimate gas using the bundler.\n * Only required if the smart contract account is not providing gas values.\n */\n dummySignature?: string;\n\n /**\n * The estimated gas limits for the user operation.\n * Gas is automatically estimated using the bundler if not provided.\n */\n gas?: {\n /** The amount of gas to allocate to the main execution call. */\n callGasLimit: string;\n\n /** The amount of gas to pay to compensate the bundler for pre-verification execution, calldata and any gas overhead that cannot be tracked on-chain. */\n preVerificationGas: string;\n\n /** The amount of gas to allocate for the verification step. */\n verificationGasLimit: string;\n };\n\n /**\n * The initCode to include in the user operation.\n * Required only if the smart contract is not yet deployed.\n */\n initCode?: string;\n\n /**\n * The nonce to include in the user operation, specific to the smart contract account.\n */\n nonce: string;\n\n /**\n * The address of the smart contract account creating the user operation.\n */\n sender: string;\n};\n\n/**\n * The data returned by the smart contract account when updating a user operation.\n */\nexport type UpdateUserOperationResponse = {\n /**\n * The final paymasterAndData to include in the user operation.\n * Not required if a paymaster is not sponsoring the transaction.\n */\n paymasterAndData?: string;\n\n /**\n * The final gas limits for the user operation suggested by the smart contract account.\n * The simulated gas limits may be different after the bundler estimates gas with the use\n * of the paymaster.\n */\n callGasLimit?: string;\n preVerificationGas?: string;\n verificationGasLimit?: string;\n};\n\n/**\n * The data returned by the smart contract account when signing a user operation.\n */\nexport type SignUserOperationResponse = {\n /** The final signature of the user operation. */\n signature: string;\n};\n\n/**\n * An abstraction to provide smart contract and paymaster specific data when creating a user operation.\n * This will typically communicate with an account snap installed in the client.\n */\nexport type SmartContractAccount = {\n /**\n * Retrieve the initial values required to create a user operation.\n *\n * @param request - The data needed by the smart contract account to provide the initial user operation values.\n * @returns The initial values required to create a user operation.\n */\n prepareUserOperation: (\n request: PrepareUserOperationRequest,\n ) => Promise<PrepareUserOperationResponse>;\n\n /**\n * Retrieve additional data required to create a user operation, such as the paymasterAndData value.\n * If gas values were not provided in the prepare response, this will be called after estimating gas using the bundler.\n *\n * @param request - The data needed by the smart contract account to provide the additional user operation values.\n * @returns The additional values required to create a user operation.\n */\n updateUserOperation: (\n request: UpdateUserOperationRequest,\n ) => Promise<UpdateUserOperationResponse>;\n\n /**\n * Sign the final user operation.\n *\n * @param request - The data needed by the smart contract account to generate the signature.\n * @returns The final values required to sign a user operation.\n */\n signUserOperation: (\n request: SignUserOperationRequest,\n ) => Promise<SignUserOperationResponse>;\n};\n\n/**\n * Response from the `eth_getUserOperationReceipt` bundler method.\n * Includes the status of a completed user operation and the receipt of the transaction that submitted it.\n */\nexport type UserOperationReceipt = {\n /** Confirmed total cost of the gas for the user operation. */\n actualGasCost: Hex | number;\n\n /** Confirmed total amount of gas used by the user operation. */\n actualGasUsed: Hex | number;\n\n /** True if the user operation was successfully confirmed on chain. */\n success: boolean;\n\n /** Receipt for the associated transaction. */\n receipt: {\n /** Hash of the block the transaction was added to. */\n blockHash: string;\n\n /** Hash of the confirmed transaction. */\n transactionHash: string;\n };\n};\n\n/** Information specific to user operations created from swap transactions. */\nexport type SwapsMetadata = {\n /** ID of the associated approval transaction. */\n approvalTxId: string | null;\n\n /** Address of the destination token. */\n destinationTokenAddress: string | null;\n\n /** Number of decimals of the destination token. */\n destinationTokenDecimals: number | null;\n\n /** Symbol of the destination token. */\n destinationTokenSymbol: string | null;\n\n /** Amount of the destination token. */\n destinationTokenAmount: string | null;\n\n /** Estimated base fee of the swap. */\n estimatedBaseFee: string | null;\n\n /** Address of the source token. */\n sourceTokenAddress: string | null;\n\n /** Amount of the source token. */\n sourceTokenAmount: string | null;\n\n /** Number of decimals of the source token. */\n sourceTokenDecimals: number | null;\n\n /** Symbol of the source token. */\n sourceTokenSymbol: string | null;\n\n /** Recipient of the swap and send transaction. */\n swapAndSendRecipient: string | null;\n\n /** Untyped raw metadata values. */\n swapMetaData: Record<string, never> | null;\n\n /** Value of the token being swapped. */\n swapTokenValue: string | null;\n};\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA0DA;;GAEG;AACH,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,gDAAyB,CAAA;IACzB,4CAAqB,CAAA;IACrB,wCAAiB,CAAA;IACjB,8CAAuB,CAAA;IACvB,wCAAiB,CAAA;IACjB,8CAAuB,CAAA;AACzB,CAAC,EAPW,mBAAmB,KAAnB,mBAAmB,QAO9B","sourcesContent":["import type {\n TransactionParams,\n TransactionType,\n UserFeeLevel,\n} from '@metamask/transaction-controller';\nimport type { Hex } from '@metamask/utils';\n\n/**\n * A complete user operation to be submitted to a bundler.\n * Defined in EIP-4337.\n */\nexport type UserOperation = {\n /** The data to pass to the sender during the main execution call. */\n callData: string;\n\n /** The amount of gas to allocate the main execution call. */\n callGasLimit: string;\n\n /**\n * The initCode of the account.\n * Needed if and only if the account is not yet on-chain and needs to be created.\n */\n initCode: string;\n\n /**\n * Maximum fee per gas.\n * Similar to EIP-1559 max_fee_per_gas.\n */\n maxFeePerGas: string;\n\n /**\n * Maximum priority fee per gas.\n * Similar to EIP-1559 max_priority_fee_per_gas.\n */\n maxPriorityFeePerGas: string;\n\n /** Anti-replay parameter. */\n nonce: string;\n\n /**\n * Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster.\n * Empty for self-sponsored transactions.\n */\n paymasterAndData: string;\n\n /** The amount of gas to pay to compensate the bundler for pre-verification execution, calldata and any gas overhead that cannot be tracked on-chain. */\n preVerificationGas: string;\n\n /** The account making the operation. */\n sender: string;\n\n /** Data passed into the account along with the nonce during the verification step. */\n signature: string;\n\n /** The amount of gas to allocate for the verification step. */\n verificationGasLimit: string;\n};\n\n/**\n * The possible statuses of a single user operation.\n */\nexport enum UserOperationStatus {\n Unapproved = 'unapproved',\n Approved = 'approved',\n Signed = 'signed',\n Submitted = 'submitted',\n Failed = 'failed',\n Confirmed = 'confirmed',\n}\n\n/** Information concerning an error while creating a user operation. */\nexport type UserOperationError = {\n /**\n * A descriptive error name.\n */\n name: string;\n\n /**\n * A descriptive error message providing details about the encountered error.\n */\n message: string;\n\n /**\n * The stack trace associated with the error, if available.\n */\n stack: string | null;\n\n /**\n * An optional error code associated with the error.\n */\n code: string | null;\n\n /**\n * Additional information related to the error.\n */\n rpc: string | null;\n};\n\n/**\n * Metadata concerning a single user operation, stored in the client state.\n */\nexport type UserOperationMetadata = {\n /** Confirmed total cost of the gas for the user operation. */\n actualGasCost: string | null;\n\n /** Confirmed total amount of gas used by the user operation. */\n actualGasUsed: string | null;\n\n /** Base fee of the transaction block as a hex value. */\n baseFeePerGas: string | null;\n\n /** URL of the bundler that the operation was submitted to. */\n bundlerUrl: string | null;\n\n /** Hexadecimal chain ID of the target network. */\n chainId: string;\n\n /** An error that occurred while creating the operation. */\n error: UserOperationError | null;\n\n /** Hash of the user operation, generated by the bundler. */\n hash: string | null;\n\n /** A unique ID used to identify a user operation in the client. */\n id: string;\n\n /** The origin of the user operation, such as the hostname of a dApp. */\n origin: string;\n\n /** Current status of the user operation. */\n status: UserOperationStatus;\n\n /** Metadata specific to swap transactions. */\n swapsMetadata: SwapsMetadata | null;\n\n /** Timestamp of when the user operation was created. */\n time: number;\n\n /** Hash of the transaction that submitted the user operation to the entrypoint. */\n transactionHash: string | null;\n\n /** The initial transaction parameters that the user operation was created from. */\n transactionParams: Required<TransactionParams> | null;\n\n /** The type of transaction that the user operation will create. */\n transactionType: TransactionType | null;\n\n /** The origin of the gas fee values. */\n userFeeLevel: UserFeeLevel | null;\n\n /** Resulting user operation object to be submitted to the bundler. */\n userOperation: UserOperation;\n};\n\n/**\n * The data provided to the smart contract account when preparing a user operation.\n */\nexport type PrepareUserOperationRequest = {\n /** The hexadecimal chain ID of the target network. */\n chainId: string;\n\n /** The data to include in the resulting transaction. */\n data?: string;\n\n /** Address of the account requesting the user operation. */\n from: string;\n\n /** The destination address of the resulting transaction. */\n to?: string;\n\n /** The value to send in the resulting transaction. */\n value?: string;\n};\n\n/**\n * The data provided to the smart contract account when updating a user operation.\n */\nexport type UpdateUserOperationRequest = {\n /** The user operation to update including the dummy signature and dummy paymasterAndData values. */\n userOperation: UserOperation;\n\n /** The hexadecimal chain ID of the target network. */\n chainId: string;\n};\n\n/**\n * The data provided to the smart contract account when signing a user operation.\n */\nexport type SignUserOperationRequest = {\n /** The user operation to sign including the dummy signature and final paymasterAndData values. */\n userOperation: UserOperation;\n\n /** The hexadecimal chain ID of the target network. */\n chainId: string;\n};\n\n/**\n * The data returned by the smart contract account when preparing a user operation.\n */\nexport type PrepareUserOperationResponse = {\n /** The URL of the bundler to submit the user operation to. */\n bundler: string;\n\n /** The data to pass to the sender during the main execution call. */\n callData: string;\n\n /**\n * A dummy paymasterAndData value required to estimate gas using the bundler.\n * Only required if the smart contract account is not providing gas values.\n */\n dummyPaymasterAndData?: string;\n\n /**\n * A dummy signature value required to estimate gas using the bundler.\n * Only required if the smart contract account is not providing gas values.\n */\n dummySignature?: string;\n\n /**\n * The estimated gas limits for the user operation.\n * Gas is automatically estimated using the bundler if not provided.\n */\n gas?: {\n /** The amount of gas to allocate to the main execution call. */\n callGasLimit: string;\n\n /** The amount of gas to pay to compensate the bundler for pre-verification execution, calldata and any gas overhead that cannot be tracked on-chain. */\n preVerificationGas: string;\n\n /** The amount of gas to allocate for the verification step. */\n verificationGasLimit: string;\n };\n\n /**\n * The initCode to include in the user operation.\n * Required only if the smart contract is not yet deployed.\n */\n initCode?: string;\n\n /**\n * The nonce to include in the user operation, specific to the smart contract account.\n */\n nonce: string;\n\n /**\n * The address of the smart contract account creating the user operation.\n */\n sender: string;\n};\n\n/**\n * The data returned by the smart contract account when updating a user operation.\n */\nexport type UpdateUserOperationResponse = {\n /**\n * The final paymasterAndData to include in the user operation.\n * Not required if a paymaster is not sponsoring the transaction.\n */\n paymasterAndData?: string;\n\n /**\n * The final gas limits for the user operation suggested by the smart contract account.\n * The simulated gas limits may be different after the bundler estimates gas with the use\n * of the paymaster.\n */\n callGasLimit?: string;\n preVerificationGas?: string;\n verificationGasLimit?: string;\n};\n\n/**\n * The data returned by the smart contract account when signing a user operation.\n */\nexport type SignUserOperationResponse = {\n /** The final signature of the user operation. */\n signature: string;\n};\n\n/**\n * An abstraction to provide smart contract and paymaster specific data when creating a user operation.\n * This will typically communicate with an account snap installed in the client.\n */\nexport type SmartContractAccount = {\n /**\n * Retrieve the initial values required to create a user operation.\n * @param request - The data needed by the smart contract account to provide the initial user operation values.\n * @returns The initial values required to create a user operation.\n */\n prepareUserOperation: (\n request: PrepareUserOperationRequest,\n ) => Promise<PrepareUserOperationResponse>;\n\n /**\n * Retrieve additional data required to create a user operation, such as the paymasterAndData value.\n * If gas values were not provided in the prepare response, this will be called after estimating gas using the bundler.\n * @param request - The data needed by the smart contract account to provide the additional user operation values.\n * @returns The additional values required to create a user operation.\n */\n updateUserOperation: (\n request: UpdateUserOperationRequest,\n ) => Promise<UpdateUserOperationResponse>;\n\n /**\n * Sign the final user operation.\n * @param request - The data needed by the smart contract account to generate the signature.\n * @returns The final values required to sign a user operation.\n */\n signUserOperation: (\n request: SignUserOperationRequest,\n ) => Promise<SignUserOperationResponse>;\n};\n\n/**\n * Response from the `eth_getUserOperationReceipt` bundler method.\n * Includes the status of a completed user operation and the receipt of the transaction that submitted it.\n */\nexport type UserOperationReceipt = {\n /** Confirmed total cost of the gas for the user operation. */\n actualGasCost: Hex | number;\n\n /** Confirmed total amount of gas used by the user operation. */\n actualGasUsed: Hex | number;\n\n /** True if the user operation was successfully confirmed on chain. */\n success: boolean;\n\n /** Receipt for the associated transaction. */\n receipt: {\n /** Hash of the block the transaction was added to. */\n blockHash: string;\n\n /** Hash of the confirmed transaction. */\n transactionHash: string;\n };\n};\n\n/** Information specific to user operations created from swap transactions. */\nexport type SwapsMetadata = {\n /** ID of the associated approval transaction. */\n approvalTxId: string | null;\n\n /** Address of the destination token. */\n destinationTokenAddress: string | null;\n\n /** Number of decimals of the destination token. */\n destinationTokenDecimals: number | null;\n\n /** Symbol of the destination token. */\n destinationTokenSymbol: string | null;\n\n /** Amount of the destination token. */\n destinationTokenAmount: string | null;\n\n /** Estimated base fee of the swap. */\n estimatedBaseFee: string | null;\n\n /** Address of the source token. */\n sourceTokenAddress: string | null;\n\n /** Amount of the source token. */\n sourceTokenAmount: string | null;\n\n /** Number of decimals of the source token. */\n sourceTokenDecimals: number | null;\n\n /** Symbol of the source token. */\n sourceTokenSymbol: string | null;\n\n /** Recipient of the swap and send transaction. */\n swapAndSendRecipient: string | null;\n\n /** Untyped raw metadata values. */\n swapMetaData: Record<string, never> | null;\n\n /** Value of the token being swapped. */\n swapTokenValue: string | null;\n};\n"]}
@@ -14,7 +14,6 @@ const logger_1 = require("../logger.cjs");
14
14
  const log = (0, logger_1.createModuleLogger)(logger_1.projectLogger, 'gas-fees');
15
15
  /**
16
16
  * Populates the gas fee properties for a user operation.
17
- *
18
17
  * @param request - The request to update the gas fees.
19
18
  * @param request.getGasFeeEstimates - A callback to get gas fee estimates.
20
19
  * @param request.metadata - The metadata for the user operation.
@@ -39,7 +38,6 @@ async function updateGasFees(request) {
39
38
  exports.updateGasFees = updateGasFees;
40
39
  /**
41
40
  * Gets the maxFeePerGas for a user operation.
42
- *
43
41
  * @param originalRequest - The original request to add the user operation.
44
42
  * @param getGetFasEstimates - A callback to get gas fee estimates.
45
43
  * @param transaction - The transaction that created the user operation.
@@ -65,7 +63,6 @@ async function getMaxFeePerGas(originalRequest, getGetFasEstimates, transaction)
65
63
  }
66
64
  /**
67
65
  * Gets the maxPriorityFeePerGas for a user operation.
68
- *
69
66
  * @param originalRequest - The original request to add the user operation.
70
67
  * @param getGetFasEstimates - A callback to get gas fee estimates.
71
68
  * @param userOperation - The user operation being updated.
@@ -94,7 +91,6 @@ async function getMaxPriorityFeePerGas(originalRequest, getGetFasEstimates, user
94
91
  }
95
92
  /**
96
93
  * Gets the userFeeLevel for a user operation.
97
- *
98
94
  * @param metadata - The metadata for the user operation.
99
95
  * @param originalRequest - The original request to add the user operation.
100
96
  * @param suggestedGasFees - The suggested gas fees, if any.
@@ -125,7 +121,6 @@ function getUserFeeLevel(metadata, originalRequest, suggestedGasFees, transactio
125
121
  }
126
122
  /**
127
123
  * Gets suggested gas fees.
128
- *
129
124
  * @param request - The request to update the gas fees.
130
125
  * @param request.getGasFeeEstimates - A callback to get gas fee estimates.
131
126
  * @param request.provider - A provider to query the network.
@@ -175,7 +170,6 @@ async function getSuggestedGasFees(request) {
175
170
  }
176
171
  /**
177
172
  * Converts a GWEI decimal string to a WEI hexadecimal string.
178
- *
179
173
  * @param value - The GWEI decimal string to convert.
180
174
  * @returns The WEI hexadecimal string.
181
175
  */
@@ -184,7 +178,6 @@ function gweiDecimalToWeiHex(value) {
184
178
  }
185
179
  /**
186
180
  * Checks if a gas fee property is empty.
187
- *
188
181
  * @param value - The gas fee value to check.
189
182
  * @returns Whether the gas fee property is empty.
190
183
  */