@account-kit/infra 4.0.0-alpha.0 → 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/actions/simulateUserOperationChanges.js.map +1 -1
- package/dist/cjs/chains.d.ts +4 -0
- package/dist/cjs/chains.js.map +1 -1
- package/dist/cjs/client/decorators/alchemyEnhancedApis.d.ts +5537 -1
- package/dist/cjs/client/decorators/alchemyEnhancedApis.js.map +1 -1
- package/dist/cjs/client/decorators/smartAccount.js.map +1 -1
- package/dist/cjs/client/internal/smartAccountClientFromRpc.d.ts +2 -2
- package/dist/cjs/client/internal/smartAccountClientFromRpc.js +2 -1
- package/dist/cjs/client/internal/smartAccountClientFromRpc.js.map +1 -1
- package/dist/cjs/client/isAlchemySmartAccountClient.js.map +1 -1
- package/dist/cjs/client/rpcClient.js.map +1 -1
- package/dist/cjs/client/smartAccountClient.js.map +1 -1
- package/dist/cjs/defaults.js.map +1 -1
- package/dist/cjs/gas-manager.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/middleware/feeEstimator.js.map +1 -1
- package/dist/cjs/middleware/gasManager.js.map +1 -1
- package/dist/cjs/middleware/userOperationSimulator.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/actions/simulateUserOperationChanges.js.map +1 -1
- package/dist/esm/chains.d.ts +4 -0
- package/dist/esm/chains.js.map +1 -1
- package/dist/esm/client/decorators/alchemyEnhancedApis.d.ts +5537 -1
- package/dist/esm/client/decorators/alchemyEnhancedApis.js.map +1 -1
- package/dist/esm/client/decorators/smartAccount.js.map +1 -1
- package/dist/esm/client/internal/smartAccountClientFromRpc.d.ts +2 -2
- package/dist/esm/client/internal/smartAccountClientFromRpc.js +2 -1
- package/dist/esm/client/internal/smartAccountClientFromRpc.js.map +1 -1
- package/dist/esm/client/isAlchemySmartAccountClient.js.map +1 -1
- package/dist/esm/client/rpcClient.js.map +1 -1
- package/dist/esm/client/smartAccountClient.js.map +1 -1
- package/dist/esm/defaults.js.map +1 -1
- package/dist/esm/gas-manager.js +1 -1
- package/dist/esm/gas-manager.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/middleware/feeEstimator.js.map +1 -1
- package/dist/esm/middleware/gasManager.js.map +1 -1
- package/dist/esm/middleware/userOperationSimulator.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/actions/simulateUserOperationChanges.d.ts +17 -0
- package/dist/types/actions/simulateUserOperationChanges.d.ts.map +1 -1
- package/dist/types/chains.d.ts +23 -0
- package/dist/types/chains.d.ts.map +1 -1
- package/dist/types/client/decorators/alchemyEnhancedApis.d.ts +5554 -1
- package/dist/types/client/decorators/alchemyEnhancedApis.d.ts.map +1 -1
- package/dist/types/client/decorators/smartAccount.d.ts +15 -0
- package/dist/types/client/decorators/smartAccount.d.ts.map +1 -1
- package/dist/types/client/internal/smartAccountClientFromRpc.d.ts +2 -2
- package/dist/types/client/internal/smartAccountClientFromRpc.d.ts.map +1 -1
- package/dist/types/client/isAlchemySmartAccountClient.d.ts +15 -0
- package/dist/types/client/isAlchemySmartAccountClient.d.ts.map +1 -1
- package/dist/types/client/rpcClient.d.ts +22 -0
- package/dist/types/client/rpcClient.d.ts.map +1 -1
- package/dist/types/defaults.d.ts +14 -0
- package/dist/types/defaults.d.ts.map +1 -1
- package/dist/types/gas-manager.d.ts +13 -0
- package/dist/types/gas-manager.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/middleware/feeEstimator.d.ts +19 -0
- package/dist/types/middleware/feeEstimator.d.ts.map +1 -1
- package/dist/types/middleware/userOperationSimulator.d.ts +19 -0
- package/dist/types/middleware/userOperationSimulator.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -3
- package/src/actions/simulateUserOperationChanges.ts +17 -0
- package/src/chains.ts +24 -0
- package/src/client/decorators/alchemyEnhancedApis.ts +50 -33
- package/src/client/decorators/smartAccount.ts +15 -0
- package/src/client/internal/smartAccountClientFromRpc.ts +33 -13
- package/src/client/isAlchemySmartAccountClient.ts +15 -0
- package/src/client/rpcClient.ts +22 -0
- package/src/client/smartAccountClient.ts +17 -0
- package/src/defaults.ts +14 -0
- package/src/gas-manager.ts +17 -4
- package/src/index.ts +1 -0
- package/src/middleware/feeEstimator.ts +19 -0
- package/src/middleware/gasManager.ts +1 -1
- package/src/middleware/userOperationSimulator.ts +19 -0
- package/src/version.ts +1 -1
|
@@ -115,6 +115,23 @@ export function createAlchemySmartAccountClient<
|
|
|
115
115
|
TContext
|
|
116
116
|
>;
|
|
117
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Creates an Alchemy smart account client using the provided configuration options, including account details, gas manager configuration, and custom middleware.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* import { createAlchemySmartAccountClient } from "@account-kit/infra";
|
|
124
|
+
* import { sepolia } from "@account-kit/infra/chain";
|
|
125
|
+
*
|
|
126
|
+
* const client = createAlchemySmartAccountClient({
|
|
127
|
+
* chain: sepolia,
|
|
128
|
+
* apiKey: "your-api-key",
|
|
129
|
+
* });
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @param {AlchemySmartAccountClientConfig} config The configuration for creating the Alchemy smart account client
|
|
133
|
+
* @returns {AlchemySmartAccountClient} An instance of `AlchemySmartAccountClient` configured based on the provided options
|
|
134
|
+
*/
|
|
118
135
|
export function createAlchemySmartAccountClient({
|
|
119
136
|
account,
|
|
120
137
|
gasManagerConfig,
|
package/src/defaults.ts
CHANGED
|
@@ -9,6 +9,20 @@ import {
|
|
|
9
9
|
} from "@aa-sdk/core";
|
|
10
10
|
import type { Chain } from "viem";
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves the default user operation fee options for a given chain. Adjusts fees for specific chains like Arbitrum and Optimism.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { getDefaultUserOperationFeeOptions } from "@account-kit/infra";
|
|
18
|
+
* import { arbitrum } from "@account-kit/infra/chains";
|
|
19
|
+
*
|
|
20
|
+
* const feeOpts = getDefaultUserOperationFeeOptions(arbitrum);
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @param {Chain} chain The blockchain chain for which to get the fee options
|
|
24
|
+
* @returns {UserOperationFeeOptions} An object containing the default fee options for user operations on the specified chain
|
|
25
|
+
*/
|
|
12
26
|
export const getDefaultUserOperationFeeOptions = (
|
|
13
27
|
chain: Chain
|
|
14
28
|
): UserOperationFeeOptions => {
|
package/src/gas-manager.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import type { Address, Chain } from "viem";
|
|
2
1
|
import {
|
|
3
2
|
arbitrum,
|
|
4
3
|
arbitrumSepolia,
|
|
5
4
|
base,
|
|
6
5
|
baseSepolia,
|
|
6
|
+
fraxtal,
|
|
7
|
+
fraxtalSepolia,
|
|
7
8
|
mainnet,
|
|
8
|
-
sepolia,
|
|
9
9
|
optimism,
|
|
10
10
|
optimismSepolia,
|
|
11
11
|
polygon,
|
|
12
12
|
polygonAmoy,
|
|
13
13
|
polygonMumbai,
|
|
14
|
-
|
|
15
|
-
fraxtalSepolia,
|
|
14
|
+
sepolia,
|
|
16
15
|
zora,
|
|
17
16
|
zoraSepolia,
|
|
18
17
|
} from "@aa-sdk/core";
|
|
18
|
+
import type { Address, Chain } from "viem";
|
|
19
19
|
|
|
20
20
|
export const AlchemyPaymasterAddressV3 =
|
|
21
21
|
"0x4f84a207A80c39E9e8BaE717c1F25bA7AD1fB08F";
|
|
@@ -26,6 +26,19 @@ export const ArbSepoliaPaymasterAddress =
|
|
|
26
26
|
export const AlchemyPaymasterAddressV1 =
|
|
27
27
|
"0xc03aac639bb21233e0139381970328db8bceeb67";
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves the Alchemy paymaster address for the given chain. Returns different addresses based on the chain ID.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { sepolia, getAlchemyPaymasterAddress } from "@account-kit/infra/chains";
|
|
35
|
+
*
|
|
36
|
+
* const paymasterAddress = getAlchemyPaymasterAddress(sepolia);
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param {Chain} chain The chain for which the paymaster address is required
|
|
40
|
+
* @returns {Address} The Alchemy paymaster address corresponding to the specified chain
|
|
41
|
+
*/
|
|
29
42
|
export const getAlchemyPaymasterAddress = (chain: Chain): Address => {
|
|
30
43
|
switch (chain.id) {
|
|
31
44
|
case polygonAmoy.id:
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type * from "./actions/simulateUserOperationChanges.js";
|
|
2
2
|
export { simulateUserOperationChanges } from "./actions/simulateUserOperationChanges.js";
|
|
3
3
|
export type * from "./actions/types.js";
|
|
4
|
+
export type * from "./chains.js";
|
|
4
5
|
export { defineAlchemyChain } from "./chains.js";
|
|
5
6
|
export type * from "./client/decorators/alchemyEnhancedApis.js";
|
|
6
7
|
export { alchemyEnhancedApiActions } from "./client/decorators/alchemyEnhancedApis.js";
|
|
@@ -2,6 +2,25 @@ import type { ClientMiddlewareFn } from "@aa-sdk/core";
|
|
|
2
2
|
import { applyUserOpOverrideOrFeeOption } from "@aa-sdk/core";
|
|
3
3
|
import type { ClientWithAlchemyMethods } from "../client/types";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Function that estimates the transaction fees using Alchemy methods for a given client.
|
|
7
|
+
* It fetches the latest block and estimates the max priority fee per gas, applying any overrides or fee options provided.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { alchemyFeeEstimator, createAlchemyPublicRpcClient } from "@account-kit/infra";
|
|
12
|
+
* import { createSmartAccountClient } from "@aa-sdk/core";
|
|
13
|
+
*
|
|
14
|
+
* const bundlerClient = createAlchemyPublicRpcClient(...);
|
|
15
|
+
* const client = createSmartAccountClient({
|
|
16
|
+
* feeEstimator: alchemyFeeEstimator(bundlerClient),
|
|
17
|
+
* ...otherParams
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param {ClientWithAlchemyMethods} client The client with Alchemy methods
|
|
22
|
+
* @returns {ClientMiddlewareFn} A middleware function that takes a transaction structure and fee options, and returns the augmented structure with estimated fees
|
|
23
|
+
*/
|
|
5
24
|
export const alchemyFeeEstimator: <C extends ClientWithAlchemyMethods>(
|
|
6
25
|
client: C
|
|
7
26
|
) => ClientMiddlewareFn =
|
|
@@ -145,7 +145,7 @@ export interface AlchemyGasEstimationOptions {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
|
-
*
|
|
148
|
+
* Dummy paymaster and data middleware for the alchemy gas manager
|
|
149
149
|
*
|
|
150
150
|
* @template {ClientWithAlchemyMethods} C
|
|
151
151
|
* @param client client with alchemy methods
|
|
@@ -5,6 +5,25 @@ import {
|
|
|
5
5
|
} from "@aa-sdk/core";
|
|
6
6
|
import type { ClientWithAlchemyMethods } from "../client/types";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A middleware function to be used during simulation of user operations which leverages Alchemy's RPC uo simulation method.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { alchemyUserOperationSimulator, createAlchemyPublicRpcClient } from "@account-kit/infra";
|
|
14
|
+
* import { createSmartAccountClient } from "@aa-sdk/core";
|
|
15
|
+
*
|
|
16
|
+
* const bundlerClient = createAlchemyPublicRpcClient(...);
|
|
17
|
+
* const client = createSmartAccountClient({
|
|
18
|
+
* userOperationSimulator: alchemyUserOperationSimulator(bundlerClient),
|
|
19
|
+
* ...otherParams
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @template C The client object with Alchemy methods
|
|
24
|
+
* @param {C} client The client object with Alchemy methods
|
|
25
|
+
* @returns {ClientMiddlewareFn} A middleware function to simulate and process user operations
|
|
26
|
+
*/
|
|
8
27
|
export function alchemyUserOperationSimulator<
|
|
9
28
|
C extends ClientWithAlchemyMethods
|
|
10
29
|
>(client: C): ClientMiddlewareFn {
|
package/src/version.ts
CHANGED