Skip to content

Commit 90aa403

Browse files
committed
Use UInt64 in retalFees
1 parent 40ffa0d commit 90aa403

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/infrastructure/NetworkHttp.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { NodeInfo } from '../model/node/NodeInfo';
4040
import { Http } from './Http';
4141
import { NetworkRepository } from './NetworkRepository';
4242
import { NodeHttp } from './NodeHttp';
43+
import { UInt64 } from '../model/UInt64';
4344

4445
/**
4546
* Network http repository.
@@ -103,9 +104,9 @@ export class NetworkHttp extends Http implements NetworkRepository {
103104
*/
104105
public getRentalFees(): Observable<RentalFees> {
105106
return this.call(this.networkRoutesApi.getRentalFees(), (body) =>
106-
new RentalFees(body.effectiveRootNamespaceRentalFeePerBlock,
107-
body.effectiveChildNamespaceRentalFee,
108-
body.effectiveMosaicRentalFee));
107+
new RentalFees(UInt64.fromNumericString(body.effectiveRootNamespaceRentalFeePerBlock),
108+
UInt64.fromNumericString(body.effectiveChildNamespaceRentalFee),
109+
UInt64.fromNumericString(body.effectiveMosaicRentalFee)));
109110
}
110111

111112
/**

src/model/network/RentalFees.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { UInt64 } from '../UInt64';
18+
1719
/**
1820
* Rental Fees
1921
*/
@@ -24,8 +26,8 @@ export class RentalFees {
2426
* @param effectiveChildNamespaceRentalFee - Absolute amount. An amount of 123456789 (absolute) for a mosaic with divisibility 6 means 123.456789 (relative).
2527
* @param effectiveMosaicRentalFee - bsolute amount. An amount of 123456789 (absolute) for a mosaic with divisibility 6 means 123.456789 (relative).
2628
*/
27-
constructor(public readonly effectiveRootNamespaceRentalFeePerBlock: string,
28-
public readonly effectiveChildNamespaceRentalFee: string,
29-
public readonly effectiveMosaicRentalFee: string) {
29+
constructor(public readonly effectiveRootNamespaceRentalFeePerBlock: UInt64,
30+
public readonly effectiveChildNamespaceRentalFee: UInt64,
31+
public readonly effectiveMosaicRentalFee: UInt64) {
3032
}
3133
}

test/infrastructure/NetworkHttp.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ describe('NetworkHttp', () => {
9191

9292
const rentalFees = await networkRepository.getRentalFees().toPromise();
9393
expect(rentalFees).to.be.not.null;
94-
expect(rentalFees.effectiveChildNamespaceRentalFee).to.be.equals('1');
95-
expect(rentalFees.effectiveMosaicRentalFee).to.be.equals('2');
96-
expect(rentalFees.effectiveRootNamespaceRentalFeePerBlock).to.be.equals('3');
94+
expect(rentalFees.effectiveChildNamespaceRentalFee.toString()).to.be.equals('1');
95+
expect(rentalFees.effectiveMosaicRentalFee.toString()).to.be.equals('2');
96+
expect(rentalFees.effectiveRootNamespaceRentalFeePerBlock.toString()).to.be.equals('3');
9797
});
9898

9999
it('getNetworkType', async () => {

0 commit comments

Comments
 (0)