如何将 AccountId 转换为 Vec<u8>,反之亦然

问题描述

我有一个接受 T::AccountId 类型的函数

    Citizen get(fn candidate_name): map hasher(blake2_128_concat) T::AccountId => Option<Vec<u8>>;

例如

    fn add_count(origin,account:T::AccountId,phrase: Vec<u8>) {
       // I need to concatenate : account + _ + phrase,then convert it to Vec<u8> or bytes
       // Then change the Citizen storage using account
    }

另一种方式是:

    fn add_count(origin,account:Vec<u8>,phrase: Vec<u8>) {
       // Concatenate : account + _ + phrase,then convert it to Vec<u8> or bytes
       // Then change account to T::AccountId and then change the Citizen storage
    }

但我无法将 T::AccountId 类型转换为 bytes/vec,反之亦然。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)