diff --git a/AGENTS.md b/AGENTS.md
index c90eb64c..21cd5dc6 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -21,12 +21,20 @@ This app integrates with:
```bash
# Standard build - Open Bitkit.xcodeproj in Xcode and build
-# E2E test build (uses local Electrum backend)
+# E2E test build (uses local Electrum backend by default)
xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
-scheme Bitkit \
-configuration Debug \
SWIFT_ACTIVE_COMPILATION_CONDITIONS='$(inherited) E2E_BUILD' \
build
+
+# E2E test build with network Electrum and regtest (Info.plist build setting)
+E2E_BACKEND=network E2E_NETWORK=regtest \
+ xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
+ -scheme Bitkit \
+ -configuration Debug \
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS='$(inherited) E2E_BUILD' \
+ build
```
### Code Formatting
@@ -197,7 +205,7 @@ New feature (`TransferTrackingManager`) tracks pending transfers to handle edge
- The app currently runs on **regtest only** (see `LightningService.swift:92` guard)
- VSS (Versioned Storage Service) authentication is not yet implemented
- Electrum/Esplora server URLs are configurable via `Env`
-- E2E builds use local Electrum backend via `E2E_BUILD` compilation flag
+- E2E builds use local Electrum backend via `E2E_BUILD` compilation flag (override with `E2E_BACKEND`/`E2E_NETWORK` build settings)
### Error Handling
diff --git a/Bitkit/Constants/Env.swift b/Bitkit/Constants/Env.swift
index 1510f6d4..ef1f6e4c 100644
--- a/Bitkit/Constants/Env.swift
+++ b/Bitkit/Constants/Env.swift
@@ -24,6 +24,29 @@ enum Env {
#endif
}
+ private static func infoPlistValue(_ key: String) -> String? {
+ let value = Bundle.main.object(forInfoDictionaryKey: key) as? String
+ let trimmed = value?.trimmingCharacters(in: .whitespacesAndNewlines)
+ return trimmed?.isEmpty == false ? trimmed : nil
+ }
+
+ private static var e2eBackend: String {
+ (infoPlistValue("E2E_BACKEND") ?? "local").lowercased()
+ }
+
+ private static var e2eNetwork: LDKNode.Network {
+ switch (infoPlistValue("E2E_NETWORK") ?? "regtest").lowercased() {
+ case "bitcoin", "mainnet":
+ return .bitcoin
+ case "testnet":
+ return .testnet
+ case "signet":
+ return .signet
+ default:
+ return .regtest
+ }
+ }
+
static var isGeoblockingEnabled: Bool {
#if CHECK_GEOBLOCK
return true
@@ -48,7 +71,19 @@ enum Env {
// MARK: wallet services
- static let network: LDKNode.Network = (isDebug || isUnitTest || isE2E) ? .regtest : .bitcoin
+ static let network: LDKNode.Network = {
+ if isUnitTest {
+ return .regtest
+ }
+ if isE2E {
+ return e2eNetwork
+ }
+ if isDebug {
+ return .regtest
+ }
+ return .bitcoin
+ }()
+
static let ldkLogLevel = LDKNode.LogLevel.trace
static let walletSyncIntervalSecs: UInt64 = 10 // TODO: play around with this
@@ -80,7 +115,7 @@ enum Env {
// MARK: Server URLs
static var electrumServerUrl: String {
- if isE2E {
+ if isE2E, e2eBackend == "local" {
return "tcp://127.0.0.1:60001"
}
diff --git a/Bitkit/Info.plist b/Bitkit/Info.plist
index 8ceefe72..235c8d56 100644
--- a/Bitkit/Info.plist
+++ b/Bitkit/Info.plist
@@ -19,6 +19,10 @@
+ E2E_BACKEND
+ $(E2E_BACKEND)
+ E2E_NETWORK
+ $(E2E_NETWORK)
NSFaceIDUsageDescription
Bitkit uses Face ID to securely authenticate access to your wallet and protect your Bitcoin.
UIAppFonts
diff --git a/README.md b/README.md
index 58335716..173e3d63 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ The app automatically selects the network based on the build configuration:
### Building for E2E tests
-To produce an E2E build (uses the local Electrum backend), pass the `E2E_BUILD` compilation flag:
+To produce an E2E build (uses the local Electrum backend by default), pass the `E2E_BUILD` compilation flag:
```bash
xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
@@ -36,6 +36,26 @@ xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
build
```
+You can also set the backend/network at build time via Info.plist substitutions:
+
+```bash
+# Use network Electrum with regtest
+E2E_BACKEND=network E2E_NETWORK=regtest \
+ xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
+ -scheme Bitkit \
+ -configuration Debug \
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS='$(inherited) E2E_BUILD' \
+ build
+
+# Use network Electrum with mainnet
+E2E_BACKEND=network E2E_NETWORK=bitcoin \
+ xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
+ -scheme Bitkit \
+ -configuration Debug \
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS='$(inherited) E2E_BUILD' \
+ build
+```
+
## Localization
### Pulling Translations