Initial commit with 🏗️ create-eth @ 2.0.4

This commit is contained in:
han
2026-01-12 10:42:14 +07:00
commit fd53a8187a
126 changed files with 27771 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import { parseEther } from "viem";
export function multiplyTo1e18(tokens: string | bigint) {
try {
return parseEther(tokens.toString());
} catch (err) {
// wrong tokens value
return 0n;
}
}
export function getTokenPrice(tokens: string | bigint, tokensPerEth?: bigint) {
const tokensMultiplied = multiplyTo1e18(tokens);
return tokensPerEth ? tokensMultiplied / tokensPerEth : tokensMultiplied;
}