Skip to content

Commit

Permalink
fix(deps): fix dependencies versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubilmax committed Oct 13, 2022
1 parent cae96b4 commit c8c8f98
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 453 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
},
"homepage": "https://github.com/Rubilmax/ethers-maths#readme",
"dependencies": {
"ethers": "^5.0.0"
"@ethersproject/bignumber": "^5.7.0",
"@ethersproject/units": "^5.7.0"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^3.3.0",
Expand All @@ -63,9 +64,7 @@
"ts-jest": "^27.0.5",
"typescript": "^4.7.4"
},
"peerDependencies": {
"ethers": "^5.7.0"
},
"peerDependencies": {},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
Expand Down
17 changes: 9 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BigNumber, BigNumberish, utils } from "ethers";
import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
import { formatUnits, parseUnits } from "@ethersproject/units";

import { avgUp, max, min, mulDivUp, pow10 } from "./utils";

Expand All @@ -15,7 +16,7 @@ const HALF_WAD_PERCENT_RATIO = WAD_PERCENT_RATIO.div(2);
const RAY_PERCENT_RATIO = RAY.div(PERCENT);
const HALF_RAY_PERCENT_RATIO = RAY_PERCENT_RATIO.div(2);

declare module "ethers" {
declare module "@ethersproject/bignumber" {
interface BigNumber {
min: (other: BigNumberish) => BigNumber;
max: (other: BigNumberish) => BigNumber;
Expand Down Expand Up @@ -99,7 +100,7 @@ BigNumber.prototype.percentToRay = function () {
return this.mul(RAY_PERCENT_RATIO);
};
BigNumber.prototype.formatPercent = function () {
return utils.formatUnits(this, 2);
return formatUnits(this, 2);
};

BigNumber.prototype.wadAdd = function (wad: BigNumberish) {
Expand All @@ -124,7 +125,7 @@ BigNumber.prototype.wadToRay = function () {
return this.mul(RAY_WAD_RATIO);
};
BigNumber.prototype.formatWad = function () {
return utils.formatUnits(this, 18);
return formatUnits(this, 18);
};

BigNumber.prototype.rayAdd = function (ray: BigNumberish) {
Expand All @@ -149,16 +150,16 @@ BigNumber.prototype.rayToWad = function () {
return this.add(HALF_RAY_WAD_RATIO).div(RAY_WAD_RATIO);
};
BigNumber.prototype.formatRay = function () {
return utils.formatUnits(this, 27);
return formatUnits(this, 27);
};

BigNumber.pow10 = pow10;
BigNumber.parsePercent = function (value: string) {
return utils.parseUnits(value, 2);
return parseUnits(value, 2);
};
BigNumber.parseWad = function (value: string) {
return utils.parseUnits(value, 18);
return parseUnits(value, 18);
};
BigNumber.parseRay = function (value: string) {
return utils.parseUnits(value, 27);
return parseUnits(value, 27);
};
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BigNumber, BigNumberish } from "ethers";
import { BigNumber, BigNumberish } from "@ethersproject/bignumber";

export const pow10 = (power: BigNumberish) => BigNumber.from(10).pow(power);

Expand Down
2 changes: 1 addition & 1 deletion test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BigNumber } from "ethers";
import { BigNumber } from "@ethersproject/bignumber";

import "../src";

Expand Down
Loading

0 comments on commit c8c8f98

Please sign in to comment.