@oydual31/more-vaults-sdk 1.1.15 → 1.1.16
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 +31 -0
- package/dist/ethers/index.cjs.map +1 -1
- package/dist/ethers/index.d.cts +6 -1
- package/dist/ethers/index.d.ts +6 -1
- package/dist/ethers/index.js +31 -1
- package/dist/ethers/index.js.map +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/viem/index.cjs +31 -0
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +6 -1
- package/dist/viem/index.d.ts +6 -1
- package/dist/viem/index.js +31 -1
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/ethers/errors.ts +15 -0
- package/src/ethers/index.ts +1 -0
- package/src/ethers/redeemFlows.ts +28 -2
- package/src/viem/errors.ts +15 -0
- package/src/viem/index.ts +1 -0
- package/src/viem/redeemFlows.ts +28 -2
package/dist/ethers/index.cjs
CHANGED
|
@@ -742,6 +742,19 @@ var ComposeTimeoutError = class extends MoreVaultsError {
|
|
|
742
742
|
this.guid = guid;
|
|
743
743
|
}
|
|
744
744
|
};
|
|
745
|
+
var WithdrawalTimelockActiveError = class extends MoreVaultsError {
|
|
746
|
+
timelockEndsAt;
|
|
747
|
+
requestTxHash;
|
|
748
|
+
constructor(vault, timelockEndsAt, requestTxHash) {
|
|
749
|
+
const date = new Date(Number(timelockEndsAt) * 1e3).toISOString();
|
|
750
|
+
super(
|
|
751
|
+
`[MoreVaults] Withdrawal timelock on vault ${vault} is active until ${date}. Call smartRedeem again after the timelock expires to complete the withdrawal.`
|
|
752
|
+
);
|
|
753
|
+
this.name = "WithdrawalTimelockActiveError";
|
|
754
|
+
this.timelockEndsAt = timelockEndsAt;
|
|
755
|
+
this.requestTxHash = requestTxHash;
|
|
756
|
+
}
|
|
757
|
+
};
|
|
745
758
|
var STARGATE_TYPE_ABI = [
|
|
746
759
|
"function stargateType() view returns (uint8)"
|
|
747
760
|
];
|
|
@@ -1867,6 +1880,23 @@ async function smartRedeem(signer, addresses, shares, receiver, owner, extraOpti
|
|
|
1867
1880
|
const lzFee = await quoteLzFee(provider, vault, extraOptions);
|
|
1868
1881
|
return redeemAsync(signer, addresses, shares, receiver, owner, lzFee, extraOptions);
|
|
1869
1882
|
}
|
|
1883
|
+
if (status.withdrawalQueueEnabled) {
|
|
1884
|
+
const pending = await getWithdrawalRequest(provider, vault, owner);
|
|
1885
|
+
const now = BigInt(Math.floor(Date.now() / 1e3));
|
|
1886
|
+
if (pending && (pending.timelockEndsAt === 0n || now >= pending.timelockEndsAt)) {
|
|
1887
|
+
return redeemShares(signer, addresses, shares, receiver, owner);
|
|
1888
|
+
}
|
|
1889
|
+
if (pending) {
|
|
1890
|
+
throw new WithdrawalTimelockActiveError(vault, pending.timelockEndsAt);
|
|
1891
|
+
}
|
|
1892
|
+
if (status.withdrawalTimelockSeconds === 0n) {
|
|
1893
|
+
await requestRedeem(signer, addresses, shares, owner);
|
|
1894
|
+
return redeemShares(signer, addresses, shares, receiver, owner);
|
|
1895
|
+
}
|
|
1896
|
+
const { receipt } = await requestRedeem(signer, addresses, shares, owner);
|
|
1897
|
+
const timelockEndsAt = now + status.withdrawalTimelockSeconds;
|
|
1898
|
+
throw new WithdrawalTimelockActiveError(vault, timelockEndsAt, receipt?.hash);
|
|
1899
|
+
}
|
|
1870
1900
|
return redeemShares(signer, addresses, shares, receiver, owner);
|
|
1871
1901
|
}
|
|
1872
1902
|
async function bridgeAssetsToSpoke(signer, assetOFT, spokeChainEid, amount, receiver, lzFee, isStargate = true) {
|
|
@@ -3612,6 +3642,7 @@ exports.UnsupportedChainError = UnsupportedChainError;
|
|
|
3612
3642
|
exports.VAULT_ABI = VAULT_ABI;
|
|
3613
3643
|
exports.VAULT_ANALYSIS_ABI = VAULT_ANALYSIS_ABI;
|
|
3614
3644
|
exports.VaultPausedError = VaultPausedError;
|
|
3645
|
+
exports.WithdrawalTimelockActiveError = WithdrawalTimelockActiveError;
|
|
3615
3646
|
exports.WrongChainError = WrongChainError;
|
|
3616
3647
|
exports.acceptOwnership = acceptOwnership;
|
|
3617
3648
|
exports.addAvailableAsset = addAvailableAsset;
|