Example #1
0
        private Function <TContractMessage> GetFunction(string contractAddress)
        {
            var contract = Eth.GetContract <TContractMessage>(contractAddress);
            var function = contract.GetFunction <TContractMessage>();

            return(function);
        }
Example #2
0
        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));
        }
Example #3
0
        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));
        }
Example #4
0
        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));
        }
Example #5
0
        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));
        }
Example #6
0
        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));
        }
Example #7
0
        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));
        }
Example #8
0
        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)));
        }