summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rwxr-xr-xbuild_single.sh46
-rwxr-xr-xcontrib/depends/gen_toolchain.cmake.sh4
-rwxr-xr-xgenerate_checksum.sh12
-rw-r--r--impls/monero.dart/ffigen_monero.yaml2
-rw-r--r--impls/monero.dart/ffigen_wownero.yaml2
-rw-r--r--impls/monero.dart/ffigen_zano.yaml2
-rw-r--r--impls/monero.dart/lib/src/checksum_monero.dart6
-rw-r--r--impls/monero.dart/lib/src/checksum_wownero.dart2
-rw-r--r--impls/monero.dart/lib/src/checksum_zano.dart2
-rw-r--r--impls/monero.ts/checksum_monero.ts6
-rw-r--r--impls/monero.ts/checksum_wownero.ts2
-rw-r--r--impls/monero.ts/checksum_zano.ts2
-rw-r--r--monero_libwallet2_api_c/CMakeLists.txt120
-rw-r--r--monero_libwallet2_api_c/monero_libwallet2_api_c.exp40
-rw-r--r--monero_libwallet2_api_c/src/main/cpp/monero_checksum.c5
-rw-r--r--monero_libwallet2_api_c/src/main/cpp/monero_checksum.h26
-rw-r--r--monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.cpp (renamed from monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp)72
-rw-r--r--monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.h (renamed from monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h)113
-rw-r--r--tests/c/Makefile58
-rw-r--r--tests/c/src/main.c12
-rw-r--r--tests/c/src/utils.c65
-rw-r--r--tests/c/src/utils.h8
-rw-r--r--tests/c/tests/all.h7
-rw-r--r--tests/c/tests/monero_test_creation.c55
-rw-r--r--tests/c/tests/monero_test_restore.c255
-rw-r--r--wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.c5
-rw-r--r--wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h25
-rw-r--r--wownero_libwallet2_api_c/src/main/cpp/wownero_wallet2_api_c.cpp (renamed from wownero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp)22
-rw-r--r--wownero_libwallet2_api_c/src/main/cpp/wownero_wallet2_api_c.h (renamed from wownero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h)0
-rw-r--r--zano_libwallet2_api_c/src/main/cpp/zano_checksum.c5
-rw-r--r--zano_libwallet2_api_c/src/main/cpp/zano_checksum.h25
-rw-r--r--zano_libwallet2_api_c/src/main/cpp/zano_wallet2_api_c.cpp (renamed from zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp)6
-rw-r--r--zano_libwallet2_api_c/src/main/cpp/zano_wallet2_api_c.h (renamed from zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.h)0
34 files changed, 776 insertions, 238 deletions
diff --git a/.gitignore b/.gitignore
index 706bca7..12bf358 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,5 @@ contrib/depends/simplybs
./monero
./wownero
./zano
+*.o
+test_wallet2_api_c
diff --git a/build_single.sh b/build_single.sh
index 8be1e0b..ebc30e3 100755
--- a/build_single.sh
+++ b/build_single.sh
@@ -68,34 +68,24 @@ export PATH="$(pwd)/contrib/depends/_native/bin/:$(pwd)/contrib/depends/$HOST_AB
buildType=Release
-pushd ${repo}_libwallet2_api_c
- rm -rf build/${HOST_ABI} || true
- mkdir -p build/${HOST_ABI}
- if [[ "$repo" == "zano" ]];
- then
- EXTRA_CMAKE_FLAGS="-DCAKEWALLET=ON"
- fi
- pushd build/${HOST_ABI}
- cmake --trace-expand -DCMAKE_TOOLCHAIN_FILE=$PWD/../../../contrib/depends/${HOST_ABI}/share/toolchain.cmake $EXTRA_CMAKE_FLAGS -DUSE_DEVICE_TREZOR=OFF -DMONERO_FLAVOR=$repo -DCMAKE_BUILD_TYPE=Debug -DHOST_ABI=${HOST_ABI} ../..
- make $NPROC
+for OUTPUT_MODE in SHARED;
+do
+ pushd ${repo}_libwallet2_api_c
+ rm -rf build/${HOST_ABI}_${OUTPUT_MODE} || true
+ mkdir -p build/${HOST_ABI}_${OUTPUT_MODE}
+ if [[ "$repo" == "zano" ]];
+ then
+ EXTRA_CMAKE_FLAGS="-DCAKEWALLET=ON"
+ fi
+ pushd build/${HOST_ABI}_${OUTPUT_MODE}
+ cmake -DCMAKE_TOOLCHAIN_FILE=$PWD/../../../contrib/depends/${HOST_ABI}/share/toolchain.cmake $EXTRA_CMAKE_FLAGS -DUSE_DEVICE_TREZOR=OFF -DMONERO_FLAVOR=$repo -DCMAKE_BUILD_TYPE=Debug -DHOST_ABI=${HOST_ABI} -DOUTPUT_MODE=${OUTPUT_MODE} ../..
+ make $NPROC
+ popd
popd
-popd
+done
-mkdir -p release/$repo 2>/dev/null || true
-pushd release/$repo
- APPENDIX=""
- if [[ "${HOST_ABI}" == "x86_64-w64-mingw32" || "${HOST_ABI}" == "i686-w64-mingw32" ]];
- then
- echo "TODO: check if it's still needed"
- APPENDIX="${APPENDIX}dll"
- # cp ../../$repo/build/${HOST_ABI}/external/polyseed/libpolyseed.${APPENDIX} ${HOST_ABI}_libpolyseed.${APPENDIX}
- # rm ${HOST_ABI}_libpolyseed.${APPENDIX}.xz || true
- # xz -e ${HOST_ABI}_libpolyseed.${APPENDIX}
- elif [[ "${HOST_ABI}" == "x86_64-apple-darwin11" || "${HOST_ABI}" == "aarch64-apple-darwin11" || "${HOST_ABI}" == "host-apple-darwin" || "${HOST_ABI}" == "x86_64-host-apple-darwin" || "${HOST_ABI}" == "aarch64-apple-darwin" || "${HOST_ABI}" == "x86_64-apple-darwin" || "${HOST_ABI}" == "host-apple-ios" || "${HOST_ABI}" == "aarch64-apple-ios" || "${HOST_ABI}" == "aarch64-apple-ios-simulator" ]];
- then
- APPENDIX="${APPENDIX}dylib"
- else
- APPENDIX="${APPENDIX}so"
- fi
- mv ../../${repo}_libwallet2_api_c/build/${HOST_ABI}/libwallet2_api_c.${APPENDIX} ${HOST_ABI}_libwallet2_api_c.${APPENDIX}
+mkdir -p release/$(git describe --tags)/${HOST_ABI} 2>/dev/null || true
+pushd release/$(git describe --tags)/${HOST_ABI}
+ pwd
+ mv ../../../${repo}_libwallet2_api_c/build/${HOST_ABI}_*/lib*_wallet2_api_c.* .
popd
diff --git a/contrib/depends/gen_toolchain.cmake.sh b/contrib/depends/gen_toolchain.cmake.sh
index 1a12df7..9ed2621 100755
--- a/contrib/depends/gen_toolchain.cmake.sh
+++ b/contrib/depends/gen_toolchain.cmake.sh
@@ -133,13 +133,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(CONF_TRIPLE "aarch64-apple-darwin11")
SET(BUILD_TAG "mac-armv8")
SET(CMAKE_OSX_ARCHITECTURES "arm64")
- set(ARM ON)
- set(ARM_ID "armv8-a")
else()
SET(CLANG_TARGET "x86_64-apple-darwin11")
SET(CONF_TRIPLE "x86_64-apple-darwin11")
- SET(BUILD_TAG "mac-x64")
- SET(CMAKE_OSX_ARCHITECTURES "x86_64")
endif()
SET(_CMAKE_TOOLCHAIN_PREFIX @nativeprefix@/bin/\${CONF_TRIPLE}-)
SET(CMAKE_C_COMPILER @CC@)
diff --git a/generate_checksum.sh b/generate_checksum.sh
index ea59961..3793a54 100755
--- a/generate_checksum.sh
+++ b/generate_checksum.sh
@@ -10,17 +10,16 @@ for coin in monero wownero zano;
do
submodule_hash=$(git ls-tree HEAD ${coin} | xargs | awk '{ print $3 }')
COIN=$(echo "$coin" | tr a-z A-Z)
- COIN_wallet2_api_c_h_sha256=$(sha256sum ${coin}_libwallet2_api_c/src/main/cpp/wallet2_api_c.h | xargs | awk '{ print $1 }')
- COIN_wallet2_api_c_cpp_sha256=$(sha256sum ${coin}_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp | xargs | awk '{ print $1 }')-${submodule_hash}
+ COIN_wallet2_api_c_h_sha256=$(sha256sum ${coin}_libwallet2_api_c/src/main/cpp/${coin}_wallet2_api_c.h | xargs | awk '{ print $1 }')
+ COIN_wallet2_api_c_cpp_sha256=$(sha256sum ${coin}_libwallet2_api_c/src/main/cpp/${coin}_wallet2_api_c.cpp | xargs | awk '{ print $1 }')-${submodule_hash}
COIN_wallet2_api_c_exp_sha256=$(sha256sum ${coin}_libwallet2_api_c/${coin}_libwallet2_api_c.exp | xargs | awk '{ print $1 }')
- cat > ${coin}_libwallet2_api_c/src/main/cpp/${coin}_checksum.h << EOF
-#ifndef MONEROC_CHECKSUMS
-#define MONEROC_CHECKSUMS
+ cat > ${coin}_libwallet2_api_c/src/main/cpp/${coin}_checksum.c << EOF
+#include "${coin}_checksum.h"
+
const char * ${COIN}_wallet2_api_c_h_sha256 = "${COIN_wallet2_api_c_h_sha256}";
const char * ${COIN}_wallet2_api_c_cpp_sha256 = "${COIN_wallet2_api_c_cpp_sha256}";
const char * ${COIN}_wallet2_api_c_exp_sha256 = "${COIN_wallet2_api_c_exp_sha256}";
-#endif
EOF
cat > impls/monero.dart/lib/src/checksum_${coin}.dart << EOF
// ignore_for_file: constant_identifier_names
@@ -36,4 +35,3 @@ export const ${coin}Checksum = {
}
EOF
done
-
diff --git a/impls/monero.dart/ffigen_monero.yaml b/impls/monero.dart/ffigen_monero.yaml
index 516dbc9..c9fea5f 100644
--- a/impls/monero.dart/ffigen_monero.yaml
+++ b/impls/monero.dart/ffigen_monero.yaml
@@ -3,7 +3,7 @@ description: monero_c bindings
output: 'lib/src/generated_bindings_monero.g.dart'
headers:
entry-points:
- - '../../monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h'
+ - '../../monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.h'
exclude-all-by-default: true
functions:
diff --git a/impls/monero.dart/ffigen_wownero.yaml b/impls/monero.dart/ffigen_wownero.yaml
index 1149dca..b87b050 100644
--- a/impls/monero.dart/ffigen_wownero.yaml
+++ b/impls/monero.dart/ffigen_wownero.yaml
@@ -3,7 +3,7 @@ description: monero_c wownero bindings
output: 'lib/src/generated_bindings_wownero.g.dart'
headers:
entry-points:
- - '../../wownero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h'
+ - '../../wownero_libwallet2_api_c/src/main/cpp/wownero_wallet2_api_c.h'
exclude-all-by-default: true
functions:
diff --git a/impls/monero.dart/ffigen_zano.yaml b/impls/monero.dart/ffigen_zano.yaml
index 2c0f6a0..3272827 100644
--- a/impls/monero.dart/ffigen_zano.yaml
+++ b/impls/monero.dart/ffigen_zano.yaml
@@ -3,7 +3,7 @@ description: monero_c bindings
output: 'lib/src/generated_bindings_zano.g.dart'
headers:
entry-points:
- - '../../zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.h'
+ - '../../zano_libwallet2_api_c/src/main/cpp/zano_wallet2_api_c.h'
exclude-all-by-default: true
functions:
diff --git a/impls/monero.dart/lib/src/checksum_monero.dart b/impls/monero.dart/lib/src/checksum_monero.dart
index 27cbe36..49f3074 100644
--- a/impls/monero.dart/lib/src/checksum_monero.dart
+++ b/impls/monero.dart/lib/src/checksum_monero.dart
@@ -1,4 +1,4 @@
// ignore_for_file: constant_identifier_names
-const String wallet2_api_c_h_sha256 = "3515e4c9e537ca3efa664f0b364a3aeb106ff64337f542a262ce104c00b31235";
-const String wallet2_api_c_cpp_sha256 = "ca44a8d4a201ba6dc0a25c857e95d07bc8d514039b38cd5b3826100e8943cbcc-dbcc7d212c094bd1a45f7291dbb99a4b4627a96d";
-const String wallet2_api_c_exp_sha256 = "0561e14606106e6b0ec49fb2aefe743ff500f7c3de07557f7041e06aef9509ce";
+const String wallet2_api_c_h_sha256 = "563113bbf36f153d66d6f656ea6f364172a0e801074dcffffab62374a628607f";
+const String wallet2_api_c_cpp_sha256 = "5231bad07c802e88fc17781b71e85fce7a0dc750301893482577558aa56f925d-dbcc7d212c094bd1a45f7291dbb99a4b4627a96d";
+const String wallet2_api_c_exp_sha256 = "d873158058e22fabba8d809e9c6cdf633e1b6b2bd78ee5b617435b66131ce600";
diff --git a/impls/monero.dart/lib/src/checksum_wownero.dart b/impls/monero.dart/lib/src/checksum_wownero.dart
index a1d39ee..a82fd59 100644
--- a/impls/monero.dart/lib/src/checksum_wownero.dart
+++ b/impls/monero.dart/lib/src/checksum_wownero.dart
@@ -1,4 +1,4 @@
// ignore_for_file: constant_identifier_names
const String wallet2_api_c_h_sha256 = "f99009d1ca1d1c783cc9aa0fb63f680d48753b88124fb5de2079c57b7e34c827";
-const String wallet2_api_c_cpp_sha256 = "70b39a0bef660cb9ba0397117eb1590e18461ace89ab18141690658a2a537d5d-cfd2a696245be112a01936d1f2f41b6eb7558376";
+const String wallet2_api_c_cpp_sha256 = "4da7caa6ed47e95f0d1ee62315e46d3d9200d32cc6c49dbcadfc0ad053799ea6-cfd2a696245be112a01936d1f2f41b6eb7558376";
const String wallet2_api_c_exp_sha256 = "5f53ea8bbe66a5e5aa6cbc4ca00695900e08589cfd32062e88965a24252d05ba";
diff --git a/impls/monero.dart/lib/src/checksum_zano.dart b/impls/monero.dart/lib/src/checksum_zano.dart
index cff01f2..31abf86 100644
--- a/impls/monero.dart/lib/src/checksum_zano.dart
+++ b/impls/monero.dart/lib/src/checksum_zano.dart
@@ -1,4 +1,4 @@
// ignore_for_file: constant_identifier_names
const String wallet2_api_c_h_sha256 = "8acaa95513b85a984c08e05cc3f2ac7530bb8f32946eeeb45357bd846aef33dd";
-const String wallet2_api_c_cpp_sha256 = "4efacd3812d53dd268b6869cc0a9560e7320574d96e09136cf067f796edfeba6-b372a99c7ada82caac53b677d9aaa7c0902e3b0b";
+const String wallet2_api_c_cpp_sha256 = "cdec2578df387ab3587712f77470500934d7f18c27201ae71bc3ee52cb784cbd-b372a99c7ada82caac53b677d9aaa7c0902e3b0b";
const String wallet2_api_c_exp_sha256 = "66f3ff655bbfd11ad28c318ab707090b5a93276f436b06f7b1c0f329dba3c9c2";
diff --git a/impls/monero.ts/checksum_monero.ts b/impls/monero.ts/checksum_monero.ts
index 81eba33..7081fb2 100644
--- a/impls/monero.ts/checksum_monero.ts
+++ b/impls/monero.ts/checksum_monero.ts
@@ -1,5 +1,5 @@
export const moneroChecksum = {
- wallet2_api_c_h_sha256: "3515e4c9e537ca3efa664f0b364a3aeb106ff64337f542a262ce104c00b31235",
- wallet2_api_c_cpp_sha256: "ca44a8d4a201ba6dc0a25c857e95d07bc8d514039b38cd5b3826100e8943cbcc-dbcc7d212c094bd1a45f7291dbb99a4b4627a96d",
- wallet2_api_c_exp_sha256: "0561e14606106e6b0ec49fb2aefe743ff500f7c3de07557f7041e06aef9509ce",
+ wallet2_api_c_h_sha256: "563113bbf36f153d66d6f656ea6f364172a0e801074dcffffab62374a628607f",
+ wallet2_api_c_cpp_sha256: "5231bad07c802e88fc17781b71e85fce7a0dc750301893482577558aa56f925d-dbcc7d212c094bd1a45f7291dbb99a4b4627a96d",
+ wallet2_api_c_exp_sha256: "d873158058e22fabba8d809e9c6cdf633e1b6b2bd78ee5b617435b66131ce600",
}
diff --git a/impls/monero.ts/checksum_wownero.ts b/impls/monero.ts/checksum_wownero.ts
index c7b7e75..ff16458 100644
--- a/impls/monero.ts/checksum_wownero.ts
+++ b/impls/monero.ts/checksum_wownero.ts
@@ -1,5 +1,5 @@
export const wowneroChecksum = {
wallet2_api_c_h_sha256: "f99009d1ca1d1c783cc9aa0fb63f680d48753b88124fb5de2079c57b7e34c827",
- wallet2_api_c_cpp_sha256: "70b39a0bef660cb9ba0397117eb1590e18461ace89ab18141690658a2a537d5d-cfd2a696245be112a01936d1f2f41b6eb7558376",
+ wallet2_api_c_cpp_sha256: "4da7caa6ed47e95f0d1ee62315e46d3d9200d32cc6c49dbcadfc0ad053799ea6-cfd2a696245be112a01936d1f2f41b6eb7558376",
wallet2_api_c_exp_sha256: "5f53ea8bbe66a5e5aa6cbc4ca00695900e08589cfd32062e88965a24252d05ba",
}
diff --git a/impls/monero.ts/checksum_zano.ts b/impls/monero.ts/checksum_zano.ts
index 6080ed1..08364ff 100644
--- a/impls/monero.ts/checksum_zano.ts
+++ b/impls/monero.ts/checksum_zano.ts
@@ -1,5 +1,5 @@
export const zanoChecksum = {
wallet2_api_c_h_sha256: "8acaa95513b85a984c08e05cc3f2ac7530bb8f32946eeeb45357bd846aef33dd",
- wallet2_api_c_cpp_sha256: "4efacd3812d53dd268b6869cc0a9560e7320574d96e09136cf067f796edfeba6-b372a99c7ada82caac53b677d9aaa7c0902e3b0b",
+ wallet2_api_c_cpp_sha256: "cdec2578df387ab3587712f77470500934d7f18c27201ae71bc3ee52cb784cbd-b372a99c7ada82caac53b677d9aaa7c0902e3b0b",
wallet2_api_c_exp_sha256: "66f3ff655bbfd11ad28c318ab707090b5a93276f436b06f7b1c0f329dba3c9c2",
}
diff --git a/monero_libwallet2_api_c/CMakeLists.txt b/monero_libwallet2_api_c/CMakeLists.txt
index f11c2bc..ab6a3b4 100644
--- a/monero_libwallet2_api_c/CMakeLists.txt
+++ b/monero_libwallet2_api_c/CMakeLists.txt
@@ -1,13 +1,11 @@
cmake_minimum_required(VERSION 3.5)
-project(wallet2_api_c)
-message(STATUS ABI_INFO = ${HOST_ABI})
+project(${MONERO_FLAVOR}_wallet2_api_c)
+message(STATUS HOST_ABI = ${HOST_ABI})
set(MD_LIBRARY "")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
-# set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE)
-# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-lto")
if(${HOST_ABI} STREQUAL "x86_64-w64-mingw32")
set(CMAKE_SYSTEM_NAME Windows)
@@ -21,92 +19,53 @@ elseif(${HOST_ABI} STREQUAL "i686-w64-mingw32")
set(TARGET "i686-w64-mingw32")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lssp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lssp")
-elseif(${HOST_ABI} STREQUAL "host-apple-ios" OR
- ${HOST_ABI} STREQUAL "aarch64-apple-ios")
+elseif(${HOST_ABI} MATCHES "-apple-ios")
set(CMAKE_SYSTEM_NAME iOS)
-elseif(${HOST_ABI} STREQUAL "host-apple-darwin" OR
- ${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR
- ${HOST_ABI} STREQUAL "aarch64-host-apple-darwin")
+elseif(${HOST_ABI} MATCHES "-apple-darwin")
set(CMAKE_SYSTEM_NAME Darwin)
endif()
-if (${HOST_ABI} STREQUAL "host-apple-darwin" OR
- ${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR
- ${HOST_ABI} STREQUAL "aarch64-host-apple-darwin")
- EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE )
- if (NOT ${ARCHITECTURE} STREQUAL arm64)
- set(CMAKE_OSX_ARCHITECTURES x86_64)
- endif()
-endif()
-
-if(${HOST_ABI} STREQUAL "x86_64-linux-android" OR
- ${HOST_ABI} STREQUAL "i686-linux-android" OR
- ${HOST_ABI} STREQUAL "aarch64-linux-android" OR
- ${HOST_ABI} STREQUAL "armv7a-linux-androideabi")
+if(${HOST_ABI} MATCHES "-linux-android")
add_link_options(-stdlib=libc++ -static-libstdc++)
set(EXTRA_LIBS_ANDROID log)
endif()
-add_library( wallet2_api_c
- SHARED
+
+add_library( ${MONERO_FLAVOR}_wallet2_api_c
+ ${OUTPUT_MODE}
src/main/cpp/helpers.cpp
- src/main/cpp/wallet2_api_c.cpp )
+ src/main/cpp/${MONERO_FLAVOR}_wallet2_api_c.cpp
+ src/main/cpp/${MONERO_FLAVOR}_checksum.c)
-if(${HOST_ABI} STREQUAL "x86_64-linux-android" OR
- ${HOST_ABI} STREQUAL "i686-linux-android" OR
- ${HOST_ABI} STREQUAL "aarch64-linux-android" OR
- ${HOST_ABI} STREQUAL "armv7a-linux-androideabi")
- set_target_properties(wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,-z,noexecstack")
+if(${HOST_ABI} MATCHES "-linux-android")
+ set_target_properties(${MONERO_FLAVOR}_wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,-z,noexecstack")
endif()
-if(${HOST_ABI} STREQUAL "x86_64-linux-gnu" OR
- ${HOST_ABI} STREQUAL "i686-linux-gnu" OR
- ${HOST_ABI} STREQUAL "aarch64-linux-gnu" OR
- ${HOST_ABI} STREQUAL "armv7a-linux-gnu")
- set_target_properties(wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,-z,noexecstack")
+if(${HOST_ABI} MATCHES "-linux-gnu")
+ set_target_properties(${MONERO_FLAVOR}_wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,-z,noexecstack")
endif()
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
-
-
set(MONERO_DIR ${CMAKE_SOURCE_DIR}/../${MONERO_FLAVOR})
set(EXTERNAL_LIBS_DIR ${CMAKE_SOURCE_DIR}/../contrib/depends/${HOST_ABI})
-if (${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin11")
- set(EXTRA_LIBS_APPLE "-framework IOKit" "-framework CoreFoundation" "-framework Cocoa" hidapi)
-# set_target_properties(wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,-F/Library/Frameworks")
-elseif(${HOST_ABI} STREQUAL "host-apple-darwin" OR
- ${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR
- ${HOST_ABI} STREQUAL "aarch64-host-apple-darwin")
- set(EXTRA_LIBS_APPLE "-framework IOKit" "-framework CoreFoundation" "-framework Cocoa" apple_nghttp2)
-elseif(${HOST_ABI} STREQUAL "host-apple-ios" OR ${HOST_ABI} STREQUAL "aarch64-apple-ios" OR ${HOST_ABI} STREQUAL "arm64-apple-ios" OR ${HOST_ABI} STREQUAL "arm64-apple-ios-simulator" OR ${HOST_ABI} STREQUAL "x86_64-apple-ios-simulator")
- set(EXTRA_LIBS_APPLE "-framework IOKit" "-framework CoreFoundation" iconv )
-endif()
-
if(${HOST_ABI} STREQUAL "x86_64-w64-mingw32" OR ${HOST_ABI} STREQUAL "i686-w64-mingw32")
- target_link_options(wallet2_api_c PRIVATE -static-libgcc -static-libstdc++)
-endif()
-
-if(${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin11" OR ${HOST_ABI} STREQUAL "host-apple-darwin" OR ${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR ${HOST_ABI} STREQUAL "aarch64-host-apple-darwin" OR ${HOST_ABI} STREQUAL "host-apple-ios" OR ${HOST_ABI} STREQUAL "aarch64-apple-ios" OR ${HOST_ABI} STREQUAL "arm64-apple-iossimulator" OR ${HOST_ABI} STREQUAL "x86_64-apple-iossimulator")
- set_target_properties(wallet2_api_c PROPERTIES SUFFIX ".dylib")
-
- set_target_properties(wallet2_api_c PROPERTIES NO_SONAME 1)
+ target_link_options(${MONERO_FLAVOR}_wallet2_api_c PRIVATE -static-libgcc -static-libstdc++)
endif()
if (${MONERO_FLAVOR} STREQUAL "monero")
- target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_MONERO)
+ target_compile_definitions(${MONERO_FLAVOR}_wallet2_api_c PRIVATE FLAVOR_MONERO)
set(BCUR_ENABLED bc-ur)
elseif(${MONERO_FLAVOR} STREQUAL "wownero")
- target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_WOWNERO)
+ target_compile_definitions(${MONERO_FLAVOR}_wallet2_api_c PRIVATE FLAVOR_WOWNERO)
elseif(${MONERO_FLAVOR} STREQUAL "zano")
- target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_ZANO)
+ target_compile_definitions(${MONERO_FLAVOR}_wallet2_api_c PRIVATE FLAVOR_ZANO)
endif()
-if(NOT ${HOST_ABI} STREQUAL "x86_64-apple-darwin11" AND NOT ${HOST_ABI} STREQUAL "aarch64-apple-darwin11" AND NOT ${HOST_ABI} STREQUAL "aarch64-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "x86_64-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "host-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "aarch64-host-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "host-apple-ios" AND NOT ${HOST_ABI} STREQUAL "aarch64-apple-ios" AND NOT ${HOST_ABI} STREQUAL "aarch64-apple-ios-simulator" AND NOT ${HOST_ABI} STREQUAL "x86_64-apple-ios-simulator")
- set_target_properties(wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,--exclude-libs,ALL")
+if(NOT HOST_ABI MATCHES "-apple-")
+ set_target_properties(${MONERO_FLAVOR}_wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,--exclude-libs,ALL")
endif()
if (${MONERO_FLAVOR} STREQUAL "zano")
@@ -116,26 +75,19 @@ if (${MONERO_FLAVOR} STREQUAL "zano")
endif()
add_subdirectory("${CMAKE_SOURCE_DIR}/../${MONERO_FLAVOR}" ${CMAKE_BINARY_DIR}/${MONERO_FLAVOR}_build EXCLUDE_FROM_ALL)
-if(${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin11" OR ${HOST_ABI} STREQUAL "x86_64-apple-darwin" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin" OR ${HOST_ABI} STREQUAL "host-apple-darwin" OR ${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR ${HOST_ABI} STREQUAL "aarch64-host-apple-darwin" OR ${HOST_ABI} STREQUAL "host-apple-ios" OR ${HOST_ABI} STREQUAL "aarch64-apple-ios" OR ${HOST_ABI} STREQUAL "aarch64-apple-iossimulator" OR ${HOST_ABI} STREQUAL "x86_64-apple-ios-simulator")
- if (${MONERO_FLAVOR} STREQUAL "monero")
- set(EXPORTED_SYMBOLS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/monero_libwallet2_api_c.exp)
- elseif(${MONERO_FLAVOR} STREQUAL "wownero")
- set(EXPORTED_SYMBOLS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/wownero_libwallet2_api_c.exp)
- elseif(${MONERO_FLAVOR} STREQUAL "zano")
- set(EXPORTED_SYMBOLS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/zano_libwallet2_api_c.exp)
- endif()
+
+if(HOST_ABI MATCHES "-apple-")
+ set(EXPORTED_SYMBOLS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${MONERO_FLAVOR}_libwallet2_api_c.exp)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -exported_symbols_list ${EXPORTED_SYMBOLS_FILE}")
set_target_properties(${TARGET} PROPERTIES LINK_DEPENDS ${EXPORTED_SYMBOLS_FILE})
endif()
-if (${MONERO_FLAVOR} STREQUAL "monero")
- set(WALLET_TARGETS wallet_api ${wallet_api_LIB_DEPENDS}) # wallet_api_LIB_DEPENDS
-elseif(${MONERO_FLAVOR} STREQUAL "wownero")
- set(WALLET_TARGETS wallet_api ${wallet_api_LIB_DEPENDS}) # wallet_api_LIB_DEPENDS
+if (${MONERO_FLAVOR} STREQUAL "monero" OR ${MONERO_FLAVOR} STREQUAL "wownero")
+ set(WALLET_TARGETS wallet_api ${wallet_api_LIB_DEPENDS})
elseif(${MONERO_FLAVOR} STREQUAL "zano")
set(THREADS_PREFER_PTHREAD_FLAG ON)
-
+
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_PTHREADS_INIT 1)
@@ -160,22 +112,10 @@ if(${MONERO_FLAVOR} STREQUAL "wownero")
set(EXTRA_LIBS_WOWNEROSEED wownero-seed)
endif()
-#get_cmake_property(_variableNames VARIABLES)
-#list (SORT _variableNames)
-#foreach (_variableName ${_variableNames})
-# message(STATUS "${_variableName}=${${_variableName}}")
-#endforeach()
-#message(SEND_ERROR "${Boost_LIBRARIES}")
-#message(SEND_ERROR "${WALLET_TARGETS}
-# ${EXTRA_LIBS_WOWNEROSEED}
-# ${EXTRA_LIBS_ANDROID}")
-
-
-if (${HOST_ABI} STREQUAL "x86_64-w64-mingw32" OR
- ${HOST_ABI} STREQUAL "i686-w64-mingw32")
- target_link_options(wallet2_api_c PRIVATE "-Wl,--section-alignment,16384")
+if (${HOST_ABI} MATCHES "-w64-mingw32")
+ target_link_options(${MONERO_FLAVOR}_wallet2_api_c PRIVATE "-Wl,--section-alignment,16384")
elseif(${HOST_ABI} MATCHES "-linux-")
- target_link_options(wallet2_api_c PRIVATE "-Wl,-z,max-page-size=16384")
+ target_link_options(${MONERO_FLAVOR}_wallet2_api_c PRIVATE "-Wl,-z,max-page-size=16384")
endif()
if(${HOST_ABI} MATCHES "-apple-")
@@ -193,7 +133,7 @@ if(${HOST_ABI} MATCHES "-apple-")
)
endif()
-target_link_libraries( wallet2_api_c
+target_link_libraries( ${MONERO_FLAVOR}_wallet2_api_c
${WALLET_TARGETS}
${EXTRA_LIBS_WOWNEROSEED}
diff --git a/monero_libwallet2_api_c/monero_libwallet2_api_c.exp b/monero_libwallet2_api_c/monero_libwallet2_api_c.exp
index 1aa2f26..0c59e1a 100644
--- a/monero_libwallet2_api_c/monero_libwallet2_api_c.exp
+++ b/monero_libwallet2_api_c/monero_libwallet2_api_c.exp
@@ -308,3 +308,43 @@ _MONERO_free
_MONERO_checksum_wallet2_api_c_h
_MONERO_checksum_wallet2_api_c_cpp
_MONERO_checksum_wallet2_api_c_exp
+_MONERO_NetworkType_MAINNET
+_MONERO_NetworkType_TESTNET
+_MONERO_NetworkType_STAGENET
+_MONERO_PendingTransactionStatus_Ok
+_MONERO_PendingTransactionStatus_Error
+_MONERO_PendingTransactionStatus_Critical
+_MONERO_Priority_Default
+_MONERO_Priority_Low
+_MONERO_Priority_Medium
+_MONERO_Priority_High
+_MONERO_Priority_Last
+_MONERO_WalletDevice_Software
+_MONERO_WalletDevice_Ledger
+_MONERO_WalletDevice_Trezor
+_MONERO_WalletStatus_Ok
+_MONERO_WalletStatus_Error
+_MONERO_WalletStatus_Critical
+_MONERO_WalletConnectionStatus_Disconnected
+_MONERO_WalletConnectionStatus_Connected
+_MONERO_WalletConnectionStatus_WrongVersion
+_MONERO_WalletBackgroundSync_Off
+_MONERO_WalletBackgroundSync_ReusePassword
+_MONERO_WalletBackgroundSync_CustomPassword
+_MONERO_LogLevel_Silent
+_MONERO_LogLevel_0
+_MONERO_LogLevel_1
+_MONERO_LogLevel_2
+_MONERO_LogLevel_3
+_MONERO_LogLevel_4
+_MONERO_LogLevel_Min
+_MONERO_LogLevel_Max
+_MONERO_UnsignedTransactionStatus_Ok
+_MONERO_UnsignedTransactionStatus_Error
+_MONERO_UnsignedTransactionStatus_Critical
+_MONERO_TransactionInfoDirection_In
+_MONERO_TransactionInfoDirection_Out
+_MONERO_AddressBookErrorCodeStatus_Ok
+_MONERO_AddressBookErrorCodeGeneral_Error
+_MONERO_AddressBookErrorCodeInvalid_Address
+_MONERO_AddressBookErrorCodeInvalidPaymentId
diff --git a/monero_libwallet2_api_c/src/main/cpp/monero_checksum.c b/monero_libwallet2_api_c/src/main/cpp/monero_checksum.c
new file mode 100644
index 0000000..9c12dc5
--- /dev/null
+++ b/monero_libwallet2_api_c/src/main/cpp/monero_checksum.c
@@ -0,0 +1,5 @@
+#include "monero_checksum.h"
+
+const char * MONERO_wallet2_api_c_h_sha256 = "563113bbf36f153d66d6f656ea6f364172a0e801074dcffffab62374a628607f";
+const char * MONERO_wallet2_api_c_cpp_sha256 = "5231bad07c802e88fc17781b71e85fce7a0dc750301893482577558aa56f925d-dbcc7d212c094bd1a45f7291dbb99a4b4627a96d";
+const char * MONERO_wallet2_api_c_exp_sha256 = "d873158058e22fabba8d809e9c6cdf633e1b6b2bd78ee5b617435b66131ce600";
diff --git a/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h b/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h
index 55acabb..3f1691a 100644
--- a/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h
+++ b/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h
@@ -1,6 +1,22 @@
-#ifndef MONEROC_CHECKSUMS
-#define MONEROC_CHECKSUMS
-const char * MONERO_wallet2_api_c_h_sha256 = "3515e4c9e537ca3efa664f0b364a3aeb106ff64337f542a262ce104c00b31235";
-const char * MONERO_wallet2_api_c_cpp_sha256 = "ca44a8d4a201ba6dc0a25c857e95d07bc8d514039b38cd5b3826100e8943cbcc-dbcc7d212c094bd1a45f7291dbb99a4b4627a96d";
-const char * MONERO_wallet2_api_c_exp_sha256 = "0561e14606106e6b0ec49fb2aefe743ff500f7c3de07557f7041e06aef9509ce";
+#ifndef MONEROC_CHECKSUMS_MONERO
+#define MONEROC_CHECKSUMS_MONERO
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifdef __MINGW32__
+ #define ADDAPI __declspec(dllexport)
+#else
+ #define ADDAPI __attribute__((__visibility__("default")))
+#endif
+
+extern ADDAPI const char * MONERO_wallet2_api_c_h_sha256;
+extern ADDAPI const char * MONERO_wallet2_api_c_cpp_sha256;
+extern ADDAPI const char * MONERO_wallet2_api_c_exp_sha256;
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp b/monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.cpp
index c58fbec..ef48447 100644
--- a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp
+++ b/monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.cpp
@@ -1,5 +1,5 @@
#include <inttypes.h>
-#include "wallet2_api_c.h"
+#include "monero_wallet2_api_c.h"
#include <unistd.h>
#include "helpers.hpp"
#include <cstring>
@@ -37,7 +37,7 @@ extern "C"
// Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); <------------ We are converting the void* into Monero::Wallet*
// Monero::optional<uint64_t> optAmount; <------------- optional by default
// if (amount != 0) {------------------\ We set this optional parameter only when it isn't zero
-// optAmount = amount; |
+// optAmount = amount; |
// }___________________________________/
// std::set<uint32_t> subaddr_indices = {}; ------------- Default value
// std::set<std::string> preferred_inputs = splitString(std::string(preferredInputs), std::string(separator)); <------------- We are using helpers.cpp function to split a string into std::set
@@ -60,8 +60,21 @@ extern "C"
//
//
+const int MONERO_NetworkType_MAINNET = 0;
+const int MONERO_NetworkType_TESTNET = 1;
+const int MONERO_NetworkType_STAGENET = 2;
+
// PendingTransaction
+const int MONERO_PendingTransactionStatus_Ok = 0;
+const int MONERO_PendingTransactionStatus_Error = 1;
+const int MONERO_PendingTransactionStatus_Critical = 2;
+const int MONERO_Priority_Default = 0;
+const int MONERO_Priority_Low = 1;
+const int MONERO_Priority_Medium = 2;
+const int MONERO_Priority_High = 3;
+const int MONERO_Priority_Last = 4;
+
int MONERO_PendingTransaction_status(void* pendingTx_ptr) {
DEBUG_START()
Monero::PendingTransaction *pendingTx = reinterpret_cast<Monero::PendingTransaction*>(pendingTx_ptr);
@@ -181,6 +194,10 @@ const char* MONERO_PendingTransaction_txKey(void* pendingTx_ptr, const char* sep
// UnsignedTransaction
+const int MONERO_UnsignedTransactionStatus_Ok = 0;
+const int MONERO_UnsignedTransactionStatus_Error = 1;
+const int MONERO_UnsignedTransactionStatus_Critical = 2;
+
int MONERO_UnsignedTransaction_status(void* unsignedTx_ptr) {
DEBUG_START()
Monero::UnsignedTransaction *unsignedTx = reinterpret_cast<Monero::UnsignedTransaction*>(unsignedTx_ptr);
@@ -266,6 +283,9 @@ const char* MONERO_UnsignedTransaction_signUR(void* unsignedTx_ptr, int max_frag
DEBUG_END()
}
// TransactionInfo
+
+const int MONERO_TransactionInfoDirection_In = 0;
+const int MONERO_TransactionInfoDirection_Out = 1;
int MONERO_TransactionInfo_direction(void* txInfo_ptr) {
DEBUG_START()
Monero::TransactionInfo *txInfo = reinterpret_cast<Monero::TransactionInfo*>(txInfo_ptr);
@@ -454,7 +474,7 @@ const char* MONERO_AddressBookRow_extra(void* addressBookRow_ptr) {
return buffer;
DEBUG_END()
}
-// std::string getAddress() const {return m_address;}
+// std::string getAddress() const {return m_address;}
const char* MONERO_AddressBookRow_getAddress(void* addressBookRow_ptr) {
DEBUG_START()
Monero::AddressBookRow *addressBookRow = reinterpret_cast<Monero::AddressBookRow*>(addressBookRow_ptr);
@@ -465,7 +485,7 @@ const char* MONERO_AddressBookRow_getAddress(void* addressBookRow_ptr) {
return buffer;
DEBUG_END()
}
-// std::string getDescription() const {return m_description;}
+// std::string getDescription() const {return m_description;}
const char* MONERO_AddressBookRow_getDescription(void* addressBookRow_ptr) {
DEBUG_START()
Monero::AddressBookRow *addressBookRow = reinterpret_cast<Monero::AddressBookRow*>(addressBookRow_ptr);
@@ -476,7 +496,7 @@ const char* MONERO_AddressBookRow_getDescription(void* addressBookRow_ptr) {
return buffer;
DEBUG_END()
}
-// std::string getPaymentId() const {return m_paymentId;}
+// std::string getPaymentId() const {return m_paymentId;}
const char* MONERO_AddressBookRow_getPaymentId(void* addressBookRow_ptr) {
DEBUG_START()
Monero::AddressBookRow *addressBookRow = reinterpret_cast<Monero::AddressBookRow*>(addressBookRow_ptr);
@@ -496,6 +516,12 @@ size_t MONERO_AddressBookRow_getRowId(void* addressBookRow_ptr) {
}
// AddressBook
+
+const int MONERO_AddressBookErrorCodeStatus_Ok = 0;
+const int MONERO_AddressBookErrorCodeGeneral_Error = 1;
+const int MONERO_AddressBookErrorCodeInvalid_Address = 2;
+const int MONERO_AddressBookErrorCodeInvalidPaymentId = 3;
+
// virtual std::vector<AddressBookRow*> getAll() const = 0;
int MONERO_AddressBook_getAll_size(void* addressBook_ptr) {
DEBUG_START()
@@ -509,7 +535,7 @@ void* MONERO_AddressBook_getAll_byIndex(void* addressBook_ptr, int index) {
return addressBook->getAll()[index];
DEBUG_END()
}
-// virtual bool addRow(const std::string &dst_addr , const std::string &payment_id, const std::string &description) = 0;
+// virtual bool addRow(const std::string &dst_addr , const std::string &payment_id, const std::string &description) = 0;
bool MONERO_AddressBook_addRow(void* addressBook_ptr, const char* dst_addr , const char* payment_id, const char* description) {
DEBUG_START()
Monero::AddressBook *addressBook = reinterpret_cast<Monero::AddressBook*>(addressBook_ptr);
@@ -530,7 +556,7 @@ bool MONERO_AddressBook_setDescription(void* addressBook_ptr, size_t rowId, cons
return addressBook->setDescription(rowId, std::string(description));
DEBUG_END()
}
-// virtual void refresh() = 0;
+// virtual void refresh() = 0;
void MONERO_AddressBook_refresh(void* addressBook_ptr) {
DEBUG_START()
Monero::AddressBook *addressBook = reinterpret_cast<Monero::AddressBook*>(addressBook_ptr);
@@ -1049,6 +1075,19 @@ bool MONERO_DeviceProgress_indeterminate(void* deviceProgress_ptr) {
DEBUG_END()
}
+const int MONERO_WalletDevice_Software = 0;
+const int MONERO_WalletDevice_Ledger = 1;
+const int MONERO_WalletDevice_Trezor = 2;
+const int MONERO_WalletStatus_Ok = 0;
+const int MONERO_WalletStatus_Error = 1;
+const int MONERO_WalletStatus_Critical = 2;
+const int MONERO_WalletConnectionStatus_Disconnected = 0;
+const int MONERO_WalletConnectionStatus_Connected = 1;
+const int MONERO_WalletConnectionStatus_WrongVersion = 2;
+const int MONERO_WalletBackgroundSync_Off = 0;
+const int MONERO_WalletBackgroundSync_ReusePassword = 1;
+const int MONERO_WalletBackgroundSync_CustomPassword = 2;
+
// Wallet
const char* MONERO_Wallet_seed(void* wallet_ptr, const char* seed_offset) {
@@ -1341,6 +1380,15 @@ bool MONERO_Wallet_setProxy(void* wallet_ptr, const char* address) {
DEBUG_END()
}
+const int MONERO_LogLevel_Silent = -1;
+const int MONERO_LogLevel_0 = 0;
+const int MONERO_LogLevel_1 = 1;
+const int MONERO_LogLevel_2 = 2;
+const int MONERO_LogLevel_3 = 3;
+const int MONERO_LogLevel_4 = 4;
+const int MONERO_LogLevel_Min = MONERO_LogLevel_Silent;
+const int MONERO_LogLevel_Max = MONERO_LogLevel_4;
+
uint64_t MONERO_Wallet_balance(void* wallet_ptr, uint32_t accountIndex) {
DEBUG_START()
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
@@ -1515,8 +1563,6 @@ const char* MONERO_Wallet_createPolyseed(const char* language) {
std::string seed_words = "";
std::string err;
Monero::Wallet::createPolyseed(seed_words, err, std::string(language));
- std::cout << "MONERO_Wallet_createPolyseed(language: " << language << "):" << std::endl;
- std::cout << " err: " << err << std::endl;
std::string str = seed_words;
const std::string::size_type size = str.size();
char *buffer = new char[size + 1]; //we need extra char for NUL
@@ -1659,7 +1705,7 @@ const char* MONERO_Wallet_exchangeMultisigKeys(void* wallet_ptr, const char* inf
const char* MONERO_Wallet_exportMultisigImages(void* wallet_ptr, const char* separator) {
DEBUG_START()
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
- std::string str;
+ std::string str;
wallet->exportMultisigImages(str);
const std::string::size_type size = str.size();
char *buffer = new char[size + 1]; //we need extra char for NUL
@@ -2449,7 +2495,7 @@ void MONERO_WalletManagerFactory_setLogCategories(const char* categories) {
// 2) int
// 3) uint64_t
// 4) void*
-// 5) const char*
+// 5) const char*
void MONERO_DEBUG_test0() {
return;
@@ -2473,13 +2519,13 @@ void* MONERO_DEBUG_test4(uint64_t x) {
}
const char* MONERO_DEBUG_test5() {
- const char *text = "This is a const char* text";
+ const char *text = "This is a const char* text";
return text;
}
const char* MONERO_DEBUG_test5_std() {
std::string text("This is a std::string text");
- const char *text2 = "This is a text";
+ const char *text2 = "This is a text";
return text2;
}
diff --git a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h b/monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.h
index ff28d68..39bca89 100644
--- a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h
+++ b/monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.h
@@ -6,6 +6,11 @@
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
*/
+
+#ifndef MONERO_LIBWALLET2_API_C_H
+#define MONERO_LIBWALLET2_API_C_H
+
+
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
@@ -26,11 +31,11 @@ extern "C"
// namespace Monero {
// enum NetworkType : uint8_t {
// MAINNET = 0,
-const int NetworkType_MAINNET = 0;
+extern ADDAPI const int MONERO_NetworkType_MAINNET;
// TESTNET,
-const int NetworkType_TESTNET = 1;
+extern ADDAPI const int MONERO_NetworkType_TESTNET;
// STAGENET
-const int NetworkType_STAGENET = 2;
+extern ADDAPI const int MONERO_NetworkType_STAGENET;
// };
// namespace Utils {
// bool isAddressLocal(const std::string &hostaddr);
@@ -53,23 +58,23 @@ const int NetworkType_STAGENET = 2;
// {
// enum Status {
// Status_Ok,
-const int PendingTransactionStatus_Ok = 0;
+extern ADDAPI const int MONERO_PendingTransactionStatus_Ok;
// Status_Error,
-const int PendingTransactionStatus_Error = 1;
+extern ADDAPI const int MONERO_PendingTransactionStatus_Error;
// Status_Critical
-const int PendingTransactionStatus_Critical = 2;
+extern ADDAPI const int MONERO_PendingTransactionStatus_Critical;
// };
// enum Priority {
// Priority_Default = 0,
-const int Priority_Default = 0;
+extern ADDAPI const int MONERO_Priority_Default;
// Priority_Low = 1,
-const int Priority_Low = 1;
+extern ADDAPI const int MONERO_Priority_Low;
// Priority_Medium = 2,
-const int Priority_Medium = 2;
+extern ADDAPI const int MONERO_Priority_Medium;
// Priority_High = 3,
-const int Priority_High = 3;
+extern ADDAPI const int MONERO_Priority_High;
// Priority_Last
-const int Priority_Last = 4;
+extern ADDAPI const int MONERO_Priority_Last;
// };
// virtual ~PendingTransaction() = 0;
// virtual int status() const = 0;
@@ -109,11 +114,11 @@ extern ADDAPI const char* MONERO_PendingTransaction_hex(void* pendingTx_ptr, con
// {
// enum Status {
// Status_Ok,
-const int UnsignedTransactionStatus_Ok = 0;
+extern ADDAPI const int MONERO_UnsignedTransactionStatus_Ok;
// Status_Error,
-const int UnsignedTransactionStatus_Error = 1;
+extern ADDAPI const int MONERO_UnsignedTransactionStatus_Error;
// Status_Critical
-const int UnsignedTransactionStatus_Critical = 2;
+extern ADDAPI const int MONERO_UnsignedTransactionStatus_Critical;
// };
// virtual ~UnsignedTransaction() = 0;
// virtual int status() const = 0;
@@ -144,9 +149,9 @@ extern ADDAPI const char* MONERO_UnsignedTransaction_signUR(void* unsignedTx_ptr
// {
// enum Direction {
// Direction_In,
-const int TransactionInfoDirection_In = 0;
+extern ADDAPI const int MONERO_TransactionInfoDirection_In;
// Direction_Out
-const int TransactionInfoDirection_Out = 1;
+extern ADDAPI const int MONERO_TransactionInfoDirection_Out;
// };
// struct Transfer {
// Transfer(uint64_t _amount, const std::string &address);
@@ -211,9 +216,9 @@ extern ADDAPI void MONERO_TransactionHistory_setTxNote(void* txHistory_ptr, cons
// AddressBookRow(std::size_t _rowId, const std::string &_address, const std::string &_paymentId, const std::string &_description):
// m_rowId(_rowId),
// m_address(_address),
-// m_paymentId(_paymentId),
+// m_paymentId(_paymentId),
// m_description(_description) {}
-
+
// private:
// std::size_t m_rowId;
// std::string m_address;
@@ -222,11 +227,11 @@ extern ADDAPI void MONERO_TransactionHistory_setTxNote(void* txHistory_ptr, cons
// public:
// std::string extra;
extern ADDAPI const char* MONERO_AddressBookRow_extra(void* addressBookRow_ptr);
-// std::string getAddress() const {return m_address;}
+// std::string getAddress() const {return m_address;}
extern ADDAPI const char* MONERO_AddressBookRow_getAddress(void* addressBookRow_ptr);
-// std::string getDescription() const {return m_description;}
+// std::string getDescription() const {return m_description;}
extern ADDAPI const char* MONERO_AddressBookRow_getDescription(void* addressBookRow_ptr);
-// std::string getPaymentId() const {return m_paymentId;}
+// std::string getPaymentId() const {return m_paymentId;}
extern ADDAPI const char* MONERO_AddressBookRow_getPaymentId(void* addressBookRow_ptr);
// std::size_t getRowId() const {return m_rowId;}
extern ADDAPI size_t MONERO_AddressBookRow_getRowId(void* addressBookRow_ptr);
@@ -235,25 +240,25 @@ extern ADDAPI size_t MONERO_AddressBookRow_getRowId(void* addressBookRow_ptr);
// {
// enum ErrorCode {
// Status_Ok,
-const int AddressBookErrorCodeStatus_Ok = 0;
+extern ADDAPI const int MONERO_AddressBookErrorCodeStatus_Ok;
// General_Error,
-const int AddressBookErrorCodeGeneral_Error = 1;
+extern ADDAPI const int MONERO_AddressBookErrorCodeGeneral_Error;
// Invalid_Address,
-const int AddressBookErrorCodeInvalid_Address = 2;
+extern ADDAPI const int MONERO_AddressBookErrorCodeInvalid_Address;
// Invalid_Payment_Id
-const int AddressBookErrorCodeInvalidPaymentId = 3;
+extern ADDAPI const int MONERO_AddressBookErrorCodeInvalidPaymentId;
// };
// virtual ~AddressBook() = 0;
// virtual std::vector<AddressBookRow*> getAll() const = 0;
extern ADDAPI int MONERO_AddressBook_getAll_size(void* addressBook_ptr);
extern ADDAPI void* MONERO_AddressBook_getAll_byIndex(void* addressBook_ptr, int index);
-// virtual bool addRow(const std::string &dst_addr , const std::string &payment_id, const std::string &description) = 0;
+// virtual bool addRow(const std::string &dst_addr , const std::string &payment_id, const std::string &description) = 0;
extern ADDAPI bool MONERO_AddressBook_addRow(void* addressBook_ptr, const char* dst_addr , const char* payment_id, const char* description);
// virtual bool deleteRow(std::size_t rowId) = 0;
extern ADDAPI bool MONERO_AddressBook_deleteRow(void* addressBook_ptr, size_t rowId);
// virtual bool setDescription(std::size_t index, const std::string &description) = 0;
extern ADDAPI bool MONERO_AddressBook_setDescription(void* addressBook_ptr, size_t rowId, const char* description);
-// virtual void refresh() = 0;
+// virtual void refresh() = 0;
extern ADDAPI void MONERO_AddressBook_refresh(void* addressBook_ptr);
// virtual std::string errorString() const = 0;
extern ADDAPI const char* MONERO_AddressBook_errorString(void* addressBook_ptr);
@@ -339,7 +344,7 @@ extern ADDAPI void MONERO_Coins_setDescription(void* coins_ptr, const char* publ
// m_rowId(_rowId),
// m_address(_address),
// m_label(_label) {}
-
+
// private:
// std::size_t m_rowId;
// std::string m_address;
@@ -467,35 +472,35 @@ extern ADDAPI bool MONERO_DeviceProgress_indeterminate(void* deviceProgress_ptr)
// {
// enum Device {
// Device_Software = 0,
-const int WalletDevice_Software = 0;
+extern ADDAPI const int MONERO_WalletDevice_Software;
// Device_Ledger = 1,
-const int WalletDevice_Ledger = 1;
+extern ADDAPI const int MONERO_WalletDevice_Ledger;
// Device_Trezor = 2
-const int WalletDevice_Trezor = 2;
+extern ADDAPI const int MONERO_WalletDevice_Trezor;
// };
// enum Status {
// Status_Ok,
-const int WalletStatus_Ok = 0;
+extern ADDAPI const int MONERO_WalletStatus_Ok;
// Status_Error,
-const int WalletStatus_Error = 1;
+extern ADDAPI const int MONERO_WalletStatus_Error;
// Status_Critical
-const int WalletStatus_Critical = 2;
+extern ADDAPI const int MONERO_WalletStatus_Critical;
// };
// enum ConnectionStatus {
// ConnectionStatus_Disconnected,
-const int WalletConnectionStatus_Disconnected = 0;
+extern ADDAPI const int MONERO_WalletConnectionStatus_Disconnected;
// ConnectionStatus_Connected,
-const int WalletConnectionStatus_Connected = 1;
+extern ADDAPI const int MONERO_WalletConnectionStatus_Connected;
// ConnectionStatus_WrongVersion
-const int WalletConnectionStatus_WrongVersion = 2;
+extern ADDAPI const int MONERO_WalletConnectionStatus_WrongVersion;
// };
// enum BackgroundSyncType {
// BackgroundSync_Off = 0,
-const int WalletBackgroundSync_Off = 0;
+extern ADDAPI const int MONERO_WalletBackgroundSync_Off;
// BackgroundSync_ReusePassword = 1,
-const int WalletBackgroundSync_ReusePassword = 1;
+extern ADDAPI const int MONERO_WalletBackgroundSync_ReusePassword;
// BackgroundSync_CustomPassword = 2
-const int BackgroundSync_CustomPassword = 2;
+extern ADDAPI const int MONERO_WalletBackgroundSync_CustomPassword;
// };
// virtual ~Wallet() = 0;
// virtual std::string seed(const std::string& seed_offset = "") const = 0;
@@ -528,7 +533,7 @@ extern ADDAPI int MONERO_Wallet_nettype(void* wallet_ptr);
// bool testnet() const { return nettype() == TESTNET; }
// bool stagenet() const { return nettype() == STAGENET; }
// virtual void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const = 0;
-// virtual bool useForkRules(uint8_t version, int64_t early_blocks) const = 0;
+// virtual bool useForkRules(uint8_t version, int64_t early_blocks) const = 0;
extern ADDAPI uint8_t MONERO_Wallet_useForkRules(void* wallet_ptr, uint8_t version, int64_t early_blocks);
// virtual std::string integratedAddress(const std::string &payment_id) const = 0;
extern ADDAPI const char* MONERO_Wallet_integratedAddress(void* wallet_ptr, const char* payment_id);
@@ -894,16 +899,16 @@ extern ADDAPI void* MONERO_WalletManager_createWalletFromKeys(void* wm_ptr, cons
// {
// return createWalletFromKeys(path, password, language, testnet ? TESTNET : MAINNET, restoreHeight, addressString, viewKeyString, spendKeyString);
// }
-// virtual Wallet * createWalletFromKeys(const std::string &path,
+// virtual Wallet * createWalletFromKeys(const std::string &path,
// const std::string &language,
-// NetworkType nettype,
+// NetworkType nettype,
// uint64_t restoreHeight,
// const std::string &addressString,
// const std::string &viewKeyString,
// const std::string &spendKeyString = "") = 0;
-// Wallet * createWalletFromKeys(const std::string &path,
+// Wallet * createWalletFromKeys(const std::string &path,
// const std::string &language,
-// bool testnet,
+// bool testnet,
// uint64_t restoreHeight,
// const std::string &addressString,
// const std::string &viewKeyString,
@@ -983,14 +988,14 @@ extern ADDAPI const char* MONERO_WalletManager_resolveOpenAlias(void* wm_ptr, co
extern ADDAPI bool MONERO_WalletManager_setProxy(void* wm_ptr, const char* address);
// };
-int LogLevel_Silent = -1;
-int LogLevel_0 = 0;
-int LogLevel_1 = 1;
-int LogLevel_2 = 2;
-int LogLevel_3 = 3;
-int LogLevel_4 = 4;
-int LogLevel_Min = -1;
-int LogLevel_Max = 4;
+extern ADDAPI const int MONERO_LogLevel_Silent;
+extern ADDAPI const int MONERO_LogLevel_0;
+extern ADDAPI const int MONERO_LogLevel_1;
+extern ADDAPI const int MONERO_LogLevel_2;
+extern ADDAPI const int MONERO_LogLevel_3;
+extern ADDAPI const int MONERO_LogLevel_4;
+extern ADDAPI const int MONERO_LogLevel_Min;
+extern ADDAPI const int MONERO_LogLevel_Max;
// struct WalletManagerFactory
// {
@@ -1040,3 +1045,5 @@ extern ADDAPI const char* MONERO_checksum_wallet2_api_c_exp();
#ifdef __cplusplus
}
#endif
+
+#endif // MONERO_LIBWALLET2_API_C_H
diff --git a/tests/c/Makefile b/tests/c/Makefile
new file mode 100644
index 0000000..0384acc
--- /dev/null
+++ b/tests/c/Makefile
@@ -0,0 +1,58 @@
+CC ?= gcc
+CFLAGS ?= -Wall -Wextra -O2 -Isrc -I../../monero_libwallet2_api_c/src/main/cpp -Itests
+LDFLAGS ?=
+
+UNAME_S := $(shell uname -s)
+
+ifeq ($(OS),Windows_NT)
+ LIB_EXT := dll
+else ifeq ($(UNAME_S),Darwin)
+ LIB_EXT := dylib
+else
+ LIB_EXT := so
+endif
+
+UNAME_S := $(shell uname -s)
+UNAME_M := $(shell uname -m)
+
+# Normalize architecture
+ifeq ($(UNAME_M),x86_64)
+ ARCH := x86_64
+else ifeq ($(UNAME_M),aarch64)
+ ARCH := aarch64
+else ifeq ($(UNAME_M),arm64)
+ ARCH := aarch64
+else
+ ARCH := $(UNAME_M)
+endif
+
+# Normalize OS
+ifeq ($(UNAME_S),Darwin)
+ OS := apple-darwin
+else ifeq ($(UNAME_S),Linux)
+ OS := linux-gnu
+else
+ OS := unknown-$(shell echo $(UNAME_S) | tr A-Z a-z)
+endif
+
+HOST_ABI := $(ARCH)-$(OS)
+
+LIB_DIR ?= ../../release/$(shell git describe --tags)/$(HOST_ABI)
+
+SRC_DIRS ?= src tests
+SRCS := $(wildcard $(addsuffix /*.c,$(SRC_DIRS)))
+OBJS := $(SRCS:.c=.o)
+TARGET = test_wallet2_api_c
+
+.PHONY: all clean
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+ $(CC) $(OBJS) -o $@ -L$(LIB_DIR) -lmonero_wallet2_api_c -Wl,-rpath,$(LIB_DIR) $(LDFLAGS)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+clean:
+ rm -f $(OBJS) $(TARGET)
diff --git a/tests/c/src/main.c b/tests/c/src/main.c
new file mode 100644
index 0000000..0ae418f
--- /dev/null
+++ b/tests/c/src/main.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "../tests/all.h"
+
+
+int main() {
+ monero_test_creation();
+ monero_test_restore();
+ printf("All tests passed\n");
+ return 0;
+}
diff --git a/tests/c/src/utils.c b/tests/c/src/utils.c
new file mode 100644
index 0000000..9816075
--- /dev/null
+++ b/tests/c/src/utils.c
@@ -0,0 +1,65 @@
+#include "utils.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+char* u_mktemp() {
+ char pattern[] = "/tmp/monero_c_test_XXXXXXXXX";
+
+ char *template = malloc(strlen(pattern) + 1);
+ if (!template) {
+ perror("malloc failed");
+ exit(1);
+ }
+
+ strcpy(template, pattern);
+
+ if (mkdtemp(template) == NULL) {
+ perror("mkdtemp failed");
+ free(template);
+ exit(1);
+ }
+
+ return template;
+}
+
+char* u_cat(const char* a, const char* b) {
+ size_t len_a = strlen(a);
+ size_t len_b = strlen(b);
+
+ char* result = malloc(len_a + len_b + 1);
+ if (!result) {
+ perror("malloc failed");
+ exit(1);
+ }
+
+ memcpy(result, a, len_a);
+ memcpy(result + len_a, b, len_b + 1); // include null terminator
+
+ return result;
+}
+
+int u_wordcount(const char* str) {
+ if (!str) return 0;
+
+ int count = 0;
+ int in_word = 0;
+
+ for (size_t i = 0; str[i]; i++) {
+ // Japan smh ( = 0xE3 0x80 0x80)
+ int is_space = (str[i] == ' ') ||
+ ((unsigned char)str[i] == 0xE3 &&
+ (unsigned char)str[i+1] == 0x80 &&
+ (unsigned char)str[i+2] == 0x80);
+
+ if (is_space) {
+ in_word = 0;
+ } else if (!in_word) {
+ in_word = 1;
+ count++;
+ }
+ }
+
+ return count;
+}
diff --git a/tests/c/src/utils.h b/tests/c/src/utils.h
new file mode 100644
index 0000000..dd99556
--- /dev/null
+++ b/tests/c/src/utils.h
@@ -0,0 +1,8 @@
+#ifndef UTILS_H
+#define UTILS_H
+
+char* u_mktemp();
+char* u_cat(const char* a, const char* b);
+int u_wordcount(const char* str);
+
+#endif // UTILS_H
diff --git a/tests/c/tests/all.h b/tests/c/tests/all.h
new file mode 100644
index 0000000..cba87d8
--- /dev/null
+++ b/tests/c/tests/all.h
@@ -0,0 +1,7 @@
+#ifndef ALL_H
+#define ALL_H
+
+int monero_test_creation();
+int monero_test_restore();
+
+#endif // ALL_H
diff --git a/tests/c/tests/monero_test_creation.c b/tests/c/tests/monero_test_creation.c
new file mode 100644
index 0000000..193cd08
--- /dev/null
+++ b/tests/c/tests/monero_test_creation.c
@@ -0,0 +1,55 @@
+#include "../src/utils.h"
+#include "../../../monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int monero_test_creation_legacy() {
+ printf("monero_test_creation_legacy: ");
+ char* dir = u_mktemp();
+ char* path = u_cat(dir, "/wallet_1");
+ void* wm_ptr = MONERO_WalletManagerFactory_getWalletManager();
+ void* wallet_ptr = MONERO_WalletManager_createWallet(wm_ptr, path, "test", "English", 0);
+ int status = MONERO_Wallet_status(wallet_ptr);
+ if (status != 0) {
+ const char* error = MONERO_Wallet_errorString(wallet_ptr);
+ printf("wallet creation failed: %s\n", error);
+ exit(1);
+ }
+ printf("OK\n");
+ return 0;
+}
+
+
+int monero_test_creation_polyseed() {
+ printf("monero_test_creation_polyseed: ");
+ char* dir = u_mktemp();
+ char* path = u_cat(dir, "/wallet_1");
+ void* wm_ptr = MONERO_WalletManagerFactory_getWalletManager();
+ const char* polyseed = MONERO_Wallet_createPolyseed("English");
+
+ void* wallet_ptr = MONERO_WalletManager_createWalletFromPolyseed(
+ wm_ptr,
+ path,
+ "password",
+ MONERO_NetworkType_MAINNET,
+ polyseed,
+ "",
+ false,
+ 0,
+ 0);
+ int status = MONERO_Wallet_status(wallet_ptr);
+ if (status != 0) {
+ const char* error = MONERO_Wallet_errorString(wallet_ptr);
+ printf("wallet creation failed: %s\n", error);
+ exit(1);
+ }
+ printf("OK\n");
+ return 0;
+}
+
+int monero_test_creation() {
+ monero_test_creation_legacy();
+ monero_test_creation_polyseed();
+ return 0;
+}
diff --git a/tests/c/tests/monero_test_restore.c b/tests/c/tests/monero_test_restore.c
new file mode 100644
index 0000000..ec7cecc
--- /dev/null
+++ b/tests/c/tests/monero_test_restore.c
@@ -0,0 +1,255 @@
+#include <errno.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "../src/utils.h"
+#include "../../../monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.h"
+
+typedef struct {
+ char *name;
+ char *password;
+ char *seed;
+ unsigned long long restoreHeight;
+ char *address;
+ char *publicSpendKey;
+ char *secretSpendKey;
+ char *publicViewKey;
+ char *secretViewKey;
+ char *offset;
+} Wallet;
+
+Wallet moneroWallets[] = {
+ {
+ .name = "English Wallet",
+ .password = "englishwallet",
+ .seed = "tortoise winter play argue laptop diary tell library travel cupboard view river embark rubber plunge student",
+ .restoreHeight = 3230397,
+ .address = "49PL6qHMkc4Hw3dWT5wy5NbbVd2xda8zw3tLx2BoQsNZUWDQYYpwMEKjB9BLbEKSo3S3z34bncFw6ijToTwfiEJJ5m8aefx",
+ .publicSpendKey = "ccd6846ab69fdd653a8d092d89590dced40aa2862f3c24113fedfcd6469162a4",
+ .secretSpendKey = "37fd2e3e933c8468beb407e5350789e23bed5df33eeeb35d3b119401988e6709",
+ .publicViewKey = "6f0de7385aafd4fc259cbd0abb069295c5d3824b7e1b81f97ffcf8cccde6c72a",
+ .secretViewKey = "b8095208d61fc22e4ee3a79347a889e4872cdcf1cceff991542834cef5375907",
+ },
+ {
+ .name = "Chinese Traditional Wallet",
+ .password = "chinesetraditionalwallet",
+ .seed = "旗 铁 革 酯 紧 毅 饱 应 第 兄 植 隙 点 吐 童 赞",
+ .restoreHeight = 3230397,
+ .address = "4AR8YW51Ga3DR4a47F5J8rXaqyBa8pnnF557pTyt52ZqNMFa3gfxvi13R7sbt5zHfjbF5aKsLFZQrRod3qcr5MQj4f91rLh",
+ .publicSpendKey = "e80bab7b3e2d384a393b825cf4f2abb6d8d08f1742d87c1856c064a609a0647f",
+ .secretSpendKey = "c7de78f9819db6755e14d2e1411f1591c2d0b3a6ee19049c30e270f81eb50401",
+ .publicViewKey = "a366527c3a6d160e717ebaac11d08eccb95586991a4c87944ad750331adac020",
+ .secretViewKey = "aab2ea0dc6fa2745c8c7113399242c03300664a21cac9202c315ad789b67d004",
+ },
+ {
+ .name = "Chinese Simplified Wallet",
+ .password = "chinesesimplifiedwallet",
+ .seed = "纹 触 集 驶 朋 辨 你 版 是 益 驳 修 偏 汽 录 吨",
+ .restoreHeight = 3230397,
+ .address = "47E7p1mFGNj59QNfjpXcopP1YZuGdn7NhYJv25xbPKdicnThww5DUv2aNMH7oPWsKZjQQmXMkBzUze2T6gAaXafLAF9E4Dz",
+ .publicSpendKey = "93dec0155d30b818c7d64a0b0c3a678395e3e28bdd736abb2ef7c360b38449d5",
+ .secretSpendKey = "60084b4ff3d99d6ca38876078721c13692635429c74ef5d71f03310cf2e0690b",
+ .publicViewKey = "eff74761051a2fc77eac4d7ed1b564fd83c0e3e924199bdd5ba66b4bf4ecf351",
+ .secretViewKey = "3bde0d3a1bd2877f75fc9f6ea331c976d26a62e469db1d11ddaef2cce9405d02",
+ },
+ {
+ .name = "Japanese Wallet",
+ .password = "japanesewallet",
+ .seed = "きほん ことば そうび きどう なまえ ひさしぶり ごうけい ふひょう ぎゅうにく しはらい きびしい はんとし ととのえる たかい とかい るりがわら",
+ .restoreHeight = 3230397 ,
+ .address = "45YYsW5do7NjGSaRZPAkPQ9mi4HQsMv3w86HFddtkZi4cCbqtFiVoqJjdFobCtCwpBPZWSnUtmrU2G9fLpEE7vsQU3aZyeE",
+ .publicSpendKey = "677ac034b7c3e9fcb178370e3df067346ff5703db8273e2a65010862a85935d2",
+ .secretSpendKey = "1fe9110cc46c58ed0f5cb6c6e189e246f6c3cfbf459de2ed1565838b6e08780e",
+ .publicViewKey = "7276d8537e0cd9fed6b9327177ed9086e159f7d63b9fb35a92693cdbf322ffef",
+ .secretViewKey = "f3c8f4121cdf07616453f005e7f2cf0474cf3608ec632f4e81165ec1c5b4aa0c",
+ },
+ {
+ .name = "Korean Wallet",
+ .password = "koreanwallet",
+ .seed = "단골 운전 일대 제작 구역 보자기 대한민국 답장 쇼핑 논문 편견 대전 충돌 강당 형제 볼펜",
+ .restoreHeight = 3230397,
+ .address = "42DNYppLMXki8j3urYuXaTU1S9EBrSJ71aVNbzr4fKfnXryMwJ2rFt6Y5eCP9vpej9AdrZqNFXDFB1VmkjzjX5e5URJ9q8c",
+ .publicSpendKey = "0f96caeac7cd4ff5eb55810b4eb87ca1779637e949d138c837fe9a776b3c51b8",
+ .secretSpendKey = "d86c40f13694e7511499cdb22db4e96ee2990cfffde52274248bb8818a36c406",
+ .publicViewKey = "826438a35b0f63b9d0b877269a0468399b3f60513e079602f73c4b0f7cd0e6f3",
+ .secretViewKey = "3773b61c0cac3a2e15d03b989461704c6e90916561c6b98d035bd3d2caf88c05",
+ },
+ {
+ .name = "Portugese Wallet",
+ .password = "portugesewallet",
+ .seed = "inscrito raposa vermelho medusa apetite bacharel quantia usado poupar pilotar sigilo ideia robalo ignorado desgaste intimar",
+ .restoreHeight = 3230397,
+ .address = "43xw29tpLnU5VaPZ8Nuzz7DqrnUip5tmWBn3aukkZAyzgHTscJHvESy6pmYutLebQAB9TJgGhoCAWhPK6WJ39CpiD29fbwj",
+ .publicSpendKey = "3dcbbde593acc11adc291eeeec8bc44cc7943192d54fb1406de435b4d7b73dea",
+ .secretSpendKey = "9b94f57038b07b8280f27cedbed6e53472b48fe4683de15cc9e034fdddfcbb05",
+ .publicViewKey = "dce02ef2ca595e22d1242a53b5235f3ca8508e22386d03f171bc77ef856e1b6a",
+ .secretViewKey = "27bdd486a74f9b7c7a79c39c8ff7438a3fc862bb1ec3f6ef035a8acedf876705",
+ },
+ {
+ .name = "Czech Wallet",
+ .password = "czechwallet",
+ .seed = "ulice louskat odmlka parodie dominant slanina sukno vodivost zimnice vykonat sundat kalibr dobro moucha kometa legenda",
+ .restoreHeight = 3230397,
+ .address = "499LrJgGPkFA1BPvF4xqr5bwZfKyCZah1C2CEhvqpW7YGQddwWYyR2L1F1TJhqyxxwa4TXKYZM4bb8ukq3kein1cPMNLLi4",
+ .publicSpendKey = "c6796799947e0c35d3720af264d6a6d0e5a574cea1cde441e343b828a00c875c",
+ .secretSpendKey = "61f9c86a71744a101c36b5628c1c4324e49e84861f136cbd2d0f1477ba5ace0b",
+ .publicViewKey = "1d75ed535e3dfd0171a4a714aef368c5a6862aaf9972422f49cd76d232f88fc6",
+ .secretViewKey = "47fd8eadc1848a09b343815a74185835a0b2cc8567e61022322dd52f6aaf2004",
+ },
+ {
+ .name = "Spanish Wallet",
+ .password = "spanishwallet",
+ .seed = "rehén torpedo remo existir fuente dama culpa riqueza cebolla supremo vereda odio novio sumar espía margen",
+ .restoreHeight = 3230397,
+ .address = "41xeBwVJEpVVrJntrvUXafJR4mk9x3tfW3zXxamh8G951SM9BbBLgJSgzwdCywLRrbZvipLL2Azu9jKbu4Y9Hey3MUF6f19",
+ .publicSpendKey = "08e31c09ad35beac7bcb9e4a689e40681df1b42cd2686511e344d02606bfc802",
+ .secretSpendKey = "19ae689bdd594fde5d06b66e4c7a89d9783c02694ae615e33928b38f0c52120c",
+ .publicViewKey = "9cdf4adfd9c7c7ef236c9084a0ceb4c4da6017b9fd1b6cfd04e02527ea6f06b5",
+ .secretViewKey = "40ae98266cadfbf546e861cac2b2e93ce921f9db2e02f072d86aea274a182006",
+ },
+ {
+ .name = "Italian Wallet",
+ .password = "italianwallet",
+ .seed = "fuso rinvenire astenuto camicia erboso icona bollito esito spettrale abisso dogma appunto prefisso gracile podismo araldica",
+ .restoreHeight = 3230397,
+ .address = "46Kkbh8jLorHRKJEV7C4hNczZknHeB6w4GHpLWkpfThMdPLeeU8MFRmDfMqioYyacCTAG9wZ9y9UHZDNhehEssDVHePj3Ja",
+ .publicSpendKey = "7c0b928d9d8349622a07673a9721e9d72f60ccfc8e83935b699c379999104cd9",
+ .secretSpendKey = "673b61bdb369cc61a022e0eab47e5e41cf86e99a80979f75ebcda1219ee0ab01",
+ .publicViewKey = "8858e908f756c44bb286d5b657824d9c660386c7db0b0ec0974d268a7432bc93",
+ .secretViewKey = "5012dbfa9e1cd2a30c2a18654dc9c8bee128af8fe7246c46e5f4def76705fe0f",
+ },
+ {
+ .name = "English Wallet (offset)",
+ .password = "englishwallet",
+ .seed = "loud fix cattle broken right main web rather write aunt left nation broken ship program ten",
+ .offset = "englishoffset",
+ .restoreHeight = 3230397,
+ .address = "4B2QGWy9as7bwwLNq2DQ26Q3woahpTLbR7d8vJE1uKL5gobU9iMydFqbVrYa9ixfrnAvnuwT9BXpkBx1APocbJfb2drFuQi",
+ .publicSpendKey = "f817ca86625d1ed0ef81ccb8a4e82b89cfc3345512c7b82798ba2f5982b7daed",
+ .secretSpendKey = "39ae15e92e08a0903652b4b0f187d740d2a5bf08e77879babb345b9a78ca6504",
+ .publicViewKey = "f7fb585b9a288cce3f3b1a5f0ca6873b5a2fef8afb3bd94174ac31cbed53620e",
+ .secretViewKey = "d5676e49438b0cd38c6a699ab783c11f21e1a7ebc1c9174121e37456a97f380d",
+ },
+};
+
+size_t moneroWalletsCount = sizeof(moneroWallets) / sizeof(moneroWallets[0]);
+
+int monero_test_restore() {
+ printf("monero_test_restore: BEGIN\n");
+ for (size_t i = 0; i < moneroWalletsCount; i++) {
+ Wallet *wallet = &moneroWallets[i];
+
+ char *dir = u_mktemp();
+ char *name = u_cat(dir, "/wallet_");
+ char *path = u_cat(name, wallet->name);
+ free(name);
+
+ printf(" - %s: ", wallet->name);
+ void* wm_ptr = MONERO_WalletManagerFactory_getWalletManager();
+ const char* offset = wallet->offset ? wallet->offset : "";
+ void* wallet_ptr;
+
+ int seedWordCount = u_wordcount(wallet->seed);
+ switch (seedWordCount) {
+ case 16:
+ wallet_ptr = MONERO_WalletManager_createWalletFromPolyseed(
+ wm_ptr,
+ path,
+ wallet->password,
+ MONERO_NetworkType_MAINNET,
+ wallet->seed,
+ offset,
+ false,
+ wallet->restoreHeight,
+ 0);
+ break;
+ case 25:
+ wallet_ptr = MONERO_WalletManager_recoveryWallet(
+ wm_ptr,
+ path,
+ wallet->password,
+ wallet->seed,
+ MONERO_NetworkType_MAINNET,
+ wallet->restoreHeight,
+ 0,
+ offset);
+ break;
+ default:
+ printf("unsupported seed word count: %d\n", seedWordCount);
+ exit(1);
+ }
+
+
+ int status = MONERO_Wallet_status(wallet_ptr);
+ if (status != 0) {
+ const char* error = MONERO_Wallet_errorString(wallet_ptr);
+ printf("wallet creation failed: %s\n", error);
+ exit(1);
+ }
+
+ bool result = MONERO_Wallet_init(wallet_ptr, "", 0, "", "", false, false, "");
+ if (!result) {
+ const char* error = MONERO_Wallet_errorString(wallet_ptr);
+ printf("wallet init failed: %s\n", error);
+ exit(1);
+ }
+
+ // const char* password = MONERO_Wallet_getPassword(wallet_ptr);
+ // if (strcmp(password, wallet->password) != 0) {
+ // printf("wallet password mismatch (%s vs %s)\n", password, wallet->password);
+ // exit(1);
+ // }
+
+ if (seedWordCount == 25) {
+ const char* seed = MONERO_Wallet_seed(wallet_ptr, wallet->offset);
+ if (strcmp(seed, wallet->seed) != 0) {
+ printf("wallet seed mismatch\n");
+ exit(1);
+ }
+ }
+
+ uint64_t restoreHeight = MONERO_Wallet_getRefreshFromBlockHeight(wallet_ptr);
+ if (restoreHeight != wallet->restoreHeight) {
+ printf("wallet restore height mismatch (%llu vs %llu)\n", restoreHeight, wallet->restoreHeight);
+ exit(1);
+ }
+
+ const char* address = MONERO_Wallet_address(wallet_ptr, 0, 0);
+ if (strcmp(address, wallet->address) != 0) {
+ printf("wallet address mismatch\n");
+ exit(1);
+ }
+
+ const char* publicSpendKey = MONERO_Wallet_publicSpendKey(wallet_ptr);
+ if (strcmp(publicSpendKey, wallet->publicSpendKey) != 0) {
+ printf("wallet public spend key mismatch\n");
+ exit(1);
+ }
+
+ const char* secretSpendKey = MONERO_Wallet_secretSpendKey(wallet_ptr);
+ if (strcmp(secretSpendKey, wallet->secretSpendKey) != 0) {
+ printf("wallet secret spend key mismatch\n");
+ exit(1);
+ }
+
+ const char* publicViewKey = MONERO_Wallet_publicViewKey(wallet_ptr);
+ if (strcmp(publicViewKey, wallet->publicViewKey) != 0) {
+ printf("wallet public view key mismatch\n");
+ exit(1);
+ }
+
+ const char* secretViewKey = MONERO_Wallet_secretViewKey(wallet_ptr);
+ if (strcmp(secretViewKey, wallet->secretViewKey) != 0) {
+ printf("wallet secret view key mismatch\n");
+ exit(1);
+ }
+
+ free(dir);
+ free(path);
+ printf("OK\n");
+ }
+ printf("monero_test_restore: END\n");
+ return 0;
+}
diff --git a/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.c b/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.c
new file mode 100644
index 0000000..b6a503c
--- /dev/null
+++ b/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.c
@@ -0,0 +1,5 @@
+#include "wownero_checksum.h"
+
+const char * WOWNERO_wallet2_api_c_h_sha256 = "f99009d1ca1d1c783cc9aa0fb63f680d48753b88124fb5de2079c57b7e34c827";
+const char * WOWNERO_wallet2_api_c_cpp_sha256 = "4da7caa6ed47e95f0d1ee62315e46d3d9200d32cc6c49dbcadfc0ad053799ea6-cfd2a696245be112a01936d1f2f41b6eb7558376";
+const char * WOWNERO_wallet2_api_c_exp_sha256 = "5f53ea8bbe66a5e5aa6cbc4ca00695900e08589cfd32062e88965a24252d05ba";
diff --git a/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h b/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h
index 59f205c..3022e30 100644
--- a/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h
+++ b/wownero_libwallet2_api_c/src/main/cpp/wownero_checksum.h
@@ -1,6 +1,21 @@
-#ifndef MONEROC_CHECKSUMS
-#define MONEROC_CHECKSUMS
-const char * WOWNERO_wallet2_api_c_h_sha256 = "f99009d1ca1d1c783cc9aa0fb63f680d48753b88124fb5de2079c57b7e34c827";
-const char * WOWNERO_wallet2_api_c_cpp_sha256 = "70b39a0bef660cb9ba0397117eb1590e18461ace89ab18141690658a2a537d5d-cfd2a696245be112a01936d1f2f41b6eb7558376";
-const char * WOWNERO_wallet2_api_c_exp_sha256 = "5f53ea8bbe66a5e5aa6cbc4ca00695900e08589cfd32062e88965a24252d05ba";
+#ifndef MONEROC_CHECKSUMS_WOWNERO
+#define MONEROC_CHECKSUMS_WOWNERO
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifdef __MINGW32__
+ #define ADDAPI __declspec(dllexport)
+#else
+ #define ADDAPI __attribute__((__visibility__("default")))
+#endif
+
+extern ADDAPI const char * WOWNERO_wallet2_api_c_h_sha256;
+extern ADDAPI const char * WOWNERO_wallet2_api_c_cpp_sha256;
+extern ADDAPI const char * WOWNERO_wallet2_api_c_exp_sha256;
+
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/wownero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp b/wownero_libwallet2_api_c/src/main/cpp/wownero_wallet2_api_c.cpp
index 44887f6..7e15211 100644
--- a/wownero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp
+++ b/wownero_libwallet2_api_c/src/main/cpp/wownero_wallet2_api_c.cpp
@@ -1,5 +1,5 @@
#include <inttypes.h>
-#include "wallet2_api_c.h"
+#include "wownero_wallet2_api_c.h"
#include <unistd.h>
#include "helpers.hpp"
#include <cstring>
@@ -38,7 +38,7 @@ extern "C"
// Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); <------------ We are converting the void* into Monero::Wallet*
// Monero::optional<uint64_t> optAmount; <------------- optional by default
// if (amount != 0) {------------------\ We set this optional parameter only when it isn't zero
-// optAmount = amount; |
+// optAmount = amount; |
// }___________________________________/
// std::set<uint32_t> subaddr_indices = {}; ------------- Default value
// std::set<std::string> preferred_inputs = splitString(std::string(preferredInputs), std::string(separator)); <------------- We are using helpers.cpp function to split a string into std::set
@@ -442,7 +442,7 @@ const char* WOWNERO_AddressBookRow_extra(void* addressBookRow_ptr) {
return buffer;
DEBUG_END()
}
-// std::string getAddress() const {return m_address;}
+// std::string getAddress() const {return m_address;}
const char* WOWNERO_AddressBookRow_getAddress(void* addressBookRow_ptr) {
DEBUG_START()
Monero::AddressBookRow *addressBookRow = reinterpret_cast<Monero::AddressBookRow*>(addressBookRow_ptr);
@@ -453,7 +453,7 @@ const char* WOWNERO_AddressBookRow_getAddress(void* addressBookRow_ptr) {
return buffer;
DEBUG_END()
}
-// std::string getDescription() const {return m_description;}
+// std::string getDescription() const {return m_description;}
const char* WOWNERO_AddressBookRow_getDescription(void* addressBookRow_ptr) {
DEBUG_START()
Monero::AddressBookRow *addressBookRow = reinterpret_cast<Monero::AddressBookRow*>(addressBookRow_ptr);
@@ -464,7 +464,7 @@ const char* WOWNERO_AddressBookRow_getDescription(void* addressBookRow_ptr) {
return buffer;
DEBUG_END()
}
-// std::string getPaymentId() const {return m_paymentId;}
+// std::string getPaymentId() const {return m_paymentId;}
const char* WOWNERO_AddressBookRow_getPaymentId(void* addressBookRow_ptr) {
DEBUG_START()
Monero::AddressBookRow *addressBookRow = reinterpret_cast<Monero::AddressBookRow*>(addressBookRow_ptr);
@@ -497,7 +497,7 @@ void* WOWNERO_AddressBook_getAll_byIndex(void* addressBook_ptr, int index) {
return addressBook->getAll()[index];
DEBUG_END()
}
-// virtual bool addRow(const std::string &dst_addr , const std::string &payment_id, const std::string &description) = 0;
+// virtual bool addRow(const std::string &dst_addr , const std::string &payment_id, const std::string &description) = 0;
bool WOWNERO_AddressBook_addRow(void* addressBook_ptr, const char* dst_addr , const char* payment_id, const char* description) {
DEBUG_START()
Monero::AddressBook *addressBook = reinterpret_cast<Monero::AddressBook*>(addressBook_ptr);
@@ -518,7 +518,7 @@ bool WOWNERO_AddressBook_setDescription(void* addressBook_ptr, size_t rowId, con
return addressBook->setDescription(rowId, std::string(description));
DEBUG_END()
}
-// virtual void refresh() = 0;
+// virtual void refresh() = 0;
void WOWNERO_AddressBook_refresh(void* addressBook_ptr) {
DEBUG_START()
Monero::AddressBook *addressBook = reinterpret_cast<Monero::AddressBook*>(addressBook_ptr);
@@ -1502,8 +1502,6 @@ const char* WOWNERO_Wallet_createPolyseed(const char* language) {
std::string seed_words = "";
std::string err;
Monero::Wallet::createPolyseed(seed_words, err, std::string(language));
- std::cout << "WOWNERO_Wallet_createPolyseed(language: " << language << "):" << std::endl;
- std::cout << " err: " << err << std::endl;
std::string str = seed_words;
const std::string::size_type size = str.size();
char *buffer = new char[size + 1]; //we need extra char for NUL
@@ -2238,7 +2236,7 @@ void WOWNERO_WalletManagerFactory_setLogCategories(const char* categories) {
// 2) int
// 3) uint64_t
// 4) void*
-// 5) const char*
+// 5) const char*
void WOWNERO_DEBUG_test0() {
return;
@@ -2262,13 +2260,13 @@ void* WOWNERO_DEBUG_test4(uint64_t x) {
}
const char* WOWNERO_DEBUG_test5() {
- const char *text = "This is a const char* text";
+ const char *text = "This is a const char* text";
return text;
}
const char* WOWNERO_DEBUG_test5_std() {
std::string text ("This is a std::string text");
- const char *text2 = "This is a text";
+ const char *text2 = "This is a text";
return text2;
}
diff --git a/wownero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h b/wownero_libwallet2_api_c/src/main/cpp/wownero_wallet2_api_c.h
index f58adcd..f58adcd 100644
--- a/wownero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h
+++ b/wownero_libwallet2_api_c/src/main/cpp/wownero_wallet2_api_c.h
diff --git a/zano_libwallet2_api_c/src/main/cpp/zano_checksum.c b/zano_libwallet2_api_c/src/main/cpp/zano_checksum.c
new file mode 100644
index 0000000..c5fa83a
--- /dev/null
+++ b/zano_libwallet2_api_c/src/main/cpp/zano_checksum.c
@@ -0,0 +1,5 @@
+#include "zano_checksum.h"
+
+const char * ZANO_wallet2_api_c_h_sha256 = "8acaa95513b85a984c08e05cc3f2ac7530bb8f32946eeeb45357bd846aef33dd";
+const char * ZANO_wallet2_api_c_cpp_sha256 = "cdec2578df387ab3587712f77470500934d7f18c27201ae71bc3ee52cb784cbd-b372a99c7ada82caac53b677d9aaa7c0902e3b0b";
+const char * ZANO_wallet2_api_c_exp_sha256 = "66f3ff655bbfd11ad28c318ab707090b5a93276f436b06f7b1c0f329dba3c9c2";
diff --git a/zano_libwallet2_api_c/src/main/cpp/zano_checksum.h b/zano_libwallet2_api_c/src/main/cpp/zano_checksum.h
index 90e9f30..7d9b572 100644
--- a/zano_libwallet2_api_c/src/main/cpp/zano_checksum.h
+++ b/zano_libwallet2_api_c/src/main/cpp/zano_checksum.h
@@ -1,6 +1,21 @@
-#ifndef MONEROC_CHECKSUMS
-#define MONEROC_CHECKSUMS
-const char * ZANO_wallet2_api_c_h_sha256 = "8acaa95513b85a984c08e05cc3f2ac7530bb8f32946eeeb45357bd846aef33dd";
-const char * ZANO_wallet2_api_c_cpp_sha256 = "4efacd3812d53dd268b6869cc0a9560e7320574d96e09136cf067f796edfeba6-b372a99c7ada82caac53b677d9aaa7c0902e3b0b";
-const char * ZANO_wallet2_api_c_exp_sha256 = "66f3ff655bbfd11ad28c318ab707090b5a93276f436b06f7b1c0f329dba3c9c2";
+#ifndef MONEROC_CHECKSUMS_ZANO
+#define MONEROC_CHECKSUMS_ZANO
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifdef __MINGW32__
+ #define ADDAPI __declspec(dllexport)
+#else
+ #define ADDAPI __attribute__((__visibility__("default")))
+#endif
+
+extern ADDAPI const char * ZANO_wallet2_api_c_h_sha256;
+extern ADDAPI const char * ZANO_wallet2_api_c_cpp_sha256;
+extern ADDAPI const char * ZANO_wallet2_api_c_exp_sha256;
+
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp b/zano_libwallet2_api_c/src/main/cpp/zano_wallet2_api_c.cpp
index 11acc0a..364fdb8 100644
--- a/zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp
+++ b/zano_libwallet2_api_c/src/main/cpp/zano_wallet2_api_c.cpp
@@ -1,11 +1,11 @@
#include <inttypes.h>
-#include "wallet2_api_c.h"
+#include "zano_wallet2_api_c.h"
#include <unistd.h>
#include <cstring>
#include <thread>
-#include "zano_checksum.h"
#include "helpers.hpp"
#include "../../../../zano/src/wallet/plain_wallet_api.h"
+#include "zano_checksum.h"
#ifdef __cplusplus
extern "C"
@@ -196,7 +196,7 @@ const char* ZANO_PlainWallet_generate(const char* path, const char* password) {
return buffer;
DEBUG_END()
}
-// std::string get_opened_wallets();
+// std::string get_opened_wallets();
const char* ZANO_PlainWallet_getOpenWallets() {
DEBUG_START()
std::string str = plain_wallet::get_opened_wallets();
diff --git a/zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.h b/zano_libwallet2_api_c/src/main/cpp/zano_wallet2_api_c.h
index df6d3ef..df6d3ef 100644
--- a/zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.h
+++ b/zano_libwallet2_api_c/src/main/cpp/zano_wallet2_api_c.h