Skip to content

Commit c5f58f6

Browse files
author
Grégory Saive
authored
Merge pull request #182 from rg911/task/g82_handle_null_mosaic_properties
Issue #82 Handles null mosaic property in MosaicHttp
2 parents ac24850 + 765bd34 commit c5f58f6

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

package-lock.json

Lines changed: 2 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@
4545
"coveralls": "^3.0.0",
4646
"gulp": "^4.0.2",
4747
"gulp-typescript": "^5.0.1",
48-
"js-sha256": "^0.9.0",
4948
"mocha": "^4.0.1",
5049
"nyc": "^11.3.0",
51-
"ripemd160": "^2.0.2",
5250
"secure-random": "^1.1.1",
5351
"ts-mockito": "^2.2.7",
5452
"ts-node": "^5.0.1",
@@ -61,7 +59,9 @@
6159
"crypto-js": "^3.1.9-1",
6260
"flatbuffers": "^1.11.0",
6361
"js-joda": "^1.6.2",
62+
"js-sha256": "^0.9.0",
6463
"js-sha3": "^0.8.0",
64+
"ripemd160": "^2.0.2",
6565
"request": "^2.83.0",
6666
"request-promise-native": "^1.0.5",
6767
"rxjs": "^6.2.1",

src/infrastructure/MosaicHttp.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ export class MosaicHttp extends Http implements MosaicRepository {
8282
PublicAccount.createFromPublicKey(mosaicInfoDTO.mosaic.owner, networkType),
8383
mosaicInfoDTO.mosaic.revision,
8484
new MosaicProperties(
85-
new UInt64(mosaicFlag),
86-
(new UInt64(divisibility)).compact(),
85+
mosaicFlag ? new UInt64(mosaicFlag) : UInt64.fromUint(0),
86+
(divisibility ? new UInt64(divisibility) : UInt64.fromUint(0)).compact(),
8787
duration ? new UInt64(duration) : undefined,
8888
),
8989
);
@@ -113,7 +113,7 @@ export class MosaicHttp extends Http implements MosaicRepository {
113113
divisibility = mosaicInfoDTO.mosaic.properties[MosaicPropertyType.Divisibility].value;
114114
}
115115
if (mosaicInfoDTO.mosaic.properties[MosaicPropertyType.Duration].value) {
116-
duration = mosaicInfoDTO.mosaic.properties[MosaicPropertyType.Divisibility].value;
116+
duration = mosaicInfoDTO.mosaic.properties[MosaicPropertyType.Duration].value;
117117
}
118118
return new MosaicInfo(
119119
mosaicInfoDTO.meta.id,
@@ -123,8 +123,8 @@ export class MosaicHttp extends Http implements MosaicRepository {
123123
PublicAccount.createFromPublicKey(mosaicInfoDTO.mosaic.owner, networkType),
124124
mosaicInfoDTO.mosaic.revision,
125125
new MosaicProperties(
126-
new UInt64(mosaicFlag),
127-
(new UInt64(divisibility)).compact(),
126+
mosaicFlag ? new UInt64(mosaicFlag) : UInt64.fromUint(0),
127+
(divisibility ? new UInt64(divisibility) : UInt64.fromUint(0)).compact(),
128128
duration ? new UInt64(duration) : undefined,
129129
),
130130
);

src/service/MosaicView.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ export class MosaicView {
2424
/**
2525
* @internal
2626
* @param mosaicInfo
27-
* @param namespaceName
28-
* @param mosaicName
2927
*/
3028
constructor(/**
3129
* The mosaic information

0 commit comments

Comments
 (0)