-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20cfa93
commit 0053d70
Showing
7 changed files
with
206 additions
and
23 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { atom } from 'jotai'; | ||
import { atomWithQuery } from 'jotai-tanstack-query'; | ||
|
||
import fetchWithRetry from '@/utils/fetchWithRetry'; | ||
|
||
import { IDapp } from './IDapp.store'; | ||
import { PoolInfo } from './pools'; | ||
|
||
interface PoolData { | ||
tvl: number; | ||
apr: { | ||
percentage: number; | ||
apr_cl: number; | ||
apr: number; | ||
incentive_apr: number; | ||
}; | ||
} | ||
|
||
interface IndexedPoolData { | ||
[key: string]: PoolData[]; | ||
} | ||
|
||
export class Endur extends IDapp<IndexedPoolData> { | ||
name = 'Endur'; | ||
link = 'https://endur.fi'; | ||
logo = 'https://endur.fi/favicon.ico'; | ||
incentiveDataKey: string = 'Endur'; | ||
} | ||
|
||
export const endur = new Endur(); | ||
|
||
const EndurAtoms = { | ||
endurStats: atomWithQuery((_get) => ({ | ||
queryKey: ['Endur_APY'], | ||
queryFn: async ({ queryKey: _ }) => { | ||
const url = 'https://testnet.endur.fi/api/stats'; | ||
const response = await fetchWithRetry(url); | ||
|
||
if (!response) return null; | ||
|
||
const data = await response.json(); | ||
|
||
return data; | ||
}, | ||
})), | ||
pools: atom((_get) => { | ||
const empty: PoolInfo[] = []; | ||
return empty; | ||
}), | ||
}; | ||
|
||
export default EndurAtoms; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters