@drift-labs/vaults-sdk 0.1.416 → 0.1.417
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/accounts/vaultAccount.d.ts +6 -1
- package/lib/accounts/vaultAccount.js +116 -0
- package/lib/addresses.d.ts +1 -0
- package/lib/addresses.js +7 -0
- package/lib/math/vaultDepositor.d.ts +11 -2
- package/lib/math/vaultDepositor.js +20 -2
- package/lib/types/drift_vaults.d.ts +450 -24
- package/lib/types/drift_vaults.js +450 -24
- package/lib/types/types.d.ts +66 -1
- package/lib/vaultClient.d.ts +53 -5
- package/lib/vaultClient.js +407 -42
- package/package.json +1 -1
- package/src/accounts/vaultAccount.ts +164 -3
- package/src/addresses.ts +13 -0
- package/src/idl/drift_vaults.json +453 -24
- package/src/math/vaultDepositor.ts +36 -4
- package/src/types/drift_vaults.ts +907 -55
- package/src/types/types.ts +79 -1
- package/src/vaultClient.ts +540 -42
package/src/types/types.ts
CHANGED
|
@@ -19,6 +19,40 @@ export type WithdrawRequest = {
|
|
|
19
19
|
ts: BN;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
export type VaultParams = {
|
|
23
|
+
name: number[];
|
|
24
|
+
spotMarketIndex: number;
|
|
25
|
+
redeemPeriod: BN;
|
|
26
|
+
maxTokens: BN;
|
|
27
|
+
minDepositAmount: BN;
|
|
28
|
+
managementFee: BN;
|
|
29
|
+
profitShare: number;
|
|
30
|
+
hurdleRate: number;
|
|
31
|
+
permissioned: boolean;
|
|
32
|
+
vaultProtocol: VaultProtocolParams | null;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type VaultProtocolParams = {
|
|
36
|
+
protocol: PublicKey;
|
|
37
|
+
protocolFee: BN;
|
|
38
|
+
protocolProfitShare: number;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type UpdateVaultParams = {
|
|
42
|
+
redeemPeriod: BN | null;
|
|
43
|
+
maxTokens: BN | null;
|
|
44
|
+
minDepositAmount: BN | null;
|
|
45
|
+
managementFee: BN | null;
|
|
46
|
+
profitShare: number | null;
|
|
47
|
+
hurdleRate: number | null;
|
|
48
|
+
permissioned: boolean | null;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type UpdateVaultProtocolParams = {
|
|
52
|
+
protocolFee: BN | null;
|
|
53
|
+
protocolProfitShare: number | null;
|
|
54
|
+
};
|
|
55
|
+
|
|
22
56
|
// Vault program accounts
|
|
23
57
|
|
|
24
58
|
export type Vault = {
|
|
@@ -55,6 +89,8 @@ export type Vault = {
|
|
|
55
89
|
bump: number;
|
|
56
90
|
permissioned: boolean;
|
|
57
91
|
lastManagerWithdrawRequest: WithdrawRequest;
|
|
92
|
+
/// If this is the default Pubkey (also equal to the SystemProgram) then it does not exist.
|
|
93
|
+
vaultProtocol: PublicKey;
|
|
58
94
|
};
|
|
59
95
|
|
|
60
96
|
export type VaultDepositor = {
|
|
@@ -73,7 +109,21 @@ export type VaultDepositor = {
|
|
|
73
109
|
cumulativeProfitShareAmount: BN;
|
|
74
110
|
vaultSharesBase: number;
|
|
75
111
|
profitShareFeePaid: BN;
|
|
76
|
-
|
|
112
|
+
padding1: number;
|
|
113
|
+
padding: BN[];
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export type VaultProtocol = {
|
|
117
|
+
protocol: PublicKey;
|
|
118
|
+
protocolProfitAndFeeShares: BN;
|
|
119
|
+
protocolFee: BN;
|
|
120
|
+
protocolTotalWithdraws: BN;
|
|
121
|
+
protocolTotalFee: BN;
|
|
122
|
+
protocolTotalProfitShare: BN;
|
|
123
|
+
lastProtocolWithdrawRequest: WithdrawRequest;
|
|
124
|
+
protocolProfitShare: number;
|
|
125
|
+
bump: number;
|
|
126
|
+
version: number;
|
|
77
127
|
};
|
|
78
128
|
|
|
79
129
|
export type VaultsProgramAccountBaseEvents = {
|
|
@@ -147,6 +197,34 @@ export type VaultDepositorRecord = {
|
|
|
147
197
|
managementFeeShares: BN;
|
|
148
198
|
};
|
|
149
199
|
|
|
200
|
+
export type VaultDepositorV1Record = {
|
|
201
|
+
ts: BN;
|
|
202
|
+
|
|
203
|
+
vault: PublicKey;
|
|
204
|
+
depositorAuthority: PublicKey;
|
|
205
|
+
action: VaultDepositorAction;
|
|
206
|
+
amount: BN;
|
|
207
|
+
|
|
208
|
+
spotMarketIndex: number;
|
|
209
|
+
vaultSharesBefore: BN;
|
|
210
|
+
vaultSharesAfter: BN;
|
|
211
|
+
vaultEquityBefore: BN;
|
|
212
|
+
|
|
213
|
+
userVaultSharesBefore: BN;
|
|
214
|
+
totalVaultSharesBefore: BN;
|
|
215
|
+
|
|
216
|
+
userVaultSharesAfter: BN;
|
|
217
|
+
totalVaultSharesAfter: BN;
|
|
218
|
+
|
|
219
|
+
protocolProfitShare: BN;
|
|
220
|
+
protocolFee: BN;
|
|
221
|
+
protocolFeeShares: BN;
|
|
222
|
+
|
|
223
|
+
managerProfitShare: BN;
|
|
224
|
+
managementFee: BN;
|
|
225
|
+
managementFeeShares: BN;
|
|
226
|
+
};
|
|
227
|
+
|
|
150
228
|
export type VaultsEventMap = {
|
|
151
229
|
VaultDepositorRecord: Event<VaultDepositorRecord>;
|
|
152
230
|
};
|