Core
Other
Utils
Multi Asset Render Utils

RMRKMultiAssetRenderUtils

RMRK team

RMRKMultiAssetRenderUtils

Methods

getAssetIdWithTopPriority

function getAssetIdWithTopPriority(address target, uint256 tokenId) external view returns (uint64 maxPriorityAssetId, uint64 maxPriority)

Used to retrieve the ID of the specified token's asset with the highest priority.

Parameters

NameTypeDescription
targetaddressAddress of the smart contract of the given token
tokenIduint256ID of the token for which to retrieve the ID of the asset with the highest priority

Returns

NameTypeDescription
maxPriorityAssetIduint64The ID of the asset with the highest priority
maxPriorityuint64The priority value of the asset with the highest priority

getAssetsById

function getAssetsById(address target, uint256 tokenId, uint64[] assetIds) external view returns (string[] assets)

Used to retrieve the metadata URI of specified assets in the specified token.

Requirements: - assetIds must exist.

Parameters

NameTypeDescription
targetaddressAddress of the smart contract of the given token
tokenIduint256ID of the token to retrieve the specified assets for
assetIdsuint64[][] An array of asset IDs for which to retrieve the metadata URIs

Returns

NameTypeDescription
assetsstring[]An array of metadata URIs belonging to specified assets

getExtendedActiveAssets

function getExtendedActiveAssets(address target, uint256 tokenId) external view returns (struct RMRKMultiAssetRenderUtils.ExtendedActiveAsset[] activeAssets)

Used to get the active assets of the given token.

The full ExtendedActiveAsset looks like this: [ id, priority, metadata ]

Parameters

NameTypeDescription
targetaddressAddress of the smart contract of the given token
tokenIduint256ID of the token to retrieve the active assets for

Returns

NameTypeDescription
activeAssetsRMRKMultiAssetRenderUtils.ExtendedActiveAsset[]An array of ActiveAssets present on the given token

getPendingAssets

function getPendingAssets(address target, uint256 tokenId) external view returns (struct RMRKMultiAssetRenderUtils.PendingAsset[] pendingAssets)

Used to get the pending assets of the given token.

The full PendingAsset looks like this: [ id, acceptRejectIndex, replacesAssetWithId, metadata ]

Parameters

NameTypeDescription
targetaddressAddress of the smart contract of the given token
tokenIduint256ID of the token to retrieve the pending assets for

Returns

NameTypeDescription
pendingAssetsRMRKMultiAssetRenderUtils.PendingAsset[]An array of PendingAssets present on the given token

getTopAsset

function getTopAsset(address target, uint256 tokenId) external view returns (uint64 topAssetId, uint64 topAssetPriority, string topAssetMetadata)

Used to retrieve ID, priority value and metadata URI of the asset with the highest priority that is present on a specified token.

Parameters

NameTypeDescription
targetaddressCollection smart contract of the token for which to retireve the top asset
tokenIduint256ID of the token for which to retrieve the top asset

Returns

NameTypeDescription
topAssetIduint64ID of the asset with the highest priority
topAssetPriorityuint64Priotity value of the asset with the highest priority
topAssetMetadatastringMetadata URI of the asset with the highest priority

getTopAssetMetaForToken

function getTopAssetMetaForToken(address target, uint256 tokenId) external view returns (string metadata)

Used to retrieve the metadata URI of the specified token's asset with the highest priority.

Parameters

NameTypeDescription
targetaddressAddress of the smart contract of the given token
tokenIduint256ID of the token for which to retrieve the metadata URI of the asset with the highest priority

Returns

NameTypeDescription
metadatastringThe metadata URI of the asset with the highest priority

getTopAssetMetadataForTokens

function getTopAssetMetadataForTokens(address target, uint256[] tokenIds) external view returns (string[] metadata)

Used to retrieve the metadata URI of the specified token's asset with the highest priority for each of the given tokens.

Parameters

NameTypeDescription
targetaddressAddress of the smart contract of the tokens
tokenIdsuint256[]IDs of the tokens for which to retrieve the metadata URIs

Returns

NameTypeDescription
metadatastring[]An array of strings with the top asset metadata for each of the given tokens, in the same order as the tokens passed in the tokenIds input array

Errors

RMRKTokenHasNoAssets

error RMRKTokenHasNoAssets()

Attempting to determine the asset with the top priority on a token without assets