0

I want to define a struct serializeable to json

#[derive(Serialize)]
struct Struct {
    item: SomeRuntimeType,
}

but I get this error:

error[E0277]: the trait bound `pallet_pallet::types::SomeRuntimeType: conf::_::_serde::Serialize` is not satisfied
    --> src/main.rs:150:10
     |
150  | #[derive(Serialize)]
     |          ^^^^^^^^^ the trait `conf::_::_serde::Serialize` is not implemented for `pallet_pallet::types::SomeRuntimeType`

Is there a way to derive some kind of serialization in subxt?

#[subxt::subxt(
    runtime_metadata_path = "res/metadata.scale",
    derive_for_all_types = "Debug" // <--- like adding Serialize here
)]
pub mod runtime {}

Or do I have to manually implement serialization?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.