Revert "Bubble isSubscription from rpc-rx (#627)" (#631)

This reverts commit 767a1978d0.
This commit is contained in:
Jaco Greeff
2019-01-23 23:31:21 +01:00
committed by GitHub
parent 4ca14eb831
commit ee21272bbc
7 changed files with 22 additions and 37 deletions
+3 -6
View File
@@ -14,10 +14,7 @@ import { isFunction } from '@polkadot/util';
import ApiBase from '../Base';
import Combinator, { CombinatorCallback, CombinatorFunction } from './Combinator';
interface RxFn {
(...params: Array<any>): Observable<Codec | undefined | null>;
isSubscription: boolean;
}
type RxFn = (...params: Array<any>) => Observable<Codec | undefined | null>;
/**
* # @polkadot/api/promise
@@ -196,8 +193,8 @@ export default class ApiPromise extends ApiBase<OnCall> implements ApiPromiseInt
};
}
protected onCall (method: RxFn, params: Array<any>, isSubscription: boolean = false): OnCall {
if (!params || params.length === 0 || !isSubscription) {
protected onCall (method: RxFn, params: Array<any>, isSubscription?: boolean): OnCall {
if (!params || params.length === 0 || isSubscription === false) {
return method(...params).pipe(first()).toPromise();
}
@@ -1,7 +1,6 @@
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// @ts-check
import BN from 'bn.js';
import testingPairs from '@polkadot/keyring/testingPairs';
+4 -4
View File
@@ -1,7 +1,6 @@
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// @ts-check
import testingPairs from '@polkadot/keyring/testingPairs';
@@ -47,7 +46,7 @@ describe.skip('e2e transactions', () => {
});
it('makes a transfer (signAndSend)', async (done) => {
const unsubscribe = await api.tx.balances
api.tx.balances
.transfer('12ghjsRJpeJpUQaCQeHcBv9pRQA3tdcMxeL8cVk9JHWJGHjd', 12345)
.signAndSend(keyring.dave, ({ events, status, type }) => {
console.log('Transaction status:', type);
@@ -60,8 +59,9 @@ describe.skip('e2e transactions', () => {
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
});
unsubscribe();
done();
if (events.length) {
done();
}
}
});
});
-1
View File
@@ -1,7 +1,6 @@
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// @ts-check
import { switchMap } from 'rxjs/operators';
import testingPairs from '@polkadot/keyring/testingPairs';
-1
View File
@@ -1,7 +1,6 @@
// Copyright 2017-2019 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// @ts-check
import { first, switchMap } from 'rxjs/operators';
import testingPairs from '@polkadot/keyring/testingPairs';