Package foundation.icon.xcall
Interface CallService
-
public interface CallService
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNAMEThe name of CallService.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidCallExecuted(java.math.BigInteger _reqId, int _code, java.lang.String _msg)Notifies that the call message has been executed.voidCallMessage(java.lang.String _from, java.lang.String _to, java.math.BigInteger _sn, java.math.BigInteger _reqId, byte[] _data)Notifies the user that a new call message has arrived.voidCallMessageSent(score.Address _from, java.lang.String _to, java.math.BigInteger _sn)Notifies that the requested call message has been sent.voidexecuteCall(java.math.BigInteger _reqId, byte[] _data)Executes the requested call message.voidexecuteRollback(java.math.BigInteger _sn)Rollbacks the caller state of the request '_sn'.voidhandleError(java.math.BigInteger _sn)Handle the error on delivering the message.voidhandleMessage(java.lang.String _from, byte[] _msg)Handles incoming Messages.voidResponseMessage(java.math.BigInteger _sn, int _code)Notifies that a response message has arrived for the `_sn` if the request was a two-way message.voidRollbackExecuted(java.math.BigInteger _sn)Notifies that the rollback has been executed.voidRollbackMessage(java.math.BigInteger _sn)Notifies the user that a rollback operation is required for the request '_sn'.java.math.BigIntegersendCallMessage(java.lang.String _to, byte[] _data, byte[] _rollback, java.lang.String[] _sources, java.lang.String[] _destinations)Sends a call message to the contract on the destination chain.
-
-
-
Field Detail
-
NAME
static final java.lang.String NAME
The name of CallService.- See Also:
- Constant Field Values
-
-
Method Detail
-
sendCallMessage
java.math.BigInteger sendCallMessage(java.lang.String _to, byte[] _data, byte[] _rollback, java.lang.String[] _sources, java.lang.String[] _destinations)Sends a call message to the contract on the destination chain.- Parameters:
_to- The BTP address of the callee on the destination chain_data- The calldata specific to the target contract_rollback- (Optional) The data for restoring the caller state when an error occurred- Returns:
- The serial number of the request
-
handleMessage
void handleMessage(java.lang.String _from, byte[] _msg)Handles incoming Messages.- Parameters:
_from- String ( Network id of source network )_msg- Bytes ( serialized bytes of CallMessage )
-
handleError
void handleError(java.math.BigInteger _sn)
Handle the error on delivering the message.- Parameters:
_sn- Integer ( serial number of the original message )
-
CallMessageSent
void CallMessageSent(score.Address _from, java.lang.String _to, java.math.BigInteger _sn)Notifies that the requested call message has been sent.- Parameters:
_from- The chain-specific address of the caller_to- The BTP address of the callee on the destination chain_sn- The serial number of the request
-
ResponseMessage
void ResponseMessage(java.math.BigInteger _sn, int _code)Notifies that a response message has arrived for the `_sn` if the request was a two-way message.- Parameters:
_sn- The serial number of the previous request_code- The response code(0: Success, -1: Unknown generic failure, >=1: User defined error code)
-
RollbackMessage
void RollbackMessage(java.math.BigInteger _sn)
Notifies the user that a rollback operation is required for the request '_sn'.- Parameters:
_sn- The serial number of the previous request
-
executeRollback
void executeRollback(java.math.BigInteger _sn)
Rollbacks the caller state of the request '_sn'.- Parameters:
_sn- The serial number of the previous request
-
RollbackExecuted
void RollbackExecuted(java.math.BigInteger _sn)
Notifies that the rollback has been executed.- Parameters:
_sn- The serial number for the rollback
-
CallMessage
void CallMessage(java.lang.String _from, java.lang.String _to, java.math.BigInteger _sn, java.math.BigInteger _reqId, byte[] _data)Notifies the user that a new call message has arrived.- Parameters:
_from- The BTP address of the caller on the source chain_to- A string representation of the callee address_sn- The serial number of the request from the source_reqId- The request id of the destination chain_data- The calldata
-
executeCall
void executeCall(java.math.BigInteger _reqId, byte[] _data)Executes the requested call message.- Parameters:
_reqId- The request id
-
CallExecuted
void CallExecuted(java.math.BigInteger _reqId, int _code, java.lang.String _msg)Notifies that the call message has been executed.- Parameters:
_reqId- The request id for the call message_code- The execution result code(0: Success, -1: Unknown generic failure, >=1: User defined error code)_msg- The result message if any
-
-