@drift-labs/vaults-sdk 0.1.346 → 0.1.347

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { BulkAccountLoader, DataAndSlot, PublicKey } from '@drift-labs/sdk';
3
2
  import { Program } from '@coral-xyz/anchor';
4
3
  import StrictEventEmitter from 'strict-event-emitter-types';
@@ -1,6 +1,3 @@
1
- /// <reference types="bn.js" />
2
- /// <reference types="solana-bankrun/node_modules/@solana/web3.js" />
3
- /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
4
1
  import { Program } from '@coral-xyz/anchor';
5
2
  import { BulkAccountLoader, BN } from '@drift-labs/sdk';
6
3
  import { PublicKey } from '@solana/web3.js';
@@ -1,6 +1,3 @@
1
- /// <reference types="bn.js" />
2
- /// <reference types="solana-bankrun/node_modules/@solana/web3.js" />
3
- /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
4
1
  import { Program } from '@coral-xyz/anchor';
5
2
  import { BN, BulkAccountLoader } from '@drift-labs/sdk';
6
3
  import { PublicKey } from '@solana/web3.js';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import EventEmitter from 'events';
3
2
  import StrictEventEmitter from 'strict-event-emitter-types';
4
3
  import { VaultsProgramAccountBaseEvents, VaultsProgramAccountSubscriber } from '../types/types';
@@ -1,5 +1,3 @@
1
- /// <reference types="solana-bankrun/node_modules/@solana/web3.js" />
2
- /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
3
1
  import { PublicKey } from '@solana/web3.js';
4
2
  export declare function getVaultAddressSync(programId: PublicKey, encodedName: number[]): PublicKey;
5
3
  export declare function getVaultDepositorAddressSync(programId: PublicKey, vault: PublicKey, authority: PublicKey): PublicKey;
package/lib/addresses.js CHANGED
@@ -23,7 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getTokenVaultAddressSync = exports.getVaultDepositorAddressSync = exports.getVaultAddressSync = void 0;
26
+ exports.getVaultAddressSync = getVaultAddressSync;
27
+ exports.getVaultDepositorAddressSync = getVaultDepositorAddressSync;
28
+ exports.getTokenVaultAddressSync = getTokenVaultAddressSync;
27
29
  const web3_js_1 = require("@solana/web3.js");
28
30
  const anchor = __importStar(require("@coral-xyz/anchor"));
29
31
  function getVaultAddressSync(programId, encodedName) {
@@ -32,7 +34,6 @@ function getVaultAddressSync(programId, encodedName) {
32
34
  Buffer.from(encodedName),
33
35
  ], programId)[0];
34
36
  }
35
- exports.getVaultAddressSync = getVaultAddressSync;
36
37
  function getVaultDepositorAddressSync(programId, vault, authority) {
37
38
  return web3_js_1.PublicKey.findProgramAddressSync([
38
39
  Buffer.from(anchor.utils.bytes.utf8.encode('vault_depositor')),
@@ -40,11 +41,9 @@ function getVaultDepositorAddressSync(programId, vault, authority) {
40
41
  authority.toBuffer(),
41
42
  ], programId)[0];
42
43
  }
43
- exports.getVaultDepositorAddressSync = getVaultDepositorAddressSync;
44
44
  function getTokenVaultAddressSync(programId, vault) {
45
45
  return web3_js_1.PublicKey.findProgramAddressSync([
46
46
  Buffer.from(anchor.utils.bytes.utf8.encode('vault_token_account')),
47
47
  vault.toBuffer(),
48
48
  ], programId)[0];
49
49
  }
50
- exports.getTokenVaultAddressSync = getTokenVaultAddressSync;
@@ -1,3 +1,2 @@
1
- /// <reference types="bn.js" />
2
1
  import { BN } from '@drift-labs/sdk';
3
2
  export declare const VAULT_SHARES_PRECISION_EXP: BN;
@@ -9,7 +9,7 @@ export declare const calcModifiedDietz: (currentVaultEquityBaseValue: BigNum, pr
9
9
  ts: string;
10
10
  marketIndex: number;
11
11
  amount: string;
12
- direction: 'deposit' | 'withdraw';
12
+ direction: "deposit" | "withdraw";
13
13
  }[]) => {
14
14
  apy: number;
15
15
  returns: number;
@@ -1,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { BN } from '@drift-labs/sdk';
3
2
  import { Vault, VaultDepositor } from '../types/types';
4
3
  /**
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.calculateProfitShare = exports.calculateApplyProfitShare = void 0;
3
+ exports.calculateApplyProfitShare = calculateApplyProfitShare;
4
+ exports.calculateProfitShare = calculateProfitShare;
4
5
  const sdk_1 = require("@drift-labs/sdk");
5
6
  /**
6
7
  * Calculates the unrealized profitShare for a vaultDepositor
@@ -18,7 +19,6 @@ function calculateApplyProfitShare(vaultDepositor, vaultEquity, vault) {
18
19
  profitShareShares,
19
20
  };
20
21
  }
21
- exports.calculateApplyProfitShare = calculateApplyProfitShare;
22
22
  function calculateProfitShare(vaultDepositor, totalAmount, vault) {
23
23
  const profit = totalAmount.sub(vaultDepositor.netDeposits.add(vaultDepositor.cumulativeProfitShareAmount));
24
24
  if (profit.gt(sdk_1.ZERO)) {
@@ -29,4 +29,3 @@ function calculateProfitShare(vaultDepositor, totalAmount, vault) {
29
29
  }
30
30
  return sdk_1.ZERO;
31
31
  }
32
- exports.calculateProfitShare = calculateProfitShare;
package/lib/name.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decodeName = exports.encodeName = exports.MAX_NAME_LENGTH = void 0;
3
+ exports.MAX_NAME_LENGTH = void 0;
4
+ exports.encodeName = encodeName;
5
+ exports.decodeName = decodeName;
4
6
  exports.MAX_NAME_LENGTH = 32;
5
7
  function encodeName(name) {
6
8
  if (name.length > exports.MAX_NAME_LENGTH) {
@@ -11,9 +13,7 @@ function encodeName(name) {
11
13
  buffer.fill(' ', name.length);
12
14
  return Array(...buffer);
13
15
  }
14
- exports.encodeName = encodeName;
15
16
  function decodeName(bytes) {
16
17
  const buffer = Buffer.from(bytes);
17
18
  return buffer.toString('utf8').trim();
18
19
  }
19
- exports.decodeName = decodeName;
@@ -1,5 +1,3 @@
1
- /// <reference types="solana-bankrun/node_modules/@solana/web3.js" />
2
- /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
3
1
  import { Program } from '@coral-xyz/anchor';
4
2
  import { TransactionSignature } from '@solana/web3.js';
5
3
  import { WrappedEvents } from '../types/types';
@@ -1,7 +1,3 @@
1
- /// <reference types="bn.js" />
2
- /// <reference types="node" />
3
- /// <reference types="solana-bankrun/node_modules/@solana/web3.js" />
4
- /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
5
1
  import { BN, DataAndSlot, Event } from '@drift-labs/sdk';
6
2
  import { PublicKey } from '@solana/web3.js';
7
3
  import { EventEmitter } from 'events';
package/lib/utils.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="solana-bankrun/node_modules/@solana/web3.js" />
2
- /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
3
1
  import { DriftClient, IWallet } from '@drift-labs/sdk';
4
2
  import { Connection } from '@solana/web3.js';
5
3
  import { DriftVaults } from './types/drift_vaults';
@@ -1,6 +1,3 @@
1
- /// <reference types="bn.js" />
2
- /// <reference types="solana-bankrun/node_modules/@solana/web3.js" />
3
- /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
4
1
  import { BN, DriftClient, UserMap } from '@drift-labs/sdk';
5
2
  import { Program, ProgramAccount } from '@coral-xyz/anchor';
6
3
  import { DriftVaults } from './types/drift_vaults';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/vaults-sdk",
3
- "version": "0.1.346",
3
+ "version": "0.1.347",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "directories": {
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "@coral-xyz/anchor": "0.28.0",
11
11
  "@drift-labs/competitions-sdk": "0.2.334",
12
- "@drift-labs/sdk": "2.86.0-beta.8",
12
+ "@drift-labs/sdk": "2.86.0-beta.9",
13
13
  "@solana/web3.js": "1.73.2",
14
14
  "commander": "^11.0.0",
15
15
  "dotenv": "^16.3.1",