Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b34fe88da | |||
| aa394d8509 | |||
| 59fc73d7a9 | |||
| a744e15783 | |||
| 2b15a84077 | |||
| 79284e8e6a | |||
| 23f475eb6d | |||
| 45d8a8673f | |||
| 606b38f999 | |||
| 4c6ef8696a | |||
| bc36b47870 | |||
| b577c6ab26 | |||
| 1fc46bc09d | |||
| 224a4665aa | |||
| df059e02b6 | |||
| 78c6768b51 | |||
| a621c658a8 | |||
| b814d22f97 | |||
| 63f0e9b137 | |||
| 8c68284aba | |||
| 2968e45b4c | |||
| 8f10e7748f | |||
| 04ec60d6df | |||
| d7cdce9994 | |||
| 6cb45bf907 | |||
| 778cf30248 | |||
| 3aba4e8522 | |||
| 1a01d3f06c | |||
| 55b1865d38 | |||
| 8b3d0f2c35 | |||
| 27dd9d3e85 | |||
| 6516ae02d0 | |||
| da6c95ff28 | |||
| 5ab515a7f7 | |||
| 02dd30d81a | |||
| f0a5d0bc36 | |||
| 7f3144409c | |||
| 227cb1071f | |||
| 392b0289e3 | |||
| 05a4ff1014 | |||
| 5f18f0ee0a | |||
| f830757605 | |||
| b1edbca038 | |||
| ac72e852a5 | |||
| 8100f752e2 | |||
| 808a0671c1 | |||
| 7e278fac3d | |||
| 1831f243ff | |||
| af359f4151 | |||
| db4e559ce5 | |||
| e78aa5a863 | |||
| f31c97c303 |
@@ -1,4 +1,4 @@
|
||||
FROM --platform=linux/amd64 ghcr.io/cirruslabs/flutter:3.24.3
|
||||
FROM --platform=linux/amd64 ghcr.io/cirruslabs/flutter:3.29.3
|
||||
# FROM debian:bookworm
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- uses: 8BitJonny/gh-get-current-pr@3.0.0
|
||||
- uses: 8BitJonny/gh-get-current-pr@4.0.0
|
||||
id: PR
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- uses: 8BitJonny/gh-get-current-pr@3.0.0
|
||||
- uses: 8BitJonny/gh-get-current-pr@4.0.0
|
||||
id: PR
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
|
||||
+192
-175
@@ -9,6 +9,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
coin: [monero, wownero]
|
||||
target: [x86_64-w64-mingw32, i686-w64-mingw32]
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:24.04
|
||||
@@ -26,25 +27,19 @@ jobs:
|
||||
git config --global --add safe.directory '*'
|
||||
git config --global user.email "ci@mrcyjanek.net"
|
||||
git config --global user.name "CI mrcyjanek.net"
|
||||
./apply_patches.sh ${{ matrix.coin }}
|
||||
./apply_patches.sh monero
|
||||
./apply_patches.sh wownero
|
||||
./apply_patches.sh zano
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ github.job }}-${{ matrix.coin }}
|
||||
- name: Cache built
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
contrib/depends/built/*
|
||||
key: depends-${{ github.job }}-${{ hashFiles('contrib/depends/packages/*.mk') }}
|
||||
- name: ${{ matrix.coin }}/x86_64-w64-mingw32
|
||||
run: ./build_single.sh ${{ matrix.coin }} x86_64-w64-mingw32 -j$(nproc)
|
||||
- name: ${{ matrix.coin }}/i686-w64-mingw32
|
||||
run: ./build_single.sh ${{ matrix.coin }} i686-w64-mingw32 -j$(nproc)
|
||||
key: ${{ github.job }}-${{ matrix.coin }}-${{ matrix.target }}
|
||||
- name: Build ${{ matrix.coin }} for ${{ matrix.target }}
|
||||
run: |
|
||||
env DEPENDS_UNTRUSTED_FAST_BUILDS=forced ./build_single.sh ${{ matrix.coin }} ${{ matrix.target }} -j$(nproc)
|
||||
- name: rename artifacts
|
||||
run: |
|
||||
mkdir release/gh/
|
||||
mkdir -p release/gh/
|
||||
for i in release/${{ matrix.coin }}/*
|
||||
do
|
||||
cp "$i" "release/gh/${{ matrix.coin }}_$(basename $i)"
|
||||
@@ -58,16 +53,16 @@ jobs:
|
||||
- name: Upload lib
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: mingw ${{ matrix.coin }}
|
||||
name: mingw-${{ matrix.coin }}-${{ matrix.target }}
|
||||
path: release/${{ matrix.coin }}
|
||||
|
||||
lib_android:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
coin: [monero, wownero, zano]
|
||||
target: [x86_64-linux-android, armv7a-linux-androideabi, aarch64-linux-android]
|
||||
runs-on: ubuntu-22.04
|
||||
# container:
|
||||
# image: debian:bookworm
|
||||
steps:
|
||||
- name: Free Disk Space
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
@@ -93,27 +88,19 @@ jobs:
|
||||
git config --global --add safe.directory '*'
|
||||
git config --global user.email "ci@mrcyjanek.net"
|
||||
git config --global user.name "CI mrcyjanek.net"
|
||||
./apply_patches.sh ${{ matrix.coin }}
|
||||
./apply_patches.sh monero
|
||||
./apply_patches.sh wownero
|
||||
./apply_patches.sh zano
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ github.job }}-${{ matrix.coin }}
|
||||
- name: Cache built
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
contrib/depends/built/*
|
||||
key: depends-${{ github.job }}-${{ hashFiles('contrib/depends/packages/*.mk') }}
|
||||
- name: ${{ matrix.coin }}/x86_64-linux-android
|
||||
run: ./build_single.sh ${{ matrix.coin }} x86_64-linux-android -j$(nproc)
|
||||
- name: ${{ matrix.coin }}/aarch64-linux-android
|
||||
run: ./build_single.sh ${{ matrix.coin }} aarch64-linux-android -j$(nproc)
|
||||
- name: ${{ matrix.coin }}/armv7a-linux-androideabi
|
||||
run: ./build_single.sh ${{ matrix.coin }} armv7a-linux-androideabi -j$(nproc)
|
||||
key: ${{ github.job }}-${{ matrix.coin }}-${{ matrix.target }}
|
||||
- name: Build ${{ matrix.coin }} for ${{ matrix.target }}
|
||||
run: |
|
||||
env DEPENDS_UNTRUSTED_FAST_BUILDS=forced ./build_single.sh ${{ matrix.coin }} ${{ matrix.target }} -j$(nproc)
|
||||
- name: rename artifacts
|
||||
run: |
|
||||
mkdir release/gh/
|
||||
mkdir -p release/gh/
|
||||
for i in release/${{ matrix.coin }}/*
|
||||
do
|
||||
cp "$i" "release/gh/${{ matrix.coin }}_$(basename $i)"
|
||||
@@ -127,17 +114,19 @@ jobs:
|
||||
- name: Upload lib
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: android ${{ matrix.coin }}
|
||||
name: android-${{ matrix.coin }}-${{ matrix.target }}
|
||||
path: release/${{ matrix.coin }}
|
||||
- name: remove android_ndk
|
||||
run: |
|
||||
rm -rf contrib/depends/built/*/android_ndk
|
||||
rm -rf contrib/depends/sources/android-ndk-r26d-linux.zip
|
||||
|
||||
lib_linux:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
coin: [monero, wownero, zano]
|
||||
target: [x86_64-linux-gnu, aarch64-linux-gnu, i686-linux-gnu]
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: debian:bullseye
|
||||
@@ -155,27 +144,19 @@ jobs:
|
||||
git config --global --add safe.directory '*'
|
||||
git config --global user.email "ci@mrcyjanek.net"
|
||||
git config --global user.name "CI mrcyjanek.net"
|
||||
./apply_patches.sh ${{ matrix.coin }}
|
||||
./apply_patches.sh monero
|
||||
./apply_patches.sh wownero
|
||||
./apply_patches.sh zano
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ github.job }}-${{ matrix.coin }}
|
||||
- name: Cache built
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
contrib/depends/built/*
|
||||
key: depends-${{ github.job }}-${{ hashFiles('contrib/depends/packages/*.mk') }}
|
||||
- name: ${{ matrix.coin }}/x86_64-linux-gnu
|
||||
run: ./build_single.sh ${{ matrix.coin }} x86_64-linux-gnu -j$(nproc)
|
||||
- name: ${{ matrix.coin }}/aarch64-linux-gnu
|
||||
run: ./build_single.sh ${{ matrix.coin }} aarch64-linux-gnu -j$(nproc)
|
||||
- name: ${{ matrix.coin }}/i686-linux-gnu
|
||||
run: ./build_single.sh ${{ matrix.coin }} i686-linux-gnu -j$(nproc)
|
||||
key: ${{ github.job }}-${{ matrix.coin }}-${{ matrix.target }}
|
||||
- name: Build ${{ matrix.coin }} for ${{ matrix.target }}
|
||||
run: |
|
||||
env DEPENDS_UNTRUSTED_FAST_BUILDS=forced ./build_single.sh ${{ matrix.coin }} ${{ matrix.target }} -j$(nproc)
|
||||
- name: rename artifacts
|
||||
run: |
|
||||
mkdir release/gh/
|
||||
mkdir -p release/gh/
|
||||
for i in release/${{ matrix.coin }}/*
|
||||
do
|
||||
cp "$i" "release/gh/${{ matrix.coin }}_$(basename $i)"
|
||||
@@ -189,15 +170,17 @@ jobs:
|
||||
- name: Upload lib
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux ${{ matrix.coin }}
|
||||
name: linux-${{ matrix.coin }}-${{ matrix.target }}
|
||||
path: release/${{ matrix.coin }}
|
||||
|
||||
lib_macos:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
coin: [monero, wownero, zano]
|
||||
target: [aarch64-apple-darwin, x86_64-apple-darwin]
|
||||
name: macos build
|
||||
runs-on: macos-14
|
||||
runs-on: macos-15
|
||||
steps:
|
||||
- name: Checkout monero_c repo
|
||||
uses: actions/checkout@v4
|
||||
@@ -207,36 +190,29 @@ jobs:
|
||||
submodules: recursive
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '15.4'
|
||||
xcode-version: '16.4'
|
||||
- name: install dependencies
|
||||
run: |
|
||||
brew install ccache binutils pigz autoconf automake libtool pkg-config
|
||||
brew uninstall cmake
|
||||
brew install cmake ccache binutils pigz autoconf automake libtool pkg-config
|
||||
- name: Patch sources
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
git config --global user.email "ci@mrcyjanek.net"
|
||||
git config --global user.name "CI mrcyjanek.net"
|
||||
./apply_patches.sh ${{ matrix.coin }}
|
||||
./apply_patches.sh monero
|
||||
./apply_patches.sh wownero
|
||||
./apply_patches.sh zano
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ github.job }}-${{ matrix.coin }}
|
||||
- name: Cache built
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
contrib/depends/built/*
|
||||
key: depends-${{ github.job }}-${{ hashFiles('contrib/depends/packages/*.mk') }}
|
||||
- name: build (aarch64-apple-darwin)
|
||||
key: ${{ github.job }}-${{ matrix.coin }}-${{ matrix.target }}
|
||||
- name: Build ${{ matrix.coin }} for ${{ matrix.target }}
|
||||
run: |
|
||||
./build_single.sh ${{ matrix.coin }} aarch64-apple-darwin -j$(sysctl -n hw.logicalcpu)
|
||||
- name: build (x86_64-apple-darwin)
|
||||
run: |
|
||||
./build_single.sh ${{ matrix.coin }} x86_64-apple-darwin -j$(sysctl -n hw.logicalcpu)
|
||||
env DEPENDS_UNTRUSTED_FAST_BUILDS=forced ./build_single.sh ${{ matrix.coin }} ${{ matrix.target }} -j$(sysctl -n hw.logicalcpu)
|
||||
- name: rename artifacts
|
||||
run: |
|
||||
mkdir release/gh/
|
||||
mkdir -p release/gh/
|
||||
for i in release/${{ matrix.coin }}/*
|
||||
do
|
||||
cp "$i" "release/gh/${{ matrix.coin }}_$(basename $i)"
|
||||
@@ -250,13 +226,15 @@ jobs:
|
||||
- name: Upload lib
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: macos ${{ matrix.coin }}
|
||||
name: macos-${{ matrix.coin }}-${{ matrix.target }}
|
||||
path: release/${{ matrix.coin }}
|
||||
|
||||
lib_ios:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
coin: [monero, wownero, zano]
|
||||
target: [aarch64-apple-ios, aarch64-apple-iossimulator]
|
||||
name: ios build
|
||||
runs-on: macos-15
|
||||
steps:
|
||||
@@ -268,38 +246,29 @@ jobs:
|
||||
submodules: recursive
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '16.1'
|
||||
xcode-version: '16.4'
|
||||
- name: install dependencies
|
||||
run: |
|
||||
brew install ccache cmake autoconf automake libtool
|
||||
brew uninstall cmake
|
||||
brew install cmake ccache autoconf automake libtool
|
||||
- name: Patch sources
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
git config --global user.email "ci@mrcyjanek.net"
|
||||
git config --global user.name "CI mrcyjanek.net"
|
||||
./apply_patches.sh ${{ matrix.coin }}
|
||||
./apply_patches.sh monero
|
||||
./apply_patches.sh wownero
|
||||
./apply_patches.sh zano
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ github.job }}-${{ matrix.coin }}
|
||||
- name: Cache built
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
contrib/depends/built/*
|
||||
key: depends-${{ github.job }}-${{ hashFiles('contrib/depends/packages/*.mk') }}
|
||||
- name: build (aarch64-apple-ios)
|
||||
key: ${{ github.job }}-${{ matrix.coin }}-${{ matrix.target }}
|
||||
- name: Build ${{ matrix.coin }} for ${{ matrix.target }}
|
||||
run: |
|
||||
./build_single.sh ${{ matrix.coin }} aarch64-apple-ios -j$(sysctl -n hw.logicalcpu)
|
||||
|
||||
- name: build (aarch64-apple-iossimulator)
|
||||
run: |
|
||||
./build_single.sh ${{ matrix.coin }} aarch64-apple-iossimulator -j$(sysctl -n hw.logicalcpu)
|
||||
|
||||
env DEPENDS_UNTRUSTED_FAST_BUILDS=forced ./build_single.sh ${{ matrix.coin }} ${{ matrix.target }} -j$(sysctl -n hw.logicalcpu)
|
||||
- name: rename artifacts
|
||||
run: |
|
||||
mkdir release/gh/
|
||||
mkdir -p release/gh/
|
||||
for i in release/${{ matrix.coin }}/*
|
||||
do
|
||||
cp "$i" "release/gh/${{ matrix.coin }}_$(basename $i)"
|
||||
@@ -313,90 +282,123 @@ jobs:
|
||||
- name: Upload lib
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ios ${{ matrix.coin }}
|
||||
name: ios-${{ matrix.coin }}-${{ matrix.target }}
|
||||
path: release/${{ matrix.coin }}
|
||||
|
||||
bulk_lib_release:
|
||||
name: create single release file
|
||||
runs-on: ubuntu-latest
|
||||
needs: [
|
||||
lib_mingw, lib_android, lib_linux, lib_macos, lib_ios
|
||||
]
|
||||
needs: [lib_mingw, lib_android, lib_linux, lib_macos, lib_ios]
|
||||
strategy:
|
||||
matrix:
|
||||
coin: [monero, wownero, zano]
|
||||
platform: [android, ios, linux, macos]
|
||||
include:
|
||||
- coin: monero
|
||||
platform: mingw
|
||||
- coin: wownero
|
||||
platform: mingw
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
- name: Create release directory
|
||||
run: mkdir -p release/${{ matrix.coin }}
|
||||
|
||||
- name: Download Android artifacts
|
||||
if: matrix.platform == 'android'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: android monero
|
||||
path: release/monero
|
||||
- uses: actions/download-artifact@v4
|
||||
pattern: android-${{ matrix.coin }}-*
|
||||
path: temp-android
|
||||
merge-multiple: true
|
||||
|
||||
- name: Download iOS artifacts
|
||||
if: matrix.platform == 'ios'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: android wownero
|
||||
path: release/wownero
|
||||
- uses: actions/download-artifact@v4
|
||||
pattern: ios-${{ matrix.coin }}-*
|
||||
path: temp-ios
|
||||
merge-multiple: true
|
||||
|
||||
- name: Download Linux artifacts
|
||||
if: matrix.platform == 'linux'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: android zano
|
||||
path: release/zano
|
||||
- uses: actions/download-artifact@v4
|
||||
pattern: linux-${{ matrix.coin }}-*
|
||||
path: temp-linux
|
||||
merge-multiple: true
|
||||
|
||||
- name: Download macOS artifacts
|
||||
if: matrix.platform == 'macos'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ios monero
|
||||
path: release/monero
|
||||
- uses: actions/download-artifact@v4
|
||||
pattern: macos-${{ matrix.coin }}-*
|
||||
path: temp-macos
|
||||
merge-multiple: true
|
||||
|
||||
- name: Download MinGW artifacts
|
||||
if: matrix.platform == 'mingw' && (matrix.coin == 'monero' || matrix.coin == 'wownero')
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ios wownero
|
||||
path: release/wownero
|
||||
- uses: actions/download-artifact@v4
|
||||
pattern: mingw-${{ matrix.coin }}-*
|
||||
path: temp-mingw
|
||||
merge-multiple: true
|
||||
|
||||
- name: Copy artifacts to release directory
|
||||
run: |
|
||||
if [ -d "temp-${{ matrix.platform }}" ]; then
|
||||
cp -r temp-${{ matrix.platform }}/* release/${{ matrix.coin }}/
|
||||
fi
|
||||
|
||||
- name: Upload consolidated artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ios zano
|
||||
path: release/zano
|
||||
- uses: actions/download-artifact@v4
|
||||
name: ${{ matrix.platform }}-${{ matrix.coin }}-all
|
||||
path: release/${{ matrix.coin }}
|
||||
|
||||
final_bulk_release:
|
||||
name: create final release bundle
|
||||
runs-on: ubuntu-latest
|
||||
needs: [bulk_lib_release]
|
||||
steps:
|
||||
- name: Create release directory
|
||||
run: mkdir -p release/{monero,wownero,zano}
|
||||
|
||||
- name: Download all consolidated artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: linux monero
|
||||
path: release/monero
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: linux wownero
|
||||
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
|
||||
with:
|
||||
name: macos wownero
|
||||
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
|
||||
with:
|
||||
name: mingw wownero
|
||||
path: release/wownero
|
||||
pattern: "*-all"
|
||||
path: temp-all
|
||||
|
||||
- name: Reorganize artifacts
|
||||
run: |
|
||||
# Move all artifacts to their respective coin directories
|
||||
for coin in monero wownero zano; do
|
||||
find temp-all -name "*-${coin}-all" -type d | while read dir; do
|
||||
if [ -d "$dir" ]; then
|
||||
cp -r "$dir"/* "release/${coin}/" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
- name: zip release dir
|
||||
run: zip -r release-bundle.zip release
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: release-bundle.zip
|
||||
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
- name: Upload lib
|
||||
|
||||
- name: Upload final bundle
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-bulk
|
||||
path: release
|
||||
|
||||
deno_monerots_test_linux:
|
||||
name: test ts library
|
||||
runs-on: ubuntu-24.04
|
||||
needs: [
|
||||
lib_linux
|
||||
]
|
||||
needs: [lib_linux]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -404,10 +406,13 @@ jobs:
|
||||
submodules: recursive
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: linux monero
|
||||
path: release/monero
|
||||
pattern: linux-monero-x86_64-linux-gnu
|
||||
path: temp-linux-monero
|
||||
merge-multiple: true
|
||||
- name: unpack and move monero_c
|
||||
run: |
|
||||
mkdir -p release/monero
|
||||
cp -r temp-linux-monero/* release/monero/
|
||||
unxz -f -k release/*/*.xz
|
||||
- uses: denoland/setup-deno@v1
|
||||
with:
|
||||
@@ -431,9 +436,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
coin: [monero, wownero]
|
||||
needs: [
|
||||
lib_linux
|
||||
]
|
||||
needs: [lib_linux]
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: denoland/setup-deno@v2
|
||||
@@ -447,8 +450,14 @@ jobs:
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: linux ${{ matrix.coin }}
|
||||
path: release/${{ matrix.coin }}
|
||||
pattern: linux-${{ matrix.coin }}-*
|
||||
path: temp-linux-${{ matrix.coin }}
|
||||
merge-multiple: true
|
||||
|
||||
- name: Setup release directory
|
||||
run: |
|
||||
mkdir -p release/${{ matrix.coin }}
|
||||
cp -r temp-linux-${{ matrix.coin }}/* release/${{ matrix.coin }}/
|
||||
|
||||
- name: Run regression tests
|
||||
run: COIN="${{ matrix.coin }}" deno test -A tests/regression.test.ts
|
||||
@@ -458,10 +467,8 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
coin: [monero, wownero]
|
||||
needs: [
|
||||
lib_macos
|
||||
]
|
||||
runs-on: macos-14
|
||||
needs: [lib_macos]
|
||||
runs-on: macos-15
|
||||
steps:
|
||||
- uses: denoland/setup-deno@v2
|
||||
with:
|
||||
@@ -474,8 +481,14 @@ jobs:
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: macos ${{ matrix.coin }}
|
||||
path: release/${{ matrix.coin }}
|
||||
pattern: macos-${{ matrix.coin }}-*
|
||||
path: temp-macos-${{ matrix.coin }}
|
||||
merge-multiple: true
|
||||
|
||||
- name: Setup release directory
|
||||
run: |
|
||||
mkdir -p release/${{ matrix.coin }}
|
||||
cp -r temp-macos-${{ matrix.coin }}/* release/${{ matrix.coin }}/
|
||||
|
||||
- name: Run regression tests
|
||||
run: COIN="${{ matrix.coin }}" deno test -A tests/regression.test.ts
|
||||
@@ -485,9 +498,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
coin: [monero, wownero]
|
||||
needs: [
|
||||
lib_linux
|
||||
]
|
||||
needs: [lib_linux]
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: denoland/setup-deno@v2
|
||||
@@ -501,8 +512,14 @@ jobs:
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: linux ${{ matrix.coin }}
|
||||
path: release/${{ matrix.coin }}
|
||||
pattern: linux-${{ matrix.coin }}-*
|
||||
path: temp-linux-${{ matrix.coin }}
|
||||
merge-multiple: true
|
||||
|
||||
- name: Setup release directory
|
||||
run: |
|
||||
mkdir -p release/${{ matrix.coin }}
|
||||
cp -r temp-linux-${{ matrix.coin }}/* release/${{ matrix.coin }}/
|
||||
|
||||
- name: Run integration tests
|
||||
run: COIN="${{ matrix.coin }}" deno test -A tests/integration.test.ts
|
||||
@@ -511,16 +528,13 @@ jobs:
|
||||
SECRET_WALLET_MNEMONIC: ${{ secrets.SECRET_WALLET_MNEMONIC }}
|
||||
SECRET_WALLET_RESTORE_HEIGHT: ${{ secrets.SECRET_WALLET_RESTORE_HEIGHT }}
|
||||
|
||||
|
||||
integration_tests_macos:
|
||||
name: macos integration tests
|
||||
strategy:
|
||||
matrix:
|
||||
coin: [monero, wownero]
|
||||
needs: [
|
||||
lib_macos
|
||||
]
|
||||
runs-on: macos-14
|
||||
needs: [lib_macos]
|
||||
runs-on: macos-15
|
||||
steps:
|
||||
- uses: denoland/setup-deno@v2
|
||||
with:
|
||||
@@ -533,8 +547,14 @@ jobs:
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: macos ${{ matrix.coin }}
|
||||
path: release/${{ matrix.coin }}
|
||||
pattern: macos-${{ matrix.coin }}-*
|
||||
path: temp-macos-${{ matrix.coin }}
|
||||
merge-multiple: true
|
||||
|
||||
- name: Setup release directory
|
||||
run: |
|
||||
mkdir -p release/${{ matrix.coin }}
|
||||
cp -r temp-macos-${{ matrix.coin }}/* release/${{ matrix.coin }}/
|
||||
|
||||
- name: Run integration tests
|
||||
run: COIN="${{ matrix.coin }}" deno test -A tests/integration.test.ts
|
||||
@@ -543,13 +563,10 @@ jobs:
|
||||
SECRET_WALLET_MNEMONIC: ${{ secrets.SECRET_WALLET_MNEMONIC }}
|
||||
SECRET_WALLET_RESTORE_HEIGHT: ${{ secrets.SECRET_WALLET_RESTORE_HEIGHT }}
|
||||
|
||||
|
||||
comment_pr:
|
||||
name: comment on pr
|
||||
runs-on: ubuntu-latest
|
||||
needs: [
|
||||
lib_mingw, lib_android, lib_linux, lib_macos, lib_ios,
|
||||
]
|
||||
needs: [lib_mingw, lib_android, lib_linux, lib_macos, lib_ios]
|
||||
steps:
|
||||
- uses: actions/github-script@v7
|
||||
continue-on-error: true
|
||||
|
||||
+2
-1
@@ -19,4 +19,5 @@
|
||||
[submodule "salvium"]
|
||||
path = salvium
|
||||
url = https://github.com/salvium/salvium
|
||||
branch = rebase-v0.18
|
||||
branch = main
|
||||
shallow = true
|
||||
+1
-1
@@ -59,7 +59,7 @@ pushd contrib/depends
|
||||
then
|
||||
echo "Not building depends, directory exists"
|
||||
else
|
||||
env -i PATH="$PATH" CC=gcc CXX=g++ make "$NPROC" HOST="$HOST_ABI"
|
||||
env -i PATH="$PATH" CC=gcc CXX=g++ make "$NPROC" HOST="$HOST_ABI" DEPENDS_UNTRUSTED_FAST_BUILDS=$DEPENDS_UNTRUSTED_FAST_BUILDS
|
||||
fi
|
||||
popd
|
||||
|
||||
|
||||
Vendored
+265
@@ -0,0 +1,265 @@
|
||||
pipeline {
|
||||
agent none
|
||||
|
||||
parameters {
|
||||
string(
|
||||
name: 'LINUX_TARGETS',
|
||||
defaultValue: 'x86_64-linux-gnu,aarch64-linux-gnu,i686-linux-gnu',
|
||||
description: 'Comma-separated list of Linux targets to build'
|
||||
)
|
||||
string(
|
||||
name: 'ANDROID_TARGETS',
|
||||
defaultValue: 'x86_64-linux-android,armv7a-linux-androideabi,aarch64-linux-android',
|
||||
description: 'Comma-separated list of Android targets to build'
|
||||
)
|
||||
string(
|
||||
name: 'MINGW_TARGETS',
|
||||
defaultValue: 'x86_64-w64-mingw32,i686-w64-mingw32',
|
||||
description: 'Comma-separated list of MinGW targets to build'
|
||||
)
|
||||
string(
|
||||
name: 'DARWIN_TARGETS',
|
||||
defaultValue: 'aarch64-apple-darwin,x86_64-apple-darwin,aarch64-apple-ios,aarch64-apple-iossimulator',
|
||||
description: 'Comma-separated list of Darwin targets to build'
|
||||
)
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Check Changes') {
|
||||
agent any
|
||||
steps {
|
||||
script {
|
||||
def changes = sh(
|
||||
script: "git diff --name-only HEAD~1 HEAD | grep '^contrib/depends' || echo 'NO_CHANGES'",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
if (changes == 'NO_CHANGES') {
|
||||
echo "No changes detected in contrib/depends directory. Skipping build."
|
||||
currentBuild.result = 'NOT_BUILT'
|
||||
return
|
||||
} else {
|
||||
echo "Changes detected in contrib/depends directory:"
|
||||
echo changes
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build Dependencies') {
|
||||
when {
|
||||
not {
|
||||
equals expected: 'NOT_BUILT', actual: currentBuild.result
|
||||
}
|
||||
}
|
||||
parallel {
|
||||
stage('Linux Builds') {
|
||||
agent {
|
||||
dockerfile {
|
||||
filename '.devcontainer/Dockerfile'
|
||||
args '-v /opt/builds:/opt/builds'
|
||||
label 'linux && amd64'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
def targets = params.LINUX_TARGETS.split(',').collect { it.trim() }
|
||||
|
||||
checkout scm
|
||||
|
||||
for (target in targets) {
|
||||
echo "Building Linux dependencies for ${target}"
|
||||
|
||||
dir('contrib/depends') {
|
||||
sh "rm -rf built/${target}/*"
|
||||
sh "make HOST=${target} DEPENDS_UNTRUSTED_FAST_BUILDS=yes"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
def targets = params.LINUX_TARGETS.split(',').collect { it.trim() }
|
||||
for (target in targets) {
|
||||
uploadIfChanged(target)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Android Builds') {
|
||||
agent {
|
||||
dockerfile {
|
||||
filename '.devcontainer/Dockerfile'
|
||||
args '-v /opt/builds:/opt/builds'
|
||||
label 'linux && amd64'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
def targets = params.ANDROID_TARGETS.split(',').collect { it.trim() }
|
||||
|
||||
checkout scm
|
||||
|
||||
for (target in targets) {
|
||||
echo "Building Android dependencies for ${target}"
|
||||
|
||||
dir('contrib/depends') {
|
||||
sh "rm -rf built/${target}/*"
|
||||
sh "make HOST=${target} DEPENDS_UNTRUSTED_FAST_BUILDS=yes"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
def targets = params.ANDROID_TARGETS.split(',').collect { it.trim() }
|
||||
for (target in targets) {
|
||||
uploadIfChanged(target)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('MinGW Builds') {
|
||||
agent {
|
||||
dockerfile {
|
||||
filename '.devcontainer/Dockerfile'
|
||||
args '-v /opt/builds:/opt/builds'
|
||||
label 'linux && amd64'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
def targets = params.MINGW_TARGETS.split(',').collect { it.trim() }
|
||||
|
||||
checkout scm
|
||||
|
||||
for (target in targets) {
|
||||
echo "Building MinGW dependencies for ${target}"
|
||||
|
||||
dir('contrib/depends') {
|
||||
sh "rm -rf built/${target}/*"
|
||||
sh "make HOST=${target} DEPENDS_UNTRUSTED_FAST_BUILDS=yes"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
def targets = params.MINGW_TARGETS.split(',').collect { it.trim() }
|
||||
for (target in targets) {
|
||||
uploadIfChanged(target)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Darwin Builds') {
|
||||
agent {
|
||||
label 'darwin && arm64'
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
def targets = params.DARWIN_TARGETS.split(',').collect { it.trim() }
|
||||
|
||||
checkout scm
|
||||
|
||||
for (target in targets) {
|
||||
echo "Building dependencies for ${target}"
|
||||
|
||||
dir('contrib/depends') {
|
||||
sh "rm -rf built/${target}/*"
|
||||
sh "make HOST=${target} DEPENDS_UNTRUSTED_FAST_BUILDS=yes"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
def targets = params.DARWIN_TARGETS.split(',').collect { it.trim() }
|
||||
for (target in targets) {
|
||||
uploadIfChanged(target)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
echo "Build completed."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def uploadIfChanged(target) {
|
||||
withCredentials([sshUserPrivateKey(credentialsId: 'static-mrcyjanek-net-ssh-key', keyFileVariable: 'SSH_KEY', usernameVariable: 'SSH_USER')]) {
|
||||
sh """
|
||||
set -e
|
||||
upload_with_checksum() {
|
||||
local file_path="\$1"
|
||||
local remote_path="\$2"
|
||||
local filename=\$(basename "\$file_path")
|
||||
|
||||
if [ ! -f "\$file_path" ]; then
|
||||
echo "File \$file_path does not exist, skipping..."
|
||||
return 0
|
||||
fi
|
||||
|
||||
local_checksum=\$(sha256sum "\$file_path" | cut -d' ' -f1)
|
||||
echo "Local checksum for \$filename: \$local_checksum"
|
||||
|
||||
remote_checksum=\$(ssh -i "\$SSH_KEY" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "\$SSH_USER@static.mrcyjanek.net" "cd \$remote_path && sha256sum \$filename 2>/dev/null | cut -d' ' -f1 || echo 'FILE_NOT_FOUND'")
|
||||
|
||||
echo "Remote checksum for \$filename: \$remote_checksum"
|
||||
|
||||
if [ "\$local_checksum" != "\$remote_checksum" ]; then
|
||||
echo "Checksums differ, uploading \$filename..."
|
||||
|
||||
ssh -i "\$SSH_KEY" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "\$SSH_USER@static.mrcyjanek.net" "mkdir -p \$remote_path"
|
||||
|
||||
scp -i "\$SSH_KEY" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "\$file_path" "\$SSH_USER@static.mrcyjanek.net:\$remote_path/\$filename"
|
||||
|
||||
uploaded_checksum=\$(ssh -i "\$SSH_KEY" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "\$SSH_USER@static.mrcyjanek.net" "cd \$remote_path && sha256sum \$filename | cut -d' ' -f1")
|
||||
|
||||
if [ "\$local_checksum" = "\$uploaded_checksum" ]; then
|
||||
echo "Upload successful for \$filename"
|
||||
else
|
||||
echo "Upload verification failed for \$filename"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Checksums match, skipping upload for \$filename"
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Processing target: ${target}"
|
||||
|
||||
for package_dir in contrib/depends/built/${target}/*/; do
|
||||
if [ -d "\$package_dir" ]; then
|
||||
package=\$(basename "\$package_dir")
|
||||
echo "Processing package: \$package: \$(ls -la "\$package_dir")"
|
||||
|
||||
for file in "\$package_dir"/*.tar.gz*; do
|
||||
remote_dir_base="/home/mrcyjanek/web/static.mrcyjanek.net/public_html/lfs/depends/contrib/depends/built/${target}/\$package"
|
||||
echo "Uploading \$file to \$remote_dir_base"
|
||||
upload_with_checksum "\$file" "\$remote_dir_base"
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Finished processing ${target}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
+38
-12
@@ -13,6 +13,17 @@ DOWNLOAD_CONNECT_TIMEOUT:=30
|
||||
DOWNLOAD_RETRIES:=5
|
||||
HOST_ID_SALT ?= salt
|
||||
BUILD_ID_SALT ?= salt
|
||||
|
||||
DEPENDS_UNTRUSTED_FAST_BUILDS ?=
|
||||
PREBUILT_BASE_URL ?= https://static.mrcyjanek.net/lfs/depends/contrib/depends/built
|
||||
ifneq ($(DEPENDS_UNTRUSTED_FAST_BUILDS),)
|
||||
ifneq ($(DEPENDS_UNTRUSTED_FAST_BUILDS),yes)
|
||||
ifneq ($(DEPENDS_UNTRUSTED_FAST_BUILDS),forced)
|
||||
$(error DEPENDS_UNTRUSTED_FAST_BUILDS must be empty, "yes", or "forced", got "$(DEPENDS_UNTRUSTED_FAST_BUILDS)")
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Detect the number of CPU cores
|
||||
ifeq ($(shell uname), Darwin)
|
||||
NUM_CORES := $(shell sysctl -n hw.ncpu)
|
||||
@@ -110,19 +121,34 @@ include builders/$(build_os).mk
|
||||
include builders/default.mk
|
||||
include packages/packages.mk
|
||||
|
||||
# Legacy build ID strings (kept for debugging info)
|
||||
build_id_string_legacy:=$(BUILD_ID_SALT)
|
||||
build_id_string_legacy+=$(shell $(build_CC) --version 2>/dev/null)
|
||||
build_id_string_legacy+=$(shell $(build_AR) --version 2>/dev/null)
|
||||
build_id_string_legacy+=$(shell $(build_CXX) --version 2>/dev/null)
|
||||
build_id_string_legacy+=$(shell $(build_RANLIB) --version 2>/dev/null)
|
||||
build_id_string_legacy+=$(shell $(build_STRIP) --version 2>/dev/null)
|
||||
|
||||
$(host_arch)_$(host_os)_id_string_legacy:=$(HOST_ID_SALT)
|
||||
$(host_arch)_$(host_os)_id_string_legacy+=$(shell $(host_CC) --version 2>/dev/null)
|
||||
$(host_arch)_$(host_os)_id_string_legacy+=$(shell $(host_AR) --version 2>/dev/null)
|
||||
$(host_arch)_$(host_os)_id_string_legacy+=$(shell $(host_CXX) --version 2>/dev/null)
|
||||
$(host_arch)_$(host_os)_id_string_legacy+=$(shell $(host_RANLIB) --version 2>/dev/null)
|
||||
$(host_arch)_$(host_os)_id_string_legacy+=$(shell $(host_STRIP) --version 2>/dev/null)
|
||||
|
||||
build_id_string:=$(BUILD_ID_SALT)
|
||||
build_id_string+=$(shell $(build_CC) --version 2>/dev/null)
|
||||
build_id_string+=$(shell $(build_AR) --version 2>/dev/null)
|
||||
build_id_string+=$(shell $(build_CXX) --version 2>/dev/null)
|
||||
build_id_string+=$(shell $(build_RANLIB) --version 2>/dev/null)
|
||||
build_id_string+=$(shell $(build_STRIP) --version 2>/dev/null)
|
||||
build_id_string+=$(shell basename $(build_CC) 2>/dev/null || echo "unknown")
|
||||
build_id_string+=$(shell basename $(build_AR) 2>/dev/null || echo "unknown")
|
||||
build_id_string+=$(shell basename $(build_CXX) 2>/dev/null || echo "unknown")
|
||||
build_id_string+=$(shell basename $(build_RANLIB) 2>/dev/null || echo "unknown")
|
||||
build_id_string+=$(shell basename $(build_STRIP) 2>/dev/null || echo "unknown")
|
||||
|
||||
$(host_arch)_$(host_os)_id_string:=$(HOST_ID_SALT)
|
||||
$(host_arch)_$(host_os)_id_string+=$(shell $(host_CC) --version 2>/dev/null)
|
||||
$(host_arch)_$(host_os)_id_string+=$(shell $(host_AR) --version 2>/dev/null)
|
||||
$(host_arch)_$(host_os)_id_string+=$(shell $(host_CXX) --version 2>/dev/null)
|
||||
$(host_arch)_$(host_os)_id_string+=$(shell $(host_RANLIB) --version 2>/dev/null)
|
||||
$(host_arch)_$(host_os)_id_string+=$(shell $(host_STRIP) --version 2>/dev/null)
|
||||
$(host_arch)_$(host_os)_id_string+=$(shell basename $(host_CC) 2>/dev/null || echo "unknown")
|
||||
$(host_arch)_$(host_os)_id_string+=$(shell basename $(host_AR) 2>/dev/null || echo "unknown")
|
||||
$(host_arch)_$(host_os)_id_string+=$(shell basename $(host_CXX) 2>/dev/null || echo "unknown")
|
||||
$(host_arch)_$(host_os)_id_string+=$(shell basename $(host_RANLIB) 2>/dev/null || echo "unknown")
|
||||
$(host_arch)_$(host_os)_id_string+=$(shell basename $(host_STRIP) 2>/dev/null || echo "unknown")
|
||||
|
||||
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages)
|
||||
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)
|
||||
@@ -204,8 +230,8 @@ $(host_prefix)/share/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_
|
||||
define check_or_remove_cached
|
||||
mkdir -p $(BASE_CACHE)/$(host)/$(package) && cd $(BASE_CACHE)/$(host)/$(package); \
|
||||
$(build_SHA256SUM) -c $($(package)_cached_checksum) >/dev/null 2>/dev/null || \
|
||||
( rm -f $($(package)_cached_checksum); \
|
||||
if test -f "$($(package)_cached)"; then echo "Checksum mismatch for $(package). Forcing rebuild.."; rm -f $($(package)_cached_checksum) $($(package)_cached); fi )
|
||||
( rm -f $($(package)_cached_checksum) $($(package)_cached_buildinfo); \
|
||||
if test -f "$($(package)_cached)"; then echo "Checksum mismatch for $(package). Forcing rebuild.."; rm -f $($(package)_cached_checksum) $($(package)_cached) $($(package)_cached_buildinfo); fi )
|
||||
endef
|
||||
|
||||
define check_or_remove_sources
|
||||
|
||||
+142
-12
@@ -36,7 +36,7 @@ define fetch_file
|
||||
endef
|
||||
|
||||
define int_get_build_recipe_hash
|
||||
$(eval $(1)_all_file_checksums:=$(shell $(build_SHA256SUM) $(meta_depends) packages/$(1).mk $(addprefix $(PATCHES_PATH)/$(1)/,$($(1)_patches)) | cut -d" " -f1))
|
||||
$(eval $(1)_all_file_checksums:=$(shell cd $(BASEDIR) && $(build_SHA256SUM) $(subst $(BASEDIR)/,,$(meta_depends)) packages/$(1).mk $(addprefix patches/$(1)/,$($(1)_patches)) 2>/dev/null | cut -d" " -f1))
|
||||
$(eval $(1)_recipe_hash:=$(shell echo -n "$($(1)_all_file_checksums)" | $(build_SHA256SUM) | cut -d" " -f1))
|
||||
endef
|
||||
|
||||
@@ -46,6 +46,8 @@ $(eval $(1)_all_dependencies:=$(call int_get_all_dependencies,$(1),$($($(1)_type
|
||||
$(foreach dep,$($(1)_all_dependencies),$(eval $(1)_build_id_deps+=$(dep)-$($(dep)_version)-$($(dep)_recipe_hash)))
|
||||
$(eval $(1)_build_id_long:=$(1)-$($(1)_version)-$($(1)_recipe_hash)-$(release_type) $($(1)_build_id_deps) $($($(1)_type)_id_string))
|
||||
$(eval $(1)_build_id:=$(shell echo -n "$($(1)_build_id_long)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH)))
|
||||
$(eval $(1)_build_id_long_legacy:=$(1)-$($(1)_version)-$($(1)_recipe_hash)-$(release_type) $($(1)_build_id_deps) $($($(1)_type)_id_string_legacy))
|
||||
$(eval $(1)_build_id_legacy:=$(shell echo -n "$($(1)_build_id_long_legacy)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH)))
|
||||
final_build_id_long+=$($(package)_build_id_long)
|
||||
|
||||
#compute package-specific paths
|
||||
@@ -59,10 +61,14 @@ $(1)_extract_dir:=$(base_build_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id
|
||||
$(1)_download_dir:=$(base_download_dir)/$(1)-$($(1)_version)
|
||||
$(1)_build_dir:=$$($(1)_extract_dir)/$$($(1)_build_subdir)
|
||||
$(1)_cached_checksum:=$(BASE_CACHE)/$(host)/$(1)/$(1)-$($(1)_version)-$($(1)_build_id).tar.gz.hash
|
||||
$(1)_cached_buildinfo:=$(BASE_CACHE)/$(host)/$(1)/$(1)-$($(1)_version)-$($(1)_build_id).tar.gz.txt
|
||||
$(1)_patch_dir:=$(base_build_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id)/.patches-$($(1)_build_id)
|
||||
$(1)_prefixbin:=$($($(1)_type)_prefix)/bin/
|
||||
$(1)_cached:=$(BASE_CACHE)/$(host)/$(1)/$(1)-$($(1)_version)-$($(1)_build_id).tar.gz
|
||||
$(1)_all_sources=$($(1)_file_name) $($(1)_extra_sources)
|
||||
$(1)_prebuilt_url:=$(PREBUILT_BASE_URL)/$(host)/$(1)/$(1)-$($(1)_version)-$($(1)_build_id).tar.gz
|
||||
$(1)_prebuilt_checksum_url:=$(PREBUILT_BASE_URL)/$(host)/$(1)/$(1)-$($(1)_version)-$($(1)_build_id).tar.gz.hash
|
||||
$(1)_prebuilt_buildinfo_url:=$(PREBUILT_BASE_URL)/$(host)/$(1)/$(1)-$($(1)_version)-$($(1)_build_id).tar.gz.txt
|
||||
|
||||
#stamps
|
||||
$(1)_fetched=$(SOURCES_PATH)/download-stamps/.stamp_fetched-$(1)-$($(1)_file_name).hash
|
||||
@@ -73,6 +79,8 @@ $(1)_built=$$($(1)_build_dir)/.stamp_built
|
||||
$(1)_configured=$$($(1)_build_dir)/.stamp_configured
|
||||
$(1)_staged=$$($(1)_staging_dir)/.stamp_staged
|
||||
$(1)_postprocessed=$$($(1)_staging_prefix_dir)/.stamp_postprocessed
|
||||
$(1)_prebuilt_downloaded:=$(BASE_CACHE)/$(host)/$(1)/.stamp_prebuilt_downloaded-$($(1)_build_id)
|
||||
$(1)_cached_or_prebuilt:=$(BASE_CACHE)/$(host)/$(1)/.stamp_cached_or_prebuilt-$($(1)_build_id)
|
||||
$(1)_download_path_fixed=$(subst :,\:,$$($(1)_download_path))
|
||||
|
||||
|
||||
@@ -198,61 +206,183 @@ COMPRESS_CMD := $(shell if command -v pigz >/dev/null 2>&1; then echo "pigz"; el
|
||||
|
||||
define int_add_cmds
|
||||
$($(1)_fetched):
|
||||
$(AT)echo "=== Fetching $(1) v$($(1)_version) ==="
|
||||
$(AT)echo " Source directory: $($(1)_source_dir)"
|
||||
$(AT)echo " Download file: $($(1)_download_file)"
|
||||
$(AT)mkdir -p $$(@D) $(SOURCES_PATH)
|
||||
$(AT)rm -f $$@
|
||||
$(AT)touch $$@
|
||||
$(AT)cd $$(@D); $(call $(1)_fetch_cmds,$(1))
|
||||
$(AT)cd $($(1)_source_dir); $(foreach source,$($(1)_all_sources),$(build_SHA256SUM) $(source) >> $$(@);)
|
||||
$(AT)echo " Fetch completed: $$@"
|
||||
$(AT)touch $$@
|
||||
$($(1)_extracted): | $($(1)_fetched)
|
||||
$(AT)echo Extracting $(1)...
|
||||
$(AT)echo "=== Extracting $(1) v$($(1)_version) ==="
|
||||
$(AT)echo " Build ID: $($(1)_build_id)"
|
||||
$(AT)echo " Extract directory: $($(1)_extract_dir)"
|
||||
$(AT)mkdir -p $$(@D)
|
||||
$(AT)cd $$(@D); $(call $(1)_extract_cmds,$(1))
|
||||
$(AT)echo " Extract completed: $$@"
|
||||
$(AT)touch $$@
|
||||
$($(1)_preprocessed): | $($(1)_dependencies) $($(1)_extracted)
|
||||
$(AT)echo Preprocessing $(1)...
|
||||
$(AT)echo "=== Preprocessing $(1) v$($(1)_version) ==="
|
||||
$(AT)echo " Dependencies: $($(1)_dependencies)"
|
||||
$(AT)echo " Patch directory: $($(1)_patch_dir)"
|
||||
$(AT)echo " Patches: $($(1)_patches)"
|
||||
$(AT)mkdir -p $$(@D) $($(1)_patch_dir)
|
||||
$(AT)$(foreach patch,$($(1)_patches),cd $(PATCHES_PATH)/$(1); cp $(patch) $($(1)_patch_dir) ;)
|
||||
$(AT)cd $$(@D); $(call $(1)_preprocess_cmds, $(1))
|
||||
$(AT)echo " Preprocessing completed: $$@"
|
||||
$(AT)touch $$@
|
||||
$($(1)_configured): | $($(1)_preprocessed)
|
||||
$(AT)echo Configuring $(1)...
|
||||
$(AT)echo "=== Configuring $(1) v$($(1)_version) ==="
|
||||
$(AT)echo " Build directory: $($(1)_build_dir)"
|
||||
$(AT)echo " Host prefix: $(host_prefix)"
|
||||
$(AT)echo " All dependencies: $($(1)_all_dependencies)"
|
||||
$(AT)rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar xf $($(package)_cached); )
|
||||
$(AT)mkdir -p $$(@D)
|
||||
$(AT)+cd $$(@D); $($(1)_config_env) $(call $(1)_config_cmds, $(1))
|
||||
$(AT)echo " Configuration completed: $$@"
|
||||
$(AT)touch $$@
|
||||
$($(1)_built): | $($(1)_configured)
|
||||
$(AT)echo Building $(1)...
|
||||
$(AT)echo "=== Building $(1) v$($(1)_version) ==="
|
||||
$(AT)echo " Build directory: $($(1)_build_dir)"
|
||||
$(AT)echo " Build environment: $($(1)_build_env)"
|
||||
$(AT)mkdir -p $$(@D)
|
||||
$(AT)+cd $$(@D); $($(1)_build_env) $(call $(1)_build_cmds, $(1))
|
||||
$(AT)echo " Build completed: $$@"
|
||||
$(AT)touch $$@
|
||||
$($(1)_staged): | $($(1)_built)
|
||||
$(AT)echo Staging $(1)...
|
||||
$(AT)echo "=== Staging $(1) v$($(1)_version) ==="
|
||||
$(AT)echo " Staging directory: $($(1)_staging_dir)"
|
||||
$(AT)echo " Staging prefix: $($(1)_staging_prefix_dir)"
|
||||
$(AT)mkdir -p $($(1)_staging_dir)/$(host_prefix)
|
||||
$(AT)cd $($(1)_build_dir); $($(1)_stage_env) $(call $(1)_stage_cmds, $(1))
|
||||
$(AT)echo " Removing extract directory: $($(1)_extract_dir)"
|
||||
$(AT)rm -rf $($(1)_extract_dir)
|
||||
$(AT)echo " Staging completed: $$@"
|
||||
$(AT)touch $$@
|
||||
$($(1)_postprocessed): | $($(1)_staged)
|
||||
$(AT)echo Postprocessing $(1)...
|
||||
$(AT)echo "=== Postprocessing $(1) v$($(1)_version) ==="
|
||||
$(AT)echo " Postprocessing directory: $($(1)_staging_prefix_dir)"
|
||||
$(AT)cd $($(1)_staging_prefix_dir); $(call $(1)_postprocess_cmds)
|
||||
$(AT)echo " Postprocessing completed: $$@"
|
||||
$(AT)touch $$@
|
||||
$($(1)_prebuilt_downloaded): | $($(1)_dependencies)
|
||||
$(AT)echo "=== Attempting to download prebuilt $(1) v$($(1)_version) ==="
|
||||
$(AT)echo " Build ID: $($(1)_build_id)"
|
||||
$(AT)echo " Download URL: $($(1)_prebuilt_url)"
|
||||
$(AT)mkdir -p $$(@D)
|
||||
$(AT)mkdir -p $(dir $($(1)_cached))
|
||||
$(AT)( \
|
||||
echo " Downloading $(1) prebuilt files..." && \
|
||||
$(build_DOWNLOAD) "$($(1)_cached).tmp" "$($(1)_prebuilt_url)" && \
|
||||
$(build_DOWNLOAD) "$($(1)_cached_checksum).tmp" "$($(1)_prebuilt_checksum_url)" && \
|
||||
$(build_DOWNLOAD) "$($(1)_cached_buildinfo).tmp" "$($(1)_prebuilt_buildinfo_url)" && \
|
||||
echo " Verifying checksum..." && \
|
||||
cd $(dir $($(1)_cached)) && \
|
||||
sed 's/$(notdir $($(1)_cached))/$(notdir $($(1)_cached)).tmp/' "$($(1)_cached_checksum).tmp" > "$($(1)_cached_checksum).tmp.verify" && \
|
||||
$(build_SHA256SUM) -c "$($(1)_cached_checksum).tmp.verify" && \
|
||||
rm -f "$($(1)_cached_checksum).tmp.verify" && \
|
||||
echo " Moving files to final location..." && \
|
||||
mv "$($(1)_cached).tmp" "$($(1)_cached)" && \
|
||||
mv "$($(1)_cached_checksum).tmp" "$($(1)_cached_checksum)" && \
|
||||
mv "$($(1)_cached_buildinfo).tmp" "$($(1)_cached_buildinfo)" && \
|
||||
echo " Prebuilt download completed: $$@" && \
|
||||
touch $$@ \
|
||||
) || ( \
|
||||
echo " Download failed for $(1)" && \
|
||||
rm -f "$($(1)_cached).tmp" "$($(1)_cached_checksum).tmp" "$($(1)_cached_buildinfo).tmp" && \
|
||||
if [ "$(DEPENDS_UNTRUSTED_FAST_BUILDS)" = "forced" ]; then \
|
||||
echo " Error: DEPENDS_UNTRUSTED_FAST_BUILDS=forced but prebuilt download failed" && \
|
||||
exit 1; \
|
||||
else \
|
||||
echo " Falling back to building from source..." && \
|
||||
exit 1; \
|
||||
fi \
|
||||
)
|
||||
$($(1)_cached): | $($(1)_dependencies) $($(1)_postprocessed)
|
||||
$(AT)echo Caching $(1)...
|
||||
$(AT)echo "=== Caching $(1) v$($(1)_version) ==="
|
||||
$(AT)echo " Build ID: $($(1)_build_id)"
|
||||
$(AT)echo " Cache file: $$@"
|
||||
$(AT)echo " Compression: $(COMPRESS_CMD)"
|
||||
$(AT)cd $$($(1)_staging_dir)/$(host_prefix); find . | sort | tar --no-recursion --use-compress-program='$(COMPRESS_CMD)' -cf $$($(1)_staging_dir)/$$(@F) -T -
|
||||
$(AT)mkdir -p $$(@D)
|
||||
$(AT)rm -rf $$(@D) && mkdir -p $$(@D)
|
||||
$(AT)mv $$($(1)_staging_dir)/$$(@F) $$(@)
|
||||
$(AT)echo " Removing staging directory: $($(1)_staging_dir)"
|
||||
$(AT)rm -rf $($(1)_staging_dir)
|
||||
$(AT)echo " Caching completed: $$@"
|
||||
$($(1)_cached_checksum): $($(1)_cached)
|
||||
$(AT)echo "=== Generating checksum for $(1) v$($(1)_version) ==="
|
||||
$(AT)echo " Checksum file: $$@"
|
||||
$(AT)cd $$(@D); $(build_SHA256SUM) $$(<F) > $$(@)
|
||||
$(AT)echo " Checksum completed: $$@"
|
||||
$(AT)echo "=== Generating build info for $(1) v$($(1)_version) ==="
|
||||
$(AT)echo " Build info file: $$($(1)_cached_buildinfo)"
|
||||
$(AT)echo "# Build Info for $(1) v$($(1)_version)" > $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "# Generated on: $$(shell date)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Package: $(1)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Version: $($(1)_version)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Host: $(host)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Release Type: $(release_type)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Build ID (current): $($(1)_build_id)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Build ID (legacy): $($(1)_build_id_legacy)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Build ID String (current): $($(1)_build_id_long)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Build ID String (legacy): $($(1)_build_id_long_legacy)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Dependencies: $($(1)_dependencies)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "All Dependencies: $($(1)_all_dependencies)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Recipe Hash: $($(1)_recipe_hash)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Recipe Files: $($(1)_all_file_checksums)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Toolchain (current): $($($(1)_type)_id_string)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Toolchain (legacy): $($($(1)_type)_id_string_legacy)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Build Tools (current):" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo " CC: $$(shell basename $($($(1)_type)_CC) 2>/dev/null || echo "unknown")" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo " CXX: $$(shell basename $($($(1)_type)_CXX) 2>/dev/null || echo "unknown")" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo " AR: $$(shell basename $($($(1)_type)_AR) 2>/dev/null || echo "unknown")" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo " RANLIB: $$(shell basename $($($(1)_type)_RANLIB) 2>/dev/null || echo "unknown")" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo " STRIP: $$(shell basename $($($(1)_type)_STRIP) 2>/dev/null || echo "unknown")" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Build Tools (legacy versions):" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo " CC: $$(shell $($($(1)_type)_CC) --version 2>/dev/null | head -1 || echo "unknown")" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo " CXX: $$(shell $($($(1)_type)_CXX) --version 2>/dev/null | head -1 || echo "unknown")" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo " AR: $$(shell $($($(1)_type)_AR) --version 2>/dev/null | head -1 || echo "unknown")" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo " RANLIB: $$(shell $($($(1)_type)_RANLIB) --version 2>/dev/null | head -1 || echo "unknown")" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo " STRIP: $$(shell $($($(1)_type)_STRIP) --version 2>/dev/null | head -1 || echo "unknown")" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo "Salt Values:" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo " BUILD_ID_SALT: $(BUILD_ID_SALT)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo " HOST_ID_SALT: $(HOST_ID_SALT)" >> $$($(1)_cached_buildinfo)
|
||||
$(AT)echo " Build info completed: $$($(1)_cached_buildinfo)"
|
||||
|
||||
$($(1)_cached_or_prebuilt):
|
||||
$(AT)mkdir -p $$(@D)
|
||||
$(AT)if [ "$(DEPENDS_UNTRUSTED_FAST_BUILDS)" = "yes" ]; then \
|
||||
echo "=== Trying prebuilt download for $(1) v$($(1)_version) ===" && \
|
||||
($(MAKE) -f $(BASEDIR)/Makefile $($(1)_prebuilt_downloaded) && touch $$@) || \
|
||||
(echo " Prebuilt download failed, falling back to building from source..." && \
|
||||
$(MAKE) -f $(BASEDIR)/Makefile $($(1)_cached_checksum) && touch $$@); \
|
||||
elif [ "$(DEPENDS_UNTRUSTED_FAST_BUILDS)" = "forced" ]; then \
|
||||
echo "=== Forced prebuilt download for $(1) v$($(1)_version) ===" && \
|
||||
$(MAKE) -f $(BASEDIR)/Makefile $($(1)_prebuilt_downloaded) && touch $$@; \
|
||||
else \
|
||||
echo "=== Building from source for $(1) v$($(1)_version) ===" && \
|
||||
$(MAKE) -f $(BASEDIR)/Makefile $($(1)_cached_checksum) && touch $$@; \
|
||||
fi
|
||||
|
||||
.PHONY: $(1)
|
||||
$(1): | $($(1)_cached_checksum)
|
||||
.SECONDARY: $($(1)_cached) $($(1)_postprocessed) $($(1)_staged) $($(1)_built) $($(1)_configured) $($(1)_preprocessed) $($(1)_extracted) $($(1)_fetched)
|
||||
$(1): | $($(1)_cached_or_prebuilt)
|
||||
.SECONDARY: $($(1)_cached) $($(1)_postprocessed) $($(1)_staged) $($(1)_built) $($(1)_configured) $($(1)_preprocessed) $($(1)_extracted) $($(1)_fetched) $($(1)_cached_buildinfo) $($(1)_prebuilt_downloaded) $($(1)_cached_or_prebuilt)
|
||||
|
||||
endef
|
||||
|
||||
stages = fetched extracted preprocessed configured built staged postprocessed cached cached_checksum
|
||||
stages = fetched extracted preprocessed configured built staged postprocessed cached cached_checksum prebuilt_downloaded
|
||||
|
||||
define ext_add_stages
|
||||
$(foreach stage,$(stages),
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package=android_ndk
|
||||
$(package)_version=26d
|
||||
$(package)_version=28c
|
||||
$(package)_download_path=https://dl.google.com/android/repository/
|
||||
$(package)_file_name=android-ndk-r$($(package)_version)-linux.zip
|
||||
$(package)_sha256_hash=eefeafe7ccf177de7cc57158da585e7af119bb7504a63604ad719e4b2a328b54
|
||||
$(package)_sha256_hash=dfb20d396df28ca02a8c708314b814a4d961dc9074f9a161932746f815aa552f
|
||||
|
||||
$(package)_version_apiversion=21
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ define $(package)_config_cmds
|
||||
mkdir buildb &&\
|
||||
cd builda &&\
|
||||
sh ../source/runConfigureICU Linux &&\
|
||||
make &&\
|
||||
TARGET= make &&\
|
||||
cd ../buildb &&\
|
||||
sh ../source/runConfigureICU MinGW --enable-static=yes --disable-shared --disable-layout --disable-layoutex --disable-tests --disable-samples --prefix=$(host_prefix) --with-cross-build=`pwd`/../builda &&\
|
||||
$(MAKE) -j$(NUM_CORES) $($(package)_build_opts)
|
||||
TARGET= $(MAKE) -j$(NUM_CORES) $($(package)_build_opts)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package=unbound
|
||||
$(package)_version=1.19.1
|
||||
$(package)_version=1.23.0
|
||||
$(package)_download_path=https://www.nlnetlabs.nl/downloads/$(package)/
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=bc1d576f3dd846a0739adc41ffaa702404c6767d2b6082deb9f2f97cbb24a3a9
|
||||
$(package)_sha256_hash=959bd5f3875316d7b3f67ee237a56de5565f5b35fc9b5fc3cea6cfe735a03bb8
|
||||
$(package)_dependencies=openssl expat
|
||||
$(package)_patches=disable-glibc-reallocarray.patch
|
||||
|
||||
|
||||
# ac_cv_type_pthread_spinlock_t -> disappeared in ndk r28
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-shared --enable-static --without-pyunbound --prefix=$(host_prefix)
|
||||
$(package)_config_opts+=--with-libexpat=$(host_prefix) --with-ssl=$(host_prefix) --with-libevent=no
|
||||
@@ -14,6 +14,7 @@ define $(package)_set_vars
|
||||
$(package)_config_opts_linux=--with-pic
|
||||
$(package)_config_opts_w64=--enable-static-exe --sysconfdir=/etc --prefix=$(host_prefix) --target=$(host_prefix)
|
||||
$(package)_config_opts_x86_64_darwin=ac_cv_func_SHA384_Init=yes
|
||||
$(package)_config_opts_android=ac_cv_type_pthread_spinlock_t=no
|
||||
$(package)_build_opts_mingw32=LDFLAGS="$($(package)_ldflags) -lpthread"
|
||||
$(package)_cflags_mingw32+="-D_WIN32_WINNT=0x600"
|
||||
endef
|
||||
@@ -24,7 +25,7 @@ define $(package)_preprocess_cmds
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf) ac_cv_func_getentropy=no
|
||||
$($(package)_autoconf) $($(package)_config_opts) ac_cv_func_getentropy=no
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
|
||||
@@ -69,6 +69,9 @@ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # Find programs on host
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # Find libs in target
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Find includes in target
|
||||
|
||||
add_definitions(-DHIDAPI_DUMMY=ON)
|
||||
set(HIDAPI_DUMMY ON)
|
||||
|
||||
# specify the cross compiler to be used. Darwin uses clang provided by the SDK.
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
if(ARCHITECTURE STREQUAL "aarch64")
|
||||
@@ -97,15 +100,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
SET(BUILD_64 ON)
|
||||
SET(BREW OFF)
|
||||
SET(PORT OFF)
|
||||
SET(CMAKE_OSX_SYSROOT "@prefix@/native/SDK/")
|
||||
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
|
||||
SET(CMAKE_CXX_STANDARD 14)
|
||||
SET(LLVM_ENABLE_PIC OFF)
|
||||
SET(LLVM_ENABLE_PIE OFF)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
add_definitions(-DUSE_DEVICE_TREZOR=OFF)
|
||||
add_definitions(-DHIDAPI_DUMMY=ON)
|
||||
set(HIDAPI_DUMMY ON)
|
||||
SET(ANDROID TRUE)
|
||||
if(ARCHITECTURE STREQUAL "armv7a")
|
||||
SET(CMAKE_ANDROID_ARCH_ABI "armeabi-v7a")
|
||||
@@ -132,8 +132,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
SET(CMAKE_CXX_COMPILER @CXX@)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
set(USE_DEVICE_TREZOR OFF)
|
||||
add_definitions(-DHIDAPI_DUMMY=ON)
|
||||
set(HIDAPI_DUMMY ON)
|
||||
add_definitions(-DUSE_DEVICE_LEDGER=ON)
|
||||
SET(CMAKE_C_COMPILER @CC@)
|
||||
SET(CMAKE_CXX_COMPILER @CXX@)
|
||||
|
||||
@@ -6,7 +6,7 @@ then
|
||||
function sha256sum() { shasum -a 256 "$@" ; } && export -f sha256sum
|
||||
fi
|
||||
|
||||
for coin in monero wownero zano;
|
||||
for coin in monero wownero zano salvium;
|
||||
do
|
||||
submodule_hash=$(git ls-tree HEAD ${coin} | xargs | awk '{ print $3 }')
|
||||
COIN=$(echo "$coin" | tr a-z A-Z)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
name: SalviumC
|
||||
description: monero_c salvium bindings
|
||||
output: 'lib/src/generated_bindings_salvium.g.dart'
|
||||
headers:
|
||||
entry-points:
|
||||
- '../../salvium_libwallet2_api_c/src/main/cpp/wallet2_api_c.h'
|
||||
|
||||
exclude-all-by-default: true
|
||||
functions:
|
||||
include:
|
||||
- "SALVIUM_.+"
|
||||
|
||||
compiler-opts:
|
||||
- '-I/usr/lib/llvm-14/lib/clang/14.0.6/include'
|
||||
- '-I/usr/local/include'
|
||||
- '-I/usr/include/x86_64-linux-gnu'
|
||||
- '-I/usr/include'
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
const String wallet2_api_c_h_sha256 = "9e80c4b59a0509aa02fbf01e8df2881b89f82225d1765bfa7856cbdbaf7af116";
|
||||
const String wallet2_api_c_cpp_sha256 = "d229507db508e574bd2badf4819a38dbead8c16a84311ad32c22c887a6003439-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe";
|
||||
const String wallet2_api_c_exp_sha256 = "d0f95f1f3bc49f1f59fe4eb0b61826128d7d3bb75405d5a01a252d02db03097d";
|
||||
const String wallet2_api_c_h_sha256 = "3515e4c9e537ca3efa664f0b364a3aeb106ff64337f542a262ce104c00b31235";
|
||||
const String wallet2_api_c_cpp_sha256 = "ca44a8d4a201ba6dc0a25c857e95d07bc8d514039b38cd5b3826100e8943cbcc-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe";
|
||||
const String wallet2_api_c_exp_sha256 = "0561e14606106e6b0ec49fb2aefe743ff500f7c3de07557f7041e06aef9509ce";
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
const String wallet2_api_c_h_sha256 = "93ad4f6247f0b89c17218766c960e956047b0e8032c3db2b791842d576279330";
|
||||
const String wallet2_api_c_cpp_sha256 = "2d52bbe50a6db8c1bd68ce4be288c28319f35f48c6d093a3d67d888c8e4b3230-45404ecc719b916c217938f9e82ad352a4068d12";
|
||||
const String wallet2_api_c_exp_sha256 = "f7ab584f1271f4d533980f403597a1d9e50bced85c233ca2b17c77f4a94ed3bc";
|
||||
@@ -4351,120 +4351,83 @@ class MoneroC {
|
||||
late final _MONERO_Wallet_getBytesSent = _MONERO_Wallet_getBytesSentPtr
|
||||
.asFunction<int Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
bool MONERO_Wallet_getStateIsConnected(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
return _MONERO_Wallet_getStateIsConnected(
|
||||
wallet_ptr,
|
||||
);
|
||||
bool MONERO_Wallet_getStateIsConnected() {
|
||||
return _MONERO_Wallet_getStateIsConnected();
|
||||
}
|
||||
|
||||
late final _MONERO_Wallet_getStateIsConnectedPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Bool Function(ffi.Pointer<ffi.Void>)>>(
|
||||
_lookup<ffi.NativeFunction<ffi.Bool Function()>>(
|
||||
'MONERO_Wallet_getStateIsConnected');
|
||||
late final _MONERO_Wallet_getStateIsConnected =
|
||||
_MONERO_Wallet_getStateIsConnectedPtr.asFunction<
|
||||
bool Function(ffi.Pointer<ffi.Void>)>();
|
||||
_MONERO_Wallet_getStateIsConnectedPtr.asFunction<bool Function()>();
|
||||
|
||||
ffi.Pointer<ffi.UnsignedChar> MONERO_Wallet_getSendToDevice(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
return _MONERO_Wallet_getSendToDevice(
|
||||
wallet_ptr,
|
||||
);
|
||||
ffi.Pointer<ffi.UnsignedChar> MONERO_Wallet_getSendToDevice() {
|
||||
return _MONERO_Wallet_getSendToDevice();
|
||||
}
|
||||
|
||||
late final _MONERO_Wallet_getSendToDevicePtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.UnsignedChar> Function(
|
||||
ffi.Pointer<ffi.Void>)>>('MONERO_Wallet_getSendToDevice');
|
||||
late final _MONERO_Wallet_getSendToDevice =
|
||||
_MONERO_Wallet_getSendToDevicePtr.asFunction<
|
||||
ffi.Pointer<ffi.UnsignedChar> Function(ffi.Pointer<ffi.Void>)>();
|
||||
late final _MONERO_Wallet_getSendToDevicePtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.UnsignedChar> Function()>>(
|
||||
'MONERO_Wallet_getSendToDevice');
|
||||
late final _MONERO_Wallet_getSendToDevice = _MONERO_Wallet_getSendToDevicePtr
|
||||
.asFunction<ffi.Pointer<ffi.UnsignedChar> Function()>();
|
||||
|
||||
int MONERO_Wallet_getSendToDeviceLength(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
return _MONERO_Wallet_getSendToDeviceLength(
|
||||
wallet_ptr,
|
||||
);
|
||||
int MONERO_Wallet_getSendToDeviceLength() {
|
||||
return _MONERO_Wallet_getSendToDeviceLength();
|
||||
}
|
||||
|
||||
late final _MONERO_Wallet_getSendToDeviceLengthPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Size Function(ffi.Pointer<ffi.Void>)>>(
|
||||
_lookup<ffi.NativeFunction<ffi.Size Function()>>(
|
||||
'MONERO_Wallet_getSendToDeviceLength');
|
||||
late final _MONERO_Wallet_getSendToDeviceLength =
|
||||
_MONERO_Wallet_getSendToDeviceLengthPtr.asFunction<
|
||||
int Function(ffi.Pointer<ffi.Void>)>();
|
||||
_MONERO_Wallet_getSendToDeviceLengthPtr.asFunction<int Function()>();
|
||||
|
||||
ffi.Pointer<ffi.UnsignedChar> MONERO_Wallet_getReceivedFromDevice(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
return _MONERO_Wallet_getReceivedFromDevice(
|
||||
wallet_ptr,
|
||||
);
|
||||
ffi.Pointer<ffi.UnsignedChar> MONERO_Wallet_getReceivedFromDevice() {
|
||||
return _MONERO_Wallet_getReceivedFromDevice();
|
||||
}
|
||||
|
||||
late final _MONERO_Wallet_getReceivedFromDevicePtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.UnsignedChar> Function(
|
||||
ffi.Pointer<ffi.Void>)>>('MONERO_Wallet_getReceivedFromDevice');
|
||||
late final _MONERO_Wallet_getReceivedFromDevicePtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.UnsignedChar> Function()>>(
|
||||
'MONERO_Wallet_getReceivedFromDevice');
|
||||
late final _MONERO_Wallet_getReceivedFromDevice =
|
||||
_MONERO_Wallet_getReceivedFromDevicePtr.asFunction<
|
||||
ffi.Pointer<ffi.UnsignedChar> Function(ffi.Pointer<ffi.Void>)>();
|
||||
ffi.Pointer<ffi.UnsignedChar> Function()>();
|
||||
|
||||
int MONERO_Wallet_getReceivedFromDeviceLength(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
return _MONERO_Wallet_getReceivedFromDeviceLength(
|
||||
wallet_ptr,
|
||||
);
|
||||
int MONERO_Wallet_getReceivedFromDeviceLength() {
|
||||
return _MONERO_Wallet_getReceivedFromDeviceLength();
|
||||
}
|
||||
|
||||
late final _MONERO_Wallet_getReceivedFromDeviceLengthPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Size Function(ffi.Pointer<ffi.Void>)>>(
|
||||
_lookup<ffi.NativeFunction<ffi.Size Function()>>(
|
||||
'MONERO_Wallet_getReceivedFromDeviceLength');
|
||||
late final _MONERO_Wallet_getReceivedFromDeviceLength =
|
||||
_MONERO_Wallet_getReceivedFromDeviceLengthPtr.asFunction<
|
||||
int Function(ffi.Pointer<ffi.Void>)>();
|
||||
int Function()>();
|
||||
|
||||
bool MONERO_Wallet_getWaitsForDeviceSend(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
return _MONERO_Wallet_getWaitsForDeviceSend(
|
||||
wallet_ptr,
|
||||
);
|
||||
bool MONERO_Wallet_getWaitsForDeviceSend() {
|
||||
return _MONERO_Wallet_getWaitsForDeviceSend();
|
||||
}
|
||||
|
||||
late final _MONERO_Wallet_getWaitsForDeviceSendPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Bool Function(ffi.Pointer<ffi.Void>)>>(
|
||||
_lookup<ffi.NativeFunction<ffi.Bool Function()>>(
|
||||
'MONERO_Wallet_getWaitsForDeviceSend');
|
||||
late final _MONERO_Wallet_getWaitsForDeviceSend =
|
||||
_MONERO_Wallet_getWaitsForDeviceSendPtr.asFunction<
|
||||
bool Function(ffi.Pointer<ffi.Void>)>();
|
||||
_MONERO_Wallet_getWaitsForDeviceSendPtr.asFunction<bool Function()>();
|
||||
|
||||
bool MONERO_Wallet_getWaitsForDeviceReceive(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
return _MONERO_Wallet_getWaitsForDeviceReceive(
|
||||
wallet_ptr,
|
||||
);
|
||||
bool MONERO_Wallet_getWaitsForDeviceReceive() {
|
||||
return _MONERO_Wallet_getWaitsForDeviceReceive();
|
||||
}
|
||||
|
||||
late final _MONERO_Wallet_getWaitsForDeviceReceivePtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Bool Function(ffi.Pointer<ffi.Void>)>>(
|
||||
_lookup<ffi.NativeFunction<ffi.Bool Function()>>(
|
||||
'MONERO_Wallet_getWaitsForDeviceReceive');
|
||||
late final _MONERO_Wallet_getWaitsForDeviceReceive =
|
||||
_MONERO_Wallet_getWaitsForDeviceReceivePtr.asFunction<
|
||||
bool Function(ffi.Pointer<ffi.Void>)>();
|
||||
_MONERO_Wallet_getWaitsForDeviceReceivePtr.asFunction<bool Function()>();
|
||||
|
||||
void MONERO_Wallet_setDeviceReceivedData(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
ffi.Pointer<ffi.UnsignedChar> data,
|
||||
int len,
|
||||
) {
|
||||
return _MONERO_Wallet_setDeviceReceivedData(
|
||||
wallet_ptr,
|
||||
data,
|
||||
len,
|
||||
);
|
||||
@@ -4472,22 +4435,17 @@ class MoneroC {
|
||||
|
||||
late final _MONERO_Wallet_setDeviceReceivedDataPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
ffi.Pointer<ffi.UnsignedChar>,
|
||||
ffi.Void Function(ffi.Pointer<ffi.UnsignedChar>,
|
||||
ffi.Size)>>('MONERO_Wallet_setDeviceReceivedData');
|
||||
late final _MONERO_Wallet_setDeviceReceivedData =
|
||||
_MONERO_Wallet_setDeviceReceivedDataPtr.asFunction<
|
||||
void Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.UnsignedChar>, int)>();
|
||||
void Function(ffi.Pointer<ffi.UnsignedChar>, int)>();
|
||||
|
||||
void MONERO_Wallet_setDeviceSendData(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
ffi.Pointer<ffi.UnsignedChar> data,
|
||||
int len,
|
||||
) {
|
||||
return _MONERO_Wallet_setDeviceSendData(
|
||||
wallet_ptr,
|
||||
data,
|
||||
len,
|
||||
);
|
||||
@@ -4495,14 +4453,56 @@ class MoneroC {
|
||||
|
||||
late final _MONERO_Wallet_setDeviceSendDataPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
ffi.Pointer<ffi.UnsignedChar>,
|
||||
ffi.Void Function(ffi.Pointer<ffi.UnsignedChar>,
|
||||
ffi.Size)>>('MONERO_Wallet_setDeviceSendData');
|
||||
late final _MONERO_Wallet_setDeviceSendData =
|
||||
_MONERO_Wallet_setDeviceSendDataPtr.asFunction<
|
||||
void Function(ffi.Pointer<ffi.UnsignedChar>, int)>();
|
||||
|
||||
void MONERO_Wallet_setLedgerCallback(
|
||||
ffi.Pointer<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(ffi.Pointer<ffi.UnsignedChar> command,
|
||||
ffi.UnsignedInt cmd_len)>>
|
||||
sendToLedgerDevice,
|
||||
) {
|
||||
return _MONERO_Wallet_setLedgerCallback(
|
||||
sendToLedgerDevice,
|
||||
);
|
||||
}
|
||||
|
||||
late final _MONERO_Wallet_setLedgerCallbackPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<ffi.UnsignedChar> command,
|
||||
ffi.UnsignedInt cmd_len)>>)>>(
|
||||
'MONERO_Wallet_setLedgerCallback');
|
||||
late final _MONERO_Wallet_setLedgerCallback =
|
||||
_MONERO_Wallet_setLedgerCallbackPtr.asFunction<
|
||||
void Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.UnsignedChar>, int)>();
|
||||
ffi.Pointer<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(ffi.Pointer<ffi.UnsignedChar> command,
|
||||
ffi.UnsignedInt cmd_len)>>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> MONERO_Wallet_serializeCacheToJson(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
return _MONERO_Wallet_serializeCacheToJson(
|
||||
wallet_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _MONERO_Wallet_serializeCacheToJsonPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Void>)>>('MONERO_Wallet_serializeCacheToJson');
|
||||
late final _MONERO_Wallet_serializeCacheToJson =
|
||||
_MONERO_Wallet_serializeCacheToJsonPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
ffi.Pointer<ffi.Void> MONERO_WalletManager_createWallet(
|
||||
ffi.Pointer<ffi.Void> wm_ptr,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,406 @@
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
|
||||
import 'dart:ffi';
|
||||
import 'dart:io';
|
||||
abstract class Wallet2 {
|
||||
Wallet2WalletManagerFactory walletManagerFactory();
|
||||
|
||||
static String get libPath {
|
||||
if (Platform.isWindows) return 'unknown_libwallet2_api_c.dll';
|
||||
if (Platform.isMacOS) return 'unknown_libwallet2_api_c.dylib';
|
||||
if (Platform.isIOS) return 'UnknownWallet.framework/UnknownWallet';
|
||||
if (Platform.isAndroid) return 'libunknown_libwallet2_api_c.so';
|
||||
return 'unknown_libwallet2_api_c.so';
|
||||
}
|
||||
static set libPath(String path) {
|
||||
throw Exception('libPath is read-only, as isolates cannot be made aware of changes to this variable');
|
||||
}
|
||||
|
||||
int ffiAddress();
|
||||
}
|
||||
|
||||
abstract class Wallet2AddressBook {
|
||||
int ffiAddress();
|
||||
|
||||
int getAll_size();
|
||||
Wallet2AddressBookRow getAll_byIndex(int index);
|
||||
bool addRow({required String dstAddr, required String paymentId, required String description, });
|
||||
bool deleteRow({required int rowId});
|
||||
bool setDescription({required int rowId, required String description, });
|
||||
void refresh();
|
||||
int errorCode();
|
||||
int lookupPaymentID({required String paymentId});
|
||||
}
|
||||
|
||||
abstract class Wallet2AddressBookRow {
|
||||
int ffiAddress();
|
||||
|
||||
String extra();
|
||||
String getAddress();
|
||||
String getDescription();
|
||||
String getPaymentId();
|
||||
int getRowId();
|
||||
}
|
||||
|
||||
abstract class Wallet2Coins {
|
||||
int ffiAddress();
|
||||
|
||||
int count();
|
||||
Wallet2CoinsInfo coin(int index);
|
||||
int getAll_size();
|
||||
Wallet2CoinsInfo getAll_byIndex(int index);
|
||||
void refresh();
|
||||
void setFrozenByPublicKey({required String publicKey});
|
||||
void setFrozen({required int index});
|
||||
void thaw({required int index});
|
||||
void thawByPublicKey({required String publicKey});
|
||||
bool isTransferUnlocked({required int unlockTime, required int blockHeight});
|
||||
}
|
||||
|
||||
abstract class Wallet2CoinsInfo {
|
||||
int ffiAddress();
|
||||
|
||||
int blockHeight();
|
||||
String hash();
|
||||
int internalOutputIndex();
|
||||
int globalOutputIndex();
|
||||
bool spent();
|
||||
bool frozen();
|
||||
int spentHeight();
|
||||
int amount();
|
||||
bool rct();
|
||||
bool keyImageKnown();
|
||||
int pkIndex();
|
||||
int subaddrIndex();
|
||||
int subaddrAccount();
|
||||
String address();
|
||||
String addressLabel();
|
||||
String keyImage();
|
||||
int unlockTime();
|
||||
bool unlocked();
|
||||
String pubKey();
|
||||
bool coinbase();
|
||||
String description();
|
||||
}
|
||||
|
||||
abstract class Wallet2DeviceProgress {
|
||||
int ffiAddress();
|
||||
|
||||
bool progress();
|
||||
bool indeterminate();
|
||||
}
|
||||
|
||||
abstract class Wallet2WalletListener {
|
||||
int ffiAddress();
|
||||
|
||||
void resetNeedToRefresh();
|
||||
bool isNeedToRefresh();
|
||||
bool isNewTransactionExist();
|
||||
void resetIsNewTransactionExist();
|
||||
int height();
|
||||
}
|
||||
|
||||
abstract class Wallet2Checksum {
|
||||
int ffiAddress();
|
||||
|
||||
String checksum_wallet2_api_c_h();
|
||||
String checksum_wallet2_api_c_cpp();
|
||||
String checksum_wallet2_api_c_exp();
|
||||
}
|
||||
|
||||
abstract class Wallet2Free {
|
||||
int ffiAddress();
|
||||
|
||||
void free(Pointer<Void> wlptr);
|
||||
}
|
||||
|
||||
abstract class Wallet2MultisigState {
|
||||
int ffiAddress();
|
||||
|
||||
bool isMultisig(Pointer<Void> ptr);
|
||||
bool isReady(Pointer<Void> ptr);
|
||||
int threshold(Pointer<Void> ptr);
|
||||
int total(Pointer<Void> ptr);
|
||||
}
|
||||
|
||||
abstract class Wallet2PendingTransaction {
|
||||
int ffiAddress();
|
||||
|
||||
int status();
|
||||
String errorString();
|
||||
bool commit({required String filename, required bool overwrite});
|
||||
String commitUR(int max_fragment_length);
|
||||
int amount();
|
||||
int dust();
|
||||
int fee();
|
||||
String txid(String separator);
|
||||
int txCount();
|
||||
String subaddrAccount(String separator);
|
||||
String subaddrIndices(String separator);
|
||||
String multisigSignData();
|
||||
void signMultisigTx();
|
||||
String signersKeys(String separator);
|
||||
String hex(String separator);
|
||||
}
|
||||
|
||||
abstract class Wallet2Subaddress {
|
||||
int ffiAddress();
|
||||
|
||||
int getAll_size();
|
||||
Wallet2SubaddressRow getAll_byIndex(int index);
|
||||
void addRow({required int accountIndex, required String label});
|
||||
void setLabel({required int accountIndex, required int addressIndex, required String label});
|
||||
void refresh({required int accountIndex, required String label});
|
||||
}
|
||||
|
||||
abstract class Wallet2SubaddressAccount {
|
||||
int ffiAddress();
|
||||
|
||||
int getAll_size();
|
||||
Wallet2SubaddressAccountRow getAll_byIndex(int index);
|
||||
void addRow({required String label});
|
||||
void setLabel({required int accountIndex, required String label});
|
||||
void refresh();
|
||||
}
|
||||
|
||||
abstract class Wallet2SubaddressAccountRow {
|
||||
int ffiAddress();
|
||||
|
||||
String extra();
|
||||
String getAddress();
|
||||
String getLabel();
|
||||
String getBalance();
|
||||
String getUnlockedBalance();
|
||||
int getRowId();
|
||||
}
|
||||
|
||||
abstract class Wallet2SubaddressRow {
|
||||
int ffiAddress();
|
||||
|
||||
String extra();
|
||||
String getAddress();
|
||||
String getLabel();
|
||||
int getRowId();
|
||||
}
|
||||
|
||||
abstract class Wallet2TransactionHistory {
|
||||
int ffiAddress();
|
||||
|
||||
int count();
|
||||
Wallet2TransactionInfo transaction(int index);
|
||||
Wallet2TransactionInfo transactionById(String txid);
|
||||
void refresh();
|
||||
void setTxNote({required String txid, required String note});
|
||||
}
|
||||
|
||||
abstract class Wallet2TransactionInfo {
|
||||
int ffiAddress();
|
||||
|
||||
int direction();
|
||||
bool isPending();
|
||||
bool isFailed();
|
||||
bool isCoinbase();
|
||||
int amount();
|
||||
int fee();
|
||||
int blockHeight();
|
||||
String description();
|
||||
String subaddrIndex();
|
||||
int subaddrAccount();
|
||||
String label();
|
||||
int confirmations();
|
||||
int unlockTime();
|
||||
String hash();
|
||||
int timestamp();
|
||||
String paymentId();
|
||||
int transfers_count();
|
||||
int transfers_amount(int index);
|
||||
String transfers_address(int index);
|
||||
}
|
||||
|
||||
abstract class Wallet2UnsignedTransaction {
|
||||
int ffiAddress();
|
||||
|
||||
int status();
|
||||
String errorString();
|
||||
String amount();
|
||||
String fee();
|
||||
String mixin();
|
||||
String confirmationMessage();
|
||||
String paymentId();
|
||||
String recipientAddress();
|
||||
int minMixinCount();
|
||||
int txCount();
|
||||
bool sign(String signedFileName);
|
||||
String signUR(int max_fragment_length);
|
||||
}
|
||||
|
||||
abstract class Wallet2Wallet {
|
||||
int ffiAddress();
|
||||
|
||||
String seed({required String seedOffset});
|
||||
String getSeedLanguage();
|
||||
void setSeedLanguage({required String language});
|
||||
int status();
|
||||
String errorString();
|
||||
bool setPassword({required String password});
|
||||
String getPassword();
|
||||
bool setDevicePin({required String passphrase});
|
||||
String address({int accountIndex = 0, int addressIndex = 0});
|
||||
String path();
|
||||
int nettype();
|
||||
int useForkRules({required int version, required int earlyBlocks, });
|
||||
String integratedAddress({required String paymentId});
|
||||
String secretViewKey();
|
||||
String publicViewKey();
|
||||
String secretSpendKey();
|
||||
String publicSpendKey();
|
||||
String publicMultisigSignerKey();
|
||||
void stop();
|
||||
bool store({String path = ""});
|
||||
String filename();
|
||||
String keysFilename();
|
||||
bool init({ required String daemonAddress, int upperTransacationSizeLimit = 0, String daemonUsername = "", String daemonPassword = "", bool useSsl = false, bool lightWallet = false, String proxyAddress = "", });
|
||||
bool createWatchOnly({ required String path, required String password, required String language, });
|
||||
void setRefreshFromBlockHeight({required int refresh_from_block_height});
|
||||
int getRefreshFromBlockHeight();
|
||||
void setRecoveringFromSeed({required bool recoveringFromSeed});
|
||||
void setRecoveringFromDevice({required bool recoveringFromDevice});
|
||||
void setSubaddressLookahead({required int major, required int minor});
|
||||
bool connectToDaemon();
|
||||
int connected();
|
||||
void setTrustedDaemon({required bool arg});
|
||||
bool trustedDaemon();
|
||||
void setProxy({required String address});
|
||||
int balance({required int accountIndex});
|
||||
int unlockedBalance({required int accountIndex});
|
||||
int viewOnlyBalance({required int accountIndex});
|
||||
bool watchOnly();
|
||||
int blockChainHeight();
|
||||
int approximateBlockChainHeight();
|
||||
int estimateBlockChainHeight();
|
||||
int daemonBlockChainHeight();
|
||||
bool synchronized();
|
||||
String displayAmount(int amount);
|
||||
int amountFromString(String amount);
|
||||
int amountFromDouble(double amount);
|
||||
String genPaymentId();
|
||||
bool paymentIdValid(String paymentId);
|
||||
bool addressValid(String address, int networkType);
|
||||
bool keyValid({required String secret_key_string, required String address_string, required bool isViewKey, required int nettype});
|
||||
String keyValid_error({required String secret_key_string, required String address_string, required bool isViewKey, required int nettype});
|
||||
String paymentIdFromAddress({required String strarg, required int nettype});
|
||||
int maximumAllowedAmount();
|
||||
void init3({ required String argv0, required String defaultLogBaseName, required String logPath, required bool console, });
|
||||
String getPolyseed({required String passphrase});
|
||||
String createPolyseed({ String language = "English", });
|
||||
void startRefresh();
|
||||
void pauseRefresh();
|
||||
bool refresh();
|
||||
void refreshAsync();
|
||||
bool rescanBlockchain();
|
||||
void rescanBlockchainAsync();
|
||||
void setAutoRefreshInterval({required int millis});
|
||||
int autoRefreshInterval();
|
||||
void addSubaddress({required int accountIndex, String label = ""});
|
||||
void addSubaddressAccount({String label = ""});
|
||||
int numSubaddressAccounts();
|
||||
int numSubaddresses({required int accountIndex});
|
||||
String getSubaddressLabel({required int accountIndex, required int addressIndex});
|
||||
void setSubaddressLabel({required int accountIndex, required int addressIndex, required String label});
|
||||
Wallet2MultisigState multisig();
|
||||
String getMultisigInfo();
|
||||
String makeMultisig({ required List<String> info, required int threshold, });
|
||||
String exchangeMultisigKeys({ required List<String> info, required bool force_update_use_with_caution, });
|
||||
List<String> exportMultisigImages({ required List<String> info, });
|
||||
int importMultisigImages({ required List<String> info, });
|
||||
int hasMultisigPartialKeyImages();
|
||||
Wallet2PendingTransaction restoreMultisigTransaction({ required String signData, });
|
||||
Wallet2PendingTransaction createTransactionMultDest({ required List<String> dstAddr, String paymentId = "", required bool isSweepAll, required List<int> amounts, required int mixinCount, required int pendingTransactionPriority, required int subaddr_account, List<String> preferredInputs = const [], });
|
||||
Wallet2PendingTransaction createTransaction({required String dst_addr, required String payment_id, required int amount, required int mixin_count, required int pendingTransactionPriority, required int subaddr_account, List<String> preferredInputs = const [],});
|
||||
Wallet2UnsignedTransaction loadUnsignedTx({required String unsigned_filename});
|
||||
Wallet2UnsignedTransaction loadUnsignedTxUR({required String input});
|
||||
bool submitTransaction(String filename);
|
||||
bool submitTransactionUR(String input);
|
||||
bool hasUnknownKeyImages();
|
||||
bool exportKeyImages(String filename, {required bool all});
|
||||
String exportKeyImagesUR({ int max_fragment_length = 130, bool all = false, });
|
||||
bool importKeyImages(String filename);
|
||||
bool importKeyImagesUR(String input);
|
||||
bool exportOutputs(String filename, {required bool all});
|
||||
String exportOutputsUR({ int max_fragment_length = 130, bool all = false, });
|
||||
bool importOutputs(String filename);
|
||||
bool importOutputsUR(String input);
|
||||
bool setupBackgroundSync({ required int backgroundSyncType, required String walletPassword, required String backgroundCachePassword, });
|
||||
int getBackgroundSyncType();
|
||||
bool startBackgroundSync();
|
||||
bool stopBackgroundSync(String walletPassword);
|
||||
bool isBackgroundSyncing();
|
||||
bool isBackgroundWallet();
|
||||
Wallet2TransactionHistory history();
|
||||
Wallet2AddressBook addressBook();
|
||||
Wallet2Coins coins();
|
||||
Wallet2Subaddress subaddress();
|
||||
Wallet2SubaddressAccount subaddressAccount();
|
||||
int defaultMixin();
|
||||
void setDefaultMixin(int arg);
|
||||
bool setCacheAttribute({required String key, required String value});
|
||||
String getCacheAttribute({required String key});
|
||||
bool setUserNote({required String txid, required String note});
|
||||
String getUserNote({required String txid});
|
||||
String getTxKey({required String txid});
|
||||
String signMessage({ required String message, required String address, });
|
||||
bool verifySignedMessage({ required String message, required String address, required String signature, });
|
||||
bool rescanSpent();
|
||||
void setOffline({required bool offline});
|
||||
bool isOffline();
|
||||
void segregatePreForkOutputs({required bool segregate});
|
||||
void segregationHeight({required int height});
|
||||
void keyReuseMitigation2({required bool mitigation});
|
||||
bool lockKeysFile();
|
||||
bool unlockKeysFile();
|
||||
bool isKeysFileLocked();
|
||||
int getDeviceType();
|
||||
int coldKeyImageSync({required int spent, required int unspent});
|
||||
String deviceShowAddress({required int accountIndex, required int addressIndex});
|
||||
bool reconnectDevice();
|
||||
int getBytesReceived();
|
||||
int getBytesSent();
|
||||
Wallet2WalletListener getWalletListener();
|
||||
}
|
||||
|
||||
abstract class Wallet2WalletManager {
|
||||
int ffiAddress();
|
||||
|
||||
Wallet2Wallet createWallet({ required String path, required String password, String language = "English", int networkType = 0, });
|
||||
Wallet2Wallet openWallet({ required String path, required String password, int networkType = 0, });
|
||||
void closeWallet(Wallet2Wallet wallet, bool store);
|
||||
Wallet2Wallet recoveryWallet({ required String path, required String password, required String mnemonic, int networkType = 0, required int restoreHeight, int kdfRounds = 0, required String seedOffset, });
|
||||
Wallet2Wallet createWalletFromKeys({ required String path, required String password, String language = "English", int nettype = 1, required int restoreHeight, required String addressString, required String viewKeyString, required String spendKeyString, int kdf_rounds = 1, });
|
||||
Wallet2Wallet createDeterministicWalletFromSpendKey({ required String path, required String password, String language = "English", int networkType = 0, required String spendKeyString, required bool newWallet, required int restoreHeight, int kdfRounds = 1, });
|
||||
Wallet2Wallet createWalletFromDevice({ required String path, required String password, int networkType = 0, required String deviceName, int restoreHeight = 0, String subaddressLookahead = "", int kdfRounds = 1, });
|
||||
Wallet2Wallet createWalletFromPolyseed({ required String path, required String password, int networkType = 0, required String mnemonic, required String seedOffset, required bool newWallet, required int restoreHeight, required int kdfRounds, });
|
||||
bool walletExists(String path);
|
||||
bool verifyWalletPassword({ required String keysFileName, required String password, required bool noSpendKey, required int kdfRounds, });
|
||||
int queryWalletDevice({ required String keysFileName, required String password, required int kdfRounds, });
|
||||
List<String> findWallets({required String path});
|
||||
String errorString();
|
||||
void setDaemonAddress(String address);
|
||||
Future<int> blockchainHeight();
|
||||
Future<int> blockchainTargetHeight();
|
||||
int networkDifficulty();
|
||||
double miningHashRate();
|
||||
Future<int> blockTarget();
|
||||
bool isMining();
|
||||
bool startMining({ required String address, required int threads, required bool backgroundMining, required bool ignoreBattery, });
|
||||
bool stopMining(String address);
|
||||
String resolveOpenAlias({ required String address, required bool dnssecValid, });
|
||||
bool setProxy(String address);
|
||||
}
|
||||
|
||||
abstract class Wallet2WalletManagerFactory {
|
||||
int ffiAddress();
|
||||
|
||||
void setLogLevel(int level);
|
||||
void setLogCategories(String categories);
|
||||
Wallet2WalletManager getWalletManager();
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,4 +12,4 @@ dependencies:
|
||||
dev_dependencies:
|
||||
lints: ^5.0.0
|
||||
test: ^1.24.0
|
||||
ffigen: ^14.0.0
|
||||
ffigen: ^18.0.0
|
||||
|
||||
@@ -7,3 +7,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
|
||||
dart run ffigen --config ffigen_salvium.yaml
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const moneroChecksum = {
|
||||
wallet2_api_c_h_sha256: "9e80c4b59a0509aa02fbf01e8df2881b89f82225d1765bfa7856cbdbaf7af116",
|
||||
wallet2_api_c_cpp_sha256: "d229507db508e574bd2badf4819a38dbead8c16a84311ad32c22c887a6003439-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe",
|
||||
wallet2_api_c_exp_sha256: "d0f95f1f3bc49f1f59fe4eb0b61826128d7d3bb75405d5a01a252d02db03097d",
|
||||
wallet2_api_c_h_sha256: "3515e4c9e537ca3efa664f0b364a3aeb106ff64337f542a262ce104c00b31235",
|
||||
wallet2_api_c_cpp_sha256: "ca44a8d4a201ba6dc0a25c857e95d07bc8d514039b38cd5b3826100e8943cbcc-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe",
|
||||
wallet2_api_c_exp_sha256: "0561e14606106e6b0ec49fb2aefe743ff500f7c3de07557f7041e06aef9509ce",
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export const salviumChecksum = {
|
||||
wallet2_api_c_h_sha256: "93ad4f6247f0b89c17218766c960e956047b0e8032c3db2b791842d576279330",
|
||||
wallet2_api_c_cpp_sha256: "2d52bbe50a6db8c1bd68ce4be288c28319f35f48c6d093a3d67d888c8e4b3230-45404ecc719b916c217938f9e82ad352a4068d12",
|
||||
wallet2_api_c_exp_sha256: "f7ab584f1271f4d533980f403597a1d9e50bced85c233ca2b17c77f4a94ed3bc",
|
||||
}
|
||||
@@ -164,6 +164,14 @@ endif()
|
||||
# ${EXTRA_LIBS_WOWNEROSEED}
|
||||
# ${EXTRA_LIBS_ANDROID}")
|
||||
|
||||
|
||||
if (${HOST_ABI} STREQUAL "x86_64-w64-mingw32" OR
|
||||
${HOST_ABI} STREQUAL "i686-w64-mingw32")
|
||||
target_link_options(wallet2_api_c PRIVATE "-Wl,--section-alignment,16384")
|
||||
elseif(${HOST_ABI} MATCHES "-linux-")
|
||||
target_link_options(wallet2_api_c PRIVATE "-Wl,-z,max-page-size=16384")
|
||||
endif()
|
||||
|
||||
target_link_libraries( wallet2_api_c
|
||||
|
||||
${WALLET_TARGETS}
|
||||
|
||||
@@ -122,6 +122,8 @@ _MONERO_MultisigState_total
|
||||
_MONERO_DeviceProgress_progress
|
||||
_MONERO_DeviceProgress_indeterminate
|
||||
_MONERO_Wallet_seed
|
||||
_MONERO_Wallet_setLedgerCallback
|
||||
_MONERO_Wallet_serializeCacheToJson
|
||||
_MONERO_Wallet_getSeedLanguage
|
||||
_MONERO_Wallet_setSeedLanguage
|
||||
_MONERO_Wallet_status
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifndef MONEROC_CHECKSUMS
|
||||
#define MONEROC_CHECKSUMS
|
||||
const char * MONERO_wallet2_api_c_h_sha256 = "9e80c4b59a0509aa02fbf01e8df2881b89f82225d1765bfa7856cbdbaf7af116";
|
||||
const char * MONERO_wallet2_api_c_cpp_sha256 = "d229507db508e574bd2badf4819a38dbead8c16a84311ad32c22c887a6003439-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe";
|
||||
const char * MONERO_wallet2_api_c_exp_sha256 = "d0f95f1f3bc49f1f59fe4eb0b61826128d7d3bb75405d5a01a252d02db03097d";
|
||||
const char * MONERO_wallet2_api_c_h_sha256 = "3515e4c9e537ca3efa664f0b364a3aeb106ff64337f542a262ce104c00b31235";
|
||||
const char * MONERO_wallet2_api_c_cpp_sha256 = "ca44a8d4a201ba6dc0a25c857e95d07bc8d514039b38cd5b3826100e8943cbcc-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe";
|
||||
const char * MONERO_wallet2_api_c_exp_sha256 = "0561e14606106e6b0ec49fb2aefe743ff500f7c3de07557f7041e06aef9509ce";
|
||||
#endif
|
||||
|
||||
@@ -2102,62 +2102,71 @@ uint64_t MONERO_Wallet_getBytesSent(void* wallet_ptr) {
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
bool MONERO_Wallet_getStateIsConnected(void* wallet_ptr) {
|
||||
bool MONERO_Wallet_getStateIsConnected() {
|
||||
DEBUG_START()
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
return wallet->getStateIsConnected();
|
||||
return Monero::Wallet::getStateIsConnected();
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
unsigned char* MONERO_Wallet_getSendToDevice(void* wallet_ptr) {
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
return wallet->getSendToDevice();
|
||||
}
|
||||
|
||||
size_t MONERO_Wallet_getSendToDeviceLength(void* wallet_ptr) {
|
||||
unsigned char* MONERO_Wallet_getSendToDevice() {
|
||||
DEBUG_START()
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
return wallet->getSendToDeviceLength();
|
||||
return Monero::Wallet::getSendToDevice();
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
unsigned char* MONERO_Wallet_getReceivedFromDevice(void* wallet_ptr) {
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
return wallet->getReceivedFromDevice();
|
||||
}
|
||||
|
||||
size_t MONERO_Wallet_getReceivedFromDeviceLength(void* wallet_ptr) {
|
||||
size_t MONERO_Wallet_getSendToDeviceLength() {
|
||||
DEBUG_START()
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
return wallet->getReceivedFromDeviceLength();
|
||||
return Monero::Wallet::getSendToDeviceLength();
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
bool MONERO_Wallet_getWaitsForDeviceSend(void* wallet_ptr) {
|
||||
unsigned char* MONERO_Wallet_getReceivedFromDevice() {
|
||||
DEBUG_START()
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
return wallet->getWaitsForDeviceSend();
|
||||
return Monero::Wallet::getReceivedFromDevice();
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
bool MONERO_Wallet_getWaitsForDeviceReceive(void* wallet_ptr) {
|
||||
size_t MONERO_Wallet_getReceivedFromDeviceLength() {
|
||||
DEBUG_START()
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
return wallet->getWaitsForDeviceReceive();
|
||||
return Monero::Wallet::getReceivedFromDeviceLength();
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
void MONERO_Wallet_setDeviceReceivedData(void* wallet_ptr, unsigned char* data, size_t len) {
|
||||
bool MONERO_Wallet_getWaitsForDeviceSend() {
|
||||
DEBUG_START()
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
return wallet->setDeviceReceivedData(data, len);
|
||||
return Monero::Wallet::getWaitsForDeviceSend();
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
void MONERO_Wallet_setDeviceSendData(void* wallet_ptr, unsigned char* data, size_t len) {
|
||||
bool MONERO_Wallet_getWaitsForDeviceReceive() {
|
||||
DEBUG_START()
|
||||
return Monero::Wallet::getWaitsForDeviceReceive();
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
void MONERO_Wallet_setDeviceReceivedData(unsigned char* data, size_t len) {
|
||||
DEBUG_START()
|
||||
Monero::Wallet::setDeviceReceivedData(data, len);
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
void MONERO_Wallet_setDeviceSendData(unsigned char* data, size_t len) {
|
||||
DEBUG_START()
|
||||
Monero::Wallet::setDeviceSendData(data, len);
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
void MONERO_Wallet_setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)) {
|
||||
DEBUG_START()
|
||||
Monero::Wallet::setLedgerCallback(sendToLedgerDevice);
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
const char* MONERO_Wallet_serializeCacheToJson(void* wallet_ptr) {
|
||||
DEBUG_START()
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
return wallet->setDeviceSendData(data, len);
|
||||
std::string result = wallet->serializeCacheToJson();
|
||||
return strdup(result.c_str());
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
|
||||
@@ -832,15 +832,17 @@ extern ADDAPI uint64_t MONERO_Wallet_getBytesReceived(void* wallet_ptr);
|
||||
// virtual uint64_t getBytesSent() = 0;
|
||||
extern ADDAPI uint64_t MONERO_Wallet_getBytesSent(void* wallet_ptr);
|
||||
// HIDAPI_DUMMY
|
||||
extern ADDAPI bool MONERO_Wallet_getStateIsConnected(void* wallet_ptr);
|
||||
extern ADDAPI unsigned char* MONERO_Wallet_getSendToDevice(void* wallet_ptr);
|
||||
extern ADDAPI size_t MONERO_Wallet_getSendToDeviceLength(void* wallet_ptr);
|
||||
extern ADDAPI unsigned char* MONERO_Wallet_getReceivedFromDevice(void* wallet_ptr);
|
||||
extern ADDAPI size_t MONERO_Wallet_getReceivedFromDeviceLength(void* wallet_ptr);
|
||||
extern ADDAPI bool MONERO_Wallet_getWaitsForDeviceSend(void* wallet_ptr);
|
||||
extern ADDAPI bool MONERO_Wallet_getWaitsForDeviceReceive(void* wallet_ptr);
|
||||
extern ADDAPI void MONERO_Wallet_setDeviceReceivedData(void* wallet_ptr, unsigned char* data, size_t len);
|
||||
extern ADDAPI void MONERO_Wallet_setDeviceSendData(void* wallet_ptr, unsigned char* data, size_t len);
|
||||
extern ADDAPI bool MONERO_Wallet_getStateIsConnected();
|
||||
extern ADDAPI unsigned char* MONERO_Wallet_getSendToDevice();
|
||||
extern ADDAPI size_t MONERO_Wallet_getSendToDeviceLength();
|
||||
extern ADDAPI unsigned char* MONERO_Wallet_getReceivedFromDevice();
|
||||
extern ADDAPI size_t MONERO_Wallet_getReceivedFromDeviceLength();
|
||||
extern ADDAPI bool MONERO_Wallet_getWaitsForDeviceSend();
|
||||
extern ADDAPI bool MONERO_Wallet_getWaitsForDeviceReceive();
|
||||
extern ADDAPI void MONERO_Wallet_setDeviceReceivedData(unsigned char* data, size_t len);
|
||||
extern ADDAPI void MONERO_Wallet_setDeviceSendData(unsigned char* data, size_t len);
|
||||
extern ADDAPI void MONERO_Wallet_setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len));
|
||||
extern ADDAPI const char* MONERO_Wallet_serializeCacheToJson(void* wallet_ptr);
|
||||
// };
|
||||
|
||||
// struct WalletManager
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 6e284a2ef552f1f47e8ca9edcf8651312c9e37dd Mon Sep 17 00:00:00 2001
|
||||
From 36259ba9f88bc135b243329400bec9290abb04c6 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Tue, 2 Apr 2024 16:51:56 +0200
|
||||
Subject: [PATCH 01/14] fix missing ___clear_cache when targetting iOS
|
||||
Subject: [PATCH 01/17] fix missing ___clear_cache when targetting iOS
|
||||
|
||||
---
|
||||
.gitmodules | 3 ++-
|
||||
@@ -30,5 +30,5 @@ index 102f8acf9..ce72c9bb9 160000
|
||||
-Subproject commit 102f8acf90a7649ada410de5499a7ec62e49e1da
|
||||
+Subproject commit ce72c9bb9cb799e0d9171094b9abb009e04c5bfc
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From b4f4b38af1ab974872862fc20735e41941b955e9 Mon Sep 17 00:00:00 2001
|
||||
From 459ac9f7a64cc527528a41dc45ed4cefe83091cb Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Sat, 11 May 2024 16:25:10 +0200
|
||||
Subject: [PATCH 02/14] store crash fix
|
||||
Subject: [PATCH 02/17] store crash fix
|
||||
|
||||
Monero wallet crashes (sometimes) when it is syncing,
|
||||
while the proper solution (that can be seen in feather)
|
||||
@@ -204,5 +204,5 @@ index 2f4ad52f1..daad1e940 100644
|
||||
i_wallet2_callback* m_callback;
|
||||
hw::device::device_type m_key_device_type;
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From a74f616e3c1671a883182b0db1c6fc11a1242c01 Mon Sep 17 00:00:00 2001
|
||||
From c51ee39835aaac64da39b1c10bc068182f6e28cb Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Mon, 2 Sep 2024 16:40:31 +0200
|
||||
Subject: [PATCH 03/14] uint64_t missing definition fix
|
||||
Subject: [PATCH 03/17] uint64_t missing definition fix
|
||||
|
||||
---
|
||||
contrib/epee/include/net/http_base.h | 2 +-
|
||||
@@ -21,5 +21,5 @@ index 4af4da790..ae4c0d05e 100644
|
||||
|
||||
#include <string>
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From f9b222f1611d7cfbaf0ac52cd6194724c7554def Mon Sep 17 00:00:00 2001
|
||||
From 0c1524dd9a4f6b4450b277623ffa620f69931102 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Mon, 24 Jun 2024 10:49:12 +0200
|
||||
Subject: [PATCH 04/14] use proper error handling in get_seed
|
||||
Subject: [PATCH 04/17] use proper error handling in get_seed
|
||||
|
||||
---
|
||||
src/wallet/api/wallet.cpp | 17 ++++++++++++-----
|
||||
@@ -67,5 +67,5 @@ index c9c2dbc82..b827b826f 100644
|
||||
|
||||
return true;
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From ff70c74c8b331758ace1f14df0ca107731dda49d Mon Sep 17 00:00:00 2001
|
||||
From 467ee9154b5c1b903559bf1dbe848cbabc62ba7d Mon Sep 17 00:00:00 2001
|
||||
From: tobtoht <tob@featherwallet.org>
|
||||
Date: Tue, 12 Mar 2024 10:09:50 +0100
|
||||
Subject: [PATCH 05/14] UR functions
|
||||
Subject: [PATCH 05/17] UR functions
|
||||
|
||||
This commit adds UR functions for UR tasks,
|
||||
I believe that the right place to get
|
||||
@@ -1006,5 +1006,5 @@ index daad1e940..a752f15b9 100644
|
||||
bool import_key_images(signed_tx_set & signed_tx, size_t offset=0, bool only_selected_transfers=false);
|
||||
crypto::public_key get_tx_pub_key_from_received_outs(const tools::wallet2::transfer_details &td) const;
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,43 +1,59 @@
|
||||
From 904fe95204ba02d1a8c81fc46c1423ba1685c94f Mon Sep 17 00:00:00 2001
|
||||
From 11ddba5ab1470fb46a87ea9b702bf11f88763ecc Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Wed, 26 Jun 2024 15:04:38 +0200
|
||||
Subject: [PATCH 06/14] add dummy device for ledger
|
||||
Date: Thu, 8 May 2025 13:14:23 +0200
|
||||
Subject: [PATCH 06/17] add dummy device for ledger
|
||||
|
||||
---
|
||||
CMakeLists.txt | 6 +-
|
||||
external/randomx | 2 +-
|
||||
src/device/CMakeLists.txt | 6 +-
|
||||
src/device/device.cpp | 10 ++-
|
||||
src/device/device.cpp | 10 +-
|
||||
src/device/device.hpp | 12 +--
|
||||
src/device/device_io_dummy.cpp | 133 ++++++++++++++++++++++++++++++
|
||||
src/device/device_io_dummy.hpp | 74 +++++++++++++++++
|
||||
src/device/device_io_dummy.cpp | 161 ++++++++++++++++++++++++++++++
|
||||
src/device/device_io_dummy.hpp | 82 +++++++++++++++
|
||||
src/device/device_ledger.cpp | 6 +-
|
||||
src/device/device_ledger.hpp | 7 +-
|
||||
src/wallet/api/wallet.cpp | 94 +++++++++++++++++++++
|
||||
src/wallet/api/wallet.h | 18 ++++
|
||||
src/wallet/api/wallet2_api.h | 12 +++
|
||||
src/wallet/api/wallet.cpp | 100 +++++++++++++++++++
|
||||
src/wallet/api/wallet.h | 14 +++
|
||||
src/wallet/api/wallet2_api.h | 13 +++
|
||||
src/wallet/api/wallet_manager.cpp | 12 ++-
|
||||
12 files changed, 365 insertions(+), 25 deletions(-)
|
||||
13 files changed, 405 insertions(+), 26 deletions(-)
|
||||
create mode 100644 src/device/device_io_dummy.cpp
|
||||
create mode 100644 src/device/device_io_dummy.hpp
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index c73b813d8..5c0f31cb8 100644
|
||||
index c73b813d8..ce5ef4bab 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -692,8 +692,12 @@ include_directories(${LMDB_INCLUDE})
|
||||
@@ -692,16 +692,21 @@ include_directories(${LMDB_INCLUDE})
|
||||
include_directories(${LIBUNWIND_INCLUDE})
|
||||
link_directories(${LIBUNWIND_LIBRARY_DIRS})
|
||||
|
||||
-# Final setup for hid
|
||||
-if (HIDAPI_FOUND)
|
||||
- message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}")
|
||||
- add_definitions(-DHAVE_HIDAPI)
|
||||
- include_directories(${HIDAPI_INCLUDE_DIR})
|
||||
- link_directories(${LIBHIDAPI_LIBRARY_DIRS})
|
||||
+if (HIDAPI_DUMMY)
|
||||
+ add_definitions(-DHIDAPI_DUMMY)
|
||||
+endif()
|
||||
else()
|
||||
- message(STATUS "Could not find HIDAPI")
|
||||
+ # Final setup for hid
|
||||
+ if (HIDAPI_FOUND)
|
||||
+ message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}")
|
||||
+ add_definitions(-DHAVE_HIDAPI)
|
||||
+ include_directories(${HIDAPI_INCLUDE_DIR})
|
||||
+ link_directories(${LIBHIDAPI_LIBRARY_DIRS})
|
||||
+ else()
|
||||
+ message(STATUS "Could not find HIDAPI")
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
+
|
||||
# Final setup for hid
|
||||
-if (HIDAPI_FOUND)
|
||||
+if (HIDAPI_FOUND)
|
||||
message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}")
|
||||
add_definitions(-DHAVE_HIDAPI)
|
||||
include_directories(${HIDAPI_INCLUDE_DIR})
|
||||
# Trezor support check
|
||||
include(CheckTrezor)
|
||||
|
||||
diff --git a/src/device/CMakeLists.txt b/src/device/CMakeLists.txt
|
||||
index e4f1159b5..14d398f87 100644
|
||||
--- a/src/device/CMakeLists.txt
|
||||
@@ -131,10 +147,10 @@ index 392703a24..ffd419779 100644
|
||||
|
||||
diff --git a/src/device/device_io_dummy.cpp b/src/device/device_io_dummy.cpp
|
||||
new file mode 100644
|
||||
index 000000000..edb4beea3
|
||||
index 000000000..01e6fc7b7
|
||||
--- /dev/null
|
||||
+++ b/src/device/device_io_dummy.cpp
|
||||
@@ -0,0 +1,133 @@
|
||||
@@ -0,0 +1,161 @@
|
||||
+// Copyright (c) 2017-2022, The Monero Project
|
||||
+//
|
||||
+// All rights reserved.
|
||||
@@ -189,6 +205,10 @@ index 000000000..edb4beea3
|
||||
+size_t hw::io::device_io_dummy::receivedFromDeviceLength = 0;
|
||||
+bool hw::io::device_io_dummy::waitsForDeviceSend = false;
|
||||
+bool hw::io::device_io_dummy::waitsForDeviceReceive = false;
|
||||
+void (*hw::io::device_io_dummy::sendToLedgerDeviceCallback)(unsigned char *command, unsigned int cmd_len) = nullptr;
|
||||
+std::mutex hw::io::device_io_dummy::mutex;
|
||||
+std::condition_variable hw::io::device_io_dummy::cv_send;
|
||||
+std::condition_variable hw::io::device_io_dummy::cv_receive;
|
||||
+
|
||||
+namespace hw {
|
||||
+ namespace io {
|
||||
@@ -227,22 +247,29 @@ index 000000000..edb4beea3
|
||||
+
|
||||
+ int device_io_dummy::exchange(unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len, bool user_input) {
|
||||
+ MDEBUG("exchange(): locking mutex");
|
||||
+ boost::unique_lock<boost::mutex> lock(mutex);
|
||||
+ std::unique_lock<std::mutex> lock(mutex);
|
||||
+ sendToDevice = command;
|
||||
+ sendToDeviceLength = cmd_len;
|
||||
+ waitsForDeviceSend = true;
|
||||
+ waitsForDeviceReceive = true;
|
||||
+
|
||||
+ // Call the callback if it's set
|
||||
+ if (sendToLedgerDeviceCallback != nullptr) {
|
||||
+ MDEBUG("exchange(): calling sendToLedgerDeviceCallback");
|
||||
+ sendToLedgerDeviceCallback(command, cmd_len);
|
||||
+ }
|
||||
+ MDEBUG("exchange(): waitsForDeviceSend");
|
||||
+ // NOTE: waitsForDeviceSend should be changed by external code
|
||||
+ // Wait for the send flag to be cleared by external code
|
||||
+ while (waitsForDeviceSend) {
|
||||
+ usleep(1000);
|
||||
+ MDEBUG("exchange(): waitsForDeviceSend (still)");
|
||||
+ cv_send.wait(lock);
|
||||
+ MDEBUG("exchange(): waitsForDeviceSend notified");
|
||||
+ }
|
||||
+
|
||||
+ MDEBUG("exchange(): waitsForDeviceReceive");
|
||||
+ // Wait for the receive flag to be cleared by external code
|
||||
+ while (waitsForDeviceReceive) {
|
||||
+ usleep(1000);
|
||||
+ MDEBUG("exchange(): waitsForDeviceReceive (still)");
|
||||
+ cv_receive.wait(lock);
|
||||
+ MDEBUG("exchange(): waitsForDeviceReceive notified");
|
||||
+ }
|
||||
+
|
||||
+ if (receivedFromDeviceLength > max_resp_len) {
|
||||
@@ -250,7 +277,8 @@ index 000000000..edb4beea3
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ memset(response,0,max_resp_len);
|
||||
+
|
||||
+ memset(response, 0, max_resp_len);
|
||||
+ memcpy(response, receivedFromDevice, receivedFromDeviceLength);
|
||||
+ return receivedFromDeviceLength;
|
||||
+ }
|
||||
@@ -263,18 +291,34 @@ index 000000000..edb4beea3
|
||||
+ MDEBUG("release()");
|
||||
+ }
|
||||
+
|
||||
+ void device_io_dummy::setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)) {
|
||||
+ MDEBUG("setLedgerCallback()");
|
||||
+ sendToLedgerDeviceCallback = sendToLedgerDevice;
|
||||
+ }
|
||||
+
|
||||
+ void device_io_dummy::setDeviceReceivedData(unsigned char* data, size_t len) {
|
||||
+ MDEBUG("setDeviceReceivedData(len: " << len << ")");
|
||||
+ std::unique_lock<std::mutex> lock(mutex);
|
||||
+
|
||||
+ receivedFromDevice = static_cast<unsigned char *>(malloc(len));
|
||||
+ receivedFromDeviceLength = len;
|
||||
+ memset(receivedFromDevice, 0, len);
|
||||
+ memcpy(receivedFromDevice, data, len);
|
||||
+ waitsForDeviceReceive = false;
|
||||
+ waitsForDeviceSend = false;
|
||||
+ cv_send.notify_all();
|
||||
+ cv_receive.notify_all();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+#endif // HAVE_HIDAPI
|
||||
\ No newline at end of file
|
||||
diff --git a/src/device/device_io_dummy.hpp b/src/device/device_io_dummy.hpp
|
||||
new file mode 100644
|
||||
index 000000000..a1733616d
|
||||
index 000000000..1128b9c1d
|
||||
--- /dev/null
|
||||
+++ b/src/device/device_io_dummy.hpp
|
||||
@@ -0,0 +1,74 @@
|
||||
@@ -0,0 +1,82 @@
|
||||
+// Copyright (c) 2017-2022, The Monero Project
|
||||
+//
|
||||
+// All rights reserved.
|
||||
@@ -309,6 +353,8 @@ index 000000000..a1733616d
|
||||
+
|
||||
+#include "device_io.hpp"
|
||||
+#include "device_io_hid.hpp"
|
||||
+#include <mutex>
|
||||
+#include <condition_variable>
|
||||
+
|
||||
+namespace hw {
|
||||
+ namespace io {
|
||||
@@ -320,9 +366,11 @@ index 000000000..a1733616d
|
||||
+ };
|
||||
+ class device_io_dummy : device_io {
|
||||
+ private:
|
||||
+ boost::mutex mutex;
|
||||
+ static std::mutex mutex;
|
||||
+
|
||||
+ public:
|
||||
+ static std::condition_variable cv_send;
|
||||
+ static std::condition_variable cv_receive;
|
||||
+ static bool stateIsConnected;
|
||||
+ static unsigned char* sendToDevice;
|
||||
+ static size_t sendToDeviceLength;
|
||||
@@ -330,6 +378,7 @@ index 000000000..a1733616d
|
||||
+ static size_t receivedFromDeviceLength;
|
||||
+ static bool waitsForDeviceSend;
|
||||
+ static bool waitsForDeviceReceive;
|
||||
+ static void (*sendToLedgerDeviceCallback)(unsigned char *command, unsigned int cmd_len);
|
||||
+
|
||||
+ device_io_dummy() = default;
|
||||
+ device_io_dummy(int a, int b, int c, int d);
|
||||
@@ -343,7 +392,10 @@ index 000000000..a1733616d
|
||||
+ void disconnect();
|
||||
+ bool connected() const;
|
||||
+
|
||||
+ int exchange(unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len, bool user_input);
|
||||
+ int exchange(unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len, bool user_input);
|
||||
+
|
||||
+ static void setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len));
|
||||
+ static void setDeviceReceivedData(unsigned char* data, size_t len);
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
@@ -415,7 +467,7 @@ index 03058c4f1..39454ca6d 100644
|
||||
unsigned char buffer_send[BUFFER_SEND_SIZE];
|
||||
unsigned int length_recv;
|
||||
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
|
||||
index 3fcd6f332..25ade04a7 100644
|
||||
index 3fcd6f332..844a1c451 100644
|
||||
--- a/src/wallet/api/wallet.cpp
|
||||
+++ b/src/wallet/api/wallet.cpp
|
||||
@@ -48,6 +48,9 @@
|
||||
@@ -428,91 +480,87 @@ index 3fcd6f332..25ade04a7 100644
|
||||
|
||||
using namespace std;
|
||||
using namespace cryptonote;
|
||||
@@ -3178,4 +3181,95 @@ uint64_t WalletImpl::getBytesSent()
|
||||
@@ -3178,4 +3181,101 @@ uint64_t WalletImpl::getBytesSent()
|
||||
return m_wallet->get_bytes_sent();
|
||||
}
|
||||
|
||||
+
|
||||
+// HIDAPI_DUMMY
|
||||
+bool WalletImpl::getStateIsConnected() {
|
||||
+bool Wallet::getStateIsConnected() {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return false;
|
||||
+ #else
|
||||
+ return hw::io::device_io_dummy::stateIsConnected;
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+unsigned char* WalletImpl::getSendToDevice() {
|
||||
+unsigned char* Wallet::getSendToDevice() {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return {};
|
||||
+ #else
|
||||
+ return hw::io::device_io_dummy::sendToDevice;
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+size_t WalletImpl::getSendToDeviceLength() {
|
||||
+size_t Wallet::getSendToDeviceLength() {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return -1;
|
||||
+ #else
|
||||
+ return hw::io::device_io_dummy::sendToDeviceLength;
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+unsigned char* WalletImpl::getReceivedFromDevice() {
|
||||
+unsigned char* Wallet::getReceivedFromDevice() {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return {};
|
||||
+ #else
|
||||
+ return hw::io::device_io_dummy::receivedFromDevice;
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+size_t WalletImpl::getReceivedFromDeviceLength() {
|
||||
+size_t Wallet::getReceivedFromDeviceLength() {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return -1;
|
||||
+ #else
|
||||
+ return hw::io::device_io_dummy::receivedFromDeviceLength;
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+bool WalletImpl::getWaitsForDeviceSend() {
|
||||
+bool Wallet::getWaitsForDeviceSend() {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return false;
|
||||
+ #else
|
||||
+ return hw::io::device_io_dummy::receivedFromDeviceLength;
|
||||
+ return hw::io::device_io_dummy::waitsForDeviceSend;
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+bool WalletImpl::getWaitsForDeviceReceive() {
|
||||
+bool Wallet::getWaitsForDeviceReceive() {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return false;
|
||||
+ #else
|
||||
+ return hw::io::device_io_dummy::waitsForDeviceReceive;
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+void WalletImpl::setDeviceReceivedData(unsigned char* data, size_t len) {
|
||||
+void Wallet::setDeviceReceivedData(unsigned char* data, size_t len) {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return;
|
||||
+ #else
|
||||
+ hw::io::device_io_dummy::receivedFromDevice = static_cast<unsigned char *>(malloc(len));
|
||||
+ hw::io::device_io_dummy::receivedFromDeviceLength = len;
|
||||
+ memset(hw::io::device_io_dummy::receivedFromDevice, 0, len);
|
||||
+ memcpy(hw::io::device_io_dummy::receivedFromDevice, data, len);
|
||||
+ hw::io::device_io_dummy::waitsForDeviceReceive = false;
|
||||
+ hw::io::device_io_dummy::setDeviceReceivedData(data, len);
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+void WalletImpl::setDeviceSendData(unsigned char* data, size_t len) {
|
||||
+void Wallet::setDeviceSendData(unsigned char* data, size_t len) {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return;
|
||||
+ #else
|
||||
+ hw::io::device_io_dummy::sendToDevice = static_cast<unsigned char *>(malloc(len));
|
||||
@@ -520,15 +568,25 @@ index 3fcd6f332..25ade04a7 100644
|
||||
+ memset(hw::io::device_io_dummy::sendToDevice, 0, len);
|
||||
+ memcpy(hw::io::device_io_dummy::sendToDevice, data, len);
|
||||
+ hw::io::device_io_dummy::waitsForDeviceSend = false;
|
||||
+ hw::io::device_io_dummy::cv_send.notify_all();
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+void Wallet::setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)) {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return;
|
||||
+ #else
|
||||
+ hw::io::device_io_dummy::setLedgerCallback(sendToLedgerDevice);
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
} // namespace
|
||||
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
|
||||
index edf8bb8ce..4e9c21ecb 100644
|
||||
index edf8bb8ce..6bfb61cb8 100644
|
||||
--- a/src/wallet/api/wallet.h
|
||||
+++ b/src/wallet/api/wallet.h
|
||||
@@ -301,6 +301,24 @@ private:
|
||||
@@ -301,6 +301,20 @@ private:
|
||||
// cache connection status to avoid unnecessary RPC calls
|
||||
mutable std::atomic<bool> m_is_connected;
|
||||
boost::optional<epee::net_utils::http::login> m_daemon_login{};
|
||||
@@ -546,33 +604,30 @@ index edf8bb8ce..4e9c21ecb 100644
|
||||
+ bool getWaitsForDeviceSend();
|
||||
+
|
||||
+ bool getWaitsForDeviceReceive();
|
||||
+
|
||||
+ void setDeviceReceivedData(unsigned char *data, size_t len);
|
||||
+
|
||||
+ void setDeviceSendData(unsigned char *data, size_t len);
|
||||
};
|
||||
|
||||
|
||||
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
|
||||
index 764adbfbf..53ec4abfc 100644
|
||||
index 764adbfbf..a48a6be54 100644
|
||||
--- a/src/wallet/api/wallet2_api.h
|
||||
+++ b/src/wallet/api/wallet2_api.h
|
||||
@@ -1150,6 +1150,18 @@ struct Wallet
|
||||
@@ -1150,6 +1150,19 @@ struct Wallet
|
||||
|
||||
//! get bytes sent
|
||||
virtual uint64_t getBytesSent() = 0;
|
||||
+
|
||||
+ // HIDAPI_DUMMY
|
||||
+ virtual bool getStateIsConnected() = 0;
|
||||
+ virtual unsigned char* getSendToDevice() = 0;
|
||||
+ virtual size_t getSendToDeviceLength() = 0;
|
||||
+ virtual unsigned char* getReceivedFromDevice() = 0;
|
||||
+ virtual size_t getReceivedFromDeviceLength() = 0;
|
||||
+ virtual bool getWaitsForDeviceSend() = 0;
|
||||
+ virtual bool getWaitsForDeviceReceive() = 0;
|
||||
+ static bool getStateIsConnected();
|
||||
+ static unsigned char* getSendToDevice();
|
||||
+ static size_t getSendToDeviceLength();
|
||||
+ static unsigned char* getReceivedFromDevice();
|
||||
+ static size_t getReceivedFromDeviceLength();
|
||||
+ static bool getWaitsForDeviceSend();
|
||||
+ static bool getWaitsForDeviceReceive();
|
||||
+
|
||||
+ virtual void setDeviceReceivedData(unsigned char* data, size_t len) = 0;
|
||||
+ virtual void setDeviceSendData(unsigned char* data, size_t len) = 0;
|
||||
+ static void setDeviceReceivedData(unsigned char* data, size_t len);
|
||||
+ static void setDeviceSendData(unsigned char* data, size_t len);
|
||||
+ static void setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len));
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -600,5 +655,5 @@ index e81b8f83a..277be6ac9 100644
|
||||
|
||||
std::vector<std::string> WalletManagerImpl::findWallets(const std::string &path)
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From c54ab3f0984159bd47c63b78074caaaac082727a Mon Sep 17 00:00:00 2001
|
||||
From 3c3d441cabcaae9eb5d3db2f5cd6c506feb97168 Mon Sep 17 00:00:00 2001
|
||||
From: tobtoht <tob@featherwallet.org>
|
||||
Date: Tue, 12 Mar 2024 09:42:37 +0100
|
||||
Subject: [PATCH 07/14] polyseed
|
||||
Subject: [PATCH 07/17] polyseed
|
||||
|
||||
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
---
|
||||
@@ -814,7 +814,7 @@ index 000000000..2c8c777a7
|
||||
+#endif //POLYSEED_HPP
|
||||
\ No newline at end of file
|
||||
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
|
||||
index 25ade04a7..51911bf99 100644
|
||||
index 844a1c451..050212ff7 100644
|
||||
--- a/src/wallet/api/wallet.cpp
|
||||
+++ b/src/wallet/api/wallet.cpp
|
||||
@@ -728,6 +728,28 @@ bool WalletImpl::recoverFromDevice(const std::string &path, const std::string &p
|
||||
@@ -902,7 +902,7 @@ index 25ade04a7..51911bf99 100644
|
||||
{
|
||||
return m_wallet->get_seed_language();
|
||||
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
|
||||
index 4e9c21ecb..32e12284b 100644
|
||||
index 6bfb61cb8..e7873dd78 100644
|
||||
--- a/src/wallet/api/wallet.h
|
||||
+++ b/src/wallet/api/wallet.h
|
||||
@@ -79,9 +79,19 @@ public:
|
||||
@@ -926,7 +926,7 @@ index 4e9c21ecb..32e12284b 100644
|
||||
void setSeedLanguage(const std::string &arg) override;
|
||||
// void setListener(Listener *) {}
|
||||
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
|
||||
index 53ec4abfc..be1c3704e 100644
|
||||
index a48a6be54..8fa0bbd42 100644
|
||||
--- a/src/wallet/api/wallet2_api.h
|
||||
+++ b/src/wallet/api/wallet2_api.h
|
||||
@@ -709,6 +709,10 @@ struct Wallet
|
||||
@@ -940,7 +940,7 @@ index 53ec4abfc..be1c3704e 100644
|
||||
/**
|
||||
* @brief StartRefresh - Start/resume refresh thread (refresh every 10 seconds)
|
||||
*/
|
||||
@@ -1320,6 +1324,27 @@ struct WalletManager
|
||||
@@ -1321,6 +1325,27 @@ struct WalletManager
|
||||
uint64_t kdf_rounds = 1,
|
||||
WalletListener * listener = nullptr) = 0;
|
||||
|
||||
@@ -1282,5 +1282,5 @@ index a752f15b9..a619bdd15 100644
|
||||
uint32_t m_multisig_threshold;
|
||||
std::vector<crypto::public_key> m_multisig_signers;
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 753d7eee48d8e9ab5950e48dc984cc1038c11dd1 Mon Sep 17 00:00:00 2001
|
||||
From 722abaf1f84d8444d40e277f8b97e54250195856 Mon Sep 17 00:00:00 2001
|
||||
From: tobtoht <tob@featherwallet.org>
|
||||
Date: Tue, 12 Mar 2024 11:07:57 +0100
|
||||
Subject: [PATCH 08/14] coin control
|
||||
Subject: [PATCH 08/17] coin control
|
||||
|
||||
---
|
||||
src/simplewallet/simplewallet.cpp | 2 +-
|
||||
@@ -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 51911bf99..933cc2531 100644
|
||||
index 050212ff7..b259528ef 100644
|
||||
--- a/src/wallet/api/wallet.cpp
|
||||
+++ b/src/wallet/api/wallet.cpp
|
||||
@@ -35,6 +35,7 @@
|
||||
@@ -760,7 +760,7 @@ index 51911bf99..933cc2531 100644
|
||||
{
|
||||
return m_subaddress.get();
|
||||
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
|
||||
index 32e12284b..a82f270e4 100644
|
||||
index e7873dd78..bc782dd4a 100644
|
||||
--- a/src/wallet/api/wallet.h
|
||||
+++ b/src/wallet/api/wallet.h
|
||||
@@ -46,6 +46,7 @@ class PendingTransactionImpl;
|
||||
@@ -813,7 +813,7 @@ index 32e12284b..a82f270e4 100644
|
||||
|
||||
// multi-threaded refresh stuff
|
||||
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
|
||||
index be1c3704e..013b5bcba 100644
|
||||
index 8fa0bbd42..7e67f02fd 100644
|
||||
--- a/src/wallet/api/wallet2_api.h
|
||||
+++ b/src/wallet/api/wallet2_api.h
|
||||
@@ -263,6 +263,51 @@ struct AddressBook
|
||||
@@ -1095,5 +1095,5 @@ index a619bdd15..4f324c238 100644
|
||||
void set_unspent(size_t idx);
|
||||
bool is_spent(const transfer_details &td, bool strict = true) const;
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0ba0339b11d8f7f66f2d5cd27075d438a76351b4 Mon Sep 17 00:00:00 2001
|
||||
From f386189cf3c5b433251b2cf493ba264a1a79fb7e Mon Sep 17 00:00:00 2001
|
||||
From: M <m@cakewallet.com>
|
||||
Date: Fri, 21 Apr 2023 15:43:47 -0400
|
||||
Subject: [PATCH 09/14] Add hex encoding and tx key getter for
|
||||
Subject: [PATCH 09/17] Add hex encoding and tx key getter for
|
||||
PendingTransction in wallet api.
|
||||
|
||||
---
|
||||
@@ -51,7 +51,7 @@ index 403bfe281..0cc6c58e9 100644
|
||||
private:
|
||||
friend class WalletImpl;
|
||||
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
|
||||
index 013b5bcba..f421fdc05 100644
|
||||
index 7e67f02fd..7f1462a44 100644
|
||||
--- a/src/wallet/api/wallet2_api.h
|
||||
+++ b/src/wallet/api/wallet2_api.h
|
||||
@@ -127,6 +127,8 @@ struct PendingTransaction
|
||||
@@ -64,5 +64,5 @@ index 013b5bcba..f421fdc05 100644
|
||||
|
||||
/**
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From cb02355313d504e6a44f8f70b8eb2be64167ffd4 Mon Sep 17 00:00:00 2001
|
||||
From 55f5311122fb9d19e870fa4a330c59d76ca92aac Mon Sep 17 00:00:00 2001
|
||||
From: Konstantin Ullrich <konstantinullrich12@gmail.com>
|
||||
Date: Wed, 11 Oct 2023 16:47:59 +0200
|
||||
Subject: [PATCH 10/14] Add recoverDeterministicWalletFromSpendKey
|
||||
Subject: [PATCH 10/17] Add recoverDeterministicWalletFromSpendKey
|
||||
|
||||
This function is used by Cake Wallet to enable polyseed (dart implementation)
|
||||
support.
|
||||
@@ -19,7 +19,7 @@ Co-authored-by: Godwin Asuquo <godilite@gmail.com>
|
||||
5 files changed, 75 insertions(+)
|
||||
|
||||
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
|
||||
index 933cc2531..d8fe108b4 100644
|
||||
index b259528ef..20ccbfb35 100644
|
||||
--- a/src/wallet/api/wallet.cpp
|
||||
+++ b/src/wallet/api/wallet.cpp
|
||||
@@ -824,6 +824,35 @@ bool WalletImpl::recover(const std::string &path, const std::string &password, c
|
||||
@@ -59,7 +59,7 @@ index 933cc2531..d8fe108b4 100644
|
||||
{
|
||||
|
||||
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
|
||||
index a82f270e4..9e1fbb40b 100644
|
||||
index bc782dd4a..bfe81c590 100644
|
||||
--- a/src/wallet/api/wallet.h
|
||||
+++ b/src/wallet/api/wallet.h
|
||||
@@ -77,6 +77,10 @@ public:
|
||||
@@ -74,10 +74,10 @@ index a82f270e4..9e1fbb40b 100644
|
||||
const std::string &password,
|
||||
const std::string &device_name);
|
||||
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
|
||||
index f421fdc05..c8d6bb179 100644
|
||||
index 7f1462a44..27e8b1426 100644
|
||||
--- a/src/wallet/api/wallet2_api.h
|
||||
+++ b/src/wallet/api/wallet2_api.h
|
||||
@@ -1323,6 +1323,25 @@ struct WalletManager
|
||||
@@ -1324,6 +1324,25 @@ struct WalletManager
|
||||
return createWalletFromKeys(path, password, language, testnet ? TESTNET : MAINNET, restoreHeight, addressString, viewKeyString, spendKeyString);
|
||||
}
|
||||
|
||||
@@ -149,5 +149,5 @@ index 28fcd36c9..be3ff8184 100644
|
||||
const std::string &password,
|
||||
NetworkType nettype,
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 846d3f60093add6653d9102d841288066fc08311 Mon Sep 17 00:00:00 2001
|
||||
From ec93b6bf725eeff0999fdd9d603c4578cb19ae07 Mon Sep 17 00:00:00 2001
|
||||
From: cyan <cyjan@mrcyjanek.net>
|
||||
Date: Thu, 7 Nov 2024 16:46:24 +0000
|
||||
Subject: [PATCH 11/14] add monero submodule support
|
||||
Subject: [PATCH 11/17] add monero submodule support
|
||||
|
||||
---
|
||||
CMakeLists.txt | 6 +++---
|
||||
@@ -61,5 +61,5 @@ index 3188c88db..9fbdb3c05 100644
|
||||
if (ptx_vector.empty())
|
||||
{
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 53cc0482e55a39b5dbf2261fea11fcb160778800 Mon Sep 17 00:00:00 2001
|
||||
From 73d6ad9d513f776afb1c1f5f2d74e3b06fad7eeb Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Thu, 21 Nov 2024 06:05:03 -0500
|
||||
Subject: [PATCH 12/14] fix iOS depends build
|
||||
Subject: [PATCH 12/17] fix iOS depends build
|
||||
|
||||
---
|
||||
CMakeLists.txt | 4 ----
|
||||
@@ -100,5 +100,5 @@ index 71b8f78cc..0f53f024e 100644
|
||||
#if TARGET_OS_MAC && (!defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7)
|
||||
return boost::logic::tribool(IOPSGetTimeRemainingEstimate() != kIOPSTimeRemainingUnlimited);
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
From 1eacd30724559749be5adeb31d763f44c3f221f9 Mon Sep 17 00:00:00 2001
|
||||
From db52bcebe23b29b35ae538f01e72ed4f7f66f931 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Mon, 18 Nov 2024 10:57:37 -0500
|
||||
Subject: [PATCH 13/14] include locale only when targeting WIN32
|
||||
|
||||
Subject: [PATCH 13/17] include locale only when targeting WIN32
|
||||
|
||||
---
|
||||
CMakeLists.txt | 6 +++++-
|
||||
@@ -10,7 +9,7 @@ Subject: [PATCH 13/14] include locale only when targeting WIN32
|
||||
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 1eac121db..3a4e8f7e1 100644
|
||||
index 1eac121db..5938be622 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -1089,7 +1089,11 @@ if(NOT Boost_FOUND)
|
||||
@@ -27,7 +26,7 @@ index 1eac121db..3a4e8f7e1 100644
|
||||
# Boost System is header-only since 1.69
|
||||
if (Boost_VERSION_STRING VERSION_LESS 1.69.0)
|
||||
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
|
||||
index d8fe108b4..e3e838b13 100644
|
||||
index 20ccbfb35..c43803033 100644
|
||||
--- a/src/wallet/api/wallet.cpp
|
||||
+++ b/src/wallet/api/wallet.cpp
|
||||
@@ -46,7 +46,9 @@
|
||||
@@ -41,5 +40,5 @@ index d8fe108b4..e3e838b13 100644
|
||||
#include "bc-ur/src/bc-ur.hpp"
|
||||
#if defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI)
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 2d31234e859bff817d30d91b21d9412375668aae Mon Sep 17 00:00:00 2001
|
||||
From be01eac2724d22cd7225bb17fba7a443efe8d8d6 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Wed, 29 Jan 2025 16:13:28 +0100
|
||||
Subject: [PATCH 14/14] change earliest fork height message
|
||||
Subject: [PATCH 14/17] change earliest fork height message
|
||||
|
||||
---
|
||||
src/wallet/wallet2.cpp | 2 +-
|
||||
@@ -21,5 +21,5 @@ index 8720e18b1..69da11d9c 100644
|
||||
bool close_enough = (int64_t)height >= (int64_t)earliest_height - early_blocks && earliest_height != std::numeric_limits<uint64_t>::max(); // start using the rules that many blocks beforehand
|
||||
if (close_enough)
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 71cf45cfbd571ec58e8b2a1d408ff74804bf7e1d Mon Sep 17 00:00:00 2001
|
||||
From b62446750e904978cd1a8f90d5f2d1437a3db5a9 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Thu, 20 Feb 2025 08:36:28 +0100
|
||||
Subject: [PATCH] remove trivially_copyable assert
|
||||
Subject: [PATCH 15/17] remove trivially_copyable assert
|
||||
|
||||
---
|
||||
contrib/epee/include/span.h | 1 -
|
||||
@@ -20,5 +20,5 @@ index 01dc387d6..2ad733a2f 100644
|
||||
return {reinterpret_cast<const std::uint8_t*>(std::addressof(src)), sizeof(T)};
|
||||
}
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From ab4e853571329b3ccb745c393220c047b03f2b2c Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Tue, 1 Apr 2025 11:30:45 +0200
|
||||
Subject: [PATCH 16/17] pr-9880
|
||||
|
||||
---
|
||||
CMakeLists.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 5938be622..1c4728578 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -216,7 +216,7 @@ function(forbid_undefined_symbols)
|
||||
file(MAKE_DIRECTORY "${TEST_PROJECT}")
|
||||
file(WRITE "${TEST_PROJECT}/CMakeLists.txt"
|
||||
[=[
|
||||
-cmake_minimum_required(VERSION 3.1)
|
||||
+cmake_minimum_required(VERSION 3.5)
|
||||
project(test)
|
||||
option(EXPECT_SUCCESS "" ON)
|
||||
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/incorrect_source.cpp" "void undefined_symbol(); void symbol() { undefined_symbol(); }")
|
||||
--
|
||||
2.49.0
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From 32f2e6cc2e184bfdaa92a5d45a15983c896f6816 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Thu, 10 Apr 2025 13:28:05 +0200
|
||||
Subject: [PATCH 17/17] fix: unary_function -> __unary_function
|
||||
|
||||
---
|
||||
src/cryptonote_basic/cryptonote_basic_impl.h | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/cryptonote_basic/cryptonote_basic_impl.h b/src/cryptonote_basic/cryptonote_basic_impl.h
|
||||
index b423573c5..a9aef7a2a 100644
|
||||
--- a/src/cryptonote_basic/cryptonote_basic_impl.h
|
||||
+++ b/src/cryptonote_basic/cryptonote_basic_impl.h
|
||||
@@ -40,7 +40,11 @@ namespace cryptonote {
|
||||
/* */
|
||||
/************************************************************************/
|
||||
template<class t_array>
|
||||
+#ifdef __APPLE__
|
||||
+ struct array_hasher: std::__unary_function<t_array&, std::size_t>
|
||||
+#else
|
||||
struct array_hasher: std::unary_function<t_array&, std::size_t>
|
||||
+#endif
|
||||
{
|
||||
std::size_t operator()(const t_array& val) const
|
||||
{
|
||||
--
|
||||
2.49.0
|
||||
|
||||
@@ -0,0 +1,463 @@
|
||||
From 7c1d576901a56b7c315b2c54362f7985ff8df753 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Tue, 12 Aug 2025 07:09:14 -0400
|
||||
Subject: [PATCH] serialize cache to JSON
|
||||
|
||||
---
|
||||
src/wallet/CMakeLists.txt | 1 +
|
||||
src/wallet/api/wallet.cpp | 5 +
|
||||
src/wallet/api/wallet.h | 2 +
|
||||
src/wallet/api/wallet2_api.h | 3 +
|
||||
src/wallet/wallet2.h | 6 +
|
||||
src/wallet/wallet_cache_to_json.cpp | 368 ++++++++++++++++++++++++++++
|
||||
6 files changed, 385 insertions(+)
|
||||
create mode 100644 src/wallet/wallet_cache_to_json.cpp
|
||||
|
||||
diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt
|
||||
index b163212b7..196ad671f 100644
|
||||
--- a/src/wallet/CMakeLists.txt
|
||||
+++ b/src/wallet/CMakeLists.txt
|
||||
@@ -38,6 +38,7 @@ set(wallet_sources
|
||||
message_store.cpp
|
||||
message_transporter.cpp
|
||||
wallet_rpc_payments.cpp
|
||||
+ wallet_cache_to_json.cpp
|
||||
)
|
||||
|
||||
monero_find_all_headers(wallet_private_headers "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
|
||||
index 7d7d0f922..effb6e719 100644
|
||||
--- a/src/wallet/api/wallet.cpp
|
||||
+++ b/src/wallet/api/wallet.cpp
|
||||
@@ -3475,4 +3475,9 @@ void Wallet::setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command
|
||||
#endif
|
||||
}
|
||||
|
||||
+std::string WalletImpl::serializeCacheToJson() const
|
||||
+{
|
||||
+ return std::string(m_wallet->serialize_cache_to_json());
|
||||
+}
|
||||
+
|
||||
} // namespace
|
||||
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
|
||||
index bfe81c590..98c03b9c1 100644
|
||||
--- a/src/wallet/api/wallet.h
|
||||
+++ b/src/wallet/api/wallet.h
|
||||
@@ -335,6 +335,8 @@ private:
|
||||
bool getWaitsForDeviceSend();
|
||||
|
||||
bool getWaitsForDeviceReceive();
|
||||
+
|
||||
+ virtual std::string serializeCacheToJson() const override;
|
||||
};
|
||||
|
||||
|
||||
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
|
||||
index fcb8187d4..3d11929f9 100644
|
||||
--- a/src/wallet/api/wallet2_api.h
|
||||
+++ b/src/wallet/api/wallet2_api.h
|
||||
@@ -1217,6 +1217,9 @@ struct Wallet
|
||||
static void setDeviceReceivedData(unsigned char* data, size_t len);
|
||||
static void setDeviceSendData(unsigned char* data, size_t len);
|
||||
static void setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len));
|
||||
+
|
||||
+ //! serialize wallet cache to JSON
|
||||
+ virtual std::string serializeCacheToJson() const = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
|
||||
index 4f324c238..bc4abc672 100644
|
||||
--- a/src/wallet/wallet2.h
|
||||
+++ b/src/wallet/wallet2.h
|
||||
@@ -1429,6 +1429,12 @@ private:
|
||||
FIELD(m_background_sync_data)
|
||||
END_SERIALIZE()
|
||||
|
||||
+ /*!
|
||||
+ * \brief Serialize wallet cache fields to JSON
|
||||
+ * \return const char* pointing to JSON string containing all cache fields
|
||||
+ */
|
||||
+ const char* serialize_cache_to_json() const;
|
||||
+
|
||||
/*!
|
||||
* \brief Check if wallet keys and bin files exist
|
||||
* \param file_path Wallet file path
|
||||
diff --git a/src/wallet/wallet_cache_to_json.cpp b/src/wallet/wallet_cache_to_json.cpp
|
||||
new file mode 100644
|
||||
index 000000000..64687a7a6
|
||||
--- /dev/null
|
||||
+++ b/src/wallet/wallet_cache_to_json.cpp
|
||||
@@ -0,0 +1,368 @@
|
||||
+#include "wallet2.h"
|
||||
+#include "serialization/binary_archive.h"
|
||||
+#include "serialization/json_archive.h"
|
||||
+#include "serialization/serialization.h"
|
||||
+#include <sstream>
|
||||
+#include <iomanip>
|
||||
+
|
||||
+namespace tools
|
||||
+{
|
||||
+
|
||||
+static void write_escaped_json_string(std::ostream& os, const std::string& str)
|
||||
+{
|
||||
+ for (char c : str) {
|
||||
+ switch (c) {
|
||||
+ case '"': os << "\\\""; break;
|
||||
+ case '\\': os << "\\\\"; break;
|
||||
+ case '\n': os << "\\n"; break;
|
||||
+ case '\r': os << "\\r"; break;
|
||||
+ case '\t': os << "\\t"; break;
|
||||
+ case '\b': os << "\\b"; break;
|
||||
+ case '\f': os << "\\f"; break;
|
||||
+ default: os << c; break;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void post_process_json(std::string& json)
|
||||
+{
|
||||
+ // ": ," --> ": null,"
|
||||
+ size_t pos = 0;
|
||||
+ while ((pos = json.find(": ,", pos)) != std::string::npos) {
|
||||
+ json.replace(pos, 3, ": null,");
|
||||
+ pos += 7;
|
||||
+ }
|
||||
+
|
||||
+ // ": }" --> ": null}"
|
||||
+ pos = 0;
|
||||
+ while ((pos = json.find(": }", pos)) != std::string::npos) {
|
||||
+ json.replace(pos, 3, ": null}");
|
||||
+ pos += 7;
|
||||
+ }
|
||||
+
|
||||
+ // ": ]" --> ": null]"
|
||||
+ pos = 0;
|
||||
+ while ((pos = json.find(": ]", pos)) != std::string::npos) {
|
||||
+ json.replace(pos, 3, ": null]");
|
||||
+ pos += 7;
|
||||
+ }
|
||||
+
|
||||
+ // "key": number"hexstring" --> "key": "numberhexstring"
|
||||
+ pos = 0;
|
||||
+ while (pos < json.length()) {
|
||||
+ size_t colon_pos = json.find(": ", pos);
|
||||
+ if (colon_pos == std::string::npos) break;
|
||||
+
|
||||
+ size_t value_start = colon_pos + 2;
|
||||
+ if (value_start >= json.length()) break;
|
||||
+
|
||||
+ if (std::isdigit(json[value_start])) {
|
||||
+ size_t quote_pos = json.find('"', value_start);
|
||||
+ if (quote_pos != std::string::npos && quote_pos < json.find_first_of(",}]", value_start)) {
|
||||
+ size_t closing_quote = json.find('"', quote_pos + 1);
|
||||
+ if (closing_quote != std::string::npos && closing_quote < json.find_first_of(",}]", value_start)) {
|
||||
+ std::string digits;
|
||||
+ size_t digit_end = value_start;
|
||||
+ while (digit_end < quote_pos && std::isdigit(json[digit_end])) {
|
||||
+ digits += json[digit_end];
|
||||
+ digit_end++;
|
||||
+ }
|
||||
+
|
||||
+ if (digit_end == quote_pos && !digits.empty()) {
|
||||
+ std::string hex_part = json.substr(quote_pos + 1, closing_quote - quote_pos - 1);
|
||||
+
|
||||
+ std::string replacement = "\"" + digits + hex_part + "\"";
|
||||
+ json.replace(value_start, closing_quote - value_start + 1, replacement);
|
||||
+ pos = value_start + replacement.length();
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ pos = colon_pos + 1;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+const char* wallet2::serialize_cache_to_json() const
|
||||
+{
|
||||
+ static std::string json_result;
|
||||
+
|
||||
+ try
|
||||
+ {
|
||||
+ std::stringstream oss;
|
||||
+ json_archive<true> ar(oss, true); // true for pretty printing
|
||||
+
|
||||
+ ar.begin_object();
|
||||
+
|
||||
+ // MAGIC_FIELD("monero wallet cache")
|
||||
+ std::string magic = "monero wallet cache";
|
||||
+ ar.tag("magic");
|
||||
+ ar.serialize_blob((void*)magic.data(), magic.size());
|
||||
+ if (!ar.good()) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize magic field\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // VERSION_FIELD(2)
|
||||
+ uint32_t version = 2;
|
||||
+ ar.tag("version");
|
||||
+ ar.serialize_varint(version);
|
||||
+ if (!ar.good()) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize version field\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_blockchain) - hashchain type, has serialization support
|
||||
+ ar.tag("m_blockchain");
|
||||
+ if (!::serialization::serialize(ar, const_cast<hashchain&>(m_blockchain))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_blockchain\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_transfers) - transfer_container (std::vector<transfer_details>)
|
||||
+ ar.tag("m_transfers");
|
||||
+ if (!::serialization::serialize(ar, const_cast<transfer_container&>(m_transfers))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_transfers\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_account_public_address) - cryptonote::account_public_address
|
||||
+ ar.tag("m_account_public_address");
|
||||
+ if (!::serialization::serialize(ar, const_cast<cryptonote::account_public_address&>(m_account_public_address))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_account_public_address\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_key_images) - serializable_unordered_map<crypto::key_image, size_t>
|
||||
+ ar.tag("m_key_images");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::key_image, size_t>&>(m_key_images))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_key_images\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_unconfirmed_txs) - serializable_unordered_map<crypto::hash, unconfirmed_transfer_details>
|
||||
+ ar.tag("m_unconfirmed_txs");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::hash, unconfirmed_transfer_details>&>(m_unconfirmed_txs))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_unconfirmed_txs\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_payments) - payment_container (serializable_unordered_multimap<crypto::hash, payment_details>)
|
||||
+ ar.tag("m_payments");
|
||||
+ if (!::serialization::serialize(ar, const_cast<payment_container&>(m_payments))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_payments\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_tx_keys) - serializable_unordered_map<crypto::hash, crypto::secret_key>
|
||||
+ ar.tag("m_tx_keys");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::hash, crypto::secret_key>&>(m_tx_keys))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_tx_keys\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_confirmed_txs) - serializable_unordered_map<crypto::hash, confirmed_transfer_details>
|
||||
+ ar.tag("m_confirmed_txs");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::hash, confirmed_transfer_details>&>(m_confirmed_txs))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_confirmed_txs\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_tx_notes) - serializable_unordered_map<crypto::hash, std::string>
|
||||
+ ar.tag("m_tx_notes");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::hash, std::string>&>(m_tx_notes))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_tx_notes\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_unconfirmed_payments) - serializable_unordered_multimap<crypto::hash, pool_payment_details>
|
||||
+ ar.tag("m_unconfirmed_payments");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_multimap<crypto::hash, pool_payment_details>&>(m_unconfirmed_payments))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_unconfirmed_payments\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_pub_keys) - serializable_unordered_map<crypto::public_key, size_t>
|
||||
+ ar.tag("m_pub_keys");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::public_key, size_t>&>(m_pub_keys))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_pub_keys\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_address_book) - std::vector<tools::wallet2::address_book_row>
|
||||
+ ar.tag("m_address_book");
|
||||
+ if (!::serialization::serialize(ar, const_cast<std::vector<tools::wallet2::address_book_row>&>(m_address_book))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_address_book\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_scanned_pool_txs[0]) - std::unordered_set<crypto::hash>
|
||||
+ ar.tag("m_scanned_pool_txs_0");
|
||||
+ if (!::serialization::serialize(ar, const_cast<std::unordered_set<crypto::hash>&>(m_scanned_pool_txs[0]))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_scanned_pool_txs[0]\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_scanned_pool_txs[1]) - std::unordered_set<crypto::hash>
|
||||
+ ar.tag("m_scanned_pool_txs_1");
|
||||
+ if (!::serialization::serialize(ar, const_cast<std::unordered_set<crypto::hash>&>(m_scanned_pool_txs[1]))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_scanned_pool_txs[1]\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_subaddresses) - serializable_unordered_map<crypto::public_key, cryptonote::subaddress_index>
|
||||
+ ar.tag("m_subaddresses");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::public_key, cryptonote::subaddress_index>&>(m_subaddresses))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_subaddresses\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_subaddress_labels) - std::vector<std::vector<std::string>> - manual JSON serialization
|
||||
+ oss << ", \n \"m_subaddress_labels\": [";
|
||||
+ for (size_t i = 0; i < m_subaddress_labels.size(); ++i) {
|
||||
+ if (i > 0) oss << ", ";
|
||||
+ oss << "\n [";
|
||||
+ for (size_t j = 0; j < m_subaddress_labels[i].size(); ++j) {
|
||||
+ if (j > 0) oss << ", ";
|
||||
+ oss << "\"";
|
||||
+ write_escaped_json_string(oss, m_subaddress_labels[i][j]);
|
||||
+ oss << "\"";
|
||||
+ }
|
||||
+ oss << "]";
|
||||
+ }
|
||||
+ oss << "\n ]";
|
||||
+
|
||||
+ // FIELD(m_additional_tx_keys) - serializable_unordered_map<crypto::hash, std::vector<crypto::secret_key>>
|
||||
+ ar.tag("m_additional_tx_keys");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::hash, std::vector<crypto::secret_key>>&>(m_additional_tx_keys))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_additional_tx_keys\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_attributes) - serializable_unordered_map<std::string, std::string> - manual JSON serialization
|
||||
+ oss << ", \n \"m_attributes\": {";
|
||||
+ bool first_attr = true;
|
||||
+ for (const auto& attr : m_attributes) {
|
||||
+ if (!first_attr) oss << ", ";
|
||||
+ first_attr = false;
|
||||
+ oss << "\n \"";
|
||||
+ write_escaped_json_string(oss, attr.first);
|
||||
+ oss << "\": \"";
|
||||
+ write_escaped_json_string(oss, attr.second);
|
||||
+ oss << "\"";
|
||||
+ }
|
||||
+ oss << "\n }";
|
||||
+
|
||||
+ // FIELD(m_account_tags) - std::pair<serializable_map<std::string, std::string>, std::vector<std::string>> - manual JSON serialization
|
||||
+ oss << ", \n \"m_account_tags\": {";
|
||||
+ oss << "\n \"tags_map\": {";
|
||||
+ bool first_tag = true;
|
||||
+ for (const auto& tag : m_account_tags.first) {
|
||||
+ if (!first_tag) oss << ", ";
|
||||
+ first_tag = false;
|
||||
+ oss << "\n \"";
|
||||
+ write_escaped_json_string(oss, tag.first);
|
||||
+ oss << "\": \"";
|
||||
+ write_escaped_json_string(oss, tag.second);
|
||||
+ oss << "\"";
|
||||
+ }
|
||||
+ oss << "\n },";
|
||||
+ oss << "\n \"account_list\": [";
|
||||
+ for (size_t i = 0; i < m_account_tags.second.size(); ++i) {
|
||||
+ if (i > 0) oss << ", ";
|
||||
+ oss << "\n \"";
|
||||
+ write_escaped_json_string(oss, m_account_tags.second[i]);
|
||||
+ oss << "\"";
|
||||
+ }
|
||||
+ oss << "\n ]";
|
||||
+ oss << "\n }";
|
||||
+
|
||||
+ // FIELD(m_ring_history_saved) - bool
|
||||
+ // ar.tag("m_ring_history_saved");
|
||||
+ // ar.serialize_blob(&m_ring_history_saved, sizeof(m_ring_history_saved));
|
||||
+ // if (!ar.good()) {
|
||||
+ // json_result = "{\"error\":\"Failed to serialize m_ring_history_saved\"}";
|
||||
+ // return json_result.c_str();
|
||||
+ // }
|
||||
+
|
||||
+ // FIELD(m_last_block_reward) - uint64_t
|
||||
+ ar.tag("m_last_block_reward");
|
||||
+ ar.serialize_int(m_last_block_reward);
|
||||
+ if (!ar.good()) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_last_block_reward\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_tx_device) - serializable_unordered_map<crypto::hash, std::string>
|
||||
+ ar.tag("m_tx_device");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::hash, std::string>&>(m_tx_device))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_tx_device\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_device_last_key_image_sync) - uint64_t
|
||||
+ ar.tag("m_device_last_key_image_sync");
|
||||
+ ar.serialize_int(m_device_last_key_image_sync);
|
||||
+ if (!ar.good()) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_device_last_key_image_sync\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_cold_key_images) - serializable_unordered_map<crypto::public_key, crypto::key_image>
|
||||
+ ar.tag("m_cold_key_images");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::public_key, crypto::key_image>&>(m_cold_key_images))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_cold_key_images\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_rpc_client_secret_key) - crypto::secret_key
|
||||
+ // ar.tag("m_rpc_client_secret_key");
|
||||
+ // ar.serialize_blob(&m_rpc_client_secret_key, sizeof(m_rpc_client_secret_key));
|
||||
+ // if (!ar.good()) {
|
||||
+ // json_result = "{\"error\":\"Failed to serialize m_rpc_client_secret_key\"}";
|
||||
+ // return json_result.c_str();
|
||||
+ // }
|
||||
+
|
||||
+ // Version-dependent fields
|
||||
+ if (version >= 1) {
|
||||
+ // FIELD(m_has_ever_refreshed_from_node) - bool
|
||||
+ // ar.tag("m_has_ever_refreshed_from_node");
|
||||
+ // ar.serialize_blob(&m_has_ever_refreshed_from_node, sizeof(m_has_ever_refreshed_from_node));
|
||||
+ // if (!ar.good()) {
|
||||
+ // json_result = "{\"error\":\"Failed to serialize m_has_ever_refreshed_from_node\"}";
|
||||
+ // return json_result.c_str();
|
||||
+ // }
|
||||
+ }
|
||||
+
|
||||
+ if (version >= 2) {
|
||||
+ // FIELD(m_background_sync_data) - background_sync_data_t
|
||||
+ ar.tag("m_background_sync_data");
|
||||
+ if (!::serialization::serialize(ar, const_cast<background_sync_data_t&>(m_background_sync_data))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_background_sync_data\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ ar.end_object();
|
||||
+
|
||||
+ if (!ar.good()) {
|
||||
+ json_result = "{\"error\":\"Failed to finalize JSON serialization\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ json_result = oss.str();
|
||||
+
|
||||
+ // Post-process to fix malformed JSON
|
||||
+ post_process_json(json_result);
|
||||
+
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+ catch (const std::exception& e)
|
||||
+ {
|
||||
+ json_result = "{\"error\":\"Failed to serialize wallet cache: " + std::string(e.what()) + "\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+} // namespace tools
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -99,8 +99,8 @@ index 6095f99d5..b163212b7 100644
|
||||
rpc_base
|
||||
+ bc-ur
|
||||
multisig
|
||||
carrot_impl
|
||||
common
|
||||
cryptonote_core
|
||||
diff --git a/src/wallet/api/pending_transaction.cpp b/src/wallet/api/pending_transaction.cpp
|
||||
index 70a702796..9c3c26ee5 100644
|
||||
--- a/src/wallet/api/pending_transaction.cpp
|
||||
@@ -815,7 +815,7 @@ index b827b826f..765cefb32 100644
|
||||
if (unused_dust_indices_per_subaddr.empty())
|
||||
unused_dust_indices_per_subaddr.push_back({});
|
||||
@@ -13742,33 +13775,40 @@ crypto::public_key wallet2::get_tx_pub_key_from_received_outs(const tools::walle
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::export_key_images(const std::string &filename, bool all) const
|
||||
{
|
||||
- PERF_TIMER(export_key_images);
|
||||
|
||||
@@ -1,43 +1,59 @@
|
||||
From 904fe95204ba02d1a8c81fc46c1423ba1685c94f Mon Sep 17 00:00:00 2001
|
||||
From 11ddba5ab1470fb46a87ea9b702bf11f88763ecc Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Wed, 26 Jun 2024 15:04:38 +0200
|
||||
Subject: [PATCH 06/14] add dummy device for ledger
|
||||
Date: Thu, 8 May 2025 13:14:23 +0200
|
||||
Subject: [PATCH 06/17] add dummy device for ledger
|
||||
|
||||
---
|
||||
CMakeLists.txt | 6 +-
|
||||
external/randomx | 2 +-
|
||||
src/device/CMakeLists.txt | 6 +-
|
||||
src/device/device.cpp | 10 ++-
|
||||
src/device/device.cpp | 10 +-
|
||||
src/device/device.hpp | 12 +--
|
||||
src/device/device_io_dummy.cpp | 133 ++++++++++++++++++++++++++++++
|
||||
src/device/device_io_dummy.hpp | 74 +++++++++++++++++
|
||||
src/device/device_io_dummy.cpp | 161 ++++++++++++++++++++++++++++++
|
||||
src/device/device_io_dummy.hpp | 82 +++++++++++++++
|
||||
src/device/device_ledger.cpp | 6 +-
|
||||
src/device/device_ledger.hpp | 7 +-
|
||||
src/wallet/api/wallet.cpp | 94 +++++++++++++++++++++
|
||||
src/wallet/api/wallet.h | 18 ++++
|
||||
src/wallet/api/wallet2_api.h | 12 +++
|
||||
src/wallet/api/wallet.cpp | 100 +++++++++++++++++++
|
||||
src/wallet/api/wallet.h | 14 +++
|
||||
src/wallet/api/wallet2_api.h | 13 +++
|
||||
src/wallet/api/wallet_manager.cpp | 12 ++-
|
||||
12 files changed, 365 insertions(+), 25 deletions(-)
|
||||
13 files changed, 405 insertions(+), 26 deletions(-)
|
||||
create mode 100644 src/device/device_io_dummy.cpp
|
||||
create mode 100644 src/device/device_io_dummy.hpp
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index c73b813d8..5c0f31cb8 100644
|
||||
index c73b813d8..ce5ef4bab 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -692,8 +692,12 @@ include_directories(${LMDB_INCLUDE})
|
||||
@@ -692,16 +692,21 @@ include_directories(${LMDB_INCLUDE})
|
||||
include_directories(${LIBUNWIND_INCLUDE})
|
||||
link_directories(${LIBUNWIND_LIBRARY_DIRS})
|
||||
|
||||
-# Final setup for hid
|
||||
-if (HIDAPI_FOUND)
|
||||
- message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}")
|
||||
- add_definitions(-DHAVE_HIDAPI)
|
||||
- include_directories(${HIDAPI_INCLUDE_DIR})
|
||||
- link_directories(${LIBHIDAPI_LIBRARY_DIRS})
|
||||
+if (HIDAPI_DUMMY)
|
||||
+ add_definitions(-DHIDAPI_DUMMY)
|
||||
+endif()
|
||||
else()
|
||||
- message(STATUS "Could not find HIDAPI")
|
||||
+ # Final setup for hid
|
||||
+ if (HIDAPI_FOUND)
|
||||
+ message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}")
|
||||
+ add_definitions(-DHAVE_HIDAPI)
|
||||
+ include_directories(${HIDAPI_INCLUDE_DIR})
|
||||
+ link_directories(${LIBHIDAPI_LIBRARY_DIRS})
|
||||
+ else()
|
||||
+ message(STATUS "Could not find HIDAPI")
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
+
|
||||
# Final setup for hid
|
||||
-if (HIDAPI_FOUND)
|
||||
+if (HIDAPI_FOUND)
|
||||
message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}")
|
||||
add_definitions(-DHAVE_HIDAPI)
|
||||
include_directories(${HIDAPI_INCLUDE_DIR})
|
||||
# Trezor support check
|
||||
include(CheckTrezor)
|
||||
|
||||
diff --git a/src/device/CMakeLists.txt b/src/device/CMakeLists.txt
|
||||
index e4f1159b5..14d398f87 100644
|
||||
--- a/src/device/CMakeLists.txt
|
||||
@@ -131,10 +147,10 @@ index 392703a24..ffd419779 100644
|
||||
|
||||
diff --git a/src/device/device_io_dummy.cpp b/src/device/device_io_dummy.cpp
|
||||
new file mode 100644
|
||||
index 000000000..edb4beea3
|
||||
index 000000000..01e6fc7b7
|
||||
--- /dev/null
|
||||
+++ b/src/device/device_io_dummy.cpp
|
||||
@@ -0,0 +1,133 @@
|
||||
@@ -0,0 +1,161 @@
|
||||
+// Copyright (c) 2017-2022, The Monero Project
|
||||
+//
|
||||
+// All rights reserved.
|
||||
@@ -189,6 +205,10 @@ index 000000000..edb4beea3
|
||||
+size_t hw::io::device_io_dummy::receivedFromDeviceLength = 0;
|
||||
+bool hw::io::device_io_dummy::waitsForDeviceSend = false;
|
||||
+bool hw::io::device_io_dummy::waitsForDeviceReceive = false;
|
||||
+void (*hw::io::device_io_dummy::sendToLedgerDeviceCallback)(unsigned char *command, unsigned int cmd_len) = nullptr;
|
||||
+std::mutex hw::io::device_io_dummy::mutex;
|
||||
+std::condition_variable hw::io::device_io_dummy::cv_send;
|
||||
+std::condition_variable hw::io::device_io_dummy::cv_receive;
|
||||
+
|
||||
+namespace hw {
|
||||
+ namespace io {
|
||||
@@ -227,22 +247,29 @@ index 000000000..edb4beea3
|
||||
+
|
||||
+ int device_io_dummy::exchange(unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len, bool user_input) {
|
||||
+ MDEBUG("exchange(): locking mutex");
|
||||
+ boost::unique_lock<boost::mutex> lock(mutex);
|
||||
+ std::unique_lock<std::mutex> lock(mutex);
|
||||
+ sendToDevice = command;
|
||||
+ sendToDeviceLength = cmd_len;
|
||||
+ waitsForDeviceSend = true;
|
||||
+ waitsForDeviceReceive = true;
|
||||
+
|
||||
+ // Call the callback if it's set
|
||||
+ if (sendToLedgerDeviceCallback != nullptr) {
|
||||
+ MDEBUG("exchange(): calling sendToLedgerDeviceCallback");
|
||||
+ sendToLedgerDeviceCallback(command, cmd_len);
|
||||
+ }
|
||||
+ MDEBUG("exchange(): waitsForDeviceSend");
|
||||
+ // NOTE: waitsForDeviceSend should be changed by external code
|
||||
+ // Wait for the send flag to be cleared by external code
|
||||
+ while (waitsForDeviceSend) {
|
||||
+ usleep(1000);
|
||||
+ MDEBUG("exchange(): waitsForDeviceSend (still)");
|
||||
+ cv_send.wait(lock);
|
||||
+ MDEBUG("exchange(): waitsForDeviceSend notified");
|
||||
+ }
|
||||
+
|
||||
+ MDEBUG("exchange(): waitsForDeviceReceive");
|
||||
+ // Wait for the receive flag to be cleared by external code
|
||||
+ while (waitsForDeviceReceive) {
|
||||
+ usleep(1000);
|
||||
+ MDEBUG("exchange(): waitsForDeviceReceive (still)");
|
||||
+ cv_receive.wait(lock);
|
||||
+ MDEBUG("exchange(): waitsForDeviceReceive notified");
|
||||
+ }
|
||||
+
|
||||
+ if (receivedFromDeviceLength > max_resp_len) {
|
||||
@@ -250,7 +277,8 @@ index 000000000..edb4beea3
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ memset(response,0,max_resp_len);
|
||||
+
|
||||
+ memset(response, 0, max_resp_len);
|
||||
+ memcpy(response, receivedFromDevice, receivedFromDeviceLength);
|
||||
+ return receivedFromDeviceLength;
|
||||
+ }
|
||||
@@ -263,18 +291,34 @@ index 000000000..edb4beea3
|
||||
+ MDEBUG("release()");
|
||||
+ }
|
||||
+
|
||||
+ void device_io_dummy::setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)) {
|
||||
+ MDEBUG("setLedgerCallback()");
|
||||
+ sendToLedgerDeviceCallback = sendToLedgerDevice;
|
||||
+ }
|
||||
+
|
||||
+ void device_io_dummy::setDeviceReceivedData(unsigned char* data, size_t len) {
|
||||
+ MDEBUG("setDeviceReceivedData(len: " << len << ")");
|
||||
+ std::unique_lock<std::mutex> lock(mutex);
|
||||
+
|
||||
+ receivedFromDevice = static_cast<unsigned char *>(malloc(len));
|
||||
+ receivedFromDeviceLength = len;
|
||||
+ memset(receivedFromDevice, 0, len);
|
||||
+ memcpy(receivedFromDevice, data, len);
|
||||
+ waitsForDeviceReceive = false;
|
||||
+ waitsForDeviceSend = false;
|
||||
+ cv_send.notify_all();
|
||||
+ cv_receive.notify_all();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+#endif // HAVE_HIDAPI
|
||||
\ No newline at end of file
|
||||
diff --git a/src/device/device_io_dummy.hpp b/src/device/device_io_dummy.hpp
|
||||
new file mode 100644
|
||||
index 000000000..a1733616d
|
||||
index 000000000..1128b9c1d
|
||||
--- /dev/null
|
||||
+++ b/src/device/device_io_dummy.hpp
|
||||
@@ -0,0 +1,74 @@
|
||||
@@ -0,0 +1,82 @@
|
||||
+// Copyright (c) 2017-2022, The Monero Project
|
||||
+//
|
||||
+// All rights reserved.
|
||||
@@ -309,6 +353,8 @@ index 000000000..a1733616d
|
||||
+
|
||||
+#include "device_io.hpp"
|
||||
+#include "device_io_hid.hpp"
|
||||
+#include <mutex>
|
||||
+#include <condition_variable>
|
||||
+
|
||||
+namespace hw {
|
||||
+ namespace io {
|
||||
@@ -320,9 +366,11 @@ index 000000000..a1733616d
|
||||
+ };
|
||||
+ class device_io_dummy : device_io {
|
||||
+ private:
|
||||
+ boost::mutex mutex;
|
||||
+ static std::mutex mutex;
|
||||
+
|
||||
+ public:
|
||||
+ static std::condition_variable cv_send;
|
||||
+ static std::condition_variable cv_receive;
|
||||
+ static bool stateIsConnected;
|
||||
+ static unsigned char* sendToDevice;
|
||||
+ static size_t sendToDeviceLength;
|
||||
@@ -330,6 +378,7 @@ index 000000000..a1733616d
|
||||
+ static size_t receivedFromDeviceLength;
|
||||
+ static bool waitsForDeviceSend;
|
||||
+ static bool waitsForDeviceReceive;
|
||||
+ static void (*sendToLedgerDeviceCallback)(unsigned char *command, unsigned int cmd_len);
|
||||
+
|
||||
+ device_io_dummy() = default;
|
||||
+ device_io_dummy(int a, int b, int c, int d);
|
||||
@@ -343,7 +392,10 @@ index 000000000..a1733616d
|
||||
+ void disconnect();
|
||||
+ bool connected() const;
|
||||
+
|
||||
+ int exchange(unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len, bool user_input);
|
||||
+ int exchange(unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len, bool user_input);
|
||||
+
|
||||
+ static void setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len));
|
||||
+ static void setDeviceReceivedData(unsigned char* data, size_t len);
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
@@ -362,7 +414,7 @@ index bb5b6f497..046201a1e 100644
|
||||
|
||||
namespace {
|
||||
bool apdu_verbose =true;
|
||||
@@ -300,7 +300,7 @@ namespace hw {
|
||||
@@ -299,7 +299,7 @@ namespace hw {
|
||||
|
||||
device_ledger::device_ledger(): hw_device(0x0101, 0x05, 64, 2000) {
|
||||
this->id = device_id++;
|
||||
@@ -402,7 +454,7 @@ index 03058c4f1..39454ca6d 100644
|
||||
|
||||
// Origin: https://github.com/LedgerHQ/ledger-app-monero/blob/master/src/monero_types.h
|
||||
#define SW_OK 0x9000
|
||||
@@ -143,7 +144,11 @@ namespace hw {
|
||||
@@ -142,7 +143,11 @@ namespace hw {
|
||||
mutable std::mutex command_locker;
|
||||
|
||||
//IO
|
||||
@@ -415,10 +467,10 @@ index 03058c4f1..39454ca6d 100644
|
||||
unsigned char buffer_send[BUFFER_SEND_SIZE];
|
||||
unsigned int length_recv;
|
||||
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
|
||||
index 3fcd6f332..25ade04a7 100644
|
||||
index 3fcd6f332..844a1c451 100644
|
||||
--- a/src/wallet/api/wallet.cpp
|
||||
+++ b/src/wallet/api/wallet.cpp
|
||||
@@ -48,6 +48,9 @@
|
||||
@@ -49,6 +49,9 @@
|
||||
#include <boost/locale.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "bc-ur/src/bc-ur.hpp"
|
||||
@@ -428,91 +480,87 @@ index 3fcd6f332..25ade04a7 100644
|
||||
|
||||
using namespace std;
|
||||
using namespace cryptonote;
|
||||
@@ -3186,6 +3189,97 @@ uint64_t WalletImpl::getBytesSent()
|
||||
@@ -3178,6 +3181,103 @@ uint64_t WalletImpl::getBytesSent()
|
||||
return m_wallet->get_bytes_sent();
|
||||
}
|
||||
|
||||
+
|
||||
+// HIDAPI_DUMMY
|
||||
+bool WalletImpl::getStateIsConnected() {
|
||||
+bool Wallet::getStateIsConnected() {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return false;
|
||||
+ #else
|
||||
+ return hw::io::device_io_dummy::stateIsConnected;
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+unsigned char* WalletImpl::getSendToDevice() {
|
||||
+unsigned char* Wallet::getSendToDevice() {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return {};
|
||||
+ #else
|
||||
+ return hw::io::device_io_dummy::sendToDevice;
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+size_t WalletImpl::getSendToDeviceLength() {
|
||||
+size_t Wallet::getSendToDeviceLength() {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return -1;
|
||||
+ #else
|
||||
+ return hw::io::device_io_dummy::sendToDeviceLength;
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+unsigned char* WalletImpl::getReceivedFromDevice() {
|
||||
+unsigned char* Wallet::getReceivedFromDevice() {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return {};
|
||||
+ #else
|
||||
+ return hw::io::device_io_dummy::receivedFromDevice;
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+size_t WalletImpl::getReceivedFromDeviceLength() {
|
||||
+size_t Wallet::getReceivedFromDeviceLength() {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return -1;
|
||||
+ #else
|
||||
+ return hw::io::device_io_dummy::receivedFromDeviceLength;
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+bool WalletImpl::getWaitsForDeviceSend() {
|
||||
+bool Wallet::getWaitsForDeviceSend() {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return false;
|
||||
+ #else
|
||||
+ return hw::io::device_io_dummy::receivedFromDeviceLength;
|
||||
+ return hw::io::device_io_dummy::waitsForDeviceSend;
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+bool WalletImpl::getWaitsForDeviceReceive() {
|
||||
+bool Wallet::getWaitsForDeviceReceive() {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return false;
|
||||
+ #else
|
||||
+ return hw::io::device_io_dummy::waitsForDeviceReceive;
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+void WalletImpl::setDeviceReceivedData(unsigned char* data, size_t len) {
|
||||
+void Wallet::setDeviceReceivedData(unsigned char* data, size_t len) {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return;
|
||||
+ #else
|
||||
+ hw::io::device_io_dummy::receivedFromDevice = static_cast<unsigned char *>(malloc(len));
|
||||
+ hw::io::device_io_dummy::receivedFromDeviceLength = len;
|
||||
+ memset(hw::io::device_io_dummy::receivedFromDevice, 0, len);
|
||||
+ memcpy(hw::io::device_io_dummy::receivedFromDevice, data, len);
|
||||
+ hw::io::device_io_dummy::waitsForDeviceReceive = false;
|
||||
+ hw::io::device_io_dummy::setDeviceReceivedData(data, len);
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+void WalletImpl::setDeviceSendData(unsigned char* data, size_t len) {
|
||||
+void Wallet::setDeviceSendData(unsigned char* data, size_t len) {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ setStatusError("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return;
|
||||
+ #else
|
||||
+ hw::io::device_io_dummy::sendToDevice = static_cast<unsigned char *>(malloc(len));
|
||||
@@ -520,6 +568,16 @@ index 3fcd6f332..25ade04a7 100644
|
||||
+ memset(hw::io::device_io_dummy::sendToDevice, 0, len);
|
||||
+ memcpy(hw::io::device_io_dummy::sendToDevice, data, len);
|
||||
+ hw::io::device_io_dummy::waitsForDeviceSend = false;
|
||||
+ hw::io::device_io_dummy::cv_send.notify_all();
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
+void Wallet::setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)) {
|
||||
+ #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))
|
||||
+ MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))");
|
||||
+ return;
|
||||
+ #else
|
||||
+ hw::io::device_io_dummy::setLedgerCallback(sendToLedgerDevice);
|
||||
+ #endif
|
||||
+}
|
||||
+
|
||||
@@ -527,10 +585,10 @@ index 3fcd6f332..25ade04a7 100644
|
||||
{
|
||||
auto yi = new YieldInfoImpl(*this);
|
||||
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
|
||||
index edf8bb8ce..4e9c21ecb 100644
|
||||
index edf8bb8ce..6bfb61cb8 100644
|
||||
--- a/src/wallet/api/wallet.h
|
||||
+++ b/src/wallet/api/wallet.h
|
||||
@@ -301,6 +301,24 @@ private:
|
||||
@@ -315,6 +315,20 @@ private:
|
||||
// cache connection status to avoid unnecessary RPC calls
|
||||
mutable std::atomic<bool> m_is_connected;
|
||||
boost::optional<epee::net_utils::http::login> m_daemon_login{};
|
||||
@@ -548,33 +606,30 @@ index edf8bb8ce..4e9c21ecb 100644
|
||||
+ bool getWaitsForDeviceSend();
|
||||
+
|
||||
+ bool getWaitsForDeviceReceive();
|
||||
+
|
||||
+ void setDeviceReceivedData(unsigned char *data, size_t len);
|
||||
+
|
||||
+ void setDeviceSendData(unsigned char *data, size_t len);
|
||||
};
|
||||
|
||||
|
||||
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
|
||||
index 764adbfbf..53ec4abfc 100644
|
||||
index 764adbfbf..a48a6be54 100644
|
||||
--- a/src/wallet/api/wallet2_api.h
|
||||
+++ b/src/wallet/api/wallet2_api.h
|
||||
@@ -1150,6 +1150,18 @@ struct Wallet
|
||||
@@ -1231,6 +1231,19 @@ struct Wallet
|
||||
|
||||
//! get bytes sent
|
||||
virtual uint64_t getBytesSent() = 0;
|
||||
+
|
||||
+ // HIDAPI_DUMMY
|
||||
+ virtual bool getStateIsConnected() = 0;
|
||||
+ virtual unsigned char* getSendToDevice() = 0;
|
||||
+ virtual size_t getSendToDeviceLength() = 0;
|
||||
+ virtual unsigned char* getReceivedFromDevice() = 0;
|
||||
+ virtual size_t getReceivedFromDeviceLength() = 0;
|
||||
+ virtual bool getWaitsForDeviceSend() = 0;
|
||||
+ virtual bool getWaitsForDeviceReceive() = 0;
|
||||
+ static bool getStateIsConnected();
|
||||
+ static unsigned char* getSendToDevice();
|
||||
+ static size_t getSendToDeviceLength();
|
||||
+ static unsigned char* getReceivedFromDevice();
|
||||
+ static size_t getReceivedFromDeviceLength();
|
||||
+ static bool getWaitsForDeviceSend();
|
||||
+ static bool getWaitsForDeviceReceive();
|
||||
+
|
||||
+ virtual void setDeviceReceivedData(unsigned char* data, size_t len) = 0;
|
||||
+ virtual void setDeviceSendData(unsigned char* data, size_t len) = 0;
|
||||
+ static void setDeviceReceivedData(unsigned char* data, size_t len);
|
||||
+ static void setDeviceSendData(unsigned char* data, size_t len);
|
||||
+ static void setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len));
|
||||
|
||||
//! get yield information
|
||||
virtual YieldInfo * getYieldInfo() = 0;
|
||||
@@ -602,5 +657,5 @@ index e81b8f83a..277be6ac9 100644
|
||||
|
||||
std::vector<std::string> WalletManagerImpl::findWallets(const std::string &path)
|
||||
--
|
||||
2.48.1
|
||||
2.49.0
|
||||
|
||||
|
||||
@@ -59,10 +59,10 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 5c0f31cb8..f0630ef9b 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -371,6 +371,8 @@ if(NOT MANUAL_SUBMODULES)
|
||||
check_submodule(external/trezor-common)
|
||||
@@ -372,6 +372,8 @@ if(NOT MANUAL_SUBMODULES)
|
||||
check_submodule(external/randomx)
|
||||
check_submodule(external/supercop)
|
||||
check_submodule(external/mx25519)
|
||||
+ check_submodule(external/polyseed)
|
||||
+ check_submodule(external/utf8proc)
|
||||
endif()
|
||||
@@ -72,8 +72,8 @@ index 5c0f31cb8..f0630ef9b 100644
|
||||
set(BSDI TRUE)
|
||||
endif()
|
||||
|
||||
-include_directories(external/rapidjson/include external/easylogging++ src contrib/epee/include external external/supercop/include)
|
||||
+include_directories(external/rapidjson/include external/easylogging++ src contrib/epee/include external external/supercop/include external/polyseed/include external/utf8proc)
|
||||
-include_directories(external/rapidjson/include external/easylogging++ src contrib/epee/include external external/supercop/include external/mx25519/include)
|
||||
+include_directories(external/rapidjson/include external/easylogging++ src contrib/epee/include external external/supercop/include external/mx25519/include external/polyseed/include external/utf8proc)
|
||||
|
||||
if(APPLE)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
@@ -157,8 +157,8 @@ index 3335d3c21..06b708cf0 100644
|
||||
add_subdirectory(mnemonics)
|
||||
+add_subdirectory(polyseed)
|
||||
add_subdirectory(rpc)
|
||||
add_subdirectory(seraphis_crypto)
|
||||
if(NOT IOS)
|
||||
add_subdirectory(serialization)
|
||||
diff --git a/src/cryptonote_basic/CMakeLists.txt b/src/cryptonote_basic/CMakeLists.txt
|
||||
index 1414be1b2..414936a05 100644
|
||||
--- a/src/cryptonote_basic/CMakeLists.txt
|
||||
@@ -175,7 +175,7 @@ diff --git a/src/cryptonote_basic/account.cpp b/src/cryptonote_basic/account.cpp
|
||||
index 4e87d4477..2d556f285 100644
|
||||
--- a/src/cryptonote_basic/account.cpp
|
||||
+++ b/src/cryptonote_basic/account.cpp
|
||||
@@ -87,12 +87,16 @@ DISABLE_VS_WARNINGS(4244 4345)
|
||||
@@ -89,12 +89,16 @@ DISABLE_VS_WARNINGS(4244 4345)
|
||||
void account_keys::xor_with_key_stream(const crypto::chacha_key &key)
|
||||
{
|
||||
// encrypt a large enough byte stream with chacha20
|
||||
@@ -193,16 +193,16 @@ index 4e87d4477..2d556f285 100644
|
||||
for (crypto::secret_key &k: m_multisig_keys)
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(crypto::secret_key); ++i)
|
||||
@@ -150,6 +154,8 @@ DISABLE_VS_WARNINGS(4244 4345)
|
||||
{
|
||||
m_keys.m_spend_secret_key = crypto::secret_key();
|
||||
@@ -153,6 +158,8 @@ DISABLE_VS_WARNINGS(4244 4345)
|
||||
m_keys.s_master = m_keys.m_spend_secret_key;
|
||||
m_keys.k_prove_spend = m_keys.m_spend_secret_key;
|
||||
m_keys.m_multisig_keys.clear();
|
||||
+ m_keys.m_polyseed = crypto::secret_key();
|
||||
+ m_keys.m_passphrase.wipe();
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
void account_base::set_spend_key(const crypto::secret_key& spend_secret_key)
|
||||
@@ -255,6 +261,21 @@ DISABLE_VS_WARNINGS(4244 4345)
|
||||
@@ -260,6 +267,21 @@ DISABLE_VS_WARNINGS(4244 4345)
|
||||
create_from_keys(address, fake, viewkey);
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
@@ -234,18 +234,18 @@ index 93d1d28f0..1f76febce 100644
|
||||
#include "serialization/keyvalue_serialization.h"
|
||||
+#include "polyseed/polyseed.hpp"
|
||||
|
||||
namespace cryptonote
|
||||
{
|
||||
@@ -45,6 +46,8 @@ namespace cryptonote
|
||||
#include "carrot_core/account_secrets.h"
|
||||
#include "carrot_core/address_utils.h"
|
||||
@@ -52,6 +53,8 @@ namespace cryptonote
|
||||
std::vector<crypto::secret_key> m_multisig_keys;
|
||||
hw::device *m_device = &hw::get_device("default");
|
||||
crypto::chacha_iv m_encryption_iv;
|
||||
+ crypto::secret_key m_polyseed;
|
||||
+ epee::wipeable_string m_passphrase; // Only used with polyseed
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(m_account_address)
|
||||
@@ -53,6 +56,8 @@ namespace cryptonote
|
||||
// carrot secret keys (minus k_v, which is shared with legacy k_v)
|
||||
crypto::secret_key s_master;
|
||||
@@ -71,6 +74,8 @@ namespace cryptonote
|
||||
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(m_multisig_keys)
|
||||
const crypto::chacha_iv default_iv{{0, 0, 0, 0, 0, 0, 0, 0}};
|
||||
KV_SERIALIZE_VAL_POD_AS_BLOB_OPT(m_encryption_iv, default_iv)
|
||||
@@ -254,7 +254,7 @@ index 93d1d28f0..1f76febce 100644
|
||||
END_KV_SERIALIZE_MAP()
|
||||
|
||||
void encrypt(const crypto::chacha_key &key);
|
||||
@@ -79,6 +84,7 @@ namespace cryptonote
|
||||
@@ -99,6 +104,7 @@ namespace cryptonote
|
||||
void create_from_device(hw::device &hwdev);
|
||||
void create_from_keys(const cryptonote::account_public_address& address, const crypto::secret_key& spendkey, const crypto::secret_key& viewkey);
|
||||
void create_from_viewkey(const cryptonote::account_public_address& address, const crypto::secret_key& viewkey);
|
||||
@@ -1018,9 +1018,9 @@ index 765cefb32..806de969a 100644
|
||||
#include "device_trezor/device_trezor.hpp"
|
||||
#include "net/socks_connect.h"
|
||||
+#include "polyseed/include/polyseed.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "carrot_impl/format_utils.h"
|
||||
#include "tx_builder.h"
|
||||
#include "scanning_tools.h"
|
||||
@@ -1273,7 +1274,8 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended, std
|
||||
m_send_change_back_to_subaddress(false),
|
||||
m_pool_info_query_time(0),
|
||||
@@ -1051,7 +1051,7 @@ index 765cefb32..806de969a 100644
|
||||
+//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::get_multisig_seed(epee::wipeable_string& seed, const epee::wipeable_string &passphrase) const
|
||||
{
|
||||
bool ready;
|
||||
const multisig::multisig_account_status ms_status{get_multisig_status()};
|
||||
@@ -5313,6 +5329,9 @@ boost::optional<wallet2::keys_file_data> wallet2::get_keys_file_data(const crypt
|
||||
value2.SetInt(m_enable_multisig ? 1 : 0);
|
||||
json.AddMember("enable_multisig", value2, json.GetAllocator());
|
||||
|
||||
@@ -87,7 +87,7 @@ new file mode 100644
|
||||
index 000000000..ef12141cf
|
||||
--- /dev/null
|
||||
+++ b/src/wallet/api/coins.cpp
|
||||
@@ -0,0 +1,186 @@
|
||||
@@ -0,0 +1,194 @@
|
||||
+#include "coins.h"
|
||||
+#include "coins_info.h"
|
||||
+#include "wallet.h"
|
||||
@@ -153,6 +153,12 @@ index 000000000..ef12141cf
|
||||
+ {
|
||||
+ const tools::wallet2::transfer_details &td = m_wallet->m_wallet->get_transfer_details(i);
|
||||
+
|
||||
+ // Make a subaddress_index_extended from td.m_subaddr_index
|
||||
+ carrot::subaddress_index_extended csub{
|
||||
+ {td.m_subaddr_index.major, td.m_subaddr_index.minor},
|
||||
+ td.is_carrot() ? carrot::AddressDeriveType::Carrot : carrot::AddressDeriveType::PreCarrot,
|
||||
+ false};
|
||||
+
|
||||
+ auto ci = new CoinsInfoImpl();
|
||||
+ ci->m_blockHeight = td.m_block_height;
|
||||
+ ci->m_hash = string_tools::pod_to_hex(td.m_txid);
|
||||
@@ -167,7 +173,7 @@ index 000000000..ef12141cf
|
||||
+ ci->m_pkIndex = td.m_pk_index;
|
||||
+ ci->m_subaddrIndex = td.m_subaddr_index.minor;
|
||||
+ ci->m_subaddrAccount = td.m_subaddr_index.major;
|
||||
+ ci->m_address = m_wallet->m_wallet->get_subaddress_as_str(td.m_subaddr_index); // todo: this is expensive, cache maybe?
|
||||
+ ci->m_address = m_wallet->m_wallet->get_subaddress_as_str(csub); // todo: this is expensive, cache maybe?
|
||||
+ ci->m_addressLabel = m_wallet->m_wallet->get_subaddress_label(td.m_subaddr_index);
|
||||
+ ci->m_keyImage = string_tools::pod_to_hex(td.m_key_image);
|
||||
+ ci->m_unlockTime = td.m_tx.unlock_time;
|
||||
@@ -175,6 +181,8 @@ index 000000000..ef12141cf
|
||||
+ ci->m_pubKey = string_tools::pod_to_hex(td.get_public_key());
|
||||
+ ci->m_coinbase = td.m_tx.vin.size() == 1 && td.m_tx.vin[0].type() == typeid(cryptonote::txin_gen);
|
||||
+ ci->m_description = m_wallet->m_wallet->get_tx_note(td.m_txid);
|
||||
+ ci->m_asset = td.asset_type;
|
||||
+ ci->m_type = td.m_tx.type;
|
||||
+
|
||||
+ m_rows.push_back(ci);
|
||||
+ }
|
||||
@@ -325,7 +333,7 @@ new file mode 100644
|
||||
index 000000000..5f2c4e1e4
|
||||
--- /dev/null
|
||||
+++ b/src/wallet/api/coins_info.cpp
|
||||
@@ -0,0 +1,122 @@
|
||||
@@ -0,0 +1,132 @@
|
||||
+#include "coins_info.h"
|
||||
+
|
||||
+using namespace std;
|
||||
@@ -349,6 +357,7 @@ index 000000000..5f2c4e1e4
|
||||
+ , m_subaddrIndex(0)
|
||||
+ , m_unlockTime(0)
|
||||
+ , m_unlocked(false)
|
||||
+ , m_type(0)
|
||||
+{
|
||||
+
|
||||
+}
|
||||
@@ -445,6 +454,15 @@ index 000000000..5f2c4e1e4
|
||||
+string CoinsInfoImpl::description() const {
|
||||
+ return m_description;
|
||||
+}
|
||||
+
|
||||
+string CoinsInfoImpl::asset() const {
|
||||
+ return m_asset;
|
||||
+}
|
||||
+
|
||||
+uint8_t CoinsInfoImpl::type() const {
|
||||
+ return m_type;
|
||||
+}
|
||||
+
|
||||
+} // namespace
|
||||
+
|
||||
+namespace Bitmonero = Monero;
|
||||
@@ -453,7 +471,7 @@ new file mode 100644
|
||||
index 000000000..c43e45abd
|
||||
--- /dev/null
|
||||
+++ b/src/wallet/api/coins_info.h
|
||||
@@ -0,0 +1,71 @@
|
||||
@@ -0,0 +1,75 @@
|
||||
+#ifndef FEATHER_COINS_INFO_H
|
||||
+#define FEATHER_COINS_INFO_H
|
||||
+
|
||||
@@ -492,6 +510,8 @@ index 000000000..c43e45abd
|
||||
+ virtual std::string pubKey() const override;
|
||||
+ virtual bool coinbase() const override;
|
||||
+ virtual std::string description() const override;
|
||||
+ virtual std::string asset() const override;
|
||||
+ virtual uint8_t type() const override;
|
||||
+
|
||||
+private:
|
||||
+ uint64_t m_blockHeight;
|
||||
@@ -515,7 +535,9 @@ index 000000000..c43e45abd
|
||||
+ std::string m_pubKey;
|
||||
+ bool m_coinbase;
|
||||
+ std::string m_description;
|
||||
+
|
||||
+ std::string m_asset;
|
||||
+ uint8_t m_type;
|
||||
+
|
||||
+ friend class CoinsImpl;
|
||||
+
|
||||
+};
|
||||
@@ -849,7 +871,7 @@ diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
|
||||
index be1c3704e..013b5bcba 100644
|
||||
--- a/src/wallet/api/wallet2_api.h
|
||||
+++ b/src/wallet/api/wallet2_api.h
|
||||
@@ -263,6 +263,51 @@ struct AddressBook
|
||||
@@ -263,6 +263,53 @@ struct AddressBook
|
||||
virtual int lookupPaymentID(const std::string &payment_id) const = 0;
|
||||
};
|
||||
|
||||
@@ -881,6 +903,8 @@ index be1c3704e..013b5bcba 100644
|
||||
+ virtual std::string pubKey() const = 0;
|
||||
+ virtual bool coinbase() const = 0;
|
||||
+ virtual std::string description() const = 0;
|
||||
+ virtual std::string asset() const = 0;
|
||||
+ virtual uint8_t type() const = 0;
|
||||
+};
|
||||
+
|
||||
+struct Coins
|
||||
@@ -974,22 +998,14 @@ index 806de969a..8720e18b1 100644
|
||||
size_t wallet2::get_transfer_details(const crypto::key_image &ki) const
|
||||
{
|
||||
for (size_t idx = 0; idx < m_transfers.size(); ++idx)
|
||||
@@ -2879,6 +2900,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
||||
uint64_t amount = tx.vout[o].amount ? tx.vout[o].amount : tx_scan_info[o].amount;
|
||||
if (!pool)
|
||||
{
|
||||
+ boost::unique_lock<boost::shared_mutex> lock(m_transfers_mutex);
|
||||
std::string asset_type = "";
|
||||
THROW_WALLET_EXCEPTION_IF(!cryptonote::get_output_asset_type(tx.vout[o], asset_type), error::wallet_internal_error, "failed to get output_asset_type");
|
||||
m_transfers.push_back(transfer_details{});
|
||||
@@ -3037,6 +3059,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
||||
uint64_t extra_amount = amount - burnt;
|
||||
if (!pool)
|
||||
{
|
||||
+ boost::unique_lock<boost::shared_mutex> lock(m_transfers_mutex);
|
||||
transfer_details &td = m_transfers[kit->second];
|
||||
td.m_block_height = height;
|
||||
td.m_internal_output_index = o;
|
||||
@@ -2621,6 +2643,7 @@ void wallet2::process_new_scanned_transaction(const crypto::hash &txid, const cryp
|
||||
continue;
|
||||
|
||||
// update m_transfers view-incoming scan info, and default values
|
||||
+ boost::unique_lock<boost::shared_mutex> lock(m_transfers_mutex);
|
||||
transfer_details& td = m_transfers.emplace_back();
|
||||
td.m_block_height = height;
|
||||
td.m_internal_output_index = local_output_index;
|
||||
@@ -11031,7 +11054,7 @@ void wallet2::transfer_selected_rct(std::vector<cryptonote::tx_destination_entry
|
||||
LOG_PRINT_L2("transfer_selected_rct done");
|
||||
}
|
||||
@@ -1064,8 +1080,8 @@ index 806de969a..8720e18b1 100644
|
||||
-std::vector<wallet2::pending_tx> wallet2::create_transactions_all(uint64_t below, cryptonote::transaction_type tx_type, const std::string &asset_type, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices)
|
||||
+std::vector<wallet2::pending_tx> wallet2::create_transactions_all(uint64_t below, cryptonote::transaction_type tx_type, const std::string &asset_type, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const std::vector<crypto::key_image>& preferred_input_list)
|
||||
{
|
||||
std::vector<size_t> unused_transfers_indices;
|
||||
std::vector<size_t> unused_dust_indices;
|
||||
const bool do_carrot_tx_construction = use_fork_rules(HF_VERSION_CARROT);
|
||||
if (do_carrot_tx_construction)
|
||||
@@ -12056,7 +12091,10 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_all(uint64_t below
|
||||
for (const auto& i: m_transfers_indices[asset_type])
|
||||
{
|
||||
@@ -1081,7 +1097,7 @@ diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
|
||||
index a619bdd15..4f324c238 100644
|
||||
--- a/src/wallet/wallet2.h
|
||||
+++ b/src/wallet/wallet2.h
|
||||
@@ -1256,8 +1256,8 @@ private:
|
||||
@@ -1286,8 +1286,8 @@ private:
|
||||
bool parse_unsigned_tx_from_str(const std::string &unsigned_tx_st, unsigned_tx_set &exported_txs) const;
|
||||
bool load_tx(const std::string &signed_filename, std::vector<tools::wallet2::pending_tx> &ptx, std::function<bool(const signed_tx_set&)> accept_func = NULL);
|
||||
bool parse_tx_from_str(const std::string &signed_tx_st, std::vector<tools::wallet2::pending_tx> &ptx, std::function<bool(const signed_tx_set &)> accept_func);
|
||||
@@ -1089,17 +1105,17 @@ index a619bdd15..4f324c238 100644
|
||||
- std::vector<wallet2::pending_tx> create_transactions_all(uint64_t below, cryptonote::transaction_type tx_type, const std::string& asset_type, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices);
|
||||
+ std::vector<wallet2::pending_tx> create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts, const std::string& source_asset, const std::string& dest_asset, const cryptonote::transaction_type tx_type, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const std::vector<crypto::key_image>& preferred_input_list = {}, const unique_index_container& subtract_fee_from_outputs = {}); // pass subaddr_indices by value on purpose
|
||||
+ std::vector<wallet2::pending_tx> create_transactions_all(uint64_t below, cryptonote::transaction_type tx_type, const std::string& asset_type, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const std::vector<crypto::key_image>& preferred_input_list = {});
|
||||
std::vector<wallet2::pending_tx> create_transactions_single(const crypto::key_image &ki, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra);
|
||||
std::vector<wallet2::pending_tx> create_transactions_single(const crypto::key_image &ki, const cryptonote::account_public_address &address, const cryptonote::transaction_type tx_type, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra);
|
||||
std::vector<wallet2::pending_tx> create_transactions_return(std::vector<size_t> transfers_indices);
|
||||
std::vector<wallet2::pending_tx> create_transactions_from(const cryptonote::account_public_address &address, const cryptonote::transaction_type tx_type, const std::string& asset_type, bool is_subaddress, const size_t outputs, std::vector<size_t> unused_transfers_indices, std::vector<size_t> unused_dust_indices, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra);
|
||||
@@ -1622,6 +1622,7 @@ private:
|
||||
@@ -1694,6 +1694,7 @@ private:
|
||||
uint64_t get_num_rct_outputs();
|
||||
size_t get_num_transfer_details() const { return m_transfers.size(); }
|
||||
const transfer_details &get_transfer_details(size_t idx) const;
|
||||
+ size_t get_transfer_details(const crypto::public_key &pk) const;
|
||||
|
||||
uint8_t estimate_current_hard_fork(const uint64_t height = 0) const;
|
||||
uint8_t get_current_hard_fork();
|
||||
void get_hard_fork_info(uint8_t version, uint64_t &earliest_height);
|
||||
@@ -1835,7 +1836,9 @@ private:
|
||||
void freeze(size_t idx);
|
||||
void thaw(size_t idx);
|
||||
@@ -1126,8 +1142,8 @@ index a619bdd15..4f324c238 100644
|
||||
- std::vector<size_t> pick_preferred_rct_inputs(uint64_t needed_money, uint32_t subaddr_account, const std::set<uint32_t> &subaddr_indices, const std::string& asset_type);
|
||||
+ std::vector<size_t> pick_preferred_rct_inputs(uint64_t needed_money, uint32_t subaddr_account, const std::set<uint32_t> &subaddr_indices, const std::string& asset_type, const std::vector<crypto::key_image>& preferred_input_list);
|
||||
void set_spent(size_t idx, uint64_t height);
|
||||
void set_spent(const crypto::key_image &ki, const uint64_t height);
|
||||
void set_unspent(size_t idx);
|
||||
bool is_spent(const transfer_details &td, bool strict = true) const;
|
||||
--
|
||||
2.48.1
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
Subject: [PATCH] ios no randomx JIT
|
||||
From: julian <julian@cypherstack.com>
|
||||
---
|
||||
Index: src/cryptonote_core/cryptonote_tx_utils.cpp
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp
|
||||
--- a/src/cryptonote_core/cryptonote_tx_utils.cpp (revision f9f0a43b1f5d9ec9f444bafa88073f1ddaf6e344)
|
||||
+++ b/src/cryptonote_core/cryptonote_tx_utils.cpp (date 1752524175340)
|
||||
@@ -1410,16 +1410,24 @@
|
||||
|
||||
bool get_block_longhash(const Blockchain *pbc, const blobdata& bd, crypto::hash& res, const uint64_t height, const int major_version, const crypto::hash *seed_hash, const int miners)
|
||||
{
|
||||
- crypto::hash hash;
|
||||
if (pbc != NULL)
|
||||
{
|
||||
+ crypto::hash hash;
|
||||
const uint64_t seed_height = rx_seedheight(height);
|
||||
hash = seed_hash ? *seed_hash : pbc->get_pending_block_id_by_height(seed_height);
|
||||
- } else
|
||||
- {
|
||||
- memset(&hash, 0, sizeof(hash)); // only happens when generating genesis block
|
||||
- }
|
||||
- rx_slow_hash(hash.data, bd.data(), bd.size(), res.data);
|
||||
+ rx_slow_hash(hash.data, bd.data(), bd.size(), res.data);
|
||||
+ } else
|
||||
+ {
|
||||
+ // only happens when generating genesis block
|
||||
+ // Hardcoded genesis for ios compat
|
||||
+ const char* hex = "4ade63d5ccb8cfae075e8b882514c471f35da95f85dd1b20fdcd6f3a95caabc5";
|
||||
+ char bytes[32];
|
||||
+ for (int i = 0; i < 32; i++) {
|
||||
+ char byte_str[3] = { hex[i * 2], hex[i * 2 + 1], '\0' };
|
||||
+ bytes[i] = (char)strtol(byte_str, NULL, 16);
|
||||
+ }
|
||||
+ memcpy(res.data, bytes, sizeof(bytes));
|
||||
+ }
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,466 @@
|
||||
From 7c1d576901a56b7c315b2c54362f7985ff8df753 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Tue, 12 Aug 2025 07:09:14 -0400
|
||||
Subject: [PATCH] serialize cache to JSON
|
||||
|
||||
---
|
||||
src/wallet/CMakeLists.txt | 1 +
|
||||
src/wallet/api/wallet.cpp | 5 +
|
||||
src/wallet/api/wallet.h | 2 +
|
||||
src/wallet/api/wallet2_api.h | 3 +
|
||||
src/wallet/wallet2.h | 6 +
|
||||
src/wallet/wallet_cache_to_json.cpp | 368 ++++++++++++++++++++++++++++
|
||||
6 files changed, 385 insertions(+)
|
||||
create mode 100644 src/wallet/wallet_cache_to_json.cpp
|
||||
|
||||
diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt
|
||||
index b163212b7..196ad671f 100644
|
||||
--- a/src/wallet/CMakeLists.txt
|
||||
+++ b/src/wallet/CMakeLists.txt
|
||||
@@ -38,6 +38,7 @@ set(wallet_sources
|
||||
message_store.cpp
|
||||
message_transporter.cpp
|
||||
wallet_rpc_payments.cpp
|
||||
+ wallet_cache_to_json.cpp
|
||||
tx_builder.cpp
|
||||
)
|
||||
|
||||
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
|
||||
index 7d7d0f922..effb6e719 100644
|
||||
--- a/src/wallet/api/wallet.cpp
|
||||
+++ b/src/wallet/api/wallet.cpp
|
||||
@@ -3475,6 +3475,11 @@ void Wallet::setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command
|
||||
#endif
|
||||
}
|
||||
|
||||
+std::string WalletImpl::serializeCacheToJson() const
|
||||
+{
|
||||
+ return std::string(m_wallet->serialize_cache_to_json());
|
||||
+}
|
||||
+
|
||||
YieldInfo * WalletImpl::getYieldInfo()
|
||||
{
|
||||
auto yi = new YieldInfoImpl(*this);
|
||||
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
|
||||
index bfe81c590..98c03b9c1 100644
|
||||
--- a/src/wallet/api/wallet.h
|
||||
+++ b/src/wallet/api/wallet.h
|
||||
@@ -335,6 +335,8 @@ private:
|
||||
bool getWaitsForDeviceSend();
|
||||
|
||||
bool getWaitsForDeviceReceive();
|
||||
+
|
||||
+ virtual std::string serializeCacheToJson() const override;
|
||||
};
|
||||
|
||||
|
||||
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
|
||||
index fcb8187d4..3d11929f9 100644
|
||||
--- a/src/wallet/api/wallet2_api.h
|
||||
+++ b/src/wallet/api/wallet2_api.h
|
||||
@@ -1217,7 +1217,10 @@ struct Wallet
|
||||
static void setDeviceReceivedData(unsigned char* data, size_t len);
|
||||
static void setDeviceSendData(unsigned char* data, size_t len);
|
||||
static void setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len));
|
||||
+
|
||||
+ //! serialize wallet cache to JSON
|
||||
+ virtual std::string serializeCacheToJson() const = 0;
|
||||
|
||||
//! get yield information
|
||||
virtual YieldInfo * getYieldInfo() = 0;
|
||||
};
|
||||
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
|
||||
index 4f324c238..bc4abc672 100644
|
||||
--- a/src/wallet/wallet2.h
|
||||
+++ b/src/wallet/wallet2.h
|
||||
@@ -1544,6 +1544,12 @@ private:
|
||||
FIELD(m_return_output_info)
|
||||
END_SERIALIZE()
|
||||
|
||||
+ /*!
|
||||
+ * \brief Serialize wallet cache fields to JSON
|
||||
+ * \return const char* pointing to JSON string containing all cache fields
|
||||
+ */
|
||||
+ const char* serialize_cache_to_json() const;
|
||||
+
|
||||
/*!
|
||||
* \brief Check if wallet keys and bin files exist
|
||||
* \param file_path Wallet file path
|
||||
diff --git a/src/wallet/wallet_cache_to_json.cpp b/src/wallet/wallet_cache_to_json.cpp
|
||||
new file mode 100644
|
||||
index 000000000..64687a7a6
|
||||
--- /dev/null
|
||||
+++ b/src/wallet/wallet_cache_to_json.cpp
|
||||
@@ -0,0 +1,368 @@
|
||||
+#include "wallet2.h"
|
||||
+#include "serialization/binary_archive.h"
|
||||
+#include "serialization/json_archive.h"
|
||||
+#include "serialization/serialization.h"
|
||||
+#include <sstream>
|
||||
+#include <iomanip>
|
||||
+
|
||||
+namespace tools
|
||||
+{
|
||||
+
|
||||
+static void write_escaped_json_string(std::ostream& os, const std::string& str)
|
||||
+{
|
||||
+ for (char c : str) {
|
||||
+ switch (c) {
|
||||
+ case '"': os << "\\\""; break;
|
||||
+ case '\\': os << "\\\\"; break;
|
||||
+ case '\n': os << "\\n"; break;
|
||||
+ case '\r': os << "\\r"; break;
|
||||
+ case '\t': os << "\\t"; break;
|
||||
+ case '\b': os << "\\b"; break;
|
||||
+ case '\f': os << "\\f"; break;
|
||||
+ default: os << c; break;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void post_process_json(std::string& json)
|
||||
+{
|
||||
+ // ": ," --> ": null,"
|
||||
+ size_t pos = 0;
|
||||
+ while ((pos = json.find(": ,", pos)) != std::string::npos) {
|
||||
+ json.replace(pos, 3, ": null,");
|
||||
+ pos += 7;
|
||||
+ }
|
||||
+
|
||||
+ // ": }" --> ": null}"
|
||||
+ pos = 0;
|
||||
+ while ((pos = json.find(": }", pos)) != std::string::npos) {
|
||||
+ json.replace(pos, 3, ": null}");
|
||||
+ pos += 7;
|
||||
+ }
|
||||
+
|
||||
+ // ": ]" --> ": null]"
|
||||
+ pos = 0;
|
||||
+ while ((pos = json.find(": ]", pos)) != std::string::npos) {
|
||||
+ json.replace(pos, 3, ": null]");
|
||||
+ pos += 7;
|
||||
+ }
|
||||
+
|
||||
+ // "key": number"hexstring" --> "key": "numberhexstring"
|
||||
+ pos = 0;
|
||||
+ while (pos < json.length()) {
|
||||
+ size_t colon_pos = json.find(": ", pos);
|
||||
+ if (colon_pos == std::string::npos) break;
|
||||
+
|
||||
+ size_t value_start = colon_pos + 2;
|
||||
+ if (value_start >= json.length()) break;
|
||||
+
|
||||
+ if (std::isdigit(json[value_start])) {
|
||||
+ size_t quote_pos = json.find('"', value_start);
|
||||
+ if (quote_pos != std::string::npos && quote_pos < json.find_first_of(",}]", value_start)) {
|
||||
+ size_t closing_quote = json.find('"', quote_pos + 1);
|
||||
+ if (closing_quote != std::string::npos && closing_quote < json.find_first_of(",}]", value_start)) {
|
||||
+ std::string digits;
|
||||
+ size_t digit_end = value_start;
|
||||
+ while (digit_end < quote_pos && std::isdigit(json[digit_end])) {
|
||||
+ digits += json[digit_end];
|
||||
+ digit_end++;
|
||||
+ }
|
||||
+
|
||||
+ if (digit_end == quote_pos && !digits.empty()) {
|
||||
+ std::string hex_part = json.substr(quote_pos + 1, closing_quote - quote_pos - 1);
|
||||
+
|
||||
+ std::string replacement = "\"" + digits + hex_part + "\"";
|
||||
+ json.replace(value_start, closing_quote - value_start + 1, replacement);
|
||||
+ pos = value_start + replacement.length();
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ pos = colon_pos + 1;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+const char* wallet2::serialize_cache_to_json() const
|
||||
+{
|
||||
+ static std::string json_result;
|
||||
+
|
||||
+ try
|
||||
+ {
|
||||
+ std::stringstream oss;
|
||||
+ json_archive<true> ar(oss, true); // true for pretty printing
|
||||
+
|
||||
+ ar.begin_object();
|
||||
+
|
||||
+ // MAGIC_FIELD("monero wallet cache")
|
||||
+ std::string magic = "monero wallet cache";
|
||||
+ ar.tag("magic");
|
||||
+ ar.serialize_blob((void*)magic.data(), magic.size());
|
||||
+ if (!ar.good()) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize magic field\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // VERSION_FIELD(2)
|
||||
+ uint32_t version = 2;
|
||||
+ ar.tag("version");
|
||||
+ ar.serialize_varint(version);
|
||||
+ if (!ar.good()) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize version field\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_blockchain) - hashchain type, has serialization support
|
||||
+ ar.tag("m_blockchain");
|
||||
+ if (!::serialization::serialize(ar, const_cast<hashchain&>(m_blockchain))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_blockchain\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_transfers) - transfer_container (std::vector<transfer_details>)
|
||||
+ ar.tag("m_transfers");
|
||||
+ if (!::serialization::serialize(ar, const_cast<transfer_container&>(m_transfers))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_transfers\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_account_public_address) - cryptonote::account_public_address
|
||||
+ ar.tag("m_account_public_address");
|
||||
+ if (!::serialization::serialize(ar, const_cast<cryptonote::account_public_address&>(m_account_public_address))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_account_public_address\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_key_images) - serializable_unordered_map<crypto::key_image, size_t>
|
||||
+ ar.tag("m_key_images");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::key_image, size_t>&>(m_key_images))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_key_images\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_unconfirmed_txs) - serializable_unordered_map<crypto::hash, unconfirmed_transfer_details>
|
||||
+ ar.tag("m_unconfirmed_txs");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::hash, unconfirmed_transfer_details>&>(m_unconfirmed_txs))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_unconfirmed_txs\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_payments) - payment_container (serializable_unordered_multimap<crypto::hash, payment_details>)
|
||||
+ ar.tag("m_payments");
|
||||
+ if (!::serialization::serialize(ar, const_cast<payment_container&>(m_payments))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_payments\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_tx_keys) - serializable_unordered_map<crypto::hash, crypto::secret_key>
|
||||
+ ar.tag("m_tx_keys");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::hash, crypto::secret_key>&>(m_tx_keys))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_tx_keys\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_confirmed_txs) - serializable_unordered_map<crypto::hash, confirmed_transfer_details>
|
||||
+ ar.tag("m_confirmed_txs");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::hash, confirmed_transfer_details>&>(m_confirmed_txs))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_confirmed_txs\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_tx_notes) - serializable_unordered_map<crypto::hash, std::string>
|
||||
+ ar.tag("m_tx_notes");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::hash, std::string>&>(m_tx_notes))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_tx_notes\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_unconfirmed_payments) - serializable_unordered_multimap<crypto::hash, pool_payment_details>
|
||||
+ ar.tag("m_unconfirmed_payments");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_multimap<crypto::hash, pool_payment_details>&>(m_unconfirmed_payments))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_unconfirmed_payments\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_pub_keys) - serializable_unordered_map<crypto::public_key, size_t>
|
||||
+ ar.tag("m_pub_keys");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::public_key, size_t>&>(m_pub_keys))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_pub_keys\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_address_book) - std::vector<tools::wallet2::address_book_row>
|
||||
+ ar.tag("m_address_book");
|
||||
+ if (!::serialization::serialize(ar, const_cast<std::vector<tools::wallet2::address_book_row>&>(m_address_book))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_address_book\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_scanned_pool_txs[0]) - std::unordered_set<crypto::hash>
|
||||
+ ar.tag("m_scanned_pool_txs_0");
|
||||
+ if (!::serialization::serialize(ar, const_cast<std::unordered_set<crypto::hash>&>(m_scanned_pool_txs[0]))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_scanned_pool_txs[0]\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_scanned_pool_txs[1]) - std::unordered_set<crypto::hash>
|
||||
+ ar.tag("m_scanned_pool_txs_1");
|
||||
+ if (!::serialization::serialize(ar, const_cast<std::unordered_set<crypto::hash>&>(m_scanned_pool_txs[1]))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_scanned_pool_txs[1]\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_subaddresses) - serializable_unordered_map<crypto::public_key, cryptonote::subaddress_index>
|
||||
+ ar.tag("m_subaddresses");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::public_key, cryptonote::subaddress_index>&>(m_subaddresses))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_subaddresses\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_subaddress_labels) - std::vector<std::vector<std::string>> - manual JSON serialization
|
||||
+ oss << ", \n \"m_subaddress_labels\": [";
|
||||
+ for (size_t i = 0; i < m_subaddress_labels.size(); ++i) {
|
||||
+ if (i > 0) oss << ", ";
|
||||
+ oss << "\n [";
|
||||
+ for (size_t j = 0; j < m_subaddress_labels[i].size(); ++j) {
|
||||
+ if (j > 0) oss << ", ";
|
||||
+ oss << "\"";
|
||||
+ write_escaped_json_string(oss, m_subaddress_labels[i][j]);
|
||||
+ oss << "\"";
|
||||
+ }
|
||||
+ oss << "]";
|
||||
+ }
|
||||
+ oss << "\n ]";
|
||||
+
|
||||
+ // FIELD(m_additional_tx_keys) - serializable_unordered_map<crypto::hash, std::vector<crypto::secret_key>>
|
||||
+ ar.tag("m_additional_tx_keys");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::hash, std::vector<crypto::secret_key>>&>(m_additional_tx_keys))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_additional_tx_keys\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_attributes) - serializable_unordered_map<std::string, std::string> - manual JSON serialization
|
||||
+ oss << ", \n \"m_attributes\": {";
|
||||
+ bool first_attr = true;
|
||||
+ for (const auto& attr : m_attributes) {
|
||||
+ if (!first_attr) oss << ", ";
|
||||
+ first_attr = false;
|
||||
+ oss << "\n \"";
|
||||
+ write_escaped_json_string(oss, attr.first);
|
||||
+ oss << "\": \"";
|
||||
+ write_escaped_json_string(oss, attr.second);
|
||||
+ oss << "\"";
|
||||
+ }
|
||||
+ oss << "\n }";
|
||||
+
|
||||
+ // FIELD(m_account_tags) - std::pair<serializable_map<std::string, std::string>, std::vector<std::string>> - manual JSON serialization
|
||||
+ oss << ", \n \"m_account_tags\": {";
|
||||
+ oss << "\n \"tags_map\": {";
|
||||
+ bool first_tag = true;
|
||||
+ for (const auto& tag : m_account_tags.first) {
|
||||
+ if (!first_tag) oss << ", ";
|
||||
+ first_tag = false;
|
||||
+ oss << "\n \"";
|
||||
+ write_escaped_json_string(oss, tag.first);
|
||||
+ oss << "\": \"";
|
||||
+ write_escaped_json_string(oss, tag.second);
|
||||
+ oss << "\"";
|
||||
+ }
|
||||
+ oss << "\n },";
|
||||
+ oss << "\n \"account_list\": [";
|
||||
+ for (size_t i = 0; i < m_account_tags.second.size(); ++i) {
|
||||
+ if (i > 0) oss << ", ";
|
||||
+ oss << "\n \"";
|
||||
+ write_escaped_json_string(oss, m_account_tags.second[i]);
|
||||
+ oss << "\"";
|
||||
+ }
|
||||
+ oss << "\n ]";
|
||||
+ oss << "\n }";
|
||||
+
|
||||
+ // FIELD(m_ring_history_saved) - bool
|
||||
+ // ar.tag("m_ring_history_saved");
|
||||
+ // ar.serialize_blob(&m_ring_history_saved, sizeof(m_ring_history_saved));
|
||||
+ // if (!ar.good()) {
|
||||
+ // json_result = "{\"error\":\"Failed to serialize m_ring_history_saved\"}";
|
||||
+ // return json_result.c_str();
|
||||
+ // }
|
||||
+
|
||||
+ // FIELD(m_last_block_reward) - uint64_t
|
||||
+ ar.tag("m_last_block_reward");
|
||||
+ ar.serialize_int(m_last_block_reward);
|
||||
+ if (!ar.good()) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_last_block_reward\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_tx_device) - serializable_unordered_map<crypto::hash, std::string>
|
||||
+ ar.tag("m_tx_device");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::hash, std::string>&>(m_tx_device))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_tx_device\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_device_last_key_image_sync) - uint64_t
|
||||
+ ar.tag("m_device_last_key_image_sync");
|
||||
+ ar.serialize_int(m_device_last_key_image_sync);
|
||||
+ if (!ar.good()) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_device_last_key_image_sync\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_cold_key_images) - serializable_unordered_map<crypto::public_key, crypto::key_image>
|
||||
+ ar.tag("m_cold_key_images");
|
||||
+ if (!::serialization::serialize(ar, const_cast<serializable_unordered_map<crypto::public_key, crypto::key_image>&>(m_cold_key_images))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_cold_key_images\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ // FIELD(m_rpc_client_secret_key) - crypto::secret_key
|
||||
+ // ar.tag("m_rpc_client_secret_key");
|
||||
+ // ar.serialize_blob(&m_rpc_client_secret_key, sizeof(m_rpc_client_secret_key));
|
||||
+ // if (!ar.good()) {
|
||||
+ // json_result = "{\"error\":\"Failed to serialize m_rpc_client_secret_key\"}";
|
||||
+ // return json_result.c_str();
|
||||
+ // }
|
||||
+
|
||||
+ // Version-dependent fields
|
||||
+ if (version >= 1) {
|
||||
+ // FIELD(m_has_ever_refreshed_from_node) - bool
|
||||
+ // ar.tag("m_has_ever_refreshed_from_node");
|
||||
+ // ar.serialize_blob(&m_has_ever_refreshed_from_node, sizeof(m_has_ever_refreshed_from_node));
|
||||
+ // if (!ar.good()) {
|
||||
+ // json_result = "{\"error\":\"Failed to serialize m_has_ever_refreshed_from_node\"}";
|
||||
+ // return json_result.c_str();
|
||||
+ // }
|
||||
+ }
|
||||
+
|
||||
+ if (version >= 2) {
|
||||
+ // FIELD(m_background_sync_data) - background_sync_data_t
|
||||
+ ar.tag("m_background_sync_data");
|
||||
+ if (!::serialization::serialize(ar, const_cast<background_sync_data_t&>(m_background_sync_data))) {
|
||||
+ json_result = "{\"error\":\"Failed to serialize m_background_sync_data\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ ar.end_object();
|
||||
+
|
||||
+ if (!ar.good()) {
|
||||
+ json_result = "{\"error\":\"Failed to finalize JSON serialization\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+
|
||||
+ json_result = oss.str();
|
||||
+
|
||||
+ // Post-process to fix malformed JSON
|
||||
+ post_process_json(json_result);
|
||||
+
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+ catch (const std::exception& e)
|
||||
+ {
|
||||
+ json_result = "{\"error\":\"Failed to serialize wallet cache: " + std::string(e.what()) + "\"}";
|
||||
+ return json_result.c_str();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+} // namespace tools
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -21,23 +21,38 @@ Subject: [PATCH 08/15] add dummy device for ledger
|
||||
create mode 100644 src/device/device_io_dummy.hpp
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 88335ee9d..86000f811 100644
|
||||
index c73b813d8..ce5ef4bab 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -693,8 +693,12 @@ include_directories(${LMDB_INCLUDE})
|
||||
@@ -692,16 +692,21 @@ include_directories(${LMDB_INCLUDE})
|
||||
include_directories(${LIBUNWIND_INCLUDE})
|
||||
link_directories(${LIBUNWIND_LIBRARY_DIRS})
|
||||
|
||||
-# Final setup for hid
|
||||
-if (HIDAPI_FOUND)
|
||||
- message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}")
|
||||
- add_definitions(-DHAVE_HIDAPI)
|
||||
- include_directories(${HIDAPI_INCLUDE_DIR})
|
||||
- link_directories(${LIBHIDAPI_LIBRARY_DIRS})
|
||||
+if (HIDAPI_DUMMY)
|
||||
+ add_definitions(-DHIDAPI_DUMMY)
|
||||
+endif()
|
||||
else()
|
||||
- message(STATUS "Could not find HIDAPI")
|
||||
+ # Final setup for hid
|
||||
+ if (HIDAPI_FOUND)
|
||||
+ message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}")
|
||||
+ add_definitions(-DHAVE_HIDAPI)
|
||||
+ include_directories(${HIDAPI_INCLUDE_DIR})
|
||||
+ link_directories(${LIBHIDAPI_LIBRARY_DIRS})
|
||||
+ else()
|
||||
+ message(STATUS "Could not find HIDAPI")
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
+
|
||||
# Final setup for hid
|
||||
-if (HIDAPI_FOUND)
|
||||
+if (HIDAPI_FOUND)
|
||||
message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}")
|
||||
add_definitions(-DHAVE_HIDAPI)
|
||||
include_directories(${HIDAPI_INCLUDE_DIR})
|
||||
# Trezor support check
|
||||
include(CheckTrezor)
|
||||
|
||||
diff --git a/src/device/CMakeLists.txt b/src/device/CMakeLists.txt
|
||||
index e4f1159b5..14d398f87 100644
|
||||
--- a/src/device/CMakeLists.txt
|
||||
@@ -235,13 +250,13 @@ index 000000000..edb4beea3
|
||||
+ MDEBUG("exchange(): waitsForDeviceSend");
|
||||
+ // NOTE: waitsForDeviceSend should be changed by external code
|
||||
+ while (waitsForDeviceSend) {
|
||||
+ usleep(1000);
|
||||
+ std::this_thread::sleep_for(std::chrono::microseconds(1000));
|
||||
+ MDEBUG("exchange(): waitsForDeviceSend (still)");
|
||||
+ }
|
||||
+
|
||||
+ MDEBUG("exchange(): waitsForDeviceReceive");
|
||||
+ while (waitsForDeviceReceive) {
|
||||
+ usleep(1000);
|
||||
+ std::this_thread::sleep_for(std::chrono::microseconds(1000));
|
||||
+ MDEBUG("exchange(): waitsForDeviceReceive (still)");
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From 31ef09596a9d8d547905577823ff52d33e10a3d2 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Tue, 1 Apr 2025 11:30:45 +0200
|
||||
Subject: [PATCH] pr-9880
|
||||
|
||||
---
|
||||
CMakeLists.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 5938be6..1c47285 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -216,7 +216,7 @@ function(forbid_undefined_symbols)
|
||||
file(MAKE_DIRECTORY "${TEST_PROJECT}")
|
||||
file(WRITE "${TEST_PROJECT}/CMakeLists.txt"
|
||||
[=[
|
||||
-cmake_minimum_required(VERSION 3.1)
|
||||
+cmake_minimum_required(VERSION 3.5)
|
||||
project(test)
|
||||
option(EXPECT_SUCCESS "" ON)
|
||||
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/incorrect_source.cpp" "void undefined_symbol(); void symbol() { undefined_symbol(); }")
|
||||
--
|
||||
2.49.0
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From e488eaa7397d388cee6e914e10d23790f005f6f7 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Thu, 10 Apr 2025 13:28:06 +0200
|
||||
Subject: [PATCH] fix: unary_function -> __unary_function
|
||||
|
||||
---
|
||||
src/cryptonote_basic/cryptonote_basic_impl.h | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/cryptonote_basic/cryptonote_basic_impl.h b/src/cryptonote_basic/cryptonote_basic_impl.h
|
||||
index b423573..a9aef7a 100644
|
||||
--- a/src/cryptonote_basic/cryptonote_basic_impl.h
|
||||
+++ b/src/cryptonote_basic/cryptonote_basic_impl.h
|
||||
@@ -40,7 +40,11 @@ namespace cryptonote {
|
||||
/* */
|
||||
/************************************************************************/
|
||||
template<class t_array>
|
||||
+#ifdef __APPLE__
|
||||
+ struct array_hasher: std::__unary_function<t_array&, std::size_t>
|
||||
+#else
|
||||
struct array_hasher: std::unary_function<t_array&, std::size_t>
|
||||
+#endif
|
||||
{
|
||||
std::size_t operator()(const t_array& val) const
|
||||
{
|
||||
--
|
||||
2.49.0
|
||||
|
||||
+1
-1
Submodule salvium updated: 1f49c178ee...119a7fab57
@@ -25,10 +25,12 @@ _SALVIUM_UnsignedTransaction_minMixinCount
|
||||
_SALVIUM_UnsignedTransaction_txCount
|
||||
_SALVIUM_UnsignedTransaction_sign
|
||||
_SALVIUM_UnsignedTransaction_signUR
|
||||
_SALVIUM_TransactionInfo_asset
|
||||
_SALVIUM_TransactionInfo_direction
|
||||
_SALVIUM_TransactionInfo_isPending
|
||||
_SALVIUM_TransactionInfo_isFailed
|
||||
_SALVIUM_TransactionInfo_isCoinbase
|
||||
_SALVIUM_TransactionInfo_type
|
||||
_SALVIUM_TransactionInfo_amount
|
||||
_SALVIUM_TransactionInfo_fee
|
||||
_SALVIUM_TransactionInfo_blockHeight
|
||||
@@ -71,6 +73,7 @@ _SALVIUM_CoinsInfo_spent
|
||||
_SALVIUM_CoinsInfo_frozen
|
||||
_SALVIUM_CoinsInfo_spentHeight
|
||||
_SALVIUM_CoinsInfo_amount
|
||||
_SALVIUM_CoinsInfo_type
|
||||
_SALVIUM_CoinsInfo_rct
|
||||
_SALVIUM_CoinsInfo_keyImageKnown
|
||||
_SALVIUM_CoinsInfo_pkIndex
|
||||
@@ -84,6 +87,7 @@ _SALVIUM_CoinsInfo_unlocked
|
||||
_SALVIUM_CoinsInfo_pubKey
|
||||
_SALVIUM_CoinsInfo_coinbase
|
||||
_SALVIUM_CoinsInfo_description
|
||||
_SALVIUM_CoinsInfo_asset
|
||||
_SALVIUM_Coins_count
|
||||
_SALVIUM_Coins_coin
|
||||
_SALVIUM_Coins_getAll_size
|
||||
@@ -122,6 +126,8 @@ _SALVIUM_MultisigState_total
|
||||
_SALVIUM_DeviceProgress_progress
|
||||
_SALVIUM_DeviceProgress_indeterminate
|
||||
_SALVIUM_Wallet_seed
|
||||
_SALVIUM_Wallet_setLedgerCallback
|
||||
_SALVIUM_Wallet_serializeCacheToJson
|
||||
_SALVIUM_Wallet_getSeedLanguage
|
||||
_SALVIUM_Wallet_setSeedLanguage
|
||||
_SALVIUM_Wallet_status
|
||||
@@ -140,6 +146,10 @@ _SALVIUM_Wallet_publicViewKey
|
||||
_SALVIUM_Wallet_secretSpendKey
|
||||
_SALVIUM_Wallet_publicSpendKey
|
||||
_SALVIUM_Wallet_publicMultisigSignerKey
|
||||
_SALVIUM_Wallet_secretViewBalance
|
||||
_SALVIUM_Wallet_secretProveSpend
|
||||
_SALVIUM_Wallet_secretGenerateAddress
|
||||
_SALVIUM_Wallet_secretGenerateImage
|
||||
_SALVIUM_Wallet_stop
|
||||
_SALVIUM_Wallet_store
|
||||
_SALVIUM_Wallet_filename
|
||||
@@ -204,6 +214,7 @@ _SALVIUM_Wallet_hasMultisigPartialKeyImages
|
||||
_SALVIUM_Wallet_restoreMultisigTransaction
|
||||
_SALVIUM_Wallet_createTransactionMultDest
|
||||
_SALVIUM_Wallet_createTransaction
|
||||
_SALVIUM_Wallet_createStakeTransaction
|
||||
_SALVIUM_Wallet_loadUnsignedTx
|
||||
_SALVIUM_Wallet_loadUnsignedTxUR
|
||||
_SALVIUM_Wallet_submitTransaction
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifndef SALVIUMC_CHECKSUMS
|
||||
#define SALVIUMC_CHECKSUMS
|
||||
const char * SALVIUM_wallet2_api_c_h_sha256 = "9e80c4b59a0509aa02fbf01e8df2881b89f82225d1765bfa7856cbdbaf7af116";
|
||||
const char * SALVIUM_wallet2_api_c_cpp_sha256 = "d229507db508e574bd2badf4819a38dbead8c16a84311ad32c22c887a6003439-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe";
|
||||
const char * SALVIUM_wallet2_api_c_exp_sha256 = "d0f95f1f3bc49f1f59fe4eb0b61826128d7d3bb75405d5a01a252d02db03097d";
|
||||
#ifndef MONEROC_CHECKSUMS
|
||||
#define MONEROC_CHECKSUMS
|
||||
const char * SALVIUM_wallet2_api_c_h_sha256 = "93ad4f6247f0b89c17218766c960e956047b0e8032c3db2b791842d576279330";
|
||||
const char * SALVIUM_wallet2_api_c_cpp_sha256 = "2d52bbe50a6db8c1bd68ce4be288c28319f35f48c6d093a3d67d888c8e4b3230-45404ecc719b916c217938f9e82ad352a4068d12";
|
||||
const char * SALVIUM_wallet2_api_c_exp_sha256 = "f7ab584f1271f4d533980f403597a1d9e50bced85c233ca2b17c77f4a94ed3bc";
|
||||
#endif
|
||||
|
||||
@@ -290,6 +290,12 @@ bool SALVIUM_TransactionInfo_isCoinbase(void* txInfo_ptr) {
|
||||
return txInfo->isCoinbase();
|
||||
DEBUG_END()
|
||||
}
|
||||
uint8_t SALVIUM_TransactionInfo_type(void* txInfo_ptr) {
|
||||
DEBUG_START()
|
||||
Monero::TransactionInfo *txInfo = reinterpret_cast<Monero::TransactionInfo*>(txInfo_ptr);
|
||||
return txInfo->type();
|
||||
DEBUG_END()
|
||||
}
|
||||
uint64_t SALVIUM_TransactionInfo_amount(void* txInfo_ptr) {
|
||||
DEBUG_START()
|
||||
Monero::TransactionInfo *txInfo = reinterpret_cast<Monero::TransactionInfo*>(txInfo_ptr);
|
||||
@@ -308,6 +314,16 @@ uint64_t SALVIUM_TransactionInfo_blockHeight(void* txInfo_ptr) {
|
||||
return txInfo->blockHeight();
|
||||
DEBUG_END()
|
||||
}
|
||||
const char* SALVIUM_TransactionInfo_asset(void* txInfo_ptr) {
|
||||
DEBUG_START()
|
||||
Monero::TransactionInfo *txInfo = reinterpret_cast<Monero::TransactionInfo*>(txInfo_ptr);
|
||||
std::string str = txInfo->asset();
|
||||
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()
|
||||
}
|
||||
const char* SALVIUM_TransactionInfo_description(void* txInfo_ptr) {
|
||||
DEBUG_START()
|
||||
Monero::TransactionInfo *txInfo = reinterpret_cast<Monero::TransactionInfo*>(txInfo_ptr);
|
||||
@@ -734,6 +750,24 @@ const char* SALVIUM_CoinsInfo_description(void* coinsInfo_ptr) {
|
||||
return buffer;
|
||||
DEBUG_END()
|
||||
}
|
||||
// virtual std::string asset() const = 0;
|
||||
const char* SALVIUM_CoinsInfo_asset(void* coinsInfo_ptr) {
|
||||
DEBUG_START()
|
||||
Monero::CoinsInfo *coinsInfo = reinterpret_cast<Monero::CoinsInfo*>(coinsInfo_ptr);
|
||||
std::string str = coinsInfo->asset();
|
||||
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()
|
||||
}
|
||||
// virtual uint8_t type() const = 0;
|
||||
uint8_t SALVIUM_CoinsInfo_type(void* coinsInfo_ptr) {
|
||||
DEBUG_START()
|
||||
Monero::CoinsInfo *coinsInfo = reinterpret_cast<Monero::CoinsInfo*>(coinsInfo_ptr);
|
||||
return coinsInfo->type();
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
|
||||
// coins
|
||||
@@ -933,7 +967,7 @@ const char* SALVIUM_SubaddressAccountRow_getLabel(void* subaddressAccountRow_ptr
|
||||
DEBUG_END()
|
||||
}
|
||||
// std::string getBalance() const {return m_balance;}
|
||||
const char* SALVIUM_SubaddressAccountRow_getBalance(void* subaddressAccountRow_ptr) {
|
||||
const char* SALVIUM_SubaddressAccountRow_getBalance(void* subaddressAccountRow_ptr, const char* asset) {
|
||||
DEBUG_START()
|
||||
Monero::SubaddressAccountRow *subaddressAccountRow = reinterpret_cast<Monero::SubaddressAccountRow*>(subaddressAccountRow_ptr);
|
||||
std::string str = subaddressAccountRow->getBalance("SAL1");
|
||||
@@ -944,7 +978,7 @@ const char* SALVIUM_SubaddressAccountRow_getBalance(void* subaddressAccountRow_p
|
||||
DEBUG_END()
|
||||
}
|
||||
// std::string getUnlockedBalance() const {return m_unlockedBalance;}
|
||||
const char* SALVIUM_SubaddressAccountRow_getUnlockedBalance(void* subaddressAccountRow_ptr) {
|
||||
const char* SALVIUM_SubaddressAccountRow_getUnlockedBalance(void* subaddressAccountRow_ptr, const char* asset) {
|
||||
DEBUG_START()
|
||||
Monero::SubaddressAccountRow *subaddressAccountRow = reinterpret_cast<Monero::SubaddressAccountRow*>(subaddressAccountRow_ptr);
|
||||
std::string str = subaddressAccountRow->getUnlockedBalance("SAL1");
|
||||
@@ -1229,6 +1263,51 @@ const char* SALVIUM_Wallet_publicMultisigSignerKey(void* wallet_ptr) {
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
const char* SALVIUM_Wallet_secretViewBalance(void* wallet_ptr) {
|
||||
DEBUG_START()
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
std::string str = wallet->secretViewBalance();
|
||||
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()
|
||||
}
|
||||
|
||||
const char* SALVIUM_Wallet_secretProveSpend(void* wallet_ptr) {
|
||||
DEBUG_START()
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
std::string str = wallet->secretProveSpend();
|
||||
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()
|
||||
}
|
||||
|
||||
const char* SALVIUM_Wallet_secretGenerateAddress(void* wallet_ptr) {
|
||||
DEBUG_START()
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
std::string str = wallet->secretGenerateAddress();
|
||||
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()
|
||||
}
|
||||
|
||||
const char* SALVIUM_Wallet_secretGenerateImage(void* wallet_ptr) {
|
||||
DEBUG_START()
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
std::string str = wallet->secretGenerateImage();
|
||||
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()
|
||||
}
|
||||
|
||||
|
||||
void SALVIUM_Wallet_stop(void* wallet_ptr) {
|
||||
DEBUG_START()
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
@@ -1722,12 +1801,26 @@ void* SALVIUM_Wallet_createTransactionMultDest(void* wallet_ptr, const char* dst
|
||||
"SAL1", false /* is_return */,
|
||||
PendingTransaction_Priority_fromInt(pendingTransactionPriority),
|
||||
subaddr_account,
|
||||
subaddr_indices,
|
||||
preferred_inputs
|
||||
subaddr_indices
|
||||
);
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
void* SALVIUM_Wallet_createStakeTransaction(void* wallet_ptr, const char* dst_addr, const char* payment_id,
|
||||
uint64_t amount, uint32_t mixin_count,
|
||||
int pendingTransactionPriority,
|
||||
uint32_t subaddr_account,
|
||||
const char* preferredInputs, const char* separator) {
|
||||
DEBUG_START()
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
std::set<uint32_t> subaddr_indices = {};
|
||||
std::set<std::string> preferred_inputs = splitString(std::string(preferredInputs), std::string(separator));
|
||||
return wallet->createStakeTransaction(amount, mixin_count,
|
||||
PendingTransaction_Priority_fromInt(pendingTransactionPriority),
|
||||
subaddr_account, subaddr_indices);
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
void* SALVIUM_Wallet_createTransaction(void* wallet_ptr, const char* dst_addr, const char* payment_id,
|
||||
uint64_t amount, uint32_t mixin_count,
|
||||
int pendingTransactionPriority,
|
||||
@@ -1745,7 +1838,7 @@ void* SALVIUM_Wallet_createTransaction(void* wallet_ptr, const char* dst_addr, c
|
||||
optAmount, mixin_count,
|
||||
"SAL1", false /* is_return */,
|
||||
PendingTransaction_Priority_fromInt(pendingTransactionPriority),
|
||||
subaddr_account, subaddr_indices, preferred_inputs);
|
||||
subaddr_account, subaddr_indices);
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
@@ -2163,6 +2256,20 @@ void SALVIUM_Wallet_setDeviceSendData(void* wallet_ptr, unsigned char* data, siz
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
void SALVIUM_Wallet_setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)) {
|
||||
DEBUG_START()
|
||||
Monero::Wallet::setLedgerCallback(sendToLedgerDevice);
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
const char* SALVIUM_Wallet_serializeCacheToJson(void* wallet_ptr) {
|
||||
DEBUG_START()
|
||||
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
|
||||
std::string result = wallet->serializeCacheToJson();
|
||||
return strdup(result.c_str());
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
void* SALVIUM_WalletManager_createWallet(void* wm_ptr, const char* path, const char* password, const char* language, int networkType) {
|
||||
DEBUG_START()
|
||||
Monero::WalletManager *wm = reinterpret_cast<Monero::WalletManager*>(wm_ptr);
|
||||
|
||||
@@ -162,12 +162,16 @@ extern ADDAPI bool SALVIUM_TransactionInfo_isPending(void* txInfo_ptr);
|
||||
extern ADDAPI bool SALVIUM_TransactionInfo_isFailed(void* txInfo_ptr);
|
||||
// virtual bool isCoinbase() const = 0;
|
||||
extern ADDAPI bool SALVIUM_TransactionInfo_isCoinbase(void* txInfo_ptr);
|
||||
// virtual uint8_t type() const = 0;
|
||||
extern ADDAPI uint8_t SALVIUM_TransactionInfo_type(void* txInfo_ptr);
|
||||
// virtual uint64_t amount() const = 0;
|
||||
extern ADDAPI uint64_t SALVIUM_TransactionInfo_amount(void* txInfo_ptr);
|
||||
// virtual uint64_t fee() const = 0;
|
||||
extern ADDAPI uint64_t SALVIUM_TransactionInfo_fee(void* txInfo_ptr);
|
||||
// virtual uint64_t blockHeight() const = 0;
|
||||
extern ADDAPI uint64_t SALVIUM_TransactionInfo_blockHeight(void* txInfo_ptr);
|
||||
// virtual std::string asset() const = 0;
|
||||
extern ADDAPI const char* SALVIUM_TransactionInfo_asset(void* txInfo_ptr);
|
||||
// virtual std::string description() const = 0;
|
||||
extern ADDAPI const char* SALVIUM_TransactionInfo_description(void* txInfo_ptr);
|
||||
// virtual std::set<uint32_t> subaddrIndex() const = 0;
|
||||
@@ -190,6 +194,7 @@ extern ADDAPI const char* SALVIUM_TransactionInfo_paymentId(void* txInfo_ptr);
|
||||
extern ADDAPI int SALVIUM_TransactionInfo_transfers_count(void* txInfo_ptr);
|
||||
extern ADDAPI uint64_t SALVIUM_TransactionInfo_transfers_amount(void* txInfo_ptr, int index);
|
||||
extern ADDAPI const char* SALVIUM_TransactionInfo_transfers_address(void* txInfo_ptr, int address);
|
||||
extern ADDAPI const char* SALVIUM_TransactionInfo_transfers_asset(void* txInfo_ptr, int asset);
|
||||
// };
|
||||
// struct TransactionHistory
|
||||
// {
|
||||
@@ -307,6 +312,10 @@ extern ADDAPI const char* SALVIUM_CoinsInfo_pubKey(void* coinsInfo_ptr);
|
||||
extern ADDAPI bool SALVIUM_CoinsInfo_coinbase(void* coinsInfo_ptr);
|
||||
// virtual std::string description() const = 0;
|
||||
extern ADDAPI const char* SALVIUM_CoinsInfo_description(void* coinsInfo_ptr);
|
||||
// virtual std::string asset() const = 0;
|
||||
extern ADDAPI const char* SALVIUM_CoinsInfo_asset(void* coinsInfo_ptr);
|
||||
// virtual uint8_t type() const = 0;
|
||||
extern ADDAPI uint8_t SALVIUM_CoinsInfo_type(void* coinsInfo_ptr);
|
||||
// };
|
||||
// struct Coins
|
||||
// {
|
||||
@@ -376,14 +385,18 @@ extern ADDAPI void SALVIUM_Subaddress_refresh(void* subaddress_ptr, uint32_t acc
|
||||
// m_address(_address),
|
||||
// m_label(_label),
|
||||
// m_balance(_balance),
|
||||
// m_unlockedBalance(_unlockedBalance) {}
|
||||
// m_unlockedBalance(_unlockedBalance),
|
||||
// m_balance_sal1(_balance_sal1),
|
||||
// m_unlockedBalance_sal1(_unlockedBalance_sal1) {}
|
||||
|
||||
// private:
|
||||
// std::size_t m_rowId;
|
||||
// std::string m_address;
|
||||
// std::string m_label;
|
||||
// std::string m_balance;
|
||||
// std::string m_balance_sal1;
|
||||
// std::string m_unlockedBalance;
|
||||
// std::string m_unlockedBalance_sal1;
|
||||
// public:
|
||||
// std::string extra;
|
||||
extern ADDAPI const char* SALVIUM_SubaddressAccountRow_extra(void* subaddressAccountRow_ptr);
|
||||
@@ -392,9 +405,9 @@ extern ADDAPI const char* SALVIUM_SubaddressAccountRow_getAddress(void* subaddre
|
||||
// std::string getLabel() const {return m_label;}
|
||||
extern ADDAPI const char* SALVIUM_SubaddressAccountRow_getLabel(void* subaddressAccountRow_ptr);
|
||||
// std::string getBalance() const {return m_balance;}
|
||||
extern ADDAPI const char* SALVIUM_SubaddressAccountRow_getBalance(void* subaddressAccountRow_ptr);
|
||||
extern ADDAPI const char* SALVIUM_SubaddressAccountRow_getBalance(void* subaddressAccountRow_ptr, const char* asset);
|
||||
// std::string getUnlockedBalance() const {return m_unlockedBalance;}
|
||||
extern ADDAPI const char* SALVIUM_SubaddressAccountRow_getUnlockedBalance(void* subaddressAccountRow_ptr);
|
||||
extern ADDAPI const char* SALVIUM_SubaddressAccountRow_getUnlockedBalance(void* subaddressAccountRow_ptr, const char* asset);
|
||||
// std::size_t getRowId() const {return m_rowId;}
|
||||
extern ADDAPI size_t SALVIUM_SubaddressAccountRow_getRowId(void* subaddressAccountRow_ptr);
|
||||
// };
|
||||
@@ -542,6 +555,14 @@ extern ADDAPI const char* SALVIUM_Wallet_secretSpendKey(void* wallet_ptr);
|
||||
extern ADDAPI const char* SALVIUM_Wallet_publicSpendKey(void* wallet_ptr);
|
||||
// virtual std::string publicMultisigSignerKey() const = 0;
|
||||
extern ADDAPI const char* SALVIUM_Wallet_publicMultisigSignerKey(void* wallet_ptr);
|
||||
// virtual std::string secretViewBalance() const = 0;
|
||||
extern ADDAPI const char* SALVIUM_Wallet_secretViewBalance(void* wallet_ptr);
|
||||
// virtual std::string secretProveSpend() const = 0;
|
||||
extern ADDAPI const char* SALVIUM_Wallet_secretProveSpend(void* wallet_ptr);
|
||||
// virtual std::string secretGenerateAddress() const = 0;
|
||||
extern ADDAPI const char* SALVIUM_Wallet_secretGenerateAddress(void* wallet_ptr);
|
||||
// virtual std::string secretGenerateImage() const = 0;
|
||||
extern ADDAPI const char* SALVIUM_Wallet_secretGenerateImage(void* wallet_ptr);
|
||||
// virtual void stop() = 0;
|
||||
extern ADDAPI void SALVIUM_Wallet_stop(void* wallet_ptr);
|
||||
// virtual bool store(const std::string &path) = 0;
|
||||
@@ -715,6 +736,11 @@ extern ADDAPI void* SALVIUM_Wallet_createTransaction(void* wallet_ptr, const cha
|
||||
int pendingTransactionPriority,
|
||||
uint32_t subaddr_account,
|
||||
const char* preferredInputs, const char* separator);
|
||||
extern ADDAPI void* SALVIUM_Wallet_createStakeTransaction(void* wallet_ptr, const char* dst_addr, const char* payment_id,
|
||||
uint64_t amount, uint32_t mixin_count,
|
||||
int pendingTransactionPriority,
|
||||
uint32_t subaddr_account,
|
||||
const char* preferredInputs, const char* separator);
|
||||
// virtual PendingTransaction * createSweepUnmixableTransaction() = 0;
|
||||
// virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) = 0;
|
||||
extern ADDAPI void* SALVIUM_Wallet_loadUnsignedTx(void* wallet_ptr, const char* unsigned_filename);
|
||||
@@ -841,6 +867,8 @@ extern ADDAPI bool SALVIUM_Wallet_getWaitsForDeviceSend(void* wallet_ptr);
|
||||
extern ADDAPI bool SALVIUM_Wallet_getWaitsForDeviceReceive(void* wallet_ptr);
|
||||
extern ADDAPI void SALVIUM_Wallet_setDeviceReceivedData(void* wallet_ptr, unsigned char* data, size_t len);
|
||||
extern ADDAPI void SALVIUM_Wallet_setDeviceSendData(void* wallet_ptr, unsigned char* data, size_t len);
|
||||
extern ADDAPI void SALVIUM_Wallet_setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len));
|
||||
extern ADDAPI const char* SALVIUM_Wallet_serializeCacheToJson(void* wallet_ptr);
|
||||
// };
|
||||
|
||||
// struct WalletManager
|
||||
|
||||
@@ -31,7 +31,7 @@ export function getFileInfo(
|
||||
return fileInfo;
|
||||
}
|
||||
|
||||
async function sha256(buffer: Uint8Array): Promise<string> {
|
||||
async function sha256(buffer: Uint8Array<ArrayBuffer>): Promise<string> {
|
||||
const hashed = new Uint8Array(await crypto.subtle.digest("SHA-256", buffer));
|
||||
return Array.from(hashed).map((i) => i.toString(16).padStart(2, "0")).join("");
|
||||
}
|
||||
@@ -72,7 +72,7 @@ async function tryToDownloadFile(
|
||||
async function validFileExists(filePath: string, fileInfo: FileInfo): Promise<boolean> {
|
||||
const [mainFileName] = fileInfo.names;
|
||||
|
||||
let fileBuffer: Uint8Array;
|
||||
let fileBuffer: Uint8Array<ArrayBuffer>;
|
||||
try {
|
||||
fileBuffer = await Deno.readFile(filePath);
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user