Adjust generation sorting (#3785)

This commit is contained in:
Jaco
2021-07-20 14:14:14 +02:00
committed by GitHub
parent 20f18c72e5
commit 6dd019343d
6 changed files with 37 additions and 36 deletions
+18 -18
View File
@@ -4413,24 +4413,6 @@ declare module '@polkadot/api/types/submittable' {
* # </weight>
**/
vest: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
/**
* Unlock any vested funds of a `target` account.
*
* The dispatch origin for this call must be _Signed_.
*
* - `target`: The account whose vested funds should be unlocked. Must have funds still
* locked under this pallet.
*
* Emits either `VestingCompleted` or `VestingUpdated`.
*
* # <weight>
* - `O(1)`.
* - DbWeight: 3 Reads, 3 Writes
* - Reads: Vesting Storage, Balances Locks, Target Account
* - Writes: Vesting Storage, Balances Locks, Target Account
* # </weight>
**/
vestOther: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
/**
* Create a vested transfer.
*
@@ -4450,6 +4432,24 @@ declare module '@polkadot/api/types/submittable' {
* # </weight>
**/
vestedTransfer: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, VestingInfo]>;
/**
* Unlock any vested funds of a `target` account.
*
* The dispatch origin for this call must be _Signed_.
*
* - `target`: The account whose vested funds should be unlocked. Must have funds still
* locked under this pallet.
*
* Emits either `VestingCompleted` or `VestingUpdated`.
*
* # <weight>
* - `O(1)`.
* - DbWeight: 3 Reads, 3 Writes
* - Reads: Vesting Storage, Balances Locks, Target Account
* - Writes: Vesting Storage, Balances Locks, Target Account
* # </weight>
**/
vestOther: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
/**
* Generic tx
**/
+4 -4
View File
@@ -24,7 +24,6 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
}, {});
const modules = meta.asLatest.modules
.sort(compareName)
.filter((mod) => mod.constants.length > 0)
.map(({ constants, name }) => {
if (!isStrict) {
@@ -32,7 +31,6 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
}
const items = constants
.sort(compareName)
.map(({ docs, name, type }) => {
const returnType = formatType(allDefs, type.toString(), imports);
@@ -43,13 +41,15 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
name: stringCamelCase(name),
type: returnType
};
});
})
.sort(compareName);
return {
items,
name: stringCamelCase(name)
};
});
})
.sort(compareName);
const types = [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
+4 -4
View File
@@ -19,17 +19,17 @@ function generateForMeta (meta: Metadata, dest: string, isStrict: boolean): void
const imports = createImports({});
const modules = meta.asLatest.modules
.sort(compareName)
.filter((mod) => mod.errors.length > 0)
.map(({ errors, name }) => ({
items: errors
.sort(compareName)
.map(({ docs, name }) => ({
docs,
name: name.toString()
})),
}))
.sort(compareName),
name: stringCamelCase(name)
}));
}))
.sort(compareName);
const types = [
{
+3 -3
View File
@@ -24,7 +24,6 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
}, {});
const modules = meta.asLatest.modules
.sort(compareName)
.filter((mod) => mod.events.isSome)
.map(({ events, name }) => ({
items: events
@@ -40,9 +39,10 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
name: name.toString(),
type: types.join(', ')
};
}),
}).sort(compareName),
name: stringCamelCase(name)
}));
}))
.sort(compareName);
const types = [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
+4 -3
View File
@@ -101,7 +101,6 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
.filter((mod) => !mod.storage.isNone)
.map(({ name, storage }) => {
const items = storage.unwrap().items
.sort(compareName)
.map((storageEntry) => {
const [args, params, returnType] = entrySignature(allDefs, registry, storageEntry, imports);
@@ -113,13 +112,15 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
params,
returnType
};
});
})
.sort(compareName);
return {
items,
name: stringCamelCase(name)
};
});
})
.sort(compareName);
imports.typesTypes.Observable = true;
+4 -4
View File
@@ -37,13 +37,11 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
}, {});
const modules = meta.asLatest.modules
.sort(compareName)
.filter(({ calls }) => calls.unwrapOr([]).length !== 0)
.map(({ calls, name }) => {
setImports(allDefs, imports, ['Call', 'Extrinsic', 'SubmittableExtrinsic']);
const items = calls.unwrap()
.sort(compareName)
.map(({ args, docs, name }) => {
const params = args
.map(({ name, type }) => {
@@ -62,13 +60,15 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
name: stringCamelCase(name),
params
};
});
})
.sort(compareName);
return {
items,
name: stringCamelCase(name)
};
});
})
.sort(compareName);
const types = [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({