Get everything properly typed

This commit is contained in:
Alexis Sellier
2021-05-04 11:13:14 +02:00
parent 4ab188b6ed
commit 8c623ceaed
12 changed files with 153 additions and 35 deletions
+3 -2
View File
@@ -1,10 +1,11 @@
import { ethers } from "ethers";
import type { BigNumber } from "ethers";
export function formatBalance(n) {
export function formatBalance(n: BigNumber) {
return ethers.utils.commify(parseFloat(ethers.utils.formatUnits(n)).toFixed(2));
}
export function formatAddress(addr) {
export function formatAddress(addr: string) {
return addr.substring(0, 6)
+ '...'
+ addr.substring(addr.length - 4, addr.length);