@huma-finance/widgets 0.0.73-beta.924 → 0.0.73-beta.946
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/.env.example +3 -3
- package/{.eslintrc.js → .eslintrc.cjs} +1 -2
- package/.prettierrc.json +16 -0
- package/API.md +1 -1
- package/dist/index.js +220513 -11012
- package/dist/src/components/ApolloWrapper.d.ts +4 -0
- package/dist/src/components/ApproveAllowanceModal.d.ts +13 -0
- package/dist/src/components/ApproveAllowanceModalV2.d.ts +14 -0
- package/dist/src/components/BottomButton.d.ts +9 -0
- package/dist/src/components/ChainSupportProvider.d.ts +2 -0
- package/dist/src/components/ChooseAmountModal.d.ts +23 -0
- package/dist/src/components/ConfirmTransferModal.d.ts +19 -0
- package/dist/src/components/CreditLine/approve/1-ApproveAllowance.d.ts +9 -0
- package/dist/src/components/CreditLine/approve/2-Success.d.ts +8 -0
- package/dist/src/components/CreditLine/approve/index.d.ts +20 -0
- package/dist/src/components/CreditLine/autoPaybackV2/1-ApproveAllowance.d.ts +8 -0
- package/dist/src/components/CreditLine/autoPaybackV2/2-Success.d.ts +6 -0
- package/dist/src/components/CreditLine/autoPaybackV2/index.d.ts +15 -0
- package/dist/src/components/CreditLine/borrow/1-Evaluation.d.ts +8 -0
- package/dist/src/components/CreditLine/borrow/2-ChooseAmount.d.ts +8 -0
- package/dist/src/components/CreditLine/borrow/3-ApproveAllowance.d.ts +7 -0
- package/dist/src/components/CreditLine/borrow/4-Transfer.d.ts +7 -0
- package/dist/src/components/CreditLine/borrow/5-Success.d.ts +10 -0
- package/dist/src/components/CreditLine/borrow/6-Notifications.d.ts +6 -0
- package/dist/src/components/CreditLine/borrow/index.d.ts +19 -0
- package/dist/src/components/CreditLine/borrowV2/1-ChooseAmount.d.ts +9 -0
- package/dist/src/components/CreditLine/borrowV2/2-ApproveAllowance.d.ts +8 -0
- package/dist/src/components/CreditLine/borrowV2/3-Transfer.d.ts +7 -0
- package/dist/src/components/CreditLine/borrowV2/4-Success.d.ts +10 -0
- package/dist/src/components/CreditLine/borrowV2/5-Notifications.d.ts +6 -0
- package/dist/src/components/CreditLine/borrowV2/index.d.ts +15 -0
- package/dist/src/components/CreditLine/payment/1-ChooseAmount.d.ts +9 -0
- package/dist/src/components/CreditLine/payment/2-ApproveAllowance.d.ts +7 -0
- package/dist/src/components/CreditLine/payment/3-Transfer.d.ts +7 -0
- package/dist/src/components/CreditLine/payment/4-Success.d.ts +8 -0
- package/dist/src/components/CreditLine/payment/index.d.ts +17 -0
- package/dist/src/components/CreditLine/paymentV2/1-ChooseAmount.d.ts +11 -0
- package/dist/src/components/CreditLine/paymentV2/2-ApproveAllowance.d.ts +8 -0
- package/dist/src/components/CreditLine/paymentV2/3-Transfer.d.ts +8 -0
- package/dist/src/components/CreditLine/paymentV2/4-Success.d.ts +8 -0
- package/dist/src/components/CreditLine/paymentV2/index.d.ts +15 -0
- package/dist/src/components/CreditLine/solanaBorrow/1-ChooseAmount.d.ts +9 -0
- package/dist/src/components/CreditLine/solanaBorrow/2-Transfer.d.ts +7 -0
- package/dist/src/components/CreditLine/solanaBorrow/3-Done.d.ts +10 -0
- package/dist/src/components/CreditLine/solanaBorrow/index.d.ts +17 -0
- package/dist/src/components/CreditLine/solanaPayment/1-ChooseAmount.d.ts +9 -0
- package/dist/src/components/CreditLine/solanaPayment/2-Transfer.d.ts +7 -0
- package/dist/src/components/CreditLine/solanaPayment/3-Done.d.ts +8 -0
- package/dist/src/components/CreditLine/solanaPayment/index.d.ts +14 -0
- package/dist/src/components/CreditLine/supplyFLC/1-ApproveAllowance.d.ts +10 -0
- package/dist/src/components/CreditLine/supplyFLC/2-Transfer.d.ts +10 -0
- package/dist/src/components/CreditLine/supplyFLC/3-Success.d.ts +10 -0
- package/dist/src/components/CreditLine/supplyFLC/index.d.ts +15 -0
- package/dist/src/components/ErrorModal.d.ts +12 -0
- package/dist/src/components/HumaLoading.d.ts +7 -0
- package/dist/src/components/HumaSnackBar.d.ts +10 -0
- package/dist/src/components/InputAmountModal.d.ts +18 -0
- package/dist/src/components/InvoiceFactoring/borrow/1-Evaluation.d.ts +8 -0
- package/dist/src/components/InvoiceFactoring/borrow/2-ChooseAmount.d.ts +8 -0
- package/dist/src/components/InvoiceFactoring/borrow/3-ConfirmTransfer.d.ts +2 -0
- package/dist/src/components/InvoiceFactoring/borrow/4-ApproveNFT.d.ts +8 -0
- package/dist/src/components/InvoiceFactoring/borrow/5-Transfer.d.ts +8 -0
- package/dist/src/components/InvoiceFactoring/borrow/6-Success.d.ts +6 -0
- package/dist/src/components/InvoiceFactoring/borrow/index.d.ts +20 -0
- package/dist/src/components/InvoiceFactoring/payment/1-ChooseAmount.d.ts +8 -0
- package/dist/src/components/InvoiceFactoring/payment/2-ApproveAllowance.d.ts +7 -0
- package/dist/src/components/InvoiceFactoring/payment/3-Transfer.d.ts +7 -0
- package/dist/src/components/InvoiceFactoring/payment/4-Success.d.ts +8 -0
- package/dist/src/components/InvoiceFactoring/payment/index.d.ts +17 -0
- package/dist/src/components/Lend/addRedemptionV2/1-ChooseTranche.d.ts +8 -0
- package/dist/src/components/Lend/addRedemptionV2/2-ChooseAmount.d.ts +10 -0
- package/dist/src/components/Lend/addRedemptionV2/3-Transfer.d.ts +10 -0
- package/dist/src/components/Lend/addRedemptionV2/4-Done.d.ts +6 -0
- package/dist/src/components/Lend/addRedemptionV2/index.d.ts +23 -0
- package/dist/src/components/Lend/cancelRedemptionV2 /1-Transfer.d.ts +10 -0
- package/dist/src/components/Lend/cancelRedemptionV2 /2-Done.d.ts +10 -0
- package/dist/src/components/Lend/cancelRedemptionV2 /index.d.ts +22 -0
- package/dist/src/components/Lend/components/ApproveLenderBase.d.ts +14 -0
- package/dist/src/components/Lend/components/PersonaEvaluation.d.ts +17 -0
- package/dist/src/components/Lend/components/SecuritizeEvaluation.d.ts +8 -0
- package/dist/src/components/Lend/solanaAddRedemption/1-ChooseTranche.d.ts +8 -0
- package/dist/src/components/Lend/solanaAddRedemption/2-ChooseAmount.d.ts +11 -0
- package/dist/src/components/Lend/solanaAddRedemption/3-Transfer.d.ts +8 -0
- package/dist/src/components/Lend/solanaAddRedemption/4-Done.d.ts +8 -0
- package/dist/src/components/Lend/solanaAddRedemption/index.d.ts +19 -0
- package/dist/src/components/Lend/solanaCancelRedemption/1-ChooseTranche.d.ts +8 -0
- package/dist/src/components/Lend/solanaCancelRedemption/2-Transfer.d.ts +11 -0
- package/dist/src/components/Lend/solanaCancelRedemption/3-Done.d.ts +11 -0
- package/dist/src/components/Lend/solanaCancelRedemption/index.d.ts +16 -0
- package/dist/src/components/Lend/solanaEnableAutoRedemption/1-ApproveAllowance.d.ts +7 -0
- package/dist/src/components/Lend/solanaEnableAutoRedemption/2-Transfer.d.ts +9 -0
- package/dist/src/components/Lend/solanaEnableAutoRedemption/3-Success.d.ts +10 -0
- package/dist/src/components/Lend/solanaEnableAutoRedemption/index.d.ts +18 -0
- package/dist/src/components/Lend/solanaSupply/1-Evaluation.d.ts +12 -0
- package/dist/src/components/Lend/solanaSupply/2-ApproveLender.d.ts +10 -0
- package/dist/src/components/Lend/solanaSupply/3-ChooseTranche.d.ts +9 -0
- package/dist/src/components/Lend/solanaSupply/4-ChooseAmount.d.ts +13 -0
- package/dist/src/components/Lend/solanaSupply/5-ApproveAllowance.d.ts +7 -0
- package/dist/src/components/Lend/solanaSupply/6-Transfer.d.ts +11 -0
- package/dist/src/components/Lend/solanaSupply/7-Success.d.ts +12 -0
- package/dist/src/components/Lend/solanaSupply/8-PointsEarned.d.ts +11 -0
- package/dist/src/components/Lend/solanaSupply/index.d.ts +24 -0
- package/dist/src/components/Lend/solanaWithdraw/1-ConfirmTransfer.d.ts +9 -0
- package/dist/src/components/Lend/solanaWithdraw/2-Transfer.d.ts +9 -0
- package/dist/src/components/Lend/solanaWithdraw/3-Done.d.ts +10 -0
- package/dist/src/components/Lend/solanaWithdraw/index.d.ts +25 -0
- package/dist/src/components/Lend/stellarSupply/1-Evaluation.d.ts +4 -0
- package/dist/src/components/Lend/stellarSupply/2-ChooseTranche.d.ts +9 -0
- package/dist/src/components/Lend/stellarSupply/3-ChooseAmount.d.ts +12 -0
- package/dist/src/components/Lend/stellarSupply/4-Transfer.d.ts +8 -0
- package/dist/src/components/Lend/stellarSupply/5-Success.d.ts +10 -0
- package/dist/src/components/Lend/stellarSupply/index.d.ts +22 -0
- package/dist/src/components/Lend/supply/1-Evaluation/EvaluationEA.d.ts +8 -0
- package/dist/src/components/Lend/supply/1-Evaluation/EvaluationKYC.d.ts +8 -0
- package/dist/src/components/Lend/supply/1-Evaluation/index.d.ts +9 -0
- package/dist/src/components/Lend/supply/2-ChooseAmount.d.ts +11 -0
- package/dist/src/components/Lend/supply/3-ApproveAllowance.d.ts +7 -0
- package/dist/src/components/Lend/supply/4-Transfer.d.ts +7 -0
- package/dist/src/components/Lend/supply/5-Success.d.ts +9 -0
- package/dist/src/components/Lend/supply/6-Notifications.d.ts +6 -0
- package/dist/src/components/Lend/supply/index.d.ts +17 -0
- package/dist/src/components/Lend/supplyV2/1-ChooseTranche.d.ts +9 -0
- package/dist/src/components/Lend/supplyV2/2-Evaluation.d.ts +12 -0
- package/dist/src/components/Lend/supplyV2/3-ApproveLender.d.ts +10 -0
- package/dist/src/components/Lend/supplyV2/4-ChooseAmount.d.ts +14 -0
- package/dist/src/components/Lend/supplyV2/5-ApproveAllowance.d.ts +7 -0
- package/dist/src/components/Lend/supplyV2/6-Transfer.d.ts +11 -0
- package/dist/src/components/Lend/supplyV2/7-Success.d.ts +13 -0
- package/dist/src/components/Lend/supplyV2/8-Notifications.d.ts +8 -0
- package/dist/src/components/Lend/supplyV2/index.d.ts +23 -0
- package/dist/src/components/Lend/withdraw/1-CheckWithdrawble.d.ts +8 -0
- package/dist/src/components/Lend/withdraw/2-ChooseAmount.d.ts +10 -0
- package/dist/src/components/Lend/withdraw/3-Transfer.d.ts +7 -0
- package/dist/src/components/Lend/withdraw/4-Success.d.ts +8 -0
- package/dist/src/components/Lend/withdraw/index.d.ts +17 -0
- package/dist/src/components/Lend/withdrawV2/1-ConfirmTransfer.d.ts +11 -0
- package/dist/src/components/Lend/withdrawV2/2-Transfer.d.ts +9 -0
- package/dist/src/components/Lend/withdrawV2/3-Done.d.ts +10 -0
- package/dist/src/components/Lend/withdrawV2/index.d.ts +17 -0
- package/dist/src/components/LoadingModal.d.ts +9 -0
- package/dist/src/components/Notifi/NotifiContextWrapper.d.ts +7 -0
- package/dist/src/components/Notifi/NotifiSubscriptionModal.d.ts +7 -0
- package/dist/src/components/NumericFormatCustom.d.ts +14 -0
- package/dist/src/components/PointsEarned.d.ts +10 -0
- package/dist/src/components/ReceivableBackedCreditLine/borrow/1-ChooseAmount.d.ts +10 -0
- package/dist/src/components/ReceivableBackedCreditLine/borrow/2-ApproveAllowance.d.ts +8 -0
- package/dist/src/components/ReceivableBackedCreditLine/borrow/3-ApproveReceivable.d.ts +8 -0
- package/dist/src/components/ReceivableBackedCreditLine/borrow/4-Transfer.d.ts +8 -0
- package/dist/src/components/ReceivableBackedCreditLine/borrow/5-Success.d.ts +10 -0
- package/dist/src/components/ReceivableBackedCreditLine/borrow/6-Notifications.d.ts +6 -0
- package/dist/src/components/ReceivableBackedCreditLine/borrow/index.d.ts +17 -0
- package/dist/src/components/ReceivableBackedCreditLine/payment/1-ChoosePaymentType.d.ts +8 -0
- package/dist/src/components/ReceivableBackedCreditLine/payment/2-ChooseAmount.d.ts +12 -0
- package/dist/src/components/ReceivableBackedCreditLine/payment/3-ApproveAllowance.d.ts +10 -0
- package/dist/src/components/ReceivableBackedCreditLine/payment/4-CreateReceivable.d.ts +9 -0
- package/dist/src/components/ReceivableBackedCreditLine/payment/5-ApproveReceivable.d.ts +8 -0
- package/dist/src/components/ReceivableBackedCreditLine/payment/6-Transfer.d.ts +14 -0
- package/dist/src/components/ReceivableBackedCreditLine/payment/7-Success.d.ts +12 -0
- package/dist/src/components/ReceivableBackedCreditLine/payment/index.d.ts +21 -0
- package/dist/src/components/SignIn.d.ts +6 -0
- package/dist/src/components/SolanaErrorModal.d.ts +13 -0
- package/dist/src/components/SolanaTxDoneModal.d.ts +12 -0
- package/dist/src/components/SolanaTxSendModal.d.ts +12 -0
- package/dist/src/components/SolanaViewOnExplorer.d.ts +8 -0
- package/dist/src/components/StellarTxDoneModal.d.ts +12 -0
- package/dist/src/components/StellarTxSendModal.d.ts +8 -0
- package/dist/src/components/StellarViewOnExplorer.d.ts +8 -0
- package/dist/src/components/StreamFactoring/borrow/1-Evaluation.d.ts +9 -0
- package/dist/src/components/StreamFactoring/borrow/2-ChooseAmount.d.ts +8 -0
- package/dist/src/components/StreamFactoring/borrow/3-ConfirmTransfer.d.ts +2 -0
- package/dist/src/components/StreamFactoring/borrow/4-ApproveAllowance.d.ts +7 -0
- package/dist/src/components/StreamFactoring/borrow/5-Permit.d.ts +10 -0
- package/dist/src/components/StreamFactoring/borrow/6-Transfer.d.ts +7 -0
- package/dist/src/components/StreamFactoring/borrow/7-Success.d.ts +6 -0
- package/dist/src/components/StreamFactoring/borrow/index.d.ts +13 -0
- package/dist/src/components/StreamFactoring/payment/ChooseAmount.d.ts +8 -0
- package/dist/src/components/StreamFactoring/payment/Success.d.ts +8 -0
- package/dist/src/components/StreamFactoring/payment/Transfer.d.ts +7 -0
- package/dist/src/components/StreamFactoring/payment/index.d.ts +10 -0
- package/dist/src/components/SuperfluidFactoring/index.d.ts +12 -0
- package/dist/src/components/TxDoneModal.d.ts +9 -0
- package/dist/src/components/TxSendModal.d.ts +13 -0
- package/dist/src/components/TxSendModalV2.d.ts +13 -0
- package/dist/src/components/ViewOnExplorer.d.ts +6 -0
- package/dist/src/components/WidgetWrapper.d.ts +11 -0
- package/dist/src/components/WrapperModal.d.ts +8 -0
- package/dist/src/components/buttons/TableActionButton.d.ts +8 -0
- package/dist/src/components/buttons/index.d.ts +1 -0
- package/dist/src/components/humaModal/HumaModal.d.ts +13 -0
- package/dist/src/components/humaModal/HumaModalHeader.d.ts +12 -0
- package/dist/src/components/humaModal/index.d.ts +2 -0
- package/dist/src/components/icons/index.d.ts +23 -0
- package/dist/src/components/images/index.d.ts +3 -0
- package/dist/src/cosmos/CreditLineBorrow.fixture.d.ts +2 -0
- package/dist/src/cosmos/CreditLinePayment.fixture.d.ts +2 -0
- package/dist/src/cosmos/InvoiceFactoringBorrow.fixture.d.ts +2 -0
- package/dist/src/cosmos/InvoiceFactoringPayment.fixture.d.ts +2 -0
- package/dist/src/cosmos/LendSupply.fixture.d.ts +2 -0
- package/dist/src/cosmos/LendWithdraw.fixture.d.ts +2 -0
- package/dist/src/cosmos/SDKTesting.fixture.d.ts +2 -0
- package/dist/src/cosmos/SuperfluidFactoringBorrow.fixture.d.ts +2 -0
- package/dist/src/cosmos/WalletWrapper.d.ts +3 -0
- package/dist/src/cosmos/utils/index.d.ts +18 -0
- package/dist/src/hooks/useEA.d.ts +8 -0
- package/dist/src/hooks/useElementDimensions.d.ts +5 -0
- package/dist/src/hooks/useLogOnFirstMount.d.ts +3 -0
- package/dist/src/hooks/useNotifi.d.ts +10 -0
- package/dist/src/hooks/useRedux.d.ts +6 -0
- package/dist/src/index.d.ts +385 -0
- package/dist/src/reportWebVitals.d.ts +3 -0
- package/dist/src/setupTests.d.ts +0 -0
- package/dist/src/store/index.d.ts +10 -0
- package/dist/src/store/widgets.reducers.d.ts +58 -0
- package/dist/src/store/widgets.selectors.d.ts +4 -0
- package/dist/src/store/widgets.store.d.ts +61 -0
- package/dist/src/theme/breakpoints.d.ts +5 -0
- package/dist/src/theme/components.d.ts +2 -0
- package/dist/src/theme/coreThemeConstants.d.ts +18 -0
- package/dist/src/theme/cssMixins.d.ts +20 -0
- package/dist/src/theme/hooks/useGetSizes.d.ts +12 -0
- package/dist/src/theme/index.d.ts +2 -0
- package/dist/src/theme/palette.d.ts +53 -0
- package/dist/src/theme/shape.d.ts +2 -0
- package/dist/src/theme/theme.types.d.ts +71 -0
- package/dist/src/theme/typography.d.ts +2 -0
- package/dist/vite.config.d.ts +2 -0
- package/package.json +21 -34
- package/src/components/Lend/components/ApproveLenderBase.tsx +6 -3
- package/src/components/Lend/components/PersonaEvaluation.tsx +5 -2
- package/src/components/Lend/components/SecuritizeEvaluation.tsx +5 -2
- package/src/components/Lend/solanaSupply/1-Evaluation.tsx +3 -0
- package/src/components/Lend/solanaSupply/2-ApproveLender.tsx +3 -0
- package/src/components/Lend/solanaSupply/3-ChooseTranche.tsx +2 -0
- package/src/components/Lend/solanaSupply/4-ChooseAmount.tsx +2 -0
- package/src/components/Lend/solanaSupply/5-ApproveAllowance.tsx +2 -0
- package/src/components/Lend/solanaSupply/6-Transfer.tsx +3 -1
- package/src/components/Lend/solanaSupply/7-Success.tsx +2 -0
- package/src/components/Lend/solanaSupply/8-PointsEarned.tsx +8 -2
- package/src/components/Lend/solanaSupply/index.tsx +47 -8
- package/src/components/Lend/solanaWithdraw/1-ConfirmTransfer.tsx +2 -0
- package/src/components/Lend/solanaWithdraw/2-Transfer.tsx +2 -0
- package/src/components/Lend/solanaWithdraw/3-Done.tsx +2 -0
- package/src/components/Lend/solanaWithdraw/index.tsx +32 -7
- package/src/components/Lend/supply/1-Evaluation/EvaluationKYC.tsx +5 -2
- package/src/components/Lend/supplyV2/2-Evaluation.tsx +2 -2
- package/src/components/Lend/supplyV2/3-ApproveLender.tsx +1 -1
- package/src/components/Lend/supplyV2/6-Transfer.tsx +1 -2
- package/src/components/Lend/supplyV2/index.tsx +1 -1
- package/src/components/Notifi/NotifiContextWrapper.tsx +3 -3
- package/src/components/SolanaTxSendModal.tsx +23 -1
- package/src/components/icons/index.tsx +21 -21
- package/src/cosmos/InvoiceFactoringBorrow.fixture.tsx +1 -1
- package/src/cosmos/SuperfluidFactoringBorrow.fixture.tsx +2 -4
- package/src/cosmos/utils/index.ts +4 -2
- package/src/hooks/useEA.ts +1 -2
- package/src/hooks/useLogOnFirstMount.ts +19 -0
- package/src/hooks/useNotifi.ts +1 -1
- package/src/index.tsx +4 -7
- package/src/store/widgets.reducers.ts +6 -0
- package/src/store/widgets.selectors.ts +20 -0
- package/src/store/widgets.store.ts +2 -0
- package/tsconfig.json +20 -17
- package/vite-env.d.ts +2 -0
- package/vite.config.ts +48 -0
- package/webpack.cosmos.js +1 -1
- package/.prettierrc.js +0 -16
- package/babel.config.js +0 -15
- package/config-overrides.js +0 -9
- package/dist/cjs/index.cjs +0 -11781
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -758
- package/dist/index.js.map +0 -1
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -40
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/rollup.config.js +0 -81
- package/src/cosmos/utils/env.ts +0 -6
- package/src/react-app-env.d.ts +0 -1
|
@@ -4,15 +4,23 @@ import {
|
|
|
4
4
|
SolanaTokenUtils,
|
|
5
5
|
TrancheType,
|
|
6
6
|
} from '@huma-finance/shared'
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
LenderStateAccount,
|
|
9
|
+
LoggingContext,
|
|
10
|
+
LoggingContextHelper,
|
|
11
|
+
SolanaPoolState,
|
|
12
|
+
} from '@huma-finance/web-shared'
|
|
8
13
|
import React, { useCallback, useEffect, useState } from 'react'
|
|
9
14
|
import { useDispatch } from 'react-redux'
|
|
10
15
|
|
|
11
16
|
import { BN } from '@coral-xyz/anchor'
|
|
12
17
|
import { Mint } from '@solana/spl-token'
|
|
13
18
|
import { useAppSelector } from '../../../hooks/useRedux'
|
|
14
|
-
import { setStep } from '../../../store/widgets.reducers'
|
|
15
|
-
import {
|
|
19
|
+
import { setLoggingContext, setStep } from '../../../store/widgets.reducers'
|
|
20
|
+
import {
|
|
21
|
+
selectWidgetLoggingContext,
|
|
22
|
+
selectWidgetState,
|
|
23
|
+
} from '../../../store/widgets.selectors'
|
|
16
24
|
import { WIDGET_STEP } from '../../../store/widgets.store'
|
|
17
25
|
import { ErrorModal } from '../../ErrorModal'
|
|
18
26
|
import { WidgetWrapper } from '../../WidgetWrapper'
|
|
@@ -64,6 +72,12 @@ export function SolanaLendWithdraw({
|
|
|
64
72
|
2,
|
|
65
73
|
)
|
|
66
74
|
const [withdrawnAmount, setWithdrawnAmount] = useState<BN>()
|
|
75
|
+
const loggingHelper = useAppSelector(selectWidgetLoggingContext)
|
|
76
|
+
|
|
77
|
+
const handleCloseFlow = () => {
|
|
78
|
+
loggingHelper.logAction('ExitFlow', {})
|
|
79
|
+
handleClose()
|
|
80
|
+
}
|
|
67
81
|
|
|
68
82
|
// After withdrawn success, the handleSuccess will refresh
|
|
69
83
|
// the lenderStateAccount which will update the withdrawableAmount to 0
|
|
@@ -76,9 +90,20 @@ export function SolanaLendWithdraw({
|
|
|
76
90
|
|
|
77
91
|
useEffect(() => {
|
|
78
92
|
if (!step) {
|
|
93
|
+
// Set initial logging context
|
|
94
|
+
const context: LoggingContext = {
|
|
95
|
+
flow: 'Withdraw',
|
|
96
|
+
chainId: poolInfo.chainId,
|
|
97
|
+
poolName: poolInfo.poolName,
|
|
98
|
+
poolType: poolInfo.poolType,
|
|
99
|
+
}
|
|
100
|
+
const loggingHelperInit = new LoggingContextHelper(context)
|
|
101
|
+
loggingHelperInit.logAction('StartFlow', {})
|
|
102
|
+
dispatch(setLoggingContext(context))
|
|
103
|
+
|
|
79
104
|
dispatch(setStep(WIDGET_STEP.ConfirmTransfer))
|
|
80
105
|
}
|
|
81
|
-
}, [dispatch, step])
|
|
106
|
+
}, [dispatch, poolInfo.chainId, poolInfo.poolName, poolInfo.poolType, step])
|
|
82
107
|
|
|
83
108
|
useEffect(() => {
|
|
84
109
|
const trancheAssets =
|
|
@@ -111,7 +136,7 @@ export function SolanaLendWithdraw({
|
|
|
111
136
|
<WidgetWrapper
|
|
112
137
|
isOpen
|
|
113
138
|
loadingTitle={title}
|
|
114
|
-
handleClose={
|
|
139
|
+
handleClose={handleCloseFlow}
|
|
115
140
|
handleSuccess={handleWithdrawSuccess}
|
|
116
141
|
>
|
|
117
142
|
{step === WIDGET_STEP.ConfirmTransfer && (
|
|
@@ -132,7 +157,7 @@ export function SolanaLendWithdraw({
|
|
|
132
157
|
<Done
|
|
133
158
|
poolUnderlyingToken={poolInfo.underlyingMint}
|
|
134
159
|
withdrawAmount={withdrawnAmount}
|
|
135
|
-
handleAction={
|
|
160
|
+
handleAction={handleCloseFlow}
|
|
136
161
|
/>
|
|
137
162
|
)}
|
|
138
163
|
{step === WIDGET_STEP.Error && (
|
|
@@ -140,7 +165,7 @@ export function SolanaLendWithdraw({
|
|
|
140
165
|
title={title}
|
|
141
166
|
errorReason='Sorry there was an error'
|
|
142
167
|
errorMessage={errorMessage}
|
|
143
|
-
handleOk={
|
|
168
|
+
handleOk={handleCloseFlow}
|
|
144
169
|
/>
|
|
145
170
|
)}
|
|
146
171
|
</WidgetWrapper>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CHAINS,
|
|
3
|
-
checkIsDev,
|
|
4
3
|
configUtil,
|
|
5
4
|
DocSignatureStatus,
|
|
6
5
|
IdentityService,
|
|
@@ -8,7 +7,11 @@ import {
|
|
|
8
7
|
timeUtil,
|
|
9
8
|
VerificationStatusResult,
|
|
10
9
|
} from '@huma-finance/shared'
|
|
11
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
useAuthErrorHandling,
|
|
12
|
+
useParamsSearch,
|
|
13
|
+
checkIsDev,
|
|
14
|
+
} from '@huma-finance/web-shared'
|
|
12
15
|
import { Box, css, useTheme } from '@mui/material'
|
|
13
16
|
import { useWeb3React } from '@web3-react/core'
|
|
14
17
|
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
|
@@ -14,7 +14,7 @@ type Props = {
|
|
|
14
14
|
poolInfo: PoolInfoV2
|
|
15
15
|
networkType: NETWORK_TYPE
|
|
16
16
|
campaign?: Campaign
|
|
17
|
-
documentHash
|
|
17
|
+
documentHash?: string
|
|
18
18
|
handleClose: (options?: CloseModalOptions) => void
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -30,7 +30,7 @@ export function Evaluation({
|
|
|
30
30
|
<SecuritizeEvaluation poolInfo={poolInfo} handleClose={handleClose} />
|
|
31
31
|
)
|
|
32
32
|
}
|
|
33
|
-
if (poolInfo.KYC?.Persona) {
|
|
33
|
+
if (poolInfo.KYC?.Persona && documentHash) {
|
|
34
34
|
return (
|
|
35
35
|
<PersonaEvaluation
|
|
36
36
|
poolInfo={poolInfo}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CampaignService,
|
|
3
|
-
checkIsDev,
|
|
4
3
|
NETWORK_TYPE,
|
|
5
4
|
PoolInfoV2,
|
|
6
5
|
TrancheType,
|
|
7
6
|
} from '@huma-finance/shared'
|
|
8
|
-
import { useTrancheVaultContractV2 } from '@huma-finance/web-shared'
|
|
7
|
+
import { useTrancheVaultContractV2, checkIsDev } from '@huma-finance/web-shared'
|
|
9
8
|
import { useWeb3React } from '@web3-react/core'
|
|
10
9
|
import { ethers } from 'ethers'
|
|
11
10
|
import React, { useCallback } from 'react'
|
|
@@ -47,7 +47,7 @@ export interface Campaign {
|
|
|
47
47
|
export interface LendSupplyPropsV2 {
|
|
48
48
|
poolName: keyof typeof POOL_NAME
|
|
49
49
|
campaign?: Campaign
|
|
50
|
-
documentHash
|
|
50
|
+
documentHash?: string
|
|
51
51
|
handleClose: (options?: CloseModalOptions) => void
|
|
52
52
|
handleSuccess?: (blockNumber?: number) => void
|
|
53
53
|
}
|
|
@@ -29,14 +29,14 @@ export function NotifiContextWrapper({
|
|
|
29
29
|
|
|
30
30
|
let cardId = ''
|
|
31
31
|
if (chainId === ChainEnum.Celo || chainId === ChainEnum.Alfajores) {
|
|
32
|
-
cardId =
|
|
32
|
+
cardId = import.meta.env.VITE_NOTIFI_CONFIG_ID_CELO ?? ''
|
|
33
33
|
} else if (chainId === ChainEnum.Polygon || chainId === ChainEnum.Amoy) {
|
|
34
|
-
cardId =
|
|
34
|
+
cardId = import.meta.env.VITE_NOTIFI_CONFIG_ID_POLYGON ?? ''
|
|
35
35
|
} else if (
|
|
36
36
|
chainId === ChainEnum.Scroll ||
|
|
37
37
|
chainId === ChainEnum.ScrollSepolia
|
|
38
38
|
) {
|
|
39
|
-
cardId =
|
|
39
|
+
cardId = import.meta.env.VITE_NOTIFI_CONFIG_ID_SCROLL ?? ''
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
if (!cardId) {
|
|
@@ -9,11 +9,12 @@ import { useConnection, useWallet } from '@solana/wallet-adapter-react'
|
|
|
9
9
|
import { Transaction } from '@solana/web3.js'
|
|
10
10
|
import { useForceRefresh } from '@huma-finance/web-shared'
|
|
11
11
|
import { Box, Button, css, Typography, useTheme } from '@mui/material'
|
|
12
|
-
import { useAppDispatch } from '../hooks/useRedux'
|
|
12
|
+
import { useAppDispatch, useAppSelector } from '../hooks/useRedux'
|
|
13
13
|
import { setError, setSolanaSignature } from '../store/widgets.reducers'
|
|
14
14
|
import { LoadingModal } from './LoadingModal'
|
|
15
15
|
import { SolanaViewOnExplorer } from './SolanaViewOnExplorer'
|
|
16
16
|
import { SorryImg } from './images'
|
|
17
|
+
import { selectWidgetLoggingContext } from '../store/widgets.selectors'
|
|
17
18
|
|
|
18
19
|
type Props = {
|
|
19
20
|
chainId: SolanaChainEnum
|
|
@@ -33,6 +34,7 @@ export function SolanaTxSendModal({
|
|
|
33
34
|
const [signature, setSignature] = useState<string>('')
|
|
34
35
|
const [showRetryScreen, setShowRetryScreen] = useState<boolean>(false)
|
|
35
36
|
const [useHighPriority, setUseHighPriority] = useState<boolean>(true)
|
|
37
|
+
const loggingHelper = useAppSelector(selectWidgetLoggingContext)
|
|
36
38
|
const [refreshCount, refresh] = useForceRefresh()
|
|
37
39
|
|
|
38
40
|
const styles = {
|
|
@@ -98,7 +100,14 @@ export function SolanaTxSendModal({
|
|
|
98
100
|
useHighPriority ? 'High' : undefined,
|
|
99
101
|
process.env.REACT_APP_HELIUS_API_KEY,
|
|
100
102
|
)
|
|
103
|
+
loggingHelper.logAction('SigningTransaction', {
|
|
104
|
+
priceData: optimizedTx.instructions[0].data,
|
|
105
|
+
unitsData: optimizedTx.instructions[1].data,
|
|
106
|
+
recentBlockhash: optimizedTx.recentBlockhash,
|
|
107
|
+
lastValidBlockHeight: optimizedTx.lastValidBlockHeight,
|
|
108
|
+
})
|
|
101
109
|
const signedTx = await signTransaction(optimizedTx)
|
|
110
|
+
loggingHelper.logAction('SendingTransaction', {})
|
|
102
111
|
const signatureResult = await connection.sendRawTransaction(
|
|
103
112
|
signedTx.serialize(),
|
|
104
113
|
{
|
|
@@ -123,6 +132,9 @@ export function SolanaTxSendModal({
|
|
|
123
132
|
result?.value?.confirmationStatus === 'confirmed'
|
|
124
133
|
) {
|
|
125
134
|
if (result?.value?.err) {
|
|
135
|
+
loggingHelper.logAction('TransactionError', {
|
|
136
|
+
signature: signatureResult,
|
|
137
|
+
})
|
|
126
138
|
dispatch(
|
|
127
139
|
setError({
|
|
128
140
|
errorMessage:
|
|
@@ -131,6 +143,10 @@ export function SolanaTxSendModal({
|
|
|
131
143
|
)
|
|
132
144
|
return
|
|
133
145
|
}
|
|
146
|
+
|
|
147
|
+
loggingHelper.logAction('TransactionSuccess', {
|
|
148
|
+
signature: signatureResult,
|
|
149
|
+
})
|
|
134
150
|
handleSuccess({ signature: signatureResult })
|
|
135
151
|
return
|
|
136
152
|
}
|
|
@@ -144,6 +160,9 @@ export function SolanaTxSendModal({
|
|
|
144
160
|
optimizedTx.lastValidBlockHeight! >
|
|
145
161
|
100
|
|
146
162
|
) {
|
|
163
|
+
loggingHelper.logAction('ShowRetryScreenDueToExpiration', {
|
|
164
|
+
signature: signatureResult,
|
|
165
|
+
})
|
|
147
166
|
setShowRetryScreen(true)
|
|
148
167
|
return
|
|
149
168
|
}
|
|
@@ -155,6 +174,8 @@ export function SolanaTxSendModal({
|
|
|
155
174
|
console.log(error)
|
|
156
175
|
|
|
157
176
|
const err = error as Error
|
|
177
|
+
loggingHelper.logAction('UnknownError', { error: err?.message })
|
|
178
|
+
loggingHelper.logError(err)
|
|
158
179
|
dispatch(setError({ errorMessage: err?.message || '' }))
|
|
159
180
|
}
|
|
160
181
|
}
|
|
@@ -170,6 +191,7 @@ export function SolanaTxSendModal({
|
|
|
170
191
|
tx,
|
|
171
192
|
refreshCount,
|
|
172
193
|
useHighPriority,
|
|
194
|
+
loggingHelper,
|
|
173
195
|
])
|
|
174
196
|
|
|
175
197
|
const handleRetry = useCallback(
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { SvgIconProps } from '@mui/material'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
2
|
+
import HumaLogoSvg from './huma.svg?react'
|
|
3
|
+
import HumaFullLogoSvg from './huma-full.svg?react'
|
|
4
|
+
import MetamaskSvg from './metamask.svg?react'
|
|
5
|
+
import WalletConnectSvg from './wallet-connect.svg?react'
|
|
6
|
+
import EthereumSvg from './ethereum.svg?react'
|
|
7
|
+
import PolygonSvg from './polygon.svg?react'
|
|
8
|
+
import ReceiptSvg from './receipt.svg?react'
|
|
9
|
+
import SeparatorSvg from './separator.svg?react'
|
|
10
|
+
import LoaderSvg from './loader.svg?react'
|
|
11
|
+
import SorrySvg from './sorry.svg?react'
|
|
12
|
+
import CheckSvg from './check.svg?react'
|
|
13
|
+
import CheckGreenSvg from './check-green.svg?react'
|
|
14
|
+
import CheckCircleSvg from './check-circle.svg?react'
|
|
15
|
+
import AutoPaybackSvg from './auto-payback.svg?react'
|
|
16
|
+
import ApproveLenderSvg from './approve-lender.svg?react'
|
|
17
|
+
import DonutSvg from './donut.svg?react'
|
|
18
|
+
import UsdcSvg from './usdc.svg?react'
|
|
19
|
+
import CeloSvg from './celo.svg?react'
|
|
20
|
+
import CongratulationsSvg from './congratulations.svg?react'
|
|
21
|
+
import RibbonSvg from './ribbon.svg?react'
|
|
22
|
+
import HumaPointsSvg from './huma-points.svg?react'
|
|
23
23
|
|
|
24
24
|
export function HumaIcon(props: SvgIconProps): React.ReactElement {
|
|
25
25
|
return <HumaLogoSvg {...props} />
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
import { JsonRpcProvider } from '@ethersproject/providers'
|
|
1
2
|
import { SuperfluidFactoringWidget } from '..'
|
|
2
|
-
import { initEnv } from './utils/env'
|
|
3
3
|
import { WalletWrapper } from './WalletWrapper'
|
|
4
4
|
|
|
5
|
-
initEnv()
|
|
6
|
-
|
|
7
5
|
function Fixture() {
|
|
8
|
-
return <SuperfluidFactoringWidget />
|
|
6
|
+
return <SuperfluidFactoringWidget provider={new JsonRpcProvider()} />
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
export default (
|
|
@@ -138,11 +138,13 @@ export const getProvider = (chainId = ChainEnum.Goerli) => {
|
|
|
138
138
|
const rpcUrlMap: { [x: number]: { name: string; url: string } } = {
|
|
139
139
|
[ChainEnum.Goerli]: {
|
|
140
140
|
name: 'Goerli',
|
|
141
|
-
url: `https://goerli.infura.io/v3/${
|
|
141
|
+
url: `https://goerli.infura.io/v3/${import.meta.env.VITE_INFURA_API_KEY}`,
|
|
142
142
|
},
|
|
143
143
|
[ChainEnum.Mumbai]: {
|
|
144
144
|
name: 'Mumbai',
|
|
145
|
-
url: `https://polygon-mumbai.g.alchemy.com/v2/${
|
|
145
|
+
url: `https://polygon-mumbai.g.alchemy.com/v2/${
|
|
146
|
+
import.meta.env.VITE_ALCHEMY_API_KEY
|
|
147
|
+
}`,
|
|
146
148
|
},
|
|
147
149
|
}
|
|
148
150
|
return new JsonRpcProvider(rpcUrlMap[chainId].url, {
|
package/src/hooks/useEA.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
checkIsDev,
|
|
3
2
|
EAPayload,
|
|
4
3
|
EARejectionError,
|
|
5
4
|
EARejectMessage,
|
|
6
5
|
EARejectReason,
|
|
7
6
|
EAService,
|
|
8
7
|
} from '@huma-finance/shared'
|
|
9
|
-
import { useAuthErrorHandling } from '@huma-finance/web-shared'
|
|
8
|
+
import { useAuthErrorHandling, checkIsDev } from '@huma-finance/web-shared'
|
|
10
9
|
import { useWeb3React } from '@web3-react/core'
|
|
11
10
|
import { useCallback } from 'react'
|
|
12
11
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react'
|
|
2
|
+
import { LoggingActions } from '@huma-finance/web-shared'
|
|
3
|
+
import { selectWidgetLoggingContext } from '../store/widgets.selectors'
|
|
4
|
+
import { useAppSelector } from './useRedux'
|
|
5
|
+
|
|
6
|
+
const useLogOnFirstMount = (action: LoggingActions, data: object = {}) => {
|
|
7
|
+
const loggingHelper = useAppSelector(selectWidgetLoggingContext)
|
|
8
|
+
const hasLogged = useRef(false)
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
// Only log the action once
|
|
12
|
+
if (!hasLogged.current) {
|
|
13
|
+
loggingHelper.logAction(action, data)
|
|
14
|
+
hasLogged.current = true
|
|
15
|
+
}
|
|
16
|
+
}, [action, data, loggingHelper])
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default useLogOnFirstMount
|
package/src/hooks/useNotifi.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react'
|
|
2
2
|
import {
|
|
3
|
-
checkIsDev,
|
|
4
3
|
doesChainSupportNotifi,
|
|
5
4
|
getBlockchainConfigFromChain,
|
|
6
5
|
} from '@huma-finance/shared'
|
|
@@ -13,6 +12,7 @@ import {
|
|
|
13
12
|
useNotifiFrontendClientContext,
|
|
14
13
|
useNotifiUserSettingContext,
|
|
15
14
|
} from '@notifi-network/notifi-react'
|
|
15
|
+
import { checkIsDev } from '@huma-finance/web-shared'
|
|
16
16
|
|
|
17
17
|
export const useDoesChainSupportNotifi = (chainId: number | undefined) => {
|
|
18
18
|
const [notifiChainSupported, setNotifiChainSupported] = useState(false)
|
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { JsonRpcProvider } from '@ethersproject/providers'
|
|
2
2
|
import { ThemeProvider } from '@mui/material'
|
|
3
|
-
import { Provider as Eip1193Provider } from '@web3-react/types'
|
|
4
3
|
import { Provider as AtomProvider } from 'jotai'
|
|
5
4
|
import { useEffect, useState } from 'react'
|
|
6
5
|
import { Provider as ReduxProvider } from 'react-redux'
|
|
@@ -117,13 +116,13 @@ type JsonRpcConnectionMap = {
|
|
|
117
116
|
* @typedef {Object} WidgetProps
|
|
118
117
|
* @property {desiredChainId|undefined} desiredChainId Optional desired chain id, will trigger the switch network action if different from the current chain id
|
|
119
118
|
* @property {JsonRpcConnectionMap|undefined} jsonRpcUrlMap Optional mapping of your JSON-RPC connections indexed by chainId
|
|
120
|
-
* @property {
|
|
119
|
+
* @property {JsonRpcProvider} provider EIP-1193 provider or JsonRpc Provider
|
|
121
120
|
*/
|
|
122
121
|
type WidgetProps = {
|
|
123
122
|
handleClose?: () => void
|
|
124
123
|
desiredChainId?: number
|
|
125
124
|
jsonRpcUrlMap?: JsonRpcConnectionMap
|
|
126
|
-
provider:
|
|
125
|
+
provider: JsonRpcProvider
|
|
127
126
|
}
|
|
128
127
|
|
|
129
128
|
function Widget(props: WCProps<WidgetProps>) {
|
|
@@ -132,10 +131,8 @@ function Widget(props: WCProps<WidgetProps>) {
|
|
|
132
131
|
|
|
133
132
|
useEffect(() => {
|
|
134
133
|
const getChainId = async () => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
setChainId(network?.chainId)
|
|
138
|
-
}
|
|
134
|
+
const network = await provider.getNetwork()
|
|
135
|
+
setChainId(network?.chainId)
|
|
139
136
|
}
|
|
140
137
|
getChainId()
|
|
141
138
|
}, [provider])
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Approval } from '@huma-finance/shared'
|
|
2
2
|
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
|
|
3
|
+
import { LoggingContext } from '@huma-finance/web-shared'
|
|
3
4
|
|
|
4
5
|
import {
|
|
5
6
|
initialWidgetState,
|
|
@@ -34,6 +35,7 @@ export const widgetSlice = createSlice({
|
|
|
34
35
|
state.redeemShares = undefined
|
|
35
36
|
state.solanaSignature = undefined
|
|
36
37
|
state.txHash = undefined
|
|
38
|
+
state.loggingContext = undefined
|
|
37
39
|
},
|
|
38
40
|
setStep: (state, { payload }: PayloadAction<WIDGET_STEP>) => {
|
|
39
41
|
state.step = payload
|
|
@@ -116,6 +118,9 @@ export const widgetSlice = createSlice({
|
|
|
116
118
|
) => {
|
|
117
119
|
state.pointsAccumulated = payload
|
|
118
120
|
},
|
|
121
|
+
setLoggingContext: (state, { payload }: PayloadAction<LoggingContext>) => {
|
|
122
|
+
state.loggingContext = payload
|
|
123
|
+
},
|
|
119
124
|
setError: (
|
|
120
125
|
state,
|
|
121
126
|
{
|
|
@@ -147,6 +152,7 @@ export const {
|
|
|
147
152
|
setSolanaSignature,
|
|
148
153
|
setTxHash,
|
|
149
154
|
setPointsAccumulated,
|
|
155
|
+
setLoggingContext,
|
|
150
156
|
} = widgetSlice.actions
|
|
151
157
|
|
|
152
158
|
export default widgetSlice.reducer
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
import { LoggingContextHelper } from '@huma-finance/web-shared'
|
|
1
2
|
import { RootState } from '.'
|
|
2
3
|
|
|
3
4
|
export const selectWidgetState = (state: RootState) => state.widget
|
|
5
|
+
|
|
6
|
+
let cachedContext: LoggingContextHelper | null = null
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
+
let cachedLoggingContext: any = null
|
|
9
|
+
|
|
10
|
+
export const selectWidgetLoggingContext = (
|
|
11
|
+
state: RootState,
|
|
12
|
+
): LoggingContextHelper => {
|
|
13
|
+
if (state.widget.loggingContext === cachedLoggingContext) {
|
|
14
|
+
return cachedContext!
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
cachedLoggingContext = state.widget.loggingContext
|
|
18
|
+
cachedContext = state.widget.loggingContext
|
|
19
|
+
? new LoggingContextHelper(state.widget.loggingContext)
|
|
20
|
+
: new LoggingContextHelper()
|
|
21
|
+
|
|
22
|
+
return cachedContext
|
|
23
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Approval } from '@huma-finance/shared'
|
|
2
|
+
import { LoggingContext } from '@huma-finance/web-shared'
|
|
2
3
|
|
|
3
4
|
export enum WIDGET_TYPE {
|
|
4
5
|
BORROW = 'BORROW',
|
|
@@ -62,6 +63,7 @@ export type WidgetState = {
|
|
|
62
63
|
solanaSignature?: string
|
|
63
64
|
pointsAccumulated?: number
|
|
64
65
|
txHash?: string
|
|
66
|
+
loggingContext?: LoggingContext
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
export const initialWidgetState: WidgetState = {}
|
package/tsconfig.json
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "es5",
|
|
4
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
-
"allowJs": true,
|
|
6
|
-
"skipLibCheck": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
3
|
"allowSyntheticDefaultImports": true,
|
|
9
|
-
"
|
|
4
|
+
"composite": true,
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"declarationDir": "dts",
|
|
7
|
+
"emitDeclarationOnly": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
10
9
|
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"jsx": "react-jsx",
|
|
12
|
+
"jsxImportSource": "@emotion/react",
|
|
13
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
12
14
|
"module": "esnext",
|
|
13
15
|
"moduleResolution": "node",
|
|
16
|
+
"noFallthroughCasesInSwitch": true,
|
|
14
17
|
"resolveJsonModule": true,
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"strict": true,
|
|
20
|
+
"target": "ES2020",
|
|
21
|
+
"paths": {
|
|
22
|
+
"@huma-finance/web-shared": ["../huma-web-shared/src"],
|
|
23
|
+
"@huma-finance/shared": ["../huma-shared/src"]
|
|
24
|
+
}
|
|
22
25
|
},
|
|
23
|
-
"include": ["src/**/*", "src/**/*.json"],
|
|
26
|
+
"include": ["src/**/*", "src/**/*.json", "./*.ts", "./*.d.ts"],
|
|
24
27
|
"references": [
|
|
25
28
|
{
|
|
26
29
|
"path": "../huma-shared"
|
|
27
30
|
},
|
|
28
31
|
{
|
|
29
|
-
"path": "../huma-
|
|
32
|
+
"path": "../huma-sdk"
|
|
30
33
|
},
|
|
31
34
|
{
|
|
32
|
-
"path": "../huma-
|
|
35
|
+
"path": "../huma-web-shared"
|
|
33
36
|
}
|
|
34
37
|
]
|
|
35
38
|
}
|
package/vite-env.d.ts
ADDED
package/vite.config.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import { defineConfig } from 'vite'
|
|
3
|
+
import svgr from 'vite-plugin-svgr'
|
|
4
|
+
import { nodePolyfills } from 'vite-plugin-node-polyfills'
|
|
5
|
+
import dts from 'vite-plugin-dts'
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
build: {
|
|
9
|
+
lib: {
|
|
10
|
+
entry: path.resolve(__dirname, 'src/index.tsx'),
|
|
11
|
+
fileName: 'index',
|
|
12
|
+
formats: ['es'],
|
|
13
|
+
name: 'widget',
|
|
14
|
+
},
|
|
15
|
+
rollupOptions: {
|
|
16
|
+
external: [
|
|
17
|
+
'react',
|
|
18
|
+
'@solana/wallet-adapter-react',
|
|
19
|
+
'@solana/wallet-adapter-base',
|
|
20
|
+
'@huma-finance/web-shared',
|
|
21
|
+
], // Mark dependencies as external
|
|
22
|
+
output: {
|
|
23
|
+
globals: {
|
|
24
|
+
react: 'React',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
plugins: [svgr(), nodePolyfills(), dts()],
|
|
30
|
+
// These aliases are required; otherwise contexts aren't shared properly
|
|
31
|
+
// between the monorepo packages: https://github.com/vitejs/vite/discussions/13410
|
|
32
|
+
resolve: {
|
|
33
|
+
alias: {
|
|
34
|
+
'@solana/wallet-adapter-react': path.resolve(
|
|
35
|
+
__dirname,
|
|
36
|
+
'../../../../node_modules/@solana/wallet-adapter-react',
|
|
37
|
+
),
|
|
38
|
+
'@solana/wallet-adapter-base': path.resolve(
|
|
39
|
+
__dirname,
|
|
40
|
+
'../../../../node_modules/@solana/wallet-adapter-base',
|
|
41
|
+
),
|
|
42
|
+
'@huma-finance/web-shared': path.resolve(
|
|
43
|
+
__dirname,
|
|
44
|
+
'../huma-web-shared/src',
|
|
45
|
+
),
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
})
|
package/webpack.cosmos.js
CHANGED
package/.prettierrc.js
DELETED