From 59dce0caccf4a4abc35da527585508572f25948e Mon Sep 17 00:00:00 2001 From: Bob Lu Date: Thu, 24 Oct 2024 15:17:20 +0800 Subject: [PATCH] fix: update paraswap token list fetching --- .changeset/quiet-chefs-grow.md | 5 +++++ src/logics/paraswap-v5/logic.swap-token.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/quiet-chefs-grow.md diff --git a/.changeset/quiet-chefs-grow.md b/.changeset/quiet-chefs-grow.md new file mode 100644 index 00000000..2064888b --- /dev/null +++ b/.changeset/quiet-chefs-grow.md @@ -0,0 +1,5 @@ +--- +'@protocolink/logics': patch +--- + +update paraswap token list fetching diff --git a/src/logics/paraswap-v5/logic.swap-token.ts b/src/logics/paraswap-v5/logic.swap-token.ts index 1eace382..b0b0fb83 100644 --- a/src/logics/paraswap-v5/logic.swap-token.ts +++ b/src/logics/paraswap-v5/logic.swap-token.ts @@ -37,7 +37,7 @@ export class SwapTokenLogic try { const resp = await axios.get(tokenListUrl); let data = resp.data; - if ((resp.headers['content-type'] as string).includes('text/plain')) { + if ((resp.headers['content-type'] as string).includes('text/plain') && typeof data === 'string') { data = JSON.parse(data); } tokenLists.push(data);