@oydual31/more-vaults-sdk 1.1.22 → 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.
@@ -390,6 +390,12 @@ var ActionType = {
390
390
 
391
391
  // src/ethers/abis.ts
392
392
  var VAULT_ABI = [
393
+ // Errors (for proper revert decoding)
394
+ "error WithdrawalQueueDisabled()",
395
+ "error WithdrawalQueueEnabled()",
396
+ "error RequestWithdrawDisabled()",
397
+ "error CantProcessWithdrawRequest()",
398
+ "error FunctionDoesNotExist()",
393
399
  // ERC4626 core
394
400
  "function deposit(uint256 assets, address receiver) returns (uint256 shares)",
395
401
  "function mint(uint256 shares, address receiver) returns (uint256 assets)",
@@ -606,6 +612,18 @@ var WhitelistQuotaExhaustedError = class extends MoreVaultsError {
606
612
  this.name = "WhitelistQuotaExhaustedError";
607
613
  }
608
614
  };
615
+ var WithdrawalQueueDisabledError = class extends MoreVaultsError {
616
+ constructor(vault) {
617
+ super(`[MoreVaults] Withdrawal queue is disabled on vault ${vault}. Cannot call requestRedeem/requestWithdraw \u2014 use redeemShares/withdrawAssets directly, or smartRedeem which auto-selects the correct flow.`);
618
+ this.name = "WithdrawalQueueDisabledError";
619
+ }
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
+ };
609
627
  var InsufficientLiquidityError = class extends MoreVaultsError {
610
628
  hubLiquid;
611
629
  required;
@@ -1449,6 +1467,12 @@ function parseContractError(err, vault, caller) {
1449
1467
  if (msg.includes("EnforcedPause") || msg.includes("Pausable: paused")) {
1450
1468
  throw new VaultPausedError(vault);
1451
1469
  }
1470
+ if (msg.includes("WithdrawalQueueDisabled") || msg.includes("0xdbb22fbf")) {
1471
+ throw new WithdrawalQueueDisabledError(vault);
1472
+ }
1473
+ if (msg.includes("CantProcessWithdrawRequest") || msg.includes("0x8cbe9e8b")) {
1474
+ throw new CantProcessWithdrawRequestError(vault);
1475
+ }
1452
1476
  if (msg.includes("NotCurator") || msg.includes("OwnableUnauthorizedAccount")) {
1453
1477
  if (msg.includes("NotCurator")) {
1454
1478
  throw new NotCuratorError(vault, "unknown");
@@ -1798,6 +1822,16 @@ async function withdrawAssets(signer, addresses, assets, receiver, owner) {
1798
1822
  async function requestRedeem(signer, addresses, shares, owner) {
1799
1823
  if (shares === 0n) throw new InvalidInputError("shares amount must be greater than zero");
1800
1824
  await validateWalletChain(signer, addresses.hubChainId);
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;
1834
+ }
1801
1835
  let useLegacy = false;
1802
1836
  const vaultNew = new ethers.Contract(addresses.vault, VAULT_ABI, signer);
1803
1837
  try {
@@ -3739,6 +3773,7 @@ exports.CHAIN_IDS = CHAIN_IDS;
3739
3773
  exports.CHAIN_ID_TO_EID = CHAIN_ID_TO_EID;
3740
3774
  exports.CONFIG_ABI = CONFIG_ABI;
3741
3775
  exports.CURATOR_CONFIG_ABI = CURATOR_CONFIG_ABI;
3776
+ exports.CantProcessWithdrawRequestError = CantProcessWithdrawRequestError;
3742
3777
  exports.CapacityFullError = CapacityFullError;
3743
3778
  exports.ComposeAlreadyExecutedError = ComposeAlreadyExecutedError;
3744
3779
  exports.ComposeTimeoutError = ComposeTimeoutError;
@@ -3781,6 +3816,7 @@ exports.VAULT_ABI = VAULT_ABI;
3781
3816
  exports.VAULT_ANALYSIS_ABI = VAULT_ANALYSIS_ABI;
3782
3817
  exports.VaultPausedError = VaultPausedError;
3783
3818
  exports.WhitelistQuotaExhaustedError = WhitelistQuotaExhaustedError;
3819
+ exports.WithdrawalQueueDisabledError = WithdrawalQueueDisabledError;
3784
3820
  exports.WithdrawalTimelockActiveError = WithdrawalTimelockActiveError;
3785
3821
  exports.WrongChainError = WrongChainError;
3786
3822
  exports.acceptOwnership = acceptOwnership;