Skip to content

setType

Set the type of the asset. This might affect what kind of other metadata is expected for the asset to be valid. See a usage example below for both supported cases: 'dataset' and 'algorithm'.

Official OceanProtocol documentation: DDO Specification

Usage

When defining algorithm type assets, additional metadata is necessary to be set. Feel free to toggle between the examples below or refer to the setAlgorithm() documentation for further information.

dataset
import { AssetBuilder, Nautilus } from '@deltadao/nautilus'
import { Wallet } from 'ethers'
 
const nautilus = await Nautilus.create(new Wallet('0x1234'))
 
const assetBuilder = new AssetBuilder()
assetBuilder.setType('dataset') 
const asset = assetBuilder.build() 
 
await nautilus.publish(asset) 
ddo.metadata:
{
type: 'dataset'
}

Returns

The asset builder instance to chain building calls with.

Parameter

name

  • Type: 'dataset' | 'algorithm'

The type to use for the asset's metadata.

Refer to the setAlgorithm() documentation to learn more about required metadata when publishing algorithm assets.

assetBuilder.setType(
    'dataset'
)