Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# CHANGELOG

## 4.1.1 Mar 15, 2021

Upgrade priority: Low. Recommended when tracking the latest updates from Substrate.

Changes:

- Fix author extraction for last block in a session
- Expand `SignerPayload` to inject/expose custom signed extensions
- `ConsensusEngineId` formats non-Ascii engines correctly
- Cleanup `RpcCore` augmentation (removing TS warnings on typegen chains)
- Add upgrade block for Kusama 2029
- Ensure that type alias overrides also apply to map keys
- check type generation against fallbacks (build-time only sanity check)
- Align types with latest substrate master
- Apply latest Polkadot auctions/crowdloan/parachains/slots types


## 4.0.3 Mar 8, 2021

Upgrade priority: Low. Recommended if you use the API to sync the full chain, most notably Polkadot.
Expand Down
24 changes: 10 additions & 14 deletions packages/api/src/augment/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,10 @@ declare module '@polkadot/api/types/errors' {
export interface AugmentedErrors<ApiType> {
assets: {
[key: string]: AugmentedError<ApiType>;
/**
* Transfer amount should be non-zero.
**/
AmountZero: AugmentedError<ApiType>;
/**
* Invalid metadata given.
**/
BadMetadata: AugmentedError<ApiType>;
/**
* Some internal state is broken.
**/
BadState: AugmentedError<ApiType>;
/**
* Invalid witness data given.
**/
Expand Down Expand Up @@ -48,21 +40,25 @@ declare module '@polkadot/api/types/errors' {
**/
NoPermission: AugmentedError<ApiType>;
/**
* A mint operation lead to an overflow.
* No provider reference exists to allow a non-zero balance of a non-self-sufficient asset.
**/
Overflow: AugmentedError<ApiType>;
NoProvider: AugmentedError<ApiType>;
/**
* Attempt to destroy an asset class when non-zombie, reference-bearing accounts exist.
* A mint operation lead to an overflow.
**/
RefsLeft: AugmentedError<ApiType>;
Overflow: AugmentedError<ApiType>;
/**
* Too many zombie accounts in use.
* No approval exists that would allow the transfer.
**/
TooManyZombies: AugmentedError<ApiType>;
Unapproved: AugmentedError<ApiType>;
/**
* The given asset ID is unknown.
**/
Unknown: AugmentedError<ApiType>;
/**
* The source account would not survive the transfer and it needs to stay alive.
**/
WouldDie: AugmentedError<ApiType>;
};
authorship: {
[key: string]: AugmentedError<ApiType>;
Expand Down
33 changes: 25 additions & 8 deletions packages/api/src/augment/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,25 @@ declare module '@polkadot/api/types/events' {
export interface AugmentedEvents<ApiType> {
assets: {
[key: string]: AugmentedEvent<ApiType>;
/**
* An approval for account `delegate` was cancelled by `owner`.
* \[id, owner, delegate\]
**/
ApprovalCancelled: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId]>;
/**
* (Additional) funds have been approved for transfer to a destination account.
* \[asset_id, source, delegate, amount\]
**/
ApprovedTransfer: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, TAssetBalance]>;
/**
* Some asset `asset_id` was frozen. \[asset_id\]
**/
AssetFrozen: AugmentedEvent<ApiType, [AssetId]>;
/**
* An asset has had its attributes changed by the `Force` origin.
* \[id\]
**/
AssetStatusChanged: AugmentedEvent<ApiType, [AssetId]>;
/**
* Some asset `asset_id` was thawed. \[asset_id\]
**/
Expand All @@ -52,10 +67,6 @@ declare module '@polkadot/api/types/events' {
* Some asset class was force-created. \[asset_id, owner\]
**/
ForceCreated: AugmentedEvent<ApiType, [AssetId, AccountId]>;
/**
* Some assets was transferred by an admin. \[asset_id, from, to, amount\]
**/
ForceTransferred: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, TAssetBalance]>;
/**
* Some account `who` was frozen. \[asset_id, who\]
**/
Expand All @@ -65,13 +76,13 @@ declare module '@polkadot/api/types/events' {
**/
Issued: AugmentedEvent<ApiType, [AssetId, AccountId, TAssetBalance]>;
/**
* The maximum amount of zombies allowed has changed. \[asset_id, max_zombies\]
* Metadata has been cleared for an asset. \[asset_id\]
**/
MaxZombiesChanged: AugmentedEvent<ApiType, [AssetId, u32]>;
MetadataCleared: AugmentedEvent<ApiType, [AssetId]>;
/**
* New metadata has been set for an asset. \[asset_id, name, symbol, decimals\]
* New metadata has been set for an asset. \[asset_id, name, symbol, decimals, is_frozen\]
**/
MetadataSet: AugmentedEvent<ApiType, [AssetId, Bytes, Bytes, u8]>;
MetadataSet: AugmentedEvent<ApiType, [AssetId, Bytes, Bytes, u8, bool]>;
/**
* The owner changed \[asset_id, owner\]
**/
Expand All @@ -88,6 +99,12 @@ declare module '@polkadot/api/types/events' {
* Some assets were transferred. \[asset_id, from, to, amount\]
**/
Transferred: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, TAssetBalance]>;
/**
* An `amount` was transferred in its entirety from `owner` to `destination` by
* the approved `delegate`.
* \[id, owner, delegate, destination\]
**/
TransferredApproved: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, AccountId, TAssetBalance]>;
};
balances: {
[key: string]: AugmentedEvent<ApiType>;
Expand Down
45 changes: 36 additions & 9 deletions packages/api/src/augment/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import type { Bytes, Data, Option, U8aFixed, Vec, bool, u32, u64 } from '@polkadot/types';
import type { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
import type { AssetBalance, AssetDetails, AssetMetadata } from '@polkadot/types/interfaces/assets';
import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDetails, AssetMetadata } from '@polkadot/types/interfaces/assets';
import type { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import type { BabeAuthorityWeight, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe';
import type { BabeAuthorityWeight, BabeEpochConfiguration, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe';
import type { AccountData, BalanceLock } from '@polkadot/types/interfaces/balances';
import type { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
Expand Down Expand Up @@ -40,6 +40,11 @@ declare module '@polkadot/api/types/storage' {
* The number of units of assets held by any given account.
**/
account: AugmentedQueryDoubleMap<ApiType, (key1: AssetId | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<AssetBalance>, [AssetId, AccountId]> & QueryableStorageEntry<ApiType, [AssetId, AccountId]>;
/**
* Approved balance transfers. First balance is the amount approved for transfer. Second
* is the amount of `T::Currency` reserved for storing this.
**/
approvals: AugmentedQueryDoubleMap<ApiType, (key1: AssetId | AnyNumber | Uint8Array, key2: AssetApprovalKey | { owner?: any; delegate?: any } | string | Uint8Array) => Observable<Option<AssetApproval>>, [AssetId, AssetApprovalKey]> & QueryableStorageEntry<ApiType, [AssetId, AssetApprovalKey]>;
/**
* Details of an asset.
**/
Expand Down Expand Up @@ -80,10 +85,22 @@ declare module '@polkadot/api/types/storage' {
* Current slot number.
**/
currentSlot: AugmentedQuery<ApiType, () => Observable<Slot>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The configuration for the current epoch. Should never be `None` as it is initialized in genesis.
**/
epochConfig: AugmentedQuery<ApiType, () => Observable<Option<BabeEpochConfiguration>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Current epoch index.
**/
epochIndex: AugmentedQuery<ApiType, () => Observable<u64>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The block numbers when the last and current epoch have started, respectively `N-1` and
* `N`.
* NOTE: We track this is in order to annotate the block number when a given pool of
* entropy was fixed (i.e. it was known to chain observers). Since epochs are defined in
* slots, which may be skipped, the block numbers may not line up with the slot numbers.
**/
epochStart: AugmentedQuery<ApiType, () => Observable<ITuple<[BlockNumber, BlockNumber]>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The slot at which the first epoch actually started. This is 0
* until the first block of the chain.
Expand All @@ -107,13 +124,18 @@ declare module '@polkadot/api/types/storage' {
**/
nextAuthorities: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AuthorityId, BabeAuthorityWeight]>>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Next epoch configuration, if changed.
* The configuration for the next epoch, `None` if the config will not change
* (you can fallback to `EpochConfig` instead in that case).
**/
nextEpochConfig: AugmentedQuery<ApiType, () => Observable<Option<NextConfigDescriptor>>, []> & QueryableStorageEntry<ApiType, []>;
nextEpochConfig: AugmentedQuery<ApiType, () => Observable<Option<BabeEpochConfiguration>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Next epoch randomness.
**/
nextRandomness: AugmentedQuery<ApiType, () => Observable<Randomness>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Pending epoch configuration change that will be applied when the next epoch is enacted.
**/
pendingEpochConfigChange: AugmentedQuery<ApiType, () => Observable<Option<NextConfigDescriptor>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The epoch randomness for the *current* epoch.
*
Expand Down Expand Up @@ -488,12 +510,17 @@ declare module '@polkadot/api/types/storage' {
**/
authoredBlocks: AugmentedQueryDoubleMap<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: ValidatorId | string | Uint8Array) => Observable<u32>, [SessionIndex, ValidatorId]> & QueryableStorageEntry<ApiType, [SessionIndex, ValidatorId]>;
/**
* The block number after which it's ok to send heartbeats in current session.
* The block number after which it's ok to send heartbeats in the 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.
*
* 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.
* This value will only be used as a fallback if we fail to get a proper session
* progress estimate from `NextSessionRotation`, as those estimates should be
* more accurate then the value we calculate for `HeartbeatAfter`.
**/
heartbeatAfter: AugmentedQuery<ApiType, () => Observable<BlockNumber>, []> & QueryableStorageEntry<ApiType, []>;
/**
Expand Down
Loading