Skip to content

Commit 580306b

Browse files
committed
update typings
1 parent 9b7df6a commit 580306b

File tree

2 files changed

+48
-45
lines changed

2 files changed

+48
-45
lines changed

src/chain-wallet-libs/bindings/wallet-wasm-js/js/index.d.ts

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export class BlockDate {
1212
*/
1313
export class Settings {
1414
settings: wallet_wasm.Settings;
15-
spending_counter: wallet_wasm.SpendingCounter;
1615

1716
/**
1817
* Settings type constructor
@@ -30,49 +29,55 @@ export class Settings {
3029
toJson(): string;
3130
}
3231

32+
export class Proposal {
33+
votePlan: string;
34+
proposalIndex: number;
35+
voteOptions?: number;
36+
voteEncKey?: string;
37+
38+
/**
39+
* Proposal constructor
40+
*
41+
* @param {string} votePlan vote plan id bytes representation
42+
* @param {number} voteOptions number of available vote plan options
43+
* @param {number} proposalIndex vote's plan proposal index, mandatory for private proposal
44+
* @param {string} voteEncKey committee public key in hex representation, mandatory for private proposal
45+
* @returns {Proposal}
46+
*/
47+
constructor(
48+
votePlan: string,
49+
voteOptions: number,
50+
proposalIndex?: number,
51+
voteEncKey?: string
52+
): Proposal;
53+
}
54+
3355
/**
3456
* Wrapper over wallet-wasm-js VoteCast type
3557
*/
3658
export class Vote {
37-
voteCast: wallet_wasm.VoteCast;
59+
proposal: Proposal;
60+
choice: number;
61+
expiration: BlockDate;
3862
spendingCounter: number;
3963
spendingCounterLane: number;
40-
validUntil: BlockDate;
41-
42-
/**
43-
* Constructs public wallet-wasm-js VoteCast vote
44-
*
45-
* @param {wallet_wasm.SpendingCounter} spending_counter
46-
* @param {Uint8Array} vote_plan_bytes vote plan id bytes representation
47-
* @param {number} proposal_index vote's plan proposal index
48-
* @param {number} choice choosen vote plan option
49-
* @returns {Vote}
50-
*/
51-
static public(
52-
spending_counter: wallet_wasm.SpendingCounter,
53-
vote_plan_bytes: Uint8Array,
54-
proposal_index: number,
55-
choice: number
56-
): Vote;
5764

5865
/**
59-
* Constructs public wallet-wasm-js VoteCast vote
66+
* Vote constructor
6067
*
61-
* @param {wallet_wasm.SpendingCounter} spending_counter
62-
* @param {Uint8Array} vote_plan_bytes vote plan id bytes representation
63-
* @param {number} proposal_index vote's plan proposal index
64-
* @param {number} options number of available vote plan options
68+
* @param {Proposal} proposal
6569
* @param {number} choice choosen vote plan option
66-
* @param {Uint8Array} public_key committee public key bytes representation
70+
* @param {BlockDate} expiration expiration date of vote transaction
71+
* @param {number} spendingCounter
72+
* @param {number} spendingCounterLane
6773
* @returns {Vote}
6874
*/
69-
static private(
70-
spending_counter: wallet_wasm.SpendingCounter,
71-
vote_plan_bytes: Uint8Array,
72-
proposal_index: number,
73-
options: number,
75+
constructor(
76+
proposal: Proposal,
7477
choice: number,
75-
public_key: Uint8Array
78+
expiration: BlockDate,
79+
spendingCounter: number,
80+
spendingCounterLane: number
7681
): Vote;
7782
}
7883

@@ -81,13 +86,11 @@ export class Vote {
8186
*
8287
* @param {Vote[]} votes list of votes
8388
* @param {Settings} settings wallet Settings
84-
* @param {wallet_wasm.BlockDate} valid_until
85-
* @param {Uint8Array} private_key user private key bytes representation
89+
* @param {string} privateKey user private key hex representation
8690
* @returns {wallet_wasm.Fragment[]}
8791
*/
8892
function signVotes(
8993
votes: Vote[],
9094
settings: Settings,
91-
valid_until: wallet_wasm.BlockDate,
92-
private_key: Uint8Array
95+
privateKey: string
9396
): wallet_wasm.Fragment[];

src/chain-wallet-libs/bindings/wallet-wasm-js/js/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ class Settings {
1919
}
2020
module.exports.Settings = Settings;
2121

22+
class Proposal {
23+
constructor(votePlan, voteOptions, proposalIndex, voteEncKey) {
24+
this.votePlan = votePlan;
25+
this.voteOptions = voteOptions;
26+
this.proposalIndex = proposalIndex;
27+
this.voteEncKey = voteEncKey;
28+
}
29+
}
30+
module.exports.Proposal = Proposal;
31+
2232
class Vote {
2333
constructor(
2434
proposal,
@@ -36,16 +46,6 @@ class Vote {
3646
}
3747
module.exports.Vote = Vote;
3848

39-
class Proposal {
40-
constructor(votePlan, voteOptions, proposalIndex, voteEncKey) {
41-
this.votePlan = votePlan;
42-
this.voteOptions = voteOptions;
43-
this.proposalIndex = proposalIndex;
44-
this.voteEncKey = voteEncKey;
45-
}
46-
}
47-
module.exports.Proposal = Proposal;
48-
4949
function signVotes(votes, settings, privateKey) {
5050
let fragments = [];
5151
for (let i = 0; i < votes.length; i++) {

0 commit comments

Comments
 (0)