Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
351 changed files
with
3,524 additions
and
3,927 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./babel.config.js'); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,5 @@ | |
"packages": [ | ||
"packages/*" | ||
], | ||
"version": "0.11.8" | ||
"version": "0.12.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2017-2018 @polkadot/client-chains authors & contributors | ||
// This software may be modified and distributed under the terms | ||
// of the ISC license. See the LICENSE file for details. | ||
|
||
import { ChainGenesisState } from '../types'; | ||
|
||
const dev = (require('./chain-dev.json') as ChainGenesisState); | ||
|
||
export default ({ | ||
dev | ||
} as { [index: string]: ChainGenesisState }); |
5 changes: 2 additions & 3 deletions
5
packages/client-chains/src/defaults.js → packages/client-chains/src/defaults.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
// Copyright 2017-2018 @polkadot/client-chains authors & contributors | ||
// This software may be modified and distributed under the terms | ||
// of the ISC license. See the LICENSE file for details. | ||
// @flow | ||
|
||
import type { ChainName } from './types'; | ||
import { ChainName } from './types'; | ||
|
||
const MAIN: ChainName = 'dev'; | ||
const TEST: ChainName = 'dev'; | ||
|
||
module.exports = { | ||
export default { | ||
MAIN, | ||
TEST | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
packages/client-chains/src/genesis/state.js → packages/client-chains/src/genesis/state.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
// Copyright 2017-2018 @polkadot/client-chains authors & contributors | ||
// This software may be modified and distributed under the terms | ||
// of the ISC license. See the LICENSE file for details. | ||
// @flow | ||
|
||
import type { ChainState, ChainGenesisState } from '../types'; | ||
import { ChainState, ChainGenesisState } from '../types'; | ||
|
||
const hexToU8a = require('@polkadot/util/hex/toU8a'); | ||
import hexToU8a from '@polkadot/util/hex/toU8a'; | ||
|
||
module.exports = function genesisState ({ stateDb: { db } }: ChainState, initial: ChainGenesisState): void { | ||
export default function genesisState ({ stateDb: { db } }: ChainState, initial: ChainGenesisState): void { | ||
Object.keys(initial).forEach((key) => | ||
db.set(hexToU8a(key), hexToU8a(initial[key])) | ||
); | ||
|
||
db.commit(); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 6 additions & 8 deletions
14
packages/client-chains/src/load.js → packages/client-chains/src/load.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
// Copyright 2017-2018 @polkadot/client-chains authors & contributors | ||
// This software may be modified and distributed under the terms | ||
// of the ISC license. See the LICENSE file for details. | ||
// @flow | ||
|
||
import type { ChainGenesisState, ChainName } from './types'; | ||
import { ChainGenesisState } from './types'; | ||
|
||
const assert = require('@polkadot/util/assert'); | ||
import assert from '@polkadot/util/assert'; | ||
|
||
const chains = require('./chains'); | ||
import chains from './chains'; | ||
|
||
// TODO We should load chains from json files as well | ||
|
||
module.exports = function load (name: string): ChainGenesisState { | ||
// flowlint-next-line unclear-type:off | ||
const chain = chains[((name: any): ChainName)]; | ||
export default function load (name: string): ChainGenesisState { | ||
const chain = chains[name]; | ||
|
||
assert(chain, `Unable to find builtin chain '${name}'`); | ||
|
||
return chain; | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2017-2018 @polkadot/client-chains authors & contributors | ||
// This software may be modified and distributed under the terms | ||
// of the ISC license. See the LICENSE file for details. | ||
|
||
import { Config } from '@polkadot/client/types'; | ||
import { TrieDb } from '@polkadot/util-triedb/types'; | ||
import { ChainState } from './types'; | ||
|
||
import createBlockDb from '@polkadot/client-db-chain/block'; | ||
import createStateDb from '@polkadot/client-db-chain/state'; | ||
import createRuntime from '@polkadot/client-runtime/index'; | ||
import logger from '@polkadot/util/logger'; | ||
|
||
export default function state (config: Config, baseStateDb: TrieDb, baseBlockDb: TrieDb): ChainState { | ||
const l = logger(`chain-${config.chain}`); | ||
const runtime = createRuntime(baseStateDb); | ||
const blockDb = createBlockDb(baseBlockDb); | ||
const stateDb = createStateDb(runtime.environment.db); | ||
|
||
return { | ||
blockDb, | ||
config, | ||
l, | ||
runtime, | ||
stateDb | ||
}; | ||
} |
Oops, something went wrong.