@huma-finance/widgets 0.0.65 → 0.0.66-beta.812

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.
@@ -1,4 +1,9 @@
1
- import { CHAIN_TYPE, CloseModalOptions, PoolInfoV2 } from '@huma-finance/shared'
1
+ import {
2
+ CHAIN_TYPE,
3
+ CloseModalOptions,
4
+ NETWORK_TYPE,
5
+ PoolInfoV2,
6
+ } from '@huma-finance/shared'
2
7
  import React from 'react'
3
8
 
4
9
  import { Campaign } from '.'
@@ -7,7 +12,7 @@ import { SecuritizeEvaluation } from '../components/SecuritizeEvaluation'
7
12
 
8
13
  type Props = {
9
14
  poolInfo: PoolInfoV2
10
- pointsTestnetExperience: boolean
15
+ networkType: NETWORK_TYPE
11
16
  campaign?: Campaign
12
17
  handleClose: (options?: CloseModalOptions) => void
13
18
  }
@@ -15,7 +20,7 @@ type Props = {
15
20
  export function Evaluation({
16
21
  poolInfo,
17
22
  campaign,
18
- pointsTestnetExperience,
23
+ networkType,
19
24
  handleClose,
20
25
  }: Props): React.ReactElement | null {
21
26
  if (poolInfo.KYC?.Securitize) {
@@ -28,8 +33,8 @@ export function Evaluation({
28
33
  <PersonaEvaluation
29
34
  poolInfo={poolInfo}
30
35
  handleClose={handleClose}
31
- pointsTestnetExperience={pointsTestnetExperience}
32
36
  campaign={campaign}
37
+ networkType={networkType}
33
38
  chainType={CHAIN_TYPE.EVM}
34
39
  />
35
40
  )
@@ -1,4 +1,9 @@
1
- import { CHAIN_TYPE, PoolInfoV2, TrancheType } from '@huma-finance/shared'
1
+ import {
2
+ CHAIN_TYPE,
3
+ getEvmNetworkType,
4
+ PoolInfoV2,
5
+ TrancheType,
6
+ } from '@huma-finance/shared'
2
7
  import React from 'react'
3
8
 
4
9
  import { ApproveLenderBase } from '../components/ApproveLenderBase'
@@ -20,6 +25,7 @@ export function ApproveLender({
20
25
  seniorTrancheVault={poolInfo.seniorTrancheVault}
21
26
  isUniTranche={isUniTranche}
22
27
  chainType={CHAIN_TYPE.EVM}
28
+ networkType={getEvmNetworkType(poolInfo.chainId)}
23
29
  changeTranche={changeTranche}
24
30
  />
25
31
  )
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  CampaignService,
3
3
  checkIsDev,
4
+ NETWORK_TYPE,
4
5
  PoolInfoV2,
5
6
  TrancheType,
6
7
  } from '@huma-finance/shared'
@@ -19,14 +20,14 @@ import { TxSendModalV2 } from '../../TxSendModalV2'
19
20
  type Props = {
20
21
  poolInfo: PoolInfoV2
21
22
  trancheType: TrancheType
22
- pointsTestnetExperience: boolean
23
+ networkType: NETWORK_TYPE
23
24
  campaign?: Campaign
24
25
  }
25
26
 
26
27
  export function Transfer({
27
28
  poolInfo,
28
29
  trancheType,
29
- pointsTestnetExperience,
30
+ networkType,
30
31
  campaign,
31
32
  }: Props): React.ReactElement | null {
32
33
  const isDev = checkIsDev()
@@ -49,12 +50,12 @@ export function Transfer({
49
50
  async (options?: { txHash: string }) => {
50
51
  if (campaign && options?.txHash) {
51
52
  try {
52
- const result = await CampaignService.updateWalletPoints(
53
+ const result = await CampaignService.updateHumaAccountPoints(
53
54
  account!,
54
55
  options.txHash,
55
56
  chainId!,
57
+ networkType,
56
58
  isDev,
57
- pointsTestnetExperience,
58
59
  )
59
60
  dispatch(setPointsAccumulated(result.pointsAccumulated))
60
61
  } catch (error) {
@@ -63,7 +64,7 @@ export function Transfer({
63
64
  }
64
65
  dispatch(setStep(WIDGET_STEP.Done))
65
66
  },
66
- [account, campaign, chainId, dispatch, isDev, pointsTestnetExperience],
67
+ [account, campaign, chainId, dispatch, isDev, networkType],
67
68
  )
68
69
 
69
70
  if (!trancheVaultContract || !account) {
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  CloseModalOptions,
3
+ getEvmNetworkType,
3
4
  openInNewTab,
4
5
  POOL_NAME,
5
6
  TrancheType,
@@ -39,14 +40,12 @@ export interface Campaign {
39
40
  * Lend pool supply props
40
41
  * @typedef {Object} LendSupplyPropsV2
41
42
  * @property {POOL_NAME} poolName The name of the pool.
42
- * @property {boolean} pointsTestnetExperience If the user is in the testnet experience.
43
43
  * @property {Campaign} campaign The campaign info.
44
44
  * @property {function((CloseModalOptions|undefined)):void} handleClose Function to notify to close the widget modal when user clicks the 'x' close button.
45
45
  * @property {function((number|undefined)):void|undefined} handleSuccess Optional function to notify that the lending pool supply action is successful.
46
46
  */
47
47
  export interface LendSupplyPropsV2 {
48
48
  poolName: keyof typeof POOL_NAME
49
- pointsTestnetExperience: boolean
50
49
  campaign?: Campaign
51
50
  handleClose: (options?: CloseModalOptions) => void
52
51
  handleSuccess?: (blockNumber?: number) => void
@@ -54,7 +53,6 @@ export interface LendSupplyPropsV2 {
54
53
 
55
54
  export function LendSupplyV2({
56
55
  poolName: poolNameStr,
57
- pointsTestnetExperience,
58
56
  campaign,
59
57
  handleClose,
60
58
  handleSuccess,
@@ -171,8 +169,8 @@ export function LendSupplyV2({
171
169
  <Evaluation
172
170
  poolInfo={poolInfo}
173
171
  handleClose={handleClose}
174
- pointsTestnetExperience={pointsTestnetExperience}
175
172
  campaign={campaign}
173
+ networkType={getEvmNetworkType(poolInfo.chainId)}
176
174
  />
177
175
  )}
178
176
  {step === WIDGET_STEP.ApproveLender && (
@@ -199,8 +197,8 @@ export function LendSupplyV2({
199
197
  <Transfer
200
198
  poolInfo={poolInfo}
201
199
  trancheType={selectedTranche}
202
- pointsTestnetExperience={pointsTestnetExperience}
203
200
  campaign={campaign}
201
+ networkType={getEvmNetworkType(poolInfo.chainId)}
204
202
  />
205
203
  )}
206
204
  {step === WIDGET_STEP.Done && (