@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,533 @@
|
|
|
1
|
+
import { MySBTABI } from '../abis/index.js';
|
|
2
|
+
export const sbtActions = (address) => (client) => ({
|
|
3
|
+
// SBT specific
|
|
4
|
+
async sbtSafeMintForRole({ roleId, to, tokenURI, account }) {
|
|
5
|
+
return client.writeContract({
|
|
6
|
+
address,
|
|
7
|
+
abi: MySBTABI,
|
|
8
|
+
functionName: 'safeMintForRole',
|
|
9
|
+
args: [roleId, to, tokenURI],
|
|
10
|
+
account: account,
|
|
11
|
+
chain: client.chain
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
async sbtAirdropMint({ roleId, to, tokenURI, account }) {
|
|
15
|
+
return client.writeContract({
|
|
16
|
+
address,
|
|
17
|
+
abi: MySBTABI,
|
|
18
|
+
functionName: 'airdropMint',
|
|
19
|
+
args: [roleId, to, tokenURI],
|
|
20
|
+
account: account,
|
|
21
|
+
chain: client.chain
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
async sbtGetUserSBT({ user, roleId }) {
|
|
25
|
+
return client.readContract({
|
|
26
|
+
address,
|
|
27
|
+
abi: MySBTABI,
|
|
28
|
+
functionName: 'getUserSBT',
|
|
29
|
+
args: [user]
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
async sbtGetSBTData({ tokenId }) {
|
|
33
|
+
return client.readContract({
|
|
34
|
+
address,
|
|
35
|
+
abi: MySBTABI,
|
|
36
|
+
functionName: 'getSBTData',
|
|
37
|
+
args: [tokenId]
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
async sbtGetCommunityMembership({ user, community }) {
|
|
41
|
+
return client.readContract({
|
|
42
|
+
address,
|
|
43
|
+
abi: MySBTABI,
|
|
44
|
+
functionName: 'getCommunityMembership',
|
|
45
|
+
args: [user, community]
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
// ERC721 Standard
|
|
49
|
+
async sbtBalanceOf({ owner }) {
|
|
50
|
+
return client.readContract({
|
|
51
|
+
address,
|
|
52
|
+
abi: MySBTABI,
|
|
53
|
+
functionName: 'balanceOf',
|
|
54
|
+
args: [owner]
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
async sbtOwnerOf({ tokenId }) {
|
|
58
|
+
return client.readContract({
|
|
59
|
+
address,
|
|
60
|
+
abi: MySBTABI,
|
|
61
|
+
functionName: 'ownerOf',
|
|
62
|
+
args: [tokenId]
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
async sbtSafeTransferFrom({ from, to, tokenId, account }) {
|
|
66
|
+
return client.writeContract({
|
|
67
|
+
address,
|
|
68
|
+
abi: MySBTABI,
|
|
69
|
+
functionName: 'safeTransferFrom',
|
|
70
|
+
args: [from, to, tokenId],
|
|
71
|
+
account: account,
|
|
72
|
+
chain: client.chain
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
async sbtTransferFrom({ from, to, tokenId, account }) {
|
|
76
|
+
return client.writeContract({
|
|
77
|
+
address,
|
|
78
|
+
abi: MySBTABI,
|
|
79
|
+
functionName: 'transferFrom',
|
|
80
|
+
args: [from, to, tokenId],
|
|
81
|
+
account: account,
|
|
82
|
+
chain: client.chain
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
async sbtApprove({ to, tokenId, account }) {
|
|
86
|
+
return client.writeContract({
|
|
87
|
+
address,
|
|
88
|
+
abi: MySBTABI,
|
|
89
|
+
functionName: 'approve',
|
|
90
|
+
args: [to, tokenId],
|
|
91
|
+
account: account,
|
|
92
|
+
chain: client.chain
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
async sbtSetApprovalForAll({ operator, approved, account }) {
|
|
96
|
+
return client.writeContract({
|
|
97
|
+
address,
|
|
98
|
+
abi: MySBTABI,
|
|
99
|
+
functionName: 'setApprovalForAll',
|
|
100
|
+
args: [operator, approved],
|
|
101
|
+
account: account,
|
|
102
|
+
chain: client.chain
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
async sbtGetApproved({ tokenId }) {
|
|
106
|
+
return client.readContract({
|
|
107
|
+
address,
|
|
108
|
+
abi: MySBTABI,
|
|
109
|
+
functionName: 'getApproved',
|
|
110
|
+
args: [tokenId]
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
async sbtIsApprovedForAll({ owner, operator }) {
|
|
114
|
+
return client.readContract({
|
|
115
|
+
address,
|
|
116
|
+
abi: MySBTABI,
|
|
117
|
+
functionName: 'isApprovedForAll',
|
|
118
|
+
args: [owner, operator]
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
// ERC721 Metadata
|
|
122
|
+
async sbtName() {
|
|
123
|
+
return client.readContract({
|
|
124
|
+
address,
|
|
125
|
+
abi: MySBTABI,
|
|
126
|
+
functionName: 'name',
|
|
127
|
+
args: []
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
async sbtSymbol() {
|
|
131
|
+
return client.readContract({
|
|
132
|
+
address,
|
|
133
|
+
abi: MySBTABI,
|
|
134
|
+
functionName: 'symbol',
|
|
135
|
+
args: []
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
async sbtTokenURI({ tokenId }) {
|
|
139
|
+
return client.readContract({
|
|
140
|
+
address,
|
|
141
|
+
abi: MySBTABI,
|
|
142
|
+
functionName: 'tokenURI',
|
|
143
|
+
args: [tokenId]
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
// ERC721 Enumerable
|
|
147
|
+
async sbtTotalSupply() {
|
|
148
|
+
return client.readContract({
|
|
149
|
+
address,
|
|
150
|
+
abi: MySBTABI,
|
|
151
|
+
functionName: 'totalSupply',
|
|
152
|
+
args: []
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
async sbtTokenByIndex({ index }) {
|
|
156
|
+
return client.readContract({
|
|
157
|
+
address,
|
|
158
|
+
abi: MySBTABI,
|
|
159
|
+
functionName: 'tokenByIndex',
|
|
160
|
+
args: [index]
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
async sbtTokenOfOwnerByIndex({ owner, index }) {
|
|
164
|
+
return client.readContract({
|
|
165
|
+
address,
|
|
166
|
+
abi: MySBTABI,
|
|
167
|
+
functionName: 'tokenOfOwnerByIndex',
|
|
168
|
+
args: [owner, index]
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
// Admin/Minting
|
|
172
|
+
async sbtMint({ to, tokenURI, account }) {
|
|
173
|
+
return client.writeContract({
|
|
174
|
+
address,
|
|
175
|
+
abi: MySBTABI,
|
|
176
|
+
functionName: 'mint',
|
|
177
|
+
args: [to, tokenURI],
|
|
178
|
+
account: account,
|
|
179
|
+
chain: client.chain
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
async sbtBurn({ tokenId, account }) {
|
|
183
|
+
return client.writeContract({
|
|
184
|
+
address,
|
|
185
|
+
abi: MySBTABI,
|
|
186
|
+
functionName: 'burn',
|
|
187
|
+
args: [tokenId],
|
|
188
|
+
account: account,
|
|
189
|
+
chain: client.chain
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
async sbtDeactivateAllMemberships({ user, account }) {
|
|
193
|
+
return client.writeContract({
|
|
194
|
+
address,
|
|
195
|
+
abi: MySBTABI,
|
|
196
|
+
functionName: 'deactivateAllMemberships',
|
|
197
|
+
args: [user],
|
|
198
|
+
account: account,
|
|
199
|
+
chain: client.chain
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
async sbtSetBaseURI({ baseURI, account }) {
|
|
203
|
+
return client.writeContract({
|
|
204
|
+
address,
|
|
205
|
+
abi: MySBTABI,
|
|
206
|
+
functionName: 'setBaseURI',
|
|
207
|
+
args: [baseURI],
|
|
208
|
+
account: account,
|
|
209
|
+
chain: client.chain
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
// Constants
|
|
213
|
+
async sbtREGISTRY() {
|
|
214
|
+
return client.readContract({
|
|
215
|
+
address,
|
|
216
|
+
abi: MySBTABI,
|
|
217
|
+
functionName: 'REGISTRY',
|
|
218
|
+
args: []
|
|
219
|
+
});
|
|
220
|
+
},
|
|
221
|
+
async sbtGTOKEN_STAKING() {
|
|
222
|
+
return client.readContract({
|
|
223
|
+
address,
|
|
224
|
+
abi: MySBTABI,
|
|
225
|
+
functionName: 'GTOKEN_STAKING',
|
|
226
|
+
args: []
|
|
227
|
+
});
|
|
228
|
+
},
|
|
229
|
+
async sbtGTOKEN() {
|
|
230
|
+
return client.readContract({
|
|
231
|
+
address,
|
|
232
|
+
abi: MySBTABI,
|
|
233
|
+
functionName: 'GTOKEN',
|
|
234
|
+
args: []
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
async sbtSUPER_PAYMASTER() {
|
|
238
|
+
return client.readContract({
|
|
239
|
+
address,
|
|
240
|
+
abi: MySBTABI,
|
|
241
|
+
functionName: 'SUPER_PAYMASTER',
|
|
242
|
+
args: []
|
|
243
|
+
});
|
|
244
|
+
},
|
|
245
|
+
// Ownership
|
|
246
|
+
async sbtOwner() {
|
|
247
|
+
return client.readContract({
|
|
248
|
+
address,
|
|
249
|
+
abi: MySBTABI,
|
|
250
|
+
functionName: 'owner',
|
|
251
|
+
args: []
|
|
252
|
+
});
|
|
253
|
+
},
|
|
254
|
+
async sbtTransferSBTOwnership({ newOwner, account }) {
|
|
255
|
+
return client.writeContract({
|
|
256
|
+
address,
|
|
257
|
+
abi: MySBTABI,
|
|
258
|
+
functionName: 'transferOwnership',
|
|
259
|
+
args: [newOwner],
|
|
260
|
+
account: account,
|
|
261
|
+
chain: client.chain
|
|
262
|
+
});
|
|
263
|
+
},
|
|
264
|
+
async sbtRenounceOwnership({ account }) {
|
|
265
|
+
return client.writeContract({
|
|
266
|
+
address,
|
|
267
|
+
abi: MySBTABI,
|
|
268
|
+
functionName: 'renounceOwnership',
|
|
269
|
+
args: [],
|
|
270
|
+
account: account,
|
|
271
|
+
chain: client.chain
|
|
272
|
+
});
|
|
273
|
+
},
|
|
274
|
+
// Additional SBT-specific functions
|
|
275
|
+
async sbtMintForRole({ roleId, to, account }) {
|
|
276
|
+
return client.writeContract({
|
|
277
|
+
address,
|
|
278
|
+
abi: MySBTABI,
|
|
279
|
+
functionName: 'mintForRole',
|
|
280
|
+
args: [roleId, to],
|
|
281
|
+
account: account,
|
|
282
|
+
chain: client.chain
|
|
283
|
+
});
|
|
284
|
+
},
|
|
285
|
+
async sbtGetMemberships({ user }) {
|
|
286
|
+
return client.readContract({
|
|
287
|
+
address,
|
|
288
|
+
abi: MySBTABI,
|
|
289
|
+
functionName: 'getMemberships',
|
|
290
|
+
args: [user]
|
|
291
|
+
});
|
|
292
|
+
},
|
|
293
|
+
async sbtGetActiveMemberships({ user }) {
|
|
294
|
+
return client.readContract({
|
|
295
|
+
address,
|
|
296
|
+
abi: MySBTABI,
|
|
297
|
+
functionName: 'getActiveMemberships',
|
|
298
|
+
args: [user]
|
|
299
|
+
});
|
|
300
|
+
},
|
|
301
|
+
async sbtVerifyCommunityMembership({ user, community }) {
|
|
302
|
+
return client.readContract({
|
|
303
|
+
address,
|
|
304
|
+
abi: MySBTABI,
|
|
305
|
+
functionName: 'verifyCommunityMembership',
|
|
306
|
+
args: [user, community]
|
|
307
|
+
});
|
|
308
|
+
},
|
|
309
|
+
async sbtUserToSBT({ user }) {
|
|
310
|
+
return client.readContract({
|
|
311
|
+
address,
|
|
312
|
+
abi: MySBTABI,
|
|
313
|
+
functionName: 'userToSBT',
|
|
314
|
+
args: [user]
|
|
315
|
+
});
|
|
316
|
+
},
|
|
317
|
+
async sbtSbtData({ tokenId }) {
|
|
318
|
+
return client.readContract({
|
|
319
|
+
address,
|
|
320
|
+
abi: MySBTABI,
|
|
321
|
+
functionName: 'sbtData',
|
|
322
|
+
args: [tokenId]
|
|
323
|
+
});
|
|
324
|
+
},
|
|
325
|
+
async sbtMembershipIndex({ user, index }) {
|
|
326
|
+
return client.readContract({
|
|
327
|
+
address,
|
|
328
|
+
abi: MySBTABI,
|
|
329
|
+
functionName: 'membershipIndex',
|
|
330
|
+
args: [user, index]
|
|
331
|
+
});
|
|
332
|
+
},
|
|
333
|
+
async sbtSupportsInterface({ interfaceId }) {
|
|
334
|
+
return client.readContract({
|
|
335
|
+
address,
|
|
336
|
+
abi: MySBTABI,
|
|
337
|
+
functionName: 'supportsInterface',
|
|
338
|
+
args: [interfaceId]
|
|
339
|
+
});
|
|
340
|
+
},
|
|
341
|
+
async sbtNextTokenId() {
|
|
342
|
+
return client.readContract({
|
|
343
|
+
address,
|
|
344
|
+
abi: MySBTABI,
|
|
345
|
+
functionName: 'nextTokenId',
|
|
346
|
+
args: []
|
|
347
|
+
});
|
|
348
|
+
},
|
|
349
|
+
async sbtBurnSBT({ tokenId, account }) {
|
|
350
|
+
return client.writeContract({
|
|
351
|
+
address,
|
|
352
|
+
abi: MySBTABI,
|
|
353
|
+
functionName: 'burnSBT',
|
|
354
|
+
args: [tokenId],
|
|
355
|
+
account: account,
|
|
356
|
+
chain: client.chain
|
|
357
|
+
});
|
|
358
|
+
},
|
|
359
|
+
async sbtLeaveCommunity({ community, account }) {
|
|
360
|
+
return client.writeContract({
|
|
361
|
+
address,
|
|
362
|
+
abi: MySBTABI,
|
|
363
|
+
functionName: 'leaveCommunity',
|
|
364
|
+
args: [community],
|
|
365
|
+
account: account,
|
|
366
|
+
chain: client.chain
|
|
367
|
+
});
|
|
368
|
+
},
|
|
369
|
+
async sbtDeactivateMembership({ tokenId, account }) {
|
|
370
|
+
return client.writeContract({
|
|
371
|
+
address,
|
|
372
|
+
abi: MySBTABI,
|
|
373
|
+
functionName: 'deactivateMembership',
|
|
374
|
+
args: [tokenId],
|
|
375
|
+
account: account,
|
|
376
|
+
chain: client.chain
|
|
377
|
+
});
|
|
378
|
+
},
|
|
379
|
+
async sbtRecordActivity({ user, account }) {
|
|
380
|
+
return client.writeContract({
|
|
381
|
+
address,
|
|
382
|
+
abi: MySBTABI,
|
|
383
|
+
functionName: 'recordActivity',
|
|
384
|
+
args: [user],
|
|
385
|
+
account: account,
|
|
386
|
+
chain: client.chain
|
|
387
|
+
});
|
|
388
|
+
},
|
|
389
|
+
async sbtLastActivityTime({ user }) {
|
|
390
|
+
return client.readContract({
|
|
391
|
+
address,
|
|
392
|
+
abi: MySBTABI,
|
|
393
|
+
functionName: 'lastActivityTime',
|
|
394
|
+
args: [user]
|
|
395
|
+
});
|
|
396
|
+
},
|
|
397
|
+
async sbtWeeklyActivity({ user }) {
|
|
398
|
+
return client.readContract({
|
|
399
|
+
address,
|
|
400
|
+
abi: MySBTABI,
|
|
401
|
+
functionName: 'weeklyActivity',
|
|
402
|
+
args: [user]
|
|
403
|
+
});
|
|
404
|
+
},
|
|
405
|
+
async sbtReputationCalculator() {
|
|
406
|
+
return client.readContract({
|
|
407
|
+
address,
|
|
408
|
+
abi: MySBTABI,
|
|
409
|
+
functionName: 'reputationCalculator',
|
|
410
|
+
args: []
|
|
411
|
+
});
|
|
412
|
+
},
|
|
413
|
+
async sbtSetReputationCalculator({ calculator, account }) {
|
|
414
|
+
return client.writeContract({
|
|
415
|
+
address,
|
|
416
|
+
abi: MySBTABI,
|
|
417
|
+
functionName: 'setReputationCalculator',
|
|
418
|
+
args: [calculator],
|
|
419
|
+
account: account,
|
|
420
|
+
chain: client.chain
|
|
421
|
+
});
|
|
422
|
+
},
|
|
423
|
+
async sbtMintFee() {
|
|
424
|
+
return client.readContract({
|
|
425
|
+
address,
|
|
426
|
+
abi: MySBTABI,
|
|
427
|
+
functionName: 'mintFee',
|
|
428
|
+
args: []
|
|
429
|
+
});
|
|
430
|
+
},
|
|
431
|
+
async sbtSetMintFee({ fee, account }) {
|
|
432
|
+
return client.writeContract({
|
|
433
|
+
address,
|
|
434
|
+
abi: MySBTABI,
|
|
435
|
+
functionName: 'setMintFee',
|
|
436
|
+
args: [fee],
|
|
437
|
+
account: account,
|
|
438
|
+
chain: client.chain
|
|
439
|
+
});
|
|
440
|
+
},
|
|
441
|
+
async sbtMinLockAmount() {
|
|
442
|
+
return client.readContract({
|
|
443
|
+
address,
|
|
444
|
+
abi: MySBTABI,
|
|
445
|
+
functionName: 'minLockAmount',
|
|
446
|
+
args: []
|
|
447
|
+
});
|
|
448
|
+
},
|
|
449
|
+
async sbtSetMinLockAmount({ amount, account }) {
|
|
450
|
+
return client.writeContract({
|
|
451
|
+
address,
|
|
452
|
+
abi: MySBTABI,
|
|
453
|
+
functionName: 'setMinLockAmount',
|
|
454
|
+
args: [amount],
|
|
455
|
+
account: account,
|
|
456
|
+
chain: client.chain
|
|
457
|
+
});
|
|
458
|
+
},
|
|
459
|
+
async sbtPause({ account }) {
|
|
460
|
+
return client.writeContract({
|
|
461
|
+
address,
|
|
462
|
+
abi: MySBTABI,
|
|
463
|
+
functionName: 'pause',
|
|
464
|
+
args: [],
|
|
465
|
+
account: account,
|
|
466
|
+
chain: client.chain
|
|
467
|
+
});
|
|
468
|
+
},
|
|
469
|
+
async sbtUnpause({ account }) {
|
|
470
|
+
return client.writeContract({
|
|
471
|
+
address,
|
|
472
|
+
abi: MySBTABI,
|
|
473
|
+
functionName: 'unpause',
|
|
474
|
+
args: [],
|
|
475
|
+
account: account,
|
|
476
|
+
chain: client.chain
|
|
477
|
+
});
|
|
478
|
+
},
|
|
479
|
+
async sbtPaused() {
|
|
480
|
+
return client.readContract({
|
|
481
|
+
address,
|
|
482
|
+
abi: MySBTABI,
|
|
483
|
+
functionName: 'paused',
|
|
484
|
+
args: []
|
|
485
|
+
});
|
|
486
|
+
},
|
|
487
|
+
async sbtDaoMultisig() {
|
|
488
|
+
return client.readContract({
|
|
489
|
+
address,
|
|
490
|
+
abi: MySBTABI,
|
|
491
|
+
functionName: 'daoMultisig',
|
|
492
|
+
args: []
|
|
493
|
+
});
|
|
494
|
+
},
|
|
495
|
+
async sbtSetDAOMultisig({ multisig, account }) {
|
|
496
|
+
return client.writeContract({
|
|
497
|
+
address,
|
|
498
|
+
abi: MySBTABI,
|
|
499
|
+
functionName: 'setDAOMultisig',
|
|
500
|
+
args: [multisig],
|
|
501
|
+
account: account,
|
|
502
|
+
chain: client.chain
|
|
503
|
+
});
|
|
504
|
+
},
|
|
505
|
+
async sbtSetRegistry({ registry, account }) {
|
|
506
|
+
return client.writeContract({
|
|
507
|
+
address,
|
|
508
|
+
abi: MySBTABI,
|
|
509
|
+
functionName: 'setRegistry',
|
|
510
|
+
args: [registry],
|
|
511
|
+
account: account,
|
|
512
|
+
chain: client.chain
|
|
513
|
+
});
|
|
514
|
+
},
|
|
515
|
+
async sbtSetSuperPaymaster({ paymaster, account }) {
|
|
516
|
+
return client.writeContract({
|
|
517
|
+
address,
|
|
518
|
+
abi: MySBTABI,
|
|
519
|
+
functionName: 'setSuperPaymaster',
|
|
520
|
+
args: [paymaster],
|
|
521
|
+
account: account,
|
|
522
|
+
chain: client.chain
|
|
523
|
+
});
|
|
524
|
+
},
|
|
525
|
+
async sbtVersion() {
|
|
526
|
+
return client.readContract({
|
|
527
|
+
address,
|
|
528
|
+
abi: MySBTABI,
|
|
529
|
+
functionName: 'version',
|
|
530
|
+
args: []
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
});
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { type Address, type PublicClient, type WalletClient, type Hex, type Hash, type Account } from 'viem';
|
|
2
|
+
export type StakingActions = {
|
|
3
|
+
lockStake: (args: {
|
|
4
|
+
user: Address;
|
|
5
|
+
roleId: Hex;
|
|
6
|
+
stakeAmount: bigint;
|
|
7
|
+
entryBurn: bigint;
|
|
8
|
+
payer: Address;
|
|
9
|
+
account?: Account | Address;
|
|
10
|
+
}) => Promise<Hash>;
|
|
11
|
+
unlockStake: (args: {
|
|
12
|
+
user: Address;
|
|
13
|
+
roleId: Hex;
|
|
14
|
+
account?: Account | Address;
|
|
15
|
+
}) => Promise<Hash>;
|
|
16
|
+
unlockAndTransfer: (args: {
|
|
17
|
+
user: Address;
|
|
18
|
+
roleId: Hex;
|
|
19
|
+
account?: Account | Address;
|
|
20
|
+
}) => Promise<Hash>;
|
|
21
|
+
stake: (args: {
|
|
22
|
+
amount: bigint;
|
|
23
|
+
account?: Account | Address;
|
|
24
|
+
}) => Promise<Hash>;
|
|
25
|
+
topUpStake: (args: {
|
|
26
|
+
amount: bigint;
|
|
27
|
+
account?: Account | Address;
|
|
28
|
+
}) => Promise<Hash>;
|
|
29
|
+
unstake: (args: {
|
|
30
|
+
amount: bigint;
|
|
31
|
+
account?: Account | Address;
|
|
32
|
+
}) => Promise<Hash>;
|
|
33
|
+
slash: (args: {
|
|
34
|
+
user: Address;
|
|
35
|
+
roleId: Hex;
|
|
36
|
+
amount: bigint;
|
|
37
|
+
reason: string;
|
|
38
|
+
account?: Account | Address;
|
|
39
|
+
}) => Promise<Hash>;
|
|
40
|
+
slashByDVT: (args: {
|
|
41
|
+
user: Address;
|
|
42
|
+
roleId: Hex;
|
|
43
|
+
amount: bigint;
|
|
44
|
+
reason: string;
|
|
45
|
+
account?: Account | Address;
|
|
46
|
+
}) => Promise<Hash>;
|
|
47
|
+
setAuthorizedSlasher: (args: {
|
|
48
|
+
slasher: Address;
|
|
49
|
+
authorized: boolean;
|
|
50
|
+
account?: Account | Address;
|
|
51
|
+
}) => Promise<Hash>;
|
|
52
|
+
getStakeInfo: (args: {
|
|
53
|
+
operator: Address;
|
|
54
|
+
roleId: Hex;
|
|
55
|
+
}) => Promise<any>;
|
|
56
|
+
getStakingBalance: (args: {
|
|
57
|
+
user: Address;
|
|
58
|
+
}) => Promise<bigint>;
|
|
59
|
+
getLockedStake: (args: {
|
|
60
|
+
user: Address;
|
|
61
|
+
roleId: Hex;
|
|
62
|
+
}) => Promise<bigint>;
|
|
63
|
+
getUserRoleLocks: (args: {
|
|
64
|
+
user: Address;
|
|
65
|
+
}) => Promise<any[]>;
|
|
66
|
+
hasRoleLock: (args: {
|
|
67
|
+
user: Address;
|
|
68
|
+
roleId: Hex;
|
|
69
|
+
}) => Promise<boolean>;
|
|
70
|
+
availableBalance: (args: {
|
|
71
|
+
user: Address;
|
|
72
|
+
}) => Promise<bigint>;
|
|
73
|
+
previewExitFee: (args: {
|
|
74
|
+
user: Address;
|
|
75
|
+
roleId: Hex;
|
|
76
|
+
}) => Promise<bigint>;
|
|
77
|
+
setRegistry: (args: {
|
|
78
|
+
registry: Address;
|
|
79
|
+
account?: Account | Address;
|
|
80
|
+
}) => Promise<Hash>;
|
|
81
|
+
transferOwnership: (args: {
|
|
82
|
+
newOwner: Address;
|
|
83
|
+
account?: Account | Address;
|
|
84
|
+
}) => Promise<Hash>;
|
|
85
|
+
setRoleExitFee: (args: {
|
|
86
|
+
roleId: Hex;
|
|
87
|
+
feePercent: bigint;
|
|
88
|
+
account?: Account | Address;
|
|
89
|
+
}) => Promise<Hash>;
|
|
90
|
+
setTreasury: (args: {
|
|
91
|
+
treasury: Address;
|
|
92
|
+
account?: Account | Address;
|
|
93
|
+
}) => Promise<Hash>;
|
|
94
|
+
stakes: (args: {
|
|
95
|
+
user: Address;
|
|
96
|
+
}) => Promise<any>;
|
|
97
|
+
roleLocks: (args: {
|
|
98
|
+
user: Address;
|
|
99
|
+
roleId: Hex;
|
|
100
|
+
}) => Promise<any>;
|
|
101
|
+
roleExitConfigs: (args: {
|
|
102
|
+
roleId: Hex;
|
|
103
|
+
}) => Promise<any>;
|
|
104
|
+
userActiveRoles: (args: {
|
|
105
|
+
user: Address;
|
|
106
|
+
index: bigint;
|
|
107
|
+
}) => Promise<Hex>;
|
|
108
|
+
authorizedSlashers: (args: {
|
|
109
|
+
slasher: Address;
|
|
110
|
+
}) => Promise<boolean>;
|
|
111
|
+
getStake: (args: {
|
|
112
|
+
account: Address;
|
|
113
|
+
}) => Promise<bigint>;
|
|
114
|
+
balanceOf: (args: {
|
|
115
|
+
account: Address;
|
|
116
|
+
}) => Promise<bigint>;
|
|
117
|
+
totalStaked: () => Promise<bigint>;
|
|
118
|
+
getTotalStaked: () => Promise<bigint>;
|
|
119
|
+
treasury: () => Promise<Address>;
|
|
120
|
+
owner: () => Promise<Address>;
|
|
121
|
+
transferStakingOwnership: (args: {
|
|
122
|
+
newOwner: Address;
|
|
123
|
+
account?: Account | Address;
|
|
124
|
+
}) => Promise<Hash>;
|
|
125
|
+
renounceOwnership: (args: {
|
|
126
|
+
account?: Account | Address;
|
|
127
|
+
}) => Promise<Hash>;
|
|
128
|
+
version: () => Promise<string>;
|
|
129
|
+
REGISTRY: () => Promise<Address>;
|
|
130
|
+
GTOKEN: () => Promise<Address>;
|
|
131
|
+
};
|
|
132
|
+
export declare const stakingActions: (address: Address) => (client: PublicClient | WalletClient) => StakingActions;
|