Package org.stellar.sdk.xdr
Class HostFunction
java.lang.Object
org.stellar.sdk.xdr.HostFunction
- All Implemented Interfaces:
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;
};
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.stellar.sdk.xdr.XdrElement
gson -
Constructor Summary
ConstructorsConstructorDescriptionHostFunction(HostFunctionType discriminant, InvokeContractArgs invokeContract, CreateContractArgs createContract, byte[] wasm, CreateContractArgsV2 createContractV2) Creates a newHostFunctioninstance. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()static HostFunctiondecode(XdrDataInputStream stream) static HostFunctiondecode(XdrDataInputStream stream, int maxDepth) voidencode(XdrDataOutputStream stream) Encodes this value to XDR and writes it to the provided stream.booleanstatic HostFunctionstatic HostFunctionfromXdrBase64(String xdr) static HostFunctionfromXdrByteArray(byte[] xdr) Value of thecreateContractfield.Value of thecreateContractV2field.Value of thediscriminantfield.Value of theinvokeContractfield.byte[]getWasm()Value of thewasmfield.inthashCode()voidsetCreateContract(CreateContractArgs createContract) Value of thecreateContractfield.voidsetCreateContractV2(CreateContractArgsV2 createContractV2) Value of thecreateContractV2field.voidsetDiscriminant(HostFunctionType discriminant) Value of thediscriminantfield.voidsetInvokeContract(InvokeContractArgs invokeContract) Value of theinvokeContractfield.voidsetWasm(byte[] wasm) Value of thewasmfield.toJson()Serializes this value to JSON.toString()Methods inherited from interface org.stellar.sdk.xdr.XdrElement
toXdrBase64, toXdrByteArray
-
Constructor Details
-
HostFunction
public HostFunction() -
HostFunction
public HostFunction(HostFunctionType discriminant, InvokeContractArgs invokeContract, CreateContractArgs createContract, byte[] wasm, CreateContractArgsV2 createContractV2) Creates a newHostFunctioninstance.- Parameters:
discriminant- thediscriminantfield valueinvokeContract- theinvokeContractfield valuecreateContract- thecreateContractfield valuewasm- thewasmfield valuecreateContractV2- thecreateContractV2field value
-
-
Method Details
-
encode
Description copied from interface:XdrElementEncodes this value to XDR and writes it to the provided stream.- Specified by:
encodein interfaceXdrElement- Parameters:
stream- the destination XDR output stream- Throws:
IOException- if an I/O error occurs while writing the value
-
decode
- Throws:
IOException
-
decode
- Throws:
IOException
-
fromXdrBase64
- Throws:
IOException
-
fromXdrByteArray
- Throws:
IOException
-
toJson
Description copied from interface:XdrElementSerializes this value to JSON.- Specified by:
toJsonin interfaceXdrElement- Returns:
- the JSON representation of this value
-
fromJson
-
builder
-
toBuilder
-
getDiscriminant
Value of thediscriminantfield.- Returns:
- the
discriminantfield value
-
getInvokeContract
Value of theinvokeContractfield.- Returns:
- the
invokeContractfield value
-
getCreateContract
Value of thecreateContractfield.- Returns:
- the
createContractfield value
-
getWasm
public byte[] getWasm()Value of thewasmfield.- Returns:
- the
wasmfield value
-
getCreateContractV2
Value of thecreateContractV2field.- Returns:
- the
createContractV2field value
-
setDiscriminant
Value of thediscriminantfield.- Parameters:
discriminant- thediscriminantfield value
-
setInvokeContract
Value of theinvokeContractfield.- Parameters:
invokeContract- theinvokeContractfield value
-
setCreateContract
Value of thecreateContractfield.- Parameters:
createContract- thecreateContractfield value
-
setWasm
public void setWasm(byte[] wasm) Value of thewasmfield.- Parameters:
wasm- thewasmfield value
-
setCreateContractV2
Value of thecreateContractV2field.- Parameters:
createContractV2- thecreateContractV2field value
-
equals
-
hashCode
public int hashCode() -
toString
-