From 30961def87fdbe4a3161092cc6900e9a70eec2ae Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Tue, 10 Dec 2024 16:19:56 +0100 Subject: [PATCH] docs: include call contract improvements in the existing docs --- .../guides/calling-your-contract.md | 20 +++++++++++++++++-- pop-cli-for-smart-contracts/pop-cli/call.md | 12 +++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/pop-cli-for-smart-contracts/guides/calling-your-contract.md b/pop-cli-for-smart-contracts/guides/calling-your-contract.md index 9aa90f6..e00d241 100644 --- a/pop-cli-for-smart-contracts/guides/calling-your-contract.md +++ b/pop-cli-for-smart-contracts/guides/calling-your-contract.md @@ -2,14 +2,30 @@ Now that your contract is deployed locally, we can start interacting with it. -Grab the contract address that was outputted from the [previous step](deploy-your-contract-locally/deploy-locally-on-a-solochain.md). +### Interactive Guidance (Recommended) + +Interact with your deployed contract **with** Pop CLI's interactive guidance by simply entering: ```shell -pop call contract -p ./flipper --contract 5CLPm1CeUvJhZ8GCDZCR7nWZ2m3XXe4X5MtAQK69zEjut36A --message get --suri //Alice +pop call contract ``` +Grab the contract address that was outputted from the [previous step](deploy-your-contract-locally/deploy-locally-on-a-solochain.md). + > If you lost the address, you can always pull up [PolkadotJs Apps](https://polkadot.js.org/apps/) and check the chain state for the contract address. +You will be prompted to select a contract, choose messages, and configure additional options interactively. + +
pop call contract

pop call contract

+ +### Manual (non-interactive) + +If you prefer not to use the interactive prompts, you can call your contract by specifying all the required arguments directly. + +```shell +pop call contract -p ./flipper --contract 5CLPm1CeUvJhZ8GCDZCR7nWZ2m3XXe4X5MtAQK69zEjut36A --message get --suri //Alice +``` + ``` ┌ Pop CLI : Calling a contract │ diff --git a/pop-cli-for-smart-contracts/pop-cli/call.md b/pop-cli-for-smart-contracts/pop-cli/call.md index 2ce4f18..3ce5434 100644 --- a/pop-cli-for-smart-contracts/pop-cli/call.md +++ b/pop-cli-for-smart-contracts/pop-cli/call.md @@ -10,6 +10,13 @@ pop call **Interacting with the smart contract** +```bash +pop call contract +``` +The above will provide interactive guidance to interact with the smart contract. + +If interactive guidance is not desired than one can proceed with: + Read-only Operations: For operations that only require reading from the blockchain state. This approach does not require to submit an extrinsic. Example using the get() message: ```bash @@ -69,9 +76,14 @@ Options: e.g. - for a dev account "//Alice" - with a password "//Alice///SECRET_PASSWORD" + [default: //Alice] + -x, --execute Submit an extrinsic for on-chain execution --dry-run Perform a dry-run via RPC to estimate the gas usage. This does not submit a transaction + + -d, --dev + Enables developer mode, bypassing certain user prompts for faster testing. Recommended for testing and local development only ```