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
| Value | Name | Meaning |
|---|---|---|
0 | ACTIVE | Normal. |
1 | END_OF_LIFE | Retired; no longer maintained. Reversible. |
2 | DEPRECATED | Superseded by another asset. One-way on ocean-node. |
3 | REVOKED_BY_PUBLISHER | Withdrawn. One-way on ocean-node. |
4 | ORDERING_DISABLED_TEMPORARILY | Visible, but cannot be ordered. Reversible. |
5 | ASSET_UNLISTED | Accessible 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