Skip to content

Commit 19c50e2

Browse files
author
Greg S
committed
WIP #66: Added NetworkCurrencyMosaic.NAMESPACE_ID auto generated with cat.currency namespace, same with cat.harvest namespace
1 parent c9e9821 commit 19c50e2

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed

e2e/infrastructure/NamespaceHttp.spec.ts

Lines changed: 6 additions & 3 deletions
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);
@@ -71,10 +73,11 @@ describe('NamespaceHttp', () => {
7173
});
7274

7375
describe('getLinkedMosaicId', () => {
74-
it('should return mosaicId given namespaceId', (done) => {
76+
it('should return mosaicId given currency namespaceId', (done) => {
7577
namespaceHttp.getLinkedMosaicId(namespaceId)
7678
.subscribe((mosaicId) => {
77-
expect(mosaicId).to.be.null;
79+
expect(mosaicId).to.not.be.null;
80+
deepEqual(mosaicId, NetworkCurrencyMosaic.MOSAIC_ID);
7881
done();
7982
});
8083
});

src/model/mosaic/NetworkCurrencyMosaic.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ export class NetworkCurrencyMosaic extends Mosaic {
3434
*/
3535
public static OWNER_PUBLIC_KEY = 'B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF';
3636

37+
/**
38+
* namespaceId of `currency` namespace.
39+
*
40+
* @type {Id}
41+
*/
42+
public static NAMESPACE_ID = new NamespaceId('cat.currency');
43+
3744
/**
3845
* Per-Network currencyMosaicId
3946
*

src/model/mosaic/NetworkHarvestMosaic.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,17 @@ export class NetworkHarvestMosaic extends Mosaic {
3434
*/
3535
public static OWNER_PUBLIC_KEY = 'B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF';
3636

37+
/**
38+
* namespaceId of `harvest` namespace.
39+
*
40+
* @type {Id}
41+
*/
42+
public static NAMESPACE_ID = new NamespaceId('cat.harvest');
43+
3744
/**
3845
* Per-Network harvestMosaicId
3946
*
40-
* @note Mark the little-endianness on nonce field.
47+
* @note Little-endianness on nonce field in `mosaicId(nonce, publicKey)`.
4148
* @type {Id}
4249
*/
4350
public static MOSAIC_ID = new MosaicId(mosaicId([

test/model/mosaic/NetworkCurrencyMosaic.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {deepEqual} from 'assert';
1818
import {expect} from 'chai';
1919
import {MosaicId} from '../../../src/model/mosaic/MosaicId';
2020
import {NetworkCurrencyMosaic} from '../../../src/model/mosaic/NetworkCurrencyMosaic';
21+
import {NamespaceId} from '../../../src/model/namespace/NamespaceId';
2122

2223
describe('NetworkCurrencyMosaic', () => {
2324

@@ -36,6 +37,7 @@ describe('NetworkCurrencyMosaic', () => {
3637
});
3738

3839
it('should have valid statics', () => {
40+
deepEqual(NetworkCurrencyMosaic.NAMESPACE_ID.id, new NamespaceId([3294802500, 2243684972]).id);
3941
deepEqual(NetworkCurrencyMosaic.MOSAIC_ID.id, new MosaicId([481110499, 231112638]).id);
4042
expect(NetworkCurrencyMosaic.DIVISIBILITY).to.be.equal(6);
4143
expect(NetworkCurrencyMosaic.TRANSFERABLE).to.be.equal(true);

test/model/mosaic/NetworkHarvestMosaic.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {deepEqual} from 'assert';
1818
import {expect} from 'chai';
1919
import {MosaicId} from '../../../src/model/mosaic/MosaicId';
2020
import {NetworkHarvestMosaic} from '../../../src/model/mosaic/NetworkHarvestMosaic';
21+
import {NamespaceId} from '../../../src/model/namespace/NamespaceId';
2122

2223
describe('NetworkHarvestMosaic', () => {
2324

@@ -36,6 +37,7 @@ describe('NetworkHarvestMosaic', () => {
3637
});
3738

3839
it('should have valid statics', () => {
40+
deepEqual(NetworkHarvestMosaic.NAMESPACE_ID.id, new NamespaceId([3084986652, 2484246962]).id);
3941
deepEqual(NetworkHarvestMosaic.MOSAIC_ID.id, new MosaicId([519256100, 642862634]).id);
4042
expect(NetworkHarvestMosaic.DIVISIBILITY).to.be.equal(3);
4143
expect(NetworkHarvestMosaic.TRANSFERABLE).to.be.equal(true);

0 commit comments

Comments
 (0)