Exemplo n.º 1
0
        public async Task <ResultWrapper <Keccak> > eth_sendTransaction(TransactionForRpc rpcTx)
        {
            Transaction transaction = rpcTx.ToTransactionWithDefaults();

            if (transaction.Signature is null)
            {
                RpcResult <UInt256> chainIdResult = await _proxy.eth_chainId();

                ulong chainId = chainIdResult?.IsValid == true ? (ulong)chainIdResult.Result : 0;
                RpcResult <UInt256?> nonceResult =
                    await _proxy.eth_getTransactionCount(transaction.SenderAddress, BlockParameterModel.Pending);

                transaction.Nonce = nonceResult?.IsValid == true ? nonceResult.Result ?? UInt256.Zero : UInt256.Zero;
                _wallet.Sign(transaction, chainId);
            }

            return(ResultWrapper <Keccak> .From(await _proxy.eth_sendRawTransaction(Rlp.Encode(transaction).Bytes)));
        }
Exemplo n.º 2
0
        public async Task <ResultWrapper <Keccak> > eth_sendTransaction(TransactionForRpc transactionForRpc)
        {
            var transaction = transactionForRpc.ToTransaction();

            if (transaction.Signature is null)
            {
                var chainIdResult = await _proxy.eth_chainId();

                var chainId     = chainIdResult?.IsValid == true ? (int)chainIdResult.Result : 0;
                var nonceResult =
                    await _proxy.eth_getTransactionCount(transaction.SenderAddress, BlockParameterModel.Pending);

                transaction.Nonce = nonceResult?.IsValid == true ? nonceResult.Result ?? UInt256.Zero : UInt256.Zero;
                _wallet.Sign(transaction, chainId);
            }

            return(ResultWrapper <Keccak> .From(await _proxy.eth_sendRawTransaction(Rlp.Encode(transaction).Bytes)));
        }
Exemplo n.º 3
0
 public async Task <ResultWrapper <UInt256?> > eth_getBalance(Address address, BlockParameter blockParameter)
 => ResultWrapper <UInt256?> .From(await _proxy.eth_getBalance(address, MapBlockParameter(blockParameter)));
Exemplo n.º 4
0
 public async Task <ResultWrapper <long?> > eth_blockNumber()
 => ResultWrapper <long?> .From(await _proxy.eth_blockNumber());
Exemplo n.º 5
0
 public async Task <ResultWrapper <Keccak> > eth_sendRawTransaction(byte[] transaction)
 => ResultWrapper <Keccak> .From(await _proxy.eth_sendRawTransaction(Rlp.Encode(transaction).Bytes));
Exemplo n.º 6
0
 public async Task <ResultWrapper <UInt256?> > eth_getTransactionCount(Address address, BlockParameter blockParameter)
 => ResultWrapper <UInt256?> .From(await _proxy.eth_getTransactionCount(address, MapBlockParameter(blockParameter)));