@dashevo/dapi-client 0.25.0-dev.8 → 0.25.0-pr.1545.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.
- package/lib/BlockHeadersProvider/BlockHeadersProvider.js +14 -16
- package/lib/DAPIClient.js +8 -0
- package/lib/logger/index.js +76 -0
- package/lib/methods/platform/PlatformMethodsFacade.js +10 -0
- package/lib/methods/platform/getConsensusParams/getConsensusParamsFactory.js +10 -2
- package/lib/methods/platform/getConsensusParams/getConsensusParamsResponse.js +2 -2
- package/lib/methods/platform/getDataContract/GetDataContractResponse.js +1 -1
- package/lib/methods/platform/getDataContract/getDataContractFactory.js +6 -2
- package/lib/methods/platform/getDataContractHistory/GetDataContractHistoryResponse.js +55 -0
- package/lib/methods/platform/getDataContractHistory/getDataContractHistoryFactory.js +86 -0
- package/lib/methods/platform/getDocuments/GetDocumentsResponse.js +4 -1
- package/lib/methods/platform/getDocuments/getDocumentsFactory.js +12 -8
- package/lib/methods/platform/getEpochsInfo/EpochInfo.js +54 -0
- package/lib/methods/platform/getEpochsInfo/GetEpochsInfoResponse.js +59 -0
- package/lib/methods/platform/getEpochsInfo/getEpochsInfoFactory.js +69 -0
- package/lib/methods/platform/getIdentitiesByPublicKeyHashes/GetIdentitiesByPublicKeyHashesResponse.js +10 -1
- package/lib/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory.js +6 -3
- package/lib/methods/platform/getIdentity/GetIdentityResponse.js +2 -2
- package/lib/methods/platform/getIdentity/getIdentityFactory.js +6 -2
- package/lib/methods/platform/getProtocolVersionUpgradeState/GetProtocolVersionUpgradeStateResponse.js +56 -0
- package/lib/methods/platform/getProtocolVersionUpgradeState/VersionEntry.js +26 -0
- package/lib/methods/platform/getProtocolVersionUpgradeState/getProtocolVersionUpgradeStateFactory.js +63 -0
- package/lib/methods/platform/getProtocolVersionUpgradeVoteStatus/GetProtocolVersionUpgradeVoteStatusResponse.js +56 -0
- package/lib/methods/platform/getProtocolVersionUpgradeVoteStatus/VersionSignal.js +26 -0
- package/lib/methods/platform/getProtocolVersionUpgradeVoteStatus/getProtocolVersionUpgradeVoteStatusFactory.js +72 -0
- package/lib/methods/platform/response/AbstractResponse.js +2 -2
- package/lib/methods/platform/response/Proof.js +3 -3
- package/lib/methods/platform/waitForStateTransitionResult/WaitForStateTransitionResultResponse.js +8 -7
- package/lib/methods/platform/waitForStateTransitionResult/waitForStateTransitionResultFactory.js +7 -4
- package/lib/networkConfigs.js +38 -129
- package/lib/test/bootstrap.js +6 -0
- package/lib/transport/GrpcTransport/GrpcTransport.js +7 -0
- package/lib/transport/GrpcTransport/errors/InternalServerError.js +2 -2
- package/lib/transport/JsonRpcTransport/JsonRpcTransport.js +6 -0
- package/lib/transport/JsonRpcTransport/requestJsonRpc.js +2 -3
- package/package.json +13 -10
- package/polyfills/fetch-polyfill.js +1 -1
package/lib/methods/platform/getIdentitiesByPublicKeyHashes/getIdentitiesByPublicKeyHashesFactory.js
CHANGED
|
@@ -22,11 +22,14 @@ function getIdentitiesByPublicKeyHashesFactory(grpcTransport) {
|
|
|
22
22
|
* @returns {Promise<GetIdentitiesByPublicKeyHashesResponse>}
|
|
23
23
|
*/
|
|
24
24
|
async function getIdentitiesByPublicKeyHashes(publicKeyHashes, options = {}) {
|
|
25
|
+
const { GetIdentitiesByPublicKeyHashesRequestV0 } = GetIdentitiesByPublicKeyHashesRequest;
|
|
25
26
|
const getIdentitiesByPublicKeyHashesRequest = new GetIdentitiesByPublicKeyHashesRequest();
|
|
26
|
-
getIdentitiesByPublicKeyHashesRequest.
|
|
27
|
-
|
|
27
|
+
getIdentitiesByPublicKeyHashesRequest.setV0(
|
|
28
|
+
new GetIdentitiesByPublicKeyHashesRequestV0()
|
|
29
|
+
.setPublicKeyHashesList(
|
|
30
|
+
publicKeyHashes,
|
|
31
|
+
).setProve(!!options.prove),
|
|
28
32
|
);
|
|
29
|
-
getIdentitiesByPublicKeyHashesRequest.setProve(!!options.prove);
|
|
30
33
|
|
|
31
34
|
let lastError;
|
|
32
35
|
|
|
@@ -25,7 +25,7 @@ class GetIdentityResponse extends AbstractResponse {
|
|
|
25
25
|
* @returns {GetIdentityResponse}
|
|
26
26
|
*/
|
|
27
27
|
static createFromProto(proto) {
|
|
28
|
-
const identity = proto.getIdentity();
|
|
28
|
+
const identity = proto.getV0().getIdentity();
|
|
29
29
|
const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto(proto);
|
|
30
30
|
|
|
31
31
|
if (!identity && !proof) {
|
|
@@ -33,7 +33,7 @@ class GetIdentityResponse extends AbstractResponse {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
return new GetIdentityResponse(
|
|
36
|
-
Buffer.from(proto.getIdentity()),
|
|
36
|
+
Buffer.from(proto.getV0().getIdentity()),
|
|
37
37
|
metadata,
|
|
38
38
|
proof,
|
|
39
39
|
);
|
|
@@ -22,6 +22,7 @@ function getIdentityFactory(grpcTransport) {
|
|
|
22
22
|
* @returns {Promise<GetIdentityResponse>}
|
|
23
23
|
*/
|
|
24
24
|
async function getIdentity(id, options = {}) {
|
|
25
|
+
const { GetIdentityRequestV0 } = GetIdentityRequest;
|
|
25
26
|
const getIdentityRequest = new GetIdentityRequest();
|
|
26
27
|
// need to convert objects inherited from Buffer to pure buffer as google protobuf
|
|
27
28
|
// doesn't support extended buffers
|
|
@@ -31,8 +32,11 @@ function getIdentityFactory(grpcTransport) {
|
|
|
31
32
|
id = Buffer.from(id);
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
getIdentityRequest.
|
|
35
|
-
|
|
35
|
+
getIdentityRequest.setV0(
|
|
36
|
+
new GetIdentityRequestV0()
|
|
37
|
+
.setId(id)
|
|
38
|
+
.setProve(!!options.prove),
|
|
39
|
+
);
|
|
36
40
|
|
|
37
41
|
let lastError;
|
|
38
42
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const AbstractResponse = require('../response/AbstractResponse');
|
|
2
|
+
const VersionEntry = require('./VersionEntry');
|
|
3
|
+
const InvalidResponseError = require('../response/errors/InvalidResponseError');
|
|
4
|
+
|
|
5
|
+
class GetProtocolVersionUpgradeStateResponse extends AbstractResponse {
|
|
6
|
+
/**
|
|
7
|
+
* @param {VersionEntry[]} versionEntries
|
|
8
|
+
* @param {Metadata} metadata
|
|
9
|
+
* @param {Proof} [proof]
|
|
10
|
+
*/
|
|
11
|
+
constructor(versionEntries, metadata, proof = undefined) {
|
|
12
|
+
super(metadata, proof);
|
|
13
|
+
|
|
14
|
+
this.versionEntries = versionEntries;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @returns {VersionEntry[]}
|
|
19
|
+
*/
|
|
20
|
+
getVersionEntries() {
|
|
21
|
+
return this.versionEntries;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param proto
|
|
26
|
+
* @returns {GetProtocolVersionUpgradeStateResponse}
|
|
27
|
+
*/
|
|
28
|
+
static createFromProto(proto) {
|
|
29
|
+
const versions = proto.getV0().getVersions();
|
|
30
|
+
const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto(
|
|
31
|
+
proto,
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
if (!versions && !proof) {
|
|
35
|
+
throw new InvalidResponseError('Version upgrade state is not defined');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let versionEntries = [];
|
|
39
|
+
|
|
40
|
+
const versionsList = versions && versions.getVersionsList();
|
|
41
|
+
if (versionsList) {
|
|
42
|
+
versionEntries = versionsList.map((versionSignal) => new VersionEntry(
|
|
43
|
+
versionSignal.getVersionNumber(),
|
|
44
|
+
versionSignal.getVoteCount(),
|
|
45
|
+
));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return new GetProtocolVersionUpgradeStateResponse(
|
|
49
|
+
versionEntries,
|
|
50
|
+
metadata,
|
|
51
|
+
proof,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
module.exports = GetProtocolVersionUpgradeStateResponse;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class VersionEntry {
|
|
2
|
+
/**
|
|
3
|
+
* @param {number} versionNumber
|
|
4
|
+
* @param {number} voteCount
|
|
5
|
+
*/
|
|
6
|
+
constructor(versionNumber, voteCount) {
|
|
7
|
+
this.versionNumber = versionNumber;
|
|
8
|
+
this.voteCount = voteCount;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @returns {number}
|
|
13
|
+
*/
|
|
14
|
+
getVersionNumber() {
|
|
15
|
+
return this.versionNumber;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @returns {number}
|
|
20
|
+
*/
|
|
21
|
+
getVoteCount() {
|
|
22
|
+
return this.voteCount;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = VersionEntry;
|
package/lib/methods/platform/getProtocolVersionUpgradeState/getProtocolVersionUpgradeStateFactory.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const {
|
|
2
|
+
v0: {
|
|
3
|
+
PlatformPromiseClient,
|
|
4
|
+
GetProtocolVersionUpgradeStateRequest,
|
|
5
|
+
},
|
|
6
|
+
} = require('@dashevo/dapi-grpc');
|
|
7
|
+
|
|
8
|
+
const GetProtocolVersionUpgradeStateResponse = require('./GetProtocolVersionUpgradeStateResponse');
|
|
9
|
+
const InvalidResponseError = require('../response/errors/InvalidResponseError');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {GrpcTransport} grpcTransport
|
|
13
|
+
* @returns {getProtocolVersionUpgradeState}
|
|
14
|
+
*/
|
|
15
|
+
function getProtocolVersionUpgradeStateFactory(grpcTransport) {
|
|
16
|
+
/**
|
|
17
|
+
* Fetch the version upgrade state
|
|
18
|
+
*
|
|
19
|
+
* @typedef {getProtocolVersionUpgradeState}
|
|
20
|
+
* @param {DAPIClientOptions & {prove: boolean}} [options]
|
|
21
|
+
* @returns {Promise<GetProtocolVersionUpgradeStateResponse>}
|
|
22
|
+
*/
|
|
23
|
+
async function getProtocolVersionUpgradeState(options = {}) {
|
|
24
|
+
const { GetProtocolVersionUpgradeStateRequestV0 } = GetProtocolVersionUpgradeStateRequest;
|
|
25
|
+
const getProtocolVersionUpgradeStateRequest = new GetProtocolVersionUpgradeStateRequest();
|
|
26
|
+
getProtocolVersionUpgradeStateRequest.setV0(
|
|
27
|
+
new GetProtocolVersionUpgradeStateRequestV0()
|
|
28
|
+
.setProve(!!options.prove),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
let lastError;
|
|
32
|
+
|
|
33
|
+
// TODO: simple retry before the dapi versioning is properly implemented
|
|
34
|
+
for (let i = 0; i < 3; i += 1) {
|
|
35
|
+
try {
|
|
36
|
+
// eslint-disable-next-line no-await-in-loop
|
|
37
|
+
const getProtocolVersionUpgradeStateResponse = await grpcTransport.request(
|
|
38
|
+
PlatformPromiseClient,
|
|
39
|
+
'getProtocolVersionUpgradeState',
|
|
40
|
+
getProtocolVersionUpgradeStateRequest,
|
|
41
|
+
options,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
return GetProtocolVersionUpgradeStateResponse
|
|
45
|
+
.createFromProto(getProtocolVersionUpgradeStateResponse);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
if (e instanceof InvalidResponseError) {
|
|
48
|
+
lastError = e;
|
|
49
|
+
} else {
|
|
50
|
+
throw e;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// If we made it past the cycle it means that the retry didn't work,
|
|
56
|
+
// and we're throwing the last error encountered
|
|
57
|
+
throw lastError;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return getProtocolVersionUpgradeState;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
module.exports = getProtocolVersionUpgradeStateFactory;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const AbstractResponse = require('../response/AbstractResponse');
|
|
2
|
+
const VersionSignal = require('./VersionSignal');
|
|
3
|
+
const InvalidResponseError = require('../response/errors/InvalidResponseError');
|
|
4
|
+
|
|
5
|
+
class GetProtocolVersionUpgradeVoteStatusResponse extends AbstractResponse {
|
|
6
|
+
/**
|
|
7
|
+
* @param {VersionSignal[]} versionSignals
|
|
8
|
+
* @param {Metadata} metadata
|
|
9
|
+
* @param {Proof} [proof]
|
|
10
|
+
*/
|
|
11
|
+
constructor(versionSignals, metadata, proof = undefined) {
|
|
12
|
+
super(metadata, proof);
|
|
13
|
+
|
|
14
|
+
this.versionSignals = versionSignals;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @returns {VersionSignal[]}
|
|
19
|
+
*/
|
|
20
|
+
getVersionSignals() {
|
|
21
|
+
return this.versionSignals;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param proto
|
|
26
|
+
* @returns {GetProtocolVersionUpgradeVoteStatusResponse}
|
|
27
|
+
*/
|
|
28
|
+
static createFromProto(proto) {
|
|
29
|
+
const versions = proto.getV0().getVersions();
|
|
30
|
+
const { metadata, proof } = AbstractResponse.createMetadataAndProofFromProto(
|
|
31
|
+
proto,
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
if (!versions && !proof) {
|
|
35
|
+
throw new InvalidResponseError('Version upgrade vote status is not defined');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let versionSignals = [];
|
|
39
|
+
|
|
40
|
+
const versionSignalsList = versions && versions.getVersionSignalsList();
|
|
41
|
+
if (versionSignalsList) {
|
|
42
|
+
versionSignals = versionSignalsList.map((versionSignal) => new VersionSignal(
|
|
43
|
+
Buffer.from(versionSignal.getProTxHash()).toString('hex'),
|
|
44
|
+
versionSignal.getVersion(),
|
|
45
|
+
));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return new GetProtocolVersionUpgradeVoteStatusResponse(
|
|
49
|
+
versionSignals,
|
|
50
|
+
metadata,
|
|
51
|
+
proof,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
module.exports = GetProtocolVersionUpgradeVoteStatusResponse;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class VersionSignal {
|
|
2
|
+
/**
|
|
3
|
+
* @param {string} proTxHash
|
|
4
|
+
* @param {number} version
|
|
5
|
+
*/
|
|
6
|
+
constructor(proTxHash, version) {
|
|
7
|
+
this.proTxHash = proTxHash;
|
|
8
|
+
this.version = version;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @returns {string}
|
|
13
|
+
*/
|
|
14
|
+
getProTxHash() {
|
|
15
|
+
return this.proTxHash;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @returns {number}
|
|
20
|
+
*/
|
|
21
|
+
getVersion() {
|
|
22
|
+
return this.version;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = VersionSignal;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const {
|
|
2
|
+
v0: {
|
|
3
|
+
PlatformPromiseClient,
|
|
4
|
+
GetProtocolVersionUpgradeVoteStatusRequest,
|
|
5
|
+
},
|
|
6
|
+
} = require('@dashevo/dapi-grpc');
|
|
7
|
+
|
|
8
|
+
const GetProtocolVersionUpgradeVoteStatusResponse = require('./GetProtocolVersionUpgradeVoteStatusResponse');
|
|
9
|
+
const InvalidResponseError = require('../response/errors/InvalidResponseError');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {GrpcTransport} grpcTransport
|
|
13
|
+
* @returns {getProtocolVersionUpgradeVoteStatus}
|
|
14
|
+
*/
|
|
15
|
+
function getProtocolVersionUpgradeVoteStatusFactory(grpcTransport) {
|
|
16
|
+
/**
|
|
17
|
+
* Fetch the version upgrade vote status
|
|
18
|
+
*
|
|
19
|
+
* @typedef {getProtocolVersionUpgradeVoteStatus}
|
|
20
|
+
* @param {string} startProTxHash
|
|
21
|
+
* @param {number} count
|
|
22
|
+
* @param {DAPIClientOptions & {prove: boolean}} [options]
|
|
23
|
+
* @returns {Promise<GetProtocolVersionUpgradeVoteStatusResponse>}
|
|
24
|
+
*/
|
|
25
|
+
async function getProtocolVersionUpgradeVoteStatus(startProTxHash, count, options = {}) {
|
|
26
|
+
const {
|
|
27
|
+
GetProtocolVersionUpgradeVoteStatusRequestV0,
|
|
28
|
+
} = GetProtocolVersionUpgradeVoteStatusRequest;
|
|
29
|
+
|
|
30
|
+
// eslint-disable-next-line max-len
|
|
31
|
+
const getProtocolVersionUpgradeVoteStatusRequest = new GetProtocolVersionUpgradeVoteStatusRequest();
|
|
32
|
+
|
|
33
|
+
getProtocolVersionUpgradeVoteStatusRequest.setV0(
|
|
34
|
+
new GetProtocolVersionUpgradeVoteStatusRequestV0()
|
|
35
|
+
.setStartProTxHash(Buffer.from(startProTxHash, 'hex'))
|
|
36
|
+
.setCount(count)
|
|
37
|
+
.setProve(!!options.prove),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
let lastError;
|
|
41
|
+
|
|
42
|
+
// TODO: simple retry before the dapi versioning is properly implemented
|
|
43
|
+
for (let i = 0; i < 3; i += 1) {
|
|
44
|
+
try {
|
|
45
|
+
// eslint-disable-next-line no-await-in-loop
|
|
46
|
+
const getProtocolVersionUpgradeVoteStatusResponse = await grpcTransport.request(
|
|
47
|
+
PlatformPromiseClient,
|
|
48
|
+
'getProtocolVersionUpgradeVoteStatus',
|
|
49
|
+
getProtocolVersionUpgradeVoteStatusRequest,
|
|
50
|
+
options,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return GetProtocolVersionUpgradeVoteStatusResponse
|
|
54
|
+
.createFromProto(getProtocolVersionUpgradeVoteStatusResponse);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
if (e instanceof InvalidResponseError) {
|
|
57
|
+
lastError = e;
|
|
58
|
+
} else {
|
|
59
|
+
throw e;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// If we made it past the cycle it means that the retry didn't work,
|
|
65
|
+
// and we're throwing the last error encountered
|
|
66
|
+
throw lastError;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return getProtocolVersionUpgradeVoteStatus;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
module.exports = getProtocolVersionUpgradeVoteStatusFactory;
|
|
@@ -37,13 +37,13 @@ class AbstractResponse {
|
|
|
37
37
|
* @throws {InvalidResponseError}
|
|
38
38
|
*/
|
|
39
39
|
static createMetadataAndProofFromProto(proto) {
|
|
40
|
-
const metadata = proto.getMetadata();
|
|
40
|
+
const metadata = proto.getV0().getMetadata();
|
|
41
41
|
|
|
42
42
|
if (metadata === undefined) {
|
|
43
43
|
throw new InvalidResponseError('Metadata is not defined');
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const rawProof = proto.getProof();
|
|
46
|
+
const rawProof = proto.getV0().getProof();
|
|
47
47
|
|
|
48
48
|
let proof;
|
|
49
49
|
if (rawProof) {
|
|
@@ -16,7 +16,7 @@ class Proof {
|
|
|
16
16
|
/**
|
|
17
17
|
* @returns {Buffer}
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
getGrovedbProof() {
|
|
20
20
|
return this.merkleProof;
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -43,13 +43,13 @@ class Proof {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* @param {
|
|
46
|
+
* @param {object} proofProto
|
|
47
47
|
*
|
|
48
48
|
* @returns {Proof}
|
|
49
49
|
*/
|
|
50
50
|
static createFromProto(proofProto) {
|
|
51
51
|
return new Proof({
|
|
52
|
-
merkleProof: Buffer.from(proofProto.
|
|
52
|
+
merkleProof: Buffer.from(proofProto.getGrovedbProof()),
|
|
53
53
|
quorumHash: Buffer.from(proofProto.getQuorumHash()),
|
|
54
54
|
signature: Buffer.from(proofProto.getSignature()),
|
|
55
55
|
round: proofProto.getRound(),
|
package/lib/methods/platform/waitForStateTransitionResult/WaitForStateTransitionResultResponse.js
CHANGED
|
@@ -32,25 +32,26 @@ class WaitForStateTransitionResultResponse extends AbstractResponse {
|
|
|
32
32
|
let error;
|
|
33
33
|
let proof;
|
|
34
34
|
|
|
35
|
-
if (proto.getProof()) {
|
|
36
|
-
proof = Proof.createFromProto(proto.getProof());
|
|
35
|
+
if (proto.getV0().getProof()) {
|
|
36
|
+
proof = Proof.createFromProto(proto.getV0().getProof());
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
if (proto.getError()) {
|
|
39
|
+
if (proto.getV0().getError()) {
|
|
40
40
|
let data;
|
|
41
|
-
const rawData = proto.getError().getData();
|
|
41
|
+
const rawData = proto.getV0().getError().getData();
|
|
42
42
|
if (rawData) {
|
|
43
43
|
data = cbor.decode(Buffer.from(rawData));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
error = new ErrorResult(
|
|
47
|
-
proto.getError().getCode(),
|
|
48
|
-
proto.getError().getMessage(),
|
|
47
|
+
proto.getV0().getError().getCode(),
|
|
48
|
+
proto.getV0().getError().getMessage(),
|
|
49
49
|
data,
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
const metadata = proto.
|
|
53
|
+
const metadata = proto.getV0().getMetadata()
|
|
54
|
+
? new Metadata(proto.getV0().getMetadata().toObject()) : null;
|
|
54
55
|
|
|
55
56
|
return new WaitForStateTransitionResultResponse(
|
|
56
57
|
metadata,
|
package/lib/methods/platform/waitForStateTransitionResult/waitForStateTransitionResultFactory.js
CHANGED
|
@@ -24,17 +24,20 @@ function waitForStateTransitionResultFactory(grpcTransport) {
|
|
|
24
24
|
// eslint-disable-next-line no-param-reassign
|
|
25
25
|
options = {
|
|
26
26
|
// Set default timeout
|
|
27
|
-
timeout:
|
|
27
|
+
timeout: 120000,
|
|
28
28
|
prove: false,
|
|
29
29
|
retry: 0,
|
|
30
30
|
throwDeadlineExceeded: true,
|
|
31
31
|
...options,
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
const { WaitForStateTransitionResultRequestV0 } = WaitForStateTransitionResultRequest;
|
|
34
35
|
const waitForStateTransitionResultRequest = new WaitForStateTransitionResultRequest();
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
waitForStateTransitionResultRequest.setV0(
|
|
37
|
+
new WaitForStateTransitionResultRequestV0()
|
|
38
|
+
.setStateTransitionHash(stateTransitionHash)
|
|
39
|
+
.setProve(options.prove),
|
|
40
|
+
);
|
|
38
41
|
|
|
39
42
|
let lastError;
|
|
40
43
|
|
package/lib/networkConfigs.js
CHANGED
|
@@ -1,143 +1,52 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
testnet: {
|
|
3
3
|
seeds: [
|
|
4
|
-
'seed-1.testnet.networks.dash.org',
|
|
5
|
-
'seed-2.testnet.networks.dash.org',
|
|
6
|
-
'seed-3.testnet.networks.dash.org',
|
|
7
|
-
'seed-4.testnet.networks.dash.org',
|
|
8
|
-
'seed-5.testnet.networks.dash.org',
|
|
4
|
+
'seed-1.testnet.networks.dash.org:1443',
|
|
5
|
+
'seed-2.testnet.networks.dash.org:1443',
|
|
6
|
+
'seed-3.testnet.networks.dash.org:1443',
|
|
7
|
+
'seed-4.testnet.networks.dash.org:1443',
|
|
8
|
+
'seed-5.testnet.networks.dash.org:1443',
|
|
9
9
|
],
|
|
10
10
|
network: 'testnet',
|
|
11
11
|
// Since we don't have PoSe atm, 3rd party masternodes sometimes provide wrong data
|
|
12
12
|
// that breaks test suite and application logic. Temporary solution is to hardcode
|
|
13
13
|
// reliable DCG testnet masternodes to connect. Should be removed when PoSe is introduced.
|
|
14
14
|
dapiAddressesWhiteList: [
|
|
15
|
-
'34.
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'35.
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'54.
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'52.
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'35.
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'54.186.161.236',
|
|
49
|
-
'52.13.63.7',
|
|
50
|
-
'18.236.233.225',
|
|
51
|
-
'54.191.138.72',
|
|
52
|
-
'54.191.59.75',
|
|
53
|
-
'18.237.160.84',
|
|
54
|
-
'54.218.236.193',
|
|
55
|
-
'54.148.178.140',
|
|
56
|
-
'35.161.168.136',
|
|
57
|
-
'35.161.33.22',
|
|
58
|
-
'35.160.130.44',
|
|
59
|
-
'34.212.104.247',
|
|
60
|
-
'52.13.29.83',
|
|
61
|
-
'54.149.39.172',
|
|
62
|
-
'35.89.93.255',
|
|
63
|
-
'35.85.46.137',
|
|
64
|
-
'54.188.154.252',
|
|
65
|
-
'54.218.11.172',
|
|
66
|
-
'54.186.47.235',
|
|
67
|
-
'54.244.145.48',
|
|
68
|
-
'18.236.232.153',
|
|
69
|
-
'34.220.226.135',
|
|
70
|
-
'34.220.30.59',
|
|
71
|
-
'18.237.160.97',
|
|
72
|
-
'18.236.146.99',
|
|
73
|
-
'35.88.169.18',
|
|
74
|
-
'35.164.17.198',
|
|
75
|
-
'54.218.80.158',
|
|
76
|
-
'34.220.102.107',
|
|
77
|
-
'35.165.60.113',
|
|
78
|
-
'34.215.234.63',
|
|
79
|
-
'35.89.146.226',
|
|
80
|
-
'35.89.86.26',
|
|
81
|
-
'35.88.160.231',
|
|
82
|
-
'54.245.8.155',
|
|
83
|
-
'52.36.221.94',
|
|
84
|
-
'52.35.46.188',
|
|
85
|
-
'34.221.153.67',
|
|
86
|
-
'54.212.153.15',
|
|
87
|
-
'35.85.55.192',
|
|
88
|
-
'35.89.105.90',
|
|
89
|
-
'52.24.22.52',
|
|
90
|
-
'54.212.33.96',
|
|
91
|
-
'52.10.19.238',
|
|
92
|
-
'35.160.190.165',
|
|
93
|
-
'34.219.3.61',
|
|
94
|
-
'54.187.32.187',
|
|
95
|
-
'35.162.221.77',
|
|
96
|
-
'35.91.64.183',
|
|
97
|
-
'18.236.189.15',
|
|
98
|
-
'35.91.145.195',
|
|
99
|
-
'54.186.251.30',
|
|
100
|
-
'54.245.9.46',
|
|
101
|
-
'35.91.48.128',
|
|
102
|
-
'54.244.75.85',
|
|
103
|
-
'34.221.159.53',
|
|
104
|
-
'35.89.88.166',
|
|
105
|
-
'54.185.249.165',
|
|
106
|
-
'54.245.9.209',
|
|
107
|
-
'34.222.167.162',
|
|
108
|
-
'54.191.88.232',
|
|
109
|
-
'54.191.111.112',
|
|
110
|
-
'18.237.146.37',
|
|
111
|
-
'35.89.148.27',
|
|
112
|
-
'35.91.8.48',
|
|
113
|
-
'18.236.208.138',
|
|
114
|
-
'54.213.60.60',
|
|
115
|
-
'35.92.151.94',
|
|
116
|
-
'18.237.241.37',
|
|
117
|
-
'54.202.209.229',
|
|
118
|
-
'34.221.9.70',
|
|
119
|
-
'35.89.38.62',
|
|
120
|
-
'54.218.81.193',
|
|
121
|
-
'34.221.158.21',
|
|
122
|
-
'35.88.97.57',
|
|
123
|
-
'54.68.247.40',
|
|
124
|
-
'35.88.168.176',
|
|
125
|
-
'35.89.202.171',
|
|
126
|
-
'34.220.106.205',
|
|
127
|
-
'34.210.86.23',
|
|
128
|
-
'44.230.40.184',
|
|
15
|
+
'34.214.48.68:1443',
|
|
16
|
+
'35.166.18.166:1443',
|
|
17
|
+
'35.165.50.126:1443',
|
|
18
|
+
'52.42.202.128:1443',
|
|
19
|
+
'52.12.176.90:1443',
|
|
20
|
+
'44.233.44.95:1443',
|
|
21
|
+
'35.167.145.149:1443',
|
|
22
|
+
'52.34.144.50:1443',
|
|
23
|
+
'44.240.98.102:1443',
|
|
24
|
+
'54.201.32.131:1443',
|
|
25
|
+
'52.10.229.11:1443',
|
|
26
|
+
'52.13.132.146:1443',
|
|
27
|
+
'44.228.242.181:1443',
|
|
28
|
+
'35.82.197.197:1443',
|
|
29
|
+
'52.40.219.41:1443',
|
|
30
|
+
'44.239.39.153:1443',
|
|
31
|
+
'54.149.33.167:1443',
|
|
32
|
+
'35.164.23.245:1443',
|
|
33
|
+
'52.33.28.47:1443',
|
|
34
|
+
'52.43.86.231:1443',
|
|
35
|
+
'52.43.13.92:1443',
|
|
36
|
+
'35.163.144.230:1443',
|
|
37
|
+
'52.89.154.48:1443',
|
|
38
|
+
'52.24.124.162:1443',
|
|
39
|
+
'44.227.137.77:1443',
|
|
40
|
+
'35.85.21.179:1443',
|
|
41
|
+
'54.187.14.232:1443',
|
|
42
|
+
'54.68.235.201:1443',
|
|
43
|
+
'52.13.250.182:1443',
|
|
44
|
+
'35.82.49.196:1443',
|
|
45
|
+
'44.232.196.6:1443',
|
|
46
|
+
'54.189.164.39:1443',
|
|
47
|
+
'54.213.204.85:1443',
|
|
129
48
|
],
|
|
130
49
|
},
|
|
131
|
-
evonet: {
|
|
132
|
-
seeds: [
|
|
133
|
-
'seed-1.evonet.networks.dash.org',
|
|
134
|
-
'seed-2.evonet.networks.dash.org',
|
|
135
|
-
'seed-3.evonet.networks.dash.org',
|
|
136
|
-
'seed-4.evonet.networks.dash.org',
|
|
137
|
-
'seed-5.evonet.networks.dash.org',
|
|
138
|
-
],
|
|
139
|
-
network: 'evonet',
|
|
140
|
-
},
|
|
141
50
|
local: {
|
|
142
51
|
dapiAddresses: ['127.0.0.1'],
|
|
143
52
|
network: 'regtest',
|
package/lib/test/bootstrap.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
require('../../polyfills/fetch-polyfill');
|
|
2
|
+
require('setimmediate');
|
|
2
3
|
|
|
3
4
|
const { expect, use } = require('chai');
|
|
4
5
|
const sinon = require('sinon');
|
|
5
6
|
const sinonChai = require('sinon-chai');
|
|
6
7
|
const dirtyChai = require('dirty-chai');
|
|
7
8
|
const chaiAsPromised = require('chai-as-promised');
|
|
9
|
+
const { default: loadDpp } = require('@dashevo/wasm-dpp');
|
|
8
10
|
|
|
9
11
|
use(sinonChai);
|
|
10
12
|
use(chaiAsPromised);
|
|
11
13
|
use(dirtyChai);
|
|
12
14
|
|
|
15
|
+
before(async () => {
|
|
16
|
+
await loadDpp();
|
|
17
|
+
});
|
|
18
|
+
|
|
13
19
|
beforeEach(function beforeEach() {
|
|
14
20
|
if (!this.sinon) {
|
|
15
21
|
this.sinon = sinon.createSandbox();
|