2015-09-18 11:55:31 +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.
|
2015-05-27 12:08:46 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <exception>
|
2015-07-30 15:22:07 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Serialization/ISerializer.h"
|
2015-05-27 12:08:46 +00:00
|
|
|
|
|
|
|
namespace PaymentService {
|
|
|
|
|
|
|
|
class RequestSerializationError: public std::exception {
|
|
|
|
public:
|
|
|
|
virtual const char* what() const throw() override { return "Request error"; }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TransferDestination {
|
|
|
|
uint64_t amount;
|
|
|
|
std::string address;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SendTransactionRequest {
|
|
|
|
SendTransactionRequest() : unlockTime(0) {}
|
2015-07-30 15:22:07 +00:00
|
|
|
|
2015-05-27 12:08:46 +00:00
|
|
|
std::vector<TransferDestination> destinations;
|
|
|
|
uint64_t fee;
|
|
|
|
uint64_t mixin;
|
|
|
|
uint64_t unlockTime;
|
|
|
|
std::string paymentId;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SendTransactionResponse {
|
|
|
|
uint64_t transactionId;
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
2015-07-30 15:22:07 +00:00
|
|
|
struct GetAddressRequest {
|
|
|
|
GetAddressRequest() : index(0) {}
|
|
|
|
|
|
|
|
size_t index;
|
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GetAddressCountResponse {
|
|
|
|
std::size_t count;
|
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DeleteAddressRequest {
|
|
|
|
std::string address;
|
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DeleteAddressResponse {
|
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CreateAddressResponse {
|
|
|
|
std::string address;
|
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
|
|
|
};
|
|
|
|
|
2015-05-27 12:08:46 +00:00
|
|
|
struct GetAddressResponse {
|
|
|
|
std::string address;
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
2015-07-30 15:22:07 +00:00
|
|
|
struct GetActualBalanceRequest {
|
|
|
|
std::string address;
|
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
|
|
|
};
|
|
|
|
|
2015-05-27 12:08:46 +00:00
|
|
|
struct GetActualBalanceResponse {
|
|
|
|
uint64_t actualBalance;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
2015-07-30 15:22:07 +00:00
|
|
|
struct GetPendingBalanceRequest {
|
|
|
|
std::string address;
|
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
|
|
|
};
|
|
|
|
|
2015-05-27 12:08:46 +00:00
|
|
|
struct GetPendingBalanceResponse {
|
|
|
|
uint64_t pendingBalance;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GetTransactionsCountResponse {
|
|
|
|
uint64_t transactionsCount;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GetTransfersCountResponse {
|
|
|
|
uint64_t transfersCount;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GetTransactionIdByTransferIdRequest {
|
|
|
|
uint64_t transferId;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GetTransactionIdByTransferIdResponse {
|
|
|
|
uint64_t transactionid;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GetTransactionRequest {
|
|
|
|
uint64_t transactionId;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
2015-07-30 15:22:07 +00:00
|
|
|
struct TransferRpcInfo {
|
|
|
|
std::string address;
|
|
|
|
int64_t amount;
|
|
|
|
|
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
|
|
|
};
|
|
|
|
|
2015-05-27 12:08:46 +00:00
|
|
|
struct TransactionRpcInfo {
|
|
|
|
uint64_t firstTransferId;
|
|
|
|
uint64_t transferCount;
|
|
|
|
int64_t totalAmount;
|
|
|
|
uint64_t fee;
|
|
|
|
std::string hash;
|
|
|
|
uint64_t blockHeight;
|
|
|
|
uint64_t timestamp;
|
|
|
|
std::string extra;
|
2015-07-30 15:22:07 +00:00
|
|
|
std::vector<TransferRpcInfo> transfers;
|
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
|
|
|
};
|
|
|
|
|
|
|
|
struct GetTransactionResponse {
|
|
|
|
bool found;
|
|
|
|
TransactionRpcInfo transactionInfo;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ListTransactionsRequest {
|
|
|
|
uint32_t startingTransactionId;
|
|
|
|
uint32_t maxTransactionCount;
|
|
|
|
|
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ListTransactionsResponse {
|
|
|
|
std::vector<TransactionRpcInfo> transactions;
|
|
|
|
|
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GetTransferRequest {
|
|
|
|
uint64_t transferId;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GetTransferResponse {
|
|
|
|
bool found;
|
|
|
|
TransferRpcInfo transferInfo;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GetIncomingPaymentsRequest {
|
|
|
|
std::vector<std::string> payments;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PaymentDetails
|
|
|
|
{
|
|
|
|
std::string txHash;
|
|
|
|
uint64_t amount;
|
|
|
|
uint64_t blockHeight;
|
|
|
|
uint64_t unlockTime;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PaymentsById {
|
|
|
|
std::string id;
|
|
|
|
std::vector<PaymentDetails> payments;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GetIncomingPaymentsResponse {
|
|
|
|
std::vector<PaymentsById> payments;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(CryptoNote::ISerializer& serializer);
|
2015-05-27 12:08:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} //namespace PaymentService
|