Gov
API
- class terra_sdk.client.lcd.api.gov.GovAPI(c)[source]
- deposit_parameters()[source]
Fetches the Gov module’s deposit parameters.
- Returns
deposit parameters
- Return type
dict
- deposits(proposal_id, params=None)[source]
Fetches the Gov module’s deposit parameters.
- Returns
deposit parameters
- Return type
dict
- parameters()[source]
Fetches the Gov module’s parameters.
- Returns
Gov module parameters
- Return type
dict
- proposal(proposal_id)[source]
Fetches a single proposal by id.
- Parameters
proposal_id (int) – proposal ID
- Returns
proposal
- Return type
- proposals(params=None)[source]
Fetches all proposals. :param options: dictionary containing options. Defaults to {}. you can use one or more below:
- {
“proposal_status”: terra_sdk.core.gov.ProposalStatus (int) “voter”: voter address (str), “depositor”: depositor address(str)
} example) {“proposal_status”:1, “depositor”:”terra17lmam6zguazs5q5u6z5mmx76uj63gldnse2pdp”}
- proposer(proposal_id)[source]
Fetches the proposer of a proposal.
- Parameters
proposal_id (int) – proposal ID
- Returns
proposal’s proposer, None if proposal is not exist
- Return type
str
- tally(proposal_id)[source]
Fetches the tally for a proposal.
- Parameters
proposal_id (int) – proposal ID
- tally_parameters()[source]
Fetches the Gov module’s tally parameters.
- Returns
tally parameters
- Return type
dict
Data
Gov module data types.
- class terra_sdk.core.gov.data.Proposal(proposal_id, content, status, final_tally_result, submit_time, deposit_end_time, total_deposit, voting_start_time, voting_end_time)[source]
Contains information about a submitted proposal on the blockchain.
- content: Union[terra_sdk.core.gov.proposals.TextProposal, terra_sdk.core.distribution.proposals.CommunityPoolSpendProposal, terra_sdk.core.params.proposals.ParameterChangeProposal, terra_sdk.core.upgrade.data.proposal.SoftwareUpgradeProposal, terra_sdk.core.upgrade.data.proposal.CancelSoftwareUpgradeProposal]
Proposal contents.
- deposit_end_time: datetime.datetime
Time at which the deposit period ended, or will end.
- final_tally_result: terra_sdk.core.gov.data.TallyResult
Final tallied result of the proposal (after vote).
- proposal_id: int
Proposal’s ID.
- status: str
Status of proposal.
- submit_time: datetime.datetime
Timestamp at which proposal was submitted.
- to_data()[source]
Converts the object to its JSON-serializable Python data representation.
- Return type
dict
- total_deposit: terra_sdk.core.coins.Coins
Total amount deposited for proposal
- voting_end_time: datetime.datetime
Time at which voting period ended, or will end.
- voting_start_time: datetime.datetime
Time at which voting period started, or will start.
Messages
Gov module message types.
- class terra_sdk.core.gov.msgs.MsgDeposit(proposal_id, depositor, amount)[source]
Deposit funds for an active deposit-stage proposal.
- Parameters
proposal_id – proposal number to deposit for
depositor (AccAddress) – account making deposit
amount (Coins) – amount to deposit
- action = 'deposit'
- to_data()[source]
Converts the object to its JSON-serializable Python data representation.
- Return type
dict
- type_amino = 'gov/MsgDeposit'
- type_url: str = '/cosmos.gov.v1beta1.MsgDeposit'
- class terra_sdk.core.gov.msgs.MsgSubmitProposal(content, initial_deposit, proposer)[source]
Submit the attached proposal with an initial deposit.
- Parameters
content (Content) – type of proposal
initial_deposit (Coins) – initial deposit for proposal made by proposer
proposer (AccAddress) – proposal submitter
- action = 'submit_proposal'
- type_amino = 'gov/MsgSubmitProposal'
- type_url: str = '/cosmos.gov.v1beta1.MsgSubmitProposal'
- class terra_sdk.core.gov.msgs.MsgVote(proposal_id, voter, option)[source]
Vote for an active voting-stage proposal.
- Parameters
proposal_id – proposal to vote for
voter (
NewType()
(AccAddress
,str
)) – account casting voteoption (
VoteOption
) – vote option (must be one of:MsgVote.ABSTAIN
,MsgVote.YES
,MsgVote.NO
, orMsgVote.NO_WITH_VETO
,
- ABSTAIN = 'Abstain'
- EMPTY = 'Empty'
Encodes an empty vote option.
- NO = 'No'
- NO_WITH_VETO = 'NoWithVeto'
- YES = 'Yes'
- action = 'vote'
- option: VoteOption
@option.validator def _check_option(self, attribute, value):
- possible_options = [
self.EMPTY, self.YES, self.ABSTAIN, self.NO, self.NO_WITH_VETO,
] if value not in possible_options:
- raise TypeError(
f”incorrect value for option: {value}, must be one of: {possible_options}”
)
- to_data()[source]
Converts the object to its JSON-serializable Python data representation.
- Return type
dict
- type_amino = 'gov/MsgVote'
- type_url: str = '/cosmos.gov.v1beta1.MsgVote'
Proposals
Gov module governance proposal types.
- class terra_sdk.core.gov.proposals.TextProposal(title, description)[source]
Generic proposal type with only title and description that does nothing if passed. Primarily used for assessing the community sentiment around the proposal.
- Parameters
title (
str
) – proposal titledescription (
str
) – proposal description
- type_amino = 'gov/TextProposal'
- type_url = '/cosmos.gov.v1beta1.TextProposal'