File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 352352 "@injectivelabs/mito-proto-ts-v2" : " 1.17.3" ,
353353 "@injectivelabs/networks" : " workspace:*" ,
354354 "@injectivelabs/olp-proto-ts-v2" : " 1.17.6" ,
355- "@injectivelabs/tc-abacus-proto-ts-v2" : " 1.18.1 " ,
355+ "@injectivelabs/tc-abacus-proto-ts-v2" : " 1.18.2 " ,
356356 "@injectivelabs/ts-types" : " workspace:*" ,
357357 "@injectivelabs/utils" : " workspace:*" ,
358358 "@noble/curves" : " catalog:" ,
Original file line number Diff line number Diff line change @@ -8,6 +8,25 @@ const tcAbacusGrpcApi = new TcAbacusGrpcApi(
88)
99
1010describe ( 'TcAbacusGrpcApi' , ( ) => {
11+ test ( 'fetchCurrentEpoch' , async ( ) => {
12+ try {
13+ const response = await tcAbacusGrpcApi . fetchCurrentEpoch ( )
14+
15+ expect ( response ) . toBeDefined ( )
16+ expect ( response ) . toEqual (
17+ expect . objectContaining <
18+ ReturnType <
19+ typeof TcAbacusGrpcTransformer . grpcCurrentEpochToCurrentEpoch
20+ >
21+ > ( response ) ,
22+ )
23+ } catch ( e ) {
24+ console . error (
25+ 'TcAbacusGrpcApi.fetchCurrentEpoch => ' + ( e as any ) . message ,
26+ )
27+ }
28+ } )
29+
1130 test ( 'fetchHealthCheck' , async ( ) => {
1231 try {
1332 const response = await tcAbacusGrpcApi . fetchHealthCheck ( )
Original file line number Diff line number Diff line change @@ -11,6 +11,17 @@ export class TcAbacusGrpcApi extends BaseGrpcConsumer {
1111 return this . initClient ( InjectiveTCAbacusRPCClient )
1212 }
1313
14+ async fetchCurrentEpoch ( ) {
15+ const request = TcAbacusPb . GetCurrentEpochRequest . create ( { } )
16+
17+ const response = await this . executeGrpcCall <
18+ TcAbacusPb . GetCurrentEpochRequest ,
19+ TcAbacusPb . GetCurrentEpochResponse
20+ > ( request , this . client . getCurrentEpoch . bind ( this . client ) )
21+
22+ return TcAbacusGrpcTransformer . grpcCurrentEpochToCurrentEpoch ( response )
23+ }
24+
1425 async fetchHealthCheck ( ) {
1526 const request = TcAbacusPb . HealthCheckRequest . create ( { } )
1627
Original file line number Diff line number Diff line change @@ -4,13 +4,23 @@ import type {
44 SnapshotPoints ,
55 ReferrerInvitee ,
66 HealthCheckResponse ,
7+ CurrentEpochResponse ,
78 AccountStatsResponse ,
89 AccountPointsResponse ,
910 ListReferrersResponse ,
1011 AccountInviteesResponse ,
1112} from '../../types/index.js'
1213
1314export class TcAbacusGrpcTransformer {
15+ static grpcCurrentEpochToCurrentEpoch (
16+ response : TcAbacusPb . GetCurrentEpochResponse ,
17+ ) : CurrentEpochResponse {
18+ return {
19+ epochEnd : response . epochEnd ,
20+ epochPoints : response . epochPoints ,
21+ }
22+ }
23+
1424 static grpcHealthCheckToHealthCheck (
1525 response : TcAbacusPb . HealthCheckResponse ,
1626 ) : HealthCheckResponse {
@@ -41,6 +51,7 @@ export class TcAbacusGrpcTransformer {
4151 updatedAt : response . updatedAt ,
4252 nextCursor : response . nextCursor ,
4353 totalPoints : response . totalPoints ,
54+ totalReferralPoints : response . totalReferralPoints ,
4455 snapshots : response . snapshots . map ( ( snapshot ) =>
4556 TcAbacusGrpcTransformer . grpcSnapshotPointsToSnapshotPoints ( snapshot ) ,
4657 ) ,
Original file line number Diff line number Diff line change 1+ export interface CurrentEpochResponse {
2+ epochEnd : string
3+ epochPoints : string
4+ }
5+
16export interface HealthCheckResponse {
27 uptime : string
38 uptimeSeconds : number
@@ -17,6 +22,7 @@ export interface AccountPointsResponse {
1722 updatedAt : string
1823 totalPoints : string
1924 nextCursor ?: string
25+ totalReferralPoints : string
2026 snapshots : SnapshotPoints [ ]
2127}
2228
You can’t perform that action at this time.
0 commit comments