Skip to content

Commit

Permalink
supernet api proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptozoidberg committed Oct 19, 2014
1 parent c11f69d commit 14eba55
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/wallet/wallet_rpc_server.cpp
Expand Up @@ -187,6 +187,21 @@ namespace tools
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
bool wallet_rpc_server::on_maketelepod(const wallet_rpc::COMMAND_RPC_MAKETELEPOD::request& req, wallet_rpc::COMMAND_RPC_MAKETELEPOD::response& res, epee::json_rpc::error& er, connection_context& cntx)
{
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
bool wallet_rpc_server::on_clonetelepod(const wallet_rpc::COMMAND_RPC_CLONETELEPOD::request& req, wallet_rpc::COMMAND_RPC_CLONETELEPOD::response& res, epee::json_rpc::error& er, connection_context& cntx)
{
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
bool wallet_rpc_server::on_telepodstatus(const wallet_rpc::COMMAND_RPC_TELEPODSTATUS::request& req, wallet_rpc::COMMAND_RPC_TELEPODSTATUS::response& res, epee::json_rpc::error& er, connection_context& cntx)
{
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
}


Expand Down
7 changes: 7 additions & 0 deletions src/wallet/wallet_rpc_server.h
Expand Up @@ -40,6 +40,10 @@ namespace tools
MAP_JON_RPC_WE("transfer", on_transfer, wallet_rpc::COMMAND_RPC_TRANSFER)
MAP_JON_RPC_WE("store", on_store, wallet_rpc::COMMAND_RPC_STORE)
MAP_JON_RPC_WE("get_payments", on_get_payments, wallet_rpc::COMMAND_RPC_GET_PAYMENTS)
// supernet api
MAP_JON_RPC_WE("maketelepod", on_maketelepod, wallet_rpc::COMMAND_RPC_MAKETELEPOD)
MAP_JON_RPC_WE("clonetelepod", on_clonetelepod, wallet_rpc::COMMAND_RPC_CLONETELEPOD)
MAP_JON_RPC_WE("telepodstatus", on_telepodstatus, wallet_rpc::COMMAND_RPC_TELEPODSTATUS)
END_JSON_RPC_MAP()
END_URI_MAP2()

Expand All @@ -49,6 +53,9 @@ namespace tools
bool on_transfer(const wallet_rpc::COMMAND_RPC_TRANSFER::request& req, wallet_rpc::COMMAND_RPC_TRANSFER::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_store(const wallet_rpc::COMMAND_RPC_STORE::request& req, wallet_rpc::COMMAND_RPC_STORE::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_get_payments(const wallet_rpc::COMMAND_RPC_GET_PAYMENTS::request& req, wallet_rpc::COMMAND_RPC_GET_PAYMENTS::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_maketelepod(const wallet_rpc::COMMAND_RPC_MAKETELEPOD::request& req, wallet_rpc::COMMAND_RPC_MAKETELEPOD::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_clonetelepod(const wallet_rpc::COMMAND_RPC_CLONETELEPOD::request& req, wallet_rpc::COMMAND_RPC_CLONETELEPOD::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_telepodstatus(const wallet_rpc::COMMAND_RPC_TELEPODSTATUS::request& req, wallet_rpc::COMMAND_RPC_TELEPODSTATUS::response& res, epee::json_rpc::error& er, connection_context& cntx);

bool handle_command_line(const boost::program_options::variables_map& vm);

Expand Down
82 changes: 82 additions & 0 deletions src/wallet/wallet_rpc_server_commans_defs.h
Expand Up @@ -190,6 +190,88 @@ namespace wallet_rpc
};
};


struct telepod
{
std::string transaction_template_hex;
std::string account_keys_hex;
std::string basement_tx_id_hex;
std::list<uint64_t> tx_outs_offsets;

BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(transaction_template_hex)
KV_SERIALIZE(account_keys_hex)
KV_SERIALIZE(basement_tx_id_hex)
KV_SERIALIZE(tx_outs_offsets)
END_KV_SERIALIZE_MAP()
};

struct COMMAND_RPC_MAKETELEPOD
{
struct request
{
uint64_t amount;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(amount)
END_KV_SERIALIZE_MAP()
};

struct response
{
std::string status;
telepod tpd;

BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(status)
KV_SERIALIZE(tpd)
END_KV_SERIALIZE_MAP()
};
};


struct COMMAND_RPC_TELEPODSTATUS
{
struct request
{
telepod tpd;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(tpd)
END_KV_SERIALIZE_MAP()
};

struct response
{
std::string status; //"OK", "UNCONFIRMED", "BAD", "SPENT"

BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(status)
END_KV_SERIALIZE_MAP()
};
};

struct COMMAND_RPC_CLONETELEPOD
{
struct request
{
telepod tpd;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(tpd)
END_KV_SERIALIZE_MAP()
};

struct response
{
std::string status;
telepod tpd;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(status)
KV_SERIALIZE(tpd)
END_KV_SERIALIZE_MAP()
};
};



}
}

0 comments on commit 14eba55

Please sign in to comment.