dash-platform-sdk 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +15 -15
  2. package/bundle.min.js +1 -1
  3. package/package.json +1 -1
  4. package/src/DashPlatformSDK.d.ts +0 -8
  5. package/src/DashPlatformSDK.js +0 -10
  6. package/src/contestedResources/getContestedResourceVoteState.js +1 -1
  7. package/src/dataContracts/getDataContractByIdentifier.js +1 -1
  8. package/src/documents/query.js +1 -1
  9. package/src/grpcConnectionPool.d.ts +3 -6
  10. package/src/grpcConnectionPool.js +141 -47
  11. package/src/identities/getIdentityBalance.js +1 -1
  12. package/src/identities/getIdentityByIdentifier.js +1 -1
  13. package/src/identities/getIdentityByNonUniquePublicKeyHash.js +1 -1
  14. package/src/identities/getIdentityByPublicKeyHash.js +1 -1
  15. package/src/identities/getIdentityContractNonce.js +1 -1
  16. package/src/identities/getIdentityNonce.js +1 -1
  17. package/src/identities/getIdentityPublicKeys.js +1 -1
  18. package/src/node/epochInfos.js +1 -1
  19. package/src/node/finalizedEpochInfos.js +1 -1
  20. package/src/node/getCurrentQuorumsInfo.js +1 -1
  21. package/src/node/status.js +1 -1
  22. package/src/node/totalCredits.js +1 -1
  23. package/src/platformAddresses/getAddressInfo.js +1 -1
  24. package/src/platformAddresses/getAddressesBranchState.js +1 -1
  25. package/src/platformAddresses/getAddressesInfos.js +1 -1
  26. package/src/platformAddresses/getAddressesTrunkState.js +1 -1
  27. package/src/platformAddresses/getRecentAddressBalanceChanges.js +1 -1
  28. package/src/platformAddresses/getRecentCompactedAddressBalanceChanges.js +1 -1
  29. package/src/shielded/getMostRecentShieldedAnchor.js +1 -1
  30. package/src/shielded/getShieldedAnchors.js +1 -1
  31. package/src/shielded/getShieldedEncryptedNotes.js +1 -1
  32. package/src/shielded/getShieldedNotesCount.js +1 -1
  33. package/src/shielded/getShieldedNullifiers.js +1 -1
  34. package/src/shielded/getShieldedPoolState.js +1 -1
  35. package/src/stateTransitions/broadcast.js +1 -1
  36. package/src/stateTransitions/waitForStateTransitionResult.js +1 -1
  37. package/src/tokens/getIdentitiesTokenBalances.js +1 -1
  38. package/src/tokens/getIdentityTokensBalances.js +1 -1
  39. package/src/tokens/getTokenContractInfo.js +1 -1
  40. package/src/tokens/getTokenDirectPurchasePrices.js +1 -1
  41. package/src/tokens/getTokenTotalSupply.js +1 -1
  42. package/src/utils/verifyTenderdashProof.js +1 -1
  43. package/test/unit/ContestedResources.spec.js +0 -1
  44. package/test/unit/DataContract.spec.js +0 -1
  45. package/test/unit/Document.spec.js +0 -1
  46. package/test/unit/Identity.spec.js +0 -1
  47. package/test/unit/Names.spec.js +0 -1
  48. package/test/unit/Node.spec.js +0 -1
  49. package/test/unit/PlatformAddress.spec.js +0 -1
  50. package/test/unit/Shielded.spec.js +0 -1
  51. package/test/unit/Tokens.spec.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dash-platform-sdk",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "main": "index.js",
5
5
  "description": "Lightweight SDK for accessing Dash Platform blockchain",
6
6
  "repository": {
@@ -58,14 +58,6 @@ export declare class DashPlatformSDK {
58
58
  * @param network
59
59
  */
60
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>;
69
61
  /**
70
62
  * Get currently used network
71
63
  *
@@ -81,16 +81,6 @@ export class DashPlatformSDK {
81
81
  this.names = new NamesController(grpcPool);
82
82
  this.keyPair = new KeyPairController();
83
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
- }
94
84
  /**
95
85
  * Get currently used network
96
86
  *
@@ -27,7 +27,7 @@ export default async function getContestedResourceVoteState(grpcPool, contract,
27
27
  }
28
28
  }
29
29
  });
30
- const { response } = await grpcPool.getClient().getContestedResourceVoteState(getContestedResourceVoteStateRequest);
30
+ const { response } = await (await grpcPool.getClient()).getContestedResourceVoteState(getContestedResourceVoteStateRequest);
31
31
  const { version } = response;
32
32
  if (version.oneofKind !== 'v0') {
33
33
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -18,7 +18,7 @@ export default async function getByIdentifier(grpcPool, identifier) {
18
18
  }
19
19
  }
20
20
  });
21
- const { response } = await grpcPool.getClient().getDataContract(getDataContractRequest);
21
+ const { response } = await (await grpcPool.getClient()).getDataContract(getDataContractRequest);
22
22
  const { version } = response;
23
23
  if (version.oneofKind !== 'v0') {
24
24
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -35,7 +35,7 @@ export default async function query(grpcPool, dataContractId, documentTypeName,
35
35
  }
36
36
  });
37
37
  const dataContract = await getDataContractByIdentifier(grpcPool, dataContractId);
38
- const { response } = await grpcPool.getClient().getDocuments(getDocumentsRequest);
38
+ const { response } = await (await grpcPool.getClient()).getDocuments(getDocumentsRequest);
39
39
  const { version } = response;
40
40
  if (version.oneofKind !== 'v0') {
41
41
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -1,6 +1,5 @@
1
1
  import { PlatformClient } from '../proto/generated/platform.client.js';
2
2
  import { Network } from '../types.js';
3
- export type MasternodeList = Record<string, MasternodeInfo>;
4
3
  export interface GRPCOptions {
5
4
  poolLimit?: number;
6
5
  dapiUrl?: string | string[];
@@ -13,8 +12,7 @@ export interface GRPCOptions {
13
12
  */
14
13
  export interface GRPCPool {
15
14
  network: Network;
16
- getClient: (abortController?: AbortController) => PlatformClient;
17
- waitForInit?: () => Promise<void>;
15
+ getClient: (abortController?: AbortController) => PlatformClient | Promise<PlatformClient>;
18
16
  }
19
17
  export interface MasternodeInfo {
20
18
  proTxHash: string;
@@ -42,8 +40,7 @@ export default class GRPCConnectionPool implements GRPCPool {
42
40
  constructor(network: Network, grpcOptions?: GRPCOptions);
43
41
  _initialize(network: Network, poolLimit: number, dapiUrl?: string | string[]): Promise<void>;
44
42
  /**
45
- * Resolves when the pool initialization (seed nodes check and evonodes discovery) is finished
43
+ * Waits for the pool initialization and returns a client connected to a random healthy node
46
44
  */
47
- waitForInit(): Promise<void>;
48
- getClient(abortController?: AbortController): PlatformClient;
45
+ getClient(abortController?: AbortController): Promise<PlatformClient>;
49
46
  }
@@ -4,31 +4,47 @@ import { GetStatusRequest } from '../proto/generated/platform.js';
4
4
  import getCurrentQuorumsInfo from './node/getCurrentQuorumsInfo.js';
5
5
  import getRandomArrayItem from './utils/getRandomArrayItem.js';
6
6
  import { fetchWithDetails } from './utils/fetchWithDetails.js';
7
- const GRPC_DEFAULT_POOL_LIMIT = 5;
7
+ import { LATEST_PLATFORM_VERSION } from './constants.js';
8
+ const GRPC_DEFAULT_POOL_LIMIT = 15;
8
9
  const seedNodes = {
9
10
  testnet: [
10
11
  // seed-1.pshenmic.dev
11
- 'https://158.160.14.115:1443',
12
- 'https://62.84.119.150:1443',
13
- // validator
14
- 'https://68.67.122.26:1443'
12
+ 'https://153.80.206.232:1443',
13
+ // DCG seed
14
+ 'https://34.209.12.72:1443',
15
+ // Testnet validators (hp-masternode-1 -> hp-masternode-15)
16
+ 'https://68.67.122.1:1443',
17
+ 'https://68.67.122.2:1443',
18
+ 'https://68.67.122.3:1443',
19
+ 'https://68.67.122.4:1443',
20
+ 'https://68.67.122.5:1443',
21
+ 'https://68.67.122.6:1443',
22
+ 'https://68.67.122.7:1443',
23
+ 'https://68.67.122.8:1443',
24
+ 'https://68.67.122.9:1443',
25
+ 'https://68.67.122.10:1443',
26
+ 'https://68.67.122.11:1443',
27
+ 'https://68.67.122.12:1443',
28
+ 'https://68.67.122.13:1443',
29
+ 'https://68.67.122.14:1443',
30
+ 'https://68.67.122.15:1443'
15
31
  ],
16
32
  mainnet: [
17
33
  // seed-1.pshenmic.dev
18
- 'https://158.160.14.115:443',
19
- 'https://62.84.119.150:443',
34
+ 'https://153.80.206.97:443',
35
+ // DCG seed
36
+ 'https://34.211.174.194:443',
20
37
  // validator
21
- 'https://95.216.146.18:443',
22
- // mainnet dcg seeds
23
- // 'https://158.160.14.115',
24
- // 'https://3.0.60.103',
25
- // 'https://34.211.174.194'
38
+ 'https://95.216.146.18:443'
26
39
  ]
27
40
  };
28
41
  const DAPI_PORTS = {
29
42
  testnet: 1443,
30
43
  mainnet: 443
31
44
  };
45
+ const HEALTHCHECK_TIMEOUT_MS = 5000;
46
+ // platform produces empty blocks every 3 minutes, so a healthy chain is never older than that
47
+ const HEALTHCHECK_MAX_BLOCK_AGE_MS = 10 * 60 * 1000;
32
48
  export const createClient = (url, abortController) => {
33
49
  return new PlatformClient(new GrpcWebFetchTransport({
34
50
  baseUrl: url,
@@ -36,14 +52,73 @@ export const createClient = (url, abortController) => {
36
52
  fetch: fetchWithDetails
37
53
  }));
38
54
  };
55
+ /**
56
+ * Runs a request with an AbortController that is aborted after the given timeout
57
+ */
58
+ const withTimeout = async (request, timeoutMs = HEALTHCHECK_TIMEOUT_MS) => {
59
+ const abortController = new AbortController();
60
+ const timeout = setTimeout(() => abortController.abort(), timeoutMs);
61
+ try {
62
+ return await request(abortController);
63
+ }
64
+ finally {
65
+ clearTimeout(timeout);
66
+ }
67
+ };
68
+ const isNodeHealthy = async (url) => {
69
+ try {
70
+ const response = await withTimeout(async (abortController) => {
71
+ const { response } = await createClient(url, abortController).getStatus(GetStatusRequest.create({}));
72
+ return response;
73
+ });
74
+ if (response.version.oneofKind !== 'v0') {
75
+ return false;
76
+ }
77
+ const { version, chain, time } = response.version.v0;
78
+ // node is still syncing
79
+ if (chain == null || Boolean(chain.catchingUp)) {
80
+ return false;
81
+ }
82
+ // node runs a protocol version that is not supported by the SDK
83
+ // (e.g. newer software with incompatible proofs / responses)
84
+ const protocol = version?.protocol?.drive;
85
+ if (protocol == null || protocol.current !== Number(LATEST_PLATFORM_VERSION) || protocol?.latest !== Number(LATEST_PLATFORM_VERSION)) {
86
+ return false;
87
+ }
88
+ // chain is stalled, last block is too old relative to the node's own clock
89
+ // (local time is in seconds, block time is in milliseconds)
90
+ if (time?.block == null || Number(time.local) * 1000 - Number(time.block) > HEALTHCHECK_MAX_BLOCK_AGE_MS) {
91
+ return false;
92
+ }
93
+ return true;
94
+ }
95
+ catch (e) {
96
+ return false;
97
+ }
98
+ };
99
+ // Fisher–Yates shuffle
100
+ // Randomly shuffles the elements inside of array, having previously cloned it.
101
+ const shuffle = (array) => {
102
+ const result = [...array];
103
+ for (let i = result.length - 1; i > 0; i--) {
104
+ const j = Math.floor(Math.random() * (i + 1));
105
+ [result[i], result[j]] = [result[j], result[i]];
106
+ }
107
+ return result;
108
+ };
39
109
  export default class GRPCConnectionPool {
40
- dapiUrls;
110
+ dapiUrls = [];
41
111
  network;
112
+ #poolLimit;
113
+ #dapiUrl;
42
114
  #initialization;
43
115
  constructor(network, grpcOptions) {
44
- const grpcPoolLimit = grpcOptions?.poolLimit ?? GRPC_DEFAULT_POOL_LIMIT;
45
116
  this.network = network;
46
- this.#initialization = this._initialize(network, grpcPoolLimit, grpcOptions?.dapiUrl).catch(console.error);
117
+ this.#poolLimit = grpcOptions?.poolLimit ?? GRPC_DEFAULT_POOL_LIMIT;
118
+ this.#dapiUrl = grpcOptions?.dapiUrl;
119
+ // start initialization in the background, failures are reported on the first request
120
+ this.#initialization = this._initialize(network, this.#poolLimit, this.#dapiUrl);
121
+ this.#initialization.catch(() => { });
47
122
  }
48
123
  async _initialize(network, poolLimit, dapiUrl) {
49
124
  if (typeof dapiUrl === 'string') {
@@ -51,56 +126,75 @@ export default class GRPCConnectionPool {
51
126
  return;
52
127
  }
53
128
  if (Array.isArray(dapiUrl)) {
54
- this.dapiUrls = dapiUrl;
129
+ this.dapiUrls = [...new Set(dapiUrl)];
130
+ if (this.dapiUrls.length === 0) {
131
+ throw new Error('DAPI URL list is empty');
132
+ }
55
133
  return;
56
134
  }
57
135
  if (dapiUrl != null) {
58
136
  throw new Error('Unrecognized DAPI URL');
59
137
  }
60
- // Add default seed nodes
61
- this.dapiUrls = [...seedNodes[network]];
62
- // retrieve evonodes from current validator sets through the first responding seed node,
63
- // seed nodes that failed to respond are removed from the pool
64
- const seedRequests = seedNodes[network].map(async (seed) => {
138
+ let quorumsInfo;
139
+ const errors = [];
140
+ for (const seed of seedNodes[network]) {
65
141
  try {
66
- return await getCurrentQuorumsInfo({ network, getClient: () => createClient(seed) });
142
+ quorumsInfo = await withTimeout(async (abortController) => await getCurrentQuorumsInfo({ network, getClient: () => createClient(seed, abortController) }));
143
+ break;
67
144
  }
68
145
  catch (e) {
69
- this.dapiUrls = this.dapiUrls.filter(url => url !== seed);
70
- throw e;
146
+ errors.push(e);
71
147
  }
72
- });
73
- const { validatorSets } = await Promise.any(seedRequests);
148
+ }
149
+ if (quorumsInfo == null) {
150
+ throw new AggregateError(errors, `None of the ${network} seed nodes are available: ${errors.map(String).join('; ')}`);
151
+ }
74
152
  // map it to array of dapiUrls
75
- const networkDAPIUrls = [...new Set(validatorSets
153
+ const networkDAPIUrls = shuffle([...new Set(quorumsInfo.validatorSets
76
154
  .flatMap(validatorSet => validatorSet.members)
77
155
  .filter(member => !member.isBanned)
78
- .map(member => `https://${member.nodeIp}:${DAPI_PORTS[network]}`))];
79
- // healthcheck nodes
80
- for (const url of networkDAPIUrls) {
81
- if (this.dapiUrls.length > poolLimit) {
82
- break;
83
- }
84
- try {
85
- const client = createClient(url);
86
- const { response } = await client.getStatus(GetStatusRequest.create({}));
87
- if (response.version.oneofKind === 'v0' && response.version.v0.chain != null) {
88
- this.dapiUrls.push(url);
156
+ .map(member => `https://${member.nodeIp}:${DAPI_PORTS[network]}`))])
157
+ .filter(url => !this.dapiUrls.includes(url));
158
+ // healthcheck nodes in parallel batches until the pool is full
159
+ for (let i = 0; i < networkDAPIUrls.length && this.dapiUrls.length < poolLimit; i += poolLimit) {
160
+ const batch = networkDAPIUrls.slice(i, i + poolLimit);
161
+ await Promise.all(batch.map(async (url) => {
162
+ if (await isNodeHealthy(url)) {
163
+ this.#addNode(url, poolLimit);
89
164
  }
90
- }
91
- catch (e) {
92
- }
165
+ }));
166
+ }
167
+ // fail the initialization, so it is retried on the next request
168
+ if (this.dapiUrls.length === 0) {
169
+ throw new Error(`None of the ${network} evonodes are available (${networkDAPIUrls.length} checked, ` +
170
+ `nodes must be synced and run protocol version ${Number(LATEST_PLATFORM_VERSION)})`);
93
171
  }
94
- // wait until every seed node responded or failed, so dead ones are removed from the pool
95
- await Promise.allSettled(seedRequests);
96
172
  }
97
173
  /**
98
- * Resolves when the pool initialization (seed nodes check and evonodes discovery) is finished
174
+ * Adds a node to the pool, unless it is already there or the pool is full
99
175
  */
100
- async waitForInit() {
101
- await this.#initialization;
176
+ #addNode(url, poolLimit) {
177
+ if (!this.dapiUrls.includes(url) && this.dapiUrls.length < poolLimit) {
178
+ this.dapiUrls.push(url);
179
+ }
102
180
  }
103
- getClient(abortController) {
181
+ /**
182
+ * Waits for the pool initialization and returns a client connected to a random healthy node
183
+ */
184
+ async getClient(abortController) {
185
+ // retry initialization if the previous attempt failed
186
+ this.#initialization ??= this._initialize(this.network, this.#poolLimit, this.#dapiUrl);
187
+ const initialization = this.#initialization;
188
+ try {
189
+ await initialization;
190
+ }
191
+ catch (e) {
192
+ // other callers may have already started a new attempt
193
+ if (this.#initialization === initialization) {
194
+ this.#initialization = undefined;
195
+ }
196
+ throw e;
197
+ }
104
198
  const dapiUrl = getRandomArrayItem(this.dapiUrls);
105
199
  return createClient(dapiUrl, abortController);
106
200
  }
@@ -15,7 +15,7 @@ export default async function getIdentityBalance(grpcPool, identifier) {
15
15
  }
16
16
  }
17
17
  });
18
- const { response } = await grpcPool.getClient().getIdentityBalance(getIdentityBalanceRequest);
18
+ const { response } = await (await grpcPool.getClient()).getIdentityBalance(getIdentityBalanceRequest);
19
19
  const { version } = response;
20
20
  if (version.oneofKind !== 'v0') {
21
21
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -15,7 +15,7 @@ export default async function getIdentityByIdentifier(grpcPool, identifier) {
15
15
  }
16
16
  }
17
17
  });
18
- const { response } = await grpcPool.getClient().getIdentity(getIdentityRequest);
18
+ const { response } = await (await grpcPool.getClient()).getIdentity(getIdentityRequest);
19
19
  const { version } = response;
20
20
  if (version.oneofKind !== 'v0') {
21
21
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -16,7 +16,7 @@ export default async function getIdentityByNonUniquePublicKeyHash(grpcPool, hex)
16
16
  }
17
17
  }
18
18
  });
19
- const { response } = await grpcPool.getClient().getIdentityByNonUniquePublicKeyHash(getIdentityByNonUniquePublicKeyHashRequest);
19
+ const { response } = await (await grpcPool.getClient()).getIdentityByNonUniquePublicKeyHash(getIdentityByNonUniquePublicKeyHashRequest);
20
20
  const { version } = response;
21
21
  if (version.oneofKind !== 'v0') {
22
22
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -15,7 +15,7 @@ export default async function getIdentityByPublicKeyHash(grpcPool, hex) {
15
15
  }
16
16
  }
17
17
  });
18
- const { response } = await grpcPool.getClient().getIdentityByPublicKeyHash(getIdentityByPublicKeyHashRequest);
18
+ const { response } = await (await grpcPool.getClient()).getIdentityByPublicKeyHash(getIdentityByPublicKeyHashRequest);
19
19
  const { version } = response;
20
20
  if (version.oneofKind !== 'v0') {
21
21
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -18,7 +18,7 @@ export default async function getIdentityContractNonce(grpcPool, identity, dataC
18
18
  }
19
19
  }
20
20
  });
21
- const { response } = await grpcPool.getClient().getIdentityContractNonce(getIdentityContractNonceRequest);
21
+ const { response } = await (await grpcPool.getClient()).getIdentityContractNonce(getIdentityContractNonceRequest);
22
22
  const { version } = response;
23
23
  if (version.oneofKind !== 'v0') {
24
24
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -16,7 +16,7 @@ export default async function getIdentityNonce(grpcPool, identifier) {
16
16
  }
17
17
  }
18
18
  });
19
- const { response } = await grpcPool.getClient().getIdentityNonce(getIdentityNonceRequest);
19
+ const { response } = await (await grpcPool.getClient()).getIdentityNonce(getIdentityNonceRequest);
20
20
  const { version } = response;
21
21
  if (version.oneofKind !== 'v0') {
22
22
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -30,7 +30,7 @@ export default async function getIdentityPublicKeys(grpcPool, identifier, keyIds
30
30
  }
31
31
  }
32
32
  });
33
- const { response } = await grpcPool.getClient().getIdentityKeys(getIdentityKeysRequest);
33
+ const { response } = await (await grpcPool.getClient()).getIdentityKeys(getIdentityKeysRequest);
34
34
  const { version } = response;
35
35
  if (version.oneofKind !== 'v0') {
36
36
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -17,7 +17,7 @@ export default async function epochInfos(grpcPool, count, ascending, start) {
17
17
  }
18
18
  }
19
19
  });
20
- const { response } = await grpcPool.getClient().getEpochsInfo(getEpochsInfoRequest);
20
+ const { response } = await (await grpcPool.getClient()).getEpochsInfo(getEpochsInfoRequest);
21
21
  const { version } = response;
22
22
  if (version.oneofKind !== 'v0') {
23
23
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -17,7 +17,7 @@ export default async function getFinalizedEpochsInfo(grpcPool, startEpochIndex,
17
17
  }
18
18
  }
19
19
  });
20
- const { response } = await grpcPool.getClient().getFinalizedEpochInfos(getEpochsInfoRequest);
20
+ const { response } = await (await grpcPool.getClient()).getFinalizedEpochInfos(getEpochsInfoRequest);
21
21
  const { version } = response;
22
22
  if (version.oneofKind !== 'v0') {
23
23
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -7,7 +7,7 @@ export default async function getCurrentQuorumsInfo(grpcPool) {
7
7
  v0: {}
8
8
  }
9
9
  });
10
- const { response } = await grpcPool.getClient().getCurrentQuorumsInfo(getCurrentQuorumsInfoRequest);
10
+ const { response } = await (await grpcPool.getClient()).getCurrentQuorumsInfo(getCurrentQuorumsInfoRequest);
11
11
  const { version } = response;
12
12
  if (version.oneofKind !== 'v0') {
13
13
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -7,7 +7,7 @@ export default async function status(grpcPool) {
7
7
  v0: {}
8
8
  }
9
9
  });
10
- const { response } = await grpcPool.getClient().getStatus(getStatusRequest);
10
+ const { response } = await (await grpcPool.getClient()).getStatus(getStatusRequest);
11
11
  const { version } = response;
12
12
  if (version.oneofKind !== 'v0') {
13
13
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -11,7 +11,7 @@ export default async function totalCredits(grpcPool) {
11
11
  v0: { prove: true }
12
12
  }
13
13
  });
14
- const { response } = await grpcPool.getClient().getTotalCreditsInPlatform(getTotalCreditsInPlatformRequest);
14
+ const { response } = await (await grpcPool.getClient()).getTotalCreditsInPlatform(getTotalCreditsInPlatformRequest);
15
15
  const { version } = response;
16
16
  if (version.oneofKind !== 'v0') {
17
17
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -15,7 +15,7 @@ export async function getAddressInfo(grpcPool, platformAddress) {
15
15
  }
16
16
  }
17
17
  });
18
- const { response } = await grpcPool.getClient().getAddressInfo(getAddressInfoRequest);
18
+ const { response } = await (await grpcPool.getClient()).getAddressInfo(getAddressInfoRequest);
19
19
  const { version } = response;
20
20
  if (version.oneofKind !== 'v0') {
21
21
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -12,7 +12,7 @@ export async function getAddressesBranchState(grpcPool, key, depth, checkpointHe
12
12
  }
13
13
  }
14
14
  });
15
- const { response } = await grpcPool.getClient().getAddressesBranchState(getAddressesBranchStateRequest);
15
+ const { response } = await (await grpcPool.getClient()).getAddressesBranchState(getAddressesBranchStateRequest);
16
16
  const { version } = response;
17
17
  if (version.oneofKind !== 'v0') {
18
18
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -15,7 +15,7 @@ export async function getAddressesInfos(grpcPool, platformAddresses) {
15
15
  }
16
16
  }
17
17
  });
18
- const { response } = await grpcPool.getClient().getAddressesInfos(getAddressInfoRequest);
18
+ const { response } = await (await grpcPool.getClient()).getAddressesInfos(getAddressInfoRequest);
19
19
  const { version } = response;
20
20
  if (version.oneofKind !== 'v0') {
21
21
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -11,7 +11,7 @@ export async function getAddressesTrunkState(grpcPool) {
11
11
  v0: {}
12
12
  }
13
13
  });
14
- const { response } = await grpcPool.getClient().getAddressesTrunkState(getAddressesTrunkStateRequest);
14
+ const { response } = await (await grpcPool.getClient()).getAddressesTrunkState(getAddressesTrunkStateRequest);
15
15
  const { version } = response;
16
16
  if (version.oneofKind !== 'v0') {
17
17
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -15,7 +15,7 @@ export async function getRecentAddressBalanceChanges(grpcPool, startHeight, star
15
15
  }
16
16
  }
17
17
  });
18
- const { response } = await grpcPool.getClient().getRecentAddressBalanceChanges(getRecentAddressBalanceChangesRequest);
18
+ const { response } = await (await grpcPool.getClient()).getRecentAddressBalanceChanges(getRecentAddressBalanceChangesRequest);
19
19
  const { version } = response;
20
20
  if (version.oneofKind !== 'v0') {
21
21
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -14,7 +14,7 @@ export async function getRecentCompactedAddressBalanceChanges(grpcPool, startBlo
14
14
  }
15
15
  }
16
16
  });
17
- const { response } = await grpcPool.getClient().getRecentCompactedAddressBalanceChanges(getRecentCompactedAddressBalanceChangesRequest);
17
+ const { response } = await (await grpcPool.getClient()).getRecentCompactedAddressBalanceChanges(getRecentCompactedAddressBalanceChangesRequest);
18
18
  const { version } = response;
19
19
  if (version.oneofKind !== 'v0') {
20
20
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -13,7 +13,7 @@ export default async function getMostRecentShieldedAnchor(grpcPool) {
13
13
  }
14
14
  }
15
15
  });
16
- const { response } = await grpcPool.getClient().getMostRecentShieldedAnchor(getMostRecentShieldedAnchorRequest);
16
+ const { response } = await (await grpcPool.getClient()).getMostRecentShieldedAnchor(getMostRecentShieldedAnchorRequest);
17
17
  const { version } = response;
18
18
  if (version.oneofKind !== 'v0') {
19
19
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -13,7 +13,7 @@ export default async function getShieldedAnchors(grpcPool) {
13
13
  }
14
14
  }
15
15
  });
16
- const { response } = await grpcPool.getClient().getShieldedAnchors(getShieldedAnchorsRequest);
16
+ const { response } = await (await grpcPool.getClient()).getShieldedAnchors(getShieldedAnchorsRequest);
17
17
  const { version } = response;
18
18
  if (version.oneofKind !== 'v0') {
19
19
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -15,7 +15,7 @@ export default async function getShieldedEncryptedNotes(grpcPool, startIndex, co
15
15
  }
16
16
  }
17
17
  });
18
- const { response } = await grpcPool.getClient().getShieldedEncryptedNotes(getShieldedEncryptedNotesRequest);
18
+ const { response } = await (await grpcPool.getClient()).getShieldedEncryptedNotes(getShieldedEncryptedNotesRequest);
19
19
  const { version } = response;
20
20
  if (version.oneofKind !== 'v0') {
21
21
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -13,7 +13,7 @@ export default async function getShieldedNotesCount(grpcPool) {
13
13
  }
14
14
  }
15
15
  });
16
- const { response } = await grpcPool.getClient().getShieldedNotesCount(getShieldedNotesCountRequest);
16
+ const { response } = await (await grpcPool.getClient()).getShieldedNotesCount(getShieldedNotesCountRequest);
17
17
  const { version } = response;
18
18
  if (version.oneofKind !== 'v0') {
19
19
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -14,7 +14,7 @@ export default async function getShieldedNullifiers(grpcPool, nullifiers) {
14
14
  }
15
15
  }
16
16
  });
17
- const { response } = await grpcPool.getClient().getShieldedNullifiers(getShieldedNullifiersRequest);
17
+ const { response } = await (await grpcPool.getClient()).getShieldedNullifiers(getShieldedNullifiersRequest);
18
18
  const { version } = response;
19
19
  if (version.oneofKind !== 'v0') {
20
20
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -13,7 +13,7 @@ export default async function getShieldedPoolState(grpcPool) {
13
13
  }
14
14
  }
15
15
  });
16
- const { response } = await grpcPool.getClient().getShieldedPoolState(getShieldedPoolStateRequest);
16
+ const { response } = await (await grpcPool.getClient()).getShieldedPoolState(getShieldedPoolStateRequest);
17
17
  const { version } = response;
18
18
  if (version.oneofKind !== 'v0') {
19
19
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -8,7 +8,7 @@ export default async function broadcast(grpcPool, stateTransition) {
8
8
  const broadcastStateTransitionRequest = BroadcastStateTransitionRequest.create({
9
9
  stateTransition: stateTransition.bytes()
10
10
  });
11
- await grpcPool.getClient().broadcastStateTransition(broadcastStateTransitionRequest);
11
+ await (await grpcPool.getClient()).broadcastStateTransition(broadcastStateTransitionRequest);
12
12
  }
13
13
  catch (err) {
14
14
  const errorBin = err.meta?.['dash-serialized-consensus-error-bin'];
@@ -18,7 +18,7 @@ export default async function waitForStateTransitionResult(grpcPool, stateTransi
18
18
  }
19
19
  }
20
20
  });
21
- const { response } = await grpcPool.getClient().waitForStateTransitionResult(waitForStateTransitionResultRequest);
21
+ const { response } = await (await grpcPool.getClient()).waitForStateTransitionResult(waitForStateTransitionResultRequest);
22
22
  const { version } = response;
23
23
  if (version.oneofKind !== 'v0') {
24
24
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -17,7 +17,7 @@ export default async function getIdentitiesTokenBalances(grpcPool, identifiers,
17
17
  }
18
18
  }
19
19
  });
20
- const { response } = await grpcPool.getClient().getIdentitiesTokenBalances(getIdentitiesTokenBalancesRequest);
20
+ const { response } = await (await grpcPool.getClient()).getIdentitiesTokenBalances(getIdentitiesTokenBalancesRequest);
21
21
  const { version } = response;
22
22
  if (version.oneofKind !== 'v0') {
23
23
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');
@@ -17,7 +17,7 @@ export default async function getIdentityTokensBalances(grpcPool, identifier, to
17
17
  }
18
18
  }
19
19
  });
20
- const { response } = await grpcPool.getClient().getIdentityTokenBalances(getIdentityTokenBalancesRequest);
20
+ const { response } = await (await grpcPool.getClient()).getIdentityTokenBalances(getIdentityTokenBalancesRequest);
21
21
  const { version } = response;
22
22
  if (version.oneofKind !== 'v0') {
23
23
  throw new Error('Unexpected oneOf type returned from DAPI (must be v0)');