@injectivelabs/sdk-ts 1.15.33 → 1.15.35

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.
@@ -46,4 +46,7 @@ export declare class IndexerGrpcArchiverApi extends BaseGrpcConsumer {
46
46
  token?: string;
47
47
  limit?: number;
48
48
  }): Promise<import("../types/archiver.js").DenomHolders>;
49
+ fetchAccountStats({ account }: {
50
+ account: string;
51
+ }): Promise<import("../types/archiver.js").AccountStats>;
49
52
  }
@@ -230,5 +230,27 @@ class IndexerGrpcArchiverApi extends BaseIndexerGrpcConsumer_js_1.default {
230
230
  });
231
231
  }
232
232
  }
233
+ async fetchAccountStats({ account }) {
234
+ const request = indexer_proto_ts_1.InjectiveArchiverRpc.AccountStatsRequest.create();
235
+ request.account = account;
236
+ try {
237
+ const response = await this.retry(() => this.client.AccountStats(request, this.metadata));
238
+ return index_js_2.IndexerGrpcArchiverTransformer.grpcAccountStatsResponseToAccountStats(response);
239
+ }
240
+ catch (e) {
241
+ if (e instanceof indexer_proto_ts_1.InjectiveArchiverRpc.GrpcWebError) {
242
+ throw new exceptions_1.GrpcUnaryRequestException(new Error(e.toString()), {
243
+ code: (0, exceptions_1.grpcErrorCodeToErrorCode)(e.code),
244
+ context: 'All Time Account Stats',
245
+ contextModule: this.module,
246
+ });
247
+ }
248
+ throw new exceptions_1.GrpcUnaryRequestException(e, {
249
+ code: exceptions_1.UnspecifiedErrorCode,
250
+ context: 'All Time Account Stats',
251
+ contextModule: this.module,
252
+ });
253
+ }
254
+ }
233
255
  }
234
256
  exports.IndexerGrpcArchiverApi = IndexerGrpcArchiverApi;
@@ -1,4 +1,4 @@
1
- import { DenomHolders, HistoricalRPNL, LeaderboardRow, PnlLeaderboard, VolLeaderboard, HistoricalBalance, HistoricalVolumes } from '../types/archiver.js';
1
+ import { AccountStats, DenomHolders, HistoricalRPNL, LeaderboardRow, PnlLeaderboard, VolLeaderboard, HistoricalBalance, HistoricalVolumes } from '../types/archiver.js';
2
2
  import { InjectiveArchiverRpc } from '@injectivelabs/indexer-proto-ts';
3
3
  /**
4
4
  * @category Indexer Grpc Transformer
@@ -16,4 +16,5 @@ export declare class IndexerGrpcArchiverTransformer {
16
16
  static grpcPnlLeaderboardFixedResolutionResponseToPnlLeaderboard(response: InjectiveArchiverRpc.PnlLeaderboardFixedResolutionResponse): PnlLeaderboard;
17
17
  static grpcVolLeaderboardFixedResolutionResponseToVolLeaderboard(response: InjectiveArchiverRpc.VolLeaderboardFixedResolutionResponse): VolLeaderboard;
18
18
  static grpcDenomHoldersResponseToDenomHolders(response: InjectiveArchiverRpc.DenomHoldersResponse): DenomHolders;
19
+ static grpcAccountStatsResponseToAccountStats(response: InjectiveArchiverRpc.AccountStatsResponse): AccountStats;
19
20
  }
@@ -99,5 +99,11 @@ class IndexerGrpcArchiverTransformer {
99
99
  total: response.total,
100
100
  };
101
101
  }
102
+ static grpcAccountStatsResponseToAccountStats(response) {
103
+ return {
104
+ pnl: response.pnl,
105
+ volume: response.volume,
106
+ };
107
+ }
102
108
  }
103
109
  exports.IndexerGrpcArchiverTransformer = IndexerGrpcArchiverTransformer;
@@ -38,10 +38,14 @@ export interface DenomHolders {
38
38
  next: string[];
39
39
  total: number;
40
40
  }
41
+ export interface AccountStats {
42
+ pnl: number;
43
+ volume: number;
44
+ }
41
45
  export type GrpcHistoricalRPNL = InjectiveArchiverRpc.HistoricalRPNL;
46
+ export type GrpcLeaderboardRow = InjectiveArchiverRpc.LeaderboardRow;
47
+ export type GrpcDenomHolders = InjectiveArchiverRpc.DenomHoldersResponse;
42
48
  export type GrpcHistoricalBalance = InjectiveArchiverRpc.HistoricalBalance;
43
49
  export type GrpcHistoricalVolumes = InjectiveArchiverRpc.HistoricalVolumes;
44
50
  export type GrpcPnlLeaderboard = InjectiveArchiverRpc.PnlLeaderboardResponse | InjectiveArchiverRpc.PnlLeaderboardFixedResolutionResponse;
45
51
  export type GrpcVolLeaderboard = InjectiveArchiverRpc.VolLeaderboardResponse | InjectiveArchiverRpc.VolLeaderboardFixedResolutionResponse;
46
- export type GrpcLeaderboardRow = InjectiveArchiverRpc.LeaderboardRow;
47
- export type GrpcDenomHolders = InjectiveArchiverRpc.DenomHoldersResponse;
@@ -46,4 +46,7 @@ export declare class IndexerGrpcArchiverApi extends BaseGrpcConsumer {
46
46
  token?: string;
47
47
  limit?: number;
48
48
  }): Promise<import("../types/archiver.js").DenomHolders>;
49
+ fetchAccountStats({ account }: {
50
+ account: string;
51
+ }): Promise<import("../types/archiver.js").AccountStats>;
49
52
  }
@@ -224,4 +224,26 @@ export class IndexerGrpcArchiverApi extends BaseGrpcConsumer {
224
224
  });
225
225
  }
226
226
  }
227
+ async fetchAccountStats({ account }) {
228
+ const request = InjectiveArchiverRpc.AccountStatsRequest.create();
229
+ request.account = account;
230
+ try {
231
+ const response = await this.retry(() => this.client.AccountStats(request, this.metadata));
232
+ return IndexerGrpcArchiverTransformer.grpcAccountStatsResponseToAccountStats(response);
233
+ }
234
+ catch (e) {
235
+ if (e instanceof InjectiveArchiverRpc.GrpcWebError) {
236
+ throw new GrpcUnaryRequestException(new Error(e.toString()), {
237
+ code: grpcErrorCodeToErrorCode(e.code),
238
+ context: 'All Time Account Stats',
239
+ contextModule: this.module,
240
+ });
241
+ }
242
+ throw new GrpcUnaryRequestException(e, {
243
+ code: UnspecifiedErrorCode,
244
+ context: 'All Time Account Stats',
245
+ contextModule: this.module,
246
+ });
247
+ }
248
+ }
227
249
  }
@@ -1,4 +1,4 @@
1
- import { DenomHolders, HistoricalRPNL, LeaderboardRow, PnlLeaderboard, VolLeaderboard, HistoricalBalance, HistoricalVolumes } from '../types/archiver.js';
1
+ import { AccountStats, DenomHolders, HistoricalRPNL, LeaderboardRow, PnlLeaderboard, VolLeaderboard, HistoricalBalance, HistoricalVolumes } from '../types/archiver.js';
2
2
  import { InjectiveArchiverRpc } from '@injectivelabs/indexer-proto-ts';
3
3
  /**
4
4
  * @category Indexer Grpc Transformer
@@ -16,4 +16,5 @@ export declare class IndexerGrpcArchiverTransformer {
16
16
  static grpcPnlLeaderboardFixedResolutionResponseToPnlLeaderboard(response: InjectiveArchiverRpc.PnlLeaderboardFixedResolutionResponse): PnlLeaderboard;
17
17
  static grpcVolLeaderboardFixedResolutionResponseToVolLeaderboard(response: InjectiveArchiverRpc.VolLeaderboardFixedResolutionResponse): VolLeaderboard;
18
18
  static grpcDenomHoldersResponseToDenomHolders(response: InjectiveArchiverRpc.DenomHoldersResponse): DenomHolders;
19
+ static grpcAccountStatsResponseToAccountStats(response: InjectiveArchiverRpc.AccountStatsResponse): AccountStats;
19
20
  }
@@ -96,4 +96,10 @@ export class IndexerGrpcArchiverTransformer {
96
96
  total: response.total,
97
97
  };
98
98
  }
99
+ static grpcAccountStatsResponseToAccountStats(response) {
100
+ return {
101
+ pnl: response.pnl,
102
+ volume: response.volume,
103
+ };
104
+ }
99
105
  }
@@ -38,10 +38,14 @@ export interface DenomHolders {
38
38
  next: string[];
39
39
  total: number;
40
40
  }
41
+ export interface AccountStats {
42
+ pnl: number;
43
+ volume: number;
44
+ }
41
45
  export type GrpcHistoricalRPNL = InjectiveArchiverRpc.HistoricalRPNL;
46
+ export type GrpcLeaderboardRow = InjectiveArchiverRpc.LeaderboardRow;
47
+ export type GrpcDenomHolders = InjectiveArchiverRpc.DenomHoldersResponse;
42
48
  export type GrpcHistoricalBalance = InjectiveArchiverRpc.HistoricalBalance;
43
49
  export type GrpcHistoricalVolumes = InjectiveArchiverRpc.HistoricalVolumes;
44
50
  export type GrpcPnlLeaderboard = InjectiveArchiverRpc.PnlLeaderboardResponse | InjectiveArchiverRpc.PnlLeaderboardFixedResolutionResponse;
45
51
  export type GrpcVolLeaderboard = InjectiveArchiverRpc.VolLeaderboardResponse | InjectiveArchiverRpc.VolLeaderboardFixedResolutionResponse;
46
- export type GrpcLeaderboardRow = InjectiveArchiverRpc.LeaderboardRow;
47
- export type GrpcDenomHolders = InjectiveArchiverRpc.DenomHoldersResponse;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@injectivelabs/sdk-ts",
3
3
  "description": "SDK in TypeScript for building Injective applications in a browser, node, and react native environment.",
4
- "version": "1.15.33",
4
+ "version": "1.15.35",
5
5
  "sideEffects": false,
6
6
  "license": "Apache-2.0",
7
7
  "author": {
@@ -123,16 +123,16 @@
123
123
  "@cosmjs/stargate": "^0.33.0",
124
124
  "@injectivelabs/abacus-proto-ts": "1.14.0",
125
125
  "@injectivelabs/core-proto-ts": "1.14.3",
126
- "@injectivelabs/exceptions": "^1.15.30",
126
+ "@injectivelabs/exceptions": "^1.15.32",
127
127
  "@injectivelabs/grpc-web": "^0.0.1",
128
128
  "@injectivelabs/grpc-web-node-http-transport": "^0.0.2",
129
129
  "@injectivelabs/grpc-web-react-native-transport": "^0.0.2",
130
- "@injectivelabs/indexer-proto-ts": "1.13.13",
130
+ "@injectivelabs/indexer-proto-ts": "1.13.14",
131
131
  "@injectivelabs/mito-proto-ts": "1.13.2",
132
- "@injectivelabs/networks": "^1.15.31",
132
+ "@injectivelabs/networks": "^1.15.33",
133
133
  "@injectivelabs/olp-proto-ts": "1.13.4",
134
- "@injectivelabs/ts-types": "^1.15.31",
135
- "@injectivelabs/utils": "^1.15.31",
134
+ "@injectivelabs/ts-types": "^1.15.33",
135
+ "@injectivelabs/utils": "^1.15.33",
136
136
  "@metamask/eth-sig-util": "^8.2.0",
137
137
  "@noble/curves": "^1.8.1",
138
138
  "@noble/hashes": "^1.7.1",
@@ -151,7 +151,7 @@
151
151
  "shx": "^0.3.4",
152
152
  "snakecase-keys": "^5.4.1"
153
153
  },
154
- "gitHead": "a214c118cc513d4f635e040efdc64d108913ff96",
154
+ "gitHead": "7e589344149d5c2f0ca7869003fb2fee503688f0",
155
155
  "typedoc": {
156
156
  "entryPoint": "./src/index.ts",
157
157
  "readmeFile": "./README.md",