feat: gov vote

This commit is contained in:
Alisa | Side.one
2023-06-05 11:19:52 +08:00
parent 57657fe627
commit a4b2fd2e23
3 changed files with 311 additions and 328 deletions
+63 -59
View File
@@ -1,79 +1,83 @@
import type { Coin, PaginatedResponse } from "./common"
import type { Coin, PaginatedResponse } from './common';
export interface GovParams {
"voting_params": {
"voting_period": string,
"proposal_voting_periods": any[],
"expedited_voting_period": string
},
"deposit_params": {
"min_deposit": Coin[],
"max_deposit_period": string,
"min_expedited_deposit": Coin[],
"min_initial_deposit_ratio": string
},
"tally_params": {
"quorum": string,
"threshold": string,
"veto_threshold": string,
"expedited_threshold": string
}
voting_params: {
voting_period: string;
proposal_voting_periods: any[];
expedited_voting_period: string;
};
deposit_params: {
min_deposit: Coin[];
max_deposit_period: string;
min_expedited_deposit: Coin[];
min_initial_deposit_ratio: string;
};
tally_params: {
quorum: string;
threshold: string;
veto_threshold: string;
expedited_threshold: string;
};
}
export interface GovProposal {
"proposal_id": string,
"content": {
"@type": string,
"title": string,
"description": string,
"plan"?: {
'height'?: string | number,
'time'?: string | number,
}
},
"status": string,
"final_tally_result": {
"yes": string,
"abstain": string,
"no": string,
"no_with_veto": string,
},
"submit_time": string,
"deposit_end_time": string,
"total_deposit": Coin[],
"voting_start_time": string,
"voting_end_time": string,
"is_expedited": boolean,
"voterStatus"?: string,
proposal_id: string;
content: {
'@type': string;
title: string;
description: string;
plan?: {
height?: string | number;
time?: string | number;
};
};
status: string;
final_tally_result: {
yes: string;
abstain: string;
no: string;
no_with_veto: string;
};
submit_time: string;
deposit_end_time: string;
total_deposit: Coin[];
voting_start_time: string;
voting_end_time: string;
is_expedited: boolean;
voterStatus?: string
// VoteOption[];
}
export interface VoteOption {
option: string;
weight: string;
}
export interface Tally {
yes: string,
abstain: string,
no: string,
no_with_veto: string
yes: string;
abstain: string;
no: string;
no_with_veto: string;
}
export interface GovVote {
proposal_id: string,
voter: string,
option: string,
options: { "option": string, "weight": string }[]
proposal_id: string;
voter: string;
option: string;
options: { option: string; weight: string }[];
}
export interface PaginatedProposals extends PaginatedResponse {
proposals: GovProposal[]
proposals: GovProposal[];
}
export interface PaginatedProposalDeposit extends PaginatedResponse {
deposits: {
amount: Coin[],
proposal_id: string,
depositor: string
}
deposits: {
amount: Coin[];
proposal_id: string;
depositor: string;
};
}
export interface PaginatedProposalVotes extends PaginatedResponse {
votes: GovVote[]
}
votes: GovVote[];
}