Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 909a4db994 | |||
| 6ed8e1f7ab | |||
| 2a133d0102 | |||
| c74e024f98 | |||
| 4b03e7aefa | |||
| cebd4cb419 | |||
| a8d16f918c | |||
| ddd7d5edea | |||
| 5e90cedb27 | |||
| b506d2a8ee | |||
| d701dd10d3 | |||
| 5635ca4db0 | |||
| c3474df916 | |||
| 1af4416964 | |||
| 0d753a0d79 |
@@ -1,4 +1,4 @@
|
||||
FROM --platform=linux/amd64 ghcr.io/cirruslabs/flutter:3.29.3
|
||||
FROM --platform=linux/amd64 ghcr.io/cirruslabs/flutter:3.24.3
|
||||
# FROM debian:bookworm
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
name: build
|
||||
run-name: build ${{ inputs.flavor || 'peya' }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
flavor:
|
||||
description: monero_c flavor to build
|
||||
required: true
|
||||
default: peya
|
||||
type: choice
|
||||
options:
|
||||
- peya
|
||||
- salvium
|
||||
- monero
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- main
|
||||
paths:
|
||||
- ".gitea/workflows/build.yml"
|
||||
- "build_single.sh"
|
||||
- "apply_patches.sh"
|
||||
- "contrib/depends/**"
|
||||
- "patches/**"
|
||||
- "monero_libwallet2_api_c/**"
|
||||
- "salvium_libwallet2_api_c/**"
|
||||
- "peya_libwallet2_api_c/**"
|
||||
- "impls/monero.dart/**"
|
||||
- "impls/monero.ts/**"
|
||||
- ".gitmodules"
|
||||
|
||||
jobs:
|
||||
build-libs:
|
||||
name: ${{ inputs.flavor || 'peya' }} ${{ matrix.target.name }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target:
|
||||
- name: x86_64 Linux
|
||||
host: x86_64-linux-gnu
|
||||
packages: automake autotools-dev build-essential ca-certificates ccache clang cmake curl git gperf libssl-dev libtool pkg-config python3
|
||||
- name: Win64
|
||||
host: x86_64-w64-mingw32
|
||||
packages: automake autotools-dev build-essential ca-certificates ccache clang cmake curl git libssl-dev libtool pkg-config python3 gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
|
||||
env:
|
||||
FLAVOR: ${{ inputs.flavor || 'peya' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
|
||||
- name: Configure Gitea auth for private submodules
|
||||
env:
|
||||
MONERO_C_GITEA_PAT: ${{ secrets.MONERO_C_GITEA_PAT }}
|
||||
PEYA_GITEA_PAT: ${{ secrets.PEYA_GITEA_PAT }}
|
||||
GITEA_PAT: ${{ secrets.GITEA_PAT }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
AUTH_TOKEN="${MONERO_C_GITEA_PAT:-${PEYA_GITEA_PAT:-${GITEA_PAT:-}}}"
|
||||
|
||||
if [ "${FLAVOR}" != "monero" ] && [ -z "${AUTH_TOKEN}" ]; then
|
||||
echo "Missing Gitea PAT secret for private ${FLAVOR} submodule"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "${AUTH_TOKEN}" ]; then
|
||||
git config --global url."http://tiamak:${AUTH_TOKEN}@54.38.205.168:3000/".insteadOf "http://54.38.205.168:3000/"
|
||||
fi
|
||||
|
||||
git submodule sync
|
||||
git -c protocol.version=2 submodule update --init --force "${FLAVOR}"
|
||||
git -C "${FLAVOR}" submodule sync --recursive
|
||||
git -C "${FLAVOR}" -c protocol.version=2 submodule update --init --force --recursive
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ${{ matrix.target.packages }}
|
||||
|
||||
- name: Prepare MinGW alternatives
|
||||
if: ${{ matrix.target.host == 'x86_64-w64-mingw32' }}
|
||||
run: |
|
||||
sudo update-alternatives --set x86_64-w64-mingw32-g++ "$(which x86_64-w64-mingw32-g++-posix)"
|
||||
sudo update-alternatives --set x86_64-w64-mingw32-gcc "$(which x86_64-w64-mingw32-gcc-posix)"
|
||||
|
||||
- name: Apply patches
|
||||
run: |
|
||||
./apply_patches.sh "${FLAVOR}"
|
||||
|
||||
- name: Build libraries
|
||||
run: |
|
||||
./build_single.sh "${FLAVOR}" "${{ matrix.target.host }}" -j"$(nproc)"
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: https://github.com/actions/upload-artifact@v3
|
||||
with:
|
||||
name: monero-c-${{ env.FLAVOR }}-${{ matrix.target.host }}
|
||||
path: release/${{ env.FLAVOR }}/${{ matrix.target.host }}_*.xz
|
||||
if-no-files-found: error
|
||||
@@ -0,0 +1,72 @@
|
||||
name: consistency
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- main
|
||||
paths:
|
||||
- ".gitea/workflows/consistency.yml"
|
||||
- "generate_checksum.sh"
|
||||
- "impls/monero.dart/**"
|
||||
- "impls/monero.ts/**"
|
||||
- "monero_libwallet2_api_c/**"
|
||||
- "salvium_libwallet2_api_c/**"
|
||||
- "peya_libwallet2_api_c/**"
|
||||
- ".gitmodules"
|
||||
|
||||
jobs:
|
||||
checksums:
|
||||
name: checksum sync
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
|
||||
- name: Generate checksums
|
||||
run: |
|
||||
./generate_checksum.sh
|
||||
|
||||
- name: Check for dirty tree
|
||||
run: |
|
||||
git diff --exit-code
|
||||
|
||||
dart-bindings:
|
||||
name: Dart bindings sync
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
|
||||
- name: Install libclang for ffigen
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y clang libclang-14-dev llvm-14
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: https://github.com/subosito/flutter-action@v2
|
||||
with:
|
||||
channel: stable
|
||||
|
||||
- name: Fetch Dart dependencies
|
||||
run: |
|
||||
cd impls/monero.dart
|
||||
dart pub get
|
||||
|
||||
- name: Regenerate Dart bindings
|
||||
env:
|
||||
LIBCLANG_PATH: /usr/lib/llvm-14/lib
|
||||
run: |
|
||||
cd impls/monero.dart
|
||||
./update_bindings.sh
|
||||
|
||||
- name: Check for dirty tree
|
||||
run: |
|
||||
git diff --exit-code
|
||||
@@ -0,0 +1,243 @@
|
||||
name: release
|
||||
run-name: release ${{ inputs.flavor }} ${{ inputs.tag_name }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag_name:
|
||||
description: Release tag (for example v0.1.0)
|
||||
required: true
|
||||
flavor:
|
||||
description: monero_c flavor to build
|
||||
required: true
|
||||
default: peya
|
||||
type: choice
|
||||
options:
|
||||
- peya
|
||||
- salvium
|
||||
- monero
|
||||
target_ref:
|
||||
description: Branch, tag or commit to build and tag
|
||||
required: true
|
||||
default: develop
|
||||
release_name:
|
||||
description: Optional release title
|
||||
required: false
|
||||
release_notes:
|
||||
description: Release notes / body
|
||||
required: false
|
||||
prerelease:
|
||||
description: Mark release as prerelease
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
draft:
|
||||
description: Create release as draft
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
name: Create release
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
release_id: ${{ steps.release.outputs.release_id }}
|
||||
flavor: ${{ inputs.flavor }}
|
||||
steps:
|
||||
- name: Install release tooling
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y curl jq
|
||||
|
||||
- name: Create or reuse Gitea release
|
||||
id: release
|
||||
env:
|
||||
MONERO_C_GITEA_PAT: ${{ secrets.MONERO_C_GITEA_PAT }}
|
||||
PEYA_GITEA_PAT: ${{ secrets.PEYA_GITEA_PAT }}
|
||||
GITEA_PAT: ${{ secrets.GITEA_PAT }}
|
||||
GITEA_API: ${{ github.server_url }}/api/v1
|
||||
REPO: ${{ github.repository }}
|
||||
TAG_NAME: ${{ inputs.tag_name }}
|
||||
INPUT_RELEASE_NAME: ${{ inputs.release_name }}
|
||||
RELEASE_NOTES: ${{ inputs.release_notes }}
|
||||
TARGET_COMMITISH: ${{ inputs.target_ref }}
|
||||
INPUT_PRERELEASE: ${{ inputs.prerelease }}
|
||||
INPUT_DRAFT: ${{ inputs.draft }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
GITEA_TOKEN="${MONERO_C_GITEA_PAT:-${PEYA_GITEA_PAT:-${GITEA_PAT:-}}}"
|
||||
if [ -z "${GITEA_TOKEN}" ]; then
|
||||
echo "Missing Gitea PAT secret for release publishing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "${INPUT_RELEASE_NAME}" ]; then
|
||||
RELEASE_NAME="${INPUT_RELEASE_NAME}"
|
||||
else
|
||||
RELEASE_NAME="Release ${TAG_NAME}"
|
||||
fi
|
||||
|
||||
get_release_url="${GITEA_API}/repos/${REPO}/releases/tags/${TAG_NAME}"
|
||||
create_release_url="${GITEA_API}/repos/${REPO}/releases"
|
||||
|
||||
status="$(curl -sS -o /tmp/release.json -w '%{http_code}' \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${get_release_url}")"
|
||||
|
||||
if [ "${status}" = "200" ]; then
|
||||
echo "release_id=$(jq -r '.id' /tmp/release.json)" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${status}" != "404" ]; then
|
||||
echo "Unexpected response while checking release: HTTP ${status}"
|
||||
cat /tmp/release.json
|
||||
exit 1
|
||||
fi
|
||||
|
||||
jq -n \
|
||||
--arg tag_name "${TAG_NAME}" \
|
||||
--arg target_commitish "${TARGET_COMMITISH}" \
|
||||
--arg name "${RELEASE_NAME}" \
|
||||
--arg body "${RELEASE_NOTES}" \
|
||||
--argjson draft "${INPUT_DRAFT}" \
|
||||
--argjson prerelease "${INPUT_PRERELEASE}" \
|
||||
'{tag_name:$tag_name,target_commitish:$target_commitish,name:$name,body:$body,draft:$draft,prerelease:$prerelease}' \
|
||||
> /tmp/release-payload.json
|
||||
|
||||
curl -sS \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
--data @/tmp/release-payload.json \
|
||||
"${create_release_url}" \
|
||||
-o /tmp/release.json
|
||||
|
||||
if ! jq -e '.id' /tmp/release.json >/dev/null; then
|
||||
cat /tmp/release.json
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "release_id=$(jq -r '.id' /tmp/release.json)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
build-release:
|
||||
name: ${{ matrix.target.name }}
|
||||
needs: create-release
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target:
|
||||
- name: x86_64 Linux
|
||||
host: x86_64-linux-gnu
|
||||
packages: automake autotools-dev build-essential ca-certificates ccache clang cmake curl git gperf libssl-dev libtool pkg-config python3
|
||||
- name: Win64
|
||||
host: x86_64-w64-mingw32
|
||||
packages: automake autotools-dev build-essential ca-certificates ccache clang cmake curl git libssl-dev libtool pkg-config python3 gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
ref: ${{ inputs.target_ref }}
|
||||
|
||||
- name: Configure Gitea auth for private submodules
|
||||
env:
|
||||
MONERO_C_GITEA_PAT: ${{ secrets.MONERO_C_GITEA_PAT }}
|
||||
PEYA_GITEA_PAT: ${{ secrets.PEYA_GITEA_PAT }}
|
||||
GITEA_PAT: ${{ secrets.GITEA_PAT }}
|
||||
FLAVOR: ${{ needs.create-release.outputs.flavor }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
AUTH_TOKEN="${MONERO_C_GITEA_PAT:-${PEYA_GITEA_PAT:-${GITEA_PAT:-}}}"
|
||||
|
||||
if [ "${FLAVOR}" != "monero" ] && [ -z "${AUTH_TOKEN}" ]; then
|
||||
echo "Missing Gitea PAT secret for private ${FLAVOR} submodule"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "${AUTH_TOKEN}" ]; then
|
||||
git config --global url."http://tiamak:${AUTH_TOKEN}@54.38.205.168:3000/".insteadOf "http://54.38.205.168:3000/"
|
||||
fi
|
||||
|
||||
git submodule sync
|
||||
git -c protocol.version=2 submodule update --init --force "${FLAVOR}"
|
||||
git -C "${FLAVOR}" submodule sync --recursive
|
||||
git -C "${FLAVOR}" -c protocol.version=2 submodule update --init --force --recursive
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ${{ matrix.target.packages }}
|
||||
|
||||
- name: Prepare MinGW alternatives
|
||||
if: ${{ matrix.target.host == 'x86_64-w64-mingw32' }}
|
||||
run: |
|
||||
sudo update-alternatives --set x86_64-w64-mingw32-g++ "$(which x86_64-w64-mingw32-g++-posix)"
|
||||
sudo update-alternatives --set x86_64-w64-mingw32-gcc "$(which x86_64-w64-mingw32-gcc-posix)"
|
||||
|
||||
- name: Apply patches
|
||||
run: |
|
||||
./apply_patches.sh "${{ needs.create-release.outputs.flavor }}"
|
||||
|
||||
- name: Build release libraries
|
||||
run: |
|
||||
./build_single.sh "${{ needs.create-release.outputs.flavor }}" "${{ matrix.target.host }}" -j"$(nproc)"
|
||||
|
||||
- name: Upload release assets
|
||||
env:
|
||||
MONERO_C_GITEA_PAT: ${{ secrets.MONERO_C_GITEA_PAT }}
|
||||
PEYA_GITEA_PAT: ${{ secrets.PEYA_GITEA_PAT }}
|
||||
GITEA_PAT: ${{ secrets.GITEA_PAT }}
|
||||
GITEA_API: ${{ github.server_url }}/api/v1
|
||||
REPO: ${{ github.repository }}
|
||||
RELEASE_ID: ${{ needs.create-release.outputs.release_id }}
|
||||
FLAVOR: ${{ needs.create-release.outputs.flavor }}
|
||||
HOST: ${{ matrix.target.host }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
GITEA_TOKEN="${MONERO_C_GITEA_PAT:-${PEYA_GITEA_PAT:-${GITEA_PAT:-}}}"
|
||||
if [ -z "${GITEA_TOKEN}" ]; then
|
||||
echo "Missing Gitea PAT secret for release publishing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
assets_url="${GITEA_API}/repos/${REPO}/releases/${RELEASE_ID}/assets"
|
||||
shopt -s nullglob
|
||||
files=(release/${FLAVOR}/${HOST}_*.xz)
|
||||
|
||||
if [ "${#files[@]}" -eq 0 ]; then
|
||||
echo "No release assets found in release/${FLAVOR} for ${HOST}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curl -sS \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${assets_url}" \
|
||||
-o /tmp/release-assets.json
|
||||
|
||||
for asset in "${files[@]}"; do
|
||||
asset_name="$(basename "${asset}")"
|
||||
existing_id="$(jq -r --arg name "${asset_name}" '.[] | select(.name == $name) | .id' /tmp/release-assets.json | head -n 1)"
|
||||
|
||||
if [ -n "${existing_id}" ]; then
|
||||
curl -sS \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-X DELETE \
|
||||
"${assets_url}/${existing_id}" \
|
||||
>/dev/null
|
||||
fi
|
||||
|
||||
curl -sS \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-X POST \
|
||||
-F "attachment=@${asset}" \
|
||||
"${assets_url}?name=${asset_name}" \
|
||||
>/dev/null
|
||||
done
|
||||
@@ -1,56 +0,0 @@
|
||||
name: Check if checksums are in sync
|
||||
on: [push]
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
jobs:
|
||||
android:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- uses: 8BitJonny/gh-get-current-pr@4.0.0
|
||||
id: PR
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: stable
|
||||
- name: generate checksums
|
||||
run: |
|
||||
./generate_checksum.sh
|
||||
- name: check if git tree is clean
|
||||
run: |
|
||||
if [ -z "$(git status --porcelain)" ]; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
- uses: actions/github-script@v7
|
||||
continue-on-error: true
|
||||
id: get_issue_number
|
||||
with:
|
||||
script: |
|
||||
if (context.issue.number) {
|
||||
// Return issue number if present
|
||||
return context.issue.number;
|
||||
} else {
|
||||
// Otherwise return issue number from commit
|
||||
return (
|
||||
await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
||||
commit_sha: context.sha,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
})
|
||||
).data[0].number;
|
||||
}
|
||||
result-encoding: string
|
||||
- name: Create or update comment
|
||||
continue-on-error: true
|
||||
if: failure()
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
with:
|
||||
issue-number: ${{steps.get_issue_number.outputs.result}}
|
||||
body: |
|
||||
Invalid checksums, please run `./generate_checksum.sh`
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
name: Check if dart bindings are in sync
|
||||
on: [push]
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
jobs:
|
||||
android:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- uses: 8BitJonny/gh-get-current-pr@4.0.0
|
||||
id: PR
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: stable
|
||||
- name: generate bindings
|
||||
run: |
|
||||
cd impls/monero.dart
|
||||
./update_bindings.sh
|
||||
- name: check if git tree is clean
|
||||
run: |
|
||||
if [ -z "$(git status --porcelain)" ]; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
- uses: actions/github-script@v7
|
||||
continue-on-error: true
|
||||
id: get_issue_number
|
||||
with:
|
||||
script: |
|
||||
if (context.issue.number) {
|
||||
// Return issue number if present
|
||||
return context.issue.number;
|
||||
} else {
|
||||
// Otherwise return issue number from commit
|
||||
return (
|
||||
await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
||||
commit_sha: context.sha,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
})
|
||||
).data[0].number;
|
||||
}
|
||||
result-encoding: string
|
||||
- name: Create or update comment
|
||||
continue-on-error: true
|
||||
if: failure()
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
with:
|
||||
issue-number: ${{steps.get_issue_number.outputs.result}}
|
||||
body: |
|
||||
Invalid bindings found in monero.dart, make sure to run `./impls/monero.dart/update_bindings.sh`
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
name: Build documentation
|
||||
|
||||
on: [push]
|
||||
|
||||
env:
|
||||
# Name of module and id separated by a slash
|
||||
INSTANCE: Writerside/in
|
||||
# Replace HI with the ID of the instance in capital letters
|
||||
ARTIFACT: webHelpIN2-all.zip
|
||||
# Docker image version
|
||||
DOCKER_VERSION: "242.21870"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '^1.23.2'
|
||||
- uses: hecrj/setup-rust-action@v2
|
||||
with:
|
||||
rust-version: stable
|
||||
- name: Update image
|
||||
run: cd docs && ./update_screenshot.sh
|
||||
- name: Build Writerside docs using Docker
|
||||
uses: JetBrains/writerside-github-action@v4
|
||||
with:
|
||||
location: "docs"
|
||||
instance: ${{ env.INSTANCE }}
|
||||
artifact: ${{ env.ARTIFACT }}
|
||||
docker-version: ${{ env.DOCKER_VERSION }}
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: artifact
|
||||
path: artifacts/${{ env.ARTIFACT }}
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: artifacts/${{ env.ARTIFACT }}
|
||||
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
@@ -1,615 +0,0 @@
|
||||
name: full compatibility check
|
||||
on: [push]
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
jobs:
|
||||
lib_mingw:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
coin: [monero, wownero]
|
||||
target: [x86_64-w64-mingw32, i686-w64-mingw32]
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:24.04
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt update
|
||||
apt install -y pigz build-essential pkg-config autoconf libtool ccache make cmake gcc g++ git curl lbzip2 gperf gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 gcc-mingw-w64-i686 g++-mingw-w64-i686
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- 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 monero
|
||||
./apply_patches.sh wownero
|
||||
./apply_patches.sh zano
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
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 -p release/gh/
|
||||
for i in release/${{ matrix.coin }}/*
|
||||
do
|
||||
cp "$i" "release/gh/${{ matrix.coin }}_$(basename $i)"
|
||||
done
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: release/gh/*
|
||||
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
- name: Upload lib
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
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
|
||||
steps:
|
||||
- name: Free Disk Space
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
uses: jlumbroso/free-disk-space@main
|
||||
with:
|
||||
tool-cache: false
|
||||
android: true
|
||||
dotnet: true
|
||||
haskell: true
|
||||
large-packages: true
|
||||
docker-images: true
|
||||
swap-storage: true
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y llvm pigz build-essential pkg-config autoconf libtool ccache make cmake gcc g++ git curl lbzip2 libtinfo6 gperf unzip python-is-python3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- 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 monero
|
||||
./apply_patches.sh wownero
|
||||
./apply_patches.sh zano
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
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 -p release/gh/
|
||||
for i in release/${{ matrix.coin }}/*
|
||||
do
|
||||
cp "$i" "release/gh/${{ matrix.coin }}_$(basename $i)"
|
||||
done
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: release/gh/*
|
||||
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
- name: Upload lib
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
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
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt update
|
||||
apt install -y pigz build-essential pkg-config autoconf libtool ccache make cmake gcc g++ git curl lbzip2 libtinfo5 gperf gcc-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-i686-linux-gnu g++-i686-linux-gnu
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- 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 monero
|
||||
./apply_patches.sh wownero
|
||||
./apply_patches.sh zano
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
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 -p release/gh/
|
||||
for i in release/${{ matrix.coin }}/*
|
||||
do
|
||||
cp "$i" "release/gh/${{ matrix.coin }}_$(basename $i)"
|
||||
done
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: release/gh/*
|
||||
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
- name: Upload lib
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
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-15
|
||||
steps:
|
||||
- name: Checkout monero_c repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: MrCyjaneK/monero_c
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '16.4'
|
||||
- name: install dependencies
|
||||
run: |
|
||||
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 monero
|
||||
./apply_patches.sh wownero
|
||||
./apply_patches.sh zano
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
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$(sysctl -n hw.logicalcpu)
|
||||
- name: rename artifacts
|
||||
run: |
|
||||
mkdir -p release/gh/
|
||||
for i in release/${{ matrix.coin }}/*
|
||||
do
|
||||
cp "$i" "release/gh/${{ matrix.coin }}_$(basename $i)"
|
||||
done
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: release/gh/*
|
||||
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
- name: Upload lib
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
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:
|
||||
- name: Checkout monero_c repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: MrCyjaneK/monero_c
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '16.4'
|
||||
- name: install dependencies
|
||||
run: |
|
||||
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 monero
|
||||
./apply_patches.sh wownero
|
||||
./apply_patches.sh zano
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
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$(sysctl -n hw.logicalcpu)
|
||||
- name: rename artifacts
|
||||
run: |
|
||||
mkdir -p release/gh/
|
||||
for i in release/${{ matrix.coin }}/*
|
||||
do
|
||||
cp "$i" "release/gh/${{ matrix.coin }}_$(basename $i)"
|
||||
done
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: release/gh/*
|
||||
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
- name: Upload lib
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
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]
|
||||
strategy:
|
||||
matrix:
|
||||
coin: [monero, wownero, zano]
|
||||
platform: [android, ios, linux, macos]
|
||||
include:
|
||||
- coin: monero
|
||||
platform: mingw
|
||||
- coin: wownero
|
||||
platform: mingw
|
||||
steps:
|
||||
- name: Create release directory
|
||||
run: mkdir -p release/${{ matrix.coin }}
|
||||
|
||||
- name: Download Android artifacts
|
||||
if: matrix.platform == 'android'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: android-${{ matrix.coin }}-*
|
||||
path: temp-android
|
||||
merge-multiple: true
|
||||
|
||||
- name: Download iOS artifacts
|
||||
if: matrix.platform == 'ios'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: ios-${{ matrix.coin }}-*
|
||||
path: temp-ios
|
||||
merge-multiple: true
|
||||
|
||||
- name: Download Linux artifacts
|
||||
if: matrix.platform == 'linux'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: linux-${{ matrix.coin }}-*
|
||||
path: temp-linux
|
||||
merge-multiple: true
|
||||
|
||||
- name: Download macOS artifacts
|
||||
if: matrix.platform == 'macos'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
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:
|
||||
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: ${{ 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:
|
||||
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 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]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
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:
|
||||
deno-version: vx.x.x
|
||||
- name: Create symlink
|
||||
run: |
|
||||
cd impls/monero.ts
|
||||
mkdir lib
|
||||
cd lib
|
||||
ln -s ../../../release/monero/x86_64-linux-gnu_libwallet2_api_c.so
|
||||
mv x86_64-linux-gnu_libwallet2_api_c.so monero_libwallet2_api_c.so
|
||||
cd ..
|
||||
- name: Run tests
|
||||
run: |
|
||||
cd impls/monero.ts
|
||||
deno run --unstable-ffi --allow-ffi checksum.ts
|
||||
|
||||
regression_tests_linux:
|
||||
name: linux regression tests
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
coin: [monero, wownero]
|
||||
needs: [lib_linux]
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: denoland/setup-deno@v2
|
||||
with:
|
||||
deno-version: v2.x
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
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
|
||||
|
||||
regression_tests_macos:
|
||||
name: macos regression tests
|
||||
strategy:
|
||||
matrix:
|
||||
coin: [monero, wownero]
|
||||
needs: [lib_macos]
|
||||
runs-on: macos-15
|
||||
steps:
|
||||
- uses: denoland/setup-deno@v2
|
||||
with:
|
||||
deno-version: canary
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
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
|
||||
|
||||
integration_tests_linux:
|
||||
name: linux integration tests
|
||||
strategy:
|
||||
matrix:
|
||||
coin: [monero, wownero]
|
||||
needs: [lib_linux]
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: denoland/setup-deno@v2
|
||||
with:
|
||||
deno-version: v2.x
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
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
|
||||
env:
|
||||
SECRET_WALLET_PASSWORD: ${{ secrets.SECRET_WALLET_PASSWORD }}
|
||||
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-15
|
||||
steps:
|
||||
- uses: denoland/setup-deno@v2
|
||||
with:
|
||||
deno-version: v2.x
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
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
|
||||
env:
|
||||
SECRET_WALLET_PASSWORD: ${{ secrets.SECRET_WALLET_PASSWORD }}
|
||||
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]
|
||||
steps:
|
||||
- uses: actions/github-script@v7
|
||||
continue-on-error: true
|
||||
id: get_issue_number
|
||||
with:
|
||||
script: |
|
||||
if (context.issue.number) {
|
||||
// Return issue number if present
|
||||
return context.issue.number;
|
||||
} else {
|
||||
// Otherwise return issue number from commit
|
||||
return (
|
||||
await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
||||
commit_sha: context.sha,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
})
|
||||
).data[0].number;
|
||||
}
|
||||
result-encoding: string
|
||||
- name: Find Comment
|
||||
continue-on-error: true
|
||||
uses: peter-evans/find-comment@v3
|
||||
id: fc
|
||||
with:
|
||||
issue-number: ${{steps.get_issue_number.outputs.result}}
|
||||
comment-author: 'github-actions[bot]'
|
||||
body-includes: download artifacts
|
||||
- name: Update comment
|
||||
continue-on-error: true
|
||||
if: steps.fc.outcome == 'success'
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
with:
|
||||
comment-id: ${{ steps.fc.outputs.comment-id }}
|
||||
issue-number: ${{steps.get_issue_number.outputs.result}}
|
||||
body: |
|
||||
[download artifacts #${{github.run_id}}](https://nightly.link/MrCyjaneK/monero_c/actions/runs/${{github.run_id}})
|
||||
edit-mode: replace
|
||||
- name: Create comment
|
||||
continue-on-error: true
|
||||
if: steps.fc.outcome == 'failure'
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
with:
|
||||
issue-number: ${{steps.get_issue_number.outputs.result}}
|
||||
body: |
|
||||
[download artifacts #${{github.run_id}}](https://nightly.link/MrCyjaneK/monero_c/actions/runs/${{github.run_id}}) (this comment will update whenever you push)
|
||||
+8
-16
@@ -3,21 +3,13 @@
|
||||
url = https://github.com/monero-project/monero
|
||||
branch = release-v0.18
|
||||
shallow = true
|
||||
[submodule "wownero"]
|
||||
path = wownero
|
||||
url = https://codeberg.org/wownero/wownero
|
||||
shallow = true
|
||||
[submodule "zano"]
|
||||
path = zano
|
||||
url = https://github.com/hyle-team/zano
|
||||
shallow = false
|
||||
[submodule "wownero_libwallet2_api_c/wownero-seed"]
|
||||
path = wownero_libwallet2_api_c/wownero-seed
|
||||
url = https://github.com/MrCyjaneK/wownero-seed
|
||||
branch = cyjan-namespace2
|
||||
shallow = true
|
||||
[submodule "salvium"]
|
||||
path = salvium
|
||||
url = https://github.com/salvium/salvium
|
||||
branch = main
|
||||
shallow = true
|
||||
url = http://54.38.205.168:3000/tiamak/salvium.git
|
||||
branch = salvium_one
|
||||
shallow = true
|
||||
[submodule "peya"]
|
||||
path = peya
|
||||
url = http://54.38.205.168:3000/tiamak/Peya.git
|
||||
branch = develop
|
||||
shallow = true
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
TL;DR:
|
||||
|
||||
```bash
|
||||
$ rm -rf monero wownero release
|
||||
$ rm -rf monero salvium peya release
|
||||
$ git submodule update --init --recursive --force
|
||||
$ for coin in monero wownero zano; do ./apply_patches.sh $coin; done
|
||||
$ for coin in monero salvium peya; do ./apply_patches.sh $coin; done
|
||||
```
|
||||
|
||||
Broken? Not working? Need help? https://moneroc.mrcyjanek.net/
|
||||
|
||||
+5
-16
@@ -6,14 +6,15 @@ repo="$1"
|
||||
|
||||
if [[ "x$repo" == "x" ]];
|
||||
then
|
||||
echo "Usage: $0 monero/wownero/zano/salvium"
|
||||
echo "Usage: $0 monero/salvium/peya"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "x$repo" != "xwownero" && "x$repo" != "xmonero" && "x$repo" != "xzano" && "x$repo" != "xsalvium" ]];
|
||||
if [[ "x$repo" != "xmonero" && "x$repo" != "xsalvium" && "x$repo" != "xpeya" ]];
|
||||
then
|
||||
echo "Usage: $0 monero/wownero/zano/salvium"
|
||||
echo "Invalid target given, only monero, wownero,zano, and salvium are supported targets"
|
||||
echo "Usage: $0 monero/salvium/peya"
|
||||
echo "Invalid target given, only monero, salvium, and peya are supported targets"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "$repo" ]]
|
||||
@@ -32,18 +33,6 @@ fi
|
||||
set -e
|
||||
cd $repo
|
||||
git am -3 --whitespace=fix --reject ../patches/$repo/*.patch
|
||||
if [[ "$repo" == "wownero" ]];
|
||||
then
|
||||
pushd external/randomwow
|
||||
git remote set-url origin https://github.com/mrcyjanek/randomwow.git
|
||||
popd
|
||||
fi
|
||||
if [[ "$repo" == "zano" ]];
|
||||
then
|
||||
pushd contrib/tor-connect
|
||||
git remote set-url origin https://github.com/mrcyjanek/tor-connect.git
|
||||
popd
|
||||
fi
|
||||
git submodule init
|
||||
git submodule update --init --recursive --force
|
||||
git am -3 <<EOF
|
||||
|
||||
+5
-9
@@ -20,13 +20,13 @@ set -e
|
||||
repo=$1
|
||||
if [[ "x$repo" == "x" ]];
|
||||
then
|
||||
echo "Usage: $0 monero/wownero/zano/salvium $(gcc -dumpmachine) -j$proccount"
|
||||
echo "Usage: $0 monero/salvium/peya $(gcc -dumpmachine) -j$proccount"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "x$repo" != "xwownero" && "x$repo" != "xmonero" && "x$repo" != "xzano" && "x$repo" != "xsalvium" ]];
|
||||
if [[ "x$repo" != "xmonero" && "x$repo" != "xsalvium" && "x$repo" != "xpeya" ]];
|
||||
then
|
||||
echo "Usage: $0 monero/wownero/zano/salvium $(gcc -dumpmachine) -j$proccount"
|
||||
echo "Usage: $0 monero/salvium/peya $(gcc -dumpmachine) -j$proccount"
|
||||
echo "Invalid target given"
|
||||
exit 1
|
||||
fi
|
||||
@@ -41,7 +41,7 @@ fi
|
||||
HOST_ABI="$2"
|
||||
if [[ "x$HOST_ABI" == "x" ]];
|
||||
then
|
||||
echo "Usage: $0 monero/wownero/zano/salvium $(gcc -dumpmachine) -j$proccount"
|
||||
echo "Usage: $0 monero/salvium/peya $(gcc -dumpmachine) -j$proccount"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -49,7 +49,7 @@ NPROC="$3"
|
||||
|
||||
if [[ "x$NPROC" == "x" ]];
|
||||
then
|
||||
echo "Usage: $0 monero/wownero/zano/salvium $(gcc -dumpmachine) -j$proccount"
|
||||
echo "Usage: $0 monero/salvium/peya $(gcc -dumpmachine) -j$proccount"
|
||||
exit 1
|
||||
fi
|
||||
cd $(dirname $0)
|
||||
@@ -68,10 +68,6 @@ buildType=Debug
|
||||
pushd ${repo}_libwallet2_api_c
|
||||
rm -rf build/${HOST_ABI} || true
|
||||
mkdir -p build/${HOST_ABI} -p
|
||||
if [[ "$repo" == "zano" ]];
|
||||
then
|
||||
EXTRA_CMAKE_FLAGS="-DCAKEWALLET=ON"
|
||||
fi
|
||||
pushd build/${HOST_ABI}
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=$PWD/../../../contrib/depends/${HOST_ABI}/share/toolchain.cmake $EXTRA_CMAKE_FLAGS -DUSE_DEVICE_TREZOR=OFF -DMONERO_FLAVOR=$repo -DCMAKE_BUILD_TYPE=Debug -DHOST_ABI=${HOST_ABI} ../..
|
||||
make $NPROC
|
||||
|
||||
Vendored
-265
@@ -1,265 +0,0 @@
|
||||
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}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
+12
-38
@@ -13,17 +13,6 @@ 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)
|
||||
@@ -121,34 +110,19 @@ 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 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")
|
||||
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)
|
||||
|
||||
$(host_arch)_$(host_os)_id_string:=$(HOST_ID_SALT)
|
||||
$(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")
|
||||
$(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)
|
||||
|
||||
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages)
|
||||
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)
|
||||
@@ -230,8 +204,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) $($(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 )
|
||||
( 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 )
|
||||
endef
|
||||
|
||||
define check_or_remove_sources
|
||||
|
||||
+12
-142
@@ -36,7 +36,7 @@ define fetch_file
|
||||
endef
|
||||
|
||||
define int_get_build_recipe_hash
|
||||
$(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)_all_file_checksums:=$(shell $(build_SHA256SUM) $(meta_depends) packages/$(1).mk $(addprefix $(PATCHES_PATH)/$(1)/,$($(1)_patches)) | cut -d" " -f1))
|
||||
$(eval $(1)_recipe_hash:=$(shell echo -n "$($(1)_all_file_checksums)" | $(build_SHA256SUM) | cut -d" " -f1))
|
||||
endef
|
||||
|
||||
@@ -46,8 +46,6 @@ $(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
|
||||
@@ -61,14 +59,10 @@ $(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
|
||||
@@ -79,8 +73,6 @@ $(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))
|
||||
|
||||
|
||||
@@ -206,183 +198,61 @@ 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) v$($(1)_version) ==="
|
||||
$(AT)echo " Build ID: $($(1)_build_id)"
|
||||
$(AT)echo " Extract directory: $($(1)_extract_dir)"
|
||||
$(AT)echo Extracting $(1)...
|
||||
$(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) v$($(1)_version) ==="
|
||||
$(AT)echo " Dependencies: $($(1)_dependencies)"
|
||||
$(AT)echo " Patch directory: $($(1)_patch_dir)"
|
||||
$(AT)echo " Patches: $($(1)_patches)"
|
||||
$(AT)echo Preprocessing $(1)...
|
||||
$(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) v$($(1)_version) ==="
|
||||
$(AT)echo " Build directory: $($(1)_build_dir)"
|
||||
$(AT)echo " Host prefix: $(host_prefix)"
|
||||
$(AT)echo " All dependencies: $($(1)_all_dependencies)"
|
||||
$(AT)echo Configuring $(1)...
|
||||
$(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) v$($(1)_version) ==="
|
||||
$(AT)echo " Build directory: $($(1)_build_dir)"
|
||||
$(AT)echo " Build environment: $($(1)_build_env)"
|
||||
$(AT)echo Building $(1)...
|
||||
$(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) v$($(1)_version) ==="
|
||||
$(AT)echo " Staging directory: $($(1)_staging_dir)"
|
||||
$(AT)echo " Staging prefix: $($(1)_staging_prefix_dir)"
|
||||
$(AT)echo Staging $(1)...
|
||||
$(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) v$($(1)_version) ==="
|
||||
$(AT)echo " Postprocessing directory: $($(1)_staging_prefix_dir)"
|
||||
$(AT)echo Postprocessing $(1)...
|
||||
$(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) v$($(1)_version) ==="
|
||||
$(AT)echo " Build ID: $($(1)_build_id)"
|
||||
$(AT)echo " Cache file: $$@"
|
||||
$(AT)echo " Compression: $(COMPRESS_CMD)"
|
||||
$(AT)echo Caching $(1)...
|
||||
$(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_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)
|
||||
$(1): | $($(1)_cached_checksum)
|
||||
.SECONDARY: $($(1)_cached) $($(1)_postprocessed) $($(1)_staged) $($(1)_built) $($(1)_configured) $($(1)_preprocessed) $($(1)_extracted) $($(1)_fetched)
|
||||
|
||||
endef
|
||||
|
||||
stages = fetched extracted preprocessed configured built staged postprocessed cached cached_checksum prebuilt_downloaded
|
||||
stages = fetched extracted preprocessed configured built staged postprocessed cached cached_checksum
|
||||
|
||||
define ext_add_stages
|
||||
$(foreach stage,$(stages),
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package=android_ndk
|
||||
$(package)_version=28c
|
||||
$(package)_version=26d
|
||||
$(package)_download_path=https://dl.google.com/android/repository/
|
||||
$(package)_file_name=android-ndk-r$($(package)_version)-linux.zip
|
||||
$(package)_sha256_hash=dfb20d396df28ca02a8c708314b814a4d961dc9074f9a161932746f815aa552f
|
||||
$(package)_sha256_hash=eefeafe7ccf177de7cc57158da585e7af119bb7504a63604ad719e4b2a328b54
|
||||
|
||||
$(package)_version_apiversion=21
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ $(package)_config_opts_android=threadapi=pthread runtime-link=static target-os=a
|
||||
$(package)_config_opts_darwin=--toolset=darwin runtime-link=static
|
||||
$(package)_config_opts_ios=--toolset=darwin-$($(package)_ios_COMPILER_VERSION)~iphone runtime-link=static
|
||||
$(package)_config_opts_iossimulator=--toolset=darwin-$($(package)_ios_COMPILER_VERSION)~iphone runtime-link=static
|
||||
$(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static
|
||||
$(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static define=BOOST_LOG_WITHOUT_EVENT_LOG
|
||||
$(package)_config_opts_x86_64_mingw32=address-model=64
|
||||
$(package)_config_opts_i686_mingw32=address-model=32
|
||||
$(package)_config_opts_i686_linux=address-model=32 architecture=x86
|
||||
|
||||
@@ -15,10 +15,10 @@ define $(package)_config_cmds
|
||||
mkdir buildb &&\
|
||||
cd builda &&\
|
||||
sh ../source/runConfigureICU Linux &&\
|
||||
TARGET= make &&\
|
||||
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 &&\
|
||||
TARGET= $(MAKE) -j$(NUM_CORES) $($(package)_build_opts)
|
||||
$(MAKE) -j$(NUM_CORES) $($(package)_build_opts)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package=unbound
|
||||
$(package)_version=1.23.0
|
||||
$(package)_version=1.19.1
|
||||
$(package)_download_path=https://www.nlnetlabs.nl/downloads/$(package)/
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=959bd5f3875316d7b3f67ee237a56de5565f5b35fc9b5fc3cea6cfe735a03bb8
|
||||
$(package)_sha256_hash=bc1d576f3dd846a0739adc41ffaa702404c6767d2b6082deb9f2f97cbb24a3a9
|
||||
$(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,7 +14,6 @@ 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
|
||||
@@ -25,7 +24,7 @@ define $(package)_preprocess_cmds
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf) $($(package)_config_opts) ac_cv_func_getentropy=no
|
||||
$($(package)_autoconf) ac_cv_func_getentropy=no
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
|
||||
@@ -69,9 +69,6 @@ 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")
|
||||
@@ -100,12 +97,15 @@ 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,6 +132,8 @@ 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@)
|
||||
@@ -195,7 +197,6 @@ endif()
|
||||
|
||||
link_directories(@prefix@/lib)
|
||||
include_directories(@prefix@/include)
|
||||
include_directories(@prefix@/include/wownero_seed)
|
||||
|
||||
add_definitions(-DPOLYSEED_STATIC=ON)
|
||||
add_definitions(-DMOBILE_WALLET_BUILD)
|
||||
@@ -205,4 +206,4 @@ if (ANDROID OR IOS)
|
||||
endif()
|
||||
|
||||
#Create a new global cmake flag that indicates building with depends
|
||||
set (DEPENDS true)
|
||||
set (DEPENDS true)
|
||||
|
||||
@@ -35,7 +35,7 @@ yourself](https://github.com/MrCyjaneK/unnamed_monero_wallet/blob/master-rewrite
|
||||
```bash
|
||||
$ ./build_moneroc.sh
|
||||
--prebuild # allow downloads of prebuilds
|
||||
--coin # monero/wownero
|
||||
--coin # monero/salvium/peya
|
||||
--tag v0.18.3.3-RC45 # which tag to build / download
|
||||
--triplet x86_64-linux-android # which triplet to build / download
|
||||
--location android/.../jniLibs/x86_64 # where to but the libraries
|
||||
@@ -45,4 +45,4 @@ $ ./build_moneroc.sh
|
||||
|
||||
There is a simple script in cake_wallet written in `dart` that runs on all platform (including windows) which downloads
|
||||
all required libraries for selected platforms in one go.
|
||||
[You can take look at it here](https://github.com/cake-tech/cake_wallet/blob/main/tool/download_moneroc_prebuilds.dart)
|
||||
[You can take look at it here](https://github.com/cake-tech/cake_wallet/blob/main/tool/download_moneroc_prebuilds.dart)
|
||||
|
||||
@@ -25,7 +25,8 @@ execute_process(WORKING_DIRECTORY monero_c COMMAND git checkout ${MONERO_C_COMMI
|
||||
execute_process(WORKING_DIRECTORY monero_c COMMAND git submodule update --recursive --force --init)
|
||||
|
||||
execute_process(COMMAND rm monero_c/monero/.patch-applied)
|
||||
execute_process(COMMAND rm monero_c/wownero/.patch-applied)
|
||||
execute_process(COMMAND rm -f monero_c/salvium/.patch-applied)
|
||||
execute_process(COMMAND rm -f monero_c/peya/.patch-applied)
|
||||
|
||||
# apply patches
|
||||
|
||||
@@ -34,7 +35,8 @@ if (MONERO_C_MONERO)
|
||||
endif()
|
||||
|
||||
if (MONERO_C_WOWNERO)
|
||||
execute_process(WORKING_DIRECTORY monero_c COMMAND ./apply_patches.sh wownero)
|
||||
execute_process(WORKING_DIRECTORY monero_c COMMAND ./apply_patches.sh salvium)
|
||||
execute_process(WORKING_DIRECTORY monero_c COMMAND ./apply_patches.sh peya)
|
||||
endif()
|
||||
|
||||
# actually.. build the software
|
||||
@@ -61,4 +63,4 @@ endif()
|
||||
add_custom_target(
|
||||
.host-apple-darwin_monero_libwallet2_api_c.dylib ALL
|
||||
DEPENDS host-apple-darwin_monero_libwallet2_api_c.dylib
|
||||
)
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ then
|
||||
function sha256sum() { shasum -a 256 "$@" ; } && export -f sha256sum
|
||||
fi
|
||||
|
||||
for coin in monero wownero zano salvium;
|
||||
for coin in monero salvium peya;
|
||||
do
|
||||
submodule_hash=$(git ls-tree HEAD ${coin} | xargs | awk '{ print $3 }')
|
||||
COIN=$(echo "$coin" | tr a-z A-Z)
|
||||
@@ -36,4 +36,3 @@ export const ${coin}Checksum = {
|
||||
}
|
||||
EOF
|
||||
done
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
name: PeyaC
|
||||
description: monero_c peya bindings
|
||||
output: 'lib/src/generated_bindings_peya.g.dart'
|
||||
headers:
|
||||
entry-points:
|
||||
- '../../peya_libwallet2_api_c/src/main/cpp/wallet2_api_c.h'
|
||||
|
||||
exclude-all-by-default: true
|
||||
functions:
|
||||
include:
|
||||
- "PEYA_.+"
|
||||
|
||||
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'
|
||||
@@ -1,11 +0,0 @@
|
||||
name: WowneroC
|
||||
description: monero_c wownero bindings
|
||||
output: 'lib/src/generated_bindings_wownero.g.dart'
|
||||
headers:
|
||||
entry-points:
|
||||
- '../../wownero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h'
|
||||
|
||||
exclude-all-by-default: true
|
||||
functions:
|
||||
include:
|
||||
- "WOWNERO_.+"
|
||||
@@ -1,11 +0,0 @@
|
||||
name: ZanoC
|
||||
description: monero_c bindings
|
||||
output: 'lib/src/generated_bindings_zano.g.dart'
|
||||
headers:
|
||||
entry-points:
|
||||
- '../../zano_libwallet2_api_c/src/main/cpp/wallet2_api_c.h'
|
||||
|
||||
exclude-all-by-default: true
|
||||
functions:
|
||||
include:
|
||||
- "ZANO_.+"
|
||||
@@ -3604,17 +3604,6 @@ void Wallet_setLedgerCallback(Pointer<NativeFunction<Void Function(Pointer<Unsig
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Deprecated("TODO")
|
||||
String MONERO_Wallet_serializeCacheToJson(wallet ptr) {
|
||||
debugStart?.call('MONERO_Wallet_serializeCacheToJson');
|
||||
lib ??= MoneroC(DynamicLibrary.open(libPath));
|
||||
final ret = lib!.MONERO_Wallet_serializeCacheToJson(ptr);
|
||||
final str = ret.cast<Utf8>().toDartString();
|
||||
MONERO_free(ret.cast());
|
||||
debugEnd?.call('MONERO_Wallet_serializeCacheToJson');
|
||||
return str;
|
||||
}
|
||||
|
||||
// WalletManager
|
||||
@Deprecated("TODO")
|
||||
typedef WalletManager = Pointer<Void>;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+352
-306
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 = "3515e4c9e537ca3efa664f0b364a3aeb106ff64337f542a262ce104c00b31235";
|
||||
const String wallet2_api_c_cpp_sha256 = "ca44a8d4a201ba6dc0a25c857e95d07bc8d514039b38cd5b3826100e8943cbcc-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe";
|
||||
const String wallet2_api_c_exp_sha256 = "0561e14606106e6b0ec49fb2aefe743ff500f7c3de07557f7041e06aef9509ce";
|
||||
const String wallet2_api_c_h_sha256 = "91218f60e937753a606b1db899ee2ed66a1b02144eb2d79b950ce59804397f84";
|
||||
const String wallet2_api_c_cpp_sha256 = "282128494f3419c128dff7ed67daadd9c2ad0600d10557e829df03d9bc1ad891-9d2f5b392bc46d56449be92295071fbc2cb3d230";
|
||||
const String wallet2_api_c_exp_sha256 = "d0f95f1f3bc49f1f59fe4eb0b61826128d7d3bb75405d5a01a252d02db03097d";
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
const String wallet2_api_c_h_sha256 = "abfc67892fa12c69b7871ed5db0de819b7d6f1a270b2d9f3b0340d95e43bf8a7";
|
||||
const String wallet2_api_c_cpp_sha256 = "5aeae36dc0d58a38d1ac61fc027c3c3f10f4331284f27833fdd3146e12d010b5-cf5969b5dd96d78d5bcc8a2fe97c9e6522c781a5";
|
||||
const String wallet2_api_c_exp_sha256 = "31b4f92a01ff4812c46e5978c0195f725fe93c87bcd8036391a12fe9d5774621";
|
||||
@@ -1,4 +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";
|
||||
const String wallet2_api_c_h_sha256 = "e058d5ca0dc56bc7c40b55f6428a86bd14dd5b4308c03854ef6a1099aa09d107";
|
||||
const String wallet2_api_c_cpp_sha256 = "c40f623ef0801ceccba760d49176d84122c683e4f832e304372b9c931a02ed25-42ec3826a079af4411ed2632b9e469d428e884ae";
|
||||
const String wallet2_api_c_exp_sha256 = "8743a9af4dd98eb5288829226d8815b8f91ad1bd48db10488e65f4b1983549d8";
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
const String wallet2_api_c_h_sha256 = "f99009d1ca1d1c783cc9aa0fb63f680d48753b88124fb5de2079c57b7e34c827";
|
||||
const String wallet2_api_c_cpp_sha256 = "70b39a0bef660cb9ba0397117eb1590e18461ace89ab18141690658a2a537d5d-3e302be710f4e6b4f58642989c8e47711362fa56";
|
||||
const String wallet2_api_c_exp_sha256 = "5f53ea8bbe66a5e5aa6cbc4ca00695900e08589cfd32062e88965a24252d05ba";
|
||||
@@ -1,4 +0,0 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
const String wallet2_api_c_h_sha256 = "8acaa95513b85a984c08e05cc3f2ac7530bb8f32946eeeb45357bd846aef33dd";
|
||||
const String wallet2_api_c_cpp_sha256 = "4efacd3812d53dd268b6869cc0a9560e7320574d96e09136cf067f796edfeba6-fbeb658ae04bed149c0f52af5e8f1e815249f4d4";
|
||||
const String wallet2_api_c_exp_sha256 = "66f3ff655bbfd11ad28c318ab707090b5a93276f436b06f7b1c0f329dba3c9c2";
|
||||
@@ -4488,22 +4488,6 @@ class MoneroC {
|
||||
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,
|
||||
ffi.Pointer<ffi.Char> path,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -760,6 +760,39 @@ class SalviumC {
|
||||
_SALVIUM_TransactionInfo_paymentIdPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
int SALVIUM_TransactionInfo_returnAddresses_count(
|
||||
ffi.Pointer<ffi.Void> txInfo_ptr,
|
||||
) {
|
||||
return _SALVIUM_TransactionInfo_returnAddresses_count(
|
||||
txInfo_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _SALVIUM_TransactionInfo_returnAddresses_countPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<ffi.Void>)>>(
|
||||
'SALVIUM_TransactionInfo_returnAddresses_count');
|
||||
late final _SALVIUM_TransactionInfo_returnAddresses_count =
|
||||
_SALVIUM_TransactionInfo_returnAddresses_countPtr.asFunction<
|
||||
int Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> SALVIUM_TransactionInfo_returnAddresses_at(
|
||||
ffi.Pointer<ffi.Void> txInfo_ptr,
|
||||
int index,
|
||||
) {
|
||||
return _SALVIUM_TransactionInfo_returnAddresses_at(
|
||||
txInfo_ptr,
|
||||
index,
|
||||
);
|
||||
}
|
||||
|
||||
late final _SALVIUM_TransactionInfo_returnAddresses_atPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>,
|
||||
ffi.Int)>>('SALVIUM_TransactionInfo_returnAddresses_at');
|
||||
late final _SALVIUM_TransactionInfo_returnAddresses_at =
|
||||
_SALVIUM_TransactionInfo_returnAddresses_atPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>, int)>();
|
||||
|
||||
int SALVIUM_TransactionInfo_transfers_count(
|
||||
ffi.Pointer<ffi.Void> txInfo_ptr,
|
||||
) {
|
||||
@@ -811,6 +844,24 @@ class SalviumC {
|
||||
_SALVIUM_TransactionInfo_transfers_addressPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>, int)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> SALVIUM_TransactionInfo_transfers_asset(
|
||||
ffi.Pointer<ffi.Void> txInfo_ptr,
|
||||
int asset,
|
||||
) {
|
||||
return _SALVIUM_TransactionInfo_transfers_asset(
|
||||
txInfo_ptr,
|
||||
asset,
|
||||
);
|
||||
}
|
||||
|
||||
late final _SALVIUM_TransactionInfo_transfers_assetPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>,
|
||||
ffi.Int)>>('SALVIUM_TransactionInfo_transfers_asset');
|
||||
late final _SALVIUM_TransactionInfo_transfers_asset =
|
||||
_SALVIUM_TransactionInfo_transfers_assetPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>, int)>();
|
||||
|
||||
int SALVIUM_TransactionHistory_count(
|
||||
ffi.Pointer<ffi.Void> txHistory_ptr,
|
||||
) {
|
||||
@@ -1442,6 +1493,35 @@ class SalviumC {
|
||||
late final _SALVIUM_CoinsInfo_description = _SALVIUM_CoinsInfo_descriptionPtr
|
||||
.asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> SALVIUM_CoinsInfo_asset(
|
||||
ffi.Pointer<ffi.Void> coinsInfo_ptr,
|
||||
) {
|
||||
return _SALVIUM_CoinsInfo_asset(
|
||||
coinsInfo_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _SALVIUM_CoinsInfo_assetPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Void>)>>('SALVIUM_CoinsInfo_asset');
|
||||
late final _SALVIUM_CoinsInfo_asset = _SALVIUM_CoinsInfo_assetPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
int SALVIUM_CoinsInfo_type(
|
||||
ffi.Pointer<ffi.Void> coinsInfo_ptr,
|
||||
) {
|
||||
return _SALVIUM_CoinsInfo_type(
|
||||
coinsInfo_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _SALVIUM_CoinsInfo_typePtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Uint8 Function(ffi.Pointer<ffi.Void>)>>(
|
||||
'SALVIUM_CoinsInfo_type');
|
||||
late final _SALVIUM_CoinsInfo_type = _SALVIUM_CoinsInfo_typePtr.asFunction<
|
||||
int Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
int SALVIUM_Coins_count(
|
||||
ffi.Pointer<ffi.Void> coins_ptr,
|
||||
) {
|
||||
@@ -1834,35 +1914,43 @@ class SalviumC {
|
||||
|
||||
ffi.Pointer<ffi.Char> SALVIUM_SubaddressAccountRow_getBalance(
|
||||
ffi.Pointer<ffi.Void> subaddressAccountRow_ptr,
|
||||
ffi.Pointer<ffi.Char> asset,
|
||||
) {
|
||||
return _SALVIUM_SubaddressAccountRow_getBalance(
|
||||
subaddressAccountRow_ptr,
|
||||
asset,
|
||||
);
|
||||
}
|
||||
|
||||
late final _SALVIUM_SubaddressAccountRow_getBalancePtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>>(
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>>(
|
||||
'SALVIUM_SubaddressAccountRow_getBalance');
|
||||
late final _SALVIUM_SubaddressAccountRow_getBalance =
|
||||
_SALVIUM_SubaddressAccountRow_getBalancePtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> SALVIUM_SubaddressAccountRow_getUnlockedBalance(
|
||||
ffi.Pointer<ffi.Void> subaddressAccountRow_ptr,
|
||||
ffi.Pointer<ffi.Char> asset,
|
||||
) {
|
||||
return _SALVIUM_SubaddressAccountRow_getUnlockedBalance(
|
||||
subaddressAccountRow_ptr,
|
||||
asset,
|
||||
);
|
||||
}
|
||||
|
||||
late final _SALVIUM_SubaddressAccountRow_getUnlockedBalancePtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>>(
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>>(
|
||||
'SALVIUM_SubaddressAccountRow_getUnlockedBalance');
|
||||
late final _SALVIUM_SubaddressAccountRow_getUnlockedBalance =
|
||||
_SALVIUM_SubaddressAccountRow_getUnlockedBalancePtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
int SALVIUM_SubaddressAccountRow_getRowId(
|
||||
ffi.Pointer<ffi.Void> subaddressAccountRow_ptr,
|
||||
@@ -2071,6 +2159,37 @@ class SalviumC {
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
void SALVIUM_Wallet_setStoreTxInfo(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
bool store,
|
||||
) {
|
||||
return _SALVIUM_Wallet_setStoreTxInfo(
|
||||
wallet_ptr,
|
||||
store,
|
||||
);
|
||||
}
|
||||
|
||||
late final _SALVIUM_Wallet_setStoreTxInfoPtr = _lookup<
|
||||
ffi
|
||||
.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Bool)>>(
|
||||
'SALVIUM_Wallet_setStoreTxInfo');
|
||||
late final _SALVIUM_Wallet_setStoreTxInfo = _SALVIUM_Wallet_setStoreTxInfoPtr
|
||||
.asFunction<void Function(ffi.Pointer<ffi.Void>, bool)>();
|
||||
|
||||
bool SALVIUM_Wallet_getStoreTxInfo(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
return _SALVIUM_Wallet_getStoreTxInfo(
|
||||
wallet_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _SALVIUM_Wallet_getStoreTxInfoPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Bool Function(ffi.Pointer<ffi.Void>)>>(
|
||||
'SALVIUM_Wallet_getStoreTxInfo');
|
||||
late final _SALVIUM_Wallet_getStoreTxInfo = _SALVIUM_Wallet_getStoreTxInfoPtr
|
||||
.asFunction<bool Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> SALVIUM_Wallet_getSeedLanguage(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
@@ -2365,6 +2484,70 @@ class SalviumC {
|
||||
_SALVIUM_Wallet_publicMultisigSignerKeyPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> SALVIUM_Wallet_secretViewBalance(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
return _SALVIUM_Wallet_secretViewBalance(
|
||||
wallet_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _SALVIUM_Wallet_secretViewBalancePtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Void>)>>('SALVIUM_Wallet_secretViewBalance');
|
||||
late final _SALVIUM_Wallet_secretViewBalance =
|
||||
_SALVIUM_Wallet_secretViewBalancePtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> SALVIUM_Wallet_secretProveSpend(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
return _SALVIUM_Wallet_secretProveSpend(
|
||||
wallet_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _SALVIUM_Wallet_secretProveSpendPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Void>)>>('SALVIUM_Wallet_secretProveSpend');
|
||||
late final _SALVIUM_Wallet_secretProveSpend =
|
||||
_SALVIUM_Wallet_secretProveSpendPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> SALVIUM_Wallet_secretGenerateAddress(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
return _SALVIUM_Wallet_secretGenerateAddress(
|
||||
wallet_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _SALVIUM_Wallet_secretGenerateAddressPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Void>)>>('SALVIUM_Wallet_secretGenerateAddress');
|
||||
late final _SALVIUM_Wallet_secretGenerateAddress =
|
||||
_SALVIUM_Wallet_secretGenerateAddressPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> SALVIUM_Wallet_secretGenerateImage(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
return _SALVIUM_Wallet_secretGenerateImage(
|
||||
wallet_ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _SALVIUM_Wallet_secretGenerateImagePtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Void>)>>('SALVIUM_Wallet_secretGenerateImage');
|
||||
late final _SALVIUM_Wallet_secretGenerateImage =
|
||||
_SALVIUM_Wallet_secretGenerateImagePtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
void SALVIUM_Wallet_stop(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
) {
|
||||
@@ -3557,6 +3740,55 @@ class SalviumC {
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
ffi.Pointer<ffi.Void> SALVIUM_Wallet_createStakeTransaction(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
ffi.Pointer<ffi.Char> dst_addr,
|
||||
ffi.Pointer<ffi.Char> payment_id,
|
||||
int amount,
|
||||
int mixin_count,
|
||||
int pendingTransactionPriority,
|
||||
int subaddr_account,
|
||||
ffi.Pointer<ffi.Char> preferredInputs,
|
||||
ffi.Pointer<ffi.Char> separator,
|
||||
) {
|
||||
return _SALVIUM_Wallet_createStakeTransaction(
|
||||
wallet_ptr,
|
||||
dst_addr,
|
||||
payment_id,
|
||||
amount,
|
||||
mixin_count,
|
||||
pendingTransactionPriority,
|
||||
subaddr_account,
|
||||
preferredInputs,
|
||||
separator,
|
||||
);
|
||||
}
|
||||
|
||||
late final _SALVIUM_Wallet_createStakeTransactionPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Void> Function(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Uint64,
|
||||
ffi.Uint32,
|
||||
ffi.Int,
|
||||
ffi.Uint32,
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>)>>('SALVIUM_Wallet_createStakeTransaction');
|
||||
late final _SALVIUM_Wallet_createStakeTransaction =
|
||||
_SALVIUM_Wallet_createStakeTransactionPtr.asFunction<
|
||||
ffi.Pointer<ffi.Void> Function(
|
||||
ffi.Pointer<ffi.Void>,
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
ffi.Pointer<ffi.Void> SALVIUM_Wallet_loadUnsignedTx(
|
||||
ffi.Pointer<ffi.Void> wallet_ptr,
|
||||
ffi.Pointer<ffi.Char> unsigned_filename,
|
||||
@@ -4550,14 +4782,14 @@ class SalviumC {
|
||||
void Function(
|
||||
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.UnsignedChar>, int)>();
|
||||
|
||||
void MONERO_Wallet_setLedgerCallback(
|
||||
void SALVIUM_Wallet_setLedgerCallback(
|
||||
ffi.Pointer<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(ffi.Pointer<ffi.UnsignedChar> command,
|
||||
ffi.UnsignedInt cmd_len)>>
|
||||
sendToLedgerDevice,
|
||||
) {
|
||||
return _MONERO_Wallet_setLedgerCallback(
|
||||
return _SALVIUM_Wallet_setLedgerCallback(
|
||||
sendToLedgerDevice,
|
||||
);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,527 +0,0 @@
|
||||
// AUTO GENERATED FILE, DO NOT EDIT.
|
||||
//
|
||||
// Generated by `package:ffigen`.
|
||||
// ignore_for_file: type=lint
|
||||
import 'dart:ffi' as ffi;
|
||||
|
||||
/// monero_c bindings
|
||||
class ZanoC {
|
||||
/// Holds the symbol lookup function.
|
||||
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
||||
_lookup;
|
||||
|
||||
/// The symbols are looked up in [dynamicLibrary].
|
||||
ZanoC(ffi.DynamicLibrary dynamicLibrary) : _lookup = dynamicLibrary.lookup;
|
||||
|
||||
/// The symbols are looked up with [lookup].
|
||||
ZanoC.fromLookup(
|
||||
ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
||||
lookup)
|
||||
: _lookup = lookup;
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_init(
|
||||
ffi.Pointer<ffi.Char> address,
|
||||
ffi.Pointer<ffi.Char> working_dir,
|
||||
int log_level,
|
||||
) {
|
||||
return _ZANO_PlainWallet_init(
|
||||
address,
|
||||
working_dir,
|
||||
log_level,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_initPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>, ffi.Int)>>('ZANO_PlainWallet_init');
|
||||
late final _ZANO_PlainWallet_init = _ZANO_PlainWallet_initPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>, int)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_init2(
|
||||
ffi.Pointer<ffi.Char> ip,
|
||||
ffi.Pointer<ffi.Char> port,
|
||||
ffi.Pointer<ffi.Char> working_dir,
|
||||
int log_level,
|
||||
) {
|
||||
return _ZANO_PlainWallet_init2(
|
||||
ip,
|
||||
port,
|
||||
working_dir,
|
||||
log_level,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_init2Ptr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Int)>>('ZANO_PlainWallet_init2');
|
||||
late final _ZANO_PlainWallet_init2 = _ZANO_PlainWallet_init2Ptr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>, int)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_reset() {
|
||||
return _ZANO_PlainWallet_reset();
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_resetPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
|
||||
'ZANO_PlainWallet_reset');
|
||||
late final _ZANO_PlainWallet_reset =
|
||||
_ZANO_PlainWallet_resetPtr.asFunction<ffi.Pointer<ffi.Char> Function()>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_setLogLevel(
|
||||
int log_level,
|
||||
) {
|
||||
return _ZANO_PlainWallet_setLogLevel(
|
||||
log_level,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_setLogLevelPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Int)>>(
|
||||
'ZANO_PlainWallet_setLogLevel');
|
||||
late final _ZANO_PlainWallet_setLogLevel = _ZANO_PlainWallet_setLogLevelPtr
|
||||
.asFunction<ffi.Pointer<ffi.Char> Function(int)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_getVersion() {
|
||||
return _ZANO_PlainWallet_getVersion();
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_getVersionPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
|
||||
'ZANO_PlainWallet_getVersion');
|
||||
late final _ZANO_PlainWallet_getVersion = _ZANO_PlainWallet_getVersionPtr
|
||||
.asFunction<ffi.Pointer<ffi.Char> Function()>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_getWalletFiles() {
|
||||
return _ZANO_PlainWallet_getWalletFiles();
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_getWalletFilesPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
|
||||
'ZANO_PlainWallet_getWalletFiles');
|
||||
late final _ZANO_PlainWallet_getWalletFiles =
|
||||
_ZANO_PlainWallet_getWalletFilesPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function()>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_getExportPrivateInfo(
|
||||
ffi.Pointer<ffi.Char> target_dir,
|
||||
) {
|
||||
return _ZANO_PlainWallet_getExportPrivateInfo(
|
||||
target_dir,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_getExportPrivateInfoPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_getExportPrivateInfo');
|
||||
late final _ZANO_PlainWallet_getExportPrivateInfo =
|
||||
_ZANO_PlainWallet_getExportPrivateInfoPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_deleteWallet(
|
||||
ffi.Pointer<ffi.Char> file_name,
|
||||
) {
|
||||
return _ZANO_PlainWallet_deleteWallet(
|
||||
file_name,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_deleteWalletPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_deleteWallet');
|
||||
late final _ZANO_PlainWallet_deleteWallet = _ZANO_PlainWallet_deleteWalletPtr
|
||||
.asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_getAddressInfo(
|
||||
ffi.Pointer<ffi.Char> addr,
|
||||
) {
|
||||
return _ZANO_PlainWallet_getAddressInfo(
|
||||
addr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_getAddressInfoPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_getAddressInfo');
|
||||
late final _ZANO_PlainWallet_getAddressInfo =
|
||||
_ZANO_PlainWallet_getAddressInfoPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_getAppconfig(
|
||||
ffi.Pointer<ffi.Char> encryption_key,
|
||||
) {
|
||||
return _ZANO_PlainWallet_getAppconfig(
|
||||
encryption_key,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_getAppconfigPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_getAppconfig');
|
||||
late final _ZANO_PlainWallet_getAppconfig = _ZANO_PlainWallet_getAppconfigPtr
|
||||
.asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_setAppconfig(
|
||||
ffi.Pointer<ffi.Char> conf_str,
|
||||
ffi.Pointer<ffi.Char> encryption_key,
|
||||
) {
|
||||
return _ZANO_PlainWallet_setAppconfig(
|
||||
conf_str,
|
||||
encryption_key,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_setAppconfigPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_setAppconfig');
|
||||
late final _ZANO_PlainWallet_setAppconfig =
|
||||
_ZANO_PlainWallet_setAppconfigPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_generateRandomKey(
|
||||
int lenght,
|
||||
) {
|
||||
return _ZANO_PlainWallet_generateRandomKey(
|
||||
lenght,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_generateRandomKeyPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Uint64)>>(
|
||||
'ZANO_PlainWallet_generateRandomKey');
|
||||
late final _ZANO_PlainWallet_generateRandomKey =
|
||||
_ZANO_PlainWallet_generateRandomKeyPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(int)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_getLogsBuffer() {
|
||||
return _ZANO_PlainWallet_getLogsBuffer();
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_getLogsBufferPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
|
||||
'ZANO_PlainWallet_getLogsBuffer');
|
||||
late final _ZANO_PlainWallet_getLogsBuffer =
|
||||
_ZANO_PlainWallet_getLogsBufferPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function()>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_truncateLog() {
|
||||
return _ZANO_PlainWallet_truncateLog();
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_truncateLogPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
|
||||
'ZANO_PlainWallet_truncateLog');
|
||||
late final _ZANO_PlainWallet_truncateLog = _ZANO_PlainWallet_truncateLogPtr
|
||||
.asFunction<ffi.Pointer<ffi.Char> Function()>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_getConnectivityStatus() {
|
||||
return _ZANO_PlainWallet_getConnectivityStatus();
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_getConnectivityStatusPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
|
||||
'ZANO_PlainWallet_getConnectivityStatus');
|
||||
late final _ZANO_PlainWallet_getConnectivityStatus =
|
||||
_ZANO_PlainWallet_getConnectivityStatusPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function()>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_open(
|
||||
ffi.Pointer<ffi.Char> path,
|
||||
ffi.Pointer<ffi.Char> password,
|
||||
) {
|
||||
return _ZANO_PlainWallet_open(
|
||||
path,
|
||||
password,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_openPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_open');
|
||||
late final _ZANO_PlainWallet_open = _ZANO_PlainWallet_openPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_restore(
|
||||
ffi.Pointer<ffi.Char> seed,
|
||||
ffi.Pointer<ffi.Char> path,
|
||||
ffi.Pointer<ffi.Char> password,
|
||||
ffi.Pointer<ffi.Char> seed_password,
|
||||
) {
|
||||
return _ZANO_PlainWallet_restore(
|
||||
seed,
|
||||
path,
|
||||
password,
|
||||
seed_password,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_restorePtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_restore');
|
||||
late final _ZANO_PlainWallet_restore =
|
||||
_ZANO_PlainWallet_restorePtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_generate(
|
||||
ffi.Pointer<ffi.Char> path,
|
||||
ffi.Pointer<ffi.Char> password,
|
||||
) {
|
||||
return _ZANO_PlainWallet_generate(
|
||||
path,
|
||||
password,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_generatePtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_generate');
|
||||
late final _ZANO_PlainWallet_generate =
|
||||
_ZANO_PlainWallet_generatePtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_getOpenWallets() {
|
||||
return _ZANO_PlainWallet_getOpenWallets();
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_getOpenWalletsPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
|
||||
'ZANO_PlainWallet_getOpenWallets');
|
||||
late final _ZANO_PlainWallet_getOpenWallets =
|
||||
_ZANO_PlainWallet_getOpenWalletsPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function()>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_getWalletStatus(
|
||||
int h,
|
||||
) {
|
||||
return _ZANO_PlainWallet_getWalletStatus(
|
||||
h,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_getWalletStatusPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Int64)>>(
|
||||
'ZANO_PlainWallet_getWalletStatus');
|
||||
late final _ZANO_PlainWallet_getWalletStatus =
|
||||
_ZANO_PlainWallet_getWalletStatusPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(int)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_closeWallet(
|
||||
int h,
|
||||
) {
|
||||
return _ZANO_PlainWallet_closeWallet(
|
||||
h,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_closeWalletPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Int64)>>(
|
||||
'ZANO_PlainWallet_closeWallet');
|
||||
late final _ZANO_PlainWallet_closeWallet = _ZANO_PlainWallet_closeWalletPtr
|
||||
.asFunction<ffi.Pointer<ffi.Char> Function(int)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_invoke(
|
||||
int h,
|
||||
ffi.Pointer<ffi.Char> params,
|
||||
) {
|
||||
return _ZANO_PlainWallet_invoke(
|
||||
h,
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_invokePtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Int64, ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_invoke');
|
||||
late final _ZANO_PlainWallet_invoke = _ZANO_PlainWallet_invokePtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(int, ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_asyncCall(
|
||||
ffi.Pointer<ffi.Char> method_name,
|
||||
int instance_id,
|
||||
ffi.Pointer<ffi.Char> params,
|
||||
) {
|
||||
return _ZANO_PlainWallet_asyncCall(
|
||||
method_name,
|
||||
instance_id,
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_asyncCallPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>, ffi.Uint64,
|
||||
ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_asyncCall');
|
||||
late final _ZANO_PlainWallet_asyncCall =
|
||||
_ZANO_PlainWallet_asyncCallPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Char>, int, ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_tryPullResult(
|
||||
int instance_id,
|
||||
) {
|
||||
return _ZANO_PlainWallet_tryPullResult(
|
||||
instance_id,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_tryPullResultPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Uint64)>>(
|
||||
'ZANO_PlainWallet_tryPullResult');
|
||||
late final _ZANO_PlainWallet_tryPullResult =
|
||||
_ZANO_PlainWallet_tryPullResultPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(int)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_syncCall(
|
||||
ffi.Pointer<ffi.Char> method_name,
|
||||
int instance_id,
|
||||
ffi.Pointer<ffi.Char> params,
|
||||
) {
|
||||
return _ZANO_PlainWallet_syncCall(
|
||||
method_name,
|
||||
instance_id,
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_syncCallPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>, ffi.Uint64,
|
||||
ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_syncCall');
|
||||
late final _ZANO_PlainWallet_syncCall =
|
||||
_ZANO_PlainWallet_syncCallPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(
|
||||
ffi.Pointer<ffi.Char>, int, ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
bool ZANO_PlainWallet_isWalletExist(
|
||||
ffi.Pointer<ffi.Char> path,
|
||||
) {
|
||||
return _ZANO_PlainWallet_isWalletExist(
|
||||
path,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_isWalletExistPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Bool Function(ffi.Pointer<ffi.Char>)>>(
|
||||
'ZANO_PlainWallet_isWalletExist');
|
||||
late final _ZANO_PlainWallet_isWalletExist =
|
||||
_ZANO_PlainWallet_isWalletExistPtr.asFunction<
|
||||
bool Function(ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_getWalletInfo(
|
||||
int h,
|
||||
) {
|
||||
return _ZANO_PlainWallet_getWalletInfo(
|
||||
h,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_getWalletInfoPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Int64)>>(
|
||||
'ZANO_PlainWallet_getWalletInfo');
|
||||
late final _ZANO_PlainWallet_getWalletInfo =
|
||||
_ZANO_PlainWallet_getWalletInfoPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(int)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_PlainWallet_resetWalletPassword(
|
||||
int h,
|
||||
ffi.Pointer<ffi.Char> password,
|
||||
) {
|
||||
return _ZANO_PlainWallet_resetWalletPassword(
|
||||
h,
|
||||
password,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_resetWalletPasswordPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Pointer<ffi.Char> Function(ffi.Int64,
|
||||
ffi.Pointer<ffi.Char>)>>('ZANO_PlainWallet_resetWalletPassword');
|
||||
late final _ZANO_PlainWallet_resetWalletPassword =
|
||||
_ZANO_PlainWallet_resetWalletPasswordPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function(int, ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
int ZANO_PlainWallet_getCurrentTxFee(
|
||||
int priority,
|
||||
) {
|
||||
return _ZANO_PlainWallet_getCurrentTxFee(
|
||||
priority,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_PlainWallet_getCurrentTxFeePtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Uint64 Function(ffi.Uint64)>>(
|
||||
'ZANO_PlainWallet_getCurrentTxFee');
|
||||
late final _ZANO_PlainWallet_getCurrentTxFee =
|
||||
_ZANO_PlainWallet_getCurrentTxFeePtr.asFunction<int Function(int)>();
|
||||
|
||||
void ZANO_free(
|
||||
ffi.Pointer<ffi.Void> ptr,
|
||||
) {
|
||||
return _ZANO_free(
|
||||
ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _ZANO_freePtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
|
||||
'ZANO_free');
|
||||
late final _ZANO_free =
|
||||
_ZANO_freePtr.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_checksum_wallet2_api_c_h() {
|
||||
return _ZANO_checksum_wallet2_api_c_h();
|
||||
}
|
||||
|
||||
late final _ZANO_checksum_wallet2_api_c_hPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
|
||||
'ZANO_checksum_wallet2_api_c_h');
|
||||
late final _ZANO_checksum_wallet2_api_c_h = _ZANO_checksum_wallet2_api_c_hPtr
|
||||
.asFunction<ffi.Pointer<ffi.Char> Function()>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_checksum_wallet2_api_c_cpp() {
|
||||
return _ZANO_checksum_wallet2_api_c_cpp();
|
||||
}
|
||||
|
||||
late final _ZANO_checksum_wallet2_api_c_cppPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
|
||||
'ZANO_checksum_wallet2_api_c_cpp');
|
||||
late final _ZANO_checksum_wallet2_api_c_cpp =
|
||||
_ZANO_checksum_wallet2_api_c_cppPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function()>();
|
||||
|
||||
ffi.Pointer<ffi.Char> ZANO_checksum_wallet2_api_c_exp() {
|
||||
return _ZANO_checksum_wallet2_api_c_exp();
|
||||
}
|
||||
|
||||
late final _ZANO_checksum_wallet2_api_c_expPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>(
|
||||
'ZANO_checksum_wallet2_api_c_exp');
|
||||
late final _ZANO_checksum_wallet2_api_c_exp =
|
||||
_ZANO_checksum_wallet2_api_c_expPtr.asFunction<
|
||||
ffi.Pointer<ffi.Char> Function()>();
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,688 +0,0 @@
|
||||
|
||||
// ignore_for_file: non_constant_identifier_names, camel_case_types
|
||||
|
||||
import 'dart:ffi';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:ffi/ffi.dart';
|
||||
import 'package:monero/src/generated_bindings_zano.g.dart';
|
||||
|
||||
export 'src/checksum_monero.dart';
|
||||
|
||||
typedef PendingTransaction = Pointer<Void>;
|
||||
|
||||
ZanoC? lib;
|
||||
String libPath = (() {
|
||||
if (Platform.isWindows) return 'zano_libwallet2_api_c.dll';
|
||||
if (Platform.isMacOS) return 'zano_libwallet2_api_c.dylib';
|
||||
if (Platform.isIOS) return 'ZanoWallet.framework/ZanoWallet';
|
||||
if (Platform.isAndroid) return 'libzano_libwallet2_api_c.so';
|
||||
return 'zano_libwallet2_api_c.so';
|
||||
})();
|
||||
|
||||
Map<String, List<int>> debugCallLength = {};
|
||||
|
||||
final defaultSeparatorStr = ";";
|
||||
final defaultSeparator = defaultSeparatorStr.toNativeUtf8().cast<Char>();
|
||||
/* we don't call .free here, this comment serves one purpose - so the numbers match :) */
|
||||
|
||||
final Stopwatch sw = Stopwatch()..start();
|
||||
|
||||
bool printStarts = false;
|
||||
|
||||
void Function(String call)? debugStart = (call) {
|
||||
try {
|
||||
if (printStarts) print("MONERO: $call");
|
||||
debugCallLength[call] ??= <int>[];
|
||||
debugCallLength[call]!.add(sw.elapsedMicroseconds);
|
||||
} catch (e) {}
|
||||
};
|
||||
void debugChores() {
|
||||
for (var key in debugCallLength.keys) {
|
||||
if (debugCallLength[key]!.length > 1000000) {
|
||||
final elm =
|
||||
debugCallLength[key]!.reduce((value, element) => value + element);
|
||||
debugCallLength[key]!.clear();
|
||||
debugCallLength["${key}_1M"] ??= <int>[];
|
||||
debugCallLength["${key}_1M"]!.add(elm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int debugCount = 0;
|
||||
|
||||
void Function(String call)? debugEnd = (call) {
|
||||
try {
|
||||
final id = debugCallLength[call]!.length - 1;
|
||||
if (++debugCount > 1000000) {
|
||||
debugCount = 0;
|
||||
debugChores();
|
||||
}
|
||||
debugCallLength[call]![id] =
|
||||
sw.elapsedMicroseconds - debugCallLength[call]![id];
|
||||
} catch (e) {}
|
||||
};
|
||||
void Function(String call, dynamic error)? errorHandler = (call, error) {
|
||||
print("$call: $error");
|
||||
};
|
||||
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_init(const char* address, const char* working_dir, int log_level);
|
||||
String PlainWallet_init(String address, String working_dir, int log_level) {
|
||||
debugStart?.call('ZANO_PlainWallet_init');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final address_ = address.toNativeUtf8();
|
||||
final working_dir_ = working_dir.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_init(address_.cast(), working_dir_.cast(), log_level);
|
||||
calloc.free(address_);
|
||||
calloc.free(working_dir_);
|
||||
debugEnd?.call('ZANO_PlainWallet_init');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_init');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_init', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_init');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_init2(const char* ip, const char* port, const char* working_dir, int log_level);
|
||||
String PlainWallet_init2(String ip, String port, String working_dir, int log_level) {
|
||||
debugStart?.call('ZANO_PlainWallet_init2');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final ip_ = ip.toNativeUtf8();
|
||||
final port_ = port.toNativeUtf8();
|
||||
final working_dir_ = working_dir.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_init2(ip_.cast(), port_.cast(), working_dir_.cast(), log_level);
|
||||
calloc.free(ip_);
|
||||
calloc.free(port_);
|
||||
calloc.free(working_dir_);
|
||||
debugEnd?.call('ZANO_PlainWallet_init2');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_init2');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_init2', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_init2');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_reset();
|
||||
String PlainWallet_reset() {
|
||||
debugStart?.call('ZANO_PlainWallet_reset');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_PlainWallet_reset();
|
||||
debugEnd?.call('ZANO_PlainWallet_reset');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_reset');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_reset', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_reset');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_setLogLevel(int log_level);
|
||||
String PlainWallet_setLogLevel(int log_level) {
|
||||
debugStart?.call('ZANO_PlainWallet_setLogLevel');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_PlainWallet_setLogLevel(log_level);
|
||||
debugEnd?.call('ZANO_PlainWallet_setLogLevel');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_setLogLevel');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_setLogLevel', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_setLogLevel');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_getVersion();
|
||||
String PlainWallet_getVersion() {
|
||||
debugStart?.call('ZANO_PlainWallet_getVersion');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_PlainWallet_getVersion();
|
||||
debugEnd?.call('ZANO_PlainWallet_getVersion');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_getVersion');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_getVersion', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_getVersion');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_getWalletFiles();
|
||||
String PlainWallet_getWalletFiles() {
|
||||
debugStart?.call('ZANO_PlainWallet_getWalletFiles');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_PlainWallet_getWalletFiles();
|
||||
debugEnd?.call('ZANO_PlainWallet_getWalletFiles');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_getWalletFiles');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_getWalletFiles', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_getWalletFiles');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_getExportPrivateInfo(const char* target_dir);
|
||||
String PlainWallet_getExportPrivateInfo(String target_dir) {
|
||||
debugStart?.call('ZANO_PlainWallet_getExportPrivateInfo');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final target_dir_ = target_dir.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_getExportPrivateInfo(target_dir_.cast());
|
||||
calloc.free(target_dir_);
|
||||
debugEnd?.call('ZANO_PlainWallet_getExportPrivateInfo');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_getExportPrivateInfo');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_getExportPrivateInfo', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_getExportPrivateInfo');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_deleteWallet(const char* file_name);
|
||||
String PlainWallet_deleteWallet(String file_name) {
|
||||
debugStart?.call('ZANO_PlainWallet_deleteWallet');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final file_name_ = file_name.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_deleteWallet(file_name_.cast());
|
||||
calloc.free(file_name_);
|
||||
debugEnd?.call('ZANO_PlainWallet_deleteWallet');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_deleteWallet');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_deleteWallet', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_deleteWallet');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_getAddressInfo(const char* addr);
|
||||
String PlainWallet_getAddressInfo(String addr) {
|
||||
debugStart?.call('ZANO_PlainWallet_getAddressInfo');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final addr_ = addr.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_getAddressInfo(addr_.cast());
|
||||
calloc.free(addr_);
|
||||
debugEnd?.call('ZANO_PlainWallet_getAddressInfo');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_getAddressInfo');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_getAddressInfo', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_getAddressInfo');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_getAppconfig(const char* encryption_key);
|
||||
String PlainWallet_getAppconfig(String encryption_key) {
|
||||
debugStart?.call('ZANO_PlainWallet_getAppconfig');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final encryption_key_ = encryption_key.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_getAppconfig(encryption_key_.cast());
|
||||
calloc.free(encryption_key_);
|
||||
debugEnd?.call('ZANO_PlainWallet_getAppconfig');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_getAppconfig');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_getAppconfig', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_getAppconfig');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_setAppconfig(const char* conf_str, const char* encryption_key);
|
||||
String PlainWallet_setAppconfig(String conf_str, String encryption_key) {
|
||||
debugStart?.call('ZANO_PlainWallet_setAppconfig');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final conf_str_ = conf_str.toNativeUtf8();
|
||||
final encryption_key_ = encryption_key.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_setAppconfig(conf_str_.cast(), encryption_key_.cast());
|
||||
calloc.free(conf_str_);
|
||||
calloc.free(encryption_key_);
|
||||
debugEnd?.call('ZANO_PlainWallet_setAppconfig');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_setAppconfig');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_setAppconfig', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_setAppconfig');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_generateRandomKey(uint64_t lenght);
|
||||
String PlainWallet_generateRandomKey(int length) {
|
||||
debugStart?.call('ZANO_PlainWallet_generateRandomKey');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_PlainWallet_generateRandomKey(length);
|
||||
debugEnd?.call('ZANO_PlainWallet_generateRandomKey');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_generateRandomKey');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_generateRandomKey', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_generateRandomKey');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_getLogsBuffer();
|
||||
String PlainWallet_getLogsBuffer() {
|
||||
debugStart?.call('ZANO_PlainWallet_getLogsBuffer');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_PlainWallet_getLogsBuffer();
|
||||
debugEnd?.call('ZANO_PlainWallet_getLogsBuffer');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_getLogsBuffer');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_getLogsBuffer', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_getLogsBuffer');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_truncateLog();
|
||||
String PlainWallet_truncateLog() {
|
||||
debugStart?.call('ZANO_PlainWallet_truncateLog');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_PlainWallet_truncateLog();
|
||||
debugEnd?.call('ZANO_PlainWallet_truncateLog');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_truncateLog');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_truncateLog', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_truncateLog');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_getConnectivityStatus();
|
||||
String PlainWallet_getConnectivityStatus() {
|
||||
debugStart?.call('ZANO_PlainWallet_getConnectivityStatus');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_PlainWallet_getConnectivityStatus();
|
||||
debugEnd?.call('ZANO_PlainWallet_getConnectivityStatus');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_getConnectivityStatus');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_getConnectivityStatus', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_getConnectivityStatus');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_open(const char* path, const char* password);
|
||||
String PlainWallet_open(String path, String password) {
|
||||
debugStart?.call('ZANO_PlainWallet_open');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final path_ = path.toNativeUtf8();
|
||||
final password_ = password.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_open(path_.cast(), password_.cast());
|
||||
calloc.free(path_);
|
||||
calloc.free(password_);
|
||||
debugEnd?.call('ZANO_PlainWallet_open');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_open');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_open', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_open');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_restore(const char* seed, const char* path, const char* password, const char* seed_password);
|
||||
String PlainWallet_restore(String seed, String path, String password, String seed_password) {
|
||||
debugStart?.call('ZANO_PlainWallet_restore');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final seed_ = seed.toNativeUtf8();
|
||||
final path_ = path.toNativeUtf8();
|
||||
final password_ = password.toNativeUtf8();
|
||||
final seed_password_ = seed_password.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_restore(seed_.cast(), path_.cast(), password_.cast(), seed_password_.cast());
|
||||
calloc.free(seed_);
|
||||
calloc.free(path_);
|
||||
calloc.free(password_);
|
||||
calloc.free(seed_password_);
|
||||
debugEnd?.call('ZANO_PlainWallet_restore');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_restore');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_restore', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_restore');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_generate(const char* path, const char* password);
|
||||
String PlainWallet_generate(String path, String password) {
|
||||
debugStart?.call('ZANO_PlainWallet_generate');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final path_ = path.toNativeUtf8();
|
||||
final password_ = password.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_generate(path_.cast(), password_.cast());
|
||||
calloc.free(path_);
|
||||
calloc.free(password_);
|
||||
debugEnd?.call('ZANO_PlainWallet_generate');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_generate');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_generate', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_generate');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_getOpenWallets();
|
||||
String PlainWallet_getOpenWallets() {
|
||||
debugStart?.call('ZANO_PlainWallet_getOpenWallets');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_PlainWallet_getOpenWallets();
|
||||
debugEnd?.call('ZANO_PlainWallet_getOpenWallets');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_getOpenWallets');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_getOpenWallets', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_getOpenWallets');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_getWalletStatus(int64_t h);
|
||||
String PlainWallet_getWalletStatus(int h) {
|
||||
debugStart?.call('ZANO_PlainWallet_getWalletStatus');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_PlainWallet_getWalletStatus(h);
|
||||
debugEnd?.call('ZANO_PlainWallet_getWalletStatus');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_getWalletStatus');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_getWalletStatus', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_getWalletStatus');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_closeWallet(int64_t h);
|
||||
String PlainWallet_closeWallet(int h) {
|
||||
debugStart?.call('ZANO_PlainWallet_closeWallet');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_PlainWallet_closeWallet(h);
|
||||
debugEnd?.call('ZANO_PlainWallet_closeWallet');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_closeWallet');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_closeWallet', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_closeWallet');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_invoke(int64_t h, const char* params);
|
||||
String PlainWallet_invoke(int h, String params) {
|
||||
debugStart?.call('ZANO_PlainWallet_invoke');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final params_ = params.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_invoke(h, params_.cast());
|
||||
calloc.free(params_);
|
||||
debugEnd?.call('ZANO_PlainWallet_invoke');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_invoke');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_invoke', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_invoke');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_asyncCall(const char* method_name, uint64_t instance_id, const char* params);
|
||||
String PlainWallet_asyncCall(String method_name, int h, String params) {
|
||||
debugStart?.call('ZANO_PlainWallet_asyncCall');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final params_ = params.toNativeUtf8();
|
||||
final method_name_ = method_name.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_asyncCall(method_name_.cast(), h, params_.cast());
|
||||
calloc.free(params_);
|
||||
calloc.free(method_name_);
|
||||
debugEnd?.call('ZANO_PlainWallet_asyncCall');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_asyncCall');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_asyncCall', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_asyncCall');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_tryPullResult(uint64_t instance_id);
|
||||
String PlainWallet_tryPullResult(int instance_id) {
|
||||
debugStart?.call('ZANO_PlainWallet_tryPullResult');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_PlainWallet_tryPullResult(instance_id);
|
||||
debugEnd?.call('ZANO_PlainWallet_tryPullResult');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_tryPullResult');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_tryPullResult', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_tryPullResult');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_syncCall(const char* method_name, uint64_t instance_id, const char* params);
|
||||
String PlainWallet_syncCall(String method_name, int instance_id, String params) {
|
||||
debugStart?.call('ZANO_PlainWallet_syncCall');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final method_name_ = method_name.toNativeUtf8();
|
||||
final params_ = params.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_syncCall(method_name_.cast(), instance_id, params_.cast());
|
||||
calloc.free(method_name_);
|
||||
calloc.free(params_);
|
||||
debugEnd?.call('ZANO_PlainWallet_syncCall');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_syncCall');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_syncCall', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_syncCall');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI bool ZANO_PlainWallet_isWalletExist(const char* path);
|
||||
bool PlainWallet_isWalletExist(String path) {
|
||||
debugStart?.call('ZANO_PlainWallet_isWalletExist');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final path_ = path.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_isWalletExist(path_.cast());
|
||||
calloc.free(path_);
|
||||
debugEnd?.call('ZANO_PlainWallet_isWalletExist');
|
||||
return txid;
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_getWalletInfo(int64_t h);
|
||||
String PlainWallet_getWalletInfo(int h) {
|
||||
debugStart?.call('ZANO_PlainWallet_getWalletInfo');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_PlainWallet_getWalletInfo(h);
|
||||
debugEnd?.call('ZANO_PlainWallet_getWalletInfo');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_getWalletInfo');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_getWalletInfo', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_getWalletInfo');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_PlainWallet_resetWalletPassword(int64_t h, const char* password);
|
||||
String PlainWallet_resetWalletPassword(int h, String password) {
|
||||
debugStart?.call('ZANO_PlainWallet_resetWalletPassword');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final password_ = password.toNativeUtf8();
|
||||
final txid = lib!.ZANO_PlainWallet_resetWalletPassword(h, password_.cast());
|
||||
calloc.free(password_);
|
||||
debugEnd?.call('ZANO_PlainWallet_resetWalletPassword');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_PlainWallet_resetWalletPassword');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_PlainWallet_resetWalletPassword', e);
|
||||
debugEnd?.call('ZANO_PlainWallet_resetWalletPassword');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI uint64_t ZANO_PlainWallet_getCurrentTxFee(uint64_t priority);
|
||||
int PlainWallet_getCurrentTxFee(int priority) {
|
||||
debugStart?.call('ZANO_PlainWallet_getCurrentTxFee');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_PlainWallet_getCurrentTxFee(priority);
|
||||
debugEnd?.call('ZANO_PlainWallet_getCurrentTxFee');
|
||||
return txid;
|
||||
}
|
||||
|
||||
void ZANO_free(Pointer<Void> wlptr) {
|
||||
debugStart?.call('ZANO_free');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
|
||||
final s = lib!.ZANO_free(wlptr);
|
||||
debugEnd?.call('ZANO_free');
|
||||
return s;
|
||||
}
|
||||
|
||||
// extern ADDAPI const char* ZANO_checksum_wallet2_api_c_h();
|
||||
String checksum_wallet2_api_c_h() {
|
||||
debugStart?.call('ZANO_checksum_wallet2_api_c_h');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_checksum_wallet2_api_c_h();
|
||||
debugEnd?.call('ZANO_checksum_wallet2_api_c_h');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_checksum_wallet2_api_c_h');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_checksum_wallet2_api_c_h', e);
|
||||
debugEnd?.call('ZANO_checksum_wallet2_api_c_h');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_checksum_wallet2_api_c_cpp();
|
||||
String checksum_wallet2_api_c_cpp() {
|
||||
debugStart?.call('ZANO_checksum_wallet2_api_c_cpp');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_checksum_wallet2_api_c_cpp();
|
||||
debugEnd?.call('ZANO_checksum_wallet2_api_c_cpp');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_checksum_wallet2_api_c_cpp');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_checksum_wallet2_api_c_cpp', e);
|
||||
debugEnd?.call('ZANO_checksum_wallet2_api_c_cpp');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
// extern ADDAPI const char* ZANO_checksum_wallet2_api_c_exp();
|
||||
String checksum_wallet2_api_c_exp() {
|
||||
debugStart?.call('ZANO_checksum_wallet2_api_c_exp');
|
||||
lib ??= ZanoC(DynamicLibrary.open(libPath));
|
||||
final txid = lib!.ZANO_checksum_wallet2_api_c_exp();
|
||||
debugEnd?.call('ZANO_checksum_wallet2_api_c_exp');
|
||||
try {
|
||||
final strPtr = txid.cast<Utf8>();
|
||||
final str = strPtr.toDartString();
|
||||
ZANO_free(strPtr.cast());
|
||||
debugEnd?.call('ZANO_checksum_wallet2_api_c_exp');
|
||||
return str;
|
||||
} catch (e) {
|
||||
errorHandler?.call('ZANO_checksum_wallet2_api_c_exp', e);
|
||||
debugEnd?.call('ZANO_checksum_wallet2_api_c_exp');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ set -e
|
||||
|
||||
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
|
||||
dart run ffigen --config ffigen_peya.yaml
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const moneroChecksum = {
|
||||
wallet2_api_c_h_sha256: "3515e4c9e537ca3efa664f0b364a3aeb106ff64337f542a262ce104c00b31235",
|
||||
wallet2_api_c_cpp_sha256: "ca44a8d4a201ba6dc0a25c857e95d07bc8d514039b38cd5b3826100e8943cbcc-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe",
|
||||
wallet2_api_c_exp_sha256: "0561e14606106e6b0ec49fb2aefe743ff500f7c3de07557f7041e06aef9509ce",
|
||||
wallet2_api_c_h_sha256: "91218f60e937753a606b1db899ee2ed66a1b02144eb2d79b950ce59804397f84",
|
||||
wallet2_api_c_cpp_sha256: "282128494f3419c128dff7ed67daadd9c2ad0600d10557e829df03d9bc1ad891-9d2f5b392bc46d56449be92295071fbc2cb3d230",
|
||||
wallet2_api_c_exp_sha256: "d0f95f1f3bc49f1f59fe4eb0b61826128d7d3bb75405d5a01a252d02db03097d",
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export const peyaChecksum = {
|
||||
wallet2_api_c_h_sha256: "abfc67892fa12c69b7871ed5db0de819b7d6f1a270b2d9f3b0340d95e43bf8a7",
|
||||
wallet2_api_c_cpp_sha256: "5aeae36dc0d58a38d1ac61fc027c3c3f10f4331284f27833fdd3146e12d010b5-cf5969b5dd96d78d5bcc8a2fe97c9e6522c781a5",
|
||||
wallet2_api_c_exp_sha256: "31b4f92a01ff4812c46e5978c0195f725fe93c87bcd8036391a12fe9d5774621",
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
export const salviumChecksum = {
|
||||
wallet2_api_c_h_sha256: "93ad4f6247f0b89c17218766c960e956047b0e8032c3db2b791842d576279330",
|
||||
wallet2_api_c_cpp_sha256: "2d52bbe50a6db8c1bd68ce4be288c28319f35f48c6d093a3d67d888c8e4b3230-45404ecc719b916c217938f9e82ad352a4068d12",
|
||||
wallet2_api_c_exp_sha256: "f7ab584f1271f4d533980f403597a1d9e50bced85c233ca2b17c77f4a94ed3bc",
|
||||
wallet2_api_c_h_sha256: "e058d5ca0dc56bc7c40b55f6428a86bd14dd5b4308c03854ef6a1099aa09d107",
|
||||
wallet2_api_c_cpp_sha256: "c40f623ef0801ceccba760d49176d84122c683e4f832e304372b9c931a02ed25-42ec3826a079af4411ed2632b9e469d428e884ae",
|
||||
wallet2_api_c_exp_sha256: "8743a9af4dd98eb5288829226d8815b8f91ad1bd48db10488e65f4b1983549d8",
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
export const wowneroChecksum = {
|
||||
wallet2_api_c_h_sha256: "f99009d1ca1d1c783cc9aa0fb63f680d48753b88124fb5de2079c57b7e34c827",
|
||||
wallet2_api_c_cpp_sha256: "70b39a0bef660cb9ba0397117eb1590e18461ace89ab18141690658a2a537d5d-3e302be710f4e6b4f58642989c8e47711362fa56",
|
||||
wallet2_api_c_exp_sha256: "5f53ea8bbe66a5e5aa6cbc4ca00695900e08589cfd32062e88965a24252d05ba",
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
export const zanoChecksum = {
|
||||
wallet2_api_c_h_sha256: "8acaa95513b85a984c08e05cc3f2ac7530bb8f32946eeeb45357bd846aef33dd",
|
||||
wallet2_api_c_cpp_sha256: "4efacd3812d53dd268b6869cc0a9560e7320574d96e09136cf067f796edfeba6-fbeb658ae04bed149c0f52af5e8f1e815249f4d4",
|
||||
wallet2_api_c_exp_sha256: "66f3ff655bbfd11ad28c318ab707090b5a93276f436b06f7b1c0f329dba3c9c2",
|
||||
}
|
||||
@@ -1,8 +1,17 @@
|
||||
import { type MoneroSymbols, moneroSymbols, type SymbolName, type WowneroSymbols, wowneroSymbols } from "./symbols.ts";
|
||||
import {
|
||||
type MoneroSymbols,
|
||||
moneroSymbols,
|
||||
type PeyaSymbols,
|
||||
peyaSymbols,
|
||||
type SalviumSymbols,
|
||||
salviumSymbols,
|
||||
type SymbolName,
|
||||
} from "./symbols.ts";
|
||||
|
||||
export type MoneroDylib = Deno.DynamicLibrary<MoneroSymbols>;
|
||||
export type WowneroDylib = Deno.DynamicLibrary<WowneroSymbols>;
|
||||
export type Dylib = MoneroDylib | WowneroDylib;
|
||||
export type SalviumDylib = Deno.DynamicLibrary<SalviumSymbols>;
|
||||
export type PeyaDylib = Deno.DynamicLibrary<PeyaSymbols>;
|
||||
export type Dylib = MoneroDylib | SalviumDylib | PeyaDylib;
|
||||
|
||||
export let dylib: Dylib;
|
||||
|
||||
@@ -40,8 +49,8 @@ export function loadMoneroDylib(newDylib?: MoneroDylib) {
|
||||
dylib = Deno.dlopen(libPath, moneroSymbols);
|
||||
}
|
||||
|
||||
export function loadWowneroDylib(newDylib?: WowneroDylib) {
|
||||
dylibPrefix = "WOWNERO";
|
||||
export function loadSalviumDylib(newDylib?: SalviumDylib) {
|
||||
dylibPrefix = "SALVIUM";
|
||||
|
||||
if (newDylib) {
|
||||
dylib = newDylib;
|
||||
@@ -51,18 +60,45 @@ export function loadWowneroDylib(newDylib?: WowneroDylib) {
|
||||
let libPath: string;
|
||||
switch (Deno.build.os) {
|
||||
case "darwin":
|
||||
libPath = "./lib/wownero_libwallet2_api_c.dylib";
|
||||
libPath = "./lib/salvium_libwallet2_api_c.dylib";
|
||||
break;
|
||||
case "android":
|
||||
libPath = "./lib/libwownero_libwallet2_api_c.so";
|
||||
libPath = "./lib/libsalvium_libwallet2_api_c.so";
|
||||
break;
|
||||
case "windows":
|
||||
libPath = "./lib/wownero_libwallet2_api_c.dll";
|
||||
libPath = "./lib/salvium_libwallet2_api_c.dll";
|
||||
break;
|
||||
default:
|
||||
libPath = "./lib/wownero_libwallet2_api_c.so";
|
||||
libPath = "./lib/salvium_libwallet2_api_c.so";
|
||||
break;
|
||||
}
|
||||
|
||||
dylib = Deno.dlopen(libPath, wowneroSymbols);
|
||||
dylib = Deno.dlopen(libPath, salviumSymbols);
|
||||
}
|
||||
|
||||
export function loadPeyaDylib(newDylib?: PeyaDylib) {
|
||||
dylibPrefix = "PEYA";
|
||||
|
||||
if (newDylib) {
|
||||
dylib = newDylib;
|
||||
return;
|
||||
}
|
||||
|
||||
let libPath: string;
|
||||
switch (Deno.build.os) {
|
||||
case "darwin":
|
||||
libPath = "./lib/peya_libwallet2_api_c.dylib";
|
||||
break;
|
||||
case "android":
|
||||
libPath = "./lib/libpeya_libwallet2_api_c.so";
|
||||
break;
|
||||
case "windows":
|
||||
libPath = "./lib/peya_libwallet2_api_c.dll";
|
||||
break;
|
||||
default:
|
||||
libPath = "./lib/peya_libwallet2_api_c.so";
|
||||
break;
|
||||
}
|
||||
|
||||
dylib = Deno.dlopen(libPath, peyaSymbols);
|
||||
}
|
||||
|
||||
@@ -2434,11 +2434,16 @@ export const moneroSymbols = {
|
||||
|
||||
export type MoneroSymbols = typeof moneroSymbols;
|
||||
|
||||
type ReplaceMonero<T extends string> = T extends `MONERO${infer Y}` ? `WOWNERO${Y}` : never;
|
||||
export type WowneroSymbols = { [Key in keyof MoneroSymbols as ReplaceMonero<Key>]: MoneroSymbols[Key] };
|
||||
type ReplacePrefix<T extends string, Prefix extends string> = T extends `MONERO${infer Y}` ? `${Prefix}${Y}` : never;
|
||||
export type SalviumSymbols = { [Key in keyof MoneroSymbols as ReplacePrefix<Key, "SALVIUM">]: MoneroSymbols[Key] };
|
||||
export type PeyaSymbols = { [Key in keyof MoneroSymbols as ReplacePrefix<Key, "PEYA">]: MoneroSymbols[Key] };
|
||||
|
||||
export type SymbolName = keyof MoneroSymbols extends `MONERO_${infer SymbolName}` ? SymbolName : never;
|
||||
|
||||
export const wowneroSymbols = Object.fromEntries(
|
||||
Object.entries(moneroSymbols).map(([key, value]) => [key.replace("MONERO", "WOWNERO"), value]),
|
||||
) as WowneroSymbols;
|
||||
export const salviumSymbols = Object.fromEntries(
|
||||
Object.entries(moneroSymbols).map(([key, value]) => [key.replace("MONERO", "SALVIUM"), value]),
|
||||
) as SalviumSymbols;
|
||||
|
||||
export const peyaSymbols = Object.fromEntries(
|
||||
Object.entries(moneroSymbols).map(([key, value]) => [key.replace("MONERO", "PEYA"), value]),
|
||||
) as PeyaSymbols;
|
||||
|
||||
+1
-1
Submodule monero updated: 0232839913...9d2f5b392b
@@ -99,30 +99,16 @@ endif()
|
||||
if (${MONERO_FLAVOR} STREQUAL "monero")
|
||||
target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_MONERO)
|
||||
set(BCUR_ENABLED bc-ur)
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "wownero")
|
||||
target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_WOWNERO)
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "zano")
|
||||
target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_ZANO)
|
||||
endif()
|
||||
|
||||
if(NOT ${HOST_ABI} STREQUAL "x86_64-apple-darwin11" AND NOT ${HOST_ABI} STREQUAL "aarch64-apple-darwin11" AND NOT ${HOST_ABI} STREQUAL "aarch64-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "x86_64-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "host-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "aarch64-host-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "host-apple-ios" AND NOT ${HOST_ABI} STREQUAL "aarch64-apple-ios" AND NOT ${HOST_ABI} STREQUAL "aarch64-apple-iossimulator" AND NOT ${HOST_ABI} STREQUAL "x86_64-apple-iossimulator")
|
||||
set_target_properties(wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,--exclude-libs,ALL")
|
||||
endif()
|
||||
|
||||
if (${MONERO_FLAVOR} STREQUAL "zano")
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/build/${HOST_ABI}/zano_build/contrib/zlib
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectory("${CMAKE_SOURCE_DIR}/../${MONERO_FLAVOR}" ${CMAKE_BINARY_DIR}/${MONERO_FLAVOR}_build EXCLUDE_FROM_ALL)
|
||||
if(${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin11" OR ${HOST_ABI} STREQUAL "x86_64-apple-darwin" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin" OR ${HOST_ABI} STREQUAL "host-apple-darwin" OR ${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR ${HOST_ABI} STREQUAL "aarch64-host-apple-darwin" OR ${HOST_ABI} STREQUAL "host-apple-ios" OR ${HOST_ABI} STREQUAL "aarch64-apple-ios" OR ${HOST_ABI} STREQUAL "aarch64-apple-iossimulator" OR ${HOST_ABI} STREQUAL "x86_64-apple-iossimulator")
|
||||
if (${MONERO_FLAVOR} STREQUAL "monero")
|
||||
set(EXPORTED_SYMBOLS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/monero_libwallet2_api_c.exp)
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "wownero")
|
||||
set(EXPORTED_SYMBOLS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/wownero_libwallet2_api_c.exp)
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "zano")
|
||||
set(EXPORTED_SYMBOLS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/zano_libwallet2_api_c.exp)
|
||||
endif()
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -exported_symbols_list ${EXPORTED_SYMBOLS_FILE}")
|
||||
@@ -131,27 +117,6 @@ endif()
|
||||
|
||||
if (${MONERO_FLAVOR} STREQUAL "monero")
|
||||
set(WALLET_TARGETS wallet_api ${wallet_api_LIB_DEPENDS}) # wallet_api_LIB_DEPENDS
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "wownero")
|
||||
set(WALLET_TARGETS wallet_api ${wallet_api_LIB_DEPENDS}) # wallet_api_LIB_DEPENDS
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "zano")
|
||||
find_package(Boost 1.71 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
set(WALLET_TARGETS
|
||||
wallet
|
||||
general
|
||||
tor-connect
|
||||
crypto
|
||||
currency_core
|
||||
common
|
||||
zlibstatic
|
||||
|
||||
${Boost_LIBRARIES}
|
||||
${OpenSSL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(${MONERO_FLAVOR} STREQUAL "wownero")
|
||||
add_subdirectory(wownero-seed EXCLUDE_FROM_ALL)
|
||||
set(EXTRA_LIBS_WOWNEROSEED wownero-seed)
|
||||
endif()
|
||||
|
||||
#get_cmake_property(_variableNames VARIABLES)
|
||||
@@ -164,17 +129,8 @@ 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}
|
||||
${EXTRA_LIBS_WOWNEROSEED}
|
||||
${EXTRA_LIBS_ANDROID}
|
||||
)
|
||||
|
||||
@@ -122,8 +122,6 @@ _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 = "3515e4c9e537ca3efa664f0b364a3aeb106ff64337f542a262ce104c00b31235";
|
||||
const char * MONERO_wallet2_api_c_cpp_sha256 = "ca44a8d4a201ba6dc0a25c857e95d07bc8d514039b38cd5b3826100e8943cbcc-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe";
|
||||
const char * MONERO_wallet2_api_c_exp_sha256 = "0561e14606106e6b0ec49fb2aefe743ff500f7c3de07557f7041e06aef9509ce";
|
||||
const char * MONERO_wallet2_api_c_h_sha256 = "91218f60e937753a606b1db899ee2ed66a1b02144eb2d79b950ce59804397f84";
|
||||
const char * MONERO_wallet2_api_c_cpp_sha256 = "282128494f3419c128dff7ed67daadd9c2ad0600d10557e829df03d9bc1ad891-9d2f5b392bc46d56449be92295071fbc2cb3d230";
|
||||
const char * MONERO_wallet2_api_c_exp_sha256 = "d0f95f1f3bc49f1f59fe4eb0b61826128d7d3bb75405d5a01a252d02db03097d";
|
||||
#endif
|
||||
|
||||
@@ -2162,14 +2162,6 @@ void MONERO_Wallet_setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *c
|
||||
DEBUG_END()
|
||||
}
|
||||
|
||||
const char* MONERO_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* MONERO_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);
|
||||
|
||||
@@ -842,7 +842,6 @@ 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
|
||||
|
||||
@@ -22,38 +22,23 @@ Subject: [PATCH 06/17] add dummy device for ledger
|
||||
create mode 100644 src/device/device_io_dummy.hpp
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index c73b813d8..ce5ef4bab 100644
|
||||
index c73b813d8..5c0f31cb8 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -692,16 +692,21 @@ include_directories(${LMDB_INCLUDE})
|
||||
@@ -692,8 +692,12 @@ 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)
|
||||
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()
|
||||
|
||||
+endif()
|
||||
+
|
||||
# Trezor support check
|
||||
include(CheckTrezor)
|
||||
|
||||
# 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})
|
||||
diff --git a/src/device/CMakeLists.txt b/src/device/CMakeLists.txt
|
||||
index e4f1159b5..14d398f87 100644
|
||||
--- a/src/device/CMakeLists.txt
|
||||
@@ -300,12 +285,12 @@ index 000000000..01e6fc7b7
|
||||
+ MDEBUG("setDeviceReceivedData(len: " << len << ")");
|
||||
+ std::unique_lock<std::mutex> lock(mutex);
|
||||
+
|
||||
+ receivedFromDevice = static_cast<unsigned char *>(malloc(len));
|
||||
+ receivedFromDevice = data;
|
||||
+ receivedFromDeviceLength = len;
|
||||
+ memset(receivedFromDevice, 0, len);
|
||||
+ memcpy(receivedFromDevice, data, len);
|
||||
+ waitsForDeviceReceive = false;
|
||||
+
|
||||
+ waitsForDeviceSend = false;
|
||||
+ waitsForDeviceReceive = false;
|
||||
+
|
||||
+ cv_send.notify_all();
|
||||
+ cv_receive.notify_all();
|
||||
+ }
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 6e284a2ef552f1f47e8ca9edcf8651312c9e37dd 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
|
||||
|
||||
---
|
||||
.gitmodules | 3 ++-
|
||||
external/randomx | 2 +-
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/.gitmodules b/.gitmodules
|
||||
index 721cce3b4..ffb73fe9a 100644
|
||||
--- a/.gitmodules
|
||||
+++ b/.gitmodules
|
||||
@@ -9,7 +9,8 @@
|
||||
url = https://github.com/trezor/trezor-common.git
|
||||
[submodule "external/randomx"]
|
||||
path = external/randomx
|
||||
- url = https://github.com/tevador/RandomX
|
||||
+ url = https://github.com/MrCyjaneK/RandomX
|
||||
+ branch = cyjan-fix-ios
|
||||
[submodule "external/supercop"]
|
||||
path = external/supercop
|
||||
url = https://github.com/monero-project/supercop
|
||||
diff --git a/external/randomx b/external/randomx
|
||||
index 102f8acf9..ce72c9bb9 160000
|
||||
--- a/external/randomx
|
||||
+++ b/external/randomx
|
||||
@@ -1 +1 @@
|
||||
-Subproject commit 102f8acf90a7649ada410de5499a7ec62e49e1da
|
||||
+Subproject commit ce72c9bb9cb799e0d9171094b9abb009e04c5bfc
|
||||
--
|
||||
2.48.1
|
||||
|
||||
+9
-11
@@ -1,7 +1,7 @@
|
||||
From 799d1825696483da743ff2f92a773fcfbef08557 Mon Sep 17 00:00:00 2001
|
||||
From b4f4b38af1ab974872862fc20735e41941b955e9 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Sat, 11 May 2024 16:25:10 +0200
|
||||
Subject: [PATCH 04/15] store crash fix
|
||||
Subject: [PATCH 02/14] store crash fix
|
||||
|
||||
Monero wallet crashes (sometimes) when it is syncing,
|
||||
while the proper solution (that can be seen in feather)
|
||||
@@ -38,12 +38,12 @@ the current state.
|
||||
---
|
||||
src/wallet/api/wallet.cpp | 25 ++++++++++++-------------
|
||||
src/wallet/api/wallet.h | 1 -
|
||||
src/wallet/wallet2.cpp | 12 +++++++++++-
|
||||
src/wallet/wallet2.cpp | 11 ++++++++++-
|
||||
src/wallet/wallet2.h | 3 +++
|
||||
4 files changed, 26 insertions(+), 15 deletions(-)
|
||||
4 files changed, 25 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
|
||||
index e868fa039..899ef044a 100644
|
||||
index 8fda0bab7..67b170e3d 100644
|
||||
--- a/src/wallet/api/wallet.cpp
|
||||
+++ b/src/wallet/api/wallet.cpp
|
||||
@@ -55,8 +55,8 @@ using namespace cryptonote;
|
||||
@@ -147,7 +147,7 @@ index 1f199a72c..ac7ce2f6a 100644
|
||||
std::atomic<int> m_refreshIntervalMillis;
|
||||
std::atomic<bool> m_refreshShouldRescan;
|
||||
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
|
||||
index 535005ab1..4e66cdeae 100644
|
||||
index dfb8b23cb..c9c2dbc82 100644
|
||||
--- a/src/wallet/wallet2.cpp
|
||||
+++ b/src/wallet/wallet2.cpp
|
||||
@@ -1192,6 +1192,7 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended, std
|
||||
@@ -173,19 +173,17 @@ index 535005ab1..4e66cdeae 100644
|
||||
bool wallet2::set_proxy(const std::string &address)
|
||||
{
|
||||
return m_http_client->set_proxy(address);
|
||||
@@ -4107,8 +4116,9 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
|
||||
@@ -4107,7 +4116,7 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
|
||||
// infer when we get an incoming output
|
||||
|
||||
bool first = true, last = false;
|
||||
- while(m_run.load(std::memory_order_relaxed) && blocks_fetched < max_blocks)
|
||||
+ while(m_run.load(std::memory_order_relaxed) && blocks_fetched < max_blocks && m_refreshEnabled)
|
||||
{
|
||||
+ LOG_ERROR("SYNCING");
|
||||
uint64_t next_blocks_start_height;
|
||||
std::vector<cryptonote::block_complete_entry> next_blocks;
|
||||
std::vector<parsed_block> next_parsed_blocks;
|
||||
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
|
||||
index 632298726..022d0696f 100644
|
||||
index 2f4ad52f1..daad1e940 100644
|
||||
--- a/src/wallet/wallet2.h
|
||||
+++ b/src/wallet/wallet2.h
|
||||
@@ -1078,6 +1078,8 @@ private:
|
||||
@@ -206,5 +204,5 @@ index 632298726..022d0696f 100644
|
||||
i_wallet2_callback* m_callback;
|
||||
hw::device::device_type m_key_device_type;
|
||||
--
|
||||
2.48.0
|
||||
2.48.1
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
From 5a9148c10ea29a42d8aa08d69e2f4559c8611655 Mon Sep 17 00:00:00 2001
|
||||
From a74f616e3c1671a883182b0db1c6fc11a1242c01 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Mon, 2 Sep 2024 16:40:31 +0200
|
||||
Subject: [PATCH 05/15] uint64_t missing definition fix
|
||||
Subject: [PATCH 03/14] 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.0
|
||||
2.48.1
|
||||
|
||||
+8
-8
@@ -1,7 +1,7 @@
|
||||
From ee6aa49179833c930c1ec10ae2e877aeb87eb8c8 Mon Sep 17 00:00:00 2001
|
||||
From f9b222f1611d7cfbaf0ac52cd6194724c7554def Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Mon, 24 Jun 2024 10:49:12 +0200
|
||||
Subject: [PATCH 06/15] use proper error handling in get_seed
|
||||
Subject: [PATCH 04/14] use proper error handling in get_seed
|
||||
|
||||
---
|
||||
src/wallet/api/wallet.cpp | 17 ++++++++++++-----
|
||||
@@ -9,10 +9,10 @@ Subject: [PATCH 06/15] use proper error handling in get_seed
|
||||
2 files changed, 16 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
|
||||
index 899ef044a..e16d8f83f 100644
|
||||
index 67b170e3d..89df5c517 100644
|
||||
--- a/src/wallet/api/wallet.cpp
|
||||
+++ b/src/wallet/api/wallet.cpp
|
||||
@@ -826,12 +826,19 @@ bool WalletImpl::close(bool store)
|
||||
@@ -763,12 +763,19 @@ bool WalletImpl::close(bool store)
|
||||
|
||||
std::string WalletImpl::seed(const std::string& seed_offset) const
|
||||
{
|
||||
@@ -38,10 +38,10 @@ index 899ef044a..e16d8f83f 100644
|
||||
|
||||
std::string WalletImpl::getSeedLanguage() const
|
||||
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
|
||||
index 4e66cdeae..48267d647 100644
|
||||
index c9c2dbc82..b827b826f 100644
|
||||
--- a/src/wallet/wallet2.cpp
|
||||
+++ b/src/wallet/wallet2.cpp
|
||||
@@ -1449,11 +1449,13 @@ bool wallet2::get_seed(epee::wipeable_string& electrum_words, const epee::wipeab
|
||||
@@ -1428,11 +1428,13 @@ bool wallet2::get_seed(epee::wipeable_string& electrum_words, const epee::wipeab
|
||||
bool keys_deterministic = is_deterministic();
|
||||
if (!keys_deterministic)
|
||||
{
|
||||
@@ -55,7 +55,7 @@ index 4e66cdeae..48267d647 100644
|
||||
std::cout << "seed_language not set" << std::endl;
|
||||
return false;
|
||||
}
|
||||
@@ -1463,8 +1465,9 @@ bool wallet2::get_seed(epee::wipeable_string& electrum_words, const epee::wipeab
|
||||
@@ -1444,8 +1446,9 @@ bool wallet2::get_seed(epee::wipeable_string& electrum_words, const epee::wipeab
|
||||
key = cryptonote::encrypt_key(key, passphrase);
|
||||
if (!crypto::ElectrumWords::bytes_to_words(key, electrum_words, seed_language))
|
||||
{
|
||||
@@ -67,5 +67,5 @@ index 4e66cdeae..48267d647 100644
|
||||
|
||||
return true;
|
||||
--
|
||||
2.48.0
|
||||
2.48.1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 031df7de0d75d93f78be732d5cac702b0ab193f0 Mon Sep 17 00:00:00 2001
|
||||
From ff70c74c8b331758ace1f14df0ca107731dda49d Mon Sep 17 00:00:00 2001
|
||||
From: tobtoht <tob@featherwallet.org>
|
||||
Date: Tue, 12 Mar 2024 10:09:50 +0100
|
||||
Subject: [PATCH 07/15] UR functions
|
||||
Subject: [PATCH 05/14] UR functions
|
||||
|
||||
This commit adds UR functions for UR tasks,
|
||||
I believe that the right place to get
|
||||
@@ -19,10 +19,8 @@ Things broken in the commit
|
||||
later. However (considering the purpose
|
||||
of this patch) it is not a dealbreaker.
|
||||
---
|
||||
.gitmodules | 5 +-
|
||||
.gitmodules | 4 +
|
||||
CMakeLists.txt | 4 +-
|
||||
contrib/depends/hosts/darwin.mk | 2 +-
|
||||
contrib/depends/toolchain.cmake.in | 2 +-
|
||||
external/CMakeLists.txt | 1 +
|
||||
external/bc-ur | 1 +
|
||||
src/device/device_ledger.cpp | 5 +-
|
||||
@@ -36,69 +34,46 @@ Things broken in the commit
|
||||
src/wallet/api/wallet2_api.h | 22 +-
|
||||
src/wallet/wallet2.cpp | 141 +++++++----
|
||||
src/wallet/wallet2.h | 3 +
|
||||
17 files changed, 521 insertions(+), 60 deletions(-)
|
||||
15 files changed, 519 insertions(+), 57 deletions(-)
|
||||
create mode 160000 external/bc-ur
|
||||
|
||||
diff --git a/.gitmodules b/.gitmodules
|
||||
index 991071fbe..b24855d9b 100644
|
||||
index ffb73fe9a..72af74d55 100644
|
||||
--- a/.gitmodules
|
||||
+++ b/.gitmodules
|
||||
@@ -16,4 +16,7 @@
|
||||
path = external/randomwow
|
||||
url = https://codeberg.org/wownero/RandomWOW
|
||||
branch = 1.2.1-wow
|
||||
-
|
||||
@@ -11,6 +11,10 @@
|
||||
path = external/supercop
|
||||
url = https://github.com/monero-project/supercop
|
||||
branch = monero
|
||||
+[submodule "external/bc-ur"]
|
||||
+ path = external/bc-ur
|
||||
+ url = https://github.com/MrCyjaneK/bc-ur
|
||||
+ branch = misc
|
||||
[submodule "external/miniupnp"]
|
||||
path = external/miniupnp
|
||||
url = https://github.com/miniupnp/miniupnp
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b4b8c8089..88335ee9d 100644
|
||||
index db69b1b04..c73b813d8 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -96,7 +96,8 @@ enable_language(C ASM)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
@@ -100,6 +100,7 @@ enable_language(C ASM)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_EXTENSIONS OFF)
|
||||
-set(CMAKE_CXX_STANDARD 14)
|
||||
+set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
+add_definitions(-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) # boost: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
@@ -365,6 +366,7 @@ if(NOT MANUAL_SUBMODULES)
|
||||
@@ -367,6 +368,7 @@ if(NOT MANUAL_SUBMODULES)
|
||||
endfunction ()
|
||||
|
||||
message(STATUS "Checking submodules")
|
||||
+ #check_submodule(external/bc-ur)
|
||||
+# check_submodule(external/bc-ur)
|
||||
check_submodule(external/miniupnp)
|
||||
check_submodule(external/rapidjson)
|
||||
#check_submodule(external/trezor-common)
|
||||
diff --git a/contrib/depends/hosts/darwin.mk b/contrib/depends/hosts/darwin.mk
|
||||
index 79d449054..83d83036b 100644
|
||||
--- a/contrib/depends/hosts/darwin.mk
|
||||
+++ b/contrib/depends/hosts/darwin.mk
|
||||
@@ -1,4 +1,4 @@
|
||||
-OSX_MIN_VERSION=10.8
|
||||
+OSX_MIN_VERSION=10.14
|
||||
LD64_VERSION=609
|
||||
ifeq (aarch64, $(host_arch))
|
||||
CC_target=arm64-apple-$(host_os)
|
||||
diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in
|
||||
index f118c754e..f26655d68 100644
|
||||
--- a/contrib/depends/toolchain.cmake.in
|
||||
+++ b/contrib/depends/toolchain.cmake.in
|
||||
@@ -94,7 +94,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
SET(BREW OFF)
|
||||
SET(PORT OFF)
|
||||
SET(CMAKE_OSX_SYSROOT "@prefix@/native/SDK/")
|
||||
- SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.08")
|
||||
+ SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
|
||||
SET(CMAKE_CXX_STANDARD 14)
|
||||
SET(LLVM_ENABLE_PIC OFF)
|
||||
SET(LLVM_ENABLE_PIE OFF)
|
||||
check_submodule(external/trezor-common)
|
||||
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
|
||||
index 29aed0cc6..dfdffe67c 100644
|
||||
index 538e4d215..074e23f16 100644
|
||||
--- a/external/CMakeLists.txt
|
||||
+++ b/external/CMakeLists.txt
|
||||
@@ -69,4 +69,5 @@ endif()
|
||||
@@ -106,36 +81,16 @@ index 29aed0cc6..dfdffe67c 100644
|
||||
add_subdirectory(easylogging++)
|
||||
add_subdirectory(qrcodegen)
|
||||
+add_subdirectory(bc-ur)
|
||||
add_subdirectory(randomwow EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(randomx EXCLUDE_FROM_ALL)
|
||||
diff --git a/external/bc-ur b/external/bc-ur
|
||||
new file mode 160000
|
||||
index 000000000..d82e7c753
|
||||
--- /dev/null
|
||||
+++ b/external/bc-ur
|
||||
@@ -0,0 +1 @@
|
||||
@@ -0,0 +1,1 @@
|
||||
+Subproject commit d82e7c753e710b8000706dc3383b498438795208
|
||||
diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp
|
||||
index 9961d13e7..8403d76e8 100644
|
||||
--- a/src/device/device_ledger.cpp
|
||||
+++ b/src/device/device_ledger.cpp
|
||||
@@ -313,12 +313,13 @@ namespace hw {
|
||||
|
||||
/* ======================================================================= */
|
||||
/* LOCKER */
|
||||
- /* ======================================================================= */
|
||||
+ /* ======================================================================= */
|
||||
|
||||
//automatic lock one more level on device ensuring the current thread is allowed to use it
|
||||
+ #pragma message ("Warning AUTO_LOCK_CMD is intentionally left broken. This is yet to be fixed.")
|
||||
#define AUTO_LOCK_CMD() \
|
||||
/* lock both mutexes without deadlock*/ \
|
||||
- boost::lock(device_locker, command_locker); \
|
||||
+ /* boost::lock(device_locker, command_locker); */ \
|
||||
/* make sure both already-locked mutexes are unlocked at the end of scope */ \
|
||||
boost::lock_guard<boost::recursive_mutex> lock1(device_locker, boost::adopt_lock); \
|
||||
boost::lock_guard<boost::mutex> lock2(command_locker, boost::adopt_lock)
|
||||
diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt
|
||||
index fdf3f2f5d..66384fe31 100644
|
||||
index 6095f99d5..b163212b7 100644
|
||||
--- a/src/wallet/CMakeLists.txt
|
||||
+++ b/src/wallet/CMakeLists.txt
|
||||
@@ -50,6 +50,7 @@ monero_add_library(wallet
|
||||
@@ -144,8 +99,8 @@ index fdf3f2f5d..66384fe31 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
|
||||
@@ -282,10 +237,10 @@ index 30065a7fa..a94b23f75 100644
|
||||
uint64_t minMixinCount() const override;
|
||||
|
||||
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
|
||||
index e16d8f83f..ee000e7ab 100644
|
||||
index 89df5c517..3fcd6f332 100644
|
||||
--- a/src/wallet/api/wallet.cpp
|
||||
+++ b/src/wallet/api/wallet.cpp
|
||||
@@ -47,6 +47,7 @@
|
||||
@@ -48,6 +48,7 @@
|
||||
|
||||
#include <boost/locale.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
@@ -293,11 +248,11 @@ index e16d8f83f..ee000e7ab 100644
|
||||
|
||||
using namespace std;
|
||||
using namespace cryptonote;
|
||||
@@ -1066,6 +1067,24 @@ uint64_t WalletImpl::unlockedBalance(uint32_t accountIndex) const
|
||||
return m_wallet->unlocked_balance(accountIndex, false);
|
||||
@@ -961,6 +962,24 @@ uint64_t WalletImpl::unlockedBalance(uint32_t accountIndex) const
|
||||
return m_wallet->unlocked_balance(accountIndex, asset, false);
|
||||
}
|
||||
|
||||
+uint64_t WalletImpl::viewOnlyBalance(uint32_t accountIndex, const std::vector<std::string> &key_images) const
|
||||
+uint64_t WalletImpl::viewOnlyBalance(uint32_t accountIndex, const std::vector<std::string> &key_images, const std::string& asset) const
|
||||
+{
|
||||
+ clearStatus();
|
||||
+
|
||||
@@ -312,13 +267,13 @@ index e16d8f83f..ee000e7ab 100644
|
||||
+ kis.push_back(ki);
|
||||
+ }
|
||||
+
|
||||
+ return m_wallet->view_only_balance(accountIndex, kis);
|
||||
+ return m_wallet->view_only_balance(accountIndex, kis, asset);
|
||||
+}
|
||||
+
|
||||
uint64_t WalletImpl::blockChainHeight() const
|
||||
{
|
||||
if(m_wallet->light_wallet()) {
|
||||
@@ -1208,6 +1227,61 @@ UnsignedTransaction *WalletImpl::loadUnsignedTx(const std::string &unsigned_file
|
||||
return m_wallet->get_blockchain_current_height();
|
||||
@@ -1139,6 +1158,61 @@ UnsignedTransaction *WalletImpl::loadUnsignedTx(const std::string &unsigned_file
|
||||
return transaction;
|
||||
}
|
||||
|
||||
@@ -380,16 +335,7 @@ index e16d8f83f..ee000e7ab 100644
|
||||
bool WalletImpl::submitTransaction(const string &fileName) {
|
||||
clearStatus();
|
||||
if (checkBackgroundSync("cannot submit tx"))
|
||||
@@ -1219,7 +1293,7 @@ bool WalletImpl::submitTransaction(const string &fileName) {
|
||||
setStatus(Status_Ok, tr("Failed to load transaction from file"));
|
||||
return false;
|
||||
}
|
||||
-
|
||||
+
|
||||
if(!transaction->commit()) {
|
||||
setStatusError(transaction->m_errorString);
|
||||
return false;
|
||||
@@ -1228,6 +1302,61 @@ bool WalletImpl::submitTransaction(const string &fileName) {
|
||||
@@ -1159,6 +1233,61 @@ bool WalletImpl::submitTransaction(const string &fileName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -451,7 +397,7 @@ index e16d8f83f..ee000e7ab 100644
|
||||
bool WalletImpl::exportKeyImages(const string &filename, bool all)
|
||||
{
|
||||
if (m_wallet->watch_only())
|
||||
@@ -1255,6 +1384,39 @@ bool WalletImpl::exportKeyImages(const string &filename, bool all)
|
||||
@@ -1186,6 +1318,39 @@ bool WalletImpl::exportKeyImages(const string &filename, bool all)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -491,7 +437,7 @@ index e16d8f83f..ee000e7ab 100644
|
||||
bool WalletImpl::importKeyImages(const string &filename)
|
||||
{
|
||||
if (checkBackgroundSync("cannot import key images"))
|
||||
@@ -1280,6 +1442,62 @@ bool WalletImpl::importKeyImages(const string &filename)
|
||||
@@ -1211,6 +1373,62 @@ bool WalletImpl::importKeyImages(const string &filename)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -554,7 +500,7 @@ index e16d8f83f..ee000e7ab 100644
|
||||
bool WalletImpl::exportOutputs(const string &filename, bool all)
|
||||
{
|
||||
if (checkBackgroundSync("cannot export outputs"))
|
||||
@@ -1312,6 +1530,40 @@ bool WalletImpl::exportOutputs(const string &filename, bool all)
|
||||
@@ -1243,6 +1461,40 @@ bool WalletImpl::exportOutputs(const string &filename, bool all)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -595,7 +541,7 @@ index e16d8f83f..ee000e7ab 100644
|
||||
bool WalletImpl::importOutputs(const string &filename)
|
||||
{
|
||||
if (checkBackgroundSync("cannot import outputs"))
|
||||
@@ -1346,6 +1598,61 @@ bool WalletImpl::importOutputs(const string &filename)
|
||||
@@ -1277,6 +1529,61 @@ bool WalletImpl::importOutputs(const string &filename)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -661,16 +607,16 @@ diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
|
||||
index ac7ce2f6a..edf8bb8ce 100644
|
||||
--- a/src/wallet/api/wallet.h
|
||||
+++ b/src/wallet/api/wallet.h
|
||||
@@ -112,6 +112,7 @@ public:
|
||||
@@ -113,6 +113,7 @@ public:
|
||||
bool setProxy(const std::string &address) override;
|
||||
uint64_t balance(uint32_t accountIndex = 0) const override;
|
||||
uint64_t unlockedBalance(uint32_t accountIndex = 0) const override;
|
||||
+ uint64_t viewOnlyBalance(uint32_t accountIndex, const std::vector<std::string> &key_images) const override;
|
||||
uint64_t balance(const std::string& asset, uint32_t accountIndex = 0) const override;
|
||||
uint64_t unlockedBalance(const std::string& asset, uint32_t accountIndex = 0) const override;
|
||||
+ uint64_t viewOnlyBalance(uint32_t accountIndex, const std::vector<std::string> &key_images, const std::string& asset = "SAL1") const override;
|
||||
uint64_t blockChainHeight() const override;
|
||||
uint64_t approximateBlockChainHeight() const override;
|
||||
uint64_t estimateBlockChainHeight() const override;
|
||||
@@ -164,11 +165,18 @@ public:
|
||||
std::set<uint32_t> subaddr_indices = {}) override;
|
||||
@@ -177,11 +178,18 @@ public:
|
||||
std::set<uint32_t> subaddr_indices = {}) override;
|
||||
virtual PendingTransaction * createSweepUnmixableTransaction() override;
|
||||
bool submitTransaction(const std::string &fileName) override;
|
||||
+ bool submitTransactionUR(const std::string &input) override;
|
||||
@@ -692,7 +638,7 @@ diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
|
||||
index e349df176..764adbfbf 100644
|
||||
--- a/src/wallet/api/wallet2_api.h
|
||||
+++ b/src/wallet/api/wallet2_api.h
|
||||
@@ -91,6 +91,7 @@ struct PendingTransaction
|
||||
@@ -92,6 +92,7 @@ struct PendingTransaction
|
||||
virtual std::string errorString() const = 0;
|
||||
// commit transaction or save to file if filename is provided.
|
||||
virtual bool commit(const std::string &filename = "", bool overwrite = false) = 0;
|
||||
@@ -700,7 +646,7 @@ index e349df176..764adbfbf 100644
|
||||
virtual uint64_t amount() const = 0;
|
||||
virtual uint64_t dust() const = 0;
|
||||
virtual uint64_t fee() const = 0;
|
||||
@@ -160,7 +161,8 @@ struct UnsignedTransaction
|
||||
@@ -195,7 +196,8 @@ struct UnsignedTransaction
|
||||
* @param signedFileName
|
||||
* return - true on success
|
||||
*/
|
||||
@@ -710,15 +656,15 @@ index e349df176..764adbfbf 100644
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -626,6 +628,7 @@ struct Wallet
|
||||
result += unlockedBalance(i);
|
||||
@@ -668,6 +670,7 @@ struct Wallet
|
||||
result += unlockedBalance(asset, i);
|
||||
return result;
|
||||
}
|
||||
+ virtual uint64_t viewOnlyBalance(uint32_t accountIndex, const std::vector<std::string> &key_images = {}) const = 0;
|
||||
+ virtual uint64_t viewOnlyBalance(uint32_t accountIndex, const std::vector<std::string> &key_images = {}, const std::string& asset = "SAL1") const = 0;
|
||||
|
||||
/**
|
||||
* @brief watchOnly - checks if wallet is watch only
|
||||
@@ -884,13 +887,15 @@ struct Wallet
|
||||
@@ -965,13 +968,15 @@ struct Wallet
|
||||
* after object returned
|
||||
*/
|
||||
virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) = 0;
|
||||
@@ -737,7 +683,7 @@ index e349df176..764adbfbf 100644
|
||||
|
||||
/*!
|
||||
* \brief disposeTransaction - destroys transaction object
|
||||
@@ -906,6 +911,8 @@ struct Wallet
|
||||
@@ -987,6 +992,8 @@ struct Wallet
|
||||
virtual uint64_t estimateTransactionFee(const std::vector<std::pair<std::string, uint64_t>> &destinations,
|
||||
PendingTransaction::Priority priority) const = 0;
|
||||
|
||||
@@ -746,7 +692,7 @@ index e349df176..764adbfbf 100644
|
||||
/*!
|
||||
* \brief exportKeyImages - exports key images to file
|
||||
* \param filename
|
||||
@@ -913,20 +920,22 @@ struct Wallet
|
||||
@@ -994,20 +1001,22 @@ struct Wallet
|
||||
* \return - true on success
|
||||
*/
|
||||
virtual bool exportKeyImages(const std::string &filename, bool all = false) = 0;
|
||||
@@ -771,7 +717,7 @@ index e349df176..764adbfbf 100644
|
||||
|
||||
/*!
|
||||
* \brief importOutputs - imports outputs from file
|
||||
@@ -934,6 +943,7 @@ struct Wallet
|
||||
@@ -1015,6 +1024,7 @@ struct Wallet
|
||||
* \return - true on success
|
||||
*/
|
||||
virtual bool importOutputs(const std::string &filename) = 0;
|
||||
@@ -780,10 +726,10 @@ index e349df176..764adbfbf 100644
|
||||
/*!
|
||||
* \brief scanTransactions - scan a list of transaction ids, this operation may reveal the txids to the remote node and affect your privacy
|
||||
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
|
||||
index 48267d647..e14d4d2fc 100644
|
||||
index b827b826f..765cefb32 100644
|
||||
--- a/src/wallet/wallet2.cpp
|
||||
+++ b/src/wallet/wallet2.cpp
|
||||
@@ -948,6 +948,16 @@ uint32_t get_subaddress_clamped_sum(uint32_t idx, uint32_t extra)
|
||||
@@ -945,6 +945,16 @@ uint32_t get_subaddress_clamped_sum(uint32_t idx, uint32_t extra)
|
||||
return idx + extra;
|
||||
}
|
||||
|
||||
@@ -800,33 +746,37 @@ index 48267d647..e14d4d2fc 100644
|
||||
static void setup_shim(hw::wallet_shim * shim, tools::wallet2 * wallet)
|
||||
{
|
||||
shim->get_tx_pub_key_from_received_outs = std::bind(&tools::wallet2::get_tx_pub_key_from_received_outs, wallet, std::placeholders::_1);
|
||||
@@ -6998,6 +7008,25 @@ uint64_t wallet2::unlocked_balance(uint32_t index_major, bool strict, uint64_t *
|
||||
@@ -7088,6 +7098,29 @@ uint64_t wallet2::unlocked_balance(uint32_t index_major, const std::string& asse
|
||||
return amount;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
+uint64_t wallet2::view_only_balance(uint32_t index_major, const std::vector<crypto::key_image>& selected_inputs)
|
||||
+uint64_t wallet2::view_only_balance(uint32_t index_major, const std::vector<crypto::key_image>& selected_inputs, const std::string& asset_type)
|
||||
+{
|
||||
+ uint64_t amount = 0;
|
||||
+ for (const auto &td : m_transfers) {
|
||||
+ if (is_preferred_input(selected_inputs, td.m_key_image) &&
|
||||
+ !is_spent(td, false) &&
|
||||
+ !td.m_frozen &&
|
||||
+ !td.m_key_image_partial &&
|
||||
+ td.m_key_image_known &&
|
||||
+ td.is_rct() &&
|
||||
+ is_transfer_unlocked(td) &&
|
||||
+ td.m_subaddr_index.major == index_major)
|
||||
+ if (m_transfers_indices.count(asset_type) > 0) {
|
||||
+ for (const auto& idx: m_transfers_indices.at(asset_type))
|
||||
+ {
|
||||
+ amount += td.m_amount;
|
||||
+ const transfer_details& td = m_transfers[idx];
|
||||
+ if (is_preferred_input(selected_inputs, td.m_key_image) &&
|
||||
+ !is_spent(td, false) &&
|
||||
+ !td.m_frozen &&
|
||||
+ !td.m_key_image_partial &&
|
||||
+ td.m_key_image_known &&
|
||||
+ td.is_rct() &&
|
||||
+ is_transfer_unlocked(td) &&
|
||||
+ td.m_subaddr_index.major == index_major)
|
||||
+ {
|
||||
+ amount += td.m_amount;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return amount;
|
||||
+}
|
||||
+//----------------------------------------------------------------------------------------------------
|
||||
std::map<uint32_t, uint64_t> wallet2::balance_per_subaddress(uint32_t index_major, bool strict) const
|
||||
std::map<uint32_t, uint64_t> wallet2::balance_per_subaddress(uint32_t index_major, const std::string& asset_type, bool strict) const
|
||||
{
|
||||
std::map<uint32_t, uint64_t> amount_per_subaddr;
|
||||
@@ -7849,9 +7878,7 @@ bool wallet2::sign_tx(unsigned_tx_set &exported_txs, std::vector<wallet2::pendin
|
||||
@@ -7963,9 +7992,7 @@ bool wallet2::sign_tx(unsigned_tx_set &exported_txs, std::vector<wallet2::pendin
|
||||
crypto::key_derivation derivation;
|
||||
std::vector<crypto::key_derivation> additional_derivations;
|
||||
|
||||
@@ -837,7 +787,7 @@ index 48267d647..e14d4d2fc 100644
|
||||
std::vector<crypto::public_key> additional_tx_pub_keys;
|
||||
for (const crypto::secret_key &skey: txs[n].additional_tx_keys)
|
||||
{
|
||||
@@ -11241,7 +11268,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
||||
@@ -10880,7 +10907,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
||||
MDEBUG("Ignoring output " << i << " of amount " << print_money(td.amount()) << " which is below fractional threshold " << print_money(fractional_threshold));
|
||||
continue;
|
||||
}
|
||||
@@ -846,7 +796,7 @@ index 48267d647..e14d4d2fc 100644
|
||||
{
|
||||
if (td.amount() > m_ignore_outputs_above || td.amount() < m_ignore_outputs_below)
|
||||
{
|
||||
@@ -11291,9 +11318,15 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
||||
@@ -10930,9 +10957,15 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
||||
|
||||
LOG_PRINT_L2("Starting with " << num_nondust_outputs << " non-dust outputs and " << num_dust_outputs << " dust outputs");
|
||||
|
||||
@@ -864,8 +814,8 @@ index 48267d647..e14d4d2fc 100644
|
||||
// if empty, put dummy entry so that the front can be referenced later in the loop
|
||||
if (unused_dust_indices_per_subaddr.empty())
|
||||
unused_dust_indices_per_subaddr.push_back({});
|
||||
@@ -13920,33 +13953,40 @@ crypto::public_key wallet2::get_tx_pub_key_from_received_outs(const tools::walle
|
||||
|
||||
@@ -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);
|
||||
@@ -928,7 +878,7 @@ index 48267d647..e14d4d2fc 100644
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
std::pair<uint64_t, std::vector<std::pair<crypto::key_image, crypto::signature>>> wallet2::export_key_images(bool all) const
|
||||
{
|
||||
@@ -14001,53 +14041,60 @@ std::pair<uint64_t, std::vector<std::pair<crypto::key_image, crypto::signature>>
|
||||
@@ -13828,53 +13868,60 @@ std::pair<uint64_t, std::vector<std::pair<crypto::key_image, crypto::signature>>
|
||||
return std::make_pair(offset, ski);
|
||||
}
|
||||
|
||||
@@ -1008,18 +958,18 @@ index 48267d647..e14d4d2fc 100644
|
||||
ski.push_back(std::make_pair(key_image, signature));
|
||||
}
|
||||
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
|
||||
index 022d0696f..746e2aeff 100644
|
||||
index daad1e940..a752f15b9 100644
|
||||
--- a/src/wallet/wallet2.h
|
||||
+++ b/src/wallet/wallet2.h
|
||||
@@ -1157,6 +1157,7 @@ private:
|
||||
@@ -1112,6 +1112,7 @@ private:
|
||||
// locked & unlocked balance of given or current subaddress account
|
||||
uint64_t balance(uint32_t subaddr_index_major, bool strict) const;
|
||||
uint64_t unlocked_balance(uint32_t subaddr_index_major, bool strict, uint64_t *blocks_to_unlock = NULL, uint64_t *time_to_unlock = NULL);
|
||||
+ uint64_t view_only_balance(uint32_t index_major, const std::vector<crypto::key_image>& selected_inputs = {});
|
||||
uint64_t balance(uint32_t subaddr_index_major, const std::string& asset_type, bool strict) const;
|
||||
uint64_t unlocked_balance(uint32_t subaddr_index_major, const std::string& asset_type, bool strict, uint64_t *blocks_to_unlock = NULL, uint64_t *time_to_unlock = NULL);
|
||||
+ uint64_t view_only_balance(uint32_t index_major, const std::vector<crypto::key_image>& selected_inputs = {}, const std::string& asset_type = "SAL1");
|
||||
// locked & unlocked balance per subaddress of given or current subaddress account
|
||||
std::map<uint32_t, uint64_t> balance_per_subaddress(uint32_t subaddr_index_major, bool strict) const;
|
||||
std::map<uint32_t, std::pair<uint64_t, std::pair<uint64_t, uint64_t>>> unlocked_balance_per_subaddress(uint32_t subaddr_index_major, bool strict);
|
||||
@@ -1631,9 +1632,11 @@ private:
|
||||
std::map<uint32_t, uint64_t> balance_per_subaddress(uint32_t subaddr_index_major, const std::string& asset_type, bool strict) const;
|
||||
std::map<uint32_t, std::pair<uint64_t, std::pair<uint64_t, uint64_t>>> unlocked_balance_per_subaddress(uint32_t subaddr_index_major, const std::string& asset_type, bool strict);
|
||||
@@ -1596,9 +1597,11 @@ private:
|
||||
std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> export_blockchain() const;
|
||||
void import_blockchain(const std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> &bc);
|
||||
bool export_key_images(const std::string &filename, bool all = false) const;
|
||||
@@ -1032,5 +982,5 @@ index 022d0696f..746e2aeff 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.0
|
||||
2.48.1
|
||||
|
||||
+121
-79
@@ -1,22 +1,23 @@
|
||||
From 221fb7ed81aff1830b4bc2d7f9b73c94eb36924a 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 08/15] 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
|
||||
|
||||
@@ -84,7 +85,7 @@ index e4f1159b5..14d398f87 100644
|
||||
${device_headers}
|
||||
device_ledger.hpp
|
||||
diff --git a/src/device/device.cpp b/src/device/device.cpp
|
||||
index e6cd358b6..777584c01 100644
|
||||
index e6cd358b6..dd0701e0c 100644
|
||||
--- a/src/device/device.cpp
|
||||
+++ b/src/device/device.cpp
|
||||
@@ -29,7 +29,7 @@
|
||||
@@ -146,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.
|
||||
@@ -204,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 {
|
||||
@@ -242,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) {
|
||||
+ std::this_thread::sleep_for(std::chrono::microseconds(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) {
|
||||
+ std::this_thread::sleep_for(std::chrono::microseconds(1000));
|
||||
+ MDEBUG("exchange(): waitsForDeviceReceive (still)");
|
||||
+ cv_receive.wait(lock);
|
||||
+ MDEBUG("exchange(): waitsForDeviceReceive notified");
|
||||
+ }
|
||||
+
|
||||
+ if (receivedFromDeviceLength > max_resp_len) {
|
||||
@@ -265,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;
|
||||
+ }
|
||||
@@ -278,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.
|
||||
@@ -324,6 +353,8 @@ index 000000000..a1733616d
|
||||
+
|
||||
+#include "device_io.hpp"
|
||||
+#include "device_io_hid.hpp"
|
||||
+#include <mutex>
|
||||
+#include <condition_variable>
|
||||
+
|
||||
+namespace hw {
|
||||
+ namespace io {
|
||||
@@ -335,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;
|
||||
@@ -345,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);
|
||||
@@ -358,14 +392,17 @@ 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);
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+#endif // HAVE_HIDAPI
|
||||
diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp
|
||||
index 8403d76e8..0587eb7d3 100644
|
||||
index bb5b6f497..046201a1e 100644
|
||||
--- a/src/device/device_ledger.cpp
|
||||
+++ b/src/device/device_ledger.cpp
|
||||
@@ -41,7 +41,7 @@ namespace hw {
|
||||
@@ -375,8 +412,8 @@ index 8403d76e8..0587eb7d3 100644
|
||||
- #ifdef WITH_DEVICE_LEDGER
|
||||
+ #if defined(WITH_DEVICE_LEDGER) || defined(HIDAPI_DUMMY)
|
||||
|
||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
#define MONERO_DEFAULT_LOG_CATEGORY "device.ledger"
|
||||
namespace {
|
||||
bool apdu_verbose =true;
|
||||
@@ -299,7 +299,7 @@ namespace hw {
|
||||
|
||||
device_ledger::device_ledger(): hw_device(0x0101, 0x05, 64, 2000) {
|
||||
@@ -405,9 +442,9 @@ index 03058c4f1..39454ca6d 100644
|
||||
#include "log.hpp"
|
||||
#include "device_io_hid.hpp"
|
||||
+#include "device_io_dummy.hpp"
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/recursive_mutex.hpp>
|
||||
#include <mutex>
|
||||
|
||||
namespace hw {
|
||||
@@ -56,7 +57,7 @@ namespace hw {
|
||||
|
||||
void register_all(std::map<std::string, std::unique_ptr<device>> ®istry);
|
||||
@@ -417,8 +454,8 @@ index 03058c4f1..39454ca6d 100644
|
||||
|
||||
// Origin: https://github.com/LedgerHQ/ledger-app-monero/blob/master/src/monero_types.h
|
||||
#define SW_OK 0x9000
|
||||
@@ -148,7 +149,11 @@ namespace hw {
|
||||
mutable boost::mutex command_locker;
|
||||
@@ -142,7 +143,11 @@ namespace hw {
|
||||
mutable std::mutex command_locker;
|
||||
|
||||
//IO
|
||||
+#if defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI)
|
||||
@@ -430,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 ee000e7ab..556e2a8ce 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"
|
||||
@@ -443,91 +480,87 @@ index ee000e7ab..556e2a8ce 100644
|
||||
|
||||
using namespace std;
|
||||
using namespace cryptonote;
|
||||
@@ -3178,4 +3181,95 @@ 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));
|
||||
@@ -535,15 +568,27 @@ index ee000e7ab..556e2a8ce 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
|
||||
+}
|
||||
+
|
||||
} // namespace
|
||||
+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
|
||||
+}
|
||||
+
|
||||
YieldInfo * WalletImpl::getYieldInfo()
|
||||
{
|
||||
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{};
|
||||
@@ -561,36 +606,33 @@ 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;
|
||||
diff --git a/src/wallet/api/wallet_manager.cpp b/src/wallet/api/wallet_manager.cpp
|
||||
index e81b8f83a..277be6ac9 100644
|
||||
--- a/src/wallet/api/wallet_manager.cpp
|
||||
@@ -615,5 +657,5 @@ index e81b8f83a..277be6ac9 100644
|
||||
|
||||
std::vector<std::string> WalletManagerImpl::findWallets(const std::string &path)
|
||||
--
|
||||
2.48.0
|
||||
2.49.0
|
||||
|
||||
@@ -1,45 +1,35 @@
|
||||
From d146c6c1e23e1bf3762449e72a3aab847b3c0412 Mon Sep 17 00:00:00 2001
|
||||
From c54ab3f0984159bd47c63b78074caaaac082727a Mon Sep 17 00:00:00 2001
|
||||
From: tobtoht <tob@featherwallet.org>
|
||||
Date: Tue, 12 Mar 2024 09:42:37 +0100
|
||||
Subject: [PATCH 09/15] polyseed
|
||||
Subject: [PATCH 07/14] polyseed
|
||||
|
||||
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
---
|
||||
.gitmodules | 6 +
|
||||
CMakeLists.txt | 4 +-
|
||||
contrib/depends/hosts/darwin.mk | 2 +
|
||||
contrib/depends/hosts/linux.mk | 8 +-
|
||||
contrib/depends/packages/packages.mk | 2 +-
|
||||
contrib/depends/packages/polyseed.mk | 28 +++
|
||||
contrib/depends/packages/sodium.mk | 2 +-
|
||||
.../polyseed/0001-disable-soname.patch | 48 +++++
|
||||
.../patches/polyseed/force-static-mingw.patch | 23 +++
|
||||
contrib/epee/include/wipeable_string.h | 7 +
|
||||
contrib/epee/src/wipeable_string.cpp | 10 +
|
||||
external/CMakeLists.txt | 2 +
|
||||
external/polyseed | 1 +
|
||||
external/utf8proc | 1 +
|
||||
src/CMakeLists.txt | 1 +
|
||||
src/cryptonote_basic/CMakeLists.txt | 1 +
|
||||
src/cryptonote_basic/account.cpp | 23 ++-
|
||||
src/cryptonote_basic/account.h | 6 +
|
||||
src/cryptonote_config.h | 2 +
|
||||
src/polyseed/CMakeLists.txt | 25 +++
|
||||
src/polyseed/pbkdf2.c | 85 ++++++++
|
||||
src/polyseed/pbkdf2.h | 46 +++++
|
||||
src/polyseed/polyseed.cpp | 182 ++++++++++++++++++
|
||||
src/polyseed/polyseed.hpp | 167 ++++++++++++++++
|
||||
src/wallet/api/wallet.cpp | 70 +++++++
|
||||
src/wallet/api/wallet.h | 10 +
|
||||
src/wallet/api/wallet2_api.h | 25 +++
|
||||
src/wallet/api/wallet_manager.cpp | 9 +
|
||||
src/wallet/api/wallet_manager.h | 10 +
|
||||
src/wallet/wallet2.cpp | 99 ++++++++--
|
||||
src/wallet/wallet2.h | 30 ++-
|
||||
31 files changed, 912 insertions(+), 23 deletions(-)
|
||||
create mode 100644 contrib/depends/packages/polyseed.mk
|
||||
create mode 100644 contrib/depends/patches/polyseed/0001-disable-soname.patch
|
||||
create mode 100644 contrib/depends/patches/polyseed/force-static-mingw.patch
|
||||
.gitmodules | 6 +
|
||||
CMakeLists.txt | 4 +-
|
||||
contrib/epee/include/wipeable_string.h | 7 +
|
||||
contrib/epee/src/wipeable_string.cpp | 10 ++
|
||||
external/CMakeLists.txt | 2 +
|
||||
external/polyseed | 1 +
|
||||
external/utf8proc | 1 +
|
||||
src/CMakeLists.txt | 1 +
|
||||
src/cryptonote_basic/CMakeLists.txt | 1 +
|
||||
src/cryptonote_basic/account.cpp | 23 +++-
|
||||
src/cryptonote_basic/account.h | 6 +
|
||||
src/cryptonote_config.h | 2 +
|
||||
src/polyseed/CMakeLists.txt | 25 ++++
|
||||
src/polyseed/pbkdf2.c | 85 ++++++++++++
|
||||
src/polyseed/pbkdf2.h | 46 +++++++
|
||||
src/polyseed/polyseed.cpp | 182 +++++++++++++++++++++++++
|
||||
src/polyseed/polyseed.hpp | 167 +++++++++++++++++++++++
|
||||
src/wallet/api/wallet.cpp | 70 ++++++++++
|
||||
src/wallet/api/wallet.h | 10 ++
|
||||
src/wallet/api/wallet2_api.h | 25 ++++
|
||||
src/wallet/api/wallet_manager.cpp | 9 ++
|
||||
src/wallet/api/wallet_manager.h | 10 ++
|
||||
src/wallet/wallet2.cpp | 100 ++++++++++++--
|
||||
src/wallet/wallet2.h | 30 +++-
|
||||
24 files changed, 805 insertions(+), 18 deletions(-)
|
||||
create mode 160000 external/polyseed
|
||||
create mode 160000 external/utf8proc
|
||||
create mode 100644 src/polyseed/CMakeLists.txt
|
||||
@@ -49,219 +39,44 @@ Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
create mode 100644 src/polyseed/polyseed.hpp
|
||||
|
||||
diff --git a/.gitmodules b/.gitmodules
|
||||
index b24855d9b..589676649 100644
|
||||
index 72af74d55..b838e84e0 100644
|
||||
--- a/.gitmodules
|
||||
+++ b/.gitmodules
|
||||
@@ -20,3 +20,9 @@
|
||||
path = external/bc-ur
|
||||
url = https://github.com/MrCyjaneK/bc-ur
|
||||
branch = misc
|
||||
@@ -11,6 +11,12 @@
|
||||
path = external/randomx
|
||||
url = https://github.com/MrCyjaneK/RandomX
|
||||
branch = cyjan-fix-ios
|
||||
+[submodule "external/utf8proc"]
|
||||
+ path = external/utf8proc
|
||||
+ url = https://github.com/JuliaStrings/utf8proc.git
|
||||
+[submodule "external/polyseed"]
|
||||
+ path = external/polyseed
|
||||
+ url = https://github.com/tevador/polyseed.git
|
||||
\ No newline at end of file
|
||||
[submodule "external/supercop"]
|
||||
path = external/supercop
|
||||
url = https://github.com/monero-project/supercop
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 86000f811..96056e324 100644
|
||||
index 5c0f31cb8..f0630ef9b 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -372,6 +372,8 @@ if(NOT MANUAL_SUBMODULES)
|
||||
#check_submodule(external/trezor-common)
|
||||
check_submodule(external/randomwow)
|
||||
check_submodule(external/randomx)
|
||||
check_submodule(external/supercop)
|
||||
check_submodule(external/mx25519)
|
||||
+ check_submodule(external/polyseed)
|
||||
+ check_submodule(external/utf8proc)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -461,7 +463,7 @@ endif()
|
||||
# elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
|
||||
# set(BSDI TRUE)
|
||||
@@ -460,7 +462,7 @@ endif()
|
||||
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)
|
||||
diff --git a/contrib/depends/hosts/darwin.mk b/contrib/depends/hosts/darwin.mk
|
||||
index 83d83036b..b14ee5c5b 100644
|
||||
--- a/contrib/depends/hosts/darwin.mk
|
||||
+++ b/contrib/depends/hosts/darwin.mk
|
||||
@@ -8,6 +8,8 @@ endif
|
||||
darwin_CC=clang -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -mlinker-version=$(LD64_VERSION) -B$(host_prefix)/native/bin/$(host)-
|
||||
darwin_CXX=clang++ -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -mlinker-version=$(LD64_VERSION) -stdlib=libc++ -B$(host_prefix)/native/bin/$(host)-
|
||||
|
||||
+darwin_RANLIB=$(host_prefix)/native/bin/$(host)-ranlib
|
||||
+
|
||||
darwin_CFLAGS=-pipe
|
||||
darwin_CXXFLAGS=$(darwin_CFLAGS)
|
||||
darwin_ARFLAGS=cr
|
||||
diff --git a/contrib/depends/hosts/linux.mk b/contrib/depends/hosts/linux.mk
|
||||
index 912fdb03c..b79799f30 100644
|
||||
--- a/contrib/depends/hosts/linux.mk
|
||||
+++ b/contrib/depends/hosts/linux.mk
|
||||
@@ -11,15 +11,15 @@ linux_debug_CXXFLAGS=$(linux_debug_CFLAGS)
|
||||
linux_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC
|
||||
|
||||
ifeq (86,$(findstring 86,$(build_arch)))
|
||||
-i686_linux_CC=gcc -m32
|
||||
-i686_linux_CXX=g++ -m32
|
||||
+i686_linux_CC=i686-linux-gnu-gcc
|
||||
+i686_linux_CXX=i686-linux-gnu-g++
|
||||
i686_linux_AR=ar
|
||||
i686_linux_RANLIB=ranlib
|
||||
i686_linux_NM=nm
|
||||
i686_linux_STRIP=strip
|
||||
|
||||
-x86_64_linux_CC=gcc -m64
|
||||
-x86_64_linux_CXX=g++ -m64
|
||||
+x86_64_linux_CC=x86_64-linux-gnu-gcc
|
||||
+x86_64_linux_CXX=x86_64-linux-gnu-g++
|
||||
x86_64_linux_AR=ar
|
||||
x86_64_linux_RANLIB=ranlib
|
||||
x86_64_linux_NM=nm
|
||||
diff --git a/contrib/depends/packages/packages.mk b/contrib/depends/packages/packages.mk
|
||||
index d2d1eca85..8783d4955 100644
|
||||
--- a/contrib/depends/packages/packages.mk
|
||||
+++ b/contrib/depends/packages/packages.mk
|
||||
@@ -1,4 +1,4 @@
|
||||
-packages:=boost openssl zeromq libiconv expat unbound
|
||||
+packages:=boost openssl zeromq libiconv expat unbound polyseed
|
||||
|
||||
# ccache is useless in gitian builds
|
||||
ifneq ($(GITIAN),1)
|
||||
diff --git a/contrib/depends/packages/polyseed.mk b/contrib/depends/packages/polyseed.mk
|
||||
new file mode 100644
|
||||
index 000000000..0071b20f3
|
||||
--- /dev/null
|
||||
+++ b/contrib/depends/packages/polyseed.mk
|
||||
@@ -0,0 +1,28 @@
|
||||
+package=polyseed
|
||||
+$(package)_version=2.0.0
|
||||
+$(package)_download_path=https://github.com/tevador/$(package)/archive/refs/tags/
|
||||
+$(package)_download_file=v$($(package)_version).tar.gz
|
||||
+$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||
+$(package)_sha256_hash=f36282fcbcd68d32461b8230c89e1a40661bd46b91109681cec637433004135a
|
||||
+$(package)_patches=force-static-mingw.patch 0001-disable-soname.patch
|
||||
+
|
||||
+define $(package)_preprocess_cmds
|
||||
+ patch -p1 < $($(package)_patch_dir)/force-static-mingw.patch &&\
|
||||
+ patch -p1 < $($(package)_patch_dir)/0001-disable-soname.patch
|
||||
+endef
|
||||
+
|
||||
+define $(package)_config_cmds
|
||||
+ CC="$($(package)_cc)" cmake -DCMAKE_INSTALL_PREFIX="$(host_prefix)" .
|
||||
+endef
|
||||
+
|
||||
+define $(package)_set_vars
|
||||
+ $(package)_build_opts=CC="$($(package)_cc)"
|
||||
+endef
|
||||
+
|
||||
+define $(package)_build_cmds
|
||||
+ CC="$($(package)_cc)" $(MAKE)
|
||||
+endef
|
||||
+
|
||||
+define $(package)_stage_cmds
|
||||
+ $(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
+endef
|
||||
diff --git a/contrib/depends/packages/sodium.mk b/contrib/depends/packages/sodium.mk
|
||||
index 87b34599e..68a5b48ba 100644
|
||||
--- a/contrib/depends/packages/sodium.mk
|
||||
+++ b/contrib/depends/packages/sodium.mk
|
||||
@@ -6,7 +6,7 @@ $(package)_sha256_hash=6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e
|
||||
$(package)_patches=disable-glibc-getrandom-getentropy.patch fix-whitespace.patch
|
||||
|
||||
define $(package)_set_vars
|
||||
-$(package)_config_opts=--enable-static --disable-shared
|
||||
+$(package)_config_opts=--enable-static --disable-shared --with-pic
|
||||
$(package)_config_opts+=--prefix=$(host_prefix)
|
||||
endef
|
||||
|
||||
diff --git a/contrib/depends/patches/polyseed/0001-disable-soname.patch b/contrib/depends/patches/polyseed/0001-disable-soname.patch
|
||||
new file mode 100644
|
||||
index 000000000..bd97dd394
|
||||
--- /dev/null
|
||||
+++ b/contrib/depends/patches/polyseed/0001-disable-soname.patch
|
||||
@@ -0,0 +1,48 @@
|
||||
+From aabafcfc0572651436d024a635483c49042fad7f Mon Sep 17 00:00:00 2001
|
||||
+From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
+Date: Thu, 28 Mar 2024 00:32:51 +0100
|
||||
+Subject: [PATCH] disable soname
|
||||
+
|
||||
+---
|
||||
+ CMakeLists.txt | 16 +++++++++-------
|
||||
+ 1 file changed, 9 insertions(+), 7 deletions(-)
|
||||
+
|
||||
+diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
+index 8a8e7c2..5301353 100644
|
||||
+--- a/CMakeLists.txt
|
||||
++++ b/CMakeLists.txt
|
||||
+@@ -36,6 +36,7 @@ include_directories(polyseed
|
||||
+ target_compile_definitions(polyseed PRIVATE POLYSEED_SHARED)
|
||||
+ set_target_properties(polyseed PROPERTIES VERSION 2.0.0
|
||||
+ SOVERSION 2
|
||||
++ NO_SONAME 1
|
||||
+ C_STANDARD 11
|
||||
+ C_STANDARD_REQUIRED ON)
|
||||
+
|
||||
+@@ -45,16 +46,17 @@ include_directories(polyseed_static
|
||||
+ include/)
|
||||
+ target_compile_definitions(polyseed_static PRIVATE POLYSEED_STATIC)
|
||||
+ set_target_properties(polyseed_static PROPERTIES OUTPUT_NAME polyseed
|
||||
++ NO_SONAME 1
|
||||
+ C_STANDARD 11
|
||||
+ C_STANDARD_REQUIRED ON)
|
||||
+
|
||||
+-add_executable(polyseed-tests
|
||||
+- tests/tests.c)
|
||||
+-include_directories(polyseed-tests
|
||||
+- include/)
|
||||
+-target_compile_definitions(polyseed-tests PRIVATE POLYSEED_STATIC)
|
||||
+-target_link_libraries(polyseed-tests
|
||||
+- PRIVATE polyseed_static)
|
||||
++# add_executable(polyseed-tests
|
||||
++# tests/tests.c)
|
||||
++# include_directories(polyseed-tests
|
||||
++# include/)
|
||||
++# target_compile_definitions(polyseed-tests PRIVATE POLYSEED_STATIC)
|
||||
++# target_link_libraries(polyseed-tests
|
||||
++# PRIVATE polyseed_static)
|
||||
+
|
||||
+ include(GNUInstallDirs)
|
||||
+ install(TARGETS polyseed polyseed_static
|
||||
+--
|
||||
+2.39.2
|
||||
diff --git a/contrib/depends/patches/polyseed/force-static-mingw.patch b/contrib/depends/patches/polyseed/force-static-mingw.patch
|
||||
new file mode 100644
|
||||
index 000000000..f05cb2b6a
|
||||
--- /dev/null
|
||||
+++ b/contrib/depends/patches/polyseed/force-static-mingw.patch
|
||||
@@ -0,0 +1,23 @@
|
||||
+--- a/include/polyseed.h
|
||||
++++ b/include/polyseed.h
|
||||
+@@ -93,13 +93,13 @@ Shared/static library definitions
|
||||
+ - define POLYSEED_STATIC when linking to the static library
|
||||
+ */
|
||||
+ #if defined(_WIN32) || defined(__CYGWIN__)
|
||||
+- #ifdef POLYSEED_SHARED
|
||||
+- #define POLYSEED_API __declspec(dllexport)
|
||||
+- #elif !defined(POLYSEED_STATIC)
|
||||
+- #define POLYSEED_API __declspec(dllimport)
|
||||
+- #else
|
||||
+- #define POLYSEED_API
|
||||
+- #endif
|
||||
++// #ifdef POLYSEED_SHARED
|
||||
++// #define POLYSEED_API __declspec(dllexport)
|
||||
++// #elif !defined(POLYSEED_STATIC)
|
||||
++// #define POLYSEED_API __declspec(dllimport)
|
||||
++// #else
|
||||
++ #define POLYSEED_API
|
||||
++// #endif
|
||||
+ #define POLYSEED_PRIVATE
|
||||
+ #else
|
||||
+ #ifdef POLYSEED_SHARED
|
||||
diff --git a/contrib/epee/include/wipeable_string.h b/contrib/epee/include/wipeable_string.h
|
||||
index 65977cd97..594e15de4 100644
|
||||
--- a/contrib/epee/include/wipeable_string.h
|
||||
@@ -307,16 +122,17 @@ index b016f2f48..f2f365b1b 100644
|
||||
+
|
||||
}
|
||||
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
|
||||
index dfdffe67c..fa98f61b5 100644
|
||||
index 074e23f16..f7e35f98f 100644
|
||||
--- a/external/CMakeLists.txt
|
||||
+++ b/external/CMakeLists.txt
|
||||
@@ -70,4 +70,6 @@ add_subdirectory(db_drivers)
|
||||
@@ -70,5 +70,7 @@ endif()
|
||||
add_subdirectory(db_drivers)
|
||||
add_subdirectory(easylogging++)
|
||||
add_subdirectory(qrcodegen)
|
||||
add_subdirectory(bc-ur)
|
||||
+add_subdirectory(polyseed EXCLUDE_FROM_ALL)
|
||||
+add_subdirectory(utf8proc EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(randomwow EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(bc-ur)
|
||||
add_subdirectory(randomx EXCLUDE_FROM_ALL)
|
||||
diff --git a/external/polyseed b/external/polyseed
|
||||
new file mode 160000
|
||||
index 000000000..bd79f5014
|
||||
@@ -332,7 +148,7 @@ index 000000000..3de4596fb
|
||||
@@ -0,0 +1 @@
|
||||
+Subproject commit 3de4596fbe28956855df2ecb3c11c0bbc3535838
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 9216bcaa5..c043ba150 100644
|
||||
index 3335d3c21..06b708cf0 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -95,6 +95,7 @@ add_subdirectory(net)
|
||||
@@ -341,8 +157,8 @@ index 9216bcaa5..c043ba150 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
|
||||
@@ -352,14 +168,14 @@ index 1414be1b2..414936a05 100644
|
||||
cryptonote_format_utils_basic
|
||||
device
|
||||
+ polyseed_wrapper
|
||||
oracle
|
||||
${Boost_DATE_TIME_LIBRARY}
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
${Boost_SERIALIZATION_LIBRARY}
|
||||
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
|
||||
@@ -377,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);
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
@@ -418,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)
|
||||
@@ -438,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);
|
||||
@@ -447,18 +263,18 @@ index 93d1d28f0..1f76febce 100644
|
||||
const account_keys& get_keys() const;
|
||||
std::string get_public_address_str(network_type nettype) const;
|
||||
diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h
|
||||
index 8b5091a46..d9151e8d2 100644
|
||||
index 82891b9de..26200bf34 100644
|
||||
--- a/src/cryptonote_config.h
|
||||
+++ b/src/cryptonote_config.h
|
||||
@@ -219,6 +219,8 @@
|
||||
@@ -265,6 +265,8 @@
|
||||
|
||||
#define DNS_BLOCKLIST_LIFETIME (86400 * 8)
|
||||
|
||||
+#define POLYSEED_COIN POLYSEED_WOWNERO
|
||||
+#define POLYSEED_COIN POLYSEED_MONERO
|
||||
+
|
||||
//The limit is enough for the mandatory transaction content with 16 outputs (547 bytes),
|
||||
//a custom tag (1 byte) and up to 32 bytes of custom data for each recipient.
|
||||
// (1+32) + (1+1+16*32) + (1+16*32) = 1060
|
||||
#define PRICING_RECORD_VALID_BLOCKS 10
|
||||
#define PRICING_RECORD_VALID_TIME_DIFF_FROM_BLOCK 120 // seconds
|
||||
|
||||
diff --git a/src/polyseed/CMakeLists.txt b/src/polyseed/CMakeLists.txt
|
||||
new file mode 100644
|
||||
index 000000000..cca4eb746
|
||||
@@ -998,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 556e2a8ce..704e5e148 100644
|
||||
index 25ade04a7..51911bf99 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
|
||||
@@ -1194,7 +1010,7 @@ index a223e1df9..28fcd36c9 100644
|
||||
bool walletExists(const std::string &path) override;
|
||||
bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key, uint64_t kdf_rounds = 1) const override;
|
||||
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
|
||||
index e14d4d2fc..fd4094360 100644
|
||||
index 765cefb32..806de969a 100644
|
||||
--- a/src/wallet/wallet2.cpp
|
||||
+++ b/src/wallet/wallet2.cpp
|
||||
@@ -92,6 +92,7 @@ using namespace epee;
|
||||
@@ -1202,15 +1018,15 @@ index e14d4d2fc..fd4094360 100644
|
||||
#include "device_trezor/device_trezor.hpp"
|
||||
#include "net/socks_connect.h"
|
||||
+#include "polyseed/include/polyseed.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@@ -1278,7 +1279,8 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended, std
|
||||
m_enable_multisig(false),
|
||||
#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),
|
||||
m_has_ever_refreshed_from_node(false),
|
||||
- m_allow_mismatched_daemon_version(true)
|
||||
+ m_allow_mismatched_daemon_version(true),
|
||||
- m_allow_mismatched_daemon_version(false)
|
||||
+ m_allow_mismatched_daemon_version(false),
|
||||
+ m_polyseed(false)
|
||||
{
|
||||
set_rpc_client_secret_key(rct::rct2sk(rct::skGen()));
|
||||
@@ -1235,26 +1051,26 @@ index e14d4d2fc..fd4094360 100644
|
||||
+//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::get_multisig_seed(epee::wipeable_string& seed, const epee::wipeable_string &passphrase) const
|
||||
{
|
||||
bool ready;
|
||||
@@ -4801,6 +4817,9 @@ boost::optional<wallet2::keys_file_data> wallet2::get_keys_file_data(const crypt
|
||||
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());
|
||||
|
||||
+ value2.SetInt(m_polyseed ? 1 : 0);
|
||||
+ json.AddMember("polyseed", value2, json.GetAllocator());
|
||||
+
|
||||
if (m_background_sync_type == BackgroundSyncCustomPassword && !background_keys_file && m_custom_background_key)
|
||||
{
|
||||
value.SetString(reinterpret_cast<const char*>(m_custom_background_key.get().data()), m_custom_background_key.get().size());
|
||||
@@ -5040,6 +5059,7 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st
|
||||
m_enable_multisig = false;
|
||||
m_allow_mismatched_daemon_version = true;
|
||||
value2.SetInt(m_freeze_incoming_payments ? 1 : 0);
|
||||
json.AddMember("freeze_incoming_payments", value2, json.GetAllocator());
|
||||
|
||||
@@ -5560,6 +5579,7 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st
|
||||
m_send_change_back_to_subaddress = false;
|
||||
m_allow_mismatched_daemon_version = false;
|
||||
m_custom_background_key = boost::none;
|
||||
+ m_polyseed = false;
|
||||
}
|
||||
else if(json.IsObject())
|
||||
{
|
||||
@@ -5280,6 +5300,9 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st
|
||||
@@ -5804,6 +5824,9 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st
|
||||
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, background_sync_type, BackgroundSyncType, Int, false, BackgroundSyncOff);
|
||||
m_background_sync_type = field_background_sync_type;
|
||||
|
||||
@@ -1264,7 +1080,7 @@ index e14d4d2fc..fd4094360 100644
|
||||
// Load encryption key used to encrypt background cache
|
||||
crypto::chacha_key custom_background_key;
|
||||
m_custom_background_key = boost::none;
|
||||
@@ -5599,6 +5622,48 @@ void wallet2::init_type(hw::device::device_type device_type)
|
||||
@@ -6123,6 +6146,48 @@ void wallet2::init_type(hw::device::device_type device_type)
|
||||
m_key_device_type = device_type;
|
||||
}
|
||||
|
||||
@@ -1313,7 +1129,7 @@ index e14d4d2fc..fd4094360 100644
|
||||
/*!
|
||||
* \brief Generates a wallet or restores one. Assumes the multisig setup
|
||||
* has already completed for the provided multisig info.
|
||||
@@ -5726,7 +5791,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip
|
||||
@@ -6250,7 +6315,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -1322,7 +1138,7 @@ index e14d4d2fc..fd4094360 100644
|
||||
{
|
||||
// -1 month for fluctuations in block time and machine date/time setup.
|
||||
// avg seconds per block
|
||||
@@ -5750,7 +5815,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip
|
||||
@@ -6274,7 +6339,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip
|
||||
// the daemon is currently syncing.
|
||||
// If we use the approximate height we subtract one month as
|
||||
// a safety margin.
|
||||
@@ -1331,19 +1147,25 @@ index e14d4d2fc..fd4094360 100644
|
||||
uint64_t target_height = get_daemon_blockchain_target_height(err);
|
||||
if (err.empty()) {
|
||||
if (target_height < height)
|
||||
@@ -13643,9 +13708,10 @@ uint64_t wallet2::get_daemon_blockchain_target_height(string &err)
|
||||
@@ -13926,7 +13991,7 @@ uint64_t wallet2::get_daemon_blockchain_target_height(string &err)
|
||||
return target_height;
|
||||
}
|
||||
|
||||
-uint64_t wallet2::get_approximate_blockchain_height() const
|
||||
+uint64_t wallet2::get_approximate_blockchain_height(uint64_t t) const
|
||||
{
|
||||
uint64_t approx_blockchain_height = m_nettype == TESTNET ? 0 : (time(NULL) - 1522624244)/307;
|
||||
+ // uint64_t approx_blockchain_height = fork_block + ((t > 0 ? t : time(NULL)) - fork_time)/seconds_per_block;
|
||||
if (m_nettype != MAINNET) return 0;
|
||||
|
||||
@@ -13937,7 +14002,7 @@ uint64_t wallet2::get_approximate_blockchain_height() const
|
||||
// avg seconds per block
|
||||
const int seconds_per_block = DIFFICULTY_TARGET_V2;
|
||||
// Calculated blockchain height
|
||||
- uint64_t approx_blockchain_height = fork_block + (time(NULL) - fork_time)/seconds_per_block;
|
||||
+ uint64_t approx_blockchain_height = fork_block + ((t > 0 ? t : time(NULL)) - fork_time)/seconds_per_block;
|
||||
LOG_PRINT_L2("Calculated blockchain height: " << approx_blockchain_height);
|
||||
return approx_blockchain_height;
|
||||
}
|
||||
@@ -15780,15 +15846,6 @@ bool wallet2::parse_uri(const std::string &uri, std::string &address, std::strin
|
||||
@@ -16112,15 +16177,6 @@ bool wallet2::parse_uri(const std::string &uri, std::string &address, std::strin
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
uint64_t wallet2::get_blockchain_height_by_date(uint16_t year, uint8_t month, uint8_t day)
|
||||
{
|
||||
@@ -1359,7 +1181,7 @@ index e14d4d2fc..fd4094360 100644
|
||||
std::tm date = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
date.tm_year = year - 1900;
|
||||
date.tm_mon = month - 1;
|
||||
@@ -15797,7 +15854,23 @@ uint64_t wallet2::get_blockchain_height_by_date(uint16_t year, uint8_t month, ui
|
||||
@@ -16129,7 +16185,23 @@ uint64_t wallet2::get_blockchain_height_by_date(uint16_t year, uint8_t month, ui
|
||||
{
|
||||
throw std::runtime_error("month or day out of range");
|
||||
}
|
||||
@@ -1384,7 +1206,7 @@ index e14d4d2fc..fd4094360 100644
|
||||
uint64_t height_min = 0;
|
||||
uint64_t height_max = get_daemon_blockchain_height(err) - 1;
|
||||
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
|
||||
index 746e2aeff..c165acb9d 100644
|
||||
index a752f15b9..a619bdd15 100644
|
||||
--- a/src/wallet/wallet2.h
|
||||
+++ b/src/wallet/wallet2.h
|
||||
@@ -72,6 +72,7 @@
|
||||
@@ -1416,7 +1238,7 @@ index 746e2aeff..c165acb9d 100644
|
||||
/*!
|
||||
* \brief Generates a wallet or restores one.
|
||||
* \param wallet_ Name of wallet file
|
||||
@@ -1095,6 +1110,15 @@ private:
|
||||
@@ -1126,6 +1141,15 @@ private:
|
||||
bool is_deterministic() const;
|
||||
bool get_seed(epee::wipeable_string& electrum_words, const epee::wipeable_string &passphrase = epee::wipeable_string()) const;
|
||||
|
||||
@@ -1430,8 +1252,8 @@ index 746e2aeff..c165acb9d 100644
|
||||
+ bool get_polyseed(epee::wipeable_string& seed, epee::wipeable_string &passphrase) const;
|
||||
+
|
||||
/*!
|
||||
* \brief Checks if light wallet. A light wallet sends view key to a server where the blockchain is scanned.
|
||||
*/
|
||||
* \brief Gets the seed language
|
||||
*/
|
||||
@@ -1562,8 +1586,8 @@ private:
|
||||
/*!
|
||||
* \brief Calculates the approximate blockchain height from current date/time.
|
||||
@@ -1460,5 +1282,5 @@ index 746e2aeff..c165acb9d 100644
|
||||
uint32_t m_multisig_threshold;
|
||||
std::vector<crypto::public_key> m_multisig_signers;
|
||||
--
|
||||
2.48.0
|
||||
2.48.1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From edc33fa98da3bc9e8e746a59f5e62b9001afb230 Mon Sep 17 00:00:00 2001
|
||||
From 753d7eee48d8e9ab5950e48dc984cc1038c11dd1 Mon Sep 17 00:00:00 2001
|
||||
From: tobtoht <tob@featherwallet.org>
|
||||
Date: Tue, 12 Mar 2024 11:07:57 +0100
|
||||
Subject: [PATCH 10/15] coin control
|
||||
Subject: [PATCH 08/14] coin control
|
||||
|
||||
---
|
||||
src/simplewallet/simplewallet.cpp | 2 +-
|
||||
@@ -10,30 +10,52 @@ Subject: [PATCH 10/15] coin control
|
||||
src/wallet/api/coins.h | 40 +++++++
|
||||
src/wallet/api/coins_info.cpp | 122 ++++++++++++++++++++
|
||||
src/wallet/api/coins_info.h | 71 ++++++++++++
|
||||
src/wallet/api/wallet.cpp | 64 +++++++++-
|
||||
src/wallet/api/wallet.cpp | 170 +++++++++++++++++++++------
|
||||
src/wallet/api/wallet.h | 10 +-
|
||||
src/wallet/api/wallet2_api.h | 52 ++++++++-
|
||||
src/wallet/wallet2.cpp | 46 +++++++-
|
||||
src/wallet/wallet2.h | 11 +-
|
||||
11 files changed, 593 insertions(+), 19 deletions(-)
|
||||
11 files changed, 667 insertions(+), 51 deletions(-)
|
||||
create mode 100644 src/wallet/api/coins.cpp
|
||||
create mode 100644 src/wallet/api/coins.h
|
||||
create mode 100644 src/wallet/api/coins_info.cpp
|
||||
create mode 100644 src/wallet/api/coins_info.h
|
||||
|
||||
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
|
||||
index 83b56c3f4..12c38b8e1 100644
|
||||
index 89691e9f7..b26817e52 100644
|
||||
--- a/src/simplewallet/simplewallet.cpp
|
||||
+++ b/src/simplewallet/simplewallet.cpp
|
||||
@@ -6981,7 +6981,7 @@ bool simple_wallet::transfer_main(const std::vector<std::string> &args_, bool ca
|
||||
{
|
||||
// figure out what tx will be necessary
|
||||
auto ptx_vector = m_wallet->create_transactions_2(dsts, fake_outs_count, priority, extra,
|
||||
- m_current_subaddress_account, subaddr_indices, subtract_fee_from_outputs);
|
||||
+ m_current_subaddress_account, subaddr_indices, {}, subtract_fee_from_outputs);
|
||||
|
||||
if (ptx_vector.empty())
|
||||
{
|
||||
@@ -7183,25 +7183,25 @@ bool simple_wallet::transfer_main(
|
||||
switch (transfer_type) {
|
||||
case Burn:
|
||||
unlock_block = 0;
|
||||
- ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::BURN, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, subtract_fee_from_outputs);
|
||||
+ ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::BURN, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, {}, subtract_fee_from_outputs);
|
||||
break;
|
||||
case Convert:
|
||||
unlock_block = CONVERT_LOCK_PERIOD;
|
||||
- ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::CONVERT, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, subtract_fee_from_outputs);
|
||||
+ ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::CONVERT, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, {}, subtract_fee_from_outputs);
|
||||
break;
|
||||
case Stake:
|
||||
unlock_block = get_config(m_wallet->nettype()).STAKE_LOCK_PERIOD;
|
||||
- ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::STAKE, fake_outs_count, unlock_block, priority, extra, m_current_subaddress_account, subaddr_indices, subtract_fee_from_outputs);
|
||||
+ ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::STAKE, fake_outs_count, unlock_block, priority, extra, m_current_subaddress_account, subaddr_indices, {}, subtract_fee_from_outputs);
|
||||
break;
|
||||
case TransferLocked:
|
||||
unlock_block = locked_blocks;
|
||||
- ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::TRANSFER, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, subtract_fee_from_outputs);
|
||||
+ ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::TRANSFER, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, {}, subtract_fee_from_outputs);
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("Unknown transfer method, using default");
|
||||
/* FALLTHRU */
|
||||
case Transfer:
|
||||
- ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::TRANSFER, fake_outs_count, 0 /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, subtract_fee_from_outputs);
|
||||
+ ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::TRANSFER, fake_outs_count, 0 /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, {}, subtract_fee_from_outputs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
diff --git a/src/wallet/api/CMakeLists.txt b/src/wallet/api/CMakeLists.txt
|
||||
index af7948d8a..bb740e2ac 100644
|
||||
--- a/src/wallet/api/CMakeLists.txt
|
||||
@@ -65,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"
|
||||
@@ -131,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);
|
||||
@@ -145,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;
|
||||
@@ -153,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);
|
||||
+ }
|
||||
@@ -303,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;
|
||||
@@ -327,6 +357,7 @@ index 000000000..5f2c4e1e4
|
||||
+ , m_subaddrIndex(0)
|
||||
+ , m_unlockTime(0)
|
||||
+ , m_unlocked(false)
|
||||
+ , m_type(0)
|
||||
+{
|
||||
+
|
||||
+}
|
||||
@@ -423,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;
|
||||
@@ -431,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
|
||||
+
|
||||
@@ -470,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;
|
||||
@@ -493,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;
|
||||
+
|
||||
+};
|
||||
@@ -504,10 +548,10 @@ index 000000000..c43e45abd
|
||||
+
|
||||
+#endif //FEATHER_COINS_INFO_H
|
||||
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
|
||||
index 704e5e148..e69910e69 100644
|
||||
index 4b0a26a6b..644cf503b 100644
|
||||
--- a/src/wallet/api/wallet.cpp
|
||||
+++ b/src/wallet/api/wallet.cpp
|
||||
@@ -35,6 +35,7 @@
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "transaction_history.h"
|
||||
#include "address_book.h"
|
||||
#include "subaddress.h"
|
||||
@@ -515,7 +559,7 @@ index 704e5e148..e69910e69 100644
|
||||
#include "subaddress_account.h"
|
||||
#include "common_defines.h"
|
||||
#include "common/util.h"
|
||||
@@ -473,6 +474,7 @@ WalletImpl::WalletImpl(NetworkType nettype, uint64_t kdf_rounds)
|
||||
@@ -444,6 +445,7 @@ WalletImpl::WalletImpl(NetworkType nettype, uint64_t kdf_rounds)
|
||||
m_wallet->set_refresh_enabled(false);
|
||||
m_addressBook.reset(new AddressBookImpl(this));
|
||||
m_subaddress.reset(new SubaddressImpl(this));
|
||||
@@ -523,111 +567,241 @@ index 704e5e148..e69910e69 100644
|
||||
m_subaddressAccount.reset(new SubaddressAccountImpl(this));
|
||||
|
||||
|
||||
@@ -2046,7 +2048,7 @@ PendingTransaction* WalletImpl::restoreMultisigTransaction(const string& signDat
|
||||
@@ -2018,7 +2020,7 @@ PendingTransaction *WalletImpl::createAuditTransaction(
|
||||
// - unconfirmed_transfer_details;
|
||||
// - confirmed_transfer_details)
|
||||
|
||||
-PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<string> &dst_addr, const string &payment_id, optional<std::vector<uint64_t>> amount, uint32_t mixin_count, PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices)
|
||||
+PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<string> &dst_addr, const string &payment_id, optional<std::vector<uint64_t>> amount, uint32_t mixin_count, PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const std::set<std::string> &preferred_inputs)
|
||||
-PendingTransaction *WalletImpl::createTransactionMultDest(const Monero::transaction_type &tx_type, const std::vector<string> &dst_addr, const string &payment_id, optional<std::vector<uint64_t>> amount, uint32_t mixin_count, const std::string &asset_type, const bool is_return, PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices)
|
||||
+PendingTransaction *WalletImpl::createTransactionMultDest(const Monero::transaction_type &tx_type, const std::vector<string> &dst_addr, const string &payment_id, optional<std::vector<uint64_t>> amount, uint32_t mixin_count, const std::string &asset_type, const bool is_return, PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const std::set<std::string> &preferred_inputs)
|
||||
|
||||
{
|
||||
clearStatus();
|
||||
@@ -2084,6 +2086,7 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
|
||||
@@ -2057,55 +2059,114 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const Monero::transact
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool error = false;
|
||||
+ uint64_t amountSum = 0;
|
||||
for (size_t i = 0; i < dst_addr.size() && !error; i++) {
|
||||
if(!cryptonote::get_account_address_from_str(info, m_wallet->nettype(), dst_addr[i])) {
|
||||
// TODO: copy-paste 'if treating as an address fails, try as url' from simplewallet.cpp:1982
|
||||
@@ -2105,6 +2108,7 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
|
||||
de.original = dst_addr[i];
|
||||
de.addr = info.address;
|
||||
de.amount = (*amount)[i];
|
||||
+ amountSum += (*amount)[i];
|
||||
de.is_subaddress = info.is_subaddress;
|
||||
de.is_integrated = info.has_payment_id;
|
||||
dsts.push_back(de);
|
||||
@@ -2115,6 +2119,51 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
|
||||
- bool error = false;
|
||||
- for (size_t i = 0; i < dst_addr.size() && !error; i++) {
|
||||
- if(!cryptonote::get_account_address_from_str(info, m_wallet->nettype(), dst_addr[i])) {
|
||||
- // TODO: copy-paste 'if treating as an address fails, try as url' from simplewallet.cpp:1982
|
||||
- setStatusError(tr("Invalid destination address"));
|
||||
- error = true;
|
||||
- break;
|
||||
- }
|
||||
- if (info.has_payment_id) {
|
||||
- if (!extra_nonce.empty()) {
|
||||
- setStatusError(tr("a single transaction cannot use more than one payment id"));
|
||||
+ uint64_t max_coin_control_input = 0;
|
||||
+ uint64_t max_frozen_input = 0;
|
||||
+ try {
|
||||
+ bool error = false;
|
||||
+ uint64_t amountSum = 0;
|
||||
+ for (size_t i = 0; i < dst_addr.size() && !error; i++) {
|
||||
+ if(!cryptonote::get_account_address_from_str(info, m_wallet->nettype(), dst_addr[i])) {
|
||||
+ // TODO: copy-paste 'if treating as an address fails, try as url' from simplewallet.cpp:1982
|
||||
+ setStatusError(tr("Invalid destination address"));
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
- set_encrypted_payment_id_to_tx_extra_nonce(extra_nonce, info.payment_id);
|
||||
+ if (info.has_payment_id) {
|
||||
+ if (!extra_nonce.empty()) {
|
||||
+ setStatusError(tr("a single transaction cannot use more than one payment id"));
|
||||
+ error = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ set_encrypted_payment_id_to_tx_extra_nonce(extra_nonce, info.payment_id);
|
||||
+ }
|
||||
+
|
||||
+ if (amount) {
|
||||
+ cryptonote::tx_destination_entry de;
|
||||
+ de.original = dst_addr[i];
|
||||
+ de.addr = info.address;
|
||||
+ de.amount = (*amount)[i];
|
||||
+ de.asset_type = asset_type;
|
||||
+ amountSum += (*amount)[i];
|
||||
+ de.is_subaddress = info.is_subaddress;
|
||||
+ de.is_integrated = info.has_payment_id;
|
||||
+ de.is_return = is_return;
|
||||
+ dsts.push_back(de);
|
||||
+ } else {
|
||||
+ if (subaddr_indices.empty()) {
|
||||
+ for (uint32_t index = 0; index < m_wallet->get_num_subaddresses(subaddr_account); ++index)
|
||||
+ subaddr_indices.insert(index);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+ // uint64_t maxAllowedSpend = m_wallet->unlocked_balance(subaddr_account, true);
|
||||
+ // if (maxAllowedSpend < amountSum) {
|
||||
+ // error = true;
|
||||
+ // setStatusError(tr("Amount you are trying to spend is larger than unlocked amount"));
|
||||
+ // break;
|
||||
+ // }
|
||||
+ std::vector<crypto::key_image> preferred_input_list;
|
||||
+ if (!preferred_inputs.empty()) {
|
||||
+ LOG_ERROR("empty");
|
||||
|
||||
- if (amount) {
|
||||
- cryptonote::tx_destination_entry de;
|
||||
- de.original = dst_addr[i];
|
||||
- de.addr = info.address;
|
||||
- de.amount = (*amount)[i];
|
||||
- de.asset_type = asset_type;
|
||||
- de.is_subaddress = info.is_subaddress;
|
||||
- de.is_integrated = info.has_payment_id;
|
||||
- de.is_return = is_return;
|
||||
- dsts.push_back(de);
|
||||
- } else {
|
||||
- if (subaddr_indices.empty()) {
|
||||
- for (uint32_t index = 0; index < m_wallet->get_num_subaddresses(subaddr_account); ++index)
|
||||
- subaddr_indices.insert(index);
|
||||
+ // uint64_t maxAllowedSpend = m_wallet->unlocked_balance(subaddr_account, true);
|
||||
+ // if (maxAllowedSpend < amountSum) {
|
||||
+ // error = true;
|
||||
+ // setStatusError(tr("Amount you are trying to spend is larger than unlocked amount"));
|
||||
+ // break;
|
||||
+ // }
|
||||
+ std::vector<crypto::key_image> preferred_input_list;
|
||||
+ if (!preferred_inputs.empty()) {
|
||||
+ LOG_ERROR("not empty");
|
||||
+
|
||||
+ for (const auto &public_key : preferred_inputs) {
|
||||
+ crypto::key_image keyImage;
|
||||
+ bool r = epee::string_tools::hex_to_pod(public_key, keyImage);
|
||||
+ if (!r) {
|
||||
+ error = true;
|
||||
+ setStatusError(tr("failed to parse key image"));
|
||||
+ break;
|
||||
+ }
|
||||
+ if (m_wallet->frozen(keyImage)) {
|
||||
+ error = true;
|
||||
+ setStatusError(tr("refusing to spend frozen coin"));
|
||||
+ break;
|
||||
+ for (const auto &public_key : preferred_inputs) {
|
||||
+ crypto::key_image keyImage;
|
||||
+ bool r = epee::string_tools::hex_to_pod(public_key, keyImage);
|
||||
+ if (!r) {
|
||||
+ error = true;
|
||||
+ setStatusError(tr("failed to parse key image"));
|
||||
+ break;
|
||||
+ }
|
||||
+ if (m_wallet->frozen(keyImage)) {
|
||||
+ error = true;
|
||||
+ setStatusError(tr("refusing to spend frozen coin"));
|
||||
+ break;
|
||||
}
|
||||
+
|
||||
+ for (size_t i = 0; i < m_wallet->get_num_transfer_details(); ++i) {
|
||||
+ const tools::wallet2::transfer_details &td = m_wallet->get_transfer_details(i);
|
||||
+ if (td.m_key_image == keyImage) {
|
||||
+ max_coin_control_input += td.amount();
|
||||
+ }
|
||||
+ if (td.m_frozen) {
|
||||
+ max_frozen_input += td.amount();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ preferred_input_list.push_back(keyImage);
|
||||
+ }
|
||||
+ LOG_ERROR("not empty");
|
||||
+
|
||||
+ preferred_input_list.push_back(keyImage);
|
||||
+ }
|
||||
+ } else {
|
||||
+ LOG_ERROR("not empty");
|
||||
+
|
||||
+ boost::shared_lock<boost::shared_mutex> transfers_lock(m_wallet->m_transfers_mutex);
|
||||
+ for (size_t i = 0; i < m_wallet->get_num_transfer_details(); ++i) {
|
||||
+ const tools::wallet2::transfer_details &td = m_wallet->get_transfer_details(i);
|
||||
+ LOG_ERROR("COIN: " << i << ": " << td.amount() << "; "<<td.m_spent << ";" << td.m_frozen << ";" << m_wallet->frozen(td));
|
||||
+ if (td.m_spent) continue;
|
||||
+ LOG_ERROR("is frozen");
|
||||
+ if (!td.m_frozen) {
|
||||
+ LOG_ERROR("isn't:");
|
||||
+ LOG_ERROR("hash: " << td.m_key_image << "; " << td.amount());
|
||||
+ preferred_input_list.push_back(td.m_key_image);
|
||||
+ boost::shared_lock<boost::shared_mutex> transfers_lock(m_wallet->m_transfers_mutex);
|
||||
+ for (size_t i = 0; i < m_wallet->get_num_transfer_details(); ++i) {
|
||||
+ const tools::wallet2::transfer_details &td = m_wallet->get_transfer_details(i);
|
||||
+ LOG_ERROR("COIN: " << i << ": " << td.amount() << "; "<<td.m_spent << ";" << td.m_frozen << ";" << m_wallet->frozen(td));
|
||||
+ if (td.m_spent) continue;
|
||||
+ LOG_ERROR("is frozen");
|
||||
+ if (!td.m_frozen) {
|
||||
+ LOG_ERROR("isn't:");
|
||||
+ LOG_ERROR("hash: " << td.m_key_image << "; " << td.amount());
|
||||
+ preferred_input_list.push_back(td.m_key_image);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ for (const auto &de : preferred_input_list) {
|
||||
+ LOG_ERROR("preferred input: " << de);
|
||||
+ }
|
||||
if (error) {
|
||||
break;
|
||||
}
|
||||
@@ -2129,11 +2178,11 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
|
||||
if (amount) {
|
||||
transaction->m_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count,
|
||||
adjusted_priority,
|
||||
- extra, subaddr_account, subaddr_indices);
|
||||
+ extra, subaddr_account, subaddr_indices, preferred_input_list);
|
||||
} else {
|
||||
transaction->m_pending_tx = m_wallet->create_transactions_all(0, info.address, info.is_subaddress, 1, fake_outs_count,
|
||||
adjusted_priority,
|
||||
- extra, subaddr_account, subaddr_indices);
|
||||
+ extra, subaddr_account, subaddr_indices, preferred_input_list);
|
||||
+ for (const auto &de : preferred_input_list) {
|
||||
+ LOG_ERROR("preferred input: " << de);
|
||||
+ }
|
||||
+ if (error) {
|
||||
+ break;
|
||||
+ }
|
||||
+ if (!extra_nonce.empty() && !add_extra_nonce_to_tx_extra(extra, extra_nonce)) {
|
||||
+ setStatusError(tr("failed to set up payment id, though it was decoded correctly"));
|
||||
+ break;
|
||||
}
|
||||
pendingTxPostProcess(transaction);
|
||||
- }
|
||||
- if (error) {
|
||||
- break;
|
||||
- }
|
||||
- if (!extra_nonce.empty() && !add_extra_nonce_to_tx_extra(extra, extra_nonce)) {
|
||||
- setStatusError(tr("failed to set up payment id, though it was decoded correctly"));
|
||||
- break;
|
||||
- }
|
||||
- try {
|
||||
size_t fake_outs_count = mixin_count > 0 ? mixin_count : m_wallet->default_mixin();
|
||||
fake_outs_count = m_wallet->adjust_mixin(mixin_count);
|
||||
|
||||
@@ -2214,10 +2263,10 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const std::vector<stri
|
||||
if (amount) {
|
||||
transaction->m_pending_tx = m_wallet->create_transactions_2(dsts, asset_type, asset_type, converted_tx_type, fake_outs_count, 0 /* unlock_time */,
|
||||
adjusted_priority,
|
||||
- extra, subaddr_account, subaddr_indices);
|
||||
+ extra, subaddr_account, subaddr_indices, preferred_input_list);
|
||||
} else {
|
||||
std::vector<tools::wallet2::pending_tx> m_pending_txs;
|
||||
for (const auto subaddr_index : subaddr_indices) {
|
||||
@@ -2127,7 +2188,8 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const Monero::transact
|
||||
adjusted_priority,
|
||||
extra,
|
||||
subaddr_account,
|
||||
- std::set<uint32_t> {subaddr_index}
|
||||
+ std::set<uint32_t> {subaddr_index},
|
||||
+ preferred_input_list
|
||||
);
|
||||
m_pending_txs.insert(m_pending_txs.end(), result.begin(), result.end());
|
||||
|
||||
@@ -2165,6 +2227,16 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const Monero::transact
|
||||
writer << boost::format(tr("not enough money to transfer, available only %s, sent amount %s")) %
|
||||
print_money(e.available()) %
|
||||
print_money(e.tx_amount());
|
||||
+ if (max_coin_control_input != 0 &&
|
||||
+ max_coin_control_input != e.available()) {
|
||||
+ writer << std::endl << boost::format(tr("In addition, coin control was enabled for this transaction, limiting available balance to %s. Make sure that you have enough outputs selected in coin control")) %
|
||||
+ print_money(max_coin_control_input);
|
||||
+ }
|
||||
+ if (max_frozen_input != 0 &&
|
||||
+ max_frozen_input != e.available()) {
|
||||
+ writer << std::endl << boost::format(tr("In addition, some a total of %s is frozen. Make sure that you have enough outputs unforzen outputs in coin control")) %
|
||||
+ print_money(max_frozen_input);
|
||||
+ }
|
||||
setStatusError(writer.str());
|
||||
} catch (const tools::error::not_enough_money& e) {
|
||||
std::ostringstream writer;
|
||||
@@ -2172,6 +2244,16 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const Monero::transact
|
||||
writer << boost::format(tr("not enough money to transfer, overall balance only %s, sent amount %s")) %
|
||||
print_money(e.available()) %
|
||||
print_money(e.tx_amount());
|
||||
+ if (max_coin_control_input != 0 &&
|
||||
+ max_coin_control_input != e.available()) {
|
||||
+ writer << std::endl << boost::format(tr("In addition, coin control was enabled for this transaction, limiting available balance to %s. Make sure that you have enough outputs selected in coin control")) %
|
||||
+ print_money(max_coin_control_input);
|
||||
+ }
|
||||
+ if (max_frozen_input != 0 &&
|
||||
+ max_frozen_input != e.available()) {
|
||||
+ writer << std::endl << boost::format(tr("In addition, some a total of %s is frozen. Make sure that you have enough outputs unforzen outputs in coin control")) %
|
||||
+ print_money(max_frozen_input);
|
||||
+ }
|
||||
setStatusError(writer.str());
|
||||
} catch (const tools::error::tx_not_possible& e) {
|
||||
std::ostringstream writer;
|
||||
@@ -2179,6 +2261,16 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const Monero::transact
|
||||
print_money(e.tx_amount() + e.fee()) %
|
||||
print_money(e.tx_amount()) %
|
||||
print_money(e.fee());
|
||||
+ if (max_coin_control_input != 0 &&
|
||||
+ max_coin_control_input != e.available()) {
|
||||
+ writer << std::endl << boost::format(tr("In addition, coin control was enabled for this transaction, limiting available balance to %s. Make sure that you have enough outputs selected in coin control")) %
|
||||
+ print_money(max_coin_control_input);
|
||||
+ }
|
||||
+ if (max_frozen_input != 0 &&
|
||||
+ max_frozen_input != e.available()) {
|
||||
+ writer << std::endl << boost::format(tr("In addition, some a total of %s is frozen. Make sure that you have enough outputs unforzen outputs in coin control")) %
|
||||
+ print_money(max_frozen_input);
|
||||
+ }
|
||||
setStatusError(writer.str());
|
||||
} catch (const tools::error::not_enough_outs_to_mix& e) {
|
||||
std::ostringstream writer;
|
||||
@@ -2222,10 +2304,10 @@ PendingTransaction *WalletImpl::createTransactionMultDest(const Monero::transact
|
||||
}
|
||||
|
||||
PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, const string &payment_id, optional<uint64_t> amount, uint32_t mixin_count,
|
||||
- PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices)
|
||||
+ PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const std::set<std::string> &preferred_inputs)
|
||||
- const std::string &asset_type, const bool is_return, PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices)
|
||||
+ const std::string &asset_type, const bool is_return, PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const std::set<std::string> &preferred_inputs)
|
||||
|
||||
{
|
||||
- return createTransactionMultDest(std::vector<string> {dst_addr}, payment_id, amount ? (std::vector<uint64_t> {*amount}) : (optional<std::vector<uint64_t>>()), mixin_count, priority, subaddr_account, subaddr_indices);
|
||||
+ return createTransactionMultDest(std::vector<string> {dst_addr}, payment_id, amount ? (std::vector<uint64_t> {*amount}) : (optional<std::vector<uint64_t>>()), mixin_count, priority, subaddr_account, subaddr_indices, preferred_inputs);
|
||||
- return createTransactionMultDest(Monero::transaction_type::TRANSFER, std::vector<string> {dst_addr}, payment_id, amount ? (std::vector<uint64_t> {*amount}) : (optional<std::vector<uint64_t>>()), mixin_count, asset_type, is_return, priority, subaddr_account, subaddr_indices);
|
||||
+ return createTransactionMultDest(Monero::transaction_type::TRANSFER, std::vector<string> {dst_addr}, payment_id, amount ? (std::vector<uint64_t> {*amount}) : (optional<std::vector<uint64_t>>()), mixin_count, asset_type, is_return, priority, subaddr_account, subaddr_indices, preferred_inputs);
|
||||
}
|
||||
|
||||
PendingTransaction *WalletImpl::createSweepUnmixableTransaction()
|
||||
@@ -2342,6 +2391,11 @@ AddressBook *WalletImpl::addressBook()
|
||||
@@ -2350,6 +2442,11 @@ AddressBook *WalletImpl::addressBook()
|
||||
return m_addressBook.get();
|
||||
}
|
||||
|
||||
@@ -651,20 +825,21 @@ index 32e12284b..a82f270e4 100644
|
||||
class SubaddressAccountImpl;
|
||||
struct Wallet2CallbackImpl;
|
||||
|
||||
@@ -167,12 +168,14 @@ public:
|
||||
optional<std::vector<uint64_t>> amount, uint32_t mixin_count,
|
||||
PendingTransaction::Priority priority = PendingTransaction::Priority_Low,
|
||||
uint32_t subaddr_account = 0,
|
||||
- std::set<uint32_t> subaddr_indices = {}) override;
|
||||
+ std::set<uint32_t> subaddr_indices = {},
|
||||
+ const std::set<std::string> &preferred_inputs = {}) override;
|
||||
@@ -167,13 +168,15 @@ public:
|
||||
const std::string &asset_type, const bool is_return,
|
||||
PendingTransaction::Priority priority = PendingTransaction::Priority_Low,
|
||||
uint32_t subaddr_account = 0,
|
||||
- std::set<uint32_t> subaddr_indices = {}) override;
|
||||
+ std::set<uint32_t> subaddr_indices = {},
|
||||
+ const std::set<std::string> &preferred_inputs = {}) override;
|
||||
PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,
|
||||
optional<uint64_t> amount, uint32_t mixin_count,
|
||||
PendingTransaction::Priority priority = PendingTransaction::Priority_Low,
|
||||
uint32_t subaddr_account = 0,
|
||||
- std::set<uint32_t> subaddr_indices = {}) override;
|
||||
+ std::set<uint32_t> subaddr_indices = {},
|
||||
+ const std::set<std::string> &preferred_inputs = {}) override;
|
||||
optional<uint64_t> amount, uint32_t mixin_count,
|
||||
const std::string &asset_type, const bool is_return,
|
||||
PendingTransaction::Priority priority = PendingTransaction::Priority_Low,
|
||||
uint32_t subaddr_account = 0,
|
||||
- std::set<uint32_t> subaddr_indices = {}) override;
|
||||
+ std::set<uint32_t> subaddr_indices = {},
|
||||
+ const std::set<std::string> &preferred_inputs = {}) override;
|
||||
virtual PendingTransaction * createSweepUnmixableTransaction() override;
|
||||
bool submitTransaction(const std::string &fileName) override;
|
||||
bool submitTransactionUR(const std::string &input) override;
|
||||
@@ -696,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;
|
||||
};
|
||||
|
||||
@@ -728,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
|
||||
@@ -748,18 +925,18 @@ index be1c3704e..013b5bcba 100644
|
||||
struct SubaddressRow {
|
||||
public:
|
||||
SubaddressRow(std::size_t _rowId, const std::string &_address, const std::string &_label):
|
||||
@@ -856,7 +901,8 @@ struct Wallet
|
||||
optional<std::vector<uint64_t>> amount, uint32_t mixin_count,
|
||||
PendingTransaction::Priority = PendingTransaction::Priority_Low,
|
||||
uint32_t subaddr_account = 0,
|
||||
- std::set<uint32_t> subaddr_indices = {}) = 0;
|
||||
+ std::set<uint32_t> subaddr_indices = {},
|
||||
+ const std::set<std::string> &preferred_inputs = {}) = 0;
|
||||
@@ -940,7 +985,8 @@ struct Wallet
|
||||
const std::string &asset_type, const bool is_return,
|
||||
PendingTransaction::Priority = PendingTransaction::Priority_Low,
|
||||
uint32_t subaddr_account = 0,
|
||||
- std::set<uint32_t> subaddr_indices = {}) = 0;
|
||||
+ std::set<uint32_t> subaddr_indices = {},
|
||||
+ const std::set<std::string> &preferred_inputs = {}) = 0;
|
||||
|
||||
/*!
|
||||
* \brief createTransaction creates transaction. if dst_addr is an integrated address, payment_id is ignored
|
||||
@@ -875,7 +921,8 @@ struct Wallet
|
||||
optional<uint64_t> amount, uint32_t mixin_count,
|
||||
const std::string &asset_type, const bool is_return,
|
||||
PendingTransaction::Priority = PendingTransaction::Priority_Low,
|
||||
uint32_t subaddr_account = 0,
|
||||
- std::set<uint32_t> subaddr_indices = {}) = 0;
|
||||
@@ -777,10 +954,10 @@ index be1c3704e..013b5bcba 100644
|
||||
virtual SubaddressAccount * subaddressAccount() = 0;
|
||||
virtual void setListener(WalletListener *) = 0;
|
||||
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
|
||||
index fd4094360..be3096675 100644
|
||||
index 806de969a..8720e18b1 100644
|
||||
--- a/src/wallet/wallet2.cpp
|
||||
+++ b/src/wallet/wallet2.cpp
|
||||
@@ -2103,12 +2103,21 @@ bool wallet2::frozen(const multisig_tx_set& txs) const
|
||||
@@ -2100,12 +2100,21 @@ bool wallet2::frozen(const multisig_tx_set& txs) const
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -802,7 +979,7 @@ index fd4094360..be3096675 100644
|
||||
void wallet2::thaw(const crypto::key_image &ki)
|
||||
{
|
||||
thaw(get_transfer_details(ki));
|
||||
@@ -2119,6 +2128,18 @@ bool wallet2::frozen(const crypto::key_image &ki) const
|
||||
@@ -2116,6 +2125,18 @@ bool wallet2::frozen(const crypto::key_image &ki) const
|
||||
return frozen(get_transfer_details(ki));
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@@ -821,33 +998,25 @@ index fd4094360..be3096675 100644
|
||||
size_t wallet2::get_transfer_details(const crypto::key_image &ki) const
|
||||
{
|
||||
for (size_t idx = 0; idx < m_transfers.size(); ++idx)
|
||||
@@ -2532,6 +2553,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);
|
||||
m_transfers.push_back(transfer_details{});
|
||||
transfer_details& td = m_transfers.back();
|
||||
td.m_block_height = height;
|
||||
@@ -2635,6 +2657,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;
|
||||
@@ -10506,7 +10529,7 @@ void wallet2::transfer_selected_rct(std::vector<cryptonote::tx_destination_entry
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
-std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, uint32_t subaddr_account, const std::set<uint32_t> &subaddr_indices)
|
||||
+std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, uint32_t subaddr_account, const std::set<uint32_t> &subaddr_indices, const std::vector<crypto::key_image>& preferred_input_list)
|
||||
-std::vector<size_t> wallet2::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> wallet2::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)
|
||||
{
|
||||
std::vector<size_t> picks;
|
||||
float current_output_relatdness = 1.0f;
|
||||
@@ -10517,6 +10540,9 @@ std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui
|
||||
for (size_t i = 0; i < m_transfers.size(); ++i)
|
||||
@@ -11048,6 +11071,9 @@ std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui
|
||||
for (size_t i: m_transfers_indices[asset_type])
|
||||
{
|
||||
const transfer_details& td = m_transfers[i];
|
||||
+ if (!is_preferred_input(preferred_input_list, td.m_key_image)) {
|
||||
@@ -856,37 +1025,37 @@ index fd4094360..be3096675 100644
|
||||
if (!is_spent(td, false) && !td.m_frozen && td.is_rct() && td.amount() >= needed_money && is_transfer_unlocked(td) && td.m_subaddr_index.major == subaddr_account && subaddr_indices.count(td.m_subaddr_index.minor) == 1)
|
||||
{
|
||||
if (td.amount() > m_ignore_outputs_above || td.amount() < m_ignore_outputs_below)
|
||||
@@ -10537,6 +10563,9 @@ std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui
|
||||
for (size_t i = 0; i < m_transfers.size(); ++i)
|
||||
@@ -11069,6 +11095,9 @@ std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui
|
||||
{
|
||||
const transfer_details& td = m_transfers[i];
|
||||
size_t idx = *i;
|
||||
const transfer_details& td = m_transfers[idx];
|
||||
+ if (!is_preferred_input(preferred_input_list, td.m_key_image)) {
|
||||
+ continue;
|
||||
+ }
|
||||
if (!is_spent(td, false) && !td.m_frozen && !td.m_key_image_partial && td.is_rct() && is_transfer_unlocked(td) && td.m_subaddr_index.major == subaddr_account && subaddr_indices.count(td.m_subaddr_index.minor) == 1)
|
||||
{
|
||||
if (td.amount() > m_ignore_outputs_above || td.amount() < m_ignore_outputs_below)
|
||||
@@ -10548,6 +10577,9 @@ std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui
|
||||
for (size_t j = i + 1; j < m_transfers.size(); ++j)
|
||||
@@ -11084,6 +11113,9 @@ std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui
|
||||
{
|
||||
const transfer_details& td2 = m_transfers[j];
|
||||
size_t idx2 = *j;
|
||||
const transfer_details& td2 = m_transfers[idx2];
|
||||
+ if (!is_preferred_input(preferred_input_list, td2.m_key_image)) {
|
||||
+ continue;
|
||||
+ }
|
||||
if (td2.amount() > m_ignore_outputs_above || td2.amount() < m_ignore_outputs_below)
|
||||
{
|
||||
MDEBUG("Ignoring output " << j << " of amount " << print_money(td2.amount()) << " which is outside prescribed range [" << print_money(m_ignore_outputs_below) << ", " << print_money(m_ignore_outputs_above) << "]");
|
||||
@@ -11120,7 +11152,7 @@ bool wallet2::light_wallet_key_image_is_ours(const crypto::key_image& key_image,
|
||||
MDEBUG("Ignoring output " << idx2 << " of amount " << print_money(td2.amount()) << " which is outside prescribed range [" << print_money(m_ignore_outputs_below) << ", " << print_money(m_ignore_outputs_above) << "]");
|
||||
@@ -11125,7 +11157,7 @@ bool wallet2::light_wallet_key_image_is_ours(const crypto::key_image& key_image,
|
||||
// This system allows for sending (almost) the entire balance, since it does
|
||||
// not generate spurious change in all txes, thus decreasing the instantaneous
|
||||
// usable balance.
|
||||
-std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const unique_index_container& subtract_fee_from_outputs)
|
||||
+std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, 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)
|
||||
-std::vector<wallet2::pending_tx> wallet2::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 unique_index_container& subtract_fee_from_outputs)
|
||||
+std::vector<wallet2::pending_tx> wallet2::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)
|
||||
{
|
||||
//ensure device is let in NONE mode in any case
|
||||
hw::device &hwdev = m_account.get_device();
|
||||
@@ -11328,6 +11360,9 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
||||
for (size_t i = 0; i < m_transfers.size(); ++i)
|
||||
@@ -11333,6 +11365,9 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
||||
for (size_t i: m_transfers_indices[source_asset])
|
||||
{
|
||||
const transfer_details& td = m_transfers[i];
|
||||
+ if (!is_preferred_input(preferred_input_list, td.m_key_image)) {
|
||||
@@ -895,27 +1064,28 @@ index fd4094360..be3096675 100644
|
||||
if (m_ignore_fractional_outputs && td.amount() < fractional_threshold)
|
||||
{
|
||||
MDEBUG("Ignoring output " << i << " of amount " << print_money(td.amount()) << " which is below fractional threshold " << print_money(fractional_threshold));
|
||||
@@ -11419,7 +11454,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
||||
@@ -11528,7 +11563,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
||||
// will get us a known fee.
|
||||
uint64_t estimated_fee = estimate_fee(use_per_byte_fee, use_rct, 2, fake_outs_count, 2, extra.size(), bulletproof, clsag, bulletproof_plus, use_view_tags, base_fee, fee_quantization_mask);
|
||||
total_needed_money = needed_money + (subtract_fee_from_outputs.size() ? 0 : estimated_fee);
|
||||
- preferred_inputs = pick_preferred_rct_inputs(total_needed_money, subaddr_account, subaddr_indices);
|
||||
+ preferred_inputs = pick_preferred_rct_inputs(total_needed_money, subaddr_account, subaddr_indices, preferred_input_list);
|
||||
- preferred_inputs = pick_preferred_rct_inputs(total_needed_money, subaddr_account, subaddr_indices, source_asset);
|
||||
+ preferred_inputs = pick_preferred_rct_inputs(total_needed_money, subaddr_account, subaddr_indices, source_asset, preferred_input_list);
|
||||
if (!preferred_inputs.empty())
|
||||
{
|
||||
string s;
|
||||
@@ -11898,7 +11933,7 @@ bool wallet2::sanity_check(const std::vector<wallet2::pending_tx> &ptx_vector, c
|
||||
@@ -12022,7 +12057,7 @@ bool wallet2::sanity_check(const std::vector<wallet2::pending_tx> &ptx_vector, c
|
||||
return true;
|
||||
}
|
||||
|
||||
-std::vector<wallet2::pending_tx> wallet2::create_transactions_all(uint64_t below, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, 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, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, 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> 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;
|
||||
@@ -11927,6 +11962,9 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_all(uint64_t below
|
||||
for (size_t i = 0; i < m_transfers.size(); ++i)
|
||||
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])
|
||||
{
|
||||
//size_t i = m_transfers_indices[asset_type][idx];
|
||||
const transfer_details& td = m_transfers[i];
|
||||
+ if (!is_preferred_input(preferred_input_list, td.m_key_image)) {
|
||||
+ continue;
|
||||
@@ -924,29 +1094,29 @@ index fd4094360..be3096675 100644
|
||||
{
|
||||
MDEBUG("Ignoring output " << i << " of amount " << print_money(td.amount()) << " which is below threshold " << print_money(fractional_threshold));
|
||||
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
|
||||
index c165acb9d..6b103d9c2 100644
|
||||
index a619bdd15..4f324c238 100644
|
||||
--- a/src/wallet/wallet2.h
|
||||
+++ b/src/wallet/wallet2.h
|
||||
@@ -1216,8 +1216,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);
|
||||
- std::vector<wallet2::pending_tx> create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, uint32_t priority, const std::vector<uint8_t>& extra, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, 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, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, 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 size_t fake_outs_count, 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, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, 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, uint32_t priority, const std::vector<uint8_t>& extra);
|
||||
std::vector<wallet2::pending_tx> create_transactions_from(const cryptonote::account_public_address &address, 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, uint32_t priority, const std::vector<uint8_t>& extra);
|
||||
bool sanity_check(const std::vector<wallet2::pending_tx> &ptx_vector, const std::vector<cryptonote::tx_destination_entry>& dsts, const unique_index_container& subtract_fee_from_outputs = {}) const;
|
||||
@@ -1569,6 +1569,7 @@ private:
|
||||
- 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 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);
|
||||
+ 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, 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);
|
||||
@@ -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);
|
||||
@@ -1800,7 +1801,9 @@ private:
|
||||
@@ -1835,7 +1836,9 @@ private:
|
||||
void freeze(size_t idx);
|
||||
void thaw(size_t idx);
|
||||
bool frozen(size_t idx) const;
|
||||
@@ -956,24 +1126,24 @@ index c165acb9d..6b103d9c2 100644
|
||||
void thaw(const crypto::key_image &ki);
|
||||
bool frozen(const crypto::key_image &ki) const;
|
||||
bool frozen(const transfer_details &td) const;
|
||||
@@ -1841,6 +1844,8 @@ private:
|
||||
@@ -1876,6 +1879,8 @@ private:
|
||||
|
||||
static std::string get_default_daemon_address() { CRITICAL_REGION_LOCAL(default_daemon_address_lock); return default_daemon_address; }
|
||||
|
||||
+ boost::shared_mutex m_transfers_mutex;
|
||||
+
|
||||
private:
|
||||
/*!
|
||||
* \brief Stores wallet information to wallet file.
|
||||
@@ -1912,7 +1917,7 @@ private:
|
||||
bool get_pricing_record(oracle::pricing_record& pr, const uint64_t height);
|
||||
bool get_circulating_supply(std::vector<std::pair<std::string, std::string>> &amounts);
|
||||
bool get_yield_info(std::vector<cryptonote::yield_block_info>& ybi_data);
|
||||
@@ -1962,7 +1967,7 @@ private:
|
||||
std::vector<uint64_t> get_unspent_amounts_vector(bool strict);
|
||||
uint64_t get_dynamic_base_fee_estimate();
|
||||
float get_output_relatedness(const transfer_details &td0, const transfer_details &td1) const;
|
||||
- std::vector<size_t> pick_preferred_rct_inputs(uint64_t needed_money, uint32_t subaddr_account, const std::set<uint32_t> &subaddr_indices);
|
||||
+ 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::vector<crypto::key_image>& preferred_input_list);
|
||||
- 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.0
|
||||
2.48.1
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
From 96911b156ad9cfef2ebf2809a393492e87ab7607 Mon Sep 17 00:00:00 2001
|
||||
From 0ba0339b11d8f7f66f2d5cd27075d438a76351b4 Mon Sep 17 00:00:00 2001
|
||||
From: M <m@cakewallet.com>
|
||||
Date: Fri, 21 Apr 2023 15:43:47 -0400
|
||||
Subject: [PATCH 11/15] Add hex encoding and tx key getter for
|
||||
Subject: [PATCH 09/14] Add hex encoding and tx key getter for
|
||||
PendingTransction in wallet api.
|
||||
|
||||
---
|
||||
@@ -64,5 +64,5 @@ index 013b5bcba..f421fdc05 100644
|
||||
|
||||
/**
|
||||
--
|
||||
2.48.0
|
||||
2.48.1
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
From ad28016bf3cfd11242dc14472389f7a006c73dcf Mon Sep 17 00:00:00 2001
|
||||
From cb02355313d504e6a44f8f70b8eb2be64167ffd4 Mon Sep 17 00:00:00 2001
|
||||
From: Konstantin Ullrich <konstantinullrich12@gmail.com>
|
||||
Date: Wed, 11 Oct 2023 16:47:59 +0200
|
||||
Subject: [PATCH 12/15] Add recoverDeterministicWalletFromSpendKey
|
||||
Subject: [PATCH 10/14] 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 e69910e69..e650e6044 100644
|
||||
index 933cc2531..d8fe108b4 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
|
||||
@@ -149,5 +149,5 @@ index 28fcd36c9..be3ff8184 100644
|
||||
const std::string &password,
|
||||
NetworkType nettype,
|
||||
--
|
||||
2.48.0
|
||||
2.48.1
|
||||
|
||||
+11
-11
@@ -1,7 +1,7 @@
|
||||
From f8b3055a79c929dc167d20d4874ab20b0a51d49d Mon Sep 17 00:00:00 2001
|
||||
From 846d3f60093add6653d9102d841288066fc08311 Mon Sep 17 00:00:00 2001
|
||||
From: cyan <cyjan@mrcyjanek.net>
|
||||
Date: Thu, 7 Nov 2024 16:46:24 +0000
|
||||
Subject: [PATCH 13/15] add monero submodule support
|
||||
Subject: [PATCH 11/14] add monero submodule support
|
||||
|
||||
---
|
||||
CMakeLists.txt | 6 +++---
|
||||
@@ -10,11 +10,11 @@ Subject: [PATCH 13/15] add monero submodule support
|
||||
3 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 96056e324..1383e630a 100644
|
||||
index f0630ef9b..9406e57b4 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -223,9 +223,9 @@ function(forbid_undefined_symbols)
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
@@ -226,9 +226,9 @@ function(forbid_undefined_symbols)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(test)
|
||||
option(EXPECT_SUCCESS "" ON)
|
||||
-file(WRITE "${CMAKE_SOURCE_DIR}/incorrect_source.cpp" "void undefined_symbol(); void symbol() { undefined_symbol(); }")
|
||||
@@ -25,7 +25,7 @@ index 96056e324..1383e630a 100644
|
||||
endif()
|
||||
add_library(l0 SHARED incorrect_source.cpp)
|
||||
add_library(l1 MODULE incorrect_source.cpp)
|
||||
@@ -391,7 +391,7 @@ else()
|
||||
@@ -390,7 +390,7 @@ else()
|
||||
endif()
|
||||
|
||||
list(INSERT CMAKE_MODULE_PATH 0
|
||||
@@ -48,18 +48,18 @@ index 7ecf5f610..89fb9d167 100644
|
||||
set(saved_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||
set(CMAKE_C_FLAGS "${flag}")
|
||||
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
|
||||
index 21e69ea0e..d9bc5dda3 100644
|
||||
index 3188c88db..9fbdb3c05 100644
|
||||
--- a/src/wallet/wallet_rpc_server.cpp
|
||||
+++ b/src/wallet/wallet_rpc_server.cpp
|
||||
@@ -1162,7 +1162,7 @@ namespace tools
|
||||
@@ -1286,7 +1286,7 @@ namespace tools
|
||||
{
|
||||
uint64_t mixin = m_wallet->adjust_mixin(req.ring_size ? req.ring_size - 1 : 0);
|
||||
uint32_t priority = m_wallet->adjust_priority(req.priority);
|
||||
- std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, mixin, priority, extra, req.account_index, req.subaddr_indices, req.subtract_fee_from_outputs);
|
||||
+ std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, mixin, priority, extra, req.account_index, req.subaddr_indices, {}, req.subtract_fee_from_outputs);
|
||||
- std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, req.source_asset, req.dest_asset, type, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices, req.subtract_fee_from_outputs);
|
||||
+ std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, req.source_asset, req.dest_asset, type, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices, {}, req.subtract_fee_from_outputs);
|
||||
|
||||
if (ptx_vector.empty())
|
||||
{
|
||||
--
|
||||
2.48.0
|
||||
2.48.1
|
||||
|
||||
+11
-11
@@ -1,7 +1,7 @@
|
||||
From a707d5fc2aa9d387857381e7ebc4a68c1d245a00 Mon Sep 17 00:00:00 2001
|
||||
From 53cc0482e55a39b5dbf2261fea11fcb160778800 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Thu, 21 Nov 2024 06:05:03 -0500
|
||||
Subject: [PATCH 14/15] fix iOS depends build
|
||||
Subject: [PATCH 12/14] fix iOS depends build
|
||||
|
||||
---
|
||||
CMakeLists.txt | 4 ----
|
||||
@@ -11,20 +11,20 @@ Subject: [PATCH 14/15] fix iOS depends build
|
||||
4 files changed, 14 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 1383e630a..b8782570d 100644
|
||||
index 9406e57b4..1eac121db 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -39,10 +39,6 @@ include(CheckLibraryExists)
|
||||
include(CheckFunctionExists)
|
||||
endif()
|
||||
include(FindPythonInterp)
|
||||
|
||||
-if (IOS)
|
||||
- INCLUDE(CmakeLists_IOS.txt)
|
||||
-endif()
|
||||
-
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
message(STATUS "CMake version ${CMAKE_VERSION}")
|
||||
project(salvium)
|
||||
|
||||
option (USE_CCACHE "Use ccache if a usable instance is found" ON)
|
||||
diff --git a/src/checkpoints/CMakeLists.txt b/src/checkpoints/CMakeLists.txt
|
||||
index 665441f62..841df3256 100644
|
||||
--- a/src/checkpoints/CMakeLists.txt
|
||||
@@ -60,7 +60,7 @@ index 414936a05..81c81767f 100644
|
||||
find_library(IOKIT_LIBRARY IOKit)
|
||||
mark_as_advanced(IOKIT_LIBRARY)
|
||||
diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp
|
||||
index 83bea8b5b..dfb4b5c5a 100644
|
||||
index 71b8f78cc..0f53f024e 100644
|
||||
--- a/src/cryptonote_basic/miner.cpp
|
||||
+++ b/src/cryptonote_basic/miner.cpp
|
||||
@@ -45,7 +45,7 @@
|
||||
@@ -72,7 +72,7 @@ index 83bea8b5b..dfb4b5c5a 100644
|
||||
#include <sys/times.h>
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#include <IOKit/ps/IOPSKeys.h>
|
||||
@@ -971,7 +971,7 @@ namespace cryptonote
|
||||
@@ -883,7 +883,7 @@ namespace cryptonote
|
||||
|
||||
return true;
|
||||
|
||||
@@ -81,7 +81,7 @@ index 83bea8b5b..dfb4b5c5a 100644
|
||||
|
||||
mach_msg_type_number_t count;
|
||||
kern_return_t status;
|
||||
@@ -1037,7 +1037,7 @@ namespace cryptonote
|
||||
@@ -949,7 +949,7 @@ namespace cryptonote
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ index 83bea8b5b..dfb4b5c5a 100644
|
||||
|
||||
struct tms tms;
|
||||
if ( times(&tms) != (clock_t)-1 )
|
||||
@@ -1066,7 +1066,7 @@ namespace cryptonote
|
||||
@@ -978,7 +978,7 @@ namespace cryptonote
|
||||
return boost::logic::tribool(power_status.ACLineStatus != 1);
|
||||
}
|
||||
|
||||
@@ -100,5 +100,5 @@ index 83bea8b5b..dfb4b5c5a 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.0
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From 1eacd30724559749be5adeb31d763f44c3f221f9 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
|
||||
|
||||
|
||||
---
|
||||
src/wallet/api/wallet.cpp | 2 ++
|
||||
1 files changed, 2 insertions(+), 0 deletion(-)
|
||||
|
||||
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
|
||||
index d8fe108b4..e3e838b13 100644
|
||||
--- a/src/wallet/api/wallet.cpp
|
||||
+++ b/src/wallet/api/wallet.cpp
|
||||
@@ -46,7 +46,9 @@
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
|
||||
+#ifdef WIN32
|
||||
#include <boost/locale.hpp>
|
||||
+#endif
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "bc-ur/src/bc-ur.hpp"
|
||||
#if defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI)
|
||||
--
|
||||
2.48.1
|
||||
|
||||
+4
-4
@@ -1,17 +1,17 @@
|
||||
From d47284456194c6d99698b28908d753acf1a64010 Mon Sep 17 00:00:00 2001
|
||||
From 2d31234e859bff817d30d91b21d9412375668aae Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Wed, 29 Jan 2025 16:13:28 +0100
|
||||
Subject: [PATCH] change earliest fork height message
|
||||
Subject: [PATCH 14/14] change earliest fork height message
|
||||
|
||||
---
|
||||
src/wallet/wallet2.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
|
||||
index d060bf95b..9c1574c02 100644
|
||||
index 8720e18b1..69da11d9c 100644
|
||||
--- a/src/wallet/wallet2.cpp
|
||||
+++ b/src/wallet/wallet2.cpp
|
||||
@@ -12354,7 +12354,7 @@ bool wallet2::use_fork_rules(uint8_t version, int64_t early_blocks)
|
||||
@@ -12365,7 +12365,7 @@ bool wallet2::use_fork_rules(uint8_t version, int64_t early_blocks)
|
||||
boost::optional<std::string> result = m_node_rpc_proxy.get_height(height);
|
||||
THROW_WALLET_EXCEPTION_IF(result, error::wallet_internal_error, "Failed to get height");
|
||||
result = m_node_rpc_proxy.get_earliest_height(version, earliest_height);
|
||||
@@ -0,0 +1,24 @@
|
||||
From 71cf45cfbd571ec58e8b2a1d408ff74804bf7e1d 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
|
||||
|
||||
---
|
||||
contrib/epee/include/span.h | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/contrib/epee/include/span.h b/contrib/epee/include/span.h
|
||||
index 01dc387d6..2ad733a2f 100644
|
||||
--- a/contrib/epee/include/span.h
|
||||
+++ b/contrib/epee/include/span.h
|
||||
@@ -162,7 +162,6 @@ namespace epee
|
||||
{
|
||||
static_assert(!std::is_empty<T>(), "empty types will not work -> sizeof == 1");
|
||||
static_assert(std::is_standard_layout<T>(), "type must have standard layout");
|
||||
- static_assert(std::is_trivially_copyable<T>(), "type must be trivially copyable");
|
||||
static_assert(alignof(T) == 1, "type may have padding");
|
||||
return {reinterpret_cast<const std::uint8_t*>(std::addressof(src)), sizeof(T)};
|
||||
}
|
||||
--
|
||||
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;
|
||||
}
|
||||
|
||||
+12
-9
@@ -22,14 +22,14 @@ index b163212b7..196ad671f 100644
|
||||
message_transporter.cpp
|
||||
wallet_rpc_payments.cpp
|
||||
+ wallet_cache_to_json.cpp
|
||||
tx_builder.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
|
||||
@@ -3475,6 +3475,11 @@ void Wallet::setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -38,7 +38,9 @@ index 7d7d0f922..effb6e719 100644
|
||||
+ return std::string(m_wallet->serialize_cache_to_json());
|
||||
+}
|
||||
+
|
||||
} // namespace
|
||||
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
|
||||
@@ -56,22 +58,23 @@ 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
|
||||
@@ -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
|
||||
@@ -1429,6 +1429,12 @@ private:
|
||||
FIELD(m_background_sync_data)
|
||||
@@ -1544,6 +1544,12 @@ private:
|
||||
FIELD(m_return_output_info)
|
||||
END_SERIALIZE()
|
||||
|
||||
+ /*!
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,19 +0,0 @@
|
||||
From 4828befb3843764eaaa5e5ea489cde6d101d71ce Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Wed, 23 Oct 2024 15:18:21 +0200
|
||||
Subject: [PATCH 02/15] fix missing ___clear_cache when targetting iOS
|
||||
|
||||
---
|
||||
external/randomwow | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/external/randomwow b/external/randomwow
|
||||
index 27b099b6d..6f30d4b92 160000
|
||||
--- a/external/randomwow
|
||||
+++ b/external/randomwow
|
||||
@@ -1 +1 @@
|
||||
-Subproject commit 27b099b6dd6fef6e17f58c6dfe00009e9c5df587
|
||||
+Subproject commit 6f30d4b924fecb231e5b683915cc75d18b3b5866
|
||||
--
|
||||
2.48.0
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
From d4d406961073b5f9d3cc46a6cedaf73a378e1ea6 Mon Sep 17 00:00:00 2001
|
||||
From: cyan <cyjan@mrcyjanek.net>
|
||||
Date: Tue, 22 Oct 2024 10:23:18 +0000
|
||||
Subject: [PATCH 03/15] fix is_trivially_copyable
|
||||
|
||||
---
|
||||
contrib/epee/include/span.h | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/contrib/epee/include/span.h b/contrib/epee/include/span.h
|
||||
index 01dc387d6..5e3af4d11 100644
|
||||
--- a/contrib/epee/include/span.h
|
||||
+++ b/contrib/epee/include/span.h
|
||||
@@ -151,7 +151,6 @@ namespace epee
|
||||
using value_type = typename T::value_type;
|
||||
static_assert(!std::is_empty<value_type>(), "empty value types will not work -> sizeof == 1");
|
||||
static_assert(std::is_standard_layout<value_type>(), "value type must have standard layout");
|
||||
- static_assert(std::is_trivially_copyable<value_type>(), "value type must be trivially copyable");
|
||||
static_assert(alignof(value_type) == 1, "value type may have padding");
|
||||
return {reinterpret_cast<std::uint8_t*>(src.data()), src.size() * sizeof(value_type)};
|
||||
}
|
||||
@@ -162,7 +161,6 @@ namespace epee
|
||||
{
|
||||
static_assert(!std::is_empty<T>(), "empty types will not work -> sizeof == 1");
|
||||
static_assert(std::is_standard_layout<T>(), "type must have standard layout");
|
||||
- static_assert(std::is_trivially_copyable<T>(), "type must be trivially copyable");
|
||||
static_assert(alignof(T) == 1, "type may have padding");
|
||||
return {reinterpret_cast<const std::uint8_t*>(std::addressof(src)), sizeof(T)};
|
||||
}
|
||||
--
|
||||
2.48.0
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
From eeb059ab8bff7e8614531565259ca66f6e6a8c7d Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Mon, 18 Nov 2024 10:57:37 -0500
|
||||
Subject: [PATCH 15/15] include locale only when targeting WIN32
|
||||
|
||||
---
|
||||
CMakeLists.txt | 5 ++++-
|
||||
src/wallet/api/wallet.cpp | 2 ++
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b8782570d..d1ed1de7b 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -1090,7 +1090,10 @@ if(NOT Boost_FOUND)
|
||||
elseif(Boost_FOUND)
|
||||
message(STATUS "Found Boost Version: ${Boost_VERSION_STRING}")
|
||||
|
||||
- set(BOOST_COMPONENTS filesystem thread date_time chrono serialization program_options locale)
|
||||
+ if(WIN32)
|
||||
+ set(BOOST_LOCALE locale)
|
||||
+ endif()
|
||||
+ set(BOOST_COMPONENTS filesystem thread date_time chrono serialization program_options ${BOOST_LOCALE})
|
||||
|
||||
# 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 e650e6044..6d7553a1d 100644
|
||||
--- a/src/wallet/api/wallet.cpp
|
||||
+++ b/src/wallet/api/wallet.cpp
|
||||
@@ -46,7 +46,9 @@
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
|
||||
+#ifdef WIN32
|
||||
#include <boost/locale.hpp>
|
||||
+#endif
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "bc-ur/src/bc-ur.hpp"
|
||||
#if defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI)
|
||||
--
|
||||
2.48.0
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
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
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
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,39 +0,0 @@
|
||||
From 38da066606cb959497d9b8221bb29ee885bc7c31 Mon Sep 17 00:00:00 2001
|
||||
From: cyan <cyjan@mrcyjanek.net>
|
||||
Date: Sat, 2 Nov 2024 20:50:26 +0000
|
||||
Subject: [PATCH 1/7] fix build issues
|
||||
|
||||
---
|
||||
contrib/db/libmdbx/CMakeLists.txt | 2 +-
|
||||
contrib/db/libmdbx/packages/rpm/CMakeLists.txt | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/contrib/db/libmdbx/CMakeLists.txt b/contrib/db/libmdbx/CMakeLists.txt
|
||||
index 75e9b3b0..01a5915c 100644
|
||||
--- a/contrib/db/libmdbx/CMakeLists.txt
|
||||
+++ b/contrib/db/libmdbx/CMakeLists.txt
|
||||
@@ -80,7 +80,7 @@ macro(add_mdbx_option NAME DESCRIPTION DEFAULT)
|
||||
endmacro()
|
||||
|
||||
# only for compatibility testing
|
||||
-# set(CMAKE_CXX_STANDARD 14)
|
||||
+set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
if(NOT "$ENV{TEAMCITY_PROCESS_FLOW_ID}" STREQUAL "")
|
||||
set(CI TEAMCITY)
|
||||
diff --git a/contrib/db/libmdbx/packages/rpm/CMakeLists.txt b/contrib/db/libmdbx/packages/rpm/CMakeLists.txt
|
||||
index 5949e9f0..e7b677bd 100644
|
||||
--- a/contrib/db/libmdbx/packages/rpm/CMakeLists.txt
|
||||
+++ b/contrib/db/libmdbx/packages/rpm/CMakeLists.txt
|
||||
@@ -12,7 +12,7 @@ set(MDBX_VERSION_STRING ${MDBX_VERSION_MAJOR}.${MDBX_VERSION_MINOR}.${MDBX_VERSI
|
||||
enable_language(C)
|
||||
enable_language(CXX)
|
||||
|
||||
-set(CMAKE_CXX_STANDARD 11)
|
||||
+set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED on)
|
||||
|
||||
add_definitions(-DNDEBUG=1 -DMDBX_DEBUG=0 -DLIBMDBX_EXPORTS=1 -D_GNU_SOURCE=1)
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
From 9e55bde82de70a12d68249233d2d571bf388a409 Mon Sep 17 00:00:00 2001
|
||||
From: cyan <cyjan@mrcyjanek.net>
|
||||
Date: Sun, 3 Nov 2024 08:59:22 +0000
|
||||
Subject: [PATCH 2/7] fix mingw build issues
|
||||
|
||||
---
|
||||
contrib/epee/include/misc_os_dependent.h | 4 ++--
|
||||
src/common/callstack_helper.cpp | 2 +-
|
||||
src/crypto/ecrypt-config.h | 2 +-
|
||||
3 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/contrib/epee/include/misc_os_dependent.h b/contrib/epee/include/misc_os_dependent.h
|
||||
index c06e5d94..a2a979b9 100644
|
||||
--- a/contrib/epee/include/misc_os_dependent.h
|
||||
+++ b/contrib/epee/include/misc_os_dependent.h
|
||||
@@ -110,14 +110,14 @@ namespace misc_utils
|
||||
}
|
||||
|
||||
|
||||
-#if defined(__GNUC__) && !defined(__ANDROID__)
|
||||
+#if defined(__GNUC__) && !defined(__ANDROID__) && !defined(_WIN32)
|
||||
#include <execinfo.h>
|
||||
#include <boost/core/demangle.hpp>
|
||||
#endif
|
||||
inline std::string print_trace_default()
|
||||
{
|
||||
std::stringstream ss;
|
||||
-#if defined(__GNUC__) && !defined(__ANDROID__)
|
||||
+#if defined(__GNUC__) && !defined(__ANDROID__) && !defined(_WIN32)
|
||||
ss << std::endl << "STACK" << std::endl;
|
||||
const size_t max_depth = 100;
|
||||
size_t stack_depth;
|
||||
diff --git a/src/common/callstack_helper.cpp b/src/common/callstack_helper.cpp
|
||||
index b84fe5a8..c9eae839 100644
|
||||
--- a/src/common/callstack_helper.cpp
|
||||
+++ b/src/common/callstack_helper.cpp
|
||||
@@ -9,7 +9,7 @@
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
-#include <Psapi.h>
|
||||
+#include <psapi.h>
|
||||
#pragma comment(lib, "psapi.lib")
|
||||
#pragma comment(lib, "dbghelp.lib")
|
||||
|
||||
diff --git a/src/crypto/ecrypt-config.h b/src/crypto/ecrypt-config.h
|
||||
index 9176de17..8b488135 100644
|
||||
--- a/src/crypto/ecrypt-config.h
|
||||
+++ b/src/crypto/ecrypt-config.h
|
||||
@@ -257,7 +257,7 @@
|
||||
|
||||
#ifdef _UI64_MAX
|
||||
|
||||
-#if (_UI64_MAX / 0xFFFFFFFFui64 > 0xFFFFFFFFui64)
|
||||
+#if (_UI64_MAX / 0xFFFFFFFF > 0xFFFFFFFF)
|
||||
#ifndef I64T
|
||||
#define I64T __int64
|
||||
#define U64C(v) (v##ui64)
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
From 2eccbb7b4dfef6aef3de75ed843353343b2cc0c8 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Tue, 5 Nov 2024 16:52:23 +0100
|
||||
Subject: [PATCH 3/7] fix ios builds
|
||||
|
||||
---
|
||||
CMakeLists.txt | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index c480300f..7087d796 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -136,6 +136,8 @@ else()
|
||||
set(ARCH default CACHE STRING "CPU to build for: -march value or default")
|
||||
if("${ARCH}" STREQUAL "default")
|
||||
set(ARCH_FLAG "")
|
||||
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
+ set(ARCH_FLAG "")
|
||||
else()
|
||||
set(ARCH_FLAG "-march=${ARCH}")
|
||||
endif()
|
||||
@@ -207,7 +209,7 @@ else()
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
|
||||
if(STATIC)
|
||||
if(APPLE)
|
||||
- message(SEND_ERROR "Static build is not supported on MacOS X")
|
||||
+ message("Static build is not supported on MacOS X")
|
||||
else()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
||||
endif()
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
From 1ba500f05c1b534c9fbec8d1dc534546febb5b43 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Wed, 4 Dec 2024 17:21:44 -0600
|
||||
Subject: [PATCH 4/7] use boost::filesystem instead of stdfs
|
||||
|
||||
---
|
||||
CMakeLists.txt | 23 ++++-------------------
|
||||
contrib/epee/include/file_io_utils.h | 6 +++---
|
||||
2 files changed, 7 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 7087d796..6ded9711 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -232,24 +232,9 @@ if(STATIC)
|
||||
endif()
|
||||
|
||||
message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
|
||||
-if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
- set(CMAKE_OSX_DEPLOYMENT_TARGET 12.00)
|
||||
- if(NOT DEFINED SKIP_BOOST_FATLIB_LIB OR NOT SKIP_BOOST_FATLIB_LIB)
|
||||
- message("Ios: libboost.a included as library")
|
||||
- set(Boost_LIBRARIES "libboost.a")
|
||||
- else()
|
||||
- message("Ios: libboost.a not included as library")
|
||||
- endif()
|
||||
- #workaround for new XCode 12 policy for builds(now it includes a slice for the "arm64" when builds for simulator)
|
||||
- set(__iphoneos_archs "arm64")
|
||||
- #set(__iphonesimulator_archs "arm64,x86_64")
|
||||
- set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "${__iphoneos_archs}")
|
||||
- set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "${__iphoneos_archs}")
|
||||
- #set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "${__iphonesimulator_archs}")
|
||||
- #set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "${__iphonesimulator_archs}")
|
||||
-elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
+if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
if(CAKEWALLET)
|
||||
- find_package(Boost ${ZANO_BOOST_MIN_VER} REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options locale)
|
||||
+ find_package(Boost ${ZANO_BOOST_MIN_VER} REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options)
|
||||
else()
|
||||
set(Boost_LIBRARY_DIRS "${Boost_LIBRARY_DIRS}/${CMAKE_ANDROID_ARCH_ABI}/")
|
||||
set(Boost_LIBRARIES "${Boost_LIBRARY_DIRS}libboost_system.a;${Boost_LIBRARY_DIRS}libboost_filesystem.a;${Boost_LIBRARY_DIRS}libboost_thread.a;${Boost_LIBRARY_DIRS}libboost_timer.a;${Boost_LIBRARY_DIRS}libboost_date_time.a;${Boost_LIBRARY_DIRS}libboost_chrono.a;${Boost_LIBRARY_DIRS}libboost_regex.a;${Boost_LIBRARY_DIRS}libboost_serialization.a;${Boost_LIBRARY_DIRS}libboost_atomic.a;${Boost_LIBRARY_DIRS}libboost_program_options.a")
|
||||
@@ -257,7 +242,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fPIC")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fPIC")
|
||||
elseif(APPLE)
|
||||
- find_package(Boost ${ZANO_BOOST_MIN_VER} REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options locale)
|
||||
+ find_package(Boost ${ZANO_BOOST_MIN_VER} REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options)
|
||||
else()
|
||||
find_package(Boost ${ZANO_BOOST_MIN_VER} REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options locale log)
|
||||
endif()
|
||||
@@ -302,7 +287,7 @@ else()
|
||||
find_package(Git QUIET)
|
||||
if(Git_FOUND OR GIT_FOUND)
|
||||
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
|
||||
- add_custom_target(version ALL "${CMAKE_COMMAND}" "-D" "VERSION=${VERSION}" "-D" "GIT=${GIT_EXECUTABLE}" "-D" "TO=${CMAKE_BINARY_DIR}/version/version.h" "-P" "src/version.cmake" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
||||
+ add_custom_target(version ALL "${CMAKE_COMMAND}" "-D" "VERSION=${VERSION}" "-D" "GIT=${GIT_EXECUTABLE}" "-D" "TO=${CMAKE_BINARY_DIR}/version/version.h" "-P" "src/version.cmake" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
else()
|
||||
message(STATUS "WARNING: Git was not found!")
|
||||
set(VERSION "${VERSION}-unknown")
|
||||
diff --git a/contrib/epee/include/file_io_utils.h b/contrib/epee/include/file_io_utils.h
|
||||
index bb21ae99..ced01092 100644
|
||||
--- a/contrib/epee/include/file_io_utils.h
|
||||
+++ b/contrib/epee/include/file_io_utils.h
|
||||
@@ -574,10 +574,10 @@ namespace file_io_utils
|
||||
try
|
||||
{
|
||||
|
||||
- stdfs::directory_iterator end_itr; // default construction yields past-the-end
|
||||
- for (stdfs::directory_iterator itr( epee::string_encoding::utf8_to_wstring(path) ); itr != end_itr; ++itr )
|
||||
+ boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end
|
||||
+ for ( boost::filesystem::directory_iterator itr( epee::string_encoding::utf8_to_wstring(path) ); itr != end_itr; ++itr )
|
||||
{
|
||||
- if ( only_files && stdfs::is_directory(itr->status()) )
|
||||
+ if ( only_files && boost::filesystem::is_directory(itr->status()) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
From 00bfd0703db144cb51f667c183ff5d066dec2f9c Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Thu, 5 Dec 2024 09:36:34 -0600
|
||||
Subject: [PATCH 5/7] downgrade cmake version so LIB_DEPENDS shows up
|
||||
|
||||
---
|
||||
CMakeLists.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 6ded9711..47d24a81 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -1,4 +1,4 @@
|
||||
-cmake_minimum_required(VERSION 3.16)
|
||||
+cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
PROJECT(Zano)
|
||||
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
From cefa69627a46ec6fd54e3c44e82f1d777e3c98c0 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Thu, 12 Dec 2024 09:00:57 -0500
|
||||
Subject: [PATCH 6/7] increase max password
|
||||
|
||||
---
|
||||
src/currency_core/currency_format_utils.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/currency_core/currency_format_utils.cpp b/src/currency_core/currency_format_utils.cpp
|
||||
index 56316dd5..d92e5793 100644
|
||||
--- a/src/currency_core/currency_format_utils.cpp
|
||||
+++ b/src/currency_core/currency_format_utils.cpp
|
||||
@@ -3653,7 +3653,7 @@ namespace currency
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
- #define PASSWORD_REGEXP R"([A-Za-z0-9~!?@#$%^&*_+|{}\[\]()<>:;"'\-=/.,]{0,40})"
|
||||
+ #define PASSWORD_REGEXP R"([A-Za-z0-9~!?@#$%^&*_+|{}\[\]()<>:;"'\-=/.,]{0,2048})"
|
||||
bool validate_password(const std::string& password)
|
||||
{
|
||||
// OLD: static const std::string allowed_password_symbols = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!?@#$%^&*_+|{}[]()<>:;\"'-=\\/.,";
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
From af034097788cb58518b794c1312f8a8df297dda7 Mon Sep 17 00:00:00 2001
|
||||
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
|
||||
Date: Tue, 18 Feb 2025 14:27:36 +0100
|
||||
Subject: [PATCH 7/7] relax mutex in invoke call
|
||||
|
||||
---
|
||||
src/common/error_codes.h | 1 +
|
||||
src/wallet/wallets_manager.cpp | 37 ++++++++++++++++++++++++++++++----
|
||||
2 files changed, 34 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/common/error_codes.h b/src/common/error_codes.h
|
||||
index 1e3dc2ef..4723afe4 100644
|
||||
--- a/src/common/error_codes.h
|
||||
+++ b/src/common/error_codes.h
|
||||
@@ -45,3 +45,4 @@
|
||||
#define API_RETURN_CODE_HTLC_ORIGIN_HASH_MISSMATCHED "HTLC_ORIGIN_HASH_MISSMATCHED"
|
||||
#define API_RETURN_CODE_WRAP "WRAP"
|
||||
#define API_RETURN_CODE_MISSING_ZC_INPUTS "MISSING_ZC_INPUTS"
|
||||
+#define API_RETURN_CODE_BAD_JSON "BAD_JSON"
|
||||
\ No newline at end of file
|
||||
diff --git a/src/wallet/wallets_manager.cpp b/src/wallet/wallets_manager.cpp
|
||||
index 5c8ef5c0..4b968a18 100644
|
||||
--- a/src/wallet/wallets_manager.cpp
|
||||
+++ b/src/wallet/wallets_manager.cpp
|
||||
@@ -1678,10 +1678,27 @@ std::string wallets_manager::get_wallet_status(uint64_t wallet_id)
|
||||
return epee::serialization::store_t_to_json(wsi);
|
||||
}
|
||||
|
||||
+struct json_just_method
|
||||
+{
|
||||
+ std::string method;
|
||||
+ BEGIN_KV_SERIALIZE_MAP()
|
||||
+ KV_SERIALIZE(method)
|
||||
+ END_KV_SERIALIZE_MAP()
|
||||
+};
|
||||
+
|
||||
std::string wallets_manager::invoke(uint64_t wallet_id, std::string params)
|
||||
{
|
||||
GET_WALLET_OPT_BY_ID(wallet_id, wo);
|
||||
|
||||
+ json_just_method req = {};
|
||||
+ if (!epee::serialization::load_t_from_json(req, params))
|
||||
+ {
|
||||
+ epee::json_rpc::response<epee::json_rpc::dummy_result, epee::json_rpc::error> error_response = AUTO_VAL_INIT(error_response);
|
||||
+ error_response.error.code = -1;
|
||||
+ error_response.error.message = API_RETURN_CODE_BAD_JSON;
|
||||
+ return epee::serialization::store_t_to_json(error_response);
|
||||
+ }
|
||||
+
|
||||
CRITICAL_REGION_LOCAL1(wo.long_refresh_in_progress_lock);
|
||||
if (wo.long_refresh_in_progress)
|
||||
{
|
||||
@@ -1691,16 +1708,28 @@ std::string wallets_manager::invoke(uint64_t wallet_id, std::string params)
|
||||
return epee::serialization::store_t_to_json(error_response);
|
||||
}
|
||||
|
||||
-
|
||||
- auto locker_object = wo.w.lock();
|
||||
-
|
||||
epee::net_utils::http::http_request_info query_info = AUTO_VAL_INIT(query_info);
|
||||
epee::net_utils::http::http_response_info response_info = AUTO_VAL_INIT(response_info);
|
||||
epee::net_utils::connection_context_base stub_conn_context = AUTO_VAL_INIT(stub_conn_context);
|
||||
bool call_found = false;
|
||||
query_info.m_URI = "/json_rpc";
|
||||
query_info.m_body = params;
|
||||
- wo.rpc_wrapper->handle_http_request_map(query_info, response_info, stub_conn_context, call_found);
|
||||
+
|
||||
+ if (req.method != "assets_whitelist_get" &&
|
||||
+ req.method != "decrypt_data" &&
|
||||
+ req.method != "encrypt_data" &&
|
||||
+ req.method != "get_restore_info" &&
|
||||
+ req.method != "get_seed_phrase_info" &&
|
||||
+ req.method != "get_wallet_info" &&
|
||||
+ req.method != "getaddress" &&
|
||||
+ req.method != "getbalance" &&
|
||||
+ req.method != "sign_message") {
|
||||
+ auto locker_object = wo.w.lock();
|
||||
+ wo.rpc_wrapper->handle_http_request_map(query_info, response_info, stub_conn_context, call_found);
|
||||
+ } else {
|
||||
+ wo.rpc_wrapper->handle_http_request_map(query_info, response_info, stub_conn_context, call_found);
|
||||
+ }
|
||||
+
|
||||
return response_info.m_body;
|
||||
}
|
||||
|
||||
--
|
||||
2.48.1
|
||||
|
||||
Submodule
+1
Submodule peya added at a0162b4205
@@ -0,0 +1,144 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(wallet2_api_c)
|
||||
message(STATUS ABI_INFO = ${HOST_ABI})
|
||||
|
||||
set(MD_LIBRARY "")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
# set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE)
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-lto")
|
||||
|
||||
if(${HOST_ABI} STREQUAL "x86_64-w64-mingw32")
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_LINKER "x86_64-w64-mingw32-ld")
|
||||
set(TARGET "x86_64-w64-mingw32")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lssp")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lssp")
|
||||
elseif(${HOST_ABI} STREQUAL "i686-w64-mingw32")
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_LINKER "i686-w64-mingw32-ld")
|
||||
set(TARGET "i686-w64-mingw32")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lssp")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lssp")
|
||||
elseif(${HOST_ABI} STREQUAL "host-apple-ios" OR
|
||||
${HOST_ABI} STREQUAL "aarch64-apple-ios")
|
||||
set(CMAKE_SYSTEM_NAME iOS)
|
||||
elseif(${HOST_ABI} STREQUAL "host-apple-darwin" OR
|
||||
${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR
|
||||
${HOST_ABI} STREQUAL "aarch64-host-apple-darwin")
|
||||
set(CMAKE_SYSTEM_NAME Darwin)
|
||||
endif()
|
||||
|
||||
if (${HOST_ABI} STREQUAL "host-apple-darwin" OR
|
||||
${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR
|
||||
${HOST_ABI} STREQUAL "aarch64-host-apple-darwin")
|
||||
EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE )
|
||||
if (NOT ${ARCHITECTURE} STREQUAL arm64)
|
||||
set(CMAKE_OSX_ARCHITECTURES x86_64)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${HOST_ABI} STREQUAL "x86_64-linux-android" OR
|
||||
${HOST_ABI} STREQUAL "i686-linux-android" OR
|
||||
${HOST_ABI} STREQUAL "aarch64-linux-android" OR
|
||||
${HOST_ABI} STREQUAL "armv7a-linux-androideabi")
|
||||
add_link_options(-stdlib=libc++ -static-libstdc++)
|
||||
set(EXTRA_LIBS_ANDROID log)
|
||||
endif()
|
||||
|
||||
add_library( wallet2_api_c
|
||||
SHARED
|
||||
src/main/cpp/helpers.cpp
|
||||
src/main/cpp/wallet2_api_c.cpp )
|
||||
|
||||
if(${HOST_ABI} STREQUAL "x86_64-linux-android" OR
|
||||
${HOST_ABI} STREQUAL "i686-linux-android" OR
|
||||
${HOST_ABI} STREQUAL "aarch64-linux-android" OR
|
||||
${HOST_ABI} STREQUAL "armv7a-linux-androideabi")
|
||||
set_target_properties(wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,-z,noexecstack")
|
||||
endif()
|
||||
|
||||
if(${HOST_ABI} STREQUAL "x86_64-linux-gnu" OR
|
||||
${HOST_ABI} STREQUAL "i686-linux-gnu" OR
|
||||
${HOST_ABI} STREQUAL "aarch64-linux-gnu" OR
|
||||
${HOST_ABI} STREQUAL "armv7a-linux-gnu")
|
||||
set_target_properties(wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,-z,noexecstack")
|
||||
endif()
|
||||
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
|
||||
|
||||
|
||||
|
||||
set(MONERO_DIR ${CMAKE_SOURCE_DIR}/../${MONERO_FLAVOR})
|
||||
set(EXTERNAL_LIBS_DIR ${CMAKE_SOURCE_DIR}/../contrib/depends/${HOST_ABI})
|
||||
include_directories(${MONERO_DIR}/src)
|
||||
|
||||
if (${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin11")
|
||||
set(EXTRA_LIBS_APPLE "-framework IOKit" "-framework CoreFoundation" "-framework Cocoa" hidapi)
|
||||
# set_target_properties(wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,-F/Library/Frameworks")
|
||||
elseif(${HOST_ABI} STREQUAL "host-apple-darwin" OR
|
||||
${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR
|
||||
${HOST_ABI} STREQUAL "aarch64-host-apple-darwin")
|
||||
set(EXTRA_LIBS_APPLE "-framework IOKit" "-framework CoreFoundation" "-framework Cocoa" apple_nghttp2)
|
||||
elseif(${HOST_ABI} STREQUAL "host-apple-ios" OR ${HOST_ABI} STREQUAL "aarch64-apple-ios" OR ${HOST_ABI} STREQUAL "arm64-apple-ios" OR ${HOST_ABI} STREQUAL "arm64-apple-iossimulator" OR ${HOST_ABI} STREQUAL "x86_64-apple-iossimulator")
|
||||
set(EXTRA_LIBS_APPLE "-framework IOKit" "-framework CoreFoundation" iconv )
|
||||
endif()
|
||||
|
||||
if(${HOST_ABI} STREQUAL "x86_64-w64-mingw32" OR ${HOST_ABI} STREQUAL "i686-w64-mingw32")
|
||||
target_link_options(wallet2_api_c PRIVATE -static-libgcc -static-libstdc++)
|
||||
endif()
|
||||
|
||||
if(${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin11" OR ${HOST_ABI} STREQUAL "host-apple-darwin" OR ${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR ${HOST_ABI} STREQUAL "aarch64-host-apple-darwin" OR ${HOST_ABI} STREQUAL "host-apple-ios" OR ${HOST_ABI} STREQUAL "aarch64-apple-ios" OR ${HOST_ABI} STREQUAL "arm64-apple-iossimulator" OR ${HOST_ABI} STREQUAL "x86_64-apple-iossimulator")
|
||||
set_target_properties(wallet2_api_c PROPERTIES SUFFIX ".dylib")
|
||||
|
||||
set_target_properties(wallet2_api_c PROPERTIES NO_SONAME 1)
|
||||
endif()
|
||||
|
||||
if (${MONERO_FLAVOR} STREQUAL "monero")
|
||||
target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_MONERO)
|
||||
set(BCUR_ENABLED bc-ur)
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "peya")
|
||||
target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_PEYA)
|
||||
set(BCUR_ENABLED bc-ur)
|
||||
endif()
|
||||
|
||||
if(NOT ${HOST_ABI} STREQUAL "x86_64-apple-darwin11" AND NOT ${HOST_ABI} STREQUAL "aarch64-apple-darwin11" AND NOT ${HOST_ABI} STREQUAL "aarch64-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "x86_64-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "host-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "aarch64-host-apple-darwin" AND NOT ${HOST_ABI} STREQUAL "host-apple-ios" AND NOT ${HOST_ABI} STREQUAL "aarch64-apple-ios" AND NOT ${HOST_ABI} STREQUAL "aarch64-apple-iossimulator" AND NOT ${HOST_ABI} STREQUAL "x86_64-apple-iossimulator")
|
||||
set_target_properties(wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,--exclude-libs,ALL")
|
||||
endif()
|
||||
|
||||
add_subdirectory("${CMAKE_SOURCE_DIR}/../${MONERO_FLAVOR}" ${CMAKE_BINARY_DIR}/${MONERO_FLAVOR}_build EXCLUDE_FROM_ALL)
|
||||
if(${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin11" OR ${HOST_ABI} STREQUAL "x86_64-apple-darwin" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin" OR ${HOST_ABI} STREQUAL "host-apple-darwin" OR ${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR ${HOST_ABI} STREQUAL "aarch64-host-apple-darwin" OR ${HOST_ABI} STREQUAL "host-apple-ios" OR ${HOST_ABI} STREQUAL "aarch64-apple-ios" OR ${HOST_ABI} STREQUAL "aarch64-apple-iossimulator" OR ${HOST_ABI} STREQUAL "x86_64-apple-iossimulator")
|
||||
if (${MONERO_FLAVOR} STREQUAL "monero")
|
||||
set(EXPORTED_SYMBOLS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/monero_libwallet2_api_c.exp)
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "peya")
|
||||
set(EXPORTED_SYMBOLS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/peya_libwallet2_api_c.exp)
|
||||
endif()
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -exported_symbols_list ${EXPORTED_SYMBOLS_FILE}")
|
||||
set_target_properties(${TARGET} PROPERTIES LINK_DEPENDS ${EXPORTED_SYMBOLS_FILE})
|
||||
endif()
|
||||
|
||||
if (${MONERO_FLAVOR} STREQUAL "monero")
|
||||
set(WALLET_TARGETS wallet_api ${wallet_api_LIB_DEPENDS}) # wallet_api_LIB_DEPENDS
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "peya")
|
||||
set(WALLET_TARGETS wallet_api ${wallet_api_LIB_DEPENDS}) # wallet_api_LIB_DEPENDS
|
||||
endif()
|
||||
|
||||
#get_cmake_property(_variableNames VARIABLES)
|
||||
#list (SORT _variableNames)
|
||||
#foreach (_variableName ${_variableNames})
|
||||
# message(STATUS "${_variableName}=${${_variableName}}")
|
||||
#endforeach()
|
||||
#message(SEND_ERROR "${Boost_LIBRARIES}")
|
||||
#message(SEND_ERROR "${WALLET_TARGETS}
|
||||
# ${EXTRA_LIBS_WOWNEROSEED}
|
||||
# ${EXTRA_LIBS_ANDROID}")
|
||||
|
||||
target_link_libraries( wallet2_api_c
|
||||
|
||||
${WALLET_TARGETS}
|
||||
${EXTRA_LIBS_ANDROID}
|
||||
)
|
||||
@@ -0,0 +1,323 @@
|
||||
_PEYA_PendingTransaction_status
|
||||
_PEYA_PendingTransaction_errorString
|
||||
_PEYA_PendingTransaction_commit
|
||||
_PEYA_PendingTransaction_commitUR
|
||||
_PEYA_PendingTransaction_amount
|
||||
_PEYA_PendingTransaction_dust
|
||||
_PEYA_PendingTransaction_fee
|
||||
_PEYA_PendingTransaction_txid
|
||||
_PEYA_PendingTransaction_txCount
|
||||
_PEYA_PendingTransaction_subaddrAccount
|
||||
_PEYA_PendingTransaction_subaddrIndices
|
||||
_PEYA_PendingTransaction_multisigSignData
|
||||
_PEYA_PendingTransaction_signMultisigTx
|
||||
_PEYA_PendingTransaction_signersKeys
|
||||
_PEYA_PendingTransaction_hex
|
||||
_PEYA_UnsignedTransaction_status
|
||||
_PEYA_UnsignedTransaction_errorString
|
||||
_PEYA_UnsignedTransaction_amount
|
||||
_PEYA_UnsignedTransaction_fee
|
||||
_PEYA_UnsignedTransaction_mixin
|
||||
_PEYA_UnsignedTransaction_confirmationMessage
|
||||
_PEYA_UnsignedTransaction_paymentId
|
||||
_PEYA_UnsignedTransaction_recipientAddress
|
||||
_PEYA_UnsignedTransaction_minMixinCount
|
||||
_PEYA_UnsignedTransaction_txCount
|
||||
_PEYA_UnsignedTransaction_sign
|
||||
_PEYA_UnsignedTransaction_signUR
|
||||
_PEYA_TransactionInfo_asset
|
||||
_PEYA_TransactionInfo_direction
|
||||
_PEYA_TransactionInfo_isPending
|
||||
_PEYA_TransactionInfo_isFailed
|
||||
_PEYA_TransactionInfo_isCoinbase
|
||||
_PEYA_TransactionInfo_type
|
||||
_PEYA_TransactionInfo_amount
|
||||
_PEYA_TransactionInfo_fee
|
||||
_PEYA_TransactionInfo_blockHeight
|
||||
_PEYA_TransactionInfo_description
|
||||
_PEYA_TransactionInfo_subaddrIndex
|
||||
_PEYA_TransactionInfo_subaddrAccount
|
||||
_PEYA_TransactionInfo_label
|
||||
_PEYA_TransactionInfo_confirmations
|
||||
_PEYA_TransactionInfo_unlockTime
|
||||
_PEYA_TransactionInfo_hash
|
||||
_PEYA_TransactionInfo_timestamp
|
||||
_PEYA_TransactionInfo_paymentId
|
||||
_PEYA_TransactionInfo_returnAddresses_count
|
||||
_PEYA_TransactionInfo_returnAddresses_at
|
||||
_PEYA_TransactionInfo_transfers_count
|
||||
_PEYA_TransactionInfo_transfers_amount
|
||||
_PEYA_TransactionInfo_transfers_address
|
||||
_PEYA_TransactionHistory_count
|
||||
_PEYA_TransactionHistory_transaction
|
||||
_PEYA_TransactionHistory_transactionById
|
||||
_PEYA_TransactionHistory_refresh
|
||||
_PEYA_TransactionHistory_setTxNote
|
||||
_PEYA_AddressBookRow_extra
|
||||
_PEYA_AddressBookRow_getAddress
|
||||
_PEYA_AddressBookRow_getDescription
|
||||
_PEYA_AddressBookRow_getPaymentId
|
||||
_PEYA_AddressBookRow_getRowId
|
||||
_PEYA_AddressBook_getAll_size
|
||||
_PEYA_AddressBook_getAll_byIndex
|
||||
_PEYA_AddressBook_addRow
|
||||
_PEYA_AddressBook_deleteRow
|
||||
_PEYA_AddressBook_setDescription
|
||||
_PEYA_AddressBook_refresh
|
||||
_PEYA_AddressBook_errorString
|
||||
_PEYA_AddressBook_errorCode
|
||||
_PEYA_AddressBook_lookupPaymentID
|
||||
_PEYA_CoinsInfo_blockHeight
|
||||
_PEYA_CoinsInfo_hash
|
||||
_PEYA_CoinsInfo_internalOutputIndex
|
||||
_PEYA_CoinsInfo_globalOutputIndex
|
||||
_PEYA_CoinsInfo_spent
|
||||
_PEYA_CoinsInfo_frozen
|
||||
_PEYA_CoinsInfo_spentHeight
|
||||
_PEYA_CoinsInfo_amount
|
||||
_PEYA_CoinsInfo_type
|
||||
_PEYA_CoinsInfo_rct
|
||||
_PEYA_CoinsInfo_keyImageKnown
|
||||
_PEYA_CoinsInfo_pkIndex
|
||||
_PEYA_CoinsInfo_subaddrIndex
|
||||
_PEYA_CoinsInfo_subaddrAccount
|
||||
_PEYA_CoinsInfo_address
|
||||
_PEYA_CoinsInfo_addressLabel
|
||||
_PEYA_CoinsInfo_keyImage
|
||||
_PEYA_CoinsInfo_unlockTime
|
||||
_PEYA_CoinsInfo_unlocked
|
||||
_PEYA_CoinsInfo_pubKey
|
||||
_PEYA_CoinsInfo_coinbase
|
||||
_PEYA_CoinsInfo_description
|
||||
_PEYA_CoinsInfo_asset
|
||||
_PEYA_Coins_count
|
||||
_PEYA_Coins_coin
|
||||
_PEYA_Coins_getAll_size
|
||||
_PEYA_Coins_getAll_byIndex
|
||||
_PEYA_Coins_refresh
|
||||
_PEYA_Coins_setFrozenByPublicKey
|
||||
_PEYA_Coins_setFrozen
|
||||
_PEYA_Coins_thaw
|
||||
_PEYA_Coins_thawByPublicKey
|
||||
_PEYA_Coins_isTransferUnlocked
|
||||
_PEYA_Coins_setDescription
|
||||
_PEYA_SubaddressRow_extra
|
||||
_PEYA_SubaddressRow_getAddress
|
||||
_PEYA_SubaddressRow_getLabel
|
||||
_PEYA_SubaddressRow_getRowId
|
||||
_PEYA_Subaddress_getAll_size
|
||||
_PEYA_Subaddress_getAll_byIndex
|
||||
_PEYA_Subaddress_addRow
|
||||
_PEYA_Subaddress_setLabel
|
||||
_PEYA_Subaddress_refresh
|
||||
_PEYA_SubaddressAccountRow_extra
|
||||
_PEYA_SubaddressAccountRow_getAddress
|
||||
_PEYA_SubaddressAccountRow_getLabel
|
||||
_PEYA_SubaddressAccountRow_getBalance
|
||||
_PEYA_SubaddressAccountRow_getUnlockedBalance
|
||||
_PEYA_SubaddressAccountRow_getRowId
|
||||
_PEYA_SubaddressAccount_getAll_size
|
||||
_PEYA_SubaddressAccount_getAll_byIndex
|
||||
_PEYA_SubaddressAccount_addRow
|
||||
_PEYA_SubaddressAccount_setLabel
|
||||
_PEYA_SubaddressAccount_refresh
|
||||
_PEYA_MultisigState_isMultisig
|
||||
_PEYA_MultisigState_isReady
|
||||
_PEYA_MultisigState_threshold
|
||||
_PEYA_MultisigState_total
|
||||
_PEYA_DeviceProgress_progress
|
||||
_PEYA_DeviceProgress_indeterminate
|
||||
_PEYA_Wallet_seed
|
||||
_PEYA_Wallet_setStoreTxInfo
|
||||
_PEYA_Wallet_getStoreTxInfo
|
||||
_PEYA_Wallet_setLedgerCallback
|
||||
_PEYA_Wallet_serializeCacheToJson
|
||||
_PEYA_Wallet_getSeedLanguage
|
||||
_PEYA_Wallet_setSeedLanguage
|
||||
_PEYA_Wallet_status
|
||||
_PEYA_Wallet_errorString
|
||||
_PEYA_Wallet_setPassword
|
||||
_PEYA_Wallet_getPassword
|
||||
_PEYA_Wallet_setDevicePin
|
||||
_PEYA_Wallet_setDevicePassphrase
|
||||
_PEYA_Wallet_address
|
||||
_PEYA_Wallet_path
|
||||
_PEYA_Wallet_nettype
|
||||
_PEYA_Wallet_useForkRules
|
||||
_PEYA_Wallet_integratedAddress
|
||||
_PEYA_Wallet_secretViewKey
|
||||
_PEYA_Wallet_publicViewKey
|
||||
_PEYA_Wallet_secretSpendKey
|
||||
_PEYA_Wallet_publicSpendKey
|
||||
_PEYA_Wallet_publicMultisigSignerKey
|
||||
_PEYA_Wallet_secretViewBalance
|
||||
_PEYA_Wallet_secretProveSpend
|
||||
_PEYA_Wallet_secretGenerateAddress
|
||||
_PEYA_Wallet_secretGenerateImage
|
||||
_PEYA_Wallet_stop
|
||||
_PEYA_Wallet_store
|
||||
_PEYA_Wallet_filename
|
||||
_PEYA_Wallet_keysFilename
|
||||
_PEYA_Wallet_init
|
||||
_PEYA_Wallet_createWatchOnly
|
||||
_PEYA_Wallet_setRefreshFromBlockHeight
|
||||
_PEYA_Wallet_getRefreshFromBlockHeight
|
||||
_PEYA_Wallet_setRecoveringFromSeed
|
||||
_PEYA_Wallet_setRecoveringFromDevice
|
||||
_PEYA_Wallet_setSubaddressLookahead
|
||||
_PEYA_Wallet_connectToDaemon
|
||||
_PEYA_Wallet_connected
|
||||
_PEYA_Wallet_setTrustedDaemon
|
||||
_PEYA_Wallet_trustedDaemon
|
||||
_PEYA_Wallet_setProxy
|
||||
_PEYA_Wallet_balance
|
||||
_PEYA_Wallet_unlockedBalance
|
||||
_PEYA_Wallet_viewOnlyBalance
|
||||
_PEYA_Wallet_watchOnly
|
||||
_PEYA_Wallet_isDeterministic
|
||||
_PEYA_Wallet_blockChainHeight
|
||||
_PEYA_Wallet_approximateBlockChainHeight
|
||||
_PEYA_Wallet_estimateBlockChainHeight
|
||||
_PEYA_Wallet_daemonBlockChainHeight
|
||||
_PEYA_Wallet_daemonBlockChainTargetHeight
|
||||
_PEYA_Wallet_synchronized
|
||||
_PEYA_Wallet_displayAmount
|
||||
_PEYA_Wallet_amountFromString
|
||||
_PEYA_Wallet_amountFromDouble
|
||||
_PEYA_Wallet_genPaymentId
|
||||
_PEYA_Wallet_paymentIdValid
|
||||
_PEYA_Wallet_addressValid
|
||||
_PEYA_Wallet_keyValid
|
||||
_PEYA_Wallet_keyValid_error
|
||||
_PEYA_Wallet_paymentIdFromAddress
|
||||
_PEYA_Wallet_maximumAllowedAmount
|
||||
_PEYA_Wallet_init3
|
||||
_PEYA_Wallet_getPolyseed
|
||||
_PEYA_Wallet_createPolyseed
|
||||
_PEYA_Wallet_startRefresh
|
||||
_PEYA_Wallet_pauseRefresh
|
||||
_PEYA_Wallet_refresh
|
||||
_PEYA_Wallet_refreshAsync
|
||||
_PEYA_Wallet_rescanBlockchain
|
||||
_PEYA_Wallet_rescanBlockchainAsync
|
||||
_PEYA_Wallet_setAutoRefreshInterval
|
||||
_PEYA_Wallet_autoRefreshInterval
|
||||
_PEYA_Wallet_addSubaddressAccount
|
||||
_PEYA_Wallet_numSubaddressAccounts
|
||||
_PEYA_Wallet_numSubaddresses
|
||||
_PEYA_Wallet_addSubaddress
|
||||
_PEYA_Wallet_getSubaddressLabel
|
||||
_PEYA_Wallet_setSubaddressLabel
|
||||
_PEYA_Wallet_multisig
|
||||
_PEYA_Wallet_getMultisigInfo
|
||||
_PEYA_Wallet_makeMultisig
|
||||
_PEYA_Wallet_exchangeMultisigKeys
|
||||
_PEYA_Wallet_exportMultisigImages
|
||||
_PEYA_Wallet_importMultisigImages
|
||||
_PEYA_Wallet_hasMultisigPartialKeyImages
|
||||
_PEYA_Wallet_restoreMultisigTransaction
|
||||
_PEYA_Wallet_createTransactionMultDest
|
||||
_PEYA_Wallet_createTransaction
|
||||
_PEYA_Wallet_createStakeTransaction
|
||||
_PEYA_Wallet_loadUnsignedTx
|
||||
_PEYA_Wallet_loadUnsignedTxUR
|
||||
_PEYA_Wallet_submitTransaction
|
||||
_PEYA_Wallet_submitTransactionUR
|
||||
_PEYA_Wallet_hasUnknownKeyImages
|
||||
_PEYA_Wallet_exportKeyImages
|
||||
_PEYA_Wallet_exportKeyImagesUR
|
||||
_PEYA_Wallet_importKeyImages
|
||||
_PEYA_Wallet_importKeyImagesUR
|
||||
_PEYA_Wallet_exportOutputs
|
||||
_PEYA_Wallet_exportOutputsUR
|
||||
_PEYA_Wallet_importOutputs
|
||||
_PEYA_Wallet_importOutputsUR
|
||||
_PEYA_Wallet_setupBackgroundSync
|
||||
_PEYA_Wallet_getBackgroundSyncType
|
||||
_PEYA_Wallet_startBackgroundSync
|
||||
_PEYA_Wallet_stopBackgroundSync
|
||||
_PEYA_Wallet_isBackgroundSyncing
|
||||
_PEYA_Wallet_isBackgroundWallet
|
||||
_PEYA_Wallet_history
|
||||
_PEYA_Wallet_addressBook
|
||||
_PEYA_Wallet_coins
|
||||
_PEYA_Wallet_subaddress
|
||||
_PEYA_Wallet_subaddressAccount
|
||||
_PEYA_Wallet_defaultMixin
|
||||
_PEYA_Wallet_setDefaultMixin
|
||||
_PEYA_Wallet_setCacheAttribute
|
||||
_PEYA_Wallet_getCacheAttribute
|
||||
_PEYA_Wallet_setUserNote
|
||||
_PEYA_Wallet_getUserNote
|
||||
_PEYA_Wallet_getTxKey
|
||||
_PEYA_Wallet_signMessage
|
||||
_PEYA_Wallet_verifySignedMessage
|
||||
_PEYA_Wallet_rescanSpent
|
||||
_PEYA_Wallet_setOffline
|
||||
_PEYA_Wallet_isOffline
|
||||
_PEYA_Wallet_segregatePreForkOutputs
|
||||
_PEYA_Wallet_segregationHeight
|
||||
_PEYA_Wallet_keyReuseMitigation2
|
||||
_PEYA_Wallet_lockKeysFile
|
||||
_PEYA_Wallet_unlockKeysFile
|
||||
_PEYA_Wallet_isKeysFileLocked
|
||||
_PEYA_Wallet_getDeviceType
|
||||
_PEYA_Wallet_coldKeyImageSync
|
||||
_PEYA_Wallet_deviceShowAddress
|
||||
_PEYA_Wallet_reconnectDevice
|
||||
_PEYA_Wallet_getBytesReceived
|
||||
_PEYA_Wallet_getBytesSent
|
||||
_PEYA_Wallet_getStateIsConnected
|
||||
_PEYA_Wallet_getSendToDevice
|
||||
_PEYA_Wallet_getSendToDeviceLength
|
||||
_PEYA_Wallet_getReceivedFromDevice
|
||||
_PEYA_Wallet_getReceivedFromDeviceLength
|
||||
_PEYA_Wallet_getWaitsForDeviceSend
|
||||
_PEYA_Wallet_getWaitsForDeviceReceive
|
||||
_PEYA_Wallet_setDeviceReceivedData
|
||||
_PEYA_Wallet_setDeviceSendData
|
||||
_PEYA_WalletManager_createWallet
|
||||
_PEYA_WalletManager_openWallet
|
||||
_PEYA_WalletManager_recoveryWallet
|
||||
_PEYA_WalletManager_createWalletFromKeys
|
||||
_PEYA_WalletManager_createDeterministicWalletFromSpendKey
|
||||
_PEYA_WalletManager_createWalletFromDevice
|
||||
_PEYA_WalletManager_createWalletFromPolyseed
|
||||
_PEYA_WalletManager_closeWallet
|
||||
_PEYA_WalletManager_walletExists
|
||||
_PEYA_WalletManager_verifyWalletPassword
|
||||
_PEYA_WalletManager_queryWalletDevice
|
||||
_PEYA_WalletManager_findWallets
|
||||
_PEYA_WalletManager_errorString
|
||||
_PEYA_WalletManager_setDaemonAddress
|
||||
_PEYA_WalletManager_blockchainHeight
|
||||
_PEYA_WalletManager_blockchainTargetHeight
|
||||
_PEYA_WalletManager_networkDifficulty
|
||||
_PEYA_WalletManager_miningHashRate
|
||||
_PEYA_WalletManager_blockTarget
|
||||
_PEYA_WalletManager_isMining
|
||||
_PEYA_WalletManager_startMining
|
||||
_PEYA_WalletManager_stopMining
|
||||
_PEYA_WalletManager_resolveOpenAlias
|
||||
_PEYA_WalletManager_setProxy
|
||||
_PEYA_WalletManagerFactory_getWalletManager
|
||||
_PEYA_WalletManagerFactory_setLogLevel
|
||||
_PEYA_WalletManagerFactory_setLogCategories
|
||||
_PEYA_DEBUG_test0
|
||||
_PEYA_DEBUG_test1
|
||||
_PEYA_DEBUG_test2
|
||||
_PEYA_DEBUG_test3
|
||||
_PEYA_DEBUG_test4
|
||||
_PEYA_DEBUG_test5
|
||||
_PEYA_DEBUG_test5_std
|
||||
_PEYA_DEBUG_isPointerNull
|
||||
_PEYA_cw_getWalletListener
|
||||
_PEYA_cw_WalletListener_resetNeedToRefresh
|
||||
_PEYA_cw_WalletListener_isNeedToRefresh
|
||||
_PEYA_cw_WalletListener_isNewTransactionExist
|
||||
_PEYA_cw_WalletListener_resetIsNewTransactionExist
|
||||
_PEYA_cw_WalletListener_height
|
||||
_PEYA_free
|
||||
_PEYA_checksum_wallet2_api_c_h
|
||||
_PEYA_checksum_wallet2_api_c_cpp
|
||||
_PEYA_checksum_wallet2_api_c_exp
|
||||
@@ -0,0 +1,273 @@
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "helpers.hpp"
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
#include <thread>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include <android/log.h>
|
||||
|
||||
#define LOG_TAG "moneroc"
|
||||
#define BUFFER_SIZE 1024*32
|
||||
|
||||
static int stdoutToLogcat(const char *buf, int size) {
|
||||
__android_log_write(ANDROID_LOG_INFO, LOG_TAG, buf);
|
||||
return size;
|
||||
}
|
||||
|
||||
static int stderrToLogcat(const char *buf, int size) {
|
||||
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, buf);
|
||||
return size;
|
||||
}
|
||||
|
||||
void redirectStdoutThread(int pipe_stdout[2]) {
|
||||
char bufferStdout[BUFFER_SIZE];
|
||||
while (true) {
|
||||
int read_size = read(pipe_stdout[0], bufferStdout, sizeof(bufferStdout) - 1);
|
||||
if (read_size > 0) {
|
||||
bufferStdout[read_size] = '\0';
|
||||
stdoutToLogcat(bufferStdout, read_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void redirectStderrThread(int pipe_stderr[2]) {
|
||||
char bufferStderr[BUFFER_SIZE];
|
||||
while (true) {
|
||||
int read_size = read(pipe_stderr[0], bufferStderr, sizeof(bufferStderr) - 1);
|
||||
if (read_size > 0) {
|
||||
bufferStderr[read_size] = '\0';
|
||||
stderrToLogcat(bufferStderr, read_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setupAndroidLogging() {
|
||||
static int pfdStdout[2];
|
||||
static int pfdStderr[2];
|
||||
|
||||
pipe(pfdStdout);
|
||||
pipe(pfdStderr);
|
||||
|
||||
dup2(pfdStdout[1], STDOUT_FILENO);
|
||||
dup2(pfdStderr[1], STDERR_FILENO);
|
||||
|
||||
std::thread stdoutThread(redirectStdoutThread, pfdStdout);
|
||||
std::thread stderrThread(redirectStderrThread, pfdStderr);
|
||||
|
||||
stdoutThread.detach();
|
||||
stderrThread.detach();
|
||||
}
|
||||
|
||||
#endif // __ANDROID__
|
||||
|
||||
__attribute__((constructor))
|
||||
void library_init() {
|
||||
#ifdef __ANDROID__
|
||||
setupAndroidLogging(); // This will now run automatically when the library is loaded
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* vectorToString(const std::vector<std::string>& vec, const std::string separator) {
|
||||
// Check if the vector is empty
|
||||
if (vec.empty()) {
|
||||
char *buffer = new char[1];
|
||||
buffer[0] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// Concatenate all strings in the vector
|
||||
std::string result;
|
||||
for (size_t i = 0; i < vec.size() - 1; ++i) {
|
||||
result += vec[i];
|
||||
result += separator;
|
||||
}
|
||||
result += vec.back(); // Append the last string without the separator
|
||||
|
||||
std::string str = result;
|
||||
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;
|
||||
}
|
||||
|
||||
const char* vectorToString(const std::vector<uint32_t>& vec, const std::string separator) {
|
||||
if (vec.empty()) {
|
||||
char *buffer = new char[1];
|
||||
buffer[0] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
// Calculate the size needed for the result string
|
||||
size_t size = 0;
|
||||
for (size_t i = 0; i < vec.size(); ++i) {
|
||||
// Calculate the number of digits in each element
|
||||
size += snprintf(nullptr, 0, "%u", vec[i]);
|
||||
// Add comma and space for all elements except the last one
|
||||
if (i < vec.size() - 1) {
|
||||
size += separator.size(); // comma and space
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate memory for the result string
|
||||
char* result = new char[size + 1];
|
||||
|
||||
// Fill in the result string
|
||||
char* current = result;
|
||||
for (size_t i = 0; i < vec.size(); ++i) {
|
||||
// Convert each element to string and copy to the result string
|
||||
int written = snprintf(current, size + 1, "%u", vec[i]);
|
||||
current += written;
|
||||
// Add comma and space for all elements except the last one
|
||||
if (i < vec.size() - 1) {
|
||||
strcpy(current, separator.c_str());
|
||||
current += separator.size();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* vectorToString(const std::vector<uint64_t>& vec, const std::string separator) {
|
||||
if (vec.empty()) {
|
||||
char *buffer = new char[1];
|
||||
buffer[0] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
// Calculate the size needed for the result string
|
||||
size_t size = 0;
|
||||
for (size_t i = 0; i < vec.size(); ++i) {
|
||||
// Calculate the number of digits in each element
|
||||
size += snprintf(nullptr, 0, "%llu", vec[i]);
|
||||
// Add comma and space for all elements except the last one
|
||||
if (i < vec.size() - 1) {
|
||||
size += separator.size(); // comma and space
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate memory for the result string
|
||||
char* result = new char[size + 1];
|
||||
|
||||
// Fill in the result string
|
||||
char* current = result;
|
||||
for (size_t i = 0; i < vec.size(); ++i) {
|
||||
// Convert each element to string and copy to the result string
|
||||
int written = snprintf(current, size + 1, "%llu", vec[i]);
|
||||
current += written;
|
||||
// Add comma and space for all elements except the last one
|
||||
if (i < vec.size() - 1) {
|
||||
strcpy(current, separator.c_str());
|
||||
current += separator.size();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* vectorToString(const std::vector<std::set<uint32_t>>& vec, const std::string separator) {
|
||||
// Check if the vector is empty
|
||||
if (vec.empty()) {
|
||||
char *buffer = new char[1];
|
||||
buffer[0] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// Use a stringstream to concatenate sets with commas and individual elements with spaces
|
||||
std::ostringstream oss;
|
||||
oss << "{";
|
||||
for (auto it = vec.begin(); it != vec.end(); ++it) {
|
||||
if (it != vec.begin()) {
|
||||
oss << separator;
|
||||
}
|
||||
|
||||
oss << "{";
|
||||
for (auto setIt = it->begin(); setIt != it->end(); ++setIt) {
|
||||
if (setIt != it->begin()) {
|
||||
oss << separator;
|
||||
}
|
||||
oss << *setIt;
|
||||
}
|
||||
oss << "}";
|
||||
}
|
||||
oss << "}";
|
||||
std::string str = oss.str();
|
||||
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;
|
||||
}
|
||||
|
||||
// Function to convert std::set<uint32_t> to a string
|
||||
const char* vectorToString(const std::set<uint32_t>& intSet, const std::string separator) {
|
||||
// Check if the set is empty
|
||||
if (intSet.empty()) {
|
||||
char *buffer = new char[1];
|
||||
buffer[0] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// Use a stringstream to concatenate elements with commas
|
||||
std::ostringstream oss;
|
||||
auto it = intSet.begin();
|
||||
oss << *it;
|
||||
for (++it; it != intSet.end(); ++it) {
|
||||
oss << ", " << *it;
|
||||
}
|
||||
|
||||
std::string str = oss.str();
|
||||
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;
|
||||
}
|
||||
|
||||
std::set<std::string> splitString(const std::string& str, const std::string& delim) {
|
||||
std::set<std::string> tokens;
|
||||
if (str.empty()) return tokens;
|
||||
size_t pos = 0;
|
||||
std::string token;
|
||||
std::string content = str; // Copy of str so we can safely erase content
|
||||
while ((pos = content.find(delim)) != std::string::npos) {
|
||||
token = content.substr(0, pos);
|
||||
tokens.insert(token);
|
||||
content.erase(0, pos + delim.length());
|
||||
}
|
||||
tokens.insert(content); // Inserting the last token
|
||||
return tokens;
|
||||
}
|
||||
|
||||
std::vector<std::string> splitStringVector(const std::string& str, const std::string& delim) {
|
||||
std::vector<std::string> tokens;
|
||||
if (str.empty()) return tokens;
|
||||
size_t pos = 0;
|
||||
std::string content = str; // Copy of str so we can safely erase content
|
||||
while ((pos = content.find(delim)) != std::string::npos) {
|
||||
tokens.push_back(content.substr(0, pos));
|
||||
content.erase(0, pos + delim.length());
|
||||
}
|
||||
tokens.push_back(content); // Inserting the last token
|
||||
return tokens;
|
||||
}
|
||||
|
||||
std::vector<uint64_t> splitStringUint(const std::string& str, const std::string& delim) {
|
||||
std::vector<uint64_t> tokens;
|
||||
if (str.empty()) return tokens;
|
||||
size_t pos = 0;
|
||||
std::string token;
|
||||
std::string content = str; // Copy of str so we can safely erase content
|
||||
while ((pos = content.find(delim)) != std::string::npos) {
|
||||
token = content.substr(0, pos);
|
||||
tokens.push_back(std::stoull(token)); // Convert string to uint64_t and push to vector
|
||||
content.erase(0, pos + delim.length());
|
||||
}
|
||||
tokens.push_back(std::stoull(content)); // Inserting the last token
|
||||
return tokens;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
// Debug macros
|
||||
#define DEBUG_START() \
|
||||
try {
|
||||
|
||||
#define DEBUG_END() \
|
||||
} catch (const std::exception &e) { \
|
||||
std::cerr << "Exception caught in function: " << __FUNCTION__ \
|
||||
<< " at " << __FILE__ << ":" << __LINE__ << std::endl \
|
||||
<< "Message: " << e.what() << std::endl; \
|
||||
std::abort(); \
|
||||
} catch (...) { \
|
||||
std::cerr << "Unknown exception caught in function: " << __FUNCTION__ \
|
||||
<< " at " << __FILE__ << ":" << __LINE__ << std::endl; \
|
||||
std::abort(); \
|
||||
}
|
||||
|
||||
|
||||
const char* vectorToString(const std::vector<std::string>& vec, const std::string separator);
|
||||
const char* vectorToString(const std::vector<uint32_t>& vec, const std::string separator);
|
||||
const char* vectorToString(const std::vector<uint64_t>& vec, const std::string separator);
|
||||
const char* vectorToString(const std::vector<std::set<uint32_t>>& vec, const std::string separator);
|
||||
const char* vectorToString(const std::set<uint32_t>& intSet, const std::string separator);
|
||||
std::set<std::string> splitString(const std::string& str, const std::string& delim);
|
||||
std::vector<uint64_t> splitStringUint(const std::string& str, const std::string& delim);
|
||||
std::vector<std::string> splitStringVector(const std::string& str, const std::string& delim);
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef MONEROC_CHECKSUMS
|
||||
#define MONEROC_CHECKSUMS
|
||||
const char * PEYA_wallet2_api_c_h_sha256 = "abfc67892fa12c69b7871ed5db0de819b7d6f1a270b2d9f3b0340d95e43bf8a7";
|
||||
const char * PEYA_wallet2_api_c_cpp_sha256 = "5aeae36dc0d58a38d1ac61fc027c3c3f10f4331284f27833fdd3146e12d010b5-cf5969b5dd96d78d5bcc8a2fe97c9e6522c781a5";
|
||||
const char * PEYA_wallet2_api_c_exp_sha256 = "31b4f92a01ff4812c46e5978c0195f725fe93c87bcd8036391a12fe9d5774621";
|
||||
#endif
|
||||
+770
-435
File diff suppressed because it is too large
Load Diff
+356
-292
File diff suppressed because it is too large
Load Diff
+1
-1
Submodule salvium updated: 119a7fab57...42ec3826a0
@@ -99,10 +99,6 @@ endif()
|
||||
if (${MONERO_FLAVOR} STREQUAL "monero")
|
||||
target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_MONERO)
|
||||
set(BCUR_ENABLED bc-ur)
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "wownero")
|
||||
target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_WOWNERO)
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "zano")
|
||||
target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_ZANO)
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "salvium")
|
||||
target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_SALVIUM)
|
||||
set(BCUR_ENABLED bc-ur)
|
||||
@@ -112,20 +108,10 @@ if(NOT ${HOST_ABI} STREQUAL "x86_64-apple-darwin11" AND NOT ${HOST_ABI} STREQUAL
|
||||
set_target_properties(wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,--exclude-libs,ALL")
|
||||
endif()
|
||||
|
||||
if (${MONERO_FLAVOR} STREQUAL "zano")
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/build/${HOST_ABI}/zano_build/contrib/zlib
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectory("${CMAKE_SOURCE_DIR}/../${MONERO_FLAVOR}" ${CMAKE_BINARY_DIR}/${MONERO_FLAVOR}_build EXCLUDE_FROM_ALL)
|
||||
if(${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin11" OR ${HOST_ABI} STREQUAL "x86_64-apple-darwin" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin" OR ${HOST_ABI} STREQUAL "host-apple-darwin" OR ${HOST_ABI} STREQUAL "x86_64-host-apple-darwin" OR ${HOST_ABI} STREQUAL "aarch64-host-apple-darwin" OR ${HOST_ABI} STREQUAL "host-apple-ios" OR ${HOST_ABI} STREQUAL "aarch64-apple-ios" OR ${HOST_ABI} STREQUAL "aarch64-apple-iossimulator" OR ${HOST_ABI} STREQUAL "x86_64-apple-iossimulator")
|
||||
if (${MONERO_FLAVOR} STREQUAL "monero")
|
||||
set(EXPORTED_SYMBOLS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/monero_libwallet2_api_c.exp)
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "wownero")
|
||||
set(EXPORTED_SYMBOLS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/wownero_libwallet2_api_c.exp)
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "zano")
|
||||
set(EXPORTED_SYMBOLS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/zano_libwallet2_api_c.exp)
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "salvium")
|
||||
set(EXPORTED_SYMBOLS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/salvium_libwallet2_api_c.exp)
|
||||
endif()
|
||||
@@ -136,31 +122,10 @@ endif()
|
||||
|
||||
if (${MONERO_FLAVOR} STREQUAL "monero")
|
||||
set(WALLET_TARGETS wallet_api ${wallet_api_LIB_DEPENDS}) # wallet_api_LIB_DEPENDS
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "wownero")
|
||||
set(WALLET_TARGETS wallet_api ${wallet_api_LIB_DEPENDS}) # wallet_api_LIB_DEPENDS
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "zano")
|
||||
find_package(Boost 1.71 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
set(WALLET_TARGETS
|
||||
wallet
|
||||
general
|
||||
tor-connect
|
||||
crypto
|
||||
currency_core
|
||||
common
|
||||
zlibstatic
|
||||
|
||||
${Boost_LIBRARIES}
|
||||
${OpenSSL_LIBRARIES})
|
||||
elseif(${MONERO_FLAVOR} STREQUAL "salvium")
|
||||
set(WALLET_TARGETS wallet_api ${wallet_api_LIB_DEPENDS}) # wallet_api_LIB_DEPENDS
|
||||
endif()
|
||||
|
||||
if(${MONERO_FLAVOR} STREQUAL "wownero")
|
||||
add_subdirectory(wownero-seed EXCLUDE_FROM_ALL)
|
||||
set(EXTRA_LIBS_WOWNEROSEED wownero-seed)
|
||||
endif()
|
||||
|
||||
#get_cmake_property(_variableNames VARIABLES)
|
||||
#list (SORT _variableNames)
|
||||
#foreach (_variableName ${_variableNames})
|
||||
@@ -174,6 +139,5 @@ endif()
|
||||
target_link_libraries( wallet2_api_c
|
||||
|
||||
${WALLET_TARGETS}
|
||||
${EXTRA_LIBS_WOWNEROSEED}
|
||||
${EXTRA_LIBS_ANDROID}
|
||||
)
|
||||
|
||||
@@ -43,6 +43,8 @@ _SALVIUM_TransactionInfo_unlockTime
|
||||
_SALVIUM_TransactionInfo_hash
|
||||
_SALVIUM_TransactionInfo_timestamp
|
||||
_SALVIUM_TransactionInfo_paymentId
|
||||
_SALVIUM_TransactionInfo_returnAddresses_count
|
||||
_SALVIUM_TransactionInfo_returnAddresses_at
|
||||
_SALVIUM_TransactionInfo_transfers_count
|
||||
_SALVIUM_TransactionInfo_transfers_amount
|
||||
_SALVIUM_TransactionInfo_transfers_address
|
||||
@@ -126,6 +128,8 @@ _SALVIUM_MultisigState_total
|
||||
_SALVIUM_DeviceProgress_progress
|
||||
_SALVIUM_DeviceProgress_indeterminate
|
||||
_SALVIUM_Wallet_seed
|
||||
_SALVIUM_Wallet_setStoreTxInfo
|
||||
_SALVIUM_Wallet_getStoreTxInfo
|
||||
_SALVIUM_Wallet_setLedgerCallback
|
||||
_SALVIUM_Wallet_serializeCacheToJson
|
||||
_SALVIUM_Wallet_getSeedLanguage
|
||||
|
||||
@@ -80,7 +80,9 @@ void library_init() {
|
||||
const char* vectorToString(const std::vector<std::string>& vec, const std::string separator) {
|
||||
// Check if the vector is empty
|
||||
if (vec.empty()) {
|
||||
return "";
|
||||
char *buffer = new char[1];
|
||||
buffer[0] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// Concatenate all strings in the vector
|
||||
@@ -99,6 +101,11 @@ const char* vectorToString(const std::vector<std::string>& vec, const std::strin
|
||||
}
|
||||
|
||||
const char* vectorToString(const std::vector<uint32_t>& vec, const std::string separator) {
|
||||
if (vec.empty()) {
|
||||
char *buffer = new char[1];
|
||||
buffer[0] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
// Calculate the size needed for the result string
|
||||
size_t size = 0;
|
||||
for (size_t i = 0; i < vec.size(); ++i) {
|
||||
@@ -111,11 +118,7 @@ const char* vectorToString(const std::vector<uint32_t>& vec, const std::string s
|
||||
}
|
||||
|
||||
// Allocate memory for the result string
|
||||
char* result = static_cast<char*>(malloc(size + 1));
|
||||
if (result == nullptr) {
|
||||
// Handle memory allocation failure
|
||||
return nullptr;
|
||||
}
|
||||
char* result = new char[size + 1];
|
||||
|
||||
// Fill in the result string
|
||||
char* current = result;
|
||||
@@ -134,6 +137,11 @@ const char* vectorToString(const std::vector<uint32_t>& vec, const std::string s
|
||||
}
|
||||
|
||||
const char* vectorToString(const std::vector<uint64_t>& vec, const std::string separator) {
|
||||
if (vec.empty()) {
|
||||
char *buffer = new char[1];
|
||||
buffer[0] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
// Calculate the size needed for the result string
|
||||
size_t size = 0;
|
||||
for (size_t i = 0; i < vec.size(); ++i) {
|
||||
@@ -146,11 +154,7 @@ const char* vectorToString(const std::vector<uint64_t>& vec, const std::string s
|
||||
}
|
||||
|
||||
// Allocate memory for the result string
|
||||
char* result = static_cast<char*>(malloc(size + 1));
|
||||
if (result == nullptr) {
|
||||
// Handle memory allocation failure
|
||||
return nullptr;
|
||||
}
|
||||
char* result = new char[size + 1];
|
||||
|
||||
// Fill in the result string
|
||||
char* current = result;
|
||||
@@ -171,7 +175,9 @@ const char* vectorToString(const std::vector<uint64_t>& vec, const std::string s
|
||||
const char* vectorToString(const std::vector<std::set<uint32_t>>& vec, const std::string separator) {
|
||||
// Check if the vector is empty
|
||||
if (vec.empty()) {
|
||||
return "";
|
||||
char *buffer = new char[1];
|
||||
buffer[0] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// Use a stringstream to concatenate sets with commas and individual elements with spaces
|
||||
@@ -203,7 +209,9 @@ const char* vectorToString(const std::vector<std::set<uint32_t>>& vec, const std
|
||||
const char* vectorToString(const std::set<uint32_t>& intSet, const std::string separator) {
|
||||
// Check if the set is empty
|
||||
if (intSet.empty()) {
|
||||
return "";
|
||||
char *buffer = new char[1];
|
||||
buffer[0] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// Use a stringstream to concatenate elements with commas
|
||||
@@ -262,4 +270,4 @@ std::vector<uint64_t> splitStringUint(const std::string& str, const std::string&
|
||||
}
|
||||
tokens.push_back(std::stoull(content)); // Inserting the last token
|
||||
return tokens;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#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";
|
||||
const char * SALVIUM_wallet2_api_c_h_sha256 = "e058d5ca0dc56bc7c40b55f6428a86bd14dd5b4308c03854ef6a1099aa09d107";
|
||||
const char * SALVIUM_wallet2_api_c_cpp_sha256 = "c40f623ef0801ceccba760d49176d84122c683e4f832e304372b9c931a02ed25-42ec3826a079af4411ed2632b9e469d428e884ae";
|
||||
const char * SALVIUM_wallet2_api_c_exp_sha256 = "8743a9af4dd98eb5288829226d8815b8f91ad1bd48db10488e65f4b1983549d8";
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user