id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
221,600
raiden-network/raiden
raiden/network/rpc/client.py
check_address_has_code
def check_address_has_code( client: 'JSONRPCClient', address: Address, contract_name: str = '', ): """ Checks that the given address contains code. """ result = client.web3.eth.getCode(to_checksum_address(address), 'latest') if not result: if contract_name: forma...
python
def check_address_has_code( client: 'JSONRPCClient', address: Address, contract_name: str = '', ): """ Checks that the given address contains code. """ result = client.web3.eth.getCode(to_checksum_address(address), 'latest') if not result: if contract_name: forma...
[ "def", "check_address_has_code", "(", "client", ":", "'JSONRPCClient'", ",", "address", ":", "Address", ",", "contract_name", ":", "str", "=", "''", ",", ")", ":", "result", "=", "client", ".", "web3", ".", "eth", ".", "getCode", "(", "to_checksum_address", ...
Checks that the given address contains code.
[ "Checks", "that", "the", "given", "address", "contains", "code", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/client.py#L188-L207
221,601
raiden-network/raiden
raiden/network/rpc/client.py
dependencies_order_of_build
def dependencies_order_of_build(target_contract, dependencies_map): """ Return an ordered list of contracts that is sufficient to successfully deploy the target contract. Note: This function assumes that the `dependencies_map` is an acyclic graph. """ if not dependencies_map: return...
python
def dependencies_order_of_build(target_contract, dependencies_map): """ Return an ordered list of contracts that is sufficient to successfully deploy the target contract. Note: This function assumes that the `dependencies_map` is an acyclic graph. """ if not dependencies_map: return...
[ "def", "dependencies_order_of_build", "(", "target_contract", ",", "dependencies_map", ")", ":", "if", "not", "dependencies_map", ":", "return", "[", "target_contract", "]", "if", "target_contract", "not", "in", "dependencies_map", ":", "raise", "ValueError", "(", "...
Return an ordered list of contracts that is sufficient to successfully deploy the target contract. Note: This function assumes that the `dependencies_map` is an acyclic graph.
[ "Return", "an", "ordered", "list", "of", "contracts", "that", "is", "sufficient", "to", "successfully", "deploy", "the", "target", "contract", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/client.py#L232-L262
221,602
raiden-network/raiden
raiden/network/rpc/client.py
check_value_error_for_parity
def check_value_error_for_parity(value_error: ValueError, call_type: ParityCallType) -> bool: """ For parity failing calls and functions do not return None if the transaction will fail but instead throw a ValueError exception. This function checks the thrown exception to see if it's the correct one and...
python
def check_value_error_for_parity(value_error: ValueError, call_type: ParityCallType) -> bool: """ For parity failing calls and functions do not return None if the transaction will fail but instead throw a ValueError exception. This function checks the thrown exception to see if it's the correct one and...
[ "def", "check_value_error_for_parity", "(", "value_error", ":", "ValueError", ",", "call_type", ":", "ParityCallType", ")", "->", "bool", ":", "try", ":", "error_data", "=", "json", ".", "loads", "(", "str", "(", "value_error", ")", ".", "replace", "(", "\"'...
For parity failing calls and functions do not return None if the transaction will fail but instead throw a ValueError exception. This function checks the thrown exception to see if it's the correct one and if yes returns True, if not returns False
[ "For", "parity", "failing", "calls", "and", "functions", "do", "not", "return", "None", "if", "the", "transaction", "will", "fail", "but", "instead", "throw", "a", "ValueError", "exception", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/client.py#L270-L295
221,603
raiden-network/raiden
raiden/network/rpc/client.py
JSONRPCClient.get_confirmed_blockhash
def get_confirmed_blockhash(self): """ Gets the block CONFIRMATION_BLOCKS in the past and returns its block hash """ confirmed_block_number = self.web3.eth.blockNumber - self.default_block_num_confirmations if confirmed_block_number < 0: confirmed_block_number = 0 return sel...
python
def get_confirmed_blockhash(self): """ Gets the block CONFIRMATION_BLOCKS in the past and returns its block hash """ confirmed_block_number = self.web3.eth.blockNumber - self.default_block_num_confirmations if confirmed_block_number < 0: confirmed_block_number = 0 return sel...
[ "def", "get_confirmed_blockhash", "(", "self", ")", ":", "confirmed_block_number", "=", "self", ".", "web3", ".", "eth", ".", "blockNumber", "-", "self", ".", "default_block_num_confirmations", "if", "confirmed_block_number", "<", "0", ":", "confirmed_block_number", ...
Gets the block CONFIRMATION_BLOCKS in the past and returns its block hash
[ "Gets", "the", "block", "CONFIRMATION_BLOCKS", "in", "the", "past", "and", "returns", "its", "block", "hash" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/client.py#L559-L565
221,604
raiden-network/raiden
raiden/network/rpc/client.py
JSONRPCClient.balance
def balance(self, account: Address): """ Return the balance of the account of the given address. """ return self.web3.eth.getBalance(to_checksum_address(account), 'pending')
python
def balance(self, account: Address): """ Return the balance of the account of the given address. """ return self.web3.eth.getBalance(to_checksum_address(account), 'pending')
[ "def", "balance", "(", "self", ",", "account", ":", "Address", ")", ":", "return", "self", ".", "web3", ".", "eth", ".", "getBalance", "(", "to_checksum_address", "(", "account", ")", ",", "'pending'", ")" ]
Return the balance of the account of the given address.
[ "Return", "the", "balance", "of", "the", "account", "of", "the", "given", "address", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/client.py#L585-L587
221,605
raiden-network/raiden
raiden/network/rpc/client.py
JSONRPCClient.parity_get_pending_transaction_hash_by_nonce
def parity_get_pending_transaction_hash_by_nonce( self, address: AddressHex, nonce: Nonce, ) -> Optional[TransactionHash]: """Queries the local parity transaction pool and searches for a transaction. Checks the local tx pool for a transaction from a particular ad...
python
def parity_get_pending_transaction_hash_by_nonce( self, address: AddressHex, nonce: Nonce, ) -> Optional[TransactionHash]: """Queries the local parity transaction pool and searches for a transaction. Checks the local tx pool for a transaction from a particular ad...
[ "def", "parity_get_pending_transaction_hash_by_nonce", "(", "self", ",", "address", ":", "AddressHex", ",", "nonce", ":", "Nonce", ",", ")", "->", "Optional", "[", "TransactionHash", "]", ":", "assert", "self", ".", "eth_node", "is", "constants", ".", "EthClient...
Queries the local parity transaction pool and searches for a transaction. Checks the local tx pool for a transaction from a particular address and for a given nonce. If it exists it returns the transaction hash.
[ "Queries", "the", "local", "parity", "transaction", "pool", "and", "searches", "for", "a", "transaction", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/client.py#L589-L607
221,606
raiden-network/raiden
raiden/network/rpc/client.py
JSONRPCClient.new_contract_proxy
def new_contract_proxy(self, contract_interface, contract_address: Address): """ Return a proxy for interacting with a smart contract. Args: contract_interface: The contract interface as defined by the json. address: The contract's address. """ return ContractPro...
python
def new_contract_proxy(self, contract_interface, contract_address: Address): """ Return a proxy for interacting with a smart contract. Args: contract_interface: The contract interface as defined by the json. address: The contract's address. """ return ContractPro...
[ "def", "new_contract_proxy", "(", "self", ",", "contract_interface", ",", "contract_address", ":", "Address", ")", ":", "return", "ContractProxy", "(", "self", ",", "contract", "=", "self", ".", "new_contract", "(", "contract_interface", ",", "contract_address", "...
Return a proxy for interacting with a smart contract. Args: contract_interface: The contract interface as defined by the json. address: The contract's address.
[ "Return", "a", "proxy", "for", "interacting", "with", "a", "smart", "contract", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/client.py#L628-L638
221,607
raiden-network/raiden
raiden/network/rpc/client.py
JSONRPCClient.send_transaction
def send_transaction( self, to: Address, startgas: int, value: int = 0, data: bytes = b'', ) -> bytes: """ Helper to send signed messages. This method will use the `privkey` provided in the constructor to locally sign the transacti...
python
def send_transaction( self, to: Address, startgas: int, value: int = 0, data: bytes = b'', ) -> bytes: """ Helper to send signed messages. This method will use the `privkey` provided in the constructor to locally sign the transacti...
[ "def", "send_transaction", "(", "self", ",", "to", ":", "Address", ",", "startgas", ":", "int", ",", "value", ":", "int", "=", "0", ",", "data", ":", "bytes", "=", "b''", ",", ")", "->", "bytes", ":", "if", "to", "==", "to_canonical_address", "(", ...
Helper to send signed messages. This method will use the `privkey` provided in the constructor to locally sign the transaction. This requires an extended server implementation that accepts the variables v, r, and s.
[ "Helper", "to", "send", "signed", "messages", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/client.py#L775-L828
221,608
raiden-network/raiden
raiden/network/rpc/client.py
JSONRPCClient.poll
def poll( self, transaction_hash: bytes, ): """ Wait until the `transaction_hash` is applied or rejected. Args: transaction_hash: Transaction hash that we are waiting for. """ if len(transaction_hash) != 32: raise ValueError( ...
python
def poll( self, transaction_hash: bytes, ): """ Wait until the `transaction_hash` is applied or rejected. Args: transaction_hash: Transaction hash that we are waiting for. """ if len(transaction_hash) != 32: raise ValueError( ...
[ "def", "poll", "(", "self", ",", "transaction_hash", ":", "bytes", ",", ")", ":", "if", "len", "(", "transaction_hash", ")", "!=", "32", ":", "raise", "ValueError", "(", "'transaction_hash must be a 32 byte hash'", ",", ")", "transaction_hash", "=", "encode_hex"...
Wait until the `transaction_hash` is applied or rejected. Args: transaction_hash: Transaction hash that we are waiting for.
[ "Wait", "until", "the", "transaction_hash", "is", "applied", "or", "rejected", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/client.py#L830-L877
221,609
raiden-network/raiden
raiden/network/rpc/client.py
JSONRPCClient.new_filter
def new_filter( self, contract_address: Address, topics: List[str] = None, from_block: BlockSpecification = 0, to_block: BlockSpecification = 'latest', ) -> StatelessFilter: """ Create a filter in the ethereum node. """ logs_blocks_sanity_c...
python
def new_filter( self, contract_address: Address, topics: List[str] = None, from_block: BlockSpecification = 0, to_block: BlockSpecification = 'latest', ) -> StatelessFilter: """ Create a filter in the ethereum node. """ logs_blocks_sanity_c...
[ "def", "new_filter", "(", "self", ",", "contract_address", ":", "Address", ",", "topics", ":", "List", "[", "str", "]", "=", "None", ",", "from_block", ":", "BlockSpecification", "=", "0", ",", "to_block", ":", "BlockSpecification", "=", "'latest'", ",", "...
Create a filter in the ethereum node.
[ "Create", "a", "filter", "in", "the", "ethereum", "node", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/client.py#L879-L896
221,610
raiden-network/raiden
raiden/network/rpc/client.py
JSONRPCClient.get_filter_events
def get_filter_events( self, contract_address: Address, topics: List[str] = None, from_block: BlockSpecification = 0, to_block: BlockSpecification = 'latest', ) -> List[Dict]: """ Get events for the given query. """ logs_blocks_sanity_check...
python
def get_filter_events( self, contract_address: Address, topics: List[str] = None, from_block: BlockSpecification = 0, to_block: BlockSpecification = 'latest', ) -> List[Dict]: """ Get events for the given query. """ logs_blocks_sanity_check...
[ "def", "get_filter_events", "(", "self", ",", "contract_address", ":", "Address", ",", "topics", ":", "List", "[", "str", "]", "=", "None", ",", "from_block", ":", "BlockSpecification", "=", "0", ",", "to_block", ":", "BlockSpecification", "=", "'latest'", "...
Get events for the given query.
[ "Get", "events", "for", "the", "given", "query", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/client.py#L898-L912
221,611
raiden-network/raiden
raiden/network/rpc/client.py
JSONRPCClient.check_for_insufficient_eth
def check_for_insufficient_eth( self, transaction_name: str, transaction_executed: bool, required_gas: int, block_identifier: BlockSpecification, ): """ After estimate gas failure checks if our address has enough balance. If the account di...
python
def check_for_insufficient_eth( self, transaction_name: str, transaction_executed: bool, required_gas: int, block_identifier: BlockSpecification, ): """ After estimate gas failure checks if our address has enough balance. If the account di...
[ "def", "check_for_insufficient_eth", "(", "self", ",", "transaction_name", ":", "str", ",", "transaction_executed", ":", "bool", ",", "required_gas", ":", "int", ",", "block_identifier", ":", "BlockSpecification", ",", ")", ":", "if", "transaction_executed", ":", ...
After estimate gas failure checks if our address has enough balance. If the account did not have enough ETH balance to execute the, transaction then it raises an `InsufficientFunds` error
[ "After", "estimate", "gas", "failure", "checks", "if", "our", "address", "has", "enough", "balance", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/client.py#L914-L935
221,612
raiden-network/raiden
raiden/utils/upgrades.py
get_db_version
def get_db_version(db_filename: Path) -> int: """Return the version value stored in the db""" assert os.path.exists(db_filename) # Perform a query directly through SQL rather than using # storage.get_version() # as get_version will return the latest version if it doesn't # find a record in the...
python
def get_db_version(db_filename: Path) -> int: """Return the version value stored in the db""" assert os.path.exists(db_filename) # Perform a query directly through SQL rather than using # storage.get_version() # as get_version will return the latest version if it doesn't # find a record in the...
[ "def", "get_db_version", "(", "db_filename", ":", "Path", ")", "->", "int", ":", "assert", "os", ".", "path", ".", "exists", "(", "db_filename", ")", "# Perform a query directly through SQL rather than using", "# storage.get_version()", "# as get_version will return the lat...
Return the version value stored in the db
[ "Return", "the", "version", "value", "stored", "in", "the", "db" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/upgrades.py#L73-L101
221,613
raiden-network/raiden
tools/scenario-player/scenario_player/utils.py
get_or_deploy_token
def get_or_deploy_token(runner) -> Tuple[ContractProxy, int]: """ Deploy or reuse """ token_contract = runner.contract_manager.get_contract(CONTRACT_CUSTOM_TOKEN) token_config = runner.scenario.get('token', {}) if not token_config: token_config = {} address = token_config.get('address') ...
python
def get_or_deploy_token(runner) -> Tuple[ContractProxy, int]: """ Deploy or reuse """ token_contract = runner.contract_manager.get_contract(CONTRACT_CUSTOM_TOKEN) token_config = runner.scenario.get('token', {}) if not token_config: token_config = {} address = token_config.get('address') ...
[ "def", "get_or_deploy_token", "(", "runner", ")", "->", "Tuple", "[", "ContractProxy", ",", "int", "]", ":", "token_contract", "=", "runner", ".", "contract_manager", ".", "get_contract", "(", "CONTRACT_CUSTOM_TOKEN", ")", "token_config", "=", "runner", ".", "sc...
Deploy or reuse
[ "Deploy", "or", "reuse" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/tools/scenario-player/scenario_player/utils.py#L199-L257
221,614
raiden-network/raiden
tools/scenario-player/scenario_player/utils.py
get_udc_and_token
def get_udc_and_token(runner) -> Tuple[Optional[ContractProxy], Optional[ContractProxy]]: """ Return contract proxies for the UserDepositContract and associated token """ from scenario_player.runner import ScenarioRunner assert isinstance(runner, ScenarioRunner) udc_config = runner.scenario.services.ge...
python
def get_udc_and_token(runner) -> Tuple[Optional[ContractProxy], Optional[ContractProxy]]: """ Return contract proxies for the UserDepositContract and associated token """ from scenario_player.runner import ScenarioRunner assert isinstance(runner, ScenarioRunner) udc_config = runner.scenario.services.ge...
[ "def", "get_udc_and_token", "(", "runner", ")", "->", "Tuple", "[", "Optional", "[", "ContractProxy", "]", ",", "Optional", "[", "ContractProxy", "]", "]", ":", "from", "scenario_player", ".", "runner", "import", "ScenarioRunner", "assert", "isinstance", "(", ...
Return contract proxies for the UserDepositContract and associated token
[ "Return", "contract", "proxies", "for", "the", "UserDepositContract", "and", "associated", "token" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/tools/scenario-player/scenario_player/utils.py#L260-L285
221,615
raiden-network/raiden
tools/scenario-player/scenario_player/utils.py
mint_token_if_balance_low
def mint_token_if_balance_low( token_contract: ContractProxy, target_address: str, min_balance: int, fund_amount: int, gas_limit: int, mint_msg: str, no_action_msg: str = None, ) -> Optional[TransactionHash]: """ Check token balance and mint if below minimum "...
python
def mint_token_if_balance_low( token_contract: ContractProxy, target_address: str, min_balance: int, fund_amount: int, gas_limit: int, mint_msg: str, no_action_msg: str = None, ) -> Optional[TransactionHash]: """ Check token balance and mint if below minimum "...
[ "def", "mint_token_if_balance_low", "(", "token_contract", ":", "ContractProxy", ",", "target_address", ":", "str", ",", "min_balance", ":", "int", ",", "fund_amount", ":", "int", ",", "gas_limit", ":", "int", ",", "mint_msg", ":", "str", ",", "no_action_msg", ...
Check token balance and mint if below minimum
[ "Check", "token", "balance", "and", "mint", "if", "below", "minimum" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/tools/scenario-player/scenario_player/utils.py#L288-L307
221,616
raiden-network/raiden
raiden/storage/wal.py
WriteAheadLog.log_and_dispatch
def log_and_dispatch(self, state_change): """ Log and apply a state change. This function will first write the state change to the write-ahead-log, in case of a node crash the state change can be recovered and replayed to restore the node state. Events produced by applying stat...
python
def log_and_dispatch(self, state_change): """ Log and apply a state change. This function will first write the state change to the write-ahead-log, in case of a node crash the state change can be recovered and replayed to restore the node state. Events produced by applying stat...
[ "def", "log_and_dispatch", "(", "self", ",", "state_change", ")", ":", "with", "self", ".", "_lock", ":", "timestamp", "=", "datetime", ".", "utcnow", "(", ")", ".", "isoformat", "(", "timespec", "=", "'milliseconds'", ")", "state_change_id", "=", "self", ...
Log and apply a state change. This function will first write the state change to the write-ahead-log, in case of a node crash the state change can be recovered and replayed to restore the node state. Events produced by applying state change are also saved.
[ "Log", "and", "apply", "a", "state", "change", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/storage/wal.py#L64-L83
221,617
raiden-network/raiden
raiden/storage/wal.py
WriteAheadLog.snapshot
def snapshot(self): """ Snapshot the application state. Snapshots are used to restore the application state, either after a restart or a crash. """ with self._lock: current_state = self.state_manager.current_state state_change_id = self.state_change_id ...
python
def snapshot(self): """ Snapshot the application state. Snapshots are used to restore the application state, either after a restart or a crash. """ with self._lock: current_state = self.state_manager.current_state state_change_id = self.state_change_id ...
[ "def", "snapshot", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "current_state", "=", "self", ".", "state_manager", ".", "current_state", "state_change_id", "=", "self", ".", "state_change_id", "# otherwise no state change was dispatched", "if", "state_...
Snapshot the application state. Snapshots are used to restore the application state, either after a restart or a crash.
[ "Snapshot", "the", "application", "state", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/storage/wal.py#L85-L97
221,618
raiden-network/raiden
raiden/blockchain_events_handler.py
handle_tokennetwork_new
def handle_tokennetwork_new(raiden: 'RaidenService', event: Event): """ Handles a `TokenNetworkCreated` event. """ data = event.event_data args = data['args'] block_number = data['block_number'] token_network_address = args['token_network_address'] token_address = typing.TokenAddress(args['token...
python
def handle_tokennetwork_new(raiden: 'RaidenService', event: Event): """ Handles a `TokenNetworkCreated` event. """ data = event.event_data args = data['args'] block_number = data['block_number'] token_network_address = args['token_network_address'] token_address = typing.TokenAddress(args['token...
[ "def", "handle_tokennetwork_new", "(", "raiden", ":", "'RaidenService'", ",", "event", ":", "Event", ")", ":", "data", "=", "event", ".", "event_data", "args", "=", "data", "[", "'args'", "]", "block_number", "=", "data", "[", "'block_number'", "]", "token_n...
Handles a `TokenNetworkCreated` event.
[ "Handles", "a", "TokenNetworkCreated", "event", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/blockchain_events_handler.py#L45-L75
221,619
raiden-network/raiden
tools/scenario-player/scenario_player/tasks/blockchain.py
query_blockchain_events
def query_blockchain_events( web3: Web3, contract_manager: ContractManager, contract_address: Address, contract_name: str, topics: List, from_block: BlockNumber, to_block: BlockNumber, ) -> List[Dict]: """Returns events emmitted by a contract for a given event...
python
def query_blockchain_events( web3: Web3, contract_manager: ContractManager, contract_address: Address, contract_name: str, topics: List, from_block: BlockNumber, to_block: BlockNumber, ) -> List[Dict]: """Returns events emmitted by a contract for a given event...
[ "def", "query_blockchain_events", "(", "web3", ":", "Web3", ",", "contract_manager", ":", "ContractManager", ",", "contract_address", ":", "Address", ",", "contract_name", ":", "str", ",", "topics", ":", "List", ",", "from_block", ":", "BlockNumber", ",", "to_bl...
Returns events emmitted by a contract for a given event name, within a certain range. Args: web3: A Web3 instance contract_manager: A contract manager contract_address: The address of the contract to be filtered, can be `None` contract_name: The name of the contract topics: ...
[ "Returns", "events", "emmitted", "by", "a", "contract", "for", "a", "given", "event", "name", "within", "a", "certain", "range", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/tools/scenario-player/scenario_player/tasks/blockchain.py#L50-L89
221,620
raiden-network/raiden
raiden/storage/migrations/v16_to_v17.py
upgrade_v16_to_v17
def upgrade_v16_to_v17(storage: SQLiteStorage, old_version: int, current_version: int, **kwargs): """ InitiatorPaymentState was changed so that the "initiator" attribute is renamed to "initiator_transfers" and converted to a list. """ if old_version == SOURCE_VERSION: _transform_snapshots(storag...
python
def upgrade_v16_to_v17(storage: SQLiteStorage, old_version: int, current_version: int, **kwargs): """ InitiatorPaymentState was changed so that the "initiator" attribute is renamed to "initiator_transfers" and converted to a list. """ if old_version == SOURCE_VERSION: _transform_snapshots(storag...
[ "def", "upgrade_v16_to_v17", "(", "storage", ":", "SQLiteStorage", ",", "old_version", ":", "int", ",", "current_version", ":", "int", ",", "*", "*", "kwargs", ")", ":", "if", "old_version", "==", "SOURCE_VERSION", ":", "_transform_snapshots", "(", "storage", ...
InitiatorPaymentState was changed so that the "initiator" attribute is renamed to "initiator_transfers" and converted to a list.
[ "InitiatorPaymentState", "was", "changed", "so", "that", "the", "initiator", "attribute", "is", "renamed", "to", "initiator_transfers", "and", "converted", "to", "a", "list", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/storage/migrations/v16_to_v17.py#L52-L59
221,621
raiden-network/raiden
raiden/storage/versions.py
filter_db_names
def filter_db_names(paths: List[str]) -> List[str]: """Returns a filtered list of `paths`, where every name matches our format. Args: paths: A list of file names. """ return [ db_path for db_path in paths if VERSION_RE.match(os.path.basename(db_path)) ]
python
def filter_db_names(paths: List[str]) -> List[str]: """Returns a filtered list of `paths`, where every name matches our format. Args: paths: A list of file names. """ return [ db_path for db_path in paths if VERSION_RE.match(os.path.basename(db_path)) ]
[ "def", "filter_db_names", "(", "paths", ":", "List", "[", "str", "]", ")", "->", "List", "[", "str", "]", ":", "return", "[", "db_path", "for", "db_path", "in", "paths", "if", "VERSION_RE", ".", "match", "(", "os", ".", "path", ".", "basename", "(", ...
Returns a filtered list of `paths`, where every name matches our format. Args: paths: A list of file names.
[ "Returns", "a", "filtered", "list", "of", "paths", "where", "every", "name", "matches", "our", "format", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/storage/versions.py#L37-L47
221,622
raiden-network/raiden
raiden/network/proxies/utils.py
compare_contract_versions
def compare_contract_versions( proxy: ContractProxy, expected_version: str, contract_name: str, address: Address, ) -> None: """Compare version strings of a contract. If not matching raise ContractVersionMismatch. Also may raise AddressWrongContract if the contract contains ...
python
def compare_contract_versions( proxy: ContractProxy, expected_version: str, contract_name: str, address: Address, ) -> None: """Compare version strings of a contract. If not matching raise ContractVersionMismatch. Also may raise AddressWrongContract if the contract contains ...
[ "def", "compare_contract_versions", "(", "proxy", ":", "ContractProxy", ",", "expected_version", ":", "str", ",", "contract_name", ":", "str", ",", "address", ":", "Address", ",", ")", "->", "None", ":", "assert", "isinstance", "(", "expected_version", ",", "s...
Compare version strings of a contract. If not matching raise ContractVersionMismatch. Also may raise AddressWrongContract if the contract contains no code.
[ "Compare", "version", "strings", "of", "a", "contract", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/utils.py#L16-L42
221,623
raiden-network/raiden
raiden/network/proxies/utils.py
get_onchain_locksroots
def get_onchain_locksroots( chain: 'BlockChainService', canonical_identifier: CanonicalIdentifier, participant1: Address, participant2: Address, block_identifier: BlockSpecification, ) -> Tuple[Locksroot, Locksroot]: """Return the locksroot for `participant1` and `participant...
python
def get_onchain_locksroots( chain: 'BlockChainService', canonical_identifier: CanonicalIdentifier, participant1: Address, participant2: Address, block_identifier: BlockSpecification, ) -> Tuple[Locksroot, Locksroot]: """Return the locksroot for `participant1` and `participant...
[ "def", "get_onchain_locksroots", "(", "chain", ":", "'BlockChainService'", ",", "canonical_identifier", ":", "CanonicalIdentifier", ",", "participant1", ":", "Address", ",", "participant2", ":", "Address", ",", "block_identifier", ":", "BlockSpecification", ",", ")", ...
Return the locksroot for `participant1` and `participant2` at `block_identifier`.
[ "Return", "the", "locksroot", "for", "participant1", "and", "participant2", "at", "block_identifier", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/utils.py#L45-L70
221,624
raiden-network/raiden
raiden/transfer/node.py
inplace_delete_message_queue
def inplace_delete_message_queue( chain_state: ChainState, state_change: Union[ReceiveDelivered, ReceiveProcessed], queueid: QueueIdentifier, ) -> None: """ Filter messages from queue, if the queue becomes empty, cleanup the queue itself. """ queue = chain_state.queueids_to_queues.get(qu...
python
def inplace_delete_message_queue( chain_state: ChainState, state_change: Union[ReceiveDelivered, ReceiveProcessed], queueid: QueueIdentifier, ) -> None: """ Filter messages from queue, if the queue becomes empty, cleanup the queue itself. """ queue = chain_state.queueids_to_queues.get(qu...
[ "def", "inplace_delete_message_queue", "(", "chain_state", ":", "ChainState", ",", "state_change", ":", "Union", "[", "ReceiveDelivered", ",", "ReceiveProcessed", "]", ",", "queueid", ":", "QueueIdentifier", ",", ")", "->", "None", ":", "queue", "=", "chain_state"...
Filter messages from queue, if the queue becomes empty, cleanup the queue itself.
[ "Filter", "messages", "from", "queue", "if", "the", "queue", "becomes", "empty", "cleanup", "the", "queue", "itself", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/node.py#L498-L516
221,625
raiden-network/raiden
raiden/transfer/node.py
inplace_delete_message
def inplace_delete_message( message_queue: List[SendMessageEvent], state_change: Union[ReceiveDelivered, ReceiveProcessed], ) -> None: """ Check if the message exists in queue with ID `queueid` and exclude if found.""" for message in list(message_queue): message_found = ( mes...
python
def inplace_delete_message( message_queue: List[SendMessageEvent], state_change: Union[ReceiveDelivered, ReceiveProcessed], ) -> None: """ Check if the message exists in queue with ID `queueid` and exclude if found.""" for message in list(message_queue): message_found = ( mes...
[ "def", "inplace_delete_message", "(", "message_queue", ":", "List", "[", "SendMessageEvent", "]", ",", "state_change", ":", "Union", "[", "ReceiveDelivered", ",", "ReceiveProcessed", "]", ",", ")", "->", "None", ":", "for", "message", "in", "list", "(", "messa...
Check if the message exists in queue with ID `queueid` and exclude if found.
[ "Check", "if", "the", "message", "exists", "in", "queue", "with", "ID", "queueid", "and", "exclude", "if", "found", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/node.py#L519-L530
221,626
raiden-network/raiden
raiden/transfer/node.py
handle_delivered
def handle_delivered( chain_state: ChainState, state_change: ReceiveDelivered, ) -> TransitionResult[ChainState]: """ Check if the "Delivered" message exists in the global queue and delete if found.""" queueid = QueueIdentifier(state_change.sender, CHANNEL_IDENTIFIER_GLOBAL_QUEUE) inplace_de...
python
def handle_delivered( chain_state: ChainState, state_change: ReceiveDelivered, ) -> TransitionResult[ChainState]: """ Check if the "Delivered" message exists in the global queue and delete if found.""" queueid = QueueIdentifier(state_change.sender, CHANNEL_IDENTIFIER_GLOBAL_QUEUE) inplace_de...
[ "def", "handle_delivered", "(", "chain_state", ":", "ChainState", ",", "state_change", ":", "ReceiveDelivered", ",", ")", "->", "TransitionResult", "[", "ChainState", "]", ":", "queueid", "=", "QueueIdentifier", "(", "state_change", ".", "sender", ",", "CHANNEL_ID...
Check if the "Delivered" message exists in the global queue and delete if found.
[ "Check", "if", "the", "Delivered", "message", "exists", "in", "the", "global", "queue", "and", "delete", "if", "found", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/node.py#L620-L627
221,627
raiden-network/raiden
raiden/transfer/node.py
is_transaction_effect_satisfied
def is_transaction_effect_satisfied( chain_state: ChainState, transaction: ContractSendEvent, state_change: StateChange, ) -> bool: """ True if the side-effect of `transaction` is satisfied by `state_change`. This predicate is used to clear the transaction queue. This should only be...
python
def is_transaction_effect_satisfied( chain_state: ChainState, transaction: ContractSendEvent, state_change: StateChange, ) -> bool: """ True if the side-effect of `transaction` is satisfied by `state_change`. This predicate is used to clear the transaction queue. This should only be...
[ "def", "is_transaction_effect_satisfied", "(", "chain_state", ":", "ChainState", ",", "transaction", ":", "ContractSendEvent", ",", "state_change", ":", "StateChange", ",", ")", "->", "bool", ":", "# These transactions are not made atomic through the WAL. They are sent", "# e...
True if the side-effect of `transaction` is satisfied by `state_change`. This predicate is used to clear the transaction queue. This should only be done once the expected side effect of a transaction is achieved. This doesn't necessarily mean that the transaction sent by *this* node was mined, but ...
[ "True", "if", "the", "side", "-", "effect", "of", "transaction", "is", "satisfied", "by", "state_change", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/node.py#L1043-L1180
221,628
raiden-network/raiden
raiden/transfer/node.py
is_transaction_invalidated
def is_transaction_invalidated(transaction, state_change): """ True if the `transaction` is made invalid by `state_change`. Some transactions will fail due to race conditions. The races are: - Another transaction which has the same side effect is executed before. - Another transaction which *invalidat...
python
def is_transaction_invalidated(transaction, state_change): """ True if the `transaction` is made invalid by `state_change`. Some transactions will fail due to race conditions. The races are: - Another transaction which has the same side effect is executed before. - Another transaction which *invalidat...
[ "def", "is_transaction_invalidated", "(", "transaction", ",", "state_change", ")", ":", "# Most transactions cannot be invalidated by others. These are:", "#", "# - close transactions", "# - settle transactions", "# - batch unlocks", "#", "# Deposits and withdraws are invalidated by the ...
True if the `transaction` is made invalid by `state_change`. Some transactions will fail due to race conditions. The races are: - Another transaction which has the same side effect is executed before. - Another transaction which *invalidates* the state of the smart contract required by the local trans...
[ "True", "if", "the", "transaction", "is", "made", "invalid", "by", "state_change", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/node.py#L1183-L1232
221,629
raiden-network/raiden
raiden/transfer/node.py
is_transaction_expired
def is_transaction_expired(transaction, block_number): """ True if transaction cannot be mined because it has expired. Some transactions are time dependent, e.g. the secret registration must be done before the lock expiration, and the update transfer must be done before the settlement window is over. I...
python
def is_transaction_expired(transaction, block_number): """ True if transaction cannot be mined because it has expired. Some transactions are time dependent, e.g. the secret registration must be done before the lock expiration, and the update transfer must be done before the settlement window is over. I...
[ "def", "is_transaction_expired", "(", "transaction", ",", "block_number", ")", ":", "is_update_expired", "=", "(", "isinstance", "(", "transaction", ",", "ContractSendChannelUpdateTransfer", ")", "and", "transaction", ".", "expiration", "<", "block_number", ")", "if",...
True if transaction cannot be mined because it has expired. Some transactions are time dependent, e.g. the secret registration must be done before the lock expiration, and the update transfer must be done before the settlement window is over. If the current block is higher than any of these expirations...
[ "True", "if", "transaction", "cannot", "be", "mined", "because", "it", "has", "expired", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/node.py#L1235-L1259
221,630
raiden-network/raiden
raiden/network/proxies/user_deposit.py
UserDeposit.deposit
def deposit( self, beneficiary: Address, total_deposit: TokenAmount, block_identifier: BlockSpecification, ) -> None: """ Deposit provided amount into the user-deposit contract to the beneficiary's account. """ token_address = self.token_addre...
python
def deposit( self, beneficiary: Address, total_deposit: TokenAmount, block_identifier: BlockSpecification, ) -> None: """ Deposit provided amount into the user-deposit contract to the beneficiary's account. """ token_address = self.token_addre...
[ "def", "deposit", "(", "self", ",", "beneficiary", ":", "Address", ",", "total_deposit", ":", "TokenAmount", ",", "block_identifier", ":", "BlockSpecification", ",", ")", "->", "None", ":", "token_address", "=", "self", ".", "token_address", "(", "block_identifi...
Deposit provided amount into the user-deposit contract to the beneficiary's account.
[ "Deposit", "provided", "amount", "into", "the", "user", "-", "deposit", "contract", "to", "the", "beneficiary", "s", "account", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/user_deposit.py#L68-L144
221,631
raiden-network/raiden
raiden/network/proxies/user_deposit.py
UserDeposit.effective_balance
def effective_balance(self, address: Address, block_identifier: BlockSpecification) -> Balance: """ The user's balance with planned withdrawals deducted. """ fn = getattr(self.proxy.contract.functions, 'effectiveBalance') balance = fn(address).call(block_identifier=block_identifier) if ...
python
def effective_balance(self, address: Address, block_identifier: BlockSpecification) -> Balance: """ The user's balance with planned withdrawals deducted. """ fn = getattr(self.proxy.contract.functions, 'effectiveBalance') balance = fn(address).call(block_identifier=block_identifier) if ...
[ "def", "effective_balance", "(", "self", ",", "address", ":", "Address", ",", "block_identifier", ":", "BlockSpecification", ")", "->", "Balance", ":", "fn", "=", "getattr", "(", "self", ".", "proxy", ".", "contract", ".", "functions", ",", "'effectiveBalance'...
The user's balance with planned withdrawals deducted.
[ "The", "user", "s", "balance", "with", "planned", "withdrawals", "deducted", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/user_deposit.py#L146-L154
221,632
raiden-network/raiden
raiden/encoding/encoders.py
integer.validate
def validate(self, value: int): ''' Validates the integer is in the value range. ''' if not isinstance(value, int): raise ValueError('value is not an integer') if self.minimum > value or self.maximum < value: msg = ( '{} is outside the valide range [{},{}...
python
def validate(self, value: int): ''' Validates the integer is in the value range. ''' if not isinstance(value, int): raise ValueError('value is not an integer') if self.minimum > value or self.maximum < value: msg = ( '{} is outside the valide range [{},{}...
[ "def", "validate", "(", "self", ",", "value", ":", "int", ")", ":", "if", "not", "isinstance", "(", "value", ",", "int", ")", ":", "raise", "ValueError", "(", "'value is not an integer'", ")", "if", "self", ".", "minimum", ">", "value", "or", "self", "...
Validates the integer is in the value range.
[ "Validates", "the", "integer", "is", "in", "the", "value", "range", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/encoding/encoders.py#L11-L20
221,633
raiden-network/raiden
raiden/api/python.py
event_filter_for_payments
def event_filter_for_payments( event: architecture.Event, token_network_identifier: TokenNetworkID = None, partner_address: Address = None, ) -> bool: """Filters out non payment history related events - If no other args are given, all payment related events match - If a token networ...
python
def event_filter_for_payments( event: architecture.Event, token_network_identifier: TokenNetworkID = None, partner_address: Address = None, ) -> bool: """Filters out non payment history related events - If no other args are given, all payment related events match - If a token networ...
[ "def", "event_filter_for_payments", "(", "event", ":", "architecture", ".", "Event", ",", "token_network_identifier", ":", "TokenNetworkID", "=", "None", ",", "partner_address", ":", "Address", "=", "None", ",", ")", "->", "bool", ":", "is_matching_event", "=", ...
Filters out non payment history related events - If no other args are given, all payment related events match - If a token network identifier is given then only payment events for that match - If a partner is also given then if the event is a payment sent event and the target matches it's returned. I...
[ "Filters", "out", "non", "payment", "history", "related", "events" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/python.py#L83-L120
221,634
raiden-network/raiden
raiden/api/python.py
RaidenAPI.token_network_register
def token_network_register( self, registry_address: PaymentNetworkID, token_address: TokenAddress, channel_participant_deposit_limit: TokenAmount, token_network_deposit_limit: TokenAmount, retry_timeout: NetworkTimeout = DEFAULT_RETRY_TIMEOUT, ...
python
def token_network_register( self, registry_address: PaymentNetworkID, token_address: TokenAddress, channel_participant_deposit_limit: TokenAmount, token_network_deposit_limit: TokenAmount, retry_timeout: NetworkTimeout = DEFAULT_RETRY_TIMEOUT, ...
[ "def", "token_network_register", "(", "self", ",", "registry_address", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "channel_participant_deposit_limit", ":", "TokenAmount", ",", "token_network_deposit_limit", ":", "TokenAmount", ",", "retry_timeo...
Register the `token_address` in the blockchain. If the address is already registered but the event has not been processed this function will block until the next block to make sure the event is processed. Raises: InvalidAddress: If the registry_address or token_address is not ...
[ "Register", "the", "token_address", "in", "the", "blockchain", ".", "If", "the", "address", "is", "already", "registered", "but", "the", "event", "has", "not", "been", "processed", "this", "function", "will", "block", "until", "the", "next", "block", "to", "...
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/python.py#L220-L279
221,635
raiden-network/raiden
raiden/api/python.py
RaidenAPI.token_network_connect
def token_network_connect( self, registry_address: PaymentNetworkID, token_address: TokenAddress, funds: TokenAmount, initial_channel_target: int = 3, joinable_funds_target: float = 0.4, ) -> None: """ Automatically maintain channels op...
python
def token_network_connect( self, registry_address: PaymentNetworkID, token_address: TokenAddress, funds: TokenAmount, initial_channel_target: int = 3, joinable_funds_target: float = 0.4, ) -> None: """ Automatically maintain channels op...
[ "def", "token_network_connect", "(", "self", ",", "registry_address", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "funds", ":", "TokenAmount", ",", "initial_channel_target", ":", "int", "=", "3", ",", "joinable_funds_target", ":", "float...
Automatically maintain channels open for the given token network. Args: token_address: the ERC20 token network to connect to. funds: the amount of funds that can be used by the ConnectionMananger. initial_channel_target: number of channels to open proactively. jo...
[ "Automatically", "maintain", "channels", "open", "for", "the", "given", "token", "network", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/python.py#L281-L329
221,636
raiden-network/raiden
raiden/api/python.py
RaidenAPI.token_network_leave
def token_network_leave( self, registry_address: PaymentNetworkID, token_address: TokenAddress, ) -> List[NettingChannelState]: """ Close all channels and wait for settlement. """ if not is_binary_address(registry_address): raise InvalidAddress('regist...
python
def token_network_leave( self, registry_address: PaymentNetworkID, token_address: TokenAddress, ) -> List[NettingChannelState]: """ Close all channels and wait for settlement. """ if not is_binary_address(registry_address): raise InvalidAddress('regist...
[ "def", "token_network_leave", "(", "self", ",", "registry_address", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", ")", "->", "List", "[", "NettingChannelState", "]", ":", "if", "not", "is_binary_address", "(", "registry_address", ")", ":...
Close all channels and wait for settlement.
[ "Close", "all", "channels", "and", "wait", "for", "settlement", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/python.py#L331-L355
221,637
raiden-network/raiden
raiden/api/python.py
RaidenAPI.channel_open
def channel_open( self, registry_address: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, settle_timeout: BlockTimeout = None, retry_timeout: NetworkTimeout = DEFAULT_RETRY_TIMEOUT, ) -> ChannelID: """ Open a ch...
python
def channel_open( self, registry_address: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, settle_timeout: BlockTimeout = None, retry_timeout: NetworkTimeout = DEFAULT_RETRY_TIMEOUT, ) -> ChannelID: """ Open a ch...
[ "def", "channel_open", "(", "self", ",", "registry_address", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "partner_address", ":", "Address", ",", "settle_timeout", ":", "BlockTimeout", "=", "None", ",", "retry_timeout", ":", "NetworkTimeo...
Open a channel with the peer at `partner_address` with the given `token_address`.
[ "Open", "a", "channel", "with", "the", "peer", "at", "partner_address", "with", "the", "given", "token_address", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/python.py#L357-L447
221,638
raiden-network/raiden
raiden/api/python.py
RaidenAPI.set_total_channel_deposit
def set_total_channel_deposit( self, registry_address: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, total_deposit: TokenAmount, retry_timeout: NetworkTimeout = DEFAULT_RETRY_TIMEOUT, ): """ Set the `total_dep...
python
def set_total_channel_deposit( self, registry_address: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, total_deposit: TokenAmount, retry_timeout: NetworkTimeout = DEFAULT_RETRY_TIMEOUT, ): """ Set the `total_dep...
[ "def", "set_total_channel_deposit", "(", "self", ",", "registry_address", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "partner_address", ":", "Address", ",", "total_deposit", ":", "TokenAmount", ",", "retry_timeout", ":", "NetworkTimeout", ...
Set the `total_deposit` in the channel with the peer at `partner_address` and the given `token_address` in order to be able to do transfers. Raises: InvalidAddress: If either token_address or partner_address is not 20 bytes long. TransactionThrew: May happen for ...
[ "Set", "the", "total_deposit", "in", "the", "channel", "with", "the", "peer", "at", "partner_address", "and", "the", "given", "token_address", "in", "order", "to", "be", "able", "to", "do", "transfers", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/python.py#L449-L563
221,639
raiden-network/raiden
raiden/api/python.py
RaidenAPI.get_node_network_state
def get_node_network_state(self, node_address: Address): """ Returns the currently network status of `node_address`. """ return views.get_node_network_status( chain_state=views.state_from_raiden(self.raiden), node_address=node_address, )
python
def get_node_network_state(self, node_address: Address): """ Returns the currently network status of `node_address`. """ return views.get_node_network_status( chain_state=views.state_from_raiden(self.raiden), node_address=node_address, )
[ "def", "get_node_network_state", "(", "self", ",", "node_address", ":", "Address", ")", ":", "return", "views", ".", "get_node_network_status", "(", "chain_state", "=", "views", ".", "state_from_raiden", "(", "self", ".", "raiden", ")", ",", "node_address", "=",...
Returns the currently network status of `node_address`.
[ "Returns", "the", "currently", "network", "status", "of", "node_address", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/python.py#L701-L706
221,640
raiden-network/raiden
raiden/api/python.py
RaidenAPI.get_tokens_list
def get_tokens_list(self, registry_address: PaymentNetworkID): """Returns a list of tokens the node knows about""" tokens_list = views.get_token_identifiers( chain_state=views.state_from_raiden(self.raiden), payment_network_id=registry_address, ) return tokens_lis...
python
def get_tokens_list(self, registry_address: PaymentNetworkID): """Returns a list of tokens the node knows about""" tokens_list = views.get_token_identifiers( chain_state=views.state_from_raiden(self.raiden), payment_network_id=registry_address, ) return tokens_lis...
[ "def", "get_tokens_list", "(", "self", ",", "registry_address", ":", "PaymentNetworkID", ")", ":", "tokens_list", "=", "views", ".", "get_token_identifiers", "(", "chain_state", "=", "views", ".", "state_from_raiden", "(", "self", ".", "raiden", ")", ",", "payme...
Returns a list of tokens the node knows about
[ "Returns", "a", "list", "of", "tokens", "the", "node", "knows", "about" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/python.py#L712-L718
221,641
raiden-network/raiden
raiden/api/python.py
RaidenAPI.transfer_and_wait
def transfer_and_wait( self, registry_address: PaymentNetworkID, token_address: TokenAddress, amount: TokenAmount, target: Address, identifier: PaymentID = None, transfer_timeout: int = None, secret: Secret = None, ...
python
def transfer_and_wait( self, registry_address: PaymentNetworkID, token_address: TokenAddress, amount: TokenAmount, target: Address, identifier: PaymentID = None, transfer_timeout: int = None, secret: Secret = None, ...
[ "def", "transfer_and_wait", "(", "self", ",", "registry_address", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "amount", ":", "TokenAmount", ",", "target", ":", "Address", ",", "identifier", ":", "PaymentID", "=", "None", ",", "transf...
Do a transfer with `target` with the given `amount` of `token_address`.
[ "Do", "a", "transfer", "with", "target", "with", "the", "given", "amount", "of", "token_address", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/python.py#L731-L755
221,642
raiden-network/raiden
raiden/api/python.py
RaidenAPI.get_blockchain_events_token_network
def get_blockchain_events_token_network( self, token_address: TokenAddress, from_block: BlockSpecification = GENESIS_BLOCK_NUMBER, to_block: BlockSpecification = 'latest', ): """Returns a list of blockchain events coresponding to the token_address.""" ...
python
def get_blockchain_events_token_network( self, token_address: TokenAddress, from_block: BlockSpecification = GENESIS_BLOCK_NUMBER, to_block: BlockSpecification = 'latest', ): """Returns a list of blockchain events coresponding to the token_address.""" ...
[ "def", "get_blockchain_events_token_network", "(", "self", ",", "token_address", ":", "TokenAddress", ",", "from_block", ":", "BlockSpecification", "=", "GENESIS_BLOCK_NUMBER", ",", "to_block", ":", "BlockSpecification", "=", "'latest'", ",", ")", ":", "if", "not", ...
Returns a list of blockchain events coresponding to the token_address.
[ "Returns", "a", "list", "of", "blockchain", "events", "coresponding", "to", "the", "token_address", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/python.py#L922-L956
221,643
raiden-network/raiden
raiden/api/python.py
RaidenAPI.create_monitoring_request
def create_monitoring_request( self, balance_proof: BalanceProofSignedState, reward_amount: TokenAmount, ) -> Optional[RequestMonitoring]: """ This method can be used to create a `RequestMonitoring` message. It will contain all data necessary for an external monit...
python
def create_monitoring_request( self, balance_proof: BalanceProofSignedState, reward_amount: TokenAmount, ) -> Optional[RequestMonitoring]: """ This method can be used to create a `RequestMonitoring` message. It will contain all data necessary for an external monit...
[ "def", "create_monitoring_request", "(", "self", ",", "balance_proof", ":", "BalanceProofSignedState", ",", "reward_amount", ":", "TokenAmount", ",", ")", "->", "Optional", "[", "RequestMonitoring", "]", ":", "# create RequestMonitoring message from the above + `reward_amount...
This method can be used to create a `RequestMonitoring` message. It will contain all data necessary for an external monitoring service to - send an updateNonClosingBalanceProof transaction to the TokenNetwork contract, for the `balance_proof` that we received from a channel partner. - cl...
[ "This", "method", "can", "be", "used", "to", "create", "a", "RequestMonitoring", "message", ".", "It", "will", "contain", "all", "data", "necessary", "for", "an", "external", "monitoring", "service", "to", "-", "send", "an", "updateNonClosingBalanceProof", "tran...
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/python.py#L995-L1013
221,644
raiden-network/raiden
raiden/transfer/mediated_transfer/state.py
lockedtransfersigned_from_message
def lockedtransfersigned_from_message(message: 'LockedTransfer') -> 'LockedTransferSignedState': """ Create LockedTransferSignedState from a LockedTransfer message. """ balance_proof = balanceproof_from_envelope(message) lock = HashTimeLockState( message.lock.amount, message.lock.expiration...
python
def lockedtransfersigned_from_message(message: 'LockedTransfer') -> 'LockedTransferSignedState': """ Create LockedTransferSignedState from a LockedTransfer message. """ balance_proof = balanceproof_from_envelope(message) lock = HashTimeLockState( message.lock.amount, message.lock.expiration...
[ "def", "lockedtransfersigned_from_message", "(", "message", ":", "'LockedTransfer'", ")", "->", "'LockedTransferSignedState'", ":", "balance_proof", "=", "balanceproof_from_envelope", "(", "message", ")", "lock", "=", "HashTimeLockState", "(", "message", ".", "lock", "....
Create LockedTransferSignedState from a LockedTransfer message.
[ "Create", "LockedTransferSignedState", "from", "a", "LockedTransfer", "message", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/state.py#L51-L71
221,645
raiden-network/raiden
raiden/ui/cli.py
version
def version(short): """Print version information and exit. """ if short: print(get_system_spec()['raiden']) else: print(json.dumps( get_system_spec(), indent=2, ))
python
def version(short): """Print version information and exit. """ if short: print(get_system_spec()['raiden']) else: print(json.dumps( get_system_spec(), indent=2, ))
[ "def", "version", "(", "short", ")", ":", "if", "short", ":", "print", "(", "get_system_spec", "(", ")", "[", "'raiden'", "]", ")", "else", ":", "print", "(", "json", ".", "dumps", "(", "get_system_spec", "(", ")", ",", "indent", "=", "2", ",", ")"...
Print version information and exit.
[ "Print", "version", "information", "and", "exit", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/ui/cli.py#L553-L561
221,646
raiden-network/raiden
raiden/connection_manager.py
ConnectionManager.connect
def connect( self, funds: typing.TokenAmount, initial_channel_target: int = 3, joinable_funds_target: float = 0.4, ): """Connect to the network. Subsequent calls to `connect` are allowed, but will only affect the spendable funds and the connec...
python
def connect( self, funds: typing.TokenAmount, initial_channel_target: int = 3, joinable_funds_target: float = 0.4, ): """Connect to the network. Subsequent calls to `connect` are allowed, but will only affect the spendable funds and the connec...
[ "def", "connect", "(", "self", ",", "funds", ":", "typing", ".", "TokenAmount", ",", "initial_channel_target", ":", "int", "=", "3", ",", "joinable_funds_target", ":", "float", "=", "0.4", ",", ")", ":", "token", "=", "self", ".", "raiden", ".", "chain",...
Connect to the network. Subsequent calls to `connect` are allowed, but will only affect the spendable funds and the connection strategy parameters for the future. `connect` will not close any channels. Note: the ConnectionManager does not discriminate manually opened channels from ...
[ "Connect", "to", "the", "network", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/connection_manager.py#L101-L166
221,647
raiden-network/raiden
raiden/connection_manager.py
ConnectionManager.leave
def leave(self, registry_address): """ Leave the token network. This implies closing all channels and waiting for all channels to be settled. """ with self.lock: self.initial_channel_target = 0 channels_to_close = views.get_channelstate_open( ...
python
def leave(self, registry_address): """ Leave the token network. This implies closing all channels and waiting for all channels to be settled. """ with self.lock: self.initial_channel_target = 0 channels_to_close = views.get_channelstate_open( ...
[ "def", "leave", "(", "self", ",", "registry_address", ")", ":", "with", "self", ".", "lock", ":", "self", ".", "initial_channel_target", "=", "0", "channels_to_close", "=", "views", ".", "get_channelstate_open", "(", "chain_state", "=", "views", ".", "state_fr...
Leave the token network. This implies closing all channels and waiting for all channels to be settled.
[ "Leave", "the", "token", "network", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/connection_manager.py#L168-L206
221,648
raiden-network/raiden
raiden/connection_manager.py
ConnectionManager.join_channel
def join_channel(self, partner_address, partner_deposit): """Will be called, when we were selected as channel partner by another node. It will fund the channel with up to the partners deposit, but not more than remaining funds or the initial funding per channel. If the connection manage...
python
def join_channel(self, partner_address, partner_deposit): """Will be called, when we were selected as channel partner by another node. It will fund the channel with up to the partners deposit, but not more than remaining funds or the initial funding per channel. If the connection manage...
[ "def", "join_channel", "(", "self", ",", "partner_address", ",", "partner_deposit", ")", ":", "# Consider this race condition:", "#", "# - Partner opens the channel and starts the deposit.", "# - This nodes learns about the new channel, starts ConnectionManager's", "# retry_connect, wh...
Will be called, when we were selected as channel partner by another node. It will fund the channel with up to the partners deposit, but not more than remaining funds or the initial funding per channel. If the connection manager has no funds, this is a noop.
[ "Will", "be", "called", "when", "we", "were", "selected", "as", "channel", "partner", "by", "another", "node", ".", "It", "will", "fund", "the", "channel", "with", "up", "to", "the", "partners", "deposit", "but", "not", "more", "than", "remaining", "funds"...
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/connection_manager.py#L208-L286
221,649
raiden-network/raiden
raiden/connection_manager.py
ConnectionManager.retry_connect
def retry_connect(self): """Will be called when new channels in the token network are detected. If the minimum number of channels was not yet established, it will try to open new channels. If the connection manager has no funds, this is a noop. """ with self.lock: ...
python
def retry_connect(self): """Will be called when new channels in the token network are detected. If the minimum number of channels was not yet established, it will try to open new channels. If the connection manager has no funds, this is a noop. """ with self.lock: ...
[ "def", "retry_connect", "(", "self", ")", ":", "with", "self", ".", "lock", ":", "if", "self", ".", "_funds_remaining", ">", "0", "and", "not", "self", ".", "_leaving_state", ":", "self", ".", "_open_channels", "(", ")" ]
Will be called when new channels in the token network are detected. If the minimum number of channels was not yet established, it will try to open new channels. If the connection manager has no funds, this is a noop.
[ "Will", "be", "called", "when", "new", "channels", "in", "the", "token", "network", "are", "detected", ".", "If", "the", "minimum", "number", "of", "channels", "was", "not", "yet", "established", "it", "will", "try", "to", "open", "new", "channels", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/connection_manager.py#L288-L297
221,650
raiden-network/raiden
raiden/connection_manager.py
ConnectionManager._find_new_partners
def _find_new_partners(self): """ Search the token network for potential channel partners. """ open_channels = views.get_channelstate_open( chain_state=views.state_from_raiden(self.raiden), payment_network_id=self.registry_address, token_address=self.token_address, ...
python
def _find_new_partners(self): """ Search the token network for potential channel partners. """ open_channels = views.get_channelstate_open( chain_state=views.state_from_raiden(self.raiden), payment_network_id=self.registry_address, token_address=self.token_address, ...
[ "def", "_find_new_partners", "(", "self", ")", ":", "open_channels", "=", "views", ".", "get_channelstate_open", "(", "chain_state", "=", "views", ".", "state_from_raiden", "(", "self", ".", "raiden", ")", ",", "payment_network_id", "=", "self", ".", "registry_a...
Search the token network for potential channel partners.
[ "Search", "the", "token", "network", "for", "potential", "channel", "partners", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/connection_manager.py#L299-L327
221,651
raiden-network/raiden
raiden/connection_manager.py
ConnectionManager._join_partner
def _join_partner(self, partner: Address): """ Ensure a channel exists with partner and is funded in our side """ try: self.api.channel_open( self.registry_address, self.token_address, partner, ) except DuplicatedChannelErro...
python
def _join_partner(self, partner: Address): """ Ensure a channel exists with partner and is funded in our side """ try: self.api.channel_open( self.registry_address, self.token_address, partner, ) except DuplicatedChannelErro...
[ "def", "_join_partner", "(", "self", ",", "partner", ":", "Address", ")", ":", "try", ":", "self", ".", "api", ".", "channel_open", "(", "self", ".", "registry_address", ",", "self", ".", "token_address", ",", "partner", ",", ")", "except", "DuplicatedChan...
Ensure a channel exists with partner and is funded in our side
[ "Ensure", "a", "channel", "exists", "with", "partner", "and", "is", "funded", "in", "our", "side" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/connection_manager.py#L329-L373
221,652
raiden-network/raiden
raiden/connection_manager.py
ConnectionManager._open_channels
def _open_channels(self) -> bool: """ Open channels until there are `self.initial_channel_target` channels open. Do nothing if there are enough channels open already. Note: - This method must be called with the lock held. Return: - False if no channels could be o...
python
def _open_channels(self) -> bool: """ Open channels until there are `self.initial_channel_target` channels open. Do nothing if there are enough channels open already. Note: - This method must be called with the lock held. Return: - False if no channels could be o...
[ "def", "_open_channels", "(", "self", ")", "->", "bool", ":", "open_channels", "=", "views", ".", "get_channelstate_open", "(", "chain_state", "=", "views", ".", "state_from_raiden", "(", "self", ".", "raiden", ")", ",", "payment_network_id", "=", "self", ".",...
Open channels until there are `self.initial_channel_target` channels open. Do nothing if there are enough channels open already. Note: - This method must be called with the lock held. Return: - False if no channels could be opened
[ "Open", "channels", "until", "there", "are", "self", ".", "initial_channel_target", "channels", "open", ".", "Do", "nothing", "if", "there", "are", "enough", "channels", "open", "already", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/connection_manager.py#L375-L435
221,653
raiden-network/raiden
raiden/connection_manager.py
ConnectionManager._initial_funding_per_partner
def _initial_funding_per_partner(self) -> int: """The calculated funding per partner depending on configuration and overall funding of the ConnectionManager. Note: - This attribute must be accessed with the lock held. """ if self.initial_channel_target: r...
python
def _initial_funding_per_partner(self) -> int: """The calculated funding per partner depending on configuration and overall funding of the ConnectionManager. Note: - This attribute must be accessed with the lock held. """ if self.initial_channel_target: r...
[ "def", "_initial_funding_per_partner", "(", "self", ")", "->", "int", ":", "if", "self", ".", "initial_channel_target", ":", "return", "int", "(", "self", ".", "funds", "*", "(", "1", "-", "self", ".", "joinable_funds_target", ")", "/", "self", ".", "initi...
The calculated funding per partner depending on configuration and overall funding of the ConnectionManager. Note: - This attribute must be accessed with the lock held.
[ "The", "calculated", "funding", "per", "partner", "depending", "on", "configuration", "and", "overall", "funding", "of", "the", "ConnectionManager", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/connection_manager.py#L438-L451
221,654
raiden-network/raiden
raiden/connection_manager.py
ConnectionManager._funds_remaining
def _funds_remaining(self) -> int: """The remaining funds after subtracting the already deposited amounts. Note: - This attribute must be accessed with the lock held. """ if self.funds > 0: token = self.raiden.chain.token(self.token_address) token_bal...
python
def _funds_remaining(self) -> int: """The remaining funds after subtracting the already deposited amounts. Note: - This attribute must be accessed with the lock held. """ if self.funds > 0: token = self.raiden.chain.token(self.token_address) token_bal...
[ "def", "_funds_remaining", "(", "self", ")", "->", "int", ":", "if", "self", ".", "funds", ">", "0", ":", "token", "=", "self", ".", "raiden", ".", "chain", ".", "token", "(", "self", ".", "token_address", ")", "token_balance", "=", "token", ".", "ba...
The remaining funds after subtracting the already deposited amounts. Note: - This attribute must be accessed with the lock held.
[ "The", "remaining", "funds", "after", "subtracting", "the", "already", "deposited", "amounts", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/connection_manager.py#L454-L471
221,655
raiden-network/raiden
tools/debugging/replay_wal.py
Translator._make_regex
def _make_regex(self): """ Compile rxp with all keys concatenated. """ rxp = "|".join( map(self._address_rxp, self.keys()), ) self._regex = re.compile( rxp, re.IGNORECASE, )
python
def _make_regex(self): """ Compile rxp with all keys concatenated. """ rxp = "|".join( map(self._address_rxp, self.keys()), ) self._regex = re.compile( rxp, re.IGNORECASE, )
[ "def", "_make_regex", "(", "self", ")", ":", "rxp", "=", "\"|\"", ".", "join", "(", "map", "(", "self", ".", "_address_rxp", ",", "self", ".", "keys", "(", ")", ")", ",", ")", "self", ".", "_regex", "=", "re", ".", "compile", "(", "rxp", ",", "...
Compile rxp with all keys concatenated.
[ "Compile", "rxp", "with", "all", "keys", "concatenated", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/tools/debugging/replay_wal.py#L97-L105
221,656
raiden-network/raiden
raiden/api/v1/resources.py
TokensResource.get
def get(self): """ this translates to 'get all token addresses we have channels open for' """ return self.rest_api.get_tokens_list( self.rest_api.raiden_api.raiden.default_registry.address, )
python
def get(self): """ this translates to 'get all token addresses we have channels open for' """ return self.rest_api.get_tokens_list( self.rest_api.raiden_api.raiden.default_registry.address, )
[ "def", "get", "(", "self", ")", ":", "return", "self", ".", "rest_api", ".", "get_tokens_list", "(", "self", ".", "rest_api", ".", "raiden_api", ".", "raiden", ".", "default_registry", ".", "address", ",", ")" ]
this translates to 'get all token addresses we have channels open for'
[ "this", "translates", "to", "get", "all", "token", "addresses", "we", "have", "channels", "open", "for" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/v1/resources.py#L88-L94
221,657
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
is_safe_to_wait
def is_safe_to_wait( lock_expiration: BlockExpiration, reveal_timeout: BlockTimeout, block_number: BlockNumber, ) -> SuccessOrError: """ True if waiting is safe, i.e. there are more than enough blocks to safely unlock on chain. """ # reveal timeout will not ever be larger than th...
python
def is_safe_to_wait( lock_expiration: BlockExpiration, reveal_timeout: BlockTimeout, block_number: BlockNumber, ) -> SuccessOrError: """ True if waiting is safe, i.e. there are more than enough blocks to safely unlock on chain. """ # reveal timeout will not ever be larger than th...
[ "def", "is_safe_to_wait", "(", "lock_expiration", ":", "BlockExpiration", ",", "reveal_timeout", ":", "BlockTimeout", ",", "block_number", ":", "BlockNumber", ",", ")", "->", "SuccessOrError", ":", "# reveal timeout will not ever be larger than the lock_expiration otherwise", ...
True if waiting is safe, i.e. there are more than enough blocks to safely unlock on chain.
[ "True", "if", "waiting", "is", "safe", "i", ".", "e", ".", "there", "are", "more", "than", "enough", "blocks", "to", "safely", "unlock", "on", "chain", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L103-L129
221,658
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
is_send_transfer_almost_equal
def is_send_transfer_almost_equal( send_channel: NettingChannelState, send: LockedTransferUnsignedState, received: LockedTransferSignedState, ) -> bool: """ True if both transfers are for the same mediated transfer. """ # The only thing that may change is the direction of the transfer ...
python
def is_send_transfer_almost_equal( send_channel: NettingChannelState, send: LockedTransferUnsignedState, received: LockedTransferSignedState, ) -> bool: """ True if both transfers are for the same mediated transfer. """ # The only thing that may change is the direction of the transfer ...
[ "def", "is_send_transfer_almost_equal", "(", "send_channel", ":", "NettingChannelState", ",", "send", ":", "LockedTransferUnsignedState", ",", "received", ":", "LockedTransferSignedState", ",", ")", "->", "bool", ":", "# The only thing that may change is the direction of the tr...
True if both transfers are for the same mediated transfer.
[ "True", "if", "both", "transfers", "are", "for", "the", "same", "mediated", "transfer", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L154-L171
221,659
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
filter_reachable_routes
def filter_reachable_routes( routes: List[RouteState], nodeaddresses_to_networkstates: NodeNetworkStateMap, ) -> List[RouteState]: """This function makes sure we use reachable routes only.""" reachable_routes = [] for route in routes: node_network_state = nodeaddresses_to_networksta...
python
def filter_reachable_routes( routes: List[RouteState], nodeaddresses_to_networkstates: NodeNetworkStateMap, ) -> List[RouteState]: """This function makes sure we use reachable routes only.""" reachable_routes = [] for route in routes: node_network_state = nodeaddresses_to_networksta...
[ "def", "filter_reachable_routes", "(", "routes", ":", "List", "[", "RouteState", "]", ",", "nodeaddresses_to_networkstates", ":", "NodeNetworkStateMap", ",", ")", "->", "List", "[", "RouteState", "]", ":", "reachable_routes", "=", "[", "]", "for", "route", "in",...
This function makes sure we use reachable routes only.
[ "This", "function", "makes", "sure", "we", "use", "reachable", "routes", "only", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L198-L214
221,660
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
filter_used_routes
def filter_used_routes( transfers_pair: List[MediationPairState], routes: List[RouteState], ) -> List[RouteState]: """This function makes sure we filter routes that have already been used. So in a setup like this, we want to make sure that node 2, having tried to route the transfer through ...
python
def filter_used_routes( transfers_pair: List[MediationPairState], routes: List[RouteState], ) -> List[RouteState]: """This function makes sure we filter routes that have already been used. So in a setup like this, we want to make sure that node 2, having tried to route the transfer through ...
[ "def", "filter_used_routes", "(", "transfers_pair", ":", "List", "[", "MediationPairState", "]", ",", "routes", ":", "List", "[", "RouteState", "]", ",", ")", "->", "List", "[", "RouteState", "]", ":", "channelid_to_route", "=", "{", "r", ".", "channel_ident...
This function makes sure we filter routes that have already been used. So in a setup like this, we want to make sure that node 2, having tried to route the transfer through 3 will also try 5 before sending it backwards to 1 1 -> 2 -> 3 -> 4 v ^ 5 -> 6 -> 7 This function will ...
[ "This", "function", "makes", "sure", "we", "filter", "routes", "that", "have", "already", "been", "used", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L217-L246
221,661
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
get_payee_channel
def get_payee_channel( channelidentifiers_to_channels: ChannelMap, transfer_pair: MediationPairState, ) -> Optional[NettingChannelState]: """ Returns the payee channel of a given transfer pair or None if it's not found """ payee_channel_identifier = transfer_pair.payee_transfer.balance_proof.cha...
python
def get_payee_channel( channelidentifiers_to_channels: ChannelMap, transfer_pair: MediationPairState, ) -> Optional[NettingChannelState]: """ Returns the payee channel of a given transfer pair or None if it's not found """ payee_channel_identifier = transfer_pair.payee_transfer.balance_proof.cha...
[ "def", "get_payee_channel", "(", "channelidentifiers_to_channels", ":", "ChannelMap", ",", "transfer_pair", ":", "MediationPairState", ",", ")", "->", "Optional", "[", "NettingChannelState", "]", ":", "payee_channel_identifier", "=", "transfer_pair", ".", "payee_transfer"...
Returns the payee channel of a given transfer pair or None if it's not found
[ "Returns", "the", "payee", "channel", "of", "a", "given", "transfer", "pair", "or", "None", "if", "it", "s", "not", "found" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L249-L255
221,662
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
get_payer_channel
def get_payer_channel( channelidentifiers_to_channels: ChannelMap, transfer_pair: MediationPairState, ) -> Optional[NettingChannelState]: """ Returns the payer channel of a given transfer pair or None if it's not found """ payer_channel_identifier = transfer_pair.payer_transfer.balance_proof.cha...
python
def get_payer_channel( channelidentifiers_to_channels: ChannelMap, transfer_pair: MediationPairState, ) -> Optional[NettingChannelState]: """ Returns the payer channel of a given transfer pair or None if it's not found """ payer_channel_identifier = transfer_pair.payer_transfer.balance_proof.cha...
[ "def", "get_payer_channel", "(", "channelidentifiers_to_channels", ":", "ChannelMap", ",", "transfer_pair", ":", "MediationPairState", ",", ")", "->", "Optional", "[", "NettingChannelState", "]", ":", "payer_channel_identifier", "=", "transfer_pair", ".", "payer_transfer"...
Returns the payer channel of a given transfer pair or None if it's not found
[ "Returns", "the", "payer", "channel", "of", "a", "given", "transfer", "pair", "or", "None", "if", "it", "s", "not", "found" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L258-L264
221,663
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
get_pending_transfer_pairs
def get_pending_transfer_pairs( transfers_pair: List[MediationPairState], ) -> List[MediationPairState]: """ Return the transfer pairs that are not at a final state. """ pending_pairs = list( pair for pair in transfers_pair if pair.payee_state not in STATE_TRANSFER_FINAL or ...
python
def get_pending_transfer_pairs( transfers_pair: List[MediationPairState], ) -> List[MediationPairState]: """ Return the transfer pairs that are not at a final state. """ pending_pairs = list( pair for pair in transfers_pair if pair.payee_state not in STATE_TRANSFER_FINAL or ...
[ "def", "get_pending_transfer_pairs", "(", "transfers_pair", ":", "List", "[", "MediationPairState", "]", ",", ")", "->", "List", "[", "MediationPairState", "]", ":", "pending_pairs", "=", "list", "(", "pair", "for", "pair", "in", "transfers_pair", "if", "pair", ...
Return the transfer pairs that are not at a final state.
[ "Return", "the", "transfer", "pairs", "that", "are", "not", "at", "a", "final", "state", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L267-L277
221,664
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
get_lock_amount_after_fees
def get_lock_amount_after_fees( lock: HashTimeLockState, payee_channel: NettingChannelState, ) -> PaymentWithFeeAmount: """ Return the lock.amount after fees are taken. Fees are taken only for the outgoing channel, which is the one with collateral locked from this node. """ retu...
python
def get_lock_amount_after_fees( lock: HashTimeLockState, payee_channel: NettingChannelState, ) -> PaymentWithFeeAmount: """ Return the lock.amount after fees are taken. Fees are taken only for the outgoing channel, which is the one with collateral locked from this node. """ retu...
[ "def", "get_lock_amount_after_fees", "(", "lock", ":", "HashTimeLockState", ",", "payee_channel", ":", "NettingChannelState", ",", ")", "->", "PaymentWithFeeAmount", ":", "return", "PaymentWithFeeAmount", "(", "lock", ".", "amount", "-", "payee_channel", ".", "mediati...
Return the lock.amount after fees are taken. Fees are taken only for the outgoing channel, which is the one with collateral locked from this node.
[ "Return", "the", "lock", ".", "amount", "after", "fees", "are", "taken", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L280-L290
221,665
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
sanity_check
def sanity_check( state: MediatorTransferState, channelidentifiers_to_channels: ChannelMap, ) -> None: """ Check invariants that must hold. """ # if a transfer is paid we must know the secret all_transfers_states = itertools.chain( (pair.payee_state for pair in state.transfers_pair)...
python
def sanity_check( state: MediatorTransferState, channelidentifiers_to_channels: ChannelMap, ) -> None: """ Check invariants that must hold. """ # if a transfer is paid we must know the secret all_transfers_states = itertools.chain( (pair.payee_state for pair in state.transfers_pair)...
[ "def", "sanity_check", "(", "state", ":", "MediatorTransferState", ",", "channelidentifiers_to_channels", ":", "ChannelMap", ",", ")", "->", "None", ":", "# if a transfer is paid we must know the secret", "all_transfers_states", "=", "itertools", ".", "chain", "(", "(", ...
Check invariants that must hold.
[ "Check", "invariants", "that", "must", "hold", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L293-L365
221,666
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
clear_if_finalized
def clear_if_finalized( iteration: TransitionResult, channelidentifiers_to_channels: ChannelMap, ) -> TransitionResult[MediatorTransferState]: """Clear the mediator task if all the locks have been finalized. A lock is considered finalized if it has been removed from the merkle tree offchain...
python
def clear_if_finalized( iteration: TransitionResult, channelidentifiers_to_channels: ChannelMap, ) -> TransitionResult[MediatorTransferState]: """Clear the mediator task if all the locks have been finalized. A lock is considered finalized if it has been removed from the merkle tree offchain...
[ "def", "clear_if_finalized", "(", "iteration", ":", "TransitionResult", ",", "channelidentifiers_to_channels", ":", "ChannelMap", ",", ")", "->", "TransitionResult", "[", "MediatorTransferState", "]", ":", "state", "=", "cast", "(", "MediatorTransferState", ",", "iter...
Clear the mediator task if all the locks have been finalized. A lock is considered finalized if it has been removed from the merkle tree offchain, either because the transfer was unlocked or expired, or because the channel was settled on chain and therefore the channel is removed.
[ "Clear", "the", "mediator", "task", "if", "all", "the", "locks", "have", "been", "finalized", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L368-L401
221,667
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
forward_transfer_pair
def forward_transfer_pair( payer_transfer: LockedTransferSignedState, available_routes: List['RouteState'], channelidentifiers_to_channels: Dict, pseudo_random_generator: random.Random, block_number: BlockNumber, ) -> Tuple[Optional[MediationPairState], List[Event]]: """ Give...
python
def forward_transfer_pair( payer_transfer: LockedTransferSignedState, available_routes: List['RouteState'], channelidentifiers_to_channels: Dict, pseudo_random_generator: random.Random, block_number: BlockNumber, ) -> Tuple[Optional[MediationPairState], List[Event]]: """ Give...
[ "def", "forward_transfer_pair", "(", "payer_transfer", ":", "LockedTransferSignedState", ",", "available_routes", ":", "List", "[", "'RouteState'", "]", ",", "channelidentifiers_to_channels", ":", "Dict", ",", "pseudo_random_generator", ":", "random", ".", "Random", ","...
Given a payer transfer tries a new route to proceed with the mediation. Args: payer_transfer: The transfer received from the payer_channel. available_routes: Current available routes that may be used, it's assumed that the routes list is ordered from best to worst. channelidenti...
[ "Given", "a", "payer", "transfer", "tries", "a", "new", "route", "to", "proceed", "with", "the", "mediation", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L438-L496
221,668
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
backward_transfer_pair
def backward_transfer_pair( backward_channel: NettingChannelState, payer_transfer: LockedTransferSignedState, pseudo_random_generator: random.Random, block_number: BlockNumber, ) -> Tuple[Optional[MediationPairState], List[Event]]: """ Sends a transfer backwards, allowing the previou...
python
def backward_transfer_pair( backward_channel: NettingChannelState, payer_transfer: LockedTransferSignedState, pseudo_random_generator: random.Random, block_number: BlockNumber, ) -> Tuple[Optional[MediationPairState], List[Event]]: """ Sends a transfer backwards, allowing the previou...
[ "def", "backward_transfer_pair", "(", "backward_channel", ":", "NettingChannelState", ",", "payer_transfer", ":", "LockedTransferSignedState", ",", "pseudo_random_generator", ":", "random", ".", "Random", ",", "block_number", ":", "BlockNumber", ",", ")", "->", "Tuple",...
Sends a transfer backwards, allowing the previous hop to try a new route. When all the routes available for this node failed, send a transfer backwards with the same amount and secrethash, allowing the previous hop to do a retry. Args: backward_channel: The original channel which sent the ...
[ "Sends", "a", "transfer", "backwards", "allowing", "the", "previous", "hop", "to", "try", "a", "new", "route", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L499-L551
221,669
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
events_for_expired_pairs
def events_for_expired_pairs( channelidentifiers_to_channels: ChannelMap, transfers_pair: List[MediationPairState], waiting_transfer: Optional[WaitingTransferState], block_number: BlockNumber, ) -> List[Event]: """ Informational events for expired locks. """ pending_transfers_pai...
python
def events_for_expired_pairs( channelidentifiers_to_channels: ChannelMap, transfers_pair: List[MediationPairState], waiting_transfer: Optional[WaitingTransferState], block_number: BlockNumber, ) -> List[Event]: """ Informational events for expired locks. """ pending_transfers_pai...
[ "def", "events_for_expired_pairs", "(", "channelidentifiers_to_channels", ":", "ChannelMap", ",", "transfers_pair", ":", "List", "[", "MediationPairState", "]", ",", "waiting_transfer", ":", "Optional", "[", "WaitingTransferState", "]", ",", "block_number", ":", "BlockN...
Informational events for expired locks.
[ "Informational", "events", "for", "expired", "locks", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L681-L738
221,670
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
events_for_secretreveal
def events_for_secretreveal( transfers_pair: List[MediationPairState], secret: Secret, pseudo_random_generator: random.Random, ) -> List[Event]: """ Reveal the secret off-chain. The secret is revealed off-chain even if there is a pending transaction to reveal it on-chain, this allow...
python
def events_for_secretreveal( transfers_pair: List[MediationPairState], secret: Secret, pseudo_random_generator: random.Random, ) -> List[Event]: """ Reveal the secret off-chain. The secret is revealed off-chain even if there is a pending transaction to reveal it on-chain, this allow...
[ "def", "events_for_secretreveal", "(", "transfers_pair", ":", "List", "[", "MediationPairState", "]", ",", "secret", ":", "Secret", ",", "pseudo_random_generator", ":", "random", ".", "Random", ",", ")", "->", "List", "[", "Event", "]", ":", "events", ":", "...
Reveal the secret off-chain. The secret is revealed off-chain even if there is a pending transaction to reveal it on-chain, this allows the unlock to happen off-chain, which is faster. This node is named N, suppose there is a mediated transfer with two refund transfers, one from B and one from C: ...
[ "Reveal", "the", "secret", "off", "-", "chain", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L741-L794
221,671
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
events_for_balanceproof
def events_for_balanceproof( channelidentifiers_to_channels: ChannelMap, transfers_pair: List[MediationPairState], pseudo_random_generator: random.Random, block_number: BlockNumber, secret: Secret, secrethash: SecretHash, ) -> List[Event]: """ While it's safe do the o...
python
def events_for_balanceproof( channelidentifiers_to_channels: ChannelMap, transfers_pair: List[MediationPairState], pseudo_random_generator: random.Random, block_number: BlockNumber, secret: Secret, secrethash: SecretHash, ) -> List[Event]: """ While it's safe do the o...
[ "def", "events_for_balanceproof", "(", "channelidentifiers_to_channels", ":", "ChannelMap", ",", "transfers_pair", ":", "List", "[", "MediationPairState", "]", ",", "pseudo_random_generator", ":", "random", ".", "Random", ",", "block_number", ":", "BlockNumber", ",", ...
While it's safe do the off-chain unlock.
[ "While", "it", "s", "safe", "do", "the", "off", "-", "chain", "unlock", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L797-L862
221,672
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
events_for_onchain_secretreveal_if_dangerzone
def events_for_onchain_secretreveal_if_dangerzone( channelmap: ChannelMap, secrethash: SecretHash, transfers_pair: List[MediationPairState], block_number: BlockNumber, block_hash: BlockHash, ) -> List[Event]: """ Reveal the secret on-chain if the lock enters the unsafe region...
python
def events_for_onchain_secretreveal_if_dangerzone( channelmap: ChannelMap, secrethash: SecretHash, transfers_pair: List[MediationPairState], block_number: BlockNumber, block_hash: BlockHash, ) -> List[Event]: """ Reveal the secret on-chain if the lock enters the unsafe region...
[ "def", "events_for_onchain_secretreveal_if_dangerzone", "(", "channelmap", ":", "ChannelMap", ",", "secrethash", ":", "SecretHash", ",", "transfers_pair", ":", "List", "[", "MediationPairState", "]", ",", "block_number", ":", "BlockNumber", ",", "block_hash", ":", "Bl...
Reveal the secret on-chain if the lock enters the unsafe region and the secret is not yet on-chain.
[ "Reveal", "the", "secret", "on", "-", "chain", "if", "the", "lock", "enters", "the", "unsafe", "region", "and", "the", "secret", "is", "not", "yet", "on", "-", "chain", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L865-L933
221,673
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
events_for_onchain_secretreveal_if_closed
def events_for_onchain_secretreveal_if_closed( channelmap: ChannelMap, transfers_pair: List[MediationPairState], secret: Secret, secrethash: SecretHash, block_hash: BlockHash, ) -> List[Event]: """ Register the secret on-chain if the payer channel is already closed and th...
python
def events_for_onchain_secretreveal_if_closed( channelmap: ChannelMap, transfers_pair: List[MediationPairState], secret: Secret, secrethash: SecretHash, block_hash: BlockHash, ) -> List[Event]: """ Register the secret on-chain if the payer channel is already closed and th...
[ "def", "events_for_onchain_secretreveal_if_closed", "(", "channelmap", ":", "ChannelMap", ",", "transfers_pair", ":", "List", "[", "MediationPairState", "]", ",", "secret", ":", "Secret", ",", "secrethash", ":", "SecretHash", ",", "block_hash", ":", "BlockHash", ","...
Register the secret on-chain if the payer channel is already closed and the mediator learned the secret off-chain. Balance proofs are not exchanged for closed channels, so there is no reason to wait for the unsafe region to register secret. Note: If the secret is learned before the channel is...
[ "Register", "the", "secret", "on", "-", "chain", "if", "the", "payer", "channel", "is", "already", "closed", "and", "the", "mediator", "learned", "the", "secret", "off", "-", "chain", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L936-L995
221,674
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
events_to_remove_expired_locks
def events_to_remove_expired_locks( mediator_state: MediatorTransferState, channelidentifiers_to_channels: ChannelMap, block_number: BlockNumber, pseudo_random_generator: random.Random, ) -> List[Event]: """ Clear the channels which have expired locks. This only considers the *s...
python
def events_to_remove_expired_locks( mediator_state: MediatorTransferState, channelidentifiers_to_channels: ChannelMap, block_number: BlockNumber, pseudo_random_generator: random.Random, ) -> List[Event]: """ Clear the channels which have expired locks. This only considers the *s...
[ "def", "events_to_remove_expired_locks", "(", "mediator_state", ":", "MediatorTransferState", ",", "channelidentifiers_to_channels", ":", "ChannelMap", ",", "block_number", ":", "BlockNumber", ",", "pseudo_random_generator", ":", "random", ".", "Random", ",", ")", "->", ...
Clear the channels which have expired locks. This only considers the *sent* transfers, received transfers can only be updated by the partner.
[ "Clear", "the", "channels", "which", "have", "expired", "locks", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L998-L1053
221,675
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
secret_learned
def secret_learned( state: MediatorTransferState, channelidentifiers_to_channels: ChannelMap, pseudo_random_generator: random.Random, block_number: BlockNumber, block_hash: BlockHash, secret: Secret, secrethash: SecretHash, payee_address: Address, ) -> Tra...
python
def secret_learned( state: MediatorTransferState, channelidentifiers_to_channels: ChannelMap, pseudo_random_generator: random.Random, block_number: BlockNumber, block_hash: BlockHash, secret: Secret, secrethash: SecretHash, payee_address: Address, ) -> Tra...
[ "def", "secret_learned", "(", "state", ":", "MediatorTransferState", ",", "channelidentifiers_to_channels", ":", "ChannelMap", ",", "pseudo_random_generator", ":", "random", ".", "Random", ",", "block_number", ":", "BlockNumber", ",", "block_hash", ":", "BlockHash", "...
Unlock the payee lock, reveal the lock to the payer, and if necessary register the secret on-chain.
[ "Unlock", "the", "payee", "lock", "reveal", "the", "lock", "to", "the", "payer", "and", "if", "necessary", "register", "the", "secret", "on", "-", "chain", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L1056-L1107
221,676
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
mediate_transfer
def mediate_transfer( state: MediatorTransferState, possible_routes: List['RouteState'], payer_channel: NettingChannelState, channelidentifiers_to_channels: ChannelMap, nodeaddresses_to_networkstates: NodeNetworkStateMap, pseudo_random_generator: random.Random, pa...
python
def mediate_transfer( state: MediatorTransferState, possible_routes: List['RouteState'], payer_channel: NettingChannelState, channelidentifiers_to_channels: ChannelMap, nodeaddresses_to_networkstates: NodeNetworkStateMap, pseudo_random_generator: random.Random, pa...
[ "def", "mediate_transfer", "(", "state", ":", "MediatorTransferState", ",", "possible_routes", ":", "List", "[", "'RouteState'", "]", ",", "payer_channel", ":", "NettingChannelState", ",", "channelidentifiers_to_channels", ":", "ChannelMap", ",", "nodeaddresses_to_network...
Try a new route or fail back to a refund. The mediator can safely try a new route knowing that the tokens from payer_transfer will cover the expenses of the mediation. If there is no route available that may be used at the moment of the call the mediator may send a refund back to the payer, allowing th...
[ "Try", "a", "new", "route", "or", "fail", "back", "to", "a", "refund", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L1110-L1180
221,677
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
handle_onchain_secretreveal
def handle_onchain_secretreveal( mediator_state: MediatorTransferState, onchain_secret_reveal: ContractReceiveSecretReveal, channelidentifiers_to_channels: ChannelMap, pseudo_random_generator: random.Random, block_number: BlockNumber, ) -> TransitionResult[MediatorTransferState]:...
python
def handle_onchain_secretreveal( mediator_state: MediatorTransferState, onchain_secret_reveal: ContractReceiveSecretReveal, channelidentifiers_to_channels: ChannelMap, pseudo_random_generator: random.Random, block_number: BlockNumber, ) -> TransitionResult[MediatorTransferState]:...
[ "def", "handle_onchain_secretreveal", "(", "mediator_state", ":", "MediatorTransferState", ",", "onchain_secret_reveal", ":", "ContractReceiveSecretReveal", ",", "channelidentifiers_to_channels", ":", "ChannelMap", ",", "pseudo_random_generator", ":", "random", ".", "Random", ...
The secret was revealed on-chain, set the state of all transfers to secret known.
[ "The", "secret", "was", "revealed", "on", "-", "chain", "set", "the", "state", "of", "all", "transfers", "to", "secret", "known", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L1384-L1426
221,678
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
handle_unlock
def handle_unlock( mediator_state: MediatorTransferState, state_change: ReceiveUnlock, channelidentifiers_to_channels: ChannelMap, ) -> TransitionResult[MediatorTransferState]: """ Handle a ReceiveUnlock state change. """ events = list() balance_proof_sender = state_change.balance_pr...
python
def handle_unlock( mediator_state: MediatorTransferState, state_change: ReceiveUnlock, channelidentifiers_to_channels: ChannelMap, ) -> TransitionResult[MediatorTransferState]: """ Handle a ReceiveUnlock state change. """ events = list() balance_proof_sender = state_change.balance_pr...
[ "def", "handle_unlock", "(", "mediator_state", ":", "MediatorTransferState", ",", "state_change", ":", "ReceiveUnlock", ",", "channelidentifiers_to_channels", ":", "ChannelMap", ",", ")", "->", "TransitionResult", "[", "MediatorTransferState", "]", ":", "events", "=", ...
Handle a ReceiveUnlock state change.
[ "Handle", "a", "ReceiveUnlock", "state", "change", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L1429-L1467
221,679
raiden-network/raiden
raiden/network/proxies/service_registry.py
ServiceRegistry.service_count
def service_count(self, block_identifier: BlockSpecification) -> int: """Get the number of registered services""" result = self.proxy.contract.functions.serviceCount().call( block_identifier=block_identifier, ) return result
python
def service_count(self, block_identifier: BlockSpecification) -> int: """Get the number of registered services""" result = self.proxy.contract.functions.serviceCount().call( block_identifier=block_identifier, ) return result
[ "def", "service_count", "(", "self", ",", "block_identifier", ":", "BlockSpecification", ")", "->", "int", ":", "result", "=", "self", ".", "proxy", ".", "contract", ".", "functions", ".", "serviceCount", "(", ")", ".", "call", "(", "block_identifier", "=", ...
Get the number of registered services
[ "Get", "the", "number", "of", "registered", "services" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/service_registry.py#L46-L51
221,680
raiden-network/raiden
raiden/network/proxies/service_registry.py
ServiceRegistry.get_service_address
def get_service_address( self, block_identifier: BlockSpecification, index: int, ) -> Optional[AddressHex]: """Gets the address of a service by index. If index is out of range return None""" try: result = self.proxy.contract.functions.service_addresses...
python
def get_service_address( self, block_identifier: BlockSpecification, index: int, ) -> Optional[AddressHex]: """Gets the address of a service by index. If index is out of range return None""" try: result = self.proxy.contract.functions.service_addresses...
[ "def", "get_service_address", "(", "self", ",", "block_identifier", ":", "BlockSpecification", ",", "index", ":", "int", ",", ")", "->", "Optional", "[", "AddressHex", "]", ":", "try", ":", "result", "=", "self", ".", "proxy", ".", "contract", ".", "functi...
Gets the address of a service by index. If index is out of range return None
[ "Gets", "the", "address", "of", "a", "service", "by", "index", ".", "If", "index", "is", "out", "of", "range", "return", "None" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/service_registry.py#L53-L65
221,681
raiden-network/raiden
raiden/network/proxies/service_registry.py
ServiceRegistry.get_service_url
def get_service_url( self, block_identifier: BlockSpecification, service_hex_address: AddressHex, ) -> Optional[str]: """Gets the URL of a service by address. If does not exist return None""" result = self.proxy.contract.functions.urls(service_hex_address).call( ...
python
def get_service_url( self, block_identifier: BlockSpecification, service_hex_address: AddressHex, ) -> Optional[str]: """Gets the URL of a service by address. If does not exist return None""" result = self.proxy.contract.functions.urls(service_hex_address).call( ...
[ "def", "get_service_url", "(", "self", ",", "block_identifier", ":", "BlockSpecification", ",", "service_hex_address", ":", "AddressHex", ",", ")", "->", "Optional", "[", "str", "]", ":", "result", "=", "self", ".", "proxy", ".", "contract", ".", "functions", ...
Gets the URL of a service by address. If does not exist return None
[ "Gets", "the", "URL", "of", "a", "service", "by", "address", ".", "If", "does", "not", "exist", "return", "None" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/service_registry.py#L67-L78
221,682
raiden-network/raiden
raiden/network/proxies/service_registry.py
ServiceRegistry.set_url
def set_url(self, url: str): """Sets the url needed to access the service via HTTP for the caller""" gas_limit = self.proxy.estimate_gas('latest', 'setURL', url) transaction_hash = self.proxy.transact('setURL', gas_limit, url) self.client.poll(transaction_hash) assert not check_t...
python
def set_url(self, url: str): """Sets the url needed to access the service via HTTP for the caller""" gas_limit = self.proxy.estimate_gas('latest', 'setURL', url) transaction_hash = self.proxy.transact('setURL', gas_limit, url) self.client.poll(transaction_hash) assert not check_t...
[ "def", "set_url", "(", "self", ",", "url", ":", "str", ")", ":", "gas_limit", "=", "self", ".", "proxy", ".", "estimate_gas", "(", "'latest'", ",", "'setURL'", ",", "url", ")", "transaction_hash", "=", "self", ".", "proxy", ".", "transact", "(", "'setU...
Sets the url needed to access the service via HTTP for the caller
[ "Sets", "the", "url", "needed", "to", "access", "the", "service", "via", "HTTP", "for", "the", "caller" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/service_registry.py#L80-L85
221,683
raiden-network/raiden
raiden/utils/signer.py
recover
def recover( data: bytes, signature: Signature, hasher: Callable[[bytes], bytes] = eth_sign_sha3, ) -> Address: """ eth_recover address from data hash and signature """ _hash = hasher(data) # ecdsa_recover accepts only standard [0,1] v's so we add support also for [27,28] here #...
python
def recover( data: bytes, signature: Signature, hasher: Callable[[bytes], bytes] = eth_sign_sha3, ) -> Address: """ eth_recover address from data hash and signature """ _hash = hasher(data) # ecdsa_recover accepts only standard [0,1] v's so we add support also for [27,28] here #...
[ "def", "recover", "(", "data", ":", "bytes", ",", "signature", ":", "Signature", ",", "hasher", ":", "Callable", "[", "[", "bytes", "]", ",", "bytes", "]", "=", "eth_sign_sha3", ",", ")", "->", "Address", ":", "_hash", "=", "hasher", "(", "data", ")"...
eth_recover address from data hash and signature
[ "eth_recover", "address", "from", "data", "hash", "and", "signature" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/signer.py#L23-L41
221,684
raiden-network/raiden
raiden/utils/signer.py
LocalSigner.sign
def sign(self, data: bytes, v: int = 27) -> Signature: """ Sign data hash with local private key """ assert v in (0, 27), 'Raiden is only signing messages with v in (0, 27)' _hash = eth_sign_sha3(data) signature = self.private_key.sign_msg_hash(message_hash=_hash) sig_bytes = sig...
python
def sign(self, data: bytes, v: int = 27) -> Signature: """ Sign data hash with local private key """ assert v in (0, 27), 'Raiden is only signing messages with v in (0, 27)' _hash = eth_sign_sha3(data) signature = self.private_key.sign_msg_hash(message_hash=_hash) sig_bytes = sig...
[ "def", "sign", "(", "self", ",", "data", ":", "bytes", ",", "v", ":", "int", "=", "27", ")", "->", "Signature", ":", "assert", "v", "in", "(", "0", ",", "27", ")", ",", "'Raiden is only signing messages with v in (0, 27)'", "_hash", "=", "eth_sign_sha3", ...
Sign data hash with local private key
[ "Sign", "data", "hash", "with", "local", "private", "key" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/signer.py#L83-L90
221,685
raiden-network/raiden
raiden/network/proxies/token.py
Token.approve
def approve( self, allowed_address: Address, allowance: TokenAmount, ): """ Aprove `allowed_address` to transfer up to `deposit` amount of token. Note: For channel deposit please use the channel proxy, since it does additional validations...
python
def approve( self, allowed_address: Address, allowance: TokenAmount, ): """ Aprove `allowed_address` to transfer up to `deposit` amount of token. Note: For channel deposit please use the channel proxy, since it does additional validations...
[ "def", "approve", "(", "self", ",", "allowed_address", ":", "Address", ",", "allowance", ":", "TokenAmount", ",", ")", ":", "# Note that given_block_identifier is not used here as there", "# are no preconditions to check before sending the transaction", "log_details", "=", "{",...
Aprove `allowed_address` to transfer up to `deposit` amount of token. Note: For channel deposit please use the channel proxy, since it does additional validations.
[ "Aprove", "allowed_address", "to", "transfer", "up", "to", "deposit", "amount", "of", "token", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/token.py#L49-L112
221,686
raiden-network/raiden
raiden/network/proxies/token.py
Token.balance_of
def balance_of(self, address, block_identifier='latest'): """ Return the balance of `address`. """ return self.proxy.contract.functions.balanceOf( to_checksum_address(address), ).call(block_identifier=block_identifier)
python
def balance_of(self, address, block_identifier='latest'): """ Return the balance of `address`. """ return self.proxy.contract.functions.balanceOf( to_checksum_address(address), ).call(block_identifier=block_identifier)
[ "def", "balance_of", "(", "self", ",", "address", ",", "block_identifier", "=", "'latest'", ")", ":", "return", "self", ".", "proxy", ".", "contract", ".", "functions", ".", "balanceOf", "(", "to_checksum_address", "(", "address", ")", ",", ")", ".", "call...
Return the balance of `address`.
[ "Return", "the", "balance", "of", "address", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/token.py#L158-L162
221,687
raiden-network/raiden
raiden/network/proxies/token.py
Token.total_supply
def total_supply(self, block_identifier='latest'): """ Return the total supply of the token at the given block identifier. """ return self.proxy.contract.functions.totalSupply().call(block_identifier=block_identifier)
python
def total_supply(self, block_identifier='latest'): """ Return the total supply of the token at the given block identifier. """ return self.proxy.contract.functions.totalSupply().call(block_identifier=block_identifier)
[ "def", "total_supply", "(", "self", ",", "block_identifier", "=", "'latest'", ")", ":", "return", "self", ".", "proxy", ".", "contract", ".", "functions", ".", "totalSupply", "(", ")", ".", "call", "(", "block_identifier", "=", "block_identifier", ")" ]
Return the total supply of the token at the given block identifier.
[ "Return", "the", "total", "supply", "of", "the", "token", "at", "the", "given", "block", "identifier", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/token.py#L164-L166
221,688
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator_manager.py
clear_if_finalized
def clear_if_finalized( iteration: TransitionResult, ) -> TransitionResult[InitiatorPaymentState]: """ Clear the initiator payment task if all transfers have been finalized or expired. """ state = cast(InitiatorPaymentState, iteration.new_state) if state is None: return iteration i...
python
def clear_if_finalized( iteration: TransitionResult, ) -> TransitionResult[InitiatorPaymentState]: """ Clear the initiator payment task if all transfers have been finalized or expired. """ state = cast(InitiatorPaymentState, iteration.new_state) if state is None: return iteration i...
[ "def", "clear_if_finalized", "(", "iteration", ":", "TransitionResult", ",", ")", "->", "TransitionResult", "[", "InitiatorPaymentState", "]", ":", "state", "=", "cast", "(", "InitiatorPaymentState", ",", "iteration", ".", "new_state", ")", "if", "state", "is", ...
Clear the initiator payment task if all transfers have been finalized or expired.
[ "Clear", "the", "initiator", "payment", "task", "if", "all", "transfers", "have", "been", "finalized", "or", "expired", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator_manager.py#L34-L47
221,689
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator_manager.py
cancel_current_route
def cancel_current_route( payment_state: InitiatorPaymentState, initiator_state: InitiatorTransferState, ) -> List[Event]: """ Cancel current route. This allows a new route to be tried. """ assert can_cancel(initiator_state), 'Cannot cancel a route after the secret is revealed' tra...
python
def cancel_current_route( payment_state: InitiatorPaymentState, initiator_state: InitiatorTransferState, ) -> List[Event]: """ Cancel current route. This allows a new route to be tried. """ assert can_cancel(initiator_state), 'Cannot cancel a route after the secret is revealed' tra...
[ "def", "cancel_current_route", "(", "payment_state", ":", "InitiatorPaymentState", ",", "initiator_state", ":", "InitiatorTransferState", ",", ")", "->", "List", "[", "Event", "]", ":", "assert", "can_cancel", "(", "initiator_state", ")", ",", "'Cannot cancel a route ...
Cancel current route. This allows a new route to be tried.
[ "Cancel", "current", "route", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator_manager.py#L81-L95
221,690
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator_manager.py
subdispatch_to_all_initiatortransfer
def subdispatch_to_all_initiatortransfer( payment_state: InitiatorPaymentState, state_change: StateChange, channelidentifiers_to_channels: ChannelMap, pseudo_random_generator: random.Random, ) -> TransitionResult[InitiatorPaymentState]: events = list() ''' Copy and iterate over t...
python
def subdispatch_to_all_initiatortransfer( payment_state: InitiatorPaymentState, state_change: StateChange, channelidentifiers_to_channels: ChannelMap, pseudo_random_generator: random.Random, ) -> TransitionResult[InitiatorPaymentState]: events = list() ''' Copy and iterate over t...
[ "def", "subdispatch_to_all_initiatortransfer", "(", "payment_state", ":", "InitiatorPaymentState", ",", "state_change", ":", "StateChange", ",", "channelidentifiers_to_channels", ":", "ChannelMap", ",", "pseudo_random_generator", ":", "random", ".", "Random", ",", ")", "-...
Copy and iterate over the list of keys because this loop will alter the `initiator_transfers` list and this is not allowed if iterating over the original list.
[ "Copy", "and", "iterate", "over", "the", "list", "of", "keys", "because", "this", "loop", "will", "alter", "the", "initiator_transfers", "list", "and", "this", "is", "not", "allowed", "if", "iterating", "over", "the", "original", "list", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator_manager.py#L163-L184
221,691
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator_manager.py
handle_cancelpayment
def handle_cancelpayment( payment_state: InitiatorPaymentState, channelidentifiers_to_channels: ChannelMap, ) -> TransitionResult[InitiatorPaymentState]: """ Cancel the payment and all related transfers. """ # Cannot cancel a transfer after the secret is revealed events = list() for init...
python
def handle_cancelpayment( payment_state: InitiatorPaymentState, channelidentifiers_to_channels: ChannelMap, ) -> TransitionResult[InitiatorPaymentState]: """ Cancel the payment and all related transfers. """ # Cannot cancel a transfer after the secret is revealed events = list() for init...
[ "def", "handle_cancelpayment", "(", "payment_state", ":", "InitiatorPaymentState", ",", "channelidentifiers_to_channels", ":", "ChannelMap", ",", ")", "->", "TransitionResult", "[", "InitiatorPaymentState", "]", ":", "# Cannot cancel a transfer after the secret is revealed", "e...
Cancel the payment and all related transfers.
[ "Cancel", "the", "payment", "and", "all", "related", "transfers", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator_manager.py#L232-L263
221,692
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator_manager.py
handle_lock_expired
def handle_lock_expired( payment_state: InitiatorPaymentState, state_change: ReceiveLockExpired, channelidentifiers_to_channels: ChannelMap, block_number: BlockNumber, ) -> TransitionResult[InitiatorPaymentState]: """Initiator also needs to handle LockExpired messages when refund tra...
python
def handle_lock_expired( payment_state: InitiatorPaymentState, state_change: ReceiveLockExpired, channelidentifiers_to_channels: ChannelMap, block_number: BlockNumber, ) -> TransitionResult[InitiatorPaymentState]: """Initiator also needs to handle LockExpired messages when refund tra...
[ "def", "handle_lock_expired", "(", "payment_state", ":", "InitiatorPaymentState", ",", "state_change", ":", "ReceiveLockExpired", ",", "channelidentifiers_to_channels", ":", "ChannelMap", ",", "block_number", ":", "BlockNumber", ",", ")", "->", "TransitionResult", "[", ...
Initiator also needs to handle LockExpired messages when refund transfers are involved. A -> B -> C - A sends locked transfer to B - B attempted to forward to C but has not enough capacity - B sends a refund transfer with the same secrethash back to A - When the lock expires B will also send a Loc...
[ "Initiator", "also", "needs", "to", "handle", "LockExpired", "messages", "when", "refund", "transfers", "are", "involved", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator_manager.py#L340-L385
221,693
raiden-network/raiden
raiden/network/rpc/middleware.py
http_retry_with_backoff_middleware
def http_retry_with_backoff_middleware( make_request, web3, # pylint: disable=unused-argument errors: Tuple = ( exceptions.ConnectionError, exceptions.HTTPError, exceptions.Timeout, exceptions.TooManyRedirects, ), retries: int = 10...
python
def http_retry_with_backoff_middleware( make_request, web3, # pylint: disable=unused-argument errors: Tuple = ( exceptions.ConnectionError, exceptions.HTTPError, exceptions.Timeout, exceptions.TooManyRedirects, ), retries: int = 10...
[ "def", "http_retry_with_backoff_middleware", "(", "make_request", ",", "web3", ",", "# pylint: disable=unused-argument", "errors", ":", "Tuple", "=", "(", "exceptions", ".", "ConnectionError", ",", "exceptions", ".", "HTTPError", ",", "exceptions", ".", "Timeout", ","...
Retry requests with exponential backoff Creates middleware that retries failed HTTP requests and exponentially increases the backoff between retries. Meant to replace the default middleware `http_retry_request_middleware` for HTTPProvider.
[ "Retry", "requests", "with", "exponential", "backoff", "Creates", "middleware", "that", "retries", "failed", "HTTP", "requests", "and", "exponentially", "increases", "the", "backoff", "between", "retries", ".", "Meant", "to", "replace", "the", "default", "middleware...
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/middleware.py#L52-L86
221,694
raiden-network/raiden
raiden/network/pathfinding.py
get_random_service
def get_random_service( service_registry: ServiceRegistry, block_identifier: BlockSpecification, ) -> Tuple[Optional[str], Optional[str]]: """Selects a random PFS from service_registry. Returns a tuple of the chosen services url and eth address. If there are no PFS in the given registry, it...
python
def get_random_service( service_registry: ServiceRegistry, block_identifier: BlockSpecification, ) -> Tuple[Optional[str], Optional[str]]: """Selects a random PFS from service_registry. Returns a tuple of the chosen services url and eth address. If there are no PFS in the given registry, it...
[ "def", "get_random_service", "(", "service_registry", ":", "ServiceRegistry", ",", "block_identifier", ":", "BlockSpecification", ",", ")", "->", "Tuple", "[", "Optional", "[", "str", "]", ",", "Optional", "[", "str", "]", "]", ":", "count", "=", "service_regi...
Selects a random PFS from service_registry. Returns a tuple of the chosen services url and eth address. If there are no PFS in the given registry, it returns (None, None).
[ "Selects", "a", "random", "PFS", "from", "service_registry", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/pathfinding.py#L81-L106
221,695
raiden-network/raiden
raiden/network/pathfinding.py
configure_pfs_or_exit
def configure_pfs_or_exit( pfs_address: Optional[str], pfs_eth_address: Optional[str], routing_mode: RoutingMode, service_registry, ) -> Optional[PFSConfiguration]: """ Take in the given pfs_address argument, the service registry and find out a pfs address to use. If pfs...
python
def configure_pfs_or_exit( pfs_address: Optional[str], pfs_eth_address: Optional[str], routing_mode: RoutingMode, service_registry, ) -> Optional[PFSConfiguration]: """ Take in the given pfs_address argument, the service registry and find out a pfs address to use. If pfs...
[ "def", "configure_pfs_or_exit", "(", "pfs_address", ":", "Optional", "[", "str", "]", ",", "pfs_eth_address", ":", "Optional", "[", "str", "]", ",", "routing_mode", ":", "RoutingMode", ",", "service_registry", ",", ")", "->", "Optional", "[", "PFSConfiguration",...
Take in the given pfs_address argument, the service registry and find out a pfs address to use. If pfs_address is None then basic routing must have been requested. If pfs_address is provided we use that. If pfs_address is 'auto' then we randomly choose a PFS address from the registry Returns a Nam...
[ "Take", "in", "the", "given", "pfs_address", "argument", "the", "service", "registry", "and", "find", "out", "a", "pfs", "address", "to", "use", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/pathfinding.py#L132-L192
221,696
raiden-network/raiden
raiden/network/pathfinding.py
query_paths
def query_paths( service_config: Dict[str, Any], our_address: Address, privkey: bytes, current_block_number: BlockNumber, token_network_address: Union[TokenNetworkAddress, TokenNetworkID], route_from: InitiatorAddress, route_to: TargetAddress, value: Payme...
python
def query_paths( service_config: Dict[str, Any], our_address: Address, privkey: bytes, current_block_number: BlockNumber, token_network_address: Union[TokenNetworkAddress, TokenNetworkID], route_from: InitiatorAddress, route_to: TargetAddress, value: Payme...
[ "def", "query_paths", "(", "service_config", ":", "Dict", "[", "str", ",", "Any", "]", ",", "our_address", ":", "Address", ",", "privkey", ":", "bytes", ",", "current_block_number", ":", "BlockNumber", ",", "token_network_address", ":", "Union", "[", "TokenNet...
Query paths from the PFS. Send a request to the /paths endpoint of the PFS specified in service_config, and retry in case of a failed request if it makes sense.
[ "Query", "paths", "from", "the", "PFS", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/pathfinding.py#L362-L421
221,697
raiden-network/raiden
raiden/network/transport/udp/udp_transport.py
single_queue_send
def single_queue_send( transport: 'UDPTransport', recipient: Address, queue: Queue_T, queue_identifier: QueueIdentifier, event_stop: Event, event_healthy: Event, event_unhealthy: Event, message_retries: int, message_retry_timeout: int, mess...
python
def single_queue_send( transport: 'UDPTransport', recipient: Address, queue: Queue_T, queue_identifier: QueueIdentifier, event_stop: Event, event_healthy: Event, event_unhealthy: Event, message_retries: int, message_retry_timeout: int, mess...
[ "def", "single_queue_send", "(", "transport", ":", "'UDPTransport'", ",", "recipient", ":", "Address", ",", "queue", ":", "Queue_T", ",", "queue_identifier", ":", "QueueIdentifier", ",", "event_stop", ":", "Event", ",", "event_healthy", ":", "Event", ",", "event...
Handles a single message queue for `recipient`. Notes: - This task must be the only consumer of queue. - This task can be killed at any time, but the intended usage is to stop it with the event_stop. - If there are many queues for the same recipient, it is the caller's responsibility to not...
[ "Handles", "a", "single", "message", "queue", "for", "recipient", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/udp/udp_transport.py#L57-L163
221,698
raiden-network/raiden
raiden/network/transport/udp/udp_transport.py
UDPTransport.get_health_events
def get_health_events(self, recipient): """ Starts a healthcheck task for `recipient` and returns a HealthEvents with locks to react on its current state. """ if recipient not in self.addresses_events: self.start_health_check(recipient) return self.addresses_events[r...
python
def get_health_events(self, recipient): """ Starts a healthcheck task for `recipient` and returns a HealthEvents with locks to react on its current state. """ if recipient not in self.addresses_events: self.start_health_check(recipient) return self.addresses_events[r...
[ "def", "get_health_events", "(", "self", ",", "recipient", ")", ":", "if", "recipient", "not", "in", "self", ".", "addresses_events", ":", "self", ".", "start_health_check", "(", "recipient", ")", "return", "self", ".", "addresses_events", "[", "recipient", "]...
Starts a healthcheck task for `recipient` and returns a HealthEvents with locks to react on its current state.
[ "Starts", "a", "healthcheck", "task", "for", "recipient", "and", "returns", "a", "HealthEvents", "with", "locks", "to", "react", "on", "its", "current", "state", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/udp/udp_transport.py#L287-L294
221,699
raiden-network/raiden
raiden/network/transport/udp/udp_transport.py
UDPTransport.start_health_check
def start_health_check(self, recipient): """ Starts a task for healthchecking `recipient` if there is not one yet. It also whitelists the address """ if recipient not in self.addresses_events: self.whitelist(recipient) # noop for now, for compatibility p...
python
def start_health_check(self, recipient): """ Starts a task for healthchecking `recipient` if there is not one yet. It also whitelists the address """ if recipient not in self.addresses_events: self.whitelist(recipient) # noop for now, for compatibility p...
[ "def", "start_health_check", "(", "self", ",", "recipient", ")", ":", "if", "recipient", "not", "in", "self", ".", "addresses_events", ":", "self", ".", "whitelist", "(", "recipient", ")", "# noop for now, for compatibility", "ping_nonce", "=", "self", ".", "nod...
Starts a task for healthchecking `recipient` if there is not one yet. It also whitelists the address
[ "Starts", "a", "task", "for", "healthchecking", "recipient", "if", "there", "is", "not", "one", "yet", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/udp/udp_transport.py#L305-L339