@drift-labs/vaults-sdk 0.1.531 → 0.1.533
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 +6 -0
- package/cli/commands/applyProfitShare.ts +14 -16
- package/cli/commands/forceWithdrawAll.ts +101 -0
- package/cli/commands/index.ts +1 -0
- package/cli/utils.ts +2 -0
- package/lib/addresses.d.ts +3 -0
- package/lib/addresses.js +24 -0
- package/lib/types/drift_vaults.d.ts +673 -60
- package/lib/types/drift_vaults.js +668 -55
- package/lib/utils.d.ts +2 -1
- package/lib/utils.js +20 -1
- package/lib/vaultClient.d.ts +39 -8
- package/lib/vaultClient.js +347 -44
- package/package.json +2 -2
- package/src/addresses.ts +45 -0
- package/src/idl/drift_vaults.json +1527 -207
- package/src/types/drift_vaults.ts +1322 -96
- package/src/utils.ts +37 -1
- package/src/vaultClient.ts +642 -60
package/src/addresses.ts
CHANGED
|
@@ -42,6 +42,21 @@ export function getTokenVaultAddressSync(
|
|
|
42
42
|
)[0];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
export function getInsuranceFundTokenVaultAddressSync(
|
|
46
|
+
programId: PublicKey,
|
|
47
|
+
vault: PublicKey,
|
|
48
|
+
marketIndex: number
|
|
49
|
+
): PublicKey {
|
|
50
|
+
return PublicKey.findProgramAddressSync(
|
|
51
|
+
[
|
|
52
|
+
Buffer.from(anchor.utils.bytes.utf8.encode('vault_token_account')),
|
|
53
|
+
vault.toBuffer(),
|
|
54
|
+
new anchor.BN(marketIndex).toArrayLike(Buffer, 'le', 2),
|
|
55
|
+
],
|
|
56
|
+
programId
|
|
57
|
+
)[0];
|
|
58
|
+
}
|
|
59
|
+
|
|
45
60
|
export function getVaultProtocolAddressSync(
|
|
46
61
|
programId: PublicKey,
|
|
47
62
|
vault: PublicKey
|
|
@@ -54,3 +69,33 @@ export function getVaultProtocolAddressSync(
|
|
|
54
69
|
programId
|
|
55
70
|
)[0];
|
|
56
71
|
}
|
|
72
|
+
|
|
73
|
+
export function getTokenizedVaultAddressSync(
|
|
74
|
+
programId: PublicKey,
|
|
75
|
+
vault: PublicKey,
|
|
76
|
+
sharesBase: number
|
|
77
|
+
): PublicKey {
|
|
78
|
+
return PublicKey.findProgramAddressSync(
|
|
79
|
+
[
|
|
80
|
+
Buffer.from(anchor.utils.bytes.utf8.encode('tokenized_vault_depositor')),
|
|
81
|
+
vault.toBuffer(),
|
|
82
|
+
Buffer.from(anchor.utils.bytes.utf8.encode(sharesBase.toString())),
|
|
83
|
+
],
|
|
84
|
+
programId
|
|
85
|
+
)[0];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function getTokenizedVaultMintAddressSync(
|
|
89
|
+
programId: PublicKey,
|
|
90
|
+
vault: PublicKey,
|
|
91
|
+
sharesBase: number
|
|
92
|
+
): PublicKey {
|
|
93
|
+
return PublicKey.findProgramAddressSync(
|
|
94
|
+
[
|
|
95
|
+
Buffer.from(anchor.utils.bytes.utf8.encode('mint')),
|
|
96
|
+
vault.toBuffer(),
|
|
97
|
+
Buffer.from(anchor.utils.bytes.utf8.encode(sharesBase.toString())),
|
|
98
|
+
],
|
|
99
|
+
programId
|
|
100
|
+
)[0];
|
|
101
|
+
}
|