Skip to content

Commit b692309

Browse files
author
Greg S
committed
#48: disabled mosaicId by name initialization ; fixed XEM class
1 parent 5a93c09 commit b692309

File tree

5 files changed

+27
-15
lines changed

5 files changed

+27
-15
lines changed

src/model/mosaic/MosaicId.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,21 @@ export class MosaicId {
4242
constructor(id: string | number[]) {
4343
if (id instanceof Array) {
4444
this.id = new Id(id);
45-
} else if (typeof id === 'string') {
45+
}
46+
/**
47+
* Deprecated initialization with MosaicName.
48+
* To be re-introduced after AliasTransaction implementation.
49+
*
50+
* @deprecated
51+
else if (typeof id === 'string') {
4652
this.fullName = id;
4753
const limiterPosition = id.indexOf(':');
4854
const namespaceName = id.substr(0, limiterPosition);
4955
const mosaicName = id.substr(limiterPosition + 1);
5056
this.id = new Id(MosaicIdentifierGenerator(namespaceName, mosaicName));
5157
}
58+
*
59+
*/
5260
}
5361

5462
/**

src/model/mosaic/XEM.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,13 @@ export class XEM extends Mosaic {
4949

5050
/**
5151
* mosaicId
52+
*
53+
* UInt64 XEM mosaic ID: [3294802500, 2243684972]
54+
* Hexadecimal XEM mosaic ID: 85bbea6cc462b244
55+
*
5256
* @type {Id}
5357
*/
54-
public static MOSAIC_ID = new MosaicId('nem:xem');
55-
56-
/**
57-
* namespaceId
58-
* @type {Id}
59-
*/
60-
public static NAMESPACE_ID = new NamespaceId('nem');
58+
public static MOSAIC_ID = new MosaicId([3294802500, 2243684972]);
6159

6260
/**
6361
* constructor

test/model/mosaic/MosaicId.spec.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,22 @@ import {MosaicId} from '../../../src/model/mosaic/MosaicId';
2020

2121
describe('MosaicId', () => {
2222

23+
/**
24+
* Deprecated initialization with MosaicName.
25+
* To be re-introduced after AliasTransaction implementation.
26+
*
27+
* @deprecated
2328
it('should be created from full name', () => {
2429
const id = new MosaicId('nem:xem');
25-
deepEqual(id.id, new Id([3646934825, 3576016193]));
30+
deepEqual(id.id, new Id([3294802500, 2243684972]));
2631
expect(id.fullName).to.be.equal('nem:xem');
2732
});
33+
*
34+
*/
2835

2936
it('should be created from id', () => {
30-
const id = new MosaicId([3646934825, 3576016193]);
31-
deepEqual(id.id, new Id([3646934825, 3576016193]));
37+
const id = new MosaicId([3294802500, 2243684972]);
38+
deepEqual(id.id, new Id([3294802500, 2243684972]));
3239
expect(id.fullName).to.be.equal(undefined);
3340
});
3441
});

test/model/mosaic/XEM.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('XEM', () => {
2626

2727
const xem = XEM.createRelative(1000);
2828

29-
deepEqual(xem.id.id.toHex(), 'd525ad41d95fcf29');
29+
deepEqual(xem.id.id.toHex(), '85bbea6cc462b244');
3030
expect(xem.amount.compact()).to.be.equal(1000 * 1000000);
3131
});
3232

@@ -37,7 +37,6 @@ describe('XEM', () => {
3737
});
3838

3939
it('should have valid statics', () => {
40-
deepEqual(XEM.NAMESPACE_ID.id, new NamespaceId([929036875, 2226345261]).id);
41-
deepEqual(XEM.MOSAIC_ID.id, new MosaicId([3646934825, 3576016193]).id);
40+
deepEqual(XEM.MOSAIC_ID.id, new MosaicId([3294802500, 2243684972]).id);
4241
});
4342
});

test/model/transaction/TransferTransaction.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@ describe('TransferTransaction', () => {
7373
240,
7474
signedTransaction.payload.length,
7575
)).to.be.equal('9050B9837EFAB4BBE8A4B9BB32D812F9885C00D8FC1650E1420D000100746573742D6D657373616765' +
76-
'29CF5FD941AD25D500E1F50500000000');
76+
'44B262C46CEABB8500E1F50500000000');
7777
});
7878
});

0 commit comments

Comments
 (0)