@huma-finance/widgets 0.0.78-beta.1044 → 0.0.78-beta.1046

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
@@ -54057,6 +54057,7 @@ var CURRENCY_CODE;
54057
54057
  (function(ar) {
54058
54058
  ar[ar.USD = 840] = "USD";
54059
54059
  })(CURRENCY_CODE || (CURRENCY_CODE = {}));
54060
+ const FEATHERS_TO_HUMA_RATIO = 30;
54060
54061
  var HUMA_ACCOUNT_EXCEPTION;
54061
54062
  (function(ar) {
54062
54063
  ar.AccountTokenNotFoundException = "AccountTokenNotFoundException", ar.InvalidAccountTokenException = "InvalidAccountTokenException", ar.WalletNotSignedInException = "WalletNotSignedInException", ar.WalletNotCreatedException = "WalletNotCreatedException";
@@ -54080,6 +54081,15 @@ class EARejectionError extends Error {
54080
54081
  super(EARejectMessage);
54081
54082
  }
54082
54083
  }
54084
+ function isValidHttpUrl(ar) {
54085
+ let or;
54086
+ try {
54087
+ or = new URL(ar);
54088
+ } catch {
54089
+ return !1;
54090
+ }
54091
+ return or.protocol === "http:" || or.protocol === "https:";
54092
+ }
54083
54093
  function getBlockchainConfigFromChain(ar) {
54084
54094
  switch (ar) {
54085
54095
  case ChainEnum.Celo:
@@ -59828,20 +59838,6 @@ const MILLISECONDS = 1e3, DAY_SECONDS = 24 * 60 * 60, TIME_FORMAT_LL = "ll", tim
59828
59838
  sleep: sleep$3,
59829
59839
  formatDate
59830
59840
  };
59831
- var TxStateType;
59832
- (function(ar) {
59833
- ar.Success = "Success", ar.Denied = "Denied", ar.Invalid = "Invalid", ar.Failed = "Failed", ar.New = "New", ar.GasEstimating = "GasEstimating", ar.Signing = "Signing", ar.Confirming = "Confirming";
59834
- })(TxStateType || (TxStateType = {}));
59835
- const isTxFailed = (ar) => [TxStateType.Denied, TxStateType.Invalid, TxStateType.Failed].includes(ar), decodeLogs = (ar, or) => {
59836
- const ur = [], cr = new Interface(or);
59837
- for (const fr of ar)
59838
- try {
59839
- ur.push(cr.parseLog(fr));
59840
- } catch (lr) {
59841
- console.error(lr);
59842
- }
59843
- return ur;
59844
- };
59845
59841
  function parseUnits$1(ar, or) {
59846
59842
  var ur;
59847
59843
  const cr = BigInt(ar.replace(".", "")), fr = BigInt(10) ** BigInt(or);
@@ -59858,16 +59854,20 @@ const tokenDecimalUtils = {
59858
59854
  parseUnits: parseUnits$1,
59859
59855
  formatUnits: formatUnits$1
59860
59856
  };
59861
- function isValidHttpUrl(ar) {
59862
- let or;
59863
- try {
59864
- or = new URL(ar);
59865
- } catch {
59866
- return !1;
59867
- }
59868
- return or.protocol === "http:" || or.protocol === "https:";
59869
- }
59870
- const defaultJsonSerializer$1 = JSON, uppercase = (ar) => ar.toUpperCase(), HeadersInstanceToPlainObject = (ar) => {
59857
+ var TxStateType;
59858
+ (function(ar) {
59859
+ ar.Success = "Success", ar.Denied = "Denied", ar.Invalid = "Invalid", ar.Failed = "Failed", ar.New = "New", ar.GasEstimating = "GasEstimating", ar.Signing = "Signing", ar.Confirming = "Confirming";
59860
+ })(TxStateType || (TxStateType = {}));
59861
+ const isTxFailed = (ar) => [TxStateType.Denied, TxStateType.Invalid, TxStateType.Failed].includes(ar), decodeLogs = (ar, or) => {
59862
+ const ur = [], cr = new Interface(or);
59863
+ for (const fr of ar)
59864
+ try {
59865
+ ur.push(cr.parseLog(fr));
59866
+ } catch (lr) {
59867
+ console.error(lr);
59868
+ }
59869
+ return ur;
59870
+ }, defaultJsonSerializer$1 = JSON, uppercase = (ar) => ar.toUpperCase(), HeadersInstanceToPlainObject = (ar) => {
59871
59871
  const or = {};
59872
59872
  return ar.forEach((ur, cr) => {
59873
59873
  or[cr] = ur;
@@ -181036,9 +181036,9 @@ function PointsEarned({
181036
181036
  }) {
181037
181037
  const ur = useTheme(), cr = useDispatch(), fr = useResetAtom(txAtom), { pointsAccumulated: lr } = useAppSelector(selectWidgetState), dr = !isEmpty(lr) && lr > 0, pr = Math.round(
181038
181038
  (ar.withdrawalLockupPeriodDays ?? 0) / 30
181039
- ), hr = pr > 1 ? `${pr} months` : `${pr} month`, Ar = useCallback(() => {
181039
+ ), hr = pr > 1 ? `${pr} months` : `${pr} month`, Ar = lr ? lr / FEATHERS_TO_HUMA_RATIO : void 0, gr = useCallback(() => {
181040
181040
  fr(), cr(resetState()), or({ isSuccess: !0 });
181041
- }, [cr, or, fr]), gr = {
181041
+ }, [cr, or, fr]), yr = {
181042
181042
  wrapper: css`
181043
181043
  height: 518px;
181044
181044
  position: relative;
@@ -181087,32 +181087,32 @@ function PointsEarned({
181087
181087
  font-weight: 700;
181088
181088
  `
181089
181089
  };
181090
- return /* @__PURE__ */ jsxs(Box, { css: gr.wrapper, children: [
181091
- /* @__PURE__ */ jsx(Box, { css: gr.congrats, children: /* @__PURE__ */ jsx(CongratulationsIcon, {}) }),
181092
- /* @__PURE__ */ jsxs(Box, { css: gr.ribbon, children: [
181090
+ return /* @__PURE__ */ jsxs(Box, { css: yr.wrapper, children: [
181091
+ /* @__PURE__ */ jsx(Box, { css: yr.congrats, children: /* @__PURE__ */ jsx(CongratulationsIcon, {}) }),
181092
+ /* @__PURE__ */ jsxs(Box, { css: yr.ribbon, children: [
181093
181093
  /* @__PURE__ */ jsx(RibbonIcon, {}),
181094
- /* @__PURE__ */ jsxs(Box, { css: gr.ribbonContent, children: [
181094
+ /* @__PURE__ */ jsxs(Box, { css: yr.ribbonContent, children: [
181095
181095
  /* @__PURE__ */ jsx(HumaPointsIcon, {}),
181096
- /* @__PURE__ */ jsx(Box, { children: dr ? `${formatNumber$1(lr)} Feathers` : "Feathers earned" })
181096
+ /* @__PURE__ */ jsx(Box, { children: dr ? `${formatNumber$1(Ar)} $HUMA` : "Rewards earned" })
181097
181097
  ] })
181098
181098
  ] }),
181099
- /* @__PURE__ */ jsx(Box, { css: gr.entirePoints, children: dr ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
181099
+ /* @__PURE__ */ jsx(Box, { css: yr.entirePoints, children: dr ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
181100
181100
  /* @__PURE__ */ jsx(Box, { children: "Congratulations," }),
181101
181101
  /* @__PURE__ */ jsxs(Box, { children: [
181102
181102
  "you've earned ",
181103
- lr,
181104
- " Feathers"
181103
+ Ar,
181104
+ " $HUMA"
181105
181105
  ] })
181106
181106
  ] }) : /* @__PURE__ */ jsx(Box, { children: "Congratulations on joining the Huma Protocol!" }) }),
181107
- /* @__PURE__ */ jsxs(Box, { css: gr.entirePointsDetails, children: [
181108
- "You'll earn Feathers ",
181109
- /* @__PURE__ */ jsx("span", { css: gr.everyday, children: "everyday" }),
181107
+ /* @__PURE__ */ jsxs(Box, { css: yr.entirePointsDetails, children: [
181108
+ "You'll earn rewards ",
181109
+ /* @__PURE__ */ jsx("span", { css: yr.everyday, children: "everyday" }),
181110
181110
  " for",
181111
181111
  " ",
181112
181112
  hr,
181113
181113
  " straight."
181114
181114
  ] }),
181115
- /* @__PURE__ */ jsx(BottomButton, { variant: "contained", onClick: Ar, children: "GREAT" })
181115
+ /* @__PURE__ */ jsx(BottomButton, { variant: "contained", onClick: gr, children: "GREAT" })
181116
181116
  ] });
181117
181117
  }
181118
181118
  var persona = { exports: {} }, hasRequiredPersona;
@@ -182418,7 +182418,7 @@ function PersonaEvaluation({
182418
182418
  }
182419
182419
  ) : /* @__PURE__ */ jsxs(WrapperModal, { title: Rr.title, children: [
182420
182420
  /* @__PURE__ */ jsx(Box, { css: Fr.iconWrapper, children: /* @__PURE__ */ jsx("img", { src: ApproveLenderImg, alt: "approve-lender" }) }),
182421
- or && Rr === Ir.verifyIdentity ? /* @__PURE__ */ jsx(Box, { css: Fr.description, children: /* @__PURE__ */ jsx("span", { children: "You'll be rewarded with Huma Feathers after completing KYC/KYB and your first investment." }) }) : /* @__PURE__ */ jsx(Box, { css: Fr.description, children: Rr.description }),
182421
+ or && Rr === Ir.verifyIdentity ? /* @__PURE__ */ jsx(Box, { css: Fr.description, children: /* @__PURE__ */ jsx("span", { children: "You'll be rewarded with Huma rewards after completing KYC/KYB and your first investment." }) }) : /* @__PURE__ */ jsx(Box, { css: Fr.description, children: Rr.description }),
182422
182422
  !!Rr.buttonText && /* @__PURE__ */ jsx(BottomButton, { variant: "contained", onClick: Nr, children: Rr.buttonText })
182423
182423
  ] });
182424
182424
  }
@@ -182766,7 +182766,7 @@ function Transfer$a({
182766
182766
  );
182767
182767
  lr(setPointsAccumulated(Vr.pointsAccumulated));
182768
182768
  } catch (Vr) {
182769
- console.error("Failed to update wallet Feathers", Vr);
182769
+ console.error("Failed to update wallet rewards", Vr);
182770
182770
  }
182771
182771
  lr(setStep(WIDGET_STEP.Done));
182772
182772
  },
@@ -182898,7 +182898,7 @@ function Success$8({
182898
182898
  subContent: gr(),
182899
182899
  chainId: ar.chainId,
182900
182900
  solanaSignature: pr,
182901
- buttonText: ur && !cr ? "VIEW FEATHERS" : "DONE"
182901
+ buttonText: ur && !cr ? "VIEW REWARDS" : "DONE"
182902
182902
  }
182903
182903
  );
182904
182904
  }
@@ -228356,7 +228356,7 @@ function Transfer$6({
228356
228356
  );
228357
228357
  lr(setPointsAccumulated(Cr.pointsAccumulated));
228358
228358
  } catch (Cr) {
228359
- console.error("Failed to update wallet Feathers", Cr);
228359
+ console.error("Failed to update wallet rewards", Cr);
228360
228360
  }
228361
228361
  lr(setStep(WIDGET_STEP.Done));
228362
228362
  },
@@ -228404,7 +228404,7 @@ function Success$5({
228404
228404
  qr.unix()
228405
228405
  )}.`
228406
228406
  ];
228407
- }, Ur = () => Cr ? "WHAT'S NEXT" : ur ? "VIEW FEATHERS" : void 0;
228407
+ }, Ur = () => Cr ? "WHAT'S NEXT" : ur ? "VIEW REWARDS" : void 0;
228408
228408
  return /* @__PURE__ */ jsx(
228409
228409
  TxDoneModal,
228410
228410
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huma-finance/widgets",
3
- "version": "0.0.78-beta.1044+24ff73d",
3
+ "version": "0.0.78-beta.1046+aae9acb",
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.78-beta.1044+24ff73d",
26
- "@huma-finance/shared": "^0.0.78-beta.1044+24ff73d",
27
- "@huma-finance/web-shared": "^0.0.78-beta.1044+24ff73d",
25
+ "@huma-finance/sdk": "^0.0.78-beta.1046+aae9acb",
26
+ "@huma-finance/shared": "^0.0.78-beta.1046+aae9acb",
27
+ "@huma-finance/web-shared": "^0.0.78-beta.1046+aae9acb",
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": "24ff73d70fb62e039002e258535f1c126869f30d"
193
+ "gitHead": "aae9acb98b1bf765463e9773c6c64d496396009b"
194
194
  }
@@ -345,7 +345,7 @@ export function PersonaEvaluation({
345
345
  {campaign && kycCopy === KYCCopies.verifyIdentity ? (
346
346
  <Box css={styles.description}>
347
347
  <span>
348
- You'll be rewarded with Huma Feathers after completing KYC/KYB and
348
+ You'll be rewarded with Huma rewards after completing KYC/KYB and
349
349
  your first investment.
350
350
  </span>
351
351
  </Box>
@@ -83,7 +83,7 @@ export function Transfer({
83
83
  )
84
84
  dispatch(setPointsAccumulated(result.pointsAccumulated))
85
85
  } catch (error) {
86
- console.error('Failed to update wallet Feathers', error)
86
+ console.error('Failed to update wallet rewards', error)
87
87
  }
88
88
  }
89
89
  dispatch(setStep(WIDGET_STEP.Done))
@@ -69,7 +69,7 @@ export function Success({
69
69
  subContent={getSubContent()}
70
70
  chainId={poolInfo.chainId}
71
71
  solanaSignature={solanaSignature}
72
- buttonText={campaign && !isExistingUser ? 'VIEW FEATHERS' : 'DONE'}
72
+ buttonText={campaign && !isExistingUser ? 'VIEW REWARDS' : 'DONE'}
73
73
  />
74
74
  )
75
75
  }
@@ -2,6 +2,7 @@ import {
2
2
  CampaignService,
3
3
  CHAIN_TYPE,
4
4
  CloseModalOptions,
5
+ FEATHERS_TO_HUMA_RATIO,
5
6
  formatNumber,
6
7
  isEmpty,
7
8
  NETWORK_TYPE,
@@ -61,6 +62,10 @@ export function PointsEarned({
61
62
  lockupMonths > 1 ? `${lockupMonths} months` : `${lockupMonths} month`
62
63
  const [state, setState] = useState<STATE>(STATE.Loading)
63
64
 
65
+ const rewardsAccumulated = pointsAccumulated
66
+ ? pointsAccumulated / FEATHERS_TO_HUMA_RATIO
67
+ : undefined
68
+
64
69
  useEffect(() => {
65
70
  const updateWalletPoints = async () => {
66
71
  try {
@@ -74,7 +79,7 @@ export function PointsEarned({
74
79
  setPointsAccumulated(result.pointsAccumulated)
75
80
  setState(STATE.Congrats)
76
81
  } catch (error) {
77
- console.error('Failed to update wallet Feathers', error)
82
+ console.error('Failed to update wallet rewards', error)
78
83
  }
79
84
  }
80
85
  updateWalletPoints()
@@ -138,7 +143,7 @@ export function PointsEarned({
138
143
 
139
144
  if (state === STATE.SignIn) {
140
145
  return (
141
- <SignIn description='Please sign in to check the Feathers that you earned.' />
146
+ <SignIn description='Please sign in to check the rewards that you earned.' />
142
147
  )
143
148
  }
144
149
 
@@ -154,8 +159,8 @@ export function PointsEarned({
154
159
  <HumaPointsIcon />
155
160
  <Box>
156
161
  {hasPointsAccumulated
157
- ? `${formatNumber(pointsAccumulated)} Feathers`
158
- : 'Feathers earned'}
162
+ ? `${formatNumber(rewardsAccumulated)} $HUMA`
163
+ : 'Rewards earned'}
159
164
  </Box>
160
165
  </Box>
161
166
  </Box>
@@ -163,14 +168,14 @@ export function PointsEarned({
163
168
  {hasPointsAccumulated ? (
164
169
  <>
165
170
  <Box>Congratulations,</Box>
166
- <Box>you've earned {pointsAccumulated} Feathers</Box>
171
+ <Box>you've earned {rewardsAccumulated} $HUMA</Box>
167
172
  </>
168
173
  ) : (
169
174
  <Box>Congratulations on joining the Huma Protocol!</Box>
170
175
  )}
171
176
  </Box>
172
177
  <Box css={styles.entirePointsDetails}>
173
- You'll earn Feathers <span css={styles.everyday}>everyday</span> for{' '}
178
+ You'll earn rewards <span css={styles.everyday}>everyday</span> for{' '}
174
179
  {monthText} straight.
175
180
  </Box>
176
181
  <BottomButton variant='contained' onClick={handleCloseModal}>
@@ -58,7 +58,7 @@ export function Transfer({
58
58
  )
59
59
  dispatch(setPointsAccumulated(result.pointsAccumulated))
60
60
  } catch (error) {
61
- console.error('Failed to update wallet Feathers', error)
61
+ console.error('Failed to update wallet rewards', error)
62
62
  }
63
63
  }
64
64
  dispatch(setStep(WIDGET_STEP.Done))
@@ -99,7 +99,7 @@ export function Success({
99
99
  if (hasNextStep) {
100
100
  return "WHAT'S NEXT"
101
101
  }
102
- return campaign ? 'VIEW FEATHERS' : undefined
102
+ return campaign ? 'VIEW REWARDS' : undefined
103
103
  }
104
104
 
105
105
  return (
@@ -1,4 +1,9 @@
1
- import { CloseModalOptions, formatNumber, isEmpty } from '@huma-finance/shared'
1
+ import {
2
+ CloseModalOptions,
3
+ FEATHERS_TO_HUMA_RATIO,
4
+ formatNumber,
5
+ isEmpty,
6
+ } from '@huma-finance/shared'
2
7
  import { txAtom } from '@huma-finance/web-shared'
3
8
  import { Box, css, useTheme } from '@mui/material'
4
9
  import { useResetAtom } from 'jotai/utils'
@@ -32,6 +37,10 @@ export function PointsEarned({
32
37
  const monthText =
33
38
  lockupMonths > 1 ? `${lockupMonths} months` : `${lockupMonths} month`
34
39
 
40
+ const rewardsAccumulated = pointsAccumulated
41
+ ? pointsAccumulated / FEATHERS_TO_HUMA_RATIO
42
+ : undefined
43
+
35
44
  const handleCloseModal = useCallback(() => {
36
45
  reset()
37
46
  dispatch(resetState())
@@ -99,8 +108,8 @@ export function PointsEarned({
99
108
  <HumaPointsIcon />
100
109
  <Box>
101
110
  {hasPointsAccumulated
102
- ? `${formatNumber(pointsAccumulated)} Feathers`
103
- : 'Feathers earned'}
111
+ ? `${formatNumber(rewardsAccumulated)} $HUMA`
112
+ : 'Rewards earned'}
104
113
  </Box>
105
114
  </Box>
106
115
  </Box>
@@ -108,14 +117,14 @@ export function PointsEarned({
108
117
  {hasPointsAccumulated ? (
109
118
  <>
110
119
  <Box>Congratulations,</Box>
111
- <Box>you've earned {pointsAccumulated} Feathers</Box>
120
+ <Box>you've earned {rewardsAccumulated} $HUMA</Box>
112
121
  </>
113
122
  ) : (
114
123
  <Box>Congratulations on joining the Huma Protocol!</Box>
115
124
  )}
116
125
  </Box>
117
126
  <Box css={styles.entirePointsDetails}>
118
- You'll earn Feathers <span css={styles.everyday}>everyday</span> for{' '}
127
+ You'll earn rewards <span css={styles.everyday}>everyday</span> for{' '}
119
128
  {monthText} straight.
120
129
  </Box>
121
130
  <BottomButton variant='contained' onClick={handleCloseModal}>