def deploy_contract(self, owner: TAddress, contract: Contract) -> "TransactionBuilder": """Deploy a new contract on chain.""" contract._client = self.client contract.owner_address = owner contract.origin_address = owner contract.contract_address = None return contract.deploy()
def get_contract(self, addr: TAddress) -> Contract: """Get a contract object.""" addr = keys.to_base58check_address(addr) info = self.provider.make_request("wallet/getcontract", { "value": addr, "visible": True }) try: self._handle_api_error(info) except ApiError: # your java's null pointer exception sucks raise AddressNotFound("contract address not found") cntr = Contract( addr=addr, bytecode=info.get("bytecode", ''), name=info.get("name", ""), abi=info.get("abi", {}).get("entrys", []), origin_energy_limit=info.get("origin_energy_limit", 0), user_resource_percent=info.get("consume_user_resource_percent", 100), client=self, ) return cntr