In my runtime I'm using
pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;. Within my pallet I also need this type to implement
From<SomeType>. I attempted to add
type CustomAccountId: From<SomeType>; to my pallet's config, but encountered numerous errors. I'm not even sure if I'm on the right track. What is the proper way to achieve this?
Edit: To be more specific, I have the following type definition in my pallet, which is also used in a StorageMap
type AccountId: IsType<<Self as frame_system::Config>::AccountId> + From<H160>; // some code... #[pallet::storage] pub(super) type AssetOwner<T: Config> = StorageMap<_, Blake2_128Concat, U256, <T as pallet::Config>::AccountId, OptionQuery>;
Some errors I got:
error[E0599]: the function or associated item `get` exists for struct `StorageMap<_GeneratedPrefixForStorageAssetOwner<T>, Blake2_128Concat, U256, <T as Config>::AccountId>`, but its trait bounds were not satisfied ... error[E0277]: the trait bound `<T as pallet::Config>::AccountId: std::clone::Clone` is not satisfied ... the trait bound `<T as pallet::Config>::AccountId: WrapperTypeEncode` is not satisfied ... error[E0369]: binary operation `==` cannot be applied to type `&<T as pallet::Config>::AccountId` ...
These errors make me suspect that I'm not extending the AccountId type from the runtime config correctly. What is the proper way to achieve this functionality?