|
@@ -2,7 +2,6 @@
|
|
|
|
|
|
import { types } from '../index'
|
|
import { types } from '../index'
|
|
import { Constructor, Codec, RegistryTypes, Registry } from '@polkadot/types/types'
|
|
import { Constructor, Codec, RegistryTypes, Registry } from '@polkadot/types/types'
|
|
-import { Struct } from '@polkadot/types/codec'
|
|
|
|
import { TypeRegistry } from '@polkadot/types'
|
|
import { TypeRegistry } from '@polkadot/types'
|
|
import fs from 'fs'
|
|
import fs from 'fs'
|
|
import path from 'path'
|
|
import path from 'path'
|
|
@@ -49,13 +48,8 @@ function normalizeDef(registry: Registry, defOrConstructor: any, typeName: strin
|
|
throw new Error('_set definitions are not supported yet!')
|
|
throw new Error('_set definitions are not supported yet!')
|
|
} else {
|
|
} else {
|
|
// Struct - normalize properties
|
|
// Struct - normalize properties
|
|
- const emptyStruct = new Struct(registry, {}) as any
|
|
|
|
for (const [key, value] of Object.entries(obj)) {
|
|
for (const [key, value] of Object.entries(obj)) {
|
|
// Prevent interface clashes
|
|
// Prevent interface clashes
|
|
- // FIXME: Would be way better if this was actually done by @polkadot/typegen tool
|
|
|
|
- if (emptyStruct[key] !== undefined) {
|
|
|
|
- continue
|
|
|
|
- }
|
|
|
|
const normalizedValue = normalizeDef(registry, value, `${typeName}[${key}]`)
|
|
const normalizedValue = normalizeDef(registry, value, `${typeName}[${key}]`)
|
|
if (typeof normalizedValue !== 'string') {
|
|
if (typeof normalizedValue !== 'string') {
|
|
throw new Error(
|
|
throw new Error(
|