mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 05:47:58 +00:00
Tidy up some metadata accessing (#978)
* Reduce some repetition when obtaining metadata pallets/runtime_traits * make them pub * fix docs and clippy
This commit is contained in:
@@ -88,10 +88,8 @@ impl<ArgsData: EncodeAsFields, ReturnTy: DecodeWithMetadata> RuntimeApiPayload
|
||||
}
|
||||
|
||||
fn encode_args_to(&self, metadata: &Metadata, out: &mut Vec<u8>) -> Result<(), Error> {
|
||||
let api_trait = metadata
|
||||
.runtime_api_trait_by_name(&self.trait_name)
|
||||
.ok_or_else(|| MetadataError::RuntimeTraitNotFound((*self.trait_name).to_owned()))?;
|
||||
let api_method = api_trait
|
||||
let api_method = metadata
|
||||
.runtime_api_trait_by_name_err(&self.trait_name)?
|
||||
.method_by_name(&self.method_name)
|
||||
.ok_or_else(|| MetadataError::RuntimeMethodNotFound((*self.method_name).to_owned()))?;
|
||||
|
||||
|
||||
@@ -70,11 +70,7 @@ where
|
||||
async move {
|
||||
let metadata = client.metadata();
|
||||
|
||||
let api_trait = metadata
|
||||
.runtime_api_trait_by_name(payload.trait_name())
|
||||
.ok_or_else(|| {
|
||||
MetadataError::RuntimeTraitNotFound(payload.trait_name().to_owned())
|
||||
})?;
|
||||
let api_trait = metadata.runtime_api_trait_by_name_err(payload.trait_name())?;
|
||||
let api_method = api_trait
|
||||
.method_by_name(payload.method_name())
|
||||
.ok_or_else(|| {
|
||||
|
||||
Reference in New Issue
Block a user