@drift-labs/vaults-sdk 0.1.325 → 0.1.326
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/lib/accountSubscribers/pollingVaultsProgramAccountSubscriber.d.ts +0 -1
- package/lib/accounts/vaultAccount.d.ts +0 -3
- package/lib/accounts/vaultDepositorAccount.d.ts +0 -3
- package/lib/accounts/vaultsProgramAccount.d.ts +0 -1
- package/lib/addresses.d.ts +0 -2
- package/lib/addresses.js +3 -4
- package/lib/constants/index.d.ts +0 -1
- package/lib/math/vault.d.ts +1 -1
- package/lib/math/vaultDepositor.d.ts +0 -1
- package/lib/math/vaultDepositor.js +2 -3
- package/lib/name.js +3 -3
- package/lib/parsers/logParser.d.ts +0 -2
- package/lib/types/types.d.ts +0 -4
- package/lib/utils.d.ts +0 -2
- package/lib/vaultClient.d.ts +0 -3
- package/package.json +2 -2
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/// <reference types="bn.js" />
|
|
2
|
-
/// <reference types="@coral-xyz/anchor/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="@coral-xyz/anchor/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';
|
package/lib/addresses.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="@coral-xyz/anchor/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.
|
|
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;
|
package/lib/constants/index.d.ts
CHANGED
package/lib/math/vault.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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.
|
|
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="@coral-xyz/anchor/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';
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/// <reference types="bn.js" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="@coral-xyz/anchor/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="@coral-xyz/anchor/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';
|
package/lib/vaultClient.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/// <reference types="bn.js" />
|
|
2
|
-
/// <reference types="@coral-xyz/anchor/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.
|
|
3
|
+
"version": "0.1.326",
|
|
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.85.0-beta.
|
|
12
|
+
"@drift-labs/sdk": "2.85.0-beta.3",
|
|
13
13
|
"@solana/web3.js": "1.73.2",
|
|
14
14
|
"commander": "^11.0.0",
|
|
15
15
|
"dotenv": "^16.3.1",
|