Skip to content

Commit

Permalink
Update ServiceMarket.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
huhuanming committed Dec 24, 2024
1 parent e213964 commit acd0197
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions packages/kit-bg/src/services/ServiceMarket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,21 @@ class ServiceMarket extends ServiceBase {
const client = await this.getClient(EServiceEndpointEnum.Utility);
try {
const poolsData = await Promise.allSettled(
keys.map((key) =>
client.get<{
data: IMarketDetailPool[];
}>('/utility/v1/market/pools', {
params: {
query: detailPlatforms[key].contract_address,
network: detailPlatforms[key].coingeckoNetworkId,
},
}),
),
keys.map((key) => {
const { contract_address: contractAddress, coingeckoNetworkId } =
detailPlatforms[key];
if (contractAddress && coingeckoNetworkId) {
return client.get<{
data: IMarketDetailPool[];
}>('/utility/v1/market/pools', {
params: {
query: contractAddress,
network: coingeckoNetworkId,
},
});
}
return Promise.resolve({ data: { data: [] } });
}),
);
return keys
.map((key, index) => ({
Expand All @@ -133,7 +138,8 @@ class ServiceMarket extends ServiceBase {
: [],
}))
.filter((i) => i.data.length);
} catch {
} catch (error) {
console.error('fetchPools error', error);
return [];
}
}
Expand Down

0 comments on commit acd0197

Please sign in to comment.