mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-09-11 05:45:30 +03:00
Use network when invoking snarkos CLI
This commit is contained in:
parent
4ee4ba7746
commit
c721fa25b0
@ -97,6 +97,8 @@ impl Command for Deploy {
|
||||
self.compiler_options.endpoint.clone(),
|
||||
"--priority-fee".to_string(),
|
||||
self.fee_options.priority_fee.to_string(),
|
||||
"--network".to_string(),
|
||||
network.id().to_string(),
|
||||
"--path".to_string(),
|
||||
path.to_str().unwrap().parse().unwrap(),
|
||||
"--broadcast".to_string(),
|
||||
|
@ -105,6 +105,8 @@ fn handle_execute<N: Network>(command: Execute, context: Context) -> Result<<Exe
|
||||
command.compiler_options.endpoint.clone(),
|
||||
"--priority-fee".to_string(),
|
||||
command.fee_options.priority_fee.to_string(),
|
||||
"--network".to_string(),
|
||||
N::ID.to_string(),
|
||||
"--broadcast".to_string(),
|
||||
format!("{}/{}/transaction/broadcast", command.compiler_options.endpoint, command.compiler_options.network)
|
||||
.to_string(),
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
use leo_errors::{CliError, LeoError};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use snarkvm::prelude::{MainnetV0, Network, TestnetV0};
|
||||
use std::fmt;
|
||||
|
||||
// Retrievable networks for an external program
|
||||
@ -27,6 +28,15 @@ pub enum NetworkName {
|
||||
MainnetV0,
|
||||
}
|
||||
|
||||
impl NetworkName {
|
||||
pub fn id(&self) -> u16 {
|
||||
match self {
|
||||
NetworkName::TestnetV0 => TestnetV0::ID,
|
||||
NetworkName::MainnetV0 => MainnetV0::ID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<&str> for NetworkName {
|
||||
type Error = LeoError;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user