Skip nextIndex (#1513)

* Skip nextIndex

* Remove from derive
This commit is contained in:
Jaco Greeff
2019-10-25 16:22:06 +02:00
committed by GitHub
parent ab78245576
commit de395c7053
2 changed files with 12 additions and 7 deletions
+6 -4
View File
@@ -91,10 +91,12 @@ export function all (api: ApiInterfaceRx): (address: AccountIndex | AccountId |
of(accountId),
bestNumber(api)(),
queryBalances(api, accountId),
api.rpc.account && api.rpc.account.nextIndex
? api.rpc.account.nextIndex(accountId)
// otherwise we end up with this: type 'Codec | Index' is not assignable to type 'Index'.
: api.query.system.accountNonce<Index>(accountId)
// FIXME This is having issues with Kusama, only use accountNonce atm
// api.rpc.account && api.rpc.account.nextIndex
// ? api.rpc.account.nextIndex(accountId)
// // otherwise we end up with this: type 'Codec | Index' is not assignable to type 'Index'.
// : api.query.system.accountNonce<Index>(accountId)
api.query.system.accountNonce<Index>(accountId)
])
: of([createType('AccountId'), createType('BlockNumber'), [createType('Balance'), createType('Balance'), createType('Vec<BalanceLock>'), createType('Option<VestingSchedule>', null)], createType('Index')])
)
+6 -3
View File
@@ -193,9 +193,12 @@ 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.rpc.account.nextIndex
? this._api.rpc.account.nextIndex(address)
: this._api.query.system.accountNonce(address)
// FIXME This apparently is having issues on latest Kusama for nonce retrieval,
// hence we are using the accountNonce only
// ? this._api.rpc.account.nextIndex
// ? this._api.rpc.account.nextIndex(address)
// : this._api.query.system.accountNonce(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