ibc_primitives/types/
signer.rs

1use derive_more::Display;
2
3use crate::prelude::*;
4
5/// Represents the address of the signer of the current transaction
6#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
7#[cfg_attr(
8    feature = "parity-scale-codec",
9    derive(
10        parity_scale_codec::Encode,
11        parity_scale_codec::Decode,
12        scale_info::TypeInfo
13    )
14)]
15#[cfg_attr(
16    feature = "borsh",
17    derive(borsh::BorshSerialize, borsh::BorshDeserialize)
18)]
19#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
20#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
21#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Display)]
22pub struct Signer(String);
23
24impl From<String> for Signer {
25    fn from(s: String) -> Self {
26        Self(s)
27    }
28}
29
30impl AsRef<str> for Signer {
31    fn as_ref(&self) -> &str {
32        self.0.as_str()
33    }
34}