dash-platform-sdk 1.1.1 → 1.1.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/bundle.min.js +1 -1
- package/package.json +6 -5
- package/proto/generated/platform.d.ts +340 -115
- package/proto/generated/platform.js +3732 -2333
- package/src/DashPlatformSDK.d.ts +18 -5
- package/src/DashPlatformSDK.js +20 -7
- package/src/constants.d.ts +4 -0
- package/src/constants.js +5 -1
- package/src/contestedResources/getContestedResourceVoteState.d.ts +6 -0
- package/src/contestedResources/getContestedResourceVoteState.js +124 -0
- package/src/contestedResources/index.d.ts +29 -0
- package/src/contestedResources/index.js +75 -0
- package/src/dataContracts/create.js +1 -1
- package/src/dataContracts/createStateTransition.d.ts +1 -1
- package/src/dataContracts/createStateTransition.js +5 -6
- package/src/dataContracts/getDataContractByIdentifier.js +5 -5
- package/src/dataContracts/index.d.ts +2 -3
- package/src/dataContracts/index.js +1 -1
- package/src/documents/create.d.ts +1 -1
- package/src/documents/create.js +1 -41
- package/src/documents/createStateTransition.d.ts +2 -2
- package/src/documents/createStateTransition.js +9 -10
- package/src/documents/index.d.ts +3 -3
- package/src/documents/index.js +3 -7
- package/src/documents/query.js +3 -5
- package/src/grpcConnectionPool.d.ts +3 -2
- package/src/grpcConnectionPool.js +52 -48
- package/src/identities/getIdentityBalance.js +4 -4
- package/src/identities/getIdentityByIdentifier.js +4 -4
- package/src/identities/getIdentityByNonUniquePublicKeyHash.d.ts +3 -0
- package/src/identities/getIdentityByNonUniquePublicKeyHash.js +87 -0
- package/src/identities/getIdentityByPublicKeyHash.js +4 -4
- package/src/identities/getIdentityContractNonce.js +4 -4
- package/src/identities/getIdentityNonce.js +4 -4
- package/src/identities/getIdentityPublicKeys.js +4 -4
- package/src/identities/index.d.ts +9 -1
- package/src/identities/index.js +23 -1
- package/src/node/epochs.d.ts +10 -0
- package/src/node/epochs.js +82 -0
- package/src/node/index.d.ts +16 -1
- package/src/node/index.js +35 -1
- package/src/node/totalCredits.d.ts +2 -0
- package/src/node/totalCredits.js +77 -0
- package/src/stateTransitions/broadcast.js +3 -0
- package/src/tokens/getIdentitiesTokenBalances.d.ts +8 -0
- package/src/tokens/getIdentitiesTokenBalances.js +87 -0
- package/src/tokens/getIdentityTokensBalances.d.ts +8 -0
- package/src/tokens/getIdentityTokensBalances.js +87 -0
- package/src/tokens/getTokenContractInfo.d.ts +8 -0
- package/src/tokens/getTokenContractInfo.js +87 -0
- package/src/tokens/getTokenTotalSupply.d.ts +9 -0
- package/src/tokens/getTokenTotalSupply.js +85 -0
- package/src/tokens/index.d.ts +50 -0
- package/src/tokens/index.js +124 -0
- package/src/types.d.ts +30 -0
- package/src/types.js +14 -1
- package/src/utils/indexBytesToString.d.ts +1 -0
- package/src/utils/indexBytesToString.js +7 -0
- package/src/utils/stringToIndexValueBytes.d.ts +1 -0
- package/src/utils/stringToIndexValueBytes.js +13 -0
- package/test/unit/ContestedResources.spec.d.ts +1 -0
- package/test/unit/ContestedResources.spec.js +257 -0
- package/test/unit/DataContract.spec.js +16 -6
- package/test/unit/DocumentsBatch.spec.js +6 -6
- package/test/unit/Identity.spec.js +15 -3
- package/test/unit/Node.spec.js +40 -0
- package/test/unit/Tokens.spec.d.ts +1 -0
- package/test/unit/Tokens.spec.js +100 -0
package/src/documents/index.js
CHANGED
|
@@ -38,7 +38,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.DocumentsController = void 0;
|
|
40
40
|
var create_1 = require("./create");
|
|
41
|
-
var pshenmic_dpp_1 = require("pshenmic-dpp");
|
|
42
41
|
var createStateTransition_1 = require("./createStateTransition");
|
|
43
42
|
var query_1 = require("./query");
|
|
44
43
|
/**
|
|
@@ -64,10 +63,7 @@ var DocumentsController = /** @class */ (function () {
|
|
|
64
63
|
DocumentsController.prototype.create = function (dataContractId, documentType, data, owner, revision) {
|
|
65
64
|
return __awaiter(this, void 0, void 0, function () {
|
|
66
65
|
return __generator(this, function (_a) {
|
|
67
|
-
|
|
68
|
-
case 0: return [4 /*yield*/, (0, create_1.default)(dataContractId, documentType, data, owner, revision)];
|
|
69
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
70
|
-
}
|
|
66
|
+
return [2 /*return*/, (0, create_1.default)(dataContractId, documentType, data, owner, revision)];
|
|
71
67
|
});
|
|
72
68
|
});
|
|
73
69
|
};
|
|
@@ -107,12 +103,12 @@ var DocumentsController = /** @class */ (function () {
|
|
|
107
103
|
* 6) Purchase - purchase a document from identity (if price was set)
|
|
108
104
|
*
|
|
109
105
|
* @param document {DocumentWASM} Instance of the document to make transition with
|
|
110
|
-
* @param batchType {
|
|
106
|
+
* @param batchType {string} Type of the document transition, must be a one of ('create' | 'replace' | 'delete' |'updatePrice' |'transfer' | 'purchase')
|
|
111
107
|
* @param identityContractNonce {bigint} Identity contract nonce
|
|
112
108
|
* @param params {CreateStateTransitionDocumentBatchParams=} Additional params, required for Transfer, SetPrice, Purchase transitions
|
|
113
109
|
*/
|
|
114
110
|
DocumentsController.prototype.createStateTransition = function (document, batchType, identityContractNonce, params) {
|
|
115
|
-
if ([
|
|
111
|
+
if (['transfer', 'updatePrice', 'purchase'].includes(batchType) && params == null) {
|
|
116
112
|
throw new Error('Params required for Transfer, UpdatePrice or Purchase document transitions');
|
|
117
113
|
}
|
|
118
114
|
return (0, createStateTransition_1.default)(document, batchType, identityContractNonce, params);
|
package/src/documents/query.js
CHANGED
|
@@ -80,17 +80,15 @@ function query(grpcPool_1, dataContractId_1, documentTypeName_1, where_1, orderB
|
|
|
80
80
|
throw new Error('Metadata not found');
|
|
81
81
|
}
|
|
82
82
|
startAtIncluded = ((_c = getDocumentsRequest.v0) === null || _c === void 0 ? void 0 : _c.startAfter) == null;
|
|
83
|
-
_b = (0, wasm_drive_verify_1.verifyDocumentProof)(proof.grovedbProof, dataContract.bytes(pshenmic_dpp_1.PlatformVersionWASM.
|
|
83
|
+
_b = (0, wasm_drive_verify_1.verifyDocumentProof)(proof.grovedbProof, dataContract.bytes(pshenmic_dpp_1.PlatformVersionWASM.PLATFORM_V9), documentTypeName, where, orderBy, limit, (_d = getDocumentsRequest.v0) === null || _d === void 0 ? void 0 : _d.startAt, startAtIncluded, BigInt(metadata === null || metadata === void 0 ? void 0 : metadata.timeMs), pshenmic_dpp_1.PlatformVersionWASM.PLATFORM_V9), rootHash = _b.root_hash, documents = _b.documents;
|
|
84
84
|
return [4 /*yield*/, (0, getQuorumPublicKey_1.getQuorumPublicKey)(proof.quorumType, (0, bytesToHex_1.default)(proof.quorumHash))];
|
|
85
85
|
case 3:
|
|
86
86
|
quorumPublicKey = _f.sent();
|
|
87
|
-
|
|
88
|
-
case 4:
|
|
89
|
-
verify = _f.sent();
|
|
87
|
+
verify = (0, verifyTenderdashProof_1.default)(proof, metadata, rootHash, quorumPublicKey);
|
|
90
88
|
if (!verify) {
|
|
91
89
|
throw new Error('Failed to verify query');
|
|
92
90
|
}
|
|
93
|
-
return [2 /*return*/, (_e = documents === null || documents === void 0 ? void 0 : documents.map(function (document) { return pshenmic_dpp_1.DocumentWASM.fromBytes(document, dataContract, documentTypeName, pshenmic_dpp_1.PlatformVersionWASM.
|
|
91
|
+
return [2 /*return*/, (_e = documents === null || documents === void 0 ? void 0 : documents.map(function (document) { return pshenmic_dpp_1.DocumentWASM.fromBytes(document, dataContract, documentTypeName, pshenmic_dpp_1.PlatformVersionWASM.PLATFORM_V9); })) !== null && _e !== void 0 ? _e : []];
|
|
94
92
|
}
|
|
95
93
|
});
|
|
96
94
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Channel, Client } from 'nice-grpc-web';
|
|
2
2
|
import { PlatformDefinition } from '../proto/generated/platform';
|
|
3
|
+
import { GRPCOptions } from './DashPlatformSDK';
|
|
3
4
|
export default class GRPCConnectionPool {
|
|
4
5
|
channels: Channel[];
|
|
5
|
-
constructor(network: 'testnet' | 'mainnet',
|
|
6
|
-
|
|
6
|
+
constructor(network: 'testnet' | 'mainnet', grpcOptions?: GRPCOptions);
|
|
7
|
+
_initialize(network: 'testnet' | 'mainnet', poolLimit: number, dapiUrl?: string | string[]): Promise<void>;
|
|
7
8
|
getClient(): Client<PlatformDefinition>;
|
|
8
9
|
}
|
|
@@ -35,20 +35,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
39
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40
|
-
if (ar || !(i in from)) {
|
|
41
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42
|
-
ar[i] = from[i];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
|
-
};
|
|
47
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
39
|
var getRandomArrayItem_1 = require("./utils/getRandomArrayItem");
|
|
49
40
|
var nice_grpc_web_1 = require("nice-grpc-web");
|
|
50
41
|
var platform_1 = require("../proto/generated/platform");
|
|
51
42
|
var getEvonodeList_1 = require("./utils/getEvonodeList");
|
|
43
|
+
var constants_1 = require("./constants");
|
|
52
44
|
var seedNodes = {
|
|
53
45
|
testnet: [
|
|
54
46
|
// seed-1.pshenmic.dev
|
|
@@ -64,36 +56,36 @@ var seedNodes = {
|
|
|
64
56
|
]
|
|
65
57
|
};
|
|
66
58
|
var GRPCConnectionPool = /** @class */ (function () {
|
|
67
|
-
function GRPCConnectionPool(network,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this._loadRecentEvonodeList(network)
|
|
72
|
-
.catch(console.error);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (typeof dapiUrl === 'string') {
|
|
76
|
-
this.channels = [(0, nice_grpc_web_1.createChannel)(dapiUrl)];
|
|
77
|
-
}
|
|
78
|
-
else if (Array.isArray(dapiUrl)) {
|
|
79
|
-
this.channels = dapiUrl.map(function (dapiUrl) { return (0, nice_grpc_web_1.createChannel)(dapiUrl); });
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
throw new Error('Invalid dapiUrl');
|
|
83
|
-
}
|
|
59
|
+
function GRPCConnectionPool(network, grpcOptions) {
|
|
60
|
+
var _a;
|
|
61
|
+
var grpcPoolLimit = (_a = grpcOptions === null || grpcOptions === void 0 ? void 0 : grpcOptions.poolLimit) !== null && _a !== void 0 ? _a : constants_1.GRPC_DEFAULT_POOL_LIMIT;
|
|
62
|
+
this._initialize(network, grpcPoolLimit, grpcOptions === null || grpcOptions === void 0 ? void 0 : grpcOptions.dapiUrl).catch(console.error);
|
|
84
63
|
}
|
|
85
|
-
GRPCConnectionPool.prototype.
|
|
64
|
+
GRPCConnectionPool.prototype._initialize = function (network, poolLimit, dapiUrl) {
|
|
86
65
|
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
-
var evonodeList,
|
|
88
|
-
var _this = this;
|
|
66
|
+
var evonodeList, networkDAPIUrls, _i, networkDAPIUrls_1, url, channel, client, response, v0, e_1;
|
|
89
67
|
return __generator(this, function (_a) {
|
|
90
68
|
switch (_a.label) {
|
|
91
|
-
case 0:
|
|
92
|
-
|
|
93
|
-
|
|
69
|
+
case 0:
|
|
70
|
+
if (typeof dapiUrl === 'string') {
|
|
71
|
+
this.channels = [(0, nice_grpc_web_1.createChannel)(dapiUrl)];
|
|
72
|
+
return [2 /*return*/];
|
|
73
|
+
}
|
|
74
|
+
if (Array.isArray(dapiUrl)) {
|
|
75
|
+
this.channels = dapiUrl.map(function (dapiUrl) { return (0, nice_grpc_web_1.createChannel)(dapiUrl); });
|
|
76
|
+
return [2 /*return*/];
|
|
77
|
+
}
|
|
78
|
+
if (dapiUrl != null) {
|
|
79
|
+
throw new Error('Unrecognized DAPI URL');
|
|
80
|
+
}
|
|
81
|
+
// Add default seed nodes
|
|
82
|
+
this.channels = (seedNodes[network].map(function (dapiUrl) { return (0, nice_grpc_web_1.createChannel)(dapiUrl); }));
|
|
83
|
+
return [4 /*yield*/, (0, getEvonodeList_1.default)(network)
|
|
84
|
+
// map it to array of dapiUrls
|
|
85
|
+
];
|
|
94
86
|
case 1:
|
|
95
87
|
evonodeList = _a.sent();
|
|
96
|
-
|
|
88
|
+
networkDAPIUrls = Object.entries(evonodeList)
|
|
97
89
|
.map(function (_a) {
|
|
98
90
|
var info = _a[1];
|
|
99
91
|
return info;
|
|
@@ -103,22 +95,34 @@ var GRPCConnectionPool = /** @class */ (function () {
|
|
|
103
95
|
var host = info.address.split(':')[0];
|
|
104
96
|
return "https://".concat(host, ":").concat(info.platformHTTPPort);
|
|
105
97
|
});
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
switch (_a.label) {
|
|
109
|
-
case 0: return [4 /*yield*/, fetch(dapiUrl)];
|
|
110
|
-
case 1:
|
|
111
|
-
_a.sent();
|
|
112
|
-
return [2 /*return*/, dapiUrl];
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}); }))];
|
|
98
|
+
_i = 0, networkDAPIUrls_1 = networkDAPIUrls;
|
|
99
|
+
_a.label = 2;
|
|
116
100
|
case 2:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
101
|
+
if (!(_i < networkDAPIUrls_1.length)) return [3 /*break*/, 7];
|
|
102
|
+
url = networkDAPIUrls_1[_i];
|
|
103
|
+
if (this.channels.length > poolLimit) {
|
|
104
|
+
return [3 /*break*/, 7];
|
|
105
|
+
}
|
|
106
|
+
_a.label = 3;
|
|
107
|
+
case 3:
|
|
108
|
+
_a.trys.push([3, 5, , 6]);
|
|
109
|
+
channel = (0, nice_grpc_web_1.createChannel)(url);
|
|
110
|
+
client = (0, nice_grpc_web_1.createClient)(platform_1.PlatformDefinition, channel);
|
|
111
|
+
return [4 /*yield*/, client.getStatus(platform_1.GetStatusRequest.fromPartial({ v0: {} }))];
|
|
112
|
+
case 4:
|
|
113
|
+
response = _a.sent();
|
|
114
|
+
v0 = response.v0;
|
|
115
|
+
if ((v0 === null || v0 === void 0 ? void 0 : v0.chain) != null) {
|
|
116
|
+
this.channels.push((0, nice_grpc_web_1.createChannel)(url));
|
|
117
|
+
}
|
|
118
|
+
return [3 /*break*/, 6];
|
|
119
|
+
case 5:
|
|
120
|
+
e_1 = _a.sent();
|
|
121
|
+
return [3 /*break*/, 6];
|
|
122
|
+
case 6:
|
|
123
|
+
_i++;
|
|
124
|
+
return [3 /*break*/, 2];
|
|
125
|
+
case 7: return [2 /*return*/];
|
|
122
126
|
}
|
|
123
127
|
});
|
|
124
128
|
});
|
|
@@ -66,7 +66,10 @@ function getIdentityBalance(grpcPool, identifier) {
|
|
|
66
66
|
if (metadata == null) {
|
|
67
67
|
throw new Error('Metadata not found');
|
|
68
68
|
}
|
|
69
|
-
_b = (0, wasm_drive_verify_1.verifyIdentityBalanceForIdentityId)(proof.grovedbProof, id.bytes(), true, pshenmic_dpp_1.PlatformVersionWASM.
|
|
69
|
+
_b = (0, wasm_drive_verify_1.verifyIdentityBalanceForIdentityId)(proof.grovedbProof, id.bytes(), true, pshenmic_dpp_1.PlatformVersionWASM.PLATFORM_V9), rootHash = _b.root_hash, balance = _b.balance;
|
|
70
|
+
if (balance == null) {
|
|
71
|
+
throw new Error("Failed to fetch balance for identifier ".concat(id.base58()));
|
|
72
|
+
}
|
|
70
73
|
return [4 /*yield*/, (0, getQuorumPublicKey_1.getQuorumPublicKey)(proof.quorumType, (0, bytesToHex_1.default)(proof.quorumHash))];
|
|
71
74
|
case 2:
|
|
72
75
|
quorumPublicKey = _c.sent();
|
|
@@ -74,9 +77,6 @@ function getIdentityBalance(grpcPool, identifier) {
|
|
|
74
77
|
if (!verify) {
|
|
75
78
|
throw new Error('Failed to verify query');
|
|
76
79
|
}
|
|
77
|
-
if (balance == null) {
|
|
78
|
-
throw new Error("Failed to fetch balance for identifier ".concat(id.base58()));
|
|
79
|
-
}
|
|
80
80
|
return [2 /*return*/, BigInt(balance)];
|
|
81
81
|
}
|
|
82
82
|
});
|
|
@@ -66,7 +66,10 @@ function getIdentityByIdentifier(grpcPool, identifier) {
|
|
|
66
66
|
if (metadata == null) {
|
|
67
67
|
throw new Error('Metadata not found');
|
|
68
68
|
}
|
|
69
|
-
_b = (0, wasm_drive_verify_1.verifyFullIdentityByIdentityId)(proof.grovedbProof, true, id.bytes(), pshenmic_dpp_1.PlatformVersionWASM.
|
|
69
|
+
_b = (0, wasm_drive_verify_1.verifyFullIdentityByIdentityId)(proof.grovedbProof, true, id.bytes(), pshenmic_dpp_1.PlatformVersionWASM.PLATFORM_V9), rootHash = _b.root_hash, identity = _b.identity;
|
|
70
|
+
if (identity == null) {
|
|
71
|
+
throw new Error("Identity with identifier ".concat(id.base58(), " not found"));
|
|
72
|
+
}
|
|
70
73
|
return [4 /*yield*/, (0, getQuorumPublicKey_1.getQuorumPublicKey)(proof.quorumType, (0, bytesToHex_1.default)(proof.quorumHash))];
|
|
71
74
|
case 2:
|
|
72
75
|
quorumPublicKey = _c.sent();
|
|
@@ -74,9 +77,6 @@ function getIdentityByIdentifier(grpcPool, identifier) {
|
|
|
74
77
|
if (!verify) {
|
|
75
78
|
throw new Error('Failed to verify query');
|
|
76
79
|
}
|
|
77
|
-
if (identity == null) {
|
|
78
|
-
throw new Error("Identity with identifier ".concat(id.base58(), " not found"));
|
|
79
|
-
}
|
|
80
80
|
return [2 /*return*/, pshenmic_dpp_1.IdentityWASM.fromBytes(identity)];
|
|
81
81
|
}
|
|
82
82
|
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.default = getIdentityByNonUniquePublicKeyHash;
|
|
40
|
+
var platform_1 = require("../../proto/generated/platform");
|
|
41
|
+
var pshenmic_dpp_1 = require("pshenmic-dpp");
|
|
42
|
+
var hexToBytes_1 = require("../utils/hexToBytes");
|
|
43
|
+
var wasm_drive_verify_1 = require("wasm-drive-verify");
|
|
44
|
+
var getQuorumPublicKey_1 = require("../utils/getQuorumPublicKey");
|
|
45
|
+
var bytesToHex_1 = require("../utils/bytesToHex");
|
|
46
|
+
var verifyTenderdashProof_1 = require("../utils/verifyTenderdashProof");
|
|
47
|
+
var getIdentityByIdentifier_1 = require("./getIdentityByIdentifier");
|
|
48
|
+
function getIdentityByNonUniquePublicKeyHash(grpcPool, hex) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
var getIdentityByNonUniquePublicKeyHashRequest, v0, _a, proof, metadata, _b, rootHash, identityId, identifier, quorumPublicKey, verify;
|
|
51
|
+
return __generator(this, function (_c) {
|
|
52
|
+
switch (_c.label) {
|
|
53
|
+
case 0:
|
|
54
|
+
getIdentityByNonUniquePublicKeyHashRequest = platform_1.GetIdentityByNonUniquePublicKeyHashRequest.fromPartial({
|
|
55
|
+
v0: {
|
|
56
|
+
publicKeyHash: (0, hexToBytes_1.default)(hex),
|
|
57
|
+
prove: true
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return [4 /*yield*/, grpcPool.getClient().getIdentityByNonUniquePublicKeyHash(getIdentityByNonUniquePublicKeyHashRequest)];
|
|
61
|
+
case 1:
|
|
62
|
+
v0 = (_c.sent()).v0;
|
|
63
|
+
_a = v0, proof = _a.proof, metadata = _a.metadata;
|
|
64
|
+
if ((proof === null || proof === void 0 ? void 0 : proof.grovedbIdentityPublicKeyHashProof) == null) {
|
|
65
|
+
throw new Error('Proof not found');
|
|
66
|
+
}
|
|
67
|
+
if (metadata == null) {
|
|
68
|
+
throw new Error('Metadata not found');
|
|
69
|
+
}
|
|
70
|
+
_b = (0, wasm_drive_verify_1.verifyIdentityIdByNonUniquePublicKeyHash)(proof.grovedbIdentityPublicKeyHashProof.grovedbProof, false, (0, hexToBytes_1.default)(hex), undefined, pshenmic_dpp_1.PlatformVersionWASM.PLATFORM_V9), rootHash = _b.root_hash, identityId = _b.identity_id;
|
|
71
|
+
if (identityId == null) {
|
|
72
|
+
throw new Error("Identity with non unique public key hash ".concat(hex, " not found"));
|
|
73
|
+
}
|
|
74
|
+
identifier = new pshenmic_dpp_1.IdentifierWASM(identityId);
|
|
75
|
+
return [4 /*yield*/, (0, getQuorumPublicKey_1.getQuorumPublicKey)(proof.grovedbIdentityPublicKeyHashProof.quorumType, (0, bytesToHex_1.default)(proof.grovedbIdentityPublicKeyHashProof.quorumHash))];
|
|
76
|
+
case 2:
|
|
77
|
+
quorumPublicKey = _c.sent();
|
|
78
|
+
verify = (0, verifyTenderdashProof_1.default)(proof.grovedbIdentityPublicKeyHashProof, metadata, rootHash, quorumPublicKey);
|
|
79
|
+
if (!verify) {
|
|
80
|
+
throw new Error('Failed to verify query');
|
|
81
|
+
}
|
|
82
|
+
return [4 /*yield*/, (0, getIdentityByIdentifier_1.default)(grpcPool, identifier)];
|
|
83
|
+
case 3: return [2 /*return*/, _c.sent()];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
@@ -66,7 +66,10 @@ function getIdentityByPublicKeyHash(grpcPool, hex) {
|
|
|
66
66
|
if (metadata == null) {
|
|
67
67
|
throw new Error('Metadata not found');
|
|
68
68
|
}
|
|
69
|
-
_b = (0, wasm_drive_verify_1.verifyFullIdentityByUniquePublicKeyHash)(proof.grovedbProof, (0, hexToBytes_1.default)(hex), pshenmic_dpp_1.PlatformVersionWASM.
|
|
69
|
+
_b = (0, wasm_drive_verify_1.verifyFullIdentityByUniquePublicKeyHash)(proof.grovedbProof, (0, hexToBytes_1.default)(hex), pshenmic_dpp_1.PlatformVersionWASM.PLATFORM_V9), rootHash = _b.root_hash, identity = _b.identity;
|
|
70
|
+
if (identity == null) {
|
|
71
|
+
throw new Error("Identity with public key hash ".concat(hex, " not found"));
|
|
72
|
+
}
|
|
70
73
|
return [4 /*yield*/, (0, getQuorumPublicKey_1.getQuorumPublicKey)(proof.quorumType, (0, bytesToHex_1.default)(proof.quorumHash))];
|
|
71
74
|
case 2:
|
|
72
75
|
quorumPublicKey = _c.sent();
|
|
@@ -74,9 +77,6 @@ function getIdentityByPublicKeyHash(grpcPool, hex) {
|
|
|
74
77
|
if (!verify) {
|
|
75
78
|
throw new Error('Failed to verify query');
|
|
76
79
|
}
|
|
77
|
-
if (identity == null) {
|
|
78
|
-
throw new Error("Identity with public key hash ".concat(hex, " not found"));
|
|
79
|
-
}
|
|
80
80
|
return [2 /*return*/, pshenmic_dpp_1.IdentityWASM.fromBytes(identity)];
|
|
81
81
|
}
|
|
82
82
|
});
|
|
@@ -69,7 +69,10 @@ function getIdentityContractNonce(grpcPool, identity, dataContract) {
|
|
|
69
69
|
if (metadata == null) {
|
|
70
70
|
throw new Error('Metadata not found');
|
|
71
71
|
}
|
|
72
|
-
_b = (0, wasm_drive_verify_1.verifyIdentityContractNonce)(proof.grovedbProof, identityIdentifier.bytes(), dataContractIdentifier.bytes(), true, pshenmic_dpp_1.PlatformVersionWASM.
|
|
72
|
+
_b = (0, wasm_drive_verify_1.verifyIdentityContractNonce)(proof.grovedbProof, identityIdentifier.bytes(), dataContractIdentifier.bytes(), true, pshenmic_dpp_1.PlatformVersionWASM.PLATFORM_V9), rootHash = _b.root_hash, identityContractNonce = _b.nonce;
|
|
73
|
+
if (identityContractNonce == null) {
|
|
74
|
+
return [2 /*return*/, BigInt(0)];
|
|
75
|
+
}
|
|
73
76
|
return [4 /*yield*/, (0, getQuorumPublicKey_1.getQuorumPublicKey)(proof.quorumType, (0, bytesToHex_1.default)(proof.quorumHash))];
|
|
74
77
|
case 2:
|
|
75
78
|
quorumPublicKey = _c.sent();
|
|
@@ -77,9 +80,6 @@ function getIdentityContractNonce(grpcPool, identity, dataContract) {
|
|
|
77
80
|
if (!verify) {
|
|
78
81
|
throw new Error('Failed to verify query');
|
|
79
82
|
}
|
|
80
|
-
if (identityContractNonce == null) {
|
|
81
|
-
throw new Error("Could not get identityContractNonce for Identity with identifier ".concat(identityIdentifier.base58()));
|
|
82
|
-
}
|
|
83
83
|
return [2 /*return*/, BigInt(identityContractNonce) & IDENTITY_CONTRACT_NONCE_VALUE_FILTER];
|
|
84
84
|
}
|
|
85
85
|
});
|
|
@@ -67,7 +67,10 @@ function getIdentityNonce(grpcPool, identifier) {
|
|
|
67
67
|
if (metadata == null) {
|
|
68
68
|
throw new Error('Metadata not found');
|
|
69
69
|
}
|
|
70
|
-
_b = (0, wasm_drive_verify_1.verifyIdentityNonce)(proof.grovedbProof, id.bytes(), true, pshenmic_dpp_1.PlatformVersionWASM.
|
|
70
|
+
_b = (0, wasm_drive_verify_1.verifyIdentityNonce)(proof.grovedbProof, id.bytes(), true, pshenmic_dpp_1.PlatformVersionWASM.PLATFORM_V9), rootHash = _b.root_hash, nonce = _b.nonce;
|
|
71
|
+
if (nonce == null) {
|
|
72
|
+
return [2 /*return*/, BigInt(0)];
|
|
73
|
+
}
|
|
71
74
|
return [4 /*yield*/, (0, getQuorumPublicKey_1.getQuorumPublicKey)(proof.quorumType, (0, bytesToHex_1.default)(proof.quorumHash))];
|
|
72
75
|
case 2:
|
|
73
76
|
quorumPublicKey = _c.sent();
|
|
@@ -75,9 +78,6 @@ function getIdentityNonce(grpcPool, identifier) {
|
|
|
75
78
|
if (!verify) {
|
|
76
79
|
throw new Error('Failed to verify query');
|
|
77
80
|
}
|
|
78
|
-
if (nonce == null) {
|
|
79
|
-
throw new Error("Could not get identityNonce for Identity with identifier ".concat(id.base58()));
|
|
80
|
-
}
|
|
81
81
|
return [2 /*return*/, BigInt(nonce) & IDENTITY_NONCE_VALUE_FILTER];
|
|
82
82
|
}
|
|
83
83
|
});
|
|
@@ -67,7 +67,10 @@ function getIdentityPublicKeys(grpcPool, identifier) {
|
|
|
67
67
|
if (metadata == null) {
|
|
68
68
|
throw new Error('Metadata not found');
|
|
69
69
|
}
|
|
70
|
-
_b = (0, wasm_drive_verify_1.verifyIdentityKeysByIdentityId)(proof.grovedbProof, id.bytes(), null, false, false, true, null, null, pshenmic_dpp_1.PlatformVersionWASM.
|
|
70
|
+
_b = (0, wasm_drive_verify_1.verifyIdentityKeysByIdentityId)(proof.grovedbProof, id.bytes(), null, false, false, true, null, null, pshenmic_dpp_1.PlatformVersionWASM.PLATFORM_V9), rootHash = _b.root_hash, loadedIdentityKeys = _b.loaded_identity_keys;
|
|
71
|
+
if (loadedIdentityKeys == null) {
|
|
72
|
+
throw new Error("Identity with identifier ".concat(id.base58(), " not found"));
|
|
73
|
+
}
|
|
71
74
|
return [4 /*yield*/, (0, getQuorumPublicKey_1.getQuorumPublicKey)(proof.quorumType, (0, bytesToHex_1.default)(proof.quorumHash))];
|
|
72
75
|
case 2:
|
|
73
76
|
quorumPublicKey = _c.sent();
|
|
@@ -75,9 +78,6 @@ function getIdentityPublicKeys(grpcPool, identifier) {
|
|
|
75
78
|
if (!verify) {
|
|
76
79
|
throw new Error('Failed to verify query');
|
|
77
80
|
}
|
|
78
|
-
if (loadedIdentityKeys == null) {
|
|
79
|
-
throw new Error("Identity with identifier ".concat(id.base58(), " not found"));
|
|
80
|
-
}
|
|
81
81
|
return [2 /*return*/, loadedIdentityKeys.map(function (loadedIdentityKey) { return pshenmic_dpp_1.IdentityPublicKeyWASM.fromBytes(loadedIdentityKey); })];
|
|
82
82
|
}
|
|
83
83
|
});
|
|
@@ -21,11 +21,19 @@ export declare class IdentitiesController {
|
|
|
21
21
|
/**
|
|
22
22
|
* Retrieves an Identity from the network by give public key hash
|
|
23
23
|
*
|
|
24
|
-
* @param hex {string
|
|
24
|
+
* @param hex {string} public key hash value in hex, should be a length of 40
|
|
25
25
|
*
|
|
26
26
|
* @return {Promise<IdentityWASM>}
|
|
27
27
|
*/
|
|
28
28
|
getIdentityByPublicKeyHash(hex: string): Promise<IdentityWASM>;
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves an Identity from the network by non-unique public key hash (like Voter Identity, SHA160)
|
|
31
|
+
*
|
|
32
|
+
* @param hex {string} public key hash value in hex, should be a length of 40
|
|
33
|
+
*
|
|
34
|
+
* @return {Promise<IdentityWASM>}
|
|
35
|
+
*/
|
|
36
|
+
getIdentityByNonUniquePublicKeyHash(hex: string): Promise<IdentityWASM>;
|
|
29
37
|
/**
|
|
30
38
|
* Retrieves Identity by identifier from the network
|
|
31
39
|
* @param identifier {IdentifierLike} identifier
|
package/src/identities/index.js
CHANGED
|
@@ -43,6 +43,7 @@ var getIdentityNonce_1 = require("./getIdentityNonce");
|
|
|
43
43
|
var getIdentityBalance_1 = require("./getIdentityBalance");
|
|
44
44
|
var getIdentityByPublicKeyHash_1 = require("./getIdentityByPublicKeyHash");
|
|
45
45
|
var getIdentityByIdentifier_1 = require("./getIdentityByIdentifier");
|
|
46
|
+
var getIdentityByNonUniquePublicKeyHash_1 = require("./getIdentityByNonUniquePublicKeyHash");
|
|
46
47
|
/**
|
|
47
48
|
* Collection of methods to query identities and its related data
|
|
48
49
|
*
|
|
@@ -72,7 +73,7 @@ var IdentitiesController = /** @class */ (function () {
|
|
|
72
73
|
/**
|
|
73
74
|
* Retrieves an Identity from the network by give public key hash
|
|
74
75
|
*
|
|
75
|
-
* @param hex {string
|
|
76
|
+
* @param hex {string} public key hash value in hex, should be a length of 40
|
|
76
77
|
*
|
|
77
78
|
* @return {Promise<IdentityWASM>}
|
|
78
79
|
*/
|
|
@@ -90,6 +91,27 @@ var IdentitiesController = /** @class */ (function () {
|
|
|
90
91
|
});
|
|
91
92
|
});
|
|
92
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* Retrieves an Identity from the network by non-unique public key hash (like Voter Identity, SHA160)
|
|
96
|
+
*
|
|
97
|
+
* @param hex {string} public key hash value in hex, should be a length of 40
|
|
98
|
+
*
|
|
99
|
+
* @return {Promise<IdentityWASM>}
|
|
100
|
+
*/
|
|
101
|
+
IdentitiesController.prototype.getIdentityByNonUniquePublicKeyHash = function (hex) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
+
return __generator(this, function (_a) {
|
|
104
|
+
switch (_a.label) {
|
|
105
|
+
case 0:
|
|
106
|
+
if (hex.length !== 40) {
|
|
107
|
+
throw new Error('Public key hash should equal 40');
|
|
108
|
+
}
|
|
109
|
+
return [4 /*yield*/, (0, getIdentityByNonUniquePublicKeyHash_1.default)(this.grpcPool, hex)];
|
|
110
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
};
|
|
93
115
|
/**
|
|
94
116
|
* Retrieves Identity by identifier from the network
|
|
95
117
|
* @param identifier {IdentifierLike} identifier
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import GRPCConnectionPool from '../grpcConnectionPool';
|
|
2
|
+
export interface EpochInfo {
|
|
3
|
+
number: number;
|
|
4
|
+
firstBlockHeight: number;
|
|
5
|
+
firstCoreBlockHeight: number;
|
|
6
|
+
startTime: bigint;
|
|
7
|
+
feeMultiplier: bigint;
|
|
8
|
+
protocolVersion: 9;
|
|
9
|
+
}
|
|
10
|
+
export default function epochs(grpcPool: GRPCConnectionPool, count: number, ascending: boolean, start?: number): Promise<EpochInfo[]>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.default = epochs;
|
|
40
|
+
var platform_1 = require("../../proto/generated/platform");
|
|
41
|
+
var wasm_drive_verify_1 = require("wasm-drive-verify");
|
|
42
|
+
var pshenmic_dpp_1 = require("pshenmic-dpp");
|
|
43
|
+
var getQuorumPublicKey_1 = require("../utils/getQuorumPublicKey");
|
|
44
|
+
var bytesToHex_1 = require("../utils/bytesToHex");
|
|
45
|
+
var verifyTenderdashProof_1 = require("../utils/verifyTenderdashProof");
|
|
46
|
+
function epochs(grpcPool, count, ascending, start) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
+
var request, v0, _a, proof, metadata, _b, rootHash, epochInfos, quorumPublicKey, verify;
|
|
49
|
+
return __generator(this, function (_c) {
|
|
50
|
+
switch (_c.label) {
|
|
51
|
+
case 0:
|
|
52
|
+
request = platform_1.GetEpochsInfoRequest.fromPartial({
|
|
53
|
+
v0: {
|
|
54
|
+
startEpoch: start,
|
|
55
|
+
count: count,
|
|
56
|
+
ascending: ascending,
|
|
57
|
+
prove: true
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return [4 /*yield*/, grpcPool.getClient().getEpochsInfo(request)];
|
|
61
|
+
case 1:
|
|
62
|
+
v0 = (_c.sent()).v0;
|
|
63
|
+
_a = v0, proof = _a.proof, metadata = _a.metadata;
|
|
64
|
+
if (proof == null) {
|
|
65
|
+
throw new Error('Proof not found');
|
|
66
|
+
}
|
|
67
|
+
if (metadata == null) {
|
|
68
|
+
throw new Error('Metadata not found');
|
|
69
|
+
}
|
|
70
|
+
_b = (0, wasm_drive_verify_1.verifyEpochInfos)(proof.grovedbProof, metadata.epoch, start, count, ascending, pshenmic_dpp_1.PlatformVersionWASM.PLATFORM_V9), rootHash = _b.root_hash, epochInfos = _b.epoch_infos;
|
|
71
|
+
return [4 /*yield*/, (0, getQuorumPublicKey_1.getQuorumPublicKey)(proof.quorumType, (0, bytesToHex_1.default)(proof.quorumHash))];
|
|
72
|
+
case 2:
|
|
73
|
+
quorumPublicKey = _c.sent();
|
|
74
|
+
verify = (0, verifyTenderdashProof_1.default)(proof, metadata, rootHash, quorumPublicKey);
|
|
75
|
+
if (!verify) {
|
|
76
|
+
throw new Error('Failed to verify query');
|
|
77
|
+
}
|
|
78
|
+
return [2 /*return*/, epochInfos];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
package/src/node/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import GRPCConnectionPool from '../grpcConnectionPool';
|
|
2
2
|
import { NodeStatus } from '../types';
|
|
3
|
+
import { EpochInfo } from './epochs';
|
|
3
4
|
/**
|
|
4
5
|
* Node controller for requesting information about DAPI node
|
|
5
6
|
*
|
|
@@ -8,7 +9,8 @@ import { NodeStatus } from '../types';
|
|
|
8
9
|
export declare class NodeController {
|
|
9
10
|
/** @ignore **/
|
|
10
11
|
grpcPool: GRPCConnectionPool;
|
|
11
|
-
|
|
12
|
+
network: 'testnet' | 'mainnet';
|
|
13
|
+
constructor(grpcPool: GRPCConnectionPool, network: 'testnet' | 'mainnet');
|
|
12
14
|
/**
|
|
13
15
|
* Retrieves an info about node
|
|
14
16
|
* Includes information about genesis, chain, software versions
|
|
@@ -16,4 +18,17 @@ export declare class NodeController {
|
|
|
16
18
|
* @return {Promise<NodeStatus>}
|
|
17
19
|
*/
|
|
18
20
|
status(): Promise<NodeStatus>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns total credits amount in platform
|
|
23
|
+
*
|
|
24
|
+
* @return {Promise<bigint>}
|
|
25
|
+
*/
|
|
26
|
+
totalCredits(): Promise<bigint>;
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves an info about epochs
|
|
29
|
+
* Includes information about first block height, time, fee multiplier, number
|
|
30
|
+
*
|
|
31
|
+
* @return {Promise<EpochInfo[]>}
|
|
32
|
+
*/
|
|
33
|
+
getEpochsInfo(count: number, ascending: boolean, start?: number): Promise<EpochInfo[]>;
|
|
19
34
|
}
|