Skip to content

Commit

Permalink
CLI (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
juchiast authored Oct 22, 2024
1 parent e5bc36d commit 6e469d1
Show file tree
Hide file tree
Showing 16 changed files with 5,466 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ target
.vscode
_data
guest_local_storage
crates/flow-server/local_storage/*
local_storage
config.toml
.env
40 changes: 20 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
members = ["lib/*", "crates/*"]
exclude = ["crates/space-wasm/tests"]
exclude = ["crates/space-wasm/tests", "lib/space-operator-cli"]
resolver = "2"

[patch.crates-io]
Expand Down Expand Up @@ -44,3 +44,4 @@ serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["preserve_order"] }
anyhow = "1"
bs58 = "0.4"
postgrest = { package = "spo-postgrest", version = "1.6.0" }
File renamed without changes.
2 changes: 1 addition & 1 deletion crates/cmds-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ rust_decimal = { version = "1.32.0", features = ["serde-with-float"] }
tracing = "0.1.40"
bytes = "1.5.0"
mime_guess = "2.0.4"
postgrest = { git = "https://github.com/space-operator/postgrest-rs", branch = "dev" }
postgrest = { workspace = true }
tokio = "1.33.0"
once_cell = "1.17"
url = { version = "2.5.0", features = ["serde"] }
Expand Down
3 changes: 1 addition & 2 deletions crates/command-rpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ pub enum Error {
pub type WsStream =
tokio_tungstenite::WebSocketStream<tokio_tungstenite::MaybeTlsStream<tokio::net::TcpStream>>;

#[allow(dead_code)]
pub struct CommandHost {
natives: BTreeMap<Cow<'static, str>, CommandDescription>,
stream: WsStream,
}

async fn send() {}

impl CommandHost {
pub async fn connect(url: &str) -> Result<Self, Error> {
let (stream, _) = tokio_tungstenite::connect_async(url).await?;
Expand Down
5 changes: 1 addition & 4 deletions crates/pdg-common/src/nft_metadata/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,7 @@ impl RenderParams {

#[cfg(test)]
mod tests {
use std::{
collections::{HashMap, HashSet},
vec,
};
use std::collections::{HashMap, HashSet};

use serde_json::json;
use strum::IntoEnumIterator;
Expand Down
2 changes: 0 additions & 2 deletions lib/client/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ use std::collections::HashMap;

#[derive(Serialize, Deserialize, Debug)]
#[serde(untagged)]

pub enum RestResult<T> {
Error(ErrorBody),
Success(T),
}

#[derive(Debug)]

pub struct True;

impl Serialize for True {
Expand Down
2 changes: 1 addition & 1 deletion lib/flow-lib/src/command/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl CmdBuilder {
optional: x.optional,
})
.collect(),
instruction_info: None,
instruction_info: self.def.data.instruction_info,
permissions: self.def.permissions,
};

Expand Down
5 changes: 4 additions & 1 deletion lib/flow-lib/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ pub mod prelude {
},
config::{client::NodeData, node::Permissions},
context::Context,
solana::Instructions,
CmdInputDescription as Input, CmdOutputDescription as Output, FlowId, Name, ValueSet,
ValueType,
};
pub use async_trait::async_trait;
pub use bytes::Bytes;
pub use serde::{Deserialize, Serialize};
pub use serde_json::Value as JsonValue;
pub use solana_sdk::{pubkey::Pubkey, signature::Signature, signer::keypair::Keypair};
pub use thiserror::Error as ThisError;
pub use value::{self, Value};
pub use value::{self, Decimal, Value};
}

/// Error type of commmands.
Expand Down
2 changes: 2 additions & 0 deletions lib/flow-lib/src/config/node.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Note: only add fields that are needed in backend.
use crate::command::InstructionInfo;
use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize, Debug, Clone)]
Expand All @@ -20,6 +21,7 @@ pub struct Permissions {
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Data {
pub node_id: String,
pub instruction_info: Option<InstructionInfo>,
}

#[derive(Deserialize, Serialize, Debug, Clone)]
Expand Down
Loading

0 comments on commit 6e469d1

Please sign in to comment.