File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -156,10 +156,21 @@ impl TestSVM {
156156 seeds : & [ & [ u8 ] ] ,
157157 program_id : Pubkey ,
158158 ) -> Result < AccountRef < T > > {
159- let ( pubkey, _bump) = self
159+ let ( pda, _) = self . get_pda_with_bump ( label, seeds, program_id) ?;
160+ Ok ( pda)
161+ }
162+
163+ /// Finds a program derived address and return an [AccountRef] with proper type information and bump seed.
164+ pub fn get_pda_with_bump < T : anchor_lang:: AccountDeserialize > (
165+ & mut self ,
166+ label : & str ,
167+ seeds : & [ & [ u8 ] ] ,
168+ program_id : Pubkey ,
169+ ) -> Result < ( AccountRef < T > , u8 ) > {
170+ let ( pubkey, bump) = self
160171 . address_book
161172 . find_pda_with_bump ( label, seeds, program_id) ?;
162- Ok ( AccountRef :: new ( pubkey) )
173+ Ok ( ( AccountRef :: new ( pubkey) , bump ) )
163174 }
164175
165176 /// Advance the time by the specified number of seconds
You can’t perform that action at this time.
0 commit comments