@huma-finance/widgets 0.0.77-beta.1006 → 0.0.77-beta.1010

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/dist/index.js CHANGED
@@ -59818,12 +59818,13 @@ const MILLISECONDS = 1e3, DAY_SECONDS = 24 * 60 * 60, TIME_FORMAT_LL = "ll", tim
59818
59818
  } catch {
59819
59819
  return 0;
59820
59820
  }
59821
- }, sleep$3 = (ar) => new Promise((or) => setTimeout(or, ar)), timeUtil = {
59821
+ }, formatDate = (ar, or = "MMM D, YYYY") => hooks$1(ar).format(or), sleep$3 = (ar) => new Promise((or) => setTimeout(or, ar)), timeUtil = {
59822
59822
  timestampToStr,
59823
59823
  timestampToLL,
59824
59824
  getUnixTimestamp,
59825
59825
  secondsToDays,
59826
- sleep: sleep$3
59826
+ sleep: sleep$3,
59827
+ formatDate
59827
59828
  };
59828
59829
  var TxStateType;
59829
59830
  (function(ar) {
@@ -70286,6 +70287,39 @@ function getHumaAccountPoints(ar, or) {
70286
70287
  throw console.error(fr), new Error(COMMON_ERROR_MESSAGE);
70287
70288
  });
70288
70289
  }
70290
+ function getSeasonPoints(ar, or) {
70291
+ const ur = configUtil.getCampaignAPIUrl(ar, or), cr = gql$1`
70292
+ query {
70293
+ seasonPoints {
70294
+ ... on SeasonPointsResult {
70295
+ data {
70296
+ seasonName
70297
+ endsAt
70298
+ totalPoints
70299
+ basePoints
70300
+ liquidityPoints
70301
+ referralPoints
70302
+ bonusPoints
70303
+ }
70304
+ }
70305
+ ... on PointServiceError {
70306
+ errMessage
70307
+ }
70308
+ }
70309
+ }
70310
+ `;
70311
+ return requestPost(ur, JSON.stringify({ query: cr })).then((fr) => {
70312
+ var lr, dr, pr;
70313
+ if (fr.errors)
70314
+ throw console.log(fr.errors), new Error(COMMON_ERROR_MESSAGE);
70315
+ const hr = (dr = (lr = fr.data) === null || lr === void 0 ? void 0 : lr.seasonPoints) === null || dr === void 0 ? void 0 : dr.errMessage;
70316
+ if (hr)
70317
+ throw console.error(hr), new Error(hr);
70318
+ return (pr = fr.data) === null || pr === void 0 ? void 0 : pr.seasonPoints.data;
70319
+ }).catch((fr) => {
70320
+ throw console.error(fr), new Error(COMMON_ERROR_MESSAGE);
70321
+ });
70322
+ }
70289
70323
  function getEstimatedPoints(ar, or, ur, cr) {
70290
70324
  const fr = configUtil.getCampaignAPIUrl(ur, cr), lr = gql$1`
70291
70325
  query {
@@ -70353,7 +70387,8 @@ const CampaignService = {
70353
70387
  getLeaderboard,
70354
70388
  getHumaAccountRanking,
70355
70389
  getHumaAccountPoints,
70356
- updateHumaAccountPoints
70390
+ updateHumaAccountPoints,
70391
+ getSeasonPoints
70357
70392
  }, isRejection = (ar) => ar !== null && typeof ar == "object" && Array.isArray(ar.reasons), approve = async (ar, or, ur = !1) => {
70358
70393
  const cr = await requestPost(`${configUtil.getEAVerseUrl(or, ur)}/underwriter/underwrite`, ar), { result: fr } = cr;
70359
70394
  if (isRejection(fr))
@@ -182986,7 +183021,9 @@ function SolanaLendWithdraw({
182986
183021
  new LoggingContextHelper(Vr).logAction("StartFlow", {}), pr(setLoggingContext(Vr)), pr(setStep(WIDGET_STEP.ConfirmTransfer));
182987
183022
  }
182988
183023
  }, [pr, ar.chainId, ar.poolName, ar.poolType, hr]), useEffect(() => {
182989
- const Vr = fr === "senior" ? or.seniorTrancheAssets : or.juniorTrancheAssets, Yr = new BN$1(Vr ?? 1), Dr = new BN$1(cr.supply.toString() ?? 1), br = Yr.muln(1e5).div(Dr).toNumber() / 1e5;
183024
+ const Vr = fr === "senior" ? or.seniorTrancheAssets : or.juniorTrancheAssets, Yr = new BN$1(Vr ?? 1), Dr = new BN$1(
183025
+ cr.supply.toString()
183026
+ ).isZero() ? new BN$1(1) : new BN$1(cr.supply.toString()), br = Yr.muln(1e5).div(Dr).toNumber() / 1e5;
182990
183027
  Cr(br);
182991
183028
  }, [
182992
183029
  or.juniorTrancheAssets,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huma-finance/widgets",
3
- "version": "0.0.77-beta.1006+ec60cbc",
3
+ "version": "0.0.77-beta.1010+cad23bb",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -22,9 +22,9 @@
22
22
  "@ethersproject/contracts": "^5.7.0",
23
23
  "@ethersproject/experimental": "^5.7.0",
24
24
  "@ethersproject/units": "^5.6.0",
25
- "@huma-finance/sdk": "^0.0.77-beta.1006+ec60cbc",
26
- "@huma-finance/shared": "^0.0.77-beta.1006+ec60cbc",
27
- "@huma-finance/web-shared": "^0.0.77-beta.1006+ec60cbc",
25
+ "@huma-finance/sdk": "^0.0.77-beta.1010+cad23bb",
26
+ "@huma-finance/shared": "^0.0.77-beta.1010+cad23bb",
27
+ "@huma-finance/web-shared": "^0.0.77-beta.1010+cad23bb",
28
28
  "@mui/x-date-pickers": "^5.0.7",
29
29
  "@notifi-network/notifi-frontend-client": "^1.1.2",
30
30
  "@notifi-network/notifi-react": "^1.1.2",
@@ -190,5 +190,5 @@
190
190
  "optionalDependencies": {
191
191
  "encoding": "^0.1.13"
192
192
  },
193
- "gitHead": "ec60cbc7be95cd34132898dd55f4dccd91c50297"
193
+ "gitHead": "cad23bbd7959598dd3e5ad45761259a4e5a98666"
194
194
  }
@@ -113,7 +113,11 @@ export function SolanaLendWithdraw({
113
113
  : poolState.juniorTrancheAssets
114
114
 
115
115
  const trancheAssetsVal = new BN(trancheAssets ?? 1)
116
- const trancheSupplyVal = new BN(trancheMintAccount.supply.toString() ?? 1)
116
+ const trancheSupplyVal = new BN(
117
+ trancheMintAccount.supply.toString(),
118
+ ).isZero()
119
+ ? new BN(1)
120
+ : new BN(trancheMintAccount.supply.toString())
117
121
  const sharePrice =
118
122
  trancheAssetsVal.muln(100000).div(trancheSupplyVal).toNumber() / 100000
119
123
  setSharePrice(sharePrice)