dash-platform-sdk 1.6.0-dev.7 → 1.6.0-dev.9

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 (65) hide show
  1. package/README.md +14 -14
  2. package/bundle.min.js +1 -1
  3. package/package.json +2 -2
  4. package/proto/generated/platform.client.d.ts +10 -0
  5. package/proto/generated/platform.client.js +7 -0
  6. package/proto/generated/platform.d.ts +137 -0
  7. package/proto/generated/platform.js +279 -1
  8. package/src/QueryExecutor.d.ts +40 -4
  9. package/src/QueryExecutor.js +61 -8
  10. package/src/constants.d.ts +7 -1
  11. package/src/constants.js +9 -2
  12. package/src/contestedResources/getContestedResourceVoteState.js +14 -6
  13. package/src/contestedResources/getVotePollsByEndDate.js +7 -2
  14. package/src/dataContracts/getDataContractByIdentifier.js +3 -3
  15. package/src/documents/index.d.ts +4 -1
  16. package/src/documents/index.js +6 -2
  17. package/src/documents/query.js +4 -4
  18. package/src/documents/queryAggregate.js +2 -3
  19. package/src/documents/queryJoined.js +6 -7
  20. package/src/documents/queryRanked.js +2 -3
  21. package/src/documents/v1.d.ts +2 -2
  22. package/src/documents/v1.js +2 -3
  23. package/src/grpcConnectionPool.d.ts +9 -2
  24. package/src/grpcConnectionPool.js +7 -8
  25. package/src/identities/getIdentityBalance.js +1 -2
  26. package/src/identities/getIdentityByIdentifier.js +1 -2
  27. package/src/identities/getIdentityByNonUniquePublicKeyHash.js +2 -3
  28. package/src/identities/getIdentityByPublicKeyHash.js +1 -2
  29. package/src/identities/getIdentityContractNonce.js +1 -2
  30. package/src/identities/getIdentityNonce.js +1 -2
  31. package/src/identities/getIdentityPublicKeys.js +1 -2
  32. package/src/names/index.d.ts +1 -1
  33. package/src/names/index.js +1 -1
  34. package/src/names/registerName.js +5 -2
  35. package/src/node/epochInfos.js +1 -2
  36. package/src/node/finalizedEpochInfos.js +1 -2
  37. package/src/node/getPathElements.d.ts +4 -0
  38. package/src/node/getPathElements.js +27 -0
  39. package/src/node/getProtocolVersion.d.ts +9 -0
  40. package/src/node/getProtocolVersion.js +29 -0
  41. package/src/node/index.d.ts +20 -0
  42. package/src/node/index.js +25 -0
  43. package/src/node/totalCredits.js +3 -3
  44. package/src/platformAddresses/getAddressInfo.js +1 -2
  45. package/src/platformAddresses/getAddressesBranchState.js +1 -2
  46. package/src/platformAddresses/getAddressesInfos.js +1 -2
  47. package/src/platformAddresses/getAddressesTrunkState.js +1 -2
  48. package/src/platformAddresses/getRecentAddressBalanceChanges.js +2 -2
  49. package/src/platformAddresses/getRecentCompactedAddressBalanceChanges.js +2 -2
  50. package/src/shielded/getMostRecentShieldedAnchor.js +1 -2
  51. package/src/shielded/getShieldedAnchors.js +1 -2
  52. package/src/shielded/getShieldedEncryptedNotes.js +2 -2
  53. package/src/shielded/getShieldedNotesCount.js +1 -2
  54. package/src/shielded/getShieldedNullifiers.js +1 -2
  55. package/src/shielded/getShieldedPoolState.js +1 -2
  56. package/src/stateTransitions/waitForStateTransitionResult.js +13 -11
  57. package/src/tokens/getIdentitiesTokenBalances.js +1 -2
  58. package/src/tokens/getIdentityTokensBalances.js +1 -2
  59. package/src/tokens/getTokenContractInfo.js +1 -2
  60. package/src/tokens/getTokenDirectPurchasePrices.js +1 -2
  61. package/src/tokens/getTokenTotalSupply.js +1 -2
  62. package/test/integration/MainnetCompatibility.spec.d.ts +1 -0
  63. package/test/integration/MainnetCompatibility.spec.js +373 -0
  64. package/test/unit/Node.spec.js +17 -0
  65. package/test/unit/SDK.spec.js +38 -0
@@ -2,7 +2,6 @@ import { GetIdentityByPublicKeyHashRequest } from '../../proto/generated/platfor
2
2
  import { IdentityWASM, verifyIdentityByUniqueKeyHashProof } from 'pshenmic-dpp';
3
3
  import hexToBytes from '../utils/hexToBytes.js';
4
4
  import QueryExecutor from '../QueryExecutor.js';
5
- import { LATEST_PLATFORM_VERSION } from '../constants.js';
6
5
  export default async function getIdentityByPublicKeyHash(grpcPool, quorumKeyProvider, hex) {
7
6
  const getIdentityByPublicKeyHashRequest = GetIdentityByPublicKeyHashRequest.create({
8
7
  version: {
@@ -15,7 +14,7 @@ export default async function getIdentityByPublicKeyHash(grpcPool, quorumKeyProv
15
14
  });
16
15
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
17
16
  .setGrpcRequest('getIdentityByPublicKeyHash', getIdentityByPublicKeyHashRequest)
18
- .setProofVerifier(verifyIdentityByUniqueKeyHashProof, hexToBytes(hex), LATEST_PLATFORM_VERSION)
17
+ .setProofVerifier(verifyIdentityByUniqueKeyHashProof, (_, platformVersion) => [hexToBytes(hex), platformVersion])
19
18
  .mapResponse(data => {
20
19
  const identity = data.proved ? data.verified.identity : IdentityWASM.fromBytes(data.result.identity);
21
20
  if (identity == null) {
@@ -1,7 +1,6 @@
1
1
  import { GetIdentityContractNonceRequest } from '../../proto/generated/platform.js';
2
2
  import { IdentifierWASM, verifyIdentityContractNonceProof } from 'pshenmic-dpp';
3
3
  import QueryExecutor from '../QueryExecutor.js';
4
- import { LATEST_PLATFORM_VERSION } from '../constants.js';
5
4
  const IDENTITY_CONTRACT_NONCE_VALUE_FILTER = BigInt(0xFFFFFFFFFF);
6
5
  export default async function getIdentityContractNonce(grpcPool, quorumKeyProvider, identity, dataContract) {
7
6
  const identityIdentifier = new IdentifierWASM(identity);
@@ -18,7 +17,7 @@ export default async function getIdentityContractNonce(grpcPool, quorumKeyProvid
18
17
  });
19
18
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
20
19
  .setGrpcRequest('getIdentityContractNonce', getIdentityContractNonceRequest)
21
- .setProofVerifier(verifyIdentityContractNonceProof, identityIdentifier.bytes(), dataContractIdentifier.bytes(), true, LATEST_PLATFORM_VERSION)
20
+ .setProofVerifier(verifyIdentityContractNonceProof, (_, platformVersion) => [identityIdentifier.bytes(), dataContractIdentifier.bytes(), true, platformVersion])
22
21
  .mapResponse(data => {
23
22
  const contractNonce = data.proved ? data.verified.contractNonce : BigInt(data.result.identityContractNonce);
24
23
  return contractNonce != null ? contractNonce & IDENTITY_CONTRACT_NONCE_VALUE_FILTER : BigInt(0);
@@ -1,7 +1,6 @@
1
1
  import { GetIdentityNonceRequest } from '../../proto/generated/platform.js';
2
2
  import { IdentifierWASM, verifyIdentityNonceProof } from 'pshenmic-dpp';
3
3
  import QueryExecutor from '../QueryExecutor.js';
4
- import { LATEST_PLATFORM_VERSION } from '../constants.js';
5
4
  const IDENTITY_NONCE_VALUE_FILTER = BigInt(0xFFFFFFFFFF);
6
5
  export default async function getIdentityNonce(grpcPool, quorumKeyProvider, identifier) {
7
6
  const id = new IdentifierWASM(identifier);
@@ -16,7 +15,7 @@ export default async function getIdentityNonce(grpcPool, quorumKeyProvider, iden
16
15
  });
17
16
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
18
17
  .setGrpcRequest('getIdentityNonce', getIdentityNonceRequest)
19
- .setProofVerifier(verifyIdentityNonceProof, id.bytes(), true, LATEST_PLATFORM_VERSION)
18
+ .setProofVerifier(verifyIdentityNonceProof, (_, platformVersion) => [id.bytes(), true, platformVersion])
20
19
  .mapResponse(data => {
21
20
  const nonce = data.proved ? data.verified.nonce : BigInt(data.result.identityNonce);
22
21
  return nonce != null ? nonce & IDENTITY_NONCE_VALUE_FILTER : BigInt(0);
@@ -1,7 +1,6 @@
1
1
  import { GetIdentityKeysRequest, KeyRequestType } from '../../proto/generated/platform.js';
2
2
  import { IdentifierWASM, IdentityPublicKeyWASM, verifyIdentityKeysByIdentifierProof } from 'pshenmic-dpp';
3
3
  import QueryExecutor from '../QueryExecutor.js';
4
- import { LATEST_PLATFORM_VERSION } from '../constants.js';
5
4
  export default async function getIdentityPublicKeys(grpcPool, quorumKeyProvider, identifier, keyIds) {
6
5
  const id = new IdentifierWASM(identifier);
7
6
  let requestType = {
@@ -30,7 +29,7 @@ export default async function getIdentityPublicKeys(grpcPool, quorumKeyProvider,
30
29
  });
31
30
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
32
31
  .setGrpcRequest('getIdentityKeys', getIdentityKeysRequest)
33
- .setProofVerifier(verifyIdentityKeysByIdentifierProof, id.bytes(), keyIds ?? null, false, false, true, null, null, LATEST_PLATFORM_VERSION)
32
+ .setProofVerifier(verifyIdentityKeysByIdentifierProof, (_, platformVersion) => [id.bytes(), keyIds ?? null, false, false, true, null, null, platformVersion])
34
33
  .mapResponse(data => {
35
34
  const keys = data.proved
36
35
  ? data.verified.identity?.loadedPublicKeys
@@ -47,7 +47,7 @@ export declare class NamesController {
47
47
  * @param identityId {IdentifierLike} identity identifier
48
48
  * @param privateKey {PrivateKeyWASM} Authentication / High private key from your identity
49
49
  * @param preorderSalt {Uint8Array=} Optional 32 bytes salt of already existing preorder document. If provided, preorder step is skipped
50
- * @param platformVersion {PlatformVersionLike=} Optional platform version used to create preorder and domain documents (latest by default)
50
+ * @param platformVersion {PlatformVersionLike=} Optional platform version used to create preorder and domain documents (protocol version of the network by default)
51
51
  *
52
52
  * @return {Promise<Uint8Array>} preorder salt (also attached as `preorderSalt` to the error if domain broadcast fails)
53
53
  */
@@ -71,7 +71,7 @@ export class NamesController {
71
71
  * @param identityId {IdentifierLike} identity identifier
72
72
  * @param privateKey {PrivateKeyWASM} Authentication / High private key from your identity
73
73
  * @param preorderSalt {Uint8Array=} Optional 32 bytes salt of already existing preorder document. If provided, preorder step is skipped
74
- * @param platformVersion {PlatformVersionLike=} Optional platform version used to create preorder and domain documents (latest by default)
74
+ * @param platformVersion {PlatformVersionLike=} Optional platform version used to create preorder and domain documents (protocol version of the network by default)
75
75
  *
76
76
  * @return {Promise<Uint8Array>} preorder salt (also attached as `preorderSalt` to the error if domain broadcast fails)
77
77
  */
@@ -8,6 +8,7 @@ import getIdentityContractNonce from '../identities/getIdentityContractNonce.js'
8
8
  import broadcast from '../stateTransitions/broadcast.js';
9
9
  import waitForStateTransitionResult from '../stateTransitions/waitForStateTransitionResult.js';
10
10
  import testNameContested from './testNameContested.js';
11
+ import getProtocolVersion from '../node/getProtocolVersion.js';
11
12
  import { DPNS_DATA_CONTRACT_ID } from '../constants.js';
12
13
  export default async function registerName(grpcPool, quorumKeyProvider, name, identity, privateKey, preorderSalt, platformVersion) {
13
14
  const [identityPublicKey] = identity.getPublicKeys().filter(identityPublicKey => identityPublicKey.getPublicKeyHash() === privateKey.getPublicKeyHash());
@@ -30,6 +31,8 @@ export default async function registerName(grpcPool, quorumKeyProvider, name, id
30
31
  ...new TextEncoder().encode(normalizedFullDomainName)
31
32
  ])));
32
33
  const identityContractNonce = await getIdentityContractNonce(grpcPool, quorumKeyProvider, identity.id, DPNS_DATA_CONTRACT_ID);
34
+ // document ids are generated differently by the protocol versions, so the documents are created with the one of the network
35
+ const documentPlatformVersion = platformVersion ?? await getProtocolVersion(grpcPool, quorumKeyProvider);
33
36
  // skip preorder if salt of existing preorder is provided
34
37
  const domainNonce = identityContractNonce + BigInt(preorderSalt == null ? 2 : 1);
35
38
  // salt is exposed in the error only once preorder exists (passed in or its broadcast accepted),
@@ -41,7 +44,7 @@ export default async function registerName(grpcPool, quorumKeyProvider, name, id
41
44
  const preorderData = {
42
45
  saltedDomainHash
43
46
  };
44
- const preorderDocument = createDocument(DPNS_DATA_CONTRACT_ID, 'preorder', preorderData, identity.id.base58(), identityContractNonce + BigInt(1), undefined, undefined, platformVersion);
47
+ const preorderDocument = createDocument(DPNS_DATA_CONTRACT_ID, 'preorder', preorderData, identity.id.base58(), identityContractNonce + BigInt(1), undefined, undefined, documentPlatformVersion);
45
48
  const preorderStateTransition = createStateTransition(preorderDocument, 'create', { identityContractNonce: identityContractNonce + BigInt(1) });
46
49
  await preorderStateTransition.sign(privateKey, identityPublicKey);
47
50
  await broadcast(grpcPool, preorderStateTransition);
@@ -63,7 +66,7 @@ export default async function registerName(grpcPool, quorumKeyProvider, name, id
63
66
  allowSubdomains: false
64
67
  }
65
68
  };
66
- const domainDocument = createDocument(DPNS_DATA_CONTRACT_ID, 'domain', domainData, identity.id.base58(), domainNonce, undefined, undefined, platformVersion);
69
+ const domainDocument = createDocument(DPNS_DATA_CONTRACT_ID, 'domain', domainData, identity.id.base58(), domainNonce, undefined, undefined, documentPlatformVersion);
67
70
  const domainStateTransition = createStateTransition(domainDocument, 'create', {
68
71
  identityContractNonce: domainNonce,
69
72
  // @ts-expect-error
@@ -2,7 +2,6 @@ import { GetEpochsInfoRequest } from '../../proto/generated/platform.js';
2
2
  import { verifyEpochsInfoProof } from 'pshenmic-dpp';
3
3
  import QueryExecutor from '../QueryExecutor.js';
4
4
  import { UInt32Value } from '../../proto/generated/google/protobuf/wrappers.js';
5
- import { LATEST_PLATFORM_VERSION } from '../constants.js';
6
5
  export default async function epochInfos(grpcPool, quorumKeyProvider, count, ascending, start) {
7
6
  const getEpochsInfoRequest = GetEpochsInfoRequest.create({
8
7
  version: {
@@ -17,7 +16,7 @@ export default async function epochInfos(grpcPool, quorumKeyProvider, count, asc
17
16
  });
18
17
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
19
18
  .setGrpcRequest('getEpochsInfo', getEpochsInfoRequest)
20
- .setProofVerifier(verifyEpochsInfoProof, ({ metadata }) => [metadata.epoch, start, count, ascending, LATEST_PLATFORM_VERSION])
19
+ .setProofVerifier(verifyEpochsInfoProof, ({ metadata }, platformVersion) => [metadata.epoch, start, count, ascending, platformVersion])
21
20
  .mapResponse(data => {
22
21
  if (data.proved) {
23
22
  return data.verified.epochsInfo.map(info => ({
@@ -1,7 +1,6 @@
1
1
  import { GetFinalizedEpochInfosRequest } from '../../proto/generated/platform.js';
2
2
  import { IdentifierWASM, verifyFinalizedEpochInfosProof } from 'pshenmic-dpp';
3
3
  import QueryExecutor from '../QueryExecutor.js';
4
- import { LATEST_PLATFORM_VERSION } from '../constants.js';
5
4
  export default async function getFinalizedEpochsInfo(grpcPool, quorumKeyProvider, startEpochIndex, startEpochIndexIncluded, endEpochIndex, endEpochIndexIncluded) {
6
5
  const getEpochsInfoRequest = GetFinalizedEpochInfosRequest.create({
7
6
  version: {
@@ -17,7 +16,7 @@ export default async function getFinalizedEpochsInfo(grpcPool, quorumKeyProvider
17
16
  });
18
17
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
19
18
  .setGrpcRequest('getFinalizedEpochInfos', getEpochsInfoRequest)
20
- .setProofVerifier(verifyFinalizedEpochInfosProof, startEpochIndex, startEpochIndexIncluded, endEpochIndex, endEpochIndexIncluded, LATEST_PLATFORM_VERSION)
19
+ .setProofVerifier(verifyFinalizedEpochInfosProof, (_, platformVersion) => [startEpochIndex, startEpochIndexIncluded, endEpochIndex, endEpochIndexIncluded, platformVersion])
21
20
  .mapResponse(data => {
22
21
  if (data.proved) {
23
22
  return data.verified.epochInfos.map(info => ({
@@ -0,0 +1,4 @@
1
+ import { GRPCPool } from '../grpcConnectionPool.js';
2
+ import { QuorumKeyProvider } from '../quorumKeyProvider.js';
3
+ import { VerifiedPathElement } from 'pshenmic-dpp';
4
+ export default function getPathElements(grpcPool: GRPCPool, quorumKeyProvider: QuorumKeyProvider, path: Uint8Array[], keys: Uint8Array[]): Promise<VerifiedPathElement[]>;
@@ -0,0 +1,27 @@
1
+ import { GetPathElementsRequest } from '../../proto/generated/platform.js';
2
+ import { verifyPathElementsProof } from 'pshenmic-dpp';
3
+ import QueryExecutor from '../QueryExecutor.js';
4
+ export default async function getPathElements(grpcPool, quorumKeyProvider, path, keys) {
5
+ const getPathElementsRequest = GetPathElementsRequest.create({
6
+ version: {
7
+ oneofKind: 'v0',
8
+ v0: {
9
+ path,
10
+ keys,
11
+ prove: true
12
+ }
13
+ }
14
+ });
15
+ return await QueryExecutor.build(grpcPool, quorumKeyProvider)
16
+ .setGrpcRequest('getPathElements', getPathElementsRequest)
17
+ // the response without proof returns serialized elements without their keys, they can't be decoded
18
+ .setRequireProof(true)
19
+ .setProofVerifier(verifyPathElementsProof, (_, platformVersion) => [path, keys, platformVersion])
20
+ .mapResponse(data => {
21
+ if (!data.proved) {
22
+ throw new Error('Path elements can only be requested with proof');
23
+ }
24
+ return data.verified.elements;
25
+ })
26
+ .execute();
27
+ }
@@ -0,0 +1,9 @@
1
+ import { PlatformVersionWASM } from 'pshenmic-dpp';
2
+ import { GRPCPool } from '../grpcConnectionPool.js';
3
+ import { QuorumKeyProvider } from '../quorumKeyProvider.js';
4
+ /**
5
+ * Returns the protocol version of the network learned from the verified responses.
6
+ * If no response was verified yet, the current epoch is requested with proof (even if proofs are disabled),
7
+ * so the protocol version is learned from its verified response
8
+ */
9
+ export default function getProtocolVersion(grpcPool: GRPCPool, quorumKeyProvider: QuorumKeyProvider): Promise<PlatformVersionWASM>;
@@ -0,0 +1,29 @@
1
+ import { verifyEpochsInfoProof } from 'pshenmic-dpp';
2
+ import { GetEpochsInfoRequest } from '../../proto/generated/platform.js';
3
+ import QueryExecutor, { getPoolProtocolVersion, getVerifiedProtocolVersion } from '../QueryExecutor.js';
4
+ /**
5
+ * Returns the protocol version of the network learned from the verified responses.
6
+ * If no response was verified yet, the current epoch is requested with proof (even if proofs are disabled),
7
+ * so the protocol version is learned from its verified response
8
+ */
9
+ export default async function getProtocolVersion(grpcPool, quorumKeyProvider) {
10
+ if (getVerifiedProtocolVersion(grpcPool) == null) {
11
+ const getEpochsInfoRequest = GetEpochsInfoRequest.create({
12
+ version: {
13
+ oneofKind: 'v0',
14
+ v0: {
15
+ count: 1,
16
+ ascending: false,
17
+ prove: true
18
+ }
19
+ }
20
+ });
21
+ await QueryExecutor.build(grpcPool, quorumKeyProvider)
22
+ .setGrpcRequest('getEpochsInfo', getEpochsInfoRequest)
23
+ .setRequireProof(true)
24
+ .setProofVerifier(verifyEpochsInfoProof, ({ metadata }, platformVersion) => [metadata.epoch, undefined, 1, false, platformVersion])
25
+ .mapResponse(() => undefined)
26
+ .execute();
27
+ }
28
+ return getPoolProtocolVersion(grpcPool);
29
+ }
@@ -4,6 +4,7 @@ import { NodeStatus } from '../../types.js';
4
4
  import { EpochInfo } from './epochInfos.js';
5
5
  import { FinalizedEpochInfo } from './finalizedEpochInfos.js';
6
6
  import { CurrentQuorumsInfo } from './getCurrentQuorumsInfo.js';
7
+ import { PlatformVersionWASM, VerifiedPathElement } from 'pshenmic-dpp';
7
8
  /**
8
9
  * Node controller for requesting information about DAPI node
9
10
  *
@@ -28,6 +29,14 @@ export declare class NodeController {
28
29
  * @return {Promise<bigint>}
29
30
  */
30
31
  totalCredits(): Promise<bigint>;
32
+ /**
33
+ * Returns the protocol version of the network, used by default to verify proofs and to create documents.
34
+ * It is learned from the verified responses, if no response was verified yet, one proved request is made
35
+ * (even if proofs are disabled)
36
+ *
37
+ * @return {Promise<PlatformVersionWASM>}
38
+ */
39
+ getProtocolVersion(): Promise<PlatformVersionWASM>;
31
40
  /**
32
41
  * Retrieves an info about epochs
33
42
  * Includes information about first block height, time, fee multiplier, number
@@ -49,4 +58,15 @@ export declare class NodeController {
49
58
  * @return {Promise<CurrentQuorumsInfo>}
50
59
  */
51
60
  getCurrentQuorumsInfo(): Promise<CurrentQuorumsInfo>;
61
+ /**
62
+ * Retrieves GroveDB elements stored under the given keys of a path in the platform state
63
+ * Returns the found elements in key order, keys with nothing stored under them are omitted (their absence is still proven).
64
+ * Always requested with proof, even if proofs are disabled
65
+ *
66
+ * @param path {Uint8Array[]} - path of the subtree, as a list of path segments
67
+ * @param keys {Uint8Array[]} - keys of the elements in the subtree
68
+ *
69
+ * @return {Promise<VerifiedPathElement[]>}
70
+ */
71
+ getPathElements(path: Uint8Array[], keys: Uint8Array[]): Promise<VerifiedPathElement[]>;
52
72
  }
package/src/node/index.js CHANGED
@@ -3,6 +3,8 @@ import getEpochsInfo from './epochInfos.js';
3
3
  import getFinalizedEpochsInfo from './finalizedEpochInfos.js';
4
4
  import getTotalCredits from './totalCredits.js';
5
5
  import getCurrentQuorumsInfo from './getCurrentQuorumsInfo.js';
6
+ import getProtocolVersion from './getProtocolVersion.js';
7
+ import getPathElements from './getPathElements.js';
6
8
  /**
7
9
  * Node controller for requesting information about DAPI node
8
10
  *
@@ -34,6 +36,16 @@ export class NodeController {
34
36
  async totalCredits() {
35
37
  return await getTotalCredits(this.grpcPool, this.quorumKeyProvider);
36
38
  }
39
+ /**
40
+ * Returns the protocol version of the network, used by default to verify proofs and to create documents.
41
+ * It is learned from the verified responses, if no response was verified yet, one proved request is made
42
+ * (even if proofs are disabled)
43
+ *
44
+ * @return {Promise<PlatformVersionWASM>}
45
+ */
46
+ async getProtocolVersion() {
47
+ return await getProtocolVersion(this.grpcPool, this.quorumKeyProvider);
48
+ }
37
49
  /**
38
50
  * Retrieves an info about epochs
39
51
  * Includes information about first block height, time, fee multiplier, number
@@ -61,4 +73,17 @@ export class NodeController {
61
73
  async getCurrentQuorumsInfo() {
62
74
  return await getCurrentQuorumsInfo(this.grpcPool);
63
75
  }
76
+ /**
77
+ * Retrieves GroveDB elements stored under the given keys of a path in the platform state
78
+ * Returns the found elements in key order, keys with nothing stored under them are omitted (their absence is still proven).
79
+ * Always requested with proof, even if proofs are disabled
80
+ *
81
+ * @param path {Uint8Array[]} - path of the subtree, as a list of path segments
82
+ * @param keys {Uint8Array[]} - keys of the elements in the subtree
83
+ *
84
+ * @return {Promise<VerifiedPathElement[]>}
85
+ */
86
+ async getPathElements(path, keys) {
87
+ return await getPathElements(this.grpcPool, this.quorumKeyProvider, path, keys);
88
+ }
64
89
  }
@@ -1,5 +1,5 @@
1
1
  import { GetTotalCreditsInPlatformRequest } from '../../proto/generated/platform.js';
2
- import { HALVING_INTERVAL, LATEST_PLATFORM_VERSION, MAINNET_ACTIVATION_HEIGHT, TESTNET_ACTIVATION_HEIGHT } from '../constants.js';
2
+ import { HALVING_INTERVAL, MAINNET_ACTIVATION_HEIGHT, TESTNET_ACTIVATION_HEIGHT } from '../constants.js';
3
3
  import { verifyTotalCreditsProof } from 'pshenmic-dpp';
4
4
  import QueryExecutor from '../QueryExecutor.js';
5
5
  export default async function totalCredits(grpcPool, quorumKeyProvider) {
@@ -11,9 +11,9 @@ export default async function totalCredits(grpcPool, quorumKeyProvider) {
11
11
  });
12
12
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
13
13
  .setGrpcRequest('getTotalCreditsInPlatform', getTotalCreditsInPlatformRequest)
14
- .setProofVerifier(verifyTotalCreditsProof, ({ metadata }) => {
14
+ .setProofVerifier(verifyTotalCreditsProof, ({ metadata }, platformVersion) => {
15
15
  const activationHeight = grpcPool.network === 'testnet' ? TESTNET_ACTIVATION_HEIGHT : MAINNET_ACTIVATION_HEIGHT;
16
- return [HALVING_INTERVAL, activationHeight, metadata.coreChainLockedHeight, LATEST_PLATFORM_VERSION];
16
+ return [HALVING_INTERVAL, activationHeight, metadata.coreChainLockedHeight, platformVersion];
17
17
  })
18
18
  .mapResponse(data => data.proved ? data.verified.totalCredits : BigInt(data.result.credits))
19
19
  .execute();
@@ -1,6 +1,5 @@
1
1
  import { PlatformAddressWASM, verifyPlatformAddressInfo } from 'pshenmic-dpp';
2
2
  import { GetAddressInfoRequest } from '../../proto/generated/platform.js';
3
- import { LATEST_PLATFORM_VERSION } from '../constants.js';
4
3
  import QueryExecutor from '../QueryExecutor.js';
5
4
  export async function getAddressInfo(grpcPool, quorumKeyProvider, platformAddress) {
6
5
  const platformAddressWASM = new PlatformAddressWASM(platformAddress);
@@ -15,7 +14,7 @@ export async function getAddressInfo(grpcPool, quorumKeyProvider, platformAddres
15
14
  });
16
15
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
17
16
  .setGrpcRequest('getAddressInfo', getAddressInfoRequest)
18
- .setProofVerifier(verifyPlatformAddressInfo, platformAddressWASM, true, LATEST_PLATFORM_VERSION)
17
+ .setProofVerifier(verifyPlatformAddressInfo, (_, platformVersion) => [platformAddressWASM, true, platformVersion])
19
18
  .mapResponse(data => {
20
19
  const balanceAndNonce = data.proved ? data.verified : data.result.addressInfoEntry.balanceAndNonce;
21
20
  if (balanceAndNonce?.nonce == null || balanceAndNonce.balance == null) {
@@ -1,6 +1,5 @@
1
1
  import { verifyAddressesBranchState } from 'pshenmic-dpp';
2
2
  import { GetAddressesBranchStateRequest, Proof, ResponseMetadata } from '../../proto/generated/platform.js';
3
- import { LATEST_PLATFORM_VERSION } from '../constants.js';
4
3
  import QueryExecutor from '../QueryExecutor.js';
5
4
  export async function getAddressesBranchState(grpcPool, quorumKeyProvider, key, depth, checkpointHeight, expectedRootHash) {
6
5
  const getAddressesBranchStateRequest = GetAddressesBranchStateRequest.create({
@@ -23,7 +22,7 @@ export async function getAddressesBranchState(grpcPool, quorumKeyProvider, key,
23
22
  }
24
23
  return { proof: Proof.create({ grovedbProof: version.v0.merkProof }), metadata: ResponseMetadata.create() };
25
24
  })
26
- .setProofVerifier(verifyAddressesBranchState, key, depth, expectedRootHash, LATEST_PLATFORM_VERSION)
25
+ .setProofVerifier(verifyAddressesBranchState, (_, platformVersion) => [key, depth, expectedRootHash, platformVersion])
27
26
  .mapResponse(data => {
28
27
  if (!data.proved) {
29
28
  throw new Error('Addresses branch state can only be requested with proof');
@@ -1,6 +1,5 @@
1
1
  import { PlatformAddressWASM, verifyPlatformAddressesInfos } from 'pshenmic-dpp';
2
2
  import { GetAddressesInfosRequest } from '../../proto/generated/platform.js';
3
- import { LATEST_PLATFORM_VERSION } from '../constants.js';
4
3
  import QueryExecutor from '../QueryExecutor.js';
5
4
  export async function getAddressesInfos(grpcPool, quorumKeyProvider, platformAddresses) {
6
5
  const platformAddressesWASM = platformAddresses.map(addr => new PlatformAddressWASM(addr));
@@ -15,7 +14,7 @@ export async function getAddressesInfos(grpcPool, quorumKeyProvider, platformAdd
15
14
  });
16
15
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
17
16
  .setGrpcRequest('getAddressesInfos', getAddressInfoRequest)
18
- .setProofVerifier(verifyPlatformAddressesInfos, platformAddressesWASM, true, LATEST_PLATFORM_VERSION)
17
+ .setProofVerifier(verifyPlatformAddressesInfos, (_, platformVersion) => [platformAddressesWASM, true, platformVersion])
19
18
  .mapResponse(data => {
20
19
  const infos = data.proved
21
20
  ? data.verified.infos
@@ -1,6 +1,5 @@
1
1
  import { verifyAddressesTrunkState } from 'pshenmic-dpp';
2
2
  import { GetAddressesTrunkStateRequest } from '../../proto/generated/platform.js';
3
- import { LATEST_PLATFORM_VERSION } from '../constants.js';
4
3
  import QueryExecutor from '../QueryExecutor.js';
5
4
  export async function getAddressesTrunkState(grpcPool, quorumKeyProvider) {
6
5
  const getAddressesTrunkStateRequest = GetAddressesTrunkStateRequest.create({
@@ -24,7 +23,7 @@ export async function getAddressesTrunkState(grpcPool, quorumKeyProvider) {
24
23
  }
25
24
  return { proof, metadata };
26
25
  })
27
- .setProofVerifier(verifyAddressesTrunkState, LATEST_PLATFORM_VERSION)
26
+ .setProofVerifier(verifyAddressesTrunkState, (_, platformVersion) => [platformVersion])
28
27
  .mapResponse(data => {
29
28
  if (!data.proved) {
30
29
  throw new Error('Addresses trunk state can only be requested with proof');
@@ -1,6 +1,6 @@
1
1
  import { verifyRecentAddressBalanceChanges, PlatformAddressWASM } from 'pshenmic-dpp';
2
2
  import { GetRecentAddressBalanceChangesRequest } from '../../proto/generated/platform.js';
3
- import { LATEST_PLATFORM_VERSION, RECENT_ADDRESS_BALANCE_CHANGES_LIMIT } from '../constants.js';
3
+ import { RECENT_ADDRESS_BALANCE_CHANGES_LIMIT } from '../constants.js';
4
4
  import QueryExecutor from '../QueryExecutor.js';
5
5
  export async function getRecentAddressBalanceChanges(grpcPool, quorumKeyProvider, startHeight, startHeightExclusive = false) {
6
6
  const getRecentAddressBalanceChangesRequest = GetRecentAddressBalanceChangesRequest.create({
@@ -15,7 +15,7 @@ export async function getRecentAddressBalanceChanges(grpcPool, quorumKeyProvider
15
15
  });
16
16
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
17
17
  .setGrpcRequest('getRecentAddressBalanceChanges', getRecentAddressBalanceChangesRequest)
18
- .setProofVerifier(verifyRecentAddressBalanceChanges, startHeight, startHeightExclusive, RECENT_ADDRESS_BALANCE_CHANGES_LIMIT, true, LATEST_PLATFORM_VERSION)
18
+ .setProofVerifier(verifyRecentAddressBalanceChanges, (_, platformVersion) => [startHeight, startHeightExclusive, RECENT_ADDRESS_BALANCE_CHANGES_LIMIT, true, platformVersion])
19
19
  .mapResponse(data => {
20
20
  if (data.proved) {
21
21
  return data.verified.blocks;
@@ -1,6 +1,6 @@
1
1
  import { verifyRecentCompactedAddressBalanceChanges, PlatformAddressWASM } from 'pshenmic-dpp';
2
2
  import { GetRecentCompactedAddressBalanceChangesRequest } from '../../proto/generated/platform.js';
3
- import { LATEST_PLATFORM_VERSION, RECENT_COMPACTED_ADDRESS_BALANCE_CHANGES_LIMIT } from '../constants.js';
3
+ import { RECENT_COMPACTED_ADDRESS_BALANCE_CHANGES_LIMIT } from '../constants.js';
4
4
  import QueryExecutor from '../QueryExecutor.js';
5
5
  export async function getRecentCompactedAddressBalanceChanges(grpcPool, quorumKeyProvider, startBlockHeight) {
6
6
  const getRecentCompactedAddressBalanceChangesRequest = GetRecentCompactedAddressBalanceChangesRequest.create({
@@ -14,7 +14,7 @@ export async function getRecentCompactedAddressBalanceChanges(grpcPool, quorumKe
14
14
  });
15
15
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
16
16
  .setGrpcRequest('getRecentCompactedAddressBalanceChanges', getRecentCompactedAddressBalanceChangesRequest)
17
- .setProofVerifier(verifyRecentCompactedAddressBalanceChanges, startBlockHeight, RECENT_COMPACTED_ADDRESS_BALANCE_CHANGES_LIMIT, LATEST_PLATFORM_VERSION)
17
+ .setProofVerifier(verifyRecentCompactedAddressBalanceChanges, (_, platformVersion) => [startBlockHeight, RECENT_COMPACTED_ADDRESS_BALANCE_CHANGES_LIMIT, platformVersion])
18
18
  .mapResponse(data => {
19
19
  if (data.proved) {
20
20
  return data.verified.ranges;
@@ -1,6 +1,5 @@
1
1
  import { GetMostRecentShieldedAnchorRequest } from '../../proto/generated/platform.js';
2
2
  import { IdentifierWASM, verifyMostRecentShieldedAnchorProof } from 'pshenmic-dpp';
3
- import { SHIELDED_PLATFORM_VERSION } from '../constants.js';
4
3
  import QueryExecutor from '../QueryExecutor.js';
5
4
  export default async function getMostRecentShieldedAnchor(grpcPool, quorumKeyProvider, tokenIdentifier) {
6
5
  const tokenId = tokenIdentifier != null ? new IdentifierWASM(tokenIdentifier) : undefined;
@@ -15,7 +14,7 @@ export default async function getMostRecentShieldedAnchor(grpcPool, quorumKeyPro
15
14
  });
16
15
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
17
16
  .setGrpcRequest('getMostRecentShieldedAnchor', getMostRecentShieldedAnchorRequest)
18
- .setProofVerifier(verifyMostRecentShieldedAnchorProof, true, SHIELDED_PLATFORM_VERSION, tokenId)
17
+ .setProofVerifier(verifyMostRecentShieldedAnchorProof, (_, platformVersion) => [true, platformVersion, tokenId])
19
18
  .mapResponse(data => data.proved ? data.verified.anchor : data.result.anchor)
20
19
  .execute();
21
20
  }
@@ -1,6 +1,5 @@
1
1
  import { GetShieldedAnchorsRequest } from '../../proto/generated/platform.js';
2
2
  import { IdentifierWASM, verifyShieldedAnchorsProof } from 'pshenmic-dpp';
3
- import { SHIELDED_PLATFORM_VERSION } from '../constants.js';
4
3
  import QueryExecutor from '../QueryExecutor.js';
5
4
  export default async function getShieldedAnchors(grpcPool, quorumKeyProvider, tokenIdentifier) {
6
5
  const tokenId = tokenIdentifier != null ? new IdentifierWASM(tokenIdentifier) : undefined;
@@ -15,7 +14,7 @@ export default async function getShieldedAnchors(grpcPool, quorumKeyProvider, to
15
14
  });
16
15
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
17
16
  .setGrpcRequest('getShieldedAnchors', getShieldedAnchorsRequest)
18
- .setProofVerifier(verifyShieldedAnchorsProof, true, SHIELDED_PLATFORM_VERSION, tokenId)
17
+ .setProofVerifier(verifyShieldedAnchorsProof, (_, platformVersion) => [true, platformVersion, tokenId])
19
18
  .mapResponse(data => data.proved ? data.verified.anchors : data.result.anchors.anchors)
20
19
  .execute();
21
20
  }
@@ -1,6 +1,6 @@
1
1
  import { GetShieldedEncryptedNotesRequest } from '../../proto/generated/platform.js';
2
2
  import { IdentifierWASM, verifyShieldedEncryptedNotesProof } from 'pshenmic-dpp';
3
- import { SHIELDED_PLATFORM_VERSION, SHIELDED_MAX_NOTES_PER_QUERY } from '../constants.js';
3
+ import { SHIELDED_MAX_NOTES_PER_QUERY } from '../constants.js';
4
4
  import QueryExecutor from '../QueryExecutor.js';
5
5
  export default async function getShieldedEncryptedNotes(grpcPool, quorumKeyProvider, startIndex, count, tokenIdentifier) {
6
6
  const tokenId = tokenIdentifier != null ? new IdentifierWASM(tokenIdentifier) : undefined;
@@ -17,7 +17,7 @@ export default async function getShieldedEncryptedNotes(grpcPool, quorumKeyProvi
17
17
  });
18
18
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
19
19
  .setGrpcRequest('getShieldedEncryptedNotes', getShieldedEncryptedNotesRequest)
20
- .setProofVerifier(verifyShieldedEncryptedNotesProof, startIndex, count, SHIELDED_MAX_NOTES_PER_QUERY, true, SHIELDED_PLATFORM_VERSION, tokenId)
20
+ .setProofVerifier(verifyShieldedEncryptedNotesProof, (_, platformVersion) => [startIndex, count, SHIELDED_MAX_NOTES_PER_QUERY, true, platformVersion, tokenId])
21
21
  .mapResponse(data => {
22
22
  const notes = data.proved ? data.verified.notes : data.result.encryptedNotes.entries;
23
23
  return notes.map(note => ({
@@ -1,6 +1,5 @@
1
1
  import { GetShieldedNotesCountRequest } from '../../proto/generated/platform.js';
2
2
  import { IdentifierWASM, verifyShieldedNotesCountProof } from 'pshenmic-dpp';
3
- import { SHIELDED_PLATFORM_VERSION } from '../constants.js';
4
3
  import QueryExecutor from '../QueryExecutor.js';
5
4
  export default async function getShieldedNotesCount(grpcPool, quorumKeyProvider, tokenIdentifier) {
6
5
  const tokenId = tokenIdentifier != null ? new IdentifierWASM(tokenIdentifier) : undefined;
@@ -15,7 +14,7 @@ export default async function getShieldedNotesCount(grpcPool, quorumKeyProvider,
15
14
  });
16
15
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
17
16
  .setGrpcRequest('getShieldedNotesCount', getShieldedNotesCountRequest)
18
- .setProofVerifier(verifyShieldedNotesCountProof, true, SHIELDED_PLATFORM_VERSION, tokenId)
17
+ .setProofVerifier(verifyShieldedNotesCountProof, (_, platformVersion) => [true, platformVersion, tokenId])
19
18
  .mapResponse(data => data.proved ? data.verified.count : BigInt(data.result.totalNotesCount))
20
19
  .execute();
21
20
  }
@@ -1,6 +1,5 @@
1
1
  import { GetShieldedNullifiersRequest } from '../../proto/generated/platform.js';
2
2
  import { IdentifierWASM, verifyShieldedNullifiersProof } from 'pshenmic-dpp';
3
- import { SHIELDED_PLATFORM_VERSION } from '../constants.js';
4
3
  import QueryExecutor from '../QueryExecutor.js';
5
4
  export default async function getShieldedNullifiers(grpcPool, quorumKeyProvider, nullifiers, tokenIdentifier) {
6
5
  const tokenId = tokenIdentifier != null ? new IdentifierWASM(tokenIdentifier) : undefined;
@@ -16,7 +15,7 @@ export default async function getShieldedNullifiers(grpcPool, quorumKeyProvider,
16
15
  });
17
16
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
18
17
  .setGrpcRequest('getShieldedNullifiers', getShieldedNullifiersRequest)
19
- .setProofVerifier(verifyShieldedNullifiersProof, nullifiers, true, SHIELDED_PLATFORM_VERSION, tokenId)
18
+ .setProofVerifier(verifyShieldedNullifiersProof, (_, platformVersion) => [nullifiers, true, platformVersion, tokenId])
20
19
  .mapResponse(data => {
21
20
  const nullifiersStatuses = data.proved ? data.verified.nullifiers : data.result.nullifierStatuses.entries;
22
21
  return nullifiersStatuses.map(entry => ({
@@ -1,7 +1,6 @@
1
1
  import { GetShieldedPoolStateRequest } from '../../proto/generated/platform.js';
2
2
  import QueryExecutor from '../QueryExecutor.js';
3
3
  import { IdentifierWASM, verifyShieldedPoolStateProof } from 'pshenmic-dpp';
4
- import { SHIELDED_PLATFORM_VERSION } from '../constants.js';
5
4
  export default async function getShieldedPoolState(grpcPool, quorumKeyProvider, tokenIdentifier) {
6
5
  const tokenId = tokenIdentifier != null ? new IdentifierWASM(tokenIdentifier) : undefined;
7
6
  const getShieldedPoolStateRequest = GetShieldedPoolStateRequest.create({
@@ -15,7 +14,7 @@ export default async function getShieldedPoolState(grpcPool, quorumKeyProvider,
15
14
  });
16
15
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
17
16
  .setGrpcRequest('getShieldedPoolState', getShieldedPoolStateRequest)
18
- .setProofVerifier(verifyShieldedPoolStateProof, true, SHIELDED_PLATFORM_VERSION, tokenId)
17
+ .setProofVerifier(verifyShieldedPoolStateProof, (_, platformVersion) => [true, platformVersion, tokenId])
19
18
  .mapResponse(data => data.proved ? data.verified.totalBalance : BigInt(data.result.totalBalance))
20
19
  .execute();
21
20
  }
@@ -3,7 +3,7 @@ import hexToBytes from '../utils/hexToBytes.js';
3
3
  import { WaitForStateTransitionResultRequest } from '../../proto/generated/platform.js';
4
4
  import QueryExecutor, { getResponseProof } from '../QueryExecutor.js';
5
5
  import { base64 } from '@scure/base';
6
- import { LATEST_PLATFORM_VERSION } from '../constants.js';
6
+ import { LATEST_PLATFORM_VERSION, WITHDRAWALS_DATA_CONTRACT_ID } from '../constants.js';
7
7
  import getDataContractByIdentifier from '../dataContracts/getDataContractByIdentifier.js';
8
8
  function toStateTransitionError(txHash, { code, message, data }) {
9
9
  return new Error(`State transition ${txHash} failed to execute with code ${String(code)}, message: ${String(message)}, data: ${base64.encode(data)}`);
@@ -16,8 +16,7 @@ export default async function waitForStateTransitionResult(grpcPool, quorumKeyPr
16
16
  v0: {
17
17
  stateTransitionHash: hexToBytes(txHash),
18
18
  prove: true,
19
- // without proof the owner balance is returned only if requested
20
- requestUserBalance: grpcPool.proofs === false
19
+ requestUserBalance: false
21
20
  }
22
21
  }
23
22
  });
@@ -32,8 +31,14 @@ export default async function waitForStateTransitionResult(grpcPool, quorumKeyPr
32
31
  const masternodeVote = MasternodeVoteTransitionWASM.fromStateTransition(stateTransition);
33
32
  knownContracts.push(await getDataContractByIdentifier(grpcPool, quorumKeyProvider, masternodeVote.vote.votePoll.contractId));
34
33
  }
34
+ // withdrawal documents of the shielded pool are created in the withdrawals system contract
35
+ if (stateTransition.getActionType() === 'SHIELDED_WITHDRAWAL') {
36
+ knownContracts.push(await getDataContractByIdentifier(grpcPool, quorumKeyProvider, WITHDRAWALS_DATA_CONTRACT_ID));
37
+ }
35
38
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
36
39
  .setGrpcRequest('waitForStateTransitionResult', waitForStateTransitionResultRequest)
40
+ // the result is always verified, also if proofs are disabled in the pool
41
+ .setRequireProof(true)
37
42
  .mapProof(response => {
38
43
  const { version } = response;
39
44
  if (version.oneofKind !== 'v0') {
@@ -56,16 +61,13 @@ export default async function waitForStateTransitionResult(grpcPool, quorumKeyPr
56
61
  return [stateTransition, blockInfo, knownContracts, Math.min(metadata.protocolVersion, LATEST_PLATFORM_VERSION)];
57
62
  })
58
63
  .mapResponse(data => {
59
- if (data.proved) {
60
- if (data.verified.result == null) {
61
- throw new Error('State transition result was null');
62
- }
63
- return data.verified.ownerBalance;
64
+ if (!data.proved) {
65
+ throw new Error('State transition result must be proved');
64
66
  }
65
- if (data.result.oneofKind === 'error') {
66
- throw toStateTransitionError(txHash, data.result.error);
67
+ if (data.verified.result == null) {
68
+ throw new Error('State transition result was null');
67
69
  }
68
- return BigInt(data.result.successWithOwnerBalance.ownerBalance);
70
+ return data.verified.ownerBalance;
69
71
  })
70
72
  .execute();
71
73
  }
@@ -1,7 +1,6 @@
1
1
  import { GetIdentitiesTokenBalancesRequest } from '../../proto/generated/platform.js';
2
2
  import { IdentifierWASM, verifyTokenBalancesForIdentitiesProof } from 'pshenmic-dpp';
3
3
  import QueryExecutor from '../QueryExecutor.js';
4
- import { LATEST_PLATFORM_VERSION } from '../constants.js';
5
4
  export default async function getIdentitiesTokenBalances(grpcPool, quorumKeyProvider, identifiers, tokenIdentifier) {
6
5
  const ids = identifiers.map(identifier => new IdentifierWASM(identifier));
7
6
  const tokenId = new IdentifierWASM(tokenIdentifier);
@@ -17,7 +16,7 @@ export default async function getIdentitiesTokenBalances(grpcPool, quorumKeyProv
17
16
  });
18
17
  return await QueryExecutor.build(grpcPool, quorumKeyProvider)
19
18
  .setGrpcRequest('getIdentitiesTokenBalances', getIdentitiesTokenBalancesRequest)
20
- .setProofVerifier(verifyTokenBalancesForIdentitiesProof, tokenId, true, ids, LATEST_PLATFORM_VERSION)
19
+ .setProofVerifier(verifyTokenBalancesForIdentitiesProof, (_, platformVersion) => [tokenId, true, ids, platformVersion])
21
20
  .mapResponse(data => {
22
21
  const balances = data.proved
23
22
  ? data.verified.balances