Skip to content

Commit

Permalink
Added GetAddress function
Browse files Browse the repository at this point in the history
  • Loading branch information
EduMenges committed Sep 12, 2024
1 parent ffa30ed commit a1c31a1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/GeniusSDK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "GeniusSDK.h"
#include "account/GeniusNode.hpp"
#include <boost/multiprecision/cpp_int/import_export.hpp>
#include <memory>
#include <rapidjson/document.h>
#include <rapidjson/writer.h>
Expand Down Expand Up @@ -151,3 +152,14 @@ void GeniusSDKMintTokens( uint64_t amount )
{
GeniusNodeInstance->MintTokens( amount );
}

GeniusAddress GeniusSDKGetAddress()
{
auto address = GeniusNodeInstance->GetAdddress();

GeniusAddress ret;

boost::multiprecision::export_bits( address, ret.bytes, 8 );

return ret;
}
6 changes: 6 additions & 0 deletions src/GeniusSDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ typedef struct
GeniusArray *ptr;
} GeniusMatrix; ///< Struct to interop a matrix of C++ vectors in C

typedef struct
{
uint8_t bytes[256 / 8];
} 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

Expand All @@ -50,6 +55,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

Expand Down

0 comments on commit a1c31a1

Please sign in to comment.