Beispiel #1
0
def blocks(hashes, json_block=False):
    payload = {
        "json_block": json_block,
        "hashes": hashes,
    }
    r = call("blocks", payload)
    return fix_json(r)
Beispiel #2
0
def wallet_balances(wallet, threshold=None, url=None):
    payload = {
        "wallet": wallet,
        **({"threshold": threshold} if threshold else {}),
    }
    r = call("wallet_balances", payload, url)
    return fix_json(r)
Beispiel #3
0
def wallet_history(wallet, modified_since=0):
    payload = {
        "wallet": wallet,
        "modified_since": modified_since,
    }
    r = call("wallet_history", payload)
    return fix_json(r)
Beispiel #4
0
def confirmation_quorum(peer_details=False, peers_stake_required=0):
    payload = {
        "peer_details": peer_details,
        "peers_stake_required": peers_stake_required,
    }
    r = call("confirmation_quorum", payload)
    return fix_json(r)
Beispiel #5
0
def block_info(hash, json_block=False):
    payload = {
        "json_block": json_block,
        "hash": hash,
    }
    r = call("block_info", payload)
    return fix_json(r)
Beispiel #6
0
def account_history(account,
                    count,
                    raw=False,
                    head="",
                    offset=0,
                    reverse=False,
                    account_filter=[]):
    payload = {
        "account": account,
        "count": count,
        "raw": raw,
        **({
            "head": head
        } if head != "" else {}),
        "offset": offset,
        "reverse": reverse,
        **({
            "account_filter": account_filter
        } if account_filter != [] else {}),
    }

    r = call("account_history", payload)
    r = fix_json(r)

    # hack to keep data structures consistent
    if r["history"] == {}:
        r["history"] = []

    return r
Beispiel #7
0
def unchecked_keys(key, count=-1, json_block=False):
    payload = {
        "key": key,
        "count": count,
        "json_block": json_block,
    }
    r = call("unchecked_keys", payload)
    return fix_json(r)
Beispiel #8
0
def wallet_representative_set(wallet, representative, update_existing_accounts=False, url=None):
    payload = {
        "wallet": wallet,
        "representative": representative,
        "update_existing_accounts": update_existing_accounts,
    }
    r = call("wallet_representative_set", payload, url)
    return fix_json(r)
Beispiel #9
0
def wallet_change_seed(wallet, seed, count=0, url=None):
    payload = {
        "wallet": wallet,
        "seed": seed,
        "count": count,
    }
    r = call("wallet_change_seed", payload, url)
    return fix_json(r)
Beispiel #10
0
def epoch_upgrade(epoch, key, count=None, url=None):
    payload = {
        "epoch": epoch,
        "key": key,
        **({"count": count} if count else {}),
    }
    r = call("epoch_upgrade", payload, url)
    return fix_json(r)
Beispiel #11
0
def wallet_change_seed(wallet, seed, count=0):
    payload = {
        "wallet": wallet,
        "seed": seed,
        "count": count,
    }
    r = call("wallet_change_seed", payload, pippin=True)
    return fix_json(r)
Beispiel #12
0
def unopened(account, count=-1, threshold=0):
    payload = {
        "account": account,
        "count": count,
        "threshold": threshold,
    }
    r = call("unopened", payload)
    return fix_json(r)
Beispiel #13
0
def pending_exists(hash, include_active=False, include_only_confirmed=False):
    payload = {
        "hash": hash,
        "include_active": include_active,
        "include_only_confirmed": include_only_confirmed,
    }
    r = call("pending_exists", payload)
    return fix_json(r)
Beispiel #14
0
def account_move(wallet, source, accounts):
    payload = {
        "wallet": wallet,
        "source": source,
        "accounts": accounts,
    }
    r = call("account_move", payload)
    return fix_json(r)
Beispiel #15
0
def confirmation_history(hash=None):
    payload = {
        **({
            "hash": hash
        } if hash else {}),
    }
    r = call("confirmation_history", payload)
    return fix_json(r)
Beispiel #16
0
def account_info(account, representative=False, weight=False, pending=False):
    payload = {
        "account": account,
        "representative": representative,
        "weight": weight,
        "pending": pending,
    }
    r = call("account_info", payload)
    return fix_json(r)
Beispiel #17
0
def confirmation_info(root, representatives=False, contents=False, json_block=False, url=None):
    payload = {
        "json_block": json_block,
        "root": root,
        "contents": contents,
        "representatives": representatives,
    }
    r = call("confirmation_info", payload, url)
    return fix_json(r)
Beispiel #18
0
def block_create(type, balance, key, representative, link, previous, json_block=False, url=None):
    payload = {
        "type": type,
        "balance": balance,
        "key": key,
        "representative": representative,
        "link": link,
        "previous": previous,
        "json_block": json_block,
    }
    r = call("block_create", payload, url)
    return fix_json(r)
Beispiel #19
0
def wallet_ledger(
    wallet, representative=False, weight=False, pending=False, modified_since=0, url=None
):
    payload = {
        "wallet": wallet,
        "representative": representative,
        "weight": weight,
        "pending": pending,
        "modified_since": modified_since,
    }
    r = call("wallet_ledger", payload, url)
    return fix_json(r)
Beispiel #20
0
def account_history(account,
                    count,
                    raw=False,
                    head="",
                    offset=0,
                    reverse=False,
                    account_filter=[]):
    payload = {"account": account, "count": count}
    r = call("account_history", payload)
    r = fix_json(r)

    # hack to keep data structures consistent
    if r["history"] == {}:
        r["history"] = []

    return r
Beispiel #21
0
def blocks_info(
    hashes,
    include_not_found=False,
    pending=False,
    source=False,
    balance=False,
    json_block=False,
):
    payload = {
        "json_block": json_block,
        "include_not_found": include_not_found,
        "hashes": hashes,
        "pending": pending,
        "source": source,
        "balance": balance,
    }
    r = call("blocks_info", payload)
    return fix_json(r)
Beispiel #22
0
def accounts_pending(
    accounts,
    threshold=0,
    source=False,
    include_active=False,
    sorting=False,
    include_only_confirmed=False,
):
    payload = {
        "accounts": accounts,
        "threshold": threshold,
        "source": source,
        "include_active": include_active,
        "sorting": sorting,
        "include_only_confirmed": include_only_confirmed,
    }
    r = call("accounts_pending", payload)
    return fix_json(r)
Beispiel #23
0
def sign(
    block_type=None,
    previous_block=None,
    representative=None,
    balance=None,
    link=None,
    link_as_account=None,
    signature=None,
    work=None,
    hash=None,
    key=None,
    wallet=None,
    account=None,
    json_block=False,
):
    # distinguish between hash sign and block sign
    payload = ({
        "hash": hash
    } if hash is not None else {
        "json_block": json_block,
        **({
            "key": key
        } if key else {}),
        **({
            "wallet": wallet
        } if wallet else {}),
        **({
            "account": account
        } if account else {}),
        "block": {
            "type": block_type,
            "account": account,
            "previous": previous_block,
            "representative": representative,
            "balance": balance,
            "link": link,
            "link_as_account": link_as_account,
            "signature": signature,
            "work": work,
        },
    })
    r = call("sign", payload)
    return fix_json(r)
Beispiel #24
0
def wallet_pending(
    wallet,
    count=-1,
    threshold=None,
    source=False,
    include_active=False,
    min_version=False,
    include_only_confirmed=False,
):
    payload = {
        "wallet": wallet,
        "count": count,
        **({"threshold": threshold} if threshold else {}),
        "source": source,
        "include_active": include_active,
        "min_version": min_version,
        "include_only_confirmed": include_only_confirmed,
    }
    r = call("wallet_pending", payload)
    return fix_json(r)
Beispiel #25
0
def pending(
    account,
    count=-1,
    threshold=0,
    source=False,
    include_active=False,
    min_version=False,
    sorting=False,
    include_only_confirmed=True,
):
    payload = {
        "account": account,
        "count": count,
        "threshold": threshold,
        "source": source,
        "include_active": include_active,
        "min_version": min_version,
        "sorting": sorting,
        "include_only_confirmed": include_only_confirmed,
    }
    r = call("pending", payload)
    return fix_json(r)
Beispiel #26
0
def ledger(
    account,
    count=-1,
    representative=False,
    weight=False,
    pending=False,
    modified_since=0,
    sorting=False,
    threshold=0,
):
    payload = {
        "account": account,
        "count": count,
        "representative": representative,
        "weight": weight,
        "pending": pending,
        "modified_since": modified_since,
        "sorting": sorting,
        "threshold": threshold,
    }
    r = call("ledger", payload)
    return fix_json(r)
Beispiel #27
0
def account_weight(account):
    payload = {"account": account}
    r = call("account_weight", payload)
    return fix_json(r)
Beispiel #28
0
def wallet_locked(wallet):
    payload = {"wallet": wallet}
    r = call("wallet_locked", payload, pippin=True)
    return fix_json(r)
Beispiel #29
0
def work_set(wallet, account, work):
    payload = {"wallet": wallet, "account": account, "work": work}
    r = call("work_set", payload)
    return fix_json(r)
Beispiel #30
0
def wallet_info(wallet):
    payload = {"wallet": wallet}
    r = call("wallet_info", payload)
    return fix_json(r)