@huma-finance/widgets 0.0.63-beta.746 → 0.0.63-beta.751

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": "@huma-finance/widgets",
3
- "version": "0.0.63-beta.746+efaca45",
3
+ "version": "0.0.63-beta.751+cd8ae08",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -29,9 +29,9 @@
29
29
  "@ethersproject/experimental": "^5.7.0",
30
30
  "@ethersproject/providers": "^5.6.0",
31
31
  "@ethersproject/units": "^5.6.0",
32
- "@huma-finance/sdk": "^0.0.63-beta.746+efaca45",
33
- "@huma-finance/shared": "^0.0.63-beta.746+efaca45",
34
- "@huma-finance/web-shared": "^0.0.63-beta.746+efaca45",
32
+ "@huma-finance/sdk": "^0.0.63-beta.751+cd8ae08",
33
+ "@huma-finance/shared": "^0.0.63-beta.751+cd8ae08",
34
+ "@huma-finance/web-shared": "^0.0.63-beta.751+cd8ae08",
35
35
  "@mui/x-date-pickers": "^5.0.7",
36
36
  "@notifi-network/notifi-frontend-client": "^1.1.2",
37
37
  "@notifi-network/notifi-react": "^1.1.2",
@@ -201,5 +201,5 @@
201
201
  "optionalDependencies": {
202
202
  "encoding": "^0.1.13"
203
203
  },
204
- "gitHead": "efaca45d25c081b77a8f12188b41ccabe906ed72"
204
+ "gitHead": "cd8ae083994c75b06335738fc3e4ef3a1c5adc19"
205
205
  }
@@ -45,7 +45,10 @@ export function ChooseAmount({
45
45
  const juniorTrancheAssetsBN = new BN(juniorTrancheAssets ?? 0)
46
46
  const seniorTrancheAssetsBN = new BN(seniorTrancheAssets ?? 0)
47
47
  const totalDeployedBN = seniorTrancheAssetsBN.add(juniorTrancheAssetsBN)
48
- const totalAvailableCapBN = new BN(liquidityCap ?? 0).sub(totalDeployedBN)
48
+ let totalAvailableCapBN = new BN(liquidityCap ?? 0).sub(totalDeployedBN)
49
+ totalAvailableCapBN = totalAvailableCapBN.ltn(0)
50
+ ? new BN(0)
51
+ : totalAvailableCapBN
49
52
  const maxSeniorAssetsBN = juniorTrancheAssetsBN.muln(
50
53
  maxSeniorJuniorRatio ?? 0,
51
54
  )
@@ -41,7 +41,9 @@ export function ChooseAmount({
41
41
  const juniorTrancheAssetsBN = BigInt(juniorTrancheAssets ?? 0)
42
42
  const seniorTrancheAssetsBN = BigInt(seniorTrancheAssets ?? 0)
43
43
  const totalDeployedBN = seniorTrancheAssetsBN + juniorTrancheAssetsBN
44
- const totalAvailableCapBN = BigInt(liquidityCap ?? 0) - totalDeployedBN
44
+ let totalAvailableCapBN = BigInt(liquidityCap ?? 0) - totalDeployedBN
45
+ totalAvailableCapBN =
46
+ totalAvailableCapBN < 0 ? BigInt(0) : totalAvailableCapBN
45
47
  const maxSeniorAssetsBN =
46
48
  juniorTrancheAssetsBN * BigInt(maxSeniorJuniorRatio ?? 0)
47
49
  let seniorAvailableCapBN = maxSeniorAssetsBN - seniorTrancheAssetsBN
@@ -48,7 +48,10 @@ export function ChooseAmount({
48
48
  const { juniorAvailableCapBN, seniorAvailableCapBN } = useMemo(() => {
49
49
  const { maxSeniorJuniorRatio, liquidityCap: liquidityCapBN } = lpConfig
50
50
  const totalDeployedBN = seniorAssetsBN.add(juniorAssetsBN)
51
- const totalAvailableCapBN = liquidityCapBN.sub(totalDeployedBN)
51
+ let totalAvailableCapBN = liquidityCapBN.sub(totalDeployedBN)
52
+ totalAvailableCapBN = totalAvailableCapBN.lt(0)
53
+ ? BigNumber.from(0)
54
+ : totalAvailableCapBN
52
55
  const maxSeniorAssetsBN = juniorAssetsBN.mul(maxSeniorJuniorRatio)
53
56
  let seniorAvailableCapBN = maxSeniorAssetsBN.sub(seniorAssetsBN)
54
57
  seniorAvailableCapBN = seniorAvailableCapBN.gt(totalAvailableCapBN)