Here you can find the API of some of the important classes and methods of the µRaiden M2M-client framework. This documentation is auto-generated from the docstrings and type-hints in the source code, so if you have further questions please consult the source-code first.
microraiden.client.client.
Client
(private_key=None, key_password_path=None, channel_manager_address=None, web3=None)[source]__init__
(private_key=None, key_password_path=None, channel_manager_address=None, web3=None)[source]Parameters: |
|
---|---|
Return type: |
|
get_open_channels
(receiver=None)[source]Returns all open channels to the given receiver. If no receiver is specified, all open channels are returned.
Return type: | List [Channel ] |
---|
get_suitable_channel
(receiver, value, initial_deposit=<function Client.<lambda>>, topup_deposit=<function Client.<lambda>>)[source]Searches stored channels for one that can sustain the given transfer value. If none is found, a possibly open channel is topped up using the topup callable to determine its topup value. If both attempts fail, a new channel is created based on the initial deposit callable. Note: In the realistic case that only one channel is opened per (sender,receiver) pair, this method usually performs like this: 1. Directly return open channel if sufficiently funded. 2. Topup existing open channel if insufficiently funded. 3. Create new channel if no open channel exists. If topping up or creating fails, this method returns None. Channels are topped up just enough so that their remaining capacity equals topup_deposit(value).
Return type: | Channel |
---|
open_channel
(receiver_address, deposit)[source]Open a channel with a receiver and deposit
Attempts to open a new channel to the receiver with the given deposit. Blocks until the creation transaction is found in a pending block or timeout is reached.
Parameters: |
|
---|---|
Return type: |
|
Returns: | The opened channel, if successful. Otherwise None |
sync_channels
()[source]Merges locally available channel information, including their current balance signatures, with channel information available on the blockchain to make up for local data loss. Naturally, balance signatures cannot be recovered from the blockchain.
microraiden.client.channel.
Channel
(core, sender, receiver, block, deposit=0, balance=0, state=<State.open: 1>, on_settle=<function Channel.<lambda>>)[source]State
[source]An enumeration.
closed
= 3open
= 1settling
= 2balance
balance_sig
close
(balance=None)[source]Attempts to request close on a channel. An explicit balance can be given to override the locally stored balance signature. Blocks until a confirmation event is received or timeout.
close_cooperatively
(closing_sig)[source]Attempts to close the channel immediately by providing a hash of the channel’s balance proof signed by the receiver. This signature must correspond to the balance proof stored in the passed channel state.
create_transfer
(value)[source]Updates the given channel’s balance and balance signature with the new value. The signature is returned and stored in the channel state.
is_suitable
(value)[source]is_valid
()[source]Return type: | bool |
---|
key
Return type: | bytes |
---|
settle
()[source]Attempts to settle a channel that has passed its settlement period. If a channel cannot be settled yet, the call is ignored with a warning. Blocks until a confirmation event is received or timeout.
sign
()[source]topup
(deposit)[source]Attempts to increase the deposit in an existing channel. Block until confirmation.
update_balance
(value)[source]microraiden.client.session.
Session
(client=None, endpoint_url=None, retry_interval=5, initial_deposit=<function Session.<lambda>>, topup_deposit=<function Session.<lambda>>, close_channel_on_exit=False, **client_kwargs)[source]close
()[source]Closes all adapters and as such the session
close_channel
(endpoint_url=None)[source]on_cooperative_close_denied
(response=None)[source]on_exit
(method, url, response, **kwargs)[source]on_http_error
(method, url, response, **kwargs)[source]Return type: | bool |
---|
on_http_response
(method, url, response, **kwargs)[source]Called whenever server returns a reply. Return False to abort current request.
Return type: | bool |
---|
on_init
(method, url, **kwargs)[source]on_insufficient_confirmations
(method, url, response, **kwargs)[source]Return type: | bool |
---|
on_invalid_amount
(method, url, response, **kwargs)[source]Return type: | bool |
---|
on_invalid_balance_proof
(method, url, response, **kwargs)[source]Return type: | bool |
---|
on_invalid_contract_address
(method, url, response, **kwargs)[source]Return type: | bool |
---|
on_nonexisting_channel
(method, url, response, **kwargs)[source]Return type: | bool |
---|
on_payment_requested
(method, url, response, **kwargs)[source]Return type: | bool |
---|
on_success
(method, url, response, **kwargs)[source]Return type: | bool |
---|
request
(method, url, **kwargs)[source]Constructs a Request
, prepares it and sends it.
Returns Response
object.
Parameters: |
|
---|---|
Return type: | requests.Response |
microraiden.client.context.
Context
(private_key, web3, channel_manager_address)[source]