Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Convert ether to wei (raw units)
align.blockchain.utils.parseEther(ether: string): bigint
import Align from "@tolbel/align"; const align = new Align({ apiKey: process.env.ALIGN_API_KEY!, environment: "sandbox", }); // Convert 1 ETH to wei const wei = align.blockchain.utils.parseEther("1.0"); console.log(wei.toString()); // "1000000000000000000" // Convert 0.5 ETH to wei const halfWei = align.blockchain.utils.parseEther("0.5"); console.log(halfWei.toString()); // "500000000000000000"
const weiAmount = align.blockchain.utils.parseEther("0.1"); console.log(weiAmount.toString());
const amountInEther = "0.1"; const amountInWei = align.blockchain.utils.parseEther(amountInEther); // Use for contract call const tx = await contract.deposit({ value: amountInWei, });