public TransfersSubscription(CryptoNote.Currency currency, Logging.ILogger logger, AccountSubscription sub)
 {
     this.subscription = new CryptoNote.AccountSubscription(sub);
     this.logger       = new Logging.LoggerRef(logger, "TransfersSubscription");
     this.transfers    = new CryptoNote.TransfersContainer(currency, logger, sub.transactionSpendableAge);
     this.m_address    = currency.accountAddressAsString(sub.keys.address);
 }
Example #2
0
        public TransfersSyncronizer(CryptoNote.Currency currency, Logging.ILogger logger, IBlockchainSynchronizer sync, INodeOriginal node)
        {
//C++ TO C# CONVERTER TODO TASK: The following line could not be converted:
            this.m_currency = new CryptoNote.Currency(currency);
            this.m_logger   = new Logging.LoggerRef(logger, "TransfersSyncronizer");
            this.m_sync     = new CryptoNote.IBlockchainSynchronizer(sync);
            this.m_node     = new CryptoNote.INodeOriginal(node);
        }
Example #3
0
        public TransferListFormatter(CryptoNote.Currency currency, Tuple <WalletTransfers.const_iterator, WalletTransfers.const_iterator> range)
        {
//C++ TO C# CONVERTER TODO TASK: The following line could not be converted:
            this.m_currency = new CryptoNote.Currency(currency);
            this.m_range    = range;
        }
Example #4
0
        public WalletOrderListFormatter(CryptoNote.Currency currency, List <CryptoNote.WalletOrder> walletOrderList)
        {
//C++ TO C# CONVERTER TODO TASK: The following line could not be converted:
            this.m_currency        = new CryptoNote.Currency(currency);
            this.m_walletOrderList = walletOrderList;
        }
    //--------------------------------------------------------------------------------
    private bool print_bc(List <string> args)
    {
        if (args.Count == 0)
        {
            Console.Write("need block index parameter");
            Console.Write("\n");
            return(false);
        }

        uint start_index        = 0;
        uint end_index          = 0;
        uint end_block_parametr = m_core.getTopBlockIndex();

        if (!Common.GlobalMembers.fromString(args[0], start_index))
        {
            Console.Write("wrong starter block index parameter");
            Console.Write("\n");
            return(false);
        }

        if (args.Count > 1 && !Common.GlobalMembers.fromString(args[1], end_index))
        {
            Console.Write("wrong end block index parameter");
            Console.Write("\n");
            return(false);
        }

        if (end_index == 0)
        {
//C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created:
//ORIGINAL LINE: end_index = start_index;
            end_index.CopyFrom(start_index);
        }

        if (end_index > end_block_parametr)
        {
            Console.Write("end block index parameter shouldn't be greater than ");
            Console.Write(end_block_parametr);
            Console.Write("\n");
            return(false);
        }

        if (end_index < start_index)
        {
            Console.Write("end block index should be greater than or equal to starter block index");
            Console.Write("\n");
            return(false);
        }

        CryptoNote.COMMAND_RPC_GET_BLOCK_HEADERS_RANGE.request  req = new CryptoNote.COMMAND_RPC_GET_BLOCK_HEADERS_RANGE.request();
        CryptoNote.COMMAND_RPC_GET_BLOCK_HEADERS_RANGE.response res = new CryptoNote.COMMAND_RPC_GET_BLOCK_HEADERS_RANGE.response();
        CryptoNote.JsonRpc.JsonRpcError error_resp = new CryptoNote.JsonRpc.JsonRpcError();

        req.start_height = start_index;
        req.end_height   = end_index;

        // TODO: implement m_is_rpc handling like in monero?
        if (!m_prpc_server.on_get_block_headers_range(req, res, error_resp) || res.status != DefineConstants.CORE_RPC_STATUS_OK)
        {
            // TODO res.status handling
            Console.Write("Response status not CORE_RPC_STATUS_OK");
            Console.Write("\n");
            return(false);
        }

        CryptoNote.Currency currency = m_core.getCurrency();

        bool first = true;

        foreach (CryptoNote  in :block_header_response & header : res.headers)
        {
            if (!first)
            {
                Console.Write("\n");
                first = false;
            }

            Console.Write("height: ");
            Console.Write(header.height);
            Console.Write(", timestamp: ");
            Console.Write(header.timestamp);
            Console.Write(", difficulty: ");
            Console.Write(header.difficulty);
            Console.Write(", size: ");
            Console.Write(header.block_size);
            Console.Write(", transactions: ");
            Console.Write(header.num_txes);
            Console.Write("\n");
            Console.Write("major version: ");
            Console.Write((uint)header.major_version);
            Console.Write(", minor version: ");
            Console.Write((uint)header.minor_version);
            Console.Write("\n");
            Console.Write("block id: ");
            Console.Write(header.hash);
            Console.Write(", previous block id: ");
            Console.Write(header.prev_hash);
            Console.Write("\n");
            Console.Write("difficulty: ");
            Console.Write(header.difficulty);
            Console.Write(", nonce: ");
            Console.Write(header.nonce);
            Console.Write(", reward: ");
            Console.Write(currency.formatAmount(header.reward));
            Console.Write("\n");
        }

        return(true);
    }