@dashevo/dapi-grpc 5.0.0-beta.1 → 5.0.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/dapi-grpc",
3
- "version": "5.0.0-beta.1",
3
+ "version": "5.0.0-beta.2",
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": "5.0.0-beta.1",
48
+ "@dashevo/grpc-common": "5.0.0-beta.2",
49
49
  "@dashevo/protobufjs": "6.10.5",
50
50
  "@grpc/grpc-js": "^1.14.3",
51
51
  "@improbable-eng/grpc-web": "^0.15.0",
@@ -3785,6 +3785,20 @@ message GetGroupActionsResponse {
3785
3785
  optional string public_note = 3; // Public note
3786
3786
  }
3787
3787
 
3788
+ // Mint straight into the token's shielded pool (protocol version 14+)
3789
+ message MintToPoolEvent {
3790
+ uint64 amount = 1; // Amount minted into the pool
3791
+ bytes actions_digest = 2; // Digest of the Orchard actions every signer commits to
3792
+ optional string public_note = 3; // Public note
3793
+ }
3794
+
3795
+ // Burn of notes held in the token's shielded pool (protocol version 14+)
3796
+ message BurnFromPoolEvent {
3797
+ uint64 amount = 1; // Amount destroyed
3798
+ bytes actions_digest = 2; // Digest of the Orchard actions every signer commits to
3799
+ optional string public_note = 3; // Public note
3800
+ }
3801
+
3788
3802
  // Event associated with this action
3789
3803
  message GroupActionEvent {
3790
3804
  oneof event_type {
@@ -3824,6 +3838,8 @@ message GetGroupActionsResponse {
3824
3838
  7; // Token configuration update details
3825
3839
  UpdateDirectPurchasePriceEvent update_price =
3826
3840
  8; // Updating the token direct selling price
3841
+ MintToPoolEvent mint_to_pool = 9; // Mint into the token shielded pool
3842
+ BurnFromPoolEvent burn_from_pool = 10; // Burn from the token shielded pool
3827
3843
  }
3828
3844
  }
3829
3845
 
@@ -4057,11 +4073,15 @@ message GetRecentCompactedAddressBalanceChangesResponse {
4057
4073
 
4058
4074
  // --- Shielded Pool Queries ---
4059
4075
 
4076
+ // Every shielded pool query below targets the credit shielded pool unless `token_id` is set,
4077
+ // in which case it targets that token's own shielded pool (protocol version 14+; the 32-byte
4078
+ // token id). Responses have the same shape for both pools.
4060
4079
  message GetShieldedEncryptedNotesRequest {
4061
4080
  message GetShieldedEncryptedNotesRequestV0 {
4062
4081
  uint64 start_index = 1;
4063
4082
  uint32 count = 2;
4064
4083
  bool prove = 3;
4084
+ optional bytes token_id = 4; // target a token's shielded pool instead of the credit pool
4065
4085
  }
4066
4086
  oneof version { GetShieldedEncryptedNotesRequestV0 v0 = 1; }
4067
4087
  }
@@ -4089,6 +4109,7 @@ message GetShieldedEncryptedNotesResponse {
4089
4109
  message GetShieldedAnchorsRequest {
4090
4110
  message GetShieldedAnchorsRequestV0 {
4091
4111
  bool prove = 1;
4112
+ optional bytes token_id = 2; // target a token's shielded pool instead of the credit pool
4092
4113
  }
4093
4114
  oneof version { GetShieldedAnchorsRequestV0 v0 = 1; }
4094
4115
  }
@@ -4110,6 +4131,7 @@ message GetShieldedAnchorsResponse {
4110
4131
  message GetMostRecentShieldedAnchorRequest {
4111
4132
  message GetMostRecentShieldedAnchorRequestV0 {
4112
4133
  bool prove = 1;
4134
+ optional bytes token_id = 2; // target a token's shielded pool instead of the credit pool
4113
4135
  }
4114
4136
  oneof version { GetMostRecentShieldedAnchorRequestV0 v0 = 1; }
4115
4137
  }
@@ -4128,6 +4150,7 @@ message GetMostRecentShieldedAnchorResponse {
4128
4150
  message GetShieldedPoolStateRequest {
4129
4151
  message GetShieldedPoolStateRequestV0 {
4130
4152
  bool prove = 1;
4153
+ optional bytes token_id = 2; // target a token's shielded pool instead of the credit pool
4131
4154
  }
4132
4155
  oneof version { GetShieldedPoolStateRequestV0 v0 = 1; }
4133
4156
  }
@@ -4153,6 +4176,7 @@ message GetShieldedPoolStateResponse {
4153
4176
  message GetShieldedNotesCountRequest {
4154
4177
  message GetShieldedNotesCountRequestV0 {
4155
4178
  bool prove = 1;
4179
+ optional bytes token_id = 2; // target a token's shielded pool instead of the credit pool
4156
4180
  }
4157
4181
  oneof version { GetShieldedNotesCountRequestV0 v0 = 1; }
4158
4182
  }
@@ -4172,6 +4196,7 @@ message GetShieldedNullifiersRequest {
4172
4196
  message GetShieldedNullifiersRequestV0 {
4173
4197
  repeated bytes nullifiers = 1;
4174
4198
  bool prove = 2;
4199
+ optional bytes token_id = 3; // target a token's shielded pool instead of the credit pool
4175
4200
  }
4176
4201
  oneof version { GetShieldedNullifiersRequestV0 v0 = 1; }
4177
4202
  }
@@ -0,0 +1,51 @@
1
+ const assert = require('node:assert/strict');
2
+ const nodeMessages = require('../../clients/platform/v0/nodejs/platform_protoc');
3
+ const webMessages = require('../../clients/platform/v0/web/platform_pb');
4
+ const protobufMessages = require('../../clients/platform/v0/nodejs/platform_pbjs');
5
+ const driveMessages = require('../../clients/drive/v0/nodejs/drive_pbjs');
6
+
7
+ const requestNames = [
8
+ 'GetShieldedEncryptedNotesRequest',
9
+ 'GetShieldedAnchorsRequest',
10
+ 'GetMostRecentShieldedAnchorRequest',
11
+ 'GetShieldedPoolStateRequest',
12
+ 'GetShieldedNotesCountRequest',
13
+ 'GetShieldedNullifiersRequest',
14
+ ];
15
+
16
+ describe('shielded query token selectors', () => {
17
+ requestNames.forEach((name) => {
18
+ describe(name, () => {
19
+ const NodeRequest = nodeMessages[name][`${name}V0`];
20
+ const WebRequest = webMessages[name][`${name}V0`];
21
+ const ProtobufRequest = protobufMessages.org.dash.platform.dapi.v0[name][`${name}V0`];
22
+ const DriveRequest = driveMessages.org.dash.platform.dapi.v0[name][`${name}V0`];
23
+
24
+ [undefined, Buffer.alloc(32, 7)].forEach((tokenId) => {
25
+ it(`should preserve the ${tokenId ? 'token' : 'credit'} pool selector across clients`, () => {
26
+ const request = new NodeRequest();
27
+ if (tokenId) {
28
+ request.setTokenId(tokenId);
29
+ }
30
+ const webRequest = WebRequest.deserializeBinary(request.serializeBinary());
31
+ assert.equal(webRequest.hasTokenId(), Boolean(tokenId));
32
+ if (tokenId) {
33
+ assert.deepEqual(Buffer.from(webRequest.getTokenId_asU8()), tokenId);
34
+ }
35
+
36
+ const protobufRequest = ProtobufRequest.decode(webRequest.serializeBinary());
37
+ assert.equal(Object.hasOwn(protobufRequest, 'tokenId'), Boolean(tokenId));
38
+ const driveRequest = DriveRequest.decode(ProtobufRequest.encode(protobufRequest).finish());
39
+ assert.equal(Object.hasOwn(driveRequest, 'tokenId'), Boolean(tokenId));
40
+ const roundTrip = NodeRequest.deserializeBinary(DriveRequest.encode(driveRequest).finish());
41
+ assert.equal(roundTrip.hasTokenId(), Boolean(tokenId));
42
+ if (tokenId) {
43
+ assert.deepEqual(Buffer.from(roundTrip.getTokenId_asU8()), tokenId);
44
+ roundTrip.clearTokenId();
45
+ assert.equal(roundTrip.hasTokenId(), false);
46
+ }
47
+ });
48
+ });
49
+ });
50
+ });
51
+ });