-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add lending pool balances to UI #28
Conversation
Teolhyn
commented
Sep 10, 2024
- Add getter for pool balances
- Add functionality to get the balance data through transaction simulation
- Add recurring fetching of contract balances to front-end with six second intervals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tosi hyvää kamaa
const [totalSupplied, setTotalSupplied] = useState<string>('0'); | ||
const [supplyAPY, setSupplyAPY] = useState<string>('0.00%'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Näissä ei oo pakko määrittää tota <string>
explisiittisesti, TS inferoi sen tosta default-arvosta.
const formatSuppliedAmount = useCallback((amount: bigint) => { | ||
const ten_k = BigInt(10_000 * 10_000_000); | ||
const one_m = BigInt(1_000_000 * 10_000_000); | ||
switch (true) { | ||
case amount > one_m: | ||
return `${(Number(amount) / (1_000_000 * 10_000_000)).toFixed(2)}M`; | ||
case amount > ten_k: | ||
return `${(Number(amount) / (1_000 * 10_000_000)).toFixed(1)}K`; | ||
default: | ||
return `${(Number(amount) / 10_000_000).toFixed(1)}`; | ||
} | ||
}, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tän voisi piilottaa abstraktion taakse, vaikkapa uuteen formatting.ts
tiedostoon
0a8ec54
to
3039336
Compare
3039336
to
dfa2458
Compare