@zerodev/sdk 4.0.28 → 4.0.30

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 (40) hide show
  1. package/dist/cjs/index.d.ts +1 -1
  2. package/dist/cjs/index.js +3 -1
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/kernel-zerodev/abis/ERC20Abi.d.ts +231 -39
  5. package/dist/cjs/kernel-zerodev/abis/ERC20Abi.js.map +1 -1
  6. package/dist/cjs/kernel-zerodev/paymaster/token-paymaster.js +5 -1
  7. package/dist/cjs/kernel-zerodev/paymaster/token-paymaster.js.map +1 -1
  8. package/dist/cjs/kernel-zerodev/validator/session-key-validator.d.ts +11 -6
  9. package/dist/cjs/kernel-zerodev/validator/session-key-validator.js +81 -5
  10. package/dist/cjs/kernel-zerodev/validator/session-key-validator.js.map +1 -1
  11. package/dist/cjs/kernel-zerodev/validator/types.d.ts +27 -1
  12. package/dist/cjs/kernel-zerodev/validator/types.js.map +1 -1
  13. package/dist/esm/index.d.ts +1 -1
  14. package/dist/esm/index.js +1 -1
  15. package/dist/esm/index.js.map +1 -1
  16. package/dist/esm/kernel-zerodev/abis/ERC20Abi.d.ts +231 -39
  17. package/dist/esm/kernel-zerodev/abis/ERC20Abi.js.map +1 -1
  18. package/dist/esm/kernel-zerodev/paymaster/token-paymaster.js +5 -1
  19. package/dist/esm/kernel-zerodev/paymaster/token-paymaster.js.map +1 -1
  20. package/dist/esm/kernel-zerodev/validator/session-key-validator.d.ts +11 -6
  21. package/dist/esm/kernel-zerodev/validator/session-key-validator.js +78 -4
  22. package/dist/esm/kernel-zerodev/validator/session-key-validator.js.map +1 -1
  23. package/dist/esm/kernel-zerodev/validator/types.d.ts +27 -1
  24. package/dist/esm/kernel-zerodev/validator/types.js +2 -1
  25. package/dist/esm/kernel-zerodev/validator/types.js.map +1 -1
  26. package/dist/types/index.d.ts +1 -1
  27. package/dist/types/index.d.ts.map +1 -1
  28. package/dist/types/kernel-zerodev/abis/ERC20Abi.d.ts +231 -39
  29. package/dist/types/kernel-zerodev/abis/ERC20Abi.d.ts.map +1 -1
  30. package/dist/types/kernel-zerodev/paymaster/token-paymaster.d.ts.map +1 -1
  31. package/dist/types/kernel-zerodev/validator/session-key-validator.d.ts +11 -6
  32. package/dist/types/kernel-zerodev/validator/session-key-validator.d.ts.map +1 -1
  33. package/dist/types/kernel-zerodev/validator/types.d.ts +27 -1
  34. package/dist/types/kernel-zerodev/validator/types.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/src/index.ts +5 -1
  37. package/src/kernel-zerodev/abis/ERC20Abi.ts +1 -1
  38. package/src/kernel-zerodev/paymaster/token-paymaster.ts +8 -1
  39. package/src/kernel-zerodev/validator/session-key-validator.ts +111 -9
  40. package/src/kernel-zerodev/validator/types.ts +64 -0
@@ -3,7 +3,7 @@ export { ValidatorMode, KernelBaseValidator, } from "./kernel-zerodev/validator/
3
3
  export * from "./kernel-zerodev/validator/index.js";
4
4
  export type * from "./kernel-zerodev/validator/types.js";
5
5
  export type { KernelBaseValidatorParams } from "./kernel-zerodev/validator/base.js";
6
- export { ParamCondition } from "./kernel-zerodev/validator/session-key-validator.js";
6
+ export { ParamCondition, getAbiItem, getPermissionFromABI, } from "./kernel-zerodev/validator/session-key-validator.js";
7
7
  export { ValidatorProvider } from "./kernel-zerodev/validator-provider/base.js";
8
8
  export type { ValidatorProviderParams, ValidatorProviderParamsOpts, ExtendedValidatorProviderParams, } from "./kernel-zerodev/validator-provider/base.js";
9
9
  export type * from "./kernel-zerodev/validator-provider/types.js";
package/dist/cjs/index.js CHANGED
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
26
  return result;
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.constants = exports.EmptyAccountSigner = exports.ZeroDevAccountSigner = exports.ZeroDevEthersProvider = exports.getChainId = exports.Operation = exports.ZeroDevProvider = exports.KernelSmartContractAccount = exports.ValidatorProvider = exports.ParamCondition = exports.KernelBaseValidator = exports.ValidatorMode = void 0;
29
+ exports.constants = exports.EmptyAccountSigner = exports.ZeroDevAccountSigner = exports.ZeroDevEthersProvider = exports.getChainId = exports.Operation = exports.ZeroDevProvider = exports.KernelSmartContractAccount = exports.ValidatorProvider = exports.getPermissionFromABI = exports.getAbiItem = exports.ParamCondition = exports.KernelBaseValidator = exports.ValidatorMode = void 0;
30
30
  __exportStar(require("./kernel-zerodev/abis/index.js"), exports);
31
31
  var base_js_1 = require("./kernel-zerodev/validator/base.js");
32
32
  Object.defineProperty(exports, "ValidatorMode", { enumerable: true, get: function () { return base_js_1.ValidatorMode; } });
@@ -34,6 +34,8 @@ Object.defineProperty(exports, "KernelBaseValidator", { enumerable: true, get: f
34
34
  __exportStar(require("./kernel-zerodev/validator/index.js"), exports);
35
35
  var session_key_validator_js_1 = require("./kernel-zerodev/validator/session-key-validator.js");
36
36
  Object.defineProperty(exports, "ParamCondition", { enumerable: true, get: function () { return session_key_validator_js_1.ParamCondition; } });
37
+ Object.defineProperty(exports, "getAbiItem", { enumerable: true, get: function () { return session_key_validator_js_1.getAbiItem; } });
38
+ Object.defineProperty(exports, "getPermissionFromABI", { enumerable: true, get: function () { return session_key_validator_js_1.getPermissionFromABI; } });
37
39
  var base_js_2 = require("./kernel-zerodev/validator-provider/base.js");
38
40
  Object.defineProperty(exports, "ValidatorProvider", { enumerable: true, get: function () { return base_js_2.ValidatorProvider; } });
39
41
  __exportStar(require("./kernel-zerodev/validator-provider/index.js"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,iEAA+C;AAG/C,8DAG4C;AAF1C,wGAAA,aAAa,OAAA;AACb,8GAAA,mBAAmB,OAAA;AAErB,sEAAoD;AAGpD,gGAAqF;AAA5E,0HAAA,cAAc,OAAA;AAGvB,uEAAgF;AAAvE,4GAAA,iBAAiB,OAAA;AAO1B,+EAA6D;AAI7D,0DAAyE;AAAhE,wHAAA,0BAA0B,OAAA;AAEnC,4DAA0E;AAAjE,8GAAA,eAAe,OAAA;AAAE,wGAAA,SAAS,OAAA;AAGnC,4DAA0C;AAC1C,0DAA2D;AAAlD,sGAAA,UAAU,OAAA;AACnB,0FAA4F;AAAnF,2HAAA,qBAAqB,OAAA;AAC9B,wFAA0F;AAAjF,yHAAA,oBAAoB,OAAA;AAC7B,6EAA8E;AAArE,sHAAA,kBAAkB,OAAA;AAG3B,2EAA2D;AAG3D,kEAAgD","sourcesContent":["// Add you exports here, make sure to export types separately from impls and use the `type` keyword when exporting them\n// Don't use wildcard exports, instead use named exports\n\n//kernel exports\nexport * from \"./kernel-zerodev/abis/index.js\";\n\n// Validator exports\nexport {\n ValidatorMode,\n KernelBaseValidator,\n} from \"./kernel-zerodev/validator/base.js\";\nexport * from \"./kernel-zerodev/validator/index.js\";\nexport type * from \"./kernel-zerodev/validator/types.js\";\nexport type { KernelBaseValidatorParams } from \"./kernel-zerodev/validator/base.js\";\nexport { ParamCondition } from \"./kernel-zerodev/validator/session-key-validator.js\";\n\n// Validator Provider exports\nexport { ValidatorProvider } from \"./kernel-zerodev/validator-provider/base.js\";\nexport type {\n ValidatorProviderParams,\n ValidatorProviderParamsOpts,\n ExtendedValidatorProviderParams,\n} from \"./kernel-zerodev/validator-provider/base.js\";\nexport type * from \"./kernel-zerodev/validator-provider/types.js\";\nexport * from \"./kernel-zerodev/validator-provider/index.js\";\n\n// Core exports\nexport type * from \"./kernel-zerodev/paymaster/types.js\";\nexport { KernelSmartContractAccount } from \"./kernel-zerodev/account.js\";\nexport type { KernelSmartAccountParams } from \"./kernel-zerodev/account.js\";\nexport { ZeroDevProvider, Operation } from \"./kernel-zerodev/provider.js\";\n\n// Utils exports\nexport * from \"./kernel-zerodev/utils.js\";\nexport { getChainId } from \"./kernel-zerodev/api/index.js\";\nexport { ZeroDevEthersProvider } from \"./kernel-zerodev/ethers-provider/ethers-provider.js\";\nexport { ZeroDevAccountSigner } from \"./kernel-zerodev/ethers-provider/account-signer.js\";\nexport { EmptyAccountSigner } from \"./kernel-zerodev/signer/empty-account.js\";\n\n// Constant exports\nexport * as constants from \"./kernel-zerodev/constants.js\";\n\n// Owner exports\nexport * from \"./kernel-zerodev/owner/index.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,iEAA+C;AAG/C,8DAG4C;AAF1C,wGAAA,aAAa,OAAA;AACb,8GAAA,mBAAmB,OAAA;AAErB,sEAAoD;AAGpD,gGAI6D;AAH3D,0HAAA,cAAc,OAAA;AACd,sHAAA,UAAU,OAAA;AACV,gIAAA,oBAAoB,OAAA;AAItB,uEAAgF;AAAvE,4GAAA,iBAAiB,OAAA;AAO1B,+EAA6D;AAI7D,0DAAyE;AAAhE,wHAAA,0BAA0B,OAAA;AAEnC,4DAA0E;AAAjE,8GAAA,eAAe,OAAA;AAAE,wGAAA,SAAS,OAAA;AAGnC,4DAA0C;AAC1C,0DAA2D;AAAlD,sGAAA,UAAU,OAAA;AACnB,0FAA4F;AAAnF,2HAAA,qBAAqB,OAAA;AAC9B,wFAA0F;AAAjF,yHAAA,oBAAoB,OAAA;AAC7B,6EAA8E;AAArE,sHAAA,kBAAkB,OAAA;AAG3B,2EAA2D;AAG3D,kEAAgD","sourcesContent":["// Add you exports here, make sure to export types separately from impls and use the `type` keyword when exporting them\n// Don't use wildcard exports, instead use named exports\n\n//kernel exports\nexport * from \"./kernel-zerodev/abis/index.js\";\n\n// Validator exports\nexport {\n ValidatorMode,\n KernelBaseValidator,\n} from \"./kernel-zerodev/validator/base.js\";\nexport * from \"./kernel-zerodev/validator/index.js\";\nexport type * from \"./kernel-zerodev/validator/types.js\";\nexport type { KernelBaseValidatorParams } from \"./kernel-zerodev/validator/base.js\";\nexport {\n ParamCondition,\n getAbiItem,\n getPermissionFromABI,\n} from \"./kernel-zerodev/validator/session-key-validator.js\";\n\n// Validator Provider exports\nexport { ValidatorProvider } from \"./kernel-zerodev/validator-provider/base.js\";\nexport type {\n ValidatorProviderParams,\n ValidatorProviderParamsOpts,\n ExtendedValidatorProviderParams,\n} from \"./kernel-zerodev/validator-provider/base.js\";\nexport type * from \"./kernel-zerodev/validator-provider/types.js\";\nexport * from \"./kernel-zerodev/validator-provider/index.js\";\n\n// Core exports\nexport type * from \"./kernel-zerodev/paymaster/types.js\";\nexport { KernelSmartContractAccount } from \"./kernel-zerodev/account.js\";\nexport type { KernelSmartAccountParams } from \"./kernel-zerodev/account.js\";\nexport { ZeroDevProvider, Operation } from \"./kernel-zerodev/provider.js\";\n\n// Utils exports\nexport * from \"./kernel-zerodev/utils.js\";\nexport { getChainId } from \"./kernel-zerodev/api/index.js\";\nexport { ZeroDevEthersProvider } from \"./kernel-zerodev/ethers-provider/ethers-provider.js\";\nexport { ZeroDevAccountSigner } from \"./kernel-zerodev/ethers-provider/account-signer.js\";\nexport { EmptyAccountSigner } from \"./kernel-zerodev/signer/empty-account.js\";\n\n// Constant exports\nexport * as constants from \"./kernel-zerodev/constants.js\";\n\n// Owner exports\nexport * from \"./kernel-zerodev/owner/index.js\";\n"]}
@@ -1,39 +1,231 @@
1
- export declare const ERC20Abi: ({
2
- inputs: {
3
- internalType: string;
4
- name: string;
5
- type: string;
6
- }[];
7
- stateMutability: string;
8
- type: string;
9
- anonymous?: undefined;
10
- name?: undefined;
11
- outputs?: undefined;
12
- } | {
13
- anonymous: boolean;
14
- inputs: {
15
- indexed: boolean;
16
- internalType: string;
17
- name: string;
18
- type: string;
19
- }[];
20
- name: string;
21
- type: string;
22
- stateMutability?: undefined;
23
- outputs?: undefined;
24
- } | {
25
- inputs: {
26
- internalType: string;
27
- name: string;
28
- type: string;
29
- }[];
30
- name: string;
31
- outputs: {
32
- internalType: string;
33
- name: string;
34
- type: string;
35
- }[];
36
- stateMutability: string;
37
- type: string;
38
- anonymous?: undefined;
39
- })[];
1
+ export declare const ERC20Abi: readonly [{
2
+ readonly inputs: readonly [{
3
+ readonly internalType: "string";
4
+ readonly name: "name_";
5
+ readonly type: "string";
6
+ }, {
7
+ readonly internalType: "string";
8
+ readonly name: "symbol_";
9
+ readonly type: "string";
10
+ }, {
11
+ readonly internalType: "uint8";
12
+ readonly name: "decimals_";
13
+ readonly type: "uint8";
14
+ }, {
15
+ readonly internalType: "uint256";
16
+ readonly name: "initialBalance_";
17
+ readonly type: "uint256";
18
+ }, {
19
+ readonly internalType: "address payable";
20
+ readonly name: "feeReceiver_";
21
+ readonly type: "address";
22
+ }];
23
+ readonly stateMutability: "payable";
24
+ readonly type: "constructor";
25
+ }, {
26
+ readonly anonymous: false;
27
+ readonly inputs: readonly [{
28
+ readonly indexed: true;
29
+ readonly internalType: "address";
30
+ readonly name: "owner";
31
+ readonly type: "address";
32
+ }, {
33
+ readonly indexed: true;
34
+ readonly internalType: "address";
35
+ readonly name: "spender";
36
+ readonly type: "address";
37
+ }, {
38
+ readonly indexed: false;
39
+ readonly internalType: "uint256";
40
+ readonly name: "value";
41
+ readonly type: "uint256";
42
+ }];
43
+ readonly name: "Approval";
44
+ readonly type: "event";
45
+ }, {
46
+ readonly anonymous: false;
47
+ readonly inputs: readonly [{
48
+ readonly indexed: true;
49
+ readonly internalType: "address";
50
+ readonly name: "from";
51
+ readonly type: "address";
52
+ }, {
53
+ readonly indexed: true;
54
+ readonly internalType: "address";
55
+ readonly name: "to";
56
+ readonly type: "address";
57
+ }, {
58
+ readonly indexed: false;
59
+ readonly internalType: "uint256";
60
+ readonly name: "value";
61
+ readonly type: "uint256";
62
+ }];
63
+ readonly name: "Transfer";
64
+ readonly type: "event";
65
+ }, {
66
+ readonly inputs: readonly [{
67
+ readonly internalType: "address";
68
+ readonly name: "owner";
69
+ readonly type: "address";
70
+ }, {
71
+ readonly internalType: "address";
72
+ readonly name: "spender";
73
+ readonly type: "address";
74
+ }];
75
+ readonly name: "allowance";
76
+ readonly outputs: readonly [{
77
+ readonly internalType: "uint256";
78
+ readonly name: "";
79
+ readonly type: "uint256";
80
+ }];
81
+ readonly stateMutability: "view";
82
+ readonly type: "function";
83
+ }, {
84
+ readonly inputs: readonly [{
85
+ readonly internalType: "address";
86
+ readonly name: "spender";
87
+ readonly type: "address";
88
+ }, {
89
+ readonly internalType: "uint256";
90
+ readonly name: "amount";
91
+ readonly type: "uint256";
92
+ }];
93
+ readonly name: "approve";
94
+ readonly outputs: readonly [{
95
+ readonly internalType: "bool";
96
+ readonly name: "";
97
+ readonly type: "bool";
98
+ }];
99
+ readonly stateMutability: "nonpayable";
100
+ readonly type: "function";
101
+ }, {
102
+ readonly inputs: readonly [{
103
+ readonly internalType: "address";
104
+ readonly name: "account";
105
+ readonly type: "address";
106
+ }];
107
+ readonly name: "balanceOf";
108
+ readonly outputs: readonly [{
109
+ readonly internalType: "uint256";
110
+ readonly name: "";
111
+ readonly type: "uint256";
112
+ }];
113
+ readonly stateMutability: "view";
114
+ readonly type: "function";
115
+ }, {
116
+ readonly inputs: readonly [];
117
+ readonly name: "decimals";
118
+ readonly outputs: readonly [{
119
+ readonly internalType: "uint8";
120
+ readonly name: "";
121
+ readonly type: "uint8";
122
+ }];
123
+ readonly stateMutability: "view";
124
+ readonly type: "function";
125
+ }, {
126
+ readonly inputs: readonly [{
127
+ readonly internalType: "address";
128
+ readonly name: "spender";
129
+ readonly type: "address";
130
+ }, {
131
+ readonly internalType: "uint256";
132
+ readonly name: "subtractedValue";
133
+ readonly type: "uint256";
134
+ }];
135
+ readonly name: "decreaseAllowance";
136
+ readonly outputs: readonly [{
137
+ readonly internalType: "bool";
138
+ readonly name: "";
139
+ readonly type: "bool";
140
+ }];
141
+ readonly stateMutability: "nonpayable";
142
+ readonly type: "function";
143
+ }, {
144
+ readonly inputs: readonly [{
145
+ readonly internalType: "address";
146
+ readonly name: "spender";
147
+ readonly type: "address";
148
+ }, {
149
+ readonly internalType: "uint256";
150
+ readonly name: "addedValue";
151
+ readonly type: "uint256";
152
+ }];
153
+ readonly name: "increaseAllowance";
154
+ readonly outputs: readonly [{
155
+ readonly internalType: "bool";
156
+ readonly name: "";
157
+ readonly type: "bool";
158
+ }];
159
+ readonly stateMutability: "nonpayable";
160
+ readonly type: "function";
161
+ }, {
162
+ readonly inputs: readonly [];
163
+ readonly name: "name";
164
+ readonly outputs: readonly [{
165
+ readonly internalType: "string";
166
+ readonly name: "";
167
+ readonly type: "string";
168
+ }];
169
+ readonly stateMutability: "view";
170
+ readonly type: "function";
171
+ }, {
172
+ readonly inputs: readonly [];
173
+ readonly name: "symbol";
174
+ readonly outputs: readonly [{
175
+ readonly internalType: "string";
176
+ readonly name: "";
177
+ readonly type: "string";
178
+ }];
179
+ readonly stateMutability: "view";
180
+ readonly type: "function";
181
+ }, {
182
+ readonly inputs: readonly [];
183
+ readonly name: "totalSupply";
184
+ readonly outputs: readonly [{
185
+ readonly internalType: "uint256";
186
+ readonly name: "";
187
+ readonly type: "uint256";
188
+ }];
189
+ readonly stateMutability: "view";
190
+ readonly type: "function";
191
+ }, {
192
+ readonly inputs: readonly [{
193
+ readonly internalType: "address";
194
+ readonly name: "recipient";
195
+ readonly type: "address";
196
+ }, {
197
+ readonly internalType: "uint256";
198
+ readonly name: "amount";
199
+ readonly type: "uint256";
200
+ }];
201
+ readonly name: "transfer";
202
+ readonly outputs: readonly [{
203
+ readonly internalType: "bool";
204
+ readonly name: "";
205
+ readonly type: "bool";
206
+ }];
207
+ readonly stateMutability: "nonpayable";
208
+ readonly type: "function";
209
+ }, {
210
+ readonly inputs: readonly [{
211
+ readonly internalType: "address";
212
+ readonly name: "sender";
213
+ readonly type: "address";
214
+ }, {
215
+ readonly internalType: "address";
216
+ readonly name: "recipient";
217
+ readonly type: "address";
218
+ }, {
219
+ readonly internalType: "uint256";
220
+ readonly name: "amount";
221
+ readonly type: "uint256";
222
+ }];
223
+ readonly name: "transferFrom";
224
+ readonly outputs: readonly [{
225
+ readonly internalType: "bool";
226
+ readonly name: "";
227
+ readonly type: "bool";
228
+ }];
229
+ readonly stateMutability: "nonpayable";
230
+ readonly type: "function";
231
+ }];
@@ -1 +1 @@
1
- {"version":3,"file":"ERC20Abi.js","sourceRoot":"","sources":["../../../../src/kernel-zerodev/abis/ERC20Abi.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACtB;QACE,MAAM,EAAE;YACN,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE;YACzD,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3D,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE;YAC3D,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,EAAE;YACrE;gBACE,YAAY,EAAE,iBAAiB;gBAC/B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,SAAS;QAC1B,IAAI,EAAE,aAAa;KACpB;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN,EAAE,OAAO,EAAE,IAA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IAAI,EAAE,SAAS,EAAE;SAC7D;QACD,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC3D,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;CACF,CAAC","sourcesContent":["export const ERC20Abi = [\n {\n inputs: [\n { internalType: \"string\", name: \"name_\", type: \"string\" },\n { internalType: \"string\", name: \"symbol_\", type: \"string\" },\n { internalType: \"uint8\", name: \"decimals_\", type: \"uint8\" },\n { internalType: \"uint256\", name: \"initialBalance_\", type: \"uint256\" },\n {\n internalType: \"address payable\",\n name: \"feeReceiver_\",\n type: \"address\",\n },\n ],\n stateMutability: \"payable\",\n type: \"constructor\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"owner\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"spender\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"value\",\n type: \"uint256\",\n },\n ],\n name: \"Approval\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"address\", name: \"from\", type: \"address\" },\n { indexed: true, internalType: \"address\", name: \"to\", type: \"address\" },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"value\",\n type: \"uint256\",\n },\n ],\n name: \"Transfer\",\n type: \"event\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"owner\", type: \"address\" },\n { internalType: \"address\", name: \"spender\", type: \"address\" },\n ],\n name: \"allowance\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"spender\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n name: \"approve\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"account\", type: \"address\" }],\n name: \"balanceOf\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"decimals\",\n outputs: [{ internalType: \"uint8\", name: \"\", type: \"uint8\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"spender\", type: \"address\" },\n { internalType: \"uint256\", name: \"subtractedValue\", type: \"uint256\" },\n ],\n name: \"decreaseAllowance\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"spender\", type: \"address\" },\n { internalType: \"uint256\", name: \"addedValue\", type: \"uint256\" },\n ],\n name: \"increaseAllowance\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"name\",\n outputs: [{ internalType: \"string\", name: \"\", type: \"string\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"symbol\",\n outputs: [{ internalType: \"string\", name: \"\", type: \"string\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"totalSupply\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"recipient\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n name: \"transfer\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"sender\", type: \"address\" },\n { internalType: \"address\", name: \"recipient\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n name: \"transferFrom\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n];\n"]}
1
+ {"version":3,"file":"ERC20Abi.js","sourceRoot":"","sources":["../../../../src/kernel-zerodev/abis/ERC20Abi.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACtB;QACE,MAAM,EAAE;YACN,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE;YACzD,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3D,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE;YAC3D,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,EAAE;YACrE;gBACE,YAAY,EAAE,iBAAiB;gBAC/B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,eAAe,EAAE,SAAS;QAC1B,IAAI,EAAE,aAAa;KACpB;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS;aAChB;YACD;gBACE,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;aAChB;SACF;QACD,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,OAAO;KACd;IACD;QACE,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE;Y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IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;SAC7D;QACD,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC3D,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;CACO,CAAC","sourcesContent":["export const ERC20Abi = [\n {\n inputs: [\n { internalType: \"string\", name: \"name_\", type: \"string\" },\n { internalType: \"string\", name: \"symbol_\", type: \"string\" },\n { internalType: \"uint8\", name: \"decimals_\", type: \"uint8\" },\n { internalType: \"uint256\", name: \"initialBalance_\", type: \"uint256\" },\n {\n internalType: \"address payable\",\n name: \"feeReceiver_\",\n type: \"address\",\n },\n ],\n stateMutability: \"payable\",\n type: \"constructor\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"owner\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"spender\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"value\",\n type: \"uint256\",\n },\n ],\n name: \"Approval\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n { indexed: true, internalType: \"address\", name: \"from\", type: \"address\" },\n { indexed: true, internalType: \"address\", name: \"to\", type: \"address\" },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"value\",\n type: \"uint256\",\n },\n ],\n name: \"Transfer\",\n type: \"event\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"owner\", type: \"address\" },\n { internalType: \"address\", name: \"spender\", type: \"address\" },\n ],\n name: \"allowance\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"spender\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n name: \"approve\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"account\", type: \"address\" }],\n name: \"balanceOf\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"decimals\",\n outputs: [{ internalType: \"uint8\", name: \"\", type: \"uint8\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"spender\", type: \"address\" },\n { internalType: \"uint256\", name: \"subtractedValue\", type: \"uint256\" },\n ],\n name: \"decreaseAllowance\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"spender\", type: \"address\" },\n { internalType: \"uint256\", name: \"addedValue\", type: \"uint256\" },\n ],\n name: \"increaseAllowance\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"name\",\n outputs: [{ internalType: \"string\", name: \"\", type: \"string\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"symbol\",\n outputs: [{ internalType: \"string\", name: \"\", type: \"string\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"totalSupply\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"recipient\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n name: \"transfer\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"sender\", type: \"address\" },\n { internalType: \"address\", name: \"recipient\", type: \"address\" },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n name: \"transferFrom\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n"]}
@@ -125,6 +125,10 @@ class TokenPaymaster extends base_js_1.Paymaster {
125
125
  to: await this.provider.getAddress(),
126
126
  data: erc20CallData,
127
127
  }),
128
+ signature: await this.provider
129
+ .getAccount()
130
+ .getValidator()
131
+ .getDynamicDummySignature((await struct.sender), erc20CallData),
128
132
  };
129
133
  }
130
134
  catch (error) {
@@ -148,7 +152,7 @@ class TokenPaymaster extends base_js_1.Paymaster {
148
152
  (0, viem_1.isAddress)(paymasterAddress)) {
149
153
  const erc20UserOp = await this.getERC20UserOp(struct, mainCall, gasTokenAddress, paymasterAddress);
150
154
  if (!erc20UserOp) {
151
- return struct;
155
+ return;
152
156
  }
153
157
  const paymasterResp = await this.signUserOp({
154
158
  userOp: struct,
@@ -1 +1 @@
1
- {"version":3,"file":"token-paymaster.js","sourceRoot":"","sources":["../../../../src/kernel-zerodev/paymaster/token-paymaster.ts"],"names":[],"mappings":";;;;;;AAMA,kDAA0B;AAC1B,+BAMc;AACd,qDAA+C;AAC/C,qEAA+D;AAC/D,6DAAuD;AACvD,kDAKyB;AACzB,4CAGsB;AAEtB,0CAGqB;AACrB,uCAAsC;AAKtC,8CAA6C;AAE7C,MAAa,cAAe,SAAQ,mBAAS;IAC3C,YACE,QAAyB,EACf,eAAmD;QAE7D,KAAK,CAAC,QAAQ,CAAC,CAAC;QAFhB;;;;mBAAU,eAAe;WAAoC;IAG/D,CAAC;IACD,KAAK,CAAC,mBAAmB,CACvB,iBAAgD;QAEhD,MAAM,OAAO,GAAG,MAAM,IAAA,qBAAU,EAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;QAE/D,IAAI;YACF,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,MAAM,eAAK,CAAC,IAAI,CA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AAQ;oBACzB,eAAe;oBACf,WAAW;oBACX,aAAa,EAAE,WAAW,CAAC,QAAQ;oBACnC,iBAAiB;oBACjB,iBAAiB;iBAClB,CAAC,CAAC;gBACH,IAAI,aAAa,EAAE;oBACjB,OAAO,aAAa,CAAC;iBACtB;aACF;SACF;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACpB;QACD,OAAO;IACT,CAAC;CACF;AArLD,wCAqLC","sourcesContent":["import {\n type PromiseOrValue,\n type BytesLike,\n type UserOperationCallData,\n type UserOperationStruct,\n} from \"@alchemy/aa-core\";\nimport axios from \"axios\";\nimport {\n type Hex,\n toHex,\n decodeFunctionData,\n encodeFunctionData,\n isAddress,\n} from \"viem\";\nimport { ERC20Abi } from \"../abis/ERC20Abi.js\";\nimport { KernelAccountAbi } from \"../abis/KernelAccountAbi.js\";\nimport { MultiSendAbi } from \"../abis/MultiSendAbi.js\";\nimport {\n PAYMASTER_URL,\n ENTRYPOINT_ADDRESS,\n MULTISEND_ADDR,\n ERC20_APPROVAL_AMOUNT,\n} from \"../constants.js\";\nimport {\n AccountNotConnected,\n IncorrectCallDataForTokenPaymaster,\n} from \"../errors.js\";\nimport type { ZeroDevProvider } from \"../provider.js\";\nimport {\n getGasTokenAddress,\n type UserOperationCallDataWithDelegate,\n} from \"../utils.js\";\nimport { Paymaster } from \"./base.js\";\nimport {\n type PaymasterAndBundlerProviders,\n type PaymasterConfig,\n} from \"./types.js\";\nimport { getChainId } from \"../api/index.js\";\n\nexport class TokenPaymaster extends Paymaster {\n constructor(\n provider: ZeroDevProvider,\n protected paymasterConfig: PaymasterConfig<\"TOKEN_PAYMASTER\">\n ) {\n super(provider);\n }\n async getPaymasterAddress(\n paymasterProvider?: PaymasterAndBundlerProviders\n ): Promise<Hex | undefined> {\n const chainId = await getChainId(this.provider.getProjectId());\n\n try {\n const { data: paymasterResp } = await axios.post(\n `${PAYMASTER_URL}/getPaymasterAddress`,\n {\n chainId,\n entryPointAddress: ENTRYPOINT_ADDRESS,\n paymasterProvider,\n },\n { headers: { \"Content-Type\": \"application/json\" } }\n );\n return paymasterResp as Hex;\n } catch (e) {\n console.log(e);\n return undefined;\n }\n }\n async decodeMainCallFromCallData(\n kernelAddress: PromiseOrValue<string>,\n callData: PromiseOrValue<BytesLike>\n ): Promise<UserOperationCallDataWithDelegate | undefined> {\n let data: Hex = \"0x\";\n if (callData instanceof Promise) {\n const _data = await callData;\n if (_data instanceof Uint8Array) {\n data = toHex(_data);\n } else {\n data = _data as Hex;\n }\n } else if (callData instanceof Uint8Array) {\n data = toHex(callData);\n } else {\n data = callData as Hex;\n }\n\n try {\n const { functionName, args } = decodeFunctionData({\n abi: KernelAccountAbi,\n data: data,\n });\n if (functionName === \"execute\") {\n const [target, value, data] = args;\n let msFuntionName;\n try {\n ({ functionName: msFuntionName } = decodeFunctionData({\n abi: MultiSendAbi,\n data,\n }));\n } catch (error) {}\n let mainCall:\n | UserOperationCallData\n | UserOperationCallDataWithDelegate = {\n target,\n value: value ?? 0n,\n data,\n };\n if (msFuntionName === \"multiSend\") {\n mainCall = {\n ...mainCall,\n target: MULTISEND_ADDR,\n delegateCall: true,\n data,\n };\n }\n return mainCall;\n }\n } catch (error) {\n return {\n target: (kernelAddress instanceof Promise\n ? await kernelAddress\n : kernelAddress) as Hex,\n data,\n value: 0n,\n delegateCall: true,\n };\n }\n return;\n }\n\n async getERC20UserOp(\n struct: UserOperationStruct,\n mainCall: UserOperationCallDataWithDelegate,\n gasTokenAddress: Hex,\n paymasterAddress: Hex\n ): Promise<UserOperationStruct | undefined> {\n try {\n const approveData: UserOperationCallData = {\n target: gasTokenAddress,\n value: BigInt(0),\n data: encodeFunctionData({\n abi: ERC20Abi,\n functionName: \"approve\",\n args: [paymasterAddress, ERC20_APPROVAL_AMOUNT[gasTokenAddress]],\n }),\n };\n if (!this.provider.account) {\n throw AccountNotConnected;\n }\n const erc20CallData = await this.provider.account.encodeBatchExecute([\n approveData,\n mainCall,\n ]);\n return {\n ...struct,\n callData: erc20CallData,\n callGasLimit: await this.provider.rpcClient.estimateGas({\n account: ENTRYPOINT_ADDRESS,\n to: await this.provider.getAddress(),\n data: erc20CallData,\n }),\n };\n } catch (error) {\n return;\n }\n }\n\n async getPaymasterResponse(\n struct: UserOperationStruct,\n paymasterProvider?: PaymasterAndBundlerProviders,\n shouldOverrideFee?: boolean\n ): Promise<UserOperationStruct | undefined> {\n try {\n const mainCall = await this.decodeMainCallFromCallData(\n struct.sender,\n struct.callData\n );\n if (!mainCall) {\n throw IncorrectCallDataForTokenPaymaster;\n }\n const chainId = await getChainId(this.provider.getProjectId());\n if (!chainId) {\n throw new Error(\"ChainId not found\");\n }\n const gasTokenAddress = getGasTokenAddress(\n this.paymasterConfig.gasToken,\n chainId\n );\n let paymasterAddress = await this.getPaymasterAddress(paymasterProvider);\n if (\n gasTokenAddress !== undefined &&\n paymasterAddress !== undefined &&\n isAddress(paymasterAddress)\n ) {\n const erc20UserOp = await this.getERC20UserOp(\n struct,\n mainCall,\n gasTokenAddress,\n paymasterAddress\n );\n if (!erc20UserOp) {\n return struct;\n }\n const paymasterResp = await this.signUserOp({\n userOp: struct,\n callData: struct.callData,\n gasTokenAddress,\n erc20UserOp,\n erc20CallData: erc20UserOp.callData,\n paymasterProvider,\n shouldOverrideFee,\n });\n if (paymasterResp) {\n return paymasterResp;\n }\n }\n } catch (error) {\n console.log(error);\n }\n return;\n }\n}\n"]}
1
+ {"version":3,"file":"token-paymaster.js","sourceRoot":"","sources":["../../../../src/kernel-zerodev/paymaster/token-paymaster.ts"],"names":[],"mappings":";;;;;;AAMA,kDAA0B;AAC1B,+BAMc;AACd,qDAA+C;AAC/C,qEAA+D;AAC/D,6DAAuD;AACvD,kDAKyB;AACzB,4CAGsB;AAEtB,0CAGqB;AACrB,uCAAsC;AAKtC,8CAA6C;AAE7C,MAAa,cAAe,SAAQ,mBAAS;IAC3C,YACE,QAAyB,EACf,eAAmD;QAE7D,KAA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gBAAgB,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;YACzE,IACE,eAAe,KAAK,SAAS;gBAC7B,gBAAgB,KAAK,SAAS;gBAC9B,IAAA,gBAAS,EAAC,gBAAgB,CAAC,EAC3B;gBACA,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAC3C,MAAM,EACN,QAAQ,EACR,eAAe,EACf,gBAAgB,CACjB,CAAC;gBACF,IAAI,CAAC,WAAW,EAAE;oBAChB,OAAO;iBACR;gBACD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC;oBAC1C,MAAM,EAAE,MAAM;oBACd,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,eAAe;oBACf,WAAW;oBACX,aAAa,EAAE,WAAW,CAAC,QAAQ;oBACnC,iBAAiB;oBACjB,iBAAiB;iBAClB,CAAC,CAAC;gBACH,IAAI,aAAa,EAAE;oBACjB,OAAO,aAAa,CAAC;iBACtB;aACF;SACF;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACpB;QACD,OAAO;IACT,CAAC;CACF;AA5LD,wCA4LC","sourcesContent":["import {\n type PromiseOrValue,\n type BytesLike,\n type UserOperationCallData,\n type UserOperationStruct,\n} from \"@alchemy/aa-core\";\nimport axios from \"axios\";\nimport {\n type Hex,\n toHex,\n decodeFunctionData,\n encodeFunctionData,\n isAddress,\n} from \"viem\";\nimport { ERC20Abi } from \"../abis/ERC20Abi.js\";\nimport { KernelAccountAbi } from \"../abis/KernelAccountAbi.js\";\nimport { MultiSendAbi } from \"../abis/MultiSendAbi.js\";\nimport {\n PAYMASTER_URL,\n ENTRYPOINT_ADDRESS,\n MULTISEND_ADDR,\n ERC20_APPROVAL_AMOUNT,\n} from \"../constants.js\";\nimport {\n AccountNotConnected,\n IncorrectCallDataForTokenPaymaster,\n} from \"../errors.js\";\nimport type { ZeroDevProvider } from \"../provider.js\";\nimport {\n getGasTokenAddress,\n type UserOperationCallDataWithDelegate,\n} from \"../utils.js\";\nimport { Paymaster } from \"./base.js\";\nimport {\n type PaymasterAndBundlerProviders,\n type PaymasterConfig,\n} from \"./types.js\";\nimport { getChainId } from \"../api/index.js\";\n\nexport class TokenPaymaster extends Paymaster {\n constructor(\n provider: ZeroDevProvider,\n protected paymasterConfig: PaymasterConfig<\"TOKEN_PAYMASTER\">\n ) {\n super(provider);\n }\n async getPaymasterAddress(\n paymasterProvider?: PaymasterAndBundlerProviders\n ): Promise<Hex | undefined> {\n const chainId = await getChainId(this.provider.getProjectId());\n\n try {\n const { data: paymasterResp } = await axios.post(\n `${PAYMASTER_URL}/getPaymasterAddress`,\n {\n chainId,\n entryPointAddress: ENTRYPOINT_ADDRESS,\n paymasterProvider,\n },\n { headers: { \"Content-Type\": \"application/json\" } }\n );\n return paymasterResp as Hex;\n } catch (e) {\n console.log(e);\n return undefined;\n }\n }\n async decodeMainCallFromCallData(\n kernelAddress: PromiseOrValue<string>,\n callData: PromiseOrValue<BytesLike>\n ): Promise<UserOperationCallDataWithDelegate | undefined> {\n let data: Hex = \"0x\";\n if (callData instanceof Promise) {\n const _data = await callData;\n if (_data instanceof Uint8Array) {\n data = toHex(_data);\n } else {\n data = _data as Hex;\n }\n } else if (callData instanceof Uint8Array) {\n data = toHex(callData);\n } else {\n data = callData as Hex;\n }\n\n try {\n const { functionName, args } = decodeFunctionData({\n abi: KernelAccountAbi,\n data: data,\n });\n if (functionName === \"execute\") {\n const [target, value, data] = args;\n let msFuntionName;\n try {\n ({ functionName: msFuntionName } = decodeFunctionData({\n abi: MultiSendAbi,\n data,\n }));\n } catch (error) {}\n let mainCall:\n | UserOperationCallData\n | UserOperationCallDataWithDelegate = {\n target,\n value: value ?? 0n,\n data,\n };\n if (msFuntionName === \"multiSend\") {\n mainCall = {\n ...mainCall,\n target: MULTISEND_ADDR,\n delegateCall: true,\n data,\n };\n }\n return mainCall;\n }\n } catch (error) {\n return {\n target: (kernelAddress instanceof Promise\n ? await kernelAddress\n : kernelAddress) as Hex,\n data,\n value: 0n,\n delegateCall: true,\n };\n }\n return;\n }\n\n async getERC20UserOp(\n struct: UserOperationStruct,\n mainCall: UserOperationCallDataWithDelegate,\n gasTokenAddress: Hex,\n paymasterAddress: Hex\n ): Promise<UserOperationStruct | undefined> {\n try {\n const approveData: UserOperationCallData = {\n target: gasTokenAddress,\n value: BigInt(0),\n data: encodeFunctionData({\n abi: ERC20Abi,\n functionName: \"approve\",\n args: [paymasterAddress, ERC20_APPROVAL_AMOUNT[gasTokenAddress]],\n }),\n };\n if (!this.provider.account) {\n throw AccountNotConnected;\n }\n const erc20CallData = await this.provider.account.encodeBatchExecute([\n approveData,\n mainCall,\n ]);\n return {\n ...struct,\n callData: erc20CallData,\n callGasLimit: await this.provider.rpcClient.estimateGas({\n account: ENTRYPOINT_ADDRESS,\n to: await this.provider.getAddress(),\n data: erc20CallData,\n }),\n signature: await this.provider\n .getAccount()\n .getValidator()\n .getDynamicDummySignature(\n (await struct.sender) as Hex,\n erc20CallData\n ),\n };\n } catch (error) {\n return;\n }\n }\n\n async getPaymasterResponse(\n struct: UserOperationStruct,\n paymasterProvider?: PaymasterAndBundlerProviders,\n shouldOverrideFee?: boolean\n ): Promise<UserOperationStruct | undefined> {\n try {\n const mainCall = await this.decodeMainCallFromCallData(\n struct.sender,\n struct.callData\n );\n if (!mainCall) {\n throw IncorrectCallDataForTokenPaymaster;\n }\n const chainId = await getChainId(this.provider.getProjectId());\n if (!chainId) {\n throw new Error(\"ChainId not found\");\n }\n const gasTokenAddress = getGasTokenAddress(\n this.paymasterConfig.gasToken,\n chainId\n );\n let paymasterAddress = await this.getPaymasterAddress(paymasterProvider);\n if (\n gasTokenAddress !== undefined &&\n paymasterAddress !== undefined &&\n isAddress(paymasterAddress)\n ) {\n const erc20UserOp = await this.getERC20UserOp(\n struct,\n mainCall,\n gasTokenAddress,\n paymasterAddress\n );\n if (!erc20UserOp) {\n return;\n }\n const paymasterResp = await this.signUserOp({\n userOp: struct,\n callData: struct.callData,\n gasTokenAddress,\n erc20UserOp,\n erc20CallData: erc20UserOp.callData,\n paymasterProvider,\n shouldOverrideFee,\n });\n if (paymasterResp) {\n return paymasterResp;\n }\n }\n } catch (error) {\n console.log(error);\n }\n return;\n }\n}\n"]}
@@ -1,7 +1,10 @@
1
- import { type Address, type Hex, type SmartAccountSigner, type UserOperationRequest, type SignTypedDataParams } from "@alchemy/aa-core";
1
+ import { type Address, type Hex, type SmartAccountSigner, type UserOperationRequest, type SignTypedDataParams, type Abi } from "@alchemy/aa-core";
2
2
  import { KernelBaseValidator, type KernelBaseValidatorParams, type ValidatorPluginData } from "./base.js";
3
+ import { type GetAbiItemParameters } from "viem";
3
4
  import { MerkleTree } from "merkletreejs";
4
- import type { Operation } from "../provider.js";
5
+ import { Operation } from "../provider.js";
6
+ import type { GetAbiItemReturnType } from "viem/dist/types/utils/abi/getAbiItem.js";
7
+ import type { GeneratePermissionFromArgsParameters } from "./types.js";
5
8
  export interface SessionKeyValidatorParams extends KernelBaseValidatorParams {
6
9
  sessionKey: SmartAccountSigner;
7
10
  sessionKeyData: SessionKeyData;
@@ -24,19 +27,21 @@ export interface ParamRules {
24
27
  condition: ParamCondition;
25
28
  param: Hex;
26
29
  }
27
- export interface Permission {
30
+ export type Permission = {
28
31
  target: Address;
29
- valueLimit: bigint;
30
32
  sig: Hex;
31
33
  rules: ParamRules[];
32
- operation: Operation;
33
- }
34
+ valueLimit?: bigint;
35
+ operation?: Operation;
36
+ };
34
37
  export interface SessionKeyData {
35
38
  validUntil: number;
36
39
  validAfter: number;
37
40
  paymaster?: Address;
38
41
  permissions?: Permission[];
39
42
  }
43
+ export declare function getAbiItem<TAbi extends Abi | readonly unknown[], TItemName extends string>({ abi, args, name, }: GetAbiItemParameters<TAbi, TItemName>): GetAbiItemReturnType<TAbi, TItemName>;
44
+ export declare function getPermissionFromABI<TAbi extends Abi | readonly unknown[], TFunctionName extends string | undefined = string>({ abi, target, args, conditions, functionName, operation, valueLimit, }: GeneratePermissionFromArgsParameters<TAbi, TFunctionName>): Permission;
40
45
  export declare class SessionKeyValidator extends KernelBaseValidator {
41
46
  protected sessionKey: SmartAccountSigner;
42
47
  sessionKeyData: SessionKeyData;
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SessionKeyValidator = exports.ParamCondition = void 0;
3
+ exports.SessionKeyValidator = exports.getPermissionFromABI = exports.getAbiItem = exports.ParamCondition = void 0;
4
4
  const aa_core_1 = require("@alchemy/aa-core");
5
5
  const base_js_1 = require("./base.js");
6
6
  const viem_1 = require("viem");
7
+ const utils_1 = require("viem/utils");
7
8
  const SessionKeyValidatorAbi_js_1 = require("../abis/SessionKeyValidatorAbi.js");
8
9
  const constants_js_1 = require("../constants.js");
9
10
  const KernelAccountAbi_js_1 = require("../abis/KernelAccountAbi.js");
10
11
  const merkletreejs_1 = require("merkletreejs");
12
+ const provider_js_1 = require("../provider.js");
11
13
  const index_js_1 = require("../api/index.js");
12
14
  const utils_js_1 = require("../utils.js");
13
15
  BigInt.prototype.toJSON = function () {
@@ -22,6 +24,73 @@ var ParamCondition;
22
24
  ParamCondition[ParamCondition["LESS_THAN_OR_EQUAL"] = 4] = "LESS_THAN_OR_EQUAL";
23
25
  ParamCondition[ParamCondition["NOT_EQUAL"] = 5] = "NOT_EQUAL";
24
26
  })(ParamCondition || (exports.ParamCondition = ParamCondition = {}));
27
+ function getAbiItem({ abi, args = [], name, }) {
28
+ const abiItems = abi.filter((x) => "name" in x && x.name === name);
29
+ if (abiItems.length === 0)
30
+ return undefined;
31
+ if (abiItems.length === 1)
32
+ return abiItems[0];
33
+ const abiItemsParamFiltered = [];
34
+ for (const abiItem of abiItems) {
35
+ if (!("inputs" in abiItem))
36
+ continue;
37
+ if (!args || args.length === 0) {
38
+ if (!abiItem.inputs || abiItem.inputs.length === 0)
39
+ return abiItem;
40
+ continue;
41
+ }
42
+ if (!abiItem.inputs)
43
+ continue;
44
+ if (abiItem.inputs.length === 0)
45
+ continue;
46
+ if (abiItem.inputs.length !== args.length)
47
+ continue;
48
+ abiItemsParamFiltered.push(abiItem);
49
+ }
50
+ if (abiItemsParamFiltered.length === 0)
51
+ return abiItems[0];
52
+ else if (abiItemsParamFiltered.length === 1)
53
+ return abiItemsParamFiltered[0];
54
+ else
55
+ throw Error(`Couldn't parse funtion signature using params, set appropriate one from below:\n${abiItemsParamFiltered
56
+ .map((item) => (0, utils_1.formatAbiItem)(item))
57
+ .reduce((a, c) => `${a}\n${c}`)}`);
58
+ }
59
+ exports.getAbiItem = getAbiItem;
60
+ function getPermissionFromABI({ abi, target, args, conditions, functionName, operation, valueLimit, }) {
61
+ const abiItem = getAbiItem({
62
+ abi,
63
+ args,
64
+ name: functionName,
65
+ });
66
+ if (abiItem.type !== "function") {
67
+ throw Error(`${functionName} not found in abi`);
68
+ }
69
+ const functionSelector = (0, viem_1.getFunctionSelector)(abiItem);
70
+ let paramRules = [];
71
+ if (args &&
72
+ Array.isArray(args) &&
73
+ conditions &&
74
+ Array.isArray(conditions) &&
75
+ args.length === conditions.length) {
76
+ paramRules = args
77
+ .map((arg, i) => arg &&
78
+ conditions && {
79
+ param: (0, viem_1.pad)((0, viem_1.isHex)(arg) ? arg : (0, viem_1.toHex)(arg), { size: 32 }),
80
+ offset: i * 32,
81
+ condition: conditions[i],
82
+ })
83
+ .filter((rule) => rule);
84
+ }
85
+ return {
86
+ sig: functionSelector,
87
+ rules: paramRules,
88
+ target,
89
+ operation: operation ?? provider_js_1.Operation.Call,
90
+ valueLimit: valueLimit ?? 0n,
91
+ };
92
+ }
93
+ exports.getPermissionFromABI = getPermissionFromABI;
25
94
  class SessionKeyValidator extends base_js_1.KernelBaseValidator {
26
95
  constructor(params) {
27
96
  super(params);
@@ -46,8 +115,15 @@ class SessionKeyValidator extends base_js_1.KernelBaseValidator {
46
115
  this.sessionKey = params.sessionKey;
47
116
  this.sessionKeyData = {
48
117
  ...params.sessionKeyData,
118
+ validAfter: params.sessionKeyData.validAfter ?? 0,
119
+ validUntil: params.sessionKeyData.validUntil ?? 0,
49
120
  paymaster: params.sessionKeyData.paymaster ?? viem_1.zeroAddress,
50
121
  };
122
+ this.sessionKeyData.permissions = this.sessionKeyData.permissions?.map((perm) => ({
123
+ ...perm,
124
+ operation: perm.operation ?? provider_js_1.Operation.Call,
125
+ valueLimit: perm.valueLimit ?? 0n,
126
+ }));
51
127
  this.merkleTree = this.getMerkleTree();
52
128
  if (this.shouldDelegateViaFallback()) {
53
129
  throw Error("Session key permissions not set");
@@ -92,14 +168,14 @@ class SessionKeyValidator extends base_js_1.KernelBaseValidator {
92
168
  if (!operationPermissions.length)
93
169
  return undefined;
94
170
  const signaturePermissions = this.filterBySignature(operationPermissions, args[2].slice(0, 10).toLowerCase());
95
- const valueLimitPermissions = signaturePermissions.filter((permission) => permission.valueLimit >= args[1]);
171
+ const valueLimitPermissions = signaturePermissions.filter((permission) => (permission.valueLimit ?? 0n) >= args[1]);
96
172
  if (!valueLimitPermissions.length)
97
173
  return undefined;
98
174
  const sortedPermissions = valueLimitPermissions.sort((a, b) => {
99
- if (b.valueLimit > a.valueLimit) {
175
+ if ((b.valueLimit ?? 0n) > (a.valueLimit ?? 0n)) {
100
176
  return 1;
101
177
  }
102
- else if (b.valueLimit < a.valueLimit) {
178
+ else if ((b.valueLimit ?? 0n) < (a.valueLimit ?? 0n)) {
103
179
  return -1;
104
180
  }
105
181
  else {
@@ -113,7 +189,7 @@ class SessionKeyValidator extends base_js_1.KernelBaseValidator {
113
189
  }
114
190
  }
115
191
  filterByOperation(permissions, operation) {
116
- return permissions.filter((permission) => permission.operation === operation);
192
+ return permissions.filter((permission) => permission.operation === operation || provider_js_1.Operation.Call === operation);
117
193
  }
118
194
  filterBySignature(permissions, signature) {
119
195
  return permissions.filter((permission) => permission.sig.toLowerCase() === signature);