@account-kit/infra 4.20.1 → 4.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/esm/alchemyTrackerHeaders.d.ts +24 -0
  2. package/dist/esm/alchemyTrackerHeaders.js +60 -0
  3. package/dist/esm/alchemyTrackerHeaders.js.map +1 -0
  4. package/dist/esm/alchemyTransport.d.ts +2 -0
  5. package/dist/esm/alchemyTransport.js +4 -1
  6. package/dist/esm/alchemyTransport.js.map +1 -1
  7. package/dist/esm/chains.d.ts +3 -0
  8. package/dist/esm/chains.js +36 -1
  9. package/dist/esm/chains.js.map +1 -1
  10. package/dist/esm/client/decorators/smartAccount.d.ts +1 -1
  11. package/dist/esm/client/decorators/smartAccount.js +11 -5
  12. package/dist/esm/client/decorators/smartAccount.js.map +1 -1
  13. package/dist/esm/client/smartAccountClient.d.ts +1 -1
  14. package/dist/esm/client/smartAccountClient.js +43 -23
  15. package/dist/esm/client/smartAccountClient.js.map +1 -1
  16. package/dist/esm/index.d.ts +2 -1
  17. package/dist/esm/index.js +2 -1
  18. package/dist/esm/index.js.map +1 -1
  19. package/dist/esm/middleware/feeEstimator.js +3 -2
  20. package/dist/esm/middleware/feeEstimator.js.map +1 -1
  21. package/dist/esm/middleware/gasManager.js +3 -2
  22. package/dist/esm/middleware/gasManager.js.map +1 -1
  23. package/dist/esm/version.d.ts +1 -1
  24. package/dist/esm/version.js +1 -1
  25. package/dist/esm/version.js.map +1 -1
  26. package/dist/types/alchemyTrackerHeaders.d.ts +25 -0
  27. package/dist/types/alchemyTrackerHeaders.d.ts.map +1 -0
  28. package/dist/types/alchemyTransport.d.ts +2 -0
  29. package/dist/types/alchemyTransport.d.ts.map +1 -1
  30. package/dist/types/chains.d.ts +3 -0
  31. package/dist/types/chains.d.ts.map +1 -1
  32. package/dist/types/client/decorators/smartAccount.d.ts +1 -1
  33. package/dist/types/client/decorators/smartAccount.d.ts.map +1 -1
  34. package/dist/types/client/smartAccountClient.d.ts +1 -1
  35. package/dist/types/client/smartAccountClient.d.ts.map +1 -1
  36. package/dist/types/index.d.ts +2 -1
  37. package/dist/types/index.d.ts.map +1 -1
  38. package/dist/types/middleware/feeEstimator.d.ts.map +1 -1
  39. package/dist/types/middleware/gasManager.d.ts.map +1 -1
  40. package/dist/types/version.d.ts +1 -1
  41. package/package.json +4 -4
  42. package/src/alchemyTrackerHeaders.ts +61 -0
  43. package/src/alchemyTransport.ts +5 -1
  44. package/src/chains.ts +40 -0
  45. package/src/client/decorators/smartAccount.ts +11 -5
  46. package/src/client/smartAccountClient.ts +53 -34
  47. package/src/index.ts +4 -0
  48. package/src/middleware/feeEstimator.ts +7 -2
  49. package/src/middleware/gasManager.ts +3 -1
  50. package/src/version.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../src/client/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,GASzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAc,MAAM,MAAM,CAAC;AAElC,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;AAGtC,MAAM,UAAU,mBAAmB,CAEjC,OAAiB;IACjB,OAAO,EAAE,uBAAuB,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,CAAC;AACrE,CAAC;AAiFD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,+BAA+B,CAAC,EAC9C,OAAO,EACP,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,YA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AC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import {\n ChainNotFoundError,\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 Chain } from \"viem\";\nimport type { AlchemyTransport } 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\";\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} & 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 account,\n policyId,\n useSimulation,\n feeEstimator,\n customMiddleware,\n gasEstimator,\n signUserOperation,\n transport,\n chain,\n opts,\n}: AlchemySmartAccountClientConfig): AlchemySmartAccountClient {\n if (!chain) {\n throw new ChainNotFoundError();\n }\n\n const feeOptions =\n opts?.feeOptions ?? getDefaultUserOperationFeeOptions(chain);\n\n const scaClient = createSmartAccountClient({\n account,\n transport,\n chain,\n type: \"AlchemySmartAccountClient\",\n opts: {\n ...opts,\n feeOptions,\n },\n feeEstimator: feeEstimator ?? alchemyFeeEstimator(transport),\n gasEstimator,\n customMiddleware: async (struct, args) => {\n if (isSmartAccountWithSigner(args.account)) {\n transport.updateHeaders(getSignerTypeHeader(args.account));\n }\n return customMiddleware ? customMiddleware(struct, args) : struct;\n },\n ...(policyId\n ? alchemyGasAndPaymasterAndDataMiddleware({\n policyId,\n transport,\n gasEstimatorOverride: gasEstimator,\n feeEstimatorOverride: feeEstimator,\n })\n : {}),\n userOperationSimulator: useSimulation\n ? alchemyUserOperationSimulator(transport)\n : undefined,\n signUserOperation,\n }).extend(alchemyActions);\n\n if (account && isSmartAccountWithSigner(account)) {\n transport.updateHeaders(getSignerTypeHeader(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,EAAc,MAAM,MAAM,CAAC;AAClC,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,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AAC;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 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} & 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 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"]}
@@ -4,7 +4,7 @@ export type * from "./actions/types.js";
4
4
  export type * from "./alchemyTransport.js";
5
5
  export { alchemy, isAlchemyTransport } from "./alchemyTransport.js";
6
6
  export type * from "./chains.js";
7
- export { arbitrum, arbitrumGoerli, arbitrumNova, arbitrumSepolia, base, baseGoerli, baseSepolia, defineAlchemyChain, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, shape, shapeSepolia, worldChain, worldChainSepolia, zora, zoraSepolia, beraChainBartio, opbnbMainnet, opbnbTestnet, soneiumMinato, soneiumMainnet, unichainMainnet, unichainSepolia, inkMainnet, inkSepolia, mekong, monadTestnet, openlootSepolia, gensynTestnet, } from "./chains.js";
7
+ export { arbitrum, arbitrumGoerli, arbitrumNova, arbitrumSepolia, base, baseGoerli, baseSepolia, defineAlchemyChain, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, shape, shapeSepolia, worldChain, worldChainSepolia, zora, zoraSepolia, beraChainBartio, opbnbMainnet, opbnbTestnet, soneiumMinato, soneiumMainnet, unichainMainnet, unichainSepolia, inkMainnet, inkSepolia, mekong, monadTestnet, openlootSepolia, gensynTestnet, riseTestnet, sonic, sonicTestnet, } from "./chains.js";
8
8
  export type * from "./client/decorators/alchemyEnhancedApis.js";
9
9
  export { alchemyEnhancedApiActions } from "./client/decorators/alchemyEnhancedApis.js";
10
10
  export type * from "./client/decorators/smartAccount.js";
@@ -19,6 +19,7 @@ export { getDefaultUserOperationFeeOptions } from "./defaults.js";
19
19
  export { getAlchemyPaymasterAddress } from "./gas-manager.js";
20
20
  export { alchemyFeeEstimator } from "./middleware/feeEstimator.js";
21
21
  export type * from "./middleware/gasManager.js";
22
+ export * from "./alchemyTrackerHeaders.js";
22
23
  export { alchemyGasManagerMiddleware, alchemyGasAndPaymasterAndDataMiddleware, } from "./middleware/gasManager.js";
23
24
  export { alchemyUserOperationSimulator } from "./middleware/userOperationSimulator.js";
24
25
  export type * from "./schema.js";
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { simulateUserOperationChanges } from "./actions/simulateUserOperationChanges.js";
2
2
  export { alchemy, isAlchemyTransport } from "./alchemyTransport.js";
3
- export { arbitrum, arbitrumGoerli, arbitrumNova, arbitrumSepolia, base, baseGoerli, baseSepolia, defineAlchemyChain, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, shape, shapeSepolia, worldChain, worldChainSepolia, zora, zoraSepolia, beraChainBartio, opbnbMainnet, opbnbTestnet, soneiumMinato, soneiumMainnet, unichainMainnet, unichainSepolia, inkMainnet, inkSepolia, mekong, monadTestnet, openlootSepolia, gensynTestnet, } from "./chains.js";
3
+ export { arbitrum, arbitrumGoerli, arbitrumNova, arbitrumSepolia, base, baseGoerli, baseSepolia, defineAlchemyChain, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, shape, shapeSepolia, worldChain, worldChainSepolia, zora, zoraSepolia, beraChainBartio, opbnbMainnet, opbnbTestnet, soneiumMinato, soneiumMainnet, unichainMainnet, unichainSepolia, inkMainnet, inkSepolia, mekong, monadTestnet, openlootSepolia, gensynTestnet, riseTestnet, sonic, sonicTestnet, } from "./chains.js";
4
4
  export { alchemyEnhancedApiActions } from "./client/decorators/alchemyEnhancedApis.js";
5
5
  export { alchemyActions } from "./client/decorators/smartAccount.js";
6
6
  export { isAlchemySmartAccountClient } from "./client/isAlchemySmartAccountClient.js";
@@ -9,6 +9,7 @@ export { createAlchemySmartAccountClient } from "./client/smartAccountClient.js"
9
9
  export { getDefaultUserOperationFeeOptions } from "./defaults.js";
10
10
  export { getAlchemyPaymasterAddress } from "./gas-manager.js";
11
11
  export { alchemyFeeEstimator } from "./middleware/feeEstimator.js";
12
+ export * from "./alchemyTrackerHeaders.js";
12
13
  export { alchemyGasManagerMiddleware, alchemyGasAndPaymasterAndDataMiddleware, } from "./middleware/gasManager.js";
13
14
  export { alchemyUserOperationSimulator } from "./middleware/userOperationSimulator.js";
14
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AAGzF,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EACL,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,eAAe,EACf,IAAI,EACJ,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,cAAc,EACd,MAAM,EACN,OAAO,EACP,QAAQ,EACR,cAAc,EACd,eAAe,EACf,OAAO,EACP,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,EACL,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,IAAI,EACJ,WAAW,EACX,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,EACd,eAAe,EACf,eAAe,EACf,UAAU,EACV,UAAU,EACV,MAAM,EACN,YAAY,EACZ,eAAe,EACf,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAEvF,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AAEjF,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EACL,2BAA2B,EAC3B,uCAAuC,GACxC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC","sourcesContent":["export type * from \"./actions/simulateUserOperationChanges.js\";\nexport { simulateUserOperationChanges } from \"./actions/simulateUserOperationChanges.js\";\nexport type * from \"./actions/types.js\";\nexport type * from \"./alchemyTransport.js\";\nexport { alchemy, isAlchemyTransport } from \"./alchemyTransport.js\";\nexport type * from \"./chains.js\";\nexport {\n arbitrum,\n arbitrumGoerli,\n arbitrumNova,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n defineAlchemyChain,\n fraxtal,\n fraxtalSepolia,\n goerli,\n mainnet,\n optimism,\n optimismGoerli,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n shape,\n shapeSepolia,\n worldChain,\n worldChainSepolia,\n zora,\n zoraSepolia,\n beraChainBartio,\n opbnbMainnet,\n opbnbTestnet,\n soneiumMinato,\n soneiumMainnet,\n unichainMainnet,\n unichainSepolia,\n inkMainnet,\n inkSepolia,\n mekong,\n monadTestnet,\n openlootSepolia,\n gensynTestnet,\n} from \"./chains.js\";\nexport type * from \"./client/decorators/alchemyEnhancedApis.js\";\nexport { alchemyEnhancedApiActions } from \"./client/decorators/alchemyEnhancedApis.js\";\nexport type * from \"./client/decorators/smartAccount.js\";\nexport { alchemyActions } from \"./client/decorators/smartAccount.js\";\nexport { isAlchemySmartAccountClient } from \"./client/isAlchemySmartAccountClient.js\";\nexport type * from \"./client/rpcClient.js\";\nexport { createAlchemyPublicRpcClient } from \"./client/rpcClient.js\";\nexport type * from \"./client/smartAccountClient.js\";\nexport { createAlchemySmartAccountClient } from \"./client/smartAccountClient.js\";\nexport type * from \"./client/types.js\";\nexport { getDefaultUserOperationFeeOptions } from \"./defaults.js\";\nexport { getAlchemyPaymasterAddress } from \"./gas-manager.js\";\nexport { alchemyFeeEstimator } from \"./middleware/feeEstimator.js\";\nexport type * from \"./middleware/gasManager.js\";\nexport {\n alchemyGasManagerMiddleware,\n alchemyGasAndPaymasterAndDataMiddleware,\n} from \"./middleware/gasManager.js\";\nexport { alchemyUserOperationSimulator } from \"./middleware/userOperationSimulator.js\";\nexport type * from \"./schema.js\";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EAAE,MAAM,wCAAwC,CAAC","sourcesContent":["export type * from \"./actions/simulateUserOperationChanges.js\";\nexport { simulateUserOperationChanges } from \"./actions/simulateUserOperationChanges.js\";\nexport type * from \"./actions/types.js\";\nexport type * from \"./alchemyTransport.js\";\nexport { alchemy, isAlchemyTransport } from \"./alchemyTransport.js\";\nexport type * from \"./chains.js\";\nexport {\n arbitrum,\n arbitrumGoerli,\n arbitrumNova,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n defineAlchemyChain,\n fraxtal,\n fraxtalSepolia,\n goerli,\n mainnet,\n optimism,\n optimismGoerli,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n shape,\n shapeSepolia,\n worldChain,\n worldChainSepolia,\n zora,\n zoraSepolia,\n beraChainBartio,\n opbnbMainnet,\n opbnbTestnet,\n soneiumMinato,\n soneiumMainnet,\n unichainMainnet,\n unichainSepolia,\n inkMainnet,\n inkSepolia,\n mekong,\n monadTestnet,\n openlootSepolia,\n gensynTestnet,\n riseTestnet,\n sonic,\n sonicTestnet,\n} from \"./chains.js\";\nexport type * from \"./client/decorators/alchemyEnhancedApis.js\";\nexport { alchemyEnhancedApiActions } from \"./client/decorators/alchemyEnhancedApis.js\";\nexport type * from \"./client/decorators/smartAccount.js\";\nexport { alchemyActions } from \"./client/decorators/smartAccount.js\";\nexport { isAlchemySmartAccountClient } from \"./client/isAlchemySmartAccountClient.js\";\nexport type * from \"./client/rpcClient.js\";\nexport { createAlchemyPublicRpcClient } from \"./client/rpcClient.js\";\nexport type * from \"./client/smartAccountClient.js\";\nexport { createAlchemySmartAccountClient } from \"./client/smartAccountClient.js\";\nexport type * from \"./client/types.js\";\nexport { getDefaultUserOperationFeeOptions } from \"./defaults.js\";\nexport { getAlchemyPaymasterAddress } from \"./gas-manager.js\";\nexport { alchemyFeeEstimator } from \"./middleware/feeEstimator.js\";\nexport type * from \"./middleware/gasManager.js\";\nexport * from \"./alchemyTrackerHeaders.js\";\nexport {\n alchemyGasManagerMiddleware,\n alchemyGasAndPaymasterAndDataMiddleware,\n} from \"./middleware/gasManager.js\";\nexport { alchemyUserOperationSimulator } from \"./middleware/userOperationSimulator.js\";\nexport type * from \"./schema.js\";\n"]}
@@ -1,4 +1,4 @@
1
- import { applyUserOpOverrideOrFeeOption, bigIntMultiply } from "@aa-sdk/core";
1
+ import { applyUserOpOverrideOrFeeOption, bigIntMultiply, clientHeaderTrack, } from "@aa-sdk/core";
2
2
  /**
3
3
  * Function that estimates the transaction fees using Alchemy methods for a given client.
4
4
  * It fetches the latest block and estimates the max priority fee per gas, applying any overrides or fee options provided.
@@ -22,7 +22,8 @@ import { applyUserOpOverrideOrFeeOption, bigIntMultiply } from "@aa-sdk/core";
22
22
  * @param {AlchemyTransport} transport An alchemy transport for making Alchemy specific RPC calls
23
23
  * @returns {ClientMiddlewareFn} A middleware function that takes a transaction structure and fee options, and returns the augmented structure with estimated fees
24
24
  */
25
- export const alchemyFeeEstimator = (transport) => async (struct, { overrides, feeOptions, client }) => {
25
+ export const alchemyFeeEstimator = (transport) => async (struct, { overrides, feeOptions, client: client_ }) => {
26
+ const client = clientHeaderTrack(client_, "alchemyFeeEstimator");
26
27
  const transport_ = transport({ chain: client.chain });
27
28
  let [block, maxPriorityFeePerGasEstimate] = await Promise.all([
28
29
  client.getBlock({ blockTag: "latest" }),
@@ -1 +1 @@
1
- {"version":3,"file":"feeEstimator.js","sourceRoot":"","sources":["../../../src/middleware/feeEstimator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAG9B,CAAC,SAAS,EAAE,EAAE,CACd,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE;IAClD,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 { applyUserOpOverrideOrFeeOption, bigIntMultiply } 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 }) => {\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,4 +1,4 @@
1
- import { bypassPaymasterAndData, ChainNotFoundError, deepHexlify, defaultGasEstimator, erc7677Middleware, filterUndefined, isBigNumberish, isMultiplier, noopMiddleware, resolveProperties, } from "@aa-sdk/core";
1
+ import { bypassPaymasterAndData, ChainNotFoundError, clientHeaderTrack, deepHexlify, defaultGasEstimator, erc7677Middleware, filterUndefined, isBigNumberish, isMultiplier, noopMiddleware, resolveProperties, } from "@aa-sdk/core";
2
2
  import { fromHex, isHex } from "viem";
3
3
  import { alchemyFeeEstimator } from "./feeEstimator.js";
4
4
  /**
@@ -83,7 +83,8 @@ export function alchemyGasAndPaymasterAndDataMiddleware(params) {
83
83
  ? defaultGasEstimator(args.client)(uo, args)
84
84
  : noopMiddleware(uo, args);
85
85
  },
86
- paymasterAndData: async (uo, { account, client, feeOptions, overrides: overrides_ }) => {
86
+ paymasterAndData: async (uo, { account, client: client_, feeOptions, overrides: overrides_ }) => {
87
+ const client = clientHeaderTrack(client_, "alchemyFeeEstimator");
87
88
  if (!client.chain) {
88
89
  throw new ChainNotFoundError();
89
90
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gasManager.js","sourceRoot":"","sources":["../../../src/middleware/gasManager.ts"],"names":[],"mappings":"AASA,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,cAAc,EACd,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAY,MAAM,MAAM,CAAC;AAGhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAA2B;IAE3B,OAAO,iBAAiB,CAAkC;QACxD,OAAO,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;KAChC,CAAC,CAAC;AACL,CAAC;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,uCAAuC,CACrD,MAAqD;IAKrD,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,GACvE,MAAM,CAAC;IACT,OAAO;QACL,qBAAqB,EAAE,KAAK,EAAE,E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CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,aAAa,GAAG,CAGpB,KAAwD,EACxD,SAAiE,EACjE,UAAmE,EACnE,aAAuD,EACzB,EAAE;IAChC,IAAI,MAAM,GAAG,KAAyD,CAAC;IAEvE,IAAI,SAAS,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QAChC,4BAA4B;QAC5B,IAAI,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;YACtC,OAAO,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QACxC,CAAC;QACD,+BAA+B;aAC1B,CAAC;YACJ,OAAO;gBACL,UAAU,EAAE,MAAM,CAAE,SAAS,CAAC,MAAM,CAAgB,CAAC,UAAU,CAAC;aACjE,CAAC;QACJ,CAAC;IACH,CAAC;IAED,6CAA6C;IAC7C,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACtC,OAAO;YACL,UAAU,EAAE,MAAM,CAAE,UAAW,CAAC,KAAK,CAAgB,CAAC,UAAU,CAAC;SAClE,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GACf,aAAa,CAAC,KAAuD,CAAC,CAAC;IACzE,IAAI,KAAK,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,WAAkB,EAAE,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC;QACrE,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import type {\n ClientMiddlewareConfig,\n ClientMiddlewareFn,\n EntryPointVersion,\n Multiplier,\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationRequest,\n} from \"@aa-sdk/core\";\nimport {\n bypassPaymasterAndData,\n ChainNotFoundError,\n deepHexlify,\n defaultGasEstimator,\n erc7677Middleware,\n filterUndefined,\n isBigNumberish,\n isMultiplier,\n noopMiddleware,\n resolveProperties,\n} from \"@aa-sdk/core\";\nimport { fromHex, isHex, type Hex } from \"viem\";\nimport type { AlchemySmartAccountClient } from \"../client/smartAccountClient.js\";\nimport type { AlchemyTransport } from \"../alchemyTransport.js\";\nimport { alchemyFeeEstimator } from \"./feeEstimator.js\";\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 * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">} partial client middleware configuration containing `dummyPaymasterAndData` and `paymasterAndData`\n */\nexport function alchemyGasManagerMiddleware(\n policyId: string | string[]\n): Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\"> {\n return erc7677Middleware<{ policyId: string | string[] }>({\n context: { policyId: policyId },\n });\n}\n\ninterface AlchemyGasAndPaymasterAndDataMiddlewareParams {\n policyId: string | string[];\n transport: AlchemyTransport;\n gasEstimatorOverride?: ClientMiddlewareFn;\n feeEstimatorOverride?: ClientMiddlewareFn;\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\" | \"paymasterAndData\">} partial client middleware configuration containing `dummyPaymasterAndData` and `paymasterAndData`\n */\nexport function alchemyGasAndPaymasterAndDataMiddleware(\n params: AlchemyGasAndPaymasterAndDataMiddlewareParams\n): Pick<\n ClientMiddlewareConfig,\n \"dummyPaymasterAndData\" | \"feeEstimator\" | \"gasEstimator\" | \"paymasterAndData\"\n> {\n const { policyId, transport, gasEstimatorOverride, 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(policyId).dummyPaymasterAndData!(\n uo,\n args\n );\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, feeOptions, overrides: overrides_ }\n ) => {\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 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 },\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"]}
1
+ {"version":3,"file":"gasManager.js","sourceRoot":"","sources":["../../../src/middleware/gasManager.ts"],"names":[],"mappings":"AASA,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,EAAE,OAAO,EAAE,KAAK,EAAY,MAAM,MAAM,CAAC;AAGhD,OAAO,EAAE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SAClE,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GACf,aAAa,CAAC,KAAuD,CAAC,CAAC;IACzE,IAAI,KAAK,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,WAAkB,EAAE,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC;QACrE,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import type {\n ClientMiddlewareConfig,\n ClientMiddlewareFn,\n EntryPointVersion,\n Multiplier,\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 { fromHex, isHex, type Hex } from \"viem\";\nimport type { AlchemySmartAccountClient } from \"../client/smartAccountClient.js\";\nimport type { AlchemyTransport } from \"../alchemyTransport.js\";\nimport { alchemyFeeEstimator } from \"./feeEstimator.js\";\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 * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">} partial client middleware configuration containing `dummyPaymasterAndData` and `paymasterAndData`\n */\nexport function alchemyGasManagerMiddleware(\n policyId: string | string[]\n): Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\"> {\n return erc7677Middleware<{ policyId: string | string[] }>({\n context: { policyId: policyId },\n });\n}\n\ninterface AlchemyGasAndPaymasterAndDataMiddlewareParams {\n policyId: string | string[];\n transport: AlchemyTransport;\n gasEstimatorOverride?: ClientMiddlewareFn;\n feeEstimatorOverride?: ClientMiddlewareFn;\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\" | \"paymasterAndData\">} partial client middleware configuration containing `dummyPaymasterAndData` and `paymasterAndData`\n */\nexport function alchemyGasAndPaymasterAndDataMiddleware(\n params: AlchemyGasAndPaymasterAndDataMiddlewareParams\n): Pick<\n ClientMiddlewareConfig,\n \"dummyPaymasterAndData\" | \"feeEstimator\" | \"gasEstimator\" | \"paymasterAndData\"\n> {\n const { policyId, transport, gasEstimatorOverride, 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(policyId).dummyPaymasterAndData!(\n uo,\n args\n );\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 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 },\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"]}
@@ -1 +1 @@
1
- export declare const VERSION = "4.20.1";
1
+ export declare const VERSION = "4.22.0";
@@ -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.20.1";
3
+ export const VERSION = "4.22.0";
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.20.1\";\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.22.0\";\n"]}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Remove the tracking headers. This is used in our split transport to ensure that we remove the headers that
3
+ * are not used by the other systems.
4
+ *
5
+ * @param {unknown} x The headers to remove the tracking headers from
6
+ */
7
+ export declare function mutateRemoveTrackingHeaders(x?: unknown): void;
8
+ /**
9
+ * Update the headers with the trace header and breadcrumb.
10
+ *
11
+ * These trace headers are used in the imply ingestion pipeline to trace the request.
12
+ * And the breadcrumb is used to get finer grain details in the trace.
13
+ *
14
+ * Then there are the trace headers that are part of the W3C trace context standard.
15
+ *
16
+ * @param {string} crumb The crumb to add to the breadcrumb
17
+ * @returns {Function} A function that updates the headers
18
+ */
19
+ export declare function headersUpdate(crumb: string): (x: Record<string, string>) => {
20
+ traceheader: `00-${string}-${string}-${string}`;
21
+ tracestate: string;
22
+ "X-Alchemy-Trace-Breadcrumb": string;
23
+ "X-Alchemy-Trace-Id": string;
24
+ };
25
+ //# sourceMappingURL=alchemyTrackerHeaders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alchemyTrackerHeaders.d.ts","sourceRoot":"","sources":["../../src/alchemyTrackerHeaders.ts"],"names":[],"mappings":"AAgBA;;;;;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"}
@@ -22,6 +22,7 @@ type AlchemyTransportBase = Transport<"alchemy", {
22
22
  export type AlchemyTransport = AlchemyTransportBase & {
23
23
  updateHeaders(newHeaders: HeadersInit): void;
24
24
  config: AlchemyTransportConfig;
25
+ dynamicFetchOptions: AlchemyTransportConfig["fetchOptions"];
25
26
  };
26
27
  /**
27
28
  * A type guard for the transport to determine if it is an Alchemy transport.
@@ -76,5 +77,6 @@ export declare function isAlchemyTransport(transport: Transport, chain: Chain):
76
77
  * @returns {AlchemyTransport} The configured Alchemy transport object.
77
78
  */
78
79
  export declare function alchemy(config: AlchemyTransportConfig): AlchemyTransport;
80
+ export declare const convertHeadersToObject: (headers?: HeadersInit) => Record<string, string>;
79
81
  export {};
80
82
  //# sourceMappingURL=alchemyTransport.d.ts.map
@@ -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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C,cAAc,CAAC,CAAC,CAAC;CACjE,CAAC;AAEF,KAAK,oBAAoB,GAAG,SAAS,CACnC,SAAS,EACT;IACE,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,sBAAsB,CAAC,cAAc,CAAC,CAAC;CACvD,EACD,gBAAgB,CAAC,CAAC,GAAG,eAAe,EAAE,GAAG,gBAAgB,CAAC,CAAC,CAC5D,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG;IACpD,aAAa,CAAC,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7C,MAAM,EAAE,sBAAsB,CAAC;IAC/B,mBAAmB,EAAE,sBAAsB,CAAC,cAAc,CAAC,CAAC;CAC7D,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,GACX,SAAS,IAAI,gBAAgB,CAE/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,sBAAsB,GAAG,gBAAgB,CAiFxE;AAED,eAAO,MAAM,sBAAsB,aACvB,WAAW,KACpB,OAAO,MAAM,EAAE,MAAM,CAqBvB,CAAC"}
@@ -45,6 +45,8 @@ export declare const fraxtal: Chain;
45
45
  export declare const fraxtalSepolia: Chain;
46
46
  export declare const zora: Chain;
47
47
  export declare const zoraSepolia: Chain;
48
+ export declare const sonic: Chain;
49
+ export declare const sonicTestnet: Chain;
48
50
  export declare const worldChainSepolia: Chain;
49
51
  export declare const worldChain: Chain;
50
52
  export declare const shapeSepolia: Chain;
@@ -63,4 +65,5 @@ export declare const monadTestnet: Chain;
63
65
  export declare const mekong: Chain;
64
66
  export declare const openlootSepolia: Chain;
65
67
  export declare const gensynTestnet: Chain;
68
+ export declare const riseTestnet: Chain;
66
69
  //# sourceMappingURL=chains.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file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EAAE,KAgBvB,CAAC;AAEH,eAAO,MAAM,UAAU,EAAE,KAgBvB,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAgBzB,CAAC;AAEH,eAAO,MAAM,MAAM,EAAE,KAgBnB,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,KAsB5B,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,KAsB1B,CAAC;AAEH,eAAO,MAAM,WAAW,EAAE,KAsBxB,CAAC"}
@@ -19,7 +19,7 @@ export type AlchemySmartAccountClientActions<TAccount extends SmartContractAccou
19
19
  * const clientWithAlchemyActions = client.extend(alchemyActions);
20
20
  * ```
21
21
  *
22
- * @param {Client<TTransport, TChain, TAccount>} client The client instance used to perform actions
22
+ * @param {Client<TTransport, TChain, TAccount>} client_ The client instance used to perform actions
23
23
  * @returns {AlchemySmartAccountClientActions<TAccount, TContext>} An object containing Alchemy Smart Account client actions
24
24
  */
25
25
  export declare const alchemyActions: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(client: Client<TTransport, TChain, TAccount>) => AlchemySmartAccountClientActions<TAccount, TContext, TChain>;
@@ -1 +1 @@
1
- {"version":3,"file":"smartAccount.d.ts","sourceRoot":"","sources":["../../../../src/client/decorators/smartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,KAAK,EACL,MAAM,EACN,GAAG,EACH,yBAAyB,EACzB,SAAS,EACV,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,yCAAyC,EAAE,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E,CAAC,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,SAAS,EACpE,IAAI,EAAE,yBAAyB,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,EACjE,SAAS,CAAC,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,EACtD,OAAO,CAAC,EAAE,QAAQ,KACf,OAAO,CAAC,GAAG,CAAC,CAAC;IAClB,gBAAgB,EAAE,CAChB,IAAI,EAAE,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,KACjD,OAAO,CAAC,GAAG,CAAC,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,EAAE,CAC3B,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,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,6 +1,6 @@
1
1
  import { type Prettify, type SmartAccountClient, type SmartAccountClientActions, type SmartAccountClientConfig, type SmartAccountClientRpcSchema, type SmartContractAccount, type SmartContractAccountWithSigner, type UserOperationContext } from "@aa-sdk/core";
2
2
  import { type Chain } from "viem";
3
- import type { AlchemyTransport } from "../alchemyTransport.js";
3
+ import { type AlchemyTransport } from "../alchemyTransport.js";
4
4
  import { type AlchemySmartAccountClientActions } from "./decorators/smartAccount.js";
5
5
  import type { AlchemyRpcSchema } from "./types.js";
6
6
  export declare function getSignerTypeHeader<TAccount extends SmartContractAccountWithSigner>(account: TAccount): {
@@ -1 +1 @@
1
- {"version":3,"file":"smartAccountClient.d.ts","sourceRoot":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AC,MAAM,EAAE,OAAO,CAAC,EACjE,OAAO,SAAS,oBAAoB,GAAG,SAAS,GAC5C,oBAAoB,GACpB,SAAS,IACX,QAAQ,CAAC,8BAA8B,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAE/E,wBAAgB,+BAA+B,CAC7C,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EACb,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EAEb,MAAM,EAAE,+BAA+B,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAClE,yBAAyB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAC"}
@@ -4,7 +4,7 @@ export type * from "./actions/types.js";
4
4
  export type * from "./alchemyTransport.js";
5
5
  export { alchemy, isAlchemyTransport } from "./alchemyTransport.js";
6
6
  export type * from "./chains.js";
7
- export { arbitrum, arbitrumGoerli, arbitrumNova, arbitrumSepolia, base, baseGoerli, baseSepolia, defineAlchemyChain, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, shape, shapeSepolia, worldChain, worldChainSepolia, zora, zoraSepolia, beraChainBartio, opbnbMainnet, opbnbTestnet, soneiumMinato, soneiumMainnet, unichainMainnet, unichainSepolia, inkMainnet, inkSepolia, mekong, monadTestnet, openlootSepolia, gensynTestnet, } from "./chains.js";
7
+ export { arbitrum, arbitrumGoerli, arbitrumNova, arbitrumSepolia, base, baseGoerli, baseSepolia, defineAlchemyChain, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, shape, shapeSepolia, worldChain, worldChainSepolia, zora, zoraSepolia, beraChainBartio, opbnbMainnet, opbnbTestnet, soneiumMinato, soneiumMainnet, unichainMainnet, unichainSepolia, inkMainnet, inkSepolia, mekong, monadTestnet, openlootSepolia, gensynTestnet, riseTestnet, sonic, sonicTestnet, } from "./chains.js";
8
8
  export type * from "./client/decorators/alchemyEnhancedApis.js";
9
9
  export { alchemyEnhancedApiActions } from "./client/decorators/alchemyEnhancedApis.js";
10
10
  export type * from "./client/decorators/smartAccount.js";
@@ -19,6 +19,7 @@ export { getDefaultUserOperationFeeOptions } from "./defaults.js";
19
19
  export { getAlchemyPaymasterAddress } from "./gas-manager.js";
20
20
  export { alchemyFeeEstimator } from "./middleware/feeEstimator.js";
21
21
  export type * from "./middleware/gasManager.js";
22
+ export * from "./alchemyTrackerHeaders.js";
22
23
  export { alchemyGasManagerMiddleware, alchemyGasAndPaymasterAndDataMiddleware, } from "./middleware/gasManager.js";
23
24
  export { alchemyUserOperationSimulator } from "./middleware/userOperationSimulator.js";
24
25
  export type * from "./schema.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,2CAA2C,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,uBAAuB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACpE,mBAAmB,aAAa,CAAC;AACjC,OAAO,EACL,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,eAAe,EACf,IAAI,EACJ,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,cAAc,EACd,MAAM,EACN,OAAO,EACP,QAAQ,EACR,cAAc,EACd,eAAe,EACf,OAAO,EACP,WAAW,EACX,aAAa,EACb,OAAO,EACP,KAAK,EACL,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,IAAI,EACJ,WAAW,EAC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Aa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feeEstimator.d.ts","sourceRoot":"","sources":["../../../src/middleware/feeEstimator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,mBAAmB,EAAE,CAChC,SAAS,EAAE,gBAAgB,KACxB,kBAkCF,CAAC"}
1
+ {"version":3,"file":"feeEstimator.d.ts","sourceRoot":"","sources":["../../../src/middleware/feeEstimator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAMvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,mBAAmB,EAAE,CAChC,SAAS,EAAE,gBAAgB,KACxB,kBAmCF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"gasManager.d.ts","sourceRoot":"","sources":["../../../src/middleware/gasManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAMnB,MAAM,cAAc,CAAC;AAetB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAC1B,IAAI,CAAC,sBAAsB,EAAE,uBAAuB,GAAG,kBAAkB,CAAC,CAI5E;AAED,UAAU,6CAA6C;IACrD,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,oBAAoB,CAAC,EAAE,kBAAkB,CAAC;IAC1C,oBAAoB,CAAC,EAAE,kBAAkB,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,uCAAuC,CACrD,MAAM,EAAE,6CAA6C,GACpD,IAAI,CACL,sBAAsB,EACtB,uBAAuB,GAAG,cAAc,GAAG,cAAc,GAAG,kBAAkB,CAC/E,CAiHA"}
1
+ {"version":3,"file":"gasManager.d.ts","sourceRoot":"","sources":["../../../src/middleware/gasManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAMnB,MAAM,cAAc,CAAC;AAgBtB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAC1B,IAAI,CAAC,sBAAsB,EAAE,uBAAuB,GAAG,kBAAkB,CAAC,CAI5E;AAED,UAAU,6CAA6C;IACrD,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,oBAAoB,CAAC,EAAE,kBAAkB,CAAC;IAC1C,oBAAoB,CAAC,EAAE,kBAAkB,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,uCAAuC,CACrD,MAAM,EAAE,6CAA6C,GACpD,IAAI,CACL,sBAAsB,EACtB,uBAAuB,GAAG,cAAc,GAAG,cAAc,GAAG,kBAAkB,CAC/E,CAkHA"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.20.1";
1
+ export declare const VERSION = "4.22.0";
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.20.1",
3
+ "version": "4.22.0",
4
4
  "description": "adapters for @aa-sdk/core for interacting with alchemy services",
5
5
  "author": "Alchemy",
6
6
  "license": "MIT",
@@ -45,8 +45,8 @@
45
45
  "vitest": "^2.0.4"
46
46
  },
47
47
  "dependencies": {
48
- "@aa-sdk/core": "^4.20.1",
49
- "@account-kit/logging": "^4.20.1",
48
+ "@aa-sdk/core": "^4.22.0",
49
+ "@account-kit/logging": "^4.22.0",
50
50
  "eventemitter3": "^5.0.1",
51
51
  "zod": "^3.22.4"
52
52
  },
@@ -65,7 +65,7 @@
65
65
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
66
66
  },
67
67
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
68
- "gitHead": "8ee8571d4bbf78d75fb7c2a40e299808eaa63bfb",
68
+ "gitHead": "07a9e38db91c0a8937f3e2f28e25c95605e31698",
69
69
  "optionalDependencies": {
70
70
  "alchemy-sdk": "^3.0.0"
71
71
  }
@@ -0,0 +1,61 @@
1
+ import { TraceHeader } from "@aa-sdk/core";
2
+
3
+ /**
4
+ * The header that is used to track the trace id.
5
+ *
6
+ * @see headersUpdate
7
+ */
8
+ const TRACKER_HEADER = "X-Alchemy-Trace-Id";
9
+
10
+ /**
11
+ * The header that is used to track the breadcrumb.
12
+ *
13
+ * @see headersUpdate
14
+ */
15
+ const TRACKER_BREADCRUMB = "X-Alchemy-Trace-Breadcrumb";
16
+
17
+ /**
18
+ * Remove the tracking headers. This is used in our split transport to ensure that we remove the headers that
19
+ * are not used by the other systems.
20
+ *
21
+ * @param {unknown} x The headers to remove the tracking headers from
22
+ */
23
+ export function mutateRemoveTrackingHeaders(x?: unknown) {
24
+ if (!x) return;
25
+ if (Array.isArray(x)) return;
26
+ if (typeof x !== "object") return;
27
+ TRACKER_HEADER in x && delete x[TRACKER_HEADER];
28
+ TRACKER_BREADCRUMB in x && delete x[TRACKER_BREADCRUMB];
29
+ "traceheader" in x && delete x["traceheader"];
30
+ "tracestate" in x && delete x["tracestate"];
31
+ }
32
+
33
+ function addCrumb(previous: string | undefined, crumb: string): string {
34
+ if (!previous) return crumb;
35
+ return `${previous} > ${crumb}`;
36
+ }
37
+ /**
38
+ * Update the headers with the trace header and breadcrumb.
39
+ *
40
+ * These trace headers are used in the imply ingestion pipeline to trace the request.
41
+ * And the breadcrumb is used to get finer grain details in the trace.
42
+ *
43
+ * Then there are the trace headers that are part of the W3C trace context standard.
44
+ *
45
+ * @param {string} crumb The crumb to add to the breadcrumb
46
+ * @returns {Function} A function that updates the headers
47
+ */
48
+ export function headersUpdate(crumb: string) {
49
+ const headerUpdate_ = (x: Record<string, string>) => {
50
+ const traceHeader = (
51
+ TraceHeader.fromTraceHeader(x) || TraceHeader.default()
52
+ ).withEvent(crumb);
53
+ return {
54
+ [TRACKER_HEADER]: traceHeader.parentId,
55
+ ...x,
56
+ [TRACKER_BREADCRUMB]: addCrumb(x[TRACKER_BREADCRUMB], crumb),
57
+ ...traceHeader.toTraceHeader(),
58
+ };
59
+ };
60
+ return headerUpdate_;
61
+ }
@@ -18,6 +18,7 @@ import {
18
18
  import type { AlchemyRpcSchema } from "./client/types.js";
19
19
  import { AlchemyChainSchema } from "./schema.js";
20
20
  import { VERSION } from "./version.js";
21
+ import { mutateRemoveTrackingHeaders } from "./alchemyTrackerHeaders.js";
21
22
 
22
23
  type Never<T> = T extends object
23
24
  ? {
@@ -65,6 +66,7 @@ type AlchemyTransportBase = Transport<
65
66
  export type AlchemyTransport = AlchemyTransportBase & {
66
67
  updateHeaders(newHeaders: HeadersInit): void;
67
68
  config: AlchemyTransportConfig;
69
+ dynamicFetchOptions: AlchemyTransportConfig["fetchOptions"];
68
70
  };
69
71
 
70
72
  /**
@@ -163,6 +165,7 @@ export function alchemy(config: AlchemyTransportConfig): AlchemyTransport {
163
165
  : connectionConfig.rpcUrl;
164
166
 
165
167
  const innerTransport = (() => {
168
+ mutateRemoveTrackingHeaders(config?.fetchOptions?.headers);
166
169
  if (config.alchemyConnection && config.nodeRpcUrl) {
167
170
  return split({
168
171
  overrides: [
@@ -194,6 +197,7 @@ export function alchemy(config: AlchemyTransportConfig): AlchemyTransport {
194
197
  };
195
198
 
196
199
  return Object.assign(transport, {
200
+ dynamicFetchOptions: fetchOptions,
197
201
  updateHeaders(newHeaders_: HeadersInit) {
198
202
  const newHeaders = convertHeadersToObject(newHeaders_);
199
203
 
@@ -206,7 +210,7 @@ export function alchemy(config: AlchemyTransportConfig): AlchemyTransport {
206
210
  });
207
211
  }
208
212
 
209
- const convertHeadersToObject = (
213
+ export const convertHeadersToObject = (
210
214
  headers?: HeadersInit
211
215
  ): Record<string, string> => {
212
216
  if (!headers) {