Exemple #1
0
 def from_data(cls, data: dict) -> MsgDeposit:
     data = data["value"]
     return cls(
         proposal_id=int(data["proposal_id"]),
         depositor=data["depositor"],
         amount=Coins.from_data(data["amount"]),
     )
Exemple #2
0
 def from_data(cls, data: dict) -> CommunityPoolSpendProposal:
     data = data["value"]
     return cls(
         title=data["title"],
         description=data["description"],
         recipient=data["recipient"],
         amount=Coins.from_data(data["amount"]),
     )
Exemple #3
0
 def from_data(cls, data: dict) -> MsgSend:
     data = data["value"]
     amount = Coins.from_data(data["amount"])
     return cls(
         from_address=data["from_address"],
         to_address=data["to_address"],
         amount=amount,
     )
Exemple #4
0
 def from_data(cls, data: dict) -> MsgSubmitProposal:
     data = data["value"]
     p_type = PROPOSAL_TYPES[data["content"]["type"]]
     content = p_type.from_data(data["content"])
     return cls(
         content=content,
         initial_deposit=Coins.from_data(data["initial_deposit"]),
         proposer=data["proposer"],
     )
Exemple #5
0
 def rewards_for(self, delegator: AccAddress) -> Union[ApiResponse, dict]:
     """Get an account's delegation rewards."""
     delegator = validate_acc_address(delegator)
     res = self._api_get(f"/distribution/delegators/{delegator}/rewards")
     rewards = res["rewards"] or []
     total = Coins.from_data(res["total"])
     result = JiguBox({
         "rewards": {
             r["validator_address"]: Coins.deserialize(r["reward"])
             for r in rewards
         },
         "total": total,
     })
     return project(res, result)
Exemple #6
0
 def from_data(cls, data: dict) -> Proposal:
     final_tally_result = data["final_tally_result"]
     for key in final_tally_result:
         final_tally_result[key] = Coin(uLuna, int(final_tally_result[key]))
     p_type = PROPOSAL_TYPES[data["content"]["type"]]
     content = p_type.from_data(data["content"])
     return cls(
         content=content,
         id=int(data["id"]),
         proposal_status=ProposalStatus(data["proposal_status"]),
         final_tally_result=JiguBox(final_tally_result),
         submit_time=Timestamp.from_data(data["submit_time"]),
         deposit_end_time=Timestamp.from_data(data["deposit_end_time"]),
         total_deposit=Coins.from_data(data["total_deposit"]),
         voting_start_time=Timestamp.from_data(data["voting_start_time"]),
         voting_end_time=Timestamp.from_data(data["voting_end_time"]),
     )
Exemple #7
0
 def exchange_rates(self) -> Union[ApiResponse, Coins]:
     """Gets all exchange rates."""
     res = self._api_get("/oracle/denoms/exchange_rates")
     return project(res, Coins.from_data(res))
Exemple #8
0
 def from_data(cls, data: dict) -> MultiSendIO:
     return cls(address=data["address"],
                coins=Coins.from_data(data["coins"]))