@dashevo/dapi-grpc 4.2.0-beta.1 → 4.2.0-beta.3

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.
@@ -184,6 +184,42 @@ type PlatformgetContractGroupsForContract = {
184
184
  readonly responseType: typeof platform_pb.GetContractGroupsForContractResponse;
185
185
  };
186
186
 
187
+ type PlatformgetContractModerationStatus = {
188
+ readonly methodName: string;
189
+ readonly service: typeof Platform;
190
+ readonly requestStream: false;
191
+ readonly responseStream: false;
192
+ readonly requestType: typeof platform_pb.GetContractModerationStatusRequest;
193
+ readonly responseType: typeof platform_pb.GetContractModerationStatusResponse;
194
+ };
195
+
196
+ type PlatformgetContractModerationEntries = {
197
+ readonly methodName: string;
198
+ readonly service: typeof Platform;
199
+ readonly requestStream: false;
200
+ readonly responseStream: false;
201
+ readonly requestType: typeof platform_pb.GetContractModerationEntriesRequest;
202
+ readonly responseType: typeof platform_pb.GetContractModerationEntriesResponse;
203
+ };
204
+
205
+ type PlatformgetContractDocumentRemovals = {
206
+ readonly methodName: string;
207
+ readonly service: typeof Platform;
208
+ readonly requestStream: false;
209
+ readonly responseStream: false;
210
+ readonly requestType: typeof platform_pb.GetContractDocumentRemovalsRequest;
211
+ readonly responseType: typeof platform_pb.GetContractDocumentRemovalsResponse;
212
+ };
213
+
214
+ type PlatformgetContractFeePots = {
215
+ readonly methodName: string;
216
+ readonly service: typeof Platform;
217
+ readonly requestStream: false;
218
+ readonly responseStream: false;
219
+ readonly requestType: typeof platform_pb.GetContractFeePotsRequest;
220
+ readonly responseType: typeof platform_pb.GetContractFeePotsResponse;
221
+ };
222
+
187
223
  type PlatformgetDocumentHistory = {
188
224
  readonly methodName: string;
189
225
  readonly service: typeof Platform;
@@ -620,6 +656,10 @@ export class Platform {
620
656
  static readonly getContractGroupInfo: PlatformgetContractGroupInfo;
621
657
  static readonly getContractGroupMembers: PlatformgetContractGroupMembers;
622
658
  static readonly getContractGroupsForContract: PlatformgetContractGroupsForContract;
659
+ static readonly getContractModerationStatus: PlatformgetContractModerationStatus;
660
+ static readonly getContractModerationEntries: PlatformgetContractModerationEntries;
661
+ static readonly getContractDocumentRemovals: PlatformgetContractDocumentRemovals;
662
+ static readonly getContractFeePots: PlatformgetContractFeePots;
623
663
  static readonly getDocumentHistory: PlatformgetDocumentHistory;
624
664
  static readonly getDocuments: PlatformgetDocuments;
625
665
  static readonly getIdentityByPublicKeyHash: PlatformgetIdentityByPublicKeyHash;
@@ -880,6 +920,42 @@ export class PlatformClient {
880
920
  requestMessage: platform_pb.GetContractGroupsForContractRequest,
881
921
  callback: (error: ServiceError|null, responseMessage: platform_pb.GetContractGroupsForContractResponse|null) => void
882
922
  ): UnaryResponse;
923
+ getContractModerationStatus(
924
+ requestMessage: platform_pb.GetContractModerationStatusRequest,
925
+ metadata: grpc.Metadata,
926
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetContractModerationStatusResponse|null) => void
927
+ ): UnaryResponse;
928
+ getContractModerationStatus(
929
+ requestMessage: platform_pb.GetContractModerationStatusRequest,
930
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetContractModerationStatusResponse|null) => void
931
+ ): UnaryResponse;
932
+ getContractModerationEntries(
933
+ requestMessage: platform_pb.GetContractModerationEntriesRequest,
934
+ metadata: grpc.Metadata,
935
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetContractModerationEntriesResponse|null) => void
936
+ ): UnaryResponse;
937
+ getContractModerationEntries(
938
+ requestMessage: platform_pb.GetContractModerationEntriesRequest,
939
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetContractModerationEntriesResponse|null) => void
940
+ ): UnaryResponse;
941
+ getContractDocumentRemovals(
942
+ requestMessage: platform_pb.GetContractDocumentRemovalsRequest,
943
+ metadata: grpc.Metadata,
944
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetContractDocumentRemovalsResponse|null) => void
945
+ ): UnaryResponse;
946
+ getContractDocumentRemovals(
947
+ requestMessage: platform_pb.GetContractDocumentRemovalsRequest,
948
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetContractDocumentRemovalsResponse|null) => void
949
+ ): UnaryResponse;
950
+ getContractFeePots(
951
+ requestMessage: platform_pb.GetContractFeePotsRequest,
952
+ metadata: grpc.Metadata,
953
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetContractFeePotsResponse|null) => void
954
+ ): UnaryResponse;
955
+ getContractFeePots(
956
+ requestMessage: platform_pb.GetContractFeePotsRequest,
957
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetContractFeePotsResponse|null) => void
958
+ ): UnaryResponse;
883
959
  getDocumentHistory(
884
960
  requestMessage: platform_pb.GetDocumentHistoryRequest,
885
961
  metadata: grpc.Metadata,
@@ -190,6 +190,42 @@ Platform.getContractGroupsForContract = {
190
190
  responseType: platform_pb.GetContractGroupsForContractResponse
191
191
  };
192
192
 
193
+ Platform.getContractModerationStatus = {
194
+ methodName: "getContractModerationStatus",
195
+ service: Platform,
196
+ requestStream: false,
197
+ responseStream: false,
198
+ requestType: platform_pb.GetContractModerationStatusRequest,
199
+ responseType: platform_pb.GetContractModerationStatusResponse
200
+ };
201
+
202
+ Platform.getContractModerationEntries = {
203
+ methodName: "getContractModerationEntries",
204
+ service: Platform,
205
+ requestStream: false,
206
+ responseStream: false,
207
+ requestType: platform_pb.GetContractModerationEntriesRequest,
208
+ responseType: platform_pb.GetContractModerationEntriesResponse
209
+ };
210
+
211
+ Platform.getContractDocumentRemovals = {
212
+ methodName: "getContractDocumentRemovals",
213
+ service: Platform,
214
+ requestStream: false,
215
+ responseStream: false,
216
+ requestType: platform_pb.GetContractDocumentRemovalsRequest,
217
+ responseType: platform_pb.GetContractDocumentRemovalsResponse
218
+ };
219
+
220
+ Platform.getContractFeePots = {
221
+ methodName: "getContractFeePots",
222
+ service: Platform,
223
+ requestStream: false,
224
+ responseStream: false,
225
+ requestType: platform_pb.GetContractFeePotsRequest,
226
+ responseType: platform_pb.GetContractFeePotsResponse
227
+ };
228
+
193
229
  Platform.getDocumentHistory = {
194
230
  methodName: "getDocumentHistory",
195
231
  service: Platform,
@@ -1231,6 +1267,130 @@ PlatformClient.prototype.getContractGroupsForContract = function getContractGrou
1231
1267
  };
1232
1268
  };
1233
1269
 
1270
+ PlatformClient.prototype.getContractModerationStatus = function getContractModerationStatus(requestMessage, metadata, callback) {
1271
+ if (arguments.length === 2) {
1272
+ callback = arguments[1];
1273
+ }
1274
+ var client = grpc.unary(Platform.getContractModerationStatus, {
1275
+ request: requestMessage,
1276
+ host: this.serviceHost,
1277
+ metadata: metadata,
1278
+ transport: this.options.transport,
1279
+ debug: this.options.debug,
1280
+ onEnd: function (response) {
1281
+ if (callback) {
1282
+ if (response.status !== grpc.Code.OK) {
1283
+ var err = new Error(response.statusMessage);
1284
+ err.code = response.status;
1285
+ err.metadata = response.trailers;
1286
+ callback(err, null);
1287
+ } else {
1288
+ callback(null, response.message);
1289
+ }
1290
+ }
1291
+ }
1292
+ });
1293
+ return {
1294
+ cancel: function () {
1295
+ callback = null;
1296
+ client.close();
1297
+ }
1298
+ };
1299
+ };
1300
+
1301
+ PlatformClient.prototype.getContractModerationEntries = function getContractModerationEntries(requestMessage, metadata, callback) {
1302
+ if (arguments.length === 2) {
1303
+ callback = arguments[1];
1304
+ }
1305
+ var client = grpc.unary(Platform.getContractModerationEntries, {
1306
+ request: requestMessage,
1307
+ host: this.serviceHost,
1308
+ metadata: metadata,
1309
+ transport: this.options.transport,
1310
+ debug: this.options.debug,
1311
+ onEnd: function (response) {
1312
+ if (callback) {
1313
+ if (response.status !== grpc.Code.OK) {
1314
+ var err = new Error(response.statusMessage);
1315
+ err.code = response.status;
1316
+ err.metadata = response.trailers;
1317
+ callback(err, null);
1318
+ } else {
1319
+ callback(null, response.message);
1320
+ }
1321
+ }
1322
+ }
1323
+ });
1324
+ return {
1325
+ cancel: function () {
1326
+ callback = null;
1327
+ client.close();
1328
+ }
1329
+ };
1330
+ };
1331
+
1332
+ PlatformClient.prototype.getContractDocumentRemovals = function getContractDocumentRemovals(requestMessage, metadata, callback) {
1333
+ if (arguments.length === 2) {
1334
+ callback = arguments[1];
1335
+ }
1336
+ var client = grpc.unary(Platform.getContractDocumentRemovals, {
1337
+ request: requestMessage,
1338
+ host: this.serviceHost,
1339
+ metadata: metadata,
1340
+ transport: this.options.transport,
1341
+ debug: this.options.debug,
1342
+ onEnd: function (response) {
1343
+ if (callback) {
1344
+ if (response.status !== grpc.Code.OK) {
1345
+ var err = new Error(response.statusMessage);
1346
+ err.code = response.status;
1347
+ err.metadata = response.trailers;
1348
+ callback(err, null);
1349
+ } else {
1350
+ callback(null, response.message);
1351
+ }
1352
+ }
1353
+ }
1354
+ });
1355
+ return {
1356
+ cancel: function () {
1357
+ callback = null;
1358
+ client.close();
1359
+ }
1360
+ };
1361
+ };
1362
+
1363
+ PlatformClient.prototype.getContractFeePots = function getContractFeePots(requestMessage, metadata, callback) {
1364
+ if (arguments.length === 2) {
1365
+ callback = arguments[1];
1366
+ }
1367
+ var client = grpc.unary(Platform.getContractFeePots, {
1368
+ request: requestMessage,
1369
+ host: this.serviceHost,
1370
+ metadata: metadata,
1371
+ transport: this.options.transport,
1372
+ debug: this.options.debug,
1373
+ onEnd: function (response) {
1374
+ if (callback) {
1375
+ if (response.status !== grpc.Code.OK) {
1376
+ var err = new Error(response.statusMessage);
1377
+ err.code = response.status;
1378
+ err.metadata = response.trailers;
1379
+ callback(err, null);
1380
+ } else {
1381
+ callback(null, response.message);
1382
+ }
1383
+ }
1384
+ }
1385
+ });
1386
+ return {
1387
+ cancel: function () {
1388
+ callback = null;
1389
+ client.close();
1390
+ }
1391
+ };
1392
+ };
1393
+
1234
1394
  PlatformClient.prototype.getDocumentHistory = function getDocumentHistory(requestMessage, metadata, callback) {
1235
1395
  if (arguments.length === 2) {
1236
1396
  callback = arguments[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/dapi-grpc",
3
- "version": "4.2.0-beta.1",
3
+ "version": "4.2.0-beta.3",
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": "4.2.0-beta.1",
48
+ "@dashevo/grpc-common": "4.2.0-beta.3",
49
49
  "@dashevo/protobufjs": "6.10.5",
50
50
  "@grpc/grpc-js": "^1.14.3",
51
51
  "@improbable-eng/grpc-web": "^0.15.0",
@@ -47,6 +47,14 @@ service Platform {
47
47
  returns (GetContractGroupMembersResponse);
48
48
  rpc getContractGroupsForContract(GetContractGroupsForContractRequest)
49
49
  returns (GetContractGroupsForContractResponse);
50
+ rpc getContractModerationStatus(GetContractModerationStatusRequest)
51
+ returns (GetContractModerationStatusResponse);
52
+ rpc getContractModerationEntries(GetContractModerationEntriesRequest)
53
+ returns (GetContractModerationEntriesResponse);
54
+ rpc getContractDocumentRemovals(GetContractDocumentRemovalsRequest)
55
+ returns (GetContractDocumentRemovalsResponse);
56
+ rpc getContractFeePots(GetContractFeePotsRequest)
57
+ returns (GetContractFeePotsResponse);
50
58
  rpc getDocumentHistory(GetDocumentHistoryRequest)
51
59
  returns (GetDocumentHistoryResponse);
52
60
  rpc getDocuments(GetDocumentsRequest) returns (GetDocumentsResponse);
@@ -698,6 +706,198 @@ message GetContractGroupMembersResponse {
698
706
  oneof version { GetContractGroupMembersResponseV0 v0 = 1; }
699
707
  }
700
708
 
709
+ // One of the two moderation lists a moderated data contract may keep (protocol version 14).
710
+ enum ContractModerationList {
711
+ CONTRACT_MODERATION_LIST_UNSPECIFIED = 0; // Not a list: a request that leaves the field out is refused
712
+ CONTRACT_MODERATION_LIST_BANLIST = 1; // Identities barred until an unban
713
+ CONTRACT_MODERATION_LIST_SUSPENSIONS = 2; // Identities barred until a block time
714
+ }
715
+
716
+ // Why a moderator banned or suspended an identity. Nothing checks what a
717
+ // moderator writes.
718
+ message ContractModerationReason {
719
+ optional uint32 code =
720
+ 1; // Reserved for the ban codes a contract may declare in a later
721
+ // protocol version; a u16, expected unset today, never checked
722
+ string text = 2; // Free text, at most 1024 bytes of UTF-8, may be empty
723
+ }
724
+
725
+ message GetContractModerationStatusRequest {
726
+ message GetContractModerationStatusRequestV0 {
727
+ bytes contract_id = 1; // The 32-byte id of the moderated contract
728
+ bytes identity_id = 2; // The 32-byte id of the identity
729
+ repeated ContractModerationList lists =
730
+ 3; // The lists to read, which the contract's config must declare; at
731
+ // least one, no repeats
732
+ bool prove = 4; // Flag to request a proof as the response
733
+ }
734
+ oneof version { GetContractModerationStatusRequestV0 v0 = 1; }
735
+ }
736
+
737
+ message GetContractModerationStatusResponse {
738
+ // The identity's status on the lists the request named, and on no other: a
739
+ // list that was not read says nothing, so its field is left unset.
740
+ message ContractModerationStatus {
741
+ optional bool banned =
742
+ 1; // Set only when the banlist was read: the identity is on it
743
+ optional uint64 suspended_until =
744
+ 2; // The block time, in milliseconds, until which the identity is
745
+ // suspended; a lapsed suspension stays until it is swept. Unset
746
+ // when the identity is not suspended or the list was not read
747
+ repeated ContractModerationList lists =
748
+ 3; // The lists this status covers, as the request named them
749
+ optional ContractModerationReason ban_reason =
750
+ 4; // Set when the identity is banned: why
751
+ optional ContractModerationReason suspension_reason =
752
+ 5; // Set when the identity is suspended: why
753
+ }
754
+
755
+ message GetContractModerationStatusResponseV0 {
756
+ oneof result {
757
+ ContractModerationStatus status = 1; // The identity's status on the lists read
758
+ Proof proof = 2; // Cryptographic proof of the status, if requested
759
+ }
760
+ ResponseMetadata metadata = 3; // Metadata about the blockchain state
761
+ }
762
+ oneof version { GetContractModerationStatusResponseV0 v0 = 1; }
763
+ }
764
+
765
+ message GetContractModerationEntriesRequest {
766
+ message GetContractModerationEntriesRequestV0 {
767
+ bytes contract_id = 1; // The 32-byte id of the moderated contract
768
+ ContractModerationList list = 2; // The list to read, which the contract's config must declare
769
+ optional bytes start_after =
770
+ 3; // 32-byte identity id; the page starts after it
771
+ optional uint32 limit =
772
+ 4; // Maximum number of entries to return, from 1 to the protocol's
773
+ // max_returned_elements (100); absent means that maximum
774
+ bool prove = 5; // Flag to request a proof as the response
775
+ }
776
+ oneof version { GetContractModerationEntriesRequestV0 v0 = 1; }
777
+ }
778
+
779
+ message GetContractModerationEntriesResponse {
780
+ message ContractModerationEntry {
781
+ bytes identity_id = 1; // The barred identity
782
+ optional uint64 until =
783
+ 2; // For a suspension list entry: the block time, in milliseconds, at
784
+ // which it lapses
785
+ ContractModerationReason reason = 3; // Why the identity is on the list
786
+ }
787
+
788
+ message ContractModerationEntries {
789
+ repeated ContractModerationEntry entries = 1; // The page, in identity id order
790
+ }
791
+
792
+ message GetContractModerationEntriesResponseV0 {
793
+ oneof result {
794
+ ContractModerationEntries entries = 1; // One page of the list
795
+ Proof proof = 2; // Cryptographic proof of the page, if requested
796
+ }
797
+ ResponseMetadata metadata = 3; // Metadata about the blockchain state
798
+ }
799
+ oneof version { GetContractModerationEntriesResponseV0 v0 = 1; }
800
+ }
801
+
802
+ // The records of the documents a contract's moderators deleted, within one
803
+ // document type whose documents they may delete (`canBeDeletedByModerators`):
804
+ // the ones of the document ids named, or one page in document id order.
805
+ message GetContractDocumentRemovalsRequest {
806
+ message DocumentIds {
807
+ repeated bytes document_ids =
808
+ 1; // 32-byte document ids, from 1 to the protocol's
809
+ // max_returned_elements (100), none twice; an id with no record is
810
+ // left out of the response, and proved absent when a proof is asked
811
+ }
812
+
813
+ message Page {
814
+ optional bytes start_after =
815
+ 1; // 32-byte document id; the page starts after it
816
+ optional uint32 limit =
817
+ 2; // Maximum number of records to return, from 1 to the protocol's
818
+ // max_returned_elements (100); absent means that maximum
819
+ }
820
+
821
+ message GetContractDocumentRemovalsRequestV0 {
822
+ bytes contract_id = 1; // The 32-byte id of the moderated contract
823
+ string document_type_name =
824
+ 2; // The document type, which must let moderators delete its documents
825
+ oneof selection {
826
+ DocumentIds document_ids = 3; // The records of these documents
827
+ Page page = 4; // One page of the type's records
828
+ }
829
+ bool prove = 5; // Flag to request a proof as the response
830
+ }
831
+ oneof version { GetContractDocumentRemovalsRequestV0 v0 = 1; }
832
+ }
833
+
834
+ message GetContractDocumentRemovalsResponse {
835
+ message ContractDocumentRemoval {
836
+ bytes document_id = 1; // The id the removed document had
837
+ bytes document_owner_id = 2; // The identity that owned it
838
+ bytes moderator_id = 3; // The contract owner or moderator that removed it
839
+ uint64 removed_at =
840
+ 4; // The time of the block that removed it, in milliseconds
841
+ ContractModerationReason reason = 5; // Why the moderator removed it
842
+ }
843
+
844
+ message ContractDocumentRemovals {
845
+ repeated ContractDocumentRemoval removals =
846
+ 1; // The records, in document id order
847
+ }
848
+
849
+ message GetContractDocumentRemovalsResponseV0 {
850
+ oneof result {
851
+ ContractDocumentRemovals removals = 1; // The records read
852
+ Proof proof = 2; // Cryptographic proof of the records, if requested
853
+ }
854
+ ResponseMetadata metadata = 3; // Metadata about the blockchain state
855
+ }
856
+ oneof version { GetContractDocumentRemovalsResponseV0 v0 = 1; }
857
+ }
858
+
859
+ message GetContractFeePotsRequest {
860
+ message GetContractFeePotsRequestV0 {
861
+ bytes contract_id = 1; // The 32-byte id of the data contract
862
+ bool prove = 2; // Flag to request a proof as the response
863
+ }
864
+ oneof version { GetContractFeePotsRequestV0 v0 = 1; }
865
+ }
866
+
867
+ message GetContractFeePotsResponse {
868
+ // The last payout of a pot, which the claim that made it left in state
869
+ message ContractFeePotLastClaim {
870
+ uint32 epoch = 1; // The epoch (u16) the pot was paid out in; a pot is paid
871
+ // out at most once per epoch
872
+ uint64 time_ms = 2
873
+ [ jstype = JS_STRING ]; // The time of the block that paid the pot out
874
+ bytes claimant_id = 3; // The identity that signed the claim: the contract
875
+ // owner for the owner pot, the member of the
876
+ // moderation team that claimed for the moderators pot
877
+ }
878
+
879
+ // One of the two pots a contract's document action fees collect in
880
+ message ContractFeePot {
881
+ uint64 credits = 1 [ jstype = JS_STRING ]; // What the pot holds
882
+ ContractFeePotLastClaim last_claim =
883
+ 2; // Unset when the pot was never paid out
884
+ }
885
+
886
+ message ContractFeePots {
887
+ ContractFeePot owner = 1; // The pot the contract owner claims
888
+ ContractFeePot moderators = 2; // The pot the moderation team shares
889
+ }
890
+
891
+ message GetContractFeePotsResponseV0 {
892
+ oneof result {
893
+ ContractFeePots pots = 1; // Both pots of the contract
894
+ Proof proof = 2; // Cryptographic proof of the pots, if requested
895
+ }
896
+ ResponseMetadata metadata = 3; // Metadata about the blockchain state
897
+ }
898
+ oneof version { GetContractFeePotsResponseV0 v0 = 1; }
899
+ }
900
+
701
901
  message GetContractGroupsForContractRequest {
702
902
  message GetContractGroupsForContractRequestV0 {
703
903
  bytes contract_id = 1; // The 32-byte id of the contract
@@ -1960,6 +2160,13 @@ message GetDocumentsResponse {
1960
2160
  message ChainedDocuments {
1961
2161
  repeated bytes inner_documents = 1;
1962
2162
  repeated bytes outer_documents = 2;
2163
+ // The join values that have NO outer document, in first
2164
+ // appearance order: referenced documents deleted after the
2165
+ // inner document was written. Only a join property declaring
2166
+ // `refersTo: deletableDocument` can report any; under
2167
+ // `refersTo: permanentDocument` a missing document fails the
2168
+ // query instead.
2169
+ repeated bytes missing_outer_ids = 3;
1963
2170
  }
1964
2171
 
1965
2172
  // A composite query's page and per-sub-query results, documents
@@ -1977,6 +2184,11 @@ message GetDocumentsResponse {
1977
2184
  // value's index-key bytes.
1978
2185
  CountEntries counts = 2;
1979
2186
  }
2187
+ // DOCUMENTS by-id join only: the derived ids that have NO
2188
+ // document, in first appearance order (referenced documents
2189
+ // deleted since). Only a source property declaring
2190
+ // `refersTo: deletableDocument` can report any.
2191
+ repeated bytes missing_ids = 3;
1980
2192
  }
1981
2193
  repeated SubQueryResult sub_results = 2;
1982
2194
  }