Skip to content

Commit d88ee5b

Browse files
author
Grégory Saive
authored
Merge branch 'master' into task/g41-add-alias-for-HashLockTransaction
2 parents f06e473 + 717efcb commit d88ee5b

File tree

76 files changed

+1867
-560
lines changed

Some content is hidden

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

76 files changed

+1867
-560
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ script:
1313
before_deploy:
1414
- npm install --global typedoc
1515
- typedoc --out ts-docs src
16+
- touch ./ts-docs/.nojekyll
1617
deploy:
1718
provider: pages
1819
skip_cleanup: true
19-
keep-history: true
2020
local_dir: ts-docs
2121
github_token: $GITHUB_TOKEN
2222
on:
2323
branch: master
24-
24+

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,32 @@
11
# CHANGELOG
22

3+
# v0.10.3
4+
5+
- Fixed NetworkCurrencyMosaic, NetworkHarvestMosaic
6+
- Added exposed UInt64.fromHex and UInt64.toHex
7+
- Added MosaicId.createFromNonce
8+
- Added MosaicNonce, MosaicNonce.createRandom
9+
- Fixed AliasDTO.mosaicId to be UInt64
10+
- Added nem2-library@v0.9.8 version update (cow compatibility)
11+
12+
# v0.10.2
13+
14+
- Added cow network update *base* compatibility
15+
- Added AliasTransaction, AddressAliasTransaction, MosaicAliasTransaction
16+
- Changed MosaicDefinition to hold MosaicNonce
17+
- Changed SecretLock transaction to work with Sha3_256 instead of Sha3_512
18+
19+
# v0.10.1-beta
20+
21+
- added replyGiven in Transaction model
22+
- several linter fixes
23+
24+
# v0.10.0-beta
25+
26+
- update rxjs to v6
27+
- use observableFrom
28+
29+
# v0.9.5
30+
31+
- data signatures
32+
- nodejs version 10 updates

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
The official nem2-sdk for TypeScript and JavaScript, available for browsers, mobile applications and NodeJS, to work
99
with the NEM2 (a.k.a Catapult)
1010

11+
## Important Notes
12+
13+
Due to a network upgrade with [catapult-server@cow](https://github.com/nemtech/catapult-server/releases/tag/v0.3.0.1) version, **transactions from Alpaca&Bison are not compatible anymore**.
14+
15+
The upgrade to this SDK's [version v0.10.2](https://github.com/nemtech/nem2-sdk-typescript-javascript/releases/tag/v0.10.2) is mandatory for **cow compatibility**.
16+
17+
Other versions like [version v0.10.1-beta](https://github.com/nemtech/nem2-sdk-typescript-javascript/releases/tag/v0.10.1-beta) can be used for **bison** network version.
18+
1119
## Requirements
1220

1321
### NodeJS
@@ -43,9 +51,17 @@ Please, use the following available resources to get help:
4351
- [nem2-cli documentation][docs]
4452
- If you found a bug, [open a new issue][issues]
4553

54+
## Changelog
55+
56+
Important versions listed below. Refer to the [Changelog](CHANGELOG.md) for a full history of the project.
57+
58+
- [0.10.3](CHANGELOG.md#v0103) - **Cow compatible** - TBD
59+
- [0.10.2](CHANGELOG.md#v0102) - **Cow compatible** - 2019-02-25
60+
- [0.10.1-beta](CHANGELOG.md#v0101-beta) - **Alpaca compatible**
61+
4662
## License
4763

48-
Copyright (c) 2018 NEM
64+
Copyright (c) 2018-2019 NEM
4965
Licensed under the [Apache License 2.0](LICENSE)
5066

5167
[self]: https://github.com/nemtech/nem2-sdk-typescript-javascript

e2e/infrastructure/MosaicHttp.spec.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,29 +53,4 @@ describe('MosaicHttp', () => {
5353
});
5454
});
5555
});
56-
57-
describe('getMosaicsFromNamespace', () => {
58-
it('should return mosaics given namespaceId', (done) => {
59-
mosaicHttp.getMosaicsFromNamespace(namespaceId)
60-
.subscribe((mosaicInfos) => {
61-
expect(mosaicInfos[0].height.lower).to.be.equal(1);
62-
expect(mosaicInfos[0].height.higher).to.be.equal(0);
63-
expect(mosaicInfos[0].divisibility).to.be.equal(6);
64-
expect(mosaicInfos[0].isSupplyMutable()).to.be.equal(false);
65-
expect(mosaicInfos[0].isTransferable()).to.be.equal(true);
66-
expect(mosaicInfos[0].isLevyMutable()).to.be.equal(false);
67-
done();
68-
});
69-
});
70-
});
71-
72-
describe('getMosaicsName', () => {
73-
it('should return mosaics name given array of mosaicIds', (done) => {
74-
mosaicHttp.getMosaicsName([mosaicId])
75-
.subscribe((mosaicNames) => {
76-
expect(mosaicNames[0].name).to.be.equal('xem');
77-
done();
78-
});
79-
});
80-
});
8156
});

e2e/infrastructure/NamespaceHttp.spec.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
import {deepEqual} from 'assert';
1617
import {expect} from 'chai';
1718
import {NamespaceHttp} from '../../src/infrastructure/NamespaceHttp';
1819
import {PublicAccount} from '../../src/model/account/PublicAccount';
1920
import {NetworkType} from '../../src/model/blockchain/NetworkType';
21+
import {NetworkCurrencyMosaic} from '../../src/model/mosaic/NetworkCurrencyMosaic';
2022
import {NamespaceId} from '../../src/model/namespace/NamespaceId';
2123
import {APIUrl} from '../conf/conf.spec';
2224

2325
describe('NamespaceHttp', () => {
24-
const namespaceId = new NamespaceId([929036875, 2226345261]);
26+
const namespaceId = NetworkCurrencyMosaic.NAMESPACE_ID;
2527
const publicAccount = PublicAccount.createFromPublicKey('B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF',
2628
NetworkType.MIJIN_TEST);
2729
const namespaceHttp = new NamespaceHttp(APIUrl);
@@ -69,4 +71,24 @@ describe('NamespaceHttp', () => {
6971
});
7072
});
7173
});
74+
75+
describe('getLinkedMosaicId', () => {
76+
it('should return mosaicId given currency namespaceId', (done) => {
77+
namespaceHttp.getLinkedMosaicId(namespaceId)
78+
.subscribe((mosaicId) => {
79+
expect(mosaicId).to.not.be.null;
80+
done();
81+
});
82+
});
83+
});
84+
85+
describe('getLinkedAddress', () => {
86+
it('should return address given namespaceId', (done) => {
87+
namespaceHttp.getLinkedAddress(namespaceId)
88+
.subscribe((address) => {
89+
expect(address).to.be.null;
90+
done();
91+
});
92+
});
93+
});
7294
});

e2e/infrastructure/TransactionHttp.spec.ts

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ import {Address} from '../../src/model/account/Address';
2626
import {PublicAccount} from '../../src/model/account/PublicAccount';
2727
import {NetworkType} from '../../src/model/blockchain/NetworkType';
2828
import {MosaicId} from '../../src/model/mosaic/MosaicId';
29+
import {MosaicNonce} from '../../src/model/mosaic/MosaicNonce';
2930
import {MosaicProperties} from '../../src/model/mosaic/MosaicProperties';
3031
import {MosaicSupplyType} from '../../src/model/mosaic/MosaicSupplyType';
31-
import {XEM} from '../../src/model/mosaic/XEM';
32+
import {NetworkCurrencyMosaic} from '../../src/model/mosaic/NetworkCurrencyMosaic';
3233
import {AggregateTransaction} from '../../src/model/transaction/AggregateTransaction';
3334
import {CosignatureSignedTransaction} from '../../src/model/transaction/CosignatureSignedTransaction';
3435
import {CosignatureTransaction} from '../../src/model/transaction/CosignatureTransaction';
@@ -97,7 +98,7 @@ describe('TransactionHttp', () => {
9798
const transferTransaction = TransferTransaction.create(
9899
Deadline.create(),
99100
Address.createFromRawAddress('SBILTA367K2LX2FEXG5TFWAS7GEFYAGY7QLFBYKC'),
100-
[XEM.createRelative(10)],
101+
[NetworkCurrencyMosaic.createRelative(10)],
101102
PlainMessage.create('test-message'),
102103
NetworkType.MIJIN_TEST,
103104
);
@@ -151,8 +152,8 @@ describe('TransactionHttp', () => {
151152
it('standalone', (done) => {
152153
const mosaicDefinitionTransaction = MosaicDefinitionTransaction.create(
153154
Deadline.create(),
154-
'test-mosaic-name-' + Math.floor(Math.random() * 10000),
155-
namespaceName,
155+
new MosaicNonce(new Uint8Array([0xE6, 0xDE, 0x84, 0xB8])), // nonce
156+
new MosaicId(UInt64.fromUint(1).toDTO()), // ID
156157
MosaicProperties.create({
157158
supplyMutable: true,
158159
transferable: true,
@@ -170,8 +171,8 @@ describe('TransactionHttp', () => {
170171
it('aggregate', (done) => {
171172
const mosaicDefinitionTransaction = MosaicDefinitionTransaction.create(
172173
Deadline.create(),
173-
'test-mosaic-name-' + Math.floor(Math.random() * 10000),
174-
namespaceName,
174+
new MosaicNonce(new Uint8Array([0xE6, 0xDE, 0x84, 0xB8])), // nonce
175+
new MosaicId(UInt64.fromUint(1).toDTO()), // ID
175176
MosaicProperties.create({
176177
supplyMutable: true,
177178
transferable: true,
@@ -244,7 +245,7 @@ describe('TransactionHttp', () => {
244245
);
245246

246247
const lockFundsTransaction = LockFundsTransaction.create(Deadline.create(),
247-
XEM.createRelative(10),
248+
NetworkCurrencyMosaic.createRelative(10),
248249
UInt64.fromUint(10000),
249250
signedTransaction,
250251
NetworkType.MIJIN_TEST);
@@ -265,7 +266,7 @@ describe('TransactionHttp', () => {
265266
const transferTransaction = TransferTransaction.create(
266267
Deadline.create(),
267268
Address.createFromRawAddress('SBILTA367K2LX2FEXG5TFWAS7GEFYAGY7QLFBYKC'),
268-
[XEM.createRelative(1)],
269+
[NetworkCurrencyMosaic.createRelative(1)],
269270
PlainMessage.create('test-message'),
270271
NetworkType.MIJIN_TEST,
271272
);
@@ -279,7 +280,7 @@ describe('TransactionHttp', () => {
279280
);
280281

281282
const lockFundsTransaction = LockFundsTransaction.create(Deadline.create(),
282-
XEM.createRelative(10),
283+
NetworkCurrencyMosaic.createRelative(10),
283284
UInt64.fromUint(10000),
284285
signedTransaction,
285286
NetworkType.MIJIN_TEST);
@@ -316,7 +317,7 @@ describe('TransactionHttp', () => {
316317
const signedTransaction = account.sign(aggregateTransaction);
317318

318319
const lockFundsTransaction = LockFundsTransaction.create(Deadline.create(),
319-
XEM.createRelative(10),
320+
NetworkCurrencyMosaic.createRelative(10),
320321
UInt64.fromUint(10000),
321322
signedTransaction,
322323
NetworkType.MIJIN_TEST);
@@ -333,7 +334,7 @@ describe('TransactionHttp', () => {
333334
);
334335
const signedTransaction = account.sign(aggregateTransaction);
335336
const lockFundsTransaction = LockFundsTransaction.create(Deadline.create(),
336-
XEM.createRelative(10),
337+
NetworkCurrencyMosaic.createRelative(10),
337338
UInt64.fromUint(10),
338339
signedTransaction,
339340
NetworkType.MIJIN_TEST);
@@ -351,7 +352,7 @@ describe('TransactionHttp', () => {
351352
it('standalone', (done) => {
352353
const secretLockTransaction = SecretLockTransaction.create(
353354
Deadline.create(),
354-
XEM.createAbsolute(10),
355+
NetworkCurrencyMosaic.createAbsolute(10),
355356
UInt64.fromUint(100),
356357
HashType.Op_Sha3_256,
357358
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
@@ -365,7 +366,7 @@ describe('TransactionHttp', () => {
365366
it('aggregate', (done) => {
366367
const secretLockTransaction = SecretLockTransaction.create(
367368
Deadline.create(),
368-
XEM.createAbsolute(10),
369+
NetworkCurrencyMosaic.createAbsolute(10),
369370
UInt64.fromUint(100),
370371
HashType.Op_Sha3_256,
371372
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
@@ -384,7 +385,7 @@ describe('TransactionHttp', () => {
384385
it('standalone', (done) => {
385386
const secretLockTransaction = SecretLockTransaction.create(
386387
Deadline.create(),
387-
XEM.createAbsolute(10),
388+
NetworkCurrencyMosaic.createAbsolute(10),
388389
UInt64.fromUint(100),
389390
HashType.Op_Keccak_256,
390391
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
@@ -398,7 +399,7 @@ describe('TransactionHttp', () => {
398399
it('aggregate', (done) => {
399400
const secretLockTransaction = SecretLockTransaction.create(
400401
Deadline.create(),
401-
XEM.createAbsolute(10),
402+
NetworkCurrencyMosaic.createAbsolute(10),
402403
UInt64.fromUint(100),
403404
HashType.Op_Keccak_256,
404405
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
@@ -417,7 +418,7 @@ describe('TransactionHttp', () => {
417418
it('standalone', (done) => {
418419
const secretLockTransaction = SecretLockTransaction.create(
419420
Deadline.create(),
420-
XEM.createAbsolute(10),
421+
NetworkCurrencyMosaic.createAbsolute(10),
421422
UInt64.fromUint(100),
422423
HashType.Op_Hash_160,
423424
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
@@ -431,7 +432,7 @@ describe('TransactionHttp', () => {
431432
it('aggregate', (done) => {
432433
const secretLockTransaction = SecretLockTransaction.create(
433434
Deadline.create(),
434-
XEM.createAbsolute(10),
435+
NetworkCurrencyMosaic.createAbsolute(10),
435436
UInt64.fromUint(100),
436437
HashType.Op_Hash_160,
437438
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
@@ -450,7 +451,7 @@ describe('TransactionHttp', () => {
450451
it('standalone', (done) => {
451452
const secretLockTransaction = SecretLockTransaction.create(
452453
Deadline.create(),
453-
XEM.createAbsolute(10),
454+
NetworkCurrencyMosaic.createAbsolute(10),
454455
UInt64.fromUint(100),
455456
HashType.Op_Hash_256,
456457
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
@@ -464,7 +465,7 @@ describe('TransactionHttp', () => {
464465
it('aggregate', (done) => {
465466
const secretLockTransaction = SecretLockTransaction.create(
466467
Deadline.create(),
467-
XEM.createAbsolute(10),
468+
NetworkCurrencyMosaic.createAbsolute(10),
468469
UInt64.fromUint(100),
469470
HashType.Op_Hash_256,
470471
sha3_256.create().update(nacl_catapult.randomBytes(20)).hex(),
@@ -488,7 +489,7 @@ describe('TransactionHttp', () => {
488489
const proof = convert.uint8ToHex(secretSeed);
489490
const secretLockTransaction = SecretLockTransaction.create(
490491
Deadline.create(),
491-
XEM.createAbsolute(10),
492+
NetworkCurrencyMosaic.createAbsolute(10),
492493
UInt64.fromUint(100),
493494
HashType.Op_Sha3_256,
494495
secret,
@@ -515,7 +516,7 @@ describe('TransactionHttp', () => {
515516
const proof = convert.uint8ToHex(secretSeed);
516517
const secretLockTransaction = SecretLockTransaction.create(
517518
Deadline.create(),
518-
XEM.createAbsolute(10),
519+
NetworkCurrencyMosaic.createAbsolute(10),
519520
UInt64.fromUint(100),
520521
HashType.Op_Sha3_256,
521522
secret,
@@ -548,7 +549,7 @@ describe('TransactionHttp', () => {
548549
const proof = convert.uint8ToHex(secretSeed);
549550
const secretLockTransaction = SecretLockTransaction.create(
550551
Deadline.create(),
551-
XEM.createAbsolute(10),
552+
NetworkCurrencyMosaic.createAbsolute(10),
552553
UInt64.fromUint(100),
553554
HashType.Op_Keccak_256,
554555
secret,
@@ -575,7 +576,7 @@ describe('TransactionHttp', () => {
575576
const proof = convert.uint8ToHex(secretSeed);
576577
const secretLockTransaction = SecretLockTransaction.create(
577578
Deadline.create(),
578-
XEM.createAbsolute(10),
579+
NetworkCurrencyMosaic.createAbsolute(10),
579580
UInt64.fromUint(100),
580581
HashType.Op_Keccak_256,
581582
secret,
@@ -607,7 +608,7 @@ describe('TransactionHttp', () => {
607608
const proof = convert.uint8ToHex(secretSeed);
608609
const secretLockTransaction = SecretLockTransaction.create(
609610
Deadline.create(),
610-
XEM.createAbsolute(10),
611+
NetworkCurrencyMosaic.createAbsolute(10),
611612
UInt64.fromUint(100),
612613
HashType.Op_Hash_160,
613614
secret,
@@ -634,7 +635,7 @@ describe('TransactionHttp', () => {
634635
const proof = convert.uint8ToHex(secretSeed);
635636
const secretLockTransaction = SecretLockTransaction.create(
636637
Deadline.create(),
637-
XEM.createAbsolute(10),
638+
NetworkCurrencyMosaic.createAbsolute(10),
638639
UInt64.fromUint(100),
639640
HashType.Op_Hash_160,
640641
secret,
@@ -666,7 +667,7 @@ describe('TransactionHttp', () => {
666667
const proof = convert.uint8ToHex(secretSeed);
667668
const secretLockTransaction = SecretLockTransaction.create(
668669
Deadline.create(),
669-
XEM.createAbsolute(10),
670+
NetworkCurrencyMosaic.createAbsolute(10),
670671
UInt64.fromUint(100),
671672
HashType.Op_Hash_256,
672673
secret,
@@ -693,7 +694,7 @@ describe('TransactionHttp', () => {
693694
const proof = convert.uint8ToHex(secretSeed);
694695
const secretLockTransaction = SecretLockTransaction.create(
695696
Deadline.create(),
696-
XEM.createAbsolute(10),
697+
NetworkCurrencyMosaic.createAbsolute(10),
697698
UInt64.fromUint(100),
698699
HashType.Op_Hash_256,
699700
secret,
@@ -857,7 +858,7 @@ describe('TransactionHttp', () => {
857858
const tx = TransferTransaction.create(
858859
Deadline.create(),
859860
Address.createFromRawAddress('SAGY2PTFX4T2XYKYXTJXYCTQRP3FESQH5MEQI2RQ'),
860-
[XEM.createRelative(10)],
861+
[NetworkCurrencyMosaic.createRelative(10)],
861862
EmptyMessage,
862863
NetworkType.MIJIN_TEST,
863864
);

0 commit comments

Comments
 (0)