Package org.onyx.api

Class Asset.Builder

java.lang.Object
org.onyx.api.Asset.Builder
Enclosing class:
Asset

public static class Asset.Builder extends Object
A builder for defining assets in the ledger.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • create

      public Asset create(Client client) throws ChainException
      Creates a new asset in the ledger.
      Parameters:
      client - ledger API connection object
      Returns:
      an asset
      Throws:
      ChainException
    • setId

      public Asset.Builder setId(String id)
      Specifies the id for the new asset.
      Parameters:
      id - a unique, user-specified identifier
      Returns:
      updated builder
    • addTag

      public Asset.Builder addTag(String key, Object value)
      Adds a key-value pair to the asset's tags.
      Parameters:
      key - key of the tag
      value - value of the tag
      Returns:
      updated builder
    • setTags

      public Asset.Builder setTags(Map<String,Object> tags)
      Specifies key-value data that describes the asset.
      Parameters:
      tags - map of tag keys to tag values
      Returns:
      updated builder
    • setQuorum

      public Asset.Builder setQuorum(int quorum)
      Specifies the number of keys required to sign transactions that issue tokens of the asset. Defaults to the number of keys provided.
      Parameters:
      quorum - a number less than or equal to the number of keys
      Returns:
      updated builder
    • addKeyId

      public Asset.Builder addKeyId(String id)
      Adds a key that controls the asset.
      Parameters:
      id - the key's ID
      Returns:
      updated builder