@account-kit/infra 4.44.0 → 4.46.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.
@@ -58,13 +58,23 @@ export type RequestGasAndPaymasterAndDataRequest = [
58
58
  export type RequestGasAndPaymasterAndDataResponse<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = Pick<UserOperationRequest, "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "maxFeePerGas" | "maxPriorityFeePerGas"> & (TEntryPointVersion extends "0.6.0" ? {
59
59
  paymasterAndData: UserOperationRequest<"0.6.0">["paymasterAndData"];
60
60
  } : TEntryPointVersion extends "0.7.0" ? Pick<UserOperationRequest<"0.7.0">, "paymaster" | "paymasterData" | "paymasterVerificationGasLimit" | "paymasterPostOpGasLimit"> : never);
61
- export type RequestPayamsterTokenQuoteRequest = [
61
+ export type RequestPaymasterTokenQuoteRequest = [
62
62
  {
63
63
  policyId: string;
64
- tokenAddress: Address;
64
+ entryPoint: Address;
65
+ erc20Context?: {
66
+ tokenAddress: Address;
67
+ permit?: Hex;
68
+ maxTokenAmount?: BigInt;
69
+ };
70
+ dummySignature: Hex;
71
+ userOperation: UserOperationRequest;
72
+ overrides?: UserOperationOverrides;
65
73
  }
66
74
  ];
67
- export type RequestPayamsterTokenQuoteResponse = {
68
- ethToTokenConversionRate: string;
75
+ export type RequestPaymasterTokenQuoteResponse = {
76
+ tokensPerEth: string;
77
+ estimatedTokenAmount: string;
78
+ estimatedUsd: number;
69
79
  };
70
80
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/actions/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC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tB,cAAc,GACd,sBAAsB,CACzB,GACC,CAAC,kBAAkB,SAAS,OAAO,GAC/B;IACE,gBAAgB,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,kBAAkB,CAAC,CAAC;CACrE,GACD,kBAAkB,SAAS,OAAO,GAChC,IAAI,CACF,oBAAoB,CAAC,OAAO,CAAC,EAC3B,WAAW,GACX,eAAe,GACf,+BAA+B,GAC/B,yBAAyB,CAC5B,GACD,KAAK,CAAC,CAAC;AAEf,MAAM,MAAM,iCAAiC,GAAG;IAC9C;QACE,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,OAAO,CAAC;QACpB,YAAY,CAAC,EAAE;YACb,YAAY,EAAE,OAAO,CAAC;YACtB,MAAM,CAAC,EAAE,GAAG,CAAC;YACb,cAAc,CAAC,EAAE,MAAM,CAAC;SACzB,CAAC;QACF,cAAc,EAAE,GAAG,CAAC;QACpB,aAAa,EAAE,oBAAoB,CAAC;QACpC,SAAS,CAAC,EAAE,sBAAsB,CAAC;KACpC;CACF,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { type BundlerClient, type Erc7677RpcSchema, type UserOperationRequest } from "@aa-sdk/core";
2
- import type { SimulateUserOperationAssetChangesRequest, SimulateUserOperationAssetChangesResponse, RequestGasAndPaymasterAndDataRequest, RequestGasAndPaymasterAndDataResponse, RequestPayamsterTokenQuoteRequest, RequestPayamsterTokenQuoteResponse } from "../actions/types";
2
+ import type { SimulateUserOperationAssetChangesRequest, SimulateUserOperationAssetChangesResponse, RequestGasAndPaymasterAndDataRequest, RequestGasAndPaymasterAndDataResponse, RequestPaymasterTokenQuoteRequest, RequestPaymasterTokenQuoteResponse } from "../actions/types";
3
3
  import type { AlchemyTransport } from "../alchemyTransport";
4
4
  export type AlchemyRpcSchema = [
5
5
  {
@@ -22,8 +22,8 @@ export type AlchemyRpcSchema = [
22
22
  },
23
23
  {
24
24
  Method: "alchemy_requestPaymasterTokenQuote";
25
- Parameters: RequestPayamsterTokenQuoteRequest;
26
- ReturnType: RequestPayamsterTokenQuoteResponse;
25
+ Parameters: RequestPaymasterTokenQuoteRequest;
26
+ ReturnType: RequestPaymasterTokenQuoteResponse;
27
27
  }
28
28
  ];
29
29
  export type ClientWithAlchemyMethods = BundlerClient<AlchemyTransport> & {
@@ -1,8 +1,14 @@
1
- import type { Address, Chain, Hex } from "viem";
1
+ import { type Address, type Chain, type Hex } from "viem";
2
+ import type { EntryPointVersion } from "@aa-sdk/core";
3
+ export declare const AlchemyPaymasterAddressV06Unify = "0x0000000000ce04e2359130e7d0204A5249958921";
4
+ export declare const AlchemyPaymasterAddressV07Unify = "0x00000000000667F27D4DB42334ec11a25db7EBb4";
5
+ export declare const AlchemyPaymasterAddressV4 = "0xEaf0Cde110a5d503f2dD69B3a49E031e29b3F9D2";
2
6
  export declare const AlchemyPaymasterAddressV3 = "0x4f84a207A80c39E9e8BaE717c1F25bA7AD1fB08F";
3
7
  export declare const AlchemyPaymasterAddressV2 = "0x4Fd9098af9ddcB41DA48A1d78F91F1398965addc";
4
8
  export declare const ArbSepoliaPaymasterAddress = "0x0804Afe6EEFb73ce7F93CD0d5e7079a5a8068592";
5
9
  export declare const AlchemyPaymasterAddressV1 = "0xc03aac639bb21233e0139381970328db8bceeb67";
10
+ export declare const AlchemyPaymasterAddressV07V2 = "0x2cc0c7981D846b9F2a16276556f6e8cb52BfB633";
11
+ export declare const AlchemyPaymasterAddressV07V1 = "0xEF725Aa22d43Ea69FB22bE2EBe6ECa205a6BCf5B";
6
12
  /**
7
13
  * Retrieves the Alchemy paymaster address for the given chain. Returns different addresses based on the chain ID.
8
14
  *
@@ -10,15 +16,14 @@ export declare const AlchemyPaymasterAddressV1 = "0xc03aac639bb21233e01393819703
10
16
  * ```ts
11
17
  * import { sepolia, getAlchemyPaymasterAddress } from "@account-kit/infra";
12
18
  *
13
- * const paymasterAddress = getAlchemyPaymasterAddress(sepolia);
19
+ * const paymasterAddress = getAlchemyPaymasterAddress(sepolia, "0.6.0");
14
20
  * ```
15
21
  *
16
22
  * @param {Chain} chain The chain for which the paymaster address is required
23
+ * @param {EntryPointVersion} version The version of the entry point
17
24
  * @returns {Address} The Alchemy paymaster address corresponding to the specified chain
18
- *
19
- * @deprecated This chain list in this function is no longer maintained since the ERC-7677 middleware is typically used to resolve the paymaster address
20
25
  */
21
- export declare const getAlchemyPaymasterAddress: (chain: Chain) => Address;
26
+ export declare const getAlchemyPaymasterAddress: (chain: Chain, version: EntryPointVersion) => Address;
22
27
  export declare const PermitTypes: {
23
28
  readonly EIP712Domain: readonly [{
24
29
  readonly name: "name";
@@ -50,7 +55,9 @@ export declare const PermitTypes: {
50
55
  readonly type: "uint256";
51
56
  }];
52
57
  };
53
- export declare const EIP712NoncesAbi: readonly ["function nonces(address owner) external view returns (uint)", "function decimals() public view returns (uint8)", "function balanceOf(address owner) external view returns (uint256)", "function allowance(address owner, address spender) external view returns (uint256)"];
58
+ export declare const ERC20Abis: readonly ["function decimals() public view returns (uint8)", "function balanceOf(address owner) external view returns (uint256)", "function allowance(address owner, address spender) external view returns (uint256)", "function approve(address spender, uint256 amount) external returns (bool)"];
59
+ export declare const EIP7597Abis: readonly ["function nonces(address owner) external view returns (uint)"];
60
+ export declare const approveTokenCallData: (paymasterAddress: Address, allowance: BigInt) => `0x${string}`;
54
61
  export type PermitMessage = {
55
62
  owner: Hex;
56
63
  spender: Hex;
@@ -1 +1 @@
1
- {"version":3,"file":"gas-manager.d.ts","sourceRoot":"","sources":["../../src/gas-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAmBhD,eAAO,MAAM,yBAAyB,+CACQ,CAAC;AAC/C,eAAO,MAAM,yBAAyB,+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CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,0BAA0B,GACrC,OAAO,KAAK,EACZ,SAAS,iBAAiB,KACzB,OA0GF,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcd,CAAC;AAEX,eAAO,MAAM,SAAS,sSAKZ,CAAC;AAEX,eAAO,MAAM,WAAW,0EAEd,CAAC;AAEX,eAAO,MAAM,oBAAoB,GAC/B,kBAAkB,OAAO,EACzB,WAAW,MAAM,kBAOlB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,GAAG,CAAC;CACxB,CAAC"}
@@ -31,6 +31,7 @@ interface AlchemyGasAndPaymasterAndDataMiddlewareParams {
31
31
  export type PolicyToken = {
32
32
  address: Address;
33
33
  maxTokenAmount: bigint;
34
+ paymasterAddress?: Address;
34
35
  approvalMode?: "NONE" | "PERMIT";
35
36
  erc20Name?: string;
36
37
  version?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"gasManager.d.ts","sourceRoot":"","sources":["../../../src/middleware/gasManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,sBAAsB,EACtB,kBAAkB,EAQnB,MAAM,cAAc,CAAC;AAyBtB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAe/D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,E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AQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,oBAAoB,CAAC,EAAE,kBAAkB,CAAC;IAC1C,oBAAoB,CAAC,EAAE,kBAAkB,CAAC;CAC3C;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,uCAAuC,CACrD,MAAM,EAAE,6CAA6C,GACpD,IAAI,CACL,sBAAsB,EACtB,uBAAuB,GAAG,cAAc,GAAG,cAAc,GAAG,kBAAkB,CAC/E,CA4IA"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.44.0";
1
+ export declare const VERSION = "4.46.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@account-kit/infra",
3
- "version": "4.44.0",
3
+ "version": "4.46.0",
4
4
  "description": "adapters for @aa-sdk/core for interacting with alchemy services",
5
5
  "author": "Alchemy",
6
6
  "license": "MIT",
@@ -43,8 +43,8 @@
43
43
  "typescript-template": "*"
44
44
  },
45
45
  "dependencies": {
46
- "@aa-sdk/core": "^4.44.0",
47
- "@account-kit/logging": "^4.44.0",
46
+ "@aa-sdk/core": "^4.46.0",
47
+ "@account-kit/logging": "^4.46.0",
48
48
  "eventemitter3": "^5.0.1",
49
49
  "zod": "^3.22.4"
50
50
  },
@@ -63,7 +63,7 @@
63
63
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
64
64
  },
65
65
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
66
- "gitHead": "29c87d1385f13cffcb55e6286bfaeb26637d5fe9",
66
+ "gitHead": "fb516cc1ba7059a257fb329fb8663c7cc90947bb",
67
67
  "optionalDependencies": {
68
68
  "alchemy-sdk": "^3.0.0"
69
69
  }
@@ -92,13 +92,23 @@ export type RequestGasAndPaymasterAndDataResponse<
92
92
  >
93
93
  : never);
94
94
 
95
- export type RequestPayamsterTokenQuoteRequest = [
95
+ export type RequestPaymasterTokenQuoteRequest = [
96
96
  {
97
97
  policyId: string;
98
- tokenAddress: Address;
98
+ entryPoint: Address;
99
+ erc20Context?: {
100
+ tokenAddress: Address;
101
+ permit?: Hex;
102
+ maxTokenAmount?: BigInt;
103
+ };
104
+ dummySignature: Hex;
105
+ userOperation: UserOperationRequest;
106
+ overrides?: UserOperationOverrides;
99
107
  },
100
108
  ];
101
109
 
102
- export type RequestPayamsterTokenQuoteResponse = {
103
- ethToTokenConversionRate: string;
110
+ export type RequestPaymasterTokenQuoteResponse = {
111
+ tokensPerEth: string;
112
+ estimatedTokenAmount: string;
113
+ estimatedUsd: number;
104
114
  };
@@ -8,8 +8,8 @@ import type {
8
8
  SimulateUserOperationAssetChangesResponse,
9
9
  RequestGasAndPaymasterAndDataRequest,
10
10
  RequestGasAndPaymasterAndDataResponse,
11
- RequestPayamsterTokenQuoteRequest,
12
- RequestPayamsterTokenQuoteResponse,
11
+ RequestPaymasterTokenQuoteRequest,
12
+ RequestPaymasterTokenQuoteResponse,
13
13
  } from "../actions/types";
14
14
  import type { AlchemyTransport } from "../alchemyTransport";
15
15
 
@@ -32,8 +32,8 @@ export type AlchemyRpcSchema = [
32
32
  },
33
33
  {
34
34
  Method: "alchemy_requestPaymasterTokenQuote";
35
- Parameters: RequestPayamsterTokenQuoteRequest;
36
- ReturnType: RequestPayamsterTokenQuoteResponse;
35
+ Parameters: RequestPaymasterTokenQuoteRequest;
36
+ ReturnType: RequestPaymasterTokenQuoteResponse;
37
37
  },
38
38
  ];
39
39
 
@@ -1,4 +1,4 @@
1
- import type { Address, Chain, Hex } from "viem";
1
+ import { encodeFunctionData, type Address, type Chain, type Hex } from "viem";
2
2
  import {
3
3
  arbitrum,
4
4
  arbitrumSepolia,
@@ -11,12 +11,46 @@ import {
11
11
  optimismSepolia,
12
12
  polygon,
13
13
  polygonAmoy,
14
- polygonMumbai,
14
+ unichainSepolia,
15
+ worldChainSepolia,
15
16
  sepolia,
16
17
  zora,
17
18
  zoraSepolia,
19
+ shapeSepolia,
20
+ optimismGoerli,
21
+ arbitrumGoerli,
22
+ arbitrumNova,
23
+ baseGoerli,
24
+ beraChainBartio,
25
+ celoAlfajores,
26
+ celoMainnet,
27
+ gensynTestnet,
28
+ goerli,
29
+ inkMainnet,
30
+ inkSepolia,
31
+ monadTestnet,
32
+ opbnbMainnet,
33
+ opbnbTestnet,
34
+ openlootSepolia,
35
+ polygonMumbai,
36
+ riseTestnet,
37
+ shape,
38
+ soneiumMainnet,
39
+ soneiumMinato,
40
+ storyAeneid,
41
+ storyMainnet,
42
+ teaSepolia,
43
+ unichainMainnet,
44
+ worldChain,
18
45
  } from "./chains.js";
46
+ import type { EntryPointVersion } from "@aa-sdk/core";
47
+ export const AlchemyPaymasterAddressV06Unify =
48
+ "0x0000000000ce04e2359130e7d0204A5249958921";
49
+ export const AlchemyPaymasterAddressV07Unify =
50
+ "0x00000000000667F27D4DB42334ec11a25db7EBb4";
19
51
 
52
+ export const AlchemyPaymasterAddressV4 =
53
+ "0xEaf0Cde110a5d503f2dD69B3a49E031e29b3F9D2";
20
54
  export const AlchemyPaymasterAddressV3 =
21
55
  "0x4f84a207A80c39E9e8BaE717c1F25bA7AD1fB08F";
22
56
  export const AlchemyPaymasterAddressV2 =
@@ -26,6 +60,11 @@ export const ArbSepoliaPaymasterAddress =
26
60
  export const AlchemyPaymasterAddressV1 =
27
61
  "0xc03aac639bb21233e0139381970328db8bceeb67";
28
62
 
63
+ export const AlchemyPaymasterAddressV07V2 =
64
+ "0x2cc0c7981D846b9F2a16276556f6e8cb52BfB633";
65
+ export const AlchemyPaymasterAddressV07V1 =
66
+ "0xEF725Aa22d43Ea69FB22bE2EBe6ECa205a6BCf5B";
67
+
29
68
  /**
30
69
  * Retrieves the Alchemy paymaster address for the given chain. Returns different addresses based on the chain ID.
31
70
  *
@@ -33,37 +72,121 @@ export const AlchemyPaymasterAddressV1 =
33
72
  * ```ts
34
73
  * import { sepolia, getAlchemyPaymasterAddress } from "@account-kit/infra";
35
74
  *
36
- * const paymasterAddress = getAlchemyPaymasterAddress(sepolia);
75
+ * const paymasterAddress = getAlchemyPaymasterAddress(sepolia, "0.6.0");
37
76
  * ```
38
77
  *
39
78
  * @param {Chain} chain The chain for which the paymaster address is required
79
+ * @param {EntryPointVersion} version The version of the entry point
40
80
  * @returns {Address} The Alchemy paymaster address corresponding to the specified chain
41
- *
42
- * @deprecated This chain list in this function is no longer maintained since the ERC-7677 middleware is typically used to resolve the paymaster address
43
81
  */
44
- export const getAlchemyPaymasterAddress = (chain: Chain): Address => {
45
- switch (chain.id) {
46
- case polygonAmoy.id:
47
- case optimismSepolia.id:
48
- case baseSepolia.id:
49
- case zora.id:
50
- case zoraSepolia.id:
51
- case fraxtal.id:
52
- case fraxtalSepolia.id:
53
- return AlchemyPaymasterAddressV3;
54
- case mainnet.id:
55
- case arbitrum.id:
56
- case optimism.id:
57
- case polygon.id:
58
- case base.id:
59
- return AlchemyPaymasterAddressV2;
60
- case arbitrumSepolia.id:
61
- return ArbSepoliaPaymasterAddress;
62
- case sepolia.id:
63
- case polygonMumbai.id:
64
- return AlchemyPaymasterAddressV1;
82
+ export const getAlchemyPaymasterAddress = (
83
+ chain: Chain,
84
+ version: EntryPointVersion,
85
+ ): Address => {
86
+ switch (version) {
87
+ case "0.6.0":
88
+ switch (chain.id) {
89
+ case fraxtalSepolia.id:
90
+ case worldChainSepolia.id:
91
+ case shapeSepolia.id:
92
+ case unichainSepolia.id:
93
+ case opbnbTestnet.id:
94
+ case inkSepolia.id:
95
+ case monadTestnet.id:
96
+ case openlootSepolia.id:
97
+ case gensynTestnet.id:
98
+ case riseTestnet.id:
99
+ case storyAeneid.id:
100
+ case teaSepolia.id:
101
+ case arbitrumGoerli.id:
102
+ case goerli.id:
103
+ case optimismGoerli.id:
104
+ case baseGoerli.id:
105
+ case polygonMumbai.id:
106
+ case worldChain.id:
107
+ case shape.id:
108
+ case unichainMainnet.id:
109
+ case soneiumMinato.id:
110
+ case soneiumMainnet.id:
111
+ case opbnbMainnet.id:
112
+ case beraChainBartio.id:
113
+ case inkMainnet.id:
114
+ case arbitrumNova.id:
115
+ case storyMainnet.id:
116
+ case celoAlfajores.id:
117
+ case celoMainnet.id:
118
+ return AlchemyPaymasterAddressV4;
119
+ case polygonAmoy.id:
120
+ case optimismSepolia.id:
121
+ case baseSepolia.id:
122
+ case zora.id:
123
+ case zoraSepolia.id:
124
+ case fraxtal.id:
125
+ return AlchemyPaymasterAddressV3;
126
+ case mainnet.id:
127
+ case arbitrum.id:
128
+ case optimism.id:
129
+ case polygon.id:
130
+ case base.id:
131
+ return AlchemyPaymasterAddressV2;
132
+ case arbitrumSepolia.id:
133
+ return ArbSepoliaPaymasterAddress;
134
+ case sepolia.id:
135
+ return AlchemyPaymasterAddressV1;
136
+ default:
137
+ return AlchemyPaymasterAddressV06Unify;
138
+ }
139
+ case "0.7.0":
140
+ switch (chain.id) {
141
+ case arbitrumNova.id:
142
+ case celoAlfajores.id:
143
+ case celoMainnet.id:
144
+ case gensynTestnet.id:
145
+ case inkMainnet.id:
146
+ case inkSepolia.id:
147
+ case monadTestnet.id:
148
+ case opbnbMainnet.id:
149
+ case opbnbTestnet.id:
150
+ case openlootSepolia.id:
151
+ case riseTestnet.id:
152
+ case shape.id:
153
+ case shapeSepolia.id:
154
+ case soneiumMainnet.id:
155
+ case soneiumMinato.id:
156
+ case storyAeneid.id:
157
+ case storyMainnet.id:
158
+ case teaSepolia.id:
159
+ case unichainMainnet.id:
160
+ case unichainSepolia.id:
161
+ case worldChain.id:
162
+ case worldChainSepolia.id:
163
+ return AlchemyPaymasterAddressV07V1;
164
+ case arbitrum.id:
165
+ case arbitrumGoerli.id:
166
+ case arbitrumSepolia.id:
167
+ case base.id:
168
+ case baseGoerli.id:
169
+ case baseSepolia.id:
170
+ case beraChainBartio.id:
171
+ case fraxtal.id:
172
+ case fraxtalSepolia.id:
173
+ case goerli.id:
174
+ case mainnet.id:
175
+ case optimism.id:
176
+ case optimismGoerli.id:
177
+ case optimismSepolia.id:
178
+ case polygon.id:
179
+ case polygonAmoy.id:
180
+ case polygonMumbai.id:
181
+ case sepolia.id:
182
+ case zora.id:
183
+ case zoraSepolia.id:
184
+ return AlchemyPaymasterAddressV07V2;
185
+ default:
186
+ return AlchemyPaymasterAddressV07Unify;
187
+ }
65
188
  default:
66
- throw new Error(`Unsupported chain: ${chain}`);
189
+ throw new Error(`Unsupported EntryPointVersion: ${version}`);
67
190
  }
68
191
  };
69
192
 
@@ -83,13 +206,28 @@ export const PermitTypes = {
83
206
  ],
84
207
  } as const;
85
208
 
86
- export const EIP712NoncesAbi = [
87
- "function nonces(address owner) external view returns (uint)",
209
+ export const ERC20Abis = [
88
210
  "function decimals() public view returns (uint8)",
89
211
  "function balanceOf(address owner) external view returns (uint256)",
90
212
  "function allowance(address owner, address spender) external view returns (uint256)",
213
+ "function approve(address spender, uint256 amount) external returns (bool)",
91
214
  ] as const;
92
215
 
216
+ export const EIP7597Abis = [
217
+ "function nonces(address owner) external view returns (uint)",
218
+ ] as const;
219
+
220
+ export const approveTokenCallData = (
221
+ paymasterAddress: Address,
222
+ allowance: BigInt,
223
+ ) => {
224
+ return encodeFunctionData({
225
+ abi: ERC20Abis,
226
+ functionName: "approve",
227
+ args: [paymasterAddress, allowance],
228
+ });
229
+ };
230
+
93
231
  export type PermitMessage = {
94
232
  owner: Hex;
95
233
  spender: Hex;
@@ -3,7 +3,6 @@ import type {
3
3
  ClientMiddlewareConfig,
4
4
  ClientMiddlewareFn,
5
5
  EntryPointVersion,
6
- Erc7677Client,
7
6
  Multiplier,
8
7
  SmartContractAccount,
9
8
  UserOperationFeeOptions,
@@ -26,18 +25,21 @@ import {
26
25
  import {
27
26
  fromHex,
28
27
  isHex,
29
- toHex,
30
28
  type Hex,
31
29
  encodeAbiParameters,
32
30
  encodeFunctionData,
33
31
  parseAbi,
34
- sliceHex,
35
32
  } from "viem";
36
33
  import type { AlchemySmartAccountClient } from "../client/smartAccountClient.js";
37
34
  import type { AlchemyTransport } from "../alchemyTransport.js";
38
35
  import { alchemyFeeEstimator } from "./feeEstimator.js";
39
36
  import type { RequestGasAndPaymasterAndDataRequest } from "../actions/types.js";
40
- import { PermitTypes, EIP712NoncesAbi } from "../gas-manager.js";
37
+ import {
38
+ PermitTypes,
39
+ EIP7597Abis,
40
+ ERC20Abis,
41
+ getAlchemyPaymasterAddress,
42
+ } from "../gas-manager.js";
41
43
  import type { PermitMessage, PermitDomain } from "../gas-manager.js";
42
44
  import type { MiddlewareClient } from "../../../../aa-sdk/core/dist/types/middleware/actions.js";
43
45
 
@@ -76,7 +78,6 @@ export function alchemyGasManagerMiddleware(
76
78
  Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "paymasterAndData">
77
79
  > {
78
80
  const buildContext = async (
79
- uo: Parameters<ClientMiddlewareFn>[0],
80
81
  args: Parameters<ClientMiddlewareFn>[1],
81
82
  ): Promise<Context> => {
82
83
  const context: Context = { policyId };
@@ -87,7 +88,6 @@ export function alchemyGasManagerMiddleware(
87
88
  }
88
89
 
89
90
  if (policyToken !== undefined) {
90
- const userOp = await deepHexlify(await resolveProperties(uo));
91
91
  context.erc20Context = {
92
92
  tokenAddress: policyToken.address,
93
93
  maxTokenAmount: policyToken.maxTokenAmount,
@@ -95,10 +95,8 @@ export function alchemyGasManagerMiddleware(
95
95
 
96
96
  if (policyToken.approvalMode === "PERMIT") {
97
97
  context.erc20Context.permit = await generateSignedPermit(
98
- userOp,
99
98
  client as AlchemySmartAccountClient,
100
99
  account,
101
- policyId,
102
100
  policyToken,
103
101
  );
104
102
  }
@@ -108,13 +106,13 @@ export function alchemyGasManagerMiddleware(
108
106
  };
109
107
  return {
110
108
  dummyPaymasterAndData: async (uo, args) => {
111
- const context = await buildContext(uo, args);
109
+ const context = await buildContext(args);
112
110
  const baseMiddleware = erc7677Middleware({ context });
113
111
  return baseMiddleware.dummyPaymasterAndData(uo, args);
114
112
  },
115
113
 
116
114
  paymasterAndData: async (uo, args) => {
117
- const context = await buildContext(uo, args);
115
+ const context = await buildContext(args);
118
116
  const baseMiddleware = erc7677Middleware({ context });
119
117
  return baseMiddleware.paymasterAndData(uo, args);
120
118
  },
@@ -132,6 +130,7 @@ interface AlchemyGasAndPaymasterAndDataMiddlewareParams {
132
130
  export type PolicyToken = {
133
131
  address: Address;
134
132
  maxTokenAmount: bigint;
133
+ paymasterAddress?: Address;
135
134
  approvalMode?: "NONE" | "PERMIT";
136
135
  erc20Name?: string;
137
136
  version?: string;
@@ -280,10 +279,8 @@ export function alchemyGasAndPaymasterAndDataMiddleware(
280
279
  };
281
280
  if (policyToken.approvalMode === "PERMIT") {
282
281
  erc20Context.permit = await generateSignedPermit(
283
- userOp,
284
282
  client,
285
283
  account,
286
- policyId,
287
284
  policyToken,
288
285
  );
289
286
  }
@@ -366,29 +363,24 @@ const overrideField = <
366
363
  /**
367
364
  * Utility function to generate a signed Permit for erc20 transaction
368
365
  *
369
- * @param {UserOperationRequest<TEntryPointVersion>} userOp - The user operation request
370
366
  * @param {MiddlewareClient} client - The Alchemy smart account client
371
367
  * @param {TAccount} account - The smart account instance
372
- * @param {string | string[]} policyId - The policy ID or array of policy IDs
373
368
  * @param {PolicyToken} policyToken - The policy token configuration
374
369
  * @param {Address} policyToken.address - ERC20 contract addressya
375
370
  * @param {bigint} [policyToken.maxTokenAmount] - Optional ERC20 token limit
371
+ * @param {Address} [policyToken.paymasterAddress] - Optional Paymaster Address
376
372
  * @param {"NONE" | "PERMIT"} [policyToken.approvalMode] - ERC20 approve mode
377
373
  * @param {string} [policyToken.erc20Name] - EIP2612 specified ERC20 contract name
378
374
  * @param {string} [policyToken.version] - EIP2612 specified ERC20 contract version
379
375
  * @returns {Promise<Hex>} Returns a Promise containing the signed EIP2612 permit
380
376
  */
381
- const generateSignedPermit = async <
382
- TAccount extends SmartContractAccount,
383
- TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
384
- >(
385
- userOp: UserOperationRequest<TEntryPointVersion>,
377
+ const generateSignedPermit = async <TAccount extends SmartContractAccount>(
386
378
  client: MiddlewareClient,
387
379
  account: TAccount,
388
- policyId: string | string[],
389
380
  policyToken: {
390
381
  address: Address;
391
382
  maxTokenAmount: bigint;
383
+ paymasterAddress?: Address;
392
384
  approvalMode?: "NONE" | "PERMIT";
393
385
  erc20Name?: string;
394
386
  version?: string;
@@ -404,7 +396,7 @@ const generateSignedPermit = async <
404
396
  let decimalsFuture = client.call({
405
397
  to: policyToken.address,
406
398
  data: encodeFunctionData({
407
- abi: parseAbi(EIP712NoncesAbi),
399
+ abi: parseAbi(ERC20Abis),
408
400
  functionName: "decimals",
409
401
  args: [],
410
402
  }),
@@ -413,28 +405,15 @@ const generateSignedPermit = async <
413
405
  let nonceFuture = client.call({
414
406
  to: policyToken.address,
415
407
  data: encodeFunctionData({
416
- abi: parseAbi(EIP712NoncesAbi),
408
+ abi: parseAbi(EIP7597Abis),
417
409
  functionName: "nonces",
418
410
  args: [account.address],
419
411
  }),
420
412
  });
421
413
 
422
- let paymasterDataFuture = (client as Erc7677Client).request({
423
- method: "pm_getPaymasterStubData",
424
- params: [
425
- userOp,
426
- account.getEntryPoint().address,
427
- toHex(client.chain.id),
428
- {
429
- policyId: Array.isArray(policyId) ? policyId[0] : policyId,
430
- },
431
- ],
432
- });
433
-
434
- const [decimalsResponse, nonceResponse, paymasterData] = await Promise.all([
414
+ const [decimalsResponse, nonceResponse] = await Promise.all([
435
415
  decimalsFuture,
436
416
  nonceFuture,
437
- paymasterDataFuture,
438
417
  ]);
439
418
  if (!decimalsResponse.data) {
440
419
  throw new Error("No decimals returned from erc20 contract call");
@@ -448,11 +427,9 @@ const generateSignedPermit = async <
448
427
  const maxAmountToken = policyToken.maxTokenAmount * decimals;
449
428
  const nonce = BigInt(nonceResponse.data);
450
429
 
451
- const paymasterAddress = paymasterData.paymaster
452
- ? paymasterData.paymaster
453
- : paymasterData.paymasterAndData
454
- ? sliceHex(paymasterData.paymasterAndData, 0, 20)
455
- : undefined;
430
+ const paymasterAddress =
431
+ policyToken.paymasterAddress ??
432
+ getAlchemyPaymasterAddress(client.chain, account.getEntryPoint().version);
456
433
 
457
434
  if (paymasterAddress === undefined || paymasterAddress === "0x") {
458
435
  throw new Error("no paymaster contract address available");
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.44.0";
3
+ export const VERSION = "4.46.0";