Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ontend into simple-spot

# Conflicts:
#	src/components/Trade/TradeChart/TVChartContainer.tsx
#	src/components/Trade/TradeChart/index.tsx
  • Loading branch information
linkielink committed Dec 8, 2023
2 parents 920d7b8 + aef2940 commit 451aa3b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/api/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ export const allParamsCache: Cache<AssetParamsBaseForAddr[]> = new Map()
export const underlyingDebtCache: Cache<string> = new Map()
export const previewDepositCache: Cache<{ vaultAddress: string; amount: string }> = new Map()
export const stakingAprCache: Cache<StakingApr[]> = new Map()
export const assetParamsCache: Cache<AssetParamsBaseForAddr[]> = new Map()
12 changes: 10 additions & 2 deletions src/api/params/getAssetParams.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import { assetParamsCache, cacheFn } from 'api/cache'
import { getParamsQueryClient } from 'api/cosmwasm-client'
import { AssetParamsBaseForAddr } from 'types/generated/mars-params/MarsParams.types'
import iterateContractQuery from 'utils/iterateContractQuery'

export default async function getAssetParams(): Promise<AssetParamsBaseForAddr[]> {
try {
const paramsQueryClient = await getParamsQueryClient()
return iterateContractQuery(paramsQueryClient.allAssetParams)
return await cacheFn(
async () => {
const paramsQueryClient = await getParamsQueryClient()
return iterateContractQuery(paramsQueryClient.allAssetParams)
},
assetParamsCache,
'assetParams',
600,
)
} catch (ex) {
throw ex
}
Expand Down
4 changes: 2 additions & 2 deletions src/api/vaults/getDepositedVaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function getVaultPositionStatusAndUnlockIdAndUnlockTime(
}
}

function flatVaultPositionAmount(
export function flatVaultPositionAmount(
vaultPositionAmount: VaultPositionAmount,
): VaultPositionFlatAmounts {
const amounts = {
Expand All @@ -82,7 +82,7 @@ function flatVaultPositionAmount(
return amounts
}

async function getLpTokensForVaultPosition(
export async function getLpTokensForVaultPosition(
vault: Vault,
vaultPosition: VaultPosition,
): Promise<Coin[]> {
Expand Down

0 comments on commit 451aa3b

Please sign in to comment.