diff --git a/packages/sdk-ts/package.json b/packages/sdk-ts/package.json index d36b060ab..47d1cb4d4 100644 --- a/packages/sdk-ts/package.json +++ b/packages/sdk-ts/package.json @@ -126,7 +126,7 @@ "@injectivelabs/grpc-web": "^0.0.1", "@injectivelabs/grpc-web-node-http-transport": "^0.0.2", "@injectivelabs/grpc-web-react-native-transport": "^0.0.2", - "@injectivelabs/indexer-proto-ts": "1.13.1", + "@injectivelabs/indexer-proto-ts": "1.13.2", "@injectivelabs/mito-proto-ts": "1.13.0", "@injectivelabs/networks": "^1.14.32", "@injectivelabs/olp-proto-ts": "1.13.1", diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcTradingApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcTradingApi.ts index 3d81b7991..138a11844 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcTradingApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcTradingApi.ts @@ -22,6 +22,33 @@ export class IndexerGrpcTradingApi extends BaseGrpcConsumer { ) } + async fetchTradingStats() { + const request = InjectiveTradingRpc.GetTradingStatsRequest.create() + + try { + const response = + await this.retry(() => + this.client.GetTradingStats(request), + ) + + return response + } catch (e: unknown) { + if (e instanceof InjectiveTradingRpc.GrpcWebError) { + throw new GrpcUnaryRequestException(new Error(e.toString()), { + code: e.code, + context: 'TradingStats', + contextModule: this.module, + }) + } + + throw new GrpcUnaryRequestException(e as Error, { + code: UnspecifiedErrorCode, + context: 'TradingStats', + contextModule: this.module, + }) + } + } + async fetchGridStrategies({ accountAddress, subaccountId, diff --git a/yarn.lock b/yarn.lock index 961ce89f5..43a8a203e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2220,6 +2220,16 @@ protobufjs "^7.0.0" rxjs "^7.4.0" +"@injectivelabs/indexer-proto-ts@1.13.2": + version "1.13.2" + resolved "https://registry.yarnpkg.com/@injectivelabs/indexer-proto-ts/-/indexer-proto-ts-1.13.2.tgz#ad784602ea392b7a25410784cf90eed74895d07b" + integrity sha512-Sn6TiFslc1Lvxhljr5lJCymIRpAcsyfevAyQlGDbls0ZKHcZnl9oBHlFbCPA04dyNGcs9txU2odzBC/1hsYfwQ== + dependencies: + "@injectivelabs/grpc-web" "^0.0.1" + google-protobuf "^3.14.0" + protobufjs "^7.0.0" + rxjs "^7.4.0" + "@injectivelabs/mito-proto-ts@1.13.0": version "1.13.0" resolved "https://registry.npmjs.org/@injectivelabs/mito-proto-ts/-/mito-proto-ts-1.13.0.tgz#9bc5325977a3c51b3fb8ec54a93244435861a9ca" @@ -2240,6 +2250,46 @@ protobufjs "^7.0.0" rxjs "^7.4.0" +"@injectivelabs/sdk-ts@^1.14.19": + version "1.14.32" + resolved "https://registry.yarnpkg.com/@injectivelabs/sdk-ts/-/sdk-ts-1.14.32.tgz#560bc07a717d14bac81ee4f5ef17f9ac42abbd67" + integrity sha512-l4V5TK4QnTS8kgv4Qnmmi4rZo+2yF9y4S6lhH6eoyRuPb/xXODUzkyQDIHwbd1Qf92G31qSdL76Koe13v/SBIQ== + dependencies: + "@apollo/client" "^3.11.10" + "@cosmjs/amino" "^0.32.3" + "@cosmjs/proto-signing" "^0.32.3" + "@cosmjs/stargate" "^0.32.3" + "@ethersproject/bytes" "^5.7.0" + "@injectivelabs/core-proto-ts" "1.13.4" + "@injectivelabs/exceptions" "^1.14.32" + "@injectivelabs/grpc-web" "^0.0.1" + "@injectivelabs/grpc-web-node-http-transport" "^0.0.2" + "@injectivelabs/grpc-web-react-native-transport" "^0.0.2" + "@injectivelabs/indexer-proto-ts" "1.13.1" + "@injectivelabs/mito-proto-ts" "1.13.0" + "@injectivelabs/networks" "^1.14.32" + "@injectivelabs/olp-proto-ts" "1.13.1" + "@injectivelabs/test-utils" "^1.14.32" + "@injectivelabs/ts-types" "^1.14.32" + "@injectivelabs/utils" "^1.14.32" + "@metamask/eth-sig-util" "^4.0.0" + "@noble/curves" "^1.4.0" + axios "^1.6.4" + bech32 "^2.0.0" + bip39 "^3.0.4" + cosmjs-types "^0.9.0" + ethereumjs-util "^7.1.4" + ethers "^6.5.1" + google-protobuf "^3.21.0" + graphql "^16.3.0" + http-status-codes "^2.2.0" + js-sha3 "^0.8.0" + jscrypto "^1.0.3" + keccak256 "^1.0.6" + secp256k1 "^4.0.3" + shx "^0.3.2" + snakecase-keys "^5.4.1" + "@injectivelabs/wallet-base@^0.0.6": version "0.0.6" resolved "https://registry.yarnpkg.com/@injectivelabs/wallet-base/-/wallet-base-0.0.6.tgz#073ee305b901c939b1dd5807b0506105c8d3f84d" @@ -12113,7 +12163,12 @@ libsodium-wrappers-sumo@^0.7.11: dependencies: libsodium-sumo "^0.7.13" -libsodium-wrappers@^0.7.6, "libsodium-wrappers@npm:@bangjelkoski/noop", "libsodium@npm:@bangjelkoski/noop": +libsodium-wrappers@^0.7.6, "libsodium-wrappers@npm:@bangjelkoski/noop": + version "0.0.1" + resolved "https://registry.npmjs.org/@bangjelkoski/noop/-/noop-0.0.1.tgz#172235ce00dd4269258c420f01464f07eb9801ed" + integrity sha512-lQgYJJbok2Unu2vKh0TAtWxXo16kLXNrjqmfo0hQTAuE/tVvz5zVqMgGsj+gMkkWfsInEbUndG0nlyCwaFv8hQ== + +"libsodium@npm:@bangjelkoski/noop": version "0.0.1" resolved "https://registry.npmjs.org/@bangjelkoski/noop/-/noop-0.0.1.tgz#172235ce00dd4269258c420f01464f07eb9801ed" integrity sha512-lQgYJJbok2Unu2vKh0TAtWxXo16kLXNrjqmfo0hQTAuE/tVvz5zVqMgGsj+gMkkWfsInEbUndG0nlyCwaFv8hQ==