Skip to content

Commit 66d470d

Browse files
authored
Merge branch 'master' into task/g411_listener_status
2 parents 2523013 + 369acd0 commit 66d470d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/model/mosaic/MosaicNonce.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,12 @@ export class MosaicNonce {
7474
public toDTO(): Uint8Array {
7575
return this.nonce;
7676
}
77+
78+
/**
79+
* Get string value of nonce
80+
* @returns {string}
81+
*/
82+
public toHex(): string {
83+
return convert.uint8ToHex(this.nonce)
84+
}
7785
}

test/model/mosaic/MosaicNonce.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,12 @@ describe('MosaicNonce', () => {
4545
expect(nonce.nonce).to.not.be.null;
4646
deepEqual(nonce.nonce, new Uint8Array([0x0, 0x0, 0x0, 0x0]));
4747
});
48+
49+
describe('toHex()', () => {
50+
it('should return string value of nonce', () => {
51+
const nonce = new MosaicNonce(new Uint8Array([0x0, 0x0, 0x0, 0x0]))
52+
const hex = nonce.toHex()
53+
expect(hex).to.be.equal('00000000');
54+
});
55+
});
4856
});

0 commit comments

Comments
 (0)