Skip to content

Commit

Permalink
fix: update paraswap token list fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Lu committed Oct 24, 2024
1 parent 641841d commit 36b47af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/quiet-chefs-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@protocolink/logics': patch
---

update paraswap token list fetching
9 changes: 3 additions & 6 deletions src/logics/paraswap-v5/logic.swap-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,12 @@ export class SwapTokenLogic
async getTokenList(): Promise<SwapTokenLogicTokenList> {
const tokenListUrls = getTokenListUrls(this.chainId);
const tokenLists: TokenList[] = [];

await Promise.all(
tokenListUrls.map(async (tokenListUrl) => {
try {
const resp = await axios.get(tokenListUrl);
let data = resp.data;
if ((resp.headers['content-type'] as string).includes('text/plain')) {
data = JSON.parse(data);
}
tokenLists.push(data);
const { data } = await axios.get(tokenListUrl);
if (data && typeof data === 'object') tokenLists.push(data);
} catch {}
})
);
Expand Down

0 comments on commit 36b47af

Please sign in to comment.