gear_subxt/utils/
multi_signature.rs1use codec::{Decode, Encode};
10
11#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug)]
14pub enum MultiSignature {
15 Ed25519([u8; 64]),
17 Sr25519([u8; 64]),
19 Ecdsa([u8; 65]),
21}
22
23#[cfg(feature = "substrate-compat")]
25mod substrate_impls {
26 use super::*;
27
28 impl From<sp_runtime::MultiSignature> for MultiSignature {
29 fn from(value: sp_runtime::MultiSignature) -> Self {
30 match value {
31 sp_runtime::MultiSignature::Ed25519(s) => Self::Ed25519(s.0),
32 sp_runtime::MultiSignature::Sr25519(s) => Self::Sr25519(s.0),
33 sp_runtime::MultiSignature::Ecdsa(s) => Self::Ecdsa(s.0),
34 }
35 }
36 }
37
38 impl From<sp_core::ed25519::Signature> for MultiSignature {
39 fn from(value: sp_core::ed25519::Signature) -> Self {
40 let sig: sp_runtime::MultiSignature = value.into();
41 sig.into()
42 }
43 }
44
45 impl From<sp_core::sr25519::Signature> for MultiSignature {
46 fn from(value: sp_core::sr25519::Signature) -> Self {
47 let sig: sp_runtime::MultiSignature = value.into();
48 sig.into()
49 }
50 }
51
52 impl From<sp_core::ecdsa::Signature> for MultiSignature {
53 fn from(value: sp_core::ecdsa::Signature) -> Self {
54 let sig: sp_runtime::MultiSignature = value.into();
55 sig.into()
56 }
57 }
58}