@polkadot/types-codec 6.12.2-10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abstract/AbstractArray.cjs +208 -0
- package/abstract/AbstractArray.d.ts +84 -0
- package/abstract/AbstractArray.js +197 -0
- package/abstract/AbstractInt.cjs +254 -0
- package/abstract/AbstractInt.d.ts +75 -0
- package/abstract/AbstractInt.js +231 -0
- package/abstract/index.cjs +21 -0
- package/abstract/index.d.ts +2 -0
- package/abstract/index.js +4 -0
- package/base/Base.cjs +137 -0
- package/base/Base.d.ts +56 -0
- package/base/Base.js +125 -0
- package/base/Compact.cjs +201 -0
- package/base/Compact.d.ts +83 -0
- package/base/Compact.js +186 -0
- package/base/DoNotConstruct.cjs +101 -0
- package/base/DoNotConstruct.d.ts +33 -0
- package/base/DoNotConstruct.js +88 -0
- package/base/Enum.cjs +445 -0
- package/base/Enum.d.ts +105 -0
- package/base/Enum.js +421 -0
- package/base/Int.cjs +45 -0
- package/base/Int.d.ts +16 -0
- package/base/Int.js +33 -0
- package/base/Null.cjs +111 -0
- package/base/Null.d.ts +54 -0
- package/base/Null.js +101 -0
- package/base/Option.cjs +256 -0
- package/base/Option.d.ts +88 -0
- package/base/Option.js +240 -0
- package/base/Result.cjs +109 -0
- package/base/Result.d.ts +46 -0
- package/base/Result.js +98 -0
- package/base/Tuple.cjs +132 -0
- package/base/Tuple.d.ts +39 -0
- package/base/Tuple.js +116 -0
- package/base/UInt.cjs +39 -0
- package/base/UInt.d.ts +15 -0
- package/base/UInt.js +29 -0
- package/base/Vec.cjs +126 -0
- package/base/Vec.d.ts +28 -0
- package/base/Vec.js +104 -0
- package/base/VecAny.cjs +31 -0
- package/base/VecAny.d.ts +15 -0
- package/base/VecAny.js +21 -0
- package/base/VecFixed.cjs +111 -0
- package/base/VecFixed.d.ts +26 -0
- package/base/VecFixed.js +93 -0
- package/base/index.cjs +109 -0
- package/base/index.d.ts +13 -0
- package/base/index.js +15 -0
- package/bundle.cjs +100 -0
- package/bundle.d.ts +7 -0
- package/bundle.js +9 -0
- package/detectPackage.cjs +9 -0
- package/detectPackage.d.ts +1 -0
- package/detectPackage.js +5 -0
- package/extended/BTreeMap.cjs +24 -0
- package/extended/BTreeMap.d.ts +5 -0
- package/extended/BTreeMap.js +14 -0
- package/extended/BTreeSet.cjs +227 -0
- package/extended/BTreeSet.d.ts +55 -0
- package/extended/BTreeSet.js +212 -0
- package/extended/BitVec.cjs +97 -0
- package/extended/BitVec.d.ts +26 -0
- package/extended/BitVec.js +82 -0
- package/extended/Bytes.cjs +86 -0
- package/extended/Bytes.d.ts +25 -0
- package/extended/Bytes.js +75 -0
- package/extended/HashMap.cjs +24 -0
- package/extended/HashMap.d.ts +5 -0
- package/extended/HashMap.js +14 -0
- package/extended/Linkage.cjs +89 -0
- package/extended/Linkage.d.ts +31 -0
- package/extended/Linkage.js +71 -0
- package/extended/Map.cjs +244 -0
- package/extended/Map.d.ts +50 -0
- package/extended/Map.js +225 -0
- package/extended/Range.cjs +92 -0
- package/extended/Range.d.ts +30 -0
- package/extended/Range.js +75 -0
- package/extended/Type.cjs +39 -0
- package/extended/Type.d.ts +16 -0
- package/extended/Type.js +27 -0
- package/extended/U8aFixed.cjs +66 -0
- package/extended/U8aFixed.d.ts +16 -0
- package/extended/U8aFixed.js +53 -0
- package/extended/WrapperOpaque.cjs +60 -0
- package/extended/WrapperOpaque.d.ts +14 -0
- package/extended/WrapperOpaque.js +49 -0
- package/extended/index.cjs +105 -0
- package/extended/index.d.ts +11 -0
- package/extended/index.js +13 -0
- package/index.cjs +20 -0
- package/index.d.ts +2 -0
- package/index.js +4 -0
- package/native/Bool.cjs +141 -0
- package/native/Bool.d.ts +62 -0
- package/native/Bool.js +130 -0
- package/native/Date.cjs +170 -0
- package/native/Date.d.ts +76 -0
- package/native/Date.js +158 -0
- package/native/Json.cjs +137 -0
- package/native/Json.d.ts +56 -0
- package/native/Json.js +121 -0
- package/native/Raw.cjs +192 -0
- package/native/Raw.d.ts +90 -0
- package/native/Raw.js +182 -0
- package/native/Set.cjs +268 -0
- package/native/Set.d.ts +76 -0
- package/native/Set.js +251 -0
- package/native/Struct.cjs +302 -0
- package/native/Struct.d.ts +93 -0
- package/native/Struct.js +286 -0
- package/native/Text.cjs +193 -0
- package/native/Text.d.ts +71 -0
- package/native/Text.js +178 -0
- package/native/index.cjs +79 -0
- package/native/index.d.ts +7 -0
- package/native/index.js +9 -0
- package/package.json +387 -0
- package/packageInfo.cjs +14 -0
- package/packageInfo.d.ts +4 -0
- package/packageInfo.js +7 -0
- package/primitive/I128.cjs +26 -0
- package/primitive/I128.d.ts +11 -0
- package/primitive/I128.js +16 -0
- package/primitive/I16.cjs +26 -0
- package/primitive/I16.d.ts +11 -0
- package/primitive/I16.js +16 -0
- package/primitive/I256.cjs +26 -0
- package/primitive/I256.d.ts +11 -0
- package/primitive/I256.js +16 -0
- package/primitive/I32.cjs +26 -0
- package/primitive/I32.d.ts +11 -0
- package/primitive/I32.js +16 -0
- package/primitive/I64.cjs +26 -0
- package/primitive/I64.d.ts +11 -0
- package/primitive/I64.js +16 -0
- package/primitive/I8.cjs +26 -0
- package/primitive/I8.d.ts +11 -0
- package/primitive/I8.js +16 -0
- package/primitive/U128.cjs +26 -0
- package/primitive/U128.d.ts +11 -0
- package/primitive/U128.js +16 -0
- package/primitive/U16.cjs +26 -0
- package/primitive/U16.d.ts +11 -0
- package/primitive/U16.js +16 -0
- package/primitive/U256.cjs +26 -0
- package/primitive/U256.d.ts +11 -0
- package/primitive/U256.js +16 -0
- package/primitive/U32.cjs +26 -0
- package/primitive/U32.d.ts +11 -0
- package/primitive/U32.js +16 -0
- package/primitive/U64.cjs +26 -0
- package/primitive/U64.d.ts +11 -0
- package/primitive/U64.js +16 -0
- package/primitive/U8.cjs +26 -0
- package/primitive/U8.d.ts +11 -0
- package/primitive/U8.js +16 -0
- package/primitive/USize.cjs +28 -0
- package/primitive/USize.d.ts +12 -0
- package/primitive/USize.js +18 -0
- package/primitive/index.cjs +187 -0
- package/primitive/index.d.ts +13 -0
- package/primitive/index.js +15 -0
- package/types/codec.cjs +1 -0
- package/types/codec.d.ts +77 -0
- package/types/codec.js +1 -0
- package/types/helpers.cjs +1 -0
- package/types/helpers.d.ts +14 -0
- package/types/helpers.js +1 -0
- package/types/index.cjs +57 -0
- package/types/index.d.ts +4 -0
- package/types/index.js +6 -0
- package/types/interfaces.cjs +1 -0
- package/types/interfaces.d.ts +69 -0
- package/types/interfaces.js +1 -0
- package/types/registry.cjs +1 -0
- package/types/registry.d.ts +61 -0
- package/types/registry.js +1 -0
- package/utils/compareArray.cjs +22 -0
- package/utils/compareArray.d.ts +1 -0
- package/utils/compareArray.js +13 -0
- package/utils/compareMap.cjs +39 -0
- package/utils/compareMap.d.ts +1 -0
- package/utils/compareMap.js +31 -0
- package/utils/compareSet.cjs +29 -0
- package/utils/compareSet.d.ts +1 -0
- package/utils/compareSet.js +22 -0
- package/utils/decodeU8a.cjs +69 -0
- package/utils/decodeU8a.d.ts +13 -0
- package/utils/decodeU8a.js +60 -0
- package/utils/index.cjs +95 -0
- package/utils/index.d.ts +9 -0
- package/utils/index.js +11 -0
- package/utils/mapToTypeMap.cjs +25 -0
- package/utils/mapToTypeMap.d.ts +5 -0
- package/utils/mapToTypeMap.js +17 -0
- package/utils/sanitize.cjs +242 -0
- package/utils/sanitize.d.ts +16 -0
- package/utils/sanitize.js +215 -0
- package/utils/sortValues.cjs +89 -0
- package/utils/sortValues.d.ts +13 -0
- package/utils/sortValues.js +73 -0
- package/utils/typeToConstructor.cjs +14 -0
- package/utils/typeToConstructor.d.ts +2 -0
- package/utils/typeToConstructor.js +6 -0
- package/utils/typesToMap.cjs +20 -0
- package/utils/typesToMap.d.ts +2 -0
- package/utils/typesToMap.js +13 -0
- package/utils/util.cjs +15 -0
- package/utils/util.d.ts +3 -0
- package/utils/util.js +7 -0
package/base/Compact.js
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import _classPrivateFieldLooseBase from "@babel/runtime/helpers/esm/classPrivateFieldLooseBase";
|
|
2
|
+
import _classPrivateFieldLooseKey from "@babel/runtime/helpers/esm/classPrivateFieldLooseKey";
|
|
3
|
+
// Copyright 2017-2021 @polkadot/types-codec authors & contributors
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
import { compactFromU8a, compactToU8a, isBigInt, isBn, isNumber, isString } from '@polkadot/util';
|
|
6
|
+
import { typeToConstructor } from "../utils/index.js";
|
|
7
|
+
/**
|
|
8
|
+
* @name Compact
|
|
9
|
+
* @description
|
|
10
|
+
* A compact length-encoding codec wrapper. It performs the same function as Length, however
|
|
11
|
+
* differs in that it uses a variable number of bytes to do the actual encoding. This is mostly
|
|
12
|
+
* used by other types to add length-prefixed encoding, or in the case of wrapped types, taking
|
|
13
|
+
* a number and making the compact representation thereof
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var _Type = /*#__PURE__*/_classPrivateFieldLooseKey("Type");
|
|
17
|
+
|
|
18
|
+
var _raw = /*#__PURE__*/_classPrivateFieldLooseKey("raw");
|
|
19
|
+
|
|
20
|
+
export class Compact {
|
|
21
|
+
constructor(registry, Type, value = 0) {
|
|
22
|
+
this.registry = void 0;
|
|
23
|
+
this.createdAtHash = void 0;
|
|
24
|
+
this.initialU8aLength = void 0;
|
|
25
|
+
Object.defineProperty(this, _Type, {
|
|
26
|
+
writable: true,
|
|
27
|
+
value: void 0
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(this, _raw, {
|
|
30
|
+
writable: true,
|
|
31
|
+
value: void 0
|
|
32
|
+
});
|
|
33
|
+
this.registry = registry;
|
|
34
|
+
_classPrivateFieldLooseBase(this, _Type)[_Type] = typeToConstructor(registry, Type);
|
|
35
|
+
const [raw, decodedLength] = Compact.decodeCompact(registry, _classPrivateFieldLooseBase(this, _Type)[_Type], value);
|
|
36
|
+
this.initialU8aLength = decodedLength;
|
|
37
|
+
_classPrivateFieldLooseBase(this, _raw)[_raw] = raw;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static with(Type) {
|
|
41
|
+
return class extends Compact {
|
|
42
|
+
constructor(registry, value) {
|
|
43
|
+
super(registry, Type, value);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** @internal */
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
static decodeCompact(registry, Type, value) {
|
|
52
|
+
if (value instanceof Compact) {
|
|
53
|
+
return [new Type(registry, _classPrivateFieldLooseBase(value, _raw)[_raw]), 0];
|
|
54
|
+
} else if (value instanceof Type) {
|
|
55
|
+
return [value, 0];
|
|
56
|
+
} else if (isString(value) || isNumber(value) || isBn(value) || isBigInt(value)) {
|
|
57
|
+
return [new Type(registry, value), 0];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const [decodedLength, bn] = compactFromU8a(value);
|
|
61
|
+
return [new Type(registry, bn), decodedLength];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @description The length of the value when encoded as a Uint8Array
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
get encodedLength() {
|
|
69
|
+
return this.toU8a().length;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @description returns a hash of the contents
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
get hash() {
|
|
77
|
+
return this.registry.hash(this.toU8a());
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @description Checks if the value is an empty value
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
get isEmpty() {
|
|
85
|
+
return _classPrivateFieldLooseBase(this, _raw)[_raw].isEmpty;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @description Returns the number of bits in the value
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
bitLength() {
|
|
93
|
+
return _classPrivateFieldLooseBase(this, _raw)[_raw].bitLength();
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @description Compares the value of the input to see if there is a match
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
eq(other) {
|
|
101
|
+
return _classPrivateFieldLooseBase(this, _raw)[_raw].eq(other instanceof Compact ? _classPrivateFieldLooseBase(other, _raw)[_raw] : other);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* @description Returns a BigInt representation of the number
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
toBigInt() {
|
|
109
|
+
return _classPrivateFieldLooseBase(this, _raw)[_raw].toBigInt();
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @description Returns the BN representation of the number
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
toBn() {
|
|
117
|
+
return _classPrivateFieldLooseBase(this, _raw)[_raw].toBn();
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
toHex(isLe) {
|
|
125
|
+
return _classPrivateFieldLooseBase(this, _raw)[_raw].toHex(isLe);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
toHuman(isExtended) {
|
|
133
|
+
return _classPrivateFieldLooseBase(this, _raw)[_raw].toHuman(isExtended);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* @description Converts the Object to JSON, typically used for RPC transfers
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
toJSON() {
|
|
141
|
+
return _classPrivateFieldLooseBase(this, _raw)[_raw].toJSON();
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @description Returns the number representation for the value
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
toNumber() {
|
|
149
|
+
return _classPrivateFieldLooseBase(this, _raw)[_raw].toNumber();
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* @description Returns the base runtime type name for this instance
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
toRawType() {
|
|
157
|
+
return `Compact<${this.registry.getClassName(_classPrivateFieldLooseBase(this, _Type)[_Type]) || _classPrivateFieldLooseBase(this, _raw)[_raw].toRawType()}>`;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* @description Returns the string representation of the value
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
toString() {
|
|
165
|
+
return _classPrivateFieldLooseBase(this, _raw)[_raw].toString();
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
169
|
+
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
|
170
|
+
*/
|
|
171
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
toU8a(isBare) {
|
|
175
|
+
return compactToU8a(_classPrivateFieldLooseBase(this, _raw)[_raw].toBn());
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* @description Returns the embedded [[UInt]] or [[Moment]] value
|
|
179
|
+
*/
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
unwrap() {
|
|
183
|
+
return _classPrivateFieldLooseBase(this, _raw)[_raw];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.DoNotConstruct = void 0;
|
|
9
|
+
|
|
10
|
+
var _classPrivateFieldLooseBase2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldLooseBase"));
|
|
11
|
+
|
|
12
|
+
var _classPrivateFieldLooseKey2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldLooseKey"));
|
|
13
|
+
|
|
14
|
+
var _neverError = /*#__PURE__*/(0, _classPrivateFieldLooseKey2.default)("neverError");
|
|
15
|
+
|
|
16
|
+
// Copyright 2017-2021 @polkadot/types-codec authors & contributors
|
|
17
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @name DoNotConstruct
|
|
21
|
+
* @description
|
|
22
|
+
* An unknown type that fails on construction with the type info
|
|
23
|
+
*/
|
|
24
|
+
class DoNotConstruct {
|
|
25
|
+
constructor(registry) {
|
|
26
|
+
let typeName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'DoNotConstruct';
|
|
27
|
+
this.registry = void 0;
|
|
28
|
+
this.createdAtHash = void 0;
|
|
29
|
+
Object.defineProperty(this, _neverError, {
|
|
30
|
+
writable: true,
|
|
31
|
+
value: void 0
|
|
32
|
+
});
|
|
33
|
+
this.registry = registry;
|
|
34
|
+
(0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError] = new Error(`DoNotConstruct: Cannot construct unknown type ${typeName}`);
|
|
35
|
+
throw (0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static with(typeName) {
|
|
39
|
+
return class extends DoNotConstruct {
|
|
40
|
+
constructor(registry) {
|
|
41
|
+
super(registry, typeName);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @description The length of the value when encoded as a Uint8Array
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
get encodedLength() {
|
|
52
|
+
throw (0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @description returns a hash of the contents
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
get hash() {
|
|
60
|
+
throw (0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @description Checks if the value is an empty value (always true)
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
get isEmpty() {
|
|
68
|
+
throw (0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
eq() {
|
|
72
|
+
throw (0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
toHex() {
|
|
76
|
+
throw (0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
toHuman() {
|
|
80
|
+
throw (0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
toJSON() {
|
|
84
|
+
throw (0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
toRawType() {
|
|
88
|
+
throw (0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
toString() {
|
|
92
|
+
throw (0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
toU8a() {
|
|
96
|
+
throw (0, _classPrivateFieldLooseBase2.default)(this, _neverError)[_neverError];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
exports.DoNotConstruct = DoNotConstruct;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import _classPrivateFieldLooseBase from "@babel/runtime/helpers/esm/classPrivateFieldLooseBase";
|
|
2
|
+
import _classPrivateFieldLooseKey from "@babel/runtime/helpers/esm/classPrivateFieldLooseKey";
|
|
3
|
+
|
|
4
|
+
var _neverError = /*#__PURE__*/_classPrivateFieldLooseKey("neverError");
|
|
5
|
+
|
|
6
|
+
// Copyright 2017-2021 @polkadot/types-codec authors & contributors
|
|
7
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @name DoNotConstruct
|
|
11
|
+
* @description
|
|
12
|
+
* An unknown type that fails on construction with the type info
|
|
13
|
+
*/
|
|
14
|
+
export class DoNotConstruct {
|
|
15
|
+
constructor(registry, typeName = 'DoNotConstruct') {
|
|
16
|
+
this.registry = void 0;
|
|
17
|
+
this.createdAtHash = void 0;
|
|
18
|
+
Object.defineProperty(this, _neverError, {
|
|
19
|
+
writable: true,
|
|
20
|
+
value: void 0
|
|
21
|
+
});
|
|
22
|
+
this.registry = registry;
|
|
23
|
+
_classPrivateFieldLooseBase(this, _neverError)[_neverError] = new Error(`DoNotConstruct: Cannot construct unknown type ${typeName}`);
|
|
24
|
+
throw _classPrivateFieldLooseBase(this, _neverError)[_neverError];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static with(typeName) {
|
|
28
|
+
return class extends DoNotConstruct {
|
|
29
|
+
constructor(registry) {
|
|
30
|
+
super(registry, typeName);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @description The length of the value when encoded as a Uint8Array
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
get encodedLength() {
|
|
41
|
+
throw _classPrivateFieldLooseBase(this, _neverError)[_neverError];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @description returns a hash of the contents
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
get hash() {
|
|
49
|
+
throw _classPrivateFieldLooseBase(this, _neverError)[_neverError];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @description Checks if the value is an empty value (always true)
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
get isEmpty() {
|
|
57
|
+
throw _classPrivateFieldLooseBase(this, _neverError)[_neverError];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
eq() {
|
|
61
|
+
throw _classPrivateFieldLooseBase(this, _neverError)[_neverError];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
toHex() {
|
|
65
|
+
throw _classPrivateFieldLooseBase(this, _neverError)[_neverError];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
toHuman() {
|
|
69
|
+
throw _classPrivateFieldLooseBase(this, _neverError)[_neverError];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
toJSON() {
|
|
73
|
+
throw _classPrivateFieldLooseBase(this, _neverError)[_neverError];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
toRawType() {
|
|
77
|
+
throw _classPrivateFieldLooseBase(this, _neverError)[_neverError];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
toString() {
|
|
81
|
+
throw _classPrivateFieldLooseBase(this, _neverError)[_neverError];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
toU8a() {
|
|
85
|
+
throw _classPrivateFieldLooseBase(this, _neverError)[_neverError];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
}
|