Joystream / Joystream/joystream
CLI: Sending extrinsics
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Description
In my last PR I introduced the api:inspect command which allows inspecting some of the chain state endpoints, ie. listing and retrieving values of api.consts and listing/calling api.query methods from the CLI.
This already required to create some functionality that would handle promting the user for inputs of varying types: ie. Option<Type>, Tuple(Type1, Type2) or simply Type (which is currently always beeing send as a string).
This could be used as a base to also allow the user to interact with api.tx in order to send extrinsics. In Pioneer there is a separate module for that (Extrinsics). In the CLI this can either be part of api:inspect and used this way:
api:inspect -t=tx -M=contentWorkingGroup -m=createChannel -e
Or there can be a separate command for this, like api:extrnsics. I already went the route of trying to make api:inspect as universal as possible, since this seemed quite convinient at the beginning, but the drawback of this approach is that it's getting hard to describe what this command actually does (it handles pretty much all the imaginabe interactions with the api and everything depends on which flags are provided and which aren't). It may also be useful to separate some of its logic.
Adding support for api.tx will require handling a few other possible input arguments' types like Enum, Vec, Struct etc. I found this file: https://github.com/Joystream/apps/blob/joystream/packages/react-params/src/Param/findComponent.ts to be a good reference for how to handle different types of input. It may be challenging to correctly handle all the possible types, but this can be implemented step by step, by checking which types are currently most common etc. Fortunately most of the "simple" types like IDs, addresses (ie. Account), hashes, Bytes, numbers etc. are getting correctly parsed from simple strings, so they seem not to require any specific logic (although it may be convinient to handle them differently in the future, ie. allowing to choose one of the existing accounts for Account type etc.).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing api:inspect command and its handling of prompted inputs, then review the referenced react-params/src/Param/findComponent.ts implementation for enum, vector, tuple, and struct inputs. Decide whether extrinsics belong in api:inspect or a separate command, and define completion as sending api.tx extrinsics with the supported argument types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- blockchain, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100