Skip to content

Commit 9a8b921

Browse files
author
Grégory Saive
authored
Merge branch 'master' into iss22
2 parents 03612c0 + 894f8c5 commit 9a8b921

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1023
-499
lines changed

.travis.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,17 @@ cache:
88
- "node_modules"
99
before_script:
1010
- npm run build
11-
script: npm run test:coveralls
11+
script:
12+
- npm run test:coveralls
13+
before_deploy:
14+
- npm install --global typedoc
15+
- typedoc --out ts-docs src
16+
deploy:
17+
provider: pages
18+
skip_cleanup: true
19+
keep-history: true
20+
local_dir: ts-docs
21+
github_token: $GITHUB_TOKEN
22+
on:
23+
branch: master
24+

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ with the NEM2 (a.k.a Catapult)
1414

1515
- NodeJS 8.9.X
1616
- NodeJS 9.X.X
17+
- NodeJS 10.X.X
18+
19+
## Installation
20+
21+
```npm install nem2-sdk rxjs```
1722

1823
## Documentation and Getting Started
1924

@@ -46,4 +51,4 @@ Licensed under the [Apache License 2.0](LICENSE)
4651
[self]: https://github.com/nemtech/nem2-sdk-typescript-javascript
4752
[docs]: http://nemtech.github.io/getting-started/setup-workstation.html
4853
[issues]: https://github.com/nemtech/nem2-sdk-typescript-javascript/issues
49-
[sdk-ref]: http://nemtech.github.io/nem2-sdk-typescript-javascript
54+
[sdk-ref]: http://nemtech.github.io/nem2-sdk-typescript-javascript

e2e/infrastructure/Listener.spec.ts

Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import {AccountHttp} from '../../src/infrastructure/AccountHttp';
17-
import {Listener} from '../../src/infrastructure/Listener';
18-
import {Address} from '../../src/model/account/Address';
16+
import { AccountHttp } from '../../src/infrastructure/AccountHttp';
17+
import { Listener } from '../../src/infrastructure/Listener';
18+
import { Address } from '../../src/model/account/Address';
1919
import * as conf from '../conf/conf.spec';
2020
import {
2121
APIUrl, Cosignatory2Account, Cosignatory3Account, CosignatoryAccount, MultisigAccount,
2222
TestingAccount,
2323
} from '../conf/conf.spec';
24-
import {TransactionUtils} from './TransactionUtils';
24+
import { TransactionUtils } from './TransactionUtils';
2525

2626
describe('Listener', () => {
2727
let account;
@@ -40,64 +40,78 @@ describe('Listener', () => {
4040
});
4141

4242
it('newBlock', (done) => {
43-
listener.newBlock().subscribe((res) => {
44-
done();
45-
});
43+
listener.newBlock()
44+
.toPromise()
45+
.then((res) => {
46+
done();
47+
});
4648

4749
TransactionUtils.createAndAnnounce();
4850
});
4951

5052
it('confirmedTransactionsGiven address signer', (done) => {
51-
listener.confirmed(account.address).subscribe((res) => {
52-
done();
53-
});
53+
listener.confirmed(account.address)
54+
.toPromise()
55+
.then((res) => {
56+
done();
57+
});
5458

5559
TransactionUtils.createAndAnnounce();
5660
});
5761

5862
it('confirmedTransactionsGiven address recipient', (done) => {
5963
const recipientAddress = Address.createFromRawAddress('SBILTA367K2LX2FEXG5TFWAS7GEFYAGY7QLFBYKC');
60-
listener.confirmed(recipientAddress).subscribe((res) => {
61-
done();
62-
});
64+
listener.confirmed(recipientAddress)
65+
.toPromise()
66+
.then((res) => {
67+
done();
68+
});
6369

6470
TransactionUtils.createAndAnnounce();
6571
});
6672

6773
it('unconfirmedTransactionsAdded', (done) => {
68-
listener.unconfirmedAdded(account.address).subscribe((res) => {
69-
done();
70-
});
74+
listener.unconfirmedAdded(account.address)
75+
.toPromise()
76+
.then((res) => {
77+
done();
78+
});
7179

7280
setTimeout(() => {
7381
TransactionUtils.createAndAnnounce();
7482
}, 1000);
7583
});
7684

7785
it('unconfirmedTransactionsRemoved', (done) => {
78-
listener.unconfirmedRemoved(account.address).subscribe((res) => {
79-
done();
80-
});
86+
listener.unconfirmedRemoved(account.address)
87+
.toPromise()
88+
.then((res) => {
89+
done();
90+
});
8191

8292
setTimeout(() => {
8393
TransactionUtils.createAndAnnounce();
8494
}, 1000);
8595
});
8696

8797
it('aggregateBondedTransactionsAdded', (done) => {
88-
listener.aggregateBondedAdded(multisigAccount.address).subscribe((res) => {
89-
done();
90-
});
98+
listener.aggregateBondedAdded(multisigAccount.address)
99+
.toPromise()
100+
.then((res) => {
101+
done();
102+
});
91103

92104
setTimeout(() => {
93105
TransactionUtils.createAggregateBoundedTransactionAndAnnounce();
94106
}, 1000);
95107
});
96108

97109
it('aggregateBondedTransactionsRemoved', (done) => {
98-
listener.aggregateBondedRemoved(multisigAccount.address).subscribe((res) => {
99-
done();
100-
});
110+
listener.aggregateBondedRemoved(multisigAccount.address)
111+
.toPromise()
112+
.then((res) => {
113+
done();
114+
});
101115

102116
setTimeout(() => {
103117
TransactionUtils.createAggregateBoundedTransactionAndAnnounce();
@@ -112,9 +126,11 @@ describe('Listener', () => {
112126
});
113127

114128
it('cosignatureAdded', (done) => {
115-
listener.cosignatureAdded(multisigAccount.address).subscribe((res) => {
116-
done();
117-
});
129+
listener.cosignatureAdded(multisigAccount.address)
130+
.toPromise()
131+
.then((res) => {
132+
done();
133+
});
118134

119135
setTimeout(() => {
120136
TransactionUtils.createAggregateBoundedTransactionAndAnnounce();
@@ -128,9 +144,11 @@ describe('Listener', () => {
128144
});
129145

130146
it('transactionStatusGiven', (done) => {
131-
listener.status(account.address).subscribe((res) => {
132-
done();
133-
});
147+
listener.status(account.address)
148+
.toPromise()
149+
.then((res) => {
150+
done();
151+
});
134152

135153
setTimeout(() => {
136154
TransactionUtils.createAndAnnounceWithInsufficientBalance();

e2e/infrastructure/TransactionUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class TransactionUtils {
6464
NetworkType.MIJIN_TEST,
6565
);
6666

67-
const aggregateTransaction = AggregateTransaction.createComplete(
67+
const aggregateTransaction = AggregateTransaction.createBonded(
6868
Deadline.create(2, ChronoUnit.MINUTES),
6969
[transferTransaction.toAggregate(MultisigAccount.publicAccount)],
7070
NetworkType.MIJIN_TEST,

e2e/service/MosaicService.spec.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import 'rxjs/add/operator/toPromise';
2-
import {AccountHttp} from '../../src/infrastructure/AccountHttp';
3-
import {MosaicHttp} from '../../src/infrastructure/MosaicHttp';
4-
import {NamespaceHttp} from '../../src/infrastructure/NamespaceHttp';
5-
import {Address} from '../../src/model/account/Address';
6-
import {MosaicService} from '../../src/service/MosaicService';
7-
import {APIUrl} from '../conf/conf.spec';
1+
import { map, mergeMap, toArray } from 'rxjs/operators';
2+
import { AccountHttp } from '../../src/infrastructure/AccountHttp';
3+
import { MosaicHttp } from '../../src/infrastructure/MosaicHttp';
4+
import { NamespaceHttp } from '../../src/infrastructure/NamespaceHttp';
5+
import { Address } from '../../src/model/account/Address';
6+
import { MosaicService } from '../../src/service/MosaicService';
7+
import { APIUrl } from '../conf/conf.spec';
88

99
describe('MosaicService', () => {
1010

@@ -17,10 +17,10 @@ describe('MosaicService', () => {
1717

1818
const address = Address.createFromRawAddress('SCO2JY-N6OJSM-CJPPVS-Z3OX7P-TWPQEJ-GZTI6W-GLKK');
1919

20-
return mosaicService.mosaicsAmountViewFromAddress(address)
21-
.flatMap((_) => _)
22-
.map((mosaic) => console.log('You have', mosaic.relativeAmount(), mosaic.fullName()))
23-
.toArray()
24-
.toPromise();
20+
return mosaicService.mosaicsAmountViewFromAddress(address).pipe(
21+
mergeMap((_) => _),
22+
map((mosaic) => console.log('You have', mosaic.relativeAmount(), mosaic.fullName())),
23+
toArray(),
24+
).toPromise();
2525
});
2626
});

0 commit comments

Comments
 (0)