This commit is contained in:
Jaco
2022-05-30 15:42:31 +03:00
committed by GitHub
parent 06cb4aadfa
commit bd0b6426a7
20 changed files with 191 additions and 187 deletions
+3 -3
View File
@@ -20,14 +20,14 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "8.6.2-1",
"version": "8.6.2",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.3",
"@polkadot/types-codec": "8.6.2-1",
"@polkadot/types-codec": "8.6.2",
"@polkadot/util": "^9.3.1"
},
"devDependencies": {
"@polkadot/types": "8.6.2-1"
"@polkadot/types": "8.6.2"
}
}
+7 -6
View File
@@ -4,7 +4,7 @@
import type { Codec, CodecClass, Registry, U8aBitLength, UIntBitLength } from '@polkadot/types-codec/types';
import type { TypeDef } from '../types';
import { BTreeMap, BTreeSet, Bytes, CodecSet, Compact, DoNotConstruct, Enum, HashMap, Int, Null, Option, OptionBool, Range, RangeInclusive, Result, Struct, Tuple, U8aFixed, UInt, Vec, VecFixed, WrapperKeepOpaque, WrapperOpaque } from '@polkadot/types-codec';
import { BTreeMap, BTreeSet, Bytes, CodecSet, Compact, DoNotConstruct, Enum, HashMap, Int, Null, Option, Range, RangeInclusive, Result, Struct, Tuple, U8aFixed, UInt, Vec, VecFixed, WrapperKeepOpaque, WrapperOpaque } from '@polkadot/types-codec';
import { assert, isNumber, stringify } from '@polkadot/util';
import { TypeDefInfo } from '../types';
@@ -118,11 +118,12 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
[TypeDefInfo.Option]: (registry: Registry, value: TypeDef): CodecClass<Codec> => {
assert(value.sub && !Array.isArray(value.sub), 'Expected type information for Option');
return (
value.sub.type === 'bool'
? OptionBool
: createWithSub(Option, value)
);
// NOTE This is opt-in (unhandled), not by default
// if (value.sub.type === 'bool') {
// return OptionBool;
// }
return createWithSub(Option, value);
},
[TypeDefInfo.Plain]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>