@oydual31/more-vaults-sdk 1.1.18 → 1.1.19
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/ethers/index.cjs +21 -5
- package/dist/ethers/index.cjs.map +1 -1
- package/dist/ethers/index.d.cts +14 -4
- package/dist/ethers/index.d.ts +14 -4
- package/dist/ethers/index.js +21 -6
- package/dist/ethers/index.js.map +1 -1
- package/dist/react/index.cjs +27 -5
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +27 -5
- package/dist/react/index.js.map +1 -1
- package/dist/viem/index.cjs +28 -5
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +14 -4
- package/dist/viem/index.d.ts +14 -4
- package/dist/viem/index.js +28 -6
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/ethers/depositFlows.ts +1 -1
- package/src/ethers/errors.ts +7 -0
- package/src/ethers/index.ts +1 -0
- package/src/ethers/preflight.ts +30 -10
- package/src/viem/depositFlows.ts +1 -1
- package/src/viem/errors.ts +7 -0
- package/src/viem/index.ts +1 -0
- package/src/viem/preflight.ts +37 -10
package/dist/ethers/index.cjs
CHANGED
|
@@ -600,6 +600,12 @@ var NotWhitelistedError = class extends MoreVaultsError {
|
|
|
600
600
|
this.name = "NotWhitelistedError";
|
|
601
601
|
}
|
|
602
602
|
};
|
|
603
|
+
var WhitelistQuotaExhaustedError = class extends MoreVaultsError {
|
|
604
|
+
constructor(vault, user) {
|
|
605
|
+
super(`[MoreVaults] Address ${user} has no remaining whitelist deposit quota on vault ${vault}. Ask the vault owner to increase your deposit cap.`);
|
|
606
|
+
this.name = "WhitelistQuotaExhaustedError";
|
|
607
|
+
}
|
|
608
|
+
};
|
|
603
609
|
var InsufficientLiquidityError = class extends MoreVaultsError {
|
|
604
610
|
hubLiquid;
|
|
605
611
|
required;
|
|
@@ -1297,17 +1303,26 @@ async function preflightRedeemLiquidity(provider, vault, shares) {
|
|
|
1297
1303
|
throw new InsufficientLiquidityError(vault, hubLiquid, assetsNeeded);
|
|
1298
1304
|
}
|
|
1299
1305
|
}
|
|
1300
|
-
async function preflightSync(provider, vault) {
|
|
1306
|
+
async function preflightSync(provider, vault, user) {
|
|
1301
1307
|
const config = new ethers.Contract(vault, CONFIG_ABI, provider);
|
|
1302
1308
|
const [isPaused, depositCapResult] = await Promise.all([
|
|
1303
1309
|
config.paused(),
|
|
1304
|
-
config.maxDeposit(
|
|
1310
|
+
config.maxDeposit(user).catch(() => null)
|
|
1305
1311
|
]);
|
|
1306
1312
|
if (isPaused) {
|
|
1307
1313
|
throw new VaultPausedError(vault);
|
|
1308
1314
|
}
|
|
1309
|
-
if (depositCapResult
|
|
1310
|
-
|
|
1315
|
+
if (depositCapResult === null) return;
|
|
1316
|
+
if (depositCapResult === 0n) {
|
|
1317
|
+
const vaultContract = new ethers.Contract(vault, VAULT_ABI, provider);
|
|
1318
|
+
const [capacity, assets] = await Promise.all([
|
|
1319
|
+
config.depositCapacity(),
|
|
1320
|
+
vaultContract.totalAssets()
|
|
1321
|
+
]);
|
|
1322
|
+
if (capacity > 0n && assets >= capacity) {
|
|
1323
|
+
throw new CapacityFullError(vault);
|
|
1324
|
+
}
|
|
1325
|
+
throw new WhitelistQuotaExhaustedError(vault, user);
|
|
1311
1326
|
}
|
|
1312
1327
|
}
|
|
1313
1328
|
async function preflightSpokeDeposit(spokeProvider, vault, spokeOFT, hubEid, spokeEid, amount, userAddress, lzFee) {
|
|
@@ -1479,7 +1494,7 @@ async function depositSimple(signer, addresses, assets, receiver) {
|
|
|
1479
1494
|
if (assets === 0n) throw new InvalidInputError("deposit amount must be greater than zero");
|
|
1480
1495
|
const provider = signer.provider;
|
|
1481
1496
|
await validateWalletChain(signer, addresses.hubChainId);
|
|
1482
|
-
await preflightSync(provider, addresses.vault);
|
|
1497
|
+
await preflightSync(provider, addresses.vault, receiver);
|
|
1483
1498
|
const vault = new ethers.Contract(addresses.vault, VAULT_ABI, signer);
|
|
1484
1499
|
const underlying = await vault.asset();
|
|
1485
1500
|
await ensureAllowance3(signer, underlying, addresses.vault, assets);
|
|
@@ -3743,6 +3758,7 @@ exports.UnsupportedChainError = UnsupportedChainError;
|
|
|
3743
3758
|
exports.VAULT_ABI = VAULT_ABI;
|
|
3744
3759
|
exports.VAULT_ANALYSIS_ABI = VAULT_ANALYSIS_ABI;
|
|
3745
3760
|
exports.VaultPausedError = VaultPausedError;
|
|
3761
|
+
exports.WhitelistQuotaExhaustedError = WhitelistQuotaExhaustedError;
|
|
3746
3762
|
exports.WithdrawalTimelockActiveError = WithdrawalTimelockActiveError;
|
|
3747
3763
|
exports.WrongChainError = WrongChainError;
|
|
3748
3764
|
exports.acceptOwnership = acceptOwnership;
|