public ResultWrapper <Data> eth_sendTransaction(Transaction transaction) { Core.Transaction tx = _modelMapper.MapTransaction(transaction); Keccak txHash = _blockchainBridge.SendTransaction(tx); return(ResultWrapper <Data> .Success(new Data(txHash))); }
public Block MapBlock(Core.Block block, bool returnFullTransactionObjects) { Transaction[] transactions = null; Data[] transactionHashes = null; if (returnFullTransactionObjects) { transactions = new Transaction[block.Transactions.Length]; } else { transactionHashes = new Data[block.Transactions.Length]; } for (int i = 0; i < block.Transactions.Length; i++) { if (returnFullTransactionObjects) { transactions[i] = MapTransaction(block.Hash, block.Number, i, block.Transactions[i]); } else { transactionHashes[i] = new Data(block.Transactions[i].Hash); } } var blockModel = new Block { Hash = new Data(block.Hash.Bytes), Uncles = block.Ommers?.Select(x => new Data(x.Hash)).ToArray(), Transactions = transactions, TransactionHashes = transactionHashes }; if (block.Header == null) { return(blockModel); } blockModel.Number = new Quantity(block.Header.Number); blockModel.ParentHash = new Data(block.Header.ParentHash); blockModel.Nonce = new Data(block.Header.Nonce.ToString()); blockModel.MixHash = new Data(block.Header.MixHash?.ToString()); blockModel.Sha3Uncles = new Data(block.Header.OmmersHash); blockModel.LogsBloom = new Data(block.Header.Bloom?.Bytes); blockModel.TransactionsRoot = new Data(block.Header.TransactionsRoot); blockModel.StateRoot = new Data(block.Header.StateRoot); blockModel.ReceiptsRoot = new Data(block.Header.ReceiptsRoot); blockModel.Miner = block.Header.Beneficiary != null ? new Data(block.Header.Beneficiary) : null; blockModel.Difficulty = new Quantity(block.Header.Difficulty); blockModel.TotalDifficulty = new Quantity(block.Header.TotalDifficulty ?? 0); blockModel.ExtraData = new Data(block.Header.ExtraData); //Size = new Quantity(block.Header.) blockModel.GasLimit = new Quantity(block.Header.GasLimit); blockModel.GasUsed = new Quantity(block.Header.GasUsed); blockModel.Timestamp = new Quantity(block.Header.Timestamp); return(blockModel); }
public Core.Transaction MapTransaction(Transaction transaction) { Core.Transaction tx = new Core.Transaction(); tx.GasLimit = transaction.Gas?.Value.ToUInt256() ?? 90000; tx.GasPrice = transaction.GasPrice?.Value.ToUInt256() ?? 0; tx.Nonce = transaction.Nonce?.Value.ToUInt256() ?? 0; // here pick the last nonce? tx.To = transaction.To == null ? null : new Address(transaction.To.Value); tx.SenderAddress = transaction.From == null ? null : new Address(transaction.From.Value); tx.Value = transaction.Value?.Value.ToUInt256() ?? UInt256.Zero; if (tx.To == null) { tx.Init = transaction.Data.Value; } else { tx.Data = transaction.Data.Value; } return(tx); }
public ResultWrapper <Quantity> eth_estimateGas(Transaction transactionCall, BlockParameter blockParameter) { throw new NotImplementedException(); }
public ResultWrapper <Data> eth_call(Transaction transactionCall, BlockParameter blockParameter) { throw new NotImplementedException(); }
public ResultWrapper <Data> eth_sendTransaction(Transaction transaction) { throw new NotImplementedException(); }
public ResultWrapper <Quantity> eth_estimateGas(Transaction transactionCall, BlockParameter blockParameter) { return(ResultWrapper <Quantity> .Fail("eth_estimateGas not supported")); }
public ResultWrapper <Data> eth_call(Transaction transactionCall, BlockParameter blockParameter) { Core.Block block = GetBlock(blockParameter).Data; byte[] result = _blockchainBridge.Call(block, _modelMapper.MapTransaction(transactionCall)); return(ResultWrapper <Data> .Success(new Data(result))); }
public ResultWrapper <ParityLikeTxTrace> trace_call(Transaction message, string[] traceTypes, BlockParameter quantity) { throw new NotImplementedException(); }