@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.
- package/dist/esm/actions/simulateUserOperationChanges.d.ts +17 -0
- package/dist/esm/actions/simulateUserOperationChanges.js +17 -0
- package/dist/esm/actions/simulateUserOperationChanges.js.map +1 -1
- package/dist/esm/actions/types.d.ts +4 -0
- package/dist/esm/actions/types.js +4 -0
- package/dist/esm/actions/types.js.map +1 -1
- package/dist/esm/chains.d.ts +22 -0
- package/dist/esm/chains.js +60 -1
- package/dist/esm/chains.js.map +1 -1
- package/dist/esm/client/decorators/alchemyEnhancedApis.d.ts +18 -5393
- package/dist/esm/client/decorators/alchemyEnhancedApis.js +37 -18
- package/dist/esm/client/decorators/alchemyEnhancedApis.js.map +1 -1
- package/dist/esm/client/decorators/smartAccount.d.ts +15 -0
- package/dist/esm/client/decorators/smartAccount.js +15 -0
- package/dist/esm/client/decorators/smartAccount.js.map +1 -1
- package/dist/esm/client/internal/smartAccountClientFromRpc.d.ts +7 -0
- package/dist/esm/client/internal/smartAccountClientFromRpc.js +17 -0
- package/dist/esm/client/internal/smartAccountClientFromRpc.js.map +1 -1
- package/dist/esm/client/isAlchemySmartAccountClient.d.ts +17 -5393
- package/dist/esm/client/isAlchemySmartAccountClient.js +21 -2
- package/dist/esm/client/isAlchemySmartAccountClient.js.map +1 -1
- package/dist/esm/client/rpcClient.d.ts +22 -0
- package/dist/esm/client/rpcClient.js +22 -0
- package/dist/esm/client/rpcClient.js.map +1 -1
- package/dist/esm/client/smartAccountClient.js +17 -0
- package/dist/esm/client/smartAccountClient.js.map +1 -1
- package/dist/esm/defaults.d.ts +14 -0
- package/dist/esm/defaults.js +14 -0
- package/dist/esm/defaults.js.map +1 -1
- package/dist/esm/errors/base.js +1 -0
- package/dist/esm/errors/base.js.map +1 -1
- package/dist/esm/gas-manager.d.ts +13 -0
- package/dist/esm/gas-manager.js +13 -0
- package/dist/esm/gas-manager.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/middleware/feeEstimator.d.ts +19 -0
- package/dist/esm/middleware/feeEstimator.js +20 -0
- package/dist/esm/middleware/feeEstimator.js.map +1 -1
- package/dist/esm/middleware/gasManager.d.ts +19 -0
- package/dist/esm/middleware/gasManager.js +19 -0
- package/dist/esm/middleware/gasManager.js.map +1 -1
- package/dist/esm/middleware/userOperationSimulator.d.ts +19 -0
- package/dist/esm/middleware/userOperationSimulator.js +19 -0
- package/dist/esm/middleware/userOperationSimulator.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +3 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/chains.d.ts +3 -0
- package/dist/types/chains.d.ts.map +1 -1
- package/dist/types/client/decorators/alchemyEnhancedApis.d.ts +1 -5393
- package/dist/types/client/decorators/alchemyEnhancedApis.d.ts.map +1 -1
- package/dist/types/client/isAlchemySmartAccountClient.d.ts +2 -5393
- package/dist/types/client/isAlchemySmartAccountClient.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +13 -14
- package/src/chains.ts +44 -0
- package/src/client/decorators/alchemyEnhancedApis.ts +13 -11
- package/src/client/isAlchemySmartAccountClient.ts +3 -3
- package/src/index.ts +3 -0
- package/src/version.ts +1 -1
- package/dist/cjs/actions/simulateUserOperationChanges.d.ts +0 -5
- package/dist/cjs/actions/simulateUserOperationChanges.js +0 -24
- package/dist/cjs/actions/simulateUserOperationChanges.js.map +0 -1
- package/dist/cjs/actions/types.d.ts +0 -39
- package/dist/cjs/actions/types.js +0 -17
- package/dist/cjs/actions/types.js.map +0 -1
- package/dist/cjs/chains.d.ts +0 -30
- package/dist/cjs/chains.js +0 -215
- package/dist/cjs/chains.js.map +0 -1
- package/dist/cjs/client/decorators/alchemyEnhancedApis.d.ts +0 -5406
- package/dist/cjs/client/decorators/alchemyEnhancedApis.js +0 -26
- package/dist/cjs/client/decorators/alchemyEnhancedApis.js.map +0 -1
- package/dist/cjs/client/decorators/smartAccount.d.ts +0 -7
- package/dist/cjs/client/decorators/smartAccount.js +0 -9
- package/dist/cjs/client/decorators/smartAccount.js.map +0 -1
- package/dist/cjs/client/internal/smartAccountClientFromRpc.d.ts +0 -11
- package/dist/cjs/client/internal/smartAccountClientFromRpc.js +0 -44
- package/dist/cjs/client/internal/smartAccountClientFromRpc.js.map +0 -1
- package/dist/cjs/client/isAlchemySmartAccountClient.d.ts +0 -5395
- package/dist/cjs/client/isAlchemySmartAccountClient.js +0 -9
- package/dist/cjs/client/isAlchemySmartAccountClient.js.map +0 -1
- package/dist/cjs/client/rpcClient.d.ts +0 -8
- package/dist/cjs/client/rpcClient.js +0 -36
- package/dist/cjs/client/rpcClient.js.map +0 -1
- package/dist/cjs/client/smartAccountClient.d.ts +0 -17
- package/dist/cjs/client/smartAccountClient.js +0 -32
- package/dist/cjs/client/smartAccountClient.js.map +0 -1
- package/dist/cjs/client/types.d.ts +0 -29
- package/dist/cjs/client/types.js +0 -3
- package/dist/cjs/client/types.js.map +0 -1
- package/dist/cjs/defaults.d.ts +0 -3
- package/dist/cjs/defaults.js +0 -23
- package/dist/cjs/defaults.js.map +0 -1
- package/dist/cjs/errors/base.d.ts +0 -4
- package/dist/cjs/errors/base.js +0 -18
- package/dist/cjs/errors/base.js.map +0 -1
- package/dist/cjs/errors/rpcUrl.d.ts +0 -10
- package/dist/cjs/errors/rpcUrl.js +0 -26
- package/dist/cjs/errors/rpcUrl.js.map +0 -1
- package/dist/cjs/gas-manager.d.ts +0 -6
- package/dist/cjs/gas-manager.js +0 -35
- package/dist/cjs/gas-manager.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -25
- package/dist/cjs/index.js +0 -53
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/middleware/feeEstimator.d.ts +0 -3
- package/dist/cjs/middleware/feeEstimator.js +0 -26
- package/dist/cjs/middleware/feeEstimator.js.map +0 -1
- package/dist/cjs/middleware/gasManager.d.ts +0 -2
- package/dist/cjs/middleware/gasManager.js +0 -11
- package/dist/cjs/middleware/gasManager.js.map +0 -1
- package/dist/cjs/middleware/userOperationSimulator.d.ts +0 -3
- package/dist/cjs/middleware/userOperationSimulator.js +0 -21
- package/dist/cjs/middleware/userOperationSimulator.js.map +0 -1
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/schema.d.ts +0 -396
- package/dist/cjs/schema.js +0 -19
- package/dist/cjs/schema.js.map +0 -1
- package/dist/cjs/type.d.ts +0 -3
- package/dist/cjs/type.js +0 -3
- package/dist/cjs/type.js.map +0 -1
- package/dist/cjs/version.d.ts +0 -1
- package/dist/cjs/version.js +0 -5
- package/dist/cjs/version.js.map +0 -1
- package/dist/esm/package.json +0 -1
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import { isSmartAccountClient } from "@aa-sdk/core";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* 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.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { isAlchemySmartAccountClient } from "@account-kit/infra";
|
|
8
|
+
*
|
|
9
|
+
* if (isAlchemySmartAccountClient(client)) {
|
|
10
|
+
* // do things with the client as an Alchemy Smart Account Client
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @param {Client<TTransport, TChain, TAccount>} client The client instance to be checked
|
|
15
|
+
* @returns {boolean} `true` if the client is an Alchemy Smart Account Client, otherwise `false`
|
|
16
|
+
*/
|
|
17
|
+
export function isAlchemySmartAccountClient(client) {
|
|
18
|
+
// TODO: the goal of this check is to make sure that the client supports certain RPC methods
|
|
19
|
+
// we should probably do this by checking the client's transport and configured URL, since alchemy
|
|
20
|
+
// clients have to be RPC clients. this is difficult to do though because the transport might
|
|
21
|
+
// point to a proxy url :/
|
|
3
22
|
return isSmartAccountClient(client);
|
|
4
|
-
}
|
|
23
|
+
}
|
|
5
24
|
//# sourceMappingURL=isAlchemySmartAccountClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isAlchemySmartAccountClient.js","sourceRoot":"","sources":["../../../src/client/isAlchemySmartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA6B,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"isAlchemySmartAccountClient.js","sourceRoot":"","sources":["../../../src/client/isAlchemySmartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA6B,MAAM,cAAc,CAAC;AAI/E;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,2BAA2B,CAOzC,MAA4C;IAE5C,4FAA4F;IAC5F,kGAAkG;IAClG,6FAA6F;IAC7F,0BAA0B;IAC1B,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC","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 function 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,6 +1,28 @@
|
|
|
1
1
|
import { type ConnectionConfig, type NoUndefined } from "@aa-sdk/core";
|
|
2
2
|
import { type Chain, type HttpTransportConfig } from "viem";
|
|
3
3
|
import type { ClientWithAlchemyMethods } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* 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.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createAlchemyPublicRpcClient } from "@account-kit/infra";
|
|
10
|
+
* import { sepolia } from "@account-kit/infra";
|
|
11
|
+
*
|
|
12
|
+
* const client = createAlchemyPublicRpcClient({
|
|
13
|
+
* chain: sepolia,
|
|
14
|
+
* connectionConfig: {
|
|
15
|
+
* apiKey: "your-api-key",
|
|
16
|
+
* }
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @param {{connectionConfig: ConnectionConfig,chain: Chain,fetchOptions?: NoUndefined<HttpTransportConfig["fetchOptions"]>}} params The parameters for creating the Alchemy public RPC client
|
|
21
|
+
* @param {ConnectionConfig} params.connectionConfig The connection configuration containing the RPC URL and API key
|
|
22
|
+
* @param {Chain} params.chain The blockchain chain configuration
|
|
23
|
+
* @param {NoUndefined<HttpTransportConfig["fetchOptions"]>} [params.fetchOptions] Optional fetch configuration for HTTP transport
|
|
24
|
+
* @returns {ClientWithAlchemyMethods} A client object tailored with Alchemy methods and capabilities to interact with the blockchain
|
|
25
|
+
*/
|
|
4
26
|
export declare const createAlchemyPublicRpcClient: ({ chain: chain_, connectionConfig, fetchOptions, }: {
|
|
5
27
|
connectionConfig: ConnectionConfig;
|
|
6
28
|
chain: Chain;
|
|
@@ -2,6 +2,28 @@ import { createBundlerClient, } from "@aa-sdk/core";
|
|
|
2
2
|
import { http } from "viem";
|
|
3
3
|
import { AlchemyChainSchema } from "../schema.js";
|
|
4
4
|
import { VERSION } from "../version.js";
|
|
5
|
+
/**
|
|
6
|
+
* 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.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { createAlchemyPublicRpcClient } from "@account-kit/infra";
|
|
11
|
+
* import { sepolia } from "@account-kit/infra";
|
|
12
|
+
*
|
|
13
|
+
* const client = createAlchemyPublicRpcClient({
|
|
14
|
+
* chain: sepolia,
|
|
15
|
+
* connectionConfig: {
|
|
16
|
+
* apiKey: "your-api-key",
|
|
17
|
+
* }
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param {{connectionConfig: ConnectionConfig,chain: Chain,fetchOptions?: NoUndefined<HttpTransportConfig["fetchOptions"]>}} params The parameters for creating the Alchemy public RPC client
|
|
22
|
+
* @param {ConnectionConfig} params.connectionConfig The connection configuration containing the RPC URL and API key
|
|
23
|
+
* @param {Chain} params.chain The blockchain chain configuration
|
|
24
|
+
* @param {NoUndefined<HttpTransportConfig["fetchOptions"]>} [params.fetchOptions] Optional fetch configuration for HTTP transport
|
|
25
|
+
* @returns {ClientWithAlchemyMethods} A client object tailored with Alchemy methods and capabilities to interact with the blockchain
|
|
26
|
+
*/
|
|
5
27
|
export const createAlchemyPublicRpcClient = ({ chain: chain_, connectionConfig, fetchOptions = {}, }) => {
|
|
6
28
|
const chain = AlchemyChainSchema.parse(chain_);
|
|
7
29
|
const rpcUrl = connectionConfig.rpcUrl == null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpcClient.js","sourceRoot":"","sources":["../../../src/client/rpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,GAGpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,IAAI,EAAwC,MAAM,MAAM,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"rpcClient.js","sourceRoot":"","sources":["../../../src/client/rpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,GAGpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,IAAI,EAAwC,MAAM,MAAM,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAC3C,KAAK,EAAE,MAAM,EACb,gBAAgB,EAChB,YAAY,GAAG,EAAE,GAKlB,EAA4B,EAAE;IAC7B,MAAM,KAAK,GAAG,kBAAkB,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,OAAO;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,mBAAmB,CAAC;QACzB,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,IAAI,CAAC,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","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"]}
|
|
@@ -4,6 +4,23 @@ import { getDefaultUserOperationFeeOptions } from "../defaults.js";
|
|
|
4
4
|
import { AlchemyProviderConfigSchema } from "../schema.js";
|
|
5
5
|
import { createAlchemySmartAccountClientFromRpcClient } from "./internal/smartAccountClientFromRpc.js";
|
|
6
6
|
import { createAlchemyPublicRpcClient } from "./rpcClient.js";
|
|
7
|
+
/**
|
|
8
|
+
* Creates an Alchemy smart account client using the provided configuration options, including account details, gas manager configuration, and custom middleware.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { createAlchemySmartAccountClient } from "@account-kit/infra";
|
|
13
|
+
* import { sepolia } from "@account-kit/infra/chain";
|
|
14
|
+
*
|
|
15
|
+
* const client = createAlchemySmartAccountClient({
|
|
16
|
+
* chain: sepolia,
|
|
17
|
+
* apiKey: "your-api-key",
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param {AlchemySmartAccountClientConfig} config The configuration for creating the Alchemy smart account client
|
|
22
|
+
* @returns {AlchemySmartAccountClient} An instance of `AlchemySmartAccountClient` configured based on the provided options
|
|
23
|
+
*/
|
|
7
24
|
export function createAlchemySmartAccountClient({ account, policyId, useSimulation, feeEstimator, customMiddleware, gasEstimator, signUserOperation, ...config_ }) {
|
|
8
25
|
const config = AlchemyProviderConfigSchema.parse(config_);
|
|
9
26
|
const { chain, opts, ...connectionConfig } = config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../src/client/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAQN,MAAM,cAAc,CAAC;AACtB,OAAO,EAA8B,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAG3D,OAAO,EAAE,4CAA4C,EAAE,MAAM,yCAAyC,CAAC;AACvG,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../src/client/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAQN,MAAM,cAAc,CAAC;AACtB,OAAO,EAA8B,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAG3D,OAAO,EAAE,4CAA4C,EAAE,MAAM,yCAAyC,CAAC;AACvG,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAqG9D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,+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,2BAA2B,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GAAG,MAAM,CAAC;IAEpD,MAAM,MAAM,GAAG,4BAA4B,CAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,UAAU,GACd,IAAI,EAAE,UAAU,IAAI,iCAAiC,CAAC,KAAK,CAAC,CAAC;IAE/D,OAAO,4CAA4C,CAAC;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","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"]}
|
package/dist/esm/defaults.d.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
import { type UserOperationFeeOptions } from "@aa-sdk/core";
|
|
2
2
|
import type { Chain } from "viem";
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves the default user operation fee options for a given chain. Adjusts fees for specific chains like Arbitrum and Optimism.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { getDefaultUserOperationFeeOptions } from "@account-kit/infra";
|
|
9
|
+
* import { arbitrum } from "@account-kit/infra";
|
|
10
|
+
*
|
|
11
|
+
* const feeOpts = getDefaultUserOperationFeeOptions(arbitrum);
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @param {Chain} chain The blockchain chain for which to get the fee options
|
|
15
|
+
* @returns {UserOperationFeeOptions} An object containing the default fee options for user operations on the specified chain
|
|
16
|
+
*/
|
|
3
17
|
export declare const getDefaultUserOperationFeeOptions: (chain: Chain) => UserOperationFeeOptions;
|
package/dist/esm/defaults.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import {} from "@aa-sdk/core";
|
|
2
2
|
import { arbitrum, arbitrumGoerli, arbitrumSepolia, optimism, optimismGoerli, optimismSepolia, } from "./chains.js";
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves the default user operation fee options for a given chain. Adjusts fees for specific chains like Arbitrum and Optimism.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { getDefaultUserOperationFeeOptions } from "@account-kit/infra";
|
|
9
|
+
* import { arbitrum } from "@account-kit/infra";
|
|
10
|
+
*
|
|
11
|
+
* const feeOpts = getDefaultUserOperationFeeOptions(arbitrum);
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @param {Chain} chain The blockchain chain for which to get the fee options
|
|
15
|
+
* @returns {UserOperationFeeOptions} An object containing the default fee options for user operations on the specified chain
|
|
16
|
+
*/
|
|
3
17
|
export const getDefaultUserOperationFeeOptions = (chain) => {
|
|
4
18
|
const feeOptions = {
|
|
5
19
|
maxFeePerGas: { multiplier: 1.5 },
|
package/dist/esm/defaults.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,MAAM,cAAc,CAAC;AAE5D,OAAO,EACL,QAAQ,EACR,cAAc,EACd,eAAe,EACf,QAAQ,EACR,cAAc,EACd,eAAe,GAChB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,MAAM,cAAc,CAAC;AAE5D,OAAO,EACL,QAAQ,EACR,cAAc,EACd,eAAe,EACf,QAAQ,EACR,cAAc,EACd,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,KAAY,EACa,EAAE;IAC3B,MAAM,UAAU,GAA4B;QAC1C,YAAY,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE;QACjC,oBAAoB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;KAC3C,CAAC;IAEF,IACE,IAAI,GAAG,CAAS;QACd,QAAQ,CAAC,EAAE;QACX,cAAc,CAAC,EAAE;QACjB,eAAe,CAAC,EAAE;QAClB,QAAQ,CAAC,EAAE;QACX,cAAc,CAAC,EAAE;QACjB,eAAe,CAAC,EAAE;KACnB,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAChB,CAAC;QACD,UAAU,CAAC,kBAAkB,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACvD,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC","sourcesContent":["import { type UserOperationFeeOptions } from \"@aa-sdk/core\";\nimport type { Chain } from \"viem\";\nimport {\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n optimism,\n optimismGoerli,\n optimismSepolia,\n} from \"./chains.js\";\n\n/**\n * Retrieves the default user operation fee options for a given chain. Adjusts fees for specific chains like Arbitrum and Optimism.\n *\n * @example\n * ```ts\n * import { getDefaultUserOperationFeeOptions } from \"@account-kit/infra\";\n * import { arbitrum } from \"@account-kit/infra\";\n *\n * const feeOpts = getDefaultUserOperationFeeOptions(arbitrum);\n * ```\n *\n * @param {Chain} chain The blockchain chain for which to get the fee options\n * @returns {UserOperationFeeOptions} An object containing the default fee options for user operations on the specified chain\n */\nexport const getDefaultUserOperationFeeOptions = (\n chain: Chain\n): UserOperationFeeOptions => {\n const feeOptions: UserOperationFeeOptions = {\n maxFeePerGas: { multiplier: 1.5 },\n maxPriorityFeePerGas: { multiplier: 1.05 },\n };\n\n if (\n new Set<number>([\n arbitrum.id,\n arbitrumGoerli.id,\n arbitrumSepolia.id,\n optimism.id,\n optimismGoerli.id,\n optimismSepolia.id,\n ]).has(chain.id)\n ) {\n feeOptions.preVerificationGas = { multiplier: 1.05 };\n }\n\n return feeOptions;\n};\n"]}
|
package/dist/esm/errors/base.js
CHANGED
|
@@ -3,6 +3,7 @@ import { VERSION } from "../version.js";
|
|
|
3
3
|
export class BaseError extends CoreBaseError {
|
|
4
4
|
constructor() {
|
|
5
5
|
super(...arguments);
|
|
6
|
+
// This version could be different from the aa-core version so we overwrite this here.
|
|
6
7
|
Object.defineProperty(this, "version", {
|
|
7
8
|
enumerable: true,
|
|
8
9
|
configurable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/errors/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,OAAgB,SAAU,SAAQ,aAAa;IAArD;;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/errors/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,OAAgB,SAAU,SAAQ,aAAa;IAArD;;QACE,sFAAsF;QAC7E;;;;mBAAU,OAAO;WAAC;IAC7B,CAAC;CAAA","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"]}
|
|
@@ -3,4 +3,17 @@ export declare const AlchemyPaymasterAddressV3 = "0x4f84a207A80c39E9e8BaE717c1F2
|
|
|
3
3
|
export declare const AlchemyPaymasterAddressV2 = "0x4Fd9098af9ddcB41DA48A1d78F91F1398965addc";
|
|
4
4
|
export declare const ArbSepoliaPaymasterAddress = "0x0804Afe6EEFb73ce7F93CD0d5e7079a5a8068592";
|
|
5
5
|
export declare const AlchemyPaymasterAddressV1 = "0xc03aac639bb21233e0139381970328db8bceeb67";
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves the Alchemy paymaster address for the given chain. Returns different addresses based on the chain ID.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { sepolia, getAlchemyPaymasterAddress } from "@account-kit/infra";
|
|
12
|
+
*
|
|
13
|
+
* const paymasterAddress = getAlchemyPaymasterAddress(sepolia);
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param {Chain} chain The chain for which the paymaster address is required
|
|
17
|
+
* @returns {Address} The Alchemy paymaster address corresponding to the specified chain
|
|
18
|
+
*/
|
|
6
19
|
export declare const getAlchemyPaymasterAddress: (chain: Chain) => Address;
|
package/dist/esm/gas-manager.js
CHANGED
|
@@ -3,6 +3,19 @@ export const AlchemyPaymasterAddressV3 = "0x4f84a207A80c39E9e8BaE717c1F25bA7AD1f
|
|
|
3
3
|
export const AlchemyPaymasterAddressV2 = "0x4Fd9098af9ddcB41DA48A1d78F91F1398965addc";
|
|
4
4
|
export const ArbSepoliaPaymasterAddress = "0x0804Afe6EEFb73ce7F93CD0d5e7079a5a8068592";
|
|
5
5
|
export const AlchemyPaymasterAddressV1 = "0xc03aac639bb21233e0139381970328db8bceeb67";
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves the Alchemy paymaster address for the given chain. Returns different addresses based on the chain ID.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { sepolia, getAlchemyPaymasterAddress } from "@account-kit/infra";
|
|
12
|
+
*
|
|
13
|
+
* const paymasterAddress = getAlchemyPaymasterAddress(sepolia);
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param {Chain} chain The chain for which the paymaster address is required
|
|
17
|
+
* @returns {Address} The Alchemy paymaster address corresponding to the specified chain
|
|
18
|
+
*/
|
|
6
19
|
export const getAlchemyPaymasterAddress = (chain) => {
|
|
7
20
|
switch (chain.id) {
|
|
8
21
|
case polygonAmoy.id:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas-manager.js","sourceRoot":"","sources":["../../src/gas-manager.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,WAAW,EACX,OAAO,EACP,cAAc,EACd,OAAO,EACP,QAAQ,EACR,eAAe,EACf,OAAO,EACP,WAAW,EACX,aAAa,EACb,OAAO,EACP,IAAI,EACJ,WAAW,GACZ,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,yBAAyB,GACpC,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,yBAAyB,GACpC,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,0BAA0B,GACrC,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,yBAAyB,GACpC,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"gas-manager.js","sourceRoot":"","sources":["../../src/gas-manager.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,WAAW,EACX,OAAO,EACP,cAAc,EACd,OAAO,EACP,QAAQ,EACR,eAAe,EACf,OAAO,EACP,WAAW,EACX,aAAa,EACb,OAAO,EACP,IAAI,EACJ,WAAW,GACZ,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,yBAAyB,GACpC,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,yBAAyB,GACpC,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,0BAA0B,GACrC,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,yBAAyB,GACpC,4CAA4C,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,KAAY,EAAW,EAAE;IAClE,QAAQ,KAAK,CAAC,EAAE,EAAE,CAAC;QACjB,KAAK,WAAW,CAAC,EAAE,CAAC;QACpB,KAAK,eAAe,CAAC,EAAE,CAAC;QACxB,KAAK,WAAW,CAAC,EAAE,CAAC;QACpB,KAAK,IAAI,CAAC,EAAE,CAAC;QACb,KAAK,WAAW,CAAC,EAAE,CAAC;QACpB,KAAK,OAAO,CAAC,EAAE,CAAC;QAChB,KAAK,cAAc,CAAC,EAAE;YACpB,OAAO,yBAAyB,CAAC;QACnC,KAAK,OAAO,CAAC,EAAE,CAAC;QAChB,KAAK,QAAQ,CAAC,EAAE,CAAC;QACjB,KAAK,QAAQ,CAAC,EAAE,CAAC;QACjB,KAAK,OAAO,CAAC,EAAE,CAAC;QAChB,KAAK,IAAI,CAAC,EAAE;YACV,OAAO,yBAAyB,CAAC;QACnC,KAAK,eAAe,CAAC,EAAE;YACrB,OAAO,0BAA0B,CAAC;QACpC,KAAK,OAAO,CAAC,EAAE,CAAC;QAChB,KAAK,aAAa,CAAC,EAAE;YACnB,OAAO,yBAAyB,CAAC;QACnC;YACE,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC;AACH,CAAC,CAAC","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"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export type * from "./actions/simulateUserOperationChanges.js";
|
|
|
2
2
|
export { simulateUserOperationChanges } from "./actions/simulateUserOperationChanges.js";
|
|
3
3
|
export type * from "./actions/types.js";
|
|
4
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";
|
|
5
|
+
export { arbitrum, arbitrumGoerli, arbitrumSepolia, arbitrumNova, base, baseGoerli, baseSepolia, defineAlchemyChain, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, zora, zoraSepolia, worldChain, worldChainSepolia, shape, shapeSepolia, } from "./chains.js";
|
|
6
6
|
export type * from "./client/decorators/alchemyEnhancedApis.js";
|
|
7
7
|
export { alchemyEnhancedApiActions } from "./client/decorators/alchemyEnhancedApis.js";
|
|
8
8
|
export type * from "./client/decorators/smartAccount.js";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { simulateUserOperationChanges } from "./actions/simulateUserOperationChanges.js";
|
|
2
|
-
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";
|
|
2
|
+
export { arbitrum, arbitrumGoerli, arbitrumSepolia, arbitrumNova, base, baseGoerli, baseSepolia, defineAlchemyChain, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, zora, zoraSepolia, worldChain, worldChainSepolia, shape, shapeSepolia, } from "./chains.js";
|
|
3
3
|
export { alchemyEnhancedApiActions } from "./client/decorators/alchemyEnhancedApis.js";
|
|
4
4
|
export { alchemyActions } from "./client/decorators/smartAccount.js";
|
|
5
5
|
export { createAlchemySmartAccountClientFromRpcClient as createAlchemySmartAccountClientFromExisting } from "./client/internal/smartAccountClientFromRpc.js";
|
package/dist/esm/index.js.map
CHANGED
|
@@ -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,EACL,QAAQ,EACR,cAAc,EACd,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,IAAI,EACJ,WAAW,EACX,UAAU,EACV,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AAGzF,OAAO,EACL,QAAQ,EACR,cAAc,EACd,eAAe,EACf,YAAY,EACZ,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,IAAI,EACJ,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,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,4CAA4C,IAAI,2CAA2C,EAAE,MAAM,gDAAgD,CAAC;AAC7J,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,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAEvF,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC","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 arbitrumNova,\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 shape,\n shapeSepolia,\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 +1,22 @@
|
|
|
1
1
|
import type { ClientMiddlewareFn } from "@aa-sdk/core";
|
|
2
2
|
import type { ClientWithAlchemyMethods } from "../client/types";
|
|
3
|
+
/**
|
|
4
|
+
* Function that estimates the transaction fees using Alchemy methods for a given client.
|
|
5
|
+
* It fetches the latest block and estimates the max priority fee per gas, applying any overrides or fee options provided.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { alchemyFeeEstimator, createAlchemyPublicRpcClient } from "@account-kit/infra";
|
|
10
|
+
* import { createSmartAccountClient } from "@aa-sdk/core";
|
|
11
|
+
*
|
|
12
|
+
* const bundlerClient = createAlchemyPublicRpcClient(...);
|
|
13
|
+
* const client = createSmartAccountClient({
|
|
14
|
+
* feeEstimator: alchemyFeeEstimator(bundlerClient),
|
|
15
|
+
* ...otherParams
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param {ClientWithAlchemyMethods} client The client with Alchemy methods
|
|
20
|
+
* @returns {ClientMiddlewareFn} A middleware function that takes a transaction structure and fee options, and returns the augmented structure with estimated fees
|
|
21
|
+
*/
|
|
3
22
|
export declare const alchemyFeeEstimator: <C extends ClientWithAlchemyMethods>(client: C) => ClientMiddlewareFn;
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
import { applyUserOpOverrideOrFeeOption } from "@aa-sdk/core";
|
|
2
|
+
/**
|
|
3
|
+
* Function that estimates the transaction fees using Alchemy methods for a given client.
|
|
4
|
+
* It fetches the latest block and estimates the max priority fee per gas, applying any overrides or fee options provided.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { alchemyFeeEstimator, createAlchemyPublicRpcClient } from "@account-kit/infra";
|
|
9
|
+
* import { createSmartAccountClient } from "@aa-sdk/core";
|
|
10
|
+
*
|
|
11
|
+
* const bundlerClient = createAlchemyPublicRpcClient(...);
|
|
12
|
+
* const client = createSmartAccountClient({
|
|
13
|
+
* feeEstimator: alchemyFeeEstimator(bundlerClient),
|
|
14
|
+
* ...otherParams
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param {ClientWithAlchemyMethods} client The client with Alchemy methods
|
|
19
|
+
* @returns {ClientMiddlewareFn} A middleware function that takes a transaction structure and fee options, and returns the augmented structure with estimated fees
|
|
20
|
+
*/
|
|
2
21
|
export const alchemyFeeEstimator = (client) => async (struct, { overrides, feeOptions }) => {
|
|
3
22
|
let [block, maxPriorityFeePerGasEstimate] = await Promise.all([
|
|
4
23
|
client.getBlock({ blockTag: "latest" }),
|
|
24
|
+
// it is a fair assumption that if someone is using this Alchemy Middleware, then they are using Alchemy RPC
|
|
5
25
|
client.request({
|
|
6
26
|
method: "rundler_maxPriorityFeePerGas",
|
|
7
27
|
params: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feeEstimator.js","sourceRoot":"","sources":["../../../src/middleware/feeEstimator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"feeEstimator.js","sourceRoot":"","sources":["../../../src/middleware/feeEstimator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAG9D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,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;QACvC,4GAA4G;QAC5G,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,8BAA8B,CACzD,4BAA4B,EAC5B,SAAS,EAAE,oBAAoB,EAC/B,UAAU,EAAE,oBAAoB,CACjC,CAAC;IACF,MAAM,YAAY,GAAG,8BAA8B,CACjD,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","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 +1,21 @@
|
|
|
1
1
|
import type { ClientMiddlewareConfig } from "@aa-sdk/core";
|
|
2
|
+
/**
|
|
3
|
+
* Paymaster middleware factory that uses Alchemy's Gas Manager for sponsoring transactions.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
*
|
|
8
|
+
* import { sepolia } from "@account-kit/infra";
|
|
9
|
+
* import { http } from "viem";
|
|
10
|
+
*
|
|
11
|
+
* const client = createSmartAccountClient({
|
|
12
|
+
* http("rpc-url"),
|
|
13
|
+
* sepolia,
|
|
14
|
+
* alchemyErc7677Middleware("policyId")
|
|
15
|
+
* );
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param {string} policyId the policyId for Alchemy's gas manager
|
|
19
|
+
* @returns {Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "paymasterAndData">} partial client middleware configuration containing `dummyPaymasterAndData` and `paymasterAndData`
|
|
20
|
+
*/
|
|
2
21
|
export declare function alchemyGasManagerMiddleware(policyId: string): Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "paymasterAndData">;
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { erc7677Middleware } from "@aa-sdk/core";
|
|
2
|
+
/**
|
|
3
|
+
* Paymaster middleware factory that uses Alchemy's Gas Manager for sponsoring transactions.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
*
|
|
8
|
+
* import { sepolia } from "@account-kit/infra";
|
|
9
|
+
* import { http } from "viem";
|
|
10
|
+
*
|
|
11
|
+
* const client = createSmartAccountClient({
|
|
12
|
+
* http("rpc-url"),
|
|
13
|
+
* sepolia,
|
|
14
|
+
* alchemyErc7677Middleware("policyId")
|
|
15
|
+
* );
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param {string} policyId the policyId for Alchemy's gas manager
|
|
19
|
+
* @returns {Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "paymasterAndData">} partial client middleware configuration containing `dummyPaymasterAndData` and `paymasterAndData`
|
|
20
|
+
*/
|
|
2
21
|
export function alchemyGasManagerMiddleware(policyId) {
|
|
3
22
|
return erc7677Middleware({
|
|
4
23
|
context: { policyId: policyId },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gasManager.js","sourceRoot":"","sources":["../../../src/middleware/gasManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"gasManager.js","sourceRoot":"","sources":["../../../src/middleware/gasManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAAgB;IAEhB,OAAO,iBAAiB,CAAuB;QAC7C,OAAO,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;KAChC,CAAC,CAAC;AACL,CAAC","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 +1,22 @@
|
|
|
1
1
|
import { type ClientMiddlewareFn, type UserOperationContext } from "@aa-sdk/core";
|
|
2
2
|
import type { ClientWithAlchemyMethods } from "../client/types";
|
|
3
|
+
/**
|
|
4
|
+
* A middleware function to be used during simulation of user operations which leverages Alchemy's RPC uo simulation method.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { alchemyUserOperationSimulator, createAlchemyPublicRpcClient } from "@account-kit/infra";
|
|
9
|
+
* import { createSmartAccountClient } from "@aa-sdk/core";
|
|
10
|
+
*
|
|
11
|
+
* const bundlerClient = createAlchemyPublicRpcClient(...);
|
|
12
|
+
* const client = createSmartAccountClient({
|
|
13
|
+
* userOperationSimulator: alchemyUserOperationSimulator(bundlerClient),
|
|
14
|
+
* ...otherParams
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @template C The client object with Alchemy methods
|
|
19
|
+
* @param {C} client The client object with Alchemy methods
|
|
20
|
+
* @returns {ClientMiddlewareFn} A middleware function to simulate and process user operations
|
|
21
|
+
*/
|
|
3
22
|
export declare function alchemyUserOperationSimulator<C extends ClientWithAlchemyMethods, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(client: C): ClientMiddlewareFn<TContext>;
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { deepHexlify, resolveProperties, } from "@aa-sdk/core";
|
|
2
|
+
/**
|
|
3
|
+
* A middleware function to be used during simulation of user operations which leverages Alchemy's RPC uo simulation method.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { alchemyUserOperationSimulator, createAlchemyPublicRpcClient } from "@account-kit/infra";
|
|
8
|
+
* import { createSmartAccountClient } from "@aa-sdk/core";
|
|
9
|
+
*
|
|
10
|
+
* const bundlerClient = createAlchemyPublicRpcClient(...);
|
|
11
|
+
* const client = createSmartAccountClient({
|
|
12
|
+
* userOperationSimulator: alchemyUserOperationSimulator(bundlerClient),
|
|
13
|
+
* ...otherParams
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @template C The client object with Alchemy methods
|
|
18
|
+
* @param {C} client The client object with Alchemy methods
|
|
19
|
+
* @returns {ClientMiddlewareFn} A middleware function to simulate and process user operations
|
|
20
|
+
*/
|
|
2
21
|
export function alchemyUserOperationSimulator(client) {
|
|
3
22
|
return async (struct, { account }) => {
|
|
4
23
|
const uoSimResult = await client.request({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userOperationSimulator.js","sourceRoot":"","sources":["../../../src/middleware/userOperationSimulator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,GAGlB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"userOperationSimulator.js","sourceRoot":"","sources":["../../../src/middleware/userOperationSimulator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,GAGlB,MAAM,cAAc,CAAC;AAGtB;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,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,WAAW,CAAC,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC;gBAC5C,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO;aAChC;SACF,CAAC,CAAC;QAEH,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {\n deepHexlify,\n resolveProperties,\n type ClientMiddlewareFn,\n type UserOperationContext,\n} from \"@aa-sdk/core\";\nimport type { 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"]}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.0-
|
|
1
|
+
export declare const VERSION = "4.0.0-beta.0";
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.0.0-beta.0\";\n"]}
|
package/dist/types/chains.d.ts
CHANGED
|
@@ -47,4 +47,7 @@ export declare const zora: Chain;
|
|
|
47
47
|
export declare const zoraSepolia: Chain;
|
|
48
48
|
export declare const worldChainSepolia: Chain;
|
|
49
49
|
export declare const worldChain: Chain;
|
|
50
|
+
export declare const shapeSepolia: Chain;
|
|
51
|
+
export declare const shape: Chain;
|
|
52
|
+
export declare const arbitrumNova: Chain;
|
|
50
53
|
//# sourceMappingURL=chains.d.ts.map
|
|
@@ -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;
|
|
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,MAAM,OAAO,EAAE,KAQrB,CAAC;AACF,eAAO,MAAM,IAAI,EAAE,KAQlB,CAAC;AACF,eAAO,MAAM,UAAU,EAAE,KAQxB,CAAC;AACF,eAAO,MAAM,WAAW,EAAE,KAQzB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAQ3B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAQzB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAS3B,CAAC;AAEH,eAAO,MAAM,IAAI,EAAE,KAKlB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAKzB,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,YAAY,EAAE,KAK1B,CAAC"}
|