@polkadot/types-codec 6.12.2-2 → 6.12.2-23
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/Base.cjs +39 -11
- package/base/Base.js +36 -11
- package/base/Enum.cjs +8 -0
- package/base/Enum.js +8 -0
- package/extended/WrapperOpaque.cjs +1 -9
- package/extended/WrapperOpaque.js +1 -9
- package/native/Json.cjs +4 -0
- package/native/Json.js +4 -0
- package/native/Struct.cjs +15 -2
- package/native/Struct.data.cjs +10 -0
- package/native/Struct.data.js +3 -0
- package/native/Struct.js +15 -2
- package/package.json +11 -75
- package/packageInfo.cjs +1 -1
- package/packageInfo.js +1 -1
- package/abstract/AbstractArray.d.ts +0 -84
- package/abstract/AbstractInt.d.ts +0 -75
- package/abstract/index.d.ts +0 -2
- package/base/Base.d.ts +0 -54
- package/base/Compact.d.ts +0 -83
- package/base/DoNotConstruct.d.ts +0 -33
- package/base/Enum.d.ts +0 -101
- package/base/Int.d.ts +0 -16
- package/base/Null.d.ts +0 -54
- package/base/Option.d.ts +0 -88
- package/base/Result.d.ts +0 -46
- package/base/Tuple.d.ts +0 -39
- package/base/UInt.d.ts +0 -15
- package/base/Vec.d.ts +0 -28
- package/base/VecAny.d.ts +0 -15
- package/base/VecFixed.d.ts +0 -26
- package/base/index.d.ts +0 -13
- package/bundle.d.ts +0 -7
- package/detectPackage.d.ts +0 -1
- package/extended/BTreeMap.d.ts +0 -5
- package/extended/BTreeSet.d.ts +0 -55
- package/extended/BitVec.d.ts +0 -26
- package/extended/Bytes.d.ts +0 -25
- package/extended/HashMap.d.ts +0 -5
- package/extended/Linkage.d.ts +0 -31
- package/extended/Map.d.ts +0 -50
- package/extended/Range.d.ts +0 -30
- package/extended/Type.d.ts +0 -16
- package/extended/U8aFixed.d.ts +0 -16
- package/extended/WrapperOpaque.d.ts +0 -18
- package/extended/index.d.ts +0 -11
- package/index.d.ts +0 -2
- package/native/Bool.d.ts +0 -62
- package/native/Date.d.ts +0 -76
- package/native/Json.d.ts +0 -55
- package/native/Raw.d.ts +0 -90
- package/native/Set.d.ts +0 -76
- package/native/Struct.d.ts +0 -92
- package/native/Text.d.ts +0 -71
- package/native/index.d.ts +0 -7
- package/packageInfo.d.ts +0 -4
- package/primitive/I128.d.ts +0 -11
- package/primitive/I16.d.ts +0 -11
- package/primitive/I256.d.ts +0 -11
- package/primitive/I32.d.ts +0 -11
- package/primitive/I64.d.ts +0 -11
- package/primitive/I8.d.ts +0 -11
- package/primitive/U128.d.ts +0 -11
- package/primitive/U16.d.ts +0 -11
- package/primitive/U256.d.ts +0 -11
- package/primitive/U32.d.ts +0 -11
- package/primitive/U64.d.ts +0 -11
- package/primitive/U8.d.ts +0 -11
- package/primitive/USize.d.ts +0 -12
- package/primitive/index.d.ts +0 -13
- package/types/codec.d.ts +0 -77
- package/types/helpers.d.ts +0 -14
- package/types/index.d.ts +0 -4
- package/types/interfaces.d.ts +0 -68
- package/types/registry.d.ts +0 -44
- package/utils/compareArray.d.ts +0 -1
- package/utils/compareMap.d.ts +0 -1
- package/utils/compareSet.d.ts +0 -1
- package/utils/decodeU8a.d.ts +0 -13
- package/utils/index.d.ts +0 -9
- package/utils/mapToTypeMap.d.ts +0 -5
- package/utils/sanitize.d.ts +0 -16
- package/utils/sortValues.d.ts +0 -13
- package/utils/typeToConstructor.d.ts +0 -2
- package/utils/typesToMap.d.ts +0 -2
- package/utils/util.d.ts +0 -3
package/native/Text.d.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { AnyU8a, Codec, CodecRegistry, IU8a } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* @name Text
|
|
5
|
-
* @description
|
|
6
|
-
* This is a string wrapper, along with the length. It is used both for strings as well
|
|
7
|
-
* as items such as documentation. It simply extends the standard JS `String` built-in
|
|
8
|
-
* object, inheriting all methods exposed from `String`.
|
|
9
|
-
* @noInheritDoc
|
|
10
|
-
*/
|
|
11
|
-
export declare class Text extends String implements Codec {
|
|
12
|
-
#private;
|
|
13
|
-
readonly registry: CodecRegistry;
|
|
14
|
-
createdAtHash?: IU8a;
|
|
15
|
-
constructor(registry: CodecRegistry, value?: null | Text | string | AnyU8a | {
|
|
16
|
-
toString: () => string;
|
|
17
|
-
});
|
|
18
|
-
/**
|
|
19
|
-
* @description The length of the value when encoded as a Uint8Array
|
|
20
|
-
*/
|
|
21
|
-
get encodedLength(): number;
|
|
22
|
-
/**
|
|
23
|
-
* @description The length of the initial encoded value (Only available when constructed from a Uint8Array)
|
|
24
|
-
*/
|
|
25
|
-
get initialU8aLength(): number | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* @description returns a hash of the contents
|
|
28
|
-
*/
|
|
29
|
-
get hash(): IU8a;
|
|
30
|
-
/**
|
|
31
|
-
* @description Checks if the value is an empty value
|
|
32
|
-
*/
|
|
33
|
-
get isEmpty(): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* @description The length of the value
|
|
36
|
-
*/
|
|
37
|
-
get length(): number;
|
|
38
|
-
/**
|
|
39
|
-
* @description Compares the value of the input to see if there is a match
|
|
40
|
-
*/
|
|
41
|
-
eq(other?: unknown): boolean;
|
|
42
|
-
/**
|
|
43
|
-
* @description Set an override value for this
|
|
44
|
-
*/
|
|
45
|
-
setOverride(override: string): void;
|
|
46
|
-
/**
|
|
47
|
-
* @description Returns a hex string representation of the value
|
|
48
|
-
*/
|
|
49
|
-
toHex(): HexString;
|
|
50
|
-
/**
|
|
51
|
-
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
52
|
-
*/
|
|
53
|
-
toHuman(): string;
|
|
54
|
-
/**
|
|
55
|
-
* @description Converts the Object to JSON, typically used for RPC transfers
|
|
56
|
-
*/
|
|
57
|
-
toJSON(): string;
|
|
58
|
-
/**
|
|
59
|
-
* @description Returns the base runtime type name for this instance
|
|
60
|
-
*/
|
|
61
|
-
toRawType(): string;
|
|
62
|
-
/**
|
|
63
|
-
* @description Returns the string representation of the value
|
|
64
|
-
*/
|
|
65
|
-
toString(): string;
|
|
66
|
-
/**
|
|
67
|
-
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
68
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
69
|
-
*/
|
|
70
|
-
toU8a(isBare?: boolean): Uint8Array;
|
|
71
|
-
}
|
package/native/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { bool, bool as Bool } from './Bool';
|
|
2
|
-
export { CodecDate, CodecDate as Date } from './Date';
|
|
3
|
-
export { Json } from './Json';
|
|
4
|
-
export { Raw } from './Raw';
|
|
5
|
-
export { CodecSet, CodecSet as Set } from './Set';
|
|
6
|
-
export { Struct } from './Struct';
|
|
7
|
-
export { Text } from './Text';
|
package/packageInfo.d.ts
DELETED
package/primitive/I128.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Int } from '../base/Int';
|
|
2
|
-
declare const i128_base: import("../types").CodecClass<Int>;
|
|
3
|
-
/**
|
|
4
|
-
* @name i128
|
|
5
|
-
* @description
|
|
6
|
-
* A 128-bit signed integer
|
|
7
|
-
*/
|
|
8
|
-
export declare class i128 extends i128_base {
|
|
9
|
-
readonly __IntType = "i128";
|
|
10
|
-
}
|
|
11
|
-
export {};
|
package/primitive/I16.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Int } from '../base/Int';
|
|
2
|
-
declare const i16_base: import("../types").CodecClass<Int>;
|
|
3
|
-
/**
|
|
4
|
-
* @name i16
|
|
5
|
-
* @description
|
|
6
|
-
* A 16-bit signed integer
|
|
7
|
-
*/
|
|
8
|
-
export declare class i16 extends i16_base {
|
|
9
|
-
readonly __IntType = "i16";
|
|
10
|
-
}
|
|
11
|
-
export {};
|
package/primitive/I256.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Int } from '../base/Int';
|
|
2
|
-
declare const i256_base: import("../types").CodecClass<Int>;
|
|
3
|
-
/**
|
|
4
|
-
* @name i256
|
|
5
|
-
* @description
|
|
6
|
-
* A 256-bit signed integer
|
|
7
|
-
*/
|
|
8
|
-
export declare class i256 extends i256_base {
|
|
9
|
-
readonly __IntType = "i256";
|
|
10
|
-
}
|
|
11
|
-
export {};
|
package/primitive/I32.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Int } from '../base/Int';
|
|
2
|
-
declare const i32_base: import("../types").CodecClass<Int>;
|
|
3
|
-
/**
|
|
4
|
-
* @name i32
|
|
5
|
-
* @description
|
|
6
|
-
* A 32-bit signed integer
|
|
7
|
-
*/
|
|
8
|
-
export declare class i32 extends i32_base {
|
|
9
|
-
readonly __IntType = "i32";
|
|
10
|
-
}
|
|
11
|
-
export {};
|
package/primitive/I64.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Int } from '../base/Int';
|
|
2
|
-
declare const i64_base: import("../types").CodecClass<Int>;
|
|
3
|
-
/**
|
|
4
|
-
* @name i64
|
|
5
|
-
* @description
|
|
6
|
-
* A 64-bit signed integer
|
|
7
|
-
*/
|
|
8
|
-
export declare class i64 extends i64_base {
|
|
9
|
-
readonly __IntType = "i64";
|
|
10
|
-
}
|
|
11
|
-
export {};
|
package/primitive/I8.d.ts
DELETED
package/primitive/U128.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { UInt } from '../base/UInt';
|
|
2
|
-
declare const u128_base: import("../types").CodecClass<UInt>;
|
|
3
|
-
/**
|
|
4
|
-
* @name u128
|
|
5
|
-
* @description
|
|
6
|
-
* A 128-bit unsigned integer
|
|
7
|
-
*/
|
|
8
|
-
export declare class u128 extends u128_base {
|
|
9
|
-
readonly __UIntType = "u128";
|
|
10
|
-
}
|
|
11
|
-
export {};
|
package/primitive/U16.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { UInt } from '../base/UInt';
|
|
2
|
-
declare const u16_base: import("../types").CodecClass<UInt>;
|
|
3
|
-
/**
|
|
4
|
-
* @name u16
|
|
5
|
-
* @description
|
|
6
|
-
* A 16-bit unsigned integer
|
|
7
|
-
*/
|
|
8
|
-
export declare class u16 extends u16_base {
|
|
9
|
-
readonly __UIntType = "u16";
|
|
10
|
-
}
|
|
11
|
-
export {};
|
package/primitive/U256.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { UInt } from '../base/UInt';
|
|
2
|
-
declare const u256_base: import("../types").CodecClass<UInt>;
|
|
3
|
-
/**
|
|
4
|
-
* @name u256
|
|
5
|
-
* @description
|
|
6
|
-
* A 256-bit unsigned integer
|
|
7
|
-
*/
|
|
8
|
-
export declare class u256 extends u256_base {
|
|
9
|
-
readonly __UIntType = "u256";
|
|
10
|
-
}
|
|
11
|
-
export {};
|
package/primitive/U32.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { UInt } from '../base/UInt';
|
|
2
|
-
declare const u32_base: import("../types").CodecClass<UInt>;
|
|
3
|
-
/**
|
|
4
|
-
* @name u32
|
|
5
|
-
* @description
|
|
6
|
-
* A 32-bit unsigned integer
|
|
7
|
-
*/
|
|
8
|
-
export declare class u32 extends u32_base {
|
|
9
|
-
readonly __UIntType = "u32";
|
|
10
|
-
}
|
|
11
|
-
export {};
|
package/primitive/U64.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { UInt } from '../base/UInt';
|
|
2
|
-
declare const u64_base: import("../types").CodecClass<UInt>;
|
|
3
|
-
/**
|
|
4
|
-
* @name u64
|
|
5
|
-
* @description
|
|
6
|
-
* A 64-bit unsigned integer
|
|
7
|
-
*/
|
|
8
|
-
export declare class u64 extends u64_base {
|
|
9
|
-
readonly __UIntType = "u64";
|
|
10
|
-
}
|
|
11
|
-
export {};
|
package/primitive/U8.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { UInt } from '../base/UInt';
|
|
2
|
-
declare const u8_base: import("../types").CodecClass<UInt>;
|
|
3
|
-
/**
|
|
4
|
-
* @name u8
|
|
5
|
-
* @description
|
|
6
|
-
* An 8-bit unsigned integer
|
|
7
|
-
*/
|
|
8
|
-
export declare class u8 extends u8_base {
|
|
9
|
-
readonly __UIntType = "u8";
|
|
10
|
-
}
|
|
11
|
-
export {};
|
package/primitive/USize.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { CodecRegistry } from '../types';
|
|
2
|
-
import { u32 } from './U32';
|
|
3
|
-
/**
|
|
4
|
-
* @name USize
|
|
5
|
-
* @description
|
|
6
|
-
* A System default unsigned number, typically used in RPC to report non-consensus
|
|
7
|
-
* data. It is a wrapper for [[U32]] as a WASM default (as generated by Rust bindings).
|
|
8
|
-
* It is not to be used, since it created consensus mismatches.
|
|
9
|
-
*/
|
|
10
|
-
export declare class usize extends u32 {
|
|
11
|
-
constructor(registry: CodecRegistry, value?: unknown);
|
|
12
|
-
}
|
package/primitive/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { i8, i8 as I8 } from './I8';
|
|
2
|
-
export { i16, i16 as I16 } from './I16';
|
|
3
|
-
export { i32, i32 as I32 } from './I32';
|
|
4
|
-
export { i64, i64 as I64 } from './I64';
|
|
5
|
-
export { i128, i128 as I128 } from './I128';
|
|
6
|
-
export { i256, i256 as I256 } from './I256';
|
|
7
|
-
export { u8, u8 as U8 } from './U8';
|
|
8
|
-
export { u16, u16 as U16 } from './U16';
|
|
9
|
-
export { u32, u32 as U32 } from './U32';
|
|
10
|
-
export { u64, u64 as U64 } from './U64';
|
|
11
|
-
export { u128, u128 as U128 } from './U128';
|
|
12
|
-
export { u256, u256 as U256 } from './U256';
|
|
13
|
-
export { usize, usize as USize } from './USize';
|
package/types/codec.d.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { AnyJson } from './helpers';
|
|
3
|
-
import type { IU8a } from './interfaces';
|
|
4
|
-
import type { CodecRegistry } from './registry';
|
|
5
|
-
export declare type BareOpts = boolean | Record<string, boolean>;
|
|
6
|
-
/**
|
|
7
|
-
* @name Codec
|
|
8
|
-
* @description
|
|
9
|
-
* The base Codec interface. All types implement the interface provided here. Additionally
|
|
10
|
-
* implementors can add their own specific interfaces and helpers with getters and functions.
|
|
11
|
-
* The Codec Base is however required for operating as an encoding/decoding layer
|
|
12
|
-
*/
|
|
13
|
-
export interface Codec {
|
|
14
|
-
/**
|
|
15
|
-
* @description The length of the value when encoded as a Uint8Array
|
|
16
|
-
*/
|
|
17
|
-
readonly encodedLength: number;
|
|
18
|
-
/**
|
|
19
|
-
* @description Returns a hash of the value
|
|
20
|
-
*/
|
|
21
|
-
readonly hash: IU8a;
|
|
22
|
-
/**
|
|
23
|
-
* @description The length of the initial encoded value (Only available when constructed from a Uint8Array)
|
|
24
|
-
*/
|
|
25
|
-
readonly initialU8aLength?: number;
|
|
26
|
-
/**
|
|
27
|
-
* @description Checks if the value is an empty value
|
|
28
|
-
*/
|
|
29
|
-
readonly isEmpty: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* @description The registry associated with this object
|
|
32
|
-
*/
|
|
33
|
-
readonly registry: CodecRegistry;
|
|
34
|
-
/**
|
|
35
|
-
* @description The block at which this value was retrieved/created (set to non-empty when retrieved from storage)
|
|
36
|
-
*/
|
|
37
|
-
createdAtHash?: IU8a;
|
|
38
|
-
/**
|
|
39
|
-
* @description Compares the value of the input to see if there is a match
|
|
40
|
-
*/
|
|
41
|
-
eq(other?: unknown): boolean;
|
|
42
|
-
/**
|
|
43
|
-
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
|
|
44
|
-
*/
|
|
45
|
-
toHex(isLe?: boolean): HexString;
|
|
46
|
-
/**
|
|
47
|
-
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
48
|
-
*/
|
|
49
|
-
toHuman(isExtended?: boolean): AnyJson;
|
|
50
|
-
/**
|
|
51
|
-
* @description Converts the Object to JSON, typically used for RPC transfers
|
|
52
|
-
*/
|
|
53
|
-
toJSON(): AnyJson;
|
|
54
|
-
/**
|
|
55
|
-
* @description Returns the base runtime type name for this instance
|
|
56
|
-
*/
|
|
57
|
-
toRawType(): string;
|
|
58
|
-
/**
|
|
59
|
-
* @description Returns the string representation of the value
|
|
60
|
-
*/
|
|
61
|
-
toString(): string;
|
|
62
|
-
/**
|
|
63
|
-
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
64
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
65
|
-
*/
|
|
66
|
-
toU8a(isBare?: BareOpts): Uint8Array;
|
|
67
|
-
}
|
|
68
|
-
export interface CodecClass<T = Codec> {
|
|
69
|
-
/**
|
|
70
|
-
* @description An internal fallback type (previous generation) if encoding fails
|
|
71
|
-
*/
|
|
72
|
-
readonly __fallbackType?: string;
|
|
73
|
-
new (registry: CodecRegistry, ...args: any[]): T;
|
|
74
|
-
}
|
|
75
|
-
export declare type CodecClassDef<T = Codec> = Record<string, CodecClass<T>>;
|
|
76
|
-
export declare type CodecTo = 'toHex' | 'toJSON' | 'toString' | 'toU8a';
|
|
77
|
-
export declare type ArgsDef = Record<string, CodecClass | string>;
|
package/types/helpers.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="bn.js" />
|
|
2
|
-
import type { BN } from '@polkadot/util';
|
|
3
|
-
import type { Codec } from './codec';
|
|
4
|
-
export declare type AnyJson = string | number | boolean | null | undefined | AnyJson[] | {
|
|
5
|
-
[index: string]: AnyJson;
|
|
6
|
-
};
|
|
7
|
-
export declare type AnyFunction = (...args: any[]) => any;
|
|
8
|
-
export declare type AnyNumber = BN | bigint | Uint8Array | number | string;
|
|
9
|
-
export declare type AnyString = string | string;
|
|
10
|
-
export declare type AnyTuple = Codec[];
|
|
11
|
-
export declare type AnyU8a = Uint8Array | number[] | string;
|
|
12
|
-
export declare type UIntBitLength = 8 | 16 | 32 | 64 | 128 | 256;
|
|
13
|
-
export declare type U8aBitLength = 8 | 16 | 32 | 64 | 128 | 160 | 256 | 264 | 512 | 520 | 1024 | 2048;
|
|
14
|
-
export declare type AnyTupleValue = AnyU8a | (Codec | AnyU8a | AnyNumber | AnyString | undefined | null)[];
|
package/types/index.d.ts
DELETED
package/types/interfaces.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/// <reference types="bn.js" />
|
|
2
|
-
import type { BN } from '@polkadot/util';
|
|
3
|
-
import type { ArgsDef, Codec } from './codec';
|
|
4
|
-
import type { AnyTuple } from './helpers';
|
|
5
|
-
export interface ICompact<T extends INumber = INumber> extends Codec {
|
|
6
|
-
toBigInt(): bigint;
|
|
7
|
-
toBn(): BN;
|
|
8
|
-
toNumber(): number;
|
|
9
|
-
unwrap(): T;
|
|
10
|
-
}
|
|
11
|
-
export interface IEnum extends Codec {
|
|
12
|
-
readonly defIndexes: number[];
|
|
13
|
-
readonly defKeys: string[];
|
|
14
|
-
readonly index: number;
|
|
15
|
-
readonly isBasic: boolean;
|
|
16
|
-
readonly type: string;
|
|
17
|
-
readonly value: Codec;
|
|
18
|
-
toNumber(): number;
|
|
19
|
-
}
|
|
20
|
-
export interface IMap<K extends Codec = Codec, V extends Codec = Codec> extends Map<K, V>, Codec {
|
|
21
|
-
}
|
|
22
|
-
export interface INumber extends Codec {
|
|
23
|
-
bitLength(): number;
|
|
24
|
-
toBigInt(): bigint;
|
|
25
|
-
toBn(): BN;
|
|
26
|
-
toNumber(): number;
|
|
27
|
-
}
|
|
28
|
-
export interface IOption<T extends Codec = Codec> extends Codec {
|
|
29
|
-
readonly isNone: boolean;
|
|
30
|
-
readonly isSome: boolean;
|
|
31
|
-
readonly value: Codec;
|
|
32
|
-
unwrap(): T;
|
|
33
|
-
unwrapOr<O>(other: O): T | O;
|
|
34
|
-
unwrapOrDefault(): T;
|
|
35
|
-
}
|
|
36
|
-
export interface IResult<O extends Codec = Codec, E extends Codec = Codec> extends IEnum {
|
|
37
|
-
readonly asErr: E;
|
|
38
|
-
readonly asOk: O;
|
|
39
|
-
readonly isErr: boolean;
|
|
40
|
-
readonly isOk: boolean;
|
|
41
|
-
}
|
|
42
|
-
export interface ISet<K = string> extends Set<K>, Codec {
|
|
43
|
-
readonly strings: string[];
|
|
44
|
-
}
|
|
45
|
-
export interface IStruct<K = string, V extends Codec = Codec> extends Map<K, V>, Codec {
|
|
46
|
-
readonly defKeys: string[];
|
|
47
|
-
getAtIndex(index: number): Codec;
|
|
48
|
-
toArray(): Codec[];
|
|
49
|
-
}
|
|
50
|
-
export declare type ITuple<T extends AnyTuple = Codec[]> = T & Codec;
|
|
51
|
-
export interface IU8a extends Uint8Array, Codec {
|
|
52
|
-
readonly isAscii: boolean;
|
|
53
|
-
readonly isUtf8: boolean;
|
|
54
|
-
bitLength(): number;
|
|
55
|
-
toHuman(isExtended?: boolean): any;
|
|
56
|
-
toJSON(): any;
|
|
57
|
-
toUtf8(): string;
|
|
58
|
-
}
|
|
59
|
-
export interface IVec<T extends Codec = Codec> extends Array<T>, Codec {
|
|
60
|
-
toArray(): T[];
|
|
61
|
-
}
|
|
62
|
-
export interface IMethod<A extends AnyTuple = AnyTuple> extends Codec {
|
|
63
|
-
readonly args: A;
|
|
64
|
-
readonly argsDef: ArgsDef;
|
|
65
|
-
readonly callIndex: Uint8Array;
|
|
66
|
-
readonly data: Uint8Array;
|
|
67
|
-
is: (tx: IMethod<AnyTuple>) => tx is IMethod<A>;
|
|
68
|
-
}
|
package/types/registry.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/// <reference types="bn.js" />
|
|
2
|
-
import type { BN } from '@polkadot/util';
|
|
3
|
-
import type { Codec, CodecClass } from './codec';
|
|
4
|
-
import type { ICompact, IEnum, IMap, IMethod, INumber, IOption, IResult, ISet, IStruct, ITuple, IU8a, IVec } from './interfaces';
|
|
5
|
-
export declare 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;
|
|
6
|
-
export declare type RegistryTypes = Record<string, CodecClass | string | Record<string, string> | {
|
|
7
|
-
_enum: string[] | Record<string, number> | Record<string, string | null>;
|
|
8
|
-
} | {
|
|
9
|
-
_set: Record<string, number>;
|
|
10
|
-
}>;
|
|
11
|
-
export interface CodecCreateOptions {
|
|
12
|
-
blockHash?: Uint8Array | string | null;
|
|
13
|
-
isOptional?: boolean;
|
|
14
|
-
isPedantic?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export interface CodecRegistry {
|
|
17
|
-
readonly chainDecimals: number[];
|
|
18
|
-
readonly chainSS58: number | undefined;
|
|
19
|
-
readonly chainTokens: string[];
|
|
20
|
-
createdAtHash?: IU8a;
|
|
21
|
-
findMetaCall(callIndex: Uint8Array): unknown;
|
|
22
|
-
findMetaError(errorIndex: Uint8Array | {
|
|
23
|
-
error: BN;
|
|
24
|
-
index: BN;
|
|
25
|
-
}): unknown;
|
|
26
|
-
findMetaEvent(eventIndex: Uint8Array): CodecClass<any>;
|
|
27
|
-
isLookupType(value: string): boolean;
|
|
28
|
-
createLookupType(lookupId: ICompact<INumber> | number): string;
|
|
29
|
-
createClassUnsafe<T extends Codec = Codec, K extends string = string>(type: K): CodecClass<T>;
|
|
30
|
-
createTypeUnsafe<T extends Codec = Codec, K extends string = string>(type: K, params: unknown[], options?: CodecCreateOptions): T;
|
|
31
|
-
getClassName(clazz: CodecClass): string | undefined;
|
|
32
|
-
getOrThrow<T extends Codec = Codec, K extends string = string>(name: K, msg?: string): CodecClass<T>;
|
|
33
|
-
getOrUnknown<T extends Codec = Codec, K extends string = string>(name: K): CodecClass<T>;
|
|
34
|
-
getSignedExtensionExtra(): Record<string, string>;
|
|
35
|
-
getSignedExtensionTypes(): Record<string, string>;
|
|
36
|
-
hasClass(name: string): boolean;
|
|
37
|
-
hasDef(name: string): boolean;
|
|
38
|
-
hasType(name: string): boolean;
|
|
39
|
-
hash(data: Uint8Array): IU8a;
|
|
40
|
-
register(type: CodecClass | RegistryTypes): void;
|
|
41
|
-
register(name: string, type: CodecClass): void;
|
|
42
|
-
register(arg1: string | CodecClass | RegistryTypes, arg2?: CodecClass): void;
|
|
43
|
-
setMetadata(metadata: unknown, signedExtensions?: string[], userExtensions?: unknown): void;
|
|
44
|
-
}
|
package/utils/compareArray.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function compareArray(a: unknown[], b?: unknown): boolean;
|
package/utils/compareMap.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function compareMap(a: Map<unknown, unknown>, b?: unknown): boolean;
|
package/utils/compareSet.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function compareSet(a: Set<unknown>, b?: unknown): boolean;
|
package/utils/decodeU8a.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Codec, CodecClass, CodecRegistry } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Given an u8a, and an array of Type constructors, decode the u8a against the
|
|
4
|
-
* types, and return an array of decoded values.
|
|
5
|
-
*
|
|
6
|
-
* @param u8a - The u8a to decode.
|
|
7
|
-
* @param result - The result array (will be returned with values pushed)
|
|
8
|
-
* @param types - The array of CodecClass to decode the U8a against.
|
|
9
|
-
*/
|
|
10
|
-
export declare function decodeU8a<T extends Codec = Codec, E = T>(registry: CodecRegistry, u8a: Uint8Array, types: CodecClass[] | {
|
|
11
|
-
[index: string]: CodecClass;
|
|
12
|
-
}, withZip?: boolean): [E[], number];
|
|
13
|
-
export declare function decodeU8aVec<T extends Codec = Codec>(registry: CodecRegistry, u8a: Uint8Array, start: number, Type: CodecClass<T>, count: number): [T[], number, number];
|
package/utils/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { compareArray } from './compareArray';
|
|
2
|
-
export { compareMap } from './compareMap';
|
|
3
|
-
export { compareSet } from './compareSet';
|
|
4
|
-
export { decodeU8a, decodeU8aVec } from './decodeU8a';
|
|
5
|
-
export { mapToTypeMap } from './mapToTypeMap';
|
|
6
|
-
export { typeToConstructor } from './typeToConstructor';
|
|
7
|
-
export { sanitize } from './sanitize';
|
|
8
|
-
export { sortAsc, sortSet, sortMap } from './sortValues';
|
|
9
|
-
export { typesToMap } from './typesToMap';
|
package/utils/mapToTypeMap.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { CodecClass, CodecRegistry } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* @description takes an input map of the form `{ [string]: string | CodecClass }` and returns a map of `{ [string]: CodecClass }`
|
|
4
|
-
*/
|
|
5
|
-
export declare function mapToTypeMap(registry: CodecRegistry, input: Record<string, string | CodecClass>): Record<string, CodecClass>;
|
package/utils/sanitize.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
interface SanitizeOptions {
|
|
2
|
-
allowNamespaces?: boolean;
|
|
3
|
-
}
|
|
4
|
-
declare type Mapper = (value: string, options?: SanitizeOptions) => string;
|
|
5
|
-
export declare function findClosing(value: string, start: number): number;
|
|
6
|
-
export declare function alias(src: string, dest: string, withChecks?: boolean): Mapper;
|
|
7
|
-
export declare function cleanupCompact(): Mapper;
|
|
8
|
-
export declare function flattenSingleTuple(): Mapper;
|
|
9
|
-
export declare function removeExtensions(type: string, isSized: boolean): Mapper;
|
|
10
|
-
export declare function removeColons(): Mapper;
|
|
11
|
-
export declare function removeGenerics(): Mapper;
|
|
12
|
-
export declare function removePairOf(): Mapper;
|
|
13
|
-
export declare function removeTraits(): Mapper;
|
|
14
|
-
export declare function removeWrap(check: string): Mapper;
|
|
15
|
-
export declare function sanitize(value: String | string, options?: SanitizeOptions): string;
|
|
16
|
-
export {};
|
package/utils/sortValues.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="bn.js" />
|
|
2
|
-
import type { BN } from '@polkadot/util';
|
|
3
|
-
import type { Codec } from '../types';
|
|
4
|
-
declare type SortArg = Codec | Codec[] | number[] | BN | bigint | number | Uint8Array;
|
|
5
|
-
/**
|
|
6
|
-
* Sort keys/values of BTreeSet/BTreeMap in ascending order for encoding compatibility with Rust's BTreeSet/BTreeMap
|
|
7
|
-
* (https://doc.rust-lang.org/stable/std/collections/struct.BTreeSet.html)
|
|
8
|
-
* (https://doc.rust-lang.org/stable/std/collections/struct.BTreeMap.html)
|
|
9
|
-
*/
|
|
10
|
-
export declare function sortAsc<V extends SortArg = Codec>(a: V, b: V): number;
|
|
11
|
-
export declare function sortSet<V extends Codec = Codec>(set: Set<V>): Set<V>;
|
|
12
|
-
export declare function sortMap<K extends Codec = Codec, V extends Codec = Codec>(map: Map<K, V>): Map<K, V>;
|
|
13
|
-
export {};
|
package/utils/typesToMap.d.ts
DELETED
package/utils/util.d.ts
DELETED