Skip to content

Commit

Permalink
Merge pull request #1264 from kaloudis/close-channel-mempool-space
Browse files Browse the repository at this point in the history
Close Channel: add ability to get rate suggestions from Mempool.space
  • Loading branch information
kaloudis authored Jan 22, 2023
2 parents aa0db72 + 7e160d6 commit 4907ada
Showing 1 changed file with 63 additions and 13 deletions.
76 changes: 63 additions & 13 deletions views/Channels/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
StyleSheet,
Text,
TouchableOpacity,
TouchableWithoutFeedback,
View
} from 'react-native';
import { Divider, Header, Icon } from 'react-native-elements';
Expand Down Expand Up @@ -108,6 +109,12 @@ export default class ChannelView extends React.Component<
navigation.navigate('Wallet');
};

handleOnNavigateBack = (satPerByte: string) => {
this.setState({
satPerByte
});
};

render() {
const {
navigation,
Expand All @@ -123,7 +130,8 @@ export default class ChannelView extends React.Component<
const { nodes } = ChannelsStore;
const { settings, implementation } = SettingsStore;
const { privacy } = settings;
const lurkerMode = (privacy && privacy.lurkerMode) || false;
const lurkerMode = privacy && privacy.lurkerMode;
const enableMempoolRates = privacy && privacy.enableMempoolRates;

const {
channel_point,
Expand Down Expand Up @@ -440,18 +448,51 @@ export default class ChannelView extends React.Component<
'views.Channel.closingRate'
)}
</Text>
<TextInput
keyboardType="numeric"
placeholder={'2'}
value={satPerByte}
onChangeText={(text: string) =>
this.setState({
satPerByte: text
})
}
autoCapitalize="none"
autoCorrect={false}
/>
{enableMempoolRates ? (
<TouchableWithoutFeedback
onPress={() =>
navigation.navigate('EditFee', {
onNavigateBack:
this
.handleOnNavigateBack
})
}
>
<View
style={{
...styles.editFeeBox,
borderColor:
'rgba(255, 217, 63, .6)',
borderWidth: 3
}}
>
<Text
style={{
...styles.text,
color: themeColor(
'text'
),
fontSize: 18
}}
>
{satPerByte}
</Text>
</View>
</TouchableWithoutFeedback>
) : (
<TextInput
keyboardType="numeric"
placeholder={'2'}
value={satPerByte}
onChangeText={(text: string) =>
this.setState({
satPerByte: text
})
}
autoCapitalize="none"
autoCorrect={false}
/>
)}
{BackendUtils.isLNDBased() && (
<>
<Text
Expand Down Expand Up @@ -539,5 +580,14 @@ const styles = StyleSheet.create({
button: {
paddingTop: 15,
paddingBottom: 15
},
editFeeBox: {
height: 65,
padding: 15,
marginTop: 15,
borderRadius: 4,
borderColor: '#FFD93F',
borderWidth: 2,
marginBottom: 20
}
});

0 comments on commit 4907ada

Please sign in to comment.