Update from new @polkadot/params (#95)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-provider",
|
||||
"version": "0.12.15",
|
||||
"version": "0.13.0",
|
||||
"description": "Transport providers for the API",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -35,7 +35,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0-beta.47",
|
||||
"@polkadot/storage-substrate": "^0.16.15",
|
||||
"@polkadot/storage": "^0.17.2",
|
||||
"@polkadot/util": "^0.22.2",
|
||||
"@polkadot/util-crypto": "^0.22.2",
|
||||
"@polkadot/util-keyring": "^0.22.2",
|
||||
|
||||
@@ -13,7 +13,7 @@ import type { MockState, MockState$Subscription$Callback } from './types';
|
||||
const BN = require('bn.js');
|
||||
const headerEncode = require('@polkadot/primitives-json/header/encode');
|
||||
const createKey = require('@polkadot/storage/key');
|
||||
const state = require('@polkadot/storage-substrate/keys');
|
||||
const state = require('@polkadot/storage');
|
||||
const bnToU8a = require('@polkadot/util/bn/toU8a');
|
||||
const u8aToHex = require('@polkadot/util/u8a/toHex');
|
||||
const randomAsU8a = require('@polkadot/util-crypto/random/asU8a');
|
||||
@@ -76,11 +76,11 @@ module.exports = function mocks ({ emitter, storage, subscriptions }: MockState)
|
||||
newHead = makeBlockHeader(newHead.number);
|
||||
|
||||
keyring.getPairs().forEach(({ publicKey }: KeyringPair, index: number) => {
|
||||
setStorageBn(storage, state.staking.keys.freeBalanceOf, newHead.number.muln(3).iaddn(index), publicKey());
|
||||
setStorageBn(storage, state.system.keys.accountIndexOf, newHead.number.addn(index), publicKey());
|
||||
setStorageBn(storage, state.staking.public.freeBalanceOf, newHead.number.muln(3).iaddn(index), publicKey());
|
||||
setStorageBn(storage, state.system.public.accountIndexOf, newHead.number.addn(index), publicKey());
|
||||
});
|
||||
|
||||
setStorageBn(storage, state.timestamp.keys.current, Math.floor(Date.now() / 1000));
|
||||
setStorageBn(storage, state.timestamp.public.current, Math.floor(Date.now() / 1000));
|
||||
|
||||
updateSubs(subscriptions, 'subscribe_newHead', headerEncode(newHead));
|
||||
}, 5000);
|
||||
|
||||
@@ -13,8 +13,8 @@ const l = require('@polkadot/util/logger')('api-mock');
|
||||
const SUBSCRIPTIONS = Array.prototype.concat.apply(
|
||||
[], Object.keys(interfaces).map((section) => {
|
||||
return Object
|
||||
.keys(interfaces[section].methods)
|
||||
.filter((method) => interfaces[section].methods[method].isSubscription)
|
||||
.keys(interfaces[section].public)
|
||||
.filter((method) => interfaces[section].public[method].isSubscription)
|
||||
.map((method) => `subscribe_${method}`);
|
||||
})
|
||||
);
|
||||
@@ -25,7 +25,10 @@ const REQUESTS = {
|
||||
// flowlint-next-line unclear-type:off
|
||||
storage[((params[0]: any): string)]
|
||||
);
|
||||
}
|
||||
},
|
||||
'system_chain': (): string => 'mockChain',
|
||||
'system_name': (): string => 'mockClient',
|
||||
'system_version': (): string => '9.8.7'
|
||||
};
|
||||
|
||||
module.exports = function state (): MockState {
|
||||
|
||||
Reference in New Issue
Block a user