Rewrite type-storage (#164)

* Only modify type-storage folder to avoid conflicts

* Use new syntax

* Export default

* Add legacy code

* Skip outdates tests

* Use fromJSON for metadata

* Add comment to move function to repo

* Add whitespace

* Add type

* Use original files

* Fix bug test

* Simplify code

* Fix bug initializing well known keys

* Rename well known keys to substrate

* Linting

* Linting
This commit is contained in:
Amaury Martiny
2018-09-27 12:25:58 +02:00
committed by Jaco Greeff
parent b5a36c4eaa
commit cbd3246c26
24 changed files with 302 additions and 1209 deletions
+5 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
// FIME: This file is way too long and way too messy
// FIXME: This file is way too long and way too messy
import { Storages } from '@polkadot/storage/types';
import { SectionItem } from '@polkadot/params/types';
@@ -20,6 +20,7 @@ import randomAsU8a from '@polkadot/util-crypto/random/asU8a';
import testKeyring from '@polkadot/util-keyring/testing';
const keyring = testKeyring();
// FIXME No more .public
const stateStaking = state.staking.public;
const stateSystem = state.staking.public;
const stateTimestamp = state.timestamp.public;
@@ -78,10 +79,13 @@ export default function mocks ({ emitter, storage, subscriptions }: MockState):
newHead = makeBlockHeader(newHead.number);
keyring.getPairs().forEach(({ publicKey }: KeyringPair, index: number) => {
// @ts-ignore FIXME This does not exist anymore
setStorageBn(storage, stateStaking.freeBalanceOf, newHead.number.muln(3).iaddn(index), publicKey());
// @ts-ignore FIXME This does not exist anymore
setStorageBn(storage, stateSystem.accountIndexOf, newHead.number.addn(index), publicKey());
});
// @ts-ignore FIXME This does not exist anymore
setStorageBn(storage, stateTimestamp.current, Math.floor(Date.now() / 1000));
updateSubs(subscriptions, 'chain_newHead', headerEncode(newHead));