-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathfacade.ts
More file actions
60 lines (50 loc) · 1.91 KB
/
facade.ts
File metadata and controls
60 lines (50 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import * as wasm from '../wasm.js';
import type { EvoSDK } from '../sdk.js';
export class VotingFacade {
private sdk: EvoSDK;
constructor(sdk: EvoSDK) { this.sdk = sdk; }
async contestedResourceVoteState(
query: wasm.ContestedResourceVoteStateQuery,
): Promise<wasm.ContestedResourceVoteState> {
const w = await this.sdk.getWasmSdkConnected();
return w.getContestedResourceVoteState(query);
}
async contestedResourceVoteStateWithProof(
query: wasm.ContestedResourceVoteStateQuery,
): Promise<wasm.ProofMetadataResponseTyped<
wasm.ContestedResourceVoteState
>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getContestedResourceVoteStateWithProofInfo(query);
}
async contestedResourceIdentityVotes(
query: wasm.ContestedResourceIdentityVotesQuery,
): Promise<Map<string, wasm.ResourceVote>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getContestedResourceIdentityVotes(query);
}
async contestedResourceIdentityVotesWithProof(
query: wasm.ContestedResourceIdentityVotesQuery,
): Promise<wasm.ProofMetadataResponseTyped<
Map<string, wasm.ResourceVote>
>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getContestedResourceIdentityVotesWithProofInfo(query);
}
async votePollsByEndDate(query?: wasm.VotePollsByEndDateQuery): Promise<wasm.VotePollsByEndDateEntry[]> {
const w = await this.sdk.getWasmSdkConnected();
return w.getVotePollsByEndDate(query);
}
async votePollsByEndDateWithProof(
query?: wasm.VotePollsByEndDateQuery,
): Promise<wasm.ProofMetadataResponseTyped<
wasm.VotePollsByEndDateEntry[]
>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getVotePollsByEndDateWithProofInfo(query);
}
async masternodeVote(options: wasm.MasternodeVoteOptions): Promise<void> {
const w = await this.sdk.getWasmSdkConnected();
return w.masternodeVote(options);
}
}