Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
MONERO_C_TAG=v0.18.4.0-RC7
COIN=monero
MONERO_C_TAG=99aa531f9c7180805e59dd52f6dde95d5c55ab0d
MONERO_C_PREBUILD_TAG=v0.18.4.6-RC2
COIN=monero
2 changes: 1 addition & 1 deletion .fvmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"flutter": "3.32.0"
"flutter": "3.41.9"
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ missing_translations.txt

# FVM Version Cache
.fvm/
*.g.dart
*.g.dart

android/.kotlin/sessions/*.salive
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"dart.flutterSdkPath": ".fvm/versions/3.32.0"
"dart.flutterSdkPath": ".fvm/versions/3.41.9"
}
26 changes: 12 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
include .env
UNAME := $(shell uname)
MONERO_C_PREBUILD_TAG ?= $(MONERO_C_TAG)

all: libs_android_build libs_ios_build prepare_dev

init:
git submodule update --init --recursive

libs_android_download: mwebd_android
./build_moneroc.sh --prebuild --coin ${COIN} --tag ${MONERO_C_TAG} --triplet x86_64-linux-android --location android/app/src/main/jniLibs/x86_64
./build_moneroc.sh --prebuild --coin ${COIN} --tag ${MONERO_C_TAG} --triplet aarch64-linux-android --location android/app/src/main/jniLibs/arm64-v8a
./build_moneroc.sh --prebuild --coin ${COIN} --tag ${MONERO_C_TAG} --triplet armv7a-linux-androideabi --location android/app/src/main/jniLibs/armeabi-v7a
./build_moneroc.sh --prebuild --coin ${COIN} --tag ${MONERO_C_TAG} --prebuild-tag ${MONERO_C_PREBUILD_TAG} --triplet x86_64-linux-android --location android/app/src/main/jniLibs/x86_64
./build_moneroc.sh --prebuild --coin ${COIN} --tag ${MONERO_C_TAG} --prebuild-tag ${MONERO_C_PREBUILD_TAG} --triplet aarch64-linux-android --location android/app/src/main/jniLibs/arm64-v8a
./build_moneroc.sh --prebuild --coin ${COIN} --tag ${MONERO_C_TAG} --prebuild-tag ${MONERO_C_PREBUILD_TAG} --triplet armv7a-linux-androideabi --location android/app/src/main/jniLibs/armeabi-v7a

libs_android_build: mwebd_android
ifneq ($(UNAME), Linux)
echo Only Linux hosts can build for android, try $(MAKE) libs_android_download
exit 1
endif
./build_moneroc.sh --coin ${COIN} --tag ${MONERO_C_TAG} --triplet x86_64-linux-android --location android/app/src/main/jniLibs/x86_64
./build_moneroc.sh --coin ${COIN} --tag ${MONERO_C_TAG} --triplet aarch64-linux-android --location android/app/src/main/jniLibs/arm64-v8a
./build_moneroc.sh --coin ${COIN} --tag ${MONERO_C_TAG} --triplet armv7a-linux-androideabi --location android/app/src/main/jniLibs/armeabi-v7a
Expand All @@ -19,17 +21,13 @@ libs_android_build_ci: mwebd_android
./build_moneroc.sh --coin ${COIN} --tag ${MONERO_C_TAG} --triplet aarch64-linux-android --location android/app/src/main/jniLibs/arm64-v8a

libs_ios_download: mwebd_ios
./build_moneroc.sh --prebuild --coin ${COIN} --tag ${MONERO_C_TAG} --triplet aarch64-apple-ios --location ios/native_libs/ios-arm64
./build_moneroc.sh --prebuild --coin ${COIN} --tag ${MONERO_C_TAG} --triplet aarch64-apple-iossimulator --location ios/native_libs/ios-arm64-simulator
./build_moneroc.sh --prebuild --coin ${COIN} --tag ${MONERO_C_TAG} --prebuild-tag ${MONERO_C_PREBUILD_TAG} --triplet aarch64-apple-ios --location ios/native_libs/ios-arm64
./build_moneroc.sh --prebuild --coin ${COIN} --tag ${MONERO_C_TAG} --prebuild-tag ${MONERO_C_PREBUILD_TAG} --triplet aarch64-apple-ios-simulator --location ios/native_libs/ios-arm64-simulator
cd ios && ./gen_framework.sh

libs_ios_build: mwebd_ios
ifneq ($(UNAME), Darwin)
echo Only Darwin hosts can build for iOS, try $(MAKE) libs_ios_download
exit 1
endif
./build_moneroc.sh --coin ${COIN} --tag ${MONERO_C_TAG} --triplet aarch64-apple-ios --location ios/native_libs/ios-arm64
./build_moneroc.sh --coin ${COIN} --tag ${MONERO_C_TAG} --triplet aarch64-apple-iossimulator --location ios/native_libs/ios-arm64-simulator
./build_moneroc.sh --coin ${COIN} --tag ${MONERO_C_TAG} --triplet aarch64-apple-ios-simulator --location ios/native_libs/ios-arm64-simulator
cd ios && ./gen_framework.sh

cupcake_android:
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
To build:

```bash
$ make libs_android_build # or libs_android_download, libs_ios_build, libs_ios_download
$ make prepare_dev # load dev signing key (not required on iOS)
$ make init # fetch the submodules
$ make all # or libs_android_build, libs_android_download, libs_ios_build, libs_ios_download
$ make prepare_dev # not needed if ran `make all`
$ make cupcake_android # or cupcake_ios
```

Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ android {
applicationId "com.cakewallet.cupcake"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 23
minSdkVersion flutter.minSdkVersion
targetSdkVersion 36
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/jniLibs/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
libmonero_libwallet2_api_c.so
libmonero_*wallet2_api_c.so
3 changes: 2 additions & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
org.gradle.jvmargs=-Xmx4G
org.gradle.jvmargs=-Xmx6G
android.useAndroidX=true
android.enableJetifier=true
android.ndk.suppressMinSdkVersionError=21
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '8.8.0' apply false
id "com.android.application" version '8.9.1' apply false
id "org.jetbrains.kotlin.android" version "2.0.21" apply false
}

Expand Down
118 changes: 97 additions & 21 deletions build_moneroc.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/bash

# Script designed to build (or download) monero_c
# usage:
# ./build_moneroc.sh
# usage:
# ./build_moneroc.sh
# --prebuild - allow downloads of prebuilds
# --coin - monero/wownero
# --tag v0.18.3.3-RC45 - which tag to build / download
# --tag v0.18.3.3-RC45 - tag, branch, or commit to check out
# --prebuild-tag v0.18.4.6-RC2 - GitHub release to download libs from (defaults to --tag)
# --triplet x86_64-linux-android - which triplet to build / download
# --location android/app/src/main/jniLibs/x86_64 - where to but the libraries
# source: github.com/mrcyjanek/unnamed_monero_wallet
Expand All @@ -18,6 +19,7 @@ POSITIONAL_ARGS=()
ARG_PREBUILD=""
ARG_COIN=""
ARG_TAG=""
ARG_PREBUILD_TAG=""
ARG_TRIPLET=""
ARG_LOCATION=""

Expand All @@ -32,6 +34,11 @@ while [[ $# -gt 0 ]]; do
shift
shift
;;
--prebuild-tag)
ARG_PREBUILD_TAG="$2"
shift
shift
;;
--triplet)
ARG_TRIPLET="$2"
shift
Expand Down Expand Up @@ -62,10 +69,21 @@ set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters

if [[ "x$ARG_TAG" == "x" || "x$ARG_TRIPLET" == "x" || "x$ARG_LOCATION" == "x" || "x$ARG_COIN" == "x" ]];
then
head -11 "$0" | tail -9
head -12 "$0" | tail -10
exit 1
fi

# --branch only accepts tags/branches. Fetch the ref so commit SHAs work too.
function checkout_moneroc() {
local dest="$1"
rm -rf "${dest}"
mkdir -p "${dest}"
git -C "${dest}" init
git -C "${dest}" remote add origin https://github.com/mrcyjanek/monero_c
git -C "${dest}" fetch --depth=1 origin "${ARG_TAG}"
git -C "${dest}" checkout --force FETCH_HEAD
}

if [[ "${ARG_TRIPLET}" == *android* ]];
then
lib_name_prefix=lib
Expand All @@ -85,23 +103,81 @@ fi

if [[ ! "x$ARG_PREBUILD" == "x" ]];
then
BUILD_DIR="$PWD/.cache/monero_c/${ARG_TAG}"
if [[ ! -d "${BUILD_DIR}/impls" ]];
then
checkout_moneroc "${BUILD_DIR}"
fi

RELEASE_TAG="${ARG_PREBUILD_TAG:-$ARG_TAG}"
# download prebuild
GH_JSON="$(curl --retry 12 --retry-all-errors -L -o- 'https://api.github.com/repos/MrCyjaneK/monero_c/releases/tags/'"${ARG_TAG}" | tr -d '\r')"
for release_url in $(echo "$GH_JSON" | jq -r '.assets[].browser_download_url' | tr -d '\r' | xargs)
GH_JSON="$(curl --retry 12 --retry-all-errors -L -o- 'https://api.github.com/repos/MrCyjaneK/monero_c/releases/tags/'"${RELEASE_TAG}" | tr -d '\r')"
ASSET_URLS="$(echo "$GH_JSON" | jq -r '.assets[]?.browser_download_url' | tr -d '\r' | xargs)"
if [[ "x$ASSET_URLS" == "x" ]];
then
echo "No release assets for tag '${RELEASE_TAG}'; --prebuild needs a GitHub release (set --prebuild-tag if --tag is a commit)"
exit 1
fi

BUNDLE_URL=""
for release_url in $ASSET_URLS
do
asset_basename=$(urldecode $(basename $release_url) | tr -d '\r' | xargs)
if [[ "$asset_basename" == ${ARG_COIN}_${ARG_TRIPLET}* ]];
then
if [[ "$asset_basename" == *libwallet2_api_c* ]];
if [[ "$(basename $release_url)" == "release-bundle.zip" ]];
then
BUNDLE_URL="$release_url"
fi
done

if [[ ! "x$BUNDLE_URL" == "x" ]];
then
BUNDLE_DIR="$PWD/.cache/monero_c/prebuild/${RELEASE_TAG}"
mkdir -p "$BUNDLE_DIR"
if [[ ! -f "$BUNDLE_DIR/release-bundle.zip" ]];
then
curl --retry 12 --retry-all-errors -L "$BUNDLE_URL" -o "$BUNDLE_DIR/release-bundle.zip.part"
mv "$BUNDLE_DIR/release-bundle.zip.part" "$BUNDLE_DIR/release-bundle.zip"
fi

rm -rf "$BUNDLE_DIR/${ARG_TRIPLET}"
unzip -q -o "$BUNDLE_DIR/release-bundle.zip" \
"*/${ARG_TRIPLET}/lib${ARG_COIN}_wallet2_api_c.*" \
-d "$BUNDLE_DIR/${ARG_TRIPLET}" || true

FOUND=""
for release in "$BUNDLE_DIR/${ARG_TRIPLET}"/*/"${ARG_TRIPLET}"/lib${ARG_COIN}_wallet2_api_c.*
do
[[ -f "$release" ]] || continue
FOUND="ON"
asset_basename="$(basename $release)"
if [[ "${ARG_TRIPLET}" == *-apple-ios* ]];
then
curl -L "$release_url" > "$ARG_LOCATION/$lib_name_prefix${asset_basename/${ARG_TRIPLET}_/}"
unxz -f "$ARG_LOCATION/$lib_name_prefix${asset_basename/${ARG_TRIPLET}_/}"
cp "$release" "$ARG_LOCATION/${ARG_COIN}_libwallet2_api_c.${asset_basename##*.}"
else
curl -L "$release_url" > "$ARG_LOCATION/${asset_basename/${ARG_COIN}_${ARG_TRIPLET}_/}"
unxz -f "$ARG_LOCATION/${asset_basename/${ARG_COIN}_${ARG_TRIPLET}_/}"
cp "$release" "$ARG_LOCATION/$asset_basename"
fi
done
if [[ "x$FOUND" == "x" ]];
then
echo "release-bundle.zip of '${RELEASE_TAG}' has no ${ARG_COIN} library for ${ARG_TRIPLET}"
exit 1
fi
done
else
for release_url in $ASSET_URLS
do
asset_basename=$(urldecode $(basename $release_url) | tr -d '\r' | xargs)
if [[ "$asset_basename" == ${ARG_COIN}_${ARG_TRIPLET}* ]];
then
if [[ "$asset_basename" == *libwallet2_api_c* ]];
then
curl -L "$release_url" > "$ARG_LOCATION/$lib_name_prefix${asset_basename/${ARG_TRIPLET}_/}"
unxz -f "$ARG_LOCATION/$lib_name_prefix${asset_basename/${ARG_TRIPLET}_/}" || true
else
curl -L "$release_url" > "$ARG_LOCATION/${asset_basename/${ARG_COIN}_${ARG_TRIPLET}_/}"
unxz -f "$ARG_LOCATION/${asset_basename/${ARG_COIN}_${ARG_TRIPLET}_/}" || true
fi
fi
done
fi
else
# build from source
BUILD_DIR="$PWD/.cache/monero_c/${ARG_TAG}"
Expand All @@ -120,23 +196,23 @@ else
fi
COPIED=""

if ! ls ${BUILD_DIR}/release/${ARG_COIN}/${ARG_TRIPLET}_libwallet2_api_c*.xz
if ! ls ${BUILD_DIR}/release/${ARG_COIN}/${ARG_TRIPLET}_libwallet2_api_c*
then
pushd "$BUILD_DIR"
./build_single.sh ${ARG_COIN} ${ARG_TRIPLET} -j$(nproc)
env -i PATH="$PATH" HOME="$HOME" ./build_single.sh ${ARG_COIN} ${ARG_TRIPLET} -j$(nproc)
popd
fi

for release in ${BUILD_DIR}/release/${ARG_COIN}/${ARG_TRIPLET}_*.xz;
for release in ${BUILD_DIR}/release/${ARG_COIN}/${ARG_TRIPLET}_*;
do
asset_basename="$(basename $release)"
if [[ "$asset_basename" == *libwallet2_api_c* ]];
then
cp "$release" "$ARG_LOCATION/$lib_name_prefix${ARG_COIN}_${asset_basename/${ARG_TRIPLET}_/}"
unxz -f "$ARG_LOCATION/$lib_name_prefix${ARG_COIN}_${asset_basename/${ARG_TRIPLET}_/}"
unxz -f "$ARG_LOCATION/$lib_name_prefix${ARG_COIN}_${asset_basename/${ARG_TRIPLET}_/}" || true
else
cp "$release" "$ARG_LOCATION/${asset_basename/${ARG_TRIPLET}_/}"
unxz -f "$ARG_LOCATION/${asset_basename/${ARG_TRIPLET}_/}"
unxz -f "$ARG_LOCATION/${asset_basename/${ARG_TRIPLET}_/}" || true
fi
done
fi
fi
2 changes: 1 addition & 1 deletion external/cake_wallet
Submodule cake_wallet updated 2314 files
3 changes: 1 addition & 2 deletions l10n.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
synthetic-package: false
untranslated-messages-file: missing_translations.txt
untranslated-messages-file: missing_translations.txt
5 changes: 5 additions & 0 deletions lib/coins/bitcoin/wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:cupcake/coins/bitcoin/address.dart';
import 'package:cupcake/coins/bitcoin/amount.dart';
import 'package:cupcake/coins/bitcoin/coin.dart';
import 'package:cupcake/coins/bitcoin/wallet_info.dart';
import 'package:cupcake/utils/psbt.dart';
import 'package:cupcake/utils/types.dart';
import 'package:cupcake/utils/urqr.dart';
import 'package:cupcake/views/animated_qr_page.dart';
Expand Down Expand Up @@ -43,6 +44,9 @@ class BDKWalletWrapper {
wallet.sign(
psbt: psbt,
signOptions: SignOptions(
// Offline signer has no UTXO DB.
// Witness utxo is required to sign.
// Fee display warns when input amounts cannot be cross-checked.
trustWitnessUtxo: true,
allowAllSighashes: true,
removePartialSigs: false,
Expand Down Expand Up @@ -138,6 +142,7 @@ class BitcoinWallet implements CoinWallet {
wallet: this,
destMap: destMap,
fee: BitcoinAmount(psbt.feeAmount()?.toInt() ?? -1),
warnings: psbtConfirmationWarnings(psbt.serialize()),
confirmCallback: (final BuildContext context) async {
final status = await wallet.sign(psbt: psbt);
if (!status) throw Exception("Failed to sign");
Expand Down
Loading
Loading