Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Katana Logging to Mirror Starknet Devnet Features #1206

Merged
merged 6 commits into from
Nov 30, 2023
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions crates/katana/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ use std::{fs, io};
use clap::{CommandFactory, Parser};
use clap_complete::{generate, Shell};
use console::Style;
use katana_core::constants::{
ERC20_CONTRACT_CLASS_HASH, FEE_TOKEN_ADDRESS, UDC_ADDRESS, UDC_CLASS_HASH,
};
use katana_core::sequencer::KatanaSequencer;
use katana_rpc::{spawn, NodeHandle};
use tokio::signal::ctrl_c;
Expand Down Expand Up @@ -36,7 +39,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let NodeHandle { addr, handle, .. } = spawn(Arc::clone(&sequencer), server_config).await?;

if !config.silent {
let accounts = sequencer.backend.accounts.iter();
let mut accounts = sequencer.backend.accounts.iter().peekable();
let account_class_hash = accounts.peek().unwrap().class_hash;

if config.json_log {
info!(
Expand All @@ -56,6 +60,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
"🚀 JSON-RPC server started: {}",
Style::new().red().apply_to(format!("http://{addr}"))
),
format!("{}", account_class_hash),
);
}
}
Expand All @@ -74,7 +79,7 @@ fn print_completion(shell: Shell) {
generate(shell, &mut command, name, &mut io::stdout());
}

fn print_intro(accounts: String, seed: String, address: String) {
fn print_intro(accounts: String, seed: String, address: String, account_class_hash: String) {
println!(
"{}",
Style::new().red().apply_to(
Expand All @@ -87,11 +92,33 @@ fn print_intro(accounts: String, seed: String, address: String) {
██╔═██╗ ██╔══██║ ██║ ██╔══██║██║╚██╗██║██╔══██║
██║ ██╗██║ ██║ ██║ ██║ ██║██║ ╚████║██║ ██║
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝

"
)
);

println!(
r"
PREDEPLOYED CONTRACTS
==================

| Contract | Fee Token
| Address | {}
| Class Hash | {}

| Contract | Universal Deployer UDC
tarrencev marked this conversation as resolved.
Show resolved Hide resolved
| Address | {}
| Class Hash | {}

| Contract | Account Contract
| Class Hash | {}
",
*FEE_TOKEN_ADDRESS,
*ERC20_CONTRACT_CLASS_HASH,
*UDC_ADDRESS,
*UDC_CLASS_HASH,
account_class_hash
);

println!(
r"
PREFUNDED ACCOUNTS
Expand Down
Loading