diff --git a/packages/sdk-ts/package.json b/packages/sdk-ts/package.json index 17f7b9504..5b707b097 100644 --- a/packages/sdk-ts/package.json +++ b/packages/sdk-ts/package.json @@ -45,7 +45,7 @@ "@injectivelabs/grpc-web-node-http-transport": "^0.0.2", "@injectivelabs/grpc-web-react-native-transport": "^0.0.2", "@injectivelabs/indexer-proto-ts": "1.11.10", - "@injectivelabs/mito-proto-ts": "1.0.46", + "@injectivelabs/mito-proto-ts": "1.0.47", "@injectivelabs/networks": "^1.14.1-beta.1", "@injectivelabs/test-utils": "^1.14.1-beta.0", "@injectivelabs/token-metadata": "^1.14.1-beta.4", diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.spec.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.spec.ts index 208f51748..890a0ee40 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.spec.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.spec.ts @@ -154,9 +154,10 @@ describe('IndexerGrpcMitoApi', () => { test('fetchHolderPortfolio', async () => { try { - const response = await indexerGrpcMitoApi.fetchHolderPortfolio( - injectiveAddress, - ) + const response = await indexerGrpcMitoApi.fetchHolderPortfolio({ + stakingContractAddress, + holderAddress: injectiveAddress, + }) if (!response) { console.warn('fetchHolderPortfolio.portfolioNotFound') diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.ts index 38a628953..b63c16e4c 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.ts @@ -299,10 +299,17 @@ export class IndexerGrpcMitoApi extends BaseGrpcConsumer { } } - async fetchHolderPortfolio(holderAddress: string) { + async fetchHolderPortfolio({ + holderAddress, + stakingContractAddress, + }: { + holderAddress: string + stakingContractAddress: string + }) { const request = MitoApi.PortfolioRequest.create() request.holderAddress = holderAddress + request.stakingContractAddress = stakingContractAddress try { const response = await this.retry(() => diff --git a/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcMitoTransformer.ts b/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcMitoTransformer.ts index d5ce175b5..43079163d 100644 --- a/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcMitoTransformer.ts +++ b/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcMitoTransformer.ts @@ -153,6 +153,7 @@ export class IndexerGrpcMitoTransformer { pnlChartList: portfolio.pnlChart.map( IndexerGrpcMitoTransformer.mitoPriceSnapshotToPriceSnapshot, ), + updatedAt: parseInt(portfolio.pnlUpdatedAt, 10), } } diff --git a/packages/sdk-ts/src/client/indexer/types/mito.ts b/packages/sdk-ts/src/client/indexer/types/mito.ts index 909d18925..3cd6937e6 100644 --- a/packages/sdk-ts/src/client/indexer/types/mito.ts +++ b/packages/sdk-ts/src/client/indexer/types/mito.ts @@ -73,6 +73,7 @@ export interface MitoPortfolio { pnl: number totalValueChartList: MitoPriceSnapshot[] pnlChartList: MitoPriceSnapshot[] + updatedAt: number } export interface MitoLeaderboardEntry { diff --git a/yarn.lock b/yarn.lock index 0b715a020..e24122371 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2176,10 +2176,10 @@ protobufjs "^7.0.0" rxjs "^7.4.0" -"@injectivelabs/mito-proto-ts@1.0.46": - version "1.0.46" - resolved "https://registry.yarnpkg.com/@injectivelabs/mito-proto-ts/-/mito-proto-ts-1.0.46.tgz#d0e31c4ca2f76940771621b2fe88f9bc40c7a891" - integrity sha512-K1g5udssQd4pDNzMteUQiI3PLHsuBhCKT6wli2h05ImB0NFQcGbLQlk3lpzsdfE9Usx2hCmZiQNUfUouRrTBpQ== +"@injectivelabs/mito-proto-ts@1.0.47": + version "1.0.47" + resolved "https://registry.yarnpkg.com/@injectivelabs/mito-proto-ts/-/mito-proto-ts-1.0.47.tgz#bcc53839a7204530a3d585772b42aa6c3d14cd9e" + integrity sha512-MJpxbvxUImjmowqB4Ny5BY7vv2x8lU5+cgchTzhT71jaLWTPL4VzjSjUPA1M/MHopaTemEZqDKOOmbRJwA5OZg== dependencies: "@injectivelabs/grpc-web" "^0.0.1" google-protobuf "^3.14.0"