Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chantools: sweepremoteclosed #2102

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ import LspExplanationWrappedInvoices from './views/Explanations/LspExplanationWr
import LspExplanationOverview from './views/Explanations/LspExplanationOverview';
import RestoreChannelBackups from './views/Settings/EmbeddedNode/RestoreChannelBackups';

// Chantools
import Chantools from './views/Settings/EmbeddedNode/Chantools';
import Sweepremoteclosed from './views/Settings/EmbeddedNode/Chantools/Sweepremoteclosed';

import RawTxHex from './views/RawTxHex';

import CustodialWalletWarning from './views/Settings/CustodialWalletWarning';
Expand Down Expand Up @@ -450,6 +454,12 @@ const AppScenes = {
},
CustodialWalletWarning: {
screen: CustodialWalletWarning
},
Chantools: {
screen: Chantools
},
Sweepremoteclosed: {
screen: Sweepremoteclosed
}
};

Expand Down
6 changes: 6 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,12 @@
"views.Settings.CustodialWalletWarning.graph3": "ZEUS has the ability to create a self-custodial wallet in the app. This wallet provides you with a 24-word seed phrase that gives you full control of your funds.",
"views.Settings.CustodialWalletWarning.graph4": "To get started with your own self-custodial wallet, press the button below, and hit the 'Create mainnet wallet' button on the next screen.",
"views.Settings.CustodialWalletWarning.create": "Create self-custodial wallet",
"views.Settings.EmbeddedNode.Chantools.Sweepremoteclosed.seed": "Seed phrase",
"views.Settings.EmbeddedNode.Chantools.Sweepremoteclosed.recoveryWindow": "Recovery window",
"views.Settings.EmbeddedNode.Chantools.Sweepremoteclosed.sweepAddr": "Sweep address",
"views.Settings.EmbeddedNode.Chantools.Sweepremoteclosed.apiUrl": "API URL",
"views.Settings.EmbeddedNode.Chantools.Sweepremoteclosed.customApiUrl": "Custom API URL",
"views.Settings.EmbeddedNode.Chantools.Sweepremoteclosed.start": "Start sweep",
"views.LspExplanation.text1": "Zeus is a self-custodial lightning wallet. In order to send or receive a lightning payment, you must open a lightning payment channel, which has a setup fee.",
"views.LspExplanation.text2": "Once the channel is set up, you'll only have to pay normal network fees until your channel exhausts its capacity.",
"views.LspExplanation.buttonText": "Learn more about liquidity",
Expand Down
23 changes: 23 additions & 0 deletions views/Settings/EmbeddedNode/Advanced.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,29 @@ export default class EmbeddedNodeAdvancedSettings extends React.Component<
</Text>
</View>
</>
<>
<ListItem
containerStyle={{
backgroundColor: 'transparent'
}}
onPress={() => navigation.navigate('Chantools')}
>
<ListItem.Content>
<ListItem.Title
style={{
color: themeColor('text'),
fontFamily: 'PPNeueMontreal-Book'
}}
>
chantools
</ListItem.Title>
</ListItem.Content>
<Icon
name="keyboard-arrow-right"
color={themeColor('secondaryText')}
/>
</ListItem>
</>
<>
<View style={{ marginTop: 20 }}>
<Button
Expand Down
231 changes: 231 additions & 0 deletions views/Settings/EmbeddedNode/Chantools/Sweepremoteclosed.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
import * as React from 'react';
import { ScrollView, StyleSheet, View } from 'react-native';

import Button from '../../../../components/Button';
import DropdownSetting from '../../../../components/DropdownSetting';
import Header from '../../../../components/Header';
import OnchainFeeInput from '../../../../components/OnchainFeeInput';
import Screen from '../../../../components/Screen';
import Text from '../../../../components/Text';
import TextInput from '../../../../components/TextInput';

import { localeString } from '../../../../utils/LocaleUtils';
import { themeColor } from '../../../../utils/ThemeUtils';

export const API_URL_KEYS = [
{
key: 'https://blockstream.info/api',
value: 'https://blockstream.info/api'
},
{ key: 'https://mempool.space/api', value: 'https://mempool.space/api' },
{ key: 'Custom', value: 'Custom' }
];

interface SweepremoteclosedProps {
navigation: any;
}

interface SweepremoteclosedState {
seed: string;
sweepAddr: string;
apiUrl: string;
customApiUrl: string;
feeRate: string;
recoveryWindow: string;
loading: boolean;
}

export default class Sweepremoteclosed extends React.Component<
SweepremoteclosedProps,
SweepremoteclosedState
> {
state = {
seed: '',
sweepAddr: '',
apiUrl: 'https://mempool.space/api',
customApiUrl: '',
feeRate: '21',
recoveryWindow: '200',
loading: false
};

render() {
const { navigation } = this.props;
const {
seed,
sweepAddr,
apiUrl,
customApiUrl,
feeRate,
recoveryWindow,
loading
} = this.state;
return (
<Screen>
<View style={{ flex: 1 }}>
<Header
leftComponent="Back"
centerComponent={{
text: 'sweepremoteclosed',
style: {
color: themeColor('text'),
fontFamily: 'PPNeueMontreal-Book'
}
}}
navigation={navigation}
/>
<ScrollView style={{ margin: 10 }}>
<>
<Text
style={{
...styles.text,
color: themeColor('secondaryText')
}}
>
{localeString(
'views.Settings.EmbeddedNode.Chantools.Sweepremoteclosed.seed'
)}
</Text>
<TextInput
placeholder={
'cherry truth mask employ box silver mass bunker fiscal vote'
}
value={seed}
onChangeText={(text: string) =>
this.setState({
seed: text
})
}
locked={loading}
/>
</>
<>
<Text
style={{
...styles.text,
color: themeColor('secondaryText')
}}
>
{localeString(
'views.Settings.EmbeddedNode.Chantools.Sweepremoteclosed.sweepAddr'
)}
</Text>
<TextInput
value={sweepAddr}
onChangeText={(text: string) =>
this.setState({
sweepAddr: text
})
}
locked={loading}
/>
</>
<>
<Text
style={{
...styles.text,
color: themeColor('secondaryText')
}}
>
{localeString('views.Send.feeSatsVbyte')}
</Text>
<OnchainFeeInput
fee={feeRate}
onChangeFee={(text: string) => {
this.setState({
feeRate: text
});
}}
/>
</>
<>
<Text
style={{
...styles.text,
color: themeColor('secondaryText')
}}
>
{localeString(
'views.Settings.EmbeddedNode.Chantools.Sweepremoteclosed.recoveryWindow'
)}
</Text>
<TextInput
placeholder={'200'}
value={recoveryWindow}
onChangeText={(text: string) =>
this.setState({
recoveryWindow: text
})
}
locked={loading}
keyboardType="numeric"
/>
</>
<View style={{ marginTop: 10 }}>
<DropdownSetting
title={localeString(
'views.Settings.EmbeddedNode.Chantools.Sweepremoteclosed.apiUrl'
)}
selectedValue={apiUrl}
onValueChange={(value: string) => {
this.setState({
apiUrl: value
});
}}
values={API_URL_KEYS}
/>
</View>
{apiUrl === 'Custom' && (
<>
<Text
style={{
...styles.text,
color: themeColor('secondaryText')
}}
>
{localeString(
'views.Settings.EmbeddedNode.Chantools.Sweepremoteclosed.customApiUrl'
)}
</Text>
<TextInput
value={customApiUrl}
onChangeText={(text: string) =>
this.setState({
sweepAddr: text
})
}
locked={customApiUrl}
/>
</>
)}
</ScrollView>
<View style={{ bottom: 10 }}>
<View
style={{
paddingTop: 30,
paddingBottom: 15,
paddingLeft: 10,
paddingRight: 10
}}
>
<Button
title={localeString(
'views.Settings.EmbeddedNode.Chantools.Sweepremoteclosed.start'
)}
onPress={() => {
console.log('start sweepremoteclosed');
}}
/>
</View>
</View>
</View>
</Screen>
);
}
}

const styles = StyleSheet.create({
text: {
fontFamily: 'PPNeueMontreal-Book'
}
});
62 changes: 62 additions & 0 deletions views/Settings/EmbeddedNode/Chantools/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import * as React from 'react';
import { ScrollView, View } from 'react-native';
import { Icon, ListItem } from 'react-native-elements';

import Header from '../../../../components/Header';
import Screen from '../../../../components/Screen';

import { themeColor } from '../../../../utils/ThemeUtils';

interface ChantoolsProps {
navigation: any;
}

export default class Chantools extends React.Component<ChantoolsProps, {}> {
render() {
const { navigation } = this.props;
return (
<Screen>
<View style={{ flex: 1 }}>
<Header
leftComponent="Back"
centerComponent={{
text: 'chantools',
style: {
color: themeColor('text'),
fontFamily: 'PPNeueMontreal-Book'
}
}}
navigation={navigation}
/>
<ScrollView>
<>
<ListItem
containerStyle={{
backgroundColor: 'transparent'
}}
onPress={() =>
navigation.navigate('Sweepremoteclosed')
}
>
<ListItem.Content>
<ListItem.Title
style={{
color: themeColor('text'),
fontFamily: 'PPNeueMontreal-Book'
}}
>
sweepremoteclosed
</ListItem.Title>
</ListItem.Content>
<Icon
name="keyboard-arrow-right"
color={themeColor('secondaryText')}
/>
</ListItem>
</>
</ScrollView>
</View>
</Screen>
);
}
}
Loading