@dashevo/dapi-grpc 1.3.0-dev.5 → 1.3.0-dev.6

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/Cargo.toml CHANGED
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  name = "dapi-grpc"
3
3
  description = "GRPC client for Dash Platform"
4
- version = "1.3.0-dev.5"
4
+ version = "1.3.0-dev.6"
5
5
  authors = [
6
6
  "Samuel Westrich <sam@dash.org>",
7
7
  "Igor Markin <igor.markin@dash.org>",
@@ -62,6 +62,8 @@ const {
62
62
  GetTotalCreditsInPlatformResponse: PBJSGetTotalCreditsInPlatformResponse,
63
63
  GetStatusRequest: PBJSGetStatusRequest,
64
64
  GetStatusResponse: PBJSGetStatusResponse,
65
+ GetIdentityBalanceRequest: PBJSGetIdentityBalanceRequest,
66
+ GetIdentityBalanceResponse: PBJSGetIdentityBalanceResponse,
65
67
  },
66
68
  },
67
69
  },
@@ -88,6 +90,7 @@ const {
88
90
  GetIdentityKeysResponse: ProtocGetIdentityKeysResponse,
89
91
  GetTotalCreditsInPlatformResponse: ProtocGetTotalCreditsInPlatformResponse,
90
92
  GetStatusResponse: ProtocGetStatusResponse,
93
+ GetIdentityBalanceResponse: ProtocGetIdentityBalanceResponse,
91
94
  } = require('./platform_protoc');
92
95
 
93
96
  const getPlatformDefinition = require('../../../../lib/getPlatformDefinition');
@@ -186,6 +189,10 @@ class PlatformPromiseClient {
186
189
  this.client.getStatus.bind(this.client),
187
190
  );
188
191
 
192
+ this.client.getIdentityBalance = promisify(
193
+ this.client.getIdentityBalance.bind(this.client),
194
+ );
195
+
189
196
  this.protocolVersion = undefined;
190
197
  }
191
198
 
@@ -762,6 +769,35 @@ class PlatformPromiseClient {
762
769
  );
763
770
  }
764
771
 
772
+ getIdentityBalance(
773
+ getIdentityBalanceRequest,
774
+ metadata = {},
775
+ options = {},
776
+ ) {
777
+ if (!isObject(metadata)) {
778
+ throw new Error('metadata must be an object');
779
+ }
780
+
781
+ return this.client.getIdentityBalance(
782
+ getIdentityBalanceRequest,
783
+ convertObjectToMetadata(metadata),
784
+ {
785
+ interceptors: [
786
+ jsonToProtobufInterceptorFactory(
787
+ jsonToProtobufFactory(
788
+ ProtocGetIdentityBalanceResponse,
789
+ PBJSGetIdentityBalanceResponse,
790
+ ),
791
+ protobufToJsonFactory(
792
+ PBJSGetIdentityBalanceRequest,
793
+ ),
794
+ ),
795
+ ],
796
+ ...options,
797
+ },
798
+ );
799
+ }
800
+
765
801
  /**
766
802
  * @param {string} protocolVersion
767
803
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/dapi-grpc",
3
- "version": "1.3.0-dev.5",
3
+ "version": "1.3.0-dev.6",
4
4
  "description": "DAPI GRPC definition file and generated clients",
5
5
  "browser": "browser.js",
6
6
  "main": "node.js",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://github.com/dashevo/dapi-grpc#readme",
47
47
  "dependencies": {
48
- "@dashevo/grpc-common": "1.3.0-dev.5",
48
+ "@dashevo/grpc-common": "1.3.0-dev.6",
49
49
  "@dashevo/protobufjs": "6.10.5",
50
50
  "@grpc/grpc-js": "1.4.4",
51
51
  "@improbable-eng/grpc-web": "^0.15.0",
@@ -22,6 +22,7 @@ describe('PlatformPromiseClient', () => {
22
22
  getIdentityContractNonce: this.sinon.stub().resolves(response),
23
23
  getIdentityNonce: this.sinon.stub().resolves(response),
24
24
  getIdentityKeys: this.sinon.stub().resolves(response),
25
+ getIdentityBalance: this.sinon.stub().resolves(response),
25
26
  };
26
27
  });
27
28
 
@@ -170,4 +171,14 @@ describe('PlatformPromiseClient', () => {
170
171
  .to.be.calledOnceWith(request);
171
172
  });
172
173
  });
174
+
175
+ describe('#getIdentityBalance', () => {
176
+ it('should get identity balance', async () => {
177
+ const result = await platformPromiseClient.getIdentityBalance(request);
178
+
179
+ expect(result).to.equal(response);
180
+ expect(platformPromiseClient.client.getIdentityBalance)
181
+ .to.be.calledOnceWith(request);
182
+ });
183
+ });
173
184
  });