@pezkuwi/types-codec 16.5.5 → 16.5.6
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/LICENSE +201 -0
- package/abstract/Array.js +166 -0
- package/abstract/Base.js +101 -0
- package/abstract/Int.js +226 -0
- package/abstract/Object.js +40 -0
- package/{src/abstract/index.ts → abstract/index.js} +0 -3
- package/base/Compact.js +159 -0
- package/base/DoNotConstruct.js +95 -0
- package/base/Enum.js +369 -0
- package/{build/base → base}/Int.d.ts +1 -1
- package/base/Int.js +26 -0
- package/base/Null.js +77 -0
- package/base/Option.js +232 -0
- package/base/Result.js +63 -0
- package/base/Tuple.js +110 -0
- package/{build/base → base}/UInt.d.ts +1 -1
- package/base/UInt.js +23 -0
- package/base/Vec.js +102 -0
- package/base/VecAny.js +17 -0
- package/base/VecFixed.js +67 -0
- package/{src/base/index.ts → base/index.js} +0 -3
- package/{src/bundle.ts → bundle.js} +0 -6
- package/cjs/abstract/Array.d.ts +89 -0
- package/cjs/abstract/Array.js +170 -0
- package/cjs/abstract/Base.d.ts +75 -0
- package/cjs/abstract/Base.js +105 -0
- package/cjs/abstract/Int.d.ts +80 -0
- package/cjs/abstract/Int.js +230 -0
- package/cjs/abstract/Object.d.ts +67 -0
- package/cjs/abstract/Object.js +44 -0
- package/cjs/abstract/index.d.ts +3 -0
- package/cjs/abstract/index.js +9 -0
- package/cjs/base/Compact.d.ts +88 -0
- package/cjs/base/Compact.js +163 -0
- package/cjs/base/DoNotConstruct.d.ts +63 -0
- package/cjs/base/DoNotConstruct.js +99 -0
- package/cjs/base/Enum.d.ts +118 -0
- package/cjs/base/Enum.js +373 -0
- package/cjs/base/Int.d.ts +16 -0
- package/cjs/base/Int.js +30 -0
- package/cjs/base/Null.d.ts +56 -0
- package/cjs/base/Null.js +81 -0
- package/cjs/base/Option.d.ts +94 -0
- package/cjs/base/Option.js +236 -0
- package/cjs/base/Result.d.ts +38 -0
- package/cjs/base/Result.js +67 -0
- package/cjs/base/Tuple.d.ts +42 -0
- package/cjs/base/Tuple.js +114 -0
- package/cjs/base/UInt.d.ts +15 -0
- package/cjs/base/UInt.js +27 -0
- package/cjs/base/Vec.d.ts +28 -0
- package/cjs/base/Vec.js +107 -0
- package/cjs/base/VecAny.d.ts +15 -0
- package/cjs/base/VecAny.js +21 -0
- package/cjs/base/VecFixed.d.ts +30 -0
- package/cjs/base/VecFixed.js +71 -0
- package/cjs/base/index.d.ts +12 -0
- package/cjs/base/index.js +27 -0
- package/cjs/bundle.d.ts +7 -0
- package/cjs/bundle.js +12 -0
- package/cjs/extended/BTreeMap.js +14 -0
- package/cjs/extended/BTreeSet.js +189 -0
- package/cjs/extended/BitVec.js +112 -0
- package/cjs/extended/Bytes.js +74 -0
- package/cjs/extended/HashMap.js +14 -0
- package/cjs/extended/Linkage.js +70 -0
- package/cjs/extended/Map.js +204 -0
- package/cjs/extended/OptionBool.js +76 -0
- package/cjs/extended/Range.js +42 -0
- package/cjs/extended/RangeInclusive.js +17 -0
- package/cjs/extended/Type.js +25 -0
- package/cjs/extended/U8aFixed.js +46 -0
- package/cjs/extended/WrapperKeepOpaque.js +103 -0
- package/cjs/extended/WrapperOpaque.js +23 -0
- package/cjs/extended/index.js +32 -0
- package/cjs/index.js +5 -0
- package/cjs/native/Bool.js +113 -0
- package/cjs/native/Date.js +144 -0
- package/cjs/native/Float.js +111 -0
- package/cjs/native/Json.js +121 -0
- package/cjs/native/Raw.js +144 -0
- package/cjs/native/Set.js +219 -0
- package/cjs/native/Struct.data.js +4 -0
- package/cjs/native/Struct.js +264 -0
- package/cjs/native/Text.js +154 -0
- package/cjs/native/index.js +22 -0
- package/cjs/package.json +3 -0
- package/cjs/packageDetect.js +5 -0
- package/cjs/packageInfo.js +4 -0
- package/cjs/primitive/F32.js +14 -0
- package/cjs/primitive/F64.js +14 -0
- package/cjs/primitive/I128.js +14 -0
- package/cjs/primitive/I16.js +14 -0
- package/cjs/primitive/I256.js +14 -0
- package/cjs/primitive/I32.js +14 -0
- package/cjs/primitive/I64.js +14 -0
- package/cjs/primitive/I8.js +14 -0
- package/cjs/primitive/ISize.js +18 -0
- package/cjs/primitive/U128.js +14 -0
- package/cjs/primitive/U16.js +14 -0
- package/cjs/primitive/U256.js +14 -0
- package/cjs/primitive/U32.js +14 -0
- package/cjs/primitive/U64.js +14 -0
- package/cjs/primitive/U8.js +14 -0
- package/cjs/primitive/USize.js +18 -0
- package/cjs/primitive/index.js +51 -0
- package/{build → cjs}/types/codec.d.ts +1 -1
- package/cjs/types/codec.js +2 -0
- package/cjs/types/helpers.js +2 -0
- package/cjs/types/index.js +7 -0
- package/cjs/types/interfaces.js +2 -0
- package/cjs/types/registry.js +2 -0
- package/cjs/utils/compareArray.js +13 -0
- package/cjs/utils/compareMap.js +30 -0
- package/cjs/utils/compareSet.js +20 -0
- package/cjs/utils/decodeU8a.js +105 -0
- package/cjs/utils/index.js +25 -0
- package/cjs/utils/sanitize.js +233 -0
- package/cjs/utils/sortValues.js +84 -0
- package/cjs/utils/toConstructors.js +40 -0
- package/cjs/utils/typesToMap.js +10 -0
- package/cjs/utils/util.js +7 -0
- package/extended/BTreeMap.d.ts +5 -0
- package/extended/BTreeMap.js +10 -0
- package/extended/BTreeSet.d.ts +64 -0
- package/extended/BTreeSet.js +185 -0
- package/extended/BitVec.d.ts +37 -0
- package/extended/BitVec.js +108 -0
- package/extended/Bytes.d.ts +29 -0
- package/extended/Bytes.js +70 -0
- package/extended/HashMap.d.ts +5 -0
- package/extended/HashMap.js +10 -0
- package/extended/Linkage.d.ts +37 -0
- package/extended/Linkage.js +65 -0
- package/extended/Map.d.ts +59 -0
- package/extended/Map.js +200 -0
- package/extended/OptionBool.d.ts +36 -0
- package/extended/OptionBool.js +72 -0
- package/extended/Range.d.ts +29 -0
- package/extended/Range.js +38 -0
- package/extended/RangeInclusive.d.ts +6 -0
- package/extended/RangeInclusive.js +13 -0
- package/extended/Type.d.ts +16 -0
- package/extended/Type.js +21 -0
- package/extended/U8aFixed.d.ts +16 -0
- package/extended/U8aFixed.js +42 -0
- package/extended/WrapperKeepOpaque.d.ts +40 -0
- package/extended/WrapperKeepOpaque.js +99 -0
- package/extended/WrapperOpaque.d.ts +10 -0
- package/extended/WrapperOpaque.js +19 -0
- package/{src/extended/index.ts → extended/index.d.ts} +0 -3
- package/extended/index.js +14 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/native/Bool.d.ts +71 -0
- package/native/Bool.js +109 -0
- package/native/Date.d.ts +84 -0
- package/native/Date.js +140 -0
- package/native/Float.d.ts +68 -0
- package/native/Float.js +107 -0
- package/native/Json.d.ts +69 -0
- package/native/Json.js +117 -0
- package/native/Raw.d.ts +87 -0
- package/native/Raw.js +140 -0
- package/native/Set.d.ts +84 -0
- package/native/Set.js +215 -0
- package/native/Struct.d.ts +106 -0
- package/{src/native/Struct.data.ts → native/Struct.data.js} +0 -3
- package/native/Struct.js +260 -0
- package/native/Text.d.ts +77 -0
- package/native/Text.js +150 -0
- package/{src/native/index.ts → native/index.d.ts} +0 -3
- package/native/index.js +8 -0
- package/package.json +1126 -11
- package/packageDetect.d.ts +1 -0
- package/packageDetect.js +3 -0
- package/packageInfo.d.ts +6 -0
- package/packageInfo.js +1 -0
- package/primitive/F32.d.ts +11 -0
- package/primitive/F32.js +10 -0
- package/primitive/F64.d.ts +11 -0
- package/primitive/F64.js +10 -0
- package/primitive/I128.d.ts +11 -0
- package/primitive/I128.js +10 -0
- package/primitive/I16.d.ts +11 -0
- package/primitive/I16.js +10 -0
- package/primitive/I256.d.ts +11 -0
- package/primitive/I256.js +10 -0
- package/primitive/I32.d.ts +11 -0
- package/primitive/I32.js +10 -0
- package/primitive/I64.d.ts +11 -0
- package/primitive/I64.js +10 -0
- package/primitive/I8.d.ts +11 -0
- package/primitive/I8.js +10 -0
- package/primitive/ISize.d.ts +12 -0
- package/primitive/ISize.js +14 -0
- package/primitive/U128.d.ts +11 -0
- package/primitive/U128.js +10 -0
- package/primitive/U16.d.ts +11 -0
- package/primitive/U16.js +10 -0
- package/primitive/U256.d.ts +11 -0
- package/primitive/U256.js +10 -0
- package/primitive/U32.d.ts +11 -0
- package/primitive/U32.js +10 -0
- package/primitive/U64.d.ts +11 -0
- package/primitive/U64.js +10 -0
- package/primitive/U8.d.ts +11 -0
- package/primitive/U8.js +10 -0
- package/primitive/USize.d.ts +12 -0
- package/primitive/USize.js +14 -0
- package/{src/primitive/index.ts → primitive/index.d.ts} +0 -3
- package/primitive/index.js +16 -0
- package/types/codec.d.ts +113 -0
- package/types/codec.js +1 -0
- package/{src/types/helpers.ts → types/helpers.d.ts} +8 -31
- package/types/helpers.js +1 -0
- package/{src/types/index.ts → types/index.d.ts} +0 -3
- package/types/index.js +4 -0
- package/types/interfaces.d.ts +74 -0
- package/types/interfaces.js +1 -0
- package/types/registry.d.ts +67 -0
- package/types/registry.js +1 -0
- package/utils/compareArray.d.ts +1 -0
- package/utils/compareArray.js +10 -0
- package/utils/compareMap.d.ts +1 -0
- package/utils/compareMap.js +27 -0
- package/utils/compareSet.d.ts +1 -0
- package/utils/compareSet.js +17 -0
- package/utils/decodeU8a.d.ts +26 -0
- package/utils/decodeU8a.js +100 -0
- package/{src/utils/index.ts → utils/index.d.ts} +0 -3
- package/utils/index.js +8 -0
- package/utils/sanitize.d.ts +15 -0
- package/utils/sanitize.js +219 -0
- package/utils/sortValues.d.ts +12 -0
- package/utils/sortValues.js +79 -0
- package/utils/toConstructors.d.ts +16 -0
- package/utils/toConstructors.js +35 -0
- package/utils/typesToMap.d.ts +2 -0
- package/utils/typesToMap.js +7 -0
- package/utils/util.d.ts +3 -0
- package/utils/util.js +4 -0
- package/src/abstract/Array.ts +0 -213
- package/src/abstract/Base.ts +0 -129
- package/src/abstract/Int.ts +0 -271
- package/src/abstract/Object.ts +0 -99
- package/src/base/Compact.spec.ts +0 -99
- package/src/base/Compact.ts +0 -198
- package/src/base/DoNotConstruct.spec.ts +0 -23
- package/src/base/DoNotConstruct.ts +0 -118
- package/src/base/Enum.spec.ts +0 -487
- package/src/base/Enum.ts +0 -460
- package/src/base/Int.spec.ts +0 -225
- package/src/base/Int.ts +0 -34
- package/src/base/Null.spec.ts +0 -41
- package/src/base/Null.ts +0 -96
- package/src/base/Option.spec.ts +0 -216
- package/src/base/Option.ts +0 -275
- package/src/base/Result.spec.ts +0 -64
- package/src/base/Result.ts +0 -79
- package/src/base/Tuple.spec.ts +0 -161
- package/src/base/Tuple.ts +0 -149
- package/src/base/UInt.spec.ts +0 -192
- package/src/base/UInt.ts +0 -30
- package/src/base/Vec.spec.ts +0 -224
- package/src/base/Vec.ts +0 -133
- package/src/base/VecAny.ts +0 -23
- package/src/base/VecFixed.spec.ts +0 -78
- package/src/base/VecFixed.ts +0 -92
- package/src/checkTypes.manual.ts +0 -12
- package/src/extended/BTreeMap.spec.ts +0 -245
- package/src/extended/BTreeMap.ts +0 -16
- package/src/extended/BTreeSet.spec.ts +0 -260
- package/src/extended/BTreeSet.ts +0 -233
- package/src/extended/BitVec.spec.ts +0 -97
- package/src/extended/BitVec.ts +0 -137
- package/src/extended/Bytes.spec.ts +0 -75
- package/src/extended/Bytes.ts +0 -88
- package/src/extended/HashMap.spec.ts +0 -36
- package/src/extended/HashMap.ts +0 -16
- package/src/extended/Linkage.spec.ts +0 -43
- package/src/extended/Linkage.ts +0 -81
- package/src/extended/Map.spec.ts +0 -123
- package/src/extended/Map.ts +0 -255
- package/src/extended/OptionBool.spec.ts +0 -49
- package/src/extended/OptionBool.ts +0 -93
- package/src/extended/Range.spec.ts +0 -37
- package/src/extended/Range.ts +0 -56
- package/src/extended/RangeInclusive.ts +0 -20
- package/src/extended/Type.spec.ts +0 -118
- package/src/extended/Type.ts +0 -29
- package/src/extended/U8aFixed.spec.ts +0 -117
- package/src/extended/U8aFixed.ts +0 -57
- package/src/extended/WrapperKeepOpaque.spec.ts +0 -101
- package/src/extended/WrapperKeepOpaque.ts +0 -128
- package/src/extended/WrapperOpaque.spec.ts +0 -58
- package/src/extended/WrapperOpaque.ts +0 -27
- package/src/index.ts +0 -6
- package/src/mod.ts +0 -4
- package/src/native/Bool.spec.ts +0 -74
- package/src/native/Bool.ts +0 -137
- package/src/native/Date.spec.ts +0 -85
- package/src/native/Date.ts +0 -169
- package/src/native/Float.spec.ts +0 -51
- package/src/native/Float.ts +0 -136
- package/src/native/Json.ts +0 -147
- package/src/native/Raw.spec.ts +0 -113
- package/src/native/Raw.ts +0 -171
- package/src/native/Set.spec.ts +0 -116
- package/src/native/Set.ts +0 -269
- package/src/native/Struct.spec.ts +0 -411
- package/src/native/Struct.ts +0 -338
- package/src/native/Text.spec.ts +0 -85
- package/src/native/Text.ts +0 -184
- package/src/packageDetect.ts +0 -11
- package/src/packageInfo.ts +0 -6
- package/src/primitive/F32.ts +0 -14
- package/src/primitive/F64.ts +0 -14
- package/src/primitive/I128.ts +0 -14
- package/src/primitive/I16.ts +0 -14
- package/src/primitive/I256.ts +0 -14
- package/src/primitive/I32.ts +0 -14
- package/src/primitive/I64.ts +0 -14
- package/src/primitive/I8.ts +0 -14
- package/src/primitive/ISize.ts +0 -21
- package/src/primitive/U128.ts +0 -14
- package/src/primitive/U16.ts +0 -14
- package/src/primitive/U256.ts +0 -14
- package/src/primitive/U32.ts +0 -14
- package/src/primitive/U64.ts +0 -14
- package/src/primitive/U8.ts +0 -14
- package/src/primitive/USize.ts +0 -21
- package/src/test/performance.ts +0 -61
- package/src/types/codec.ts +0 -140
- package/src/types/interfaces.ts +0 -98
- package/src/types/registry.ts +0 -86
- package/src/utils/compareArray.ts +0 -22
- package/src/utils/compareMap.ts +0 -40
- package/src/utils/compareSet.ts +0 -23
- package/src/utils/decodeU8a.ts +0 -123
- package/src/utils/sanitize.spec.ts +0 -89
- package/src/utils/sanitize.ts +0 -290
- package/src/utils/sortValues.ts +0 -103
- package/src/utils/toConstructors.ts +0 -46
- package/src/utils/typesToMap.ts +0 -14
- package/src/utils/util.ts +0 -8
- package/tsconfig.build.json +0 -16
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.spec.json +0 -21
- /package/{build/abstract → abstract}/Array.d.ts +0 -0
- /package/{build/abstract → abstract}/Base.d.ts +0 -0
- /package/{build/abstract → abstract}/Int.d.ts +0 -0
- /package/{build/abstract → abstract}/Object.d.ts +0 -0
- /package/{build/abstract → abstract}/index.d.ts +0 -0
- /package/{build/base → base}/Compact.d.ts +0 -0
- /package/{build/base → base}/DoNotConstruct.d.ts +0 -0
- /package/{build/base → base}/Enum.d.ts +0 -0
- /package/{build/base → base}/Null.d.ts +0 -0
- /package/{build/base → base}/Option.d.ts +0 -0
- /package/{build/base → base}/Result.d.ts +0 -0
- /package/{build/base → base}/Tuple.d.ts +0 -0
- /package/{build/base → base}/Vec.d.ts +0 -0
- /package/{build/base → base}/VecAny.d.ts +0 -0
- /package/{build/base → base}/VecFixed.d.ts +0 -0
- /package/{build/base → base}/index.d.ts +0 -0
- /package/{build/bundle.d.ts → bundle.d.ts} +0 -0
- /package/{build → cjs}/extended/BTreeMap.d.ts +0 -0
- /package/{build → cjs}/extended/BTreeSet.d.ts +0 -0
- /package/{build → cjs}/extended/BitVec.d.ts +0 -0
- /package/{build → cjs}/extended/Bytes.d.ts +0 -0
- /package/{build → cjs}/extended/HashMap.d.ts +0 -0
- /package/{build → cjs}/extended/Linkage.d.ts +0 -0
- /package/{build → cjs}/extended/Map.d.ts +0 -0
- /package/{build → cjs}/extended/OptionBool.d.ts +0 -0
- /package/{build → cjs}/extended/Range.d.ts +0 -0
- /package/{build → cjs}/extended/RangeInclusive.d.ts +0 -0
- /package/{build → cjs}/extended/Type.d.ts +0 -0
- /package/{build → cjs}/extended/U8aFixed.d.ts +0 -0
- /package/{build → cjs}/extended/WrapperKeepOpaque.d.ts +0 -0
- /package/{build → cjs}/extended/WrapperOpaque.d.ts +0 -0
- /package/{build → cjs}/extended/index.d.ts +0 -0
- /package/{build → cjs}/index.d.ts +0 -0
- /package/{build → cjs}/native/Bool.d.ts +0 -0
- /package/{build → cjs}/native/Date.d.ts +0 -0
- /package/{build → cjs}/native/Float.d.ts +0 -0
- /package/{build → cjs}/native/Json.d.ts +0 -0
- /package/{build → cjs}/native/Raw.d.ts +0 -0
- /package/{build → cjs}/native/Set.d.ts +0 -0
- /package/{build → cjs}/native/Struct.d.ts +0 -0
- /package/{build → cjs}/native/Text.d.ts +0 -0
- /package/{build → cjs}/native/index.d.ts +0 -0
- /package/{build → cjs}/packageDetect.d.ts +0 -0
- /package/{build → cjs}/packageInfo.d.ts +0 -0
- /package/{build → cjs}/primitive/F32.d.ts +0 -0
- /package/{build → cjs}/primitive/F64.d.ts +0 -0
- /package/{build → cjs}/primitive/I128.d.ts +0 -0
- /package/{build → cjs}/primitive/I16.d.ts +0 -0
- /package/{build → cjs}/primitive/I256.d.ts +0 -0
- /package/{build → cjs}/primitive/I32.d.ts +0 -0
- /package/{build → cjs}/primitive/I64.d.ts +0 -0
- /package/{build → cjs}/primitive/I8.d.ts +0 -0
- /package/{build → cjs}/primitive/ISize.d.ts +0 -0
- /package/{build → cjs}/primitive/U128.d.ts +0 -0
- /package/{build → cjs}/primitive/U16.d.ts +0 -0
- /package/{build → cjs}/primitive/U256.d.ts +0 -0
- /package/{build → cjs}/primitive/U32.d.ts +0 -0
- /package/{build → cjs}/primitive/U64.d.ts +0 -0
- /package/{build → cjs}/primitive/U8.d.ts +0 -0
- /package/{build → cjs}/primitive/USize.d.ts +0 -0
- /package/{build → cjs}/primitive/index.d.ts +0 -0
- /package/{build → cjs}/types/helpers.d.ts +0 -0
- /package/{build → cjs}/types/index.d.ts +0 -0
- /package/{build → cjs}/types/interfaces.d.ts +0 -0
- /package/{build → cjs}/types/registry.d.ts +0 -0
- /package/{build → cjs}/utils/compareArray.d.ts +0 -0
- /package/{build → cjs}/utils/compareMap.d.ts +0 -0
- /package/{build → cjs}/utils/compareSet.d.ts +0 -0
- /package/{build → cjs}/utils/decodeU8a.d.ts +0 -0
- /package/{build → cjs}/utils/index.d.ts +0 -0
- /package/{build → cjs}/utils/sanitize.d.ts +0 -0
- /package/{build → cjs}/utils/sortValues.d.ts +0 -0
- /package/{build → cjs}/utils/toConstructors.d.ts +0 -0
- /package/{build → cjs}/utils/typesToMap.d.ts +0 -0
- /package/{build → cjs}/utils/util.d.ts +0 -0
package/src/primitive/I32.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { Int } from '../base/Int.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @name i32
|
|
8
|
-
* @description
|
|
9
|
-
* A 32-bit signed integer
|
|
10
|
-
*/
|
|
11
|
-
export class i32 extends Int.with(32) {
|
|
12
|
-
// NOTE without this, we cannot properly determine extensions
|
|
13
|
-
readonly __IntType = 'i32';
|
|
14
|
-
}
|
package/src/primitive/I64.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { Int } from '../base/Int.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @name i64
|
|
8
|
-
* @description
|
|
9
|
-
* A 64-bit signed integer
|
|
10
|
-
*/
|
|
11
|
-
export class i64 extends Int.with(64) {
|
|
12
|
-
// NOTE without this, we cannot properly determine extensions
|
|
13
|
-
readonly __IntType = 'i64';
|
|
14
|
-
}
|
package/src/primitive/I8.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { Int } from '../base/Int.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @name i8
|
|
8
|
-
* @description
|
|
9
|
-
* An 8-bit signed integer
|
|
10
|
-
*/
|
|
11
|
-
export class i8 extends Int.with(8) {
|
|
12
|
-
// NOTE without this, we cannot properly determine extensions
|
|
13
|
-
readonly __IntType = 'i8';
|
|
14
|
-
}
|
package/src/primitive/ISize.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { Registry } from '../types/index.js';
|
|
5
|
-
|
|
6
|
-
import { i32 } from './I32.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @name ISize
|
|
10
|
-
* @description
|
|
11
|
-
* A System default signed number, typically used in RPC to report non-consensus
|
|
12
|
-
* data. It is a wrapper for [[I32]] as a WASM default (as generated by Rust bindings).
|
|
13
|
-
* It is not to be used, since it creates consensus mismatches.
|
|
14
|
-
*/
|
|
15
|
-
export class isize extends i32 {
|
|
16
|
-
constructor (registry: Registry, value?: unknown) {
|
|
17
|
-
super(registry, value);
|
|
18
|
-
|
|
19
|
-
throw new Error('The `isize` type should not be used. Since it is platform-specific, it creates incompatibilities between native (generally i64) and WASM (always i32) code. Use one of the `i32` or `i64` types explicitly.');
|
|
20
|
-
}
|
|
21
|
-
}
|
package/src/primitive/U128.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { UInt } from '../base/UInt.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @name u128
|
|
8
|
-
* @description
|
|
9
|
-
* A 128-bit unsigned integer
|
|
10
|
-
*/
|
|
11
|
-
export class u128 extends UInt.with(128) {
|
|
12
|
-
// NOTE without this, we cannot properly determine extensions
|
|
13
|
-
readonly __UIntType = 'u128';
|
|
14
|
-
}
|
package/src/primitive/U16.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { UInt } from '../base/UInt.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @name u16
|
|
8
|
-
* @description
|
|
9
|
-
* A 16-bit unsigned integer
|
|
10
|
-
*/
|
|
11
|
-
export class u16 extends UInt.with(16) {
|
|
12
|
-
// NOTE without this, we cannot properly determine extensions
|
|
13
|
-
readonly __UIntType = 'u16';
|
|
14
|
-
}
|
package/src/primitive/U256.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { UInt } from '../base/UInt.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @name u256
|
|
8
|
-
* @description
|
|
9
|
-
* A 256-bit unsigned integer
|
|
10
|
-
*/
|
|
11
|
-
export class u256 extends UInt.with(256) {
|
|
12
|
-
// NOTE without this, we cannot properly determine extensions
|
|
13
|
-
readonly __UIntType = 'u256';
|
|
14
|
-
}
|
package/src/primitive/U32.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { UInt } from '../base/UInt.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @name u32
|
|
8
|
-
* @description
|
|
9
|
-
* A 32-bit unsigned integer
|
|
10
|
-
*/
|
|
11
|
-
export class u32 extends UInt.with(32) {
|
|
12
|
-
// NOTE without this, we cannot properly determine extensions
|
|
13
|
-
readonly __UIntType = 'u32';
|
|
14
|
-
}
|
package/src/primitive/U64.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { UInt } from '../base/UInt.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @name u64
|
|
8
|
-
* @description
|
|
9
|
-
* A 64-bit unsigned integer
|
|
10
|
-
*/
|
|
11
|
-
export class u64 extends UInt.with(64) {
|
|
12
|
-
// NOTE without this, we cannot properly determine extensions
|
|
13
|
-
readonly __UIntType = 'u64';
|
|
14
|
-
}
|
package/src/primitive/U8.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { UInt } from '../base/UInt.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @name u8
|
|
8
|
-
* @description
|
|
9
|
-
* An 8-bit unsigned integer
|
|
10
|
-
*/
|
|
11
|
-
export class u8 extends UInt.with(8) {
|
|
12
|
-
// NOTE without this, we cannot properly determine extensions
|
|
13
|
-
readonly __UIntType = 'u8';
|
|
14
|
-
}
|
package/src/primitive/USize.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { Registry } from '../types/index.js';
|
|
5
|
-
|
|
6
|
-
import { u32 } from './U32.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @name USize
|
|
10
|
-
* @description
|
|
11
|
-
* A System default unsigned number, typically used in RPC to report non-consensus
|
|
12
|
-
* data. It is a wrapper for [[U32]] as a WASM default (as generated by Rust bindings).
|
|
13
|
-
* It is not to be used, since it created consensus mismatches.
|
|
14
|
-
*/
|
|
15
|
-
export class usize extends u32 {
|
|
16
|
-
constructor (registry: Registry, value?: unknown) {
|
|
17
|
-
super(registry, value);
|
|
18
|
-
|
|
19
|
-
throw new Error('The `usize` type should not be used. Since it is platform-specific, it creates incompatibilities between native (generally u64) and WASM (always u32) code. Use one of the `u32` or `u64` types explicitly.');
|
|
20
|
-
}
|
|
21
|
-
}
|
package/src/test/performance.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
/* global it */
|
|
5
|
-
|
|
6
|
-
// Shamelessly copied from @polkadot/util/test
|
|
7
|
-
|
|
8
|
-
import { formatDecimal, formatNumber } from '@pezkuwi/util';
|
|
9
|
-
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
-
type ExecFn = (...params: any[]) => unknown;
|
|
12
|
-
|
|
13
|
-
const NUM_PAD = 16;
|
|
14
|
-
const PRE_PAD = 32;
|
|
15
|
-
|
|
16
|
-
function loop (count: number, inputs: unknown[][], exec: ExecFn): [number, unknown[]] {
|
|
17
|
-
const start = performance.now();
|
|
18
|
-
const inputsCount = inputs.length;
|
|
19
|
-
const results = new Array<unknown>(inputsCount);
|
|
20
|
-
|
|
21
|
-
for (let i = 0; i < count; i++) {
|
|
22
|
-
const result = exec(...inputs[i % inputsCount]);
|
|
23
|
-
|
|
24
|
-
if (i < inputsCount) {
|
|
25
|
-
results[i] = result;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return [performance.now() - start, results];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function formatFixed (value: number): string {
|
|
33
|
-
const [a, b] = value.toFixed(2).split('.');
|
|
34
|
-
|
|
35
|
-
return [formatDecimal(a), b].join('.');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function formatOps (count: number, time: number): string {
|
|
39
|
-
const micro = (time * 1000) / count;
|
|
40
|
-
const ops = 1_000_000 / micro;
|
|
41
|
-
|
|
42
|
-
return `
|
|
43
|
-
${formatFixed(ops).padStart(NUM_PAD + PRE_PAD + 1)} ops/s
|
|
44
|
-
${formatFixed(micro).padStart(NUM_PAD + PRE_PAD + 1)} μs/op`;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function perf (name: string, count: number, inputs: unknown[][], exec: ExecFn): void {
|
|
48
|
-
const test = process.env['GITHUB_REPOSITORY']
|
|
49
|
-
? it.skip
|
|
50
|
-
: it;
|
|
51
|
-
|
|
52
|
-
test(`performance: ${name}`, (): void => {
|
|
53
|
-
const [time] = loop(count, inputs, exec);
|
|
54
|
-
|
|
55
|
-
console.error(`
|
|
56
|
-
performance run for ${name} completed with ${formatNumber(count)} iterations.
|
|
57
|
-
|
|
58
|
-
${`${name}:`.padStart(PRE_PAD)} ${time.toFixed(2).padStart(NUM_PAD)} ms${formatOps(count, time)}
|
|
59
|
-
`);
|
|
60
|
-
});
|
|
61
|
-
}
|
package/src/types/codec.ts
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { HexString } from '@pezkuwi/util/types';
|
|
5
|
-
import type { AnyJson, ToString } from './helpers.js';
|
|
6
|
-
import type { IU8a } from './interfaces.js';
|
|
7
|
-
import type { Registry } from './registry.js';
|
|
8
|
-
|
|
9
|
-
export type BareOpts = boolean | Record<string, boolean>;
|
|
10
|
-
|
|
11
|
-
export interface Inspect {
|
|
12
|
-
inner?: Inspect[] | undefined;
|
|
13
|
-
name?: string;
|
|
14
|
-
outer?: Uint8Array[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @name Codec
|
|
19
|
-
* @description
|
|
20
|
-
* The base Codec interface. All types implement the interface provided here.
|
|
21
|
-
* Additionally implementors can add their own specific interfaces and helpers
|
|
22
|
-
* with getters and functions. The Codec Base is however required for operating
|
|
23
|
-
* as an encoding/decoding layer
|
|
24
|
-
*/
|
|
25
|
-
export interface Codec {
|
|
26
|
-
/**
|
|
27
|
-
* @description
|
|
28
|
-
* The block at which this value was retrieved/created (set to non-empty when
|
|
29
|
-
* retrieved from storage)
|
|
30
|
-
*/
|
|
31
|
-
createdAtHash?: IU8a | undefined;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @description
|
|
35
|
-
* The length of the initial encoded value (Only available when the value was
|
|
36
|
-
* constructed from a Uint8Array input)
|
|
37
|
-
*/
|
|
38
|
-
initialU8aLength?: number | undefined;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @description
|
|
42
|
-
* (internal usage) Indicates that the value was created via a fallback. This
|
|
43
|
-
* is used when with data specified in the metadata when the storage entry is
|
|
44
|
-
* empty.
|
|
45
|
-
*
|
|
46
|
-
* With metadata fallback values (available as defaults on most storage entries)
|
|
47
|
-
* any empty storage item should erturn the default. (This is the same as the
|
|
48
|
-
* implementation on the Substrate runtime)
|
|
49
|
-
*/
|
|
50
|
-
isStorageFallback?: boolean;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @description The length of the value when encoded as a Uint8Array
|
|
54
|
-
*/
|
|
55
|
-
readonly encodedLength: number;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @description Returns a hash of the value
|
|
59
|
-
*/
|
|
60
|
-
readonly hash: IU8a;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @description Checks if the value is an empty value
|
|
64
|
-
*/
|
|
65
|
-
readonly isEmpty: boolean;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @description The registry associated with this object
|
|
69
|
-
*/
|
|
70
|
-
readonly registry: Registry;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @description Compares the value of the input to see if there is a match
|
|
74
|
-
*/
|
|
75
|
-
eq (other?: unknown): boolean;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @description Returns a breakdown of the hex encoding for this Codec
|
|
79
|
-
*/
|
|
80
|
-
inspect (isBare?: BareOpts): Inspect;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
|
|
84
|
-
*/
|
|
85
|
-
toHex (isLe?: boolean): HexString;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
|
89
|
-
* @param isExtended When set, for some (e.g. call) it can add more info, e.g. metadata documentation. (Generally not needed in all cases, but can be useful in Events, Calls, ...)
|
|
90
|
-
* @param disableAscii When set, for some (e.g. `Raw` types) it will disable converting the value to ascii.
|
|
91
|
-
*/
|
|
92
|
-
toHuman (isExtended?: boolean, disableAscii?: boolean): AnyJson;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @description Converts the Object to JSON, typically used for RPC transfers
|
|
96
|
-
*/
|
|
97
|
-
toJSON (): AnyJson;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* @description Converts the value in a best-fit primitive form
|
|
101
|
-
* @param disableAscii
|
|
102
|
-
*/
|
|
103
|
-
toPrimitive (disableAscii?: boolean): AnyJson;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* @description Returns the base runtime type name for this instance
|
|
107
|
-
*/
|
|
108
|
-
toRawType (): string;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* @description Returns the string representation of the value
|
|
112
|
-
*/
|
|
113
|
-
toString (): string;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
|
117
|
-
* @param isBare true when the value has none of the type-specific prefixes (internal use, only available on
|
|
118
|
-
* some Codec types, specifically those that add encodings such as length of indexes)
|
|
119
|
-
*/
|
|
120
|
-
toU8a (isBare?: BareOpts): Uint8Array;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export interface CodecClass<T = Codec, A extends unknown[] = any[]> {
|
|
124
|
-
/**
|
|
125
|
-
* @description An internal fallback type (previous generation) if encoding fails
|
|
126
|
-
*/
|
|
127
|
-
readonly __fallbackType?: string;
|
|
128
|
-
|
|
129
|
-
new(registry: Registry, ...args: A): T;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export interface CodecObject<T extends ToString> extends Codec {
|
|
133
|
-
readonly $: T;
|
|
134
|
-
|
|
135
|
-
valueOf (): T;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export type CodecTo = 'toHex' | 'toJSON' | 'toPrimitive' | 'toString' | 'toU8a';
|
|
139
|
-
|
|
140
|
-
export type ArgsDef = Record<string, CodecClass | string>;
|
package/src/types/interfaces.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
// import type { SignOptions } from '@pezkuwi/keyring/types';
|
|
5
|
-
import type { BN } from '@pezkuwi/util';
|
|
6
|
-
import type { ArgsDef, Codec } from './codec.js';
|
|
7
|
-
import type { AnyTuple } from './helpers.js';
|
|
8
|
-
|
|
9
|
-
export interface ICompact<T extends INumber = INumber> extends Codec {
|
|
10
|
-
toBigInt (): bigint;
|
|
11
|
-
toBn (): BN;
|
|
12
|
-
toNumber (): number;
|
|
13
|
-
unwrap (): T;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface IEnum extends Codec {
|
|
17
|
-
readonly defIndexes: number[];
|
|
18
|
-
readonly defKeys: string[];
|
|
19
|
-
readonly index: number;
|
|
20
|
-
readonly isBasic: boolean;
|
|
21
|
-
readonly type: string;
|
|
22
|
-
readonly value: Codec;
|
|
23
|
-
|
|
24
|
-
toNumber (): number;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface IMap<K extends Codec = Codec, V extends Codec = Codec> extends Map<K, V>, Codec {}
|
|
28
|
-
|
|
29
|
-
export interface INumber extends Codec {
|
|
30
|
-
bitLength (): number;
|
|
31
|
-
toBigInt (): bigint;
|
|
32
|
-
toBn (): BN;
|
|
33
|
-
toNumber (): number;
|
|
34
|
-
toPrimitive (disableAscii?: boolean): string | number;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface IFloat extends Codec {
|
|
38
|
-
toNumber (): number;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface IOption<T extends Codec = Codec> extends Codec {
|
|
42
|
-
readonly isNone: boolean;
|
|
43
|
-
readonly isSome: boolean;
|
|
44
|
-
readonly value: Codec;
|
|
45
|
-
|
|
46
|
-
unwrap (): T;
|
|
47
|
-
unwrapOr <O>(other: O): T | O;
|
|
48
|
-
unwrapOrDefault (): T;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface IResult<O extends Codec = Codec, E extends Codec = Codec> extends IEnum {
|
|
52
|
-
readonly asErr: E;
|
|
53
|
-
readonly asOk: O;
|
|
54
|
-
readonly isErr: boolean;
|
|
55
|
-
readonly isOk: boolean;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface ISet<K = string> extends Set<K>, Codec {
|
|
59
|
-
readonly strings: string[];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface IStruct<K = string, V extends Codec = Codec> extends Map<K, V>, Codec {
|
|
63
|
-
readonly defKeys: string[];
|
|
64
|
-
|
|
65
|
-
getAtIndex (index: number): Codec
|
|
66
|
-
toArray (): Codec[];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
70
|
-
export interface IText extends String, Codec {
|
|
71
|
-
// nothing additional
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export type ITuple<T extends AnyTuple = Codec[]> = T & Codec;
|
|
75
|
-
|
|
76
|
-
export interface IU8a extends Uint8Array, Codec {
|
|
77
|
-
readonly isAscii: boolean;
|
|
78
|
-
readonly isUtf8: boolean
|
|
79
|
-
|
|
80
|
-
bitLength (): number;
|
|
81
|
-
toHuman (isExtended?: boolean, disableAscii?: boolean): any;
|
|
82
|
-
toJSON (): any;
|
|
83
|
-
toUtf8 (): string;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface IVec<T extends Codec = Codec> extends Array<T>, Codec {
|
|
87
|
-
toArray (): T[];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface IMethod<A extends AnyTuple = AnyTuple, M = any> extends Codec {
|
|
91
|
-
readonly args: A;
|
|
92
|
-
readonly argsDef: ArgsDef;
|
|
93
|
-
readonly callIndex: Uint8Array;
|
|
94
|
-
readonly data: Uint8Array;
|
|
95
|
-
readonly meta: M;
|
|
96
|
-
|
|
97
|
-
is: (tx: IMethod<AnyTuple>) => tx is IMethod<A>;
|
|
98
|
-
}
|
package/src/types/registry.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import type { BN } from '@pezkuwi/util';
|
|
5
|
-
import type { Codec, CodecClass } from './codec.js';
|
|
6
|
-
import type { AnyTuple, LookupString } from './helpers.js';
|
|
7
|
-
import type { ICompact, IEnum, IMap, IMethod, INumber, IOption, IResult, ISet, IStruct, ITuple, IU8a, IVec } from './interfaces.js';
|
|
8
|
-
|
|
9
|
-
export type OnlyCodec<K, T, Types> =
|
|
10
|
-
K extends keyof Types
|
|
11
|
-
? Types[K]
|
|
12
|
-
: T extends ICompact | IEnum | IMap | IMethod | INumber | IOption | IResult | ISet | IStruct | ITuple | IU8a | IVec
|
|
13
|
-
? T
|
|
14
|
-
: T extends Codec
|
|
15
|
-
? T
|
|
16
|
-
: never;
|
|
17
|
-
|
|
18
|
-
export interface RegistryError {
|
|
19
|
-
args: string[];
|
|
20
|
-
docs: string[];
|
|
21
|
-
index: number;
|
|
22
|
-
// compat
|
|
23
|
-
method: string;
|
|
24
|
-
name: string;
|
|
25
|
-
section: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export type RegistryTypes =
|
|
29
|
-
Record<string, CodecClass | string | Record<string, string> |
|
|
30
|
-
{ _enum: string[] | Record<string, number> | Record<string, string | null> } |
|
|
31
|
-
{ _set: Record<string, number> }>;
|
|
32
|
-
|
|
33
|
-
export interface CodecCreateOptions {
|
|
34
|
-
blockHash?: Uint8Array | string | null | undefined;
|
|
35
|
-
isFallback?: boolean;
|
|
36
|
-
isOptional?: boolean;
|
|
37
|
-
isPedantic?: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface CallBase<A extends AnyTuple, M = any> extends IMethod<A, M> {
|
|
41
|
-
readonly method: string;
|
|
42
|
-
readonly section: string;
|
|
43
|
-
|
|
44
|
-
toJSON: () => any;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface CallFunction<A extends AnyTuple = AnyTuple, M = any> extends CallBase<A, M> {
|
|
48
|
-
(...args: any[]): IMethod<A, M>;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface Registry {
|
|
52
|
-
readonly chainDecimals: number[];
|
|
53
|
-
readonly chainIsEthereum: boolean;
|
|
54
|
-
readonly chainSS58: number | undefined;
|
|
55
|
-
readonly chainTokens: string[];
|
|
56
|
-
|
|
57
|
-
createdAtHash?: IU8a;
|
|
58
|
-
|
|
59
|
-
findMetaCall (callIndex: Uint8Array): CallFunction;
|
|
60
|
-
findMetaError (errorIndex: Uint8Array | { error: BN, index: BN } | { error: BN | Uint8Array, index: BN }): RegistryError;
|
|
61
|
-
findMetaEvent (eventIndex: Uint8Array): CodecClass<any>;
|
|
62
|
-
|
|
63
|
-
isLookupType (value: string): value is LookupString;
|
|
64
|
-
createLookupType (lookupId: ICompact<INumber> | number): LookupString;
|
|
65
|
-
createClassUnsafe <T extends Codec = Codec, K extends string = string> (type: K): CodecClass<T>;
|
|
66
|
-
createTypeUnsafe <T extends Codec = Codec, K extends string = string> (type: K, params: unknown[], options?: CodecCreateOptions): T;
|
|
67
|
-
|
|
68
|
-
// get is for Compat, overridden in derived classes
|
|
69
|
-
get (...params: never[]): any;
|
|
70
|
-
|
|
71
|
-
getClassName (clazz: CodecClass): string | undefined;
|
|
72
|
-
getOrThrow <T extends Codec = Codec, K extends string = string> (name: K, msg?: string): CodecClass<T>;
|
|
73
|
-
getOrUnknown <T extends Codec = Codec, K extends string = string> (name: K): CodecClass<T>;
|
|
74
|
-
getTransactionExtensionVersion (): number;
|
|
75
|
-
getSignedExtensionExtra (): Record<string, string>;
|
|
76
|
-
getSignedExtensionTypes (): Record<string, string>;
|
|
77
|
-
|
|
78
|
-
hasClass (name: string): boolean;
|
|
79
|
-
hasDef (name: string): boolean;
|
|
80
|
-
hasType (name: string): boolean;
|
|
81
|
-
hash (data: Uint8Array): IU8a;
|
|
82
|
-
register (type: CodecClass | RegistryTypes): void;
|
|
83
|
-
register (name: string, type: CodecClass): void;
|
|
84
|
-
register (arg1: string | CodecClass | RegistryTypes, arg2?: CodecClass): void;
|
|
85
|
-
setMetadata (metadata: unknown, signedExtensions?: string[], userExtensions?: unknown, noInitWarn?: boolean): void;
|
|
86
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { isUndefined } from '@pezkuwi/util';
|
|
5
|
-
|
|
6
|
-
import { hasEq } from './util.js';
|
|
7
|
-
|
|
8
|
-
// NOTE These are used internally and when comparing objects, we expect that
|
|
9
|
-
// when the second is an Codec[] that the first has to be as well
|
|
10
|
-
export function compareArray (a: unknown[], b?: unknown): boolean {
|
|
11
|
-
if (Array.isArray(b)) {
|
|
12
|
-
return (a.length === b.length) && isUndefined(
|
|
13
|
-
a.find((v, index): boolean =>
|
|
14
|
-
hasEq(v)
|
|
15
|
-
? !v.eq(b[index])
|
|
16
|
-
: v !== b[index]
|
|
17
|
-
)
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return false;
|
|
22
|
-
}
|
package/src/utils/compareMap.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { isObject, isUndefined } from '@pezkuwi/util';
|
|
5
|
-
|
|
6
|
-
import { hasEq } from './util.js';
|
|
7
|
-
|
|
8
|
-
function hasMismatch (a?: unknown, b?: unknown): boolean {
|
|
9
|
-
return isUndefined(a) || (
|
|
10
|
-
hasEq(a)
|
|
11
|
-
? !a.eq(b)
|
|
12
|
-
: a !== b
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function notEntry (value: unknown): boolean {
|
|
17
|
-
return !Array.isArray(value) || value.length !== 2;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function compareMapArray (a: Map<unknown, unknown>, b: [unknown, unknown][]): boolean {
|
|
21
|
-
// equal number of entries and each entry in the array should match
|
|
22
|
-
return (a.size === b.length) && !b.some((e) =>
|
|
23
|
-
notEntry(e) ||
|
|
24
|
-
hasMismatch(a.get(e[0]), e[1])
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// NOTE These are used internally and when comparing objects, we expect that
|
|
29
|
-
// when the second is an Map<string, Codec> that the first has to be as well
|
|
30
|
-
export function compareMap (a: Map<unknown, unknown>, b?: unknown): boolean {
|
|
31
|
-
if (Array.isArray(b)) {
|
|
32
|
-
return compareMapArray(a, b as [unknown, unknown][]);
|
|
33
|
-
} else if (b instanceof Map) {
|
|
34
|
-
return compareMapArray(a, [...b.entries()]);
|
|
35
|
-
} else if (isObject(b)) {
|
|
36
|
-
return compareMapArray(a, Object.entries(b));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return false;
|
|
40
|
-
}
|
package/src/utils/compareSet.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/types-codec authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { isObject } from '@pezkuwi/util';
|
|
5
|
-
|
|
6
|
-
function compareSetArray (a: Set<unknown>, b: any[]): boolean {
|
|
7
|
-
// equal number of entries and each entry in the array should match
|
|
8
|
-
return (a.size === b.length) && !b.some((e) => !a.has(e));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// NOTE These are used internally and when comparing objects, we expect that
|
|
12
|
-
// when the second is an Set<string, Codec> that the first has to be as well
|
|
13
|
-
export function compareSet (a: Set<unknown>, b?: unknown): boolean {
|
|
14
|
-
if (Array.isArray(b)) {
|
|
15
|
-
return compareSetArray(a, b);
|
|
16
|
-
} else if (b instanceof Set) {
|
|
17
|
-
return compareSetArray(a, [...b.values()]);
|
|
18
|
-
} else if (isObject(b)) {
|
|
19
|
-
return compareSetArray(a, Object.values(b));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return false;
|
|
23
|
-
}
|