@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.
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +3 -1
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js.map +1 -1
- package/dist/classes/reserve.d.ts +1 -1
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +11 -8
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +21 -1
- package/dist/classes/vault.js.map +1 -1
- package/dist/client_kamino_manager.d.ts.map +1 -1
- package/dist/client_kamino_manager.js +20 -10
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/idl.json +193 -16
- package/dist/idl_codegen/accounts/GlobalConfig.d.ts +40 -0
- package/dist/idl_codegen/accounts/GlobalConfig.d.ts.map +1 -0
- package/dist/idl_codegen/accounts/GlobalConfig.js +116 -0
- package/dist/idl_codegen/accounts/GlobalConfig.js.map +1 -0
- package/dist/idl_codegen/accounts/LendingMarket.d.ts +24 -3
- package/dist/idl_codegen/accounts/LendingMarket.d.ts.map +1 -1
- package/dist/idl_codegen/accounts/LendingMarket.js +25 -7
- package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
- package/dist/idl_codegen/accounts/index.d.ts +2 -0
- package/dist/idl_codegen/accounts/index.d.ts.map +1 -1
- package/dist/idl_codegen/accounts/index.js +3 -1
- package/dist/idl_codegen/accounts/index.js.map +1 -1
- package/dist/idl_codegen/errors/custom.d.ts +35 -11
- package/dist/idl_codegen/errors/custom.d.ts.map +1 -1
- package/dist/idl_codegen/errors/custom.js +64 -22
- package/dist/idl_codegen/errors/custom.js.map +1 -1
- package/dist/idl_codegen/instructions/idlMissingTypes.d.ts +2 -1
- package/dist/idl_codegen/instructions/idlMissingTypes.d.ts.map +1 -1
- package/dist/idl_codegen/instructions/idlMissingTypes.js +2 -1
- package/dist/idl_codegen/instructions/idlMissingTypes.js.map +1 -1
- package/dist/idl_codegen/instructions/index.d.ts +6 -0
- package/dist/idl_codegen/instructions/index.d.ts.map +1 -1
- package/dist/idl_codegen/instructions/index.js +7 -1
- package/dist/idl_codegen/instructions/index.js.map +1 -1
- package/dist/idl_codegen/instructions/initGlobalConfig.d.ts +10 -0
- package/dist/idl_codegen/instructions/initGlobalConfig.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/initGlobalConfig.js +19 -0
- package/dist/idl_codegen/instructions/initGlobalConfig.js.map +1 -0
- package/dist/idl_codegen/instructions/updateGlobalConfig.d.ts +13 -0
- package/dist/idl_codegen/instructions/updateGlobalConfig.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/updateGlobalConfig.js +61 -0
- package/dist/idl_codegen/instructions/updateGlobalConfig.js.map +1 -0
- package/dist/idl_codegen/instructions/updateGlobalConfigAdmin.d.ts +7 -0
- package/dist/idl_codegen/instructions/updateGlobalConfigAdmin.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/updateGlobalConfigAdmin.js +16 -0
- package/dist/idl_codegen/instructions/updateGlobalConfigAdmin.js.map +1 -0
- package/dist/idl_codegen/instructions/updateReserveConfig.d.ts +5 -4
- package/dist/idl_codegen/instructions/updateReserveConfig.d.ts.map +1 -1
- package/dist/idl_codegen/instructions/updateReserveConfig.js +7 -5
- package/dist/idl_codegen/instructions/updateReserveConfig.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawProtocolFee.d.ts +2 -2
- package/dist/idl_codegen/instructions/withdrawProtocolFee.d.ts.map +1 -1
- package/dist/idl_codegen/instructions/withdrawProtocolFee.js +2 -6
- package/dist/idl_codegen/instructions/withdrawProtocolFee.js.map +1 -1
- package/dist/idl_codegen/types/UpdateGlobalConfigMode.d.ts +32 -0
- package/dist/idl_codegen/types/UpdateGlobalConfigMode.d.ts.map +1 -0
- package/dist/idl_codegen/types/UpdateGlobalConfigMode.js +108 -0
- package/dist/idl_codegen/types/UpdateGlobalConfigMode.js.map +1 -0
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +33 -7
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js +60 -12
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/idl_codegen/types/index.d.ts +6 -2
- package/dist/idl_codegen/types/index.d.ts.map +1 -1
- package/dist/idl_codegen/types/index.js +3 -1
- package/dist/idl_codegen/types/index.js.map +1 -1
- package/dist/utils/instruction.d.ts.map +1 -1
- package/dist/utils/instruction.js.map +1 -1
- package/dist/utils/lookupTable.d.ts.map +1 -1
- package/dist/utils/lookupTable.js +1 -6
- package/dist/utils/lookupTable.js.map +1 -1
- package/dist/utils/managerTypes.js +1 -1
- package/dist/utils/managerTypes.js.map +1 -1
- package/dist/utils/seeds.d.ts +16 -0
- package/dist/utils/seeds.d.ts.map +1 -1
- package/dist/utils/seeds.js +23 -1
- package/dist/utils/seeds.js.map +1 -1
- package/package.json +1 -1
- package/src/classes/manager.ts +3 -1
- package/src/classes/market.ts +2 -6
- package/src/classes/reserve.ts +12 -8
- package/src/classes/vault.ts +32 -1
- package/src/classes/vault_types.ts +1 -1
- package/src/client_kamino_manager.ts +35 -13
- package/src/idl.json +193 -16
- package/src/idl_codegen/accounts/GlobalConfig.ts +125 -0
- package/src/idl_codegen/accounts/LendingMarket.ts +41 -9
- package/src/idl_codegen/accounts/index.ts +2 -0
- package/src/idl_codegen/errors/custom.ts +65 -20
- package/src/idl_codegen/instructions/idlMissingTypes.ts +4 -2
- package/src/idl_codegen/instructions/index.ts +9 -0
- package/src/idl_codegen/instructions/initGlobalConfig.ts +30 -0
- package/src/idl_codegen/instructions/updateGlobalConfig.ts +47 -0
- package/src/idl_codegen/instructions/updateGlobalConfigAdmin.ts +24 -0
- package/src/idl_codegen/instructions/updateReserveConfig.ts +10 -8
- package/src/idl_codegen/instructions/withdrawProtocolFee.ts +4 -8
- package/src/idl_codegen/types/UpdateGlobalConfigMode.ts +90 -0
- package/src/idl_codegen/types/UpdateLendingMarketMode.ts +73 -13
- package/src/idl_codegen/types/index.ts +16 -2
- package/src/utils/instruction.ts +2 -2
- package/src/utils/lookupTable.ts +1 -7
- package/src/utils/managerTypes.ts +1 -1
- package/src/utils/seeds.ts +25 -0
|
@@ -92,14 +92,14 @@ export type CustomError =
|
|
|
92
92
|
| DepositLimitExceeded
|
|
93
93
|
| BorrowingDisabledOutsideElevationGroup
|
|
94
94
|
| NetValueRemainingTooSmall
|
|
95
|
-
|
|
|
95
|
+
| WorseLtvBlocked
|
|
96
96
|
| LiabilitiesBiggerThanAssets
|
|
97
97
|
| ReserveTokenBalanceMismatch
|
|
98
98
|
| ReserveVaultBalanceMismatch
|
|
99
99
|
| ReserveAccountingMismatch
|
|
100
100
|
| BorrowingAboveUtilizationRateDisabled
|
|
101
101
|
| LiquidationBorrowFactorPriority
|
|
102
|
-
|
|
|
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
|
-
|
|
|
121
|
-
|
|
|
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
|
|
1192
|
+
export class WorseLtvBlocked extends Error {
|
|
1190
1193
|
static readonly code = 6093
|
|
1191
1194
|
readonly code = 6093
|
|
1192
|
-
readonly name = "
|
|
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
|
|
1275
|
+
export class LiquidationLowestLiquidationLtvPriority extends Error {
|
|
1273
1276
|
static readonly code = 6100
|
|
1274
1277
|
readonly code = 6100
|
|
1275
|
-
readonly name = "
|
|
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
|
|
1494
|
+
export class LowestLtvAssetsPriority extends Error {
|
|
1492
1495
|
static readonly code = 6118
|
|
1493
1496
|
readonly code = 6118
|
|
1494
|
-
readonly name = "
|
|
1497
|
+
readonly name = "LowestLtvAssetsPriority"
|
|
1495
1498
|
readonly msg =
|
|
1496
|
-
"
|
|
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:
|
|
1503
|
+
"6118: Withdrawing must prioritize the collateral with the lowest reserve max-LTV"
|
|
1501
1504
|
)
|
|
1502
1505
|
}
|
|
1503
1506
|
}
|
|
1504
1507
|
|
|
1505
|
-
export class
|
|
1508
|
+
export class WorseLtvThanUnhealthyLtv extends Error {
|
|
1506
1509
|
static readonly code = 6119
|
|
1507
1510
|
readonly code = 6119
|
|
1508
|
-
readonly name = "
|
|
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
|
|
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
|
|
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
|
|
1883
|
+
return new LowestLtvAssetsPriority(logs)
|
|
1845
1884
|
case 6119:
|
|
1846
|
-
return new
|
|
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
|
-
|
|
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.
|
|
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:
|
|
8
|
+
mode: types.UpdateConfigModeKind
|
|
9
9
|
value: Uint8Array
|
|
10
|
-
|
|
10
|
+
skipConfigIntegrityValidation: boolean
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export interface UpdateReserveConfigAccounts {
|
|
14
|
-
|
|
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
|
-
|
|
21
|
+
types.UpdateConfigMode.layout("mode"),
|
|
21
22
|
borsh.vecU8("value"),
|
|
22
|
-
borsh.bool("
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
12
|
+
globalConfig: PublicKey
|
|
13
13
|
lendingMarket: PublicKey
|
|
14
14
|
reserve: PublicKey
|
|
15
15
|
reserveLiquidityMint: PublicKey
|
|
16
16
|
lendingMarketAuthority: PublicKey
|
|
17
17
|
feeVault: PublicKey
|
|
18
|
-
|
|
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.
|
|
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
|
|
513
|
-
kind: "
|
|
512
|
+
export interface UpdateObligationOrderExecutionEnabledJSON {
|
|
513
|
+
kind: "UpdateObligationOrderExecutionEnabled"
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
-
export class
|
|
516
|
+
export class UpdateObligationOrderExecutionEnabled {
|
|
517
517
|
static readonly discriminator = 22
|
|
518
|
-
static readonly kind = "
|
|
518
|
+
static readonly kind = "UpdateObligationOrderExecutionEnabled"
|
|
519
519
|
readonly discriminator = 22
|
|
520
|
-
readonly kind = "
|
|
520
|
+
readonly kind = "UpdateObligationOrderExecutionEnabled"
|
|
521
521
|
|
|
522
|
-
toJSON():
|
|
522
|
+
toJSON(): UpdateObligationOrderExecutionEnabledJSON {
|
|
523
523
|
return {
|
|
524
|
-
kind: "
|
|
524
|
+
kind: "UpdateObligationOrderExecutionEnabled",
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
527
|
|
|
528
528
|
toEncodable() {
|
|
529
529
|
return {
|
|
530
|
-
|
|
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 ("
|
|
608
|
-
return new
|
|
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 "
|
|
685
|
-
return new
|
|
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([], "
|
|
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.
|
|
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.
|
|
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"
|