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.