From 12bc3aaaa9aafb7db0b08ad1343f830070aa18d3 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Thu, 4 Jan 2024 22:17:42 +0100 Subject: [PATCH] drop cache, it is causing more trouble than it's worth implement anonero's fork functions in bridge. Calling it RC39 to not break versioning. --- .github/workflows/android.yml | 151 +---------------------- .github/workflows/linux.yml | 111 ----------------- libbridge/src/main/cpp/helpers.cpp | 14 +++ libbridge/src/main/cpp/helpers.hpp | 3 +- libbridge/src/main/cpp/wallet2_api.h | 82 +++++++++++- libbridge/src/main/cpp/wallet2_api_c.cpp | 107 +++++++++++++++- libbridge/src/main/cpp/wallet2_api_c.h | 53 +++++++- 7 files changed, 253 insertions(+), 268 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index cbfe5c9..c2aae62 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -92,94 +92,8 @@ jobs: steps: - name: Checkout repository code uses: actions/checkout@v3 - - name: Download cached build artifacts - run: | - ${{ github.workspace }}/download_artifact.sh libsodium "${SODIUM_VERSION}-${{ matrix.host_triplet }}-${SODIUM_HASH}" ${{ github.workspace }}/prefix/lib/libsodium.a - ${{ github.workspace }}/download_artifact.sh openssl "${OPENSSL_VERSION}-${{ matrix.host_triplet }}-${OPENSSL_HASH}" ${{ github.workspace }}/prefix/lib/libcrypto.a - ${{ github.workspace }}/download_artifact.sh openssl "${OPENSSL_VERSION}-${{ matrix.host_triplet }}-${OPENSSL_HASH}" ${{ github.workspace }}/prefix/lib/libssl.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_chrono.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_date_time.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_filesystem.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_program_options.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_regex.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_serialization.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_system.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_thread.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_wserialization.a - ${{ github.workspace }}/download_artifact.sh libunbound "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/prefix/lib/libunbound.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/lib/libwallet_api.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/lib/libwallet.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_core/libcryptonote_core.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_basic.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/mnemonics/libmnemonics.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/common/libcommon.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/crypto/libcncrypto.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/ringct/libringct.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/ringct/libringct_basic.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/blockchain_db/libblockchain_db.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/db_drivers/liblmdb/liblmdb.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/easylogging++/libeasylogging.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/contrib/epee/src/libepee.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/blocks/libblocks.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/checkpoints/libcheckpoints.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/device/libdevice.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/device_trezor/libdevice_trezor.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/multisig/libmultisig.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/libversion.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/net/libnet.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/hardforks/libhardforks.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/randomx/librandomx.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/rpc/librpc_base.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/crypto/wallet/libwallet-crypto.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_format_utils_basic.a - - name: Create skip flag based on cache - run: | - if [[ -f "${{ github.workspace }}/prefix/lib/libsodium.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libcrypto.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libssl.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_chrono.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_date_time.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_filesystem.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_program_options.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_regex.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_serialization.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_system.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_thread.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_wserialization.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libunbound.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/lib/libwallet_api.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/lib/libwallet.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/cryptonote_core/libcryptonote_core.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_basic.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/mnemonics/libmnemonics.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/common/libcommon.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/crypto/libcncrypto.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/ringct/libringct.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/ringct/libringct_basic.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/blockchain_db/libblockchain_db.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/external/db_drivers/liblmdb/liblmdb.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/external/easylogging++/libeasylogging.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/contrib/epee/src/libepee.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/blocks/libblocks.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/checkpoints/libcheckpoints.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/device/libdevice.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/device_trezor/libdevice_trezor.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/multisig/libmultisig.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/libversion.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/net/libnet.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/hardforks/libhardforks.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/external/randomx/librandomx.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/rpc/librpc_base.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_format_utils_basic.a" ]]; \ - then \ - echo "Cache exist, creating /tmp/skip_deps"; \ - touch /tmp/skip_deps; \ - else \ - echo "Cache missing, this will be a looooong build."; \ - fi - name: Download monero run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && rm -rf monero && git clone ${MONERO_GIT_SOURCE} --depth=1 --branch ${MONERO_TAG} monero \ && cd monero \ @@ -194,7 +108,6 @@ jobs: && rm -f /usr/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz - name: Download Boost run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && curl -L -o boost_${BOOST_VERSION}.tar.bz2 https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \ && echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \ @@ -202,7 +115,6 @@ jobs: && rm -f boost_${BOOST_VERSION}.tar.bz2 - name: Download iconv run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && curl -O http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz \ && echo "${ICONV_HASH} libiconv-${ICONV_VERSION}.tar.gz" | sha256sum -c \ @@ -210,7 +122,6 @@ jobs: && rm -f libiconv-${ICONV_VERSION}.tar.gz - name: Download zlib run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && curl -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \ && echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \ @@ -219,7 +130,6 @@ jobs: && mv zlib-${ZLIB_VERSION} zlib - name: Download OpenSSL run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && curl -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \ && echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c \ @@ -227,42 +137,36 @@ jobs: && rm openssl-${OPENSSL_VERSION}.tar.gz - name: Download ZMQ run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} --depth=1 \ && cd libzmq \ && test `git rev-parse HEAD` = ${ZMQ_HASH} || exit 1 - name: Download libsodium run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} --depth=1 \ && cd libsodium \ && test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 - name: Download libexpat run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && git clone https://github.com/libexpat/libexpat.git -b ${LIBEXPAT_VERSION} --depth=1 \ && cd libexpat/expat \ && test `git rev-parse HEAD` = ${LIBEXPAT_HASH} || exit 1 \ - name: Download libunbound run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && git clone https://github.com/NLnetLabs/unbound.git -b ${LIBUNBOUND_VERSION} --depth=1 \ && cd unbound \ && test `git rev-parse HEAD` = ${LIBUNBOUND_HASH} || exit 1 - name: Download polyseed run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && git clone https://github.com/tevador/polyseed.git \ && cd polyseed \ && git reset --hard ${POLYSEED_HASH} - name: Download utf8proc run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && git clone https://github.com/JuliaStrings/utf8proc -b v2.8.0 --depth=1 \ && cd utf8proc \ @@ -281,7 +185,6 @@ jobs: # TODO(mrcyjanek): x86_64-linux-gnu <- get this dynamically. - name: Build iconv (for boost) run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd libiconv-${ICONV_VERSION} \ && CC=clang CXX=clang++ ./configure --build=x86_64-linux-gnu --host=${{ matrix.host_triplet }} --prefix=${PREFIX} --disable-rpath \ @@ -289,20 +192,17 @@ jobs: && make install - name: Build boost (2/2) run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd boost_${BOOST_VERSION} \ && ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install -j${NPROC} &>/tmp/boost_log.txt || cat /tmp/boost_log.txt - name: Build zlib run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd zlib \ && CC=clang CXX=clang++ ./configure --static \ && make -j${NPROC} - name: Build OpenSSL run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd openssl-${OPENSSL_VERSION} \ && export PATH=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH \ @@ -311,7 +211,6 @@ jobs: && make install_sw &>/tmp/openssl_log_2.txt || cat /tmp/openssl_log_2.txt - name: Build ZMQ run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd libzmq \ && ./autogen.sh \ @@ -320,7 +219,6 @@ jobs: && make install - name: Build Sodium run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd libsodium \ && ./autogen.sh \ @@ -329,7 +227,6 @@ jobs: && make install - name: Build libexpat run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd libexpat/expat \ && ./buildconf.sh \ @@ -338,7 +235,6 @@ jobs: && make install - name: Build libunbound run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd unbound \ && CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=${{ matrix.host_triplet }} --enable-static --disable-shared --disable-flto --with-ssl=${PREFIX} --with-libexpat=${PREFIX} \ @@ -346,7 +242,6 @@ jobs: && make install - name: Build polyseed run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd polyseed \ && CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} . \ @@ -354,7 +249,6 @@ jobs: && make install - name: Build utf8proc run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd utf8proc \ && mkdir build \ @@ -365,7 +259,6 @@ jobs: && make install - name: Build monero (1/2) configure run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd monero \ && export CMAKE_INCLUDE_PATH="${PREFIX}/include" \ @@ -380,7 +273,6 @@ jobs: && env CC=clang CXX=clang++ cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="${{ matrix.monero_arch }}" -D STATIC=ON -D BUILD_64="${{ matrix.monero_build64 }}" -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D BUILD_TAG="${{ matrix.monero_buildtag }}" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARCH_ABI="${{ matrix.full_arch }}" ../.. ; fi - name: Build monero (2/2) build run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd monero \ && cd build/release \ @@ -392,7 +284,6 @@ jobs: && make wallet_api -j${NPROC} - name: Copy prefix from $PREFIX to local run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cp -a /opt/android/prefix ${{ github.workspace }}/prefix - name: Build libbridge (1/2) configure @@ -430,44 +321,4 @@ jobs: files: |- ${{ github.workspace }}/libbridge/build/${{ matrix.host_triplet }}_libwallet2_api_c.so.xz ${{ github.workspace }}/libbridge/build/${{ matrix.host_triplet }}_libwallet2_api_c.so.sha256 - ${{ github.workspace }}/libbridge/build/${{ matrix.host_triplet }}_libwallet2_api_c.so.xz.sha256 - - name: Create cache entries - run: | - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh libsodium "${SODIUM_VERSION}-${{ matrix.host_triplet }}-${SODIUM_HASH}" ${{ github.workspace }}/prefix/lib/libsodium.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh openssl "${OPENSSL_VERSION}-${{ matrix.host_triplet }}-${OPENSSL_HASH}" ${{ github.workspace }}/prefix/lib/libcrypto.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh openssl "${OPENSSL_VERSION}-${{ matrix.host_triplet }}-${OPENSSL_HASH}" ${{ github.workspace }}/prefix/lib/libssl.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_chrono.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_date_time.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_filesystem.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_program_options.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_regex.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_serialization.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_system.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_thread.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_wserialization.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh libunbound "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/prefix/lib/libunbound.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/lib/libwallet_api.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/lib/libwallet.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_core/libcryptonote_core.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_basic.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/mnemonics/libmnemonics.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/common/libcommon.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/crypto/libcncrypto.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/ringct/libringct.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/ringct/libringct_basic.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/blockchain_db/libblockchain_db.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/db_drivers/liblmdb/liblmdb.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/easylogging++/libeasylogging.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/contrib/epee/src/libepee.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/blocks/libblocks.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/checkpoints/libcheckpoints.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/device/libdevice.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/device_trezor/libdevice_trezor.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/multisig/libmultisig.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/libversion.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/net/libnet.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/hardforks/libhardforks.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/randomx/librandomx.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/rpc/librpc_base.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/crypto/wallet/libwallet-crypto.a - PAT_SECRET_PACKAGE=${{ secrets.PAT_SECRET_PACKAGE }} ${{ github.workspace }}/save_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_format_utils_basic.a \ No newline at end of file + ${{ github.workspace }}/libbridge/build/${{ matrix.host_triplet }}_libwallet2_api_c.so.xz.sha256 \ No newline at end of file diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 3f7ec47..0455f8f 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -65,94 +65,8 @@ jobs: run: apt update && apt install -y pkg-config m4 libtool automake autoconf bison checkinstall - name: Checkout repository code uses: actions/checkout@v3 - - name: Download cached build artifacts - run: | - ${{ github.workspace }}/download_artifact.sh libsodium "${SODIUM_VERSION}-${{ matrix.host_triplet }}-${SODIUM_HASH}" ${{ github.workspace }}/prefix/lib/libsodium.a - ${{ github.workspace }}/download_artifact.sh openssl "${OPENSSL_VERSION}-${{ matrix.host_triplet }}-${OPENSSL_HASH}" ${{ github.workspace }}/prefix/lib/libcrypto.a - ${{ github.workspace }}/download_artifact.sh openssl "${OPENSSL_VERSION}-${{ matrix.host_triplet }}-${OPENSSL_HASH}" ${{ github.workspace }}/prefix/lib/libssl.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_chrono.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_date_time.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_filesystem.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_program_options.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_regex.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_serialization.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_system.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_thread.a - ${{ github.workspace }}/download_artifact.sh boost "${BOOST_VERSION_DOT}-${{ matrix.host_triplet }}-${BOOST_HASH}" ${{ github.workspace }}/prefix/lib/libboost_wserialization.a - ${{ github.workspace }}/download_artifact.sh libunbound "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/prefix/lib/libunbound.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/lib/libwallet_api.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/lib/libwallet.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_core/libcryptonote_core.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_basic.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/mnemonics/libmnemonics.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/common/libcommon.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/crypto/libcncrypto.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/ringct/libringct.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/ringct/libringct_basic.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/blockchain_db/libblockchain_db.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/db_drivers/liblmdb/liblmdb.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/easylogging++/libeasylogging.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/contrib/epee/src/libepee.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/blocks/libblocks.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/checkpoints/libcheckpoints.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/device/libdevice.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/device_trezor/libdevice_trezor.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/multisig/libmultisig.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/libversion.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/net/libnet.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/hardforks/libhardforks.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/external/randomx/librandomx.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/rpc/librpc_base.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/crypto/wallet/libwallet-crypto.a - ${{ github.workspace }}/download_artifact.sh monero "${MONERO_TAG}-${{ matrix.host_triplet }}-${MONERO_GIT_SOURCE_SIMPLE}" ${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_format_utils_basic.a - - name: Create skip flag based on cache - run: | - if [[ -f "${{ github.workspace }}/prefix/lib/libsodium.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libcrypto.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libssl.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_chrono.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_date_time.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_filesystem.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_program_options.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_regex.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_serialization.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_system.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_thread.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libboost_wserialization.a" ]] \ - && [[ -f "${{ github.workspace }}/prefix/lib/libunbound.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/lib/libwallet_api.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/lib/libwallet.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/cryptonote_core/libcryptonote_core.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_basic.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/mnemonics/libmnemonics.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/common/libcommon.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/crypto/libcncrypto.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/ringct/libringct.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/ringct/libringct_basic.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/blockchain_db/libblockchain_db.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/external/db_drivers/liblmdb/liblmdb.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/external/easylogging++/libeasylogging.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/contrib/epee/src/libepee.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/blocks/libblocks.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/checkpoints/libcheckpoints.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/device/libdevice.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/device_trezor/libdevice_trezor.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/multisig/libmultisig.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/libversion.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/net/libnet.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/hardforks/libhardforks.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/external/randomx/librandomx.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/rpc/librpc_base.a" ]] \ - && [[ -f "${{ github.workspace }}/monero/build/release/src/cryptonote_basic/libcryptonote_format_utils_basic.a" ]]; \ - then \ - echo "Cache exist, creating /tmp/skip_deps"; \ - touch /tmp/skip_deps; \ - else \ - echo "Cache missing, this will be a looooong build."; \ - fi - name: Download monero run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && rm -rf monero && git clone ${MONERO_GIT_SOURCE} --depth=1 --branch ${MONERO_TAG} monero \ && cd monero \ @@ -167,7 +81,6 @@ jobs: && rm -f /usr/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz - name: Download Boost run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && curl -L -o boost_${BOOST_VERSION}.tar.bz2 https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \ && echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \ @@ -175,7 +88,6 @@ jobs: && rm -f boost_${BOOST_VERSION}.tar.bz2 - name: Download iconv run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && curl -O http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz \ && echo "${ICONV_HASH} libiconv-${ICONV_VERSION}.tar.gz" | sha256sum -c \ @@ -183,7 +95,6 @@ jobs: && rm -f libiconv-${ICONV_VERSION}.tar.gz - name: Download zlib run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && curl -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \ && echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \ @@ -192,7 +103,6 @@ jobs: && mv zlib-${ZLIB_VERSION} zlib - name: Download OpenSSL run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && curl -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \ && echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c \ @@ -200,49 +110,42 @@ jobs: && rm openssl-${OPENSSL_VERSION}.tar.gz - name: Download ZMQ run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} --depth=1 \ && cd libzmq \ && test `git rev-parse HEAD` = ${ZMQ_HASH} || exit 1 - name: Download libsodium run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} --depth=1 \ && cd libsodium \ && test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 - name: Download libexpat run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && git clone https://github.com/libexpat/libexpat.git -b ${LIBEXPAT_VERSION} --depth=1 \ && cd libexpat/expat \ && test `git rev-parse HEAD` = ${LIBEXPAT_HASH} || exit 1 \ - name: Download libunbound run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && git clone https://github.com/NLnetLabs/unbound.git -b ${LIBUNBOUND_VERSION} --depth=1 \ && cd unbound \ && test `git rev-parse HEAD` = ${LIBUNBOUND_HASH} || exit 1 - name: Download polyseed run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && git clone https://github.com/tevador/polyseed.git \ && cd polyseed \ && git reset --hard ${POLYSEED_HASH} - name: Download utf8proc run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && git clone https://github.com/JuliaStrings/utf8proc -b v2.8.0 --depth=1 \ && cd utf8proc \ && git reset --hard ${UTF8PROC_HASH} - name: Build boost (1/2) run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd boost_${BOOST_VERSION} \ && ./bootstrap.sh --prefix=${PREFIX} @@ -250,7 +153,6 @@ jobs: # TODO(mrcyjanek): x86_64-linux-gnu <- get this dynamically. - name: Build iconv (for boost) run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd libiconv-${ICONV_VERSION} \ && ./configure --build=x86_64-linux-gnu --host=${{ matrix.host_triplet }} --prefix=${PREFIX} --disable-rpath \ @@ -258,21 +160,18 @@ jobs: && make install - name: Build boost (2/2) run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd boost_${BOOST_VERSION} \ && echo -n -e '\n#undef PTHREAD_STACK_MIN\n#define PTHREAD_STACK_MIN 16384\n' | cat - ./boost/thread/pthread/thread_data.hpp > temp && mv temp ./boost/thread/pthread/thread_data.hpp \ && ./b2 cxxflags=-fPIC cflags=-fPIC --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=linux --stagedir=linux toolset=gcc threading=multi threadapi=pthread -sICONV_PATH=${PREFIX} install -j${NPROC} &>/tmp/boost_log.txt || cat /tmp/boost_log.txt - name: Build zlib run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd zlib \ && ./configure --static \ && make -j${NPROC} - name: Build OpenSSL run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd openssl-${OPENSSL_VERSION} \ && ./Configure -static no-shared no-tests --with-zlib-include=${{ github.workspace }}/zlib/include --with-zlib-lib=${{ github.workspace }}/zlib/lib --prefix=${PREFIX} --openssldir=${PREFIX} -fpic \ @@ -280,7 +179,6 @@ jobs: && make install_sw &>/tmp/openssl_log_2.txt || cat /tmp/openssl_log_2.txt - name: Build ZMQ run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd libzmq \ && ./autogen.sh \ @@ -290,7 +188,6 @@ jobs: && make install - name: Build Sodium run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd libsodium \ && ./autogen.sh \ @@ -299,7 +196,6 @@ jobs: && make install - name: Build libexpat run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd libexpat/expat \ && ./buildconf.sh \ @@ -308,11 +204,9 @@ jobs: && make install - name: Fix paths run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cp /opt/linux/prefix/lib64/* /opt/linux/prefix/lib -r - name: Build libunbound run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd unbound \ && ./configure -with-pic --prefix=${PREFIX} --enable-static --disable-shared --disable-flto --with-libexpat=${PREFIX} --with-ssl=${PREFIX} \ @@ -320,7 +214,6 @@ jobs: && make install - name: Build polyseed run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd polyseed \ && cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} . \ @@ -328,7 +221,6 @@ jobs: && make install - name: Build utf8proc run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd utf8proc \ && mkdir build \ @@ -339,7 +231,6 @@ jobs: && make install - name: Build monero (1/2) configure run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd monero \ && export CMAKE_INCLUDE_PATH="${PREFIX}/include" \ @@ -350,7 +241,6 @@ jobs: && env cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="${{ matrix.monero_arch }}" -D STATIC=ON -D BUILD_64="${{ matrix.monero_build64 }}" -D CMAKE_BUILD_TYPE=release -D ANDROID=false -D BUILD_TAG="${{ matrix.monero_buildtag }}" -D CMAKE_SYSTEM_NAME="Linux" ../.. - name: Build monero (2/2) build run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cd monero \ && cd build/release \ @@ -361,7 +251,6 @@ jobs: && make wallet_api -j${NPROC} - name: Copy prefix from $PREFIX to local run: | - [[ -f "/tmp/skip_deps" ]] && exit 0; \ cd ${{ github.workspace }} \ && cp -a /opt/linux/prefix/lib64/* /opt/linux/prefix/lib \ && cp -a /opt/linux/prefix ${{ github.workspace }}/prefix diff --git a/libbridge/src/main/cpp/helpers.cpp b/libbridge/src/main/cpp/helpers.cpp index 064ce36..fac131a 100644 --- a/libbridge/src/main/cpp/helpers.cpp +++ b/libbridge/src/main/cpp/helpers.cpp @@ -143,3 +143,17 @@ const char* vectorToString(const std::set& intSet, const std::string s memcpy(buffer, str.c_str(), size + 1); return buffer; } + +std::set splitString(const std::string& str, const std::string& delim) { + std::set tokens; + size_t pos = 0; + std::string token; + std::string content = str; // Copy of str so we can safely erase content + while ((pos = content.find(delim)) != std::string::npos) { + token = content.substr(0, pos); + tokens.insert(token); + content.erase(0, pos + delim.length()); + } + tokens.insert(content); // Inserting the last token + return tokens; +} \ No newline at end of file diff --git a/libbridge/src/main/cpp/helpers.hpp b/libbridge/src/main/cpp/helpers.hpp index 5d9b4a4..45fa624 100644 --- a/libbridge/src/main/cpp/helpers.hpp +++ b/libbridge/src/main/cpp/helpers.hpp @@ -7,4 +7,5 @@ const char* vectorToString(const std::vector& vec, const std::strin const char* vectorToString(const std::vector& vec, const std::string separator); const char* vectorToString(const std::vector& vec, const std::string separator); const char* vectorToString(const std::vector>& vec, const std::string separator); -const char* vectorToString(const std::set& intSet, const std::string separator); \ No newline at end of file +const char* vectorToString(const std::set& intSet, const std::string separator); +std::set splitString(const std::string& str, const std::string& delim); \ No newline at end of file diff --git a/libbridge/src/main/cpp/wallet2_api.h b/libbridge/src/main/cpp/wallet2_api.h index 646e585..5612c66 100644 --- a/libbridge/src/main/cpp/wallet2_api.h +++ b/libbridge/src/main/cpp/wallet2_api.h @@ -38,6 +38,7 @@ #include #include #include +#include // Public interface for libwallet library namespace Monero { @@ -287,6 +288,7 @@ struct CoinsInfo virtual bool unlocked() const = 0; virtual std::string pubKey() const = 0; virtual bool coinbase() const = 0; + virtual std::string description() const = 0; }; struct Coins @@ -296,9 +298,12 @@ struct Coins virtual CoinsInfo * coin(int index) const = 0; virtual std::vector getAll() const = 0; virtual void refresh() = 0; + virtual void setFrozen(std::string public_key) = 0; virtual void setFrozen(int index) = 0; + virtual void thaw(std::string public_key) = 0; virtual void thaw(int index) = 0; virtual bool isTransferUnlocked(uint64_t unlockTime, uint64_t blockHeight) = 0; + virtual void setDescription(const std::string &public_key, const std::string &description) = 0; }; struct SubaddressRow { @@ -485,6 +490,12 @@ struct Wallet ConnectionStatus_WrongVersion }; + enum BackgroundSyncType { + BackgroundSync_Off = 0, + BackgroundSync_ReusePassword = 1, + BackgroundSync_CustomPassword = 2 + }; + virtual ~Wallet() = 0; virtual std::string seed(const std::string& seed_offset = "") const = 0; virtual std::string getSeedLanguage() const = 0; @@ -660,6 +671,7 @@ struct Wallet result += unlockedBalance(i); return result; } + virtual uint64_t viewOnlyBalance(uint32_t accountIndex, const std::vector &key_images = {}) const = 0; /** * @brief watchOnly - checks if wallet is watch only @@ -740,6 +752,10 @@ struct Wallet static void warning(const std::string &category, const std::string &str); static void error(const std::string &category, const std::string &str); + virtual bool getPolyseed(std::string &seed, std::string &passphrase) const = 0; + static bool createPolyseed(std::string &seed_words, std::string &err, const std::string &language = "English"); + static std::vector> getPolyseedLanguages(); + /** * @brief StartRefresh - Start/resume refresh thread (refresh every 10 seconds) */ @@ -883,7 +899,8 @@ struct Wallet optional> amount, uint32_t mixin_count, PendingTransaction::Priority = PendingTransaction::Priority_Low, uint32_t subaddr_account = 0, - std::set subaddr_indices = {}) = 0; + std::set subaddr_indices = {}, + const std::set &preferred_inputs = {}) = 0; /*! * \brief createTransaction creates transaction. if dst_addr is an integrated address, payment_id is ignored @@ -902,7 +919,8 @@ struct Wallet optional amount, uint32_t mixin_count, PendingTransaction::Priority = PendingTransaction::Priority_Low, uint32_t subaddr_account = 0, - std::set subaddr_indices = {}) = 0; + std::set subaddr_indices = {}, + const std::set &preferred_inputs = {}) = 0; /*! * \brief createSweepUnmixableTransaction creates transaction with unmixable outputs. @@ -940,6 +958,8 @@ struct Wallet virtual uint64_t estimateTransactionFee(const std::vector> &destinations, PendingTransaction::Priority priority) const = 0; + virtual bool hasUnknownKeyImages() const = 0; + /*! * \brief exportKeyImages - exports key images to file * \param filename @@ -976,6 +996,43 @@ struct Wallet */ virtual bool scanTransactions(const std::vector &txids) = 0; + /*! + * \brief setupBackgroundSync - setup background sync mode with just a view key + * \param background_sync_type - the mode the wallet background syncs in + * \param wallet_password + * \param background_cache_password - custom password to encrypt background cache, only needed for custom password background sync type + * \return - true on success + */ + virtual bool setupBackgroundSync(const BackgroundSyncType background_sync_type, const std::string &wallet_password, const optional &background_cache_password) = 0; + + /*! + * \brief getBackgroundSyncType - get mode the wallet background syncs in + * \return - the type, or off if type is unknown + */ + virtual BackgroundSyncType getBackgroundSyncType() const = 0; + + /** + * @brief startBackgroundSync - sync the chain in the background with just view key + */ + virtual bool startBackgroundSync() = 0; + + /** + * @brief stopBackgroundSync - bring back spend key and process background synced txs + * \param wallet_password + */ + virtual bool stopBackgroundSync(const std::string &wallet_password) = 0; + + /** + * @brief isBackgroundSyncing - returns true if the wallet is background syncing + */ + virtual bool isBackgroundSyncing() const = 0; + + /** + * @brief isBackgroundWallet - returns true if the wallet is a background wallet + */ + virtual bool isBackgroundWallet() const = 0; + + virtual TransactionHistory * history() = 0; virtual AddressBook * addressBook() = 0; virtual Coins * coins() = 0; @@ -1297,6 +1354,27 @@ struct WalletManager uint64_t kdf_rounds = 1, WalletListener * listener = nullptr) = 0; + /*! + * \brief creates a wallet from a polyseed mnemonic phrase + * \param path Name of the wallet file to be created + * \param password Password of wallet file + * \param nettype Network type + * \param mnemonic Polyseed mnemonic + * \param passphrase Optional seed offset passphrase + * \param newWallet Whether it is a new wallet + * \param restoreHeight Override the embedded restore height + * \param kdf_rounds Number of rounds for key derivation function + * @return + */ + virtual Wallet * createWalletFromPolyseed(const std::string &path, + const std::string &password, + NetworkType nettype, + const std::string &mnemonic, + const std::string &passphrase = "", + bool newWallet = true, + uint64_t restore_height = 0, + uint64_t kdf_rounds = 1) = 0; + /*! * \brief Closes wallet. In case operation succeeded, wallet object deleted. in case operation failed, wallet object not deleted * \param wallet previously opened / created wallet instance diff --git a/libbridge/src/main/cpp/wallet2_api_c.cpp b/libbridge/src/main/cpp/wallet2_api_c.cpp index 97b6fa8..388c0b0 100644 --- a/libbridge/src/main/cpp/wallet2_api_c.cpp +++ b/libbridge/src/main/cpp/wallet2_api_c.cpp @@ -475,6 +475,15 @@ bool MONERO_CoinsInfo_coinbase(void* coinsInfo_ptr) { Monero::CoinsInfo *coinsInfo = reinterpret_cast(coinsInfo_ptr); return coinsInfo->internalOutputIndex(); } +// virtual std::string description() const = 0; +const char* MONERO_CoinsInfo_description(void* coinsInfo_ptr) { + Monero::CoinsInfo *coinsInfo = reinterpret_cast(coinsInfo_ptr); + std::string str = coinsInfo->description(); + const std::string::size_type size = str.size(); + char *buffer = new char[size + 1]; //we need extra char for NUL + memcpy(buffer, str.c_str(), size + 1); + return buffer; +} // coins @@ -496,6 +505,11 @@ void MONERO_Coins_refresh(void* coins_ptr) { Monero::Coins *coins = reinterpret_cast(coins_ptr); return coins->refresh(); } +// virtual void setFrozen(std::string public_key) = 0; +void MONERO_Coins_setFrozenByPublicKey(void* coins_ptr, const char* public_key) { + Monero::Coins *coins = reinterpret_cast(coins_ptr); + return coins->setFrozen(std::string(public_key)); +} // virtual void setFrozen(int index) = 0; void MONERO_Coins_setFrozen(void* coins_ptr, int index) { Monero::Coins *coins = reinterpret_cast(coins_ptr); @@ -506,11 +520,21 @@ void MONERO_Coins_thaw(void* coins_ptr, int index) { Monero::Coins *coins = reinterpret_cast(coins_ptr); return coins->thaw(index); } +// virtual void thaw(std::string public_key) = 0; +void MONERO_Coins_thawByPublicKey(void* coins_ptr, const char* public_key) { + Monero::Coins *coins = reinterpret_cast(coins_ptr); + return coins->thaw(std::string(public_key)); +} // virtual bool isTransferUnlocked(uint64_t unlockTime, uint64_t blockHeight) = 0; bool MONERO_Coins_isTransferUnlocked(void* coins_ptr, uint64_t unlockTime, uint64_t blockHeight) { Monero::Coins *coins = reinterpret_cast(coins_ptr); return coins->isTransferUnlocked(unlockTime, blockHeight); } +// virtual void setDescription(const std::string &public_key, const std::string &description) = 0; +void MONERO_Coins_setDescription(void* coins_ptr, const char* public_key, const char* description) { + Monero::Coins *coins = reinterpret_cast(coins_ptr); + coins->setDescription(std::string(public_key), std::string(description)); +} // SubaddressRow @@ -923,6 +947,11 @@ uint64_t MONERO_Wallet_unlockedBalance(void* wallet_ptr, uint32_t accountIndex) return wallet->unlockedBalance(accountIndex); } +uint64_t MONERO_Wallet_viewOnlyBalance(void* wallet_ptr, uint32_t accountIndex) { + Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); + return wallet->viewOnlyBalance(accountIndex); +} + // TODO bool MONERO_Wallet_watchOnly(void* wallet_ptr) { Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); @@ -1035,6 +1064,29 @@ void MONERO_Wallet_init3(void* wallet_ptr, const char* argv0, const char* defaul Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); return wallet->init(argv0, default_log_base_name, log_path, console); } +const char* MONERO_Wallet_getPolyseed(void* wallet_ptr, const char* passphrase) { + Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); + std::string seed = ""; + std::string _passphrase = std::string(passphrase); + wallet->getPolyseed(seed, _passphrase); + std::string str = seed; + const std::string::size_type size = str.size(); + char *buffer = new char[size + 1]; //we need extra char for NUL + memcpy(buffer, str.c_str(), size + 1); + return buffer; +} +// static bool createPolyseed(std::string &seed_words, std::string &err, const std::string &language = "English"); +const char* MONERO_Wallet_createPolyseed() { + std::string seed_words = ""; + std::string err; + Monero::Wallet::createPolyseed(seed_words, err); + 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 + memcpy(buffer, str.c_str(), size + 1); + return buffer; +} + void MONERO_Wallet_startRefresh(void* wallet_ptr) { Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); return wallet->startRefresh(); @@ -1107,16 +1159,19 @@ const char* MONERO_Wallet_getMultisigInfo(void* wallet_ptr) { void* MONERO_Wallet_createTransaction(void* wallet_ptr, const char* dst_addr, const char* payment_id, uint64_t amount, uint32_t mixin_count, int pendingTransactionPriority, - uint32_t subaddr_account) { + uint32_t subaddr_account, + const char* preferredInputs, const char* separator) { Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); Monero::optional optAmount; if (amount != 0) { optAmount = amount; } + std::set subaddr_indices = {}; + std::set preferred_inputs = splitString(std::string(preferredInputs), std::string(separator)); return wallet->createTransaction(std::string(dst_addr), std::string(payment_id), optAmount, mixin_count, Monero::PendingTransaction::Priority_Low, - subaddr_account /*, subaddr_indices */); + subaddr_account, subaddr_indices); } void* MONERO_Wallet_loadUnsignedTx(void* wallet_ptr, const char* fileName) { Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); @@ -1126,6 +1181,10 @@ bool MONERO_Wallet_submitTransaction(void* wallet_ptr, const char* fileName) { Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); return wallet->submitTransaction(std::string(fileName)); } +bool MONERO_Wallet_hasUnknownKeyImages(void* wallet_ptr) { + Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); + return wallet->hasUnknownKeyImages(); +} bool MONERO_Wallet_exportKeyImages(void* wallet_ptr, const char* filename, bool all) { Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); return wallet->exportKeyImages(std::string(filename), all); @@ -1142,6 +1201,36 @@ bool MONERO_Wallet_importOutputs(void* wallet_ptr, const char* filename) { Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); return wallet->importOutputs(std::string(filename)); } +// virtual bool setupBackgroundSync(const BackgroundSyncType background_sync_type, const std::string &wallet_password, const optional &background_cache_password) = 0; +bool MONERO_Wallet_setupBackgroundSync(void* wallet_ptr, int background_sync_type, const char* wallet_password, const char* background_cache_password) { + Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); + return wallet->setupBackgroundSync(Monero::Wallet::BackgroundSyncType::BackgroundSync_CustomPassword, std::string(wallet_password), std::string(background_cache_password)); +} +// virtual BackgroundSyncType getBackgroundSyncType() const = 0; +int MONERO_Wallet_getBackgroundSyncType(void* wallet_ptr) { + Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); + return wallet->getBackgroundSyncType(); +} +// virtual bool startBackgroundSync() = 0; +bool MONERO_Wallet_startBackgroundSync(void* wallet_ptr) { + Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); + return wallet->startBackgroundSync(); +} +// virtual bool stopBackgroundSync(const std::string &wallet_password) = 0; +bool MONERO_Wallet_stopBackgroundSync(void* wallet_ptr, const char* wallet_password) { + Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); + return wallet->stopBackgroundSync(std::string(wallet_password)); +} +// virtual bool isBackgroundSyncing() const = 0; +bool MONERO_Wallet_isBackgroundSyncing(void* wallet_ptr) { + Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); + return wallet->hasUnknownKeyImages(); +} +// virtual bool isBackgroundWallet() const = 0; +bool MONERO_Wallet_isBackgroundWallet(void* wallet_ptr) { + Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); + return wallet->isBackgroundWallet(); +} void* MONERO_Wallet_history(void* wallet_ptr) { Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); return wallet->history(); @@ -1325,6 +1414,20 @@ void* MONERO_WalletManager_recoveryWallet(const char* path, const char* password return reinterpret_cast(wallet); } +void* MONERO_WalletManager_createWalletFromPolyseed(const char* path, const char* password, + int nettype, const char* mnemonic, const char* passphrase, + bool newWallet, uint64_t restore_height, uint64_t kdf_rounds) { + return Monero::WalletManagerFactory::getWalletManager()->createWalletFromPolyseed(std::string(path), + std::string(password), + static_cast(nettype), + std::string(mnemonic), + std::string(passphrase), + newWallet, + restore_height, + kdf_rounds); +} + + bool MONERO_WalletManager_closeWallet(void* wallet_ptr, bool store) { Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); return Monero::WalletManagerFactory::getWalletManager()->closeWallet( diff --git a/libbridge/src/main/cpp/wallet2_api_c.h b/libbridge/src/main/cpp/wallet2_api_c.h index 6e9c971..53b75f2 100644 --- a/libbridge/src/main/cpp/wallet2_api_c.h +++ b/libbridge/src/main/cpp/wallet2_api_c.h @@ -293,6 +293,8 @@ bool MONERO_CoinsInfo_unlocked(void* coinsInfo_ptr); const char* MONERO_CoinsInfo_pubKey(void* coinsInfo_ptr); // virtual bool coinbase() const = 0; bool MONERO_CoinsInfo_coinbase(void* coinsInfo_ptr); +// virtual std::string description() const = 0; +const char* MONERO_CoinsInfo_description(void* coinsInfo_ptr); // }; // struct Coins // { @@ -304,12 +306,18 @@ void* MONERO_Coins_coin(void* coins_ptr, int index); // virtual std::vector getAll() const = 0; // virtual void refresh() = 0; void MONERO_Coins_refresh(void* coins_ptr); +// virtual void setFrozen(std::string public_key) = 0; +void MONERO_Coins_setFrozenByPublicKey(void* coins_ptr, const char* public_key); // virtual void setFrozen(int index) = 0; void MONERO_Coins_setFrozen(void* coins_ptr, int index); // virtual void thaw(int index) = 0; void MONERO_Coins_thaw(void* coins_ptr, int index); +// virtual void thaw(std::string public_key) = 0; +void MONERO_Coins_thawByPublicKey(void* coins_ptr, const char* public_key); // virtual bool isTransferUnlocked(uint64_t unlockTime, uint64_t blockHeight) = 0; bool MONERO_Coins_isTransferUnlocked(void* coins_ptr, uint64_t unlockTime, uint64_t blockHeight); +// virtual void setDescription(const std::string &public_key, const std::string &description) = 0; +void MONERO_Coins_setDescription(void* coins_ptr, const char* public_key, const char* description); // }; // struct SubaddressRow { // public: @@ -467,6 +475,14 @@ const int WalletConnectionStatus_Connected = 1; // ConnectionStatus_WrongVersion const int WalletConnectionStatus_WrongVersion = 2; // }; +// enum BackgroundSyncType { +// BackgroundSync_Off = 0, +const int WalletBackgroundSync_Off = 0; +// BackgroundSync_ReusePassword = 1, +const int WalletBackgroundSync_ReusePassword = 1; +// BackgroundSync_CustomPassword = 2 +const int BackgroundSync_CustomPassword = 2; +// }; // virtual ~Wallet() = 0; // virtual std::string seed(const std::string& seed_offset = "") const = 0; const char* MONERO_Wallet_seed(void* wallet_ptr, const char* seed_offset); @@ -561,6 +577,8 @@ uint64_t MONERO_Wallet_unlockedBalance(void* wallet_ptr, uint32_t accountIndex); // return result; // } // virtual bool watchOnly() const = 0; +// virtual uint64_t viewOnlyBalance(uint32_t accountIndex, const std::vector &key_images = {}) const = 0; +uint64_t MONERO_Wallet_viewOnlyBalance(void* wallet_ptr, uint32_t accountIndex); bool MONERO_Wallet_watchOnly(void* wallet_ptr); // virtual bool isDeterministic() const = 0; bool MONERO_Wallet_isDeterministic(void* wallet_ptr); @@ -617,6 +635,10 @@ void MONERO_Wallet_init3(void* wallet_ptr, const char* argv0, const char* defaul // static void warning(const std::string &category, const std::string &str); // static void error(const std::string &category, const std::string &str); // virtual void startRefresh() = 0; +// virtual bool getPolyseed(std::string &seed, std::string &passphrase) const = 0; +const char* MONERO_Wallet_getPolyseed(void* wallet_ptr, const char* passphrase); +// static bool createPolyseed(std::string &seed_words, std::string &err, const std::string &language = "English"); +const char* MONERO_Wallet_createPolyseed(); void MONERO_Wallet_startRefresh(void* wallet_ptr); // virtual void pauseRefresh() = 0; void MONERO_Wallet_pauseRefresh(void* wallet_ptr); @@ -662,11 +684,13 @@ const char* MONERO_Wallet_getMultisigInfo(void* wallet_ptr); // optional amount, uint32_t mixin_count, // PendingTransaction::Priority = PendingTransaction::Priority_Low, // uint32_t subaddr_account = 0, -// std::set subaddr_indices = {}) = 0; +// std::set subaddr_indices = {}, +// const std::set &preferred_inputs = {) = 0; void* MONERO_Wallet_createTransaction(void* wallet_ptr, const char* dst_addr, const char* payment_id, uint64_t amount, uint32_t mixin_count, int pendingTransactionPriority, - uint32_t subaddr_account); // std::nullopt + uint32_t subaddr_account, + const char* preferredInputs, const char* separator); // virtual PendingTransaction * createSweepUnmixableTransaction() = 0; // virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) = 0; void* MONERO_Wallet_loadUnsignedTx(void* wallet_ptr, const char* unsigned_filename); @@ -675,6 +699,8 @@ bool MONERO_Wallet_submitTransaction(void* wallet_ptr, const char* fileName); // virtual void disposeTransaction(PendingTransaction * t) = 0; // virtual uint64_t estimateTransactionFee(const std::vector> &destinations, // PendingTransaction::Priority priority) const = 0; +// virtual bool hasUnknownKeyImages() const = 0; +bool MONERO_Wallet_hasUnknownKeyImages(void* wallet_ptr); // virtual bool exportKeyImages(const std::string &filename, bool all = false) = 0; bool MONERO_Wallet_exportKeyImages(void* wallet_ptr, const char* filename, bool all); // virtual bool importKeyImages(const std::string &filename) = 0; @@ -684,6 +710,18 @@ bool MONERO_Wallet_exportOutputs(void* wallet_ptr, const char* filename, bool al // virtual bool importOutputs(const std::string &filename) = 0; bool MONERO_Wallet_importOutputs(void* wallet_ptr, const char* filename); // virtual bool scanTransactions(const std::vector &txids) = 0; +// virtual bool setupBackgroundSync(const BackgroundSyncType background_sync_type, const std::string &wallet_password, const optional &background_cache_password) = 0; +bool MONERO_Wallet_setupBackgroundSync(void* wallet_ptr, int background_sync_type, const char* wallet_password, const char* background_cache_password); +// virtual BackgroundSyncType getBackgroundSyncType() const = 0; +int MONERO_Wallet_getBackgroundSyncType(void* wallet_ptr); +// virtual bool startBackgroundSync() = 0; +bool MONERO_Wallet_startBackgroundSync(void* wallet_ptr); +// virtual bool stopBackgroundSync(const std::string &wallet_password) = 0; +bool MONERO_Wallet_stopBackgroundSync(void* wallet_ptr, const char* wallet_password); +// virtual bool isBackgroundSyncing() const = 0; +bool MONERO_Wallet_isBackgroundSyncing(void* wallet_ptr); +// virtual bool isBackgroundWallet() const = 0; +bool MONERO_Wallet_isBackgroundWallet(void* wallet_ptr); // virtual TransactionHistory * history() = 0; void* MONERO_Wallet_history(void* wallet_ptr); // virtual AddressBook * addressBook() = 0; @@ -836,6 +874,17 @@ void* MONERO_WalletManager_recoveryWallet(const char* path, const char* password // const std::string &subaddressLookahead = "", // uint64_t kdf_rounds = 1, // WalletListener * listener = nullptr) = 0; +// virtual Wallet * createWalletFromPolyseed(const std::string &path, +// const std::string &password, +// NetworkType nettype, +// const std::string &mnemonic, +// const std::string &passphrase = "", +// bool newWallet = true, +// uint64_t restore_height = 0, +// uint64_t kdf_rounds = 1) = 0; +void* MONERO_WalletManager_createWalletFromPolyseed(const char* path, const char* password, + int nettype, const char* mnemonic, const char* passphrase, + bool newWallet, uint64_t restore_height, uint64_t kdf_rounds); // virtual bool closeWallet(Wallet *wallet, bool store = true) = 0; bool MONERO_WalletManager_closeWallet(void* wallet_ptr, bool store); // virtual bool walletExists(const std::string &path) = 0;