Skip to content
Merged
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
1 change: 0 additions & 1 deletion .github/workflows/e2e-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ jobs:
CHATWOOT_API: ${{ secrets.CHATWOOT_API }}
E2E: true
E2E_BACKEND: network
GEO: false
TREZOR_BRIDGE: true
TREZOR_BRIDGE_URL: http://10.0.2.2:21325
run: ./gradlew assembleDevDebug
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHATWOOT_API: ${{ secrets.CHATWOOT_API }}
E2E: true
GEO: false
run: ./gradlew assembleDevDebug

- name: Rename APK
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/e2e_migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ jobs:
CHATWOOT_API: ${{ secrets.CHATWOOT_API }}
E2E: true
E2E_BACKEND: network
GEO: false
run: ./gradlew assembleDevDebug

- name: Rename APK
Expand Down
5 changes: 1 addition & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ just test android
# Build for E2E tests (UI hooks enabled, local Electrum by default)
just e2e

# Build for E2E tests with geoblocking disabled
just e2e no geo

# Build for E2E tests using network Electrum (not local; staging/mainnet based on flavor)
just e2e network assembleTnetRelease

Expand Down Expand Up @@ -290,7 +287,7 @@ writing one; it has the format, the runner commands and the per-suite preconditi
- KEEP the file name, `<journey name>` and `<action>` prose identical across the two repos so the
specs stay diffable. Change only what the platform forces.
- MATCH the iOS identifier string when adding a `testTag` a journey asserts on — the vocabulary is
deliberately shared (`N9`, `NRemove`, `SpendingAmountContinue`, `HardwareTransferSign`). Record any
deliberately shared (`N9`, `NRemove`, `TransferUnavailableContinue`, `HardwareTransferToSpending`). Record any
name that cannot match in the identifier table in `journeys/README.md`.
- ADAPT rather than transcribe when a platform genuinely behaves differently, and say so in the
journey's `<description>` and the suite README — never assert behaviour the platform does not have.
Expand Down
4 changes: 2 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ list:
"lint" \
"lint baseline" \
"format" \
"e2e [network|no geo|TASK] [TASK]" \
"e2e [network|TASK] [TASK]" \
"changelog [all|next|hotfix]" \
"clean"

Expand Down Expand Up @@ -191,7 +191,7 @@ format:
{{ gradle }} detekt --auto-correct --rerun-tasks

e2e mode="" value="" task="assembleDevRelease":
{{ if mode == "" { "E2E=true " + gradle + " " + task } else if mode == "network" { "E2E=true E2E_BACKEND=network " + gradle + " " + if value == "" { task } else { value } } else if mode == "no" { if value == "geo" { "GEO=false E2E=true " + gradle + " " + task } else { error("usage: just e2e no geo [TASK]") } } else { "E2E=true " + gradle + " " + mode } }}
{{ if mode == "" { "E2E=true " + gradle + " " + task } else if mode == "network" { "E2E=true E2E_BACKEND=network " + gradle + " " + if value == "" { task } else { value } } else { "E2E=true " + gradle + " " + mode } }}

changelog target="all":
./scripts/preview-changelog.sh --target {{ target }}
Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,6 @@ just e2e network assembleTnetRelease
just e2e network assembleMainnetRelease
```

#### Disable Geoblocking Checks

By default, geoblocking checks via API are enabled. To disable at build time, use the `GEO` environment variable:

```sh
just e2e no geo
```

## Contributing

### AI Code Review with Claude
Expand Down
2 changes: 0 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ val e2eHomegateUrlEnv = providers.environmentVariable("E2E_HOMEGATE_URL")
.orElse(e2eLocalHostEnv.map { "http://$it:6288" })
val e2eHomeserverPubkyEnv = providers.environmentVariable("E2E_HOMESERVER_PUBKY").orElse("")
val e2eHomegateOverrideEnv = providers.environmentVariable("E2E_HOMEGATE_URL").orElse("")
val geoEnv = envFlag("GEO", default = true)
val paykitUiDisabledEnv = envFlag("PAYKIT_UI_DISABLED", default = false)
val trezorBridgeEnv = localProp("TREZOR_BRIDGE").map { it.toBoolean().toString() }.orElse("false")
val trezorBridgeUrlEnv = localProp("TREZOR_BRIDGE_URL").orElse("http://10.0.2.2:21325")
Expand Down Expand Up @@ -365,7 +364,6 @@ androidComponents {
buildConfigFields.put("E2E_HOMEGATE_OVERRIDE", e2eHomegateOverrideEnv.stringField())
buildConfigFields.put("TREZOR_BRIDGE", trezorBridgeEnv.booleanField())
buildConfigFields.put("TREZOR_BRIDGE_URL", trezorBridgeUrlEnv.stringField())
buildConfigFields.put("GEO", geoEnv.booleanField())
buildConfigFields.put("FEATURE_PAYKIT_UI_DISABLED", paykitUiDisabledEnv.booleanField())
buildConfigFields.put("LOCALES", provider { bcp47Locales.joinToString(",") }.stringField())
buildConfigFields.put(
Expand Down
140 changes: 0 additions & 140 deletions app/src/androidTest/java/to/bitkit/services/BlocktankTest.kt
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
package to.bitkit.services

import androidx.test.platform.app.InstrumentationRegistry
import com.synonym.bitkitcore.BtOrderState
import com.synonym.bitkitcore.BtOrderState2
import com.synonym.bitkitcore.CreateCjitOptions
import com.synonym.bitkitcore.CreateOrderOptions
import com.synonym.bitkitcore.IBtEstimateFeeResponse2
import com.synonym.bitkitcore.initDb
import com.synonym.bitkitcore.updateBlocktankUrl
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import kotlinx.coroutines.runBlocking
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import to.bitkit.env.Env
import to.bitkit.test.annotations.CoreServiceIntegration
import to.bitkit.test.annotations.DeviceIntegration
import javax.inject.Inject
import kotlin.test.assertEquals
import kotlin.test.assertNotEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue

Expand Down Expand Up @@ -85,136 +77,4 @@ class BlocktankTest {
assertTrue(info.onchain.feeRates.mid > 0u, "Mid fee rate should be greater than 0")
assertTrue(info.onchain.feeRates.slow > 0u, "Slow fee rate should be greater than 0")
}

@Ignore("Blocktank staging no longer creates orders or CJIT entries (synonymdev/blocktank-lsp-http#168)")
@Test
fun testCreateCjitEntry() = runBlocking {
// Test creating a CJIT order
val channelSizeSat = 100_000uL // 100k sats
val invoiceSat = 10_000uL // 10k sats for the invoice
val invoiceDescription = "Test CJIT"
val nodeId = "03e7156ae33b0a208d0744199163177e909e80176e55d97a2f221ede0f934dd9ad" // Example node ID
val channelExpiryWeeks = 6u
val options = CreateCjitOptions(source = "bitkit", discountCode = null)

// Create CJIT entry
val cjitEntry = service.blocktank.createCjit(
channelSizeSat = channelSizeSat,
invoiceSat = invoiceSat,
invoiceDescription = invoiceDescription,
nodeId = nodeId,
channelExpiryWeeks = channelExpiryWeeks,
options = options
)

// Verify CJIT entry
assertNotNull(cjitEntry, "CJIT entry should not be null")
assertTrue(cjitEntry.id.isNotEmpty(), "CJIT entry ID should not be empty")
assertEquals(cjitEntry.channelSizeSat, channelSizeSat, "Channel size should match requested amount")
assertTrue(
cjitEntry.source == "bitkit",
"Source should match expected value"
)
assertNotNull(cjitEntry.lspNode, "LSP node should not be null")
assertTrue(
cjitEntry.lspNode.pubkey.isNotEmpty(),
"LSP node pubkey should not be empty"
)
assertEquals(cjitEntry.nodeId, nodeId, "Node ID should match requested ID")
assertEquals(
cjitEntry.channelExpiryWeeks,
channelExpiryWeeks,
"Channel expiry weeks should match the requested value"
)

// Test getting CJIT entries
val entries = service.blocktank.cjitEntries(
entryIds = listOf(cjitEntry.id),
filter = null,
refresh = true
)
assertTrue(entries.isNotEmpty(), "Should retrieve created CJIT entry")
assertEquals(entries.first().id, cjitEntry.id, "Retrieved entry should match created entry")
}

@Ignore("Blocktank staging no longer creates orders or CJIT entries (synonymdev/blocktank-lsp-http#168)")
@Test
fun testOrders() = runBlocking {
// Test creating an order
val lspBalanceSat = 100_000uL
val channelExpiryWeeks = 2u
val options = CreateOrderOptions(
clientBalanceSat = 0uL,
lspNodeId = null,
couponCode = "",
source = "bitkit-android",
discountCode = null,
zeroConf = false,
zeroConfPayment = true,
zeroReserve = false,
clientNodeId = null,
signature = null,
timestamp = null,
refundOnchainAddress = null,
announceChannel = true
)

// Create Order
val order = service.blocktank.newOrder(
lspBalanceSat = lspBalanceSat,
channelExpiryWeeks = channelExpiryWeeks,
options = options
)

// Verify Order
assertNotNull(order, "Order should not be null")
assertTrue(order.id.isNotEmpty(), "Order ID should not be empty")
assertEquals(order.state, BtOrderState.CREATED, "Initial state should be created")
assertEquals(order.state2, BtOrderState2.CREATED, "Initial state2 should be created")
assertEquals(order.lspBalanceSat, lspBalanceSat, "LSP balance should match requested amount")
assertEquals(order.clientBalanceSat, 0uL, "Client balance should be zero")
assertEquals(order.channelExpiryWeeks, channelExpiryWeeks, "Channel expiry weeks should match")
assertEquals(order.source, "bitkit-android", "Source should match the expected value")

// Test getting orders
val orders = service.blocktank.orders(
orderIds = listOf(order.id),
filter = null,
refresh = true
)
assertTrue(orders.isNotEmpty(), "Orders list should not be empty")
assertEquals(orders.first().id, order.id, "Retrieved order should match created order")
}

@Test
fun testOrderEstimate() = runBlocking {
val lspBalanceSat = 100_000uL
val channelExpiryWeeks = 2u
val options = CreateOrderOptions(
clientBalanceSat = 0uL,
lspNodeId = null,
couponCode = "",
source = "bitkit-android",
discountCode = null,
zeroConf = false,
zeroConfPayment = true,
zeroReserve = false,
clientNodeId = null,
signature = null,
timestamp = null,
refundOnchainAddress = null,
announceChannel = true,
)

val estimate: IBtEstimateFeeResponse2 = service.blocktank.estimateFee(
lspBalanceSat = lspBalanceSat,
channelExpiryWeeks = channelExpiryWeeks,
options = options
)

assertNotNull(estimate.min0ConfTxFee, "Min 0 conf tx fee should not be null")
assertNotEquals(0uL, estimate.feeSat, "Fee should not be zero")
assertNotEquals(0uL, estimate.networkFeeSat, "Network fee should not be zero")
assertNotEquals(0uL, estimate.serviceFeeSat, "Service fee should not be zero")
}
}
Loading
Loading