Class RawTxBuilder

java.lang.Object
foundation.omni.tx.RawTxBuilder

public class RawTxBuilder extends Object
Build hex-encoded raw Omni transactions
  • Constructor Details

    • RawTxBuilder

      public RawTxBuilder()
  • Method Details

    • createSimpleSendHex

      @Deprecated public String createSimpleSendHex(CurrencyID currencyId, OmniValue amount)
      Deprecated.
      Creates a hex-encoded raw transaction of type 0: "simple send".
      Parameters:
      currencyId - currency ID to send
      amount - amount to send
      Returns:
      Hex encoded string for the transaction
    • createSimpleSend

      public byte[] createSimpleSend(CurrencyID currencyId, OmniValue amount)
    • createSendToOwnersHex

      public String createSendToOwnersHex(CurrencyID currencyId, OmniValue amount)
      Creates a hex-encoded raw transaction of type 3: "send to owners".
      Parameters:
      currencyId - currency ID to send
      amount - amount to send to all owners
      Returns:
      Hex encoded string for the transaction
    • createSendToOwners

      public byte[] createSendToOwners(CurrencyID currencyId, OmniValue amount)
    • createDexSellOfferHex

      public String createDexSellOfferHex(CurrencyID currencyId, OmniDivisibleValue amountForSale, org.bitcoinj.base.Coin amountDesired, Byte paymentWindow, org.bitcoinj.base.Coin commitmentFee, Byte action)
      Creates a hex-encoded raw transaction of type 20: "sell tokens for bitcoins". Currency amounts are Long values in satoshis/willetts
      Parameters:
      currencyId - Currency ID to sell OMNI or TOMNI only
      amountForSale - Amount of OMNI/TOMNI for sale
      amountDesired - Amount of BTC desired
      paymentWindow - Time period in blocks
      commitmentFee - Minimum Bitcoin transaction fee
      action - Sell offer sub-action
      Returns:
      The hex-encoded raw transaction
    • createMetaDexSellOfferHex

      public String createMetaDexSellOfferHex(CurrencyID currencyForSale, OmniValue amountForSale, CurrencyID currencyDesired, OmniValue amountDesired, Byte action)
      Creates a hex-encoded raw transaction of type 21: "trade tokens for tokens".
      Parameters:
      currencyForSale - currency to sell
      amountForSale - amount to sell
      currencyDesired - currency desired in exchange
      amountDesired - amount of other currency desired
      action - action
      Returns:
      The hex-encoded raw transaction
    • createAcceptDexOfferHex

      public String createAcceptDexOfferHex(CurrencyID currencyId, OmniValue amount)
      Creates a hex-encoded raw transaction of type 22: "purchase tokens with bitcoins".
      Parameters:
      currencyId - currency ID to purchase
      amount - amount to purchase
      Returns:
      The hex-encoded raw transaction
    • createPropertyHex

      public String createPropertyHex(Ecosystem ecosystem, PropertyType propertyType, Long previousPropertyId, String category, String subCategory, String label, String website, String info, OmniValue amount)
      Creates a hex-encoded raw transaction of type 50: "create a property with fixed supply".
      Parameters:
      ecosystem - main or test ecosystem
      propertyType - divisible or indivisible
      previousPropertyId - an identifier of a predecessor token (0 for new tokens)
      category - a category for the new tokens (can be "")
      subCategory - a subcategory for the new tokens (can be "")
      label - label
      website - an URL for further information about the new tokens (can be "")
      info - info
      amount - the number of tokens to create
      Returns:
      The hex-encoded raw transaction
    • createCrowdsaleHex

      public String createCrowdsaleHex(Ecosystem ecosystem, PropertyType propertyType, Long previousPropertyId, String category, String subCategory, String label, String website, String info, CurrencyID propertyDesired, Long tokensPerUnit, Long deadline, Byte earlyBirdBonus, Byte issuerBonus)
      Creates a hex-encoded raw transaction of type 51: "create a property via crowdsale with variable supply".
      Parameters:
      ecosystem - main or test ecosystem
      propertyType - divisible or indivisible
      previousPropertyId - an identifier of a predecessor token (0 for new crowdsales)
      category - a category for the new tokens (can be "")
      subCategory - a subcategory for the new tokens (can be "")
      label - label
      website - an URL for further information about the new tokens (can be "")
      info - info
      propertyDesired - the identifier of a token eligible to participate in the crowdsale
      tokensPerUnit - the amount of tokens granted per unit invested in the crowdsale
      deadline - the deadline of the crowdsale as Unix timestamp
      earlyBirdBonus - an early bird bonus for participants in percent per week
      issuerBonus - a percentage of tokens that will be granted to the issuer
      Returns:
      The hex-encoded raw transaction
    • createCloseCrowdsaleHex

      public String createCloseCrowdsaleHex(CurrencyID currencyId)
      Creates a hex-encoded raw transaction of type 53: "close a crowdsale manually".
      Parameters:
      currencyId - currency id of crowdsale
      Returns:
      The hex-encoded raw transaction
    • createManagedPropertyHex

      public String createManagedPropertyHex(Ecosystem ecosystem, PropertyType propertyType, Long previousPropertyId, String category, String subCategory, String label, String website, String info)
      Creates a hex-encoded raw transaction of type 54: "create a managed property with variable supply".
      Parameters:
      ecosystem - Omni ecosystem
      propertyType - divisible or indivisible
      previousPropertyId - an identifier of a predecessor token (0 for new tokens)
      category - a category for the new tokens (can be "")
      subCategory - a subcategory for the new tokens (can be "")
      label - label
      website - an URL for further information about the new tokens (can be "")
      info - info
      Returns:
      The hex-encoded raw transaction
    • createGrantTokensHex

      public String createGrantTokensHex(CurrencyID currencyId, OmniValue amount, String memo)
      Creates a hex-encoded raw transaction of type 55: "grant tokens for a managed property".
      Parameters:
      currencyId - currency id for grant
      amount - amount to grant
      memo - memo
      Returns:
      The hex-encoded raw transaction
    • createRevokeTokensHex

      public String createRevokeTokensHex(CurrencyID currencyId, OmniValue amount, String memo)
      Creates a hex-encoded raw transaction of type 56: "revoke tokens of a managed property".
      Parameters:
      currencyId - currency id for revoke
      amount - amount to revoke
      memo - memo
      Returns:
      The hex-encoded raw transaction
    • createChangePropertyManagerHex

      public String createChangePropertyManagerHex(CurrencyID currencyId)
      Creates a hex-encoded raw transaction of type 70: "change manager of a managed property".
      Parameters:
      currencyId - currency id to change manager
      Returns:
      The hex-encoded raw transaction