@wandevs/governance-contracts-sdk 1.0.1 → 1.1.1
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/README.md +12 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1017 -65
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1017 -65
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -13
package/dist/index.d.mts
CHANGED
|
@@ -1,31 +1,82 @@
|
|
|
1
|
-
import { Abi, Account, Address, Chain, ContractFunctionArgs, ContractFunctionName,
|
|
1
|
+
import { Abi, Account, Address, Chain, ContractFunctionArgs, ContractFunctionName, Hex, PrepareTransactionRequestReturnType, PublicClient } from "viem";
|
|
2
2
|
|
|
3
3
|
//#region src/util.d.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Type definition for proposal description schema structure
|
|
6
|
+
* @interface ProposalDescriptionSchema
|
|
7
|
+
* @property {Array<{ type: string }>} types - ABI parameter types array
|
|
8
|
+
* @property {string[]} names - Corresponding parameter names array (no undefined values)
|
|
9
|
+
*/
|
|
10
|
+
interface ProposalDescriptionSchema {
|
|
11
|
+
types: Array<{
|
|
12
|
+
type: 'uint8' | 'string';
|
|
13
|
+
}>;
|
|
14
|
+
names: string[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Type definition for decoded proposal description data
|
|
18
|
+
* @type {Record<string, number | string>}
|
|
19
|
+
* Key-value pairs of proposal description data (version/title/description etc.)
|
|
20
|
+
*/
|
|
21
|
+
type ProposalDescriptionData = Record<string, number | string>;
|
|
22
|
+
/**
|
|
23
|
+
* Valid version types for proposal description schema
|
|
24
|
+
* @type {1 | 2 | 3}
|
|
25
|
+
*/
|
|
26
|
+
type ValidVersion = 1 | 2 | 3;
|
|
27
|
+
/**
|
|
28
|
+
* Supported proposal description data type schemas by version
|
|
29
|
+
* @readonly
|
|
30
|
+
* @type {Record<ValidVersion, ProposalDescriptionSchema>}
|
|
31
|
+
* Schema definitions for different versions of proposal description data:
|
|
32
|
+
* - Version 1: basic fields (version/title/description/email/telegram)
|
|
33
|
+
* - Version 2: adds twitter field
|
|
34
|
+
* - Version 3: adds discord field
|
|
35
|
+
*/
|
|
36
|
+
declare const supportedProposalDescriptionDataTypeSchema: Record<ValidVersion, ProposalDescriptionSchema>;
|
|
37
|
+
/**
|
|
38
|
+
* Encodes proposal description data to Hex format using viem's encodeAbiParameters
|
|
39
|
+
* @function encodeProposalDescriptionData
|
|
40
|
+
* @param {...(number | string)} args - Proposal description parameters (matches schema by version):
|
|
41
|
+
* - First argument: version (uint8, 1/2/3)
|
|
42
|
+
* - Subsequent arguments: title, description, email, telegram, [twitter], [discord]
|
|
43
|
+
* @returns {Hex} Encoded Hex string of proposal description data
|
|
44
|
+
* @throws {Error} If version is unsupported or argument count doesn't match schema
|
|
45
|
+
* @example
|
|
46
|
+
* // Encode version 2 proposal data
|
|
47
|
+
* const encoded = encodeProposalDescriptionData(2, "Test Proposal", "Test Description", "test@example.com", "@test", "@test_twitter");
|
|
48
|
+
* console.log(encoded); // Hex string
|
|
49
|
+
*/
|
|
50
|
+
declare function encodeProposalDescriptionData(...args: (number | string)[]): Hex;
|
|
51
|
+
/**
|
|
52
|
+
* Decodes Hex formatted proposal description data back to object format
|
|
53
|
+
* @function decodeProposalDescriptionData
|
|
54
|
+
* @param {Hex} hexData - Encoded Hex string of proposal description data
|
|
55
|
+
* @returns {ProposalDescriptionData} Decoded proposal description object with named fields
|
|
56
|
+
* @throws {Error} If version from hexData is unsupported or data is corrupted
|
|
57
|
+
* @example
|
|
58
|
+
* // Decode Hex data to proposal object
|
|
59
|
+
* const decoded = decodeProposalDescriptionData("0x...");
|
|
60
|
+
* console.log(decoded.title); // "Test Proposal"
|
|
61
|
+
*/
|
|
62
|
+
declare function decodeProposalDescriptionData(hexData: Hex): ProposalDescriptionData;
|
|
63
|
+
/**
|
|
64
|
+
* Extracts version number from encoded Hex proposal data
|
|
65
|
+
* @function getVersionFromData
|
|
66
|
+
* @param {Hex} hexData - Encoded Hex string of proposal description data
|
|
67
|
+
* @returns {ValidVersion | 0} Extracted valid version (1/2/3) or 0 if invalid
|
|
68
|
+
* Reads the first 32-byte slot of Hex data to get uint8 version value
|
|
69
|
+
* @example
|
|
70
|
+
* const version = getVersionFromData("0x...");
|
|
71
|
+
* console.log(version); // 2
|
|
72
|
+
*/
|
|
73
|
+
declare function getVersionFromData(hexData: Hex): ValidVersion | 0;
|
|
27
74
|
//#endregion
|
|
28
75
|
//#region src/types/index.d.ts
|
|
76
|
+
/**
|
|
77
|
+
* @enum {number} UnstakeStatus
|
|
78
|
+
* Define unstake status at different stages.
|
|
79
|
+
*/
|
|
29
80
|
declare enum UnstakeStatus {
|
|
30
81
|
NotExists = 0,
|
|
31
82
|
// Request does not exist
|
|
@@ -35,21 +86,37 @@ declare enum UnstakeStatus {
|
|
|
35
86
|
// Request is in progress
|
|
36
87
|
ReadyToClaim = 3
|
|
37
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* @enum {number} ProposalRole
|
|
91
|
+
* Define the roles of proposal participants.
|
|
92
|
+
*/
|
|
38
93
|
declare enum ProposalRole {
|
|
39
94
|
Proposer = 0,
|
|
40
95
|
Partner = 1,
|
|
41
96
|
Voter = 2
|
|
42
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* @enum {number} PledgeType
|
|
100
|
+
* Define the type of pledged.
|
|
101
|
+
*/
|
|
43
102
|
declare enum PledgeType {
|
|
44
103
|
None = 0,
|
|
45
104
|
Burn = 1,
|
|
46
105
|
Lock = 2
|
|
47
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* @enum {number} VoteType
|
|
109
|
+
* Define the type of vote.
|
|
110
|
+
*/
|
|
48
111
|
declare enum VoteType {
|
|
49
112
|
None = 0,
|
|
50
113
|
For = 1,
|
|
51
114
|
Against = 2
|
|
52
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* @enum {number} ProposalState
|
|
118
|
+
* Define the different stages of a proposal.
|
|
119
|
+
*/
|
|
53
120
|
declare enum ProposalState {
|
|
54
121
|
None = 0,
|
|
55
122
|
UnderReview = 1,
|
|
@@ -59,79 +126,402 @@ declare enum ProposalState {
|
|
|
59
126
|
Succeeded = 5,
|
|
60
127
|
Rejected = 6
|
|
61
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* @enum {number} ProposalCategory
|
|
131
|
+
* Define the category of proposal.
|
|
132
|
+
*/
|
|
62
133
|
declare enum ProposalCategory {
|
|
63
134
|
Funding = 0,
|
|
64
135
|
Technical = 1
|
|
65
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Funding info.
|
|
139
|
+
*/
|
|
66
140
|
interface FundInfo {
|
|
141
|
+
/**
|
|
142
|
+
* Amount of WAN.
|
|
143
|
+
* @type {bigint}
|
|
144
|
+
*/
|
|
67
145
|
wanAmount: bigint;
|
|
146
|
+
/**
|
|
147
|
+
* Amount of WAN power.
|
|
148
|
+
* @type {bigint}
|
|
149
|
+
*/
|
|
68
150
|
wanPower: bigint;
|
|
151
|
+
/**
|
|
152
|
+
* ID of proposal request withdrawal to be queried for proposer, partner or voter.
|
|
153
|
+
* @type {bigint}
|
|
154
|
+
*/
|
|
69
155
|
requestId: bigint;
|
|
156
|
+
/**
|
|
157
|
+
* The amount of StWan that can be withdrawn after staking WAN in the proposal for proposer, partner or voter.
|
|
158
|
+
* @type {bigint}
|
|
159
|
+
*/
|
|
70
160
|
claimStWanAmount: bigint;
|
|
161
|
+
/**
|
|
162
|
+
* The amount of WAN that can be received after claim StWan in the proposal for proposer, partner or voter.
|
|
163
|
+
* @type {bigint}
|
|
164
|
+
*/
|
|
71
165
|
claimWanAmount: bigint;
|
|
166
|
+
/**
|
|
167
|
+
* Lock duration of proposal be queried for proposer, partner or voter.
|
|
168
|
+
* @type {bigint}
|
|
169
|
+
*/
|
|
72
170
|
lockDuration: bigint;
|
|
171
|
+
/**
|
|
172
|
+
* PledgeType of proposal be queried for proposer, partner or voter.
|
|
173
|
+
* @type {PledgeType}
|
|
174
|
+
*/
|
|
73
175
|
pledgeType: PledgeType;
|
|
176
|
+
/**
|
|
177
|
+
* Reasons for participating in the proposal.
|
|
178
|
+
* @type {Hex}
|
|
179
|
+
*/
|
|
74
180
|
reason: Hex;
|
|
181
|
+
/**
|
|
182
|
+
* Indicator showing whether it has been claimed.
|
|
183
|
+
* @type {boolean}
|
|
184
|
+
*/
|
|
75
185
|
exited: boolean;
|
|
76
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Pproposal vote statistics.
|
|
189
|
+
*/
|
|
77
190
|
interface Tally {
|
|
191
|
+
/**
|
|
192
|
+
* Amount of WAN power for yes.
|
|
193
|
+
* @type {bigint}
|
|
194
|
+
*/
|
|
78
195
|
yes: bigint;
|
|
196
|
+
/**
|
|
197
|
+
* Amount of WAN power for no.
|
|
198
|
+
* @type {bigint}
|
|
199
|
+
*/
|
|
79
200
|
no: bigint;
|
|
80
201
|
}
|
|
81
|
-
|
|
82
|
-
|
|
202
|
+
/**
|
|
203
|
+
* ContractProposal: proposal info of Wanchain governance contract.
|
|
204
|
+
*/
|
|
205
|
+
interface ContractProposal {
|
|
206
|
+
/**
|
|
207
|
+
* Amount of XP required when proposal creation.
|
|
208
|
+
* @type {bigint}
|
|
209
|
+
*/
|
|
83
210
|
requireXpAmount: bigint;
|
|
211
|
+
/**
|
|
212
|
+
* Amount of WAN request when proposal creation.
|
|
213
|
+
* @type {bigint}
|
|
214
|
+
*/
|
|
84
215
|
requestWanAmount: bigint;
|
|
216
|
+
/**
|
|
217
|
+
* Minimum amount of WAN power to win proposal vote.
|
|
218
|
+
* @type {bigint}
|
|
219
|
+
*/
|
|
85
220
|
requestMinVotingWanPower: bigint;
|
|
221
|
+
/**
|
|
222
|
+
* Amount of WAN that proposal total pledged for proposer and partner.
|
|
223
|
+
* @type {bigint}
|
|
224
|
+
*/
|
|
86
225
|
totalPledgingWanAmount: bigint;
|
|
226
|
+
/**
|
|
227
|
+
* Amount of WAN power that proposal total pledged.
|
|
228
|
+
* @type {bigint}
|
|
229
|
+
*/
|
|
87
230
|
totalPledgingWanPower: bigint;
|
|
231
|
+
/**
|
|
232
|
+
* Amount of WAN voted.
|
|
233
|
+
* @type {bigint}
|
|
234
|
+
*/
|
|
88
235
|
totalVotingWanAmount: bigint;
|
|
236
|
+
/**
|
|
237
|
+
* Amount of WAN power voted.
|
|
238
|
+
* @type {bigint}
|
|
239
|
+
*/
|
|
89
240
|
totalVotingWanPower: bigint;
|
|
241
|
+
/**
|
|
242
|
+
* The total amount of T involved in the proposal.
|
|
243
|
+
* @type {bigint}
|
|
244
|
+
*/
|
|
90
245
|
totalWanAmount: bigint;
|
|
246
|
+
/**
|
|
247
|
+
* The amount of WAN's that have passed review in the proposal.
|
|
248
|
+
* @type {bigint}
|
|
249
|
+
*/
|
|
91
250
|
totalLockingWanAmount: bigint;
|
|
251
|
+
/**
|
|
252
|
+
* The amount of WAN's that have burned in the proposal.
|
|
253
|
+
* @type {bigint}
|
|
254
|
+
*/
|
|
92
255
|
totalBurnedWanAmount: bigint;
|
|
256
|
+
/**
|
|
257
|
+
* The total amount of StWan received after staking WAN in the proposal.
|
|
258
|
+
* @type {bigint}
|
|
259
|
+
*/
|
|
93
260
|
totalStWanAmount: bigint;
|
|
261
|
+
/**
|
|
262
|
+
* The amount of StWan that can be withdrawn after staking WAN in the proposal.
|
|
263
|
+
* @type {bigint}
|
|
264
|
+
*/
|
|
94
265
|
totalClaimeStWanAmount: bigint;
|
|
266
|
+
/**
|
|
267
|
+
* Timestamp of proposal creation.
|
|
268
|
+
* @type {bigint}
|
|
269
|
+
*/
|
|
95
270
|
submitTimestamp: bigint;
|
|
271
|
+
/**
|
|
272
|
+
* Fundraising deadline for prospective proposal.
|
|
273
|
+
* @type {bigint}
|
|
274
|
+
*/
|
|
96
275
|
fundraisingDeadline: bigint;
|
|
276
|
+
/**
|
|
277
|
+
* Vote deadline for active(voting) proposal.
|
|
278
|
+
* @type {bigint}
|
|
279
|
+
*/
|
|
97
280
|
voteDeadline: bigint;
|
|
281
|
+
/**
|
|
282
|
+
* Current proposal vote statistics.
|
|
283
|
+
* @type {bigint}
|
|
284
|
+
*/
|
|
98
285
|
tally: Tally;
|
|
286
|
+
/**
|
|
287
|
+
* Funding info of proposer.
|
|
288
|
+
* @type {Hex}
|
|
289
|
+
*/
|
|
99
290
|
proposerFundInfo: FundInfo;
|
|
291
|
+
/**
|
|
292
|
+
* Category of proposal.
|
|
293
|
+
* @type {Hex}
|
|
294
|
+
*/
|
|
100
295
|
category: ProposalCategory;
|
|
296
|
+
/**
|
|
297
|
+
* State of proposal.
|
|
298
|
+
* @type {Hex}
|
|
299
|
+
*/
|
|
101
300
|
state: ProposalState;
|
|
301
|
+
/**
|
|
302
|
+
* Proposer of proposal.
|
|
303
|
+
* @type {Hex}
|
|
304
|
+
*/
|
|
102
305
|
proposer: Address;
|
|
306
|
+
/**
|
|
307
|
+
* Description of proposal creation.
|
|
308
|
+
* @type {Hex}
|
|
309
|
+
*/
|
|
103
310
|
description: Hex;
|
|
311
|
+
/**
|
|
312
|
+
* Reasons to cancel or review proposal.
|
|
313
|
+
* @type {Hex}
|
|
314
|
+
*/
|
|
104
315
|
reason: Hex;
|
|
105
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* ProposalInfo: proposal info extends contract proposal(ContractProposal)
|
|
319
|
+
*/
|
|
320
|
+
interface ProposalInfo extends ContractProposal {
|
|
321
|
+
/**
|
|
322
|
+
* ID of proposal, should be bytes32.
|
|
323
|
+
* @type {Hex}
|
|
324
|
+
*/
|
|
325
|
+
proposalId: Hex;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* PartnerInfo: partner info in proposal
|
|
329
|
+
*/
|
|
106
330
|
interface PartnerInfo {
|
|
331
|
+
/**
|
|
332
|
+
* Fund info for partner.
|
|
333
|
+
* @type {FundInfo}
|
|
334
|
+
*/
|
|
107
335
|
fundInfo: FundInfo;
|
|
108
336
|
}
|
|
337
|
+
/**
|
|
338
|
+
* VoterInfo: voter info in proposal
|
|
339
|
+
*/
|
|
109
340
|
interface VoterInfo {
|
|
341
|
+
/**
|
|
342
|
+
* Fund info for voter.
|
|
343
|
+
* @type {FundInfo}
|
|
344
|
+
*/
|
|
110
345
|
fundInfo: FundInfo;
|
|
346
|
+
/**
|
|
347
|
+
* Vote type for voter.
|
|
348
|
+
* @type {VoteType}
|
|
349
|
+
*/
|
|
111
350
|
voteType: VoteType;
|
|
112
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* IndexRange: Index range: [start, index]
|
|
354
|
+
*/
|
|
113
355
|
interface IndexRange {
|
|
114
|
-
|
|
115
|
-
|
|
356
|
+
/**
|
|
357
|
+
* Start index.
|
|
358
|
+
* @type {number}
|
|
359
|
+
*/
|
|
360
|
+
start: number;
|
|
361
|
+
/**
|
|
362
|
+
* End index.
|
|
363
|
+
* @type {number}
|
|
364
|
+
*/
|
|
365
|
+
end: number;
|
|
116
366
|
}
|
|
367
|
+
/**
|
|
368
|
+
* PlegeMultiplierReturn: Return type for getProposalMultipliers.
|
|
369
|
+
*/
|
|
117
370
|
interface PlegeMultiplierReturn {
|
|
371
|
+
/**
|
|
372
|
+
* PledgeType of proposal be queried for proposer, partner or voter.
|
|
373
|
+
* @type {PledgeType}
|
|
374
|
+
*/
|
|
118
375
|
pledgeType: PledgeType;
|
|
376
|
+
/**
|
|
377
|
+
* Lock duration of proposal be queried for proposer, partner or voter.
|
|
378
|
+
* @type {bigint}
|
|
379
|
+
*/
|
|
119
380
|
lockDuration: bigint;
|
|
381
|
+
/**
|
|
382
|
+
* Multiplier of proposal be queried for proposer, partner or voter.
|
|
383
|
+
* @type {bigint}
|
|
384
|
+
*/
|
|
120
385
|
multiplier: bigint;
|
|
121
386
|
}
|
|
387
|
+
/**
|
|
388
|
+
* CanRequestProposalWithdrawalParam: Input parameter type for canRequestProposalWithdrawal, same as CanClaimProposalWithdrawalParam.
|
|
389
|
+
*/
|
|
122
390
|
interface CanRequestProposalWithdrawalParam {
|
|
391
|
+
/**
|
|
392
|
+
* State of proposal to be queried.
|
|
393
|
+
* @type {ProposalState}
|
|
394
|
+
*/
|
|
123
395
|
state: ProposalState;
|
|
124
|
-
|
|
396
|
+
/**
|
|
397
|
+
* PledgeType of proposal to be queried.
|
|
398
|
+
* @type {PledgeType}
|
|
399
|
+
*/
|
|
400
|
+
pledgeType: PledgeType;
|
|
401
|
+
/**
|
|
402
|
+
* Lock duration of proposal be queried for proposer, partner or voter.
|
|
403
|
+
* @type {bigint}
|
|
404
|
+
*/
|
|
125
405
|
lockDuration: bigint;
|
|
406
|
+
/**
|
|
407
|
+
* Vote deadlint for proposal to be queried.
|
|
408
|
+
* @type {bigint}
|
|
409
|
+
*/
|
|
126
410
|
voteDeadline: bigint;
|
|
411
|
+
/**
|
|
412
|
+
* ID of proposal request withdrawal to be queried for proposer, partner or voter.
|
|
413
|
+
* @type {bigint}
|
|
414
|
+
*/
|
|
127
415
|
requestId: bigint;
|
|
416
|
+
/**
|
|
417
|
+
* Check if already claimed of proposal to be queried for proposer, partner or voter.
|
|
418
|
+
* @type {boolean}
|
|
419
|
+
*/
|
|
128
420
|
exited: boolean;
|
|
129
421
|
}
|
|
422
|
+
/**
|
|
423
|
+
* CanClaimProposalWithdrawalParam: Input parameter type for canClaimProposalWithdrawal, same as CanRequestProposalWithdrawalParam.
|
|
424
|
+
*/
|
|
425
|
+
type CanClaimProposalWithdrawalParam = CanRequestProposalWithdrawalParam;
|
|
426
|
+
/**
|
|
427
|
+
* CanRequestProposalWithdrawalRetrunItem: Return array item for canRequestProposalWithdrawal
|
|
428
|
+
*/
|
|
130
429
|
interface CanRequestProposalWithdrawalRetrunItem {
|
|
430
|
+
/**
|
|
431
|
+
* Check if need to request withdrawal for proposer, partner or voter.
|
|
432
|
+
* @type {boolean}
|
|
433
|
+
*/
|
|
131
434
|
needRequestWithdrawal: boolean;
|
|
435
|
+
/**
|
|
436
|
+
* Check if can request withdrawal for proposer, partner or voter.
|
|
437
|
+
* @type {boolean}
|
|
438
|
+
*/
|
|
132
439
|
canRequestWithdrawal: boolean;
|
|
133
440
|
}
|
|
134
|
-
|
|
441
|
+
/**
|
|
442
|
+
* Type definition of return type for getBaseParameters.
|
|
443
|
+
* @interface BaseParametersReturnType
|
|
444
|
+
* @property {bigint} allProposalWanAmount - All reviewed proposal WAN amounts.
|
|
445
|
+
* @property {bigint} allProposalLockingWanAmount - All amount of WAN that locking into POS.
|
|
446
|
+
* @property {bigint} allProposalBurnedWanAmount - All burned WAN amounts.
|
|
447
|
+
* @property {bigint} ethTransferGasLimit - WAN transfer gaslimit.
|
|
448
|
+
* @property {bigint} minParticipationAmount - Minimum amount of WANs a participant can participate in for funding proposal.
|
|
449
|
+
* @property {bigint} requestWanMultiplier - Multiplier to request WANs from Wanchain Treasury.
|
|
450
|
+
* @property {bigint} succeedThreshold - Threshold to succeed proposal.
|
|
451
|
+
* @property {bigint} requireXpAmount - Proposal creation require amount of XP.
|
|
452
|
+
* @property {bigint} pledgeLockDuration - Proposer or partner pledge WAN by locking duration.
|
|
453
|
+
* @property {bigint} fundraisingDuration - Duration for partners to pledge their WAN to help a Prospective Proposal meet the pledge requirements.
|
|
454
|
+
* @property {bigint} voteDuration - Duration for voters to vote active proposal.
|
|
455
|
+
* @property {Address} xp - Address of XP token.
|
|
456
|
+
* @property {Address} stakingManager - Address for StakingManager.
|
|
457
|
+
* @property {Address} wanTreasury - Address for Wanchain community treasury.
|
|
458
|
+
* @property {Address} burnAddr - Address for WAN burned.
|
|
459
|
+
* @property {bigint} proposalCount - Count for total proposal: include reviewing proposals, canceled proposals, prospective proposals, active proposals, succeeded proposals and failed proposals.
|
|
460
|
+
* @property {bigint} reviewPendingProposalCount - Count for reviewing proposals.
|
|
461
|
+
* @property {bigint} prospectiveProposalCount - Count for prospective proposals.
|
|
462
|
+
* @property {bigint} votingProposalCount - Count for active(voting) proposals.
|
|
463
|
+
* @property {bigint} succeededProposalCount - Count for succeeded proposals.
|
|
464
|
+
* @property {bigint} failedProposalCount - Count for rejected proposals.
|
|
465
|
+
* @property {bigint} canceledProposalCount - Count for canceled proposals.
|
|
466
|
+
* @property {bigint} proposalWanMultiplierCount - Count of multipliers for proposer and partner .
|
|
467
|
+
* @property {bigint} votingWanMultiplierCount - Count of multipliers for voter.
|
|
468
|
+
*/
|
|
469
|
+
interface BaseParametersReturnType {
|
|
470
|
+
allProposalWanAmount: bigint;
|
|
471
|
+
allProposalLockingWanAmount: bigint;
|
|
472
|
+
allProposalBurnedWanAmount: bigint;
|
|
473
|
+
ethTransferGasLimit: bigint;
|
|
474
|
+
minParticipationAmount: bigint;
|
|
475
|
+
requestWanMultiplier: bigint;
|
|
476
|
+
succeedThreshold: bigint;
|
|
477
|
+
requireXpAmount: bigint;
|
|
478
|
+
pledgeLockDuration: bigint;
|
|
479
|
+
fundraisingDuration: bigint;
|
|
480
|
+
voteDuration: bigint;
|
|
481
|
+
xp: Address;
|
|
482
|
+
stakingManager: Address;
|
|
483
|
+
wanTreasury: Address;
|
|
484
|
+
burnAddr: Address;
|
|
485
|
+
proposalCount: bigint;
|
|
486
|
+
reviewPendingProposalCount: bigint;
|
|
487
|
+
prospectiveProposalCount: bigint;
|
|
488
|
+
votingProposalCount: bigint;
|
|
489
|
+
succeededProposalCount: bigint;
|
|
490
|
+
failedProposalCount: bigint;
|
|
491
|
+
canceledProposalCount: bigint;
|
|
492
|
+
proposalWanMultiplierCount: bigint;
|
|
493
|
+
votingWanMultiplierCount: bigint;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* RecentProposalsParam: Recent proposals parameter
|
|
497
|
+
*/
|
|
498
|
+
interface RecentProposalsParam {
|
|
499
|
+
/**
|
|
500
|
+
* The start index to query recent proposals, it is the recent index
|
|
501
|
+
* @type {number}
|
|
502
|
+
*/
|
|
503
|
+
start: number;
|
|
504
|
+
/**
|
|
505
|
+
* The max count of proposals
|
|
506
|
+
* @type {number}
|
|
507
|
+
*/
|
|
508
|
+
limit: number;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* GetRecentProposalsResult: Return recent reviewed proposals: state shoud be in [Fundraising, VotingInProgress, Succeeded, Rejected]
|
|
512
|
+
*/
|
|
513
|
+
interface GetRecentProposalsResult {
|
|
514
|
+
/**
|
|
515
|
+
* The proposal array obtained this time is sorted by index from large to small (that is, the latest first)
|
|
516
|
+
* @type {ProposalInfo[]}
|
|
517
|
+
*/
|
|
518
|
+
proposals: ProposalInfo[];
|
|
519
|
+
/**
|
|
520
|
+
* The starting index of the next request
|
|
521
|
+
* @type {number}
|
|
522
|
+
*/
|
|
523
|
+
nextIndex: number;
|
|
524
|
+
}
|
|
135
525
|
//#endregion
|
|
136
526
|
//#region src/abis/WanGovernor.d.ts
|
|
137
527
|
declare const ABI: readonly [{
|
|
@@ -2516,41 +2906,69 @@ declare const ABI: readonly [{
|
|
|
2516
2906
|
}];
|
|
2517
2907
|
//#endregion
|
|
2518
2908
|
//#region src/governance.d.ts
|
|
2909
|
+
/**
|
|
2910
|
+
* Wanchain governance
|
|
2911
|
+
* @remarks Providing creation, cancellation, review, contribute, voting, query, etc. proposal API
|
|
2912
|
+
*/
|
|
2913
|
+
/**
|
|
2914
|
+
* Governance Core Class: Encapsulates Viem's PublicClient and Wanchain governance contract address management
|
|
2915
|
+
* @class SDK
|
|
2916
|
+
* @template TAbi - Contract ABI type, the built-in GOVERNANCE_ABI constant is used by default
|
|
2917
|
+
* @param {Address} governanceAddr - Wanchain governance contract address
|
|
2918
|
+
* @param {Chain} chain - Block chain from Viem's chains(such as wanchain, wanchainTestnet)
|
|
2919
|
+
* @param {string} [rpcUrl] - Optional custom RPC; if not provided, the chain's default RPC is used.
|
|
2920
|
+
* @example
|
|
2921
|
+
* const sdk = new Governance('0x123...', wanchain);
|
|
2922
|
+
* console.log(sdk.governanceAddr); // '0x123...'
|
|
2923
|
+
*/
|
|
2519
2924
|
declare class Governance<TAbi extends Abi = typeof ABI> {
|
|
2925
|
+
readonly publicClient: PublicClient;
|
|
2926
|
+
readonly governanceAddr: Address;
|
|
2927
|
+
readonly governanceAbi: Abi;
|
|
2520
2928
|
constructor(governanceAddr: Address, chain?: Chain, rpcUrl?: string);
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
failedProposalCount: bigint;
|
|
2543
|
-
canceledProposalCount: bigint;
|
|
2544
|
-
proposalWanMultiplierCount: bigint;
|
|
2545
|
-
votingWanMultiplierCount: bigint;
|
|
2546
|
-
}>;
|
|
2929
|
+
/**
|
|
2930
|
+
* Get the basic parameters(return JSON object)
|
|
2931
|
+
* @returns {Promise<BaseParametersReturnType>}
|
|
2932
|
+
* @example
|
|
2933
|
+
* const ret = await sdk.getBaseParameters();
|
|
2934
|
+
* console.log(ret);
|
|
2935
|
+
*/
|
|
2936
|
+
getBaseParameters(): Promise<BaseParametersReturnType>;
|
|
2937
|
+
/**
|
|
2938
|
+
* Get the basic parameters(return JSON object)
|
|
2939
|
+
* @param options - Optional parameters
|
|
2940
|
+
* @param options.proposalWanMultiplier - Index range of proposal WAN multipliers
|
|
2941
|
+
* @param options.votingWanMultiplier - Index range of voter WAN multipliers
|
|
2942
|
+
* @returns {Promise<{
|
|
2943
|
+
proposalWanMultipliers: PlegeMultiplierReturn[] | []
|
|
2944
|
+
votingWanMultipliers: PlegeMultiplierReturn[] | []
|
|
2945
|
+
}>}
|
|
2946
|
+
* @example
|
|
2947
|
+
* const ret = await sdk.getProposalMultipliers({proposalWanMultiplier:{start: 0, end: 0}, votingWanMultiplier:{start: 0, end: 0}});
|
|
2948
|
+
* console.log(ret);
|
|
2949
|
+
*/
|
|
2547
2950
|
getProposalMultipliers(options: {
|
|
2548
2951
|
proposalWanMultiplier: IndexRange | undefined;
|
|
2549
2952
|
votingWanMultiplier: IndexRange | undefined;
|
|
2550
2953
|
}): Promise<{
|
|
2551
|
-
proposalWanMultipliers: [
|
|
2552
|
-
votingWanMultipliers: [
|
|
2954
|
+
proposalWanMultipliers: PlegeMultiplierReturn[] | [];
|
|
2955
|
+
votingWanMultipliers: PlegeMultiplierReturn[] | [];
|
|
2553
2956
|
}>;
|
|
2957
|
+
/**
|
|
2958
|
+
* Get proposal counts for all, recviewPending, prospective, voting, succeeded, failed and canceled proposal
|
|
2959
|
+
* @returns {Promise<{
|
|
2960
|
+
allProposalCount: bigint
|
|
2961
|
+
reviewPendingProposalCount: bigint
|
|
2962
|
+
prospectiveProposalCount: bigint
|
|
2963
|
+
votingProposalCount: bigint
|
|
2964
|
+
succeededProposalCount: bigint
|
|
2965
|
+
failedProposalCount: bigint
|
|
2966
|
+
canceledProposalCount: bigint
|
|
2967
|
+
}>}
|
|
2968
|
+
* @example
|
|
2969
|
+
* const ret = await sdk.getProposalCounts();
|
|
2970
|
+
* console.log(ret);
|
|
2971
|
+
*/
|
|
2554
2972
|
getProposalCounts(): Promise<{
|
|
2555
2973
|
allProposalCount: bigint;
|
|
2556
2974
|
reviewPendingProposalCount: bigint;
|
|
@@ -2560,59 +2978,593 @@ declare class Governance<TAbi extends Abi = typeof ABI> {
|
|
|
2560
2978
|
failedProposalCount: bigint;
|
|
2561
2979
|
canceledProposalCount: bigint;
|
|
2562
2980
|
}>;
|
|
2981
|
+
/**
|
|
2982
|
+
* Get active proposal counts by category
|
|
2983
|
+
* @returns {Promise<{
|
|
2984
|
+
fundingProposalCount: bigint
|
|
2985
|
+
technicalProposalCount: bigint
|
|
2986
|
+
}>}
|
|
2987
|
+
* @example
|
|
2988
|
+
* const ret = await sdk.getActiveProposalCategoryCounts();
|
|
2989
|
+
* console.log(ret);
|
|
2990
|
+
*/
|
|
2563
2991
|
getActiveProposalCategoryCounts(): Promise<{
|
|
2564
2992
|
fundingProposalCount: bigint;
|
|
2565
2993
|
technicalProposalCount: bigint;
|
|
2566
2994
|
}>;
|
|
2567
|
-
|
|
2995
|
+
/**
|
|
2996
|
+
* Get prospective + active proposal counts by category
|
|
2997
|
+
* @returns {Promise<{
|
|
2998
|
+
fundingProposalCount: bigint
|
|
2999
|
+
technicalProposalCount: bigint
|
|
3000
|
+
}>}
|
|
3001
|
+
* @example
|
|
3002
|
+
* const ret = await sdk.getParticipableProposalCategoryCounts();
|
|
3003
|
+
* console.log(ret);
|
|
3004
|
+
*/
|
|
3005
|
+
getParticipableProposalCategoryCounts(): Promise<{
|
|
3006
|
+
fundingProposalCount: bigint;
|
|
3007
|
+
technicalProposalCount: bigint;
|
|
3008
|
+
}>;
|
|
3009
|
+
/**
|
|
3010
|
+
* Get WAN and XP balance for identified account
|
|
3011
|
+
* @returns {Promise<{
|
|
3012
|
+
ethBalance: bigint
|
|
3013
|
+
xpBalance: bigint
|
|
3014
|
+
}>}
|
|
3015
|
+
* @example
|
|
3016
|
+
* const xpAddress = '0x123...';
|
|
3017
|
+
* const account = '0x456...';
|
|
3018
|
+
* const ret = await sdk.getAssetBalances(xpAddress, account);
|
|
3019
|
+
* console.log(ret);
|
|
3020
|
+
*/
|
|
3021
|
+
getAssetBalances(xpAddress: Address, account: Address): Promise<{
|
|
2568
3022
|
ethBalance: bigint;
|
|
2569
3023
|
xpBalance: bigint;
|
|
2570
3024
|
}>;
|
|
3025
|
+
/**
|
|
3026
|
+
* Get counts proposal count for identified account
|
|
3027
|
+
* @param {Address} account - Account to be queried
|
|
3028
|
+
* @returns {Promise<{
|
|
3029
|
+
proposerProposalCount: bigint,
|
|
3030
|
+
partnerProposalCount: bigint,
|
|
3031
|
+
voterProposalCount: bigint,
|
|
3032
|
+
}>}
|
|
3033
|
+
* @example
|
|
3034
|
+
* const account = '0x456...';
|
|
3035
|
+
* const ret = await sdk.getAccountProposalCount(account);
|
|
3036
|
+
* console.log(ret);
|
|
3037
|
+
*/
|
|
2571
3038
|
getAccountProposalCount(account: Address): Promise<{
|
|
2572
3039
|
proposerProposalCount: bigint;
|
|
2573
3040
|
partnerProposalCount: bigint;
|
|
2574
3041
|
voterProposalCount: bigint;
|
|
2575
3042
|
}>;
|
|
2576
|
-
|
|
3043
|
+
/**
|
|
3044
|
+
* Get fouondations
|
|
3045
|
+
* @returns {Promise<readonly Address[]>} - Array of foundations
|
|
3046
|
+
* @example
|
|
3047
|
+
* const ret = await sdk.getFoundations(account);
|
|
3048
|
+
* console.log(ret);
|
|
3049
|
+
*/
|
|
3050
|
+
getFoundations(): Promise<readonly Address[]>;
|
|
3051
|
+
/**
|
|
3052
|
+
* Caculate proposal ID
|
|
3053
|
+
* @param {Address} account - Account of proposer
|
|
3054
|
+
* @param {bigint} requestWanAmount - Amount of WAN's requested for proposal
|
|
3055
|
+
* @param {ProposalCategory} category - Category of proposal
|
|
3056
|
+
* @param {PledgeType} pledgeType - PledgeType of proposal for proposer
|
|
3057
|
+
* @param {Hex} description - Description of proposal
|
|
3058
|
+
* @returns {Promise<Hex>} - ID of proposal
|
|
3059
|
+
* @example
|
|
3060
|
+
* const account = '0x456...';
|
|
3061
|
+
* const requestWanAmount = 100n;
|
|
3062
|
+
* const category = ProposalCategory.ProposalCategory;
|
|
3063
|
+
* const pledgeType = PledgeType.Burn;
|
|
3064
|
+
* const description = 'request';
|
|
3065
|
+
* const ret = await sdk.getAccountProposalId(account, requestWanAmount, category, pledgeType, description);
|
|
3066
|
+
* console.log(ret);
|
|
3067
|
+
*/
|
|
2577
3068
|
getAccountProposalId(account: Address, requestWanAmount: bigint, category: ProposalCategory, pledgeType: PledgeType, description: Hex): Promise<Hex>;
|
|
2578
|
-
|
|
3069
|
+
/**
|
|
3070
|
+
* Get counts for the proposal partners and voteres
|
|
3071
|
+
* @param {Hex} proposalId - ID of propsal
|
|
3072
|
+
* @returns {Promise<{
|
|
3073
|
+
partnerCount: bigint,
|
|
3074
|
+
voterCount: bigint
|
|
3075
|
+
}>}
|
|
3076
|
+
* @example
|
|
3077
|
+
* const proposalId = '0x456...';
|
|
3078
|
+
* const ret = await sdk.getProposalPartnerAndVoterCounts(proposalId);
|
|
3079
|
+
* console.log(ret);
|
|
3080
|
+
*/
|
|
3081
|
+
getProposalPartnerAndVoterCounts(proposalId: Hex): Promise<{
|
|
3082
|
+
partnerCount: bigint;
|
|
3083
|
+
voterCount: bigint;
|
|
3084
|
+
}>;
|
|
3085
|
+
/**
|
|
3086
|
+
* Get multi-proposasl info of proposer
|
|
3087
|
+
* @param {Address} proposerAddr - Proposer address
|
|
3088
|
+
* @param {IndexRange} indexRange - Range of index
|
|
3089
|
+
* @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
|
|
3090
|
+
* @example
|
|
3091
|
+
* const proposerAddr = '0x456...';
|
|
3092
|
+
* const indexRange = {start:0, end: 1};
|
|
3093
|
+
* const ret = await sdk.getProposerProposals(proposerAddr, indexRange);
|
|
3094
|
+
* console.log(ret);
|
|
3095
|
+
*/
|
|
2579
3096
|
getProposerProposals(proposerAddr: Address, indexRange: IndexRange): Promise<ProposalInfo[]>;
|
|
3097
|
+
/**
|
|
3098
|
+
* Get multi-proposasl info of partner
|
|
3099
|
+
* @param {Address} partnerAddr - Partner address
|
|
3100
|
+
* @param {IndexRange} indexRange - Range of index
|
|
3101
|
+
* @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
|
|
3102
|
+
* @example
|
|
3103
|
+
* const partnerAddr = '0x456...';
|
|
3104
|
+
* const indexRange = {start:0, end: 1};
|
|
3105
|
+
* const ret = await sdk.getPartnerProposals(partnerAddr, indexRange);
|
|
3106
|
+
* console.log(ret);
|
|
3107
|
+
*/
|
|
2580
3108
|
getPartnerProposals(partnerAddr: Address, indexRange: IndexRange): Promise<{
|
|
2581
3109
|
proposalInfo: ProposalInfo;
|
|
2582
3110
|
partnerInfo: PartnerInfo;
|
|
2583
3111
|
}[]>;
|
|
3112
|
+
/**
|
|
3113
|
+
* Get multi-proposasl info of voter
|
|
3114
|
+
* @param {Address} voterAddr - Voter address
|
|
3115
|
+
* @param {IndexRange} indexRange - Range of index
|
|
3116
|
+
* @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
|
|
3117
|
+
* @example
|
|
3118
|
+
* const voterAddr = '0x456...';
|
|
3119
|
+
* const indexRange = {start:0, end: 1};
|
|
3120
|
+
* const ret = await sdk.getPartnerProposals(voterAddr, indexRange);
|
|
3121
|
+
* console.log(ret);
|
|
3122
|
+
*/
|
|
2584
3123
|
getVoterProposals(voterAddr: Address, indexRange: IndexRange): Promise<{
|
|
2585
3124
|
proposalInfo: ProposalInfo;
|
|
2586
3125
|
voterInfo: VoterInfo;
|
|
2587
3126
|
}[]>;
|
|
3127
|
+
/**
|
|
3128
|
+
* Get multi-info of partner
|
|
3129
|
+
* @param {Address} partnerAddr - Partner address
|
|
3130
|
+
* @param {Hex[]} proposalIds - IDs of proposal
|
|
3131
|
+
* @returns {Promise<PartnerInfo[]>} - Multi-info of partner
|
|
3132
|
+
* @example
|
|
3133
|
+
* const partnerAddr = '0x456...';
|
|
3134
|
+
* const proposalIds = ['0x1...','[0x2...]];
|
|
3135
|
+
* const ret = await sdk.getPartnerInfo(partnerAddr, proposalIds);
|
|
3136
|
+
* console.log(ret);
|
|
3137
|
+
*/
|
|
2588
3138
|
getPartnerInfo(partnerAddr: Address, proposalIds: Hex[]): Promise<PartnerInfo[]>;
|
|
3139
|
+
/**
|
|
3140
|
+
* Get multi-info of voter
|
|
3141
|
+
* @param {Address} voterAddr - Voter address
|
|
3142
|
+
* @param {Hex[]} proposalIds - IDs of proposal
|
|
3143
|
+
* @returns {Promise<PartnerInfo[]>} - Multi-info of voter
|
|
3144
|
+
* @example
|
|
3145
|
+
* const voterAddr = '0x456...';
|
|
3146
|
+
* const proposalIds = ['0x1...','[0x2...]];
|
|
3147
|
+
* const ret = await sdk.getVoterInfo(voterAddr, proposalIds);
|
|
3148
|
+
* console.log(ret);
|
|
3149
|
+
*/
|
|
2589
3150
|
getVoterInfo(voterAddr: Address, proposalIds: Hex[]): Promise<VoterInfo[]>;
|
|
2590
|
-
|
|
3151
|
+
/**
|
|
3152
|
+
* Get recent reviewed proposals
|
|
3153
|
+
* @param {RecentProposalsParam} param - Recent proposal parameters
|
|
3154
|
+
* @returns {Promise<GetRecentProposalsResult>} - Multi-info of proposal and next index
|
|
3155
|
+
* @example
|
|
3156
|
+
* const param = {start:5, limit: 6}; // index 5-0
|
|
3157
|
+
* const ret = await sdk.getRecentReviewedProposals(param);
|
|
3158
|
+
* console.log(ret);
|
|
3159
|
+
*/
|
|
3160
|
+
getRecentReviewedProposals(param: RecentProposalsParam): Promise<GetRecentProposalsResult>;
|
|
3161
|
+
/**
|
|
3162
|
+
* Get review pending proposals
|
|
3163
|
+
* @param {IndexRange} indexRange - Range of index
|
|
3164
|
+
* @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
|
|
3165
|
+
* @example
|
|
3166
|
+
* const indexRange = {start:0, end: 5};
|
|
3167
|
+
* const ret = await sdk.getReviewPendingProposals(indexRange);
|
|
3168
|
+
* console.log(ret);
|
|
3169
|
+
*/
|
|
3170
|
+
getReviewPendingProposals(indexRange: IndexRange): Promise<ProposalInfo[]>;
|
|
3171
|
+
/**
|
|
3172
|
+
* Get recent review pending proposals
|
|
3173
|
+
* @param {RecentProposalsParam} param - Recent proposal parameters
|
|
3174
|
+
* @returns {Promise<GetRecentProposalsResult>} - Multi-info of proposal and next index
|
|
3175
|
+
* @example
|
|
3176
|
+
* const param = {start:5, limit: 6}; // index 5-0
|
|
3177
|
+
* const ret = await sdk.getRecentReviewPendingProposals(param);
|
|
3178
|
+
* console.log(ret);
|
|
3179
|
+
*/
|
|
3180
|
+
getRecentReviewPendingProposals(param: RecentProposalsParam): Promise<GetRecentProposalsResult>;
|
|
3181
|
+
/**
|
|
3182
|
+
* Get prospective proposals
|
|
3183
|
+
* @param {IndexRange} indexRange - Range of index
|
|
3184
|
+
* @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
|
|
3185
|
+
* @example
|
|
3186
|
+
* const indexRange = {start:0, end: 5};
|
|
3187
|
+
* const ret = await sdk.getProspectiveProposals(indexRange);
|
|
3188
|
+
* console.log(ret);
|
|
3189
|
+
*/
|
|
2591
3190
|
getProspectiveProposals(indexRange: IndexRange): Promise<ProposalInfo[]>;
|
|
3191
|
+
/**
|
|
3192
|
+
* Get recent prospective proposals
|
|
3193
|
+
* @param {RecentProposalsParam} param - Recent proposal parameters
|
|
3194
|
+
* @returns {Promise<GetRecentProposalsResult>} - Multi-info of proposal and next index
|
|
3195
|
+
* @example
|
|
3196
|
+
* const param = {start:5, limit: 6}; // index 5-0
|
|
3197
|
+
* const ret = await sdk.getRecentProspectiveProposals(param);
|
|
3198
|
+
* console.log(ret);
|
|
3199
|
+
*/
|
|
3200
|
+
getRecentProspectiveProposals(param: RecentProposalsParam): Promise<GetRecentProposalsResult>;
|
|
3201
|
+
/**
|
|
3202
|
+
* Get active(voting) proposals
|
|
3203
|
+
* @param {IndexRange} indexRange - Range of index
|
|
3204
|
+
* @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
|
|
3205
|
+
* @example
|
|
3206
|
+
* const indexRange = {start:0, end: 5};
|
|
3207
|
+
* const ret = await sdk.getVotingProposals(indexRange);
|
|
3208
|
+
* console.log(ret);
|
|
3209
|
+
*/
|
|
2592
3210
|
getVotingProposals(indexRange: IndexRange): Promise<ProposalInfo[]>;
|
|
3211
|
+
/**
|
|
3212
|
+
* Get recent active(voting) proposals
|
|
3213
|
+
* @param {RecentProposalsParam} param - Recent proposal parameters
|
|
3214
|
+
* @returns {Promise<GetRecentProposalsResult>} - Multi-info of proposal and next index
|
|
3215
|
+
* @example
|
|
3216
|
+
* const param = {start:5, limit: 6}; // index 5-0
|
|
3217
|
+
* const ret = await sdk.getRecentVotingProposals(param);
|
|
3218
|
+
* console.log(ret);
|
|
3219
|
+
*/
|
|
3220
|
+
getRecentVotingProposals(param: RecentProposalsParam): Promise<GetRecentProposalsResult>;
|
|
3221
|
+
/**
|
|
3222
|
+
* Get succeed proposals
|
|
3223
|
+
* @param {IndexRange} indexRange - Range of index
|
|
3224
|
+
* @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
|
|
3225
|
+
* @example
|
|
3226
|
+
* const indexRange = {start:0, end: 5};
|
|
3227
|
+
* const ret = await sdk.getSucceedProposals(indexRange);
|
|
3228
|
+
* console.log(ret);
|
|
3229
|
+
*/
|
|
2593
3230
|
getSucceedProposals(indexRange: IndexRange): Promise<ProposalInfo[]>;
|
|
3231
|
+
/**
|
|
3232
|
+
* Get recent succeeded proposals
|
|
3233
|
+
* @param {RecentProposalsParam} param - Recent proposal parameters
|
|
3234
|
+
* @returns {Promise<GetRecentProposalsResult>} - Multi-info of proposal and next index
|
|
3235
|
+
* @example
|
|
3236
|
+
* const param = {start:5, limit: 6}; // index 5-0
|
|
3237
|
+
* const ret = await sdk.getRecentSucceededProposals(param);
|
|
3238
|
+
* console.log(ret);
|
|
3239
|
+
*/
|
|
3240
|
+
getRecentSucceededProposals(param: RecentProposalsParam): Promise<GetRecentProposalsResult>;
|
|
3241
|
+
/**
|
|
3242
|
+
* Get failed proposals
|
|
3243
|
+
* @param {IndexRange} indexRange - Range of index
|
|
3244
|
+
* @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
|
|
3245
|
+
* @example
|
|
3246
|
+
* const indexRange = {start:0, end: 5};
|
|
3247
|
+
* const ret = await sdk.getFailedProposals(indexRange);
|
|
3248
|
+
* console.log(ret);
|
|
3249
|
+
*/
|
|
2594
3250
|
getFailedProposals(indexRange: IndexRange): Promise<ProposalInfo[]>;
|
|
3251
|
+
/**
|
|
3252
|
+
* Get recent rejected proposals
|
|
3253
|
+
* @param {RecentProposalsParam} param - Recent proposal parameters
|
|
3254
|
+
* @returns {Promise<GetRecentProposalsResult>} - Multi-info of proposal and next index
|
|
3255
|
+
* @example
|
|
3256
|
+
* const param = {start:5, limit: 6}; // index 5-0
|
|
3257
|
+
* const ret = await sdk.getRecentRejectedProposals(param);
|
|
3258
|
+
* console.log(ret);
|
|
3259
|
+
*/
|
|
3260
|
+
getRecentRejectedProposals(param: RecentProposalsParam): Promise<GetRecentProposalsResult>;
|
|
3261
|
+
/**
|
|
3262
|
+
* Get canceled proposals
|
|
3263
|
+
* @param {IndexRange} indexRange - Range of index
|
|
3264
|
+
* @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
|
|
3265
|
+
* @example
|
|
3266
|
+
* const indexRange = {start:0, end: 5};
|
|
3267
|
+
* const ret = await sdk.getCanceledProposals(indexRange);
|
|
3268
|
+
* console.log(ret);
|
|
3269
|
+
*/
|
|
3270
|
+
getCanceledProposals(indexRange: IndexRange): Promise<ProposalInfo[]>;
|
|
3271
|
+
/**
|
|
3272
|
+
* Get recent canceled proposals
|
|
3273
|
+
* @param {RecentProposalsParam} param - Recent proposal parameters
|
|
3274
|
+
* @returns {Promise<GetRecentProposalsResult>} - Multi-info of proposal and next index
|
|
3275
|
+
* @example
|
|
3276
|
+
* const param = {start:5, limit: 6}; // index 5-0
|
|
3277
|
+
* const ret = await sdk.getRecentCanceledProposals(param);
|
|
3278
|
+
* console.log(ret);
|
|
3279
|
+
*/
|
|
3280
|
+
getRecentCanceledProposals(param: RecentProposalsParam): Promise<GetRecentProposalsResult>;
|
|
3281
|
+
/**
|
|
3282
|
+
* Get specified proposal info
|
|
3283
|
+
* @param {Hex} proposalId - ID of proposal
|
|
3284
|
+
* @returns {Promise<ProposalInfo>} - Proposal info
|
|
3285
|
+
* @example
|
|
3286
|
+
* const proposalId = '0x12...';
|
|
3287
|
+
* const ret = await sdk.getProposalInfo(proposalId);
|
|
3288
|
+
* console.log(ret);
|
|
3289
|
+
*/
|
|
2595
3290
|
getProposalInfo(proposalId: Hex): Promise<ProposalInfo>;
|
|
3291
|
+
/**
|
|
3292
|
+
* Check whether need or can request proposal withdrawal
|
|
3293
|
+
* @param {bigint} timestamp - Timestamp of latest block
|
|
3294
|
+
* @param {CanRequestProposalWithdrawalParam[]} params - Parameters
|
|
3295
|
+
* @returns {Promise<CanRequestProposalWithdrawalRetrunItem[]>} - Array of {needRequestWithdrawal, canRequestWithdrawal}
|
|
3296
|
+
* @example
|
|
3297
|
+
* var proposalId = '0x12...';
|
|
3298
|
+
* var proposalInfo = await sdk.getProposalInfo(proposalId);
|
|
3299
|
+
* var latestBlock = await sdk.publicClient.getBlock();
|
|
3300
|
+
* var [{needRequestWithdrawal, canRequestWithdrawal}] = sdk.canRequestProposalWithdrawal(latestBlock.timestamp, [
|
|
3301
|
+
{
|
|
3302
|
+
state: proposalInfo.state,
|
|
3303
|
+
pledgeType: proposalInfo.proposerFundInfo.pledgeType,
|
|
3304
|
+
lockDuration: proposalInfo.proposerFundInfo.lockDuration,
|
|
3305
|
+
voteDeadline: proposalInfo.voteDeadline,
|
|
3306
|
+
requestId: proposalInfo.proposerFundInfo.requestId,
|
|
3307
|
+
exited: proposalInfo.proposerFundInfo.exited,
|
|
3308
|
+
}
|
|
3309
|
+
]);
|
|
3310
|
+
*/
|
|
2596
3311
|
canRequestProposalWithdrawal(timestamp: bigint, params: CanRequestProposalWithdrawalParam[]): CanRequestProposalWithdrawalRetrunItem[];
|
|
3312
|
+
/**
|
|
3313
|
+
* Check whether can claim proposal withdrawal or not
|
|
3314
|
+
* @param {Address} stakingManagerAddr - Address of stakingManager
|
|
3315
|
+
* @param {bigint} timestamp - Timestamp of latest block
|
|
3316
|
+
* @param {CanClaimProposalWithdrawalParam[]} params - Parameters
|
|
3317
|
+
* @returns {Promise<boolean[]>} - Array of boolean
|
|
3318
|
+
* @example
|
|
3319
|
+
* var stakingManagerAddr = '0x34...';
|
|
3320
|
+
* var proposalId = '0x12...';
|
|
3321
|
+
* var proposalInfo = await sdk.getProposalInfo(proposalId);
|
|
3322
|
+
* var latestBlock = await sdk.publicClient.getBlock();
|
|
3323
|
+
* var ret = sdk.canClaimProposalWithdrawal(stakingManagerAddr, latestBlock.timestamp, [
|
|
3324
|
+
{
|
|
3325
|
+
state: proposalInfo.state,
|
|
3326
|
+
pledgeType: proposalInfo.proposerFundInfo.pledgeType,
|
|
3327
|
+
lockDuration: proposalInfo.proposerFundInfo.lockDuration,
|
|
3328
|
+
voteDeadline: proposalInfo.voteDeadline,
|
|
3329
|
+
requestId: proposalInfo.proposerFundInfo.requestId,
|
|
3330
|
+
exited: proposalInfo.proposerFundInfo.exited,
|
|
3331
|
+
}
|
|
3332
|
+
]);
|
|
3333
|
+
* console.log(ret);
|
|
3334
|
+
*/
|
|
2597
3335
|
canClaimProposalWithdrawal(stakingManagerAddr: Address, timestamp: bigint, params: CanClaimProposalWithdrawalParam[]): Promise<boolean[]>;
|
|
2598
|
-
|
|
3336
|
+
/**
|
|
3337
|
+
* Get unstake status after request proposal withdrawal
|
|
3338
|
+
* @param {Address} stakingManagerAddr - Address of stakingManager
|
|
3339
|
+
* @param {bigint} requestId - ID of proposal request withdrawal to be queried for proposer, partner or voter.
|
|
3340
|
+
* @returns {Promise<UnstakeStatus>} - Status of unstake
|
|
3341
|
+
* @example
|
|
3342
|
+
* var stakingManagerAddr = '0x34...';
|
|
3343
|
+
* var proposalId = '0x12...';
|
|
3344
|
+
* var proposalInfo = await sdk.getProposalInfo(proposalId);
|
|
3345
|
+
* var ret = sdk.getUnstakeStatus(stakingManagerAddr, proposalInfo.proposerFundInfo.requestId);
|
|
3346
|
+
* console.log(ret);
|
|
3347
|
+
*/
|
|
3348
|
+
getUnstakeStatus(stakingManagerAddr: Address, requestId: bigint): Promise<UnstakeStatus>;
|
|
3349
|
+
/**
|
|
3350
|
+
* Build transaction
|
|
3351
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3352
|
+
* @param {ContractFunctionName} functionName - Function name
|
|
3353
|
+
* @param {ContractFunctionArgs} args - Parameters
|
|
3354
|
+
* @param {bigint} value - Amount of WAN
|
|
3355
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3356
|
+
* @example
|
|
3357
|
+
* const functionName = 'cancelProposal' as ContractFunctionName<TAbi, 'nonpayable' | 'payable'>;
|
|
3358
|
+
* const args = [proposalId, reason] as ContractFunctionArgs<TAbi, 'nonpayable' | 'payable'>;
|
|
3359
|
+
* const ret = await sdk.buildTx(account, functionName, args, BigInt(0));
|
|
3360
|
+
* console.log(ret);
|
|
3361
|
+
*/
|
|
2599
3362
|
buildTx<TFunctionName extends ContractFunctionName<TAbi, 'nonpayable' | 'payable'>>(account: Account | Address, functionName: TFunctionName, args: ContractFunctionArgs<TAbi, 'nonpayable' | 'payable', TFunctionName>, value?: bigint): Promise<PrepareTransactionRequestReturnType>;
|
|
2600
|
-
|
|
3363
|
+
/**
|
|
3364
|
+
* Build createProposal transaction
|
|
3365
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3366
|
+
* @param {bigint} pledgeWanAmount - Amount of WAN that proposer pledged
|
|
3367
|
+
* @param {bigint} requestWanAmount - Amount of WAN that proposer request.
|
|
3368
|
+
* @param {ProposalCategory} category - Category of proposal
|
|
3369
|
+
* @param {PledgeType} pledgeType - Pledge type
|
|
3370
|
+
* @param {Hex} description - Description of proposal
|
|
3371
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3372
|
+
* @example
|
|
3373
|
+
* const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
|
|
3374
|
+
* const pledgeWanAmount = parseEther("1");
|
|
3375
|
+
* const requestWanAmount = parseEther("100");
|
|
3376
|
+
* const category = ProposalCategory.Funding;
|
|
3377
|
+
* const pledgeType = PledgeType.Lock;
|
|
3378
|
+
* const ret = await sdk.buildCreateProposalTx(walletClient.account!, pledgeWanAmount, requestWanAmount, category, pledgeType, description);
|
|
3379
|
+
* console.log(ret);
|
|
3380
|
+
*/
|
|
2601
3381
|
buildCreateProposalTx(account: Address | Account, pledgeWanAmount: bigint, requestWanAmount: bigint, category: ProposalCategory, pledgeType: PledgeType, description: Hex): Promise<PrepareTransactionRequestReturnType>;
|
|
3382
|
+
/**
|
|
3383
|
+
* Build cancelProposal transaction
|
|
3384
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3385
|
+
* @param {Hex} proposalId - ID of proposal
|
|
3386
|
+
* @param {Hex} reason - Cancel reason.
|
|
3387
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3388
|
+
* @example
|
|
3389
|
+
* const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
|
|
3390
|
+
* const proposalId = '0x12...';
|
|
3391
|
+
* const reason = toHex('cancel');
|
|
3392
|
+
* const ret = await sdk.buildCancelProposalTx(walletClient.account!, proposalId, reason);
|
|
3393
|
+
* console.log(ret);
|
|
3394
|
+
*/
|
|
2602
3395
|
buildCancelProposalTx(account: Address | Account, proposalId: Hex, reason: Hex): Promise<PrepareTransactionRequestReturnType>;
|
|
3396
|
+
/**
|
|
3397
|
+
* Build reviewPoposal transaction
|
|
3398
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3399
|
+
* @param {Hex} proposalId - ID of proposal
|
|
3400
|
+
* @param {boolean} isApproved - For or against.
|
|
3401
|
+
* @param {Hex} reason - Cancel reason.
|
|
3402
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3403
|
+
* @example
|
|
3404
|
+
* const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
|
|
3405
|
+
* const proposalId = '0x12...';
|
|
3406
|
+
* const isApproved = true;
|
|
3407
|
+
* const reason = toHex('greate');
|
|
3408
|
+
* const ret = await sdk.buildReviewProposalTx(walletClient.account!, proposalId, isApproved, reason);
|
|
3409
|
+
* console.log(ret);
|
|
3410
|
+
*/
|
|
2603
3411
|
buildReviewProposalTx(account: Address | Account, proposalId: Hex, isApproved: boolean, reason: Hex): Promise<PrepareTransactionRequestReturnType>;
|
|
3412
|
+
/**
|
|
3413
|
+
* Build contributePoposal transaction
|
|
3414
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3415
|
+
* @param {Hex} proposalId - ID of proposal
|
|
3416
|
+
* @param {bigint} pledgeWanAmount - Amount of WAN that partner pledged
|
|
3417
|
+
* @param {PledgeType} pledgeType - Pledge type
|
|
3418
|
+
* @param {Hex} reason - Reason.
|
|
3419
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3420
|
+
* @example
|
|
3421
|
+
* const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
|
|
3422
|
+
* const proposalId = '0x12...';
|
|
3423
|
+
* const pledgeWanAmount = parseEther("1");
|
|
3424
|
+
* const pledgeType = PledgeType.Lock;
|
|
3425
|
+
* const reason = toHex('support');
|
|
3426
|
+
* const ret = await sdk.buildContributeProposalTx(walletClient.account!, proposalId, pledgeWanAmount, pledgeType, toHex(reason));
|
|
3427
|
+
* console.log(ret);
|
|
3428
|
+
*/
|
|
2604
3429
|
buildContributeProposalTx(account: Address | Account, proposalId: Hex, pledgeWanAmount: bigint, pledgeType: PledgeType, reason: Hex): Promise<PrepareTransactionRequestReturnType>;
|
|
3430
|
+
/**
|
|
3431
|
+
* Build votePoposal transaction
|
|
3432
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3433
|
+
* @param {Hex} proposalId - ID of proposal
|
|
3434
|
+
* @param {bigint} pledgeWanAmount - Amount of WAN that partner pledged
|
|
3435
|
+
* @param {bigint} lockDuration - Lock duration of proposal for voter
|
|
3436
|
+
* @param {PledgeType} pledgeType - Pledge type
|
|
3437
|
+
* @param {VoteType} voteType - Vote type
|
|
3438
|
+
* @param {Hex} reason - Reason.
|
|
3439
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3440
|
+
* @example
|
|
3441
|
+
* const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
|
|
3442
|
+
* const proposalId = '0x12...';
|
|
3443
|
+
* const pledgeWanAmount = parseEther("1");
|
|
3444
|
+
* const lockDuration = 8...;
|
|
3445
|
+
* const pledgeType = PledgeType.Lock;
|
|
3446
|
+
* const voteType = VoteType.For;
|
|
3447
|
+
* const reason = toHex('support');
|
|
3448
|
+
* const ret = await sdk.buildVoteProposalTx(walletClient.account!, proposalId, pledgeWanAmount, lockDuration, pledgeType, voteType, toHex(reason));
|
|
3449
|
+
* console.log(ret);
|
|
3450
|
+
*/
|
|
2605
3451
|
buildVoteProposalTx(account: Address | Account, proposalId: Hex, pledgeWanAmount: bigint, lockDuration: bigint, pledgeType: PledgeType, voteType: VoteType, reason: Hex): Promise<PrepareTransactionRequestReturnType>;
|
|
3452
|
+
/**
|
|
3453
|
+
* Build tallyPoposal transaction
|
|
3454
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3455
|
+
* @param {Hex} proposalId - ID of proposal
|
|
3456
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3457
|
+
* @example
|
|
3458
|
+
* const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
|
|
3459
|
+
* const proposalId = '0x12...';
|
|
3460
|
+
* const ret = await sdk.buildTallyProposalTx(walletClient.account!, proposalId);
|
|
3461
|
+
* console.log(ret);
|
|
3462
|
+
*/
|
|
2606
3463
|
buildTallyProposalTx(account: Address | Account, proposalId: Hex): Promise<PrepareTransactionRequestReturnType>;
|
|
3464
|
+
/**
|
|
3465
|
+
* Build requestProposerWithdrawal transaction
|
|
3466
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3467
|
+
* @param {Hex} proposalId - ID of proposal
|
|
3468
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3469
|
+
* @example
|
|
3470
|
+
* const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
|
|
3471
|
+
* const proposalId = '0x12...';
|
|
3472
|
+
* const ret = await sdk.buildRequestProposerWithdrawalTx(walletClient.account!, proposalId);
|
|
3473
|
+
* console.log(ret);
|
|
3474
|
+
*/
|
|
2607
3475
|
buildRequestProposerWithdrawalTx(account: Address | Account, proposalId: Hex): Promise<PrepareTransactionRequestReturnType>;
|
|
3476
|
+
/**
|
|
3477
|
+
* Build claimProposerWithdrawal transaction
|
|
3478
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3479
|
+
* @param {Hex} proposalId - ID of proposal
|
|
3480
|
+
* @param {bigint} requestId - ID of proposal request withdrawal to be queried
|
|
3481
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3482
|
+
* @example
|
|
3483
|
+
* const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
|
|
3484
|
+
* const proposalId = '0x12...';
|
|
3485
|
+
* const requestId = 34...n;
|
|
3486
|
+
* const ret = await sdk.buildClaimProposerWithdrawalTx(walletClient.account!, proposalId, requestId);
|
|
3487
|
+
* console.log(ret);
|
|
3488
|
+
*/
|
|
2608
3489
|
buildClaimProposerWithdrawalTx(account: Address | Account, proposalId: Hex, requestId: bigint): Promise<PrepareTransactionRequestReturnType>;
|
|
3490
|
+
/**
|
|
3491
|
+
* Build requestPartnerWithdrawal transaction
|
|
3492
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3493
|
+
* @param {Hex} proposalId - ID of proposal
|
|
3494
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3495
|
+
* @example
|
|
3496
|
+
* const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
|
|
3497
|
+
* const proposalId = '0x12...';
|
|
3498
|
+
* const ret = await sdk.buildRequestPartnerWithdrawalTx(walletClient.account!, proposalId);
|
|
3499
|
+
* console.log(ret);
|
|
3500
|
+
*/
|
|
2609
3501
|
buildRequestPartnerWithdrawalTx(account: Address | Account, proposalId: Hex): Promise<PrepareTransactionRequestReturnType>;
|
|
3502
|
+
/**
|
|
3503
|
+
* Build claimPartnerWithdrawal transaction
|
|
3504
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3505
|
+
* @param {Hex} proposalId - ID of proposal
|
|
3506
|
+
* @param {bigint} requestId - ID of proposal request withdrawal to be queried
|
|
3507
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3508
|
+
* @example
|
|
3509
|
+
* const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
|
|
3510
|
+
* const proposalId = '0x12...';
|
|
3511
|
+
* const requestId = 34...n;
|
|
3512
|
+
* const ret = await sdk.buildClaimPartnerWithdrawalTx(walletClient.account!, proposalId, requestId);
|
|
3513
|
+
* console.log(ret);
|
|
3514
|
+
*/
|
|
2610
3515
|
buildClaimPartnerWithdrawalTx(account: Address | Account, proposalId: Hex, requestId: bigint): Promise<PrepareTransactionRequestReturnType>;
|
|
3516
|
+
/**
|
|
3517
|
+
* Build requestVoterWithdrawal transaction
|
|
3518
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3519
|
+
* @param {Hex} proposalId - ID of proposal
|
|
3520
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3521
|
+
* @example
|
|
3522
|
+
* const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
|
|
3523
|
+
* const proposalId = '0x12...';
|
|
3524
|
+
* const ret = await sdk.buildRequestVoterWithdrawalTx(walletClient.account!, proposalId);
|
|
3525
|
+
* console.log(ret);
|
|
3526
|
+
*/
|
|
2611
3527
|
buildRequestVoterWithdrawalTx(account: Address | Account, proposalId: Hex): Promise<PrepareTransactionRequestReturnType>;
|
|
3528
|
+
/**
|
|
3529
|
+
* Build claimVoterWithdrawal transaction
|
|
3530
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3531
|
+
* @param {Hex} proposalId - ID of proposal
|
|
3532
|
+
* @param {bigint} requestId - ID of proposal request withdrawal to be queried
|
|
3533
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3534
|
+
* @example
|
|
3535
|
+
* const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
|
|
3536
|
+
* const proposalId = '0x12...';
|
|
3537
|
+
* const requestId = 34...n;
|
|
3538
|
+
* const ret = await sdk.buildClaimVoterWithdrawalTx(walletClient.account!, proposalId, requestId);
|
|
3539
|
+
* console.log(ret);
|
|
3540
|
+
*/
|
|
2612
3541
|
buildClaimVoterWithdrawalTx(account: Address | Account, proposalId: Hex, requestId: bigint): Promise<PrepareTransactionRequestReturnType>;
|
|
3542
|
+
/**
|
|
3543
|
+
* Build updateFundraisingDuration transaction
|
|
3544
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3545
|
+
* @param {bigint} fundraisingDuration - Fundraising duration
|
|
3546
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3547
|
+
* @example
|
|
3548
|
+
* const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
|
|
3549
|
+
* const fundraisingDuration = 34...n;
|
|
3550
|
+
* const ret = await sdk.buildUpdateFundraisingDurationTx(walletClient.account!, fundraisingDuration);
|
|
3551
|
+
* console.log(ret);
|
|
3552
|
+
*/
|
|
2613
3553
|
buildUpdateFundraisingDurationTx(account: Address | Account, fundraisingDuration: bigint): Promise<PrepareTransactionRequestReturnType>;
|
|
3554
|
+
/**
|
|
3555
|
+
* Build updateMinParticipationAmount transaction
|
|
3556
|
+
* @param {Account | Address} account - Account | Address of sender
|
|
3557
|
+
* @param {bigint} amount - Minimum amount of WANs a participant can participate in proposal
|
|
3558
|
+
* @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
|
|
3559
|
+
* @example
|
|
3560
|
+
* const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
|
|
3561
|
+
* const amount = 34...n;
|
|
3562
|
+
* const ret = await sdk.buildUpdateMinParticipationAmountTx(walletClient.account!, amount);
|
|
3563
|
+
* console.log(ret);
|
|
3564
|
+
*/
|
|
2614
3565
|
buildUpdateMinParticipationAmountTx(account: Address | Account, amount: bigint): Promise<PrepareTransactionRequestReturnType>;
|
|
3566
|
+
private _getRecentProposalsByState;
|
|
2615
3567
|
}
|
|
2616
3568
|
//#endregion
|
|
2617
|
-
export { type CanClaimProposalWithdrawalParam, type CanRequestProposalWithdrawalParam, type CanRequestProposalWithdrawalRetrunItem, type FundInfo, Governance, type IndexRange, type PartnerInfo, PledgeType, type PlegeMultiplierReturn, ProposalCategory, type ProposalInfo, ProposalRole, ProposalState, type Tally, UnstakeStatus, VoteType, type VoterInfo, decodeProposalDescriptionData, encodeProposalDescriptionData, getVersionFromData, supportedProposalDescriptionDataTypeSchema };
|
|
3569
|
+
export { type CanClaimProposalWithdrawalParam, type CanRequestProposalWithdrawalParam, type CanRequestProposalWithdrawalRetrunItem, type FundInfo, Governance, type IndexRange, type PartnerInfo, PledgeType, type PlegeMultiplierReturn, ProposalCategory, ProposalDescriptionData, ProposalDescriptionSchema, type ProposalInfo, ProposalRole, ProposalState, type Tally, UnstakeStatus, ValidVersion, VoteType, type VoterInfo, decodeProposalDescriptionData, encodeProposalDescriptionData, getVersionFromData, supportedProposalDescriptionDataTypeSchema };
|
|
2618
3570
|
//# sourceMappingURL=index.d.mts.map
|