danicoin/src/PaymentGate/PaymentServiceJsonRpcMessages.h

333 lines
6.8 KiB
C
Raw Normal View History

// 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.
2015-05-27 12:08:46 +00:00
#pragma once
#include <exception>
2015-12-09 13:19:03 +00:00
#include <limits>
2015-07-30 15:22:07 +00:00
#include <vector>
#include "Serialization/ISerializer.h"
2015-05-27 12:08:46 +00:00
namespace PaymentService {
2015-12-09 13:19:03 +00:00
const uint32_t DEFAULT_ANONYMITY_LEVEL = 6;
2015-05-27 12:08:46 +00:00
class RequestSerializationError: public std::exception {
public:
virtual const char* what() const throw() override { return "Request error"; }
};
2015-12-09 13:19:03 +00:00
struct Reset {
struct Request {
std::string viewSecretKey;
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
};
2015-12-09 13:19:03 +00:00
struct GetViewKey {
struct Request {
void serialize(CryptoNote::ISerializer& serializer);
};
2015-07-30 15:22:07 +00:00
2015-12-09 13:19:03 +00:00
struct Response {
std::string viewSecretKey;
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
};
2015-12-09 13:19:03 +00:00
struct GetStatus {
struct Request {
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
struct Response {
uint32_t blockCount;
uint32_t knownBlockCount;
std::string lastBlockHash;
uint32_t peerCount;
2015-07-30 15:22:07 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
2015-07-30 15:22:07 +00:00
};
2015-12-09 13:19:03 +00:00
struct GetAddresses {
struct Request {
void serialize(CryptoNote::ISerializer& serializer);
};
2015-07-30 15:22:07 +00:00
2015-12-09 13:19:03 +00:00
struct Response {
std::vector<std::string> addresses;
2015-07-30 15:22:07 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
2015-07-30 15:22:07 +00:00
};
2015-12-09 13:19:03 +00:00
struct CreateAddress {
struct Request {
std::string spendSecretKey;
std::string spendPublicKey;
2015-07-30 15:22:07 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
struct Response {
std::string address;
void serialize(CryptoNote::ISerializer& serializer);
};
2015-07-30 15:22:07 +00:00
};
2015-12-09 13:19:03 +00:00
struct DeleteAddress {
struct Request {
std::string address;
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
struct Response {
void serialize(CryptoNote::ISerializer& serializer);
};
2015-07-30 15:22:07 +00:00
};
2015-12-09 13:19:03 +00:00
struct GetSpendKeys {
struct Request {
std::string address;
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
struct Response {
std::string spendSecretKey;
std::string spendPublicKey;
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
};
2015-12-09 13:19:03 +00:00
struct GetBalance {
struct Request {
std::string address;
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
uint64_t availableBalance;
uint64_t lockedAmount;
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
};
2015-12-09 13:19:03 +00:00
struct GetBlockHashes {
struct Request {
uint32_t firstBlockIndex;
uint32_t blockCount;
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
std::vector<std::string> blockHashes;
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
};
2015-12-09 13:19:03 +00:00
struct TransactionHashesInBlockRpcInfo {
std::string blockHash;
std::vector<std::string> transactionHashes;
2015-05-27 12:08:46 +00:00
2015-07-15 12:23:00 +00:00
void serialize(CryptoNote::ISerializer& serializer);
2015-05-27 12:08:46 +00:00
};
2015-12-09 13:19:03 +00:00
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;
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
std::vector<TransactionHashesInBlockRpcInfo> items;
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
};
2015-07-30 15:22:07 +00:00
struct TransferRpcInfo {
2015-10-01 15:27:18 +00:00
uint8_t type;
2015-07-30 15:22:07 +00:00
std::string address;
int64_t amount;
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
struct TransactionRpcInfo {
2015-10-01 15:27:18 +00:00
uint8_t state;
2015-12-09 13:19:03 +00:00
std::string transactionHash;
uint32_t blockIndex;
2015-05-27 12:08:46 +00:00
uint64_t timestamp;
2015-12-09 13:19:03 +00:00
bool isBase;
uint64_t unlockTime;
int64_t amount;
uint64_t fee;
2015-07-30 15:22:07 +00:00
std::vector<TransferRpcInfo> transfers;
2015-12-09 13:19:03 +00:00
std::string extra;
std::string paymentId;
2015-05-27 12:08:46 +00:00
2015-07-15 12:23:00 +00:00
void serialize(CryptoNote::ISerializer& serializer);
2015-05-27 12:08:46 +00:00
};
2015-12-09 13:19:03 +00:00
struct GetTransaction {
struct Request {
std::string transactionHash;
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
2015-07-15 12:23:00 +00:00
2015-12-09 13:19:03 +00:00
struct Response {
TransactionRpcInfo transaction;
2015-07-15 12:23:00 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
2015-07-15 12:23:00 +00:00
};
2015-12-09 13:19:03 +00:00
struct TransactionsInBlockRpcInfo {
std::string blockHash;
2015-07-15 12:23:00 +00:00
std::vector<TransactionRpcInfo> transactions;
void serialize(CryptoNote::ISerializer& serializer);
2015-05-27 12:08:46 +00:00
};
2015-12-09 13:19:03 +00:00
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;
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
struct Response {
std::vector<TransactionsInBlockRpcInfo> items;
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
};
2015-12-09 13:19:03 +00:00
struct GetUnconfirmedTransactionHashes {
struct Request {
std::vector<std::string> addresses;
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
void serialize(CryptoNote::ISerializer& serializer);
};
struct Response {
std::vector<std::string> transactionHashes;
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
};
2015-12-09 13:19:03 +00:00
struct WalletRpcOrder {
std::string address;
2015-05-27 12:08:46 +00:00
uint64_t amount;
2015-07-15 12:23:00 +00:00
void serialize(CryptoNote::ISerializer& serializer);
2015-05-27 12:08:46 +00:00
};
2015-12-09 13:19:03 +00:00
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);
};
};
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
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);
};
2015-05-27 12:08:46 +00:00
};
2015-12-09 13:19:03 +00:00
struct GetDelayedTransactionHashes {
struct Request {
void serialize(CryptoNote::ISerializer& serializer);
};
2015-05-27 12:08:46 +00:00
2015-12-09 13:19:03 +00:00
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);
};
2015-05-27 12:08:46 +00:00
};
} //namespace PaymentService