summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.devcontainer/Dockerfile5
-rw-r--r--.github/workflows/full_check.yaml34
-rw-r--r--.gitmodules4
-rw-r--r--README.md3
-rwxr-xr-xapply_patches.sh27
-rwxr-xr-xbuild_single.sh21
-rw-r--r--contrib/depends/packages/android_ndk.mk2
-rw-r--r--contrib/depends/packages/native_ccache.mk4
-rw-r--r--contrib/depends/packages/sodium.mk4
-rw-r--r--contrib/depends/toolchain.cmake.in1
-rwxr-xr-xgenerate_checksum.sh2
-rw-r--r--impls/monero.dart/ffigen_zano.yaml11
-rw-r--r--impls/monero.dart/lib/src/checksum_zano.dart4
-rw-r--r--impls/monero.dart/lib/src/generated_bindings_zano.g.dart527
-rw-r--r--impls/monero.dart/lib/zano.dart688
-rwxr-xr-ximpls/monero.dart/update_bindings.sh1
-rw-r--r--impls/monero.ts/checksum_zano.ts5
-rw-r--r--monero_libwallet2_api_c/CMakeLists.txt60
-rw-r--r--monero_libwallet2_api_c/src/main/cpp/helpers.hpp1
-rw-r--r--patches/monero/0009-coin-control.patch211
-rw-r--r--patches/zano/0001-add-missing-include.patch64
-rw-r--r--patches/zano/0002-fix-build-issues.patch39
-rw-r--r--patches/zano/0003-fix-mingw-build-issues.patch61
-rw-r--r--patches/zano/0004-update-tor-connect.patch33
-rw-r--r--patches/zano/0005-fix-ios-builds.patch43
-rw-r--r--patches/zano/0006-use-boost-filesystem-instead-of-stdfs.patch80
-rw-r--r--patches/zano/0007-downgrade-cmake-version-so-LIB_DEPENDS-shows-up.patch22
-rw-r--r--patches/zano/0008-increase-max-password.patch25
-rw-r--r--tests/.DS_Storebin0 -> 6148 bytes
-rw-r--r--tests/download_deps.ts171
-rw-r--r--tests/integration.test.ts2
-rwxr-xr-xtests/utils.ts4
m---------zano0
l---------zano_libwallet2_api_c/CMakeLists.txt1
l---------zano_libwallet2_api_c/src/main/cpp/helpers.cpp1
l---------zano_libwallet2_api_c/src/main/cpp/helpers.hpp1
-rw-r--r--zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp322
-rw-r--r--zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.h67
-rw-r--r--zano_libwallet2_api_c/src/main/cpp/zano_checksum.h6
-rw-r--r--zano_libwallet2_api_c/zano_libwallet2_api_c.exp33
40 files changed, 2410 insertions, 180 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 6dc59c4..ed16f21 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -6,7 +6,10 @@ SHELL ["/bin/bash", "-c"]
# lintinfo5
-RUN wget http://mirrors.kernel.org/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb -O libtinfo5.deb \
+SHELL ["/bin/bash", "-c"]
+
+RUN [[ "$(uname -m)" == "aarch64" || "$(uname -m)" == "arm64" ]] && exit 0 \
+ || wget http://mirrors.kernel.org/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb -O libtinfo5.deb \
&& apt install ./libtinfo5.deb \
&& rm libtinfo5.deb
diff --git a/.github/workflows/full_check.yaml b/.github/workflows/full_check.yaml
index e083dd6..20dcbc5 100644
--- a/.github/workflows/full_check.yaml
+++ b/.github/workflows/full_check.yaml
@@ -64,8 +64,8 @@ jobs:
strategy:
fail-fast: false
matrix:
- coin: [monero, wownero]
- runs-on: ubuntu-24.04
+ coin: [monero, wownero, zano]
+ runs-on: ubuntu-22.04
# container:
# image: debian:bookworm
steps:
@@ -137,7 +137,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- coin: [monero, wownero]
+ coin: [monero, wownero, zano]
runs-on: ubuntu-latest
container:
image: debian:bullseye
@@ -195,7 +195,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- coin: [monero, wownero]
+ coin: [monero, wownero, zano]
name: macos build
runs-on: macos-14
steps:
@@ -210,7 +210,7 @@ jobs:
xcode-version: '15.4'
- name: install dependencies
run: |
- brew install ccache binutils pigz autoconf automake libtool
+ brew install ccache binutils pigz autoconf automake libtool pkg-config
- name: Patch sources
run: |
git config --global --add safe.directory '*'
@@ -256,9 +256,9 @@ jobs:
strategy:
fail-fast: false
matrix:
- coin: [monero, wownero]
+ coin: [monero, wownero, zano]
name: ios build
- runs-on: macos-14
+ runs-on: macos-15
steps:
- name: Checkout monero_c repo
uses: actions/checkout@v4
@@ -268,10 +268,10 @@ jobs:
submodules: recursive
- uses: maxim-lobanov/setup-xcode@v1
with:
- xcode-version: '15.4'
+ xcode-version: '16.1'
- name: install dependencies
run: |
- brew install ccache unbound zmq autoconf automake libtool
+ brew install ccache cmake autoconf automake libtool
- name: Patch sources
run: |
git config --global --add safe.directory '*'
@@ -327,6 +327,10 @@ jobs:
path: release/wownero
- uses: actions/download-artifact@v4
with:
+ name: android zano
+ path: release/zano
+ - uses: actions/download-artifact@v4
+ with:
name: ios monero
path: release/monero
- uses: actions/download-artifact@v4
@@ -335,6 +339,10 @@ jobs:
path: release/wownero
- uses: actions/download-artifact@v4
with:
+ name: ios zano
+ path: release/zano
+ - uses: actions/download-artifact@v4
+ with:
name: linux monero
path: release/monero
- uses: actions/download-artifact@v4
@@ -343,6 +351,10 @@ jobs:
path: release/wownero
- uses: actions/download-artifact@v4
with:
+ name: linux zano
+ path: release/zano
+ - uses: actions/download-artifact@v4
+ with:
name: macos monero
path: release/monero
- uses: actions/download-artifact@v4
@@ -351,6 +363,10 @@ jobs:
path: release/wownero
- uses: actions/download-artifact@v4
with:
+ name: macos zano
+ path: release/zano
+ - uses: actions/download-artifact@v4
+ with:
name: mingw monero
path: release/monero
- uses: actions/download-artifact@v4
diff --git a/.gitmodules b/.gitmodules
index ecf86b2..04af1e1 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -7,6 +7,10 @@
path = wownero
url = https://codeberg.org/wownero/wownero
shallow = true
+[submodule "zano"]
+ path = zano
+ url = https://github.com/hyle-team/zano
+ shallow = true
[submodule "wownero_libwallet2_api_c/wownero-seed"]
path = wownero_libwallet2_api_c/wownero-seed
url = https://github.com/MrCyjaneK/wownero-seed
diff --git a/README.md b/README.md
index 4036888..5ed7564 100644
--- a/README.md
+++ b/README.md
@@ -9,8 +9,7 @@ TL;DR:
```bash
$ rm -rf monero wownero release
$ git submodule update --init --recursive --force
-$ for coin in monero wownero; do ./apply_patches.sh $coin; done
-$ ./build_single monero $(gcc -dumpmachine) -j$(nproc)
+$ for coin in monero wownero zano; do ./apply_patches.sh $coin; done
```
Broken? Not working? Need help? https://moneroc.mrcyjanek.net/
diff --git a/apply_patches.sh b/apply_patches.sh
index 22c3bba..8013c9d 100755
--- a/apply_patches.sh
+++ b/apply_patches.sh
@@ -38,7 +38,30 @@ then
git remote set-url origin https://github.com/mrcyjanek/randomwow.git
popd
fi
+if [[ "$repo" == "zano" ]];
+then
+ pushd contrib/tor-connect
+ git remote set-url origin https://github.com/mrcyjanek/tor-connect.git
+ popd
+fi
git submodule init
git submodule update --init --recursive --force
-touch .patch-applied
-echo "you are good to go!" \ No newline at end of file
+git am -3 <<EOF
+From e56dd6cd0fb1a5e55d3cb08691edf24b26d65299 Mon Sep 17 00:00:00 2001
+From: Czarek Nakamoto <cyjan@mrcyjanek.net>
+Date: Fri, 20 Dec 2024 09:18:08 +0100
+Subject: [PATCH] add .patch-applied
+
+---
+ .patch-applied | 0
+ 1 file changed, 0 insertions(+), 0 deletions(-)
+ create mode 100644 .patch-applied
+
+diff --git a/.patch-applied b/.patch-applied
+new file mode 100644
+index 000000000..e69de29bb
+--
+2.39.5 (Apple Git-154)
+EOF
+
+echo "you are good to go!"
diff --git a/build_single.sh b/build_single.sh
index f868f98..0309a28 100755
--- a/build_single.sh
+++ b/build_single.sh
@@ -20,14 +20,14 @@ set -e
repo=$1
if [[ "x$repo" == "x" ]];
then
- echo "Usage: $0 monero/wownero $(gcc -dumpmachine) -j$proccount"
+ echo "Usage: $0 monero/wownero/zano $(gcc -dumpmachine) -j$proccount"
exit 1
fi
-if [[ "x$repo" != "xwownero" && "x$repo" != "xmonero" ]];
+if [[ "x$repo" != "xwownero" && "x$repo" != "xmonero" && "x$repo" != "xzano" ]];
then
- echo "Usage: $0 monero/wownero $(gcc -dumpmachine) -j$proccount"
- echo "Invalid target given, only monero and wownero are supported targets"
+ echo "Usage: $0 monero/wownero/zano $(gcc -dumpmachine) -j$proccount"
+ echo "Invalid target given"
exit 1
fi
@@ -55,7 +55,12 @@ fi
cd $(dirname $0)
WDIR=$PWD
pushd contrib/depends
- env -i PATH="$PATH" CC=gcc CXX=g++ make "$NPROC" HOST="$HOST_ABI"
+ if [[ -d $HOST_ABI ]];
+ then
+ echo "Not building depends, directory exists"
+ else
+ env -i PATH="$PATH" CC=gcc CXX=g++ make "$NPROC" HOST="$HOST_ABI"
+ fi
popd
buildType=Debug
@@ -63,8 +68,12 @@ buildType=Debug
pushd ${repo}_libwallet2_api_c
rm -rf build/${HOST_ABI} || true
mkdir -p build/${HOST_ABI} -p
+ if [[ "$repo" == "zano" ]];
+ then
+ EXTRA_CMAKE_FLAGS="-DCAKEWALLET=ON"
+ fi
pushd build/${HOST_ABI}
- cmake -DCMAKE_TOOLCHAIN_FILE=$PWD/../../../contrib/depends/${HOST_ABI}/share/toolchain.cmake -DUSE_DEVICE_TREZOR=OFF -DMONERO_FLAVOR=$repo -DCMAKE_BUILD_TYPE=Debug -DHOST_ABI=${HOST_ABI} ../..
+ 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} ../..
make $NPROC
popd
popd
diff --git a/contrib/depends/packages/android_ndk.mk b/contrib/depends/packages/android_ndk.mk
index 2c2914e..89db323 100644
--- a/contrib/depends/packages/android_ndk.mk
+++ b/contrib/depends/packages/android_ndk.mk
@@ -15,7 +15,7 @@ endef
define $(package)_extract_cmds
echo $($(package)_sha256_hash) $($(1)_source_dir)/$($(package)_file_name) | sha256sum -c &&\
- unzip -q $($(1)_source_dir)/$($(package)_file_name)
+ echo "A" | unzip -q $($(1)_source_dir)/$($(package)_file_name)
endef
# arm-linux-androideabi-ar - openssl workaround
diff --git a/contrib/depends/packages/native_ccache.mk b/contrib/depends/packages/native_ccache.mk
index 6821454..1523660 100644
--- a/contrib/depends/packages/native_ccache.mk
+++ b/contrib/depends/packages/native_ccache.mk
@@ -5,7 +5,7 @@ $(package)_file_name=ccache-$($(package)_version).tar.gz
$(package)_sha256_hash=108100960bb7e64573ea925af2ee7611701241abb36ce0aae3354528403a7d87
define $(package)_set_vars
-$(package)_config_opts=-DCMAKE_INSTALL_PREFIX="$(host_prefix)/native"
+$(package)_config_opts=-DCMAKE_INSTALL_PREFIX="$(host_prefix)/native" -DENABLE_TESTING=OFF
endef
define $(package)_config_cmds
@@ -17,7 +17,7 @@ define $(package)_build_cmds
endef
define $(package)_stage_cmds
- cd build && $(MAKE) DESTDIR=$($(package)_staging_dir) install
+ cd build && $(MAKE) -j1 DESTDIR=$($(package)_staging_dir) install
endef
define $(package)_postprocess_cmds
diff --git a/contrib/depends/packages/sodium.mk b/contrib/depends/packages/sodium.mk
index 8e85a4e..0050bd3 100644
--- a/contrib/depends/packages/sodium.mk
+++ b/contrib/depends/packages/sodium.mk
@@ -21,11 +21,11 @@ define $(package)_config_cmds
endef
define $(package)_build_cmds
- $(MAKE) -j$(NUM_CORES)
+ $(MAKE)
endef
define $(package)_stage_cmds
- $(MAKE) DESTDIR=$($(package)_staging_dir) install
+ $(MAKE) -j1 DESTDIR=$($(package)_staging_dir) install
endef
define $(package)_postprocess_cmds
diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in
index 2e0ba52..216741e 100644
--- a/contrib/depends/toolchain.cmake.in
+++ b/contrib/depends/toolchain.cmake.in
@@ -197,6 +197,7 @@ include_directories(@prefix@/include)
include_directories(@prefix@/include/wownero_seed)
add_definitions(-DPOLYSEED_STATIC=ON)
+add_definitions(-DMOBILE_WALLET_BUILD)
#Create a new global cmake flag that indicates building with depends
set (DEPENDS true) \ No newline at end of file
diff --git a/generate_checksum.sh b/generate_checksum.sh
index 4b82e53..ea59961 100755
--- a/generate_checksum.sh
+++ b/generate_checksum.sh
@@ -6,7 +6,7 @@ then
function sha256sum() { shasum -a 256 "$@" ; } && export -f sha256sum
fi
-for coin in monero wownero;
+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)
diff --git a/impls/monero.dart/ffigen_zano.yaml b/impls/monero.dart/ffigen_zano.yaml
new file mode 100644
index 0000000..2c0f6a0
--- /dev/null
+++ b/impls/monero.dart/ffigen_zano.yaml
@@ -0,0 +1,11 @@
+name: ZanoC
+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'
+
+exclude-all-by-default: true
+functions:
+ include:
+ - "ZANO_.+" \ No newline at end of file
diff --git a/impls/monero.dart/lib/src/checksum_zano.dart b/impls/monero.dart/lib/src/checksum_zano.dart
new file mode 100644
index 0000000..b8b879a
--- /dev/null
+++ b/impls/monero.dart/lib/src/checksum_zano.dart
@@ -0,0 +1,4 @@
+// ignore_for_file: constant_identifier_names
+const String wallet2_api_c_h_sha256 = "8acaa95513b85a984c08e05cc3f2ac7530bb8f32946eeeb45357bd846aef33dd";
+const String wallet2_api_c_cpp_sha256 = "4efacd3812d53dd268b6869cc0a9560e7320574d96e09136cf067f796edfeba6-2817090c8ac7639d6f697d00fc8bcba2b3681d90";
+const String wallet2_api_c_exp_sha256 = "66f3ff655bbfd11ad28c318ab707090b5a93276f436b06f7b1c0f329dba3c9c2";
diff --git a/impls/monero.dart/lib/src/generated_bindings_zano.g.dart b/impls/monero.dart/lib/src/generated_bindings_zano.g.dart
new file mode 100644
index 0000000..1ffdc3e
--- /dev/null
+++ b/impls/monero.dart/lib/src/generated_bindings_zano.g.dart
@@ -0,0 +1,527 @@
+// AUTO GENERATED FILE, DO NOT EDIT.
+//
+// Generated by `package:ffigen`.
+// ignore_for_file: type=lint
+import 'dart:ffi' as ffi;
+
+/// monero_c bindings
+class ZanoC {
+ /// Holds the symbol lookup function.
+ final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
+ _lookup;
+
+ /// The symbols are looked up in [dynamicLibrary].
+ ZanoC(ffi.DynamicLibrary dynamicLibrary) : _lookup = dynamicLibrary.lookup;
+
+ /// The symbols are looked up with [lookup].
+ ZanoC.fromLookup(
+ ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
+ lookup)
+ : _lookup = lookup;
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_init(
+ ffi.Pointer<ffi.Char> address,
+ ffi.Pointer<ffi.Char> working_dir,
+ int log_level,
+ ) {
+ return _ZANO_PlainWallet_init(
+ address,
+ working_dir,
+ log_level,
+ );
+ }
+
+ late final _ZANO_PlainWallet_initPtr = _lookup<
+ ffi.NativeFunction<
+ ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>,
+ ffi.Pointer<ffi.Char>, ffi.Int)>>('ZANO_PlainWallet_init');
+ late final _ZANO_PlainWallet_init = _ZANO_PlainWallet_initPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(
+ ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>, int)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_init2(
+ ffi.Pointer<ffi.Char> ip,
+ ffi.Pointer<ffi.Char> port,
+ ffi.Pointer<ffi.Char> working_dir,
+ int log_level,
+ ) {
+ return _ZANO_PlainWallet_init2(
+ ip,
+ port,
+ working_dir,
+ log_level,
+ );
+ }
+
+ late final _ZANO_PlainWallet_init2Ptr = _lookup<
+ ffi.NativeFunction<
+ ffi.Pointer<ffi.Char> Function(
+ ffi.Pointer<ffi.Char>,
+ ffi.Pointer<ffi.Char>,
+ ffi.Pointer<ffi.Char>,
+ ffi.Int)>>('ZANO_PlainWallet_init2');
+ late final _ZANO_PlainWallet_init2 = _ZANO_PlainWallet_init2Ptr.asFunction<
+ ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>,
+ ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>, int)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_reset() {
+ return _ZANO_PlainWallet_reset();
+ }
+
+ late final _ZANO_PlainWallet_resetPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
+ 'ZANO_PlainWallet_reset');
+ late final _ZANO_PlainWallet_reset =
+ _ZANO_PlainWallet_resetPtr.asFunction<ffi.Pointer<ffi.Char> Function()>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_setLogLevel(
+ int log_level,
+ ) {
+ return _ZANO_PlainWallet_setLogLevel(
+ log_level,
+ );
+ }
+
+ late final _ZANO_PlainWallet_setLogLevelPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Int)>>(
+ 'ZANO_PlainWallet_setLogLevel');
+ late final _ZANO_PlainWallet_setLogLevel = _ZANO_PlainWallet_setLogLevelPtr
+ .asFunction<ffi.Pointer<ffi.Char> Function(int)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_getVersion() {
+ return _ZANO_PlainWallet_getVersion();
+ }
+
+ late final _ZANO_PlainWallet_getVersionPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
+ 'ZANO_PlainWallet_getVersion');
+ late final _ZANO_PlainWallet_getVersion = _ZANO_PlainWallet_getVersionPtr
+ .asFunction<ffi.Pointer<ffi.Char> Function()>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_getWalletFiles() {
+ return _ZANO_PlainWallet_getWalletFiles();
+ }
+
+ late final _ZANO_PlainWallet_getWalletFilesPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
+ 'ZANO_PlainWallet_getWalletFiles');
+ late final _ZANO_PlainWallet_getWalletFiles =
+ _ZANO_PlainWallet_getWalletFilesPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function()>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_getExportPrivateInfo(
+ ffi.Pointer<ffi.Char> target_dir,
+ ) {
+ return _ZANO_PlainWallet_getExportPrivateInfo(
+ target_dir,
+ );
+ }
+
+ late final _ZANO_PlainWallet_getExportPrivateInfoPtr = _lookup<
+ ffi.NativeFunction<
+ ffi.Pointer<ffi.Char> Function(
+ ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_getExportPrivateInfo');
+ late final _ZANO_PlainWallet_getExportPrivateInfo =
+ _ZANO_PlainWallet_getExportPrivateInfoPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_deleteWallet(
+ ffi.Pointer<ffi.Char> file_name,
+ ) {
+ return _ZANO_PlainWallet_deleteWallet(
+ file_name,
+ );
+ }
+
+ late final _ZANO_PlainWallet_deleteWalletPtr = _lookup<
+ ffi.NativeFunction<
+ ffi.Pointer<ffi.Char> Function(
+ ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_deleteWallet');
+ late final _ZANO_PlainWallet_deleteWallet = _ZANO_PlainWallet_deleteWalletPtr
+ .asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_getAddressInfo(
+ ffi.Pointer<ffi.Char> addr,
+ ) {
+ return _ZANO_PlainWallet_getAddressInfo(
+ addr,
+ );
+ }
+
+ late final _ZANO_PlainWallet_getAddressInfoPtr = _lookup<
+ ffi.NativeFunction<
+ ffi.Pointer<ffi.Char> Function(
+ ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_getAddressInfo');
+ late final _ZANO_PlainWallet_getAddressInfo =
+ _ZANO_PlainWallet_getAddressInfoPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_getAppconfig(
+ ffi.Pointer<ffi.Char> encryption_key,
+ ) {
+ return _ZANO_PlainWallet_getAppconfig(
+ encryption_key,
+ );
+ }
+
+ late final _ZANO_PlainWallet_getAppconfigPtr = _lookup<
+ ffi.NativeFunction<
+ ffi.Pointer<ffi.Char> Function(
+ ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_getAppconfig');
+ late final _ZANO_PlainWallet_getAppconfig = _ZANO_PlainWallet_getAppconfigPtr
+ .asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_setAppconfig(
+ ffi.Pointer<ffi.Char> conf_str,
+ ffi.Pointer<ffi.Char> encryption_key,
+ ) {
+ return _ZANO_PlainWallet_setAppconfig(
+ conf_str,
+ encryption_key,
+ );
+ }
+
+ late final _ZANO_PlainWallet_setAppconfigPtr = _lookup<
+ ffi.NativeFunction<
+ ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>,
+ ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_setAppconfig');
+ late final _ZANO_PlainWallet_setAppconfig =
+ _ZANO_PlainWallet_setAppconfigPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(
+ ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_generateRandomKey(
+ int lenght,
+ ) {
+ return _ZANO_PlainWallet_generateRandomKey(
+ lenght,
+ );
+ }
+
+ late final _ZANO_PlainWallet_generateRandomKeyPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Uint64)>>(
+ 'ZANO_PlainWallet_generateRandomKey');
+ late final _ZANO_PlainWallet_generateRandomKey =
+ _ZANO_PlainWallet_generateRandomKeyPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(int)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_getLogsBuffer() {
+ return _ZANO_PlainWallet_getLogsBuffer();
+ }
+
+ late final _ZANO_PlainWallet_getLogsBufferPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
+ 'ZANO_PlainWallet_getLogsBuffer');
+ late final _ZANO_PlainWallet_getLogsBuffer =
+ _ZANO_PlainWallet_getLogsBufferPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function()>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_truncateLog() {
+ return _ZANO_PlainWallet_truncateLog();
+ }
+
+ late final _ZANO_PlainWallet_truncateLogPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
+ 'ZANO_PlainWallet_truncateLog');
+ late final _ZANO_PlainWallet_truncateLog = _ZANO_PlainWallet_truncateLogPtr
+ .asFunction<ffi.Pointer<ffi.Char> Function()>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_getConnectivityStatus() {
+ return _ZANO_PlainWallet_getConnectivityStatus();
+ }
+
+ late final _ZANO_PlainWallet_getConnectivityStatusPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
+ 'ZANO_PlainWallet_getConnectivityStatus');
+ late final _ZANO_PlainWallet_getConnectivityStatus =
+ _ZANO_PlainWallet_getConnectivityStatusPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function()>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_open(
+ ffi.Pointer<ffi.Char> path,
+ ffi.Pointer<ffi.Char> password,
+ ) {
+ return _ZANO_PlainWallet_open(
+ path,
+ password,
+ );
+ }
+
+ late final _ZANO_PlainWallet_openPtr = _lookup<
+ ffi.NativeFunction<
+ ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>,
+ ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_open');
+ late final _ZANO_PlainWallet_open = _ZANO_PlainWallet_openPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(
+ ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_restore(
+ ffi.Pointer<ffi.Char> seed,
+ ffi.Pointer<ffi.Char> path,
+ ffi.Pointer<ffi.Char> password,
+ ffi.Pointer<ffi.Char> seed_password,
+ ) {
+ return _ZANO_PlainWallet_restore(
+ seed,
+ path,
+ password,
+ seed_password,
+ );
+ }
+
+ late final _ZANO_PlainWallet_restorePtr = _lookup<
+ ffi.NativeFunction<
+ ffi.Pointer<ffi.Char> Function(
+ ffi.Pointer<ffi.Char>,
+ ffi.Pointer<ffi.Char>,
+ ffi.Pointer<ffi.Char>,
+ ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_restore');
+ late final _ZANO_PlainWallet_restore =
+ _ZANO_PlainWallet_restorePtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(
+ ffi.Pointer<ffi.Char>,
+ ffi.Pointer<ffi.Char>,
+ ffi.Pointer<ffi.Char>,
+ ffi.Pointer<ffi.Char>)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_generate(
+ ffi.Pointer<ffi.Char> path,
+ ffi.Pointer<ffi.Char> password,
+ ) {
+ return _ZANO_PlainWallet_generate(
+ path,
+ password,
+ );
+ }
+
+ late final _ZANO_PlainWallet_generatePtr = _lookup<
+ ffi.NativeFunction<
+ ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>,
+ ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_generate');
+ late final _ZANO_PlainWallet_generate =
+ _ZANO_PlainWallet_generatePtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(
+ ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_getOpenWallets() {
+ return _ZANO_PlainWallet_getOpenWallets();
+ }
+
+ late final _ZANO_PlainWallet_getOpenWalletsPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
+ 'ZANO_PlainWallet_getOpenWallets');
+ late final _ZANO_PlainWallet_getOpenWallets =
+ _ZANO_PlainWallet_getOpenWalletsPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function()>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_getWalletStatus(
+ int h,
+ ) {
+ return _ZANO_PlainWallet_getWalletStatus(
+ h,
+ );
+ }
+
+ late final _ZANO_PlainWallet_getWalletStatusPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Int64)>>(
+ 'ZANO_PlainWallet_getWalletStatus');
+ late final _ZANO_PlainWallet_getWalletStatus =
+ _ZANO_PlainWallet_getWalletStatusPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(int)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_closeWallet(
+ int h,
+ ) {
+ return _ZANO_PlainWallet_closeWallet(
+ h,
+ );
+ }
+
+ late final _ZANO_PlainWallet_closeWalletPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Int64)>>(
+ 'ZANO_PlainWallet_closeWallet');
+ late final _ZANO_PlainWallet_closeWallet = _ZANO_PlainWallet_closeWalletPtr
+ .asFunction<ffi.Pointer<ffi.Char> Function(int)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_invoke(
+ int h,
+ ffi.Pointer<ffi.Char> params,
+ ) {
+ return _ZANO_PlainWallet_invoke(
+ h,
+ params,
+ );
+ }
+
+ late final _ZANO_PlainWallet_invokePtr = _lookup<
+ ffi.NativeFunction<
+ ffi.Pointer<ffi.Char> Function(
+ ffi.Int64, ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_invoke');
+ late final _ZANO_PlainWallet_invoke = _ZANO_PlainWallet_invokePtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(int, ffi.Pointer<ffi.Char>)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_asyncCall(
+ ffi.Pointer<ffi.Char> method_name,
+ int instance_id,
+ ffi.Pointer<ffi.Char> params,
+ ) {
+ return _ZANO_PlainWallet_asyncCall(
+ method_name,
+ instance_id,
+ params,
+ );
+ }
+
+ late final _ZANO_PlainWallet_asyncCallPtr = _lookup<
+ ffi.NativeFunction<
+ ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>, ffi.Uint64,
+ ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_asyncCall');
+ late final _ZANO_PlainWallet_asyncCall =
+ _ZANO_PlainWallet_asyncCallPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(
+ ffi.Pointer<ffi.Char>, int, ffi.Pointer<ffi.Char>)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_tryPullResult(
+ int instance_id,
+ ) {
+ return _ZANO_PlainWallet_tryPullResult(
+ instance_id,
+ );
+ }
+
+ late final _ZANO_PlainWallet_tryPullResultPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Uint64)>>(
+ 'ZANO_PlainWallet_tryPullResult');
+ late final _ZANO_PlainWallet_tryPullResult =
+ _ZANO_PlainWallet_tryPullResultPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(int)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_syncCall(
+ ffi.Pointer<ffi.Char> method_name,
+ int instance_id,
+ ffi.Pointer<ffi.Char> params,
+ ) {
+ return _ZANO_PlainWallet_syncCall(
+ method_name,
+ instance_id,
+ params,
+ );
+ }
+
+ late final _ZANO_PlainWallet_syncCallPtr = _lookup<
+ ffi.NativeFunction<
+ ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>, ffi.Uint64,
+ ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_syncCall');
+ late final _ZANO_PlainWallet_syncCall =
+ _ZANO_PlainWallet_syncCallPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(
+ ffi.Pointer<ffi.Char>, int, ffi.Pointer<ffi.Char>)>();
+
+ bool ZANO_PlainWallet_isWalletExist(
+ ffi.Pointer<ffi.Char> path,
+ ) {
+ return _ZANO_PlainWallet_isWalletExist(
+ path,
+ );
+ }
+
+ late final _ZANO_PlainWallet_isWalletExistPtr =
+ _lookup<ffi.NativeFunction<ffi.Bool Function(ffi.Pointer<ffi.Char>)>>(
+ 'ZANO_PlainWallet_isWalletExist');
+ late final _ZANO_PlainWallet_isWalletExist =
+ _ZANO_PlainWallet_isWalletExistPtr.asFunction<
+ bool Function(ffi.Pointer<ffi.Char>)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_getWalletInfo(
+ int h,
+ ) {
+ return _ZANO_PlainWallet_getWalletInfo(
+ h,
+ );
+ }
+
+ late final _ZANO_PlainWallet_getWalletInfoPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Int64)>>(
+ 'ZANO_PlainWallet_getWalletInfo');
+ late final _ZANO_PlainWallet_getWalletInfo =
+ _ZANO_PlainWallet_getWalletInfoPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(int)>();
+
+ ffi.Pointer<ffi.Char> ZANO_PlainWallet_resetWalletPassword(
+ int h,
+ ffi.Pointer<ffi.Char> password,
+ ) {
+ return _ZANO_PlainWallet_resetWalletPassword(
+ h,
+ password,
+ );
+ }
+
+ late final _ZANO_PlainWallet_resetWalletPasswordPtr = _lookup<
+ ffi.NativeFunction<
+ ffi.Pointer<ffi.Char> Function(ffi.Int64,
+ ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_resetWalletPassword');
+ late final _ZANO_PlainWallet_resetWalletPassword =
+ _ZANO_PlainWallet_resetWalletPasswordPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function(int, ffi.Pointer<ffi.Char>)>();
+
+ int ZANO_PlainWallet_getCurrentTxFee(
+ int priority,
+ ) {
+ return _ZANO_PlainWallet_getCurrentTxFee(
+ priority,
+ );
+ }
+
+ late final _ZANO_PlainWallet_getCurrentTxFeePtr =
+ _lookup<ffi.NativeFunction<ffi.Uint64 Function(ffi.Uint64)>>(
+ 'ZANO_PlainWallet_getCurrentTxFee');
+ late final _ZANO_PlainWallet_getCurrentTxFee =
+ _ZANO_PlainWallet_getCurrentTxFeePtr.asFunction<int Function(int)>();
+
+ void ZANO_free(
+ ffi.Pointer<ffi.Void> ptr,
+ ) {
+ return _ZANO_free(
+ ptr,
+ );
+ }
+
+ late final _ZANO_freePtr =
+ _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
+ 'ZANO_free');
+ late final _ZANO_free =
+ _ZANO_freePtr.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
+
+ ffi.Pointer<ffi.Char> ZANO_checksum_wallet2_api_c_h() {
+ return _ZANO_checksum_wallet2_api_c_h();
+ }
+
+ late final _ZANO_checksum_wallet2_api_c_hPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
+ 'ZANO_checksum_wallet2_api_c_h');
+ late final _ZANO_checksum_wallet2_api_c_h = _ZANO_checksum_wallet2_api_c_hPtr
+ .asFunction<ffi.Pointer<ffi.Char> Function()>();
+
+ ffi.Pointer<ffi.Char> ZANO_checksum_wallet2_api_c_cpp() {
+ return _ZANO_checksum_wallet2_api_c_cpp();
+ }
+
+ late final _ZANO_checksum_wallet2_api_c_cppPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
+ 'ZANO_checksum_wallet2_api_c_cpp');
+ late final _ZANO_checksum_wallet2_api_c_cpp =
+ _ZANO_checksum_wallet2_api_c_cppPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function()>();
+
+ ffi.Pointer<ffi.Char> ZANO_checksum_wallet2_api_c_exp() {
+ return _ZANO_checksum_wallet2_api_c_exp();
+ }
+
+ late final _ZANO_checksum_wallet2_api_c_expPtr =
+ _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
+ 'ZANO_checksum_wallet2_api_c_exp');
+ late final _ZANO_checksum_wallet2_api_c_exp =
+ _ZANO_checksum_wallet2_api_c_expPtr.asFunction<
+ ffi.Pointer<ffi.Char> Function()>();
+}
diff --git a/impls/monero.dart/lib/zano.dart b/impls/monero.dart/lib/zano.dart
new file mode 100644
index 0000000..f17346a
--- /dev/null
+++ b/impls/monero.dart/lib/zano.dart
@@ -0,0 +1,688 @@
+
+// ignore_for_file: non_constant_identifier_names, camel_case_types
+
+import 'dart:ffi';
+import 'dart:io';
+
+import 'package:ffi/ffi.dart';
+import 'package:monero/src/generated_bindings_zano.g.dart';
+
+export 'src/checksum_monero.dart';
+
+typedef PendingTransaction = Pointer<Void>;
+
+ZanoC? lib;
+String libPath = (() {
+ if (Platform.isWindows) return 'zano_libwallet2_api_c.dll';
+ if (Platform.isMacOS) return 'zano_libwallet2_api_c.dylib';
+ if (Platform.isIOS) return 'ZanoWallet.framework/ZanoWallet';
+ if (Platform.isAndroid) return 'libzano_libwallet2_api_c.so';
+ return 'zano_libwallet2_api_c.so';
+})();
+
+Map<String, List<int>> debugCallLength = {};
+
+final defaultSeparatorStr = ";";
+final defaultSeparator = defaultSeparatorStr.toNativeUtf8().cast<Char>();
+/* we don't call .free here, this comment serves one purpose - so the numbers match :) */
+
+final Stopwatch sw = Stopwatch()..start();
+
+bool printStarts = false;
+
+void Function(String call)? debugStart = (call) {
+ try {
+ if (printStarts) print("MONERO: $call");
+ debugCallLength[call] ??= <int>[];
+ debugCallLength[call]!.add(sw.elapsedMicroseconds);
+ } catch (e) {}
+};
+void debugChores() {
+ for (var key in debugCallLength.keys) {
+ if (debugCallLength[key]!.length > 1000000) {
+ final elm =
+ debugCallLength[key]!.reduce((value, element) => value + element);
+ debugCallLength[key]!.clear();
+ debugCallLength["${key}_1M"] ??= <int>[];
+ debugCallLength["${key}_1M"]!.add(elm);
+ }
+ }
+}
+
+int debugCount = 0;
+
+void Function(String call)? debugEnd = (call) {
+ try {
+ final id = debugCallLength[call]!.length - 1;
+ if (++debugCount > 1000000) {
+ debugCount = 0;
+ debugChores();
+ }
+ debugCallLength[call]![id] =
+ sw.elapsedMicroseconds - debugCallLength[call]![id];
+ } catch (e) {}
+};
+void Function(String call, dynamic error)? errorHandler = (call, error) {
+ print("$call: $error");
+};
+
+// extern ADDAPI const char* ZANO_PlainWallet_init(const char* address, const char* working_dir, int log_level);
+String PlainWallet_init(String address, String working_dir, int log_level) {
+ debugStart?.call('ZANO_PlainWallet_init');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final address_ = address.toNativeUtf8();
+ final working_dir_ = working_dir.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_init(address_.cast(), working_dir_.cast(), log_level);
+ calloc.free(address_);
+ calloc.free(working_dir_);
+ debugEnd?.call('ZANO_PlainWallet_init');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_init');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_init', e);
+ debugEnd?.call('ZANO_PlainWallet_init');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_init2(const char* ip, const char* port, const char* working_dir, int log_level);
+String PlainWallet_init2(String ip, String port, String working_dir, int log_level) {
+ debugStart?.call('ZANO_PlainWallet_init2');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final ip_ = ip.toNativeUtf8();
+ final port_ = port.toNativeUtf8();
+ final working_dir_ = working_dir.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_init2(ip_.cast(), port_.cast(), working_dir_.cast(), log_level);
+ calloc.free(ip_);
+ calloc.free(port_);
+ calloc.free(working_dir_);
+ debugEnd?.call('ZANO_PlainWallet_init2');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_init2');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_init2', e);
+ debugEnd?.call('ZANO_PlainWallet_init2');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_reset();
+String PlainWallet_reset() {
+ debugStart?.call('ZANO_PlainWallet_reset');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_PlainWallet_reset();
+ debugEnd?.call('ZANO_PlainWallet_reset');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_reset');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_reset', e);
+ debugEnd?.call('ZANO_PlainWallet_reset');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_setLogLevel(int log_level);
+String PlainWallet_setLogLevel(int log_level) {
+ debugStart?.call('ZANO_PlainWallet_setLogLevel');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_PlainWallet_setLogLevel(log_level);
+ debugEnd?.call('ZANO_PlainWallet_setLogLevel');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_setLogLevel');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_setLogLevel', e);
+ debugEnd?.call('ZANO_PlainWallet_setLogLevel');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_getVersion();
+String PlainWallet_getVersion() {
+ debugStart?.call('ZANO_PlainWallet_getVersion');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_PlainWallet_getVersion();
+ debugEnd?.call('ZANO_PlainWallet_getVersion');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_getVersion');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_getVersion', e);
+ debugEnd?.call('ZANO_PlainWallet_getVersion');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_getWalletFiles();
+String PlainWallet_getWalletFiles() {
+ debugStart?.call('ZANO_PlainWallet_getWalletFiles');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_PlainWallet_getWalletFiles();
+ debugEnd?.call('ZANO_PlainWallet_getWalletFiles');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_getWalletFiles');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_getWalletFiles', e);
+ debugEnd?.call('ZANO_PlainWallet_getWalletFiles');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_getExportPrivateInfo(const char* target_dir);
+String PlainWallet_getExportPrivateInfo(String target_dir) {
+ debugStart?.call('ZANO_PlainWallet_getExportPrivateInfo');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final target_dir_ = target_dir.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_getExportPrivateInfo(target_dir_.cast());
+ calloc.free(target_dir_);
+ debugEnd?.call('ZANO_PlainWallet_getExportPrivateInfo');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_getExportPrivateInfo');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_getExportPrivateInfo', e);
+ debugEnd?.call('ZANO_PlainWallet_getExportPrivateInfo');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_deleteWallet(const char* file_name);
+String PlainWallet_deleteWallet(String file_name) {
+ debugStart?.call('ZANO_PlainWallet_deleteWallet');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final file_name_ = file_name.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_deleteWallet(file_name_.cast());
+ calloc.free(file_name_);
+ debugEnd?.call('ZANO_PlainWallet_deleteWallet');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_deleteWallet');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_deleteWallet', e);
+ debugEnd?.call('ZANO_PlainWallet_deleteWallet');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_getAddressInfo(const char* addr);
+String PlainWallet_getAddressInfo(String addr) {
+ debugStart?.call('ZANO_PlainWallet_getAddressInfo');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final addr_ = addr.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_getAddressInfo(addr_.cast());
+ calloc.free(addr_);
+ debugEnd?.call('ZANO_PlainWallet_getAddressInfo');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_getAddressInfo');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_getAddressInfo', e);
+ debugEnd?.call('ZANO_PlainWallet_getAddressInfo');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_getAppconfig(const char* encryption_key);
+String PlainWallet_getAppconfig(String encryption_key) {
+ debugStart?.call('ZANO_PlainWallet_getAppconfig');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final encryption_key_ = encryption_key.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_getAppconfig(encryption_key_.cast());
+ calloc.free(encryption_key_);
+ debugEnd?.call('ZANO_PlainWallet_getAppconfig');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_getAppconfig');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_getAppconfig', e);
+ debugEnd?.call('ZANO_PlainWallet_getAppconfig');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_setAppconfig(const char* conf_str, const char* encryption_key);
+String PlainWallet_setAppconfig(String conf_str, String encryption_key) {
+ debugStart?.call('ZANO_PlainWallet_setAppconfig');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final conf_str_ = conf_str.toNativeUtf8();
+ final encryption_key_ = encryption_key.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_setAppconfig(conf_str_.cast(), encryption_key_.cast());
+ calloc.free(conf_str_);
+ calloc.free(encryption_key_);
+ debugEnd?.call('ZANO_PlainWallet_setAppconfig');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_setAppconfig');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_setAppconfig', e);
+ debugEnd?.call('ZANO_PlainWallet_setAppconfig');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_generateRandomKey(uint64_t lenght);
+String PlainWallet_generateRandomKey(int length) {
+ debugStart?.call('ZANO_PlainWallet_generateRandomKey');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_PlainWallet_generateRandomKey(length);
+ debugEnd?.call('ZANO_PlainWallet_generateRandomKey');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_generateRandomKey');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_generateRandomKey', e);
+ debugEnd?.call('ZANO_PlainWallet_generateRandomKey');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_getLogsBuffer();
+String PlainWallet_getLogsBuffer() {
+ debugStart?.call('ZANO_PlainWallet_getLogsBuffer');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_PlainWallet_getLogsBuffer();
+ debugEnd?.call('ZANO_PlainWallet_getLogsBuffer');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_getLogsBuffer');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_getLogsBuffer', e);
+ debugEnd?.call('ZANO_PlainWallet_getLogsBuffer');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_truncateLog();
+String PlainWallet_truncateLog() {
+ debugStart?.call('ZANO_PlainWallet_truncateLog');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_PlainWallet_truncateLog();
+ debugEnd?.call('ZANO_PlainWallet_truncateLog');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_truncateLog');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_truncateLog', e);
+ debugEnd?.call('ZANO_PlainWallet_truncateLog');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_getConnectivityStatus();
+String PlainWallet_getConnectivityStatus() {
+ debugStart?.call('ZANO_PlainWallet_getConnectivityStatus');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_PlainWallet_getConnectivityStatus();
+ debugEnd?.call('ZANO_PlainWallet_getConnectivityStatus');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_getConnectivityStatus');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_getConnectivityStatus', e);
+ debugEnd?.call('ZANO_PlainWallet_getConnectivityStatus');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_open(const char* path, const char* password);
+String PlainWallet_open(String path, String password) {
+ debugStart?.call('ZANO_PlainWallet_open');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final path_ = path.toNativeUtf8();
+ final password_ = password.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_open(path_.cast(), password_.cast());
+ calloc.free(path_);
+ calloc.free(password_);
+ debugEnd?.call('ZANO_PlainWallet_open');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_open');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_open', e);
+ debugEnd?.call('ZANO_PlainWallet_open');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_restore(const char* seed, const char* path, const char* password, const char* seed_password);
+String PlainWallet_restore(String seed, String path, String password, String seed_password) {
+ debugStart?.call('ZANO_PlainWallet_restore');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final seed_ = seed.toNativeUtf8();
+ final path_ = path.toNativeUtf8();
+ final password_ = password.toNativeUtf8();
+ final seed_password_ = seed_password.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_restore(seed_.cast(), path_.cast(), password_.cast(), seed_password_.cast());
+ calloc.free(seed_);
+ calloc.free(path_);
+ calloc.free(password_);
+ calloc.free(seed_password_);
+ debugEnd?.call('ZANO_PlainWallet_restore');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_restore');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_restore', e);
+ debugEnd?.call('ZANO_PlainWallet_restore');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_generate(const char* path, const char* password);
+String PlainWallet_generate(String path, String password) {
+ debugStart?.call('ZANO_PlainWallet_generate');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final path_ = path.toNativeUtf8();
+ final password_ = password.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_generate(path_.cast(), password_.cast());
+ calloc.free(path_);
+ calloc.free(password_);
+ debugEnd?.call('ZANO_PlainWallet_generate');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_generate');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_generate', e);
+ debugEnd?.call('ZANO_PlainWallet_generate');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_getOpenWallets();
+String PlainWallet_getOpenWallets() {
+ debugStart?.call('ZANO_PlainWallet_getOpenWallets');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_PlainWallet_getOpenWallets();
+ debugEnd?.call('ZANO_PlainWallet_getOpenWallets');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_getOpenWallets');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_getOpenWallets', e);
+ debugEnd?.call('ZANO_PlainWallet_getOpenWallets');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_getWalletStatus(int64_t h);
+String PlainWallet_getWalletStatus(int h) {
+ debugStart?.call('ZANO_PlainWallet_getWalletStatus');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_PlainWallet_getWalletStatus(h);
+ debugEnd?.call('ZANO_PlainWallet_getWalletStatus');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_getWalletStatus');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_getWalletStatus', e);
+ debugEnd?.call('ZANO_PlainWallet_getWalletStatus');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_closeWallet(int64_t h);
+String PlainWallet_closeWallet(int h) {
+ debugStart?.call('ZANO_PlainWallet_closeWallet');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_PlainWallet_closeWallet(h);
+ debugEnd?.call('ZANO_PlainWallet_closeWallet');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_closeWallet');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_closeWallet', e);
+ debugEnd?.call('ZANO_PlainWallet_closeWallet');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_invoke(int64_t h, const char* params);
+String PlainWallet_invoke(int h, String params) {
+ debugStart?.call('ZANO_PlainWallet_invoke');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final params_ = params.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_invoke(h, params_.cast());
+ calloc.free(params_);
+ debugEnd?.call('ZANO_PlainWallet_invoke');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_invoke');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_invoke', e);
+ debugEnd?.call('ZANO_PlainWallet_invoke');
+ return "";
+ }
+}
+
+// extern ADDAPI const char* ZANO_PlainWallet_asyncCall(const char* method_name, uint64_t instance_id, const char* params);
+String PlainWallet_asyncCall(String method_name, int h, String params) {
+ debugStart?.call('ZANO_PlainWallet_asyncCall');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final params_ = params.toNativeUtf8();
+ final method_name_ = method_name.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_asyncCall(method_name_.cast(), h, params_.cast());
+ calloc.free(params_);
+ calloc.free(method_name_);
+ debugEnd?.call('ZANO_PlainWallet_asyncCall');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_asyncCall');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_asyncCall', e);
+ debugEnd?.call('ZANO_PlainWallet_asyncCall');
+ return "";
+ }
+}
+
+// extern ADDAPI const char* ZANO_PlainWallet_tryPullResult(uint64_t instance_id);
+String PlainWallet_tryPullResult(int instance_id) {
+ debugStart?.call('ZANO_PlainWallet_tryPullResult');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_PlainWallet_tryPullResult(instance_id);
+ debugEnd?.call('ZANO_PlainWallet_tryPullResult');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_tryPullResult');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_tryPullResult', e);
+ debugEnd?.call('ZANO_PlainWallet_tryPullResult');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_syncCall(const char* method_name, uint64_t instance_id, const char* params);
+String PlainWallet_syncCall(String method_name, int instance_id, String params) {
+ debugStart?.call('ZANO_PlainWallet_syncCall');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final method_name_ = method_name.toNativeUtf8();
+ final params_ = params.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_syncCall(method_name_.cast(), instance_id, params_.cast());
+ calloc.free(method_name_);
+ calloc.free(params_);
+ debugEnd?.call('ZANO_PlainWallet_syncCall');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_syncCall');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_syncCall', e);
+ debugEnd?.call('ZANO_PlainWallet_syncCall');
+ return "";
+ }
+}
+// extern ADDAPI bool ZANO_PlainWallet_isWalletExist(const char* path);
+bool PlainWallet_isWalletExist(String path) {
+ debugStart?.call('ZANO_PlainWallet_isWalletExist');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final path_ = path.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_isWalletExist(path_.cast());
+ calloc.free(path_);
+ debugEnd?.call('ZANO_PlainWallet_isWalletExist');
+ return txid;
+}
+// extern ADDAPI const char* ZANO_PlainWallet_getWalletInfo(int64_t h);
+String PlainWallet_getWalletInfo(int h) {
+ debugStart?.call('ZANO_PlainWallet_getWalletInfo');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_PlainWallet_getWalletInfo(h);
+ debugEnd?.call('ZANO_PlainWallet_getWalletInfo');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_getWalletInfo');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_getWalletInfo', e);
+ debugEnd?.call('ZANO_PlainWallet_getWalletInfo');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_PlainWallet_resetWalletPassword(int64_t h, const char* password);
+String PlainWallet_resetWalletPassword(int h, String password) {
+ debugStart?.call('ZANO_PlainWallet_resetWalletPassword');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final password_ = password.toNativeUtf8();
+ final txid = lib!.ZANO_PlainWallet_resetWalletPassword(h, password_.cast());
+ calloc.free(password_);
+ debugEnd?.call('ZANO_PlainWallet_resetWalletPassword');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_PlainWallet_resetWalletPassword');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_PlainWallet_resetWalletPassword', e);
+ debugEnd?.call('ZANO_PlainWallet_resetWalletPassword');
+ return "";
+ }
+}
+// extern ADDAPI uint64_t ZANO_PlainWallet_getCurrentTxFee(uint64_t priority);
+int PlainWallet_getCurrentTxFee(int priority) {
+ debugStart?.call('ZANO_PlainWallet_getCurrentTxFee');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_PlainWallet_getCurrentTxFee(priority);
+ debugEnd?.call('ZANO_PlainWallet_getCurrentTxFee');
+ return txid;
+}
+
+void ZANO_free(Pointer<Void> wlptr) {
+ debugStart?.call('ZANO_free');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+
+ final s = lib!.ZANO_free(wlptr);
+ debugEnd?.call('ZANO_free');
+ return s;
+}
+
+// extern ADDAPI const char* ZANO_checksum_wallet2_api_c_h();
+String checksum_wallet2_api_c_h() {
+ debugStart?.call('ZANO_checksum_wallet2_api_c_h');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_checksum_wallet2_api_c_h();
+ debugEnd?.call('ZANO_checksum_wallet2_api_c_h');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_checksum_wallet2_api_c_h');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_checksum_wallet2_api_c_h', e);
+ debugEnd?.call('ZANO_checksum_wallet2_api_c_h');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_checksum_wallet2_api_c_cpp();
+String checksum_wallet2_api_c_cpp() {
+ debugStart?.call('ZANO_checksum_wallet2_api_c_cpp');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_checksum_wallet2_api_c_cpp();
+ debugEnd?.call('ZANO_checksum_wallet2_api_c_cpp');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_checksum_wallet2_api_c_cpp');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_checksum_wallet2_api_c_cpp', e);
+ debugEnd?.call('ZANO_checksum_wallet2_api_c_cpp');
+ return "";
+ }
+}
+// extern ADDAPI const char* ZANO_checksum_wallet2_api_c_exp();
+String checksum_wallet2_api_c_exp() {
+ debugStart?.call('ZANO_checksum_wallet2_api_c_exp');
+ lib ??= ZanoC(DynamicLibrary.open(libPath));
+ final txid = lib!.ZANO_checksum_wallet2_api_c_exp();
+ debugEnd?.call('ZANO_checksum_wallet2_api_c_exp');
+ try {
+ final strPtr = txid.cast<Utf8>();
+ final str = strPtr.toDartString();
+ ZANO_free(strPtr.cast());
+ debugEnd?.call('ZANO_checksum_wallet2_api_c_exp');
+ return str;
+ } catch (e) {
+ errorHandler?.call('ZANO_checksum_wallet2_api_c_exp', e);
+ debugEnd?.call('ZANO_checksum_wallet2_api_c_exp');
+ return "";
+ }
+} \ No newline at end of file
diff --git a/impls/monero.dart/update_bindings.sh b/impls/monero.dart/update_bindings.sh
index 8ac3cab..f1ba024 100755
--- a/impls/monero.dart/update_bindings.sh
+++ b/impls/monero.dart/update_bindings.sh
@@ -6,3 +6,4 @@ cd "$(realpath $(dirname $0))"
dart run ffigen --config ffigen_wownero.yaml
dart run ffigen --config ffigen_monero.yaml
+dart run ffigen --config ffigen_zano.yaml
diff --git a/impls/monero.ts/checksum_zano.ts b/impls/monero.ts/checksum_zano.ts
new file mode 100644
index 0000000..2af89bd
--- /dev/null
+++ b/impls/monero.ts/checksum_zano.ts
@@ -0,0 +1,5 @@
+export const zanoChecksum = {
+ wallet2_api_c_h_sha256: "8acaa95513b85a984c08e05cc3f2ac7530bb8f32946eeeb45357bd846aef33dd",
+ wallet2_api_c_cpp_sha256: "4efacd3812d53dd268b6869cc0a9560e7320574d96e09136cf067f796edfeba6-2817090c8ac7639d6f697d00fc8bcba2b3681d90",
+ wallet2_api_c_exp_sha256: "66f3ff655bbfd11ad28c318ab707090b5a93276f436b06f7b1c0f329dba3c9c2",
+}
diff --git a/monero_libwallet2_api_c/CMakeLists.txt b/monero_libwallet2_api_c/CMakeLists.txt
index dadafc6..6790333 100644
--- a/monero_libwallet2_api_c/CMakeLists.txt
+++ b/monero_libwallet2_api_c/CMakeLists.txt
@@ -1,8 +1,11 @@
-cmake_minimum_required(VERSION 3.4.1)
+cmake_minimum_required(VERSION 3.5)
project(wallet2_api_c)
message(STATUS ABI_INFO = ${HOST_ABI})
-set (CMAKE_CXX_STANDARD 11)
+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)
@@ -34,7 +37,7 @@ if (${HOST_ABI} STREQUAL "host-apple-darwin" OR
endif()
endif()
-if(${HOST_ABI} STREQUAL "x86_64-linux-android" OR
+if(${HOST_ABI} STREQUAL "" OR
${HOST_ABI} STREQUAL "i686-linux-android" OR
${HOST_ABI} STREQUAL "aarch64-linux-android" OR
${HOST_ABI} STREQUAL "armv7a-linux-androideabi")
@@ -76,26 +79,60 @@ if(${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64
set_target_properties(wallet2_api_c PROPERTIES NO_SONAME 1)
endif()
+if (${MONERO_FLAVOR} STREQUAL "monero")
+ target_compile_definitions(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)
+elseif(${MONERO_FLAVOR} STREQUAL "zano")
+ target_compile_definitions(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")
set_target_properties(wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,--exclude-libs,ALL")
endif()
-add_subdirectory("${CMAKE_SOURCE_DIR}/../${MONERO_FLAVOR}" ${CMAKE_BINARY_DIR}/${MONERO_FLAVOR}_build EXCLUDE_FROM_ALL)
-
-
+if (${MONERO_FLAVOR} STREQUAL "zano")
+ include_directories(
+ ${CMAKE_SOURCE_DIR}/build/${HOST_ABI}/zano_build/contrib/zlib
+ )
+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 "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")
+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")
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()
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
+elseif(${MONERO_FLAVOR} STREQUAL "zano")
+ find_package(Boost 1.71 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options)
+ find_package(OpenSSL REQUIRED)
+ set(WALLET_TARGETS
+ wallet
+ general
+ tor-connect
+ crypto
+ currency_core
+ common
+ zlibstatic
+
+ ${Boost_LIBRARIES}
+ ${OpenSSL_LIBRARIES})
+endif()
+
if(${MONERO_FLAVOR} STREQUAL "wownero")
add_subdirectory(wownero-seed EXCLUDE_FROM_ALL)
set(EXTRA_LIBS_WOWNEROSEED wownero-seed)
@@ -106,11 +143,14 @@ endif()
#foreach (_variableName ${_variableNames})
# message(STATUS "${_variableName}=${${_variableName}}")
#endforeach()
+#message(SEND_ERROR "${Boost_LIBRARIES}")
+#message(SEND_ERROR "${WALLET_TARGETS}
+# ${EXTRA_LIBS_WOWNEROSEED}
+# ${EXTRA_LIBS_ANDROID}")
target_link_libraries( wallet2_api_c
- wallet_api
+ ${WALLET_TARGETS}
${EXTRA_LIBS_WOWNEROSEED}
${EXTRA_LIBS_ANDROID}
- ${wallet_api_LIB_DEPENDS}
- ) \ No newline at end of file
+ )
diff --git a/monero_libwallet2_api_c/src/main/cpp/helpers.hpp b/monero_libwallet2_api_c/src/main/cpp/helpers.hpp
index 2c64394..83cf33b 100644
--- a/monero_libwallet2_api_c/src/main/cpp/helpers.hpp
+++ b/monero_libwallet2_api_c/src/main/cpp/helpers.hpp
@@ -3,6 +3,7 @@
#include <set>
#include <sstream>
#include <cstdlib>
+#include <iostream>
// Debug macros
#define DEBUG_START() \
diff --git a/patches/monero/0009-coin-control.patch b/patches/monero/0009-coin-control.patch
index 4c4b842..5ce3669 100644
--- a/patches/monero/0009-coin-control.patch
+++ b/patches/monero/0009-coin-control.patch
@@ -1,4 +1,4 @@
-From d15a18cac55cb06d5421ecfef1118e439d0cd572 Mon Sep 17 00:00:00 2001
+From 5b7e0a2085f1e9804b0c4ae97f17d84419a1199b Mon Sep 17 00:00:00 2001
From: tobtoht <tob@featherwallet.org>
Date: Tue, 12 Mar 2024 11:07:57 +0100
Subject: [PATCH 10/15] coin control
@@ -10,12 +10,12 @@ Subject: [PATCH 10/15] coin control
src/wallet/api/coins.h | 40 +++++++
src/wallet/api/coins_info.cpp | 122 ++++++++++++++++++++
src/wallet/api/coins_info.h | 71 ++++++++++++
- src/wallet/api/wallet.cpp | 106 ++++++++++++++++-
+ src/wallet/api/wallet.cpp | 170 +++++++++++++++++++++------
src/wallet/api/wallet.h | 10 +-
src/wallet/api/wallet2_api.h | 52 ++++++++-
src/wallet/wallet2.cpp | 46 +++++++-
src/wallet/wallet2.h | 11 +-
- 11 files changed, 635 insertions(+), 19 deletions(-)
+ 11 files changed, 667 insertions(+), 51 deletions(-)
create mode 100644 src/wallet/api/coins.cpp
create mode 100644 src/wallet/api/coins.h
create mode 100644 src/wallet/api/coins_info.cpp
@@ -504,7 +504,7 @@ index 000000000..c43e45abd
+
+#endif //FEATHER_COINS_INFO_H
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
-index 67ac90a46..a76d773ba 100644
+index 67ac90a46..06837ab61 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -35,6 +35,7 @@
@@ -532,87 +532,144 @@ index 67ac90a46..a76d773ba 100644
{
clearStatus();
-@@ -2084,6 +2086,7 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
+@@ -2083,57 +2085,116 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
+ break;
}
}
- bool error = false;
-+ uint64_t amountSum = 0;
- for (size_t i = 0; i < dst_addr.size() && !error; i++) {
- if(!cryptonote::get_account_address_from_str(info, m_wallet->nettype(), dst_addr[i])) {
- // TODO: copy-paste 'if treating as an address fails, try as url' from simplewallet.cpp:1982
-@@ -2105,6 +2108,7 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
- de.original = dst_addr[i];
- de.addr = info.address;
- de.amount = (*amount)[i];
-+ amountSum += (*amount)[i];
- de.is_subaddress = info.is_subaddress;
- de.is_integrated = info.has_payment_id;
- dsts.push_back(de);
-@@ -2115,6 +2119,63 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
+- bool error = false;
+- for (size_t i = 0; i < dst_addr.size() && !error; i++) {
+- if(!cryptonote::get_account_address_from_str(info, m_wallet->nettype(), dst_addr[i])) {
+- // TODO: copy-paste 'if treating as an address fails, try as url' from simplewallet.cpp:1982
+- setStatusError(tr("Invalid destination address"));
+- error = true;
+- break;
+- }
+- if (info.has_payment_id) {
+- if (!extra_nonce.empty()) {
+- setStatusError(tr("a single transaction cannot use more than one payment id"));
++ uint64_t max_coin_control_input = 0;
++ uint64_t max_frozen_input = 0;
++ try {
++ bool error = false;
++ uint64_t amountSum = 0;
++ for (size_t i = 0; i < dst_addr.size() && !error; i++) {
++ if(!cryptonote::get_account_address_from_str(info, m_wallet->nettype(), dst_addr[i])) {
++ // TODO: copy-paste 'if treating as an address fails, try as url' from simplewallet.cpp:1982
++ setStatusError(tr("Invalid destination address"));
+ error = true;
+ break;
}
- }
- }
-+ // uint64_t maxAllowedSpend = m_wallet->unlocked_balance(subaddr_account, true);
-+ // if (maxAllowedSpend < amountSum) {
-+ // error = true;
-+ // setStatusError(tr("Amount you are trying to spend is larger than unlocked amount"));
-+ // break;
-+ // }
-+ std::vector<crypto::key_image> preferred_input_list;
-+ uint64_t max_coin_control_input = 0;
-+ uint64_t max_frozen_input = 0;
-+ if (!preferred_inputs.empty()) {
-+ LOG_ERROR("not empty");
-+
-+ for (const auto &public_key : preferred_inputs) {
-+ crypto::key_image keyImage;
-+ bool r = epee::string_tools::hex_to_pod(public_key, keyImage);
-+ if (!r) {
-+ error = true;
-+ setStatusError(tr("failed to parse key image"));
-+ break;
-+ }
-+ if (m_wallet->frozen(keyImage)) {
-+ error = true;
-+ setStatusError(tr("refusing to spend frozen coin"));
-+ break;
-+ }
-+
-+ for (size_t i = 0; i < m_wallet->get_num_transfer_details(); ++i) {
-+ const tools::wallet2::transfer_details &td = m_wallet->get_transfer_details(i);
-+ if (td.m_key_image == keyImage) {
-+ max_coin_control_input += td.amount();
-+ }
-+ if (td.m_frozen) {
-+ max_frozen_input += td.amount();
+- set_encrypted_payment_id_to_tx_extra_nonce(extra_nonce, info.payment_id);
++ if (info.has_payment_id) {
++ if (!extra_nonce.empty()) {
++ setStatusError(tr("a single transaction cannot use more than one payment id"));
++ error = true;
++ break;
++ }
++ set_encrypted_payment_id_to_tx_extra_nonce(extra_nonce, info.payment_id);
+ }
-+ }
+
-+ preferred_input_list.push_back(keyImage);
-+ }
-+ } else {
++ if (amount) {
++ cryptonote::tx_destination_entry de;
++ de.original = dst_addr[i];
++ de.addr = info.address;
++ de.amount = (*amount)[i];
++ amountSum += (*amount)[i];
++ de.is_subaddress = info.is_subaddress;
++ de.is_integrated = info.has_payment_id;
++ dsts.push_back(de);
++ } else {
++ if (subaddr_indices.empty()) {
++ for (uint32_t index = 0; index < m_wallet->get_num_subaddresses(subaddr_account); ++index)
++ subaddr_indices.insert(index);
++ }
++ }
+ }
++ // uint64_t maxAllowedSpend = m_wallet->unlocked_balance(subaddr_account, true);
++ // if (maxAllowedSpend < amountSum) {
++ // error = true;
++ // setStatusError(tr("Amount you are trying to spend is larger than unlocked amount"));
++ // break;
++ // }
++ std::vector<crypto::key_image> preferred_input_list;
++ if (!preferred_inputs.empty()) {
+ LOG_ERROR("not empty");
+
-+ boost::shared_lock<boost::shared_mutex> transfers_lock(m_wallet->m_transfers_mutex);
-+ for (size_t i = 0; i < m_wallet->get_num_transfer_details(); ++i) {
-+ const tools::wallet2::transfer_details &td = m_wallet->get_transfer_details(i);
-+ LOG_ERROR("COIN: " << i << ": " << td.amount() << "; "<<td.m_spent << ";" << td.m_frozen << ";" << m_wallet->frozen(td));
-+ if (td.m_spent) continue;
-+ LOG_ERROR("is frozen");
-+ if (!td.m_frozen) {
-+ LOG_ERROR("isn't:");
-+ LOG_ERROR("hash: " << td.m_key_image << "; " << td.amount());
-+ preferred_input_list.push_back(td.m_key_image);
++ for (const auto &public_key : preferred_inputs) {
++ crypto::key_image keyImage;
++ bool r = epee::string_tools::hex_to_pod(public_key, keyImage);
++ if (!r) {
++ error = true;
++ setStatusError(tr("failed to parse key image"));
++ break;
++ }
++ if (m_wallet->frozen(keyImage)) {
++ error = true;
++ setStatusError(tr("refusing to spend frozen coin"));
++ break;
++ }
+
+- if (amount) {
+- cryptonote::tx_destination_entry de;
+- de.original = dst_addr[i];
+- de.addr = info.address;
+- de.amount = (*amount)[i];
+- de.is_subaddress = info.is_subaddress;
+- de.is_integrated = info.has_payment_id;
+- dsts.push_back(de);
++ for (size_t i = 0; i < m_wallet->get_num_transfer_details(); ++i) {
++ const tools::wallet2::transfer_details &td = m_wallet->get_transfer_details(i);
++ if (td.m_key_image == keyImage) {
++ max_coin_control_input += td.amount();
++ }
++ if (td.m_frozen) {
++ max_frozen_input += td.amount();
++ }
+ }
++
++ preferred_input_list.push_back(keyImage);
+ }
-+ }
-+ for (const auto &de : preferred_input_list) {
-+ LOG_ERROR("preferred input: " << de);
-+ }
- if (error) {
- break;
- }
-@@ -2129,11 +2190,11 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
+ } else {
+- if (subaddr_indices.empty()) {
+- for (uint32_t index = 0; index < m_wallet->get_num_subaddresses(subaddr_account); ++index)
+- subaddr_indices.insert(index);
++ LOG_ERROR("not empty");
++
++ boost::shared_lock<boost::shared_mutex> transfers_lock(m_wallet->m_transfers_mutex);
++ for (size_t i = 0; i < m_wallet->get_num_transfer_details(); ++i) {
++ const tools::wallet2::transfer_details &td = m_wallet->get_transfer_details(i);
++ LOG_ERROR("COIN: " << i << ": " << td.amount() << "; "<<td.m_spent << ";" << td.m_frozen << ";" << m_wallet->frozen(td));
++ if (td.m_spent) continue;
++ LOG_ERROR("is frozen");
++ if (!td.m_frozen) {
++ LOG_ERROR("isn't:");
++ LOG_ERROR("hash: " << td.m_key_image << "; " << td.amount());
++ preferred_input_list.push_back(td.m_key_image);
++ }
+ }
+ }
+- }
+- if (error) {
+- break;
+- }
+- if (!extra_nonce.empty() && !add_extra_nonce_to_tx_extra(extra, extra_nonce)) {
+- setStatusError(tr("failed to set up payment id, though it was decoded correctly"));
+- break;
+- }
+- try {
++ for (const auto &de : preferred_input_list) {
++ LOG_ERROR("preferred input: " << de);
++ }
++ if (error) {
++ break;
++ }
++ if (!extra_nonce.empty() && !add_extra_nonce_to_tx_extra(extra, extra_nonce)) {
++ setStatusError(tr("failed to set up payment id, though it was decoded correctly"));
++ break;
++ }
+ size_t fake_outs_count = mixin_count > 0 ? mixin_count : m_wallet->default_mixin();
+ fake_outs_count = m_wallet->adjust_mixin(mixin_count);
+
if (amount) {
transaction->m_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count,
adjusted_priority,
@@ -1038,5 +1095,5 @@ index 91cf2a376..bc16d528c 100644
void set_unspent(size_t idx);
bool is_spent(const transfer_details &td, bool strict = true) const;
--
-2.43.0
+2.39.5 (Apple Git-154)
diff --git a/patches/zano/0001-add-missing-include.patch b/patches/zano/0001-add-missing-include.patch
new file mode 100644
index 0000000..cd95528
--- /dev/null
+++ b/patches/zano/0001-add-missing-include.patch
@@ -0,0 +1,64 @@
+From a49fa9a64aebf69f15832291e70888ff18ed6040 Mon Sep 17 00:00:00 2001
+From: Czarek Nakamoto <cyjan@mrcyjanek.net>
+Date: Thu, 31 Oct 2024 13:07:20 +0000
+Subject: [PATCH 1/5] add missing #include
+
+---
+ src/currency_core/genesis.cpp | 1 +
+ src/currency_core/genesis.h | 2 +-
+ src/wallet/plain_wallet_api.cpp | 1 +
+ src/wallet/plain_wallet_api.h | 1 +
+ 4 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/currency_core/genesis.cpp b/src/currency_core/genesis.cpp
+index a58dcb4e..c34b0285 100644
+--- a/src/currency_core/genesis.cpp
++++ b/src/currency_core/genesis.cpp
+@@ -4,6 +4,7 @@
+ // file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+ #include "genesis.h"
++#include <cstdint>
+
+ namespace currency
+ {
+diff --git a/src/currency_core/genesis.h b/src/currency_core/genesis.h
+index 8ea77d89..d78cec97 100644
+--- a/src/currency_core/genesis.h
++++ b/src/currency_core/genesis.h
+@@ -3,7 +3,7 @@
+ // Copyright (c) 2014-2018 The Louisdor Project
+ // Distributed under the MIT/X11 software license, see the accompanying
+ // file COPYING or http://www.opensource.org/licenses/mit-license.php.
+-
++#include <cstdint>
+ #pragma once
+ #include <string>
+ namespace currency
+diff --git a/src/wallet/plain_wallet_api.cpp b/src/wallet/plain_wallet_api.cpp
+index bb322481..dccff76c 100644
+--- a/src/wallet/plain_wallet_api.cpp
++++ b/src/wallet/plain_wallet_api.cpp
+@@ -6,6 +6,7 @@
+ #ifdef ANDROID_BUILD
+ #include <android/log.h>
+ #endif
++#include <cstdint>
+ #include "plain_wallet_api.h"
+ #include "plain_wallet_api_defs.h"
+ #include "currency_core/currency_config.h"
+diff --git a/src/wallet/plain_wallet_api.h b/src/wallet/plain_wallet_api.h
+index f12eba03..177b8173 100644
+--- a/src/wallet/plain_wallet_api.h
++++ b/src/wallet/plain_wallet_api.h
+@@ -6,6 +6,7 @@
+ #pragma once
+
+ #include <string>
++#include <cstdint>
+ #include "../common/error_codes.h"
+
+ namespace plain_wallet
+--
+2.39.5 (Apple Git-154)
+
diff --git a/patches/zano/0002-fix-build-issues.patch b/patches/zano/0002-fix-build-issues.patch
new file mode 100644
index 0000000..9ff3f85
--- /dev/null
+++ b/patches/zano/0002-fix-build-issues.patch
@@ -0,0 +1,39 @@
+From 627750b0f1471c5d34755ca446d452429945d5d6 Mon Sep 17 00:00:00 2001
+From: cyan <cyjan@mrcyjanek.net>
+Date: Sat, 2 Nov 2024 20:50:26 +0000
+Subject: [PATCH 2/5] fix build issues
+
+---
+ contrib/db/libmdbx/CMakeLists.txt | 2 +-
+ contrib/db/libmdbx/packages/rpm/CMakeLists.txt | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/contrib/db/libmdbx/CMakeLists.txt b/contrib/db/libmdbx/CMakeLists.txt
+index 75e9b3b0..01a5915c 100644
+--- a/contrib/db/libmdbx/CMakeLists.txt
++++ b/contrib/db/libmdbx/CMakeLists.txt
+@@ -80,7 +80,7 @@ macro(add_mdbx_option NAME DESCRIPTION DEFAULT)
+ endmacro()
+
+ # only for compatibility testing
+-# set(CMAKE_CXX_STANDARD 14)
++set(CMAKE_CXX_STANDARD 17)
+
+ if(NOT "$ENV{TEAMCITY_PROCESS_FLOW_ID}" STREQUAL "")
+ set(CI TEAMCITY)
+diff --git a/contrib/db/libmdbx/packages/rpm/CMakeLists.txt b/contrib/db/libmdbx/packages/rpm/CMakeLists.txt
+index 5949e9f0..e7b677bd 100644
+--- a/contrib/db/libmdbx/packages/rpm/CMakeLists.txt
++++ b/contrib/db/libmdbx/packages/rpm/CMakeLists.txt
+@@ -12,7 +12,7 @@ set(MDBX_VERSION_STRING ${MDBX_VERSION_MAJOR}.${MDBX_VERSION_MINOR}.${MDBX_VERSI
+ enable_language(C)
+ enable_language(CXX)
+
+-set(CMAKE_CXX_STANDARD 11)
++set(CMAKE_CXX_STANDARD 17)
+ set(CMAKE_CXX_STANDARD_REQUIRED on)
+
+ add_definitions(-DNDEBUG=1 -DMDBX_DEBUG=0 -DLIBMDBX_EXPORTS=1 -D_GNU_SOURCE=1)
+--
+2.39.5 (Apple Git-154)
+
diff --git a/patches/zano/0003-fix-mingw-build-issues.patch b/patches/zano/0003-fix-mingw-build-issues.patch
new file mode 100644
index 0000000..48b4d65
--- /dev/null
+++ b/patches/zano/0003-fix-mingw-build-issues.patch
@@ -0,0 +1,61 @@
+From 1f7604d5b661f4490a1757e5ed1d6ed367ffb739 Mon Sep 17 00:00:00 2001
+From: cyan <cyjan@mrcyjanek.net>
+Date: Sun, 3 Nov 2024 08:59:22 +0000
+Subject: [PATCH 3/5] fix mingw build issues
+
+---
+ contrib/epee/include/misc_os_dependent.h | 4 ++--
+ src/common/callstack_helper.cpp | 2 +-
+ src/crypto/ecrypt-config.h | 2 +-
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/contrib/epee/include/misc_os_dependent.h b/contrib/epee/include/misc_os_dependent.h
+index c06e5d94..a2a979b9 100644
+--- a/contrib/epee/include/misc_os_dependent.h
++++ b/contrib/epee/include/misc_os_dependent.h
+@@ -110,14 +110,14 @@ namespace misc_utils
+ }
+
+
+-#if defined(__GNUC__) && !defined(__ANDROID__)
++#if defined(__GNUC__) && !defined(__ANDROID__) && !defined(_WIN32)
+ #include <execinfo.h>
+ #include <boost/core/demangle.hpp>
+ #endif
+ inline std::string print_trace_default()
+ {
+ std::stringstream ss;
+-#if defined(__GNUC__) && !defined(__ANDROID__)
++#if defined(__GNUC__) && !defined(__ANDROID__) && !defined(_WIN32)
+ ss << std::endl << "STACK" << std::endl;
+ const size_t max_depth = 100;
+ size_t stack_depth;
+diff --git a/src/common/callstack_helper.cpp b/src/common/callstack_helper.cpp
+index b84fe5a8..c9eae839 100644
+--- a/src/common/callstack_helper.cpp
++++ b/src/common/callstack_helper.cpp
+@@ -9,7 +9,7 @@
+ #define NOMINMAX
+ #endif
+ #include <windows.h>
+-#include <Psapi.h>
++#include <psapi.h>
+ #pragma comment(lib, "psapi.lib")
+ #pragma comment(lib, "dbghelp.lib")
+
+diff --git a/src/crypto/ecrypt-config.h b/src/crypto/ecrypt-config.h
+index 9176de17..8b488135 100644
+--- a/src/crypto/ecrypt-config.h
++++ b/src/crypto/ecrypt-config.h
+@@ -257,7 +257,7 @@
+
+ #ifdef _UI64_MAX
+
+-#if (_UI64_MAX / 0xFFFFFFFFui64 > 0xFFFFFFFFui64)
++#if (_UI64_MAX / 0xFFFFFFFF > 0xFFFFFFFF)
+ #ifndef I64T
+ #define I64T __int64
+ #define U64C(v) (v##ui64)
+--
+2.39.5 (Apple Git-154)
+
diff --git a/patches/zano/0004-update-tor-connect.patch b/patches/zano/0004-update-tor-connect.patch
new file mode 100644
index 0000000..76cc59d
--- /dev/null
+++ b/patches/zano/0004-update-tor-connect.patch
@@ -0,0 +1,33 @@
+From 7d05e6a8d62ad3302bd1bb1818db36bde5885bab Mon Sep 17 00:00:00 2001
+From: Czarek Nakamoto <cyjan@mrcyjanek.net>
+Date: Tue, 5 Nov 2024 10:35:03 -0500
+Subject: [PATCH 4/5] update tor-connect
+
+---
+ .gitmodules | 2 +-
+ contrib/tor-connect | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/.gitmodules b/.gitmodules
+index 57896bbb..4df859f8 100644
+--- a/.gitmodules
++++ b/.gitmodules
+@@ -7,7 +7,7 @@
+ branch = main
+ [submodule "contrib/tor-connect"]
+ path = contrib/tor-connect
+- url = https://github.com/hyle-team/tor-connect.git
++ url = https://github.com/MrCyjaneK/tor-connect.git
+ branch = main
+ [submodule "contrib/jwt-cpp"]
+ path = contrib/jwt-cpp
+diff --git a/contrib/tor-connect b/contrib/tor-connect
+index b589edb1..cc445b2f 160000
+--- a/contrib/tor-connect
++++ b/contrib/tor-connect
+@@ -1 +1 @@
+-Subproject commit b589edb1906dccb387cfeded6ed12286c5f0405f
++Subproject commit cd7f0c4b583488a7fe9b50de8e533a9853b6a5c7
+--
+2.39.5 (Apple Git-154)
+
diff --git a/patches/zano/0005-fix-ios-builds.patch b/patches/zano/0005-fix-ios-builds.patch
new file mode 100644
index 0000000..f68244f
--- /dev/null
+++ b/patches/zano/0005-fix-ios-builds.patch
@@ -0,0 +1,43 @@
+From 20975fed75b7255f6cb6df74a17f1923f7159c09 Mon Sep 17 00:00:00 2001
+From: Czarek Nakamoto <cyjan@mrcyjanek.net>
+Date: Tue, 5 Nov 2024 16:52:23 +0100
+Subject: [PATCH 5/5] fix ios builds
+
+---
+ CMakeLists.txt | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c480300f..7087d796 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -136,6 +136,8 @@ else()
+ set(ARCH default CACHE STRING "CPU to build for: -march value or default")
+ if("${ARCH}" STREQUAL "default")
+ set(ARCH_FLAG "")
++ elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
++ set(ARCH_FLAG "")
+ else()
+ set(ARCH_FLAG "-march=${ARCH}")
+ endif()
+@@ -207,7 +209,7 @@ else()
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
+ if(STATIC)
+ if(APPLE)
+- message(SEND_ERROR "Static build is not supported on MacOS X")
++ message("Static build is not supported on MacOS X")
+ else()
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
+ endif()
+@@ -260,8 +262,6 @@ else()
+ find_package(Boost 1.70 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options locale log)
+ endif()
+
+-
+-
+ message(STATUS "Boost: ${Boost_VERSION} from ${Boost_LIBRARY_DIRS}")
+
+
+--
+2.39.5 (Apple Git-154)
+
diff --git a/patches/zano/0006-use-boost-filesystem-instead-of-stdfs.patch b/patches/zano/0006-use-boost-filesystem-instead-of-stdfs.patch
new file mode 100644
index 0000000..64b7f4c
--- /dev/null
+++ b/patches/zano/0006-use-boost-filesystem-instead-of-stdfs.patch
@@ -0,0 +1,80 @@
+From 033d71f4a8623dee3508c493431402bbbe5a8b2d Mon Sep 17 00:00:00 2001
+From: Czarek Nakamoto <cyjan@mrcyjanek.net>
+Date: Wed, 4 Dec 2024 17:21:44 -0600
+Subject: [PATCH] use boost::filesystem instead of stdfs
+
+---
+ CMakeLists.txt | 23 ++++-------------------
+ contrib/epee/include/file_io_utils.h | 6 +++---
+ 2 files changed, 7 insertions(+), 22 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7087d796..6ded9711 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -232,24 +232,9 @@ if(STATIC)
+ endif()
+
+ message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
+-if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
+- set(CMAKE_OSX_DEPLOYMENT_TARGET 12.00)
+- if(NOT DEFINED SKIP_BOOST_FATLIB_LIB OR NOT SKIP_BOOST_FATLIB_LIB)
+- message("Ios: libboost.a included as library")
+- set(Boost_LIBRARIES "libboost.a")
+- else()
+- message("Ios: libboost.a not included as library")
+- endif()
+- #workaround for new XCode 12 policy for builds(now it includes a slice for the "arm64" when builds for simulator)
+- set(__iphoneos_archs "arm64")
+- #set(__iphonesimulator_archs "arm64,x86_64")
+- set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "${__iphoneos_archs}")
+- set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "${__iphoneos_archs}")
+- #set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "${__iphonesimulator_archs}")
+- #set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "${__iphonesimulator_archs}")
+-elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
++if(CMAKE_SYSTEM_NAME STREQUAL "Android")
+ if(CAKEWALLET)
+- find_package(Boost 1.71 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options locale)
++ find_package(Boost 1.71 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options)
+ else()
+ set(Boost_LIBRARY_DIRS "${Boost_LIBRARY_DIRS}/${CMAKE_ANDROID_ARCH_ABI}/")
+ set(Boost_LIBRARIES "${Boost_LIBRARY_DIRS}libboost_system.a;${Boost_LIBRARY_DIRS}libboost_filesystem.a;${Boost_LIBRARY_DIRS}libboost_thread.a;${Boost_LIBRARY_DIRS}libboost_timer.a;${Boost_LIBRARY_DIRS}libboost_date_time.a;${Boost_LIBRARY_DIRS}libboost_chrono.a;${Boost_LIBRARY_DIRS}libboost_regex.a;${Boost_LIBRARY_DIRS}libboost_serialization.a;${Boost_LIBRARY_DIRS}libboost_atomic.a;${Boost_LIBRARY_DIRS}libboost_program_options.a")
+@@ -257,7 +242,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fPIC")
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fPIC")
+ elseif(APPLE)
+- find_package(Boost 1.71 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options locale)
++ find_package(Boost 1.71 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options)
+ else()
+ find_package(Boost 1.70 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options locale log)
+ endif()
+@@ -302,7 +287,7 @@ else()
+ find_package(Git QUIET)
+ if(Git_FOUND OR GIT_FOUND)
+ message(STATUS "Found Git: ${GIT_EXECUTABLE}")
+- add_custom_target(version ALL "${CMAKE_COMMAND}" "-D" "VERSION=${VERSION}" "-D" "GIT=${GIT_EXECUTABLE}" "-D" "TO=${CMAKE_BINARY_DIR}/version/version.h" "-P" "src/version.cmake" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
++ add_custom_target(version ALL "${CMAKE_COMMAND}" "-D" "VERSION=${VERSION}" "-D" "GIT=${GIT_EXECUTABLE}" "-D" "TO=${CMAKE_BINARY_DIR}/version/version.h" "-P" "src/version.cmake" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
+ else()
+ message(STATUS "WARNING: Git was not found!")
+ set(VERSION "${VERSION}-unknown")
+diff --git a/contrib/epee/include/file_io_utils.h b/contrib/epee/include/file_io_utils.h
+index bb21ae99..ced01092 100644
+--- a/contrib/epee/include/file_io_utils.h
++++ b/contrib/epee/include/file_io_utils.h
+@@ -574,10 +574,10 @@ namespace file_io_utils
+ try
+ {
+
+- stdfs::directory_iterator end_itr; // default construction yields past-the-end
+- for (stdfs::directory_iterator itr( epee::string_encoding::utf8_to_wstring(path) ); itr != end_itr; ++itr )
++ boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end
++ for ( boost::filesystem::directory_iterator itr( epee::string_encoding::utf8_to_wstring(path) ); itr != end_itr; ++itr )
+ {
+- if ( only_files && stdfs::is_directory(itr->status()) )
++ if ( only_files && boost::filesystem::is_directory(itr->status()) )
+ {
+ continue;
+ }
+--
+2.39.5 (Apple Git-154)
+
diff --git a/patches/zano/0007-downgrade-cmake-version-so-LIB_DEPENDS-shows-up.patch b/patches/zano/0007-downgrade-cmake-version-so-LIB_DEPENDS-shows-up.patch
new file mode 100644
index 0000000..0ac7e50
--- /dev/null
+++ b/patches/zano/0007-downgrade-cmake-version-so-LIB_DEPENDS-shows-up.patch
@@ -0,0 +1,22 @@
+From e6201106cd09416f96c8d83270c94565583cd356 Mon Sep 17 00:00:00 2001
+From: Czarek Nakamoto <cyjan@mrcyjanek.net>
+Date: Thu, 5 Dec 2024 09:36:34 -0600
+Subject: [PATCH] downgrade cmake version so LIB_DEPENDS shows up
+
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6ded9711..47d24a81 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-cmake_minimum_required(VERSION 3.16)
++cmake_minimum_required(VERSION 3.5)
+
+ PROJECT(Zano)
+
+--
+2.39.5 (Apple Git-154)
+
diff --git a/patches/zano/0008-increase-max-password.patch b/patches/zano/0008-increase-max-password.patch
new file mode 100644
index 0000000..0ce87c7
--- /dev/null
+++ b/patches/zano/0008-increase-max-password.patch
@@ -0,0 +1,25 @@
+From 6812b5de7e0a52e9341e54dbe2fc0b790dc6de5a Mon Sep 17 00:00:00 2001
+From: Czarek Nakamoto <cyjan@mrcyjanek.net>
+Date: Thu, 12 Dec 2024 09:00:57 -0500
+Subject: [PATCH] increase max password
+
+---
+ src/currency_core/currency_format_utils.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/currency_core/currency_format_utils.cpp b/src/currency_core/currency_format_utils.cpp
+index 96d55b4..0c3d947 100644
+--- a/src/currency_core/currency_format_utils.cpp
++++ b/src/currency_core/currency_format_utils.cpp
+@@ -3632,7 +3632,7 @@ namespace currency
+ return true;
+ }
+ //------------------------------------------------------------------
+- #define PASSWORD_REGEXP R"([A-Za-z0-9~!?@#$%^&*_+|{}\[\]()<>:;"'\-=/.,]{0,40})"
++ #define PASSWORD_REGEXP R"([A-Za-z0-9~!?@#$%^&*_+|{}\[\]()<>:;"'\-=/.,]{0,2048})"
+ bool validate_password(const std::string& password)
+ {
+ // OLD: static const std::string allowed_password_symbols = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!?@#$%^&*_+|{}[]()<>:;\"'-=\\/.,";
+--
+2.39.5 (Apple Git-154)
+
diff --git a/tests/.DS_Store b/tests/.DS_Store
new file mode 100644
index 0000000..6914114
--- /dev/null
+++ b/tests/.DS_Store
Binary files differ
diff --git a/tests/download_deps.ts b/tests/download_deps.ts
index 808640e..8871fa5 100644
--- a/tests/download_deps.ts
+++ b/tests/download_deps.ts
@@ -4,8 +4,11 @@ import { Coin, getMoneroCTags } from "./utils.ts";
export type Target = `${typeof Deno["build"]["os"]}_${typeof Deno["build"]["arch"]}`;
interface FileInfo {
- overrideMirrors?: string[];
- name: string;
+ // List of mirrors that override DownloadInfo mirrors for this FileInfo
+ overrideMirrors?: [mainFilePath: string, ...fallbacks: string[]];
+ // List of file names that fallback if previous failed
+ // If first name failed and got fallbacked by another, it will get renamed to the first entry
+ names: string[];
sha256?: string;
}
@@ -21,7 +24,7 @@ export function getFileInfo(
downloadInfo: DownloadInfo,
target: Target = `${Deno.build.os}_${Deno.build.arch}`,
): FileInfo {
- const fileInfo = "name" in downloadInfo.file ? downloadInfo.file : downloadInfo.file[target];
+ const fileInfo = "names" in downloadInfo.file ? downloadInfo.file : downloadInfo.file[target];
if (!fileInfo) {
throw new Error(`No fileInfo set for target: ${target}`);
}
@@ -37,6 +40,61 @@ export async function downloadDependencies(...infos: DownloadInfo[]): Promise<vo
return await downloadFiles("./tests/dependencies", `${Deno.build.os}_${Deno.build.arch}`, ...infos);
}
+async function tryToDownloadFile(
+ mirror: string,
+ fileInfo: FileInfo,
+ fileName: string,
+): Promise<Uint8Array | undefined> {
+ const url = `${mirror}/${fileName}`;
+
+ const response = await fetch(url);
+ if (!response.ok) {
+ console.warn(`Could not reach file ${fileName} on mirror: ${mirror}`);
+ await response.body?.cancel();
+ return;
+ }
+
+ const responseBuffer = await response.bytes();
+
+ if (fileInfo.sha256) {
+ const responseChecksum = await sha256(responseBuffer);
+ if (responseChecksum !== fileInfo.sha256) {
+ console.warn(
+ `Checksum mismatch on file ${fileName} on mirror: ${mirror} (${responseChecksum} != ${fileInfo.sha256})`,
+ );
+ return;
+ }
+ }
+
+ return responseBuffer;
+}
+
+async function validFileExists(filePath: string, fileInfo: FileInfo): Promise<boolean> {
+ const [mainFileName] = fileInfo.names;
+
+ let fileBuffer: Uint8Array;
+ try {
+ fileBuffer = await Deno.readFile(filePath);
+ } catch {
+ return false;
+ }
+
+ // File exists, make sure checksum matches
+ if (fileInfo.sha256) {
+ const fileChecksum = await sha256(fileBuffer);
+ if (fileChecksum !== fileInfo.sha256) {
+ console.log(
+ `File ${mainFileName} already exists, but checksum is mismatched (${fileChecksum} != ${fileInfo.sha256}), redownloading`,
+ );
+ await Deno.remove(filePath);
+ return false;
+ }
+ }
+
+ console.log(`File ${mainFileName} already exists, skipping`);
+ return true;
+}
+
export async function downloadFiles(outDir: string, target: Target, ...infos: DownloadInfo[]): Promise<void> {
try {
await Deno.mkdir(outDir, { recursive: true });
@@ -48,65 +106,40 @@ export async function downloadFiles(outDir: string, target: Target, ...infos: Do
for (const info of infos) {
const fileInfo = getFileInfo(info, target);
- const fileName = fileInfo.name;
- const filePath = join(outDir, info.outDir ?? "", fileName);
-
- file_might_exist: try {
- const fileBuffer = await Deno.readFile(filePath);
-
- // File exists, make sure checksum matches
- if (fileInfo.sha256) {
- const fileChecksum = await sha256(fileBuffer);
- if (fileChecksum !== fileInfo.sha256) {
- console.log(
- `File ${fileName} already exists, but checksum is mismatched (${fileChecksum} != ${fileInfo.sha256}), redownloading`,
- );
- await Deno.remove(filePath);
- break file_might_exist;
- }
- }
-
- console.log(`File ${fileName} already exists, skipping`);
+ const [mainFileName] = fileInfo.names;
+
+ if (
+ await validFileExists(
+ join(outDir, info.outDir || ""),
+ fileInfo,
+ )
+ ) {
continue;
- } catch { /**/ }
+ }
let buffer: Uint8Array | undefined;
+ outer: for (const mirror of fileInfo.overrideMirrors ?? info.mirrors) {
+ for (const fileName of fileInfo.names) {
+ buffer = await tryToDownloadFile(mirror, fileInfo, fileName);
- for (const mirror of fileInfo.overrideMirrors ?? info.mirrors) {
- const url = `${mirror}/${fileName}`;
-
- const response = await fetch(url);
- if (!response.ok) {
- console.warn(`Could not reach file ${fileName} on mirror: ${mirror}`);
- await response.body?.cancel();
- continue;
- }
-
- const responseBuffer = await response.bytes();
-
- if (fileInfo.sha256) {
- const responseChecksum = await sha256(responseBuffer);
- if (responseChecksum !== fileInfo.sha256) {
- console.warn(
- `Checksum mismatch on file ${fileName} on mirror: ${mirror} (${responseChecksum} != ${fileInfo.sha256})`,
- );
- continue;
+ if (buffer) {
+ break outer;
}
}
-
- buffer = responseBuffer;
}
if (!buffer) {
- throw new Error(`None of the mirrors for ${fileName} are available`);
+ throw new Error(`None of the mirrors for ${fileInfo.names} are available`);
}
+ const filePath = join(outDir, info.outDir ?? "", mainFileName);
+
await Deno.mkdir(resolve(filePath, ".."), {
recursive: true,
}).catch(() => {});
await Deno.writeFile(filePath, buffer);
- console.info("Downloaded file", fileInfo.name);
+ console.info("Downloaded file", filePath);
}
}
@@ -117,25 +150,25 @@ export const wowneroCliInfo: DownloadInfo = {
],
file: {
linux_aarch64: {
- name: "wownero-aarch64-linux-gnu-59db3fe8d.tar.bz2",
+ names: ["wownero-aarch64-linux-gnu-59db3fe8d.tar.bz2"],
sha256: "07ce678302c07a6e79d90be65cbda243d843d414fbadb30f972d6c226575cfa7",
},
linux_x86_64: {
- name: "wownero-x86_64-linux-gnu-59db3fe8d.tar.bz2",
+ names: ["wownero-x86_64-linux-gnu-59db3fe8d.tar.bz2"],
sha256: "03880967c70cc86558d962b8a281868c3934238ea457a36174ba72b99d70107e",
},
darwin_aarch64: {
- name: "wownero-aarch64-apple-darwin11-59db3fe8d.tar.bz2",
+ names: ["wownero-aarch64-apple-darwin11-59db3fe8d.tar.bz2"],
sha256: "25ff454a92b1cf036df5f28cdd2c63dcaf4b03da7da9403087371f868827c957",
},
darwin_x86_64: {
- name: "wownero-x86_64-apple-darwin11-59db3fe8d.tar.bz2",
+ names: ["wownero-x86_64-apple-darwin11-59db3fe8d.tar.bz2"],
sha256: "7e9b6a84a560ed7a9ed7117c6f07fb228d77a06afac863d0ea1dbf833c4eddf6",
},
windows_x86_64: {
- name: "wownero-x86_64-w64-mingw32-59db3fe8d.zip",
+ names: ["wownero-x86_64-w64-mingw32-59db3fe8d.zip"],
sha256: "7e0ed84afa51e3b403d635c706042859094eb6850de21c9e82cb0a104425510e",
},
@@ -144,7 +177,7 @@ export const wowneroCliInfo: DownloadInfo = {
"https://static.mrcyjanek.net/download_mirror/",
"https://codeberg.org/wownero/wownero/releases/download/v0.11.1.0/",
],
- name: "wownero-aarch64-linux-android-v0.11.1.0.tar.bz2",
+ names: ["wownero-aarch64-linux-android-v0.11.1.0.tar.bz2"],
sha256: "236188f8d8e7fad2ff35973f8c2417afffa8855d1a57b4c682fff5b199ea40f5",
},
},
@@ -157,30 +190,30 @@ export const moneroCliInfo: DownloadInfo = {
],
file: {
linux_aarch64: {
- name: "monero-linux-armv8-v0.18.3.4.tar.bz2",
+ names: ["monero-linux-armv8-v0.18.3.4.tar.bz2"],
sha256: "33ca2f0055529d225b61314c56370e35606b40edad61c91c859f873ed67a1ea7",
},
linux_x86_64: {
- name: "monero-linux-x64-v0.18.3.4.tar.bz2",
+ names: ["monero-linux-x64-v0.18.3.4.tar.bz2"],
sha256: "51ba03928d189c1c11b5379cab17dd9ae8d2230056dc05c872d0f8dba4a87f1d",
},
darwin_aarch64: {
- name: "monero-mac-armv8-v0.18.3.4.tar.bz2",
+ names: ["monero-mac-armv8-v0.18.3.4.tar.bz2"],
sha256: "44520cb3a05c2518ca9aeae1b2e3080fe2bba1e3596d014ceff1090dfcba8ab4",
},
darwin_x86_64: {
- name: "monero-mac-x64-v0.18.3.4.tar.bz2",
+ names: ["monero-mac-x64-v0.18.3.4.tar.bz2"],
sha256: "32c449f562216d3d83154e708471236d07db7477d6b67f1936a0a85a5005f2b8",
},
windows_x86_64: {
- name: "monero-win-x64-v0.18.3.4.zip",
+ names: ["monero-win-x64-v0.18.3.4.zip"],
sha256: "54a66db6c892b2a0999754841f4ca68511741b88ea3ab20c7cd504a027f465f5",
},
android_aarch64: {
- name: "monero-android-armv8-v0.18.3.4.tar.bz2",
+ names: ["monero-android-armv8-v0.18.3.4.tar.bz2"],
sha256: "d9c9249d1408822ce36b346c6b9fb6b896cda16714d62117fb1c588a5201763c",
},
},
@@ -199,12 +232,22 @@ for (const tag of await getMoneroCTags()) {
`https://github.com/MrCyjaneK/monero_c/releases/download/${tag}/`,
],
file: {
- linux_aarch64: { name: `${coin}_aarch64-linux-gnu_libwallet2_api_c.so.xz` },
- linux_x86_64: { name: `${coin}_x86_64-linux-gnu_libwallet2_api_c.so.xz` },
- darwin_aarch64: { name: `${coin}_aarch64-apple-darwin11_libwallet2_api_c.dylib.xz` },
- darwin_x86_64: { name: `${coin}_x86_64-apple-darwin11_libwallet2_api_c.dylib.xz` },
- windows_x86_64: { name: `${coin}_x86_64-w64-mingw32_libwallet2_api_c.dll.xz` },
- android_aarch64: { name: `${coin}_aarch64-linux-android_libwallet2_api_c.so.xz` },
+ linux_aarch64: { names: [`${coin}_aarch64-linux-gnu_libwallet2_api_c.so.xz`] },
+ linux_x86_64: { names: [`${coin}_x86_64-linux-gnu_libwallet2_api_c.so.xz`] },
+ darwin_aarch64: {
+ names: [
+ `${coin}_aarch64-apple-darwin11_libwallet2_api_c.dylib.xz`,
+ `${coin}_aarch64-apple-darwin_libwallet2_api_c.dylib.xz`,
+ ],
+ },
+ darwin_x86_64: {
+ names: [
+ `${coin}_x86_64-apple-darwin11_libwallet2_api_c.dylib.xz`,
+ `${coin}_x86_64-apple-darwin_libwallet2_api_c.dylib.xz`,
+ ],
+ },
+ windows_x86_64: { names: [`${coin}_x86_64-w64-mingw32_libwallet2_api_c.dll.xz`] },
+ android_aarch64: { names: [`${coin}_aarch64-linux-android_libwallet2_api_c.so.xz`] },
},
outDir: `libs/${tag}`,
});
diff --git a/tests/integration.test.ts b/tests/integration.test.ts
index 100bd43..2570874 100644
--- a/tests/integration.test.ts
+++ b/tests/integration.test.ts
@@ -443,7 +443,7 @@ Deno.test("0004-coin-control.patch", {
assertEquals(await transaction.status(), 1);
assertEquals(
- await transaction.errorString(),
+ (await transaction.errorString())?.split("\n")[0],
"not enough money to transfer, overall balance only 0.002000000000, sent amount 0.002000000000",
);
});
diff --git a/tests/utils.ts b/tests/utils.ts
index 86501a8..9408f54 100755
--- a/tests/utils.ts
+++ b/tests/utils.ts
@@ -84,13 +84,13 @@ export async function extract(path: string, out: string) {
export async function prepareMoneroCli() {
await downloadDependencies(moneroCliInfo);
- const path = join("./tests/dependencies", moneroCliInfo.outDir ?? "", getFileInfo(moneroCliInfo).name);
+ const path = join("./tests/dependencies", moneroCliInfo.outDir ?? "", getFileInfo(moneroCliInfo).names[0]);
await extract(path, "./tests/dependencies/monero-cli/");
}
export async function prepareWowneroCli() {
await downloadDependencies(wowneroCliInfo);
- const path = join("./tests/dependencies", wowneroCliInfo.outDir ?? "", getFileInfo(wowneroCliInfo).name);
+ const path = join("./tests/dependencies", wowneroCliInfo.outDir ?? "", getFileInfo(wowneroCliInfo).names[0]);
await extract(path, "./tests/dependencies/wownero-cli/");
}
diff --git a/zano b/zano
new file mode 160000
+Subproject 2817090c8ac7639d6f697d00fc8bcba2b3681d9
diff --git a/zano_libwallet2_api_c/CMakeLists.txt b/zano_libwallet2_api_c/CMakeLists.txt
new file mode 120000
index 0000000..73b40ff
--- /dev/null
+++ b/zano_libwallet2_api_c/CMakeLists.txt
@@ -0,0 +1 @@
+../monero_libwallet2_api_c/CMakeLists.txt \ No newline at end of file
diff --git a/zano_libwallet2_api_c/src/main/cpp/helpers.cpp b/zano_libwallet2_api_c/src/main/cpp/helpers.cpp
new file mode 120000
index 0000000..524768b
--- /dev/null
+++ b/zano_libwallet2_api_c/src/main/cpp/helpers.cpp
@@ -0,0 +1 @@
+../../../../monero_libwallet2_api_c/src/main/cpp/helpers.cpp \ No newline at end of file
diff --git a/zano_libwallet2_api_c/src/main/cpp/helpers.hpp b/zano_libwallet2_api_c/src/main/cpp/helpers.hpp
new file mode 120000
index 0000000..99d2733
--- /dev/null
+++ b/zano_libwallet2_api_c/src/main/cpp/helpers.hpp
@@ -0,0 +1 @@
+../../../../monero_libwallet2_api_c/src/main/cpp/helpers.hpp \ No newline at end of file
diff --git a/zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp b/zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp
new file mode 100644
index 0000000..11acc0a
--- /dev/null
+++ b/zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp
@@ -0,0 +1,322 @@
+#include <inttypes.h>
+#include "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"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+// namespace plain_wallet
+// {
+// typedef int64_t hwallet;
+// std::string init(const std::string& address, const std::string& working_dir, int log_level);
+const char* ZANO_PlainWallet_init(const char* address, const char* working_dir, int log_level) {
+ DEBUG_START()
+ std::string str = plain_wallet::init(std::string(address), std::string(working_dir), log_level);
+ 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;
+ DEBUG_END()
+}
+// std::string init(const std::string& ip, const std::string& port, const std::string& working_dir, int log_level);
+const char* ZANO_PlainWallet_init2(const char* ip, const char* port, const char* working_dir, int log_level) {
+ DEBUG_START()
+ std::string str = plain_wallet::init(std::string(ip), std::string(port), std::string(working_dir), log_level);
+ 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;
+ DEBUG_END()
+}
+// std::string reset();
+const char* ZANO_PlainWallet_reset() {
+ DEBUG_START()
+ std::string str = plain_wallet::reset();
+ 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;
+ DEBUG_END()
+}
+// std::string set_log_level(int log_level);
+const char* ZANO_PlainWallet_setLogLevel(int log_level) {
+ DEBUG_START()
+ std::string str = plain_wallet::set_log_level(log_level);
+ 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;
+ DEBUG_END()
+}
+// std::string get_version();
+const char* ZANO_PlainWallet_getVersion() {
+ DEBUG_START()
+ std::string str = plain_wallet::get_version();
+ 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;
+ DEBUG_END()
+}
+// std::string get_wallet_files();
+const char* ZANO_PlainWallet_getWalletFiles() {
+ DEBUG_START()
+ std::string str = plain_wallet::get_wallet_files();
+ 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;
+ DEBUG_END()
+}
+// std::string get_export_private_info(const std::string& target_dir);
+const char* ZANO_PlainWallet_getExportPrivateInfo(const char* target_dir) {
+ DEBUG_START()
+ std::string str = plain_wallet::get_export_private_info(std::string(target_dir));
+ 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;
+ DEBUG_END()
+}
+// std::string delete_wallet(const std::string& file_name);
+const char* ZANO_PlainWallet_deleteWallet(const char* file_name) {
+ DEBUG_START()
+ std::string str = plain_wallet::delete_wallet(std::string(file_name));
+ 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;
+ DEBUG_END()
+}
+// std::string get_address_info(const std::string& addr);
+const char* ZANO_PlainWallet_getAddressInfo(const char* addr) {
+ DEBUG_START()
+ std::string str = plain_wallet::get_address_info(std::string(addr));
+ 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;
+ DEBUG_END()
+}
+// std::string get_appconfig(const std::string& encryption_key);
+const char* ZANO_PlainWallet_getAppconfig(const char* encryption_key) {
+ DEBUG_START()
+ std::string str = plain_wallet::get_appconfig(std::string(encryption_key));
+ 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;
+ DEBUG_END()
+}
+// std::string set_appconfig(const std::string& conf_str, const std::string& encryption_key);
+const char* ZANO_PlainWallet_setAppconfig(const char* conf_str, const char* encryption_key) {
+ DEBUG_START()
+ std::string str = plain_wallet::set_appconfig(std::string(conf_str), std::string(encryption_key));
+ 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;
+ DEBUG_END()
+}
+// std::string generate_random_key(uint64_t lenght);
+const char* ZANO_PlainWallet_generateRandomKey(uint64_t lenght) {
+ DEBUG_START()
+ std::string str = plain_wallet::generate_random_key(lenght);
+ 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;
+ DEBUG_END()
+}
+// std::string get_logs_buffer();
+const char* ZANO_PlainWallet_getLogsBuffer() {
+ DEBUG_START()
+ std::string str = plain_wallet::get_logs_buffer();
+ 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;
+ DEBUG_END()
+}
+// std::string truncate_log();
+const char* ZANO_PlainWallet_truncateLog() {
+ DEBUG_START()
+ std::string str = plain_wallet::truncate_log();
+ 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;
+ DEBUG_END()
+}
+// std::string get_connectivity_status();
+const char* ZANO_PlainWallet_getConnectivityStatus() {
+ DEBUG_START()
+ std::string str = plain_wallet::get_connectivity_status();
+ 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;
+ DEBUG_END()
+}
+// std::string open(const std::string& path, const std::string& password);
+const char* ZANO_PlainWallet_open(const char* path, const char* password) {
+ DEBUG_START()
+ std::string str = plain_wallet::open(std::string(path), std::string(password));
+ 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;
+ DEBUG_END()
+}
+// std::string restore(const std::string& seed, const std::string& path, const std::string& password, const std::string& seed_password);
+const char* ZANO_PlainWallet_restore(const char* seed, const char* path, const char* password, const char* seed_password) {
+ DEBUG_START()
+ std::string str = plain_wallet::restore(std::string(seed), std::string(path), std::string(password), std::string(seed_password));
+ 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;
+ DEBUG_END()
+}
+// std::string generate(const std::string& path, const std::string& password);
+const char* ZANO_PlainWallet_generate(const char* path, const char* password) {
+ DEBUG_START()
+ std::string str = plain_wallet::generate(std::string(path), std::string(password));
+ 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;
+ DEBUG_END()
+}
+// std::string get_opened_wallets();
+const char* ZANO_PlainWallet_getOpenWallets() {
+ DEBUG_START()
+ std::string str = plain_wallet::get_opened_wallets();
+ 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;
+ DEBUG_END()
+}
+
+// std::string get_wallet_status(hwallet h);
+const char* ZANO_PlainWallet_getWalletStatus(int64_t h) {
+ DEBUG_START()
+ std::string str = plain_wallet::get_wallet_status(h);
+ 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;
+ DEBUG_END()
+}
+// std::string close_wallet(hwallet h);
+const char* ZANO_PlainWallet_closeWallet(int64_t h) {
+ DEBUG_START()
+ std::string str = plain_wallet::close_wallet(h);
+ 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;
+ DEBUG_END()
+}
+// std::string invoke(hwallet h, const std::string& params);
+const char* ZANO_PlainWallet_invoke(int64_t h, const char* params) {
+ DEBUG_START()
+ std::string str = plain_wallet::invoke(h, std::string(params));
+ 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;
+ DEBUG_END()
+}
+// //async api
+// std::string async_call(const std::string& method_name, uint64_t instance_id, const std::string& params);
+const char* ZANO_PlainWallet_asyncCall(const char* method_name, uint64_t instance_id, const char* params) {
+ DEBUG_START()
+ std::string str = plain_wallet::async_call(std::string(method_name), instance_id, std::string(params));
+ 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;
+ DEBUG_END()
+}
+// std::string try_pull_result(uint64_t);
+const char* ZANO_PlainWallet_tryPullResult(uint64_t instance_id) {
+ DEBUG_START()
+ std::string str = plain_wallet::try_pull_result(instance_id);
+ 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;
+ DEBUG_END()
+}
+// std::string sync_call(const std::string& method_name, uint64_t instance_id, const std::string& params);
+const char* ZANO_PlainWallet_syncCall(const char* method_name, uint64_t instance_id, const char* params) {
+ DEBUG_START()
+ std::string str = plain_wallet::sync_call(std::string(method_name), instance_id, std::string(params));
+ 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;
+ DEBUG_END()
+}
+// //cake wallet api extension
+// bool is_wallet_exist(const std::string& path);
+bool ZANO_PlainWallet_isWalletExist(const char* path) {
+ DEBUG_START()
+ return plain_wallet::is_wallet_exist(std::string(path));
+ DEBUG_END()
+}
+// std::string get_wallet_info(hwallet h);
+const char* ZANO_PlainWallet_getWalletInfo(int64_t h) {
+ DEBUG_START()
+ std::string str = plain_wallet::get_wallet_info(h);
+ 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;
+ DEBUG_END()
+}
+// std::string reset_wallet_password(hwallet h, const std::string& password);
+const char* ZANO_PlainWallet_resetWalletPassword(int64_t h, const char* password) {
+ DEBUG_START()
+ std::string str = plain_wallet::reset_wallet_password(h, std::string(password));
+ 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;
+ DEBUG_END()
+}
+// uint64_t get_current_tx_fee(uint64_t priority); // 0 (default), 1 (unimportant), 2 (normal), 3 (elevated), 4 (priority)
+uint64_t ZANO_PlainWallet_getCurrentTxFee(uint64_t priority) {
+ DEBUG_START()
+ return plain_wallet::get_current_tx_fee(priority);
+ DEBUG_END()
+}
+// }
+
+void ZANO_free(void* ptr) {
+ free(ptr);
+}
+
+const char* ZANO_checksum_wallet2_api_c_h() {
+ return ZANO_wallet2_api_c_h_sha256;
+}
+const char* ZANO_checksum_wallet2_api_c_cpp() {
+ return ZANO_wallet2_api_c_cpp_sha256;
+}
+const char* ZANO_checksum_wallet2_api_c_exp() {
+ return ZANO_wallet2_api_c_exp_sha256;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.h b/zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.h
new file mode 100644
index 0000000..df6d3ef
--- /dev/null
+++ b/zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.h
@@ -0,0 +1,67 @@
+/*
+#include <android/log.h>
+
+#define LOG_TAG "[NDK]"
+#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
+#define LOGW(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__)
+#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
+*/
+#include <stdint.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <unistd.h>
+#include "zano_checksum.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifdef __MINGW32__
+ #define ADDAPI __declspec(dllexport)
+#else
+ #define ADDAPI __attribute__((__visibility__("default")))
+#endif
+
+
+extern ADDAPI const char* ZANO_PlainWallet_init(const char* address, const char* working_dir, int log_level);
+extern ADDAPI const char* ZANO_PlainWallet_init2(const char* ip, const char* port, const char* working_dir, int log_level);
+extern ADDAPI const char* ZANO_PlainWallet_reset();
+extern ADDAPI const char* ZANO_PlainWallet_setLogLevel(int log_level);
+extern ADDAPI const char* ZANO_PlainWallet_getVersion();
+extern ADDAPI const char* ZANO_PlainWallet_getWalletFiles();
+extern ADDAPI const char* ZANO_PlainWallet_getExportPrivateInfo(const char* target_dir);
+extern ADDAPI const char* ZANO_PlainWallet_deleteWallet(const char* file_name);
+extern ADDAPI const char* ZANO_PlainWallet_getAddressInfo(const char* addr);
+extern ADDAPI const char* ZANO_PlainWallet_getAppconfig(const char* encryption_key);
+extern ADDAPI const char* ZANO_PlainWallet_setAppconfig(const char* conf_str, const char* encryption_key);
+extern ADDAPI const char* ZANO_PlainWallet_generateRandomKey(uint64_t lenght);
+extern ADDAPI const char* ZANO_PlainWallet_getLogsBuffer();
+extern ADDAPI const char* ZANO_PlainWallet_truncateLog();
+extern ADDAPI const char* ZANO_PlainWallet_getConnectivityStatus();
+extern ADDAPI const char* ZANO_PlainWallet_open(const char* path, const char* password);
+extern ADDAPI const char* ZANO_PlainWallet_restore(const char* seed, const char* path, const char* password, const char* seed_password);
+extern ADDAPI const char* ZANO_PlainWallet_generate(const char* path, const char* password);
+extern ADDAPI const char* ZANO_PlainWallet_getOpenWallets();
+extern ADDAPI const char* ZANO_PlainWallet_getWalletStatus(int64_t h);
+extern ADDAPI const char* ZANO_PlainWallet_closeWallet(int64_t h);
+extern ADDAPI const char* ZANO_PlainWallet_invoke(int64_t h, const char* params);
+
+
+extern ADDAPI const char* ZANO_PlainWallet_asyncCall(const char* method_name, uint64_t instance_id, const char* params);
+extern ADDAPI const char* ZANO_PlainWallet_tryPullResult(uint64_t instance_id);
+extern ADDAPI const char* ZANO_PlainWallet_syncCall(const char* method_name, uint64_t instance_id, const char* params);
+extern ADDAPI bool ZANO_PlainWallet_isWalletExist(const char* path);
+extern ADDAPI const char* ZANO_PlainWallet_getWalletInfo(int64_t h);
+extern ADDAPI const char* ZANO_PlainWallet_resetWalletPassword(int64_t h, const char* password);
+extern ADDAPI uint64_t ZANO_PlainWallet_getCurrentTxFee(uint64_t priority);
+
+extern ADDAPI void ZANO_free(void* ptr);
+
+extern ADDAPI const char* ZANO_checksum_wallet2_api_c_h();
+extern ADDAPI const char* ZANO_checksum_wallet2_api_c_cpp();
+extern ADDAPI const char* ZANO_checksum_wallet2_api_c_exp();
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/zano_libwallet2_api_c/src/main/cpp/zano_checksum.h b/zano_libwallet2_api_c/src/main/cpp/zano_checksum.h
new file mode 100644
index 0000000..7f8d845
--- /dev/null
+++ b/zano_libwallet2_api_c/src/main/cpp/zano_checksum.h
@@ -0,0 +1,6 @@
+#ifndef MONEROC_CHECKSUMS
+#define MONEROC_CHECKSUMS
+const char * ZANO_wallet2_api_c_h_sha256 = "8acaa95513b85a984c08e05cc3f2ac7530bb8f32946eeeb45357bd846aef33dd";
+const char * ZANO_wallet2_api_c_cpp_sha256 = "4efacd3812d53dd268b6869cc0a9560e7320574d96e09136cf067f796edfeba6-2817090c8ac7639d6f697d00fc8bcba2b3681d90";
+const char * ZANO_wallet2_api_c_exp_sha256 = "66f3ff655bbfd11ad28c318ab707090b5a93276f436b06f7b1c0f329dba3c9c2";
+#endif
diff --git a/zano_libwallet2_api_c/zano_libwallet2_api_c.exp b/zano_libwallet2_api_c/zano_libwallet2_api_c.exp
new file mode 100644
index 0000000..423922a
--- /dev/null
+++ b/zano_libwallet2_api_c/zano_libwallet2_api_c.exp
@@ -0,0 +1,33 @@
+_ZANO_PlainWallet_init
+_ZANO_PlainWallet_init2
+_ZANO_PlainWallet_reset
+_ZANO_PlainWallet_setLogLevel
+_ZANO_PlainWallet_getVersion
+_ZANO_PlainWallet_getWalletFiles
+_ZANO_PlainWallet_getExportPrivateInfo
+_ZANO_PlainWallet_deleteWallet
+_ZANO_PlainWallet_getAddressInfo
+_ZANO_PlainWallet_getAppconfig
+_ZANO_PlainWallet_setAppconfig
+_ZANO_PlainWallet_generateRandomKey
+_ZANO_PlainWallet_getLogsBuffer
+_ZANO_PlainWallet_truncateLog
+_ZANO_PlainWallet_getConnectivityStatus
+_ZANO_PlainWallet_open
+_ZANO_PlainWallet_restore
+_ZANO_PlainWallet_generate
+_ZANO_PlainWallet_getOpenWallets
+_ZANO_PlainWallet_getWalletStatus
+_ZANO_PlainWallet_closeWallet
+_ZANO_PlainWallet_invoke
+_ZANO_PlainWallet_asyncCall
+_ZANO_PlainWallet_tryPullResult
+_ZANO_PlainWallet_syncCall
+_ZANO_PlainWallet_isWalletExist
+_ZANO_PlainWallet_getWalletInfo
+_ZANO_PlainWallet_resetWalletPassword
+_ZANO_PlainWallet_getCurrentTxFee
+_ZANO_free
+_ZANO_checksum_wallet2_api_c_h
+_ZANO_checksum_wallet2_api_c_cpp
+_ZANO_checksum_wallet2_api_c_exp \ No newline at end of file