Skip to content

Commit

Permalink
feat: improvement to build process
Browse files Browse the repository at this point in the history
  • Loading branch information
drewstone committed Oct 26, 2024
1 parent a6fe588 commit 8517daf
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 628 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ exclude = ["contracts"]
alloy-contract = { version = "0.1" }
alloy-sol-types = { version = "0.7.2", features = ["json"] }
serde = { version = "1.0.208" }

[build-dependencies]
serde_json = { version = "1.0" }


[features]
default = ["std"]
std = []
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,24 @@ To add new contracts to the Rust bindings, follow these steps:
import "path/to/NewContract.sol";
```

2. Add the JSON file for the new contract to the list in `build.rs`:
2. Add the JSON file for the new contract to the list in the `test_forge_build_and_json_extraction` test in `src/lib.rs`:
```rust
let json_files = vec![
// ... existing files ...
"contracts/out/NewContract.sol/NewContract.json",
"NewContract.sol/NewContract.json",
];
```

3. Expose the new contract in `src/lib.rs`:
3. Run the test to generate the JSON files:
```
cargo test test_forge_build_and_json_extraction
```

4. Add the new contract to the `generate_sol_types!` macro in `src/lib.rs`:
```rust
sol!(
#[allow(missing_docs)]
#[sol(rpc)]
#[derive(Debug, Serialize, Deserialize)]
NewContract,
"json/NewContract.json"
generate_sol_types!(
// ... existing contracts ...
NewContract, "json/NewContract.json",
);
```

Expand Down
116 changes: 0 additions & 116 deletions build.rs

This file was deleted.

Loading

0 comments on commit 8517daf

Please sign in to comment.