@account-kit/infra 4.21.0 → 4.23.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 +63 -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 +2 -0
  8. package/dist/esm/chains.js +13 -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 +2 -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 +64 -0
  43. package/src/alchemyTransport.ts +5 -1
  44. package/src/chains.ts +16 -0
  45. package/src/client/decorators/smartAccount.ts +11 -5
  46. package/src/client/smartAccountClient.ts +53 -34
  47. package/src/index.ts +3 -0
  48. package/src/middleware/feeEstimator.ts +7 -2
  49. package/src/middleware/gasManager.ts +3 -1
  50. package/src/version.ts +1 -1
@@ -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, riseTestnet, } 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, riseTestnet, } 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,EACb,WAAW,GACZ,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 riseTestnet,\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\";\n"]}
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,EACb,WAAW,EACX,KAAK,EACL,YAAY,GACb,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,cAAc,4BAA4B,CAAC;AAC3C,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 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","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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,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,EAAE,EAAE,IAAI,EAAE,EAAE;YACxC;YACE,sEAAsE;YACtE,sBAAsB,CAAC,IAAI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AAC;QACJ,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 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.21.0";
1
+ export declare const VERSION = "4.23.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.21.0";
3
+ export const VERSION = "4.23.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.21.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.23.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
+ traceparent: `00-${string}-${string}-${string}`;
21
+ tracestate: string;
22
+ "X-Alchemy-Client-Breadcrumb": string;
23
+ "X-Alchemy-Client-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":"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"}
@@ -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,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;AACd,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,oBAAoB,GAAG;IAC1B,iBAAiB,EAAE,gBAAgB,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAcF,MAAM,MAAM,sBAAsB,GAAG,CACjC,CAAC,gBAAg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,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;
@@ -1 +1 @@
1
- {"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../src/chains.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAyBlC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,kBAAkB;WAItB,KAAK;gBACA,MAAM;MAChB,KAUH,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAQtB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAQ5B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAQ7B,CAAC;AACF,eAAO,MAAM,MAAM,EAAE,KAQpB,CAAC;AACF,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC;AACF,eAAO,MAAM,QAAQ,EAAE,KAQtB,CAAC;AACF,eAAO,MAAM,cAAc,EAAE,KAQ5B,CAAC;AACF,eAAO,MAAM,eAAe,EAAE,KAQ7B,CAAC;AACF,eAAO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AAEF,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAgB9B,CAAC;AAEH,eAAO,MAAM,UAAU,EAAE,KAgBvB,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,KAgBzB,CAAC;AAEH,eAAO,MAAM,KAAK,EAAE,KAgBlB,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,KAgB5B,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,KAgB5B,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,KAgB1B,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,KAgB3B,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,KAgBzB,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,KAgBzB,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,KAgB5B,CAAC;AAEH,eAAO,MAAM,UAAU,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,MAAM,wBAAwB,CAAC;AAGxF,MAAM,MAAM,gCAAgC,CAC1C,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EACb,QAAQ,SAAS,oBAAoB,GAAG,SAAS,GAC7C,oBAAoB,GACpB,SAAS,EACb,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,kBAAkB,SAAS,wBAAwB,CAAC,QAAQ,CAAC,GAAG,wBAAwB,CAAC,QAAQ,CAAC,IAChG;IACF,qBAAqB,EAAE,CACrB,IAAI,EAAE,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAClD,OAAO,CAAC,yCAAyC,CAAC,CAAC;IACxD,iBAAiB,EAAE,CACjB,IAAI,EAAE,2BAA2B,CAC/B,QAAQ,EACR,QAAQ,EACR,wBAAwB,CAAC,QAAQ,CAAC,CACnC,KACE,OAAO,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC1D,eAAe,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C7C,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":"","sources":["../../../src/client/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EACzB,KAAK,8BAA8B,EACnC,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAK/D,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,wBAAgB,mBAAmB,CACjC,QAAQ,SAAS,8BAA8B,EAC/C,OAAO,EAAE,QAAQ;;EAElB;AAGD,MAAM,MAAM,+BAA+B,CACzC,KAAK,SAAS,KAAK,GAAG,SAAS,GAAG,K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
  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, riseTestnet, } 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";
@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AAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,mBAAmB,uBAAuB,CAAC;AAC3C,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,mBAAmB,gCAAgC,CAAC;AACpD,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AACjF,mBAAmB,mBAAmB,CAAC;AACvC,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,mBAAmB,4BAA4B,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EACL,2BAA2B,EAC3B,uCAAuC,GACxC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,mBAAmB,aAAa,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.21.0";
1
+ export declare const VERSION = "4.23.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.21.0",
3
+ "version": "4.23.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.21.0",
49
- "@account-kit/logging": "^4.21.0",
48
+ "@aa-sdk/core": "^4.23.0",
49
+ "@account-kit/logging": "^4.23.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": "fa390d769ea38558e9adb10f2560d4a85f6b0e1f",
68
+ "gitHead": "f3a34c8b964421501ce9cde737adfafc00c7c897",
69
69
  "optionalDependencies": {
70
70
  "alchemy-sdk": "^3.0.0"
71
71
  }
@@ -0,0 +1,64 @@
1
+ import { TRACE_HEADER_NAME } from "@aa-sdk/core";
2
+ import { TRACE_HEADER_STATE } from "@aa-sdk/core";
3
+ import { TraceHeader } from "@aa-sdk/core";
4
+
5
+ /**
6
+ * The header that is used to track the trace id.
7
+ * We use a client specific one to not mess with the span tracing of the servers.
8
+ *
9
+ * @see headersUpdate
10
+ */
11
+ const TRACKER_HEADER = "X-Alchemy-Client-Trace-Id";
12
+
13
+ /**
14
+ * The header that is used to track the breadcrumb.
15
+ *
16
+ * @see headersUpdate
17
+ */
18
+ const TRACKER_BREADCRUMB = "X-Alchemy-Client-Breadcrumb";
19
+
20
+ /**
21
+ * Remove the tracking headers. This is used in our split transport to ensure that we remove the headers that
22
+ * are not used by the other systems.
23
+ *
24
+ * @param {unknown} x The headers to remove the tracking headers from
25
+ */
26
+ export function mutateRemoveTrackingHeaders(x?: unknown) {
27
+ if (!x) return;
28
+ if (Array.isArray(x)) return;
29
+ if (typeof x !== "object") return;
30
+ TRACKER_HEADER in x && delete x[TRACKER_HEADER];
31
+ TRACKER_BREADCRUMB in x && delete x[TRACKER_BREADCRUMB];
32
+ TRACE_HEADER_NAME in x && delete x[TRACE_HEADER_NAME];
33
+ TRACE_HEADER_STATE in x && delete x[TRACE_HEADER_STATE];
34
+ }
35
+
36
+ function addCrumb(previous: string | undefined, crumb: string): string {
37
+ if (!previous) return crumb;
38
+ return `${previous} > ${crumb}`;
39
+ }
40
+ /**
41
+ * Update the headers with the trace header and breadcrumb.
42
+ *
43
+ * These trace headers are used in the imply ingestion pipeline to trace the request.
44
+ * And the breadcrumb is used to get finer grain details in the trace.
45
+ *
46
+ * Then there are the trace headers that are part of the W3C trace context standard.
47
+ *
48
+ * @param {string} crumb The crumb to add to the breadcrumb
49
+ * @returns {Function} A function that updates the headers
50
+ */
51
+ export function headersUpdate(crumb: string) {
52
+ const headerUpdate_ = (x: Record<string, string>) => {
53
+ const traceHeader = (
54
+ TraceHeader.fromTraceHeader(x) || TraceHeader.default()
55
+ ).withEvent(crumb);
56
+ return {
57
+ [TRACKER_HEADER]: traceHeader.parentId,
58
+ ...x,
59
+ [TRACKER_BREADCRUMB]: addCrumb(x[TRACKER_BREADCRUMB], crumb),
60
+ ...traceHeader.toTraceHeader(),
61
+ };
62
+ };
63
+ return headerUpdate_;
64
+ }
@@ -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) {
package/src/chains.ts CHANGED
@@ -21,6 +21,8 @@ import {
21
21
  arbitrumNova as vabn,
22
22
  zora as vzora,
23
23
  zoraSepolia as vzoras,
24
+ sonic as vsonic,
25
+ sonicTestnet as vsonict,
24
26
  } from "viem/chains";
25
27
 
26
28
  export type AlchemyChainConfig = {
@@ -238,6 +240,20 @@ export const zoraSepolia: Chain = {
238
240
  },
239
241
  };
240
242
 
243
+ export const sonic: Chain = {
244
+ ...vsonic,
245
+ rpcUrls: {
246
+ ...vsonic.rpcUrls,
247
+ },
248
+ };
249
+
250
+ export const sonicTestnet: Chain = {
251
+ ...vsonict,
252
+ rpcUrls: {
253
+ ...vsonict.rpcUrls,
254
+ },
255
+ };
256
+
241
257
  export const worldChainSepolia: Chain = defineChain({
242
258
  id: 4801,
243
259
  name: "World Chain Sepolia",
@@ -10,6 +10,7 @@ import {
10
10
  type SmartContractAccount,
11
11
  type UserOperationContext,
12
12
  type UserOperationOverrides,
13
+ clientHeaderTrack,
13
14
  } from "@aa-sdk/core";
14
15
  import type {
15
16
  Chain,
@@ -64,7 +65,7 @@ export type AlchemySmartAccountClientActions<
64
65
  * const clientWithAlchemyActions = client.extend(alchemyActions);
65
66
  * ```
66
67
  *
67
- * @param {Client<TTransport, TChain, TAccount>} client The client instance used to perform actions
68
+ * @param {Client<TTransport, TChain, TAccount>} client_ The client instance used to perform actions
68
69
  * @returns {AlchemySmartAccountClientActions<TAccount, TContext>} An object containing Alchemy Smart Account client actions
69
70
  */
70
71
  export const alchemyActions: <
@@ -79,11 +80,14 @@ export const alchemyActions: <
79
80
  >(
80
81
  client: Client<TTransport, TChain, TAccount>
81
82
  ) => AlchemySmartAccountClientActions<TAccount, TContext, TChain> = (
82
- client
83
+ client_
83
84
  ) => ({
84
- simulateUserOperation: async (args) =>
85
- simulateUserOperationChanges(client, args),
86
- sendUserOperation: async (args) => {
85
+ simulateUserOperation: async (args) => {
86
+ const client = clientHeaderTrack(client_, "simulateUserOperation");
87
+ return simulateUserOperationChanges(client, args);
88
+ },
89
+ async sendUserOperation(args) {
90
+ const client = clientHeaderTrack(client_, "infraSendUserOperation");
87
91
  const { account = client.account } = args;
88
92
 
89
93
  const result = sendUserOperation(client, args);
@@ -91,6 +95,7 @@ export const alchemyActions: <
91
95
  return result;
92
96
  },
93
97
  sendTransaction: async (args, overrides, context) => {
98
+ const client = clientHeaderTrack(client_, "sendTransaction");
94
99
  const { account = client.account } = args;
95
100
 
96
101
  const result = await sendTransaction(client, args, overrides, context);
@@ -98,6 +103,7 @@ export const alchemyActions: <
98
103
  return result;
99
104
  },
100
105
  async sendTransactions(args) {
106
+ const client = clientHeaderTrack(client_, "sendTransactions");
101
107
  const { account = client.account } = args;
102
108
 
103
109
  const result = sendTransactions(client, args);