danicoin/src/Wallet/WalletRpcServerCommandsDefinitions.h

174 lines
3.4 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.
2014-04-02 16:00:17 +00:00
#pragma once
2015-07-30 15:22:07 +00:00
#include "CryptoNoteProtocol/CryptoNoteProtocolDefinitions.h"
#include "CryptoNoteCore/CryptoNoteBasic.h"
2014-04-02 16:00:17 +00:00
#include "crypto/hash.h"
2015-08-27 18:55:14 +00:00
#include "Rpc/CoreRpcServerCommandsDefinitions.h"
2015-07-30 15:22:07 +00:00
#include "WalletRpcServerErrorCodes.h"
2015-07-15 12:23:00 +00:00
2015-07-30 15:22:07 +00:00
namespace Tools
2014-04-02 16:00:17 +00:00
{
namespace wallet_rpc
{
2015-07-15 12:23:00 +00:00
using CryptoNote::ISerializer;
2014-04-02 16:00:17 +00:00
#define WALLET_RPC_STATUS_OK "OK"
#define WALLET_RPC_STATUS_BUSY "BUSY"
struct COMMAND_RPC_GET_BALANCE
{
2015-08-27 18:55:14 +00:00
typedef CryptoNote::EMPTY_STRUCT request;
2014-04-02 16:00:17 +00:00
struct response
{
2015-05-27 12:08:46 +00:00
uint64_t locked_amount;
uint64_t available_balance;
2014-04-02 16:00:17 +00:00
2015-07-15 12:23:00 +00:00
void serialize(ISerializer& s) {
KV_MEMBER(locked_amount)
KV_MEMBER(available_balance)
}
2014-04-02 16:00:17 +00:00
};
};
2015-10-01 15:27:18 +00:00
struct transfer_destination
2014-04-02 16:00:17 +00:00
{
uint64_t amount;
std::string address;
2015-07-15 12:23:00 +00:00
void serialize(ISerializer& s) {
KV_MEMBER(amount)
KV_MEMBER(address)
}
2014-04-02 16:00:17 +00:00
};
struct COMMAND_RPC_TRANSFER
{
struct request
{
2015-10-01 15:27:18 +00:00
std::list<transfer_destination> destinations;
2014-04-02 16:00:17 +00:00
uint64_t fee;
uint64_t mixin;
uint64_t unlock_time;
2014-06-25 17:21:42 +00:00
std::string payment_id;
2014-04-02 16:00:17 +00:00
2015-07-15 12:23:00 +00:00
void serialize(ISerializer& s) {
KV_MEMBER(destinations)
KV_MEMBER(fee)
KV_MEMBER(mixin)
KV_MEMBER(unlock_time)
KV_MEMBER(payment_id)
}
2014-04-02 16:00:17 +00:00
};
struct response
{
std::string tx_hash;
2015-07-15 12:23:00 +00:00
void serialize(ISerializer& s) {
KV_MEMBER(tx_hash)
}
2014-04-02 16:00:17 +00:00
};
};
struct COMMAND_RPC_STORE
{
2015-08-27 18:55:14 +00:00
typedef CryptoNote::EMPTY_STRUCT request;
typedef CryptoNote::EMPTY_STRUCT response;
2014-04-02 16:00:17 +00:00
};
2014-04-29 16:26:45 +00:00
struct payment_details
{
std::string tx_hash;
uint64_t amount;
uint64_t block_height;
uint64_t unlock_time;
2015-07-15 12:23:00 +00:00
void serialize(ISerializer& s) {
KV_MEMBER(tx_hash)
KV_MEMBER(amount)
KV_MEMBER(block_height)
KV_MEMBER(unlock_time)
}
2014-04-29 16:26:45 +00:00
};
struct COMMAND_RPC_GET_PAYMENTS
{
struct request
{
std::string payment_id;
2015-07-15 12:23:00 +00:00
void serialize(ISerializer& s) {
KV_MEMBER(payment_id)
}
2014-04-29 16:26:45 +00:00
};
struct response
{
std::list<payment_details> payments;
2015-07-15 12:23:00 +00:00
void serialize(ISerializer& s) {
KV_MEMBER(payments)
}
2014-04-29 16:26:45 +00:00
};
};
struct Transfer {
uint64_t time;
bool output;
std::string transactionHash;
uint64_t amount;
uint64_t fee;
std::string paymentId;
std::string address;
uint64_t blockIndex;
uint64_t unlockTime;
2015-07-15 12:23:00 +00:00
void serialize(ISerializer& s) {
KV_MEMBER(time)
KV_MEMBER(output)
KV_MEMBER(transactionHash)
KV_MEMBER(amount)
KV_MEMBER(fee)
KV_MEMBER(paymentId)
KV_MEMBER(address)
KV_MEMBER(blockIndex)
KV_MEMBER(unlockTime)
}
};
struct COMMAND_RPC_GET_TRANSFERS {
2015-08-27 18:55:14 +00:00
typedef CryptoNote::EMPTY_STRUCT request;
struct response {
std::list<Transfer> transfers;
2015-07-15 12:23:00 +00:00
void serialize(ISerializer& s) {
KV_MEMBER(transfers)
}
};
};
struct COMMAND_RPC_GET_HEIGHT {
2015-08-27 18:55:14 +00:00
typedef CryptoNote::EMPTY_STRUCT request;
struct response {
uint64_t height;
2015-07-15 12:23:00 +00:00
void serialize(ISerializer& s) {
KV_MEMBER(height)
}
};
};
struct COMMAND_RPC_RESET {
2015-08-27 18:55:14 +00:00
typedef CryptoNote::EMPTY_STRUCT request;
typedef CryptoNote::EMPTY_STRUCT response;
};
2014-04-02 16:00:17 +00:00
}
}