danicoinwallet/src/CryptoNoteWrapper.h
2015-09-18 12:37:30 +00:00

56 lines
1.6 KiB
C++

// 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>
namespace CryptoNote {
class INode;
class IWalletLegacy;
class Currency;
class CoreConfig;
class NetNodeConfig;
}
namespace Logging {
class LoggerManager;
}
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;
virtual CryptoNote::IWalletLegacy* createWallet() = 0;
};
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;
};
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);
}