@huma-finance/widgets 0.0.62-beta.622 → 0.0.62-beta.627
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 +34 -26
- package/dist/cjs/index.cjs +430 -155
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.d.ts +25 -9
- package/dist/index.js +433 -159
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/CreditLine/paymentV2/1-ChooseAmount.tsx +1 -0
- package/src/components/CreditLine/solanaBorrow/1-ChooseAmount.tsx +2 -21
- package/src/components/CreditLine/solanaBorrow/2-Transfer.tsx +159 -0
- package/src/components/CreditLine/solanaBorrow/3-Done.tsx +38 -0
- package/src/components/CreditLine/solanaBorrow/index.tsx +19 -25
- package/src/components/CreditLine/solanaPayment/1-ChooseAmount.tsx +75 -0
- package/src/components/CreditLine/solanaPayment/2-Transfer.tsx +92 -0
- package/src/components/CreditLine/solanaPayment/3-Done.tsx +59 -0
- package/src/components/CreditLine/solanaPayment/index.tsx +83 -0
- package/src/components/InputAmountModal.tsx +1 -0
- package/src/index.tsx +23 -8
- package/src/components/CreditLine/solanaBorrow/2-ApproveAllowance.tsx +0 -89
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
-
import { txAtom, useMQ, sendTxAtom, usePoolUnderlyingTokenContract, useMount, usePoolInfo, useAccountStats, usePoolInfoV2, usePoolUnderlyingTokenInfoV2, usePoolSafeAllowanceV2, useAuthErrorHandling, useCLFeeManager, useCLPoolAllowance, usePoolContract, useCreditContractV2, useCreditStatsV2, useFirstLossCoverContractV2, useFirstLossCoverRequirementV2, useFirstLossCoverAllowanceV2, useFeeManager, useInvoiceNFTContract, useRFPoolAllowance, useLenderDepositRecordV2, useLPConfigV2, useNextEpochStartTimeV2, useTrancheVaultContractV2, useCancellableRedemptionInfoV2, useParamsSearch, usePoolAllowance, useLenderApproved, useLenderPosition, useWithdrawlLockoutInSeconds, usePoolUnderlyingTokenBalance, usePoolUnderlyingTokenBalanceV2, useLenderApprovedV2, useTrancheVaultAssetsV2, useLastDepositTime, usePoolBalance, useReceivableInfoV2, useReceivableContractV2, useERC2612Permit, useMultiSendContract, usePoolUnderlyingToken, useFactoring, useLenderAccounts, useHumaProgram, useTokenAccount, useTrancheMintAccounts, useTrancheTokenAccounts, useBorrowerAccounts,
|
|
2
|
+
import { txAtom, useMQ, sendTxAtom, usePoolUnderlyingTokenContract, useMount, usePoolInfo, useAccountStats, usePoolInfoV2, usePoolUnderlyingTokenInfoV2, usePoolSafeAllowanceV2, useAuthErrorHandling, useCLFeeManager, useCLPoolAllowance, usePoolContract, useCreditContractV2, useCreditStatsV2, useFirstLossCoverContractV2, useFirstLossCoverRequirementV2, useFirstLossCoverAllowanceV2, useFeeManager, useInvoiceNFTContract, useRFPoolAllowance, useLenderDepositRecordV2, useLPConfigV2, useNextEpochStartTimeV2, useTrancheVaultContractV2, useCancellableRedemptionInfoV2, useParamsSearch, usePoolAllowance, useLenderApproved, useLenderPosition, useWithdrawlLockoutInSeconds, usePoolUnderlyingTokenBalance, usePoolUnderlyingTokenBalanceV2, useLenderApprovedV2, useTrancheVaultAssetsV2, useLastDepositTime, usePoolBalance, useReceivableInfoV2, useReceivableContractV2, useERC2612Permit, useMultiSendContract, usePoolUnderlyingToken, useFactoring, useLenderAccounts, useHumaProgram, useTokenAccount, useTrancheMintAccounts, useTrancheTokenAccounts, useBorrowerAccounts, Provider as Provider$1 } from '@huma-finance/web-shared';
|
|
3
3
|
import { useTheme, css, Box, Typography, Tooltip, Button, Dialog, Slider, Input, Divider, TextField, FormControl, FormLabel, RadioGroup, FormControlLabel, Radio, Snackbar, Alert, Link, Skeleton, TablePagination, LinearProgress, createTheme, ThemeProvider } from '@mui/material';
|
|
4
4
|
import { useAtom, Provider as Provider$2 } from 'jotai';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { useCallback, useState, useEffect, useMemo, useRef } from 'react';
|
|
7
7
|
import { useSelector, useDispatch, Provider } from 'react-redux';
|
|
8
|
-
import { supportedChainId, isTxFailed, getExplorerUrl, openInNewTab, TxStateType, decodeLogs, ERC20_ABI, downScale, formatMoney, POOL_NAME, POOL_TYPE, getERC20Contract, checkIsDev, EAService, EARejectionError, EARejectMessage, EARejectReason, timeUtil, formatNumber, doesChainSupportNotifi, getBlockchainConfigFromChain, CreditState, isEmpty, CreditStateV2, upScale, toBigNumber, TRANSFER_ABI, FirstLossCoverIndex, combineStyles, timestampToLL, getTrancheAssetsAndShares, IdentityService, CHAINS, configUtil, IdentityServiceV2, IdentityVerificationStatusV2, CampaignService, CAMPAIGN_REFERENCE_CODE, KYC_PROVIDER, formatAmount, getTrancheVaultContractV2, getTrancheRedemptionStatusV2, getPoolContractV2, CURRENCY_CODE, CreditEventText, SuperfluidPoolProcessor_ABI, hasRFActiveLoan, getWalletAddressAbbr, PoolMap, CreditEvent, SolanaTokenUtils, getSolanaExplorerUrl, getTokenAccounts, getSentinelAddress } from '@huma-finance/shared';
|
|
8
|
+
import { supportedChainId, isTxFailed, getExplorerUrl, openInNewTab, TxStateType, decodeLogs, ERC20_ABI, downScale, formatMoney, POOL_NAME, POOL_TYPE, getERC20Contract, checkIsDev, EAService, EARejectionError, EARejectMessage, EARejectReason, timeUtil, formatNumber, doesChainSupportNotifi, getBlockchainConfigFromChain, CreditState, isEmpty, CreditStateV2, upScale, toBigNumber, TRANSFER_ABI, FirstLossCoverIndex, combineStyles, timestampToLL, getTrancheAssetsAndShares, IdentityService, CHAINS, configUtil, IdentityServiceV2, IdentityVerificationStatusV2, CampaignService, CAMPAIGN_REFERENCE_CODE, KYC_PROVIDER, formatAmount, getTrancheVaultContractV2, getTrancheRedemptionStatusV2, getPoolContractV2, CURRENCY_CODE, CreditEventText, SuperfluidPoolProcessor_ABI, hasRFActiveLoan, getWalletAddressAbbr, PoolMap, CreditEvent, SolanaTokenUtils, getSolanaExplorerUrl, getTokenAccounts, getSentinelAddress, getCreditAccounts } from '@huma-finance/shared';
|
|
9
9
|
import { useWeb3React } from '@web3-react/core';
|
|
10
10
|
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
|
|
11
11
|
import { useResetAtom } from 'jotai/utils';
|
|
@@ -35,7 +35,7 @@ import TableRow from '@mui/material/TableRow';
|
|
|
35
35
|
import { getAddress } from '@ethersproject/address';
|
|
36
36
|
import { useWallet, useConnection } from '@solana/wallet-adapter-react';
|
|
37
37
|
import { BN } from '@coral-xyz/anchor';
|
|
38
|
-
import { TOKEN_2022_PROGRAM_ID, createApproveCheckedInstruction } from '@solana/spl-token';
|
|
38
|
+
import { TOKEN_2022_PROGRAM_ID, getAccount, TokenAccountNotFoundError, TokenInvalidAccountOwnerError, createAssociatedTokenAccountInstruction, ASSOCIATED_TOKEN_PROGRAM_ID, createApproveCheckedInstruction } from '@solana/spl-token';
|
|
39
39
|
import { Transaction, PublicKey } from '@solana/web3.js';
|
|
40
40
|
|
|
41
41
|
function _taggedTemplateLiteral(strings, raw) {
|
|
@@ -1891,7 +1891,7 @@ function ApproveAllowanceModal(_ref) {
|
|
|
1891
1891
|
});
|
|
1892
1892
|
}
|
|
1893
1893
|
|
|
1894
|
-
function ApproveAllowance$
|
|
1894
|
+
function ApproveAllowance$c(_ref) {
|
|
1895
1895
|
let {
|
|
1896
1896
|
poolInfo,
|
|
1897
1897
|
amount
|
|
@@ -2033,7 +2033,7 @@ function CreditLineApprove(_ref) {
|
|
|
2033
2033
|
loadingTitle: "Approve Allowance",
|
|
2034
2034
|
handleClose: handleClose,
|
|
2035
2035
|
handleSuccess: handleSuccess,
|
|
2036
|
-
children: [step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$
|
|
2036
|
+
children: [step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$c, {
|
|
2037
2037
|
poolInfo: poolInfo,
|
|
2038
2038
|
amount: amount
|
|
2039
2039
|
}), step === WIDGET_STEP.Done && jsx(Success$f, {
|
|
@@ -2132,7 +2132,7 @@ function ApproveAllowanceModalV2(_ref) {
|
|
|
2132
2132
|
});
|
|
2133
2133
|
}
|
|
2134
2134
|
|
|
2135
|
-
function ApproveAllowance$
|
|
2135
|
+
function ApproveAllowance$b(_ref) {
|
|
2136
2136
|
let {
|
|
2137
2137
|
poolInfo,
|
|
2138
2138
|
poolUnderlyingToken
|
|
@@ -2202,7 +2202,7 @@ function AutoPaybackV2(_ref) {
|
|
|
2202
2202
|
loadingTitle: "Auto Payback",
|
|
2203
2203
|
handleClose: handleClose,
|
|
2204
2204
|
handleSuccess: handleSuccess,
|
|
2205
|
-
children: [step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$
|
|
2205
|
+
children: [step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$b, {
|
|
2206
2206
|
poolInfo: poolInfo,
|
|
2207
2207
|
poolUnderlyingToken: poolUnderlyingToken
|
|
2208
2208
|
}), step === WIDGET_STEP.Done && jsx(Success$e, {
|
|
@@ -2575,7 +2575,7 @@ function ChooseAmountModal(_ref) {
|
|
|
2575
2575
|
});
|
|
2576
2576
|
}
|
|
2577
2577
|
|
|
2578
|
-
function ChooseAmount$
|
|
2578
|
+
function ChooseAmount$g(_ref) {
|
|
2579
2579
|
let {
|
|
2580
2580
|
poolInfo,
|
|
2581
2581
|
accountStats
|
|
@@ -2635,7 +2635,7 @@ function ChooseAmount$f(_ref) {
|
|
|
2635
2635
|
});
|
|
2636
2636
|
}
|
|
2637
2637
|
|
|
2638
|
-
function ApproveAllowance$
|
|
2638
|
+
function ApproveAllowance$a(_ref) {
|
|
2639
2639
|
let {
|
|
2640
2640
|
poolInfo
|
|
2641
2641
|
} = _ref;
|
|
@@ -2694,7 +2694,7 @@ function TxSendModal(_ref) {
|
|
|
2694
2694
|
});
|
|
2695
2695
|
}
|
|
2696
2696
|
|
|
2697
|
-
function Transfer$
|
|
2697
|
+
function Transfer$k(_ref) {
|
|
2698
2698
|
let {
|
|
2699
2699
|
poolInfo
|
|
2700
2700
|
} = _ref;
|
|
@@ -3052,12 +3052,12 @@ function CreditLineBorrow(_ref) {
|
|
|
3052
3052
|
children: [step === WIDGET_STEP.Evaluation && jsx(Evaluation$5, {
|
|
3053
3053
|
poolInfo: poolInfo,
|
|
3054
3054
|
handleApprove: approveCallback
|
|
3055
|
-
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$
|
|
3055
|
+
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$g, {
|
|
3056
3056
|
poolInfo: poolInfo,
|
|
3057
3057
|
accountStats: accountStats
|
|
3058
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$
|
|
3058
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$a, {
|
|
3059
3059
|
poolInfo: poolInfo
|
|
3060
|
-
}), step === WIDGET_STEP.Transfer && jsx(Transfer$
|
|
3060
|
+
}), step === WIDGET_STEP.Transfer && jsx(Transfer$k, {
|
|
3061
3061
|
poolInfo: poolInfo
|
|
3062
3062
|
}), step === WIDGET_STEP.Done && jsx(Success$d, {
|
|
3063
3063
|
poolInfo: poolInfo,
|
|
@@ -3100,7 +3100,7 @@ function InputAmountModal(_ref) {
|
|
|
3100
3100
|
inputField: css(_templateObject3$f || (_templateObject3$f = _taggedTemplateLiteral(["\n input {\n width: 100%;\n color: ", ";\n font-weight: 800;\n font-size: 40px;\n line-height: 133.4%;\n }\n "])), theme.palette.text.primary),
|
|
3101
3101
|
maxWrapper: css(_templateObject4$7 || (_templateObject4$7 = _taggedTemplateLiteral(["\n position: relative;\n display: flex;\n justify-content: flex-end;\n "]))),
|
|
3102
3102
|
maxTitle: css(_templateObject5$3 || (_templateObject5$3 = _taggedTemplateLiteral(["\n position: absolute;\n color: ", ";\n font-weight: 400;\n font-size: 12px;\n line-height: 166%;\n letter-spacing: 0.4px;\n top: ", ";\n width: 200px;\n text-align: right;\n "])), theme.palette.text.primary, theme.spacing(-3)),
|
|
3103
|
-
max: css(_templateObject6$3 || (_templateObject6$3 = _taggedTemplateLiteral(["\n display: flex;\n min-width: fit-content;\n justify-content: center;\n align-items: center;\n border-radius: 32px;\n padding: 4px 10px;\n gap: 8px;\n font-weight: 700;\n font-size: 13px;\n line-height: 22px;\n letter-spacing: 0.46px;\n "]))),
|
|
3103
|
+
max: css(_templateObject6$3 || (_templateObject6$3 = _taggedTemplateLiteral(["\n display: flex;\n min-width: fit-content;\n justify-content: center;\n align-items: center;\n border-radius: 32px;\n padding: 4px 10px;\n gap: 8px;\n font-weight: 700;\n font-size: 13px;\n line-height: 22px;\n letter-spacing: 0.46px;\n white-space: nowrap;\n "]))),
|
|
3104
3104
|
info: css(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteral(["\n color: ", ";\n font-weight: 400;\n font-size: 16px;\n line-height: 160%;\n letter-spacing: 0.15px;\n "])), theme.palette.text.secondary),
|
|
3105
3105
|
subInfo: css(_templateObject8$1 || (_templateObject8$1 = _taggedTemplateLiteral(["\n position: absolute;\n bottom: ", ";\n "])), theme.spacing(6))
|
|
3106
3106
|
};
|
|
@@ -3176,7 +3176,7 @@ function InputAmountModal(_ref) {
|
|
|
3176
3176
|
});
|
|
3177
3177
|
}
|
|
3178
3178
|
|
|
3179
|
-
function ChooseAmount$
|
|
3179
|
+
function ChooseAmount$f(_ref) {
|
|
3180
3180
|
let {
|
|
3181
3181
|
poolInfo,
|
|
3182
3182
|
poolUnderlyingToken,
|
|
@@ -3229,7 +3229,7 @@ function ChooseAmount$e(_ref) {
|
|
|
3229
3229
|
});
|
|
3230
3230
|
}
|
|
3231
3231
|
|
|
3232
|
-
function ApproveAllowance$
|
|
3232
|
+
function ApproveAllowance$9(_ref) {
|
|
3233
3233
|
let {
|
|
3234
3234
|
poolInfo,
|
|
3235
3235
|
poolUnderlyingToken
|
|
@@ -3287,7 +3287,7 @@ function TxSendModalV2(_ref) {
|
|
|
3287
3287
|
});
|
|
3288
3288
|
}
|
|
3289
3289
|
|
|
3290
|
-
function Transfer$
|
|
3290
|
+
function Transfer$j(_ref) {
|
|
3291
3291
|
let {
|
|
3292
3292
|
poolInfo
|
|
3293
3293
|
} = _ref;
|
|
@@ -3418,14 +3418,14 @@ function CreditLineBorrowV2(_ref) {
|
|
|
3418
3418
|
handleSuccess: handleSuccessCallback,
|
|
3419
3419
|
children: [!step && jsx(LoadingModal, {
|
|
3420
3420
|
title: "Borrow"
|
|
3421
|
-
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$
|
|
3421
|
+
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$f, {
|
|
3422
3422
|
poolInfo: poolInfo,
|
|
3423
3423
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
3424
3424
|
accountStats: accountStats
|
|
3425
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$
|
|
3425
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$9, {
|
|
3426
3426
|
poolInfo: poolInfo,
|
|
3427
3427
|
poolUnderlyingToken: poolUnderlyingToken
|
|
3428
|
-
}), step === WIDGET_STEP.Transfer && jsx(Transfer$
|
|
3428
|
+
}), step === WIDGET_STEP.Transfer && jsx(Transfer$j, {
|
|
3429
3429
|
poolInfo: poolInfo
|
|
3430
3430
|
}), step === WIDGET_STEP.Done && jsx(Success$c, {
|
|
3431
3431
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
@@ -3442,7 +3442,7 @@ function CreditLineBorrowV2(_ref) {
|
|
|
3442
3442
|
});
|
|
3443
3443
|
}
|
|
3444
3444
|
|
|
3445
|
-
function ChooseAmount$
|
|
3445
|
+
function ChooseAmount$e(_ref) {
|
|
3446
3446
|
let {
|
|
3447
3447
|
payoffAmount,
|
|
3448
3448
|
totalDueAmount,
|
|
@@ -3493,7 +3493,7 @@ function ChooseAmount$d(_ref) {
|
|
|
3493
3493
|
});
|
|
3494
3494
|
}
|
|
3495
3495
|
|
|
3496
|
-
function ApproveAllowance$
|
|
3496
|
+
function ApproveAllowance$8(_ref) {
|
|
3497
3497
|
let {
|
|
3498
3498
|
poolInfo
|
|
3499
3499
|
} = _ref;
|
|
@@ -3507,7 +3507,7 @@ function ApproveAllowance$9(_ref) {
|
|
|
3507
3507
|
});
|
|
3508
3508
|
}
|
|
3509
3509
|
|
|
3510
|
-
function Transfer$
|
|
3510
|
+
function Transfer$i(_ref) {
|
|
3511
3511
|
let {
|
|
3512
3512
|
poolInfo
|
|
3513
3513
|
} = _ref;
|
|
@@ -3599,13 +3599,13 @@ function CreditLinePayment(_ref) {
|
|
|
3599
3599
|
loadingTitle: "Make Payment",
|
|
3600
3600
|
handleClose: handleClose,
|
|
3601
3601
|
handleSuccess: handleSuccess,
|
|
3602
|
-
children: [step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$
|
|
3602
|
+
children: [step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$e, {
|
|
3603
3603
|
poolInfo: poolInfo,
|
|
3604
3604
|
payoffAmount: payoffAmount,
|
|
3605
3605
|
totalDueAmount: totalDueAmount
|
|
3606
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$
|
|
3606
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$8, {
|
|
3607
3607
|
poolInfo: poolInfo
|
|
3608
|
-
}), step === WIDGET_STEP.Transfer && jsx(Transfer$
|
|
3608
|
+
}), step === WIDGET_STEP.Transfer && jsx(Transfer$i, {
|
|
3609
3609
|
poolInfo: poolInfo
|
|
3610
3610
|
}), step === WIDGET_STEP.Done && jsx(Success$b, {
|
|
3611
3611
|
poolInfo: poolInfo,
|
|
@@ -3618,7 +3618,7 @@ function CreditLinePayment(_ref) {
|
|
|
3618
3618
|
});
|
|
3619
3619
|
}
|
|
3620
3620
|
|
|
3621
|
-
function ChooseAmount$
|
|
3621
|
+
function ChooseAmount$d(_ref) {
|
|
3622
3622
|
let {
|
|
3623
3623
|
payoffAmount: payoffAmountBN,
|
|
3624
3624
|
totalDueAmount: totalDueAmountBN,
|
|
@@ -3640,6 +3640,8 @@ function ChooseAmount$c(_ref) {
|
|
|
3640
3640
|
} = usePoolSafeAllowanceV2(poolInfo.poolName, account, provider);
|
|
3641
3641
|
const totalDueAmount = Number(ethers.utils.formatUnits(totalDueAmountBN, decimals));
|
|
3642
3642
|
const payoffAmount = Number(ethers.utils.formatUnits(payoffAmountBN, decimals));
|
|
3643
|
+
|
|
3644
|
+
// TODO: Remove redundant useEffect
|
|
3643
3645
|
useEffect(() => {
|
|
3644
3646
|
setCurrentAmount(totalDueAmount);
|
|
3645
3647
|
}, [totalDueAmount]);
|
|
@@ -3679,7 +3681,7 @@ function ChooseAmount$c(_ref) {
|
|
|
3679
3681
|
});
|
|
3680
3682
|
}
|
|
3681
3683
|
|
|
3682
|
-
function ApproveAllowance$
|
|
3684
|
+
function ApproveAllowance$7(_ref) {
|
|
3683
3685
|
let {
|
|
3684
3686
|
poolInfo,
|
|
3685
3687
|
poolUnderlyingToken
|
|
@@ -3697,7 +3699,7 @@ function ApproveAllowance$8(_ref) {
|
|
|
3697
3699
|
});
|
|
3698
3700
|
}
|
|
3699
3701
|
|
|
3700
|
-
function Transfer$
|
|
3702
|
+
function Transfer$h(_ref) {
|
|
3701
3703
|
let {
|
|
3702
3704
|
poolInfo,
|
|
3703
3705
|
poolUnderlyingToken
|
|
@@ -3803,15 +3805,15 @@ function CreditLinePaymentV2(_ref) {
|
|
|
3803
3805
|
loadingTitle: "Pay",
|
|
3804
3806
|
handleClose: handleClose,
|
|
3805
3807
|
handleSuccess: handleSuccess,
|
|
3806
|
-
children: [step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$
|
|
3808
|
+
children: [step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$d, {
|
|
3807
3809
|
poolInfo: poolInfo,
|
|
3808
3810
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
3809
3811
|
payoffAmount: payoffAmount,
|
|
3810
3812
|
totalDueAmount: totalDueAmount
|
|
3811
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$
|
|
3813
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$7, {
|
|
3812
3814
|
poolInfo: poolInfo,
|
|
3813
3815
|
poolUnderlyingToken: poolUnderlyingToken
|
|
3814
|
-
}), step === WIDGET_STEP.Transfer && jsx(Transfer$
|
|
3816
|
+
}), step === WIDGET_STEP.Transfer && jsx(Transfer$h, {
|
|
3815
3817
|
poolInfo: poolInfo,
|
|
3816
3818
|
poolUnderlyingToken: poolUnderlyingToken
|
|
3817
3819
|
}), step === WIDGET_STEP.Done && jsx(Success$a, {
|
|
@@ -3825,7 +3827,7 @@ function CreditLinePaymentV2(_ref) {
|
|
|
3825
3827
|
});
|
|
3826
3828
|
}
|
|
3827
3829
|
|
|
3828
|
-
function ApproveAllowance$
|
|
3830
|
+
function ApproveAllowance$6(_ref) {
|
|
3829
3831
|
let {
|
|
3830
3832
|
poolInfo,
|
|
3831
3833
|
poolUnderlyingToken,
|
|
@@ -3862,7 +3864,7 @@ function Success$9(_ref) {
|
|
|
3862
3864
|
});
|
|
3863
3865
|
}
|
|
3864
3866
|
|
|
3865
|
-
function Transfer$
|
|
3867
|
+
function Transfer$g(_ref) {
|
|
3866
3868
|
let {
|
|
3867
3869
|
poolInfo,
|
|
3868
3870
|
amountToDeposit,
|
|
@@ -3939,11 +3941,11 @@ function SupplyFirstLossCover(_ref) {
|
|
|
3939
3941
|
loadingTitle: title,
|
|
3940
3942
|
handleClose: handleClose,
|
|
3941
3943
|
handleSuccess: handleSuccess,
|
|
3942
|
-
children: [step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$
|
|
3944
|
+
children: [step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$6, {
|
|
3943
3945
|
poolInfo: poolInfo,
|
|
3944
3946
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
3945
3947
|
amountToDeposit: minAmountToDeposit
|
|
3946
|
-
}), step === WIDGET_STEP.Transfer && jsx(Transfer$
|
|
3948
|
+
}), step === WIDGET_STEP.Transfer && jsx(Transfer$g, {
|
|
3947
3949
|
poolInfo: poolInfo,
|
|
3948
3950
|
amountToDeposit: minAmountToDeposit,
|
|
3949
3951
|
title: title
|
|
@@ -3996,7 +3998,7 @@ function Evaluation$4(_ref) {
|
|
|
3996
3998
|
});
|
|
3997
3999
|
}
|
|
3998
4000
|
|
|
3999
|
-
function ChooseAmount$
|
|
4001
|
+
function ChooseAmount$c(_ref) {
|
|
4000
4002
|
var _receivable;
|
|
4001
4003
|
let {
|
|
4002
4004
|
poolInfo,
|
|
@@ -4201,7 +4203,7 @@ function ApproveNFT(_ref) {
|
|
|
4201
4203
|
});
|
|
4202
4204
|
}
|
|
4203
4205
|
|
|
4204
|
-
function Transfer$
|
|
4206
|
+
function Transfer$f(_ref) {
|
|
4205
4207
|
let {
|
|
4206
4208
|
poolInfo,
|
|
4207
4209
|
tokenId
|
|
@@ -4277,13 +4279,13 @@ function InvoiceFactoringBorrow(_ref) {
|
|
|
4277
4279
|
children: [step === WIDGET_STEP.Evaluation && jsx(Evaluation$4, {
|
|
4278
4280
|
poolInfo: poolInfo,
|
|
4279
4281
|
tokenId: tokenId.toString()
|
|
4280
|
-
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$
|
|
4282
|
+
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$c, {
|
|
4281
4283
|
poolInfo: poolInfo,
|
|
4282
4284
|
accountStats: accountStats
|
|
4283
4285
|
}), step === WIDGET_STEP.ConfirmTransfer && jsx(ConfirmTransfer$2, {}), step === WIDGET_STEP.ApproveNFT && jsx(ApproveNFT, {
|
|
4284
4286
|
poolInfo: poolInfo,
|
|
4285
4287
|
tokenId: tokenId.toString()
|
|
4286
|
-
}), step === WIDGET_STEP.Transfer && jsx(Transfer$
|
|
4288
|
+
}), step === WIDGET_STEP.Transfer && jsx(Transfer$f, {
|
|
4287
4289
|
poolInfo: poolInfo,
|
|
4288
4290
|
tokenId: tokenId.toString()
|
|
4289
4291
|
}), step === WIDGET_STEP.Done && jsx(Success$8, {
|
|
@@ -4296,7 +4298,7 @@ function InvoiceFactoringBorrow(_ref) {
|
|
|
4296
4298
|
});
|
|
4297
4299
|
}
|
|
4298
4300
|
|
|
4299
|
-
function ChooseAmount$
|
|
4301
|
+
function ChooseAmount$b(_ref) {
|
|
4300
4302
|
let {
|
|
4301
4303
|
creditRecord,
|
|
4302
4304
|
poolInfo
|
|
@@ -4347,7 +4349,7 @@ function ChooseAmount$a(_ref) {
|
|
|
4347
4349
|
});
|
|
4348
4350
|
}
|
|
4349
4351
|
|
|
4350
|
-
function ApproveAllowance$
|
|
4352
|
+
function ApproveAllowance$5(_ref) {
|
|
4351
4353
|
let {
|
|
4352
4354
|
poolInfo
|
|
4353
4355
|
} = _ref;
|
|
@@ -4361,7 +4363,7 @@ function ApproveAllowance$6(_ref) {
|
|
|
4361
4363
|
});
|
|
4362
4364
|
}
|
|
4363
4365
|
|
|
4364
|
-
function Transfer$
|
|
4366
|
+
function Transfer$e(_ref) {
|
|
4365
4367
|
let {
|
|
4366
4368
|
poolInfo
|
|
4367
4369
|
} = _ref;
|
|
@@ -4441,12 +4443,12 @@ function InvoiceFactoringPayment(_ref) {
|
|
|
4441
4443
|
loadingTitle: "Make Payment",
|
|
4442
4444
|
handleClose: handleClose,
|
|
4443
4445
|
handleSuccess: handleSuccess,
|
|
4444
|
-
children: [step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$
|
|
4446
|
+
children: [step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$b, {
|
|
4445
4447
|
creditRecord: creditRecord,
|
|
4446
4448
|
poolInfo: poolInfo
|
|
4447
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$
|
|
4449
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$5, {
|
|
4448
4450
|
poolInfo: poolInfo
|
|
4449
|
-
}), step === WIDGET_STEP.Transfer && jsx(Transfer$
|
|
4451
|
+
}), step === WIDGET_STEP.Transfer && jsx(Transfer$e, {
|
|
4450
4452
|
poolInfo: poolInfo
|
|
4451
4453
|
}), step === WIDGET_STEP.Done && jsx(Success$7, {
|
|
4452
4454
|
poolInfo: poolInfo,
|
|
@@ -4515,7 +4517,7 @@ function ChooseTranche$4(_ref) {
|
|
|
4515
4517
|
});
|
|
4516
4518
|
}
|
|
4517
4519
|
|
|
4518
|
-
function ChooseAmount$
|
|
4520
|
+
function ChooseAmount$a(_ref) {
|
|
4519
4521
|
let {
|
|
4520
4522
|
poolInfo,
|
|
4521
4523
|
poolUnderlyingToken,
|
|
@@ -4580,7 +4582,7 @@ function ChooseAmount$9(_ref) {
|
|
|
4580
4582
|
});
|
|
4581
4583
|
}
|
|
4582
4584
|
|
|
4583
|
-
function Transfer$
|
|
4585
|
+
function Transfer$d(_ref) {
|
|
4584
4586
|
let {
|
|
4585
4587
|
poolInfo,
|
|
4586
4588
|
poolUnderlyingToken,
|
|
@@ -4613,7 +4615,7 @@ function Transfer$b(_ref) {
|
|
|
4613
4615
|
});
|
|
4614
4616
|
}
|
|
4615
4617
|
|
|
4616
|
-
function Done$
|
|
4618
|
+
function Done$6(_ref) {
|
|
4617
4619
|
let {
|
|
4618
4620
|
handleAction
|
|
4619
4621
|
} = _ref;
|
|
@@ -4726,15 +4728,15 @@ function AddRedemptionV2(_ref) {
|
|
|
4726
4728
|
children: [step === WIDGET_STEP.ChooseTranche && jsx(ChooseTranche$4, {
|
|
4727
4729
|
selectedTranche: trancheInfo === null || trancheInfo === void 0 ? void 0 : trancheInfo.tranche,
|
|
4728
4730
|
changeTranche: handleChangeTranche
|
|
4729
|
-
}), step === WIDGET_STEP.ChooseAmount && trancheInfo && jsx(ChooseAmount$
|
|
4731
|
+
}), step === WIDGET_STEP.ChooseAmount && trancheInfo && jsx(ChooseAmount$a, {
|
|
4730
4732
|
poolInfo: poolInfo,
|
|
4731
4733
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
4732
4734
|
trancheInfo: trancheInfo
|
|
4733
|
-
}), step === WIDGET_STEP.Transfer && trancheInfo && jsx(Transfer$
|
|
4735
|
+
}), step === WIDGET_STEP.Transfer && trancheInfo && jsx(Transfer$d, {
|
|
4734
4736
|
poolInfo: poolInfo,
|
|
4735
4737
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
4736
4738
|
trancheInfo: trancheInfo
|
|
4737
|
-
}), step === WIDGET_STEP.Done && trancheInfo && jsx(Done$
|
|
4739
|
+
}), step === WIDGET_STEP.Done && trancheInfo && jsx(Done$6, {
|
|
4738
4740
|
handleAction: handleClose
|
|
4739
4741
|
}), step === WIDGET_STEP.Error && jsx(ErrorModal, {
|
|
4740
4742
|
title: title,
|
|
@@ -4745,7 +4747,7 @@ function AddRedemptionV2(_ref) {
|
|
|
4745
4747
|
});
|
|
4746
4748
|
}
|
|
4747
4749
|
|
|
4748
|
-
function Transfer$
|
|
4750
|
+
function Transfer$c(_ref) {
|
|
4749
4751
|
let {
|
|
4750
4752
|
poolInfo,
|
|
4751
4753
|
trancheType,
|
|
@@ -4771,7 +4773,7 @@ function Transfer$a(_ref) {
|
|
|
4771
4773
|
});
|
|
4772
4774
|
}
|
|
4773
4775
|
|
|
4774
|
-
function Done$
|
|
4776
|
+
function Done$5(_ref) {
|
|
4775
4777
|
let {
|
|
4776
4778
|
poolUnderlyingToken,
|
|
4777
4779
|
redemptionInfo,
|
|
@@ -4832,11 +4834,11 @@ function CancelRedemptionV2(_ref) {
|
|
|
4832
4834
|
loadingTitle: title,
|
|
4833
4835
|
handleClose: handleClose,
|
|
4834
4836
|
handleSuccess: handleRedeemSuccess,
|
|
4835
|
-
children: [step === WIDGET_STEP.Transfer && jsx(Transfer$
|
|
4837
|
+
children: [step === WIDGET_STEP.Transfer && jsx(Transfer$c, {
|
|
4836
4838
|
poolInfo: poolInfo,
|
|
4837
4839
|
trancheType: trancheType,
|
|
4838
4840
|
redemptionInfo: redemptionInfo
|
|
4839
|
-
}), step === WIDGET_STEP.Done && jsx(Done$
|
|
4841
|
+
}), step === WIDGET_STEP.Done && jsx(Done$5, {
|
|
4840
4842
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
4841
4843
|
handleAction: handleClose,
|
|
4842
4844
|
redemptionInfo: redemptionInfo
|
|
@@ -5238,7 +5240,7 @@ function Evaluation$3(_ref) {
|
|
|
5238
5240
|
});
|
|
5239
5241
|
}
|
|
5240
5242
|
|
|
5241
|
-
function ChooseAmount$
|
|
5243
|
+
function ChooseAmount$9(_ref) {
|
|
5242
5244
|
let {
|
|
5243
5245
|
allowance,
|
|
5244
5246
|
withdrawlLockoutSeconds,
|
|
@@ -5281,7 +5283,7 @@ function ChooseAmount$8(_ref) {
|
|
|
5281
5283
|
});
|
|
5282
5284
|
}
|
|
5283
5285
|
|
|
5284
|
-
function ApproveAllowance$
|
|
5286
|
+
function ApproveAllowance$4(_ref) {
|
|
5285
5287
|
let {
|
|
5286
5288
|
poolInfo
|
|
5287
5289
|
} = _ref;
|
|
@@ -5295,7 +5297,7 @@ function ApproveAllowance$5(_ref) {
|
|
|
5295
5297
|
});
|
|
5296
5298
|
}
|
|
5297
5299
|
|
|
5298
|
-
function Transfer$
|
|
5300
|
+
function Transfer$b(_ref) {
|
|
5299
5301
|
let {
|
|
5300
5302
|
poolInfo
|
|
5301
5303
|
} = _ref;
|
|
@@ -5445,14 +5447,14 @@ function LendSupply(_ref) {
|
|
|
5445
5447
|
poolInfo: poolInfo,
|
|
5446
5448
|
handleClose: handleClose,
|
|
5447
5449
|
handleApproveSuccess: handleApproveSuccess
|
|
5448
|
-
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$
|
|
5450
|
+
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$9, {
|
|
5449
5451
|
poolInfo: poolInfo,
|
|
5450
5452
|
allowance: allowance,
|
|
5451
5453
|
underlyingTokenBalance: balanceWithoutDecimals,
|
|
5452
5454
|
withdrawlLockoutSeconds: withdrawlLockoutSeconds
|
|
5453
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$
|
|
5455
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$4, {
|
|
5454
5456
|
poolInfo: poolInfo
|
|
5455
|
-
}), step === WIDGET_STEP.Transfer && jsx(Transfer$
|
|
5457
|
+
}), step === WIDGET_STEP.Transfer && jsx(Transfer$b, {
|
|
5456
5458
|
poolInfo: poolInfo
|
|
5457
5459
|
}), step === WIDGET_STEP.Done && jsx(Success$6, {
|
|
5458
5460
|
poolInfo: poolInfo,
|
|
@@ -6093,7 +6095,7 @@ function Evaluation$2(_ref) {
|
|
|
6093
6095
|
return null;
|
|
6094
6096
|
}
|
|
6095
6097
|
|
|
6096
|
-
function ChooseAmount$
|
|
6098
|
+
function ChooseAmount$8(_ref) {
|
|
6097
6099
|
let {
|
|
6098
6100
|
poolInfo,
|
|
6099
6101
|
lpConfig,
|
|
@@ -6176,7 +6178,7 @@ function ChooseAmount$7(_ref) {
|
|
|
6176
6178
|
});
|
|
6177
6179
|
}
|
|
6178
6180
|
|
|
6179
|
-
function ApproveAllowance$
|
|
6181
|
+
function ApproveAllowance$3(_ref) {
|
|
6180
6182
|
let {
|
|
6181
6183
|
poolInfo
|
|
6182
6184
|
} = _ref;
|
|
@@ -6193,7 +6195,7 @@ function ApproveAllowance$4(_ref) {
|
|
|
6193
6195
|
});
|
|
6194
6196
|
}
|
|
6195
6197
|
|
|
6196
|
-
function Transfer$
|
|
6198
|
+
function Transfer$a(_ref) {
|
|
6197
6199
|
let {
|
|
6198
6200
|
poolInfo,
|
|
6199
6201
|
trancheType
|
|
@@ -6559,16 +6561,16 @@ function LendSupplyV2(_ref) {
|
|
|
6559
6561
|
changeTranche: setSelectedTranche,
|
|
6560
6562
|
pointsTestnetExperience: pointsTestnetExperience,
|
|
6561
6563
|
campaign: campaign
|
|
6562
|
-
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$
|
|
6564
|
+
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$8, {
|
|
6563
6565
|
poolInfo: poolInfo,
|
|
6564
6566
|
lpConfig: lpConfig,
|
|
6565
6567
|
juniorAssets: juniorAssets,
|
|
6566
6568
|
seniorAssets: seniorAssets,
|
|
6567
6569
|
selectedTranche: selectedTranche,
|
|
6568
6570
|
isUniTranche: isUniTranche
|
|
6569
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$
|
|
6571
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$3, {
|
|
6570
6572
|
poolInfo: poolInfo
|
|
6571
|
-
}), step === WIDGET_STEP.Transfer && selectedTranche && jsx(Transfer$
|
|
6573
|
+
}), step === WIDGET_STEP.Transfer && selectedTranche && jsx(Transfer$a, {
|
|
6572
6574
|
poolInfo: poolInfo,
|
|
6573
6575
|
trancheType: selectedTranche
|
|
6574
6576
|
}), step === WIDGET_STEP.Done && jsx(Success$5, {
|
|
@@ -6636,7 +6638,7 @@ function CheckWithdrawable(_ref) {
|
|
|
6636
6638
|
});
|
|
6637
6639
|
}
|
|
6638
6640
|
|
|
6639
|
-
function ChooseAmount$
|
|
6641
|
+
function ChooseAmount$7(_ref) {
|
|
6640
6642
|
let {
|
|
6641
6643
|
lenderPosition,
|
|
6642
6644
|
poolBalance,
|
|
@@ -6674,7 +6676,7 @@ function ChooseAmount$6(_ref) {
|
|
|
6674
6676
|
});
|
|
6675
6677
|
}
|
|
6676
6678
|
|
|
6677
|
-
function Transfer$
|
|
6679
|
+
function Transfer$9(_ref) {
|
|
6678
6680
|
let {
|
|
6679
6681
|
poolInfo
|
|
6680
6682
|
} = _ref;
|
|
@@ -6787,11 +6789,11 @@ function LendWithdraw(_ref) {
|
|
|
6787
6789
|
children: [step === WIDGET_STEP.CheckWithdrawable && jsx(CheckWithdrawable, {
|
|
6788
6790
|
poolInfo: poolInfo,
|
|
6789
6791
|
handleClose: handleClose
|
|
6790
|
-
}), step === WIDGET_STEP.ChooseAmount && lenderPosition && poolBalance && jsx(ChooseAmount$
|
|
6792
|
+
}), step === WIDGET_STEP.ChooseAmount && lenderPosition && poolBalance && jsx(ChooseAmount$7, {
|
|
6791
6793
|
poolInfo: poolInfo,
|
|
6792
6794
|
lenderPosition: lenderPosition,
|
|
6793
6795
|
poolBalance: poolBalance
|
|
6794
|
-
}), step === WIDGET_STEP.Transfer && jsx(Transfer$
|
|
6796
|
+
}), step === WIDGET_STEP.Transfer && jsx(Transfer$9, {
|
|
6795
6797
|
poolInfo: poolInfo
|
|
6796
6798
|
}), step === WIDGET_STEP.Done && jsx(Success$4, {
|
|
6797
6799
|
poolInfo: poolInfo,
|
|
@@ -6894,7 +6896,7 @@ function ConfirmTransfer$1(_ref) {
|
|
|
6894
6896
|
});
|
|
6895
6897
|
}
|
|
6896
6898
|
|
|
6897
|
-
function Transfer$
|
|
6899
|
+
function Transfer$8(_ref) {
|
|
6898
6900
|
let {
|
|
6899
6901
|
poolInfo,
|
|
6900
6902
|
tranche,
|
|
@@ -6920,7 +6922,7 @@ function Transfer$6(_ref) {
|
|
|
6920
6922
|
});
|
|
6921
6923
|
}
|
|
6922
6924
|
|
|
6923
|
-
function Done$
|
|
6925
|
+
function Done$4(_ref) {
|
|
6924
6926
|
let {
|
|
6925
6927
|
poolUnderlyingToken,
|
|
6926
6928
|
withdrawAmount,
|
|
@@ -7020,11 +7022,11 @@ function LendWithdrawV2(_ref) {
|
|
|
7020
7022
|
redemptionStatus: redemptionStatus,
|
|
7021
7023
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
7022
7024
|
poolIsClosed: poolIsClosed
|
|
7023
|
-
}), step === WIDGET_STEP.Transfer && jsx(Transfer$
|
|
7025
|
+
}), step === WIDGET_STEP.Transfer && jsx(Transfer$8, {
|
|
7024
7026
|
poolInfo: poolInfo,
|
|
7025
7027
|
tranche: trancheType,
|
|
7026
7028
|
poolIsClosed: poolIsClosed
|
|
7027
|
-
}), step === WIDGET_STEP.Done && jsx(Done$
|
|
7029
|
+
}), step === WIDGET_STEP.Done && jsx(Done$4, {
|
|
7028
7030
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
7029
7031
|
withdrawAmount: redemptionStatus.withdrawableAssets,
|
|
7030
7032
|
handleAction: handleClose
|
|
@@ -7037,7 +7039,7 @@ function LendWithdrawV2(_ref) {
|
|
|
7037
7039
|
});
|
|
7038
7040
|
}
|
|
7039
7041
|
|
|
7040
|
-
function ChooseAmount$
|
|
7042
|
+
function ChooseAmount$6(_ref) {
|
|
7041
7043
|
let {
|
|
7042
7044
|
poolInfo,
|
|
7043
7045
|
poolUnderlyingToken,
|
|
@@ -7101,7 +7103,7 @@ function ChooseAmount$5(_ref) {
|
|
|
7101
7103
|
});
|
|
7102
7104
|
}
|
|
7103
7105
|
|
|
7104
|
-
function ApproveAllowance$
|
|
7106
|
+
function ApproveAllowance$2(_ref) {
|
|
7105
7107
|
let {
|
|
7106
7108
|
poolInfo,
|
|
7107
7109
|
poolUnderlyingToken
|
|
@@ -7160,7 +7162,7 @@ function ApproveReceivable$1(_ref) {
|
|
|
7160
7162
|
});
|
|
7161
7163
|
}
|
|
7162
7164
|
|
|
7163
|
-
function Transfer$
|
|
7165
|
+
function Transfer$7(_ref) {
|
|
7164
7166
|
let {
|
|
7165
7167
|
poolInfo,
|
|
7166
7168
|
tokenId
|
|
@@ -7301,18 +7303,18 @@ function ReceivableBackedCreditLineBorrowV2(_ref) {
|
|
|
7301
7303
|
loadingTitle: "Borrow",
|
|
7302
7304
|
handleClose: handleClose,
|
|
7303
7305
|
handleSuccess: handleSuccessCallback,
|
|
7304
|
-
children: [step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$
|
|
7306
|
+
children: [step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$6, {
|
|
7305
7307
|
poolInfo: poolInfo,
|
|
7306
7308
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
7307
7309
|
accountStats: accountStats,
|
|
7308
7310
|
tokenId: tokenId
|
|
7309
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$
|
|
7311
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance$2, {
|
|
7310
7312
|
poolInfo: poolInfo,
|
|
7311
7313
|
poolUnderlyingToken: poolUnderlyingToken
|
|
7312
7314
|
}), step === WIDGET_STEP.ApproveNFT && tokenId && jsx(ApproveReceivable$1, {
|
|
7313
7315
|
poolInfo: poolInfo,
|
|
7314
7316
|
tokenId: tokenId
|
|
7315
|
-
}), step === WIDGET_STEP.Transfer && tokenId && jsx(Transfer$
|
|
7317
|
+
}), step === WIDGET_STEP.Transfer && tokenId && jsx(Transfer$7, {
|
|
7316
7318
|
poolInfo: poolInfo,
|
|
7317
7319
|
tokenId: tokenId
|
|
7318
7320
|
}), step === WIDGET_STEP.Done && jsx(Success$3, {
|
|
@@ -7386,7 +7388,7 @@ function ChoosePaymentType(_ref) {
|
|
|
7386
7388
|
});
|
|
7387
7389
|
}
|
|
7388
7390
|
|
|
7389
|
-
function ChooseAmount$
|
|
7391
|
+
function ChooseAmount$5(_ref) {
|
|
7390
7392
|
let {
|
|
7391
7393
|
payoffAmount: payoffAmountBN,
|
|
7392
7394
|
poolInfo,
|
|
@@ -7440,7 +7442,7 @@ function ChooseAmount$4(_ref) {
|
|
|
7440
7442
|
});
|
|
7441
7443
|
}
|
|
7442
7444
|
|
|
7443
|
-
function ApproveAllowance$
|
|
7445
|
+
function ApproveAllowance$1(_ref) {
|
|
7444
7446
|
let {
|
|
7445
7447
|
poolInfo,
|
|
7446
7448
|
poolUnderlyingToken,
|
|
@@ -7568,7 +7570,7 @@ function ApproveReceivable(_ref) {
|
|
|
7568
7570
|
});
|
|
7569
7571
|
}
|
|
7570
7572
|
|
|
7571
|
-
function Transfer$
|
|
7573
|
+
function Transfer$6(_ref) {
|
|
7572
7574
|
let {
|
|
7573
7575
|
poolInfo,
|
|
7574
7576
|
poolUnderlyingToken,
|
|
@@ -7719,12 +7721,12 @@ function ReceivableBackedCreditLinePaymentV2(_ref) {
|
|
|
7719
7721
|
children: [step === WIDGET_STEP.ChoosePaymentType && jsx(ChoosePaymentType, {
|
|
7720
7722
|
paymentType: paymentType,
|
|
7721
7723
|
changePaymentType: setPaymentType
|
|
7722
|
-
}), step === WIDGET_STEP.ChooseAmount && paymentType && jsx(ChooseAmount$
|
|
7724
|
+
}), step === WIDGET_STEP.ChooseAmount && paymentType && jsx(ChooseAmount$5, {
|
|
7723
7725
|
poolInfo: poolInfo,
|
|
7724
7726
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
7725
7727
|
payoffAmount: payoffAmount,
|
|
7726
7728
|
paymentType: paymentType
|
|
7727
|
-
}), step === WIDGET_STEP.ApproveAllowance && paymentType && jsx(ApproveAllowance$
|
|
7729
|
+
}), step === WIDGET_STEP.ApproveAllowance && paymentType && jsx(ApproveAllowance$1, {
|
|
7728
7730
|
poolInfo: poolInfo,
|
|
7729
7731
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
7730
7732
|
paymentType: paymentType
|
|
@@ -7735,7 +7737,7 @@ function ReceivableBackedCreditLinePaymentV2(_ref) {
|
|
|
7735
7737
|
}), step === WIDGET_STEP.ApproveNFT && borrowTokenId && jsx(ApproveReceivable, {
|
|
7736
7738
|
poolInfo: poolInfo,
|
|
7737
7739
|
tokenId: borrowTokenId
|
|
7738
|
-
}), step === WIDGET_STEP.Transfer && paymentType && jsx(Transfer$
|
|
7740
|
+
}), step === WIDGET_STEP.Transfer && paymentType && jsx(Transfer$6, {
|
|
7739
7741
|
poolInfo: poolInfo,
|
|
7740
7742
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
7741
7743
|
paymentType: paymentType,
|
|
@@ -8065,7 +8067,7 @@ function Evaluation$1(_ref) {
|
|
|
8065
8067
|
});
|
|
8066
8068
|
}
|
|
8067
8069
|
|
|
8068
|
-
function ChooseAmount$
|
|
8070
|
+
function ChooseAmount$4(_ref) {
|
|
8069
8071
|
var _poolInfo$extra;
|
|
8070
8072
|
let {
|
|
8071
8073
|
poolInfo,
|
|
@@ -8179,7 +8181,7 @@ function ConfirmTransfer() {
|
|
|
8179
8181
|
});
|
|
8180
8182
|
}
|
|
8181
8183
|
|
|
8182
|
-
function ApproveAllowance
|
|
8184
|
+
function ApproveAllowance(_ref) {
|
|
8183
8185
|
let {
|
|
8184
8186
|
poolInfo
|
|
8185
8187
|
} = _ref;
|
|
@@ -8251,7 +8253,7 @@ function Permit(_ref) {
|
|
|
8251
8253
|
});
|
|
8252
8254
|
}
|
|
8253
8255
|
|
|
8254
|
-
function Transfer$
|
|
8256
|
+
function Transfer$5(_ref) {
|
|
8255
8257
|
let {
|
|
8256
8258
|
poolInfo
|
|
8257
8259
|
} = _ref;
|
|
@@ -8330,17 +8332,17 @@ function StreamFactoringBorrow(_ref) {
|
|
|
8330
8332
|
poolInfo: poolInfo,
|
|
8331
8333
|
payerAddress: payerAddress,
|
|
8332
8334
|
superToken: superToken
|
|
8333
|
-
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$
|
|
8335
|
+
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$4, {
|
|
8334
8336
|
poolInfo: poolInfo,
|
|
8335
8337
|
currentFlowRate: currentFlowRate
|
|
8336
|
-
}), step === WIDGET_STEP.ConfirmTransfer && jsx(ConfirmTransfer, {}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance
|
|
8338
|
+
}), step === WIDGET_STEP.ConfirmTransfer && jsx(ConfirmTransfer, {}), step === WIDGET_STEP.ApproveAllowance && jsx(ApproveAllowance, {
|
|
8337
8339
|
poolInfo: poolInfo
|
|
8338
8340
|
}), step === WIDGET_STEP.Permit && account && jsx(Permit, {
|
|
8339
8341
|
poolInfo: poolInfo,
|
|
8340
8342
|
payerAddress: payerAddress,
|
|
8341
8343
|
borrower: account,
|
|
8342
8344
|
superToken: superToken
|
|
8343
|
-
}), step === WIDGET_STEP.Transfer && jsx(Transfer$
|
|
8345
|
+
}), step === WIDGET_STEP.Transfer && jsx(Transfer$5, {
|
|
8344
8346
|
poolInfo: poolInfo
|
|
8345
8347
|
}), step === WIDGET_STEP.Done && jsx(Success$1, {
|
|
8346
8348
|
handleAction: handleClose
|
|
@@ -9358,7 +9360,7 @@ function ChooseTranche$2(_ref) {
|
|
|
9358
9360
|
});
|
|
9359
9361
|
}
|
|
9360
9362
|
|
|
9361
|
-
function ChooseAmount$
|
|
9363
|
+
function ChooseAmount$3(_ref) {
|
|
9362
9364
|
let {
|
|
9363
9365
|
poolInfo,
|
|
9364
9366
|
poolState,
|
|
@@ -9509,7 +9511,7 @@ function SolanaTxSendModal(_ref) {
|
|
|
9509
9511
|
});
|
|
9510
9512
|
}
|
|
9511
9513
|
|
|
9512
|
-
function Transfer$
|
|
9514
|
+
function Transfer$4(_ref) {
|
|
9513
9515
|
let {
|
|
9514
9516
|
poolInfo,
|
|
9515
9517
|
selectedTranche
|
|
@@ -9750,13 +9752,13 @@ function SolanaLendSupply(_ref) {
|
|
|
9750
9752
|
poolUnderlyingToken: poolInfo.underlyingMint,
|
|
9751
9753
|
selectedTranche: selectedTranche,
|
|
9752
9754
|
changeTranche: setSelectedTranche
|
|
9753
|
-
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$
|
|
9755
|
+
}), step === WIDGET_STEP.ChooseAmount && jsx(ChooseAmount$3, {
|
|
9754
9756
|
poolInfo: poolInfo,
|
|
9755
9757
|
poolState: poolState,
|
|
9756
9758
|
tokenAccount: tokenAccount,
|
|
9757
9759
|
selectedTranche: selectedTranche,
|
|
9758
9760
|
isUniTranche: isUniTranche
|
|
9759
|
-
}), step === WIDGET_STEP.Transfer && selectedTranche && jsx(Transfer$
|
|
9761
|
+
}), step === WIDGET_STEP.Transfer && selectedTranche && jsx(Transfer$4, {
|
|
9760
9762
|
poolInfo: poolInfo,
|
|
9761
9763
|
selectedTranche: selectedTranche
|
|
9762
9764
|
}), step === WIDGET_STEP.Done && jsx(Success, {
|
|
@@ -9772,7 +9774,7 @@ function SolanaLendSupply(_ref) {
|
|
|
9772
9774
|
});
|
|
9773
9775
|
}
|
|
9774
9776
|
|
|
9775
|
-
function ChooseAmount$
|
|
9777
|
+
function ChooseAmount$2(_ref) {
|
|
9776
9778
|
let {
|
|
9777
9779
|
poolInfo,
|
|
9778
9780
|
poolState,
|
|
@@ -9920,7 +9922,7 @@ function ChooseTranche$1(_ref) {
|
|
|
9920
9922
|
});
|
|
9921
9923
|
}
|
|
9922
9924
|
|
|
9923
|
-
function Done$
|
|
9925
|
+
function Done$3(_ref) {
|
|
9924
9926
|
let {
|
|
9925
9927
|
poolInfo,
|
|
9926
9928
|
handleAction
|
|
@@ -9939,7 +9941,7 @@ function Done$1(_ref) {
|
|
|
9939
9941
|
});
|
|
9940
9942
|
}
|
|
9941
9943
|
|
|
9942
|
-
function Transfer$
|
|
9944
|
+
function Transfer$3(_ref) {
|
|
9943
9945
|
let {
|
|
9944
9946
|
poolInfo,
|
|
9945
9947
|
selectedTranche
|
|
@@ -10062,15 +10064,15 @@ function SolanaLendAddRedemption(_ref) {
|
|
|
10062
10064
|
children: [step === WIDGET_STEP.ChooseTranche && jsx(ChooseTranche$1, {
|
|
10063
10065
|
selectedTranche: selectedTranche,
|
|
10064
10066
|
changeTranche: setSelectedTranche
|
|
10065
|
-
}), step === WIDGET_STEP.ChooseAmount && selectedTranche && jsx(ChooseAmount$
|
|
10067
|
+
}), step === WIDGET_STEP.ChooseAmount && selectedTranche && jsx(ChooseAmount$2, {
|
|
10066
10068
|
poolInfo: poolInfo,
|
|
10067
10069
|
poolState: poolState,
|
|
10068
10070
|
lenderState: selectedTranche === 'senior' ? seniorLenderStateAccount : juniorLenderStateAccount,
|
|
10069
10071
|
selectedTranche: selectedTranche
|
|
10070
|
-
}), step === WIDGET_STEP.Transfer && selectedTranche && jsx(Transfer$
|
|
10072
|
+
}), step === WIDGET_STEP.Transfer && selectedTranche && jsx(Transfer$3, {
|
|
10071
10073
|
poolInfo: poolInfo,
|
|
10072
10074
|
selectedTranche: selectedTranche
|
|
10073
|
-
}), step === WIDGET_STEP.Done && jsx(Done$
|
|
10075
|
+
}), step === WIDGET_STEP.Done && jsx(Done$3, {
|
|
10074
10076
|
poolInfo: poolInfo,
|
|
10075
10077
|
handleAction: handleClose
|
|
10076
10078
|
}), step === WIDGET_STEP.Error && jsx(ErrorModal, {
|
|
@@ -10082,7 +10084,7 @@ function SolanaLendAddRedemption(_ref) {
|
|
|
10082
10084
|
});
|
|
10083
10085
|
}
|
|
10084
10086
|
|
|
10085
|
-
function Transfer(_ref) {
|
|
10087
|
+
function Transfer$2(_ref) {
|
|
10086
10088
|
let {
|
|
10087
10089
|
poolInfo,
|
|
10088
10090
|
lenderState,
|
|
@@ -10188,7 +10190,7 @@ function ChooseTranche(_ref) {
|
|
|
10188
10190
|
});
|
|
10189
10191
|
}
|
|
10190
10192
|
|
|
10191
|
-
function Done(_ref) {
|
|
10193
|
+
function Done$2(_ref) {
|
|
10192
10194
|
let {
|
|
10193
10195
|
poolInfo,
|
|
10194
10196
|
lenderState,
|
|
@@ -10269,12 +10271,12 @@ function SolanaLendCancelRedemption(_ref) {
|
|
|
10269
10271
|
children: [step === WIDGET_STEP.ChooseTranche && jsx(ChooseTranche, {
|
|
10270
10272
|
selectedTranche: selectedTranche,
|
|
10271
10273
|
changeTranche: setSelectedTranche
|
|
10272
|
-
}), step === WIDGET_STEP.Transfer && selectedTranche && jsx(Transfer, {
|
|
10274
|
+
}), step === WIDGET_STEP.Transfer && selectedTranche && jsx(Transfer$2, {
|
|
10273
10275
|
poolInfo: poolInfo,
|
|
10274
10276
|
lenderState: selectedTranche === 'senior' ? seniorLenderStateAccount : juniorLenderStateAccount,
|
|
10275
10277
|
lenderStatePDA: selectedTranche === 'senior' ? seniorLenderStateAccountPDA : juniorLenderStateAccountPDA,
|
|
10276
10278
|
selectedTranche: selectedTranche
|
|
10277
|
-
}), step === WIDGET_STEP.Done && selectedTranche && jsx(Done, {
|
|
10279
|
+
}), step === WIDGET_STEP.Done && selectedTranche && jsx(Done$2, {
|
|
10278
10280
|
poolInfo: poolInfo,
|
|
10279
10281
|
lenderState: selectedTranche === 'senior' ? seniorLenderStateAccount : juniorLenderStateAccount,
|
|
10280
10282
|
selectedTranche: selectedTranche,
|
|
@@ -10288,37 +10290,30 @@ function SolanaLendCancelRedemption(_ref) {
|
|
|
10288
10290
|
});
|
|
10289
10291
|
}
|
|
10290
10292
|
|
|
10291
|
-
function ChooseAmount(_ref) {
|
|
10293
|
+
function ChooseAmount$1(_ref) {
|
|
10292
10294
|
let {
|
|
10293
10295
|
poolInfo,
|
|
10294
|
-
creditConfigAccount
|
|
10295
|
-
tokenAccount
|
|
10296
|
+
creditConfigAccount
|
|
10296
10297
|
} = _ref;
|
|
10297
10298
|
const dispatch = useAppDispatch();
|
|
10298
10299
|
const {
|
|
10299
10300
|
symbol,
|
|
10300
10301
|
decimals
|
|
10301
10302
|
} = poolInfo.underlyingMint;
|
|
10302
|
-
const sentinel = useMemo(() => getSentinelAddress(poolInfo.chainId), [poolInfo.chainId]);
|
|
10303
10303
|
const [currentAmount, setCurrentAmount] = useState(0);
|
|
10304
10304
|
const creditAvailable = useMemo(() => SolanaTokenUtils.formatUnits(creditConfigAccount.creditAvailable, decimals), [creditConfigAccount.creditAvailable, decimals]);
|
|
10305
10305
|
const handleChangeAmount = newAmount => {
|
|
10306
10306
|
setCurrentAmount(newAmount);
|
|
10307
10307
|
};
|
|
10308
10308
|
const handleAction = useCallback(() => {
|
|
10309
|
-
var _tokenAccount$delegat;
|
|
10310
|
-
if (!tokenAccount) {
|
|
10311
|
-
return;
|
|
10312
|
-
}
|
|
10313
10309
|
const borrowAmountBN = SolanaTokenUtils.parseUnits(String(currentAmount), decimals);
|
|
10314
|
-
const nextStep = borrowAmountBN.gt(new BN(tokenAccount.delegatedAmount.toString())) || ((_tokenAccount$delegat = tokenAccount.delegate) === null || _tokenAccount$delegat === void 0 ? void 0 : _tokenAccount$delegat.toString()) !== sentinel ? WIDGET_STEP.ApproveAllowance : WIDGET_STEP.Transfer;
|
|
10315
10310
|
dispatch(setBorrowInfo({
|
|
10316
10311
|
borrowAmount: currentAmount,
|
|
10317
10312
|
borrowAmountBN: JSON.parse(borrowAmountBN.toString()),
|
|
10318
10313
|
chargedFees: 0,
|
|
10319
|
-
nextStep
|
|
10314
|
+
nextStep: WIDGET_STEP.Transfer
|
|
10320
10315
|
}));
|
|
10321
|
-
}, [currentAmount, decimals, dispatch
|
|
10316
|
+
}, [currentAmount, decimals, dispatch]);
|
|
10322
10317
|
return jsx(InputAmountModal, {
|
|
10323
10318
|
title: "Borrow",
|
|
10324
10319
|
subTitle: "Choose Amount",
|
|
@@ -10332,46 +10327,90 @@ function ChooseAmount(_ref) {
|
|
|
10332
10327
|
});
|
|
10333
10328
|
}
|
|
10334
10329
|
|
|
10335
|
-
function
|
|
10330
|
+
function Transfer$1(_ref) {
|
|
10336
10331
|
let {
|
|
10337
|
-
poolInfo
|
|
10338
|
-
tokenAccount
|
|
10332
|
+
poolInfo
|
|
10339
10333
|
} = _ref;
|
|
10340
10334
|
const dispatch = useAppDispatch();
|
|
10341
10335
|
const {
|
|
10342
10336
|
wallet,
|
|
10343
|
-
publicKey
|
|
10344
|
-
sendTransaction,
|
|
10345
|
-
signTransaction
|
|
10337
|
+
publicKey
|
|
10346
10338
|
} = useWallet();
|
|
10347
|
-
const sentinel =
|
|
10339
|
+
const sentinel = getSentinelAddress(poolInfo.chainId);
|
|
10348
10340
|
const {
|
|
10349
10341
|
connection
|
|
10350
10342
|
} = useConnection();
|
|
10351
10343
|
const [transaction, setTransaction] = useState();
|
|
10344
|
+
const program = useHumaProgram(poolInfo.chainId);
|
|
10345
|
+
const {
|
|
10346
|
+
borrowAmountBN: borrowAmountBNJson
|
|
10347
|
+
} = useAppSelector(selectWidgetState);
|
|
10352
10348
|
const handleSuccess = useCallback(() => {
|
|
10353
|
-
dispatch(setStep(WIDGET_STEP.
|
|
10349
|
+
dispatch(setStep(WIDGET_STEP.Done));
|
|
10354
10350
|
}, [dispatch]);
|
|
10355
10351
|
useEffect(() => {
|
|
10356
10352
|
async function getTx() {
|
|
10357
|
-
|
|
10353
|
+
var _borrowAmountBNJson$t, _tokenAccount$delegat;
|
|
10354
|
+
if (!wallet || !publicKey || !connection) {
|
|
10358
10355
|
return;
|
|
10359
10356
|
}
|
|
10360
|
-
const
|
|
10361
|
-
|
|
10362
|
-
publicKey
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
//
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10357
|
+
const {
|
|
10358
|
+
underlyingTokenATA
|
|
10359
|
+
} = getTokenAccounts(poolInfo, publicKey);
|
|
10360
|
+
const tx = new Transaction();
|
|
10361
|
+
|
|
10362
|
+
// Create user token account if it doesn't exist
|
|
10363
|
+
let tokenAccount;
|
|
10364
|
+
try {
|
|
10365
|
+
tokenAccount = await getAccount(connection, underlyingTokenATA, undefined, TOKEN_2022_PROGRAM_ID);
|
|
10366
|
+
} catch (error) {
|
|
10367
|
+
// TokenAccountNotFoundError can be possible if the associated address has already received some lamports,
|
|
10368
|
+
// becoming a system account. Assuming program derived addressing is safe, this is the only case for the
|
|
10369
|
+
// TokenInvalidAccountOwnerError in this code path.
|
|
10370
|
+
if (error instanceof TokenAccountNotFoundError || error instanceof TokenInvalidAccountOwnerError) {
|
|
10371
|
+
// As this isn't atomic, it's possible others can create associated accounts meanwhile.
|
|
10372
|
+
tx.add(createAssociatedTokenAccountInstruction(publicKey, underlyingTokenATA, publicKey, new PublicKey(poolInfo.underlyingMint.address), TOKEN_2022_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID));
|
|
10373
|
+
}
|
|
10374
|
+
}
|
|
10375
|
+
|
|
10376
|
+
// Approve allowance to the sentinel if the account is new or delegated amount is not enough
|
|
10377
|
+
const borrowAmountBN = new BN((_borrowAmountBNJson$t = borrowAmountBNJson === null || borrowAmountBNJson === void 0 ? void 0 : borrowAmountBNJson.toString()) !== null && _borrowAmountBNJson$t !== void 0 ? _borrowAmountBNJson$t : '0');
|
|
10378
|
+
if (!tokenAccount || borrowAmountBN.gt(new BN(tokenAccount.delegatedAmount.toString())) || ((_tokenAccount$delegat = tokenAccount.delegate) === null || _tokenAccount$delegat === void 0 ? void 0 : _tokenAccount$delegat.toString()) !== sentinel) {
|
|
10379
|
+
tx.add(createApproveCheckedInstruction(underlyingTokenATA, new PublicKey(poolInfo.underlyingMint.address), new PublicKey(sentinel),
|
|
10380
|
+
// delegate
|
|
10381
|
+
publicKey,
|
|
10382
|
+
// owner of the wallet
|
|
10383
|
+
BigInt(SolanaTokenUtils.parseUnits('100000000000',
|
|
10384
|
+
// 100 billion
|
|
10385
|
+
poolInfo.underlyingMint.decimals).toString()),
|
|
10386
|
+
// amount
|
|
10387
|
+
poolInfo.underlyingMint.decimals, undefined,
|
|
10388
|
+
// multiSigners
|
|
10389
|
+
TOKEN_2022_PROGRAM_ID));
|
|
10390
|
+
}
|
|
10391
|
+
const {
|
|
10392
|
+
creditConfigAccount,
|
|
10393
|
+
creditStateAccount
|
|
10394
|
+
} = getCreditAccounts(poolInfo, publicKey);
|
|
10395
|
+
// borrowAmountBNJson is stored as a raw number string in this flow
|
|
10396
|
+
const programTx = await program.methods.drawdown(borrowAmountBN).accountsPartial({
|
|
10397
|
+
borrower: publicKey,
|
|
10398
|
+
humaConfig: poolInfo.humaConfig,
|
|
10399
|
+
poolConfig: poolInfo.poolConfig,
|
|
10400
|
+
poolState: poolInfo.poolState,
|
|
10401
|
+
creditConfig: creditConfigAccount,
|
|
10402
|
+
creditState: creditStateAccount,
|
|
10403
|
+
poolAuthority: poolInfo.poolAuthority,
|
|
10404
|
+
underlyingMint: poolInfo.underlyingMint.address,
|
|
10405
|
+
poolUnderlyingToken: poolInfo.poolUnderlyingTokenAccount,
|
|
10406
|
+
borrowerUnderlyingToken: underlyingTokenATA,
|
|
10407
|
+
tokenProgram: TOKEN_2022_PROGRAM_ID
|
|
10408
|
+
}).transaction();
|
|
10409
|
+
tx.add(programTx);
|
|
10371
10410
|
setTransaction(tx);
|
|
10372
10411
|
}
|
|
10373
10412
|
getTx();
|
|
10374
|
-
}, [connection, dispatch, poolInfo.underlyingMint.address, poolInfo.underlyingMint.decimals,
|
|
10413
|
+
}, [borrowAmountBNJson, connection, dispatch, poolInfo, poolInfo.underlyingMint.address, poolInfo.underlyingMint.decimals, program.methods, publicKey, sentinel, wallet]);
|
|
10375
10414
|
return jsx(SolanaTxSendModal, {
|
|
10376
10415
|
tx: transaction,
|
|
10377
10416
|
chainId: poolInfo.chainId,
|
|
@@ -10379,9 +10418,34 @@ function ApproveAllowance(_ref) {
|
|
|
10379
10418
|
});
|
|
10380
10419
|
}
|
|
10381
10420
|
|
|
10421
|
+
function Done$1(_ref) {
|
|
10422
|
+
let {
|
|
10423
|
+
poolInfo,
|
|
10424
|
+
poolState,
|
|
10425
|
+
handleAction
|
|
10426
|
+
} = _ref;
|
|
10427
|
+
const {
|
|
10428
|
+
borrowAmount,
|
|
10429
|
+
solanaSignature
|
|
10430
|
+
} = useAppSelector(selectWidgetState);
|
|
10431
|
+
const {
|
|
10432
|
+
symbol
|
|
10433
|
+
} = poolInfo.underlyingMint;
|
|
10434
|
+
const dueDate = timeUtil.timestampToLL(poolState.epochEndTime);
|
|
10435
|
+
const content = ["".concat(formatNumber(borrowAmount), " ").concat(symbol, " is now in your wallet."), "Note: your first automatic payment will occur after ".concat(dueDate, ".")];
|
|
10436
|
+
return jsx(SolanaTxDoneModal, {
|
|
10437
|
+
handleAction: handleAction,
|
|
10438
|
+
content: content,
|
|
10439
|
+
chainId: poolInfo.chainId,
|
|
10440
|
+
solanaSignature: solanaSignature,
|
|
10441
|
+
buttonText: "DONE"
|
|
10442
|
+
});
|
|
10443
|
+
}
|
|
10444
|
+
|
|
10382
10445
|
function SolanaBorrow(_ref) {
|
|
10383
10446
|
let {
|
|
10384
10447
|
poolInfo,
|
|
10448
|
+
poolState,
|
|
10385
10449
|
handleClose,
|
|
10386
10450
|
handleSuccess
|
|
10387
10451
|
} = _ref;
|
|
@@ -10391,9 +10455,207 @@ function SolanaBorrow(_ref) {
|
|
|
10391
10455
|
loading: isLoadingBorrowerAccounts
|
|
10392
10456
|
} = useBorrowerAccounts(poolInfo.chainId, poolInfo.poolName);
|
|
10393
10457
|
const {
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
} =
|
|
10458
|
+
step,
|
|
10459
|
+
errorMessage
|
|
10460
|
+
} = useAppSelector(selectWidgetState);
|
|
10461
|
+
useEffect(() => {
|
|
10462
|
+
if (!step) {
|
|
10463
|
+
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
10464
|
+
}
|
|
10465
|
+
}, [dispatch, step]);
|
|
10466
|
+
const title = 'Borrow';
|
|
10467
|
+
if (isLoadingBorrowerAccounts) {
|
|
10468
|
+
return jsx(WidgetWrapper, {
|
|
10469
|
+
isOpen: true,
|
|
10470
|
+
isLoading: true,
|
|
10471
|
+
loadingTitle: title,
|
|
10472
|
+
handleClose: handleClose,
|
|
10473
|
+
handleSuccess: handleSuccess
|
|
10474
|
+
});
|
|
10475
|
+
}
|
|
10476
|
+
return jsxs(WidgetWrapper, {
|
|
10477
|
+
isOpen: true,
|
|
10478
|
+
loadingTitle: title,
|
|
10479
|
+
handleClose: handleClose,
|
|
10480
|
+
handleSuccess: handleSuccess,
|
|
10481
|
+
children: [step === WIDGET_STEP.ChooseAmount && creditConfigAccount && jsx(ChooseAmount$1, {
|
|
10482
|
+
poolInfo: poolInfo,
|
|
10483
|
+
creditConfigAccount: creditConfigAccount
|
|
10484
|
+
}), step === WIDGET_STEP.Transfer && jsx(Transfer$1, {
|
|
10485
|
+
poolInfo: poolInfo
|
|
10486
|
+
}), step === WIDGET_STEP.Done && jsx(Done$1, {
|
|
10487
|
+
poolInfo: poolInfo,
|
|
10488
|
+
poolState: poolState,
|
|
10489
|
+
handleAction: handleClose
|
|
10490
|
+
}), step === WIDGET_STEP.Error && jsx(ErrorModal, {
|
|
10491
|
+
title: title,
|
|
10492
|
+
errorReason: "Sorry there was an error",
|
|
10493
|
+
errorMessage: errorMessage,
|
|
10494
|
+
handleOk: handleClose
|
|
10495
|
+
})]
|
|
10496
|
+
});
|
|
10497
|
+
}
|
|
10498
|
+
|
|
10499
|
+
function ChooseAmount(_ref) {
|
|
10500
|
+
let {
|
|
10501
|
+
poolInfo,
|
|
10502
|
+
creditStateAccount
|
|
10503
|
+
} = _ref;
|
|
10504
|
+
const dispatch = useAppDispatch();
|
|
10505
|
+
const {
|
|
10506
|
+
symbol,
|
|
10507
|
+
decimals
|
|
10508
|
+
} = poolInfo.underlyingMint;
|
|
10509
|
+
const [currentAmount, setCurrentAmount] = useState(0);
|
|
10510
|
+
const totalDueAmount = useMemo(() => Number(SolanaTokenUtils.formatUnits(creditStateAccount.creditRecord.totalDueAmount, decimals)), [creditStateAccount.creditRecord.totalDueAmount, decimals]);
|
|
10511
|
+
const payoffAmount = useMemo(() => Number(SolanaTokenUtils.formatUnits(creditStateAccount.creditRecord.payoffAmount, decimals)), [creditStateAccount.creditRecord.payoffAmount, decimals]);
|
|
10512
|
+
useEffect(() => {
|
|
10513
|
+
setCurrentAmount(totalDueAmount);
|
|
10514
|
+
dispatch(setPaymentAmount({
|
|
10515
|
+
paymentAmount: totalDueAmount
|
|
10516
|
+
}));
|
|
10517
|
+
}, [dispatch, totalDueAmount]);
|
|
10518
|
+
const handleChangeAmount = newAmount => {
|
|
10519
|
+
setCurrentAmount(newAmount);
|
|
10520
|
+
dispatch(setPaymentAmount({
|
|
10521
|
+
paymentAmount: newAmount
|
|
10522
|
+
}));
|
|
10523
|
+
};
|
|
10524
|
+
const handleAction = useCallback(() => {
|
|
10525
|
+
dispatch(setStep(WIDGET_STEP.Transfer));
|
|
10526
|
+
}, [dispatch]);
|
|
10527
|
+
return jsx(InputAmountModal, {
|
|
10528
|
+
title: "Make Payment",
|
|
10529
|
+
subTitle: "Choose Amount",
|
|
10530
|
+
tokenSymbol: symbol,
|
|
10531
|
+
currentAmount: currentAmount,
|
|
10532
|
+
handleChangeAmount: handleChangeAmount,
|
|
10533
|
+
maxAmount: payoffAmount,
|
|
10534
|
+
maxAmountText: "Pay Off",
|
|
10535
|
+
infos: ["".concat(formatNumber(totalDueAmount.toFixed(0)), " Due")],
|
|
10536
|
+
handleAction: handleAction,
|
|
10537
|
+
actionText: "PAY"
|
|
10538
|
+
});
|
|
10539
|
+
}
|
|
10540
|
+
|
|
10541
|
+
function Transfer(_ref) {
|
|
10542
|
+
let {
|
|
10543
|
+
poolInfo
|
|
10544
|
+
} = _ref;
|
|
10545
|
+
const dispatch = useAppDispatch();
|
|
10546
|
+
const {
|
|
10547
|
+
wallet,
|
|
10548
|
+
publicKey
|
|
10549
|
+
} = useWallet();
|
|
10550
|
+
const {
|
|
10551
|
+
connection
|
|
10552
|
+
} = useConnection();
|
|
10553
|
+
const [transaction, setTransaction] = useState();
|
|
10554
|
+
const program = useHumaProgram(poolInfo.chainId);
|
|
10555
|
+
const {
|
|
10556
|
+
paymentAmount
|
|
10557
|
+
} = useAppSelector(selectWidgetState);
|
|
10558
|
+
const {
|
|
10559
|
+
decimals
|
|
10560
|
+
} = poolInfo.underlyingMint;
|
|
10561
|
+
const handleSuccess = useCallback(() => {
|
|
10562
|
+
dispatch(setStep(WIDGET_STEP.Done));
|
|
10563
|
+
}, [dispatch]);
|
|
10564
|
+
useEffect(() => {
|
|
10565
|
+
async function getTx() {
|
|
10566
|
+
if (!wallet || !publicKey || !connection || !paymentAmount) {
|
|
10567
|
+
return;
|
|
10568
|
+
}
|
|
10569
|
+
const {
|
|
10570
|
+
underlyingTokenATA
|
|
10571
|
+
} = getTokenAccounts(poolInfo, publicKey);
|
|
10572
|
+
const {
|
|
10573
|
+
creditConfigAccount,
|
|
10574
|
+
creditStateAccount
|
|
10575
|
+
} = getCreditAccounts(poolInfo, publicKey);
|
|
10576
|
+
const paymentAmountBN = SolanaTokenUtils.parseUnits(paymentAmount.toString(), decimals);
|
|
10577
|
+
const tx = await program.methods.makePayment(paymentAmountBN).accountsPartial({
|
|
10578
|
+
signer: publicKey,
|
|
10579
|
+
humaConfig: poolInfo.humaConfig,
|
|
10580
|
+
poolConfig: poolInfo.poolConfig,
|
|
10581
|
+
poolState: poolInfo.poolState,
|
|
10582
|
+
creditConfig: creditConfigAccount,
|
|
10583
|
+
creditState: creditStateAccount,
|
|
10584
|
+
poolAuthority: poolInfo.poolAuthority,
|
|
10585
|
+
underlyingMint: poolInfo.underlyingMint.address,
|
|
10586
|
+
poolUnderlyingToken: poolInfo.poolUnderlyingTokenAccount,
|
|
10587
|
+
borrowerUnderlyingToken: underlyingTokenATA,
|
|
10588
|
+
tokenProgram: TOKEN_2022_PROGRAM_ID
|
|
10589
|
+
}).transaction();
|
|
10590
|
+
setTransaction(tx);
|
|
10591
|
+
}
|
|
10592
|
+
getTx();
|
|
10593
|
+
}, [connection, decimals, dispatch, paymentAmount, poolInfo, poolInfo.underlyingMint.address, poolInfo.underlyingMint.decimals, program.methods, publicKey, wallet]);
|
|
10594
|
+
return jsx(SolanaTxSendModal, {
|
|
10595
|
+
tx: transaction,
|
|
10596
|
+
chainId: poolInfo.chainId,
|
|
10597
|
+
handleSuccess: handleSuccess
|
|
10598
|
+
});
|
|
10599
|
+
}
|
|
10600
|
+
|
|
10601
|
+
function Done(_ref) {
|
|
10602
|
+
let {
|
|
10603
|
+
poolInfo,
|
|
10604
|
+
handleAction
|
|
10605
|
+
} = _ref;
|
|
10606
|
+
const {
|
|
10607
|
+
solanaSignature
|
|
10608
|
+
} = useAppSelector(selectWidgetState);
|
|
10609
|
+
const {
|
|
10610
|
+
symbol
|
|
10611
|
+
} = poolInfo.underlyingMint;
|
|
10612
|
+
const {
|
|
10613
|
+
connection
|
|
10614
|
+
} = useConnection();
|
|
10615
|
+
const [tokensPaid, setTokensPaid] = useState(null);
|
|
10616
|
+
useEffect(() => {
|
|
10617
|
+
const fetchTokensPaid = async () => {
|
|
10618
|
+
var _txData$meta, _txData$meta2;
|
|
10619
|
+
if (!solanaSignature) {
|
|
10620
|
+
return;
|
|
10621
|
+
}
|
|
10622
|
+
const txData = await connection.getTransaction(solanaSignature, {
|
|
10623
|
+
maxSupportedTransactionVersion: 2
|
|
10624
|
+
});
|
|
10625
|
+
const preTokenBalance = txData === null || txData === void 0 || (_txData$meta = txData.meta) === null || _txData$meta === void 0 || (_txData$meta = _txData$meta.preTokenBalances) === null || _txData$meta === void 0 || (_txData$meta = _txData$meta[1]) === null || _txData$meta === void 0 || (_txData$meta = _txData$meta.uiTokenAmount) === null || _txData$meta === void 0 ? void 0 : _txData$meta.uiAmount;
|
|
10626
|
+
const postTokenBalance = txData === null || txData === void 0 || (_txData$meta2 = txData.meta) === null || _txData$meta2 === void 0 || (_txData$meta2 = _txData$meta2.postTokenBalances) === null || _txData$meta2 === void 0 || (_txData$meta2 = _txData$meta2[1]) === null || _txData$meta2 === void 0 || (_txData$meta2 = _txData$meta2.uiTokenAmount) === null || _txData$meta2 === void 0 ? void 0 : _txData$meta2.uiAmount;
|
|
10627
|
+
if (preTokenBalance && postTokenBalance) {
|
|
10628
|
+
setTokensPaid(preTokenBalance - postTokenBalance);
|
|
10629
|
+
}
|
|
10630
|
+
};
|
|
10631
|
+
fetchTokensPaid();
|
|
10632
|
+
}, [connection, solanaSignature]);
|
|
10633
|
+
const content = useMemo(() => {
|
|
10634
|
+
if (tokensPaid !== null) {
|
|
10635
|
+
return ["You successfully paid ".concat(formatNumber(tokensPaid), " ").concat(symbol, ".")];
|
|
10636
|
+
}
|
|
10637
|
+
return ['Your payment to the pool was successful'];
|
|
10638
|
+
}, [tokensPaid, symbol]);
|
|
10639
|
+
return jsx(SolanaTxDoneModal, {
|
|
10640
|
+
handleAction: handleAction,
|
|
10641
|
+
content: content,
|
|
10642
|
+
chainId: poolInfo.chainId,
|
|
10643
|
+
solanaSignature: solanaSignature,
|
|
10644
|
+
buttonText: "DONE"
|
|
10645
|
+
});
|
|
10646
|
+
}
|
|
10647
|
+
|
|
10648
|
+
function SolanaPayment(_ref) {
|
|
10649
|
+
let {
|
|
10650
|
+
poolInfo,
|
|
10651
|
+
handleClose,
|
|
10652
|
+
handleSuccess
|
|
10653
|
+
} = _ref;
|
|
10654
|
+
const dispatch = useDispatch();
|
|
10655
|
+
const {
|
|
10656
|
+
creditStateAccount,
|
|
10657
|
+
loading: isLoadingBorrowerAccounts
|
|
10658
|
+
} = useBorrowerAccounts(poolInfo.chainId, poolInfo.poolName);
|
|
10397
10659
|
const {
|
|
10398
10660
|
step,
|
|
10399
10661
|
errorMessage
|
|
@@ -10403,8 +10665,8 @@ function SolanaBorrow(_ref) {
|
|
|
10403
10665
|
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
10404
10666
|
}
|
|
10405
10667
|
}, [dispatch, step]);
|
|
10406
|
-
const title = '
|
|
10407
|
-
if (isLoadingBorrowerAccounts
|
|
10668
|
+
const title = 'Make Payment';
|
|
10669
|
+
if (isLoadingBorrowerAccounts) {
|
|
10408
10670
|
return jsx(WidgetWrapper, {
|
|
10409
10671
|
isOpen: true,
|
|
10410
10672
|
isLoading: true,
|
|
@@ -10418,13 +10680,14 @@ function SolanaBorrow(_ref) {
|
|
|
10418
10680
|
loadingTitle: title,
|
|
10419
10681
|
handleClose: handleClose,
|
|
10420
10682
|
handleSuccess: handleSuccess,
|
|
10421
|
-
children: [step === WIDGET_STEP.ChooseAmount &&
|
|
10683
|
+
children: [step === WIDGET_STEP.ChooseAmount && creditStateAccount && jsx(ChooseAmount, {
|
|
10422
10684
|
poolInfo: poolInfo,
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10685
|
+
creditStateAccount: creditStateAccount
|
|
10686
|
+
}), step === WIDGET_STEP.Transfer && jsx(Transfer, {
|
|
10687
|
+
poolInfo: poolInfo
|
|
10688
|
+
}), step === WIDGET_STEP.Done && jsx(Done, {
|
|
10426
10689
|
poolInfo: poolInfo,
|
|
10427
|
-
|
|
10690
|
+
handleAction: handleClose
|
|
10428
10691
|
}), step === WIDGET_STEP.Error && jsx(ErrorModal, {
|
|
10429
10692
|
title: title,
|
|
10430
10693
|
errorReason: "Sorry there was an error",
|
|
@@ -10875,8 +11138,6 @@ function SolanaWidget(props) {
|
|
|
10875
11138
|
/**
|
|
10876
11139
|
* Lend pool supply widget props for Solana pools
|
|
10877
11140
|
* @typedef {Object} SolanaLendSupplyWidgetProps
|
|
10878
|
-
* @property {SolanaLendSupplyProps} SolanaLendSupplyProps - Specific widget props
|
|
10879
|
-
* @property {SolanaWidgetProps} SolanaWidgetProps - Widget general props.
|
|
10880
11141
|
*/
|
|
10881
11142
|
|
|
10882
11143
|
/**
|
|
@@ -10896,8 +11157,6 @@ function SolanaLendSupplyWidget(props) {
|
|
|
10896
11157
|
/**
|
|
10897
11158
|
* Lend pool supply widget props for Solana pools
|
|
10898
11159
|
* @typedef {Object} SolanaLendAddRedemptionWidgetProps
|
|
10899
|
-
* @property {SolanaLendSupplyProps} SolanaLendSupplyProps - Specific widget props
|
|
10900
|
-
* @property {SolanaWidgetProps} SolanaWidgetProps - Widget general props.
|
|
10901
11160
|
*/
|
|
10902
11161
|
|
|
10903
11162
|
/**
|
|
@@ -10917,8 +11176,6 @@ function SolanaLendAddRedemptionWidget(props) {
|
|
|
10917
11176
|
/**
|
|
10918
11177
|
* Lend pool supply widget props for Solana pools
|
|
10919
11178
|
* @typedef {Object} SolanaLendCancelRedemptionWidgetProps
|
|
10920
|
-
* @property {SolanaLendSupplyProps} SolanaLendSupplyProps - Specific widget props
|
|
10921
|
-
* @property {SolanaWidgetProps} SolanaWidgetProps - Widget general props.
|
|
10922
11179
|
*/
|
|
10923
11180
|
|
|
10924
11181
|
/**
|
|
@@ -10938,8 +11195,6 @@ function SolanaLendCancelRedemptionWidget(props) {
|
|
|
10938
11195
|
/**
|
|
10939
11196
|
* Lend pool supply widget props for Solana pools
|
|
10940
11197
|
* @typedef {Object} SolanaBorrowWidgetProps
|
|
10941
|
-
* @property {SolanaLendSupplyProps} SolanaLendSupplyProps - Specific widget props
|
|
10942
|
-
* @property {SolanaWidgetProps} SolanaWidgetProps - Widget general props.
|
|
10943
11198
|
*/
|
|
10944
11199
|
|
|
10945
11200
|
/**
|
|
@@ -10956,5 +11211,24 @@ function SolanaBorrowWidget(props) {
|
|
|
10956
11211
|
});
|
|
10957
11212
|
}
|
|
10958
11213
|
|
|
10959
|
-
|
|
11214
|
+
/**
|
|
11215
|
+
* Lend pool supply widget props for Solana pools
|
|
11216
|
+
* @typedef {Object} SolanaPaymentWidgetProps
|
|
11217
|
+
*/
|
|
11218
|
+
|
|
11219
|
+
/**
|
|
11220
|
+
* Lend pool supply widget for Solana pools
|
|
11221
|
+
*
|
|
11222
|
+
* @param {SolanaPaymentWidgetProps} props - Widget props
|
|
11223
|
+
*/
|
|
11224
|
+
function SolanaPaymentWidget(props) {
|
|
11225
|
+
return jsx(SolanaWidget, {
|
|
11226
|
+
...props,
|
|
11227
|
+
children: jsx(SolanaPayment, {
|
|
11228
|
+
...props
|
|
11229
|
+
})
|
|
11230
|
+
});
|
|
11231
|
+
}
|
|
11232
|
+
|
|
11233
|
+
export { AddRedemptionWidgetV2, AutoPaybackWidgetV2, CancelRedemptionWidgetV2, CreditLineApproveWidget, CreditLineBorrowWidget, CreditLineBorrowWidgetV2, CreditLinePaymentWidget, CreditLinePaymentWidgetV2, InvoiceFactoringBorrowWidget, InvoiceFactoringPaymentWidget, LendSupplyWidget, LendSupplyWidgetV2, LendWithdrawWidget, LendWithdrawWidgetV2, ReceivableBackedCreditLineBorrowWidgetV2, ReceivableBackedCreditLinePaymentWidgetV2, SolanaBorrowWidget, SolanaLendAddRedemptionWidget, SolanaLendCancelRedemptionWidget, SolanaLendSupplyWidget, SolanaPaymentWidget, SuperfluidFactoringWidget, SupplyFirstLossCoverWidget };
|
|
10960
11234
|
//# sourceMappingURL=index.js.map
|