Skip to content

Commit b736ea3

Browse files
committed
Merge remote-tracking branch 'origin/master' into fix/lnurl-pay
# Conflicts: # Cargo.lock # Cargo.toml # Package.swift # bindings/android/gradle.properties # bindings/android/lib/src/main/jniLibs/arm64-v8a/libbitkitcore.so # bindings/android/lib/src/main/jniLibs/armeabi-v7a/libbitkitcore.so # bindings/android/lib/src/main/jniLibs/x86/libbitkitcore.so # bindings/android/lib/src/main/jniLibs/x86_64/libbitkitcore.so # bindings/android/lib/src/main/kotlin/com/synonym/bitkitcore/bitkitcore.android.kt # bindings/android/lib/src/main/kotlin/com/synonym/bitkitcore/bitkitcore.common.kt # bindings/ios/BitkitCore.xcframework.zip # bindings/ios/BitkitCore.xcframework/ios-arm64-simulator/libbitkitcore.a # bindings/ios/BitkitCore.xcframework/ios-arm64/libbitkitcore.a # bindings/python/bitkitcore/libbitkitcore.dylib
2 parents 496c084 + 7c60588 commit b736ea3

52 files changed

Lines changed: 7069 additions & 1140 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[target.armv7-linux-androideabi]
2+
rustflags = [
3+
"-C", "link-arg=-Wl,--allow-multiple-definition",
4+
"-C", "link-arg=-Wl,-z,max-page-size=16384,-z,common-page-size=16384",
5+
]
6+
7+
[target.aarch64-linux-android]
8+
rustflags = [
9+
"-C", "link-arg=-Wl,--allow-multiple-definition",
10+
"-C", "link-arg=-Wl,-z,max-page-size=16384,-z,common-page-size=16384",
11+
]
12+
13+
[target.i686-linux-android]
14+
rustflags = [
15+
"-C", "link-arg=-Wl,--allow-multiple-definition",
16+
"-C", "link-arg=-Wl,-z,max-page-size=16384,-z,common-page-size=16384",
17+
]
18+
19+
[target.x86_64-linux-android]
20+
rustflags = [
21+
"-C", "link-arg=-Wl,--allow-multiple-definition",
22+
"-C", "link-arg=-Wl,-z,max-page-size=16384,-z,common-page-size=16384",
23+
]
24+
25+
[env]
26+
OPENSSL_STATIC = "1"
27+
OPENSSL_NO_VENDOR = "0"

.github/workflows/gradle-publish.yml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
publish:
1717
runs-on: ubuntu-latest
1818
permissions:
19-
contents: read
19+
contents: write
2020
packages: write
2121

2222
steps:
@@ -34,6 +34,22 @@ jobs:
3434
- name: Setup Gradle
3535
uses: gradle/actions/setup-gradle@v4
3636

37+
- name: Install native build dependencies
38+
run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev pkg-config protobuf-compiler
39+
40+
- name: Set up Android SDK
41+
uses: android-actions/setup-android@v3
42+
43+
- name: Set up Android NDK
44+
id: setup-ndk
45+
uses: nttld/setup-ndk@v1
46+
with:
47+
ndk-version: r28c
48+
add-to-path: true
49+
50+
- name: Export Android NDK root
51+
run: echo "ANDROID_NDK_ROOT=${{ steps.setup-ndk.outputs.ndk-path }}" >> "$GITHUB_ENV"
52+
3753
- name: Extract version from input or tag
3854
id: version
3955
shell: bash
@@ -42,12 +58,27 @@ jobs:
4258
if [[ -z "$VERSION" ]]; then
4359
VERSION="$GITHUB_REF_NAME"
4460
fi
45-
echo "version=${VERSION#v}" >> $GITHUB_OUTPUT
61+
echo "version=${VERSION#v}" >> "$GITHUB_OUTPUT"
62+
63+
- name: Generate Android bindings
64+
run: ./build_android.sh
4665

4766
- name: Build with Gradle
4867
working-directory: bindings/android
4968
run: ./gradlew build -Pversion=${{ steps.version.outputs.version }}
5069

70+
- name: Upload native debug symbols artifact
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: bitkit-core-native-debug-symbols-${{ steps.version.outputs.version }}
74+
path: bindings/android/native-debug-symbols.zip
75+
76+
- name: Upload native debug symbols to release
77+
if: github.event_name == 'release'
78+
env:
79+
GH_TOKEN: ${{ github.token }}
80+
run: gh release upload "${{ github.event.release.tag_name }}" bindings/android/native-debug-symbols.zip --clobber
81+
5182
# same credentials env vars used in the publishing section of build.gradle.kts
5283
- name: Publish to GitHub Packages
5384
working-directory: bindings/android

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
target/
2+
bindings/android/native-debug-symbols.zip
23
.idea/
34
.DS_Store
45
# AI

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog
2+
3+
## 0.3.3 - 2026-06-22
4+
5+
- Surface wrong/cancelled/expected Trezor PIN failures as typed `TrezorError` variants (`InvalidPin`, `PinCancelled`, `PinRequired`) instead of generic device errors, so mobile clients can clear the PIN spinner, prompt a deliberate retry, and avoid reconnecting while the device is mid-flow. Backed by `trezor-connect-rs` 0.3.3, which maps protocol `Failure` codes to typed errors; unknown failure codes remain generic `TrezorError::DeviceError`.
6+
7+
## 0.3.2 - 2026-06-22
8+
9+
- Expose Trezor lock state through `TrezorFeatures.unlocked` so mobile apps can distinguish PIN protection from the current locked/unlocked session state.
10+
- Add `trezor_refresh_features()` as an explicit one-shot refresh for fresh Trezor feature state without background polling.
11+
- Surface busy Trezor transport state as `TrezorError::DeviceBusy`, including structured native callback busy results, so mobile clients can back off while the device is busy or awaiting user action.

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bitkitcore"
3-
version = "0.1.75"
3+
version = "0.3.5"
44
edition = "2021"
55

66
[lib]
@@ -47,11 +47,11 @@ btleplug = "0.11"
4747

4848
# Trezor connect library - non-iOS platforms get USB + Bluetooth
4949
[target.'cfg(not(target_os = "ios"))'.dependencies]
50-
trezor-connect-rs = { version = "0.3.2", features = ["psbt"] }
50+
trezor-connect-rs = { version = "0.3.3", features = ["psbt"] }
5151

5252
# iOS: Bluetooth only (libusb has no iOS backend, so no USB support)
5353
[target.'cfg(target_os = "ios")'.dependencies]
54-
trezor-connect-rs = { version = "0.3.2", default-features = false, features = ["bluetooth", "psbt"] }
54+
trezor-connect-rs = { version = "0.3.3", default-features = false, features = ["bluetooth", "psbt"] }
5555

5656
# JNI for Android (must match btleplug's jni version)
5757
[target.'cfg(target_os = "android")'.dependencies]
@@ -67,17 +67,6 @@ tempfile = "3.2"
6767
serial_test = "3.2.0"
6868
rust_decimal = "1.30"
6969

70-
[target.armv7-linux-androideabi]
71-
rustflags = [
72-
"-C", "link-arg=-Wl,--allow-multiple-definition",
73-
]
74-
75-
[target.aarch64-linux-android]
76-
rustflags = [
77-
"-C", "link-arg=-Wl,--allow-multiple-definition",
78-
]
79-
80-
8170
[[bin]]
8271
name = "example"
8372
path = "example/main.rs"

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import PackageDescription
55

6-
let tag = "v0.1.75"
7-
let checksum = "9e4c13246dee06e38491d4112029352b60032df54ac7ed885a64375186c6dc3b"
6+
let tag = "v0.3.5"
7+
let checksum = "bd1dcde687950d5dcaa5ea86d8fb8e3b8e68fd3cfdfca024e3bc4ee54746ea07"
88
let url = "https://github.com/synonymdev/bitkit-core/releases/download/\(tag)/BitkitCore.xcframework.zip"
99

1010
let package = Package(

README.md

Lines changed: 84 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,50 +118,121 @@
118118
```rust
119119
fn init_db(base_path: String) -> Result<String, DbError>
120120
```
121+
- [get_default_wallet_id](src/modules/activity/README.md#usage-examples): Get the default wallet ID for the built-in Bitkit wallet
122+
```rust
123+
fn get_default_wallet_id() -> String
124+
```
121125
- [insert_activity](src/modules/activity/README.md#usage-examples): Insert an activity (onchain or lightning)
122126
```rust
123127
fn insert_activity(activity: Activity) -> Result<(), ActivityError>
124128
```
125-
- [get_activities](src/modules/activity/README.md#usage-examples): Get activities with optional filtering, limit and sort direction
126-
```rust
127-
fn get_activities(filter: ActivityFilter, limit: Option<u32>, sort_direction: Option<SortDirection>) -> Result<Vec<Activity>, ActivityError>
129+
- [get_activities](src/modules/activity/README.md#usage-examples): Get activities with optional wallet scope, filtering, limit and sort direction
130+
```rust
131+
fn get_activities(
132+
wallet_id: Option<String>,
133+
filter: Option<ActivityFilter>,
134+
tx_type: Option<PaymentType>,
135+
tags: Option<Vec<String>>,
136+
search: Option<String>,
137+
min_date: Option<u64>,
138+
max_date: Option<u64>,
139+
limit: Option<u32>,
140+
sort_direction: Option<SortDirection>
141+
) -> Result<Vec<Activity>, ActivityError>
128142
```
129-
- [get_activity_by_id](src/modules/activity/README.md#usage-examples): Look up any activity by its ID
143+
- [get_activity_by_id](src/modules/activity/README.md#usage-examples): Look up any activity by wallet ID and activity ID
130144
```rust
131-
fn get_activity_by_id(activity_id: String) -> Result<Option<Activity>, ActivityError>
145+
fn get_activity_by_id(wallet_id: String, activity_id: String) -> Result<Option<Activity>, ActivityError>
146+
```
147+
- [get_activity_by_tx_id](src/modules/activity/README.md#usage-examples): Look up an onchain activity by wallet ID and transaction ID
148+
```rust
149+
fn get_activity_by_tx_id(wallet_id: String, tx_id: String) -> Result<Option<OnchainActivity>, ActivityError>
132150
```
133151
- [update_activity](src/modules/activity/README.md#usage-examples): Update an existing activity (onchain or lightning)
134152
```rust
135153
fn update_activity(activity_id: String, activity: Activity) -> Result<(), ActivityError>
136154
```
137-
- [delete_activity_by_id](src/modules/activity/README.md#usage-examples): Delete any activity (onchain or lightning) by its ID. Returns true if activity was found and deleted, false if not found
155+
- [delete_activity_by_id](src/modules/activity/README.md#usage-examples): Delete any activity by wallet ID and activity ID. Returns true if activity was found and deleted, false if not found
156+
```rust
157+
fn delete_activity_by_id(wallet_id: String, activity_id: String) -> Result<bool, ActivityError>
158+
```
159+
- [delete_activities_by_wallet_id](src/modules/activity/README.md#usage-examples): Delete all activities and scoped activity data for a wallet
138160
```rust
139-
fn delete_activity_by_id(activity_id: String) -> Result<bool, ActivityError>
161+
fn delete_activities_by_wallet_id(wallet_id: String) -> Result<u32, ActivityError>
162+
```
163+
- [mark_activity_as_seen](src/modules/activity/README.md#usage-examples): Mark an activity as seen by wallet ID and activity ID
164+
```rust
165+
fn mark_activity_as_seen(wallet_id: String, activity_id: String, seen_at: u64) -> Result<(), ActivityError>
140166
```
141167
- [add_tags](src/modules/activity/README.md#usage-examples): Add tags to an activity
142168
```rust
143-
fn add_tags(activity_id: String, tags: Vec<String>) -> Result<(), ActivityError>
169+
fn add_tags(wallet_id: String, activity_id: String, tags: Vec<String>) -> Result<(), ActivityError>
144170
```
145171
- [remove_tags](src/modules/activity/README.md#usage-examples): Remove tags from an activity
146172
```rust
147-
fn remove_tags(activity_id: String, tags: Vec<String>) -> Result<(), ActivityError>
173+
fn remove_tags(wallet_id: String, activity_id: String, tags: Vec<String>) -> Result<(), ActivityError>
148174
```
149175
- [get_tags](src/modules/activity/README.md#usage-examples): Get all tags for an activity
150176
```rust
151-
fn get_tags(activity_id: String) -> Result<Vec<String>, ActivityError>
177+
fn get_tags(wallet_id: String, activity_id: String) -> Result<Vec<String>, ActivityError>
152178
```
153179
- [get_all_unique_tags](src/modules/activity/README.md#usage-examples): Get all unique tags in the database sorted alphabetically
154180
```rust
155181
fn get_all_unique_tags() -> Result<Vec<String>, ActivityError>
156182
```
157-
- [get_activities_by_tag](src/modules/activity/README.md#usage-examples): Get all activities with a specific tag
183+
- [get_activities_by_tag](src/modules/activity/README.md#usage-examples): Get activities with a specific tag and optional wallet scope
158184
```rust
159-
fn get_activities_by_tag(tag: String, limit: Option<u32>, sort_direction: Option<SortDirection>) -> Result<Vec<Activity>, ActivityError>
185+
fn get_activities_by_tag(
186+
wallet_id: Option<String>,
187+
tag: String,
188+
limit: Option<u32>,
189+
sort_direction: Option<SortDirection>
190+
) -> Result<Vec<Activity>, ActivityError>
160191
```
161192
- [upsert_activity](src/modules/activity/README.md#usage-examples): Insert or update an activity
162193
```rust
163194
fn upsert_activity(activity: Activity) -> Result<(), ActivityError>
164195
```
196+
- [add_pre_activity_metadata](src/modules/activity/README.md#usage-examples): Store pending metadata before an activity exists
197+
```rust
198+
fn add_pre_activity_metadata(pre_activity_metadata: PreActivityMetadata) -> Result<(), ActivityError>
199+
```
200+
- [get_pre_activity_metadata](src/modules/activity/README.md#usage-examples): Get pending metadata by wallet ID and payment ID or address
201+
```rust
202+
fn get_pre_activity_metadata(
203+
wallet_id: String,
204+
search_key: String,
205+
search_by_address: bool
206+
) -> Result<Option<PreActivityMetadata>, ActivityError>
207+
```
208+
- [add_pre_activity_metadata_tags](src/modules/activity/README.md#usage-examples): Add tags to pending metadata
209+
```rust
210+
fn add_pre_activity_metadata_tags(wallet_id: String, payment_id: String, tags: Vec<String>) -> Result<(), ActivityError>
211+
```
212+
- [remove_pre_activity_metadata_tags](src/modules/activity/README.md#usage-examples): Remove tags from pending metadata
213+
```rust
214+
fn remove_pre_activity_metadata_tags(wallet_id: String, payment_id: String, tags: Vec<String>) -> Result<(), ActivityError>
215+
```
216+
- [reset_pre_activity_metadata_tags](src/modules/activity/README.md#usage-examples): Remove all tags from pending metadata
217+
```rust
218+
fn reset_pre_activity_metadata_tags(wallet_id: String, payment_id: String) -> Result<(), ActivityError>
219+
```
220+
- [delete_pre_activity_metadata](src/modules/activity/README.md#usage-examples): Delete pending metadata by wallet ID and payment ID
221+
```rust
222+
fn delete_pre_activity_metadata(wallet_id: String, payment_id: String) -> Result<(), ActivityError>
223+
```
224+
- [upsert_pre_activity_metadata](src/modules/activity/README.md#usage-examples): Insert or update pending metadata records
225+
```rust
226+
fn upsert_pre_activity_metadata(pre_activity_metadata: Vec<PreActivityMetadata>) -> Result<(), ActivityError>
227+
```
228+
- [get_transaction_details](src/modules/activity/README.md#usage-examples): Get transaction details by wallet ID and transaction ID
229+
```rust
230+
fn get_transaction_details(wallet_id: String, tx_id: String) -> Result<Option<TransactionDetails>, ActivityError>
231+
```
232+
- [delete_transaction_details](src/modules/activity/README.md#usage-examples): Delete transaction details by wallet ID and transaction ID
233+
```rust
234+
fn delete_transaction_details(wallet_id: String, tx_id: String) -> Result<bool, ActivityError>
235+
```
165236
- Blocktank:
166237
- [init_db](src/modules/blocktank/README.md#usage-examples): Initialize database
167238
```rust
@@ -510,4 +581,4 @@ cargo test modules::blocktank
510581

511582
# Run tests for the Trezor module
512583
cargo test modules::trezor
513-
```
584+
```

bindings/android/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ Create a GitHub Release with a new tag like `v0.1.0`. The workflow `gradle-publi
8585
### Terminal
8686

8787
```sh
88-
cd bindings/android
88+
./build_android.sh
89+
cd ./bindings/android
8990
./gradlew publish -Pversion=0.1.0
9091
```
92+
93+
Run `./build_android.sh` before any direct Gradle publish so `jniLibs` is regenerated as stripped release libraries with separate `native-debug-symbols.zip` metadata and 16 KB page-size alignment.

bindings/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ android.useAndroidX=true
33
android.enableJetifier=true
44
kotlin.code.style=official
55
group=com.synonym
6-
version=0.1.75
6+
version=0.3.5

0 commit comments

Comments
 (0)