@drift-labs/vaults-sdk 0.1.117 → 0.1.119

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))) {
@@ -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) {
@@ -535,7 +537,9 @@ class VaultClient {
535
537
  },
536
538
  remainingAccounts,
537
539
  });
538
- return await this.createAndSendTxn([withdrawIx]);
540
+ return await this.createAndSendTxn([withdrawIx], {
541
+ units: 650000,
542
+ });
539
543
  }
540
544
  }
541
545
  async forceWithdraw(vaultDepositor) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/vaults-sdk",
3
- "version": "0.1.117",
3
+ "version": "0.1.119",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "directories": {
@@ -773,7 +773,9 @@ export class VaultClient {
773
773
  }
774
774
  );
775
775
 
776
- return await this.createAndSendTxn([requestWithdrawIx]);
776
+ return await this.createAndSendTxn([requestWithdrawIx], {
777
+ units: 650_000,
778
+ });
777
779
  }
778
780
  }
779
781
 
@@ -841,7 +843,9 @@ export class VaultClient {
841
843
  remainingAccounts,
842
844
  });
843
845
 
844
- return await this.createAndSendTxn([withdrawIx]);
846
+ return await this.createAndSendTxn([withdrawIx], {
847
+ units: 650_000,
848
+ });
845
849
  }
846
850
  }
847
851