@polkadot/types-codec 10.3.1 → 10.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abstract/Base.d.ts +2 -2
- package/abstract/Object.d.ts +1 -1
- package/base/Compact.d.ts +2 -7
- package/base/Enum.d.ts +2 -6
- package/base/Option.d.ts +2 -7
- package/base/Tuple.d.ts +2 -6
- package/base/Vec.d.ts +2 -7
- package/base/VecFixed.d.ts +2 -7
- package/cjs/packageInfo.js +1 -1
- package/native/Raw.d.ts +2 -2
- package/native/Struct.d.ts +3 -7
- package/package.json +1 -1
- package/packageInfo.js +1 -1
- package/types/codec.d.ts +3 -3
- package/types/helpers.d.ts +4 -0
- package/types/registry.d.ts +1 -1
package/abstract/Base.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ import type { AnyJson, BareOpts, Codec, Inspect, IU8a, Registry } from '../types
|
|
|
7
7
|
export declare abstract class AbstractBase<T extends Codec> implements Codec {
|
|
8
8
|
#private;
|
|
9
9
|
readonly registry: Registry;
|
|
10
|
-
createdAtHash?: IU8a;
|
|
11
|
-
initialU8aLength?: number;
|
|
10
|
+
createdAtHash?: IU8a | undefined;
|
|
11
|
+
initialU8aLength?: number | undefined;
|
|
12
12
|
isStorageFallback?: boolean;
|
|
13
13
|
protected constructor(registry: Registry, value: T, initialU8aLength?: number);
|
|
14
14
|
/**
|
package/abstract/Object.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { AnyJson, BareOpts, CodecObject, Inspect, IU8a, Registry, ToString
|
|
|
7
7
|
export declare abstract class AbstractObject<T extends ToString> implements CodecObject<T> {
|
|
8
8
|
readonly registry: Registry;
|
|
9
9
|
createdAtHash?: IU8a;
|
|
10
|
-
initialU8aLength?: number;
|
|
10
|
+
initialU8aLength?: number | undefined;
|
|
11
11
|
isStorageFallback?: boolean;
|
|
12
12
|
readonly $: T;
|
|
13
13
|
protected constructor(registry: Registry, value: T, initialU8aLength?: number);
|
package/base/Compact.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import type { BN } from '@polkadot/util';
|
|
3
3
|
import type { HexString } from '@polkadot/util/types';
|
|
4
|
-
import type { AnyJson, AnyNumber, CodecClass, ICompact, Inspect, INumber, IU8a, Registry } from '../types/index.js';
|
|
5
|
-
interface Options<T> {
|
|
6
|
-
definition?: CodecClass<T>;
|
|
7
|
-
setDefinition?: (d: CodecClass<T>) => CodecClass<T>;
|
|
8
|
-
}
|
|
4
|
+
import type { AnyJson, AnyNumber, CodecClass, DefinitionSetter, ICompact, Inspect, INumber, IU8a, Registry } from '../types/index.js';
|
|
9
5
|
/**
|
|
10
6
|
* @name Compact
|
|
11
7
|
* @description
|
|
@@ -20,7 +16,7 @@ export declare class Compact<T extends INumber> implements ICompact<T> {
|
|
|
20
16
|
createdAtHash?: IU8a;
|
|
21
17
|
initialU8aLength?: number;
|
|
22
18
|
isStorageFallback?: boolean;
|
|
23
|
-
constructor(registry: Registry, Type: CodecClass<T> | string, value?: Compact<T> | AnyNumber, { definition, setDefinition }?:
|
|
19
|
+
constructor(registry: Registry, Type: CodecClass<T> | string, value?: Compact<T> | AnyNumber, { definition, setDefinition }?: DefinitionSetter<CodecClass<T>>);
|
|
24
20
|
static with<O extends INumber>(Type: CodecClass<O> | string): CodecClass<Compact<O>>;
|
|
25
21
|
/**
|
|
26
22
|
* @description The length of the value when encoded as a Uint8Array
|
|
@@ -91,4 +87,3 @@ export declare class Compact<T extends INumber> implements ICompact<T> {
|
|
|
91
87
|
*/
|
|
92
88
|
unwrap(): T;
|
|
93
89
|
}
|
|
94
|
-
export {};
|
package/base/Enum.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { AnyJson, Codec, CodecClass, IEnum, Inspect, IU8a, Registry } from '../types/index.js';
|
|
2
|
+
import type { AnyJson, Codec, CodecClass, DefinitionSetter, IEnum, Inspect, IU8a, Registry } from '../types/index.js';
|
|
3
3
|
export interface EnumCodecClass<T = Codec> {
|
|
4
4
|
new (registry: Registry, value?: any, index?: number): T;
|
|
5
5
|
}
|
|
@@ -13,10 +13,6 @@ interface EntryDef {
|
|
|
13
13
|
index: number;
|
|
14
14
|
}
|
|
15
15
|
type TypesDef = Record<string, EntryDef>;
|
|
16
|
-
interface Options {
|
|
17
|
-
definition?: Definition;
|
|
18
|
-
setDefinition?: (d: Definition) => Definition;
|
|
19
|
-
}
|
|
20
16
|
/**
|
|
21
17
|
* @name Enum
|
|
22
18
|
* @description
|
|
@@ -29,7 +25,7 @@ export declare class Enum implements IEnum {
|
|
|
29
25
|
createdAtHash?: IU8a;
|
|
30
26
|
initialU8aLength?: number;
|
|
31
27
|
isStorageFallback?: boolean;
|
|
32
|
-
constructor(registry: Registry, Types: Record<string, string | CodecClass> | Record<string, number> | string[], value?: unknown, index?: number, { definition, setDefinition }?:
|
|
28
|
+
constructor(registry: Registry, Types: Record<string, string | CodecClass> | Record<string, number> | string[], value?: unknown, index?: number, { definition, setDefinition }?: DefinitionSetter<Definition>);
|
|
33
29
|
static with(Types: Record<string, string | CodecClass> | Record<string, number> | string[]): EnumCodecClass<Enum>;
|
|
34
30
|
/**
|
|
35
31
|
* @description The length of the value when encoded as a Uint8Array
|
package/base/Option.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { AnyJson, Codec, CodecClass, Inspect, IOption, IU8a, Registry } from '../types/index.js';
|
|
3
|
-
interface Options<T> {
|
|
4
|
-
definition?: CodecClass<T>;
|
|
5
|
-
setDefinition?: (d: CodecClass<T>) => CodecClass<T>;
|
|
6
|
-
}
|
|
2
|
+
import type { AnyJson, Codec, CodecClass, DefinitionSetter, Inspect, IOption, IU8a, Registry } from '../types/index.js';
|
|
7
3
|
/**
|
|
8
4
|
* @name Option
|
|
9
5
|
* @description
|
|
@@ -18,7 +14,7 @@ export declare class Option<T extends Codec> implements IOption<T> {
|
|
|
18
14
|
createdAtHash?: IU8a;
|
|
19
15
|
initialU8aLength?: number;
|
|
20
16
|
isStorageFallback?: boolean;
|
|
21
|
-
constructor(registry: Registry, typeName: CodecClass<T> | string, value?: unknown, { definition, setDefinition }?:
|
|
17
|
+
constructor(registry: Registry, typeName: CodecClass<T> | string, value?: unknown, { definition, setDefinition }?: DefinitionSetter<CodecClass<T>>);
|
|
22
18
|
static with<O extends Codec>(Type: CodecClass<O> | string): CodecClass<Option<O>>;
|
|
23
19
|
/**
|
|
24
20
|
* @description The length of the value when encoded as a Uint8Array
|
|
@@ -96,4 +92,3 @@ export declare class Option<T extends Codec> implements IOption<T> {
|
|
|
96
92
|
*/
|
|
97
93
|
unwrapOrDefault(): T;
|
|
98
94
|
}
|
|
99
|
-
export {};
|
package/base/Tuple.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import type { AnyTupleValue, Codec, CodecClass, Inspect, ITuple, Registry } from '../types/index.js';
|
|
1
|
+
import type { AnyTupleValue, Codec, CodecClass, DefinitionSetter, Inspect, ITuple, Registry } from '../types/index.js';
|
|
2
2
|
import { AbstractArray } from '../abstract/Array.js';
|
|
3
3
|
type TupleType = (CodecClass | string);
|
|
4
4
|
type TupleTypes = TupleType[] | {
|
|
5
5
|
[index: string]: CodecClass | string;
|
|
6
6
|
};
|
|
7
7
|
type Definition = [CodecClass[], string[]];
|
|
8
|
-
interface Options {
|
|
9
|
-
definition?: Definition;
|
|
10
|
-
setDefinition?: (d: Definition) => Definition;
|
|
11
|
-
}
|
|
12
8
|
/**
|
|
13
9
|
* @name Tuple
|
|
14
10
|
* @description
|
|
@@ -17,7 +13,7 @@ interface Options {
|
|
|
17
13
|
*/
|
|
18
14
|
export declare class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
|
|
19
15
|
#private;
|
|
20
|
-
constructor(registry: Registry, Types: TupleTypes | TupleType, value?: AnyTupleValue, { definition, setDefinition }?:
|
|
16
|
+
constructor(registry: Registry, Types: TupleTypes | TupleType, value?: AnyTupleValue, { definition, setDefinition }?: DefinitionSetter<Definition>);
|
|
21
17
|
static with(Types: TupleTypes | TupleType): CodecClass<Tuple>;
|
|
22
18
|
/**
|
|
23
19
|
* @description The length of the value when encoded as a Uint8Array
|
package/base/Vec.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { Codec, CodecClass, Registry } from '../types/index.js';
|
|
2
|
+
import type { Codec, CodecClass, DefinitionSetter, Registry } from '../types/index.js';
|
|
3
3
|
import { AbstractArray } from '../abstract/Array.js';
|
|
4
|
-
interface Options<T> {
|
|
5
|
-
definition?: CodecClass<T>;
|
|
6
|
-
setDefinition?: (d: CodecClass<T>) => CodecClass<T>;
|
|
7
|
-
}
|
|
8
4
|
export declare function decodeVec<T extends Codec>(registry: Registry, result: T[], value: Uint8Array | HexString | unknown[] | null, startAt: number, Type: CodecClass<T>): [number, number];
|
|
9
5
|
/**
|
|
10
6
|
* @name Vec
|
|
@@ -15,7 +11,7 @@ export declare function decodeVec<T extends Codec>(registry: Registry, result: T
|
|
|
15
11
|
*/
|
|
16
12
|
export declare class Vec<T extends Codec> extends AbstractArray<T> {
|
|
17
13
|
#private;
|
|
18
|
-
constructor(registry: Registry, Type: CodecClass<T> | string, value?: Uint8Array | HexString | unknown[], { definition, setDefinition }?:
|
|
14
|
+
constructor(registry: Registry, Type: CodecClass<T> | string, value?: Uint8Array | HexString | unknown[], { definition, setDefinition }?: DefinitionSetter<CodecClass<T>>);
|
|
19
15
|
static with<O extends Codec>(Type: CodecClass<O> | string): CodecClass<Vec<O>>;
|
|
20
16
|
/**
|
|
21
17
|
* @description The type for the items
|
|
@@ -30,4 +26,3 @@ export declare class Vec<T extends Codec> extends AbstractArray<T> {
|
|
|
30
26
|
*/
|
|
31
27
|
toRawType(): string;
|
|
32
28
|
}
|
|
33
|
-
export {};
|
package/base/VecFixed.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { Codec, CodecClass, Inspect, Registry } from '../types/index.js';
|
|
2
|
+
import type { Codec, CodecClass, DefinitionSetter, Inspect, Registry } from '../types/index.js';
|
|
3
3
|
import { AbstractArray } from '../abstract/Array.js';
|
|
4
|
-
interface Options<T> {
|
|
5
|
-
definition?: CodecClass<T>;
|
|
6
|
-
setDefinition?: (d: CodecClass<T>) => CodecClass<T>;
|
|
7
|
-
}
|
|
8
4
|
/**
|
|
9
5
|
* @name VecFixed
|
|
10
6
|
* @description
|
|
@@ -12,7 +8,7 @@ interface Options<T> {
|
|
|
12
8
|
*/
|
|
13
9
|
export declare class VecFixed<T extends Codec> extends AbstractArray<T> {
|
|
14
10
|
#private;
|
|
15
|
-
constructor(registry: Registry, Type: CodecClass<T> | string, length: number, value?: Uint8Array | HexString | unknown[], { definition, setDefinition }?:
|
|
11
|
+
constructor(registry: Registry, Type: CodecClass<T> | string, length: number, value?: Uint8Array | HexString | unknown[], { definition, setDefinition }?: DefinitionSetter<CodecClass<T>>);
|
|
16
12
|
static with<O extends Codec>(Type: CodecClass<O> | string, length: number): CodecClass<VecFixed<O>>;
|
|
17
13
|
/**
|
|
18
14
|
* @description The type for the items
|
|
@@ -32,4 +28,3 @@ export declare class VecFixed<T extends Codec> extends AbstractArray<T> {
|
|
|
32
28
|
*/
|
|
33
29
|
toRawType(): string;
|
|
34
30
|
}
|
|
35
|
-
export {};
|
package/cjs/packageInfo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.packageInfo = void 0;
|
|
4
|
-
exports.packageInfo = { name: '@polkadot/types-codec', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '10.3.
|
|
4
|
+
exports.packageInfo = { name: '@polkadot/types-codec', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '10.3.3' };
|
package/native/Raw.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ import type { AnyJson, AnyU8a, Inspect, IU8a, Registry } from '../types/index.js
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class Raw extends Uint8Array implements IU8a {
|
|
13
13
|
readonly registry: Registry;
|
|
14
|
-
createdAtHash?: IU8a;
|
|
15
|
-
initialU8aLength?: number;
|
|
14
|
+
createdAtHash?: IU8a | undefined;
|
|
15
|
+
initialU8aLength?: number | undefined;
|
|
16
16
|
isStorageFallback?: boolean;
|
|
17
17
|
/**
|
|
18
18
|
* @description This ensures that operators such as clice, filter, map, etc. return
|
package/native/Struct.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { AnyJson, BareOpts, Codec, CodecClass, Inspect, IStruct, IU8a, Registry } from '../types/index.js';
|
|
2
|
+
import type { AnyJson, BareOpts, Codec, CodecClass, DefinitionSetter, Inspect, IStruct, IU8a, Registry } from '../types/index.js';
|
|
3
3
|
type TypesDef<T = Codec> = Record<string, string | CodecClass<T>>;
|
|
4
4
|
type Definition = [CodecClass[], string[]];
|
|
5
|
-
interface Options {
|
|
6
|
-
definition?: Definition;
|
|
7
|
-
setDefinition?: (d: Definition) => Definition;
|
|
8
|
-
}
|
|
9
5
|
/**
|
|
10
6
|
* @name Struct
|
|
11
7
|
* @description
|
|
@@ -27,10 +23,10 @@ export declare class Struct<S extends TypesDef = TypesDef, V extends {
|
|
|
27
23
|
}> extends Map<keyof S, Codec> implements IStruct<keyof S> {
|
|
28
24
|
#private;
|
|
29
25
|
readonly registry: Registry;
|
|
30
|
-
createdAtHash?: IU8a;
|
|
26
|
+
createdAtHash?: IU8a | undefined;
|
|
31
27
|
initialU8aLength?: number;
|
|
32
28
|
isStorageFallback?: boolean;
|
|
33
|
-
constructor(registry: Registry, Types: S, value?: V | Map<unknown, unknown> | unknown[] | HexString | null, jsonMap?: Map<string, string>, { definition, setDefinition }?:
|
|
29
|
+
constructor(registry: Registry, Types: S, value?: V | Map<unknown, unknown> | unknown[] | HexString | null, jsonMap?: Map<string, string>, { definition, setDefinition }?: DefinitionSetter<Definition>);
|
|
34
30
|
static with<S extends TypesDef>(Types: S, jsonMap?: Map<string, string>): CodecClass<Struct<S>>;
|
|
35
31
|
/**
|
|
36
32
|
* @description The available keys for this struct
|
package/package.json
CHANGED
package/packageInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageInfo = { name: '@polkadot/types-codec', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '10.3.
|
|
1
|
+
export const packageInfo = { name: '@polkadot/types-codec', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '10.3.3' };
|
package/types/codec.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { IU8a } from './interfaces.js';
|
|
|
4
4
|
import type { Registry } from './registry.js';
|
|
5
5
|
export type BareOpts = boolean | Record<string, boolean>;
|
|
6
6
|
export interface Inspect {
|
|
7
|
-
inner?: Inspect[];
|
|
7
|
+
inner?: Inspect[] | undefined;
|
|
8
8
|
name?: string;
|
|
9
9
|
outer?: Uint8Array[];
|
|
10
10
|
}
|
|
@@ -22,13 +22,13 @@ export interface Codec {
|
|
|
22
22
|
* The block at which this value was retrieved/created (set to non-empty when
|
|
23
23
|
* retrieved from storage)
|
|
24
24
|
*/
|
|
25
|
-
createdAtHash?: IU8a;
|
|
25
|
+
createdAtHash?: IU8a | undefined;
|
|
26
26
|
/**
|
|
27
27
|
* @description
|
|
28
28
|
* The length of the initial encoded value (Only available when the value was
|
|
29
29
|
* constructed from a Uint8Array input)
|
|
30
30
|
*/
|
|
31
|
-
initialU8aLength?: number;
|
|
31
|
+
initialU8aLength?: number | undefined;
|
|
32
32
|
/**
|
|
33
33
|
* @description
|
|
34
34
|
* (internal usage) Indicates that the value was created via a fallback. This
|
package/types/helpers.d.ts
CHANGED
package/types/registry.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type RegistryTypes = Record<string, CodecClass | string | Record<string,
|
|
|
18
18
|
_set: Record<string, number>;
|
|
19
19
|
}>;
|
|
20
20
|
export interface CodecCreateOptions {
|
|
21
|
-
blockHash?: Uint8Array | string | null;
|
|
21
|
+
blockHash?: Uint8Array | string | null | undefined;
|
|
22
22
|
isFallback?: boolean;
|
|
23
23
|
isOptional?: boolean;
|
|
24
24
|
isPedantic?: boolean;
|