@drift-labs/vaults-sdk 0.1.462 → 0.1.463
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 +115 -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 +587 -24
- package/lib/types/drift_vaults.js +587 -24
- package/lib/types/types.d.ts +77 -1
- package/lib/vaultClient.d.ts +52 -3
- package/lib/vaultClient.js +400 -42
- package/package.json +1 -1
- package/src/accounts/vaultAccount.ts +163 -2
- package/src/addresses.ts +13 -0
- package/src/idl/drift_vaults.json +598 -24
- package/src/math/vaultDepositor.ts +36 -4
- package/src/types/drift_vaults.ts +1231 -105
- package/src/types/types.ts +94 -1
- package/src/vaultClient.ts +532 -42
package/src/types/types.ts
CHANGED
|
@@ -19,6 +19,52 @@ 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
|
+
};
|
|
33
|
+
|
|
34
|
+
export type VaultWithProtocolParams = {
|
|
35
|
+
name: number[];
|
|
36
|
+
spotMarketIndex: number;
|
|
37
|
+
redeemPeriod: BN;
|
|
38
|
+
maxTokens: BN;
|
|
39
|
+
minDepositAmount: BN;
|
|
40
|
+
managementFee: BN;
|
|
41
|
+
profitShare: number;
|
|
42
|
+
hurdleRate: number;
|
|
43
|
+
permissioned: boolean;
|
|
44
|
+
vaultProtocol: VaultProtocolParams;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type VaultProtocolParams = {
|
|
48
|
+
protocol: PublicKey;
|
|
49
|
+
protocolFee: BN;
|
|
50
|
+
protocolProfitShare: number;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type UpdateVaultParams = {
|
|
54
|
+
redeemPeriod: BN | null;
|
|
55
|
+
maxTokens: BN | null;
|
|
56
|
+
minDepositAmount: BN | null;
|
|
57
|
+
managementFee: BN | null;
|
|
58
|
+
profitShare: number | null;
|
|
59
|
+
hurdleRate: number | null;
|
|
60
|
+
permissioned: boolean | null;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type UpdateVaultProtocolParams = {
|
|
64
|
+
protocolFee: BN | null;
|
|
65
|
+
protocolProfitShare: number | null;
|
|
66
|
+
};
|
|
67
|
+
|
|
22
68
|
// Vault program accounts
|
|
23
69
|
|
|
24
70
|
export type Vault = {
|
|
@@ -55,6 +101,7 @@ export type Vault = {
|
|
|
55
101
|
bump: number;
|
|
56
102
|
permissioned: boolean;
|
|
57
103
|
lastManagerWithdrawRequest: WithdrawRequest;
|
|
104
|
+
vaultProtocol: boolean;
|
|
58
105
|
};
|
|
59
106
|
|
|
60
107
|
export type VaultDepositor = {
|
|
@@ -73,7 +120,21 @@ export type VaultDepositor = {
|
|
|
73
120
|
cumulativeProfitShareAmount: BN;
|
|
74
121
|
vaultSharesBase: number;
|
|
75
122
|
profitShareFeePaid: BN;
|
|
76
|
-
|
|
123
|
+
padding1: number;
|
|
124
|
+
padding: BN[];
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export type VaultProtocol = {
|
|
128
|
+
protocol: PublicKey;
|
|
129
|
+
protocolProfitAndFeeShares: BN;
|
|
130
|
+
protocolFee: BN;
|
|
131
|
+
protocolTotalWithdraws: BN;
|
|
132
|
+
protocolTotalFee: BN;
|
|
133
|
+
protocolTotalProfitShare: BN;
|
|
134
|
+
lastProtocolWithdrawRequest: WithdrawRequest;
|
|
135
|
+
protocolProfitShare: number;
|
|
136
|
+
bump: number;
|
|
137
|
+
version: number;
|
|
77
138
|
};
|
|
78
139
|
|
|
79
140
|
export type VaultsProgramAccountBaseEvents = {
|
|
@@ -97,9 +158,13 @@ export interface VaultsProgramAccountSubscriber<
|
|
|
97
158
|
isSubscribed: boolean;
|
|
98
159
|
|
|
99
160
|
subscribe(): Promise<boolean>;
|
|
161
|
+
|
|
100
162
|
fetch(): Promise<void>;
|
|
163
|
+
|
|
101
164
|
updateData(account: Account, slot: number): void;
|
|
165
|
+
|
|
102
166
|
unsubscribe(): Promise<void>;
|
|
167
|
+
|
|
103
168
|
getAccountAndSlot(): DataAndSlot<Account>;
|
|
104
169
|
}
|
|
105
170
|
|
|
@@ -147,6 +212,34 @@ export type VaultDepositorRecord = {
|
|
|
147
212
|
managementFeeShares: BN;
|
|
148
213
|
};
|
|
149
214
|
|
|
215
|
+
export type VaultDepositorV1Record = {
|
|
216
|
+
ts: BN;
|
|
217
|
+
|
|
218
|
+
vault: PublicKey;
|
|
219
|
+
depositorAuthority: PublicKey;
|
|
220
|
+
action: VaultDepositorAction;
|
|
221
|
+
amount: BN;
|
|
222
|
+
|
|
223
|
+
spotMarketIndex: number;
|
|
224
|
+
vaultSharesBefore: BN;
|
|
225
|
+
vaultSharesAfter: BN;
|
|
226
|
+
vaultEquityBefore: BN;
|
|
227
|
+
|
|
228
|
+
userVaultSharesBefore: BN;
|
|
229
|
+
totalVaultSharesBefore: BN;
|
|
230
|
+
|
|
231
|
+
userVaultSharesAfter: BN;
|
|
232
|
+
totalVaultSharesAfter: BN;
|
|
233
|
+
|
|
234
|
+
protocolProfitShare: BN;
|
|
235
|
+
protocolFee: BN;
|
|
236
|
+
protocolFeeShares: BN;
|
|
237
|
+
|
|
238
|
+
managerProfitShare: BN;
|
|
239
|
+
managementFee: BN;
|
|
240
|
+
managementFeeShares: BN;
|
|
241
|
+
};
|
|
242
|
+
|
|
150
243
|
export type VaultsEventMap = {
|
|
151
244
|
VaultDepositorRecord: Event<VaultDepositorRecord>;
|
|
152
245
|
};
|