@huma-finance/widgets 0.0.62-beta.693 → 0.0.62-beta.699

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.62-beta.693+8191572",
3
+ "version": "0.0.62-beta.699+0d992b9",
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.62-beta.693+8191572",
33
- "@huma-finance/shared": "^0.0.62-beta.693+8191572",
34
- "@huma-finance/web-shared": "^0.0.62-beta.693+8191572",
32
+ "@huma-finance/sdk": "^0.0.62-beta.699+0d992b9",
33
+ "@huma-finance/shared": "^0.0.62-beta.699+0d992b9",
34
+ "@huma-finance/web-shared": "^0.0.61",
35
35
  "@mui/icons-material": "^5.3.0",
36
36
  "@mui/material": "^5.0.6",
37
37
  "@mui/styles": "^5.0.2",
@@ -203,5 +203,5 @@
203
203
  "optionalDependencies": {
204
204
  "encoding": "^0.1.13"
205
205
  },
206
- "gitHead": "8191572db7e2ff3ac3cfcebc41075fd60d8a23df"
206
+ "gitHead": "0d992b9eaf4c234189e50cbc26b6edc52f23f93e"
207
207
  }
@@ -1,4 +1,6 @@
1
1
  import {
2
+ CampaignService,
3
+ checkIsDev,
2
4
  getTokenAccounts,
3
5
  SolanaPoolInfo,
4
6
  SolanaTokenUtils,
@@ -6,12 +8,16 @@ import {
6
8
  } from '@huma-finance/shared'
7
9
  import React, { useCallback, useEffect, useState } from 'react'
8
10
 
9
- import { useHumaProgram, useLenderAccounts } from '@huma-finance/web-shared'
11
+ import {
12
+ SolanaPoolState,
13
+ useHumaProgram,
14
+ useLenderAccounts,
15
+ } from '@huma-finance/web-shared'
10
16
  import { TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID } from '@solana/spl-token'
11
17
  import { useWallet } from '@solana/wallet-adapter-react'
12
18
  import { Transaction } from '@solana/web3.js'
13
19
  import { useAppDispatch, useAppSelector } from '../../../hooks/useRedux'
14
- import { setStep } from '../../../store/widgets.reducers'
20
+ import { setPointsAccumulated, setStep } from '../../../store/widgets.reducers'
15
21
  import { selectWidgetState } from '../../../store/widgets.selectors'
16
22
  import { WIDGET_STEP } from '../../../store/widgets.store'
17
23
  import { LoadingModal } from '../../LoadingModal'
@@ -19,13 +25,18 @@ import { SolanaTxSendModal } from '../../SolanaTxSendModal'
19
25
 
20
26
  type Props = {
21
27
  poolInfo: SolanaPoolInfo
28
+ poolState: SolanaPoolState
22
29
  selectedTranche: TrancheType
30
+ pointsTestnetExperience: boolean
23
31
  }
24
32
 
25
33
  export function Transfer({
26
34
  poolInfo,
35
+ poolState,
27
36
  selectedTranche,
37
+ pointsTestnetExperience,
28
38
  }: Props): React.ReactElement | null {
39
+ const isDev = checkIsDev()
29
40
  const dispatch = useAppDispatch()
30
41
  const { publicKey } = useWallet()
31
42
  const { supplyAmount } = useAppSelector(selectWidgetState)
@@ -44,9 +55,33 @@ export function Transfer({
44
55
  } = useLenderAccounts(poolInfo.chainId, poolInfo.poolName)
45
56
  const program = useHumaProgram(poolInfo.chainId)
46
57
 
47
- const handleSuccess = useCallback(() => {
48
- dispatch(setStep(WIDGET_STEP.Done))
49
- }, [dispatch])
58
+ const handleSuccess = useCallback(
59
+ async (options?: { signature: string }) => {
60
+ if (publicKey && poolState.campaign && options?.signature) {
61
+ try {
62
+ const result = await CampaignService.updateWalletPoints(
63
+ publicKey.toString(),
64
+ options.signature,
65
+ poolInfo.chainId,
66
+ isDev,
67
+ pointsTestnetExperience,
68
+ )
69
+ dispatch(setPointsAccumulated(result.pointsAccumulated))
70
+ } catch (error) {
71
+ console.error('Failed to update wallet points', error)
72
+ }
73
+ }
74
+ dispatch(setStep(WIDGET_STEP.Done))
75
+ },
76
+ [
77
+ dispatch,
78
+ isDev,
79
+ pointsTestnetExperience,
80
+ poolInfo.chainId,
81
+ poolState.campaign,
82
+ publicKey,
83
+ ],
84
+ )
50
85
 
51
86
  useEffect(() => {
52
87
  async function getTx() {
@@ -1,7 +1,7 @@
1
1
  import { formatMoney, SolanaPoolInfo, timeUtil } from '@huma-finance/shared'
2
2
  import { SolanaPoolState } from '@huma-finance/web-shared'
3
3
  import dayjs from 'dayjs'
4
- import React, { useCallback, useEffect } from 'react'
4
+ import React, { useCallback } from 'react'
5
5
  import { useDispatch } from 'react-redux'
6
6
  import { Campaign } from '.'
7
7
  import { useAppSelector } from '../../../hooks/useRedux'
@@ -14,7 +14,6 @@ type Props = {
14
14
  poolInfo: SolanaPoolInfo
15
15
  poolState: SolanaPoolState
16
16
  campaign?: Campaign
17
- updateTransactionHash: (hash: string) => void
18
17
  handleAction: () => void
19
18
  }
20
19
 
@@ -22,19 +21,12 @@ export function Success({
22
21
  poolInfo,
23
22
  poolState,
24
23
  campaign,
25
- updateTransactionHash,
26
24
  handleAction,
27
25
  }: Props): React.ReactElement {
28
26
  const dispatch = useDispatch()
29
27
  const { supplyAmount, solanaSignature } = useAppSelector(selectWidgetState)
30
28
  const { symbol } = poolInfo.underlyingMint
31
29
 
32
- useEffect(() => {
33
- if (solanaSignature) {
34
- updateTransactionHash(solanaSignature)
35
- }
36
- }, [solanaSignature, updateTransactionHash])
37
-
38
30
  const content = [
39
31
  `You successfully supplied ${formatMoney(supplyAmount)} ${symbol}.`,
40
32
  ]
@@ -12,13 +12,13 @@ import { setStep } from '../../../store/widgets.reducers'
12
12
  import { selectWidgetState } from '../../../store/widgets.selectors'
13
13
  import { WIDGET_STEP } from '../../../store/widgets.store'
14
14
  import { ErrorModal } from '../../ErrorModal'
15
+ import { PointsEarned } from '../../PointsEarned'
15
16
  import { WidgetWrapper } from '../../WidgetWrapper'
16
17
  import { Evaluation } from './1-Evaluation'
17
18
  import { ChooseTranche } from './2-ChooseTranche'
18
19
  import { ChooseAmount } from './3-ChooseAmount'
19
20
  import { Transfer } from './4-Transfer'
20
21
  import { Success } from './5-Success'
21
- import { PointsEarned } from './6-PointsEarned'
22
22
 
23
23
  export interface Campaign {
24
24
  id: string
@@ -59,7 +59,6 @@ export function SolanaLendSupply({
59
59
  const [tokenAccount, isLoadingTokenAccount] = useTokenAccount(poolInfo)
60
60
  const { step, errorMessage } = useAppSelector(selectWidgetState)
61
61
  const [selectedTranche, setSelectedTranche] = useState<TrancheType>()
62
- const [transactionHash, setTransactionHash] = useState<string | undefined>()
63
62
 
64
63
  useEffect(() => {
65
64
  if (!step && !isLoadingLenderAccounts && !isLoadingTokenAccount) {
@@ -141,24 +140,23 @@ export function SolanaLendSupply({
141
140
  />
142
141
  )}
143
142
  {step === WIDGET_STEP.Transfer && selectedTranche && (
144
- <Transfer poolInfo={poolInfo} selectedTranche={selectedTranche} />
143
+ <Transfer
144
+ poolInfo={poolInfo}
145
+ poolState={poolState}
146
+ selectedTranche={selectedTranche}
147
+ pointsTestnetExperience={pointsTestnetExperience}
148
+ />
145
149
  )}
146
150
  {step === WIDGET_STEP.Done && (
147
151
  <Success
148
152
  poolInfo={poolInfo}
149
153
  poolState={poolState}
150
154
  campaign={poolState.campaign}
151
- updateTransactionHash={setTransactionHash}
152
155
  handleAction={handleClose}
153
156
  />
154
157
  )}
155
- {step === WIDGET_STEP.PointsEarned && transactionHash && (
156
- <PointsEarned
157
- transactionHash={transactionHash}
158
- poolState={poolState}
159
- pointsTestnetExperience={pointsTestnetExperience}
160
- handleAction={handleClose}
161
- />
158
+ {step === WIDGET_STEP.PointsEarned && (
159
+ <PointsEarned lpConfig={poolState} handleAction={handleClose} />
162
160
  )}
163
161
  {step === WIDGET_STEP.Error && (
164
162
  <ErrorModal
@@ -1,11 +1,17 @@
1
- import { PoolInfoV2, TrancheType } from '@huma-finance/shared'
1
+ import {
2
+ CampaignService,
3
+ checkIsDev,
4
+ PoolInfoV2,
5
+ TrancheType,
6
+ } from '@huma-finance/shared'
2
7
  import { useTrancheVaultContractV2 } from '@huma-finance/web-shared'
3
8
  import { useWeb3React } from '@web3-react/core'
4
9
  import { ethers } from 'ethers'
5
10
  import React, { useCallback } from 'react'
6
11
 
12
+ import { Campaign } from '.'
7
13
  import { useAppDispatch, useAppSelector } from '../../../hooks/useRedux'
8
- import { setStep } from '../../../store/widgets.reducers'
14
+ import { setPointsAccumulated, setStep } from '../../../store/widgets.reducers'
9
15
  import { selectWidgetState } from '../../../store/widgets.selectors'
10
16
  import { WIDGET_STEP } from '../../../store/widgets.store'
11
17
  import { TxSendModalV2 } from '../../TxSendModalV2'
@@ -13,14 +19,19 @@ import { TxSendModalV2 } from '../../TxSendModalV2'
13
19
  type Props = {
14
20
  poolInfo: PoolInfoV2
15
21
  trancheType: TrancheType
22
+ pointsTestnetExperience: boolean
23
+ campaign?: Campaign
16
24
  }
17
25
 
18
26
  export function Transfer({
19
27
  poolInfo,
20
28
  trancheType,
29
+ pointsTestnetExperience,
30
+ campaign,
21
31
  }: Props): React.ReactElement | null {
32
+ const isDev = checkIsDev()
22
33
  const dispatch = useAppDispatch()
23
- const { account, provider } = useWeb3React()
34
+ const { account, chainId, provider } = useWeb3React()
24
35
  const { supplyAmount } = useAppSelector(selectWidgetState)
25
36
  const { decimals } = poolInfo.poolUnderlyingToken
26
37
  const supplyBigNumber = ethers.utils.parseUnits(
@@ -34,9 +45,26 @@ export function Transfer({
34
45
  account,
35
46
  )
36
47
 
37
- const handleSuccess = useCallback(() => {
38
- dispatch(setStep(WIDGET_STEP.Done))
39
- }, [dispatch])
48
+ const handleSuccess = useCallback(
49
+ async (options?: { txHash: string }) => {
50
+ if (campaign && options?.txHash) {
51
+ try {
52
+ const result = await CampaignService.updateWalletPoints(
53
+ account!,
54
+ options.txHash,
55
+ chainId!,
56
+ isDev,
57
+ pointsTestnetExperience,
58
+ )
59
+ dispatch(setPointsAccumulated(result.pointsAccumulated))
60
+ } catch (error) {
61
+ console.error('Failed to update wallet points', error)
62
+ }
63
+ }
64
+ dispatch(setStep(WIDGET_STEP.Done))
65
+ },
66
+ [account, campaign, chainId, dispatch, isDev, pointsTestnetExperience],
67
+ )
40
68
 
41
69
  if (!trancheVaultContract || !account) {
42
70
  return null
@@ -26,7 +26,6 @@ type Props = {
26
26
  poolInfo: PoolInfoV2
27
27
  lpConfig: { withdrawalLockoutPeriodInDays: number }
28
28
  campaign?: Campaign
29
- updateTransactionHash: (hash: string) => void
30
29
  handleAction: () => void
31
30
  }
32
31
 
@@ -34,12 +33,11 @@ export function Success({
34
33
  poolInfo,
35
34
  lpConfig,
36
35
  campaign,
37
- updateTransactionHash,
38
36
  handleAction,
39
37
  }: Props): React.ReactElement {
40
38
  const dispatch = useDispatch()
41
39
  const { account, chainId } = useWeb3React()
42
- const [{ txReceipt, txHash }] = useAtom(sendTxAtom)
40
+ const [{ txReceipt }] = useAtom(sendTxAtom)
43
41
  const { symbol, decimals, address } = poolInfo.poolUnderlyingToken
44
42
  const [supplyAmount, setSupplyAmount] = useState<string | undefined>()
45
43
  const { isFirstTimeNotifiUser } = useIsFirstTimeNotifiUser(account, chainId)
@@ -63,12 +61,6 @@ export function Success({
63
61
  }
64
62
  }, [account, address, decimals, poolInfo.poolSafe, txReceipt])
65
63
 
66
- useEffect(() => {
67
- if (txHash) {
68
- updateTransactionHash(txHash)
69
- }
70
- }, [txHash, updateTransactionHash])
71
-
72
64
  const handleUserAction = useCallback(() => {
73
65
  if (isFirstTimeNotifiUser && notifiChainSupported) {
74
66
  dispatch(setStep(WIDGET_STEP.Notifications))
@@ -19,6 +19,7 @@ import { setStep } from '../../../store/widgets.reducers'
19
19
  import { selectWidgetState } from '../../../store/widgets.selectors'
20
20
  import { WIDGET_STEP } from '../../../store/widgets.store'
21
21
  import { ErrorModal } from '../../ErrorModal'
22
+ import { PointsEarned } from '../../PointsEarned'
22
23
  import { WidgetWrapper } from '../../WidgetWrapper'
23
24
  import { ChooseTranche } from './1-ChooseTranche'
24
25
  import { Evaluation } from './2-Evaluation'
@@ -27,7 +28,6 @@ import { ApproveAllowance } from './4-ApproveAllowance'
27
28
  import { Transfer } from './5-Transfer'
28
29
  import { Success } from './6-Success'
29
30
  import { Notifications } from './7-Notifications'
30
- import { PointsEarned } from './8-PointsEarned'
31
31
 
32
32
  export interface Campaign {
33
33
  id: string
@@ -65,7 +65,6 @@ export function LendSupplyV2({
65
65
  const { poolUnderlyingToken } = poolInfo || {}
66
66
  const { step, errorMessage } = useAppSelector(selectWidgetState)
67
67
  const [selectedTranche, setSelectedTranche] = useState<TrancheType>()
68
- const [transactionHash, setTransactionHash] = useState<string | undefined>()
69
68
  const lpConfig = useLPConfigV2(poolName, provider)
70
69
  const isUniTranche = lpConfig?.maxSeniorJuniorRatio === 0
71
70
  const [lenderApprovedSenior] = useLenderApprovedV2(
@@ -199,25 +198,29 @@ export function LendSupplyV2({
199
198
  <ApproveAllowance poolInfo={poolInfo} />
200
199
  )}
201
200
  {step === WIDGET_STEP.Transfer && selectedTranche && (
202
- <Transfer poolInfo={poolInfo} trancheType={selectedTranche} />
201
+ <Transfer
202
+ poolInfo={poolInfo}
203
+ trancheType={selectedTranche}
204
+ pointsTestnetExperience={pointsTestnetExperience}
205
+ campaign={campaign}
206
+ />
203
207
  )}
204
208
  {step === WIDGET_STEP.Done && (
205
209
  <Success
206
210
  poolInfo={poolInfo}
207
211
  lpConfig={lpConfig}
208
212
  campaign={campaign}
209
- updateTransactionHash={setTransactionHash}
210
213
  handleAction={handleClose}
211
214
  />
212
215
  )}
213
216
  {step === WIDGET_STEP.Notifications && (
214
217
  <Notifications campaign={campaign} handleAction={handleClose} />
215
218
  )}
216
- {step === WIDGET_STEP.PointsEarned && transactionHash && (
219
+ {step === WIDGET_STEP.PointsEarned && (
217
220
  <PointsEarned
218
- transactionHash={transactionHash}
219
- lpConfig={lpConfig}
220
- pointsTestnetExperience={pointsTestnetExperience}
221
+ lpConfig={{
222
+ withdrawalLockupPeriodDays: lpConfig.withdrawalLockoutPeriodInDays,
223
+ }}
221
224
  handleAction={handleClose}
222
225
  />
223
226
  )}
@@ -39,6 +39,10 @@ export function NotifiContextWrapper({
39
39
  cardId = process.env.REACT_APP_NOTIFI_CONFIG_ID_SCROLL ?? ''
40
40
  }
41
41
 
42
+ if (!cardId) {
43
+ return children
44
+ }
45
+
42
46
  return (
43
47
  <NotifiContextProvider
44
48
  tenantId='humafinanceprod'
@@ -0,0 +1,124 @@
1
+ import { formatNumber, isEmpty } from '@huma-finance/shared'
2
+ import { txAtom } from '@huma-finance/web-shared'
3
+ import { Box, css, useTheme } from '@mui/material'
4
+ import { useResetAtom } from 'jotai/utils'
5
+ import React, { useCallback } from 'react'
6
+ import { useDispatch } from 'react-redux'
7
+
8
+ import { useAppSelector } from '../hooks/useRedux'
9
+ import { resetState } from '../store/widgets.reducers'
10
+ import { selectWidgetState } from '../store/widgets.selectors'
11
+ import { BottomButton } from './BottomButton'
12
+ import { CongratulationsIcon, HumaPointsIcon, RibbonIcon } from './icons'
13
+
14
+ type Props = {
15
+ lpConfig: { withdrawalLockupPeriodDays?: number }
16
+ handleAction: () => void
17
+ }
18
+
19
+ export function PointsEarned({
20
+ lpConfig,
21
+ handleAction,
22
+ }: Props): React.ReactElement {
23
+ const theme = useTheme()
24
+ const dispatch = useDispatch()
25
+ const reset = useResetAtom(txAtom)
26
+ const { pointsAccumulated } = useAppSelector(selectWidgetState)
27
+ const hasPointsAccumulated =
28
+ !isEmpty(pointsAccumulated) && pointsAccumulated! > 0
29
+ const lockupMonths = Math.round(lpConfig.withdrawalLockupPeriodDays ?? 0 / 30)
30
+ const monthText =
31
+ lockupMonths > 1 ? `${lockupMonths} months` : `${lockupMonths} month`
32
+
33
+ const handleCloseModal = useCallback(() => {
34
+ reset()
35
+ dispatch(resetState())
36
+ handleAction()
37
+ }, [dispatch, handleAction, reset])
38
+
39
+ const styles = {
40
+ wrapper: css`
41
+ height: 518px;
42
+ position: relative;
43
+ `,
44
+ congrats: css`
45
+ margin: ${theme.spacing(-4, -4.5, 0, -4.5)};
46
+ `,
47
+ ribbon: css`
48
+ position: relative;
49
+ ${theme.cssMixins.rowHCentered};
50
+ font-weight: 700;
51
+ margin-top: ${theme.spacing(-8)};
52
+ color: ${theme.palette.text.primary};
53
+ font-size: 20px;
54
+ line-height: 160%;
55
+ letter-spacing: 0.15px;
56
+ `,
57
+ ribbonContent: css`
58
+ ${theme.cssMixins.rowVCentered};
59
+ position: absolute;
60
+ top: ${theme.spacing(1)};
61
+
62
+ svg {
63
+ margin-right: ${theme.spacing(1)};
64
+ }
65
+ `,
66
+ entirePoints: css`
67
+ color: ${theme.palette.text.tertiary};
68
+ text-align: center;
69
+ font-weight: 700;
70
+ font-size: 20px;
71
+ line-height: 160%;
72
+ letter-spacing: 0.15px;
73
+ margin-top: ${theme.spacing(7)};
74
+ `,
75
+ entirePointsDetails: css`
76
+ color: ${theme.palette.text.tertiary};
77
+ text-align: center;
78
+ font-weight: 400;
79
+ font-size: 16px;
80
+ line-height: 150%;
81
+ letter-spacing: 0.15px;
82
+ margin-top: ${theme.spacing(4)};
83
+ `,
84
+ everyday: css`
85
+ font-weight: 700;
86
+ `,
87
+ }
88
+
89
+ return (
90
+ <Box css={styles.wrapper}>
91
+ <Box css={styles.congrats}>
92
+ <CongratulationsIcon />
93
+ </Box>
94
+ <Box css={styles.ribbon}>
95
+ <RibbonIcon />
96
+ <Box css={styles.ribbonContent}>
97
+ <HumaPointsIcon />
98
+ <Box>
99
+ {hasPointsAccumulated
100
+ ? `${formatNumber(pointsAccumulated)} Points`
101
+ : 'Points earned'}
102
+ </Box>
103
+ </Box>
104
+ </Box>
105
+ <Box css={styles.entirePoints}>
106
+ {hasPointsAccumulated ? (
107
+ <>
108
+ <Box>Congratulations,</Box>
109
+ <Box>you've earned {pointsAccumulated} points</Box>
110
+ </>
111
+ ) : (
112
+ <Box>Congratulations on joining the Huma Protocol!</Box>
113
+ )}
114
+ </Box>
115
+ <Box css={styles.entirePointsDetails}>
116
+ You'll earn points <span css={styles.everyday}>everyday</span> for{' '}
117
+ {monthText} straight.
118
+ </Box>
119
+ <BottomButton variant='contained' onClick={handleCloseModal}>
120
+ GREAT
121
+ </BottomButton>
122
+ </Box>
123
+ )
124
+ }
@@ -3,15 +3,15 @@ import React, { useEffect, useState } from 'react'
3
3
 
4
4
  import { useConnection, useWallet } from '@solana/wallet-adapter-react'
5
5
  import { Transaction } from '@solana/web3.js'
6
+ import { useAppDispatch } from '../hooks/useRedux'
6
7
  import { setError, setSolanaSignature } from '../store/widgets.reducers'
7
8
  import { LoadingModal } from './LoadingModal'
8
9
  import { SolanaViewOnExplorer } from './SolanaViewOnExplorer'
9
- import { useAppDispatch } from '../hooks/useRedux'
10
10
 
11
11
  type Props = {
12
12
  chainId: SolanaChainEnum
13
13
  tx?: Transaction
14
- handleSuccess: () => void
14
+ handleSuccess: (options?: { signature: string }) => void
15
15
  }
16
16
 
17
17
  export function SolanaTxSendModal({
@@ -41,7 +41,7 @@ export function SolanaTxSendModal({
41
41
  lastValidBlockHeight: latestBlockHash.lastValidBlockHeight,
42
42
  signature,
43
43
  })
44
- handleSuccess()
44
+ handleSuccess({ signature })
45
45
  } catch (error: unknown) {
46
46
  const err = error as Error
47
47
  dispatch(setError({ errorMessage: err?.message || '' }))
@@ -14,7 +14,7 @@ type Props = {
14
14
  params: unknown[]
15
15
  title?: string
16
16
  contract: Contract
17
- handleSuccess?: () => void
17
+ handleSuccess?: (options?: { txHash: string }) => void
18
18
  }
19
19
 
20
20
  export function TxSendModalV2({
@@ -30,12 +30,12 @@ export function TxSendModalV2({
30
30
  const [{ state, txHash }, send] = useAtom(sendTxAtom)
31
31
 
32
32
  useEffect(() => {
33
- if (state === TxStateType.Success) {
33
+ if (state === TxStateType.Success && txHash) {
34
34
  if (handleSuccess) {
35
- handleSuccess()
35
+ handleSuccess({ txHash })
36
36
  }
37
37
  }
38
- }, [dispatch, handleSuccess, state])
38
+ }, [dispatch, handleSuccess, state, txHash])
39
39
 
40
40
  useMount(() => {
41
41
  send({ contract, method, params, provider })
@@ -1,5 +1,5 @@
1
- import { createSlice, PayloadAction } from '@reduxjs/toolkit'
2
1
  import { Approval } from '@huma-finance/shared'
2
+ import { createSlice, PayloadAction } from '@reduxjs/toolkit'
3
3
 
4
4
  import {
5
5
  initialWidgetState,
@@ -106,6 +106,12 @@ export const widgetSlice = createSlice({
106
106
  setSolanaSignature: (state, { payload }: PayloadAction<string>) => {
107
107
  state.solanaSignature = payload
108
108
  },
109
+ setPointsAccumulated: (
110
+ state,
111
+ { payload }: PayloadAction<number | undefined>,
112
+ ) => {
113
+ state.pointsAccumulated = payload
114
+ },
109
115
  setError: (
110
116
  state,
111
117
  {
@@ -135,6 +141,7 @@ export const {
135
141
  setRedeemAmount,
136
142
  setRedeemShares,
137
143
  setSolanaSignature,
144
+ setPointsAccumulated,
138
145
  } = widgetSlice.actions
139
146
 
140
147
  export default widgetSlice.reducer
@@ -59,6 +59,7 @@ export type WidgetState = {
59
59
  stream?: WidgetStream
60
60
  multisend?: MultisendPayload
61
61
  solanaSignature?: string
62
+ pointsAccumulated?: number
62
63
  }
63
64
 
64
65
  export const initialWidgetState: WidgetState = {}