Skip to content

Commit

Permalink
✏️ doc: change the color and style of the homepage image. (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
Liquidwe authored Dec 13, 2024
1 parent b964627 commit cb08fa9
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 36 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
![manuscript](./images/manuscript_logo_3.png)
![manuscript](./images/manuscript_logo.png)
<div>
<a href="https://chainbase.com/blockchains">
<img src="https://chainbase.com/public/blockchains/logos/chain_status_1.svg" alt="Packaging status" align="right">
</a>

![macOS](https://img.shields.io/badge/-OSX-da644e?logo=apple)
![Linux](https://img.shields.io/badge/-Linux-da644e?logo=linux)
![FreeBSD](https://img.shields.io/badge/-FreeBSD-da644e?logo=freebsd)
![NetBSD](https://img.shields.io/badge/-NetBSD-da644e?logo=netbsd)
![OpenBSD](https://img.shields.io/badge/-OpenBSD-da644e?logo=openbsd)

[![GitHub Version](https://img.shields.io/github/tag-pre/chainbase-labs/manuscript-core?label=Version&color=da644e)](https://github.com/chainbase-labs/manuscript-core/releases)
![PyPI License](https://img.shields.io/pypi/l/quixstreams?label=Licence&color=da644e)
[![Docs](https://img.shields.io/badge/docs-chainbase.com-0345b2?label=Docs&color=da644e)](https://docs.chainbase.com/core-concepts/manuscript/overview#core-values-and-capabilities-of-manuscript)
[![Discord](https://img.shields.io/badge/Chainbase-da644e?logo=Discord)](https://discord.com/channels/933995010158907422/935156893872185344)
[![Telegram](https://img.shields.io/badge/Chainbase-da644e?logo=Telegram)](https://t.me/ChainbaseNetwork)
![macOS](https://img.shields.io/badge/-OSX-4c4293?logo=apple)
![Linux](https://img.shields.io/badge/-Linux-4c4293?logo=linux)
![FreeBSD](https://img.shields.io/badge/-FreeBSD-4c4293?logo=freebsd)
![NetBSD](https://img.shields.io/badge/-NetBSD-4c4293?logo=netbsd)
![OpenBSD](https://img.shields.io/badge/-OpenBSD-4c4293?logo=openbsd)

[![GitHub Version](https://img.shields.io/github/tag-pre/chainbase-labs/manuscript-core?label=Version&color=4c4293)](https://github.com/chainbase-labs/manuscript-core/releases)
![PyPI License](https://img.shields.io/pypi/l/quixstreams?label=Licence&color=4c4293)
[![Docs](https://img.shields.io/badge/docs-chainbase.com-0345b2?label=Docs&color=4c4293)](https://docs.chainbase.com/core-concepts/manuscript/overview#core-values-and-capabilities-of-manuscript)
[![Discord](https://img.shields.io/badge/Chainbase-4c4293?logo=Discord)](https://discord.com/channels/933995010158907422/935156893872185344)
[![Telegram](https://img.shields.io/badge/Chainbase-4c4293?logo=Telegram)](https://t.me/ChainbaseNetwork)
<a href="https%3A%2F%2Fx.com%2FchainbaseHQ" target="_blank" style="display: flex; align-items: center;">
<img src="https://img.shields.io/badge/Twitter-da644e?logo=x&logoColor=white" alt="Twitter" />
<img src="https://img.shields.io/badge/Twitter-4c4293?logo=x&logoColor=white" alt="Twitter" />
</a>
# Build The World's Largest Omnichain Data Network
Chainbase is a global blockchain data network with an extensive dataset and cluster worldwide. If we compare Chainbase’s global data network to a country, then Manuscript would be the language of this data network nation. Manuscript plays a crucial role in the Chainbase ecosystem, serving as a bridge connecting various data, services, and users.
Expand Down
2 changes: 1 addition & 1 deletion gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ lazy_static = "1.4.0"
base64 = "0.22.1"
aes-gcm = "0.10.3"
sysinfo = "0.33.0"
rand = "0.8.5"
rand = "0.8.5"
1 change: 1 addition & 0 deletions gui/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![recursion_limit = "512"]
pub mod config;
pub mod app;
pub mod ui;
Expand Down
140 changes: 119 additions & 21 deletions gui/src/tasks/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ use tokio::time::Duration;
use super::docker::{DOCKER_COMPOSE_TEMPLATE, DOCKER_COMPOSE_TEMPLATE_SOLANA, JOB_CONFIG_TEMPLATE, MANUSCRIPT_TEMPLATE, MANUSCRIPT_TEMPLATE_SOLANA};
use crate::config::Settings;
use std::collections::HashSet;
use std::thread;

#[derive(Debug, Clone)]
pub struct JobManager;

Expand Down Expand Up @@ -106,7 +104,6 @@ impl JobManager {

match action {
"edit" => {
// Read the manuscript.yaml file
let yaml_content = std::fs::read_to_string(job_dir.join("manuscript.yaml"))?;
Ok(Some(yaml_content))
},
Expand All @@ -121,6 +118,10 @@ impl JobManager {
Ok(Some(format!("Error: {}", String::from_utf8_lossy(&output.stderr))))
}
},
"graphql" => {
self.handle_graphql_action(job_name, &home_dir).await?;
Ok(None)
},
"delete" => {
// First, stop containers
Command::new("docker")
Expand Down Expand Up @@ -162,26 +163,18 @@ impl JobManager {
.args(["compose", "down"])
.output()?;
Ok(None)
},
"graphql" => {
if let Some(port) = self.get_job_graphql_port(job_name)? {
let url = format!("http://127.0.0.1:{}", port);
webbrowser::open(&url)
.map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))?;
}
Ok(None)
}
_ => Ok(None)
}
}

fn get_job_graphql_port(&self, job_name: &str) -> io::Result<Option<u16>> {
let home_dir = dirs::home_dir()
.ok_or_else(|| io::Error::new(io::ErrorKind::NotFound, "Home directory not found"))?;

async fn handle_graphql_action(&self, job_name: &str, home_dir: &std::path::Path) -> io::Result<()> {
let content = std::fs::read_to_string(home_dir.join(".manuscript_config.ini"))?;

let mut current_section = "";
let mut port = None;
let mut table = None;
let mut chain = None;

for line in content.lines() {
let line = line.trim();

Expand All @@ -190,15 +183,120 @@ impl JobManager {
continue;
}

if current_section == job_name && line.starts_with("graphqlPort") {
if let Some(port_str) = line.split('=').nth(1) {
if let Ok(port) = port_str.trim().parse::<u16>() {
return Ok(Some(port));
if current_section == job_name {
if line.starts_with("graphqlPort") {
if let Some(val) = line.split('=').nth(1) {
port = val.trim().parse::<u16>().ok();
}
}
if line.starts_with("table") {
if let Some(val) = line.split('=').nth(1) {
table = Some(val.trim().to_string());
}
}
if line.starts_with("chain") {
if let Some(val) = line.split('=').nth(1) {
chain = Some(val.trim().to_string());
}
}
}
}
Ok(None)

if let (Some(port), Some(table), Some(chain)) = (port, table, chain) {
let url = format!("http://127.0.0.1:{}", port);

// TODO: The data here needs to be upgraded to automatically obtain from the protocol.
let payload = if chain == "solana" {
serde_json::json!({
"type": "bulk",
"source": "default",
"resource_version": 1,
"args": [{
"type": "postgres_track_tables",
"args": {
"allow_warnings": true,
"tables": [
{"table": {"name": "blocks", "schema": "public"}, "source": "default"},
{"table": {"name": "cursors", "schema": "public"}, "source": "default"},
{"table": {"name": "mpl_token_metadata_create_metadata_account_v3_events", "schema": "public"}, "source": "default"},
{"table": {"name": "mpl_token_metadata_other_events", "schema": "public"}, "source": "default"},
{"table": {"name": "pumpfun_create_events", "schema": "public"}, "source": "default"},
{"table": {"name": "pumpfun_initialize_events", "schema": "public"}, "source": "default"},
{"table": {"name": "pumpfun_set_params_events", "schema": "public"}, "source": "default"},
{"table": {"name": "pumpfun_swap_events", "schema": "public"}, "source": "default"},
{"table": {"name": "pumpfun_withdraw_events", "schema": "public"}, "source": "default"},
{"table": {"name": "raydium_amm_deposit_events", "schema": "public"}, "source": "default"},
{"table": {"name": "raydium_amm_initialize_events", "schema": "public"}, "source": "default"},
{"table": {"name": "raydium_amm_swap_events", "schema": "public"}, "source": "default"},
{"table": {"name": "raydium_amm_withdraw_events", "schema": "public"}, "source": "default"},
{"table": {"name": "raydium_amm_withdraw_pnl_events", "schema": "public"}, "source": "default"},
{"table": {"name": "spl_token_approve_events", "schema": "public"}, "source": "default"},
{"table": {"name": "spl_token_burn_events", "schema": "public"}, "source": "default"},
{"table": {"name": "spl_token_close_account_events", "schema": "public"}, "source": "default"},
{"table": {"name": "spl_token_freeze_account_events", "schema": "public"}, "source": "default"},
{"table": {"name": "spl_token_initialize_account_events", "schema": "public"}, "source": "default"},
{"table": {"name": "spl_token_initialize_immutable_owner_events", "schema": "public"}, "source": "default"},
{"table": {"name": "spl_token_initialize_mint_events", "schema": "public"}, "source": "default"},
{"table": {"name": "spl_token_initialize_multisig_events", "schema": "public"}, "source": "default"},
{"table": {"name": "spl_token_mint_to_events", "schema": "public"}, "source": "default"},
{"table": {"name": "spl_token_revoke_events", "schema": "public"}, "source": "default"},
{"table": {"name": "spl_token_set_authority_events", "schema": "public"}, "source": "default"},
{"table": {"name": "spl_token_sync_native_events", "schema": "public"}, "source": "default"},
{"table": {"name": "spl_token_thaw_account_events", "schema": "public"}, "source": "default"},
{"table": {"name": "spl_token_transfer_events", "schema": "public"}, "source": "default"},
{"table": {"name": "substreams_history", "schema": "public"}, "source": "default"},
{"table": {"name": "system_program_advance_nonce_account_events", "schema": "public"}, "source": "default"},
{"table": {"name": "system_program_allocate_events", "schema": "public"}, "source": "default"},
{"table": {"name": "system_program_allocate_with_seed_events", "schema": "public"}, "source": "default"},
{"table": {"name": "system_program_assign_events", "schema": "public"}, "source": "default"},
{"table": {"name": "system_program_assign_with_seed_events", "schema": "public"}, "source": "default"},
{"table": {"name": "system_program_authorize_nonce_account_events", "schema": "public"}, "source": "default"},
{"table": {"name": "system_program_create_account_events", "schema": "public"}, "source": "default"},
{"table": {"name": "system_program_create_account_with_seed_events", "schema": "public"}, "source": "default"},
{"table": {"name": "system_program_initialize_nonce_account_events", "schema": "public"}, "source": "default"},
{"table": {"name": "system_program_transfer_events", "schema": "public"}, "source": "default"},
{"table": {"name": "system_program_transfer_with_seed_events", "schema": "public"}, "source": "default"},
{"table": {"name": "system_program_upgrade_nonce_account_events", "schema": "public"}, "source": "default"},
{"table": {"name": "system_program_withdraw_nonce_account_events", "schema": "public"}, "source": "default"},
{"table": {"name": "transactions", "schema": "public"}, "source": "default"}
]
}
}]
})
} else {
serde_json::json!({
"type": "bulk",
"source": "default",
"resource_version": 1,
"args": [{
"type": "postgres_track_tables",
"args": {
"allow_warnings": true,
"tables": [{
"table": {
"name": table,
"schema": "public"
},
"source": "default"
}]
}
}]
})
};

let client = reqwest::Client::new();
let response = client.post(format!("{}/v1/metadata", url))
.json(&payload)
.send()
.await
.map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))?;

// Open browser after metadata request succeeds
webbrowser::open(&url)
.map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))?;
}

Ok(())
}

pub async fn create_config_file(&self, yaml_content: &str, tx: mpsc::Sender<JobsUpdate>) -> io::Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion gui/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ fn draw_jobs_list(frame: &mut ratatui::Frame, app: &mut App, area: Rect) {
JobState::Pending => "Pulling Image...",
JobState::PullingImage => "Pulling Image...",
JobState::Failed => "Failed",
JobState::NotStarted => "Not Started",
JobState::NotStarted => "Not Started (pull images while take few minutes..)",
JobState::Creating => "Creating (pull images while take few minutes..)",
}
),
Expand Down
Binary file modified images/manuscript_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/manuscript_logo_1.png
Binary file not shown.
Binary file removed images/manuscript_logo_2.png
Binary file not shown.
Binary file removed images/manuscript_logo_3.png
Binary file not shown.

0 comments on commit cb08fa9

Please sign in to comment.