@dashevo/dapi-client 1.0.0-pr.1875.1 → 1.0.0-pr.1902.1
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/docs/_sidebar.md
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
- [.broadcastTransaction()](usage/application/core/broadcastTransaction.md)
|
|
8
8
|
- [.generateToAddress()](usage/application/core/generateToAddress.md)
|
|
9
9
|
- [.getBestBlockHash()](usage/application/core/getBestBlockHash.md)
|
|
10
|
-
- [.getBestBlockHeight()](usage/application/core/getBestBlockHeight.md)
|
|
11
10
|
- [.getBlockByHash()](usage/application/core/getBlockByHash.md)
|
|
12
11
|
- [.getBlockByHeight()](usage/application/core/getBlockByHeight.md)
|
|
13
12
|
- [.getBlockHash()](usage/application/core/getBlockHash.md)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const broadcastTransactionFactory = require('./broadcastTransactionFactory');
|
|
2
2
|
const generateToAddressFactory = require('./generateToAddressFactory');
|
|
3
3
|
const getBestBlockHashFactory = require('./getBestBlockHashFactory');
|
|
4
|
-
const getBestBlockHeightFactory = require('./getBestBlockHeightFactory');
|
|
5
4
|
const getBlockByHashFactory = require('./getBlockByHashFactory');
|
|
6
5
|
const getBlockByHeightFactory = require('./getBlockByHeightFactory');
|
|
7
6
|
const getBlockHashFactory = require('./getBlockHashFactory');
|
|
@@ -21,7 +20,6 @@ class CoreMethodsFacade {
|
|
|
21
20
|
this.broadcastTransaction = broadcastTransactionFactory(grpcTransport);
|
|
22
21
|
this.generateToAddress = generateToAddressFactory(jsonRpcTransport);
|
|
23
22
|
this.getBestBlockHash = getBestBlockHashFactory(jsonRpcTransport);
|
|
24
|
-
this.getBestBlockHeight = getBestBlockHeightFactory(grpcTransport);
|
|
25
23
|
this.getBlockByHash = getBlockByHashFactory(grpcTransport);
|
|
26
24
|
this.getBlockByHeight = getBlockByHeightFactory(grpcTransport);
|
|
27
25
|
this.getBlockHash = getBlockHashFactory(jsonRpcTransport);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashevo/dapi-client",
|
|
3
|
-
"version": "1.0.0-pr.
|
|
3
|
+
"version": "1.0.0-pr.1902.1",
|
|
4
4
|
"description": "Client library used to access Dash DAPI endpoints",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"contributors": [
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
}
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@dashevo/dapi-grpc": "1.0.0-pr.
|
|
30
|
-
"@dashevo/dash-spv": "1.0.0-pr.
|
|
29
|
+
"@dashevo/dapi-grpc": "1.0.0-pr.1902.1",
|
|
30
|
+
"@dashevo/dash-spv": "1.0.0-pr.1902.1",
|
|
31
31
|
"@dashevo/dashcore-lib": "~0.21.1",
|
|
32
|
-
"@dashevo/grpc-common": "1.0.0-pr.
|
|
33
|
-
"@dashevo/wasm-dpp": "1.0.0-pr.
|
|
32
|
+
"@dashevo/grpc-common": "1.0.0-pr.1902.1",
|
|
33
|
+
"@dashevo/wasm-dpp": "1.0.0-pr.1902.1",
|
|
34
34
|
"bs58": "^4.0.1",
|
|
35
35
|
"cbor": "^8.0.0",
|
|
36
36
|
"google-protobuf": "^3.12.2",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"test:integration": "mocha './test/integration/**/*.spec.js'",
|
|
93
93
|
"test:node": "NODE_ENV=test mocha",
|
|
94
94
|
"test:browsers": "karma start ./karma.conf.js --single-run",
|
|
95
|
-
"test:coverage": "NODE_ENV=test nyc --check-coverage --stmts=98 --branch=98 --funcs=98 --lines=
|
|
95
|
+
"test:coverage": "NODE_ENV=test nyc --check-coverage --stmts=98 --branch=98 --funcs=98 --lines=94.99 yarn run mocha 'test/unit/**/*.spec.js' 'test/integration/**/*.spec.js'",
|
|
96
96
|
"prepublishOnly": "yarn run build:web"
|
|
97
97
|
},
|
|
98
98
|
"ultra": {
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
**Usage**: `await client.core.getBestBlockHeight(options)`
|
|
2
|
-
**Description**: Allow to fetch the best (highest/latest block height) from the network
|
|
3
|
-
|
|
4
|
-
Parameters:
|
|
5
|
-
|
|
6
|
-
| parameters | type | required | Description |
|
|
7
|
-
|---------------------------|---------------------|----------------| ------------------------------------------------------------------------------------------------ |
|
|
8
|
-
| **options** | DAPIClientOptions | no | |
|
|
9
|
-
|
|
10
|
-
Returns : {Promise<string>} - The best block height
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const {
|
|
2
|
-
v0: {
|
|
3
|
-
GetBestBlockHeightRequest,
|
|
4
|
-
CorePromiseClient,
|
|
5
|
-
},
|
|
6
|
-
} = require('@dashevo/dapi-grpc');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @param {GrpcTransport} grpcTransport
|
|
11
|
-
* @returns {getBestBlockHeight}
|
|
12
|
-
*/
|
|
13
|
-
function getBestBlockHeightFactory(grpcTransport) {
|
|
14
|
-
/**
|
|
15
|
-
* Returns block height of chain tip
|
|
16
|
-
* @typedef {getBestBlockHeight}
|
|
17
|
-
* @param {DAPIClientOptions} [options]
|
|
18
|
-
* @returns {Promise<string>}
|
|
19
|
-
*/
|
|
20
|
-
async function getBestBlockHeight(options = {}) {
|
|
21
|
-
const response = await grpcTransport.request(
|
|
22
|
-
CorePromiseClient,
|
|
23
|
-
'getBestBlockHeight',
|
|
24
|
-
new GetBestBlockHeightRequest(),
|
|
25
|
-
options,
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
return response.getHeight();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return getBestBlockHeight;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
module.exports = getBestBlockHeightFactory;
|