@kamino-finance/klend-sdk 5.0.6 → 5.0.7
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/README_KAMINO_MANAGER.md +154 -17
- package/dist/classes/manager.d.ts +22 -0
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +29 -0
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/vault.d.ts +30 -0
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +177 -0
- package/dist/classes/vault.js.map +1 -1
- package/dist/client_kamino_manager.d.ts.map +1 -1
- package/dist/client_kamino_manager.js +113 -1
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts +10 -10
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js +52 -51
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js.map +1 -1
- package/package.json +1 -1
- package/src/classes/manager.ts +34 -0
- package/src/classes/vault.ts +250 -0
- package/src/client_kamino_manager.ts +174 -1
- package/src/idl_codegen_kamino_vault/types/VaultConfigField.ts +116 -117
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as types from
|
|
2
|
-
import * as borsh from
|
|
1
|
+
import * as types from '../types';
|
|
2
|
+
import * as borsh from '@coral-xyz/borsh';
|
|
3
3
|
export interface PerformanceFeeBpsJSON {
|
|
4
|
-
kind:
|
|
4
|
+
kind: 'PerformanceFeeBps';
|
|
5
5
|
}
|
|
6
6
|
export declare class PerformanceFeeBps {
|
|
7
7
|
static readonly discriminator = 0;
|
|
@@ -14,7 +14,7 @@ export declare class PerformanceFeeBps {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
export interface ManagementFeeBpsJSON {
|
|
17
|
-
kind:
|
|
17
|
+
kind: 'ManagementFeeBps';
|
|
18
18
|
}
|
|
19
19
|
export declare class ManagementFeeBps {
|
|
20
20
|
static readonly discriminator = 1;
|
|
@@ -27,7 +27,7 @@ export declare class ManagementFeeBps {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
export interface MinDepositAmountJSON {
|
|
30
|
-
kind:
|
|
30
|
+
kind: 'MinDepositAmount';
|
|
31
31
|
}
|
|
32
32
|
export declare class MinDepositAmount {
|
|
33
33
|
static readonly discriminator = 2;
|
|
@@ -40,7 +40,7 @@ export declare class MinDepositAmount {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
export interface MinWithdrawAmountJSON {
|
|
43
|
-
kind:
|
|
43
|
+
kind: 'MinWithdrawAmount';
|
|
44
44
|
}
|
|
45
45
|
export declare class MinWithdrawAmount {
|
|
46
46
|
static readonly discriminator = 3;
|
|
@@ -53,7 +53,7 @@ export declare class MinWithdrawAmount {
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
export interface MintInvestAmountJSON {
|
|
56
|
-
kind:
|
|
56
|
+
kind: 'MintInvestAmount';
|
|
57
57
|
}
|
|
58
58
|
export declare class MintInvestAmount {
|
|
59
59
|
static readonly discriminator = 4;
|
|
@@ -66,7 +66,7 @@ export declare class MintInvestAmount {
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
export interface MinInvestDelaySlotsJSON {
|
|
69
|
-
kind:
|
|
69
|
+
kind: 'MinInvestDelaySlots';
|
|
70
70
|
}
|
|
71
71
|
export declare class MinInvestDelaySlots {
|
|
72
72
|
static readonly discriminator = 5;
|
|
@@ -79,7 +79,7 @@ export declare class MinInvestDelaySlots {
|
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
export interface CrankFundFeePerReserveJSON {
|
|
82
|
-
kind:
|
|
82
|
+
kind: 'CrankFundFeePerReserve';
|
|
83
83
|
}
|
|
84
84
|
export declare class CrankFundFeePerReserve {
|
|
85
85
|
static readonly discriminator = 6;
|
|
@@ -92,7 +92,7 @@ export declare class CrankFundFeePerReserve {
|
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
export interface PendingVaultAdminJSON {
|
|
95
|
-
kind:
|
|
95
|
+
kind: 'PendingVaultAdmin';
|
|
96
96
|
}
|
|
97
97
|
export declare class PendingVaultAdmin {
|
|
98
98
|
static readonly discriminator = 7;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VaultConfigField.d.ts","sourceRoot":"","sources":["../../../src/idl_codegen_kamino_vault/types/VaultConfigField.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"VaultConfigField.d.ts","sourceRoot":"","sources":["../../../src/idl_codegen_kamino_vault/types/VaultConfigField.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAE1C,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAED,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,QAAQ,CAAC,aAAa,KAAK;IAClC,MAAM,CAAC,QAAQ,CAAC,IAAI,uBAAuB;IAC3C,QAAQ,CAAC,aAAa,KAAK;IAC3B,QAAQ,CAAC,IAAI,uBAAuB;IAEpC,MAAM,IAAI,qBAAqB;IAM/B,WAAW;;;CAKZ;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,QAAQ,CAAC,aAAa,KAAK;IAClC,MAAM,CAAC,QAAQ,CAAC,IAAI,sBAAsB;IAC1C,QAAQ,CAAC,aAAa,KAAK;IAC3B,QAAQ,CAAC,IAAI,sBAAsB;IAEnC,MAAM,IAAI,oBAAoB;IAM9B,WAAW;;;CAKZ;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED,qBAAa,gBAAgB;IAC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AAQ,CAAC,IAAI,4BAA4B;IAChD,QAAQ,CAAC,aAAa,KAAK;IAC3B,QAAQ,CAAC,IAAI,4BAA4B;IAEzC,MAAM,IAAI,0BAA0B;IAMpC,WAAW;;;CAKZ;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAED,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,QAAQ,CAAC,aAAa,KAAK;IAClC,MAAM,CAAC,QAAQ,CAAC,IAAI,uBAAuB;IAC3C,QAAQ,CAAC,aAAa,KAAK;IAC3B,QAAQ,CAAC,IAAI,uBAAuB;IAEpC,MAAM,IAAI,qBAAqB;IAM/B,WAAW;;;CAKZ;AAGD,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,KAAK,CAAC,oBAAoB,CAgChE;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,oBAAoB,GAAG,KAAK,CAAC,oBAAoB,CA2BpF;AAED,wBAAgB,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,6BAevC"}
|
|
@@ -30,12 +30,12 @@ exports.layout = layout;
|
|
|
30
30
|
const borsh = __importStar(require("@coral-xyz/borsh"));
|
|
31
31
|
class PerformanceFeeBps {
|
|
32
32
|
static discriminator = 0;
|
|
33
|
-
static kind =
|
|
33
|
+
static kind = 'PerformanceFeeBps';
|
|
34
34
|
discriminator = 0;
|
|
35
|
-
kind =
|
|
35
|
+
kind = 'PerformanceFeeBps';
|
|
36
36
|
toJSON() {
|
|
37
37
|
return {
|
|
38
|
-
kind:
|
|
38
|
+
kind: 'PerformanceFeeBps',
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
toEncodable() {
|
|
@@ -47,12 +47,12 @@ class PerformanceFeeBps {
|
|
|
47
47
|
exports.PerformanceFeeBps = PerformanceFeeBps;
|
|
48
48
|
class ManagementFeeBps {
|
|
49
49
|
static discriminator = 1;
|
|
50
|
-
static kind =
|
|
50
|
+
static kind = 'ManagementFeeBps';
|
|
51
51
|
discriminator = 1;
|
|
52
|
-
kind =
|
|
52
|
+
kind = 'ManagementFeeBps';
|
|
53
53
|
toJSON() {
|
|
54
54
|
return {
|
|
55
|
-
kind:
|
|
55
|
+
kind: 'ManagementFeeBps',
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
toEncodable() {
|
|
@@ -64,12 +64,12 @@ class ManagementFeeBps {
|
|
|
64
64
|
exports.ManagementFeeBps = ManagementFeeBps;
|
|
65
65
|
class MinDepositAmount {
|
|
66
66
|
static discriminator = 2;
|
|
67
|
-
static kind =
|
|
67
|
+
static kind = 'MinDepositAmount';
|
|
68
68
|
discriminator = 2;
|
|
69
|
-
kind =
|
|
69
|
+
kind = 'MinDepositAmount';
|
|
70
70
|
toJSON() {
|
|
71
71
|
return {
|
|
72
|
-
kind:
|
|
72
|
+
kind: 'MinDepositAmount',
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
toEncodable() {
|
|
@@ -81,12 +81,12 @@ class MinDepositAmount {
|
|
|
81
81
|
exports.MinDepositAmount = MinDepositAmount;
|
|
82
82
|
class MinWithdrawAmount {
|
|
83
83
|
static discriminator = 3;
|
|
84
|
-
static kind =
|
|
84
|
+
static kind = 'MinWithdrawAmount';
|
|
85
85
|
discriminator = 3;
|
|
86
|
-
kind =
|
|
86
|
+
kind = 'MinWithdrawAmount';
|
|
87
87
|
toJSON() {
|
|
88
88
|
return {
|
|
89
|
-
kind:
|
|
89
|
+
kind: 'MinWithdrawAmount',
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
toEncodable() {
|
|
@@ -98,12 +98,12 @@ class MinWithdrawAmount {
|
|
|
98
98
|
exports.MinWithdrawAmount = MinWithdrawAmount;
|
|
99
99
|
class MintInvestAmount {
|
|
100
100
|
static discriminator = 4;
|
|
101
|
-
static kind =
|
|
101
|
+
static kind = 'MintInvestAmount';
|
|
102
102
|
discriminator = 4;
|
|
103
|
-
kind =
|
|
103
|
+
kind = 'MintInvestAmount';
|
|
104
104
|
toJSON() {
|
|
105
105
|
return {
|
|
106
|
-
kind:
|
|
106
|
+
kind: 'MintInvestAmount',
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
toEncodable() {
|
|
@@ -115,12 +115,12 @@ class MintInvestAmount {
|
|
|
115
115
|
exports.MintInvestAmount = MintInvestAmount;
|
|
116
116
|
class MinInvestDelaySlots {
|
|
117
117
|
static discriminator = 5;
|
|
118
|
-
static kind =
|
|
118
|
+
static kind = 'MinInvestDelaySlots';
|
|
119
119
|
discriminator = 5;
|
|
120
|
-
kind =
|
|
120
|
+
kind = 'MinInvestDelaySlots';
|
|
121
121
|
toJSON() {
|
|
122
122
|
return {
|
|
123
|
-
kind:
|
|
123
|
+
kind: 'MinInvestDelaySlots',
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
toEncodable() {
|
|
@@ -132,12 +132,12 @@ class MinInvestDelaySlots {
|
|
|
132
132
|
exports.MinInvestDelaySlots = MinInvestDelaySlots;
|
|
133
133
|
class CrankFundFeePerReserve {
|
|
134
134
|
static discriminator = 6;
|
|
135
|
-
static kind =
|
|
135
|
+
static kind = 'CrankFundFeePerReserve';
|
|
136
136
|
discriminator = 6;
|
|
137
|
-
kind =
|
|
137
|
+
kind = 'CrankFundFeePerReserve';
|
|
138
138
|
toJSON() {
|
|
139
139
|
return {
|
|
140
|
-
kind:
|
|
140
|
+
kind: 'CrankFundFeePerReserve',
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
toEncodable() {
|
|
@@ -149,12 +149,12 @@ class CrankFundFeePerReserve {
|
|
|
149
149
|
exports.CrankFundFeePerReserve = CrankFundFeePerReserve;
|
|
150
150
|
class PendingVaultAdmin {
|
|
151
151
|
static discriminator = 7;
|
|
152
|
-
static kind =
|
|
152
|
+
static kind = 'PendingVaultAdmin';
|
|
153
153
|
discriminator = 7;
|
|
154
|
-
kind =
|
|
154
|
+
kind = 'PendingVaultAdmin';
|
|
155
155
|
toJSON() {
|
|
156
156
|
return {
|
|
157
|
-
kind:
|
|
157
|
+
kind: 'PendingVaultAdmin',
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
160
|
toEncodable() {
|
|
@@ -166,73 +166,74 @@ class PendingVaultAdmin {
|
|
|
166
166
|
exports.PendingVaultAdmin = PendingVaultAdmin;
|
|
167
167
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
168
168
|
function fromDecoded(obj) {
|
|
169
|
-
if (typeof obj !==
|
|
170
|
-
throw new Error(
|
|
169
|
+
if (typeof obj !== 'object') {
|
|
170
|
+
throw new Error('Invalid enum object');
|
|
171
171
|
}
|
|
172
|
-
|
|
172
|
+
console.log('');
|
|
173
|
+
if ('PerformanceFeeBps' in obj) {
|
|
173
174
|
return new PerformanceFeeBps();
|
|
174
175
|
}
|
|
175
|
-
if (
|
|
176
|
+
if ('ManagementFeeBps' in obj) {
|
|
176
177
|
return new ManagementFeeBps();
|
|
177
178
|
}
|
|
178
|
-
if (
|
|
179
|
+
if ('MinDepositAmount' in obj) {
|
|
179
180
|
return new MinDepositAmount();
|
|
180
181
|
}
|
|
181
|
-
if (
|
|
182
|
+
if ('MinWithdrawAmount' in obj) {
|
|
182
183
|
return new MinWithdrawAmount();
|
|
183
184
|
}
|
|
184
|
-
if (
|
|
185
|
+
if ('MintInvestAmount' in obj) {
|
|
185
186
|
return new MintInvestAmount();
|
|
186
187
|
}
|
|
187
|
-
if (
|
|
188
|
+
if ('MinInvestDelaySlots' in obj) {
|
|
188
189
|
return new MinInvestDelaySlots();
|
|
189
190
|
}
|
|
190
|
-
if (
|
|
191
|
+
if ('CrankFundFeePerReserve' in obj) {
|
|
191
192
|
return new CrankFundFeePerReserve();
|
|
192
193
|
}
|
|
193
|
-
if (
|
|
194
|
+
if ('PendingVaultAdmin' in obj) {
|
|
194
195
|
return new PendingVaultAdmin();
|
|
195
196
|
}
|
|
196
|
-
throw new Error(
|
|
197
|
+
throw new Error('Invalid enum object');
|
|
197
198
|
}
|
|
198
199
|
function fromJSON(obj) {
|
|
199
200
|
switch (obj.kind) {
|
|
200
|
-
case
|
|
201
|
+
case 'PerformanceFeeBps': {
|
|
201
202
|
return new PerformanceFeeBps();
|
|
202
203
|
}
|
|
203
|
-
case
|
|
204
|
+
case 'ManagementFeeBps': {
|
|
204
205
|
return new ManagementFeeBps();
|
|
205
206
|
}
|
|
206
|
-
case
|
|
207
|
+
case 'MinDepositAmount': {
|
|
207
208
|
return new MinDepositAmount();
|
|
208
209
|
}
|
|
209
|
-
case
|
|
210
|
+
case 'MinWithdrawAmount': {
|
|
210
211
|
return new MinWithdrawAmount();
|
|
211
212
|
}
|
|
212
|
-
case
|
|
213
|
+
case 'MintInvestAmount': {
|
|
213
214
|
return new MintInvestAmount();
|
|
214
215
|
}
|
|
215
|
-
case
|
|
216
|
+
case 'MinInvestDelaySlots': {
|
|
216
217
|
return new MinInvestDelaySlots();
|
|
217
218
|
}
|
|
218
|
-
case
|
|
219
|
+
case 'CrankFundFeePerReserve': {
|
|
219
220
|
return new CrankFundFeePerReserve();
|
|
220
221
|
}
|
|
221
|
-
case
|
|
222
|
+
case 'PendingVaultAdmin': {
|
|
222
223
|
return new PendingVaultAdmin();
|
|
223
224
|
}
|
|
224
225
|
}
|
|
225
226
|
}
|
|
226
227
|
function layout(property) {
|
|
227
228
|
const ret = borsh.rustEnum([
|
|
228
|
-
borsh.struct([],
|
|
229
|
-
borsh.struct([],
|
|
230
|
-
borsh.struct([],
|
|
231
|
-
borsh.struct([],
|
|
232
|
-
borsh.struct([],
|
|
233
|
-
borsh.struct([],
|
|
234
|
-
borsh.struct([],
|
|
235
|
-
borsh.struct([],
|
|
229
|
+
borsh.struct([], 'PerformanceFeeBps'),
|
|
230
|
+
borsh.struct([], 'ManagementFeeBps'),
|
|
231
|
+
borsh.struct([], 'MinDepositAmount'),
|
|
232
|
+
borsh.struct([], 'MinWithdrawAmount'),
|
|
233
|
+
borsh.struct([], 'MintInvestAmount'),
|
|
234
|
+
borsh.struct([], 'MinInvestDelaySlots'),
|
|
235
|
+
borsh.struct([], 'CrankFundFeePerReserve'),
|
|
236
|
+
borsh.struct([], 'PendingVaultAdmin'),
|
|
236
237
|
]);
|
|
237
238
|
if (property !== undefined) {
|
|
238
239
|
return ret.replicate(property);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VaultConfigField.js","sourceRoot":"","sources":["../../../src/idl_codegen_kamino_vault/types/VaultConfigField.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA8LA,
|
|
1
|
+
{"version":3,"file":"VaultConfigField.js","sourceRoot":"","sources":["../../../src/idl_codegen_kamino_vault/types/VaultConfigField.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA8LA,kCAgCC;AAED,4BA2BC;AAED,wBAeC;AAzQD,wDAA0C;AAM1C,MAAa,iBAAiB;IAC5B,MAAM,CAAU,aAAa,GAAG,CAAC,CAAC;IAClC,MAAM,CAAU,IAAI,GAAG,mBAAmB,CAAC;IAClC,aAAa,GAAG,CAAC,CAAC;IAClB,IAAI,GAAG,mBAAmB,CAAC;IAEpC,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,mBAAmB;SAC1B,CAAC;IACJ,CAAC;IAED,WAAW;QACT,OAAO;YACL,iBAAiB,EAAE,EAAE;SACtB,CAAC;IACJ,CAAC;;AAhBH,8CAiBC;AAMD,MAAa,gBAAgB;IAC3B,MAAM,CAAU,aAAa,GAAG,CAAC,CAAC;IAClC,MAAM,CAAU,IAAI,GAAG,kBAAkB,CAAC;IACjC,aAAa,GAAG,CAAC,CAAC;IAClB,IAAI,GAAG,kBAAkB,CAAC;IAEnC,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,kBAAkB;SACzB,CAAC;IACJ,CAAC;IAED,WAAW;QACT,OAAO;YACL,gBAAgB,EAAE,EAAE;SACrB,CAAC;IACJ,CAAC;;AAhBH,4CAiBC;AAMD,MAAa,gBAAgB;IAC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CAAC;QACD,KAAK,mBAAmB,CAAC,CAAC,CAAC;YACzB,OAAO,IAAI,iBAAiB,EAAE,CAAC;QACjC,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAgB,MAAM,CAAC,QAAiB;IACtC,MAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC;QACzB,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,mBAAmB,CAAC;QACrC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,kBAAkB,CAAC;QACpC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,kBAAkB,CAAC;QACpC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,mBAAmB,CAAC;QACrC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,kBAAkB,CAAC;QACpC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,qBAAqB,CAAC;QACvC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,wBAAwB,CAAC;QAC1C,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,mBAAmB,CAAC;KACtC,CAAC,CAAC;IACH,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/package.json
CHANGED
package/src/classes/manager.ts
CHANGED
|
@@ -54,6 +54,7 @@ import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
|
54
54
|
import { Data } from '@kamino-finance/kliquidity-sdk';
|
|
55
55
|
import bs58 from 'bs58';
|
|
56
56
|
import { getProgramAccounts } from '../utils/rpc';
|
|
57
|
+
import { VaultConfigFieldKind } from '../idl_codegen_kamino_vault/types';
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
60
|
* KaminoManager is a class that provides a high-level interface to interact with the Kamino Lend and Kamino Vault programs, in order to create and manage a market, as well as vaults
|
|
@@ -317,6 +318,29 @@ export class KaminoManager {
|
|
|
317
318
|
return this._vaultClient.depositIxs(user, vault, tokenAmount);
|
|
318
319
|
}
|
|
319
320
|
|
|
321
|
+
async updateVaultConfigIx(vault: KaminoVault, mode: VaultConfigFieldKind, value: string): Promise<TransactionInstruction> {
|
|
322
|
+
return this._vaultClient.updateVaultConfigIx(vault, mode, value);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* This function creates the instruction for the `pendingAdmin` of the vault to accept to become the owner of the vault (step 2/2 of the ownership transfer)
|
|
327
|
+
* @param vault - vault to change the ownership for
|
|
328
|
+
* @returns - an instruction to be used to be executed
|
|
329
|
+
*/
|
|
330
|
+
async acceptVaultOwnershipIx(vault: KaminoVault): Promise<TransactionInstruction> {
|
|
331
|
+
return this._vaultClient.acceptVaultOwnershipIx(vault);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* This function creates the instruction for the admin to give up a part of the pending fees (which will be accounted as part of the vault)
|
|
336
|
+
* @param vault - vault to give up pending fees for
|
|
337
|
+
* @param maxAmountToGiveUp - the maximum amount of fees to give up, in tokens
|
|
338
|
+
* @returns - an instruction to be used to be executed
|
|
339
|
+
*/
|
|
340
|
+
async giveUpPendingFeesIx(vault: KaminoVault, maxAmountToGiveUp: Decimal): Promise<TransactionInstruction> {
|
|
341
|
+
return this._vaultClient.giveUpPendingFeesIx(vault, maxAmountToGiveUp);
|
|
342
|
+
}
|
|
343
|
+
|
|
320
344
|
/**
|
|
321
345
|
* This function will return the missing ATA creation instructions, as well as one or multiple withdraw instructions, based on how many reserves it's needed to withdraw from. This might have to be split in multiple transactions
|
|
322
346
|
* @param user - user to withdraw
|
|
@@ -334,6 +358,16 @@ export class KaminoManager {
|
|
|
334
358
|
return this._vaultClient.withdrawIxs(user, vault, shareAmount, slot);
|
|
335
359
|
}
|
|
336
360
|
|
|
361
|
+
/**
|
|
362
|
+
* This method withdraws all the pending fees from the vault to the owner's token ATA
|
|
363
|
+
* @param vault - vault for which the admin withdraws the pending fees
|
|
364
|
+
* @param slot - current slot, used to estimate the interest earned in the different reserves with allocation from the vault
|
|
365
|
+
* @returns - list of instructions to withdraw all pending fees
|
|
366
|
+
*/
|
|
367
|
+
async withdrawPendingFeesIxs(vault: KaminoVault, slot: number): Promise<TransactionInstruction[]> {
|
|
368
|
+
return this._vaultClient.withdrawPendingFeesIxs(vault, slot);
|
|
369
|
+
}
|
|
370
|
+
|
|
337
371
|
/**
|
|
338
372
|
* This method calculates the token per share value. This will always change based on interest earned from the vault, but calculating it requires a bunch of rpc requests. Caching this for a short duration would be optimal
|
|
339
373
|
* @param vault - vault to calculate tokensPerShare for
|