Drop support for linked lists (#2643)
* Drop support for linked lists * CHANGELOG * Remove all .linked. checks
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user