Align query name generation (#4383)

This commit is contained in:
Jaco
2021-12-23 11:44:36 +02:00
committed by GitHub
parent bb2833ae51
commit d0b4542c94
3 changed files with 4 additions and 5 deletions
@@ -55,7 +55,7 @@ describe('decorateStorage', (): void => {
'0x' +
'80' + // length
'26aa394eea5630e07c48ae0c9558cef7' + // System
xxhashAsHex(':__STORAGE_VERSION__:', 128).substr(2)
xxhashAsHex(':__STORAGE_VERSION__:', 128).substring(2)
);
});
});
@@ -7,7 +7,7 @@ import type { Storage } from '../types';
import { lazyMethod, lazyMethods, stringCamelCase } from '@polkadot/util';
import { objectNameFirstLower } from '../util';
import { objectNameToCamel } from '../util';
import { createFunction, createKeyRaw, NO_RAW_ARGS } from './createFunction';
import { getStorage } from './getStorage';
import { createRuntimeFunction } from './util';
@@ -41,7 +41,7 @@ export function decorateStorage (registry: CodecRegistry, { pallets }: MetadataL
items,
(meta: StorageEntryMetadataLatest) =>
createFunction(registry, { meta, method: meta.name.toString(), prefix, section }, {}),
objectNameFirstLower
objectNameToCamel
)
);
}
+1 -2
View File
@@ -3,7 +3,7 @@
import type { Text } from '@polkadot/types-codec';
import { stringCamelCase, stringLowerFirst } from '@polkadot/util';
import { stringCamelCase } from '@polkadot/util';
type Name = string | Text;
@@ -15,6 +15,5 @@ function convert (fn: (n: Name) => string): (n: Named) => string {
return ({ name }: Named) => fn(name);
}
export const objectNameFirstLower = convert(stringLowerFirst);
export const objectNameToCamel = convert(stringCamelCase);
export const objectNameToString = convert((n) => n.toString());