dash-platform-sdk 1.5.0 → 1.5.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/README.md +15 -15
- package/bundle.min.js +1 -1
- package/index.d.ts +4 -1
- package/index.js +3 -1
- package/package.json +1 -1
- package/proto/generated/platform.client.d.ts +10 -0
- package/proto/generated/platform.client.js +25 -18
- package/proto/generated/platform.d.ts +162 -0
- package/proto/generated/platform.js +351 -0
- package/src/DashPlatformSDK.d.ts +19 -7
- package/src/DashPlatformSDK.js +33 -3
- package/src/contestedResources/getContestedResourceVoteState.d.ts +2 -2
- package/src/contestedResources/index.d.ts +3 -3
- package/src/dataContracts/getDataContractByIdentifier.d.ts +2 -2
- package/src/dataContracts/index.d.ts +3 -3
- package/src/documents/index.d.ts +3 -3
- package/src/documents/query.d.ts +2 -2
- package/src/grpcConnectionPool.d.ts +19 -2
- package/src/grpcConnectionPool.js +44 -16
- package/src/identities/getIdentityBalance.d.ts +2 -2
- package/src/identities/getIdentityByIdentifier.d.ts +2 -2
- package/src/identities/getIdentityByNonUniquePublicKeyHash.d.ts +2 -2
- package/src/identities/getIdentityByPublicKeyHash.d.ts +2 -2
- package/src/identities/getIdentityContractNonce.d.ts +2 -2
- package/src/identities/getIdentityNonce.d.ts +2 -2
- package/src/identities/getIdentityPublicKeys.d.ts +2 -2
- package/src/identities/index.d.ts +3 -3
- package/src/names/index.d.ts +3 -3
- package/src/names/registerName.d.ts +2 -2
- package/src/names/searchByIdentity.d.ts +2 -2
- package/src/names/searchByName.d.ts +2 -2
- package/src/node/epochInfos.d.ts +2 -2
- package/src/node/finalizedEpochInfos.d.ts +2 -2
- package/src/node/getCurrentQuorumsInfo.d.ts +19 -0
- package/src/node/getCurrentQuorumsInfo.js +31 -0
- package/src/node/index.d.ts +11 -3
- package/src/node/index.js +10 -0
- package/src/node/status.d.ts +2 -2
- package/src/node/totalCredits.d.ts +2 -2
- package/src/platformAddresses/getAddressInfo.d.ts +2 -2
- package/src/platformAddresses/getAddressesBranchState.d.ts +2 -2
- package/src/platformAddresses/getAddressesInfos.d.ts +2 -2
- package/src/platformAddresses/getAddressesTrunkState.d.ts +2 -2
- package/src/platformAddresses/getRecentAddressBalanceChanges.d.ts +2 -2
- package/src/platformAddresses/getRecentCompactedAddressBalanceChanges.d.ts +2 -2
- package/src/platformAddresses/index.d.ts +3 -3
- package/src/shielded/getMostRecentShieldedAnchor.d.ts +2 -2
- package/src/shielded/getShieldedAnchors.d.ts +2 -2
- package/src/shielded/getShieldedEncryptedNotes.d.ts +2 -2
- package/src/shielded/getShieldedNotesCount.d.ts +2 -2
- package/src/shielded/getShieldedNullifiers.d.ts +2 -2
- package/src/shielded/getShieldedPoolState.d.ts +2 -2
- package/src/shielded/index.d.ts +3 -3
- package/src/stateTransitions/broadcast.d.ts +2 -2
- package/src/stateTransitions/index.d.ts +3 -3
- package/src/stateTransitions/waitForStateTransitionResult.d.ts +2 -2
- package/src/tokens/getIdentitiesTokenBalances.d.ts +2 -2
- package/src/tokens/getIdentityTokensBalances.d.ts +2 -2
- package/src/tokens/getTokenContractInfo.d.ts +2 -2
- package/src/tokens/getTokenDirectPurchasePrices.d.ts +2 -2
- package/src/tokens/getTokenTotalSupply.d.ts +2 -2
- package/src/tokens/index.d.ts +3 -3
- package/src/utils/fetchWithDetails.d.ts +24 -0
- package/src/utils/fetchWithDetails.js +71 -0
- package/src/utils/getQuorumPublicKey.js +2 -1
- package/test/unit/ContestedResources.spec.js +2 -1
- package/test/unit/DataContract.spec.js +2 -1
- package/test/unit/Document.spec.js +2 -1
- package/test/unit/Identity.spec.js +2 -1
- package/test/unit/Names.spec.js +2 -1
- package/test/unit/Node.spec.js +20 -1
- package/test/unit/PlatformAddress.spec.js +2 -1
- package/test/unit/Shielded.spec.js +1 -0
- package/test/unit/Tokens.spec.js +2 -1
- package/src/utils/getEvonodeList.d.ts +0 -2
- package/src/utils/getEvonodeList.js +0 -12
|
@@ -5525,6 +5525,356 @@ class GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0$Type
|
|
|
5525
5525
|
*/
|
|
5526
5526
|
export const GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0 = new GetTotalCreditsInPlatformResponse_GetTotalCreditsInPlatformResponseV0$Type();
|
|
5527
5527
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
5528
|
+
class GetCurrentQuorumsInfoRequest$Type extends MessageType {
|
|
5529
|
+
constructor() {
|
|
5530
|
+
super("org.dash.platform.dapi.v0.GetCurrentQuorumsInfoRequest", [
|
|
5531
|
+
{ no: 1, name: "v0", kind: "message", oneof: "version", T: () => GetCurrentQuorumsInfoRequest_GetCurrentQuorumsInfoRequestV0 }
|
|
5532
|
+
]);
|
|
5533
|
+
}
|
|
5534
|
+
create(value) {
|
|
5535
|
+
const message = globalThis.Object.create((this.messagePrototype));
|
|
5536
|
+
message.version = { oneofKind: undefined };
|
|
5537
|
+
if (value !== undefined)
|
|
5538
|
+
reflectionMergePartial(this, message, value);
|
|
5539
|
+
return message;
|
|
5540
|
+
}
|
|
5541
|
+
internalBinaryRead(reader, length, options, target) {
|
|
5542
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
5543
|
+
while (reader.pos < end) {
|
|
5544
|
+
let [fieldNo, wireType] = reader.tag();
|
|
5545
|
+
switch (fieldNo) {
|
|
5546
|
+
case /* org.dash.platform.dapi.v0.GetCurrentQuorumsInfoRequest.GetCurrentQuorumsInfoRequestV0 v0 */ 1:
|
|
5547
|
+
message.version = {
|
|
5548
|
+
oneofKind: "v0",
|
|
5549
|
+
v0: GetCurrentQuorumsInfoRequest_GetCurrentQuorumsInfoRequestV0.internalBinaryRead(reader, reader.uint32(), options, message.version.v0)
|
|
5550
|
+
};
|
|
5551
|
+
break;
|
|
5552
|
+
default:
|
|
5553
|
+
let u = options.readUnknownField;
|
|
5554
|
+
if (u === "throw")
|
|
5555
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
5556
|
+
let d = reader.skip(wireType);
|
|
5557
|
+
if (u !== false)
|
|
5558
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
5559
|
+
}
|
|
5560
|
+
}
|
|
5561
|
+
return message;
|
|
5562
|
+
}
|
|
5563
|
+
internalBinaryWrite(message, writer, options) {
|
|
5564
|
+
/* org.dash.platform.dapi.v0.GetCurrentQuorumsInfoRequest.GetCurrentQuorumsInfoRequestV0 v0 = 1; */
|
|
5565
|
+
if (message.version.oneofKind === "v0")
|
|
5566
|
+
GetCurrentQuorumsInfoRequest_GetCurrentQuorumsInfoRequestV0.internalBinaryWrite(message.version.v0, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
5567
|
+
let u = options.writeUnknownFields;
|
|
5568
|
+
if (u !== false)
|
|
5569
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
5570
|
+
return writer;
|
|
5571
|
+
}
|
|
5572
|
+
}
|
|
5573
|
+
/**
|
|
5574
|
+
* @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetCurrentQuorumsInfoRequest
|
|
5575
|
+
*/
|
|
5576
|
+
export const GetCurrentQuorumsInfoRequest = new GetCurrentQuorumsInfoRequest$Type();
|
|
5577
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
5578
|
+
class GetCurrentQuorumsInfoRequest_GetCurrentQuorumsInfoRequestV0$Type extends MessageType {
|
|
5579
|
+
constructor() {
|
|
5580
|
+
super("org.dash.platform.dapi.v0.GetCurrentQuorumsInfoRequest.GetCurrentQuorumsInfoRequestV0", []);
|
|
5581
|
+
}
|
|
5582
|
+
create(value) {
|
|
5583
|
+
const message = globalThis.Object.create((this.messagePrototype));
|
|
5584
|
+
if (value !== undefined)
|
|
5585
|
+
reflectionMergePartial(this, message, value);
|
|
5586
|
+
return message;
|
|
5587
|
+
}
|
|
5588
|
+
internalBinaryRead(reader, length, options, target) {
|
|
5589
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
5590
|
+
while (reader.pos < end) {
|
|
5591
|
+
let [fieldNo, wireType] = reader.tag();
|
|
5592
|
+
switch (fieldNo) {
|
|
5593
|
+
default:
|
|
5594
|
+
let u = options.readUnknownField;
|
|
5595
|
+
if (u === "throw")
|
|
5596
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
5597
|
+
let d = reader.skip(wireType);
|
|
5598
|
+
if (u !== false)
|
|
5599
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
5600
|
+
}
|
|
5601
|
+
}
|
|
5602
|
+
return message;
|
|
5603
|
+
}
|
|
5604
|
+
internalBinaryWrite(message, writer, options) {
|
|
5605
|
+
let u = options.writeUnknownFields;
|
|
5606
|
+
if (u !== false)
|
|
5607
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
5608
|
+
return writer;
|
|
5609
|
+
}
|
|
5610
|
+
}
|
|
5611
|
+
/**
|
|
5612
|
+
* @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetCurrentQuorumsInfoRequest.GetCurrentQuorumsInfoRequestV0
|
|
5613
|
+
*/
|
|
5614
|
+
export const GetCurrentQuorumsInfoRequest_GetCurrentQuorumsInfoRequestV0 = new GetCurrentQuorumsInfoRequest_GetCurrentQuorumsInfoRequestV0$Type();
|
|
5615
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
5616
|
+
class GetCurrentQuorumsInfoResponse$Type extends MessageType {
|
|
5617
|
+
constructor() {
|
|
5618
|
+
super("org.dash.platform.dapi.v0.GetCurrentQuorumsInfoResponse", [
|
|
5619
|
+
{ no: 1, name: "v0", kind: "message", oneof: "version", T: () => GetCurrentQuorumsInfoResponse_GetCurrentQuorumsInfoResponseV0 }
|
|
5620
|
+
]);
|
|
5621
|
+
}
|
|
5622
|
+
create(value) {
|
|
5623
|
+
const message = globalThis.Object.create((this.messagePrototype));
|
|
5624
|
+
message.version = { oneofKind: undefined };
|
|
5625
|
+
if (value !== undefined)
|
|
5626
|
+
reflectionMergePartial(this, message, value);
|
|
5627
|
+
return message;
|
|
5628
|
+
}
|
|
5629
|
+
internalBinaryRead(reader, length, options, target) {
|
|
5630
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
5631
|
+
while (reader.pos < end) {
|
|
5632
|
+
let [fieldNo, wireType] = reader.tag();
|
|
5633
|
+
switch (fieldNo) {
|
|
5634
|
+
case /* org.dash.platform.dapi.v0.GetCurrentQuorumsInfoResponse.GetCurrentQuorumsInfoResponseV0 v0 */ 1:
|
|
5635
|
+
message.version = {
|
|
5636
|
+
oneofKind: "v0",
|
|
5637
|
+
v0: GetCurrentQuorumsInfoResponse_GetCurrentQuorumsInfoResponseV0.internalBinaryRead(reader, reader.uint32(), options, message.version.v0)
|
|
5638
|
+
};
|
|
5639
|
+
break;
|
|
5640
|
+
default:
|
|
5641
|
+
let u = options.readUnknownField;
|
|
5642
|
+
if (u === "throw")
|
|
5643
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
5644
|
+
let d = reader.skip(wireType);
|
|
5645
|
+
if (u !== false)
|
|
5646
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
5647
|
+
}
|
|
5648
|
+
}
|
|
5649
|
+
return message;
|
|
5650
|
+
}
|
|
5651
|
+
internalBinaryWrite(message, writer, options) {
|
|
5652
|
+
/* org.dash.platform.dapi.v0.GetCurrentQuorumsInfoResponse.GetCurrentQuorumsInfoResponseV0 v0 = 1; */
|
|
5653
|
+
if (message.version.oneofKind === "v0")
|
|
5654
|
+
GetCurrentQuorumsInfoResponse_GetCurrentQuorumsInfoResponseV0.internalBinaryWrite(message.version.v0, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
5655
|
+
let u = options.writeUnknownFields;
|
|
5656
|
+
if (u !== false)
|
|
5657
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
5658
|
+
return writer;
|
|
5659
|
+
}
|
|
5660
|
+
}
|
|
5661
|
+
/**
|
|
5662
|
+
* @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetCurrentQuorumsInfoResponse
|
|
5663
|
+
*/
|
|
5664
|
+
export const GetCurrentQuorumsInfoResponse = new GetCurrentQuorumsInfoResponse$Type();
|
|
5665
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
5666
|
+
class GetCurrentQuorumsInfoResponse_ValidatorV0$Type extends MessageType {
|
|
5667
|
+
constructor() {
|
|
5668
|
+
super("org.dash.platform.dapi.v0.GetCurrentQuorumsInfoResponse.ValidatorV0", [
|
|
5669
|
+
{ no: 1, name: "pro_tx_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
|
5670
|
+
{ no: 2, name: "node_ip", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
5671
|
+
{ no: 3, name: "is_banned", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
|
|
5672
|
+
]);
|
|
5673
|
+
}
|
|
5674
|
+
create(value) {
|
|
5675
|
+
const message = globalThis.Object.create((this.messagePrototype));
|
|
5676
|
+
message.proTxHash = new Uint8Array(0);
|
|
5677
|
+
message.nodeIp = "";
|
|
5678
|
+
message.isBanned = false;
|
|
5679
|
+
if (value !== undefined)
|
|
5680
|
+
reflectionMergePartial(this, message, value);
|
|
5681
|
+
return message;
|
|
5682
|
+
}
|
|
5683
|
+
internalBinaryRead(reader, length, options, target) {
|
|
5684
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
5685
|
+
while (reader.pos < end) {
|
|
5686
|
+
let [fieldNo, wireType] = reader.tag();
|
|
5687
|
+
switch (fieldNo) {
|
|
5688
|
+
case /* bytes pro_tx_hash */ 1:
|
|
5689
|
+
message.proTxHash = reader.bytes();
|
|
5690
|
+
break;
|
|
5691
|
+
case /* string node_ip */ 2:
|
|
5692
|
+
message.nodeIp = reader.string();
|
|
5693
|
+
break;
|
|
5694
|
+
case /* bool is_banned */ 3:
|
|
5695
|
+
message.isBanned = reader.bool();
|
|
5696
|
+
break;
|
|
5697
|
+
default:
|
|
5698
|
+
let u = options.readUnknownField;
|
|
5699
|
+
if (u === "throw")
|
|
5700
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
5701
|
+
let d = reader.skip(wireType);
|
|
5702
|
+
if (u !== false)
|
|
5703
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
5704
|
+
}
|
|
5705
|
+
}
|
|
5706
|
+
return message;
|
|
5707
|
+
}
|
|
5708
|
+
internalBinaryWrite(message, writer, options) {
|
|
5709
|
+
/* bytes pro_tx_hash = 1; */
|
|
5710
|
+
if (message.proTxHash.length)
|
|
5711
|
+
writer.tag(1, WireType.LengthDelimited).bytes(message.proTxHash);
|
|
5712
|
+
/* string node_ip = 2; */
|
|
5713
|
+
if (message.nodeIp !== "")
|
|
5714
|
+
writer.tag(2, WireType.LengthDelimited).string(message.nodeIp);
|
|
5715
|
+
/* bool is_banned = 3; */
|
|
5716
|
+
if (message.isBanned !== false)
|
|
5717
|
+
writer.tag(3, WireType.Varint).bool(message.isBanned);
|
|
5718
|
+
let u = options.writeUnknownFields;
|
|
5719
|
+
if (u !== false)
|
|
5720
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
5721
|
+
return writer;
|
|
5722
|
+
}
|
|
5723
|
+
}
|
|
5724
|
+
/**
|
|
5725
|
+
* @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetCurrentQuorumsInfoResponse.ValidatorV0
|
|
5726
|
+
*/
|
|
5727
|
+
export const GetCurrentQuorumsInfoResponse_ValidatorV0 = new GetCurrentQuorumsInfoResponse_ValidatorV0$Type();
|
|
5728
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
5729
|
+
class GetCurrentQuorumsInfoResponse_ValidatorSetV0$Type extends MessageType {
|
|
5730
|
+
constructor() {
|
|
5731
|
+
super("org.dash.platform.dapi.v0.GetCurrentQuorumsInfoResponse.ValidatorSetV0", [
|
|
5732
|
+
{ no: 1, name: "quorum_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
|
5733
|
+
{ no: 2, name: "core_height", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
|
5734
|
+
{ no: 3, name: "members", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => GetCurrentQuorumsInfoResponse_ValidatorV0 },
|
|
5735
|
+
{ no: 4, name: "threshold_public_key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
|
5736
|
+
]);
|
|
5737
|
+
}
|
|
5738
|
+
create(value) {
|
|
5739
|
+
const message = globalThis.Object.create((this.messagePrototype));
|
|
5740
|
+
message.quorumHash = new Uint8Array(0);
|
|
5741
|
+
message.coreHeight = 0;
|
|
5742
|
+
message.members = [];
|
|
5743
|
+
message.thresholdPublicKey = new Uint8Array(0);
|
|
5744
|
+
if (value !== undefined)
|
|
5745
|
+
reflectionMergePartial(this, message, value);
|
|
5746
|
+
return message;
|
|
5747
|
+
}
|
|
5748
|
+
internalBinaryRead(reader, length, options, target) {
|
|
5749
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
5750
|
+
while (reader.pos < end) {
|
|
5751
|
+
let [fieldNo, wireType] = reader.tag();
|
|
5752
|
+
switch (fieldNo) {
|
|
5753
|
+
case /* bytes quorum_hash */ 1:
|
|
5754
|
+
message.quorumHash = reader.bytes();
|
|
5755
|
+
break;
|
|
5756
|
+
case /* uint32 core_height */ 2:
|
|
5757
|
+
message.coreHeight = reader.uint32();
|
|
5758
|
+
break;
|
|
5759
|
+
case /* repeated org.dash.platform.dapi.v0.GetCurrentQuorumsInfoResponse.ValidatorV0 members */ 3:
|
|
5760
|
+
message.members.push(GetCurrentQuorumsInfoResponse_ValidatorV0.internalBinaryRead(reader, reader.uint32(), options));
|
|
5761
|
+
break;
|
|
5762
|
+
case /* bytes threshold_public_key */ 4:
|
|
5763
|
+
message.thresholdPublicKey = reader.bytes();
|
|
5764
|
+
break;
|
|
5765
|
+
default:
|
|
5766
|
+
let u = options.readUnknownField;
|
|
5767
|
+
if (u === "throw")
|
|
5768
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
5769
|
+
let d = reader.skip(wireType);
|
|
5770
|
+
if (u !== false)
|
|
5771
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
5772
|
+
}
|
|
5773
|
+
}
|
|
5774
|
+
return message;
|
|
5775
|
+
}
|
|
5776
|
+
internalBinaryWrite(message, writer, options) {
|
|
5777
|
+
/* bytes quorum_hash = 1; */
|
|
5778
|
+
if (message.quorumHash.length)
|
|
5779
|
+
writer.tag(1, WireType.LengthDelimited).bytes(message.quorumHash);
|
|
5780
|
+
/* uint32 core_height = 2; */
|
|
5781
|
+
if (message.coreHeight !== 0)
|
|
5782
|
+
writer.tag(2, WireType.Varint).uint32(message.coreHeight);
|
|
5783
|
+
/* repeated org.dash.platform.dapi.v0.GetCurrentQuorumsInfoResponse.ValidatorV0 members = 3; */
|
|
5784
|
+
for (let i = 0; i < message.members.length; i++)
|
|
5785
|
+
GetCurrentQuorumsInfoResponse_ValidatorV0.internalBinaryWrite(message.members[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
|
|
5786
|
+
/* bytes threshold_public_key = 4; */
|
|
5787
|
+
if (message.thresholdPublicKey.length)
|
|
5788
|
+
writer.tag(4, WireType.LengthDelimited).bytes(message.thresholdPublicKey);
|
|
5789
|
+
let u = options.writeUnknownFields;
|
|
5790
|
+
if (u !== false)
|
|
5791
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
5792
|
+
return writer;
|
|
5793
|
+
}
|
|
5794
|
+
}
|
|
5795
|
+
/**
|
|
5796
|
+
* @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetCurrentQuorumsInfoResponse.ValidatorSetV0
|
|
5797
|
+
*/
|
|
5798
|
+
export const GetCurrentQuorumsInfoResponse_ValidatorSetV0 = new GetCurrentQuorumsInfoResponse_ValidatorSetV0$Type();
|
|
5799
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
5800
|
+
class GetCurrentQuorumsInfoResponse_GetCurrentQuorumsInfoResponseV0$Type extends MessageType {
|
|
5801
|
+
constructor() {
|
|
5802
|
+
super("org.dash.platform.dapi.v0.GetCurrentQuorumsInfoResponse.GetCurrentQuorumsInfoResponseV0", [
|
|
5803
|
+
{ no: 1, name: "quorum_hashes", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 12 /*ScalarType.BYTES*/ },
|
|
5804
|
+
{ no: 2, name: "current_quorum_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
|
5805
|
+
{ no: 3, name: "validator_sets", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => GetCurrentQuorumsInfoResponse_ValidatorSetV0 },
|
|
5806
|
+
{ no: 4, name: "last_block_proposer", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
|
5807
|
+
{ no: 5, name: "metadata", kind: "message", T: () => ResponseMetadata }
|
|
5808
|
+
]);
|
|
5809
|
+
}
|
|
5810
|
+
create(value) {
|
|
5811
|
+
const message = globalThis.Object.create((this.messagePrototype));
|
|
5812
|
+
message.quorumHashes = [];
|
|
5813
|
+
message.currentQuorumHash = new Uint8Array(0);
|
|
5814
|
+
message.validatorSets = [];
|
|
5815
|
+
message.lastBlockProposer = new Uint8Array(0);
|
|
5816
|
+
if (value !== undefined)
|
|
5817
|
+
reflectionMergePartial(this, message, value);
|
|
5818
|
+
return message;
|
|
5819
|
+
}
|
|
5820
|
+
internalBinaryRead(reader, length, options, target) {
|
|
5821
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
5822
|
+
while (reader.pos < end) {
|
|
5823
|
+
let [fieldNo, wireType] = reader.tag();
|
|
5824
|
+
switch (fieldNo) {
|
|
5825
|
+
case /* repeated bytes quorum_hashes */ 1:
|
|
5826
|
+
message.quorumHashes.push(reader.bytes());
|
|
5827
|
+
break;
|
|
5828
|
+
case /* bytes current_quorum_hash */ 2:
|
|
5829
|
+
message.currentQuorumHash = reader.bytes();
|
|
5830
|
+
break;
|
|
5831
|
+
case /* repeated org.dash.platform.dapi.v0.GetCurrentQuorumsInfoResponse.ValidatorSetV0 validator_sets */ 3:
|
|
5832
|
+
message.validatorSets.push(GetCurrentQuorumsInfoResponse_ValidatorSetV0.internalBinaryRead(reader, reader.uint32(), options));
|
|
5833
|
+
break;
|
|
5834
|
+
case /* bytes last_block_proposer */ 4:
|
|
5835
|
+
message.lastBlockProposer = reader.bytes();
|
|
5836
|
+
break;
|
|
5837
|
+
case /* org.dash.platform.dapi.v0.ResponseMetadata metadata */ 5:
|
|
5838
|
+
message.metadata = ResponseMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
|
|
5839
|
+
break;
|
|
5840
|
+
default:
|
|
5841
|
+
let u = options.readUnknownField;
|
|
5842
|
+
if (u === "throw")
|
|
5843
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
5844
|
+
let d = reader.skip(wireType);
|
|
5845
|
+
if (u !== false)
|
|
5846
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
5847
|
+
}
|
|
5848
|
+
}
|
|
5849
|
+
return message;
|
|
5850
|
+
}
|
|
5851
|
+
internalBinaryWrite(message, writer, options) {
|
|
5852
|
+
/* repeated bytes quorum_hashes = 1; */
|
|
5853
|
+
for (let i = 0; i < message.quorumHashes.length; i++)
|
|
5854
|
+
writer.tag(1, WireType.LengthDelimited).bytes(message.quorumHashes[i]);
|
|
5855
|
+
/* bytes current_quorum_hash = 2; */
|
|
5856
|
+
if (message.currentQuorumHash.length)
|
|
5857
|
+
writer.tag(2, WireType.LengthDelimited).bytes(message.currentQuorumHash);
|
|
5858
|
+
/* repeated org.dash.platform.dapi.v0.GetCurrentQuorumsInfoResponse.ValidatorSetV0 validator_sets = 3; */
|
|
5859
|
+
for (let i = 0; i < message.validatorSets.length; i++)
|
|
5860
|
+
GetCurrentQuorumsInfoResponse_ValidatorSetV0.internalBinaryWrite(message.validatorSets[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
|
|
5861
|
+
/* bytes last_block_proposer = 4; */
|
|
5862
|
+
if (message.lastBlockProposer.length)
|
|
5863
|
+
writer.tag(4, WireType.LengthDelimited).bytes(message.lastBlockProposer);
|
|
5864
|
+
/* org.dash.platform.dapi.v0.ResponseMetadata metadata = 5; */
|
|
5865
|
+
if (message.metadata)
|
|
5866
|
+
ResponseMetadata.internalBinaryWrite(message.metadata, writer.tag(5, WireType.LengthDelimited).fork(), options).join();
|
|
5867
|
+
let u = options.writeUnknownFields;
|
|
5868
|
+
if (u !== false)
|
|
5869
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
5870
|
+
return writer;
|
|
5871
|
+
}
|
|
5872
|
+
}
|
|
5873
|
+
/**
|
|
5874
|
+
* @generated MessageType for protobuf message org.dash.platform.dapi.v0.GetCurrentQuorumsInfoResponse.GetCurrentQuorumsInfoResponseV0
|
|
5875
|
+
*/
|
|
5876
|
+
export const GetCurrentQuorumsInfoResponse_GetCurrentQuorumsInfoResponseV0 = new GetCurrentQuorumsInfoResponse_GetCurrentQuorumsInfoResponseV0$Type();
|
|
5877
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
5528
5878
|
class GetStatusRequest$Type extends MessageType {
|
|
5529
5879
|
constructor() {
|
|
5530
5880
|
super("org.dash.platform.dapi.v0.GetStatusRequest", [
|
|
@@ -12461,6 +12811,7 @@ export const Platform = new ServiceType("org.dash.platform.dapi.v0.Platform", [
|
|
|
12461
12811
|
{ name: "getContestedResourceVoteState", options: {}, I: GetContestedResourceVoteStateRequest, O: GetContestedResourceVoteStateResponse },
|
|
12462
12812
|
{ name: "getTotalCreditsInPlatform", options: {}, I: GetTotalCreditsInPlatformRequest, O: GetTotalCreditsInPlatformResponse },
|
|
12463
12813
|
{ name: "getStatus", options: {}, I: GetStatusRequest, O: GetStatusResponse },
|
|
12814
|
+
{ name: "getCurrentQuorumsInfo", options: {}, I: GetCurrentQuorumsInfoRequest, O: GetCurrentQuorumsInfoResponse },
|
|
12464
12815
|
{ name: "getIdentityTokenBalances", options: {}, I: GetIdentityTokenBalancesRequest, O: GetIdentityTokenBalancesResponse },
|
|
12465
12816
|
{ name: "getIdentitiesTokenBalances", options: {}, I: GetIdentitiesTokenBalancesRequest, O: GetIdentitiesTokenBalancesResponse },
|
|
12466
12817
|
{ name: "getTokenContractInfo", options: {}, I: GetTokenContractInfoRequest, O: GetTokenContractInfoResponse },
|
package/src/DashPlatformSDK.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { GRPCOptions, GRPCPool } from './grpcConnectionPool.js';
|
|
2
2
|
import { IdentitiesController } from './identities/index.js';
|
|
3
3
|
import { StateTransitionsController } from './stateTransitions/index.js';
|
|
4
4
|
import { DocumentsController } from './documents/index.js';
|
|
@@ -13,10 +13,7 @@ import { VotingController } from './voting/index.js';
|
|
|
13
13
|
import { Network } from '../types.js';
|
|
14
14
|
import { PlatformAddressesController } from './platformAddresses/index.js';
|
|
15
15
|
import { ShieldedController } from './shielded/index.js';
|
|
16
|
-
export
|
|
17
|
-
poolLimit: 5;
|
|
18
|
-
dapiUrl?: string | string[];
|
|
19
|
-
}
|
|
16
|
+
export type { GRPCOptions, GRPCPool };
|
|
20
17
|
export interface SDKOptions {
|
|
21
18
|
network: Network;
|
|
22
19
|
grpc?: GRPCOptions;
|
|
@@ -29,7 +26,7 @@ export interface SDKOptions {
|
|
|
29
26
|
export declare class DashPlatformSDK {
|
|
30
27
|
network: Network;
|
|
31
28
|
/** @ignore **/
|
|
32
|
-
grpcPool:
|
|
29
|
+
grpcPool: GRPCPool;
|
|
33
30
|
/** @ignore **/
|
|
34
31
|
options?: SDKOptions;
|
|
35
32
|
contestedResources: ContestedResourcesController;
|
|
@@ -60,7 +57,15 @@ export declare class DashPlatformSDK {
|
|
|
60
57
|
* @param grpcPool
|
|
61
58
|
* @param network
|
|
62
59
|
*/
|
|
63
|
-
_initialize(grpcPool:
|
|
60
|
+
_initialize(grpcPool: GRPCPool): void;
|
|
61
|
+
/**
|
|
62
|
+
* Waits until GRPC connection pool is initialized
|
|
63
|
+
* (seed nodes are checked and evonodes are discovered)
|
|
64
|
+
* SDK can be used without waiting, but requests may be sent to unavailable seed nodes until then
|
|
65
|
+
*
|
|
66
|
+
* @return {Promise<void>}
|
|
67
|
+
*/
|
|
68
|
+
waitForInit(): Promise<void>;
|
|
64
69
|
/**
|
|
65
70
|
* Get currently used network
|
|
66
71
|
*
|
|
@@ -73,4 +78,11 @@ export declare class DashPlatformSDK {
|
|
|
73
78
|
* @param network {string}
|
|
74
79
|
*/
|
|
75
80
|
setNetwork(network: Network): void;
|
|
81
|
+
/**
|
|
82
|
+
* Replaces GRPC connection pool used by the SDK with a custom one.
|
|
83
|
+
* SDK network is switched to the pool's network
|
|
84
|
+
*
|
|
85
|
+
* @param grpcPool {GRPCPool}
|
|
86
|
+
*/
|
|
87
|
+
setGRPCPool(grpcPool: GRPCPool): void;
|
|
76
88
|
}
|
package/src/DashPlatformSDK.js
CHANGED
|
@@ -52,8 +52,11 @@ export class DashPlatformSDK {
|
|
|
52
52
|
// @ts-expect-error
|
|
53
53
|
this.options.grpc = { dapiUrl: options.dapiUrl };
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const customPool = this.options?.grpc?.pool;
|
|
56
|
+
if (customPool != null && customPool.network !== this.network) {
|
|
57
|
+
throw new Error(`Custom GRPC pool network (${customPool.network}) does not match SDK network (${this.network})`);
|
|
58
|
+
}
|
|
59
|
+
this._initialize(customPool ?? new GRPCConnectionPool(this.network, this.options?.grpc));
|
|
57
60
|
}
|
|
58
61
|
/**
|
|
59
62
|
* @private
|
|
@@ -78,6 +81,16 @@ export class DashPlatformSDK {
|
|
|
78
81
|
this.names = new NamesController(grpcPool);
|
|
79
82
|
this.keyPair = new KeyPairController();
|
|
80
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Waits until GRPC connection pool is initialized
|
|
86
|
+
* (seed nodes are checked and evonodes are discovered)
|
|
87
|
+
* SDK can be used without waiting, but requests may be sent to unavailable seed nodes until then
|
|
88
|
+
*
|
|
89
|
+
* @return {Promise<void>}
|
|
90
|
+
*/
|
|
91
|
+
async waitForInit() {
|
|
92
|
+
await this.grpcPool.waitForInit?.();
|
|
93
|
+
}
|
|
81
94
|
/**
|
|
82
95
|
* Get currently used network
|
|
83
96
|
*
|
|
@@ -95,8 +108,25 @@ export class DashPlatformSDK {
|
|
|
95
108
|
if (network !== 'testnet' && network !== 'mainnet') {
|
|
96
109
|
throw new Error('Unknown network, should be mainnet or testnet');
|
|
97
110
|
}
|
|
111
|
+
const customPool = this.options?.grpc?.pool;
|
|
112
|
+
if (customPool != null && customPool.network !== network) {
|
|
113
|
+
throw new Error(`Custom GRPC pool is bound to ${customPool.network}, pass a pool for ${network} with setGRPCPool() instead`);
|
|
114
|
+
}
|
|
98
115
|
this.network = network;
|
|
99
|
-
|
|
116
|
+
this._initialize(customPool ?? new GRPCConnectionPool(this.network, this.options?.grpc));
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Replaces GRPC connection pool used by the SDK with a custom one.
|
|
120
|
+
* SDK network is switched to the pool's network
|
|
121
|
+
*
|
|
122
|
+
* @param grpcPool {GRPCPool}
|
|
123
|
+
*/
|
|
124
|
+
setGRPCPool(grpcPool) {
|
|
125
|
+
if (grpcPool.network !== 'testnet' && grpcPool.network !== 'mainnet') {
|
|
126
|
+
throw new Error('Unknown GRPC pool network, should be mainnet or testnet');
|
|
127
|
+
}
|
|
128
|
+
this.network = grpcPool.network;
|
|
129
|
+
this.options = { ...(this.options ?? { network: grpcPool.network }), network: grpcPool.network, grpc: { ...this.options?.grpc, pool: grpcPool } };
|
|
100
130
|
this._initialize(grpcPool);
|
|
101
131
|
}
|
|
102
132
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ContestedResourceVoteState, ContestedStateResultType } from '../../types.js';
|
|
2
|
-
import
|
|
2
|
+
import { GRPCPool } from '../grpcConnectionPool.js';
|
|
3
3
|
import { GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo } from '../../proto/generated/platform.js';
|
|
4
4
|
import { DataContractWASM } from 'pshenmic-dpp';
|
|
5
5
|
export type StartAtIdentifierInfo = GetContestedResourceVoteStateRequest_GetContestedResourceVoteStateRequestV0_StartAtIdentifierInfo;
|
|
6
|
-
export default function getContestedResourceVoteState(grpcPool:
|
|
6
|
+
export default function getContestedResourceVoteState(grpcPool: GRPCPool, contract: DataContractWASM, documentTypeName: string, indexName: string, indexValues: Array<Uint8Array<ArrayBufferLike>>, resultType: ContestedStateResultType, allowIncludeLockedAndAbstainingVoteTally: boolean, startAtIdentifierInfo?: StartAtIdentifierInfo, count?: number): Promise<ContestedResourceVoteState>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { GRPCPool } from '../grpcConnectionPool.js';
|
|
2
2
|
import { ContestedResourceVoteState, ContestedStateResultType } from '../../types.js';
|
|
3
3
|
import { DataContractWASM } from 'pshenmic-dpp';
|
|
4
4
|
import { StartAtIdentifierInfo } from './getContestedResourceVoteState.js';
|
|
@@ -9,8 +9,8 @@ import { StartAtIdentifierInfo } from './getContestedResourceVoteState.js';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare class ContestedResourcesController {
|
|
11
11
|
/** @ignore **/
|
|
12
|
-
grpcPool:
|
|
13
|
-
constructor(grpcPool:
|
|
12
|
+
grpcPool: GRPCPool;
|
|
13
|
+
constructor(grpcPool: GRPCPool);
|
|
14
14
|
/**
|
|
15
15
|
* Retrieves an info about vote state for contested resource
|
|
16
16
|
*
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DataContractWASM, IdentifierLike } from 'pshenmic-dpp';
|
|
2
|
-
import
|
|
3
|
-
export default function getByIdentifier(grpcPool:
|
|
2
|
+
import { GRPCPool } from '../grpcConnectionPool.js';
|
|
3
|
+
export default function getByIdentifier(grpcPool: GRPCPool, identifier: IdentifierLike): Promise<DataContractWASM>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataContractTokens, DataContractWASM, IdentifierLike, PlatformVersionWASM, StateTransitionWASM } from 'pshenmic-dpp';
|
|
2
|
-
import
|
|
2
|
+
import { GRPCPool } from '../grpcConnectionPool.js';
|
|
3
3
|
import { DataContractConfig } from '../../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Collection of methods necessary to work with Data Contracts in the network,
|
|
@@ -9,8 +9,8 @@ import { DataContractConfig } from '../../types.js';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare class DataContractsController {
|
|
11
11
|
/** @ignore */
|
|
12
|
-
grpcPool:
|
|
13
|
-
constructor(grpcPool:
|
|
12
|
+
grpcPool: GRPCPool;
|
|
13
|
+
constructor(grpcPool: GRPCPool);
|
|
14
14
|
/**
|
|
15
15
|
* Creates an instance of {DataContractWASM} that can be used to
|
|
16
16
|
* register a data contract in the network.
|
package/src/documents/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DocumentTransitionParams } from '../../types.js';
|
|
2
2
|
import { DocumentWASM, IdentifierLike, IdentifierWASM, StateTransitionWASM, WhereClause } from 'pshenmic-dpp';
|
|
3
|
-
import
|
|
3
|
+
import { GRPCPool } from '../grpcConnectionPool.js';
|
|
4
4
|
/**
|
|
5
5
|
* Collection of methods to work with documents like creation, querying or preparing a transition action
|
|
6
6
|
*
|
|
@@ -8,8 +8,8 @@ import GRPCConnectionPool from '../grpcConnectionPool.js';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class DocumentsController {
|
|
10
10
|
/** @ignore **/
|
|
11
|
-
grpcPool:
|
|
12
|
-
constructor(grpcPool:
|
|
11
|
+
grpcPool: GRPCPool;
|
|
12
|
+
constructor(grpcPool: GRPCPool);
|
|
13
13
|
/**
|
|
14
14
|
* Creates a {DocumentWASM} instance that can be used to submit a document in the network.
|
|
15
15
|
*
|
package/src/documents/query.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DocumentWASM, IdentifierLike, IdentifierWASM, WhereClause } from 'pshenmic-dpp';
|
|
2
|
-
import
|
|
3
|
-
export default function query(grpcPool:
|
|
2
|
+
import { GRPCPool } from '../grpcConnectionPool.js';
|
|
3
|
+
export default function query(grpcPool: GRPCPool, dataContractId: IdentifierLike, documentTypeName: string, where?: WhereClause[], orderBy?: string[][], limit?: number | undefined, startAt?: IdentifierWASM, startAfter?: IdentifierWASM): Promise<DocumentWASM[]>;
|
|
@@ -2,8 +2,19 @@ import { PlatformClient } from '../proto/generated/platform.client.js';
|
|
|
2
2
|
import { Network } from '../types.js';
|
|
3
3
|
export type MasternodeList = Record<string, MasternodeInfo>;
|
|
4
4
|
export interface GRPCOptions {
|
|
5
|
-
poolLimit
|
|
5
|
+
poolLimit?: number;
|
|
6
6
|
dapiUrl?: string | string[];
|
|
7
|
+
/** Custom connection pool, if set, `poolLimit` and `dapiUrl` are ignored **/
|
|
8
|
+
pool?: GRPCPool;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Minimal interface the SDK requires from a GRPC connection pool.
|
|
12
|
+
* Implement it to supply your own node selection, retries, transport options, etc.
|
|
13
|
+
*/
|
|
14
|
+
export interface GRPCPool {
|
|
15
|
+
network: Network;
|
|
16
|
+
getClient: (abortController?: AbortController) => PlatformClient;
|
|
17
|
+
waitForInit?: () => Promise<void>;
|
|
7
18
|
}
|
|
8
19
|
export interface MasternodeInfo {
|
|
9
20
|
proTxHash: string;
|
|
@@ -23,10 +34,16 @@ export interface MasternodeInfo {
|
|
|
23
34
|
collateraladdress: string;
|
|
24
35
|
pubkeyoperator: string;
|
|
25
36
|
}
|
|
26
|
-
export
|
|
37
|
+
export declare const createClient: (url: string, abortController?: AbortController) => PlatformClient;
|
|
38
|
+
export default class GRPCConnectionPool implements GRPCPool {
|
|
39
|
+
#private;
|
|
27
40
|
dapiUrls: string[];
|
|
28
41
|
network: Network;
|
|
29
42
|
constructor(network: Network, grpcOptions?: GRPCOptions);
|
|
30
43
|
_initialize(network: Network, poolLimit: number, dapiUrl?: string | string[]): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Resolves when the pool initialization (seed nodes check and evonodes discovery) is finished
|
|
46
|
+
*/
|
|
47
|
+
waitForInit(): Promise<void>;
|
|
31
48
|
getClient(abortController?: AbortController): PlatformClient;
|
|
32
49
|
}
|