diff --git a/packages/api-derive/src/balances/fees.ts b/packages/api-derive/src/balances/fees.ts index 50ffc7d4d2..4823a075ad 100644 --- a/packages/api-derive/src/balances/fees.ts +++ b/packages/api-derive/src/balances/fees.ts @@ -14,14 +14,16 @@ import { drr } from '../util/drr'; type Result = [Balance, Balance, Balance, Balance, Balance]; function queryV2 (api: ApiInterfaceRx): Observable { + const paymentBase = api.consts.transactionPayment || api.consts.balances; + return of([ // get values from api.const for substrate versions post spec_version: 101 // https://github.com/paritytech/substrate/pull/2883/files#diff-5e5e1c3aec9ddfde0a9054d062ab3db9R131 api.consts.balances.creationFee as Balance, api.consts.balances.existentialDeposit as Balance, - api.consts.balances.transactionBaseFee as Balance, - api.consts.balances.transactionByteFee as Balance, - api.consts.balances.transferFee as Balance + api.consts.balances.transferFee as Balance, + paymentBase.transactionBaseFee as Balance, + paymentBase.transactionByteFee as Balance ]); } @@ -30,9 +32,9 @@ function queryV1 (api: ApiInterfaceRx): Observable { // 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, - api.query.balances.transferFee + api.query.balances.transactionByteFee ]); } @@ -56,7 +58,7 @@ export function fees (api: ApiInterfaceRx): () => Observable { ? queryV2(api) : queryV1(api) ).pipe( - map(([creationFee, existentialDeposit, transactionBaseFee, transactionByteFee, transferFee]): DerivedFees => ({ + map(([creationFee, existentialDeposit, transferFee, transactionBaseFee, transactionByteFee]): DerivedFees => ({ creationFee, existentialDeposit, transactionBaseFee, diff --git a/packages/types/src/interfaceRegistry.ts b/packages/types/src/interfaceRegistry.ts index 33a870d5d9..8a70967532 100644 --- a/packages/types/src/interfaceRegistry.ts +++ b/packages/types/src/interfaceRegistry.ts @@ -22,6 +22,7 @@ import { FullIdentification, IdentificationTuple, Keys, SessionIndex, SessionKey import { EraIndex, EraPoints, EraRewards, Exposure, Forcing, IndividualExposure, MomentOf, Points, RewardDestination, SlashJournalEntry, StakingLedger, UnlockChunk, ValidatorPrefs, ValidatorPrefs0to145 } from '@polkadot/types/interfaces/staking'; import { DigestOf, DispatchError, Event, EventId, EventIndex, EventRecord, EventRecord0to76, Key, Phase } from '@polkadot/types/interfaces/system'; import { TreasuryProposal } from '@polkadot/types/interfaces/treasury'; +import { Multiplier } from '@polkadot/types/interfaces/txpayment'; import { DispatchResult, DispatchResultOf } from '@polkadot/types/interfaces/utility'; import { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations'; import { EcdsaSignature, EthereumAddress } from '@polkadot/types/interfaces/claims'; @@ -639,6 +640,9 @@ export interface InterfaceRegistry { TreasuryProposal: TreasuryProposal; 'Option': Option; 'Vec': Vec; + Multiplier: Multiplier; + 'Option': Option; + 'Vec': Vec; DispatchResult: DispatchResult; 'Option': Option; 'Vec': Vec; diff --git a/packages/types/src/interfaces/definitions.ts b/packages/types/src/interfaces/definitions.ts index b9c499ee74..f0b5a5530e 100644 --- a/packages/types/src/interfaces/definitions.ts +++ b/packages/types/src/interfaces/definitions.ts @@ -24,6 +24,7 @@ export { default as session } from './session/definitions'; export { default as staking } from './staking/definitions'; export { default as system } from './system/definitions'; export { default as treasury } from './treasury/definitions'; +export { default as txpayment } from './txpayment/definitions'; export { default as utility } from './utility/definitions'; // polkadot-specific types diff --git a/packages/types/src/interfaces/txpayment/definitions.ts b/packages/types/src/interfaces/txpayment/definitions.ts new file mode 100644 index 0000000000..f512d2e687 --- /dev/null +++ b/packages/types/src/interfaces/txpayment/definitions.ts @@ -0,0 +1,9 @@ +// Copyright 2017-2019 @polkadot/types authors & contributors +// This software may be modified and distributed under the terms +// of the Apache-2.0 license. See the LICENSE file for details. + +export default { + types: { + Multiplier: 'Fixed64' + } +}; diff --git a/packages/types/src/interfaces/txpayment/index.ts b/packages/types/src/interfaces/txpayment/index.ts new file mode 100644 index 0000000000..05fdc138ff --- /dev/null +++ b/packages/types/src/interfaces/txpayment/index.ts @@ -0,0 +1,4 @@ +// Auto-generated via `yarn build:interfaces`, do not edit +/* eslint-disable @typescript-eslint/no-empty-interface */ + +export * from './types'; diff --git a/packages/types/src/interfaces/txpayment/types.ts b/packages/types/src/interfaces/txpayment/types.ts new file mode 100644 index 0000000000..2ec08ff232 --- /dev/null +++ b/packages/types/src/interfaces/txpayment/types.ts @@ -0,0 +1,7 @@ +// Auto-generated via `yarn build:interfaces`, do not edit +/* eslint-disable @typescript-eslint/no-empty-interface */ + +import { Fixed64 } from '@polkadot/types/primitive'; + +/** Fixed64 */ +export interface Multiplier extends Fixed64 {} diff --git a/packages/types/src/interfaces/types.ts b/packages/types/src/interfaces/types.ts index ee1f7b79be..296481f483 100644 --- a/packages/types/src/interfaces/types.ts +++ b/packages/types/src/interfaces/types.ts @@ -20,6 +20,7 @@ export * from './session/types'; export * from './staking/types'; export * from './system/types'; export * from './treasury/types'; +export * from './txpayment/types'; export * from './utility/types'; export * from './attestations/types'; export * from './claims/types';