@byzantine/vault-sdk
Version:
Byzantine Vault SDK for creating and managing vaults on Ethereum for restaking strategies
30 lines (29 loc) • 973 B
TypeScript
/**
* Utility functions for unit conversion
*/
/**
* Converts an amount from a human-readable format to wei (or equivalent smallest unit)
* @param amount - Amount in human-readable format
* @param decimals - Number of decimals
* @returns Amount in smallest unit as bigint
*/
export declare function parseUnits(amount: string, decimals: number): bigint;
/**
* Converts an amount from wei (or equivalent smallest unit) to a human-readable format
* @param amount - Amount in smallest unit
* @param decimals - Number of decimals
* @returns Amount in human-readable format
*/
export declare function formatUnits(amount: bigint, decimals: number): string;
/**
* Converts ether to wei
* @param ether - Amount in ether
* @returns Amount in wei as bigint
*/
export declare function parseEther(ether: string): bigint;
/**
* Converts wei to ether
* @param wei - Amount in wei
* @returns Amount in ether
*/
export declare function formatEther(wei: bigint): string;