From 508165977e8bf726abe34b388db2430b90f28db9 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Mon, 23 Jun 2025 17:09:27 +0300 Subject: [PATCH 1/7] add multisig and governance to mxpy cookbook --- docs/sdk-and-tools/mxpy/installing-mxpy.md | 13 +- docs/sdk-and-tools/mxpy/mxpy-cli.md | 270 ++++++++++++++++++++- 2 files changed, 279 insertions(+), 4 deletions(-) diff --git a/docs/sdk-and-tools/mxpy/installing-mxpy.md b/docs/sdk-and-tools/mxpy/installing-mxpy.md index 353aa63ba..9514d04bb 100644 --- a/docs/sdk-and-tools/mxpy/installing-mxpy.md +++ b/docs/sdk-and-tools/mxpy/installing-mxpy.md @@ -41,10 +41,15 @@ pipx install multiversx-sdk-cli --force This will simply install the latest version available. +As of latest versions, we also publish the package under the `mxpy` name. Typing the following command should also work: +```sh +pipx install mxpy +``` + In case you want to install a specific version you should also specify the version. ```sh -pipx install multiversx-sdk-cli==9.5.1 +pipx install multiversx-sdk-cli==11.0.0 ``` You can also install **mxpy** directly from a GitHub branch. Replace `branch_name` with your desired branch and run the following command: @@ -98,3 +103,9 @@ To upgrade **mxpy** to a newer version, you can simply run the following command ```sh pipx upgrade multiversx-sdk-cli ``` + +or, if you've installed the CLI using the `mxpy` name: + +```sh +pipx upgrade mxpy +``` diff --git a/docs/sdk-and-tools/mxpy/mxpy-cli.md b/docs/sdk-and-tools/mxpy/mxpy-cli.md index 49b9519ff..380d87726 100644 --- a/docs/sdk-and-tools/mxpy/mxpy-cli.md +++ b/docs/sdk-and-tools/mxpy/mxpy-cli.md @@ -86,6 +86,8 @@ mxpy's configuration is stored in the file `~/multiversx-sdk/mxpy.json`. ### Viewing the current mxpy configuration +As of `mxpy v11`, we've introduced more configuration options, such as `environments` and `wallets`. + In order to view the current configuration, one can issue the command `mxpy config dump`. Output example: ```json @@ -110,17 +112,201 @@ One can alter the current configuration using the command `mxpy config set`. For mxpy config set dependencies.testwallets.tag v1.0.0 ``` -The default config contains the **default address hrp** which depending on the network (e.g Sovereign Chain) might need to be altered. +The default config contains the **log level** of the CLI. The default log level is set to `info`, but can be changed. The available values are: [debug, info, warning, error]. To set the log level, we can use the following command: +```sh +mxpy config set log_level debug +``` + +:::note +Previously, the `default_address_hrp` was also stored in the config. As of `mxpy v11` it has been moved to the `env` config, which we'll talk about in the next section. +::: + +### Configuring environments + +Environments can be useful when switching between networks, such as Mainnet and Devnet. + +The values that are available for configuration and their default values are the following: +```json +{ + "default_address_hrp": "erd", + "proxy_url": "", + "explorer_url": "", + "ask_confirmation": "false", +} +``` + +#### Creating a new env config + +To create a new env config, we use the following command: -Most of the commands that might need the `address hrp` already provide a parameter called `--hrp` or `--address-hrp`, that can be explicitly set, but there are system smart contract addresses that cannot be changed by providing the parameter. If that addresses need to be changed, we can use the following command to set the `default hrp` that will be used throughout mxpy. Here we set the default hrp to `test` : ```sh -mxpy config set default_address_hrp test +mxpy env new +``` + +Additionally, `--template` can be used to create a config from an existing env config. After a new env config is created, it is set as the active env config. After a new env config is created, the values need to be set using the `mxpy env set` command. + +#### Setting the default hrp + +The `default_address_hrp` might need to be changed depending on the network you plan on using (e.g Sovereign Chain). Most of the commands that might need the `address hrp` already provide a parameter called `--hrp` or `--address-hrp`, that can be explicitly set, but there are system smart contract addresses that cannot be changed by providing the parameter. If that addresses need to be changed, we can use the following command to set the `default hrp` that will be used throughout mxpy. Here we set the default hrp to `test`: + +```sh +mxpy env set default_address_hrp test ``` :::note Explicitly providing `--hrp` will **always** be used over the one fetched from the network or the `hrp` set in the config. ::: +#### Setting the proxy url + +If `proxy_url` is set in the active environment, the `--proxy` argument is no longer required for the commands that require this argument. + +To set the proxy url, use the following command: + +```sh +mxpy env set proxy_url https://devnet-api.multiversx.com +``` + +#### Setting the explorer url + +mxpy already knows the explorer urls for all three networks (Mainnet, Devnet, Testnet). This is particulary useful when running the CLI on custom networks where an explorer is also available. This key is not required to be present in the env config for the config to be valid. To set the explorer url use the following command: + +```sh +mxpy env set explorer_url +``` + +#### Setting the ask for confirmation flag + +If set to `true`, whenever sending a transaction, mxpy will display the transaction and will ask for your confirmation. To set the flag, use the following command: + +```sh +mxpy env set ask_confirmation true +``` + +#### Dumping the active env config + +We can see the values set in our active env config. To do so, we use the following command: + +```sh +mxpy env dump +``` + +#### Dumping all the available env configs + +We may have multiple env configs, maybe one for each network. To dump all the available env configs, we use the following command: + +```sh +mxpy env list +``` + +#### Deleting a value from the active env config + +We can also delete the key-value pairs saved in the env config. For example, let's say we want to delete the explorer url, so we use the following command: + +```sh +mxpy env delete explorer_url +``` + +#### Getting a value from the active env config + +If we want to see just the value of a specific env config key, we can use the following command: + +```sh +mxpy env get +``` + +#### Deleting an env config + +To delete an env config, we use the following command: + +```sh +mxpy env remove +``` + +#### Switching to a different env config + +To switch to a new env config, we use the following command: + +```sh +mxpy env switch +``` + +### Configuring wallets + +Wallets can be configured in the address config. From all the wallets configured, one must be set as the active wallet. This wallet will be the default wallet used through mxpy if not another wallet is provided via CLI args, such as `--pem`, `--keystore` or `--ledger`. Additionally, the `--sender` argument has been added and can be used to specify a certain sender from the address config (e.g. --sender alice). + +The values that are available for configuring wallets are the following: +```json +{ + "kind": "", + "path": "", + "index": "", +} +``` + +The `kind` field represents the wallet type and can be either `pem` or `keystore`. If the wallet is of type `keystore`, you'll be prompted to enter the wallet's password. + +The `path` field represents the absolute path to the wallet. + +The `index` field represents the index that will be used when deriving the wallet from the secret key. This field is optional, the default index is `0`. + +#### Creating a new address config + +To create a new address config, we use the following command: + +```sh +mxpy address new +``` + +#### Setting the address config fields + +For a config to be valid, we need to set at least the `kind` and `path` fields. To do so, we use the following command: + +```sh +mxpy address set kind pem +mxpy address set path absolute/path/to/pem/wallet.pem +``` + +#### Getting the value of a field + +Very similar to `mxpy config` or `mxpy env`, we can get the value of a field from the active config using the following command: + +```sh +mxpy env get path +``` + +#### Dumping the active address config + +To view all the properties of the active address, use the following command: + +```sh +mxpy address dump +``` + +#### Dumping all availale addresses + +To view all the addresses configured, use the following command: + +```sh +mxpy address list +``` + +#### Switching to a different address + +We may have multiple addresses configured, so to switch between them, we use the following command: + +```sh +mxpy address switch +``` + +#### Removing an address from the config + +We can remove an address from the config using the alias of the address and the following command: + +```sh +mxpy address remove +``` + [comment]: # (mx-context-auto) ## Creating wallets @@ -672,3 +858,81 @@ mxpy contract call erd1qqqqqqqqqqqqqpgqwwef37kmegph97egvvrxh3nccx7xuygez8ns682zz :::note As of October 2023, on Windows (or WSL), you might encounter some issues when trying to use Ledger in `mxpy`. ::: + +## Interacting with the Multisig Smart Contract + +As of `mxpy v11`, interacting with Multisig contracts has become a lot easier because a dedicated command group called `mxpy multisig` has been added. We can deploy a multisig contract, create proposals and query the contract. For a full list of all the possible actions, run the following command: + +```sh +mxpy multisig -h +``` + +#### Deploying a multisig contract + +```sh +mxpy multisig deploy --bytecode path/to/multisig.wasm \ + --abi path/to/multisig.abi.json + --quorum 2 + --board-members erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx + --proxy=https://devnet-gateway.multiversx.com \ + --gas-limit 100000000 \ + --send +``` + +#### Creating a new proposal + +```sh +mxpy multisig add-board-member --contract erd1qqqqqqqqqqqqqpgq2ukrsg73nwgu3uz6sp8vequuyrhtv2akd8ssyrg7wj \ + --abi path/to/multisig.abi.json + --board-member erd1k2s324ww2g0yj38qn2ch2jwctdy8mnfxep94q9arncc6xecg3xaq6mjse8 + --proxy=https://devnet-gateway.multiversx.com \ + --gas-limit 10000000 \ + --send +``` + +#### Querying the contract + +```sh +mxpy multisig get-proposers --contract erd1qqqqqqqqqqqqqpgq2ukrsg73nwgu3uz6sp8vequuyrhtv2akd8ssyrg7wj \ + --abi path/to/multisig.abi.json + --proxy=https://devnet-gateway.multiversx.com +``` + +## Interacting with the Governance Smart Contract + +As of `mxpy v11`, mxpy allows for easier interaction with the Governance smart contract. We can create a new governance proposal, vote for a proposal and query the contract. For a full list of the available commands, run the following command: + +```sh +mxpy governance -h +``` + +#### Creating a new proposal + +```sh +mxpy governance propose \ + --commit-hash 30118901102b0bef11d675f4327565ae5246eeb5 \ + --start-vote-epoch 1000 \ + --end-vote-epoch 1010 \ + --proxy=https://devnet-gateway.multiversx.com \ + --gas-limit 100000000 \ + --send +``` + +#### Voting for a proposal + +```sh +mxpy governance vote \ + --proposal-nonce 1 \ + --vote yes \ + --proxy=https://devnet-gateway.multiversx.com \ + --gas-limit 100000000 \ + --send +``` + +#### Querying the contract + +```sh +mxpy governance get-proposal-info \ + --proposal-nonce 1 \ + --proxy=https://devnet-gateway.multiversx.com +``` From b979a96bf4bec1024fd464c16b8df1e17385b633 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Mon, 23 Jun 2025 17:09:36 +0300 Subject: [PATCH 2/7] remove deprecated args --- .../upgrading-smart-contracts.md | 4 ++-- .../user-defined-smart-contracts.md | 22 +++++++++---------- .../setup-local-testnet-advanced.md | 16 +++++++------- docs/developers/setup-local-testnet.md | 12 +++++----- .../mxpy/smart-contract-interactions.md | 14 ++++++------ docs/validators/staking/staking.md | 10 ++++----- docs/validators/staking/unjailing.md | 14 +++++------- 7 files changed, 44 insertions(+), 48 deletions(-) diff --git a/docs/developers/developer-reference/upgrading-smart-contracts.md b/docs/developers/developer-reference/upgrading-smart-contracts.md index cc98c99fb..a0e36c682 100644 --- a/docs/developers/developer-reference/upgrading-smart-contracts.md +++ b/docs/developers/developer-reference/upgrading-smart-contracts.md @@ -40,7 +40,7 @@ Let's assume we deploy the contract with the argument **1u64**, and then we upgr Upgrading a smart contract is a relatively easy process, but its implications are not exactly obvious. To upgrade a smart contract, simply run the following command: ``` -mxpy --verbose contract upgrade SC_ADDRESS --recall-nonce \ +mxpy --verbose contract upgrade SC_ADDRESS \ --pem=PEM_PATH --bytecode=WASM_PATH \ --gas-limit=100000000 \ --send --proxy=https://devnet-gateway.multiversx.com --chain=D @@ -51,7 +51,7 @@ Replace SC_ADDRESS, PEM_PATH and WASM_PATH accordingly. Also, if you want to use This will replace the given SC's code with the one from the provided file, but that is not all. Additionally, it will run the new code's `upgrade` function. So, if your `upgrade` function has any arguments, the command has to be run by also giving said arguments: ``` -mxpy --verbose contract upgrade SC_ADDRESS --recall-nonce \ +mxpy --verbose contract upgrade SC_ADDRESS \ --pem=PEM_PATH --bytecode=WASM_PATH \ --arguments arg1 arg2 arg3 --gas-limit=100000000 \ diff --git a/docs/developers/gas-and-fees/user-defined-smart-contracts.md b/docs/developers/gas-and-fees/user-defined-smart-contracts.md index 0e8988072..63e1750dd 100644 --- a/docs/developers/gas-and-fees/user-defined-smart-contracts.md +++ b/docs/developers/gas-and-fees/user-defined-smart-contracts.md @@ -18,7 +18,7 @@ At first, pass the maximum possible amount for `gas-limit` (no guessing). ```bash $ mxpy --verbose contract deploy --bytecode=./contract.wasm \ - --recall-nonce --gas-limit=600000000 \ + --gas-limit=600000000 \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --simulate ``` @@ -43,7 +43,7 @@ After that, check the cost simulation by running the simulation once again, but ```bash $ mxpy --verbose contract deploy --bytecode=./contract.wasm \ - --recall-nonce --gas-limit=1849711 \ + --gas-limit=1849711 \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --simulate ``` @@ -65,7 +65,7 @@ In the end, let's actually deploy the contract: ```bash $ mxpy --verbose contract deploy --bytecode=./contract.wasm \ - --recall-nonce --gas-limit=1849711 \ + --gas-limit=1849711 \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --send --wait-result ``` @@ -92,7 +92,7 @@ Assuming we've already deployed the contract (see above) let's get the cost for $ mxpy --verbose contract call erd1qqqqqqqqqqqqqpgqygvvtlty3v7cad507v5z793duw9jjmlxd8sszs8a2y \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --function=increment\ - --recall-nonce --gas-limit=600000000\ + --gas-limit=600000000\ --simulate ``` @@ -114,7 +114,7 @@ In the end, let's actually call the contract: $ mxpy --verbose contract call erd1qqqqqqqqqqqqqpgqygvvtlty3v7cad507v5z793duw9jjmlxd8sszs8a2y \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --function=increment\ - --recall-nonce --gas-limit=1225515\ + --gas-limit=1225515\ --send --wait-result ``` @@ -142,12 +142,12 @@ Let's deploy the contracts `A` and `B`: ```bash $ mxpy --verbose contract deploy --bytecode=./a.wasm \ - --recall-nonce --gas-limit=5000000 \ + --gas-limit=5000000 \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --send --wait-result --outfile=a.json $ mxpy --verbose contract deploy --bytecode=./b.wasm \ - --recall-nonce --gas-limit=5000000 \ + --gas-limit=5000000 \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --send --wait-result --outfile=b.json ``` @@ -160,7 +160,7 @@ $ export hexAddressOfB=0x$(mxpy wallet bech32 --decode erd1qqqqqqqqqqqqqpgqj5zft $ mxpy --verbose contract call erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --function=foo\ - --recall-nonce --gas-limit=50000000\ + --gas-limit=50000000\ --arguments ${hexAddressOfB}\ --simulate ``` @@ -226,7 +226,7 @@ For our example, let's simulate using the following values for `gasLimit`: `7619 $ mxpy --verbose contract call erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --function=foo\ - --recall-nonce --gas-limit=7619200\ + --gas-limit=7619200\ --arguments ${hexAddressOfB}\ --simulate @@ -235,7 +235,7 @@ $ mxpy --verbose contract call erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2 mxpy --verbose contract call erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --function=foo\ - --recall-nonce --gas-limit=7000000\ + --gas-limit=7000000\ --arguments ${hexAddressOfB}\ --simulate @@ -244,7 +244,7 @@ mxpy --verbose contract call erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9 mxpy --verbose contract call erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --function=foo\ - --recall-nonce --gas-limit=6000000\ + --gas-limit=6000000\ --arguments ${hexAddressOfB}\ --simulate diff --git a/docs/developers/setup-local-testnet-advanced.md b/docs/developers/setup-local-testnet-advanced.md index 891b66166..fcae73419 100644 --- a/docs/developers/setup-local-testnet-advanced.md +++ b/docs/developers/setup-local-testnet-advanced.md @@ -175,7 +175,7 @@ Given the request above, extract and save the fields `erd_chain_id` and `erd_min Let's send a simple transaction using **mxpy:** ```bash -$ mxpy tx new --recall-nonce --data="Hello, World" --gas-limit=70000 \ +$ mxpy tx new --data="Hello, World" --gas-limit=70000 \ --receiver=erd1... \ --pem=./sandbox/node/config/walletKey.pem --pem-index=0 \ --proxy=http://localhost:7950 \ @@ -197,7 +197,7 @@ Let's deploy a Smart Contract using **mxpy**. ```bash Deploy mxpy --verbose contract deploy --bytecode=./mycontract/output/contract.wasm \ - --recall-nonce --gas-limit=5000000 \ + --gas-limit=5000000 \ --pem=./sandbox/node/config/walletKey.pem --pem-index=0 \ --outfile=contract.json \ --proxy=http://localhost:7950 \ @@ -216,16 +216,16 @@ If everything is fine (transaction status is `executed` and the `code` property ```bash Call mxpy --verbose contract call erd1qqqqqqqqqqqqqpgql... \ - --recall-nonce --gas-limit=1000000 --function=increment \ - --pem=./sandbox/node/config/walletKey.pem --pem-index=0 --outfile=myCall.json \ - --proxy=http://localhost:7950 \ - --send + --gas-limit=1000000 --function=increment \ + --pem=./sandbox/node/config/walletKey.pem --pem-index=0 --outfile=myCall.json \ + --proxy=http://localhost:7950 \ + --send ``` ```bash Query -mxpy --verbose contract query erd1qqqqqqqqqqqqqpgqlq... \ +mxpy --verbose contract query erd1qqqqqqqqqqqqqpgqlq... \ --function=get \ - --proxy=http://localhost:7950 + --proxy=http://localhost:7950 ``` diff --git a/docs/developers/setup-local-testnet.md b/docs/developers/setup-local-testnet.md index cb262b7e8..1c05ed5b1 100644 --- a/docs/developers/setup-local-testnet.md +++ b/docs/developers/setup-local-testnet.md @@ -64,7 +64,7 @@ If everything goes well, in the terminal you should see logs coming from the nod ``` INFO:cli.localnet:Starting localnet... -... +... INFO:localnet:Starting process ['./seednode', ... ... INFO:localnet:Starting process ['./node', ... @@ -326,7 +326,7 @@ These wallets (Alice, Bob, Carol, ..., Mike) **are publicly known** - they shoul Let's send a simple transaction using **mxpy**: ```bash -mxpy tx new --recall-nonce --data="Hello, World" --gas-limit=70000 \ +mxpy tx new --data="Hello, World" --gas-limit=70000 \ --receiver=erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --chain=localnet --proxy=http://localhost:7950 \ @@ -347,7 +347,7 @@ Let's deploy a Smart Contract using **mxpy**. ```bash mxpy --verbose contract deploy --bytecode=./contract.wasm \ - --recall-nonce --gas-limit=5000000 \ + --gas-limit=5000000 \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --outfile=contract.json \ --chain=localnet --proxy=http://localhost:7950 \ @@ -365,7 +365,7 @@ If everything is fine (transaction status is `executed` and the `code` property ```bash mxpy --verbose contract call erd1qqqqqqqqqqqqqpgqj5zftf3ef3gqm3gklcetpmxwg43rh8z2d8ss2e49aq \ - --recall-nonce --gas-limit=1000000 --function=increment \ + --gas-limit=1000000 --function=increment \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem --outfile=myCall.json \ --chain=localnet --proxy=http://localhost:7950 \ --send @@ -386,13 +386,13 @@ At times, you can simulate transactions instead of broadcasting them, by replaci ```bash # Simulate: Call Contract mxpy contract call erd1qqqqqqqqqqqqqpgqj5zftf3ef3gqm3gklcetpmxwg43rh8z2d8ss2e49aq \ - --recall-nonce --gas-limit=1000000 --function=increment \ + --gas-limit=1000000 --function=increment \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --chain=localnet --proxy=http://localhost:7950 \ --simulate # Simulate: Simple Transfer -mxpy tx new --recall-nonce --data="Hello, World" --gas-limit=70000 \ +mxpy tx new --data="Hello, World" --gas-limit=70000 \ --receiver=erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --chain=localnet --proxy=http://localhost:7950 \ diff --git a/docs/sdk-and-tools/mxpy/smart-contract-interactions.md b/docs/sdk-and-tools/mxpy/smart-contract-interactions.md index 7c0eecc73..4e1f4e0b4 100644 --- a/docs/sdk-and-tools/mxpy/smart-contract-interactions.md +++ b/docs/sdk-and-tools/mxpy/smart-contract-interactions.md @@ -49,7 +49,7 @@ Now, in order to deploy the contract, we use the special **deploy** function of ``` deploySC() { - mxpy --verbose contract deploy --recall-nonce \ + mxpy --verbose contract deploy \ --bytecode=${WASM_PATH} \ --pem=${WALLET_PEM} \ --gas-limit=60000000 \ @@ -77,7 +77,7 @@ The upgrade function would look like this: ``` upgradeSC() { - mxpy --verbose contract upgrade ${CONTRACT_ADDRESS} --recall-nonce --payable \ + mxpy --verbose contract upgrade ${CONTRACT_ADDRESS} --payable \ --bytecode=${WASM_PATH} \ --pem=${WALLET_PEM} \ --gas-limit=60000000 \ @@ -113,7 +113,7 @@ ADDRESS_ARGUMENT="erd14nw9pukqyqu75gj0shm8upsegjft8l0awjefp877phfx74775dsq49swp3 THIRD_BIGUINT_ARGUMENT=0x0f4240 myNonPayableEndpoint() { address_argument="0x$(mxpy wallet bech32 --decode ${ADDRESS_ARGUMENT})" - mxpy --verbose contract call ${CONTRACT_ADDRESS} --recall-nonce \ + mxpy --verbose contract call ${CONTRACT_ADDRESS} \ --pem=${WALLET_PEM} \ --gas-limit=6000000 \ --proxy=${PROXY} --chain=${CHAIN_ID} \ @@ -152,7 +152,7 @@ So, in case of our **myNonPayableEndpoint** interaction, we can write it like so ADDRESS_ARGUMENT="erd14nw9pukqyqu75gj0shm8upsegjft8l0awjefp877phfx74775dsq49swp3" THIRD_BIGUINT_ARGUMENT=1000000 myNonPayableEndpoint() { - mxpy --verbose contract call ${CONTRACT_ADDRESS} --recall-nonce \ + mxpy --verbose contract call ${CONTRACT_ADDRESS} \ --pem=${WALLET_PEM} \ --gas-limit=6000000 \ --proxy=${PROXY} --chain=${CHAIN_ID} \ @@ -193,7 +193,7 @@ myPayableEndpoint() { method_name=str:myPayableEndpoint my_token=str:$1 token_amount=$2 - mxpy --verbose contract call ${CONTRACT_ADDRESS} --recall-nonce \ + mxpy --verbose contract call ${CONTRACT_ADDRESS} \ --pem=${WALLET_PEM} \ --gas-limit=6000000 \ --proxy=${PROXY} --chain=${CHAIN_ID} \ @@ -226,7 +226,7 @@ myESDTNFTPayableEndpoint() { sft_token_nonce=$2 sft_token_amount=$3 destination_address=$4 - mxpy --verbose contract call $user_address --recall-nonce \ + mxpy --verbose contract call $user_address \ --pem=${WALLET_PEM} \ --gas-limit=100000000 \ --proxy=${PROXY} --chain=${CHAIN_ID} \ @@ -279,7 +279,7 @@ myMultiESDTNFTPayableEndpoint() { third_token_nonce=$7 third_token_amount=$8 - mxpy --verbose contract call $user_address --recall-nonce \ + mxpy --verbose contract call $user_address \ --pem=${WALLET_PEM} \ --gas-limit=100000000 \ --proxy=${PROXY} --chain=${CHAIN_ID} \ diff --git a/docs/validators/staking/staking.md b/docs/validators/staking/staking.md index 2b5fb40fd..0ea9ab0df 100644 --- a/docs/validators/staking/staking.md +++ b/docs/validators/staking/staking.md @@ -105,7 +105,7 @@ The following commands assume that the PEM file for your Wallet was saved with t The command to submit a staking transaction with `mxpy` is this: ```bash -mxpy --verbose validator stake --pem=walletKey.pem --value="" --validators-file= --proxy=https://gateway.multiversx.com --estimate-gas --recall-nonce +mxpy --verbose validator stake --pem=walletKey.pem --value="" --validators-file= --proxy=https://gateway.multiversx.com ``` Notice that we are using the `walletKey.pem` file. Moreover, before executing this command, you need to replace the following: @@ -131,12 +131,10 @@ Notice that we are using the `walletKey.pem` file. Moreover, before executing th The `pemFile` field should point to valid Validator PEM file. **Note that paths must be relative to the JSON file itself.** -Notice also that there is no calculation for "Gas Limit". If you provide the `--estimate-gas` argument to `mxpy`, the gas limit will be estimated automatically. - Here's an example for a staking command for one node: ``` -mxpy --verbose validator stake --pem=walletKey.pem --value="2500000000000000000000" --validators-file=my-validators.json --proxy=https://gateway.multiversx.com --estimate-gas --recall-nonce +mxpy --verbose validator stake --pem=walletKey.pem --value="2500000000000000000000" --validators-file=my-validators.json --proxy=https://gateway.multiversx.com ``` :::note important @@ -146,7 +144,7 @@ You must take **denomination** into account when specifying the `value` paramete For two nodes, it becomes this: ``` -mxpy --verbose validator stake --pem=walletKey.pem --value="5000000000000000000000" --validators-file=my-validators.json --proxy=https://gateway.multiversx.com --estimate-gas --recall-nonce +mxpy --verbose validator stake --pem=walletKey.pem --value="5000000000000000000000" --validators-file=my-validators.json --proxy=https://gateway.multiversx.com ``` [comment]: # (mx-context-auto) @@ -160,7 +158,7 @@ Alternatively, you can tell `mxpy` to specify another wallet to which your rewar For example, a staking command for a single node, with a reward address specified, looks like this: ``` -mxpy --verbose validator stake --reward-address="erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th" --pem=walletKey.pem --value="2500000000000000000000" --validators-file=my-validators.json --proxy=https://gateway.multiversx.com --estimate-gas --recall-nonce +mxpy --verbose validator stake --reward-address="erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th" --pem=walletKey.pem --value="2500000000000000000000" --validators-file=my-validators.json --proxy=https://gateway.multiversx.com ``` The above command will submit a staking command and will also inform the Staking SmartContract that the rewards should be transferred to the wallet `erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th` . diff --git a/docs/validators/staking/unjailing.md b/docs/validators/staking/unjailing.md index 600626c37..c368758b4 100644 --- a/docs/validators/staking/unjailing.md +++ b/docs/validators/staking/unjailing.md @@ -145,8 +145,8 @@ The following commands assume that the PEM file for your Wallet was saved with t The command to submit an unjailing transaction with `mxpy` is this: -```python -mxpy --verbose validator unjail --pem=walletKey.pem --value="" --nodes-public-keys=",,...," --proxy=https://gateway.multiversx.com --estimate-gas --recall-nonce +```sh +mxpy --verbose validator unjail --pem=walletKey.pem --value="" --nodes-public-keys=",,...," --proxy=https://gateway.multiversx.com ``` Notice that we are using the `walletKey.pem` file. Moreover, before executing this command, you need to replace the following: @@ -154,12 +154,10 @@ Notice that we are using the `walletKey.pem` file. Moreover, before executing th - Replace `` with the amount of EGLD required for unjailing your validators. You need to calculate this value with respect to the number of nodes you are unjailing. See the [beginning of the Unjailing through the Wallet](/validators/staking/unjailing#unjailing-through-the-wallet) section for info on how to do it. - Replace all the `` with the actual **BLS public keys** of your nodes, which you can find inside their individual `validatorKey.pem` files. Make sure you **do not write the BLS secret keys**! Read the page [Validator Keys](/validators/key-management/validator-keys) to see how to interpret the `validatorKey.pem` files. -Notice also that there is no calculation for "Gas Limit". If you provide the `--estimate-gas` argument to `mxpy`, the gas limit will be estimated automatically. - Here's an example for an unjailing command for one validator: -```python -mxpy --verbose validator unjail --pem=walletKey.pem --value="2500000000000000000000" --nodes-public-keys="b617d8bc442bda59510f77e04a1680e8b2d3293c8c4083d94260db96a4d732deaaf9855fa0cef2273f5a67b4f442c725efc06a5d366b9f15a66da9eb8208a09c9ab4066b6b3d38c3cf1ea7fab6489a90713b3b56d87de68c6558c80d7533bf27" --proxy=https://gateway.multiversx.com --estimate-gas --recall-nonce +```sh +mxpy --verbose validator unjail --pem=walletKey.pem --value="2500000000000000000000" --nodes-public-keys="b617d8bc442bda59510f77e04a1680e8b2d3293c8c4083d94260db96a4d732deaaf9855fa0cef2273f5a67b4f442c725efc06a5d366b9f15a66da9eb8208a09c9ab4066b6b3d38c3cf1ea7fab6489a90713b3b56d87de68c6558c80d7533bf27" --proxy=https://gateway.multiversx.com ``` :::note important @@ -168,8 +166,8 @@ You must take **denomination** into account when specifying the `value` paramete For two validators, the command becomes this one: -```python -mxpy --verbose validator unjail --pem=walletKey.pem --value="5000000000000000000000" --nodes-public-keys="b617d8bc442bda59510f77e04a1680e8b2d3293c8c4083d94260db96a4d732deaaf9855fa0cef2273f5a67b4f442c725efc06a5d366b9f15a66da9eb8208a09c9ab4066b6b3d38c3cf1ea7fab6489a90713b3b56d87de68c6558c80d7533bf27,f921a0f76ed70e8a806c6f9119f87b12700f96f732e6070b675e0aec10cb0723803202a4c40194847c38195db07b1001f6d50c81a82b949e438cd6dd945c2eb99b32c79465aefb9144c8668af67e2d01f71b81842d9b94e4543a12616cb5897d" --proxy=https://gateway.multiversx.com --estimate-gas --recall-nonce +```sh +mxpy --verbose validator unjail --pem=walletKey.pem --value="5000000000000000000000" --nodes-public-keys="b617d8bc442bda59510f77e04a1680e8b2d3293c8c4083d94260db96a4d732deaaf9855fa0cef2273f5a67b4f442c725efc06a5d366b9f15a66da9eb8208a09c9ab4066b6b3d38c3cf1ea7fab6489a90713b3b56d87de68c6558c80d7533bf27,f921a0f76ed70e8a806c6f9119f87b12700f96f732e6070b675e0aec10cb0723803202a4c40194847c38195db07b1001f6d50c81a82b949e438cd6dd945c2eb99b32c79465aefb9144c8668af67e2d01f71b81842d9b94e4543a12616cb5897d" --proxy=https://gateway.multiversx.com ``` Notice that the two BLS public keys are separated by a comma, with no extra space between them. From 4737a1654d7cd95ef410d20c05590e3d38a8ccdd Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Mon, 23 Jun 2025 17:11:45 +0300 Subject: [PATCH 3/7] add whitespace --- .../user-defined-smart-contracts.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/developers/gas-and-fees/user-defined-smart-contracts.md b/docs/developers/gas-and-fees/user-defined-smart-contracts.md index 63e1750dd..36a6527aa 100644 --- a/docs/developers/gas-and-fees/user-defined-smart-contracts.md +++ b/docs/developers/gas-and-fees/user-defined-smart-contracts.md @@ -225,27 +225,27 @@ For our example, let's simulate using the following values for `gasLimit`: `7619 ```bash $ mxpy --verbose contract call erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ - --function=foo\ - --gas-limit=7619200\ - --arguments ${hexAddressOfB}\ + --function=foo \ + --gas-limit=7619200 \ + --arguments ${hexAddressOfB} \ --simulate ... inspect output (possibly testnet logs); execution is successful mxpy --verbose contract call erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ - --function=foo\ - --gas-limit=7000000\ - --arguments ${hexAddressOfB}\ + --function=foo \ + --gas-limit=7000000 \ + --arguments ${hexAddressOfB} \ --simulate ... inspect output (possibly testnet logs); execution is successful mxpy --verbose contract call erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ - --function=foo\ - --gas-limit=6000000\ - --arguments ${hexAddressOfB}\ + --function=foo \ + --gas-limit=6000000 \ + --arguments ${hexAddressOfB} \ --simulate ... inspect output (possibly testnet logs); ERROR: out of gas when executing B::bar() From ce1c1727b16cb6051ed4aaff0e72dbdbcd8bc10d Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Mon, 23 Jun 2025 17:14:02 +0300 Subject: [PATCH 4/7] fix typos --- docs/sdk-and-tools/mxpy/mxpy-cli.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sdk-and-tools/mxpy/mxpy-cli.md b/docs/sdk-and-tools/mxpy/mxpy-cli.md index 380d87726..089cf7641 100644 --- a/docs/sdk-and-tools/mxpy/mxpy-cli.md +++ b/docs/sdk-and-tools/mxpy/mxpy-cli.md @@ -169,7 +169,7 @@ mxpy env set proxy_url https://devnet-api.multiversx.com #### Setting the explorer url -mxpy already knows the explorer urls for all three networks (Mainnet, Devnet, Testnet). This is particulary useful when running the CLI on custom networks where an explorer is also available. This key is not required to be present in the env config for the config to be valid. To set the explorer url use the following command: +mxpy already knows the explorer urls for all three networks (Mainnet, Devnet, Testnet). This is particularly useful when running the CLI on custom networks where an explorer is also available. This key is not required to be present in the env config for the config to be valid. To set the explorer url use the following command: ```sh mxpy env set explorer_url @@ -283,7 +283,7 @@ To view all the properties of the active address, use the following command: mxpy address dump ``` -#### Dumping all availale addresses +#### Dumping all available addresses To view all the addresses configured, use the following command: From 2cc2a559fc2a8ff200d70c8f207b84c73ba2d07f Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Tue, 24 Jun 2025 17:43:36 +0300 Subject: [PATCH 5/7] update config-wallet --- docs/sdk-and-tools/mxpy/mxpy-cli.md | 44 ++++++++++++++--------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/sdk-and-tools/mxpy/mxpy-cli.md b/docs/sdk-and-tools/mxpy/mxpy-cli.md index 089cf7641..153bfae22 100644 --- a/docs/sdk-and-tools/mxpy/mxpy-cli.md +++ b/docs/sdk-and-tools/mxpy/mxpy-cli.md @@ -169,7 +169,7 @@ mxpy env set proxy_url https://devnet-api.multiversx.com #### Setting the explorer url -mxpy already knows the explorer urls for all three networks (Mainnet, Devnet, Testnet). This is particularly useful when running the CLI on custom networks where an explorer is also available. This key is not required to be present in the env config for the config to be valid. To set the explorer url use the following command: +**mxpy** already knows the explorer urls for all three networks (Mainnet, Devnet, Testnet). This is particularly useful when running the CLI on custom networks where an explorer is also available. This key is not required to be present in the `env config` for the config to be valid. To set the explorer url use the following command: ```sh mxpy env set explorer_url @@ -233,70 +233,70 @@ mxpy env switch ### Configuring wallets -Wallets can be configured in the address config. From all the wallets configured, one must be set as the active wallet. This wallet will be the default wallet used through mxpy if not another wallet is provided via CLI args, such as `--pem`, `--keystore` or `--ledger`. Additionally, the `--sender` argument has been added and can be used to specify a certain sender from the address config (e.g. --sender alice). +Wallets can be configured in the wallet config. From all the wallets configured, one must be set as the active wallet. This wallet will be the default wallet used through mxpy if not another wallet is provided via CLI args, such as `--pem`, `--keystore` or `--ledger`. Additionally, the `--sender` argument has been added and can be used to specify a certain sender from the address config (e.g. --sender alice). The values that are available for configuring wallets are the following: ```json { - "kind": "", "path": "", "index": "", } ``` -The `kind` field represents the wallet type and can be either `pem` or `keystore`. If the wallet is of type `keystore`, you'll be prompted to enter the wallet's password. +If the wallet is of type `keystore`, you'll be prompted to enter the wallet's password. The `path` field represents the absolute path to the wallet. The `index` field represents the index that will be used when deriving the wallet from the secret key. This field is optional, the default index is `0`. -#### Creating a new address config +#### Creating a new wallet config -To create a new address config, we use the following command: +To create a new wallet config, we use the following command: ```sh -mxpy address new +mxpy config-wallet new ``` -#### Setting the address config fields +This command accepts the `--path` argument, so the path to the wallet can be set directly, without needing to call `mxpy config-wallet set` afterwards. -For a config to be valid, we need to set at least the `kind` and `path` fields. To do so, we use the following command: +#### Setting the wallet config fields + +For a config to be valid, we need to set at least the `path` field for an already created wallet alias. To do so, we use the following command: ```sh -mxpy address set kind pem -mxpy address set path absolute/path/to/pem/wallet.pem +mxpy config-wallet set path absolute/path/to/pem/wallet.pem --alias alice ``` #### Getting the value of a field -Very similar to `mxpy config` or `mxpy env`, we can get the value of a field from the active config using the following command: +We can get the value of a field from an alias using the following command: ```sh -mxpy env get path +mxpy config-wallet get path --alias alice ``` -#### Dumping the active address config +#### Dumping the active wallet config To view all the properties of the active address, use the following command: ```sh -mxpy address dump +mxpy config-wallet dump ``` -#### Dumping all available addresses +#### Dumping all configured wallets -To view all the addresses configured, use the following command: +To view all the wallets configured, use the following command: ```sh -mxpy address list +mxpy config-wallet list ``` -#### Switching to a different address +#### Switching to a different wallet -We may have multiple addresses configured, so to switch between them, we use the following command: +We may have multiple wallets configured, so to switch between them, we use the following command: ```sh -mxpy address switch +mxpy config-wallet switch --alias alice ``` #### Removing an address from the config @@ -304,7 +304,7 @@ mxpy address switch We can remove an address from the config using the alias of the address and the following command: ```sh -mxpy address remove +mxpy config-wallet remove --alias alice ``` [comment]: # (mx-context-auto) From a3adeb764d881f576de1df4627ea91e5184042d3 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Tue, 24 Jun 2025 17:56:36 +0300 Subject: [PATCH 6/7] rename to config-env --- docs/sdk-and-tools/mxpy/mxpy-cli.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/sdk-and-tools/mxpy/mxpy-cli.md b/docs/sdk-and-tools/mxpy/mxpy-cli.md index 153bfae22..e7025a8bd 100644 --- a/docs/sdk-and-tools/mxpy/mxpy-cli.md +++ b/docs/sdk-and-tools/mxpy/mxpy-cli.md @@ -140,7 +140,7 @@ The values that are available for configuration and their default values are the To create a new env config, we use the following command: ```sh -mxpy env new +mxpy config-env new ``` Additionally, `--template` can be used to create a config from an existing env config. After a new env config is created, it is set as the active env config. After a new env config is created, the values need to be set using the `mxpy env set` command. @@ -150,7 +150,7 @@ Additionally, `--template` can be used to create a config from an existing env c The `default_address_hrp` might need to be changed depending on the network you plan on using (e.g Sovereign Chain). Most of the commands that might need the `address hrp` already provide a parameter called `--hrp` or `--address-hrp`, that can be explicitly set, but there are system smart contract addresses that cannot be changed by providing the parameter. If that addresses need to be changed, we can use the following command to set the `default hrp` that will be used throughout mxpy. Here we set the default hrp to `test`: ```sh -mxpy env set default_address_hrp test +mxpy config-env set default_address_hrp test ``` :::note @@ -164,7 +164,7 @@ If `proxy_url` is set in the active environment, the `--proxy` argument is no lo To set the proxy url, use the following command: ```sh -mxpy env set proxy_url https://devnet-api.multiversx.com +mxpy config-env set proxy_url https://devnet-api.multiversx.com ``` #### Setting the explorer url @@ -172,7 +172,7 @@ mxpy env set proxy_url https://devnet-api.multiversx.com **mxpy** already knows the explorer urls for all three networks (Mainnet, Devnet, Testnet). This is particularly useful when running the CLI on custom networks where an explorer is also available. This key is not required to be present in the `env config` for the config to be valid. To set the explorer url use the following command: ```sh -mxpy env set explorer_url +mxpy config-env set explorer_url ``` #### Setting the ask for confirmation flag @@ -180,7 +180,7 @@ mxpy env set explorer_url If set to `true`, whenever sending a transaction, mxpy will display the transaction and will ask for your confirmation. To set the flag, use the following command: ```sh -mxpy env set ask_confirmation true +mxpy config-env set ask_confirmation true ``` #### Dumping the active env config @@ -188,7 +188,7 @@ mxpy env set ask_confirmation true We can see the values set in our active env config. To do so, we use the following command: ```sh -mxpy env dump +mxpy config-env dump ``` #### Dumping all the available env configs @@ -196,7 +196,7 @@ mxpy env dump We may have multiple env configs, maybe one for each network. To dump all the available env configs, we use the following command: ```sh -mxpy env list +mxpy config-env list ``` #### Deleting a value from the active env config @@ -204,7 +204,7 @@ mxpy env list We can also delete the key-value pairs saved in the env config. For example, let's say we want to delete the explorer url, so we use the following command: ```sh -mxpy env delete explorer_url +mxpy config-env delete explorer_url ``` #### Getting a value from the active env config @@ -212,7 +212,7 @@ mxpy env delete explorer_url If we want to see just the value of a specific env config key, we can use the following command: ```sh -mxpy env get +mxpy config-env get ``` #### Deleting an env config @@ -220,7 +220,7 @@ mxpy env get To delete an env config, we use the following command: ```sh -mxpy env remove +mxpy config-env remove ``` #### Switching to a different env config @@ -228,7 +228,7 @@ mxpy env remove To switch to a new env config, we use the following command: ```sh -mxpy env switch +mxpy config-env switch ``` ### Configuring wallets From 1774d26e2af98b56402b3146916b949b44fcb419 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Wed, 25 Jun 2025 12:16:51 +0300 Subject: [PATCH 7/7] updates after latest mxpy changes --- docs/sdk-and-tools/mxpy/mxpy-cli.md | 40 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/docs/sdk-and-tools/mxpy/mxpy-cli.md b/docs/sdk-and-tools/mxpy/mxpy-cli.md index e7025a8bd..5f5f37b0d 100644 --- a/docs/sdk-and-tools/mxpy/mxpy-cli.md +++ b/docs/sdk-and-tools/mxpy/mxpy-cli.md @@ -106,11 +106,7 @@ mxpy config dump --defaults ### Updating the mxpy configuration -One can alter the current configuration using the command `mxpy config set`. For example, in order to set the **_testwallets version_** to be used, one would do the following: - -```bash -mxpy config set dependencies.testwallets.tag v1.0.0 -``` +One can alter the current configuration using the command `mxpy config set`. The default config contains the **log level** of the CLI. The default log level is set to `info`, but can be changed. The available values are: [debug, info, warning, error]. To set the log level, we can use the following command: ```sh @@ -123,7 +119,7 @@ Previously, the `default_address_hrp` was also stored in the config. As of `mxpy ### Configuring environments -Environments can be useful when switching between networks, such as Mainnet and Devnet. +An `env config` is a named environment configuration that stores commonly used settings (like proxy url, hrp, and flags) for use with the **mxpy CLI**. Environments can be useful when switching between networks, such as Mainnet and Devnet. The values that are available for configuration and their default values are the following: ```json @@ -143,14 +139,14 @@ To create a new env config, we use the following command: mxpy config-env new ``` -Additionally, `--template` can be used to create a config from an existing env config. After a new env config is created, it is set as the active env config. After a new env config is created, the values need to be set using the `mxpy env set` command. +Additionally, `--template` can be used to create a config from an existing env config. After a new env config is created, it becomes the active one. You can then set its values using the `mxpy config-env set` command. #### Setting the default hrp -The `default_address_hrp` might need to be changed depending on the network you plan on using (e.g Sovereign Chain). Most of the commands that might need the `address hrp` already provide a parameter called `--hrp` or `--address-hrp`, that can be explicitly set, but there are system smart contract addresses that cannot be changed by providing the parameter. If that addresses need to be changed, we can use the following command to set the `default hrp` that will be used throughout mxpy. Here we set the default hrp to `test`: +The `default_address_hrp` might need to be changed depending on the network you plan on using (e.g Sovereign Chain). Most of the commands that might need the `address hrp` already provide a parameter called `--hrp` or `--address-hrp`, that can be explicitly set, but there are system smart contract addresses that cannot be changed by providing the parameter. If those addresses need to be changed, we can use the following command to set the `default hrp` that will be used throughout mxpy. Here we set the default hrp to `test`: ```sh -mxpy config-env set default_address_hrp test +mxpy config-env set default_address_hrp test --env test-env ``` :::note @@ -159,12 +155,12 @@ Explicitly providing `--hrp` will **always** be used over the one fetched from t #### Setting the proxy url -If `proxy_url` is set in the active environment, the `--proxy` argument is no longer required for the commands that require this argument. +If `proxy_url` is set in the active environment, the `--proxy` argument is no longer required for the commands that need this argument. To set the proxy url, use the following command: ```sh -mxpy config-env set proxy_url https://devnet-api.multiversx.com +mxpy config-env set proxy_url https://devnet-api.multiversx.com --env devnet ``` #### Setting the explorer url @@ -172,7 +168,7 @@ mxpy config-env set proxy_url https://devnet-api.multiversx.com **mxpy** already knows the explorer urls for all three networks (Mainnet, Devnet, Testnet). This is particularly useful when running the CLI on custom networks where an explorer is also available. This key is not required to be present in the `env config` for the config to be valid. To set the explorer url use the following command: ```sh -mxpy config-env set explorer_url +mxpy config-env set explorer_url https://url-to-explorer.com --env test-env ``` #### Setting the ask for confirmation flag @@ -180,7 +176,7 @@ mxpy config-env set explorer_url If set to `true`, whenever sending a transaction, mxpy will display the transaction and will ask for your confirmation. To set the flag, use the following command: ```sh -mxpy config-env set ask_confirmation true +mxpy config-env set ask_confirmation true --env mainnet ``` #### Dumping the active env config @@ -204,15 +200,15 @@ mxpy config-env list We can also delete the key-value pairs saved in the env config. For example, let's say we want to delete the explorer url, so we use the following command: ```sh -mxpy config-env delete explorer_url +mxpy config-env delete explorer_url --env test-env ``` #### Getting a value from the active env config -If we want to see just the value of a specific env config key, we can use the following command: +If we want to see just the value of a env config key from a specific environment, we can use the following command: ```sh -mxpy config-env get +mxpy config-env get --env mainnet ``` #### Deleting an env config @@ -220,7 +216,7 @@ mxpy config-env get To delete an env config, we use the following command: ```sh -mxpy config-env remove +mxpy config-env remove ``` #### Switching to a different env config @@ -228,12 +224,14 @@ mxpy config-env remove To switch to a new env config, we use the following command: ```sh -mxpy config-env switch +mxpy config-env switch --env ``` +You can manage multiple environment configurations with ease using `mxpy config-env`. This feature helps streamline workflows when working with multiple networks or projects. Use `mxpy config-env list` to see all available configs, and `switch` to quickly toggle between them. + ### Configuring wallets -Wallets can be configured in the wallet config. From all the wallets configured, one must be set as the active wallet. This wallet will be the default wallet used through mxpy if not another wallet is provided via CLI args, such as `--pem`, `--keystore` or `--ledger`. Additionally, the `--sender` argument has been added and can be used to specify a certain sender from the address config (e.g. --sender alice). +Wallets can be configured in the wallet config. Among all configured wallets, one must be set as the active wallet. This active wallet will be used by default in all mxpy commands, unless another wallet is explicitly provided using `--pem`, `--keystore`, or `--ledger`. Alternatively, the `--sender` argument can be used to specify a particular sender address from the address config (e.g. --sender alice). The values that are available for configuring wallets are the following: ```json @@ -243,7 +241,7 @@ The values that are available for configuring wallets are the following: } ``` -If the wallet is of type `keystore`, you'll be prompted to enter the wallet's password. +Supported wallet types include PEM files and keystores. The CLI will determine the type based on the given path and act accordingly. If the wallet is of type `keystore`, you'll be prompted to enter the wallet's password. The `path` field represents the absolute path to the wallet. @@ -251,7 +249,7 @@ The `index` field represents the index that will be used when deriving the walle #### Creating a new wallet config -To create a new wallet config, we use the following command: +When configuring a new wallet we need to give it an alias. An alias is a user-defined name that identifies a configured wallet (e.g. alice, bob, dev-wallet). To create a new wallet config, we use the following command: ```sh mxpy config-wallet new