Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

feat: implement getConsensusParams method #126

Merged
merged 4 commits into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions clients/platform/v0/nodejs/PlatformPromiseClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const {
GetIdentityIdsByPublicKeyHashesResponse: PBJSGetIdentityIdsByPublicKeyHashesResponse,
WaitForStateTransitionResultRequest: PBJSWaitForStateTransitionResultRequest,
WaitForStateTransitionResultResponse: PBJSWaitForStateTransitionResultResponse,
GetConsensusParamsRequest: PBJSGetConsensusParamsRequest,
GetConsensusParamsResponse: PBJSGetConsensusParamsResponse,
},
},
},
Expand All @@ -52,6 +54,7 @@ const {
GetIdentitiesByPublicKeyHashesResponse: ProtocGetIdentitiesByPublicKeyHashesResponse,
GetIdentityIdsByPublicKeyHashesResponse: ProtocGetIdentityIdsByPublicKeyHashesResponse,
WaitForStateTransitionResultResponse: ProtocWaitForStateTransitionResultResponse,
GetConsensusParamsResponse: ProtocGetConsensusParamsResponse,
} = require('./platform_protoc');

const getPlatformDefinition = require('../../../../lib/getPlatformDefinition');
Expand Down Expand Up @@ -98,6 +101,10 @@ class PlatformPromiseClient {
this.client.waitForStateTransitionResult.bind(this.client),
);

this.client.getConsensusParams = promisify(
this.client.getConsensusParams.bind(this.client),
);

this.protocolVersion = undefined;
}

Expand Down Expand Up @@ -326,6 +333,39 @@ class PlatformPromiseClient {
);
}

/**
* @param {!GetConsensusParamsRequest} getConsensusParamsRequest
* @param {?Object<string, string>} metadata
* @param {CallOptions} [options={}]
* @returns {Promise<!GetConsensusParamsResponse>}
*/
getConsensusParams(
getConsensusParamsRequest, metadata = {}, options = {},
) {
if (!isObject(metadata)) {
throw new Error('metadata must be an object');
}

return this.client.getConsensusParams(
getConsensusParamsRequest,
convertObjectToMetadata(metadata),
{
interceptors: [
jsonToProtobufInterceptorFactory(
jsonToProtobufFactory(
ProtocGetConsensusParamsResponse,
PBJSGetConsensusParamsResponse,
),
protobufToJsonFactory(
PBJSGetConsensusParamsRequest,
),
),
],
...options,
},
);
}

/**
* @param {string} protocolVersion
*/
Expand Down
63 changes: 63 additions & 0 deletions clients/platform/v0/objective-c/Platform.pbobjc.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

204 changes: 204 additions & 0 deletions clients/platform/v0/objective-c/Platform.pbobjc.m

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading