diff --git a/crates/rs/src/lib.rs b/crates/rs/src/lib.rs index 6e3ce63..ea71785 100644 --- a/crates/rs/src/lib.rs +++ b/crates/rs/src/lib.rs @@ -32,7 +32,11 @@ impl ContractBindings { /// /// * `file` - The path to the file to write the bindings to. pub fn write_to_file(&self, file: &str) -> io::Result<()> { - fs::write(file, self.to_string()) + let content = format!( + "// ****\n// Auto-generated by cainome do not edit.\n// ****\n\n{}", + self + ); + fs::write(file, content) } } @@ -109,6 +113,16 @@ impl Abigen { self } + /// Sets the derives to be added to the generated types. + /// + /// # Arguments + /// + /// * `derives` - Derives to be added to the generated types. + pub fn with_derives(mut self, derives: Vec) -> Self { + self.derives = derives; + self + } + /// Generates the contract bindings. pub fn generate(&self) -> Result { let file_content = std::fs::read_to_string(&self.abi_source)?;