@exponent-labs/klend-idl 0.9.0
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/build/accounts/LendingMarket.d.ts +88 -0
- package/build/accounts/LendingMarket.js +225 -0
- package/build/accounts/LendingMarket.js.map +1 -0
- package/build/accounts/Obligation.d.ts +85 -0
- package/build/accounts/Obligation.js +217 -0
- package/build/accounts/Obligation.js.map +1 -0
- package/build/accounts/ReferrerState.d.ts +23 -0
- package/build/accounts/ReferrerState.js +85 -0
- package/build/accounts/ReferrerState.js.map +1 -0
- package/build/accounts/ReferrerTokenState.d.ts +36 -0
- package/build/accounts/ReferrerTokenState.js +116 -0
- package/build/accounts/ReferrerTokenState.js.map +1 -0
- package/build/accounts/Reserve.d.ts +61 -0
- package/build/accounts/Reserve.js +169 -0
- package/build/accounts/Reserve.js.map +1 -0
- package/build/accounts/ShortUrl.d.ts +23 -0
- package/build/accounts/ShortUrl.js +85 -0
- package/build/accounts/ShortUrl.js.map +1 -0
- package/build/accounts/UserMetadata.d.ts +36 -0
- package/build/accounts/UserMetadata.js +116 -0
- package/build/accounts/UserMetadata.js.map +1 -0
- package/build/accounts/UserState.d.ts +69 -0
- package/build/accounts/UserState.js +182 -0
- package/build/accounts/UserState.js.map +1 -0
- package/build/accounts/index.d.ts +16 -0
- package/build/accounts/index.js +20 -0
- package/build/accounts/index.js.map +1 -0
- package/build/errors/anchor.d.ts +434 -0
- package/build/errors/anchor.js +767 -0
- package/build/errors/anchor.js.map +1 -0
- package/build/errors/custom.d.ts +898 -0
- package/build/errors/custom.js +1580 -0
- package/build/errors/custom.js.map +1 -0
- package/build/errors/index.d.ts +5 -0
- package/build/errors/index.js +71 -0
- package/build/errors/index.js.map +1 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +34 -0
- package/build/index.js.map +1 -0
- package/build/instructions/borrowObligationLiquidity.d.ts +21 -0
- package/build/instructions/borrowObligationLiquidity.js +80 -0
- package/build/instructions/borrowObligationLiquidity.js.map +1 -0
- package/build/instructions/borrowObligationLiquidityV2.d.ts +28 -0
- package/build/instructions/borrowObligationLiquidityV2.js +90 -0
- package/build/instructions/borrowObligationLiquidityV2.js.map +1 -0
- package/build/instructions/deleteReferrerStateAndShortUrl.d.ts +9 -0
- package/build/instructions/deleteReferrerStateAndShortUrl.js +20 -0
- package/build/instructions/deleteReferrerStateAndShortUrl.js.map +1 -0
- package/build/instructions/depositObligationCollateral.d.ts +17 -0
- package/build/instructions/depositObligationCollateral.js +64 -0
- package/build/instructions/depositObligationCollateral.js.map +1 -0
- package/build/instructions/depositReserveLiquidity.d.ts +21 -0
- package/build/instructions/depositReserveLiquidity.js +88 -0
- package/build/instructions/depositReserveLiquidity.js.map +1 -0
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.d.ts +23 -0
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.js +94 -0
- package/build/instructions/depositReserveLiquidityAndObligationCollateral.js.map +1 -0
- package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.d.ts +30 -0
- package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js +100 -0
- package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js.map +1 -0
- package/build/instructions/flashBorrowReserveLiquidity.d.ts +21 -0
- package/build/instructions/flashBorrowReserveLiquidity.js +80 -0
- package/build/instructions/flashBorrowReserveLiquidity.js.map +1 -0
- package/build/instructions/flashRepayReserveLiquidity.d.ts +22 -0
- package/build/instructions/flashRepayReserveLiquidity.js +77 -0
- package/build/instructions/flashRepayReserveLiquidity.js.map +1 -0
- package/build/instructions/idlMissingTypes.d.ts +18 -0
- package/build/instructions/idlMissingTypes.js +62 -0
- package/build/instructions/idlMissingTypes.js.map +1 -0
- package/build/instructions/index.d.ts +74 -0
- package/build/instructions/index.js +78 -0
- package/build/instructions/index.js.map +1 -0
- package/build/instructions/initFarmsForReserve.d.ts +18 -0
- package/build/instructions/initFarmsForReserve.js +62 -0
- package/build/instructions/initFarmsForReserve.js.map +1 -0
- package/build/instructions/initLendingMarket.d.ts +13 -0
- package/build/instructions/initLendingMarket.js +53 -0
- package/build/instructions/initLendingMarket.js.map +1 -0
- package/build/instructions/initObligation.d.ts +18 -0
- package/build/instructions/initObligation.js +54 -0
- package/build/instructions/initObligation.js.map +1 -0
- package/build/instructions/initObligationFarmsForReserve.d.ts +19 -0
- package/build/instructions/initObligationFarmsForReserve.js +59 -0
- package/build/instructions/initObligationFarmsForReserve.js.map +1 -0
- package/build/instructions/initReferrerStateAndShortUrl.d.ts +14 -0
- package/build/instructions/initReferrerStateAndShortUrl.js +54 -0
- package/build/instructions/initReferrerStateAndShortUrl.js.map +1 -0
- package/build/instructions/initReferrerTokenState.d.ts +14 -0
- package/build/instructions/initReferrerTokenState.js +50 -0
- package/build/instructions/initReferrerTokenState.js.map +1 -0
- package/build/instructions/initReserve.d.ts +17 -0
- package/build/instructions/initReserve.js +56 -0
- package/build/instructions/initReserve.js.map +1 -0
- package/build/instructions/initUserMetadata.d.ts +14 -0
- package/build/instructions/initUserMetadata.js +54 -0
- package/build/instructions/initUserMetadata.js.map +1 -0
- package/build/instructions/liquidateObligationAndRedeemReserveCollateral.d.ts +31 -0
- package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js +126 -0
- package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js.map +1 -0
- package/build/instructions/redeemFees.d.ts +11 -0
- package/build/instructions/redeemFees.js +38 -0
- package/build/instructions/redeemFees.js.map +1 -0
- package/build/instructions/redeemReserveCollateral.d.ts +21 -0
- package/build/instructions/redeemReserveCollateral.js +92 -0
- package/build/instructions/redeemReserveCollateral.js.map +1 -0
- package/build/instructions/refreshObligation.d.ts +6 -0
- package/build/instructions/refreshObligation.js +17 -0
- package/build/instructions/refreshObligation.js.map +1 -0
- package/build/instructions/refreshObligationFarmsForReserve.d.ts +18 -0
- package/build/instructions/refreshObligationFarmsForReserve.js +62 -0
- package/build/instructions/refreshObligationFarmsForReserve.js.map +1 -0
- package/build/instructions/refreshReserve.d.ts +10 -0
- package/build/instructions/refreshReserve.js +29 -0
- package/build/instructions/refreshReserve.js.map +1 -0
- package/build/instructions/refreshReservesBatch.d.ts +6 -0
- package/build/instructions/refreshReservesBatch.js +43 -0
- package/build/instructions/refreshReservesBatch.js.map +1 -0
- package/build/instructions/repayObligationLiquidity.d.ts +18 -0
- package/build/instructions/repayObligationLiquidity.js +65 -0
- package/build/instructions/repayObligationLiquidity.js.map +1 -0
- package/build/instructions/repayObligationLiquidityV2.d.ts +26 -0
- package/build/instructions/repayObligationLiquidityV2.js +76 -0
- package/build/instructions/repayObligationLiquidityV2.js.map +1 -0
- package/build/instructions/requestElevationGroup.d.ts +11 -0
- package/build/instructions/requestElevationGroup.js +47 -0
- package/build/instructions/requestElevationGroup.js.map +1 -0
- package/build/instructions/socializeLoss.d.ts +14 -0
- package/build/instructions/socializeLoss.js +53 -0
- package/build/instructions/socializeLoss.js.map +1 -0
- package/build/instructions/updateLendingMarket.d.ts +12 -0
- package/build/instructions/updateLendingMarket.js +47 -0
- package/build/instructions/updateLendingMarket.js.map +1 -0
- package/build/instructions/updateLendingMarketOwner.d.ts +6 -0
- package/build/instructions/updateLendingMarketOwner.js +21 -0
- package/build/instructions/updateLendingMarketOwner.js.map +1 -0
- package/build/instructions/updateReserveConfig.d.ts +14 -0
- package/build/instructions/updateReserveConfig.js +49 -0
- package/build/instructions/updateReserveConfig.js.map +1 -0
- package/build/instructions/withdrawObligationCollateral.d.ts +18 -0
- package/build/instructions/withdrawObligationCollateral.js +69 -0
- package/build/instructions/withdrawObligationCollateral.js.map +1 -0
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts +23 -0
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +98 -0
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -0
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.d.ts +30 -0
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js +104 -0
- package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js.map +1 -0
- package/build/instructions/withdrawProtocolFee.d.ts +17 -0
- package/build/instructions/withdrawProtocolFee.js +64 -0
- package/build/instructions/withdrawProtocolFee.js.map +1 -0
- package/build/instructions/withdrawReferrerFees.d.ts +13 -0
- package/build/instructions/withdrawReferrerFees.js +40 -0
- package/build/instructions/withdrawReferrerFees.js.map +1 -0
- package/build/kamino_lending.d.ts +3937 -0
- package/build/kamino_lending.js +3940 -0
- package/build/kamino_lending.js.map +1 -0
- package/build/kamino_lending.json +6352 -0
- package/build/programId.d.ts +3 -0
- package/build/programId.js +9 -0
- package/build/programId.js.map +1 -0
- package/build/types/AssetTier.d.ts +44 -0
- package/build/types/AssetTier.js +122 -0
- package/build/types/AssetTier.js.map +1 -0
- package/build/types/BigFractionBytes.d.ts +26 -0
- package/build/types/BigFractionBytes.js +72 -0
- package/build/types/BigFractionBytes.js.map +1 -0
- package/build/types/BorrowRateCurve.d.ts +27 -0
- package/build/types/BorrowRateCurve.js +63 -0
- package/build/types/BorrowRateCurve.js.map +1 -0
- package/build/types/CurvePoint.d.ts +25 -0
- package/build/types/CurvePoint.js +68 -0
- package/build/types/CurvePoint.js.map +1 -0
- package/build/types/ElevationGroup.d.ts +62 -0
- package/build/types/ElevationGroup.js +125 -0
- package/build/types/ElevationGroup.js.map +1 -0
- package/build/types/FeeCalculation.d.ts +31 -0
- package/build/types/FeeCalculation.js +95 -0
- package/build/types/FeeCalculation.js.map +1 -0
- package/build/types/InitObligationArgs.d.ts +25 -0
- package/build/types/InitObligationArgs.js +68 -0
- package/build/types/InitObligationArgs.js.map +1 -0
- package/build/types/LastUpdate.d.ts +36 -0
- package/build/types/LastUpdate.js +84 -0
- package/build/types/LastUpdate.js.map +1 -0
- package/build/types/ObligationCollateral.d.ts +43 -0
- package/build/types/ObligationCollateral.js +98 -0
- package/build/types/ObligationCollateral.js.map +1 -0
- package/build/types/ObligationLiquidity.d.ts +64 -0
- package/build/types/ObligationLiquidity.js +123 -0
- package/build/types/ObligationLiquidity.js.map +1 -0
- package/build/types/PriceHeuristic.d.ts +32 -0
- package/build/types/PriceHeuristic.js +78 -0
- package/build/types/PriceHeuristic.js.map +1 -0
- package/build/types/PythConfiguration.d.ts +22 -0
- package/build/types/PythConfiguration.js +63 -0
- package/build/types/PythConfiguration.js.map +1 -0
- package/build/types/ReserveCollateral.d.ts +43 -0
- package/build/types/ReserveCollateral.js +97 -0
- package/build/types/ReserveCollateral.js.map +1 -0
- package/build/types/ReserveConfig.d.ts +246 -0
- package/build/types/ReserveConfig.js +269 -0
- package/build/types/ReserveConfig.js.map +1 -0
- package/build/types/ReserveFarmKind.d.ts +31 -0
- package/build/types/ReserveFarmKind.js +98 -0
- package/build/types/ReserveFarmKind.js.map +1 -0
- package/build/types/ReserveFees.d.ts +32 -0
- package/build/types/ReserveFees.js +82 -0
- package/build/types/ReserveFees.js.map +1 -0
- package/build/types/ReserveLiquidity.d.ts +114 -0
- package/build/types/ReserveLiquidity.js +191 -0
- package/build/types/ReserveLiquidity.js.map +1 -0
- package/build/types/ReserveStatus.d.ts +44 -0
- package/build/types/ReserveStatus.js +122 -0
- package/build/types/ReserveStatus.js.map +1 -0
- package/build/types/ScopeConfiguration.d.ts +32 -0
- package/build/types/ScopeConfiguration.js +79 -0
- package/build/types/ScopeConfiguration.js.map +1 -0
- package/build/types/SwitchboardConfiguration.d.ts +27 -0
- package/build/types/SwitchboardConfiguration.js +69 -0
- package/build/types/SwitchboardConfiguration.js.map +1 -0
- package/build/types/TokenInfo.d.ts +99 -0
- package/build/types/TokenInfo.js +145 -0
- package/build/types/TokenInfo.js.map +1 -0
- package/build/types/UpdateConfigMode.d.ts +616 -0
- package/build/types/UpdateConfigMode.js +1178 -0
- package/build/types/UpdateConfigMode.js.map +1 -0
- package/build/types/UpdateLendingMarketConfigValue.d.ts +177 -0
- package/build/types/UpdateLendingMarketConfigValue.js +312 -0
- package/build/types/UpdateLendingMarketConfigValue.js.map +1 -0
- package/build/types/UpdateLendingMarketMode.d.ts +239 -0
- package/build/types/UpdateLendingMarketMode.js +482 -0
- package/build/types/UpdateLendingMarketMode.js.map +1 -0
- package/build/types/WithdrawalCaps.d.ts +37 -0
- package/build/types/WithdrawalCaps.js +89 -0
- package/build/types/WithdrawalCaps.js.map +1 -0
- package/build/types/index.d.ts +64 -0
- package/build/types/index.js +77 -0
- package/build/types/index.js.map +1 -0
- package/package.json +44 -0
- package/src/accounts/LendingMarket.ts +292 -0
- package/src/accounts/Obligation.ts +282 -0
- package/src/accounts/ReferrerState.ts +90 -0
- package/src/accounts/ReferrerTokenState.ts +126 -0
- package/src/accounts/Reserve.ts +218 -0
- package/src/accounts/ShortUrl.ts +86 -0
- package/src/accounts/UserMetadata.ts +126 -0
- package/src/accounts/UserState.ts +210 -0
- package/src/accounts/index.ts +19 -0
- package/src/errors/anchor.ts +773 -0
- package/src/errors/custom.ts +1633 -0
- package/src/errors/index.ts +62 -0
- package/src/index.ts +5 -0
- package/src/instructions/borrowObligationLiquidity.ts +81 -0
- package/src/instructions/borrowObligationLiquidityV2.ts +103 -0
- package/src/instructions/deleteReferrerStateAndShortUrl.ts +27 -0
- package/src/instructions/depositObligationCollateral.ts +61 -0
- package/src/instructions/depositReserveLiquidity.ts +89 -0
- package/src/instructions/depositReserveLiquidityAndObligationCollateral.ts +97 -0
- package/src/instructions/depositReserveLiquidityAndObligationCollateralV2.ts +119 -0
- package/src/instructions/flashBorrowReserveLiquidity.ts +81 -0
- package/src/instructions/flashRepayReserveLiquidity.ts +79 -0
- package/src/instructions/idlMissingTypes.ts +59 -0
- package/src/instructions/index.ts +158 -0
- package/src/instructions/initFarmsForReserve.ts +60 -0
- package/src/instructions/initLendingMarket.ts +46 -0
- package/src/instructions/initObligation.ts +51 -0
- package/src/instructions/initObligationFarmsForReserve.ts +58 -0
- package/src/instructions/initReferrerStateAndShortUrl.ts +48 -0
- package/src/instructions/initReferrerTokenState.ts +44 -0
- package/src/instructions/initReserve.ts +68 -0
- package/src/instructions/initUserMetadata.ts +48 -0
- package/src/instructions/liquidateObligationAndRedeemReserveCollateral.ts +137 -0
- package/src/instructions/redeemFees.ts +44 -0
- package/src/instructions/redeemReserveCollateral.ts +93 -0
- package/src/instructions/refreshObligation.ts +18 -0
- package/src/instructions/refreshObligationFarmsForReserve.ts +60 -0
- package/src/instructions/refreshReserve.ts +34 -0
- package/src/instructions/refreshReservesBatch.ts +24 -0
- package/src/instructions/repayObligationLiquidity.ts +63 -0
- package/src/instructions/repayObligationLiquidityV2.ts +87 -0
- package/src/instructions/requestElevationGroup.ts +38 -0
- package/src/instructions/socializeLoss.ts +47 -0
- package/src/instructions/updateLendingMarket.ts +39 -0
- package/src/instructions/updateLendingMarketOwner.ts +25 -0
- package/src/instructions/updateReserveConfig.ts +43 -0
- package/src/instructions/withdrawObligationCollateral.ts +67 -0
- package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.ts +101 -0
- package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.ts +123 -0
- package/src/instructions/withdrawProtocolFee.ts +61 -0
- package/src/instructions/withdrawReferrerFees.ts +48 -0
- package/src/kamino_lending.json +6352 -0
- package/src/kamino_lending.ts +7873 -0
- package/src/programId.ts +9 -0
- package/src/types/AssetTier.ts +116 -0
- package/src/types/BigFractionBytes.ts +59 -0
- package/src/types/BorrowRateCurve.ts +53 -0
- package/src/types/CurvePoint.ts +58 -0
- package/src/types/ElevationGroup.ts +129 -0
- package/src/types/FeeCalculation.ts +83 -0
- package/src/types/InitObligationArgs.ts +58 -0
- package/src/types/LastUpdate.ts +78 -0
- package/src/types/ObligationCollateral.ts +100 -0
- package/src/types/ObligationLiquidity.ts +140 -0
- package/src/types/PriceHeuristic.ts +72 -0
- package/src/types/PythConfiguration.ts +53 -0
- package/src/types/ReserveCollateral.ts +94 -0
- package/src/types/ReserveConfig.ts +349 -0
- package/src/types/ReserveFarmKind.ts +90 -0
- package/src/types/ReserveFees.ts +76 -0
- package/src/types/ReserveLiquidity.ts +219 -0
- package/src/types/ReserveStatus.ts +120 -0
- package/src/types/ScopeConfiguration.ts +76 -0
- package/src/types/SwitchboardConfiguration.ts +64 -0
- package/src/types/TokenInfo.ts +172 -0
- package/src/types/UpdateConfigMode.ts +1440 -0
- package/src/types/UpdateLendingMarketConfigValue.ts +376 -0
- package/src/types/UpdateLendingMarketMode.ts +570 -0
- package/src/types/WithdrawalCaps.ts +85 -0
- package/src/types/index.ts +275 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,87 @@
|
|
|
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 { PROGRAM_ID } from "../programId"
|
|
5
|
+
|
|
6
|
+
export interface RepayObligationLiquidityV2Args {
|
|
7
|
+
liquidityAmount: BN
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface RepayObligationLiquidityV2Accounts {
|
|
11
|
+
repayAccounts: {
|
|
12
|
+
owner: PublicKey
|
|
13
|
+
obligation: PublicKey
|
|
14
|
+
lendingMarket: PublicKey
|
|
15
|
+
repayReserve: PublicKey
|
|
16
|
+
reserveLiquidityMint: PublicKey
|
|
17
|
+
reserveDestinationLiquidity: PublicKey
|
|
18
|
+
userSourceLiquidity: PublicKey
|
|
19
|
+
tokenProgram: PublicKey
|
|
20
|
+
instructionSysvarAccount: PublicKey
|
|
21
|
+
}
|
|
22
|
+
farmsAccounts: {
|
|
23
|
+
obligationFarmUserState?: PublicKey | null
|
|
24
|
+
reserveFarmState?: PublicKey | null
|
|
25
|
+
}
|
|
26
|
+
lendingMarketAuthority: PublicKey
|
|
27
|
+
farmsProgram: PublicKey
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const layout = borsh.struct([borsh.u64("liquidityAmount")])
|
|
31
|
+
|
|
32
|
+
function optionalAccountMeta(
|
|
33
|
+
pubkey: PublicKey | null | undefined,
|
|
34
|
+
isWritable: boolean,
|
|
35
|
+
programId: PublicKey,
|
|
36
|
+
): AccountMeta {
|
|
37
|
+
return {
|
|
38
|
+
pubkey: pubkey ?? programId,
|
|
39
|
+
isSigner: false,
|
|
40
|
+
isWritable,
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function repayObligationLiquidityV2(
|
|
45
|
+
args: RepayObligationLiquidityV2Args,
|
|
46
|
+
accounts: RepayObligationLiquidityV2Accounts,
|
|
47
|
+
programId: PublicKey = PROGRAM_ID,
|
|
48
|
+
) {
|
|
49
|
+
const keys: Array<AccountMeta> = [
|
|
50
|
+
{ pubkey: accounts.repayAccounts.owner, isSigner: true, isWritable: false },
|
|
51
|
+
{ pubkey: accounts.repayAccounts.obligation, isSigner: false, isWritable: true },
|
|
52
|
+
{ pubkey: accounts.repayAccounts.lendingMarket, isSigner: false, isWritable: false },
|
|
53
|
+
{ pubkey: accounts.repayAccounts.repayReserve, isSigner: false, isWritable: true },
|
|
54
|
+
{
|
|
55
|
+
pubkey: accounts.repayAccounts.reserveLiquidityMint,
|
|
56
|
+
isSigner: false,
|
|
57
|
+
isWritable: false,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
pubkey: accounts.repayAccounts.reserveDestinationLiquidity,
|
|
61
|
+
isSigner: false,
|
|
62
|
+
isWritable: true,
|
|
63
|
+
},
|
|
64
|
+
{ pubkey: accounts.repayAccounts.userSourceLiquidity, isSigner: false, isWritable: true },
|
|
65
|
+
{ pubkey: accounts.repayAccounts.tokenProgram, isSigner: false, isWritable: false },
|
|
66
|
+
{
|
|
67
|
+
pubkey: accounts.repayAccounts.instructionSysvarAccount,
|
|
68
|
+
isSigner: false,
|
|
69
|
+
isWritable: false,
|
|
70
|
+
},
|
|
71
|
+
optionalAccountMeta(accounts.farmsAccounts.obligationFarmUserState, true, programId),
|
|
72
|
+
optionalAccountMeta(accounts.farmsAccounts.reserveFarmState, true, programId),
|
|
73
|
+
{ pubkey: accounts.lendingMarketAuthority, isSigner: false, isWritable: false },
|
|
74
|
+
{ pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
|
|
75
|
+
]
|
|
76
|
+
const identifier = Buffer.from([116, 174, 213, 76, 180, 53, 210, 144])
|
|
77
|
+
const buffer = Buffer.alloc(1000)
|
|
78
|
+
const len = layout.encode(
|
|
79
|
+
{
|
|
80
|
+
liquidityAmount: args.liquidityAmount,
|
|
81
|
+
},
|
|
82
|
+
buffer,
|
|
83
|
+
)
|
|
84
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
85
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
86
|
+
return ix
|
|
87
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import { PROGRAM_ID } from "../programId"
|
|
4
|
+
|
|
5
|
+
export interface RequestElevationGroupArgs {
|
|
6
|
+
elevationGroup: number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface RequestElevationGroupAccounts {
|
|
10
|
+
owner: PublicKey
|
|
11
|
+
obligation: PublicKey
|
|
12
|
+
lendingMarket: PublicKey
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const layout = borsh.struct([borsh.u8("elevationGroup")])
|
|
16
|
+
|
|
17
|
+
export function requestElevationGroup(
|
|
18
|
+
args: RequestElevationGroupArgs,
|
|
19
|
+
accounts: RequestElevationGroupAccounts,
|
|
20
|
+
programId: PublicKey = PROGRAM_ID,
|
|
21
|
+
) {
|
|
22
|
+
const keys: Array<AccountMeta> = [
|
|
23
|
+
{ pubkey: accounts.owner, isSigner: true, isWritable: false },
|
|
24
|
+
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
25
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
26
|
+
]
|
|
27
|
+
const identifier = Buffer.from([36, 119, 251, 129, 34, 240, 7, 147])
|
|
28
|
+
const buffer = Buffer.alloc(1000)
|
|
29
|
+
const len = layout.encode(
|
|
30
|
+
{
|
|
31
|
+
elevationGroup: args.elevationGroup,
|
|
32
|
+
},
|
|
33
|
+
buffer,
|
|
34
|
+
)
|
|
35
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
36
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
37
|
+
return ix
|
|
38
|
+
}
|
|
@@ -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 { PROGRAM_ID } from "../programId"
|
|
5
|
+
|
|
6
|
+
export interface SocializeLossArgs {
|
|
7
|
+
liquidityAmount: BN
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface SocializeLossAccounts {
|
|
11
|
+
riskCouncil: PublicKey
|
|
12
|
+
obligation: PublicKey
|
|
13
|
+
lendingMarket: PublicKey
|
|
14
|
+
reserve: PublicKey
|
|
15
|
+
instructionSysvarAccount: PublicKey
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const layout = borsh.struct([borsh.u64("liquidityAmount")])
|
|
19
|
+
|
|
20
|
+
export function socializeLoss(
|
|
21
|
+
args: SocializeLossArgs,
|
|
22
|
+
accounts: SocializeLossAccounts,
|
|
23
|
+
programId: PublicKey = PROGRAM_ID,
|
|
24
|
+
) {
|
|
25
|
+
const keys: Array<AccountMeta> = [
|
|
26
|
+
{ pubkey: accounts.riskCouncil, isSigner: true, isWritable: false },
|
|
27
|
+
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
28
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
29
|
+
{ pubkey: accounts.reserve, isSigner: false, isWritable: true },
|
|
30
|
+
{
|
|
31
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
32
|
+
isSigner: false,
|
|
33
|
+
isWritable: false,
|
|
34
|
+
},
|
|
35
|
+
]
|
|
36
|
+
const identifier = Buffer.from([245, 75, 91, 0, 236, 97, 19, 3])
|
|
37
|
+
const buffer = Buffer.alloc(1000)
|
|
38
|
+
const len = layout.encode(
|
|
39
|
+
{
|
|
40
|
+
liquidityAmount: args.liquidityAmount,
|
|
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,39 @@
|
|
|
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 { PROGRAM_ID } from "../programId"
|
|
5
|
+
|
|
6
|
+
export interface UpdateLendingMarketArgs {
|
|
7
|
+
mode: BN
|
|
8
|
+
value: Array<number>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface UpdateLendingMarketAccounts {
|
|
12
|
+
lendingMarketOwner: PublicKey
|
|
13
|
+
lendingMarket: PublicKey
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const layout = borsh.struct([borsh.u64("mode"), borsh.array(borsh.u8(), 72, "value")])
|
|
17
|
+
|
|
18
|
+
export function updateLendingMarket(
|
|
19
|
+
args: UpdateLendingMarketArgs,
|
|
20
|
+
accounts: UpdateLendingMarketAccounts,
|
|
21
|
+
programId: PublicKey = PROGRAM_ID,
|
|
22
|
+
) {
|
|
23
|
+
const keys: Array<AccountMeta> = [
|
|
24
|
+
{ pubkey: accounts.lendingMarketOwner, isSigner: true, isWritable: false },
|
|
25
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: true },
|
|
26
|
+
]
|
|
27
|
+
const identifier = Buffer.from([209, 157, 53, 210, 97, 180, 31, 45])
|
|
28
|
+
const buffer = Buffer.alloc(1000)
|
|
29
|
+
const len = layout.encode(
|
|
30
|
+
{
|
|
31
|
+
mode: args.mode,
|
|
32
|
+
value: args.value,
|
|
33
|
+
},
|
|
34
|
+
buffer,
|
|
35
|
+
)
|
|
36
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
37
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
38
|
+
return ix
|
|
39
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import { PROGRAM_ID } from "../programId"
|
|
3
|
+
|
|
4
|
+
export interface UpdateLendingMarketOwnerAccounts {
|
|
5
|
+
lendingMarketOwnerCached: PublicKey
|
|
6
|
+
lendingMarket: PublicKey
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function updateLendingMarketOwner(
|
|
10
|
+
accounts: UpdateLendingMarketOwnerAccounts,
|
|
11
|
+
programId: PublicKey = PROGRAM_ID,
|
|
12
|
+
) {
|
|
13
|
+
const keys: Array<AccountMeta> = [
|
|
14
|
+
{
|
|
15
|
+
pubkey: accounts.lendingMarketOwnerCached,
|
|
16
|
+
isSigner: true,
|
|
17
|
+
isWritable: false,
|
|
18
|
+
},
|
|
19
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: true },
|
|
20
|
+
]
|
|
21
|
+
const identifier = Buffer.from([118, 224, 10, 62, 196, 230, 184, 89])
|
|
22
|
+
const data = identifier
|
|
23
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
24
|
+
return ix
|
|
25
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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 { PROGRAM_ID } from "../programId"
|
|
5
|
+
|
|
6
|
+
export interface UpdateReserveConfigArgs {
|
|
7
|
+
mode: BN
|
|
8
|
+
value: Uint8Array
|
|
9
|
+
skipValidation: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface UpdateReserveConfigAccounts {
|
|
13
|
+
lendingMarketOwner: PublicKey
|
|
14
|
+
lendingMarket: PublicKey
|
|
15
|
+
reserve: PublicKey
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const layout = borsh.struct([borsh.u64("mode"), borsh.vecU8("value"), borsh.bool("skipValidation")])
|
|
19
|
+
|
|
20
|
+
export function updateReserveConfig(
|
|
21
|
+
args: UpdateReserveConfigArgs,
|
|
22
|
+
accounts: UpdateReserveConfigAccounts,
|
|
23
|
+
programId: PublicKey = PROGRAM_ID,
|
|
24
|
+
) {
|
|
25
|
+
const keys: Array<AccountMeta> = [
|
|
26
|
+
{ pubkey: accounts.lendingMarketOwner, isSigner: true, isWritable: false },
|
|
27
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
28
|
+
{ pubkey: accounts.reserve, isSigner: false, isWritable: true },
|
|
29
|
+
]
|
|
30
|
+
const identifier = Buffer.from([61, 148, 100, 70, 143, 107, 17, 13])
|
|
31
|
+
const buffer = Buffer.alloc(1000)
|
|
32
|
+
const len = layout.encode(
|
|
33
|
+
{
|
|
34
|
+
mode: args.mode,
|
|
35
|
+
value: Buffer.from(args.value.buffer, args.value.byteOffset, args.value.length),
|
|
36
|
+
skipValidation: args.skipValidation,
|
|
37
|
+
},
|
|
38
|
+
buffer,
|
|
39
|
+
)
|
|
40
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
41
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
42
|
+
return ix
|
|
43
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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 { PROGRAM_ID } from "../programId"
|
|
5
|
+
|
|
6
|
+
export interface WithdrawObligationCollateralArgs {
|
|
7
|
+
collateralAmount: BN
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface WithdrawObligationCollateralAccounts {
|
|
11
|
+
owner: PublicKey
|
|
12
|
+
obligation: PublicKey
|
|
13
|
+
lendingMarket: PublicKey
|
|
14
|
+
lendingMarketAuthority: PublicKey
|
|
15
|
+
withdrawReserve: PublicKey
|
|
16
|
+
reserveSourceCollateral: PublicKey
|
|
17
|
+
userDestinationCollateral: PublicKey
|
|
18
|
+
tokenProgram: PublicKey
|
|
19
|
+
instructionSysvarAccount: PublicKey
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const layout = borsh.struct([borsh.u64("collateralAmount")])
|
|
23
|
+
|
|
24
|
+
export function withdrawObligationCollateral(
|
|
25
|
+
args: WithdrawObligationCollateralArgs,
|
|
26
|
+
accounts: WithdrawObligationCollateralAccounts,
|
|
27
|
+
programId: PublicKey = PROGRAM_ID,
|
|
28
|
+
) {
|
|
29
|
+
const keys: Array<AccountMeta> = [
|
|
30
|
+
{ pubkey: accounts.owner, isSigner: true, isWritable: false },
|
|
31
|
+
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
32
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
33
|
+
{
|
|
34
|
+
pubkey: accounts.lendingMarketAuthority,
|
|
35
|
+
isSigner: false,
|
|
36
|
+
isWritable: false,
|
|
37
|
+
},
|
|
38
|
+
{ pubkey: accounts.withdrawReserve, isSigner: false, isWritable: true },
|
|
39
|
+
{
|
|
40
|
+
pubkey: accounts.reserveSourceCollateral,
|
|
41
|
+
isSigner: false,
|
|
42
|
+
isWritable: true,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
pubkey: accounts.userDestinationCollateral,
|
|
46
|
+
isSigner: false,
|
|
47
|
+
isWritable: true,
|
|
48
|
+
},
|
|
49
|
+
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
|
|
50
|
+
{
|
|
51
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
52
|
+
isSigner: false,
|
|
53
|
+
isWritable: false,
|
|
54
|
+
},
|
|
55
|
+
]
|
|
56
|
+
const identifier = Buffer.from([37, 116, 205, 103, 243, 192, 92, 198])
|
|
57
|
+
const buffer = Buffer.alloc(1000)
|
|
58
|
+
const len = layout.encode(
|
|
59
|
+
{
|
|
60
|
+
collateralAmount: args.collateralAmount,
|
|
61
|
+
},
|
|
62
|
+
buffer,
|
|
63
|
+
)
|
|
64
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
65
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
66
|
+
return ix
|
|
67
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
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 { PROGRAM_ID } from "../programId"
|
|
5
|
+
|
|
6
|
+
export interface WithdrawObligationCollateralAndRedeemReserveCollateralArgs {
|
|
7
|
+
collateralAmount: BN
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface WithdrawObligationCollateralAndRedeemReserveCollateralAccounts {
|
|
11
|
+
owner: PublicKey
|
|
12
|
+
obligation: PublicKey
|
|
13
|
+
lendingMarket: PublicKey
|
|
14
|
+
lendingMarketAuthority: PublicKey
|
|
15
|
+
withdrawReserve: PublicKey
|
|
16
|
+
reserveLiquidityMint: PublicKey
|
|
17
|
+
reserveSourceCollateral: PublicKey
|
|
18
|
+
reserveCollateralMint: PublicKey
|
|
19
|
+
reserveLiquiditySupply: PublicKey
|
|
20
|
+
userDestinationLiquidity: PublicKey
|
|
21
|
+
placeholderUserDestinationCollateral: PublicKey
|
|
22
|
+
collateralTokenProgram: PublicKey
|
|
23
|
+
liquidityTokenProgram: PublicKey
|
|
24
|
+
instructionSysvarAccount: PublicKey
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const layout = borsh.struct([borsh.u64("collateralAmount")])
|
|
28
|
+
|
|
29
|
+
export function withdrawObligationCollateralAndRedeemReserveCollateral(
|
|
30
|
+
args: WithdrawObligationCollateralAndRedeemReserveCollateralArgs,
|
|
31
|
+
accounts: WithdrawObligationCollateralAndRedeemReserveCollateralAccounts,
|
|
32
|
+
programId: PublicKey = PROGRAM_ID,
|
|
33
|
+
) {
|
|
34
|
+
const keys: Array<AccountMeta> = [
|
|
35
|
+
{ pubkey: accounts.owner, isSigner: true, isWritable: true },
|
|
36
|
+
{ pubkey: accounts.obligation, isSigner: false, isWritable: true },
|
|
37
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
38
|
+
{
|
|
39
|
+
pubkey: accounts.lendingMarketAuthority,
|
|
40
|
+
isSigner: false,
|
|
41
|
+
isWritable: false,
|
|
42
|
+
},
|
|
43
|
+
{ pubkey: accounts.withdrawReserve, isSigner: false, isWritable: true },
|
|
44
|
+
{
|
|
45
|
+
pubkey: accounts.reserveLiquidityMint,
|
|
46
|
+
isSigner: false,
|
|
47
|
+
isWritable: true,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
pubkey: accounts.reserveSourceCollateral,
|
|
51
|
+
isSigner: false,
|
|
52
|
+
isWritable: true,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
pubkey: accounts.reserveCollateralMint,
|
|
56
|
+
isSigner: false,
|
|
57
|
+
isWritable: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
pubkey: accounts.reserveLiquiditySupply,
|
|
61
|
+
isSigner: false,
|
|
62
|
+
isWritable: true,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
pubkey: accounts.userDestinationLiquidity,
|
|
66
|
+
isSigner: false,
|
|
67
|
+
isWritable: true,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
pubkey: accounts.placeholderUserDestinationCollateral,
|
|
71
|
+
isSigner: false,
|
|
72
|
+
isWritable: false,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
pubkey: accounts.collateralTokenProgram,
|
|
76
|
+
isSigner: false,
|
|
77
|
+
isWritable: false,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
pubkey: accounts.liquidityTokenProgram,
|
|
81
|
+
isSigner: false,
|
|
82
|
+
isWritable: false,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
pubkey: accounts.instructionSysvarAccount,
|
|
86
|
+
isSigner: false,
|
|
87
|
+
isWritable: false,
|
|
88
|
+
},
|
|
89
|
+
]
|
|
90
|
+
const identifier = Buffer.from([75, 93, 93, 220, 34, 150, 218, 196])
|
|
91
|
+
const buffer = Buffer.alloc(1000)
|
|
92
|
+
const len = layout.encode(
|
|
93
|
+
{
|
|
94
|
+
collateralAmount: args.collateralAmount,
|
|
95
|
+
},
|
|
96
|
+
buffer,
|
|
97
|
+
)
|
|
98
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
99
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
100
|
+
return ix
|
|
101
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
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 { PROGRAM_ID } from "../programId"
|
|
5
|
+
|
|
6
|
+
export interface WithdrawObligationCollateralAndRedeemReserveCollateralV2Args {
|
|
7
|
+
collateralAmount: BN
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface WithdrawObligationCollateralAndRedeemReserveCollateralV2Accounts {
|
|
11
|
+
withdrawAccounts: {
|
|
12
|
+
owner: PublicKey
|
|
13
|
+
obligation: PublicKey
|
|
14
|
+
lendingMarket: PublicKey
|
|
15
|
+
lendingMarketAuthority: PublicKey
|
|
16
|
+
withdrawReserve: PublicKey
|
|
17
|
+
reserveLiquidityMint: PublicKey
|
|
18
|
+
reserveSourceCollateral: PublicKey
|
|
19
|
+
reserveCollateralMint: PublicKey
|
|
20
|
+
reserveLiquiditySupply: PublicKey
|
|
21
|
+
userDestinationLiquidity: PublicKey
|
|
22
|
+
placeholderUserDestinationCollateral?: PublicKey | null
|
|
23
|
+
collateralTokenProgram: PublicKey
|
|
24
|
+
liquidityTokenProgram: PublicKey
|
|
25
|
+
instructionSysvarAccount: PublicKey
|
|
26
|
+
}
|
|
27
|
+
farmsAccounts: {
|
|
28
|
+
obligationFarmUserState?: PublicKey | null
|
|
29
|
+
reserveFarmState?: PublicKey | null
|
|
30
|
+
}
|
|
31
|
+
farmsProgram: PublicKey
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const layout = borsh.struct([borsh.u64("collateralAmount")])
|
|
35
|
+
|
|
36
|
+
function optionalAccountMeta(
|
|
37
|
+
pubkey: PublicKey | null | undefined,
|
|
38
|
+
isWritable: boolean,
|
|
39
|
+
programId: PublicKey,
|
|
40
|
+
): AccountMeta {
|
|
41
|
+
return {
|
|
42
|
+
pubkey: pubkey ?? programId,
|
|
43
|
+
isSigner: false,
|
|
44
|
+
isWritable,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function withdrawObligationCollateralAndRedeemReserveCollateralV2(
|
|
49
|
+
args: WithdrawObligationCollateralAndRedeemReserveCollateralV2Args,
|
|
50
|
+
accounts: WithdrawObligationCollateralAndRedeemReserveCollateralV2Accounts,
|
|
51
|
+
programId: PublicKey = PROGRAM_ID,
|
|
52
|
+
) {
|
|
53
|
+
const keys: Array<AccountMeta> = [
|
|
54
|
+
{ pubkey: accounts.withdrawAccounts.owner, isSigner: true, isWritable: true },
|
|
55
|
+
{ pubkey: accounts.withdrawAccounts.obligation, isSigner: false, isWritable: true },
|
|
56
|
+
{ pubkey: accounts.withdrawAccounts.lendingMarket, isSigner: false, isWritable: false },
|
|
57
|
+
{
|
|
58
|
+
pubkey: accounts.withdrawAccounts.lendingMarketAuthority,
|
|
59
|
+
isSigner: false,
|
|
60
|
+
isWritable: false,
|
|
61
|
+
},
|
|
62
|
+
{ pubkey: accounts.withdrawAccounts.withdrawReserve, isSigner: false, isWritable: true },
|
|
63
|
+
{
|
|
64
|
+
pubkey: accounts.withdrawAccounts.reserveLiquidityMint,
|
|
65
|
+
isSigner: false,
|
|
66
|
+
isWritable: false,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
pubkey: accounts.withdrawAccounts.reserveSourceCollateral,
|
|
70
|
+
isSigner: false,
|
|
71
|
+
isWritable: true,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
pubkey: accounts.withdrawAccounts.reserveCollateralMint,
|
|
75
|
+
isSigner: false,
|
|
76
|
+
isWritable: true,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
pubkey: accounts.withdrawAccounts.reserveLiquiditySupply,
|
|
80
|
+
isSigner: false,
|
|
81
|
+
isWritable: true,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
pubkey: accounts.withdrawAccounts.userDestinationLiquidity,
|
|
85
|
+
isSigner: false,
|
|
86
|
+
isWritable: true,
|
|
87
|
+
},
|
|
88
|
+
optionalAccountMeta(
|
|
89
|
+
accounts.withdrawAccounts.placeholderUserDestinationCollateral,
|
|
90
|
+
false,
|
|
91
|
+
programId,
|
|
92
|
+
),
|
|
93
|
+
{
|
|
94
|
+
pubkey: accounts.withdrawAccounts.collateralTokenProgram,
|
|
95
|
+
isSigner: false,
|
|
96
|
+
isWritable: false,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
pubkey: accounts.withdrawAccounts.liquidityTokenProgram,
|
|
100
|
+
isSigner: false,
|
|
101
|
+
isWritable: false,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
pubkey: accounts.withdrawAccounts.instructionSysvarAccount,
|
|
105
|
+
isSigner: false,
|
|
106
|
+
isWritable: false,
|
|
107
|
+
},
|
|
108
|
+
optionalAccountMeta(accounts.farmsAccounts.obligationFarmUserState, true, programId),
|
|
109
|
+
optionalAccountMeta(accounts.farmsAccounts.reserveFarmState, true, programId),
|
|
110
|
+
{ pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
|
|
111
|
+
]
|
|
112
|
+
const identifier = Buffer.from([235, 52, 119, 152, 149, 197, 20, 7])
|
|
113
|
+
const buffer = Buffer.alloc(1000)
|
|
114
|
+
const len = layout.encode(
|
|
115
|
+
{
|
|
116
|
+
collateralAmount: args.collateralAmount,
|
|
117
|
+
},
|
|
118
|
+
buffer,
|
|
119
|
+
)
|
|
120
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
121
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
122
|
+
return ix
|
|
123
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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 { PROGRAM_ID } from "../programId"
|
|
5
|
+
|
|
6
|
+
export interface WithdrawProtocolFeeArgs {
|
|
7
|
+
amount: BN
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface WithdrawProtocolFeeAccounts {
|
|
11
|
+
lendingMarketOwner: PublicKey
|
|
12
|
+
lendingMarket: PublicKey
|
|
13
|
+
reserve: PublicKey
|
|
14
|
+
reserveLiquidityMint: PublicKey
|
|
15
|
+
lendingMarketAuthority: PublicKey
|
|
16
|
+
feeVault: PublicKey
|
|
17
|
+
lendingMarketOwnerAta: PublicKey
|
|
18
|
+
tokenProgram: PublicKey
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const layout = borsh.struct([borsh.u64("amount")])
|
|
22
|
+
|
|
23
|
+
export function withdrawProtocolFee(
|
|
24
|
+
args: WithdrawProtocolFeeArgs,
|
|
25
|
+
accounts: WithdrawProtocolFeeAccounts,
|
|
26
|
+
programId: PublicKey = PROGRAM_ID,
|
|
27
|
+
) {
|
|
28
|
+
const keys: Array<AccountMeta> = [
|
|
29
|
+
{ pubkey: accounts.lendingMarketOwner, isSigner: true, isWritable: false },
|
|
30
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
31
|
+
{ pubkey: accounts.reserve, isSigner: false, isWritable: false },
|
|
32
|
+
{
|
|
33
|
+
pubkey: accounts.reserveLiquidityMint,
|
|
34
|
+
isSigner: false,
|
|
35
|
+
isWritable: true,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
pubkey: accounts.lendingMarketAuthority,
|
|
39
|
+
isSigner: false,
|
|
40
|
+
isWritable: false,
|
|
41
|
+
},
|
|
42
|
+
{ pubkey: accounts.feeVault, isSigner: false, isWritable: true },
|
|
43
|
+
{
|
|
44
|
+
pubkey: accounts.lendingMarketOwnerAta,
|
|
45
|
+
isSigner: false,
|
|
46
|
+
isWritable: true,
|
|
47
|
+
},
|
|
48
|
+
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
|
|
49
|
+
]
|
|
50
|
+
const identifier = Buffer.from([158, 201, 158, 189, 33, 93, 162, 103])
|
|
51
|
+
const buffer = Buffer.alloc(1000)
|
|
52
|
+
const len = layout.encode(
|
|
53
|
+
{
|
|
54
|
+
amount: args.amount,
|
|
55
|
+
},
|
|
56
|
+
buffer,
|
|
57
|
+
)
|
|
58
|
+
const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
|
|
59
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
60
|
+
return ix
|
|
61
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import { PROGRAM_ID } from "../programId"
|
|
3
|
+
|
|
4
|
+
export interface WithdrawReferrerFeesAccounts {
|
|
5
|
+
referrer: PublicKey
|
|
6
|
+
referrerTokenState: PublicKey
|
|
7
|
+
reserve: PublicKey
|
|
8
|
+
reserveLiquidityMint: PublicKey
|
|
9
|
+
reserveSupplyLiquidity: PublicKey
|
|
10
|
+
referrerTokenAccount: PublicKey
|
|
11
|
+
lendingMarket: PublicKey
|
|
12
|
+
lendingMarketAuthority: PublicKey
|
|
13
|
+
tokenProgram: PublicKey
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function withdrawReferrerFees(accounts: WithdrawReferrerFeesAccounts, programId: PublicKey = PROGRAM_ID) {
|
|
17
|
+
const keys: Array<AccountMeta> = [
|
|
18
|
+
{ pubkey: accounts.referrer, isSigner: true, isWritable: true },
|
|
19
|
+
{ pubkey: accounts.referrerTokenState, isSigner: false, isWritable: true },
|
|
20
|
+
{ pubkey: accounts.reserve, isSigner: false, isWritable: true },
|
|
21
|
+
{
|
|
22
|
+
pubkey: accounts.reserveLiquidityMint,
|
|
23
|
+
isSigner: false,
|
|
24
|
+
isWritable: true,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
pubkey: accounts.reserveSupplyLiquidity,
|
|
28
|
+
isSigner: false,
|
|
29
|
+
isWritable: true,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
pubkey: accounts.referrerTokenAccount,
|
|
33
|
+
isSigner: false,
|
|
34
|
+
isWritable: true,
|
|
35
|
+
},
|
|
36
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
37
|
+
{
|
|
38
|
+
pubkey: accounts.lendingMarketAuthority,
|
|
39
|
+
isSigner: false,
|
|
40
|
+
isWritable: false,
|
|
41
|
+
},
|
|
42
|
+
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
|
|
43
|
+
]
|
|
44
|
+
const identifier = Buffer.from([171, 118, 121, 201, 233, 140, 23, 228])
|
|
45
|
+
const data = identifier
|
|
46
|
+
const ix = new TransactionInstruction({ keys, programId, data })
|
|
47
|
+
return ix
|
|
48
|
+
}
|