@account-kit/infra 4.0.0-alpha.8 → 4.0.0-beta.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 (130) hide show
  1. package/dist/esm/actions/simulateUserOperationChanges.d.ts +17 -0
  2. package/dist/esm/actions/simulateUserOperationChanges.js +17 -0
  3. package/dist/esm/actions/simulateUserOperationChanges.js.map +1 -1
  4. package/dist/esm/actions/types.d.ts +4 -0
  5. package/dist/esm/actions/types.js +4 -0
  6. package/dist/esm/actions/types.js.map +1 -1
  7. package/dist/esm/chains.d.ts +22 -0
  8. package/dist/esm/chains.js +60 -1
  9. package/dist/esm/chains.js.map +1 -1
  10. package/dist/esm/client/decorators/alchemyEnhancedApis.d.ts +18 -5393
  11. package/dist/esm/client/decorators/alchemyEnhancedApis.js +37 -18
  12. package/dist/esm/client/decorators/alchemyEnhancedApis.js.map +1 -1
  13. package/dist/esm/client/decorators/smartAccount.d.ts +15 -0
  14. package/dist/esm/client/decorators/smartAccount.js +15 -0
  15. package/dist/esm/client/decorators/smartAccount.js.map +1 -1
  16. package/dist/esm/client/internal/smartAccountClientFromRpc.d.ts +7 -0
  17. package/dist/esm/client/internal/smartAccountClientFromRpc.js +17 -0
  18. package/dist/esm/client/internal/smartAccountClientFromRpc.js.map +1 -1
  19. package/dist/esm/client/isAlchemySmartAccountClient.d.ts +17 -5393
  20. package/dist/esm/client/isAlchemySmartAccountClient.js +21 -2
  21. package/dist/esm/client/isAlchemySmartAccountClient.js.map +1 -1
  22. package/dist/esm/client/rpcClient.d.ts +22 -0
  23. package/dist/esm/client/rpcClient.js +22 -0
  24. package/dist/esm/client/rpcClient.js.map +1 -1
  25. package/dist/esm/client/smartAccountClient.js +17 -0
  26. package/dist/esm/client/smartAccountClient.js.map +1 -1
  27. package/dist/esm/defaults.d.ts +14 -0
  28. package/dist/esm/defaults.js +14 -0
  29. package/dist/esm/defaults.js.map +1 -1
  30. package/dist/esm/errors/base.js +1 -0
  31. package/dist/esm/errors/base.js.map +1 -1
  32. package/dist/esm/gas-manager.d.ts +13 -0
  33. package/dist/esm/gas-manager.js +13 -0
  34. package/dist/esm/gas-manager.js.map +1 -1
  35. package/dist/esm/index.d.ts +1 -1
  36. package/dist/esm/index.js +1 -1
  37. package/dist/esm/index.js.map +1 -1
  38. package/dist/esm/middleware/feeEstimator.d.ts +19 -0
  39. package/dist/esm/middleware/feeEstimator.js +20 -0
  40. package/dist/esm/middleware/feeEstimator.js.map +1 -1
  41. package/dist/esm/middleware/gasManager.d.ts +19 -0
  42. package/dist/esm/middleware/gasManager.js +19 -0
  43. package/dist/esm/middleware/gasManager.js.map +1 -1
  44. package/dist/esm/middleware/userOperationSimulator.d.ts +19 -0
  45. package/dist/esm/middleware/userOperationSimulator.js +19 -0
  46. package/dist/esm/middleware/userOperationSimulator.js.map +1 -1
  47. package/dist/esm/version.d.ts +1 -1
  48. package/dist/esm/version.js +3 -1
  49. package/dist/esm/version.js.map +1 -1
  50. package/dist/types/chains.d.ts +3 -0
  51. package/dist/types/chains.d.ts.map +1 -1
  52. package/dist/types/client/decorators/alchemyEnhancedApis.d.ts +1 -5393
  53. package/dist/types/client/decorators/alchemyEnhancedApis.d.ts.map +1 -1
  54. package/dist/types/client/isAlchemySmartAccountClient.d.ts +2 -5393
  55. package/dist/types/client/isAlchemySmartAccountClient.d.ts.map +1 -1
  56. package/dist/types/index.d.ts +1 -1
  57. package/dist/types/index.d.ts.map +1 -1
  58. package/dist/types/version.d.ts +1 -1
  59. package/dist/types/version.d.ts.map +1 -1
  60. package/package.json +13 -14
  61. package/src/chains.ts +44 -0
  62. package/src/client/decorators/alchemyEnhancedApis.ts +13 -11
  63. package/src/client/isAlchemySmartAccountClient.ts +3 -3
  64. package/src/index.ts +3 -0
  65. package/src/version.ts +1 -1
  66. package/dist/cjs/actions/simulateUserOperationChanges.d.ts +0 -5
  67. package/dist/cjs/actions/simulateUserOperationChanges.js +0 -24
  68. package/dist/cjs/actions/simulateUserOperationChanges.js.map +0 -1
  69. package/dist/cjs/actions/types.d.ts +0 -39
  70. package/dist/cjs/actions/types.js +0 -17
  71. package/dist/cjs/actions/types.js.map +0 -1
  72. package/dist/cjs/chains.d.ts +0 -30
  73. package/dist/cjs/chains.js +0 -215
  74. package/dist/cjs/chains.js.map +0 -1
  75. package/dist/cjs/client/decorators/alchemyEnhancedApis.d.ts +0 -5406
  76. package/dist/cjs/client/decorators/alchemyEnhancedApis.js +0 -26
  77. package/dist/cjs/client/decorators/alchemyEnhancedApis.js.map +0 -1
  78. package/dist/cjs/client/decorators/smartAccount.d.ts +0 -7
  79. package/dist/cjs/client/decorators/smartAccount.js +0 -9
  80. package/dist/cjs/client/decorators/smartAccount.js.map +0 -1
  81. package/dist/cjs/client/internal/smartAccountClientFromRpc.d.ts +0 -11
  82. package/dist/cjs/client/internal/smartAccountClientFromRpc.js +0 -44
  83. package/dist/cjs/client/internal/smartAccountClientFromRpc.js.map +0 -1
  84. package/dist/cjs/client/isAlchemySmartAccountClient.d.ts +0 -5395
  85. package/dist/cjs/client/isAlchemySmartAccountClient.js +0 -9
  86. package/dist/cjs/client/isAlchemySmartAccountClient.js.map +0 -1
  87. package/dist/cjs/client/rpcClient.d.ts +0 -8
  88. package/dist/cjs/client/rpcClient.js +0 -36
  89. package/dist/cjs/client/rpcClient.js.map +0 -1
  90. package/dist/cjs/client/smartAccountClient.d.ts +0 -17
  91. package/dist/cjs/client/smartAccountClient.js +0 -32
  92. package/dist/cjs/client/smartAccountClient.js.map +0 -1
  93. package/dist/cjs/client/types.d.ts +0 -29
  94. package/dist/cjs/client/types.js +0 -3
  95. package/dist/cjs/client/types.js.map +0 -1
  96. package/dist/cjs/defaults.d.ts +0 -3
  97. package/dist/cjs/defaults.js +0 -23
  98. package/dist/cjs/defaults.js.map +0 -1
  99. package/dist/cjs/errors/base.d.ts +0 -4
  100. package/dist/cjs/errors/base.js +0 -18
  101. package/dist/cjs/errors/base.js.map +0 -1
  102. package/dist/cjs/errors/rpcUrl.d.ts +0 -10
  103. package/dist/cjs/errors/rpcUrl.js +0 -26
  104. package/dist/cjs/errors/rpcUrl.js.map +0 -1
  105. package/dist/cjs/gas-manager.d.ts +0 -6
  106. package/dist/cjs/gas-manager.js +0 -35
  107. package/dist/cjs/gas-manager.js.map +0 -1
  108. package/dist/cjs/index.d.ts +0 -25
  109. package/dist/cjs/index.js +0 -53
  110. package/dist/cjs/index.js.map +0 -1
  111. package/dist/cjs/middleware/feeEstimator.d.ts +0 -3
  112. package/dist/cjs/middleware/feeEstimator.js +0 -26
  113. package/dist/cjs/middleware/feeEstimator.js.map +0 -1
  114. package/dist/cjs/middleware/gasManager.d.ts +0 -2
  115. package/dist/cjs/middleware/gasManager.js +0 -11
  116. package/dist/cjs/middleware/gasManager.js.map +0 -1
  117. package/dist/cjs/middleware/userOperationSimulator.d.ts +0 -3
  118. package/dist/cjs/middleware/userOperationSimulator.js +0 -21
  119. package/dist/cjs/middleware/userOperationSimulator.js.map +0 -1
  120. package/dist/cjs/package.json +0 -1
  121. package/dist/cjs/schema.d.ts +0 -396
  122. package/dist/cjs/schema.js +0 -19
  123. package/dist/cjs/schema.js.map +0 -1
  124. package/dist/cjs/type.d.ts +0 -3
  125. package/dist/cjs/type.js +0 -3
  126. package/dist/cjs/type.js.map +0 -1
  127. package/dist/cjs/version.d.ts +0 -1
  128. package/dist/cjs/version.js +0 -5
  129. package/dist/cjs/version.js.map +0 -1
  130. package/dist/esm/package.json +0 -1
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAlchemySmartAccountClient = void 0;
4
- const core_1 = require("@aa-sdk/core");
5
- const isAlchemySmartAccountClient = (client) => {
6
- return (0, core_1.isSmartAccountClient)(client);
7
- };
8
- exports.isAlchemySmartAccountClient = isAlchemySmartAccountClient;
9
- //# sourceMappingURL=isAlchemySmartAccountClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isAlchemySmartAccountClient.js","sourceRoot":"","sources":["../../../src/client/isAlchemySmartAccountClient.ts"],"names":[],"mappings":";;;AAAA,uCAA+E;AAmBxE,MAAM,2BAA2B,GAAG,CAOzC,MAA4C,EACuB,EAAE;IAKrE,OAAO,IAAA,2BAAoB,EAAC,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC;AAdW,QAAA,2BAA2B,+BActC","sourcesContent":["import { isSmartAccountClient, type SmartContractAccount } from \"@aa-sdk/core\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport type { AlchemySmartAccountClient } from \"./smartAccountClient\";\n\n/**\n * Checks if a given client is an Alchemy Smart Account Client. The goal of this check is to ensure that the client supports certain RPC methods.\n *\n * @example\n * ```ts\n * import { isAlchemySmartAccountClient } from \"@account-kit/infra\";\n *\n * if (isAlchemySmartAccountClient(client)) {\n * // do things with the client as an Alchemy Smart Account Client\n * }\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance to be checked\n * @returns {boolean} `true` if the client is an Alchemy Smart Account Client, otherwise `false`\n */\nexport const isAlchemySmartAccountClient = <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n): client is AlchemySmartAccountClient<TTransport, TChain, TAccount> => {\n // TODO: the goal of this check is to make sure that the client supports certain RPC methods\n // we should probably do this by checking the client's transport and configured URL, since alchemy\n // clients have to be RPC clients. this is difficult to do though because the transport might\n // point to a proxy url :/\n return isSmartAccountClient(client);\n};\n"]}
@@ -1,8 +0,0 @@
1
- import { type ConnectionConfig, type NoUndefined } from "@aa-sdk/core";
2
- import { type Chain, type HttpTransportConfig } from "viem";
3
- import type { ClientWithAlchemyMethods } from "./types.js";
4
- export declare const createAlchemyPublicRpcClient: ({ chain: chain_, connectionConfig, fetchOptions, }: {
5
- connectionConfig: ConnectionConfig;
6
- chain: Chain;
7
- fetchOptions?: Omit<RequestInit, "body"> | undefined;
8
- }) => ClientWithAlchemyMethods;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAlchemyPublicRpcClient = void 0;
4
- const core_1 = require("@aa-sdk/core");
5
- const viem_1 = require("viem");
6
- const schema_js_1 = require("../schema.js");
7
- const version_js_1 = require("../version.js");
8
- const createAlchemyPublicRpcClient = ({ chain: chain_, connectionConfig, fetchOptions = {}, }) => {
9
- const chain = schema_js_1.AlchemyChainSchema.parse(chain_);
10
- const rpcUrl = connectionConfig.rpcUrl == null
11
- ? `${chain.rpcUrls.alchemy.http[0]}/${connectionConfig.apiKey ?? ""}`
12
- : connectionConfig.rpcUrl;
13
- fetchOptions.headers = {
14
- ...fetchOptions.headers,
15
- "Alchemy-AA-Sdk-Version": version_js_1.VERSION,
16
- };
17
- if (connectionConfig.jwt != null) {
18
- fetchOptions.headers = {
19
- ...fetchOptions.headers,
20
- Authorization: `Bearer ${connectionConfig.jwt}`,
21
- };
22
- }
23
- return (0, core_1.createBundlerClient)({
24
- chain: chain,
25
- transport: (0, viem_1.http)(rpcUrl, { fetchOptions }),
26
- }).extend(() => ({
27
- updateHeaders(newHeaders) {
28
- fetchOptions.headers = {
29
- ...fetchOptions.headers,
30
- ...newHeaders,
31
- };
32
- },
33
- }));
34
- };
35
- exports.createAlchemyPublicRpcClient = createAlchemyPublicRpcClient;
36
- //# sourceMappingURL=rpcClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rpcClient.js","sourceRoot":"","sources":["../../../src/client/rpcClient.ts"],"names":[],"mappings":";;;AAAA,uCAIsB;AACtB,+BAAkE;AAClE,4CAAkD;AAClD,8CAAwC;AAyBjC,MAAM,4BAA4B,GAAG,CAAC,EAC3C,KAAK,EAAE,MAAM,EACb,gBAAgB,EAChB,YAAY,GAAG,EAAE,GAKlB,EAA4B,EAAE;IAC7B,MAAM,KAAK,GAAG,8BAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE/C,MAAM,MAAM,GACV,gBAAgB,CAAC,MAAM,IAAI,IAAI;QAC7B,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,MAAM,IAAI,EAAE,EAAE;QACrE,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC;IAE9B,YAAY,CAAC,OAAO,GAAG;QACrB,GAAG,YAAY,CAAC,OAAO;QACvB,wBAAwB,EAAE,oBAAO;KAClC,CAAC;IAEF,IAAI,gBAAgB,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;QACjC,YAAY,CAAC,OAAO,GAAG;YACrB,GAAG,YAAY,CAAC,OAAO;YACvB,aAAa,EAAE,UAAU,gBAAgB,CAAC,GAAG,EAAE;SAChD,CAAC;IACJ,CAAC;IAED,OAAO,IAAA,0BAAmB,EAAC;QACzB,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,IAAA,WAAI,EAAC,MAAM,EAAE,EAAE,YAAY,EAAE,CAAC;KAC1C,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACf,aAAa,CAAC,UAAuB;YACnC,YAAY,CAAC,OAAO,GAAG;gBACrB,GAAG,YAAY,CAAC,OAAO;gBACvB,GAAG,UAAU;aACd,CAAC;QACJ,CAAC;KACF,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AAvCW,QAAA,4BAA4B,gCAuCvC","sourcesContent":["import {\n createBundlerClient,\n type ConnectionConfig,\n type NoUndefined,\n} from \"@aa-sdk/core\";\nimport { http, type Chain, type HttpTransportConfig } from \"viem\";\nimport { AlchemyChainSchema } from \"../schema.js\";\nimport { VERSION } from \"../version.js\";\nimport type { ClientWithAlchemyMethods } from \"./types.js\";\n\n/**\n * Creates an Alchemy public RPC client with the provided chain, connection configuration, and optional fetch options. The client has alchemy methods and can dynamically update HTTP headers.\n *\n * @example\n * ```ts\n * import { createAlchemyPublicRpcClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra\";\n *\n * const client = createAlchemyPublicRpcClient({\n * chain: sepolia,\n * connectionConfig: {\n * apiKey: \"your-api-key\",\n * }\n * });\n * ```\n *\n * @param {{connectionConfig: ConnectionConfig,chain: Chain,fetchOptions?: NoUndefined<HttpTransportConfig[\"fetchOptions\"]>}} params The parameters for creating the Alchemy public RPC client\n * @param {ConnectionConfig} params.connectionConfig The connection configuration containing the RPC URL and API key\n * @param {Chain} params.chain The blockchain chain configuration\n * @param {NoUndefined<HttpTransportConfig[\"fetchOptions\"]>} [params.fetchOptions] Optional fetch configuration for HTTP transport\n * @returns {ClientWithAlchemyMethods} A client object tailored with Alchemy methods and capabilities to interact with the blockchain\n */\nexport const createAlchemyPublicRpcClient = ({\n chain: chain_,\n connectionConfig,\n fetchOptions = {},\n}: {\n connectionConfig: ConnectionConfig;\n chain: Chain;\n fetchOptions?: NoUndefined<HttpTransportConfig[\"fetchOptions\"]>;\n}): ClientWithAlchemyMethods => {\n const chain = AlchemyChainSchema.parse(chain_);\n\n const rpcUrl =\n connectionConfig.rpcUrl == null\n ? `${chain.rpcUrls.alchemy.http[0]}/${connectionConfig.apiKey ?? \"\"}`\n : connectionConfig.rpcUrl;\n\n fetchOptions.headers = {\n ...fetchOptions.headers,\n \"Alchemy-AA-Sdk-Version\": VERSION,\n };\n\n if (connectionConfig.jwt != null) {\n fetchOptions.headers = {\n ...fetchOptions.headers,\n Authorization: `Bearer ${connectionConfig.jwt}`,\n };\n }\n\n return createBundlerClient({\n chain: chain,\n transport: http(rpcUrl, { fetchOptions }),\n }).extend(() => ({\n updateHeaders(newHeaders: HeadersInit) {\n fetchOptions.headers = {\n ...fetchOptions.headers,\n ...newHeaders,\n };\n },\n }));\n};\n"]}
@@ -1,17 +0,0 @@
1
- import { type Prettify, type SmartAccountClient, type SmartAccountClientActions, type SmartAccountClientConfig, type SmartAccountClientRpcSchema, type SmartContractAccount, type UserOperationContext } from "@aa-sdk/core";
2
- import { type Chain, type Transport } from "viem";
3
- import type { AlchemyProviderConfig } from "../type.js";
4
- import type { AlchemySmartAccountClientActions } from "./decorators/smartAccount.js";
5
- import type { AlchemyRpcSchema } from "./types.js";
6
- export type AlchemySmartAccountClientConfig<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends SmartContractAccount | undefined = SmartContractAccount | undefined, context extends UserOperationContext | undefined = UserOperationContext | undefined> = {
7
- account?: account;
8
- useSimulation?: boolean;
9
- policyId?: string;
10
- } & AlchemyProviderConfig & Pick<SmartAccountClientConfig<transport, chain, account, context>, "customMiddleware" | "feeEstimator" | "gasEstimator" | "signUserOperation">;
11
- export type BaseAlchemyActions<chain extends Chain | undefined = Chain | undefined, account extends SmartContractAccount | undefined = SmartContractAccount | undefined, context extends UserOperationContext | undefined = UserOperationContext | undefined> = SmartAccountClientActions<chain, account, context> & AlchemySmartAccountClientActions<account, context>;
12
- export type AlchemySmartAccountClient_Base<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends SmartContractAccount | undefined = SmartContractAccount | undefined, actions extends Record<string, unknown> = Record<string, unknown>, context extends UserOperationContext | undefined = UserOperationContext | undefined> = Prettify<SmartAccountClient<transport, chain, account, actions & BaseAlchemyActions<chain, account, context>, [
13
- ...SmartAccountClientRpcSchema,
14
- ...AlchemyRpcSchema
15
- ], context>>;
16
- export type AlchemySmartAccountClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends SmartContractAccount | undefined = SmartContractAccount | undefined, actions extends Record<string, unknown> = Record<string, unknown>, context extends UserOperationContext | undefined = UserOperationContext | undefined> = Prettify<AlchemySmartAccountClient_Base<transport, chain, account, actions, context>>;
17
- export declare function createAlchemySmartAccountClient<TTransport extends Transport = Transport, TChain extends Chain = Chain, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>({ account, policyId, useSimulation, feeEstimator, customMiddleware, gasEstimator, signUserOperation, ...config_ }: AlchemySmartAccountClientConfig<TTransport, TChain, TAccount, TContext>): AlchemySmartAccountClient<TTransport, TChain, TAccount, Record<string, never>, TContext>;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAlchemySmartAccountClient = void 0;
4
- const defaults_js_1 = require("../defaults.js");
5
- const schema_js_1 = require("../schema.js");
6
- const smartAccountClientFromRpc_js_1 = require("./internal/smartAccountClientFromRpc.js");
7
- const rpcClient_js_1 = require("./rpcClient.js");
8
- function createAlchemySmartAccountClient({ account, policyId, useSimulation, feeEstimator, customMiddleware, gasEstimator, signUserOperation, ...config_ }) {
9
- const config = schema_js_1.AlchemyProviderConfigSchema.parse(config_);
10
- const { chain, opts, ...connectionConfig } = config;
11
- const client = (0, rpcClient_js_1.createAlchemyPublicRpcClient)({
12
- chain,
13
- connectionConfig,
14
- });
15
- const feeOptions = opts?.feeOptions ?? (0, defaults_js_1.getDefaultUserOperationFeeOptions)(chain);
16
- return (0, smartAccountClientFromRpc_js_1.createAlchemySmartAccountClientFromRpcClient)({
17
- client,
18
- account,
19
- opts: {
20
- ...opts,
21
- feeOptions,
22
- },
23
- policyId,
24
- useSimulation,
25
- feeEstimator,
26
- customMiddleware,
27
- gasEstimator,
28
- signUserOperation,
29
- });
30
- }
31
- exports.createAlchemySmartAccountClient = createAlchemySmartAccountClient;
32
- //# sourceMappingURL=smartAccountClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../src/client/smartAccountClient.ts"],"names":[],"mappings":";;;AAUA,gDAAmE;AACnE,4CAA2D;AAG3D,0FAAuG;AACvG,iDAA8D;AAsH9D,SAAgB,+BAA+B,CAAC,EAC9C,OAAO,EACP,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,GAAG,OAAO,EACsB;IAChC,MAAM,MAAM,GAAG,uCAA2B,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GAAG,MAAM,CAAC;IAEpD,MAAM,MAAM,GAAG,IAAA,2CAA4B,EAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,UAAU,GACd,IAAI,EAAE,UAAU,IAAI,IAAA,+CAAiC,EAAC,KAAK,CAAC,CAAC;IAE/D,OAAO,IAAA,2EAA4C,EAAC;QAClD,MAAM;QACN,OAAO;QACP,IAAI,EAAE;YACJ,GAAG,IAAI;YACP,UAAU;SACX;QACD,QAAQ;QACR,aAAa;QACb,YAAY;QACZ,gBAAgB;QAChB,YAAY;QACZ,iBAAiB;KAClB,CAAC,CAAC;AACL,CAAC;AAnCD,0EAmCC","sourcesContent":["import {\n type Prettify,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountClientRpcSchema,\n type SmartContractAccount,\n type UserOperationContext,\n} from \"@aa-sdk/core\";\nimport { type Chain, type Transport } from \"viem\";\nimport { getDefaultUserOperationFeeOptions } from \"../defaults.js\";\nimport { AlchemyProviderConfigSchema } from \"../schema.js\";\nimport type { AlchemyProviderConfig } from \"../type.js\";\nimport type { AlchemySmartAccountClientActions } from \"./decorators/smartAccount.js\";\nimport { createAlchemySmartAccountClientFromRpcClient } from \"./internal/smartAccountClientFromRpc.js\";\nimport { createAlchemyPublicRpcClient } from \"./rpcClient.js\";\nimport type { AlchemyRpcSchema } from \"./types.js\";\n\n// #region AlchemySmartAccountClientConfig\nexport type AlchemySmartAccountClientConfig<\n transport extends Transport = Transport,\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;\n} & AlchemyProviderConfig &\n Pick<\n SmartAccountClientConfig<transport, chain, account, context>,\n \"customMiddleware\" | \"feeEstimator\" | \"gasEstimator\" | \"signUserOperation\"\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 transport extends Transport = Transport,\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 transport,\n chain,\n account,\n actions & BaseAlchemyActions<chain, account, context>,\n [...SmartAccountClientRpcSchema, ...AlchemyRpcSchema],\n context\n >\n>;\n\nexport type AlchemySmartAccountClient<\n transport extends Transport = Transport,\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 AlchemySmartAccountClient_Base<transport, chain, account, actions, context>\n>;\n\nexport function createAlchemySmartAccountClient<\n TTransport extends Transport = Transport,\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 account,\n policyId,\n useSimulation,\n feeEstimator,\n customMiddleware,\n gasEstimator,\n signUserOperation,\n ...config_\n}: AlchemySmartAccountClientConfig<\n TTransport,\n TChain,\n TAccount,\n TContext\n>): AlchemySmartAccountClient<\n TTransport,\n TChain,\n TAccount,\n Record<string, never>,\n TContext\n>;\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 } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra/chain\";\n *\n * const client = createAlchemySmartAccountClient({\n * chain: sepolia,\n * 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 ...config_\n}: AlchemySmartAccountClientConfig): AlchemySmartAccountClient {\n const config = AlchemyProviderConfigSchema.parse(config_);\n const { chain, opts, ...connectionConfig } = config;\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const feeOptions =\n opts?.feeOptions ?? getDefaultUserOperationFeeOptions(chain);\n\n return createAlchemySmartAccountClientFromRpcClient({\n client,\n account,\n opts: {\n ...opts,\n feeOptions,\n },\n policyId,\n useSimulation,\n feeEstimator,\n customMiddleware,\n gasEstimator,\n signUserOperation,\n });\n}\n"]}
@@ -1,29 +0,0 @@
1
- import { type BundlerClient, type UserOperationRequest } from "@aa-sdk/core";
2
- import type { HttpTransport } from "viem";
3
- import type { SimulateUserOperationAssetChangesRequest, SimulateUserOperationAssetChangesResponse } from "../actions/types";
4
- export type AlchemyRpcSchema = [
5
- {
6
- Method: "alchemy_simulateUserOperationAssetChanges";
7
- Parameters: SimulateUserOperationAssetChangesRequest;
8
- ReturnType: SimulateUserOperationAssetChangesResponse;
9
- },
10
- {
11
- Method: "rundler_maxPriorityFeePerGas";
12
- Parameters: [];
13
- ReturnType: UserOperationRequest["maxPriorityFeePerGas"];
14
- }
15
- ];
16
- export type ClientWithAlchemyMethods = BundlerClient<HttpTransport> & {
17
- request: BundlerClient<HttpTransport>["request"] & {
18
- request(args: {
19
- method: "alchemy_simulateUserOperationAssetChanges";
20
- params: SimulateUserOperationAssetChangesRequest;
21
- }): Promise<SimulateUserOperationAssetChangesResponse>;
22
- request(args: {
23
- method: "rundler_maxPriorityFeePerGas";
24
- params: [];
25
- }): Promise<UserOperationRequest["maxPriorityFeePerGas"]>;
26
- }["request"];
27
- } & {
28
- updateHeaders: (headers: HeadersInit) => void;
29
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"","sourcesContent":["import { type BundlerClient, type UserOperationRequest } from \"@aa-sdk/core\";\nimport type { HttpTransport } from \"viem\";\nimport type {\n SimulateUserOperationAssetChangesRequest,\n SimulateUserOperationAssetChangesResponse,\n} from \"../actions/types\";\n\nexport type AlchemyRpcSchema = [\n {\n Method: \"alchemy_simulateUserOperationAssetChanges\";\n Parameters: SimulateUserOperationAssetChangesRequest;\n ReturnType: SimulateUserOperationAssetChangesResponse;\n },\n {\n Method: \"rundler_maxPriorityFeePerGas\";\n Parameters: [];\n ReturnType: UserOperationRequest[\"maxPriorityFeePerGas\"];\n }\n];\n\nexport type ClientWithAlchemyMethods = BundlerClient<HttpTransport> & {\n request: BundlerClient<HttpTransport>[\"request\"] &\n {\n request(args: {\n method: \"alchemy_simulateUserOperationAssetChanges\";\n params: SimulateUserOperationAssetChangesRequest;\n }): Promise<SimulateUserOperationAssetChangesResponse>;\n\n request(args: {\n method: \"rundler_maxPriorityFeePerGas\";\n params: [];\n }): Promise<UserOperationRequest[\"maxPriorityFeePerGas\"]>;\n }[\"request\"];\n} & {\n updateHeaders: (headers: HeadersInit) => void;\n};\n"]}
@@ -1,3 +0,0 @@
1
- import { type UserOperationFeeOptions } from "@aa-sdk/core";
2
- import type { Chain } from "viem";
3
- export declare const getDefaultUserOperationFeeOptions: (chain: Chain) => UserOperationFeeOptions;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDefaultUserOperationFeeOptions = void 0;
4
- const chains_js_1 = require("./chains.js");
5
- const getDefaultUserOperationFeeOptions = (chain) => {
6
- const feeOptions = {
7
- maxFeePerGas: { multiplier: 1.5 },
8
- maxPriorityFeePerGas: { multiplier: 1.05 },
9
- };
10
- if (new Set([
11
- chains_js_1.arbitrum.id,
12
- chains_js_1.arbitrumGoerli.id,
13
- chains_js_1.arbitrumSepolia.id,
14
- chains_js_1.optimism.id,
15
- chains_js_1.optimismGoerli.id,
16
- chains_js_1.optimismSepolia.id,
17
- ]).has(chain.id)) {
18
- feeOptions.preVerificationGas = { multiplier: 1.05 };
19
- }
20
- return feeOptions;
21
- };
22
- exports.getDefaultUserOperationFeeOptions = getDefaultUserOperationFeeOptions;
23
- //# sourceMappingURL=defaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/defaults.ts"],"names":[],"mappings":";;;AAEA,2CAOqB;AAgBd,MAAM,iCAAiC,GAAG,CAC/C,KAAY,EACa,EAAE;IAC3B,MAAM,UAAU,GAA4B;QAC1C,YAAY,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE;QACjC,oBAAoB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;KAC3C,CAAC;IAEF,IACE,IAAI,GAAG,CAAS;QACd,oBAAQ,CAAC,EAAE;QACX,0BAAc,CAAC,EAAE;QACjB,2BAAe,CAAC,EAAE;QAClB,oBAAQ,CAAC,EAAE;QACX,0BAAc,CAAC,EAAE;QACjB,2BAAe,CAAC,EAAE;KACnB,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAChB,CAAC;QACD,UAAU,CAAC,kBAAkB,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACvD,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAtBW,QAAA,iCAAiC,qCAsB5C","sourcesContent":["import { type UserOperationFeeOptions } from \"@aa-sdk/core\";\nimport type { Chain } from \"viem\";\nimport {\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n optimism,\n optimismGoerli,\n optimismSepolia,\n} from \"./chains.js\";\n\n/**\n * Retrieves the default user operation fee options for a given chain. Adjusts fees for specific chains like Arbitrum and Optimism.\n *\n * @example\n * ```ts\n * import { getDefaultUserOperationFeeOptions } from \"@account-kit/infra\";\n * import { arbitrum } from \"@account-kit/infra\";\n *\n * const feeOpts = getDefaultUserOperationFeeOptions(arbitrum);\n * ```\n *\n * @param {Chain} chain The blockchain chain for which to get the fee options\n * @returns {UserOperationFeeOptions} An object containing the default fee options for user operations on the specified chain\n */\nexport const getDefaultUserOperationFeeOptions = (\n chain: Chain\n): UserOperationFeeOptions => {\n const feeOptions: UserOperationFeeOptions = {\n maxFeePerGas: { multiplier: 1.5 },\n maxPriorityFeePerGas: { multiplier: 1.05 },\n };\n\n if (\n new Set<number>([\n arbitrum.id,\n arbitrumGoerli.id,\n arbitrumSepolia.id,\n optimism.id,\n optimismGoerli.id,\n optimismSepolia.id,\n ]).has(chain.id)\n ) {\n feeOptions.preVerificationGas = { multiplier: 1.05 };\n }\n\n return feeOptions;\n};\n"]}
@@ -1,4 +0,0 @@
1
- import { BaseError as CoreBaseError } from "@aa-sdk/core";
2
- export declare abstract class BaseError extends CoreBaseError {
3
- version: string;
4
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseError = void 0;
4
- const core_1 = require("@aa-sdk/core");
5
- const version_js_1 = require("../version.js");
6
- class BaseError extends core_1.BaseError {
7
- constructor() {
8
- super(...arguments);
9
- Object.defineProperty(this, "version", {
10
- enumerable: true,
11
- configurable: true,
12
- writable: true,
13
- value: version_js_1.VERSION
14
- });
15
- }
16
- }
17
- exports.BaseError = BaseError;
18
- //# sourceMappingURL=base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/errors/base.ts"],"names":[],"mappings":";;;AAAA,uCAA0D;AAC1D,8CAAwC;AAExC,MAAsB,SAAU,SAAQ,gBAAa;IAArD;;QAEW;;;;mBAAU,oBAAO;WAAC;IAC7B,CAAC;CAAA;AAHD,8BAGC","sourcesContent":["import { BaseError as CoreBaseError } from \"@aa-sdk/core\";\nimport { VERSION } from \"../version.js\";\n\nexport abstract class BaseError extends CoreBaseError {\n // This version could be different from the aa-core version so we overwrite this here.\n override version = VERSION;\n}\n"]}
@@ -1,10 +0,0 @@
1
- import { type ConnectionConfig } from "@aa-sdk/core";
2
- import { type Chain } from "viem";
3
- import { BaseError } from "./base.js";
4
- export declare class InvalidRpcUrlError extends BaseError {
5
- name: string;
6
- constructor(context: {
7
- chain: Chain;
8
- connectionConfig: ConnectionConfig;
9
- });
10
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InvalidRpcUrlError = void 0;
4
- const base_js_1 = require("./base.js");
5
- class InvalidRpcUrlError extends base_js_1.BaseError {
6
- constructor(context) {
7
- super(["RPC Url not provided"].join("\n"), {
8
- details: [
9
- "If you are passing in a chain object and only an API key, make sure to use the chain object exported from @aa-sdk/core",
10
- "Otherwise, pass in an RPC URL directly",
11
- ].join("\n"),
12
- metaMessages: [
13
- `Chain: ${JSON.stringify(context.chain, null, 2)}`,
14
- `ConnectionConfig: ${JSON.stringify(context.connectionConfig)}`,
15
- ],
16
- });
17
- Object.defineProperty(this, "name", {
18
- enumerable: true,
19
- configurable: true,
20
- writable: true,
21
- value: "InvalidRpcUrlError"
22
- });
23
- }
24
- }
25
- exports.InvalidRpcUrlError = InvalidRpcUrlError;
26
- //# sourceMappingURL=rpcUrl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rpcUrl.js","sourceRoot":"","sources":["../../../src/errors/rpcUrl.ts"],"names":[],"mappings":";;;AAEA,uCAAsC;AAEtC,MAAa,kBAAmB,SAAQ,mBAAS;IAG/C,YAAY,OAA6D;QACvE,KAAK,CAAC,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACzC,OAAO,EAAE;gBACP,wHAAwH;gBACxH,wCAAwC;aACzC,CAAC,IAAI,CAAC,IAAI,CAAC;YACZ,YAAY,EAAE;gBACZ,UAAU,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;gBAClD,qBAAqB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE;aAChE;SACF,CAAC,CAAC;QAZI;;;;mBAAO,oBAAoB;WAAC;IAarC,CAAC;CACF;AAfD,gDAeC","sourcesContent":["import { type ConnectionConfig } from \"@aa-sdk/core\";\nimport { type Chain } from \"viem\";\nimport { BaseError } from \"./base.js\";\n\nexport class InvalidRpcUrlError extends BaseError {\n override name = \"InvalidRpcUrlError\";\n\n constructor(context: { chain: Chain; connectionConfig: ConnectionConfig }) {\n super([\"RPC Url not provided\"].join(\"\\n\"), {\n details: [\n \"If you are passing in a chain object and only an API key, make sure to use the chain object exported from @aa-sdk/core\",\n \"Otherwise, pass in an RPC URL directly\",\n ].join(\"\\n\"),\n metaMessages: [\n `Chain: ${JSON.stringify(context.chain, null, 2)}`,\n `ConnectionConfig: ${JSON.stringify(context.connectionConfig)}`,\n ],\n });\n }\n}\n"]}
@@ -1,6 +0,0 @@
1
- import type { Address, Chain } from "viem";
2
- export declare const AlchemyPaymasterAddressV3 = "0x4f84a207A80c39E9e8BaE717c1F25bA7AD1fB08F";
3
- export declare const AlchemyPaymasterAddressV2 = "0x4Fd9098af9ddcB41DA48A1d78F91F1398965addc";
4
- export declare const ArbSepoliaPaymasterAddress = "0x0804Afe6EEFb73ce7F93CD0d5e7079a5a8068592";
5
- export declare const AlchemyPaymasterAddressV1 = "0xc03aac639bb21233e0139381970328db8bceeb67";
6
- export declare const getAlchemyPaymasterAddress: (chain: Chain) => Address;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAlchemyPaymasterAddress = exports.AlchemyPaymasterAddressV1 = exports.ArbSepoliaPaymasterAddress = exports.AlchemyPaymasterAddressV2 = exports.AlchemyPaymasterAddressV3 = void 0;
4
- const chains_js_1 = require("./chains.js");
5
- exports.AlchemyPaymasterAddressV3 = "0x4f84a207A80c39E9e8BaE717c1F25bA7AD1fB08F";
6
- exports.AlchemyPaymasterAddressV2 = "0x4Fd9098af9ddcB41DA48A1d78F91F1398965addc";
7
- exports.ArbSepoliaPaymasterAddress = "0x0804Afe6EEFb73ce7F93CD0d5e7079a5a8068592";
8
- exports.AlchemyPaymasterAddressV1 = "0xc03aac639bb21233e0139381970328db8bceeb67";
9
- const getAlchemyPaymasterAddress = (chain) => {
10
- switch (chain.id) {
11
- case chains_js_1.polygonAmoy.id:
12
- case chains_js_1.optimismSepolia.id:
13
- case chains_js_1.baseSepolia.id:
14
- case chains_js_1.zora.id:
15
- case chains_js_1.zoraSepolia.id:
16
- case chains_js_1.fraxtal.id:
17
- case chains_js_1.fraxtalSepolia.id:
18
- return exports.AlchemyPaymasterAddressV3;
19
- case chains_js_1.mainnet.id:
20
- case chains_js_1.arbitrum.id:
21
- case chains_js_1.optimism.id:
22
- case chains_js_1.polygon.id:
23
- case chains_js_1.base.id:
24
- return exports.AlchemyPaymasterAddressV2;
25
- case chains_js_1.arbitrumSepolia.id:
26
- return exports.ArbSepoliaPaymasterAddress;
27
- case chains_js_1.sepolia.id:
28
- case chains_js_1.polygonMumbai.id:
29
- return exports.AlchemyPaymasterAddressV1;
30
- default:
31
- throw new Error(`Unsupported chain: ${chain}`);
32
- }
33
- };
34
- exports.getAlchemyPaymasterAddress = getAlchemyPaymasterAddress;
35
- //# sourceMappingURL=gas-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gas-manager.js","sourceRoot":"","sources":["../../src/gas-manager.ts"],"names":[],"mappings":";;;AACA,2CAgBqB;AAER,QAAA,yBAAyB,GACpC,4CAA4C,CAAC;AAClC,QAAA,yBAAyB,GACpC,4CAA4C,CAAC;AAClC,QAAA,0BAA0B,GACrC,4CAA4C,CAAC;AAClC,QAAA,yBAAyB,GACpC,4CAA4C,CAAC;AAexC,MAAM,0BAA0B,GAAG,CAAC,KAAY,EAAW,EAAE;IAClE,QAAQ,KAAK,CAAC,EAAE,EAAE,CAAC;QACjB,KAAK,uBAAW,CAAC,EAAE,CAAC;QACpB,KAAK,2BAAe,CAAC,EAAE,CAAC;QACxB,KAAK,uBAAW,CAAC,EAAE,CAAC;QACpB,KAAK,gBAAI,CAAC,EAAE,CAAC;QACb,KAAK,uBAAW,CAAC,EAAE,CAAC;QACpB,KAAK,mBAAO,CAAC,EAAE,CAAC;QAChB,KAAK,0BAAc,CAAC,EAAE;YACpB,OAAO,iCAAyB,CAAC;QACnC,KAAK,mBAAO,CAAC,EAAE,CAAC;QAChB,KAAK,oBAAQ,CAAC,EAAE,CAAC;QACjB,KAAK,oBAAQ,CAAC,EAAE,CAAC;QACjB,KAAK,mBAAO,CAAC,EAAE,CAAC;QAChB,KAAK,gBAAI,CAAC,EAAE;YACV,OAAO,iCAAyB,CAAC;QACnC,KAAK,2BAAe,CAAC,EAAE;YACrB,OAAO,kCAA0B,CAAC;QACpC,KAAK,mBAAO,CAAC,EAAE,CAAC;QAChB,KAAK,yBAAa,CAAC,EAAE;YACnB,OAAO,iCAAyB,CAAC;QACnC;YACE,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC;AACH,CAAC,CAAC;AAxBW,QAAA,0BAA0B,8BAwBrC","sourcesContent":["import type { Address, Chain } from \"viem\";\nimport {\n arbitrum,\n arbitrumSepolia,\n base,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n mainnet,\n optimism,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n zora,\n zoraSepolia,\n} from \"./chains.js\";\n\nexport const AlchemyPaymasterAddressV3 =\n \"0x4f84a207A80c39E9e8BaE717c1F25bA7AD1fB08F\";\nexport const AlchemyPaymasterAddressV2 =\n \"0x4Fd9098af9ddcB41DA48A1d78F91F1398965addc\";\nexport const ArbSepoliaPaymasterAddress =\n \"0x0804Afe6EEFb73ce7F93CD0d5e7079a5a8068592\";\nexport const AlchemyPaymasterAddressV1 =\n \"0xc03aac639bb21233e0139381970328db8bceeb67\";\n\n/**\n * Retrieves the Alchemy paymaster address for the given chain. Returns different addresses based on the chain ID.\n *\n * @example\n * ```ts\n * import { sepolia, getAlchemyPaymasterAddress } from \"@account-kit/infra\";\n *\n * const paymasterAddress = getAlchemyPaymasterAddress(sepolia);\n * ```\n *\n * @param {Chain} chain The chain for which the paymaster address is required\n * @returns {Address} The Alchemy paymaster address corresponding to the specified chain\n */\nexport const getAlchemyPaymasterAddress = (chain: Chain): Address => {\n switch (chain.id) {\n case polygonAmoy.id:\n case optimismSepolia.id:\n case baseSepolia.id:\n case zora.id:\n case zoraSepolia.id:\n case fraxtal.id:\n case fraxtalSepolia.id:\n return AlchemyPaymasterAddressV3;\n case mainnet.id:\n case arbitrum.id:\n case optimism.id:\n case polygon.id:\n case base.id:\n return AlchemyPaymasterAddressV2;\n case arbitrumSepolia.id:\n return ArbSepoliaPaymasterAddress;\n case sepolia.id:\n case polygonMumbai.id:\n return AlchemyPaymasterAddressV1;\n default:\n throw new Error(`Unsupported chain: ${chain}`);\n }\n};\n"]}
@@ -1,25 +0,0 @@
1
- export type * from "./actions/simulateUserOperationChanges.js";
2
- export { simulateUserOperationChanges } from "./actions/simulateUserOperationChanges.js";
3
- export type * from "./actions/types.js";
4
- export type * from "./chains.js";
5
- export { arbitrum, arbitrumGoerli, arbitrumSepolia, base, baseGoerli, baseSepolia, defineAlchemyChain, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, zora, zoraSepolia, worldChain, worldChainSepolia, } from "./chains.js";
6
- export type * from "./client/decorators/alchemyEnhancedApis.js";
7
- export { alchemyEnhancedApiActions } from "./client/decorators/alchemyEnhancedApis.js";
8
- export type * from "./client/decorators/smartAccount.js";
9
- export { alchemyActions } from "./client/decorators/smartAccount.js";
10
- export { createAlchemySmartAccountClientFromRpcClient as createAlchemySmartAccountClientFromExisting } from "./client/internal/smartAccountClientFromRpc.js";
11
- export { isAlchemySmartAccountClient } from "./client/isAlchemySmartAccountClient.js";
12
- export type * from "./client/rpcClient.js";
13
- export { createAlchemyPublicRpcClient } from "./client/rpcClient.js";
14
- export type * from "./client/smartAccountClient.js";
15
- export { createAlchemySmartAccountClient } from "./client/smartAccountClient.js";
16
- export type * from "./client/types.js";
17
- export { getDefaultUserOperationFeeOptions } from "./defaults.js";
18
- export { getAlchemyPaymasterAddress } from "./gas-manager.js";
19
- export { alchemyFeeEstimator } from "./middleware/feeEstimator.js";
20
- export type * from "./middleware/gasManager.js";
21
- export { alchemyGasManagerMiddleware } from "./middleware/gasManager.js";
22
- export { alchemyUserOperationSimulator } from "./middleware/userOperationSimulator.js";
23
- export type * from "./schema.js";
24
- export { AlchemyProviderConfigSchema } from "./schema.js";
25
- export type { AlchemyProviderConfig } from "./type.js";
package/dist/cjs/index.js DELETED
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AlchemyProviderConfigSchema = exports.alchemyUserOperationSimulator = exports.alchemyGasManagerMiddleware = exports.alchemyFeeEstimator = exports.getAlchemyPaymasterAddress = exports.getDefaultUserOperationFeeOptions = exports.createAlchemySmartAccountClient = exports.createAlchemyPublicRpcClient = exports.isAlchemySmartAccountClient = exports.createAlchemySmartAccountClientFromExisting = exports.alchemyActions = exports.alchemyEnhancedApiActions = exports.worldChainSepolia = exports.worldChain = exports.zoraSepolia = exports.zora = exports.sepolia = exports.polygonMumbai = exports.polygonAmoy = exports.polygon = exports.optimismSepolia = exports.optimismGoerli = exports.optimism = exports.mainnet = exports.goerli = exports.fraxtalSepolia = exports.fraxtal = exports.defineAlchemyChain = exports.baseSepolia = exports.baseGoerli = exports.base = exports.arbitrumSepolia = exports.arbitrumGoerli = exports.arbitrum = exports.simulateUserOperationChanges = void 0;
4
- var simulateUserOperationChanges_js_1 = require("./actions/simulateUserOperationChanges.js");
5
- Object.defineProperty(exports, "simulateUserOperationChanges", { enumerable: true, get: function () { return simulateUserOperationChanges_js_1.simulateUserOperationChanges; } });
6
- var chains_js_1 = require("./chains.js");
7
- Object.defineProperty(exports, "arbitrum", { enumerable: true, get: function () { return chains_js_1.arbitrum; } });
8
- Object.defineProperty(exports, "arbitrumGoerli", { enumerable: true, get: function () { return chains_js_1.arbitrumGoerli; } });
9
- Object.defineProperty(exports, "arbitrumSepolia", { enumerable: true, get: function () { return chains_js_1.arbitrumSepolia; } });
10
- Object.defineProperty(exports, "base", { enumerable: true, get: function () { return chains_js_1.base; } });
11
- Object.defineProperty(exports, "baseGoerli", { enumerable: true, get: function () { return chains_js_1.baseGoerli; } });
12
- Object.defineProperty(exports, "baseSepolia", { enumerable: true, get: function () { return chains_js_1.baseSepolia; } });
13
- Object.defineProperty(exports, "defineAlchemyChain", { enumerable: true, get: function () { return chains_js_1.defineAlchemyChain; } });
14
- Object.defineProperty(exports, "fraxtal", { enumerable: true, get: function () { return chains_js_1.fraxtal; } });
15
- Object.defineProperty(exports, "fraxtalSepolia", { enumerable: true, get: function () { return chains_js_1.fraxtalSepolia; } });
16
- Object.defineProperty(exports, "goerli", { enumerable: true, get: function () { return chains_js_1.goerli; } });
17
- Object.defineProperty(exports, "mainnet", { enumerable: true, get: function () { return chains_js_1.mainnet; } });
18
- Object.defineProperty(exports, "optimism", { enumerable: true, get: function () { return chains_js_1.optimism; } });
19
- Object.defineProperty(exports, "optimismGoerli", { enumerable: true, get: function () { return chains_js_1.optimismGoerli; } });
20
- Object.defineProperty(exports, "optimismSepolia", { enumerable: true, get: function () { return chains_js_1.optimismSepolia; } });
21
- Object.defineProperty(exports, "polygon", { enumerable: true, get: function () { return chains_js_1.polygon; } });
22
- Object.defineProperty(exports, "polygonAmoy", { enumerable: true, get: function () { return chains_js_1.polygonAmoy; } });
23
- Object.defineProperty(exports, "polygonMumbai", { enumerable: true, get: function () { return chains_js_1.polygonMumbai; } });
24
- Object.defineProperty(exports, "sepolia", { enumerable: true, get: function () { return chains_js_1.sepolia; } });
25
- Object.defineProperty(exports, "zora", { enumerable: true, get: function () { return chains_js_1.zora; } });
26
- Object.defineProperty(exports, "zoraSepolia", { enumerable: true, get: function () { return chains_js_1.zoraSepolia; } });
27
- Object.defineProperty(exports, "worldChain", { enumerable: true, get: function () { return chains_js_1.worldChain; } });
28
- Object.defineProperty(exports, "worldChainSepolia", { enumerable: true, get: function () { return chains_js_1.worldChainSepolia; } });
29
- var alchemyEnhancedApis_js_1 = require("./client/decorators/alchemyEnhancedApis.js");
30
- Object.defineProperty(exports, "alchemyEnhancedApiActions", { enumerable: true, get: function () { return alchemyEnhancedApis_js_1.alchemyEnhancedApiActions; } });
31
- var smartAccount_js_1 = require("./client/decorators/smartAccount.js");
32
- Object.defineProperty(exports, "alchemyActions", { enumerable: true, get: function () { return smartAccount_js_1.alchemyActions; } });
33
- var smartAccountClientFromRpc_js_1 = require("./client/internal/smartAccountClientFromRpc.js");
34
- Object.defineProperty(exports, "createAlchemySmartAccountClientFromExisting", { enumerable: true, get: function () { return smartAccountClientFromRpc_js_1.createAlchemySmartAccountClientFromRpcClient; } });
35
- var isAlchemySmartAccountClient_js_1 = require("./client/isAlchemySmartAccountClient.js");
36
- Object.defineProperty(exports, "isAlchemySmartAccountClient", { enumerable: true, get: function () { return isAlchemySmartAccountClient_js_1.isAlchemySmartAccountClient; } });
37
- var rpcClient_js_1 = require("./client/rpcClient.js");
38
- Object.defineProperty(exports, "createAlchemyPublicRpcClient", { enumerable: true, get: function () { return rpcClient_js_1.createAlchemyPublicRpcClient; } });
39
- var smartAccountClient_js_1 = require("./client/smartAccountClient.js");
40
- Object.defineProperty(exports, "createAlchemySmartAccountClient", { enumerable: true, get: function () { return smartAccountClient_js_1.createAlchemySmartAccountClient; } });
41
- var defaults_js_1 = require("./defaults.js");
42
- Object.defineProperty(exports, "getDefaultUserOperationFeeOptions", { enumerable: true, get: function () { return defaults_js_1.getDefaultUserOperationFeeOptions; } });
43
- var gas_manager_js_1 = require("./gas-manager.js");
44
- Object.defineProperty(exports, "getAlchemyPaymasterAddress", { enumerable: true, get: function () { return gas_manager_js_1.getAlchemyPaymasterAddress; } });
45
- var feeEstimator_js_1 = require("./middleware/feeEstimator.js");
46
- Object.defineProperty(exports, "alchemyFeeEstimator", { enumerable: true, get: function () { return feeEstimator_js_1.alchemyFeeEstimator; } });
47
- var gasManager_js_1 = require("./middleware/gasManager.js");
48
- Object.defineProperty(exports, "alchemyGasManagerMiddleware", { enumerable: true, get: function () { return gasManager_js_1.alchemyGasManagerMiddleware; } });
49
- var userOperationSimulator_js_1 = require("./middleware/userOperationSimulator.js");
50
- Object.defineProperty(exports, "alchemyUserOperationSimulator", { enumerable: true, get: function () { return userOperationSimulator_js_1.alchemyUserOperationSimulator; } });
51
- var schema_js_1 = require("./schema.js");
52
- Object.defineProperty(exports, "AlchemyProviderConfigSchema", { enumerable: true, get: function () { return schema_js_1.AlchemyProviderConfigSchema; } });
53
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AACA,6FAAyF;AAAhF,+IAAA,4BAA4B,OAAA;AAGrC,yCAuBqB;AAtBnB,qGAAA,QAAQ,OAAA;AACR,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AACf,iGAAA,IAAI,OAAA;AACJ,uGAAA,UAAU,OAAA;AACV,wGAAA,WAAW,OAAA;AACX,+GAAA,kBAAkB,OAAA;AAClB,oGAAA,OAAO,OAAA;AACP,2GAAA,cAAc,OAAA;AACd,mGAAA,MAAM,OAAA;AACN,oGAAA,OAAO,OAAA;AACP,qGAAA,QAAQ,OAAA;AACR,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AACf,oGAAA,OAAO,OAAA;AACP,wGAAA,WAAW,OAAA;AACX,0GAAA,aAAa,OAAA;AACb,oGAAA,OAAO,OAAA;AACP,iGAAA,IAAI,OAAA;AACJ,wGAAA,WAAW,OAAA;AACX,uGAAA,UAAU,OAAA;AACV,8GAAA,iBAAiB,OAAA;AAGnB,qFAAuF;AAA9E,mIAAA,yBAAyB,OAAA;AAElC,uEAAqE;AAA5D,iHAAA,cAAc,OAAA;AACvB,+FAA6J;AAApJ,2JAAA,4CAA4C,OAA+C;AACpG,0FAAsF;AAA7E,6IAAA,2BAA2B,OAAA;AAEpC,sDAAqE;AAA5D,4HAAA,4BAA4B,OAAA;AAErC,wEAAiF;AAAxE,wIAAA,+BAA+B,OAAA;AAExC,6CAAkE;AAAzD,gIAAA,iCAAiC,OAAA;AAC1C,mDAA8D;AAArD,4HAAA,0BAA0B,OAAA;AACnC,gEAAmE;AAA1D,sHAAA,mBAAmB,OAAA;AAE5B,4DAAyE;AAAhE,4HAAA,2BAA2B,OAAA;AACpC,oFAAuF;AAA9E,0IAAA,6BAA6B,OAAA;AAEtC,yCAA0D;AAAjD,wHAAA,2BAA2B,OAAA","sourcesContent":["export type * from \"./actions/simulateUserOperationChanges.js\";\nexport { simulateUserOperationChanges } from \"./actions/simulateUserOperationChanges.js\";\nexport type * from \"./actions/types.js\";\nexport type * from \"./chains.js\";\nexport {\n arbitrum,\n arbitrumGoerli,\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 zora,\n zoraSepolia,\n worldChain,\n worldChainSepolia,\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 { createAlchemySmartAccountClientFromRpcClient as createAlchemySmartAccountClientFromExisting } from \"./client/internal/smartAccountClientFromRpc.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 { alchemyGasManagerMiddleware } from \"./middleware/gasManager.js\";\nexport { alchemyUserOperationSimulator } from \"./middleware/userOperationSimulator.js\";\nexport type * from \"./schema.js\";\nexport { AlchemyProviderConfigSchema } from \"./schema.js\";\nexport type { AlchemyProviderConfig } from \"./type.js\";\n"]}
@@ -1,3 +0,0 @@
1
- import type { ClientMiddlewareFn } from "@aa-sdk/core";
2
- import type { ClientWithAlchemyMethods } from "../client/types";
3
- export declare const alchemyFeeEstimator: <C extends ClientWithAlchemyMethods>(client: C) => ClientMiddlewareFn;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.alchemyFeeEstimator = void 0;
4
- const core_1 = require("@aa-sdk/core");
5
- const alchemyFeeEstimator = (client) => async (struct, { overrides, feeOptions }) => {
6
- let [block, maxPriorityFeePerGasEstimate] = await Promise.all([
7
- client.getBlock({ blockTag: "latest" }),
8
- client.request({
9
- method: "rundler_maxPriorityFeePerGas",
10
- params: [],
11
- }),
12
- ]);
13
- const baseFeePerGas = block.baseFeePerGas;
14
- if (baseFeePerGas == null) {
15
- throw new Error("baseFeePerGas is null");
16
- }
17
- const maxPriorityFeePerGas = (0, core_1.applyUserOpOverrideOrFeeOption)(maxPriorityFeePerGasEstimate, overrides?.maxPriorityFeePerGas, feeOptions?.maxPriorityFeePerGas);
18
- const maxFeePerGas = (0, core_1.applyUserOpOverrideOrFeeOption)(baseFeePerGas + BigInt(maxPriorityFeePerGas), overrides?.maxFeePerGas, feeOptions?.maxFeePerGas);
19
- return {
20
- ...struct,
21
- maxPriorityFeePerGas,
22
- maxFeePerGas,
23
- };
24
- };
25
- exports.alchemyFeeEstimator = alchemyFeeEstimator;
26
- //# sourceMappingURL=feeEstimator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"feeEstimator.js","sourceRoot":"","sources":["../../../src/middleware/feeEstimator.ts"],"names":[],"mappings":";;;AACA,uCAA8D;AAsBvD,MAAM,mBAAmB,GAG9B,CAAC,MAAM,EAAE,EAAE,CACX,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE;IAC1C,IAAI,CAAC,KAAK,EAAE,4BAA4B,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC5D,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;QAEvC,MAAM,CAAC,OAAO,CAAC;YACb,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,IAAA,qCAA8B,EACzD,4BAA4B,EAC5B,SAAS,EAAE,oBAAoB,EAC/B,UAAU,EAAE,oBAAoB,CACjC,CAAC;IACF,MAAM,YAAY,GAAG,IAAA,qCAA8B,EACjD,aAAa,GAAG,MAAM,CAAC,oBAAoB,CAAC,EAC5C,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,YAAY,CACzB,CAAC;IAEF,OAAO;QACL,GAAG,MAAM;QACT,oBAAoB;QACpB,YAAY;KACb,CAAC;AACJ,CAAC,CAAC;AAnCS,QAAA,mBAAmB,uBAmC5B","sourcesContent":["import type { ClientMiddlewareFn } from \"@aa-sdk/core\";\nimport { applyUserOpOverrideOrFeeOption } from \"@aa-sdk/core\";\nimport type { ClientWithAlchemyMethods } from \"../client/types\";\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, createAlchemyPublicRpcClient } from \"@account-kit/infra\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createAlchemyPublicRpcClient(...);\n * const client = createSmartAccountClient({\n * feeEstimator: alchemyFeeEstimator(bundlerClient),\n * ...otherParams\n * });\n * ```\n *\n * @param {ClientWithAlchemyMethods} client The client with Alchemy methods\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: <C extends ClientWithAlchemyMethods>(\n client: C\n) => ClientMiddlewareFn =\n (client) =>\n async (struct, { overrides, feeOptions }) => {\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 client.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 baseFeePerGas + BigInt(maxPriorityFeePerGas),\n overrides?.maxFeePerGas,\n feeOptions?.maxFeePerGas\n );\n\n return {\n ...struct,\n maxPriorityFeePerGas,\n maxFeePerGas,\n };\n };\n"]}
@@ -1,2 +0,0 @@
1
- import type { ClientMiddlewareConfig } from "@aa-sdk/core";
2
- export declare function alchemyGasManagerMiddleware(policyId: string): Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "paymasterAndData">;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.alchemyGasManagerMiddleware = void 0;
4
- const core_1 = require("@aa-sdk/core");
5
- function alchemyGasManagerMiddleware(policyId) {
6
- return (0, core_1.erc7677Middleware)({
7
- context: { policyId: policyId },
8
- });
9
- }
10
- exports.alchemyGasManagerMiddleware = alchemyGasManagerMiddleware;
11
- //# sourceMappingURL=gasManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gasManager.js","sourceRoot":"","sources":["../../../src/middleware/gasManager.ts"],"names":[],"mappings":";;;AACA,uCAAiD;AAqBjD,SAAgB,2BAA2B,CACzC,QAAgB;IAEhB,OAAO,IAAA,wBAAiB,EAAuB;QAC7C,OAAO,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;KAChC,CAAC,CAAC;AACL,CAAC;AAND,kEAMC","sourcesContent":["import type { ClientMiddlewareConfig } from \"@aa-sdk/core\";\nimport { erc7677Middleware } from \"@aa-sdk/core\";\n\n/**\n * Paymaster middleware factory that uses Alchemy's Gas Manager for sponsoring transactions.\n *\n * @example\n * ```ts\n *\n * import { sepolia } from \"@account-kit/infra\";\n * import { http } from \"viem\";\n *\n * const client = createSmartAccountClient({\n * http(\"rpc-url\"),\n * sepolia,\n * alchemyErc7677Middleware(\"policyId\")\n * );\n * ```\n *\n * @param {string} policyId the policyId 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\n): Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\"> {\n return erc7677Middleware<{ policyId: string }>({\n context: { policyId: policyId },\n });\n}\n"]}
@@ -1,3 +0,0 @@
1
- import { type ClientMiddlewareFn, type UserOperationContext } from "@aa-sdk/core";
2
- import type { ClientWithAlchemyMethods } from "../client/types";
3
- export declare function alchemyUserOperationSimulator<C extends ClientWithAlchemyMethods, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(client: C): ClientMiddlewareFn<TContext>;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.alchemyUserOperationSimulator = void 0;
4
- const core_1 = require("@aa-sdk/core");
5
- function alchemyUserOperationSimulator(client) {
6
- return async (struct, { account }) => {
7
- const uoSimResult = await client.request({
8
- method: "alchemy_simulateUserOperationAssetChanges",
9
- params: [
10
- (0, core_1.deepHexlify)(await (0, core_1.resolveProperties)(struct)),
11
- account.getEntryPoint().address,
12
- ],
13
- });
14
- if (uoSimResult.error) {
15
- throw new Error(uoSimResult.error.message);
16
- }
17
- return struct;
18
- };
19
- }
20
- exports.alchemyUserOperationSimulator = alchemyUserOperationSimulator;
21
- //# sourceMappingURL=userOperationSimulator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"userOperationSimulator.js","sourceRoot":"","sources":["../../../src/middleware/userOperationSimulator.ts"],"names":[],"mappings":";;;AAAA,uCAKsB;AAsBtB,SAAgB,6BAA6B,CAK3C,MAAS;IACT,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACnC,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;YACvC,MAAM,EAAE,2CAA2C;YACnD,MAAM,EAAE;gBACN,IAAA,kBAAW,EAAC,MAAM,IAAA,wBAAiB,EAAC,MAAM,CAAC,CAAC;gBAC5C,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO;aAChC;SACF,CAAC,CAAC;QAEH,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AArBD,sEAqBC","sourcesContent":["import {\n deepHexlify,\n resolveProperties,\n type ClientMiddlewareFn,\n type UserOperationContext,\n} from \"@aa-sdk/core\";\nimport type { ClientWithAlchemyMethods } from \"../client/types\";\n\n/**\n * A middleware function to be used during simulation of user operations which leverages Alchemy's RPC uo simulation method.\n *\n * @example\n * ```ts\n * import { alchemyUserOperationSimulator, createAlchemyPublicRpcClient } from \"@account-kit/infra\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createAlchemyPublicRpcClient(...);\n * const client = createSmartAccountClient({\n * userOperationSimulator: alchemyUserOperationSimulator(bundlerClient),\n * ...otherParams\n * });\n * ```\n *\n * @template C The client object with Alchemy methods\n * @param {C} client The client object with Alchemy methods\n * @returns {ClientMiddlewareFn} A middleware function to simulate and process user operations\n */\nexport function alchemyUserOperationSimulator<\n C extends ClientWithAlchemyMethods,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(client: C): ClientMiddlewareFn<TContext> {\n return async (struct, { account }) => {\n const uoSimResult = await client.request({\n method: \"alchemy_simulateUserOperationAssetChanges\",\n params: [\n deepHexlify(await resolveProperties(struct)),\n account.getEntryPoint().address,\n ],\n });\n\n if (uoSimResult.error) {\n throw new Error(uoSimResult.error.message);\n }\n\n return struct;\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"type":"commonjs"}