MCPcopy Create free account
hub / github.com/raiden-network/raiden / transfer_tasks_view

Function transfer_tasks_view

raiden/api/python.py:167–188  ·  view source on GitHub ↗
(
    transfer_tasks: Dict[SecretHash, TransferTask],
    token_address: TokenAddress = None,
    channel_id: ChannelID = None,
)

Source from the content-addressed store, hash-verified

165
166
167def transfer_tasks_view(
168 transfer_tasks: Dict[SecretHash, TransferTask],
169 token_address: TokenAddress = None,
170 channel_id: ChannelID = None,
171) -> List[Dict[str, Any]]:
172 view = []
173
174 for secrethash, transfer_task in transfer_tasks.items():
175 transfer = get_transfer_from_task(secrethash, transfer_task)
176
177 if transfer is None:
178 continue
179 if token_address is not None:
180 if transfer.token != token_address:
181 continue
182 elif channel_id is not None:
183 if transfer.balance_proof.channel_identifier != channel_id:
184 continue
185
186 view.append(flatten_transfer(transfer, transfer_task.role))
187
188 return view
189
190
191class RaidenAPI: # pragma: no unittest

Callers 4

test_initiator_task_viewFunction · 0.90
test_mediator_task_viewFunction · 0.90
test_target_task_viewFunction · 0.90
get_pending_transfersMethod · 0.85

Calls 2

get_transfer_from_taskFunction · 0.85
flatten_transferFunction · 0.85

Tested by 3

test_initiator_task_viewFunction · 0.72
test_mediator_task_viewFunction · 0.72
test_target_task_viewFunction · 0.72