Move from TinyBig to `BigInt`
This is low priority for now. We should wait until BigInt becomes more of an industry standard.
This change is inspired by the recent change in ethers.js to BigInt.
https://docs.ethers.org/v6-beta/migrating/#migrate-bigint
I have started to look into this.
Do we want to upgrade to a new version of TypeScript in the tsconfig.json for this?
I have been playing around with using BigInt and I am running into a ts error when trying to use BigInt literals.
For example:
export function etherToWei(
etherQuantity: string | number | bigint,
): bigint {
validateType(etherQuantity, ['string', 'number', 'object']);
const result = BigInt(etherQuantity) * 1000000000000000000n
return BigInt(result);
}
throws this ts error: BigInt literals are not available when targeting lower than ES2020.
We could use the constructor which compiles just fine with our current version of typescript
const result = BigInt(etherQuantity) * BigInt(1000000000000000000)
Also are we completely deprecating TinyBig and only supporting BigInt?
Like removing the TinyBig and Big inputs from functions?
https://github.com/dawsbot/essential-eth/blob/b079202c2b1dc51f5a03bac966bebb1862413e5c/src/utils/ether-to-wei.ts#LL31C12-L31C31
Let's wait on this with the first priority now being a full refresh of the landing page.
I really like viem.sh and would love your input/shaping of this new website @jtfirek 🙏