@huma-finance/widgets 0.0.62-beta.636 → 0.0.62-beta.637
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/cjs/index.cjs +18 -10
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.js +20 -12
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/CreditLine/solanaBorrow/2-Transfer.tsx +9 -9
- package/src/components/CreditLine/solanaPayment/2-Transfer.tsx +5 -5
- package/src/components/Lend/components/PersonaEvaluation.tsx +5 -0
- package/src/components/Lend/solanaAddRedemption/3-Transfer.tsx +3 -3
- package/src/components/Lend/solanaCancelRedemption/2-Transfer.tsx +1 -1
- package/src/components/Lend/solanaSupply/1-Evaluation.tsx +12 -1
- package/src/components/Lend/solanaSupply/4-Transfer.tsx +13 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huma-finance/widgets",
|
|
3
|
-
"version": "0.0.62-beta.
|
|
3
|
+
"version": "0.0.62-beta.637+9f3e124",
|
|
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.
|
|
33
|
-
"@huma-finance/shared": "^0.0.62-beta.
|
|
34
|
-
"@huma-finance/web-shared": "^0.0.62-beta.
|
|
32
|
+
"@huma-finance/sdk": "^0.0.62-beta.637+9f3e124",
|
|
33
|
+
"@huma-finance/shared": "^0.0.62-beta.637+9f3e124",
|
|
34
|
+
"@huma-finance/web-shared": "^0.0.62-beta.637+9f3e124",
|
|
35
35
|
"@mui/icons-material": "^5.3.0",
|
|
36
36
|
"@mui/material": "^5.0.6",
|
|
37
37
|
"@mui/styles": "^5.0.2",
|
|
@@ -207,5 +207,5 @@
|
|
|
207
207
|
"optionalDependencies": {
|
|
208
208
|
"encoding": "^0.1.13"
|
|
209
209
|
},
|
|
210
|
-
"gitHead": "
|
|
210
|
+
"gitHead": "9f3e124976998f1d4f21c4db656acbe747756c17"
|
|
211
211
|
}
|
|
@@ -7,24 +7,24 @@ import {
|
|
|
7
7
|
} from '@huma-finance/shared'
|
|
8
8
|
import React, { useCallback, useEffect, useState } from 'react'
|
|
9
9
|
|
|
10
|
+
import { BN } from '@coral-xyz/anchor'
|
|
11
|
+
import { useHumaProgram } from '@huma-finance/web-shared'
|
|
10
12
|
import {
|
|
11
13
|
ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
12
14
|
createApproveCheckedInstruction,
|
|
13
15
|
createAssociatedTokenAccountInstruction,
|
|
14
16
|
getAccount,
|
|
15
|
-
|
|
17
|
+
TOKEN_PROGRAM_ID,
|
|
16
18
|
TokenAccountNotFoundError,
|
|
17
19
|
TokenInvalidAccountOwnerError,
|
|
18
20
|
} from '@solana/spl-token'
|
|
19
21
|
import { useConnection, useWallet } from '@solana/wallet-adapter-react'
|
|
20
22
|
import { PublicKey, Transaction } from '@solana/web3.js'
|
|
21
|
-
import { useHumaProgram } from '@huma-finance/web-shared'
|
|
22
|
-
import { BN } from '@coral-xyz/anchor'
|
|
23
23
|
import { useAppDispatch, useAppSelector } from '../../../hooks/useRedux'
|
|
24
|
-
import { SolanaTxSendModal } from '../../SolanaTxSendModal'
|
|
25
24
|
import { setStep } from '../../../store/widgets.reducers'
|
|
26
|
-
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
27
25
|
import { selectWidgetState } from '../../../store/widgets.selectors'
|
|
26
|
+
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
27
|
+
import { SolanaTxSendModal } from '../../SolanaTxSendModal'
|
|
28
28
|
|
|
29
29
|
type Props = {
|
|
30
30
|
poolInfo: SolanaPoolInfo
|
|
@@ -60,7 +60,7 @@ export function Transfer({ poolInfo }: Props): React.ReactElement | null {
|
|
|
60
60
|
connection,
|
|
61
61
|
underlyingTokenATA,
|
|
62
62
|
undefined,
|
|
63
|
-
|
|
63
|
+
TOKEN_PROGRAM_ID,
|
|
64
64
|
)
|
|
65
65
|
} catch (error: unknown) {
|
|
66
66
|
// TokenAccountNotFoundError can be possible if the associated address has already received some lamports,
|
|
@@ -77,7 +77,7 @@ export function Transfer({ poolInfo }: Props): React.ReactElement | null {
|
|
|
77
77
|
underlyingTokenATA,
|
|
78
78
|
publicKey,
|
|
79
79
|
new PublicKey(poolInfo.underlyingMint.address),
|
|
80
|
-
|
|
80
|
+
TOKEN_PROGRAM_ID,
|
|
81
81
|
ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
82
82
|
),
|
|
83
83
|
)
|
|
@@ -105,7 +105,7 @@ export function Transfer({ poolInfo }: Props): React.ReactElement | null {
|
|
|
105
105
|
), // amount
|
|
106
106
|
poolInfo.underlyingMint.decimals,
|
|
107
107
|
undefined, // multiSigners
|
|
108
|
-
|
|
108
|
+
TOKEN_PROGRAM_ID,
|
|
109
109
|
),
|
|
110
110
|
)
|
|
111
111
|
}
|
|
@@ -128,7 +128,7 @@ export function Transfer({ poolInfo }: Props): React.ReactElement | null {
|
|
|
128
128
|
underlyingMint: poolInfo.underlyingMint.address,
|
|
129
129
|
poolUnderlyingToken: poolInfo.poolUnderlyingTokenAccount,
|
|
130
130
|
borrowerUnderlyingToken: underlyingTokenATA,
|
|
131
|
-
tokenProgram:
|
|
131
|
+
tokenProgram: TOKEN_PROGRAM_ID,
|
|
132
132
|
})
|
|
133
133
|
.transaction()
|
|
134
134
|
tx.add(programTx)
|
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
} from '@huma-finance/shared'
|
|
7
7
|
import React, { useCallback, useEffect, useState } from 'react'
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { useHumaProgram } from '@huma-finance/web-shared'
|
|
10
|
+
import { TOKEN_PROGRAM_ID } from '@solana/spl-token'
|
|
10
11
|
import { useConnection, useWallet } from '@solana/wallet-adapter-react'
|
|
11
12
|
import { Transaction } from '@solana/web3.js'
|
|
12
|
-
import { useHumaProgram } from '@huma-finance/web-shared'
|
|
13
13
|
import { useAppDispatch, useAppSelector } from '../../../hooks/useRedux'
|
|
14
|
-
import { SolanaTxSendModal } from '../../SolanaTxSendModal'
|
|
15
14
|
import { setStep } from '../../../store/widgets.reducers'
|
|
16
|
-
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
17
15
|
import { selectWidgetState } from '../../../store/widgets.selectors'
|
|
16
|
+
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
17
|
+
import { SolanaTxSendModal } from '../../SolanaTxSendModal'
|
|
18
18
|
|
|
19
19
|
type Props = {
|
|
20
20
|
poolInfo: SolanaPoolInfo
|
|
@@ -62,7 +62,7 @@ export function Transfer({ poolInfo }: Props): React.ReactElement | null {
|
|
|
62
62
|
underlyingMint: poolInfo.underlyingMint.address,
|
|
63
63
|
poolUnderlyingToken: poolInfo.poolUnderlyingTokenAccount,
|
|
64
64
|
borrowerUnderlyingToken: underlyingTokenATA,
|
|
65
|
-
tokenProgram:
|
|
65
|
+
tokenProgram: TOKEN_PROGRAM_ID,
|
|
66
66
|
})
|
|
67
67
|
.transaction()
|
|
68
68
|
|
|
@@ -36,6 +36,7 @@ type Props = {
|
|
|
36
36
|
isUniTranche: boolean
|
|
37
37
|
pointsTestnetExperience: boolean
|
|
38
38
|
campaign?: Campaign
|
|
39
|
+
chainSpecificData?: Record<string, unknown>
|
|
39
40
|
changeTranche: (tranche: TrancheType) => void
|
|
40
41
|
handleClose: (identityStatus?: IdentityVerificationStatusV2) => void
|
|
41
42
|
}
|
|
@@ -46,6 +47,7 @@ export function PersonaEvaluation({
|
|
|
46
47
|
campaign,
|
|
47
48
|
pointsTestnetExperience,
|
|
48
49
|
chainType,
|
|
50
|
+
chainSpecificData,
|
|
49
51
|
changeTranche,
|
|
50
52
|
handleClose,
|
|
51
53
|
}: Props): React.ReactElement | null {
|
|
@@ -101,6 +103,7 @@ export function PersonaEvaluation({
|
|
|
101
103
|
chainId!,
|
|
102
104
|
poolInfo.juniorTrancheVault,
|
|
103
105
|
isDev,
|
|
106
|
+
chainSpecificData,
|
|
104
107
|
)
|
|
105
108
|
if (!isUniTranche) {
|
|
106
109
|
await IdentityServiceV2.approveLender(
|
|
@@ -108,6 +111,7 @@ export function PersonaEvaluation({
|
|
|
108
111
|
chainId!,
|
|
109
112
|
poolInfo.seniorTrancheVault,
|
|
110
113
|
isDev,
|
|
114
|
+
chainSpecificData,
|
|
111
115
|
)
|
|
112
116
|
}
|
|
113
117
|
if (isUniTranche) {
|
|
@@ -123,6 +127,7 @@ export function PersonaEvaluation({
|
|
|
123
127
|
}, [
|
|
124
128
|
account,
|
|
125
129
|
chainId,
|
|
130
|
+
chainSpecificData,
|
|
126
131
|
changeTranche,
|
|
127
132
|
dispatch,
|
|
128
133
|
isDev,
|
|
@@ -6,17 +6,17 @@ import {
|
|
|
6
6
|
} from '@huma-finance/shared'
|
|
7
7
|
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
|
8
8
|
|
|
9
|
-
import { TOKEN_2022_PROGRAM_ID } from '@solana/spl-token'
|
|
10
|
-
import { useWallet } from '@solana/wallet-adapter-react'
|
|
11
9
|
import {
|
|
12
10
|
useHumaProgram,
|
|
13
11
|
useTrancheMintAccounts,
|
|
14
12
|
} from '@huma-finance/web-shared'
|
|
13
|
+
import { TOKEN_2022_PROGRAM_ID } from '@solana/spl-token'
|
|
14
|
+
import { useWallet } from '@solana/wallet-adapter-react'
|
|
15
15
|
import { Transaction } from '@solana/web3.js'
|
|
16
16
|
import { useAppDispatch, useAppSelector } from '../../../hooks/useRedux'
|
|
17
17
|
import { setStep } from '../../../store/widgets.reducers'
|
|
18
|
-
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
19
18
|
import { selectWidgetState } from '../../../store/widgets.selectors'
|
|
19
|
+
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
20
20
|
import { SolanaTxSendModal } from '../../SolanaTxSendModal'
|
|
21
21
|
|
|
22
22
|
type Props = {
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
} from '@huma-finance/shared'
|
|
6
6
|
import React, { useCallback, useEffect, useState } from 'react'
|
|
7
7
|
|
|
8
|
+
import { LenderStateAccount, useHumaProgram } from '@huma-finance/web-shared'
|
|
8
9
|
import { TOKEN_2022_PROGRAM_ID } from '@solana/spl-token'
|
|
9
10
|
import { useWallet } from '@solana/wallet-adapter-react'
|
|
10
|
-
import { LenderStateAccount, useHumaProgram } from '@huma-finance/web-shared'
|
|
11
11
|
import { Transaction } from '@solana/web3.js'
|
|
12
12
|
import { useAppDispatch } from '../../../hooks/useRedux'
|
|
13
13
|
import { setStep } from '../../../store/widgets.reducers'
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
CHAIN_TYPE,
|
|
3
|
+
SOLANA_CHAIN_INFO,
|
|
4
|
+
SolanaPoolInfo,
|
|
5
|
+
TrancheType,
|
|
6
|
+
} from '@huma-finance/shared'
|
|
2
7
|
import React from 'react'
|
|
3
8
|
|
|
4
9
|
import { PersonaEvaluation } from '../components/PersonaEvaluation'
|
|
@@ -22,6 +27,8 @@ export function Evaluation({
|
|
|
22
27
|
handleClose,
|
|
23
28
|
}: Props): React.ReactElement | null {
|
|
24
29
|
if (poolInfo.KYC?.Persona) {
|
|
30
|
+
const solanChainInfo = SOLANA_CHAIN_INFO[poolInfo.chainId]
|
|
31
|
+
|
|
25
32
|
return (
|
|
26
33
|
<PersonaEvaluation
|
|
27
34
|
poolInfo={{
|
|
@@ -33,6 +40,10 @@ export function Evaluation({
|
|
|
33
40
|
isUniTranche={isUniTranche}
|
|
34
41
|
pointsTestnetExperience={pointsTestnetExperience}
|
|
35
42
|
campaign={campaign}
|
|
43
|
+
chainSpecificData={{
|
|
44
|
+
huma_program_id: solanChainInfo.poolProgram,
|
|
45
|
+
pool_id: poolInfo.poolId,
|
|
46
|
+
}}
|
|
36
47
|
chainType={CHAIN_TYPE.SOLANA}
|
|
37
48
|
changeTranche={changeTranche}
|
|
38
49
|
/>
|
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
} from '@huma-finance/shared'
|
|
7
7
|
import React, { useCallback, useEffect, useState } from 'react'
|
|
8
8
|
|
|
9
|
-
import { TOKEN_2022_PROGRAM_ID } from '@solana/spl-token'
|
|
10
|
-
import { useWallet } from '@solana/wallet-adapter-react'
|
|
11
9
|
import { useHumaProgram, useLenderAccounts } from '@huma-finance/web-shared'
|
|
10
|
+
import { TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID } from '@solana/spl-token'
|
|
11
|
+
import { useWallet } from '@solana/wallet-adapter-react'
|
|
12
12
|
import { Transaction } from '@solana/web3.js'
|
|
13
13
|
import { useAppDispatch, useAppSelector } from '../../../hooks/useRedux'
|
|
14
14
|
import { setStep } from '../../../store/widgets.reducers'
|
|
15
|
-
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
16
15
|
import { selectWidgetState } from '../../../store/widgets.selectors'
|
|
17
|
-
import {
|
|
16
|
+
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
18
17
|
import { LoadingModal } from '../../LoadingModal'
|
|
18
|
+
import { SolanaTxSendModal } from '../../SolanaTxSendModal'
|
|
19
19
|
|
|
20
20
|
type Props = {
|
|
21
21
|
poolInfo: SolanaPoolInfo
|
|
@@ -58,6 +58,12 @@ export function Transfer({
|
|
|
58
58
|
|
|
59
59
|
const { underlyingTokenATA, seniorTrancheATA, juniorTrancheATA } =
|
|
60
60
|
getTokenAccounts(poolInfo, publicKey)
|
|
61
|
+
|
|
62
|
+
const approvedLender =
|
|
63
|
+
selectedTranche === 'senior'
|
|
64
|
+
? seniorLenderApprovedAccountPDA!
|
|
65
|
+
: juniorLenderApprovedAccountPDA!
|
|
66
|
+
|
|
61
67
|
if (
|
|
62
68
|
(selectedTranche === 'senior' && !seniorLenderStateAccount) ||
|
|
63
69
|
(selectedTranche === 'junior' && !juniorLenderStateAccount)
|
|
@@ -68,10 +74,7 @@ export function Transfer({
|
|
|
68
74
|
lender: publicKey,
|
|
69
75
|
humaConfig: poolInfo.humaConfig,
|
|
70
76
|
poolConfig: poolInfo.poolConfig,
|
|
71
|
-
approvedLender
|
|
72
|
-
selectedTranche === 'senior'
|
|
73
|
-
? seniorLenderApprovedAccountPDA!
|
|
74
|
-
: juniorLenderApprovedAccountPDA!,
|
|
77
|
+
approvedLender,
|
|
75
78
|
trancheMint:
|
|
76
79
|
selectedTranche === 'senior'
|
|
77
80
|
? poolInfo.seniorTrancheMint
|
|
@@ -89,6 +92,7 @@ export function Transfer({
|
|
|
89
92
|
const depositTx = await program.methods
|
|
90
93
|
.deposit(supplyBigNumber)
|
|
91
94
|
.accountsPartial({
|
|
95
|
+
approvedLender,
|
|
92
96
|
depositor: publicKey,
|
|
93
97
|
poolConfig: poolInfo.poolConfig,
|
|
94
98
|
underlyingMint: poolInfo.underlyingMint.address,
|
|
@@ -101,7 +105,7 @@ export function Transfer({
|
|
|
101
105
|
depositorTrancheToken:
|
|
102
106
|
selectedTranche === 'senior' ? seniorTrancheATA : juniorTrancheATA,
|
|
103
107
|
humaConfig: poolInfo.humaConfig,
|
|
104
|
-
|
|
108
|
+
underlyingTokenProgram: TOKEN_PROGRAM_ID,
|
|
105
109
|
})
|
|
106
110
|
.transaction()
|
|
107
111
|
tx.add(depositTx)
|