From 9198c39f3fb85e6cb13e74fe933e32dd3dee1f05 Mon Sep 17 00:00:00 2001 From: Eduardo Menges Mattje Date: Fri, 13 Sep 2024 15:29:51 -0300 Subject: [PATCH] Added `GetAdress` function --- src/GeniusSDK.cpp | 12 ++++++++++++ src/GeniusSDK.h | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/src/GeniusSDK.cpp b/src/GeniusSDK.cpp index 98c5232..615dfd4 100644 --- a/src/GeniusSDK.cpp +++ b/src/GeniusSDK.cpp @@ -7,6 +7,7 @@ #include "GeniusSDK.h" #include "account/GeniusNode.hpp" +#include #include #include #include @@ -151,3 +152,14 @@ void GeniusSDKMintTokens( uint64_t amount ) { GeniusNodeInstance->MintTokens( amount ); } + +GeniusAddress GeniusSDKGetAddress() +{ + auto address = GeniusNodeInstance->GetAdddress(); + + GeniusAddress ret; + + std::copy( address.cbegin(), address.cend(), ret.address ); + + return ret; +} diff --git a/src/GeniusSDK.h b/src/GeniusSDK.h index a7d5049..29707ab 100644 --- a/src/GeniusSDK.h +++ b/src/GeniusSDK.h @@ -41,6 +41,13 @@ typedef struct GeniusArray *ptr; } GeniusMatrix; ///< Struct to interop a matrix of C++ vectors in C +typedef struct +{ + /// A string prepended with `0x` followed by 64 hex characters, + /// including a null-terminating char just for safety. + char address[2 + 256 / 4 + 1]; +} GeniusAddress; + typedef char ImagePath_t[1024]; ///< ID/Path of the image to be processed typedef uint64_t PayAmount_t; ///< Amount to be paid for the processing @@ -50,6 +57,7 @@ GNUS_VISIBILITY_DEFAULT uint64_t GeniusSDKGetBalance(); GNUS_VISIBILITY_DEFAULT GeniusMatrix GeniusSDKGetTransactions(); GNUS_VISIBILITY_DEFAULT void GeniusSDKFreeTransactions( GeniusMatrix matrix ); GNUS_VISIBILITY_DEFAULT void GeniusSDKMintTokens( uint64_t amount ); +GNUS_VISIBILITY_DEFAULT GeniusAddress GeniusSDKGetAddress(); GNUS_EXPORT_END