Package org.onyx.api

Class Account.Builder

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

public static class Account.Builder extends Object
A builder for creating accounts in the ledger.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • create

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

      public Account.Builder setId(String id)
      Specifies the id for the new account.
      Parameters:
      id - unique identifier. Will be auto-generated if not provided.
      Returns:
      updated builder
    • setQuorum

      public Account.Builder setQuorum(int quorum)
      Specifies the number of keys required to sign transactions that transfer or retire tokens from the account. 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 Account.Builder addKeyId(String id)
      Adds a key that controls the account.
      Parameters:
      id - the key's ID
      Returns:
      updated builder
    • addTag

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

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