@polkadot/types-codec 9.8.2 → 9.9.1
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/base/Enum.d.ts +1 -1
- package/base/Tuple.d.ts +3 -3
- package/cjs/packageInfo.js +1 -1
- package/extended/Linkage.d.ts +1 -1
- package/extended/Range.d.ts +1 -1
- package/extended/WrapperKeepOpaque.d.ts +1 -1
- package/native/Set.d.ts +1 -1
- package/native/Struct.d.ts +2 -2
- package/package.json +3 -3
- package/packageInfo.js +1 -1
- package/types/codec.d.ts +3 -3
- package/types/helpers.d.ts +11 -11
- package/types/interfaces.d.ts +1 -1
- package/types/registry.d.ts +2 -2
- package/utils/sanitize.d.ts +1 -1
- package/utils/sortValues.d.ts +1 -1
package/base/Enum.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ interface EntryDef {
|
|
|
12
12
|
Type: CodecClass;
|
|
13
13
|
index: number;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
type TypesDef = Record<string, EntryDef>;
|
|
16
16
|
interface Options {
|
|
17
17
|
definition?: Definition;
|
|
18
18
|
setDefinition?: (d: Definition) => Definition;
|
package/base/Tuple.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { AnyTupleValue, Codec, CodecClass, Inspect, ITuple, Registry } from '../types';
|
|
2
2
|
import { AbstractArray } from '../abstract/Array';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type TupleType = (CodecClass | string);
|
|
4
|
+
type TupleTypes = TupleType[] | {
|
|
5
5
|
[index: string]: CodecClass | string;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type Definition = [CodecClass[], string[]];
|
|
8
8
|
interface Options {
|
|
9
9
|
definition?: Definition;
|
|
10
10
|
setDefinition?: (d: Definition) => Definition;
|
package/cjs/packageInfo.js
CHANGED
package/extended/Linkage.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Codec, CodecClass, Registry } from '../types';
|
|
|
2
2
|
import { Option } from '../base/Option';
|
|
3
3
|
import { Tuple } from '../base/Tuple';
|
|
4
4
|
import { Struct } from '../native/Struct';
|
|
5
|
-
|
|
5
|
+
type TypeWithValues = [CodecClass, any[]];
|
|
6
6
|
/**
|
|
7
7
|
* @name Linkage
|
|
8
8
|
* @description The wrapper for the result from a LinkedMap
|
package/extended/Range.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AnyJson, Codec, CodecClass, Inspect, Registry } from '../types';
|
|
2
2
|
import { Bytes } from './Bytes';
|
|
3
|
-
|
|
3
|
+
type OpaqueName = 'WrapperKeepOpaque' | 'WrapperOpaque';
|
|
4
4
|
interface Options {
|
|
5
5
|
opaqueName?: OpaqueName;
|
|
6
6
|
}
|
package/native/Set.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { HexString } from '@polkadot/util/types';
|
|
3
3
|
import type { CodecClass, Inspect, ISet, IU8a, Registry } from '../types';
|
|
4
4
|
import { BN } from '@polkadot/util';
|
|
5
|
-
|
|
5
|
+
type SetValues = Record<string, number | BN>;
|
|
6
6
|
/**
|
|
7
7
|
* @name Set
|
|
8
8
|
* @description
|
package/native/Struct.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HexString } from '@polkadot/util/types';
|
|
2
2
|
import type { AnyJson, BareOpts, Codec, CodecClass, Inspect, IStruct, IU8a, Registry } from '../types';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type TypesDef<T = Codec> = Record<string, string | CodecClass<T>>;
|
|
4
|
+
type Definition = [CodecClass[], string[]];
|
|
5
5
|
interface Options {
|
|
6
6
|
definition?: Definition;
|
|
7
7
|
setDefinition?: (d: Definition) => Definition;
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"./cjs/detectPackage.js"
|
|
21
21
|
],
|
|
22
22
|
"type": "module",
|
|
23
|
-
"version": "9.
|
|
23
|
+
"version": "9.9.1",
|
|
24
24
|
"main": "./cjs/index.js",
|
|
25
25
|
"module": "./index.js",
|
|
26
26
|
"types": "./index.d.ts",
|
|
@@ -435,7 +435,7 @@
|
|
|
435
435
|
},
|
|
436
436
|
"dependencies": {
|
|
437
437
|
"@babel/runtime": "^7.20.1",
|
|
438
|
-
"@polkadot/util": "^10.1.
|
|
439
|
-
"@polkadot/x-bigint": "^10.1.
|
|
438
|
+
"@polkadot/util": "^10.1.13",
|
|
439
|
+
"@polkadot/x-bigint": "^10.1.13"
|
|
440
440
|
}
|
|
441
441
|
}
|
package/packageInfo.js
CHANGED
|
@@ -7,5 +7,5 @@ export const packageInfo = {
|
|
|
7
7
|
name: '@polkadot/types-codec',
|
|
8
8
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
9
9
|
type: 'esm',
|
|
10
|
-
version: '9.
|
|
10
|
+
version: '9.9.1'
|
|
11
11
|
};
|
package/types/codec.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { HexString } from '@polkadot/util/types';
|
|
|
2
2
|
import type { AnyJson } from './helpers';
|
|
3
3
|
import type { IU8a } from './interfaces';
|
|
4
4
|
import type { Registry } from './registry';
|
|
5
|
-
export
|
|
5
|
+
export type BareOpts = boolean | Record<string, boolean>;
|
|
6
6
|
export interface Inspect {
|
|
7
7
|
inner?: Inspect[];
|
|
8
8
|
name?: string;
|
|
@@ -85,5 +85,5 @@ export interface CodecClass<T = Codec> {
|
|
|
85
85
|
readonly __fallbackType?: string;
|
|
86
86
|
new (registry: Registry, ...args: any[]): T;
|
|
87
87
|
}
|
|
88
|
-
export
|
|
89
|
-
export
|
|
88
|
+
export type CodecTo = 'toHex' | 'toJSON' | 'toPrimitive' | 'toString' | 'toU8a';
|
|
89
|
+
export type ArgsDef = Record<string, CodecClass | string>;
|
package/types/helpers.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import type { BN } from '@polkadot/util';
|
|
3
3
|
import type { Codec } from './codec';
|
|
4
|
-
export
|
|
4
|
+
export type AnyJson = string | number | boolean | null | undefined | AnyJson[] | {
|
|
5
5
|
[index: string]: AnyJson;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
7
|
+
export type AnyFunction = (...args: any[]) => any;
|
|
8
|
+
export type AnyNumber = BN | bigint | Uint8Array | number | string;
|
|
9
|
+
export type AnyFloat = Number | number | Uint8Array | string;
|
|
10
|
+
export type AnyString = String | string;
|
|
11
|
+
export type AnyBool = Boolean | boolean;
|
|
12
|
+
export type AnyTuple = Codec[];
|
|
13
|
+
export type AnyU8a = Uint8Array | number[] | string;
|
|
14
|
+
export type UIntBitLength = 8 | 16 | 32 | 64 | 128 | 256;
|
|
15
|
+
export type U8aBitLength = 8 | 16 | 32 | 64 | 128 | 160 | 256 | 264 | 512 | 520 | 1024 | 2048;
|
|
16
|
+
export type AnyTupleValue = AnyU8a | (Codec | AnyU8a | AnyNumber | AnyString | undefined | null)[];
|
package/types/interfaces.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export interface IStruct<K = string, V extends Codec = Codec> extends Map<K, V>,
|
|
|
53
53
|
}
|
|
54
54
|
export interface IText extends String, Codec {
|
|
55
55
|
}
|
|
56
|
-
export
|
|
56
|
+
export type ITuple<T extends AnyTuple = Codec[]> = T & Codec;
|
|
57
57
|
export interface IU8a extends Uint8Array, Codec {
|
|
58
58
|
readonly isAscii: boolean;
|
|
59
59
|
readonly isUtf8: boolean;
|
package/types/registry.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { BN } from '@polkadot/util';
|
|
|
3
3
|
import type { Codec, CodecClass } from './codec';
|
|
4
4
|
import type { AnyTuple } from './helpers';
|
|
5
5
|
import type { ICompact, IEnum, IMap, IMethod, INumber, IOption, IResult, ISet, IStruct, ITuple, IU8a, IVec } from './interfaces';
|
|
6
|
-
export
|
|
6
|
+
export type OnlyCodec<K, T, Types> = K extends keyof Types ? Types[K] : T extends ICompact | IEnum | IMap | IMethod | INumber | IOption | IResult | ISet | IStruct | ITuple | IU8a | IVec ? T : T extends Codec ? T : never;
|
|
7
7
|
export interface RegistryError {
|
|
8
8
|
args: string[];
|
|
9
9
|
docs: string[];
|
|
@@ -12,7 +12,7 @@ export interface RegistryError {
|
|
|
12
12
|
name: string;
|
|
13
13
|
section: string;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export type RegistryTypes = Record<string, CodecClass | string | Record<string, string> | {
|
|
16
16
|
_enum: string[] | Record<string, number> | Record<string, string | null>;
|
|
17
17
|
} | {
|
|
18
18
|
_set: Record<string, number>;
|
package/utils/sanitize.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnyString } from '../types';
|
|
2
|
-
|
|
2
|
+
type Mapper = (value: string) => string;
|
|
3
3
|
export declare function trim(): Mapper;
|
|
4
4
|
export declare function findClosing(value: string, start: number): number;
|
|
5
5
|
export declare function alias(src: string, dest: string, withChecks?: boolean): Mapper;
|
package/utils/sortValues.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import type { BN } from '@polkadot/util';
|
|
3
3
|
import type { Codec } from '../types';
|
|
4
|
-
|
|
4
|
+
type SortArg = Codec | Codec[] | number[] | BN | bigint | number | Uint8Array;
|
|
5
5
|
/**
|
|
6
6
|
* Sort keys/values of BTreeSet/BTreeMap in ascending order for encoding compatibility with Rust's BTreeSet/BTreeMap
|
|
7
7
|
* (https://doc.rust-lang.org/stable/std/collections/struct.BTreeSet.html)
|