Skip to content

Commit

Permalink
Merge branch 'master' into mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
dpad85 committed Jun 18, 2024
2 parents 2570c3f + 4d8f310 commit 39ab651
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 51 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ FROM eclipse-temurin:17.0.10_7-jdk-alpine as ECLAIR_CORE_BUILD
COPY ./buildSrc/src/main/kotlin/Versions.kt .
RUN cat Versions.kt | grep "const val eclair =" | cut -d '"' -f 2 > eclair-core-version.txt

ARG MAVEN_VERSION=3.9.7
ARG MAVEN_VERSION=3.9.8
ARG USER_HOME_DIR="/root"
ARG SHA=f64913f89756264f2686e241f3f4486eca5d0dfdbb97077b0efc389cad376053824d58caa35c39648453ca58639f85335f9be9c8f217bfdb0c2d5ff2a9428fac
ARG SHA=7d171def9b85846bf757a2cec94b7529371068a0670df14682447224e57983528e97a6d1b850327e4ca02b139abaab7fcb93c4315119e6f0ffb3f0cbc0d0b9a2
ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries

RUN apk add --no-cache curl tar bash git
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath("com.android.tools.build:gradle:7.4.2")
classpath("com.android.tools.build:gradle:8.4.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}")
classpath("org.jetbrains.kotlin:kotlin-serialization:${Versions.kotlin}")
classpath("app.cash.sqldelight:gradle-plugin:${Versions.sqlDelight}")
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
object Versions {
const val lightningKmp = "1.6.2"
const val lightningKmp = "1.6.3"
const val secp256k1 = "0.14.0"
const val torMobile = "0.2.0"

Expand All @@ -11,7 +11,7 @@ object Versions {
const val slf4j = "1.7.30"
const val junit = "4.13"

const val fcmPlugin = "4.3.10"
const val fcmPlugin = "4.4.2"

object Android {
const val coreKtx = "1.9.0"
Expand All @@ -26,7 +26,7 @@ object Versions {
const val biometrics = "1.1.0"

const val zxing = "4.1.0"
const val fcm = "22.0.0"
const val fcm = "24.0.0"
const val logback = "2.0.0"

const val testRunner = "1.3.0"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
4 changes: 2 additions & 2 deletions phoenix-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
applicationId = "fr.acinq.phoenix.mainnet"
minSdk = 26
targetSdk = 34
versionCode = 79
versionName = "2.2.3"
versionCode = 80
versionName = gitCommitHash()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
resourceConfigurations.addAll(listOf("en", "fr", "de", "es", "b+es+419", "cs", "pt-rBR", "sk", "vi"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import fr.acinq.lightning.blockchain.fee.FeeratePerByte
import fr.acinq.lightning.blockchain.fee.FeeratePerKw
import fr.acinq.lightning.channel.ChannelCommand
import fr.acinq.lightning.utils.msat
import fr.acinq.lightning.utils.sat
import fr.acinq.phoenix.managers.PeerManager
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -76,7 +77,7 @@ class CpfpViewModel(val peerManager: PeerManager) : ViewModel() {
val (actualFeerate, fees) = res
if (actualFeerate <= userFeerate * 1.10) {
CpfpState.Error.FeerateTooLow(userFeerate = userFeerate, actualFeerate = actualFeerate)
} else if (fees.serviceFee > 0.msat) {
} else if (fees.serviceFee > 0.sat) {
throw IllegalArgumentException("service fee above 0")
} else {
CpfpState.ReadyToExecute(userFeerate = userFeerate, actualFeerate = res.first, fee = fees.miningFee)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import fr.acinq.bitcoin.Satoshi
import fr.acinq.lightning.MilliSatoshi
import fr.acinq.lightning.blockchain.fee.FeeratePerKw
import fr.acinq.lightning.channel.ChannelCommand
import fr.acinq.lightning.channel.ChannelManagementFees
import fr.acinq.lightning.utils.sat
import fr.acinq.lightning.utils.sum
import fr.acinq.lightning.utils.toMilliSatoshi
Expand Down Expand Up @@ -230,7 +231,7 @@ private fun RequestLiquidityBottomSection(
}
LeaseEstimationView(amountRequested = amount, leaseFees = state.fees, actualFeerate = state.actualFeerate)
Spacer(modifier = Modifier.height(24.dp))
if (state.fees.serviceFee + state.fees.miningFee.toMilliSatoshi() > balance) {
if ((state.fees.serviceFee + state.fees.miningFee).toMilliSatoshi() > balance) {
ErrorMessage(header = stringResource(id = R.string.liquidityads_over_balance))
} else if (isAmountError) {
ErrorMessage(header = stringResource(id = R.string.validation_invalid_amount))
Expand Down Expand Up @@ -264,7 +265,7 @@ private fun RequestLiquidityBottomSection(
@Composable
private fun LeaseEstimationView(
amountRequested: Satoshi,
leaseFees: ChannelCommand.Commitment.Splice.Fees,
leaseFees: ChannelManagementFees,
actualFeerate: FeeratePerKw
) {
SplashLabelRow(
Expand All @@ -278,7 +279,7 @@ private fun LeaseEstimationView(
label = stringResource(id = R.string.liquidityads_estimate_details_service_fees),
helpMessage = stringResource(id = R.string.liquidityads_estimate_details_service_fees_help)
) {
AmountWithFiatBelow(amount = leaseFees.serviceFee, amountTextStyle = MaterialTheme.typography.body2)
AmountWithFiatBelow(amount = leaseFees.serviceFee.toMilliSatoshi(), amountTextStyle = MaterialTheme.typography.body2)
}
Spacer(modifier = Modifier.height(8.dp))
SplashLabelRow(
Expand All @@ -294,7 +295,7 @@ private fun LeaseEstimationView(
}
}

val totalFees = leaseFees.miningFee.toMilliSatoshi() + leaseFees.serviceFee
val totalFees = leaseFees.miningFee + leaseFees.serviceFee
SplashLabelRow(label = "") {
Spacer(modifier = Modifier.height(8.dp))
HSeparator(width = 60.dp)
Expand All @@ -303,10 +304,10 @@ private fun LeaseEstimationView(
SplashLabelRow(
label = stringResource(id = R.string.send_spliceout_complete_recap_total),
) {
AmountWithFiatBelow(amount = totalFees, amountTextStyle = MaterialTheme.typography.body2)
AmountWithFiatBelow(amount = totalFees.toMilliSatoshi(), amountTextStyle = MaterialTheme.typography.body2)
}

if (totalFees >= amountRequested.toMilliSatoshi() * 0.25) {
if (totalFees >= amountRequested * 0.25) {
SplashLabelRow(label = "", icon = R.drawable.ic_alert_triangle, iconTint = orange) {
Text(
text = stringResource(id = R.string.liquidityads_estimate_above_25),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.lifecycle.viewModelScope
import fr.acinq.bitcoin.Satoshi
import fr.acinq.lightning.blockchain.fee.FeeratePerKw
import fr.acinq.lightning.channel.ChannelCommand
import fr.acinq.lightning.channel.ChannelManagementFees
import fr.acinq.phoenix.managers.AppConfigurationManager
import fr.acinq.phoenix.managers.NodeParamsManager
import fr.acinq.phoenix.managers.PeerManager
Expand All @@ -37,7 +38,7 @@ import org.slf4j.LoggerFactory
sealed class RequestLiquidityState {
object Init: RequestLiquidityState()
object Estimating: RequestLiquidityState()
data class Estimation(val amount: Satoshi, val fees: ChannelCommand.Commitment.Splice.Fees, val actualFeerate: FeeratePerKw): RequestLiquidityState()
data class Estimation(val amount: Satoshi, val fees: ChannelManagementFees, val actualFeerate: FeeratePerKw): RequestLiquidityState()
object Requesting: RequestLiquidityState()
sealed class Complete: RequestLiquidityState() {
abstract val response: ChannelCommand.Commitment.Splice.Response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import fr.acinq.lightning.blockchain.fee.FeeratePerByte
import fr.acinq.lightning.blockchain.fee.FeeratePerKw
import fr.acinq.lightning.channel.ChannelCommand
import fr.acinq.lightning.utils.msat
import fr.acinq.lightning.utils.sat
import fr.acinq.phoenix.managers.PeerManager
import fr.acinq.phoenix.utils.Parser
import kotlinx.coroutines.CoroutineExceptionHandler
Expand Down Expand Up @@ -82,7 +83,7 @@ class SpliceOutViewModel(private val peerManager: PeerManager, private val chain
else -> {
val (actualFeerate, fee) = res
log.info("received actual feerate=$actualFeerate from splice-out estimate fee")
if (fee.serviceFee > 0.msat) {
if (fee.serviceFee > 0.sat) {
throw IllegalArgumentException("service fee above 0")
} else {
SpliceOutState.ReadyToSend(amount, userFeerate, actualFeerate, estimatedFee = fee.miningFee)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ object LegacyMigrationHelper {
LightningOutgoingPayment.Details.SwapOut(
address = paymentMeta.swap_out_address ?: "",
paymentRequest = paymentRequest ?: Bolt11Invoice.create(
chainHash = chain.chainHash,
chain = chain,
amount = head.recipientAmount().toLong().msat,
paymentHash = head.paymentHash().bytes().toArray().byteVector32(),
privateKey = Lightning.randomKey(),
Expand Down
12 changes: 6 additions & 6 deletions phoenix-ios/phoenix-ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2245,7 +2245,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-Green";
CODE_SIGN_ENTITLEMENTS = "phoenix-ios/Phoenix.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 75;
CURRENT_PROJECT_VERSION = 76;
DEVELOPMENT_ASSET_PATHS = "\"phoenix-ios/Preview Content\"";
DEVELOPMENT_TEAM = XD77LN4376;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -2274,7 +2274,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-Green";
CODE_SIGN_ENTITLEMENTS = "phoenix-ios/Phoenix.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 75;
CURRENT_PROJECT_VERSION = 76;
DEVELOPMENT_ASSET_PATHS = "\"phoenix-ios/Preview Content\"";
DEVELOPMENT_TEAM = XD77LN4376;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -2379,7 +2379,7 @@
buildSettings = {
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 75;
CURRENT_PROJECT_VERSION = 76;
DEVELOPMENT_TEAM = XD77LN4376;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand Down Expand Up @@ -2408,7 +2408,7 @@
buildSettings = {
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 75;
CURRENT_PROJECT_VERSION = 76;
DEVELOPMENT_TEAM = XD77LN4376;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand Down Expand Up @@ -2438,7 +2438,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = "phoenix-notifySrvExt/phoenix-notifySrvExt.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 75;
CURRENT_PROJECT_VERSION = 76;
DEVELOPMENT_TEAM = XD77LN4376;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "phoenix-notifySrvExt/Info.plist";
Expand All @@ -2465,7 +2465,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = "phoenix-notifySrvExt/phoenix-notifySrvExt.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 75;
CURRENT_PROJECT_VERSION = 76;
DEVELOPMENT_TEAM = XD77LN4376;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "phoenix-notifySrvExt/Info.plist";
Expand Down
18 changes: 9 additions & 9 deletions phoenix-ios/phoenix-ios/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -6672,7 +6672,7 @@
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Au fur et à mesure que vous recevez des fonds, les liquidités sont consommées et deviennent votre solde. Au bout d'un an, les liquidités non utilisées seront récupérées par le service."
"value" : "Au fur et à mesure que vous recevez des fonds, la liquidité est consommée et devient votre solde. Au bout d'un an, la liquidité non utilisée sera récupérée par le service."
}
}
}
Expand Down Expand Up @@ -8173,7 +8173,7 @@
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Bitcoin déchaîné"
"value" : "Bitcoin supercharged"
}
}
}
Expand Down Expand Up @@ -9152,7 +9152,7 @@
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Taille du chenal affectée"
"value" : "Capacité du canal impactée"
}
}
}
Expand Down Expand Up @@ -18382,7 +18382,7 @@
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Les fonds envoyés sur la chaîne sont prélevés de votre côté du canal, ce qui réduit la taille du canal du même montant. Vos liquidités entrantes restent les mêmes."
"value" : "Les fonds envoyés on-chain sont prélevés de votre côté du canal de paiement, ce qui réduit la taille du canal du même montant. Votre liquidité entrante reste la même."
}
}
}
Expand Down Expand Up @@ -30790,7 +30790,7 @@
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Le destinataire n'est pas joignable ou ne dispose pas de suffisamment de liquidités entrantes."
"value" : "Le destinataire n'est pas joignable ou ne dispose pas de suffisamment de liquidité entrante."
}
}
}
Expand Down Expand Up @@ -37178,7 +37178,7 @@
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Le paiement n'a pas pu être transmis au destinataire (probablement manque de liquidités entrantes)."
"value" : "Le paiement n'a pas pu être transmis au destinataire (probablement manque de liquidité entrante)."
}
}
}
Expand Down Expand Up @@ -38307,7 +38307,7 @@
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ce taux de frais est en deçà de ce que vos transactions utilisent déjà. Il doit être plus élevé afin d'avoir un quelconque effet."
"value" : "Ces frais sont en deçà de ce que vos transactions utilisent déjà. Ils doivent être plus élevés pour avoir un quelconque effet."
}
}
}
Expand Down Expand Up @@ -40123,7 +40123,7 @@
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Les transactions avec des frais trop faibles peuvent rester en attente de confirmation pendant des jours ou des semaines.\n\nLe choix de ces frais est votre responsabilité. Une fois envoyée, cette transaction ne pourra pas être annulée, seulement accélérée avec des frais plus élevés.\n\nÊtes-vous sûr de vouloir continuer ?"
"value" : "Les transactions avec des frais trop faibles peuvent rester en attente de confirmation pendant des jours voire des semaines.\n\nLe choix de ces frais est de votre responsabilité. Une fois envoyée, cette transaction ne pourra pas être annulée, seulement accélérée avec des frais plus élevés.\n\nÊtes-vous sûr de vouloir continuer ?"
}
}
}
Expand Down Expand Up @@ -42759,7 +42759,7 @@
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "La routine de tour de contrôle ne s'est pas terminée correctement"
"value" : "La routine de contrôle ne s'est pas terminée correctement"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,7 @@ struct LiquidityAdsView: View {
.gridColumnAlignment(.trailing)

let (amtBtc, amtFiat) = formattedBalances(
msats: feeInfo.estimate.serviceFee,
policy: .showMsatsIfNonZero
sats: feeInfo.estimate.serviceFee
)
HStack(alignment: VerticalAlignment.top, spacing: 8) {
VStack(alignment: HorizontalAlignment.leading, spacing: 4) {
Expand Down Expand Up @@ -735,7 +734,7 @@ struct LiquidityAdsView: View {
}

let minerMsat = Utils.toMsat(sat: feeInfo.estimate.minerFee)
let serviceMsat = feeInfo.estimate.serviceFee.msat
let serviceMsat = Utils.toMsat(sat: feeInfo.estimate.serviceFee)

let totalFeeMsat = minerMsat + serviceMsat
return totalFeeMsat > balanceMsat
Expand Down Expand Up @@ -815,7 +814,7 @@ struct LiquidityAdsView: View {

var pair: KotlinPair<
Lightning_kmpFeeratePerKw,
Lightning_kmpChannelCommand.CommitmentSpliceFees>? = nil
Lightning_kmpChannelManagementFees>? = nil

var _channelsNotAvailable = false
do {
Expand Down Expand Up @@ -843,7 +842,7 @@ struct LiquidityAdsView: View {

if let pair = pair,
let feerate: Lightning_kmpFeeratePerKw = pair.first,
let fees: Lightning_kmpChannelCommand.CommitmentSpliceFees = pair.second
let fees: Lightning_kmpChannelManagementFees = pair.second
{
feeInfo = LiquidityFeeInfo(
params: LiquidityFeeParams(amount: amount, feerate: feerate, leaseRate: leaseRate),
Expand Down Expand Up @@ -1027,8 +1026,7 @@ fileprivate struct FeeInfo_Grid: InfoGridView {
} valueColumn: {

let (amtBtc, amtFiat) = formattedBalances(
msats: feeInfo.estimate.serviceFee,
policy: .showMsatsIfNonZero
sats: feeInfo.estimate.serviceFee
)
HStack(alignment: VerticalAlignment.top, spacing: 8) {
VStack(alignment: HorizontalAlignment.leading, spacing: 4) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct LiquidityFeeParams {

struct LiquidityFeeEstimate {
let minerFee: Bitcoin_kmpSatoshi
let serviceFee: Lightning_kmpMilliSatoshi
let serviceFee: Bitcoin_kmpSatoshi
}

struct LiquidityFeeInfo {
Expand Down
4 changes: 2 additions & 2 deletions phoenix-ios/phoenix-ios/views/inspect/CpfpView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ struct CpfpView: View {

Task { @MainActor in

var pair: KotlinPair<Lightning_kmpFeeratePerKw, Lightning_kmpChannelCommand.CommitmentSpliceFees>? = nil
var pair: KotlinPair<Lightning_kmpFeeratePerKw, Lightning_kmpChannelManagementFees>? = nil
do {
pair = try await peer.estimateFeeForSpliceCpfp(
channelId: onChainPayment.channelId,
Expand All @@ -669,7 +669,7 @@ struct CpfpView: View {
let cpfpFeeratePerKw: Lightning_kmpFeeratePerKw = pair.first!
let cpfpFeerate = Lightning_kmpFeeratePerByte(feeratePerKw: cpfpFeeratePerKw)

let spliceFees: Lightning_kmpChannelCommand.CommitmentSpliceFees = pair.second!
let spliceFees: Lightning_kmpChannelManagementFees = pair.second!
let minerFee: Bitcoin_kmpSatoshi = spliceFees.miningFee

// From the docs (in lightning-kmp):
Expand Down
2 changes: 1 addition & 1 deletion phoenix-ios/phoenix-ios/views/send/MinerFeeSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ struct MinerFeeSheet: View {

if let pair = pair,
let updatedFeePerKw: Lightning_kmpFeeratePerKw = pair.first,
let fees: Lightning_kmpChannelCommand.CommitmentSpliceFees = pair.second
let fees: Lightning_kmpChannelManagementFees = pair.second
{
if self.satsPerByte == originalSatsPerByte {
self.minerFeeInfo = MinerFeeInfo(
Expand Down
Loading

0 comments on commit 39ab651

Please sign in to comment.