Skip to content

Commit db5ca08

Browse files
authored
Merge branch 'master' into fix/bitkit-not-responding
2 parents 6785c5b + eee3800 commit db5ca08

10 files changed

Lines changed: 436 additions & 33 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Bug Report
2+
description: Report a bug in Bitkit Android
3+
title: ''
4+
type: bug
5+
body:
6+
- type: textarea
7+
id: description
8+
attributes:
9+
label: Description
10+
description: Brief description of the issue or additional context
11+
validations:
12+
required: true
13+
14+
- type: textarea
15+
id: steps
16+
attributes:
17+
label: Steps to Reproduce
18+
value: |
19+
1.
20+
2.
21+
3.
22+
validations:
23+
required: true
24+
25+
- type: textarea
26+
id: actual
27+
attributes:
28+
label: Actual Behavior
29+
description: What actually happened
30+
validations:
31+
required: true
32+
33+
- type: textarea
34+
id: expected
35+
attributes:
36+
label: Expected Behavior
37+
description: What you expected to happen
38+
validations:
39+
required: true
40+
41+
- type: textarea
42+
id: logs
43+
attributes:
44+
label: Logs / Screenshots / Recordings
45+
description: Attach relevant logs, screenshots, or screen recordings
46+
validations:
47+
required: false
48+
49+
- type: input
50+
id: version
51+
attributes:
52+
label: Bitkit Version
53+
placeholder: e.g., 2.0.0 or commit SHA
54+
validations:
55+
required: false
56+
57+
- type: input
58+
id: platform
59+
attributes:
60+
label: Platform
61+
placeholder: e.g., Pixel 7 / Emulator / Android 14
62+
validations:
63+
required: false
64+
65+
- type: input
66+
id: network
67+
attributes:
68+
label: Network
69+
placeholder: e.g., mainnet / regtest / local
70+
validations:
71+
required: false

.github/workflows/e2e_migration.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
description: "Branch of synonymdev/bitkit-e2e-tests to use (main | default-feature-branch | custom branch name)"
88
required: false
99
default: "default-feature-branch"
10+
schedule:
11+
- cron: "0 2 * * *"
1012

1113
env:
1214
TERM: xterm-256color
@@ -75,13 +77,17 @@ jobs:
7577
strategy:
7678
fail-fast: false
7779
matrix:
80+
rn_version:
81+
- v1.1.6
82+
- v1.1.4
83+
- v1.1.3
7884
scenario:
79-
- { name: migration_1, grep: "@migration_1" }
80-
- { name: migration_2, grep: "@migration_2" }
81-
- { name: migration_3, grep: "@migration_3" }
82-
- { name: migration_4, grep: "@migration_4" }
85+
- { name: migration_1-restore, grep: "@migration_1" }
86+
- { name: migration_2-migration, grep: "@migration_2" }
87+
- { name: migration_3-with-passphrase, grep: "@migration_3" }
88+
- { name: migration_4-with-sweep, grep: "@migration_4" }
8389

84-
name: e2e-tests - ${{ matrix.scenario.name }}
90+
name: e2e-tests - ${{ matrix.rn_version }} - ${{ matrix.scenario.name }}
8591

8692
steps:
8793
- name: Show selected E2E branch
@@ -111,7 +117,7 @@ jobs:
111117
- name: Download RN app for migration
112118
run: |
113119
curl -L -o bitkit-e2e-tests/aut/bitkit_rn_regtest.apk \
114-
https://github.com/synonymdev/bitkit-e2e-tests/releases/download/migration-rn-regtest/bitkit_rn_regtest.apk
120+
https://github.com/synonymdev/bitkit-e2e-tests/releases/download/migration-rn-regtest/bitkit_rn_regtest_${{ matrix.rn_version }}.apk
115121
116122
- name: List APK directory contents
117123
run: ls -l bitkit-e2e-tests/aut
@@ -189,5 +195,5 @@ jobs:
189195
if: failure()
190196
uses: actions/upload-artifact@v4
191197
with:
192-
name: e2e-artifacts_${{ matrix.scenario.name }}_${{ github.run_number }}
198+
name: e2e-artifacts_${{ matrix.scenario.name }}_${{ matrix.rn_version }}_${{ github.run_number }}
193199
path: bitkit-e2e-tests/artifacts/

app/src/main/java/to/bitkit/models/Network.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,10 @@ fun Network.toCoreNetworkType(): NetworkType = when (this) {
2424
Network.SIGNET -> NetworkType.SIGNET
2525
Network.REGTEST -> NetworkType.REGTEST
2626
}
27+
28+
fun NetworkType.toLdkNetwork(): Network = when (this) {
29+
NetworkType.BITCOIN -> Network.BITCOIN
30+
NetworkType.TESTNET -> Network.TESTNET
31+
NetworkType.SIGNET -> Network.SIGNET
32+
NetworkType.REGTEST -> Network.REGTEST
33+
}

app/src/main/java/to/bitkit/ui/settings/advanced/sweep/SweepSettingsScreen.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import androidx.compose.runtime.getValue
2020
import androidx.compose.ui.Alignment
2121
import androidx.compose.ui.Modifier
2222
import androidx.compose.ui.layout.ContentScale
23+
import androidx.compose.ui.platform.testTag
2324
import androidx.compose.ui.res.painterResource
2425
import androidx.compose.ui.res.stringResource
2526
import androidx.compose.ui.tooling.preview.Preview
@@ -224,7 +225,9 @@ private fun FoundFundsView(
224225
PrimaryButton(
225226
text = stringResource(R.string.sweep__to_wallet),
226227
onClick = onSweepToWallet,
227-
modifier = Modifier.fillMaxWidth()
228+
modifier = Modifier
229+
.fillMaxWidth()
230+
.testTag("SweepToWalletButton")
228231
)
229232

230233
VerticalSpacer(16.dp)

app/src/main/java/to/bitkit/utils/Bip21Utils.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ import to.bitkit.models.SATS_IN_BTC
44

55
object Bip21Utils {
66

7+
private const val BIP21_PREFIX = "bitcoin:"
8+
9+
/**
10+
* Checks if a BIP21 URI is duplicated (contains multiple bitcoin: prefixes).
11+
* Workaround for https://github.com/synonymdev/bitkit-core/issues/63
12+
* @return true if the input contains duplicated BIP21 URIs, false otherwise
13+
*/
14+
fun isDuplicatedBip21(input: String): Boolean {
15+
val lowercased = input.lowercase()
16+
val firstIndex = lowercased.indexOf(BIP21_PREFIX)
17+
if (firstIndex == -1) return false
18+
19+
val secondIndex = lowercased.indexOf(BIP21_PREFIX, firstIndex + BIP21_PREFIX.length)
20+
return secondIndex != -1
21+
}
22+
723
fun buildBip21Url(
824
bitcoinAddress: String,
925
amountSats: ULong? = null,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package to.bitkit.utils
2+
3+
import org.lightningdevkit.ldknode.Network
4+
5+
/**
6+
* Helper for validating Bitcoin network compatibility of addresses and invoices
7+
*/
8+
object NetworkValidationHelper {
9+
/**
10+
* Check if an address/invoice network mismatches the current app network
11+
* @param addressNetwork The network detected from the address/invoice
12+
* @param currentNetwork The app's current network (typically Env.network)
13+
* @return true if there's a mismatch (address won't work on current network)
14+
*/
15+
fun isNetworkMismatch(addressNetwork: Network?, currentNetwork: Network): Boolean {
16+
if (addressNetwork == null) return false
17+
18+
// Special case: regtest uses testnet prefixes (m, n, 2, tb1)
19+
if (currentNetwork == Network.REGTEST && addressNetwork == Network.TESTNET) {
20+
return false
21+
}
22+
23+
return addressNetwork != currentNetwork
24+
}
25+
}

0 commit comments

Comments
 (0)