@huma-finance/widgets 0.0.80 → 0.0.81-beta.1108
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/API.md +0 -11
- package/dist/index.js +60790 -64401
- package/dist/src/components/Lend/solanaSupply/6-Transfer.d.ts +2 -3
- package/dist/src/components/Lend/solanaSupply/7-Success.d.ts +1 -4
- package/dist/src/components/Lend/solanaSupply/index.d.ts +1 -7
- package/dist/src/components/Lend/stellarSupply/index.d.ts +0 -4
- package/dist/src/components/Lend/supply/1-Evaluation.d.ts +8 -0
- package/dist/src/components/Lend/supplyV2/6-Transfer.d.ts +2 -5
- package/dist/src/components/Lend/supplyV2/7-Success.d.ts +1 -3
- package/dist/src/components/Lend/supplyV2/8-Notifications.d.ts +1 -3
- package/dist/src/components/Lend/supplyV2/index.d.ts +1 -9
- package/dist/src/hooks/useEA.d.ts +0 -2
- package/dist/src/store/widgets.reducers.d.ts +1 -2
- package/dist/src/store/widgets.store.d.ts +0 -4
- package/package.json +6 -6
- package/src/components/CreditLine/borrow/1-Evaluation.tsx +1 -11
- package/src/components/InvoiceFactoring/borrow/1-Evaluation.tsx +1 -10
- package/src/components/Lend/solanaSupply/6-Transfer.tsx +4 -34
- package/src/components/Lend/solanaSupply/7-Success.tsx +2 -16
- package/src/components/Lend/solanaSupply/index.tsx +1 -66
- package/src/components/Lend/stellarSupply/index.tsx +0 -5
- package/src/components/Lend/supply/{1-Evaluation/EvaluationEA.tsx → 1-Evaluation.tsx} +9 -9
- package/src/components/Lend/supply/index.tsx +0 -1
- package/src/components/Lend/supplyV2/6-Transfer.tsx +7 -35
- package/src/components/Lend/supplyV2/7-Success.tsx +2 -18
- package/src/components/Lend/supplyV2/8-Notifications.tsx +3 -26
- package/src/components/Lend/supplyV2/index.tsx +15 -72
- package/src/components/SolanaTxSendModal.tsx +1 -1
- package/src/components/StreamFactoring/borrow/1-Evaluation.tsx +1 -10
- package/src/hooks/useEA.ts +4 -22
- package/src/store/widgets.reducers.ts +0 -7
- package/src/store/widgets.store.ts +0 -4
- package/vite.config.ts +1 -1
- package/dist/src/components/Lend/components/ApproveLenderBase.d.ts +0 -14
- package/dist/src/components/Lend/components/PersonaEvaluation.d.ts +0 -17
- package/dist/src/components/Lend/components/SecuritizeEvaluation.d.ts +0 -8
- package/dist/src/components/Lend/solanaSupply/1-Evaluation.d.ts +0 -12
- package/dist/src/components/Lend/solanaSupply/2-ApproveLender.d.ts +0 -10
- package/dist/src/components/Lend/solanaSupply/8-PointsEarned.d.ts +0 -11
- package/dist/src/components/Lend/supply/1-Evaluation/EvaluationEA.d.ts +0 -8
- package/dist/src/components/Lend/supply/1-Evaluation/EvaluationKYC.d.ts +0 -8
- package/dist/src/components/Lend/supply/1-Evaluation/index.d.ts +0 -9
- package/dist/src/components/Lend/supplyV2/2-Evaluation.d.ts +0 -12
- package/dist/src/components/Lend/supplyV2/3-ApproveLender.d.ts +0 -10
- package/dist/src/components/PointsEarned.d.ts +0 -10
- package/dist/src/components/SignIn.d.ts +0 -6
- package/dist/src/cosmos/CreditLineBorrow.fixture.d.ts +0 -2
- package/dist/src/cosmos/CreditLinePayment.fixture.d.ts +0 -2
- package/dist/src/cosmos/InvoiceFactoringBorrow.fixture.d.ts +0 -2
- package/dist/src/cosmos/InvoiceFactoringPayment.fixture.d.ts +0 -2
- package/dist/src/cosmos/LendSupply.fixture.d.ts +0 -2
- package/dist/src/cosmos/LendWithdraw.fixture.d.ts +0 -2
- package/dist/src/cosmos/SDKTesting.fixture.d.ts +0 -2
- package/dist/src/cosmos/SuperfluidFactoringBorrow.fixture.d.ts +0 -2
- package/dist/src/cosmos/WalletWrapper.d.ts +0 -3
- package/dist/src/cosmos/utils/index.d.ts +0 -18
- package/src/components/Lend/components/ApproveLenderBase.tsx +0 -128
- package/src/components/Lend/components/PersonaEvaluation.tsx +0 -371
- package/src/components/Lend/components/SecuritizeEvaluation.tsx +0 -343
- package/src/components/Lend/solanaSupply/1-Evaluation.tsx +0 -43
- package/src/components/Lend/solanaSupply/2-ApproveLender.tsx +0 -45
- package/src/components/Lend/solanaSupply/8-PointsEarned.tsx +0 -189
- package/src/components/Lend/supply/1-Evaluation/EvaluationKYC.tsx +0 -369
- package/src/components/Lend/supply/1-Evaluation/index.tsx +0 -31
- package/src/components/Lend/supplyV2/2-Evaluation.tsx +0 -47
- package/src/components/Lend/supplyV2/3-ApproveLender.tsx +0 -35
- package/src/components/PointsEarned.tsx +0 -135
- package/src/components/SignIn.tsx +0 -53
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SolanaPoolInfo, TrancheType } from '../../../../../huma-shared/src';
|
|
2
2
|
import { SolanaPoolState } from '../../../../../huma-web-shared/src';
|
|
3
3
|
import { default as React } from 'react';
|
|
4
4
|
type Props = {
|
|
5
5
|
poolInfo: SolanaPoolInfo;
|
|
6
6
|
poolState: SolanaPoolState;
|
|
7
7
|
selectedTranche: TrancheType;
|
|
8
|
-
networkType: NETWORK_TYPE;
|
|
9
8
|
};
|
|
10
|
-
export declare function Transfer({ poolInfo, poolState, selectedTranche,
|
|
9
|
+
export declare function Transfer({ poolInfo, poolState, selectedTranche, }: Props): React.ReactElement | null;
|
|
11
10
|
export {};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { CloseModalOptions, SolanaPoolInfo } from '../../../../../huma-shared/src';
|
|
2
2
|
import { SolanaPoolState } from '../../../../../huma-web-shared/src';
|
|
3
3
|
import { default as React } from 'react';
|
|
4
|
-
import { Campaign } from '.';
|
|
5
4
|
type Props = {
|
|
6
5
|
poolInfo: SolanaPoolInfo;
|
|
7
6
|
poolState: SolanaPoolState;
|
|
8
|
-
campaign?: Campaign;
|
|
9
|
-
isExistingUser: boolean;
|
|
10
7
|
handleAction: (options?: CloseModalOptions) => void;
|
|
11
8
|
};
|
|
12
|
-
export declare function Success({ poolInfo, poolState,
|
|
9
|
+
export declare function Success({ poolInfo, poolState, handleAction, }: Props): React.ReactElement;
|
|
13
10
|
export {};
|
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import { CloseModalOptions, SolanaPoolInfo } from '../../../../../huma-shared/src';
|
|
2
2
|
import { SolanaPoolState } from '../../../../../huma-web-shared/src';
|
|
3
3
|
import { default as React } from 'react';
|
|
4
|
-
export interface Campaign {
|
|
5
|
-
id: string;
|
|
6
|
-
campaignGroupId: string;
|
|
7
|
-
}
|
|
8
4
|
/**
|
|
9
5
|
* Lend pool supply props
|
|
10
6
|
* @typedef {Object} SolanaLendSupplyProps
|
|
11
7
|
* @property {SolanaPoolInfo} poolInfo The metadata of the pool.
|
|
12
8
|
* @property {SolanaPoolState} poolState The current state config of the pool.
|
|
13
|
-
* @param {string} documentHash The subscription file hash.
|
|
14
9
|
* @property {function((CloseModalOptions|undefined)):void} handleClose Function to notify to close the widget modal when user clicks the 'x' close button.
|
|
15
10
|
* @property {function():void|undefined} handleSuccess Optional function to notify that the lending pool supply action is successful.
|
|
16
11
|
*/
|
|
17
12
|
export interface SolanaLendSupplyProps {
|
|
18
13
|
poolInfo: SolanaPoolInfo;
|
|
19
14
|
poolState: SolanaPoolState;
|
|
20
|
-
documentHash: string;
|
|
21
15
|
handleClose: (options?: CloseModalOptions) => void;
|
|
22
16
|
handleSuccess?: () => void;
|
|
23
17
|
}
|
|
24
|
-
export declare function SolanaLendSupply({ poolInfo, poolState,
|
|
18
|
+
export declare function SolanaLendSupply({ poolInfo, poolState, handleClose, handleSuccess, }: SolanaLendSupplyProps): React.ReactElement | null;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { CloseModalOptions, StellarPoolInfo } from '../../../../../huma-shared/src';
|
|
2
2
|
import { StellarPoolState } from '../../../../../huma-web-shared/src';
|
|
3
3
|
import { default as React } from 'react';
|
|
4
|
-
export interface Campaign {
|
|
5
|
-
id: string;
|
|
6
|
-
campaignGroupId: string;
|
|
7
|
-
}
|
|
8
4
|
/**
|
|
9
5
|
* Lend pool supply props
|
|
10
6
|
* @typedef {Object} StellarLendSupplyProps
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PoolInfoType } from '../../../../../huma-shared/src';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
type Props = {
|
|
4
|
+
poolInfo: PoolInfoType;
|
|
5
|
+
handleApproveSuccess: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function Evaluation({ poolInfo, handleApproveSuccess, }: Props): React.ReactElement | null;
|
|
8
|
+
export {};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PoolInfoV2, TrancheType } from '../../../../../huma-shared/src';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
|
-
import { Campaign } from '.';
|
|
4
3
|
type Props = {
|
|
5
4
|
poolInfo: PoolInfoV2;
|
|
6
5
|
trancheType: TrancheType;
|
|
7
|
-
networkType: NETWORK_TYPE;
|
|
8
|
-
campaign?: Campaign;
|
|
9
6
|
};
|
|
10
|
-
export declare function Transfer({ poolInfo, trancheType,
|
|
7
|
+
export declare function Transfer({ poolInfo, trancheType, }: Props): React.ReactElement | null;
|
|
11
8
|
export {};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { PoolInfoV2 } from '../../../../../huma-shared/src';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
|
-
import { Campaign } from '.';
|
|
4
3
|
type Props = {
|
|
5
4
|
poolInfo: PoolInfoV2;
|
|
6
5
|
lpConfig: {
|
|
7
6
|
withdrawalLockoutPeriodInDays: number;
|
|
8
7
|
};
|
|
9
|
-
campaign?: Campaign;
|
|
10
8
|
handleAction: () => void;
|
|
11
9
|
};
|
|
12
|
-
export declare function Success({ poolInfo, lpConfig,
|
|
10
|
+
export declare function Success({ poolInfo, lpConfig, handleAction, }: Props): React.ReactElement;
|
|
13
11
|
export {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { Campaign } from '.';
|
|
3
2
|
type Props = {
|
|
4
|
-
campaign?: Campaign;
|
|
5
3
|
handleAction: () => void;
|
|
6
4
|
};
|
|
7
|
-
export declare function Notifications({
|
|
5
|
+
export declare function Notifications({ handleAction }: Props): React.ReactElement;
|
|
8
6
|
export {};
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import { CloseModalOptions, POOL_NAME } from '../../../../../huma-shared/src';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
|
-
export interface Campaign {
|
|
4
|
-
id: string;
|
|
5
|
-
campaignGroupId: string;
|
|
6
|
-
}
|
|
7
3
|
/**
|
|
8
4
|
* Lend pool supply props
|
|
9
5
|
* @typedef {Object} LendSupplyPropsV2
|
|
10
6
|
* @property {POOL_NAME} poolName The name of the pool.
|
|
11
|
-
* @property {Campaign} campaign The campaign info.
|
|
12
|
-
* @param {string} documentHash The subscription file hash.
|
|
13
7
|
* @property {function((CloseModalOptions|undefined)):void} handleClose Function to notify to close the widget modal when user clicks the 'x' close button.
|
|
14
8
|
* @property {function((number|undefined)):void|undefined} handleSuccess Optional function to notify that the lending pool supply action is successful.
|
|
15
9
|
*/
|
|
16
10
|
export interface LendSupplyPropsV2 {
|
|
17
11
|
poolName: keyof typeof POOL_NAME;
|
|
18
|
-
campaign?: Campaign;
|
|
19
|
-
documentHash?: string;
|
|
20
12
|
handleClose: (options?: CloseModalOptions) => void;
|
|
21
13
|
handleSuccess?: (blockNumber?: number) => void;
|
|
22
14
|
}
|
|
23
|
-
export declare function LendSupplyV2({ poolName: poolNameStr,
|
|
15
|
+
export declare function LendSupplyV2({ poolName: poolNameStr, handleClose, handleSuccess, }: LendSupplyPropsV2): React.ReactElement | null;
|
|
@@ -2,7 +2,5 @@ import { EAPayload } from '../../../huma-shared/src';
|
|
|
2
2
|
import { WIDGET_STEP } from '../store/widgets.store';
|
|
3
3
|
declare const useEA: () => {
|
|
4
4
|
checkingEA: (payload: EAPayload, nextStep: WIDGET_STEP) => Promise<void>;
|
|
5
|
-
isWalletOwnershipVerificationRequired: boolean;
|
|
6
|
-
isWalletOwnershipVerified: boolean;
|
|
7
5
|
};
|
|
8
6
|
export default useEA;
|
|
@@ -29,7 +29,6 @@ export declare const widgetSlice: import('@reduxjs/toolkit').Slice<import('./wid
|
|
|
29
29
|
setMultisend: (state: import('immer/dist/internal').WritableDraft<import('./widgets.store').WidgetState>, { payload }: PayloadAction<MultisendPayload>) => void;
|
|
30
30
|
setSolanaSignature: (state: import('immer/dist/internal').WritableDraft<import('./widgets.store').WidgetState>, { payload }: PayloadAction<string>) => void;
|
|
31
31
|
setTxHash: (state: import('immer/dist/internal').WritableDraft<import('./widgets.store').WidgetState>, { payload }: PayloadAction<string>) => void;
|
|
32
|
-
setPointsAccumulated: (state: import('immer/dist/internal').WritableDraft<import('./widgets.store').WidgetState>, { payload }: PayloadAction<number | undefined>) => void;
|
|
33
32
|
setLoggingContext: (state: import('immer/dist/internal').WritableDraft<import('./widgets.store').WidgetState>, { payload }: PayloadAction<LoggingContext>) => void;
|
|
34
33
|
setError: (state: import('immer/dist/internal').WritableDraft<import('./widgets.store').WidgetState>, { payload, }: PayloadAction<{
|
|
35
34
|
errorMessage: string;
|
|
@@ -53,6 +52,6 @@ export declare const resetState: import('@reduxjs/toolkit').ActionCreatorWithout
|
|
|
53
52
|
}, "widget/setPaymentAmount">, setStream: import('@reduxjs/toolkit').ActionCreatorWithPayload<Partial<{
|
|
54
53
|
borrowFlowrate: string;
|
|
55
54
|
durationInSeconds: number;
|
|
56
|
-
}>, "widget/setStream">, setMultisend: import('@reduxjs/toolkit').ActionCreatorWithPayload<MultisendPayload, "widget/setMultisend">, setSupplyAmount: import('@reduxjs/toolkit').ActionCreatorWithPayload<number, "widget/setSupplyAmount">, setWithdrawAmount: import('@reduxjs/toolkit').ActionCreatorWithPayload<number, "widget/setWithdrawAmount">, setWithdrawShares: import('@reduxjs/toolkit').ActionCreatorWithPayload<number, "widget/setWithdrawShares">, setRedeemAmount: import('@reduxjs/toolkit').ActionCreatorWithPayload<number, "widget/setRedeemAmount">, setRedeemShares: import('@reduxjs/toolkit').ActionCreatorWithPayload<number, "widget/setRedeemShares">, setSolanaSignature: import('@reduxjs/toolkit').ActionCreatorWithPayload<string, "widget/setSolanaSignature">, setTxHash: import('@reduxjs/toolkit').ActionCreatorWithPayload<string, "widget/setTxHash">,
|
|
55
|
+
}>, "widget/setStream">, setMultisend: import('@reduxjs/toolkit').ActionCreatorWithPayload<MultisendPayload, "widget/setMultisend">, setSupplyAmount: import('@reduxjs/toolkit').ActionCreatorWithPayload<number, "widget/setSupplyAmount">, setWithdrawAmount: import('@reduxjs/toolkit').ActionCreatorWithPayload<number, "widget/setWithdrawAmount">, setWithdrawShares: import('@reduxjs/toolkit').ActionCreatorWithPayload<number, "widget/setWithdrawShares">, setRedeemAmount: import('@reduxjs/toolkit').ActionCreatorWithPayload<number, "widget/setRedeemAmount">, setRedeemShares: import('@reduxjs/toolkit').ActionCreatorWithPayload<number, "widget/setRedeemShares">, setSolanaSignature: import('@reduxjs/toolkit').ActionCreatorWithPayload<string, "widget/setSolanaSignature">, setTxHash: import('@reduxjs/toolkit').ActionCreatorWithPayload<string, "widget/setTxHash">, setLoggingContext: import('@reduxjs/toolkit').ActionCreatorWithPayload<LoggingContext, "widget/setLoggingContext">;
|
|
57
56
|
declare const _default: import('redux').Reducer<import('./widgets.store').WidgetState>;
|
|
58
57
|
export default _default;
|
|
@@ -5,13 +5,11 @@ export declare enum WIDGET_TYPE {
|
|
|
5
5
|
PAYMENT = "PAYMENT"
|
|
6
6
|
}
|
|
7
7
|
export declare enum WIDGET_STEP {
|
|
8
|
-
SignIn = "SignIn",
|
|
9
8
|
ChooseTranche = "ChooseTranche",
|
|
10
9
|
ChoosePaymentType = "ChoosePaymentType",
|
|
11
10
|
Evaluation = "Evaluation",
|
|
12
11
|
FirstLossCover = "FirstLossCover",
|
|
13
12
|
ChooseAmount = "ChooseAmount",
|
|
14
|
-
ApproveLender = "ApproveLender",
|
|
15
13
|
Permit = "Permit",
|
|
16
14
|
ApproveAllowance = "ApproveAllowance",
|
|
17
15
|
MintNFT = "MintNFT",
|
|
@@ -23,7 +21,6 @@ export declare enum WIDGET_STEP {
|
|
|
23
21
|
Transfer = "Transfer",
|
|
24
22
|
CheckWithdrawable = "CheckWithdrawable",
|
|
25
23
|
Notifications = "Notifications",
|
|
26
|
-
PointsEarned = "PointsEarned",
|
|
27
24
|
Done = "Done",
|
|
28
25
|
Error = "Error"
|
|
29
26
|
}
|
|
@@ -57,7 +54,6 @@ export type WidgetState = {
|
|
|
57
54
|
stream?: WidgetStream;
|
|
58
55
|
multisend?: MultisendPayload;
|
|
59
56
|
solanaSignature?: string;
|
|
60
|
-
pointsAccumulated?: number;
|
|
61
57
|
txHash?: string;
|
|
62
58
|
loggingContext?: LoggingContext;
|
|
63
59
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huma-finance/widgets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.81-beta.1108+ef6838f",
|
|
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.
|
|
26
|
-
"@huma-finance/shared": "^0.0.
|
|
27
|
-
"@huma-finance/web-shared": "^0.0.
|
|
25
|
+
"@huma-finance/sdk": "^0.0.81-beta.1108+ef6838f",
|
|
26
|
+
"@huma-finance/shared": "^0.0.81-beta.1108+ef6838f",
|
|
27
|
+
"@huma-finance/web-shared": "^0.0.81-beta.1108+ef6838f",
|
|
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",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"start": "tsc -w",
|
|
71
|
-
"build": "vite build",
|
|
71
|
+
"build": "NODE_OPTIONS=--max-old-space-size=4096 vite build",
|
|
72
72
|
"cosmos": "cosmos",
|
|
73
73
|
"prettier": "prettier --write \"src/**/*.{js,ts,tsx,graphql}\"",
|
|
74
74
|
"lint": "eslint --max-warnings=0 \"src/**/*.{js,ts,tsx,graphql}\"",
|
|
@@ -190,5 +190,5 @@
|
|
|
190
190
|
"optionalDependencies": {
|
|
191
191
|
"encoding": "^0.1.13"
|
|
192
192
|
},
|
|
193
|
-
"gitHead": "
|
|
193
|
+
"gitHead": "ef6838f8f618ff6d0cb21b00ae360bafeaed0926"
|
|
194
194
|
}
|
|
@@ -9,7 +9,6 @@ import { setStep } from '../../../store/widgets.reducers'
|
|
|
9
9
|
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
10
10
|
import { CheckCircleIcon, CheckGreenIcon } from '../../icons'
|
|
11
11
|
import spinner from '../../icons/spinner.gif'
|
|
12
|
-
import { SignIn } from '../../SignIn'
|
|
13
12
|
|
|
14
13
|
type Props = {
|
|
15
14
|
poolInfo: PoolInfoType
|
|
@@ -21,11 +20,7 @@ export function Evaluation({
|
|
|
21
20
|
handleApprove,
|
|
22
21
|
}: Props): React.ReactElement {
|
|
23
22
|
const theme = useTheme()
|
|
24
|
-
const {
|
|
25
|
-
checkingEA,
|
|
26
|
-
isWalletOwnershipVerificationRequired,
|
|
27
|
-
isWalletOwnershipVerified,
|
|
28
|
-
} = useEA()
|
|
23
|
+
const { checkingEA } = useEA()
|
|
29
24
|
const dispatch = useAppDispatch()
|
|
30
25
|
const { account, chainId } = useWeb3React()
|
|
31
26
|
const [status, setStatus] = useState<'checking' | 'success'>('checking')
|
|
@@ -52,7 +47,6 @@ export function Evaluation({
|
|
|
52
47
|
handleApprove,
|
|
53
48
|
poolInfo.assetAddress,
|
|
54
49
|
poolInfo.pool,
|
|
55
|
-
isWalletOwnershipVerified,
|
|
56
50
|
])
|
|
57
51
|
|
|
58
52
|
const styles = {
|
|
@@ -121,10 +115,6 @@ export function Evaluation({
|
|
|
121
115
|
dispatch(setStep(WIDGET_STEP.ChooseAmount))
|
|
122
116
|
}
|
|
123
117
|
|
|
124
|
-
if (isWalletOwnershipVerificationRequired) {
|
|
125
|
-
return <SignIn />
|
|
126
|
-
}
|
|
127
|
-
|
|
128
118
|
return (
|
|
129
119
|
<Box css={styles.wrapper}>
|
|
130
120
|
<Typography variant='h6' css={styles.header}>
|
|
@@ -5,7 +5,6 @@ import React, { useEffect } from 'react'
|
|
|
5
5
|
import useEA from '../../../hooks/useEA'
|
|
6
6
|
import { LoadingModal } from '../../LoadingModal'
|
|
7
7
|
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
8
|
-
import { SignIn } from '../../SignIn'
|
|
9
8
|
|
|
10
9
|
type Props = {
|
|
11
10
|
poolInfo: PoolInfoType
|
|
@@ -13,11 +12,7 @@ type Props = {
|
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
export function Evaluation({ poolInfo, tokenId }: Props): React.ReactElement {
|
|
16
|
-
const {
|
|
17
|
-
checkingEA,
|
|
18
|
-
isWalletOwnershipVerificationRequired,
|
|
19
|
-
isWalletOwnershipVerified,
|
|
20
|
-
} = useEA()
|
|
15
|
+
const { checkingEA } = useEA()
|
|
21
16
|
const { account, chainId } = useWeb3React()
|
|
22
17
|
|
|
23
18
|
useEffect(() => {
|
|
@@ -43,12 +38,8 @@ export function Evaluation({ poolInfo, tokenId }: Props): React.ReactElement {
|
|
|
43
38
|
poolInfo.assetAddress,
|
|
44
39
|
poolInfo.pool,
|
|
45
40
|
tokenId,
|
|
46
|
-
isWalletOwnershipVerified,
|
|
47
41
|
])
|
|
48
42
|
|
|
49
|
-
if (isWalletOwnershipVerificationRequired) {
|
|
50
|
-
return <SignIn />
|
|
51
|
-
}
|
|
52
43
|
return (
|
|
53
44
|
<LoadingModal
|
|
54
45
|
title='Checking Invoice'
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CampaignService,
|
|
3
2
|
convertToShares,
|
|
4
3
|
getTokenAccounts,
|
|
5
|
-
NETWORK_TYPE,
|
|
6
4
|
SolanaPoolInfo,
|
|
7
5
|
SolanaTokenUtils,
|
|
8
6
|
TrancheType,
|
|
9
7
|
} from '@huma-finance/shared'
|
|
10
8
|
import {
|
|
11
|
-
checkIsDev,
|
|
12
9
|
SolanaPoolState,
|
|
13
10
|
useHumaProgram,
|
|
14
11
|
useLenderAccounts,
|
|
@@ -24,7 +21,7 @@ import { ComputeBudgetProgram, PublicKey, Transaction } from '@solana/web3.js'
|
|
|
24
21
|
import React, { useCallback, useEffect, useState } from 'react'
|
|
25
22
|
import useLogOnFirstMount from '../../../hooks/useLogOnFirstMount'
|
|
26
23
|
import { useAppDispatch, useAppSelector } from '../../../hooks/useRedux'
|
|
27
|
-
import {
|
|
24
|
+
import { setStep } from '../../../store/widgets.reducers'
|
|
28
25
|
import { selectWidgetState } from '../../../store/widgets.selectors'
|
|
29
26
|
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
30
27
|
import { LoadingModal } from '../../LoadingModal'
|
|
@@ -34,17 +31,14 @@ type Props = {
|
|
|
34
31
|
poolInfo: SolanaPoolInfo
|
|
35
32
|
poolState: SolanaPoolState
|
|
36
33
|
selectedTranche: TrancheType
|
|
37
|
-
networkType: NETWORK_TYPE
|
|
38
34
|
}
|
|
39
35
|
|
|
40
36
|
export function Transfer({
|
|
41
37
|
poolInfo,
|
|
42
38
|
poolState,
|
|
43
39
|
selectedTranche,
|
|
44
|
-
networkType,
|
|
45
40
|
}: Props): React.ReactElement | null {
|
|
46
41
|
useLogOnFirstMount('Transaction')
|
|
47
|
-
const isDev = checkIsDev()
|
|
48
42
|
const dispatch = useAppDispatch()
|
|
49
43
|
const { publicKey } = useWallet()
|
|
50
44
|
const { supplyAmount } = useAppSelector(selectWidgetState)
|
|
@@ -70,33 +64,9 @@ export function Transfer({
|
|
|
70
64
|
} = useTrancheTokenAccounts(poolInfo)
|
|
71
65
|
const program = useHumaProgram(poolInfo.chainId)
|
|
72
66
|
|
|
73
|
-
const handleSuccess = useCallback(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
try {
|
|
77
|
-
const result = await CampaignService.updateHumaAccountPoints(
|
|
78
|
-
publicKey.toString(),
|
|
79
|
-
options.signature,
|
|
80
|
-
poolInfo.chainId,
|
|
81
|
-
networkType,
|
|
82
|
-
isDev,
|
|
83
|
-
)
|
|
84
|
-
dispatch(setPointsAccumulated(result.pointsAccumulated))
|
|
85
|
-
} catch (error) {
|
|
86
|
-
console.error('Failed to update wallet rewards', error)
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
dispatch(setStep(WIDGET_STEP.Done))
|
|
90
|
-
},
|
|
91
|
-
[
|
|
92
|
-
dispatch,
|
|
93
|
-
isDev,
|
|
94
|
-
networkType,
|
|
95
|
-
poolInfo.chainId,
|
|
96
|
-
poolState.campaign,
|
|
97
|
-
publicKey,
|
|
98
|
-
],
|
|
99
|
-
)
|
|
67
|
+
const handleSuccess = useCallback(() => {
|
|
68
|
+
dispatch(setStep(WIDGET_STEP.Done))
|
|
69
|
+
}, [dispatch])
|
|
100
70
|
|
|
101
71
|
useEffect(() => {
|
|
102
72
|
async function getTx() {
|
|
@@ -7,32 +7,23 @@ import {
|
|
|
7
7
|
import { SolanaPoolState } from '@huma-finance/web-shared'
|
|
8
8
|
import dayjs from 'dayjs'
|
|
9
9
|
import React, { useCallback } from 'react'
|
|
10
|
-
import { useDispatch } from 'react-redux'
|
|
11
|
-
import { Campaign } from '.'
|
|
12
10
|
import useLogOnFirstMount from '../../../hooks/useLogOnFirstMount'
|
|
13
11
|
import { useAppSelector } from '../../../hooks/useRedux'
|
|
14
|
-
import { setStep } from '../../../store/widgets.reducers'
|
|
15
12
|
import { selectWidgetState } from '../../../store/widgets.selectors'
|
|
16
|
-
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
17
13
|
import { SolanaTxDoneModal } from '../../SolanaTxDoneModal'
|
|
18
14
|
|
|
19
15
|
type Props = {
|
|
20
16
|
poolInfo: SolanaPoolInfo
|
|
21
17
|
poolState: SolanaPoolState
|
|
22
|
-
campaign?: Campaign
|
|
23
|
-
isExistingUser: boolean
|
|
24
18
|
handleAction: (options?: CloseModalOptions) => void
|
|
25
19
|
}
|
|
26
20
|
|
|
27
21
|
export function Success({
|
|
28
22
|
poolInfo,
|
|
29
23
|
poolState,
|
|
30
|
-
campaign,
|
|
31
|
-
isExistingUser,
|
|
32
24
|
handleAction,
|
|
33
25
|
}: Props): React.ReactElement {
|
|
34
26
|
useLogOnFirstMount('Success')
|
|
35
|
-
const dispatch = useDispatch()
|
|
36
27
|
const { supplyAmount, solanaSignature } = useAppSelector(selectWidgetState)
|
|
37
28
|
const { symbol } = poolInfo.underlyingMint
|
|
38
29
|
|
|
@@ -55,12 +46,8 @@ export function Success({
|
|
|
55
46
|
}
|
|
56
47
|
|
|
57
48
|
const handleUserAction = useCallback(() => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
} else {
|
|
61
|
-
handleAction({ isSuccess: true })
|
|
62
|
-
}
|
|
63
|
-
}, [campaign, dispatch, handleAction, isExistingUser])
|
|
49
|
+
handleAction({ isSuccess: true })
|
|
50
|
+
}, [handleAction])
|
|
64
51
|
|
|
65
52
|
return (
|
|
66
53
|
<SolanaTxDoneModal
|
|
@@ -69,7 +56,6 @@ export function Success({
|
|
|
69
56
|
subContent={getSubContent()}
|
|
70
57
|
chainId={poolInfo.chainId}
|
|
71
58
|
solanaSignature={solanaSignature}
|
|
72
|
-
buttonText={campaign && !isExistingUser ? 'VIEW REWARDS' : 'DONE'}
|
|
73
59
|
/>
|
|
74
60
|
)
|
|
75
61
|
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CampaignService,
|
|
3
2
|
CloseModalOptions,
|
|
4
|
-
getSolanaNetworkType,
|
|
5
3
|
SolanaPoolInfo,
|
|
6
4
|
TrancheType,
|
|
7
5
|
} from '@huma-finance/shared'
|
|
8
6
|
import {
|
|
9
|
-
checkIsDev,
|
|
10
7
|
LoggingContext,
|
|
11
8
|
LoggingContextHelper,
|
|
12
9
|
SolanaPoolState,
|
|
@@ -23,10 +20,7 @@ import {
|
|
|
23
20
|
selectWidgetState,
|
|
24
21
|
} from '../../../store/widgets.selectors'
|
|
25
22
|
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
26
|
-
import { PointsEarned } from '../../PointsEarned'
|
|
27
23
|
import { WidgetWrapper } from '../../WidgetWrapper'
|
|
28
|
-
import { Evaluation } from './1-Evaluation'
|
|
29
|
-
import { ApproveLender } from './2-ApproveLender'
|
|
30
24
|
import { ChooseTranche } from './3-ChooseTranche'
|
|
31
25
|
import { ChooseAmount } from './4-ChooseAmount'
|
|
32
26
|
import { ApproveAllowance } from './5-ApproveAllowance'
|
|
@@ -34,24 +28,17 @@ import { Transfer } from './6-Transfer'
|
|
|
34
28
|
import { Success } from './7-Success'
|
|
35
29
|
import { SolanaErrorModal } from '../../SolanaErrorModal'
|
|
36
30
|
|
|
37
|
-
export interface Campaign {
|
|
38
|
-
id: string
|
|
39
|
-
campaignGroupId: string
|
|
40
|
-
}
|
|
41
|
-
|
|
42
31
|
/**
|
|
43
32
|
* Lend pool supply props
|
|
44
33
|
* @typedef {Object} SolanaLendSupplyProps
|
|
45
34
|
* @property {SolanaPoolInfo} poolInfo The metadata of the pool.
|
|
46
35
|
* @property {SolanaPoolState} poolState The current state config of the pool.
|
|
47
|
-
* @param {string} documentHash The subscription file hash.
|
|
48
36
|
* @property {function((CloseModalOptions|undefined)):void} handleClose Function to notify to close the widget modal when user clicks the 'x' close button.
|
|
49
37
|
* @property {function():void|undefined} handleSuccess Optional function to notify that the lending pool supply action is successful.
|
|
50
38
|
*/
|
|
51
39
|
export interface SolanaLendSupplyProps {
|
|
52
40
|
poolInfo: SolanaPoolInfo
|
|
53
41
|
poolState: SolanaPoolState
|
|
54
|
-
documentHash: string
|
|
55
42
|
handleClose: (options?: CloseModalOptions) => void
|
|
56
43
|
handleSuccess?: () => void
|
|
57
44
|
}
|
|
@@ -59,12 +46,10 @@ export interface SolanaLendSupplyProps {
|
|
|
59
46
|
export function SolanaLendSupply({
|
|
60
47
|
poolInfo,
|
|
61
48
|
poolState,
|
|
62
|
-
documentHash,
|
|
63
49
|
handleClose,
|
|
64
50
|
handleSuccess,
|
|
65
51
|
}: SolanaLendSupplyProps): React.ReactElement | null {
|
|
66
52
|
const dispatch = useDispatch()
|
|
67
|
-
const isDev = checkIsDev()
|
|
68
53
|
const { isUniTranche } = poolState
|
|
69
54
|
const {
|
|
70
55
|
seniorLenderApproved,
|
|
@@ -75,28 +60,12 @@ export function SolanaLendSupply({
|
|
|
75
60
|
const { step, errorMessage } = useAppSelector(selectWidgetState)
|
|
76
61
|
const loggingHelper = useAppSelector(selectWidgetLoggingContext)
|
|
77
62
|
const [selectedTranche, setSelectedTranche] = useState<TrancheType>()
|
|
78
|
-
const [isExistingUser, setIsExistingUser] = useState<boolean>(false)
|
|
79
63
|
|
|
80
64
|
const handleCloseFlow = (options?: CloseModalOptions) => {
|
|
81
65
|
loggingHelper.logAction('ExitFlow', {})
|
|
82
66
|
handleClose(options)
|
|
83
67
|
}
|
|
84
68
|
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
async function fetchPoints() {
|
|
87
|
-
const points = await CampaignService.getHumaAccountPoints(
|
|
88
|
-
import.meta.env.VITE_NETWORK_TYPE,
|
|
89
|
-
isDev,
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
if (points && points?.totalPoints > 0) {
|
|
93
|
-
setIsExistingUser(true)
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
fetchPoints()
|
|
97
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
98
|
-
}, [])
|
|
99
|
-
|
|
100
69
|
useEffect(() => {
|
|
101
70
|
if (!step && !isLoadingLenderAccounts && !isLoadingTokenAccount) {
|
|
102
71
|
// Set initial logging context
|
|
@@ -112,18 +81,7 @@ export function SolanaLendSupply({
|
|
|
112
81
|
dispatch(setLoggingContext(context))
|
|
113
82
|
|
|
114
83
|
if (!juniorLenderApproved && !seniorLenderApproved) {
|
|
115
|
-
|
|
116
|
-
step: WIDGET_STEP.Evaluation,
|
|
117
|
-
})
|
|
118
|
-
dispatch(setStep(WIDGET_STEP.Evaluation))
|
|
119
|
-
return
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (!isUniTranche && (!juniorLenderApproved || !seniorLenderApproved)) {
|
|
123
|
-
loggingHelperInit.logAction('SetInitialStep', {
|
|
124
|
-
step: WIDGET_STEP.ApproveLender,
|
|
125
|
-
})
|
|
126
|
-
dispatch(setStep(WIDGET_STEP.ApproveLender))
|
|
84
|
+
handleClose()
|
|
127
85
|
return
|
|
128
86
|
}
|
|
129
87
|
|
|
@@ -185,23 +143,6 @@ export function SolanaLendSupply({
|
|
|
185
143
|
handleClose={handleCloseFlow}
|
|
186
144
|
handleSuccess={handleSuccess}
|
|
187
145
|
>
|
|
188
|
-
{step === WIDGET_STEP.Evaluation && (
|
|
189
|
-
<Evaluation
|
|
190
|
-
poolInfo={poolInfo}
|
|
191
|
-
campaign={poolState.campaign}
|
|
192
|
-
documentHash={documentHash}
|
|
193
|
-
networkType={getSolanaNetworkType(poolInfo.chainId)}
|
|
194
|
-
handleClose={handleCloseFlow}
|
|
195
|
-
/>
|
|
196
|
-
)}
|
|
197
|
-
{step === WIDGET_STEP.ApproveLender && (
|
|
198
|
-
<ApproveLender
|
|
199
|
-
poolInfo={poolInfo}
|
|
200
|
-
isUniTranche={!!isUniTranche}
|
|
201
|
-
documentHash={documentHash}
|
|
202
|
-
changeTranche={setSelectedTranche}
|
|
203
|
-
/>
|
|
204
|
-
)}
|
|
205
146
|
{step === WIDGET_STEP.ChooseTranche && (
|
|
206
147
|
<ChooseTranche
|
|
207
148
|
poolUnderlyingToken={poolInfo.underlyingMint}
|
|
@@ -226,21 +167,15 @@ export function SolanaLendSupply({
|
|
|
226
167
|
poolInfo={poolInfo}
|
|
227
168
|
poolState={poolState}
|
|
228
169
|
selectedTranche={selectedTranche}
|
|
229
|
-
networkType={getSolanaNetworkType(poolInfo.chainId)}
|
|
230
170
|
/>
|
|
231
171
|
)}
|
|
232
172
|
{step === WIDGET_STEP.Done && (
|
|
233
173
|
<Success
|
|
234
174
|
poolInfo={poolInfo}
|
|
235
175
|
poolState={poolState}
|
|
236
|
-
campaign={poolState.campaign}
|
|
237
176
|
handleAction={handleCloseFlow}
|
|
238
|
-
isExistingUser={isExistingUser}
|
|
239
177
|
/>
|
|
240
178
|
)}
|
|
241
|
-
{step === WIDGET_STEP.PointsEarned && (
|
|
242
|
-
<PointsEarned lpConfig={poolState} handleAction={handleCloseFlow} />
|
|
243
|
-
)}
|
|
244
179
|
{step === WIDGET_STEP.Error && (
|
|
245
180
|
<SolanaErrorModal
|
|
246
181
|
chainId={poolInfo.chainId}
|
|
@@ -24,11 +24,6 @@ import { ChooseAmount } from './3-ChooseAmount'
|
|
|
24
24
|
import { Transfer } from './4-Transfer'
|
|
25
25
|
import { Success } from './5-Success'
|
|
26
26
|
|
|
27
|
-
export interface Campaign {
|
|
28
|
-
id: string
|
|
29
|
-
campaignGroupId: string
|
|
30
|
-
}
|
|
31
|
-
|
|
32
27
|
/**
|
|
33
28
|
* Lend pool supply props
|
|
34
29
|
* @typedef {Object} StellarLendSupplyProps
|
|
@@ -3,21 +3,21 @@ import { useWeb3React } from '@web3-react/core'
|
|
|
3
3
|
import { EAService, PoolInfoType } from '@huma-finance/shared'
|
|
4
4
|
import React, { useState } from 'react'
|
|
5
5
|
|
|
6
|
-
import { useAppDispatch } from '
|
|
7
|
-
import { setError, setStep } from '
|
|
8
|
-
import { WIDGET_STEP } from '
|
|
9
|
-
import { CustomError } from '
|
|
10
|
-
import { BottomButton } from '
|
|
11
|
-
import { ApproveLenderImg } from '
|
|
12
|
-
import { LoadingModal } from '
|
|
13
|
-
import { WrapperModal } from '
|
|
6
|
+
import { useAppDispatch } from '../../../hooks/useRedux'
|
|
7
|
+
import { setError, setStep } from '../../../store/widgets.reducers'
|
|
8
|
+
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
9
|
+
import { CustomError } from '../../../utilTypes'
|
|
10
|
+
import { BottomButton } from '../../BottomButton'
|
|
11
|
+
import { ApproveLenderImg } from '../../images'
|
|
12
|
+
import { LoadingModal } from '../../LoadingModal'
|
|
13
|
+
import { WrapperModal } from '../../WrapperModal'
|
|
14
14
|
|
|
15
15
|
type Props = {
|
|
16
16
|
poolInfo: PoolInfoType
|
|
17
17
|
handleApproveSuccess: () => void
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export function
|
|
20
|
+
export function Evaluation({
|
|
21
21
|
poolInfo,
|
|
22
22
|
handleApproveSuccess,
|
|
23
23
|
}: Props): React.ReactElement | null {
|