@account-kit/infra 4.0.0-alpha.1 → 4.0.0-alpha.11
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/chains.d.ts +21 -0
- package/dist/cjs/chains.js +200 -1
- package/dist/cjs/chains.js.map +1 -1
- package/dist/cjs/client/decorators/alchemyEnhancedApis.d.ts +1173 -1317
- package/dist/cjs/client/internal/smartAccountClientFromRpc.js +2 -14
- package/dist/cjs/client/internal/smartAccountClientFromRpc.js.map +1 -1
- package/dist/cjs/client/isAlchemySmartAccountClient.d.ts +1173 -1317
- package/dist/cjs/client/rpcClient.js.map +1 -1
- package/dist/cjs/client/smartAccountClient.d.ts +2 -3
- package/dist/cjs/client/smartAccountClient.js +2 -2
- package/dist/cjs/client/smartAccountClient.js.map +1 -1
- package/dist/cjs/client/types.d.ts +1 -48
- package/dist/cjs/client/types.js.map +1 -1
- package/dist/cjs/defaults.js +7 -7
- package/dist/cjs/defaults.js.map +1 -1
- package/dist/cjs/gas-manager.js +16 -16
- package/dist/cjs/gas-manager.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +22 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/middleware/gasManager.d.ts +2 -29
- package/dist/cjs/middleware/gasManager.js +4 -141
- package/dist/cjs/middleware/gasManager.js.map +1 -1
- package/dist/cjs/middleware/userOperationSimulator.d.ts +2 -2
- package/dist/cjs/middleware/userOperationSimulator.js.map +1 -1
- package/dist/cjs/schema.js +3 -10
- package/dist/cjs/schema.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/chains.d.ts +21 -0
- package/dist/esm/chains.js +199 -0
- package/dist/esm/chains.js.map +1 -1
- package/dist/esm/client/decorators/alchemyEnhancedApis.d.ts +1173 -1317
- package/dist/esm/client/internal/smartAccountClientFromRpc.js +2 -14
- package/dist/esm/client/internal/smartAccountClientFromRpc.js.map +1 -1
- package/dist/esm/client/isAlchemySmartAccountClient.d.ts +1173 -1317
- package/dist/esm/client/rpcClient.js.map +1 -1
- package/dist/esm/client/smartAccountClient.d.ts +2 -3
- package/dist/esm/client/smartAccountClient.js +2 -3
- package/dist/esm/client/smartAccountClient.js.map +1 -1
- package/dist/esm/client/types.d.ts +1 -48
- package/dist/esm/client/types.js.map +1 -1
- package/dist/esm/defaults.js +2 -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 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/middleware/gasManager.d.ts +2 -29
- package/dist/esm/middleware/gasManager.js +5 -142
- package/dist/esm/middleware/gasManager.js.map +1 -1
- package/dist/esm/middleware/userOperationSimulator.d.ts +2 -2
- package/dist/esm/middleware/userOperationSimulator.js.map +1 -1
- package/dist/esm/schema.js +4 -11
- package/dist/esm/schema.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/chains.d.ts +21 -0
- package/dist/types/chains.d.ts.map +1 -1
- package/dist/types/client/decorators/alchemyEnhancedApis.d.ts +1173 -1317
- package/dist/types/client/decorators/alchemyEnhancedApis.d.ts.map +1 -1
- package/dist/types/client/internal/smartAccountClientFromRpc.d.ts +2 -2
- package/dist/types/client/isAlchemySmartAccountClient.d.ts +1173 -1317
- package/dist/types/client/isAlchemySmartAccountClient.d.ts.map +1 -1
- package/dist/types/client/rpcClient.d.ts +1 -1
- package/dist/types/client/smartAccountClient.d.ts +2 -3
- package/dist/types/client/smartAccountClient.d.ts.map +1 -1
- package/dist/types/client/types.d.ts +1 -48
- package/dist/types/client/types.d.ts.map +1 -1
- package/dist/types/defaults.d.ts +1 -1
- package/dist/types/defaults.d.ts.map +1 -1
- package/dist/types/gas-manager.d.ts +1 -1
- package/dist/types/gas-manager.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/middleware/gasManager.d.ts +15 -87
- package/dist/types/middleware/gasManager.d.ts.map +1 -1
- package/dist/types/middleware/userOperationSimulator.d.ts +2 -2
- package/dist/types/middleware/userOperationSimulator.d.ts.map +1 -1
- package/dist/types/schema.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 +5 -4
- package/src/chains.ts +231 -0
- package/src/client/internal/smartAccountClientFromRpc.ts +4 -20
- package/src/client/rpcClient.ts +1 -1
- package/src/client/smartAccountClient.ts +4 -5
- package/src/client/types.ts +1 -54
- package/src/defaults.ts +4 -4
- package/src/gas-manager.ts +3 -3
- package/src/index.ts +24 -1
- package/src/middleware/gasManager.ts +21 -424
- package/src/middleware/userOperationSimulator.ts +6 -2
- package/src/schema.ts +3 -11
- package/src/version.ts +1 -1
|
@@ -39,8 +39,8 @@ export function getSignerTypeHeader<
|
|
|
39
39
|
* Helper method meant to be used internally to create an alchemy smart account client
|
|
40
40
|
* from an existing Alchemy Rpc Client
|
|
41
41
|
*
|
|
42
|
-
* @param args configuration for the client
|
|
43
|
-
* @returns a smart account client configured to use Alchemy's RPC
|
|
42
|
+
* @param {CreateAlchemySmartAccountClientFromRpcClientParams<TAccount, TContext>} args configuration for the client
|
|
43
|
+
* @returns {AlchemySmartAccountClient} a smart account client configured to use Alchemy's RPC
|
|
44
44
|
*/
|
|
45
45
|
export function createAlchemySmartAccountClientFromRpcClient<
|
|
46
46
|
TChain extends Chain | undefined = Chain | undefined,
|
|
@@ -84,7 +84,7 @@ export function createAlchemySmartAccountClientFromRpcClient(
|
|
|
84
84
|
opts,
|
|
85
85
|
account,
|
|
86
86
|
useSimulation,
|
|
87
|
-
|
|
87
|
+
policyId,
|
|
88
88
|
feeEstimator,
|
|
89
89
|
gasEstimator,
|
|
90
90
|
customMiddleware,
|
|
@@ -106,7 +106,6 @@ export function createAlchemySmartAccountClientFromRpcClient(
|
|
|
106
106
|
if (isSmartAccountWithSigner(args.account)) {
|
|
107
107
|
client.updateHeaders(getSignerTypeHeader(args.account));
|
|
108
108
|
}
|
|
109
|
-
|
|
110
109
|
return customMiddleware ? customMiddleware(struct, args) : struct;
|
|
111
110
|
},
|
|
112
111
|
feeEstimator: feeEstimator ?? alchemyFeeEstimator(client),
|
|
@@ -114,22 +113,7 @@ export function createAlchemySmartAccountClientFromRpcClient(
|
|
|
114
113
|
? alchemyUserOperationSimulator(client)
|
|
115
114
|
: undefined,
|
|
116
115
|
gasEstimator,
|
|
117
|
-
...(
|
|
118
|
-
alchemyGasManagerMiddleware(client, {
|
|
119
|
-
...gasManagerConfig,
|
|
120
|
-
gasEstimationOptions: {
|
|
121
|
-
...gasManagerConfig.gasEstimationOptions,
|
|
122
|
-
disableGasEstimation:
|
|
123
|
-
gasManagerConfig.gasEstimationOptions?.disableGasEstimation ??
|
|
124
|
-
false,
|
|
125
|
-
fallbackFeeDataGetter:
|
|
126
|
-
gasManagerConfig.gasEstimationOptions?.fallbackFeeDataGetter ??
|
|
127
|
-
feeEstimator,
|
|
128
|
-
fallbackGasEstimator:
|
|
129
|
-
gasManagerConfig.gasEstimationOptions?.fallbackGasEstimator ??
|
|
130
|
-
gasEstimator,
|
|
131
|
-
},
|
|
132
|
-
})),
|
|
116
|
+
...(policyId && alchemyGasManagerMiddleware(policyId)),
|
|
133
117
|
signUserOperation,
|
|
134
118
|
}).extend(alchemyActions);
|
|
135
119
|
|
package/src/client/rpcClient.ts
CHANGED
|
@@ -14,7 +14,7 @@ import type { ClientWithAlchemyMethods } from "./types.js";
|
|
|
14
14
|
* @example
|
|
15
15
|
* ```ts
|
|
16
16
|
* import { createAlchemyPublicRpcClient } from "@account-kit/infra";
|
|
17
|
-
* import { sepolia } from "@account-kit/infra
|
|
17
|
+
* import { sepolia } from "@account-kit/infra";
|
|
18
18
|
*
|
|
19
19
|
* const client = createAlchemyPublicRpcClient({
|
|
20
20
|
* chain: sepolia,
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
} from "@aa-sdk/core";
|
|
10
10
|
import { type Chain, type Transport } from "viem";
|
|
11
11
|
import { getDefaultUserOperationFeeOptions } from "../defaults.js";
|
|
12
|
-
import { type AlchemyGasManagerConfig } from "../middleware/gasManager.js";
|
|
13
12
|
import { AlchemyProviderConfigSchema } from "../schema.js";
|
|
14
13
|
import type { AlchemyProviderConfig } from "../type.js";
|
|
15
14
|
import type { AlchemySmartAccountClientActions } from "./decorators/smartAccount.js";
|
|
@@ -30,7 +29,7 @@ export type AlchemySmartAccountClientConfig<
|
|
|
30
29
|
> = {
|
|
31
30
|
account?: account;
|
|
32
31
|
useSimulation?: boolean;
|
|
33
|
-
|
|
32
|
+
policyId?: string;
|
|
34
33
|
} & AlchemyProviderConfig &
|
|
35
34
|
Pick<
|
|
36
35
|
SmartAccountClientConfig<transport, chain, account, context>,
|
|
@@ -95,7 +94,7 @@ export function createAlchemySmartAccountClient<
|
|
|
95
94
|
| undefined
|
|
96
95
|
>({
|
|
97
96
|
account,
|
|
98
|
-
|
|
97
|
+
policyId,
|
|
99
98
|
useSimulation,
|
|
100
99
|
feeEstimator,
|
|
101
100
|
customMiddleware,
|
|
@@ -134,7 +133,7 @@ export function createAlchemySmartAccountClient<
|
|
|
134
133
|
*/
|
|
135
134
|
export function createAlchemySmartAccountClient({
|
|
136
135
|
account,
|
|
137
|
-
|
|
136
|
+
policyId,
|
|
138
137
|
useSimulation,
|
|
139
138
|
feeEstimator,
|
|
140
139
|
customMiddleware,
|
|
@@ -160,7 +159,7 @@ export function createAlchemySmartAccountClient({
|
|
|
160
159
|
...opts,
|
|
161
160
|
feeOptions,
|
|
162
161
|
},
|
|
163
|
-
|
|
162
|
+
policyId,
|
|
164
163
|
useSimulation,
|
|
165
164
|
feeEstimator,
|
|
166
165
|
customMiddleware,
|
package/src/client/types.ts
CHANGED
|
@@ -1,40 +1,11 @@
|
|
|
1
1
|
import { type BundlerClient, type UserOperationRequest } from "@aa-sdk/core";
|
|
2
|
-
import type {
|
|
2
|
+
import type { HttpTransport } from "viem";
|
|
3
3
|
import type {
|
|
4
4
|
SimulateUserOperationAssetChangesRequest,
|
|
5
5
|
SimulateUserOperationAssetChangesResponse,
|
|
6
6
|
} from "../actions/types";
|
|
7
|
-
import type {
|
|
8
|
-
RequestGasAndPaymasterAndDataOverrides,
|
|
9
|
-
RequestGasAndPaymasterAndDataResponse,
|
|
10
|
-
RequestPaymasterAndDataResponse,
|
|
11
|
-
} from "../middleware/gasManager";
|
|
12
7
|
|
|
13
8
|
export type AlchemyRpcSchema = [
|
|
14
|
-
{
|
|
15
|
-
Method: "alchemy_requestPaymasterAndData";
|
|
16
|
-
Parameters: [
|
|
17
|
-
{
|
|
18
|
-
policyId: string;
|
|
19
|
-
entryPoint: Address;
|
|
20
|
-
userOperation: UserOperationRequest;
|
|
21
|
-
}
|
|
22
|
-
];
|
|
23
|
-
ReturnType: RequestPaymasterAndDataResponse;
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
Method: "alchemy_requestGasAndPaymasterAndData";
|
|
27
|
-
Parameters: [
|
|
28
|
-
{
|
|
29
|
-
policyId: string;
|
|
30
|
-
entryPoint: Address;
|
|
31
|
-
userOperation: UserOperationRequest;
|
|
32
|
-
dummySignature: Hex;
|
|
33
|
-
overrides?: RequestGasAndPaymasterAndDataOverrides;
|
|
34
|
-
}
|
|
35
|
-
];
|
|
36
|
-
ReturnType: RequestGasAndPaymasterAndDataResponse;
|
|
37
|
-
},
|
|
38
9
|
{
|
|
39
10
|
Method: "alchemy_simulateUserOperationAssetChanges";
|
|
40
11
|
Parameters: SimulateUserOperationAssetChangesRequest;
|
|
@@ -50,30 +21,6 @@ export type AlchemyRpcSchema = [
|
|
|
50
21
|
export type ClientWithAlchemyMethods = BundlerClient<HttpTransport> & {
|
|
51
22
|
request: BundlerClient<HttpTransport>["request"] &
|
|
52
23
|
{
|
|
53
|
-
request(args: {
|
|
54
|
-
method: "alchemy_requestPaymasterAndData";
|
|
55
|
-
params: [
|
|
56
|
-
{
|
|
57
|
-
policyId: string;
|
|
58
|
-
entryPoint: Address;
|
|
59
|
-
userOperation: UserOperationRequest;
|
|
60
|
-
}
|
|
61
|
-
];
|
|
62
|
-
}): Promise<RequestPaymasterAndDataResponse>;
|
|
63
|
-
|
|
64
|
-
request(args: {
|
|
65
|
-
method: "alchemy_requestGasAndPaymasterAndData";
|
|
66
|
-
params: [
|
|
67
|
-
{
|
|
68
|
-
policyId: string;
|
|
69
|
-
entryPoint: Address;
|
|
70
|
-
userOperation: UserOperationRequest;
|
|
71
|
-
dummySignature: Hex;
|
|
72
|
-
overrides?: RequestGasAndPaymasterAndDataOverrides;
|
|
73
|
-
}
|
|
74
|
-
];
|
|
75
|
-
}): Promise<RequestGasAndPaymasterAndDataResponse>;
|
|
76
|
-
|
|
77
24
|
request(args: {
|
|
78
25
|
method: "alchemy_simulateUserOperationAssetChanges";
|
|
79
26
|
params: SimulateUserOperationAssetChangesRequest;
|
package/src/defaults.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type UserOperationFeeOptions } from "@aa-sdk/core";
|
|
2
|
+
import type { Chain } from "viem";
|
|
1
3
|
import {
|
|
2
4
|
arbitrum,
|
|
3
5
|
arbitrumGoerli,
|
|
@@ -5,9 +7,7 @@ import {
|
|
|
5
7
|
optimism,
|
|
6
8
|
optimismGoerli,
|
|
7
9
|
optimismSepolia,
|
|
8
|
-
|
|
9
|
-
} from "@aa-sdk/core";
|
|
10
|
-
import type { Chain } from "viem";
|
|
10
|
+
} from "./chains.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Retrieves the default user operation fee options for a given chain. Adjusts fees for specific chains like Arbitrum and Optimism.
|
|
@@ -15,7 +15,7 @@ import type { Chain } from "viem";
|
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts
|
|
17
17
|
* import { getDefaultUserOperationFeeOptions } from "@account-kit/infra";
|
|
18
|
-
* import { arbitrum } from "@account-kit/infra
|
|
18
|
+
* import { arbitrum } from "@account-kit/infra";
|
|
19
19
|
*
|
|
20
20
|
* const feeOpts = getDefaultUserOperationFeeOptions(arbitrum);
|
|
21
21
|
* ```
|
package/src/gas-manager.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Address, Chain } from "viem";
|
|
1
2
|
import {
|
|
2
3
|
arbitrum,
|
|
3
4
|
arbitrumSepolia,
|
|
@@ -14,8 +15,7 @@ import {
|
|
|
14
15
|
sepolia,
|
|
15
16
|
zora,
|
|
16
17
|
zoraSepolia,
|
|
17
|
-
} from "
|
|
18
|
-
import type { Address, Chain } from "viem";
|
|
18
|
+
} from "./chains.js";
|
|
19
19
|
|
|
20
20
|
export const AlchemyPaymasterAddressV3 =
|
|
21
21
|
"0x4f84a207A80c39E9e8BaE717c1F25bA7AD1fB08F";
|
|
@@ -31,7 +31,7 @@ export const AlchemyPaymasterAddressV1 =
|
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
33
|
* ```ts
|
|
34
|
-
* import { sepolia, getAlchemyPaymasterAddress } from "@account-kit/infra
|
|
34
|
+
* import { sepolia, getAlchemyPaymasterAddress } from "@account-kit/infra";
|
|
35
35
|
*
|
|
36
36
|
* const paymasterAddress = getAlchemyPaymasterAddress(sepolia);
|
|
37
37
|
* ```
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,30 @@ 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 {
|
|
5
|
+
export {
|
|
6
|
+
arbitrum,
|
|
7
|
+
arbitrumGoerli,
|
|
8
|
+
arbitrumSepolia,
|
|
9
|
+
base,
|
|
10
|
+
baseGoerli,
|
|
11
|
+
baseSepolia,
|
|
12
|
+
defineAlchemyChain,
|
|
13
|
+
fraxtal,
|
|
14
|
+
fraxtalSepolia,
|
|
15
|
+
goerli,
|
|
16
|
+
mainnet,
|
|
17
|
+
optimism,
|
|
18
|
+
optimismGoerli,
|
|
19
|
+
optimismSepolia,
|
|
20
|
+
polygon,
|
|
21
|
+
polygonAmoy,
|
|
22
|
+
polygonMumbai,
|
|
23
|
+
sepolia,
|
|
24
|
+
zora,
|
|
25
|
+
zoraSepolia,
|
|
26
|
+
worldChain,
|
|
27
|
+
worldChainSepolia,
|
|
28
|
+
} from "./chains.js";
|
|
6
29
|
export type * from "./client/decorators/alchemyEnhancedApis.js";
|
|
7
30
|
export { alchemyEnhancedApiActions } from "./client/decorators/alchemyEnhancedApis.js";
|
|
8
31
|
export type * from "./client/decorators/smartAccount.js";
|