@kamino-finance/klend-sdk 5.14.4 → 5.14.5

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 (109) hide show
  1. package/dist/classes/manager.d.ts.map +1 -1
  2. package/dist/classes/manager.js +3 -1
  3. package/dist/classes/manager.js.map +1 -1
  4. package/dist/classes/market.d.ts.map +1 -1
  5. package/dist/classes/market.js.map +1 -1
  6. package/dist/classes/reserve.d.ts +1 -1
  7. package/dist/classes/reserve.d.ts.map +1 -1
  8. package/dist/classes/reserve.js +11 -8
  9. package/dist/classes/reserve.js.map +1 -1
  10. package/dist/classes/vault.d.ts.map +1 -1
  11. package/dist/classes/vault.js +21 -1
  12. package/dist/classes/vault.js.map +1 -1
  13. package/dist/client_kamino_manager.d.ts.map +1 -1
  14. package/dist/client_kamino_manager.js +20 -10
  15. package/dist/client_kamino_manager.js.map +1 -1
  16. package/dist/idl.json +193 -16
  17. package/dist/idl_codegen/accounts/GlobalConfig.d.ts +40 -0
  18. package/dist/idl_codegen/accounts/GlobalConfig.d.ts.map +1 -0
  19. package/dist/idl_codegen/accounts/GlobalConfig.js +116 -0
  20. package/dist/idl_codegen/accounts/GlobalConfig.js.map +1 -0
  21. package/dist/idl_codegen/accounts/LendingMarket.d.ts +24 -3
  22. package/dist/idl_codegen/accounts/LendingMarket.d.ts.map +1 -1
  23. package/dist/idl_codegen/accounts/LendingMarket.js +25 -7
  24. package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
  25. package/dist/idl_codegen/accounts/index.d.ts +2 -0
  26. package/dist/idl_codegen/accounts/index.d.ts.map +1 -1
  27. package/dist/idl_codegen/accounts/index.js +3 -1
  28. package/dist/idl_codegen/accounts/index.js.map +1 -1
  29. package/dist/idl_codegen/errors/custom.d.ts +35 -11
  30. package/dist/idl_codegen/errors/custom.d.ts.map +1 -1
  31. package/dist/idl_codegen/errors/custom.js +64 -22
  32. package/dist/idl_codegen/errors/custom.js.map +1 -1
  33. package/dist/idl_codegen/instructions/idlMissingTypes.d.ts +2 -1
  34. package/dist/idl_codegen/instructions/idlMissingTypes.d.ts.map +1 -1
  35. package/dist/idl_codegen/instructions/idlMissingTypes.js +2 -1
  36. package/dist/idl_codegen/instructions/idlMissingTypes.js.map +1 -1
  37. package/dist/idl_codegen/instructions/index.d.ts +6 -0
  38. package/dist/idl_codegen/instructions/index.d.ts.map +1 -1
  39. package/dist/idl_codegen/instructions/index.js +7 -1
  40. package/dist/idl_codegen/instructions/index.js.map +1 -1
  41. package/dist/idl_codegen/instructions/initGlobalConfig.d.ts +10 -0
  42. package/dist/idl_codegen/instructions/initGlobalConfig.d.ts.map +1 -0
  43. package/dist/idl_codegen/instructions/initGlobalConfig.js +19 -0
  44. package/dist/idl_codegen/instructions/initGlobalConfig.js.map +1 -0
  45. package/dist/idl_codegen/instructions/updateGlobalConfig.d.ts +13 -0
  46. package/dist/idl_codegen/instructions/updateGlobalConfig.d.ts.map +1 -0
  47. package/dist/idl_codegen/instructions/updateGlobalConfig.js +61 -0
  48. package/dist/idl_codegen/instructions/updateGlobalConfig.js.map +1 -0
  49. package/dist/idl_codegen/instructions/updateGlobalConfigAdmin.d.ts +7 -0
  50. package/dist/idl_codegen/instructions/updateGlobalConfigAdmin.d.ts.map +1 -0
  51. package/dist/idl_codegen/instructions/updateGlobalConfigAdmin.js +16 -0
  52. package/dist/idl_codegen/instructions/updateGlobalConfigAdmin.js.map +1 -0
  53. package/dist/idl_codegen/instructions/updateReserveConfig.d.ts +5 -4
  54. package/dist/idl_codegen/instructions/updateReserveConfig.d.ts.map +1 -1
  55. package/dist/idl_codegen/instructions/updateReserveConfig.js +7 -5
  56. package/dist/idl_codegen/instructions/updateReserveConfig.js.map +1 -1
  57. package/dist/idl_codegen/instructions/withdrawProtocolFee.d.ts +2 -2
  58. package/dist/idl_codegen/instructions/withdrawProtocolFee.d.ts.map +1 -1
  59. package/dist/idl_codegen/instructions/withdrawProtocolFee.js +2 -6
  60. package/dist/idl_codegen/instructions/withdrawProtocolFee.js.map +1 -1
  61. package/dist/idl_codegen/types/UpdateGlobalConfigMode.d.ts +32 -0
  62. package/dist/idl_codegen/types/UpdateGlobalConfigMode.d.ts.map +1 -0
  63. package/dist/idl_codegen/types/UpdateGlobalConfigMode.js +108 -0
  64. package/dist/idl_codegen/types/UpdateGlobalConfigMode.js.map +1 -0
  65. package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +33 -7
  66. package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts.map +1 -1
  67. package/dist/idl_codegen/types/UpdateLendingMarketMode.js +60 -12
  68. package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
  69. package/dist/idl_codegen/types/index.d.ts +6 -2
  70. package/dist/idl_codegen/types/index.d.ts.map +1 -1
  71. package/dist/idl_codegen/types/index.js +3 -1
  72. package/dist/idl_codegen/types/index.js.map +1 -1
  73. package/dist/utils/instruction.d.ts.map +1 -1
  74. package/dist/utils/instruction.js.map +1 -1
  75. package/dist/utils/lookupTable.d.ts.map +1 -1
  76. package/dist/utils/lookupTable.js +1 -6
  77. package/dist/utils/lookupTable.js.map +1 -1
  78. package/dist/utils/managerTypes.js +1 -1
  79. package/dist/utils/managerTypes.js.map +1 -1
  80. package/dist/utils/seeds.d.ts +16 -0
  81. package/dist/utils/seeds.d.ts.map +1 -1
  82. package/dist/utils/seeds.js +23 -1
  83. package/dist/utils/seeds.js.map +1 -1
  84. package/package.json +1 -1
  85. package/src/classes/manager.ts +3 -1
  86. package/src/classes/market.ts +2 -6
  87. package/src/classes/reserve.ts +12 -8
  88. package/src/classes/vault.ts +32 -1
  89. package/src/classes/vault_types.ts +1 -1
  90. package/src/client_kamino_manager.ts +35 -13
  91. package/src/idl.json +193 -16
  92. package/src/idl_codegen/accounts/GlobalConfig.ts +125 -0
  93. package/src/idl_codegen/accounts/LendingMarket.ts +41 -9
  94. package/src/idl_codegen/accounts/index.ts +2 -0
  95. package/src/idl_codegen/errors/custom.ts +65 -20
  96. package/src/idl_codegen/instructions/idlMissingTypes.ts +4 -2
  97. package/src/idl_codegen/instructions/index.ts +9 -0
  98. package/src/idl_codegen/instructions/initGlobalConfig.ts +30 -0
  99. package/src/idl_codegen/instructions/updateGlobalConfig.ts +47 -0
  100. package/src/idl_codegen/instructions/updateGlobalConfigAdmin.ts +24 -0
  101. package/src/idl_codegen/instructions/updateReserveConfig.ts +10 -8
  102. package/src/idl_codegen/instructions/withdrawProtocolFee.ts +4 -8
  103. package/src/idl_codegen/types/UpdateGlobalConfigMode.ts +90 -0
  104. package/src/idl_codegen/types/UpdateLendingMarketMode.ts +73 -13
  105. package/src/idl_codegen/types/index.ts +16 -2
  106. package/src/utils/instruction.ts +2 -2
  107. package/src/utils/lookupTable.ts +1 -7
  108. package/src/utils/managerTypes.ts +1 -1
  109. package/src/utils/seeds.ts +25 -0
@@ -92,14 +92,14 @@ export type CustomError =
92
92
  | DepositLimitExceeded
93
93
  | BorrowingDisabledOutsideElevationGroup
94
94
  | NetValueRemainingTooSmall
95
- | WorseLTVBlocked
95
+ | WorseLtvBlocked
96
96
  | LiabilitiesBiggerThanAssets
97
97
  | ReserveTokenBalanceMismatch
98
98
  | ReserveVaultBalanceMismatch
99
99
  | ReserveAccountingMismatch
100
100
  | BorrowingAboveUtilizationRateDisabled
101
101
  | LiquidationBorrowFactorPriority
102
- | LiquidationLowestLTVPriority
102
+ | LiquidationLowestLiquidationLtvPriority
103
103
  | ElevationGroupBorrowLimitExceeded
104
104
  | ElevationGroupWithoutDebtReserve
105
105
  | ElevationGroupMaxCollateralReserveZero
@@ -117,8 +117,8 @@ export type CustomError =
117
117
  | ObligationCurrentlyMarkedForDeleveraging
118
118
  | MaximumWithdrawValueZero
119
119
  | ZeroMaxLtvAssetsInDeposits
120
- | MinLtvAssetsPriority
121
- | WorseLTVThanUnhealthyLTV
120
+ | LowestLtvAssetsPriority
121
+ | WorseLtvThanUnhealthyLtv
122
122
  | FarmAccountsMissing
123
123
  | RepayTooSmallForFullLiquidation
124
124
  | InsufficientRepayAmount
@@ -126,6 +126,9 @@ export type CustomError =
126
126
  | InvalidOrderConfiguration
127
127
  | OrderConfigurationNotSupportedByObligation
128
128
  | OperationNotPermittedWithCurrentObligationOrders
129
+ | OperationNotPermittedMarketImmutable
130
+ | OrderCreationDisabled
131
+ | NoUpgradeAuthority
129
132
 
130
133
  export class InvalidMarketAuthority extends Error {
131
134
  static readonly code = 6000
@@ -1186,10 +1189,10 @@ export class NetValueRemainingTooSmall extends Error {
1186
1189
  }
1187
1190
  }
1188
1191
 
1189
- export class WorseLTVBlocked extends Error {
1192
+ export class WorseLtvBlocked extends Error {
1190
1193
  static readonly code = 6093
1191
1194
  readonly code = 6093
1192
- readonly name = "WorseLTVBlocked"
1195
+ readonly name = "WorseLtvBlocked"
1193
1196
  readonly msg = "Cannot get the obligation in a worse position"
1194
1197
 
1195
1198
  constructor(readonly logs?: string[]) {
@@ -1269,16 +1272,16 @@ export class LiquidationBorrowFactorPriority extends Error {
1269
1272
  }
1270
1273
  }
1271
1274
 
1272
- export class LiquidationLowestLTVPriority extends Error {
1275
+ export class LiquidationLowestLiquidationLtvPriority extends Error {
1273
1276
  static readonly code = 6100
1274
1277
  readonly code = 6100
1275
- readonly name = "LiquidationLowestLTVPriority"
1278
+ readonly name = "LiquidationLowestLiquidationLtvPriority"
1276
1279
  readonly msg =
1277
- "Liquidation must prioritize the collateral with the lowest LTV"
1280
+ "Liquidation must prioritize the collateral with the lowest liquidation LTV"
1278
1281
 
1279
1282
  constructor(readonly logs?: string[]) {
1280
1283
  super(
1281
- "6100: Liquidation must prioritize the collateral with the lowest LTV"
1284
+ "6100: Liquidation must prioritize the collateral with the lowest liquidation LTV"
1282
1285
  )
1283
1286
  }
1284
1287
  }
@@ -1488,24 +1491,24 @@ export class ZeroMaxLtvAssetsInDeposits extends Error {
1488
1491
  }
1489
1492
  }
1490
1493
 
1491
- export class MinLtvAssetsPriority extends Error {
1494
+ export class LowestLtvAssetsPriority extends Error {
1492
1495
  static readonly code = 6118
1493
1496
  readonly code = 6118
1494
- readonly name = "MinLtvAssetsPriority"
1497
+ readonly name = "LowestLtvAssetsPriority"
1495
1498
  readonly msg =
1496
- "The operation must prioritize the collateral with the lowest LTV"
1499
+ "Withdrawing must prioritize the collateral with the lowest reserve max-LTV"
1497
1500
 
1498
1501
  constructor(readonly logs?: string[]) {
1499
1502
  super(
1500
- "6118: The operation must prioritize the collateral with the lowest LTV"
1503
+ "6118: Withdrawing must prioritize the collateral with the lowest reserve max-LTV"
1501
1504
  )
1502
1505
  }
1503
1506
  }
1504
1507
 
1505
- export class WorseLTVThanUnhealthyLTV extends Error {
1508
+ export class WorseLtvThanUnhealthyLtv extends Error {
1506
1509
  static readonly code = 6119
1507
1510
  readonly code = 6119
1508
- readonly name = "WorseLTVThanUnhealthyLTV"
1511
+ readonly name = "WorseLtvThanUnhealthyLtv"
1509
1512
  readonly msg = "Cannot get the obligation liquidatable"
1510
1513
 
1511
1514
  constructor(readonly logs?: string[]) {
@@ -1602,6 +1605,42 @@ export class OperationNotPermittedWithCurrentObligationOrders extends Error {
1602
1605
  }
1603
1606
  }
1604
1607
 
1608
+ export class OperationNotPermittedMarketImmutable extends Error {
1609
+ static readonly code = 6127
1610
+ readonly code = 6127
1611
+ readonly name = "OperationNotPermittedMarketImmutable"
1612
+ readonly msg = "Cannot update lending market because it is set as immutable"
1613
+
1614
+ constructor(readonly logs?: string[]) {
1615
+ super("6127: Cannot update lending market because it is set as immutable")
1616
+ }
1617
+ }
1618
+
1619
+ export class OrderCreationDisabled extends Error {
1620
+ static readonly code = 6128
1621
+ readonly code = 6128
1622
+ readonly name = "OrderCreationDisabled"
1623
+ readonly msg = "Creation of new orders is disabled"
1624
+
1625
+ constructor(readonly logs?: string[]) {
1626
+ super("6128: Creation of new orders is disabled")
1627
+ }
1628
+ }
1629
+
1630
+ export class NoUpgradeAuthority extends Error {
1631
+ static readonly code = 6129
1632
+ readonly code = 6129
1633
+ readonly name = "NoUpgradeAuthority"
1634
+ readonly msg =
1635
+ "Cannot initialize global config because there is no upgrade authority to the program"
1636
+
1637
+ constructor(readonly logs?: string[]) {
1638
+ super(
1639
+ "6129: Cannot initialize global config because there is no upgrade authority to the program"
1640
+ )
1641
+ }
1642
+ }
1643
+
1605
1644
  export function fromCode(code: number, logs?: string[]): CustomError | null {
1606
1645
  switch (code) {
1607
1646
  case 6000:
@@ -1791,7 +1830,7 @@ export function fromCode(code: number, logs?: string[]): CustomError | null {
1791
1830
  case 6092:
1792
1831
  return new NetValueRemainingTooSmall(logs)
1793
1832
  case 6093:
1794
- return new WorseLTVBlocked(logs)
1833
+ return new WorseLtvBlocked(logs)
1795
1834
  case 6094:
1796
1835
  return new LiabilitiesBiggerThanAssets(logs)
1797
1836
  case 6095:
@@ -1805,7 +1844,7 @@ export function fromCode(code: number, logs?: string[]): CustomError | null {
1805
1844
  case 6099:
1806
1845
  return new LiquidationBorrowFactorPriority(logs)
1807
1846
  case 6100:
1808
- return new LiquidationLowestLTVPriority(logs)
1847
+ return new LiquidationLowestLiquidationLtvPriority(logs)
1809
1848
  case 6101:
1810
1849
  return new ElevationGroupBorrowLimitExceeded(logs)
1811
1850
  case 6102:
@@ -1841,9 +1880,9 @@ export function fromCode(code: number, logs?: string[]): CustomError | null {
1841
1880
  case 6117:
1842
1881
  return new ZeroMaxLtvAssetsInDeposits(logs)
1843
1882
  case 6118:
1844
- return new MinLtvAssetsPriority(logs)
1883
+ return new LowestLtvAssetsPriority(logs)
1845
1884
  case 6119:
1846
- return new WorseLTVThanUnhealthyLTV(logs)
1885
+ return new WorseLtvThanUnhealthyLtv(logs)
1847
1886
  case 6120:
1848
1887
  return new FarmAccountsMissing(logs)
1849
1888
  case 6121:
@@ -1858,6 +1897,12 @@ export function fromCode(code: number, logs?: string[]): CustomError | null {
1858
1897
  return new OrderConfigurationNotSupportedByObligation(logs)
1859
1898
  case 6126:
1860
1899
  return new OperationNotPermittedWithCurrentObligationOrders(logs)
1900
+ case 6127:
1901
+ return new OperationNotPermittedMarketImmutable(logs)
1902
+ case 6128:
1903
+ return new OrderCreationDisabled(logs)
1904
+ case 6129:
1905
+ return new NoUpgradeAuthority(logs)
1861
1906
  }
1862
1907
 
1863
1908
  return null
@@ -15,7 +15,8 @@ export interface IdlMissingTypesArgs {
15
15
  }
16
16
 
17
17
  export interface IdlMissingTypesAccounts {
18
- lendingMarketOwner: PublicKey
18
+ signer: PublicKey
19
+ globalConfig: PublicKey
19
20
  lendingMarket: PublicKey
20
21
  reserve: PublicKey
21
22
  }
@@ -36,7 +37,8 @@ export function idlMissingTypes(
36
37
  programId: PublicKey = PROGRAM_ID
37
38
  ) {
38
39
  const keys: Array<AccountMeta> = [
39
- { pubkey: accounts.lendingMarketOwner, isSigner: true, isWritable: false },
40
+ { pubkey: accounts.signer, isSigner: true, isWritable: false },
41
+ { pubkey: accounts.globalConfig, isSigner: false, isWritable: false },
40
42
  { pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
41
43
  { pubkey: accounts.reserve, isSigner: false, isWritable: true },
42
44
  ]
@@ -188,6 +188,15 @@ export type {
188
188
  SetObligationOrderArgs,
189
189
  SetObligationOrderAccounts,
190
190
  } from "./setObligationOrder"
191
+ export { initGlobalConfig } from "./initGlobalConfig"
192
+ export type { InitGlobalConfigAccounts } from "./initGlobalConfig"
193
+ export { updateGlobalConfig } from "./updateGlobalConfig"
194
+ export type {
195
+ UpdateGlobalConfigArgs,
196
+ UpdateGlobalConfigAccounts,
197
+ } from "./updateGlobalConfig"
198
+ export { updateGlobalConfigAdmin } from "./updateGlobalConfigAdmin"
199
+ export type { UpdateGlobalConfigAdminAccounts } from "./updateGlobalConfigAdmin"
191
200
  export { idlMissingTypes } from "./idlMissingTypes"
192
201
  export type {
193
202
  IdlMissingTypesArgs,
@@ -0,0 +1,30 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface InitGlobalConfigAccounts {
8
+ payer: PublicKey
9
+ globalConfig: PublicKey
10
+ programData: PublicKey
11
+ systemProgram: PublicKey
12
+ rent: PublicKey
13
+ }
14
+
15
+ export function initGlobalConfig(
16
+ accounts: InitGlobalConfigAccounts,
17
+ programId: PublicKey = PROGRAM_ID
18
+ ) {
19
+ const keys: Array<AccountMeta> = [
20
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
21
+ { pubkey: accounts.globalConfig, isSigner: false, isWritable: true },
22
+ { pubkey: accounts.programData, isSigner: false, isWritable: false },
23
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
24
+ { pubkey: accounts.rent, isSigner: false, isWritable: false },
25
+ ]
26
+ const identifier = Buffer.from([140, 136, 214, 48, 87, 0, 120, 255])
27
+ const data = identifier
28
+ const ix = new TransactionInstruction({ keys, programId, data })
29
+ return ix
30
+ }
@@ -0,0 +1,47 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface UpdateGlobalConfigArgs {
8
+ mode: types.UpdateGlobalConfigModeKind
9
+ value: Uint8Array
10
+ }
11
+
12
+ export interface UpdateGlobalConfigAccounts {
13
+ globalAdmin: PublicKey
14
+ globalConfig: PublicKey
15
+ }
16
+
17
+ export const layout = borsh.struct([
18
+ types.UpdateGlobalConfigMode.layout("mode"),
19
+ borsh.vecU8("value"),
20
+ ])
21
+
22
+ export function updateGlobalConfig(
23
+ args: UpdateGlobalConfigArgs,
24
+ accounts: UpdateGlobalConfigAccounts,
25
+ programId: PublicKey = PROGRAM_ID
26
+ ) {
27
+ const keys: Array<AccountMeta> = [
28
+ { pubkey: accounts.globalAdmin, isSigner: true, isWritable: false },
29
+ { pubkey: accounts.globalConfig, isSigner: false, isWritable: true },
30
+ ]
31
+ const identifier = Buffer.from([164, 84, 130, 189, 111, 58, 250, 200])
32
+ const buffer = Buffer.alloc(1000)
33
+ const len = layout.encode(
34
+ {
35
+ mode: args.mode.toEncodable(),
36
+ value: Buffer.from(
37
+ args.value.buffer,
38
+ args.value.byteOffset,
39
+ args.value.length
40
+ ),
41
+ },
42
+ buffer
43
+ )
44
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
45
+ const ix = new TransactionInstruction({ keys, programId, data })
46
+ return ix
47
+ }
@@ -0,0 +1,24 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface UpdateGlobalConfigAdminAccounts {
8
+ pendingAdmin: PublicKey
9
+ globalConfig: PublicKey
10
+ }
11
+
12
+ export function updateGlobalConfigAdmin(
13
+ accounts: UpdateGlobalConfigAdminAccounts,
14
+ programId: PublicKey = PROGRAM_ID
15
+ ) {
16
+ const keys: Array<AccountMeta> = [
17
+ { pubkey: accounts.pendingAdmin, isSigner: true, isWritable: false },
18
+ { pubkey: accounts.globalConfig, isSigner: false, isWritable: true },
19
+ ]
20
+ const identifier = Buffer.from([184, 87, 23, 193, 156, 238, 175, 119])
21
+ const data = identifier
22
+ const ix = new TransactionInstruction({ keys, programId, data })
23
+ return ix
24
+ }
@@ -5,21 +5,22 @@ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-u
5
5
  import { PROGRAM_ID } from "../programId"
6
6
 
7
7
  export interface UpdateReserveConfigArgs {
8
- mode: BN
8
+ mode: types.UpdateConfigModeKind
9
9
  value: Uint8Array
10
- skipValidation: boolean
10
+ skipConfigIntegrityValidation: boolean
11
11
  }
12
12
 
13
13
  export interface UpdateReserveConfigAccounts {
14
- lendingMarketOwner: PublicKey
14
+ signer: PublicKey
15
+ globalConfig: PublicKey
15
16
  lendingMarket: PublicKey
16
17
  reserve: PublicKey
17
18
  }
18
19
 
19
20
  export const layout = borsh.struct([
20
- borsh.u64("mode"),
21
+ types.UpdateConfigMode.layout("mode"),
21
22
  borsh.vecU8("value"),
22
- borsh.bool("skipValidation"),
23
+ borsh.bool("skipConfigIntegrityValidation"),
23
24
  ])
24
25
 
25
26
  export function updateReserveConfig(
@@ -28,7 +29,8 @@ export function updateReserveConfig(
28
29
  programId: PublicKey = PROGRAM_ID
29
30
  ) {
30
31
  const keys: Array<AccountMeta> = [
31
- { pubkey: accounts.lendingMarketOwner, isSigner: true, isWritable: false },
32
+ { pubkey: accounts.signer, isSigner: true, isWritable: false },
33
+ { pubkey: accounts.globalConfig, isSigner: false, isWritable: false },
32
34
  { pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
33
35
  { pubkey: accounts.reserve, isSigner: false, isWritable: true },
34
36
  ]
@@ -36,13 +38,13 @@ export function updateReserveConfig(
36
38
  const buffer = Buffer.alloc(1000)
37
39
  const len = layout.encode(
38
40
  {
39
- mode: args.mode,
41
+ mode: args.mode.toEncodable(),
40
42
  value: Buffer.from(
41
43
  args.value.buffer,
42
44
  args.value.byteOffset,
43
45
  args.value.length
44
46
  ),
45
- skipValidation: args.skipValidation,
47
+ skipConfigIntegrityValidation: args.skipConfigIntegrityValidation,
46
48
  },
47
49
  buffer
48
50
  )
@@ -9,13 +9,13 @@ export interface WithdrawProtocolFeeArgs {
9
9
  }
10
10
 
11
11
  export interface WithdrawProtocolFeeAccounts {
12
- lendingMarketOwner: PublicKey
12
+ globalConfig: PublicKey
13
13
  lendingMarket: PublicKey
14
14
  reserve: PublicKey
15
15
  reserveLiquidityMint: PublicKey
16
16
  lendingMarketAuthority: PublicKey
17
17
  feeVault: PublicKey
18
- lendingMarketOwnerAta: PublicKey
18
+ feeCollectorAta: PublicKey
19
19
  tokenProgram: PublicKey
20
20
  }
21
21
 
@@ -27,7 +27,7 @@ export function withdrawProtocolFee(
27
27
  programId: PublicKey = PROGRAM_ID
28
28
  ) {
29
29
  const keys: Array<AccountMeta> = [
30
- { pubkey: accounts.lendingMarketOwner, isSigner: true, isWritable: false },
30
+ { pubkey: accounts.globalConfig, isSigner: false, isWritable: false },
31
31
  { pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
32
32
  { pubkey: accounts.reserve, isSigner: false, isWritable: false },
33
33
  {
@@ -41,11 +41,7 @@ export function withdrawProtocolFee(
41
41
  isWritable: false,
42
42
  },
43
43
  { pubkey: accounts.feeVault, isSigner: false, isWritable: true },
44
- {
45
- pubkey: accounts.lendingMarketOwnerAta,
46
- isSigner: false,
47
- isWritable: true,
48
- },
44
+ { pubkey: accounts.feeCollectorAta, isSigner: false, isWritable: true },
49
45
  { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
50
46
  ]
51
47
  const identifier = Buffer.from([158, 201, 158, 189, 33, 93, 162, 103])
@@ -0,0 +1,90 @@
1
+ import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as borsh from "@coral-xyz/borsh"
5
+
6
+ export interface PendingAdminJSON {
7
+ kind: "PendingAdmin"
8
+ }
9
+
10
+ export class PendingAdmin {
11
+ static readonly discriminator = 0
12
+ static readonly kind = "PendingAdmin"
13
+ readonly discriminator = 0
14
+ readonly kind = "PendingAdmin"
15
+
16
+ toJSON(): PendingAdminJSON {
17
+ return {
18
+ kind: "PendingAdmin",
19
+ }
20
+ }
21
+
22
+ toEncodable() {
23
+ return {
24
+ PendingAdmin: {},
25
+ }
26
+ }
27
+ }
28
+
29
+ export interface FeeCollectorJSON {
30
+ kind: "FeeCollector"
31
+ }
32
+
33
+ export class FeeCollector {
34
+ static readonly discriminator = 1
35
+ static readonly kind = "FeeCollector"
36
+ readonly discriminator = 1
37
+ readonly kind = "FeeCollector"
38
+
39
+ toJSON(): FeeCollectorJSON {
40
+ return {
41
+ kind: "FeeCollector",
42
+ }
43
+ }
44
+
45
+ toEncodable() {
46
+ return {
47
+ FeeCollector: {},
48
+ }
49
+ }
50
+ }
51
+
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
+ export function fromDecoded(obj: any): types.UpdateGlobalConfigModeKind {
54
+ if (typeof obj !== "object") {
55
+ throw new Error("Invalid enum object")
56
+ }
57
+
58
+ if ("PendingAdmin" in obj) {
59
+ return new PendingAdmin()
60
+ }
61
+ if ("FeeCollector" in obj) {
62
+ return new FeeCollector()
63
+ }
64
+
65
+ throw new Error("Invalid enum object")
66
+ }
67
+
68
+ export function fromJSON(
69
+ obj: types.UpdateGlobalConfigModeJSON
70
+ ): types.UpdateGlobalConfigModeKind {
71
+ switch (obj.kind) {
72
+ case "PendingAdmin": {
73
+ return new PendingAdmin()
74
+ }
75
+ case "FeeCollector": {
76
+ return new FeeCollector()
77
+ }
78
+ }
79
+ }
80
+
81
+ export function layout(property?: string) {
82
+ const ret = borsh.rustEnum([
83
+ borsh.struct([], "PendingAdmin"),
84
+ borsh.struct([], "FeeCollector"),
85
+ ])
86
+ if (property !== undefined) {
87
+ return ret.replicate(property)
88
+ }
89
+ return ret
90
+ }
@@ -509,25 +509,71 @@ export class UpdateInitialDepositAmount {
509
509
  }
510
510
  }
511
511
 
512
- export interface UpdateObligationOrdersEnabledJSON {
513
- kind: "UpdateObligationOrdersEnabled"
512
+ export interface UpdateObligationOrderExecutionEnabledJSON {
513
+ kind: "UpdateObligationOrderExecutionEnabled"
514
514
  }
515
515
 
516
- export class UpdateObligationOrdersEnabled {
516
+ export class UpdateObligationOrderExecutionEnabled {
517
517
  static readonly discriminator = 22
518
- static readonly kind = "UpdateObligationOrdersEnabled"
518
+ static readonly kind = "UpdateObligationOrderExecutionEnabled"
519
519
  readonly discriminator = 22
520
- readonly kind = "UpdateObligationOrdersEnabled"
520
+ readonly kind = "UpdateObligationOrderExecutionEnabled"
521
521
 
522
- toJSON(): UpdateObligationOrdersEnabledJSON {
522
+ toJSON(): UpdateObligationOrderExecutionEnabledJSON {
523
523
  return {
524
- kind: "UpdateObligationOrdersEnabled",
524
+ kind: "UpdateObligationOrderExecutionEnabled",
525
525
  }
526
526
  }
527
527
 
528
528
  toEncodable() {
529
529
  return {
530
- UpdateObligationOrdersEnabled: {},
530
+ UpdateObligationOrderExecutionEnabled: {},
531
+ }
532
+ }
533
+ }
534
+
535
+ export interface UpdateImmutableFlagJSON {
536
+ kind: "UpdateImmutableFlag"
537
+ }
538
+
539
+ export class UpdateImmutableFlag {
540
+ static readonly discriminator = 23
541
+ static readonly kind = "UpdateImmutableFlag"
542
+ readonly discriminator = 23
543
+ readonly kind = "UpdateImmutableFlag"
544
+
545
+ toJSON(): UpdateImmutableFlagJSON {
546
+ return {
547
+ kind: "UpdateImmutableFlag",
548
+ }
549
+ }
550
+
551
+ toEncodable() {
552
+ return {
553
+ UpdateImmutableFlag: {},
554
+ }
555
+ }
556
+ }
557
+
558
+ export interface UpdateObligationOrderCreationEnabledJSON {
559
+ kind: "UpdateObligationOrderCreationEnabled"
560
+ }
561
+
562
+ export class UpdateObligationOrderCreationEnabled {
563
+ static readonly discriminator = 24
564
+ static readonly kind = "UpdateObligationOrderCreationEnabled"
565
+ readonly discriminator = 24
566
+ readonly kind = "UpdateObligationOrderCreationEnabled"
567
+
568
+ toJSON(): UpdateObligationOrderCreationEnabledJSON {
569
+ return {
570
+ kind: "UpdateObligationOrderCreationEnabled",
571
+ }
572
+ }
573
+
574
+ toEncodable() {
575
+ return {
576
+ UpdateObligationOrderCreationEnabled: {},
531
577
  }
532
578
  }
533
579
  }
@@ -604,8 +650,14 @@ export function fromDecoded(obj: any): types.UpdateLendingMarketModeKind {
604
650
  if ("UpdateInitialDepositAmount" in obj) {
605
651
  return new UpdateInitialDepositAmount()
606
652
  }
607
- if ("UpdateObligationOrdersEnabled" in obj) {
608
- return new UpdateObligationOrdersEnabled()
653
+ if ("UpdateObligationOrderExecutionEnabled" in obj) {
654
+ return new UpdateObligationOrderExecutionEnabled()
655
+ }
656
+ if ("UpdateImmutableFlag" in obj) {
657
+ return new UpdateImmutableFlag()
658
+ }
659
+ if ("UpdateObligationOrderCreationEnabled" in obj) {
660
+ return new UpdateObligationOrderCreationEnabled()
609
661
  }
610
662
 
611
663
  throw new Error("Invalid enum object")
@@ -681,8 +733,14 @@ export function fromJSON(
681
733
  case "UpdateInitialDepositAmount": {
682
734
  return new UpdateInitialDepositAmount()
683
735
  }
684
- case "UpdateObligationOrdersEnabled": {
685
- return new UpdateObligationOrdersEnabled()
736
+ case "UpdateObligationOrderExecutionEnabled": {
737
+ return new UpdateObligationOrderExecutionEnabled()
738
+ }
739
+ case "UpdateImmutableFlag": {
740
+ return new UpdateImmutableFlag()
741
+ }
742
+ case "UpdateObligationOrderCreationEnabled": {
743
+ return new UpdateObligationOrderCreationEnabled()
686
744
  }
687
745
  }
688
746
  }
@@ -711,7 +769,9 @@ export function layout(property?: string) {
711
769
  borsh.struct([], "UpdateName"),
712
770
  borsh.struct([], "UpdateIndividualAutodeleverageMarginCallPeriodSecs"),
713
771
  borsh.struct([], "UpdateInitialDepositAmount"),
714
- borsh.struct([], "UpdateObligationOrdersEnabled"),
772
+ borsh.struct([], "UpdateObligationOrderExecutionEnabled"),
773
+ borsh.struct([], "UpdateImmutableFlag"),
774
+ borsh.struct([], "UpdateObligationOrderCreationEnabled"),
715
775
  ])
716
776
  if (property !== undefined) {
717
777
  return ret.replicate(property)
@@ -1,6 +1,7 @@
1
1
  import * as UpdateConfigMode from "./UpdateConfigMode"
2
2
  import * as UpdateLendingMarketConfigValue from "./UpdateLendingMarketConfigValue"
3
3
  import * as UpdateLendingMarketMode from "./UpdateLendingMarketMode"
4
+ import * as UpdateGlobalConfigMode from "./UpdateGlobalConfigMode"
4
5
  import * as AssetTier from "./AssetTier"
5
6
  import * as FeeCalculation from "./FeeCalculation"
6
7
  import * as ReserveFarmKind from "./ReserveFarmKind"
@@ -159,7 +160,9 @@ export type UpdateLendingMarketModeKind =
159
160
  | UpdateLendingMarketMode.UpdateName
160
161
  | UpdateLendingMarketMode.UpdateIndividualAutodeleverageMarginCallPeriodSecs
161
162
  | UpdateLendingMarketMode.UpdateInitialDepositAmount
162
- | UpdateLendingMarketMode.UpdateObligationOrdersEnabled
163
+ | UpdateLendingMarketMode.UpdateObligationOrderExecutionEnabled
164
+ | UpdateLendingMarketMode.UpdateImmutableFlag
165
+ | UpdateLendingMarketMode.UpdateObligationOrderCreationEnabled
163
166
  export type UpdateLendingMarketModeJSON =
164
167
  | UpdateLendingMarketMode.UpdateOwnerJSON
165
168
  | UpdateLendingMarketMode.UpdateEmergencyModeJSON
@@ -183,7 +186,18 @@ export type UpdateLendingMarketModeJSON =
183
186
  | UpdateLendingMarketMode.UpdateNameJSON
184
187
  | UpdateLendingMarketMode.UpdateIndividualAutodeleverageMarginCallPeriodSecsJSON
185
188
  | UpdateLendingMarketMode.UpdateInitialDepositAmountJSON
186
- | UpdateLendingMarketMode.UpdateObligationOrdersEnabledJSON
189
+ | UpdateLendingMarketMode.UpdateObligationOrderExecutionEnabledJSON
190
+ | UpdateLendingMarketMode.UpdateImmutableFlagJSON
191
+ | UpdateLendingMarketMode.UpdateObligationOrderCreationEnabledJSON
192
+
193
+ export { UpdateGlobalConfigMode }
194
+
195
+ export type UpdateGlobalConfigModeKind =
196
+ | UpdateGlobalConfigMode.PendingAdmin
197
+ | UpdateGlobalConfigMode.FeeCollector
198
+ export type UpdateGlobalConfigModeJSON =
199
+ | UpdateGlobalConfigMode.PendingAdminJSON
200
+ | UpdateGlobalConfigMode.FeeCollectorJSON
187
201
 
188
202
  export { LastUpdate } from "./LastUpdate"
189
203
  export type { LastUpdateFields, LastUpdateJSON } from "./LastUpdate"