pub trait ExplorerFindable: SpecifiedBox {
fn process_explorer_response(
explorer_response_body: &str
) -> Result<Vec<Self>>
where
Self: Sized;
fn process_explorer_response_custom(
explorer_response_body: &str,
box_spec: BoxSpec
) -> Result<Vec<Self>>
where
Self: Sized;
}
Expand description
A trait which is implemented via deriving the procedural macro SpecBox
.
This trait wraps the below methods from BoxSpec
but instead returns
the Self
struct that implements SpecifiedBox
improving the dev
experience.
A separate trait + using a proc macro was required due to a few
intricacies of Rust’s trait/type system
Required methods
Using the response JSON (as a String) from the Ergo Explorer API
endpoint generated by the explorer_endpoint()
method,
filter all returned ErgoBox
es against the default BoxSpec
of the SpecifiedBox
using the verify_box()
method and creating
new instances of your SpecifiedBox
struct.
Using the response JSON (as a String) from the Ergo Explorer API
endpoint generated by the explorer_endpoint()
method,
filter all returned ErgoBox
es against a custom BoxSpec
using the verify_box()
method and creating new instances
of your SpecifiedBox
struct.