2015-05-27 12:08:46 +00:00
|
|
|
// Copyright (c) 2012-2015, The CryptoNote developers, The Bytecoin developers
|
|
|
|
//
|
|
|
|
// This file is part of Bytecoin.
|
|
|
|
//
|
|
|
|
// Bytecoin is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Bytecoin is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with Bytecoin. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "serialization/ISerializer.h"
|
|
|
|
#include <vector>
|
|
|
|
#include <exception>
|
|
|
|
|
|
|
|
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) {}
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
struct TransactionRpcInfo {
|
|
|
|
uint64_t firstTransferId;
|
|
|
|
uint64_t transferCount;
|
|
|
|
int64_t totalAmount;
|
|
|
|
uint64_t fee;
|
|
|
|
std::string hash;
|
|
|
|
bool isCoinbase;
|
|
|
|
uint64_t blockHeight;
|
|
|
|
uint64_t timestamp;
|
|
|
|
std::string extra;
|
|
|
|
|
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 TransferRpcInfo {
|
|
|
|
std::string address;
|
|
|
|
int64_t amount;
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
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
|