Skip to content

Commit 69558f2

Browse files
authored
Merge branch 'cypherstack:staging' into cl_coinselect
2 parents 98633ec + ea92006 commit 69558f2

10 files changed

Lines changed: 297 additions & 16 deletions

.github/workflows/build-ci-image.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ jobs:
4040
cache-from: type=gha
4141
cache-to: type=gha,mode=max
4242

43+
- name: Build and push android image
44+
uses: docker/build-push-action@v7
45+
with:
46+
context: .
47+
target: android
48+
push: true
49+
tags: ${{ env.GHCR_IMAGE }}:android
50+
cache-from: type=gha
51+
cache-to: type=gha,mode=max
52+
4353
- name: Build and push test image
4454
uses: docker/build-push-action@v7
4555
with:

.github/workflows/build.yaml

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
contents: read
103103
packages: read
104104
container:
105-
image: ghcr.io/${{ github.repository_owner }}/stackwallet-ci:latest
105+
image: ghcr.io/${{ github.repository_owner }}/stackwallet-ci:android
106106
credentials:
107107
username: ${{ github.actor }}
108108
password: ${{ github.token }}
@@ -190,6 +190,12 @@ jobs:
190190
- name: Build APKs
191191
run: flutter build apk --split-per-abi --release
192192

193+
- name: Clean intermediates before AAB
194+
run: |
195+
rm -rf build/app/intermediates
196+
rm -rf build/app/tmp
197+
find build -name '*.o' -delete 2>/dev/null || true
198+
193199
- name: Build AAB
194200
run: flutter build appbundle --release
195201

@@ -484,9 +490,76 @@ jobs:
484490
name: stack_wallet-ios-aarch64-${{ steps.ver.outputs.version }}
485491
path: stack_wallet-ios-aarch64-${{ steps.ver.outputs.version }}.ipa
486492

493+
build-flatpak:
494+
runs-on: ubuntu-24.04
495+
needs: build-linux
496+
steps:
497+
- uses: actions/checkout@v6
498+
499+
- name: Set version
500+
id: ver
501+
run: |
502+
if [ "${{ github.ref_type }}" = "tag" ]; then
503+
VERSION="${{ github.ref_name }}"
504+
VERSION="${VERSION#v}"
505+
elif [ -n "${{ inputs.version }}" ]; then
506+
VERSION="${{ inputs.version }}"
507+
else
508+
VERSION="0.0.0-staging.${{ github.run_number }}"
509+
fi
510+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
511+
512+
- name: Download Linux bundle
513+
uses: actions/download-artifact@v4
514+
with:
515+
name: stack_wallet-linux-x86_64-${{ steps.ver.outputs.version }}
516+
517+
- name: Stage bundle and icon
518+
run: |
519+
tar -xzf "stack_wallet-linux-x86_64-${{ steps.ver.outputs.version }}.tar.gz" -C flatpak/
520+
cp asset_sources/icon/stack_wallet/icon.png flatpak/com.cypherstack.stackwallet.png
521+
522+
- name: Install Flatpak tools
523+
run: |
524+
sudo apt-get update -q
525+
sudo apt-get install -y flatpak flatpak-builder
526+
527+
- name: Set up Flathub remote
528+
run: flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
529+
530+
- name: Cache Flatpak SDK
531+
uses: actions/cache@v4
532+
with:
533+
path: ~/.local/share/flatpak
534+
key: flatpak-freedesktop-24.08-v1
535+
536+
- name: Install Flatpak SDK
537+
run: |
538+
flatpak install --user --noninteractive flathub \
539+
org.freedesktop.Platform//24.08 \
540+
org.freedesktop.Sdk//24.08
541+
542+
- name: Build Flatpak
543+
run: |
544+
flatpak-builder --user --force-clean \
545+
--repo=flatpak-repo \
546+
build-flatpak flatpak/com.cypherstack.stackwallet.yaml
547+
548+
- name: Bundle Flatpak
549+
run: |
550+
flatpak build-bundle flatpak-repo \
551+
--runtime-repo=https://flathub.org/repo/flathub.flatpakrepo \
552+
"stack_wallet-linux-x86_64-${{ steps.ver.outputs.version }}.flatpak" \
553+
com.cypherstack.stackwallet
554+
555+
- uses: actions/upload-artifact@v4
556+
with:
557+
name: stack_wallet-flatpak-x86_64-${{ steps.ver.outputs.version }}
558+
path: stack_wallet-linux-x86_64-${{ steps.ver.outputs.version }}.flatpak
559+
487560
release:
488561
if: github.ref_type == 'tag'
489-
needs: [build-linux, build-android, build-windows, build-macos, build-ios]
562+
needs: [build-linux, build-android, build-windows, build-macos, build-ios, build-flatpak]
490563
runs-on: ubuntu-latest
491564
permissions:
492565
contents: write
@@ -503,7 +576,7 @@ jobs:
503576
name=$(basename "$dir")
504577
(cd "$dir" && zip -r "../../release-files/${name}.zip" .)
505578
done
506-
find artifacts/ \( -name "*.tar.gz" -o -name "*.zip" -o -name "*.ipa" \) -mindepth 2 -exec mv {} release-files/ \;
579+
find artifacts/ \( -name "*.tar.gz" -o -name "*.zip" -o -name "*.ipa" -o -name "*.flatpak" \) -mindepth 2 -exec mv {} release-files/ \;
507580
find artifacts/ -name "*.apk" -mindepth 2 -exec mv {} release-files/ \;
508581
509582
- uses: softprops/action-gh-release@v2

.github/workflows/test.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,21 @@ jobs:
4343
env:
4444
CHANGE_NOW: ${{ secrets.CHANGE_NOW }}
4545
run: |
46-
echo "$CHANGE_NOW" | base64 --decode > lib/external_api_keys.dart
46+
if [ -n "$CHANGE_NOW" ]; then
47+
echo "$CHANGE_NOW" | base64 --decode > lib/external_api_keys.dart
48+
else
49+
cat > lib/external_api_keys.dart << 'EOF'
50+
const String kChangeNowApiKey = "";
51+
const String kSimpleSwapApiKey = "";
52+
const String kNanswapApiKey = "";
53+
const String kNanoSwapRpcApiKey = "";
54+
const String kWizSwapApiKey = "";
55+
const kShopInBitAccessKey = "";
56+
const kShopInBitPartnerSecret = "";
57+
const kCakePayApiToken = "";
58+
const kExolixApiKey = "";
59+
EOF
60+
fi
4761
4862
- name: Ensure app config for tests
4963
run: bash scripts/ensure_test_app_config.sh

Dockerfile

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,85 @@ RUN git config --system --add safe.directory '*'
8888
RUN flutter --version && rustc --version && cargo --version && node --version && go version
8989

9090

91+
# Android-only image: no Linux/Windows cross-compilers, no OpenCV/OpenCL, single Rust toolchain with android targets
92+
FROM ubuntu:24.04 AS android
93+
94+
ENV DEBIAN_FRONTEND=noninteractive \
95+
TZ=Etc/UTC \
96+
LANG=C.UTF-8 \
97+
LC_ALL=C.UTF-8
98+
99+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
100+
101+
RUN apt-get update && apt-get install -y --no-install-recommends \
102+
ca-certificates curl file git gnupg python3 sudo unzip xz-utils \
103+
build-essential cmake ninja-build pkg-config \
104+
libssl-dev zlib1g-dev \
105+
openjdk-21-jdk-headless \
106+
&& rm -rf /var/lib/apt/lists/*
107+
108+
ENV RUSTUP_HOME=/usr/local/rustup \
109+
CARGO_HOME=/usr/local/cargo \
110+
PATH=/usr/local/cargo/bin:$PATH
111+
112+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
113+
| sh -s -- -y --default-toolchain 1.89.0 --profile minimal --no-modify-path \
114+
&& rustup target add \
115+
aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android \
116+
--toolchain 1.89.0 \
117+
&& cargo install cargo-ndk \
118+
&& chmod -R a+rwX "$CARGO_HOME" "$RUSTUP_HOME"
119+
120+
ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64
121+
122+
ENV ANDROID_SDK_ROOT=/opt/android-sdk \
123+
ANDROID_HOME=/opt/android-sdk \
124+
ANDROID_NDK_ROOT=/opt/android-sdk/ndk/28.2.13676358 \
125+
ANDROID_NDK_HOME=/opt/android-sdk/ndk/28.2.13676358 \
126+
PATH=/opt/android-sdk/cmdline-tools/latest/bin:/opt/android-sdk/platform-tools:$PATH
127+
128+
RUN mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" \
129+
&& curl -fsSL https://dl.google.com/android/repository/commandlinetools-linux-14742923_latest.zip \
130+
-o /tmp/cmdline-tools.zip \
131+
&& echo "48833c34b761c10cb20bcd16582129395d121b27 /tmp/cmdline-tools.zip" | sha1sum -c \
132+
&& unzip -q /tmp/cmdline-tools.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" \
133+
&& mv "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest" \
134+
&& rm /tmp/cmdline-tools.zip \
135+
&& mkdir -p "$ANDROID_SDK_ROOT/licenses" \
136+
&& printf '\n24333f8a63b6825ea9c5514f83c2829b004d1fee\n8933bad161af4178b1185d1a37fbf41ea5269c55d7b9237478ea8ec3307c27e4' \
137+
> "$ANDROID_SDK_ROOT/licenses/android-sdk-license" \
138+
&& printf '\n84831b9409646a918e30573bab4c9c91346d8abd' \
139+
> "$ANDROID_SDK_ROOT/licenses/android-sdk-preview-license" \
140+
&& printf '\n859f317696f67ef3d7f30a50a5560e7834b43903' \
141+
> "$ANDROID_SDK_ROOT/licenses/android-sdk-arm-dbt-license" \
142+
&& sdkmanager \
143+
"platform-tools" \
144+
"build-tools;35.0.0" \
145+
"platforms;android-35" \
146+
"ndk;28.2.13676358" \
147+
&& chmod -R a+rwX "$ANDROID_SDK_ROOT"
148+
149+
ENV PATH=/usr/local/go/bin:$PATH
150+
151+
RUN curl -fsSL https://go.dev/dl/go1.24.13.linux-amd64.tar.gz -o /tmp/go.tar.gz \
152+
&& echo "1fc94b57134d51669c72173ad5d49fd62afb0f1db9bf3f798fd98ee423f8d730 /tmp/go.tar.gz" | sha256sum -c \
153+
&& tar -C /usr/local -xzf /tmp/go.tar.gz \
154+
&& rm /tmp/go.tar.gz
155+
156+
ENV FLUTTER_HOME=/opt/flutter \
157+
PATH=/opt/flutter/bin:/opt/flutter/bin/cache/dart-sdk/bin:$PATH
158+
159+
RUN git clone --depth 1 --branch 3.38.1 https://github.com/flutter/flutter.git "$FLUTTER_HOME" \
160+
&& git config --global --add safe.directory '*' \
161+
&& flutter config --no-analytics \
162+
&& flutter precache --android \
163+
&& chmod -R a+rwX "$FLUTTER_HOME"
164+
165+
RUN git config --system --add safe.directory '*'
166+
167+
RUN flutter --version && rustc --version && cargo --version && go version
168+
169+
91170
# Minimal image for flutter test (no Rust, no Android SDK, no cross-compilers)
92171
FROM ubuntu:24.04 AS test
93172

docs/building.md

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,21 @@ cd scripts/windows
149149
./deps.sh
150150
```
151151

152-
install go in WSL [https://go.dev/doc/install](https://go.dev/doc/install) (follow linux instructions) and ensure you have `x86_64-w64-mingw32-gcc`
152+
Upgrade the version of cmake >= 3.31.6, the default version of ubuntu 24.04 (3.28.1) will be too low to build libepiccash.
153+
You can use pip to install a specific version
154+
```
155+
sudo apt remove cmake
156+
pip install cmake==3.31.6
157+
```
158+
159+
install go in WSL [https://go.dev/doc/install](https://go.dev/doc/install) (follow linux instructions) and ensure you have `mingw-w64` package installed to get the `x86_64-w64-mingw32-gcc` compiler.
160+
153161
go version should be at least 1.24
154162

155-
and use `scripts/build_app.sh` to build plugins:
163+
and use `scripts/build_app.sh` to build plugins: (see the [Build script section](#build-script-build_appsh) to understand the arguments)
156164
```
157165
cd ..
158-
./build_app.sh -a stack_wallet -p windows -v 2.1.0 -b 210
166+
./build_app.sh -a stack_wallet -p windows -v 2.4.4 -b 301
159167
```
160168

161169
### Running
@@ -255,17 +263,33 @@ flutter run macos
255263
## Windows host
256264

257265
### Visual Studio
258-
Visual Studio is required for Windows development with the Flutter SDK. Download it at https://visualstudio.microsoft.com/downloads/ and install the "Desktop development with C++", "Linux development with C++", and "Visual C++ build tools" workloads. You may also need the Windows 10, 11, and/or Universal SDK workloads depending on your Windows version.
266+
Visual Studio 2022 is required for Windows development with the Flutter SDK. Download it at https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history and install the "Desktop development with C++", "Linux development with C++", and "Visual C++ build tools" workloads. You may also need the Windows 10, 11, and/or Universal SDK workloads depending on your Windows version.
259267

260268
### Build plugins in WSL2
261269
Set up Ubuntu 24.04 in WSL2. Follow the entire Linux host section in the WSL2 Ubuntu 24.04 host to get set up to build. The Android Studio section may be skipped in WSL (it's only needed on the Windows host).
262270

263271
Install the following libraries:
264272
```
265-
sudo apt-get install libgtk2.0-dev
273+
sudo apt-get install libgtk2.0-dev nasm mingw-w64
274+
```
275+
276+
The WSL2 host may optionally be navigated to the `stack_wallet` repository on the Windows host in order to build the plugins in-place and skip the next section in which you copy the `dll`s from WSL2 to Windows.
277+
278+
In this case, you need to enable "metadata" in your wsl setup to be able to modify files on your Windows filesystem.
279+
Add this content to your /etc/wsl.conf in WSL.
280+
```
281+
[automount]
282+
options = "metadata"
283+
```
284+
Then restart the wsl from Windows
266285
```
286+
wsl --shutdown
287+
wsl
288+
```
289+
290+
https://stackoverflow.com/questions/46610256/chmod-wsl-bash-doesnt-work/50856772#50856772
267291

268-
The WSL2 host may optionally be navigated to the `stack_wallet` repository on the Windows host in order to build the plugins in-place and skip the next section in which you copy the `dll`s from WSL2 to Windows. Then build windows `dll` libraries by running the following script on the WSL2 Ubuntu 24.04 host:
292+
Then build windows `dll` libraries by running the following script on the WSL2 Ubuntu 24.04 host:
269293

270294
- `stack_wallet/scripts/windows/build_all.sh`
271295

@@ -296,11 +320,27 @@ Enable Developer Mode for symlink support,
296320
start ms-settings:developers
297321
```
298322

299-
You may need to install NuGet and CppWinRT / C++/WinRT SDKs version `2.0.210806.1`:
323+
Or enable it automatically from powershell:
324+
```
325+
PS C:\WINDOWS\system32> reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
326+
```
327+
328+
329+
Install NuGet:
330+
```
331+
winget install 9WZDNCRDMDM3 --accept-package-agreements # NuGet, can also use Microsoft.NuGet
332+
```
333+
334+
Then restart your terminal and add a source to nuget:
300335
```
301-
winget install 9WZDNCRDMDM3 # NuGet, can also use Microsoft.NuGet
302-
winget install Microsoft.Windows.CppWinRT -Version 2.0.210806.1
336+
nuget sources add -Name "nuget.org" -Source "https://api.nuget.org/v3/index.json"
303337
```
338+
339+
Install and CppWinRT / C++/WinRT SDKs version `2.0.210806.1` with the help of nuget:
340+
```
341+
nuget install Microsoft.Windows.CppWinRT --Version 2.0.210806.1
342+
```
343+
304344
or [download the package](https://www.nuget.org/packages/Microsoft.Windows.CppWinRT/2.0.210806.1) and [manually install it](https://github.com/Baseflow/flutter-permission-handler/issues/1025#issuecomment-1518576722) by placing it in `flutter/bin` with [nuget.exe](https://dist.nuget.org/win-x86-commandline/latest/nuget.exe) and installing by running `nuget install Microsoft.Windows.CppWinRT -Version 2.0.210806.1` in the root `stack_wallet` folder.
305345
<!-- TODO: script this NuGet and WinCppRT installation -->
306346

@@ -309,16 +349,18 @@ or [download the package](https://www.nuget.org/packages/Microsoft.Windows.CppWi
309349
Certain test wallet parameter and API key template files must be created in order to run Stack Wallet on Windows. These can be created by script using PowerShell on the Windows host as in
310350
```
311351
cd scripts
312-
./prebuild.ps1
352+
powershell -ExecutionPolicy Bypass -File prebuild.ps1
313353
cd .. // When finished go back to the root directory.
314354
```
355+
356+
315357
or manually by creating the files referenced in that script with the specified content.
316358

317359
### Build frostdart
318360

319361
In PowerShell on the Windows host, navigate to the `stack_wallet` folder:
320362
```
321-
cd crypto_plugins/frostdart
363+
cd crypto_plugins/frostdart/scripts/windows
322364
./build_all.bat
323365
cd .. // When finished go back to the root directory.
324366
```
@@ -328,6 +370,7 @@ cd .. // When finished go back to the root directory.
328370
Run the following commands:
329371
```
330372
flutter pub get
373+
dart run coinlib:build_windows
331374
flutter run -d windows
332375
```
333376

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Desktop Entry]
2+
Name=Stack Wallet
3+
Comment=Open-source non-custodial cryptocurrency wallet
4+
Exec=stack_wallet
5+
Icon=com.cypherstack.stackwallet
6+
Type=Application
7+
Categories=Finance;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<component type="desktop-application">
3+
<id>com.cypherstack.stackwallet</id>
4+
<metadata_license>CC0-1.0</metadata_license>
5+
<project_license>GPL-3.0-only</project_license>
6+
<name>Stack Wallet</name>
7+
<summary>Open-source non-custodial cryptocurrency wallet</summary>
8+
<description>
9+
<p>
10+
Stack Wallet is an open-source, non-custodial, privacy-focused
11+
cryptocurrency wallet supporting multiple coins.
12+
</p>
13+
</description>
14+
<url type="homepage">https://stackwallet.com</url>
15+
<url type="bugtracker">https://github.com/cypherstack/stack_wallet/issues</url>
16+
<content_rating type="oars-1.1"/>
17+
</component>

0 commit comments

Comments
 (0)