Skip to content

Commit

Permalink
generated
Browse files Browse the repository at this point in the history
  • Loading branch information
madMAx43v3r committed Jun 28, 2024
1 parent bc52c8c commit 811259f
Show file tree
Hide file tree
Showing 14 changed files with 522 additions and 29 deletions.
9 changes: 5 additions & 4 deletions generated/include/mmx/WalletAsyncClient.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <mmx/Contract.hxx>
#include <mmx/Solution.hxx>
#include <mmx/Transaction.hxx>
#include <mmx/account_info_t.hxx>
#include <mmx/account_t.hxx>
#include <mmx/addr_t.hpp>
#include <mmx/balance_t.hxx>
Expand Down Expand Up @@ -194,11 +195,11 @@ public:
const std::function<void(const vnx::exception&)>& _error_callback = std::function<void(const vnx::exception&)>());

uint64_t get_account(const uint32_t& index = 0,
const std::function<void(const ::mmx::account_t&)>& _callback = std::function<void(const ::mmx::account_t&)>(),
const std::function<void(const ::mmx::account_info_t&)>& _callback = std::function<void(const ::mmx::account_info_t&)>(),
const std::function<void(const vnx::exception&)>& _error_callback = std::function<void(const vnx::exception&)>());

uint64_t get_all_accounts(
const std::function<void(const std::map<uint32_t, ::mmx::account_t>&)>& _callback = std::function<void(const std::map<uint32_t, ::mmx::account_t>&)>(),
const std::function<void(const std::vector<::mmx::account_info_t>&)>& _callback = std::function<void(const std::vector<::mmx::account_info_t>&)>(),
const std::function<void(const vnx::exception&)>& _error_callback = std::function<void(const vnx::exception&)>());

uint64_t is_locked(const uint32_t& index = 0,
Expand Down Expand Up @@ -346,8 +347,8 @@ private:
std::unordered_map<uint64_t, std::pair<std::function<void(const std::map<::mmx::addr_t, std::array<std::pair<::mmx::addr_t, ::mmx::uint128>, 2>>&)>, std::function<void(const vnx::exception&)>>> vnx_queue_get_swap_liquidity;
std::unordered_map<uint64_t, std::pair<std::function<void(const ::mmx::addr_t&)>, std::function<void(const vnx::exception&)>>> vnx_queue_get_address;
std::unordered_map<uint64_t, std::pair<std::function<void(const std::vector<::mmx::addr_t>&)>, std::function<void(const vnx::exception&)>>> vnx_queue_get_all_addresses;
std::unordered_map<uint64_t, std::pair<std::function<void(const ::mmx::account_t&)>, std::function<void(const vnx::exception&)>>> vnx_queue_get_account;
std::unordered_map<uint64_t, std::pair<std::function<void(const std::map<uint32_t, ::mmx::account_t>&)>, std::function<void(const vnx::exception&)>>> vnx_queue_get_all_accounts;
std::unordered_map<uint64_t, std::pair<std::function<void(const ::mmx::account_info_t&)>, std::function<void(const vnx::exception&)>>> vnx_queue_get_account;
std::unordered_map<uint64_t, std::pair<std::function<void(const std::vector<::mmx::account_info_t>&)>, std::function<void(const vnx::exception&)>>> vnx_queue_get_all_accounts;
std::unordered_map<uint64_t, std::pair<std::function<void(const vnx::bool_t&)>, std::function<void(const vnx::exception&)>>> vnx_queue_is_locked;
std::unordered_map<uint64_t, std::pair<std::function<void()>, std::function<void(const vnx::exception&)>>> vnx_queue_lock;
std::unordered_map<uint64_t, std::pair<std::function<void()>, std::function<void(const vnx::exception&)>>> vnx_queue_unlock;
Expand Down
5 changes: 3 additions & 2 deletions generated/include/mmx/WalletBase.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <mmx/Contract.hxx>
#include <mmx/Solution.hxx>
#include <mmx/Transaction.hxx>
#include <mmx/account_info_t.hxx>
#include <mmx/account_t.hxx>
#include <mmx/addr_t.hpp>
#include <mmx/balance_t.hxx>
Expand Down Expand Up @@ -122,8 +123,8 @@ protected:
virtual std::map<::mmx::addr_t, std::array<std::pair<::mmx::addr_t, ::mmx::uint128>, 2>> get_swap_liquidity(const uint32_t& index) const = 0;
virtual ::mmx::addr_t get_address(const uint32_t& index, const uint32_t& offset) const = 0;
virtual std::vector<::mmx::addr_t> get_all_addresses(const int32_t& index) const = 0;
virtual ::mmx::account_t get_account(const uint32_t& index) const = 0;
virtual std::map<uint32_t, ::mmx::account_t> get_all_accounts() const = 0;
virtual ::mmx::account_info_t get_account(const uint32_t& index) const = 0;
virtual std::vector<::mmx::account_info_t> get_all_accounts() const = 0;
virtual vnx::bool_t is_locked(const uint32_t& index) const = 0;
virtual void lock(const uint32_t& index) = 0;
virtual void unlock(const uint32_t& index, const std::string& passphrase) = 0;
Expand Down
5 changes: 3 additions & 2 deletions generated/include/mmx/WalletClient.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <mmx/Contract.hxx>
#include <mmx/Solution.hxx>
#include <mmx/Transaction.hxx>
#include <mmx/account_info_t.hxx>
#include <mmx/account_t.hxx>
#include <mmx/addr_t.hpp>
#include <mmx/balance_t.hxx>
Expand Down Expand Up @@ -129,9 +130,9 @@ public:

std::vector<::mmx::addr_t> get_all_addresses(const int32_t& index = 0);

::mmx::account_t get_account(const uint32_t& index = 0);
::mmx::account_info_t get_account(const uint32_t& index = 0);

std::map<uint32_t, ::mmx::account_t> get_all_accounts();
std::vector<::mmx::account_info_t> get_all_accounts();

vnx::bool_t is_locked(const uint32_t& index = 0);

Expand Down
4 changes: 2 additions & 2 deletions generated/include/mmx/Wallet_get_account_return.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define INCLUDE_mmx_Wallet_get_account_return_HXX_

#include <mmx/package.hxx>
#include <mmx/account_t.hxx>
#include <mmx/account_info_t.hxx>
#include <vnx/Value.h>


Expand All @@ -14,7 +14,7 @@ namespace mmx {
class MMX_EXPORT Wallet_get_account_return : public ::vnx::Value {
public:

::mmx::account_t _ret_0;
::mmx::account_info_t _ret_0;

typedef ::vnx::Value Super;

Expand Down
4 changes: 2 additions & 2 deletions generated/include/mmx/Wallet_get_all_accounts_return.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define INCLUDE_mmx_Wallet_get_all_accounts_return_HXX_

#include <mmx/package.hxx>
#include <mmx/account_t.hxx>
#include <mmx/account_info_t.hxx>
#include <vnx/Value.h>


Expand All @@ -14,7 +14,7 @@ namespace mmx {
class MMX_EXPORT Wallet_get_all_accounts_return : public ::vnx::Value {
public:

std::map<uint32_t, ::mmx::account_t> _ret_0;
std::vector<::mmx::account_info_t> _ret_0;

typedef ::vnx::Value Super;

Expand Down
89 changes: 89 additions & 0 deletions generated/include/mmx/account_info_t.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@

// AUTO GENERATED by vnxcppcodegen

#ifndef INCLUDE_mmx_account_info_t_HXX_
#define INCLUDE_mmx_account_info_t_HXX_

#include <mmx/package.hxx>
#include <mmx/account_t.hxx>
#include <mmx/addr_t.hpp>


namespace mmx {

struct MMX_EXPORT account_info_t : ::mmx::account_t {


vnx::optional<::mmx::addr_t> address;
uint32_t account = 0;

typedef ::mmx::account_t Super;

static const vnx::Hash64 VNX_TYPE_HASH;
static const vnx::Hash64 VNX_CODE_HASH;

static constexpr uint64_t VNX_TYPE_ID = 0x5858a2f32468feaeull;

account_info_t() {}

vnx::Hash64 get_type_hash() const;
std::string get_type_name() const;
const vnx::TypeCode* get_type_code() const;

static ::mmx::account_info_t make(const uint32_t& account = 0, const vnx::optional<::mmx::addr_t>& address = nullptr, const ::mmx::account_t& config = ::mmx::account_t());

static std::shared_ptr<account_info_t> create();
std::shared_ptr<account_info_t> clone() const;

void read(vnx::TypeInput& _in, const vnx::TypeCode* _type_code, const uint16_t* _code);
void write(vnx::TypeOutput& _out, const vnx::TypeCode* _type_code, const uint16_t* _code) const;

void read(std::istream& _in);
void write(std::ostream& _out) const;

template<typename T>
void accept_generic(T& _visitor) const;
void accept(vnx::Visitor& _visitor) const;

vnx::Object to_object() const;
void from_object(const vnx::Object& object);

vnx::Variant get_field(const std::string& name) const;
void set_field(const std::string& name, const vnx::Variant& value);

friend std::ostream& operator<<(std::ostream& _out, const account_info_t& _value);
friend std::istream& operator>>(std::istream& _in, account_info_t& _value);

static const vnx::TypeCode* static_get_type_code();
static std::shared_ptr<vnx::TypeCode> static_create_type_code();

};

template<typename T>
void account_info_t::accept_generic(T& _visitor) const {
_visitor.template type_begin<account_info_t>(8);
_visitor.type_field("index", 0); _visitor.accept(index);
_visitor.type_field("num_addresses", 1); _visitor.accept(num_addresses);
_visitor.type_field("name", 2); _visitor.accept(name);
_visitor.type_field("key_file", 3); _visitor.accept(key_file);
_visitor.type_field("finger_print", 4); _visitor.accept(finger_print);
_visitor.type_field("with_passphrase", 5); _visitor.accept(with_passphrase);
_visitor.type_field("address", 6); _visitor.accept(address);
_visitor.type_field("account", 7); _visitor.accept(account);
_visitor.template type_end<account_info_t>(8);
}


} // namespace mmx


namespace vnx {

template<>
struct is_equivalent<::mmx::account_info_t> {
bool operator()(const uint16_t* code, const TypeCode* type_code);
};

} // vnx

#endif // INCLUDE_mmx_account_info_t_HXX_
30 changes: 30 additions & 0 deletions generated/include/mmx/package.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ class WalletFile;
class WebAPIBase;
class WebAPI_shutdown;
class WebAPI_shutdown_return;
struct account_info_t;
struct account_t;
class addr_t;
struct balance_t;
Expand Down Expand Up @@ -733,6 +734,7 @@ MMX_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_WalletFile; //
MMX_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_WebAPIBase; ///< \private
MMX_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_WebAPI_shutdown; ///< \private
MMX_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_WebAPI_shutdown_return; ///< \private
MMX_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_account_info_t; ///< \private
MMX_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_account_t; ///< \private
MMX_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_balance_t; ///< \private
MMX_EXPORT extern const vnx::TypeCode* const vnx_native_type_code_block_index_t; ///< \private
Expand Down Expand Up @@ -1107,6 +1109,7 @@ void read(TypeInput& in, ::mmx::WalletFile& value, const TypeCode* type_code, co
void read(TypeInput& in, ::mmx::WebAPIBase& value, const TypeCode* type_code, const uint16_t* code); ///< \private
void read(TypeInput& in, ::mmx::WebAPI_shutdown& value, const TypeCode* type_code, const uint16_t* code); ///< \private
void read(TypeInput& in, ::mmx::WebAPI_shutdown_return& value, const TypeCode* type_code, const uint16_t* code); ///< \private
void read(TypeInput& in, ::mmx::account_info_t& value, const TypeCode* type_code, const uint16_t* code); ///< \private
void read(TypeInput& in, ::mmx::account_t& value, const TypeCode* type_code, const uint16_t* code); ///< \private
void read(TypeInput& in, ::mmx::addr_t& value, const TypeCode* type_code, const uint16_t* code); ///< \private
void read(TypeInput& in, ::mmx::balance_t& value, const TypeCode* type_code, const uint16_t* code); ///< \private
Expand Down Expand Up @@ -1484,6 +1487,7 @@ void write(TypeOutput& out, const ::mmx::WalletFile& value, const TypeCode* type
void write(TypeOutput& out, const ::mmx::WebAPIBase& value, const TypeCode* type_code, const uint16_t* code); ///< \private
void write(TypeOutput& out, const ::mmx::WebAPI_shutdown& value, const TypeCode* type_code, const uint16_t* code); ///< \private
void write(TypeOutput& out, const ::mmx::WebAPI_shutdown_return& value, const TypeCode* type_code, const uint16_t* code); ///< \private
void write(TypeOutput& out, const ::mmx::account_info_t& value, const TypeCode* type_code, const uint16_t* code); ///< \private
void write(TypeOutput& out, const ::mmx::account_t& value, const TypeCode* type_code, const uint16_t* code); ///< \private
void write(TypeOutput& out, const ::mmx::addr_t& value, const TypeCode* type_code, const uint16_t* code); ///< \private
void write(TypeOutput& out, const ::mmx::balance_t& value, const TypeCode* type_code, const uint16_t* code); ///< \private
Expand Down Expand Up @@ -1861,6 +1865,7 @@ void read(std::istream& in, ::mmx::WalletFile& value); ///< \private
void read(std::istream& in, ::mmx::WebAPIBase& value); ///< \private
void read(std::istream& in, ::mmx::WebAPI_shutdown& value); ///< \private
void read(std::istream& in, ::mmx::WebAPI_shutdown_return& value); ///< \private
void read(std::istream& in, ::mmx::account_info_t& value); ///< \private
void read(std::istream& in, ::mmx::account_t& value); ///< \private
void read(std::istream& in, ::mmx::addr_t& value); ///< \private
void read(std::istream& in, ::mmx::balance_t& value); ///< \private
Expand Down Expand Up @@ -2238,6 +2243,7 @@ void write(std::ostream& out, const ::mmx::WalletFile& value); ///< \private
void write(std::ostream& out, const ::mmx::WebAPIBase& value); ///< \private
void write(std::ostream& out, const ::mmx::WebAPI_shutdown& value); ///< \private
void write(std::ostream& out, const ::mmx::WebAPI_shutdown_return& value); ///< \private
void write(std::ostream& out, const ::mmx::account_info_t& value); ///< \private
void write(std::ostream& out, const ::mmx::account_t& value); ///< \private
void write(std::ostream& out, const ::mmx::addr_t& value); ///< \private
void write(std::ostream& out, const ::mmx::balance_t& value); ///< \private
Expand Down Expand Up @@ -2615,6 +2621,7 @@ void accept(Visitor& visitor, const ::mmx::WalletFile& value); ///< \private
void accept(Visitor& visitor, const ::mmx::WebAPIBase& value); ///< \private
void accept(Visitor& visitor, const ::mmx::WebAPI_shutdown& value); ///< \private
void accept(Visitor& visitor, const ::mmx::WebAPI_shutdown_return& value); ///< \private
void accept(Visitor& visitor, const ::mmx::account_info_t& value); ///< \private
void accept(Visitor& visitor, const ::mmx::account_t& value); ///< \private
void accept(Visitor& visitor, const ::mmx::addr_t& value); ///< \private
void accept(Visitor& visitor, const ::mmx::balance_t& value); ///< \private
Expand Down Expand Up @@ -10275,6 +10282,29 @@ struct type<::mmx::WebAPI_shutdown_return> {
void create_dynamic_code(std::vector<uint16_t>& code, const ::mmx::WebAPI_shutdown_return& value, bool special = false);
};

/// \private
template<>
struct type<::mmx::account_info_t> {
void read(TypeInput& in, ::mmx::account_info_t& value, const TypeCode* type_code, const uint16_t* code) {
vnx::read(in, value, type_code, code);
}
void write(TypeOutput& out, const ::mmx::account_info_t& value, const TypeCode* type_code, const uint16_t* code) {
vnx::write(out, value, type_code, code);
}
void read(std::istream& in, ::mmx::account_info_t& value) {
vnx::read(in, value);
}
void write(std::ostream& out, const ::mmx::account_info_t& value) {
vnx::write(out, value);
}
void accept(Visitor& visitor, const ::mmx::account_info_t& value) {
vnx::accept(visitor, value);
}
const TypeCode* get_type_code();
void create_dynamic_code(std::vector<uint16_t>& code);
void create_dynamic_code(std::vector<uint16_t>& code, const ::mmx::account_info_t& value, bool special = false);
};

/// \private
template<>
struct type<::mmx::account_t> {
Expand Down
9 changes: 5 additions & 4 deletions generated/src/WalletAsyncClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
#include <mmx/Wallet_unlock_return.hxx>
#include <mmx/Wallet_update_cache.hxx>
#include <mmx/Wallet_update_cache_return.hxx>
#include <mmx/account_info_t.hxx>
#include <mmx/account_t.hxx>
#include <mmx/addr_t.hpp>
#include <mmx/balance_t.hxx>
Expand Down Expand Up @@ -765,7 +766,7 @@ uint64_t WalletAsyncClient::get_all_addresses(const int32_t& index, const std::f
return _request_id;
}

uint64_t WalletAsyncClient::get_account(const uint32_t& index, const std::function<void(const ::mmx::account_t&)>& _callback, const std::function<void(const vnx::exception&)>& _error_callback) {
uint64_t WalletAsyncClient::get_account(const uint32_t& index, const std::function<void(const ::mmx::account_info_t&)>& _callback, const std::function<void(const vnx::exception&)>& _error_callback) {
auto _method = ::mmx::Wallet_get_account::create();
_method->index = index;
const auto _request_id = ++vnx_next_id;
Expand All @@ -778,7 +779,7 @@ uint64_t WalletAsyncClient::get_account(const uint32_t& index, const std::functi
return _request_id;
}

uint64_t WalletAsyncClient::get_all_accounts(const std::function<void(const std::map<uint32_t, ::mmx::account_t>&)>& _callback, const std::function<void(const vnx::exception&)>& _error_callback) {
uint64_t WalletAsyncClient::get_all_accounts(const std::function<void(const std::vector<::mmx::account_info_t>&)>& _callback, const std::function<void(const vnx::exception&)>& _error_callback) {
auto _method = ::mmx::Wallet_get_all_accounts::create();
const auto _request_id = ++vnx_next_id;
{
Expand Down Expand Up @@ -2643,7 +2644,7 @@ int32_t WalletAsyncClient::vnx_callback_switch(uint64_t _request_id, std::shared
if(auto _result = std::dynamic_pointer_cast<const ::mmx::Wallet_get_account_return>(_value)) {
_callback(_result->_ret_0);
} else if(_value && !_value->is_void()) {
_callback(_value->get_field_by_index(0).to<::mmx::account_t>());
_callback(_value->get_field_by_index(0).to<::mmx::account_info_t>());
} else {
throw std::logic_error("WalletAsyncClient: invalid return value");
}
Expand All @@ -2662,7 +2663,7 @@ int32_t WalletAsyncClient::vnx_callback_switch(uint64_t _request_id, std::shared
if(auto _result = std::dynamic_pointer_cast<const ::mmx::Wallet_get_all_accounts_return>(_value)) {
_callback(_result->_ret_0);
} else if(_value && !_value->is_void()) {
_callback(_value->get_field_by_index(0).to<std::map<uint32_t, ::mmx::account_t>>());
_callback(_value->get_field_by_index(0).to<std::vector<::mmx::account_info_t>>());
} else {
throw std::logic_error("WalletAsyncClient: invalid return value");
}
Expand Down
1 change: 1 addition & 0 deletions generated/src/WalletBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
#include <mmx/Wallet_unlock_return.hxx>
#include <mmx/Wallet_update_cache.hxx>
#include <mmx/Wallet_update_cache_return.hxx>
#include <mmx/account_info_t.hxx>
#include <mmx/account_t.hxx>
#include <mmx/addr_t.hpp>
#include <mmx/balance_t.hxx>
Expand Down
9 changes: 5 additions & 4 deletions generated/src/WalletClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
#include <mmx/Wallet_unlock_return.hxx>
#include <mmx/Wallet_update_cache.hxx>
#include <mmx/Wallet_update_cache_return.hxx>
#include <mmx/account_info_t.hxx>
#include <mmx/account_t.hxx>
#include <mmx/addr_t.hpp>
#include <mmx/balance_t.hxx>
Expand Down Expand Up @@ -761,26 +762,26 @@ std::vector<::mmx::addr_t> WalletClient::get_all_addresses(const int32_t& index)
}
}

::mmx::account_t WalletClient::get_account(const uint32_t& index) {
::mmx::account_info_t WalletClient::get_account(const uint32_t& index) {
auto _method = ::mmx::Wallet_get_account::create();
_method->index = index;
auto _return_value = vnx_request(_method, false);
if(auto _result = std::dynamic_pointer_cast<const ::mmx::Wallet_get_account_return>(_return_value)) {
return _result->_ret_0;
} else if(_return_value && !_return_value->is_void()) {
return _return_value->get_field_by_index(0).to<::mmx::account_t>();
return _return_value->get_field_by_index(0).to<::mmx::account_info_t>();
} else {
throw std::logic_error("WalletClient: invalid return value");
}
}

std::map<uint32_t, ::mmx::account_t> WalletClient::get_all_accounts() {
std::vector<::mmx::account_info_t> WalletClient::get_all_accounts() {
auto _method = ::mmx::Wallet_get_all_accounts::create();
auto _return_value = vnx_request(_method, false);
if(auto _result = std::dynamic_pointer_cast<const ::mmx::Wallet_get_all_accounts_return>(_return_value)) {
return _result->_ret_0;
} else if(_return_value && !_return_value->is_void()) {
return _return_value->get_field_by_index(0).to<std::map<uint32_t, ::mmx::account_t>>();
return _return_value->get_field_by_index(0).to<std::vector<::mmx::account_info_t>>();
} else {
throw std::logic_error("WalletClient: invalid return value");
}
Expand Down
Loading

0 comments on commit 811259f

Please sign in to comment.