コード例 #1
0
def parser_function(args: Namespace) -> str:
    client = Client(endpoint=args.endpoint, version=args.version)
    pending_transfers = client.pending_transfers(
        token_address=args.token_address,
        partner_address=args.partner_address,
    )
    return utils.print_stdout(pending_transfers)
コード例 #2
0
def parser_function(args: Namespace) -> str:
    client = Client(endpoint=args.endpoint, version=args.version)
    channel = client.channel_close(
        token_address=args.token_address,
        partner_address=args.partner_address,
    )
    return utils.print_stdout(channel)
コード例 #3
0
def parser_function(args: Namespace) -> str:
    client = Client(endpoint=args.endpoint, version=args.version)
    payment_events = client.payment_events(
        token_address=args.token_address,
        target_address=args.token_address,
    )
    return utils.print_stdout(payment_events)
コード例 #4
0
def parser_function(args: Namespace) -> str:
    client = Client(endpoint=args.endpoint, version=args.version)
    channel = client.channel_increase_withdraw(
        token_address=args.token_address,
        partner_address=args.partner_address,
        total_withdraw=args.total_withdraw,
    )
    return utils.print_stdout(channel)
コード例 #5
0
def parser_function(args: Namespace) -> str:
    client = Client(endpoint=args.endpoint, version=args.version)
    mint_tokens = client.mint_tokens(
        token_address=args.token_address,
        to=args.to,
        value=args.value,
        contract_method=args.contract_method,
    )
    return utils.print_stdout(mint_tokens)
コード例 #6
0
def parser_function(args: Namespace) -> str:
    client = Client(endpoint=args.endpoint, version=args.version)
    payment = client.payment(
        token_address=args.token_address,
        target_address=args.target_address,
        amount=args.amount,
        identifier=args.identifier,
    )
    return utils.print_stdout(payment)
コード例 #7
0
def parser_function(args: Namespace) -> str:
    client = Client(endpoint=args.endpoint, version=args.version)
    channel_open = client.channel_open(
        token_address=args.token_address,
        partner_address=args.partner_address,
        total_deposit=args.total_deposit,
        settle_timeout=args.settle_timeout,
    )
    return utils.print_stdout(channel_open)
コード例 #8
0
def parser_function(args: Namespace) -> str:
    client = Client(endpoint=args.endpoint, version=args.version)
    connection = client.connections_connect(
        token_address=args.token_address,
        funds=args.funds,
        initial_channel_target=args.initial_channel_target,
        joinable_funds_target=args.joinable_funds_target,
    )
    return utils.print_stdout(connection)
コード例 #9
0
def parser_function(args: Namespace) -> str:
    client = Client(endpoint=args.endpoint, version=args.version)
    address = client.address()
    return utils.print_stdout(address["our_address"])
コード例 #10
0
def parser_function(args: Namespace) -> str:
    client = Client(endpoint=args.endpoint, version=args.version)
    connection = client.connections()
    return utils.print_stdout(connection)
コード例 #11
0
def parser_function(args: Namespace) -> str:
    client = Client(endpoint=args.endpoint, version=args.version)
    non_settled_partners = client.non_settled_partners(
        token_address=args.token_address, )
    return utils.print_stdout(non_settled_partners)
コード例 #12
0
def parser_function(args: Namespace) -> str:
    client = Client(endpoint=args.endpoint, version=args.version)
    tokens = client.tokens(token_address=args.token_address)
    return utils.print_stdout(tokens)
コード例 #13
0
import importlib
import sys
from unittest import mock

import requests

from raiden_client import Client
from raiden_client.interfaces import cli_commands
from raiden_client.interfaces.cli import CLI_ENDPOINTS, create_main_parser, main

client = Client()

main_parser = create_main_parser()
subparsers = main_parser.add_subparsers()


def test_cli() -> None:
    """Simple test which just try to build CLI parser"""
    # When we run pytest tests/ , tests/ arg passed to CLI,
    # So we should remove this argument:
    sys.argv = [sys.argv[0]]
    assert main() is None


def test_each_command_has_executor() -> None:
    for plugin in CLI_ENDPOINTS:
        module = importlib.import_module(plugin)
        assert hasattr(module, "configure_parser")
        assert hasattr(module, "parser_function")