@dashevo/dapi-grpc 3.1.0-dev.7 → 4.0.0-beta.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.
@@ -130,6 +130,15 @@ type PlatformgetDataContracts = {
130
130
  readonly responseType: typeof platform_pb.GetDataContractsResponse;
131
131
  };
132
132
 
133
+ type PlatformgetDocumentHistory = {
134
+ readonly methodName: string;
135
+ readonly service: typeof Platform;
136
+ readonly requestStream: false;
137
+ readonly responseStream: false;
138
+ readonly requestType: typeof platform_pb.GetDocumentHistoryRequest;
139
+ readonly responseType: typeof platform_pb.GetDocumentHistoryResponse;
140
+ };
141
+
133
142
  type PlatformgetDocuments = {
134
143
  readonly methodName: string;
135
144
  readonly service: typeof Platform;
@@ -517,6 +526,15 @@ type PlatformgetShieldedPoolState = {
517
526
  readonly responseType: typeof platform_pb.GetShieldedPoolStateResponse;
518
527
  };
519
528
 
529
+ type PlatformgetShieldedNotesCount = {
530
+ readonly methodName: string;
531
+ readonly service: typeof Platform;
532
+ readonly requestStream: false;
533
+ readonly responseStream: false;
534
+ readonly requestType: typeof platform_pb.GetShieldedNotesCountRequest;
535
+ readonly responseType: typeof platform_pb.GetShieldedNotesCountResponse;
536
+ };
537
+
520
538
  type PlatformgetShieldedNullifiers = {
521
539
  readonly methodName: string;
522
540
  readonly service: typeof Platform;
@@ -578,6 +596,7 @@ export class Platform {
578
596
  static readonly getDataContract: PlatformgetDataContract;
579
597
  static readonly getDataContractHistory: PlatformgetDataContractHistory;
580
598
  static readonly getDataContracts: PlatformgetDataContracts;
599
+ static readonly getDocumentHistory: PlatformgetDocumentHistory;
581
600
  static readonly getDocuments: PlatformgetDocuments;
582
601
  static readonly getIdentityByPublicKeyHash: PlatformgetIdentityByPublicKeyHash;
583
602
  static readonly getIdentityByNonUniquePublicKeyHash: PlatformgetIdentityByNonUniquePublicKeyHash;
@@ -621,6 +640,7 @@ export class Platform {
621
640
  static readonly getShieldedAnchors: PlatformgetShieldedAnchors;
622
641
  static readonly getMostRecentShieldedAnchor: PlatformgetMostRecentShieldedAnchor;
623
642
  static readonly getShieldedPoolState: PlatformgetShieldedPoolState;
643
+ static readonly getShieldedNotesCount: PlatformgetShieldedNotesCount;
624
644
  static readonly getShieldedNullifiers: PlatformgetShieldedNullifiers;
625
645
  static readonly getNullifiersTrunkState: PlatformgetNullifiersTrunkState;
626
646
  static readonly getNullifiersBranchState: PlatformgetNullifiersBranchState;
@@ -786,6 +806,15 @@ export class PlatformClient {
786
806
  requestMessage: platform_pb.GetDataContractsRequest,
787
807
  callback: (error: ServiceError|null, responseMessage: platform_pb.GetDataContractsResponse|null) => void
788
808
  ): UnaryResponse;
809
+ getDocumentHistory(
810
+ requestMessage: platform_pb.GetDocumentHistoryRequest,
811
+ metadata: grpc.Metadata,
812
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetDocumentHistoryResponse|null) => void
813
+ ): UnaryResponse;
814
+ getDocumentHistory(
815
+ requestMessage: platform_pb.GetDocumentHistoryRequest,
816
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetDocumentHistoryResponse|null) => void
817
+ ): UnaryResponse;
789
818
  getDocuments(
790
819
  requestMessage: platform_pb.GetDocumentsRequest,
791
820
  metadata: grpc.Metadata,
@@ -1173,6 +1202,15 @@ export class PlatformClient {
1173
1202
  requestMessage: platform_pb.GetShieldedPoolStateRequest,
1174
1203
  callback: (error: ServiceError|null, responseMessage: platform_pb.GetShieldedPoolStateResponse|null) => void
1175
1204
  ): UnaryResponse;
1205
+ getShieldedNotesCount(
1206
+ requestMessage: platform_pb.GetShieldedNotesCountRequest,
1207
+ metadata: grpc.Metadata,
1208
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetShieldedNotesCountResponse|null) => void
1209
+ ): UnaryResponse;
1210
+ getShieldedNotesCount(
1211
+ requestMessage: platform_pb.GetShieldedNotesCountRequest,
1212
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetShieldedNotesCountResponse|null) => void
1213
+ ): UnaryResponse;
1176
1214
  getShieldedNullifiers(
1177
1215
  requestMessage: platform_pb.GetShieldedNullifiersRequest,
1178
1216
  metadata: grpc.Metadata,
@@ -136,6 +136,15 @@ Platform.getDataContracts = {
136
136
  responseType: platform_pb.GetDataContractsResponse
137
137
  };
138
138
 
139
+ Platform.getDocumentHistory = {
140
+ methodName: "getDocumentHistory",
141
+ service: Platform,
142
+ requestStream: false,
143
+ responseStream: false,
144
+ requestType: platform_pb.GetDocumentHistoryRequest,
145
+ responseType: platform_pb.GetDocumentHistoryResponse
146
+ };
147
+
139
148
  Platform.getDocuments = {
140
149
  methodName: "getDocuments",
141
150
  service: Platform,
@@ -523,6 +532,15 @@ Platform.getShieldedPoolState = {
523
532
  responseType: platform_pb.GetShieldedPoolStateResponse
524
533
  };
525
534
 
535
+ Platform.getShieldedNotesCount = {
536
+ methodName: "getShieldedNotesCount",
537
+ service: Platform,
538
+ requestStream: false,
539
+ responseStream: false,
540
+ requestType: platform_pb.GetShieldedNotesCountRequest,
541
+ responseType: platform_pb.GetShieldedNotesCountResponse
542
+ };
543
+
526
544
  Platform.getShieldedNullifiers = {
527
545
  methodName: "getShieldedNullifiers",
528
546
  service: Platform,
@@ -1009,6 +1027,37 @@ PlatformClient.prototype.getDataContracts = function getDataContracts(requestMes
1009
1027
  };
1010
1028
  };
1011
1029
 
1030
+ PlatformClient.prototype.getDocumentHistory = function getDocumentHistory(requestMessage, metadata, callback) {
1031
+ if (arguments.length === 2) {
1032
+ callback = arguments[1];
1033
+ }
1034
+ var client = grpc.unary(Platform.getDocumentHistory, {
1035
+ request: requestMessage,
1036
+ host: this.serviceHost,
1037
+ metadata: metadata,
1038
+ transport: this.options.transport,
1039
+ debug: this.options.debug,
1040
+ onEnd: function (response) {
1041
+ if (callback) {
1042
+ if (response.status !== grpc.Code.OK) {
1043
+ var err = new Error(response.statusMessage);
1044
+ err.code = response.status;
1045
+ err.metadata = response.trailers;
1046
+ callback(err, null);
1047
+ } else {
1048
+ callback(null, response.message);
1049
+ }
1050
+ }
1051
+ }
1052
+ });
1053
+ return {
1054
+ cancel: function () {
1055
+ callback = null;
1056
+ client.close();
1057
+ }
1058
+ };
1059
+ };
1060
+
1012
1061
  PlatformClient.prototype.getDocuments = function getDocuments(requestMessage, metadata, callback) {
1013
1062
  if (arguments.length === 2) {
1014
1063
  callback = arguments[1];
@@ -2342,6 +2391,37 @@ PlatformClient.prototype.getShieldedPoolState = function getShieldedPoolState(re
2342
2391
  };
2343
2392
  };
2344
2393
 
2394
+ PlatformClient.prototype.getShieldedNotesCount = function getShieldedNotesCount(requestMessage, metadata, callback) {
2395
+ if (arguments.length === 2) {
2396
+ callback = arguments[1];
2397
+ }
2398
+ var client = grpc.unary(Platform.getShieldedNotesCount, {
2399
+ request: requestMessage,
2400
+ host: this.serviceHost,
2401
+ metadata: metadata,
2402
+ transport: this.options.transport,
2403
+ debug: this.options.debug,
2404
+ onEnd: function (response) {
2405
+ if (callback) {
2406
+ if (response.status !== grpc.Code.OK) {
2407
+ var err = new Error(response.statusMessage);
2408
+ err.code = response.status;
2409
+ err.metadata = response.trailers;
2410
+ callback(err, null);
2411
+ } else {
2412
+ callback(null, response.message);
2413
+ }
2414
+ }
2415
+ }
2416
+ });
2417
+ return {
2418
+ cancel: function () {
2419
+ callback = null;
2420
+ client.close();
2421
+ }
2422
+ };
2423
+ };
2424
+
2345
2425
  PlatformClient.prototype.getShieldedNullifiers = function getShieldedNullifiers(requestMessage, metadata, callback) {
2346
2426
  if (arguments.length === 2) {
2347
2427
  callback = arguments[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/dapi-grpc",
3
- "version": "3.1.0-dev.7",
3
+ "version": "4.0.0-beta.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": "3.1.0-dev.7",
48
+ "@dashevo/grpc-common": "4.0.0-beta.1",
49
49
  "@dashevo/protobufjs": "6.10.5",
50
50
  "@grpc/grpc-js": "^1.14.3",
51
51
  "@improbable-eng/grpc-web": "^0.15.0",
@@ -35,6 +35,8 @@ service Platform {
35
35
  returns (GetDataContractHistoryResponse);
36
36
  rpc getDataContracts(GetDataContractsRequest)
37
37
  returns (GetDataContractsResponse);
38
+ rpc getDocumentHistory(GetDocumentHistoryRequest)
39
+ returns (GetDocumentHistoryResponse);
38
40
  rpc getDocuments(GetDocumentsRequest) returns (GetDocumentsResponse);
39
41
  rpc getIdentityByPublicKeyHash(GetIdentityByPublicKeyHashRequest)
40
42
  returns (GetIdentityByPublicKeyHashResponse);
@@ -126,6 +128,8 @@ service Platform {
126
128
  returns (GetMostRecentShieldedAnchorResponse);
127
129
  rpc getShieldedPoolState(GetShieldedPoolStateRequest)
128
130
  returns (GetShieldedPoolStateResponse);
131
+ rpc getShieldedNotesCount(GetShieldedNotesCountRequest)
132
+ returns (GetShieldedNotesCountResponse);
129
133
  rpc getShieldedNullifiers(GetShieldedNullifiersRequest)
130
134
  returns (GetShieldedNullifiersResponse);
131
135
  rpc getNullifiersTrunkState(GetNullifiersTrunkStateRequest)
@@ -1300,6 +1304,49 @@ message GetDocumentsResponse {
1300
1304
  }
1301
1305
  }
1302
1306
 
1307
+ message GetDocumentHistoryRequest {
1308
+ message GetDocumentHistoryRequestV0 {
1309
+ bytes data_contract_id = 1; // The ID of the data contract
1310
+ string document_type_name = 2; // The document type name
1311
+ bytes document_id = 3; // The document ID
1312
+ google.protobuf.UInt32Value limit =
1313
+ 4; // The maximum number of history entries to return
1314
+ google.protobuf.UInt32Value offset =
1315
+ 5; // The offset for pagination through the document history
1316
+ uint64 start_at_ms = 6 [
1317
+ jstype = JS_STRING
1318
+ ]; // Only return results after this time in milliseconds
1319
+ bool prove = 7; // Flag to request a proof as the response
1320
+ }
1321
+ oneof version { GetDocumentHistoryRequestV0 v0 = 1; }
1322
+ }
1323
+
1324
+ message GetDocumentHistoryResponse {
1325
+ message GetDocumentHistoryResponseV0 {
1326
+ // Represents a single entry in a document's history
1327
+ message DocumentHistoryEntry {
1328
+ uint64 date = 1 [ jstype = JS_STRING ]; // The date of the history entry
1329
+ bytes value = 2; // The value of the document at this point in history
1330
+ }
1331
+
1332
+ // Collection of document history entries
1333
+ message DocumentHistory {
1334
+ repeated DocumentHistoryEntry document_entries =
1335
+ 1; // List of history entries
1336
+ }
1337
+
1338
+ oneof result {
1339
+ DocumentHistory document_history =
1340
+ 1; // The actual history of the document
1341
+ Proof proof =
1342
+ 2; // Cryptographic proof of the document history, if requested
1343
+ }
1344
+
1345
+ ResponseMetadata metadata = 3; // Metadata about the blockchain state
1346
+ }
1347
+ oneof version { GetDocumentHistoryResponseV0 v0 = 1; }
1348
+ }
1349
+
1303
1350
  message GetIdentityByPublicKeyHashRequest {
1304
1351
  message GetIdentityByPublicKeyHashRequestV0 {
1305
1352
  bytes public_key_hash =
@@ -2927,6 +2974,31 @@ message GetShieldedPoolStateResponse {
2927
2974
  oneof version { GetShieldedPoolStateResponseV0 v0 = 1; }
2928
2975
  }
2929
2976
 
2977
+ // Count of leaves in the shielded notes commitment tree.
2978
+ // Used by wallets at the start of a shielded sync to seed a
2979
+ // determinate progress-bar denominator. The count IS bound by the
2980
+ // Merk value hash: it is the first field (`total_count`) of the
2981
+ // serialized `CommitmentTree` element whose bytes are hashed into the
2982
+ // app/root hash, so it is provable via a PathQuery proof of that
2983
+ // element (set `prove = true`).
2984
+ message GetShieldedNotesCountRequest {
2985
+ message GetShieldedNotesCountRequestV0 {
2986
+ bool prove = 1;
2987
+ }
2988
+ oneof version { GetShieldedNotesCountRequestV0 v0 = 1; }
2989
+ }
2990
+
2991
+ message GetShieldedNotesCountResponse {
2992
+ message GetShieldedNotesCountResponseV0 {
2993
+ oneof result {
2994
+ uint64 total_notes_count = 1 [jstype = JS_STRING];
2995
+ Proof proof = 2;
2996
+ }
2997
+ ResponseMetadata metadata = 3;
2998
+ }
2999
+ oneof version { GetShieldedNotesCountResponseV0 v0 = 1; }
3000
+ }
3001
+
2930
3002
  message GetShieldedNullifiersRequest {
2931
3003
  message GetShieldedNullifiersRequestV0 {
2932
3004
  repeated bytes nullifiers = 1;