@account-kit/infra 4.35.0 → 4.35.1

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 (41) hide show
  1. package/dist/esm/actions/simulateUserOperationChanges.js.map +1 -1
  2. package/dist/esm/actions/types.js.map +1 -1
  3. package/dist/esm/alchemyTransport.js +1 -1
  4. package/dist/esm/alchemyTransport.js.map +1 -1
  5. package/dist/esm/client/decorators/alchemyEnhancedApis.js.map +1 -1
  6. package/dist/esm/client/decorators/smartAccount.js.map +1 -1
  7. package/dist/esm/client/isAlchemySmartAccountClient.js.map +1 -1
  8. package/dist/esm/client/smartAccountClient.js.map +1 -1
  9. package/dist/esm/client/types.js.map +1 -1
  10. package/dist/esm/defaults.js.map +1 -1
  11. package/dist/esm/metrics.js.map +1 -1
  12. package/dist/esm/middleware/feeEstimator.js.map +1 -1
  13. package/dist/esm/middleware/gasManager.js.map +1 -1
  14. package/dist/esm/middleware/userOperationSimulator.js.map +1 -1
  15. package/dist/esm/version.d.ts +1 -1
  16. package/dist/esm/version.js +1 -1
  17. package/dist/esm/version.js.map +1 -1
  18. package/dist/types/actions/types.d.ts.map +1 -1
  19. package/dist/types/alchemyTrackerHeaders.d.ts.map +1 -1
  20. package/dist/types/alchemyTransport.d.ts.map +1 -1
  21. package/dist/types/chains.d.ts.map +1 -1
  22. package/dist/types/client/decorators/smartAccount.d.ts.map +1 -1
  23. package/dist/types/client/rpcClient.d.ts.map +1 -1
  24. package/dist/types/defaults.d.ts.map +1 -1
  25. package/dist/types/gas-manager.d.ts.map +1 -1
  26. package/dist/types/version.d.ts +1 -1
  27. package/package.json +5 -7
  28. package/src/actions/simulateUserOperationChanges.ts +5 -5
  29. package/src/actions/types.ts +11 -11
  30. package/src/alchemyTransport.ts +12 -9
  31. package/src/client/decorators/alchemyEnhancedApis.ts +4 -4
  32. package/src/client/decorators/smartAccount.ts +9 -8
  33. package/src/client/isAlchemySmartAccountClient.ts +2 -2
  34. package/src/client/smartAccountClient.ts +10 -10
  35. package/src/client/types.ts +1 -1
  36. package/src/defaults.ts +1 -1
  37. package/src/metrics.ts +1 -1
  38. package/src/middleware/feeEstimator.ts +3 -3
  39. package/src/middleware/gasManager.ts +25 -25
  40. package/src/middleware/userOperationSimulator.ts +1 -1
  41. package/src/version.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"simulateUserOperationChanges.js","sourceRoot":"","sources":["../../../src/actions/simulateUserOperationChanges.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,WAAW,GAGZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAIvF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAQiB,KAAK,EAC7D,MAAM,EACN,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAClD,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,2BAA2B,CAAC,MAAM,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,uBAAuB,CAC/B,2BAA2B,EAC3B,mCAAmC,EACnC,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,WAAW,CAC1B,MAAM,MAAM,CAAC,kBAAkB,CAAC;QAC9B,GAAG,MAAM;QACT,OAAO;QACP,SAAS;KACV,CAAC,CACH,CAAC;IAEF,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,MAAM,EAAE,2CAA2C;QACnD,MAAM,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC;KACpD,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import {\n AccountNotFoundError,\n IncompatibleClientError,\n deepHexlify,\n type SendUserOperationParameters,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport { isAlchemySmartAccountClient } from \"../client/isAlchemySmartAccountClient.js\";\nimport type { AlchemyRpcSchema } from \"../client/types.js\";\nimport type { SimulateUserOperationAssetChangesResponse } from \"./types.js\";\n\n/**\n * Simulates user operation changes including asset changes for a specified user operation and returns the resulting state changes.\n *\n * @example\n * ```ts\n * import { simulateUserOperationChanges, createAlchemyPublicRpcClient } from \"@account-kit/infra\";\n *\n * const client = createAlchemyPublicRpcClient(...);\n * const response = await simulateUserOperationChanges(client, {\n * uo: ...\n * });\n * ```\n *\n * @param {Client<Transport, TChain, TAccount, AlchemyRpcSchema>} client The client instance used to send the simulation request\n * @param {SendUserOperationParameters<TAccount>} args The parameters of the user operation including the account and other overrides\n * @returns {Promise<SimulateUserOperationAssetChangesResponse>} A promise that resolves to the response of the simulation showing the asset changes\n */\nexport const simulateUserOperationChanges: <\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<Transport, TChain, TAccount, AlchemyRpcSchema>,\n args: SendUserOperationParameters<TAccount>\n) => Promise<SimulateUserOperationAssetChangesResponse> = async (\n client,\n { account = client.account, overrides, ...params }\n) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isAlchemySmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"AlchemySmartAccountClient\",\n \"SimulateUserOperationAssetChanges\",\n client\n );\n }\n\n const uoStruct = deepHexlify(\n await client.buildUserOperation({\n ...params,\n account,\n overrides,\n })\n );\n\n return client.request({\n method: \"alchemy_simulateUserOperationAssetChanges\",\n params: [uoStruct, account.getEntryPoint().address],\n });\n};\n"]}
1
+ {"version":3,"file":"simulateUserOperationChanges.js","sourceRoot":"","sources":["../../../src/actions/simulateUserOperationChanges.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,WAAW,GAGZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAIvF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAQiB,KAAK,EAC7D,MAAM,EACN,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAClD,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,2BAA2B,CAAC,MAAM,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,uBAAuB,CAC/B,2BAA2B,EAC3B,mCAAmC,EACnC,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,WAAW,CAC1B,MAAM,MAAM,CAAC,kBAAkB,CAAC;QAC9B,GAAG,MAAM;QACT,OAAO;QACP,SAAS;KACV,CAAC,CACH,CAAC;IAEF,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,MAAM,EAAE,2CAA2C;QACnD,MAAM,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC;KACpD,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import {\n AccountNotFoundError,\n IncompatibleClientError,\n deepHexlify,\n type SendUserOperationParameters,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport { isAlchemySmartAccountClient } from \"../client/isAlchemySmartAccountClient.js\";\nimport type { AlchemyRpcSchema } from \"../client/types.js\";\nimport type { SimulateUserOperationAssetChangesResponse } from \"./types.js\";\n\n/**\n * Simulates user operation changes including asset changes for a specified user operation and returns the resulting state changes.\n *\n * @example\n * ```ts\n * import { simulateUserOperationChanges, createAlchemyPublicRpcClient } from \"@account-kit/infra\";\n *\n * const client = createAlchemyPublicRpcClient(...);\n * const response = await simulateUserOperationChanges(client, {\n * uo: ...\n * });\n * ```\n *\n * @param {Client<Transport, TChain, TAccount, AlchemyRpcSchema>} client The client instance used to send the simulation request\n * @param {SendUserOperationParameters<TAccount>} args The parameters of the user operation including the account and other overrides\n * @returns {Promise<SimulateUserOperationAssetChangesResponse>} A promise that resolves to the response of the simulation showing the asset changes\n */\nexport const simulateUserOperationChanges: <\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n>(\n client: Client<Transport, TChain, TAccount, AlchemyRpcSchema>,\n args: SendUserOperationParameters<TAccount>,\n) => Promise<SimulateUserOperationAssetChangesResponse> = async (\n client,\n { account = client.account, overrides, ...params },\n) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isAlchemySmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"AlchemySmartAccountClient\",\n \"SimulateUserOperationAssetChanges\",\n client,\n );\n }\n\n const uoStruct = deepHexlify(\n await client.buildUserOperation({\n ...params,\n account,\n overrides,\n }),\n );\n\n return client.request({\n method: \"alchemy_simulateUserOperationAssetChanges\",\n params: [uoStruct, account.getEntryPoint().address],\n });\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/actions/types.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,iBAUX;AAVD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,oCAAe,CAAA;IACf,sCAAiB,CAAA;IACjB,wCAAmB,CAAA;IACnB;;;OAGG;IACH,gDAA2B,CAAA;AAC7B,CAAC,EAVW,iBAAiB,KAAjB,iBAAiB,QAU5B;AAED,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,2CAAqB,CAAA;AACvB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B","sourcesContent":["import type {\n UserOperationStruct,\n UserOperationRequest,\n UserOperationOverrides,\n EntryPointVersion,\n} from \"@aa-sdk/core\";\nimport type { Address, Hash, Hex } from \"viem\";\n\nexport enum SimulateAssetType {\n NATIVE = \"NATIVE\",\n ERC20 = \"ERC20\",\n ERC721 = \"ERC721\",\n ERC1155 = \"ERC1155\",\n /**\n * Special contracts that don't follow ERC 721/1155. Currently limited to\n * CryptoKitties and CryptoPunks.\n */\n SPECIAL_NFT = \"SPECIAL_NFT\",\n}\n\nexport enum SimulateChangeType {\n APPROVE = \"APPROVE\",\n TRANSFER = \"TRANSFER\",\n}\n\nexport type SimulateUserOperationAssetChangesRequest = [\n UserOperationStruct,\n entryPoint: Address,\n blockNumber?: Hash\n];\n\nexport type SimulateUserOperationAssetChangesResponse = {\n changes: SimulateAssetChange[];\n error?: SimulateAssetChangesError;\n};\n\nexport interface SimulateAssetChangesError extends Record<string, any> {\n message: string;\n}\n\nexport interface SimulateAssetChange {\n assetType: SimulateAssetType;\n changeType: SimulateChangeType;\n from: Address;\n to: Address;\n rawAmount?: string;\n amount?: string;\n contactAddress: Address;\n tokenId?: string;\n decimals: number;\n symbol: string;\n name?: string;\n logo?: string;\n}\n\nexport type RequestGasAndPaymasterAndDataRequest = [\n {\n policyId: string | string[];\n entryPoint: Address;\n erc20Context?: {\n tokenAddress: Address;\n permit?: Hex;\n maxTokenAmount?: BigInt;\n };\n dummySignature: Hex;\n userOperation: UserOperationRequest;\n overrides?: UserOperationOverrides;\n }\n];\n\nexport type RequestGasAndPaymasterAndDataResponse<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = Pick<\n UserOperationRequest,\n | \"callGasLimit\"\n | \"preVerificationGas\"\n | \"verificationGasLimit\"\n | \"maxFeePerGas\"\n | \"maxPriorityFeePerGas\"\n> &\n (TEntryPointVersion extends \"0.6.0\"\n ? {\n paymasterAndData: UserOperationRequest<\"0.6.0\">[\"paymasterAndData\"];\n }\n : TEntryPointVersion extends \"0.7.0\"\n ? Pick<\n UserOperationRequest<\"0.7.0\">,\n | \"paymaster\"\n | \"paymasterData\"\n | \"paymasterVerificationGasLimit\"\n | \"paymasterPostOpGasLimit\"\n >\n : never);\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/actions/types.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,iBAUX;AAVD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,oCAAe,CAAA;IACf,sCAAiB,CAAA;IACjB,wCAAmB,CAAA;IACnB;;;OAGG;IACH,gDAA2B,CAAA;AAC7B,CAAC,EAVW,iBAAiB,KAAjB,iBAAiB,QAU5B;AAED,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,2CAAqB,CAAA;AACvB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B","sourcesContent":["import type {\n UserOperationStruct,\n UserOperationRequest,\n UserOperationOverrides,\n EntryPointVersion,\n} from \"@aa-sdk/core\";\nimport type { Address, Hash, Hex } from \"viem\";\n\nexport enum SimulateAssetType {\n NATIVE = \"NATIVE\",\n ERC20 = \"ERC20\",\n ERC721 = \"ERC721\",\n ERC1155 = \"ERC1155\",\n /**\n * Special contracts that don't follow ERC 721/1155. Currently limited to\n * CryptoKitties and CryptoPunks.\n */\n SPECIAL_NFT = \"SPECIAL_NFT\",\n}\n\nexport enum SimulateChangeType {\n APPROVE = \"APPROVE\",\n TRANSFER = \"TRANSFER\",\n}\n\nexport type SimulateUserOperationAssetChangesRequest = [\n UserOperationStruct,\n entryPoint: Address,\n blockNumber?: Hash,\n];\n\nexport type SimulateUserOperationAssetChangesResponse = {\n changes: SimulateAssetChange[];\n error?: SimulateAssetChangesError;\n};\n\nexport interface SimulateAssetChangesError extends Record<string, any> {\n message: string;\n}\n\nexport interface SimulateAssetChange {\n assetType: SimulateAssetType;\n changeType: SimulateChangeType;\n from: Address;\n to: Address;\n rawAmount?: string;\n amount?: string;\n contactAddress: Address;\n tokenId?: string;\n decimals: number;\n symbol: string;\n name?: string;\n logo?: string;\n}\n\nexport type RequestGasAndPaymasterAndDataRequest = [\n {\n policyId: string | string[];\n entryPoint: Address;\n erc20Context?: {\n tokenAddress: Address;\n permit?: Hex;\n maxTokenAmount?: BigInt;\n };\n dummySignature: Hex;\n userOperation: UserOperationRequest;\n overrides?: UserOperationOverrides;\n },\n];\n\nexport type RequestGasAndPaymasterAndDataResponse<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n> = Pick<\n UserOperationRequest,\n | \"callGasLimit\"\n | \"preVerificationGas\"\n | \"verificationGasLimit\"\n | \"maxFeePerGas\"\n | \"maxPriorityFeePerGas\"\n> &\n (TEntryPointVersion extends \"0.6.0\"\n ? {\n paymasterAndData: UserOperationRequest<\"0.6.0\">[\"paymasterAndData\"];\n }\n : TEntryPointVersion extends \"0.7.0\"\n ? Pick<\n UserOperationRequest<\"0.7.0\">,\n | \"paymaster\"\n | \"paymasterData\"\n | \"paymasterVerificationGasLimit\"\n | \"paymasterPostOpGasLimit\"\n >\n : never);\n"]}
@@ -106,7 +106,7 @@ export function alchemy(config) {
106
106
  : connectionConfig.rpcUrl;
107
107
  const chainAgnosticRpcUrl = connectionConfig.rpcUrl == null
108
108
  ? "https://api.g.alchemy.com/v2/"
109
- : connectionConfig.chainAgnosticUrl ?? connectionConfig.rpcUrl;
109
+ : (connectionConfig.chainAgnosticUrl ?? connectionConfig.rpcUrl);
110
110
  const innerTransport = (() => {
111
111
  mutateRemoveTrackingHeaders(config?.fetchOptions?.headers);
112
112
  if (config.alchemyConnection && config.nodeRpcUrl) {
@@ -1 +1 @@
1
- {"version":3,"file":"alchemyTransport.js","sourceRoot":"","sources":["../../src/alchemyTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,GAGN,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,eAAe,EACf,IAAI,GAOL,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AA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AE,EAAE;YAC7B,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC7B,CAAC,CAAC,CAAC;QACH,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACpC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YAC3B,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAA4B,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {\n ChainNotFoundError,\n ConnectionConfigSchema,\n split,\n type ConnectionConfig,\n type NoUndefined,\n} from \"@aa-sdk/core\";\nimport {\n createTransport,\n http,\n type Chain,\n type EIP1193RequestFn,\n type HttpTransportConfig,\n type PublicRpcSchema,\n type Transport,\n type TransportConfig,\n} from \"viem\";\nimport { mutateRemoveTrackingHeaders } from \"./alchemyTrackerHeaders.js\";\nimport type { AlchemyRpcSchema } from \"./client/types.js\";\nimport { AlchemyChainSchema } from \"./schema.js\";\nimport { VERSION } from \"./version.js\";\n\ntype Never<T> = T extends object\n ? {\n [K in keyof T]?: never;\n }\n : never;\n\ntype AlchemyConnectionConfig = ConnectionConfig;\n\ntype SplitTransportConfig = {\n alchemyConnection: AlchemyConnectionConfig;\n nodeRpcUrl: string;\n};\n\nconst alchemyMethods = [\n \"eth_sendUserOperation\",\n \"eth_estimateUserOperationGas\",\n \"eth_getUserOperationReceipt\",\n \"eth_getUserOperationByHash\",\n \"eth_supportedEntryPoints\",\n \"rundler_maxPriorityFeePerGas\",\n \"pm_getPaymasterData\",\n \"pm_getPaymasterStubData\",\n \"alchemy_requestGasAndPaymasterAndData\",\n];\n\nconst chainAgnosticMethods = [\n \"wallet_prepareCalls\",\n \"wallet_sendPreparedCalls\",\n \"wallet_requestAccount\",\n \"wallet_createAccount\",\n \"wallet_listAccounts\",\n \"wallet_createSession\",\n \"wallet_getCallsStatus\",\n];\n\nexport type AlchemyTransportConfig = (\n | (AlchemyConnectionConfig & Never<SplitTransportConfig>)\n | (SplitTransportConfig & Never<AlchemyConnectionConfig>)\n) & {\n /** The max number of times to retry. */\n retryCount?: TransportConfig[\"retryCount\"] | undefined;\n /** The base delay (in ms) between retries. */\n retryDelay?: TransportConfig[\"retryDelay\"] | undefined;\n fetchOptions?: NoUndefined<HttpTransportConfig[\"fetchOptions\"]>;\n};\n\ntype AlchemyTransportBase = Transport<\n \"alchemy\",\n {\n alchemyRpcUrl: string;\n fetchOptions?: AlchemyTransportConfig[\"fetchOptions\"];\n },\n EIP1193RequestFn<[...PublicRpcSchema, ...AlchemyRpcSchema]>\n>;\n\nexport type AlchemyTransport = AlchemyTransportBase & {\n updateHeaders(newHeaders: HeadersInit): void;\n config: AlchemyTransportConfig;\n dynamicFetchOptions: AlchemyTransportConfig[\"fetchOptions\"];\n};\n\n/**\n * A type guard for the transport to determine if it is an Alchemy transport.\n * Used in cases where we would like to do switching depending on the transport, where there used\n * to be two clients for a alchemy and a non alchemy, and with this switch we don't need the two seperate clients. *\n *\n * @param {Transport} transport The transport to check\n * @param {Chain} chain Chain for the transport to run its function to return the transport config\n * @returns {boolean} `true` if the transport is an Alchemy transport, otherwise `false`\n */\nexport function isAlchemyTransport(\n transport: Transport,\n chain: Chain\n): transport is AlchemyTransport {\n return transport({ chain }).config.type === \"alchemy\";\n}\n\n/**\n * Creates an Alchemy transport with the specified configuration options.\n * When sending all traffic to Alchemy, you must pass in one of rpcUrl, apiKey, or jwt.\n * If you want to send Bundler and Paymaster traffic to Alchemy and Node traffic to a different RPC, you must pass in alchemyConnection and nodeRpcUrl.\n *\n * @example\n * ### Basic Example\n * If the chain you're using is supported for both Bundler and Node RPCs, then you can do the following:\n * ```ts\n * import { alchemy } from \"@account-kit/infra\";\n *\n * const transport = alchemy({\n * // NOTE: you can also pass in an rpcUrl or jwt here or rpcUrl and jwt\n * apiKey: \"your-api-key\",\n * });\n * ```\n *\n * ### AA Only Chains\n * For AA-only chains, you need to specify the alchemyConnection and nodeRpcUrl since Alchemy only\n * handles the Bundler and Paymaster RPCs for these chains.\n * ```ts\n * import { alchemy } from \"@account-kit/infra\";\n *\n * const transport = alchemy({\n * alchemyConnection: {\n * apiKey: \"your-api-key\",\n * },\n * nodeRpcUrl: \"https://zora.rpc.url\",\n * });\n * ```\n *\n * @param {AlchemyTransportConfig} config The configuration object for the Alchemy transport.\n * @param {number} config.retryDelay Optional The delay between retries, in milliseconds.\n * @param {number} config.retryCount Optional The number of retry attempts.\n * @param {string} [config.alchemyConnection] Optional Alchemy connection configuration (if this is passed in, nodeRpcUrl is required).\n * @param {string} [config.fetchOptions] Optional fetch options for HTTP requests.\n * @param {string} [config.nodeRpcUrl] Optional RPC URL for node (if this is passed in, alchemyConnection is required).\n * @param {string} [config.rpcUrl] Optional RPC URL.\n * @param {string} [config.apiKey] Optional API key for Alchemy.\n * @param {string} [config.jwt] Optional JSON Web Token for authorization.\n * @returns {AlchemyTransport} The configured Alchemy transport object.\n */\nexport function alchemy(config: AlchemyTransportConfig): AlchemyTransport {\n const { retryDelay, retryCount } = config;\n // we create a copy here in case we create a split transport down below\n // we don't want to add alchemy headers to 3rd party nodes\n const fetchOptions = { ...config.fetchOptions };\n\n const connectionConfig = ConnectionConfigSchema.parse(\n config.alchemyConnection ?? config\n );\n\n const headersAsObject = convertHeadersToObject(fetchOptions.headers);\n\n // TODO: we probably should just log these headers during telemetry logging instead of doing this mutable header stuff\n fetchOptions.headers = {\n ...headersAsObject,\n \"Alchemy-AA-Sdk-Version\": VERSION,\n };\n\n if (connectionConfig.jwt != null || connectionConfig.apiKey != null) {\n fetchOptions.headers = {\n ...fetchOptions.headers,\n Authorization: `Bearer ${\n connectionConfig.jwt ?? connectionConfig.apiKey\n }`,\n };\n }\n\n const transport: AlchemyTransportBase = (opts) => {\n const { chain: chain_ } = opts;\n if (!chain_) {\n throw new ChainNotFoundError();\n }\n const chain = AlchemyChainSchema.parse(chain_);\n\n const rpcUrl =\n connectionConfig.rpcUrl == null\n ? `${chain.rpcUrls.alchemy.http[0]}/`\n : connectionConfig.rpcUrl;\n\n const chainAgnosticRpcUrl =\n connectionConfig.rpcUrl == null\n ? \"https://api.g.alchemy.com/v2/\"\n : connectionConfig.chainAgnosticUrl ?? connectionConfig.rpcUrl;\n\n const innerTransport = (() => {\n mutateRemoveTrackingHeaders(config?.fetchOptions?.headers);\n if (config.alchemyConnection && config.nodeRpcUrl) {\n return split({\n overrides: [\n {\n methods: alchemyMethods,\n transport: http(rpcUrl, { fetchOptions }),\n },\n {\n methods: chainAgnosticMethods,\n transport: http(chainAgnosticRpcUrl, { fetchOptions }),\n },\n ],\n fallback: http(config.nodeRpcUrl, {\n fetchOptions: config.fetchOptions,\n }),\n });\n }\n\n return split({\n overrides: [\n {\n methods: chainAgnosticMethods,\n transport: http(chainAgnosticRpcUrl, { fetchOptions }),\n },\n ],\n fallback: http(rpcUrl, { fetchOptions }),\n });\n })();\n\n return createTransport(\n {\n key: \"alchemy\",\n name: \"Alchemy Transport\",\n request: innerTransport(opts).request,\n retryCount: retryCount ?? opts?.retryCount,\n retryDelay,\n type: \"alchemy\",\n },\n { alchemyRpcUrl: rpcUrl, fetchOptions }\n );\n };\n\n return Object.assign(transport, {\n dynamicFetchOptions: fetchOptions,\n updateHeaders(newHeaders_: HeadersInit) {\n const newHeaders = convertHeadersToObject(newHeaders_);\n\n fetchOptions.headers = {\n ...fetchOptions.headers,\n ...newHeaders,\n };\n },\n config,\n });\n}\n\nexport const convertHeadersToObject = (\n headers?: HeadersInit\n): Record<string, string> => {\n if (!headers) {\n return {};\n }\n\n if (headers instanceof Headers) {\n const headersObject = {} as Record<string, string>;\n headers.forEach((value, key) => {\n headersObject[key] = value;\n });\n return headersObject;\n }\n\n if (Array.isArray(headers)) {\n return headers.reduce((acc, header) => {\n acc[header[0]] = header[1];\n return acc;\n }, {} as Record<string, string>);\n }\n\n return headers;\n};\n"]}
1
+ {"version":3,"file":"alchemyTransport.js","sourceRoot":"","sources":["../../src/alchemyTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,GAGN,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,eAAe,EACf,IAAI,GAOL,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAEzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAevC,MAAM,cAAc,GAAG;IACrB,uBAAuB;IACvB,8BAA8B;IAC9B,6BAA6B;IAC7B,4BAA4B;IAC5B,0BAA0B;IAC1B,8BAA8B;IAC9B,qBAAqB;IACrB,yBAAyB;IACzB,uCAAuC;CACxC,CAAC;AAEF,MAAM,oBAAoB,GAAG;IAC3B,qBAAqB;IACrB,0BAA0B;IAC1B,uBAAuB;IACvB,sBAAsB;IACtB,qBAAqB;IACrB,sBAAsB;IACtB,uBAAuB;CACxB,CAAC;AA4BF;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAChC,SAAoB,EACpB,KAAY;IAEZ,OAAO,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC;AACxD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,UAAU,OAAO,CAAC,MAA8B;IACpD,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAC1C,uEAAuE;IACvE,0DAA0D;IAC1D,MAAM,YAAY,GAAG,EAAE,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;IAEhD,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,KAAK,CACnD,MAA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,GAAG,UAAU;aACd,CAAC;QACJ,CAAC;QACD,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,OAAqB,EACG,EAAE;IAC1B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,OAAO,YAAY,OAAO,EAAE,CAAC;QAC/B,MAAM,aAAa,GAAG,EAA4B,CAAC;QACnD,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC7B,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC7B,CAAC,CAAC,CAAC;QACH,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO,OAAO,CAAC,MAAM,CACnB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACd,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YAC3B,OAAO,GAAG,CAAC;QACb,CAAC,EACD,EAA4B,CAC7B,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {\n ChainNotFoundError,\n ConnectionConfigSchema,\n split,\n type ConnectionConfig,\n type NoUndefined,\n} from \"@aa-sdk/core\";\nimport {\n createTransport,\n http,\n type Chain,\n type EIP1193RequestFn,\n type HttpTransportConfig,\n type PublicRpcSchema,\n type Transport,\n type TransportConfig,\n} from \"viem\";\nimport { mutateRemoveTrackingHeaders } from \"./alchemyTrackerHeaders.js\";\nimport type { AlchemyRpcSchema } from \"./client/types.js\";\nimport { AlchemyChainSchema } from \"./schema.js\";\nimport { VERSION } from \"./version.js\";\n\ntype Never<T> = T extends object\n ? {\n [K in keyof T]?: never;\n }\n : never;\n\ntype AlchemyConnectionConfig = ConnectionConfig;\n\ntype SplitTransportConfig = {\n alchemyConnection: AlchemyConnectionConfig;\n nodeRpcUrl: string;\n};\n\nconst alchemyMethods = [\n \"eth_sendUserOperation\",\n \"eth_estimateUserOperationGas\",\n \"eth_getUserOperationReceipt\",\n \"eth_getUserOperationByHash\",\n \"eth_supportedEntryPoints\",\n \"rundler_maxPriorityFeePerGas\",\n \"pm_getPaymasterData\",\n \"pm_getPaymasterStubData\",\n \"alchemy_requestGasAndPaymasterAndData\",\n];\n\nconst chainAgnosticMethods = [\n \"wallet_prepareCalls\",\n \"wallet_sendPreparedCalls\",\n \"wallet_requestAccount\",\n \"wallet_createAccount\",\n \"wallet_listAccounts\",\n \"wallet_createSession\",\n \"wallet_getCallsStatus\",\n];\n\nexport type AlchemyTransportConfig = (\n | (AlchemyConnectionConfig & Never<SplitTransportConfig>)\n | (SplitTransportConfig & Never<AlchemyConnectionConfig>)\n) & {\n /** The max number of times to retry. */\n retryCount?: TransportConfig[\"retryCount\"] | undefined;\n /** The base delay (in ms) between retries. */\n retryDelay?: TransportConfig[\"retryDelay\"] | undefined;\n fetchOptions?: NoUndefined<HttpTransportConfig[\"fetchOptions\"]>;\n};\n\ntype AlchemyTransportBase = Transport<\n \"alchemy\",\n {\n alchemyRpcUrl: string;\n fetchOptions?: AlchemyTransportConfig[\"fetchOptions\"];\n },\n EIP1193RequestFn<[...PublicRpcSchema, ...AlchemyRpcSchema]>\n>;\n\nexport type AlchemyTransport = AlchemyTransportBase & {\n updateHeaders(newHeaders: HeadersInit): void;\n config: AlchemyTransportConfig;\n dynamicFetchOptions: AlchemyTransportConfig[\"fetchOptions\"];\n};\n\n/**\n * A type guard for the transport to determine if it is an Alchemy transport.\n * Used in cases where we would like to do switching depending on the transport, where there used\n * to be two clients for a alchemy and a non alchemy, and with this switch we don't need the two seperate clients. *\n *\n * @param {Transport} transport The transport to check\n * @param {Chain} chain Chain for the transport to run its function to return the transport config\n * @returns {boolean} `true` if the transport is an Alchemy transport, otherwise `false`\n */\nexport function isAlchemyTransport(\n transport: Transport,\n chain: Chain,\n): transport is AlchemyTransport {\n return transport({ chain }).config.type === \"alchemy\";\n}\n\n/**\n * Creates an Alchemy transport with the specified configuration options.\n * When sending all traffic to Alchemy, you must pass in one of rpcUrl, apiKey, or jwt.\n * If you want to send Bundler and Paymaster traffic to Alchemy and Node traffic to a different RPC, you must pass in alchemyConnection and nodeRpcUrl.\n *\n * @example\n * ### Basic Example\n * If the chain you're using is supported for both Bundler and Node RPCs, then you can do the following:\n * ```ts\n * import { alchemy } from \"@account-kit/infra\";\n *\n * const transport = alchemy({\n * // NOTE: you can also pass in an rpcUrl or jwt here or rpcUrl and jwt\n * apiKey: \"your-api-key\",\n * });\n * ```\n *\n * ### AA Only Chains\n * For AA-only chains, you need to specify the alchemyConnection and nodeRpcUrl since Alchemy only\n * handles the Bundler and Paymaster RPCs for these chains.\n * ```ts\n * import { alchemy } from \"@account-kit/infra\";\n *\n * const transport = alchemy({\n * alchemyConnection: {\n * apiKey: \"your-api-key\",\n * },\n * nodeRpcUrl: \"https://zora.rpc.url\",\n * });\n * ```\n *\n * @param {AlchemyTransportConfig} config The configuration object for the Alchemy transport.\n * @param {number} config.retryDelay Optional The delay between retries, in milliseconds.\n * @param {number} config.retryCount Optional The number of retry attempts.\n * @param {string} [config.alchemyConnection] Optional Alchemy connection configuration (if this is passed in, nodeRpcUrl is required).\n * @param {string} [config.fetchOptions] Optional fetch options for HTTP requests.\n * @param {string} [config.nodeRpcUrl] Optional RPC URL for node (if this is passed in, alchemyConnection is required).\n * @param {string} [config.rpcUrl] Optional RPC URL.\n * @param {string} [config.apiKey] Optional API key for Alchemy.\n * @param {string} [config.jwt] Optional JSON Web Token for authorization.\n * @returns {AlchemyTransport} The configured Alchemy transport object.\n */\nexport function alchemy(config: AlchemyTransportConfig): AlchemyTransport {\n const { retryDelay, retryCount } = config;\n // we create a copy here in case we create a split transport down below\n // we don't want to add alchemy headers to 3rd party nodes\n const fetchOptions = { ...config.fetchOptions };\n\n const connectionConfig = ConnectionConfigSchema.parse(\n config.alchemyConnection ?? config,\n );\n\n const headersAsObject = convertHeadersToObject(fetchOptions.headers);\n\n // TODO: we probably should just log these headers during telemetry logging instead of doing this mutable header stuff\n fetchOptions.headers = {\n ...headersAsObject,\n \"Alchemy-AA-Sdk-Version\": VERSION,\n };\n\n if (connectionConfig.jwt != null || connectionConfig.apiKey != null) {\n fetchOptions.headers = {\n ...fetchOptions.headers,\n Authorization: `Bearer ${\n connectionConfig.jwt ?? connectionConfig.apiKey\n }`,\n };\n }\n\n const transport: AlchemyTransportBase = (opts) => {\n const { chain: chain_ } = opts;\n if (!chain_) {\n throw new ChainNotFoundError();\n }\n const chain = AlchemyChainSchema.parse(chain_);\n\n const rpcUrl =\n connectionConfig.rpcUrl == null\n ? `${chain.rpcUrls.alchemy.http[0]}/`\n : connectionConfig.rpcUrl;\n\n const chainAgnosticRpcUrl =\n connectionConfig.rpcUrl == null\n ? \"https://api.g.alchemy.com/v2/\"\n : (connectionConfig.chainAgnosticUrl ?? connectionConfig.rpcUrl);\n\n const innerTransport = (() => {\n mutateRemoveTrackingHeaders(config?.fetchOptions?.headers);\n if (config.alchemyConnection && config.nodeRpcUrl) {\n return split({\n overrides: [\n {\n methods: alchemyMethods,\n transport: http(rpcUrl, { fetchOptions }),\n },\n {\n methods: chainAgnosticMethods,\n transport: http(chainAgnosticRpcUrl, { fetchOptions }),\n },\n ],\n fallback: http(config.nodeRpcUrl, {\n fetchOptions: config.fetchOptions,\n }),\n });\n }\n\n return split({\n overrides: [\n {\n methods: chainAgnosticMethods,\n transport: http(chainAgnosticRpcUrl, { fetchOptions }),\n },\n ],\n fallback: http(rpcUrl, { fetchOptions }),\n });\n })();\n\n return createTransport(\n {\n key: \"alchemy\",\n name: \"Alchemy Transport\",\n request: innerTransport(opts).request,\n retryCount: retryCount ?? opts?.retryCount,\n retryDelay,\n type: \"alchemy\",\n },\n { alchemyRpcUrl: rpcUrl, fetchOptions },\n );\n };\n\n return Object.assign(transport, {\n dynamicFetchOptions: fetchOptions,\n updateHeaders(newHeaders_: HeadersInit) {\n const newHeaders = convertHeadersToObject(newHeaders_);\n\n fetchOptions.headers = {\n ...fetchOptions.headers,\n ...newHeaders,\n };\n },\n config,\n });\n}\n\nexport const convertHeadersToObject = (\n headers?: HeadersInit,\n): Record<string, string> => {\n if (!headers) {\n return {};\n }\n\n if (headers instanceof Headers) {\n const headersObject = {} as Record<string, string>;\n headers.forEach((value, key) => {\n headersObject[key] = value;\n });\n return headersObject;\n }\n\n if (Array.isArray(headers)) {\n return headers.reduce(\n (acc, header) => {\n acc[header[0]] = header[1];\n return acc;\n },\n {} as Record<string, string>,\n );\n }\n\n return headers;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"alchemyEnhancedApis.js","sourceRoot":"","sources":["../../../../src/client/decorators/alchemyEnhancedApis.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAazD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAgB;IAShB,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,MAAM,UAAU,GAAG,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEzD,IACE,OAAO,CAAC,MAAM,CAAC,GAAG;YAClB,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK,MAAM,CAAC,SAAS,CAAC,aAAa,EACrD,CAAC;YACD,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;QACJ,CAAC;QAED,OAAO;YACL,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,EAAE,EAAE,UAAU,CAAC,EAAE;YACjB,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { SmartContractAccount } from \"@aa-sdk/core\";\nimport type { Alchemy } from \"alchemy-sdk\";\nimport type { Chain } from \"viem\";\nimport { AlchemySdkClientSchema } from \"../../schema.js\";\nimport type { AlchemySmartAccountClient } from \"../smartAccountClient.js\";\n\nexport type AlchemyEnhancedApis = {\n core: Alchemy[\"core\"];\n nft: Alchemy[\"nft\"];\n transact: Alchemy[\"transact\"];\n debug: Alchemy[\"debug\"];\n ws: Alchemy[\"ws\"];\n notify: Alchemy[\"notify\"];\n config: Alchemy[\"config\"];\n};\n\n/**\n * Given an instance of the Alchemy SDK, returns a smart account client decorator which contains actions for interacting Alchemy's enhanced APIs.\n *\n * @example\n * ```ts\n * import { Alchemy } from \"alchemy-sdk\";\n * import { alchemyEnhancedApiActions } from \"@account-kit/infra\";\n * import { alchemySCAClient } from \"./client\";\n *\n * const alchemy = new Alchemy(...);\n * const enhancedApiDecorator = alchemyEnhancedApiActions(alchemy);\n * const withEnhancedApis = alchemySCAClient.extend(enhancedApiDecorator);\n * ```\n *\n * @param {Alchemy} alchemy The Alchemy instance containing the SDK client\n * @returns {(client: AlchemySmartAccountClient) => AlchemyEnhancedApis} A client decorator for Alchemy Smart Account clients that adds the enhanced API methods\n */\nexport function alchemyEnhancedApiActions(\n alchemy: Alchemy\n): <\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: AlchemySmartAccountClient<TChain, TAccount>\n) => AlchemyEnhancedApis {\n return (client) => {\n const alchemySdk = AlchemySdkClientSchema.parse(alchemy);\n\n if (\n alchemy.config.url &&\n alchemy.config.url !== client.transport.alchemyRpcUrl\n ) {\n throw new Error(\n \"Alchemy SDK client JSON-RPC URL must match AlchemyProvider JSON-RPC URL\"\n );\n }\n\n return {\n core: alchemySdk.core,\n nft: alchemySdk.nft,\n transact: alchemySdk.transact,\n debug: alchemySdk.debug,\n ws: alchemySdk.ws,\n notify: alchemySdk.notify,\n config: alchemySdk.config,\n };\n };\n}\n"]}
1
+ {"version":3,"file":"alchemyEnhancedApis.js","sourceRoot":"","sources":["../../../../src/client/decorators/alchemyEnhancedApis.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAazD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAgB;IAShB,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,MAAM,UAAU,GAAG,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEzD,IACE,OAAO,CAAC,MAAM,CAAC,GAAG;YAClB,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK,MAAM,CAAC,SAAS,CAAC,aAAa,EACrD,CAAC;YACD,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;QACJ,CAAC;QAED,OAAO;YACL,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,EAAE,EAAE,UAAU,CAAC,EAAE;YACjB,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { SmartContractAccount } from \"@aa-sdk/core\";\nimport type { Alchemy } from \"alchemy-sdk\";\nimport type { Chain } from \"viem\";\nimport { AlchemySdkClientSchema } from \"../../schema.js\";\nimport type { AlchemySmartAccountClient } from \"../smartAccountClient.js\";\n\nexport type AlchemyEnhancedApis = {\n core: Alchemy[\"core\"];\n nft: Alchemy[\"nft\"];\n transact: Alchemy[\"transact\"];\n debug: Alchemy[\"debug\"];\n ws: Alchemy[\"ws\"];\n notify: Alchemy[\"notify\"];\n config: Alchemy[\"config\"];\n};\n\n/**\n * Given an instance of the Alchemy SDK, returns a smart account client decorator which contains actions for interacting Alchemy's enhanced APIs.\n *\n * @example\n * ```ts\n * import { Alchemy } from \"alchemy-sdk\";\n * import { alchemyEnhancedApiActions } from \"@account-kit/infra\";\n * import { alchemySCAClient } from \"./client\";\n *\n * const alchemy = new Alchemy(...);\n * const enhancedApiDecorator = alchemyEnhancedApiActions(alchemy);\n * const withEnhancedApis = alchemySCAClient.extend(enhancedApiDecorator);\n * ```\n *\n * @param {Alchemy} alchemy The Alchemy instance containing the SDK client\n * @returns {(client: AlchemySmartAccountClient) => AlchemyEnhancedApis} A client decorator for Alchemy Smart Account clients that adds the enhanced API methods\n */\nexport function alchemyEnhancedApiActions(\n alchemy: Alchemy,\n): <\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n>(\n client: AlchemySmartAccountClient<TChain, TAccount>,\n) => AlchemyEnhancedApis {\n return (client) => {\n const alchemySdk = AlchemySdkClientSchema.parse(alchemy);\n\n if (\n alchemy.config.url &&\n alchemy.config.url !== client.transport.alchemyRpcUrl\n ) {\n throw new Error(\n \"Alchemy SDK client JSON-RPC URL must match AlchemyProvider JSON-RPC URL\",\n );\n }\n\n return {\n core: alchemySdk.core,\n nft: alchemySdk.nft,\n transact: alchemySdk.transact,\n debug: alchemySdk.debug,\n ws: alchemySdk.ws,\n notify: alchemySdk.notify,\n config: alchemySdk.config,\n };\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"smartAccount.js","sourceRoot":"","sources":["../../../../src/client/decorators/smartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EAQjB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAE7F,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAgC/C;;;;;;;;;;;;;;G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;QAE1C,MAAM,MAAM,GAAG,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC9C,cAAc,CAAC,MAAM,CAAC,KAAM,CAAC,EAAE,EAAE,OAAQ,CAAC,CAAC;QAC3C,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,cAAc,CAAC,OAAe,EAAE,OAA6B;IACpE,MAAM,UAAU,GAAG,wBAAwB,CAAC,OAAO,CAAC;QAClD,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,UAAU;QAChC,CAAC,CAAC,SAAS,CAAC;IAEd,WAAW,CAAC,UAAU,CAAC;QACrB,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE;YACJ,OAAO;YACP,UAAU,EAAE,UAAU;YACtB,UAAU,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO;SAC5C;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n isSmartAccountWithSigner,\n sendTransaction,\n sendTransactions,\n sendUserOperation,\n type GetEntryPointFromAccount,\n type SendTransactionsParameters,\n type SendUserOperationParameters,\n type SendUserOperationResult,\n type SmartContractAccount,\n type UserOperationContext,\n type UserOperationOverrides,\n clientHeaderTrack,\n} from \"@aa-sdk/core\";\nimport type {\n Chain,\n Client,\n Hex,\n SendTransactionParameters,\n Transport,\n} from \"viem\";\nimport { simulateUserOperationChanges } from \"../../actions/simulateUserOperationChanges.js\";\nimport type { SimulateUserOperationAssetChangesResponse } from \"../../actions/types.js\";\nimport { InfraLogger } from \"../../metrics.js\";\n\nexport type AlchemySmartAccountClientActions<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TChain extends Chain | undefined = Chain | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n simulateUserOperation: (\n args: SendUserOperationParameters<TAccount, TContext>\n ) => Promise<SimulateUserOperationAssetChangesResponse>;\n sendUserOperation: (\n args: SendUserOperationParameters<\n TAccount,\n TContext,\n GetEntryPointFromAccount<TAccount>\n >\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n sendTransaction: <TChainOverride extends Chain | undefined = undefined>(\n args: SendTransactionParameters<TChain, TAccount, TChainOverride>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext\n ) => Promise<Hex>;\n sendTransactions: (\n args: SendTransactionsParameters<TAccount, TContext>\n ) => Promise<Hex>;\n};\n\n/**\n * Provides a set of actions for interacting with the Alchemy Smart Account client, including the ability to simulate user operations.\n *\n * @example\n * ```ts\n * import { alchemyActions } from \"@account-kit/infra\";\n * import { createPublicClient } from \"viem\";\n *\n * const client = createPublicClient(...);\n * const clientWithAlchemyActions = client.extend(alchemyActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client_ The client instance used to perform actions\n * @returns {AlchemySmartAccountClientActions<TAccount, TContext>} An object containing Alchemy Smart Account client actions\n */\nexport const alchemyActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => AlchemySmartAccountClientActions<TAccount, TContext, TChain> = (\n client_\n) => ({\n simulateUserOperation: async (args) => {\n const client = clientHeaderTrack(client_, \"simulateUserOperation\");\n return simulateUserOperationChanges(client, args);\n },\n async sendUserOperation(args) {\n const client = clientHeaderTrack(client_, \"infraSendUserOperation\");\n const { account = client.account } = args;\n\n const result = sendUserOperation(client, args);\n logSendUoEvent(client.chain!.id, account!);\n return result;\n },\n sendTransaction: async (args, overrides, context) => {\n const client = clientHeaderTrack(client_, \"sendTransaction\");\n const { account = client.account } = args;\n\n const result = await sendTransaction(client, args, overrides, context);\n logSendUoEvent(client.chain!.id, account as SmartContractAccount);\n return result;\n },\n async sendTransactions(args) {\n const client = clientHeaderTrack(client_, \"sendTransactions\");\n const { account = client.account } = args;\n\n const result = sendTransactions(client, args);\n logSendUoEvent(client.chain!.id, account!);\n return result;\n },\n});\n\nfunction logSendUoEvent(chainId: number, account: SmartContractAccount) {\n const signerType = isSmartAccountWithSigner(account)\n ? account.getSigner().signerType\n : \"unknown\";\n\n InfraLogger.trackEvent({\n name: \"client_send_uo\",\n data: {\n chainId,\n signerType: signerType,\n entryPoint: account.getEntryPoint().address,\n },\n });\n}\n"]}
1
+ {"version":3,"file":"smartAccount.js","sourceRoot":"","sources":["../../../../src/client/decorators/smartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EAQjB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAE7F,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAiC/C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,cAAc,GAWyC,CAClE,OAAO,EACP,EAAE,CAAC,CAAC;IACJ,qBAAqB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACpC,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC;QACnE,OAAO,4BAA4B,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;IACD,KAAK,CAAC,iBAAiB,CAAC,IAAI;QAC1B,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC;QACpE,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;QAE1C,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/C,cAAc,CAAC,MAAM,CAAC,KAAM,CAAC,EAAE,EAAE,OAAQ,CAAC,C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{\n isSmartAccountWithSigner,\n sendTransaction,\n sendTransactions,\n sendUserOperation,\n type GetEntryPointFromAccount,\n type SendTransactionsParameters,\n type SendUserOperationParameters,\n type SendUserOperationResult,\n type SmartContractAccount,\n type UserOperationContext,\n type UserOperationOverrides,\n clientHeaderTrack,\n} from \"@aa-sdk/core\";\nimport type {\n Chain,\n Client,\n Hex,\n SendTransactionParameters,\n Transport,\n} from \"viem\";\nimport { simulateUserOperationChanges } from \"../../actions/simulateUserOperationChanges.js\";\nimport type { SimulateUserOperationAssetChangesResponse } from \"../../actions/types.js\";\nimport { InfraLogger } from \"../../metrics.js\";\n\nexport type AlchemySmartAccountClientActions<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TChain extends Chain | undefined = Chain | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n> = {\n simulateUserOperation: (\n args: SendUserOperationParameters<TAccount, TContext>,\n ) => Promise<SimulateUserOperationAssetChangesResponse>;\n sendUserOperation: (\n args: SendUserOperationParameters<\n TAccount,\n TContext,\n GetEntryPointFromAccount<TAccount>\n >,\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n sendTransaction: <TChainOverride extends Chain | undefined = undefined>(\n args: SendTransactionParameters<TChain, TAccount, TChainOverride>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext,\n ) => Promise<Hex>;\n sendTransactions: (\n args: SendTransactionsParameters<TAccount, TContext>,\n ) => Promise<Hex>;\n};\n\n/**\n * Provides a set of actions for interacting with the Alchemy Smart Account client, including the ability to simulate user operations.\n *\n * @example\n * ```ts\n * import { alchemyActions } from \"@account-kit/infra\";\n * import { createPublicClient } from \"viem\";\n *\n * const client = createPublicClient(...);\n * const clientWithAlchemyActions = client.extend(alchemyActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client_ The client instance used to perform actions\n * @returns {AlchemySmartAccountClientActions<TAccount, TContext>} An object containing Alchemy Smart Account client actions\n */\nexport const alchemyActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(\n client: Client<TTransport, TChain, TAccount>,\n) => AlchemySmartAccountClientActions<TAccount, TContext, TChain> = (\n client_,\n) => ({\n simulateUserOperation: async (args) => {\n const client = clientHeaderTrack(client_, \"simulateUserOperation\");\n return simulateUserOperationChanges(client, args);\n },\n async sendUserOperation(args) {\n const client = clientHeaderTrack(client_, \"infraSendUserOperation\");\n const { account = client.account } = args;\n\n const result = sendUserOperation(client, args);\n logSendUoEvent(client.chain!.id, account!);\n return result;\n },\n sendTransaction: async (args, overrides, context) => {\n const client = clientHeaderTrack(client_, \"sendTransaction\");\n const { account = client.account } = args;\n\n const result = await sendTransaction(client, args, overrides, context);\n logSendUoEvent(client.chain!.id, account as SmartContractAccount);\n return result;\n },\n async sendTransactions(args) {\n const client = clientHeaderTrack(client_, \"sendTransactions\");\n const { account = client.account } = args;\n\n const result = sendTransactions(client, args);\n logSendUoEvent(client.chain!.id, account!);\n return result;\n },\n});\n\nfunction logSendUoEvent(chainId: number, account: SmartContractAccount) {\n const signerType = isSmartAccountWithSigner(account)\n ? account.getSigner().signerType\n : \"unknown\";\n\n InfraLogger.trackEvent({\n name: \"client_send_uo\",\n data: {\n chainId,\n signerType: signerType,\n entryPoint: account.getEntryPoint().address,\n },\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"isAlchemySmartAccountClient.js","sourceRoot":"","sources":["../../../src/client/isAlchemySmartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,MAAM,cAAc,CAAC;AAIzD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,2BAA2B,CAMzC,MAA2C;IAE3C,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC;AAC7C,CAAC","sourcesContent":["import { type SmartContractAccount } from \"@aa-sdk/core\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport type { AlchemySmartAccountClient } from \"./smartAccountClient\";\n\n/**\n * Checks if a given client is an Alchemy Smart Account Client. The goal of this check is to ensure that the client supports certain RPC methods.\n *\n * @example\n * ```ts\n * import { isAlchemySmartAccountClient } from \"@account-kit/infra\";\n *\n * if (isAlchemySmartAccountClient(client)) {\n * // do things with the client as an Alchemy Smart Account Client\n * }\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance to be checked\n * @returns {boolean} `true` if the client is an Alchemy Smart Account Client, otherwise `false`\n */\nexport function isAlchemySmartAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<Transport, TChain, TAccount>\n): client is AlchemySmartAccountClient<TChain, TAccount> {\n return client.transport.type === \"alchemy\";\n}\n"]}
1
+ {"version":3,"file":"isAlchemySmartAccountClient.js","sourceRoot":"","sources":["../../../src/client/isAlchemySmartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,MAAM,cAAc,CAAC;AAIzD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,2BAA2B,CAMzC,MAA2C;IAE3C,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC;AAC7C,CAAC","sourcesContent":["import { type SmartContractAccount } from \"@aa-sdk/core\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport type { AlchemySmartAccountClient } from \"./smartAccountClient\";\n\n/**\n * Checks if a given client is an Alchemy Smart Account Client. The goal of this check is to ensure that the client supports certain RPC methods.\n *\n * @example\n * ```ts\n * import { isAlchemySmartAccountClient } from \"@account-kit/infra\";\n *\n * if (isAlchemySmartAccountClient(client)) {\n * // do things with the client as an Alchemy Smart Account Client\n * }\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance to be checked\n * @returns {boolean} `true` if the client is an Alchemy Smart Account Client, otherwise `false`\n */\nexport function isAlchemySmartAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n>(\n client: Client<Transport, TChain, TAccount>,\n): client is AlchemySmartAccountClient<TChain, TAccount> {\n return client.transport.type === \"alchemy\";\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../src/client/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,GASzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA4B,MAAM,MAAM,CAAC;AAChD,OAAO,EACL,OAAO,EACP,sBAAsB,GAEvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,uCAAuC,EAAE,MAAM,6BAA6B,CAAC;AACtF,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EACL,cAAc,GAEf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,UAAU,mBAAmB,CAEjC,OAAiB;IACjB,OAAO,EAAE,uBAAuB,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,CAAC;AACrE,CAAC;AAwFD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,+BAA+B,CAC7C,MAAuC;IAEvC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,UAAU,GACd,MAAM,CAAC,IAAI,EAAE,UAAU,IAAI,iCAAiC,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iB;QAC3C,aAAa,CAAC,UAAkB;YAC9B,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;YAC1C,MAAM,mBAAmB,GAAG,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC;YACjE,MAAM,YAAY,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;YAC/C,YAAY,CAAC,aAAa,CACxB,aAAa,CAAC,UAAU,CAAC,CACvB,sBAAsB,CAAC,mBAAmB,EAAE,OAAO,CAAC,CACrD,CACF,CAAC;YACF,OAAO,+BAA+B,CAAC;gBACrC,GAAG,MAAM;gBACT,SAAS,EAAE,YAAY;aACxB,CAAQ,CAAC;QACZ,CAAC;KACF,CAAC;SACC,MAAM,CAAC,cAAc,CAAC;SACtB,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACpB,aAAa,CAAC,UAAkB;YAC9B,OAAO,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAChD,CAAC;KACF,CAAC,CAAC,CAAC;IAEN,IAAI,MAAM,CAAC,OAAO,IAAI,wBAAwB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/D,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,mBAAmB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import {\n ChainNotFoundError,\n clientHeaderTrack,\n createSmartAccountClient,\n isSmartAccountWithSigner,\n type Prettify,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountClientRpcSchema,\n type SmartContractAccount,\n type SmartContractAccountWithSigner,\n type UserOperationContext,\n} from \"@aa-sdk/core\";\nimport { type Address, type Chain } from \"viem\";\nimport {\n alchemy,\n convertHeadersToObject,\n type AlchemyTransport,\n} from \"../alchemyTransport.js\";\nimport { getDefaultUserOperationFeeOptions } from \"../defaults.js\";\nimport { alchemyFeeEstimator } from \"../middleware/feeEstimator.js\";\nimport { alchemyGasAndPaymasterAndDataMiddleware } from \"../middleware/gasManager.js\";\nimport { alchemyUserOperationSimulator } from \"../middleware/userOperationSimulator.js\";\nimport {\n alchemyActions,\n type AlchemySmartAccountClientActions,\n} from \"./decorators/smartAccount.js\";\nimport type { AlchemyRpcSchema } from \"./types.js\";\nimport { headersUpdate } from \"../alchemyTrackerHeaders.js\";\n\nexport function getSignerTypeHeader<\n TAccount extends SmartContractAccountWithSigner\n>(account: TAccount) {\n return { \"Alchemy-Aa-Sdk-Signer\": account.getSigner().signerType };\n}\n\n// #region AlchemySmartAccountClientConfig\nexport type AlchemySmartAccountClientConfig<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = {\n account?: account;\n useSimulation?: boolean;\n policyId?: string | string[];\n policyToken?: {\n address: Address;\n maxTokenAmount: bigint;\n approvalMode?: \"NONE\" | \"PERMIT\";\n erc20Name?: string;\n version?: string;\n };\n} & Pick<\n SmartAccountClientConfig<AlchemyTransport, chain, account, context>,\n | \"customMiddleware\"\n | \"feeEstimator\"\n | \"gasEstimator\"\n | \"signUserOperation\"\n | \"transport\"\n | \"chain\"\n | \"opts\"\n>;\n// #endregion AlchemySmartAccountClientConfig\n\nexport type BaseAlchemyActions<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = SmartAccountClientActions<chain, account, context> &\n AlchemySmartAccountClientActions<account, context>;\n\nexport type AlchemySmartAccountClient_Base<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n SmartAccountClient<\n AlchemyTransport,\n chain,\n account,\n actions & BaseAlchemyActions<chain, account, context>,\n [...SmartAccountClientRpcSchema, ...AlchemyRpcSchema],\n context\n >\n>;\n\nexport type AlchemySmartAccountClient<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<AlchemySmartAccountClient_Base<chain, account, actions, context>>;\n\nexport function createAlchemySmartAccountClient<\n TChain extends Chain = Chain,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n params: AlchemySmartAccountClientConfig<TChain, TAccount, TContext>\n): AlchemySmartAccountClient<TChain, TAccount, Record<string, never>, TContext>;\n\n/**\n * Creates an Alchemy smart account client using the provided configuration options, including account details, gas manager configuration, and custom middleware.\n *\n * @example\n * ```ts\n * import { createAlchemySmartAccountClient, alchemy } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra/chain\";\n *\n * const client = createAlchemySmartAccountClient({\n * chain: sepolia,\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * });\n * ```\n *\n * @param {AlchemySmartAccountClientConfig} config The configuration for creating the Alchemy smart account client\n * @returns {AlchemySmartAccountClient} An instance of `AlchemySmartAccountClient` configured based on the provided options\n */\nexport function createAlchemySmartAccountClient(\n config: AlchemySmartAccountClientConfig\n): AlchemySmartAccountClient {\n if (!config.chain) {\n throw new ChainNotFoundError();\n }\n\n const feeOptions =\n config.opts?.feeOptions ?? getDefaultUserOperationFeeOptions(config.chain);\n\n const scaClient = createSmartAccountClient({\n account: config.account,\n transport: config.transport,\n chain: config.chain,\n type: \"AlchemySmartAccountClient\",\n opts: {\n ...config.opts,\n feeOptions,\n },\n feeEstimator: config.feeEstimator ?? alchemyFeeEstimator(config.transport),\n gasEstimator: config.gasEstimator,\n customMiddleware: async (struct, args) => {\n if (isSmartAccountWithSigner(args.account)) {\n config.transport.updateHeaders(getSignerTypeHeader(args.account));\n }\n return config.customMiddleware\n ? config.customMiddleware(struct, args)\n : struct;\n },\n ...(config.policyId\n ? alchemyGasAndPaymasterAndDataMiddleware({\n policyId: config.policyId,\n policyToken: config.policyToken,\n transport: config.transport,\n gasEstimatorOverride: config.gasEstimator,\n feeEstimatorOverride: config.feeEstimator,\n })\n : {}),\n userOperationSimulator: config.useSimulation\n ? alchemyUserOperationSimulator(config.transport)\n : undefined,\n signUserOperation: config.signUserOperation,\n addBreadCrumb(breadcrumb: string) {\n const oldConfig = config.transport.config;\n const dynamicFetchOptions = config.transport.dynamicFetchOptions;\n const newTransport = alchemy({ ...oldConfig });\n newTransport.updateHeaders(\n headersUpdate(breadcrumb)(\n convertHeadersToObject(dynamicFetchOptions?.headers)\n )\n );\n return createAlchemySmartAccountClient({\n ...config,\n transport: newTransport,\n }) as any;\n },\n })\n .extend(alchemyActions)\n .extend((client_) => ({\n addBreadcrumb(breadcrumb: string) {\n return clientHeaderTrack(client_, breadcrumb);\n },\n }));\n\n if (config.account && isSmartAccountWithSigner(config.account)) {\n config.transport.updateHeaders(getSignerTypeHeader(config.account));\n }\n\n return scaClient;\n}\n"]}
1
+ {"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../src/client/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,GASzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA4B,MAAM,MAAM,CAAC;AAChD,OAAO,EACL,OAAO,EACP,sBAAsB,GAEvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,uCAAuC,EAAE,MAAM,6BAA6B,CAAC;AAC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AC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/D,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,mBAAmB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import {\n ChainNotFoundError,\n clientHeaderTrack,\n createSmartAccountClient,\n isSmartAccountWithSigner,\n type Prettify,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountClientRpcSchema,\n type SmartContractAccount,\n type SmartContractAccountWithSigner,\n type UserOperationContext,\n} from \"@aa-sdk/core\";\nimport { type Address, type Chain } from \"viem\";\nimport {\n alchemy,\n convertHeadersToObject,\n type AlchemyTransport,\n} from \"../alchemyTransport.js\";\nimport { getDefaultUserOperationFeeOptions } from \"../defaults.js\";\nimport { alchemyFeeEstimator } from \"../middleware/feeEstimator.js\";\nimport { alchemyGasAndPaymasterAndDataMiddleware } from \"../middleware/gasManager.js\";\nimport { alchemyUserOperationSimulator } from \"../middleware/userOperationSimulator.js\";\nimport {\n alchemyActions,\n type AlchemySmartAccountClientActions,\n} from \"./decorators/smartAccount.js\";\nimport type { AlchemyRpcSchema } from \"./types.js\";\nimport { headersUpdate } from \"../alchemyTrackerHeaders.js\";\n\nexport function getSignerTypeHeader<\n TAccount extends SmartContractAccountWithSigner,\n>(account: TAccount) {\n return { \"Alchemy-Aa-Sdk-Signer\": account.getSigner().signerType };\n}\n\n// #region AlchemySmartAccountClientConfig\nexport type AlchemySmartAccountClientConfig<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = {\n account?: account;\n useSimulation?: boolean;\n policyId?: string | string[];\n policyToken?: {\n address: Address;\n maxTokenAmount: bigint;\n approvalMode?: \"NONE\" | \"PERMIT\";\n erc20Name?: string;\n version?: string;\n };\n} & Pick<\n SmartAccountClientConfig<AlchemyTransport, chain, account, context>,\n | \"customMiddleware\"\n | \"feeEstimator\"\n | \"gasEstimator\"\n | \"signUserOperation\"\n | \"transport\"\n | \"chain\"\n | \"opts\"\n>;\n// #endregion AlchemySmartAccountClientConfig\n\nexport type BaseAlchemyActions<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = SmartAccountClientActions<chain, account, context> &\n AlchemySmartAccountClientActions<account, context>;\n\nexport type AlchemySmartAccountClient_Base<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<\n SmartAccountClient<\n AlchemyTransport,\n chain,\n account,\n actions & BaseAlchemyActions<chain, account, context>,\n [...SmartAccountClientRpcSchema, ...AlchemyRpcSchema],\n context\n >\n>;\n\nexport type AlchemySmartAccountClient<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<AlchemySmartAccountClient_Base<chain, account, actions, context>>;\n\nexport function createAlchemySmartAccountClient<\n TChain extends Chain = Chain,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(\n params: AlchemySmartAccountClientConfig<TChain, TAccount, TContext>,\n): AlchemySmartAccountClient<TChain, TAccount, Record<string, never>, TContext>;\n\n/**\n * Creates an Alchemy smart account client using the provided configuration options, including account details, gas manager configuration, and custom middleware.\n *\n * @example\n * ```ts\n * import { createAlchemySmartAccountClient, alchemy } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra/chain\";\n *\n * const client = createAlchemySmartAccountClient({\n * chain: sepolia,\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * });\n * ```\n *\n * @param {AlchemySmartAccountClientConfig} config The configuration for creating the Alchemy smart account client\n * @returns {AlchemySmartAccountClient} An instance of `AlchemySmartAccountClient` configured based on the provided options\n */\nexport function createAlchemySmartAccountClient(\n config: AlchemySmartAccountClientConfig,\n): AlchemySmartAccountClient {\n if (!config.chain) {\n throw new ChainNotFoundError();\n }\n\n const feeOptions =\n config.opts?.feeOptions ?? getDefaultUserOperationFeeOptions(config.chain);\n\n const scaClient = createSmartAccountClient({\n account: config.account,\n transport: config.transport,\n chain: config.chain,\n type: \"AlchemySmartAccountClient\",\n opts: {\n ...config.opts,\n feeOptions,\n },\n feeEstimator: config.feeEstimator ?? alchemyFeeEstimator(config.transport),\n gasEstimator: config.gasEstimator,\n customMiddleware: async (struct, args) => {\n if (isSmartAccountWithSigner(args.account)) {\n config.transport.updateHeaders(getSignerTypeHeader(args.account));\n }\n return config.customMiddleware\n ? config.customMiddleware(struct, args)\n : struct;\n },\n ...(config.policyId\n ? alchemyGasAndPaymasterAndDataMiddleware({\n policyId: config.policyId,\n policyToken: config.policyToken,\n transport: config.transport,\n gasEstimatorOverride: config.gasEstimator,\n feeEstimatorOverride: config.feeEstimator,\n })\n : {}),\n userOperationSimulator: config.useSimulation\n ? alchemyUserOperationSimulator(config.transport)\n : undefined,\n signUserOperation: config.signUserOperation,\n addBreadCrumb(breadcrumb: string) {\n const oldConfig = config.transport.config;\n const dynamicFetchOptions = config.transport.dynamicFetchOptions;\n const newTransport = alchemy({ ...oldConfig });\n newTransport.updateHeaders(\n headersUpdate(breadcrumb)(\n convertHeadersToObject(dynamicFetchOptions?.headers),\n ),\n );\n return createAlchemySmartAccountClient({\n ...config,\n transport: newTransport,\n }) as any;\n },\n })\n .extend(alchemyActions)\n .extend((client_) => ({\n addBreadcrumb(breadcrumb: string) {\n return clientHeaderTrack(client_, breadcrumb);\n },\n }));\n\n if (config.account && isSmartAccountWithSigner(config.account)) {\n config.transport.updateHeaders(getSignerTypeHeader(config.account));\n }\n\n return scaClient;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,MAAM,cAAc,CAAC","sourcesContent":["import {\n type BundlerClient,\n type Erc7677RpcSchema,\n type UserOperationRequest,\n} from \"@aa-sdk/core\";\nimport type {\n SimulateUserOperationAssetChangesRequest,\n SimulateUserOperationAssetChangesResponse,\n RequestGasAndPaymasterAndDataRequest,\n RequestGasAndPaymasterAndDataResponse,\n} from \"../actions/types\";\nimport type { AlchemyTransport } from \"../alchemyTransport\";\n\nexport type AlchemyRpcSchema = [\n {\n Method: \"alchemy_simulateUserOperationAssetChanges\";\n Parameters: SimulateUserOperationAssetChangesRequest;\n ReturnType: SimulateUserOperationAssetChangesResponse;\n },\n {\n Method: \"rundler_maxPriorityFeePerGas\";\n Parameters: [];\n ReturnType: UserOperationRequest[\"maxPriorityFeePerGas\"];\n },\n ...Erc7677RpcSchema<{ policyId: string }>,\n {\n Method: \"alchemy_requestGasAndPaymasterAndData\";\n Parameters: RequestGasAndPaymasterAndDataRequest;\n ReturnType: RequestGasAndPaymasterAndDataResponse;\n }\n];\n\nexport type ClientWithAlchemyMethods = BundlerClient<AlchemyTransport> & {\n request: BundlerClient<AlchemyTransport>[\"request\"] &\n {\n request(args: {\n method: \"alchemy_simulateUserOperationAssetChanges\";\n params: SimulateUserOperationAssetChangesRequest;\n }): Promise<SimulateUserOperationAssetChangesResponse>;\n\n request(args: {\n method: \"rundler_maxPriorityFeePerGas\";\n params: [];\n }): Promise<UserOperationRequest[\"maxPriorityFeePerGas\"]>;\n\n request(args: {\n method: \"alchemy_requestGasAndPaymasterAndData\";\n params: RequestGasAndPaymasterAndDataRequest;\n }): Promise<RequestGasAndPaymasterAndDataResponse>;\n }[\"request\"];\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,MAAM,cAAc,CAAC","sourcesContent":["import {\n type BundlerClient,\n type Erc7677RpcSchema,\n type UserOperationRequest,\n} from \"@aa-sdk/core\";\nimport type {\n SimulateUserOperationAssetChangesRequest,\n SimulateUserOperationAssetChangesResponse,\n RequestGasAndPaymasterAndDataRequest,\n RequestGasAndPaymasterAndDataResponse,\n} from \"../actions/types\";\nimport type { AlchemyTransport } from \"../alchemyTransport\";\n\nexport type AlchemyRpcSchema = [\n {\n Method: \"alchemy_simulateUserOperationAssetChanges\";\n Parameters: SimulateUserOperationAssetChangesRequest;\n ReturnType: SimulateUserOperationAssetChangesResponse;\n },\n {\n Method: \"rundler_maxPriorityFeePerGas\";\n Parameters: [];\n ReturnType: UserOperationRequest[\"maxPriorityFeePerGas\"];\n },\n ...Erc7677RpcSchema<{ policyId: string }>,\n {\n Method: \"alchemy_requestGasAndPaymasterAndData\";\n Parameters: RequestGasAndPaymasterAndDataRequest;\n ReturnType: RequestGasAndPaymasterAndDataResponse;\n },\n];\n\nexport type ClientWithAlchemyMethods = BundlerClient<AlchemyTransport> & {\n request: BundlerClient<AlchemyTransport>[\"request\"] &\n {\n request(args: {\n method: \"alchemy_simulateUserOperationAssetChanges\";\n params: SimulateUserOperationAssetChangesRequest;\n }): Promise<SimulateUserOperationAssetChangesResponse>;\n\n request(args: {\n method: \"rundler_maxPriorityFeePerGas\";\n params: [];\n }): Promise<UserOperationRequest[\"maxPriorityFeePerGas\"]>;\n\n request(args: {\n method: \"alchemy_requestGasAndPaymasterAndData\";\n params: RequestGasAndPaymasterAndDataRequest;\n }): Promise<RequestGasAndPaymasterAndDataResponse>;\n }[\"request\"];\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,MAAM,cAAc,CAAC;AAE5D,OAAO,EACL,QAAQ,EACR,cAAc,EACd,eAAe,EACf,QAAQ,EACR,cAAc,EACd,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,KAAY,EACa,EAAE;IAC3B,MAAM,UAAU,GAA4B;QAC1C,YAAY,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE;QACjC,oBAAoB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;KAC3C,CAAC;IAEF,IACE,IAAI,GAAG,CAAS;QACd,QAAQ,CAAC,EAAE;QACX,cAAc,CAAC,EAAE;QACjB,eAAe,CAAC,EAAE;QAClB,QAAQ,CAAC,EAAE;QACX,cAAc,CAAC,EAAE;QACjB,eAAe,CAAC,EAAE;KACnB,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAChB,CAAC;QACD,UAAU,CAAC,kBAAkB,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACvD,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC","sourcesContent":["import { type UserOperationFeeOptions } from \"@aa-sdk/core\";\nimport type { Chain } from \"viem\";\nimport {\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n optimism,\n optimismGoerli,\n optimismSepolia,\n} from \"./chains.js\";\n\n/**\n * Retrieves the default user operation fee options for a given chain. Adjusts fees for specific chains like Arbitrum and Optimism.\n *\n * @example\n * ```ts\n * import { getDefaultUserOperationFeeOptions } from \"@account-kit/infra\";\n * import { arbitrum } from \"@account-kit/infra\";\n *\n * const feeOpts = getDefaultUserOperationFeeOptions(arbitrum);\n * ```\n *\n * @param {Chain} chain The blockchain chain for which to get the fee options\n * @returns {UserOperationFeeOptions} An object containing the default fee options for user operations on the specified chain\n */\nexport const getDefaultUserOperationFeeOptions = (\n chain: Chain\n): UserOperationFeeOptions => {\n const feeOptions: UserOperationFeeOptions = {\n maxFeePerGas: { multiplier: 1.5 },\n maxPriorityFeePerGas: { multiplier: 1.05 },\n };\n\n if (\n new Set<number>([\n arbitrum.id,\n arbitrumGoerli.id,\n arbitrumSepolia.id,\n optimism.id,\n optimismGoerli.id,\n optimismSepolia.id,\n ]).has(chain.id)\n ) {\n feeOptions.preVerificationGas = { multiplier: 1.05 };\n }\n\n return feeOptions;\n};\n"]}
1
+ {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,MAAM,cAAc,CAAC;AAE5D,OAAO,EACL,QAAQ,EACR,cAAc,EACd,eAAe,EACf,QAAQ,EACR,cAAc,EACd,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,KAAY,EACa,EAAE;IAC3B,MAAM,UAAU,GAA4B;QAC1C,YAAY,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE;QACjC,oBAAoB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;KAC3C,CAAC;IAEF,IACE,IAAI,GAAG,CAAS;QACd,QAAQ,CAAC,EAAE;QACX,cAAc,CAAC,EAAE;QACjB,eAAe,CAAC,EAAE;QAClB,QAAQ,CAAC,EAAE;QACX,cAAc,CAAC,EAAE;QACjB,eAAe,CAAC,EAAE;KACnB,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAChB,CAAC;QACD,UAAU,CAAC,kBAAkB,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACvD,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC","sourcesContent":["import { type UserOperationFeeOptions } from \"@aa-sdk/core\";\nimport type { Chain } from \"viem\";\nimport {\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n optimism,\n optimismGoerli,\n optimismSepolia,\n} from \"./chains.js\";\n\n/**\n * Retrieves the default user operation fee options for a given chain. Adjusts fees for specific chains like Arbitrum and Optimism.\n *\n * @example\n * ```ts\n * import { getDefaultUserOperationFeeOptions } from \"@account-kit/infra\";\n * import { arbitrum } from \"@account-kit/infra\";\n *\n * const feeOpts = getDefaultUserOperationFeeOptions(arbitrum);\n * ```\n *\n * @param {Chain} chain The blockchain chain for which to get the fee options\n * @returns {UserOperationFeeOptions} An object containing the default fee options for user operations on the specified chain\n */\nexport const getDefaultUserOperationFeeOptions = (\n chain: Chain,\n): UserOperationFeeOptions => {\n const feeOptions: UserOperationFeeOptions = {\n maxFeePerGas: { multiplier: 1.5 },\n maxPriorityFeePerGas: { multiplier: 1.05 },\n };\n\n if (\n new Set<number>([\n arbitrum.id,\n arbitrumGoerli.id,\n arbitrumSepolia.id,\n optimism.id,\n optimismGoerli.id,\n optimismSepolia.id,\n ]).has(chain.id)\n ) {\n feeOptions.preVerificationGas = { multiplier: 1.05 };\n }\n\n return feeOptions;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAavC,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAoB;IACzD,OAAO,EAAE,oBAAoB;IAC7B,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC","sourcesContent":["import { createLogger } from \"@account-kit/logging\";\nimport type { Address } from \"viem\";\nimport { VERSION } from \"./version.js\";\n\nexport type InfraEventsSchema = [\n {\n EventName: \"client_send_uo\";\n EventData: {\n signerType: string;\n chainId: number;\n entryPoint: Address;\n };\n }\n];\n\nexport const InfraLogger = createLogger<InfraEventsSchema>({\n package: \"@account-kit/infra\",\n version: VERSION,\n});\n"]}
1
+ {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAavC,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAoB;IACzD,OAAO,EAAE,oBAAoB;IAC7B,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC","sourcesContent":["import { createLogger } from \"@account-kit/logging\";\nimport type { Address } from \"viem\";\nimport { VERSION } from \"./version.js\";\n\nexport type InfraEventsSchema = [\n {\n EventName: \"client_send_uo\";\n EventData: {\n signerType: string;\n chainId: number;\n entryPoint: Address;\n };\n },\n];\n\nexport const InfraLogger = createLogger<InfraEventsSchema>({\n package: \"@account-kit/infra\",\n version: VERSION,\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"feeEstimator.js","sourceRoot":"","sources":["../../../src/middleware/feeEstimator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,8BAA8B,EAC9B,cAAc,EACd,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAG9B,CAAC,SAAS,EAAE,EAAE,CACd,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;IAC3D,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;IACjE,MAAM,UAAU,GAAG,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACtD,IAAI,CAAC,KAAK,EAAE,4BAA4B,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC5D,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;QACvC,4GAA4G;QAC5G,UAAU,CAAC,OAAO,CAAC;YACjB,MAAM,EAAE,8BAA8B;YACtC,MAAM,EAAE,EAAE;SACX,CAAC;KACH,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;IAC1C,IAAI,aAAa,IAAI,IAAI,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,oBAAoB,GAAG,8BAA8B,CACzD,4BAA4B,EAC5B,SAAS,EAAE,oBAAoB,EAC/B,UAAU,EAAE,oBAAoB,CACjC,CAAC;IACF,MAAM,YAAY,GAAG,8BAA8B,CACjD,cAAc,CAAC,aAAa,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,oBAAoB,CAAC,EACjE,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,YAAY,CACzB,CAAC;IAEF,OAAO;QACL,GAAG,MAAM;QACT,oBAAoB;QACpB,YAAY;KACb,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { ClientMiddlewareFn } from \"@aa-sdk/core\";\nimport {\n applyUserOpOverrideOrFeeOption,\n bigIntMultiply,\n clientHeaderTrack,\n} from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"../alchemyTransport\";\n\n/**\n * Function that estimates the transaction fees using Alchemy methods for a given client.\n * It fetches the latest block and estimates the max priority fee per gas, applying any overrides or fee options provided.\n *\n * @example\n * ```ts\n * import { alchemyFeeEstimator, alchemy } from \"@account-kit/infra\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const alchemyTransport = alchemy({\n * chain: sepolia,\n * apiKey: \"your-api-key\"\n * });\n *\n * const client = createSmartAccountClient({\n * feeEstimator: alchemyFeeEstimator(alchemyTransport),\n * ...otherParams\n * });\n * ```\n *\n * @param {AlchemyTransport} transport An alchemy transport for making Alchemy specific RPC calls\n * @returns {ClientMiddlewareFn} A middleware function that takes a transaction structure and fee options, and returns the augmented structure with estimated fees\n */\nexport const alchemyFeeEstimator: (\n transport: AlchemyTransport\n) => ClientMiddlewareFn =\n (transport) =>\n async (struct, { overrides, feeOptions, client: client_ }) => {\n const client = clientHeaderTrack(client_, \"alchemyFeeEstimator\");\n const transport_ = transport({ chain: client.chain });\n let [block, maxPriorityFeePerGasEstimate] = await Promise.all([\n client.getBlock({ blockTag: \"latest\" }),\n // it is a fair assumption that if someone is using this Alchemy Middleware, then they are using Alchemy RPC\n transport_.request({\n method: \"rundler_maxPriorityFeePerGas\",\n params: [],\n }),\n ]);\n\n const baseFeePerGas = block.baseFeePerGas;\n if (baseFeePerGas == null) {\n throw new Error(\"baseFeePerGas is null\");\n }\n\n const maxPriorityFeePerGas = applyUserOpOverrideOrFeeOption(\n maxPriorityFeePerGasEstimate,\n overrides?.maxPriorityFeePerGas,\n feeOptions?.maxPriorityFeePerGas\n );\n const maxFeePerGas = applyUserOpOverrideOrFeeOption(\n bigIntMultiply(baseFeePerGas, 1.5) + BigInt(maxPriorityFeePerGas),\n overrides?.maxFeePerGas,\n feeOptions?.maxFeePerGas\n );\n\n return {\n ...struct,\n maxPriorityFeePerGas,\n maxFeePerGas,\n };\n };\n"]}
1
+ {"version":3,"file":"feeEstimator.js","sourceRoot":"","sources":["../../../src/middleware/feeEstimator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,8BAA8B,EAC9B,cAAc,EACd,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAG9B,CAAC,SAAS,EAAE,EAAE,CACd,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;IAC3D,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;IACjE,MAAM,UAAU,GAAG,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACtD,IAAI,CAAC,KAAK,EAAE,4BAA4B,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC5D,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;QACvC,4GAA4G;QAC5G,UAAU,CAAC,OAAO,CAAC;YACjB,MAAM,EAAE,8BAA8B;YACtC,MAAM,EAAE,EAAE;SACX,CAAC;KACH,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;IAC1C,IAAI,aAAa,IAAI,IAAI,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,oBAAoB,GAAG,8BAA8B,CACzD,4BAA4B,EAC5B,SAAS,EAAE,oBAAoB,EAC/B,UAAU,EAAE,oBAAoB,CACjC,CAAC;IACF,MAAM,YAAY,GAAG,8BAA8B,CACjD,cAAc,CAAC,aAAa,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,oBAAoB,CAAC,EACjE,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,YAAY,CACzB,CAAC;IAEF,OAAO;QACL,GAAG,MAAM;QACT,oBAAoB;QACpB,YAAY;KACb,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { ClientMiddlewareFn } from \"@aa-sdk/core\";\nimport {\n applyUserOpOverrideOrFeeOption,\n bigIntMultiply,\n clientHeaderTrack,\n} from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"../alchemyTransport\";\n\n/**\n * Function that estimates the transaction fees using Alchemy methods for a given client.\n * It fetches the latest block and estimates the max priority fee per gas, applying any overrides or fee options provided.\n *\n * @example\n * ```ts\n * import { alchemyFeeEstimator, alchemy } from \"@account-kit/infra\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const alchemyTransport = alchemy({\n * chain: sepolia,\n * apiKey: \"your-api-key\"\n * });\n *\n * const client = createSmartAccountClient({\n * feeEstimator: alchemyFeeEstimator(alchemyTransport),\n * ...otherParams\n * });\n * ```\n *\n * @param {AlchemyTransport} transport An alchemy transport for making Alchemy specific RPC calls\n * @returns {ClientMiddlewareFn} A middleware function that takes a transaction structure and fee options, and returns the augmented structure with estimated fees\n */\nexport const alchemyFeeEstimator: (\n transport: AlchemyTransport,\n) => ClientMiddlewareFn =\n (transport) =>\n async (struct, { overrides, feeOptions, client: client_ }) => {\n const client = clientHeaderTrack(client_, \"alchemyFeeEstimator\");\n const transport_ = transport({ chain: client.chain });\n let [block, maxPriorityFeePerGasEstimate] = await Promise.all([\n client.getBlock({ blockTag: \"latest\" }),\n // it is a fair assumption that if someone is using this Alchemy Middleware, then they are using Alchemy RPC\n transport_.request({\n method: \"rundler_maxPriorityFeePerGas\",\n params: [],\n }),\n ]);\n\n const baseFeePerGas = block.baseFeePerGas;\n if (baseFeePerGas == null) {\n throw new Error(\"baseFeePerGas is null\");\n }\n\n const maxPriorityFeePerGas = applyUserOpOverrideOrFeeOption(\n maxPriorityFeePerGasEstimate,\n overrides?.maxPriorityFeePerGas,\n feeOptions?.maxPriorityFeePerGas,\n );\n const maxFeePerGas = applyUserOpOverrideOrFeeOption(\n bigIntMultiply(baseFeePerGas, 1.5) + BigInt(maxPriorityFeePerGas),\n overrides?.maxFeePerGas,\n feeOptions?.maxFeePerGas,\n );\n\n return {\n ...struct,\n maxPriorityFeePerGas,\n maxFeePerGas,\n };\n };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"gasManager.js","sourceRoot":"","sources":["../../../src/middleware/gasManager.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,cAAc,EACd,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,OAAO,EACP,KAAK,EACL,KAAK,EAEL,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,QAAQ,GACT,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,eA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CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IAClE,OAAO,mBAAmB,CACxB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAC7D,CAAC,cAAc,EAAE,QAAQ,EAAE,YAAY,CAAC,CACzC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type {\n Address,\n ClientMiddlewareConfig,\n ClientMiddlewareFn,\n EntryPointVersion,\n Erc7677Client,\n Multiplier,\n SmartContractAccount,\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationRequest,\n} from \"@aa-sdk/core\";\nimport {\n bypassPaymasterAndData,\n ChainNotFoundError,\n clientHeaderTrack,\n deepHexlify,\n defaultGasEstimator,\n erc7677Middleware,\n filterUndefined,\n isBigNumberish,\n isMultiplier,\n noopMiddleware,\n resolveProperties,\n} from \"@aa-sdk/core\";\nimport {\n fromHex,\n isHex,\n toHex,\n type Hex,\n encodeAbiParameters,\n encodeFunctionData,\n parseAbi,\n sliceHex,\n} from \"viem\";\nimport type { AlchemySmartAccountClient } from \"../client/smartAccountClient.js\";\nimport type { AlchemyTransport } from \"../alchemyTransport.js\";\nimport { alchemyFeeEstimator } from \"./feeEstimator.js\";\nimport type { RequestGasAndPaymasterAndDataRequest } from \"../actions/types.js\";\nimport { PermitTypes, EIP712NoncesAbi } from \"../gas-manager.js\";\nimport type { PermitMessage, PermitDomain } from \"../gas-manager.js\";\nimport type { MiddlewareClient } from \"../../../../aa-sdk/core/dist/types/middleware/actions.js\";\n\ntype Context = {\n policyId: string | string[];\n erc20Context?: {\n tokenAddress: Address;\n maxTokenAmount?: BigInt;\n permit?: Hex;\n };\n};\n/**\n * Paymaster middleware factory that uses Alchemy's Gas Manager for sponsoring\n * transactions. Adheres to the ERC-7677 standardized communication protocol.\n *\n * @example\n * ```ts\n * import { sepolia, alchemyGasManagerMiddleware } from \"@account-kit/infra\";\n * import { http } from \"viem\";\n *\n * const client = createSmartAccountClient({\n * transport: http(\"rpc-url\"),\n * chain: sepolia,\n * ...alchemyGasManagerMiddleware(\"policyId\")\n * });\n * ```\n *\n * @param {string | string[]} policyId - The policyId (or list of policyIds) for Alchemy's gas manager\n * @param {PolicyToken | undefined} policyToken - The policy token configuration\n * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">} Partial client middleware configuration containing `dummyPaymasterAndData` and `paymasterAndData`\n */\nexport function alchemyGasManagerMiddleware(\n policyId: string | string[],\n policyToken?: PolicyToken\n): Required<\n Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">\n> {\n const buildContext = async (\n uo: Parameters<ClientMiddlewareFn>[0],\n args: Parameters<ClientMiddlewareFn>[1]\n ): Promise<Context> => {\n const context: Context = { policyId };\n\n const { account, client } = args;\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n if (policyToken !== undefined) {\n const userOp = await deepHexlify(await resolveProperties(uo));\n context.erc20Context = {\n tokenAddress: policyToken.address,\n maxTokenAmount: policyToken.maxTokenAmount,\n };\n\n if (policyToken.approvalMode === \"PERMIT\") {\n context.erc20Context.permit = await generateSignedPermit(\n userOp,\n client as AlchemySmartAccountClient,\n account,\n policyId,\n policyToken\n );\n }\n }\n\n return context;\n };\n return {\n dummyPaymasterAndData: async (uo, args) => {\n const context = await buildContext(uo, args);\n const baseMiddleware = erc7677Middleware({ context });\n return baseMiddleware.dummyPaymasterAndData(uo, args);\n },\n\n paymasterAndData: async (uo, args) => {\n const context = await buildContext(uo, args);\n const baseMiddleware = erc7677Middleware({ context });\n return baseMiddleware.paymasterAndData(uo, args);\n },\n };\n}\n\ninterface AlchemyGasAndPaymasterAndDataMiddlewareParams {\n policyId: string | string[];\n policyToken?: PolicyToken;\n transport: AlchemyTransport;\n gasEstimatorOverride?: ClientMiddlewareFn;\n feeEstimatorOverride?: ClientMiddlewareFn;\n}\n\nexport type PolicyToken = {\n address: Address;\n maxTokenAmount: bigint;\n approvalMode?: \"NONE\" | \"PERMIT\";\n erc20Name?: string;\n version?: string;\n};\n\n/**\n * Paymaster middleware factory that uses Alchemy's Gas Manager for sponsoring\n * transactions. Uses Alchemy's custom `alchemy_requestGasAndPaymasterAndData`\n * method instead of conforming to the standard ERC-7677 interface. Note that\n * if you use `createAlchemySmartAccountClient`, this middleware is already\n * used by default and you do not need to manually include it.\n *\n * @example\n * ```ts twoslash\n * import { sepolia, alchemy, alchemyGasAndPaymasterAndDataMiddleware } from \"@account-kit/infra\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const client = createSmartAccountClient({\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * chain: sepolia,\n * ...alchemyGasAndPaymasterAndDataMiddleware({\n * policyId: \"policyId\",\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * })\n * });\n * ```\n *\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams} params configuration params\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams.policyId} params.policyId the policyId for Alchemy's gas manager\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams.transport} params.transport fallback transport to use for fee estimation when not using the paymaster\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams.gasEstimatorOverride} params.gasEstimatorOverride custom gas estimator middleware\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams.feeEstimatorOverride} params.feeEstimatorOverride custom fee estimator middleware\n * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"feeEstimator\" | \"gasEstimator\" | \"paymasterAndData\">} partial client middleware configuration containing `dummyPaymasterAndData`, `feeEstimator`, `gasEstimator`, and `paymasterAndData`\n */\nexport function alchemyGasAndPaymasterAndDataMiddleware(\n params: AlchemyGasAndPaymasterAndDataMiddlewareParams\n): Pick<\n ClientMiddlewareConfig,\n \"dummyPaymasterAndData\" | \"feeEstimator\" | \"gasEstimator\" | \"paymasterAndData\"\n> {\n const {\n policyId,\n policyToken,\n transport,\n gasEstimatorOverride,\n feeEstimatorOverride,\n } = params;\n return {\n dummyPaymasterAndData: async (uo, args) => {\n if (\n // No reason to generate dummy data if we are bypassing the paymaster.\n bypassPaymasterAndData(args.overrides) ||\n // When using alchemy_requestGasAndPaymasterAndData, there is generally no reason to generate dummy\n // data. However, if the gas/feeEstimator is overriden, then this option should be enabled.\n !(gasEstimatorOverride || feeEstimatorOverride)\n ) {\n return noopMiddleware(uo, args);\n }\n\n // Fall back to the default 7677 dummyPaymasterAndData middleware.\n return alchemyGasManagerMiddleware(\n policyId,\n policyToken\n ).dummyPaymasterAndData(uo, args);\n },\n feeEstimator: (uo, args) => {\n return feeEstimatorOverride\n ? feeEstimatorOverride(uo, args)\n : bypassPaymasterAndData(args.overrides)\n ? alchemyFeeEstimator(transport)(uo, args)\n : noopMiddleware(uo, args);\n },\n gasEstimator: (uo, args) => {\n return gasEstimatorOverride\n ? gasEstimatorOverride(uo, args)\n : bypassPaymasterAndData(args.overrides)\n ? defaultGasEstimator(args.client)(uo, args)\n : noopMiddleware(uo, args);\n },\n paymasterAndData: async (\n uo,\n { account, client: client_, feeOptions, overrides: overrides_ }\n ) => {\n const client = clientHeaderTrack(client_, \"alchemyFeeEstimator\");\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const userOp = deepHexlify(await resolveProperties(uo));\n\n const overrides: UserOperationOverrides = filterUndefined({\n maxFeePerGas: overrideField(\n \"maxFeePerGas\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp\n ),\n maxPriorityFeePerGas: overrideField(\n \"maxPriorityFeePerGas\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp\n ),\n callGasLimit: overrideField(\n \"callGasLimit\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp\n ),\n verificationGasLimit: overrideField(\n \"verificationGasLimit\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp\n ),\n preVerificationGas: overrideField(\n \"preVerificationGas\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp\n ),\n ...(account.getEntryPoint().version === \"0.7.0\"\n ? {\n paymasterVerificationGasLimit: overrideField<\"0.7.0\">(\n \"paymasterVerificationGasLimit\",\n overrides_ as UserOperationOverrides<\"0.7.0\">,\n feeOptions,\n userOp\n ),\n paymasterPostOpGasLimit: overrideField<\"0.7.0\">(\n \"paymasterPostOpGasLimit\",\n overrides_ as UserOperationOverrides<\"0.7.0\">,\n feeOptions,\n userOp\n ),\n }\n : {}),\n });\n\n let erc20Context: RequestGasAndPaymasterAndDataRequest[0][\"erc20Context\"] =\n undefined;\n if (policyToken !== undefined) {\n erc20Context = {\n tokenAddress: policyToken.address,\n maxTokenAmount: policyToken.maxTokenAmount,\n };\n if (policyToken.approvalMode === \"PERMIT\") {\n erc20Context.permit = await generateSignedPermit(\n userOp,\n client,\n account,\n policyId,\n policyToken\n );\n }\n }\n\n const result = await (client as AlchemySmartAccountClient).request({\n method: \"alchemy_requestGasAndPaymasterAndData\",\n params: [\n {\n policyId,\n entryPoint: account.getEntryPoint().address,\n userOperation: userOp,\n dummySignature: await account.getDummySignature(),\n overrides,\n ...(erc20Context\n ? {\n erc20Context,\n }\n : {}),\n },\n ],\n });\n\n return {\n ...uo,\n ...result,\n };\n },\n };\n}\n\n/**\n * Utility function to override a field in the user operation request with the overrides or fee options\n *\n * @template {EntryPointVersion} TEntryPointVersion\n * @param {keyof UserOperationFeeOptions<TEntryPointVersion>} field the field to override\n * @param {UserOperationOverrides<TEntryPointVersion> | undefined} overrides the overrides object\n * @param {UserOperationFeeOptions<TEntryPointVersion> | undefined} feeOptions the fee options object from the client\n * @param {UserOperationRequest<TEntryPointVersion>} userOperation the user operation request\n * @returns {Hex | Multiplier | undefined} the overridden field value\n */\nconst overrideField = <\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n>(\n field: keyof UserOperationFeeOptions<TEntryPointVersion>,\n overrides: UserOperationOverrides<TEntryPointVersion> | undefined,\n feeOptions: UserOperationFeeOptions<TEntryPointVersion> | undefined,\n userOperation: UserOperationRequest<TEntryPointVersion>\n): Hex | Multiplier | undefined => {\n let _field = field as keyof UserOperationOverrides<TEntryPointVersion>;\n\n if (overrides?.[_field] != null) {\n // one-off absolute override\n if (isBigNumberish(overrides[_field])) {\n return deepHexlify(overrides[_field]);\n }\n // one-off multiplier overrides\n else {\n return {\n multiplier: Number((overrides[_field] as Multiplier).multiplier),\n };\n }\n }\n\n // provider level fee options with multiplier\n if (isMultiplier(feeOptions?.[field])) {\n return {\n multiplier: Number((feeOptions![field] as Multiplier).multiplier),\n };\n }\n\n const userOpField =\n userOperation[field as keyof UserOperationRequest<TEntryPointVersion>];\n if (isHex(userOpField) && fromHex(userOpField as Hex, \"bigint\") > 0n) {\n return userOpField;\n }\n return undefined;\n};\n\n/**\n * Utility function to generate a signed Permit for erc20 transaction\n *\n * @param {UserOperationRequest<TEntryPointVersion>} userOp - The user operation request\n * @param {MiddlewareClient} client - The Alchemy smart account client\n * @param {TAccount} account - The smart account instance\n * @param {string | string[]} policyId - The policy ID or array of policy IDs\n * @param {PolicyToken} policyToken - The policy token configuration\n * @param {Address} policyToken.address - ERC20 contract addressya\n * @param {bigint} [policyToken.maxTokenAmount] - Optional ERC20 token limit\n * @param {\"NONE\" | \"PERMIT\"} [policyToken.approvalMode] - ERC20 approve mode\n * @param {string} [policyToken.erc20Name] - EIP2612 specified ERC20 contract name\n * @param {string} [policyToken.version] - EIP2612 specified ERC20 contract version\n * @returns {Promise<Hex>} Returns a Promise containing the signed EIP2612 permit\n */\nconst generateSignedPermit = async <\n TAccount extends SmartContractAccount,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n>(\n userOp: UserOperationRequest<TEntryPointVersion>,\n client: MiddlewareClient,\n account: TAccount,\n policyId: string | string[],\n policyToken: {\n address: Address;\n maxTokenAmount: bigint;\n approvalMode?: \"NONE\" | \"PERMIT\";\n erc20Name?: string;\n version?: string;\n }\n): Promise<Hex> => {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n if (!policyToken.erc20Name || !policyToken.version) {\n throw new Error(\"erc20Name or version is missing\");\n }\n\n let decimalsFuture = client.call({\n to: policyToken.address,\n data: encodeFunctionData({\n abi: parseAbi(EIP712NoncesAbi),\n functionName: \"decimals\",\n args: [],\n }),\n });\n\n let nonceFuture = client.call({\n to: policyToken.address,\n data: encodeFunctionData({\n abi: parseAbi(EIP712NoncesAbi),\n functionName: \"nonces\",\n args: [account.address],\n }),\n });\n\n let paymasterDataFuture = (client as Erc7677Client).request({\n method: \"pm_getPaymasterStubData\",\n params: [\n userOp,\n account.getEntryPoint().address,\n toHex(client.chain.id),\n {\n policyId: Array.isArray(policyId) ? policyId[0] : policyId,\n },\n ],\n });\n\n const [decimalsResponse, nonceResponse, paymasterData] = await Promise.all([\n decimalsFuture,\n nonceFuture,\n paymasterDataFuture,\n ]);\n if (!decimalsResponse.data) {\n throw new Error(\"No decimals returned from erc20 contract call\");\n }\n if (!nonceResponse.data) {\n throw new Error(\"No nonces returned from erc20 contract call\");\n }\n\n const decimals =\n 10n ** (decimalsResponse.data ? BigInt(decimalsResponse.data) : 18n);\n const maxAmountToken = policyToken.maxTokenAmount * decimals;\n const nonce = BigInt(nonceResponse.data);\n\n const paymasterAddress = paymasterData.paymaster\n ? paymasterData.paymaster\n : paymasterData.paymasterAndData\n ? sliceHex(paymasterData.paymasterAndData, 0, 20)\n : undefined;\n\n if (paymasterAddress === undefined || paymasterAddress === \"0x\") {\n throw new Error(\"no paymaster contract address available\");\n }\n\n const deadline = BigInt(Math.floor(Date.now() / 1000) + 60 * 10);\n\n const typedPermitData = {\n types: PermitTypes,\n primaryType: \"Permit\" as const,\n domain: {\n name: policyToken.erc20Name ?? \"\",\n version: policyToken.version ?? \"\",\n chainId: BigInt(client.chain.id),\n verifyingContract: policyToken.address,\n } satisfies PermitDomain,\n message: {\n owner: account.address,\n spender: paymasterAddress,\n value: maxAmountToken,\n nonce: nonce,\n deadline,\n } satisfies PermitMessage,\n } as const;\n\n const signedPermit = await account.signTypedData(typedPermitData);\n return encodeAbiParameters(\n [{ type: \"uint256\" }, { type: \"uint256\" }, { type: \"bytes\" }],\n [maxAmountToken, deadline, signedPermit]\n );\n};\n"]}
1
+ {"version":3,"file":"gasManager.js","sourceRoot":"","sources":["../../../src/middleware/gasManager.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,cAAc,EACd,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,OAAO,EACP,KAAK,EACL,KAAK,EAEL,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,QAAQ,GACT,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAYjE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAA2B,EAC3B,WAAyB;IAIzB,MAAM,YAAY,GAAG,KAAK,EACxB,EAAqC,EACrC,IAAuC,EACrB,EAAE;QACpB,MAAM,OAAO,GAAY,EAAE,QAAQ,EAAE,CAAC;QAEtC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;QACjC,CAAC;QAED,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,MAAM,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;YAC9D,OAAO,CAAC,YAAY,GAAG;gBACrB,YAAY,EAAE,WAAW,CAAC,OAAO;gBACjC,cAAc,EAAE,WAAW,CAAC,cAAc;aAC3C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AI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IAEjE,MAAM,eAAe,GAAG;QACtB,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,QAAiB;QAC9B,MAAM,EAAE;YACN,IAAI,EAAE,WAAW,CAAC,SAAS,IAAI,EAAE;YACjC,OAAO,EAAE,WAAW,CAAC,OAAO,IAAI,EAAE;YAClC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,iBAAiB,EAAE,WAAW,CAAC,OAAO;SAChB;QACxB,OAAO,EAAE;YACP,KAAK,EAAE,OAAO,CAAC,OAAO;YACtB,OAAO,EAAE,gBAAgB;YACzB,KAAK,EAAE,cAAc;YACrB,KAAK,EAAE,KAAK;YACZ,QAAQ;SACe;KACjB,CAAC;IAEX,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IAClE,OAAO,mBAAmB,CACxB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAC7D,CAAC,cAAc,EAAE,QAAQ,EAAE,YAAY,CAAC,CACzC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type {\n Address,\n ClientMiddlewareConfig,\n ClientMiddlewareFn,\n EntryPointVersion,\n Erc7677Client,\n Multiplier,\n SmartContractAccount,\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationRequest,\n} from \"@aa-sdk/core\";\nimport {\n bypassPaymasterAndData,\n ChainNotFoundError,\n clientHeaderTrack,\n deepHexlify,\n defaultGasEstimator,\n erc7677Middleware,\n filterUndefined,\n isBigNumberish,\n isMultiplier,\n noopMiddleware,\n resolveProperties,\n} from \"@aa-sdk/core\";\nimport {\n fromHex,\n isHex,\n toHex,\n type Hex,\n encodeAbiParameters,\n encodeFunctionData,\n parseAbi,\n sliceHex,\n} from \"viem\";\nimport type { AlchemySmartAccountClient } from \"../client/smartAccountClient.js\";\nimport type { AlchemyTransport } from \"../alchemyTransport.js\";\nimport { alchemyFeeEstimator } from \"./feeEstimator.js\";\nimport type { RequestGasAndPaymasterAndDataRequest } from \"../actions/types.js\";\nimport { PermitTypes, EIP712NoncesAbi } from \"../gas-manager.js\";\nimport type { PermitMessage, PermitDomain } from \"../gas-manager.js\";\nimport type { MiddlewareClient } from \"../../../../aa-sdk/core/dist/types/middleware/actions.js\";\n\ntype Context = {\n policyId: string | string[];\n erc20Context?: {\n tokenAddress: Address;\n maxTokenAmount?: BigInt;\n permit?: Hex;\n };\n};\n/**\n * Paymaster middleware factory that uses Alchemy's Gas Manager for sponsoring\n * transactions. Adheres to the ERC-7677 standardized communication protocol.\n *\n * @example\n * ```ts\n * import { sepolia, alchemyGasManagerMiddleware } from \"@account-kit/infra\";\n * import { http } from \"viem\";\n *\n * const client = createSmartAccountClient({\n * transport: http(\"rpc-url\"),\n * chain: sepolia,\n * ...alchemyGasManagerMiddleware(\"policyId\")\n * });\n * ```\n *\n * @param {string | string[]} policyId - The policyId (or list of policyIds) for Alchemy's gas manager\n * @param {PolicyToken | undefined} policyToken - The policy token configuration\n * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">} Partial client middleware configuration containing `dummyPaymasterAndData` and `paymasterAndData`\n */\nexport function alchemyGasManagerMiddleware(\n policyId: string | string[],\n policyToken?: PolicyToken,\n): Required<\n Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">\n> {\n const buildContext = async (\n uo: Parameters<ClientMiddlewareFn>[0],\n args: Parameters<ClientMiddlewareFn>[1],\n ): Promise<Context> => {\n const context: Context = { policyId };\n\n const { account, client } = args;\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n if (policyToken !== undefined) {\n const userOp = await deepHexlify(await resolveProperties(uo));\n context.erc20Context = {\n tokenAddress: policyToken.address,\n maxTokenAmount: policyToken.maxTokenAmount,\n };\n\n if (policyToken.approvalMode === \"PERMIT\") {\n context.erc20Context.permit = await generateSignedPermit(\n userOp,\n client as AlchemySmartAccountClient,\n account,\n policyId,\n policyToken,\n );\n }\n }\n\n return context;\n };\n return {\n dummyPaymasterAndData: async (uo, args) => {\n const context = await buildContext(uo, args);\n const baseMiddleware = erc7677Middleware({ context });\n return baseMiddleware.dummyPaymasterAndData(uo, args);\n },\n\n paymasterAndData: async (uo, args) => {\n const context = await buildContext(uo, args);\n const baseMiddleware = erc7677Middleware({ context });\n return baseMiddleware.paymasterAndData(uo, args);\n },\n };\n}\n\ninterface AlchemyGasAndPaymasterAndDataMiddlewareParams {\n policyId: string | string[];\n policyToken?: PolicyToken;\n transport: AlchemyTransport;\n gasEstimatorOverride?: ClientMiddlewareFn;\n feeEstimatorOverride?: ClientMiddlewareFn;\n}\n\nexport type PolicyToken = {\n address: Address;\n maxTokenAmount: bigint;\n approvalMode?: \"NONE\" | \"PERMIT\";\n erc20Name?: string;\n version?: string;\n};\n\n/**\n * Paymaster middleware factory that uses Alchemy's Gas Manager for sponsoring\n * transactions. Uses Alchemy's custom `alchemy_requestGasAndPaymasterAndData`\n * method instead of conforming to the standard ERC-7677 interface. Note that\n * if you use `createAlchemySmartAccountClient`, this middleware is already\n * used by default and you do not need to manually include it.\n *\n * @example\n * ```ts twoslash\n * import { sepolia, alchemy, alchemyGasAndPaymasterAndDataMiddleware } from \"@account-kit/infra\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const client = createSmartAccountClient({\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * chain: sepolia,\n * ...alchemyGasAndPaymasterAndDataMiddleware({\n * policyId: \"policyId\",\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * })\n * });\n * ```\n *\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams} params configuration params\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams.policyId} params.policyId the policyId for Alchemy's gas manager\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams.transport} params.transport fallback transport to use for fee estimation when not using the paymaster\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams.gasEstimatorOverride} params.gasEstimatorOverride custom gas estimator middleware\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams.feeEstimatorOverride} params.feeEstimatorOverride custom fee estimator middleware\n * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"feeEstimator\" | \"gasEstimator\" | \"paymasterAndData\">} partial client middleware configuration containing `dummyPaymasterAndData`, `feeEstimator`, `gasEstimator`, and `paymasterAndData`\n */\nexport function alchemyGasAndPaymasterAndDataMiddleware(\n params: AlchemyGasAndPaymasterAndDataMiddlewareParams,\n): Pick<\n ClientMiddlewareConfig,\n \"dummyPaymasterAndData\" | \"feeEstimator\" | \"gasEstimator\" | \"paymasterAndData\"\n> {\n const {\n policyId,\n policyToken,\n transport,\n gasEstimatorOverride,\n feeEstimatorOverride,\n } = params;\n return {\n dummyPaymasterAndData: async (uo, args) => {\n if (\n // No reason to generate dummy data if we are bypassing the paymaster.\n bypassPaymasterAndData(args.overrides) ||\n // When using alchemy_requestGasAndPaymasterAndData, there is generally no reason to generate dummy\n // data. However, if the gas/feeEstimator is overriden, then this option should be enabled.\n !(gasEstimatorOverride || feeEstimatorOverride)\n ) {\n return noopMiddleware(uo, args);\n }\n\n // Fall back to the default 7677 dummyPaymasterAndData middleware.\n return alchemyGasManagerMiddleware(\n policyId,\n policyToken,\n ).dummyPaymasterAndData(uo, args);\n },\n feeEstimator: (uo, args) => {\n return feeEstimatorOverride\n ? feeEstimatorOverride(uo, args)\n : bypassPaymasterAndData(args.overrides)\n ? alchemyFeeEstimator(transport)(uo, args)\n : noopMiddleware(uo, args);\n },\n gasEstimator: (uo, args) => {\n return gasEstimatorOverride\n ? gasEstimatorOverride(uo, args)\n : bypassPaymasterAndData(args.overrides)\n ? defaultGasEstimator(args.client)(uo, args)\n : noopMiddleware(uo, args);\n },\n paymasterAndData: async (\n uo,\n { account, client: client_, feeOptions, overrides: overrides_ },\n ) => {\n const client = clientHeaderTrack(client_, \"alchemyFeeEstimator\");\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const userOp = deepHexlify(await resolveProperties(uo));\n\n const overrides: UserOperationOverrides = filterUndefined({\n maxFeePerGas: overrideField(\n \"maxFeePerGas\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp,\n ),\n maxPriorityFeePerGas: overrideField(\n \"maxPriorityFeePerGas\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp,\n ),\n callGasLimit: overrideField(\n \"callGasLimit\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp,\n ),\n verificationGasLimit: overrideField(\n \"verificationGasLimit\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp,\n ),\n preVerificationGas: overrideField(\n \"preVerificationGas\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp,\n ),\n ...(account.getEntryPoint().version === \"0.7.0\"\n ? {\n paymasterVerificationGasLimit: overrideField<\"0.7.0\">(\n \"paymasterVerificationGasLimit\",\n overrides_ as UserOperationOverrides<\"0.7.0\">,\n feeOptions,\n userOp,\n ),\n paymasterPostOpGasLimit: overrideField<\"0.7.0\">(\n \"paymasterPostOpGasLimit\",\n overrides_ as UserOperationOverrides<\"0.7.0\">,\n feeOptions,\n userOp,\n ),\n }\n : {}),\n });\n\n let erc20Context: RequestGasAndPaymasterAndDataRequest[0][\"erc20Context\"] =\n undefined;\n if (policyToken !== undefined) {\n erc20Context = {\n tokenAddress: policyToken.address,\n maxTokenAmount: policyToken.maxTokenAmount,\n };\n if (policyToken.approvalMode === \"PERMIT\") {\n erc20Context.permit = await generateSignedPermit(\n userOp,\n client,\n account,\n policyId,\n policyToken,\n );\n }\n }\n\n const result = await (client as AlchemySmartAccountClient).request({\n method: \"alchemy_requestGasAndPaymasterAndData\",\n params: [\n {\n policyId,\n entryPoint: account.getEntryPoint().address,\n userOperation: userOp,\n dummySignature: await account.getDummySignature(),\n overrides,\n ...(erc20Context\n ? {\n erc20Context,\n }\n : {}),\n },\n ],\n });\n\n return {\n ...uo,\n ...result,\n };\n },\n };\n}\n\n/**\n * Utility function to override a field in the user operation request with the overrides or fee options\n *\n * @template {EntryPointVersion} TEntryPointVersion\n * @param {keyof UserOperationFeeOptions<TEntryPointVersion>} field the field to override\n * @param {UserOperationOverrides<TEntryPointVersion> | undefined} overrides the overrides object\n * @param {UserOperationFeeOptions<TEntryPointVersion> | undefined} feeOptions the fee options object from the client\n * @param {UserOperationRequest<TEntryPointVersion>} userOperation the user operation request\n * @returns {Hex | Multiplier | undefined} the overridden field value\n */\nconst overrideField = <\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n>(\n field: keyof UserOperationFeeOptions<TEntryPointVersion>,\n overrides: UserOperationOverrides<TEntryPointVersion> | undefined,\n feeOptions: UserOperationFeeOptions<TEntryPointVersion> | undefined,\n userOperation: UserOperationRequest<TEntryPointVersion>,\n): Hex | Multiplier | undefined => {\n let _field = field as keyof UserOperationOverrides<TEntryPointVersion>;\n\n if (overrides?.[_field] != null) {\n // one-off absolute override\n if (isBigNumberish(overrides[_field])) {\n return deepHexlify(overrides[_field]);\n }\n // one-off multiplier overrides\n else {\n return {\n multiplier: Number((overrides[_field] as Multiplier).multiplier),\n };\n }\n }\n\n // provider level fee options with multiplier\n if (isMultiplier(feeOptions?.[field])) {\n return {\n multiplier: Number((feeOptions![field] as Multiplier).multiplier),\n };\n }\n\n const userOpField =\n userOperation[field as keyof UserOperationRequest<TEntryPointVersion>];\n if (isHex(userOpField) && fromHex(userOpField as Hex, \"bigint\") > 0n) {\n return userOpField;\n }\n return undefined;\n};\n\n/**\n * Utility function to generate a signed Permit for erc20 transaction\n *\n * @param {UserOperationRequest<TEntryPointVersion>} userOp - The user operation request\n * @param {MiddlewareClient} client - The Alchemy smart account client\n * @param {TAccount} account - The smart account instance\n * @param {string | string[]} policyId - The policy ID or array of policy IDs\n * @param {PolicyToken} policyToken - The policy token configuration\n * @param {Address} policyToken.address - ERC20 contract addressya\n * @param {bigint} [policyToken.maxTokenAmount] - Optional ERC20 token limit\n * @param {\"NONE\" | \"PERMIT\"} [policyToken.approvalMode] - ERC20 approve mode\n * @param {string} [policyToken.erc20Name] - EIP2612 specified ERC20 contract name\n * @param {string} [policyToken.version] - EIP2612 specified ERC20 contract version\n * @returns {Promise<Hex>} Returns a Promise containing the signed EIP2612 permit\n */\nconst generateSignedPermit = async <\n TAccount extends SmartContractAccount,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n>(\n userOp: UserOperationRequest<TEntryPointVersion>,\n client: MiddlewareClient,\n account: TAccount,\n policyId: string | string[],\n policyToken: {\n address: Address;\n maxTokenAmount: bigint;\n approvalMode?: \"NONE\" | \"PERMIT\";\n erc20Name?: string;\n version?: string;\n },\n): Promise<Hex> => {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n if (!policyToken.erc20Name || !policyToken.version) {\n throw new Error(\"erc20Name or version is missing\");\n }\n\n let decimalsFuture = client.call({\n to: policyToken.address,\n data: encodeFunctionData({\n abi: parseAbi(EIP712NoncesAbi),\n functionName: \"decimals\",\n args: [],\n }),\n });\n\n let nonceFuture = client.call({\n to: policyToken.address,\n data: encodeFunctionData({\n abi: parseAbi(EIP712NoncesAbi),\n functionName: \"nonces\",\n args: [account.address],\n }),\n });\n\n let paymasterDataFuture = (client as Erc7677Client).request({\n method: \"pm_getPaymasterStubData\",\n params: [\n userOp,\n account.getEntryPoint().address,\n toHex(client.chain.id),\n {\n policyId: Array.isArray(policyId) ? policyId[0] : policyId,\n },\n ],\n });\n\n const [decimalsResponse, nonceResponse, paymasterData] = await Promise.all([\n decimalsFuture,\n nonceFuture,\n paymasterDataFuture,\n ]);\n if (!decimalsResponse.data) {\n throw new Error(\"No decimals returned from erc20 contract call\");\n }\n if (!nonceResponse.data) {\n throw new Error(\"No nonces returned from erc20 contract call\");\n }\n\n const decimals =\n 10n ** (decimalsResponse.data ? BigInt(decimalsResponse.data) : 18n);\n const maxAmountToken = policyToken.maxTokenAmount * decimals;\n const nonce = BigInt(nonceResponse.data);\n\n const paymasterAddress = paymasterData.paymaster\n ? paymasterData.paymaster\n : paymasterData.paymasterAndData\n ? sliceHex(paymasterData.paymasterAndData, 0, 20)\n : undefined;\n\n if (paymasterAddress === undefined || paymasterAddress === \"0x\") {\n throw new Error(\"no paymaster contract address available\");\n }\n\n const deadline = BigInt(Math.floor(Date.now() / 1000) + 60 * 10);\n\n const typedPermitData = {\n types: PermitTypes,\n primaryType: \"Permit\" as const,\n domain: {\n name: policyToken.erc20Name ?? \"\",\n version: policyToken.version ?? \"\",\n chainId: BigInt(client.chain.id),\n verifyingContract: policyToken.address,\n } satisfies PermitDomain,\n message: {\n owner: account.address,\n spender: paymasterAddress,\n value: maxAmountToken,\n nonce: nonce,\n deadline,\n } satisfies PermitMessage,\n } as const;\n\n const signedPermit = await account.signTypedData(typedPermitData);\n return encodeAbiParameters(\n [{ type: \"uint256\" }, { type: \"uint256\" }, { type: \"bytes\" }],\n [maxAmountToken, deadline, signedPermit],\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"userOperationSimulator.js","sourceRoot":"","sources":["../../../src/middleware/userOperationSimulator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,GAGlB,MAAM,cAAc,CAAC;AAGtB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,6BAA6B,CAI3C,SAA2B;IAC3B,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;QAC3C,MAAM,WAAW,GAAG,MAAM,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC;YACnE,MAAM,EAAE,2CAA2C;YACnD,MAAM,EAAE;gBACN,WAAW,CAAC,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC;gBAC5C,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO;aAChC;SACF,CAAC,CAAC;QAEH,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {\n deepHexlify,\n resolveProperties,\n type ClientMiddlewareFn,\n type UserOperationContext,\n} from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"../alchemyTransport\";\n\n/**\n * A middleware function to be used during simulation of user operations which leverages Alchemy's RPC uo simulation method.\n *\n * @example\n * ```ts\n * import { alchemyUserOperationSimulator, alchemy, sepolia } from \"@account-kit/infra\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const alchemyTransport = alchemy({\n * chain: sepolia,\n * apiKey: \"your-api-key\"\n * });\n *\n * const client = createSmartAccountClient({\n * chain: sepolia,\n * userOperationSimulator: alchemyUserOperationSimulator(alchemyTransport),\n * ...otherParams\n * });\n * ```\n *\n * @param {AlchemyTransport} transport An Alchemy Transport that can be used for making RPC calls to alchemy\n * @returns {ClientMiddlewareFn} A middleware function to simulate and process user operations\n */\nexport function alchemyUserOperationSimulator<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(transport: AlchemyTransport): ClientMiddlewareFn<TContext> {\n return async (struct, { account, client }) => {\n const uoSimResult = await transport({ chain: client.chain }).request({\n method: \"alchemy_simulateUserOperationAssetChanges\",\n params: [\n deepHexlify(await resolveProperties(struct)),\n account.getEntryPoint().address,\n ],\n });\n\n if (uoSimResult.error) {\n throw new Error(uoSimResult.error.message);\n }\n\n return struct;\n };\n}\n"]}
1
+ {"version":3,"file":"userOperationSimulator.js","sourceRoot":"","sources":["../../../src/middleware/userOperationSimulator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,GAGlB,MAAM,cAAc,CAAC;AAGtB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,6BAA6B,CAI3C,SAA2B;IAC3B,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;QAC3C,MAAM,WAAW,GAAG,MAAM,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC;YACnE,MAAM,EAAE,2CAA2C;YACnD,MAAM,EAAE;gBACN,WAAW,CAAC,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC;gBAC5C,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO;aAChC;SACF,CAAC,CAAC;QAEH,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {\n deepHexlify,\n resolveProperties,\n type ClientMiddlewareFn,\n type UserOperationContext,\n} from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"../alchemyTransport\";\n\n/**\n * A middleware function to be used during simulation of user operations which leverages Alchemy's RPC uo simulation method.\n *\n * @example\n * ```ts\n * import { alchemyUserOperationSimulator, alchemy, sepolia } from \"@account-kit/infra\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const alchemyTransport = alchemy({\n * chain: sepolia,\n * apiKey: \"your-api-key\"\n * });\n *\n * const client = createSmartAccountClient({\n * chain: sepolia,\n * userOperationSimulator: alchemyUserOperationSimulator(alchemyTransport),\n * ...otherParams\n * });\n * ```\n *\n * @param {AlchemyTransport} transport An Alchemy Transport that can be used for making RPC calls to alchemy\n * @returns {ClientMiddlewareFn} A middleware function to simulate and process user operations\n */\nexport function alchemyUserOperationSimulator<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(transport: AlchemyTransport): ClientMiddlewareFn<TContext> {\n return async (struct, { account, client }) => {\n const uoSimResult = await transport({ chain: client.chain }).request({\n method: \"alchemy_simulateUserOperationAssetChanges\",\n params: [\n deepHexlify(await resolveProperties(struct)),\n account.getEntryPoint().address,\n ],\n });\n\n if (uoSimResult.error) {\n throw new Error(uoSimResult.error.message);\n }\n\n return struct;\n };\n}\n"]}
@@ -1 +1 @@
1
- export declare const VERSION = "4.35.0";
1
+ export declare const VERSION = "4.35.1";
@@ -1,4 +1,4 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "4.35.0";
3
+ export const VERSION = "4.35.1";
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.35.0\";\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.35.1\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/actions/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAE/C,oBAAY,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AC,EAC3B,WAAW,GACX,eAAe,GACf,+BAA+B,GAC/B,yBAAyB,CAC5B,GACD,KAAK,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"alchemyTrackerHeaders.d.ts","sourceRoot":"","sources":["../../src/alchemyTrackerHeaders.ts"],"names":[],"mappings":"AAmBA;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,CAAC,EAAE,OAAO,QAQtD;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,OACf,OAAO,MAAM,EAAE,MAAM,CAAC;;;;;EAYjD"}
1
+ {"version":3,"file":"alchemyTrackerHeaders.d.ts","sourceRoot":"","sources":["../../src/alchemyTrackerHeaders.ts"],"names":[],"mappings":"AAmBA;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,CAAC,EAAE,OAAO,QAQtD;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,OACf,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;EAYjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"alchemyTransport.d.ts","sourceRoot":"","sources":["../../src/alchemyTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAGL,KAAK,KAAK,EACV,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAI1D,KAAK,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAC5B;KACG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK;CACvB,GACD,KAAK,CAAC;AAEV,KAAK,uBAAuB,GAAG,gBAAgB,CAAC;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,GACpB,SAAS,EACb,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EAEb,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,KACzC,gCAAgC,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CA+B9D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rpcClient.d.ts","sourceRoot":"","sources":["../../../src/client/rpcClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,4BAA4B;eAI5B,gBAAgB;WACpB,KAAK,GAAG,SAAS;MACtB,wBAKH,CAAC"}
1
+ {"version":3,"file":"rpcClient.d.ts","sourceRoot":"","sources":["../../../src/client/rpcClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,4BAA4B,GAAI,uBAG1C;IACD,SAAS,EAAE,gBAAgB,CAAC;IAC5B,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC1B,KAAG,wBAKH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAUlC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iCAAiC,UACrC,KAAK,KACX,uBAoBF,CAAC"}
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAUlC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iCAAiC,GAC5C,OAAO,KAAK,KACX,uBAoBF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"gas-manager.d.ts","sourceRoot":"","sources":["../../src/gas-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAmBhD,eAAO,MAAM,yBAAyB,+CACQ,CAAC;AAC/C,eAAO,MAAM,yBAAyB,+CACQ,CAAC;AAC/C,eAAO,MAAM,0BAA0B,+CACO,CAAC;AAC/C,eAAO,MAAM,yBAAyB,+CACQ,CAAC;AAE/C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,0BAA0B,UAAW,KAAK,KAAG,OAwBzD,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcd,CAAC;AAEX,eAAO,MAAM,eAAe,wRAKlB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,GAAG,CAAC;CACxB,CAAC"}
1
+ {"version":3,"file":"gas-manager.d.ts","sourceRoot":"","sources":["../../src/gas-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAmBhD,eAAO,MAAM,yBAAyB,+CACQ,CAAC;AAC/C,eAAO,MAAM,yBAAyB,+CACQ,CAAC;AAC/C,eAAO,MAAM,0BAA0B,+CACO,CAAC;AAC/C,eAAO,MAAM,yBAAyB,+CACQ,CAAC;AAE/C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,0BAA0B,GAAI,OAAO,KAAK,KAAG,OAwBzD,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcd,CAAC;AAEX,eAAO,MAAM,eAAe,wRAKlB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,GAAG,CAAC;CACxB,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.35.0";
1
+ export declare const VERSION = "4.35.1";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@account-kit/infra",
3
- "version": "4.35.0",
3
+ "version": "4.35.1",
4
4
  "description": "adapters for @aa-sdk/core for interacting with alchemy services",
5
5
  "author": "Alchemy",
6
6
  "license": "MIT",
@@ -40,13 +40,11 @@
40
40
  "test:run": "vitest run"
41
41
  },
42
42
  "devDependencies": {
43
- "typescript": "^5.0.4",
44
- "typescript-template": "*",
45
- "vitest": "^2.0.4"
43
+ "typescript-template": "*"
46
44
  },
47
45
  "dependencies": {
48
- "@aa-sdk/core": "^4.35.0",
49
- "@account-kit/logging": "^4.35.0",
46
+ "@aa-sdk/core": "^4.35.1",
47
+ "@account-kit/logging": "^4.35.1",
50
48
  "eventemitter3": "^5.0.1",
51
49
  "zod": "^3.22.4"
52
50
  },
@@ -65,7 +63,7 @@
65
63
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
66
64
  },
67
65
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
68
- "gitHead": "3e5736311d16ae0eeaef9a869da2aff1e361a3f9",
66
+ "gitHead": "31e2138c2dd08c5b32cc2d67b3f0d7b2a7d21f4f",
69
67
  "optionalDependencies": {
70
68
  "alchemy-sdk": "^3.0.0"
71
69
  }
@@ -31,13 +31,13 @@ export const simulateUserOperationChanges: <
31
31
  TChain extends Chain | undefined = Chain | undefined,
32
32
  TAccount extends SmartContractAccount | undefined =
33
33
  | SmartContractAccount
34
- | undefined
34
+ | undefined,
35
35
  >(
36
36
  client: Client<Transport, TChain, TAccount, AlchemyRpcSchema>,
37
- args: SendUserOperationParameters<TAccount>
37
+ args: SendUserOperationParameters<TAccount>,
38
38
  ) => Promise<SimulateUserOperationAssetChangesResponse> = async (
39
39
  client,
40
- { account = client.account, overrides, ...params }
40
+ { account = client.account, overrides, ...params },
41
41
  ) => {
42
42
  if (!account) {
43
43
  throw new AccountNotFoundError();
@@ -47,7 +47,7 @@ export const simulateUserOperationChanges: <
47
47
  throw new IncompatibleClientError(
48
48
  "AlchemySmartAccountClient",
49
49
  "SimulateUserOperationAssetChanges",
50
- client
50
+ client,
51
51
  );
52
52
  }
53
53
 
@@ -56,7 +56,7 @@ export const simulateUserOperationChanges: <
56
56
  ...params,
57
57
  account,
58
58
  overrides,
59
- })
59
+ }),
60
60
  );
61
61
 
62
62
  return client.request({
@@ -26,7 +26,7 @@ export enum SimulateChangeType {
26
26
  export type SimulateUserOperationAssetChangesRequest = [
27
27
  UserOperationStruct,
28
28
  entryPoint: Address,
29
- blockNumber?: Hash
29
+ blockNumber?: Hash,
30
30
  ];
31
31
 
32
32
  export type SimulateUserOperationAssetChangesResponse = {
@@ -65,11 +65,11 @@ export type RequestGasAndPaymasterAndDataRequest = [
65
65
  dummySignature: Hex;
66
66
  userOperation: UserOperationRequest;
67
67
  overrides?: UserOperationOverrides;
68
- }
68
+ },
69
69
  ];
70
70
 
71
71
  export type RequestGasAndPaymasterAndDataResponse<
72
- TEntryPointVersion extends EntryPointVersion = EntryPointVersion
72
+ TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
73
73
  > = Pick<
74
74
  UserOperationRequest,
75
75
  | "callGasLimit"
@@ -83,11 +83,11 @@ export type RequestGasAndPaymasterAndDataResponse<
83
83
  paymasterAndData: UserOperationRequest<"0.6.0">["paymasterAndData"];
84
84
  }
85
85
  : TEntryPointVersion extends "0.7.0"
86
- ? Pick<
87
- UserOperationRequest<"0.7.0">,
88
- | "paymaster"
89
- | "paymasterData"
90
- | "paymasterVerificationGasLimit"
91
- | "paymasterPostOpGasLimit"
92
- >
93
- : never);
86
+ ? Pick<
87
+ UserOperationRequest<"0.7.0">,
88
+ | "paymaster"
89
+ | "paymasterData"
90
+ | "paymasterVerificationGasLimit"
91
+ | "paymasterPostOpGasLimit"
92
+ >
93
+ : never);
@@ -92,7 +92,7 @@ export type AlchemyTransport = AlchemyTransportBase & {
92
92
  */
93
93
  export function isAlchemyTransport(
94
94
  transport: Transport,
95
- chain: Chain
95
+ chain: Chain,
96
96
  ): transport is AlchemyTransport {
97
97
  return transport({ chain }).config.type === "alchemy";
98
98
  }
@@ -146,7 +146,7 @@ export function alchemy(config: AlchemyTransportConfig): AlchemyTransport {
146
146
  const fetchOptions = { ...config.fetchOptions };
147
147
 
148
148
  const connectionConfig = ConnectionConfigSchema.parse(
149
- config.alchemyConnection ?? config
149
+ config.alchemyConnection ?? config,
150
150
  );
151
151
 
152
152
  const headersAsObject = convertHeadersToObject(fetchOptions.headers);
@@ -181,7 +181,7 @@ export function alchemy(config: AlchemyTransportConfig): AlchemyTransport {
181
181
  const chainAgnosticRpcUrl =
182
182
  connectionConfig.rpcUrl == null
183
183
  ? "https://api.g.alchemy.com/v2/"
184
- : connectionConfig.chainAgnosticUrl ?? connectionConfig.rpcUrl;
184
+ : (connectionConfig.chainAgnosticUrl ?? connectionConfig.rpcUrl);
185
185
 
186
186
  const innerTransport = (() => {
187
187
  mutateRemoveTrackingHeaders(config?.fetchOptions?.headers);
@@ -223,7 +223,7 @@ export function alchemy(config: AlchemyTransportConfig): AlchemyTransport {
223
223
  retryDelay,
224
224
  type: "alchemy",
225
225
  },
226
- { alchemyRpcUrl: rpcUrl, fetchOptions }
226
+ { alchemyRpcUrl: rpcUrl, fetchOptions },
227
227
  );
228
228
  };
229
229
 
@@ -242,7 +242,7 @@ export function alchemy(config: AlchemyTransportConfig): AlchemyTransport {
242
242
  }
243
243
 
244
244
  export const convertHeadersToObject = (
245
- headers?: HeadersInit
245
+ headers?: HeadersInit,
246
246
  ): Record<string, string> => {
247
247
  if (!headers) {
248
248
  return {};
@@ -257,10 +257,13 @@ export const convertHeadersToObject = (
257
257
  }
258
258
 
259
259
  if (Array.isArray(headers)) {
260
- return headers.reduce((acc, header) => {
261
- acc[header[0]] = header[1];
262
- return acc;
263
- }, {} as Record<string, string>);
260
+ return headers.reduce(
261
+ (acc, header) => {
262
+ acc[header[0]] = header[1];
263
+ return acc;
264
+ },
265
+ {} as Record<string, string>,
266
+ );
264
267
  }
265
268
 
266
269
  return headers;
@@ -32,14 +32,14 @@ export type AlchemyEnhancedApis = {
32
32
  * @returns {(client: AlchemySmartAccountClient) => AlchemyEnhancedApis} A client decorator for Alchemy Smart Account clients that adds the enhanced API methods
33
33
  */
34
34
  export function alchemyEnhancedApiActions(
35
- alchemy: Alchemy
35
+ alchemy: Alchemy,
36
36
  ): <
37
37
  TChain extends Chain | undefined = Chain | undefined,
38
38
  TAccount extends SmartContractAccount | undefined =
39
39
  | SmartContractAccount
40
- | undefined
40
+ | undefined,
41
41
  >(
42
- client: AlchemySmartAccountClient<TChain, TAccount>
42
+ client: AlchemySmartAccountClient<TChain, TAccount>,
43
43
  ) => AlchemyEnhancedApis {
44
44
  return (client) => {
45
45
  const alchemySdk = AlchemySdkClientSchema.parse(alchemy);
@@ -49,7 +49,7 @@ export function alchemyEnhancedApiActions(
49
49
  alchemy.config.url !== client.transport.alchemyRpcUrl
50
50
  ) {
51
51
  throw new Error(
52
- "Alchemy SDK client JSON-RPC URL must match AlchemyProvider JSON-RPC URL"
52
+ "Alchemy SDK client JSON-RPC URL must match AlchemyProvider JSON-RPC URL",
53
53
  );
54
54
  }
55
55
 
@@ -31,25 +31,26 @@ export type AlchemySmartAccountClientActions<
31
31
  | UserOperationContext
32
32
  | undefined,
33
33
  TChain extends Chain | undefined = Chain | undefined,
34
- TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>
34
+ TEntryPointVersion extends
35
+ GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,
35
36
  > = {
36
37
  simulateUserOperation: (
37
- args: SendUserOperationParameters<TAccount, TContext>
38
+ args: SendUserOperationParameters<TAccount, TContext>,
38
39
  ) => Promise<SimulateUserOperationAssetChangesResponse>;
39
40
  sendUserOperation: (
40
41
  args: SendUserOperationParameters<
41
42
  TAccount,
42
43
  TContext,
43
44
  GetEntryPointFromAccount<TAccount>
44
- >
45
+ >,
45
46
  ) => Promise<SendUserOperationResult<TEntryPointVersion>>;
46
47
  sendTransaction: <TChainOverride extends Chain | undefined = undefined>(
47
48
  args: SendTransactionParameters<TChain, TAccount, TChainOverride>,
48
49
  overrides?: UserOperationOverrides<TEntryPointVersion>,
49
- context?: TContext
50
+ context?: TContext,
50
51
  ) => Promise<Hex>;
51
52
  sendTransactions: (
52
- args: SendTransactionsParameters<TAccount, TContext>
53
+ args: SendTransactionsParameters<TAccount, TContext>,
53
54
  ) => Promise<Hex>;
54
55
  };
55
56
 
@@ -76,11 +77,11 @@ export const alchemyActions: <
76
77
  | undefined,
77
78
  TContext extends UserOperationContext | undefined =
78
79
  | UserOperationContext
79
- | undefined
80
+ | undefined,
80
81
  >(
81
- client: Client<TTransport, TChain, TAccount>
82
+ client: Client<TTransport, TChain, TAccount>,
82
83
  ) => AlchemySmartAccountClientActions<TAccount, TContext, TChain> = (
83
- client_
84
+ client_,
84
85
  ) => ({
85
86
  simulateUserOperation: async (args) => {
86
87
  const client = clientHeaderTrack(client_, "simulateUserOperation");
@@ -21,9 +21,9 @@ export function isAlchemySmartAccountClient<
21
21
  TChain extends Chain | undefined = Chain | undefined,
22
22
  TAccount extends SmartContractAccount | undefined =
23
23
  | SmartContractAccount
24
- | undefined
24
+ | undefined,
25
25
  >(
26
- client: Client<Transport, TChain, TAccount>
26
+ client: Client<Transport, TChain, TAccount>,
27
27
  ): client is AlchemySmartAccountClient<TChain, TAccount> {
28
28
  return client.transport.type === "alchemy";
29
29
  }
@@ -30,7 +30,7 @@ import type { AlchemyRpcSchema } from "./types.js";
30
30
  import { headersUpdate } from "../alchemyTrackerHeaders.js";
31
31
 
32
32
  export function getSignerTypeHeader<
33
- TAccount extends SmartContractAccountWithSigner
33
+ TAccount extends SmartContractAccountWithSigner,
34
34
  >(account: TAccount) {
35
35
  return { "Alchemy-Aa-Sdk-Signer": account.getSigner().signerType };
36
36
  }
@@ -43,7 +43,7 @@ export type AlchemySmartAccountClientConfig<
43
43
  | undefined,
44
44
  context extends UserOperationContext | undefined =
45
45
  | UserOperationContext
46
- | undefined
46
+ | undefined,
47
47
  > = {
48
48
  account?: account;
49
49
  useSimulation?: boolean;
@@ -74,7 +74,7 @@ export type BaseAlchemyActions<
74
74
  | undefined,
75
75
  context extends UserOperationContext | undefined =
76
76
  | UserOperationContext
77
- | undefined
77
+ | undefined,
78
78
  > = SmartAccountClientActions<chain, account, context> &
79
79
  AlchemySmartAccountClientActions<account, context>;
80
80
 
@@ -86,7 +86,7 @@ export type AlchemySmartAccountClient_Base<
86
86
  actions extends Record<string, unknown> = Record<string, unknown>,
87
87
  context extends UserOperationContext | undefined =
88
88
  | UserOperationContext
89
- | undefined
89
+ | undefined,
90
90
  > = Prettify<
91
91
  SmartAccountClient<
92
92
  AlchemyTransport,
@@ -106,7 +106,7 @@ export type AlchemySmartAccountClient<
106
106
  actions extends Record<string, unknown> = Record<string, unknown>,
107
107
  context extends UserOperationContext | undefined =
108
108
  | UserOperationContext
109
- | undefined
109
+ | undefined,
110
110
  > = Prettify<AlchemySmartAccountClient_Base<chain, account, actions, context>>;
111
111
 
112
112
  export function createAlchemySmartAccountClient<
@@ -116,9 +116,9 @@ export function createAlchemySmartAccountClient<
116
116
  | undefined,
117
117
  TContext extends UserOperationContext | undefined =
118
118
  | UserOperationContext
119
- | undefined
119
+ | undefined,
120
120
  >(
121
- params: AlchemySmartAccountClientConfig<TChain, TAccount, TContext>
121
+ params: AlchemySmartAccountClientConfig<TChain, TAccount, TContext>,
122
122
  ): AlchemySmartAccountClient<TChain, TAccount, Record<string, never>, TContext>;
123
123
 
124
124
  /**
@@ -139,7 +139,7 @@ export function createAlchemySmartAccountClient<
139
139
  * @returns {AlchemySmartAccountClient} An instance of `AlchemySmartAccountClient` configured based on the provided options
140
140
  */
141
141
  export function createAlchemySmartAccountClient(
142
- config: AlchemySmartAccountClientConfig
142
+ config: AlchemySmartAccountClientConfig,
143
143
  ): AlchemySmartAccountClient {
144
144
  if (!config.chain) {
145
145
  throw new ChainNotFoundError();
@@ -186,8 +186,8 @@ export function createAlchemySmartAccountClient(
186
186
  const newTransport = alchemy({ ...oldConfig });
187
187
  newTransport.updateHeaders(
188
188
  headersUpdate(breadcrumb)(
189
- convertHeadersToObject(dynamicFetchOptions?.headers)
190
- )
189
+ convertHeadersToObject(dynamicFetchOptions?.headers),
190
+ ),
191
191
  );
192
192
  return createAlchemySmartAccountClient({
193
193
  ...config,
@@ -27,7 +27,7 @@ export type AlchemyRpcSchema = [
27
27
  Method: "alchemy_requestGasAndPaymasterAndData";
28
28
  Parameters: RequestGasAndPaymasterAndDataRequest;
29
29
  ReturnType: RequestGasAndPaymasterAndDataResponse;
30
- }
30
+ },
31
31
  ];
32
32
 
33
33
  export type ClientWithAlchemyMethods = BundlerClient<AlchemyTransport> & {
package/src/defaults.ts CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  * @returns {UserOperationFeeOptions} An object containing the default fee options for user operations on the specified chain
25
25
  */
26
26
  export const getDefaultUserOperationFeeOptions = (
27
- chain: Chain
27
+ chain: Chain,
28
28
  ): UserOperationFeeOptions => {
29
29
  const feeOptions: UserOperationFeeOptions = {
30
30
  maxFeePerGas: { multiplier: 1.5 },
package/src/metrics.ts CHANGED
@@ -10,7 +10,7 @@ export type InfraEventsSchema = [
10
10
  chainId: number;
11
11
  entryPoint: Address;
12
12
  };
13
- }
13
+ },
14
14
  ];
15
15
 
16
16
  export const InfraLogger = createLogger<InfraEventsSchema>({
@@ -30,7 +30,7 @@ import type { AlchemyTransport } from "../alchemyTransport";
30
30
  * @returns {ClientMiddlewareFn} A middleware function that takes a transaction structure and fee options, and returns the augmented structure with estimated fees
31
31
  */
32
32
  export const alchemyFeeEstimator: (
33
- transport: AlchemyTransport
33
+ transport: AlchemyTransport,
34
34
  ) => ClientMiddlewareFn =
35
35
  (transport) =>
36
36
  async (struct, { overrides, feeOptions, client: client_ }) => {
@@ -53,12 +53,12 @@ export const alchemyFeeEstimator: (
53
53
  const maxPriorityFeePerGas = applyUserOpOverrideOrFeeOption(
54
54
  maxPriorityFeePerGasEstimate,
55
55
  overrides?.maxPriorityFeePerGas,
56
- feeOptions?.maxPriorityFeePerGas
56
+ feeOptions?.maxPriorityFeePerGas,
57
57
  );
58
58
  const maxFeePerGas = applyUserOpOverrideOrFeeOption(
59
59
  bigIntMultiply(baseFeePerGas, 1.5) + BigInt(maxPriorityFeePerGas),
60
60
  overrides?.maxFeePerGas,
61
- feeOptions?.maxFeePerGas
61
+ feeOptions?.maxFeePerGas,
62
62
  );
63
63
 
64
64
  return {
@@ -71,13 +71,13 @@ type Context = {
71
71
  */
72
72
  export function alchemyGasManagerMiddleware(
73
73
  policyId: string | string[],
74
- policyToken?: PolicyToken
74
+ policyToken?: PolicyToken,
75
75
  ): Required<
76
76
  Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "paymasterAndData">
77
77
  > {
78
78
  const buildContext = async (
79
79
  uo: Parameters<ClientMiddlewareFn>[0],
80
- args: Parameters<ClientMiddlewareFn>[1]
80
+ args: Parameters<ClientMiddlewareFn>[1],
81
81
  ): Promise<Context> => {
82
82
  const context: Context = { policyId };
83
83
 
@@ -99,7 +99,7 @@ export function alchemyGasManagerMiddleware(
99
99
  client as AlchemySmartAccountClient,
100
100
  account,
101
101
  policyId,
102
- policyToken
102
+ policyToken,
103
103
  );
104
104
  }
105
105
  }
@@ -167,7 +167,7 @@ export type PolicyToken = {
167
167
  * @returns {Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "feeEstimator" | "gasEstimator" | "paymasterAndData">} partial client middleware configuration containing `dummyPaymasterAndData`, `feeEstimator`, `gasEstimator`, and `paymasterAndData`
168
168
  */
169
169
  export function alchemyGasAndPaymasterAndDataMiddleware(
170
- params: AlchemyGasAndPaymasterAndDataMiddlewareParams
170
+ params: AlchemyGasAndPaymasterAndDataMiddlewareParams,
171
171
  ): Pick<
172
172
  ClientMiddlewareConfig,
173
173
  "dummyPaymasterAndData" | "feeEstimator" | "gasEstimator" | "paymasterAndData"
@@ -194,26 +194,26 @@ export function alchemyGasAndPaymasterAndDataMiddleware(
194
194
  // Fall back to the default 7677 dummyPaymasterAndData middleware.
195
195
  return alchemyGasManagerMiddleware(
196
196
  policyId,
197
- policyToken
197
+ policyToken,
198
198
  ).dummyPaymasterAndData(uo, args);
199
199
  },
200
200
  feeEstimator: (uo, args) => {
201
201
  return feeEstimatorOverride
202
202
  ? feeEstimatorOverride(uo, args)
203
203
  : bypassPaymasterAndData(args.overrides)
204
- ? alchemyFeeEstimator(transport)(uo, args)
205
- : noopMiddleware(uo, args);
204
+ ? alchemyFeeEstimator(transport)(uo, args)
205
+ : noopMiddleware(uo, args);
206
206
  },
207
207
  gasEstimator: (uo, args) => {
208
208
  return gasEstimatorOverride
209
209
  ? gasEstimatorOverride(uo, args)
210
210
  : bypassPaymasterAndData(args.overrides)
211
- ? defaultGasEstimator(args.client)(uo, args)
212
- : noopMiddleware(uo, args);
211
+ ? defaultGasEstimator(args.client)(uo, args)
212
+ : noopMiddleware(uo, args);
213
213
  },
214
214
  paymasterAndData: async (
215
215
  uo,
216
- { account, client: client_, feeOptions, overrides: overrides_ }
216
+ { account, client: client_, feeOptions, overrides: overrides_ },
217
217
  ) => {
218
218
  const client = clientHeaderTrack(client_, "alchemyFeeEstimator");
219
219
  if (!client.chain) {
@@ -227,31 +227,31 @@ export function alchemyGasAndPaymasterAndDataMiddleware(
227
227
  "maxFeePerGas",
228
228
  overrides_ as UserOperationOverrides,
229
229
  feeOptions,
230
- userOp
230
+ userOp,
231
231
  ),
232
232
  maxPriorityFeePerGas: overrideField(
233
233
  "maxPriorityFeePerGas",
234
234
  overrides_ as UserOperationOverrides,
235
235
  feeOptions,
236
- userOp
236
+ userOp,
237
237
  ),
238
238
  callGasLimit: overrideField(
239
239
  "callGasLimit",
240
240
  overrides_ as UserOperationOverrides,
241
241
  feeOptions,
242
- userOp
242
+ userOp,
243
243
  ),
244
244
  verificationGasLimit: overrideField(
245
245
  "verificationGasLimit",
246
246
  overrides_ as UserOperationOverrides,
247
247
  feeOptions,
248
- userOp
248
+ userOp,
249
249
  ),
250
250
  preVerificationGas: overrideField(
251
251
  "preVerificationGas",
252
252
  overrides_ as UserOperationOverrides,
253
253
  feeOptions,
254
- userOp
254
+ userOp,
255
255
  ),
256
256
  ...(account.getEntryPoint().version === "0.7.0"
257
257
  ? {
@@ -259,13 +259,13 @@ export function alchemyGasAndPaymasterAndDataMiddleware(
259
259
  "paymasterVerificationGasLimit",
260
260
  overrides_ as UserOperationOverrides<"0.7.0">,
261
261
  feeOptions,
262
- userOp
262
+ userOp,
263
263
  ),
264
264
  paymasterPostOpGasLimit: overrideField<"0.7.0">(
265
265
  "paymasterPostOpGasLimit",
266
266
  overrides_ as UserOperationOverrides<"0.7.0">,
267
267
  feeOptions,
268
- userOp
268
+ userOp,
269
269
  ),
270
270
  }
271
271
  : {}),
@@ -284,7 +284,7 @@ export function alchemyGasAndPaymasterAndDataMiddleware(
284
284
  client,
285
285
  account,
286
286
  policyId,
287
- policyToken
287
+ policyToken,
288
288
  );
289
289
  }
290
290
  }
@@ -326,12 +326,12 @@ export function alchemyGasAndPaymasterAndDataMiddleware(
326
326
  * @returns {Hex | Multiplier | undefined} the overridden field value
327
327
  */
328
328
  const overrideField = <
329
- TEntryPointVersion extends EntryPointVersion = EntryPointVersion
329
+ TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
330
330
  >(
331
331
  field: keyof UserOperationFeeOptions<TEntryPointVersion>,
332
332
  overrides: UserOperationOverrides<TEntryPointVersion> | undefined,
333
333
  feeOptions: UserOperationFeeOptions<TEntryPointVersion> | undefined,
334
- userOperation: UserOperationRequest<TEntryPointVersion>
334
+ userOperation: UserOperationRequest<TEntryPointVersion>,
335
335
  ): Hex | Multiplier | undefined => {
336
336
  let _field = field as keyof UserOperationOverrides<TEntryPointVersion>;
337
337
 
@@ -380,7 +380,7 @@ const overrideField = <
380
380
  */
381
381
  const generateSignedPermit = async <
382
382
  TAccount extends SmartContractAccount,
383
- TEntryPointVersion extends EntryPointVersion = EntryPointVersion
383
+ TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
384
384
  >(
385
385
  userOp: UserOperationRequest<TEntryPointVersion>,
386
386
  client: MiddlewareClient,
@@ -392,7 +392,7 @@ const generateSignedPermit = async <
392
392
  approvalMode?: "NONE" | "PERMIT";
393
393
  erc20Name?: string;
394
394
  version?: string;
395
- }
395
+ },
396
396
  ): Promise<Hex> => {
397
397
  if (!client.chain) {
398
398
  throw new ChainNotFoundError();
@@ -451,8 +451,8 @@ const generateSignedPermit = async <
451
451
  const paymasterAddress = paymasterData.paymaster
452
452
  ? paymasterData.paymaster
453
453
  : paymasterData.paymasterAndData
454
- ? sliceHex(paymasterData.paymasterAndData, 0, 20)
455
- : undefined;
454
+ ? sliceHex(paymasterData.paymasterAndData, 0, 20)
455
+ : undefined;
456
456
 
457
457
  if (paymasterAddress === undefined || paymasterAddress === "0x") {
458
458
  throw new Error("no paymaster contract address available");
@@ -481,6 +481,6 @@ const generateSignedPermit = async <
481
481
  const signedPermit = await account.signTypedData(typedPermitData);
482
482
  return encodeAbiParameters(
483
483
  [{ type: "uint256" }, { type: "uint256" }, { type: "bytes" }],
484
- [maxAmountToken, deadline, signedPermit]
484
+ [maxAmountToken, deadline, signedPermit],
485
485
  );
486
486
  };
@@ -32,7 +32,7 @@ import type { AlchemyTransport } from "../alchemyTransport";
32
32
  export function alchemyUserOperationSimulator<
33
33
  TContext extends UserOperationContext | undefined =
34
34
  | UserOperationContext
35
- | undefined
35
+ | undefined,
36
36
  >(transport: AlchemyTransport): ClientMiddlewareFn<TContext> {
37
37
  return async (struct, { account, client }) => {
38
38
  const uoSimResult = await transport({ chain: client.chain }).request({
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "4.35.0";
3
+ export const VERSION = "4.35.1";