Adjust interfaces for cleaner esnext usage (#2833)

* Adjust interfaces for cleaner esnext usage

* Swap out esnext
This commit is contained in:
Jaco Greeff
2020-11-09 23:17:52 +01:00
committed by GitHub
parent 8993844739
commit e6dbbfae34
82 changed files with 242 additions and 348 deletions
+3 -3
View File
@@ -30,14 +30,14 @@
"dependencies": {
"@babel/runtime": "^7.12.1",
"@polkadot/api-derive": "2.6.2-1",
"@polkadot/keyring": "^4.0.2-5",
"@polkadot/keyring": "^4.0.2-7",
"@polkadot/metadata": "2.6.2-1",
"@polkadot/rpc-core": "2.6.2-1",
"@polkadot/rpc-provider": "2.6.2-1",
"@polkadot/types": "2.6.2-1",
"@polkadot/types-known": "2.6.2-1",
"@polkadot/util": "^4.0.2-5",
"@polkadot/util-crypto": "^4.0.2-5",
"@polkadot/util": "^4.0.2-7",
"@polkadot/util-crypto": "^4.0.2-7",
"bn.js": "^5.1.3",
"eventemitter3": "^4.0.7",
"rxjs": "^6.6.3"
+1 -1
View File
@@ -1,9 +1,9 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
import { Codec } from '@polkadot/types/types';
import { Vec } from '@polkadot/types/codec';
import { u16, u32, u64 } from '@polkadot/types/primitive';
import { Codec } from '@polkadot/types/types';
import { Balance, BalanceOf, BlockNumber, LockIdentifier, ModuleId, Moment, Perbill, Percent, Permill, RuntimeDbWeight, Weight } from '@polkadot/types/interfaces/runtime';
import { SessionIndex } from '@polkadot/types/interfaces/session';
import { EraIndex } from '@polkadot/types/interfaces/staking';
+1 -1
View File
@@ -1,9 +1,9 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
import { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
import { Option, U8aFixed, Vec } from '@polkadot/types/codec';
import { Bytes, Data, bool, u32, u64 } from '@polkadot/types/primitive';
import { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import { BabeAuthorityWeight, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe';
import { AccountData, BalanceLock } from '@polkadot/types/interfaces/balances';
+2 -2
View File
@@ -1,10 +1,10 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
import { AnyNumber, Codec, IExtrinsic, Observable } from '@polkadot/types/types';
import { Metadata } from '@polkadot/metadata';
import { HashMap, Json, Option, Vec } from '@polkadot/types/codec';
import { Bytes, Null, StorageKey, Text, bool, u32, u64 } from '@polkadot/types/primitive';
import { Metadata } from '@polkadot/types';
import { AnyNumber, Codec, IExtrinsic, Observable } from '@polkadot/types/types';
import { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';
import { EpochAuthorship } from '@polkadot/types/interfaces/babe';
import { BlockHash } from '@polkadot/types/interfaces/chain';
+1 -1
View File
@@ -1,9 +1,9 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
import { AnyNumber, ITuple } from '@polkadot/types/types';
import { Compact, Option, U8aFixed, Vec } from '@polkadot/types/codec';
import { Bytes, Data, bool, u16, u32, u64 } from '@polkadot/types/primitive';
import { AnyNumber, ITuple } from '@polkadot/types/types';
import { BabeEquivocationProof } from '@polkadot/types/interfaces/babe';
import { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/collective';
import { CodeHash, Gas, Schedule } from '@polkadot/types/interfaces/contracts';
+3 -2
View File
@@ -4,6 +4,7 @@
import { Constants, DecoratedMeta } from '@polkadot/metadata/decorate/types';
import { RpcInterface } from '@polkadot/rpc-core/types';
import { Call, Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import { StorageEntry } from '@polkadot/types/primitive/types';
import { AnyFunction, CallFunction, Codec, CodecArg as Arg, InterfaceTypes, Registry, RegistryTypes } from '@polkadot/types/types';
import { SubmittableExtrinsic } from '../submittable/types';
import { ApiInterfaceRx, ApiOptions, ApiTypes, DecorateMethod, DecoratedRpc, DecoratedRpcSection, PaginationOptions, QueryableConsts, QueryableModuleStorage, QueryableStorage, QueryableStorageEntry, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics } from '../types';
@@ -16,9 +17,9 @@ import { memo } from '@polkadot/api-derive/util';
import { Metadata, expandMetadata } from '@polkadot/metadata';
import { RpcCore } from '@polkadot/rpc-core';
import { WsProvider } from '@polkadot/rpc-provider';
import { Option, Raw, Text, TypeRegistry, u64 } from '@polkadot/types';
import { Option, Raw, StorageKey, Text, TypeRegistry, u64 } from '@polkadot/types';
import { DEFAULT_VERSION as EXTRINSIC_DEFAULT_VERSION } from '@polkadot/types/extrinsic/constants';
import StorageKey, { StorageEntry, unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
import { assert, compactStripLength, logger, u8aToHex } from '@polkadot/util';
import { createSubmittable } from '../submittable';
+2 -1
View File
@@ -5,7 +5,8 @@ import { RpcInterface } from '@polkadot/rpc-core/types';
import { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import { ApiInterfaceRx, ApiTypes, DecoratedRpc, QueryableConsts, QueryableStorage, QueryableStorageMulti, SubmittableExtrinsics } from '../types';
import { Metadata, Text } from '@polkadot/types';
import { Metadata } from '@polkadot/metadata';
import { Text } from '@polkadot/types';
import { assertReturn } from '@polkadot/util';
import Init from './Init';
+3 -1
View File
@@ -9,7 +9,8 @@ import { VersionedRegistry } from './types';
import BN from 'bn.js';
import { Observable, Subscription, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Metadata, Text, TypeRegistry } from '@polkadot/types';
import { Metadata } from '@polkadot/metadata';
import { Text, TypeRegistry } from '@polkadot/types';
import { LATEST_EXTRINSIC_VERSION } from '@polkadot/types/extrinsic/Extrinsic';
import { getSpecAlias, getSpecTypes, getUpgradeVersion } from '@polkadot/types-known';
import { BN_ZERO, assert, logger, u8aEq, u8aToU8a } from '@polkadot/util';
@@ -317,6 +318,7 @@ export default abstract class Init<ApiType extends ApiTypes> extends Decorate<Ap
const error = new Error(`FATAL: Unable to initialize the API: ${(_error as Error).message}`);
l.error(error);
l.error(_error);
this.emit('error', error);
}
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import { Constants } from '@polkadot/metadata/decorate/types';
import { Metadata } from '@polkadot/types';
import { Metadata } from '@polkadot/metadata';
import { Registry } from '@polkadot/types/types';
import BN from 'bn.js';
+8
View File
@@ -0,0 +1,8 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { detectPackage } from '@polkadot/util';
// FIXME This really should be `import(...).then(...)`, but need to check rejections
// eslint-disable-next-line @typescript-eslint/no-var-requires
detectPackage(require('./package.json'), typeof __dirname !== 'undefined' && __dirname);
+1 -5
View File
@@ -1,11 +1,7 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { detectPackage } from '@polkadot/util';
// FIXME This really should be `import(...).then(...)`, but need to check rejections
// eslint-disable-next-line @typescript-eslint/no-var-requires
detectPackage(require('./package.json'), typeof __dirname !== 'undefined' && __dirname);
import './detectPackage';
export { Keyring } from '@polkadot/keyring';
export { WsProvider } from '@polkadot/rpc-provider/ws';
+1 -1
View File
@@ -8,7 +8,7 @@ import type BN from 'bn.js';
import { DeriveCustom, ExactDerive } from '@polkadot/api-derive';
import { RpcInterface } from '@polkadot/rpc-core/types';
import { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
import { Metadata } from '@polkadot/types';
import { Metadata } from '@polkadot/metadata';
import { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import { DefinitionRpc, DefinitionRpcSub, Signer, SignatureOptions, Registry, RegisteredTypes } from '@polkadot/types/types';
+4 -3
View File
@@ -1,11 +1,12 @@
// Copyright 2017-2020 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Observable } from 'rxjs';
import { u64 } from '@polkadot/types';
import { Hash } from '@polkadot/types/interfaces';
import { AnyFunction, Callback, Codec, CodecArg } from '@polkadot/types/types';
import StorageKey, { StorageEntry } from '@polkadot/types/primitive/StorageKey';
import { StorageEntry } from '@polkadot/types/primitive/types';
import { Observable } from 'rxjs';
import { StorageKey, u64 } from '@polkadot/types';
import { ApiTypes, MethodResult, ObsInnerType, PaginationOptions, PromiseOrObs, UnsubscribePromise } from './base';
+2 -2
View File
@@ -3,9 +3,9 @@
import { EventRecord, ExtrinsicStatus, H256, SignedBlock } from '@polkadot/types/interfaces';
import l from './logging';
import { l } from './logging';
export default function filterEvents (extHash: H256, { block: { extrinsics, header } }: SignedBlock, allEvents: EventRecord[], status: ExtrinsicStatus): EventRecord[] | undefined {
export function filterEvents (extHash: H256, { block: { extrinsics, header } }: SignedBlock, allEvents: EventRecord[], status: ExtrinsicStatus): EventRecord[] | undefined {
// extrinsics to hashes
const myHash = extHash.toHex();
const allHashes = extrinsics.map((ext): string => ext.hash.toHex());
+4 -3
View File
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
export * from './decorate';
export { default as filterEvents } from './filterEvents';
export { default as isKeyringPair } from './isKeyringPair';
export { default as l } from './logging';
export { filterEvents } from './filterEvents';
export { isKeyringPair } from './isKeyringPair';
export { l } from './logging';
+1 -1
View File
@@ -6,6 +6,6 @@ import { IKeyringPair } from '@polkadot/types/types';
import { isFunction } from '@polkadot/util';
export default function isKeyringPair (account: string | IKeyringPair | AccountId | Address): account is IKeyringPair {
export function isKeyringPair (account: string | IKeyringPair | AccountId | Address): account is IKeyringPair {
return isFunction((account as IKeyringPair).sign);
}
+1 -3
View File
@@ -3,6 +3,4 @@
import { logger } from '@polkadot/util';
const l = logger('api/util');
export default l;
export const l = logger('api/util');
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2019 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { StorageEntry } from '@polkadot/types/primitive/StorageKey';
import { StorageEntry } from '@polkadot/types/primitive/types';
import { Type } from '@polkadot/types';
import { assert, isUndefined } from '@polkadot/util';