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
+2 -2
View File
@@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyJson, Codec, Inspect, IU8a, IVec, Registry } from '../types';
import type { AnyJson, Codec, Inspect, IU8a, IVec, Registry } from '../types/index.js';
import { compactToU8a, u8aConcatStrict, u8aToHex } from '@polkadot/util';
import { compareArray } from '../utils/compareArray';
import { compareArray } from '../utils/compareArray.js';
/**
* @name AbstractArray
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyJson, BareOpts, Codec, Inspect, IU8a, Registry } from '../types';
import type { AnyJson, BareOpts, Codec, Inspect, IU8a, Registry } from '../types/index.js';
/**
* @name Base
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyNumber, Inspect, INumber, IU8a, Registry, ToBn, UIntBitLength } from '../types';
import type { AnyNumber, Inspect, INumber, IU8a, Registry, ToBn, UIntBitLength } from '../types/index.js';
import { BN, BN_BILLION, BN_HUNDRED, BN_MILLION, BN_QUINTILL, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isBigInt, isBn, isFunction, isHex, isNumber, isObject, isString, isU8a, u8aToBn, u8aToNumber } from '@polkadot/util';
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyJson, BareOpts, CodecObject, Inspect, IU8a, Registry, ToString } from '../types';
import type { AnyJson, BareOpts, CodecObject, Inspect, IU8a, Registry, ToString } from '../types/index.js';
/**
* @name Object
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { AbstractArray } from './Array';
export { AbstractBase } from './Base';
export { AbstractInt } from './Int';
export { AbstractArray } from './Array.js';
export { AbstractBase } from './Base.js';
export { AbstractInt } from './Int.js';
@@ -7,7 +7,7 @@ import { TypeRegistry } from '@polkadot/types';
import { CodecDate, Compact, U32 } from '@polkadot/types-codec';
import { BN } from '@polkadot/util';
import { perf } from '../test/performance';
import { perf } from '../test/performance.js';
const CompactU32 = Compact.with(U32);
+2 -2
View File
@@ -3,11 +3,11 @@
import type { BN } from '@polkadot/util';
import type { HexString } from '@polkadot/util/types';
import type { AnyJson, AnyNumber, CodecClass, ICompact, Inspect, INumber, IU8a, Registry } from '../types';
import type { AnyJson, AnyNumber, CodecClass, ICompact, Inspect, INumber, IU8a, Registry } from '../types/index.js';
import { compactFromU8a, compactFromU8aLim, compactToU8a, isU8a } from '@polkadot/util';
import { typeToConstructor } from '../utils';
import { typeToConstructor } from '../utils/index.js';
interface Options<T> {
definition?: CodecClass<T>;
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyJson, Codec, CodecClass, Inspect, IU8a, Registry } from '../types';
import type { AnyJson, Codec, CodecClass, Inspect, IU8a, Registry } from '../types/index.js';
/**
* @name DoNotConstruct
+1 -1
View File
@@ -9,7 +9,7 @@ import { TypeRegistry } from '@polkadot/types';
import { Enum, Null, Text, U32 } from '@polkadot/types-codec';
import { u8aToHex } from '@polkadot/util';
import { perf } from '../test/performance';
import { perf } from '../test/performance.js';
const PEnum = Enum.with({ a: U32, b: U32 });
+3 -3
View File
@@ -2,12 +2,12 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyJson, Codec, CodecClass, IEnum, Inspect, IU8a, Registry } from '../types';
import type { AnyJson, Codec, CodecClass, IEnum, Inspect, IU8a, Registry } from '../types/index.js';
import { isHex, isNumber, isObject, isString, isU8a, objectProperties, stringCamelCase, stringify, stringPascalCase, u8aConcatStrict, u8aToHex, u8aToU8a } from '@polkadot/util';
import { mapToTypeMap, typesToMap } from '../utils';
import { Null } from './Null';
import { mapToTypeMap, typesToMap } from '../utils/index.js';
import { Null } from './Null.js';
// export interface, this is used in Enum.with, so required as public by TS
export interface EnumCodecClass<T = Codec> {
+2 -2
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AnyNumber, CodecClass, Registry, UIntBitLength } from '../types';
import type { AnyNumber, CodecClass, Registry, UIntBitLength } from '../types/index.js';
import { AbstractInt } from '../abstract/Int';
import { AbstractInt } from '../abstract/Int.js';
/**
* @name Int
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { Codec, Inspect, IU8a, Registry } from '../types';
import type { Codec, Inspect, IU8a, Registry } from '../types/index.js';
import { isNull } from '@polkadot/util';
+3 -3
View File
@@ -2,12 +2,12 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyJson, Codec, CodecClass, Inspect, IOption, IU8a, Registry } from '../types';
import type { AnyJson, Codec, CodecClass, Inspect, IOption, IU8a, Registry } from '../types/index.js';
import { isCodec, isNull, isU8a, isUndefined, u8aToHex } from '@polkadot/util';
import { typeToConstructor } from '../utils';
import { Null } from './Null';
import { typeToConstructor } from '../utils/index.js';
import { Null } from './Null.js';
interface Options<T> {
definition?: CodecClass<T>;
+2 -2
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Codec, CodecClass, IResult, Registry } from '../types';
import type { Codec, CodecClass, IResult, Registry } from '../types/index.js';
import { Enum } from './Enum';
import { Enum } from './Enum.js';
/**
* @name Result
+3 -3
View File
@@ -1,12 +1,12 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AnyTupleValue, Codec, CodecClass, Inspect, ITuple, Registry } from '../types';
import type { AnyTupleValue, Codec, CodecClass, Inspect, ITuple, Registry } from '../types/index.js';
import { isFunction, isHex, isString, isU8a, stringify, u8aConcatStrict, u8aToU8a } from '@polkadot/util';
import { AbstractArray } from '../abstract/Array';
import { decodeU8a, mapToTypeMap, typeToConstructor } from '../utils';
import { AbstractArray } from '../abstract/Array.js';
import { decodeU8a, mapToTypeMap, typeToConstructor } from '../utils/index.js';
type TupleType = (CodecClass | string);
+1 -1
View File
@@ -7,7 +7,7 @@ import { TypeRegistry } from '@polkadot/types';
import { UInt } from '@polkadot/types-codec';
import { BN, BN_TWO, isBn } from '@polkadot/util';
import { perf } from '../test/performance';
import { perf } from '../test/performance.js';
describe('UInt', (): void => {
const registry = new TypeRegistry();
+2 -2
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AnyNumber, CodecClass, Registry, UIntBitLength } from '../types';
import type { AnyNumber, CodecClass, Registry, UIntBitLength } from '../types/index.js';
import { AbstractInt } from '../abstract/Int';
import { AbstractInt } from '../abstract/Int.js';
/**
* @name UInt
+1 -1
View File
@@ -11,7 +11,7 @@ import { Text, u32, Vec } from '@polkadot/types-codec';
import rpcMetadata from '@polkadot/types-support/metadata/static-substrate';
import { decodeAddress, randomAsU8a } from '@polkadot/util-crypto';
import { perf } from '../test/performance';
import { perf } from '../test/performance.js';
const registry = new TypeRegistry();
const metadata = new Metadata(registry, rpcMetadata);
+3 -3
View File
@@ -2,12 +2,12 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { Codec, CodecClass, Registry } from '../types';
import type { Codec, CodecClass, Registry } from '../types/index.js';
import { compactFromU8aLim, isHex, isU8a, logger, stringify, u8aToU8a } from '@polkadot/util';
import { AbstractArray } from '../abstract/Array';
import { decodeU8aVec, typeToConstructor } from '../utils';
import { AbstractArray } from '../abstract/Array.js';
import { decodeU8aVec, typeToConstructor } from '../utils/index.js';
const MAX_LENGTH = 64 * 1024;
+2 -2
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Codec } from '../types';
import type { Codec } from '../types/index.js';
import { AbstractArray } from '../abstract/Array';
import { AbstractArray } from '../abstract/Array.js';
/**
* @name VecAny
+4 -4
View File
@@ -2,13 +2,13 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { Codec, CodecClass, Inspect, Registry } from '../types';
import type { Codec, CodecClass, Inspect, Registry } from '../types/index.js';
import { isU8a, u8aConcatStrict } from '@polkadot/util';
import { AbstractArray } from '../abstract/Array';
import { decodeU8aVec, typeToConstructor } from '../utils';
import { decodeVec } from './Vec';
import { AbstractArray } from '../abstract/Array.js';
import { decodeU8aVec, typeToConstructor } from '../utils/index.js';
import { decodeVec } from './Vec.js';
interface Options<T> {
definition?: CodecClass<T>;
+12 -12
View File
@@ -1,15 +1,15 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { Compact } from './Compact';
export { DoNotConstruct } from './DoNotConstruct';
export { Enum } from './Enum';
export { Int } from './Int';
export { Null } from './Null';
export { Option } from './Option';
export { Result } from './Result';
export { Tuple } from './Tuple';
export { UInt } from './UInt';
export { Vec } from './Vec';
export { VecAny } from './VecAny';
export { VecFixed } from './VecFixed';
export { Compact } from './Compact.js';
export { DoNotConstruct } from './DoNotConstruct.js';
export { Enum } from './Enum.js';
export { Int } from './Int.js';
export { Null } from './Null.js';
export { Option } from './Option.js';
export { Result } from './Result.js';
export { Tuple } from './Tuple.js';
export { UInt } from './UInt.js';
export { Vec } from './Vec.js';
export { VecAny } from './VecAny.js';
export { VecFixed } from './VecFixed.js';
+7 -7
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { packageInfo } from './packageInfo';
export { packageInfo } from './packageInfo.js';
export * from './abstract';
export * from './base';
export * from './extended';
export * from './native';
export * from './primitive';
export * from './utils';
export * from './abstract/index.js';
export * from './base/index.js';
export * from './extended/index.js';
export * from './native/index.js';
export * from './primitive/index.js';
export * from './utils/index.js';
@@ -5,7 +5,7 @@ import '@polkadot/types-augment';
import { TypeRegistry } from '@polkadot/types';
import { U32 } from '.';
import { U32 } from './index.js';
const registry = new TypeRegistry();
+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);
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Codec, CodecClass, Registry } from '../types';
import type { Codec, CodecClass, Registry } from '../types/index.js';
import { CodecMap } from './Map';
import { CodecMap } from './Map.js';
export class BTreeMap<K extends Codec = Codec, V extends Codec = Codec> extends CodecMap<K, V> {
public static with<K extends Codec, V extends Codec> (keyType: CodecClass<K> | string, valType: CodecClass<V> | string): CodecClass<CodecMap<K, V>> {
@@ -8,7 +8,7 @@ import type { CodecClass, CodecTo } from '@polkadot/types-codec/types';
import { TypeRegistry } from '@polkadot/types';
import { BTreeSet, Enum, I32, Struct, Text, Tuple, U32 } from '@polkadot/types-codec';
import { ITuple } from '../types/interfaces';
import { ITuple } from '../types/interfaces.js';
const registry = new TypeRegistry();
@@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyJson, Codec, CodecClass, Inspect, ISet, IU8a, Registry } from '../types';
import type { AnyJson, Codec, CodecClass, Inspect, ISet, IU8a, Registry } from '../types/index.js';
import { compactFromU8aLim, compactToU8a, isHex, isU8a, logger, stringify, u8aConcatStrict, u8aToHex, u8aToU8a } from '@polkadot/util';
import { compareSet, decodeU8aVec, sortSet, typeToConstructor } from '../utils';
import { compareSet, decodeU8aVec, sortSet, typeToConstructor } from '../utils/index.js';
const l = logger('BTreeSet');
@@ -6,7 +6,7 @@
import { TypeRegistry } from '@polkadot/types';
import { hexToU8a } from '@polkadot/util';
import { BitVec } from './';
import { BitVec } from './index.js';
// form Inclusion BitVec<lsb0, u8>
const TESTS = ['0x00', '0x0817', '0x0837', '0x087b', '0x0c33'];
+2 -2
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AnyU8a, Inspect, Registry } from '../types';
import type { AnyU8a, Inspect, Registry } from '../types/index.js';
import { compactFromU8aLim, compactToU8a, isString, u8aConcatStrict, u8aToU8a } from '@polkadot/util';
import { Raw } from '../native/Raw';
import { Raw } from '../native/Raw.js';
/** @internal */
function decodeBitVecU8a (value?: Uint8Array): [number, Uint8Array] {
+2 -2
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AnyU8a, Inspect, Registry } from '../types';
import type { AnyU8a, Inspect, Registry } from '../types/index.js';
import { compactAddLength, compactFromU8aLim, compactToU8a, isString, isU8a, u8aToU8a } from '@polkadot/util';
import { Raw } from '../native/Raw';
import { Raw } from '../native/Raw.js';
// Bytes are used for things like on-chain code, so it has a healthy limit
const MAX_LENGTH = 10 * 1024 * 1024;
+2 -2
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Codec, CodecClass, Registry } from '../types';
import type { Codec, CodecClass, Registry } from '../types/index.js';
import { CodecMap } from './Map';
import { CodecMap } from './Map.js';
export class HashMap<K extends Codec = Codec, V extends Codec = Codec> extends CodecMap<K, V> {
public static with<K extends Codec, V extends Codec> (keyType: CodecClass<K> | string, valType: CodecClass<V> | string): CodecClass<CodecMap<K, V>> {
+5 -5
View File
@@ -2,12 +2,12 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { Codec, CodecClass, Registry } from '../types';
import type { Codec, CodecClass, Registry } from '../types/index.js';
import { Option } from '../base/Option';
import { Tuple } from '../base/Tuple';
import { Vec } from '../base/Vec';
import { Struct } from '../native/Struct';
import { Option } from '../base/Option.js';
import { Tuple } from '../base/Tuple.js';
import { Vec } from '../base/Vec.js';
import { Struct } from '../native/Struct.js';
type TypeWithValues = [CodecClass, any[]];
+6 -6
View File
@@ -2,15 +2,15 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyJson, Codec, CodecClass, IMap, Inspect, IU8a, Registry } from '../types';
import type { AnyJson, Codec, CodecClass, IMap, Inspect, IU8a, Registry } from '../types/index.js';
import { compactFromU8aLim, compactToU8a, isHex, isObject, isU8a, logger, stringify, u8aConcatStrict, u8aToHex, u8aToU8a } from '@polkadot/util';
import { AbstractArray } from '../abstract/Array';
import { Enum } from '../base/Enum';
import { Raw } from '../native/Raw';
import { Struct } from '../native/Struct';
import { compareMap, decodeU8a, sortMap, typeToConstructor } from '../utils';
import { AbstractArray } from '../abstract/Array.js';
import { Enum } from '../base/Enum.js';
import { Raw } from '../native/Raw.js';
import { Struct } from '../native/Struct.js';
import { compareMap, decodeU8a, sortMap, typeToConstructor } from '../utils/index.js';
const l = logger('Map');
@@ -2,12 +2,12 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyBool, Inspect, Registry } from '../types';
import type { AnyBool, Inspect, Registry } from '../types/index.js';
import { isHex, isU8a, u8aToU8a } from '@polkadot/util';
import { Option } from '../base/Option';
import { bool as Bool } from '../native/Bool';
import { Option } from '../base/Option.js';
import { bool as Bool } from '../native/Bool.js';
function decodeU8a (registry: Registry, value: Uint8Array): null | Bool {
// Encoded as -
+2 -2
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AnyTuple, CodecClass, INumber, Registry } from '../types';
import type { AnyTuple, CodecClass, INumber, Registry } from '../types/index.js';
import { Tuple } from '../base/Tuple';
import { Tuple } from '../base/Tuple.js';
type RangeType = 'Range' | 'RangeInclusive';
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AnyTuple, CodecClass, INumber, Registry } from '../types';
import type { AnyTuple, CodecClass, INumber, Registry } from '../types/index.js';
import { Range } from './Range';
import { Range } from './Range.js';
export class RangeInclusive<T extends INumber = INumber> extends Range<T> {
constructor (registry: Registry, Type: CodecClass<T> | string, value?: AnyTuple) {
+3 -3
View File
@@ -1,10 +1,10 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Registry } from '../types';
import type { Registry } from '../types/index.js';
import { Text } from '../native/Text';
import { sanitize } from '../utils';
import { Text } from '../native/Text.js';
import { sanitize } from '../utils/index.js';
/**
* @name Type
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AnyU8a, CodecClass, Registry, U8aBitLength } from '../types';
import type { AnyU8a, CodecClass, Registry, U8aBitLength } from '../types/index.js';
import { isU8a, u8aToU8a } from '@polkadot/util';
import { Raw } from '../native/Raw';
import { Raw } from '../native/Raw.js';
/** @internal */
function decodeU8aFixed (value: AnyU8a, bitLength: U8aBitLength): [AnyU8a, number] {
@@ -1,13 +1,13 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AnyJson, AnyU8a, Codec, CodecClass, Inspect, Registry } from '../types';
import type { AnyJson, AnyU8a, Codec, CodecClass, Inspect, Registry } from '../types/index.js';
import { compactAddLength, compactStripLength, compactToU8a, isHex, isU8a, u8aToU8a } from '@polkadot/util';
import { Raw } from '../native/Raw';
import { typeToConstructor } from '../utils';
import { Bytes } from './Bytes';
import { Raw } from '../native/Raw.js';
import { typeToConstructor } from '../utils/index.js';
import { Bytes } from './Bytes.js';
type OpaqueName = 'WrapperKeepOpaque' | 'WrapperOpaque';
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Codec, CodecClass, Registry } from '../types';
import type { Codec, CodecClass, Registry } from '../types/index.js';
import { WrapperKeepOpaque } from './WrapperKeepOpaque';
import { WrapperKeepOpaque } from './WrapperKeepOpaque.js';
export class WrapperOpaque<T extends Codec> extends WrapperKeepOpaque<T> {
constructor (registry: Registry, typeName: CodecClass<T> | string, value?: unknown) {
+14 -14
View File
@@ -1,17 +1,17 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { BitVec } from './BitVec';
export { BTreeMap } from './BTreeMap';
export { BTreeSet } from './BTreeSet';
export { Bytes } from './Bytes';
export { HashMap } from './HashMap';
export { Linkage } from './Linkage';
export { CodecMap, CodecMap as Map } from './Map';
export { OptionBool } from './OptionBool';
export { Range } from './Range';
export { RangeInclusive } from './RangeInclusive';
export { Type } from './Type';
export { U8aFixed } from './U8aFixed';
export { WrapperKeepOpaque } from './WrapperKeepOpaque';
export { WrapperOpaque } from './WrapperOpaque';
export { BitVec } from './BitVec.js';
export { BTreeMap } from './BTreeMap.js';
export { BTreeSet } from './BTreeSet.js';
export { Bytes } from './Bytes.js';
export { HashMap } from './HashMap.js';
export { Linkage } from './Linkage.js';
export { CodecMap, CodecMap as Map } from './Map.js';
export { OptionBool } from './OptionBool.js';
export { Range } from './Range.js';
export { RangeInclusive } from './RangeInclusive.js';
export { Type } from './Type.js';
export { U8aFixed } from './U8aFixed.js';
export { WrapperKeepOpaque } from './WrapperKeepOpaque.js';
export { WrapperOpaque } from './WrapperOpaque.js';
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/types-codec 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/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
export * from './index.js';
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyBool, Codec, Inspect, IU8a, Registry } from '../types';
import type { AnyBool, Codec, Inspect, IU8a, Registry } from '../types/index.js';
import { isU8a, u8aToHex } from '@polkadot/util';
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyNumber, Inspect, INumber, IU8a, Registry, UIntBitLength } from '../types';
import type { AnyNumber, Inspect, INumber, IU8a, Registry, UIntBitLength } from '../types/index.js';
import { BN, bnToBn, bnToHex, bnToU8a, isString, isU8a, u8aToBn } from '@polkadot/util';
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyFloat, CodecClass, IFloat, Inspect, IU8a, Registry } from '../types';
import type { AnyFloat, CodecClass, IFloat, Inspect, IU8a, Registry } from '../types/index.js';
import { floatToU8a, isHex, isU8a, u8aToFloat, u8aToHex, u8aToU8a } from '@polkadot/util';
+2 -2
View File
@@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyJson, Codec, Inspect, IU8a, Registry } from '../types';
import type { AnyJson, Codec, Inspect, IU8a, Registry } from '../types/index.js';
import { isFunction, objectProperties, stringify } from '@polkadot/util';
import { compareMap } from '../utils';
import { compareMap } from '../utils/index.js';
/** @internal */
function decodeJson (value?: Record<string, unknown> | null): [string, any][] {
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyJson, AnyU8a, Inspect, IU8a, Registry } from '../types';
import type { AnyJson, AnyU8a, Inspect, IU8a, Registry } from '../types/index.js';
import { isAscii, isUndefined, isUtf8, u8aToHex, u8aToString, u8aToU8a } from '@polkadot/util';
+2 -2
View File
@@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { CodecClass, Inspect, ISet, IU8a, Registry } from '../types';
import type { CodecClass, Inspect, ISet, IU8a, Registry } from '../types/index.js';
import { BN, bnToBn, bnToU8a, isBn, isNumber, isString, isU8a, isUndefined, objectProperties, stringify, stringPascalCase, u8aToBn, u8aToHex, u8aToU8a } from '@polkadot/util';
import { compareArray } from '../utils';
import { compareArray } from '../utils/index.js';
type SetValues = Record<string, number | BN>;
@@ -10,7 +10,7 @@ import type { CodecTo } from '@polkadot/types-codec/types';
import { TypeRegistry } from '@polkadot/types';
import { Bool, Enum, Option, Struct, Text, U32, Vec } from '@polkadot/types-codec';
import { TEST_A } from './Struct.data';
import { TEST_A } from './Struct.data.js';
describe('Struct', (): void => {
const registry = new TypeRegistry();
+2 -2
View File
@@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyJson, BareOpts, Codec, CodecClass, Inspect, IStruct, IU8a, Registry } from '../types';
import type { AnyJson, BareOpts, Codec, CodecClass, Inspect, IStruct, IU8a, Registry } from '../types/index.js';
import { isBoolean, isHex, isObject, isU8a, isUndefined, objectProperties, stringCamelCase, stringify, u8aConcatStrict, u8aToHex, u8aToU8a } from '@polkadot/util';
import { compareMap, decodeU8aStruct, mapToTypeMap, typesToMap } from '../utils';
import { compareMap, decodeU8aStruct, mapToTypeMap, typesToMap } from '../utils/index.js';
type TypesDef<T = Codec> = Record<string, string | CodecClass<T>>;
+1 -1
View File
@@ -9,7 +9,7 @@ import { TypeRegistry } from '@polkadot/types';
import { Bytes, Raw, Text } from '@polkadot/types-codec';
import { stringToU8a } from '@polkadot/util';
import { perf } from '../test/performance';
import { perf } from '../test/performance.js';
describe('Text', (): void => {
const registry = new TypeRegistry();
+2 -2
View File
@@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyString, AnyU8a, Inspect, IText, IU8a, Registry } from '../types';
import type { AnyString, AnyU8a, Inspect, IText, IU8a, Registry } from '../types/index.js';
import { compactAddLength, compactFromU8aLim, compactToU8a, hexToU8a, isHex, isString, isU8a, stringToU8a, u8aToHex, u8aToString } from '@polkadot/util';
import { Raw } from './Raw';
import { Raw } from './Raw.js';
const MAX_LENGTH = 128 * 1024;
+8 -8
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { bool, bool as Bool } from './Bool';
export { CodecDate, CodecDate as Date } from './Date';
export { Float } from './Float';
export { Json } from './Json';
export { Raw } from './Raw';
export { CodecSet, CodecSet as Set } from './Set';
export { Struct } from './Struct';
export { Text } from './Text';
export { bool, bool as Bool } from './Bool.js';
export { CodecDate, CodecDate as Date } from './Date.js';
export { Float } from './Float.js';
export { Json } from './Json.js';
export { Raw } from './Raw.js';
export { CodecSet, CodecSet as Set } from './Set.js';
export { Struct } from './Struct.js';
export { Text } from './Text.js';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Float } from '../native/Float';
import { Float } from '../native/Float.js';
/**
* @name f32
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Float } from '../native/Float';
import { Float } from '../native/Float.js';
/**
* @name f64
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Int } from '../base/Int';
import { Int } from '../base/Int.js';
/**
* @name i128
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Int } from '../base/Int';
import { Int } from '../base/Int.js';
/**
* @name i16
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Int } from '../base/Int';
import { Int } from '../base/Int.js';
/**
* @name i256
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Int } from '../base/Int';
import { Int } from '../base/Int.js';
/**
* @name i32
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Int } from '../base/Int';
import { Int } from '../base/Int.js';
/**
* @name i64
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Int } from '../base/Int';
import { Int } from '../base/Int.js';
/**
* @name i8
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { UInt } from '../base/UInt';
import { UInt } from '../base/UInt.js';
/**
* @name u128
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { UInt } from '../base/UInt';
import { UInt } from '../base/UInt.js';
/**
* @name u16
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { UInt } from '../base/UInt';
import { UInt } from '../base/UInt.js';
/**
* @name u256
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { UInt } from '../base/UInt';
import { UInt } from '../base/UInt.js';
/**
* @name u32
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { UInt } from '../base/UInt';
import { UInt } from '../base/UInt.js';
/**
* @name u64
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { UInt } from '../base/UInt';
import { UInt } from '../base/UInt.js';
/**
* @name u8
+2 -2
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Registry } from '../types';
import type { Registry } from '../types/index.js';
import { u32 } from './U32';
import { u32 } from './U32.js';
/**
* @name USize
+15 -15
View File
@@ -1,18 +1,18 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { f32, f32 as F32 } from './F32';
export { f64, f64 as F64 } from './F64';
export { i8, i8 as I8 } from './I8';
export { i16, i16 as I16 } from './I16';
export { i32, i32 as I32 } from './I32';
export { i64, i64 as I64 } from './I64';
export { i128, i128 as I128 } from './I128';
export { i256, i256 as I256 } from './I256';
export { u8, u8 as U8 } from './U8';
export { u16, u16 as U16 } from './U16';
export { u32, u32 as U32 } from './U32';
export { u64, u64 as U64 } from './U64';
export { u128, u128 as U128 } from './U128';
export { u256, u256 as U256 } from './U256';
export { usize, usize as USize } from './USize';
export { f32, f32 as F32 } from './F32.js';
export { f64, f64 as F64 } from './F64.js';
export { i8, i8 as I8 } from './I8.js';
export { i16, i16 as I16 } from './I16.js';
export { i32, i32 as I32 } from './I32.js';
export { i64, i64 as I64 } from './I64.js';
export { i128, i128 as I128 } from './I128.js';
export { i256, i256 as I256 } from './I256.js';
export { u8, u8 as U8 } from './U8.js';
export { u16, u16 as U16 } from './U16.js';
export { u32, u32 as U32 } from './U32.js';
export { u64, u64 as U64 } from './U64.js';
export { u128, u128 as U128 } from './U128.js';
export { u256, u256 as U256 } from './U256.js';
export { usize, usize as USize } from './USize.js';
+3 -3
View File
@@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyJson, ToString } from './helpers';
import type { IU8a } from './interfaces';
import type { Registry } from './registry';
import type { AnyJson, ToString } from './helpers.js';
import type { IU8a } from './interfaces.js';
import type { Registry } from './registry.js';
export type BareOpts = boolean | Record<string, boolean>;
+1 -1
View File
@@ -3,7 +3,7 @@
import type { BN } from '@polkadot/util';
import type { HexString } from '@polkadot/util/types';
import type { Codec } from './codec';
import type { Codec } from './codec.js';
export type AnyJson = string | number | boolean | null | undefined | AnyJson[] | { [index: string]: AnyJson };
+4 -4
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './codec';
export * from './helpers';
export * from './interfaces';
export * from './registry';
export * from './codec.js';
export * from './helpers.js';
export * from './interfaces.js';
export * from './registry.js';
+2 -2
View File
@@ -3,8 +3,8 @@
// import type { SignOptions } from '@polkadot/keyring/types';
import type { BN } from '@polkadot/util';
import type { ArgsDef, Codec } from './codec';
import type { AnyTuple } from './helpers';
import type { ArgsDef, Codec } from './codec.js';
import type { AnyTuple } from './helpers.js';
export interface ICompact<T extends INumber = INumber> extends Codec {
toBigInt (): bigint;
+3 -3
View File
@@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
import type { BN } from '@polkadot/util';
import type { Codec, CodecClass } from './codec';
import type { AnyTuple, LookupString } from './helpers';
import type { ICompact, IEnum, IMap, IMethod, INumber, IOption, IResult, ISet, IStruct, ITuple, IU8a, IVec } from './interfaces';
import type { Codec, CodecClass } from './codec.js';
import type { AnyTuple, LookupString } from './helpers.js';
import type { ICompact, IEnum, IMap, IMethod, INumber, IOption, IResult, ISet, IStruct, ITuple, IU8a, IVec } from './interfaces.js';
export type OnlyCodec<K, T, Types> =
K extends keyof Types
@@ -3,7 +3,7 @@
import { isUndefined } from '@polkadot/util';
import { hasEq } from './util';
import { hasEq } from './util.js';
// NOTE These are used internally and when comparing objects, expects that
// when the second is an Codec[] that the first has to be as well
+1 -1
View File
@@ -3,7 +3,7 @@
import { isObject, isUndefined } from '@polkadot/util';
import { hasEq } from './util';
import { hasEq } from './util.js';
function hasMismatch (a?: unknown, b?: unknown): boolean {
return isUndefined(a) || (
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Codec, CodecClass, Registry } from '../types';
import type { Codec, CodecClass, Registry } from '../types/index.js';
import { u8aToHex } from '@polkadot/util';
+9 -9
View File
@@ -1,12 +1,12 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { compareArray } from './compareArray';
export { compareMap } from './compareMap';
export { compareSet } from './compareSet';
export { decodeU8a, decodeU8aStruct, decodeU8aVec } from './decodeU8a';
export { mapToTypeMap } from './mapToTypeMap';
export { typeToConstructor } from './typeToConstructor';
export { sanitize } from './sanitize';
export { sortAsc, sortSet, sortMap } from './sortValues';
export { typesToMap } from './typesToMap';
export { compareArray } from './compareArray.js';
export { compareMap } from './compareMap.js';
export { compareSet } from './compareSet.js';
export { decodeU8a, decodeU8aStruct, decodeU8aVec } from './decodeU8a.js';
export { mapToTypeMap } from './mapToTypeMap.js';
export { typeToConstructor } from './typeToConstructor.js';
export { sanitize } from './sanitize.js';
export { sortAsc, sortSet, sortMap } from './sortValues.js';
export { typesToMap } from './typesToMap.js';
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { CodecClass, Registry } from '../types';
import type { CodecClass, Registry } from '../types/index.js';
import { typeToConstructor } from './typeToConstructor';
import { typeToConstructor } from './typeToConstructor.js';
/**
* @description takes an input map of the form `{ [string]: string | CodecClass }` and returns a map of `{ [string]: CodecClass }`
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { AnyString } from '../types';
import { AnyString } from '../types/index.js';
type Mapper = (value: string) => string;
+2 -2
View File
@@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
import type { BN } from '@polkadot/util';
import type { Enum } from '../base/Enum';
import type { Codec } from '../types';
import type { Enum } from '../base/Enum.js';
import type { Codec } from '../types/index.js';
import { bnToBn, isBigInt, isBn, isFunction, isNumber, stringify } from '@polkadot/util';
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Codec, CodecClass, Registry } from '../types';
import type { Codec, CodecClass, Registry } from '../types/index.js';
import { isString } from '@polkadot/util';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { CodecClass, Registry } from '../types';
import type { CodecClass, Registry } from '../types/index.js';
export function typesToMap (registry: Registry, [Types, keys]: [CodecClass[], string[]]): Record<string, string> {
const result: Record<string, string> = {};