@@ -24,13 +24,11 @@ const LOAD_LAMPORTS = LAMPORTS_PER_SOL; // 1 SOL
2424
2525const instructionDiscriminators = {
2626 InitializeRentVault : Buffer . from ( [ 0 ] ) ,
27- DepositRent : Buffer . from ( [ 1 ] ) ,
28- CreateNewAccount : Buffer . from ( [ 2 ] ) ,
27+ CreateNewAccount : Buffer . from ( [ 1 ] ) ,
2928}
3029
3130describe ( "Pay the rent for an account using a PDA" , ( ) => {
3231 let context : ProgramTestContext ;
33- let lastBlock : Blockhash ;
3432 let client : BanksClient ;
3533 let payer : Keypair ;
3634
@@ -46,34 +44,32 @@ describe("Pay the rent for an account using a PDA", () => {
4644 ) ;
4745 client = context . banksClient ;
4846 payer = context . payer ;
49- lastBlock = context . lastBlockhash ;
5047
5148 } ) ;
5249
5350 it ( "should initialize rent vault PDA" , async ( ) => {
54- const data = Buffer . concat ( [ instructionDiscriminators . InitializeRentVault ] ) ;
51+ const amount = Buffer . alloc ( 8 ) ;
52+ amount . writeBigInt64BE ( BigInt ( LOAD_LAMPORTS ) , 0 ) ;
53+ const data = Buffer . concat ( [ instructionDiscriminators . InitializeRentVault , amount ] ) ;
54+
5555 const ix = new TransactionInstruction ( {
5656 keys : [
5757 { pubkey : payer . publicKey , isSigner : true , isWritable : false } ,
58- { pubkey : vault_pda , isSigner : true , isWritable : true } ,
58+ { pubkey : vault_pda , isSigner : false , isWritable : true } ,
5959 { pubkey : SystemProgram . programId , isSigner : false , isWritable : false } ,
6060 ] ,
6161 programId : PROGRAM_ID ,
6262 data,
6363 } ) ;
6464
6565 const tx = new Transaction ( ) ;
66- tx . recentBlockhash = lastBlock ;
66+ tx . recentBlockhash = context . lastBlockhash ;
6767 tx . add ( ix ) . sign ( payer ) ;
6868
6969 // Process Transaction with all the instructions
7070 await client . processTransaction ( tx ) ;
7171 } ) ;
7272
73- it ( "should deposit rent into the vault" , async ( ) => {
74-
75- } ) ;
76-
7773 it ( "should create new account using rent vault" , async ( ) => {
7874 const new_account = Keypair . generate ( ) ;
7975
@@ -83,7 +79,6 @@ describe("Pay the rent for an account using a PDA", () => {
8379 keys : [
8480 { pubkey : vault_pda , isSigner : false , isWritable : true } ,
8581 { pubkey : new_account . publicKey , isSigner : true , isWritable : true } ,
86- { pubkey : SystemProgram . programId , isSigner : false , isWritable : false } ,
8782 ] ,
8883 programId : PROGRAM_ID ,
8984 data,
0 commit comments