2015-04-29 17:03:08 +00:00
|
|
|
// Copyright (c) 2011-2015 The Cryptonote developers
|
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include <system_error>
|
|
|
|
|
2015-09-18 12:37:30 +00:00
|
|
|
namespace CryptoNote {
|
2015-04-29 17:03:08 +00:00
|
|
|
|
2015-09-18 12:37:30 +00:00
|
|
|
class INode;
|
|
|
|
class IWalletLegacy;
|
2015-04-29 17:03:08 +00:00
|
|
|
class Currency;
|
2015-09-18 12:37:30 +00:00
|
|
|
class CoreConfig;
|
|
|
|
class NetNodeConfig;
|
2015-04-29 17:03:08 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-09-18 12:37:30 +00:00
|
|
|
namespace Logging {
|
|
|
|
class LoggerManager;
|
2015-04-29 17:03:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace WalletGui {
|
|
|
|
|
|
|
|
class Node {
|
|
|
|
public:
|
|
|
|
virtual ~Node() = 0;
|
|
|
|
virtual void init(const std::function<void(std::error_code)>& callback) = 0;
|
|
|
|
virtual void deinit() = 0;
|
|
|
|
|
|
|
|
virtual std::string convertPaymentId(const std::string& paymentIdString) = 0;
|
|
|
|
virtual std::string extractPaymentId(const std::string& extra) = 0;
|
|
|
|
virtual uint64_t getLastKnownBlockHeight() const = 0;
|
|
|
|
virtual uint64_t getLastLocalBlockHeight() const = 0;
|
|
|
|
virtual uint64_t getLastLocalBlockTimestamp() const = 0;
|
|
|
|
virtual uint64_t getPeerCount() const = 0;
|
|
|
|
|
2015-09-18 12:37:30 +00:00
|
|
|
virtual CryptoNote::IWalletLegacy* createWallet() = 0;
|
2015-04-29 17:03:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class INodeCallback {
|
|
|
|
public:
|
|
|
|
virtual void peerCountUpdated(Node& node, size_t count) = 0;
|
|
|
|
virtual void localBlockchainUpdated(Node& node, uint64_t height) = 0;
|
|
|
|
virtual void lastKnownBlockHeightUpdated(Node& node, uint64_t height) = 0;
|
|
|
|
};
|
|
|
|
|
2015-09-18 12:37:30 +00:00
|
|
|
Node* createRpcNode(const CryptoNote::Currency& currency, INodeCallback& callback, const std::string& nodeHost, unsigned short nodePort);
|
|
|
|
Node* createInprocessNode(const CryptoNote::Currency& currency, Logging::LoggerManager& logManager,
|
|
|
|
const CryptoNote::CoreConfig& coreConfig, const CryptoNote::NetNodeConfig& netNodeConfig, INodeCallback& callback);
|
2015-04-29 17:03:08 +00:00
|
|
|
|
|
|
|
}
|