Drop support for linked lists (#2643)

* Drop support for linked lists

* CHANGELOG

* Remove all .linked. checks
This commit is contained in:
Jaco Greeff
2020-09-25 10:19:28 +02:00
committed by GitHub
parent 82afd93bf6
commit 7fd45f63df
7 changed files with 23 additions and 160 deletions
+3 -13
View File
@@ -42,30 +42,20 @@ const HASHER_MAP: Record<keyof typeof AllHashers, [number, boolean]> = {
Twox64Concat: [8, true]
};
function getStorageType (type: StorageEntryTypeLatest, isOptionalLinked?: boolean): [boolean, string] {
function getStorageType (type: StorageEntryTypeLatest): [boolean, string] {
if (type.isPlain) {
return [false, type.asPlain.toString()];
} else if (type.isDoubleMap) {
return [false, type.asDoubleMap.value.toString()];
}
const map = type.asMap;
if (map.linked.isTrue) {
const [pre, post] = isOptionalLinked
? ['Option<', '>']
: ['', ''];
return [true, `(${pre}${map.value.toString()}${post}, Linkage<${map.key.toString()}>)`];
}
return [false, map.value.toString()];
return [false, type.asMap.value.toString()];
}
// we unwrap the type here, turning into an output usable for createType
/** @internal */
export function unwrapStorageType (type: StorageEntryTypeLatest, isOptional?: boolean): keyof InterfaceTypes {
const [hasWrapper, outputType] = getStorageType(type, isOptional);
const [hasWrapper, outputType] = getStorageType(type);
return isOptional && !hasWrapper
? `Option<${outputType}>` as keyof InterfaceTypes