dash-platform-sdk 1.3.0-dev.10 → 1.3.0-dev.11

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.3.0-dev.10",
3
+ "version": "1.3.0-dev.11",
4
4
  "main": "index.js",
5
5
  "description": "Lightweight SDK for accessing Dash Platform blockchain",
6
6
  "ts-standard": {
@@ -58,6 +58,6 @@
58
58
  "@scure/bip39": "^2.0.0",
59
59
  "@scure/btc-signer": "^2.0.1",
60
60
  "cbor-x": "^1.6.0",
61
- "pshenmic-dpp": "1.1.0-dev.7"
61
+ "pshenmic-dpp": "1.1.2-dev.4"
62
62
  }
63
63
  }
@@ -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 { WaitForStateTransitionResultResponse } from "./platform.js";
4
+ import type { WaitForStateTransitionResultRequest } from "./platform.js";
3
5
  import type { GetTokenTotalSupplyResponse } from "./platform.js";
4
6
  import type { GetTokenTotalSupplyRequest } from "./platform.js";
5
7
  import type { GetTokenDirectPurchasePricesResponse } from "./platform.js";
@@ -144,6 +146,10 @@ export interface IPlatformClient {
144
146
  * @generated from protobuf rpc: getTokenTotalSupply
145
147
  */
146
148
  getTokenTotalSupply(input: GetTokenTotalSupplyRequest, options?: RpcOptions): UnaryCall<GetTokenTotalSupplyRequest, GetTokenTotalSupplyResponse>;
149
+ /**
150
+ * @generated from protobuf rpc: waitForStateTransitionResult
151
+ */
152
+ waitForStateTransitionResult(input: WaitForStateTransitionResultRequest, options?: RpcOptions): UnaryCall<WaitForStateTransitionResultRequest, WaitForStateTransitionResultResponse>;
147
153
  }
148
154
  /**
149
155
  * @generated from protobuf service org.dash.platform.dapi.v0.Platform
@@ -248,4 +254,8 @@ export declare class PlatformClient implements IPlatformClient, ServiceInfo {
248
254
  * @generated from protobuf rpc: getTokenTotalSupply
249
255
  */
250
256
  getTokenTotalSupply(input: GetTokenTotalSupplyRequest, options?: RpcOptions): UnaryCall<GetTokenTotalSupplyRequest, GetTokenTotalSupplyResponse>;
257
+ /**
258
+ * @generated from protobuf rpc: waitForStateTransitionResult
259
+ */
260
+ waitForStateTransitionResult(input: WaitForStateTransitionResultRequest, options?: RpcOptions): UnaryCall<WaitForStateTransitionResultRequest, WaitForStateTransitionResultResponse>;
251
261
  }
@@ -172,4 +172,11 @@ export class PlatformClient {
172
172
  const method = this.methods[22], opt = this._transport.mergeOptions(options);
173
173
  return stackIntercept("unary", this._transport, method, opt, input);
174
174
  }
175
+ /**
176
+ * @generated from protobuf rpc: waitForStateTransitionResult
177
+ */
178
+ waitForStateTransitionResult(input, options) {
179
+ const method = this.methods[23], opt = this._transport.mergeOptions(options);
180
+ return stackIntercept("unary", this._transport, method, opt, input);
181
+ }
175
182
  }
@@ -2709,6 +2709,80 @@ export interface CanonicalVote {
2709
2709
  */
2710
2710
  chainId: string;
2711
2711
  }
2712
+ /**
2713
+ * @generated from protobuf message org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest
2714
+ */
2715
+ export interface WaitForStateTransitionResultRequest {
2716
+ /**
2717
+ * @generated from protobuf oneof: version
2718
+ */
2719
+ version: {
2720
+ oneofKind: "v0";
2721
+ /**
2722
+ * @generated from protobuf field: org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 v0 = 1
2723
+ */
2724
+ v0: WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0;
2725
+ } | {
2726
+ oneofKind: undefined;
2727
+ };
2728
+ }
2729
+ /**
2730
+ * @generated from protobuf message org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0
2731
+ */
2732
+ export interface WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0 {
2733
+ /**
2734
+ * @generated from protobuf field: bytes state_transition_hash = 1
2735
+ */
2736
+ stateTransitionHash: Uint8Array;
2737
+ /**
2738
+ * @generated from protobuf field: bool prove = 2
2739
+ */
2740
+ prove: boolean;
2741
+ }
2742
+ /**
2743
+ * @generated from protobuf message org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse
2744
+ */
2745
+ export interface WaitForStateTransitionResultResponse {
2746
+ /**
2747
+ * @generated from protobuf oneof: version
2748
+ */
2749
+ version: {
2750
+ oneofKind: "v0";
2751
+ /**
2752
+ * @generated from protobuf field: org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 v0 = 1
2753
+ */
2754
+ v0: WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0;
2755
+ } | {
2756
+ oneofKind: undefined;
2757
+ };
2758
+ }
2759
+ /**
2760
+ * @generated from protobuf message org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0
2761
+ */
2762
+ export interface WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 {
2763
+ /**
2764
+ * @generated from protobuf oneof: result
2765
+ */
2766
+ result: {
2767
+ oneofKind: "error";
2768
+ /**
2769
+ * @generated from protobuf field: org.dash.platform.dapi.v0.StateTransitionBroadcastError error = 1
2770
+ */
2771
+ error: StateTransitionBroadcastError;
2772
+ } | {
2773
+ oneofKind: "proof";
2774
+ /**
2775
+ * @generated from protobuf field: org.dash.platform.dapi.v0.Proof proof = 2
2776
+ */
2777
+ proof: Proof;
2778
+ } | {
2779
+ oneofKind: undefined;
2780
+ };
2781
+ /**
2782
+ * @generated from protobuf field: org.dash.platform.dapi.v0.ResponseMetadata metadata = 3
2783
+ */
2784
+ metadata?: ResponseMetadata;
2785
+ }
2712
2786
  /**
2713
2787
  * @generated from protobuf enum org.dash.platform.dapi.v0.KeyPurpose
2714
2788
  */
@@ -4137,6 +4211,46 @@ declare class CanonicalVote$Type extends MessageType<CanonicalVote> {
4137
4211
  * @generated MessageType for protobuf message org.dash.platform.dapi.v0.CanonicalVote
4138
4212
  */
4139
4213
  export declare const CanonicalVote: CanonicalVote$Type;
4214
+ declare class WaitForStateTransitionResultRequest$Type extends MessageType<WaitForStateTransitionResultRequest> {
4215
+ constructor();
4216
+ create(value?: PartialMessage<WaitForStateTransitionResultRequest>): WaitForStateTransitionResultRequest;
4217
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: WaitForStateTransitionResultRequest): WaitForStateTransitionResultRequest;
4218
+ internalBinaryWrite(message: WaitForStateTransitionResultRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
4219
+ }
4220
+ /**
4221
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest
4222
+ */
4223
+ export declare const WaitForStateTransitionResultRequest: WaitForStateTransitionResultRequest$Type;
4224
+ declare class WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0$Type extends MessageType<WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0> {
4225
+ constructor();
4226
+ create(value?: PartialMessage<WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0>): WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0;
4227
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0): WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0;
4228
+ internalBinaryWrite(message: WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
4229
+ }
4230
+ /**
4231
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0
4232
+ */
4233
+ export declare const WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0: WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0$Type;
4234
+ declare class WaitForStateTransitionResultResponse$Type extends MessageType<WaitForStateTransitionResultResponse> {
4235
+ constructor();
4236
+ create(value?: PartialMessage<WaitForStateTransitionResultResponse>): WaitForStateTransitionResultResponse;
4237
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: WaitForStateTransitionResultResponse): WaitForStateTransitionResultResponse;
4238
+ internalBinaryWrite(message: WaitForStateTransitionResultResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
4239
+ }
4240
+ /**
4241
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse
4242
+ */
4243
+ export declare const WaitForStateTransitionResultResponse: WaitForStateTransitionResultResponse$Type;
4244
+ declare class WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0$Type extends MessageType<WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0> {
4245
+ constructor();
4246
+ create(value?: PartialMessage<WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0>): WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0;
4247
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0): WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0;
4248
+ internalBinaryWrite(message: WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
4249
+ }
4250
+ /**
4251
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0
4252
+ */
4253
+ export declare const WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0: WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0$Type;
4140
4254
  /**
4141
4255
  * @generated ServiceType for protobuf service org.dash.platform.dapi.v0.Platform
4142
4256
  */
@@ -8247,6 +8247,228 @@ class CanonicalVote$Type extends MessageType {
8247
8247
  * @generated MessageType for protobuf message org.dash.platform.dapi.v0.CanonicalVote
8248
8248
  */
8249
8249
  export const CanonicalVote = new CanonicalVote$Type();
8250
+ // @generated message type with reflection information, may provide speed optimized methods
8251
+ class WaitForStateTransitionResultRequest$Type extends MessageType {
8252
+ constructor() {
8253
+ super("org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest", [
8254
+ { no: 1, name: "v0", kind: "message", oneof: "version", T: () => WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0 }
8255
+ ]);
8256
+ }
8257
+ create(value) {
8258
+ const message = globalThis.Object.create((this.messagePrototype));
8259
+ message.version = { oneofKind: undefined };
8260
+ if (value !== undefined)
8261
+ reflectionMergePartial(this, message, value);
8262
+ return message;
8263
+ }
8264
+ internalBinaryRead(reader, length, options, target) {
8265
+ let message = target ?? this.create(), end = reader.pos + length;
8266
+ while (reader.pos < end) {
8267
+ let [fieldNo, wireType] = reader.tag();
8268
+ switch (fieldNo) {
8269
+ case /* org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 v0 */ 1:
8270
+ message.version = {
8271
+ oneofKind: "v0",
8272
+ v0: WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0.internalBinaryRead(reader, reader.uint32(), options, message.version.v0)
8273
+ };
8274
+ break;
8275
+ default:
8276
+ let u = options.readUnknownField;
8277
+ if (u === "throw")
8278
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
8279
+ let d = reader.skip(wireType);
8280
+ if (u !== false)
8281
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
8282
+ }
8283
+ }
8284
+ return message;
8285
+ }
8286
+ internalBinaryWrite(message, writer, options) {
8287
+ /* org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0 v0 = 1; */
8288
+ if (message.version.oneofKind === "v0")
8289
+ WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0.internalBinaryWrite(message.version.v0, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
8290
+ let u = options.writeUnknownFields;
8291
+ if (u !== false)
8292
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
8293
+ return writer;
8294
+ }
8295
+ }
8296
+ /**
8297
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest
8298
+ */
8299
+ export const WaitForStateTransitionResultRequest = new WaitForStateTransitionResultRequest$Type();
8300
+ // @generated message type with reflection information, may provide speed optimized methods
8301
+ class WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0$Type extends MessageType {
8302
+ constructor() {
8303
+ super("org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0", [
8304
+ { no: 1, name: "state_transition_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
8305
+ { no: 2, name: "prove", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
8306
+ ]);
8307
+ }
8308
+ create(value) {
8309
+ const message = globalThis.Object.create((this.messagePrototype));
8310
+ message.stateTransitionHash = new Uint8Array(0);
8311
+ message.prove = false;
8312
+ if (value !== undefined)
8313
+ reflectionMergePartial(this, message, value);
8314
+ return message;
8315
+ }
8316
+ internalBinaryRead(reader, length, options, target) {
8317
+ let message = target ?? this.create(), end = reader.pos + length;
8318
+ while (reader.pos < end) {
8319
+ let [fieldNo, wireType] = reader.tag();
8320
+ switch (fieldNo) {
8321
+ case /* bytes state_transition_hash */ 1:
8322
+ message.stateTransitionHash = reader.bytes();
8323
+ break;
8324
+ case /* bool prove */ 2:
8325
+ message.prove = reader.bool();
8326
+ break;
8327
+ default:
8328
+ let u = options.readUnknownField;
8329
+ if (u === "throw")
8330
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
8331
+ let d = reader.skip(wireType);
8332
+ if (u !== false)
8333
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
8334
+ }
8335
+ }
8336
+ return message;
8337
+ }
8338
+ internalBinaryWrite(message, writer, options) {
8339
+ /* bytes state_transition_hash = 1; */
8340
+ if (message.stateTransitionHash.length)
8341
+ writer.tag(1, WireType.LengthDelimited).bytes(message.stateTransitionHash);
8342
+ /* bool prove = 2; */
8343
+ if (message.prove !== false)
8344
+ writer.tag(2, WireType.Varint).bool(message.prove);
8345
+ let u = options.writeUnknownFields;
8346
+ if (u !== false)
8347
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
8348
+ return writer;
8349
+ }
8350
+ }
8351
+ /**
8352
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest.WaitForStateTransitionResultRequestV0
8353
+ */
8354
+ export const WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0 = new WaitForStateTransitionResultRequest_WaitForStateTransitionResultRequestV0$Type();
8355
+ // @generated message type with reflection information, may provide speed optimized methods
8356
+ class WaitForStateTransitionResultResponse$Type extends MessageType {
8357
+ constructor() {
8358
+ super("org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse", [
8359
+ { no: 1, name: "v0", kind: "message", oneof: "version", T: () => WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 }
8360
+ ]);
8361
+ }
8362
+ create(value) {
8363
+ const message = globalThis.Object.create((this.messagePrototype));
8364
+ message.version = { oneofKind: undefined };
8365
+ if (value !== undefined)
8366
+ reflectionMergePartial(this, message, value);
8367
+ return message;
8368
+ }
8369
+ internalBinaryRead(reader, length, options, target) {
8370
+ let message = target ?? this.create(), end = reader.pos + length;
8371
+ while (reader.pos < end) {
8372
+ let [fieldNo, wireType] = reader.tag();
8373
+ switch (fieldNo) {
8374
+ case /* org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 v0 */ 1:
8375
+ message.version = {
8376
+ oneofKind: "v0",
8377
+ v0: WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0.internalBinaryRead(reader, reader.uint32(), options, message.version.v0)
8378
+ };
8379
+ break;
8380
+ default:
8381
+ let u = options.readUnknownField;
8382
+ if (u === "throw")
8383
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
8384
+ let d = reader.skip(wireType);
8385
+ if (u !== false)
8386
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
8387
+ }
8388
+ }
8389
+ return message;
8390
+ }
8391
+ internalBinaryWrite(message, writer, options) {
8392
+ /* org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0 v0 = 1; */
8393
+ if (message.version.oneofKind === "v0")
8394
+ WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0.internalBinaryWrite(message.version.v0, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
8395
+ let u = options.writeUnknownFields;
8396
+ if (u !== false)
8397
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
8398
+ return writer;
8399
+ }
8400
+ }
8401
+ /**
8402
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse
8403
+ */
8404
+ export const WaitForStateTransitionResultResponse = new WaitForStateTransitionResultResponse$Type();
8405
+ // @generated message type with reflection information, may provide speed optimized methods
8406
+ class WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0$Type extends MessageType {
8407
+ constructor() {
8408
+ super("org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0", [
8409
+ { no: 1, name: "error", kind: "message", oneof: "result", T: () => StateTransitionBroadcastError },
8410
+ { no: 2, name: "proof", kind: "message", oneof: "result", T: () => Proof },
8411
+ { no: 3, name: "metadata", kind: "message", T: () => ResponseMetadata }
8412
+ ]);
8413
+ }
8414
+ create(value) {
8415
+ const message = globalThis.Object.create((this.messagePrototype));
8416
+ message.result = { oneofKind: undefined };
8417
+ if (value !== undefined)
8418
+ reflectionMergePartial(this, message, value);
8419
+ return message;
8420
+ }
8421
+ internalBinaryRead(reader, length, options, target) {
8422
+ let message = target ?? this.create(), end = reader.pos + length;
8423
+ while (reader.pos < end) {
8424
+ let [fieldNo, wireType] = reader.tag();
8425
+ switch (fieldNo) {
8426
+ case /* org.dash.platform.dapi.v0.StateTransitionBroadcastError error */ 1:
8427
+ message.result = {
8428
+ oneofKind: "error",
8429
+ error: StateTransitionBroadcastError.internalBinaryRead(reader, reader.uint32(), options, message.result.error)
8430
+ };
8431
+ break;
8432
+ case /* org.dash.platform.dapi.v0.Proof proof */ 2:
8433
+ message.result = {
8434
+ oneofKind: "proof",
8435
+ proof: Proof.internalBinaryRead(reader, reader.uint32(), options, message.result.proof)
8436
+ };
8437
+ break;
8438
+ case /* org.dash.platform.dapi.v0.ResponseMetadata metadata */ 3:
8439
+ message.metadata = ResponseMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
8440
+ break;
8441
+ default:
8442
+ let u = options.readUnknownField;
8443
+ if (u === "throw")
8444
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
8445
+ let d = reader.skip(wireType);
8446
+ if (u !== false)
8447
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
8448
+ }
8449
+ }
8450
+ return message;
8451
+ }
8452
+ internalBinaryWrite(message, writer, options) {
8453
+ /* org.dash.platform.dapi.v0.StateTransitionBroadcastError error = 1; */
8454
+ if (message.result.oneofKind === "error")
8455
+ StateTransitionBroadcastError.internalBinaryWrite(message.result.error, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
8456
+ /* org.dash.platform.dapi.v0.Proof proof = 2; */
8457
+ if (message.result.oneofKind === "proof")
8458
+ Proof.internalBinaryWrite(message.result.proof, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
8459
+ /* org.dash.platform.dapi.v0.ResponseMetadata metadata = 3; */
8460
+ if (message.metadata)
8461
+ ResponseMetadata.internalBinaryWrite(message.metadata, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
8462
+ let u = options.writeUnknownFields;
8463
+ if (u !== false)
8464
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
8465
+ return writer;
8466
+ }
8467
+ }
8468
+ /**
8469
+ * @generated MessageType for protobuf message org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.WaitForStateTransitionResultResponseV0
8470
+ */
8471
+ export const WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0 = new WaitForStateTransitionResultResponse_WaitForStateTransitionResultResponseV0$Type();
8250
8472
  /**
8251
8473
  * @generated ServiceType for protobuf service org.dash.platform.dapi.v0.Platform
8252
8474
  */
@@ -8273,5 +8495,6 @@ export const Platform = new ServiceType("org.dash.platform.dapi.v0.Platform", [
8273
8495
  { name: "getIdentitiesTokenBalances", options: {}, I: GetIdentitiesTokenBalancesRequest, O: GetIdentitiesTokenBalancesResponse },
8274
8496
  { name: "getTokenContractInfo", options: {}, I: GetTokenContractInfoRequest, O: GetTokenContractInfoResponse },
8275
8497
  { name: "getTokenDirectPurchasePrices", options: {}, I: GetTokenDirectPurchasePricesRequest, O: GetTokenDirectPurchasePricesResponse },
8276
- { name: "getTokenTotalSupply", options: {}, I: GetTokenTotalSupplyRequest, O: GetTokenTotalSupplyResponse }
8498
+ { name: "getTokenTotalSupply", options: {}, I: GetTokenTotalSupplyRequest, O: GetTokenTotalSupplyResponse },
8499
+ { name: "waitForStateTransitionResult", options: {}, I: WaitForStateTransitionResultRequest, O: WaitForStateTransitionResultResponse }
8277
8500
  ]);
@@ -1,4 +1,4 @@
1
1
  import { DocumentWASM } from 'pshenmic-dpp';
2
2
  export default function createDocument(dataContractId, documentType, data, owner, revision, documentId) {
3
- return new DocumentWASM(data, documentType, revision ?? BigInt(1), dataContractId, owner, documentId);
3
+ return new DocumentWASM(data, documentType, revision ?? BigInt(1), dataContractId, owner, documentId, owner);
4
4
  }
@@ -1,4 +1,4 @@
1
1
  import { IdentityPublicKeyWASM } from 'pshenmic-dpp';
2
2
  import { IdentifierLike } from '../types.js';
3
3
  import GRPCConnectionPool from '../grpcConnectionPool.js';
4
- export default function getIdentityPublicKeys(grpcPool: GRPCConnectionPool, identifier: IdentifierLike): Promise<IdentityPublicKeyWASM[]>;
4
+ export default function getIdentityPublicKeys(grpcPool: GRPCConnectionPool, identifier: IdentifierLike, keyIds?: number[]): Promise<IdentityPublicKeyWASM[]>;
@@ -3,19 +3,28 @@ import { IdentifierWASM, PlatformVersionWASM, verifyIdentityKeysByIdentifierProo
3
3
  import { getQuorumPublicKey } from '../utils/getQuorumPublicKey.js';
4
4
  import bytesToHex from '../utils/bytesToHex.js';
5
5
  import verifyTenderdashProof from '../utils/verifyTenderdashProof.js';
6
- export default async function getIdentityPublicKeys(grpcPool, identifier) {
6
+ export default async function getIdentityPublicKeys(grpcPool, identifier, keyIds) {
7
7
  const id = new IdentifierWASM(identifier);
8
+ let requestType = {
9
+ request: {
10
+ oneofKind: 'allKeys',
11
+ allKeys: {}
12
+ }
13
+ };
14
+ if (keyIds != null) {
15
+ requestType = {
16
+ request: {
17
+ oneofKind: 'specificKeys',
18
+ specificKeys: { keyIds }
19
+ }
20
+ };
21
+ }
8
22
  const getIdentityKeysRequest = GetIdentityKeysRequest.create({
9
23
  version: {
10
24
  oneofKind: 'v0',
11
25
  v0: {
12
26
  identityId: id.bytes(),
13
- requestType: KeyRequestType.create({
14
- request: {
15
- oneofKind: 'allKeys',
16
- allKeys: {}
17
- }
18
- }),
27
+ requestType: KeyRequestType.create(requestType),
19
28
  prove: true
20
29
  }
21
30
  }
@@ -33,7 +42,7 @@ export default async function getIdentityPublicKeys(grpcPool, identifier) {
33
42
  if (metadata == null) {
34
43
  throw new Error('Metadata not found');
35
44
  }
36
- const { rootHash, identity } = verifyIdentityKeysByIdentifierProof(proof.grovedbProof, id.bytes(), null, false, false, true, null, null, PlatformVersionWASM.PLATFORM_V9);
45
+ const { rootHash, identity } = verifyIdentityKeysByIdentifierProof(proof.grovedbProof, id.bytes(), keyIds != null ? keyIds : null, false, false, true, null, null, PlatformVersionWASM.PLATFORM_V9);
37
46
  if (identity == null) {
38
47
  throw new Error(`Identity with identifier ${id.base58()} not found`);
39
48
  }
@@ -56,11 +56,12 @@ export declare class IdentitiesController {
56
56
  getIdentityContractNonce(identifier: IdentifierLike, dataContract: IdentifierLike): Promise<bigint>;
57
57
  /**
58
58
  * Retrieve given Identity's public keys
59
- * @param identifier
59
+ * @param identifier {IdentifierLike}
60
+ * @param keyIds {=number[]} optional, specific keyIds to request
60
61
  *
61
62
  * @return {Promise<IdentityPublicKeyWASM[]>}
62
63
  */
63
- getIdentityPublicKeys(identifier: IdentifierLike): Promise<IdentityPublicKeyWASM[]>;
64
+ getIdentityPublicKeys(identifier: IdentifierLike, keyIds?: number[]): Promise<IdentityPublicKeyWASM[]>;
64
65
  /**
65
66
  * Helper function for creating {StateTransitionWASM} for Identity transitions
66
67
  *
@@ -84,12 +84,13 @@ export class IdentitiesController {
84
84
  }
85
85
  /**
86
86
  * Retrieve given Identity's public keys
87
- * @param identifier
87
+ * @param identifier {IdentifierLike}
88
+ * @param keyIds {=number[]} optional, specific keyIds to request
88
89
  *
89
90
  * @return {Promise<IdentityPublicKeyWASM[]>}
90
91
  */
91
- async getIdentityPublicKeys(identifier) {
92
- return await getIdentityPublicKeys(this.grpcPool, identifier);
92
+ async getIdentityPublicKeys(identifier, keyIds) {
93
+ return await getIdentityPublicKeys(this.grpcPool, identifier, keyIds);
93
94
  }
94
95
  /**
95
96
  * Helper function for creating {StateTransitionWASM} for Identity transitions
@@ -1,8 +1,51 @@
1
+ import { BlockInfoWASM, PlatformVersionWASM, verifyStateTransitionResult } from 'pshenmic-dpp';
2
+ import hexToBytes from '../utils/hexToBytes.js';
3
+ import { WaitForStateTransitionResultRequest } from '../../proto/generated/platform.js';
4
+ import { getQuorumPublicKey } from '../utils/getQuorumPublicKey.js';
5
+ import bytesToHex from '../utils/bytesToHex.js';
6
+ import verifyTenderdashProof from '../utils/verifyTenderdashProof.js';
7
+ import { base64 } from '@scure/base';
1
8
  export default async function waitForStateTransitionResult(grpcPool, stateTransition) {
2
- const url = `https://${grpcPool.network === 'mainnet' ? '' : 'testnet.'}platform-explorer.pshenmic.dev/waitForStateTransitionResult/${stateTransition.hash(false)}`;
3
- const resp = await fetch(url);
4
- if (resp.status !== 200) {
5
- console.log(await resp.json());
6
- throw new Error('Internal server error while waiting for state transition result');
9
+ const txHash = stateTransition.hash(false);
10
+ const waitForStateTransitionResultRequest = WaitForStateTransitionResultRequest.create({
11
+ version: {
12
+ oneofKind: 'v0',
13
+ v0: {
14
+ stateTransitionHash: hexToBytes(txHash),
15
+ prove: true
16
+ }
17
+ }
18
+ });
19
+ const { response } = await grpcPool.getClient().waitForStateTransitionResult(waitForStateTransitionResultRequest);
20
+ const { version } = response;
21
+ if (version.oneofKind !== 'v0') {
22
+ throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
23
+ }
24
+ const { v0 } = version;
25
+ if (v0.result.oneofKind !== 'proof' && v0.result.oneofKind !== 'error') {
26
+ throw new Error('Unexpected oneOf type returned from DAPI (must be proof)');
27
+ }
28
+ if (v0.result.oneofKind === 'proof') {
29
+ const { result: { proof }, metadata } = v0;
30
+ if (metadata == null) {
31
+ throw new Error('Metadata not found');
32
+ }
33
+ const { timeMs, height, coreChainLockedHeight, epoch } = metadata;
34
+ const { rootHash, result } = verifyStateTransitionResult(proof.grovedbProof, stateTransition, new BlockInfoWASM(BigInt(timeMs), BigInt(height), coreChainLockedHeight, epoch), true, PlatformVersionWASM.PLATFORM_V9);
35
+ if (result == null) {
36
+ throw new Error('State transition result was null');
37
+ }
38
+ const quorumPublicKey = await getQuorumPublicKey(grpcPool.network, proof.quorumType, bytesToHex(proof.quorumHash));
39
+ const verify = await verifyTenderdashProof(proof, metadata, rootHash, quorumPublicKey);
40
+ if (!verify) {
41
+ throw new Error('Failed to verify wait for state transition result query');
42
+ }
43
+ }
44
+ else if (v0.result.oneofKind === 'error') {
45
+ const { code, message, data } = v0.result.error;
46
+ throw new Error(`State transition ${txHash} failed to execute with code ${code}, message: ${message}, data: ${base64.encode(data)}`);
47
+ }
48
+ else {
49
+ throw new Error('Unexpected oneOfKind returned for waitForStateTransitionResult');
7
50
  }
8
51
  }
@@ -2,6 +2,7 @@ import broadcast from '../../src/stateTransitions/broadcast.js';
2
2
  import { DocumentWASM, PrivateKeyWASM } from 'pshenmic-dpp';
3
3
  import { DashPlatformSDK } from '../../src/DashPlatformSDK.js';
4
4
  import sleep from '../../src/utils/sleep.js';
5
+ jest.mock('../../src/stateTransitions/waitForStateTransitionResult');
5
6
  jest.mock('../../src/stateTransitions/broadcast');
6
7
  jest.mock('../../src/utils/sleep');
7
8
  let sdk;
@@ -11,13 +12,14 @@ describe('DPNS names', () => {
11
12
  // @ts-expect-error
12
13
  sleep.mockReturnValue(Promise.resolve());
13
14
  sdk.stateTransitions.broadcast = jest.fn();
15
+ sdk.stateTransitions.waitForStateTransitionResult = jest.fn();
14
16
  });
15
- test('should be able to search names by DPNS name', async () => {
17
+ xtest('should be able to search names by DPNS name', async () => {
16
18
  const documents = await sdk.names.searchByName('xyz.dash');
17
19
  expect(documents?.length).toEqual(1);
18
20
  expect(documents[0]).toEqual(expect.any(DocumentWASM));
19
21
  });
20
- test('should be able to search names by identity', async () => {
22
+ xtest('should be able to search names by identity', async () => {
21
23
  const documents = await sdk.names.searchByIdentity('36LGwPSXef8q8wpdnx4EdDeVNuqCYNAE9boDu5bxytsm');
22
24
  expect(documents?.length).toEqual(3);
23
25
  const [xyzDocument] = documents;