@aastar/dapp 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.
- package/LICENSE +21 -0
- package/dist/core/src/abis/BLSAggregator.json +686 -0
- package/dist/core/src/abis/BLSValidator.json +42 -0
- package/dist/core/src/abis/DVTValidator.json +368 -0
- package/dist/core/src/abis/EntryPoint.json +1382 -0
- package/dist/core/src/abis/GToken.json +513 -0
- package/dist/core/src/abis/GTokenStaking.json +949 -0
- package/dist/core/src/abis/MySBT.json +1518 -0
- package/dist/core/src/abis/Paymaster.json +1143 -0
- package/dist/core/src/abis/PaymasterFactory.json +640 -0
- package/dist/core/src/abis/Registry.json +1942 -0
- package/dist/core/src/abis/ReputationSystem.json +699 -0
- package/dist/core/src/abis/SimpleAccount.json +560 -0
- package/dist/core/src/abis/SimpleAccountFactory.json +111 -0
- package/dist/core/src/abis/SuperPaymaster.json +1781 -0
- package/dist/core/src/abis/index.d.ts +1126 -0
- package/dist/core/src/abis/index.js +91 -0
- package/dist/core/src/abis/xPNTsFactory.json +718 -0
- package/dist/core/src/abis/xPNTsToken.json +1280 -0
- package/dist/core/src/actions/StateValidator.d.ts +68 -0
- package/dist/core/src/actions/StateValidator.js +187 -0
- package/dist/core/src/actions/account.d.ts +55 -0
- package/dist/core/src/actions/account.js +133 -0
- package/dist/core/src/actions/aggregator.d.ts +17 -0
- package/dist/core/src/actions/aggregator.js +31 -0
- package/dist/core/src/actions/dvt.d.ts +30 -0
- package/dist/core/src/actions/dvt.js +41 -0
- package/dist/core/src/actions/entryPoint.d.ts +90 -0
- package/dist/core/src/actions/entryPoint.js +211 -0
- package/dist/core/src/actions/factory.d.ts +215 -0
- package/dist/core/src/actions/factory.js +442 -0
- package/dist/core/src/actions/faucet.d.ts +48 -0
- package/dist/core/src/actions/faucet.js +337 -0
- package/dist/core/src/actions/gtokenExtended.d.ts +39 -0
- package/dist/core/src/actions/gtokenExtended.js +115 -0
- package/dist/core/src/actions/index.d.ts +15 -0
- package/dist/core/src/actions/index.js +17 -0
- package/dist/core/src/actions/paymasterV4.d.ts +170 -0
- package/dist/core/src/actions/paymasterV4.js +334 -0
- package/dist/core/src/actions/registry.d.ts +246 -0
- package/dist/core/src/actions/registry.js +667 -0
- package/dist/core/src/actions/reputation.d.ts +129 -0
- package/dist/core/src/actions/reputation.js +281 -0
- package/dist/core/src/actions/sbt.d.ts +191 -0
- package/dist/core/src/actions/sbt.js +533 -0
- package/dist/core/src/actions/staking.d.ts +132 -0
- package/dist/core/src/actions/staking.js +330 -0
- package/dist/core/src/actions/superPaymaster.d.ts +237 -0
- package/dist/core/src/actions/superPaymaster.js +644 -0
- package/dist/core/src/actions/tokens.d.ts +229 -0
- package/dist/core/src/actions/tokens.js +415 -0
- package/dist/core/src/branding.d.ts +30 -0
- package/dist/core/src/branding.js +30 -0
- package/dist/core/src/clients/BaseClient.d.ts +25 -0
- package/dist/core/src/clients/BaseClient.js +66 -0
- package/dist/core/src/clients/types.d.ts +60 -0
- package/dist/core/src/clients/types.js +1 -0
- package/dist/core/src/clients.d.ts +5 -0
- package/dist/core/src/clients.js +11 -0
- package/dist/core/src/communities.d.ts +52 -0
- package/dist/core/src/communities.js +73 -0
- package/dist/core/src/config/ContractConfigManager.d.ts +20 -0
- package/dist/core/src/config/ContractConfigManager.js +48 -0
- package/dist/core/src/constants.d.ts +88 -0
- package/dist/core/src/constants.js +125 -0
- package/dist/core/src/contract-addresses.d.ts +110 -0
- package/dist/core/src/contract-addresses.js +99 -0
- package/dist/core/src/contracts.d.ts +424 -0
- package/dist/core/src/contracts.js +343 -0
- package/dist/core/src/crypto/blsSigner.d.ts +64 -0
- package/dist/core/src/crypto/blsSigner.js +98 -0
- package/dist/core/src/crypto/index.d.ts +1 -0
- package/dist/core/src/crypto/index.js +1 -0
- package/dist/core/src/index.d.ts +21 -0
- package/dist/core/src/index.js +21 -0
- package/dist/core/src/networks.d.ts +127 -0
- package/dist/core/src/networks.js +118 -0
- package/dist/core/src/requirementChecker.d.ts +38 -0
- package/dist/core/src/requirementChecker.js +139 -0
- package/dist/core/src/roles.d.ts +204 -0
- package/dist/core/src/roles.js +211 -0
- package/dist/core/src/utils/validation.d.ts +24 -0
- package/dist/core/src/utils/validation.js +56 -0
- package/dist/dapp/src/index.d.ts +3 -0
- package/dist/dapp/src/index.js +3 -0
- package/dist/dapp/src/ui/components/EvaluationPanel.d.ts +11 -0
- package/dist/dapp/src/ui/components/EvaluationPanel.js +37 -0
- package/dist/dapp/src/ui/hooks/useCreditScore.d.ts +13 -0
- package/dist/dapp/src/ui/hooks/useCreditScore.js +32 -0
- package/dist/dapp/src/ui/hooks/useSuperPaymaster.d.ts +8 -0
- package/dist/dapp/src/ui/hooks/useSuperPaymaster.js +23 -0
- package/dist/dapp/src/ui/index.d.ts +4 -0
- package/dist/dapp/src/ui/index.js +17 -0
- package/dist/paymaster/src/SuperPaymaster/index.d.ts +44 -0
- package/dist/paymaster/src/SuperPaymaster/index.js +133 -0
- package/dist/paymaster/src/V4/PaymasterClient.d.ts +79 -0
- package/dist/paymaster/src/V4/PaymasterClient.js +315 -0
- package/dist/paymaster/src/V4/PaymasterOperator.d.ts +41 -0
- package/dist/paymaster/src/V4/PaymasterOperator.js +241 -0
- package/dist/paymaster/src/V4/PaymasterUtils.d.ts +55 -0
- package/dist/paymaster/src/V4/PaymasterUtils.js +124 -0
- package/dist/paymaster/src/V4/SuperPaymasterClient.d.ts +21 -0
- package/dist/paymaster/src/V4/SuperPaymasterClient.js +73 -0
- package/dist/paymaster/src/V4/index.d.ts +4 -0
- package/dist/paymaster/src/V4/index.js +4 -0
- package/dist/paymaster/src/index.d.ts +2 -0
- package/dist/paymaster/src/index.js +4 -0
- package/package.json +31 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { parseEther } from 'viem';
|
|
2
|
+
import { xPNTsFactoryABI, PaymasterFactoryABI } from '../abis/index.js';
|
|
3
|
+
export const xPNTsFactoryActions = (address) => (client) => ({
|
|
4
|
+
async createToken({ name, symbol, community, account }) {
|
|
5
|
+
// Map to deployxPNTsToken
|
|
6
|
+
// Args: name, symbol, communityName, communityENS, exchangeRate, paymasterAOA
|
|
7
|
+
// We use name/symbol as community name/ens placeholder if not provided
|
|
8
|
+
// We assume msg.sender (account) is the community owner
|
|
9
|
+
return client.writeContract({
|
|
10
|
+
address,
|
|
11
|
+
abi: xPNTsFactoryABI,
|
|
12
|
+
functionName: 'deployxPNTsToken',
|
|
13
|
+
args: [
|
|
14
|
+
name,
|
|
15
|
+
symbol,
|
|
16
|
+
name, // communityName
|
|
17
|
+
symbol, // communityENS
|
|
18
|
+
parseEther('1'), // exchangeRate: 1:1 with 18 decimals (1e18)
|
|
19
|
+
'0x0000000000000000000000000000000000000000' // paymasterAOA
|
|
20
|
+
],
|
|
21
|
+
account: account,
|
|
22
|
+
chain: client.chain
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
async deployForCommunity({ community, account }) {
|
|
26
|
+
return client.writeContract({
|
|
27
|
+
address,
|
|
28
|
+
abi: xPNTsFactoryABI,
|
|
29
|
+
functionName: 'deployForCommunity',
|
|
30
|
+
args: [community],
|
|
31
|
+
account: account,
|
|
32
|
+
chain: client.chain
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
async getTokenAddress({ community }) {
|
|
36
|
+
return client.readContract({
|
|
37
|
+
address,
|
|
38
|
+
abi: xPNTsFactoryABI,
|
|
39
|
+
functionName: 'getTokenAddress',
|
|
40
|
+
args: [community]
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
async predictAddress({ community, salt }) {
|
|
44
|
+
return client.readContract({
|
|
45
|
+
address,
|
|
46
|
+
abi: xPNTsFactoryABI,
|
|
47
|
+
functionName: 'predictAddress',
|
|
48
|
+
args: salt !== undefined ? [community, salt] : [community]
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
async isTokenDeployed({ community }) {
|
|
52
|
+
return client.readContract({
|
|
53
|
+
address,
|
|
54
|
+
abi: xPNTsFactoryABI,
|
|
55
|
+
functionName: 'isTokenDeployed',
|
|
56
|
+
args: [community]
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
async getCommunityByToken({ token }) {
|
|
60
|
+
return client.readContract({
|
|
61
|
+
address,
|
|
62
|
+
abi: xPNTsFactoryABI,
|
|
63
|
+
functionName: 'getCommunityByToken',
|
|
64
|
+
args: [token]
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
async getAllTokens() {
|
|
68
|
+
return client.readContract({
|
|
69
|
+
address,
|
|
70
|
+
abi: xPNTsFactoryABI,
|
|
71
|
+
functionName: 'getAllTokens',
|
|
72
|
+
args: []
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
async getTokenCount() {
|
|
76
|
+
return client.readContract({
|
|
77
|
+
address,
|
|
78
|
+
abi: xPNTsFactoryABI,
|
|
79
|
+
functionName: 'getTokenCount',
|
|
80
|
+
args: []
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
async deployedTokens({ index }) {
|
|
84
|
+
return client.readContract({
|
|
85
|
+
address,
|
|
86
|
+
abi: xPNTsFactoryABI,
|
|
87
|
+
functionName: 'deployedTokens',
|
|
88
|
+
args: [index]
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
async communityToToken({ community }) {
|
|
92
|
+
return client.readContract({
|
|
93
|
+
address,
|
|
94
|
+
abi: xPNTsFactoryABI,
|
|
95
|
+
functionName: 'communityToToken',
|
|
96
|
+
args: [community]
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
async setRegistry({ registry, account }) {
|
|
100
|
+
return client.writeContract({
|
|
101
|
+
address,
|
|
102
|
+
abi: xPNTsFactoryABI,
|
|
103
|
+
functionName: 'setRegistry',
|
|
104
|
+
args: [registry],
|
|
105
|
+
account: account,
|
|
106
|
+
chain: client.chain
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
async setSuperPaymaster({ paymaster, account }) {
|
|
110
|
+
return client.writeContract({
|
|
111
|
+
address,
|
|
112
|
+
abi: xPNTsFactoryABI,
|
|
113
|
+
functionName: 'setSuperPaymaster',
|
|
114
|
+
args: [paymaster],
|
|
115
|
+
account: account,
|
|
116
|
+
chain: client.chain
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
async setImplementation({ impl, account }) {
|
|
120
|
+
return client.writeContract({
|
|
121
|
+
address,
|
|
122
|
+
abi: xPNTsFactoryABI,
|
|
123
|
+
functionName: 'setImplementation',
|
|
124
|
+
args: [impl],
|
|
125
|
+
account: account,
|
|
126
|
+
chain: client.chain
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
async getImplementation() {
|
|
130
|
+
return client.readContract({
|
|
131
|
+
address,
|
|
132
|
+
abi: xPNTsFactoryABI,
|
|
133
|
+
functionName: 'getImplementation',
|
|
134
|
+
args: []
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
async REGISTRY() {
|
|
138
|
+
return client.readContract({
|
|
139
|
+
address,
|
|
140
|
+
abi: xPNTsFactoryABI,
|
|
141
|
+
functionName: 'REGISTRY',
|
|
142
|
+
args: []
|
|
143
|
+
});
|
|
144
|
+
},
|
|
145
|
+
async tokenImplementation() {
|
|
146
|
+
return client.readContract({
|
|
147
|
+
address,
|
|
148
|
+
abi: xPNTsFactoryABI,
|
|
149
|
+
functionName: 'tokenImplementation',
|
|
150
|
+
args: []
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
async xPNTsFactoryOwner() {
|
|
154
|
+
return client.readContract({
|
|
155
|
+
address,
|
|
156
|
+
abi: xPNTsFactoryABI,
|
|
157
|
+
functionName: 'owner',
|
|
158
|
+
args: []
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
async transferXPNTsFactoryOwnership({ newOwner, account }) {
|
|
162
|
+
return client.writeContract({
|
|
163
|
+
address,
|
|
164
|
+
abi: xPNTsFactoryABI,
|
|
165
|
+
functionName: 'transferOwnership',
|
|
166
|
+
args: [newOwner],
|
|
167
|
+
account: account,
|
|
168
|
+
chain: client.chain
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
async renounceXPNTsFactoryOwnership({ account }) {
|
|
172
|
+
return client.writeContract({
|
|
173
|
+
address,
|
|
174
|
+
abi: xPNTsFactoryABI,
|
|
175
|
+
functionName: 'renounceOwnership',
|
|
176
|
+
args: [],
|
|
177
|
+
account: account,
|
|
178
|
+
chain: client.chain
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
async deployxPNTsToken(args) {
|
|
182
|
+
return this.createToken(args);
|
|
183
|
+
},
|
|
184
|
+
// Prediction & Economics
|
|
185
|
+
async predictDepositAmount({ community, userCount }) {
|
|
186
|
+
return client.readContract({ address, abi: xPNTsFactoryABI, functionName: 'predictDepositAmount', args: [community, userCount] });
|
|
187
|
+
},
|
|
188
|
+
async getPredictionParams({ community }) {
|
|
189
|
+
return client.readContract({ address, abi: xPNTsFactoryABI, functionName: 'getPredictionParams', args: [community] });
|
|
190
|
+
},
|
|
191
|
+
async getDepositBreakdown({ community }) {
|
|
192
|
+
return client.readContract({ address, abi: xPNTsFactoryABI, functionName: 'getDepositBreakdown', args: [community] });
|
|
193
|
+
},
|
|
194
|
+
async getAPNTsPrice() {
|
|
195
|
+
return client.readContract({ address, abi: xPNTsFactoryABI, functionName: 'getAPNTsPrice', args: [] });
|
|
196
|
+
},
|
|
197
|
+
async aPNTsPriceUSD() {
|
|
198
|
+
return client.readContract({ address, abi: xPNTsFactoryABI, functionName: 'aPNTsPriceUSD', args: [] });
|
|
199
|
+
},
|
|
200
|
+
async SUPER_PAYMASTER() {
|
|
201
|
+
return client.readContract({ address, abi: xPNTsFactoryABI, functionName: 'SUPER_PAYMASTER', args: [] });
|
|
202
|
+
},
|
|
203
|
+
async SUPERPAYMASTER() {
|
|
204
|
+
return client.readContract({ address, abi: xPNTsFactoryABI, functionName: 'SUPERPAYMASTER', args: [] });
|
|
205
|
+
},
|
|
206
|
+
// Admin & Config
|
|
207
|
+
async setIndustryMultiplier({ industry, multiplier, account }) {
|
|
208
|
+
return client.writeContract({ address, abi: xPNTsFactoryABI, functionName: 'setIndustryMultiplier', args: [industry, multiplier], account: account, chain: client.chain });
|
|
209
|
+
},
|
|
210
|
+
async setSuperPaymasterAddress({ paymaster, account }) {
|
|
211
|
+
return client.writeContract({ address, abi: xPNTsFactoryABI, functionName: 'setSuperPaymasterAddress', args: [paymaster], account: account, chain: client.chain });
|
|
212
|
+
},
|
|
213
|
+
async updateAPNTsPrice({ newPrice, account }) {
|
|
214
|
+
return client.writeContract({ address, abi: xPNTsFactoryABI, functionName: 'updateAPNTsPrice', args: [newPrice], account: account, chain: client.chain });
|
|
215
|
+
},
|
|
216
|
+
async updatePrediction({ community, userCount, account }) {
|
|
217
|
+
return client.writeContract({ address, abi: xPNTsFactoryABI, functionName: 'updatePrediction', args: [community, userCount], account: account, chain: client.chain });
|
|
218
|
+
},
|
|
219
|
+
async updatePredictionCustom({ community, params, account }) {
|
|
220
|
+
return client.writeContract({ address, abi: xPNTsFactoryABI, functionName: 'updatePredictionCustom', args: [community, params], account: account, chain: client.chain });
|
|
221
|
+
},
|
|
222
|
+
// Views
|
|
223
|
+
async hasToken({ token }) {
|
|
224
|
+
return client.readContract({ address, abi: xPNTsFactoryABI, functionName: 'hasToken', args: [token] });
|
|
225
|
+
},
|
|
226
|
+
async getDeployedCount() {
|
|
227
|
+
return client.readContract({ address, abi: xPNTsFactoryABI, functionName: 'getDeployedCount', args: [] });
|
|
228
|
+
},
|
|
229
|
+
async industryMultipliers({ industry }) {
|
|
230
|
+
return client.readContract({ address, abi: xPNTsFactoryABI, functionName: 'industryMultipliers', args: [industry] });
|
|
231
|
+
},
|
|
232
|
+
async getIndustryMultiplier({ industry }) {
|
|
233
|
+
return this.industryMultipliers({ industry });
|
|
234
|
+
},
|
|
235
|
+
async predictions({ community }) {
|
|
236
|
+
return client.readContract({ address, abi: xPNTsFactoryABI, functionName: 'predictions', args: [community] });
|
|
237
|
+
},
|
|
238
|
+
// Constants
|
|
239
|
+
async DEFAULT_SAFETY_FACTOR() {
|
|
240
|
+
return client.readContract({ address, abi: xPNTsFactoryABI, functionName: 'DEFAULT_SAFETY_FACTOR', args: [] });
|
|
241
|
+
},
|
|
242
|
+
async MIN_SUGGESTED_AMOUNT() {
|
|
243
|
+
return client.readContract({ address, abi: xPNTsFactoryABI, functionName: 'MIN_SUGGESTED_AMOUNT', args: [] });
|
|
244
|
+
},
|
|
245
|
+
async xPNTsFactoryVersion() {
|
|
246
|
+
return client.readContract({
|
|
247
|
+
address,
|
|
248
|
+
abi: xPNTsFactoryABI,
|
|
249
|
+
functionName: 'version',
|
|
250
|
+
args: []
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
export const paymasterFactoryActions = (address) => (client) => ({
|
|
255
|
+
async deployPaymaster({ owner, version, initData, account }) {
|
|
256
|
+
// Factory.deployPaymaster(version, initData)
|
|
257
|
+
const defaultVer = 'v4.2'; // 当前标准版本
|
|
258
|
+
const useVer = version || defaultVer;
|
|
259
|
+
return client.writeContract({
|
|
260
|
+
address,
|
|
261
|
+
abi: PaymasterFactoryABI,
|
|
262
|
+
functionName: 'deployPaymaster',
|
|
263
|
+
args: [useVer, initData || '0x'],
|
|
264
|
+
account: account,
|
|
265
|
+
chain: client.chain
|
|
266
|
+
});
|
|
267
|
+
},
|
|
268
|
+
async deployPaymasterDeterministic({ owner, version, initData, salt, account }) {
|
|
269
|
+
return client.writeContract({ address, abi: PaymasterFactoryABI, functionName: 'deployPaymasterDeterministic', args: [version || 'v4.2', initData || '0x', salt], account: account, chain: client.chain });
|
|
270
|
+
},
|
|
271
|
+
async predictPaymasterAddress({ owner, salt }) {
|
|
272
|
+
// Note: Contract might not have this function exposed directly or it is separate logic
|
|
273
|
+
// But ABI says it's missing, so let's try calling it if it exists in ABI
|
|
274
|
+
return client.readContract({ address, abi: PaymasterFactoryABI, functionName: 'predictPaymasterAddress', args: [owner, salt] });
|
|
275
|
+
},
|
|
276
|
+
async calculateAddress({ owner }) {
|
|
277
|
+
// This function doesn't exist in V4 factory for non-deterministic deploy
|
|
278
|
+
// We throw to avoid misleading usage
|
|
279
|
+
throw new Error('Predicting address not supported for standard deploy. Use getPaymaster after deploy.');
|
|
280
|
+
},
|
|
281
|
+
async getPaymaster({ owner }) {
|
|
282
|
+
// 使用 paymasterByOperator mapping(不支持 salt)
|
|
283
|
+
return client.readContract({
|
|
284
|
+
address,
|
|
285
|
+
abi: PaymasterFactoryABI,
|
|
286
|
+
functionName: 'paymasterByOperator',
|
|
287
|
+
args: [owner]
|
|
288
|
+
});
|
|
289
|
+
},
|
|
290
|
+
async getPaymasterCount() {
|
|
291
|
+
return client.readContract({
|
|
292
|
+
address,
|
|
293
|
+
abi: PaymasterFactoryABI,
|
|
294
|
+
functionName: 'getPaymasterCount',
|
|
295
|
+
args: []
|
|
296
|
+
});
|
|
297
|
+
},
|
|
298
|
+
async getAllPaymasters() {
|
|
299
|
+
// Not directly supported by contract as single call (it has list + pagination), using pagination shim
|
|
300
|
+
const count = await client.readContract({
|
|
301
|
+
address, abi: PaymasterFactoryABI, functionName: 'getPaymasterCount', args: []
|
|
302
|
+
});
|
|
303
|
+
return client.readContract({
|
|
304
|
+
address,
|
|
305
|
+
abi: PaymasterFactoryABI,
|
|
306
|
+
functionName: 'getPaymasterList',
|
|
307
|
+
args: [0n, count]
|
|
308
|
+
});
|
|
309
|
+
},
|
|
310
|
+
async isPaymasterDeployed({ owner }) {
|
|
311
|
+
return client.readContract({
|
|
312
|
+
address,
|
|
313
|
+
abi: PaymasterFactoryABI,
|
|
314
|
+
functionName: 'hasPaymaster', // Corrected from isPaymasterDeployed
|
|
315
|
+
args: [owner]
|
|
316
|
+
});
|
|
317
|
+
},
|
|
318
|
+
async hasPaymaster({ owner }) { return this.isPaymasterDeployed({ owner }); },
|
|
319
|
+
async getPaymasterList({ offset, limit }) {
|
|
320
|
+
return client.readContract({ address, abi: PaymasterFactoryABI, functionName: 'getPaymasterList', args: [offset, limit] });
|
|
321
|
+
},
|
|
322
|
+
async paymasterList({ index }) {
|
|
323
|
+
return client.readContract({ address, abi: PaymasterFactoryABI, functionName: 'paymasterList', args: [index] });
|
|
324
|
+
},
|
|
325
|
+
async totalDeployed() {
|
|
326
|
+
return client.readContract({ address, abi: PaymasterFactoryABI, functionName: 'totalDeployed', args: [] });
|
|
327
|
+
},
|
|
328
|
+
async getOperatorByPaymaster({ paymaster }) {
|
|
329
|
+
return client.readContract({ address, abi: PaymasterFactoryABI, functionName: 'getOperatorByPaymaster', args: [paymaster] });
|
|
330
|
+
},
|
|
331
|
+
async operatorByPaymaster({ paymaster }) { return this.getOperatorByPaymaster({ paymaster }); },
|
|
332
|
+
async getPaymasterByOperator({ operator }) {
|
|
333
|
+
return client.readContract({ address, abi: PaymasterFactoryABI, functionName: 'getPaymasterByOperator', args: [operator] });
|
|
334
|
+
},
|
|
335
|
+
async paymasterByOperator({ operator }) { return this.getPaymasterByOperator({ operator }); },
|
|
336
|
+
async getPaymasterInfo({ paymaster }) {
|
|
337
|
+
return client.readContract({ address, abi: PaymasterFactoryABI, functionName: 'getPaymasterInfo', args: [paymaster] });
|
|
338
|
+
},
|
|
339
|
+
async hasImplementation({ version }) {
|
|
340
|
+
return client.readContract({ address, abi: PaymasterFactoryABI, functionName: 'hasImplementation', args: [version] });
|
|
341
|
+
},
|
|
342
|
+
async implementations({ version }) {
|
|
343
|
+
return client.readContract({ address, abi: PaymasterFactoryABI, functionName: 'implementations', args: [version] });
|
|
344
|
+
},
|
|
345
|
+
async setImplementationV4({ impl, account }) {
|
|
346
|
+
return client.writeContract({
|
|
347
|
+
address,
|
|
348
|
+
abi: PaymasterFactoryABI,
|
|
349
|
+
functionName: 'setImplementationV4',
|
|
350
|
+
args: [impl],
|
|
351
|
+
account: account,
|
|
352
|
+
chain: client.chain
|
|
353
|
+
});
|
|
354
|
+
},
|
|
355
|
+
async getImplementationV4() {
|
|
356
|
+
return client.readContract({
|
|
357
|
+
address,
|
|
358
|
+
abi: PaymasterFactoryABI,
|
|
359
|
+
functionName: 'getImplementationV4',
|
|
360
|
+
args: []
|
|
361
|
+
});
|
|
362
|
+
},
|
|
363
|
+
async setRegistry({ registry, account }) {
|
|
364
|
+
return client.writeContract({
|
|
365
|
+
address,
|
|
366
|
+
abi: PaymasterFactoryABI,
|
|
367
|
+
functionName: 'setRegistry',
|
|
368
|
+
args: [registry],
|
|
369
|
+
account: account,
|
|
370
|
+
chain: client.chain
|
|
371
|
+
});
|
|
372
|
+
},
|
|
373
|
+
async addImplementation({ version, implementation, account }) {
|
|
374
|
+
return client.writeContract({ address, abi: PaymasterFactoryABI, functionName: 'addImplementation', args: [version, implementation], account: account, chain: client.chain });
|
|
375
|
+
},
|
|
376
|
+
async upgradeImplementation({ version, newImplementation, account }) {
|
|
377
|
+
return client.writeContract({ address, abi: PaymasterFactoryABI, functionName: 'upgradeImplementation', args: [version, newImplementation], account: account, chain: client.chain });
|
|
378
|
+
},
|
|
379
|
+
async setDefaultVersion({ version, account }) {
|
|
380
|
+
return client.writeContract({ address, abi: PaymasterFactoryABI, functionName: 'setDefaultVersion', args: [version], account: account, chain: client.chain });
|
|
381
|
+
},
|
|
382
|
+
async REGISTRY() {
|
|
383
|
+
return client.readContract({
|
|
384
|
+
address,
|
|
385
|
+
abi: PaymasterFactoryABI,
|
|
386
|
+
functionName: 'REGISTRY',
|
|
387
|
+
args: []
|
|
388
|
+
});
|
|
389
|
+
},
|
|
390
|
+
async ENTRY_POINT() {
|
|
391
|
+
return client.readContract({
|
|
392
|
+
address,
|
|
393
|
+
abi: PaymasterFactoryABI,
|
|
394
|
+
functionName: 'ENTRY_POINT',
|
|
395
|
+
args: []
|
|
396
|
+
});
|
|
397
|
+
},
|
|
398
|
+
async paymasterFactoryOwner() {
|
|
399
|
+
return client.readContract({
|
|
400
|
+
address,
|
|
401
|
+
abi: PaymasterFactoryABI,
|
|
402
|
+
functionName: 'owner',
|
|
403
|
+
args: []
|
|
404
|
+
});
|
|
405
|
+
},
|
|
406
|
+
async transferPaymasterFactoryOwnership({ newOwner, account }) {
|
|
407
|
+
return client.writeContract({
|
|
408
|
+
address,
|
|
409
|
+
abi: PaymasterFactoryABI,
|
|
410
|
+
functionName: 'transferOwnership',
|
|
411
|
+
args: [newOwner],
|
|
412
|
+
account: account,
|
|
413
|
+
chain: client.chain
|
|
414
|
+
});
|
|
415
|
+
},
|
|
416
|
+
async renouncePaymasterFactoryOwnership({ account }) {
|
|
417
|
+
return client.writeContract({
|
|
418
|
+
address,
|
|
419
|
+
abi: PaymasterFactoryABI,
|
|
420
|
+
functionName: 'renounceOwnership',
|
|
421
|
+
args: [],
|
|
422
|
+
account: account,
|
|
423
|
+
chain: client.chain
|
|
424
|
+
});
|
|
425
|
+
},
|
|
426
|
+
async defaultVersion() {
|
|
427
|
+
return client.readContract({
|
|
428
|
+
address,
|
|
429
|
+
abi: PaymasterFactoryABI,
|
|
430
|
+
functionName: 'defaultVersion',
|
|
431
|
+
args: []
|
|
432
|
+
});
|
|
433
|
+
},
|
|
434
|
+
async paymasterFactoryVersion() {
|
|
435
|
+
return client.readContract({
|
|
436
|
+
address,
|
|
437
|
+
abi: PaymasterFactoryABI,
|
|
438
|
+
functionName: 'version',
|
|
439
|
+
args: []
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type Address, type WalletClient, type PublicClient } from 'viem';
|
|
2
|
+
export declare class SepoliaFaucetAPI {
|
|
3
|
+
/**
|
|
4
|
+
* Orchestrates the complete setup for a test account.
|
|
5
|
+
* 1. Funds ETH
|
|
6
|
+
* 2. Registers ENDUSER role
|
|
7
|
+
* 3. Mints potential Paymaster Tokens (cPNTs/dPNTs)
|
|
8
|
+
* 4. Deposits to Paymaster V4 (if address provided) using Admin's tokens
|
|
9
|
+
*/
|
|
10
|
+
static prepareTestAccount(adminWallet: WalletClient, publicClient: PublicClient, config: {
|
|
11
|
+
targetAA: Address;
|
|
12
|
+
token: Address;
|
|
13
|
+
registry: Address;
|
|
14
|
+
paymasterV4?: Address;
|
|
15
|
+
superPaymaster?: Address;
|
|
16
|
+
ethAmount?: bigint;
|
|
17
|
+
tokenAmount?: bigint;
|
|
18
|
+
community?: Address;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
ethFunded: boolean;
|
|
21
|
+
roleRegistered: boolean;
|
|
22
|
+
tokenMinted: boolean;
|
|
23
|
+
paymasterDeposited: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Funds the target with ETH if balance is below threshold.
|
|
27
|
+
*/
|
|
28
|
+
static fundETH(adminWallet: WalletClient, publicClient: PublicClient, target: Address, amount: bigint): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Registers the ENDUSER role via Registry.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Registers the ENDUSER role using Sponsor Mode (Admin pays stake).
|
|
34
|
+
*/
|
|
35
|
+
static registerEndUser(adminWallet: WalletClient, publicClient: PublicClient, registryAddr: Address, target: Address, gasToken: Address, // Re-using the 'token' passed in config which is GToken
|
|
36
|
+
community?: Address): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Mints tokens directly to the target.
|
|
39
|
+
*/
|
|
40
|
+
static mintTestTokens(adminWallet: WalletClient, publicClient: PublicClient, token: Address, target: Address, amount: bigint): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Complex Flow:
|
|
43
|
+
* 1. Admin mints tokens to SELF.
|
|
44
|
+
* 2. Admin approves Paymaster.
|
|
45
|
+
* 3. Admin calls depositFor(target) on Paymaster.
|
|
46
|
+
*/
|
|
47
|
+
static adminDepositForUser(adminWallet: WalletClient, publicClient: PublicClient, paymaster: Address, target: Address, token: Address, amount: bigint): Promise<boolean>;
|
|
48
|
+
}
|