@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.
Files changed (86) hide show
  1. package/base/Base.cjs +39 -11
  2. package/base/Base.js +36 -11
  3. package/base/Enum.cjs +8 -0
  4. package/base/Enum.js +8 -0
  5. package/extended/WrapperOpaque.cjs +1 -9
  6. package/extended/WrapperOpaque.js +1 -9
  7. package/native/Json.cjs +4 -0
  8. package/native/Json.js +4 -0
  9. package/native/Struct.cjs +15 -2
  10. package/native/Struct.data.cjs +10 -0
  11. package/native/Struct.data.js +3 -0
  12. package/native/Struct.js +15 -2
  13. package/package.json +11 -75
  14. package/packageInfo.cjs +1 -1
  15. package/packageInfo.js +1 -1
  16. package/abstract/AbstractArray.d.ts +0 -84
  17. package/abstract/AbstractInt.d.ts +0 -75
  18. package/abstract/index.d.ts +0 -2
  19. package/base/Base.d.ts +0 -54
  20. package/base/Compact.d.ts +0 -83
  21. package/base/DoNotConstruct.d.ts +0 -33
  22. package/base/Enum.d.ts +0 -101
  23. package/base/Int.d.ts +0 -16
  24. package/base/Null.d.ts +0 -54
  25. package/base/Option.d.ts +0 -88
  26. package/base/Result.d.ts +0 -46
  27. package/base/Tuple.d.ts +0 -39
  28. package/base/UInt.d.ts +0 -15
  29. package/base/Vec.d.ts +0 -28
  30. package/base/VecAny.d.ts +0 -15
  31. package/base/VecFixed.d.ts +0 -26
  32. package/base/index.d.ts +0 -13
  33. package/bundle.d.ts +0 -7
  34. package/detectPackage.d.ts +0 -1
  35. package/extended/BTreeMap.d.ts +0 -5
  36. package/extended/BTreeSet.d.ts +0 -55
  37. package/extended/BitVec.d.ts +0 -26
  38. package/extended/Bytes.d.ts +0 -25
  39. package/extended/HashMap.d.ts +0 -5
  40. package/extended/Linkage.d.ts +0 -31
  41. package/extended/Map.d.ts +0 -50
  42. package/extended/Range.d.ts +0 -30
  43. package/extended/Type.d.ts +0 -16
  44. package/extended/U8aFixed.d.ts +0 -16
  45. package/extended/WrapperOpaque.d.ts +0 -18
  46. package/extended/index.d.ts +0 -11
  47. package/index.d.ts +0 -2
  48. package/native/Bool.d.ts +0 -62
  49. package/native/Date.d.ts +0 -76
  50. package/native/Json.d.ts +0 -55
  51. package/native/Raw.d.ts +0 -90
  52. package/native/Set.d.ts +0 -76
  53. package/native/Struct.d.ts +0 -92
  54. package/native/Text.d.ts +0 -71
  55. package/native/index.d.ts +0 -7
  56. package/packageInfo.d.ts +0 -4
  57. package/primitive/I128.d.ts +0 -11
  58. package/primitive/I16.d.ts +0 -11
  59. package/primitive/I256.d.ts +0 -11
  60. package/primitive/I32.d.ts +0 -11
  61. package/primitive/I64.d.ts +0 -11
  62. package/primitive/I8.d.ts +0 -11
  63. package/primitive/U128.d.ts +0 -11
  64. package/primitive/U16.d.ts +0 -11
  65. package/primitive/U256.d.ts +0 -11
  66. package/primitive/U32.d.ts +0 -11
  67. package/primitive/U64.d.ts +0 -11
  68. package/primitive/U8.d.ts +0 -11
  69. package/primitive/USize.d.ts +0 -12
  70. package/primitive/index.d.ts +0 -13
  71. package/types/codec.d.ts +0 -77
  72. package/types/helpers.d.ts +0 -14
  73. package/types/index.d.ts +0 -4
  74. package/types/interfaces.d.ts +0 -68
  75. package/types/registry.d.ts +0 -44
  76. package/utils/compareArray.d.ts +0 -1
  77. package/utils/compareMap.d.ts +0 -1
  78. package/utils/compareSet.d.ts +0 -1
  79. package/utils/decodeU8a.d.ts +0 -13
  80. package/utils/index.d.ts +0 -9
  81. package/utils/mapToTypeMap.d.ts +0 -5
  82. package/utils/sanitize.d.ts +0 -16
  83. package/utils/sortValues.d.ts +0 -13
  84. package/utils/typeToConstructor.d.ts +0 -2
  85. package/utils/typesToMap.d.ts +0 -2
  86. package/utils/util.d.ts +0 -3
@@ -1,25 +0,0 @@
1
- import type { AnyU8a, CodecRegistry } from '../types';
2
- import { Raw } from '../native/Raw';
3
- /**
4
- * @name Bytes
5
- * @description
6
- * A Bytes wrapper for Vec<u8>. The significant difference between this and a normal Uint8Array
7
- * is that this version allows for length-encoding. (i.e. it is a variable-item codec, the same
8
- * as what is found in [[Text]] and [[Vec]])
9
- */
10
- export declare class Bytes extends Raw {
11
- constructor(registry: CodecRegistry, value?: AnyU8a);
12
- /**
13
- * @description The length of the value when encoded as a Uint8Array
14
- */
15
- get encodedLength(): number;
16
- /**
17
- * @description Returns the base runtime type name for this instance
18
- */
19
- toRawType(): string;
20
- /**
21
- * @description Encodes the value as a Uint8Array as per the SCALE specifications
22
- * @param isBare true when the value has none of the type-specific prefixes (internal)
23
- */
24
- toU8a(isBare?: boolean): Uint8Array;
25
- }
@@ -1,5 +0,0 @@
1
- import type { Codec, CodecClass } from '../types';
2
- import { CodecMap } from './Map';
3
- export declare class HashMap<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
- }
@@ -1,31 +0,0 @@
1
- import type { Codec, CodecClass, CodecRegistry } from '../types';
2
- import { Option } from '../base/Option';
3
- import { Tuple } from '../base/Tuple';
4
- import { Struct } from '../native/Struct';
5
- declare type TypeWithValues = [CodecClass, any[]];
6
- /**
7
- * @name Linkage
8
- * @description The wrapper for the result from a LinkedMap
9
- */
10
- export declare class Linkage<T extends Codec> extends Struct {
11
- constructor(registry: CodecRegistry, Type: CodecClass | string, value?: unknown);
12
- static withKey<O extends Codec>(Type: CodecClass | string): CodecClass<Linkage<O>>;
13
- get previous(): Option<T>;
14
- get next(): Option<T>;
15
- /**
16
- * @description Returns the base runtime type name for this instance
17
- */
18
- toRawType(): string;
19
- /**
20
- * @description Custom toU8a which with bare mode does not return the linkage if empty
21
- */
22
- toU8a(): Uint8Array;
23
- }
24
- /**
25
- * @name LinkageResult
26
- * @description A Linkage keys/Values tuple
27
- */
28
- export declare class LinkageResult extends Tuple {
29
- constructor(registry: CodecRegistry, [TypeKey, keys]: TypeWithValues, [TypeValue, values]: TypeWithValues);
30
- }
31
- export {};
package/extended/Map.d.ts DELETED
@@ -1,50 +0,0 @@
1
- import type { HexString } from '@polkadot/util/types';
2
- import type { AnyJson, Codec, CodecClass, CodecRegistry, IMap, IU8a } from '../types';
3
- export declare class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends Map<K, V> implements IMap<K, V> {
4
- #private;
5
- readonly registry: CodecRegistry;
6
- createdAtHash?: IU8a;
7
- readonly initialU8aLength?: number;
8
- constructor(registry: CodecRegistry, keyType: CodecClass<K> | string, valType: CodecClass<V> | string, rawValue: Uint8Array | string | Map<any, any> | undefined, type?: 'BTreeMap' | 'HashMap');
9
- /**
10
- * @description The length of the value when encoded as a Uint8Array
11
- */
12
- get encodedLength(): number;
13
- /**
14
- * @description Returns a hash of the value
15
- */
16
- get hash(): IU8a;
17
- /**
18
- * @description Checks if the value is an empty value
19
- */
20
- get isEmpty(): boolean;
21
- /**
22
- * @description Compares the value of the input to see if there is a match
23
- */
24
- eq(other?: unknown): boolean;
25
- /**
26
- * @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
27
- */
28
- toHex(): HexString;
29
- /**
30
- * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
31
- */
32
- toHuman(isExtended?: boolean): Record<string, AnyJson>;
33
- /**
34
- * @description Converts the Object to JSON, typically used for RPC transfers
35
- */
36
- toJSON(): Record<string, AnyJson>;
37
- /**
38
- * @description Returns the base runtime type name for this instance
39
- */
40
- toRawType(): string;
41
- /**
42
- * @description Returns the string representation of the value
43
- */
44
- toString(): string;
45
- /**
46
- * @description Encodes the value as a Uint8Array as per the SCALE specifications
47
- * @param isBare true when the value has none of the type-specific prefixes (internal)
48
- */
49
- toU8a(isBare?: boolean): Uint8Array;
50
- }
@@ -1,30 +0,0 @@
1
- import type { AnyTuple, CodecClass, CodecRegistry, INumber } from '../types';
2
- import { Tuple } from '../base/Tuple';
3
- declare type RangeType = 'Range' | 'RangeInclusive';
4
- /**
5
- * @name Range
6
- * @description
7
- * Rust `Range<T>` representation
8
- */
9
- export declare class Range<T extends INumber> extends Tuple {
10
- #private;
11
- constructor(registry: CodecRegistry, Type: CodecClass<T> | string, value?: AnyTuple, rangeName?: RangeType);
12
- static with<T extends INumber>(Types: CodecClass<T> | string): CodecClass<Range<T>>;
13
- /**
14
- * @description Returns the starting range value
15
- */
16
- get start(): T;
17
- /**
18
- * @description Returns the ending range value
19
- */
20
- get end(): T;
21
- /**
22
- * @description Returns the base runtime type name for this instance
23
- */
24
- toRawType(): string;
25
- }
26
- export declare class RangeInclusive<T extends INumber = INumber> extends Range<T> {
27
- constructor(registry: CodecRegistry, type: CodecClass<T> | string, value?: AnyTuple);
28
- static with<T extends INumber>(Types: CodecClass<T> | string): CodecClass<RangeInclusive<T>>;
29
- }
30
- export {};
@@ -1,16 +0,0 @@
1
- import type { CodecRegistry } from '../types';
2
- import { Text } from '../native/Text';
3
- /**
4
- * @name Type
5
- * @description
6
- * This is a extended version of Text, specifically to handle types. Here we rely fully
7
- * on what Text provides us, however we also adjust the types received from the runtime,
8
- * i.e. we remove the `T::` prefixes found in some types for consistency across implementation.
9
- */
10
- export declare class Type extends Text {
11
- constructor(registry: CodecRegistry, value?: Text | Uint8Array | string);
12
- /**
13
- * @description Returns the base runtime type name for this instance
14
- */
15
- toRawType(): string;
16
- }
@@ -1,16 +0,0 @@
1
- import type { AnyU8a, CodecClass, CodecRegistry, U8aBitLength } from '../types';
2
- import { Raw } from '../native/Raw';
3
- /**
4
- * @name U8aFixed
5
- * @description
6
- * A U8a that manages a a sequence of bytes up to the specified bitLength. Not meant
7
- * to be used directly, rather is should be subclassed with the specific lengths.
8
- */
9
- export declare class U8aFixed extends Raw {
10
- constructor(registry: CodecRegistry, value?: AnyU8a, bitLength?: U8aBitLength);
11
- static with(bitLength: U8aBitLength, typeName?: string): CodecClass<U8aFixed>;
12
- /**
13
- * @description Returns the base runtime type name for this instance
14
- */
15
- toRawType(): string;
16
- }
@@ -1,18 +0,0 @@
1
- import type { Codec, CodecClass, CodecRegistry } from '../types';
2
- import { Base } from '../base/Base';
3
- export declare class WrapperOpaque<T extends Codec> extends Base<T> {
4
- constructor(registry: CodecRegistry, Type: CodecClass<T> | string, value?: unknown);
5
- static with<T extends Codec>(Type: CodecClass<T> | string): CodecClass<WrapperOpaque<T>>;
6
- /**
7
- * @description Returns the base runtime type name for this instance
8
- */
9
- toRawType(): string;
10
- /**
11
- * @description The length of the value when encoded as a Uint8Array
12
- */
13
- toU8a(isBare?: boolean): Uint8Array;
14
- /**
15
- * @description Return the inner value for the wrapped type
16
- */
17
- unwrap(): T;
18
- }
@@ -1,11 +0,0 @@
1
- export { BitVec } from './BitVec';
2
- export { BTreeMap } from './BTreeMap';
3
- export { BTreeSet } from './BTreeSet';
4
- export { Bytes } from './Bytes';
5
- export { HashMap } from './HashMap';
6
- export { Linkage } from './Linkage';
7
- export { CodecMap, CodecMap as Map } from './Map';
8
- export { Range, RangeInclusive } from './Range';
9
- export { Type } from './Type';
10
- export { U8aFixed } from './U8aFixed';
11
- export { WrapperOpaque } from './WrapperOpaque';
package/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import './detectPackage';
2
- export * from './bundle';
package/native/Bool.d.ts DELETED
@@ -1,62 +0,0 @@
1
- import type { HexString } from '@polkadot/util/types';
2
- import type { Codec, CodecRegistry, IU8a } from '../types';
3
- /**
4
- * @name bool
5
- * @description
6
- * Representation for a boolean value in the system. It extends the base JS `Boolean` class
7
- * @noInheritDoc
8
- */
9
- export declare class bool extends Boolean implements Codec {
10
- readonly registry: CodecRegistry;
11
- createdAtHash?: IU8a;
12
- constructor(registry: CodecRegistry, value?: bool | Boolean | Uint8Array | boolean | number);
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 (true when it wraps false/default)
23
- */
24
- get isEmpty(): boolean;
25
- /**
26
- * @description Checks if the value is an empty value (always false)
27
- */
28
- get isFalse(): boolean;
29
- /**
30
- * @description Checks if the value is an empty value (always false)
31
- */
32
- get isTrue(): boolean;
33
- /**
34
- * @description Compares the value of the input to see if there is a match
35
- */
36
- eq(other?: unknown): boolean;
37
- /**
38
- * @description Returns a hex string representation of the value
39
- */
40
- toHex(): HexString;
41
- /**
42
- * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
43
- */
44
- toHuman(): boolean;
45
- /**
46
- * @description Converts the Object to JSON, typically used for RPC transfers
47
- */
48
- toJSON(): boolean;
49
- /**
50
- * @description Returns the base runtime type name for this instance
51
- */
52
- toRawType(): string;
53
- /**
54
- * @description Returns the string representation of the value
55
- */
56
- toString(): string;
57
- /**
58
- * @description Encodes the value as a Uint8Array as per the SCALE specifications
59
- * @param isBare true when the value has none of the type-specific prefixes (internal)
60
- */
61
- toU8a(isBare?: boolean): Uint8Array;
62
- }
package/native/Date.d.ts DELETED
@@ -1,76 +0,0 @@
1
- /// <reference types="bn.js" />
2
- import type { HexString } from '@polkadot/util/types';
3
- import type { AnyNumber, CodecRegistry, INumber, IU8a, UIntBitLength } from '../types';
4
- import { BN } from '@polkadot/util';
5
- /**
6
- * @name Date
7
- * @description
8
- * A wrapper around seconds/timestamps. Internally the representation only has
9
- * second precicion (aligning with Rust), so any numbers passed an/out are always
10
- * per-second. For any encoding/decoding the 1000 multiplier would be applied to
11
- * get it in line with JavaScript formats. It extends the base JS `Date` object
12
- * and has all the methods available that are applicable to any `Date`
13
- * @noInheritDoc
14
- */
15
- export declare class CodecDate extends Date implements INumber {
16
- readonly registry: CodecRegistry;
17
- createdAtHash?: IU8a;
18
- constructor(registry: CodecRegistry, value?: CodecDate | Date | AnyNumber);
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 Checks if the value is an empty value
29
- */
30
- get isEmpty(): boolean;
31
- /**
32
- * @description Compares the value of the input to see if there is a match
33
- */
34
- eq(other?: unknown): boolean;
35
- /**
36
- * @description Returns the number of bits in the value
37
- */
38
- bitLength(): UIntBitLength;
39
- /**
40
- * @description Returns a BigInt representation of the number
41
- */
42
- toBigInt(): bigint;
43
- /**
44
- * @description Returns the BN representation of the timestamp
45
- */
46
- toBn(): BN;
47
- /**
48
- * @description Returns a hex string representation of the value
49
- */
50
- toHex(isLe?: boolean): HexString;
51
- /**
52
- * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
53
- */
54
- toHuman(): string;
55
- /**
56
- * @description Converts the Object to JSON, typically used for RPC transfers
57
- */
58
- toJSON(): any;
59
- /**
60
- * @description Returns the number representation for the timestamp
61
- */
62
- toNumber(): number;
63
- /**
64
- * @description Returns the base runtime type name for this instance
65
- */
66
- toRawType(): string;
67
- /**
68
- * @description Returns the string representation of the value
69
- */
70
- toString(): string;
71
- /**
72
- * @description Encodes the value as a Uint8Array as per the SCALE specifications
73
- * @param isBare true when the value has none of the type-specific prefixes (internal)
74
- */
75
- toU8a(isBare?: boolean): Uint8Array;
76
- }
package/native/Json.d.ts DELETED
@@ -1,55 +0,0 @@
1
- import type { HexString } from '@polkadot/util/types';
2
- import type { AnyJson, Codec, CodecRegistry, IU8a } from '../types';
3
- /**
4
- * @name Json
5
- * @description
6
- * Wraps the a JSON structure retrieve via RPC. It extends the standard JS Map with. While it
7
- * implements a Codec, it is limited in that it can only be used with input objects via RPC,
8
- * i.e. no hex decoding. Unlike a struct, this waps a JSON object with unknown keys
9
- * @noInheritDoc
10
- */
11
- export declare class Json extends Map<string, any> implements Codec {
12
- readonly registry: CodecRegistry;
13
- createdAtHash?: IU8a;
14
- constructor(registry: CodecRegistry, value?: Record<string, unknown> | null);
15
- /**
16
- * @description Always 0, never encodes as a Uint8Array
17
- */
18
- get encodedLength(): number;
19
- /**
20
- * @description returns a hash of the contents
21
- */
22
- get hash(): IU8a;
23
- /**
24
- * @description Checks if the value is an empty value
25
- */
26
- get isEmpty(): boolean;
27
- /**
28
- * @description Compares the value of the input to see if there is a match
29
- */
30
- eq(other?: unknown): boolean;
31
- /**
32
- * @description Unimplemented, will throw
33
- */
34
- toHex(): HexString;
35
- /**
36
- * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
37
- */
38
- toHuman(): Record<string, AnyJson>;
39
- /**
40
- * @description Converts the Object to JSON, typically used for RPC transfers
41
- */
42
- toJSON(): Record<string, AnyJson>;
43
- /**
44
- * @description Returns the base runtime type name for this instance
45
- */
46
- toRawType(): string;
47
- /**
48
- * @description Returns the string representation of the value
49
- */
50
- toString(): string;
51
- /**
52
- * @description Unimplemented, will throw
53
- */
54
- toU8a(isBare?: boolean): Uint8Array;
55
- }
package/native/Raw.d.ts DELETED
@@ -1,90 +0,0 @@
1
- import type { HexString } from '@polkadot/util/types';
2
- import type { AnyJson, AnyU8a, CodecRegistry, IU8a } from '../types';
3
- /**
4
- * @name Raw
5
- * @description
6
- * A basic wrapper around Uint8Array, with no frills and no fuss. It does differ
7
- * from other implementations where it will consume the full Uint8Array as passed to it.
8
- * As such it is meant to be subclassed where the wrapper takes care of the
9
- * actual lengths instead of used directly.
10
- * @noInheritDoc
11
- */
12
- export declare class Raw extends Uint8Array implements IU8a {
13
- readonly registry: CodecRegistry;
14
- createdAtHash?: IU8a;
15
- readonly initialU8aLength?: number;
16
- constructor(registry: CodecRegistry, value?: AnyU8a, initialU8aLength?: number);
17
- /**
18
- * @description The length of the value when encoded as a Uint8Array
19
- */
20
- get encodedLength(): number;
21
- /**
22
- * @description returns a hash of the contents
23
- */
24
- get hash(): IU8a;
25
- /**
26
- * @description Returns true if the wrapped value contains only ASCII printable characters
27
- */
28
- get isAscii(): boolean;
29
- /**
30
- * @description Returns true if the type wraps an empty/default all-0 value
31
- */
32
- get isEmpty(): boolean;
33
- /**
34
- * @description Returns true if the wrapped value contains only utf8 characters
35
- */
36
- get isUtf8(): boolean;
37
- /**
38
- * @description The length of the value
39
- */
40
- get length(): number;
41
- /**
42
- * @description Returns the number of bits in the value
43
- */
44
- bitLength(): number;
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 Create a new slice from the actual buffer. (compat)
51
- * @param start The position to start at
52
- * @param end The position to end at
53
- */
54
- slice(start?: number, end?: number): Uint8Array;
55
- /**
56
- * @description Create a new subarray from the actual buffer. (compat)
57
- * @param begin The position to start at
58
- * @param end The position to end at
59
- */
60
- subarray(begin?: number, end?: number): Uint8Array;
61
- /**
62
- * @description Returns a hex string representation of the value
63
- */
64
- toHex(): HexString;
65
- /**
66
- * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
67
- */
68
- toHuman(): AnyJson;
69
- /**
70
- * @description Converts the Object to JSON, typically used for RPC transfers
71
- */
72
- toJSON(): string;
73
- /**
74
- * @description Returns the base runtime type name for this instance
75
- */
76
- toRawType(): string;
77
- /**
78
- * @description Returns the string representation of the value
79
- */
80
- toString(): string;
81
- /**
82
- * @description Encodes the value as a Uint8Array as per the SCALE specifications
83
- * @param isBare true when the value has none of the type-specific prefixes (internal)
84
- */
85
- toU8a(isBare?: boolean): Uint8Array;
86
- /**
87
- * @description Returns the wrapped data as a UTF-8 string
88
- */
89
- toUtf8(): string;
90
- }
package/native/Set.d.ts DELETED
@@ -1,76 +0,0 @@
1
- /// <reference types="bn.js" />
2
- import type { HexString } from '@polkadot/util/types';
3
- import type { CodecClass, CodecRegistry, ISet, IU8a } from '../types';
4
- import { BN } from '@polkadot/util';
5
- declare type SetValues = Record<string, number | BN>;
6
- /**
7
- * @name Set
8
- * @description
9
- * An Set is an array of string values, represented an an encoded type by
10
- * a bitwise representation of the values.
11
- */
12
- export declare class CodecSet extends Set<string> implements ISet<string> {
13
- #private;
14
- readonly registry: CodecRegistry;
15
- createdAtHash?: IU8a;
16
- constructor(registry: CodecRegistry, setValues: SetValues, value?: string[] | Set<string> | Uint8Array | BN | number | string, bitLength?: number);
17
- static with(values: SetValues, bitLength?: number): CodecClass<CodecSet>;
18
- /**
19
- * @description The length of the value when encoded as a Uint8Array
20
- */
21
- get encodedLength(): number;
22
- /**
23
- * @description returns a hash of the contents
24
- */
25
- get hash(): IU8a;
26
- /**
27
- * @description true is the Set contains no values
28
- */
29
- get isEmpty(): boolean;
30
- /**
31
- * @description The actual set values as a string[]
32
- */
33
- get strings(): string[];
34
- /**
35
- * @description The encoded value for the set members
36
- */
37
- get valueEncoded(): BN;
38
- /**
39
- * @description adds a value to the Set (extended to allow for validity checking)
40
- */
41
- add: (key: string) => this;
42
- /**
43
- * @description Compares the value of the input to see if there is a match
44
- */
45
- eq(other?: unknown): boolean;
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 The encoded value for the set members
60
- */
61
- toNumber(): number;
62
- /**
63
- * @description Returns the base runtime type name for this instance
64
- */
65
- toRawType(): string;
66
- /**
67
- * @description Returns the string representation of the value
68
- */
69
- toString(): string;
70
- /**
71
- * @description Encodes the value as a Uint8Array as per the SCALE specifications
72
- * @param isBare true when the value has none of the type-specific prefixes (internal)
73
- */
74
- toU8a(isBare?: boolean): Uint8Array;
75
- }
76
- export {};
@@ -1,92 +0,0 @@
1
- import type { HexString } from '@polkadot/util/types';
2
- import type { AnyJson, BareOpts, Codec, CodecClass, CodecRegistry, IStruct, IU8a } from '../types';
3
- declare type TypesDef<T = Codec> = Record<string, string | CodecClass<T>>;
4
- /**
5
- * @name Struct
6
- * @description
7
- * A Struct defines an Object with key-value pairs - where the values are Codec values. It removes
8
- * a lot of repetition from the actual coding, define a structure type, pass it the key/Codec
9
- * values in the constructor and it manages the decoding. It is important that the constructor
10
- * values matches 100% to the order in th Rust code, i.e. don't go crazy and make it alphabetical,
11
- * it needs to decoded in the specific defined order.
12
- * @noInheritDoc
13
- */
14
- export declare class Struct<S extends TypesDef = TypesDef, V extends {
15
- [K in keyof S]: any;
16
- } = {
17
- [K in keyof S]: any;
18
- }, E extends {
19
- [K in keyof S]: string;
20
- } = {
21
- [K in keyof S]: string;
22
- }> extends Map<keyof S, Codec> implements IStruct<keyof S> {
23
- #private;
24
- readonly registry: CodecRegistry;
25
- createdAtHash?: IU8a;
26
- readonly initialU8aLength?: number;
27
- constructor(registry: CodecRegistry, Types: S, value?: V | Map<unknown, unknown> | unknown[] | HexString | null, jsonMap?: Map<string, string>);
28
- static with<S extends TypesDef>(Types: S, jsonMap?: Map<string, string>): CodecClass<Struct<S>>;
29
- /**
30
- * @description The available keys for this struct
31
- */
32
- get defKeys(): string[];
33
- /**
34
- * @description Checks if the value is an empty value
35
- */
36
- get isEmpty(): boolean;
37
- /**
38
- * @description Returns the Type description of the structure
39
- */
40
- get Type(): E;
41
- /**
42
- * @description The length of the value when encoded as a Uint8Array
43
- */
44
- get encodedLength(): number;
45
- /**
46
- * @description returns a hash of the contents
47
- */
48
- get hash(): IU8a;
49
- /**
50
- * @description Compares the value of the input to see if there is a match
51
- */
52
- eq(other?: unknown): boolean;
53
- /**
54
- * @description Returns a specific names entry in the structure
55
- * @param name The name of the entry to retrieve
56
- */
57
- get(name: keyof S): Codec | undefined;
58
- /**
59
- * @description Returns the values of a member at a specific index (Rather use get(name) for performance)
60
- */
61
- getAtIndex(index: number): Codec;
62
- /**
63
- * @description Converts the Object to an standard JavaScript Array
64
- */
65
- toArray(): Codec[];
66
- /**
67
- * @description Returns a hex string representation of the value
68
- */
69
- toHex(): HexString;
70
- /**
71
- * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
72
- */
73
- toHuman(isExtended?: boolean): Record<string, AnyJson>;
74
- /**
75
- * @description Converts the Object to JSON, typically used for RPC transfers
76
- */
77
- toJSON(): Record<string, AnyJson>;
78
- /**
79
- * @description Returns the base runtime type name for this instance
80
- */
81
- toRawType(): string;
82
- /**
83
- * @description Returns the string representation of the value
84
- */
85
- toString(): string;
86
- /**
87
- * @description Encodes the value as a Uint8Array as per the SCALE specifications
88
- * @param isBare true when the value has none of the type-specific prefixes (internal)
89
- */
90
- toU8a(isBare?: BareOpts): Uint8Array;
91
- }
92
- export {};