@account-kit/infra 4.34.1 → 4.35.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.
Files changed (52) hide show
  1. package/dist/esm/actions/simulateUserOperationChanges.js.map +1 -1
  2. package/dist/esm/actions/types.js.map +1 -1
  3. package/dist/esm/alchemyTransport.js +6 -16
  4. package/dist/esm/alchemyTransport.js.map +1 -1
  5. package/dist/esm/chains.d.ts +3 -0
  6. package/dist/esm/chains.js +69 -0
  7. package/dist/esm/chains.js.map +1 -1
  8. package/dist/esm/client/decorators/alchemyEnhancedApis.js.map +1 -1
  9. package/dist/esm/client/decorators/smartAccount.js.map +1 -1
  10. package/dist/esm/client/isAlchemySmartAccountClient.js.map +1 -1
  11. package/dist/esm/client/smartAccountClient.js.map +1 -1
  12. package/dist/esm/client/types.js.map +1 -1
  13. package/dist/esm/defaults.js.map +1 -1
  14. package/dist/esm/index.d.ts +1 -1
  15. package/dist/esm/index.js +1 -1
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/metrics.js.map +1 -1
  18. package/dist/esm/middleware/feeEstimator.js.map +1 -1
  19. package/dist/esm/middleware/gasManager.js.map +1 -1
  20. package/dist/esm/middleware/userOperationSimulator.js.map +1 -1
  21. package/dist/esm/version.d.ts +1 -1
  22. package/dist/esm/version.js +1 -1
  23. package/dist/esm/version.js.map +1 -1
  24. package/dist/types/actions/types.d.ts.map +1 -1
  25. package/dist/types/alchemyTrackerHeaders.d.ts.map +1 -1
  26. package/dist/types/alchemyTransport.d.ts.map +1 -1
  27. package/dist/types/chains.d.ts +3 -0
  28. package/dist/types/chains.d.ts.map +1 -1
  29. package/dist/types/client/decorators/smartAccount.d.ts.map +1 -1
  30. package/dist/types/client/rpcClient.d.ts.map +1 -1
  31. package/dist/types/defaults.d.ts.map +1 -1
  32. package/dist/types/gas-manager.d.ts.map +1 -1
  33. package/dist/types/index.d.ts +1 -1
  34. package/dist/types/index.d.ts.map +1 -1
  35. package/dist/types/version.d.ts +1 -1
  36. package/package.json +5 -7
  37. package/src/actions/simulateUserOperationChanges.ts +5 -5
  38. package/src/actions/types.ts +11 -11
  39. package/src/alchemyTransport.ts +17 -24
  40. package/src/chains.ts +72 -0
  41. package/src/client/decorators/alchemyEnhancedApis.ts +4 -4
  42. package/src/client/decorators/smartAccount.ts +9 -8
  43. package/src/client/isAlchemySmartAccountClient.ts +2 -2
  44. package/src/client/smartAccountClient.ts +10 -10
  45. package/src/client/types.ts +1 -1
  46. package/src/defaults.ts +1 -1
  47. package/src/index.ts +3 -0
  48. package/src/metrics.ts +1 -1
  49. package/src/middleware/feeEstimator.ts +3 -3
  50. package/src/middleware/gasManager.ts +25 -25
  51. package/src/middleware/userOperationSimulator.ts +1 -1
  52. package/src/version.ts +1 -1
@@ -31,25 +31,26 @@ export type AlchemySmartAccountClientActions<
31
31
  | UserOperationContext
32
32
  | undefined,
33
33
  TChain extends Chain | undefined = Chain | undefined,
34
- TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>
34
+ TEntryPointVersion extends
35
+ GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,
35
36
  > = {
36
37
  simulateUserOperation: (
37
- args: SendUserOperationParameters<TAccount, TContext>
38
+ args: SendUserOperationParameters<TAccount, TContext>,
38
39
  ) => Promise<SimulateUserOperationAssetChangesResponse>;
39
40
  sendUserOperation: (
40
41
  args: SendUserOperationParameters<
41
42
  TAccount,
42
43
  TContext,
43
44
  GetEntryPointFromAccount<TAccount>
44
- >
45
+ >,
45
46
  ) => Promise<SendUserOperationResult<TEntryPointVersion>>;
46
47
  sendTransaction: <TChainOverride extends Chain | undefined = undefined>(
47
48
  args: SendTransactionParameters<TChain, TAccount, TChainOverride>,
48
49
  overrides?: UserOperationOverrides<TEntryPointVersion>,
49
- context?: TContext
50
+ context?: TContext,
50
51
  ) => Promise<Hex>;
51
52
  sendTransactions: (
52
- args: SendTransactionsParameters<TAccount, TContext>
53
+ args: SendTransactionsParameters<TAccount, TContext>,
53
54
  ) => Promise<Hex>;
54
55
  };
55
56
 
@@ -76,11 +77,11 @@ export const alchemyActions: <
76
77
  | undefined,
77
78
  TContext extends UserOperationContext | undefined =
78
79
  | UserOperationContext
79
- | undefined
80
+ | undefined,
80
81
  >(
81
- client: Client<TTransport, TChain, TAccount>
82
+ client: Client<TTransport, TChain, TAccount>,
82
83
  ) => AlchemySmartAccountClientActions<TAccount, TContext, TChain> = (
83
- client_
84
+ client_,
84
85
  ) => ({
85
86
  simulateUserOperation: async (args) => {
86
87
  const client = clientHeaderTrack(client_, "simulateUserOperation");
@@ -21,9 +21,9 @@ export function isAlchemySmartAccountClient<
21
21
  TChain extends Chain | undefined = Chain | undefined,
22
22
  TAccount extends SmartContractAccount | undefined =
23
23
  | SmartContractAccount
24
- | undefined
24
+ | undefined,
25
25
  >(
26
- client: Client<Transport, TChain, TAccount>
26
+ client: Client<Transport, TChain, TAccount>,
27
27
  ): client is AlchemySmartAccountClient<TChain, TAccount> {
28
28
  return client.transport.type === "alchemy";
29
29
  }
@@ -30,7 +30,7 @@ import type { AlchemyRpcSchema } from "./types.js";
30
30
  import { headersUpdate } from "../alchemyTrackerHeaders.js";
31
31
 
32
32
  export function getSignerTypeHeader<
33
- TAccount extends SmartContractAccountWithSigner
33
+ TAccount extends SmartContractAccountWithSigner,
34
34
  >(account: TAccount) {
35
35
  return { "Alchemy-Aa-Sdk-Signer": account.getSigner().signerType };
36
36
  }
@@ -43,7 +43,7 @@ export type AlchemySmartAccountClientConfig<
43
43
  | undefined,
44
44
  context extends UserOperationContext | undefined =
45
45
  | UserOperationContext
46
- | undefined
46
+ | undefined,
47
47
  > = {
48
48
  account?: account;
49
49
  useSimulation?: boolean;
@@ -74,7 +74,7 @@ export type BaseAlchemyActions<
74
74
  | undefined,
75
75
  context extends UserOperationContext | undefined =
76
76
  | UserOperationContext
77
- | undefined
77
+ | undefined,
78
78
  > = SmartAccountClientActions<chain, account, context> &
79
79
  AlchemySmartAccountClientActions<account, context>;
80
80
 
@@ -86,7 +86,7 @@ export type AlchemySmartAccountClient_Base<
86
86
  actions extends Record<string, unknown> = Record<string, unknown>,
87
87
  context extends UserOperationContext | undefined =
88
88
  | UserOperationContext
89
- | undefined
89
+ | undefined,
90
90
  > = Prettify<
91
91
  SmartAccountClient<
92
92
  AlchemyTransport,
@@ -106,7 +106,7 @@ export type AlchemySmartAccountClient<
106
106
  actions extends Record<string, unknown> = Record<string, unknown>,
107
107
  context extends UserOperationContext | undefined =
108
108
  | UserOperationContext
109
- | undefined
109
+ | undefined,
110
110
  > = Prettify<AlchemySmartAccountClient_Base<chain, account, actions, context>>;
111
111
 
112
112
  export function createAlchemySmartAccountClient<
@@ -116,9 +116,9 @@ export function createAlchemySmartAccountClient<
116
116
  | undefined,
117
117
  TContext extends UserOperationContext | undefined =
118
118
  | UserOperationContext
119
- | undefined
119
+ | undefined,
120
120
  >(
121
- params: AlchemySmartAccountClientConfig<TChain, TAccount, TContext>
121
+ params: AlchemySmartAccountClientConfig<TChain, TAccount, TContext>,
122
122
  ): AlchemySmartAccountClient<TChain, TAccount, Record<string, never>, TContext>;
123
123
 
124
124
  /**
@@ -139,7 +139,7 @@ export function createAlchemySmartAccountClient<
139
139
  * @returns {AlchemySmartAccountClient} An instance of `AlchemySmartAccountClient` configured based on the provided options
140
140
  */
141
141
  export function createAlchemySmartAccountClient(
142
- config: AlchemySmartAccountClientConfig
142
+ config: AlchemySmartAccountClientConfig,
143
143
  ): AlchemySmartAccountClient {
144
144
  if (!config.chain) {
145
145
  throw new ChainNotFoundError();
@@ -186,8 +186,8 @@ export function createAlchemySmartAccountClient(
186
186
  const newTransport = alchemy({ ...oldConfig });
187
187
  newTransport.updateHeaders(
188
188
  headersUpdate(breadcrumb)(
189
- convertHeadersToObject(dynamicFetchOptions?.headers)
190
- )
189
+ convertHeadersToObject(dynamicFetchOptions?.headers),
190
+ ),
191
191
  );
192
192
  return createAlchemySmartAccountClient({
193
193
  ...config,
@@ -27,7 +27,7 @@ export type AlchemyRpcSchema = [
27
27
  Method: "alchemy_requestGasAndPaymasterAndData";
28
28
  Parameters: RequestGasAndPaymasterAndDataRequest;
29
29
  ReturnType: RequestGasAndPaymasterAndDataResponse;
30
- }
30
+ },
31
31
  ];
32
32
 
33
33
  export type ClientWithAlchemyMethods = BundlerClient<AlchemyTransport> & {
package/src/defaults.ts CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  * @returns {UserOperationFeeOptions} An object containing the default fee options for user operations on the specified chain
25
25
  */
26
26
  export const getDefaultUserOperationFeeOptions = (
27
- chain: Chain
27
+ chain: Chain,
28
28
  ): UserOperationFeeOptions => {
29
29
  const feeOptions: UserOperationFeeOptions = {
30
30
  maxFeePerGas: { multiplier: 1.5 },
package/src/index.ts CHANGED
@@ -46,6 +46,9 @@ export {
46
46
  riseTestnet,
47
47
  storyMainnet,
48
48
  storyAeneid,
49
+ celoAlfajores,
50
+ celoMainnet,
51
+ teaSepolia,
49
52
  } from "./chains.js";
50
53
  export type * from "./client/decorators/alchemyEnhancedApis.js";
51
54
  export { alchemyEnhancedApiActions } from "./client/decorators/alchemyEnhancedApis.js";
package/src/metrics.ts CHANGED
@@ -10,7 +10,7 @@ export type InfraEventsSchema = [
10
10
  chainId: number;
11
11
  entryPoint: Address;
12
12
  };
13
- }
13
+ },
14
14
  ];
15
15
 
16
16
  export const InfraLogger = createLogger<InfraEventsSchema>({
@@ -30,7 +30,7 @@ import type { AlchemyTransport } from "../alchemyTransport";
30
30
  * @returns {ClientMiddlewareFn} A middleware function that takes a transaction structure and fee options, and returns the augmented structure with estimated fees
31
31
  */
32
32
  export const alchemyFeeEstimator: (
33
- transport: AlchemyTransport
33
+ transport: AlchemyTransport,
34
34
  ) => ClientMiddlewareFn =
35
35
  (transport) =>
36
36
  async (struct, { overrides, feeOptions, client: client_ }) => {
@@ -53,12 +53,12 @@ export const alchemyFeeEstimator: (
53
53
  const maxPriorityFeePerGas = applyUserOpOverrideOrFeeOption(
54
54
  maxPriorityFeePerGasEstimate,
55
55
  overrides?.maxPriorityFeePerGas,
56
- feeOptions?.maxPriorityFeePerGas
56
+ feeOptions?.maxPriorityFeePerGas,
57
57
  );
58
58
  const maxFeePerGas = applyUserOpOverrideOrFeeOption(
59
59
  bigIntMultiply(baseFeePerGas, 1.5) + BigInt(maxPriorityFeePerGas),
60
60
  overrides?.maxFeePerGas,
61
- feeOptions?.maxFeePerGas
61
+ feeOptions?.maxFeePerGas,
62
62
  );
63
63
 
64
64
  return {
@@ -71,13 +71,13 @@ type Context = {
71
71
  */
72
72
  export function alchemyGasManagerMiddleware(
73
73
  policyId: string | string[],
74
- policyToken?: PolicyToken
74
+ policyToken?: PolicyToken,
75
75
  ): Required<
76
76
  Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "paymasterAndData">
77
77
  > {
78
78
  const buildContext = async (
79
79
  uo: Parameters<ClientMiddlewareFn>[0],
80
- args: Parameters<ClientMiddlewareFn>[1]
80
+ args: Parameters<ClientMiddlewareFn>[1],
81
81
  ): Promise<Context> => {
82
82
  const context: Context = { policyId };
83
83
 
@@ -99,7 +99,7 @@ export function alchemyGasManagerMiddleware(
99
99
  client as AlchemySmartAccountClient,
100
100
  account,
101
101
  policyId,
102
- policyToken
102
+ policyToken,
103
103
  );
104
104
  }
105
105
  }
@@ -167,7 +167,7 @@ export type PolicyToken = {
167
167
  * @returns {Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "feeEstimator" | "gasEstimator" | "paymasterAndData">} partial client middleware configuration containing `dummyPaymasterAndData`, `feeEstimator`, `gasEstimator`, and `paymasterAndData`
168
168
  */
169
169
  export function alchemyGasAndPaymasterAndDataMiddleware(
170
- params: AlchemyGasAndPaymasterAndDataMiddlewareParams
170
+ params: AlchemyGasAndPaymasterAndDataMiddlewareParams,
171
171
  ): Pick<
172
172
  ClientMiddlewareConfig,
173
173
  "dummyPaymasterAndData" | "feeEstimator" | "gasEstimator" | "paymasterAndData"
@@ -194,26 +194,26 @@ export function alchemyGasAndPaymasterAndDataMiddleware(
194
194
  // Fall back to the default 7677 dummyPaymasterAndData middleware.
195
195
  return alchemyGasManagerMiddleware(
196
196
  policyId,
197
- policyToken
197
+ policyToken,
198
198
  ).dummyPaymasterAndData(uo, args);
199
199
  },
200
200
  feeEstimator: (uo, args) => {
201
201
  return feeEstimatorOverride
202
202
  ? feeEstimatorOverride(uo, args)
203
203
  : bypassPaymasterAndData(args.overrides)
204
- ? alchemyFeeEstimator(transport)(uo, args)
205
- : noopMiddleware(uo, args);
204
+ ? alchemyFeeEstimator(transport)(uo, args)
205
+ : noopMiddleware(uo, args);
206
206
  },
207
207
  gasEstimator: (uo, args) => {
208
208
  return gasEstimatorOverride
209
209
  ? gasEstimatorOverride(uo, args)
210
210
  : bypassPaymasterAndData(args.overrides)
211
- ? defaultGasEstimator(args.client)(uo, args)
212
- : noopMiddleware(uo, args);
211
+ ? defaultGasEstimator(args.client)(uo, args)
212
+ : noopMiddleware(uo, args);
213
213
  },
214
214
  paymasterAndData: async (
215
215
  uo,
216
- { account, client: client_, feeOptions, overrides: overrides_ }
216
+ { account, client: client_, feeOptions, overrides: overrides_ },
217
217
  ) => {
218
218
  const client = clientHeaderTrack(client_, "alchemyFeeEstimator");
219
219
  if (!client.chain) {
@@ -227,31 +227,31 @@ export function alchemyGasAndPaymasterAndDataMiddleware(
227
227
  "maxFeePerGas",
228
228
  overrides_ as UserOperationOverrides,
229
229
  feeOptions,
230
- userOp
230
+ userOp,
231
231
  ),
232
232
  maxPriorityFeePerGas: overrideField(
233
233
  "maxPriorityFeePerGas",
234
234
  overrides_ as UserOperationOverrides,
235
235
  feeOptions,
236
- userOp
236
+ userOp,
237
237
  ),
238
238
  callGasLimit: overrideField(
239
239
  "callGasLimit",
240
240
  overrides_ as UserOperationOverrides,
241
241
  feeOptions,
242
- userOp
242
+ userOp,
243
243
  ),
244
244
  verificationGasLimit: overrideField(
245
245
  "verificationGasLimit",
246
246
  overrides_ as UserOperationOverrides,
247
247
  feeOptions,
248
- userOp
248
+ userOp,
249
249
  ),
250
250
  preVerificationGas: overrideField(
251
251
  "preVerificationGas",
252
252
  overrides_ as UserOperationOverrides,
253
253
  feeOptions,
254
- userOp
254
+ userOp,
255
255
  ),
256
256
  ...(account.getEntryPoint().version === "0.7.0"
257
257
  ? {
@@ -259,13 +259,13 @@ export function alchemyGasAndPaymasterAndDataMiddleware(
259
259
  "paymasterVerificationGasLimit",
260
260
  overrides_ as UserOperationOverrides<"0.7.0">,
261
261
  feeOptions,
262
- userOp
262
+ userOp,
263
263
  ),
264
264
  paymasterPostOpGasLimit: overrideField<"0.7.0">(
265
265
  "paymasterPostOpGasLimit",
266
266
  overrides_ as UserOperationOverrides<"0.7.0">,
267
267
  feeOptions,
268
- userOp
268
+ userOp,
269
269
  ),
270
270
  }
271
271
  : {}),
@@ -284,7 +284,7 @@ export function alchemyGasAndPaymasterAndDataMiddleware(
284
284
  client,
285
285
  account,
286
286
  policyId,
287
- policyToken
287
+ policyToken,
288
288
  );
289
289
  }
290
290
  }
@@ -326,12 +326,12 @@ export function alchemyGasAndPaymasterAndDataMiddleware(
326
326
  * @returns {Hex | Multiplier | undefined} the overridden field value
327
327
  */
328
328
  const overrideField = <
329
- TEntryPointVersion extends EntryPointVersion = EntryPointVersion
329
+ TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
330
330
  >(
331
331
  field: keyof UserOperationFeeOptions<TEntryPointVersion>,
332
332
  overrides: UserOperationOverrides<TEntryPointVersion> | undefined,
333
333
  feeOptions: UserOperationFeeOptions<TEntryPointVersion> | undefined,
334
- userOperation: UserOperationRequest<TEntryPointVersion>
334
+ userOperation: UserOperationRequest<TEntryPointVersion>,
335
335
  ): Hex | Multiplier | undefined => {
336
336
  let _field = field as keyof UserOperationOverrides<TEntryPointVersion>;
337
337
 
@@ -380,7 +380,7 @@ const overrideField = <
380
380
  */
381
381
  const generateSignedPermit = async <
382
382
  TAccount extends SmartContractAccount,
383
- TEntryPointVersion extends EntryPointVersion = EntryPointVersion
383
+ TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
384
384
  >(
385
385
  userOp: UserOperationRequest<TEntryPointVersion>,
386
386
  client: MiddlewareClient,
@@ -392,7 +392,7 @@ const generateSignedPermit = async <
392
392
  approvalMode?: "NONE" | "PERMIT";
393
393
  erc20Name?: string;
394
394
  version?: string;
395
- }
395
+ },
396
396
  ): Promise<Hex> => {
397
397
  if (!client.chain) {
398
398
  throw new ChainNotFoundError();
@@ -451,8 +451,8 @@ const generateSignedPermit = async <
451
451
  const paymasterAddress = paymasterData.paymaster
452
452
  ? paymasterData.paymaster
453
453
  : paymasterData.paymasterAndData
454
- ? sliceHex(paymasterData.paymasterAndData, 0, 20)
455
- : undefined;
454
+ ? sliceHex(paymasterData.paymasterAndData, 0, 20)
455
+ : undefined;
456
456
 
457
457
  if (paymasterAddress === undefined || paymasterAddress === "0x") {
458
458
  throw new Error("no paymaster contract address available");
@@ -481,6 +481,6 @@ const generateSignedPermit = async <
481
481
  const signedPermit = await account.signTypedData(typedPermitData);
482
482
  return encodeAbiParameters(
483
483
  [{ type: "uint256" }, { type: "uint256" }, { type: "bytes" }],
484
- [maxAmountToken, deadline, signedPermit]
484
+ [maxAmountToken, deadline, signedPermit],
485
485
  );
486
486
  };
@@ -32,7 +32,7 @@ import type { AlchemyTransport } from "../alchemyTransport";
32
32
  export function alchemyUserOperationSimulator<
33
33
  TContext extends UserOperationContext | undefined =
34
34
  | UserOperationContext
35
- | undefined
35
+ | undefined,
36
36
  >(transport: AlchemyTransport): ClientMiddlewareFn<TContext> {
37
37
  return async (struct, { account, client }) => {
38
38
  const uoSimResult = await transport({ chain: client.chain }).request({
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "4.34.1";
3
+ export const VERSION = "4.35.1";