def get_pending_transfers( self, token_address: TokenAddress = None, partner_address: Address = None) -> List[Dict[str, Any]]: chain_state = views.state_from_raiden(self.raiden) transfer_tasks = views.get_all_transfer_tasks(chain_state) channel_id = None confirmed_block_identifier = chain_state.block_hash if token_address is not None: token_network = self.raiden.default_registry.get_token_network( token_address=token_address, block_identifier=confirmed_block_identifier) if token_network is None: raise UnknownTokenAddress( f"Token {to_checksum_address(token_address)} not found.") if partner_address is not None: partner_channel = views.get_channelstate_for( chain_state=chain_state, token_network_registry_address=self.raiden. default_registry.address, token_address=token_address, partner_address=partner_address, ) if not partner_channel: raise ChannelNotFound( "Channel with partner `partner_address not found.`") channel_id = partner_channel.identifier return transfer_tasks_view(transfer_tasks, token_address, channel_id)
def get_pending_transfers( self, token_address: TokenAddress = None, partner_address: Address = None ) -> List[Dict[str, Any]]: chain_state = views.state_from_raiden(self.raiden) transfer_tasks = views.get_all_transfer_tasks(chain_state) channel_id = None if token_address is not None: if self.raiden.default_registry.get_token_network(token_address) is None: raise UnknownTokenAddress(f"Token {token_address} not found.") if partner_address is not None: partner_channel = self.get_channel( registry_address=self.raiden.default_registry.address, token_address=token_address, partner_address=partner_address, ) channel_id = partner_channel.identifier return transfer_tasks_view(transfer_tasks, token_address, channel_id)