git.delta.rocks / unique-network / refs/commits / d561386d7f33

difftreelog

doc: more info about asset-instance to token id conv

Daniel Shiposha2023-11-28parent: #cf0465d.patch.diff
in: master

1 file changed

modifiedpallets/foreign-assets/src/lib.rsdiffbeforeafterboth
278 /// `None` will be returned.278 /// `None` will be returned.
279 ///279 ///
280 /// Note: this function can return `Some` containing the token ID of a non-existing NFT.280 /// Note: this function can return `Some` containing the token ID of a non-existing NFT.
281 /// It returns `None` when it failed to convert the `asset_instance` to a local ID.
281 fn local_asset_instance_to_token_id(asset_instance: &AssetInstance) -> Option<TokenId> {282 fn local_asset_instance_to_token_id(asset_instance: &AssetInstance) -> Option<TokenId> {
282 match asset_instance {283 match asset_instance {
283 AssetInstance::Index(token_id) => Some(TokenId((*token_id).try_into().ok()?)),284 AssetInstance::Index(token_id) => Some(TokenId((*token_id).try_into().ok()?)),
286 }287 }
287288
288 /// Obtains the token ID of the `asset_instance` in the collection.289 /// Obtains the token ID of the `asset_instance` in the collection.
290 ///
291 /// Note: this function can return `Some` containing the token ID of a non-existing NFT.
292 /// It returns `None` when it failed to convert the `asset_instance` to a local ID.
289 fn asset_instance_to_token_id(293 fn asset_instance_to_token_id(
290 collection_locality: CollectionLocality,294 collection_locality: CollectionLocality,
291 asset_instance: &AssetInstance,295 asset_instance: &AssetInstance,