Add chain type overrides (#150)

This commit is contained in:
Jaco Greeff
2019-09-14 10:16:56 +02:00
committed by GitHub
parent 9825f298e0
commit 8aba99fc9c
5 changed files with 28 additions and 13 deletions
File diff suppressed because one or more lines are too long
+9 -5
View File
@@ -8,11 +8,11 @@ import { Chain } from './types';
// imports chain details, generally metadata. For the generation of these,
// inside the api, run `yarn chain:info [--ws <url>]`
import alexander from './alexander';
import kusama from './kusama';
import kusamaCC1 from './kusama-cc1';
const chains: Map<string, Chain> = new Map(
[alexander, kusama].map(
({ chain, genesisHash, metaCalls, ss58Format, tokenDecimals, tokenSymbol }): [string, Chain] => [
[alexander, kusamaCC1].map(
({ chain, genesisHash, metaCalls, specVersion, ss58Format, tokenDecimals, tokenSymbol, types }): [string, Chain] => [
genesisHash,
{
genesisHash,
@@ -20,9 +20,11 @@ const chains: Map<string, Chain> = new Map(
? new Metadata(Buffer.from(metaCalls, 'base64'))
: undefined,
name: chain,
specVersion,
ss58Format,
tokenDecimals,
tokenSymbol
tokenSymbol,
types: types || {}
}
]
)
@@ -30,9 +32,11 @@ const chains: Map<string, Chain> = new Map(
const UNKNOWN_CHAIN: Chain = {
name: 'Any',
specVersion: 0,
ss58Format: 42,
tokenDecimals: 0,
tokenSymbol: 'UNIT'
tokenSymbol: 'UNIT',
types: {}
};
export default function findChain (genesisHash?: string | null): Chain {
File diff suppressed because one or more lines are too long
+3
View File
@@ -8,7 +8,10 @@ export interface Chain {
name: string;
genesisHash?: string;
meta?: Metadata;
specVersion: number;
ss58Format: number;
tokenDecimals: number;
tokenSymbol: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
types: Record<string, any>;
}