fix: storageNames in metadata v4 to support DoubleMap

Merged in polkadot_v77_1 (pull request #4)

Approved-by: Ian He <ian-he@outlook.com>
This commit is contained in:
Alex Wang
2019-05-27 15:46:29 +12:00
committed by ian.he
parent daaa16523d
commit c88d284a5c
+9 -5
View File
@@ -109,11 +109,15 @@ export default class MetadataV4 extends Struct implements MetadataInterface {
return this.modules.map((mod) =>
mod.storage.isNone
? []
: mod.storage.unwrap().map((fn) =>
fn.type.isMap
? [fn.type.asMap.key.toString(), fn.type.asMap.value.toString()]
: [fn.type.asType.toString()]
)
: mod.storage.unwrap().map((fn) => {
if (fn.type.isMap) {
return [fn.type.asMap.key.toString(), fn.type.asMap.value.toString()];
} else if (fn.type.isDoubleMap) {
return [fn.type.asDoubleMap.key1.toString(), fn.type.asDoubleMap.key2.toString(), fn.type.asDoubleMap.value.toString()];
} else {
return [fn.type.asType.toString()];
}
})
);
}