paritytech / paritytech/json-rpc-interface-spec
`system_accountNextIndex` alternative?
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 37
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
The legacy JSON-RPC API provides the system_accountNextIndex RPC endpoint, which considers the transactions present in the pool.
Additionally, PJS offers a useful shorthand allowing users to pass -1 as the nonce. This signals PJS to obtain the nonce from the system_accountNextIndex endpoint.
Using the new JSON-RPC API, we can utilize the AccountNonceApi_account_nonce runtime call against the most recently seen block to get the latest nonce. However, if there are transactions in the pool, the resulting transaction will eventually become invalid because it won't have the latest nonce.
I am concerned that there is no way to accomplish the same with the new JSON-RPC API. As a library author trying to provide an alternative to PJS, my users are experiencing issues because they must manually track the latest nonce when sending multiple transactions in parallel.
I am seeking advice on the following:
- Should polkadot-api attempt to provide similar functionality by keeping track of currently broadcasted transactions from this client? This approach seems somewhat hacky and risky.
- Are there any other options or ideas that I may not have considered?
Any guidance or suggestions would be greatly appreciated.
cc: @tomaka @jsdw @bkchr
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 by reviewing the legacy system_accountNextIndex endpoint, the new AccountNonceApi_account_nonce runtime call, and the PJS nonce shorthand described in the issue. The work is complete when the project has a decided, documented approach for handling pending transactions through the new JSON-RPC API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100