stylus_tools/
checker.rs

1// Copyright 2025, Offchain Labs, Inc.
2// For licensing, see https://github.com/OffchainLabs/stylus-sdk-rs/blob/main/licenses/COPYRIGHT.md
3
4use crate::call;
5use eyre::Result;
6use typed_builder::TypedBuilder;
7
8/// Defines the configuration for checking a Stylus contract.
9/// After setting the parameters, call `Checker::check` to perform the check.
10#[derive(TypedBuilder)]
11#[builder(field_defaults(setter(into)))]
12pub struct Checker {
13    rpc: String,
14
15    #[builder(default)]
16    dir: Option<String>,
17}
18
19impl Checker {
20    // Checks the Stylus contract.
21    pub fn check(self) -> Result<()> {
22        let check_args: Vec<String> = vec!["-e".to_owned(), self.rpc, "--verbose".to_owned()];
23
24        call(&self.dir, "check", check_args)?;
25
26        Ok(())
27    }
28}