feat: update ethers@6

fix: bigint errors

fix: TS errors

fix: gasLimit fetch

fix: review comments

fix: contracts errors

chore: bump rc version

fix: revert wrong fix

fix: ts config

fix: ts config

fix: ts config

feat: update signer
This commit is contained in:
Oleg Nechiporenko
2023-09-07 00:12:07 +03:00
parent 27c426e815
commit c2a4084158
38 changed files with 409 additions and 608 deletions

View File

@@ -1,25 +1,25 @@
import { BigNumber } from 'bignumber.js';
import { ethers } from 'ethers';
import { BigNumber } from "bignumber.js";
/**
* Converts denormalized ("human-readable") number to normalized ("machine-readable") number.
* @param input Any numeric value
* @param decimals Blockchain asset precision
* @param roundingMode Rounding mode
* @returns ethers.BigNumber
* @returns bigint
*/
export default function normalizeNumber(
input: BigNumber.Value,
decimals: BigNumber.Value,
roundingMode: BigNumber.RoundingMode,
roundingMode: BigNumber.RoundingMode
) {
const decimalsBN = new BigNumber(decimals);
if (!decimalsBN.isInteger()) throw new Error(`Decimals '${decimalsBN.toString()}' is not an integer`);
if (!decimalsBN.isInteger())
throw new Error(`Decimals '${decimalsBN.toString()}' is not an integer`);
const inputBN = new BigNumber(input);
return ethers.BigNumber.from(
return BigInt(
inputBN
.multipliedBy(new BigNumber(10).pow(decimals))
.integerValue(roundingMode)
.toString(),
.toString()
);
}