@@ -395,7 +395,8 @@ def validate_arguments(args: Any):
395395def _get_delegation_controller (args : Any ):
396396 chain_id = cli_shared .get_chain_id (args .proxy , args .chain )
397397 config = TransactionsFactoryConfig (chain_id )
398- delegation = DelegationOperations (config )
398+ gas_estimator = cli_shared .initialize_gas_limit_estimator (args )
399+ delegation = DelegationOperations (config = config , gas_limit_estimator = gas_estimator )
399400 return delegation
400401
401402
@@ -408,15 +409,14 @@ def do_create_delegation_contract(args: Any):
408409 args = args ,
409410 )
410411
411- gas_limit = args .gas_limit if args .gas_limit else 0
412412 delegation = _get_delegation_controller (args )
413413
414414 tx = delegation .prepare_transaction_for_new_delegation_contract (
415415 owner = sender ,
416416 native_amount = int (args .value ),
417417 total_delegation_cap = int (args .total_delegation_cap ),
418418 service_fee = int (args .service_fee ),
419- gas_limit = gas_limit ,
419+ gas_limit = args . gas_limit ,
420420 gas_price = int (args .gas_price ),
421421 nonce = sender .nonce ,
422422 version = int (args .version ),
@@ -453,7 +453,6 @@ def add_new_nodes(args: Any):
453453 args = args ,
454454 )
455455
456- gas_limit = args .gas_limit if args .gas_limit else 0
457456 public_keys , signed_messages = _get_public_keys_and_signed_messages (args )
458457
459458 delegation = _get_delegation_controller (args )
@@ -462,7 +461,7 @@ def add_new_nodes(args: Any):
462461 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
463462 public_keys = public_keys ,
464463 signed_messages = signed_messages ,
465- gas_limit = gas_limit ,
464+ gas_limit = args . gas_limit ,
466465 gas_price = int (args .gas_price ),
467466 value = int (args .value ),
468467 nonce = sender .nonce ,
@@ -502,15 +501,14 @@ def remove_nodes(args: Any):
502501 args = args ,
503502 )
504503
505- gas_limit = args .gas_limit if args .gas_limit else 0
506504 public_keys = _load_validators_public_keys (args )
507505
508506 delegation = _get_delegation_controller (args )
509507 tx = delegation .prepare_transaction_for_removing_nodes (
510508 owner = sender ,
511509 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
512510 public_keys = public_keys ,
513- gas_limit = gas_limit ,
511+ gas_limit = args . gas_limit ,
514512 gas_price = int (args .gas_price ),
515513 value = int (args .value ),
516514 nonce = sender .nonce ,
@@ -551,15 +549,14 @@ def stake_nodes(args: Any):
551549 args = args ,
552550 )
553551
554- gas_limit = args .gas_limit if args .gas_limit else 0
555552 public_keys = _load_validators_public_keys (args )
556553
557554 delegation = _get_delegation_controller (args )
558555 tx = delegation .prepare_transaction_for_staking_nodes (
559556 owner = sender ,
560557 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
561558 public_keys = public_keys ,
562- gas_limit = gas_limit ,
559+ gas_limit = args . gas_limit ,
563560 gas_price = int (args .gas_price ),
564561 value = int (args .value ),
565562 nonce = sender .nonce ,
@@ -589,15 +586,14 @@ def unbond_nodes(args: Any):
589586 args = args ,
590587 )
591588
592- gas_limit = args .gas_limit if args .gas_limit else 0
593589 public_keys = _load_validators_public_keys (args )
594590
595591 delegation = _get_delegation_controller (args )
596592 tx = delegation .prepare_transaction_for_unbonding_nodes (
597593 owner = sender ,
598594 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
599595 public_keys = public_keys ,
600- gas_limit = gas_limit ,
596+ gas_limit = args . gas_limit ,
601597 gas_price = int (args .gas_price ),
602598 value = int (args .value ),
603599 nonce = sender .nonce ,
@@ -619,15 +615,14 @@ def unstake_nodes(args: Any):
619615 args = args ,
620616 )
621617
622- gas_limit = args .gas_limit if args .gas_limit else 0
623618 public_keys = _load_validators_public_keys (args )
624619
625620 delegation = _get_delegation_controller (args )
626621 tx = delegation .prepare_transaction_for_unstaking_nodes (
627622 owner = sender ,
628623 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
629624 public_keys = public_keys ,
630- gas_limit = gas_limit ,
625+ gas_limit = args . gas_limit ,
631626 gas_price = int (args .gas_price ),
632627 value = int (args .value ),
633628 nonce = sender .nonce ,
@@ -649,15 +644,14 @@ def unjail_nodes(args: Any):
649644 args = args ,
650645 )
651646
652- gas_limit = args .gas_limit if args .gas_limit else 0
653647 public_keys = _load_validators_public_keys (args )
654648
655649 delegation = _get_delegation_controller (args )
656650 tx = delegation .prepare_transaction_for_unjailing_nodes (
657651 owner = sender ,
658652 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
659653 public_keys = public_keys ,
660- gas_limit = gas_limit ,
654+ gas_limit = args . gas_limit ,
661655 gas_price = int (args .gas_price ),
662656 value = int (args .value ),
663657 nonce = sender .nonce ,
@@ -678,16 +672,13 @@ def delegate(args: Any):
678672 args = args ,
679673 )
680674
681- gas_limit = args .gas_limit if args .gas_limit else 0
682- value = int (args .value )
683-
684675 delegation = _get_delegation_controller (args )
685676 tx = delegation .prepare_transaction_for_delegating (
686677 owner = sender ,
687678 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
688- gas_limit = gas_limit ,
679+ gas_limit = args . gas_limit ,
689680 gas_price = int (args .gas_price ),
690- value = value ,
681+ value = int ( args . value ) ,
691682 nonce = sender .nonce ,
692683 version = int (args .version ),
693684 options = int (args .options ),
@@ -706,13 +697,11 @@ def claim_rewards(args: Any):
706697 args = args ,
707698 )
708699
709- gas_limit = args .gas_limit if args .gas_limit else 0
710-
711700 delegation = _get_delegation_controller (args )
712701 tx = delegation .prepare_transaction_for_claiming_rewards (
713702 owner = sender ,
714703 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
715- gas_limit = gas_limit ,
704+ gas_limit = args . gas_limit ,
716705 gas_price = int (args .gas_price ),
717706 value = int (args .value ),
718707 nonce = sender .nonce ,
@@ -732,13 +721,11 @@ def redelegate_rewards(args: Any):
732721 args = args ,
733722 )
734723
735- gas_limit = args .gas_limit if args .gas_limit else 0
736-
737724 delegation = _get_delegation_controller (args )
738725 tx = delegation .prepare_transaction_for_redelegating_rewards (
739726 owner = sender ,
740727 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
741- gas_limit = gas_limit ,
728+ gas_limit = args . gas_limit ,
742729 gas_price = int (args .gas_price ),
743730 value = int (args .value ),
744731 nonce = sender .nonce ,
@@ -758,16 +745,13 @@ def undelegate(args: Any):
758745 args = args ,
759746 )
760747
761- gas_limit = args .gas_limit if args .gas_limit else 0
762- value = int (args .value )
763-
764748 delegation = _get_delegation_controller (args )
765749 tx = delegation .prepare_transaction_for_undelegating (
766750 owner = sender ,
767751 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
768- gas_limit = gas_limit ,
752+ gas_limit = args . gas_limit ,
769753 gas_price = int (args .gas_price ),
770- value = value ,
754+ value = int ( args . value ) ,
771755 nonce = sender .nonce ,
772756 version = int (args .version ),
773757 options = int (args .options ),
@@ -786,13 +770,11 @@ def withdraw(args: Any):
786770 args = args ,
787771 )
788772
789- gas_limit = args .gas_limit if args .gas_limit else 0
790-
791773 delegation = _get_delegation_controller (args )
792774 tx = delegation .prepare_transaction_for_withdrawing (
793775 owner = sender ,
794776 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
795- gas_limit = gas_limit ,
777+ gas_limit = args . gas_limit ,
796778 gas_price = int (args .gas_price ),
797779 value = int (args .value ),
798780 nonce = sender .nonce ,
@@ -813,14 +795,12 @@ def change_service_fee(args: Any):
813795 args = args ,
814796 )
815797
816- gas_limit = args .gas_limit if args .gas_limit else 0
817-
818798 delegation = _get_delegation_controller (args )
819799 tx = delegation .prepare_transaction_for_changing_service_fee (
820800 owner = sender ,
821801 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
822802 service_fee = int (args .service_fee ),
823- gas_limit = gas_limit ,
803+ gas_limit = args . gas_limit ,
824804 gas_price = int (args .gas_price ),
825805 value = int (args .value ),
826806 nonce = sender .nonce ,
@@ -841,14 +821,12 @@ def modify_delegation_cap(args: Any):
841821 args = args ,
842822 )
843823
844- gas_limit = args .gas_limit if args .gas_limit else 0
845-
846824 delegation = _get_delegation_controller (args )
847825 tx = delegation .prepare_transaction_for_modifying_delegation_cap (
848826 owner = sender ,
849827 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
850828 delegation_cap = int (args .delegation_cap ),
851- gas_limit = gas_limit ,
829+ gas_limit = args . gas_limit ,
852830 gas_price = int (args .gas_price ),
853831 value = int (args .value ),
854832 nonce = sender .nonce ,
@@ -869,15 +847,13 @@ def automatic_activation(args: Any):
869847 args = args ,
870848 )
871849
872- gas_limit = args .gas_limit if args .gas_limit else 0
873-
874850 delegation = _get_delegation_controller (args )
875851 tx = delegation .prepare_transaction_for_automatic_activation (
876852 owner = sender ,
877853 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
878854 set = args .set ,
879855 unset = args .unset ,
880- gas_limit = gas_limit ,
856+ gas_limit = args . gas_limit ,
881857 gas_price = int (args .gas_price ),
882858 value = int (args .value ),
883859 nonce = sender .nonce ,
@@ -898,15 +874,13 @@ def redelegate_cap(args: Any):
898874 args = args ,
899875 )
900876
901- gas_limit = args .gas_limit if args .gas_limit else 0
902-
903877 delegation = _get_delegation_controller (args )
904878 tx = delegation .prepare_transaction_for_redelegate_cap (
905879 owner = sender ,
906880 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
907881 set = args .set ,
908882 unset = args .unset ,
909- gas_limit = gas_limit ,
883+ gas_limit = args . gas_limit ,
910884 gas_price = int (args .gas_price ),
911885 value = int (args .value ),
912886 nonce = sender .nonce ,
@@ -927,16 +901,14 @@ def set_metadata(args: Any):
927901 args = args ,
928902 )
929903
930- gas_limit = args .gas_limit if args .gas_limit else 0
931-
932904 delegation = _get_delegation_controller (args )
933905 tx = delegation .prepare_transaction_for_setting_metadata (
934906 owner = sender ,
935907 delegation_contract = Address .new_from_bech32 (args .delegation_contract ),
936908 name = args .name ,
937909 website = args .website ,
938910 identifier = args .identifier ,
939- gas_limit = gas_limit ,
911+ gas_limit = args . gas_limit ,
940912 gas_price = int (args .gas_price ),
941913 value = int (args .value ),
942914 nonce = sender .nonce ,
@@ -957,14 +929,12 @@ def make_new_contract_from_validator_data(args: Any):
957929 args = args ,
958930 )
959931
960- gas_limit = args .gas_limit if args .gas_limit else 0
961-
962932 delegation = _get_delegation_controller (args )
963933 tx = delegation .prepare_transaction_for_creating_delegation_contract_from_validator (
964934 owner = sender ,
965935 max_cap = args .max_cap ,
966936 service_fee = args .fee ,
967- gas_limit = gas_limit ,
937+ gas_limit = args . gas_limit ,
968938 gas_price = int (args .gas_price ),
969939 value = int (args .value ),
970940 nonce = sender .nonce ,
0 commit comments