cameCase storage section (as in extrinsics) (#1056)

This commit is contained in:
Jaco Greeff
2019-06-25 14:30:36 +02:00
committed by Stefanie Doll
parent 88164a64b9
commit 68b07eb19b
@@ -5,7 +5,7 @@
import { ModuleStorage, Storage } from '../types';
import Metadata from '@polkadot/types/Metadata';
import { stringLowerFirst } from '@polkadot/util';
import { stringCamelCase, stringLowerFirst } from '@polkadot/util';
import createFunction from './createFunction';
import { storage } from './storage';
@@ -26,7 +26,7 @@ export default function fromMetadata (metadata: Metadata): Storage {
const { name, prefix } = moduleMetadata;
// For access, we change the index names, i.e. Balances.FreeBalance -> balances.freeBalance
result[stringLowerFirst(name.toString())] = moduleMetadata.storage.unwrap().reduce((newModule, storageFnMeta) => {
result[stringCamelCase(name.toString())] = moduleMetadata.storage.unwrap().reduce((newModule, storageFnMeta) => {
newModule[stringLowerFirst(storageFnMeta.name.toString())] = createFunction(prefix, storageFnMeta.name, storageFnMeta);
return newModule;