@wandevs/governance-contracts-sdk 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,31 +1,82 @@
1
- import { Abi, Account, Address, Chain, ContractFunctionArgs, ContractFunctionName, EncodeFunctionDataParameters, Hex, PrepareTransactionRequestReturnType } from "viem";
1
+ import { Abi, Account, Address, Chain, ContractFunctionArgs, ContractFunctionName, Hex, PrepareTransactionRequestReturnType, PublicClient } from "viem";
2
2
 
3
3
  //#region src/util.d.ts
4
- declare const supportedProposalDescriptionDataTypeSchema: {
5
- 1: {
6
- types: {
7
- type: string;
8
- }[];
9
- names: string[];
10
- };
11
- 2: {
12
- types: {
13
- type: string;
14
- }[];
15
- names: string[];
16
- };
17
- 3: {
18
- types: {
19
- type: string;
20
- }[];
21
- names: string[];
22
- };
23
- };
24
- declare function encodeProposalDescriptionData(...args: any[]): any;
25
- declare function decodeProposalDescriptionData(hexData: any): {};
26
- declare function getVersionFromData(hexData: any): number;
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,443 @@ 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
- interface ProposalInfo {
82
- proposalId: Hex;
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
- start: bigint;
115
- end: bigint;
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
- pledgeType: PledgeType.Lock;
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
- type CanClaimProposalWithdrawalParam = CanRequestProposalWithdrawalParam;
441
+ /**
442
+ * BaseParametersReturnType: Return type for getBaseParameters.
443
+ */
444
+ interface BaseParametersReturnType {
445
+ /**
446
+ * All reviewed proposal WAN amounts.
447
+ * @type {bigint}
448
+ */
449
+ allProposalWanAmount: bigint;
450
+ /**
451
+ * All locking WAN amounts.
452
+ * @type {bigint}
453
+ */
454
+ allProposalLockingWanAmount: bigint;
455
+ /**
456
+ * All burned WAN amounts.
457
+ * @type {bigint}
458
+ */
459
+ allProposalBurnedWanAmount: bigint;
460
+ /**
461
+ * WAN transfer gaslimit
462
+ * @type {bigint}
463
+ */
464
+ ethTransferGasLimit: bigint;
465
+ /**
466
+ * Minimum amount of WANs a participant can participate in for funding proposal
467
+ * @type {bigint}
468
+ */
469
+ minParticipationAmount: bigint;
470
+ /**
471
+ * Multiplier to request WANs from Wanchain Treasury
472
+ * @type {bigint}
473
+ */
474
+ requestWanMultiplier: bigint;
475
+ /**
476
+ * Threshold to succeed proposal
477
+ * @type {bigint}
478
+ */
479
+ succeedThreshold: bigint;
480
+ /**
481
+ * Proposal creation require amount of XP
482
+ * @type {bigint}
483
+ */
484
+ requireXpAmount: bigint;
485
+ /**
486
+ * Proposer or partner pledge WAN by locking duration
487
+ * @type {bigint}
488
+ */
489
+ pledgeLockDuration: bigint;
490
+ /**
491
+ * Duration for partners to pledge their WAN to help a Prospective Proposal meet the pledge requirements.
492
+ * @type {bigint}
493
+ */
494
+ fundraisingDuration: bigint;
495
+ /**
496
+ * Duration for voters to vote active proposal
497
+ * @type {bigint}
498
+ */
499
+ voteDuration: bigint;
500
+ /**
501
+ * for XP token
502
+ * @type {bigint}
503
+ */
504
+ xp: Address;
505
+ /**
506
+ * Address for StakingManager
507
+ * @type {bigint}
508
+ */
509
+ stakingManager: Address;
510
+ /**
511
+ * Address for Wanchain community treasury
512
+ * @type {bigint}
513
+ */
514
+ wanTreasury: Address;
515
+ /**
516
+ * Address for WAN burned
517
+ * @type {bigint}
518
+ */
519
+ burnAddr: Address;
520
+ /**
521
+ * Count for total proposal: include reviewing proposals, canceled proposals, prospective proposals, active proposals, succeeded proposals and failed proposals
522
+ * @type {bigint}
523
+ */
524
+ proposalCount: bigint;
525
+ /**
526
+ * Count for reviewing proposals
527
+ * @type {bigint}
528
+ */
529
+ reviewPendingProposalCount: bigint;
530
+ /**
531
+ * Count for prospective proposals
532
+ * @type {bigint}
533
+ */
534
+ prospectiveProposalCount: bigint;
535
+ /**
536
+ * Count for active(voting) proposals
537
+ * @type {bigint}
538
+ */
539
+ votingProposalCount: bigint;
540
+ /**
541
+ * Count for succeeded proposals
542
+ * @type {bigint}
543
+ */
544
+ succeededProposalCount: bigint;
545
+ /**
546
+ * Count for rejected proposals
547
+ * @type {bigint}
548
+ */
549
+ failedProposalCount: bigint;
550
+ /**
551
+ * Count for canceled proposals
552
+ * @type {bigint}
553
+ */
554
+ canceledProposalCount: bigint;
555
+ /**
556
+ * Count of multipliers for proposer and partner
557
+ * @type {bigint}
558
+ */
559
+ proposalWanMultiplierCount: bigint;
560
+ /**
561
+ * Count of multipliers for voter
562
+ * @type {bigint}
563
+ */
564
+ votingWanMultiplierCount: bigint;
565
+ }
135
566
  //#endregion
136
567
  //#region src/abis/WanGovernor.d.ts
137
568
  declare const ABI: readonly [{
@@ -2516,41 +2947,69 @@ declare const ABI: readonly [{
2516
2947
  }];
2517
2948
  //#endregion
2518
2949
  //#region src/governance.d.ts
2950
+ /**
2951
+ * Wanchain governance
2952
+ * @remarks Providing creation, cancellation, review, contribute, voting, query, etc. proposal API
2953
+ */
2954
+ /**
2955
+ * Governance Core Class: Encapsulates Viem's PublicClient and Wanchain governance contract address management
2956
+ * @class SDK
2957
+ * @template TAbi - Contract ABI type, the built-in GOVERNANCE_ABI constant is used by default
2958
+ * @param {Address} governanceAddr - Wanchain governance contract address
2959
+ * @param {Chain} chain - Block chain from Viem's chains(such as wanchain, wanchainTestnet)
2960
+ * @param {string} [rpcUrl] - Optional custom RPC; if not provided, the chain's default RPC is used.
2961
+ * @example
2962
+ * const sdk = new Governance('0x123...', wanchain);
2963
+ * console.log(sdk.governanceAddr); // '0x123...'
2964
+ */
2519
2965
  declare class Governance<TAbi extends Abi = typeof ABI> {
2966
+ readonly publicClient: PublicClient;
2967
+ readonly governanceAddr: Address;
2968
+ readonly governanceAbi: Abi;
2520
2969
  constructor(governanceAddr: Address, chain?: Chain, rpcUrl?: string);
2521
- getBaseParameters(): Promise<{
2522
- allProposalWanAmount: bigint;
2523
- allProposalLockingWanAmount: bigint;
2524
- allProposalBurnedWanAmount: bigint;
2525
- ethTransferGasLimit: bigint;
2526
- minParticipationAmount: bigint;
2527
- requestWanMultiplier: bigint;
2528
- succeedThreshold: bigint;
2529
- requireXpAmount: bigint;
2530
- pledgeLockDuration: bigint;
2531
- fundraisingDuration: bigint;
2532
- voteDuration: bigint;
2533
- xp: Address;
2534
- stakingManager: Address;
2535
- wanTreasury: Address;
2536
- burnAddr: Address;
2537
- proposalCount: bigint;
2538
- reviewPendingProposalCount: bigint;
2539
- prospectiveProposalCount: bigint;
2540
- votingProposalCount: bigint;
2541
- succeededProposalCount: bigint;
2542
- failedProposalCount: bigint;
2543
- canceledProposalCount: bigint;
2544
- proposalWanMultiplierCount: bigint;
2545
- votingWanMultiplierCount: bigint;
2546
- }>;
2970
+ /**
2971
+ * Get the basic parameters(return JSON object)
2972
+ * @returns {Promise<BaseParametersReturnType>}
2973
+ * @example
2974
+ * const ret = await sdk.getBaseParameters();
2975
+ * console.log(ret);
2976
+ */
2977
+ getBaseParameters(): Promise<BaseParametersReturnType>;
2978
+ /**
2979
+ * Get the basic parameters(return JSON object)
2980
+ * @param options - Optional parameters
2981
+ * @param options.proposalWanMultiplier - Index range of proposal WAN multipliers
2982
+ * @param options.votingWanMultiplier - Index range of voter WAN multipliers
2983
+ * @returns {Promise<{
2984
+ proposalWanMultipliers: PlegeMultiplierReturn[] | []
2985
+ votingWanMultipliers: PlegeMultiplierReturn[] | []
2986
+ }>}
2987
+ * @example
2988
+ * const ret = await sdk.getProposalMultipliers({proposalWanMultiplier:{start: 0, end: 0}, votingWanMultiplier:{start: 0, end: 0}});
2989
+ * console.log(ret);
2990
+ */
2547
2991
  getProposalMultipliers(options: {
2548
2992
  proposalWanMultiplier: IndexRange | undefined;
2549
2993
  votingWanMultiplier: IndexRange | undefined;
2550
2994
  }): Promise<{
2551
- proposalWanMultipliers: [PlegeMultiplierReturn] | [];
2552
- votingWanMultipliers: [PlegeMultiplierReturn] | [];
2995
+ proposalWanMultipliers: PlegeMultiplierReturn[] | [];
2996
+ votingWanMultipliers: PlegeMultiplierReturn[] | [];
2553
2997
  }>;
2998
+ /**
2999
+ * Get proposal counts for all, recviewPending, prospective, voting, succeeded, failed and canceled proposal
3000
+ * @returns {Promise<{
3001
+ allProposalCount: bigint
3002
+ reviewPendingProposalCount: bigint
3003
+ prospectiveProposalCount: bigint
3004
+ votingProposalCount: bigint
3005
+ succeededProposalCount: bigint
3006
+ failedProposalCount: bigint
3007
+ canceledProposalCount: bigint
3008
+ }>}
3009
+ * @example
3010
+ * const ret = await sdk.getProposalCounts();
3011
+ * console.log(ret);
3012
+ */
2554
3013
  getProposalCounts(): Promise<{
2555
3014
  allProposalCount: bigint;
2556
3015
  reviewPendingProposalCount: bigint;
@@ -2560,59 +3019,522 @@ declare class Governance<TAbi extends Abi = typeof ABI> {
2560
3019
  failedProposalCount: bigint;
2561
3020
  canceledProposalCount: bigint;
2562
3021
  }>;
3022
+ /**
3023
+ * Get active proposal counts by category
3024
+ * @returns {Promise<{
3025
+ fundingProposalCount: bigint
3026
+ technicalProposalCount: bigint
3027
+ }>}
3028
+ * @example
3029
+ * const ret = await sdk.getActiveProposalCategoryCounts();
3030
+ * console.log(ret);
3031
+ */
2563
3032
  getActiveProposalCategoryCounts(): Promise<{
2564
3033
  fundingProposalCount: bigint;
2565
3034
  technicalProposalCount: bigint;
2566
3035
  }>;
2567
- getAssetBalances(xpAddress: Address, userAddress: Address): Promise<{
3036
+ /**
3037
+ * Get prospective + active proposal counts by category
3038
+ * @returns {Promise<{
3039
+ fundingProposalCount: bigint
3040
+ technicalProposalCount: bigint
3041
+ }>}
3042
+ * @example
3043
+ * const ret = await sdk.getParticipableProposalCategoryCounts();
3044
+ * console.log(ret);
3045
+ */
3046
+ getParticipableProposalCategoryCounts(): Promise<{
3047
+ fundingProposalCount: bigint;
3048
+ technicalProposalCount: bigint;
3049
+ }>;
3050
+ /**
3051
+ * Get WAN and XP balance for identified account
3052
+ * @returns {Promise<{
3053
+ ethBalance: bigint
3054
+ xpBalance: bigint
3055
+ }>}
3056
+ * @example
3057
+ * const xpAddress = '0x123...';
3058
+ * const account = '0x456...';
3059
+ * const ret = await sdk.getAssetBalances(xpAddress, account);
3060
+ * console.log(ret);
3061
+ */
3062
+ getAssetBalances(xpAddress: Address, account: Address): Promise<{
2568
3063
  ethBalance: bigint;
2569
3064
  xpBalance: bigint;
2570
3065
  }>;
3066
+ /**
3067
+ * Get counts proposal count for identified account
3068
+ * @param {Address} account - Account to be queried
3069
+ * @returns {Promise<{
3070
+ proposerProposalCount: bigint,
3071
+ partnerProposalCount: bigint,
3072
+ voterProposalCount: bigint,
3073
+ }>}
3074
+ * @example
3075
+ * const account = '0x456...';
3076
+ * const ret = await sdk.getAccountProposalCount(account);
3077
+ * console.log(ret);
3078
+ */
2571
3079
  getAccountProposalCount(account: Address): Promise<{
2572
3080
  proposerProposalCount: bigint;
2573
3081
  partnerProposalCount: bigint;
2574
3082
  voterProposalCount: bigint;
2575
3083
  }>;
2576
- getFoundations(): Promise<Address[]>;
3084
+ /**
3085
+ * Get fouondations
3086
+ * @returns {Promise<readonly Address[]>} - Array of foundations
3087
+ * @example
3088
+ * const ret = await sdk.getFoundations(account);
3089
+ * console.log(ret);
3090
+ */
3091
+ getFoundations(): Promise<readonly Address[]>;
3092
+ /**
3093
+ * Caculate proposal ID
3094
+ * @param {Address} account - Account of proposer
3095
+ * @param {bigint} requestWanAmount - Amount of WAN's requested for proposal
3096
+ * @param {ProposalCategory} category - Category of proposal
3097
+ * @param {PledgeType} pledgeType - PledgeType of proposal for proposer
3098
+ * @param {Hex} description - Description of proposal
3099
+ * @returns {Promise<Hex>} - ID of proposal
3100
+ * @example
3101
+ * const account = '0x456...';
3102
+ * const requestWanAmount = 100n;
3103
+ * const category = ProposalCategory.ProposalCategory;
3104
+ * const pledgeType = PledgeType.Burn;
3105
+ * const description = 'request';
3106
+ * const ret = await sdk.getAccountProposalId(account, requestWanAmount, category, pledgeType, description);
3107
+ * console.log(ret);
3108
+ */
2577
3109
  getAccountProposalId(account: Address, requestWanAmount: bigint, category: ProposalCategory, pledgeType: PledgeType, description: Hex): Promise<Hex>;
2578
- getProposalPartnerAndVoterCounts(proposalId: Hex): Promise<bigint>;
3110
+ /**
3111
+ * Get counts for the proposal partners and voteres
3112
+ * @param {Hex} proposalId - ID of propsal
3113
+ * @returns {Promise<{
3114
+ partnerCount: bigint,
3115
+ voterCount: bigint
3116
+ }>}
3117
+ * @example
3118
+ * const proposalId = '0x456...';
3119
+ * const ret = await sdk.getProposalPartnerAndVoterCounts(proposalId);
3120
+ * console.log(ret);
3121
+ */
3122
+ getProposalPartnerAndVoterCounts(proposalId: Hex): Promise<{
3123
+ partnerCount: bigint;
3124
+ voterCount: bigint;
3125
+ }>;
3126
+ /**
3127
+ * Get multi-proposasl info of proposer
3128
+ * @param {Address} proposerAddr - Proposer address
3129
+ * @param {IndexRange} indexRange - Range of index
3130
+ * @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
3131
+ * @example
3132
+ * const proposerAddr = '0x456...';
3133
+ * const indexRange = {start:0, end: 1};
3134
+ * const ret = await sdk.getProposerProposals(proposerAddr, indexRange);
3135
+ * console.log(ret);
3136
+ */
2579
3137
  getProposerProposals(proposerAddr: Address, indexRange: IndexRange): Promise<ProposalInfo[]>;
3138
+ /**
3139
+ * Get multi-proposasl info of partner
3140
+ * @param {Address} partnerAddr - Partner address
3141
+ * @param {IndexRange} indexRange - Range of index
3142
+ * @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
3143
+ * @example
3144
+ * const partnerAddr = '0x456...';
3145
+ * const indexRange = {start:0, end: 1};
3146
+ * const ret = await sdk.getPartnerProposals(partnerAddr, indexRange);
3147
+ * console.log(ret);
3148
+ */
2580
3149
  getPartnerProposals(partnerAddr: Address, indexRange: IndexRange): Promise<{
2581
3150
  proposalInfo: ProposalInfo;
2582
3151
  partnerInfo: PartnerInfo;
2583
3152
  }[]>;
3153
+ /**
3154
+ * Get multi-proposasl info of voter
3155
+ * @param {Address} voterAddr - Voter address
3156
+ * @param {IndexRange} indexRange - Range of index
3157
+ * @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
3158
+ * @example
3159
+ * const voterAddr = '0x456...';
3160
+ * const indexRange = {start:0, end: 1};
3161
+ * const ret = await sdk.getPartnerProposals(voterAddr, indexRange);
3162
+ * console.log(ret);
3163
+ */
2584
3164
  getVoterProposals(voterAddr: Address, indexRange: IndexRange): Promise<{
2585
3165
  proposalInfo: ProposalInfo;
2586
3166
  voterInfo: VoterInfo;
2587
3167
  }[]>;
3168
+ /**
3169
+ * Get multi-info of partner
3170
+ * @param {Address} partnerAddr - Partner address
3171
+ * @param {Hex[]} proposalIds - IDs of proposal
3172
+ * @returns {Promise<PartnerInfo[]>} - Multi-info of partner
3173
+ * @example
3174
+ * const partnerAddr = '0x456...';
3175
+ * const proposalIds = ['0x1...','[0x2...]];
3176
+ * const ret = await sdk.getPartnerInfo(partnerAddr, proposalIds);
3177
+ * console.log(ret);
3178
+ */
2588
3179
  getPartnerInfo(partnerAddr: Address, proposalIds: Hex[]): Promise<PartnerInfo[]>;
3180
+ /**
3181
+ * Get multi-info of voter
3182
+ * @param {Address} voterAddr - Voter address
3183
+ * @param {Hex[]} proposalIds - IDs of proposal
3184
+ * @returns {Promise<PartnerInfo[]>} - Multi-info of voter
3185
+ * @example
3186
+ * const voterAddr = '0x456...';
3187
+ * const proposalIds = ['0x1...','[0x2...]];
3188
+ * const ret = await sdk.getVoterInfo(voterAddr, proposalIds);
3189
+ * console.log(ret);
3190
+ */
2589
3191
  getVoterInfo(voterAddr: Address, proposalIds: Hex[]): Promise<VoterInfo[]>;
2590
- getReviewPendingProposals(indexRange: IndexRange): Promise<ProposalInfo>;
3192
+ /**
3193
+ * Get review pending proposals
3194
+ * @param {IndexRange} indexRange - Range of index
3195
+ * @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
3196
+ * @example
3197
+ * const indexRange = {start:0, end: 5};
3198
+ * const ret = await sdk.getReviewPendingProposals(indexRange);
3199
+ * console.log(ret);
3200
+ */
3201
+ getReviewPendingProposals(indexRange: IndexRange): Promise<ProposalInfo[]>;
3202
+ /**
3203
+ * Get prospective proposals
3204
+ * @param {IndexRange} indexRange - Range of index
3205
+ * @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
3206
+ * @example
3207
+ * const indexRange = {start:0, end: 5};
3208
+ * const ret = await sdk.getProspectiveProposals(indexRange);
3209
+ * console.log(ret);
3210
+ */
2591
3211
  getProspectiveProposals(indexRange: IndexRange): Promise<ProposalInfo[]>;
3212
+ /**
3213
+ * Get active(voting) proposals
3214
+ * @param {IndexRange} indexRange - Range of index
3215
+ * @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
3216
+ * @example
3217
+ * const indexRange = {start:0, end: 5};
3218
+ * const ret = await sdk.getVotingProposals(indexRange);
3219
+ * console.log(ret);
3220
+ */
2592
3221
  getVotingProposals(indexRange: IndexRange): Promise<ProposalInfo[]>;
3222
+ /**
3223
+ * Get succeed proposals
3224
+ * @param {IndexRange} indexRange - Range of index
3225
+ * @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
3226
+ * @example
3227
+ * const indexRange = {start:0, end: 5};
3228
+ * const ret = await sdk.getSucceedProposals(indexRange);
3229
+ * console.log(ret);
3230
+ */
2593
3231
  getSucceedProposals(indexRange: IndexRange): Promise<ProposalInfo[]>;
3232
+ /**
3233
+ * Get failed proposals
3234
+ * @param {IndexRange} indexRange - Range of index
3235
+ * @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
3236
+ * @example
3237
+ * const indexRange = {start:0, end: 5};
3238
+ * const ret = await sdk.getFailedProposals(indexRange);
3239
+ * console.log(ret);
3240
+ */
2594
3241
  getFailedProposals(indexRange: IndexRange): Promise<ProposalInfo[]>;
3242
+ /**
3243
+ * Get canceled proposals
3244
+ * @param {IndexRange} indexRange - Range of index
3245
+ * @returns {Promise<ProposalInfo[]>} - Multi-info of proposal
3246
+ * @example
3247
+ * const indexRange = {start:0, end: 5};
3248
+ * const ret = await sdk.getCanceledProposals(indexRange);
3249
+ * console.log(ret);
3250
+ */
3251
+ getCanceledProposals(indexRange: IndexRange): Promise<ProposalInfo[]>;
3252
+ /**
3253
+ * Get specified proposal info
3254
+ * @param {Hex} proposalId - ID of proposal
3255
+ * @returns {Promise<ProposalInfo>} - Proposal info
3256
+ * @example
3257
+ * const proposalId = '0x12...';
3258
+ * const ret = await sdk.getProposalInfo(proposalId);
3259
+ * console.log(ret);
3260
+ */
2595
3261
  getProposalInfo(proposalId: Hex): Promise<ProposalInfo>;
3262
+ /**
3263
+ * Check whether need or can request proposal withdrawal
3264
+ * @param {bigint} timestamp - Timestamp of latest block
3265
+ * @param {CanRequestProposalWithdrawalParam[]} params - Parameters
3266
+ * @returns {Promise<CanRequestProposalWithdrawalRetrunItem[]>} - Array of {needRequestWithdrawal, canRequestWithdrawal}
3267
+ * @example
3268
+ * var proposalId = '0x12...';
3269
+ * var proposalInfo = await sdk.getProposalInfo(proposalId);
3270
+ * var latestBlock = await sdk.publicClient.getBlock();
3271
+ * var [{needRequestWithdrawal, canRequestWithdrawal}] = sdk.canRequestProposalWithdrawal(latestBlock.timestamp, [
3272
+ {
3273
+ state: proposalInfo.state,
3274
+ pledgeType: proposalInfo.proposerFundInfo.pledgeType,
3275
+ lockDuration: proposalInfo.proposerFundInfo.lockDuration,
3276
+ voteDeadline: proposalInfo.voteDeadline,
3277
+ requestId: proposalInfo.proposerFundInfo.requestId,
3278
+ exited: proposalInfo.proposerFundInfo.exited,
3279
+ }
3280
+ ]);
3281
+ */
2596
3282
  canRequestProposalWithdrawal(timestamp: bigint, params: CanRequestProposalWithdrawalParam[]): CanRequestProposalWithdrawalRetrunItem[];
3283
+ /**
3284
+ * Check whether can claim proposal withdrawal or not
3285
+ * @param {Address} stakingManagerAddr - Address of stakingManager
3286
+ * @param {bigint} timestamp - Timestamp of latest block
3287
+ * @param {CanClaimProposalWithdrawalParam[]} params - Parameters
3288
+ * @returns {Promise<boolean[]>} - Array of boolean
3289
+ * @example
3290
+ * var stakingManagerAddr = '0x34...';
3291
+ * var proposalId = '0x12...';
3292
+ * var proposalInfo = await sdk.getProposalInfo(proposalId);
3293
+ * var latestBlock = await sdk.publicClient.getBlock();
3294
+ * var ret = sdk.canClaimProposalWithdrawal(stakingManagerAddr, latestBlock.timestamp, [
3295
+ {
3296
+ state: proposalInfo.state,
3297
+ pledgeType: proposalInfo.proposerFundInfo.pledgeType,
3298
+ lockDuration: proposalInfo.proposerFundInfo.lockDuration,
3299
+ voteDeadline: proposalInfo.voteDeadline,
3300
+ requestId: proposalInfo.proposerFundInfo.requestId,
3301
+ exited: proposalInfo.proposerFundInfo.exited,
3302
+ }
3303
+ ]);
3304
+ * console.log(ret);
3305
+ */
2597
3306
  canClaimProposalWithdrawal(stakingManagerAddr: Address, timestamp: bigint, params: CanClaimProposalWithdrawalParam[]): Promise<boolean[]>;
2598
- getUnstakeStatus(stakingManager: Address, requestId: bigint): Promise<UnstakeStatus>;
3307
+ /**
3308
+ * Get unstake status after request proposal withdrawal
3309
+ * @param {Address} stakingManagerAddr - Address of stakingManager
3310
+ * @param {bigint} requestId - ID of proposal request withdrawal to be queried for proposer, partner or voter.
3311
+ * @returns {Promise<UnstakeStatus>} - Status of unstake
3312
+ * @example
3313
+ * var stakingManagerAddr = '0x34...';
3314
+ * var proposalId = '0x12...';
3315
+ * var proposalInfo = await sdk.getProposalInfo(proposalId);
3316
+ * var ret = sdk.getUnstakeStatus(stakingManagerAddr, proposalInfo.proposerFundInfo.requestId);
3317
+ * console.log(ret);
3318
+ */
3319
+ getUnstakeStatus(stakingManagerAddr: Address, requestId: bigint): Promise<UnstakeStatus>;
3320
+ /**
3321
+ * Build transaction
3322
+ * @param {Account | Address} account - Account | Address of sender
3323
+ * @param {ContractFunctionName} functionName - Function name
3324
+ * @param {ContractFunctionArgs} args - Parameters
3325
+ * @param {bigint} value - Amount of WAN
3326
+ * @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
3327
+ * @example
3328
+ * const functionName = 'cancelProposal' as ContractFunctionName<TAbi, 'nonpayable' | 'payable'>;
3329
+ * const args = [proposalId, reason] as ContractFunctionArgs<TAbi, 'nonpayable' | 'payable'>;
3330
+ * const ret = await sdk.buildTx(account, functionName, args, BigInt(0));
3331
+ * console.log(ret);
3332
+ */
2599
3333
  buildTx<TFunctionName extends ContractFunctionName<TAbi, 'nonpayable' | 'payable'>>(account: Account | Address, functionName: TFunctionName, args: ContractFunctionArgs<TAbi, 'nonpayable' | 'payable', TFunctionName>, value?: bigint): Promise<PrepareTransactionRequestReturnType>;
2600
- _buildTx(account: Address | Account, parameters: EncodeFunctionDataParameters, value?: bigint): Promise<PrepareTransactionRequestReturnType>;
3334
+ /**
3335
+ * Build createProposal transaction
3336
+ * @param {Account | Address} account - Account | Address of sender
3337
+ * @param {bigint} pledgeWanAmount - Amount of WAN that proposer pledged
3338
+ * @param {bigint} requestWanAmount - Amount of WAN that proposer request.
3339
+ * @param {ProposalCategory} category - Category of proposal
3340
+ * @param {PledgeType} pledgeType - Pledge type
3341
+ * @param {Hex} description - Description of proposal
3342
+ * @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
3343
+ * @example
3344
+ * const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
3345
+ * const pledgeWanAmount = parseEther("1");
3346
+ * const requestWanAmount = parseEther("100");
3347
+ * const category = ProposalCategory.Funding;
3348
+ * const pledgeType = PledgeType.Lock;
3349
+ * const ret = await sdk.buildCreateProposalTx(walletClient.account!, pledgeWanAmount, requestWanAmount, category, pledgeType, description);
3350
+ * console.log(ret);
3351
+ */
2601
3352
  buildCreateProposalTx(account: Address | Account, pledgeWanAmount: bigint, requestWanAmount: bigint, category: ProposalCategory, pledgeType: PledgeType, description: Hex): Promise<PrepareTransactionRequestReturnType>;
3353
+ /**
3354
+ * Build cancelProposal transaction
3355
+ * @param {Account | Address} account - Account | Address of sender
3356
+ * @param {Hex} proposalId - ID of proposal
3357
+ * @param {Hex} reason - Cancel reason.
3358
+ * @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
3359
+ * @example
3360
+ * const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
3361
+ * const proposalId = '0x12...';
3362
+ * const reason = toHex('cancel');
3363
+ * const ret = await sdk.buildCancelProposalTx(walletClient.account!, proposalId, reason);
3364
+ * console.log(ret);
3365
+ */
2602
3366
  buildCancelProposalTx(account: Address | Account, proposalId: Hex, reason: Hex): Promise<PrepareTransactionRequestReturnType>;
3367
+ /**
3368
+ * Build reviewPoposal transaction
3369
+ * @param {Account | Address} account - Account | Address of sender
3370
+ * @param {Hex} proposalId - ID of proposal
3371
+ * @param {boolean} isApproved - For or against.
3372
+ * @param {Hex} reason - Cancel reason.
3373
+ * @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
3374
+ * @example
3375
+ * const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
3376
+ * const proposalId = '0x12...';
3377
+ * const isApproved = true;
3378
+ * const reason = toHex('greate');
3379
+ * const ret = await sdk.buildReviewProposalTx(walletClient.account!, proposalId, isApproved, reason);
3380
+ * console.log(ret);
3381
+ */
2603
3382
  buildReviewProposalTx(account: Address | Account, proposalId: Hex, isApproved: boolean, reason: Hex): Promise<PrepareTransactionRequestReturnType>;
3383
+ /**
3384
+ * Build contributePoposal transaction
3385
+ * @param {Account | Address} account - Account | Address of sender
3386
+ * @param {Hex} proposalId - ID of proposal
3387
+ * @param {bigint} pledgeWanAmount - Amount of WAN that partner pledged
3388
+ * @param {PledgeType} pledgeType - Pledge type
3389
+ * @param {Hex} reason - Reason.
3390
+ * @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
3391
+ * @example
3392
+ * const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
3393
+ * const proposalId = '0x12...';
3394
+ * const pledgeWanAmount = parseEther("1");
3395
+ * const pledgeType = PledgeType.Lock;
3396
+ * const reason = toHex('support');
3397
+ * const ret = await sdk.buildContributeProposalTx(walletClient.account!, proposalId, pledgeWanAmount, pledgeType, toHex(reason));
3398
+ * console.log(ret);
3399
+ */
2604
3400
  buildContributeProposalTx(account: Address | Account, proposalId: Hex, pledgeWanAmount: bigint, pledgeType: PledgeType, reason: Hex): Promise<PrepareTransactionRequestReturnType>;
3401
+ /**
3402
+ * Build votePoposal transaction
3403
+ * @param {Account | Address} account - Account | Address of sender
3404
+ * @param {Hex} proposalId - ID of proposal
3405
+ * @param {bigint} pledgeWanAmount - Amount of WAN that partner pledged
3406
+ * @param {bigint} lockDuration - Lock duration of proposal for voter
3407
+ * @param {PledgeType} pledgeType - Pledge type
3408
+ * @param {VoteType} voteType - Vote type
3409
+ * @param {Hex} reason - Reason.
3410
+ * @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
3411
+ * @example
3412
+ * const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
3413
+ * const proposalId = '0x12...';
3414
+ * const pledgeWanAmount = parseEther("1");
3415
+ * const lockDuration = 8...;
3416
+ * const pledgeType = PledgeType.Lock;
3417
+ * const voteType = VoteType.For;
3418
+ * const reason = toHex('support');
3419
+ * const ret = await sdk.buildVoteProposalTx(walletClient.account!, proposalId, pledgeWanAmount, lockDuration, pledgeType, voteType, toHex(reason));
3420
+ * console.log(ret);
3421
+ */
2605
3422
  buildVoteProposalTx(account: Address | Account, proposalId: Hex, pledgeWanAmount: bigint, lockDuration: bigint, pledgeType: PledgeType, voteType: VoteType, reason: Hex): Promise<PrepareTransactionRequestReturnType>;
3423
+ /**
3424
+ * Build tallyPoposal transaction
3425
+ * @param {Account | Address} account - Account | Address of sender
3426
+ * @param {Hex} proposalId - ID of proposal
3427
+ * @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
3428
+ * @example
3429
+ * const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
3430
+ * const proposalId = '0x12...';
3431
+ * const ret = await sdk.buildTallyProposalTx(walletClient.account!, proposalId);
3432
+ * console.log(ret);
3433
+ */
2606
3434
  buildTallyProposalTx(account: Address | Account, proposalId: Hex): Promise<PrepareTransactionRequestReturnType>;
3435
+ /**
3436
+ * Build requestProposerWithdrawal transaction
3437
+ * @param {Account | Address} account - Account | Address of sender
3438
+ * @param {Hex} proposalId - ID of proposal
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 ret = await sdk.buildRequestProposerWithdrawalTx(walletClient.account!, proposalId);
3444
+ * console.log(ret);
3445
+ */
2607
3446
  buildRequestProposerWithdrawalTx(account: Address | Account, proposalId: Hex): Promise<PrepareTransactionRequestReturnType>;
3447
+ /**
3448
+ * Build claimProposerWithdrawal transaction
3449
+ * @param {Account | Address} account - Account | Address of sender
3450
+ * @param {Hex} proposalId - ID of proposal
3451
+ * @param {bigint} requestId - ID of proposal request withdrawal to be queried
3452
+ * @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
3453
+ * @example
3454
+ * const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
3455
+ * const proposalId = '0x12...';
3456
+ * const requestId = 34...n;
3457
+ * const ret = await sdk.buildClaimProposerWithdrawalTx(walletClient.account!, proposalId, requestId);
3458
+ * console.log(ret);
3459
+ */
2608
3460
  buildClaimProposerWithdrawalTx(account: Address | Account, proposalId: Hex, requestId: bigint): Promise<PrepareTransactionRequestReturnType>;
3461
+ /**
3462
+ * Build requestPartnerWithdrawal transaction
3463
+ * @param {Account | Address} account - Account | Address of sender
3464
+ * @param {Hex} proposalId - ID of proposal
3465
+ * @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
3466
+ * @example
3467
+ * const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
3468
+ * const proposalId = '0x12...';
3469
+ * const ret = await sdk.buildRequestPartnerWithdrawalTx(walletClient.account!, proposalId);
3470
+ * console.log(ret);
3471
+ */
2609
3472
  buildRequestPartnerWithdrawalTx(account: Address | Account, proposalId: Hex): Promise<PrepareTransactionRequestReturnType>;
3473
+ /**
3474
+ * Build claimPartnerWithdrawal transaction
3475
+ * @param {Account | Address} account - Account | Address of sender
3476
+ * @param {Hex} proposalId - ID of proposal
3477
+ * @param {bigint} requestId - ID of proposal request withdrawal to be queried
3478
+ * @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
3479
+ * @example
3480
+ * const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
3481
+ * const proposalId = '0x12...';
3482
+ * const requestId = 34...n;
3483
+ * const ret = await sdk.buildClaimPartnerWithdrawalTx(walletClient.account!, proposalId, requestId);
3484
+ * console.log(ret);
3485
+ */
2610
3486
  buildClaimPartnerWithdrawalTx(account: Address | Account, proposalId: Hex, requestId: bigint): Promise<PrepareTransactionRequestReturnType>;
3487
+ /**
3488
+ * Build requestVoterWithdrawal transaction
3489
+ * @param {Account | Address} account - Account | Address of sender
3490
+ * @param {Hex} proposalId - ID of proposal
3491
+ * @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
3492
+ * @example
3493
+ * const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
3494
+ * const proposalId = '0x12...';
3495
+ * const ret = await sdk.buildRequestVoterWithdrawalTx(walletClient.account!, proposalId);
3496
+ * console.log(ret);
3497
+ */
2611
3498
  buildRequestVoterWithdrawalTx(account: Address | Account, proposalId: Hex): Promise<PrepareTransactionRequestReturnType>;
3499
+ /**
3500
+ * Build claimVoterWithdrawal transaction
3501
+ * @param {Account | Address} account - Account | Address of sender
3502
+ * @param {Hex} proposalId - ID of proposal
3503
+ * @param {bigint} requestId - ID of proposal request withdrawal to be queried
3504
+ * @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
3505
+ * @example
3506
+ * const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
3507
+ * const proposalId = '0x12...';
3508
+ * const requestId = 34...n;
3509
+ * const ret = await sdk.buildClaimVoterWithdrawalTx(walletClient.account!, proposalId, requestId);
3510
+ * console.log(ret);
3511
+ */
2612
3512
  buildClaimVoterWithdrawalTx(account: Address | Account, proposalId: Hex, requestId: bigint): Promise<PrepareTransactionRequestReturnType>;
3513
+ /**
3514
+ * Build updateFundraisingDuration transaction
3515
+ * @param {Account | Address} account - Account | Address of sender
3516
+ * @param {bigint} fundraisingDuration - Fundraising duration
3517
+ * @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
3518
+ * @example
3519
+ * const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
3520
+ * const fundraisingDuration = 34...n;
3521
+ * const ret = await sdk.buildUpdateFundraisingDurationTx(walletClient.account!, fundraisingDuration);
3522
+ * console.log(ret);
3523
+ */
2613
3524
  buildUpdateFundraisingDurationTx(account: Address | Account, fundraisingDuration: bigint): Promise<PrepareTransactionRequestReturnType>;
3525
+ /**
3526
+ * Build updateMinParticipationAmount transaction
3527
+ * @param {Account | Address} account - Account | Address of sender
3528
+ * @param {bigint} amount - Minimum amount of WANs a participant can participate in proposal
3529
+ * @returns {Promise<PrepareTransactionRequestReturnType>} - Transaction
3530
+ * @example
3531
+ * const walletClient = createWalletClient({ account: privateKeyToAccount(`0x${process.env.PK}`), chain: sdk.publicClient.chain, transport: http() });
3532
+ * const amount = 34...n;
3533
+ * const ret = await sdk.buildUpdateMinParticipationAmountTx(walletClient.account!, amount);
3534
+ * console.log(ret);
3535
+ */
2614
3536
  buildUpdateMinParticipationAmountTx(account: Address | Account, amount: bigint): Promise<PrepareTransactionRequestReturnType>;
2615
3537
  }
2616
3538
  //#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 };
3539
+ export { type CanClaimProposalWithdrawalParam, type CanRequestProposalWithdrawalParam, type CanRequestProposalWithdrawalRetrunItem, type FundInfo, Governance, type IndexRange, type PartnerInfo, PledgeType, type PlegeMultiplierReturn, ProposalCategory, ProposalDescriptionData, type ProposalInfo, ProposalRole, ProposalState, type Tally, UnstakeStatus, ValidVersion, VoteType, type VoterInfo, decodeProposalDescriptionData, encodeProposalDescriptionData, getVersionFromData, supportedProposalDescriptionDataTypeSchema };
2618
3540
  //# sourceMappingURL=index.d.mts.map