aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet_rpc_server_commands_defs.h
diff options
context:
space:
mode:
authorkenshi84 <kenshi84@protonmail.ch>2017-02-19 11:42:10 +0900
committerkenshi84 <kenshi84@protonmail.ch>2017-10-07 13:06:21 +0900
commit53ad5a0f42174bca57e24485ef3d40e4b9cf5599 (patch)
treeafc13a3ee6a049ec78ac234e2d55ff46e992b457 /src/wallet/wallet_rpc_server_commands_defs.h
parentMerge pull request #2548 (diff)
downloadmonero-53ad5a0f42174bca57e24485ef3d40e4b9cf5599.tar.xz
Subaddresses
Diffstat (limited to 'src/wallet/wallet_rpc_server_commands_defs.h')
-rw-r--r--src/wallet/wallet_rpc_server_commands_defs.h196
1 files changed, 196 insertions, 0 deletions
diff --git a/src/wallet/wallet_rpc_server_commands_defs.h b/src/wallet/wallet_rpc_server_commands_defs.h
index fa5c154de..f652fa7ff 100644
--- a/src/wallet/wallet_rpc_server_commands_defs.h
+++ b/src/wallet/wallet_rpc_server_commands_defs.h
@@ -31,6 +31,7 @@
#pragma once
#include "cryptonote_protocol/cryptonote_protocol_defs.h"
#include "cryptonote_basic/cryptonote_basic.h"
+#include "cryptonote_basic/subaddress_index.h"
#include "crypto/hash.h"
#include "wallet_rpc_server_error_codes.h"
@@ -48,7 +49,28 @@ namespace wallet_rpc
{
struct request
{
+ uint32_t account_index;
BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(account_index)
+ END_KV_SERIALIZE_MAP()
+ };
+
+ struct per_subaddress_info
+ {
+ uint32_t address_index;
+ std::string address;
+ uint64_t balance;
+ uint64_t unlocked_balance;
+ std::string label;
+ uint64_t num_unspent_outputs;
+
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(address_index)
+ KV_SERIALIZE(address)
+ KV_SERIALIZE(balance)
+ KV_SERIALIZE(unlocked_balance)
+ KV_SERIALIZE(label)
+ KV_SERIALIZE(num_unspent_outputs)
END_KV_SERIALIZE_MAP()
};
@@ -56,10 +78,12 @@ namespace wallet_rpc
{
uint64_t balance;
uint64_t unlocked_balance;
+ std::vector<per_subaddress_info> per_subaddress;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(balance)
KV_SERIALIZE(unlocked_balance)
+ KV_SERIALIZE(per_subaddress)
END_KV_SERIALIZE_MAP()
};
};
@@ -68,20 +92,164 @@ namespace wallet_rpc
{
struct request
{
+ uint32_t account_index;
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(account_index)
+ END_KV_SERIALIZE_MAP()
+ };
+
+ struct address_info
+ {
+ std::string address;
+ std::string label;
+ uint32_t address_index;
+ bool used;
+
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(address)
+ KV_SERIALIZE(label)
+ KV_SERIALIZE(address_index)
+ KV_SERIALIZE(used)
+ END_KV_SERIALIZE_MAP()
+ };
+
+ struct response
+ {
+ std::string address; // to remain compatible with older RPC format
+ std::vector<address_info> addresses;
+
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(address)
+ KV_SERIALIZE(addresses)
+ END_KV_SERIALIZE_MAP()
+ };
+ };
+
+ struct COMMAND_RPC_CREATE_ADDRESS
+ {
+ struct request
+ {
+ uint32_t account_index;
+ std::string label;
+
BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(account_index)
+ KV_SERIALIZE(label)
END_KV_SERIALIZE_MAP()
};
struct response
{
std::string address;
+ uint32_t address_index;
+
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(address)
+ KV_SERIALIZE(address_index)
+ END_KV_SERIALIZE_MAP()
+ };
+ };
+
+ struct COMMAND_RPC_LABEL_ADDRESS
+ {
+ struct request
+ {
+ cryptonote::subaddress_index index;
+ std::string label;
+
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(index)
+ KV_SERIALIZE(label)
+ END_KV_SERIALIZE_MAP()
+ };
+
+ struct response
+ {
+ BEGIN_KV_SERIALIZE_MAP()
+ END_KV_SERIALIZE_MAP()
+ };
+ };
+
+ struct COMMAND_RPC_GET_ACCOUNTS
+ {
+ struct request
+ {
+ BEGIN_KV_SERIALIZE_MAP()
+ END_KV_SERIALIZE_MAP()
+ };
+
+ struct subaddress_account_info
+ {
+ uint32_t account_index;
+ std::string base_address;
+ uint64_t balance;
+ uint64_t unlocked_balance;
+ std::string label;
+
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(account_index)
+ KV_SERIALIZE(base_address)
+ KV_SERIALIZE(balance)
+ KV_SERIALIZE(unlocked_balance)
+ KV_SERIALIZE(label)
+ END_KV_SERIALIZE_MAP()
+ };
+
+ struct response
+ {
+ uint64_t total_balance;
+ uint64_t total_unlocked_balance;
+ std::vector<subaddress_account_info> subaddress_accounts;
+
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(total_balance)
+ KV_SERIALIZE(total_unlocked_balance)
+ KV_SERIALIZE(subaddress_accounts)
+ END_KV_SERIALIZE_MAP()
+ };
+ };
+ struct COMMAND_RPC_CREATE_ACCOUNT
+ {
+ struct request
+ {
+ std::string label;
BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(label)
+ END_KV_SERIALIZE_MAP()
+ };
+
+ struct response
+ {
+ uint32_t account_index;
+ std::string address; // the 0-th address for convenience
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(account_index)
KV_SERIALIZE(address)
END_KV_SERIALIZE_MAP()
};
};
+ struct COMMAND_RPC_LABEL_ACCOUNT
+ {
+ struct request
+ {
+ uint32_t account_index;
+ std::string label;
+
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(account_index)
+ KV_SERIALIZE(label)
+ END_KV_SERIALIZE_MAP()
+ };
+
+ struct response
+ {
+ BEGIN_KV_SERIALIZE_MAP()
+ END_KV_SERIALIZE_MAP()
+ };
+ };
+
struct COMMAND_RPC_GET_HEIGHT
{
struct request
@@ -114,6 +282,8 @@ namespace wallet_rpc
struct request
{
std::list<transfer_destination> destinations;
+ uint32_t account_index;
+ std::set<uint32_t> subaddr_indices;
uint32_t priority;
uint64_t mixin;
uint64_t unlock_time;
@@ -124,6 +294,8 @@ namespace wallet_rpc
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(destinations)
+ KV_SERIALIZE(account_index)
+ KV_SERIALIZE(subaddr_indices)
KV_SERIALIZE(priority)
KV_SERIALIZE(mixin)
KV_SERIALIZE(unlock_time)
@@ -157,6 +329,8 @@ namespace wallet_rpc
struct request
{
std::list<transfer_destination> destinations;
+ uint32_t account_index;
+ std::set<uint32_t> subaddr_indices;
uint32_t priority;
uint64_t mixin;
uint64_t unlock_time;
@@ -167,6 +341,8 @@ namespace wallet_rpc
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(destinations)
+ KV_SERIALIZE(account_index)
+ KV_SERIALIZE(subaddr_indices)
KV_SERIALIZE(priority)
KV_SERIALIZE(mixin)
KV_SERIALIZE(unlock_time)
@@ -249,6 +425,8 @@ namespace wallet_rpc
struct request
{
std::string address;
+ uint32_t account_index;
+ std::set<uint32_t> subaddr_indices;
uint32_t priority;
uint64_t mixin;
uint64_t unlock_time;
@@ -260,6 +438,8 @@ namespace wallet_rpc
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(address)
+ KV_SERIALIZE(account_index)
+ KV_SERIALIZE(subaddr_indices)
KV_SERIALIZE(priority)
KV_SERIALIZE(mixin)
KV_SERIALIZE(unlock_time)
@@ -318,6 +498,7 @@ namespace wallet_rpc
uint64_t amount;
uint64_t block_height;
uint64_t unlock_time;
+ cryptonote::subaddress_index subaddr_index;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(payment_id)
@@ -325,6 +506,7 @@ namespace wallet_rpc
KV_SERIALIZE(amount)
KV_SERIALIZE(block_height)
KV_SERIALIZE(unlock_time)
+ KV_SERIALIZE(subaddr_index)
END_KV_SERIALIZE_MAP()
};
@@ -379,6 +561,7 @@ namespace wallet_rpc
uint64_t global_index;
std::string tx_hash;
uint64_t tx_size;
+ uint32_t subaddr_index;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(amount)
@@ -386,6 +569,7 @@ namespace wallet_rpc
KV_SERIALIZE(global_index)
KV_SERIALIZE(tx_hash)
KV_SERIALIZE(tx_size)
+ KV_SERIALIZE(subaddr_index)
END_KV_SERIALIZE_MAP()
};
@@ -394,9 +578,13 @@ namespace wallet_rpc
struct request
{
std::string transfer_type;
+ uint32_t account_index;
+ std::set<uint32_t> subaddr_indices;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(transfer_type)
+ KV_SERIALIZE(account_index)
+ KV_SERIALIZE(subaddr_indices)
END_KV_SERIALIZE_MAP()
};
@@ -470,10 +658,12 @@ namespace wallet_rpc
{
std::string standard_address;
std::string payment_id;
+ bool is_subaddress;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(standard_address)
KV_SERIALIZE(payment_id)
+ KV_SERIALIZE(is_subaddress)
END_KV_SERIALIZE_MAP()
};
};
@@ -561,6 +751,7 @@ namespace wallet_rpc
std::list<transfer_destination> destinations;
std::string type;
uint64_t unlock_time;
+ cryptonote::subaddress_index subaddr_index;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(txid);
@@ -573,6 +764,7 @@ namespace wallet_rpc
KV_SERIALIZE(destinations);
KV_SERIALIZE(type);
KV_SERIALIZE(unlock_time)
+ KV_SERIALIZE(subaddr_index);
END_KV_SERIALIZE_MAP()
};
@@ -589,6 +781,8 @@ namespace wallet_rpc
bool filter_by_height;
uint64_t min_height;
uint64_t max_height;
+ uint32_t account_index;
+ std::set<uint32_t> subaddr_indices;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(in);
@@ -599,6 +793,8 @@ namespace wallet_rpc
KV_SERIALIZE(filter_by_height);
KV_SERIALIZE(min_height);
KV_SERIALIZE(max_height);
+ KV_SERIALIZE(account_index);
+ KV_SERIALIZE(subaddr_indices);
END_KV_SERIALIZE_MAP()
};