Skip to content

Commit ad4a6e6

Browse files
authored
Use rpc.account.nextIndex in submittables (#1422)
1 parent c0a8043 commit ad4a6e6

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# 0.93.0-beta.x
22

3+
- In extrinsic submission, use `rpc.account.nextIndex` to retrieve the nonce when available
34
- 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.
45
- 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.
56
- Updated types to support the latest Polkadot/Substrate master changes

packages/api/src/submittable/Submittable.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ export default class Submittable<ApiType> extends _Extrinsic implements Submitta
193193
return combineLatest([
194194
// if we have a nonce already, don't retrieve the latest, use what is there
195195
isUndefined(options.nonce)
196-
? this._api.query.system.accountNonce<Index>(address)
196+
? this._api.rpc.account.nextIndex
197+
? this._api.rpc.account.nextIndex(address)
198+
: this._api.query.system.accountNonce(address)
197199
: of(createType('Index', options.nonce)),
198200
// if we have an era provided already or eraLength is <= 0 (immortal)
199201
// don't get the latest block, just pass null, handle in mergeMap

0 commit comments

Comments
 (0)