@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/cjs/index.cjs
CHANGED
|
@@ -1932,7 +1932,7 @@ function ApproveAllowanceModal(_ref) {
|
|
|
1932
1932
|
});
|
|
1933
1933
|
}
|
|
1934
1934
|
|
|
1935
|
-
function ApproveAllowance$
|
|
1935
|
+
function ApproveAllowance$c(_ref) {
|
|
1936
1936
|
let {
|
|
1937
1937
|
poolInfo,
|
|
1938
1938
|
amount
|
|
@@ -2074,7 +2074,7 @@ function CreditLineApprove(_ref) {
|
|
|
2074
2074
|
loadingTitle: "Approve Allowance",
|
|
2075
2075
|
handleClose: handleClose,
|
|
2076
2076
|
handleSuccess: handleSuccess,
|
|
2077
|
-
children: [step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$
|
|
2077
|
+
children: [step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$c, {
|
|
2078
2078
|
poolInfo: poolInfo,
|
|
2079
2079
|
amount: amount
|
|
2080
2080
|
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$f, {
|
|
@@ -2173,7 +2173,7 @@ function ApproveAllowanceModalV2(_ref) {
|
|
|
2173
2173
|
});
|
|
2174
2174
|
}
|
|
2175
2175
|
|
|
2176
|
-
function ApproveAllowance$
|
|
2176
|
+
function ApproveAllowance$b(_ref) {
|
|
2177
2177
|
let {
|
|
2178
2178
|
poolInfo,
|
|
2179
2179
|
poolUnderlyingToken
|
|
@@ -2243,7 +2243,7 @@ function AutoPaybackV2(_ref) {
|
|
|
2243
2243
|
loadingTitle: "Auto Payback",
|
|
2244
2244
|
handleClose: handleClose,
|
|
2245
2245
|
handleSuccess: handleSuccess,
|
|
2246
|
-
children: [step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$
|
|
2246
|
+
children: [step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$b, {
|
|
2247
2247
|
poolInfo: poolInfo,
|
|
2248
2248
|
poolUnderlyingToken: poolUnderlyingToken
|
|
2249
2249
|
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$e, {
|
|
@@ -2616,7 +2616,7 @@ function ChooseAmountModal(_ref) {
|
|
|
2616
2616
|
});
|
|
2617
2617
|
}
|
|
2618
2618
|
|
|
2619
|
-
function ChooseAmount$
|
|
2619
|
+
function ChooseAmount$g(_ref) {
|
|
2620
2620
|
let {
|
|
2621
2621
|
poolInfo,
|
|
2622
2622
|
accountStats
|
|
@@ -2676,7 +2676,7 @@ function ChooseAmount$f(_ref) {
|
|
|
2676
2676
|
});
|
|
2677
2677
|
}
|
|
2678
2678
|
|
|
2679
|
-
function ApproveAllowance$
|
|
2679
|
+
function ApproveAllowance$a(_ref) {
|
|
2680
2680
|
let {
|
|
2681
2681
|
poolInfo
|
|
2682
2682
|
} = _ref;
|
|
@@ -2735,7 +2735,7 @@ function TxSendModal(_ref) {
|
|
|
2735
2735
|
});
|
|
2736
2736
|
}
|
|
2737
2737
|
|
|
2738
|
-
function Transfer$
|
|
2738
|
+
function Transfer$k(_ref) {
|
|
2739
2739
|
let {
|
|
2740
2740
|
poolInfo
|
|
2741
2741
|
} = _ref;
|
|
@@ -3093,12 +3093,12 @@ function CreditLineBorrow(_ref) {
|
|
|
3093
3093
|
children: [step === WIDGET_STEP.Evaluation && jsxRuntime.jsx(Evaluation$5, {
|
|
3094
3094
|
poolInfo: poolInfo,
|
|
3095
3095
|
handleApprove: approveCallback
|
|
3096
|
-
}), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$
|
|
3096
|
+
}), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$g, {
|
|
3097
3097
|
poolInfo: poolInfo,
|
|
3098
3098
|
accountStats: accountStats
|
|
3099
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$
|
|
3099
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$a, {
|
|
3100
3100
|
poolInfo: poolInfo
|
|
3101
|
-
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$
|
|
3101
|
+
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$k, {
|
|
3102
3102
|
poolInfo: poolInfo
|
|
3103
3103
|
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$d, {
|
|
3104
3104
|
poolInfo: poolInfo,
|
|
@@ -3141,7 +3141,7 @@ function InputAmountModal(_ref) {
|
|
|
3141
3141
|
inputField: material.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),
|
|
3142
3142
|
maxWrapper: material.css(_templateObject4$7 || (_templateObject4$7 = _taggedTemplateLiteral(["\n position: relative;\n display: flex;\n justify-content: flex-end;\n "]))),
|
|
3143
3143
|
maxTitle: material.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)),
|
|
3144
|
-
max: material.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 "]))),
|
|
3144
|
+
max: material.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 "]))),
|
|
3145
3145
|
info: material.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),
|
|
3146
3146
|
subInfo: material.css(_templateObject8$1 || (_templateObject8$1 = _taggedTemplateLiteral(["\n position: absolute;\n bottom: ", ";\n "])), theme.spacing(6))
|
|
3147
3147
|
};
|
|
@@ -3217,7 +3217,7 @@ function InputAmountModal(_ref) {
|
|
|
3217
3217
|
});
|
|
3218
3218
|
}
|
|
3219
3219
|
|
|
3220
|
-
function ChooseAmount$
|
|
3220
|
+
function ChooseAmount$f(_ref) {
|
|
3221
3221
|
let {
|
|
3222
3222
|
poolInfo,
|
|
3223
3223
|
poolUnderlyingToken,
|
|
@@ -3270,7 +3270,7 @@ function ChooseAmount$e(_ref) {
|
|
|
3270
3270
|
});
|
|
3271
3271
|
}
|
|
3272
3272
|
|
|
3273
|
-
function ApproveAllowance$
|
|
3273
|
+
function ApproveAllowance$9(_ref) {
|
|
3274
3274
|
let {
|
|
3275
3275
|
poolInfo,
|
|
3276
3276
|
poolUnderlyingToken
|
|
@@ -3328,7 +3328,7 @@ function TxSendModalV2(_ref) {
|
|
|
3328
3328
|
});
|
|
3329
3329
|
}
|
|
3330
3330
|
|
|
3331
|
-
function Transfer$
|
|
3331
|
+
function Transfer$j(_ref) {
|
|
3332
3332
|
let {
|
|
3333
3333
|
poolInfo
|
|
3334
3334
|
} = _ref;
|
|
@@ -3459,14 +3459,14 @@ function CreditLineBorrowV2(_ref) {
|
|
|
3459
3459
|
handleSuccess: handleSuccessCallback,
|
|
3460
3460
|
children: [!step && jsxRuntime.jsx(LoadingModal, {
|
|
3461
3461
|
title: "Borrow"
|
|
3462
|
-
}), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$
|
|
3462
|
+
}), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$f, {
|
|
3463
3463
|
poolInfo: poolInfo,
|
|
3464
3464
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
3465
3465
|
accountStats: accountStats
|
|
3466
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$
|
|
3466
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$9, {
|
|
3467
3467
|
poolInfo: poolInfo,
|
|
3468
3468
|
poolUnderlyingToken: poolUnderlyingToken
|
|
3469
|
-
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$
|
|
3469
|
+
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$j, {
|
|
3470
3470
|
poolInfo: poolInfo
|
|
3471
3471
|
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$c, {
|
|
3472
3472
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
@@ -3483,7 +3483,7 @@ function CreditLineBorrowV2(_ref) {
|
|
|
3483
3483
|
});
|
|
3484
3484
|
}
|
|
3485
3485
|
|
|
3486
|
-
function ChooseAmount$
|
|
3486
|
+
function ChooseAmount$e(_ref) {
|
|
3487
3487
|
let {
|
|
3488
3488
|
payoffAmount,
|
|
3489
3489
|
totalDueAmount,
|
|
@@ -3534,7 +3534,7 @@ function ChooseAmount$d(_ref) {
|
|
|
3534
3534
|
});
|
|
3535
3535
|
}
|
|
3536
3536
|
|
|
3537
|
-
function ApproveAllowance$
|
|
3537
|
+
function ApproveAllowance$8(_ref) {
|
|
3538
3538
|
let {
|
|
3539
3539
|
poolInfo
|
|
3540
3540
|
} = _ref;
|
|
@@ -3548,7 +3548,7 @@ function ApproveAllowance$9(_ref) {
|
|
|
3548
3548
|
});
|
|
3549
3549
|
}
|
|
3550
3550
|
|
|
3551
|
-
function Transfer$
|
|
3551
|
+
function Transfer$i(_ref) {
|
|
3552
3552
|
let {
|
|
3553
3553
|
poolInfo
|
|
3554
3554
|
} = _ref;
|
|
@@ -3640,13 +3640,13 @@ function CreditLinePayment(_ref) {
|
|
|
3640
3640
|
loadingTitle: "Make Payment",
|
|
3641
3641
|
handleClose: handleClose,
|
|
3642
3642
|
handleSuccess: handleSuccess,
|
|
3643
|
-
children: [step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$
|
|
3643
|
+
children: [step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$e, {
|
|
3644
3644
|
poolInfo: poolInfo,
|
|
3645
3645
|
payoffAmount: payoffAmount,
|
|
3646
3646
|
totalDueAmount: totalDueAmount
|
|
3647
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$
|
|
3647
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$8, {
|
|
3648
3648
|
poolInfo: poolInfo
|
|
3649
|
-
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$
|
|
3649
|
+
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$i, {
|
|
3650
3650
|
poolInfo: poolInfo
|
|
3651
3651
|
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$b, {
|
|
3652
3652
|
poolInfo: poolInfo,
|
|
@@ -3659,7 +3659,7 @@ function CreditLinePayment(_ref) {
|
|
|
3659
3659
|
});
|
|
3660
3660
|
}
|
|
3661
3661
|
|
|
3662
|
-
function ChooseAmount$
|
|
3662
|
+
function ChooseAmount$d(_ref) {
|
|
3663
3663
|
let {
|
|
3664
3664
|
payoffAmount: payoffAmountBN,
|
|
3665
3665
|
totalDueAmount: totalDueAmountBN,
|
|
@@ -3681,6 +3681,8 @@ function ChooseAmount$c(_ref) {
|
|
|
3681
3681
|
} = webShared.usePoolSafeAllowanceV2(poolInfo.poolName, account, provider);
|
|
3682
3682
|
const totalDueAmount = Number(ethers.ethers.utils.formatUnits(totalDueAmountBN, decimals));
|
|
3683
3683
|
const payoffAmount = Number(ethers.ethers.utils.formatUnits(payoffAmountBN, decimals));
|
|
3684
|
+
|
|
3685
|
+
// TODO: Remove redundant useEffect
|
|
3684
3686
|
React.useEffect(() => {
|
|
3685
3687
|
setCurrentAmount(totalDueAmount);
|
|
3686
3688
|
}, [totalDueAmount]);
|
|
@@ -3720,7 +3722,7 @@ function ChooseAmount$c(_ref) {
|
|
|
3720
3722
|
});
|
|
3721
3723
|
}
|
|
3722
3724
|
|
|
3723
|
-
function ApproveAllowance$
|
|
3725
|
+
function ApproveAllowance$7(_ref) {
|
|
3724
3726
|
let {
|
|
3725
3727
|
poolInfo,
|
|
3726
3728
|
poolUnderlyingToken
|
|
@@ -3738,7 +3740,7 @@ function ApproveAllowance$8(_ref) {
|
|
|
3738
3740
|
});
|
|
3739
3741
|
}
|
|
3740
3742
|
|
|
3741
|
-
function Transfer$
|
|
3743
|
+
function Transfer$h(_ref) {
|
|
3742
3744
|
let {
|
|
3743
3745
|
poolInfo,
|
|
3744
3746
|
poolUnderlyingToken
|
|
@@ -3844,15 +3846,15 @@ function CreditLinePaymentV2(_ref) {
|
|
|
3844
3846
|
loadingTitle: "Pay",
|
|
3845
3847
|
handleClose: handleClose,
|
|
3846
3848
|
handleSuccess: handleSuccess,
|
|
3847
|
-
children: [step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$
|
|
3849
|
+
children: [step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$d, {
|
|
3848
3850
|
poolInfo: poolInfo,
|
|
3849
3851
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
3850
3852
|
payoffAmount: payoffAmount,
|
|
3851
3853
|
totalDueAmount: totalDueAmount
|
|
3852
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$
|
|
3854
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$7, {
|
|
3853
3855
|
poolInfo: poolInfo,
|
|
3854
3856
|
poolUnderlyingToken: poolUnderlyingToken
|
|
3855
|
-
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$
|
|
3857
|
+
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$h, {
|
|
3856
3858
|
poolInfo: poolInfo,
|
|
3857
3859
|
poolUnderlyingToken: poolUnderlyingToken
|
|
3858
3860
|
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$a, {
|
|
@@ -3866,7 +3868,7 @@ function CreditLinePaymentV2(_ref) {
|
|
|
3866
3868
|
});
|
|
3867
3869
|
}
|
|
3868
3870
|
|
|
3869
|
-
function ApproveAllowance$
|
|
3871
|
+
function ApproveAllowance$6(_ref) {
|
|
3870
3872
|
let {
|
|
3871
3873
|
poolInfo,
|
|
3872
3874
|
poolUnderlyingToken,
|
|
@@ -3903,7 +3905,7 @@ function Success$9(_ref) {
|
|
|
3903
3905
|
});
|
|
3904
3906
|
}
|
|
3905
3907
|
|
|
3906
|
-
function Transfer$
|
|
3908
|
+
function Transfer$g(_ref) {
|
|
3907
3909
|
let {
|
|
3908
3910
|
poolInfo,
|
|
3909
3911
|
amountToDeposit,
|
|
@@ -3980,11 +3982,11 @@ function SupplyFirstLossCover(_ref) {
|
|
|
3980
3982
|
loadingTitle: title,
|
|
3981
3983
|
handleClose: handleClose,
|
|
3982
3984
|
handleSuccess: handleSuccess,
|
|
3983
|
-
children: [step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$
|
|
3985
|
+
children: [step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$6, {
|
|
3984
3986
|
poolInfo: poolInfo,
|
|
3985
3987
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
3986
3988
|
amountToDeposit: minAmountToDeposit
|
|
3987
|
-
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$
|
|
3989
|
+
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$g, {
|
|
3988
3990
|
poolInfo: poolInfo,
|
|
3989
3991
|
amountToDeposit: minAmountToDeposit,
|
|
3990
3992
|
title: title
|
|
@@ -4037,7 +4039,7 @@ function Evaluation$4(_ref) {
|
|
|
4037
4039
|
});
|
|
4038
4040
|
}
|
|
4039
4041
|
|
|
4040
|
-
function ChooseAmount$
|
|
4042
|
+
function ChooseAmount$c(_ref) {
|
|
4041
4043
|
var _receivable;
|
|
4042
4044
|
let {
|
|
4043
4045
|
poolInfo,
|
|
@@ -4242,7 +4244,7 @@ function ApproveNFT(_ref) {
|
|
|
4242
4244
|
});
|
|
4243
4245
|
}
|
|
4244
4246
|
|
|
4245
|
-
function Transfer$
|
|
4247
|
+
function Transfer$f(_ref) {
|
|
4246
4248
|
let {
|
|
4247
4249
|
poolInfo,
|
|
4248
4250
|
tokenId
|
|
@@ -4318,13 +4320,13 @@ function InvoiceFactoringBorrow(_ref) {
|
|
|
4318
4320
|
children: [step === WIDGET_STEP.Evaluation && jsxRuntime.jsx(Evaluation$4, {
|
|
4319
4321
|
poolInfo: poolInfo,
|
|
4320
4322
|
tokenId: tokenId.toString()
|
|
4321
|
-
}), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$
|
|
4323
|
+
}), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$c, {
|
|
4322
4324
|
poolInfo: poolInfo,
|
|
4323
4325
|
accountStats: accountStats
|
|
4324
4326
|
}), step === WIDGET_STEP.ConfirmTransfer && jsxRuntime.jsx(ConfirmTransfer$2, {}), step === WIDGET_STEP.ApproveNFT && jsxRuntime.jsx(ApproveNFT, {
|
|
4325
4327
|
poolInfo: poolInfo,
|
|
4326
4328
|
tokenId: tokenId.toString()
|
|
4327
|
-
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$
|
|
4329
|
+
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$f, {
|
|
4328
4330
|
poolInfo: poolInfo,
|
|
4329
4331
|
tokenId: tokenId.toString()
|
|
4330
4332
|
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$8, {
|
|
@@ -4337,7 +4339,7 @@ function InvoiceFactoringBorrow(_ref) {
|
|
|
4337
4339
|
});
|
|
4338
4340
|
}
|
|
4339
4341
|
|
|
4340
|
-
function ChooseAmount$
|
|
4342
|
+
function ChooseAmount$b(_ref) {
|
|
4341
4343
|
let {
|
|
4342
4344
|
creditRecord,
|
|
4343
4345
|
poolInfo
|
|
@@ -4388,7 +4390,7 @@ function ChooseAmount$a(_ref) {
|
|
|
4388
4390
|
});
|
|
4389
4391
|
}
|
|
4390
4392
|
|
|
4391
|
-
function ApproveAllowance$
|
|
4393
|
+
function ApproveAllowance$5(_ref) {
|
|
4392
4394
|
let {
|
|
4393
4395
|
poolInfo
|
|
4394
4396
|
} = _ref;
|
|
@@ -4402,7 +4404,7 @@ function ApproveAllowance$6(_ref) {
|
|
|
4402
4404
|
});
|
|
4403
4405
|
}
|
|
4404
4406
|
|
|
4405
|
-
function Transfer$
|
|
4407
|
+
function Transfer$e(_ref) {
|
|
4406
4408
|
let {
|
|
4407
4409
|
poolInfo
|
|
4408
4410
|
} = _ref;
|
|
@@ -4482,12 +4484,12 @@ function InvoiceFactoringPayment(_ref) {
|
|
|
4482
4484
|
loadingTitle: "Make Payment",
|
|
4483
4485
|
handleClose: handleClose,
|
|
4484
4486
|
handleSuccess: handleSuccess,
|
|
4485
|
-
children: [step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$
|
|
4487
|
+
children: [step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$b, {
|
|
4486
4488
|
creditRecord: creditRecord,
|
|
4487
4489
|
poolInfo: poolInfo
|
|
4488
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$
|
|
4490
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$5, {
|
|
4489
4491
|
poolInfo: poolInfo
|
|
4490
|
-
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$
|
|
4492
|
+
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$e, {
|
|
4491
4493
|
poolInfo: poolInfo
|
|
4492
4494
|
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$7, {
|
|
4493
4495
|
poolInfo: poolInfo,
|
|
@@ -4556,7 +4558,7 @@ function ChooseTranche$4(_ref) {
|
|
|
4556
4558
|
});
|
|
4557
4559
|
}
|
|
4558
4560
|
|
|
4559
|
-
function ChooseAmount$
|
|
4561
|
+
function ChooseAmount$a(_ref) {
|
|
4560
4562
|
let {
|
|
4561
4563
|
poolInfo,
|
|
4562
4564
|
poolUnderlyingToken,
|
|
@@ -4621,7 +4623,7 @@ function ChooseAmount$9(_ref) {
|
|
|
4621
4623
|
});
|
|
4622
4624
|
}
|
|
4623
4625
|
|
|
4624
|
-
function Transfer$
|
|
4626
|
+
function Transfer$d(_ref) {
|
|
4625
4627
|
let {
|
|
4626
4628
|
poolInfo,
|
|
4627
4629
|
poolUnderlyingToken,
|
|
@@ -4654,7 +4656,7 @@ function Transfer$b(_ref) {
|
|
|
4654
4656
|
});
|
|
4655
4657
|
}
|
|
4656
4658
|
|
|
4657
|
-
function Done$
|
|
4659
|
+
function Done$6(_ref) {
|
|
4658
4660
|
let {
|
|
4659
4661
|
handleAction
|
|
4660
4662
|
} = _ref;
|
|
@@ -4767,15 +4769,15 @@ function AddRedemptionV2(_ref) {
|
|
|
4767
4769
|
children: [step === WIDGET_STEP.ChooseTranche && jsxRuntime.jsx(ChooseTranche$4, {
|
|
4768
4770
|
selectedTranche: trancheInfo === null || trancheInfo === void 0 ? void 0 : trancheInfo.tranche,
|
|
4769
4771
|
changeTranche: handleChangeTranche
|
|
4770
|
-
}), step === WIDGET_STEP.ChooseAmount && trancheInfo && jsxRuntime.jsx(ChooseAmount$
|
|
4772
|
+
}), step === WIDGET_STEP.ChooseAmount && trancheInfo && jsxRuntime.jsx(ChooseAmount$a, {
|
|
4771
4773
|
poolInfo: poolInfo,
|
|
4772
4774
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
4773
4775
|
trancheInfo: trancheInfo
|
|
4774
|
-
}), step === WIDGET_STEP.Transfer && trancheInfo && jsxRuntime.jsx(Transfer$
|
|
4776
|
+
}), step === WIDGET_STEP.Transfer && trancheInfo && jsxRuntime.jsx(Transfer$d, {
|
|
4775
4777
|
poolInfo: poolInfo,
|
|
4776
4778
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
4777
4779
|
trancheInfo: trancheInfo
|
|
4778
|
-
}), step === WIDGET_STEP.Done && trancheInfo && jsxRuntime.jsx(Done$
|
|
4780
|
+
}), step === WIDGET_STEP.Done && trancheInfo && jsxRuntime.jsx(Done$6, {
|
|
4779
4781
|
handleAction: handleClose
|
|
4780
4782
|
}), step === WIDGET_STEP.Error && jsxRuntime.jsx(ErrorModal, {
|
|
4781
4783
|
title: title,
|
|
@@ -4786,7 +4788,7 @@ function AddRedemptionV2(_ref) {
|
|
|
4786
4788
|
});
|
|
4787
4789
|
}
|
|
4788
4790
|
|
|
4789
|
-
function Transfer$
|
|
4791
|
+
function Transfer$c(_ref) {
|
|
4790
4792
|
let {
|
|
4791
4793
|
poolInfo,
|
|
4792
4794
|
trancheType,
|
|
@@ -4812,7 +4814,7 @@ function Transfer$a(_ref) {
|
|
|
4812
4814
|
});
|
|
4813
4815
|
}
|
|
4814
4816
|
|
|
4815
|
-
function Done$
|
|
4817
|
+
function Done$5(_ref) {
|
|
4816
4818
|
let {
|
|
4817
4819
|
poolUnderlyingToken,
|
|
4818
4820
|
redemptionInfo,
|
|
@@ -4873,11 +4875,11 @@ function CancelRedemptionV2(_ref) {
|
|
|
4873
4875
|
loadingTitle: title,
|
|
4874
4876
|
handleClose: handleClose,
|
|
4875
4877
|
handleSuccess: handleRedeemSuccess,
|
|
4876
|
-
children: [step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$
|
|
4878
|
+
children: [step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$c, {
|
|
4877
4879
|
poolInfo: poolInfo,
|
|
4878
4880
|
trancheType: trancheType,
|
|
4879
4881
|
redemptionInfo: redemptionInfo
|
|
4880
|
-
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Done$
|
|
4882
|
+
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Done$5, {
|
|
4881
4883
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
4882
4884
|
handleAction: handleClose,
|
|
4883
4885
|
redemptionInfo: redemptionInfo
|
|
@@ -5279,7 +5281,7 @@ function Evaluation$3(_ref) {
|
|
|
5279
5281
|
});
|
|
5280
5282
|
}
|
|
5281
5283
|
|
|
5282
|
-
function ChooseAmount$
|
|
5284
|
+
function ChooseAmount$9(_ref) {
|
|
5283
5285
|
let {
|
|
5284
5286
|
allowance,
|
|
5285
5287
|
withdrawlLockoutSeconds,
|
|
@@ -5322,7 +5324,7 @@ function ChooseAmount$8(_ref) {
|
|
|
5322
5324
|
});
|
|
5323
5325
|
}
|
|
5324
5326
|
|
|
5325
|
-
function ApproveAllowance$
|
|
5327
|
+
function ApproveAllowance$4(_ref) {
|
|
5326
5328
|
let {
|
|
5327
5329
|
poolInfo
|
|
5328
5330
|
} = _ref;
|
|
@@ -5336,7 +5338,7 @@ function ApproveAllowance$5(_ref) {
|
|
|
5336
5338
|
});
|
|
5337
5339
|
}
|
|
5338
5340
|
|
|
5339
|
-
function Transfer$
|
|
5341
|
+
function Transfer$b(_ref) {
|
|
5340
5342
|
let {
|
|
5341
5343
|
poolInfo
|
|
5342
5344
|
} = _ref;
|
|
@@ -5486,14 +5488,14 @@ function LendSupply(_ref) {
|
|
|
5486
5488
|
poolInfo: poolInfo,
|
|
5487
5489
|
handleClose: handleClose,
|
|
5488
5490
|
handleApproveSuccess: handleApproveSuccess
|
|
5489
|
-
}), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$
|
|
5491
|
+
}), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$9, {
|
|
5490
5492
|
poolInfo: poolInfo,
|
|
5491
5493
|
allowance: allowance,
|
|
5492
5494
|
underlyingTokenBalance: balanceWithoutDecimals,
|
|
5493
5495
|
withdrawlLockoutSeconds: withdrawlLockoutSeconds
|
|
5494
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$
|
|
5496
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$4, {
|
|
5495
5497
|
poolInfo: poolInfo
|
|
5496
|
-
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$
|
|
5498
|
+
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$b, {
|
|
5497
5499
|
poolInfo: poolInfo
|
|
5498
5500
|
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$6, {
|
|
5499
5501
|
poolInfo: poolInfo,
|
|
@@ -6134,7 +6136,7 @@ function Evaluation$2(_ref) {
|
|
|
6134
6136
|
return null;
|
|
6135
6137
|
}
|
|
6136
6138
|
|
|
6137
|
-
function ChooseAmount$
|
|
6139
|
+
function ChooseAmount$8(_ref) {
|
|
6138
6140
|
let {
|
|
6139
6141
|
poolInfo,
|
|
6140
6142
|
lpConfig,
|
|
@@ -6217,7 +6219,7 @@ function ChooseAmount$7(_ref) {
|
|
|
6217
6219
|
});
|
|
6218
6220
|
}
|
|
6219
6221
|
|
|
6220
|
-
function ApproveAllowance$
|
|
6222
|
+
function ApproveAllowance$3(_ref) {
|
|
6221
6223
|
let {
|
|
6222
6224
|
poolInfo
|
|
6223
6225
|
} = _ref;
|
|
@@ -6234,7 +6236,7 @@ function ApproveAllowance$4(_ref) {
|
|
|
6234
6236
|
});
|
|
6235
6237
|
}
|
|
6236
6238
|
|
|
6237
|
-
function Transfer$
|
|
6239
|
+
function Transfer$a(_ref) {
|
|
6238
6240
|
let {
|
|
6239
6241
|
poolInfo,
|
|
6240
6242
|
trancheType
|
|
@@ -6600,16 +6602,16 @@ function LendSupplyV2(_ref) {
|
|
|
6600
6602
|
changeTranche: setSelectedTranche,
|
|
6601
6603
|
pointsTestnetExperience: pointsTestnetExperience,
|
|
6602
6604
|
campaign: campaign
|
|
6603
|
-
}), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$
|
|
6605
|
+
}), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$8, {
|
|
6604
6606
|
poolInfo: poolInfo,
|
|
6605
6607
|
lpConfig: lpConfig,
|
|
6606
6608
|
juniorAssets: juniorAssets,
|
|
6607
6609
|
seniorAssets: seniorAssets,
|
|
6608
6610
|
selectedTranche: selectedTranche,
|
|
6609
6611
|
isUniTranche: isUniTranche
|
|
6610
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$
|
|
6612
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$3, {
|
|
6611
6613
|
poolInfo: poolInfo
|
|
6612
|
-
}), step === WIDGET_STEP.Transfer && selectedTranche && jsxRuntime.jsx(Transfer$
|
|
6614
|
+
}), step === WIDGET_STEP.Transfer && selectedTranche && jsxRuntime.jsx(Transfer$a, {
|
|
6613
6615
|
poolInfo: poolInfo,
|
|
6614
6616
|
trancheType: selectedTranche
|
|
6615
6617
|
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$5, {
|
|
@@ -6677,7 +6679,7 @@ function CheckWithdrawable(_ref) {
|
|
|
6677
6679
|
});
|
|
6678
6680
|
}
|
|
6679
6681
|
|
|
6680
|
-
function ChooseAmount$
|
|
6682
|
+
function ChooseAmount$7(_ref) {
|
|
6681
6683
|
let {
|
|
6682
6684
|
lenderPosition,
|
|
6683
6685
|
poolBalance,
|
|
@@ -6715,7 +6717,7 @@ function ChooseAmount$6(_ref) {
|
|
|
6715
6717
|
});
|
|
6716
6718
|
}
|
|
6717
6719
|
|
|
6718
|
-
function Transfer$
|
|
6720
|
+
function Transfer$9(_ref) {
|
|
6719
6721
|
let {
|
|
6720
6722
|
poolInfo
|
|
6721
6723
|
} = _ref;
|
|
@@ -6828,11 +6830,11 @@ function LendWithdraw(_ref) {
|
|
|
6828
6830
|
children: [step === WIDGET_STEP.CheckWithdrawable && jsxRuntime.jsx(CheckWithdrawable, {
|
|
6829
6831
|
poolInfo: poolInfo,
|
|
6830
6832
|
handleClose: handleClose
|
|
6831
|
-
}), step === WIDGET_STEP.ChooseAmount && lenderPosition && poolBalance && jsxRuntime.jsx(ChooseAmount$
|
|
6833
|
+
}), step === WIDGET_STEP.ChooseAmount && lenderPosition && poolBalance && jsxRuntime.jsx(ChooseAmount$7, {
|
|
6832
6834
|
poolInfo: poolInfo,
|
|
6833
6835
|
lenderPosition: lenderPosition,
|
|
6834
6836
|
poolBalance: poolBalance
|
|
6835
|
-
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$
|
|
6837
|
+
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$9, {
|
|
6836
6838
|
poolInfo: poolInfo
|
|
6837
6839
|
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$4, {
|
|
6838
6840
|
poolInfo: poolInfo,
|
|
@@ -6935,7 +6937,7 @@ function ConfirmTransfer$1(_ref) {
|
|
|
6935
6937
|
});
|
|
6936
6938
|
}
|
|
6937
6939
|
|
|
6938
|
-
function Transfer$
|
|
6940
|
+
function Transfer$8(_ref) {
|
|
6939
6941
|
let {
|
|
6940
6942
|
poolInfo,
|
|
6941
6943
|
tranche,
|
|
@@ -6961,7 +6963,7 @@ function Transfer$6(_ref) {
|
|
|
6961
6963
|
});
|
|
6962
6964
|
}
|
|
6963
6965
|
|
|
6964
|
-
function Done$
|
|
6966
|
+
function Done$4(_ref) {
|
|
6965
6967
|
let {
|
|
6966
6968
|
poolUnderlyingToken,
|
|
6967
6969
|
withdrawAmount,
|
|
@@ -7061,11 +7063,11 @@ function LendWithdrawV2(_ref) {
|
|
|
7061
7063
|
redemptionStatus: redemptionStatus,
|
|
7062
7064
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
7063
7065
|
poolIsClosed: poolIsClosed
|
|
7064
|
-
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$
|
|
7066
|
+
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$8, {
|
|
7065
7067
|
poolInfo: poolInfo,
|
|
7066
7068
|
tranche: trancheType,
|
|
7067
7069
|
poolIsClosed: poolIsClosed
|
|
7068
|
-
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Done$
|
|
7070
|
+
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Done$4, {
|
|
7069
7071
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
7070
7072
|
withdrawAmount: redemptionStatus.withdrawableAssets,
|
|
7071
7073
|
handleAction: handleClose
|
|
@@ -7078,7 +7080,7 @@ function LendWithdrawV2(_ref) {
|
|
|
7078
7080
|
});
|
|
7079
7081
|
}
|
|
7080
7082
|
|
|
7081
|
-
function ChooseAmount$
|
|
7083
|
+
function ChooseAmount$6(_ref) {
|
|
7082
7084
|
let {
|
|
7083
7085
|
poolInfo,
|
|
7084
7086
|
poolUnderlyingToken,
|
|
@@ -7142,7 +7144,7 @@ function ChooseAmount$5(_ref) {
|
|
|
7142
7144
|
});
|
|
7143
7145
|
}
|
|
7144
7146
|
|
|
7145
|
-
function ApproveAllowance$
|
|
7147
|
+
function ApproveAllowance$2(_ref) {
|
|
7146
7148
|
let {
|
|
7147
7149
|
poolInfo,
|
|
7148
7150
|
poolUnderlyingToken
|
|
@@ -7201,7 +7203,7 @@ function ApproveReceivable$1(_ref) {
|
|
|
7201
7203
|
});
|
|
7202
7204
|
}
|
|
7203
7205
|
|
|
7204
|
-
function Transfer$
|
|
7206
|
+
function Transfer$7(_ref) {
|
|
7205
7207
|
let {
|
|
7206
7208
|
poolInfo,
|
|
7207
7209
|
tokenId
|
|
@@ -7342,18 +7344,18 @@ function ReceivableBackedCreditLineBorrowV2(_ref) {
|
|
|
7342
7344
|
loadingTitle: "Borrow",
|
|
7343
7345
|
handleClose: handleClose,
|
|
7344
7346
|
handleSuccess: handleSuccessCallback,
|
|
7345
|
-
children: [step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$
|
|
7347
|
+
children: [step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$6, {
|
|
7346
7348
|
poolInfo: poolInfo,
|
|
7347
7349
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
7348
7350
|
accountStats: accountStats,
|
|
7349
7351
|
tokenId: tokenId
|
|
7350
|
-
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$
|
|
7352
|
+
}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance$2, {
|
|
7351
7353
|
poolInfo: poolInfo,
|
|
7352
7354
|
poolUnderlyingToken: poolUnderlyingToken
|
|
7353
7355
|
}), step === WIDGET_STEP.ApproveNFT && tokenId && jsxRuntime.jsx(ApproveReceivable$1, {
|
|
7354
7356
|
poolInfo: poolInfo,
|
|
7355
7357
|
tokenId: tokenId
|
|
7356
|
-
}), step === WIDGET_STEP.Transfer && tokenId && jsxRuntime.jsx(Transfer$
|
|
7358
|
+
}), step === WIDGET_STEP.Transfer && tokenId && jsxRuntime.jsx(Transfer$7, {
|
|
7357
7359
|
poolInfo: poolInfo,
|
|
7358
7360
|
tokenId: tokenId
|
|
7359
7361
|
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$3, {
|
|
@@ -7427,7 +7429,7 @@ function ChoosePaymentType(_ref) {
|
|
|
7427
7429
|
});
|
|
7428
7430
|
}
|
|
7429
7431
|
|
|
7430
|
-
function ChooseAmount$
|
|
7432
|
+
function ChooseAmount$5(_ref) {
|
|
7431
7433
|
let {
|
|
7432
7434
|
payoffAmount: payoffAmountBN,
|
|
7433
7435
|
poolInfo,
|
|
@@ -7481,7 +7483,7 @@ function ChooseAmount$4(_ref) {
|
|
|
7481
7483
|
});
|
|
7482
7484
|
}
|
|
7483
7485
|
|
|
7484
|
-
function ApproveAllowance$
|
|
7486
|
+
function ApproveAllowance$1(_ref) {
|
|
7485
7487
|
let {
|
|
7486
7488
|
poolInfo,
|
|
7487
7489
|
poolUnderlyingToken,
|
|
@@ -7609,7 +7611,7 @@ function ApproveReceivable(_ref) {
|
|
|
7609
7611
|
});
|
|
7610
7612
|
}
|
|
7611
7613
|
|
|
7612
|
-
function Transfer$
|
|
7614
|
+
function Transfer$6(_ref) {
|
|
7613
7615
|
let {
|
|
7614
7616
|
poolInfo,
|
|
7615
7617
|
poolUnderlyingToken,
|
|
@@ -7760,12 +7762,12 @@ function ReceivableBackedCreditLinePaymentV2(_ref) {
|
|
|
7760
7762
|
children: [step === WIDGET_STEP.ChoosePaymentType && jsxRuntime.jsx(ChoosePaymentType, {
|
|
7761
7763
|
paymentType: paymentType,
|
|
7762
7764
|
changePaymentType: setPaymentType
|
|
7763
|
-
}), step === WIDGET_STEP.ChooseAmount && paymentType && jsxRuntime.jsx(ChooseAmount$
|
|
7765
|
+
}), step === WIDGET_STEP.ChooseAmount && paymentType && jsxRuntime.jsx(ChooseAmount$5, {
|
|
7764
7766
|
poolInfo: poolInfo,
|
|
7765
7767
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
7766
7768
|
payoffAmount: payoffAmount,
|
|
7767
7769
|
paymentType: paymentType
|
|
7768
|
-
}), step === WIDGET_STEP.ApproveAllowance && paymentType && jsxRuntime.jsx(ApproveAllowance$
|
|
7770
|
+
}), step === WIDGET_STEP.ApproveAllowance && paymentType && jsxRuntime.jsx(ApproveAllowance$1, {
|
|
7769
7771
|
poolInfo: poolInfo,
|
|
7770
7772
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
7771
7773
|
paymentType: paymentType
|
|
@@ -7776,7 +7778,7 @@ function ReceivableBackedCreditLinePaymentV2(_ref) {
|
|
|
7776
7778
|
}), step === WIDGET_STEP.ApproveNFT && borrowTokenId && jsxRuntime.jsx(ApproveReceivable, {
|
|
7777
7779
|
poolInfo: poolInfo,
|
|
7778
7780
|
tokenId: borrowTokenId
|
|
7779
|
-
}), step === WIDGET_STEP.Transfer && paymentType && jsxRuntime.jsx(Transfer$
|
|
7781
|
+
}), step === WIDGET_STEP.Transfer && paymentType && jsxRuntime.jsx(Transfer$6, {
|
|
7780
7782
|
poolInfo: poolInfo,
|
|
7781
7783
|
poolUnderlyingToken: poolUnderlyingToken,
|
|
7782
7784
|
paymentType: paymentType,
|
|
@@ -8106,7 +8108,7 @@ function Evaluation$1(_ref) {
|
|
|
8106
8108
|
});
|
|
8107
8109
|
}
|
|
8108
8110
|
|
|
8109
|
-
function ChooseAmount$
|
|
8111
|
+
function ChooseAmount$4(_ref) {
|
|
8110
8112
|
var _poolInfo$extra;
|
|
8111
8113
|
let {
|
|
8112
8114
|
poolInfo,
|
|
@@ -8220,7 +8222,7 @@ function ConfirmTransfer() {
|
|
|
8220
8222
|
});
|
|
8221
8223
|
}
|
|
8222
8224
|
|
|
8223
|
-
function ApproveAllowance
|
|
8225
|
+
function ApproveAllowance(_ref) {
|
|
8224
8226
|
let {
|
|
8225
8227
|
poolInfo
|
|
8226
8228
|
} = _ref;
|
|
@@ -8292,7 +8294,7 @@ function Permit(_ref) {
|
|
|
8292
8294
|
});
|
|
8293
8295
|
}
|
|
8294
8296
|
|
|
8295
|
-
function Transfer$
|
|
8297
|
+
function Transfer$5(_ref) {
|
|
8296
8298
|
let {
|
|
8297
8299
|
poolInfo
|
|
8298
8300
|
} = _ref;
|
|
@@ -8371,17 +8373,17 @@ function StreamFactoringBorrow(_ref) {
|
|
|
8371
8373
|
poolInfo: poolInfo,
|
|
8372
8374
|
payerAddress: payerAddress,
|
|
8373
8375
|
superToken: superToken
|
|
8374
|
-
}), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$
|
|
8376
|
+
}), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$4, {
|
|
8375
8377
|
poolInfo: poolInfo,
|
|
8376
8378
|
currentFlowRate: currentFlowRate
|
|
8377
|
-
}), step === WIDGET_STEP.ConfirmTransfer && jsxRuntime.jsx(ConfirmTransfer, {}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance
|
|
8379
|
+
}), step === WIDGET_STEP.ConfirmTransfer && jsxRuntime.jsx(ConfirmTransfer, {}), step === WIDGET_STEP.ApproveAllowance && jsxRuntime.jsx(ApproveAllowance, {
|
|
8378
8380
|
poolInfo: poolInfo
|
|
8379
8381
|
}), step === WIDGET_STEP.Permit && account && jsxRuntime.jsx(Permit, {
|
|
8380
8382
|
poolInfo: poolInfo,
|
|
8381
8383
|
payerAddress: payerAddress,
|
|
8382
8384
|
borrower: account,
|
|
8383
8385
|
superToken: superToken
|
|
8384
|
-
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$
|
|
8386
|
+
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$5, {
|
|
8385
8387
|
poolInfo: poolInfo
|
|
8386
8388
|
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success$1, {
|
|
8387
8389
|
handleAction: handleClose
|
|
@@ -9399,7 +9401,7 @@ function ChooseTranche$2(_ref) {
|
|
|
9399
9401
|
});
|
|
9400
9402
|
}
|
|
9401
9403
|
|
|
9402
|
-
function ChooseAmount$
|
|
9404
|
+
function ChooseAmount$3(_ref) {
|
|
9403
9405
|
let {
|
|
9404
9406
|
poolInfo,
|
|
9405
9407
|
poolState,
|
|
@@ -9550,7 +9552,7 @@ function SolanaTxSendModal(_ref) {
|
|
|
9550
9552
|
});
|
|
9551
9553
|
}
|
|
9552
9554
|
|
|
9553
|
-
function Transfer$
|
|
9555
|
+
function Transfer$4(_ref) {
|
|
9554
9556
|
let {
|
|
9555
9557
|
poolInfo,
|
|
9556
9558
|
selectedTranche
|
|
@@ -9791,13 +9793,13 @@ function SolanaLendSupply(_ref) {
|
|
|
9791
9793
|
poolUnderlyingToken: poolInfo.underlyingMint,
|
|
9792
9794
|
selectedTranche: selectedTranche,
|
|
9793
9795
|
changeTranche: setSelectedTranche
|
|
9794
|
-
}), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$
|
|
9796
|
+
}), step === WIDGET_STEP.ChooseAmount && jsxRuntime.jsx(ChooseAmount$3, {
|
|
9795
9797
|
poolInfo: poolInfo,
|
|
9796
9798
|
poolState: poolState,
|
|
9797
9799
|
tokenAccount: tokenAccount,
|
|
9798
9800
|
selectedTranche: selectedTranche,
|
|
9799
9801
|
isUniTranche: isUniTranche
|
|
9800
|
-
}), step === WIDGET_STEP.Transfer && selectedTranche && jsxRuntime.jsx(Transfer$
|
|
9802
|
+
}), step === WIDGET_STEP.Transfer && selectedTranche && jsxRuntime.jsx(Transfer$4, {
|
|
9801
9803
|
poolInfo: poolInfo,
|
|
9802
9804
|
selectedTranche: selectedTranche
|
|
9803
9805
|
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Success, {
|
|
@@ -9813,7 +9815,7 @@ function SolanaLendSupply(_ref) {
|
|
|
9813
9815
|
});
|
|
9814
9816
|
}
|
|
9815
9817
|
|
|
9816
|
-
function ChooseAmount$
|
|
9818
|
+
function ChooseAmount$2(_ref) {
|
|
9817
9819
|
let {
|
|
9818
9820
|
poolInfo,
|
|
9819
9821
|
poolState,
|
|
@@ -9961,7 +9963,7 @@ function ChooseTranche$1(_ref) {
|
|
|
9961
9963
|
});
|
|
9962
9964
|
}
|
|
9963
9965
|
|
|
9964
|
-
function Done$
|
|
9966
|
+
function Done$3(_ref) {
|
|
9965
9967
|
let {
|
|
9966
9968
|
poolInfo,
|
|
9967
9969
|
handleAction
|
|
@@ -9980,7 +9982,7 @@ function Done$1(_ref) {
|
|
|
9980
9982
|
});
|
|
9981
9983
|
}
|
|
9982
9984
|
|
|
9983
|
-
function Transfer$
|
|
9985
|
+
function Transfer$3(_ref) {
|
|
9984
9986
|
let {
|
|
9985
9987
|
poolInfo,
|
|
9986
9988
|
selectedTranche
|
|
@@ -10103,15 +10105,15 @@ function SolanaLendAddRedemption(_ref) {
|
|
|
10103
10105
|
children: [step === WIDGET_STEP.ChooseTranche && jsxRuntime.jsx(ChooseTranche$1, {
|
|
10104
10106
|
selectedTranche: selectedTranche,
|
|
10105
10107
|
changeTranche: setSelectedTranche
|
|
10106
|
-
}), step === WIDGET_STEP.ChooseAmount && selectedTranche && jsxRuntime.jsx(ChooseAmount$
|
|
10108
|
+
}), step === WIDGET_STEP.ChooseAmount && selectedTranche && jsxRuntime.jsx(ChooseAmount$2, {
|
|
10107
10109
|
poolInfo: poolInfo,
|
|
10108
10110
|
poolState: poolState,
|
|
10109
10111
|
lenderState: selectedTranche === 'senior' ? seniorLenderStateAccount : juniorLenderStateAccount,
|
|
10110
10112
|
selectedTranche: selectedTranche
|
|
10111
|
-
}), step === WIDGET_STEP.Transfer && selectedTranche && jsxRuntime.jsx(Transfer$
|
|
10113
|
+
}), step === WIDGET_STEP.Transfer && selectedTranche && jsxRuntime.jsx(Transfer$3, {
|
|
10112
10114
|
poolInfo: poolInfo,
|
|
10113
10115
|
selectedTranche: selectedTranche
|
|
10114
|
-
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Done$
|
|
10116
|
+
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Done$3, {
|
|
10115
10117
|
poolInfo: poolInfo,
|
|
10116
10118
|
handleAction: handleClose
|
|
10117
10119
|
}), step === WIDGET_STEP.Error && jsxRuntime.jsx(ErrorModal, {
|
|
@@ -10123,7 +10125,7 @@ function SolanaLendAddRedemption(_ref) {
|
|
|
10123
10125
|
});
|
|
10124
10126
|
}
|
|
10125
10127
|
|
|
10126
|
-
function Transfer(_ref) {
|
|
10128
|
+
function Transfer$2(_ref) {
|
|
10127
10129
|
let {
|
|
10128
10130
|
poolInfo,
|
|
10129
10131
|
lenderState,
|
|
@@ -10229,7 +10231,7 @@ function ChooseTranche(_ref) {
|
|
|
10229
10231
|
});
|
|
10230
10232
|
}
|
|
10231
10233
|
|
|
10232
|
-
function Done(_ref) {
|
|
10234
|
+
function Done$2(_ref) {
|
|
10233
10235
|
let {
|
|
10234
10236
|
poolInfo,
|
|
10235
10237
|
lenderState,
|
|
@@ -10310,12 +10312,12 @@ function SolanaLendCancelRedemption(_ref) {
|
|
|
10310
10312
|
children: [step === WIDGET_STEP.ChooseTranche && jsxRuntime.jsx(ChooseTranche, {
|
|
10311
10313
|
selectedTranche: selectedTranche,
|
|
10312
10314
|
changeTranche: setSelectedTranche
|
|
10313
|
-
}), step === WIDGET_STEP.Transfer && selectedTranche && jsxRuntime.jsx(Transfer, {
|
|
10315
|
+
}), step === WIDGET_STEP.Transfer && selectedTranche && jsxRuntime.jsx(Transfer$2, {
|
|
10314
10316
|
poolInfo: poolInfo,
|
|
10315
10317
|
lenderState: selectedTranche === 'senior' ? seniorLenderStateAccount : juniorLenderStateAccount,
|
|
10316
10318
|
lenderStatePDA: selectedTranche === 'senior' ? seniorLenderStateAccountPDA : juniorLenderStateAccountPDA,
|
|
10317
10319
|
selectedTranche: selectedTranche
|
|
10318
|
-
}), step === WIDGET_STEP.Done && selectedTranche && jsxRuntime.jsx(Done, {
|
|
10320
|
+
}), step === WIDGET_STEP.Done && selectedTranche && jsxRuntime.jsx(Done$2, {
|
|
10319
10321
|
poolInfo: poolInfo,
|
|
10320
10322
|
lenderState: selectedTranche === 'senior' ? seniorLenderStateAccount : juniorLenderStateAccount,
|
|
10321
10323
|
selectedTranche: selectedTranche,
|
|
@@ -10329,37 +10331,30 @@ function SolanaLendCancelRedemption(_ref) {
|
|
|
10329
10331
|
});
|
|
10330
10332
|
}
|
|
10331
10333
|
|
|
10332
|
-
function ChooseAmount(_ref) {
|
|
10334
|
+
function ChooseAmount$1(_ref) {
|
|
10333
10335
|
let {
|
|
10334
10336
|
poolInfo,
|
|
10335
|
-
creditConfigAccount
|
|
10336
|
-
tokenAccount
|
|
10337
|
+
creditConfigAccount
|
|
10337
10338
|
} = _ref;
|
|
10338
10339
|
const dispatch = useAppDispatch();
|
|
10339
10340
|
const {
|
|
10340
10341
|
symbol,
|
|
10341
10342
|
decimals
|
|
10342
10343
|
} = poolInfo.underlyingMint;
|
|
10343
|
-
const sentinel = React.useMemo(() => shared.getSentinelAddress(poolInfo.chainId), [poolInfo.chainId]);
|
|
10344
10344
|
const [currentAmount, setCurrentAmount] = React.useState(0);
|
|
10345
10345
|
const creditAvailable = React.useMemo(() => shared.SolanaTokenUtils.formatUnits(creditConfigAccount.creditAvailable, decimals), [creditConfigAccount.creditAvailable, decimals]);
|
|
10346
10346
|
const handleChangeAmount = newAmount => {
|
|
10347
10347
|
setCurrentAmount(newAmount);
|
|
10348
10348
|
};
|
|
10349
10349
|
const handleAction = React.useCallback(() => {
|
|
10350
|
-
var _tokenAccount$delegat;
|
|
10351
|
-
if (!tokenAccount) {
|
|
10352
|
-
return;
|
|
10353
|
-
}
|
|
10354
10350
|
const borrowAmountBN = shared.SolanaTokenUtils.parseUnits(String(currentAmount), decimals);
|
|
10355
|
-
const nextStep = borrowAmountBN.gt(new anchor.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;
|
|
10356
10351
|
dispatch(setBorrowInfo({
|
|
10357
10352
|
borrowAmount: currentAmount,
|
|
10358
10353
|
borrowAmountBN: JSON.parse(borrowAmountBN.toString()),
|
|
10359
10354
|
chargedFees: 0,
|
|
10360
|
-
nextStep
|
|
10355
|
+
nextStep: WIDGET_STEP.Transfer
|
|
10361
10356
|
}));
|
|
10362
|
-
}, [currentAmount, decimals, dispatch
|
|
10357
|
+
}, [currentAmount, decimals, dispatch]);
|
|
10363
10358
|
return jsxRuntime.jsx(InputAmountModal, {
|
|
10364
10359
|
title: "Borrow",
|
|
10365
10360
|
subTitle: "Choose Amount",
|
|
@@ -10373,46 +10368,90 @@ function ChooseAmount(_ref) {
|
|
|
10373
10368
|
});
|
|
10374
10369
|
}
|
|
10375
10370
|
|
|
10376
|
-
function
|
|
10371
|
+
function Transfer$1(_ref) {
|
|
10377
10372
|
let {
|
|
10378
|
-
poolInfo
|
|
10379
|
-
tokenAccount
|
|
10373
|
+
poolInfo
|
|
10380
10374
|
} = _ref;
|
|
10381
10375
|
const dispatch = useAppDispatch();
|
|
10382
10376
|
const {
|
|
10383
10377
|
wallet,
|
|
10384
|
-
publicKey
|
|
10385
|
-
sendTransaction,
|
|
10386
|
-
signTransaction
|
|
10378
|
+
publicKey
|
|
10387
10379
|
} = walletAdapterReact.useWallet();
|
|
10388
|
-
const sentinel =
|
|
10380
|
+
const sentinel = shared.getSentinelAddress(poolInfo.chainId);
|
|
10389
10381
|
const {
|
|
10390
10382
|
connection
|
|
10391
10383
|
} = walletAdapterReact.useConnection();
|
|
10392
10384
|
const [transaction, setTransaction] = React.useState();
|
|
10385
|
+
const program = webShared.useHumaProgram(poolInfo.chainId);
|
|
10386
|
+
const {
|
|
10387
|
+
borrowAmountBN: borrowAmountBNJson
|
|
10388
|
+
} = useAppSelector(selectWidgetState);
|
|
10393
10389
|
const handleSuccess = React.useCallback(() => {
|
|
10394
|
-
dispatch(setStep(WIDGET_STEP.
|
|
10390
|
+
dispatch(setStep(WIDGET_STEP.Done));
|
|
10395
10391
|
}, [dispatch]);
|
|
10396
10392
|
React.useEffect(() => {
|
|
10397
10393
|
async function getTx() {
|
|
10398
|
-
|
|
10394
|
+
var _borrowAmountBNJson$t, _tokenAccount$delegat;
|
|
10395
|
+
if (!wallet || !publicKey || !connection) {
|
|
10399
10396
|
return;
|
|
10400
10397
|
}
|
|
10401
|
-
const
|
|
10402
|
-
|
|
10403
|
-
publicKey
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
//
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10398
|
+
const {
|
|
10399
|
+
underlyingTokenATA
|
|
10400
|
+
} = shared.getTokenAccounts(poolInfo, publicKey);
|
|
10401
|
+
const tx = new web3_js.Transaction();
|
|
10402
|
+
|
|
10403
|
+
// Create user token account if it doesn't exist
|
|
10404
|
+
let tokenAccount;
|
|
10405
|
+
try {
|
|
10406
|
+
tokenAccount = await splToken.getAccount(connection, underlyingTokenATA, undefined, splToken.TOKEN_2022_PROGRAM_ID);
|
|
10407
|
+
} catch (error) {
|
|
10408
|
+
// TokenAccountNotFoundError can be possible if the associated address has already received some lamports,
|
|
10409
|
+
// becoming a system account. Assuming program derived addressing is safe, this is the only case for the
|
|
10410
|
+
// TokenInvalidAccountOwnerError in this code path.
|
|
10411
|
+
if (error instanceof splToken.TokenAccountNotFoundError || error instanceof splToken.TokenInvalidAccountOwnerError) {
|
|
10412
|
+
// As this isn't atomic, it's possible others can create associated accounts meanwhile.
|
|
10413
|
+
tx.add(splToken.createAssociatedTokenAccountInstruction(publicKey, underlyingTokenATA, publicKey, new web3_js.PublicKey(poolInfo.underlyingMint.address), splToken.TOKEN_2022_PROGRAM_ID, splToken.ASSOCIATED_TOKEN_PROGRAM_ID));
|
|
10414
|
+
}
|
|
10415
|
+
}
|
|
10416
|
+
|
|
10417
|
+
// Approve allowance to the sentinel if the account is new or delegated amount is not enough
|
|
10418
|
+
const borrowAmountBN = new anchor.BN((_borrowAmountBNJson$t = borrowAmountBNJson === null || borrowAmountBNJson === void 0 ? void 0 : borrowAmountBNJson.toString()) !== null && _borrowAmountBNJson$t !== void 0 ? _borrowAmountBNJson$t : '0');
|
|
10419
|
+
if (!tokenAccount || borrowAmountBN.gt(new anchor.BN(tokenAccount.delegatedAmount.toString())) || ((_tokenAccount$delegat = tokenAccount.delegate) === null || _tokenAccount$delegat === void 0 ? void 0 : _tokenAccount$delegat.toString()) !== sentinel) {
|
|
10420
|
+
tx.add(splToken.createApproveCheckedInstruction(underlyingTokenATA, new web3_js.PublicKey(poolInfo.underlyingMint.address), new web3_js.PublicKey(sentinel),
|
|
10421
|
+
// delegate
|
|
10422
|
+
publicKey,
|
|
10423
|
+
// owner of the wallet
|
|
10424
|
+
BigInt(shared.SolanaTokenUtils.parseUnits('100000000000',
|
|
10425
|
+
// 100 billion
|
|
10426
|
+
poolInfo.underlyingMint.decimals).toString()),
|
|
10427
|
+
// amount
|
|
10428
|
+
poolInfo.underlyingMint.decimals, undefined,
|
|
10429
|
+
// multiSigners
|
|
10430
|
+
splToken.TOKEN_2022_PROGRAM_ID));
|
|
10431
|
+
}
|
|
10432
|
+
const {
|
|
10433
|
+
creditConfigAccount,
|
|
10434
|
+
creditStateAccount
|
|
10435
|
+
} = shared.getCreditAccounts(poolInfo, publicKey);
|
|
10436
|
+
// borrowAmountBNJson is stored as a raw number string in this flow
|
|
10437
|
+
const programTx = await program.methods.drawdown(borrowAmountBN).accountsPartial({
|
|
10438
|
+
borrower: publicKey,
|
|
10439
|
+
humaConfig: poolInfo.humaConfig,
|
|
10440
|
+
poolConfig: poolInfo.poolConfig,
|
|
10441
|
+
poolState: poolInfo.poolState,
|
|
10442
|
+
creditConfig: creditConfigAccount,
|
|
10443
|
+
creditState: creditStateAccount,
|
|
10444
|
+
poolAuthority: poolInfo.poolAuthority,
|
|
10445
|
+
underlyingMint: poolInfo.underlyingMint.address,
|
|
10446
|
+
poolUnderlyingToken: poolInfo.poolUnderlyingTokenAccount,
|
|
10447
|
+
borrowerUnderlyingToken: underlyingTokenATA,
|
|
10448
|
+
tokenProgram: splToken.TOKEN_2022_PROGRAM_ID
|
|
10449
|
+
}).transaction();
|
|
10450
|
+
tx.add(programTx);
|
|
10412
10451
|
setTransaction(tx);
|
|
10413
10452
|
}
|
|
10414
10453
|
getTx();
|
|
10415
|
-
}, [connection, dispatch, poolInfo.underlyingMint.address, poolInfo.underlyingMint.decimals,
|
|
10454
|
+
}, [borrowAmountBNJson, connection, dispatch, poolInfo, poolInfo.underlyingMint.address, poolInfo.underlyingMint.decimals, program.methods, publicKey, sentinel, wallet]);
|
|
10416
10455
|
return jsxRuntime.jsx(SolanaTxSendModal, {
|
|
10417
10456
|
tx: transaction,
|
|
10418
10457
|
chainId: poolInfo.chainId,
|
|
@@ -10420,9 +10459,34 @@ function ApproveAllowance(_ref) {
|
|
|
10420
10459
|
});
|
|
10421
10460
|
}
|
|
10422
10461
|
|
|
10462
|
+
function Done$1(_ref) {
|
|
10463
|
+
let {
|
|
10464
|
+
poolInfo,
|
|
10465
|
+
poolState,
|
|
10466
|
+
handleAction
|
|
10467
|
+
} = _ref;
|
|
10468
|
+
const {
|
|
10469
|
+
borrowAmount,
|
|
10470
|
+
solanaSignature
|
|
10471
|
+
} = useAppSelector(selectWidgetState);
|
|
10472
|
+
const {
|
|
10473
|
+
symbol
|
|
10474
|
+
} = poolInfo.underlyingMint;
|
|
10475
|
+
const dueDate = shared.timeUtil.timestampToLL(poolState.epochEndTime);
|
|
10476
|
+
const content = ["".concat(shared.formatNumber(borrowAmount), " ").concat(symbol, " is now in your wallet."), "Note: your first automatic payment will occur after ".concat(dueDate, ".")];
|
|
10477
|
+
return jsxRuntime.jsx(SolanaTxDoneModal, {
|
|
10478
|
+
handleAction: handleAction,
|
|
10479
|
+
content: content,
|
|
10480
|
+
chainId: poolInfo.chainId,
|
|
10481
|
+
solanaSignature: solanaSignature,
|
|
10482
|
+
buttonText: "DONE"
|
|
10483
|
+
});
|
|
10484
|
+
}
|
|
10485
|
+
|
|
10423
10486
|
function SolanaBorrow(_ref) {
|
|
10424
10487
|
let {
|
|
10425
10488
|
poolInfo,
|
|
10489
|
+
poolState,
|
|
10426
10490
|
handleClose,
|
|
10427
10491
|
handleSuccess
|
|
10428
10492
|
} = _ref;
|
|
@@ -10432,9 +10496,207 @@ function SolanaBorrow(_ref) {
|
|
|
10432
10496
|
loading: isLoadingBorrowerAccounts
|
|
10433
10497
|
} = webShared.useBorrowerAccounts(poolInfo.chainId, poolInfo.poolName);
|
|
10434
10498
|
const {
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
} =
|
|
10499
|
+
step,
|
|
10500
|
+
errorMessage
|
|
10501
|
+
} = useAppSelector(selectWidgetState);
|
|
10502
|
+
React.useEffect(() => {
|
|
10503
|
+
if (!step) {
|
|
10504
|
+
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
10505
|
+
}
|
|
10506
|
+
}, [dispatch, step]);
|
|
10507
|
+
const title = 'Borrow';
|
|
10508
|
+
if (isLoadingBorrowerAccounts) {
|
|
10509
|
+
return jsxRuntime.jsx(WidgetWrapper, {
|
|
10510
|
+
isOpen: true,
|
|
10511
|
+
isLoading: true,
|
|
10512
|
+
loadingTitle: title,
|
|
10513
|
+
handleClose: handleClose,
|
|
10514
|
+
handleSuccess: handleSuccess
|
|
10515
|
+
});
|
|
10516
|
+
}
|
|
10517
|
+
return jsxRuntime.jsxs(WidgetWrapper, {
|
|
10518
|
+
isOpen: true,
|
|
10519
|
+
loadingTitle: title,
|
|
10520
|
+
handleClose: handleClose,
|
|
10521
|
+
handleSuccess: handleSuccess,
|
|
10522
|
+
children: [step === WIDGET_STEP.ChooseAmount && creditConfigAccount && jsxRuntime.jsx(ChooseAmount$1, {
|
|
10523
|
+
poolInfo: poolInfo,
|
|
10524
|
+
creditConfigAccount: creditConfigAccount
|
|
10525
|
+
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer$1, {
|
|
10526
|
+
poolInfo: poolInfo
|
|
10527
|
+
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Done$1, {
|
|
10528
|
+
poolInfo: poolInfo,
|
|
10529
|
+
poolState: poolState,
|
|
10530
|
+
handleAction: handleClose
|
|
10531
|
+
}), step === WIDGET_STEP.Error && jsxRuntime.jsx(ErrorModal, {
|
|
10532
|
+
title: title,
|
|
10533
|
+
errorReason: "Sorry there was an error",
|
|
10534
|
+
errorMessage: errorMessage,
|
|
10535
|
+
handleOk: handleClose
|
|
10536
|
+
})]
|
|
10537
|
+
});
|
|
10538
|
+
}
|
|
10539
|
+
|
|
10540
|
+
function ChooseAmount(_ref) {
|
|
10541
|
+
let {
|
|
10542
|
+
poolInfo,
|
|
10543
|
+
creditStateAccount
|
|
10544
|
+
} = _ref;
|
|
10545
|
+
const dispatch = useAppDispatch();
|
|
10546
|
+
const {
|
|
10547
|
+
symbol,
|
|
10548
|
+
decimals
|
|
10549
|
+
} = poolInfo.underlyingMint;
|
|
10550
|
+
const [currentAmount, setCurrentAmount] = React.useState(0);
|
|
10551
|
+
const totalDueAmount = React.useMemo(() => Number(shared.SolanaTokenUtils.formatUnits(creditStateAccount.creditRecord.totalDueAmount, decimals)), [creditStateAccount.creditRecord.totalDueAmount, decimals]);
|
|
10552
|
+
const payoffAmount = React.useMemo(() => Number(shared.SolanaTokenUtils.formatUnits(creditStateAccount.creditRecord.payoffAmount, decimals)), [creditStateAccount.creditRecord.payoffAmount, decimals]);
|
|
10553
|
+
React.useEffect(() => {
|
|
10554
|
+
setCurrentAmount(totalDueAmount);
|
|
10555
|
+
dispatch(setPaymentAmount({
|
|
10556
|
+
paymentAmount: totalDueAmount
|
|
10557
|
+
}));
|
|
10558
|
+
}, [dispatch, totalDueAmount]);
|
|
10559
|
+
const handleChangeAmount = newAmount => {
|
|
10560
|
+
setCurrentAmount(newAmount);
|
|
10561
|
+
dispatch(setPaymentAmount({
|
|
10562
|
+
paymentAmount: newAmount
|
|
10563
|
+
}));
|
|
10564
|
+
};
|
|
10565
|
+
const handleAction = React.useCallback(() => {
|
|
10566
|
+
dispatch(setStep(WIDGET_STEP.Transfer));
|
|
10567
|
+
}, [dispatch]);
|
|
10568
|
+
return jsxRuntime.jsx(InputAmountModal, {
|
|
10569
|
+
title: "Make Payment",
|
|
10570
|
+
subTitle: "Choose Amount",
|
|
10571
|
+
tokenSymbol: symbol,
|
|
10572
|
+
currentAmount: currentAmount,
|
|
10573
|
+
handleChangeAmount: handleChangeAmount,
|
|
10574
|
+
maxAmount: payoffAmount,
|
|
10575
|
+
maxAmountText: "Pay Off",
|
|
10576
|
+
infos: ["".concat(shared.formatNumber(totalDueAmount.toFixed(0)), " Due")],
|
|
10577
|
+
handleAction: handleAction,
|
|
10578
|
+
actionText: "PAY"
|
|
10579
|
+
});
|
|
10580
|
+
}
|
|
10581
|
+
|
|
10582
|
+
function Transfer(_ref) {
|
|
10583
|
+
let {
|
|
10584
|
+
poolInfo
|
|
10585
|
+
} = _ref;
|
|
10586
|
+
const dispatch = useAppDispatch();
|
|
10587
|
+
const {
|
|
10588
|
+
wallet,
|
|
10589
|
+
publicKey
|
|
10590
|
+
} = walletAdapterReact.useWallet();
|
|
10591
|
+
const {
|
|
10592
|
+
connection
|
|
10593
|
+
} = walletAdapterReact.useConnection();
|
|
10594
|
+
const [transaction, setTransaction] = React.useState();
|
|
10595
|
+
const program = webShared.useHumaProgram(poolInfo.chainId);
|
|
10596
|
+
const {
|
|
10597
|
+
paymentAmount
|
|
10598
|
+
} = useAppSelector(selectWidgetState);
|
|
10599
|
+
const {
|
|
10600
|
+
decimals
|
|
10601
|
+
} = poolInfo.underlyingMint;
|
|
10602
|
+
const handleSuccess = React.useCallback(() => {
|
|
10603
|
+
dispatch(setStep(WIDGET_STEP.Done));
|
|
10604
|
+
}, [dispatch]);
|
|
10605
|
+
React.useEffect(() => {
|
|
10606
|
+
async function getTx() {
|
|
10607
|
+
if (!wallet || !publicKey || !connection || !paymentAmount) {
|
|
10608
|
+
return;
|
|
10609
|
+
}
|
|
10610
|
+
const {
|
|
10611
|
+
underlyingTokenATA
|
|
10612
|
+
} = shared.getTokenAccounts(poolInfo, publicKey);
|
|
10613
|
+
const {
|
|
10614
|
+
creditConfigAccount,
|
|
10615
|
+
creditStateAccount
|
|
10616
|
+
} = shared.getCreditAccounts(poolInfo, publicKey);
|
|
10617
|
+
const paymentAmountBN = shared.SolanaTokenUtils.parseUnits(paymentAmount.toString(), decimals);
|
|
10618
|
+
const tx = await program.methods.makePayment(paymentAmountBN).accountsPartial({
|
|
10619
|
+
signer: publicKey,
|
|
10620
|
+
humaConfig: poolInfo.humaConfig,
|
|
10621
|
+
poolConfig: poolInfo.poolConfig,
|
|
10622
|
+
poolState: poolInfo.poolState,
|
|
10623
|
+
creditConfig: creditConfigAccount,
|
|
10624
|
+
creditState: creditStateAccount,
|
|
10625
|
+
poolAuthority: poolInfo.poolAuthority,
|
|
10626
|
+
underlyingMint: poolInfo.underlyingMint.address,
|
|
10627
|
+
poolUnderlyingToken: poolInfo.poolUnderlyingTokenAccount,
|
|
10628
|
+
borrowerUnderlyingToken: underlyingTokenATA,
|
|
10629
|
+
tokenProgram: splToken.TOKEN_2022_PROGRAM_ID
|
|
10630
|
+
}).transaction();
|
|
10631
|
+
setTransaction(tx);
|
|
10632
|
+
}
|
|
10633
|
+
getTx();
|
|
10634
|
+
}, [connection, decimals, dispatch, paymentAmount, poolInfo, poolInfo.underlyingMint.address, poolInfo.underlyingMint.decimals, program.methods, publicKey, wallet]);
|
|
10635
|
+
return jsxRuntime.jsx(SolanaTxSendModal, {
|
|
10636
|
+
tx: transaction,
|
|
10637
|
+
chainId: poolInfo.chainId,
|
|
10638
|
+
handleSuccess: handleSuccess
|
|
10639
|
+
});
|
|
10640
|
+
}
|
|
10641
|
+
|
|
10642
|
+
function Done(_ref) {
|
|
10643
|
+
let {
|
|
10644
|
+
poolInfo,
|
|
10645
|
+
handleAction
|
|
10646
|
+
} = _ref;
|
|
10647
|
+
const {
|
|
10648
|
+
solanaSignature
|
|
10649
|
+
} = useAppSelector(selectWidgetState);
|
|
10650
|
+
const {
|
|
10651
|
+
symbol
|
|
10652
|
+
} = poolInfo.underlyingMint;
|
|
10653
|
+
const {
|
|
10654
|
+
connection
|
|
10655
|
+
} = walletAdapterReact.useConnection();
|
|
10656
|
+
const [tokensPaid, setTokensPaid] = React.useState(null);
|
|
10657
|
+
React.useEffect(() => {
|
|
10658
|
+
const fetchTokensPaid = async () => {
|
|
10659
|
+
var _txData$meta, _txData$meta2;
|
|
10660
|
+
if (!solanaSignature) {
|
|
10661
|
+
return;
|
|
10662
|
+
}
|
|
10663
|
+
const txData = await connection.getTransaction(solanaSignature, {
|
|
10664
|
+
maxSupportedTransactionVersion: 2
|
|
10665
|
+
});
|
|
10666
|
+
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;
|
|
10667
|
+
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;
|
|
10668
|
+
if (preTokenBalance && postTokenBalance) {
|
|
10669
|
+
setTokensPaid(preTokenBalance - postTokenBalance);
|
|
10670
|
+
}
|
|
10671
|
+
};
|
|
10672
|
+
fetchTokensPaid();
|
|
10673
|
+
}, [connection, solanaSignature]);
|
|
10674
|
+
const content = React.useMemo(() => {
|
|
10675
|
+
if (tokensPaid !== null) {
|
|
10676
|
+
return ["You successfully paid ".concat(shared.formatNumber(tokensPaid), " ").concat(symbol, ".")];
|
|
10677
|
+
}
|
|
10678
|
+
return ['Your payment to the pool was successful'];
|
|
10679
|
+
}, [tokensPaid, symbol]);
|
|
10680
|
+
return jsxRuntime.jsx(SolanaTxDoneModal, {
|
|
10681
|
+
handleAction: handleAction,
|
|
10682
|
+
content: content,
|
|
10683
|
+
chainId: poolInfo.chainId,
|
|
10684
|
+
solanaSignature: solanaSignature,
|
|
10685
|
+
buttonText: "DONE"
|
|
10686
|
+
});
|
|
10687
|
+
}
|
|
10688
|
+
|
|
10689
|
+
function SolanaPayment(_ref) {
|
|
10690
|
+
let {
|
|
10691
|
+
poolInfo,
|
|
10692
|
+
handleClose,
|
|
10693
|
+
handleSuccess
|
|
10694
|
+
} = _ref;
|
|
10695
|
+
const dispatch = reactRedux.useDispatch();
|
|
10696
|
+
const {
|
|
10697
|
+
creditStateAccount,
|
|
10698
|
+
loading: isLoadingBorrowerAccounts
|
|
10699
|
+
} = webShared.useBorrowerAccounts(poolInfo.chainId, poolInfo.poolName);
|
|
10438
10700
|
const {
|
|
10439
10701
|
step,
|
|
10440
10702
|
errorMessage
|
|
@@ -10444,8 +10706,8 @@ function SolanaBorrow(_ref) {
|
|
|
10444
10706
|
dispatch(setStep(WIDGET_STEP.ChooseAmount));
|
|
10445
10707
|
}
|
|
10446
10708
|
}, [dispatch, step]);
|
|
10447
|
-
const title = '
|
|
10448
|
-
if (isLoadingBorrowerAccounts
|
|
10709
|
+
const title = 'Make Payment';
|
|
10710
|
+
if (isLoadingBorrowerAccounts) {
|
|
10449
10711
|
return jsxRuntime.jsx(WidgetWrapper, {
|
|
10450
10712
|
isOpen: true,
|
|
10451
10713
|
isLoading: true,
|
|
@@ -10459,13 +10721,14 @@ function SolanaBorrow(_ref) {
|
|
|
10459
10721
|
loadingTitle: title,
|
|
10460
10722
|
handleClose: handleClose,
|
|
10461
10723
|
handleSuccess: handleSuccess,
|
|
10462
|
-
children: [step === WIDGET_STEP.ChooseAmount &&
|
|
10724
|
+
children: [step === WIDGET_STEP.ChooseAmount && creditStateAccount && jsxRuntime.jsx(ChooseAmount, {
|
|
10463
10725
|
poolInfo: poolInfo,
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10726
|
+
creditStateAccount: creditStateAccount
|
|
10727
|
+
}), step === WIDGET_STEP.Transfer && jsxRuntime.jsx(Transfer, {
|
|
10728
|
+
poolInfo: poolInfo
|
|
10729
|
+
}), step === WIDGET_STEP.Done && jsxRuntime.jsx(Done, {
|
|
10467
10730
|
poolInfo: poolInfo,
|
|
10468
|
-
|
|
10731
|
+
handleAction: handleClose
|
|
10469
10732
|
}), step === WIDGET_STEP.Error && jsxRuntime.jsx(ErrorModal, {
|
|
10470
10733
|
title: title,
|
|
10471
10734
|
errorReason: "Sorry there was an error",
|
|
@@ -10916,8 +11179,6 @@ function SolanaWidget(props) {
|
|
|
10916
11179
|
/**
|
|
10917
11180
|
* Lend pool supply widget props for Solana pools
|
|
10918
11181
|
* @typedef {Object} SolanaLendSupplyWidgetProps
|
|
10919
|
-
* @property {SolanaLendSupplyProps} SolanaLendSupplyProps - Specific widget props
|
|
10920
|
-
* @property {SolanaWidgetProps} SolanaWidgetProps - Widget general props.
|
|
10921
11182
|
*/
|
|
10922
11183
|
|
|
10923
11184
|
/**
|
|
@@ -10937,8 +11198,6 @@ function SolanaLendSupplyWidget(props) {
|
|
|
10937
11198
|
/**
|
|
10938
11199
|
* Lend pool supply widget props for Solana pools
|
|
10939
11200
|
* @typedef {Object} SolanaLendAddRedemptionWidgetProps
|
|
10940
|
-
* @property {SolanaLendSupplyProps} SolanaLendSupplyProps - Specific widget props
|
|
10941
|
-
* @property {SolanaWidgetProps} SolanaWidgetProps - Widget general props.
|
|
10942
11201
|
*/
|
|
10943
11202
|
|
|
10944
11203
|
/**
|
|
@@ -10958,8 +11217,6 @@ function SolanaLendAddRedemptionWidget(props) {
|
|
|
10958
11217
|
/**
|
|
10959
11218
|
* Lend pool supply widget props for Solana pools
|
|
10960
11219
|
* @typedef {Object} SolanaLendCancelRedemptionWidgetProps
|
|
10961
|
-
* @property {SolanaLendSupplyProps} SolanaLendSupplyProps - Specific widget props
|
|
10962
|
-
* @property {SolanaWidgetProps} SolanaWidgetProps - Widget general props.
|
|
10963
11220
|
*/
|
|
10964
11221
|
|
|
10965
11222
|
/**
|
|
@@ -10979,8 +11236,6 @@ function SolanaLendCancelRedemptionWidget(props) {
|
|
|
10979
11236
|
/**
|
|
10980
11237
|
* Lend pool supply widget props for Solana pools
|
|
10981
11238
|
* @typedef {Object} SolanaBorrowWidgetProps
|
|
10982
|
-
* @property {SolanaLendSupplyProps} SolanaLendSupplyProps - Specific widget props
|
|
10983
|
-
* @property {SolanaWidgetProps} SolanaWidgetProps - Widget general props.
|
|
10984
11239
|
*/
|
|
10985
11240
|
|
|
10986
11241
|
/**
|
|
@@ -10997,6 +11252,25 @@ function SolanaBorrowWidget(props) {
|
|
|
10997
11252
|
});
|
|
10998
11253
|
}
|
|
10999
11254
|
|
|
11255
|
+
/**
|
|
11256
|
+
* Lend pool supply widget props for Solana pools
|
|
11257
|
+
* @typedef {Object} SolanaPaymentWidgetProps
|
|
11258
|
+
*/
|
|
11259
|
+
|
|
11260
|
+
/**
|
|
11261
|
+
* Lend pool supply widget for Solana pools
|
|
11262
|
+
*
|
|
11263
|
+
* @param {SolanaPaymentWidgetProps} props - Widget props
|
|
11264
|
+
*/
|
|
11265
|
+
function SolanaPaymentWidget(props) {
|
|
11266
|
+
return jsxRuntime.jsx(SolanaWidget, {
|
|
11267
|
+
...props,
|
|
11268
|
+
children: jsxRuntime.jsx(SolanaPayment, {
|
|
11269
|
+
...props
|
|
11270
|
+
})
|
|
11271
|
+
});
|
|
11272
|
+
}
|
|
11273
|
+
|
|
11000
11274
|
exports.AddRedemptionWidgetV2 = AddRedemptionWidgetV2;
|
|
11001
11275
|
exports.AutoPaybackWidgetV2 = AutoPaybackWidgetV2;
|
|
11002
11276
|
exports.CancelRedemptionWidgetV2 = CancelRedemptionWidgetV2;
|
|
@@ -11017,6 +11291,7 @@ exports.SolanaBorrowWidget = SolanaBorrowWidget;
|
|
|
11017
11291
|
exports.SolanaLendAddRedemptionWidget = SolanaLendAddRedemptionWidget;
|
|
11018
11292
|
exports.SolanaLendCancelRedemptionWidget = SolanaLendCancelRedemptionWidget;
|
|
11019
11293
|
exports.SolanaLendSupplyWidget = SolanaLendSupplyWidget;
|
|
11294
|
+
exports.SolanaPaymentWidget = SolanaPaymentWidget;
|
|
11020
11295
|
exports.SuperfluidFactoringWidget = SuperfluidFactoringWidget;
|
|
11021
11296
|
exports.SupplyFirstLossCoverWidget = SupplyFirstLossCoverWidget;
|
|
11022
11297
|
//# sourceMappingURL=index.cjs.map
|