Class HostFunction

java.lang.Object
org.stellar.sdk.xdr.HostFunction
All Implemented Interfaces:
XdrElement

public class HostFunction extends Object implements XdrElement
HostFunction's original definition in the XDR file is:
 union HostFunction switch (HostFunctionType type)
 {
 case HOST_FUNCTION_TYPE_INVOKE_CONTRACT:
     InvokeContractArgs invokeContract;
 case HOST_FUNCTION_TYPE_CREATE_CONTRACT:
     CreateContractArgs createContract;
 case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM:
     opaque wasm<>;
 case HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2:
     CreateContractArgsV2 createContractV2;
 };
 
  • Constructor Details

    • HostFunction

      public HostFunction()
    • HostFunction

      public HostFunction(HostFunctionType discriminant, InvokeContractArgs invokeContract, CreateContractArgs createContract, byte[] wasm, CreateContractArgsV2 createContractV2)
      Creates a new HostFunction instance.
      Parameters:
      discriminant - the discriminant field value
      invokeContract - the invokeContract field value
      createContract - the createContract field value
      wasm - the wasm field value
      createContractV2 - the createContractV2 field value
  • Method Details

    • encode

      public void encode(XdrDataOutputStream stream) throws IOException
      Description copied from interface: XdrElement
      Encodes this value to XDR and writes it to the provided stream.
      Specified by:
      encode in interface XdrElement
      Parameters:
      stream - the destination XDR output stream
      Throws:
      IOException - if an I/O error occurs while writing the value
    • decode

      public static HostFunction decode(XdrDataInputStream stream, int maxDepth) throws IOException
      Throws:
      IOException
    • decode

      public static HostFunction decode(XdrDataInputStream stream) throws IOException
      Throws:
      IOException
    • fromXdrBase64

      public static HostFunction fromXdrBase64(String xdr) throws IOException
      Throws:
      IOException
    • fromXdrByteArray

      public static HostFunction fromXdrByteArray(byte[] xdr) throws IOException
      Throws:
      IOException
    • toJson

      public String toJson()
      Description copied from interface: XdrElement
      Serializes this value to JSON.
      Specified by:
      toJson in interface XdrElement
      Returns:
      the JSON representation of this value
    • fromJson

      public static HostFunction fromJson(String json)
    • builder

      public static HostFunction.HostFunctionBuilder builder()
    • toBuilder

    • getDiscriminant

      public HostFunctionType getDiscriminant()
      Value of the discriminant field.
      Returns:
      the discriminant field value
    • getInvokeContract

      public InvokeContractArgs getInvokeContract()
      Value of the invokeContract field.
      Returns:
      the invokeContract field value
    • getCreateContract

      public CreateContractArgs getCreateContract()
      Value of the createContract field.
      Returns:
      the createContract field value
    • getWasm

      public byte[] getWasm()
      Value of the wasm field.
      Returns:
      the wasm field value
    • getCreateContractV2

      public CreateContractArgsV2 getCreateContractV2()
      Value of the createContractV2 field.
      Returns:
      the createContractV2 field value
    • setDiscriminant

      public void setDiscriminant(HostFunctionType discriminant)
      Value of the discriminant field.
      Parameters:
      discriminant - the discriminant field value
    • setInvokeContract

      public void setInvokeContract(InvokeContractArgs invokeContract)
      Value of the invokeContract field.
      Parameters:
      invokeContract - the invokeContract field value
    • setCreateContract

      public void setCreateContract(CreateContractArgs createContract)
      Value of the createContract field.
      Parameters:
      createContract - the createContract field value
    • setWasm

      public void setWasm(byte[] wasm)
      Value of the wasm field.
      Parameters:
      wasm - the wasm field value
    • setCreateContractV2

      public void setCreateContractV2(CreateContractArgsV2 createContractV2)
      Value of the createContractV2 field.
      Parameters:
      createContractV2 - the createContractV2 field value
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object