How to convert account id string to AccountId primitives
let account = "5DJk1gegyQJk6BNs7LceZ1akt5e9fpm4gUYGzcfpKaLG9Mmb".to_owned();
let AccountId: T::AccountId = account;
How to convert account id string to AccountId primitives
let account = "5DJk1gegyQJk6BNs7LceZ1akt5e9fpm4gUYGzcfpKaLG9Mmb".to_owned();
let AccountId: T::AccountId = account;
You probably expose such things as hardcoded values in the code, but rather make them configurable. Also, the T::AccountId
is generic and we don't make any assumption about it being SS58-compatible in any way (Note that AccountId32
is Ss58Codec
, not T::AccountId
). In that case, what you want is to parse the SS58 string in the top level runtime and pass it into the pallet as a config, which means this is a duplicate of: How to hardcode an address in the substrate runtime?