import { transactionErrorCodes as e } from "../../error-handling/error-codes.constants.mjs";
import { ethers as t } from "ethers";
//#region libs/shared/common/src/functions/web3/etherFunctions.ts
var n = (e) => BigInt(t.hexlify(t.randomBytes(e))), r = (e, n) => t.formatUnits(n, e.decimals), i = (n, r) => {
	let i = 10 ** (18 - n.decimals);
	try {
		return t.parseUnits(r) / BigInt(i);
	} catch {
		throw Error(e.DECIMALS_LIMIT);
	}
}, a = (n, r, i) => {
	let a = t.formatUnits(n, r.decimals), o = BigInt(10 ** (18 - i));
	try {
		let e = t.parseUnits(a) / o;
		return t.formatUnits(e, i);
	} catch {
		throw Error(e.DECIMALS_LIMIT);
	}
};
//#endregion
export { r as getAmountInToken, i as getAmountInWei, a as getAmountWithPrecision, n as randomBigInt };
