* fix: Remove docs/api since replaced with docs/rpc-core * fix: Remove docs/api-provider since replaced with docs/rpc-provider * fix: Remove docs/api-rx since replaced with docs/rpc-rx * fix: Remove the guide file that serves no purpose * fix: Change license from ui-observable to api-observable * fix: Remove disused mockHttp and mockWs that are duplicates of those in rpc-provider * fix: Clarifies difference between PropIndex and ProposalIndex from Issue #226 * fix: Update api-observable Readme to refer to rpc-core, previously called api * misc: Update Readme of rpc-core. See commit message details. * Update name to be @polkadot/rpc-core instead of @polkadot/api * Use Yarn instead of NPM for instructions adding dependencies * Refer to @polkadot/rpc-core as `Rpc` * Highlight that given block header hash should be a 0x-prefixed hex string with length of 64 (not only length of 10 as shown in the example) * Showcase more information that you can obtain from the header object (i.e. best block number, parentHash, stateRoot, extrinsicsRoot, and digest) * Use `header.raw` instead of just `header` to access properties of the header object * Update the example to console.log the subscription ID * Add missing semicolon * fix: Fix name in license header and rename Api to Rpc for rpc-core e2e tests * fix: Update rpc-provider Readme to use Yarn instead of NPM install * fix: Fix minor typo * fix: Rename Api to Rpc for rpc-provider ws * fix: Refer to rpc-core instead of api in the rpc-rx Readme * fix: Update rpc-rx files to refer to it as RpcRx instead of RxApi or just Api * fix: Refer to rpc-core as Rpc instead of Api * fix: Update type-jsonrpc Readme. Fix typo. Use Yarn not NPM. Refer to TSLint not Flow * refactor: Move non-type dependency import with non-type dependencies * docs: Add link to parity-codec repo * fix: Avoid use of .raw. Fix listen to blocks example * fix: Add missing error to newHead in listen to blocks example
68 lines
1.8 KiB
JavaScript
68 lines
1.8 KiB
JavaScript
// Copyright 2017-2018 @polkadot/rpc-core authors & contributors
|
|
// This software may be modified and distributed under the terms
|
|
// of the ISC license. See the LICENSE file for details.
|
|
|
|
import storage from '@polkadot/storage';
|
|
import Ws from '@polkadot/rpc-provider/ws';
|
|
|
|
import Rpc from '../../src';
|
|
|
|
describe.skip('e2e krumme lanke', () => {
|
|
let api;
|
|
|
|
beforeEach(() => {
|
|
jest.setTimeout(30000);
|
|
api = new Rpc(new Ws('ws://127.0.0.1:9944'));
|
|
});
|
|
|
|
it('subscribes to storage', (done) => {
|
|
api.state
|
|
.subscribeStorage(
|
|
[
|
|
[storage.system.accountNonce, '5Ejbye9R8ygByQPrDSasaUid1munedPZUmg4f118HGmtodGp'],
|
|
[storage.balances.freeBalance, '5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFacT7']
|
|
],
|
|
(error, data) => {
|
|
if (error) {
|
|
return done(error);
|
|
}
|
|
|
|
expect(data).toHaveLength(2);
|
|
expect(data[0].toNumber()).toEqual(0);
|
|
expect(data[1].toNumber()).not.toEqual(0);
|
|
|
|
done();
|
|
}
|
|
)
|
|
.then((subscriptionId) => {
|
|
console.log('newHead: subscriptionId =', subscriptionId);
|
|
});
|
|
});
|
|
|
|
it('retrieves a block by hash (krumme lanke #1)', () => {
|
|
return api.chain
|
|
.getBlock('0x627847bffdf5f3e01ac440d057dec6a37a12a6f329db7ef8367665574b76b5df')
|
|
.then((block) => {
|
|
expect(block).toBeDefined();
|
|
})
|
|
.catch((error) => {
|
|
console.error(error);
|
|
|
|
throw error;
|
|
});
|
|
});
|
|
|
|
it('retrieves a block by hash (krumme lanke #2)', () => {
|
|
return api.chain
|
|
.getBlock('0x53416d53a4b1dfcae9165a89d193608e4aa770414f02267f5b2c4015a2e66091')
|
|
.then((block) => {
|
|
expect(block).toBeDefined();
|
|
})
|
|
.catch((error) => {
|
|
console.error(error);
|
|
|
|
throw error;
|
|
});
|
|
});
|
|
});
|