Skip to content

Commit

Permalink
Add support for events and errors in forge selectors upload (foundr…
Browse files Browse the repository at this point in the history
…y-rs#6205)

* Add support for events and errors in selectors upload

* remove
  • Loading branch information
klkvr authored Nov 3, 2023
1 parent 65e7f98 commit 8d513dc
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions crates/common/src/selectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,18 +299,23 @@ impl SignEthClient {

let request = match data {
SelectorImportData::Abi(abis) => {
let names: Vec<String> = abis
let functions_and_errors: Vec<String> = abis
.iter()
.flat_map(|abi| {
abi.abi
.functions()
.map(|func| {
func.signature().split(':').next().unwrap_or("").to_string()
})
.map(|func| func.signature())
.chain(abi.abi.errors().map(|error| error.signature()))
.collect::<Vec<_>>()
})
.collect();
SelectorImportRequest { function: names, event: Default::default() }

let events = abis
.iter()
.flat_map(|abi| abi.abi.events().map(|event| event.signature()))
.collect::<Vec<_>>();

SelectorImportRequest { function: functions_and_errors, event: events }
}
SelectorImportData::Raw(raw) => {
SelectorImportRequest { function: raw.function, event: raw.event }
Expand Down

0 comments on commit 8d513dc

Please sign in to comment.