MCPcopy Create free account
hub / github.com/consensus-shipyard/ipc / extract

Function extract

fendermint/rpc/src/query.rs:203–215  ·  view source on GitHub ↗

Extract some value from the query result, unless there was an error.

(res: AbciQuery, f: F)

Source from the content-addressed store, hash-verified

201
202/// Extract some value from the query result, unless there was an error.
203fn extract<T, F>(res: AbciQuery, f: F) -> anyhow::Result<T>
204where
205 F: FnOnce(AbciQuery) -> anyhow::Result<T>,
206{
207 if res.code.is_err() {
208 Err(anyhow!(
209 "query returned non-zero exit code: {}",
210 res.code.value()
211 ))
212 } else {
213 f(res)
214 }
215}
216
217fn extract_actor_state(res: AbciQuery) -> anyhow::Result<Option<(ActorID, ActorState)>> {
218 extract_opt(res, |res| {

Callers 5

callMethod · 0.85
estimate_gasMethod · 0.85
state_paramsMethod · 0.85
builtin_actorsMethod · 0.85
extract_optFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected