mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 09:51:10 +00:00
Remove unwrap and format code (#62)
* Remove unwrap from metadata fetch * Format code
This commit is contained in:
+7
-3
@@ -145,10 +145,14 @@ impl<T: System> Rpc<T> {
|
||||
pub fn metadata(&self) -> impl Future<Item = Metadata, Error = Error> {
|
||||
self.state
|
||||
.metadata(None)
|
||||
.map(|bytes| Decode::decode(&mut &bytes[..]).unwrap())
|
||||
.map_err(Into::into)
|
||||
.and_then(|meta: RuntimeMetadataPrefixed| {
|
||||
future::result(meta.try_into().map_err(|err| format!("{:?}", err).into()))
|
||||
.and_then(|bytes| {
|
||||
let result = Decode::decode(&mut &bytes[..])
|
||||
.map_err(Into::into)
|
||||
.and_then(|meta: RuntimeMetadataPrefixed| {
|
||||
meta.try_into().map_err(|err| format!("{:?}", err).into())
|
||||
});
|
||||
future::result(result)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user