Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
popenta committed Jan 11, 2024
1 parent 556889e commit 6fe877f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion multiversx_sdk_cli/cli_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def _add_contract_arg(sub: Any):


def _add_function_arg(sub: Any):
sub.add_argument("--function", required=True, help="the function to call")
sub.add_argument("--function", required=True, type=str, help="the function to call")


def _add_arguments_arg(sub: Any):
Expand Down
21 changes: 12 additions & 9 deletions multiversx_sdk_cli/contracts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import base64
import logging
from pathlib import Path
from typing import Any, List, Optional, Protocol, Sequence
from typing import Any, List, Optional, Protocol, Sequence, Union

from multiversx_sdk_core import (Token, TokenComputer, TokenTransfer,
Transaction, TransactionPayload)
Expand Down Expand Up @@ -79,7 +79,7 @@ def __init__(self, config: IConfig):
def prepare_deploy_transaction(self,
owner: Account,
bytecode: Path,
arguments: List[str],
arguments: Union[List[str], None],
upgradeable: bool,
readable: bool,
payable: bool,
Expand All @@ -90,11 +90,13 @@ def prepare_deploy_transaction(self,
version: int,
options: int,
guardian: str) -> Transaction:
args = prepare_args_for_factory(arguments) if arguments else []

tx = self._factory.create_transaction_for_deploy(
sender=owner.address,
bytecode=bytecode,
gas_limit=gas_limit,
arguments=prepare_args_for_factory(arguments),
arguments=args,
native_transfer_amount=value,
is_upgradeable=upgradeable,
is_readable=readable,
Expand All @@ -113,22 +115,23 @@ def prepare_execute_transaction(self,
caller: Account,
contract: Address,
function: str,
arguments: List[str],
arguments: Union[List[str], None],
gas_limit: int,
value: int,
transfers: List[str],
transfers: Union[List[str], None],
nonce: int,
version: int,
options: int,
guardian: str) -> Transaction:
token_transfers = self._prepare_token_transfers(transfers) if transfers else []
args = prepare_args_for_factory(arguments) if arguments else []

tx = self._factory.create_transaction_for_execute(
sender=caller.address,
contract=contract,
function=function,
gas_limit=gas_limit,
arguments=prepare_args_for_factory(arguments),
arguments=args,
native_transfer_amount=value,
token_transfers=token_transfers
)
Expand All @@ -144,7 +147,7 @@ def prepare_upgrade_transaction(self,
owner: Account,
contract: IAddress,
bytecode: Path,
arguments: List[str],
arguments: Union[List[str], None],
upgradeable: bool,
readable: bool,
payable: bool,
Expand All @@ -155,14 +158,14 @@ def prepare_upgrade_transaction(self,
version: int,
options: int,
guardian: str) -> Transaction:
arguments = prepare_args_for_factory(arguments)
args = prepare_args_for_factory(arguments) if arguments else []

tx = self._factory.create_transaction_for_upgrade(
sender=owner.address,
contract=contract,
bytecode=bytecode,
gas_limit=gas_limit,
arguments=arguments,
arguments=args,
native_transfer_amount=value,
is_upgradeable=upgradeable,
is_readable=readable,
Expand Down

0 comments on commit 6fe877f

Please sign in to comment.