Using pallet-assets, how do I create a pallet that has hardcoded (pallet-)asset id's for it's on-chain assets that the pallet handles?

I wasnt able to find a good documented way to do this

2 Answers 2


Because AssetId's are mostly a fancy way of saying u32, It's as simple as:

let first_asset_id: T::AssetId = 1u32.into();

Don't forget to Add From<u32> in :

type AssetId: IsType<<Self as pallet_assets::Config>::AssetId>
            + Parameter
            + From<u32>
            + Ord
            + Copy;

The implementation can be found here: https://github.com/liberland/liberland_substrate/blob/65edb6bab3/frame/llm/src/lib.rs

  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jun 6, 2022 at 10:40

for some reason, the answer above does not work for me. if I try:

let nbr:u32 = 10;
let val:AssetId = nbr.into();

I get:

the trait From<u32> is not implemented for <T as pallet_assets::Config>::AssetId

Any advice on how to solve it? Kazu.


Your Answer

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

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