fix denormolized wallet balance error

This commit is contained in:
lomonoshka
2023-11-03 13:16:16 +04:00
parent 8e018aa1b0
commit 47e68cc7fa
4 changed files with 27 additions and 7 deletions

View File

@@ -87,6 +87,10 @@ export function generateCalls(calls: BytesLike[]) {
}
export async function exchangeToNativeDecimals(token: AddressLike, amount: BigNumberish, provider: ethers.JsonRpcProvider) {
return await toNativeDecimals(token, amount, provider) / (BigInt(10) ** 8n)
}
export async function toNativeDecimals(token: AddressLike, amount: BigNumberish, provider: ethers.JsonRpcProvider) {
token = await token
if (typeof token !== "string") token = await token.getAddress()