@oydual31/more-vaults-sdk 1.1.23 → 1.1.24

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.
@@ -394,6 +394,8 @@ var VAULT_ABI = [
394
394
  "error WithdrawalQueueDisabled()",
395
395
  "error WithdrawalQueueEnabled()",
396
396
  "error RequestWithdrawDisabled()",
397
+ "error CantProcessWithdrawRequest()",
398
+ "error FunctionDoesNotExist()",
397
399
  // ERC4626 core
398
400
  "function deposit(uint256 assets, address receiver) returns (uint256 shares)",
399
401
  "function mint(uint256 shares, address receiver) returns (uint256 assets)",
@@ -616,6 +618,12 @@ var WithdrawalQueueDisabledError = class extends MoreVaultsError {
616
618
  this.name = "WithdrawalQueueDisabledError";
617
619
  }
618
620
  };
621
+ var CantProcessWithdrawRequestError = class extends MoreVaultsError {
622
+ constructor(vault) {
623
+ super(`[MoreVaults] Cannot process withdraw on vault ${vault}: the withdrawal queue is enabled and there is no valid pending request, or its timelock has not expired. Call requestRedeem first and wait for the timelock, or use smartRedeem which handles the full lifecycle.`);
624
+ this.name = "CantProcessWithdrawRequestError";
625
+ }
626
+ };
619
627
  var InsufficientLiquidityError = class extends MoreVaultsError {
620
628
  hubLiquid;
621
629
  required;
@@ -1462,6 +1470,9 @@ function parseContractError(err, vault, caller) {
1462
1470
  if (msg.includes("WithdrawalQueueDisabled") || msg.includes("0xdbb22fbf")) {
1463
1471
  throw new WithdrawalQueueDisabledError(vault);
1464
1472
  }
1473
+ if (msg.includes("CantProcessWithdrawRequest") || msg.includes("0x8cbe9e8b")) {
1474
+ throw new CantProcessWithdrawRequestError(vault);
1475
+ }
1465
1476
  if (msg.includes("NotCurator") || msg.includes("OwnableUnauthorizedAccount")) {
1466
1477
  if (msg.includes("NotCurator")) {
1467
1478
  throw new NotCuratorError(vault, "unknown");
@@ -1811,11 +1822,15 @@ async function withdrawAssets(signer, addresses, assets, receiver, owner) {
1811
1822
  async function requestRedeem(signer, addresses, shares, owner) {
1812
1823
  if (shares === 0n) throw new InvalidInputError("shares amount must be greater than zero");
1813
1824
  await validateWalletChain(signer, addresses.hubChainId);
1814
- const provider = signer.provider;
1815
- const configRead = new ethers.Contract(addresses.vault, ["function getWithdrawalQueueStatus() view returns (bool)"], provider);
1816
- const queueEnabled = await configRead.getWithdrawalQueueStatus();
1817
- if (!queueEnabled) {
1818
- throw new WithdrawalQueueDisabledError(addresses.vault);
1825
+ try {
1826
+ const provider = signer.provider;
1827
+ const configRead = new ethers.Contract(addresses.vault, ["function getWithdrawalQueueStatus() view returns (bool)"], provider);
1828
+ const queueEnabled = await configRead.getWithdrawalQueueStatus();
1829
+ if (!queueEnabled) {
1830
+ throw new WithdrawalQueueDisabledError(addresses.vault);
1831
+ }
1832
+ } catch (err) {
1833
+ if (err instanceof WithdrawalQueueDisabledError) throw err;
1819
1834
  }
1820
1835
  let useLegacy = false;
1821
1836
  const vaultNew = new ethers.Contract(addresses.vault, VAULT_ABI, signer);
@@ -3758,6 +3773,7 @@ exports.CHAIN_IDS = CHAIN_IDS;
3758
3773
  exports.CHAIN_ID_TO_EID = CHAIN_ID_TO_EID;
3759
3774
  exports.CONFIG_ABI = CONFIG_ABI;
3760
3775
  exports.CURATOR_CONFIG_ABI = CURATOR_CONFIG_ABI;
3776
+ exports.CantProcessWithdrawRequestError = CantProcessWithdrawRequestError;
3761
3777
  exports.CapacityFullError = CapacityFullError;
3762
3778
  exports.ComposeAlreadyExecutedError = ComposeAlreadyExecutedError;
3763
3779
  exports.ComposeTimeoutError = ComposeTimeoutError;