@orderly.network/vaults 2.8.10 → 2.8.11-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +20 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -1141,7 +1141,10 @@ var init_vault_deposit_form_script = __esm({
|
|
|
1141
1141
|
});
|
|
1142
1142
|
const { holding } = hooks.useCollateral();
|
|
1143
1143
|
const { t } = i18n.useTranslation();
|
|
1144
|
-
const
|
|
1144
|
+
const currentVault = React.useMemo(() => {
|
|
1145
|
+
return vaultInfo.data.find((v) => v.vault_id === vaultId);
|
|
1146
|
+
}, [vaultInfo.data, vaultId]);
|
|
1147
|
+
const minDepositAmount = currentVault?.min_deposit_amount || 0;
|
|
1145
1148
|
const maxWithdrawalAmount = hooks.useMaxWithdrawal("USDC");
|
|
1146
1149
|
const availableBalance = React.useMemo(() => {
|
|
1147
1150
|
return holding?.find((h) => h.token === "USDC")?.holding || 0;
|
|
@@ -1149,10 +1152,7 @@ var init_vault_deposit_form_script = __esm({
|
|
|
1149
1152
|
const maxQuantity = React.useMemo(() => {
|
|
1150
1153
|
return Math.min(maxWithdrawalAmount, availableBalance);
|
|
1151
1154
|
}, [maxWithdrawalAmount, availableBalance]);
|
|
1152
|
-
const sharePrice =
|
|
1153
|
-
const vault = vaultInfo.data.find((v) => v.vault_id === vaultId);
|
|
1154
|
-
return vault?.est_main_share_price;
|
|
1155
|
-
}, [vaultInfo.data, vaultId]);
|
|
1155
|
+
const sharePrice = currentVault?.est_main_share_price;
|
|
1156
1156
|
const shares = React.useMemo(() => {
|
|
1157
1157
|
if (!sharePrice || !quantity) {
|
|
1158
1158
|
return "-";
|
|
@@ -1186,7 +1186,7 @@ var init_vault_deposit_form_script = __esm({
|
|
|
1186
1186
|
};
|
|
1187
1187
|
const disabledDeposit = React.useMemo(() => {
|
|
1188
1188
|
return !quantity || quantity === "0" || disabledOperation || !!quantity && new utils.Decimal(quantity).lt(minDepositAmount);
|
|
1189
|
-
}, [quantity, disabledOperation]);
|
|
1189
|
+
}, [quantity, disabledOperation, minDepositAmount]);
|
|
1190
1190
|
const inputHint = React.useMemo(() => {
|
|
1191
1191
|
if (quantity && new utils.Decimal(quantity).lt(minDepositAmount)) {
|
|
1192
1192
|
return {
|
|
@@ -1200,7 +1200,7 @@ var init_vault_deposit_form_script = __esm({
|
|
|
1200
1200
|
hintMessage: "",
|
|
1201
1201
|
status: ""
|
|
1202
1202
|
};
|
|
1203
|
-
}, [quantity,
|
|
1203
|
+
}, [quantity, minDepositAmount, t]);
|
|
1204
1204
|
return {
|
|
1205
1205
|
quantity,
|
|
1206
1206
|
onQuantityChange,
|
|
@@ -1432,10 +1432,11 @@ var init_vault_withdraw_form_script = __esm({
|
|
|
1432
1432
|
const vaultLpInfo = exports.useVaultLpInfoById(vaultId);
|
|
1433
1433
|
const { vaultInfo } = exports.useVaultsStore();
|
|
1434
1434
|
const { t } = i18n.useTranslation();
|
|
1435
|
-
const
|
|
1436
|
-
|
|
1437
|
-
return vault?.est_main_share_price || 0;
|
|
1435
|
+
const currentVault = React.useMemo(() => {
|
|
1436
|
+
return vaultInfo.data.find((v) => v.vault_id === vaultId);
|
|
1438
1437
|
}, [vaultInfo.data, vaultId]);
|
|
1438
|
+
const sharePrice = currentVault?.est_main_share_price || 0;
|
|
1439
|
+
const minWithdrawalAmount = currentVault?.min_withdrawal_amount || 0;
|
|
1439
1440
|
const maxQuantity = vaultLpInfo?.[0]?.available_main_shares || 0;
|
|
1440
1441
|
const receivingAmount = React.useMemo(() => {
|
|
1441
1442
|
if (!quantity || !sharePrice) {
|
|
@@ -1457,25 +1458,22 @@ var init_vault_withdraw_form_script = __esm({
|
|
|
1457
1458
|
}
|
|
1458
1459
|
};
|
|
1459
1460
|
const isMinAmount = React.useMemo(() => {
|
|
1460
|
-
if (!quantity || !
|
|
1461
|
-
return false;
|
|
1461
|
+
if (!quantity || !sharePrice || !minWithdrawalAmount) return false;
|
|
1462
1462
|
const isAll = quantity === maxQuantity.toString();
|
|
1463
1463
|
if (isAll) {
|
|
1464
1464
|
return false;
|
|
1465
1465
|
}
|
|
1466
|
-
const receiving = new utils.Decimal(quantity).mul(
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
return receiving.lt(vaultInfo.data[0]?.min_withdrawal_amount);
|
|
1470
|
-
}, [quantity, vaultInfo, maxQuantity]);
|
|
1466
|
+
const receiving = new utils.Decimal(quantity).mul(sharePrice);
|
|
1467
|
+
return receiving.lt(minWithdrawalAmount);
|
|
1468
|
+
}, [quantity, sharePrice, minWithdrawalAmount, maxQuantity]);
|
|
1471
1469
|
const disabledWithdraw = React.useMemo(() => {
|
|
1472
1470
|
return !quantity || quantity === "0" || disabledOperation || !!quantity && isMinAmount;
|
|
1473
|
-
}, [quantity, disabledOperation]);
|
|
1471
|
+
}, [quantity, disabledOperation, isMinAmount]);
|
|
1474
1472
|
const inputHint = React.useMemo(() => {
|
|
1475
1473
|
if (quantity && isMinAmount) {
|
|
1476
1474
|
return {
|
|
1477
1475
|
hintMessage: t("vaults.operation.error.minWithdrawal", {
|
|
1478
|
-
amount:
|
|
1476
|
+
amount: minWithdrawalAmount
|
|
1479
1477
|
}),
|
|
1480
1478
|
status: "error"
|
|
1481
1479
|
};
|
|
@@ -1484,7 +1482,7 @@ var init_vault_withdraw_form_script = __esm({
|
|
|
1484
1482
|
hintMessage: "",
|
|
1485
1483
|
status: ""
|
|
1486
1484
|
};
|
|
1487
|
-
}, [quantity, t]);
|
|
1485
|
+
}, [quantity, isMinAmount, minWithdrawalAmount, t]);
|
|
1488
1486
|
return {
|
|
1489
1487
|
quantity,
|
|
1490
1488
|
onQuantityChange,
|
|
@@ -2419,6 +2417,7 @@ var init_vaults_list = __esm({
|
|
|
2419
2417
|
aValue = a.lifetime_apy;
|
|
2420
2418
|
bValue = b.lifetime_apy;
|
|
2421
2419
|
break;
|
|
2420
|
+
// For deposits, pnl, balance - these need LP info which we'll handle in VaultListRow
|
|
2422
2421
|
default:
|
|
2423
2422
|
return 0;
|
|
2424
2423
|
}
|
|
@@ -2939,5 +2938,5 @@ exports.getVaultInfo = getVaultInfo;
|
|
|
2939
2938
|
exports.getVaultLpInfo = getVaultLpInfo;
|
|
2940
2939
|
exports.getVaultLpPerformance = getVaultLpPerformance;
|
|
2941
2940
|
exports.getVaultOverallInfo = getVaultOverallInfo;
|
|
2942
|
-
//# sourceMappingURL=
|
|
2941
|
+
//# sourceMappingURL=index.js.map
|
|
2943
2942
|
//# sourceMappingURL=index.js.map
|