getProposals method

Future<List<Proposal>> getProposals({
  1. ProposalStatus status = ProposalStatus.ProposalStatusUnspecified,
})

Implementation

Future<List<Proposal>> getProposals(
    {ProposalStatus status =
        ProposalStatus.ProposalStatusUnspecified}) async {
  String root =
      "${TerraClientConfiguration.blockchainResourcePath}${CosmosBaseConstants.COSMOS_GOV_PROPOSALS}?proposal_status=${status.index}";

  var response = await apiRequester.getAsync<ProposalsResponseJSON>(root);
  if (response.successful!) {
    var results = ProposalsResponseJSON.fromJson(response.result!);

    return results.proposals.map((w) => Proposal.fromJSON(w)).toList();
  }

  throw Exception("");
}