async def _post(self, endpoint: str, data: Optional[dict] = None, raw: bool = False): async with self.session.post(urljoin(self.url, endpoint), json=data and dict_to_data(data)) as response: result = await response.json(content_type=None) if not str(response.status).startswith("2"): raise LCDResponseError(message=result.get("error"), response=response) try: self.last_request_height = result["height"] except KeyError: self.last_request_height = None return result if raw else result["result"]
def to_data(self) -> dict: d = copy.deepcopy(self.__dict__) d["min_self_delegation"] = str(d["min_self_delegation"]) d["tokens"] = str(d["tokens"]) d["unbonding_height"] = str(d["unbonding_height"]) return dict_to_data(d)
def to_data(self) -> dict: d = copy.deepcopy(self.__dict__) d["id"] = str(d["id"]) return dict_to_data(d)
def to_data(self) -> dict: d = copy.deepcopy(self.__dict__) d["execute_msg"] = dict_to_b64(d["execute_msg"]) return {"type": self.type, "value": dict_to_data(d)}
def to_data(self) -> dict: d = copy.deepcopy(self.__dict__) d["code_id"] = str(d["code_id"]) d["init_msg"] = dict_to_b64(d["init_msg"]) return {"type": self.type, "value": dict_to_data(d)}
def to_data(self) -> dict: d = copy.deepcopy(self.__dict__) d["period"] = str(d["period"]) return {"type": self.type, "value": dict_to_data(d)}
def to_data(self) -> dict: d = copy.deepcopy(self.__dict__) d["exchange_rates"] = str(self.exchange_rates) return {"type": self.type, "value": dict_to_data(d)}