@@ -408,6 +408,125 @@ def test_transfer_all_funds(
408408
409409 dbsync_utils .check_tx (cluster_obj = cluster , tx_raw_output = tx_raw_output )
410410
411+ @allure .link (helpers .get_vcs_link ())
412+ @pytest .mark .smoke
413+ @pytest .mark .dbsync
414+ def test_transfer_some_build_estimate (
415+ self ,
416+ cluster : clusterlib .ClusterLib ,
417+ payment_addrs : list [clusterlib .AddressRecord ],
418+ ):
419+ """Transfer some funds from one payment address to another.
420+
421+ Use the `transaction build-estimate` command.
422+
423+ * transfer some available funds from 1 source address to 1 destination address
424+ * check expected balance for source addresses
425+ * check expected balance for destination addresses
426+ * check output of the `transaction view` command
427+ * (optional) check transactions in db-sync
428+ """
429+ temp_template = common .get_test_id (cluster )
430+ amount = 2_000_000
431+
432+ src_address = payment_addrs [0 ].address
433+ dst_address = payment_addrs [1 ].address
434+
435+ txouts = [clusterlib .TxOut (address = dst_address , amount = amount )]
436+ tx_files = clusterlib .TxFiles (signing_key_files = [payment_addrs [0 ].skey_file ])
437+
438+ tx_raw_output = cluster .g_transaction .build_estimate_tx (
439+ src_address = src_address ,
440+ tx_name = temp_template ,
441+ txouts = txouts ,
442+ tx_files = tx_files ,
443+ )
444+ out_file_signed = cluster .g_transaction .sign_tx (
445+ tx_body_file = tx_raw_output .out_file ,
446+ signing_key_files = tx_files .signing_key_files ,
447+ tx_name = temp_template ,
448+ )
449+
450+ cluster .g_transaction .submit_tx (
451+ tx_file = out_file_signed ,
452+ txins = tx_raw_output .txins ,
453+ )
454+
455+ out_utxos = cluster .g_query .get_utxo (tx_raw_output = tx_raw_output )
456+ assert (
457+ clusterlib .filter_utxos (utxos = out_utxos , address = src_address )[0 ].amount
458+ == clusterlib .calculate_utxos_balance (tx_raw_output .txins ) - tx_raw_output .fee - amount
459+ )
460+ assert clusterlib .filter_utxos (utxos = out_utxos , address = dst_address )[0 ].amount == amount , (
461+ f"Incorrect balance for destination address `{ dst_address } `"
462+ )
463+
464+ common .check_missing_utxos (cluster_obj = cluster , utxos = out_utxos )
465+
466+ # Check `transaction view` command
467+ tx_view .check_tx_view (cluster_obj = cluster , tx_raw_output = tx_raw_output )
468+
469+ dbsync_utils .check_tx (cluster_obj = cluster , tx_raw_output = tx_raw_output )
470+
471+ @allure .link (helpers .get_vcs_link ())
472+ @pytest .mark .smoke
473+ @pytest .mark .dbsync
474+ def test_transfer_all_build_estimate (
475+ self ,
476+ cluster : clusterlib .ClusterLib ,
477+ payment_addrs_disposable : list [clusterlib .AddressRecord ],
478+ ):
479+ """Transfer all funds from one payment address to another.
480+
481+ Use the `transaction build-estimate` command.
482+
483+ * transfer all available funds from 1 source address to 1 destination address
484+ * check expected balance for destination addresses
485+ * check that balance for source address is 0 Lovelace
486+ * check output of the `transaction view` command
487+ * (optional) check transactions in db-sync
488+ """
489+ temp_template = common .get_test_id (cluster )
490+
491+ src_address = payment_addrs_disposable [1 ].address
492+ dst_address = payment_addrs_disposable [0 ].address
493+
494+ txouts = [clusterlib .TxOut (address = dst_address , amount = - 1 )]
495+ tx_files = clusterlib .TxFiles (signing_key_files = [payment_addrs_disposable [1 ].skey_file ])
496+
497+ tx_raw_output = cluster .g_transaction .build_estimate_tx (
498+ src_address = src_address ,
499+ tx_name = temp_template ,
500+ txouts = txouts ,
501+ tx_files = tx_files ,
502+ )
503+ out_file_signed = cluster .g_transaction .sign_tx (
504+ tx_body_file = tx_raw_output .out_file ,
505+ signing_key_files = tx_files .signing_key_files ,
506+ tx_name = temp_template ,
507+ )
508+
509+ cluster .g_transaction .submit_tx (
510+ tx_file = out_file_signed ,
511+ txins = tx_raw_output .txins ,
512+ )
513+
514+ out_utxos = cluster .g_query .get_utxo (tx_raw_output = tx_raw_output )
515+ assert not clusterlib .filter_utxos (utxos = out_utxos , address = src_address ), (
516+ f"Incorrect balance for source address `{ src_address } `"
517+ )
518+ assert (
519+ clusterlib .filter_utxos (utxos = out_utxos , address = dst_address )[0 ].amount
520+ == clusterlib .calculate_utxos_balance (tx_raw_output .txins ) - tx_raw_output .fee
521+ ), f"Incorrect balance for destination address `{ dst_address } `"
522+
523+ common .check_missing_utxos (cluster_obj = cluster , utxos = out_utxos )
524+
525+ # Check `transaction view` command
526+ tx_view .check_tx_view (cluster_obj = cluster , tx_raw_output = tx_raw_output )
527+
528+ dbsync_utils .check_tx (cluster_obj = cluster , tx_raw_output = tx_raw_output )
529+
411530 @allure .link (helpers .get_vcs_link ())
412531 @submit_utils .PARAM_SUBMIT_METHOD
413532 @common .PARAM_USE_BUILD_CMD
0 commit comments