Class ImmutableAmmObject

java.lang.Object
org.xrpl.xrpl4j.model.ledger.ImmutableAmmObject
All Implemented Interfaces:
AmmObject, LedgerObject

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableAmmObject extends Object implements AmmObject
Immutable implementation of AmmObject.

Use the builder to create immutable instances: ImmutableAmmObject.builder().

  • Method Details

    • ledgerEntryType

      public LedgerObject.LedgerEntryType ledgerEntryType()
      The type of ledger object, which will always be "AMM" in this case.
      Specified by:
      ledgerEntryType in interface AmmObject
      Returns:
      Always returns LedgerObject.LedgerEntryType.AMM.
    • flags

      public Flags flags()
      A bit-map of boolean flags. No flags are defined for AmmObject, so this value is always 0.
      Specified by:
      flags in interface AmmObject
      Returns:
      Always Flags.UNSET.
    • asset

      public Issue asset()
      The definition for one of the two assets this AMM holds.
      Specified by:
      asset in interface AmmObject
      Returns:
      An Issue.
    • asset2

      public Issue asset2()
      The definition for the other asset this AMM holds.
      Specified by:
      asset2 in interface AmmObject
      Returns:
      An Issue.
    • account

      public Address account()
      The address of the special account that holds this AMM's assets.
      Specified by:
      account in interface AmmObject
      Returns:
      An Address.
    • auctionSlot

      public Optional<AuctionSlot> auctionSlot()
      Details of the current owner of the auction slot.
      Specified by:
      auctionSlot in interface AmmObject
      Returns:
      An AuctionSlot.
    • lpTokenBalance

      public IssuedCurrencyAmount lpTokenBalance()
      The total outstanding balance of liquidity provider tokens from this AMM instance. The holders of these tokens can vote on the AMM's trading fee in proportion to their holdings, or redeem the tokens for a share of the AMM's assets which grows with the trading fees collected.
      Specified by:
      lpTokenBalance in interface AmmObject
      Returns:
      An IssuedCurrencyAmount.
    • tradingFee

      public TradingFee tradingFee()
      The percentage fee to be charged for trades against this AMM instance, in units of 1/10,000. The maximum value is 1000, for a 1% fee.
      Specified by:
      tradingFee in interface AmmObject
      Returns:
      A TradingFee.
    • voteSlots

      public com.google.common.collect.ImmutableList<VoteEntryWrapper> voteSlots()
      A list of vote objects, representing votes on the pool's trading fee.
      Specified by:
      voteSlots in interface AmmObject
      Returns:
      A List of VoteEntryWrappers.
    • ownerNode

      public String ownerNode()
      A hint indicating which page of the sender's owner directory links to this object, in case the directory consists of multiple pages.

      Note: The object does not contain a direct link to the owner directory containing it, since that value can be derived from the Account.

      Specified by:
      ownerNode in interface AmmObject
      Returns:
      A String containing the owner node hint.
    • voteSlotsUnwrapped

      public List<VoteEntry> voteSlotsUnwrapped()
      Unwraps the VoteEntryWrappers in voteSlots() for easier access to VoteEntrys.
      Specified by:
      voteSlotsUnwrapped in interface AmmObject
      Returns:
      A List of VoteEntry.
    • index

      public Hash256 index()
      The unique ID of the AmmObject.
      Specified by:
      index in interface AmmObject
      Returns:
      A Hash256.
    • withAsset

      public final ImmutableAmmObject withAsset(Issue value)
      Copy the current immutable object by setting a value for the asset attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for asset
      Returns:
      A modified copy of the this object
    • withAsset2

      public final ImmutableAmmObject withAsset2(Issue value)
      Copy the current immutable object by setting a value for the asset2 attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for asset2
      Returns:
      A modified copy of the this object
    • withAccount

      public final ImmutableAmmObject withAccount(Address value)
      Copy the current immutable object by setting a value for the account attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for account
      Returns:
      A modified copy of the this object
    • withAuctionSlot

      public final ImmutableAmmObject withAuctionSlot(AuctionSlot value)
      Copy the current immutable object by setting a present value for the optional auctionSlot attribute.
      Parameters:
      value - The value for auctionSlot
      Returns:
      A modified copy of this object
    • withAuctionSlot

      public final ImmutableAmmObject withAuctionSlot(Optional<? extends AuctionSlot> optional)
      Copy the current immutable object by setting an optional value for the auctionSlot attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for auctionSlot
      Returns:
      A modified copy of this object
    • withLpTokenBalance

      public final ImmutableAmmObject withLpTokenBalance(IssuedCurrencyAmount value)
      Copy the current immutable object by setting a value for the lpTokenBalance attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for lpTokenBalance
      Returns:
      A modified copy of the this object
    • withTradingFee

      public final ImmutableAmmObject withTradingFee(TradingFee value)
      Copy the current immutable object by setting a value for the tradingFee attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for tradingFee
      Returns:
      A modified copy of the this object
    • withVoteSlots

      public final ImmutableAmmObject withVoteSlots(VoteEntryWrapper... elements)
      Copy the current immutable object with elements that replace the content of voteSlots.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withVoteSlots

      public final ImmutableAmmObject withVoteSlots(Iterable<? extends VoteEntryWrapper> elements)
      Copy the current immutable object with elements that replace the content of voteSlots. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of voteSlots elements to set
      Returns:
      A modified copy of this object
    • withOwnerNode

      public final ImmutableAmmObject withOwnerNode(String value)
      Copy the current immutable object by setting a value for the ownerNode attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for ownerNode
      Returns:
      A modified copy of the this object
    • withIndex

      public final ImmutableAmmObject withIndex(Hash256 value)
      Copy the current immutable object by setting a value for the index attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for index
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableAmmObject that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: ledgerEntryType, flags, asset, asset2, account, auctionSlot, lpTokenBalance, tradingFee, voteSlots, ownerNode, voteSlotsUnwrapped, index.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value AmmObject with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableAmmObject copyOf(AmmObject instance)
      Creates an immutable copy of a AmmObject value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable AmmObject instance
    • builder

      public static ImmutableAmmObject.Builder builder()
      Creates a builder for ImmutableAmmObject.
       ImmutableAmmObject.builder()
          .asset(org.xrpl.xrpl4j.model.ledger.Issue) // required asset
          .asset2(org.xrpl.xrpl4j.model.ledger.Issue) // required asset2
          .account(org.xrpl.xrpl4j.model.transactions.Address) // required account
          .auctionSlot(org.xrpl.xrpl4j.model.ledger.AuctionSlot) // optional auctionSlot
          .lpTokenBalance(org.xrpl.xrpl4j.model.transactions.IssuedCurrencyAmount) // required lpTokenBalance
          .tradingFee(org.xrpl.xrpl4j.model.transactions.TradingFee) // required tradingFee
          .addVoteSlots|addAllVoteSlots(org.xrpl.xrpl4j.model.ledger.VoteEntryWrapper) // voteSlots elements
          .ownerNode(String) // required ownerNode
          .index(org.xrpl.xrpl4j.model.transactions.Hash256) // required index
          .build();
       
      Returns:
      A new ImmutableAmmObject builder