linked maps with getStorage only
This commit is contained in:
@@ -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 };
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user