mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Add traits necessary for serai_abi::Transaction to be usable in-runtime
This commit is contained in:
@@ -20,6 +20,7 @@ zeroize = { version = "^1.5", features = ["derive"] }
|
||||
borsh = { version = "1", default-features = false, features = ["derive", "de_strict_order"] }
|
||||
|
||||
bitvec = { version = "1", default-features = false, features = ["alloc"] }
|
||||
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
||||
sp-core = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "serai-next", default-features = false }
|
||||
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["alloc", "ristretto"] }
|
||||
|
||||
@@ -23,6 +23,8 @@ const HUMAN_READABLE_PART: bech32::Hrp = bech32::Hrp::parse_unchecked("sri");
|
||||
|
||||
/// The address for an account on Serai.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Zeroize, BorshSerialize, BorshDeserialize)]
|
||||
#[rustfmt::skip]
|
||||
#[derive(scale::Encode, scale::Decode)] // This is safe as scale and borsh share an encoding here
|
||||
pub struct SeraiAddress(pub [u8; 32]);
|
||||
|
||||
impl SeraiAddress {
|
||||
|
||||
@@ -2,8 +2,6 @@ use borsh::{io::*, BorshSerialize, BorshDeserialize};
|
||||
|
||||
use sp_core::{ConstU32, bounded::BoundedVec};
|
||||
|
||||
// TODO: Don't serialize this as a Vec<u8>. Shorten the length-prefix, technically encoding as an
|
||||
// enum.
|
||||
pub fn borsh_serialize_bitvec<W: Write>(
|
||||
bitvec: &bitvec::vec::BitVec<u8, bitvec::order::Lsb0>,
|
||||
writer: &mut W,
|
||||
@@ -21,6 +19,8 @@ pub fn borsh_deserialize_bitvec<R: Read>(
|
||||
|
||||
type SerializeBoundedVecAs<T> = alloc::vec::Vec<T>;
|
||||
|
||||
// TODO: Don't serialize this as a Vec<u8>. Shorten the length-prefix, technically encoding as an
|
||||
// enum.
|
||||
pub fn borsh_serialize_bounded_vec<W: Write, T: BorshSerialize, const B: u32>(
|
||||
bounded: &BoundedVec<T, ConstU32<B>>,
|
||||
writer: &mut W,
|
||||
|
||||
Reference in New Issue
Block a user