@kamino-finance/klend-sdk 5.4.0 → 5.4.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.
Files changed (40) hide show
  1. package/dist/classes/action.d.ts +0 -3
  2. package/dist/classes/action.d.ts.map +1 -1
  3. package/dist/classes/action.js +7 -10
  4. package/dist/classes/action.js.map +1 -1
  5. package/dist/classes/manager.d.ts +15 -1
  6. package/dist/classes/manager.d.ts.map +1 -1
  7. package/dist/classes/manager.js +18 -0
  8. package/dist/classes/manager.js.map +1 -1
  9. package/dist/classes/market.d.ts +1 -0
  10. package/dist/classes/market.d.ts.map +1 -1
  11. package/dist/classes/market.js +45 -0
  12. package/dist/classes/market.js.map +1 -1
  13. package/dist/classes/vault.d.ts +22 -0
  14. package/dist/classes/vault.d.ts.map +1 -1
  15. package/dist/classes/vault.js +47 -0
  16. package/dist/classes/vault.js.map +1 -1
  17. package/dist/client_kamino_manager.d.ts.map +1 -1
  18. package/dist/client_kamino_manager.js +13 -0
  19. package/dist/client_kamino_manager.js.map +1 -1
  20. package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts +6 -0
  21. package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts.map +1 -1
  22. package/dist/idl_codegen_kamino_vault/accounts/VaultState.js +13 -1
  23. package/dist/idl_codegen_kamino_vault/accounts/VaultState.js.map +1 -1
  24. package/dist/idl_codegen_kamino_vault/types/VaultAllocation.d.ts +5 -0
  25. package/dist/idl_codegen_kamino_vault/types/VaultAllocation.d.ts.map +1 -1
  26. package/dist/idl_codegen_kamino_vault/types/VaultAllocation.js +8 -1
  27. package/dist/idl_codegen_kamino_vault/types/VaultAllocation.js.map +1 -1
  28. package/dist/utils/constants.d.ts +4 -0
  29. package/dist/utils/constants.d.ts.map +1 -1
  30. package/dist/utils/constants.js +5 -1
  31. package/dist/utils/constants.js.map +1 -1
  32. package/package.json +7 -2
  33. package/src/classes/action.ts +1 -4
  34. package/src/classes/manager.ts +28 -0
  35. package/src/classes/market.ts +65 -0
  36. package/src/classes/vault.ts +76 -1
  37. package/src/client_kamino_manager.ts +20 -0
  38. package/src/idl_codegen_kamino_vault/accounts/VaultState.ts +17 -1
  39. package/src/idl_codegen_kamino_vault/types/VaultAllocation.ts +10 -1
  40. package/src/utils/constants.ts +6 -0
@@ -9,6 +9,7 @@ export interface VaultAllocationFields {
9
9
  targetAllocationWeight: BN
10
10
  /** Maximum token invested in this reserve */
11
11
  tokenAllocationCap: BN
12
+ ctokenVaultBump: BN
12
13
  configPadding: Array<BN>
13
14
  ctokenAllocation: BN
14
15
  lastInvestSlot: BN
@@ -22,6 +23,7 @@ export interface VaultAllocationJSON {
22
23
  targetAllocationWeight: string
23
24
  /** Maximum token invested in this reserve */
24
25
  tokenAllocationCap: string
26
+ ctokenVaultBump: string
25
27
  configPadding: Array<string>
26
28
  ctokenAllocation: string
27
29
  lastInvestSlot: string
@@ -35,6 +37,7 @@ export class VaultAllocation {
35
37
  readonly targetAllocationWeight: BN
36
38
  /** Maximum token invested in this reserve */
37
39
  readonly tokenAllocationCap: BN
40
+ readonly ctokenVaultBump: BN
38
41
  readonly configPadding: Array<BN>
39
42
  readonly ctokenAllocation: BN
40
43
  readonly lastInvestSlot: BN
@@ -46,6 +49,7 @@ export class VaultAllocation {
46
49
  this.ctokenVault = fields.ctokenVault
47
50
  this.targetAllocationWeight = fields.targetAllocationWeight
48
51
  this.tokenAllocationCap = fields.tokenAllocationCap
52
+ this.ctokenVaultBump = fields.ctokenVaultBump
49
53
  this.configPadding = fields.configPadding
50
54
  this.ctokenAllocation = fields.ctokenAllocation
51
55
  this.lastInvestSlot = fields.lastInvestSlot
@@ -60,7 +64,8 @@ export class VaultAllocation {
60
64
  borsh.publicKey("ctokenVault"),
61
65
  borsh.u64("targetAllocationWeight"),
62
66
  borsh.u64("tokenAllocationCap"),
63
- borsh.array(borsh.u64(), 128, "configPadding"),
67
+ borsh.u64("ctokenVaultBump"),
68
+ borsh.array(borsh.u64(), 127, "configPadding"),
64
69
  borsh.u64("ctokenAllocation"),
65
70
  borsh.u64("lastInvestSlot"),
66
71
  borsh.u128("tokenTargetAllocationSf"),
@@ -77,6 +82,7 @@ export class VaultAllocation {
77
82
  ctokenVault: obj.ctokenVault,
78
83
  targetAllocationWeight: obj.targetAllocationWeight,
79
84
  tokenAllocationCap: obj.tokenAllocationCap,
85
+ ctokenVaultBump: obj.ctokenVaultBump,
80
86
  configPadding: obj.configPadding,
81
87
  ctokenAllocation: obj.ctokenAllocation,
82
88
  lastInvestSlot: obj.lastInvestSlot,
@@ -91,6 +97,7 @@ export class VaultAllocation {
91
97
  ctokenVault: fields.ctokenVault,
92
98
  targetAllocationWeight: fields.targetAllocationWeight,
93
99
  tokenAllocationCap: fields.tokenAllocationCap,
100
+ ctokenVaultBump: fields.ctokenVaultBump,
94
101
  configPadding: fields.configPadding,
95
102
  ctokenAllocation: fields.ctokenAllocation,
96
103
  lastInvestSlot: fields.lastInvestSlot,
@@ -105,6 +112,7 @@ export class VaultAllocation {
105
112
  ctokenVault: this.ctokenVault.toString(),
106
113
  targetAllocationWeight: this.targetAllocationWeight.toString(),
107
114
  tokenAllocationCap: this.tokenAllocationCap.toString(),
115
+ ctokenVaultBump: this.ctokenVaultBump.toString(),
108
116
  configPadding: this.configPadding.map((item) => item.toString()),
109
117
  ctokenAllocation: this.ctokenAllocation.toString(),
110
118
  lastInvestSlot: this.lastInvestSlot.toString(),
@@ -119,6 +127,7 @@ export class VaultAllocation {
119
127
  ctokenVault: new PublicKey(obj.ctokenVault),
120
128
  targetAllocationWeight: new BN(obj.targetAllocationWeight),
121
129
  tokenAllocationCap: new BN(obj.tokenAllocationCap),
130
+ ctokenVaultBump: new BN(obj.ctokenVaultBump),
122
131
  configPadding: obj.configPadding.map((item) => new BN(item)),
123
132
  ctokenAllocation: new BN(obj.ctokenAllocation),
124
133
  lastInvestSlot: new BN(obj.lastInvestSlot),
@@ -8,6 +8,8 @@ export const U64_MAX = '18446744073709551615';
8
8
  const INITIAL_COLLATERAL_RATIO = 1;
9
9
  export const INITIAL_COLLATERAL_RATE = new Decimal(INITIAL_COLLATERAL_RATIO);
10
10
 
11
+ export const SECONDS_PER_YEAR = 365.242_199 * 24.0 * 60.0 * 60.0;
12
+
11
13
  export type ENV = 'mainnet-beta' | 'devnet' | 'localnet';
12
14
 
13
15
  export function isENV(value: any): value is ENV {
@@ -81,3 +83,7 @@ export const SOL_DECIMALS = 9;
81
83
  export const USDC_MAINNET_MINT = new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v');
82
84
 
83
85
  export const MAINNET_BETA_CHAIN_ID = 101;
86
+
87
+ export const POSITION_LIMIT = 10;
88
+ export const BORROWS_LIMIT = 5;
89
+ export const DEPOSITS_LIMIT = 8;