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.
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.
Using the above operations you can create an ARTM as follows:
Copy
Ask AI
import { ARTM } from '@futureverse/artm'import { ethers } from 'ethers'// Lets get you a wallet to get you startedconst wallet = new ethers.Wallet(0xc367447789c3d98a0005c48b761ffe7d2802cea44dace8656033b15d90914c1d)const artm = new ARTM({ address: wallet.address, // Custom message to help the user understand the operation statement: "Equip your ASM Brain", operations: [ createAssetLinkOperation, deleteAssetLinkOperation ], nonce: 0})artm.setSignature(wallet.signMessage('\x19Ethereum Signed Message:\n' + artm.message)console.log(artm.verify()) // true// Submit the transaction!
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.