@drift-labs/vaults-sdk 0.1.162 → 0.1.164
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/vaultClient.d.ts +8 -0
- package/lib/vaultClient.js +14 -0
- package/package.json +2 -2
- package/src/vaultClient.ts +23 -0
package/lib/vaultClient.d.ts
CHANGED
|
@@ -23,7 +23,15 @@ export declare class VaultClient {
|
|
|
23
23
|
userMapConfig?: UserMapConfig;
|
|
24
24
|
});
|
|
25
25
|
getVault(vault: PublicKey): Promise<Vault>;
|
|
26
|
+
getVaultAndSlot(vault: PublicKey): Promise<{
|
|
27
|
+
vault: Vault;
|
|
28
|
+
slot: number;
|
|
29
|
+
}>;
|
|
26
30
|
getVaultDepositor(vaultDepositor: PublicKey): Promise<any>;
|
|
31
|
+
getVaultDepositorAndSlot(vaultDepositor: PublicKey): Promise<{
|
|
32
|
+
vaultDepositor: any;
|
|
33
|
+
slot: number;
|
|
34
|
+
}>;
|
|
27
35
|
getAllVaultDepositorsWithNoWithdrawRequest(vault: PublicKey): Promise<ProgramAccount<VaultDepositor>[]>;
|
|
28
36
|
getAllVaultDepositors(vault: PublicKey): Promise<ProgramAccount<VaultDepositor>[]>;
|
|
29
37
|
getSubscribedVaultUser(vaultDriftUserAccountPubKey: PublicKey): Promise<User>;
|
package/lib/vaultClient.js
CHANGED
|
@@ -31,9 +31,23 @@ class VaultClient {
|
|
|
31
31
|
// @ts-ignore
|
|
32
32
|
return await this.program.account.vault.fetch(vault);
|
|
33
33
|
}
|
|
34
|
+
async getVaultAndSlot(vault) {
|
|
35
|
+
const vaultAndSlot = await this.program.account.vault.fetchAndContext(vault);
|
|
36
|
+
return {
|
|
37
|
+
vault: vaultAndSlot.data,
|
|
38
|
+
slot: vaultAndSlot.context.slot,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
34
41
|
async getVaultDepositor(vaultDepositor) {
|
|
35
42
|
return await this.program.account.vaultDepositor.fetch(vaultDepositor);
|
|
36
43
|
}
|
|
44
|
+
async getVaultDepositorAndSlot(vaultDepositor) {
|
|
45
|
+
const vaultDepositorAndSlot = await this.program.account.vaultDepositor.fetchAndContext(vaultDepositor);
|
|
46
|
+
return {
|
|
47
|
+
vaultDepositor: vaultDepositorAndSlot.data,
|
|
48
|
+
slot: vaultDepositorAndSlot.context.slot,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
37
51
|
async getAllVaultDepositorsWithNoWithdrawRequest(vault) {
|
|
38
52
|
const filters = [
|
|
39
53
|
{
|
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.164",
|
|
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.26.0",
|
|
11
11
|
"@drift-labs/competitions-sdk": "0.2.146",
|
|
12
|
-
"@drift-labs/sdk": "2.63.0-beta.
|
|
12
|
+
"@drift-labs/sdk": "2.63.0-beta.4",
|
|
13
13
|
"@solana/web3.js": "1.73.2",
|
|
14
14
|
"commander": "^11.0.0",
|
|
15
15
|
"dotenv": "^16.3.1",
|
package/src/vaultClient.ts
CHANGED
|
@@ -83,10 +83,33 @@ export class VaultClient {
|
|
|
83
83
|
return await this.program.account.vault.fetch(vault);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
public async getVaultAndSlot(
|
|
87
|
+
vault: PublicKey
|
|
88
|
+
): Promise<{ vault: Vault; slot: number }> {
|
|
89
|
+
const vaultAndSlot = await this.program.account.vault.fetchAndContext(
|
|
90
|
+
vault
|
|
91
|
+
);
|
|
92
|
+
return {
|
|
93
|
+
vault: vaultAndSlot.data as Vault,
|
|
94
|
+
slot: vaultAndSlot.context.slot,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
86
98
|
public async getVaultDepositor(vaultDepositor: PublicKey): Promise<any> {
|
|
87
99
|
return await this.program.account.vaultDepositor.fetch(vaultDepositor);
|
|
88
100
|
}
|
|
89
101
|
|
|
102
|
+
public async getVaultDepositorAndSlot(
|
|
103
|
+
vaultDepositor: PublicKey
|
|
104
|
+
): Promise<{ vaultDepositor: any; slot: number }> {
|
|
105
|
+
const vaultDepositorAndSlot =
|
|
106
|
+
await this.program.account.vaultDepositor.fetchAndContext(vaultDepositor);
|
|
107
|
+
return {
|
|
108
|
+
vaultDepositor: vaultDepositorAndSlot.data,
|
|
109
|
+
slot: vaultDepositorAndSlot.context.slot,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
90
113
|
public async getAllVaultDepositorsWithNoWithdrawRequest(
|
|
91
114
|
vault: PublicKey
|
|
92
115
|
): Promise<ProgramAccount<VaultDepositor>[]> {
|