@drift-labs/vaults-sdk 0.1.117 → 0.1.118
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.
|
@@ -50,8 +50,16 @@ export const vaultInvariantChecks = async (program: Command, cmdOpts: OptionValu
|
|
|
50
50
|
for (const vd of allVaultDepositors) {
|
|
51
51
|
totalUserShares = totalUserShares.add(vd.account.vaultShares);
|
|
52
52
|
if (!vd.account.lastWithdrawRequest.shares.eq(new BN(0))) {
|
|
53
|
+
const withdrawRequested = vd.account.lastWithdrawRequest.ts.toNumber();
|
|
54
|
+
const secToWithdrawal = withdrawRequested + vault.redeemPeriod.toNumber() - Date.now() / 1000;
|
|
55
|
+
const withdrawAvailable = secToWithdrawal < 0;
|
|
56
|
+
|
|
53
57
|
const pct = vd.account.lastWithdrawRequest.shares.toNumber() / vd.account.vaultShares.toNumber();
|
|
54
58
|
console.log(`Vd has withdrawal ${vd.publicKey.toBase58()} (auth: ${vd.account.authority.toBase58()}): ${vd.account.lastWithdrawRequest.shares.toString()} ($${convertToNumber(vd.account.lastWithdrawRequest.value, spotPrecision)}), ${(pct * 100.00).toFixed(2)}%`);
|
|
59
|
+
console.log(` - requested at: ${new Date(withdrawRequested * 1000).toISOString()}`);
|
|
60
|
+
const daysUntilWithdraw = Math.floor(secToWithdrawal / 86400);
|
|
61
|
+
const hoursUntilWithdraw = Math.floor((secToWithdrawal % 86400) / 3600);
|
|
62
|
+
console.log(` - can withdraw in: ${daysUntilWithdraw} days and ${hoursUntilWithdraw} hours ${withdrawAvailable ? "<--- WITHDRAWABLE" : ""}`);
|
|
55
63
|
}
|
|
56
64
|
|
|
57
65
|
if (!vd.account.cumulativeProfitShareAmount.eq(new BN(0))) {
|
package/lib/vaultClient.js
CHANGED
|
@@ -490,7 +490,9 @@ class VaultClient {
|
|
|
490
490
|
},
|
|
491
491
|
remainingAccounts,
|
|
492
492
|
});
|
|
493
|
-
return await this.createAndSendTxn([requestWithdrawIx]
|
|
493
|
+
return await this.createAndSendTxn([requestWithdrawIx], {
|
|
494
|
+
units: 650000,
|
|
495
|
+
});
|
|
494
496
|
}
|
|
495
497
|
}
|
|
496
498
|
async withdraw(vaultDepositor) {
|
package/package.json
CHANGED