Click option group that initializes the proxy. You can use this to setup your own app
Example:
from microraiden.click_helpers import main, pass_app
@main.command()
@click.option('--my-option', default=True)
@pass_app
def start(app, my_option):
app.run()
app.join()
if __name_ == "__main__":
main()
Utility module used to close all open channels of the channel manager.
Example:
$ python -m microraiden.close_all_channels --private-key ~/.keys/my_key.json
microraiden.close_all_channels.
close_open_channels
(private_key, state, channel_manager_contract, gas_price=None, wait=<function <lambda>>)[source]¶Closes all open channels that belong to a receiver.
Parameters: |
|
---|
This module contains network-specific defaults for different networks. You can change i.e. gas price, gas limits, or contract address here.
Example
Set global network defaults for ropsten:
from config import NETWORK_CFG
from constants import get_network_id
NETWORK_CFG.set_defaults(get_network_id('ropsten'))
Change global gas price:
from config import NETWORK_CFG
NETWORK_CFG.gas_price = 15 * denoms.gwei
This file contains configuration constants you probably don’t need to change
microraiden.constants.
API_PATH
= '/api/1'¶str – api path prefix
microraiden.constants.
CHANNEL_MANAGER_ABI_NAME
= 'RaidenMicroTransferChannels'¶str – name of the channel manager contract
microraiden.constants.
CHANNEL_MANAGER_CONTRACT_VERSION
= '0.2.0'¶str – required version of the deployed contract at CHANNEL_MANAGER_ADDRESS. Proxy will refuse to start if the major or minor versions do not match.
microraiden.constants.
CONTRACTS_ABI_JSON
= 'data/contracts.json'¶str – compiled contracts path
microraiden.constants.
HTML_DIR
= '/home/docs/checkouts/readthedocs.org/user_builds/microraiden/checkouts/latest/microraiden/webui'¶str – webUI sources directory
microraiden.constants.
JSLIB_DIR
= '/home/docs/checkouts/readthedocs.org/user_builds/microraiden/checkouts/latest/microraiden/webui/js'¶str – javascript directory
microraiden.constants.
JSPREFIX_URL
= '/js'¶str – url prefix for jslib dir
microraiden.constants.
MICRORAIDEN_DIR
= '/home/docs/checkouts/readthedocs.org/user_builds/microraiden/checkouts/latest'¶str – absolute path to module directory. Used to find path to the webUI sources
microraiden.constants.
MICRORAIDEN_VERSION
= '0.2.6'¶str – version of Microraiden library
microraiden.constants.
PROXY_BALANCE_LIMIT
= 100000000¶int – proxy will stop serving requests if receiver balance is below PROXY_BALANCE_LIMIT
microraiden.constants.
TKN_DECIMALS
= 1000000000000000000¶int – decimals of the token. Any price that’s set for the proxy resources is multiplied by this.
microraiden.constants.
TOKEN_ABI_NAME
= 'CustomToken'¶str – name of the token contract
microraiden.constants.
WEB3_PROVIDER_DEFAULT
= 'http://127.0.0.1:8545'¶str – ethereum node RPC interface URL
microraiden.exceptions.
InsecureStateFile
[source]¶Bases: microraiden.exceptions.StateFileException
Permissions of the state file do not match (0600 is expected).
microraiden.exceptions.
InsufficientConfirmations
[source]¶Bases: microraiden.exceptions.MicroRaidenException
uRaiden channel doesn’t have enough confirmations.
microraiden.exceptions.
InvalidBalanceAmount
[source]¶Bases: microraiden.exceptions.MicroRaidenException
Raised if the payment contains lesser balance than the previous one.
microraiden.exceptions.
InvalidBalanceProof
[source]¶Bases: microraiden.exceptions.MicroRaidenException
Balance proof data do not make sense.
microraiden.exceptions.
InvalidContractVersion
[source]¶Bases: microraiden.exceptions.MicroRaidenException
Library is not compatible with the deployed contract version
microraiden.exceptions.
MicroRaidenException
[source]¶Bases: Exception
Base exception for uRaiden
microraiden.exceptions.
NetworkIdMismatch
[source]¶Bases: microraiden.exceptions.StateFileException
RPC endpoint and database have different network id.
microraiden.exceptions.
NoBalanceProofReceived
[source]¶Bases: microraiden.exceptions.MicroRaidenException
Attempt to close channel with no registered payments.
microraiden.exceptions.
NoOpenChannel
[source]¶Bases: microraiden.exceptions.MicroRaidenException
Attempt to use nonexisting channel.
microraiden.exceptions.
StateContractAddrMismatch
[source]¶Bases: microraiden.exceptions.StateFileException
Stored state contract address doesn’t match.
microraiden.exceptions.
StateFileException
[source]¶Bases: microraiden.exceptions.MicroRaidenException
Base exception class for state file (database) operations
microraiden.exceptions.
StateFileLocked
[source]¶Bases: microraiden.exceptions.StateFileException
Another process is already using the database
microraiden.exceptions.
StateReceiverAddrMismatch
[source]¶Bases: microraiden.exceptions.StateFileException
Stored state receiver address doesn’t match.
microraiden.header.
HTTPHeaders
[source]¶Bases: object
BALANCE
= 'RDN-Balance'¶BALANCE_SIGNATURE
= 'RDN-Balance-Signature'¶CONTRACT_ADDRESS
= 'RDN-Contract-Address'¶COST
= 'RDN-Cost'¶DESERIALIZE_DICT
= None¶GATEWAY_PATH
= 'RDN-Gateway-Path'¶INSUF_CONFS
= 'RDN-Insufficient-Confirmations'¶INVALID_AMOUNT
= 'RDN-Invalid-Amount'¶INVALID_PROOF
= 'RDN-Invalid-Balance-Proof'¶NONEXISTING_CHANNEL
= 'RDN-Nonexisting-Channel'¶OPEN_BLOCK
= 'RDN-Open-Block'¶PAYMENT
= 'RDN-Payment'¶PRICE
= 'RDN-Price'¶RECEIVER_ADDRESS
= 'RDN-Receiver-Address'¶SENDER_ADDRESS
= 'RDN-Sender-Address'¶SENDER_BALANCE
= 'RDN-Sender-Balance'¶SERIALIZE_DICT
= None¶TOKEN_ADDRESS
= 'RDN-Token-Address'¶Helper functions to make initialization of the components simpler
Example:
proxy = make_paywalled_proxy(receiver_privkey, '/tmp/proxy.db')
microraiden.make_helpers.
make_channel_manager
(private_key, channel_manager_address, state_filename, web3)[source]¶Parameters: |
|
---|---|
Returns: | intialized and synced channel manager |
Return type: |
microraiden.make_helpers.
make_channel_manager_contract
(web3, channel_manager_address)[source]¶Parameters: |
|
---|---|
Returns: | contract wrapper class |
Return type: | Contract |
microraiden.make_helpers.
make_paywalled_proxy
(private_key, state_filename, contract_address=None, flask_app=None, web3=None)[source]¶Parameters: |
|
---|---|
Returns: | an initialized proxy. Do not forget to call run() to start serving requests. |
Return type: |