Exemplo n.º 1
0
        protected async Task <TransactionReceipt> InvokeAsync(Function function, BigInteger gasUnits, params object[] parameters)
        {
            var transactionReceipt = await function.SendTransactionAndWaitForReceiptAsync(
                Web3.TransactionManager.Account.Address,
                new HexBigInteger(gasUnits),
                new HexBigInteger(GasPriceProvider.GetGasPrice()),
                null,
                null,
                parameters);

            transactionReceipt.EnsureSucceededStatus();

            return(transactionReceipt);
        }
Exemplo n.º 2
0
        protected async Task <TransactionReceipt> DeployAsync(params object[] constructorParameters)
        {
            var transactionReceipt = await Web3.Eth.DeployContract.SendRequestAndWaitForReceiptAsync(
                _abi,
                _bin,
                Web3.TransactionManager.Account.Address,
                new HexBigInteger(DeploymentGasUnits),
                new HexBigInteger(GasPriceProvider.GetGasPrice()),
                null,
                null,
                constructorParameters);

            transactionReceipt.EnsureSucceededStatus();

            var contractDescriptor = Web3.Eth.GetContract(_abi, transactionReceipt.ContractAddress);

            Initialize(contractDescriptor);

            ContractAddress = transactionReceipt.ContractAddress;

            return(transactionReceipt);
        }