danicoin/src/wallet/wallet_rpc_server_commans_defs.h

190 lines
3.9 KiB
C
Raw Normal View History

2015-05-27 12:08:46 +00:00
// Copyright (c) 2012-2015, The CryptoNote developers, The Bytecoin developers
2014-08-13 10:38:35 +00:00
//
// 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/>.
2014-04-02 16:00:17 +00:00
#pragma once
#include "cryptonote_protocol/cryptonote_protocol_defs.h"
#include "cryptonote_core/cryptonote_basic.h"
#include "crypto/hash.h"
#include "wallet_rpc_server_error_codes.h"
2015-07-15 12:23:00 +00:00
2014-04-02 16:00:17 +00:00
namespace tools
{
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"
2015-07-15 12:23:00 +00:00
struct EMPTY_STRUCT {
void serialize(ISerializer& s) {}
};
2014-04-02 16:00:17 +00:00
struct COMMAND_RPC_GET_BALANCE
{
2015-07-15 12:23:00 +00:00
typedef 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
};
};
struct trnsfer_destination
{
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
{
std::list<trnsfer_destination> destinations;
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-07-15 12:23:00 +00:00
typedef EMPTY_STRUCT request;
typedef 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-07-15 12:23:00 +00:00
typedef 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-07-15 12:23:00 +00:00
typedef 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-07-15 12:23:00 +00:00
typedef EMPTY_STRUCT request;
typedef EMPTY_STRUCT response;
};
2014-04-02 16:00:17 +00:00
}
}