Skip to content

Commit

Permalink
Merge pull request #67 from originalworks/ow-data-provider-cli-print-…
Browse files Browse the repository at this point in the history
…output

Add printing processed files in ow_data_provider-cli
  • Loading branch information
cezary-stroczynski authored Oct 21, 2024
2 parents d959b50 + 4eaf9c6 commit 916dccc
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const config: HardhatUserConfig = {
],
},
kurtosis_testnet: {
url: "http://127.0.0.1:32827",
url: "http://127.0.0.1:32780",
accounts: [
"0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31",
],
Expand Down
3 changes: 2 additions & 1 deletion ow_data_provider_cli/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloy::primitives::{address, Address};

pub const DDEX_SEQUENCER_ADDRESS: Address = address!("B965D10739e19a9158e7f713720B0145D996E370");
pub const DDEX_SEQUENCER_ADDRESS: Address = address!("00c042C4D5D913277CE16611a2ce6e9003554aD5");

#[cfg(any(not(test), rust_analyzer))]
pub const IPFS_API_BASE_URL: &str = "http://localhost:5001";
Expand All @@ -11,4 +11,5 @@ pub const IMAGE_FILE_CID_TAG: &str = "ImageIpfsCid";

#[cfg(all(test, not(rust_analyzer)))]
pub const IPFS_API_BASE_URL: &str = "http://ipfs:5001";
#[cfg(all(test, not(rust_analyzer)))]
pub const IPFS_API_CAT_FILE: &str = "/api/v0/cat";
22 changes: 22 additions & 0 deletions ow_data_provider_cli/src/ipfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,31 @@ pub async fn create_output_files(
folder_path.to_string(),
)));
}

print_output(&result)?;
Ok(result)
}

fn print_output(output: &Vec<AssetDirProcessingContext>) -> Result<(), Box<dyn Error>> {
for entry in output {
println!("PROCESSED DDEX MESSAGE:");
println!(
"Source files: image: {}; XML: {}",
entry.input_image_path, entry.input_xml_path
);
println!(
"Image file {} was pined to IPFS under CID: {}",
entry.input_image_path, entry.image_cid
);
println!(
"CID: {} was included in the output file: {}",
entry.image_cid, entry.output_xml_path
);
println!("----------")
}
Ok(())
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
2 changes: 1 addition & 1 deletion ow_validator_node/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloy::primitives::{address, Address, FixedBytes};

pub const DDEX_SEQUENCER_ADDRESS: Address = address!("B965D10739e19a9158e7f713720B0145D996E370");
pub const DDEX_SEQUENCER_ADDRESS: Address = address!("00c042C4D5D913277CE16611a2ce6e9003554aD5");
pub const GET_BEACON_BLOCK_API_PATH: &str = "/eth/v2/beacon/blocks/";
pub const GET_SIDECARS_API_PATH: &str = "/eth/v1/beacon/blob_sidecars/";
pub const EMPTY_QUEUE_HEAD: FixedBytes<32> = FixedBytes::repeat_byte(0);
Expand Down
2 changes: 1 addition & 1 deletion ow_validator_node/src/ddex_sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ impl DdexSequencerContext<'_> {
&self,
config: &Config,
) -> Result<QueueHeadData, Box<dyn Error>> {
println!("Subscribed to queue, waiting for new blobs...");
let ws_url = WsConnect::new(&config.ws_url);
let ws_provider = ProviderBuilder::new().on_ws(ws_url).await?;

let filter = Filter::new()
.address(constants::DDEX_SEQUENCER_ADDRESS)
.event(DdexSequencer::NewBlobSubmitted::SIGNATURE);

println!("Subscribed to queue, waiting for new blobs...");
let subscription = ws_provider.subscribe_logs(&filter).await?;
let mut stream = subscription.into_stream();

Expand Down

0 comments on commit 916dccc

Please sign in to comment.