### Setup and Start Localnet Source: https://github.com/multiversx/mx-docs/blob/main/docs/developers/setup-local-testnet.md This command initializes, builds, and configures the localnet environment, then starts all its components. ```bash mxpy localnet setup ``` -------------------------------- ### Install Dependencies and Start API Service Source: https://github.com/multiversx/mx-docs/blob/main/docs/sovereign/sovereign-api.md Install Node.js dependencies, initialize the service, and start the testnet configuration for the API service. ```bash npm install npm run init npm run start:testnet ``` -------------------------------- ### Install and Start Redis Source: https://github.com/multiversx/mx-docs/blob/main/docs/sovereign/services.md Commands to install, start, and enable the Redis service on a Debian-based system. This is required for caching and other services. ```bash sudo apt update sudo apt install redis sudo systemctl start redis sudo systemctl enable redis ``` -------------------------------- ### Setup and Start Observing Squad Source: https://github.com/multiversx/mx-docs/blob/main/docs/bridge/axelar.md Use these commands to set up the observing squad using the `script.sh` utility and then start the nodes and the Proxy API. ```bash ./script.sh observing_squad ./script.sh start ``` -------------------------------- ### Install Dependencies and Start Sovereign Lite Wallet Source: https://github.com/multiversx/mx-docs/blob/main/docs/sovereign/sovereign-wallet.md Install project dependencies using Yarn and then start the Sovereign Lite Wallet service. ```bash yarn install yarn start-sovereign ``` -------------------------------- ### Start Observing Squad Nodes and Proxy Source: https://github.com/multiversx/mx-docs/blob/main/docs/integrators/observing-squad.md After installation, use the script to start the 5 `systemd` units for the nodes and the Proxy. ```bash ./script.sh start ``` -------------------------------- ### Start Sovereign Explorer Source: https://github.com/multiversx/mx-docs/blob/main/docs/sovereign/sovereign-explorer.md Install dependencies and start the Sovereign Explorer for testnet using npm or yarn. ```bash yarn npm run start-testnet ``` -------------------------------- ### Install Smart Contract Development Tools Source: https://github.com/multiversx/mx-docs/blob/main/static/llms-full.txt The `install` command simplifies installing necessary tools for smart contract development. Use `all` to install all known tools or specify a tool name like `mx-scenario-go`. The `--tag` option can be used with `mx-scenario-go` to specify a framework version. ```bash mx-meta install all ``` ```bash mx-meta install mx-scenario-go --tag=v0.1.0 ``` -------------------------------- ### Install mx-scenario-go Tool Source: https://github.com/multiversx/mx-docs/blob/main/docs/developers/meta/sc-meta-cli.md Install the `mx-scenario-go` tool using the `install` command. You can install all known tools or specify `mx-scenario-go` directly. Use `--tag` to specify a framework version. ```bash mx-install mx-scenario-go --tag=v1.2.3 ``` -------------------------------- ### Start Observing Squad with Docker Compose Source: https://github.com/multiversx/mx-docs/blob/main/docs/integrators/observing-squad.md Navigate to the mainnet directory and execute the start_stack.sh script to install and run the entire Observing Squad using Docker Compose. ```bash cd mainnet ./start_stack.sh ``` -------------------------------- ### Start the dApp Source: https://github.com/multiversx/mx-docs/blob/main/docs/developers/tutorials/your-first-microservice.md Run the command to start your decentralized application after making the necessary code changes. ```bash npm run start ``` -------------------------------- ### Start Development Server Source: https://github.com/multiversx/mx-docs/blob/main/docs/developers/tutorials/your-first-dapp.md Command to start the local development server for the dApp using pnpm. ```sh pnpm start-devnet ``` -------------------------------- ### Install Docker Compose Source: https://github.com/multiversx/mx-docs/blob/main/docs/integrators/observing-squad.md Install docker-compose on the system if it is not already installed. This is a prerequisite for using Docker to set up the Observing Squad. ```bash apt install docker-compose ``` -------------------------------- ### Example: Get Number of Delegators Source: https://github.com/multiversx/mx-docs/blob/main/docs/validators/delegation-manager.mdx This example shows a request to get the number of delegators and the corresponding base64 encoded response. ```json { "scAddress": "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqhllllsajxzat", "funcName": "getNumUsers" } ``` ```json { "returnData": ["BQ=="] } ``` -------------------------------- ### Navigate and Run Installation Script Source: https://github.com/multiversx/mx-docs/blob/main/docs/validators/nodes-scripts/install-update.md Navigate to the script directory and execute the main script to access the node management menu for installation. ```bash cd ~/mx-chain-scripts ./script.sh ``` -------------------------------- ### Example: Deploying a Simple Smart Contract Source: https://github.com/multiversx/mx-docs/blob/main/docs/sdk-and-tools/mxpy/mxpy-cli.md This example demonstrates deploying a contract with bytecode, proxy, initial arguments, gas limit, and a PEM file for authentication. The --send flag is used to broadcast the transaction. ```sh mxpy contract deploy --bytecode ~/contracts/adder/output/adder.wasm \ --proxy=https://devnet-gateway.multiversx.com \ --arguments 0 --gas-limit 5000000 \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --send ``` -------------------------------- ### Install Node via Script Menu Source: https://github.com/multiversx/mx-docs/blob/main/docs/validators/nodes-scripts/install-update.md Select option '1' from the script's menu to initiate the node installation process. ```bash 1) install 2) observing_squad 3) multikey_group 4) upgrade 5) upgrade_multikey 6) upgrade_squad 7) upgrade_proxy 8) remove_db 9) start 10) start_all 11) stop 12) stop_all 13) cleanup 14) github_pull 15) add_nodes 16) get_logs 17) benchmark 18) quit Please select an action:1 ``` -------------------------------- ### Start Sovereign Explorer Testnet Source: https://github.com/multiversx/mx-docs/blob/main/static/llms-full.txt Starts the Sovereign Explorer on the testnet. Ensure dependencies are installed first. ```bash npm run start-testnet ``` -------------------------------- ### Example Deployment Output Source: https://github.com/multiversx/mx-docs/blob/main/static/llms-full.txt This output shows the process of deploying a smart contract, including the sender's nonce, transaction hash, and the newly assigned contract address. ```bash interactor % cargo run deploy Compiling rust-interact v0.0.0 (/Users/you/Documents/my-contract/interact-rs) Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.96s Running `/Users/you/Documents/my-contract/target/debug/rust-interact deploy` sender's recalled nonce: 1717 -- tx nonce: 1717 sc deploy tx hash: 623c7b853b1fbb36762d433c6a5e27d34f48198e68bbba1216d1c676ab0ba3be deploy address: erd1qqqqqqqqqqqqqpgqpsev0x4nufh240l44gf2t6qzkh9xvutqd8ssrnydzr new address: erd1qqqqqqqqqqqqqpgqpsev0x4nufh240l44gf2t6qzkh9xvutqd8ssrnydzr ``` -------------------------------- ### Install Dependencies for Sovereign Explorer Source: https://github.com/multiversx/mx-docs/blob/main/static/llms-full.txt Installs project dependencies using Yarn. This is a prerequisite for starting the testnet. ```bash yarn ``` -------------------------------- ### Setup and Start Localnet with Altered Chronology Source: https://github.com/multiversx/mx-docs/blob/main/docs/developers/setup-local-testnet.md After modifying the `localnet.toml` for chronology, run these commands to set up and start the localnet. ```bash mxpy localnet setup mxpy localnet start ``` -------------------------------- ### Install Dependencies from requirements.txt Source: https://github.com/multiversx/mx-docs/blob/main/docs/sdk-and-tools/sdk-py.md Installs all dependencies listed in the requirements.txt file, including the MultiversX SDK. Run this after creating or updating the file. ```bash pip install -r requirements.txt ``` -------------------------------- ### Example: Deploying a Contract with ABI and Arguments File Source: https://github.com/multiversx/mx-docs/blob/main/docs/sdk-and-tools/mxpy/mxpy-cli.md Deploy a contract using its bytecode and ABI file, specifying constructor arguments via a JSON file. This method is useful for contracts with complex initialization parameters. ```sh mxpy contract deploy --bytecode ~/contracts/multisig/output/multisig.wasm \ --proxy=https://devnet-gateway.multiversx.com \ --abi ~/contracts/multisig/output/multisig.abi.json \ --arguments-file deploy_multisig_arguments.json \ --gas-limit 500000000 \ --pem=~/multiversx-sdk/testwallets/latest/users/alice.pem \ --send ``` -------------------------------- ### Python SDK - Entrypoint Creation Source: https://github.com/multiversx/mx-docs/blob/main/static/llms-full.txt Demonstrates how to create an entrypoint for interacting with different MultiversX networks using the Python SDK. ```APIDOC ## Creating an Entrypoint ### Description Instantiate network clients for interacting with MultiversX networks. Supports custom URLs and proxy connections. ### Usage ```py from multiversx_sdk import DevnetEntrypoint # Create a default Devnet entrypoint entrypoint = DevnetEntrypoint() # Create a Devnet entrypoint with a custom URL entrypoint_custom_url = DevnetEntrypoint(url="https://custom-multiversx-devnet-api.com") # Create a Devnet entrypoint that interacts with the proxy custom_entrypoint_proxy = DevnetEntrypoint(url="https://devnet-gateway.multiversx.com", kind="proxy") # Create an entrypoint from a network provider from multiversx_sdk import NetworkEntrypoint, ApiNetworkProvider api = ApiNetworkProvider("https://devnet-api.multiversx.com") entrypoint_from_provider = NetworkEntrypoint.new_from_network_provider(network_provider=api, chain_id="D") ``` ``` -------------------------------- ### Install Rustup and Toolchains Source: https://github.com/multiversx/mx-docs/blob/main/docs/developers/meta/interactor/interactors-overview.md Ensure Rust is installed and configured with the necessary toolchains for WASM compilation. This setup is required before using interactors. ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` ```bash rustup update rustup default stable rustup target add wasm32-unknown-unknown ``` ```bash rustc --version rustup show ``` -------------------------------- ### Example: Get Delegation Contract Configuration Source: https://github.com/multiversx/mx-docs/blob/main/docs/validators/delegation-manager.mdx This example shows a sample request and response for fetching the delegation contract's configuration. The response data is base64 encoded. ```json { "scAddress": "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqhllllsajxzat", "funcName": "getContractConfig" } ``` ```json { "returnData": [ "gKzHUD288mzScNX6nEmkGm4CHneMdrrPhJyPET9iGA8=", null, "", "Q8M8GTdWSAAA", "dHJ1ZQ==", "ZmFsc2U=", "dHJ1ZQ==", "AuU=", "+g==" ] } ``` -------------------------------- ### Equivalent commands for building a contract Source: https://github.com/multiversx/mx-docs/blob/main/docs/developers/meta/sc-meta-cli.md These commands demonstrate equivalent ways to build a smart contract project. The first uses the standalone 'all build' command after navigating to the contract directory, while the second uses the contract-specific meta tool via Cargo. ```bash cd my-contract sc-meta all build ``` ```bash cd my-contract/meta cargo run build ``` -------------------------------- ### Example: Get Delegation Contract Metadata Source: https://github.com/multiversx/mx-docs/blob/main/docs/validators/delegation-manager.mdx This example demonstrates how to query for delegation contract metadata and interprets the base64 encoded response fields for provider name, website, and identifier. ```json { "scAddress": "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqhllllsajxzat", "funcName": "getMetaData" } ``` ```json { "returnData": [ "U3Rha2luZyBwcm92aWRlciB0ZXN0", "d3d3LmVscm9uZHN0YWtpbmcuY29t", "dGVzdEtleWJhc2VJZGVudGlmaWVy" ] } ``` -------------------------------- ### Get Block by Nonce - Response Example Source: https://github.com/multiversx/mx-docs/blob/main/docs/sdk-and-tools/rest-api/blocks.mdx Example JSON response for retrieving a block by its nonce, including transaction details. This is useful for inspecting block contents and associated transactions. ```json { "data": { "block": { "nonce": 186532, "round": 186576, "hash": "7aa3...", "prevBlockHash": "2580...", "epoch": 12, "shard": 2, "numTxs": 1, "miniBlocks": [ { "hash": "e927...", "type": "TxBlock", "sourceShard": 2, "destinationShard": 1, "transactions": [ { "type": "normal", "hash": "b035...", "nonce": 3, "value": "1000000000000000000", "receiver": "erd1...", "sender": "erd1...", "gasPrice": 1000000000, "gasLimit": 70000, "data": "Zm9yIHRlc3Rz", "signature": "1047...", "status": "partially-executed" } ] } ] } }, "error": "", "code": "successful" } ``` -------------------------------- ### Source the Script for Local Setup Source: https://github.com/multiversx/mx-docs/blob/main/docs/sovereign/local-setup.md Load the script into the current shell environment to make its functions available for use. ```bash source script.sh ``` -------------------------------- ### Example: Get Number of Nodes Source: https://github.com/multiversx/mx-docs/blob/main/docs/validators/delegation-manager.mdx Example request and response for querying the number of nodes. The `returnData` field in the response contains the base64 encoded hexadecimal string representing the node count. ```json { "scAddress": "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqhllllsajxzat", "funcName": "getNumNodes" } ``` ```json { "returnData": ["Dg=="] } ``` -------------------------------- ### Example Multi-Token Transfer Transaction Source: https://github.com/multiversx/mx-docs/blob/main/docs/tokens/fungible-tokens.mdx An example demonstrating a multi-token transfer involving both a fungible token (ALC-6258d2) and a semi-fungible token (SFT-1q4r8i). The receiver gets 12 ALC-6258d2 and 3 SFT-1q4r8i. ```rust MultiTokensTransferTransaction { Sender: erd1sg4u62lzvgkeu4grnlwn7h2s92rqf8a64z48pl9c7us37ajv9u8qj9w8xg Receiver: erd1sg4u62lzvgkeu4grnlwn7h2s92rqf8a64z48pl9c7us37ajv9u8qj9w8xg Value: 0 GasLimit: 2_200_000 Data: "MultiESDTNFTTransfer" + "@8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8" + // erd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruqzu66jx "@02" + // 2 tokens to transfer "@414c432d363235386432" + // ALC-6258d2 "@00" + // 0 -> the nonce is 0 for regular ESDT tokens "@0c" + // 12 -> value to transfer "@5346542d317134723869" + // SFT-1q4r8i "@01" + // 1 -> the nonce of the SFT "@03" // 3 -> the quantity to transfer } ``` -------------------------------- ### Perform a custom GET API call Source: https://github.com/multiversx/mx-docs/blob/main/docs/sdk-and-tools/sdk-js/sdk-js-cookbook-v15.md Use `doGetGeneric` for custom GET requests when the standard `ApiNetworkProvider` methods are insufficient. This example retrieves all transactions sent by an address where the `delegate` function was called. ```javascript const entrypoint = new DevnetEntrypoint(); const api = entrypoint.createNetworkProvider(); const alice = Address.newFromBech32("erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th"); const url = `transactions/${alice.toBech32()}?function=delegate`; const response = await api.doGetGeneric(url); ``` -------------------------------- ### Example Output of `build` Command Source: https://github.com/multiversx/mx-docs/blob/main/static/llms-full.txt Illustrates the file structure and naming convention for artifacts generated by the `build` command. ```text output ├── multisig-full.abi.json ├── multisig-full.imports.json ├── multisig-full.wasm ├── multisig-view.abi.json ├── multisig-view.imports.json ├── multisig-view.wasm ├── multisig.abi.json ├── multisig.imports.json └── multisig.wasm ``` -------------------------------- ### Example: Get Total Active Stake Source: https://github.com/multiversx/mx-docs/blob/main/docs/validators/delegation-manager.mdx Example request and response for querying the total active stake. The `returnData` field in the response contains the base64 encoded hexadecimal string representing the total active stake. ```json { "scAddress": "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqhllllsajxzat", "funcName": "getTotalActiveStake" } ``` ```json { "returnData": ["ArXjrxaxiAAA"] } ``` -------------------------------- ### Instantiating an Account from a Keystore file Source: https://github.com/multiversx/mx-docs/blob/main/static/llms-full.txt Illustrates creating an Account object from a keystore file, requiring a password. ```APIDOC ## Instantiating an Account from a Keystore file ### Description Create an `Account` object from a keystore file, providing the file path and password. ### Method `Account.new_from_keystore(file_path, password)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from pathlib import Path from multiversx_sdk import Account account = Account.new_from_keystore( file_path=Path("../multiversx_sdk/testutils/testwallets/alice.json"), password="password" ) ``` ### Response #### Success Response (200) An `Account` object is instantiated. #### Response Example None ``` -------------------------------- ### Example: Get Nodes States Source: https://github.com/multiversx/mx-docs/blob/main/docs/validators/delegation-manager.mdx Example request and response for querying node states and BLS keys. The `returnData` array contains alternating base64 encoded states and public BLS keys in hexadecimal encoding. ```json { "scAddress": "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqhllllsajxzat", "funcName": "getAllNodeStates" } ``` ```json { "returnData": [ "c3Rha2Vk", "KJ6auG3rKQydktc9soWvyBOa5UPA7DYezttTqlS6JIIvsvOaH8ghs2Qruc4aXLUXNJ1if7Ot9gbt5dNUrmNfkLtZl1hpLvPllrGmFP4bKCzZ25UNiTratwOMcXhhCmSD", "bm90U3Rha2Vk", "7gJzQ3GQ4htSx6CYvOkXPDdwGfzdahuDY4agZkGhIAMfB44K08FP6z3wLQEnn2IULfZ8/Hds38LEu3Xq+mJZ4FktF0vm8C1T34b5uAEpZWtDZLICAEFCuQZrqS5Qb1CR", "vTyNQ/vDxg0L8LmoGuKP+4/wsbyWv8RaqeQ+WH+xrMvk1m7Q3wjheOpjYtQPz80YZ1CrwKj6ObsCUejP4uuvi3MQ1oMEGKg5yh3kRgybRb4TXAWEpAPszYMLIQhrIn2P", "9TbGQCcrbyXH9HBAhzIWOuH/cdSNO1dwxO5foM2L28tWU0p9Kos6DKsPMtKMx4sAeRal08K3Dk0gQxeTSAvC2fb3DAQt01rmPSAqCSXZetSX12BVcTi+pYGUHaXKJ/OW" ] } ``` -------------------------------- ### Create Account from Entrypoint Source: https://github.com/multiversx/mx-docs/blob/main/docs/sdk-and-tools/sdk-js/sdk-js-cookbook-v14.md Initialize a new account directly from a network entrypoint. This account is network agnostic. ```javascript { const entrypoint = new DevnetEntrypoint(); const account = entrypoint.createAccount(); } ``` -------------------------------- ### Deploy Sovereign Chain Locally Source: https://github.com/multiversx/mx-docs/blob/main/docs/sovereign/local-setup.md Configure and start the Sovereign chain using local scripts. This setup does not connect to the main MultiversX chain. ```bash ./config.sh && ./sovereignStart.sh ``` -------------------------------- ### Get Transactions Pool Response Source: https://github.com/multiversx/mx-docs/blob/main/static/llms-full.txt Example response for fetching the entire transaction pool from a local proxy instance. Note: This endpoint is not available on the public gateway. ```json { "data": { "txPool": { "regularTransactions": [ { "txFields": { "hash": "84bb8a..." } }, { "txFields": { "hash": "4e2c43..." } } ], "smartContractResults": [], "rewards": [] }, "error": "", "code": "successful" } } ``` -------------------------------- ### Clone Repositories and Run Prerequisites Source: https://github.com/multiversx/mx-docs/blob/main/docs/developers/setup-local-testnet-advanced.md Clone the necessary MultiversX repositories and run the prerequisites script to set up the local testnet environment. ```bash mkdir mytestnet && cd mytestnet git clone git@github.com:multiversx/mx-chain-go.git git clone git@github.com:multiversx/mx-chain-proxy-go.git ``` ```bash cd mx-chain-go/scripts/testnet ./prerequisites.sh ``` -------------------------------- ### Storage Get Annotation Example Source: https://github.com/multiversx/mx-docs/blob/main/docs/developers/developer-reference/sc-annotations.md Demonstrates how to use the `#[storage_get]` annotation to retrieve data from contract storage. It shows retrieval from a fixed key and from a composite key formed by method arguments. ```rust #[multiversx_sc::contract] pub trait Adder { #[view(getSum)] #[storage_get("sum")] fn get_sum(&self) -> BigUint; #[storage_get("example_map")] fn get_value(&self, key_1: u32, key_2: u32) -> SerializableType; } ``` -------------------------------- ### Query contract with `ReturnsResult` Source: https://github.com/multiversx/mx-docs/blob/main/docs/developers/transactions/tx-result-handlers.md This async function example shows how to query a contract's state using `ReturnsResult` to get the return value, which is inferred from the original function signature (e.g., `bool` in this case). ```rust async fn quorum_reached(&mut self, action_id: usize) -> bool { self.interactor .query() .to(self.state.current_multisig_address()) .typed(multisig_proxy::MultisigProxy) .quorum_reached(action_id) .returns(ReturnsResult) // knows from the original type marker that the expected return type is bool .prepare_async() .run() .await } ``` -------------------------------- ### Localnet Configuration File Example Source: https://github.com/multiversx/mx-docs/blob/main/static/llms-full.txt An example of the `localnet.toml` configuration file, showing settings for general, metashard, shards, networking, and software components. ```toml [general] ... rounds_per_epoch = 100 round_duration_milliseconds = 6000 [metashard] ... num_validators = 1 [shards] num_shards = 2 ... [networking] ... port_proxy = 7950 port_first_validator_rest_api = 10200 [software.mx_chain_go] resolution = "remote" archive_url = "https://github.com/multiversx/mx-chain-go/archive/refs/heads/master.zip" ... [software.mx_chain_proxy_go] resolution = "remote" archive_url = "https://github.com/multiversx/mx-chain-proxy-go/archive/refs/heads/master.zip" ... ``` -------------------------------- ### Rust Smart Contract Initialization and Upgrade Functions Source: https://github.com/multiversx/mx-docs/blob/main/static/llms-full.txt Example Rust code for a smart contract demonstrating the `init` function for initial setup and the `upgrade` function for subsequent updates. Note that `init` is not called during upgrades in versions 1.6.0 and later. ```rust #[init] fn init(&self, initial_value: u64) { // Save the initial value in storage only if it is empty. self.sum().set_if_empty(initial_value); } #[upgrade] fn upgrade(&self, new_value: u64) { self.sum().set(new_value); } ``` -------------------------------- ### Check Rust Installation Source: https://github.com/multiversx/mx-docs/blob/main/docs/developers/toolchain-setup.md Verifies the Rust installation by showing the default host, rustup home directory, installed toolchains, and active toolchain with installed targets. ```sh $ rustup show Default host: x86_64-unknown-linux-gnu rustup home: /home/ubuntu/.rustup installed toolchains -------------------- stable-x86_64-unknown-linux-gnu (default) [...] active toolchain ---------------- name: stable-x86_64-unknown-linux-gnu installed targets: wasm32-unknown-unknown wasm32v1-none x86_64-unknown-linux-gnu ``` -------------------------------- ### Run Prerequisites Script Source: https://github.com/multiversx/mx-docs/blob/main/docs/sovereign/local-setup.md Execute the script to verify and download necessary packages and clone required repositories for the Sovereign setup. ```bash ./prerequisites.sh ``` -------------------------------- ### Create New Smart Contract from Template Source: https://github.com/multiversx/mx-docs/blob/main/static/llms-full.txt Initializes a new smart contract project using one of the available templates. Defaults to the current directory if --path is not provided. ```bash sc-meta new --path= ``` -------------------------------- ### Check pip installation Source: https://github.com/multiversx/mx-docs/blob/main/docs/sdk-and-tools/mxpy/installing-mxpy.md Verify that pip is installed on your system, a prerequisite for installing argcomplete. ```sh pip3 --version ``` -------------------------------- ### Setup and Deploy Staking Contract Source: https://github.com/multiversx/mx-docs/blob/main/docs/developers/tutorials/staking-contract.md Initializes the contract world, registers the staking contract, sets up accounts, and simulates the contract deployment. ```rust pub fn new() -> Self { let mut world = ScenarioWorld::new(); world.set_current_dir_from_workspace("staking-contract"); world.register_contract(WASM_PATH, staking_contract::ContractBuilder); world.account(OWNER_ADDRESS).nonce(1).balance(0); world.account(USER_ADDRESS).nonce(1).balance(USER_BALANCE); // simulate deploy world .tx() .from(OWNER_ADDRESS) .typed(staking_contract_proxy::StakingContractProxy) .init(APY) .code(WASM_PATH) .new_address(STAKING_CONTRACT_ADDRESS) .run(); ContractSetup { world } } } ``` -------------------------------- ### Install Rustup Source: https://github.com/multiversx/mx-docs/blob/main/static/llms-full.txt Installs Rustup, the toolchain installer for Rust. Follow the prompts to choose the default toolchain and update it. ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` ```bash rustup update ``` ```bash rustup default stable ``` ```bash rustup target add wasm32-unknown-unknown ``` -------------------------------- ### Smart Contract Deployment Arguments Example Source: https://github.com/multiversx/mx-docs/blob/main/docs/sdk-and-tools/sdk-py.md Demonstrates using a mix of typed value objects and plain Python values for smart contract deployment arguments when an ABI is available. ```python args = [U32Value(42), "hello", { "foo": "bar" }, TokenIdentifierValue("TEST-123456")] ``` -------------------------------- ### Install multiversx-sc-meta Source: https://github.com/multiversx/mx-docs/blob/main/docs/developers/meta/sc-meta.md Install the standalone multiversx-sc-meta tool using Cargo. Ensure you have the 'build-essential' package installed on Ubuntu. ```bash cargo install multiversx-sc-meta --locked ``` -------------------------------- ### Instantiate Account from Keystore File Source: https://github.com/multiversx/mx-docs/blob/main/docs/sdk-and-tools/sdk-js/sdk-js-cookbook-v14.md Load an account from a keystore file using its path and password. Offers enhanced security. ```javascript { const keystorePath = path.join("../src", "testdata", "testwallets", "alice.json"); const accountFromKeystore = Account.newFromKeystore(keystorePath, "password"); } ``` -------------------------------- ### Instantiating Controllers and Factories Source: https://github.com/multiversx/mx-docs/blob/main/docs/sdk-and-tools/sdk-js/sdk-js-cookbook-v15.md Demonstrates how to create transaction controllers and factories, either by obtaining them from an entrypoint or by manual instantiation. ```APIDOC ## Instantiating Controllers and Factories There are two ways to create controllers and factories: 1. Get them from the entrypoint. 2. Manually instantiate them. ```js const entrypoint = new DevnetEntrypoint(); // getting the controller and the factory from the entrypoint const transfersController = entrypoint.createTransfersController(); const transfersFactory = entrypoint.createTransfersTransactionsFactory(); // manually instantiating the controller and the factory const controller = new TransfersController({ chainID: "D" }); const config = new TransactionsFactoryConfig({ chainID: "D" }); const factory = new TransferTransactionsFactory({ config }); ``` ``` -------------------------------- ### Install Yarn using npm Source: https://github.com/multiversx/mx-docs/blob/main/docs/sovereign/services.md Use this command to install Yarn globally via npm. Ensure Node.js and npm are installed first. ```bash npm install --global yarn ``` -------------------------------- ### Instantiating Controllers and Factories Source: https://github.com/multiversx/mx-docs/blob/main/docs/sdk-and-tools/sdk-js/sdk-js-cookbook-v14.md Demonstrates how to create and instantiate controllers and transaction factories, either by retrieving them from an entrypoint or by manual instantiation. ```APIDOC ## Instantiating Controllers and Factories ### Description There are two ways to create controllers and factories: 1. Get them from the entrypoint. 2. Manually instantiate them. ### Methods 1. `entrypoint.createTransfersController()` 2. `entrypoint.createTransfersTransactionsFactory()` 3. `new TransfersController(config)` 4. `new TransferTransactionsFactory(config)` ### Parameters #### Request Body (for manual instantiation) - **config** (object) - Configuration object for the controller or factory. - **chainID** (string) - The chain ID (e.g., "D" for Devnet). ### Request Example ```js const entrypoint = new DevnetEntrypoint(); // getting the controller and the factory from the entrypoint const transfersController = entrypoint.createTransfersController(); const transfersFactory = entrypoint.createTransfersTransactionsFactory(); // manually instantiating the controller and the factory const controller = new TransfersController({ chainID: "D" }); const config = new TransactionsFactoryConfig({ chainID: "D" }); const factory = new TransferTransactionsFactory({ config }); ``` ```