Skip to content

setType

Set the algorithm metadata of an 'algorithm' type asset.

To learn how to classify your asset as type 'algorithm', please refer to the setType()documentation.

Official OceanProtocol documentation: DDO Specification

Usage

When defining algorithm type assets, additional metadata is necessary to be set.

import { AssetBuilder, Nautilus } from '@deltadao/nautilus'
import { Wallet } from 'ethers'
 
const nautilus = await Nautilus.create(new Wallet('0x1234'))
 
const assetBuilder = new AssetBuilder()
assetBuilder.setAlgorithm({ 
    container: { 
        entrypoint: 'node $ALGO', 
        image: 'node', 
        tag: 'lts', 
        checksum: 'sha256:a6faa1aa0ae1981b70c075dd6ea0a1725a1d05a4cab85536460ae4e4710e8331'
    }, 
}) 
const asset = assetBuilder.build() 
 
await nautilus.publish(asset) 
ddo.metadata:
{
algorithm: {
container: {
entrypoint: 'node $ALGO',
image: 'node',
tag: 'lts',
checksum: 'sha256:a6faa1aa0ae1981b70c075dd6ea0a1725a1d05a4cab85536460ae4e4710e8331'
}
}
}

Returns

The asset builder instance to chain building calls with.

Parameter

algorithm

  • Type: MetadataAlgorithm

The algorithms metadata to be specified.

assetBuilder.setAlgorithm(
    { 
        container: { 
            entrypoint: 'node $ALGO', 
            image: 'node', 
            tag: 'lts', 
            checksum: 'sha256:a6faa1aa0ae1981b70c075dd6ea0a1725a1d05a4cab85536460ae4e4710e8331'
        }, 
    } 
) 

Properties

For a full overview of algorithm metadata, please refer to the Algorithm Metadata documentation provided by OceanProtocol.