Bump common (w/ rxjs 7) (#3736)
* Bump common (w/ rxjs 7) * Adjust * pre bump * Cleanup imports * Add missing switchMap * CHANGELOG * Remove duplicate imports * Bump common * Direct rxjs import
This commit is contained in:
+12
-12
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api",
|
||||
"version": "4.17.2-7",
|
||||
"version": "4.17.2-8",
|
||||
"type": "module",
|
||||
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
|
||||
"main": "index.js",
|
||||
@@ -20,16 +20,16 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/api-derive": "4.17.2-7",
|
||||
"@polkadot/keyring": "^6.11.1",
|
||||
"@polkadot/metadata": "4.17.2-7",
|
||||
"@polkadot/rpc-core": "4.17.2-7",
|
||||
"@polkadot/rpc-provider": "4.17.2-7",
|
||||
"@polkadot/types": "4.17.2-7",
|
||||
"@polkadot/types-known": "4.17.2-7",
|
||||
"@polkadot/util": "^6.11.1",
|
||||
"@polkadot/util-crypto": "^6.11.1",
|
||||
"@polkadot/x-rxjs": "^6.11.1",
|
||||
"eventemitter3": "^4.0.7"
|
||||
"@polkadot/api-derive": "4.17.2-8",
|
||||
"@polkadot/keyring": "^6.11.2-6",
|
||||
"@polkadot/metadata": "4.17.2-8",
|
||||
"@polkadot/rpc-core": "4.17.2-8",
|
||||
"@polkadot/rpc-provider": "4.17.2-8",
|
||||
"@polkadot/types": "4.17.2-8",
|
||||
"@polkadot/types-known": "4.17.2-8",
|
||||
"@polkadot/util": "^6.11.2-6",
|
||||
"@polkadot/util-crypto": "^6.11.2-6",
|
||||
"eventemitter3": "^4.0.7",
|
||||
"rxjs": "^7.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { DecoratedMeta } from '@polkadot/metadata/decorate/types';
|
||||
import type { RpcInterface } from '@polkadot/rpc-core/types';
|
||||
import type { Option, Raw, StorageKey, Text, u64 } from '@polkadot/types';
|
||||
@@ -11,6 +12,8 @@ import type { SubmittableExtrinsic } from '../submittable/types';
|
||||
import type { ApiDecoration, ApiInterfaceRx, ApiOptions, ApiTypes, DecoratedErrors, DecoratedEvents, DecoratedRpc, DecoratedRpcSection, DecorateMethod, PaginationOptions, QueryableConsts, QueryableModuleStorage, QueryableModuleStorageAt, QueryableStorage, QueryableStorageAt, QueryableStorageEntry, QueryableStorageEntryAt, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics } from '../types';
|
||||
import type { VersionedRegistry } from './types';
|
||||
|
||||
import { BehaviorSubject, combineLatest, map, of, switchMap, tap, toArray } from 'rxjs';
|
||||
|
||||
import { decorateDerive, ExactDerive } from '@polkadot/api-derive';
|
||||
import { memo } from '@polkadot/api-derive/util';
|
||||
import { expandMetadata, Metadata } from '@polkadot/metadata';
|
||||
@@ -20,8 +23,6 @@ import { TypeRegistry } from '@polkadot/types/create';
|
||||
import { DEFAULT_VERSION as EXTRINSIC_DEFAULT_VERSION } from '@polkadot/types/extrinsic/constants';
|
||||
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
|
||||
import { arrayChunk, arrayFlatten, assert, BN, BN_ZERO, compactStripLength, logger, u8aToHex } from '@polkadot/util';
|
||||
import { BehaviorSubject, combineLatest, Observable, of } from '@polkadot/x-rxjs';
|
||||
import { map, switchMap, tap, toArray } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { createSubmittable } from '../submittable';
|
||||
import { augmentObject } from '../util/augmentObject';
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Observable, Subscription } from 'rxjs';
|
||||
import type { RpcInterfaceMethod } from '@polkadot/rpc-core/types';
|
||||
import type { Text } from '@polkadot/types';
|
||||
import type { ChainProperties, Hash, RuntimeVersion } from '@polkadot/types/interfaces';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { Observable, Subscription } from '@polkadot/x-rxjs';
|
||||
import type { ApiBase, ApiDecoration, ApiOptions, ApiTypes, DecorateMethod } from '../types';
|
||||
import type { VersionedRegistry } from './types';
|
||||
|
||||
import { firstValueFrom, map, of, switchMap } from 'rxjs';
|
||||
|
||||
import { Metadata } from '@polkadot/metadata';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
import { getSpecAlias, getSpecExtensions, getSpecHasher, getSpecRpc, getSpecTypes, getUpgradeVersion } from '@polkadot/types-known';
|
||||
import { assert, BN_ZERO, logger, stringify, u8aEq, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
import { cryptoWaitReady } from '@polkadot/util-crypto';
|
||||
import { of } from '@polkadot/x-rxjs';
|
||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { detectedCapabilities } from './capabilities';
|
||||
import { Decorate } from './Decorate';
|
||||
@@ -140,7 +140,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
const header = this.registry.createType('HeaderPartial',
|
||||
this._genesisHash.eq(blockHash)
|
||||
? { number: BN_ZERO, parentHash: this._genesisHash }
|
||||
: await (this._rpcCore.chain.getHeader as RpcInterfaceMethod).json(blockHash).toPromise()
|
||||
: await firstValueFrom((this._rpcCore.chain.getHeader as RpcInterfaceMethod).json(blockHash))
|
||||
);
|
||||
|
||||
assert(!header.parentHash.isEmpty, 'Unable to retrieve header and parent from supplied hash');
|
||||
@@ -150,7 +150,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
const version = this.registry.createType('RuntimeVersionPartial',
|
||||
(firstVersion && (lastVersion || firstVersion.specVersion.eq(this._runtimeVersion.specVersion)))
|
||||
? { specName: this._runtimeVersion.specName, specVersion: firstVersion.specVersion }
|
||||
: await (this._rpcCore.state.getRuntimeVersion as RpcInterfaceMethod).json(header.parentHash).toPromise()
|
||||
: await firstValueFrom((this._rpcCore.state.getRuntimeVersion as RpcInterfaceMethod).json(header.parentHash))
|
||||
);
|
||||
|
||||
// check for pre-existing registries
|
||||
@@ -165,7 +165,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
// nothing has been found, construct new
|
||||
const registry = new TypeRegistry(blockHash);
|
||||
const metadata = new Metadata(registry,
|
||||
await (this._rpcCore.state.getMetadata as RpcInterfaceMethod).raw(header.parentHash).toPromise()
|
||||
await firstValueFrom((this._rpcCore.state.getMetadata as RpcInterfaceMethod).raw(header.parentHash))
|
||||
);
|
||||
|
||||
this._initRegistry(registry, this._runtimeChain as Text, version, metadata);
|
||||
@@ -220,8 +220,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
}
|
||||
|
||||
private _detectCapabilities (registry: Registry, blockHash?: string | Uint8Array): boolean {
|
||||
detectedCapabilities(this._rx, blockHash)
|
||||
.toPromise()
|
||||
firstValueFrom(detectedCapabilities(this._rx, blockHash))
|
||||
.then((types): void => {
|
||||
if (Object.keys(types).length) {
|
||||
registry.register(types as Record<string, string>);
|
||||
@@ -273,14 +272,14 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
|
||||
private async _metaFromChain (optMetadata?: Record<string, string>): Promise<[Hash, Metadata]> {
|
||||
const [genesisHash, runtimeVersion, chain, chainProps, rpcMethods, chainMetadata] = await Promise.all([
|
||||
this._rpcCore.chain.getBlockHash(0).toPromise(),
|
||||
this._rpcCore.state.getRuntimeVersion().toPromise(),
|
||||
this._rpcCore.system.chain().toPromise(),
|
||||
this._rpcCore.system.properties().toPromise(),
|
||||
this._rpcCore.rpc.methods().toPromise(),
|
||||
firstValueFrom(this._rpcCore.chain.getBlockHash(0)),
|
||||
firstValueFrom(this._rpcCore.state.getRuntimeVersion()),
|
||||
firstValueFrom(this._rpcCore.system.chain()),
|
||||
firstValueFrom(this._rpcCore.system.properties()),
|
||||
firstValueFrom(this._rpcCore.rpc.methods()),
|
||||
optMetadata
|
||||
? Promise.resolve(null)
|
||||
: this._rpcCore.state.getMetadata().toPromise()
|
||||
: firstValueFrom(this._rpcCore.state.getMetadata())
|
||||
]);
|
||||
|
||||
// set our chain version & genesisHash as returned
|
||||
@@ -293,7 +292,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
const metadata = chainMetadata || (
|
||||
optMetadata && optMetadata[metadataKey]
|
||||
? new Metadata(this.registry, optMetadata[metadataKey])
|
||||
: await this._rpcCore.state.getMetadata().toPromise()
|
||||
: await firstValueFrom(this._rpcCore.state.getMetadata())
|
||||
);
|
||||
|
||||
// initializes the registry & RPC
|
||||
@@ -369,7 +368,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
}
|
||||
|
||||
this.#healthTimer = setInterval((): void => {
|
||||
this._rpcCore.system.health().toPromise().catch(() => undefined);
|
||||
firstValueFrom(this._rpcCore.system.health()).catch(() => undefined);
|
||||
}, KEEPALIVE_INTERVAL);
|
||||
} catch (_error) {
|
||||
const error = new Error(`FATAL: Unable to initialize the API: ${(_error as Error).message}`);
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Raw, u32 } from '@polkadot/types';
|
||||
import type { Releases } from '@polkadot/types/interfaces';
|
||||
import type { InterfaceTypes } from '@polkadot/types/types';
|
||||
|
||||
import { catchError, combineLatest, map, of, take } from 'rxjs';
|
||||
|
||||
import { assert, compactFromU8a } from '@polkadot/util';
|
||||
import { combineLatest, Observable, of } from '@polkadot/x-rxjs';
|
||||
import { catchError, map, take } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
// the order and types needs to map with the all array setup below
|
||||
type ExtractedQ = [Releases | null];
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api', version: '4.17.2-7' };
|
||||
export const packageInfo = { name: '@polkadot/api', version: '4.17.2-8' };
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { Callback, Codec } from '@polkadot/types/types';
|
||||
import type { ApiOptions, DecorateFn, DecorateMethodOptions, ObsInnerType, StorageEntryPromiseOverloads, UnsubscribePromise, VoidFn } from '../types';
|
||||
|
||||
import { catchError, EMPTY, Subscription, tap } from 'rxjs';
|
||||
|
||||
import { assert, isFunction } from '@polkadot/util';
|
||||
import { EMPTY, Observable, Subscription } from '@polkadot/x-rxjs';
|
||||
import { catchError, tap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { ApiBase } from '../base';
|
||||
import { Combinator, CombinatorCallback, CombinatorFunction } from './Combinator';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { Codec } from '@polkadot/types/types';
|
||||
import type { ApiOptions, DecorateFn } from '../types';
|
||||
|
||||
import { from, Observable } from '@polkadot/x-rxjs';
|
||||
import { from, Observable } from 'rxjs';
|
||||
|
||||
import { ApiBase } from '../base';
|
||||
|
||||
@@ -48,8 +48,7 @@ export function decorateMethod <Method extends DecorateFn<Codec>> (method: Metho
|
||||
* <BR>
|
||||
*
|
||||
* ```javascript
|
||||
* import { combineLatest } from '@polkadot/x-rxjs';
|
||||
* import { pairwise, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
* import { combineLatest, pairwise, switchMap } from 'rxjs';
|
||||
* import { ApiRx, WsProvider } from '@polkadot/api';
|
||||
*
|
||||
*
|
||||
@@ -78,7 +77,7 @@ export function decorateMethod <Method extends DecorateFn<Codec>> (method: Metho
|
||||
* <BR>
|
||||
*
|
||||
* ```javascript
|
||||
* import { first, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
* import { first, switchMap } from 'rxjs';
|
||||
* import ApiRx from '@polkadot/api/rx';
|
||||
*
|
||||
* // import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
|
||||
@@ -122,7 +121,7 @@ export class ApiRx extends ApiBase<'rxjs'> {
|
||||
* <BR>
|
||||
*
|
||||
* ```javascript
|
||||
* import { switchMap } from '@polkadot/x-rxjs/operators';
|
||||
* import { switchMap } from 'rxjs';
|
||||
* import Api from '@polkadot/api/rx';
|
||||
*
|
||||
* Api.create()
|
||||
@@ -146,7 +145,7 @@ export class ApiRx extends ApiBase<'rxjs'> {
|
||||
* <BR>
|
||||
*
|
||||
* ```javascript
|
||||
* import { switchMap } from '@polkadot/x-rxjs/operators';
|
||||
* import { switchMap } from 'rxjs';
|
||||
* import Api from '@polkadot/api/rx';
|
||||
*
|
||||
* new Api().isReady
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
|
||||
/* eslint-disable no-dupe-class-members */
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { Address, ApplyExtrinsicResult, Call, Extrinsic, ExtrinsicEra, ExtrinsicStatus, Hash, Header, Index, RuntimeDispatchInfo } from '@polkadot/types/interfaces';
|
||||
import type { Callback, Codec, Constructor, IKeyringPair, ISubmittableResult, Registry, SignatureOptions } from '@polkadot/types/types';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { ApiInterfaceRx, ApiTypes, SignerResult } from '../types';
|
||||
import type { AddressOrPair, SignerOptions, SubmittableDryRunResult, SubmittableExtrinsic, SubmittablePaymentResult, SubmittableResultResult, SubmittableResultSubscription, SubmittableThis } from './types';
|
||||
|
||||
import { catchError, first, map, mapTo, mergeMap, of, switchMap, tap } from 'rxjs';
|
||||
|
||||
import { assert, isBn, isFunction, isNumber, isString, isU8a } from '@polkadot/util';
|
||||
import { of } from '@polkadot/x-rxjs';
|
||||
import { catchError, first, map, mapTo, mergeMap, switchMap, tap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { ApiBase } from '../base';
|
||||
import { filterEvents, isKeyringPair } from '../util';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { AccountId, Address, ApplyExtrinsicResult, DispatchError, DispatchInfo, EventRecord, Extrinsic, ExtrinsicStatus, Hash, RuntimeDispatchInfo } from '@polkadot/types/interfaces';
|
||||
import type { AnyNumber, Callback, Codec, IExtrinsicEra, IKeyringPair, ISubmittableResult, Signer } from '@polkadot/types/types';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { ApiTypes } from '../types';
|
||||
|
||||
export interface SubmittableResultValue {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { AnyFunction, Callback, Codec, CodecArg } from '@polkadot/types/types';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
|
||||
export type Push<T extends readonly unknown[], V> = [...T, V]
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { Json, Raw } from '@polkadot/types/codec';
|
||||
import type { AnyFunction, Callback, DefinitionRpc } from '@polkadot/types/types';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
import { ApiTypes, PromiseResult, Push, RxResult, UnsubscribePromise } from './base';
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { StorageKey, u64 } from '@polkadot/types';
|
||||
import type { Hash } from '@polkadot/types/interfaces';
|
||||
import type { StorageEntry } from '@polkadot/types/primitive/types';
|
||||
import type { AnyFunction, AnyTuple, Callback, Codec, CodecArg, IStorageKey } from '@polkadot/types/types';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { ApiTypes, DropLast, MethodResult, ObsInnerType, PaginationOptions, PromiseOrObs, UnsubscribePromise } from './base';
|
||||
|
||||
interface StorageEntryObservableMulti {
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Enum, Struct } from '@polkadot/types';
|
||||
import type { Option } from '@polkadot/types/codec';
|
||||
import type { AccountId, AccountIndex, AccountInfo, Address, Balance, BlockNumber, Index } from '@polkadot/types/interfaces';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
import { combineLatest, map, of, switchMap } from 'rxjs';
|
||||
|
||||
import { ApiPromise, WsProvider } from '@polkadot/api';
|
||||
import { memo } from '@polkadot/api-derive/util/memo';
|
||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
interface VestingInfo extends Struct {
|
||||
readonly locked: Balance;
|
||||
|
||||
Reference in New Issue
Block a user