diff --git a/generated/include/mmx/WalletAsyncClient.hxx b/generated/include/mmx/WalletAsyncClient.hxx index d1ee5bb5b..675b0943b 100644 --- a/generated/include/mmx/WalletAsyncClient.hxx +++ b/generated/include/mmx/WalletAsyncClient.hxx @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -194,11 +195,11 @@ public: const std::function& _error_callback = std::function()); uint64_t get_account(const uint32_t& index = 0, - const std::function& _callback = std::function(), + const std::function& _callback = std::function(), const std::function& _error_callback = std::function()); uint64_t get_all_accounts( - const std::function&)>& _callback = std::function&)>(), + const std::function&)>& _callback = std::function&)>(), const std::function& _error_callback = std::function()); uint64_t is_locked(const uint32_t& index = 0, @@ -346,8 +347,8 @@ private: std::unordered_map, 2>>&)>, std::function>> vnx_queue_get_swap_liquidity; std::unordered_map, std::function>> vnx_queue_get_address; std::unordered_map&)>, std::function>> vnx_queue_get_all_addresses; - std::unordered_map, std::function>> vnx_queue_get_account; - std::unordered_map&)>, std::function>> vnx_queue_get_all_accounts; + std::unordered_map, std::function>> vnx_queue_get_account; + std::unordered_map&)>, std::function>> vnx_queue_get_all_accounts; std::unordered_map, std::function>> vnx_queue_is_locked; std::unordered_map, std::function>> vnx_queue_lock; std::unordered_map, std::function>> vnx_queue_unlock; diff --git a/generated/include/mmx/WalletBase.hxx b/generated/include/mmx/WalletBase.hxx index 5e1355fa6..f59502e93 100644 --- a/generated/include/mmx/WalletBase.hxx +++ b/generated/include/mmx/WalletBase.hxx @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -122,8 +123,8 @@ protected: virtual std::map<::mmx::addr_t, std::array, 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 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; diff --git a/generated/include/mmx/WalletClient.hxx b/generated/include/mmx/WalletClient.hxx index 249d3386e..e10e1e4d0 100644 --- a/generated/include/mmx/WalletClient.hxx +++ b/generated/include/mmx/WalletClient.hxx @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -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 get_all_accounts(); + std::vector<::mmx::account_info_t> get_all_accounts(); vnx::bool_t is_locked(const uint32_t& index = 0); diff --git a/generated/include/mmx/Wallet_get_account_return.hxx b/generated/include/mmx/Wallet_get_account_return.hxx index fd166f421..527a0d958 100644 --- a/generated/include/mmx/Wallet_get_account_return.hxx +++ b/generated/include/mmx/Wallet_get_account_return.hxx @@ -5,7 +5,7 @@ #define INCLUDE_mmx_Wallet_get_account_return_HXX_ #include -#include +#include #include @@ -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; diff --git a/generated/include/mmx/Wallet_get_all_accounts_return.hxx b/generated/include/mmx/Wallet_get_all_accounts_return.hxx index 9c3e2914a..6daf46034 100644 --- a/generated/include/mmx/Wallet_get_all_accounts_return.hxx +++ b/generated/include/mmx/Wallet_get_all_accounts_return.hxx @@ -5,7 +5,7 @@ #define INCLUDE_mmx_Wallet_get_all_accounts_return_HXX_ #include -#include +#include #include @@ -14,7 +14,7 @@ namespace mmx { class MMX_EXPORT Wallet_get_all_accounts_return : public ::vnx::Value { public: - std::map _ret_0; + std::vector<::mmx::account_info_t> _ret_0; typedef ::vnx::Value Super; diff --git a/generated/include/mmx/account_info_t.hxx b/generated/include/mmx/account_info_t.hxx new file mode 100644 index 000000000..c0031f642 --- /dev/null +++ b/generated/include/mmx/account_info_t.hxx @@ -0,0 +1,89 @@ + +// AUTO GENERATED by vnxcppcodegen + +#ifndef INCLUDE_mmx_account_info_t_HXX_ +#define INCLUDE_mmx_account_info_t_HXX_ + +#include +#include +#include + + +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 create(); + std::shared_ptr 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 + 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 static_create_type_code(); + +}; + +template +void account_info_t::accept_generic(T& _visitor) const { + _visitor.template type_begin(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(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_ diff --git a/generated/include/mmx/package.hxx b/generated/include/mmx/package.hxx index 7e1f9af0e..76e62683b 100644 --- a/generated/include/mmx/package.hxx +++ b/generated/include/mmx/package.hxx @@ -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; @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -10275,6 +10282,29 @@ struct type<::mmx::WebAPI_shutdown_return> { void create_dynamic_code(std::vector& 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& code); + void create_dynamic_code(std::vector& code, const ::mmx::account_info_t& value, bool special = false); +}; + /// \private template<> struct type<::mmx::account_t> { diff --git a/generated/src/WalletAsyncClient.cpp b/generated/src/WalletAsyncClient.cpp index 385e13f88..a5270af2a 100644 --- a/generated/src/WalletAsyncClient.cpp +++ b/generated/src/WalletAsyncClient.cpp @@ -116,6 +116,7 @@ #include #include #include +#include #include #include #include @@ -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& _callback, const std::function& _error_callback) { +uint64_t WalletAsyncClient::get_account(const uint32_t& index, const std::function& _callback, const std::function& _error_callback) { auto _method = ::mmx::Wallet_get_account::create(); _method->index = index; const auto _request_id = ++vnx_next_id; @@ -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&)>& _callback, const std::function& _error_callback) { +uint64_t WalletAsyncClient::get_all_accounts(const std::function&)>& _callback, const std::function& _error_callback) { auto _method = ::mmx::Wallet_get_all_accounts::create(); const auto _request_id = ++vnx_next_id; { @@ -2643,7 +2644,7 @@ int32_t WalletAsyncClient::vnx_callback_switch(uint64_t _request_id, std::shared if(auto _result = std::dynamic_pointer_cast(_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"); } @@ -2662,7 +2663,7 @@ int32_t WalletAsyncClient::vnx_callback_switch(uint64_t _request_id, std::shared if(auto _result = std::dynamic_pointer_cast(_value)) { _callback(_result->_ret_0); } else if(_value && !_value->is_void()) { - _callback(_value->get_field_by_index(0).to>()); + _callback(_value->get_field_by_index(0).to>()); } else { throw std::logic_error("WalletAsyncClient: invalid return value"); } diff --git a/generated/src/WalletBase.cpp b/generated/src/WalletBase.cpp index 0c60e7c19..3536020d5 100644 --- a/generated/src/WalletBase.cpp +++ b/generated/src/WalletBase.cpp @@ -117,6 +117,7 @@ #include #include #include +#include #include #include #include diff --git a/generated/src/WalletClient.cpp b/generated/src/WalletClient.cpp index 8e0089648..514bfa33c 100644 --- a/generated/src/WalletClient.cpp +++ b/generated/src/WalletClient.cpp @@ -116,6 +116,7 @@ #include #include #include +#include #include #include #include @@ -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(_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 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(_return_value)) { return _result->_ret_0; } else if(_return_value && !_return_value->is_void()) { - return _return_value->get_field_by_index(0).to>(); + return _return_value->get_field_by_index(0).to>(); } else { throw std::logic_error("WalletClient: invalid return value"); } diff --git a/generated/src/Wallet_get_account_return.cpp b/generated/src/Wallet_get_account_return.cpp index cd68ba835..9afb7e7b0 100644 --- a/generated/src/Wallet_get_account_return.cpp +++ b/generated/src/Wallet_get_account_return.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include @@ -13,7 +13,7 @@ namespace mmx { const vnx::Hash64 Wallet_get_account_return::VNX_TYPE_HASH(0xaed020aa500eed2bull); -const vnx::Hash64 Wallet_get_account_return::VNX_CODE_HASH(0xaf766fada4e5c90full); +const vnx::Hash64 Wallet_get_account_return::VNX_CODE_HASH(0xc6165cd49b33d04cull); vnx::Hash64 Wallet_get_account_return::get_type_hash() const { return VNX_TYPE_HASH; @@ -114,14 +114,14 @@ std::shared_ptr Wallet_get_account_return::static_create_type_cod auto type_code = std::make_shared(); type_code->name = "mmx.Wallet.get_account.return"; type_code->type_hash = vnx::Hash64(0xaed020aa500eed2bull); - type_code->code_hash = vnx::Hash64(0xaf766fada4e5c90full); + type_code->code_hash = vnx::Hash64(0xc6165cd49b33d04cull); type_code->is_native = true; type_code->is_class = true; type_code->is_return = true; type_code->native_size = sizeof(::mmx::Wallet_get_account_return); type_code->create_value = []() -> std::shared_ptr { return std::make_shared(); }; type_code->depends.resize(1); - type_code->depends[0] = ::mmx::account_t::static_get_type_code(); + type_code->depends[0] = ::mmx::account_info_t::static_get_type_code(); type_code->fields.resize(1); { auto& field = type_code->fields[0]; diff --git a/generated/src/Wallet_get_all_accounts_return.cpp b/generated/src/Wallet_get_all_accounts_return.cpp index 1c5bbca80..26ca7db82 100644 --- a/generated/src/Wallet_get_all_accounts_return.cpp +++ b/generated/src/Wallet_get_all_accounts_return.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include @@ -13,7 +13,7 @@ namespace mmx { const vnx::Hash64 Wallet_get_all_accounts_return::VNX_TYPE_HASH(0x2bb48cc4299c5782ull); -const vnx::Hash64 Wallet_get_all_accounts_return::VNX_CODE_HASH(0xe6507c440defa28ull); +const vnx::Hash64 Wallet_get_all_accounts_return::VNX_CODE_HASH(0xdda3f5455aa46afeull); vnx::Hash64 Wallet_get_all_accounts_return::get_type_hash() const { return VNX_TYPE_HASH; @@ -114,20 +114,20 @@ std::shared_ptr Wallet_get_all_accounts_return::static_create_typ auto type_code = std::make_shared(); type_code->name = "mmx.Wallet.get_all_accounts.return"; type_code->type_hash = vnx::Hash64(0x2bb48cc4299c5782ull); - type_code->code_hash = vnx::Hash64(0xe6507c440defa28ull); + type_code->code_hash = vnx::Hash64(0xdda3f5455aa46afeull); type_code->is_native = true; type_code->is_class = true; type_code->is_return = true; type_code->native_size = sizeof(::mmx::Wallet_get_all_accounts_return); type_code->create_value = []() -> std::shared_ptr { return std::make_shared(); }; type_code->depends.resize(1); - type_code->depends[0] = ::mmx::account_t::static_get_type_code(); + type_code->depends[0] = ::mmx::account_info_t::static_get_type_code(); type_code->fields.resize(1); { auto& field = type_code->fields[0]; field.is_extended = true; field.name = "_ret_0"; - field.code = {13, 3, 3, 19, 0}; + field.code = {12, 19, 0}; } type_code->build(); return type_code; diff --git a/generated/src/account_info_t.cpp b/generated/src/account_info_t.cpp new file mode 100644 index 000000000..6983e7db7 --- /dev/null +++ b/generated/src/account_info_t.cpp @@ -0,0 +1,353 @@ + +// AUTO GENERATED by vnxcppcodegen + +#include +#include +#include +#include + +#include + + +namespace mmx { + + +const vnx::Hash64 account_info_t::VNX_TYPE_HASH(0x5858a2f32468feaeull); +const vnx::Hash64 account_info_t::VNX_CODE_HASH(0x9255e9ebe9f567c0ull); + +vnx::Hash64 account_info_t::get_type_hash() const { + return VNX_TYPE_HASH; +} + +std::string account_info_t::get_type_name() const { + return "mmx.account_info_t"; +} + +const vnx::TypeCode* account_info_t::get_type_code() const { + return mmx::vnx_native_type_code_account_info_t; +} + +std::shared_ptr account_info_t::create() { + return std::make_shared(); +} + +std::shared_ptr account_info_t::clone() const { + return std::make_shared(*this); +} + +void account_info_t::read(vnx::TypeInput& _in, const vnx::TypeCode* _type_code, const uint16_t* _code) { + vnx::read(_in, *this, _type_code, _code); +} + +void account_info_t::write(vnx::TypeOutput& _out, const vnx::TypeCode* _type_code, const uint16_t* _code) const { + vnx::write(_out, *this, _type_code, _code); +} + +void account_info_t::accept(vnx::Visitor& _visitor) const { + const vnx::TypeCode* _type_code = mmx::vnx_native_type_code_account_info_t; + _visitor.type_begin(*_type_code); + _visitor.type_field(_type_code->fields[0], 0); vnx::accept(_visitor, index); + _visitor.type_field(_type_code->fields[1], 1); vnx::accept(_visitor, num_addresses); + _visitor.type_field(_type_code->fields[2], 2); vnx::accept(_visitor, name); + _visitor.type_field(_type_code->fields[3], 3); vnx::accept(_visitor, key_file); + _visitor.type_field(_type_code->fields[4], 4); vnx::accept(_visitor, finger_print); + _visitor.type_field(_type_code->fields[5], 5); vnx::accept(_visitor, with_passphrase); + _visitor.type_field(_type_code->fields[6], 6); vnx::accept(_visitor, address); + _visitor.type_field(_type_code->fields[7], 7); vnx::accept(_visitor, account); + _visitor.type_end(*_type_code); +} + +void account_info_t::write(std::ostream& _out) const { + _out << "{"; + _out << "\"index\": "; vnx::write(_out, index); + _out << ", \"num_addresses\": "; vnx::write(_out, num_addresses); + _out << ", \"name\": "; vnx::write(_out, name); + _out << ", \"key_file\": "; vnx::write(_out, key_file); + _out << ", \"finger_print\": "; vnx::write(_out, finger_print); + _out << ", \"with_passphrase\": "; vnx::write(_out, with_passphrase); + _out << ", \"address\": "; vnx::write(_out, address); + _out << ", \"account\": "; vnx::write(_out, account); + _out << "}"; +} + +void account_info_t::read(std::istream& _in) { + if(auto _json = vnx::read_json(_in)) { + from_object(_json->to_object()); + } +} + +vnx::Object account_info_t::to_object() const { + vnx::Object _object; + _object["__type"] = "mmx.account_info_t"; + _object["index"] = index; + _object["num_addresses"] = num_addresses; + _object["name"] = name; + _object["key_file"] = key_file; + _object["finger_print"] = finger_print; + _object["with_passphrase"] = with_passphrase; + _object["address"] = address; + _object["account"] = account; + return _object; +} + +void account_info_t::from_object(const vnx::Object& _object) { + for(const auto& _entry : _object.field) { + if(_entry.first == "account") { + _entry.second.to(account); + } else if(_entry.first == "address") { + _entry.second.to(address); + } else if(_entry.first == "finger_print") { + _entry.second.to(finger_print); + } else if(_entry.first == "index") { + _entry.second.to(index); + } else if(_entry.first == "key_file") { + _entry.second.to(key_file); + } else if(_entry.first == "name") { + _entry.second.to(name); + } else if(_entry.first == "num_addresses") { + _entry.second.to(num_addresses); + } else if(_entry.first == "with_passphrase") { + _entry.second.to(with_passphrase); + } + } +} + +vnx::Variant account_info_t::get_field(const std::string& _name) const { + if(_name == "index") { + return vnx::Variant(index); + } + if(_name == "num_addresses") { + return vnx::Variant(num_addresses); + } + if(_name == "name") { + return vnx::Variant(name); + } + if(_name == "key_file") { + return vnx::Variant(key_file); + } + if(_name == "finger_print") { + return vnx::Variant(finger_print); + } + if(_name == "with_passphrase") { + return vnx::Variant(with_passphrase); + } + if(_name == "address") { + return vnx::Variant(address); + } + if(_name == "account") { + return vnx::Variant(account); + } + return vnx::Variant(); +} + +void account_info_t::set_field(const std::string& _name, const vnx::Variant& _value) { + if(_name == "index") { + _value.to(index); + } else if(_name == "num_addresses") { + _value.to(num_addresses); + } else if(_name == "name") { + _value.to(name); + } else if(_name == "key_file") { + _value.to(key_file); + } else if(_name == "finger_print") { + _value.to(finger_print); + } else if(_name == "with_passphrase") { + _value.to(with_passphrase); + } else if(_name == "address") { + _value.to(address); + } else if(_name == "account") { + _value.to(account); + } +} + +/// \private +std::ostream& operator<<(std::ostream& _out, const account_info_t& _value) { + _value.write(_out); + return _out; +} + +/// \private +std::istream& operator>>(std::istream& _in, account_info_t& _value) { + _value.read(_in); + return _in; +} + +const vnx::TypeCode* account_info_t::static_get_type_code() { + const vnx::TypeCode* type_code = vnx::get_type_code(VNX_TYPE_HASH); + if(!type_code) { + type_code = vnx::register_type_code(static_create_type_code()); + } + return type_code; +} + +std::shared_ptr account_info_t::static_create_type_code() { + auto type_code = std::make_shared(); + type_code->name = "mmx.account_info_t"; + type_code->type_hash = vnx::Hash64(0x5858a2f32468feaeull); + type_code->code_hash = vnx::Hash64(0x9255e9ebe9f567c0ull); + type_code->is_native = true; + type_code->native_size = sizeof(::mmx::account_info_t); + type_code->parents.resize(1); + type_code->parents[0] = ::mmx::account_t::static_get_type_code(); + type_code->create_value = []() -> std::shared_ptr { return std::make_shared>(); }; + type_code->fields.resize(8); + { + auto& field = type_code->fields[0]; + field.data_size = 4; + field.name = "index"; + field.code = {3}; + } + { + auto& field = type_code->fields[1]; + field.data_size = 4; + field.name = "num_addresses"; + field.value = vnx::to_string(1); + field.code = {3}; + } + { + auto& field = type_code->fields[2]; + field.is_extended = true; + field.name = "name"; + field.code = {32}; + } + { + auto& field = type_code->fields[3]; + field.is_extended = true; + field.name = "key_file"; + field.code = {32}; + } + { + auto& field = type_code->fields[4]; + field.is_extended = true; + field.name = "finger_print"; + field.code = {32}; + } + { + auto& field = type_code->fields[5]; + field.data_size = 1; + field.name = "with_passphrase"; + field.code = {31}; + } + { + auto& field = type_code->fields[6]; + field.is_extended = true; + field.name = "address"; + field.code = {33, 11, 32, 1}; + } + { + auto& field = type_code->fields[7]; + field.data_size = 4; + field.name = "account"; + field.code = {3}; + } + type_code->build(); + return type_code; +} + + +} // namespace mmx + + +namespace vnx { + +void read(TypeInput& in, ::mmx::account_info_t& value, const TypeCode* type_code, const uint16_t* code) { + if(code) { + switch(code[0]) { + case CODE_OBJECT: + case CODE_ALT_OBJECT: { + Object tmp; + vnx::read(in, tmp, type_code, code); + value.from_object(tmp); + return; + } + case CODE_DYNAMIC: + case CODE_ALT_DYNAMIC: + vnx::read_dynamic(in, value); + return; + } + } + if(!type_code) { + vnx::skip(in, type_code, code); + return; + } + if(code) { + switch(code[0]) { + case CODE_STRUCT: type_code = type_code->depends[code[1]]; break; + case CODE_ALT_STRUCT: type_code = type_code->depends[vnx::flip_bytes(code[1])]; break; + default: { + vnx::skip(in, type_code, code); + return; + } + } + } + const auto* const _buf = in.read(type_code->total_field_size); + if(type_code->is_matched) { + if(const auto* const _field = type_code->field_map[0]) { + vnx::read_value(_buf + _field->offset, value.index, _field->code.data()); + } + if(const auto* const _field = type_code->field_map[1]) { + vnx::read_value(_buf + _field->offset, value.num_addresses, _field->code.data()); + } + if(const auto* const _field = type_code->field_map[5]) { + vnx::read_value(_buf + _field->offset, value.with_passphrase, _field->code.data()); + } + if(const auto* const _field = type_code->field_map[7]) { + vnx::read_value(_buf + _field->offset, value.account, _field->code.data()); + } + } + for(const auto* _field : type_code->ext_fields) { + switch(_field->native_index) { + case 2: vnx::read(in, value.name, type_code, _field->code.data()); break; + case 3: vnx::read(in, value.key_file, type_code, _field->code.data()); break; + case 4: vnx::read(in, value.finger_print, type_code, _field->code.data()); break; + case 6: vnx::read(in, value.address, type_code, _field->code.data()); break; + default: vnx::skip(in, type_code, _field->code.data()); + } + } +} + +void write(TypeOutput& out, const ::mmx::account_info_t& value, const TypeCode* type_code, const uint16_t* code) { + if(code && code[0] == CODE_OBJECT) { + vnx::write(out, value.to_object(), nullptr, code); + return; + } + if(!type_code || (code && code[0] == CODE_ANY)) { + type_code = mmx::vnx_native_type_code_account_info_t; + out.write_type_code(type_code); + vnx::write_class_header<::mmx::account_info_t>(out); + } + else if(code && code[0] == CODE_STRUCT) { + type_code = type_code->depends[code[1]]; + } + auto* const _buf = out.write(13); + vnx::write_value(_buf + 0, value.index); + vnx::write_value(_buf + 4, value.num_addresses); + vnx::write_value(_buf + 8, value.with_passphrase); + vnx::write_value(_buf + 9, value.account); + vnx::write(out, value.name, type_code, type_code->fields[2].code.data()); + vnx::write(out, value.key_file, type_code, type_code->fields[3].code.data()); + vnx::write(out, value.finger_print, type_code, type_code->fields[4].code.data()); + vnx::write(out, value.address, type_code, type_code->fields[6].code.data()); +} + +void read(std::istream& in, ::mmx::account_info_t& value) { + value.read(in); +} + +void write(std::ostream& out, const ::mmx::account_info_t& value) { + value.write(out); +} + +void accept(Visitor& visitor, const ::mmx::account_info_t& value) { + value.accept(visitor); +} + +bool is_equivalent<::mmx::account_info_t>::operator()(const uint16_t* code, const TypeCode* type_code) { + if(code[0] != CODE_STRUCT || !type_code) { + return false; + } + type_code = type_code->depends[code[1]]; + return type_code->type_hash == ::mmx::account_info_t::VNX_TYPE_HASH && type_code->is_equivalent; +} + +} // vnx diff --git a/generated/src/package.cpp b/generated/src/package.cpp index e0a30dcf7..a66ac7337 100644 --- a/generated/src/package.cpp +++ b/generated/src/package.cpp @@ -333,6 +333,7 @@ #include #include #include +#include #include #include #include @@ -4285,6 +4286,18 @@ void type<::mmx::WebAPI_shutdown_return>::create_dynamic_code(std::vector::get_type_code() { + return mmx::vnx_native_type_code_account_info_t; +} + +void type<::mmx::account_info_t>::create_dynamic_code(std::vector& code) { + create_dynamic_code(code, ::mmx::account_info_t()); +} + +void type<::mmx::account_info_t>::create_dynamic_code(std::vector& code, const ::mmx::account_info_t& value, bool special) { + code.push_back(CODE_OBJECT); +} + const TypeCode* type<::mmx::account_t>::get_type_code() { return mmx::vnx_native_type_code_account_t; } @@ -5173,6 +5186,7 @@ void register_all_types() { vnx::register_type_code(::mmx::WebAPIBase::static_create_type_code()); vnx::register_type_code(::mmx::WebAPI_shutdown::static_create_type_code()); vnx::register_type_code(::mmx::WebAPI_shutdown_return::static_create_type_code()); + vnx::register_type_code(::mmx::account_info_t::static_create_type_code()); vnx::register_type_code(::mmx::account_t::static_create_type_code()); vnx::register_type_code(::mmx::balance_t::static_create_type_code()); vnx::register_type_code(::mmx::block_index_t::static_create_type_code()); @@ -5549,6 +5563,7 @@ const vnx::TypeCode* const vnx_native_type_code_WalletFile = vnx::get_type_code( const vnx::TypeCode* const vnx_native_type_code_WebAPIBase = vnx::get_type_code(vnx::Hash64(0xfe90ce601fcc0cc6ull)); const vnx::TypeCode* const vnx_native_type_code_WebAPI_shutdown = vnx::get_type_code(vnx::Hash64(0x75dd6111dc25b9d6ull)); const vnx::TypeCode* const vnx_native_type_code_WebAPI_shutdown_return = vnx::get_type_code(vnx::Hash64(0x248624ff297c34ull)); +const vnx::TypeCode* const vnx_native_type_code_account_info_t = vnx::get_type_code(vnx::Hash64(0x5858a2f32468feaeull)); const vnx::TypeCode* const vnx_native_type_code_account_t = vnx::get_type_code(vnx::Hash64(0xc0c163f453729a7ull)); const vnx::TypeCode* const vnx_native_type_code_balance_t = vnx::get_type_code(vnx::Hash64(0x613173c7e5ce65b4ull)); const vnx::TypeCode* const vnx_native_type_code_block_index_t = vnx::get_type_code(vnx::Hash64(0xd00c722670bca900ull));