Drop V1 support in derive (#1718)
* Drop V1 support in derive * Re-do staking with multi * Re-bump deps * Adjusts tests (no alice_session) * CC
This commit is contained in:
@@ -13,7 +13,7 @@ import { memo } from '../util';
|
||||
|
||||
type Result = [Balance, Balance, Balance, Balance, Balance];
|
||||
|
||||
function queryV2 (api: ApiInterfaceRx): Observable<Result> {
|
||||
function query (api: ApiInterfaceRx): Observable<Result> {
|
||||
const paymentBase = api.consts.transactionPayment || api.consts.balances;
|
||||
|
||||
return of([
|
||||
@@ -27,17 +27,6 @@ function queryV2 (api: ApiInterfaceRx): Observable<Result> {
|
||||
]);
|
||||
}
|
||||
|
||||
function queryV1 (api: ApiInterfaceRx): Observable<Result> {
|
||||
return api.queryMulti<Result>([
|
||||
// Support older versions and get values from storage
|
||||
api.query.balances.creationFee,
|
||||
api.query.balances.existentialDeposit,
|
||||
api.query.balances.transferFee,
|
||||
api.query.balances.transactionBaseFee,
|
||||
api.query.balances.transactionByteFee
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @name fees
|
||||
* @returns An object containing the combined results of the storage queries for
|
||||
@@ -52,10 +41,6 @@ function queryV1 (api: ApiInterfaceRx): Observable<Result> {
|
||||
* ```
|
||||
*/
|
||||
export function fees (api: ApiInterfaceRx): () => Observable<DerivedFees> {
|
||||
const query = api.consts.balances
|
||||
? queryV2
|
||||
: queryV1;
|
||||
|
||||
return memo((): Observable<DerivedFees> =>
|
||||
query(api).pipe(
|
||||
map(([creationFee, existentialDeposit, transferFee, transactionBaseFee, transactionByteFee]): DerivedFees => ({
|
||||
|
||||
Reference in New Issue
Block a user