Skip to content

Commit

Permalink
Checks for the cases when the inbound fees is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamkmr04 committed Sep 19, 2024
1 parent 7d48ef4 commit 9aab0d7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 29 deletions.
57 changes: 33 additions & 24 deletions components/FeeBreakdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import DateTimeUtils from '../utils/DateTimeUtils';
import { localeString } from '../utils/LocaleUtils';
import { themeColor } from '../utils/ThemeUtils';
import UrlUtils from '../utils/UrlUtils';
import BackendUtils from '../utils/BackendUtils';

import { Divider } from 'react-native-elements';

Expand Down Expand Up @@ -146,33 +147,41 @@ export default class FeeBreakdown extends React.Component<
}%`}
sensitive
/>
<KeyValue
keyValue={localeString(
'views.Channel.inboundBaseFee'
)}
value={
<Amount
sats={
Number(
localPolicy.inbound_fee_base_msat
) / 1000
{BackendUtils.supportInboundFees() && (
<>
<KeyValue
keyValue={localeString(
'views.Channel.inboundBaseFee'
)}
value={
<Amount
sats={
localPolicy.inbound_fee_base_msat
? Number(
localPolicy.inbound_fee_base_msat
) / 1000
: 0
}
toggleable
sensitive
/>
}
toggleable
/>
<KeyValue
keyValue={localeString(
'views.Channel.inboundFeeRate'
)}
value={`${
localPolicy.inbound_fee_rate_milli_msat
? Number(
localPolicy.inbound_fee_rate_milli_msat
) / 10000
: 0
}%`}
sensitive
/>
}
/>
<KeyValue
keyValue={localeString(
'views.Channel.inboundFeeRate'
)}
value={`${
Number(
localPolicy.inbound_fee_rate_milli_msat
) / 10000
}%`}
sensitive
/>
</>
)}
</React.Fragment>
)}
{isClosed && (
Expand Down
4 changes: 2 additions & 2 deletions models/ChannelInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ interface RoutingPolicy {
min_htlc: string;
fee_base_msat: string;
fee_rate_milli_msat: string;
inbound_fee_base_msat: string;
inbound_fee_rate_milli_msat: string;
inbound_fee_base_msat?: string;
inbound_fee_rate_milli_msat?: string;
disabled: boolean;
max_htlc_msat: string;
last_update: number;
Expand Down
12 changes: 9 additions & 3 deletions views/Routing/SetFees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,17 @@ export default class SetFees extends React.PureComponent<SetFeesProps, {}> {
Number(policy.fee_rate_milli_msat) / 10000
}`}
baseFeeInbound={`${
Number(policy.inbound_fee_base_msat) / 1000
policy.inbound_fee_base_msat
? Number(policy.inbound_fee_base_msat) /
1000
: 0
}`}
feeRateInbound={`${
Number(policy.inbound_fee_rate_milli_msat) /
10000
policy.inbound_fee_rate_milli_msat
? Number(
policy.inbound_fee_rate_milli_msat
) / 10000
: 0
}`}
timeLockDelta={policy.time_lock_delta.toString()}
minHtlc={`${Number(policy.min_htlc) / 1000}`}
Expand Down

0 comments on commit 9aab0d7

Please sign in to comment.