diff --git a/multiversx_sdk_cli/cli_contracts.py b/multiversx_sdk_cli/cli_contracts.py index 2fe46672..3513aab9 100644 --- a/multiversx_sdk_cli/cli_contracts.py +++ b/multiversx_sdk_cli/cli_contracts.py @@ -411,7 +411,7 @@ def upgrade(args: Any): contract.address = Address(contract_address) sender = _prepare_sender(args) - tx = contract.upgrade(sender, arguments, gas_price, gas_limit, value, chain, version, args.guardian_address, args.options) + tx = contract.upgrade(sender, arguments, gas_price, gas_limit, value, chain, version, args.guardian, args.options) if args.guardian: tx = cosign_transaction(tx, args.guardian_service_url, args.guardian_2fa_code) diff --git a/multiversx_sdk_cli/tests/test_cli_contracts.py b/multiversx_sdk_cli/tests/test_cli_contracts.py new file mode 100644 index 00000000..547309d0 --- /dev/null +++ b/multiversx_sdk_cli/tests/test_cli_contracts.py @@ -0,0 +1,90 @@ +from pathlib import Path +from multiversx_sdk_cli.cli import main + + +def test_contract_deploy(): + parent = Path(__file__).parent + output_file = parent / "testdata-out" / "deploy.json" + + main( + [ + "contract", + "deploy", + "--bytecode", + f"{parent}/testdata/adder.wasm", + "--pem", + f"{parent}/testdata/testUser.pem", + "--proxy", + "https://testnet-api.multiversx.com", + "--chain", + "T", + "--recall-nonce", + "--gas-limit", + "5000000", + "--arguments", + "0", + "--outfile", + str(output_file), + ] + ) + assert Path.is_file(output_file) == True + + +def test_contract_upgrade(): + parent = Path(__file__).parent + output_file = parent / "testdata-out" / "upgrade.json" + contract_address = "erd1qqqqqqqqqqqqqpgq5l9jl0j0gnqmm7hn82zaydwux3s5xuwkyq8srt5vsy" + + main( + [ + "contract", + "upgrade", + contract_address, + "--bytecode", + f"{parent}/testdata/adder.wasm", + "--pem", + f"{parent}/testdata/testUser.pem", + "--proxy", + "https://testnet-api.multiversx.com", + "--chain", + "T", + "--recall-nonce", + "--gas-limit", + "5000000", + "--arguments", + "0", + "--outfile", + str(output_file), + ] + ) + assert Path.is_file(output_file) == True + + +def test_contract_call(): + parent = Path(__file__).parent + output_file = parent / "testdata-out" / "call.json" + contract_address = "erd1qqqqqqqqqqqqqpgq5l9jl0j0gnqmm7hn82zaydwux3s5xuwkyq8srt5vsy" + + main( + [ + "contract", + "call", + contract_address, + "--function", + "add", + "--pem", + f"{parent}/testdata/testUser.pem", + "--proxy", + "https://testnet-api.multiversx.com", + "--chain", + "T", + "--recall-nonce", + "--gas-limit", + "5000000", + "--arguments", + "5", + "--outfile", + str(output_file), + ] + ) + assert Path.is_file(output_file) == True diff --git a/multiversx_sdk_cli/tests/testdata/adder.wasm b/multiversx_sdk_cli/tests/testdata/adder.wasm new file mode 100755 index 00000000..820c0f40 Binary files /dev/null and b/multiversx_sdk_cli/tests/testdata/adder.wasm differ diff --git a/pyproject.toml b/pyproject.toml index 873d1aa4..414438de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "multiversx-sdk-cli" -version = "6.2.0" +version = "6.2.1" authors = [ { name="MultiversX" }, ]