#[cfg(test)]
use snarkvm_circuit_types::environment::assert_scope;
mod to_address;
mod to_bits;
mod to_fields;
use crate::Identifier;
use snarkvm_circuit_network::Aleo;
use snarkvm_circuit_types::{environment::prelude::*, Address, Boolean, Field};
#[derive(Clone)]
pub struct ProgramID<A: Aleo> {
name: Identifier<A>,
network: Identifier<A>,
}
#[cfg(console)]
impl<A: Aleo> Inject for ProgramID<A> {
type Primitive = console::ProgramID<A::Network>;
fn new(_: Mode, id: Self::Primitive) -> Self {
Self {
name: Identifier::new(Mode::Constant, *id.name()),
network: Identifier::new(Mode::Constant, *id.network()),
}
}
}
impl<A: Aleo> ProgramID<A> {
#[inline]
pub const fn name(&self) -> &Identifier<A> {
&self.name
}
#[inline]
pub const fn network(&self) -> &Identifier<A> {
&self.network
}
}
#[cfg(console)]
impl<A: Aleo> Eject for ProgramID<A> {
type Primitive = console::ProgramID<A::Network>;
fn eject_mode(&self) -> Mode {
Mode::Constant
}
fn eject_value(&self) -> Self::Primitive {
console::ProgramID::from((self.name.eject_value(), self.network.eject_value()))
}
}