1

我有一个接受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<u8> ,反之亦然。

4

0 回答 0