4

I am using pallet_assets for creating custom assets and I want to call the transfer function from pallet_assets in my other custom pallet. The thing is I want to pass the AccountId of the recipient but the transfer function in pallet_assets does not take AccounId, rather it takes <T::Lookup as StaticLookup>::Source as parameter.

How can I pass AccountId to <T::Lookup as StaticLookup>::Source ??

This is the error that I'm getting:

mismatched types
expected associated type `<<T as frame_system::Config>::Lookup as StaticLookup>::Source`
   found associated type `<T as frame_system::Config>::AccountId`rustcE0308

1 Answer 1

4

If you have AccountId and you want to Get LookUp<Target = AccountId>, you will have to unlookup. Straightforward way to do is:

let user: AccountId = get_a_user();
let user_lookup = <T::Lookup as sp_runtime::traits::StaticLookup>::unlookup(user.clone());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.