use super::*;
impl<N: Network, P: ProgramStorage<N>> VM<N, P> {
#[inline]
pub fn authorize<R: Rng + CryptoRng>(
&self,
private_key: &PrivateKey<N>,
program_id: &ProgramID<N>,
function_name: Identifier<N>,
inputs: &[Value<N>],
rng: &mut R,
) -> Result<Authorization<N>> {
macro_rules! logic {
($process:expr, $network:path, $aleo:path) => {{
let inputs = inputs.to_vec();
let private_key = cast_ref!(&private_key as PrivateKey<$network>);
let program_id = cast_ref!(&program_id as ProgramID<$network>);
let function_name = cast_ref!(function_name as Identifier<$network>);
let inputs = cast_ref!(inputs as Vec<Value<$network>>);
let authorization =
$process.authorize::<$aleo, _>(private_key, program_id, function_name.clone(), inputs, rng)?;
Ok(cast_ref!(authorization as Authorization<N>).clone())
}};
}
process!(self, logic)
}
}