From 6c90022444f35c0f88c247ca293ce085c54dcb88 Mon Sep 17 00:00:00 2001 From: DrPresident Date: Thu, 21 Nov 2024 11:54:18 -0600 Subject: [PATCH] feat: more types --- src/contracts/services/moneyMarket.ts | 8 +++++--- src/types/contracts/moneyMarket/model.ts | 12 +++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/contracts/services/moneyMarket.ts b/src/contracts/services/moneyMarket.ts index 37fd929..3bd4fe4 100644 --- a/src/contracts/services/moneyMarket.ts +++ b/src/contracts/services/moneyMarket.ts @@ -9,6 +9,7 @@ import { import { BatchQueryParsedResponse, BatchQueryParams, + BatchQueryParsedResponseItem, } from '~/types/contracts/batchQuery/model'; import { sendSecretClientContractQuery$ } from '~/client/services/clientServices'; import { ConfigResponse, GetCollateralResponse, GetMarketsResponse } from '~/types/contracts/moneyMarket/response'; @@ -19,6 +20,7 @@ import { ContractAndPagination, Pagination, ParsedConfigResponse, ParsedGetCollateralResponse, ParsedGetMarketsResponse, ParsedRewardPoolsResponse, + RewardPoolResponse, } from '~/types/contracts/moneyMarket/model'; import { Contract } from '~/types/contracts/shared/index'; import { MinBlockHeightValidationOptions } from '~/types'; @@ -735,10 +737,10 @@ async function batchQueryMoneyMarketPublicLogs({ const parseBatchQueryMoneyMarketRewardPools = ( responses: BatchQueryParsedResponse, ): ParsedRewardPoolsResponse[] => ( - responses.map((response: any) => ({ - debtMarket: response.id, + responses.map((response: BatchQueryParsedResponseItem) => ({ + debtMarket: response.id.toString(), blockHeight: response.blockHeight, - rewardPools: response.response.map((pool: any) => ({ + rewardPools: response.response.map((pool: RewardPoolResponse) => ({ rewardPoolId: pool.id, amount: pool.amount, token: pool.token, diff --git a/src/types/contracts/moneyMarket/model.ts b/src/types/contracts/moneyMarket/model.ts index 9960051..8e4c068 100644 --- a/src/types/contracts/moneyMarket/model.ts +++ b/src/types/contracts/moneyMarket/model.ts @@ -174,9 +174,18 @@ type RewardPool = { rate: string, } +type RewardPoolResponse = { + id: string, + amount: string, + token: string, + start: string, + end: string, + rate: string, +} + type ParsedRewardPoolsResponse = { debtMarket: string, - blockHeight: string, + blockHeight: number, rewardPools: RewardPool[], } @@ -196,5 +205,6 @@ export type { PublicLog, PaginatedPublicLogs, RewardPool, + RewardPoolResponse, ParsedRewardPoolsResponse, };