@aastar/core 0.16.7 → 0.16.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abis/PaymasterV4_2.json +1193 -0
- package/dist/abis/SuperPaymaster.json +1 -1
- package/dist/abis/aPNTs.json +1160 -0
- package/dist/abis/abi.config.json +3 -3
- package/dist/abis/index.d.ts +15 -104
- package/dist/abis/index.js +22 -46
- package/dist/actions/account.d.ts +0 -15
- package/dist/actions/account.js +143 -108
- package/dist/actions/aggregator.d.ts +68 -7
- package/dist/actions/aggregator.js +328 -28
- package/dist/actions/dvt.d.ts +33 -5
- package/dist/actions/dvt.js +238 -38
- package/dist/actions/entryPoint.d.ts +3 -63
- package/dist/actions/entryPoint.js +52 -184
- package/dist/actions/factory.d.ts +48 -115
- package/dist/actions/factory.js +638 -438
- package/dist/actions/faucet.d.ts +23 -27
- package/dist/actions/faucet.js +150 -289
- package/dist/actions/index.d.ts +1 -2
- package/dist/actions/index.js +2 -4
- package/dist/actions/paymaster.d.ts +147 -0
- package/dist/actions/paymaster.js +706 -0
- package/dist/actions/paymasterV4.d.ts +26 -95
- package/dist/actions/paymasterV4.js +28 -121
- package/dist/actions/registry.d.ts +116 -165
- package/dist/actions/registry.js +855 -654
- package/dist/actions/reputation.d.ts +74 -52
- package/dist/actions/reputation.js +548 -242
- package/dist/actions/sbt.d.ts +90 -100
- package/dist/actions/sbt.js +801 -518
- package/dist/actions/staking.d.ts +45 -32
- package/dist/actions/staking.js +431 -260
- package/dist/actions/superPaymaster.d.ts +140 -158
- package/dist/actions/superPaymaster.js +965 -631
- package/dist/actions/tokens.d.ts +130 -108
- package/dist/actions/tokens.js +470 -414
- package/dist/actions/validators.d.ts +0 -73
- package/dist/actions/validators.js +0 -94
- package/dist/clients/BaseClient.d.ts +3 -3
- package/dist/clients/BundlerClient.d.ts +55 -0
- package/dist/clients/BundlerClient.js +92 -0
- package/dist/communities.js +2 -2
- package/dist/constants.js +1 -28
- package/dist/contract-addresses.d.ts +5 -14
- package/dist/contract-addresses.js +3 -9
- package/dist/contract-versions.d.ts +138 -0
- package/dist/contract-versions.js +328 -0
- package/dist/contracts.d.ts +6 -24
- package/dist/contracts.js +2 -2
- package/dist/errors/index.d.ts +57 -0
- package/dist/errors/index.js +123 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/requirementChecker.d.ts +35 -1
- package/dist/requirementChecker.js +39 -1
- package/dist/roles.d.ts +50 -61
- package/dist/roles.js +50 -61
- package/dist/validators/index.d.ts +35 -0
- package/dist/validators/index.js +60 -0
- package/package.json +5 -13
|
@@ -1,644 +1,978 @@
|
|
|
1
1
|
import { SuperPaymasterABI } from '../abis/index.js';
|
|
2
|
+
import { validateAddress, validateRequired, validateAmount } from '../validators/index.js';
|
|
3
|
+
import { AAStarError } from '../errors/index.js';
|
|
2
4
|
export const superPaymasterActions = (address) => (client) => ({
|
|
3
5
|
// Deposit & Withdrawal
|
|
4
|
-
async
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
6
|
+
async deposit({ amount, account }) {
|
|
7
|
+
try {
|
|
8
|
+
validateAmount(amount, 'amount');
|
|
9
|
+
return await client.writeContract({
|
|
10
|
+
address,
|
|
11
|
+
abi: SuperPaymasterABI,
|
|
12
|
+
functionName: 'deposit',
|
|
13
|
+
args: [amount],
|
|
14
|
+
account: account,
|
|
15
|
+
chain: client.chain
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
throw AAStarError.fromViemError(error, 'deposit');
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
async depositETH({ value, account }) {
|
|
23
|
+
try {
|
|
24
|
+
validateAmount(value, 'value');
|
|
25
|
+
return await client.writeContract({
|
|
26
|
+
address,
|
|
27
|
+
abi: SuperPaymasterABI,
|
|
28
|
+
functionName: 'deposit',
|
|
29
|
+
args: [],
|
|
30
|
+
value,
|
|
31
|
+
account: account,
|
|
32
|
+
chain: client.chain
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
throw AAStarError.fromViemError(error, 'depositETH');
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
async depositFor({ targetOperator, amount, account }) {
|
|
40
|
+
try {
|
|
41
|
+
validateAddress(targetOperator, 'targetOperator');
|
|
42
|
+
validateAmount(amount, 'amount');
|
|
43
|
+
return await client.writeContract({
|
|
44
|
+
address,
|
|
45
|
+
abi: SuperPaymasterABI,
|
|
46
|
+
functionName: 'depositFor',
|
|
47
|
+
args: [targetOperator, amount],
|
|
48
|
+
account: account,
|
|
49
|
+
chain: client.chain
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
throw AAStarError.fromViemError(error, 'depositFor');
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
async withdrawTo({ to, amount, account }) {
|
|
57
|
+
try {
|
|
58
|
+
validateAddress(to, 'to');
|
|
59
|
+
validateAmount(amount, 'amount');
|
|
60
|
+
return await client.writeContract({
|
|
61
|
+
address,
|
|
62
|
+
abi: SuperPaymasterABI,
|
|
63
|
+
functionName: 'withdrawTo',
|
|
64
|
+
args: [to, amount],
|
|
65
|
+
account: account,
|
|
66
|
+
chain: client.chain
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
throw AAStarError.fromViemError(error, 'withdrawTo');
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
async withdraw({ amount, account }) {
|
|
74
|
+
try {
|
|
75
|
+
validateAmount(amount, 'amount');
|
|
76
|
+
return await client.writeContract({
|
|
77
|
+
address,
|
|
78
|
+
abi: SuperPaymasterABI,
|
|
79
|
+
functionName: 'withdraw',
|
|
80
|
+
args: [amount],
|
|
81
|
+
account: account,
|
|
82
|
+
chain: client.chain
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
throw AAStarError.fromViemError(error, 'withdraw');
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
// Staking
|
|
90
|
+
async addStake({ unstakeDelaySec, value, account }) {
|
|
91
|
+
try {
|
|
92
|
+
validateRequired(unstakeDelaySec, 'unstakeDelaySec');
|
|
93
|
+
validateAmount(value, 'value');
|
|
94
|
+
return await client.writeContract({
|
|
95
|
+
address,
|
|
96
|
+
abi: SuperPaymasterABI,
|
|
97
|
+
functionName: 'addStake',
|
|
98
|
+
args: [unstakeDelaySec],
|
|
99
|
+
value,
|
|
100
|
+
account: account,
|
|
101
|
+
chain: client.chain
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
throw AAStarError.fromViemError(error, 'addStake');
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
async unlockStake({ account }) {
|
|
109
|
+
try {
|
|
110
|
+
return await client.writeContract({
|
|
111
|
+
address,
|
|
112
|
+
abi: SuperPaymasterABI,
|
|
113
|
+
functionName: 'unlockStake',
|
|
114
|
+
args: [],
|
|
115
|
+
account: account,
|
|
116
|
+
chain: client.chain
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
throw AAStarError.fromViemError(error, 'unlockStake');
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
async withdrawStake({ to, account }) {
|
|
124
|
+
try {
|
|
125
|
+
validateAddress(to, 'to');
|
|
126
|
+
return await client.writeContract({
|
|
127
|
+
address,
|
|
128
|
+
abi: SuperPaymasterABI,
|
|
129
|
+
functionName: 'withdrawStake',
|
|
130
|
+
args: [to],
|
|
131
|
+
account: account,
|
|
132
|
+
chain: client.chain
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
throw AAStarError.fromViemError(error, 'withdrawStake');
|
|
137
|
+
}
|
|
89
138
|
},
|
|
90
139
|
// Operator Management
|
|
91
|
-
async
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
140
|
+
async configureOperator({ xPNTsToken, opTreasury, exchangeRate, account }) {
|
|
141
|
+
try {
|
|
142
|
+
validateAddress(xPNTsToken, 'xPNTsToken');
|
|
143
|
+
validateAddress(opTreasury, 'opTreasury');
|
|
144
|
+
validateAmount(exchangeRate, 'exchangeRate');
|
|
145
|
+
return await client.writeContract({
|
|
146
|
+
address,
|
|
147
|
+
abi: SuperPaymasterABI,
|
|
148
|
+
functionName: 'configureOperator',
|
|
149
|
+
args: [xPNTsToken, opTreasury, exchangeRate],
|
|
150
|
+
account: account,
|
|
151
|
+
chain: client.chain
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
throw AAStarError.fromViemError(error, 'configureOperator');
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
async setOperatorPaused({ operator, paused, account }) {
|
|
159
|
+
try {
|
|
160
|
+
validateAddress(operator, 'operator');
|
|
161
|
+
return await client.writeContract({
|
|
162
|
+
address,
|
|
163
|
+
abi: SuperPaymasterABI,
|
|
164
|
+
functionName: 'setOperatorPaused',
|
|
165
|
+
args: [operator, paused],
|
|
166
|
+
account: account,
|
|
167
|
+
chain: client.chain
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
throw AAStarError.fromViemError(error, 'setOperatorPaused');
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
async setOperatorLimits({ minTxInterval, account }) {
|
|
175
|
+
try {
|
|
176
|
+
validateRequired(minTxInterval, 'minTxInterval');
|
|
177
|
+
return await client.writeContract({
|
|
178
|
+
address,
|
|
179
|
+
abi: SuperPaymasterABI,
|
|
180
|
+
functionName: 'setOperatorLimits',
|
|
181
|
+
args: [minTxInterval],
|
|
182
|
+
account: account,
|
|
183
|
+
chain: client.chain
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
throw AAStarError.fromViemError(error, 'setOperatorLimits');
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
async updateReputation({ operator, newScore, account }) {
|
|
191
|
+
try {
|
|
192
|
+
validateAddress(operator, 'operator');
|
|
193
|
+
validateAmount(newScore, 'newScore');
|
|
194
|
+
return await client.writeContract({
|
|
195
|
+
address,
|
|
196
|
+
abi: SuperPaymasterABI,
|
|
197
|
+
functionName: 'updateReputation',
|
|
198
|
+
args: [operator, newScore],
|
|
199
|
+
account: account,
|
|
200
|
+
chain: client.chain
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
throw AAStarError.fromViemError(error, 'updateReputation');
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
async executeSlashWithBLS({ operator, level, proof, account }) {
|
|
208
|
+
try {
|
|
209
|
+
validateAddress(operator, 'operator');
|
|
210
|
+
validateRequired(level, 'level');
|
|
211
|
+
validateRequired(proof, 'proof');
|
|
212
|
+
return await client.writeContract({
|
|
213
|
+
address,
|
|
214
|
+
abi: SuperPaymasterABI,
|
|
215
|
+
functionName: 'executeSlashWithBLS',
|
|
216
|
+
args: [operator, level, proof],
|
|
217
|
+
account: account,
|
|
218
|
+
chain: client.chain
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
throw AAStarError.fromViemError(error, 'executeSlashWithBLS');
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
async slashOperator({ operator, level, penaltyAmount, reason, account }) {
|
|
226
|
+
try {
|
|
227
|
+
validateAddress(operator, 'operator');
|
|
228
|
+
validateRequired(level, 'level');
|
|
229
|
+
validateAmount(penaltyAmount, 'penaltyAmount');
|
|
230
|
+
validateRequired(reason, 'reason');
|
|
231
|
+
return await client.writeContract({
|
|
232
|
+
address,
|
|
233
|
+
abi: SuperPaymasterABI,
|
|
234
|
+
functionName: 'slashOperator',
|
|
235
|
+
args: [operator, level, penaltyAmount, reason],
|
|
236
|
+
account: account,
|
|
237
|
+
chain: client.chain
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
throw AAStarError.fromViemError(error, 'slashOperator');
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
// User & SBT
|
|
245
|
+
async updateBlockedStatus({ operator, users, statuses, account }) {
|
|
246
|
+
try {
|
|
247
|
+
validateAddress(operator, 'operator');
|
|
248
|
+
validateRequired(users, 'users');
|
|
249
|
+
validateRequired(statuses, 'statuses');
|
|
250
|
+
return await client.writeContract({
|
|
251
|
+
address,
|
|
252
|
+
abi: SuperPaymasterABI,
|
|
253
|
+
functionName: 'updateBlockedStatus',
|
|
254
|
+
args: [operator, users, statuses],
|
|
255
|
+
account: account,
|
|
256
|
+
chain: client.chain
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
throw AAStarError.fromViemError(error, 'updateBlockedStatus');
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
async updateSBTStatus({ user, status, account }) {
|
|
264
|
+
try {
|
|
265
|
+
validateAddress(user, 'user');
|
|
266
|
+
return await client.writeContract({
|
|
267
|
+
address,
|
|
268
|
+
abi: SuperPaymasterABI,
|
|
269
|
+
functionName: 'updateSBTStatus',
|
|
270
|
+
args: [user, status],
|
|
271
|
+
account: account,
|
|
272
|
+
chain: client.chain
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
throw AAStarError.fromViemError(error, 'updateSBTStatus');
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
// Price
|
|
280
|
+
async setAPNTSPrice({ newPrice, account }) {
|
|
281
|
+
try {
|
|
282
|
+
validateAmount(newPrice, 'newPrice');
|
|
283
|
+
return await client.writeContract({
|
|
284
|
+
address,
|
|
285
|
+
abi: SuperPaymasterABI,
|
|
286
|
+
functionName: 'setAPNTSPrice',
|
|
287
|
+
args: [newPrice],
|
|
288
|
+
account: account,
|
|
289
|
+
chain: client.chain
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
throw AAStarError.fromViemError(error, 'setAPNTSPrice');
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
async updatePrice({ account }) {
|
|
297
|
+
try {
|
|
298
|
+
return await client.writeContract({
|
|
299
|
+
address,
|
|
300
|
+
abi: SuperPaymasterABI,
|
|
301
|
+
functionName: 'updatePrice',
|
|
302
|
+
args: [],
|
|
303
|
+
account: account,
|
|
304
|
+
chain: client.chain
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
catch (error) {
|
|
308
|
+
throw AAStarError.fromViemError(error, 'updatePrice');
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
async updatePriceDVT({ price, updatedAt, proof, account }) {
|
|
312
|
+
try {
|
|
313
|
+
validateRequired(price, 'price');
|
|
314
|
+
validateRequired(updatedAt, 'updatedAt');
|
|
315
|
+
validateRequired(proof, 'proof');
|
|
316
|
+
return await client.writeContract({
|
|
317
|
+
address,
|
|
318
|
+
abi: SuperPaymasterABI,
|
|
319
|
+
functionName: 'updatePriceDVT',
|
|
320
|
+
args: [price, updatedAt, proof],
|
|
321
|
+
account: account,
|
|
322
|
+
chain: client.chain
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
throw AAStarError.fromViemError(error, 'updatePriceDVT');
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
// Fees & Admin
|
|
330
|
+
async setProtocolFee({ newFeeBPS, account }) {
|
|
331
|
+
try {
|
|
332
|
+
validateAmount(newFeeBPS, 'newFeeBPS');
|
|
333
|
+
return await client.writeContract({
|
|
334
|
+
address,
|
|
335
|
+
abi: SuperPaymasterABI,
|
|
336
|
+
functionName: 'setProtocolFee',
|
|
337
|
+
args: [newFeeBPS],
|
|
338
|
+
account: account,
|
|
339
|
+
chain: client.chain
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
catch (error) {
|
|
343
|
+
throw AAStarError.fromViemError(error, 'setProtocolFee');
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
async setTreasury({ treasury, account }) {
|
|
347
|
+
try {
|
|
348
|
+
validateAddress(treasury, 'treasury');
|
|
349
|
+
return await client.writeContract({
|
|
350
|
+
address,
|
|
351
|
+
abi: SuperPaymasterABI,
|
|
352
|
+
functionName: 'setTreasury',
|
|
353
|
+
args: [treasury],
|
|
354
|
+
account: account,
|
|
355
|
+
chain: client.chain
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
catch (error) {
|
|
359
|
+
throw AAStarError.fromViemError(error, 'setTreasury');
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
async setXPNTsFactory({ factory, account }) {
|
|
363
|
+
try {
|
|
364
|
+
validateAddress(factory, 'factory');
|
|
365
|
+
return await client.writeContract({
|
|
366
|
+
address,
|
|
367
|
+
abi: SuperPaymasterABI,
|
|
368
|
+
functionName: 'setXPNTsFactory',
|
|
369
|
+
args: [factory],
|
|
370
|
+
account: account,
|
|
371
|
+
chain: client.chain
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
catch (error) {
|
|
375
|
+
throw AAStarError.fromViemError(error, 'setXPNTsFactory');
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
async setAPNTsToken({ token, account }) {
|
|
379
|
+
try {
|
|
380
|
+
validateAddress(token, 'token');
|
|
381
|
+
return await client.writeContract({
|
|
382
|
+
address,
|
|
383
|
+
abi: SuperPaymasterABI,
|
|
384
|
+
functionName: 'setAPNTsToken',
|
|
385
|
+
args: [token],
|
|
386
|
+
account: account,
|
|
387
|
+
chain: client.chain
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
catch (error) {
|
|
391
|
+
throw AAStarError.fromViemError(error, 'setAPNTsToken');
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
async setBLSAggregator({ aggregator, account }) {
|
|
395
|
+
try {
|
|
396
|
+
validateAddress(aggregator, 'aggregator');
|
|
397
|
+
return await client.writeContract({
|
|
398
|
+
address,
|
|
399
|
+
abi: SuperPaymasterABI,
|
|
400
|
+
functionName: 'setBLSAggregator',
|
|
401
|
+
args: [aggregator],
|
|
402
|
+
account: account,
|
|
403
|
+
chain: client.chain
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
catch (error) {
|
|
407
|
+
throw AAStarError.fromViemError(error, 'setBLSAggregator');
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
async withdrawProtocolRevenue({ to, amount, account }) {
|
|
411
|
+
try {
|
|
412
|
+
validateAddress(to, 'to');
|
|
413
|
+
validateAmount(amount, 'amount');
|
|
414
|
+
return await client.writeContract({
|
|
415
|
+
address,
|
|
416
|
+
abi: SuperPaymasterABI,
|
|
417
|
+
functionName: 'withdrawProtocolRevenue',
|
|
418
|
+
args: [to, amount],
|
|
419
|
+
account: account,
|
|
420
|
+
chain: client.chain
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
catch (error) {
|
|
424
|
+
throw AAStarError.fromViemError(error, 'withdrawProtocolRevenue');
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
// Callbacks & Validation
|
|
428
|
+
async onTransferReceived({ operator, from, value, data }) {
|
|
429
|
+
try {
|
|
430
|
+
validateAddress(operator, 'operator');
|
|
431
|
+
validateAddress(from, 'from');
|
|
432
|
+
validateAmount(value, 'value');
|
|
433
|
+
return await client.readContract({
|
|
434
|
+
address,
|
|
435
|
+
abi: SuperPaymasterABI,
|
|
436
|
+
functionName: 'onTransferReceived',
|
|
437
|
+
args: [operator, from, value, data]
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
throw AAStarError.fromViemError(error, 'onTransferReceived');
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
async validatePaymasterUserOp({ userOp, userOpHash, maxCost }) {
|
|
445
|
+
try {
|
|
446
|
+
return await client.readContract({
|
|
447
|
+
address,
|
|
448
|
+
abi: SuperPaymasterABI,
|
|
449
|
+
functionName: 'validatePaymasterUserOp',
|
|
450
|
+
args: [userOp, userOpHash, maxCost]
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
catch (error) {
|
|
454
|
+
throw AAStarError.fromViemError(error, 'validatePaymasterUserOp');
|
|
455
|
+
}
|
|
185
456
|
},
|
|
186
457
|
// View Functions
|
|
187
|
-
async
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
458
|
+
async operators({ operator }) {
|
|
459
|
+
try {
|
|
460
|
+
validateAddress(operator, 'operator');
|
|
461
|
+
const result = await client.readContract({
|
|
462
|
+
address,
|
|
463
|
+
abi: SuperPaymasterABI,
|
|
464
|
+
functionName: 'operators',
|
|
465
|
+
args: [operator]
|
|
466
|
+
});
|
|
467
|
+
if (Array.isArray(result)) {
|
|
468
|
+
return {
|
|
469
|
+
aPNTsBalance: result[0],
|
|
470
|
+
exchangeRate: result[1],
|
|
471
|
+
isConfigured: result[2],
|
|
472
|
+
isPaused: result[3],
|
|
473
|
+
xPNTsToken: result[4],
|
|
474
|
+
reputation: result[5],
|
|
475
|
+
minTxInterval: result[6],
|
|
476
|
+
treasury: result[7],
|
|
477
|
+
totalSpent: result[8],
|
|
478
|
+
totalTxSponsored: result[9]
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
return result;
|
|
482
|
+
}
|
|
483
|
+
catch (error) {
|
|
484
|
+
throw AAStarError.fromViemError(error, 'operators');
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
async getAvailableCredit({ user, token }) {
|
|
488
|
+
try {
|
|
489
|
+
validateAddress(user, 'user');
|
|
490
|
+
validateAddress(token, 'token');
|
|
491
|
+
return await client.readContract({
|
|
492
|
+
address,
|
|
493
|
+
abi: SuperPaymasterABI,
|
|
494
|
+
functionName: 'getAvailableCredit',
|
|
495
|
+
args: [user, token]
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
catch (error) {
|
|
499
|
+
throw AAStarError.fromViemError(error, 'getAvailableCredit');
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
async getDeposit() {
|
|
503
|
+
try {
|
|
504
|
+
return await client.readContract({
|
|
505
|
+
address,
|
|
506
|
+
abi: SuperPaymasterABI,
|
|
507
|
+
functionName: 'getDeposit',
|
|
508
|
+
args: []
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
catch (error) {
|
|
512
|
+
throw AAStarError.fromViemError(error, 'getDeposit');
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
async getLatestSlash({ operator }) {
|
|
516
|
+
try {
|
|
517
|
+
validateAddress(operator, 'operator');
|
|
518
|
+
const res = await client.readContract({
|
|
519
|
+
address,
|
|
520
|
+
abi: SuperPaymasterABI,
|
|
521
|
+
functionName: 'getLatestSlash',
|
|
522
|
+
args: [operator]
|
|
523
|
+
});
|
|
524
|
+
if (Array.isArray(res)) {
|
|
525
|
+
return {
|
|
526
|
+
timestamp: res[0],
|
|
527
|
+
amount: res[1],
|
|
528
|
+
reputationLoss: res[2],
|
|
529
|
+
reason: res[3],
|
|
530
|
+
level: res[4]
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
return res;
|
|
534
|
+
}
|
|
535
|
+
catch (error) {
|
|
536
|
+
throw AAStarError.fromViemError(error, 'getLatestSlash');
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
async getSlashCount({ operator }) {
|
|
540
|
+
try {
|
|
541
|
+
validateAddress(operator, 'operator');
|
|
542
|
+
return await client.readContract({
|
|
543
|
+
address,
|
|
544
|
+
abi: SuperPaymasterABI,
|
|
545
|
+
functionName: 'getSlashCount',
|
|
546
|
+
args: [operator]
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
catch (error) {
|
|
550
|
+
throw AAStarError.fromViemError(error, 'getSlashCount');
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
async getSlashHistory({ operator }) {
|
|
554
|
+
try {
|
|
555
|
+
validateAddress(operator, 'operator');
|
|
556
|
+
const res = await client.readContract({
|
|
557
|
+
address,
|
|
558
|
+
abi: SuperPaymasterABI,
|
|
559
|
+
functionName: 'getSlashHistory',
|
|
560
|
+
args: [operator]
|
|
561
|
+
});
|
|
562
|
+
return res.map(r => {
|
|
563
|
+
if (Array.isArray(r)) {
|
|
564
|
+
return {
|
|
565
|
+
timestamp: r[0],
|
|
566
|
+
amount: r[1],
|
|
567
|
+
reputationLoss: r[2],
|
|
568
|
+
reason: r[3],
|
|
569
|
+
level: r[4]
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
return r;
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
catch (error) {
|
|
576
|
+
throw AAStarError.fromViemError(error, 'getSlashHistory');
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
async slashHistory({ operator, index }) {
|
|
580
|
+
try {
|
|
581
|
+
validateAddress(operator, 'operator');
|
|
582
|
+
validateRequired(index, 'index');
|
|
583
|
+
const res = await client.readContract({
|
|
584
|
+
address,
|
|
585
|
+
abi: SuperPaymasterABI,
|
|
586
|
+
functionName: 'slashHistory',
|
|
587
|
+
args: [operator, index]
|
|
588
|
+
});
|
|
589
|
+
if (Array.isArray(res)) {
|
|
590
|
+
return {
|
|
591
|
+
timestamp: res[0],
|
|
592
|
+
amount: res[1],
|
|
593
|
+
reputationLoss: res[2],
|
|
594
|
+
reason: res[3],
|
|
595
|
+
level: res[4]
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
return res;
|
|
599
|
+
}
|
|
600
|
+
catch (error) {
|
|
601
|
+
throw AAStarError.fromViemError(error, 'slashHistory');
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
async userOpState({ user, operator }) {
|
|
605
|
+
try {
|
|
606
|
+
validateAddress(user, 'user');
|
|
607
|
+
validateAddress(operator, 'operator');
|
|
608
|
+
const res = await client.readContract({
|
|
609
|
+
address,
|
|
610
|
+
abi: SuperPaymasterABI,
|
|
611
|
+
functionName: 'userOpState',
|
|
612
|
+
args: [user, operator]
|
|
613
|
+
});
|
|
614
|
+
if (Array.isArray(res)) {
|
|
615
|
+
return { lastTimestamp: Number(res[0]), isBlocked: res[1] };
|
|
616
|
+
}
|
|
617
|
+
return { lastTimestamp: Number(res.lastTimestamp), isBlocked: res.isBlocked };
|
|
618
|
+
}
|
|
619
|
+
catch (error) {
|
|
620
|
+
throw AAStarError.fromViemError(error, 'userOpState');
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
async cachedPrice() {
|
|
624
|
+
try {
|
|
625
|
+
const res = await client.readContract({
|
|
626
|
+
address,
|
|
627
|
+
abi: SuperPaymasterABI,
|
|
628
|
+
functionName: 'cachedPrice',
|
|
629
|
+
args: []
|
|
630
|
+
});
|
|
631
|
+
if (Array.isArray(res)) {
|
|
632
|
+
return {
|
|
633
|
+
price: res[0],
|
|
634
|
+
updatedAt: res[1],
|
|
635
|
+
roundId: res[2],
|
|
636
|
+
decimals: res[3]
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
return res;
|
|
640
|
+
}
|
|
641
|
+
catch (error) {
|
|
642
|
+
throw AAStarError.fromViemError(error, 'cachedPrice');
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
async aPNTsPriceUSD() {
|
|
646
|
+
try {
|
|
647
|
+
return await client.readContract({
|
|
648
|
+
address,
|
|
649
|
+
abi: SuperPaymasterABI,
|
|
650
|
+
functionName: 'aPNTsPriceUSD',
|
|
651
|
+
args: []
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
catch (error) {
|
|
655
|
+
throw AAStarError.fromViemError(error, 'aPNTsPriceUSD');
|
|
656
|
+
}
|
|
657
|
+
},
|
|
658
|
+
async protocolFeeBPS() {
|
|
659
|
+
try {
|
|
660
|
+
return await client.readContract({
|
|
661
|
+
address,
|
|
662
|
+
abi: SuperPaymasterABI,
|
|
663
|
+
functionName: 'protocolFeeBPS',
|
|
664
|
+
args: []
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
catch (error) {
|
|
668
|
+
throw AAStarError.fromViemError(error, 'protocolFeeBPS');
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
async protocolRevenue() {
|
|
672
|
+
try {
|
|
673
|
+
return await client.readContract({
|
|
674
|
+
address,
|
|
675
|
+
abi: SuperPaymasterABI,
|
|
676
|
+
functionName: 'protocolRevenue',
|
|
677
|
+
args: []
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
catch (error) {
|
|
681
|
+
throw AAStarError.fromViemError(error, 'protocolRevenue');
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
async totalTrackedBalance() {
|
|
685
|
+
try {
|
|
686
|
+
return await client.readContract({
|
|
687
|
+
address,
|
|
688
|
+
abi: SuperPaymasterABI,
|
|
689
|
+
functionName: 'totalTrackedBalance',
|
|
690
|
+
args: []
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
catch (error) {
|
|
694
|
+
throw AAStarError.fromViemError(error, 'totalTrackedBalance');
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
async priceStalenessThreshold() {
|
|
698
|
+
try {
|
|
699
|
+
return await client.readContract({
|
|
700
|
+
address,
|
|
701
|
+
abi: SuperPaymasterABI,
|
|
702
|
+
functionName: 'priceStalenessThreshold',
|
|
703
|
+
args: []
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
catch (error) {
|
|
707
|
+
throw AAStarError.fromViemError(error, 'priceStalenessThreshold');
|
|
708
|
+
}
|
|
709
|
+
},
|
|
710
|
+
async sbtHolders({ user }) {
|
|
711
|
+
try {
|
|
712
|
+
validateAddress(user, 'user');
|
|
713
|
+
return await client.readContract({
|
|
714
|
+
address,
|
|
715
|
+
abi: SuperPaymasterABI,
|
|
716
|
+
functionName: 'sbtHolders',
|
|
717
|
+
args: [user]
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
catch (error) {
|
|
721
|
+
throw AAStarError.fromViemError(error, 'sbtHolders');
|
|
722
|
+
}
|
|
255
723
|
},
|
|
256
724
|
// Constants
|
|
257
|
-
async
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}
|
|
725
|
+
async APNTS_TOKEN() {
|
|
726
|
+
try {
|
|
727
|
+
return await client.readContract({
|
|
728
|
+
address,
|
|
729
|
+
abi: SuperPaymasterABI,
|
|
730
|
+
functionName: 'APNTS_TOKEN',
|
|
731
|
+
args: []
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
catch (error) {
|
|
735
|
+
throw AAStarError.fromViemError(error, 'APNTS_TOKEN');
|
|
736
|
+
}
|
|
737
|
+
},
|
|
738
|
+
async REGISTRY() {
|
|
739
|
+
try {
|
|
740
|
+
return await client.readContract({
|
|
741
|
+
address,
|
|
742
|
+
abi: SuperPaymasterABI,
|
|
743
|
+
functionName: 'REGISTRY',
|
|
744
|
+
args: []
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
catch (error) {
|
|
748
|
+
throw AAStarError.fromViemError(error, 'REGISTRY');
|
|
749
|
+
}
|
|
750
|
+
},
|
|
751
|
+
async BLS_AGGREGATOR() {
|
|
752
|
+
try {
|
|
753
|
+
return await client.readContract({
|
|
754
|
+
address,
|
|
755
|
+
abi: SuperPaymasterABI,
|
|
756
|
+
functionName: 'BLS_AGGREGATOR',
|
|
757
|
+
args: []
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
catch (error) {
|
|
761
|
+
throw AAStarError.fromViemError(error, 'BLS_AGGREGATOR');
|
|
762
|
+
}
|
|
763
|
+
},
|
|
764
|
+
async ETH_USD_PRICE_FEED() {
|
|
765
|
+
try {
|
|
766
|
+
return await client.readContract({
|
|
767
|
+
address,
|
|
768
|
+
abi: SuperPaymasterABI,
|
|
769
|
+
functionName: 'ETH_USD_PRICE_FEED',
|
|
770
|
+
args: []
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
catch (error) {
|
|
774
|
+
throw AAStarError.fromViemError(error, 'ETH_USD_PRICE_FEED');
|
|
775
|
+
}
|
|
776
|
+
},
|
|
777
|
+
async treasury() {
|
|
778
|
+
try {
|
|
779
|
+
return await client.readContract({
|
|
780
|
+
address,
|
|
781
|
+
abi: SuperPaymasterABI,
|
|
782
|
+
functionName: 'treasury',
|
|
783
|
+
args: []
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
catch (error) {
|
|
787
|
+
throw AAStarError.fromViemError(error, 'treasury');
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
async xpntsFactory() {
|
|
791
|
+
try {
|
|
792
|
+
return await client.readContract({
|
|
793
|
+
address,
|
|
794
|
+
abi: SuperPaymasterABI,
|
|
795
|
+
functionName: 'xpntsFactory',
|
|
796
|
+
args: []
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
catch (error) {
|
|
800
|
+
throw AAStarError.fromViemError(error, 'xpntsFactory');
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
async entryPoint() {
|
|
804
|
+
try {
|
|
805
|
+
return await client.readContract({
|
|
806
|
+
address,
|
|
807
|
+
abi: SuperPaymasterABI,
|
|
808
|
+
functionName: 'entryPoint',
|
|
809
|
+
args: []
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
catch (error) {
|
|
813
|
+
throw AAStarError.fromViemError(error, 'entryPoint');
|
|
814
|
+
}
|
|
815
|
+
},
|
|
816
|
+
async MAX_PROTOCOL_FEE() {
|
|
817
|
+
try {
|
|
818
|
+
return await client.readContract({
|
|
819
|
+
address,
|
|
820
|
+
abi: SuperPaymasterABI,
|
|
821
|
+
functionName: 'MAX_PROTOCOL_FEE',
|
|
822
|
+
args: []
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
catch (error) {
|
|
826
|
+
throw AAStarError.fromViemError(error, 'MAX_PROTOCOL_FEE');
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
async MAX_ETH_USD_PRICE() {
|
|
830
|
+
try {
|
|
831
|
+
return await client.readContract({
|
|
832
|
+
address,
|
|
833
|
+
abi: SuperPaymasterABI,
|
|
834
|
+
functionName: 'MAX_ETH_USD_PRICE',
|
|
835
|
+
args: []
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
catch (error) {
|
|
839
|
+
throw AAStarError.fromViemError(error, 'MAX_ETH_USD_PRICE');
|
|
840
|
+
}
|
|
841
|
+
},
|
|
842
|
+
async MIN_ETH_USD_PRICE() {
|
|
843
|
+
try {
|
|
844
|
+
return await client.readContract({
|
|
845
|
+
address,
|
|
846
|
+
abi: SuperPaymasterABI,
|
|
847
|
+
functionName: 'MIN_ETH_USD_PRICE',
|
|
848
|
+
args: []
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
catch (error) {
|
|
852
|
+
throw AAStarError.fromViemError(error, 'MIN_ETH_USD_PRICE');
|
|
853
|
+
}
|
|
854
|
+
},
|
|
855
|
+
async PAYMASTER_DATA_OFFSET() {
|
|
856
|
+
try {
|
|
857
|
+
return await client.readContract({
|
|
858
|
+
address,
|
|
859
|
+
abi: SuperPaymasterABI,
|
|
860
|
+
functionName: 'PAYMASTER_DATA_OFFSET',
|
|
861
|
+
args: []
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
catch (error) {
|
|
865
|
+
throw AAStarError.fromViemError(error, 'PAYMASTER_DATA_OFFSET');
|
|
866
|
+
}
|
|
867
|
+
},
|
|
868
|
+
async PRICE_CACHE_DURATION() {
|
|
869
|
+
try {
|
|
870
|
+
return await client.readContract({
|
|
871
|
+
address,
|
|
872
|
+
abi: SuperPaymasterABI,
|
|
873
|
+
functionName: 'PRICE_CACHE_DURATION',
|
|
874
|
+
args: []
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
catch (error) {
|
|
878
|
+
throw AAStarError.fromViemError(error, 'PRICE_CACHE_DURATION');
|
|
879
|
+
}
|
|
880
|
+
},
|
|
881
|
+
async RATE_OFFSET() {
|
|
882
|
+
try {
|
|
883
|
+
return await client.readContract({
|
|
884
|
+
address,
|
|
885
|
+
abi: SuperPaymasterABI,
|
|
886
|
+
functionName: 'RATE_OFFSET',
|
|
887
|
+
args: []
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
catch (error) {
|
|
891
|
+
throw AAStarError.fromViemError(error, 'RATE_OFFSET');
|
|
892
|
+
}
|
|
893
|
+
},
|
|
894
|
+
async VALIDATION_BUFFER_BPS() {
|
|
895
|
+
try {
|
|
896
|
+
return await client.readContract({
|
|
897
|
+
address,
|
|
898
|
+
abi: SuperPaymasterABI,
|
|
899
|
+
functionName: 'VALIDATION_BUFFER_BPS',
|
|
900
|
+
args: []
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
catch (error) {
|
|
904
|
+
throw AAStarError.fromViemError(error, 'VALIDATION_BUFFER_BPS');
|
|
905
|
+
}
|
|
906
|
+
},
|
|
907
|
+
async BPS_DENOMINATOR() {
|
|
908
|
+
try {
|
|
909
|
+
return await client.readContract({
|
|
910
|
+
address,
|
|
911
|
+
abi: SuperPaymasterABI,
|
|
912
|
+
functionName: 'BPS_DENOMINATOR',
|
|
913
|
+
args: []
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
catch (error) {
|
|
917
|
+
throw AAStarError.fromViemError(error, 'BPS_DENOMINATOR');
|
|
918
|
+
}
|
|
344
919
|
},
|
|
345
920
|
// Admin
|
|
346
|
-
async
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
async
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
account: account,
|
|
403
|
-
chain: client.chain
|
|
404
|
-
});
|
|
405
|
-
},
|
|
406
|
-
// Additional View Functions
|
|
407
|
-
async superPaymasterProtocolFeeBPS() {
|
|
408
|
-
return client.readContract({
|
|
409
|
-
address,
|
|
410
|
-
abi: SuperPaymasterABI,
|
|
411
|
-
functionName: 'protocolFeeBPS',
|
|
412
|
-
args: []
|
|
413
|
-
});
|
|
414
|
-
},
|
|
415
|
-
async superPaymasterProtocolRevenue() {
|
|
416
|
-
return client.readContract({
|
|
417
|
-
address,
|
|
418
|
-
abi: SuperPaymasterABI,
|
|
419
|
-
functionName: 'protocolRevenue',
|
|
420
|
-
args: []
|
|
421
|
-
});
|
|
422
|
-
},
|
|
423
|
-
async superPaymasterTreasury() {
|
|
424
|
-
return client.readContract({
|
|
425
|
-
address,
|
|
426
|
-
abi: SuperPaymasterABI,
|
|
427
|
-
functionName: 'treasury',
|
|
428
|
-
args: []
|
|
429
|
-
});
|
|
430
|
-
},
|
|
431
|
-
async superPaymasterXpntsFactory() {
|
|
432
|
-
return client.readContract({
|
|
433
|
-
address,
|
|
434
|
-
abi: SuperPaymasterABI,
|
|
435
|
-
functionName: 'xpntsFactory',
|
|
436
|
-
args: []
|
|
437
|
-
});
|
|
438
|
-
},
|
|
439
|
-
async superPaymasterTotalTrackedBalance() {
|
|
440
|
-
return client.readContract({
|
|
441
|
-
address,
|
|
442
|
-
abi: SuperPaymasterABI,
|
|
443
|
-
functionName: 'totalTrackedBalance',
|
|
444
|
-
args: []
|
|
445
|
-
});
|
|
446
|
-
},
|
|
447
|
-
async superPaymasterLastUserOpTimestamp({ user }) {
|
|
448
|
-
return client.readContract({
|
|
449
|
-
address,
|
|
450
|
-
abi: SuperPaymasterABI,
|
|
451
|
-
functionName: 'lastUserOpTimestamp',
|
|
452
|
-
args: [user]
|
|
453
|
-
});
|
|
454
|
-
},
|
|
455
|
-
// Slash History
|
|
456
|
-
async superPaymasterGetSlashHistory({ operator }) {
|
|
457
|
-
return client.readContract({
|
|
458
|
-
address,
|
|
459
|
-
abi: SuperPaymasterABI,
|
|
460
|
-
functionName: 'getSlashHistory',
|
|
461
|
-
args: [operator]
|
|
462
|
-
});
|
|
463
|
-
},
|
|
464
|
-
async superPaymasterGetSlashCount({ operator }) {
|
|
465
|
-
return client.readContract({
|
|
466
|
-
address,
|
|
467
|
-
abi: SuperPaymasterABI,
|
|
468
|
-
functionName: 'getSlashCount',
|
|
469
|
-
args: [operator]
|
|
470
|
-
});
|
|
471
|
-
},
|
|
472
|
-
async superPaymasterGetLatestSlash({ operator }) {
|
|
473
|
-
return client.readContract({
|
|
474
|
-
address,
|
|
475
|
-
abi: SuperPaymasterABI,
|
|
476
|
-
functionName: 'getLatestSlash',
|
|
477
|
-
args: [operator]
|
|
478
|
-
});
|
|
479
|
-
},
|
|
480
|
-
async superPaymasterSlashHistory({ operator, index }) {
|
|
481
|
-
return client.readContract({
|
|
482
|
-
address,
|
|
483
|
-
abi: SuperPaymasterABI,
|
|
484
|
-
functionName: 'slashHistory',
|
|
485
|
-
args: [operator, index]
|
|
486
|
-
});
|
|
487
|
-
},
|
|
488
|
-
// Price Management
|
|
489
|
-
async superPaymasterUpdatePrice({ account }) {
|
|
490
|
-
return client.writeContract({
|
|
491
|
-
address,
|
|
492
|
-
abi: SuperPaymasterABI,
|
|
493
|
-
functionName: 'updatePrice',
|
|
494
|
-
args: [],
|
|
495
|
-
account: account,
|
|
496
|
-
chain: client.chain
|
|
497
|
-
});
|
|
498
|
-
},
|
|
499
|
-
async superPaymasterUpdatePriceDVT({ price, proof, account }) {
|
|
500
|
-
return client.writeContract({
|
|
501
|
-
address,
|
|
502
|
-
abi: SuperPaymasterABI,
|
|
503
|
-
functionName: 'updatePriceDVT',
|
|
504
|
-
args: [price, proof],
|
|
505
|
-
account: account,
|
|
506
|
-
chain: client.chain
|
|
507
|
-
});
|
|
508
|
-
},
|
|
509
|
-
// Treasury & Revenue
|
|
510
|
-
async superPaymasterSetTreasury({ treasury, account }) {
|
|
511
|
-
return client.writeContract({
|
|
512
|
-
address,
|
|
513
|
-
abi: SuperPaymasterABI,
|
|
514
|
-
functionName: 'setTreasury',
|
|
515
|
-
args: [treasury],
|
|
516
|
-
account: account,
|
|
517
|
-
chain: client.chain
|
|
518
|
-
});
|
|
519
|
-
},
|
|
520
|
-
async superPaymasterWithdrawProtocolRevenue({ to, account }) {
|
|
521
|
-
return client.writeContract({
|
|
522
|
-
address,
|
|
523
|
-
abi: SuperPaymasterABI,
|
|
524
|
-
functionName: 'withdrawProtocolRevenue',
|
|
525
|
-
args: [to],
|
|
526
|
-
account: account,
|
|
527
|
-
chain: client.chain
|
|
528
|
-
});
|
|
529
|
-
},
|
|
530
|
-
// Factory & Config
|
|
531
|
-
async superPaymasterSetXPNTsFactory({ factory, account }) {
|
|
532
|
-
return client.writeContract({
|
|
533
|
-
address,
|
|
534
|
-
abi: SuperPaymasterABI,
|
|
535
|
-
functionName: 'setXPNTsFactory',
|
|
536
|
-
args: [factory],
|
|
537
|
-
account: account,
|
|
538
|
-
chain: client.chain
|
|
539
|
-
});
|
|
540
|
-
},
|
|
541
|
-
async superPaymasterSetAPNTsToken({ token, account }) {
|
|
542
|
-
return client.writeContract({
|
|
543
|
-
address,
|
|
544
|
-
abi: SuperPaymasterABI,
|
|
545
|
-
functionName: 'setAPNTsToken',
|
|
546
|
-
args: [token],
|
|
547
|
-
account: account,
|
|
548
|
-
chain: client.chain
|
|
549
|
-
});
|
|
550
|
-
},
|
|
551
|
-
async superPaymasterSetBLSAggregator({ aggregator, account }) {
|
|
552
|
-
return client.writeContract({
|
|
553
|
-
address,
|
|
554
|
-
abi: SuperPaymasterABI,
|
|
555
|
-
functionName: 'setBLSAggregator',
|
|
556
|
-
args: [aggregator],
|
|
557
|
-
account: account,
|
|
558
|
-
chain: client.chain
|
|
559
|
-
});
|
|
560
|
-
},
|
|
561
|
-
// Transfer callback
|
|
562
|
-
async superPaymasterOnTransferReceived({ from, amount, data }) {
|
|
563
|
-
return client.readContract({
|
|
564
|
-
address,
|
|
565
|
-
abi: SuperPaymasterABI,
|
|
566
|
-
functionName: 'onTransferReceived',
|
|
567
|
-
args: [from, amount, data]
|
|
568
|
-
});
|
|
569
|
-
},
|
|
570
|
-
// Withdraw alias
|
|
571
|
-
async superPaymasterWithdrawAPNTs({ amount, account }) {
|
|
572
|
-
return client.writeContract({
|
|
573
|
-
address,
|
|
574
|
-
abi: SuperPaymasterABI,
|
|
575
|
-
functionName: 'withdraw',
|
|
576
|
-
args: [amount],
|
|
577
|
-
account: account,
|
|
578
|
-
chain: client.chain
|
|
579
|
-
});
|
|
580
|
-
},
|
|
581
|
-
async superPaymasterVersion() {
|
|
582
|
-
return client.readContract({
|
|
583
|
-
address,
|
|
584
|
-
abi: SuperPaymasterABI,
|
|
585
|
-
functionName: 'version',
|
|
586
|
-
args: []
|
|
587
|
-
});
|
|
588
|
-
},
|
|
589
|
-
// Aliases including implementation
|
|
590
|
-
async superPaymasterAddStake(args) { return this.superPaymasterDepositFor(args); },
|
|
591
|
-
async superPaymasterDepositForAlias(args) { return this.superPaymasterDepositFor(args); },
|
|
592
|
-
async superPaymasterUnlockStake(args) { return this.superPaymasterUnlockSuperStake(args); },
|
|
593
|
-
async superPaymasterWithdrawAlias(args) { return this.superPaymasterWithdraw(args); },
|
|
594
|
-
async superPaymasterMAX_PROTOCOL_FEE() {
|
|
595
|
-
return client.readContract({
|
|
596
|
-
address,
|
|
597
|
-
abi: SuperPaymasterABI,
|
|
598
|
-
functionName: 'MAX_PROTOCOL_FEE',
|
|
599
|
-
args: []
|
|
600
|
-
});
|
|
601
|
-
},
|
|
602
|
-
async superPaymasterVALIDATION_BUFFER_BPS() {
|
|
603
|
-
return client.readContract({
|
|
604
|
-
address,
|
|
605
|
-
abi: SuperPaymasterABI,
|
|
606
|
-
functionName: 'VALIDATION_BUFFER_BPS',
|
|
607
|
-
args: []
|
|
608
|
-
});
|
|
609
|
-
},
|
|
610
|
-
async superPaymasterPriceStalenessThreshold() {
|
|
611
|
-
return client.readContract({
|
|
612
|
-
address,
|
|
613
|
-
abi: SuperPaymasterABI,
|
|
614
|
-
functionName: 'priceStalenessThreshold', // Assuming ABI has this exact name
|
|
615
|
-
args: []
|
|
616
|
-
});
|
|
617
|
-
},
|
|
618
|
-
async superPaymasterSbtHolders({ user }) {
|
|
619
|
-
return client.readContract({
|
|
620
|
-
address,
|
|
621
|
-
abi: SuperPaymasterABI,
|
|
622
|
-
functionName: 'sbtHolders',
|
|
623
|
-
args: [user]
|
|
624
|
-
});
|
|
625
|
-
},
|
|
626
|
-
async superPaymasterUserOpState({ userOpHash }) {
|
|
627
|
-
return client.readContract({
|
|
628
|
-
address,
|
|
629
|
-
abi: SuperPaymasterABI,
|
|
630
|
-
functionName: 'userOpState',
|
|
631
|
-
args: [userOpHash]
|
|
632
|
-
});
|
|
633
|
-
},
|
|
634
|
-
async superPaymasterUpdateSBTStatus({ user, hasSBT, account }) {
|
|
635
|
-
return client.writeContract({
|
|
636
|
-
address,
|
|
637
|
-
abi: SuperPaymasterABI,
|
|
638
|
-
functionName: 'updateSBTStatus',
|
|
639
|
-
args: [user, hasSBT],
|
|
640
|
-
account: account,
|
|
641
|
-
chain: client.chain
|
|
642
|
-
});
|
|
921
|
+
async owner() {
|
|
922
|
+
try {
|
|
923
|
+
return await client.readContract({
|
|
924
|
+
address,
|
|
925
|
+
abi: SuperPaymasterABI,
|
|
926
|
+
functionName: 'owner',
|
|
927
|
+
args: []
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
catch (error) {
|
|
931
|
+
throw AAStarError.fromViemError(error, 'owner');
|
|
932
|
+
}
|
|
933
|
+
},
|
|
934
|
+
async transferOwnership({ newOwner, account }) {
|
|
935
|
+
try {
|
|
936
|
+
validateAddress(newOwner, 'newOwner');
|
|
937
|
+
return await client.writeContract({
|
|
938
|
+
address,
|
|
939
|
+
abi: SuperPaymasterABI,
|
|
940
|
+
functionName: 'transferOwnership',
|
|
941
|
+
args: [newOwner],
|
|
942
|
+
account: account,
|
|
943
|
+
chain: client.chain
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
catch (error) {
|
|
947
|
+
throw AAStarError.fromViemError(error, 'transferOwnership');
|
|
948
|
+
}
|
|
949
|
+
},
|
|
950
|
+
async renounceOwnership({ account }) {
|
|
951
|
+
try {
|
|
952
|
+
return await client.writeContract({
|
|
953
|
+
address,
|
|
954
|
+
abi: SuperPaymasterABI,
|
|
955
|
+
functionName: 'renounceOwnership',
|
|
956
|
+
args: [],
|
|
957
|
+
account: account,
|
|
958
|
+
chain: client.chain
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
catch (error) {
|
|
962
|
+
throw AAStarError.fromViemError(error, 'renounceOwnership');
|
|
963
|
+
}
|
|
964
|
+
},
|
|
965
|
+
async version() {
|
|
966
|
+
try {
|
|
967
|
+
return await client.readContract({
|
|
968
|
+
address,
|
|
969
|
+
abi: SuperPaymasterABI,
|
|
970
|
+
functionName: 'version',
|
|
971
|
+
args: []
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
catch (error) {
|
|
975
|
+
throw AAStarError.fromViemError(error, 'version');
|
|
976
|
+
}
|
|
643
977
|
}
|
|
644
978
|
});
|