Skip to content

Commit

Permalink
fix: reintegrating localnet.
Browse files Browse the repository at this point in the history
  • Loading branch information
l-monninger committed Jan 28, 2024
1 parent 2dd42b3 commit 7882ac9
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
53 changes: 53 additions & 0 deletions movement-sdk/clis/movement/src/ctl/start/m1/localnet.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
use services::m1::localnet;
use async_trait::async_trait;
use clap::Parser;
use util::{cli::Command, util::util::constructor::ConstructorOperations};
use crate::manage::{
InstallationArgs,
VersionArgs
};
use util::util::util::Version;
use util::service::ServiceOperations;
use util::movement_dir::MovementDir;

#[derive(Debug, Parser, Clone)]
pub struct Localnet {

#[clap(flatten)]
pub version_args : VersionArgs,

#[clap(flatten)]
pub installation_args : InstallationArgs

}

impl Into<localnet::Config> for Localnet {
fn into(self) -> localnet::Config {
localnet::Config
}
}


#[async_trait]
impl Command<String> for Localnet {

async fn get_name(&self) -> String {
"localnet".to_string()
}

async fn execute(self) -> Result<String, anyhow::Error> {

let movement_dir = MovementDir::default();

// todo: handle config and version
let config : localnet::Config = self.clone().into();
let version : Version = self.version_args.try_into()?;

let service = localnet::Constructor::default();

service.start(&movement_dir).await?;

Ok("SUCCESS".to_string())
}

}
3 changes: 3 additions & 0 deletions movement-sdk/clis/movement/src/ctl/start/m1/m1.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use clap::Subcommand;
use util::cli::Command;
use super::{
localnet::Localnet,
testnet::Testnet,
mevm::Mevm,
proxy::Proxy
Expand All @@ -12,6 +13,7 @@ use super::{
about = "Start an M1 service"
)]
pub enum M1 {
Localnet(Localnet),
Testnet(Testnet),
Mevm(Mevm),
Proxy(Proxy)
Expand All @@ -27,6 +29,7 @@ impl Command<String> for M1 {
async fn execute(self) -> Result<String, anyhow::Error> {

match self {
M1::Localnet(localnet) => localnet.execute().await?,
M1::Testnet(testnet) => testnet.execute().await?,
M1::Mevm(mevm) => mevm.execute().await?,
M1::Proxy(proxy) => proxy.execute().await?
Expand Down
1 change: 1 addition & 0 deletions movement-sdk/clis/movement/src/ctl/start/m1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ pub mod proxy;
pub mod mevm;
pub mod testnet;
pub mod indexer;
pub mod localnet;
pub mod m1;
pub use m1::*;

0 comments on commit 7882ac9

Please sign in to comment.