private Function <TContractMessage> GetFunction(string contractAddress) { var contract = Eth.GetContract <TContractMessage>(contractAddress); var function = contract.GetFunction <TContractMessage>(); return(function); }
public Task <HexBigInteger> EstimateGasAsync(TContractMessage functionMessage, string contractAddress) { ValidateContractMessage(functionMessage); var contract = Eth.GetContract <TContractMessage>(contractAddress); var function = contract.GetFunction <TContractMessage>(); return(EstimateGasAsync(functionMessage, function)); }
public async Task <string> SendRequestAsync(TContractMessage functionMessage, string contractAddress) { ValidateContractMessage(functionMessage); var contract = Eth.GetContract <TContractMessage>(contractAddress); var function = contract.GetFunction <TContractMessage>(); var gasEstimate = await GetOrEstimateMaximumGas(functionMessage, function).ConfigureAwait(false); return(await ExecuteTransactionAsync(functionMessage, gasEstimate, function).ConfigureAwait(false)); }
public async Task <TransactionReceipt> SendRequestAndWaitForReceiptAsync(TContractMessage functionMessage, string contractAddress, CancellationTokenSource tokenSource = null) { ValidateContractMessage(functionMessage); var contract = Eth.GetContract <TContractMessage>(contractAddress); var function = contract.GetFunction <TContractMessage>(); var gasEstimate = await GetOrEstimateMaximumGas(functionMessage, function).ConfigureAwait(false); return(await ExecuteTransactionAsync(functionMessage, gasEstimate, function, tokenSource)); }
public async Task <TFunctionOutput> QueryAsync <TFunctionOutput>(TContractMessage contractFunctionMessage, string contractAddress, BlockParameter block = null) { var contract = Eth.GetContract <TContractMessage>(contractAddress); var function = contract.GetFunction <TContractMessage>(); ValidateContractMessage(contractFunctionMessage); return(await function.CallAsync <TFunctionOutput>(contractFunctionMessage, contractFunctionMessage.FromAddress, GetMaximumGas(contractFunctionMessage), GetValue(contractFunctionMessage), block).ConfigureAwait(false)); }
public async Task <TFunctionOutput> QueryDeserializingToObjectAsync <TFunctionOutput>( TContractMessage contractFunctionMessage, string contractAddress, BlockParameter block = null) where TFunctionOutput : new() { var contract = Eth.GetContract <TContractMessage>(contractAddress); var function = contract.GetFunction <TContractMessage>(); ValidateContractMessage(contractFunctionMessage); return(await function.CallDeserializingToObjectAsync <TFunctionOutput>(contractFunctionMessage, GetDefaultAddressFrom(contractFunctionMessage), GetMaximumGas(contractFunctionMessage), GetValue(contractFunctionMessage), block).ConfigureAwait(false)); }
public async Task <byte[]> QueryRawAsync(TContractMessage contractFunctionMessage, string contractAddress, BlockParameter block = null) { var contract = Eth.GetContract <TContractMessage>(contractAddress); var function = contract.GetFunction <TContractMessage>(); ValidateContractMessage(contractFunctionMessage); return(await function.CallRawAsync(contractFunctionMessage, GetDefaultAddressFrom(contractFunctionMessage), GetMaximumGas(contractFunctionMessage), GetValue(contractFunctionMessage), block).ConfigureAwait(false)); }
public async Task <TransactionInput> CreateTransactionInputAsync(TContractMessage functionMessage, string contractAddress) { ValidateContractMessage(functionMessage); var contract = Eth.GetContract <TContractMessage>(contractAddress); var function = contract.GetFunction <TContractMessage>(); var gasEstimate = await GetOrEstimateMaximumGas(functionMessage, function).ConfigureAwait(false); return(function.CreateTransactionInput( functionMessage, GetDefaultAddressFrom(functionMessage), gasEstimate, GetGasPrice(functionMessage), GetValue(functionMessage))); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Eth != null) { hashCode = hashCode * 59 + Eth.GetHashCode(); } if (Btc != null) { hashCode = hashCode * 59 + Btc.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if Portfolio instances are equal /// </summary> /// <param name="other">Instance of Portfolio to be compared</param> /// <returns>Boolean</returns> public bool Equals(Portfolio other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Eth == other.Eth || Eth != null && Eth.Equals(other.Eth) ) && ( Btc == other.Btc || Btc != null && Btc.Equals(other.Btc) )); }