@dashevo/dapi-grpc 2.0.0-dev.1 → 2.0.0-rc.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.
@@ -103,15 +103,6 @@ type PlatformgetEvonodesProposedEpochBlocksByRange = {
103
103
  readonly responseType: typeof platform_pb.GetEvonodesProposedEpochBlocksResponse;
104
104
  };
105
105
 
106
- type PlatformgetProofs = {
107
- readonly methodName: string;
108
- readonly service: typeof Platform;
109
- readonly requestStream: false;
110
- readonly responseStream: false;
111
- readonly requestType: typeof platform_pb.GetProofsRequest;
112
- readonly responseType: typeof platform_pb.GetProofsResponse;
113
- };
114
-
115
106
  type PlatformgetDataContract = {
116
107
  readonly methodName: string;
117
108
  readonly service: typeof Platform;
@@ -157,6 +148,15 @@ type PlatformgetIdentityByPublicKeyHash = {
157
148
  readonly responseType: typeof platform_pb.GetIdentityByPublicKeyHashResponse;
158
149
  };
159
150
 
151
+ type PlatformgetIdentityByNonUniquePublicKeyHash = {
152
+ readonly methodName: string;
153
+ readonly service: typeof Platform;
154
+ readonly requestStream: false;
155
+ readonly responseStream: false;
156
+ readonly requestType: typeof platform_pb.GetIdentityByNonUniquePublicKeyHashRequest;
157
+ readonly responseType: typeof platform_pb.GetIdentityByNonUniquePublicKeyHashResponse;
158
+ };
159
+
160
160
  type PlatformwaitForStateTransitionResult = {
161
161
  readonly methodName: string;
162
162
  readonly service: typeof Platform;
@@ -337,6 +337,15 @@ type PlatformgetTokenStatuses = {
337
337
  readonly responseType: typeof platform_pb.GetTokenStatusesResponse;
338
338
  };
339
339
 
340
+ type PlatformgetTokenDirectPurchasePrices = {
341
+ readonly methodName: string;
342
+ readonly service: typeof Platform;
343
+ readonly requestStream: false;
344
+ readonly responseStream: false;
345
+ readonly requestType: typeof platform_pb.GetTokenDirectPurchasePricesRequest;
346
+ readonly responseType: typeof platform_pb.GetTokenDirectPurchasePricesResponse;
347
+ };
348
+
340
349
  type PlatformgetTokenPreProgrammedDistributions = {
341
350
  readonly methodName: string;
342
351
  readonly service: typeof Platform;
@@ -404,12 +413,12 @@ export class Platform {
404
413
  static readonly getIdentityBalanceAndRevision: PlatformgetIdentityBalanceAndRevision;
405
414
  static readonly getEvonodesProposedEpochBlocksByIds: PlatformgetEvonodesProposedEpochBlocksByIds;
406
415
  static readonly getEvonodesProposedEpochBlocksByRange: PlatformgetEvonodesProposedEpochBlocksByRange;
407
- static readonly getProofs: PlatformgetProofs;
408
416
  static readonly getDataContract: PlatformgetDataContract;
409
417
  static readonly getDataContractHistory: PlatformgetDataContractHistory;
410
418
  static readonly getDataContracts: PlatformgetDataContracts;
411
419
  static readonly getDocuments: PlatformgetDocuments;
412
420
  static readonly getIdentityByPublicKeyHash: PlatformgetIdentityByPublicKeyHash;
421
+ static readonly getIdentityByNonUniquePublicKeyHash: PlatformgetIdentityByNonUniquePublicKeyHash;
413
422
  static readonly waitForStateTransitionResult: PlatformwaitForStateTransitionResult;
414
423
  static readonly getConsensusParams: PlatformgetConsensusParams;
415
424
  static readonly getProtocolVersionUpgradeState: PlatformgetProtocolVersionUpgradeState;
@@ -430,6 +439,7 @@ export class Platform {
430
439
  static readonly getIdentityTokenInfos: PlatformgetIdentityTokenInfos;
431
440
  static readonly getIdentitiesTokenInfos: PlatformgetIdentitiesTokenInfos;
432
441
  static readonly getTokenStatuses: PlatformgetTokenStatuses;
442
+ static readonly getTokenDirectPurchasePrices: PlatformgetTokenDirectPurchasePrices;
433
443
  static readonly getTokenPreProgrammedDistributions: PlatformgetTokenPreProgrammedDistributions;
434
444
  static readonly getTokenTotalSupply: PlatformgetTokenTotalSupply;
435
445
  static readonly getGroupInfo: PlatformgetGroupInfo;
@@ -569,15 +579,6 @@ export class PlatformClient {
569
579
  requestMessage: platform_pb.GetEvonodesProposedEpochBlocksByRangeRequest,
570
580
  callback: (error: ServiceError|null, responseMessage: platform_pb.GetEvonodesProposedEpochBlocksResponse|null) => void
571
581
  ): UnaryResponse;
572
- getProofs(
573
- requestMessage: platform_pb.GetProofsRequest,
574
- metadata: grpc.Metadata,
575
- callback: (error: ServiceError|null, responseMessage: platform_pb.GetProofsResponse|null) => void
576
- ): UnaryResponse;
577
- getProofs(
578
- requestMessage: platform_pb.GetProofsRequest,
579
- callback: (error: ServiceError|null, responseMessage: platform_pb.GetProofsResponse|null) => void
580
- ): UnaryResponse;
581
582
  getDataContract(
582
583
  requestMessage: platform_pb.GetDataContractRequest,
583
584
  metadata: grpc.Metadata,
@@ -623,6 +624,15 @@ export class PlatformClient {
623
624
  requestMessage: platform_pb.GetIdentityByPublicKeyHashRequest,
624
625
  callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityByPublicKeyHashResponse|null) => void
625
626
  ): UnaryResponse;
627
+ getIdentityByNonUniquePublicKeyHash(
628
+ requestMessage: platform_pb.GetIdentityByNonUniquePublicKeyHashRequest,
629
+ metadata: grpc.Metadata,
630
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityByNonUniquePublicKeyHashResponse|null) => void
631
+ ): UnaryResponse;
632
+ getIdentityByNonUniquePublicKeyHash(
633
+ requestMessage: platform_pb.GetIdentityByNonUniquePublicKeyHashRequest,
634
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetIdentityByNonUniquePublicKeyHashResponse|null) => void
635
+ ): UnaryResponse;
626
636
  waitForStateTransitionResult(
627
637
  requestMessage: platform_pb.WaitForStateTransitionResultRequest,
628
638
  metadata: grpc.Metadata,
@@ -803,6 +813,15 @@ export class PlatformClient {
803
813
  requestMessage: platform_pb.GetTokenStatusesRequest,
804
814
  callback: (error: ServiceError|null, responseMessage: platform_pb.GetTokenStatusesResponse|null) => void
805
815
  ): UnaryResponse;
816
+ getTokenDirectPurchasePrices(
817
+ requestMessage: platform_pb.GetTokenDirectPurchasePricesRequest,
818
+ metadata: grpc.Metadata,
819
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetTokenDirectPurchasePricesResponse|null) => void
820
+ ): UnaryResponse;
821
+ getTokenDirectPurchasePrices(
822
+ requestMessage: platform_pb.GetTokenDirectPurchasePricesRequest,
823
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetTokenDirectPurchasePricesResponse|null) => void
824
+ ): UnaryResponse;
806
825
  getTokenPreProgrammedDistributions(
807
826
  requestMessage: platform_pb.GetTokenPreProgrammedDistributionsRequest,
808
827
  metadata: grpc.Metadata,
@@ -109,15 +109,6 @@ Platform.getEvonodesProposedEpochBlocksByRange = {
109
109
  responseType: platform_pb.GetEvonodesProposedEpochBlocksResponse
110
110
  };
111
111
 
112
- Platform.getProofs = {
113
- methodName: "getProofs",
114
- service: Platform,
115
- requestStream: false,
116
- responseStream: false,
117
- requestType: platform_pb.GetProofsRequest,
118
- responseType: platform_pb.GetProofsResponse
119
- };
120
-
121
112
  Platform.getDataContract = {
122
113
  methodName: "getDataContract",
123
114
  service: Platform,
@@ -163,6 +154,15 @@ Platform.getIdentityByPublicKeyHash = {
163
154
  responseType: platform_pb.GetIdentityByPublicKeyHashResponse
164
155
  };
165
156
 
157
+ Platform.getIdentityByNonUniquePublicKeyHash = {
158
+ methodName: "getIdentityByNonUniquePublicKeyHash",
159
+ service: Platform,
160
+ requestStream: false,
161
+ responseStream: false,
162
+ requestType: platform_pb.GetIdentityByNonUniquePublicKeyHashRequest,
163
+ responseType: platform_pb.GetIdentityByNonUniquePublicKeyHashResponse
164
+ };
165
+
166
166
  Platform.waitForStateTransitionResult = {
167
167
  methodName: "waitForStateTransitionResult",
168
168
  service: Platform,
@@ -343,6 +343,15 @@ Platform.getTokenStatuses = {
343
343
  responseType: platform_pb.GetTokenStatusesResponse
344
344
  };
345
345
 
346
+ Platform.getTokenDirectPurchasePrices = {
347
+ methodName: "getTokenDirectPurchasePrices",
348
+ service: Platform,
349
+ requestStream: false,
350
+ responseStream: false,
351
+ requestType: platform_pb.GetTokenDirectPurchasePricesRequest,
352
+ responseType: platform_pb.GetTokenDirectPurchasePricesResponse
353
+ };
354
+
346
355
  Platform.getTokenPreProgrammedDistributions = {
347
356
  methodName: "getTokenPreProgrammedDistributions",
348
357
  service: Platform,
@@ -745,11 +754,11 @@ PlatformClient.prototype.getEvonodesProposedEpochBlocksByRange = function getEvo
745
754
  };
746
755
  };
747
756
 
748
- PlatformClient.prototype.getProofs = function getProofs(requestMessage, metadata, callback) {
757
+ PlatformClient.prototype.getDataContract = function getDataContract(requestMessage, metadata, callback) {
749
758
  if (arguments.length === 2) {
750
759
  callback = arguments[1];
751
760
  }
752
- var client = grpc.unary(Platform.getProofs, {
761
+ var client = grpc.unary(Platform.getDataContract, {
753
762
  request: requestMessage,
754
763
  host: this.serviceHost,
755
764
  metadata: metadata,
@@ -776,11 +785,11 @@ PlatformClient.prototype.getProofs = function getProofs(requestMessage, metadata
776
785
  };
777
786
  };
778
787
 
779
- PlatformClient.prototype.getDataContract = function getDataContract(requestMessage, metadata, callback) {
788
+ PlatformClient.prototype.getDataContractHistory = function getDataContractHistory(requestMessage, metadata, callback) {
780
789
  if (arguments.length === 2) {
781
790
  callback = arguments[1];
782
791
  }
783
- var client = grpc.unary(Platform.getDataContract, {
792
+ var client = grpc.unary(Platform.getDataContractHistory, {
784
793
  request: requestMessage,
785
794
  host: this.serviceHost,
786
795
  metadata: metadata,
@@ -807,11 +816,11 @@ PlatformClient.prototype.getDataContract = function getDataContract(requestMessa
807
816
  };
808
817
  };
809
818
 
810
- PlatformClient.prototype.getDataContractHistory = function getDataContractHistory(requestMessage, metadata, callback) {
819
+ PlatformClient.prototype.getDataContracts = function getDataContracts(requestMessage, metadata, callback) {
811
820
  if (arguments.length === 2) {
812
821
  callback = arguments[1];
813
822
  }
814
- var client = grpc.unary(Platform.getDataContractHistory, {
823
+ var client = grpc.unary(Platform.getDataContracts, {
815
824
  request: requestMessage,
816
825
  host: this.serviceHost,
817
826
  metadata: metadata,
@@ -838,11 +847,11 @@ PlatformClient.prototype.getDataContractHistory = function getDataContractHistor
838
847
  };
839
848
  };
840
849
 
841
- PlatformClient.prototype.getDataContracts = function getDataContracts(requestMessage, metadata, callback) {
850
+ PlatformClient.prototype.getDocuments = function getDocuments(requestMessage, metadata, callback) {
842
851
  if (arguments.length === 2) {
843
852
  callback = arguments[1];
844
853
  }
845
- var client = grpc.unary(Platform.getDataContracts, {
854
+ var client = grpc.unary(Platform.getDocuments, {
846
855
  request: requestMessage,
847
856
  host: this.serviceHost,
848
857
  metadata: metadata,
@@ -869,11 +878,11 @@ PlatformClient.prototype.getDataContracts = function getDataContracts(requestMes
869
878
  };
870
879
  };
871
880
 
872
- PlatformClient.prototype.getDocuments = function getDocuments(requestMessage, metadata, callback) {
881
+ PlatformClient.prototype.getIdentityByPublicKeyHash = function getIdentityByPublicKeyHash(requestMessage, metadata, callback) {
873
882
  if (arguments.length === 2) {
874
883
  callback = arguments[1];
875
884
  }
876
- var client = grpc.unary(Platform.getDocuments, {
885
+ var client = grpc.unary(Platform.getIdentityByPublicKeyHash, {
877
886
  request: requestMessage,
878
887
  host: this.serviceHost,
879
888
  metadata: metadata,
@@ -900,11 +909,11 @@ PlatformClient.prototype.getDocuments = function getDocuments(requestMessage, me
900
909
  };
901
910
  };
902
911
 
903
- PlatformClient.prototype.getIdentityByPublicKeyHash = function getIdentityByPublicKeyHash(requestMessage, metadata, callback) {
912
+ PlatformClient.prototype.getIdentityByNonUniquePublicKeyHash = function getIdentityByNonUniquePublicKeyHash(requestMessage, metadata, callback) {
904
913
  if (arguments.length === 2) {
905
914
  callback = arguments[1];
906
915
  }
907
- var client = grpc.unary(Platform.getIdentityByPublicKeyHash, {
916
+ var client = grpc.unary(Platform.getIdentityByNonUniquePublicKeyHash, {
908
917
  request: requestMessage,
909
918
  host: this.serviceHost,
910
919
  metadata: metadata,
@@ -1551,6 +1560,37 @@ PlatformClient.prototype.getTokenStatuses = function getTokenStatuses(requestMes
1551
1560
  };
1552
1561
  };
1553
1562
 
1563
+ PlatformClient.prototype.getTokenDirectPurchasePrices = function getTokenDirectPurchasePrices(requestMessage, metadata, callback) {
1564
+ if (arguments.length === 2) {
1565
+ callback = arguments[1];
1566
+ }
1567
+ var client = grpc.unary(Platform.getTokenDirectPurchasePrices, {
1568
+ request: requestMessage,
1569
+ host: this.serviceHost,
1570
+ metadata: metadata,
1571
+ transport: this.options.transport,
1572
+ debug: this.options.debug,
1573
+ onEnd: function (response) {
1574
+ if (callback) {
1575
+ if (response.status !== grpc.Code.OK) {
1576
+ var err = new Error(response.statusMessage);
1577
+ err.code = response.status;
1578
+ err.metadata = response.trailers;
1579
+ callback(err, null);
1580
+ } else {
1581
+ callback(null, response.message);
1582
+ }
1583
+ }
1584
+ }
1585
+ });
1586
+ return {
1587
+ cancel: function () {
1588
+ callback = null;
1589
+ client.close();
1590
+ }
1591
+ };
1592
+ };
1593
+
1554
1594
  PlatformClient.prototype.getTokenPreProgrammedDistributions = function getTokenPreProgrammedDistributions(requestMessage, metadata, callback) {
1555
1595
  if (arguments.length === 2) {
1556
1596
  callback = arguments[1];
@@ -0,0 +1,18 @@
1
+ const path = require('path');
2
+
3
+ const { loadPackageDefinition } = require('@dashevo/grpc-common');
4
+
5
+ function getDriveDefinition(version) {
6
+ const protoPath = path.join(__dirname, `../protos/drive/v${version}/drive.proto`);
7
+ const includeDirs = [
8
+ path.join(__dirname, '../protos/'),
9
+ ];
10
+
11
+ return loadPackageDefinition(
12
+ protoPath,
13
+ `org.dash.platform.drive.v${version}.DriveInternal`,
14
+ includeDirs,
15
+ );
16
+ }
17
+
18
+ module.exports = getDriveDefinition;
package/node.js CHANGED
@@ -1,12 +1,15 @@
1
1
  const { Metadata } = require('@grpc/grpc-js/build/src/metadata');
2
2
  const CorePromiseClient = require('./clients/core/v0/nodejs/CorePromiseClient');
3
3
  const PlatformPromiseClient = require('./clients/platform/v0/nodejs/PlatformPromiseClient');
4
+ const DrivePromiseClient = require('./clients/drive/v0/nodejs/DrivePromiseClient');
4
5
 
5
6
  const protocCoreMessages = require('./clients/core/v0/nodejs/core_protoc');
6
7
  const protocPlatformMessages = require('./clients/platform/v0/nodejs/platform_protoc');
8
+ const protocDriveMessages = require('./clients/drive/v0/nodejs/drive_protoc');
7
9
 
8
10
  const getCoreDefinition = require('./lib/getCoreDefinition');
9
11
  const getPlatformDefinition = require('./lib/getPlatformDefinition');
12
+ const getDriveDefinition = require('./lib/getDriveDefinition');
10
13
  const parseMetadata = require('./lib/utils/parseMetadata');
11
14
 
12
15
  const {
@@ -33,19 +36,35 @@ const {
33
36
  },
34
37
  } = require('./clients/platform/v0/nodejs/platform_pbjs');
35
38
 
39
+ const {
40
+ org: {
41
+ dash: {
42
+ platform: {
43
+ drive: {
44
+ v0: pbjsDriveMessages,
45
+ },
46
+ },
47
+ },
48
+ },
49
+ } = require('./clients/drive/v0/nodejs/drive_pbjs');
50
+
36
51
  module.exports = {
37
52
  getCoreDefinition,
38
53
  getPlatformDefinition,
54
+ getDriveDefinition,
39
55
  v0: {
40
56
  CorePromiseClient,
41
57
  PlatformPromiseClient,
58
+ DrivePromiseClient,
42
59
  pbjs: {
43
60
 
44
61
  ...pbjsCoreMessages,
45
62
  ...pbjsPlatformMessages,
63
+ ...pbjsDriveMessages,
46
64
  },
47
65
  ...protocCoreMessages,
48
66
  ...protocPlatformMessages,
67
+ ...protocDriveMessages,
49
68
  },
50
69
  parseMetadata,
51
70
  Metadata,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/dapi-grpc",
3
- "version": "2.0.0-dev.1",
3
+ "version": "2.0.0-rc.1",
4
4
  "description": "DAPI GRPC definition file and generated clients",
5
5
  "browser": "browser.js",
6
6
  "main": "node.js",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://github.com/dashevo/dapi-grpc#readme",
47
47
  "dependencies": {
48
- "@dashevo/grpc-common": "2.0.0-dev.1",
48
+ "@dashevo/grpc-common": "2.0.0-rc.1",
49
49
  "@dashevo/protobufjs": "6.10.5",
50
50
  "@grpc/grpc-js": "1.4.4",
51
51
  "@improbable-eng/grpc-web": "^0.15.0",
@@ -0,0 +1,18 @@
1
+ syntax = "proto3";
2
+
3
+ package org.dash.platform.drive.v0;
4
+
5
+ import "platform/v0/platform.proto";
6
+
7
+ service DriveInternal {
8
+ rpc getProofs(GetProofsRequest) returns (GetProofsResponse);
9
+ }
10
+
11
+ message GetProofsRequest {
12
+ bytes state_transition = 1;
13
+ }
14
+
15
+ message GetProofsResponse {
16
+ org.dash.platform.dapi.v0.Proof proof = 1; // Cryptographic proof for the requested data
17
+ org.dash.platform.dapi.v0.ResponseMetadata metadata = 2; // Metadata about the blockchain state
18
+ }