@dashevo/dapi-client 0.24.0-dev.6 → 0.25.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,16 @@
1
1
  class Metadata {
2
2
  /**
3
- * @param {object} properties
3
+ * @param {Object} properties
4
4
  * @param {number} properties.height - block height
5
5
  * @param {number} properties.coreChainLockedHeight - core chain locked height
6
+ * @param {number} properties.timeMs - block time
7
+ * @param {number} properties.protocolVersion - protocol version
6
8
  */
7
9
  constructor(properties) {
8
10
  this.height = properties.height;
9
11
  this.coreChainLockedHeight = properties.coreChainLockedHeight;
12
+ this.timeMs = properties.timeMs;
13
+ this.protocolVersion = properties.protocolVersion;
10
14
  }
11
15
 
12
16
  /**
@@ -26,6 +30,22 @@ class Metadata {
26
30
  getCoreChainLockedHeight() {
27
31
  return this.coreChainLockedHeight;
28
32
  }
33
+
34
+ /**
35
+ * Get block time
36
+ * @return {number}
37
+ */
38
+ getTimeMs() {
39
+ return this.timeMs;
40
+ }
41
+
42
+ /**
43
+ * Get protocol version
44
+ * @return {number}
45
+ */
46
+ getProtocolVersion() {
47
+ return this.protocolVersion;
48
+ }
29
49
  }
30
50
 
31
51
  module.exports = Metadata;
@@ -2,13 +2,15 @@ class Proof {
2
2
  /**
3
3
  * @param {object} properties
4
4
  * @param {Buffer} properties.merkleProof
5
- * @param {Buffer} properties.signatureLLMQHash
5
+ * @param {Buffer} properties.quorumHash
6
6
  * @param {Buffer} properties.signature
7
+ * @param {number} properties.round
7
8
  */
8
9
  constructor(properties) {
9
10
  this.merkleProof = properties.merkleProof;
10
- this.signatureLLMQHash = properties.signatureLLMQHash;
11
+ this.quorumHash = properties.quorumHash;
11
12
  this.signature = properties.signature;
13
+ this.round = properties.round;
12
14
  }
13
15
 
14
16
  /**
@@ -21,8 +23,8 @@ class Proof {
21
23
  /**
22
24
  * @returns {Buffer}
23
25
  */
24
- getSignatureLLMQHash() {
25
- return this.signatureLLMQHash;
26
+ getQuorumHash() {
27
+ return this.quorumHash;
26
28
  }
27
29
 
28
30
  /**
@@ -32,6 +34,14 @@ class Proof {
32
34
  return this.signature;
33
35
  }
34
36
 
37
+ /**
38
+ *
39
+ * @returns {number}
40
+ */
41
+ getRound() {
42
+ return this.round;
43
+ }
44
+
35
45
  /**
36
46
  * @param {Object} proofProto
37
47
  *
@@ -40,8 +50,9 @@ class Proof {
40
50
  static createFromProto(proofProto) {
41
51
  return new Proof({
42
52
  merkleProof: Buffer.from(proofProto.getMerkleProof()),
43
- signatureLLMQHash: Buffer.from(proofProto.getSignatureLlmqHash()),
53
+ quorumHash: Buffer.from(proofProto.getQuorumHash()),
44
54
  signature: Buffer.from(proofProto.getSignature()),
55
+ round: proofProto.getRound(),
45
56
  });
46
57
  }
47
58
  }
@@ -1,3 +1,5 @@
1
+ require('../../polyfills/fetch-polyfill');
2
+
1
3
  const { expect, use } = require('chai');
2
4
  const sinon = require('sinon');
3
5
  const sinonChai = require('sinon-chai');
@@ -20,4 +22,10 @@ afterEach(function afterEach() {
20
22
  this.sinon.restore();
21
23
  });
22
24
 
25
+ before(function before() {
26
+ if (!this.sinon) {
27
+ this.sinon = sinon.createSandbox();
28
+ }
29
+ });
30
+
23
31
  global.expect = expect;