feat: default showMillisatoshiAmounts false, always show msats for fees, bridge feePaidMsat from LDK Node native

This commit is contained in:
Evan Kaloudis
2026-03-26 20:01:31 -04:00
parent f0fae73273
commit e1f1b1aee7
15 changed files with 81 additions and 59 deletions
@@ -1078,6 +1078,7 @@ class LdkNodeModule(reactContext: ReactApplicationContext) : ReactContextBaseJav
putMap("kind", serializePaymentKind(payment.kind))
payment.amountMsat?.let { putDouble("amountMsat", it.toLong().toDouble()) }
payment.feePaidMsat?.let { putDouble("feePaidMsat", it.toLong().toDouble()) }
when (payment.direction) {
PaymentDirection.INBOUND -> putString("direction", "inbound")
+8 -11
View File
@@ -195,8 +195,7 @@ export default class EmbeddedLdkNode {
block_height: status.currentBestBlock_height,
block_hash: status.currentBestBlock_hash,
synced_to_chain:
status.isRunning &&
!!status.latestOnchainWalletSyncTimestamp,
status.isRunning && !!status.latestOnchainWalletSyncTimestamp,
synced_to_graph: !!status.latestRgsSnapshotTimestamp,
version: 'ldk-node',
testnet: network === 'testnet',
@@ -540,8 +539,7 @@ export default class EmbeddedLdkNode {
paymentId = await LdkNode.bolt11.sendBolt11(data.payment_request);
}
const { hash, preimage } =
await this.awaitPaymentCompletion(paymentId);
const { hash, preimage } = await this.awaitPaymentCompletion(paymentId);
return {
payment_hash: hash,
@@ -563,8 +561,7 @@ export default class EmbeddedLdkNode {
amountMsat: amt * 1000
});
const { hash, preimage } =
await this.awaitPaymentCompletion(paymentId);
const { hash, preimage } = await this.awaitPaymentCompletion(paymentId);
return {
payment_hash: hash,
@@ -971,8 +968,7 @@ export default class EmbeddedLdkNode {
amountMsat: Number(amountSatoshis) * 1000
});
const { hash, preimage } =
await this.awaitPaymentCompletion(paymentId);
const { hash, preimage } = await this.awaitPaymentCompletion(paymentId);
return {
payment_hash: hash,
@@ -1141,6 +1137,7 @@ export default class EmbeddedLdkNode {
// For Lightning payments, hash and preimage are in the kind object
const hash = payment.kind.hash || payment.id;
const preimage = payment.kind.preimage || '';
const feeMsat = payment.feePaidMsat || 0;
return {
payment_hash: hash,
@@ -1152,9 +1149,9 @@ export default class EmbeddedLdkNode {
: '0',
value_msat: payment.amountMsat?.toString() || '0',
creation_date: payment.latestUpdateTimestamp.toString(),
fee: '0',
fee_sat: '0',
fee_msat: '0',
fee: new BigNumber(feeMsat).dividedBy(1000).toString(),
fee_sat: new BigNumber(feeMsat).dividedBy(1000).toFixed(0),
fee_msat: feeMsat.toString(),
payment_preimage: preimage,
status: this.mapPaymentStatus(payment.status),
failure_reason:
+8 -1
View File
@@ -44,6 +44,7 @@ interface AmountDisplayProps {
colorOverride?: string;
pending?: boolean;
fee?: boolean;
forceMsats?: boolean;
fiatRatesLoading?: boolean;
accessible?: boolean;
accessibilityLabel?: string;
@@ -70,6 +71,7 @@ function AmountDisplay({
colorOverride = undefined,
pending = false,
fee = false,
forceMsats = false,
fiatRatesLoading = false,
accessible,
accessibilityLabel,
@@ -319,7 +321,8 @@ function AmountDisplay({
case 'sats':
const { displayAmount, shouldShowRounding } = processSatsAmount(
amount,
roundAmount
roundAmount,
fee || forceMsats
);
return renderSatsAmount(displayAmount, shouldShowRounding);
case 'BTC':
@@ -356,6 +359,7 @@ interface AmountProps {
toggleable?: boolean;
pending?: boolean;
fee?: boolean;
forceMsats?: boolean;
accessible?: boolean;
accessibilityLabel?: string;
negative?: boolean;
@@ -382,6 +386,7 @@ export default class Amount extends React.Component<AmountProps, {}> {
colorOverride = undefined,
pending = false,
fee = false,
forceMsats = false,
accessible,
accessibilityLabel,
negative = false,
@@ -515,6 +520,7 @@ export default class Amount extends React.Component<AmountProps, {}> {
colorOverride={colorOverride}
pending={pending}
fee={fee}
forceMsats={forceMsats}
fiatRatesLoading={FiatStore.loading}
accessible={accessible}
accessibilityLabel={accessibilityLabel}
@@ -535,6 +541,7 @@ export default class Amount extends React.Component<AmountProps, {}> {
colorOverride={colorOverride}
pending={pending}
fee={fee}
forceMsats={forceMsats}
fiatRatesLoading={FiatStore.loading}
accessible={accessible}
accessibilityLabel={accessibilityLabel}
+1
View File
@@ -106,6 +106,7 @@ export default function DonationInfoModal({
debit
sensitive
toggleable
forceMsats
/>
<Text
style={{
+1
View File
@@ -933,6 +933,7 @@ class LdkNodeModule: RCTEventEmitter {
"id": payment.id,
"kind": self.serializePaymentKind(payment.kind),
"amountMsat": payment.amountMsat as Any,
"feePaidMsat": payment.feePaidMsat as Any,
"direction": self.serializePaymentDirection(payment.direction),
"status": self.serializePaymentStatus(payment.status),
"latestUpdateTimestamp": payment.latestUpdateTimestamp
+1
View File
@@ -192,6 +192,7 @@ export interface PaymentDetails {
id: string;
kind: PaymentKind;
amountMsat?: number;
feePaidMsat?: number;
direction: PaymentDirection;
status: PaymentStatus;
latestUpdateTimestamp: number;
+1 -1
View File
@@ -1394,7 +1394,7 @@ export default class SettingsStore {
bigKeypadButtons: false,
showAllDecimalPlaces: false,
removeDecimalSpaces: false,
showMillisatoshiAmounts: true
showMillisatoshiAmounts: false
},
pos: {
posEnabled: PosEnabled.Disabled,
+4 -2
View File
@@ -33,14 +33,16 @@ export interface ValueDisplayProps {
*
* @param amount - The amount to process (as string or number)
* @param roundAmount - Whether to apply rounding logic (default: false)
* @param forceMsats - Force showing millisatoshi decimals regardless of setting (e.g. for fees)
* @returns Object containing the display amount and whether to show rounding indicator
*/
export function processSatsAmount(
amount: string | number,
roundAmount: boolean = false
roundAmount: boolean = false,
forceMsats: boolean = false
): AmountDisplayResult {
const amountStr = amount.toString();
const hideMsats = shouldHideMillisatoshiAmounts();
const hideMsats = forceMsats ? false : shouldHideMillisatoshiAmounts();
// Remove commas from the amount string for processing
const cleanAmountStr = amountStr.replace(/,/g, '');
+1
View File
@@ -217,6 +217,7 @@ export default class CashuPayment extends React.Component<
debit
sensitive
toggleable
forceMsats
/>
{getFeePercentage && (
<Text
+1
View File
@@ -212,6 +212,7 @@ export default class PaymentView extends React.Component<
debit
sensitive
toggleable
forceMsats
/>
{getFeePercentage && (
<Text
+2
View File
@@ -265,6 +265,7 @@ export default class RoutingEvent extends React.Component<
sats={fee ?? rebalanceFees ?? 0}
toggleable
sensitive
forceMsats
/>
}
/>
@@ -331,6 +332,7 @@ export default class RoutingEvent extends React.Component<
toggleable
credit
sensitive
forceMsats
/>
</View>
+2 -1
View File
@@ -33,7 +33,7 @@ function TotalRow({
<Spacer width={8} />
<Body secondary>{kind}</Body>
</Row>
<Amount sats={amount} toggleable />
<Amount sats={amount} toggleable forceMsats />
</Row>
);
}
@@ -79,6 +79,7 @@ export function RoutingHeader(props: any) {
jumboText
toggleable
sensitive
forceMsats
/>
<Text
style={{
+1 -1
View File
@@ -31,7 +31,7 @@ export function RoutingListItem({
<View style={{ flex: 1, paddingRight: 10 }}>
<Body>{title}</Body>
</View>
<Amount sats={fee} credit sensitive />
<Amount sats={fee} credit sensitive forceMsats />
</Row>
<Row justify="space-between">
<Text style={{ color: themeColor('text') }}>{date}</Text>
+48 -42
View File
@@ -617,49 +617,55 @@ export default class SendingLightning extends React.Component<
)}
{(!!payment_error || !!error) && (
<>
{(implementation === 'embedded-lnd' ||
implementation ===
'embedded-ldk-node') && (
<Button
title={localeString(
'views.SendingLightning.tryAgain'
)}
icon={{
name: 'rotate-ccw',
type: 'feather',
size: 25
}}
onPress={() => navigation.goBack()}
buttonStyle={{
backgroundColor: 'white',
height: 40
}}
containerStyle={{
width: '100%',
margin: 3
}}
/>
{implementation === 'embedded-lnd' && (
<Button
title={localeString(
'views.Settings.EmbeddedNode.Troubleshooting.title'
{(implementation === 'embedded-lnd' ||
implementation ===
'embedded-ldk-node') && (
<>
<Button
title={localeString(
'views.SendingLightning.tryAgain'
)}
icon={{
name: 'rotate-ccw',
type: 'feather',
size: 25
}}
onPress={() =>
navigation.goBack()
}
buttonStyle={{
backgroundColor:
'white',
height: 40
}}
containerStyle={{
width: '100%',
margin: 3
}}
/>
{BackendUtils.isLocalWallet() && (
<Button
title={localeString(
'views.Settings.EmbeddedNode.Troubleshooting.title'
)}
icon={{
name: 'life-buoy',
type: 'feather',
size: 25
}}
onPress={() => {
navigation.navigate(
'EmbeddedNodeTroubleshooting'
);
}}
containerStyle={{
width: '100%',
margin: 3
}}
secondary
/>
)}
icon={{
name: 'life-buoy',
type: 'feather',
size: 25
}}
onPress={() => {
navigation.navigate(
'EmbeddedNodeTroubleshooting'
);
}}
containerStyle={{
width: '100%',
margin: 3
}}
secondary
/>
</>
)}
</>
)}
+1
View File
@@ -213,6 +213,7 @@ export default class TransactionView extends React.Component<
debit
toggleable
sensitive
forceMsats
/>
{getFeePercentage && (
<Text