@@ -9,7 +9,7 @@ import U32 from '../primitive/U32';
|
||||
export const MAGIC_NUMBER = new U32(0x6174656d); // `meta`, reversed for Little Endian encoding
|
||||
|
||||
export default class MagicNumber extends U32 {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super(value);
|
||||
|
||||
assert(this.eq(MAGIC_NUMBER), `MagicNumber mismatch: expected ${MAGIC_NUMBER.toHex()}, found ${this.toHex()}`);
|
||||
|
||||
@@ -13,7 +13,7 @@ import MetadataVersioned from './MetadataVersioned';
|
||||
* The versioned runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class Metadata extends MetadataVersioned {
|
||||
public constructor (value?: Uint8Array | string) {
|
||||
constructor (value?: Uint8Array | string) {
|
||||
super(Metadata.decodeMetadata(value));
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ type MetaVersions = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
||||
type MetaAsX = 'asV0' | 'asV1' | 'asV2' | 'asV3' | 'asV4' | 'asV5' | 'asV6' | 'asV7';
|
||||
|
||||
class MetadataEnum extends Enum {
|
||||
public constructor (value?: any, index?: number) {
|
||||
constructor (value?: any, index?: number) {
|
||||
super({
|
||||
V0: 'MetadataV0', // once rolled-out, can replace this with MetadataDeprecated
|
||||
V1: 'MetadataV1', // once rolled-out, can replace this with MetadataDeprecated
|
||||
@@ -205,7 +205,7 @@ class MetadataEnum extends Enum {
|
||||
export default class MetadataVersioned extends Struct {
|
||||
private _converted: Map<number, MetaMapped> = new Map();
|
||||
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
magicNumber: MagicNumber,
|
||||
metadata: MetadataEnum
|
||||
|
||||
@@ -18,7 +18,7 @@ import { StorageFunctionMetadata } from './Storage';
|
||||
* The definition of a module in the system
|
||||
*/
|
||||
export class ModuleMetadataV2 extends Struct {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
@@ -70,7 +70,7 @@ export class ModuleMetadataV2 extends Struct {
|
||||
* The runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class MetadataV2 extends Struct implements MetadataInterface<ModuleMetadataV2> {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
modules: Vec.with(ModuleMetadataV2)
|
||||
}, value);
|
||||
|
||||
@@ -14,7 +14,7 @@ import Bytes from '../../primitive/Bytes';
|
||||
import Text from '../../primitive/Text';
|
||||
|
||||
export class StorageFunctionType extends Enum {
|
||||
public constructor (value?: any, index?: number) {
|
||||
constructor (value?: any, index?: number) {
|
||||
super({
|
||||
Type: 'PlainTypeV2',
|
||||
Map: 'MapTypeV2'
|
||||
@@ -83,7 +83,7 @@ export interface StorageFunctionMetadataValue {
|
||||
* The definition of a storage function
|
||||
*/
|
||||
export class StorageFunctionMetadata extends Struct {
|
||||
public constructor (value?: StorageFunctionMetadataValue | Uint8Array) {
|
||||
constructor (value?: StorageFunctionMetadataValue | Uint8Array) {
|
||||
super({
|
||||
name: 'Text',
|
||||
modifier: 'StorageFunctionModifierV2',
|
||||
|
||||
@@ -18,7 +18,7 @@ import { StorageFunctionMetadata } from './Storage';
|
||||
* The definition of a module in the system
|
||||
*/
|
||||
export class ModuleMetadataV3 extends Struct {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
@@ -70,7 +70,7 @@ export class ModuleMetadataV3 extends Struct {
|
||||
* The runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class MetadataV3 extends Struct implements MetadataInterface<ModuleMetadataV3> {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
modules: Vec.with(ModuleMetadataV3)
|
||||
}, value);
|
||||
|
||||
@@ -14,7 +14,7 @@ import Bytes from '../../primitive/Bytes';
|
||||
import Text from '../../primitive/Text';
|
||||
|
||||
export class StorageFunctionType extends Enum {
|
||||
public constructor (value?: any, index?: number) {
|
||||
constructor (value?: any, index?: number) {
|
||||
super({
|
||||
Type: 'PlainTypeV3',
|
||||
Map: 'MapTypeV3',
|
||||
@@ -104,7 +104,7 @@ export interface StorageFunctionMetadataValue {
|
||||
* The definition of a storage function
|
||||
*/
|
||||
export class StorageFunctionMetadata extends Struct {
|
||||
public constructor (value?: StorageFunctionMetadataValue | Uint8Array) {
|
||||
constructor (value?: StorageFunctionMetadataValue | Uint8Array) {
|
||||
super({
|
||||
name: 'Text',
|
||||
modifier: 'StorageFunctionModifierV3',
|
||||
|
||||
@@ -17,7 +17,7 @@ import { StorageFunctionMetadata } from './Storage';
|
||||
* The definition of a module in the system
|
||||
*/
|
||||
export class ModuleMetadataV4 extends Struct {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
@@ -69,7 +69,7 @@ export class ModuleMetadataV4 extends Struct {
|
||||
* The runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class MetadataV4 extends Struct implements MetadataInterface<ModuleMetadataV4> {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
modules: Vec.with(ModuleMetadataV4)
|
||||
}, value);
|
||||
|
||||
@@ -14,7 +14,7 @@ import Bytes from '../../primitive/Bytes';
|
||||
import Text from '../../primitive/Text';
|
||||
|
||||
export class StorageFunctionType extends Enum {
|
||||
public constructor (value?: any, index?: number) {
|
||||
constructor (value?: any, index?: number) {
|
||||
super({
|
||||
Type: 'PlainTypeV4',
|
||||
Map: 'MapTypeV4',
|
||||
@@ -104,7 +104,7 @@ export interface StorageFunctionMetadataValue {
|
||||
* The definition of a storage function
|
||||
*/
|
||||
export class StorageFunctionMetadata extends Struct {
|
||||
public constructor (value?: StorageFunctionMetadataValue | Uint8Array) {
|
||||
constructor (value?: StorageFunctionMetadataValue | Uint8Array) {
|
||||
super({
|
||||
name: 'Text',
|
||||
modifier: 'StorageFunctionModifierV4',
|
||||
|
||||
@@ -17,7 +17,7 @@ import { StorageFunctionMetadata } from './Storage';
|
||||
* The definition of a module in the system
|
||||
*/
|
||||
export class ModuleMetadataV5 extends Struct {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
@@ -69,7 +69,7 @@ export class ModuleMetadataV5 extends Struct {
|
||||
* The runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class MetadataV5 extends Struct implements MetadataInterface<ModuleMetadataV5> {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
modules: Vec.with(ModuleMetadataV5)
|
||||
}, value);
|
||||
|
||||
@@ -14,7 +14,7 @@ import Bytes from '../../primitive/Bytes';
|
||||
import Text from '../../primitive/Text';
|
||||
|
||||
export class StorageFunctionType extends Enum {
|
||||
public constructor (value?: any, index?: number) {
|
||||
constructor (value?: any, index?: number) {
|
||||
super({
|
||||
Type: 'PlainTypeV5',
|
||||
Map: 'MapTypeV5',
|
||||
@@ -104,7 +104,7 @@ export interface StorageFunctionMetadataValue {
|
||||
* The definition of a storage function
|
||||
*/
|
||||
export class StorageFunctionMetadata extends Struct {
|
||||
public constructor (value?: StorageFunctionMetadataValue | Uint8Array) {
|
||||
constructor (value?: StorageFunctionMetadataValue | Uint8Array) {
|
||||
super({
|
||||
name: 'Text',
|
||||
modifier: 'StorageFunctionModifierV5',
|
||||
|
||||
@@ -17,7 +17,7 @@ import { StorageEntryMetadata } from './Storage';
|
||||
* The definition of a module in the system
|
||||
*/
|
||||
export class ModuleMetadataV6 extends Struct {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
@@ -77,7 +77,7 @@ export class ModuleMetadataV6 extends Struct {
|
||||
* The runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class MetadataV6 extends Struct implements MetadataInterface<ModuleMetadataV6> {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
modules: Vec.with(ModuleMetadataV6)
|
||||
}, value);
|
||||
|
||||
@@ -17,7 +17,7 @@ import { StorageMetadata } from './Storage';
|
||||
* The definition of a module in the system
|
||||
*/
|
||||
export class ModuleMetadataV7 extends Struct {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
name: 'Text',
|
||||
storage: Option.with(StorageMetadata),
|
||||
@@ -69,7 +69,7 @@ export class ModuleMetadataV7 extends Struct {
|
||||
* The runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class MetadataV7 extends Struct implements MetadataInterface<ModuleMetadataV7> {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
modules: Vec.with(ModuleMetadataV7)
|
||||
}, value);
|
||||
|
||||
@@ -15,7 +15,7 @@ export {
|
||||
};
|
||||
|
||||
export class StorageMetadata extends Struct {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
prefix: 'Text',
|
||||
// NOTE renamed to items from entries (since Struct already has entries from Map)
|
||||
|
||||
@@ -33,7 +33,7 @@ import { StorageMetadata } from './Storage';
|
||||
* The definition of a module in the system
|
||||
*/
|
||||
export class ModuleMetadataV8 extends Struct {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
name: 'Text',
|
||||
storage: Option.with(StorageMetadata),
|
||||
@@ -93,7 +93,7 @@ export class ModuleMetadataV8 extends Struct {
|
||||
* The runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class MetadataV8 extends Struct implements MetadataInterface<ModuleMetadataV8> {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
modules: Vec.with(ModuleMetadataV8)
|
||||
}, value);
|
||||
|
||||
@@ -28,7 +28,7 @@ export default abstract class AbstractInt extends BN implements Codec {
|
||||
|
||||
private _isNegative: boolean;
|
||||
|
||||
public constructor (
|
||||
constructor (
|
||||
isNegative: boolean,
|
||||
value: AnyNumber = 0,
|
||||
bitLength: UIntBitLength = DEFAULT_UINT_BITS, isHexJson = true) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import U8a from './U8a';
|
||||
export default abstract class Base<T extends Codec> implements Codec {
|
||||
protected raw: T;
|
||||
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
this.raw = value;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,13 +27,13 @@ export interface CompactEncodable extends Codec {
|
||||
* a number and making the compact representation thereof
|
||||
*/
|
||||
export default class Compact<T extends CompactEncodable> extends Base<T> {
|
||||
public constructor (Type: Constructor<T> | InterfaceTypes, value: Compact<T> | AnyNumber = 0) {
|
||||
constructor (Type: Constructor<T> | InterfaceTypes, value: Compact<T> | AnyNumber = 0) {
|
||||
super(Compact.decodeCompact<T>(typeToConstructor(Type), value));
|
||||
}
|
||||
|
||||
public static with<T extends CompactEncodable> (Type: Constructor<T> | InterfaceTypes): Constructor<Compact<T>> {
|
||||
return class extends Compact<T> {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super(Type, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ const BITLENGTH: UIntBitLength = 64;
|
||||
export default class CodecDate extends Date implements Codec {
|
||||
protected raw: Date; // FIXME Remove this once we convert all types out of Base
|
||||
|
||||
public constructor (value: CodecDate | Date | AnyNumber = 0) {
|
||||
constructor (value: CodecDate | Date | AnyNumber = 0) {
|
||||
super(
|
||||
CodecDate.decodeDate(value)
|
||||
);
|
||||
|
||||
@@ -89,7 +89,7 @@ describe('Enum', (): void => {
|
||||
class B extends Null { }
|
||||
class C extends Null { }
|
||||
class Test extends Enum {
|
||||
public constructor (value?: string, index?: number) {
|
||||
constructor (value?: string, index?: number) {
|
||||
super({
|
||||
a: A,
|
||||
b: B,
|
||||
|
||||
@@ -109,7 +109,7 @@ export default class Enum extends Base<Codec> {
|
||||
|
||||
private _isBasic: boolean;
|
||||
|
||||
public constructor (def: Record<string, InterfaceTypes | Constructor> | string[], value?: any, index?: number) {
|
||||
constructor (def: Record<string, InterfaceTypes | Constructor> | string[], value?: any, index?: number) {
|
||||
const defInfo = extractDef(def);
|
||||
const decoded = Enum.decodeEnum(defInfo.def, value, index);
|
||||
|
||||
@@ -136,7 +136,7 @@ export default class Enum extends Base<Codec> {
|
||||
|
||||
public static with (Types: Record<string, InterfaceTypes | Constructor> | string[]): EnumConstructor<Enum> {
|
||||
return class extends Enum {
|
||||
public constructor (value?: any, index?: number) {
|
||||
constructor (value?: any, index?: number) {
|
||||
super(Types, value, index);
|
||||
|
||||
Object.keys(this._def).forEach((_key): void => {
|
||||
|
||||
@@ -19,7 +19,7 @@ import AbstractInt, { DEFAULT_UINT_BITS, UIntBitLength } from './AbstractInt';
|
||||
* @noInheritDoc
|
||||
*/
|
||||
export default class Int extends AbstractInt {
|
||||
public constructor (
|
||||
constructor (
|
||||
value: AnyNumber = 0,
|
||||
bitLength: UIntBitLength = DEFAULT_UINT_BITS, isHexJson = true) {
|
||||
super(
|
||||
|
||||
@@ -18,7 +18,7 @@ const EMPTY = new Uint8Array();
|
||||
* @description The wrapper for the result from a LinkedMap
|
||||
*/
|
||||
export default class Linkage<T extends Codec> extends Struct {
|
||||
public constructor (Type: Constructor | InterfaceTypes, value?: any) {
|
||||
constructor (Type: Constructor | InterfaceTypes, value?: any) {
|
||||
super({
|
||||
previous: Option.with(Type),
|
||||
next: Option.with(Type)
|
||||
@@ -27,7 +27,7 @@ export default class Linkage<T extends Codec> extends Struct {
|
||||
|
||||
public static withKey<O extends Codec> (Type: Constructor | InterfaceTypes): Constructor<Linkage<O>> {
|
||||
return class extends Linkage<O> {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super(Type, value);
|
||||
}
|
||||
};
|
||||
@@ -65,7 +65,7 @@ export default class Linkage<T extends Codec> extends Struct {
|
||||
* @description A Linkage keys/Values tuple
|
||||
*/
|
||||
export class LinkageResult extends Tuple {
|
||||
public constructor ([TypeKey, keys]: TypeWithValues, [TypeValue, values]: TypeWithValues) {
|
||||
constructor ([TypeKey, keys]: TypeWithValues, [TypeValue, values]: TypeWithValues) {
|
||||
super({
|
||||
Keys: Vec.with(TypeKey),
|
||||
Values: Vec.with(TypeValue)
|
||||
|
||||
@@ -21,7 +21,7 @@ import Base from './Base';
|
||||
export default class Option<T extends Codec> extends Base<T> {
|
||||
private _Type: Constructor;
|
||||
|
||||
public constructor (Type: Constructor | InterfaceTypes, value?: any) {
|
||||
constructor (Type: Constructor | InterfaceTypes, value?: any) {
|
||||
const Clazz = typeToConstructor(Type);
|
||||
|
||||
super(Option.decodeOption(Clazz, value));
|
||||
@@ -54,7 +54,7 @@ export default class Option<T extends Codec> extends Base<T> {
|
||||
|
||||
public static with<O extends Codec> (Type: Constructor | InterfaceTypes): Constructor<Option<O>> {
|
||||
return class extends Option<O> {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super(Type, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -14,14 +14,14 @@ import Enum from './Enum';
|
||||
* A Result maps to the Rust Result type, that can either wrap a success or error value
|
||||
*/
|
||||
export default class Result<O extends Codec, E extends Codec> extends Enum {
|
||||
public constructor (Ok: Constructor<O> | InterfaceTypes, Error: Constructor<E> | InterfaceTypes, value?: any) {
|
||||
constructor (Ok: Constructor<O> | InterfaceTypes, Error: Constructor<E> | InterfaceTypes, value?: any) {
|
||||
// NOTE This is order-dependent, Ok (with index 0) needs to be first
|
||||
super({ Ok, Error }, value);
|
||||
}
|
||||
|
||||
public static with<O extends Codec, E extends Codec> (Types: { Ok: Constructor<O> | InterfaceTypes; Error: Constructor<E> | InterfaceTypes }): Constructor<Result<O, E>> {
|
||||
return class extends Result<O, E> {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super(Types.Ok, Types.Error, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ type SetValues = Record<string, number>;
|
||||
export default class CodecSet extends Set<string> implements Codec {
|
||||
private _setValues: SetValues;
|
||||
|
||||
public constructor (setValues: SetValues, value?: string[] | Set<string> | Uint8Array | number) {
|
||||
constructor (setValues: SetValues, value?: string[] | Set<string> | Uint8Array | number) {
|
||||
super(CodecSet.decodeSet(setValues, value));
|
||||
|
||||
this._setValues = setValues;
|
||||
@@ -76,7 +76,7 @@ export default class CodecSet extends Set<string> implements Codec {
|
||||
|
||||
public static with (values: SetValues): Constructor<CodecSet> {
|
||||
return class extends CodecSet {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super(values, value);
|
||||
|
||||
Object.keys(values).forEach((_key): void => {
|
||||
|
||||
@@ -35,7 +35,7 @@ export default class Struct<
|
||||
|
||||
protected _Types: ConstructorDef;
|
||||
|
||||
public constructor (Types: S, value: V | Map<any, any> | any[] | string = {} as unknown as V, jsonMap: Map<keyof S, string> = new Map()) {
|
||||
constructor (Types: S, value: V | Map<any, any> | any[] | string = {} as unknown as V, jsonMap: Map<keyof S, string> = new Map()) {
|
||||
const Clazzes = mapToTypeMap(Types);
|
||||
const decoded: T = Struct.decodeStruct(Clazzes, value, jsonMap);
|
||||
|
||||
@@ -116,7 +116,7 @@ export default class Struct<
|
||||
|
||||
public static with<S extends TypesDef> (Types: S): Constructor<Struct<S>> {
|
||||
return class extends Struct<S> {
|
||||
public constructor (value?: any, jsonMap?: Map<keyof S, string>) {
|
||||
constructor (value?: any, jsonMap?: Map<keyof S, string>) {
|
||||
super(Types, value, jsonMap);
|
||||
|
||||
(Object.keys(Types) as (keyof S)[]).forEach((key): void => {
|
||||
|
||||
@@ -20,7 +20,7 @@ import { compareMap } from './utils';
|
||||
* @noInheritDoc
|
||||
*/
|
||||
export default class StructAny extends Map<string, any> implements Codec {
|
||||
public constructor (value?: { [index: string]: any } | null) {
|
||||
constructor (value?: { [index: string]: any } | null) {
|
||||
const decoded = StructAny.decodeJson(value);
|
||||
|
||||
super(decoded);
|
||||
|
||||
@@ -26,7 +26,7 @@ type TupleTypes = (Constructor | InterfaceTypes)[] | {
|
||||
export default class Tuple extends AbstractArray<Codec> {
|
||||
private _Types: TupleConstructors;
|
||||
|
||||
public constructor (Types: TupleTypes, value?: any) {
|
||||
constructor (Types: TupleTypes, value?: any) {
|
||||
const Clazzes = Array.isArray(Types)
|
||||
? Types.map((type): Constructor => typeToConstructor(type))
|
||||
: mapToTypeMap(Types);
|
||||
@@ -58,7 +58,7 @@ export default class Tuple extends AbstractArray<Codec> {
|
||||
|
||||
public static with (Types: TupleTypes): Constructor<Tuple> {
|
||||
return class extends Tuple {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super(Types, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
* @noInheritDoc
|
||||
*/
|
||||
export default class U8a extends Uint8Array implements Codec {
|
||||
public constructor (value?: AnyU8a) {
|
||||
constructor (value?: AnyU8a) {
|
||||
super(
|
||||
U8a.decodeU8a(value)
|
||||
);
|
||||
|
||||
@@ -20,7 +20,7 @@ export type BitLength = 8 | 16 | 32 | 64 | 128 | 160 | 256 | 512 | 520 | 1024 |
|
||||
* to be used directly, rather is should be subclassed with the specific lengths.
|
||||
*/
|
||||
export default class U8aFixed extends U8a {
|
||||
public constructor (value: AnyU8a = new Uint8Array(), bitLength: BitLength = 256) {
|
||||
constructor (value: AnyU8a = new Uint8Array(), bitLength: BitLength = 256) {
|
||||
super(
|
||||
U8aFixed.decodeU8aFixed(value, bitLength)
|
||||
);
|
||||
@@ -49,7 +49,7 @@ export default class U8aFixed extends U8a {
|
||||
|
||||
public static with (bitLength: BitLength): Constructor<U8aFixed> {
|
||||
return class extends U8aFixed {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super(value, bitLength);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ import AbstractInt, { DEFAULT_UINT_BITS, UIntBitLength } from './AbstractInt';
|
||||
* @noInheritDoc
|
||||
*/
|
||||
export default class UInt extends AbstractInt {
|
||||
public constructor (
|
||||
constructor (
|
||||
value: AnyNumber = 0,
|
||||
bitLength: UIntBitLength = DEFAULT_UINT_BITS, isHexJson = false) {
|
||||
super(
|
||||
|
||||
@@ -22,7 +22,7 @@ const MAX_LENGTH = 32768;
|
||||
export default class Vec<T extends Codec> extends AbstractArray<T> {
|
||||
private _Type: Constructor<T>;
|
||||
|
||||
public constructor (Type: Constructor<T> | InterfaceTypes, value: Vec<any> | Uint8Array | string | any[] = [] as any[]) {
|
||||
constructor (Type: Constructor<T> | InterfaceTypes, value: Vec<any> | Uint8Array | string | any[] = [] as any[]) {
|
||||
const Clazz = typeToConstructor<T>(Type);
|
||||
|
||||
super(...Vec.decodeVec(Clazz, value));
|
||||
@@ -55,7 +55,7 @@ export default class Vec<T extends Codec> extends AbstractArray<T> {
|
||||
|
||||
public static with<O extends Codec> (Type: Constructor<O> | InterfaceTypes): Constructor<Vec<O>> {
|
||||
return class extends Vec<O> {
|
||||
public constructor (value?: any[]) {
|
||||
constructor (value?: any[]) {
|
||||
super(Type, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ import Vec from './Vec';
|
||||
export default class VecFixed<T extends Codec> extends AbstractArray<T> {
|
||||
private _Type: Constructor<T>;
|
||||
|
||||
public constructor (Type: Constructor<T> | InterfaceTypes, length: number, value: VecFixed<any> | Uint8Array | string | any[] = [] as any[]) {
|
||||
constructor (Type: Constructor<T> | InterfaceTypes, length: number, value: VecFixed<any> | Uint8Array | string | any[] = [] as any[]) {
|
||||
const Clazz = typeToConstructor<T>(Type);
|
||||
|
||||
super(...VecFixed.decodeVecFixed(Clazz, length, value));
|
||||
@@ -44,7 +44,7 @@ export default class VecFixed<T extends Codec> extends AbstractArray<T> {
|
||||
|
||||
public static with<O extends Codec> (Type: Constructor<O> | InterfaceTypes, length: number): Constructor<VecFixed<O>> {
|
||||
return class extends VecFixed<O> {
|
||||
public constructor (value?: any[]) {
|
||||
constructor (value?: any[]) {
|
||||
super(Type, length, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ import { createType } from '../codec/create';
|
||||
*/
|
||||
export default class Bool extends Boolean implements Codec {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
public constructor (value: Bool | Boolean | Uint8Array | boolean | number = false) {
|
||||
constructor (value: Bool | Boolean | Uint8Array | boolean | number = false) {
|
||||
super(
|
||||
Bool.decodeBool(value)
|
||||
);
|
||||
|
||||
@@ -17,7 +17,7 @@ import U8a from '../codec/U8a';
|
||||
* as what is found in [[Text]] and [[Vec]])
|
||||
*/
|
||||
export default class Bytes extends U8a {
|
||||
public constructor (value?: AnyU8a) {
|
||||
constructor (value?: AnyU8a) {
|
||||
super(Bytes.decodeBytes(value));
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ export { TRANSACTION_VERSION as LATEST_EXTRINSIC_VERSION } from './v4/Extrinsic'
|
||||
* - left as is, to create an inherent
|
||||
*/
|
||||
export default class Extrinsic extends Base<ExtrinsicVx | ExtrinsicUnknown> implements IExtrinsic {
|
||||
public constructor (value: Extrinsic | ExtrinsicValue | AnyU8a | Call | undefined, { version }: CreateOptions = {}) {
|
||||
constructor (value: Extrinsic | ExtrinsicValue | AnyU8a | Call | undefined, { version }: CreateOptions = {}) {
|
||||
super(Extrinsic.decodeExtrinsic(value, version));
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ interface ImmortalEnumDef {
|
||||
*/
|
||||
export class ImmortalEra extends U8a {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public constructor (value?: AnyU8a) {
|
||||
constructor (value?: AnyU8a) {
|
||||
// For immortals, we always provide the known value (i.e. treated as a
|
||||
// constant no matter how it is constructed - it is a fixed structure)
|
||||
super(IMMORTAL_ERA);
|
||||
@@ -48,7 +48,7 @@ export class ImmortalEra extends U8a {
|
||||
* The MortalEra for an extrinsic, indicating period and phase
|
||||
*/
|
||||
export class MortalEra extends Tuple {
|
||||
public constructor (value?: MortalMethod | Uint8Array | number[] | string) {
|
||||
constructor (value?: MortalMethod | Uint8Array | number[] | string) {
|
||||
super({
|
||||
period: U64,
|
||||
phase: U64
|
||||
@@ -191,7 +191,7 @@ export class MortalEra extends Tuple {
|
||||
* The era for an extrinsic, indicating either a mortal or immortal extrinsic
|
||||
*/
|
||||
export default class ExtrinsicEra extends Enum implements IExtrinsicEra {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super({
|
||||
ImmortalEra,
|
||||
MortalEra
|
||||
|
||||
@@ -37,7 +37,7 @@ const VERSIONS: InterfaceTypes[] = [
|
||||
* on the contents included
|
||||
*/
|
||||
export default class ExtrinsicPayload extends Base<ExtrinsicPayloadVx> {
|
||||
public constructor (value: Partial<ExtrinsicPayloadValue> | Uint8Array | string | undefined, { version }: ExtrinsicPayloadOptions = {}) {
|
||||
constructor (value: Partial<ExtrinsicPayloadValue> | Uint8Array | string | undefined, { version }: ExtrinsicPayloadOptions = {}) {
|
||||
super(
|
||||
ExtrinsicPayload.decodeExtrinsicPayload(value as ExtrinsicPayloadValue, version)
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ import Struct from '../../codec/Struct';
|
||||
* A default handler for payloads where the version is not known (default throw)
|
||||
*/
|
||||
export default class ExtrinsicPayloadUnknown extends Struct {
|
||||
public constructor (value?: any, { version = 0 }: Partial<ExtrinsicPayloadOptions> = {}) {
|
||||
constructor (value?: any, { version = 0 }: Partial<ExtrinsicPayloadOptions> = {}) {
|
||||
super({});
|
||||
|
||||
throw new Error(`Unsupported extrinsic payload version ${version}`);
|
||||
|
||||
@@ -13,7 +13,7 @@ import { UNMASK_VERSION } from './constants';
|
||||
* A default handler for extrinsics where the version is not known (default throw)
|
||||
*/
|
||||
export default class ExtrinsicUnknown extends Struct {
|
||||
public constructor (value?: any, { isSigned = false, version = 0 }: Partial<ExtrinsicOptions> = {}) {
|
||||
constructor (value?: any, { isSigned = false, version = 0 }: Partial<ExtrinsicOptions> = {}) {
|
||||
super({});
|
||||
|
||||
throw new Error(`Unsupported ${isSigned ? '' : 'un'}signed extrinsic version ${version & UNMASK_VERSION}`);
|
||||
|
||||
@@ -25,7 +25,7 @@ const TRANSACTION_VERSION = 1;
|
||||
* The first generation of compact extrinsics
|
||||
*/
|
||||
export default class ExtrinsicV1 extends Struct implements IExtrinsicImpl {
|
||||
public constructor (value?: Uint8Array | ExtrinsicValueV1, { isSigned }: Partial<ExtrinsicOptions> = {}) {
|
||||
constructor (value?: Uint8Array | ExtrinsicValueV1, { isSigned }: Partial<ExtrinsicOptions> = {}) {
|
||||
super({
|
||||
signature: ExtrinsicSignatureV1,
|
||||
method: 'Call'
|
||||
|
||||
@@ -22,7 +22,7 @@ import { sign } from '../util';
|
||||
* 32 bytes: The hash of the authoring block implied by the Transaction Era and the current block.
|
||||
*/
|
||||
export default class ExtrinsicPayloadV1 extends Struct {
|
||||
public constructor (value?: ExtrinsicPayloadValue | Uint8Array | string) {
|
||||
constructor (value?: ExtrinsicPayloadValue | Uint8Array | string) {
|
||||
super({
|
||||
nonce: 'Compact<Index>',
|
||||
method: 'Bytes',
|
||||
|
||||
@@ -23,7 +23,7 @@ export default class ExtrinsicSignatureV1 extends Struct implements IExtrinsicSi
|
||||
// 64 bytes: The sr25519/ed25519 signature of the Signing Payload
|
||||
// 1-8 bytes: The Compact<Nonce> of the signing account
|
||||
// 1/2 bytes: The Transaction Era
|
||||
public constructor (value?: ExtrinsicSignatureV1 | Uint8Array, { isSigned }: ExtrinsicSignatureOptions = {}) {
|
||||
constructor (value?: ExtrinsicSignatureV1 | Uint8Array, { isSigned }: ExtrinsicSignatureOptions = {}) {
|
||||
super({
|
||||
signer: 'Address',
|
||||
signature: 'Signature',
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface ExtrinsicValueV2 {
|
||||
* The second generation of compact extrinsics
|
||||
*/
|
||||
export default class ExtrinsicV2 extends Struct implements IExtrinsicImpl {
|
||||
public constructor (value?: Uint8Array | ExtrinsicValueV2 | Call, { isSigned }: Partial<ExtrinsicOptions> = {}) {
|
||||
constructor (value?: Uint8Array | ExtrinsicValueV2 | Call, { isSigned }: Partial<ExtrinsicOptions> = {}) {
|
||||
super({
|
||||
signature: ExtrinsicSignatureV2,
|
||||
method: 'Call'
|
||||
|
||||
@@ -40,7 +40,7 @@ const SignedPayloadDefV2: Record<string, InterfaceTypes> = {
|
||||
* on the contents included
|
||||
*/
|
||||
export default class ExtrinsicPayloadV2 extends Struct {
|
||||
public constructor (value?: ExtrinsicPayloadValue | Uint8Array | string) {
|
||||
constructor (value?: ExtrinsicPayloadValue | Uint8Array | string) {
|
||||
super(SignedPayloadDefV2, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import ExtrinsicPayloadV2 from './ExtrinsicPayload';
|
||||
* A container for the [[Signature]] associated with a specific [[Extrinsic]]
|
||||
*/
|
||||
export default class ExtrinsicSignatureV2 extends Struct implements IExtrinsicSignature {
|
||||
public constructor (value: ExtrinsicSignatureV2 | Uint8Array | undefined, { isSigned }: ExtrinsicSignatureOptions = {}) {
|
||||
constructor (value: ExtrinsicSignatureV2 | Uint8Array | undefined, { isSigned }: ExtrinsicSignatureOptions = {}) {
|
||||
super({
|
||||
signer: 'Address',
|
||||
signature: 'Signature',
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface ExtrinsicValueV3 {
|
||||
* The third generation of compact extrinsics
|
||||
*/
|
||||
export default class ExtrinsicV3 extends Struct implements IExtrinsicImpl {
|
||||
public constructor (value?: Uint8Array | ExtrinsicValueV3 | Call, { isSigned }: Partial<ExtrinsicOptions> = {}) {
|
||||
constructor (value?: Uint8Array | ExtrinsicValueV3 | Call, { isSigned }: Partial<ExtrinsicOptions> = {}) {
|
||||
super({
|
||||
signature: ExtrinsicSignatureV3,
|
||||
method: 'Call'
|
||||
|
||||
@@ -38,7 +38,7 @@ export const SignedPayloadDefV3: Record<string, InterfaceTypes> = {
|
||||
* on the contents included
|
||||
*/
|
||||
export default class ExtrinsicPayloadV3 extends Struct {
|
||||
public constructor (value?: ExtrinsicPayloadValue | Uint8Array | string) {
|
||||
constructor (value?: ExtrinsicPayloadValue | Uint8Array | string) {
|
||||
super(SignedPayloadDefV3, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface ExtrinsicValueV4 {
|
||||
* The third generation of compact extrinsics
|
||||
*/
|
||||
export default class ExtrinsicV4 extends Struct implements IExtrinsicImpl {
|
||||
public constructor (value?: Uint8Array | ExtrinsicValueV4 | Call, { isSigned }: Partial<ExtrinsicOptions> = {}) {
|
||||
constructor (value?: Uint8Array | ExtrinsicValueV4 | Call, { isSigned }: Partial<ExtrinsicOptions> = {}) {
|
||||
super({
|
||||
signature: ExtrinsicSignatureV4,
|
||||
method: 'Call'
|
||||
|
||||
@@ -19,7 +19,7 @@ import { SignedPayloadDefV3 as SignedPayloadDefV4 } from '../v3/ExtrinsicPayload
|
||||
* on the contents included
|
||||
*/
|
||||
export default class ExtrinsicPayloadV4 extends Struct {
|
||||
public constructor (value?: ExtrinsicPayloadValue | Uint8Array | string) {
|
||||
constructor (value?: ExtrinsicPayloadValue | Uint8Array | string) {
|
||||
super(SignedPayloadDefV4, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import ExtrinsicPayloadV4 from './ExtrinsicPayload';
|
||||
* A container for the [[Signature]] associated with a specific [[Extrinsic]]
|
||||
*/
|
||||
export default class ExtrinsicSignatureV4 extends Struct implements IExtrinsicSignature {
|
||||
public constructor (value: ExtrinsicSignatureV4 | Uint8Array | undefined, { isSigned }: ExtrinsicSignatureOptions = {}) {
|
||||
constructor (value: ExtrinsicSignatureV4 | Uint8Array | undefined, { isSigned }: ExtrinsicSignatureOptions = {}) {
|
||||
super({
|
||||
signer: 'Address',
|
||||
signature: 'MultiSignature',
|
||||
|
||||
@@ -17,7 +17,7 @@ import U8aFixed from '../../codec/U8aFixed';
|
||||
* just a Uint8Array wrapper with a fixed length.
|
||||
*/
|
||||
export default class AccountId extends U8aFixed {
|
||||
public constructor (value: AnyU8a = new Uint8Array()) {
|
||||
constructor (value: AnyU8a = new Uint8Array()) {
|
||||
super(
|
||||
AccountId.decodeAccountId(value),
|
||||
256
|
||||
|
||||
@@ -28,7 +28,7 @@ const MAX_4BYTE = new BN(1).shln(32);
|
||||
* for an Account. We extends from [[U32]] to provide the number-like properties.
|
||||
*/
|
||||
export default class AccountIndex extends U32 {
|
||||
public constructor (value: AnyNumber = new BN(0)) {
|
||||
constructor (value: AnyNumber = new BN(0)) {
|
||||
super(
|
||||
AccountIndex.decodeAccountIndex(value)
|
||||
);
|
||||
|
||||
@@ -24,7 +24,7 @@ export const ACCOUNT_ID_PREFIX = new Uint8Array([0xff]);
|
||||
* is encoded as `[ <prefix-byte>, ...publicKey/...bytes ]` as per spec
|
||||
*/
|
||||
export default class Address extends Base<AccountId | AccountIndex> {
|
||||
public constructor (value: AnyAddress = new Uint8Array()) {
|
||||
constructor (value: AnyAddress = new Uint8Array()) {
|
||||
super(
|
||||
Address.decodeAddress(value)
|
||||
);
|
||||
|
||||
@@ -31,7 +31,7 @@ export interface BlockValue {
|
||||
* A block encoded with header and extrinsics
|
||||
*/
|
||||
export default class Block extends Struct {
|
||||
public constructor (value?: BlockValue | Uint8Array) {
|
||||
constructor (value?: BlockValue | Uint8Array) {
|
||||
super({
|
||||
header: 'Header',
|
||||
extrinsics: 'Vec<Extrinsic>'
|
||||
|
||||
@@ -36,7 +36,7 @@ const injected: Record<string, CallFunction> = {};
|
||||
* A wrapper around the `[sectionIndex, methodIndex]` value that uniquely identifies a method
|
||||
*/
|
||||
export class CallIndex extends U8aFixed {
|
||||
public constructor (value?: AnyU8a) {
|
||||
constructor (value?: AnyU8a) {
|
||||
super(value, 16);
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ export class CallIndex extends U8aFixed {
|
||||
export default class Call extends Struct implements IMethod {
|
||||
protected _meta: FunctionMetadataLatest;
|
||||
|
||||
public constructor (value: any, meta?: FunctionMetadataLatest) {
|
||||
constructor (value: any, meta?: FunctionMetadataLatest) {
|
||||
const decoded = Call.decodeCall(value, meta);
|
||||
|
||||
super({
|
||||
|
||||
@@ -18,7 +18,7 @@ import Bytes from '../Bytes';
|
||||
* A [[Enum]] the specifies the specific item in the logs of a [[Digest]]
|
||||
*/
|
||||
export class DigestItem extends Enum {
|
||||
public constructor (value: any) {
|
||||
constructor (value: any) {
|
||||
super({
|
||||
Other: 'Bytes', // 0
|
||||
AuthoritiesChange: 'Vec<AuthorityId>', // 1
|
||||
@@ -163,7 +163,7 @@ export class DigestItem extends Enum {
|
||||
* A [[Header]] Digest
|
||||
*/
|
||||
export default class Digest extends Struct {
|
||||
public constructor (value: any) {
|
||||
constructor (value: any) {
|
||||
super({
|
||||
logs: Vec.with(DigestItem)
|
||||
}, value);
|
||||
|
||||
@@ -31,7 +31,7 @@ export class EventData extends Tuple {
|
||||
|
||||
private _typeDef: TypeDef[];
|
||||
|
||||
public constructor (Types: Constructor[], value: Uint8Array, typeDef: TypeDef[], meta: EventMetadataLatest, section: string, method: string) {
|
||||
constructor (Types: Constructor[], value: Uint8Array, typeDef: TypeDef[], meta: EventMetadataLatest, section: string, method: string) {
|
||||
super(Types, value);
|
||||
|
||||
this._meta = meta;
|
||||
@@ -78,7 +78,7 @@ export class EventData extends Tuple {
|
||||
export default class Event extends Struct {
|
||||
// Currently we _only_ decode from Uint8Array, since we expect it to
|
||||
// be used via EventRecord
|
||||
public constructor (_value?: Uint8Array) {
|
||||
constructor (_value?: Uint8Array) {
|
||||
const { DataType, value } = Event.decodeEvent(_value);
|
||||
|
||||
super({
|
||||
@@ -123,7 +123,7 @@ export default class Event extends Struct {
|
||||
const Types = typeDef.map((typeDef): Constructor<Codec> => getTypeClass(typeDef));
|
||||
|
||||
EventTypes[eventIndex.toString()] = class extends EventData {
|
||||
public constructor (value: Uint8Array) {
|
||||
constructor (value: Uint8Array) {
|
||||
super(Types, value, typeDef, meta, sectionName, methodName);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ import Null from '../Null';
|
||||
* never actually be constructed
|
||||
*/
|
||||
export default class Origin extends Null {
|
||||
public constructor () {
|
||||
constructor () {
|
||||
super();
|
||||
|
||||
throw new Error('Origin should not be constructed, it is only a placeholder for compatibility');
|
||||
|
||||
@@ -32,7 +32,7 @@ export default class Vote extends U8aFixed {
|
||||
|
||||
private _conviction: Conviction;
|
||||
|
||||
public constructor (value?: InputTypes) {
|
||||
constructor (value?: InputTypes) {
|
||||
// decoded is just 1 byte
|
||||
// Aye: Most Significant Bit
|
||||
// Conviction: 0000 - 0101
|
||||
|
||||
@@ -13,7 +13,7 @@ import U8aFixed from '../codec/U8aFixed';
|
||||
* as a sane default for fixed-length hash representations.
|
||||
*/
|
||||
export default class H160 extends U8aFixed {
|
||||
public constructor (value?: AnyU8a) {
|
||||
constructor (value?: AnyU8a) {
|
||||
super(value, 160);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import U8aFixed from '../codec/U8aFixed';
|
||||
* as a sane default for fixed-length hash representations.
|
||||
*/
|
||||
export default class H256 extends U8aFixed implements IHash {
|
||||
public constructor (value?: AnyU8a) {
|
||||
constructor (value?: AnyU8a) {
|
||||
super(value, 256);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import U8aFixed from '../codec/U8aFixed';
|
||||
* Hash containing 512 bits (64 bytes), typically used for signatures
|
||||
*/
|
||||
export default class H512 extends U8aFixed {
|
||||
public constructor (value?: AnyU8a) {
|
||||
constructor (value?: AnyU8a) {
|
||||
super(value, 512);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import Int from '../codec/Int';
|
||||
* A 128-bit signed integer
|
||||
*/
|
||||
export default class I128 extends Int {
|
||||
public constructor (value?: AnyNumber) {
|
||||
constructor (value?: AnyNumber) {
|
||||
super(value, 128);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import Int from '../codec/Int';
|
||||
* A 16-bit signed integer
|
||||
*/
|
||||
export default class I16 extends Int {
|
||||
public constructor (value?: AnyNumber) {
|
||||
constructor (value?: AnyNumber) {
|
||||
super(value, 16);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import Int from '../codec/Int';
|
||||
* A 256-bit signed integer
|
||||
*/
|
||||
export default class I256 extends Int {
|
||||
public constructor (value?: AnyNumber) {
|
||||
constructor (value?: AnyNumber) {
|
||||
super(value, 256);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import Int from '../codec/Int';
|
||||
* A 32-bit signed integer
|
||||
*/
|
||||
export default class I32 extends Int {
|
||||
public constructor (value?: AnyNumber) {
|
||||
constructor (value?: AnyNumber) {
|
||||
super(value, 32);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import Int from '../codec/Int';
|
||||
* A 64-bit signed integer
|
||||
*/
|
||||
export default class I64 extends Int {
|
||||
public constructor (value?: AnyNumber) {
|
||||
constructor (value?: AnyNumber) {
|
||||
super(value, 64);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import Int from '../codec/Int';
|
||||
* An 8-bit signed integer
|
||||
*/
|
||||
export default class I8 extends Int {
|
||||
public constructor (value?: AnyNumber) {
|
||||
constructor (value?: AnyNumber) {
|
||||
super(value, 8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import Enum from '../codec/Enum';
|
||||
|
||||
export default class StorageHasher extends Enum {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super([
|
||||
'Blake2_128',
|
||||
'Blake2_256',
|
||||
|
||||
@@ -44,7 +44,7 @@ export default class StorageKey extends Bytes {
|
||||
|
||||
private _section?: string;
|
||||
|
||||
public constructor (value?: AnyU8a | StorageKey | StorageEntry | [StorageEntry, any], override: Partial<StorageKeyExtra> = {}) {
|
||||
constructor (value?: AnyU8a | StorageKey | StorageEntry | [StorageEntry, any], override: Partial<StorageKeyExtra> = {}) {
|
||||
const { key, method, section } = StorageKey.decodeStorageKey(value);
|
||||
|
||||
super(key);
|
||||
|
||||
@@ -21,7 +21,7 @@ import Compact from '../codec/Compact';
|
||||
// TODO
|
||||
// - Strings should probably be trimmed (docs do come through with extra padding)
|
||||
export default class Text extends String implements Codec {
|
||||
public constructor (value: Text | string | AnyU8a | { toString: () => string } = '') {
|
||||
constructor (value: Text | string | AnyU8a | { toString: () => string } = '') {
|
||||
super(
|
||||
Text.decodeText(value)
|
||||
);
|
||||
|
||||
@@ -15,7 +15,7 @@ import Text from './Text';
|
||||
export default class Type extends Text {
|
||||
private _originalLength: number;
|
||||
|
||||
public constructor (value: Text | Uint8Array | string = '') {
|
||||
constructor (value: Text | Uint8Array | string = '') {
|
||||
// First decode it with Text
|
||||
const textValue = new Text(value);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import UInt from '../codec/UInt';
|
||||
* A 128-bit unsigned integer
|
||||
*/
|
||||
export default class U128 extends UInt {
|
||||
public constructor (value?: AnyNumber) {
|
||||
constructor (value?: AnyNumber) {
|
||||
super(value, 128);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import UInt from '../codec/UInt';
|
||||
* A 16-bit unsigned integer
|
||||
*/
|
||||
export default class U16 extends UInt {
|
||||
public constructor (value?: AnyNumber) {
|
||||
constructor (value?: AnyNumber) {
|
||||
super(value, 16);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import UInt from '../codec/UInt';
|
||||
* A 256-bit unsigned integer
|
||||
*/
|
||||
export default class U256 extends UInt {
|
||||
public constructor (value?: AnyNumber) {
|
||||
constructor (value?: AnyNumber) {
|
||||
super(value, 256);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import UInt from '../codec/UInt';
|
||||
* A 32-bit unsigned integer
|
||||
*/
|
||||
export default class U32 extends UInt {
|
||||
public constructor (value?: AnyNumber) {
|
||||
constructor (value?: AnyNumber) {
|
||||
super(value, 32);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import UInt from '../codec/UInt';
|
||||
* A 64-bit unsigned integer
|
||||
*/
|
||||
export default class U64 extends UInt {
|
||||
public constructor (value?: AnyNumber) {
|
||||
constructor (value?: AnyNumber) {
|
||||
super(value, 64);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import UInt from '../codec/UInt';
|
||||
* An 8-bit unsigned integer
|
||||
*/
|
||||
export default class U8 extends UInt {
|
||||
public constructor (value?: AnyNumber) {
|
||||
constructor (value?: AnyNumber) {
|
||||
super(value, 8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import U32 from './U32';
|
||||
* It is not to be used, since it created consensus mismatches.
|
||||
*/
|
||||
export default class USize extends U32 {
|
||||
public constructor (value?: any) {
|
||||
constructor (value?: any) {
|
||||
super(value);
|
||||
|
||||
throw new Error('The `usize` type should not be used. Since it is platform-specific, it creates incompatibilities between native (generally u64) and WASM (always u32) code. Use one of the `u32` or `u64` types explicitly.');
|
||||
|
||||
@@ -12,7 +12,7 @@ import Null from './Null';
|
||||
* A type that should not be constructed
|
||||
*/
|
||||
export default class Unconstructable extends Null {
|
||||
public constructor () {
|
||||
constructor () {
|
||||
super();
|
||||
|
||||
throw new Error('Unconstructable should not be constructed, it is only a placeholder for compatibility');
|
||||
|
||||
Reference in New Issue
Block a user