1mod account_id;
8mod account_id20;
9pub mod bits;
10mod era;
11mod multi_address;
12mod multi_signature;
13mod static_type;
14mod unchecked_extrinsic;
15mod wrapper_opaque;
16
17use alloc::borrow::ToOwned;
18use alloc::format;
19use alloc::string::String;
20use alloc::vec::Vec;
21use codec::{Compact, Decode, Encode};
22use derive_where::derive_where;
23
24pub use account_id::AccountId32;
25pub use account_id20::AccountId20;
26pub use era::Era;
27pub use multi_address::MultiAddress;
28pub use multi_signature::MultiSignature;
29pub use primitive_types::{H160, H256, H512};
30pub use static_type::Static;
31pub use unchecked_extrinsic::UncheckedExtrinsic;
32pub use wrapper_opaque::WrapperKeepOpaque;
33
34#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
37pub struct Encoded(pub Vec<u8>);
38
39impl codec::Encode for Encoded {
40 fn encode(&self) -> Vec<u8> {
41 self.0.to_owned()
42 }
43}
44
45pub fn strip_compact_prefix(bytes: &[u8]) -> Result<(u64, &[u8]), codec::Error> {
48 let cursor = &mut &*bytes;
49 let val = <Compact<u64>>::decode(cursor)?;
50 Ok((val.0, *cursor))
51}
52
53#[derive(Encode, Decode, scale_info::TypeInfo)]
57#[derive_where(Clone, PartialEq, Debug, Eq, Default, Hash)]
58#[scale_info(skip_type_params(T))]
59#[doc(hidden)]
60pub struct PhantomDataSendSync<T>(core::marker::PhantomData<T>);
61
62impl<T> PhantomDataSendSync<T> {
63 pub fn new() -> Self {
64 Self(core::marker::PhantomData)
65 }
66}
67
68unsafe impl<T> Send for PhantomDataSendSync<T> {}
69unsafe impl<T> Sync for PhantomDataSendSync<T> {}
70
71pub type KeyedVec<K, V> = Vec<(K, V)>;
75
76pub struct Yes;
78
79pub fn to_hex(bytes: impl AsRef<[u8]>) -> String {
81 format!("0x{}", hex::encode(bytes.as_ref()))
82}