@aastar/paymaster 0.16.7

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 (106) hide show
  1. package/LICENSE +21 -0
  2. package/dist/core/src/abis/BLSAggregator.json +686 -0
  3. package/dist/core/src/abis/BLSValidator.json +42 -0
  4. package/dist/core/src/abis/DVTValidator.json +368 -0
  5. package/dist/core/src/abis/EntryPoint.json +1382 -0
  6. package/dist/core/src/abis/GToken.json +513 -0
  7. package/dist/core/src/abis/GTokenStaking.json +949 -0
  8. package/dist/core/src/abis/MySBT.json +1518 -0
  9. package/dist/core/src/abis/Paymaster.json +1143 -0
  10. package/dist/core/src/abis/PaymasterFactory.json +640 -0
  11. package/dist/core/src/abis/Registry.json +1942 -0
  12. package/dist/core/src/abis/ReputationSystem.json +699 -0
  13. package/dist/core/src/abis/SimpleAccount.json +560 -0
  14. package/dist/core/src/abis/SimpleAccountFactory.json +111 -0
  15. package/dist/core/src/abis/SuperPaymaster.json +1781 -0
  16. package/dist/core/src/abis/index.d.ts +1126 -0
  17. package/dist/core/src/abis/index.js +91 -0
  18. package/dist/core/src/abis/xPNTsFactory.json +718 -0
  19. package/dist/core/src/abis/xPNTsToken.json +1280 -0
  20. package/dist/core/src/actions/StateValidator.d.ts +68 -0
  21. package/dist/core/src/actions/StateValidator.js +187 -0
  22. package/dist/core/src/actions/account.d.ts +55 -0
  23. package/dist/core/src/actions/account.js +133 -0
  24. package/dist/core/src/actions/aggregator.d.ts +17 -0
  25. package/dist/core/src/actions/aggregator.js +31 -0
  26. package/dist/core/src/actions/dvt.d.ts +30 -0
  27. package/dist/core/src/actions/dvt.js +41 -0
  28. package/dist/core/src/actions/entryPoint.d.ts +90 -0
  29. package/dist/core/src/actions/entryPoint.js +211 -0
  30. package/dist/core/src/actions/factory.d.ts +215 -0
  31. package/dist/core/src/actions/factory.js +442 -0
  32. package/dist/core/src/actions/faucet.d.ts +48 -0
  33. package/dist/core/src/actions/faucet.js +337 -0
  34. package/dist/core/src/actions/gtokenExtended.d.ts +39 -0
  35. package/dist/core/src/actions/gtokenExtended.js +115 -0
  36. package/dist/core/src/actions/index.d.ts +15 -0
  37. package/dist/core/src/actions/index.js +17 -0
  38. package/dist/core/src/actions/paymasterV4.d.ts +170 -0
  39. package/dist/core/src/actions/paymasterV4.js +334 -0
  40. package/dist/core/src/actions/registry.d.ts +246 -0
  41. package/dist/core/src/actions/registry.js +667 -0
  42. package/dist/core/src/actions/reputation.d.ts +129 -0
  43. package/dist/core/src/actions/reputation.js +281 -0
  44. package/dist/core/src/actions/sbt.d.ts +191 -0
  45. package/dist/core/src/actions/sbt.js +533 -0
  46. package/dist/core/src/actions/staking.d.ts +132 -0
  47. package/dist/core/src/actions/staking.js +330 -0
  48. package/dist/core/src/actions/superPaymaster.d.ts +237 -0
  49. package/dist/core/src/actions/superPaymaster.js +644 -0
  50. package/dist/core/src/actions/tokens.d.ts +229 -0
  51. package/dist/core/src/actions/tokens.js +415 -0
  52. package/dist/core/src/branding.d.ts +30 -0
  53. package/dist/core/src/branding.js +30 -0
  54. package/dist/core/src/clients/BaseClient.d.ts +25 -0
  55. package/dist/core/src/clients/BaseClient.js +66 -0
  56. package/dist/core/src/clients/types.d.ts +60 -0
  57. package/dist/core/src/clients/types.js +1 -0
  58. package/dist/core/src/clients.d.ts +5 -0
  59. package/dist/core/src/clients.js +11 -0
  60. package/dist/core/src/communities.d.ts +52 -0
  61. package/dist/core/src/communities.js +73 -0
  62. package/dist/core/src/config/ContractConfigManager.d.ts +20 -0
  63. package/dist/core/src/config/ContractConfigManager.js +48 -0
  64. package/dist/core/src/constants.d.ts +88 -0
  65. package/dist/core/src/constants.js +125 -0
  66. package/dist/core/src/contract-addresses.d.ts +110 -0
  67. package/dist/core/src/contract-addresses.js +99 -0
  68. package/dist/core/src/contracts.d.ts +424 -0
  69. package/dist/core/src/contracts.js +343 -0
  70. package/dist/core/src/crypto/blsSigner.d.ts +64 -0
  71. package/dist/core/src/crypto/blsSigner.js +98 -0
  72. package/dist/core/src/crypto/index.d.ts +1 -0
  73. package/dist/core/src/crypto/index.js +1 -0
  74. package/dist/core/src/index.d.ts +21 -0
  75. package/dist/core/src/index.js +21 -0
  76. package/dist/core/src/networks.d.ts +127 -0
  77. package/dist/core/src/networks.js +118 -0
  78. package/dist/core/src/requirementChecker.d.ts +38 -0
  79. package/dist/core/src/requirementChecker.js +139 -0
  80. package/dist/core/src/roles.d.ts +204 -0
  81. package/dist/core/src/roles.js +211 -0
  82. package/dist/core/src/utils/validation.d.ts +24 -0
  83. package/dist/core/src/utils/validation.js +56 -0
  84. package/dist/paymaster/src/SuperPaymaster/index.d.ts +44 -0
  85. package/dist/paymaster/src/SuperPaymaster/index.js +133 -0
  86. package/dist/paymaster/src/V4/PaymasterClient.d.ts +79 -0
  87. package/dist/paymaster/src/V4/PaymasterClient.js +315 -0
  88. package/dist/paymaster/src/V4/PaymasterClient.test.d.ts +1 -0
  89. package/dist/paymaster/src/V4/PaymasterClient.test.js +80 -0
  90. package/dist/paymaster/src/V4/PaymasterOperator.d.ts +41 -0
  91. package/dist/paymaster/src/V4/PaymasterOperator.js +241 -0
  92. package/dist/paymaster/src/V4/PaymasterOperator.test.d.ts +1 -0
  93. package/dist/paymaster/src/V4/PaymasterOperator.test.js +66 -0
  94. package/dist/paymaster/src/V4/PaymasterUtils.d.ts +55 -0
  95. package/dist/paymaster/src/V4/PaymasterUtils.js +124 -0
  96. package/dist/paymaster/src/V4/PaymasterUtils.test.d.ts +1 -0
  97. package/dist/paymaster/src/V4/PaymasterUtils.test.js +43 -0
  98. package/dist/paymaster/src/V4/SuperPaymasterClient.d.ts +21 -0
  99. package/dist/paymaster/src/V4/SuperPaymasterClient.js +73 -0
  100. package/dist/paymaster/src/V4/SuperPaymasterClient.test.d.ts +1 -0
  101. package/dist/paymaster/src/V4/SuperPaymasterClient.test.js +53 -0
  102. package/dist/paymaster/src/V4/index.d.ts +4 -0
  103. package/dist/paymaster/src/V4/index.js +4 -0
  104. package/dist/paymaster/src/index.d.ts +2 -0
  105. package/dist/paymaster/src/index.js +4 -0
  106. package/package.json +26 -0
@@ -0,0 +1,644 @@
1
+ import { SuperPaymasterABI } from '../abis/index.js';
2
+ export const superPaymasterActions = (address) => (client) => ({
3
+ // Deposit & Withdrawal
4
+ async superPaymasterDeposit({ amount, account }) {
5
+ return client.writeContract({
6
+ address,
7
+ abi: SuperPaymasterABI,
8
+ functionName: 'deposit',
9
+ args: [amount],
10
+ account: account,
11
+ chain: client.chain
12
+ });
13
+ },
14
+ // Semantic alias: depositAPNTs - uses aPNTs token (nonpayable)
15
+ async superPaymasterDepositAPNTs({ amount, account }) {
16
+ return this.superPaymasterDeposit({ amount, account });
17
+ },
18
+ // depositETH - uses native ETH (payable, no args)
19
+ async superPaymasterDepositETH({ value, account }) {
20
+ return client.writeContract({
21
+ address,
22
+ abi: SuperPaymasterABI,
23
+ functionName: 'deposit',
24
+ args: [],
25
+ value,
26
+ account: account,
27
+ chain: client.chain
28
+ });
29
+ },
30
+ async superPaymasterWithdraw({ amount, account }) {
31
+ return client.writeContract({
32
+ address,
33
+ abi: SuperPaymasterABI,
34
+ functionName: 'withdraw',
35
+ args: [amount],
36
+ account: account,
37
+ chain: client.chain
38
+ });
39
+ },
40
+ async superPaymasterDepositFor({ operator, amount, account }) {
41
+ return client.writeContract({
42
+ address,
43
+ abi: SuperPaymasterABI,
44
+ functionName: 'depositFor',
45
+ args: [operator, amount],
46
+ account: account,
47
+ chain: client.chain
48
+ });
49
+ },
50
+ async superPaymasterWithdrawTo({ to, amount, account }) {
51
+ return client.writeContract({
52
+ address,
53
+ abi: SuperPaymasterABI,
54
+ functionName: 'withdrawTo',
55
+ args: [to, amount],
56
+ account: account,
57
+ chain: client.chain
58
+ });
59
+ },
60
+ async superPaymasterAddSuperStake({ amount, account }) {
61
+ return client.writeContract({
62
+ address,
63
+ abi: SuperPaymasterABI,
64
+ functionName: 'addStake',
65
+ args: [amount],
66
+ account: account,
67
+ chain: client.chain
68
+ });
69
+ },
70
+ async superPaymasterUnlockSuperStake({ account }) {
71
+ return client.writeContract({
72
+ address,
73
+ abi: SuperPaymasterABI,
74
+ functionName: 'unlockStake',
75
+ args: [],
76
+ account: account,
77
+ chain: client.chain
78
+ });
79
+ },
80
+ async superPaymasterWithdrawStake({ to, account }) {
81
+ return client.writeContract({
82
+ address,
83
+ abi: SuperPaymasterABI,
84
+ functionName: 'withdrawStake',
85
+ args: [to],
86
+ account: account,
87
+ chain: client.chain
88
+ });
89
+ },
90
+ // Operator Management
91
+ async superPaymasterConfigureOperator({ xPNTsToken, treasury, exchangeRate, account }) {
92
+ return client.writeContract({
93
+ address,
94
+ abi: SuperPaymasterABI,
95
+ functionName: 'configureOperator',
96
+ args: [xPNTsToken, treasury, exchangeRate],
97
+ account: account,
98
+ chain: client.chain
99
+ });
100
+ },
101
+ async superPaymasterSetOperatorPaused({ operator, paused, account }) {
102
+ return client.writeContract({
103
+ address,
104
+ abi: SuperPaymasterABI,
105
+ functionName: 'setOperatorPaused',
106
+ args: [operator, paused],
107
+ account: account,
108
+ chain: client.chain
109
+ });
110
+ },
111
+ async superPaymasterUpdateReputation({ operator, newReputation, account }) {
112
+ return client.writeContract({
113
+ address,
114
+ abi: SuperPaymasterABI,
115
+ functionName: 'updateReputation',
116
+ args: [operator, newReputation],
117
+ account: account,
118
+ chain: client.chain
119
+ });
120
+ },
121
+ async superPaymasterExecuteSlashWithBLS({ operator, roleId, amount, reason, blsSignature, account }) {
122
+ return client.writeContract({
123
+ address,
124
+ abi: SuperPaymasterABI,
125
+ functionName: 'executeSlashWithBLS',
126
+ args: [operator, roleId, amount, reason, blsSignature],
127
+ account: account,
128
+ chain: client.chain
129
+ });
130
+ },
131
+ // Price & Configuration
132
+ async superPaymasterSetAPNTsPrice({ priceUSD, account }) {
133
+ return client.writeContract({
134
+ address,
135
+ abi: SuperPaymasterABI,
136
+ functionName: 'setAPNTsPrice',
137
+ args: [priceUSD],
138
+ account: account,
139
+ chain: client.chain
140
+ });
141
+ },
142
+ async superPaymasterSetCachedPrice({ price, account }) {
143
+ return client.writeContract({
144
+ address,
145
+ abi: SuperPaymasterABI,
146
+ functionName: 'setCachedPrice',
147
+ args: [price],
148
+ account: account,
149
+ chain: client.chain
150
+ });
151
+ },
152
+ async superPaymasterSetProtocolFee({ feeRecipient, feeBps, account }) {
153
+ return client.writeContract({
154
+ address,
155
+ abi: SuperPaymasterABI,
156
+ functionName: 'setProtocolFee',
157
+ args: [feeRecipient, feeBps],
158
+ account: account,
159
+ chain: client.chain
160
+ });
161
+ },
162
+ // User Management
163
+ async superPaymasterBlockUser({ user, blocked, account }) {
164
+ return client.writeContract({
165
+ address,
166
+ abi: SuperPaymasterABI,
167
+ functionName: 'blockUser',
168
+ args: [user, blocked],
169
+ account: account,
170
+ chain: client.chain
171
+ });
172
+ },
173
+ // Validation (EntryPoint calls)
174
+ async superPaymasterValidatePaymasterUserOp({ userOp, userOpHash, maxCost }) {
175
+ return client.readContract({
176
+ address,
177
+ abi: SuperPaymasterABI,
178
+ functionName: 'validatePaymasterUserOp',
179
+ args: [userOp, userOpHash, maxCost]
180
+ });
181
+ },
182
+ async superPaymasterPostOp({ mode, context, actualGasCost, actualUserOpFeePerGas }) {
183
+ // postOp is called by EntryPoint, typically not called directly
184
+ throw new Error('postOp is called by EntryPoint after UserOp execution');
185
+ },
186
+ // View Functions
187
+ async superPaymasterOperators({ operator }) {
188
+ return client.readContract({
189
+ address,
190
+ abi: SuperPaymasterABI,
191
+ functionName: 'operators',
192
+ args: [operator]
193
+ });
194
+ },
195
+ async superPaymasterGetDeposit() {
196
+ return client.readContract({
197
+ address,
198
+ abi: SuperPaymasterABI,
199
+ functionName: 'getDeposit',
200
+ args: []
201
+ });
202
+ },
203
+ async superPaymasterGetAvailableCredit({ operator, user }) {
204
+ return client.readContract({
205
+ address,
206
+ abi: SuperPaymasterABI,
207
+ functionName: 'getAvailableCredit',
208
+ args: [operator, user]
209
+ });
210
+ },
211
+ async superPaymasterBlockedUsers({ user }) {
212
+ return client.readContract({
213
+ address,
214
+ abi: SuperPaymasterABI,
215
+ functionName: 'blockedUsers',
216
+ args: [user]
217
+ });
218
+ },
219
+ // Convenience function: Get operator's aPNTs balance
220
+ async superPaymasterBalanceOfOperator({ operator }) {
221
+ const operatorConfig = await this.superPaymasterOperators({ operator });
222
+ return operatorConfig[0]; // aPNTsBalance is the first field
223
+ },
224
+ async superPaymasterAPNTsPriceUSD() {
225
+ return client.readContract({
226
+ address,
227
+ abi: SuperPaymasterABI,
228
+ functionName: 'aPNTsPriceUSD',
229
+ args: []
230
+ });
231
+ },
232
+ async superPaymasterCachedPrice() {
233
+ return client.readContract({
234
+ address,
235
+ abi: SuperPaymasterABI,
236
+ functionName: 'cachedPrice',
237
+ args: []
238
+ });
239
+ },
240
+ async superPaymasterProtocolFee() {
241
+ return client.readContract({
242
+ address,
243
+ abi: SuperPaymasterABI,
244
+ functionName: 'protocolFee',
245
+ args: []
246
+ });
247
+ },
248
+ async superPaymasterEntryPoint() {
249
+ return client.readContract({
250
+ address,
251
+ abi: SuperPaymasterABI,
252
+ functionName: 'entryPoint',
253
+ args: []
254
+ });
255
+ },
256
+ // Constants
257
+ async superPaymasterAPNTS_TOKEN() {
258
+ return client.readContract({
259
+ address,
260
+ abi: SuperPaymasterABI,
261
+ functionName: 'APNTS_TOKEN',
262
+ args: []
263
+ });
264
+ },
265
+ async superPaymasterREGISTRY() {
266
+ return client.readContract({
267
+ address,
268
+ abi: SuperPaymasterABI,
269
+ functionName: 'REGISTRY',
270
+ args: []
271
+ });
272
+ },
273
+ async superPaymasterBLS_AGGREGATOR() {
274
+ return client.readContract({
275
+ address,
276
+ abi: SuperPaymasterABI,
277
+ functionName: 'BLS_AGGREGATOR',
278
+ args: []
279
+ });
280
+ },
281
+ async superPaymasterETH_USD_PRICE_FEED() {
282
+ return client.readContract({
283
+ address,
284
+ abi: SuperPaymasterABI,
285
+ functionName: 'ETH_USD_PRICE_FEED',
286
+ args: []
287
+ });
288
+ },
289
+ async superPaymasterPAYMASTER_DATA_OFFSET() {
290
+ return client.readContract({
291
+ address,
292
+ abi: SuperPaymasterABI,
293
+ functionName: 'PAYMASTER_DATA_OFFSET',
294
+ args: []
295
+ });
296
+ },
297
+ async superPaymasterRATE_OFFSET() {
298
+ return client.readContract({
299
+ address,
300
+ abi: SuperPaymasterABI,
301
+ functionName: 'RATE_OFFSET',
302
+ args: []
303
+ });
304
+ },
305
+ async superPaymasterBPS_DENOMINATOR() {
306
+ return client.readContract({
307
+ address,
308
+ abi: SuperPaymasterABI,
309
+ functionName: 'BPS_DENOMINATOR',
310
+ args: []
311
+ });
312
+ },
313
+ async superPaymasterPRICE_CACHE_DURATION() {
314
+ return client.readContract({
315
+ address,
316
+ abi: SuperPaymasterABI,
317
+ functionName: 'PRICE_CACHE_DURATION',
318
+ args: []
319
+ });
320
+ },
321
+ async superPaymasterPRICE_STALENESS_THRESHOLD() {
322
+ return client.readContract({
323
+ address,
324
+ abi: SuperPaymasterABI,
325
+ functionName: 'PRICE_STALENESS_THRESHOLD',
326
+ args: []
327
+ });
328
+ },
329
+ async superPaymasterMAX_ETH_USD_PRICE() {
330
+ return client.readContract({
331
+ address,
332
+ abi: SuperPaymasterABI,
333
+ functionName: 'MAX_ETH_USD_PRICE',
334
+ args: []
335
+ });
336
+ },
337
+ async superPaymasterMIN_ETH_USD_PRICE() {
338
+ return client.readContract({
339
+ address,
340
+ abi: SuperPaymasterABI,
341
+ functionName: 'MIN_ETH_USD_PRICE',
342
+ args: []
343
+ });
344
+ },
345
+ // Admin
346
+ async transferSuperPaymasterOwnership({ newOwner, account }) {
347
+ return client.writeContract({
348
+ address,
349
+ abi: SuperPaymasterABI,
350
+ functionName: 'transferOwnership',
351
+ args: [newOwner],
352
+ account: account,
353
+ chain: client.chain
354
+ });
355
+ },
356
+ async superPaymasterOwner() {
357
+ return client.readContract({
358
+ address,
359
+ abi: SuperPaymasterABI,
360
+ functionName: 'owner',
361
+ args: []
362
+ });
363
+ },
364
+ async renounceSuperPaymasterOwnership({ account }) {
365
+ return client.writeContract({
366
+ address,
367
+ abi: SuperPaymasterABI,
368
+ functionName: 'renounceOwnership',
369
+ args: [],
370
+ account: account,
371
+ chain: client.chain
372
+ });
373
+ },
374
+ // Additional Operator Management
375
+ async superPaymasterSetOperatorLimits({ operator, limits, account }) {
376
+ return client.writeContract({
377
+ address,
378
+ abi: SuperPaymasterABI,
379
+ functionName: 'setOperatorLimits',
380
+ args: [operator, limits],
381
+ account: account,
382
+ chain: client.chain
383
+ });
384
+ },
385
+ async superPaymasterSlashOperator({ operator, amount, reason, account }) {
386
+ return client.writeContract({
387
+ address,
388
+ abi: SuperPaymasterABI,
389
+ functionName: 'slashOperator',
390
+ args: [operator, amount, reason],
391
+ account: account,
392
+ chain: client.chain
393
+ });
394
+ },
395
+ // User Management
396
+ async superPaymasterUpdateBlockedStatus({ user, blocked, account }) {
397
+ return client.writeContract({
398
+ address,
399
+ abi: SuperPaymasterABI,
400
+ functionName: 'updateBlockedStatus',
401
+ args: [user, blocked],
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
+ });
643
+ }
644
+ });