6464//!
6565//! [`RpcClient::new_mock`]: https://docs.rs/solana-rpc-client/3.0.0/solana_rpc_client/rpc_client/struct.RpcClient.html#method.new_mock
6666
67- use anchor_lang:: pinocchio_runtime:: instruction:: { AccountMeta , InstructionView } ;
6867use anchor_lang:: pinocchio_runtime:: program_error:: ProgramError ;
6968use anchor_lang:: pinocchio_runtime:: pubkey:: Pubkey ;
70- use anchor_lang:: prelude:: instruction:: InstructionView ;
7169use anchor_lang:: { AccountDeserialize , Discriminator , InstructionData , ToAccountMetas } ;
7270use futures:: { Future , StreamExt } ;
7371use regex:: Regex ;
7472use solana_account_decoder:: { UiAccount , UiAccountEncoding } ;
7573use solana_commitment_config:: CommitmentConfig ;
74+ use solana_instruction:: { AccountMeta as SolanaAccountMeta , Instruction } ;
7675use solana_program:: hash:: Hash ;
7776use solana_pubsub_client:: nonblocking:: pubsub_client:: { PubsubClient , PubsubClientError } ;
7877use solana_rpc_client:: nonblocking:: rpc_client:: RpcClient as AsyncRpcClient ;
@@ -499,12 +498,12 @@ impl AsSigner for Box<dyn Signer + '_> {
499498
500499/// `RequestBuilder` provides a builder interface to create and send
501500/// transactions to a cluster.
502- pub struct RequestBuilder < ' a , ' b , ' c , ' d , C , S : ' a > {
501+ pub struct RequestBuilder < ' a , C , S : ' a > {
503502 cluster : String ,
504503 program_id : Pubkey ,
505- accounts : Vec < AccountMeta < ' a > > ,
504+ accounts : Vec < SolanaAccountMeta > ,
506505 options : CommitmentConfig ,
507- instructions : Vec < InstructionView < ' a , ' b , ' c , ' d > > ,
506+ instructions : Vec < Instruction > ,
508507 payer : C ,
509508 instruction_data : Option < Vec < u8 > > ,
510509 signers : Vec < S > ,
@@ -515,7 +514,7 @@ pub struct RequestBuilder<'a, 'b, 'c, 'd, C, S: 'a> {
515514}
516515
517516// Shared implementation for all RequestBuilders
518- impl < C : Deref < Target = impl Signer > + Clone , S : AsSigner > RequestBuilder < ' _ , ' _ , ' _ , ' _ , C , S > {
517+ impl < ' a , C : Deref < Target = impl Signer > + Clone , S : AsSigner > RequestBuilder < ' a , C , S > {
519518 #[ must_use]
520519 pub fn payer ( mut self , payer : C ) -> Self {
521520 self . payer = payer;
@@ -529,7 +528,7 @@ impl<C: Deref<Target = impl Signer> + Clone, S: AsSigner> RequestBuilder<'_, '_,
529528 }
530529
531530 #[ must_use]
532- pub fn instruction ( mut self , ix : InstructionView < ' _ , ' _ , ' _ , ' _ > ) -> Self {
531+ pub fn instruction ( mut self , ix : Instruction ) -> Self {
533532 self . instructions . push ( ix) ;
534533 self
535534 }
@@ -571,9 +570,18 @@ impl<C: Deref<Target = impl Signer> + Clone, S: AsSigner> RequestBuilder<'_, '_,
571570 /// .send()?;
572571 /// ```
573572 #[ must_use]
574- pub fn accounts ( mut self , accounts : impl ToAccountMetas ) -> Self {
575- let mut metas = accounts. to_account_metas ( None ) ;
576- self . accounts . append ( & mut metas) ;
573+ pub fn accounts ( mut self , accounts : impl ToAccountMetas + ' a ) -> Self {
574+ self . accounts
575+ . extend (
576+ accounts
577+ . to_account_metas ( None )
578+ . into_iter ( )
579+ . map ( |meta| SolanaAccountMeta {
580+ pubkey : * meta. address ,
581+ is_signer : meta. is_signer ,
582+ is_writable : meta. is_writable ,
583+ } ) ,
584+ ) ;
577585 self
578586 }
579587
@@ -589,10 +597,10 @@ impl<C: Deref<Target = impl Signer> + Clone, S: AsSigner> RequestBuilder<'_, '_,
589597 self
590598 }
591599
592- pub fn instructions ( & self ) -> Vec < InstructionView > {
600+ pub fn instructions ( & self ) -> Vec < Instruction > {
593601 let mut instructions = self . instructions . clone ( ) ;
594602 if let Some ( ix_data) = & self . instruction_data {
595- instructions. push ( InstructionView {
603+ instructions. push ( Instruction {
596604 program_id : self . program_id ,
597605 data : ix_data. clone ( ) ,
598606 accounts : self . accounts . clone ( ) ,
0 commit comments