I'm using pallet-assets to implement my own pallet. In one of the extrinsic calls I would like to check if an asset with the given ID exists. How to achieve this, given that Assets type is private and there's no getter provided?


2 Answers 2


I think you can use maybe_total_supply. This will return Some(supply) if the asset exists, and None otherwise https://github.com/paritytech/substrate/blob/0ba251c9388452c879bfcca425ada66f1f9bc802/frame/assets/src/functions.rs#L62

  • That's a good one. For some reason maybe_total_supply is not mentioned in the docs. Jun 27, 2022 at 14:48

After you create the asset with for example pallet_assets::Pallet::<T>::force_create query pallet_assets::<T>::Balance with the asset id

let assetid: AssetId<T> = 1337u32.into();
let asset_balance: u128 = pallet_assets::Pallet::<T>::balance(assetid.into(), myaccount)
  • This assumes I have an account myaccount with non-zero balance of the asset, which is not quite my case. Jun 27, 2022 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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