Skip to content

Commit

Permalink
Showing inbound fees correctly in Channel view component and SetFeesForm
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamkmr04 committed Sep 19, 2024
1 parent bbe8842 commit 7d48ef4
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 14 deletions.
27 changes: 27 additions & 0 deletions components/FeeBreakdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,33 @@ export default class FeeBreakdown extends React.Component<
}%`}
sensitive
/>
<KeyValue
keyValue={localeString(
'views.Channel.inboundBaseFee'
)}
value={
<Amount
sats={
Number(
localPolicy.inbound_fee_base_msat
) / 1000
}
toggleable
sensitive
/>
}
/>
<KeyValue
keyValue={localeString(
'views.Channel.inboundFeeRate'
)}
value={`${
Number(
localPolicy.inbound_fee_rate_milli_msat
) / 10000
}%`}
sensitive
/>
</React.Fragment>
)}
{isClosed && (
Expand Down
36 changes: 22 additions & 14 deletions components/SetFeesForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ interface SetFeesFormProps {
SettingsStore?: SettingsStore;
baseFee?: string;
feeRate?: string;
baseFeeInbound: string;
feeRateInbound: string;
timeLockDelta?: string;
channelPoint?: string;
channelId?: string;
Expand All @@ -36,8 +38,8 @@ interface SetFeesFormState {
feesSubmitted: boolean;
newBaseFee: string;
newFeeRate: string;
baseFeeInbound: string;
feeRateInbound: string;
newBaseFeeInbound: string;
newFeeRateInbound: string;
newTimeLockDelta: string;
newMinHtlc: string;
newMaxHtlc: string;
Expand All @@ -56,8 +58,8 @@ export default class SetFeesForm extends React.Component<
feesSubmitted: false,
newBaseFee: props.baseFee || '',
newFeeRate: props.feeRate || '',
baseFeeInbound: '',
feeRateInbound: '',
newBaseFeeInbound: props.baseFeeInbound || '',
newFeeRateInbound: props.feeRateInbound || '',
newTimeLockDelta: props.timeLockDelta || '',
newMinHtlc: props.minHtlc || '',
newMaxHtlc: props.maxHtlc || ''
Expand All @@ -69,8 +71,8 @@ export default class SetFeesForm extends React.Component<
feesSubmitted,
newBaseFee,
newFeeRate,
baseFeeInbound,
feeRateInbound,
newBaseFeeInbound,
newFeeRateInbound,
newTimeLockDelta,
newMinHtlc,
newMaxHtlc
Expand All @@ -81,6 +83,8 @@ export default class SetFeesForm extends React.Component<
SettingsStore,
baseFee,
feeRate,
baseFeeInbound,
feeRateInbound,
timeLockDelta,
channelPoint,
channelId,
Expand Down Expand Up @@ -165,15 +169,17 @@ export default class SetFeesForm extends React.Component<
>
{`${localeString(
'components.SetFeesForm.baseFee'
)} Inbound (${localeString('general.sats')})`}
)} ${localeString(
'views.Channel.inbound'
)} (${localeString('general.sats')})`}
</Text>
<TextInput
keyboardType="numeric"
placeholder={baseFeeInbound || '1'}
value={baseFeeInbound}
value={newBaseFeeInbound}
onChangeText={(text: string) =>
this.setState({
baseFeeInbound: text
newBaseFeeInbound: text
})
}
autoCapitalize="none"
Expand All @@ -187,15 +193,17 @@ export default class SetFeesForm extends React.Component<
>
{`${localeString(
'components.SetFeesForm.feeRate'
)} Inbound (${localeString('general.percentage')})`}
)} ${localeString(
'views.Channel.inbound'
)} (${localeString('general.percentage')})`}
</Text>
<TextInput
keyboardType="numeric"
placeholder={feeRateInbound || '1'}
value={feeRateInbound}
value={newFeeRateInbound}
onChangeText={(text: string) =>
this.setState({
feeRateInbound: text
newFeeRateInbound: text
})
}
autoCapitalize="none"
Expand Down Expand Up @@ -284,8 +292,8 @@ export default class SetFeesForm extends React.Component<
setFees(
newBaseFee,
newFeeRate,
baseFeeInbound,
feeRateInbound,
newBaseFeeInbound,
newFeeRateInbound,
Number(newTimeLockDelta),
channelPoint,
channelId,
Expand Down
3 changes: 3 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,9 @@
"views.Channel.localBaseFee": "Local Base Fee",
"views.Channel.remoteFeeRate": "Remote Fee Rate",
"views.Channel.remoteBaseFee": "Remote Base Fee",
"views.Channel.inbound": "Inbound",
"views.Channel.inboundBaseFee": "Inbound Base Fee",
"views.Channel.inboundFeeRate": "Inbound Fee Fee",
"views.Channel.feeRate": "Fee Rate",
"views.Channel.channelPayments": "Channel Payments",
"views.Channel.localMin": "Local Min",
Expand Down
2 changes: 2 additions & 0 deletions models/ChannelInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +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;
disabled: boolean;
max_htlc_msat: string;
last_update: number;
Expand Down
7 changes: 7 additions & 0 deletions views/Routing/SetFees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ export default class SetFees extends React.PureComponent<SetFeesProps, {}> {
feeRate={`${
Number(policy.fee_rate_milli_msat) / 10000
}`}
baseFeeInbound={`${
Number(policy.inbound_fee_base_msat) / 1000
}`}
feeRateInbound={`${
Number(policy.inbound_fee_rate_milli_msat) /
10000
}`}
timeLockDelta={policy.time_lock_delta.toString()}
minHtlc={`${Number(policy.min_htlc) / 1000}`}
maxHtlc={`${
Expand Down

0 comments on commit 7d48ef4

Please sign in to comment.