sdk38: Add gov proposals endpoint to lcd
This commit is contained in:
parent
0d6484648a
commit
275ff2fb5e
@ -51,4 +51,16 @@ describe("GovExtension", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("proposals", () => {
|
||||
it("works", async () => {
|
||||
pendingWithoutWasmd();
|
||||
const client = makeGovClient(wasmd.endpoint);
|
||||
const response = await client.gov.proposals();
|
||||
expect(response).toEqual({
|
||||
height: jasmine.stringMatching(nonNegativeIntegerMatcher),
|
||||
result: [],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -36,9 +36,28 @@ export type GovParametersByTypeResponse =
|
||||
| GovParametersTallyingResponse
|
||||
| GovParametersVotingResponse;
|
||||
|
||||
export interface TallyResult {
|
||||
readonly yes: string;
|
||||
readonly abstain: string;
|
||||
readonly no: string;
|
||||
readonly no_with_veto: string;
|
||||
}
|
||||
|
||||
export interface TextProposal {
|
||||
readonly proposal_id: number;
|
||||
readonly title: string;
|
||||
readonly description: string;
|
||||
readonly proposal_type: string;
|
||||
readonly proposal_status: string;
|
||||
readonly final_tally_result: TallyResult;
|
||||
readonly submit_time: string;
|
||||
readonly total_deposit: readonly Coin[];
|
||||
readonly voting_start_time: string;
|
||||
}
|
||||
|
||||
export interface GovProposalsResponse {
|
||||
readonly height: string;
|
||||
readonly result: {};
|
||||
readonly result: readonly TextProposal[];
|
||||
}
|
||||
|
||||
export interface GovProposalsByIdResponse {
|
||||
@ -79,6 +98,7 @@ export interface GovVotesByVoterResponse {
|
||||
export interface GovExtension {
|
||||
readonly gov: {
|
||||
readonly parametersByType: (parametersType: GovParametersType) => Promise<GovParametersByTypeResponse>;
|
||||
readonly proposals: () => Promise<GovProposalsResponse>;
|
||||
};
|
||||
}
|
||||
|
||||
@ -87,6 +107,7 @@ export function setupGovExtension(base: LcdClient): GovExtension {
|
||||
gov: {
|
||||
parametersByType: async (parametersType: GovParametersType) =>
|
||||
base.get(`/gov/parameters/${parametersType}`),
|
||||
proposals: async () => base.get("/gov/proposals"),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
20
packages/sdk38/types/lcdapi/gov.d.ts
vendored
20
packages/sdk38/types/lcdapi/gov.d.ts
vendored
@ -30,9 +30,26 @@ export declare type GovParametersByTypeResponse =
|
||||
| GovParametersDepositResponse
|
||||
| GovParametersTallyingResponse
|
||||
| GovParametersVotingResponse;
|
||||
export interface TallyResult {
|
||||
readonly yes: string;
|
||||
readonly abstain: string;
|
||||
readonly no: string;
|
||||
readonly no_with_veto: string;
|
||||
}
|
||||
export interface TextProposal {
|
||||
readonly proposal_id: number;
|
||||
readonly title: string;
|
||||
readonly description: string;
|
||||
readonly proposal_type: string;
|
||||
readonly proposal_status: string;
|
||||
readonly final_tally_result: TallyResult;
|
||||
readonly submit_time: string;
|
||||
readonly total_deposit: readonly Coin[];
|
||||
readonly voting_start_time: string;
|
||||
}
|
||||
export interface GovProposalsResponse {
|
||||
readonly height: string;
|
||||
readonly result: {};
|
||||
readonly result: readonly TextProposal[];
|
||||
}
|
||||
export interface GovProposalsByIdResponse {
|
||||
readonly height: string;
|
||||
@ -65,6 +82,7 @@ export interface GovVotesByVoterResponse {
|
||||
export interface GovExtension {
|
||||
readonly gov: {
|
||||
readonly parametersByType: (parametersType: GovParametersType) => Promise<GovParametersByTypeResponse>;
|
||||
readonly proposals: () => Promise<GovProposalsResponse>;
|
||||
};
|
||||
}
|
||||
export declare function setupGovExtension(base: LcdClient): GovExtension;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user