Asset Link Operations
Asset links can only be executed through a transaction. This guide will specifically focus on creating these operations using the SDKs.
Prerequisite readings
Asset Register Transaction goes into detail about how to create and submit transactions, whereas, this guide will focus on the asset link operations in particular to help you build an asset tree.
In the following sections, we will focus on using the ARTM library to create and manipulate an ARTM and its operations.
Create Asset Links 🔑
The user must own both assets to create links unless it is an off-chain asset, where only the creator of the child asset can create a link. Linking between assets owned on a FuturePass account and FuturePass account owner EOA is allowed. As long as the ownership resolution is satisfied links can be created across chains as well.
The first argument corresponds to the
path
or thesubject
of the link.The second argument is the parent asset. An asset can have 0 to many links as a parent.
The third argument is the child asset. An asset can have 0 or 1 link as a child.
Delete Asset Links 🔑
The user must own the parent asset to delete links.
You may have noticed that all the arguments look the same. This is because we have to be explicit with exactly which link we are deleting.
Sign and Send!
Using the above operations you can create an ARTM as follows:
In the above transaction, we are creating and then deleting the link in the same transaction. This is completely fine to do so but there is no reason to perform it other than for demonstration purposes!
Note that any invalid operation will result in the failure of the entire transaction.