library Lib_CrossDomainUtils {
    /**
     * Generates the correct cross domain calldata for a message.
     * @param _target Target contract address.
     * @param _sender Message sender address.
     * @param _message Message to send to the target.
     * @param _messageNonce Nonce for the provided message.
     * @return ABI encoded cross domain calldata.
     */
    function encodeXDomainCalldata(
        address _target,
        address _sender,
        bytes memory _message,
        uint256 _messageNonce
    ) internal pure returns (bytes memory) {
        return
            abi.encodeWithSignature(
                "relayMessage(address,address,bytes,uint256)",
                _target,
                _sender,
                _message,
                _messageNonce
            );
    }
    
    /**
     * Generates the correct cross domain calldata for a message.
     * @param _chainId L2 chain id.
     * @param _target Target contract address.
     * @param _sender Message sender address.
     * @param _message Message to send to the target.
     * @param _messageNonce Nonce for the provided message.
     * @return ABI encoded cross domain calldata.
     */
    function encodeXDomainCalldataViaChainId(
        uint256 _chainId,
        address _target,
        address _sender,
        bytes memory _message,
        uint256 _messageNonce
    )
        internal
        pure
        returns (
            bytes memory
        )
    {
        return abi.encodeWithSignature(
            "relayMessageViaChainId(uint256,address,address,bytes,uint256)",
            _chainId,
            _target,
            _sender,
            _message,
            _messageNonce
        );
    }
}
/**
 * @title Lib_CrossDomainUtils
 */
function encodeXDomainCalldataViaChainId(
        uint256 _chainId,
        address _target,
        address _sender,
        bytes memory _message,
        uint256 _messageNonce
    )
        internal
        pure
        returns (
            bytes memory
        )
    {
        return abi.encodeWithSignature(
            "relayMessageViaChainId(uint256,address,address,bytes,uint256)",
            _chainId,
            _target,
            _sender,
            _message,
            _messageNonce
        );
    }
/**
 * Generates the correct cross domain calldata for a message.
 * @param _chainId L2 chain id.
 * @param _target Target contract address.
 * @param _sender Message sender address.
 * @param _message Message to send to the target.
 * @param _messageNonce Nonce for the provided message.
 * @return ABI encoded cross domain calldata.
 */