Ejemplo n.º 1
0
        static RawTransactionSignerDelegate CreateRawTransactionSigner()
        {
            return(new RawTransactionSignerDelegate(async(rpcClient, txParams) =>
            {
                var account = GlobalVariables.AccountKeys.First(a => a.Address == txParams.From.Value);
                var nonce = await rpcClient.GetTransactionCount(account.Address, BlockParameterType.Pending);
                var chainID = GlobalVariables.ChainID;

                byte[] signedTxBytes = TransactionUtil.SignRawTransaction(
                    account.Account,
                    nonce,
                    (BigInteger?)txParams.GasPrice ?? 0,
                    (BigInteger?)txParams.Gas ?? 0,
                    txParams.To,
                    (BigInteger?)txParams.Value ?? 0,
                    txParams.Data,
                    chainID);

                return signedTxBytes;
            }));
        }