Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 14 additions & 4 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ fn determine_start_block<S: Storage>(storage: &S, default: u64) -> Result<u64> {

// --- Entry Point ---
pub async fn run() -> Result<()> {
crate::tracing::init(None);
log::info!("🚀 Starting brc721");

let dotenv_path = crate::cli::load_dotenv();
let cli = crate::cli::parse();
crate::tracing::init(cli.log_file.as_deref().map(Path::new));
log::info!("Loaded env from {}", dotenv_path);
log::info!("🚀 Starting brc721");
let ctx = context::Context::from_cli(&cli)?;

if let Some(path) = ctx.log_file.as_deref() {
log::info!("📝 Log file: {}", path.to_string_lossy());
crate::tracing::init(ctx.log_file.as_deref().map(Path::new));
}

log::info!("🔗 Bitcoin Core RPC URL: {}", ctx.rpc_url);
Expand Down Expand Up @@ -255,6 +255,16 @@ mod tests {
) -> Result<Vec<OwnershipUtxo>> {
Ok(vec![])
}

fn has_ownership_overlap(
&self,
_collection_id: &CollectionKey,
_base_h160: H160,
_slot_start: u128,
_slot_end: u128,
) -> Result<bool> {
Ok(false)
}
}

impl StorageWrite for DummyStorage {
Expand Down
6 changes: 4 additions & 2 deletions src/cli/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ pub struct Cli {
pub cmd: Option<Command>,
}

pub fn parse() -> Cli {
pub fn load_dotenv() -> String {
let dotenv_path = env::var("DOTENV_PATH").unwrap_or(".env".into());
dotenvy::from_filename(&dotenv_path).ok();
dotenv_path
}

log::info!("Loaded env from {}", dotenv_path);
pub fn parse() -> Cli {
Cli::parse()
}

Expand Down
2 changes: 1 addition & 1 deletion src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ pub use command::Command;
pub use tx_cmd::TxCmd;
pub use wallet_cmd::WalletCmd;

pub use args::parse;
pub use args::{load_dotenv, parse};
14 changes: 14 additions & 0 deletions src/cli/tx_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ pub enum TxCmd {
required = true
)]
collection_id: CollectionKey,
#[arg(
long = "init-owner",
value_name = "ADDRESS|ADDRESS_H160",
required = false,
help = "Init owner (addressH160 or revealed wallet address). Input0 must spend a UTXO from this address."
)]
init_owner: Option<String>,
#[arg(
long = "target-owner",
value_name = "ADDRESS|ADDRESS_H160",
required = false,
help = "Ownership output address (Bitcoin address or addressH160). Defaults to init-owner or a new wallet address."
)]
target_owner: Option<String>,
#[arg(
long = "slots",
value_name = "RANGES",
Expand Down
Loading