From 472c9d29f5ab44ac195ed555c1305d59e1e6e4f2 Mon Sep 17 00:00:00 2001 From: Bob Date: Wed, 30 Oct 2024 04:55:27 -0500 Subject: [PATCH] fix: update paraswap token list fetching (#83) Co-authored-by: Bob Lu --- .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);