From 1c9c0a6656cfa11e97e463ae79291f5a83b6b673 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Sat, 16 Dec 2023 19:52:27 +0800 Subject: [PATCH] add custom apr --- src/libs/clients/osmosis.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libs/clients/osmosis.ts b/src/libs/clients/osmosis.ts index db054c9d..af3c9201 100644 --- a/src/libs/clients/osmosis.ts +++ b/src/libs/clients/osmosis.ts @@ -8,5 +8,11 @@ export const name = 'osmosis' // osmosis custom request export const requests: Partial = { - mint_inflation: { url: 'https://public-osmosis-api.numia.xyz/apr?start_date=2023-11-27&end_date=2023-11-30', adapter: (data: any) => ({inflation: (Number(data.inflation_rate || 0)/ 100 ).toFixed(2)}) }, + mint_inflation: { + url: `https://public-osmosis-api.numia.xyz/apr?start_date=${new Date(new Date().getTime() - 186400*1000).toISOString().split('T')[0]}&end_date=${new Date().toISOString().split('T')[0]}`, + adapter: (data: any) => { + const [first] = data + return {inflation: String(Number(first?.apr|| "0")/100.0)} + } + }, }