Bump common, string* with String (#2799)

* Bump common, string* with String

* Linting, TS 4.0.5
This commit is contained in:
Jaco Greeff
2020-10-28 14:28:49 +01:00
committed by GitHub
parent 3f48b3c29f
commit 1476e5e5e9
28 changed files with 128 additions and 122 deletions
@@ -19,13 +19,13 @@ export default function fromMetadata (registry: Registry, metadata: Metadata): C
const { name } = moduleMetadata;
// For access, we change the index names, i.e. Democracy.EnactmentPeriod -> democracy.enactmentPeriod
result[stringCamelCase(name.toString())] = moduleMetadata.constants.reduce((newModule: ModuleConstants, meta): ModuleConstants => {
result[stringCamelCase(name)] = moduleMetadata.constants.reduce((newModule: ModuleConstants, meta): ModuleConstants => {
// convert to the natural type as received
const type = meta.type.toString();
const codec: ConstantCodec = createTypeUnsafe(registry, type, [hexToU8a(meta.value.toHex())]);
codec.meta = meta;
newModule[stringCamelCase(meta.name.toString())] = codec;
newModule[stringCamelCase(meta.name)] = codec;
return newModule;
}, {} as ModuleConstants);
@@ -10,7 +10,7 @@ import { assert, stringCamelCase } from '@polkadot/util';
export default function createDescriptor (registry: Registry, section: string, sectionIndex: number, methodIndex: number, callMetadata: RegistryMetadataCall): CallFunction {
const callIndex = new Uint8Array([sectionIndex, methodIndex]);
const expectedArgs = callMetadata.args;
const funcName = stringCamelCase(callMetadata.name.toString());
const funcName = stringCamelCase(callMetadata.name);
const extrinsicFn = (...args: any[]): Call => {
assert(
@@ -19,10 +19,10 @@ export default function fromMetadata (registry: Registry, metadata: RegistryMeta
const sectionIndex = isIndexed
? index.toNumber()
: _sectionIndex;
const section = stringCamelCase(name.toString());
const section = stringCamelCase(name);
result[section] = calls.unwrap().reduce((newModule: Calls, callMetadata, methodIndex): Calls => {
const method = stringCamelCase(callMetadata.name.toString());
const method = stringCamelCase(callMetadata.name);
newModule[method] = createUnchecked(registry, section, sectionIndex, methodIndex, callMetadata);
@@ -18,7 +18,7 @@ export default function fromMetadata (registry: Registry, metadata: Metadata): S
}
const { name } = moduleMetadata;
const section = stringCamelCase(name.toString());
const section = stringCamelCase(name);
const unwrapped = moduleMetadata.storage.unwrap();
const prefix = unwrapped.prefix.toString();
@@ -27,7 +27,7 @@ export default function extractTypes (types: string[]): Extracted[] {
case TypeDefInfo.HashMap:
case TypeDefInfo.Result:
case TypeDefInfo.Tuple:
return extractTypes((decoded.sub as TypeDef[]).map((sub): string => sub.type));
return extractTypes((decoded.sub as TypeDef[]).map(({ type }) => type));
default:
throw new Error(`Unhandled: Unable to create and validate type from ${type}`);
@@ -128,7 +128,7 @@ export default function toLatest (registry: Registry, { extrinsic, modules }: Me
const calls = mod.calls.unwrapOr(null);
const events = mod.events.unwrapOr(null);
const storage = mod.storage.unwrapOr(null);
const sectionTypes = getModuleTypes(registry, stringCamelCase(mod.name.toString()));
const sectionTypes = getModuleTypes(registry, stringCamelCase(mod.name));
return registry.createType('ModuleMetadataLatest', {
...mod,