File tree Expand file tree Collapse file tree 2 files changed +48
-1
lines changed
packages/sdk-ts/src/client/chain Expand file tree Collapse file tree 2 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -329,4 +329,36 @@ export class ChainGrpcExchangeApi extends BaseGrpcConsumer {
329329 } )
330330 }
331331 }
332+
333+ async fetchActiveStakeGrant ( account : string ) {
334+ const request =
335+ InjectiveExchangeV1Beta1Query . QueryActiveStakeGrantRequest . create ( )
336+
337+ request . grantee = account
338+
339+ try {
340+ const response =
341+ await this . retry < InjectiveExchangeV1Beta1Query . QueryActiveStakeGrantResponse > (
342+ ( ) => this . client . ActiveStakeGrant ( request , this . metadata ) ,
343+ )
344+
345+ return ChainGrpcExchangeTransformer . activeStakeGrantResponseToActiveStakeGrant (
346+ response ,
347+ )
348+ } catch ( e : any ) {
349+ if ( e instanceof InjectiveExchangeV1Beta1Query . GrpcWebError ) {
350+ throw new GrpcUnaryRequestException ( new Error ( e . toString ( ) ) , {
351+ code : e . code ,
352+ context : 'ActiveStakeGrant' ,
353+ contextModule : this . module ,
354+ } )
355+ }
356+
357+ throw new GrpcUnaryRequestException ( e as Error , {
358+ code : UnspecifiedErrorCode ,
359+ context : 'ActiveStakeGrant' ,
360+ contextModule : ChainModule . Exchange ,
361+ } )
362+ }
363+ }
332364}
Original file line number Diff line number Diff line change 1- import { InjectiveExchangeV1Beta1Query } from '@injectivelabs/core-proto-ts'
1+ import {
2+ InjectiveExchangeV1Beta1Query ,
3+ InjectiveExchangeV1Beta1Exchange ,
4+ } from '@injectivelabs/core-proto-ts'
25import { AtomicMarketOrderAccessLevel } from '@injectivelabs/core-proto-ts/cjs/injective/exchange/v1beta1/exchange.js'
36import {
47 IsOptedOutOfRewards ,
@@ -261,4 +264,16 @@ export class ChainGrpcExchangeTransformer {
261264 isOptedOut : response . isOptedOut ,
262265 }
263266 }
267+
268+ static activeStakeGrantResponseToActiveStakeGrant (
269+ response : InjectiveExchangeV1Beta1Query . QueryActiveStakeGrantResponse ,
270+ ) : {
271+ grant : InjectiveExchangeV1Beta1Exchange . ActiveGrant
272+ effectiveGrant : InjectiveExchangeV1Beta1Exchange . EffectiveGrant
273+ } {
274+ return {
275+ grant : response . grant ! ,
276+ effectiveGrant : response . effectiveGrant ! ,
277+ }
278+ }
264279}
You can’t perform that action at this time.
0 commit comments