Checked the FFI bridge interface. The previous code was just compiling a POC source file with no link to the actual FFI file while translated the functions from wallet-core to dart accessible methods. The work on this branch was to link the part that has the bridge with the part that translates the C functions to dart methods. Since the libraries will be static the project needed to link to static libraries preferably without any additional code. Since the GeniusWallet is supposed to run in multiple OSs each of them required different changes to integrate the static libraries. The changes and features were done in a way to reduce as much as possible duplicating code, so for "cmake" build systems most common code was unified in one place, meanwhile for iOS and macOS their respectives Xcode projects were changed.
How to test
The expected "thirdparty" repository path is in the same level as the GeniusWallet cloned path. One should compile at least "wallet-core" for the desired architecture. Alter building the expected libraries are libTrustWallet.a, libwallet_core_rs.a and libTrezorCrypto.a (or TrustWallet.lib, wallet_core_rs.lib and TrezorCrypto.lib in case of "Windows"). Also the grpc's libprotobuf.a (or libprotobuf.lib) will be needed. Their paths will be in "${PRJ_NAME}/lib" folders in the build directory.
Open the GeniusWallet project on your preferred IDE (in my case Visual Studio Code)
Edit the file "wallet_creation_screen.dart", uncommenting the lines 47 to 55.
Build the application (either build, run or debug).
Go to the "Add wallet" screen, if not already there.
Click on "Test C++ native code".
Expect the text "Value:stride" to be shown below it.
Changes
New feature: FFI interface with wallet-core libraries on all OSs (Windows, Linux, Android, iOS and OSX)
Cleanup: Removed FFI test code that just returned a double value
New feature: Created "cmake" folder with common options and utilities
New feature: Created unit tests structure and just a single working unit test for ffi code for now.
Known issues
"A RenderFlex overflowed by 16 pixels on the bottom." wasn't addressed and still occurs
When debugging the application it warns that "Build errors exist in your project", but if you click on "Debug Anyway" it works.
Unit tests has just its structure set, but it's not testing anything
Description
Checked the FFI bridge interface. The previous code was just compiling a POC source file with no link to the actual FFI file while translated the functions from wallet-core to dart accessible methods. The work on this branch was to link the part that has the bridge with the part that translates the C functions to dart methods. Since the libraries will be static the project needed to link to static libraries preferably without any additional code. Since the GeniusWallet is supposed to run in multiple OSs each of them required different changes to integrate the static libraries. The changes and features were done in a way to reduce as much as possible duplicating code, so for "cmake" build systems most common code was unified in one place, meanwhile for iOS and macOS their respectives Xcode projects were changed.
How to test
The expected "thirdparty" repository path is in the same level as the GeniusWallet cloned path. One should compile at least "wallet-core" for the desired architecture. Alter building the expected libraries are libTrustWallet.a, libwallet_core_rs.a and libTrezorCrypto.a (or TrustWallet.lib, wallet_core_rs.lib and TrezorCrypto.lib in case of "Windows"). Also the grpc's libprotobuf.a (or libprotobuf.lib) will be needed. Their paths will be in "${PRJ_NAME}/lib" folders in the build directory.
Changes
Known issues