Assets

In the context of Horizon Network, an Asset is a digital item that has been registered on a blockchain and is represented by a unique token. These assets can take many forms, including digital art, virtual real estate, in-game items, and even real-world assets that have been tokenized.

Each asset is associated with a set of metadata that provides additional information about the asset, such as its name, description, image, and attributes. This metadata is stored on the blockchain and can be accessed by anyone who holds the token representing the asset.

Horizon Network provides a marketplace where users can buy, sell, and trade these assets with each other. Because each asset is represented by a unique token, ownership of the asset can be easily transferred from one party to another on the blockchain.

Create Asset

By using the createAsset function, you can easily create a new asset on the Horizon Network, the network will automatically mint a new NFT (non-fungible token) that corresponds to the Asset. This NFT represents a unique, one-of-a-kind digital asset that can be bought, sold, and traded on various marketplaces

const asset = {
  "collectionId" : "e304962a-b76a-11ed-afa1-0242ac120002",
  "owner" : "0x0dD768A47eA2395bbE5574E3252505fe1202C4A8",
  "animationUrl" : "https://static.heroarena.app/videos/Elite-Beast-7-Mage-Coo.mp4",
  "metadata" : {"name":"Coo","image":"https://static.heroarena.app/videos/Elite-Beast-7-Mage-Coo.png","animation_url":"https://static.heroarena.app/videos/Elite-Beast-7-Mage-Coo.mp4","attributes":[{"trait_type":"hero","value":117333023},{"trait_type":"race","value":"Beast"},{"trait_type":"name","value":"Coo"},{"trait_type":"hp","value":2801},{"trait_type":"atk","value":194},{"trait_type":"def","value":204},{"trait_type":"speed","value":371},{"trait_type":"crit","value":10}]},
  "chainId" : 56,
  "imageUrl" : "https://static.heroarena.app/videos/Rare-Elf-1-Warrior-Mirnana.png",
  "name" : "Mirnana",
  "description" : "",
  "tokenAddress" : "0x88Ef499ab1688DE727c21f1b72fAaEe1A3F455AD",
  "externalLink" : "https://heroarena.app/"
}

const result = await client.createAsset(asset);

You can use the getAsset and getAssets functions to manage the assets. These functions allow you to retrieve information about the assets, such as their metadata, ownership, and other relevant details. With this information, you can easily track the status of your assets, monitor their performance, and make informed decisions about buying, selling, or transferring them.

Get an Asset

const tokenAddress = "0x88Ef499ab1688DE727c21f1b72fAaEe1A3F455AD"; // {String} Address of the ERC721 contract
const tokenId = "1"; // {String} ERC721 token ID

const result = await client.getAsset(tokenAddress, tokenId);

Get list Assets

const opts = {
  'assetContract': "0x88Ef499ab1688DE727c21f1b72fAaEe1A3F455AD", // {String} Asset Contract
  'collectionId': "e304962a-b76a-11ed-afa1-0242ac120002", // {String} Collection ID
  'ownerId': "", // {String} Owner ID
  'status': "", // {String} Status of these asset
  'limit': 10, // {Integer} Limit
  'page': 1, // {String} Current page number
  'orderBy': "created_at", // {String} Property to sort by
  'direction': "desc" // {String} Direction to sort
};

const result = await client.getAssets(opts);

List Asset on Marketplace

You can you function createListingAsset to list your assets for sale on the Horizon Marketplace. This function will create a listing that other users can browse and purchase

const sellOrder = {
  "listingTime" : "Wed Mar 01 2023 20:48:16 GMT+0700 (Indochina Time)",
  "signature" : "signature",
  "expirationTime" : "{}",
  "startPrice" : 0.001,
  "acceptPrice" : 1,
  "orderType" : "BID_OFFER"
}

const result = await client.createListingAsset(sellOrder);

Edit Asset on Marketplace

const data = {
  "listingTime" : "Wed Mar 01 2023 20:48:16 GMT+0700 (Indochina Time)",
  "expirationTime" : "{}",
  "startPrice" : 0.002,
  "acceptPrice" : 0.5
}
const tokenAddress = "0x88Ef499ab1688DE727c21f1b72fAaEe1A3F455AD"; // {String} Address of the ERC721 contract
const tokenId = "1"; // {String} ERC721 token ID

const result = await client.updateListingAsset(tokenAddress, tokenId, sellOrder);

Asset Model

Name
Type
Description

collection

Collection

createdAt

String

Timestamp of when the asset was created

description

String

Description of this asset

fees

[Fee]

Fee structure for this asset

id

String

Asset ID

imageUrl

String

URL of the image which should be used for this asset

animationUrl

String

URL of the animation which should be used for this asset

externalLink

String

URL of the external link which should be used for this asset

metadata

Object

Metadata of this asset

name

String

Name of this asset

listing

Listing

status

String

Status of this asset (where it is in the system)

tokenAddress

String

Address of the ERC721 contract

tokenId

String

ERC721 Token ID of this asset

chain

Chain

updatedAt

String

Timestamp of when the asset was updated

owner

String

Address of the user who owns this asset

Last updated