@polkadot/types-codec 6.12.2-18 → 6.12.2-21
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/package.json +3 -78
- 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 -56
- package/base/Compact.d.ts +0 -83
- package/base/DoNotConstruct.d.ts +0 -33
- package/base/Enum.d.ts +0 -105
- 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/checkTypes.manual.cjs +0 -12
- package/checkTypes.manual.js +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 -14
- 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 -56
- package/native/Raw.d.ts +0 -90
- package/native/Set.d.ts +0 -76
- package/native/Struct.d.ts +0 -93
- 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 -69
- package/types/registry.d.ts +0 -61
- 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/base/Compact.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/// <reference types="bn.js" />
|
|
2
|
-
import type { BN } from '@polkadot/util';
|
|
3
|
-
import type { HexString } from '@polkadot/util/types';
|
|
4
|
-
import type { AnyJson, AnyNumber, CodecClass, CodecRegistry, ICompact, INumber, IU8a } from '../types';
|
|
5
|
-
/**
|
|
6
|
-
* @name Compact
|
|
7
|
-
* @description
|
|
8
|
-
* A compact length-encoding codec wrapper. It performs the same function as Length, however
|
|
9
|
-
* differs in that it uses a variable number of bytes to do the actual encoding. This is mostly
|
|
10
|
-
* used by other types to add length-prefixed encoding, or in the case of wrapped types, taking
|
|
11
|
-
* a number and making the compact representation thereof
|
|
12
|
-
*/
|
|
13
|
-
export declare class Compact<T extends INumber> implements ICompact<T> {
|
|
14
|
-
#private;
|
|
15
|
-
readonly registry: CodecRegistry;
|
|
16
|
-
createdAtHash?: IU8a;
|
|
17
|
-
readonly initialU8aLength?: number;
|
|
18
|
-
constructor(registry: CodecRegistry, Type: CodecClass<T> | string, value?: Compact<T> | AnyNumber);
|
|
19
|
-
static with<T extends INumber>(Type: CodecClass<T> | string): CodecClass<Compact<T>>;
|
|
20
|
-
/** @internal */
|
|
21
|
-
static decodeCompact<T extends INumber>(registry: CodecRegistry, Type: CodecClass<T>, value: Compact<T> | AnyNumber): [T, number];
|
|
22
|
-
/**
|
|
23
|
-
* @description The length of the value when encoded as a Uint8Array
|
|
24
|
-
*/
|
|
25
|
-
get encodedLength(): number;
|
|
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 Returns the number of bits in the value
|
|
36
|
-
*/
|
|
37
|
-
bitLength(): 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 Returns a BigInt representation of the number
|
|
44
|
-
*/
|
|
45
|
-
toBigInt(): bigint;
|
|
46
|
-
/**
|
|
47
|
-
* @description Returns the BN representation of the number
|
|
48
|
-
*/
|
|
49
|
-
toBn(): BN;
|
|
50
|
-
/**
|
|
51
|
-
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
|
|
52
|
-
*/
|
|
53
|
-
toHex(isLe?: boolean): HexString;
|
|
54
|
-
/**
|
|
55
|
-
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
56
|
-
*/
|
|
57
|
-
toHuman(isExtended?: boolean): AnyJson;
|
|
58
|
-
/**
|
|
59
|
-
* @description Converts the Object to JSON, typically used for RPC transfers
|
|
60
|
-
*/
|
|
61
|
-
toJSON(): AnyJson;
|
|
62
|
-
/**
|
|
63
|
-
* @description Returns the number representation for the value
|
|
64
|
-
*/
|
|
65
|
-
toNumber(): number;
|
|
66
|
-
/**
|
|
67
|
-
* @description Returns the base runtime type name for this instance
|
|
68
|
-
*/
|
|
69
|
-
toRawType(): string;
|
|
70
|
-
/**
|
|
71
|
-
* @description Returns the string representation of the value
|
|
72
|
-
*/
|
|
73
|
-
toString(): string;
|
|
74
|
-
/**
|
|
75
|
-
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
76
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
77
|
-
*/
|
|
78
|
-
toU8a(isBare?: boolean): Uint8Array;
|
|
79
|
-
/**
|
|
80
|
-
* @description Returns the embedded [[UInt]] or [[Moment]] value
|
|
81
|
-
*/
|
|
82
|
-
unwrap(): T;
|
|
83
|
-
}
|
package/base/DoNotConstruct.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { AnyJson, Codec, CodecClass, CodecRegistry, IU8a } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* @name DoNotConstruct
|
|
5
|
-
* @description
|
|
6
|
-
* An unknown type that fails on construction with the type info
|
|
7
|
-
*/
|
|
8
|
-
export declare class DoNotConstruct implements Codec {
|
|
9
|
-
#private;
|
|
10
|
-
readonly registry: CodecRegistry;
|
|
11
|
-
createdAtHash?: IU8a;
|
|
12
|
-
constructor(registry: CodecRegistry, typeName?: string);
|
|
13
|
-
static with(typeName?: string): CodecClass;
|
|
14
|
-
/**
|
|
15
|
-
* @description The length of the value when encoded as a Uint8Array
|
|
16
|
-
*/
|
|
17
|
-
get encodedLength(): number;
|
|
18
|
-
/**
|
|
19
|
-
* @description returns a hash of the contents
|
|
20
|
-
*/
|
|
21
|
-
get hash(): IU8a;
|
|
22
|
-
/**
|
|
23
|
-
* @description Checks if the value is an empty value (always true)
|
|
24
|
-
*/
|
|
25
|
-
get isEmpty(): boolean;
|
|
26
|
-
eq(): boolean;
|
|
27
|
-
toHex(): HexString;
|
|
28
|
-
toHuman(): AnyJson;
|
|
29
|
-
toJSON(): AnyJson;
|
|
30
|
-
toRawType(): string;
|
|
31
|
-
toString(): string;
|
|
32
|
-
toU8a(): Uint8Array;
|
|
33
|
-
}
|
package/base/Enum.d.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { AnyJson, Codec, CodecClass, CodecRegistry, IEnum, IU8a } from '../types';
|
|
3
|
-
export interface EnumCodecClass<T = Codec> {
|
|
4
|
-
new (registry: CodecRegistry, value?: any, index?: number): T;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* @name Enum
|
|
8
|
-
* @description
|
|
9
|
-
* This implements an enum, that based on the value wraps a different type. It is effectively
|
|
10
|
-
* an extension to enum where the value type is determined by the actual index.
|
|
11
|
-
*/
|
|
12
|
-
export declare class Enum implements IEnum {
|
|
13
|
-
#private;
|
|
14
|
-
readonly registry: CodecRegistry;
|
|
15
|
-
createdAtHash?: IU8a;
|
|
16
|
-
readonly initialU8aLength?: number;
|
|
17
|
-
constructor(registry: CodecRegistry, Types: Record<string, string | CodecClass> | Record<string, number> | string[], value?: unknown, index?: number);
|
|
18
|
-
static with(Types: Record<string, string | CodecClass> | Record<string, number> | string[]): EnumCodecClass<Enum>;
|
|
19
|
-
/**
|
|
20
|
-
* @description The length of the value when encoded as a Uint8Array
|
|
21
|
-
*/
|
|
22
|
-
get encodedLength(): number;
|
|
23
|
-
/**
|
|
24
|
-
* @description returns a hash of the contents
|
|
25
|
-
*/
|
|
26
|
-
get hash(): IU8a;
|
|
27
|
-
/**
|
|
28
|
-
* @description The index of the enum value
|
|
29
|
-
*/
|
|
30
|
-
get index(): number;
|
|
31
|
-
/**
|
|
32
|
-
* @description The value of the enum
|
|
33
|
-
*/
|
|
34
|
-
get inner(): Codec;
|
|
35
|
-
/**
|
|
36
|
-
* @description true if this is a basic enum (no values)
|
|
37
|
-
*/
|
|
38
|
-
get isBasic(): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* @description Checks if the value is an empty value
|
|
41
|
-
*/
|
|
42
|
-
get isEmpty(): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* @description Checks if the Enum points to a [[Null]] type
|
|
45
|
-
*/
|
|
46
|
-
get isNone(): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* @description Checks if the Enum points to a [[Null]] type
|
|
49
|
-
* @deprecated use isNone
|
|
50
|
-
*/
|
|
51
|
-
get isNull(): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* @description The available keys for this enum
|
|
54
|
-
*/
|
|
55
|
-
get defIndexes(): number[];
|
|
56
|
-
/**
|
|
57
|
-
* @description The available keys for this enum
|
|
58
|
-
*/
|
|
59
|
-
get defKeys(): string[];
|
|
60
|
-
/**
|
|
61
|
-
* @description The name of the type this enum value represents
|
|
62
|
-
*/
|
|
63
|
-
get type(): string;
|
|
64
|
-
/**
|
|
65
|
-
* @description The value of the enum
|
|
66
|
-
*/
|
|
67
|
-
get value(): Codec;
|
|
68
|
-
/**
|
|
69
|
-
* @description Compares the value of the input to see if there is a match
|
|
70
|
-
*/
|
|
71
|
-
eq(other?: unknown): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* @description Returns a hex string representation of the value
|
|
74
|
-
*/
|
|
75
|
-
toHex(): HexString;
|
|
76
|
-
/**
|
|
77
|
-
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
78
|
-
*/
|
|
79
|
-
toHuman(isExtended?: boolean): AnyJson;
|
|
80
|
-
/**
|
|
81
|
-
* @description Converts the Object to JSON, typically used for RPC transfers
|
|
82
|
-
*/
|
|
83
|
-
toJSON(): AnyJson;
|
|
84
|
-
/**
|
|
85
|
-
* @description Returns the number representation for the value
|
|
86
|
-
*/
|
|
87
|
-
toNumber(): number;
|
|
88
|
-
/**
|
|
89
|
-
* @description Returns a raw struct representation of the enum types
|
|
90
|
-
*/
|
|
91
|
-
protected _toRawStruct(): string[] | Record<string, string | number>;
|
|
92
|
-
/**
|
|
93
|
-
* @description Returns the base runtime type name for this instance
|
|
94
|
-
*/
|
|
95
|
-
toRawType(): string;
|
|
96
|
-
/**
|
|
97
|
-
* @description Returns the string representation of the value
|
|
98
|
-
*/
|
|
99
|
-
toString(): string;
|
|
100
|
-
/**
|
|
101
|
-
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
102
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
103
|
-
*/
|
|
104
|
-
toU8a(isBare?: boolean): Uint8Array;
|
|
105
|
-
}
|
package/base/Int.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { AnyNumber, CodecClass, CodecRegistry, UIntBitLength } from '../types';
|
|
2
|
-
import { AbstractInt } from '../abstract/AbstractInt';
|
|
3
|
-
/**
|
|
4
|
-
* @name Int
|
|
5
|
-
* @description
|
|
6
|
-
* A generic signed integer codec. For Substrate all numbers are Little Endian encoded,
|
|
7
|
-
* this handles the encoding and decoding of those numbers. Upon construction
|
|
8
|
-
* the bitLength is provided and any additional use keeps the number to this
|
|
9
|
-
* length. This extends `BN`, so all methods available on a normal `BN` object
|
|
10
|
-
* is available here.
|
|
11
|
-
* @noInheritDoc
|
|
12
|
-
*/
|
|
13
|
-
export declare class Int extends AbstractInt {
|
|
14
|
-
constructor(registry: CodecRegistry, value?: AnyNumber, bitLength?: UIntBitLength);
|
|
15
|
-
static with(bitLength: UIntBitLength, typeName?: string): CodecClass<Int>;
|
|
16
|
-
}
|
package/base/Null.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { Codec, CodecRegistry, IU8a } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* @name Null
|
|
5
|
-
* @description
|
|
6
|
-
* Implements a type that does not contain anything (apart from `null`)
|
|
7
|
-
*/
|
|
8
|
-
export declare class Null implements Codec {
|
|
9
|
-
readonly registry: CodecRegistry;
|
|
10
|
-
createdAtHash?: IU8a;
|
|
11
|
-
readonly initialU8aLength = 0;
|
|
12
|
-
constructor(registry: CodecRegistry);
|
|
13
|
-
/**
|
|
14
|
-
* @description The length of the value when encoded as a Uint8Array
|
|
15
|
-
*/
|
|
16
|
-
get encodedLength(): number;
|
|
17
|
-
/**
|
|
18
|
-
* @description returns a hash of the contents
|
|
19
|
-
*/
|
|
20
|
-
get hash(): IU8a;
|
|
21
|
-
/**
|
|
22
|
-
* @description Checks if the value is an empty value (always true)
|
|
23
|
-
*/
|
|
24
|
-
get isEmpty(): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* @description Compares the value of the input to see if there is a match
|
|
27
|
-
*/
|
|
28
|
-
eq(other?: unknown): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* @description Returns a hex string representation of the value
|
|
31
|
-
*/
|
|
32
|
-
toHex(): HexString;
|
|
33
|
-
/**
|
|
34
|
-
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
35
|
-
*/
|
|
36
|
-
toHuman(): null;
|
|
37
|
-
/**
|
|
38
|
-
* @description Converts the Object to JSON, typically used for RPC transfers
|
|
39
|
-
*/
|
|
40
|
-
toJSON(): null;
|
|
41
|
-
/**
|
|
42
|
-
* @description Returns the base runtime type name for this instance
|
|
43
|
-
*/
|
|
44
|
-
toRawType(): string;
|
|
45
|
-
/**
|
|
46
|
-
* @description Returns the string representation of the value
|
|
47
|
-
*/
|
|
48
|
-
toString(): string;
|
|
49
|
-
/**
|
|
50
|
-
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
51
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
52
|
-
*/
|
|
53
|
-
toU8a(isBare?: boolean): Uint8Array;
|
|
54
|
-
}
|
package/base/Option.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { AnyJson, Codec, CodecClass, CodecRegistry, IOption, IU8a } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* @name Option
|
|
5
|
-
* @description
|
|
6
|
-
* An Option is an optional field. Basically the first byte indicates that there is
|
|
7
|
-
* is value to follow. If the byte is `1` there is an actual value. So the Option
|
|
8
|
-
* implements that - decodes, checks for optionality and wraps the required structure
|
|
9
|
-
* with a value if/as required/found.
|
|
10
|
-
*/
|
|
11
|
-
export declare class Option<T extends Codec> implements IOption<T> {
|
|
12
|
-
#private;
|
|
13
|
-
readonly registry: CodecRegistry;
|
|
14
|
-
createdAtHash?: IU8a;
|
|
15
|
-
constructor(registry: CodecRegistry, typeName: CodecClass<T> | string, value?: unknown);
|
|
16
|
-
static with<O extends Codec>(Type: CodecClass<O> | string): CodecClass<Option<O>>;
|
|
17
|
-
/**
|
|
18
|
-
* @description The length of the value when encoded as a Uint8Array
|
|
19
|
-
*/
|
|
20
|
-
get encodedLength(): number;
|
|
21
|
-
/**
|
|
22
|
-
* @description The length of the initial encoded value (Only available when constructed from a Uint8Array)
|
|
23
|
-
*/
|
|
24
|
-
get initialU8aLength(): number | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* @description returns a hash of the contents
|
|
27
|
-
*/
|
|
28
|
-
get hash(): IU8a;
|
|
29
|
-
/**
|
|
30
|
-
* @description Checks if the Option has no value
|
|
31
|
-
*/
|
|
32
|
-
get isEmpty(): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* @description Checks if the Option has no value
|
|
35
|
-
*/
|
|
36
|
-
get isNone(): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* @description Checks if the Option has a value
|
|
39
|
-
*/
|
|
40
|
-
get isSome(): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* @description The actual value for the Option
|
|
43
|
-
*/
|
|
44
|
-
get value(): Codec;
|
|
45
|
-
/**
|
|
46
|
-
* @description Compares the value of the input to see if there is a match
|
|
47
|
-
*/
|
|
48
|
-
eq(other?: unknown): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* @description Returns a hex string representation of the value
|
|
51
|
-
*/
|
|
52
|
-
toHex(): HexString;
|
|
53
|
-
/**
|
|
54
|
-
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
55
|
-
*/
|
|
56
|
-
toHuman(isExtended?: boolean): AnyJson;
|
|
57
|
-
/**
|
|
58
|
-
* @description Converts the Object to JSON, typically used for RPC transfers
|
|
59
|
-
*/
|
|
60
|
-
toJSON(): AnyJson;
|
|
61
|
-
/**
|
|
62
|
-
* @description Returns the base runtime type name for this instance
|
|
63
|
-
*/
|
|
64
|
-
toRawType(isBare?: boolean): string;
|
|
65
|
-
/**
|
|
66
|
-
* @description Returns the string representation of the value
|
|
67
|
-
*/
|
|
68
|
-
toString(): string;
|
|
69
|
-
/**
|
|
70
|
-
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
71
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
72
|
-
*/
|
|
73
|
-
toU8a(isBare?: boolean): Uint8Array;
|
|
74
|
-
/**
|
|
75
|
-
* @description Returns the value that the Option represents (if available), throws if null
|
|
76
|
-
*/
|
|
77
|
-
unwrap(): T;
|
|
78
|
-
/**
|
|
79
|
-
* @description Returns the value that the Option represents (if available) or defaultValue if none
|
|
80
|
-
* @param defaultValue The value to return if the option isNone
|
|
81
|
-
*/
|
|
82
|
-
unwrapOr<O>(defaultValue: O): T | O;
|
|
83
|
-
/**
|
|
84
|
-
* @description Returns the value that the Option represents (if available) or defaultValue if none
|
|
85
|
-
* @param defaultValue The value to return if the option isNone
|
|
86
|
-
*/
|
|
87
|
-
unwrapOrDefault(): T;
|
|
88
|
-
}
|
package/base/Result.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { Codec, CodecClass, CodecRegistry, IResult } from '../types';
|
|
2
|
-
import { Enum } from './Enum';
|
|
3
|
-
/**
|
|
4
|
-
* @name Result
|
|
5
|
-
* @description
|
|
6
|
-
* A Result maps to the Rust Result type, that can either wrap a success or error value
|
|
7
|
-
*/
|
|
8
|
-
export declare class Result<O extends Codec, E extends Codec> extends Enum implements IResult<O, E> {
|
|
9
|
-
constructor(registry: CodecRegistry, Ok: CodecClass<O> | string, Err: CodecClass<E> | string, value?: unknown);
|
|
10
|
-
static with<O extends Codec, E extends Codec>(Types: {
|
|
11
|
-
Ok: CodecClass<O> | string;
|
|
12
|
-
Err: CodecClass<E> | string;
|
|
13
|
-
}): CodecClass<Result<O, E>>;
|
|
14
|
-
/**
|
|
15
|
-
* @description Returns the wrapper Err value (if isErr)
|
|
16
|
-
*/
|
|
17
|
-
get asErr(): E;
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated Use asErr
|
|
20
|
-
*/
|
|
21
|
-
get asError(): E;
|
|
22
|
-
/**
|
|
23
|
-
* @description Returns the wrapper Ok value (if isOk)
|
|
24
|
-
*/
|
|
25
|
-
get asOk(): O;
|
|
26
|
-
/**
|
|
27
|
-
* @description Checks if the Result has no value
|
|
28
|
-
*/
|
|
29
|
-
get isEmpty(): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* @description Checks if the Result wraps an Err value
|
|
32
|
-
*/
|
|
33
|
-
get isErr(): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated Use isErr
|
|
36
|
-
*/
|
|
37
|
-
get isError(): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* @description Checks if the Result wraps an Ok value
|
|
40
|
-
*/
|
|
41
|
-
get isOk(): boolean;
|
|
42
|
-
/**
|
|
43
|
-
* @description Returns the base runtime type name for this instance
|
|
44
|
-
*/
|
|
45
|
-
toRawType(): string;
|
|
46
|
-
}
|
package/base/Tuple.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { AnyTupleValue, Codec, CodecClass, CodecRegistry, ITuple } from '../types';
|
|
2
|
-
import { AbstractArray } from '../abstract/AbstractArray';
|
|
3
|
-
declare type TupleType = (CodecClass | string);
|
|
4
|
-
declare type TupleTypes = TupleType[] | {
|
|
5
|
-
[index: string]: CodecClass | string;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* @name Tuple
|
|
9
|
-
* @description
|
|
10
|
-
* A Tuple defines an anonymous fixed-length array, where each element has its
|
|
11
|
-
* own type. It extends the base JS `Array` object.
|
|
12
|
-
*/
|
|
13
|
-
export declare class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
|
|
14
|
-
#private;
|
|
15
|
-
constructor(registry: CodecRegistry, Types: TupleTypes | TupleType, value?: AnyTupleValue);
|
|
16
|
-
static with(Types: TupleTypes | TupleType): CodecClass<Tuple>;
|
|
17
|
-
/**
|
|
18
|
-
* @description The length of the value when encoded as a Uint8Array
|
|
19
|
-
*/
|
|
20
|
-
get encodedLength(): number;
|
|
21
|
-
/**
|
|
22
|
-
* @description The types definition of the tuple
|
|
23
|
-
*/
|
|
24
|
-
get Types(): string[];
|
|
25
|
-
/**
|
|
26
|
-
* @description Returns the base runtime type name for this instance
|
|
27
|
-
*/
|
|
28
|
-
toRawType(): string;
|
|
29
|
-
/**
|
|
30
|
-
* @description Returns the string representation of the value
|
|
31
|
-
*/
|
|
32
|
-
toString(): string;
|
|
33
|
-
/**
|
|
34
|
-
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
35
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
36
|
-
*/
|
|
37
|
-
toU8a(isBare?: boolean): Uint8Array;
|
|
38
|
-
}
|
|
39
|
-
export {};
|
package/base/UInt.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CodecClass, UIntBitLength } from '../types';
|
|
2
|
-
import { AbstractInt } from '../abstract/AbstractInt';
|
|
3
|
-
/**
|
|
4
|
-
* @name UInt
|
|
5
|
-
* @description
|
|
6
|
-
* A generic unsigned integer codec. For Substrate all numbers are Little Endian encoded,
|
|
7
|
-
* this handles the encoding and decoding of those numbers. Upon construction
|
|
8
|
-
* the bitLength is provided and any additional use keeps the number to this
|
|
9
|
-
* length. This extends `BN`, so all methods available on a normal `BN` object
|
|
10
|
-
* is available here.
|
|
11
|
-
* @noInheritDoc
|
|
12
|
-
*/
|
|
13
|
-
export declare class UInt extends AbstractInt {
|
|
14
|
-
static with(bitLength: UIntBitLength, typeName?: string): CodecClass<UInt>;
|
|
15
|
-
}
|
package/base/Vec.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { Codec, CodecClass, CodecRegistry } from '../types';
|
|
3
|
-
import { AbstractArray } from '../abstract/AbstractArray';
|
|
4
|
-
export declare function decodeVec<T extends Codec>(registry: CodecRegistry, Type: CodecClass<T>, value: Uint8Array | HexString | unknown[], length?: number): [T[], number, number];
|
|
5
|
-
/**
|
|
6
|
-
* @name Vec
|
|
7
|
-
* @description
|
|
8
|
-
* This manages codec arrays. Internally it keeps track of the length (as decoded) and allows
|
|
9
|
-
* construction with the passed `Type` in the constructor. It is an extension to Array, providing
|
|
10
|
-
* specific encoding/decoding on top of the base type.
|
|
11
|
-
*/
|
|
12
|
-
export declare class Vec<T extends Codec> extends AbstractArray<T> {
|
|
13
|
-
#private;
|
|
14
|
-
constructor(registry: CodecRegistry, Type: CodecClass<T> | string, value?: Uint8Array | HexString | unknown[]);
|
|
15
|
-
static with<O extends Codec>(Type: CodecClass<O> | string): CodecClass<Vec<O>>;
|
|
16
|
-
/**
|
|
17
|
-
* @description The type for the items
|
|
18
|
-
*/
|
|
19
|
-
get Type(): string;
|
|
20
|
-
/**
|
|
21
|
-
* @description Finds the index of the value in the array
|
|
22
|
-
*/
|
|
23
|
-
indexOf(_other?: unknown): number;
|
|
24
|
-
/**
|
|
25
|
-
* @description Returns the base runtime type name for this instance
|
|
26
|
-
*/
|
|
27
|
-
toRawType(): string;
|
|
28
|
-
}
|
package/base/VecAny.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Codec } from '../types';
|
|
2
|
-
import { AbstractArray } from '../abstract/AbstractArray';
|
|
3
|
-
/**
|
|
4
|
-
* @name VecAny
|
|
5
|
-
* @description
|
|
6
|
-
* This manages codec arrays, assuming that the inputs are already of type Codec. Unlike
|
|
7
|
-
* a vector, this can be used to manage array-like structures with variable arguments of
|
|
8
|
-
* any types
|
|
9
|
-
*/
|
|
10
|
-
export declare class VecAny<T extends Codec> extends AbstractArray<T> {
|
|
11
|
-
/**
|
|
12
|
-
* @description Returns the base runtime type name for this instance
|
|
13
|
-
*/
|
|
14
|
-
toRawType(): string;
|
|
15
|
-
}
|
package/base/VecFixed.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { Codec, CodecClass, CodecRegistry } from '../types';
|
|
3
|
-
import { AbstractArray } from '../abstract/AbstractArray';
|
|
4
|
-
/**
|
|
5
|
-
* @name VecFixed
|
|
6
|
-
* @description
|
|
7
|
-
* This manages codec arrays of a fixed length
|
|
8
|
-
*/
|
|
9
|
-
export declare class VecFixed<T extends Codec> extends AbstractArray<T> {
|
|
10
|
-
#private;
|
|
11
|
-
constructor(registry: CodecRegistry, Type: CodecClass<T> | string, length: number, value?: Uint8Array | HexString | unknown[]);
|
|
12
|
-
static with<O extends Codec>(Type: CodecClass<O> | string, length: number): CodecClass<VecFixed<O>>;
|
|
13
|
-
/**
|
|
14
|
-
* @description The type for the items
|
|
15
|
-
*/
|
|
16
|
-
get Type(): string;
|
|
17
|
-
/**
|
|
18
|
-
* @description The length of the value when encoded as a Uint8Array
|
|
19
|
-
*/
|
|
20
|
-
get encodedLength(): number;
|
|
21
|
-
toU8a(): Uint8Array;
|
|
22
|
-
/**
|
|
23
|
-
* @description Returns the base runtime type name for this instance
|
|
24
|
-
*/
|
|
25
|
-
toRawType(): string;
|
|
26
|
-
}
|
package/base/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { Base } from './Base';
|
|
2
|
-
export { Compact } from './Compact';
|
|
3
|
-
export { DoNotConstruct } from './DoNotConstruct';
|
|
4
|
-
export { Enum } from './Enum';
|
|
5
|
-
export { Int } from './Int';
|
|
6
|
-
export { Null } from './Null';
|
|
7
|
-
export { Option } from './Option';
|
|
8
|
-
export { Result } from './Result';
|
|
9
|
-
export { Tuple } from './Tuple';
|
|
10
|
-
export { UInt } from './UInt';
|
|
11
|
-
export { Vec } from './Vec';
|
|
12
|
-
export { VecAny } from './VecAny';
|
|
13
|
-
export { VecFixed } from './VecFixed';
|
package/bundle.d.ts
DELETED
package/checkTypes.manual.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("@polkadot/types-augment");
|
|
4
|
-
|
|
5
|
-
var _types = require("@polkadot/types");
|
|
6
|
-
|
|
7
|
-
var _index = require("./index.cjs");
|
|
8
|
-
|
|
9
|
-
// Copyright 2017-2021 @polkadot/types authors & contributors
|
|
10
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
11
|
-
const registry = new _types.TypeRegistry();
|
|
12
|
-
console.log(new _index.U32(registry).divn(1));
|
package/checkTypes.manual.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2021 @polkadot/types authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import '@polkadot/types-augment';
|
|
4
|
-
import { TypeRegistry } from '@polkadot/types';
|
|
5
|
-
import { U32 } from "./index.js";
|
|
6
|
-
const registry = new TypeRegistry();
|
|
7
|
-
console.log(new U32(registry).divn(1));
|
package/detectPackage.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/extended/BTreeMap.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Codec, CodecClass } from '../types';
|
|
2
|
-
import { CodecMap } from './Map';
|
|
3
|
-
export declare class BTreeMap<K extends Codec = Codec, V extends Codec = Codec> extends CodecMap<K, V> {
|
|
4
|
-
static with<K extends Codec, V extends Codec>(keyType: CodecClass<K> | string, valType: CodecClass<V> | string): CodecClass<CodecMap<K, V>>;
|
|
5
|
-
}
|
package/extended/BTreeSet.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { HexString } from '@polkadot/util/types';
|
|
2
|
-
import type { AnyJson, Codec, CodecClass, CodecRegistry, ISet, IU8a } from '../types';
|
|
3
|
-
export declare class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V> {
|
|
4
|
-
#private;
|
|
5
|
-
readonly registry: CodecRegistry;
|
|
6
|
-
createdAtHash?: IU8a;
|
|
7
|
-
readonly initialU8aLength?: number;
|
|
8
|
-
constructor(registry: CodecRegistry, valType: CodecClass<V> | string, rawValue?: Uint8Array | string | string[] | Set<any>);
|
|
9
|
-
static with<V extends Codec>(valType: CodecClass<V> | string): CodecClass<BTreeSet<V>>;
|
|
10
|
-
/**
|
|
11
|
-
* @description The length of the value when encoded as a Uint8Array
|
|
12
|
-
*/
|
|
13
|
-
get encodedLength(): number;
|
|
14
|
-
/**
|
|
15
|
-
* @description Returns a hash of the value
|
|
16
|
-
*/
|
|
17
|
-
get hash(): IU8a;
|
|
18
|
-
/**
|
|
19
|
-
* @description Checks if the value is an empty value
|
|
20
|
-
*/
|
|
21
|
-
get isEmpty(): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* @description The actual set values as a string[]
|
|
24
|
-
*/
|
|
25
|
-
get strings(): string[];
|
|
26
|
-
/**
|
|
27
|
-
* @description Compares the value of the input to see if there is a match
|
|
28
|
-
*/
|
|
29
|
-
eq(other?: unknown): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
|
|
32
|
-
*/
|
|
33
|
-
toHex(): HexString;
|
|
34
|
-
/**
|
|
35
|
-
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
36
|
-
*/
|
|
37
|
-
toHuman(isExtended?: boolean): AnyJson;
|
|
38
|
-
/**
|
|
39
|
-
* @description Converts the Object to JSON, typically used for RPC transfers
|
|
40
|
-
*/
|
|
41
|
-
toJSON(): AnyJson;
|
|
42
|
-
/**
|
|
43
|
-
* @description Returns the base runtime type name for this instance
|
|
44
|
-
*/
|
|
45
|
-
toRawType(): string;
|
|
46
|
-
/**
|
|
47
|
-
* @description Returns the string representation of the value
|
|
48
|
-
*/
|
|
49
|
-
toString(): string;
|
|
50
|
-
/**
|
|
51
|
-
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
52
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
53
|
-
*/
|
|
54
|
-
toU8a(isBare?: boolean): Uint8Array;
|
|
55
|
-
}
|