示例#1
0
def test_vapor_refund_signature():

    unsigned_refund_transaction_raw = _["vapor"]["refund"]["unsigned"][
        "transaction_raw"]

    refund_solver = RefundSolver(
        xprivate_key=_["vapor"]["wallet"]["sender"]["xprivate_key"],
        bytecode=_["vapor"]["htlc"]["bytecode"],
        path=_["vapor"]["wallet"]["sender"]["derivation"]["path"],
        account=_["vapor"]["wallet"]["sender"]["derivation"]["account"],
        change=_["vapor"]["wallet"]["sender"]["derivation"]["change"],
        address=_["vapor"]["wallet"]["sender"]["derivation"]["address"])

    signature = Signature(network=_["vapor"]["network"]).sign(
        transaction_raw=unsigned_refund_transaction_raw, solver=refund_solver)

    assert signature.type() == _["vapor"]["refund"]["signed"]["type"]
    assert signature.fee() == _["vapor"]["refund"]["signed"]["fee"]
    assert signature.hash() == _["vapor"]["refund"]["signed"]["hash"]
    assert signature.raw() == _["vapor"]["refund"]["signed"]["raw"]
    # assert signature.json() == _["vapor"]["refund"]["signed"]["json"]
    assert signature.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["vapor"]["refund"]["signed"]["transaction_raw"])

    refund_signature = RefundSignature(network=_["vapor"]["network"]).sign(
        transaction_raw=unsigned_refund_transaction_raw, solver=refund_solver)

    assert refund_signature.type() == _["vapor"]["refund"]["signed"]["type"]
    assert refund_signature.fee() == _["vapor"]["refund"]["signed"]["fee"]
    assert refund_signature.hash() == _["vapor"]["refund"]["signed"]["hash"]
    assert refund_signature.raw() == _["vapor"]["refund"]["signed"]["raw"]
    # assert refund_signature.json() == _["vapor"]["refund"]["signed"]["json"]
    assert refund_signature.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["vapor"]["refund"]["signed"]["transaction_raw"])
示例#2
0
def test_vapor_normal_signature():

    unsigned_normal_transaction_raw = _["vapor"]["normal"]["unsigned"][
        "transaction_raw"]

    normal_solver = NormalSolver(
        xprivate_key=_["vapor"]["wallet"]["sender"]["xprivate_key"],
        path=_["vapor"]["wallet"]["sender"]["derivation"]["path"],
        account=_["vapor"]["wallet"]["sender"]["derivation"]["account"],
        change=_["vapor"]["wallet"]["sender"]["derivation"]["change"],
        address=_["vapor"]["wallet"]["sender"]["derivation"]["address"])

    signature = Signature(network=_["vapor"]["network"]).sign(
        transaction_raw=unsigned_normal_transaction_raw, solver=normal_solver)

    assert signature.type() == _["vapor"]["normal"]["signed"]["type"]
    assert signature.fee() == _["vapor"]["normal"]["signed"]["fee"]
    assert signature.hash() == _["vapor"]["normal"]["signed"]["hash"]
    assert signature.raw() == _["vapor"]["normal"]["signed"]["raw"]
    # assert signature.json() == _["vapor"]["normal"]["signed"]["json"]
    assert signature.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["vapor"]["normal"]["signed"]["transaction_raw"])

    normal_signature = NormalSignature(network=_["vapor"]["network"]).sign(
        transaction_raw=unsigned_normal_transaction_raw, solver=normal_solver)

    assert normal_signature.type() == _["vapor"]["normal"]["signed"]["type"]
    assert normal_signature.fee() == _["vapor"]["normal"]["signed"]["fee"]
    assert normal_signature.hash() == _["vapor"]["normal"]["signed"]["hash"]
    assert normal_signature.raw() == _["vapor"]["normal"]["signed"]["raw"]
    # assert normal_signature.json() == _["vapor"]["normal"]["signed"]["json"]
    assert normal_signature.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["vapor"]["normal"]["signed"]["transaction_raw"])
示例#3
0
def test_bitcoin_fund_signature():

    unsigned_fund_transaction_raw = _["bitcoin"]["fund"]["unsigned"][
        "transaction_raw"]

    fund_solver = FundSolver(
        xprivate_key=_["bitcoin"]["wallet"]["sender"]["root_xprivate_key"],
        path=_["bitcoin"]["wallet"]["sender"]["derivation"]["path"],
        account=_["bitcoin"]["wallet"]["sender"]["derivation"]["account"],
        change=_["bitcoin"]["wallet"]["sender"]["derivation"]["change"],
        address=_["bitcoin"]["wallet"]["sender"]["derivation"]["address"])

    signature = Signature(network=_["bitcoin"]["network"]).sign(
        transaction_raw=unsigned_fund_transaction_raw, solver=fund_solver)

    assert signature.type() == _["bitcoin"]["fund"]["signed"]["type"]
    assert signature.fee() == _["bitcoin"]["fund"]["signed"]["fee"]
    assert signature.hash() == _["bitcoin"]["fund"]["signed"]["hash"]
    assert signature.raw() == _["bitcoin"]["fund"]["signed"]["raw"]
    assert signature.json() == _["bitcoin"]["fund"]["signed"]["json"]
    assert signature.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["fund"]["signed"]["transaction_raw"])

    fund_signature = FundSignature(network=_["bitcoin"]["network"]).sign(
        transaction_raw=unsigned_fund_transaction_raw, solver=fund_solver)

    assert fund_signature.type() == _["bitcoin"]["fund"]["signed"]["type"]
    assert fund_signature.fee() == _["bitcoin"]["fund"]["signed"]["fee"]
    assert fund_signature.hash() == _["bitcoin"]["fund"]["signed"]["hash"]
    assert fund_signature.raw() == _["bitcoin"]["fund"]["signed"]["raw"]
    assert fund_signature.json() == _["bitcoin"]["fund"]["signed"]["json"]
    assert fund_signature.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["fund"]["signed"]["transaction_raw"])
示例#4
0
def test_vapor_claim_signature():

    unsigned_claim_transaction_raw = _["vapor"]["claim"]["unsigned"][
        "transaction_raw"]

    claim_solver = ClaimSolver(
        xprivate_key=_["vapor"]["wallet"]["recipient"]["xprivate_key"],
        secret_key=_["vapor"]["htlc"]["secret"]["key"],
        bytecode=_["vapor"]["htlc"]["bytecode"],
        path=_["vapor"]["wallet"]["recipient"]["derivation"]["path"],
        account=_["vapor"]["wallet"]["recipient"]["derivation"]["account"],
        change=_["vapor"]["wallet"]["recipient"]["derivation"]["change"],
        address=_["vapor"]["wallet"]["recipient"]["derivation"]["address"])

    signature = Signature(network=_["vapor"]["network"]).sign(
        transaction_raw=unsigned_claim_transaction_raw, solver=claim_solver)

    assert signature.type() == _["vapor"]["claim"]["signed"]["type"]
    assert signature.fee() == _["vapor"]["claim"]["signed"]["fee"]
    assert signature.hash() == _["vapor"]["claim"]["signed"]["hash"]
    assert signature.raw() == _["vapor"]["claim"]["signed"]["raw"]
    # assert signature.json() == _["vapor"]["claim"]["signed"]["json"]
    assert signature.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["vapor"]["claim"]["signed"]["transaction_raw"])

    claim_signature = ClaimSignature(network=_["vapor"]["network"]).sign(
        transaction_raw=unsigned_claim_transaction_raw, solver=claim_solver)

    assert claim_signature.type() == _["vapor"]["claim"]["signed"]["type"]
    assert claim_signature.fee() == _["vapor"]["claim"]["signed"]["fee"]
    assert claim_signature.hash() == _["vapor"]["claim"]["signed"]["hash"]
    assert claim_signature.raw() == _["vapor"]["claim"]["signed"]["raw"]
    # assert claim_signature.json() == _["vapor"]["claim"]["signed"]["json"]
    assert claim_signature.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["vapor"]["claim"]["signed"]["transaction_raw"])
示例#5
0
def test_vapor_claim_transaction():

    unsigned_claim_transaction = ClaimTransaction(
        network=_["vapor"]["network"])

    unsigned_claim_transaction.build_transaction(
        address=_["vapor"]["wallet"]["recipient"]["address"],
        transaction_id=_["vapor"]["transaction_id"],
        amount=(_["vapor"]["amount"]
                if _["vapor"]["unit"] == "NEU" else amount_unit_converter(
                    _["vapor"]["amount"], f"{_['vapor']['unit']}2NEU")),
        max_amount=_["vapor"]["max_amount"],
        asset=_["vapor"]["asset"],
    )

    assert unsigned_claim_transaction.type(
    ) == _["vapor"]["claim"]["unsigned"]["type"]
    assert unsigned_claim_transaction.fee(
    ) == _["vapor"]["claim"]["unsigned"]["fee"]
    assert unsigned_claim_transaction.hash(
    ) == _["vapor"]["claim"]["unsigned"]["hash"]
    assert unsigned_claim_transaction.raw(
    ) == _["vapor"]["claim"]["unsigned"]["raw"]
    # assert unsigned_claim_transaction.json() == _["vapor"]["claim"]["unsigned"]["json"]
    assert unsigned_claim_transaction.unsigned_datas(
    ) == _["vapor"]["claim"]["unsigned"]["unsigned_datas"]
    assert unsigned_claim_transaction.signatures(
    ) == _["vapor"]["claim"]["unsigned"]["signatures"]
    assert unsigned_claim_transaction.transaction_raw(
    ) == clean_transaction_raw(
        transaction_raw=_["vapor"]["claim"]["unsigned"]["transaction_raw"])

    signed_claim_transaction = unsigned_claim_transaction.sign(
        solver=ClaimSolver(
            xprivate_key=_["vapor"]["wallet"]["recipient"]["xprivate_key"],
            secret_key=_["vapor"]["htlc"]["secret"]["key"],
            bytecode=_["vapor"]["htlc"]["bytecode"],
            path=_["vapor"]["wallet"]["recipient"]["derivation"]["path"],
            account=_["vapor"]["wallet"]["recipient"]["derivation"]["account"],
            change=_["vapor"]["wallet"]["recipient"]["derivation"]["change"],
            address=_["vapor"]["wallet"]["recipient"]["derivation"]
            ["address"]))

    assert signed_claim_transaction.type(
    ) == _["vapor"]["claim"]["signed"]["type"]
    assert signed_claim_transaction.fee(
    ) == _["vapor"]["claim"]["signed"]["fee"]
    assert signed_claim_transaction.hash(
    ) == _["vapor"]["claim"]["signed"]["hash"]
    assert signed_claim_transaction.raw(
    ) == _["vapor"]["claim"]["signed"]["raw"]
    # assert signed_claim_transaction.json() == _["vapor"]["claim"]["signed"]["json"]
    assert signed_claim_transaction.unsigned_datas(
    ) == _["vapor"]["claim"]["signed"]["unsigned_datas"]
    assert signed_claim_transaction.signatures(
    ) == _["vapor"]["claim"]["signed"]["signatures"]
    assert signed_claim_transaction.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["vapor"]["claim"]["signed"]["transaction_raw"])
示例#6
0
def test_vapor_normal_transaction():

    unsigned_normal_transaction = NormalTransaction(
        network=_["vapor"]["network"])

    unsigned_normal_transaction.build_transaction(
        address=_["vapor"]["wallet"]["sender"]["address"],
        asset=_["vapor"]["asset"],
        recipients={
            _["vapor"]["wallet"]["recipient"]["address"]:
            (_["vapor"]["amount"]
             if _["vapor"]["unit"] == "NEU" else amount_unit_converter(
                 _["vapor"]["amount"], f"{_['vapor']['unit']}2NEU"))
        })

    assert unsigned_normal_transaction.type(
    ) == _["vapor"]["normal"]["unsigned"]["type"]
    assert unsigned_normal_transaction.fee(
    ) == _["vapor"]["normal"]["unsigned"]["fee"]
    assert unsigned_normal_transaction.hash(
    ) == _["vapor"]["normal"]["unsigned"]["hash"]
    assert unsigned_normal_transaction.raw(
    ) == _["vapor"]["normal"]["unsigned"]["raw"]
    # assert unsigned_normal_transaction.json() == _["vapor"]["normal"]["unsigned"]["json"]
    assert unsigned_normal_transaction.unsigned_datas(
    ) == _["vapor"]["normal"]["unsigned"]["unsigned_datas"]
    assert unsigned_normal_transaction.signatures(
    ) == _["vapor"]["normal"]["unsigned"]["signatures"]
    assert unsigned_normal_transaction.transaction_raw(
    ) == clean_transaction_raw(
        transaction_raw=_["vapor"]["normal"]["unsigned"]["transaction_raw"])

    signed_normal_transaction = unsigned_normal_transaction.sign(
        solver=NormalSolver(
            xprivate_key=_["vapor"]["wallet"]["sender"]["xprivate_key"],
            path=_["vapor"]["wallet"]["sender"]["derivation"]["path"],
            account=_["vapor"]["wallet"]["sender"]["derivation"]["account"],
            change=_["vapor"]["wallet"]["sender"]["derivation"]["change"],
            address=_["vapor"]["wallet"]["sender"]["derivation"]["address"]))

    assert signed_normal_transaction.type(
    ) == _["vapor"]["normal"]["signed"]["type"]
    assert signed_normal_transaction.fee(
    ) == _["vapor"]["normal"]["signed"]["fee"]
    assert signed_normal_transaction.hash(
    ) == _["vapor"]["normal"]["signed"]["hash"]
    assert signed_normal_transaction.raw(
    ) == _["vapor"]["normal"]["signed"]["raw"]
    # assert signed_normal_transaction.json() == _["vapor"]["normal"]["signed"]["json"]
    assert signed_normal_transaction.unsigned_datas(
    ) == _["vapor"]["normal"]["signed"]["unsigned_datas"]
    assert signed_normal_transaction.signatures(
    ) == _["vapor"]["normal"]["signed"]["signatures"]
    assert signed_normal_transaction.transaction_raw(
    ) == clean_transaction_raw(
        transaction_raw=_["vapor"]["normal"]["signed"]["transaction_raw"])
def test_bitcoin_cli_signature(cli_tester):

    signed_fund_transaction_raw = cli_tester.invoke(cli_main, [
        "bitcoin", "sign", "--transaction-raw",
        _["bitcoin"]["fund"]["unsigned"]["transaction_raw"], "--xprivate-key",
        _["bitcoin"]["wallet"]["sender"]["root_xprivate_key"], "--account",
        _["bitcoin"]["wallet"]["sender"]["derivation"]["account"], "--change",
        _["bitcoin"]["wallet"]["sender"]["derivation"]["change"], "--address",
        _["bitcoin"]["wallet"]["sender"]["derivation"]["address"], "--path",
        _["bitcoin"]["wallet"]["sender"]["derivation"]["path"]
    ])

    assert signed_fund_transaction_raw.exit_code == 0
    assert signed_fund_transaction_raw.output == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["fund"]["signed"]
        ["transaction_raw"]) + "\n"

    signed_withdraw_transaction_raw = cli_tester.invoke(
        cli_main, [
            "bitcoin", "sign", "--transaction-raw",
            _["bitcoin"]["withdraw"]["unsigned"]["transaction_raw"],
            "--xprivate-key",
            _["bitcoin"]["wallet"]["recipient"]["root_xprivate_key"],
            "--secret-key", _["bitcoin"]["htlc"]["secret"]["key"],
            "--bytecode", _["bitcoin"]["htlc"]["bytecode"], "--account",
            _["bitcoin"]["wallet"]["recipient"]["derivation"]["account"],
            "--change",
            _["bitcoin"]["wallet"]["recipient"]["derivation"]["change"],
            "--address",
            _["bitcoin"]["wallet"]["recipient"]["derivation"]["address"],
            "--path", _["bitcoin"]["wallet"]["recipient"]["derivation"]["path"]
        ])

    assert signed_withdraw_transaction_raw.exit_code == 0
    assert signed_withdraw_transaction_raw.output == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["withdraw"]["signed"]
        ["transaction_raw"]) + "\n"

    signed_refund_transaction_raw = cli_tester.invoke(cli_main, [
        "bitcoin", "sign", "--transaction-raw",
        _["bitcoin"]["refund"]["unsigned"]["transaction_raw"],
        "--xprivate-key",
        _["bitcoin"]["wallet"]["sender"]["root_xprivate_key"], "--endtime",
        _["bitcoin"]["htlc"]["endtime"], "--bytecode",
        _["bitcoin"]["htlc"]["bytecode"], "--account",
        _["bitcoin"]["wallet"]["sender"]["derivation"]["account"], "--change",
        _["bitcoin"]["wallet"]["sender"]["derivation"]["change"], "--address",
        _["bitcoin"]["wallet"]["sender"]["derivation"]["address"], "--path",
        _["bitcoin"]["wallet"]["sender"]["derivation"]["path"]
    ])

    assert signed_refund_transaction_raw.exit_code == 0
    assert signed_refund_transaction_raw.output == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["refund"]["signed"]
        ["transaction_raw"]) + "\n"
示例#8
0
def test_bytom_normal_transaction():

    unsigned_normal_transaction = NormalTransaction(
        network=_["bytom"]["network"])

    unsigned_normal_transaction.build_transaction(
        address=_["bytom"]["wallet"]["sender"]["address"],
        recipients={
            _["bytom"]["wallet"]["recipient"]["address"]: _["bytom"]["amount"]
        },
        asset=_["bytom"]["asset"],
        unit=_['bytom']['unit'])

    assert unsigned_normal_transaction.type(
    ) == _["bytom"]["normal"]["unsigned"]["type"]
    assert unsigned_normal_transaction.fee(
    ) == _["bytom"]["normal"]["unsigned"]["fee"]
    assert unsigned_normal_transaction.hash(
    ) == _["bytom"]["normal"]["unsigned"]["hash"]
    assert unsigned_normal_transaction.raw(
    ) == _["bytom"]["normal"]["unsigned"]["raw"]
    # assert unsigned_normal_transaction.json() == _["bytom"]["normal"]["unsigned"]["json"]
    assert unsigned_normal_transaction.unsigned_datas(
    ) == _["bytom"]["normal"]["unsigned"]["unsigned_datas"]
    assert unsigned_normal_transaction.signatures(
    ) == _["bytom"]["normal"]["unsigned"]["signatures"]
    assert unsigned_normal_transaction.transaction_raw(
    ) == clean_transaction_raw(
        transaction_raw=_["bytom"]["normal"]["unsigned"]["transaction_raw"])

    signed_normal_transaction = unsigned_normal_transaction.sign(
        solver=NormalSolver(
            xprivate_key=_["bytom"]["wallet"]["sender"]["xprivate_key"],
            path=_["bytom"]["wallet"]["sender"]["derivation"]["path"],
            account=_["bytom"]["wallet"]["sender"]["derivation"]["account"],
            change=_["bytom"]["wallet"]["sender"]["derivation"]["change"],
            address=_["bytom"]["wallet"]["sender"]["derivation"]["address"]))

    assert signed_normal_transaction.type(
    ) == _["bytom"]["normal"]["signed"]["type"]
    assert signed_normal_transaction.fee(
    ) == _["bytom"]["normal"]["signed"]["fee"]
    assert signed_normal_transaction.hash(
    ) == _["bytom"]["normal"]["signed"]["hash"]
    assert signed_normal_transaction.raw(
    ) == _["bytom"]["normal"]["signed"]["raw"]
    # assert signed_normal_transaction.json() == _["bytom"]["normal"]["signed"]["json"]
    assert signed_normal_transaction.unsigned_datas(
    ) == _["bytom"]["normal"]["signed"]["unsigned_datas"]
    assert signed_normal_transaction.signatures(
    ) == _["bytom"]["normal"]["signed"]["signatures"]
    assert signed_normal_transaction.transaction_raw(
    ) == clean_transaction_raw(
        transaction_raw=_["bytom"]["normal"]["signed"]["transaction_raw"])
示例#9
0
def test_bytom_fund_transaction():

    htlc = HTLC(network=_["bytom"]["network"]).build_htlc(
        secret_hash=_["bytom"]["htlc"]["secret"]["hash"],
        recipient_public_key=_["bytom"]["wallet"]["recipient"]["public_key"],
        sender_public_key=_["bytom"]["wallet"]["sender"]["public_key"],
        endblock=_["bytom"]["htlc"]["endblock"])

    unsigned_fund_transaction = FundTransaction(network=_["bytom"]["network"])

    unsigned_fund_transaction.build_transaction(
        address=_["bytom"]["wallet"]["sender"]["address"],
        htlc=htlc,
        asset=_["bytom"]["asset"],
        amount=_["bytom"]["amount"],
        unit=_['bytom']['unit'])

    assert unsigned_fund_transaction.type(
    ) == _["bytom"]["fund"]["unsigned"]["type"]
    assert unsigned_fund_transaction.fee(
    ) == _["bytom"]["fund"]["unsigned"]["fee"]
    assert unsigned_fund_transaction.hash(
    ) == _["bytom"]["fund"]["unsigned"]["hash"]
    assert unsigned_fund_transaction.raw(
    ) == _["bytom"]["fund"]["unsigned"]["raw"]
    # assert unsigned_fund_transaction.json() == _["bytom"]["fund"]["unsigned"]["json"]
    assert unsigned_fund_transaction.unsigned_datas(
    ) == _["bytom"]["fund"]["unsigned"]["unsigned_datas"]
    assert unsigned_fund_transaction.signatures(
    ) == _["bytom"]["fund"]["unsigned"]["signatures"]
    assert unsigned_fund_transaction.transaction_raw(
    ) == clean_transaction_raw(
        transaction_raw=_["bytom"]["fund"]["unsigned"]["transaction_raw"])

    signed_fund_transaction = unsigned_fund_transaction.sign(solver=FundSolver(
        xprivate_key=_["bytom"]["wallet"]["sender"]["xprivate_key"],
        path=_["bytom"]["wallet"]["sender"]["derivation"]["path"],
        account=_["bytom"]["wallet"]["sender"]["derivation"]["account"],
        change=_["bytom"]["wallet"]["sender"]["derivation"]["change"],
        address=_["bytom"]["wallet"]["sender"]["derivation"]["address"]))

    assert signed_fund_transaction.type(
    ) == _["bytom"]["fund"]["signed"]["type"]
    assert signed_fund_transaction.fee() == _["bytom"]["fund"]["signed"]["fee"]
    assert signed_fund_transaction.hash(
    ) == _["bytom"]["fund"]["signed"]["hash"]
    assert signed_fund_transaction.raw() == _["bytom"]["fund"]["signed"]["raw"]
    # assert signed_fund_transaction.json() == _["bytom"]["fund"]["signed"]["json"]
    assert signed_fund_transaction.unsigned_datas(
    ) == _["bytom"]["fund"]["signed"]["unsigned_datas"]
    assert signed_fund_transaction.signatures(
    ) == _["bytom"]["fund"]["signed"]["signatures"]
    assert signed_fund_transaction.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["bytom"]["fund"]["signed"]["transaction_raw"])
示例#10
0
def test_bytom_withdraw_transaction():

    unsigned_withdraw_transaction = WithdrawTransaction(
        network=_["bytom"]["network"])

    unsigned_withdraw_transaction.build_transaction(
        address=_["bytom"]["wallet"]["recipient"]["address"],
        transaction_hash=_["bytom"]["transaction_hash"],
        asset=_["bytom"]["asset"])

    assert unsigned_withdraw_transaction.type(
    ) == _["bytom"]["withdraw"]["unsigned"]["type"]
    assert unsigned_withdraw_transaction.fee(
    ) == _["bytom"]["withdraw"]["unsigned"]["fee"]
    assert unsigned_withdraw_transaction.hash(
    ) == _["bytom"]["withdraw"]["unsigned"]["hash"]
    assert unsigned_withdraw_transaction.raw(
    ) == _["bytom"]["withdraw"]["unsigned"]["raw"]
    # assert unsigned_withdraw_transaction.json() == _["bytom"]["withdraw"]["unsigned"]["json"]
    assert unsigned_withdraw_transaction.unsigned_datas(
    ) == _["bytom"]["withdraw"]["unsigned"]["unsigned_datas"]
    assert unsigned_withdraw_transaction.signatures(
    ) == _["bytom"]["withdraw"]["unsigned"]["signatures"]
    assert unsigned_withdraw_transaction.transaction_raw(
    ) == clean_transaction_raw(
        transaction_raw=_["bytom"]["withdraw"]["unsigned"]["transaction_raw"])

    signed_withdraw_transaction = unsigned_withdraw_transaction.sign(
        solver=WithdrawSolver(
            xprivate_key=_["bytom"]["wallet"]["recipient"]["xprivate_key"],
            secret_key=_["bytom"]["htlc"]["secret"]["key"],
            bytecode=_["bytom"]["htlc"]["bytecode"],
            path=_["bytom"]["wallet"]["recipient"]["derivation"]["path"],
            account=_["bytom"]["wallet"]["recipient"]["derivation"]["account"],
            change=_["bytom"]["wallet"]["recipient"]["derivation"]["change"],
            address=_["bytom"]["wallet"]["recipient"]["derivation"]
            ["address"]))

    assert signed_withdraw_transaction.type(
    ) == _["bytom"]["withdraw"]["signed"]["type"]
    assert signed_withdraw_transaction.fee(
    ) == _["bytom"]["withdraw"]["signed"]["fee"]
    assert signed_withdraw_transaction.hash(
    ) == _["bytom"]["withdraw"]["signed"]["hash"]
    assert signed_withdraw_transaction.raw(
    ) == _["bytom"]["withdraw"]["signed"]["raw"]
    # assert signed_withdraw_transaction.json() == _["bytom"]["withdraw"]["signed"]["json"]
    assert signed_withdraw_transaction.unsigned_datas(
    ) == _["bytom"]["withdraw"]["signed"]["unsigned_datas"]
    assert signed_withdraw_transaction.signatures(
    ) == _["bytom"]["withdraw"]["signed"]["signatures"]
    assert signed_withdraw_transaction.transaction_raw(
    ) == clean_transaction_raw(
        transaction_raw=_["bytom"]["withdraw"]["signed"]["transaction_raw"])
示例#11
0
def test_vapor_refund_transaction():

    unsigned_refund_transaction = RefundTransaction(
        network=_["vapor"]["network"])

    unsigned_refund_transaction.build_transaction(
        address=_["vapor"]["wallet"]["sender"]["address"],
        transaction_hash=_["vapor"]["transaction_hash"],
        asset=_["vapor"]["asset"])

    assert unsigned_refund_transaction.type(
    ) == _["vapor"]["refund"]["unsigned"]["type"]
    assert unsigned_refund_transaction.fee(
    ) == _["vapor"]["refund"]["unsigned"]["fee"]
    assert unsigned_refund_transaction.hash(
    ) == _["vapor"]["refund"]["unsigned"]["hash"]
    assert unsigned_refund_transaction.raw(
    ) == _["vapor"]["refund"]["unsigned"]["raw"]
    # assert unsigned_refund_transaction.json() == _["vapor"]["refund"]["unsigned"]["json"]
    assert unsigned_refund_transaction.unsigned_datas(
    ) == _["vapor"]["refund"]["unsigned"]["unsigned_datas"]
    assert unsigned_refund_transaction.signatures(
    ) == _["vapor"]["refund"]["unsigned"]["signatures"]
    assert unsigned_refund_transaction.transaction_raw(
    ) == clean_transaction_raw(
        transaction_raw=_["vapor"]["refund"]["unsigned"]["transaction_raw"])

    signed_refund_transaction = unsigned_refund_transaction.sign(
        solver=RefundSolver(
            xprivate_key=_["vapor"]["wallet"]["sender"]["xprivate_key"],
            bytecode=_["vapor"]["htlc"]["bytecode"],
            path=_["vapor"]["wallet"]["sender"]["derivation"]["path"],
            account=_["vapor"]["wallet"]["sender"]["derivation"]["account"],
            change=_["vapor"]["wallet"]["sender"]["derivation"]["change"],
            address=_["vapor"]["wallet"]["sender"]["derivation"]["address"]))

    assert signed_refund_transaction.type(
    ) == _["vapor"]["refund"]["signed"]["type"]
    assert signed_refund_transaction.fee(
    ) == _["vapor"]["refund"]["signed"]["fee"]
    assert signed_refund_transaction.hash(
    ) == _["vapor"]["refund"]["signed"]["hash"]
    assert signed_refund_transaction.raw(
    ) == _["vapor"]["refund"]["signed"]["raw"]
    # assert signed_refund_transaction.json() == _["vapor"]["refund"]["signed"]["json"]
    assert signed_refund_transaction.unsigned_datas(
    ) == _["vapor"]["refund"]["signed"]["unsigned_datas"]
    assert signed_refund_transaction.signatures(
    ) == _["vapor"]["refund"]["signed"]["signatures"]
    assert signed_refund_transaction.transaction_raw(
    ) == clean_transaction_raw(
        transaction_raw=_["vapor"]["refund"]["signed"]["transaction_raw"])
示例#12
0
def test_bitcoin_fund_transaction():

    htlc = HTLC(network=_["bitcoin"]["network"]).build_htlc(
        secret_hash=_["bitcoin"]["htlc"]["secret"]["hash"],
        recipient_address=_["bitcoin"]["wallet"]["recipient"]["address"],
        sender_address=_["bitcoin"]["wallet"]["sender"]["address"],
        endtime=_["bitcoin"]["htlc"]["endtime"])

    unsigned_fund_transaction = FundTransaction(
        network=_["bitcoin"]["network"])

    unsigned_fund_transaction.build_transaction(
        address=_["bitcoin"]["wallet"]["sender"]["address"],
        htlc=htlc,
        amount=_["bitcoin"]["amount"],
        unit=_["bitcoin"]["unit"])

    assert unsigned_fund_transaction.type(
    ) == _["bitcoin"]["fund"]["unsigned"]["type"]
    assert unsigned_fund_transaction.fee(
    ) == _["bitcoin"]["fund"]["unsigned"]["fee"]
    assert unsigned_fund_transaction.hash(
    ) == _["bitcoin"]["fund"]["unsigned"]["hash"]
    assert unsigned_fund_transaction.raw(
    ) == _["bitcoin"]["fund"]["unsigned"]["raw"]
    assert unsigned_fund_transaction.json(
    ) == _["bitcoin"]["fund"]["unsigned"]["json"]
    assert unsigned_fund_transaction.transaction_raw(
    ) == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["fund"]["unsigned"]["transaction_raw"])

    signed_fund_transaction = unsigned_fund_transaction.sign(solver=FundSolver(
        xprivate_key=_["bitcoin"]["wallet"]["sender"]["root_xprivate_key"],
        path=_["bitcoin"]["wallet"]["sender"]["derivation"]["path"],
        account=_["bitcoin"]["wallet"]["sender"]["derivation"]["account"],
        change=_["bitcoin"]["wallet"]["sender"]["derivation"]["change"],
        address=_["bitcoin"]["wallet"]["sender"]["derivation"]["address"]))

    assert signed_fund_transaction.type(
    ) == _["bitcoin"]["fund"]["signed"]["type"]
    assert signed_fund_transaction.fee(
    ) == _["bitcoin"]["fund"]["signed"]["fee"]
    assert signed_fund_transaction.hash(
    ) == _["bitcoin"]["fund"]["signed"]["hash"]
    assert signed_fund_transaction.raw(
    ) == _["bitcoin"]["fund"]["signed"]["raw"]
    assert signed_fund_transaction.json(
    ) == _["bitcoin"]["fund"]["signed"]["json"]
    assert signed_fund_transaction.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["fund"]["signed"]["transaction_raw"])
示例#13
0
def test_bytom_fund_transaction():

    unsigned_fund_transaction = FundTransaction(network=_["bytom"]["network"])

    unsigned_fund_transaction.build_transaction(
        address=_["bytom"]["wallet"]["sender"]["address"],
        htlc_address=_["bytom"]["htlc"]["address"],
        asset=_["bytom"]["asset"],
        amount=(_["bytom"]["amount"]
                if _["bytom"]["unit"] == "NEU" else amount_unit_converter(
                    _["bytom"]["amount"], f"{_['bytom']['unit']}2NEU")))

    assert unsigned_fund_transaction.type(
    ) == _["bytom"]["fund"]["unsigned"]["type"]
    assert unsigned_fund_transaction.fee(
    ) == _["bytom"]["fund"]["unsigned"]["fee"]
    assert unsigned_fund_transaction.hash(
    ) == _["bytom"]["fund"]["unsigned"]["hash"]
    assert unsigned_fund_transaction.raw(
    ) == _["bytom"]["fund"]["unsigned"]["raw"]
    # assert unsigned_fund_transaction.json() == _["bytom"]["fund"]["unsigned"]["json"]
    assert unsigned_fund_transaction.unsigned_datas(
    ) == _["bytom"]["fund"]["unsigned"]["unsigned_datas"]
    assert unsigned_fund_transaction.signatures(
    ) == _["bytom"]["fund"]["unsigned"]["signatures"]
    assert unsigned_fund_transaction.transaction_raw(
    ) == clean_transaction_raw(
        transaction_raw=_["bytom"]["fund"]["unsigned"]["transaction_raw"])

    signed_fund_transaction = unsigned_fund_transaction.sign(solver=FundSolver(
        xprivate_key=_["bytom"]["wallet"]["sender"]["xprivate_key"],
        path=_["bytom"]["wallet"]["sender"]["derivation"]["path"],
        account=_["bytom"]["wallet"]["sender"]["derivation"]["account"],
        change=_["bytom"]["wallet"]["sender"]["derivation"]["change"],
        address=_["bytom"]["wallet"]["sender"]["derivation"]["address"]))

    assert signed_fund_transaction.type(
    ) == _["bytom"]["fund"]["signed"]["type"]
    assert signed_fund_transaction.fee() == _["bytom"]["fund"]["signed"]["fee"]
    assert signed_fund_transaction.hash(
    ) == _["bytom"]["fund"]["signed"]["hash"]
    assert signed_fund_transaction.raw() == _["bytom"]["fund"]["signed"]["raw"]
    # assert signed_fund_transaction.json() == _["bytom"]["fund"]["signed"]["json"]
    assert signed_fund_transaction.unsigned_datas(
    ) == _["bytom"]["fund"]["signed"]["unsigned_datas"]
    assert signed_fund_transaction.signatures(
    ) == _["bytom"]["fund"]["signed"]["signatures"]
    assert signed_fund_transaction.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["bytom"]["fund"]["signed"]["transaction_raw"])
示例#14
0
def test_ethereum_erc20_withdraw_signature():

    unsigned_erc20_withdraw_transaction_raw = _["ethereum"]["erc20_withdraw"][
        "unsigned"]["transaction_raw"]

    erc20_withdraw_solver = WithdrawSolver(
        xprivate_key=_["ethereum"]["wallet"]["recipient"]["root_xprivate_key"],
        path=_["ethereum"]["wallet"]["recipient"]["derivation"]["path"],
        account=_["ethereum"]["wallet"]["recipient"]["derivation"]["account"],
        change=_["ethereum"]["wallet"]["recipient"]["derivation"]["change"],
        address=_["ethereum"]["wallet"]["recipient"]["derivation"]["address"])

    signature = Signature(network=_["ethereum"]["network"], erc20=True).sign(
        transaction_raw=unsigned_erc20_withdraw_transaction_raw,
        solver=erc20_withdraw_solver,
    )

    assert signature.type(
    ) == _["ethereum"]["erc20_withdraw"]["signed"]["type"]
    assert signature.fee() == _["ethereum"]["erc20_withdraw"]["signed"]["fee"]
    assert signature.hash(
    ) == _["ethereum"]["erc20_withdraw"]["signed"]["hash"]
    assert signature.raw() == _["ethereum"]["erc20_withdraw"]["signed"]["raw"]
    assert signature.json(
    ) == _["ethereum"]["erc20_withdraw"]["signed"]["json"]
    assert signature.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["ethereum"]["erc20_withdraw"]["signed"]
        ["transaction_raw"])

    erc20_withdraw_signature = WithdrawSignature(
        network=_["ethereum"]["network"], erc20=True).sign(
            transaction_raw=unsigned_erc20_withdraw_transaction_raw,
            solver=erc20_withdraw_solver)

    assert erc20_withdraw_signature.type(
    ) == _["ethereum"]["erc20_withdraw"]["signed"]["type"]
    assert erc20_withdraw_signature.fee(
    ) == _["ethereum"]["erc20_withdraw"]["signed"]["fee"]
    assert erc20_withdraw_signature.hash(
    ) == _["ethereum"]["erc20_withdraw"]["signed"]["hash"]
    assert erc20_withdraw_signature.raw(
    ) == _["ethereum"]["erc20_withdraw"]["signed"]["raw"]
    assert erc20_withdraw_signature.json(
    ) == _["ethereum"]["erc20_withdraw"]["signed"]["json"]
    assert erc20_withdraw_signature.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["ethereum"]["erc20_withdraw"]["signed"]
        ["transaction_raw"])
示例#15
0
def test_bitcoin_withdraw_signature():

    unsigned_withdraw_transaction_raw = _["bitcoin"]["withdraw"]["unsigned"][
        "transaction_raw"]

    withdraw_solver = WithdrawSolver(
        xprivate_key=_["bitcoin"]["wallet"]["recipient"]["root_xprivate_key"],
        secret_key=_["bitcoin"]["htlc"]["secret"]["key"],
        bytecode=_["bitcoin"]["htlc"]["bytecode"],
        path=_["bitcoin"]["wallet"]["recipient"]["derivation"]["path"],
        account=_["bitcoin"]["wallet"]["recipient"]["derivation"]["account"],
        change=_["bitcoin"]["wallet"]["recipient"]["derivation"]["change"],
        address=_["bitcoin"]["wallet"]["recipient"]["derivation"]["address"])

    signature = Signature(network=_["bitcoin"]["network"]).sign(
        transaction_raw=unsigned_withdraw_transaction_raw,
        solver=withdraw_solver)

    assert signature.type() == _["bitcoin"]["withdraw"]["signed"]["type"]
    assert signature.fee() == _["bitcoin"]["withdraw"]["signed"]["fee"]
    assert signature.hash() == _["bitcoin"]["withdraw"]["signed"]["hash"]
    assert signature.raw() == _["bitcoin"]["withdraw"]["signed"]["raw"]
    assert signature.json() == _["bitcoin"]["withdraw"]["signed"]["json"]
    assert signature.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["withdraw"]["signed"]["transaction_raw"])

    withdraw_signature = WithdrawSignature(
        network=_["bitcoin"]["network"]).sign(
            transaction_raw=unsigned_withdraw_transaction_raw,
            solver=withdraw_solver)

    assert withdraw_signature.type(
    ) == _["bitcoin"]["withdraw"]["signed"]["type"]
    assert withdraw_signature.fee(
    ) == _["bitcoin"]["withdraw"]["signed"]["fee"]
    assert withdraw_signature.hash(
    ) == _["bitcoin"]["withdraw"]["signed"]["hash"]
    assert withdraw_signature.raw(
    ) == _["bitcoin"]["withdraw"]["signed"]["raw"]
    assert withdraw_signature.json(
    ) == _["bitcoin"]["withdraw"]["signed"]["json"]
    assert withdraw_signature.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["withdraw"]["signed"]["transaction_raw"])
示例#16
0
def test_bitcoin_refund_transaction():

    unsigned_refund_transaction = RefundTransaction(network=_["bitcoin"]["network"])

    unsigned_refund_transaction.build_transaction(
        address=_["bitcoin"]["wallet"]["sender"]["address"],
        transaction_id=_["bitcoin"]["transaction_id"],
        amount=(
            _["bitcoin"]["amount"] if _["bitcoin"]["unit"] == "SATOSHI" else amount_unit_converter(
                _["bitcoin"]["amount"], f"{_['bitcoin']['unit']}2SATOSHI")
        ),
        max_amount=_["bitcoin"]["max_amount"]
    )

    assert unsigned_refund_transaction.type() == _["bitcoin"]["refund"]["unsigned"]["type"]
    assert unsigned_refund_transaction.fee() == _["bitcoin"]["refund"]["unsigned"]["fee"]
    assert unsigned_refund_transaction.hash() == _["bitcoin"]["refund"]["unsigned"]["hash"]
    assert unsigned_refund_transaction.raw() == _["bitcoin"]["refund"]["unsigned"]["raw"]
    assert unsigned_refund_transaction.json() == _["bitcoin"]["refund"]["unsigned"]["json"]
    assert unsigned_refund_transaction.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["refund"]["unsigned"]["transaction_raw"]
    )

    signed_refund_transaction = unsigned_refund_transaction.sign(
        solver=RefundSolver(
            root_xprivate_key=_["bitcoin"]["wallet"]["sender"]["root_xprivate_key"],
            bytecode=_["bitcoin"]["htlc"]["bytecode"],
            sequence=_["bitcoin"]["htlc"]["sequence"],
            path=_["bitcoin"]["wallet"]["sender"]["derivation"]["path"],
            account=_["bitcoin"]["wallet"]["sender"]["derivation"]["account"],
            change=_["bitcoin"]["wallet"]["sender"]["derivation"]["change"],
            address=_["bitcoin"]["wallet"]["sender"]["derivation"]["address"]
        )
    )

    assert signed_refund_transaction.type() == _["bitcoin"]["refund"]["signed"]["type"]
    assert signed_refund_transaction.fee() == _["bitcoin"]["refund"]["signed"]["fee"]
    assert signed_refund_transaction.hash() == _["bitcoin"]["refund"]["signed"]["hash"]
    assert signed_refund_transaction.raw() == _["bitcoin"]["refund"]["signed"]["raw"]
    assert signed_refund_transaction.json() == _["bitcoin"]["refund"]["signed"]["json"]
    assert signed_refund_transaction.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["refund"]["signed"]["transaction_raw"]
    )
示例#17
0
def test_bitcoin_normal_transaction():

    unsigned_normal_transaction = NormalTransaction(network=_["bitcoin"]["network"])

    unsigned_normal_transaction.build_transaction(
        address=_["bitcoin"]["wallet"]["sender"]["address"],
        htlc_address=_["bitcoin"]["htlc"]["address"],
        recipients={
            _["bitcoin"]["wallet"]["recipient"]["address"]: (
                _["bitcoin"]["amount"] if _["bitcoin"]["unit"] == "SATOSHI" else amount_unit_converter(
                    _["bitcoin"]["amount"], f"{_['bitcoin']['unit']}2SATOSHI")
            )
        }
    )

    assert unsigned_normal_transaction.type() == _["bitcoin"]["normal"]["unsigned"]["type"]
    assert unsigned_normal_transaction.fee() == _["bitcoin"]["normal"]["unsigned"]["fee"]
    assert unsigned_normal_transaction.hash() == _["bitcoin"]["normal"]["unsigned"]["hash"]
    assert unsigned_normal_transaction.raw() == _["bitcoin"]["normal"]["unsigned"]["raw"]
    assert unsigned_normal_transaction.json() == _["bitcoin"]["normal"]["unsigned"]["json"]
    assert unsigned_normal_transaction.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["normal"]["unsigned"]["transaction_raw"]
    )

    signed_normal_transaction = unsigned_normal_transaction.sign(
        solver=NormalSolver(
            root_xprivate_key=_["bitcoin"]["wallet"]["sender"]["root_xprivate_key"],
            path=_["bitcoin"]["wallet"]["sender"]["derivation"]["path"],
            account=_["bitcoin"]["wallet"]["sender"]["derivation"]["account"],
            change=_["bitcoin"]["wallet"]["sender"]["derivation"]["change"],
            address=_["bitcoin"]["wallet"]["sender"]["derivation"]["address"]
        )
    )

    assert signed_normal_transaction.type() == _["bitcoin"]["normal"]["signed"]["type"]
    assert signed_normal_transaction.fee() == _["bitcoin"]["normal"]["signed"]["fee"]
    assert signed_normal_transaction.hash() == _["bitcoin"]["normal"]["signed"]["hash"]
    assert signed_normal_transaction.raw() == _["bitcoin"]["normal"]["signed"]["raw"]
    assert signed_normal_transaction.json() == _["bitcoin"]["normal"]["signed"]["json"]
    assert signed_normal_transaction.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["normal"]["signed"]["transaction_raw"]
    )
示例#18
0
def test_vapor_cli_withdraw(cli_tester):

    withdraw = cli_tester.invoke(cli_main, [
        "vapor", "withdraw", "--address",
        _["vapor"]["wallet"]["recipient"]["address"], "--transaction-hash",
        _["vapor"]["transaction_hash"], "--asset", _["vapor"]["asset"],
        "--network", _["vapor"]["network"]
    ])
    assert withdraw.exit_code == 0
    assert withdraw.output == clean_transaction_raw(
        transaction_raw=_["vapor"]["withdraw"]["unsigned"]
        ["transaction_raw"]) + "\n"
示例#19
0
def test_vapor_cli_refund(cli_tester):

    refund = cli_tester.invoke(cli_main, [
        "vapor", "refund", "--address",
        _["vapor"]["wallet"]["sender"]["address"], "--transaction-hash",
        _["vapor"]["transaction_hash"], "--asset", _["vapor"]["asset"],
        "--network", _["vapor"]["network"]
    ])

    assert refund.exit_code == 0
    assert refund.output == clean_transaction_raw(
        transaction_raw=_["vapor"]["refund"]["unsigned"]
        ["transaction_raw"]) + "\n"
示例#20
0
def test_bitcoin_cli_fund(cli_tester):

    fund = cli_tester.invoke(cli_main, [
        "bitcoin", "fund", "--address",
        _["bitcoin"]["wallet"]["sender"]["address"], "--contract-address",
        _["bitcoin"]["htlc"]["contract_address"], "--amount",
        _["bitcoin"]["amount"], "--unit", _["bitcoin"]["unit"], "--version",
        _["bitcoin"]["version"], "--network", _["bitcoin"]["network"]
    ])
    assert fund.exit_code == 0
    assert fund.output == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["fund"]["unsigned"]
        ["transaction_raw"]) + "\n"
示例#21
0
def test_xinfin_xrc20_normal_signature():

    unsigned_xrc20_normal_transaction_raw = _["xinfin"]["xrc20_normal"]["unsigned"]["transaction_raw"]

    xrc20_normal_solver = NormalSolver(
        xprivate_key=_["xinfin"]["wallet"]["sender"]["root_xprivate_key"],
        path=_["xinfin"]["wallet"]["sender"]["derivation"]["path"],
        account=_["xinfin"]["wallet"]["sender"]["derivation"]["account"],
        change=_["xinfin"]["wallet"]["sender"]["derivation"]["change"],
        address=_["xinfin"]["wallet"]["sender"]["derivation"]["address"]
    )

    signature = Signature(network=_["xinfin"]["network"], xrc20=True).sign(
        transaction_raw=unsigned_xrc20_normal_transaction_raw,
        solver=xrc20_normal_solver
    )

    assert signature.type() == _["xinfin"]["xrc20_normal"]["signed"]["type"]
    assert signature.fee() == _["xinfin"]["xrc20_normal"]["signed"]["fee"]
    assert signature.hash() == _["xinfin"]["xrc20_normal"]["signed"]["hash"]
    assert signature.raw() == _["xinfin"]["xrc20_normal"]["signed"]["raw"]
    assert signature.json() == _["xinfin"]["xrc20_normal"]["signed"]["json"]
    assert signature.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["xinfin"]["xrc20_normal"]["signed"]["transaction_raw"]
    )

    xrc20_normal_signature = NormalSignature(network=_["xinfin"]["network"], xrc20=True).sign(
        transaction_raw=unsigned_xrc20_normal_transaction_raw,
        solver=xrc20_normal_solver
    )

    assert xrc20_normal_signature.type() == _["xinfin"]["xrc20_normal"]["signed"]["type"]
    assert xrc20_normal_signature.fee() == _["xinfin"]["xrc20_normal"]["signed"]["fee"]
    assert xrc20_normal_signature.hash() == _["xinfin"]["xrc20_normal"]["signed"]["hash"]
    assert xrc20_normal_signature.raw() == _["xinfin"]["xrc20_normal"]["signed"]["raw"]
    assert xrc20_normal_signature.json() == _["xinfin"]["xrc20_normal"]["signed"]["json"]
    assert xrc20_normal_signature.transaction_raw() == clean_transaction_raw(
        transaction_raw=_["xinfin"]["xrc20_normal"]["signed"]["transaction_raw"]
    )
示例#22
0
def test_bytom_cli_fund(cli_tester):

    fund = cli_tester.invoke(cli_main, [
        "bytom", "fund", "--address",
        _["bytom"]["wallet"]["sender"]["address"], "--htlc-address",
        _["bytom"]["htlc"]["address"], "--asset", _["bytom"]["asset"],
        "--amount", _["bytom"]["amount"], "--unit", _["bytom"]["unit"],
        "--network", _["bytom"]["network"]
    ])
    assert fund.exit_code == 0
    assert fund.output == clean_transaction_raw(
        transaction_raw=_["bytom"]["fund"]["unsigned"]
        ["transaction_raw"]) + "\n"
示例#23
0
def test_vapor_cli_claim(cli_tester):

    claim = cli_tester.invoke(cli_main, [
        "vapor", "claim", "--address",
        _["vapor"]["wallet"]["recipient"]["address"], "--transaction-id",
        _["vapor"]["transaction_id"], "--asset", _["vapor"]["asset"],
        "--amount", _["vapor"]["amount"], "--max-amount",
        _["vapor"]["max_amount"], "--unit", _["vapor"]["unit"], "--network",
        _["vapor"]["network"]
    ])
    assert claim.exit_code == 0
    assert claim.output == clean_transaction_raw(
        transaction_raw=_["vapor"]["claim"]["unsigned"]
        ["transaction_raw"]) + "\n"
示例#24
0
def test_bitcoin_cli_refund(cli_tester):

    refund = cli_tester.invoke(cli_main, [
        "bitcoin", "refund", "--address",
        _["bitcoin"]["wallet"]["sender"]["address"], "--transaction-id",
        _["bitcoin"]["transaction_id"], "--amount", _["bitcoin"]["amount"],
        "--max-amount", _["bitcoin"]["max_amount"], "--unit",
        _["bitcoin"]["unit"], "--version", _["bitcoin"]["version"],
        "--network", _["bitcoin"]["network"]
    ])

    assert refund.exit_code == 0
    assert refund.output == clean_transaction_raw(
        transaction_raw=_["bitcoin"]["refund"]["unsigned"]
        ["transaction_raw"]) + "\n"