pub fn generate_unique_signers(
        &self,
        bulk_signers: Vec<Option<Box<dyn Signer>>>,
        matches: &ArgMatches<'_>,
        wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
    ) -> Result<CliSignerInfo, Box<dyn error::Error>> {
        let mut unique_signers = vec![];

        // Determine if the default signer is needed
        if bulk_signers.iter().any(|signer| signer.is_none()) {
            let default_signer = self.signer_from_path(matches, wallet_manager)?;
            unique_signers.push(default_signer);
        }

        for signer in bulk_signers.into_iter().flatten() {
            if !unique_signers.iter().any(|s| s == &signer) {
                unique_signers.push(signer);
            }
        }
        Ok(CliSignerInfo {
            signers: unique_signers,
        })
    }
/// Generate a unique set of signers, possibly excluding this default signer.
///
/// This function allows a command line application to have a default
/// signer, perhaps representing a default wallet, but to override that
/// signer and instead sign with one or more other signers.
///
/// `bulk_signers` is a vector of signers, all of which are optional. If any
/// of those signers is `None`, then the default signer will be loaded; if
/// all of those signers are `Some`, then the default signer will not be
/// loaded.
///
/// The returned value includes all of the `bulk_signers` that were not
/// `None`, and maybe the default signer, if it was loaded.
///
/// # Examples
///
/// ```no_run
/// use clap::{App, Arg, value_t_or_exit};
/// use solana_clap_utils::keypair::{DefaultSigner, signer_from_path};
/// use solana_clap_utils::offline::OfflineArgs;
/// use solana_sdk::signer::Signer;
///
/// let clap_app = App::new("my-program")
///     // The argument we'll parse as a signer "path"
///     .arg(Arg::with_name("keypair")
///         .required(true)
///         .help("The default signer"))
///     .arg(Arg::with_name("payer")
///         .long("payer")
///         .help("The account paying for the transaction"))
///     .offline_args();
///
/// let mut wallet_manager = None;
///
/// let clap_matches = clap_app.get_matches();
/// let keypair_str = value_t_or_exit!(clap_matches, "keypair", String);
/// let maybe_payer = clap_matches.value_of("payer");
///
/// let default_signer = DefaultSigner::new("keypair", &keypair_str);
/// let maybe_payer_signer = maybe_payer.map(|payer| {
///     signer_from_path(&clap_matches, payer, "payer", &mut wallet_manager)
/// }).transpose()?;
/// let bulk_signers = vec![maybe_payer_signer];
///
/// let unique_signers = default_signer.generate_unique_signers(
///     bulk_signers,
///     &clap_matches,
///     &mut wallet_manager,
/// )?;
/// # Ok::<(), Box<dyn std::error::Error>>(())
/// ```
Generate a unique set of signers, possibly excluding this default signer.
This function allows a command line application to have a default
signer, perhaps representing a default wallet, but to override that
signer and instead sign with one or more other signers.

`bulk_signers` is a vector of signers, all of which are optional. If any
of those signers is `None`, then the default signer will be loaded; if
all of those signers are `Some`, then the default signer will not be
loaded.

The returned value includes all of the `bulk_signers` that were not
`None`, and maybe the default signer, if it was loaded.
Generate a unique set of signers possibly excluding this default signer . This function allows a command line application to have a default signer perhaps representing a default wallet but to override that signer and instead sign with one or more other signers . ` bulk_signers ` is a vector of signers all of which are optional . If any of those signers is ` None ` then the default signer will be loaded ; if all of those signers are ` Some ` then the default signer will not be loaded . The returned value includes all of the ` bulk_signers ` that were not ` None ` and maybe the default signer if it was loaded .
pub fn generate_unique_signers(
        &self,
        bulk_signers: Vec<Option<Box<dyn Signer>>>,
        matches: &ArgMatches<'_>,
        wallet_manager: &mut Option<Arc<RemoteWalletManager>>,
    ) -> Result<CliSignerInfo, Box<dyn error::Error>> {
        let mut unique_signers = vec![];
        // Determine if the default signer is needed
        if bulk_signers.iter().any(|signer| signer.is_none()) {
            let default_signer = self.signer_from_path(matches, wallet_manager)?;
            unique_signers.push(default_signer);
        }
        for signer in bulk_signers.into_iter().flatten() {
            if !unique_signers.iter().any(|s| s == &signer) {
                unique_signers.push(signer);
            }
        }
        Ok(CliSignerInfo {
            signers: unique_signers,
        })
    }
pub fn generate_unique_signers ( & self , bulk_signers : Vec < Option < Box < dyn Signer > > > , matches : & ArgMatches < ' _ > , wallet_manager : & mut Option < Arc < RemoteWalletManager > > , ) -> Result < CliSignerInfo , Box < dyn error :: Error > > { let mut unique_signers = vec ! [ ] ; // Determine if the default signer is needed if bulk_signers . iter ( ) . any ( | signer | signer . is_none ( ) ) { let default_signer = self . signer_from_path ( matches , wallet_manager ) ? ; unique_signers . push ( default_signer ) ; } for signer in bulk_signers . into_iter ( ) . flatten ( ) { if ! unique_signers . iter ( ) . any ( | s | s == & signer ) { unique_signers . push ( signer ) ; } } Ok ( CliSignerInfo { signers : unique_signers , } ) }
Generate a unique set of signers, possibly excluding this default signer.
Generate a unique set of signers possibly excluding this default signer .
&self
bulk_signers
Vec<Option<Box<dyn Signer>>>
matches
&ArgMatches<'_>
wallet_manager
&mut Option<Arc<RemoteWalletManager>>
examples


let clap_app = App::new("my-program")
The argument we'll parse as a signer "path"
.arg(Arg::with_name("keypair")
.required(true)
.help("The default signer"))
.arg(Arg::with_name("payer")
.long("payer")
.help("The account paying for the transaction"))
.offline_args().

let mut wallet_manager = None.



let default_signer = DefaultSigner::new("keypair", &keypair_str);
let maybe_payer_signer = maybe_payer.map(|payer| {
signer_from_path(&clap_matches, payer, "payer", &mut wallet_manager)
}).transpose()?;
let bulk_signers = vec![maybe_payer_signer].

let unique_signers = default_signer.generate_unique_signers(
bulk_signers,
&clap_matches,
&mut wallet_manager,
)?.
let clap_app = App :: new ( " my - program " ) The argument we ' ll parse as a signer " path " . arg ( Arg :: with_name ( " keypair " ) . required ( true ) . help ( " The default signer " )) . arg ( Arg :: with_name ( " payer " ) . long ( " payer " ) . help ( " The account paying for the transaction " )) . offline_args () . let mut wallet_manager = None . let default_signer = DefaultSigner :: new ( " keypair " &keypair_str ) ; let maybe_payer_signer = maybe_payer . map ( |payer| { signer_from_path ( &clap_matches payer " payer " &mut wallet_manager ) } ) . transpose () ? ; let bulk_signers = vec! [ maybe_payer_signer ] . let unique_signers = default_signer . generate_unique_signers ( bulk_signers &clap_matches &mut wallet_manager ) ? .
ok::<(), box<dyn std::error::error>>(())
None