linked maps with getStorage only

This commit is contained in:
Jaco Greeff
2020-03-09 21:42:56 +01:00
parent b526873837
commit bcbd4b8d40
2 changed files with 6 additions and 3 deletions
+4
View File
@@ -2,5 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { drr } from '@polkadot/rpc-core/rxjs';
export * from './approvalFlagsToBools';
export * from './memo';
export { drr };
+2 -3
View File
@@ -366,9 +366,8 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
// entries can be re-linked in the middle of a list, we subscribe here to make
// sure we catch any updates, no matter the list position
const getNext = (key: Codec): Observable<LinkageResult> =>
this._rpcCore.state.subscribeStorage<[LinkageData | Option<LinkageData>]>([[creator, key]]).pipe(
first(),
switchMap(([_data]: [LinkageData | Option<LinkageData>]): Observable<LinkageResult> => {
this._rpcCore.state.getStorage<LinkageData | Option<LinkageData>>([creator, key]).pipe(
switchMap((_data: LinkageData | Option<LinkageData>): Observable<LinkageResult> => {
const data = creator.meta.modifier.isOptional
? (_data as Option<LinkageData>).unwrapOr(null)
: _data as LinkageData;