microraiden.client.channel.
Channel
(core, sender, receiver, block, deposit=0, balance=0, state=<State.open: 1>, on_settle=<function Channel.<lambda>>)[source]¶Bases: object
balance
¶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.
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.
microraiden.client.client.
Client
(private_key=None, key_password_path=None, channel_manager_address=None, web3=None)[source]¶Bases: object
__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 |
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]¶Bases: requests.sessions.Session
on_http_response
(method, url, response, **kwargs)[source]¶Called whenever server returns a reply. Return False to abort current request.
Return type: | bool |
---|
request
(method, url, **kwargs)[source]¶Constructs a Request
, prepares it and sends it.
Returns Response
object.
Parameters: |
|
---|---|
Return type: | requests.Response |