mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 11:51:12 +00:00
Bridges subtree update (#2736)
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::HeaderIdProvider;
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use codec::{Codec, Decode, Encode, MaxEncodedLen};
|
||||
use frame_support::{weights::Weight, Parameter};
|
||||
use num_traits::{AsPrimitive, Bounded, CheckedSub, Saturating, SaturatingAdd, Zero};
|
||||
use sp_runtime::{
|
||||
@@ -39,7 +39,7 @@ pub enum EncodedOrDecodedCall<ChainCall> {
|
||||
Decoded(ChainCall),
|
||||
}
|
||||
|
||||
impl<ChainCall: Clone + Decode> EncodedOrDecodedCall<ChainCall> {
|
||||
impl<ChainCall: Clone + Codec> EncodedOrDecodedCall<ChainCall> {
|
||||
/// Returns decoded call.
|
||||
pub fn to_decoded(&self) -> Result<ChainCall, codec::Error> {
|
||||
match self {
|
||||
@@ -57,6 +57,14 @@ impl<ChainCall: Clone + Decode> EncodedOrDecodedCall<ChainCall> {
|
||||
Self::Decoded(decoded_call) => Ok(decoded_call),
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts self to encoded call.
|
||||
pub fn into_encoded(self) -> Vec<u8> {
|
||||
match self {
|
||||
Self::Encoded(encoded_call) => encoded_call,
|
||||
Self::Decoded(decoded_call) => decoded_call.encode(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<ChainCall> From<ChainCall> for EncodedOrDecodedCall<ChainCall> {
|
||||
|
||||
Reference in New Issue
Block a user