def add_blockchain_account(self, given_blockchain: str, given_account: str): try: blockchain = SupportedBlockchain(given_blockchain) except ValueError: msg = f'Tried to add blockchain account for unsupported blockchain {given_blockchain}' return simple_result(False, msg) account = cast(BlockchainAddress, given_account) return self.rotkehlchen.add_blockchain_account(blockchain, account)
def remove_owned_eth_tokens(self, tokens: List[str]): ethereum_tokens = [ EthereumToken(identifier=identifier) for identifier in tokens ] try: new_data = self.blockchain.remove_eth_tokens(ethereum_tokens) except InputError as e: return simple_result(False, str(e)) self.data.write_owned_eth_tokens(self.blockchain.owned_eth_tokens) return accounts_result(new_data['per_account'], new_data['totals'])
def remove_blockchain_account(self, given_blockchain: str, given_account: str): try: blockchain = SupportedBlockchain(given_blockchain) except ValueError: msg = ( f'Tried to remove blockchain account for unsupported blockchain {given_blockchain}' ) return simple_result(False, msg) return self.rotkehlchen.remove_blockchain_account( blockchain, given_account)
def add_owned_eth_tokens(self, tokens: List[str]) -> Dict[str, Any]: ethereum_tokens = [ EthereumToken(identifier=identifier) for identifier in tokens ] try: new_data = self.blockchain.track_new_tokens(ethereum_tokens) except (InputError, EthSyncError) as e: return simple_result(False, str(e)) self.data.write_owned_eth_tokens(self.blockchain.owned_eth_tokens) return accounts_result(new_data['per_account'], new_data['totals'])
def remove_blockchain_account( self, blockchain: SupportedBlockchain, account: BlockchainAddress, ): try: new_data = self.blockchain.remove_blockchain_account(blockchain, account) except (InputError, EthSyncError) as e: return simple_result(False, str(e)) self.data.remove_blockchain_account(blockchain, account) return accounts_result(new_data['per_account'], new_data['totals'])