Use .js imports in src (#5526)

* Use .js imports in src

* Adjust

* Fix imports

* Bump dev

* Adjust with .js imports for typegen

* Adjust

* Adjust

* Remove target override
This commit is contained in:
Jaco
2023-03-09 12:19:12 +02:00
committed by GitHub
parent f233671c27
commit 9fe2798b70
754 changed files with 1873 additions and 1871 deletions
+1 -1
View File
@@ -40,7 +40,7 @@
"@babel/core": "^7.21.0",
"@babel/register": "^7.21.0",
"@babel/runtime": "^7.21.0",
"@polkadot/dev": "^0.70.4",
"@polkadot/dev": "^0.71.1",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/node": "^18.14.5"
},
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './substrate';
import './substrate/index.js';
export { packageInfo } from './packageInfo';
export { packageInfo } from './packageInfo.js';
+2 -2
View File
@@ -5,7 +5,7 @@
import { detectPackage } from '@polkadot/util';
import others from './detectOther';
import { packageInfo } from './packageInfo';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others);
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import './detectPackage.js';
export * from './bundle';
export * from './bundle.js';
+8 -8
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
import '../base';
import './consts';
import './errors';
import './events';
import './query';
import './registry';
import './runtime';
import './tx';
import '../base.js';
import './consts.js';
import './errors.js';
import './events.js';
import './query.js';
import './registry.js';
import './runtime.js';
import './tx.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
export * from './index.js';
+8 -8
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
import '../base';
import './consts';
import './errors';
import './events';
import './query';
import './registry';
import './runtime';
import './tx';
import '../base.js';
import './consts.js';
import './errors.js';
import './events.js';
import './query.js';
import './registry.js';
import './runtime.js';
import './tx.js';
+8 -8
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/api-augment authors & contributors
// SPDX-License-Identifier: Apache-2.0
import '../base';
import './consts';
import './errors';
import './events';
import './query';
import './registry';
import './runtime';
import './tx';
import '../base.js';
import './consts.js';
import './errors.js';
import './events.js';
import './query.js';
import './registry.js';
import './runtime.js';
import './tx.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/api-base authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { packageInfo } from './packageInfo';
export { packageInfo } from './packageInfo.js';
+2 -2
View File
@@ -5,7 +5,7 @@
import { detectPackage } from '@polkadot/util';
import others from './detectOther';
import { packageInfo } from './packageInfo';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others);
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/api-base authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import './detectPackage.js';
export * from './bundle';
export * from './bundle.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/api-base authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
export * from './index.js';
+1 -1
View File
@@ -3,7 +3,7 @@
import type { Observable } from 'rxjs';
import type { AnyFunction, Codec, DefinitionCallNamed } from '@polkadot/types/types';
import type { ApiTypes, ReturnCodec } from './base';
import type { ApiTypes, ReturnCodec } from './base.js';
export type DecoratedCallBase<ApiType extends ApiTypes, F extends AnyFunction = (...args: any[]) => Observable<Codec>> =
ApiType extends 'rxjs'
+1 -1
View File
@@ -3,7 +3,7 @@
import type { PalletConstantMetadataLatest } from '@polkadot/types/interfaces';
import type { Codec } from '@polkadot/types/types';
import type { ApiTypes } from './base';
import type { ApiTypes } from './base.js';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export interface AugmentedConst<ApiType extends ApiTypes> {
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { IsError } from '@polkadot/types/metadata/decorate/types';
import type { ApiTypes } from './base';
import type { ApiTypes } from './base.js';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export type AugmentedError<ApiType extends ApiTypes> = IsError;
+1 -1
View File
@@ -3,7 +3,7 @@
import type { IsEvent } from '@polkadot/types/metadata/decorate/types';
import type { AnyTuple } from '@polkadot/types/types';
import type { ApiTypes } from './base';
import type { ApiTypes } from './base.js';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export type AugmentedEvent<ApiType extends ApiTypes, T extends AnyTuple = AnyTuple, N = unknown> = IsEvent<T, N>;
+4 -4
View File
@@ -10,7 +10,7 @@ export * from '@polkadot/api-base/types/storage';
export * from '@polkadot/api-base/types/submittable';
// normal exports
export * from './api';
export * from './base';
export * from './derive';
export * from './rpc';
export * from './api.js';
export * from './base.js';
export * from './derive.js';
export * from './rpc.js';
+1 -1
View File
@@ -4,7 +4,7 @@
import type { Observable } from 'rxjs';
import type { AnyFunction, AnyJson, Callback, DefinitionRpc } from '@polkadot/types/types';
import { ApiTypes, PromiseResult, Push, RxResult, UnsubscribePromise } from './base';
import { ApiTypes, PromiseResult, Push, RxResult, UnsubscribePromise } from './base.js';
export type { AugmentedRpc } from '@polkadot/rpc-core/types';
+1 -1
View File
@@ -6,7 +6,7 @@ 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, IStorageKey } from '@polkadot/types/types';
import type { ApiTypes, DropLast, MethodResult, PaginationOptions, PromiseOrObs, ReturnCodec, UnsubscribePromise } from './base';
import type { ApiTypes, DropLast, MethodResult, PaginationOptions, PromiseOrObs, ReturnCodec, UnsubscribePromise } from './base.js';
interface StorageEntryObservableMulti<R extends Codec = Codec> {
<T extends Codec = R>(args: (unknown[] | unknown)[]): Observable<T[]>;
+1 -1
View File
@@ -4,7 +4,7 @@
import type { Observable } from 'rxjs';
import type { AccountId, Address, ApplyExtrinsicResult, BlockNumber, Call, DispatchError, DispatchInfo, EventRecord, Extrinsic, ExtrinsicStatus, Hash, RuntimeDispatchInfo } from '@polkadot/types/interfaces';
import type { AnyFunction, AnyNumber, AnyTuple, Callback, CallBase, Codec, IExtrinsicEra, IKeyringPair, ISubmittableResult, Signer } from '@polkadot/types/types';
import type { ApiTypes, PromiseOrObs } from './base';
import type { ApiTypes, PromiseOrObs } from './base.js';
export type AugmentedSubmittable<T extends AnyFunction, A extends AnyTuple = AnyTuple> = T & CallBase<A>;
+2 -2
View File
@@ -12,8 +12,8 @@ import process from 'node:process';
import { TypeDefInfo } from '@polkadot/types/types';
import { blake2AsHex } from '@polkadot/util-crypto';
import abis from '../test/contracts';
import { Abi } from '.';
import abis from '../test/contracts/index.js';
import { Abi } from './index.js';
interface SpecDef {
messages: {
+2 -2
View File
@@ -4,13 +4,13 @@
import type { Bytes } from '@polkadot/types';
import type { ChainProperties, ContractConstructorSpecLatest, ContractEventSpecLatest, ContractMessageParamSpecLatest, ContractMessageSpecLatest, ContractMetadata, ContractMetadataLatest, ContractProjectInfo } from '@polkadot/types/interfaces';
import type { Codec, Registry } from '@polkadot/types/types';
import type { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, DecodedMessage } from '../types';
import type { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, DecodedMessage } from '../types.js';
import { TypeRegistry } from '@polkadot/types';
import { TypeDefInfo } from '@polkadot/types-create';
import { assertReturn, compactAddLength, compactStripLength, isNumber, isObject, isString, logger, stringCamelCase, stringify, u8aConcat, u8aToHex } from '@polkadot/util';
import { convertVersions, enumVersions } from './toLatest';
import { convertVersions, enumVersions } from './toLatest.js';
const l = logger('Abi');
@@ -5,8 +5,8 @@
import { TypeRegistry } from '@polkadot/types';
import abis from '../test/contracts';
import { v0ToLatest, v1ToLatest, v2ToLatest, v3ToLatest, v4ToLatest } from './toLatest';
import abis from '../test/contracts/index.js';
import { v0ToLatest, v1ToLatest, v2ToLatest, v3ToLatest, v4ToLatest } from './toLatest.js';
describe('v0ToLatest', (): void => {
const registry = new TypeRegistry();
+4 -4
View File
@@ -4,10 +4,10 @@
import type { ContractMetadataLatest, ContractMetadataV4 } from '@polkadot/types/interfaces';
import type { Registry } from '@polkadot/types/types';
import { v0ToV1 } from './toV1';
import { v1ToV2 } from './toV2';
import { v2ToV3 } from './toV3';
import { v3ToV4 } from './toV4';
import { v0ToV1 } from './toV1.js';
import { v1ToV2 } from './toV2.js';
import { v2ToV3 } from './toV3.js';
import { v3ToV4 } from './toV4.js';
// The versions where an enum is used, aka V0 is missing
// (Order from newest, i.e. we expect more on newest vs oldest)
+1 -1
View File
@@ -8,7 +8,7 @@ import type { Registry } from '@polkadot/types/types';
import { ApiBase } from '@polkadot/api/base';
import { isFunction } from '@polkadot/util';
import { Abi } from '../Abi';
import { Abi } from '../Abi/index.js';
export abstract class Base<ApiType extends ApiTypes> {
readonly abi: Abi;
+7 -7
View File
@@ -5,18 +5,18 @@ import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { AccountId, EventRecord, Hash } from '@polkadot/types/interfaces';
import type { ISubmittableResult } from '@polkadot/types/types';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { MapConstructorExec } from './types';
import type { AbiConstructor, BlueprintOptions } from '../types.js';
import type { MapConstructorExec } from './types.js';
import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base';
import { BN_ZERO, isUndefined } from '@polkadot/util';
import { Abi } from '../Abi';
import { applyOnEvent } from '../util';
import { Base } from './Base';
import { Contract } from './Contract';
import { convertWeight, createBluePrintTx, encodeSalt } from './util';
import { Abi } from '../Abi/index.js';
import { applyOnEvent } from '../util.js';
import { Base } from './Base.js';
import { Contract } from './Contract.js';
import { convertWeight, createBluePrintTx, encodeSalt } from './util.js';
export interface BlueprintConstructor<ApiType extends ApiTypes> {
new(api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, codeHash: string | Hash | Uint8Array): Blueprint<ApiType>;
+2 -2
View File
@@ -12,8 +12,8 @@ import { toPromiseMethod } from '@polkadot/api';
import v0contractFlipper from '../test/contracts/ink/v0/flipper.contract.json' assert { type: 'json' };
import v0abiFlipper from '../test/contracts/ink/v0/flipper.json' assert { type: 'json' };
import v1contractFlipper from '../test/contracts/ink/v1/flipper.contract.json' assert { type: 'json' };
import { Code } from './Code';
import { mockApi } from './mock';
import { Code } from './Code.js';
import { mockApi } from './mock.js';
// FIXME When Jest is removed with ESM tests, this should be converted to use import.meta.url
const v0wasmFlipper = fs.readFileSync(path.join(process.cwd(), 'packages/api-contract/src/test/contracts/ink/v0/flipper.wasm'), 'utf-8');
+8 -8
View File
@@ -6,19 +6,19 @@ import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { AccountId, EventRecord } from '@polkadot/types/interfaces';
import type { ISubmittableResult } from '@polkadot/types/types';
import type { Codec } from '@polkadot/types-codec/types';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { MapConstructorExec } from './types';
import type { AbiConstructor, BlueprintOptions } from '../types.js';
import type { MapConstructorExec } from './types.js';
import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base';
import { BN_ZERO, compactAddLength, isUndefined, isWasm, u8aToU8a } from '@polkadot/util';
import { Abi } from '../Abi';
import { applyOnEvent } from '../util';
import { Base } from './Base';
import { Blueprint } from './Blueprint';
import { Contract } from './Contract';
import { convertWeight, createBluePrintTx, encodeSalt } from './util';
import { Abi } from '../Abi/index.js';
import { applyOnEvent } from '../util.js';
import { Base } from './Base.js';
import { Blueprint } from './Blueprint.js';
import { Contract } from './Contract.js';
import { convertWeight, createBluePrintTx, encodeSalt } from './util.js';
export interface CodeConstructor<ApiType extends ApiTypes> {
new(api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, wasm: Uint8Array | string | Buffer | null | undefined): Code<ApiType>;
+6 -6
View File
@@ -6,8 +6,8 @@ import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { Bytes } from '@polkadot/types';
import type { AccountId, ContractExecResult, EventRecord, Weight, WeightV2 } from '@polkadot/types/interfaces';
import type { ISubmittableResult } from '@polkadot/types/types';
import type { AbiMessage, ContractCallOutcome, ContractOptions, DecodedEvent, WeightAll } from '../types';
import type { ContractCallResult, ContractCallSend, ContractQuery, ContractTx, MapMessageQuery, MapMessageTx } from './types';
import type { AbiMessage, ContractCallOutcome, ContractOptions, DecodedEvent, WeightAll } from '../types.js';
import type { ContractCallResult, ContractCallSend, ContractQuery, ContractTx, MapMessageQuery, MapMessageTx } from './types.js';
import { map } from 'rxjs';
@@ -15,10 +15,10 @@ import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base';
import { BN, BN_HUNDRED, BN_ONE, BN_ZERO, isUndefined, logger } from '@polkadot/util';
import { Abi } from '../Abi';
import { applyOnEvent } from '../util';
import { Base } from './Base';
import { convertWeight, withMeta } from './util';
import { Abi } from '../Abi/index.js';
import { applyOnEvent } from '../util.js';
import { Base } from './Base.js';
import { convertWeight, withMeta } from './util.js';
export interface ContractConstructor<ApiType extends ApiTypes> {
new(api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, address: string | AccountId): Contract<ApiType>;
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { Blueprint, BlueprintSubmittableResult, extendBlueprint } from './Blueprint';
export { Code, CodeSubmittableResult, extendCode } from './Code';
export { Contract, extendContract } from './Contract';
export { Blueprint, BlueprintSubmittableResult, extendBlueprint } from './Blueprint.js';
export { Code, CodeSubmittableResult, extendCode } from './Code.js';
export { Contract, extendContract } from './Contract.js';
+1 -1
View File
@@ -5,7 +5,7 @@ import type { Observable } from 'rxjs';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, ObsInnerType } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { AbiMessage, BlueprintOptions, ContractCallOutcome, ContractOptions } from '../types';
import type { AbiMessage, BlueprintOptions, ContractCallOutcome, ContractOptions } from '../types.js';
export interface MessageMeta {
readonly meta: AbiMessage;
+2 -2
View File
@@ -6,8 +6,8 @@ import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes } from '@polkadot/api/types';
import type { WeightV1, WeightV2 } from '@polkadot/types/interfaces';
import type { BN } from '@polkadot/util';
import type { AbiConstructor, AbiMessage, BlueprintOptions, WeightAll } from '../types';
import type { BlueprintDeploy, ContractGeneric } from './types';
import type { AbiConstructor, AbiMessage, BlueprintOptions, WeightAll } from '../types.js';
import type { BlueprintDeploy, ContractGeneric } from './types.js';
import { Bytes } from '@polkadot/types';
import { bnToBn, compactAddLength, u8aToU8a } from '@polkadot/util';
+4 -4
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { Abi } from './Abi';
export { packageInfo } from './packageInfo';
export { Abi } from './Abi/index.js';
export { packageInfo } from './packageInfo.js';
export * from './promise';
export * from './rx';
export * from './promise/index.js';
export * from './rx/index.js';
+2 -2
View File
@@ -5,7 +5,7 @@
import { detectPackage } from '@polkadot/util';
import others from './detectOther';
import { packageInfo } from './packageInfo';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others);
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import './detectPackage.js';
export * from './bundle';
export * from './bundle.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
export * from './index.js';
+2 -2
View File
@@ -5,8 +5,8 @@ import type { AccountId, Hash } from '@polkadot/types/interfaces';
import { ApiPromise, toPromiseMethod } from '@polkadot/api';
import { Abi } from '../Abi';
import { Blueprint, Code, Contract } from '../base';
import { Abi } from '../Abi/index.js';
import { Blueprint, Code, Contract } from '../base/index.js';
export class BlueprintPromise extends Blueprint<'promise'> {
constructor (api: ApiPromise, abi: string | Record<string, unknown> | Abi, codeHash: string | Hash) {
+2 -2
View File
@@ -5,8 +5,8 @@ import type { AccountId, Hash } from '@polkadot/types/interfaces';
import { ApiRx, toRxMethod } from '@polkadot/api';
import { Abi } from '../Abi';
import { Blueprint, Code, Contract } from '../base';
import { Abi } from '../Abi/index.js';
import { Blueprint, Code, Contract } from '../base/index.js';
export class BlueprintRx extends Blueprint<'rxjs'> {
constructor (api: ApiRx, abi: string | Record<string, unknown> | Abi, codeHash: string | Hash) {
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import ink from './ink';
import solang from './solang';
import user from './user';
import ink from './ink/index.js';
import solang from './solang/index.js';
import user from './user/index.js';
const all: Record<string, Record<string, unknown>> = {};
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { createVersionedExport } from '../util';
import * as v0 from './v0';
import * as v1 from './v1';
import * as v2 from './v2';
import * as v3 from './v3';
import * as v4 from './v4';
import { createVersionedExport } from '../util.js';
import * as v0 from './v0/index.js';
import * as v1 from './v1/index.js';
import * as v2 from './v2/index.js';
import * as v3 from './v3/index.js';
import * as v4 from './v4/index.js';
export default createVersionedExport({ v0, v1, v2, v3, v4 });
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { createVersionedExport } from '../util';
import * as v0 from './v0';
import { createVersionedExport } from '../util.js';
import * as v0 from './v0/index.js';
export default createVersionedExport({ v0 });
@@ -1,8 +1,8 @@
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { createVersionedExport } from '../util';
import * as v0 from './v0';
import * as v3 from './v3';
import { createVersionedExport } from '../util.js';
import * as v0 from './v0/index.js';
import * as v3 from './v3/index.js';
export default createVersionedExport({ v0, v3 });
+1 -1
View File
@@ -7,7 +7,7 @@ import type { Text } from '@polkadot/types';
import type { ContractExecResultResult, ContractSelector, StorageDeposit, Weight, WeightV2 } from '@polkadot/types/interfaces';
import type { Codec, TypeDef } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { Abi } from '.';
import type { Abi } from './index.js';
export interface ContractBase<ApiType extends ApiTypes> {
readonly abi: Abi;
@@ -3,14 +3,14 @@
import type { Observable } from 'rxjs';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { map, of } from 'rxjs';
import { assertReturn, isU8a } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @name accountId
+2 -2
View File
@@ -6,13 +6,13 @@ import type { AccountId, Address, Balance } from '@polkadot/types/interfaces';
import type{ PalletElectionsPhragmenSeatHolder } from '@polkadot/types/lookup';
import type { Codec } from '@polkadot/types/types';
import type { Option } from '@polkadot/types-codec';
import type { DeriveAccountFlags, DeriveApi } from '../types';
import type { DeriveAccountFlags, DeriveApi } from '../types.js';
import { map, of } from 'rxjs';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
type FlagsIntermediate = [
PalletElectionsPhragmenSeatHolder[] | [AccountId, Balance][] | undefined,
@@ -3,14 +3,14 @@
import type { Observable } from 'rxjs';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { AccountIdAndIndex, DeriveApi } from '../types';
import type { AccountIdAndIndex, DeriveApi } from '../types.js';
import { map, of } from 'rxjs';
import { isU8a } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @name idAndIndex
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import type { AccountIndexes, DeriveApi } from '../types';
import type { AccountIndexes, DeriveApi } from '../types.js';
import { map } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @name idToIndex
+2 -2
View File
@@ -7,13 +7,13 @@ import type { AccountId } from '@polkadot/types/interfaces';
import type { PalletIdentityIdentityInfo, PalletIdentityRegistration } from '@polkadot/types/lookup';
import type { Option } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
import type { DeriveAccountRegistration, DeriveApi, DeriveHasIdentity } from '../types';
import type { DeriveAccountRegistration, DeriveApi, DeriveHasIdentity } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { isHex, u8aToString } from '@polkadot/util';
import { firstMemo, memo } from '../util';
import { firstMemo, memo } from '../util/index.js';
type IdentityInfoAdditional = PalletIdentityIdentityInfo['additional'][0];
+8 -8
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './accountId';
export * from './flags';
export * from './idAndIndex';
export * from './idToIndex';
export * from './identity';
export * from './indexToId';
export * from './indexes';
export * from './info';
export * from './accountId.js';
export * from './flags.js';
export * from './idAndIndex.js';
export * from './idToIndex.js';
export * from './identity.js';
export * from './indexToId.js';
export * from './indexes.js';
export * from './info.js';
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { map, of } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @name indexToId
+2 -2
View File
@@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { AccountIndexes, DeriveApi } from '../types';
import type { AccountIndexes, DeriveApi } from '../types.js';
import { map, of, startWith } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
let indicesCache: AccountIndexes | null = null;
+2 -2
View File
@@ -5,13 +5,13 @@ import type { Observable } from 'rxjs';
import type { Bytes, Option, u32 } from '@polkadot/types';
import type { AccountId, AccountIndex, Address, Balance } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveAccountInfo, DeriveAccountRegistration, DeriveApi } from '../types';
import type { DeriveAccountInfo, DeriveAccountRegistration, DeriveApi } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { u8aToString } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
function retrieveNick (api: DeriveApi, accountId?: AccountId): Observable<string | undefined> {
return ((
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { hasProposals as collectiveHasProposals, members as collectiveMembers, prime as collectivePrime, proposal as collectiveProposal, proposalCount as collectiveProposalCount, proposalHashes as collectiveProposalHashes, proposals as collectiveProposals } from '../collective';
import { hasProposals as collectiveHasProposals, members as collectiveMembers, prime as collectivePrime, proposal as collectiveProposal, proposalCount as collectiveProposalCount, proposalHashes as collectiveProposalHashes, proposals as collectiveProposals } from '../collective/index.js';
export const members = collectiveMembers('allianceMotion');
+4 -4
View File
@@ -5,15 +5,15 @@ import type { Observable } from 'rxjs';
import type { Option, u64 } from '@polkadot/types';
import type { PalletBagsListListBag } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import type { DeriveApi } from '../types';
import type { Bag } from './types';
import type { DeriveApi } from '../types.js';
import type { Bag } from './types.js';
import { map, of, switchMap } from 'rxjs';
import { BN_ZERO, bnToBn, objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { getQueryInterface } from './util';
import { memo } from '../util/index.js';
import { getQueryInterface } from './util.js';
function orderBags (ids: BN[], bags: Option<PalletBagsListListBag>[]): Bag[] {
const sorted = ids
@@ -3,14 +3,14 @@
import type { Observable } from 'rxjs';
import type { BN } from '@polkadot/util';
import type { DeriveApi } from '../types';
import type { Bag, BagExpanded } from './types';
import type { DeriveApi } from '../types.js';
import type { Bag, BagExpanded } from './types.js';
import { map, switchMap } from 'rxjs';
import { objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function expand (instanceId: string, api: DeriveApi): (bag: Bag) => Observable<BagExpanded> {
return memo(instanceId, (bag: Bag): Observable<BagExpanded> =>
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './get';
export * from './getExpanded';
export * from './listNodes';
export * from './get.js';
export * from './getExpanded.js';
export * from './listNodes.js';
@@ -5,14 +5,14 @@ import type { Observable } from 'rxjs';
import type { Option } from '@polkadot/types';
import type { AccountId32 } from '@polkadot/types/interfaces';
import type { PalletBagsListListBag, PalletBagsListListNode } from '@polkadot/types/lookup';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { BehaviorSubject, map, of, switchMap, tap, toArray } from 'rxjs';
import { nextTick } from '@polkadot/util';
import { memo } from '../util';
import { getQueryInterface } from './util';
import { memo } from '../util/index.js';
import { getQueryInterface } from './util.js';
function traverseLinks (api: DeriveApi, head: AccountId32 | string): Observable<PalletBagsListListNode[]> {
const subject = new BehaviorSubject<AccountId32 | string>(head);
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { QueryableStorage } from '@polkadot/api-base/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
export function getQueryInterface (api: DeriveApi): QueryableStorage<'rxjs'>['voterBagsList'] {
return (
+2 -2
View File
@@ -5,13 +5,13 @@ import type { Observable } from 'rxjs';
import type { QueryableStorageEntry } from '@polkadot/api-base/types';
import type { AccountData, AccountId, AccountIndex, AccountInfo, Address, Balance, Index } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveApi, DeriveBalancesAccount, DeriveBalancesAccountData } from '../types';
import type { DeriveApi, DeriveBalancesAccount, DeriveBalancesAccountData } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { isFunction, objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
type BalanceResult = [Balance, Balance, Balance, Balance];
+2 -2
View File
@@ -5,13 +5,13 @@ import type { Observable } from 'rxjs';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, Balance, BalanceLockTo212, BlockNumber, VestingSchedule } from '@polkadot/types/interfaces';
import type { PalletBalancesBalanceLock, PalletBalancesReserveData, PalletVestingVestingInfo } from '@polkadot/types/lookup';
import type { DeriveApi, DeriveBalancesAccount, DeriveBalancesAccountData, DeriveBalancesAll, DeriveBalancesAllAccountData, DeriveBalancesAllVesting } from '../types';
import type { DeriveApi, DeriveBalancesAccount, DeriveBalancesAccountData, DeriveBalancesAll, DeriveBalancesAllAccountData, DeriveBalancesAllVesting } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { BN, BN_ZERO, bnMax, bnMin, isFunction, objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
type ResultBalance = [PalletVestingVestingInfo[] | null, ((PalletBalancesBalanceLock | BalanceLockTo212)[])[], PalletBalancesReserveData[][]];
type Result = [DeriveBalancesAccount, ResultBalance, BlockNumber];
+3 -3
View File
@@ -1,10 +1,10 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { all } from './all';
import { all } from './all.js';
export * from './account';
export * from './votingBalances';
export * from './account.js';
export * from './votingBalances.js';
const votingBalance = all;
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveBalancesAccount } from '../types';
import type { DeriveApi, DeriveBalancesAccount } from '../types.js';
import { combineLatest, of } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function votingBalances (instanceId: string, api: DeriveApi): (addresses?: (AccountId | AccountIndex | Address | string)[]) => Observable<DeriveBalancesAccount[]> {
return memo(instanceId, (addresses?: (AccountId | AccountIndex | Address | string)[]): Observable<DeriveBalancesAccount[]> =>
@@ -7,17 +7,17 @@ import type { SubmittableExtrinsic } from '@polkadot/api-base/types';
import type { Bytes, Option, StorageKey } from '@polkadot/types';
import type { Bounty, BountyIndex, Proposal, ProposalIndex } from '@polkadot/types/interfaces';
import type { Codec, InterfaceTypes } from '@polkadot/types/types';
import type { DeriveApi, DeriveCollectiveProposal } from '../types';
import type { DeriveApi, DeriveCollectiveProposal } from '../types.js';
import { firstValueFrom, of } from 'rxjs';
import { ApiPromise } from '@polkadot/api';
import { BountyFactory } from '../test/bountyFactory';
import { BytesFactory } from '../test/bytesFactory';
import { createApiWithAugmentations } from '../test/helpers';
import { ProposalFactory } from '../test/proposalFactory';
import { bounties } from '.';
import { BountyFactory } from '../test/bountyFactory.js';
import { BytesFactory } from '../test/bytesFactory.js';
import { createApiWithAugmentations } from '../test/helpers.js';
import { ProposalFactory } from '../test/proposalFactory.js';
import { bounties } from './index.js';
const DEFAULT_PROPOSER = '5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM';
+3 -3
View File
@@ -5,12 +5,12 @@ import type { Observable } from 'rxjs';
import type { Bytes, Option } from '@polkadot/types';
import type { BountyIndex } from '@polkadot/types/interfaces';
import type { PalletBountiesBounty } from '@polkadot/types/lookup';
import type { DeriveApi, DeriveBounties, DeriveCollectiveProposal } from '../types';
import type { DeriveApi, DeriveBounties, DeriveCollectiveProposal } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { memo } from '../util';
import { filterBountiesProposals } from './helpers/filterBountyProposals';
import { memo } from '../util/index.js';
import { filterBountiesProposals } from './helpers/filterBountyProposals.js';
type Result = [Option<PalletBountiesBounty>[], Option<Bytes>[], BountyIndex[], DeriveCollectiveProposal[]];
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DeriveApi, DeriveCollectiveProposal } from '../../types';
import type { DeriveApi, DeriveCollectiveProposal } from '../../types.js';
export function filterBountiesProposals (api: DeriveApi, allProposals: DeriveCollectiveProposal[]): DeriveCollectiveProposal[] {
const bountyTxBase = api.tx.bounties ? api.tx.bounties : api.tx.treasury;
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './bounties';
export * from './bounties.js';
+5 -5
View File
@@ -4,13 +4,13 @@
import type { DeriveCustom } from '@polkadot/api-base/types';
import type { AnyFunction, AnyString } from '@polkadot/types/types';
import type { ExactDerive } from './derive';
import type { DeriveApi } from './types';
import type { DeriveApi } from './types.js';
import { derive } from './derive';
import { lazyDeriveSection } from './util';
import { lazyDeriveSection } from './util/index.js';
import { derive } from './derive.js';
export * from './derive';
export * from './type';
export * from './derive.js';
export * from './type/index.js';
interface Avail {
instances: string[];
+2 -2
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { createBlockNumberDerive } from './util';
import { createBlockNumberDerive } from './util.js';
/**
* @name bestNumber
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { createBlockNumberDerive } from './util';
import { createBlockNumberDerive } from './util.js';
/**
* @name bestNumberFinalized
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { BlockNumber } from '@polkadot/types/interfaces';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { combineLatest, map } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @name bestNumberLag
+4 -4
View File
@@ -3,13 +3,13 @@
import type { Observable } from 'rxjs';
import type { SignedBlockExtended } from '../type/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { createSignedBlockExtended } from '../type';
import { memo } from '../util';
import { getAuthorDetails } from './util';
import { createSignedBlockExtended } from '../type/index.js';
import { memo } from '../util/index.js';
import { getAuthorDetails } from './util.js';
/**
* @name getBlock
@@ -4,11 +4,11 @@
import type { Observable } from 'rxjs';
import type { AnyNumber } from '@polkadot/types/types';
import type { SignedBlockExtended } from '../type/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { switchMap } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function getBlockByNumber (instanceId: string, api: DeriveApi): (blockNumber: AnyNumber) => Observable<SignedBlockExtended> {
return memo(instanceId, (blockNumber: AnyNumber): Observable<SignedBlockExtended> =>
+4 -4
View File
@@ -3,13 +3,13 @@
import type { Observable } from 'rxjs';
import type { HeaderExtended } from '../type/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { combineLatest, map, switchMap } from 'rxjs';
import { createHeaderExtended } from '../type';
import { memo } from '../util';
import { getAuthorDetails } from './util';
import { createHeaderExtended } from '../type/index.js';
import { memo } from '../util/index.js';
import { getAuthorDetails } from './util.js';
/**
* @name getHeader
+9 -9
View File
@@ -1,12 +1,12 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './bestNumber';
export * from './bestNumberFinalized';
export * from './bestNumberLag';
export * from './getHeader';
export * from './getBlock';
export * from './getBlockByNumber';
export * from './subscribeFinalizedHeads';
export * from './subscribeNewBlocks';
export * from './subscribeNewHeads';
export * from './bestNumber.js';
export * from './bestNumberFinalized.js';
export * from './bestNumberLag.js';
export * from './getHeader.js';
export * from './getBlock.js';
export * from './getBlockByNumber.js';
export * from './subscribeFinalizedHeads.js';
export * from './subscribeNewBlocks.js';
export * from './subscribeNewHeads.js';
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { SignedBlockExtended } from '../type/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { switchMap } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @name subscribeFinalizedBlocks
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { Hash, Header } from '@polkadot/types/interfaces';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { from, of, switchMap } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* Returns a header range from startHash to to (not including) endHash, i.e. lastBlock.parentHash === endHash
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { SignedBlockExtended } from '../type/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { switchMap } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @name subscribeNewBlocks
@@ -3,13 +3,13 @@
import type { Observable } from 'rxjs';
import type { HeaderExtended } from '../type/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { createHeaderExtended } from '../type';
import { memo } from '../util';
import { getAuthorDetails } from './util';
import { createHeaderExtended } from '../type/index.js';
import { memo } from '../util/index.js';
import { getAuthorDetails } from './util.js';
/**
* @name subscribeNewHeads
+2 -2
View File
@@ -6,11 +6,11 @@ import type { QueryableStorage } from '@polkadot/api-base/types';
import type { Compact, Vec } from '@polkadot/types';
import type { AccountId, BlockNumber, Header } from '@polkadot/types/interfaces';
import type { Codec, IOption } from '@polkadot/types/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { combineLatest, map, of } from 'rxjs';
import { memo, unwrapBlockNumber } from '../util';
import { memo, unwrapBlockNumber } from '../util/index.js';
// re-export these - since these needs to be resolvable from api-derive, i.e. without this
// we would emit code with ../<somewhere>/src embedded in the *.d.ts files
+1 -1
View File
@@ -3,6 +3,6 @@
import '@polkadot/api-augment';
import { derive } from '.';
import { derive } from './index.js';
console.log(derive.chain.bestNumber);
@@ -2,14 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { DeriveApi } from '../types';
import type { Collective } from './types';
import type { DeriveApi } from '../types.js';
import type { Collective } from './types.js';
import { of } from 'rxjs';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function getInstance (api: DeriveApi, section: string): DeriveApi['query']['council'] {
const instances = api.registry.getModuleInstances(api.runtimeVersion.specName, section);
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './members';
export * from './prime';
export * from './proposals';
export * from './members.js';
export * from './prime.js';
export * from './proposals.js';
@@ -3,7 +3,7 @@
import type { AccountId } from '@polkadot/types/interfaces';
import { callMethod } from './helpers';
import { callMethod } from './helpers.js';
// We are re-exporting these from here to ensure that *.d.ts generation is correct
export type { AccountId } from '@polkadot/types/interfaces';
+3 -3
View File
@@ -3,14 +3,14 @@
import type { Observable } from 'rxjs';
import type { AccountId } from '@polkadot/types/interfaces';
import type { DeriveApi } from '../types';
import type { Collective } from './types';
import type { DeriveApi } from '../types.js';
import type { Collective } from './types.js';
import { map, of } from 'rxjs';
import { isFunction } from '@polkadot/util';
import { withSection } from './helpers';
import { withSection } from './helpers.js';
// We are re-exporting these from here to ensure that *.d.ts generation is correct
export type { AccountId } from '@polkadot/types/interfaces';
@@ -4,15 +4,15 @@
import type { Observable } from 'rxjs';
import type { Option, u32 } from '@polkadot/types';
import type { Hash, Proposal, Votes } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveCollectiveProposal } from '../types';
import type { Collective } from './types';
import type { DeriveApi, DeriveCollectiveProposal } from '../types.js';
import type { Collective } from './types.js';
import { catchError, combineLatest, map, of, switchMap } from 'rxjs';
import { isFunction } from '@polkadot/util';
import { firstObservable } from '../util';
import { callMethod, withSection } from './helpers';
import { firstObservable } from '../util/index.js';
import { callMethod, withSection } from './helpers.js';
// We are re-exporting these from here to ensure that *.d.ts generation is correct
export type { Option, u32 } from '@polkadot/types';
+2 -2
View File
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { BN } from '@polkadot/util';
import type { DeriveApi, DeriveContractFees } from '../types';
import type { DeriveApi, DeriveContractFees } from '../types.js';
import { map, of } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
type ResultV2 = [BN, BN, BN, BN, BN, BN, BN, BN, BN, BN];
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './fees';
export * from './fees.js';
+3 -3
View File
@@ -1,10 +1,10 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { hasProposals as collectiveHasProposals, members as collectiveMembers, prime as collectivePrime, proposal as collectiveProposal, proposalCount as collectiveProposalCount, proposalHashes as collectiveProposalHashes, proposals as collectiveProposals } from '../collective';
import { hasProposals as collectiveHasProposals, members as collectiveMembers, prime as collectivePrime, proposal as collectiveProposal, proposalCount as collectiveProposalCount, proposalHashes as collectiveProposalHashes, proposals as collectiveProposals } from '../collective/index.js';
export * from './votes';
export * from './votesOf';
export * from './votes.js';
export * from './votesOf.js';
export const members = collectiveMembers('council');
+2 -2
View File
@@ -7,11 +7,11 @@ import type { Vec } from '@polkadot/types';
import type { AccountId, Balance } from '@polkadot/types/interfaces';
import type { PalletElectionsPhragmenVoter } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveApi, DeriveCouncilVote, DeriveCouncilVotes } from '../types';
import type { DeriveApi, DeriveCouncilVote, DeriveCouncilVotes } from '../types.js';
import { combineLatest, map, of } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
// Voter is current tuple is 2.x-era
type VoteEntry = PalletElectionsPhragmenVoter | ITuple<[Balance, Vec<AccountId>]>;
+2 -2
View File
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { AccountId } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveCouncilVote } from '../types';
import type { DeriveApi, DeriveCouncilVote } from '../types.js';
import { map } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function votesOf (instanceId: string, api: DeriveApi): (accountId: string | Uint8Array | AccountId) => Observable<DeriveCouncilVote> {
return memo(instanceId, (accountId: string | Uint8Array | AccountId): Observable<DeriveCouncilVote> =>
@@ -5,14 +5,14 @@ import type { Observable } from 'rxjs';
import type { Option, u32 } from '@polkadot/types';
import type { PolkadotRuntimeCommonCrowdloanFundInfo } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { map } from 'rxjs';
import { u8aConcat, u8aToHex } from '@polkadot/util';
import { blake2AsU8a } from '@polkadot/util-crypto';
import { memo } from '../util';
import { memo } from '../util/index.js';
interface AllInfo extends PolkadotRuntimeCommonCrowdloanFundInfo {
// previously it was named trieIndex
@@ -4,14 +4,14 @@
import type { Observable } from 'rxjs';
import type { StorageKey } from '@polkadot/types';
import type { BN } from '@polkadot/util';
import type { DeriveApi, DeriveContributions } from '../types';
import type { DeriveApi, DeriveContributions } from '../types.js';
import { BehaviorSubject, combineLatest, EMPTY, map, of, startWith, switchMap, tap, toArray } from 'rxjs';
import { arrayFlatten, isFunction, nextTick } from '@polkadot/util';
import { memo } from '../util';
import { extractContributed } from './util';
import { memo } from '../util/index.js';
import { extractContributed } from './util.js';
interface Changes {
added: string[];
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './childKey';
export * from './contributions';
export * from './ownContributions';
export * from './childKey.js';
export * from './contributions.js';
export * from './ownContributions.js';
@@ -3,14 +3,14 @@
import type { Observable } from 'rxjs';
import type { BN } from '@polkadot/util';
import type { DeriveApi, DeriveOwnContributions } from '../types';
import type { DeriveApi, DeriveOwnContributions } from '../types.js';
import { combineLatest, EMPTY, map, of, startWith, switchMap } from 'rxjs';
import { objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { extractContributed } from './util';
import { memo } from '../util/index.js';
import { extractContributed } from './util.js';
function _getValues (api: DeriveApi, childKey: string, keys: string[]): Observable<DeriveOwnContributions> {
// We actually would love to use multi-keys https://github.com/paritytech/substrate/issues/9203
@@ -7,15 +7,15 @@ import type { BlockNumber, Call, Hash, ReferendumIndex, Scheduled } from '@polka
import type { FrameSupportPreimagesBounded, PalletSchedulerScheduled } from '@polkadot/types/lookup';
import type { Codec, ITuple } from '@polkadot/types/types';
import type { HexString } from '@polkadot/util/types';
import type { DeriveApi, DeriveDispatch, DeriveProposalImage } from '../types';
import type { DeriveApi, DeriveDispatch, DeriveProposalImage } from '../types.js';
import { catchError, combineLatest, map, of, switchMap } from 'rxjs';
import { Enum } from '@polkadot/types';
import { isFunction, objectSpread, stringToHex } from '@polkadot/util';
import { memo } from '../util';
import { getImageHashBounded } from './util';
import { memo } from '../util/index.js';
import { getImageHashBounded } from './util.js';
const DEMOCRACY_ID = stringToHex('democrac');
+11 -11
View File
@@ -1,14 +1,14 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './dispatchQueue';
export * from './locks';
export * from './nextExternal';
export * from './preimages';
export * from './proposals';
export * from './referendumIds';
export * from './referendums';
export * from './referendumsActive';
export * from './referendumsFinished';
export * from './referendumsInfo';
export * from './sqrtElectorate';
export * from './dispatchQueue.js';
export * from './locks.js';
export * from './nextExternal.js';
export * from './preimages.js';
export * from './proposals.js';
export * from './referendumIds.js';
export * from './referendums.js';
export * from './referendumsActive.js';
export * from './referendumsFinished.js';
export * from './referendumsInfo.js';
export * from './sqrtElectorate.js';
+2 -2
View File
@@ -5,13 +5,13 @@ import type { Observable } from 'rxjs';
import type { AccountId, ReferendumInfoTo239, Vote } from '@polkadot/types/interfaces';
import type { PalletDemocracyReferendumInfo, PalletDemocracyVoteVoting } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import type { DeriveApi, DeriveDemocracyLock } from '../types';
import type { DeriveApi, DeriveDemocracyLock } from '../types.js';
import { map, of, switchMap } from 'rxjs';
import { BN_ZERO, isUndefined } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
type ReferendumInfoFinished = PalletDemocracyReferendumInfo['asFinished'];
type VotingDelegating = PalletDemocracyVoteVoting['asDelegating'];
@@ -6,12 +6,12 @@ import type { Option } from '@polkadot/types';
import type { H256 } from '@polkadot/types/interfaces';
import type { FrameSupportPreimagesBounded, PalletDemocracyVoteThreshold } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveApi, DeriveProposalExternal } from '../types';
import type { DeriveApi, DeriveProposalExternal } from '../types.js';
import { map, of, switchMap } from 'rxjs';
import { memo } from '../util';
import { getImageHashBounded } from './util';
import { memo } from '../util/index.js';
import { getImageHashBounded } from './util.js';
function withImage (api: DeriveApi, nextOpt: Option<ITuple<[H256 | FrameSupportPreimagesBounded, PalletDemocracyVoteThreshold]>>): Observable<DeriveProposalExternal | null> {
if (nextOpt.isNone) {
@@ -7,14 +7,14 @@ import type { FrameSupportPreimagesBounded, PalletPreimageRequestStatus } from '
import type { Bytes, Option } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
import type { HexString } from '@polkadot/util/types';
import type { DeriveApi, DeriveProposalImage } from '../types';
import type { DeriveApi, DeriveProposalImage } from '../types.js';
import { map, of, switchMap } from 'rxjs';
import { BN_ZERO, isFunction } from '@polkadot/util';
import { firstMemo, memo } from '../util';
import { getImageHashBounded } from './util';
import { firstMemo, memo } from '../util/index.js';
import { getImageHashBounded } from './util.js';
type PreimageInfo = [Bytes, AccountId, Balance, BlockNumber];
type OldPreimage = ITuple<PreimageInfo>;
@@ -6,14 +6,14 @@ import type { Option, Vec } from '@polkadot/types';
import type { AccountId, Balance, Hash, PropIndex } from '@polkadot/types/interfaces';
import type { FrameSupportPreimagesBounded } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveApi, DeriveProposal, DeriveProposalImage } from '../types';
import type { DeriveApi, DeriveProposal, DeriveProposalImage } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { isFunction, objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { getImageHashBounded } from './util';
import { memo } from '../util/index.js';
import { getImageHashBounded } from './util.js';
type DepositorsNew = Option<ITuple<[Vec<AccountId>, Balance]>>;
type DepositorsOld = Option<ITuple<[Balance, Vec<AccountId>]>>;

Some files were not shown because too many files have changed in this diff Show More