Update Substrate with vesting (#1790)

* Update Substrate with vesting

* Update balances & vesting queries with compat)

* Split base account queries

* Linting, simpler referendum voters

* Fix (some) tests
This commit is contained in:
Jaco Greeff
2020-02-02 08:50:37 +01:00
committed by GitHub
parent f9d569ddd1
commit 9d4b0ea56a
27 changed files with 577 additions and 185 deletions
@@ -0,0 +1,84 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, AccountData, AccountIndex, Address, Balance, Index } from '@polkadot/types/interfaces';
import { DerivedBalancesAccount } from '../types';
import { combineLatest, of, Observable } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { createType } from '@polkadot/types';
import { memo } from '../util';
type Result = [Balance, Balance, Balance, Balance, Index];
function calcBalances (api: ApiInterfaceRx, [accountId, [freeBalance, reservedBalance, frozenFree, frozenMisc, accountNonce]]: [AccountId, Result]): DerivedBalancesAccount {
return {
accountId,
accountNonce,
freeBalance,
frozenFree,
frozenMisc,
reservedBalance,
votingBalance: createType(api.registry, 'Balance', freeBalance.add(reservedBalance))
};
}
// old
function queryOld (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
return api.queryMulti<[Balance, Balance, Index]>([
[api.query.balances.freeBalance, accountId],
[api.query.balances.reservedBalance, accountId],
[api.query.system.accountNonce, accountId]
]).pipe(
map(([freeBalance, reservedBalance, accountNonce]): Result =>
[freeBalance, reservedBalance, createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), accountNonce]
)
);
}
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
return api.queryMulti<[AccountData, Index]>([
[api.query.balances.account, accountId],
[api.query.system.accountNonce, accountId]
]).pipe(
map(([{ free, reserved, miscFrozen, feeFrozen }, accountNonce]): Result =>
[free, reserved, feeFrozen, miscFrozen, accountNonce]
)
);
}
/**
* @name account
* @param {( AccountIndex | AccountId | Address | string )} address - An accounts Id in different formats.
* @returns An object containing the results of various balance queries
* @example
* <BR>
*
* ```javascript
* const ALICE = 'F7Hs';
*
* api.derive.balances.all(ALICE, ({ accountId, lockedBalance }) => {
* console.log(`The account ${accountId} has a locked balance ${lockedBalance} units.`);
* });
* ```
*/
export function account (api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DerivedBalancesAccount> {
return memo((address: AccountIndex | AccountId | Address | string): Observable<DerivedBalancesAccount> =>
api.derive.accounts.info(address).pipe(
switchMap(({ accountId }): Observable<[AccountId, Result]> =>
(accountId
? combineLatest([
of(accountId),
api.query.balances.account
? queryCurrent(api, accountId)
: queryOld(api, accountId)
])
: of([createType(api.registry, 'AccountId'), [createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), createType(api.registry, 'Index')]])
)
),
map((result): DerivedBalancesAccount => calcBalances(api, result))
));
}
+66 -27
View File
@@ -2,8 +2,8 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, AccountIndex, Address, Balance, BalanceLock, BlockNumber, Index, VestingSchedule } from '@polkadot/types/interfaces';
import { DerivedBalances } from '../types';
import { AccountId, AccountIndex, Address, Balance, BalanceLock, BalanceLockTo212, BlockNumber, VestingInfo, VestingSchedule } from '@polkadot/types/interfaces';
import { DerivedBalancesAccount, DerivedBalancesAll } from '../types';
import BN from 'bn.js';
import { combineLatest, of, Observable } from 'rxjs';
@@ -14,16 +14,16 @@ import { bnMax } from '@polkadot/util';
import { memo } from '../util';
type ResultBalance = [Balance, Balance, BalanceLock[], Option<VestingSchedule>, Index];
type Result = [AccountId, BlockNumber, ResultBalance];
type ResultBalance = [VestingInfo | null, (BalanceLock | BalanceLockTo212)[]];
type Result = [DerivedBalancesAccount, BlockNumber, ResultBalance];
function calcBalances (api: ApiInterfaceRx, [accountId, bestNumber, [freeBalance, reservedBalance, locks, vesting, accountNonce]]: Result): DerivedBalances {
function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBalance, frozenFree, frozenMisc, reservedBalance, votingBalance }, bestNumber, [vesting, locks]]: Result): DerivedBalancesAll {
let lockedBalance = createType(api.registry, 'Balance');
let lockedBreakdown: BalanceLock[] = [];
let lockedBreakdown: (BalanceLock | BalanceLockTo212)[] = [];
if (Array.isArray(locks)) {
// only get the locks that are valid until passed the current block
lockedBreakdown = locks.filter(({ until }): boolean => bestNumber && until.gt(bestNumber));
lockedBreakdown = (locks as BalanceLockTo212[]).filter(({ until }): boolean => !until || (bestNumber && until.gt(bestNumber)));
const notAll = lockedBreakdown.filter(({ amount }): boolean => !amount.isMax());
@@ -34,11 +34,12 @@ function calcBalances (api: ApiInterfaceRx, [accountId, bestNumber, [freeBalance
}
// Calculate the vesting balances,
// - offset = balance locked at genesis,
// - offset = balance locked at startingBlock
// - perBlock is the unlock amount
const { offset: vestingTotal, perBlock } = vesting.unwrapOr(createType(api.registry, 'VestingSchedule'));
const vestedBalance = createType(api.registry, 'Balance', perBlock.mul(bestNumber));
const isVesting = vestedBalance.lt(vestingTotal);
const { locked: vestingTotal, perBlock, startingBlock } = vesting || createType(api.registry, 'VestingInfo');
const isStarted = bestNumber.gt(startingBlock);
const vestedBalance = createType(api.registry, 'Balance', isStarted ? perBlock.mul(bestNumber.sub(startingBlock)) : 0);
const isVesting = isStarted && vestedBalance.lt(vestingTotal);
// The available balance & vested has an interplay here
// "
@@ -56,16 +57,58 @@ function calcBalances (api: ApiInterfaceRx, [accountId, bestNumber, [freeBalance
accountNonce,
availableBalance,
freeBalance,
frozenFree,
frozenMisc,
isVesting,
lockedBalance,
lockedBreakdown,
reservedBalance,
vestedBalance,
vestingTotal,
votingBalance: createType(api.registry, 'Balance', freeBalance.add(reservedBalance))
votingBalance
};
}
// old
function queryOld (api: ApiInterfaceRx, accountId: AccountId): Observable<ResultBalance> {
return api.queryMulti<[Vec<BalanceLock>, Option<VestingSchedule>]>([
[api.query.balances.locks, accountId],
[api.query.balances.vesting, accountId]
]).pipe(
map(([locks, optVesting]): ResultBalance => {
let vestingNew = null;
if (optVesting.isSome) {
const { offset: locked, perBlock, startingBlock } = optVesting.unwrap();
vestingNew = createType(api.registry, 'VestingInfo', { locked, perBlock, startingBlock });
}
return [vestingNew, locks];
})
);
}
// current (balances vesting)
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<ResultBalance> {
return (
api.query.vesting.vesting
? api.queryMulti<[Vec<BalanceLock>, Option<VestingInfo>]>([
[api.query.balances.locks, accountId],
[api.query.vesting.vesting, accountId]
])
: api.query.balances.locks(accountId).pipe(
map((locks): [Vec<BalanceLock>, Option<VestingInfo>] =>
[locks, createType(api.registry, 'Option<VestingInfo>')]
)
)
).pipe(
map(([locks, optVesting]): ResultBalance =>
[optVesting.unwrapOr(null), locks]
)
);
}
/**
* @name all
* @param {( AccountIndex | AccountId | Address | string )} address - An accounts Id in different formats.
@@ -81,25 +124,21 @@ function calcBalances (api: ApiInterfaceRx, [accountId, bestNumber, [freeBalance
* });
* ```
*/
export function all (api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DerivedBalances> {
return memo((address: AccountIndex | AccountId | Address | string): Observable<DerivedBalances> =>
api.derive.accounts.info(address).pipe(
switchMap(({ accountId }): Observable<Result> =>
(accountId
export function all (api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DerivedBalancesAll> {
return memo((address: AccountIndex | AccountId | Address | string): Observable<DerivedBalancesAll> =>
api.derive.balances.account(address).pipe(
switchMap((account): Observable<Result> =>
(!account.accountId.isEmpty
? combineLatest([
of(accountId),
of(account),
api.derive.chain.bestNumber(),
api.queryMulti<[Balance, Balance, Vec<BalanceLock>, Option<VestingSchedule>, Index]>([
[api.query.balances.freeBalance, accountId],
[api.query.balances.reservedBalance, accountId],
[api.query.balances.locks, accountId],
[api.query.balances.vesting, accountId],
[api.query.system.accountNonce, accountId]
])
api.query.balances.account
? queryCurrent(api, account.accountId)
: queryOld(api, account.accountId)
])
: of([createType(api.registry, 'AccountId'), createType(api.registry, 'BlockNumber'), [createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), createType(api.registry, 'Vec<BalanceLock>'), createType(api.registry, 'Option<VestingSchedule>', null), createType(api.registry, 'Index')]])
: of([account, createType(api.registry, 'BlockNumber'), [null, createType(api.registry, 'Vec<BalanceLock>')]])
)
),
map((result): DerivedBalances => calcBalances(api, result))
map((result): DerivedBalancesAll => calcBalances(api, result))
));
}
+5 -7
View File
@@ -8,22 +8,20 @@ import { DerivedFees } from '../types';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { createType } from '@polkadot/types';
import { memo } from '../util';
type Result = [Balance, Balance, Balance, Balance, Balance];
function query (api: ApiInterfaceRx): Observable<Result> {
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,
api.consts.balances.existentialDeposit,
api.consts.balances.transferFee,
paymentBase.transactionBaseFee as Balance,
paymentBase.transactionByteFee as Balance
// deprecated - remove
(api.consts.balances.transferFee as Balance) || createType(api.registry, 'Balance'),
api.consts.transactionPayment.transactionBaseFee,
api.consts.transactionPayment.transactionByteFee
]);
}
@@ -4,6 +4,7 @@
import { all } from './all';
export * from './account';
export * from './fees';
export * from './votingBalances';
@@ -3,20 +3,20 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import { DerivedBalances } from '../types';
import { DerivedBalancesAccount } from '../types';
import { combineLatest, Observable, of } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { memo } from '../util';
export function votingBalances (api: ApiInterfaceRx): (addresses?: (AccountId | AccountIndex | Address | string)[]) => Observable<DerivedBalances[]> {
return memo((addresses?: (AccountId | AccountIndex | Address | string)[]): Observable<DerivedBalances[]> =>
export function votingBalances (api: ApiInterfaceRx): (addresses?: (AccountId | AccountIndex | Address | string)[]) => Observable<DerivedBalancesAccount[]> {
return memo((addresses?: (AccountId | AccountIndex | Address | string)[]): Observable<DerivedBalancesAccount[]> =>
!addresses || !addresses.length
? of([] as DerivedBalances[])
? of([] as DerivedBalancesAccount[])
: combineLatest(
addresses.map((accountId): Observable<DerivedBalances> =>
api.derive.balances.all(accountId))
addresses.map((accountId): Observable<DerivedBalancesAccount> =>
api.derive.balances.account(accountId))
)
);
}
+2 -1
View File
@@ -8,6 +8,7 @@ import { DerivedContractFees } from '../types';
import BN from 'bn.js';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { createType } from '@polkadot/types';
import { memo } from '../util';
@@ -39,7 +40,7 @@ function queryConstants (api: ApiInterfaceRx): Observable<ResultV2> {
api.consts.contracts.tombstoneDeposit,
api.consts.contracts.transactionBaseFee,
api.consts.contracts.transactionByteFee,
api.consts.contracts.transferFee
api.consts.contracts.transferFee || createType(api.registry, 'Balance')
]) as unknown as Observable<ResultV2>;
}
@@ -10,13 +10,13 @@ import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Vec, createType } from '@polkadot/types';
import { DerivedBalances, DerivedReferendumVote } from '../types';
import { DerivedBalancesAccount, DerivedReferendumVote } from '../types';
import { memo } from '../util';
export function referendumVotesFor (api: ApiInterfaceRx): (referendumId: BN | number) => Observable<DerivedReferendumVote[]> {
return memo((referendumId: BN | number): Observable<DerivedReferendumVote[]> =>
api.query.democracy.votersFor<Vec<AccountId>>(referendumId).pipe(
switchMap((votersFor): Observable<[Vec<AccountId>, Vote[], DerivedBalances[]]> =>
switchMap((votersFor): Observable<[Vec<AccountId>, Vote[], DerivedBalancesAccount[]]> =>
combineLatest([
of(votersFor),
api.derive.democracy.votes(referendumId, votersFor),
+11 -5
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, AccountIndex, Balance, BalanceLock, BalanceOf, Bid, BidKind, BlockNumber, EraIndex, EraPoints, Exposure, Hash, Index, Keys, Proposal, PropIndex, ProposalIndex, ReferendumInfo, RegistrationJudgement, RewardDestination, SessionIndex, SetIndex, SocietyVote, StakingLedger, StrikeCount, TreasuryProposal, ValidatorPrefs, Vote, Votes, VoteIndex, VouchingStatus } from '@polkadot/types/interfaces';
import { AccountId, AccountIndex, Balance, BalanceLock, BalanceLockTo212, BalanceOf, Bid, BidKind, BlockNumber, EraIndex, EraPoints, Exposure, Hash, Index, Keys, Proposal, PropIndex, ProposalIndex, ReferendumInfo, RegistrationJudgement, RewardDestination, SessionIndex, SetIndex, SocietyVote, StakingLedger, StrikeCount, TreasuryProposal, ValidatorPrefs, Vote, Votes, VoteIndex, VouchingStatus } from '@polkadot/types/interfaces';
import BN from 'bn.js';
import { u32, Vec } from '@polkadot/types';
@@ -30,21 +30,27 @@ export interface DeriveAccountInfo {
nickname?: string;
}
export interface DerivedBalances {
export interface DerivedBalancesAccount {
accountId: AccountId;
accountNonce: Index;
freeBalance: Balance;
frozenFree: Balance;
frozenMisc: Balance;
reservedBalance: Balance;
votingBalance: Balance;
}
export interface DerivedBalancesAll extends DerivedBalancesAccount {
isVesting: boolean;
lockedBalance: Balance;
lockedBreakdown: BalanceLock[];
lockedBreakdown: (BalanceLock | BalanceLockTo212)[];
availableBalance: Balance;
reservedBalance: Balance;
votingBalance: Balance;
vestedBalance: Balance;
vestingTotal: Balance;
}
export type DerivedBalancesMap = Record<string, DerivedBalances>;
export type DerivedBalancesMap = Record<string, DerivedBalancesAll>;
export interface DerivedContractFees {
callBaseFee: BN;
-8
View File
@@ -42,10 +42,6 @@ declare module '@polkadot/metadata/Decorated/types' {
* The minimum amount required to keep an account open.
**/
existentialDeposit: AugmentedConst<Balance>;
/**
* The fee required to make a transfer.
**/
transferFee: AugmentedConst<Balance>;
/**
* The fee required to create an account.
**/
@@ -205,10 +201,6 @@ declare module '@polkadot/metadata/Decorated/types' {
* to removal of a contract.
**/
surchargeReward: AugmentedConst<BalanceOf>;
/**
* The fee required to make a transfer.
**/
transferFee: AugmentedConst<BalanceOf>;
/**
* The fee required to create an account.
**/
+30 -28
View File
@@ -7,7 +7,7 @@ import { Bytes, Data, bool, u32, u64 } from '@polkadot/types';
import { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, Hash, Index, KeyTypeId, Moment, Perbill, ValidatorId, Weight } from '@polkadot/types/interfaces/runtime';
import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import { BabeAuthorityWeight, MaybeVrf } from '@polkadot/types/interfaces/babe';
import { BalanceLock, VestingSchedule } from '@polkadot/types/interfaces/balances';
import { AccountData, BalanceLock } from '@polkadot/types/interfaces/balances';
import { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
import { CodeHash, ContractInfo, Gas, PrefabWasmModule, Schedule } from '@polkadot/types/interfaces/contracts';
@@ -25,6 +25,7 @@ import { DigestOf, EventIndex, EventRecord } from '@polkadot/types/interfaces/sy
import { OpenTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
import { Multisig } from '@polkadot/types/interfaces/utility';
import { VestingInfo } from '@polkadot/types/interfaces/vesting';
import { AnyNumber, ITuple } from '@polkadot/types/types';
declare module '@polkadot/api/types/storage' {
@@ -193,36 +194,21 @@ declare module '@polkadot/api/types/storage' {
**/
totalIssuance: AugmentedQuery<ApiType, () => Observable<Balance>> & QueryableStorageEntry<ApiType>;
/**
* Information regarding the vesting of a given account.
* The balance of an account.
* NOTE: THIS MAY NEVER BE IN EXISTENCE AND YET HAVE A `total().is_zero()`. If the total
* is ever zero, then the entry *MUST* be removed.
**/
vesting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<VestingSchedule>>> & QueryableStorageEntry<ApiType>;
/**
* The 'free' balance of a given account.
* This is the only balance that matters in terms of most operations on tokens. It
* alone is used to determine the balance when in the contract execution environment. When this
* balance falls below the value of `ExistentialDeposit`, then the 'current account' is
* deleted: specifically `FreeBalance`. Further, the `OnFreeBalanceZero` callback
* is invoked, giving a chance to external modules to clean up data associated with
* the deleted account.
* `frame_system::AccountNonce` is also deleted if `ReservedBalance` is also zero (it also gets
* collapsed to zero if it ever becomes less than `ExistentialDeposit`.
**/
freeBalance: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Balance>> & QueryableStorageEntry<ApiType>;
/**
* The amount of the balance of a given account that is externally reserved; this can still get
* slashed, but gets slashed last of all.
* This balance is a 'reserve' balance that other subsystems use in order to set aside tokens
* that are still 'owned' by the account holder, but which are suspendable.
* When this balance falls below the value of `ExistentialDeposit`, then this 'reserve account'
* is deleted: specifically, `ReservedBalance`.
* `frame_system::AccountNonce` is also deleted if `FreeBalance` is also zero (it also gets
* collapsed to zero if it ever becomes less than `ExistentialDeposit`.)
**/
reservedBalance: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Balance>> & QueryableStorageEntry<ApiType>;
account: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<AccountData>> & QueryableStorageEntry<ApiType>;
/**
* Any liquidity locks on some account balances.
* NOTE: Should only be accessed when setting, changing and freeing a lock.
**/
locks: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Vec<BalanceLock>>> & QueryableStorageEntry<ApiType>;
/**
* True if network has been upgraded to this version.
* True for new networks.
**/
isUpgraded: AugmentedQuery<ApiType, () => Observable<bool>> & QueryableStorageEntry<ApiType>;
};
transactionPayment: {
[index: string]: QueryableStorageEntry<ApiType>;
@@ -440,6 +426,11 @@ declare module '@polkadot/api/types/storage' {
* Get the account (and lock periods) to which another account is delegating vote.
**/
delegations: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[AccountId, Conviction]>>> & QueryableStorageEntry<ApiType>;
/**
* Accounts for which there are locks in action which may be removed at some point in the
* future. The value is the block number at which the lock expires and may be removed.
**/
locks: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<BlockNumber>>> & QueryableStorageEntry<ApiType>;
/**
* True if the last referendum tabled was submitted externally. False if it was a public
* proposal.
@@ -644,9 +635,13 @@ declare module '@polkadot/api/types/storage' {
imOnline: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The block number when we should gossip.
* The block number after which it's ok to send heartbeats in current session.
* At the beginning of each session we set this to a value that should
* fall roughly in the middle of the session duration.
* The idea is to first wait for the validators to produce a block
* in the current session, so that the heartbeat later on will not be necessary.
**/
gossipAt: AugmentedQuery<ApiType, () => Observable<BlockNumber>> & QueryableStorageEntry<ApiType>;
heartbeatAfter: AugmentedQuery<ApiType, () => Observable<BlockNumber>> & QueryableStorageEntry<ApiType>;
/**
* The current set of keys that may issue a heartbeat.
**/
@@ -798,5 +793,12 @@ declare module '@polkadot/api/types/storage' {
**/
recovered: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
};
vesting: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* Information regarding the vesting of a given account.
**/
vesting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<VestingInfo>>> & QueryableStorageEntry<ApiType>;
};
}
}
+35 -4
View File
@@ -211,8 +211,7 @@ declare module '@polkadot/api/types/submittable' {
* - `ensure_can_withdraw` is always called internally but has a bounded complexity.
* - Transferring balances to accounts that did not exist before will cause
* `T::OnNewAccount::on_new_account` to be called.
* - Removing enough funds from an account will trigger
* `T::DustRemoval::on_unbalanced` and `T::OnFreeBalanceZero::on_free_balance_zero`.
* - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced`.
* - `transfer_keep_alive` works the same way as `transfer`, but has an additional
* check that the transfer will not kill the origin account.
* # </weight>
@@ -570,6 +569,7 @@ declare module '@polkadot/api/types/submittable' {
* work an additional `EnactmentPeriod` later.
**/
reapPreimage: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
unlock: AugmentedSubmittable<(target: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
council: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
@@ -970,9 +970,9 @@ declare module '@polkadot/api/types/submittable' {
* - `info`: The identity information.
* Emits `IdentitySet` if successful.
* # <weight>
* - `O(X + R)` where `X` additional-field-count (deposit-bounded).
* - `O(X + X' + R)` where `X` additional-field-count (deposit-bounded and code-bounded).
* - At most two balance operations.
* - One storage mutation (codec `O(X + R)`).
* - One storage mutation (codec-read `O(X' + R)`, codec-write `O(X + R)`).
* - One event.
* # </weight>
**/
@@ -1528,5 +1528,36 @@ declare module '@polkadot/api/types/submittable' {
**/
removeRecovery: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
};
vesting: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Unlock any vested funds of the sender account.
* The dispatch origin for this call must be _Signed_ and the sender must have funds still
* locked under this module.
* Emits either `VestingCompleted` or `VestingUpdated`.
* # <weight>
* - `O(1)`.
* - One balance-lock operation.
* - One storage read (codec `O(1)`) and up to one removal.
* - One event.
* # </weight>
**/
vest: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
/**
* Unlock any vested funds of a `target` account.
* The dispatch origin for this call must be _Signed_.
* - `target`: The account whose vested funds should be unlocked. Must have funds still
* locked under this module.
* Emits either `VestingCompleted` or `VestingUpdated`.
* # <weight>
* - `O(1)`.
* - Up to one account lookup.
* - One balance-lock operation.
* - One storage read (codec `O(1)`) and up to one removal.
* - One event.
* # </weight>
**/
vestOther: AugmentedSubmittable<(target: Address | string | AccountId | AccountIndex | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
}
}
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { ClassOf, createType, TypeRegistry } from '@polkadot/types/codec/create';
import { hexToU8a } from '@polkadot/util';
import { u8aToHex } from '@polkadot/util';
import Decorated from './Decorated';
import json from '../Metadata/static';
@@ -12,15 +12,13 @@ const registry = new TypeRegistry();
const decorated = new Decorated(registry, json);
describe('Decorated', () => {
it('should correctly get Alice\'s freeBalance storage key (u8a)', (): void => {
it('should correctly get Alice\'s nonce storage key (u8a)', (): void => {
expect(
decorated.query
.balances
.freeBalance('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY')
).toEqual(
hexToU8a(
'0x0101c2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b42e3fb4c297a84c5cebc0e78257d213d0927ccc7596044c6ba013dd05522aacba'
u8aToHex(
decorated.query.system.accountNonce('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY')
)
).toEqual(
'0x010126aa394eea5630e07c48ae0c9558cef79c2f82b23e5fd031fb54c292794b4cc42e3fb4c297a84c5cebc0e78257d213d0927ccc7596044c6ba013dd05522aacba'
);
});
@@ -18,7 +18,7 @@ describe('fromMetadata', (): void => {
const decorated = new Decorated(registry, rpcMetadata);
it('should throw if the storage function expects an argument', (): void => {
expect((): any => decorated.query.balances.freeBalance()).toThrowError(/requires one argument/);
expect((): any => decorated.query.balances.account()).toThrowError(/requires one argument/);
});
it('should return a value if the storage function does not expect an argument', (): void => {
@@ -28,11 +28,11 @@ describe('fromMetadata', (): void => {
it('should return the correct length-prefixed storage key', (): void => {
expect(
u8aToHex(
decorated.query.balances.freeBalance(keyring.alice.address)
decorated.query.system.accountNonce(keyring.alice.address)
)
).toEqual(
// new storage key format
'0x0101c2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b42e3fb4c297a84c5cebc0e78257d213d0927ccc7596044c6ba013dd05522aacba'
'0x010126aa394eea5630e07c48ae0c9558cef79c2f82b23e5fd031fb54c292794b4cc42e3fb4c297a84c5cebc0e78257d213d0927ccc7596044c6ba013dd05522aacba'
);
});
});
@@ -1133,71 +1133,22 @@
]
},
{
"name": "Vesting",
"modifier": "optional",
"type": {
"Map": {
"hasher": "blake2256",
"key": "AccountId",
"value": "VestingSchedule",
"linked": false
}
},
"fallback": "0x00",
"documentation": [
" Information regarding the vesting of a given account."
]
},
{
"name": "FreeBalance",
"name": "Account",
"modifier": "default",
"type": {
"Map": {
"hasher": "blake2256",
"key": "AccountId",
"value": "Balance",
"value": "AccountData",
"linked": false
}
},
"fallback": "0x00000000000000000000000000000000",
"fallback": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"documentation": [
" The 'free' balance of a given account.",
" The balance of an account.",
"",
" This is the only balance that matters in terms of most operations on tokens. It",
" alone is used to determine the balance when in the contract execution environment. When this",
" balance falls below the value of `ExistentialDeposit`, then the 'current account' is",
" deleted: specifically `FreeBalance`. Further, the `OnFreeBalanceZero` callback",
" is invoked, giving a chance to external modules to clean up data associated with",
" the deleted account.",
"",
" `frame_system::AccountNonce` is also deleted if `ReservedBalance` is also zero (it also gets",
" collapsed to zero if it ever becomes less than `ExistentialDeposit`."
]
},
{
"name": "ReservedBalance",
"modifier": "default",
"type": {
"Map": {
"hasher": "blake2256",
"key": "AccountId",
"value": "Balance",
"linked": false
}
},
"fallback": "0x00000000000000000000000000000000",
"documentation": [
" The amount of the balance of a given account that is externally reserved; this can still get",
" slashed, but gets slashed last of all.",
"",
" This balance is a 'reserve' balance that other subsystems use in order to set aside tokens",
" that are still 'owned' by the account holder, but which are suspendable.",
"",
" When this balance falls below the value of `ExistentialDeposit`, then this 'reserve account'",
" is deleted: specifically, `ReservedBalance`.",
"",
" `frame_system::AccountNonce` is also deleted if `FreeBalance` is also zero (it also gets",
" collapsed to zero if it ever becomes less than `ExistentialDeposit`.)"
" NOTE: THIS MAY NEVER BE IN EXISTENCE AND YET HAVE A `total().is_zero()`. If the total",
" is ever zero, then the entry *MUST* be removed."
]
},
{
@@ -1213,7 +1164,21 @@
},
"fallback": "0x00",
"documentation": [
" Any liquidity locks on some account balances."
" Any liquidity locks on some account balances.",
" NOTE: Should only be accessed when setting, changing and freeing a lock."
]
},
{
"name": "IsUpgraded",
"modifier": "default",
"type": {
"Plain": "bool"
},
"fallback": "0x00",
"documentation": [
" True if network has been upgraded to this version.",
"",
" True for new networks."
]
}
]
@@ -1251,8 +1216,7 @@
" - `ensure_can_withdraw` is always called internally but has a bounded complexity.",
" - Transferring balances to accounts that did not exist before will cause",
" `T::OnNewAccount::on_new_account` to be called.",
" - Removing enough funds from an account will trigger",
" `T::DustRemoval::on_unbalanced` and `T::OnFreeBalanceZero::on_free_balance_zero`.",
" - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced`.",
" - `transfer_keep_alive` works the same way as `transfer`, but has an additional",
" check that the transfer will not kill the origin account.",
"",
@@ -1398,14 +1362,6 @@
" The minimum amount required to keep an account open."
]
},
{
"name": "TransferFee",
"type": "Balance",
"value": "0x0010a5d4e80000000000000000000000",
"documentation": [
" The fee required to make a transfer."
]
},
{
"name": "CreationFee",
"type": "Balance",
@@ -2669,6 +2625,23 @@
" Get the account (and lock periods) to which another account is delegating vote."
]
},
{
"name": "Locks",
"modifier": "optional",
"type": {
"Map": {
"hasher": "blake2256",
"key": "AccountId",
"value": "BlockNumber",
"linked": false
}
},
"fallback": "0x00",
"documentation": [
" Accounts for which there are locks in action which may be removed at some point in the",
" future. The value is the block number at which the lock expires and may be removed."
]
},
{
"name": "LastTabledWasExternal",
"modifier": "default",
@@ -3057,6 +3030,16 @@
" noted, if it's the same account doing it. If it's a different account, then it'll only",
" work an additional `EnactmentPeriod` later."
]
},
{
"name": "unlock",
"args": [
{
"name": "target",
"type": "AccountId"
}
],
"documentation": []
}
],
"events": [
@@ -3218,6 +3201,15 @@
"documentation": [
" A registered preimage was removed and the deposit collected by the reaper (last item)."
]
},
{
"name": "Unlocked",
"args": [
"AccountId"
],
"documentation": [
" An account has been unlocked successfully."
]
}
],
"constants": [
@@ -3414,6 +3406,18 @@
"documentation": [
" No proposals waiting"
]
},
{
"name": "NotLocked",
"documentation": [
" The target account does not have a lock."
]
},
{
"name": "NotExpired",
"documentation": [
" The lock on the account to be unlocked has not yet expired."
]
}
]
},
@@ -5209,7 +5213,7 @@
"type": {
"Plain": "Schedule"
},
"fallback": "0x0000000001000000000000000100000000000000010000000000000001000000000000000100000000000000010000000000000001000000000000008700000000000000af0000000000000001000000000000000100000000000000040000000000010010000000004000000020000000",
"fallback": "0x0000000001000000000000000100000000000000010000000000000001000000000000000100000000000000010000000000000001000000000000008700000000000000af00000000000000010000000000000001000000000000006400000000000000040000000000010010000000004000000020000000",
"documentation": [
" Current cost schedule for contracts."
]
@@ -5560,14 +5564,6 @@
" to removal of a contract."
]
},
{
"name": "TransferFee",
"type": "BalanceOf",
"value": "0x0010a5d4e80000000000000000000000",
"documentation": [
" The fee required to make a transfer."
]
},
{
"name": "CreationFee",
"type": "BalanceOf",
@@ -5817,14 +5813,19 @@
"prefix": "ImOnline",
"items": [
{
"name": "GossipAt",
"name": "HeartbeatAfter",
"modifier": "default",
"type": {
"Plain": "BlockNumber"
},
"fallback": "0x00000000",
"documentation": [
" The block number when we should gossip."
" The block number after which it's ok to send heartbeats in current session.",
"",
" At the beginning of each session we set this to a value that should",
" fall roughly in the middle of the session duration.",
" The idea is to first wait for the validators to produce a block",
" in the current session, so that the heartbeat later on will not be necessary."
]
},
{
@@ -6165,9 +6166,9 @@
" Emits `IdentitySet` if successful.",
"",
" # <weight>",
" - `O(X + R)` where `X` additional-field-count (deposit-bounded).",
" - `O(X + X' + R)` where `X` additional-field-count (deposit-bounded and code-bounded).",
" - At most two balance operations.",
" - One storage mutation (codec `O(X + R)`).",
" - One storage mutation (codec-read `O(X' + R)`, codec-write `O(X + R)`).",
" - One event.",
" # </weight>"
]
@@ -6573,6 +6574,12 @@
"documentation": [
" The target is invalid."
]
},
{
"name": "TooManyFields",
"documentation": [
" Too many additional fields."
]
}
]
},
@@ -8021,6 +8028,115 @@
]
}
]
},
{
"name": "Vesting",
"storage": {
"prefix": "Vesting",
"items": [
{
"name": "Vesting",
"modifier": "optional",
"type": {
"Map": {
"hasher": "blake2256",
"key": "AccountId",
"value": "VestingInfo",
"linked": false
}
},
"fallback": "0x00",
"documentation": [
" Information regarding the vesting of a given account."
]
}
]
},
"calls": [
{
"name": "vest",
"args": [],
"documentation": [
" Unlock any vested funds of the sender account.",
"",
" The dispatch origin for this call must be _Signed_ and the sender must have funds still",
" locked under this module.",
"",
" Emits either `VestingCompleted` or `VestingUpdated`.",
"",
" # <weight>",
" - `O(1)`.",
" - One balance-lock operation.",
" - One storage read (codec `O(1)`) and up to one removal.",
" - One event.",
" # </weight>"
]
},
{
"name": "vest_other",
"args": [
{
"name": "target",
"type": "Address"
}
],
"documentation": [
" Unlock any vested funds of a `target` account.",
"",
" The dispatch origin for this call must be _Signed_.",
"",
" - `target`: The account whose vested funds should be unlocked. Must have funds still",
" locked under this module.",
"",
" Emits either `VestingCompleted` or `VestingUpdated`.",
"",
" # <weight>",
" - `O(1)`.",
" - Up to one account lookup.",
" - One balance-lock operation.",
" - One storage read (codec `O(1)`) and up to one removal.",
" - One event.",
" # </weight>"
]
}
],
"events": [
{
"name": "VestingUpdated",
"args": [
"AccountId",
"Balance"
],
"documentation": [
" The amount vested has been updated. This could indicate more funds are available. The",
" balance given is the amount which is left unvested (and thus locked)."
]
},
{
"name": "VestingCompleted",
"args": [
"AccountId"
],
"documentation": [
" An account (given) has become fully vested. No further vesting can happen."
]
}
],
"constants": [],
"errors": [
{
"name": "NotVesting",
"documentation": [
" The account given is not vesting."
]
},
{
"name": "ExistingVestingSchedule",
"documentation": [
" An existing vesting schedule already exists for this account that cannot be clobbered."
]
}
]
}
],
"extrinsic": {
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -176,7 +176,7 @@ export default class Mock implements ProviderInterface {
// increment the balances and nonce for each account
keyring.getPairs().forEach(({ publicKey }, index): void => {
this.setStateBn(metadata.query.balances.freeBalance(publicKey), newHead.number.toBn().muln(3).iaddn(index));
// this.setStateBn(metadata.query.balances.freeBalance(publicKey), newHead.number.toBn().muln(3).iaddn(index));
this.setStateBn(metadata.query.system.accountNonce(publicKey), newHead.number.toBn().addn(index));
});
+18 -2
View File
@@ -7,10 +7,10 @@ import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, Balanc
import { InclusionHeight, Uncle, UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import { RawAuraPreDigest } from '@polkadot/types/interfaces/aura';
import { BabeAuthorityWeight, BabeBlockWeight, BabeWeight, MaybeVrf, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondary, RawBabePreDigestSecondaryTo159, RawBabePreDigestTo159, SlotNumber, VrfData, VrfProof } from '@polkadot/types/interfaces/babe';
import { BalanceLock, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances';
import { AccountData, BalanceLock, BalanceLockTo212, Reasons, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances';
import { MemberCount, ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
import { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultSuccess, ContractInfo, ContractStorageKey, Gas, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
import { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultSuccess, ContractInfo, ContractStorageKey, Gas, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
import { Conviction, PropIndex, Proposal, ReferendumIndex, ReferendumInfo } from '@polkadot/types/interfaces/democracy';
import { AccountInfo, Amount, AssetOf, InherentOfflineReport, LockPeriods, NewAccountOutcome, OpaqueKey, SessionKey } from '@polkadot/types/interfaces/deprecated';
import { ApprovalFlag, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
@@ -28,6 +28,7 @@ import { DigestOf, DispatchError, DispatchErrorModule, DispatchErrorTo198, Dispa
import { OpenTip, OpenTipFinder, OpenTipTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
import { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
import { VestingInfo } from '@polkadot/types/interfaces/vesting';
import { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations';
import { EthereumAddress } from '@polkadot/types/interfaces/claims';
import { AttestedCandidate, AuctionIndex, BalanceUpload, Bidder, CandidateReceipt, CollatorId, CollatorSignature, EgressQueueRoot, HeadData, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, LeasePeriod, LeasePeriodOf, NewBidder, ParaId, ParaIdOf, ParaInfo, ParaScheduling, ParachainDispatchOrigin, Retriable, SlotRange, SubId, UpwardMessage, ValidatorIndex, ValidityAttestation, ValidityVote, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
@@ -393,9 +394,18 @@ export interface InterfaceRegistry {
VrfProof: VrfProof;
'Option<VrfProof>': Option<VrfProof>;
'Vec<VrfProof>': Vec<VrfProof>;
AccountData: AccountData;
'Option<AccountData>': Option<AccountData>;
'Vec<AccountData>': Vec<AccountData>;
BalanceLockTo212: BalanceLockTo212;
'Option<BalanceLockTo212>': Option<BalanceLockTo212>;
'Vec<BalanceLockTo212>': Vec<BalanceLockTo212>;
BalanceLock: BalanceLock;
'Option<BalanceLock>': Option<BalanceLock>;
'Vec<BalanceLock>': Vec<BalanceLock>;
Reasons: Reasons;
'Option<Reasons>': Option<Reasons>;
'Vec<Reasons>': Vec<Reasons>;
VestingSchedule: VestingSchedule;
'Option<VestingSchedule>': Option<VestingSchedule>;
'Vec<VestingSchedule>': Vec<VestingSchedule>;
@@ -447,6 +457,9 @@ export interface InterfaceRegistry {
PrefabWasmModuleReserved: PrefabWasmModuleReserved;
'Option<PrefabWasmModuleReserved>': Option<PrefabWasmModuleReserved>;
'Vec<PrefabWasmModuleReserved>': Vec<PrefabWasmModuleReserved>;
ScheduleTo212: ScheduleTo212;
'Option<ScheduleTo212>': Option<ScheduleTo212>;
'Vec<ScheduleTo212>': Vec<ScheduleTo212>;
Schedule: Schedule;
'Option<Schedule>': Option<Schedule>;
'Vec<Schedule>': Vec<Schedule>;
@@ -824,6 +837,9 @@ export interface InterfaceRegistry {
Multisig: Multisig;
'Option<Multisig>': Option<Multisig>;
'Vec<Multisig>': Vec<Multisig>;
VestingInfo: VestingInfo;
'Option<VestingInfo>': Option<VestingInfo>;
'Vec<VestingInfo>': Vec<VestingInfo>;
BlockAttestations: BlockAttestations;
'Option<BlockAttestations>': Option<BlockAttestations>;
'Vec<BlockAttestations>': Vec<BlockAttestations>;
@@ -4,12 +4,26 @@
export default {
types: {
BalanceLock: {
AccountData: {
free: 'Balance',
reserved: 'Balance',
miscFrozen: 'Balance',
feeFrozen: 'Balance'
},
BalanceLockTo212: {
id: 'LockIdentifier',
amount: 'Balance',
until: 'BlockNumber',
reasons: 'WithdrawReasons'
},
BalanceLock: {
id: 'LockIdentifier',
amount: 'Balance',
reasons: 'Reasons'
},
Reasons: {
_enum: ['Fee', 'Misc', 'All']
},
VestingSchedule: {
offset: 'Balance',
perBlock: 'Balance',
@@ -1,17 +1,39 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { Set, Struct } from '@polkadot/types/codec';
import { Enum, Set, Struct } from '@polkadot/types/codec';
import { Balance, BlockNumber, LockIdentifier } from '@polkadot/types/interfaces/runtime';
/** @name AccountData */
export interface AccountData extends Struct {
readonly free: Balance;
readonly reserved: Balance;
readonly miscFrozen: Balance;
readonly feeFrozen: Balance;
}
/** @name BalanceLock */
export interface BalanceLock extends Struct {
readonly id: LockIdentifier;
readonly amount: Balance;
readonly reasons: Reasons;
}
/** @name BalanceLockTo212 */
export interface BalanceLockTo212 extends Struct {
readonly id: LockIdentifier;
readonly amount: Balance;
readonly until: BlockNumber;
readonly reasons: WithdrawReasons;
}
/** @name Reasons */
export interface Reasons extends Enum {
readonly isFee: boolean;
readonly isMisc: boolean;
readonly isAll: boolean;
}
/** @name VestingSchedule */
export interface VestingSchedule extends Struct {
readonly offset: Balance;
@@ -46,7 +46,7 @@ export default {
code: 'Bytes'
},
PrefabWasmModuleReserved: 'Option<Null>',
Schedule: {
ScheduleTo212: {
version: 'u32',
putCodePerByteCost: 'Gas',
growMemCost: 'Gas',
@@ -63,6 +63,24 @@ export default {
enablePrintln: 'bool',
maxSubjectLen: 'u32'
},
Schedule: {
version: 'u32',
putCodePerByteCost: 'Gas',
growMemCost: 'Gas',
regularOpCost: 'Gas',
returnDataPerByteCost: 'Gas',
eventDataPerByteCost: 'Gas',
eventPerTopicCost: 'Gas',
eventBaseCost: 'Gas',
sandboxDataReadCost: 'Gas',
sandboxDataWriteCost: 'Gas',
transferCost: 'Gas',
maxEventTopics: 'u32',
maxStackHeight: 'u32',
maxMemoryPages: 'u32',
enablePrintln: 'bool',
maxSubjectLen: 'u32'
},
SeedOf: 'Hash',
TombstoneContractInfo: 'Hash',
TrieId: 'Bytes'
@@ -69,6 +69,26 @@ export interface PrefabWasmModuleReserved extends Option<Null> {}
/** @name Schedule */
export interface Schedule extends Struct {
readonly version: u32;
readonly putCodePerByteCost: Gas;
readonly growMemCost: Gas;
readonly regularOpCost: Gas;
readonly returnDataPerByteCost: Gas;
readonly eventDataPerByteCost: Gas;
readonly eventPerTopicCost: Gas;
readonly eventBaseCost: Gas;
readonly sandboxDataReadCost: Gas;
readonly sandboxDataWriteCost: Gas;
readonly transferCost: Gas;
readonly maxEventTopics: u32;
readonly maxStackHeight: u32;
readonly maxMemoryPages: u32;
readonly enablePrintln: bool;
readonly maxSubjectLen: u32;
}
/** @name ScheduleTo212 */
export interface ScheduleTo212 extends Struct {
readonly version: u32;
readonly putCodePerByteCost: Gas;
readonly growMemCost: Gas;
@@ -30,6 +30,7 @@ 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';
export { default as vesting } from './vesting/definitions';
// polkadot-specific types
export { default as attestations } from './attestations/definitions';
+1
View File
@@ -26,6 +26,7 @@ export * from './system/types';
export * from './treasury/types';
export * from './txpayment/types';
export * from './utility/types';
export * from './vesting/types';
export * from './attestations/types';
export * from './claims/types';
export * from './parachains/types';
@@ -0,0 +1,13 @@
// Copyright 2017-2020 @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: {
VestingInfo: {
locked: 'Balance',
perBlock: 'Balance',
startingBlock: 'BlockNumber'
}
}
};
@@ -0,0 +1,4 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
export * from './types';
@@ -0,0 +1,12 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { Struct } from '@polkadot/types/codec';
import { Balance, BlockNumber } from '@polkadot/types/interfaces/runtime';
/** @name VestingInfo */
export interface VestingInfo extends Struct {
readonly locked: Balance;
readonly perBlock: Balance;
readonly startingBlock: BlockNumber;
}
+3
View File
@@ -38,6 +38,7 @@ const TYPES_KUSAMA_VERSIONED: OverrideVersionedType[] = [
{
minmax: [1019, 1031],
types: {
BalanceLock: 'BalanceLockTo212',
DispatchError: 'DispatchErrorTo198',
Keys: 'SessionKeys5',
SlashingSpans: 'SlashingSpansTo204'
@@ -46,6 +47,7 @@ const TYPES_KUSAMA_VERSIONED: OverrideVersionedType[] = [
{
minmax: [1032, 1042],
types: {
BalanceLock: 'BalanceLockTo212',
Keys: 'SessionKeys5',
SlashingSpans: 'SlashingSpansTo204'
}
@@ -53,6 +55,7 @@ const TYPES_KUSAMA_VERSIONED: OverrideVersionedType[] = [
{
minmax: [1043, undefined],
types: {
BalanceLock: 'BalanceLockTo212',
Keys: 'SessionKeys5'
}
}