Skip to content

Commit c0dbf6e

Browse files
committed
Implement supertraits
1 parent 9c3a55e commit c0dbf6e

File tree

1 file changed

+6
-12
lines changed
  • chains/nomad-substrate/src

1 file changed

+6
-12
lines changed

chains/nomad-substrate/src/aws.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use subxt::{
1313
crypto::{CryptoTypePublicPair, Derive, UncheckedFrom},
1414
ecdsa, ByteArray, DeriveJunction, Pair as TraitPair, Public as TraitPublic,
1515
},
16-
sp_runtime::{CryptoType, MultiSignature, MultiSigner},
16+
sp_runtime::{CryptoType, MultiSignature},
1717
},
1818
};
1919
use tokio::time::sleep;
@@ -165,20 +165,20 @@ impl ByteArray for Public {
165165
}
166166

167167
impl std::fmt::Display for Public {
168-
fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
169-
todo!()
168+
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
169+
write!(f, "{}", hex::encode(self.as_ref()))
170170
}
171171
}
172172

173173
impl AsRef<[u8]> for Public {
174174
fn as_ref(&self) -> &[u8] {
175-
todo!()
175+
&self.0[..]
176176
}
177177
}
178178

179179
impl AsMut<[u8]> for Public {
180180
fn as_mut(&mut self) -> &mut [u8] {
181-
todo!()
181+
&mut self.0[..]
182182
}
183183
}
184184

@@ -206,13 +206,7 @@ impl TryFrom<&[u8]> for Public {
206206

207207
impl TraitPublic for Public {
208208
fn to_public_crypto_pair(&self) -> CryptoTypePublicPair {
209-
todo!()
210-
}
211-
}
212-
213-
impl From<Public> for MultiSigner {
214-
fn from(_x: Public) -> Self {
215-
todo!()
209+
CryptoTypePublicPair(ecdsa::CRYPTO_ID, self.as_ref().to_vec())
216210
}
217211
}
218212

0 commit comments

Comments
 (0)