Remove double-up-drr (memo vs rpc) (#1541)
* Remove inner memo (no double-up on stringify) * Validators-specific query
This commit is contained in:
@@ -81,7 +81,7 @@ export const all = memo((api: ApiInterfaceRx): (address: AccountIndex | AccountI
|
||||
const bestNumberCall = bestNumber(api);
|
||||
const infoCall = info(api);
|
||||
|
||||
return memo((address: AccountIndex | AccountId | Address | string): Observable<DerivedBalances> =>
|
||||
return (address: AccountIndex | AccountId | Address | string): Observable<DerivedBalances> =>
|
||||
infoCall(address).pipe(
|
||||
switchMap(({ accountId }): Observable<Result> =>
|
||||
(accountId
|
||||
@@ -101,5 +101,5 @@ export const all = memo((api: ApiInterfaceRx): (address: AccountIndex | AccountI
|
||||
),
|
||||
map(calcBalances),
|
||||
drr()
|
||||
));
|
||||
);
|
||||
}, true);
|
||||
|
||||
@@ -56,7 +56,7 @@ export const fees = memo((api: ApiInterfaceRx): () => Observable<DerivedFees> =>
|
||||
? queryV2
|
||||
: queryV1;
|
||||
|
||||
return memo((): Observable<DerivedFees> =>
|
||||
return (): Observable<DerivedFees> =>
|
||||
query(api).pipe(
|
||||
map(([creationFee, existentialDeposit, transferFee, transactionBaseFee, transactionByteFee]): DerivedFees => ({
|
||||
creationFee,
|
||||
@@ -66,5 +66,5 @@ export const fees = memo((api: ApiInterfaceRx): () => Observable<DerivedFees> =>
|
||||
transferFee
|
||||
})),
|
||||
drr()
|
||||
));
|
||||
);
|
||||
}, true);
|
||||
|
||||
@@ -12,12 +12,12 @@ import { drr, memo } from '../util';
|
||||
import { all } from './all';
|
||||
|
||||
export const votingBalances = memo((api: ApiInterfaceRx): (addresses?: (AccountId | AccountIndex | Address | string)[]) => Observable<DerivedBalances[]> => {
|
||||
return memo((addresses?: (AccountId | AccountIndex | Address | string)[]): Observable<DerivedBalances[]> =>
|
||||
return (addresses?: (AccountId | AccountIndex | Address | string)[]): Observable<DerivedBalances[]> =>
|
||||
(
|
||||
!addresses || !addresses.length
|
||||
? of([] as DerivedBalances[])
|
||||
: combineLatest(addresses.map(all(api)))
|
||||
).pipe(
|
||||
drr()
|
||||
));
|
||||
);
|
||||
}, true);
|
||||
|
||||
@@ -17,7 +17,7 @@ import { votingBalances } from './votingBalances';
|
||||
export const votingBalancesNominatorsFor = memo((api: ApiInterfaceRx): (address: AccountId | AccountIndex | Address | string) => Observable<DerivedBalances[]> => {
|
||||
const infoCall = info(api);
|
||||
|
||||
return memo((address: AccountId | AccountIndex | Address | string): Observable<DerivedBalances[]> =>
|
||||
return (address: AccountId | AccountIndex | Address | string): Observable<DerivedBalances[]> =>
|
||||
infoCall(address).pipe(
|
||||
switchMap(({ accountId }): Observable<AccountId[]> =>
|
||||
accountId
|
||||
@@ -26,5 +26,5 @@ export const votingBalancesNominatorsFor = memo((api: ApiInterfaceRx): (address:
|
||||
),
|
||||
switchMap(votingBalances(api)),
|
||||
drr()
|
||||
));
|
||||
);
|
||||
}, true);
|
||||
|
||||
Reference in New Issue
Block a user