@drift-labs/vaults-sdk 0.7.7 → 0.7.9

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/cli/cli.ts CHANGED
@@ -31,6 +31,7 @@ import { managerApplyProfitShare } from "./commands/managerApplyProfitShare";
31
31
  import { managerUpdateFees } from "./commands/managerUpdateFees";
32
32
  import { adminInitFeeUpdate } from "./commands/adminInitFeeUpdate";
33
33
  import { adminDeleteFeeUpdate } from "./commands/adminDeleteFeeUpdate";
34
+ import { managerUpdateFuelDistributionMode } from "./commands/managerUpdateFuelDistributionMode";
34
35
 
35
36
  const program = new Command();
36
37
  program
@@ -235,6 +236,14 @@ program
235
236
  .addOption(new Option("--dump-transaction-message", "Dump the transaction message to the console").makeOptionMandatory(false))
236
237
  .action((opts) => adminDeleteFeeUpdate(program, opts));
237
238
 
239
+ program
240
+ .command("manager-update-fuel-distribution-mode")
241
+ .description("Update the fuel distribution mode for a vault")
242
+ .addOption(new Option("--vault-address <address>", "Address of the vault to update").makeOptionMandatory(true))
243
+ .addOption(new Option("--fuel-distribution-mode <mode>", "New fuel distribution mode (users-only, users-and-manager)").makeOptionMandatory(true))
244
+ .addOption(new Option("--dump-transaction-message", "Dump the transaction message to the console").makeOptionMandatory(false))
245
+ .action((opts) => managerUpdateFuelDistributionMode(program, opts));
246
+
238
247
  program.parseAsync().then(() => {
239
248
  process.exit(0);
240
249
  });
@@ -0,0 +1,39 @@
1
+ import { Command } from 'commander';
2
+ import { FuelDistributionMode } from '../../src/types/types';
3
+ import { PublicKey } from '@solana/web3.js';
4
+ import { dumpTransactionMessage, getCommandContext } from '../utils';
5
+
6
+ export async function managerUpdateFuelDistributionMode(
7
+ program: Command,
8
+ opts: {
9
+ vaultAddress: string;
10
+ fuelDistributionMode: string;
11
+ dumpTransactionMessage?: boolean;
12
+ }
13
+ ) {
14
+ const { driftVault, driftClient } = await getCommandContext(program, true);
15
+
16
+ const fuelDistributionModeStr = opts.fuelDistributionMode.toLowerCase();
17
+ let fuelDistributionMode: FuelDistributionMode;
18
+ if (fuelDistributionModeStr === 'users-only') {
19
+ fuelDistributionMode = FuelDistributionMode.UsersOnly;
20
+ } else if (fuelDistributionModeStr === 'users-and-manager') {
21
+ fuelDistributionMode = FuelDistributionMode.UsersAndManager;
22
+ } else {
23
+ throw new Error(`Invalid fuel distribution mode: ${opts.fuelDistributionMode}. Valid modes are: users-only, users-and-manager`);
24
+ }
25
+
26
+ if (opts.dumpTransactionMessage) {
27
+ const ix = await driftVault.getManagerUpdateFuelDistributionModeIx(
28
+ new PublicKey(opts.vaultAddress),
29
+ fuelDistributionMode
30
+ );
31
+ console.log(dumpTransactionMessage(driftClient.wallet.publicKey, [ix]));
32
+ } else {
33
+ const tx = await driftVault.managerUpdateFuelDistributionMode(
34
+ new PublicKey(opts.vaultAddress),
35
+ fuelDistributionMode
36
+ );
37
+ console.log(`Updated fuel distribution mode to '${fuelDistributionMode}': https://solana.fm/tx/${tx}${driftClient.env === "devnet" ? "?cluster=devnet-solana" : ""}`);
38
+ }
39
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/vaults-sdk",
3
- "version": "0.7.7",
3
+ "version": "0.7.9",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "directories": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@coral-xyz/anchor": "0.29.0",
11
- "@drift-labs/sdk": "2.121.0-beta.1",
11
+ "@drift-labs/sdk": "2.121.0-beta.2",
12
12
  "@metaplex-foundation/js": "0.20.1",
13
13
  "@solana/web3.js": "1.92.3",
14
14
  "commander": "11.1.0",