danicoin/src/PaymentGate/PaymentServiceJsonRpcMessages.h
2016-01-18 15:33:29 +00:00

332 lines
6.8 KiB
C++

// Copyright (c) 2011-2016 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 <exception>
#include <limits>
#include <vector>
#include "Serialization/ISerializer.h"
namespace PaymentService {
const uint32_t DEFAULT_ANONYMITY_LEVEL = 6;
class RequestSerializationError: public std::exception {
public:
virtual const char* what() const throw() override { return "Request error"; }
};
struct Reset {
struct Request {
std::string viewSecretKey;
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct GetViewKey {
struct Request {
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
std::string viewSecretKey;
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct GetStatus {
struct Request {
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
uint32_t blockCount;
uint32_t knownBlockCount;
std::string lastBlockHash;
uint32_t peerCount;
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct GetAddresses {
struct Request {
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
std::vector<std::string> addresses;
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct CreateAddress {
struct Request {
std::string spendSecretKey;
std::string spendPublicKey;
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
std::string address;
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct DeleteAddress {
struct Request {
std::string address;
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct GetSpendKeys {
struct Request {
std::string address;
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
std::string spendSecretKey;
std::string spendPublicKey;
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct GetBalance {
struct Request {
std::string address;
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
uint64_t availableBalance;
uint64_t lockedAmount;
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct GetBlockHashes {
struct Request {
uint32_t firstBlockIndex;
uint32_t blockCount;
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
std::vector<std::string> blockHashes;
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct TransactionHashesInBlockRpcInfo {
std::string blockHash;
std::vector<std::string> transactionHashes;
void serialize(CryptoNote::ISerializer& serializer);
};
struct GetTransactionHashes {
struct Request {
std::vector<std::string> addresses;
std::string blockHash;
uint32_t firstBlockIndex = std::numeric_limits<uint32_t>::max();
uint32_t blockCount;
std::string paymentId;
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
std::vector<TransactionHashesInBlockRpcInfo> items;
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct TransferRpcInfo {
uint8_t type;
std::string address;
int64_t amount;
void serialize(CryptoNote::ISerializer& serializer);
};
struct TransactionRpcInfo {
uint8_t state;
std::string transactionHash;
uint32_t blockIndex;
uint64_t timestamp;
bool isBase;
uint64_t unlockTime;
int64_t amount;
uint64_t fee;
std::vector<TransferRpcInfo> transfers;
std::string extra;
std::string paymentId;
void serialize(CryptoNote::ISerializer& serializer);
};
struct GetTransaction {
struct Request {
std::string transactionHash;
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
TransactionRpcInfo transaction;
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct TransactionsInBlockRpcInfo {
std::string blockHash;
std::vector<TransactionRpcInfo> transactions;
void serialize(CryptoNote::ISerializer& serializer);
};
struct GetTransactions {
struct Request {
std::vector<std::string> addresses;
std::string blockHash;
uint32_t firstBlockIndex = std::numeric_limits<uint32_t>::max();
uint32_t blockCount;
std::string paymentId;
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
std::vector<TransactionsInBlockRpcInfo> items;
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct GetUnconfirmedTransactionHashes {
struct Request {
std::vector<std::string> addresses;
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
std::vector<std::string> transactionHashes;
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct WalletRpcOrder {
std::string address;
uint64_t amount;
void serialize(CryptoNote::ISerializer& serializer);
};
struct SendTransaction {
struct Request {
std::vector<std::string> sourceAddresses;
std::vector<WalletRpcOrder> transfers;
std::string changeAddress;
uint64_t fee = 0;
uint32_t anonymity = DEFAULT_ANONYMITY_LEVEL;
std::string extra;
std::string paymentId;
uint64_t unlockTime = 0;
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
std::string transactionHash;
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct CreateDelayedTransaction {
struct Request {
std::vector<std::string> addresses;
std::vector<WalletRpcOrder> transfers;
std::string changeAddress;
uint64_t fee = 0;
uint32_t anonymity = DEFAULT_ANONYMITY_LEVEL;
std::string extra;
std::string paymentId;
uint64_t unlockTime = 0;
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
std::string transactionHash;
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct GetDelayedTransactionHashes {
struct Request {
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
std::vector<std::string> transactionHashes;
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct DeleteDelayedTransaction {
struct Request {
std::string transactionHash;
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
void serialize(CryptoNote::ISerializer& serializer);
};
};
struct SendDelayedTransaction {
struct Request {
std::string transactionHash;
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
void serialize(CryptoNote::ISerializer& serializer);
};
};
} //namespace PaymentService