@kamino-finance/klend-sdk 5.11.0 → 5.11.1
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/dist/classes/vault.d.ts +1 -0
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +7 -4
- package/dist/classes/vault.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts +3 -0
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.js +7 -1
- package/dist/idl_codegen_kamino_vault/accounts/VaultState.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.d.ts +25 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.js +43 -1
- package/dist/idl_codegen_kamino_vault/errors/custom.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/initVault.js +1 -0
- package/dist/idl_codegen_kamino_vault/instructions/initVault.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js +1 -1
- package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts +13 -0
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js +25 -1
- package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/index.d.ts +2 -2
- package/dist/idl_codegen_kamino_vault/types/index.d.ts.map +1 -1
- package/dist/idl_codegen_kamino_vault/types/index.js.map +1 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +2 -1
- package/dist/utils/constants.js.map +1 -1
- package/package.json +1 -1
- package/src/classes/vault.ts +9 -8
- package/src/idl_codegen_kamino_vault/accounts/VaultState.ts +9 -1
- package/src/idl_codegen_kamino_vault/errors/custom.ts +42 -0
- package/src/idl_codegen_kamino_vault/instructions/initVault.ts +2 -0
- package/src/idl_codegen_kamino_vault/instructions/updateReserveAllocation.ts +2 -2
- package/src/idl_codegen_kamino_vault/types/VaultConfigField.ts +30 -0
- package/src/idl_codegen_kamino_vault/types/index.ts +2 -0
- package/src/idl_kamino_vault.json +30 -3
- package/src/utils/constants.ts +1 -0
|
@@ -38,6 +38,7 @@ export interface VaultStateFields {
|
|
|
38
38
|
vaultFarm: PublicKey
|
|
39
39
|
creationTimestamp: BN
|
|
40
40
|
padding1: BN
|
|
41
|
+
allocationAdmin: PublicKey
|
|
41
42
|
padding2: Array<BN>
|
|
42
43
|
}
|
|
43
44
|
|
|
@@ -75,6 +76,7 @@ export interface VaultStateJSON {
|
|
|
75
76
|
vaultFarm: string
|
|
76
77
|
creationTimestamp: string
|
|
77
78
|
padding1: string
|
|
79
|
+
allocationAdmin: string
|
|
78
80
|
padding2: Array<string>
|
|
79
81
|
}
|
|
80
82
|
|
|
@@ -112,6 +114,7 @@ export class VaultState {
|
|
|
112
114
|
readonly vaultFarm: PublicKey
|
|
113
115
|
readonly creationTimestamp: BN
|
|
114
116
|
readonly padding1: BN
|
|
117
|
+
readonly allocationAdmin: PublicKey
|
|
115
118
|
readonly padding2: Array<BN>
|
|
116
119
|
|
|
117
120
|
static readonly discriminator = Buffer.from([
|
|
@@ -152,7 +155,8 @@ export class VaultState {
|
|
|
152
155
|
borsh.publicKey("vaultFarm"),
|
|
153
156
|
borsh.u64("creationTimestamp"),
|
|
154
157
|
borsh.u64("padding1"),
|
|
155
|
-
borsh.
|
|
158
|
+
borsh.publicKey("allocationAdmin"),
|
|
159
|
+
borsh.array(borsh.u128(), 242, "padding2"),
|
|
156
160
|
])
|
|
157
161
|
|
|
158
162
|
constructor(fields: VaultStateFields) {
|
|
@@ -191,6 +195,7 @@ export class VaultState {
|
|
|
191
195
|
this.vaultFarm = fields.vaultFarm
|
|
192
196
|
this.creationTimestamp = fields.creationTimestamp
|
|
193
197
|
this.padding1 = fields.padding1
|
|
198
|
+
this.allocationAdmin = fields.allocationAdmin
|
|
194
199
|
this.padding2 = fields.padding2
|
|
195
200
|
}
|
|
196
201
|
|
|
@@ -275,6 +280,7 @@ export class VaultState {
|
|
|
275
280
|
vaultFarm: dec.vaultFarm,
|
|
276
281
|
creationTimestamp: dec.creationTimestamp,
|
|
277
282
|
padding1: dec.padding1,
|
|
283
|
+
allocationAdmin: dec.allocationAdmin,
|
|
278
284
|
padding2: dec.padding2,
|
|
279
285
|
})
|
|
280
286
|
}
|
|
@@ -316,6 +322,7 @@ export class VaultState {
|
|
|
316
322
|
vaultFarm: this.vaultFarm.toString(),
|
|
317
323
|
creationTimestamp: this.creationTimestamp.toString(),
|
|
318
324
|
padding1: this.padding1.toString(),
|
|
325
|
+
allocationAdmin: this.allocationAdmin.toString(),
|
|
319
326
|
padding2: this.padding2.map((item) => item.toString()),
|
|
320
327
|
}
|
|
321
328
|
}
|
|
@@ -357,6 +364,7 @@ export class VaultState {
|
|
|
357
364
|
vaultFarm: new PublicKey(obj.vaultFarm),
|
|
358
365
|
creationTimestamp: new BN(obj.creationTimestamp),
|
|
359
366
|
padding1: new BN(obj.padding1),
|
|
367
|
+
allocationAdmin: new PublicKey(obj.allocationAdmin),
|
|
360
368
|
padding2: obj.padding2.map((item) => new BN(item)),
|
|
361
369
|
})
|
|
362
370
|
}
|
|
@@ -43,6 +43,9 @@ export type CustomError =
|
|
|
43
43
|
| ManagementFeeGreaterThanMaxAllowed
|
|
44
44
|
| VaultAUMZero
|
|
45
45
|
| MissingReserveForBatchRefresh
|
|
46
|
+
| MinWithdrawAmountTooBig
|
|
47
|
+
| InvestTooSoon
|
|
48
|
+
| WrongAdminOrAllocationAdmin
|
|
46
49
|
|
|
47
50
|
export class DepositAmountsZero extends Error {
|
|
48
51
|
static readonly code = 7000
|
|
@@ -528,6 +531,39 @@ export class MissingReserveForBatchRefresh extends Error {
|
|
|
528
531
|
}
|
|
529
532
|
}
|
|
530
533
|
|
|
534
|
+
export class MinWithdrawAmountTooBig extends Error {
|
|
535
|
+
static readonly code = 7044
|
|
536
|
+
readonly code = 7044
|
|
537
|
+
readonly name = "MinWithdrawAmountTooBig"
|
|
538
|
+
readonly msg = "Min withdraw amount is too big"
|
|
539
|
+
|
|
540
|
+
constructor(readonly logs?: string[]) {
|
|
541
|
+
super("7044: Min withdraw amount is too big")
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export class InvestTooSoon extends Error {
|
|
546
|
+
static readonly code = 7045
|
|
547
|
+
readonly code = 7045
|
|
548
|
+
readonly name = "InvestTooSoon"
|
|
549
|
+
readonly msg = "Invest is called too soon after last invest"
|
|
550
|
+
|
|
551
|
+
constructor(readonly logs?: string[]) {
|
|
552
|
+
super("7045: Invest is called too soon after last invest")
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
export class WrongAdminOrAllocationAdmin extends Error {
|
|
557
|
+
static readonly code = 7046
|
|
558
|
+
readonly code = 7046
|
|
559
|
+
readonly name = "WrongAdminOrAllocationAdmin"
|
|
560
|
+
readonly msg = "Wrong admin or allocation admin"
|
|
561
|
+
|
|
562
|
+
constructor(readonly logs?: string[]) {
|
|
563
|
+
super("7046: Wrong admin or allocation admin")
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
531
567
|
export function fromCode(code: number, logs?: string[]): CustomError | null {
|
|
532
568
|
switch (code) {
|
|
533
569
|
case 7000:
|
|
@@ -618,6 +654,12 @@ export function fromCode(code: number, logs?: string[]): CustomError | null {
|
|
|
618
654
|
return new VaultAUMZero(logs)
|
|
619
655
|
case 7043:
|
|
620
656
|
return new MissingReserveForBatchRefresh(logs)
|
|
657
|
+
case 7044:
|
|
658
|
+
return new MinWithdrawAmountTooBig(logs)
|
|
659
|
+
case 7045:
|
|
660
|
+
return new InvestTooSoon(logs)
|
|
661
|
+
case 7046:
|
|
662
|
+
return new WrongAdminOrAllocationAdmin(logs)
|
|
621
663
|
}
|
|
622
664
|
|
|
623
665
|
return null
|
|
@@ -11,6 +11,7 @@ export interface InitVaultAccounts {
|
|
|
11
11
|
tokenVault: PublicKey
|
|
12
12
|
baseTokenMint: PublicKey
|
|
13
13
|
sharesMint: PublicKey
|
|
14
|
+
adminTokenAccount: PublicKey
|
|
14
15
|
systemProgram: PublicKey
|
|
15
16
|
rent: PublicKey
|
|
16
17
|
tokenProgram: PublicKey
|
|
@@ -28,6 +29,7 @@ export function initVault(
|
|
|
28
29
|
{ pubkey: accounts.tokenVault, isSigner: false, isWritable: true },
|
|
29
30
|
{ pubkey: accounts.baseTokenMint, isSigner: false, isWritable: false },
|
|
30
31
|
{ pubkey: accounts.sharesMint, isSigner: false, isWritable: true },
|
|
32
|
+
{ pubkey: accounts.adminTokenAccount, isSigner: false, isWritable: true },
|
|
31
33
|
{ pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
|
|
32
34
|
{ pubkey: accounts.rent, isSigner: false, isWritable: false },
|
|
33
35
|
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
|
|
@@ -10,7 +10,7 @@ export interface UpdateReserveAllocationArgs {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export interface UpdateReserveAllocationAccounts {
|
|
13
|
-
|
|
13
|
+
signer: PublicKey
|
|
14
14
|
vaultState: PublicKey
|
|
15
15
|
baseVaultAuthority: PublicKey
|
|
16
16
|
reserveCollateralMint: PublicKey
|
|
@@ -29,7 +29,7 @@ export function updateReserveAllocation(
|
|
|
29
29
|
programId: PublicKey = PROGRAM_ID
|
|
30
30
|
) {
|
|
31
31
|
const keys: Array<AccountMeta> = [
|
|
32
|
-
{ pubkey: accounts.
|
|
32
|
+
{ pubkey: accounts.signer, isSigner: true, isWritable: true },
|
|
33
33
|
{ pubkey: accounts.vaultState, isSigner: false, isWritable: true },
|
|
34
34
|
{ pubkey: accounts.baseVaultAuthority, isSigner: false, isWritable: false },
|
|
35
35
|
{
|
|
@@ -256,6 +256,29 @@ export class Farm {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
+
export interface AllocationAdminJSON {
|
|
260
|
+
kind: "AllocationAdmin"
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export class AllocationAdmin {
|
|
264
|
+
static readonly discriminator = 11
|
|
265
|
+
static readonly kind = "AllocationAdmin"
|
|
266
|
+
readonly discriminator = 11
|
|
267
|
+
readonly kind = "AllocationAdmin"
|
|
268
|
+
|
|
269
|
+
toJSON(): AllocationAdminJSON {
|
|
270
|
+
return {
|
|
271
|
+
kind: "AllocationAdmin",
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
toEncodable() {
|
|
276
|
+
return {
|
|
277
|
+
AllocationAdmin: {},
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
259
282
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
260
283
|
export function fromDecoded(obj: any): types.VaultConfigFieldKind {
|
|
261
284
|
if (typeof obj !== "object") {
|
|
@@ -295,6 +318,9 @@ export function fromDecoded(obj: any): types.VaultConfigFieldKind {
|
|
|
295
318
|
if ("Farm" in obj) {
|
|
296
319
|
return new Farm()
|
|
297
320
|
}
|
|
321
|
+
if ("AllocationAdmin" in obj) {
|
|
322
|
+
return new AllocationAdmin()
|
|
323
|
+
}
|
|
298
324
|
|
|
299
325
|
throw new Error("Invalid enum object")
|
|
300
326
|
}
|
|
@@ -336,6 +362,9 @@ export function fromJSON(
|
|
|
336
362
|
case "Farm": {
|
|
337
363
|
return new Farm()
|
|
338
364
|
}
|
|
365
|
+
case "AllocationAdmin": {
|
|
366
|
+
return new AllocationAdmin()
|
|
367
|
+
}
|
|
339
368
|
}
|
|
340
369
|
}
|
|
341
370
|
|
|
@@ -352,6 +381,7 @@ export function layout(property?: string) {
|
|
|
352
381
|
borsh.struct([], "Name"),
|
|
353
382
|
borsh.struct([], "LookupTable"),
|
|
354
383
|
borsh.struct([], "Farm"),
|
|
384
|
+
borsh.struct([], "AllocationAdmin"),
|
|
355
385
|
])
|
|
356
386
|
if (property !== undefined) {
|
|
357
387
|
return ret.replicate(property)
|
|
@@ -63,6 +63,7 @@ export type VaultConfigFieldKind =
|
|
|
63
63
|
| VaultConfigField.Name
|
|
64
64
|
| VaultConfigField.LookupTable
|
|
65
65
|
| VaultConfigField.Farm
|
|
66
|
+
| VaultConfigField.AllocationAdmin
|
|
66
67
|
export type VaultConfigFieldJSON =
|
|
67
68
|
| VaultConfigField.PerformanceFeeBpsJSON
|
|
68
69
|
| VaultConfigField.ManagementFeeBpsJSON
|
|
@@ -75,6 +76,7 @@ export type VaultConfigFieldJSON =
|
|
|
75
76
|
| VaultConfigField.NameJSON
|
|
76
77
|
| VaultConfigField.LookupTableJSON
|
|
77
78
|
| VaultConfigField.FarmJSON
|
|
79
|
+
| VaultConfigField.AllocationAdminJSON
|
|
78
80
|
|
|
79
81
|
export { VaultAllocation } from "./VaultAllocation"
|
|
80
82
|
export type {
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
"isMut": true,
|
|
36
36
|
"isSigner": false
|
|
37
37
|
},
|
|
38
|
+
{
|
|
39
|
+
"name": "adminTokenAccount",
|
|
40
|
+
"isMut": true,
|
|
41
|
+
"isSigner": false
|
|
42
|
+
},
|
|
38
43
|
{
|
|
39
44
|
"name": "systemProgram",
|
|
40
45
|
"isMut": false,
|
|
@@ -62,7 +67,7 @@
|
|
|
62
67
|
"name": "updateReserveAllocation",
|
|
63
68
|
"accounts": [
|
|
64
69
|
{
|
|
65
|
-
"name": "
|
|
70
|
+
"name": "signer",
|
|
66
71
|
"isMut": true,
|
|
67
72
|
"isSigner": true
|
|
68
73
|
},
|
|
@@ -996,12 +1001,16 @@
|
|
|
996
1001
|
"name": "padding1",
|
|
997
1002
|
"type": "u64"
|
|
998
1003
|
},
|
|
1004
|
+
{
|
|
1005
|
+
"name": "allocationAdmin",
|
|
1006
|
+
"type": "publicKey"
|
|
1007
|
+
},
|
|
999
1008
|
{
|
|
1000
1009
|
"name": "padding2",
|
|
1001
1010
|
"type": {
|
|
1002
1011
|
"array": [
|
|
1003
1012
|
"u128",
|
|
1004
|
-
|
|
1013
|
+
242
|
|
1005
1014
|
]
|
|
1006
1015
|
}
|
|
1007
1016
|
}
|
|
@@ -1874,6 +1883,9 @@
|
|
|
1874
1883
|
},
|
|
1875
1884
|
{
|
|
1876
1885
|
"name": "Farm"
|
|
1886
|
+
},
|
|
1887
|
+
{
|
|
1888
|
+
"name": "AllocationAdmin"
|
|
1877
1889
|
}
|
|
1878
1890
|
]
|
|
1879
1891
|
}
|
|
@@ -2160,6 +2172,21 @@
|
|
|
2160
2172
|
"code": 7043,
|
|
2161
2173
|
"name": "MissingReserveForBatchRefresh",
|
|
2162
2174
|
"msg": "Missing reserve for batch refresh"
|
|
2175
|
+
},
|
|
2176
|
+
{
|
|
2177
|
+
"code": 7044,
|
|
2178
|
+
"name": "MinWithdrawAmountTooBig",
|
|
2179
|
+
"msg": "Min withdraw amount is too big"
|
|
2180
|
+
},
|
|
2181
|
+
{
|
|
2182
|
+
"code": 7045,
|
|
2183
|
+
"name": "InvestTooSoon",
|
|
2184
|
+
"msg": "Invest is called too soon after last invest"
|
|
2185
|
+
},
|
|
2186
|
+
{
|
|
2187
|
+
"code": 7046,
|
|
2188
|
+
"name": "WrongAdminOrAllocationAdmin",
|
|
2189
|
+
"msg": "Wrong admin or allocation admin"
|
|
2163
2190
|
}
|
|
2164
2191
|
]
|
|
2165
|
-
}
|
|
2192
|
+
}
|
package/src/utils/constants.ts
CHANGED