@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/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
+ }