@@ -10,48 +10,32 @@ import { LendingInstruction } from "./instruction";
10
10
const BufferLayout = require ( "buffer-layout" ) ;
11
11
12
12
export const setObligationCloseabilityStatus = (
13
+ obligation : PublicKey ,
13
14
lendingMarket : PublicKey ,
14
- lendingMarketOwner : PublicKey ,
15
+ reserve : PublicKey ,
16
+ riskAuthority : PublicKey ,
17
+ closeable : boolean ,
15
18
lendingProgramId : PublicKey ,
16
- marketName : string ,
17
- marketDescription : string ,
18
- marketImageUrl : string
19
19
) : TransactionInstruction => {
20
20
const dataLayout = BufferLayout . struct ( [
21
21
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" ) ,
27
23
] ) ;
28
24
29
- const [ lendingMarketMetadata , _ ] = findProgramAddressSync (
30
- [
31
- lendingMarket . toBytes ( ) ,
32
- Buffer . from ( anchor . utils . bytes . utf8 . encode ( "MetaData" ) ) ,
33
- ] ,
34
-
35
- lendingProgramId
36
- ) ;
37
-
38
25
const data = Buffer . alloc ( dataLayout . span ) ;
39
26
dataLayout . encode (
40
27
{
41
- instruction : LendingInstruction . UpdateMetadata ,
42
- marketName,
43
- marketDescription,
44
- marketImageUrl,
45
- padding : Buffer . alloc ( 200 ) ,
28
+ instruction : LendingInstruction . SetObligationCloseabilityStatus ,
29
+ closeable : closeable ? 1 : 0 ,
46
30
} ,
47
31
data
48
32
) ;
49
33
50
34
const keys = [
35
+ { pubkey : obligation , isSigner : false , isWritable : true } ,
51
36
{ 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 } ,
55
39
] ;
56
40
57
41
return new TransactionInstruction ( {
0 commit comments