@dashevo/dapi-client 0.24.0-dev.12 → 0.24.0-dev.14
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/README.md +3 -4
- package/lib/dapiAddressProvider/DAPIAddress.js +14 -40
- package/lib/dapiAddressProvider/ListDAPIAddressProvider.js +1 -2
- package/lib/test/fixtures/getMNListDiffsFixture.js +85 -1066
- package/lib/transport/GrpcTransport/GrpcTransport.js +4 -9
- package/lib/transport/JsonRpcTransport/JsonRpcTransport.js +1 -1
- package/package.json +9 -8
- package/polyfills/fetch-polyfill.js +10 -0
package/README.md
CHANGED
|
@@ -50,8 +50,7 @@ const DAPIClient = require('@dashevo/dapi-client');
|
|
|
50
50
|
var client = new DAPIClient({
|
|
51
51
|
seeds: [{
|
|
52
52
|
host: 'seed-1.evonet.networks.dash.org',
|
|
53
|
-
|
|
54
|
-
grpcPort: 3010,
|
|
53
|
+
port: 3000,
|
|
55
54
|
}],
|
|
56
55
|
});
|
|
57
56
|
|
|
@@ -71,8 +70,8 @@ const DAPIClient = require('@dashevo/dapi-client');
|
|
|
71
70
|
|
|
72
71
|
var client = new DAPIClient({
|
|
73
72
|
dapiAddresses: [
|
|
74
|
-
'127.0.0.1:3000
|
|
75
|
-
'127.0.0.2:3000
|
|
73
|
+
'127.0.0.1:3000',
|
|
74
|
+
'127.0.0.2:3000',
|
|
76
75
|
],
|
|
77
76
|
});
|
|
78
77
|
|
|
@@ -10,13 +10,12 @@ class DAPIAddress {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
if (typeof address === 'string') {
|
|
13
|
-
const [host,
|
|
13
|
+
const [host, port, ssl] = address.split(':');
|
|
14
14
|
|
|
15
15
|
// eslint-disable-next-line no-param-reassign
|
|
16
16
|
address = {
|
|
17
17
|
host,
|
|
18
|
-
|
|
19
|
-
grpcPort: grpcPort ? parseInt(grpcPort, 10) : DAPIAddress.DEFAULT_GRPC_PORT,
|
|
18
|
+
port: port ? parseInt(port, 10) : DAPIAddress.DEFAULT_PORT,
|
|
20
19
|
protocol: ssl === 'no-ssl' ? 'http' : DAPIAddress.DEFAULT_PROTOCOL,
|
|
21
20
|
allowSelfSignedCertificate: ssl === 'self-signed',
|
|
22
21
|
};
|
|
@@ -28,8 +27,7 @@ class DAPIAddress {
|
|
|
28
27
|
|
|
29
28
|
this.protocol = address.protocol || DAPIAddress.DEFAULT_PROTOCOL;
|
|
30
29
|
this.host = address.host;
|
|
31
|
-
this.
|
|
32
|
-
this.grpcPort = address.grpcPort || DAPIAddress.DEFAULT_GRPC_PORT;
|
|
30
|
+
this.port = address.port || DAPIAddress.DEFAULT_PORT;
|
|
33
31
|
this.proRegTxHash = address.proRegTxHash;
|
|
34
32
|
this.allowSelfSignedCertificate = address.allowSelfSignedCertificate || false;
|
|
35
33
|
|
|
@@ -68,43 +66,22 @@ class DAPIAddress {
|
|
|
68
66
|
}
|
|
69
67
|
|
|
70
68
|
/**
|
|
71
|
-
* Get
|
|
69
|
+
* Get port
|
|
72
70
|
*
|
|
73
71
|
* @returns {number}
|
|
74
72
|
*/
|
|
75
|
-
|
|
76
|
-
return this.
|
|
73
|
+
getPort() {
|
|
74
|
+
return this.port;
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
/**
|
|
80
|
-
* Set
|
|
78
|
+
* Set port
|
|
81
79
|
*
|
|
82
80
|
* @param {number} port
|
|
83
81
|
* @returns {DAPIAddress}
|
|
84
82
|
*/
|
|
85
|
-
|
|
86
|
-
this.
|
|
87
|
-
|
|
88
|
-
return this;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Get gRPC port
|
|
93
|
-
*
|
|
94
|
-
* @returns {number}
|
|
95
|
-
*/
|
|
96
|
-
getGrpcPort() {
|
|
97
|
-
return this.grpcPort;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Set gRPC port
|
|
102
|
-
*
|
|
103
|
-
* @param {number} port
|
|
104
|
-
* @returns {DAPIAddress}
|
|
105
|
-
*/
|
|
106
|
-
setGrpcPort(port) {
|
|
107
|
-
this.grpcPort = port;
|
|
83
|
+
setPort(port) {
|
|
84
|
+
this.port = port;
|
|
108
85
|
|
|
109
86
|
return this;
|
|
110
87
|
}
|
|
@@ -179,28 +156,25 @@ class DAPIAddress {
|
|
|
179
156
|
return {
|
|
180
157
|
protocol: this.getProtocol(),
|
|
181
158
|
host: this.getHost(),
|
|
182
|
-
|
|
183
|
-
grpcPort: this.getGrpcPort(),
|
|
159
|
+
port: this.getPort(),
|
|
184
160
|
proRegTxHash: this.getProRegTxHash(),
|
|
185
161
|
allowSelfSignedCertificate: this.isSelfSignedCertificateAllowed(),
|
|
186
162
|
};
|
|
187
163
|
}
|
|
188
164
|
|
|
189
165
|
toString() {
|
|
190
|
-
return `${this.getProtocol()}://${this.getHost()}:${this.
|
|
166
|
+
return `${this.getProtocol()}://${this.getHost()}:${this.getPort()}`;
|
|
191
167
|
}
|
|
192
168
|
}
|
|
193
169
|
|
|
194
|
-
DAPIAddress.
|
|
195
|
-
DAPIAddress.
|
|
196
|
-
DAPIAddress.DEFAULT_PROTOCOL = 'http';
|
|
170
|
+
DAPIAddress.DEFAULT_PORT = 3000;
|
|
171
|
+
DAPIAddress.DEFAULT_PROTOCOL = 'https';
|
|
197
172
|
|
|
198
173
|
/**
|
|
199
174
|
* @typedef {object} RawDAPIAddress
|
|
200
175
|
* @property {string} protocol
|
|
201
176
|
* @property {string} host
|
|
202
|
-
* @property {number} [
|
|
203
|
-
* @property {number} [grpcPort=3010]
|
|
177
|
+
* @property {number} [port=3000]
|
|
204
178
|
* @property {string} [proRegTxHash]
|
|
205
179
|
* @property {bool} [selfSigned]
|
|
206
180
|
*/
|
|
@@ -39,8 +39,7 @@ class ListDAPIAddressProvider {
|
|
|
39
39
|
liveAddress.protocol = 'https';
|
|
40
40
|
liveAddress.host = '127.0.0.1';
|
|
41
41
|
liveAddress.allowSelfSignedCertificate = true;
|
|
42
|
-
liveAddress.
|
|
43
|
-
liveAddress.grpcPort = 3010 + randomNodeIndex * 100;
|
|
42
|
+
liveAddress.port = 3000 + randomNodeIndex * 100;
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
return liveAddress;
|