Skip to content
LogoLogo

setAssetLifecycleState

Change an asset's lifecycle state on its NFT.

Usage

const  = await .('did:ope:2a6ebce0af...')
 
const  = await .( 
  , 
  .
) 

Resolves with the receipt once the transaction is mined, and throws if it was not submitted or reverted. Returns undefined without sending a transaction when the asset is already in the requested state. Within one instance, it waits for any publish(), completePublish() or edit() of the same NFT still running before it sends its transaction.

The states can also be set while editing, via AssetBuilder.setLifecycleState — use that when you are changing metadata anyway, and this when the state is all you want to change.

States

  • Type: LifecycleStates
ValueNameMeaning
0ACTIVENormal.
1END_OF_LIFERetired; no longer maintained. Reversible.
2DEPRECATEDSuperseded by another asset. One-way on ocean-node.
3REVOKED_BY_PUBLISHERWithdrawn. One-way on ocean-node.
4ORDERING_DISABLED_TEMPORARILYVisible, but cannot be ordered. Reversible.
5ASSET_UNLISTEDAccessible by DID, hidden from markets. Reversible.

A state change does not update the indexed transaction id, so waitForIndexer with the receipt's hash cannot wait for it. Poll getAsset and read getLifecycleState.

DDO v5's State enum carries the same values and is accepted too. nautilus re-exports it as a type only, so pass LifecycleStates members when you need a value.

Returns

  • Type: TransactionReceipt | undefined

The mined receipt. The standalone setMetadataState({ nftAddress, state, chainConfig, signer }) export behaves the same way and also waits for the receipt. A read straight after can still show the old state on an RPC behind a load balancer whose nodes lag each other by a block.

Parameters

asset

  • Type: AssetV5

state

  • Type: LifecycleStates | State