Update api.derive to use api.queryMulti (#911)

* session api.queryMulti

* Make a single subscription to retrieve all session info

* Adjustments

* WIP

* Seems mostly comprehensive, need to full test e2e

* e2e tests for operations

* Allow "create from empty"

* skip

* Remove comment

* Remove ancient ?'s

* Update types.ts
This commit is contained in:
Jaco Greeff
2019-05-16 11:36:41 +02:00
committed by GitHub
parent bafda6dc93
commit 2dfc55cb5c
16 changed files with 237 additions and 132 deletions
@@ -47,4 +47,27 @@ describe.skip('derive e2e', () => {
done();
});
});
it('retrieves all session info', (done) => {
let count = 0;
return api.derive.session.info((info) => {
console.error(JSON.stringify(info));
// 5 blocks only, then go our merry way
if (++count === 5) {
done();
}
});
});
it('retrieves the balances', (done) => {
return api.derive.balances.all('5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y', (balance) => {
console.error(JSON.stringify(balance));
if (balance.freeBalance.gtn(1)) {
done();
}
});
});
});
-1
View File
@@ -31,7 +31,6 @@ describe.skip('derive e2e', () => {
// These derive.accounts tests only work on localhost, not the poc-3 URL
// (and it is assuming it sent at least 1 tx)
describe('derive.accounts', () => {
describe('idAndIndex', () => {
it('looks up AccountId & AccountIndex from AccountId', async (done) => {
// @ts-ignore silence warning until we have static types here