Package com.klaytn.caver.contract
Class ContractEvent
- java.lang.Object
-
- com.klaytn.caver.contract.ContractEvent
-
public class ContractEvent extends java.lang.Object
Representing a Contract's event information.
-
-
Constructor Summary
Constructors Constructor Description ContractEvent()
Creates a ContractEvent instance.ContractEvent(java.lang.String type, java.lang.String name, java.lang.String signature, java.util.List<ContractIOType> inputs)
Creates a ContractEvent instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.reactivex.Flowable<LogsNotification>
getFlowable(Caver caver, EventFilterOptions paramsOption, KlayFilter filter)
Returns a Flowable instance that can subscribe to a stream of notifications.java.util.List<ContractIOType>
getInputs()
Getter function for input.java.lang.String
getName()
Getter function for name.java.lang.String
getSignature()
Getter function for signature.java.lang.String
getType()
Getter function for type.
-
-
-
Constructor Detail
-
ContractEvent
public ContractEvent()
Creates a ContractEvent instance.
-
ContractEvent
public ContractEvent(java.lang.String type, java.lang.String name, java.lang.String signature, java.util.List<ContractIOType> inputs)
Creates a ContractEvent instance.- Parameters:
type
- The input type. It always set "event"name
- The event namesignature
- The event signature string.inputs
- The list of ContractIOType contains to event parameter information.
-
-
Method Detail
-
getType
public java.lang.String getType()
Getter function for type.- Returns:
- String
-
getName
public java.lang.String getName()
Getter function for name.- Returns:
- String
-
getSignature
public java.lang.String getSignature()
Getter function for signature.- Returns:
- String
-
getInputs
public java.util.List<ContractIOType> getInputs()
Getter function for input.- Returns:
- List
-
getFlowable
public io.reactivex.Flowable<LogsNotification> getFlowable(Caver caver, EventFilterOptions paramsOption, KlayFilter filter) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException, java.lang.InstantiationException, java.lang.IllegalAccessException
Returns a Flowable instance that can subscribe to a stream of notifications.Fills the KlayFilter object to be used when subscribing using the event filter options received as parameters and the information of this event object.
Example :
ContractEvent event = contract.getEvents().get("Transfer"); EventFilterOptions eventFilterOptions = new EventFilterOptions(); EventFilterOptions.IndexedParameter indexedParam = new EventFilterOptions.IndexedParameter("from", "0x{address in hex}"); eventFilterOptions.setFilterOptions(Arrays.asList(indexedParam)); KlayFilter filter = new KlayFilter(); filter.setAddress(contract.getContractAddress()); Flowable<LogsNotification> flowable = event.getFlowable(contract.getCaver(), eventFilterOptions, filter);
- Parameters:
caver
- The name of the event in the contract.paramsOption
- The filter events by indexed parameters.filter
- TThe filter options to filter notification.- Returns:
- Flowable A Flowable instance that can subscribe to a stream of notifications
- Throws:
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.InstantiationException
java.lang.IllegalAccessException
-
-