Skip to content

Commit 5762dfa

Browse files
committed
fix set obligation closeable
1 parent b6387fd commit 5762dfa

File tree

2 files changed

+11
-27
lines changed

2 files changed

+11
-27
lines changed

solend-sdk/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@solendprotocol/solend-sdk",
3-
"version": "0.8.10-beta",
3+
"version": "0.8.11-beta",
44
"private": true,
55
"main": "src/index.ts",
66
"module": "src/index.ts",

solend-sdk/src/instructions/setObligationCloseabilityStatus.ts

+10-26
Original file line numberDiff line numberDiff line change
@@ -10,48 +10,32 @@ import { LendingInstruction } from "./instruction";
1010
const BufferLayout = require("buffer-layout");
1111

1212
export const setObligationCloseabilityStatus = (
13+
obligation: PublicKey,
1314
lendingMarket: PublicKey,
14-
lendingMarketOwner: PublicKey,
15+
reserve: PublicKey,
16+
riskAuthority: PublicKey,
17+
closeable: boolean,
1518
lendingProgramId: PublicKey,
16-
marketName: string,
17-
marketDescription: string,
18-
marketImageUrl: string
1919
): TransactionInstruction => {
2020
const dataLayout = BufferLayout.struct([
2121
BufferLayout.u8("instruction"),
22-
BufferLayout.blob(50, "marketName"),
23-
BufferLayout.blob(250, "marketDescription"),
24-
BufferLayout.blob(250, "marketImageUrl"),
25-
BufferLayout.blob(200, "padding"),
26-
BufferLayout.u8("bumpSeed"),
22+
BufferLayout.u8("closeable"),
2723
]);
2824

29-
const [lendingMarketMetadata, _] = findProgramAddressSync(
30-
[
31-
lendingMarket.toBytes(),
32-
Buffer.from(anchor.utils.bytes.utf8.encode("MetaData")),
33-
],
34-
35-
lendingProgramId
36-
);
37-
3825
const data = Buffer.alloc(dataLayout.span);
3926
dataLayout.encode(
4027
{
41-
instruction: LendingInstruction.UpdateMetadata,
42-
marketName,
43-
marketDescription,
44-
marketImageUrl,
45-
padding: Buffer.alloc(200),
28+
instruction: LendingInstruction.SetObligationCloseabilityStatus,
29+
closeable: closeable ? 1 : 0,
4630
},
4731
data
4832
);
4933

5034
const keys = [
35+
{ pubkey: obligation, isSigner: false, isWritable: true },
5136
{ pubkey: lendingMarket, isSigner: false, isWritable: false },
52-
{ pubkey: lendingMarketOwner, isSigner: true, isWritable: false },
53-
{ pubkey: lendingMarketMetadata, isSigner: false, isWritable: true },
54-
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
37+
{ pubkey: reserve, isSigner: false, isWritable: false },
38+
{ pubkey: riskAuthority, isSigner: true, isWritable: true },
5539
];
5640

5741
return new TransactionInstruction({

0 commit comments

Comments
 (0)