@kamino-finance/klend-sdk 5.11.0-beta.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.
Files changed (208) hide show
  1. package/dist/classes/action.d.ts +16 -17
  2. package/dist/classes/action.d.ts.map +1 -1
  3. package/dist/classes/action.js +61 -102
  4. package/dist/classes/action.js.map +1 -1
  5. package/dist/classes/manager.d.ts +16 -4
  6. package/dist/classes/manager.d.ts.map +1 -1
  7. package/dist/classes/manager.js +28 -3
  8. package/dist/classes/manager.js.map +1 -1
  9. package/dist/classes/obligation.d.ts +6 -1
  10. package/dist/classes/obligation.d.ts.map +1 -1
  11. package/dist/classes/obligation.js +4 -2
  12. package/dist/classes/obligation.js.map +1 -1
  13. package/dist/classes/reserve.d.ts +2 -2
  14. package/dist/classes/reserve.d.ts.map +1 -1
  15. package/dist/classes/reserve.js +15 -11
  16. package/dist/classes/reserve.js.map +1 -1
  17. package/dist/classes/types.d.ts +4 -0
  18. package/dist/classes/types.d.ts.map +1 -1
  19. package/dist/classes/utils.d.ts.map +1 -1
  20. package/dist/classes/utils.js +1 -2
  21. package/dist/classes/utils.js.map +1 -1
  22. package/dist/classes/vault.d.ts +18 -4
  23. package/dist/classes/vault.d.ts.map +1 -1
  24. package/dist/classes/vault.js +87 -30
  25. package/dist/classes/vault.js.map +1 -1
  26. package/dist/client_kamino_manager.d.ts.map +1 -1
  27. package/dist/client_kamino_manager.js +8 -3
  28. package/dist/client_kamino_manager.js.map +1 -1
  29. package/dist/idl.json +199 -152
  30. package/dist/idl_codegen/accounts/LendingMarket.d.ts +15 -0
  31. package/dist/idl_codegen/accounts/LendingMarket.d.ts.map +1 -1
  32. package/dist/idl_codegen/accounts/LendingMarket.js +11 -1
  33. package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
  34. package/dist/idl_codegen/errors/custom.d.ts +18 -2
  35. package/dist/idl_codegen/errors/custom.d.ts.map +1 -1
  36. package/dist/idl_codegen/errors/custom.js +31 -3
  37. package/dist/idl_codegen/errors/custom.js.map +1 -1
  38. package/dist/idl_codegen/instructions/borrowObligationLiquidity.js +1 -1
  39. package/dist/idl_codegen/instructions/borrowObligationLiquidity.js.map +1 -1
  40. package/dist/idl_codegen/instructions/borrowObligationLiquidityV2.js +1 -1
  41. package/dist/idl_codegen/instructions/borrowObligationLiquidityV2.js.map +1 -1
  42. package/dist/idl_codegen/instructions/depositAndWithdraw.d.ts +52 -0
  43. package/dist/idl_codegen/instructions/depositAndWithdraw.d.ts.map +1 -0
  44. package/dist/idl_codegen/instructions/depositAndWithdraw.js +219 -0
  45. package/dist/idl_codegen/instructions/depositAndWithdraw.js.map +1 -0
  46. package/dist/idl_codegen/instructions/depositReserveLiquidity.js +1 -1
  47. package/dist/idl_codegen/instructions/depositReserveLiquidity.js.map +1 -1
  48. package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.js +1 -1
  49. package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.js.map +1 -1
  50. package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.js +1 -1
  51. package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.js.map +1 -1
  52. package/dist/idl_codegen/instructions/index.d.ts +2 -2
  53. package/dist/idl_codegen/instructions/index.d.ts.map +1 -1
  54. package/dist/idl_codegen/instructions/index.js +3 -3
  55. package/dist/idl_codegen/instructions/index.js.map +1 -1
  56. package/dist/idl_codegen/instructions/initFarmsForReserve.js +1 -1
  57. package/dist/idl_codegen/instructions/initFarmsForReserve.js.map +1 -1
  58. package/dist/idl_codegen/instructions/initObligationFarmsForReserve.js +1 -1
  59. package/dist/idl_codegen/instructions/initObligationFarmsForReserve.js.map +1 -1
  60. package/dist/idl_codegen/instructions/initReserve.d.ts +1 -0
  61. package/dist/idl_codegen/instructions/initReserve.d.ts.map +1 -1
  62. package/dist/idl_codegen/instructions/initReserve.js +5 -0
  63. package/dist/idl_codegen/instructions/initReserve.js.map +1 -1
  64. package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.js +2 -2
  65. package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.js.map +1 -1
  66. package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.js +2 -2
  67. package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.js.map +1 -1
  68. package/dist/idl_codegen/instructions/redeemFees.js +1 -1
  69. package/dist/idl_codegen/instructions/redeemFees.js.map +1 -1
  70. package/dist/idl_codegen/instructions/redeemReserveCollateral.js +1 -1
  71. package/dist/idl_codegen/instructions/redeemReserveCollateral.js.map +1 -1
  72. package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.js +1 -1
  73. package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.js.map +1 -1
  74. package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeem.js +2 -2
  75. package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeem.js.map +1 -1
  76. package/dist/idl_codegen/instructions/repayObligationLiquidity.js +1 -1
  77. package/dist/idl_codegen/instructions/repayObligationLiquidity.js.map +1 -1
  78. package/dist/idl_codegen/instructions/repayObligationLiquidityV2.js +1 -1
  79. package/dist/idl_codegen/instructions/repayObligationLiquidityV2.js.map +1 -1
  80. package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +1 -1
  81. package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -1
  82. package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js +1 -1
  83. package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js.map +1 -1
  84. package/dist/idl_codegen/instructions/withdrawProtocolFee.js +1 -1
  85. package/dist/idl_codegen/instructions/withdrawProtocolFee.js.map +1 -1
  86. package/dist/idl_codegen/instructions/withdrawReferrerFees.js +1 -1
  87. package/dist/idl_codegen/instructions/withdrawReferrerFees.js.map +1 -1
  88. package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +13 -0
  89. package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts.map +1 -1
  90. package/dist/idl_codegen/types/UpdateLendingMarketMode.js +25 -1
  91. package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
  92. package/dist/idl_codegen/types/index.d.ts +2 -2
  93. package/dist/idl_codegen/types/index.d.ts.map +1 -1
  94. package/dist/idl_codegen/types/index.js.map +1 -1
  95. package/dist/idl_codegen/zero_padding/ObligationZP.d.ts +10 -4
  96. package/dist/idl_codegen/zero_padding/ObligationZP.d.ts.map +1 -1
  97. package/dist/idl_codegen/zero_padding/ObligationZP.js +9 -7
  98. package/dist/idl_codegen/zero_padding/ObligationZP.js.map +1 -1
  99. package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts +3 -0
  100. package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts.map +1 -1
  101. package/dist/idl_codegen_kamino_vault/accounts/VaultState.js +7 -1
  102. package/dist/idl_codegen_kamino_vault/accounts/VaultState.js.map +1 -1
  103. package/dist/idl_codegen_kamino_vault/errors/custom.d.ts +25 -1
  104. package/dist/idl_codegen_kamino_vault/errors/custom.d.ts.map +1 -1
  105. package/dist/idl_codegen_kamino_vault/errors/custom.js +43 -1
  106. package/dist/idl_codegen_kamino_vault/errors/custom.js.map +1 -1
  107. package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts +1 -0
  108. package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts.map +1 -1
  109. package/dist/idl_codegen_kamino_vault/instructions/initVault.js +1 -0
  110. package/dist/idl_codegen_kamino_vault/instructions/initVault.js.map +1 -1
  111. package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts +1 -1
  112. package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts.map +1 -1
  113. package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js +1 -1
  114. package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js.map +1 -1
  115. package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts +13 -0
  116. package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts.map +1 -1
  117. package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js +25 -1
  118. package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js.map +1 -1
  119. package/dist/idl_codegen_kamino_vault/types/index.d.ts +2 -2
  120. package/dist/idl_codegen_kamino_vault/types/index.d.ts.map +1 -1
  121. package/dist/idl_codegen_kamino_vault/types/index.js.map +1 -1
  122. package/dist/lending_operations/repay_with_collateral_operations.js +1 -1
  123. package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
  124. package/dist/lending_operations/swap_collateral_operations.d.ts.map +1 -1
  125. package/dist/lending_operations/swap_collateral_operations.js +5 -3
  126. package/dist/lending_operations/swap_collateral_operations.js.map +1 -1
  127. package/dist/leverage/calcs.d.ts +1 -1
  128. package/dist/leverage/calcs.d.ts.map +1 -1
  129. package/dist/leverage/calcs.js +12 -10
  130. package/dist/leverage/calcs.js.map +1 -1
  131. package/dist/leverage/instructions.d.ts +1 -2
  132. package/dist/leverage/instructions.d.ts.map +1 -1
  133. package/dist/leverage/instructions.js +2 -6
  134. package/dist/leverage/instructions.js.map +1 -1
  135. package/dist/leverage/operations.d.ts.map +1 -1
  136. package/dist/leverage/operations.js +19 -13
  137. package/dist/leverage/operations.js.map +1 -1
  138. package/dist/utils/ata.d.ts +1 -1
  139. package/dist/utils/ata.d.ts.map +1 -1
  140. package/dist/utils/ata.js +2 -2
  141. package/dist/utils/ata.js.map +1 -1
  142. package/dist/utils/constants.d.ts +5 -9
  143. package/dist/utils/constants.d.ts.map +1 -1
  144. package/dist/utils/constants.js +6 -10
  145. package/dist/utils/constants.js.map +1 -1
  146. package/dist/utils/instruction.d.ts.map +1 -1
  147. package/dist/utils/instruction.js +1 -3
  148. package/dist/utils/instruction.js.map +1 -1
  149. package/dist/utils/managerTypes.d.ts +1 -0
  150. package/dist/utils/managerTypes.d.ts.map +1 -1
  151. package/dist/utils/managerTypes.js.map +1 -1
  152. package/dist/utils/userMetadata.d.ts.map +1 -1
  153. package/dist/utils/userMetadata.js +2 -1
  154. package/dist/utils/userMetadata.js.map +1 -1
  155. package/package.json +7 -7
  156. package/src/classes/action.ts +77 -105
  157. package/src/classes/manager.ts +35 -3
  158. package/src/classes/obligation.ts +8 -4
  159. package/src/classes/reserve.ts +16 -13
  160. package/src/classes/types.ts +5 -0
  161. package/src/classes/utils.ts +3 -3
  162. package/src/classes/vault.ts +103 -45
  163. package/src/client_kamino_manager.ts +10 -3
  164. package/src/idl.json +199 -152
  165. package/src/idl_codegen/accounts/LendingMarket.ts +21 -1
  166. package/src/idl_codegen/errors/custom.ts +39 -2
  167. package/src/idl_codegen/instructions/borrowObligationLiquidity.ts +1 -1
  168. package/src/idl_codegen/instructions/borrowObligationLiquidityV2.ts +1 -1
  169. package/src/idl_codegen/instructions/depositAndWithdraw.ts +241 -0
  170. package/src/idl_codegen/instructions/depositReserveLiquidity.ts +1 -1
  171. package/src/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateral.ts +1 -1
  172. package/src/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.ts +1 -1
  173. package/src/idl_codegen/instructions/index.ts +4 -4
  174. package/src/idl_codegen/instructions/initFarmsForReserve.ts +1 -1
  175. package/src/idl_codegen/instructions/initObligationFarmsForReserve.ts +1 -1
  176. package/src/idl_codegen/instructions/initReserve.ts +6 -0
  177. package/src/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateral.ts +2 -2
  178. package/src/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.ts +2 -2
  179. package/src/idl_codegen/instructions/redeemFees.ts +1 -1
  180. package/src/idl_codegen/instructions/redeemReserveCollateral.ts +1 -1
  181. package/src/idl_codegen/instructions/refreshObligationFarmsForReserve.ts +1 -1
  182. package/src/idl_codegen/instructions/repayAndWithdrawAndRedeem.ts +2 -2
  183. package/src/idl_codegen/instructions/repayObligationLiquidity.ts +1 -1
  184. package/src/idl_codegen/instructions/repayObligationLiquidityV2.ts +1 -1
  185. package/src/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.ts +1 -1
  186. package/src/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.ts +1 -1
  187. package/src/idl_codegen/instructions/withdrawProtocolFee.ts +1 -1
  188. package/src/idl_codegen/instructions/withdrawReferrerFees.ts +1 -1
  189. package/src/idl_codegen/types/UpdateLendingMarketMode.ts +30 -0
  190. package/src/idl_codegen/types/index.ts +2 -0
  191. package/src/idl_codegen/zero_padding/ObligationZP.ts +12 -6
  192. package/src/idl_codegen_kamino_vault/accounts/VaultState.ts +9 -1
  193. package/src/idl_codegen_kamino_vault/errors/custom.ts +42 -0
  194. package/src/idl_codegen_kamino_vault/instructions/initVault.ts +2 -0
  195. package/src/idl_codegen_kamino_vault/instructions/updateReserveAllocation.ts +2 -2
  196. package/src/idl_codegen_kamino_vault/types/VaultConfigField.ts +30 -0
  197. package/src/idl_codegen_kamino_vault/types/index.ts +2 -0
  198. package/src/idl_kamino_vault.json +30 -3
  199. package/src/lending_operations/repay_with_collateral_operations.ts +1 -0
  200. package/src/lending_operations/swap_collateral_operations.ts +6 -5
  201. package/src/leverage/calcs.ts +16 -13
  202. package/src/leverage/instructions.ts +1 -6
  203. package/src/leverage/operations.ts +28 -18
  204. package/src/utils/ata.ts +1 -1
  205. package/src/utils/constants.ts +6 -11
  206. package/src/utils/instruction.ts +1 -3
  207. package/src/utils/managerTypes.ts +1 -0
  208. package/src/utils/userMetadata.ts +2 -2
@@ -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.array(borsh.u128(), 244, "padding2"),
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
- adminAuthority: PublicKey
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.adminAuthority, isSigner: true, isWritable: true },
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": "adminAuthority",
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
- 244
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
+ }
@@ -318,6 +318,7 @@ async function buildRepayWithCollateralIxs(
318
318
  false,
319
319
  requestElevationGroup,
320
320
  undefined,
321
+ undefined,
321
322
  referrer,
322
323
  scopeRefresh
323
324
  );
@@ -16,11 +16,10 @@ import {
16
16
  ScopeRefresh,
17
17
  U64_MAX,
18
18
  uniqueAccounts,
19
- WRAPPED_SOL_MINT,
20
19
  } from '../utils';
21
20
  import { AddressLookupTableAccount, PublicKey, TransactionInstruction } from '@solana/web3.js';
22
21
  import Decimal from 'decimal.js';
23
- import { createCloseAccountInstruction, TOKEN_PROGRAM_ID } from '@solana/spl-token';
22
+ import { createCloseAccountInstruction, NATIVE_MINT, TOKEN_PROGRAM_ID } from '@solana/spl-token';
24
23
 
25
24
  /**
26
25
  * Inputs to the `getSwapCollIxns()` operation.
@@ -330,11 +329,11 @@ function getAtaCreationIxns(context: SwapCollContext<any>) {
330
329
  function getAtaCloseIxns(context: SwapCollContext<any>) {
331
330
  const ataCloseIxns: TransactionInstruction[] = [];
332
331
  if (
333
- context.sourceCollReserve.getLiquidityMint().equals(WRAPPED_SOL_MINT) ||
334
- context.targetCollReserve.getLiquidityMint().equals(WRAPPED_SOL_MINT)
332
+ context.sourceCollReserve.getLiquidityMint().equals(NATIVE_MINT) ||
333
+ context.targetCollReserve.getLiquidityMint().equals(NATIVE_MINT)
335
334
  ) {
336
335
  const owner = context.obligation.state.owner;
337
- const wsolAta = getAssociatedTokenAddress(WRAPPED_SOL_MINT, owner, false);
336
+ const wsolAta = getAssociatedTokenAddress(NATIVE_MINT, owner, false);
338
337
  ataCloseIxns.push(createCloseAccountInstruction(wsolAta, owner, owner, [], TOKEN_PROGRAM_ID));
339
338
  }
340
339
  return ataCloseIxns;
@@ -385,6 +384,7 @@ async function getDepositTargetCollIxns(
385
384
  false, // we do not need ATA ixns here (we construct and close them ourselves)
386
385
  removesElevationGroup, // we may need to (temporarily) remove the elevation group; the same or a different one will be set on withdraw, if requested
387
386
  false, // we are dealing with an existing obligation, no need to create user metadata
387
+ false, // we do not need to create a lookup table, dealing with an existing obligation
388
388
  context.referrer,
389
389
  context.currentSlot,
390
390
  context.scopeRefresh,
@@ -434,6 +434,7 @@ async function getWithdrawSourceCollIxns(
434
434
  false, // we do not need ATA ixns here (we construct and close them ourselves)
435
435
  requestedElevationGroup !== undefined, // the `elevationGroupIdToRequestAfterWithdraw()` has already decided on this
436
436
  false, // we are dealing with an existing obligation, no need to create user metadata
437
+ false, // we do not need to create a lookup table, dealing with an existing obligation
437
438
  context.referrer,
438
439
  context.currentSlot,
439
440
  undefined, // we have refreshed scope already, during depositing
@@ -65,7 +65,8 @@ export async function calculateMultiplyEffects(
65
65
  debtBorrowFactorPct,
66
66
  priceCollToDebt,
67
67
  priceDebtToColl,
68
- }: LeverageFormsCalcsArgs
68
+ }: LeverageFormsCalcsArgs,
69
+ logEstimations = false
69
70
  ): Promise<FormsCalcsResult> {
70
71
  // calculate estimations for deposit operation
71
72
  const {
@@ -107,18 +108,20 @@ export async function calculateMultiplyEffects(
107
108
  flashLoanFee: flashBorrowReserveFlashLoanFeePercentage, // TODO: is this the right flash borrow?
108
109
  });
109
110
 
110
- console.log(
111
- 'Estimations',
112
- toJson({
113
- activeTab,
114
- depositModeEstimatedDepositAmount,
115
- depositModeEstimatedBorrowAmount,
116
- withdrawModeEstimatedDepositTokenWithdrawn,
117
- withdrawModeEstimatedBorrowTokenWithdrawn,
118
- adjustModeEstimatedDepositAmount,
119
- adjustModeEstimateBorrowAmount,
120
- })
121
- );
111
+ if (logEstimations) {
112
+ console.log(
113
+ 'Estimations',
114
+ toJson({
115
+ activeTab,
116
+ depositModeEstimatedDepositAmount,
117
+ depositModeEstimatedBorrowAmount,
118
+ withdrawModeEstimatedDepositTokenWithdrawn,
119
+ withdrawModeEstimatedBorrowTokenWithdrawn,
120
+ adjustModeEstimatedDepositAmount,
121
+ adjustModeEstimateBorrowAmount,
122
+ })
123
+ );
124
+ }
122
125
 
123
126
  let [isClosingPosition, totalDeposited, totalBorrowed] = [false, new Decimal(0), new Decimal(0)];
124
127
 
@@ -1,4 +1,5 @@
1
1
  import { PublicKey, SYSVAR_INSTRUCTIONS_PUBKEY } from '@solana/web3.js';
2
+ import * as anchor from '@coral-xyz/anchor';
2
3
  import { KaminoReserve } from '../classes';
3
4
  import {
4
5
  FlashBorrowReserveLiquidityArgs,
@@ -9,12 +10,6 @@ import {
9
10
  flashRepayReserveLiquidity,
10
11
  } from '../lib';
11
12
  import Decimal from 'decimal.js';
12
- import * as anchor from '@coral-xyz/anchor';
13
-
14
- export const SOL_MINTS: Array<PublicKey> = [
15
- new PublicKey('So11111111111111111111111111111111111111111'),
16
- new PublicKey('So11111111111111111111111111111111111111112'),
17
- ];
18
13
 
19
14
  export const getFlashLoanInstructions = (args: {
20
15
  borrowIxnIndex: number;
@@ -17,11 +17,10 @@ import {
17
17
  ObligationTypeTag,
18
18
  SOL_DECIMALS,
19
19
  U64_MAX,
20
- WRAPPED_SOL_MINT,
21
20
  createAtasIdempotent,
22
21
  getAssociatedTokenAddress,
23
22
  getComputeBudgetAndPriorityFeeIxns,
24
- getDepositWsolIxns,
23
+ getTransferWsolIxns,
25
24
  getLookupTableAccount,
26
25
  removeBudgetAndAtaIxns,
27
26
  uniqueAccounts,
@@ -35,7 +34,12 @@ import {
35
34
  toJson,
36
35
  withdrawLeverageCalcs,
37
36
  } from './calcs';
38
- import { TOKEN_PROGRAM_ID, createCloseAccountInstruction, getAssociatedTokenAddressSync } from '@solana/spl-token';
37
+ import {
38
+ NATIVE_MINT,
39
+ TOKEN_PROGRAM_ID,
40
+ createCloseAccountInstruction,
41
+ getAssociatedTokenAddressSync,
42
+ } from '@solana/spl-token';
39
43
  import { Kamino, StrategyWithAddress } from '@kamino-finance/kliquidity-sdk';
40
44
  import { getExpectedTokenBalanceAfterBorrow, getKtokenToTokenSwapper, getTokenToKtokenSwapper } from './utils';
41
45
  import { FullBPS } from '@kamino-finance/kliquidity-sdk/dist/utils/CreationParameters';
@@ -90,7 +94,7 @@ export async function getDepositWithLeverageSwapInputs<QuoteResponse>({
90
94
  }> {
91
95
  const collReserve = kaminoMarket.getReserveByMint(collTokenMint)!;
92
96
  const debtReserve = kaminoMarket.getReserveByMint(debtTokenMint)!;
93
- const solTokenReserve = kaminoMarket.getReserveByMint(WRAPPED_SOL_MINT);
97
+ const solTokenReserve = kaminoMarket.getReserveByMint(NATIVE_MINT);
94
98
  const flashLoanFee = collReserve.getFlashLoanFee() || new Decimal(0);
95
99
 
96
100
  const selectedTokenIsCollToken = selectedTokenMint.equals(collTokenMint);
@@ -193,7 +197,7 @@ export async function getDepositWithLeverageSwapInputs<QuoteResponse>({
193
197
 
194
198
  if (collIsKtoken) {
195
199
  let futureBalanceInAta = new Decimal(0);
196
- if (debtTokenMint.equals(WRAPPED_SOL_MINT)) {
200
+ if (debtTokenMint.equals(NATIVE_MINT)) {
197
201
  futureBalanceInAta = futureBalanceInAta.add(
198
202
  !collIsKtoken ? quotePriceCalcs.initDepositInSol : quotePriceCalcs.initDepositInSol
199
203
  );
@@ -370,7 +374,7 @@ export async function getDepositWithLeverageIxns<QuoteResponse>({
370
374
 
371
375
  const collReserve = kaminoMarket.getReserveByMint(collTokenMint);
372
376
  const debtReserve = kaminoMarket.getReserveByMint(debtTokenMint);
373
- const solTokenReserve = kaminoMarket.getReserveByMint(WRAPPED_SOL_MINT);
377
+ const solTokenReserve = kaminoMarket.getReserveByMint(NATIVE_MINT);
374
378
  const depositTokenIsSol = !solTokenReserve ? false : selectedTokenMint.equals(solTokenReserve!.getLiquidityMint());
375
379
 
376
380
  const ixs = await buildDepositWithLeverageIxns(
@@ -491,9 +495,9 @@ async function buildDepositWithLeverageIxns(
491
495
  const fillWsolAtaIxns: TransactionInstruction[] = [];
492
496
  if (depositTokenIsSol) {
493
497
  fillWsolAtaIxns.push(
494
- ...getDepositWsolIxns(
498
+ ...getTransferWsolIxns(
495
499
  owner,
496
- getAssociatedTokenAddressSync(WRAPPED_SOL_MINT, owner),
500
+ getAssociatedTokenAddressSync(NATIVE_MINT, owner),
497
501
  toLamports(calcs.initDepositInSol, SOL_DECIMALS).ceil()
498
502
  )
499
503
  );
@@ -537,6 +541,7 @@ async function buildDepositWithLeverageIxns(
537
541
  false,
538
542
  elevationGroupOverride === 0 ? false : true, // emode
539
543
  false, // to be checked and created in a setup tx in the UI
544
+ false, // to be checked and created in a setup tx in the UI
540
545
  referrer,
541
546
  currentSlot,
542
547
  scopeRefresh
@@ -606,7 +611,7 @@ export async function getWithdrawWithLeverageSwapInputs<QuoteResponse>({
606
611
  const collIsKtoken = await isKtoken(collTokenMint);
607
612
  const strategy = collIsKtoken ? (await kamino!.getStrategyByKTokenMint(collTokenMint))! : undefined;
608
613
 
609
- const solTokenReserve = kaminoMarket.getReserveByMint(WRAPPED_SOL_MINT);
614
+ const solTokenReserve = kaminoMarket.getReserveByMint(NATIVE_MINT);
610
615
  const depositTokenIsSol = !solTokenReserve ? false : selectedTokenMint.equals(solTokenReserve!.getLiquidityMint());
611
616
 
612
617
  const calcs = withdrawLeverageCalcs(
@@ -734,7 +739,7 @@ export async function getWithdrawWithLeverageIxns<QuoteResponse>({
734
739
  const collReserve = kaminoMarket.getReserveByMint(collTokenMint);
735
740
  const debtReserve = kaminoMarket.getReserveByMint(debtTokenMint);
736
741
 
737
- const solTokenReserve = kaminoMarket.getReserveByMint(WRAPPED_SOL_MINT);
742
+ const solTokenReserve = kaminoMarket.getReserveByMint(NATIVE_MINT);
738
743
  const depositTokenIsSol = !solTokenReserve ? false : selectedTokenMint.equals(solTokenReserve!.getLiquidityMint());
739
744
  const { swapInputs, initialInputs } = await getWithdrawWithLeverageSwapInputs({
740
745
  owner,
@@ -898,8 +903,8 @@ export async function buildWithdrawWithLeverageIxns(
898
903
  const atasAndCreateIxns = createAtasIdempotent(owner, mintsToCreateAtas);
899
904
 
900
905
  const closeWsolAtaIxns: TransactionInstruction[] = [];
901
- if (depositTokenIsSol || debtTokenMint.equals(WRAPPED_SOL_MINT)) {
902
- const wsolAta = getAssociatedTokenAddress(WRAPPED_SOL_MINT, owner, false);
906
+ if (depositTokenIsSol || debtTokenMint.equals(NATIVE_MINT)) {
907
+ const wsolAta = getAssociatedTokenAddress(NATIVE_MINT, owner, false);
903
908
  closeWsolAtaIxns.push(createCloseAccountInstruction(wsolAta, owner, owner, [], TOKEN_PROGRAM_ID));
904
909
  }
905
910
 
@@ -908,13 +913,13 @@ export async function buildWithdrawWithLeverageIxns(
908
913
  // TODO: Might be worth removing as it's only needed for Ktokens
909
914
  // This is here so that we have enough wsol to repay in case the kAB swapped to sol after estimates is not enough
910
915
  const fillWsolAtaIxns: TransactionInstruction[] = [];
911
- if (debtTokenMint.equals(WRAPPED_SOL_MINT)) {
916
+ if (debtTokenMint.equals(NATIVE_MINT)) {
912
917
  const halfSolBalance = (await market.getConnection().getBalance(owner)) / LAMPORTS_PER_SOL / 2;
913
918
  const balanceToWrap = halfSolBalance < 0.1 ? halfSolBalance : 0.1;
914
919
  fillWsolAtaIxns.push(
915
- ...getDepositWsolIxns(
920
+ ...getTransferWsolIxns(
916
921
  owner,
917
- getAssociatedTokenAddressSync(WRAPPED_SOL_MINT, owner),
922
+ getAssociatedTokenAddressSync(NATIVE_MINT, owner),
918
923
  toLamports(balanceToWrap, SOL_DECIMALS).ceil()
919
924
  )
920
925
  );
@@ -953,6 +958,7 @@ export async function buildWithdrawWithLeverageIxns(
953
958
  0,
954
959
  false,
955
960
  false, // to be checked and created in a setup tx in the UI (won't be the case for withdraw anyway as this would be created in deposit)
961
+ false, // to be checked and created in a setup tx in the UI (won't be the case for withdraw anyway as this would be created in deposit)
956
962
  isClosingPosition,
957
963
  referrer,
958
964
  { includeScopeRefresh: true, scopeFeed: scopeFeed! }
@@ -1496,6 +1502,7 @@ async function buildIncreaseLeverageIxns(
1496
1502
  false,
1497
1503
  false,
1498
1504
  false, // to be checked and create in a setup tx in the UI (won't be the case for adjust anyway as this would be created in deposit)
1505
+ false, // to be checked and create in a setup tx in the UI (won't be the case for adjust anyway as this would be created in deposit)
1499
1506
  referrer,
1500
1507
  currentSlot,
1501
1508
  { includeScopeRefresh: true, scopeFeed: scopeFeed! }
@@ -1513,6 +1520,7 @@ async function buildIncreaseLeverageIxns(
1513
1520
  false,
1514
1521
  false,
1515
1522
  false, // to be checked and create in a setup tx in the UI (won't be the case for adjust anyway as this would be created in deposit)
1523
+ false, // to be checked and create in a setup tx in the UI (won't be the case for adjust anyway as this would be created in deposit)
1516
1524
  referrer,
1517
1525
  currentSlot,
1518
1526
  { includeScopeRefresh: true, scopeFeed: scopeFeed! }
@@ -1633,15 +1641,15 @@ async function buildDecreaseLeverageIxns(
1633
1641
  // This is here so that we have enough wsol to repay in case the kAB swapped to sol after estimates is not enough
1634
1642
  const closeWsolAtaIxns: TransactionInstruction[] = [];
1635
1643
  const fillWsolAtaIxns: TransactionInstruction[] = [];
1636
- if (debtTokenMint.equals(WRAPPED_SOL_MINT)) {
1637
- const wsolAta = getAssociatedTokenAddress(WRAPPED_SOL_MINT, owner, false);
1644
+ if (debtTokenMint.equals(NATIVE_MINT)) {
1645
+ const wsolAta = getAssociatedTokenAddress(NATIVE_MINT, owner, false);
1638
1646
 
1639
1647
  closeWsolAtaIxns.push(createCloseAccountInstruction(wsolAta, owner, owner, [], TOKEN_PROGRAM_ID));
1640
1648
 
1641
1649
  const halfSolBalance = (await kaminoMarket.getConnection().getBalance(owner)) / LAMPORTS_PER_SOL / 2;
1642
1650
  const balanceToWrap = halfSolBalance < 0.1 ? halfSolBalance : 0.1;
1643
1651
  fillWsolAtaIxns.push(
1644
- ...getDepositWsolIxns(owner, wsolAta, toLamports(balanceToWrap, debtReserve!.stats.decimals).ceil())
1652
+ ...getTransferWsolIxns(owner, wsolAta, toLamports(balanceToWrap, debtReserve!.stats.decimals).ceil())
1645
1653
  );
1646
1654
  }
1647
1655
 
@@ -1675,6 +1683,7 @@ async function buildDecreaseLeverageIxns(
1675
1683
  false,
1676
1684
  false,
1677
1685
  false, // to be checked and create in a setup tx in the UI (won't be the case for adjust anyway as this would be created in deposit)
1686
+ false, // to be checked and create in a setup tx in the UI (won't be the case for adjust anyway as this would be created in deposit)
1678
1687
  referrer,
1679
1688
  scopeRefresh
1680
1689
  );
@@ -1691,6 +1700,7 @@ async function buildDecreaseLeverageIxns(
1691
1700
  false,
1692
1701
  false,
1693
1702
  false, // to be checked and create in a setup tx in the UI (won't be the case for adjust anyway as this would be created in deposit)
1703
+ false, // to be checked and create in a setup tx in the UI (won't be the case for adjust anyway as this would be created in deposit)
1694
1704
  referrer,
1695
1705
  currentSlot,
1696
1706
  { includeScopeRefresh: true, scopeFeed: scopeFeed! }
package/src/utils/ata.ts CHANGED
@@ -98,7 +98,7 @@ export function createAtasIdempotent(
98
98
  return res;
99
99
  }
100
100
 
101
- export function getDepositWsolIxns(owner: PublicKey, ata: PublicKey, amountLamports: Decimal) {
101
+ export function getTransferWsolIxns(owner: PublicKey, ata: PublicKey, amountLamports: Decimal) {
102
102
  const ixns: TransactionInstruction[] = [];
103
103
 
104
104
  ixns.push(
@@ -72,22 +72,17 @@ export const SLOTS_PER_YEAR = SLOTS_PER_DAY * 365;
72
72
  */
73
73
  export const MIN_AUTODELEVERAGE_BONUS_BPS = 50;
74
74
 
75
- /**
76
- * WSOL Mint
77
- */
78
- export const WRAPPED_SOL_MINT = new PublicKey('So11111111111111111111111111111111111111112');
79
-
80
75
  export const SOL_DECIMALS = 9;
81
76
 
82
- /**
83
- * USDC Mint
84
- */
85
- export const USDC_MAINNET_MINT = new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v');
86
-
87
77
  export const MAINNET_BETA_CHAIN_ID = 101;
88
78
 
89
- export const POSITION_LIMIT = 10;
90
79
  export const BORROWS_LIMIT = 5;
91
80
  export const DEPOSITS_LIMIT = 8;
92
81
 
93
82
  export const DEFAULT_MAX_COMPUTE_UNITS = 1_400_000;
83
+
84
+ /**
85
+ * Minimum initial deposit required for the initialization of a reserve
86
+ */
87
+ export const MIN_INITIAL_DEPOSIT = 100_000;
88
+ export const MIN_VAULT_INITIAL_DEPOSIT = 1_000_000_000;
@@ -38,7 +38,7 @@ export async function buildAndSendTxnWithLogs(
38
38
  });
39
39
  console.log('Transaction Hash:', withDescription, sig);
40
40
  if (withLogsIfSuccess) {
41
- await sleep(5000);
41
+ await sleep(1000);
42
42
  const res = await c.getTransaction(sig, {
43
43
  commitment: 'confirmed',
44
44
  maxSupportedTransactionVersion: 6,
@@ -49,7 +49,6 @@ export async function buildAndSendTxnWithLogs(
49
49
  } catch (e: any) {
50
50
  console.log(e);
51
51
  process.stdout.write(e.logs.toString());
52
- await sleep(5000);
53
52
  const sig = e.toString().split(' failed ')[0].split('Transaction ')[1];
54
53
  const res: VersionedTransactionResponse | null = await c.getTransaction(sig, {
55
54
  commitment: 'confirmed',
@@ -115,7 +114,6 @@ export async function simulateTxn(c: Connection, tx: Transaction, owner: Keypair
115
114
  } catch (e: any) {
116
115
  console.log(e);
117
116
  process.stdout.write(e.logs.toString());
118
- await sleep(5000);
119
117
  const sig = e.toString().split(' failed ')[0].split('Transaction ')[1];
120
118
  const res: TransactionResponse | null = await c.getTransaction(sig, {
121
119
  commitment: 'confirmed',
@@ -37,6 +37,7 @@ export type CreateKaminoMarketParams = {
37
37
 
38
38
  export type AddAssetToMarketParams = {
39
39
  admin: PublicKey;
40
+ adminLiquiditySource: PublicKey;
40
41
  marketAddress: PublicKey;
41
42
  assetConfig: AssetConfig;
42
43
  };