Skip to content
LogoLogo

publish

Publish a new asset.

Usage

import { ,  } from 'ethers'
import {
  ,
  ,
  ,
  ,
  ,
  
} from '@deltadao/nautilus'
 
const  = new ('0x1234', new ('https://rpc.dev.pontus-x.eu'))
const  = { : 'https://node.example.org' }
 
const  = await .(, {  })
const  = await .(, {
  ,
  : new (.())
})
 
const  = new <., .>({
  : .
})
  .('https://node.example.org')
  .('Access Service')
  .(86400)
  .({ : 'url', : 'https://data.example/set.csv', : 'GET' })
  .({ : 'free' })
  .()
 
const  = new ()
  .('dataset')
  .('My Dataset')
  .('What it contains')
  .('My Organisation')
  .()
  .()
 
const { ,  } = await .() 

What happens in order:

  1. Trusted algorithms are resolved to their container and file checksums. This hits the network and can fail, so it happens before any NFT exists.
  2. The NFT, the first service's datatoken and that service's pricing are created in one transaction. Each further service gets its own datatoken on the same NFT.
  3. Each service's file object is encrypted by the node.
  4. The DDO is built and validated locally against the DDO v5 SHACL schema. A missing field fails here, before any metadata transaction — no gas wasted.
  5. The DDO is signed as a verifiable credential and stored in the remote store.
  6. The { remote } pointer is encrypted and written onto the NFT.

Returns

Parameters

asset

  • Type: NautilusAsset

Built with the AssetBuilder.

options (optional)

  • Type: PublishOptions

Properties

waitForIndexer
  • Type: boolean

Block until ocean-node's indexer has the asset, so the result is immediately resolvable. Sets indexed on the response.

const {  } = await .(, { : true }) 
encrypt
  • Type: boolean
  • Default: true

Encrypt the on-chain pointer (metadata flags 0x02). Set false to write it in plaintext hex (flags 0x00), which makes the pointer readable directly from chain.

remoteStore / ddoSigner

Override the instance's remote store or DDO signer for this call.