-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
i use dnum to go from token amount in decimals -> absolute token amount.
this is usually done by doing something like
const n = dnum.multiply(dnum.from(decimalAmount), 10n ** BigInt(decimals))
then i need to get the floor of this number as a bigint, to pass to viem, so i do
const bigIntValue = n[0] / 10n ** BigInt(n[1])
it would be useful if there was perhaps an api like.
toBigInt(n:Numberish): bigint
// usage:
const bigIntValue = dnum.toBigInt(n)
would you be open to a PR with something like this? or is there an existing function that i can use to do the same task?
dnum.from(n, 0)[0] maybe? (it seems sort of cursed)
Metadata
Metadata
Assignees
Labels
No labels