capi
capi copied to clipboard
Add features for a working with ink! Dapps
Feature Request
This is an initial granular list of requirements for a viable fully-fledged ink! client for Dapps. Additions / suggestions are welcome. Many of these items may already exist in Capi.
Suggestion
General
- Allow a user to instantiate a Capi contract instance using
<name>.contractfile extension, which contains both the Wasm blob and the metadata. Currently Capi accepts two different files to achieve the same goal. - Deploy a Wasm contracts
- Call a contract message
- single call
- subscription - updates on new block to ensure data parity.
- User can define types in TypeScript
- Provide a way to bundle multiple calls together for one or more contracts that executes as a single request. (EVM chains have something similar using Multicall contracts)
- one-time call
- subscription - updates on new block
Transactions
- User can Dry Run without a signature (just a read call) to get the gasRequired fields, storage fee, etc.
- When a contract transaction requires a signature it triggers a browser wallet extension to open up via its injected extension
- Transactions expose all contract events (e.g. NFTTransferred) and blockchain events that get emitted (e.g. BalancesTransferred). Is there a way to access one specifically and get them all in the order that they happened? Contract Events can be typed by the user, and are decoded.
- Errors can be typed with decoded fields via the registry metadata
Contract Events
- Subscribe to contract events. User can define Types of the events
- Bundle subscriptions for multiple contracts and their events. User can define types.
- Fetch all events emitted from a contract in batches. e.g. Give me the first
100 events starting from block
N, then the next 100, etc. (Similar to pagination in Web APIs)
Nice To Haves
- Create a cache for repeat message reads with the same parameters on the same block. This will be especially powerful for bundled calls with many reads, and for Dapps that may have extra calls due to components re-rendering.
Motivation
The ink! team is developing a React hook library for rapid development and would like to use CAPI.
Use Cases
Dapps / Other libraries