@morpho-org/blue-sdk 2.0.0-alpha.3 → 2.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morpho-org/blue-sdk",
3
- "version": "2.0.0-alpha.3",
3
+ "version": "2.0.0-alpha.5",
4
4
  "author": "Morpho Association <contact@morpho.org>",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -10,20 +10,18 @@
10
10
  "scripts": {
11
11
  "prepublish": "yarn build",
12
12
  "build": "tsc --build tsconfig.build.json",
13
- "test-jest": "jest",
14
- "test-hardhat": "hardhat test"
13
+ "test": "hardhat test"
15
14
  },
16
15
  "dependencies": {
17
16
  "keccak256": "^1.0.6"
18
17
  },
19
18
  "devDependencies": {
20
- "@morpho-org/morpho-test": "^2.0.0-alpha.3",
21
- "@morpho-org/morpho-ts": "^2.0.0-alpha.3",
19
+ "@morpho-org/morpho-test": "^2.0.0-alpha.5",
20
+ "@morpho-org/morpho-ts": "^2.0.0-alpha.5",
22
21
  "@nomicfoundation/hardhat-ethers": "^3.0.6",
23
22
  "@nomicfoundation/hardhat-network-helpers": "^1.0.11",
24
23
  "@types/chai": "^4.3.14",
25
24
  "@types/chai-as-promised": "^7.1.2",
26
- "@types/jest": "^29.5.12",
27
25
  "@types/mocha": "^10.0.6",
28
26
  "@types/node": "^22.1.0",
29
27
  "chai": "^4.3.10",
@@ -35,36 +33,16 @@
35
33
  "hardhat": "^2.22.6",
36
34
  "hardhat-deal": "^3.1.0",
37
35
  "hardhat-tracer": "^3.1.0",
38
- "jest": "^29.7.0",
39
36
  "mocha": "^10.4.0",
40
- "ts-jest": "^29.2.4",
41
37
  "ts-node": "^10.9.2",
42
- "typescript": "^5.6.2"
38
+ "typescript": "^5.6.2",
39
+ "vitest": "^2.1.1"
43
40
  },
44
41
  "peerDependencies": {
45
- "@morpho-org/morpho-ts": "^2.0.0-alpha.3"
42
+ "@morpho-org/morpho-ts": "^2.0.0-alpha.5"
46
43
  },
47
44
  "publishConfig": {
48
45
  "access": "public"
49
46
  },
50
- "jest": {
51
- "verbose": true,
52
- "testTimeout": 15000,
53
- "maxWorkers": 1,
54
- "transform": {
55
- "^.+\\.tsx?$": [
56
- "ts-jest",
57
- {
58
- "tsconfig": "tsconfig.json"
59
- }
60
- ]
61
- },
62
- "testRegex": "(/src/.*|(\\.|/)(test|spec)+)\\.test\\.(jsx?|tsx?)$",
63
- "moduleFileExtensions": [
64
- "js",
65
- "ts"
66
- ],
67
- "preset": "ts-jest"
68
- },
69
- "gitHead": "20ba4884a2b8919ceaff88959ab5d29f97183ab6"
47
+ "gitHead": "c09c4cc1cfddf0965b1a8dde07950c32c19bec39"
70
48
  }
@@ -1 +0,0 @@
1
- export {};
package/lib/chain.test.js DELETED
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const morpho_ts_1 = require("@morpho-org/morpho-ts");
4
- const chain_1 = require("./chain");
5
- describe("Network", () => {
6
- it("Should have consistent chainIds", () => {
7
- (0, morpho_ts_1.entries)(chain_1.ChainUtils.CHAIN_METADATA).forEach(([chainId, { id }]) => {
8
- expect(+chainId).toEqual(id);
9
- });
10
- });
11
- it("Should have Testnet in the name for testnet chains", () => {
12
- Object.values(chain_1.ChainUtils.CHAIN_METADATA)
13
- .filter(({ isTestnet }) => isTestnet)
14
- .forEach(({ name }) => {
15
- expect(name).toMatch(/Testnet/);
16
- });
17
- });
18
- it("Should convert correctly a chainId to hexChainId", () => {
19
- expect(chain_1.ChainUtils.toHexChainId(chain_1.ChainId.BaseMainnet)).toEqual("0x2105");
20
- });
21
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const maths_1 = require("../maths");
4
- const MarketUtils_1 = require("./MarketUtils");
5
- const market = {
6
- loanToken: "0x0000000000000000000000000000000000000001",
7
- collateralToken: "0x0000000000000000000000000000000000000002",
8
- oracle: "0x0000000000000000000000000000000000000003",
9
- irm: "0x0000000000000000000000000000000000000004",
10
- lltv: 860000000000000000n,
11
- };
12
- describe("MarketUtils", () => {
13
- it("should calculate the correct market id", () => {
14
- expect(MarketUtils_1.MarketUtils.getMarketId(market)).toEqual("0x625e29dff74826b71c1f4c74b208a896109cc8ac9910192ce2927a982b0809e6");
15
- });
16
- it("should calculate the correct liquidation incentive factor", () => {
17
- expect(MarketUtils_1.MarketUtils.getLiquidationIncentiveFactor(market)).toEqual(1043841336116910229n);
18
- });
19
- it("should calculate the supply volume to reach utilization", () => {
20
- expect(MarketUtils_1.MarketUtils.getSupplyToUtilization({ totalSupplyAssets: maths_1.MathLib.WAD, totalBorrowAssets: maths_1.MathLib.WAD }, 900000000000000000n)).toEqual(111111111111111112n);
21
- expect(MarketUtils_1.MarketUtils.getSupplyToUtilization({ totalSupplyAssets: maths_1.MathLib.WAD, totalBorrowAssets: 0n }, 900000000000000000n)).toEqual(0n);
22
- expect(MarketUtils_1.MarketUtils.getSupplyToUtilization({ totalSupplyAssets: maths_1.MathLib.WAD, totalBorrowAssets: 0n }, 0n)).toEqual(0n);
23
- expect(MarketUtils_1.MarketUtils.getSupplyToUtilization({ totalSupplyAssets: maths_1.MathLib.WAD, totalBorrowAssets: 1n }, 0n)).toEqual(maths_1.MathLib.MAX_UINT_256);
24
- });
25
- it("should calculate the withdraw volume to reach utilization", () => {
26
- expect(MarketUtils_1.MarketUtils.getWithdrawToUtilization({ totalSupplyAssets: maths_1.MathLib.WAD, totalBorrowAssets: maths_1.MathLib.WAD }, 900000000000000000n)).toEqual(0n);
27
- expect(MarketUtils_1.MarketUtils.getWithdrawToUtilization({ totalSupplyAssets: 2n * maths_1.MathLib.WAD, totalBorrowAssets: maths_1.MathLib.WAD }, 900000000000000000n)).toEqual(888888888888888888n);
28
- expect(MarketUtils_1.MarketUtils.getWithdrawToUtilization({ totalSupplyAssets: maths_1.MathLib.WAD, totalBorrowAssets: 0n }, 900000000000000000n)).toEqual(maths_1.MathLib.WAD);
29
- });
30
- it("should calculate the borrow volume to reach utilization", () => {
31
- expect(MarketUtils_1.MarketUtils.getBorrowToUtilization({ totalSupplyAssets: maths_1.MathLib.WAD, totalBorrowAssets: maths_1.MathLib.WAD }, 900000000000000000n)).toEqual(0n);
32
- expect(MarketUtils_1.MarketUtils.getBorrowToUtilization({ totalSupplyAssets: maths_1.MathLib.WAD, totalBorrowAssets: 0n }, 900000000000000000n)).toEqual(900000000000000000n);
33
- });
34
- it("should calculate the repay volume to reach utilization", () => {
35
- expect(MarketUtils_1.MarketUtils.getRepayToUtilization({ totalSupplyAssets: maths_1.MathLib.WAD, totalBorrowAssets: maths_1.MathLib.WAD }, 900000000000000000n)).toEqual(100000000000000000n);
36
- expect(MarketUtils_1.MarketUtils.getRepayToUtilization({ totalSupplyAssets: maths_1.MathLib.WAD, totalBorrowAssets: 0n }, 900000000000000000n)).toEqual(0n);
37
- });
38
- });