Remove double-up-drr (memo vs rpc) (#1541)
* Remove inner memo (no double-up on stringify) * Validators-specific query
This commit is contained in:
@@ -66,6 +66,6 @@ export const idAndIndex = memo((api: ApiInterfaceRx): (address?: Address | Accou
|
||||
indexToIdCall: indexToId(api)
|
||||
};
|
||||
|
||||
return memo((address?: Address | AccountId | AccountIndex | string | null): Observable<AccountIdAndIndex> =>
|
||||
retrieve(address, calls).pipe(drr()));
|
||||
return (address?: Address | AccountId | AccountIndex | string | null): Observable<AccountIdAndIndex> =>
|
||||
retrieve(address, calls).pipe(drr());
|
||||
}, true);
|
||||
|
||||
@@ -28,12 +28,12 @@ import { drr, memo } from '../util';
|
||||
export const idToIndex = memo((api: ApiInterfaceRx): (accountId: AccountId | string) => Observable<AccountIndex | undefined> => {
|
||||
const indexesCall = indexes(api);
|
||||
|
||||
return memo((accountId: AccountId | string): Observable<AccountIndex | undefined> =>
|
||||
return (accountId: AccountId | string): Observable<AccountIndex | undefined> =>
|
||||
indexesCall().pipe(
|
||||
startWith({}),
|
||||
map((indexes: AccountIndexes): AccountIndex | undefined =>
|
||||
(indexes || {})[accountId.toString()]
|
||||
),
|
||||
drr()
|
||||
));
|
||||
);
|
||||
}, true);
|
||||
|
||||
@@ -28,7 +28,7 @@ import { drr, memo } from '../util';
|
||||
export const indexToId = memo((api: ApiInterfaceRx): (accountIndex: AccountIndex | string) => Observable<AccountId | undefined> => {
|
||||
const querySection = api.query.indices || api.query.balances;
|
||||
|
||||
return memo((_accountIndex: AccountIndex | string): Observable<AccountId | undefined> => {
|
||||
return (_accountIndex: AccountIndex | string): Observable<AccountId | undefined> => {
|
||||
const accountIndex = _accountIndex instanceof ClassOf('AccountIndex')
|
||||
? _accountIndex
|
||||
: createType('AccountIndex', _accountIndex);
|
||||
@@ -40,5 +40,5 @@ export const indexToId = memo((api: ApiInterfaceRx): (accountIndex: AccountIndex
|
||||
),
|
||||
drr()
|
||||
);
|
||||
});
|
||||
};
|
||||
}, true);
|
||||
|
||||
@@ -32,7 +32,7 @@ const enumsetSize = ENUMSET_SIZE.toNumber();
|
||||
* ```
|
||||
*/
|
||||
export const indexes = memo((api: ApiInterfaceRx): () => Observable<AccountIndexes> => {
|
||||
return memo((): Observable<AccountIndexes> =>
|
||||
return (): Observable<AccountIndexes> =>
|
||||
api.query.indices.nextEnumSet<AccountIndex>().pipe(
|
||||
// use the nextEnumSet (which is a counter of the number of sets) to construct
|
||||
// a range of values to query [0, 1, 2, ...]. Retrieve the full enum set for the
|
||||
@@ -54,5 +54,5 @@ export const indexes = memo((api: ApiInterfaceRx): () => Observable<AccountIndex
|
||||
return result;
|
||||
}, {} as AccountIndexes)),
|
||||
drr()
|
||||
));
|
||||
);
|
||||
}, true);
|
||||
|
||||
@@ -30,7 +30,7 @@ export const info = memo((api: ApiInterfaceRx): (address?: AccountIndex | Accoun
|
||||
const idAndIndexCall = idAndIndex(api);
|
||||
const nickCall = retrieveNick(api);
|
||||
|
||||
return memo((address?: AccountIndex | AccountId | Address | string | null): Observable<DeriveAccountInfo> =>
|
||||
return (address?: AccountIndex | AccountId | Address | string | null): Observable<DeriveAccountInfo> =>
|
||||
idAndIndexCall(address).pipe(
|
||||
switchMap(([accountId, accountIndex]): Observable<[DeriveAccountInfo, Option<[Bytes, Balance] & Codec>?]> =>
|
||||
combineLatest([
|
||||
@@ -46,5 +46,5 @@ export const info = memo((api: ApiInterfaceRx): (address?: AccountIndex | Accoun
|
||||
: undefined
|
||||
})),
|
||||
drr()
|
||||
));
|
||||
);
|
||||
}, true);
|
||||
|
||||
Reference in New Issue
Block a user