Skip to content

Commit

Permalink
docs: include call chain new feature (#12)
Browse files Browse the repository at this point in the history
* docs: include call contract improvements in the existing docs

* chore: update gif file

* docs: small improvements

* docs: update gif

* docs: various improvements

* docs: small adjusts

* docs: fix feedback

* refactor: call a chain instead of calling
  • Loading branch information
AlexD10S authored Dec 12, 2024
1 parent 3c1dffa commit fc2bf69
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions pop-cli-for-appchains/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* [Create a Contracts parachain](guides/create-a-new-parachain/create-a-smart-contract-parachain.md)
* [Create an EVM parachain](guides/create-a-new-parachain/create-an-evm-parachain.md)
* [Build your parachain](guides/build-your-parachain.md)
* [Call a chain](guides/call-a-chain.md)
* [Running your parachain](guides/running-your-parachain.md)
* [Spinning up a Polkadot Network](guides/spinning-up-a-polkadot-network/README.md)
* [Spinning up Paseo](guides/spinning-up-a-polkadot-network/spinning-up-the-polkadot-network.md)
Expand All @@ -31,5 +32,6 @@
* [new](pop-cli/new.md)
* [build](pop-cli/build.md)
* [build spec](https://learn.onpop.io/v/appchains/pop-cli/build#build-spec)
* [call](pop-cli/call.md)
* [up](pop-cli/up.md)
* [clean](pop-cli/clean.md)
72 changes: 72 additions & 0 deletions pop-cli-for-appchains/guides/call-a-chain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Call a chain

### Interactive Guidance (Recommended)

Interact with a chain **using** Pop CLI's interactive guidance by simply entering:

```shell
pop call chain
```

You will be prompted to select a pallet, the dispatchable function and its required arguments, connection details for the chain, and the account to sign the transaction.

<figure><img src="../.gitbook/assets/callchain.gif" alt="pop call chain"><figcaption><p>pop call chain</p></figcaption></figure>

### Manual (non-interactive)

If you prefer not to use interactive prompts, you can call the chain by specifying all the required arguments directly:

```shell
pop call chain --pallet System --function remark --args "0x11" --url ws://localhost:9944/ --suri //Alice --skip-confirm
```

```
┌ Pop CLI : Call a chain
◇ Would you like to dispatch this function call with `Root` origin?
│ No
⚙ pop call chain --pallet System --function remark --args "0x11" --url ws://localhost:9944/ --suri //Alice
⚙ Encoded call data: 0x00000411
◇ Do you want to submit the extrinsic?
│ Yes
◇ Extrinsic submitted with hash: "0xadbfbb2f92b22a2c5d6542ba80e4111b5c60057f594a6d155341879c5a46f96e"
└ Call complete.
```

#### Additional Options

* To dispatch a call with Root origin when the chain's runtime includes `pallet-sudo`, you can wrap the call in a `sudo.sudo()` call by using the `--sudo` flag:

```shell
pop call chain --pallet System --function remark --args "0x11" --url ws://localhost:9944/ --suri //Alice --sudo
```

* If you already have the SCALE-encoded call data, and want to directly submit the extrinsic:

```shell
pop call chain --call 0x00000411 --url ws://localhost:9944/ --suri //Alice
```

```
┌ Pop CLI : Call a chain
⚙ Encoded call data: 0x00000411
◇ Do you want to submit the extrinsic?
│ Yes
◇ Extrinsic submitted successfully with hash: "0x60b10fa42fa7bb9e36460d199cef55b28b41dae3f9bb3326fc0e584009ce305b"
└ Call complete.
```

**Technical Support**

* [Polkadot Stack Exchange](https://polkadot.stackexchange.com/)
* Create a question and tag it with "[`pop`](https://substrate.stackexchange.com/tags/pop/info)"
* Share the StackExchange question in our [Pop Support Telegram channel](https://t.me/pop\_support)
74 changes: 74 additions & 0 deletions pop-cli-for-appchains/pop-cli/call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
description: Call a chain
---

# call

```bash
pop call <COMMAND>
```

**Interacting with the chain**

```bash
pop call chain
```

You will be prompted to select a pallet, the dispatchable function and its required arguments, connection details for the chain, and the account to sign the transaction.

If interactive guidance is not desired, you can proceed manually as follows:

```bash
pop call chain --pallet System --function remark --args "0x11" --url ws://localhost:9944/ --suri //Alice --skip-confirm
```

To dispatch a call with Root origin when the chain's runtime includes `pallet-sudo`, you can wrap the call in a `sudo.sudo()` call by using the `--sudo` flag:

```bash
pop call chain --pallet System --function remark --args "0x11" --url ws://localhost:9944/ --suri //Alice --sudo
```

If you already have the `SCALE`-encoded call data and want to submit the extrinsic directly, use `--chain` as shown below:

```shell
pop call chain --call 0x00000411 --url ws://localhost:9944/ --suri //Alice
```

**Additional options:**

```
pop call chain --help
Call a chain
Usage: pop call chain [OPTIONS]
Options:
-p, --pallet <PALLET>
The pallet containing the dispatchable function to execute
-f, --function <FUNCTION>
The dispatchable function to execute within the specified pallet
-a, --args [<ARGS>...]
The dispatchable function arguments, encoded as strings
-u, --url <URL>
Websocket endpoint of a node
-s, --suri <SURI>
Secret key URI for the account signing the extrinsic.
e.g. - for a dev account "//Alice" - with a password "//Alice///SECRET_PASSWORD"
-c, --call <call>
SCALE encoded bytes representing the call data of the extrinsic
-S, --sudo
Authenticates the sudo key and dispatches a function call with `Root` origin
-y, --skip-confirm
Automatically signs and submits the extrinsic without prompting for confirmation
-h, --help
Print help (see a summary with '-h')
```

0 comments on commit fc2bf69

Please sign in to comment.