dash-platform-sdk 1.6.0-dev.8 → 1.6.0

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": "dash-platform-sdk",
3
- "version": "1.6.0-dev.8",
3
+ "version": "1.6.0",
4
4
  "main": "index.js",
5
5
  "description": "Lightweight SDK for accessing Dash Platform blockchain",
6
6
  "repository": {
@@ -59,6 +59,6 @@
59
59
  "@scure/bip32": "^2.0.0",
60
60
  "@scure/bip39": "^2.0.0",
61
61
  "@scure/btc-signer": "^2.0.1",
62
- "pshenmic-dpp": "2.0.1-dev.5"
62
+ "pshenmic-dpp": "2.0.1-dev.6"
63
63
  }
64
64
  }
@@ -1,5 +1,7 @@
1
1
  import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
2
2
  import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
3
+ import type { GetPathElementsResponse } from "./platform.js";
4
+ import type { GetPathElementsRequest } from "./platform.js";
3
5
  import type { GetShieldedNullifiersResponse } from "./platform.js";
4
6
  import type { GetShieldedNullifiersRequest } from "./platform.js";
5
7
  import type { GetShieldedNotesCountResponse } from "./platform.js";
@@ -216,6 +218,10 @@ export interface IPlatformClient {
216
218
  * @generated from protobuf rpc: getShieldedNullifiers
217
219
  */
218
220
  getShieldedNullifiers(input: GetShieldedNullifiersRequest, options?: RpcOptions): UnaryCall<GetShieldedNullifiersRequest, GetShieldedNullifiersResponse>;
221
+ /**
222
+ * @generated from protobuf rpc: getPathElements
223
+ */
224
+ getPathElements(input: GetPathElementsRequest, options?: RpcOptions): UnaryCall<GetPathElementsRequest, GetPathElementsResponse>;
219
225
  }
220
226
  /**
221
227
  * @generated from protobuf service org.dash.platform.dapi.v0.Platform
@@ -368,4 +374,8 @@ export declare class PlatformClient implements IPlatformClient, ServiceInfo {
368
374
  * @generated from protobuf rpc: getShieldedNullifiers
369
375
  */
370
376
  getShieldedNullifiers(input: GetShieldedNullifiersRequest, options?: RpcOptions): UnaryCall<GetShieldedNullifiersRequest, GetShieldedNullifiersResponse>;
377
+ /**
378
+ * @generated from protobuf rpc: getPathElements
379
+ */
380
+ getPathElements(input: GetPathElementsRequest, options?: RpcOptions): UnaryCall<GetPathElementsRequest, GetPathElementsResponse>;
371
381
  }
@@ -256,4 +256,11 @@ export class PlatformClient {
256
256
  const method = this.methods[34], opt = this._transport.mergeOptions(options);
257
257
  return stackIntercept("unary", this._transport, method, opt, input);
258
258
  }
259
+ /**
260
+ * @generated from protobuf rpc: getPathElements
261
+ */
262
+ getPathElements(input, options) {
263
+ const method = this.methods[35], opt = this._transport.mergeOptions(options);
264
+ return stackIntercept("unary", this._transport, method, opt, input);
265
+ }
259
266
  }
@@ -4912,6 +4912,93 @@ export interface CanonicalVote {
4912
4912
  */
4913
4913
  chainId: string;
4914
4914
  }
4915
+ /**
4916
+ * @generated from protobuf message org.dash.platform.dapi.v0.GetPathElementsRequest
4917
+ */
4918
+ export interface GetPathElementsRequest {
4919
+ /**
4920
+ * @generated from protobuf oneof: version
4921
+ */
4922
+ version: {
4923
+ oneofKind: "v0";
4924
+ /**
4925
+ * @generated from protobuf field: org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 v0 = 1
4926
+ */
4927
+ v0: GetPathElementsRequest_GetPathElementsRequestV0;
4928
+ } | {
4929
+ oneofKind: undefined;
4930
+ };
4931
+ }
4932
+ /**
4933
+ * @generated from protobuf message org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0
4934
+ */
4935
+ export interface GetPathElementsRequest_GetPathElementsRequestV0 {
4936
+ /**
4937
+ * @generated from protobuf field: repeated bytes path = 1
4938
+ */
4939
+ path: Uint8Array[];
4940
+ /**
4941
+ * @generated from protobuf field: repeated bytes keys = 2
4942
+ */
4943
+ keys: Uint8Array[];
4944
+ /**
4945
+ * @generated from protobuf field: bool prove = 3
4946
+ */
4947
+ prove: boolean;
4948
+ }
4949
+ /**
4950
+ * @generated from protobuf message org.dash.platform.dapi.v0.GetPathElementsResponse
4951
+ */
4952
+ export interface GetPathElementsResponse {
4953
+ /**
4954
+ * @generated from protobuf oneof: version
4955
+ */
4956
+ version: {
4957
+ oneofKind: "v0";
4958
+ /**
4959
+ * @generated from protobuf field: org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 v0 = 1
4960
+ */
4961
+ v0: GetPathElementsResponse_GetPathElementsResponseV0;
4962
+ } | {
4963
+ oneofKind: undefined;
4964
+ };
4965
+ }
4966
+ /**
4967
+ * @generated from protobuf message org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0
4968
+ */
4969
+ export interface GetPathElementsResponse_GetPathElementsResponseV0 {
4970
+ /**
4971
+ * @generated from protobuf oneof: result
4972
+ */
4973
+ result: {
4974
+ oneofKind: "elements";
4975
+ /**
4976
+ * @generated from protobuf field: org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements elements = 1
4977
+ */
4978
+ elements: GetPathElementsResponse_GetPathElementsResponseV0_Elements;
4979
+ } | {
4980
+ oneofKind: "proof";
4981
+ /**
4982
+ * @generated from protobuf field: org.dash.platform.dapi.v0.Proof proof = 2
4983
+ */
4984
+ proof: Proof;
4985
+ } | {
4986
+ oneofKind: undefined;
4987
+ };
4988
+ /**
4989
+ * @generated from protobuf field: org.dash.platform.dapi.v0.ResponseMetadata metadata = 3
4990
+ */
4991
+ metadata?: ResponseMetadata;
4992
+ }
4993
+ /**
4994
+ * @generated from protobuf message org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements
4995
+ */
4996
+ export interface GetPathElementsResponse_GetPathElementsResponseV0_Elements {
4997
+ /**
4998
+ * @generated from protobuf field: repeated bytes elements = 1
4999
+ */
5000
+ elements: Uint8Array[];
5001
+ }
4915
5002
  /**
4916
5003
  * @generated from protobuf enum org.dash.platform.dapi.v0.SignedMsgType
4917
5004
  */
@@ -7405,6 +7492,56 @@ declare class CanonicalVote$Type extends MessageType<CanonicalVote> {
7405
7492
  * @generated MessageType for protobuf message org.dash.platform.dapi.v0.CanonicalVote
7406
7493
  */
7407
7494
  export declare const CanonicalVote: CanonicalVote$Type;
7495
+ declare class GetPathElementsRequest$Type extends MessageType<GetPathElementsRequest> {
7496
+ constructor();
7497
+ create(value?: PartialMessage<GetPathElementsRequest>): GetPathElementsRequest;
7498
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetPathElementsRequest): GetPathElementsRequest;
7499
+ internalBinaryWrite(message: GetPathElementsRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
7500
+ }
7501
+ /**
7502
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetPathElementsRequest
7503
+ */
7504
+ export declare const GetPathElementsRequest: GetPathElementsRequest$Type;
7505
+ declare class GetPathElementsRequest_GetPathElementsRequestV0$Type extends MessageType<GetPathElementsRequest_GetPathElementsRequestV0> {
7506
+ constructor();
7507
+ create(value?: PartialMessage<GetPathElementsRequest_GetPathElementsRequestV0>): GetPathElementsRequest_GetPathElementsRequestV0;
7508
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetPathElementsRequest_GetPathElementsRequestV0): GetPathElementsRequest_GetPathElementsRequestV0;
7509
+ internalBinaryWrite(message: GetPathElementsRequest_GetPathElementsRequestV0, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
7510
+ }
7511
+ /**
7512
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0
7513
+ */
7514
+ export declare const GetPathElementsRequest_GetPathElementsRequestV0: GetPathElementsRequest_GetPathElementsRequestV0$Type;
7515
+ declare class GetPathElementsResponse$Type extends MessageType<GetPathElementsResponse> {
7516
+ constructor();
7517
+ create(value?: PartialMessage<GetPathElementsResponse>): GetPathElementsResponse;
7518
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetPathElementsResponse): GetPathElementsResponse;
7519
+ internalBinaryWrite(message: GetPathElementsResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
7520
+ }
7521
+ /**
7522
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetPathElementsResponse
7523
+ */
7524
+ export declare const GetPathElementsResponse: GetPathElementsResponse$Type;
7525
+ declare class GetPathElementsResponse_GetPathElementsResponseV0$Type extends MessageType<GetPathElementsResponse_GetPathElementsResponseV0> {
7526
+ constructor();
7527
+ create(value?: PartialMessage<GetPathElementsResponse_GetPathElementsResponseV0>): GetPathElementsResponse_GetPathElementsResponseV0;
7528
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetPathElementsResponse_GetPathElementsResponseV0): GetPathElementsResponse_GetPathElementsResponseV0;
7529
+ internalBinaryWrite(message: GetPathElementsResponse_GetPathElementsResponseV0, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
7530
+ }
7531
+ /**
7532
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0
7533
+ */
7534
+ export declare const GetPathElementsResponse_GetPathElementsResponseV0: GetPathElementsResponse_GetPathElementsResponseV0$Type;
7535
+ declare class GetPathElementsResponse_GetPathElementsResponseV0_Elements$Type extends MessageType<GetPathElementsResponse_GetPathElementsResponseV0_Elements> {
7536
+ constructor();
7537
+ create(value?: PartialMessage<GetPathElementsResponse_GetPathElementsResponseV0_Elements>): GetPathElementsResponse_GetPathElementsResponseV0_Elements;
7538
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetPathElementsResponse_GetPathElementsResponseV0_Elements): GetPathElementsResponse_GetPathElementsResponseV0_Elements;
7539
+ internalBinaryWrite(message: GetPathElementsResponse_GetPathElementsResponseV0_Elements, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
7540
+ }
7541
+ /**
7542
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements
7543
+ */
7544
+ export declare const GetPathElementsResponse_GetPathElementsResponseV0_Elements: GetPathElementsResponse_GetPathElementsResponseV0_Elements$Type;
7408
7545
  /**
7409
7546
  * @generated ServiceType for protobuf service org.dash.platform.dapi.v0.Platform
7410
7547
  */
@@ -15045,6 +15045,283 @@ class CanonicalVote$Type extends MessageType {
15045
15045
  * @generated MessageType for protobuf message org.dash.platform.dapi.v0.CanonicalVote
15046
15046
  */
15047
15047
  export const CanonicalVote = new CanonicalVote$Type();
15048
+ // @generated message type with reflection information, may provide speed optimized methods
15049
+ class GetPathElementsRequest$Type extends MessageType {
15050
+ constructor() {
15051
+ super("org.dash.platform.dapi.v0.GetPathElementsRequest", [
15052
+ { no: 1, name: "v0", kind: "message", oneof: "version", T: () => GetPathElementsRequest_GetPathElementsRequestV0 }
15053
+ ]);
15054
+ }
15055
+ create(value) {
15056
+ const message = globalThis.Object.create((this.messagePrototype));
15057
+ message.version = { oneofKind: undefined };
15058
+ if (value !== undefined)
15059
+ reflectionMergePartial(this, message, value);
15060
+ return message;
15061
+ }
15062
+ internalBinaryRead(reader, length, options, target) {
15063
+ let message = target ?? this.create(), end = reader.pos + length;
15064
+ while (reader.pos < end) {
15065
+ let [fieldNo, wireType] = reader.tag();
15066
+ switch (fieldNo) {
15067
+ case /* org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 v0 */ 1:
15068
+ message.version = {
15069
+ oneofKind: "v0",
15070
+ v0: GetPathElementsRequest_GetPathElementsRequestV0.internalBinaryRead(reader, reader.uint32(), options, message.version.v0)
15071
+ };
15072
+ break;
15073
+ default:
15074
+ let u = options.readUnknownField;
15075
+ if (u === "throw")
15076
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
15077
+ let d = reader.skip(wireType);
15078
+ if (u !== false)
15079
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
15080
+ }
15081
+ }
15082
+ return message;
15083
+ }
15084
+ internalBinaryWrite(message, writer, options) {
15085
+ /* org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0 v0 = 1; */
15086
+ if (message.version.oneofKind === "v0")
15087
+ GetPathElementsRequest_GetPathElementsRequestV0.internalBinaryWrite(message.version.v0, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
15088
+ let u = options.writeUnknownFields;
15089
+ if (u !== false)
15090
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
15091
+ return writer;
15092
+ }
15093
+ }
15094
+ /**
15095
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetPathElementsRequest
15096
+ */
15097
+ export const GetPathElementsRequest = new GetPathElementsRequest$Type();
15098
+ // @generated message type with reflection information, may provide speed optimized methods
15099
+ class GetPathElementsRequest_GetPathElementsRequestV0$Type extends MessageType {
15100
+ constructor() {
15101
+ super("org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0", [
15102
+ { no: 1, name: "path", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 12 /*ScalarType.BYTES*/ },
15103
+ { no: 2, name: "keys", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 12 /*ScalarType.BYTES*/ },
15104
+ { no: 3, name: "prove", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
15105
+ ]);
15106
+ }
15107
+ create(value) {
15108
+ const message = globalThis.Object.create((this.messagePrototype));
15109
+ message.path = [];
15110
+ message.keys = [];
15111
+ message.prove = false;
15112
+ if (value !== undefined)
15113
+ reflectionMergePartial(this, message, value);
15114
+ return message;
15115
+ }
15116
+ internalBinaryRead(reader, length, options, target) {
15117
+ let message = target ?? this.create(), end = reader.pos + length;
15118
+ while (reader.pos < end) {
15119
+ let [fieldNo, wireType] = reader.tag();
15120
+ switch (fieldNo) {
15121
+ case /* repeated bytes path */ 1:
15122
+ message.path.push(reader.bytes());
15123
+ break;
15124
+ case /* repeated bytes keys */ 2:
15125
+ message.keys.push(reader.bytes());
15126
+ break;
15127
+ case /* bool prove */ 3:
15128
+ message.prove = reader.bool();
15129
+ break;
15130
+ default:
15131
+ let u = options.readUnknownField;
15132
+ if (u === "throw")
15133
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
15134
+ let d = reader.skip(wireType);
15135
+ if (u !== false)
15136
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
15137
+ }
15138
+ }
15139
+ return message;
15140
+ }
15141
+ internalBinaryWrite(message, writer, options) {
15142
+ /* repeated bytes path = 1; */
15143
+ for (let i = 0; i < message.path.length; i++)
15144
+ writer.tag(1, WireType.LengthDelimited).bytes(message.path[i]);
15145
+ /* repeated bytes keys = 2; */
15146
+ for (let i = 0; i < message.keys.length; i++)
15147
+ writer.tag(2, WireType.LengthDelimited).bytes(message.keys[i]);
15148
+ /* bool prove = 3; */
15149
+ if (message.prove !== false)
15150
+ writer.tag(3, WireType.Varint).bool(message.prove);
15151
+ let u = options.writeUnknownFields;
15152
+ if (u !== false)
15153
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
15154
+ return writer;
15155
+ }
15156
+ }
15157
+ /**
15158
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetPathElementsRequest.GetPathElementsRequestV0
15159
+ */
15160
+ export const GetPathElementsRequest_GetPathElementsRequestV0 = new GetPathElementsRequest_GetPathElementsRequestV0$Type();
15161
+ // @generated message type with reflection information, may provide speed optimized methods
15162
+ class GetPathElementsResponse$Type extends MessageType {
15163
+ constructor() {
15164
+ super("org.dash.platform.dapi.v0.GetPathElementsResponse", [
15165
+ { no: 1, name: "v0", kind: "message", oneof: "version", T: () => GetPathElementsResponse_GetPathElementsResponseV0 }
15166
+ ]);
15167
+ }
15168
+ create(value) {
15169
+ const message = globalThis.Object.create((this.messagePrototype));
15170
+ message.version = { oneofKind: undefined };
15171
+ if (value !== undefined)
15172
+ reflectionMergePartial(this, message, value);
15173
+ return message;
15174
+ }
15175
+ internalBinaryRead(reader, length, options, target) {
15176
+ let message = target ?? this.create(), end = reader.pos + length;
15177
+ while (reader.pos < end) {
15178
+ let [fieldNo, wireType] = reader.tag();
15179
+ switch (fieldNo) {
15180
+ case /* org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 v0 */ 1:
15181
+ message.version = {
15182
+ oneofKind: "v0",
15183
+ v0: GetPathElementsResponse_GetPathElementsResponseV0.internalBinaryRead(reader, reader.uint32(), options, message.version.v0)
15184
+ };
15185
+ break;
15186
+ default:
15187
+ let u = options.readUnknownField;
15188
+ if (u === "throw")
15189
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
15190
+ let d = reader.skip(wireType);
15191
+ if (u !== false)
15192
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
15193
+ }
15194
+ }
15195
+ return message;
15196
+ }
15197
+ internalBinaryWrite(message, writer, options) {
15198
+ /* org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0 v0 = 1; */
15199
+ if (message.version.oneofKind === "v0")
15200
+ GetPathElementsResponse_GetPathElementsResponseV0.internalBinaryWrite(message.version.v0, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
15201
+ let u = options.writeUnknownFields;
15202
+ if (u !== false)
15203
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
15204
+ return writer;
15205
+ }
15206
+ }
15207
+ /**
15208
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetPathElementsResponse
15209
+ */
15210
+ export const GetPathElementsResponse = new GetPathElementsResponse$Type();
15211
+ // @generated message type with reflection information, may provide speed optimized methods
15212
+ class GetPathElementsResponse_GetPathElementsResponseV0$Type extends MessageType {
15213
+ constructor() {
15214
+ super("org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0", [
15215
+ { no: 1, name: "elements", kind: "message", oneof: "result", T: () => GetPathElementsResponse_GetPathElementsResponseV0_Elements },
15216
+ { no: 2, name: "proof", kind: "message", oneof: "result", T: () => Proof },
15217
+ { no: 3, name: "metadata", kind: "message", T: () => ResponseMetadata }
15218
+ ]);
15219
+ }
15220
+ create(value) {
15221
+ const message = globalThis.Object.create((this.messagePrototype));
15222
+ message.result = { oneofKind: undefined };
15223
+ if (value !== undefined)
15224
+ reflectionMergePartial(this, message, value);
15225
+ return message;
15226
+ }
15227
+ internalBinaryRead(reader, length, options, target) {
15228
+ let message = target ?? this.create(), end = reader.pos + length;
15229
+ while (reader.pos < end) {
15230
+ let [fieldNo, wireType] = reader.tag();
15231
+ switch (fieldNo) {
15232
+ case /* org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements elements */ 1:
15233
+ message.result = {
15234
+ oneofKind: "elements",
15235
+ elements: GetPathElementsResponse_GetPathElementsResponseV0_Elements.internalBinaryRead(reader, reader.uint32(), options, message.result.elements)
15236
+ };
15237
+ break;
15238
+ case /* org.dash.platform.dapi.v0.Proof proof */ 2:
15239
+ message.result = {
15240
+ oneofKind: "proof",
15241
+ proof: Proof.internalBinaryRead(reader, reader.uint32(), options, message.result.proof)
15242
+ };
15243
+ break;
15244
+ case /* org.dash.platform.dapi.v0.ResponseMetadata metadata */ 3:
15245
+ message.metadata = ResponseMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
15246
+ break;
15247
+ default:
15248
+ let u = options.readUnknownField;
15249
+ if (u === "throw")
15250
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
15251
+ let d = reader.skip(wireType);
15252
+ if (u !== false)
15253
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
15254
+ }
15255
+ }
15256
+ return message;
15257
+ }
15258
+ internalBinaryWrite(message, writer, options) {
15259
+ /* org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements elements = 1; */
15260
+ if (message.result.oneofKind === "elements")
15261
+ GetPathElementsResponse_GetPathElementsResponseV0_Elements.internalBinaryWrite(message.result.elements, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
15262
+ /* org.dash.platform.dapi.v0.Proof proof = 2; */
15263
+ if (message.result.oneofKind === "proof")
15264
+ Proof.internalBinaryWrite(message.result.proof, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
15265
+ /* org.dash.platform.dapi.v0.ResponseMetadata metadata = 3; */
15266
+ if (message.metadata)
15267
+ ResponseMetadata.internalBinaryWrite(message.metadata, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
15268
+ let u = options.writeUnknownFields;
15269
+ if (u !== false)
15270
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
15271
+ return writer;
15272
+ }
15273
+ }
15274
+ /**
15275
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0
15276
+ */
15277
+ export const GetPathElementsResponse_GetPathElementsResponseV0 = new GetPathElementsResponse_GetPathElementsResponseV0$Type();
15278
+ // @generated message type with reflection information, may provide speed optimized methods
15279
+ class GetPathElementsResponse_GetPathElementsResponseV0_Elements$Type extends MessageType {
15280
+ constructor() {
15281
+ super("org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements", [
15282
+ { no: 1, name: "elements", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 12 /*ScalarType.BYTES*/ }
15283
+ ]);
15284
+ }
15285
+ create(value) {
15286
+ const message = globalThis.Object.create((this.messagePrototype));
15287
+ message.elements = [];
15288
+ if (value !== undefined)
15289
+ reflectionMergePartial(this, message, value);
15290
+ return message;
15291
+ }
15292
+ internalBinaryRead(reader, length, options, target) {
15293
+ let message = target ?? this.create(), end = reader.pos + length;
15294
+ while (reader.pos < end) {
15295
+ let [fieldNo, wireType] = reader.tag();
15296
+ switch (fieldNo) {
15297
+ case /* repeated bytes elements */ 1:
15298
+ message.elements.push(reader.bytes());
15299
+ break;
15300
+ default:
15301
+ let u = options.readUnknownField;
15302
+ if (u === "throw")
15303
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
15304
+ let d = reader.skip(wireType);
15305
+ if (u !== false)
15306
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
15307
+ }
15308
+ }
15309
+ return message;
15310
+ }
15311
+ internalBinaryWrite(message, writer, options) {
15312
+ /* repeated bytes elements = 1; */
15313
+ for (let i = 0; i < message.elements.length; i++)
15314
+ writer.tag(1, WireType.LengthDelimited).bytes(message.elements[i]);
15315
+ let u = options.writeUnknownFields;
15316
+ if (u !== false)
15317
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
15318
+ return writer;
15319
+ }
15320
+ }
15321
+ /**
15322
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetPathElementsResponse.GetPathElementsResponseV0.Elements
15323
+ */
15324
+ export const GetPathElementsResponse_GetPathElementsResponseV0_Elements = new GetPathElementsResponse_GetPathElementsResponseV0_Elements$Type();
15048
15325
  /**
15049
15326
  * @generated ServiceType for protobuf service org.dash.platform.dapi.v0.Platform
15050
15327
  */
@@ -15083,5 +15360,6 @@ export const Platform = new ServiceType("org.dash.platform.dapi.v0.Platform", [
15083
15360
  { name: "getMostRecentShieldedAnchor", options: {}, I: GetMostRecentShieldedAnchorRequest, O: GetMostRecentShieldedAnchorResponse },
15084
15361
  { name: "getShieldedPoolState", options: {}, I: GetShieldedPoolStateRequest, O: GetShieldedPoolStateResponse },
15085
15362
  { name: "getShieldedNotesCount", options: {}, I: GetShieldedNotesCountRequest, O: GetShieldedNotesCountResponse },
15086
- { name: "getShieldedNullifiers", options: {}, I: GetShieldedNullifiersRequest, O: GetShieldedNullifiersResponse }
15363
+ { name: "getShieldedNullifiers", options: {}, I: GetShieldedNullifiersRequest, O: GetShieldedNullifiersResponse },
15364
+ { name: "getPathElements", options: {}, I: GetPathElementsRequest, O: GetPathElementsResponse }
15087
15365
  ]);
@@ -0,0 +1,4 @@
1
+ import { GRPCPool } from '../grpcConnectionPool.js';
2
+ import { QuorumKeyProvider } from '../quorumKeyProvider.js';
3
+ import { VerifiedPathElement } from 'pshenmic-dpp';
4
+ export default function getPathElements(grpcPool: GRPCPool, quorumKeyProvider: QuorumKeyProvider, path: Uint8Array[], keys: Uint8Array[]): Promise<VerifiedPathElement[]>;
@@ -0,0 +1,27 @@
1
+ import { GetPathElementsRequest } from '../../proto/generated/platform.js';
2
+ import { verifyPathElementsProof } from 'pshenmic-dpp';
3
+ import QueryExecutor from '../QueryExecutor.js';
4
+ export default async function getPathElements(grpcPool, quorumKeyProvider, path, keys) {
5
+ const getPathElementsRequest = GetPathElementsRequest.create({
6
+ version: {
7
+ oneofKind: 'v0',
8
+ v0: {
9
+ path,
10
+ keys,
11
+ prove: true
12
+ }
13
+ }
14
+ });
15
+ return await QueryExecutor.build(grpcPool, quorumKeyProvider)
16
+ .setGrpcRequest('getPathElements', getPathElementsRequest)
17
+ // the response without proof returns serialized elements without their keys, they can't be decoded
18
+ .setRequireProof(true)
19
+ .setProofVerifier(verifyPathElementsProof, (_, platformVersion) => [path, keys, platformVersion])
20
+ .mapResponse(data => {
21
+ if (!data.proved) {
22
+ throw new Error('Path elements can only be requested with proof');
23
+ }
24
+ return data.verified.elements;
25
+ })
26
+ .execute();
27
+ }
@@ -4,7 +4,7 @@ import { NodeStatus } from '../../types.js';
4
4
  import { EpochInfo } from './epochInfos.js';
5
5
  import { FinalizedEpochInfo } from './finalizedEpochInfos.js';
6
6
  import { CurrentQuorumsInfo } from './getCurrentQuorumsInfo.js';
7
- import { PlatformVersionWASM } from 'pshenmic-dpp';
7
+ import { PlatformVersionWASM, VerifiedPathElement } from 'pshenmic-dpp';
8
8
  /**
9
9
  * Node controller for requesting information about DAPI node
10
10
  *
@@ -58,4 +58,15 @@ export declare class NodeController {
58
58
  * @return {Promise<CurrentQuorumsInfo>}
59
59
  */
60
60
  getCurrentQuorumsInfo(): Promise<CurrentQuorumsInfo>;
61
+ /**
62
+ * Retrieves GroveDB elements stored under the given keys of a path in the platform state
63
+ * Returns the found elements in key order, keys with nothing stored under them are omitted (their absence is still proven).
64
+ * Always requested with proof, even if proofs are disabled
65
+ *
66
+ * @param path {Uint8Array[]} - path of the subtree, as a list of path segments
67
+ * @param keys {Uint8Array[]} - keys of the elements in the subtree
68
+ *
69
+ * @return {Promise<VerifiedPathElement[]>}
70
+ */
71
+ getPathElements(path: Uint8Array[], keys: Uint8Array[]): Promise<VerifiedPathElement[]>;
61
72
  }
package/src/node/index.js CHANGED
@@ -4,6 +4,7 @@ import getFinalizedEpochsInfo from './finalizedEpochInfos.js';
4
4
  import getTotalCredits from './totalCredits.js';
5
5
  import getCurrentQuorumsInfo from './getCurrentQuorumsInfo.js';
6
6
  import getProtocolVersion from './getProtocolVersion.js';
7
+ import getPathElements from './getPathElements.js';
7
8
  /**
8
9
  * Node controller for requesting information about DAPI node
9
10
  *
@@ -72,4 +73,17 @@ export class NodeController {
72
73
  async getCurrentQuorumsInfo() {
73
74
  return await getCurrentQuorumsInfo(this.grpcPool);
74
75
  }
76
+ /**
77
+ * Retrieves GroveDB elements stored under the given keys of a path in the platform state
78
+ * Returns the found elements in key order, keys with nothing stored under them are omitted (their absence is still proven).
79
+ * Always requested with proof, even if proofs are disabled
80
+ *
81
+ * @param path {Uint8Array[]} - path of the subtree, as a list of path segments
82
+ * @param keys {Uint8Array[]} - keys of the elements in the subtree
83
+ *
84
+ * @return {Promise<VerifiedPathElement[]>}
85
+ */
86
+ async getPathElements(path, keys) {
87
+ return await getPathElements(this.grpcPool, this.quorumKeyProvider, path, keys);
88
+ }
75
89
  }
@@ -0,0 +1 @@
1
+ export {};