Split into types-augment (#4350)
* Aplit into types-augment * Adjust * Adjust, fix typegen run * Adjust * Rebuild * Adjust * Adjust * CC
This commit is contained in:
@@ -7,9 +7,9 @@ import type { ExtraTypes } from './types';
|
||||
|
||||
import Handlebars from 'handlebars';
|
||||
|
||||
import lookupDefinitions from '@polkadot/types/augment/lookup/definitions';
|
||||
import * as defaultDefs from '@polkadot/types/interfaces/definitions';
|
||||
import { Definitions } from '@polkadot/types/types';
|
||||
import lookupDefinitions from '@polkadot/types-augment/augment/lookup/definitions';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import { compareName, createImports, formatType, initMeta, readTemplate, setImports, writeFile } from '../util';
|
||||
@@ -20,7 +20,7 @@ const generateForMetaTemplate = Handlebars.compile(readTemplate('consts'));
|
||||
function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
|
||||
writeFile(dest, (): string => {
|
||||
const allTypes = {
|
||||
'@polkadot/types/augment': {
|
||||
'@polkadot/types-augment': {
|
||||
lookup: {
|
||||
...lookupDefinitions,
|
||||
...customLookupDefinitions
|
||||
@@ -71,7 +71,7 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
|
||||
modules,
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map<{ file: string; types: string[] }>((packagePath) => ({
|
||||
file: packagePath.replace('@polkadot/types/augment', '@polkadot/types'),
|
||||
file: packagePath.replace('@polkadot/types-augment', '@polkadot/types'),
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
|
||||
@@ -7,9 +7,9 @@ import type { ExtraTypes } from './types';
|
||||
|
||||
import Handlebars from 'handlebars';
|
||||
|
||||
import lookupDefinitions from '@polkadot/types/augment/lookup/definitions';
|
||||
import * as defaultDefs from '@polkadot/types/interfaces/definitions';
|
||||
import { Definitions } from '@polkadot/types/types';
|
||||
import lookupDefinitions from '@polkadot/types-augment/augment/lookup/definitions';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import { compareName, createImports, formatType, initMeta, readTemplate, setImports, writeFile } from '../util';
|
||||
@@ -20,7 +20,7 @@ const generateForMetaTemplate = Handlebars.compile(readTemplate('events'));
|
||||
function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
|
||||
writeFile(dest, (): string => {
|
||||
const allTypes = {
|
||||
'@polkadot/types/augment': {
|
||||
'@polkadot/types-augment': {
|
||||
lookup: {
|
||||
...lookupDefinitions,
|
||||
...customLookupDefinitions
|
||||
@@ -63,7 +63,7 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
|
||||
modules,
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath.replace('@polkadot/types/augment', '@polkadot/types'),
|
||||
file: packagePath.replace('@polkadot/types-augment', '@polkadot/types'),
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
|
||||
@@ -79,6 +79,6 @@ export function generateInterfaceTypes (importDefinitions: { [importPath: string
|
||||
export function generateDefaultInterface (): void {
|
||||
generateInterfaceTypes(
|
||||
{ '@polkadot/types/interfaces': defaultDefinitions },
|
||||
'packages/types/src/augment/registry.ts'
|
||||
'packages/types-augment/src/augment/registry.ts'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ function generateLookup (destDir: string, entries: [string | undefined, HexStrin
|
||||
}
|
||||
|
||||
// Generate `packages/types/src/lookup/*s`, the registry of all lookup types
|
||||
export function generateDefaultLookup (destDir = 'packages/types/src/augment/lookup', staticData?: HexString): void {
|
||||
export function generateDefaultLookup (destDir = 'packages/types-augment/src/augment/lookup', staticData?: HexString): void {
|
||||
generateLookup(
|
||||
destDir,
|
||||
staticData
|
||||
|
||||
@@ -9,9 +9,9 @@ import type { ExtraTypes } from './types';
|
||||
|
||||
import Handlebars from 'handlebars';
|
||||
|
||||
import lookupDefinitions from '@polkadot/types/augment/lookup/definitions';
|
||||
import * as defaultDefs from '@polkadot/types/interfaces/definitions';
|
||||
import { unwrapStorageSi } from '@polkadot/types/primitive/StorageKey';
|
||||
import lookupDefinitions from '@polkadot/types-augment/augment/lookup/definitions';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import { compareName, createImports, formatType, getSimilarTypes, initMeta, readTemplate, setImports, TypeImports, writeFile } from '../util';
|
||||
@@ -69,7 +69,7 @@ function entrySignature (lookup: PortableRegistry, allDefs: Record<string, Modul
|
||||
function generateForMeta (registry: Registry, meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
|
||||
writeFile(dest, (): string => {
|
||||
const allTypes: ExtraTypes = {
|
||||
'@polkadot/types/augment': {
|
||||
'@polkadot/types-augment': {
|
||||
lookup: {
|
||||
...lookupDefinitions,
|
||||
...customLookupDefinitions
|
||||
@@ -120,7 +120,7 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
|
||||
modules,
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath.replace('@polkadot/types/augment', '@polkadot/types'),
|
||||
file: packagePath.replace('@polkadot/types-augment', '@polkadot/types'),
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
|
||||
@@ -131,7 +131,7 @@ export function generateRpcTypes (registry: TypeRegistry, importDefinitions: Rec
|
||||
modules,
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath.replace('@polkadot/types/augment', '@polkadot/types'),
|
||||
file: packagePath.replace('@polkadot/types-augment', '@polkadot/types'),
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
|
||||
@@ -8,9 +8,9 @@ import type { ExtraTypes } from './types';
|
||||
|
||||
import Handlebars from 'handlebars';
|
||||
|
||||
import lookupDefinitions from '@polkadot/types/augment/lookup/definitions';
|
||||
import * as defaultDefs from '@polkadot/types/interfaces/definitions';
|
||||
import { Text } from '@polkadot/types/primitive';
|
||||
import lookupDefinitions from '@polkadot/types-augment/augment/lookup/definitions';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import { compareName, createImports, formatType, getSimilarTypes, initMeta, readTemplate, setImports, writeFile } from '../util';
|
||||
@@ -32,7 +32,7 @@ function mapName (_name: Text): string {
|
||||
function generateForMeta (registry: Registry, meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
|
||||
writeFile(dest, (): string => {
|
||||
const allTypes: ExtraTypes = {
|
||||
'@polkadot/types/augment': {
|
||||
'@polkadot/types-augment': {
|
||||
lookup: {
|
||||
...lookupDefinitions,
|
||||
...customLookupDefinitions
|
||||
@@ -105,7 +105,7 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
|
||||
modules,
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath.replace('@polkadot/types/augment', '@polkadot/types'),
|
||||
file: packagePath.replace('@polkadot/types-augment', '@polkadot/types'),
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
{{{ importsRelative }}}
|
||||
|
||||
declare module '@polkadot/types/types/registry' {
|
||||
declare module '@polkadot/types-augment/registry' {
|
||||
{{{ importsPackage }}}
|
||||
|
||||
export interface InterfaceTypes {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
{{{ importsRelative }}}
|
||||
|
||||
declare module '@polkadot/types/lookup' {
|
||||
declare module '@polkadot/types-augment/lookup' {
|
||||
{{{ importsPackage }}}
|
||||
|
||||
{{#each items}}
|
||||
|
||||
Reference in New Issue
Block a user