Skip to content

Commit 9b6c061

Browse files
authored
Merge pull request #1659 from mars-protocol/develop
v2.11.6
2 parents f9d3349 + c953875 commit 9b6c061

File tree

4 files changed

+35
-10
lines changed

4 files changed

+35
-10
lines changed

src/api/managedVaults/getManagedVaultDepositors.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,32 @@ interface ManagedVaultDepositorsApiResponse {
1212

1313
export default async function getManagedVaultDepositors(vaultTokensDenom: string) {
1414
try {
15-
const baseUrl = `https://neutron-rest.cosmos-apis.com/cosmos/bank/v1beta1/denom_owners_by_query?denom=${vaultTokensDenom}`
15+
const allDepositors: ManagedVaultDepositor[] = []
16+
let nextKey: string | null = null
1617

17-
const url = getUrl(baseUrl, '')
18-
const response = await fetchWithTimeout(url, FETCH_TIMEOUT)
18+
// Loop through all possible pages
19+
do {
20+
const baseUrl = `https://neutron-rest.cosmos-apis.com/cosmos/bank/v1beta1/denom_owners_by_query?denom=${vaultTokensDenom}`
21+
const urlWithPagination = nextKey
22+
? `${baseUrl}&pagination.key=${encodeURIComponent(nextKey)}`
23+
: baseUrl
1924

20-
if (!response.ok) return []
21-
const data: ManagedVaultDepositorsApiResponse = await response.json()
25+
const url = getUrl(urlWithPagination, '')
26+
const response = await fetchWithTimeout(url, FETCH_TIMEOUT)
2227

23-
return data.denom_owners
28+
if (!response.ok) {
29+
return allDepositors
30+
}
31+
32+
const data: ManagedVaultDepositorsApiResponse = await response.json()
33+
34+
allDepositors.push(...data.denom_owners)
35+
36+
// Update nextKey for the next iteration
37+
nextKey = data.pagination.next_key
38+
} while (nextKey !== null)
39+
40+
return allDepositors
2441
} catch (error) {
2542
console.error('Could not fetch managed vault depositors.', error)
2643
return []

src/api/prices/getOraclePrices.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ export default async function getOraclePrices(
4949

5050
const chunkResults = await Promise.all(
5151
denomChunks.map(async (chunk) => {
52-
return await neutronOracleQueryClient.pricesByDenoms({ denoms: chunk, kind: 'default' })
52+
return await neutronOracleQueryClient.pricesByDenoms({
53+
denoms: chunk,
54+
kind: 'liquidation',
55+
})
5356
}),
5457
)
5558

@@ -70,7 +73,10 @@ export default async function getOraclePrices(
7073
const shareResults = await Promise.all(
7174
shareAssets.map(async (asset) => {
7275
try {
73-
return await neutronOracleQueryClient.price({ denom: asset.denom })
76+
return await neutronOracleQueryClient.price({
77+
denom: asset.denom,
78+
kind: 'liquidation',
79+
})
7480
} catch (error) {
7581
console.warn(`Failed to fetch price for share asset ${asset.denom}:`, error)
7682
return { denom: asset.denom, price: '0' } as PriceResponse
@@ -96,7 +102,7 @@ export default async function getOraclePrices(
96102
: await getOracleQueryClientNeutron(chainConfig)
97103
return Promise.all(
98104
assets.map(async (asset) => {
99-
const priceResponse = await queryClient.price({ denom: asset.denom })
105+
const priceResponse = await queryClient.price({ denom: asset.denom, kind: 'liquidation' })
100106
return getAssetPrice(asset, priceResponse)
101107
}),
102108
)

src/api/swap/getNeutronRouteInfo.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ async function getNeutronRouteInfoInternal(
172172
{ name: 'neutron-duality', chainId: chainConfig.id },
173173
{ name: 'neutron-astroport', chainId: chainConfig.id },
174174
],
175+
experimentalFeatures: ['eureka'],
175176
...routeParams,
176177
}
177178

@@ -267,6 +268,7 @@ export async function getNeutronRouteInfoReverse(
267268
{ name: 'neutron-duality', chainId: chainConfig.id },
268269
{ name: 'neutron-astroport', chainId: chainConfig.id },
269270
],
271+
experimentalFeatures: ['eureka'],
270272
// Use reverse routing parameters
271273
amountOut: toIntegerString(amountOut),
272274
}

src/components/managedVaults/table/column/Title.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default function Title(props: Props) {
4141
alt={vaultOwnerInfo.name}
4242
width={vaultOwnerInfo.avatar.width}
4343
height={vaultOwnerInfo.avatar.height}
44-
className='rounded-full'
44+
className='rounded-full w-8 h-8'
4545
/>
4646
</span>
4747
<div className='flex flex-col gap-0.5'>

0 commit comments

Comments
 (0)