using Nethereum.Hex.HexConvertors.Extensions;
using Nethereum.Hex.HexTypes;
using System.Runtime.Serialization;
namespace Nethereum.RPC.Eth.DTOs
{
///
/// Object - The transaction call object
///
[DataContract]
public class CallInput
{
private string _from;
private string _to;
private string _data;
public CallInput()
{
}
public CallInput(string data, string addressTo)
{
Data = data;
To = addressTo;
}
public CallInput(string data, string addressTo, HexBigInteger value) : this(data, addressTo)
{
Value = value;
}
public CallInput(string data, string addressTo, string addressFrom, HexBigInteger gas, HexBigInteger value)
: this(data, addressTo, value)
{
From = addressFrom;
Gas = gas;
}
public CallInput(string data, string addressTo, string addressFrom, HexBigInteger gas, HexBigInteger gasPrice, HexBigInteger value)
: this(data, addressTo, addressFrom, gas, value)
{
GasPrice = gasPrice;
}
public CallInput(string data, string addressTo, string addressFrom, HexBigInteger gas, HexBigInteger value, HexBigInteger type, HexBigInteger maxFeePerGas, HexBigInteger maxPriorityFeePerGas)
{
Data = data;
To = addressTo;
From = addressFrom;
Gas = gas;
Value = value;
Type = type;
MaxFeePerGas = maxFeePerGas;
MaxPriorityFeePerGas = maxPriorityFeePerGas;
}
public CallInput(string data, string addressFrom, HexBigInteger gas, HexBigInteger value)
: this(data, null, value)
{
From = addressFrom;
Gas = gas;
}
public CallInput(string data, HexBigInteger gas, string addressFrom)
{
Data = data;
Gas = gas;
From = addressFrom;
}
///
/// DATA, 20 Bytes - The address the transaction is send from.
///
[DataMember(Name = "from")]
public string From
{
get { return _from.EnsureHexPrefix(); }
set { _from = value; }
}
///
/// DATA, 20 Bytes - (optional when creating new contract) The address the transaction is directed to.
///
[DataMember(Name = "to")]
public string To
{
get { return _to.EnsureHexPrefix(); }
set { _to = value; }
}
///
/// QUANTITY - (optional, default: 90000) Integer of the gas provided for the transaction execution.It will return
/// unused gas.
///
[DataMember(Name = "gas")]
public HexBigInteger Gas { get; set; }
///
/// gasPrice: QUANTITY - (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gas
///
[DataMember(Name = "gasPrice")]
public HexBigInteger GasPrice { get; set; }
///
/// value: QUANTITY - (optional) Integer of the value send with this transaction
///
[DataMember(Name = "value")]
public HexBigInteger Value { get; set; }
///
/// data: DATA - (optional) The compiled code of a contract
///
[DataMember(Name = "data")]
public string Data
{
get { return _data.EnsureHexPrefix(); }
set { _data = value; }
}
///
/// QUANTITY - Max Fee Per Gas provided by the sender in Wei.
///
[DataMember(Name = "maxFeePerGas")]
public HexBigInteger MaxFeePerGas { get; set; }
///
/// QUANTITY - Max Priority Fee Per Gas provided by the sender in Wei.
///
[DataMember(Name = "maxPriorityFeePerGas")]
public HexBigInteger MaxPriorityFeePerGas { get; set; }
///
/// QUANTITY - The transaction type.
///
[DataMember(Name = "type")]
public HexBigInteger Type { get; set; }
}
}