Use rpc.account.nextIndex in submittables (#1422)

This commit is contained in:
Jaco Greeff
2019-09-25 17:20:46 +02:00
committed by GitHub
parent c0a804332b
commit ad4a6e63ce
2 changed files with 4 additions and 1 deletions
+1
View File
@@ -1,5 +1,6 @@
# 0.93.0-beta.x
- In extrinsic submission, use `rpc.account.nextIndex` to retrieve the nonce when available
- For TypeScript users `api.query.*.*` is now properly typed for default Substrate calls, i.e. `api.query.balances.freeBalance(...)` will return a `Balance` type. Additionally the `api.queryMulti` and `.multi` on queries not allow generic type params.
- Add `api.rpc.accounts.nextIndex`, `api.rpc.contracts.call` and `api.rpc.rpc.methods` calls. Optional calls (such as account/contracts) is decorated based on the results from `rpc.methods`, so they don't show up on nodes where they are not active.
- Updated types to support the latest Polkadot/Substrate master changes
+3 -1
View File
@@ -193,7 +193,9 @@ export default class Submittable<ApiType> extends _Extrinsic implements Submitta
return combineLatest([
// if we have a nonce already, don't retrieve the latest, use what is there
isUndefined(options.nonce)
? this._api.query.system.accountNonce<Index>(address)
? this._api.rpc.account.nextIndex
? this._api.rpc.account.nextIndex(address)
: this._api.query.system.accountNonce(address)
: of(createType('Index', options.nonce)),
// if we have an era provided already or eraLength is <= 0 (immortal)
// don't get the latest block, just pass null, handle in mergeMap