Skip to content

addService

Adds a pre-defined service to the description of your asset.

To learn more about building services, please refer to the ServiceBuilder documentation.

Official OceanProtocol documentation: DDO Specification

Usage

asset.ts
import { AssetBuilder, Nautilus, NautilusService } from '@deltadao/nautilus'
import { Wallet } from 'ethers'
import { service } from './service'
 
const nautilus = await Nautilus.create(new Wallet('0x1234'))
 
const assetBuilder = new AssetBuilder()
 
assetBuilder.addService(service) 
const asset = assetBuilder.build() 
 
await nautilus.publish(asset) 
ddo.services:
[
{
id: '6a0faa655f70198dd6457450eab66ae29a493ea861cfc666d563c897c65a0d26',
datatokenAddress: '0x99358d0F9A92420C44138802ebd6e95De54801e4',
type: 'access',
serviceEndpoint: 'https://provider.dev.pontus-x.eu',
timeout: 0,
files: '0x046e589d49...'
}
]

Returns

The asset builder instance to chain building calls with.

Parameter

service

  • Type: NautilusService

The service to be added to the asset. To learn more about building services, please refer to the ServiceBuilder documentation.

assetBuilder.addService(
    service 
)