Rename srml to interfaces (#1198)
* Rename srml to interfaces * newline, package.json
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
import '../injector';
|
||||
|
||||
import { Balance, BlockNumber } from '../srml/runtime/types';
|
||||
import { Balance, BlockNumber } from '../interfaces/runtime';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
import '../injector';
|
||||
|
||||
import { VoteThreshold } from '../srml/elections/types';
|
||||
import { BlockNumber } from '../srml/runtime/types';
|
||||
import { VoteThreshold } from '../interfaces/elections';
|
||||
import { BlockNumber } from '../interfaces/runtime';
|
||||
import { CodecTo } from '../types';
|
||||
|
||||
import extrinsics from '@polkadot/api-metadata/extrinsics/static';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Proposal, PropIndex } from '../srml/democracy/types';
|
||||
import { Proposal, PropIndex } from '../interfaces/democracy';
|
||||
import { Codec, CodecTo } from '../types';
|
||||
|
||||
import extrinsics from '@polkadot/api-metadata/extrinsics/static';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { ClassOf } from './codec/createType';
|
||||
import getTypeRegistry from './codec/typeRegistry';
|
||||
import * as srmlTypes from './srml/definitions';
|
||||
import * as definitions from './interfaces/definitions';
|
||||
|
||||
/**
|
||||
* @description A utility method that injects all the srml definitions into the type registry
|
||||
@@ -12,7 +12,7 @@ import * as srmlTypes from './srml/definitions';
|
||||
export function injectDefinitions (): void {
|
||||
const registry = getTypeRegistry();
|
||||
|
||||
Object.values(srmlTypes).forEach(({ types }): void =>
|
||||
Object.values(definitions).forEach(({ types }): void =>
|
||||
registry.register(types)
|
||||
);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Compact, Option, Vec } from './codec';
|
||||
import { AccountId, AccountIndex, Address, Block, Bool, Bytes, ConsensusEngineId, Data, Digest, DigestItem, Event, Extrinsic, ExtrinsicEra, Fixed64, H160, H256, H512, Header, I128, I16, I256, I32, I64, I8, ImmortalEra, Method, Moment, MortalEra, Null, Origin, SignaturePayload, StorageHasher, StorageKey, Text, Type, U128, U16, U256, U32, U64, U8, Vote, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from './primitive';
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Codec } from '../../types';
|
||||
import { Enum, Option, Vec } from '../../codec';
|
||||
import { AccountId } from '../../primitive';
|
||||
import { BlockNumber, Hash } from '../runtime/types';
|
||||
import { BlockNumber, Hash } from '../runtime';
|
||||
|
||||
/** BlockNumber */
|
||||
export type InclusionHeight = BlockNumber;
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
@@ -1,4 +1,4 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Compact, Option, Vec } from '../../codec';
|
||||
import { u64 } from '../../primitive';
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Option, Set, Struct, Vec } from '../../codec';
|
||||
import { Balance, BlockNumber, LockIdentifier } from '../runtime/types';
|
||||
import { Balance, BlockNumber, LockIdentifier } from '../runtime';
|
||||
|
||||
/** Struct */
|
||||
export interface BalanceLock extends Struct {
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Compact, Option, Struct, Vec } from '../../codec';
|
||||
import { AccountId, u32, u64 } from '../../primitive';
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Option, Vec } from '../../codec';
|
||||
import { AccountId } from '../../primitive';
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Compact, Enum, Option, Struct, Vec } from '../../codec';
|
||||
import { Bool, Bytes, Null, u32, u64, u8 } from '../../primitive';
|
||||
import { Balance, BlockNumber, Hash } from '../runtime/types';
|
||||
import { Balance, BlockNumber, Hash } from '../runtime';
|
||||
|
||||
/** Struct */
|
||||
export interface AliveContractInfo extends Struct {
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Compact, Enum, Option, Struct, Vec } from '../../codec';
|
||||
import { Method, u32 } from '../../primitive';
|
||||
import { BlockNumber } from '../runtime/types';
|
||||
import { VoteThreshold } from '../elections/types';
|
||||
import { BlockNumber } from '../runtime';
|
||||
import { VoteThreshold } from '../elections';
|
||||
|
||||
/** Enum */
|
||||
export interface Conviction extends Enum {
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Compact, Enum, Option, Struct, Vec } from '../../codec';
|
||||
import { AccountId, Bytes, Null, i8, u32, u64 } from '../../primitive';
|
||||
import { Balance } from '../runtime/types';
|
||||
import { Balance } from '../runtime';
|
||||
|
||||
/** Struct */
|
||||
export interface AccountInfo extends Struct {
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Compact, Enum, Option, Struct, Vec } from '../../codec';
|
||||
import { u32 } from '../../primitive';
|
||||
import { Balance } from '../runtime/types';
|
||||
import { Balance } from '../runtime';
|
||||
|
||||
/** u32 */
|
||||
export type ApprovalFlag = u32;
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Codec } from '../../types';
|
||||
import { Compact, Enum, Option, Struct, Vec } from '../../codec';
|
||||
import { u64 } from '../../primitive';
|
||||
import { BlockNumber } from '../runtime/types';
|
||||
import { AuthorityId } from '../consensus/types';
|
||||
import { BlockNumber } from '../runtime';
|
||||
import { AuthorityId } from '../consensus';
|
||||
|
||||
/** u64 */
|
||||
export type AuthorityWeight = u64;
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Option, Struct, Vec } from '../../codec';
|
||||
import { Bytes } from '../../primitive';
|
||||
import { BlockNumber } from '../runtime/types';
|
||||
import { AuthorityId } from '../consensus/types';
|
||||
import { SessionIndex } from '../session/types';
|
||||
import { BlockNumber } from '../runtime';
|
||||
import { AuthorityId } from '../consensus';
|
||||
import { SessionIndex } from '../session';
|
||||
|
||||
/** Struct */
|
||||
export interface Heartbeat extends Struct {
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Codec } from '../../types';
|
||||
import { Compact, Enum, Option, Struct, Vec } from '../../codec';
|
||||
import { AccountId, Bytes, u32, u64 } from '../../primitive';
|
||||
import { BalanceOf, BlockNumber, Hash, Signature } from '../runtime/types';
|
||||
import { BalanceOf, BlockNumber, Hash, Signature } from '../runtime';
|
||||
|
||||
/** Struct */
|
||||
export interface AttestedCandidate extends Struct {
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
@@ -1,9 +1,9 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Codec } from '../../types';
|
||||
import { Enum, Option, Struct, Vec } from '../../codec';
|
||||
import { Block, Bytes, ConsensusEngineId, StorageKey, Text, bool, u32, u64, u8 } from '../../primitive';
|
||||
import { BlockNumber, Hash, Justification, Signature, StorageData } from '../runtime/types';
|
||||
import { BlockNumber, Hash, Justification, Signature, StorageData } from '../runtime';
|
||||
|
||||
/** Vec<u8> */
|
||||
export type ApiId = Vec<u8>;
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Codec } from '../../types';
|
||||
import { Compact, Option, Struct, Vec } from '../../codec';
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Compact, Option, Vec } from '../../codec';
|
||||
import { u32 } from '../../primitive';
|
||||
import { SessionKeys } from '../runtime/types';
|
||||
import { SessionKeys } from '../runtime';
|
||||
|
||||
/** SessionKeys */
|
||||
export type Keys = SessionKeys;
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Compact, Enum, Option, Struct, Vec } from '../../codec';
|
||||
import { AccountId, Moment, u32 } from '../../primitive';
|
||||
import { Balance, BlockNumber } from '../runtime/types';
|
||||
import { Balance, BlockNumber } from '../runtime';
|
||||
|
||||
/** u32 */
|
||||
export type EraIndex = u32;
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Compact, Enum, Option, Struct, Vec } from '../../codec';
|
||||
import { Bytes, Digest, Event, u32, u8 } from '../../primitive';
|
||||
import { Hash } from '../runtime/types';
|
||||
import { Hash } from '../runtime';
|
||||
|
||||
/** Digest */
|
||||
export type DigestOf = Digest;
|
||||
@@ -0,0 +1,3 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './types';
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
import { Option, Struct, Vec } from '../../codec';
|
||||
import { AccountId } from '../../primitive';
|
||||
import { Balance } from '../runtime/types';
|
||||
import { Balance } from '../runtime';
|
||||
|
||||
/** Struct */
|
||||
export interface TreasuryProposal extends Struct {
|
||||
@@ -1,4 +1,4 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
|
||||
export * from './runtime/types';
|
||||
export * from './consensus/types';
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Hash } from '../srml/runtime/types';
|
||||
import { Hash } from '../interfaces/runtime';
|
||||
import { AnyU8a } from '../types';
|
||||
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AuthorityId } from '../srml/consensus/types';
|
||||
import { Hash } from '../srml/runtime/types';
|
||||
import { Consensus, PreRuntime, Seal, SealV0 } from '../srml/rpc/types';
|
||||
import { AuthorityId } from '../interfaces/consensus';
|
||||
import { Hash } from '../interfaces/runtime';
|
||||
import { Consensus, PreRuntime, Seal, SealV0 } from '../interfaces/rpc';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { EventId } from '../srml/system/types';
|
||||
import { EventId } from '../interfaces/system';
|
||||
import { Constructor, Codec } from '../types';
|
||||
|
||||
import { assert, isUndefined, stringCamelCase, u8aToHex } from '@polkadot/util';
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Hash } from '../srml/runtime/types';
|
||||
import { Phase } from '../srml/system/types';
|
||||
import { Hash } from '../interfaces/runtime';
|
||||
import { Phase } from '../interfaces/system';
|
||||
|
||||
import { ClassOf } from '../codec/createType';
|
||||
import Struct from '../codec/Struct';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, Index } from '../../srml/runtime/types';
|
||||
import { Balance, Index } from '../../interfaces/runtime';
|
||||
import { AnyU8a, ArgsDef, Codec, ExtrinsicPayloadValue, IExtrinsic, IHash, IKeyringPair, SignatureOptions } from '../../types';
|
||||
|
||||
import { assert, isHex, isU8a, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, Hash, Index } from '../../srml/runtime/types';
|
||||
import { Balance, Hash, Index } from '../../interfaces/runtime';
|
||||
import { IKeyringPair } from '../../types';
|
||||
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, Index, Signature } from '../../../srml/runtime/types';
|
||||
import { Balance, Index, Signature } from '../../../interfaces/runtime';
|
||||
import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, SignatureOptions } from '../../../types';
|
||||
|
||||
import createType, { ClassOf } from '../../../codec/createType';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Hash, Index } from '../../../srml/runtime/types';
|
||||
import { Hash, Index } from '../../../interfaces/runtime';
|
||||
import { AnyNumber, AnyU8a, ExtrinsicPayloadValue, IExtrinsicEra, IKeyringPair, IMethod } from '../../../types';
|
||||
|
||||
import { ClassOf } from '../../../codec/createType';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, Index } from '../../../srml/runtime/types';
|
||||
import { Balance, Index } from '../../../interfaces/runtime';
|
||||
import { AnyNumber } from '../../../types';
|
||||
|
||||
import { ClassOf } from '../../../codec/createType';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, Index, Signature } from '../../../srml/runtime/types';
|
||||
import { Balance, Index, Signature } from '../../../interfaces/runtime';
|
||||
import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, SignatureOptions } from '../../../types';
|
||||
|
||||
import createType, { ClassOf } from '../../../codec/createType';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, Hash, Index } from '../../../srml/runtime/types';
|
||||
import { Balance, Hash, Index } from '../../../interfaces/runtime';
|
||||
import { AnyNumber, AnyU8a, ExtrinsicPayloadValue, IExtrinsicEra, IKeyringPair, IMethod } from '../../../types';
|
||||
|
||||
import { ClassOf } from '../../../codec/createType';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { BlockNumber, Hash } from '../srml/runtime/types';
|
||||
import { BlockNumber, Hash } from '../interfaces/runtime';
|
||||
import { AnyNumber, AnyU8a } from '../types';
|
||||
|
||||
import { ClassOf } from '../codec/createType';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Conviction } from '../srml/democracy/types';
|
||||
import { Conviction } from '../interfaces/democracy';
|
||||
|
||||
import { isBoolean, isNumber, isObject, isU8a, isUndefined } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { getTypeDef, TypeDef, TypeDefInfo, TypeDefExtVecFixed } from '../codec/c
|
||||
import * as codecClasses from '../codec';
|
||||
import { COMPACT_ENCODABLE } from '../codec/Compact';
|
||||
import * as primitiveClasses from '../primitive';
|
||||
import * as definitions from '../srml/definitions';
|
||||
import * as definitions from '../interfaces/definitions';
|
||||
import { Constructor } from '../types';
|
||||
|
||||
// these map all the codec and primitive types for import, see the TypeImports below. If
|
||||
@@ -27,7 +27,7 @@ interface TypeImports {
|
||||
primitiveTypes: TypeExist;
|
||||
}
|
||||
|
||||
const HEADER = '// Auto-generated via `yarn build:srmlTs`, do not edit\n\n';
|
||||
const HEADER = '// Auto-generated via `yarn build:interfaces`, do not edit\n\n';
|
||||
const FOOTER = '\n';
|
||||
|
||||
// Maps the types as found to the source location. This is used to generate the
|
||||
@@ -49,7 +49,7 @@ function setImports ({ codecTypes, localTypes, ownTypes, primitiveTypes }: TypeI
|
||||
if (moduleName) {
|
||||
localTypes[moduleName][type] = true;
|
||||
|
||||
console.log(`\tImporting ${type} from ../'${moduleName}/types'`);
|
||||
console.log(`\tImporting ${type} from ../${moduleName}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -278,7 +278,7 @@ ${Object.keys(types).map((type): string => getDerivedTypes(type, types[type], im
|
||||
}`;
|
||||
}
|
||||
|
||||
function generateTsDef (srmlName: string, { types }: { types: Record<string, any> }): void {
|
||||
function generateTsDef (defName: string, { types }: { types: Record<string, any> }): void {
|
||||
// handlers are defined externally to use - this means that when we do a
|
||||
// `generators[typedef.info](...)` TS will show any unhandled types. Rather
|
||||
// we are being explicit in having no handlers where we do not support (yet)
|
||||
@@ -327,23 +327,25 @@ function generateTsDef (srmlName: string, { types }: { types: Record<string, any
|
||||
types: Object.keys(primitiveTypes)
|
||||
},
|
||||
...Object.keys(localTypes).map((moduleName): { file: string; types: string[] } => ({
|
||||
file: `../${moduleName}/types`,
|
||||
file: `../${moduleName}`,
|
||||
types: Object.keys(localTypes[moduleName])
|
||||
}))
|
||||
]);
|
||||
|
||||
fs.writeFileSync(`packages/types/src/srml/${srmlName}/types.ts`, header.concat(sortedDefs).concat(interfaceReg).concat(FOOTER), { flag: 'w' });
|
||||
fs.writeFileSync(`packages/types/src/interfaces/${defName}/types.ts`, header.concat(sortedDefs).concat(interfaceReg).concat(FOOTER), { flag: 'w' });
|
||||
fs.writeFileSync(`packages/types/src/interfaces/${defName}/index.ts`, HEADER.concat(`export * from './types';`).concat(FOOTER), { flag: 'w' });
|
||||
}
|
||||
|
||||
Object.entries(definitions).forEach(([srmlName, obj]): void => {
|
||||
console.log(`Extracting definitions for ${srmlName}`);
|
||||
Object.entries(definitions).forEach(([defName, obj]): void => {
|
||||
console.log(`Extracting interfaces for ${defName}`);
|
||||
|
||||
generateTsDef(srmlName, obj);
|
||||
generateTsDef(defName, obj);
|
||||
});
|
||||
|
||||
console.log(`Writing srml/types.ts`);
|
||||
console.log(`Writing interfaces/types.ts`);
|
||||
|
||||
fs.writeFileSync(`packages/types/src/srml/types.ts`, HEADER.concat(Object.keys(definitions).map((moduleName): string => `export * from './${moduleName}/types';`).join('\n')).concat(FOOTER), { flag: 'w' });
|
||||
fs.writeFileSync(`packages/types/src/interfaces/types.ts`, HEADER.concat(Object.keys(definitions).map((moduleName): string => `export * from './${moduleName}/types';`).join('\n')).concat(FOOTER), { flag: 'w' });
|
||||
fs.writeFileSync(`packages/types/src/interfaces/index.ts`, HEADER.concat(`export * from './types';`).concat(FOOTER), { flag: 'w' });
|
||||
|
||||
function generateInterfaceRegistry (): void {
|
||||
const codecTypes: TypeExist = {};
|
||||
+1
-1
@@ -7,4 +7,4 @@ require('@babel/register')({
|
||||
extensions: ['.js', '.ts']
|
||||
});
|
||||
|
||||
require('./srmlTS.ts');
|
||||
require('./interfacesTs.ts');
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, Index } from './srml/runtime/types';
|
||||
import { Balance, Index } from './interfaces/runtime';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user