mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-04 12:18:10 +01:00
Merge branch 'master' into scanlndhook
This commit is contained in:
commit
4be2d041a8
5 changed files with 177 additions and 1 deletions
|
@ -60,6 +60,7 @@ import PsbtWithHardwareWallet from './screen/send/psbtWithHardwareWallet';
|
||||||
import PsbtMultisig from './screen/send/psbtMultisig';
|
import PsbtMultisig from './screen/send/psbtMultisig';
|
||||||
import Success from './screen/send/success';
|
import Success from './screen/send/success';
|
||||||
import Broadcast from './screen/send/broadcast';
|
import Broadcast from './screen/send/broadcast';
|
||||||
|
import IsItMyAddress from './screen/send/isItMyAddress';
|
||||||
import CoinControl from './screen/send/coinControl';
|
import CoinControl from './screen/send/coinControl';
|
||||||
|
|
||||||
import ScanLndInvoice from './screen/lnd/scanLndInvoice';
|
import ScanLndInvoice from './screen/lnd/scanLndInvoice';
|
||||||
|
@ -148,6 +149,7 @@ const WalletsRoot = () => (
|
||||||
/>
|
/>
|
||||||
<WalletsStack.Screen name="HodlHodlViewOffer" component={HodlHodlViewOffer} options={HodlHodlViewOffer.navigationOptions} />
|
<WalletsStack.Screen name="HodlHodlViewOffer" component={HodlHodlViewOffer} options={HodlHodlViewOffer.navigationOptions} />
|
||||||
<WalletsStack.Screen name="Broadcast" component={Broadcast} options={Broadcast.navigationOptions} />
|
<WalletsStack.Screen name="Broadcast" component={Broadcast} options={Broadcast.navigationOptions} />
|
||||||
|
<WalletsStack.Screen name="IsItMyAddress" component={IsItMyAddress} options={IsItMyAddress.navigationOptions} />
|
||||||
<WalletsStack.Screen name="LnurlPay" component={LnurlPay} options={LnurlPay.navigationOptions} />
|
<WalletsStack.Screen name="LnurlPay" component={LnurlPay} options={LnurlPay.navigationOptions} />
|
||||||
<WalletsStack.Screen name="LnurlPaySuccess" component={LnurlPaySuccess} options={LnurlPaySuccess.navigationOptions} />
|
<WalletsStack.Screen name="LnurlPaySuccess" component={LnurlPaySuccess} options={LnurlPaySuccess.navigationOptions} />
|
||||||
<WalletsStack.Screen
|
<WalletsStack.Screen
|
||||||
|
|
|
@ -465,6 +465,12 @@
|
||||||
"input_path_explain": "skip to use default one ({default})",
|
"input_path_explain": "skip to use default one ({default})",
|
||||||
"view_edit_cosigners_title": "Edit Cosigners"
|
"view_edit_cosigners_title": "Edit Cosigners"
|
||||||
},
|
},
|
||||||
|
"is_it_my_address": {
|
||||||
|
"title": "Is it my address?",
|
||||||
|
"owns": "{label} owns {address}",
|
||||||
|
"enter_address": "Enter address:",
|
||||||
|
"check_address": "Check address"
|
||||||
|
},
|
||||||
"cc": {
|
"cc": {
|
||||||
"change": "change",
|
"change": "change",
|
||||||
"coins_selected": "Coins selected ({number})",
|
"coins_selected": "Coins selected ({number})",
|
||||||
|
|
156
screen/send/isItMyAddress.js
Normal file
156
screen/send/isItMyAddress.js
Normal file
|
@ -0,0 +1,156 @@
|
||||||
|
import React, { useState, useContext } from 'react';
|
||||||
|
import { StyleSheet, View, KeyboardAvoidingView, Platform, TextInput } from 'react-native';
|
||||||
|
import loc from '../../loc';
|
||||||
|
import {
|
||||||
|
SafeBlueArea,
|
||||||
|
BlueCard,
|
||||||
|
BlueButton,
|
||||||
|
BlueSpacing10,
|
||||||
|
BlueSpacing20,
|
||||||
|
BlueFormLabel,
|
||||||
|
BlueNavigationStyle,
|
||||||
|
BlueText,
|
||||||
|
BlueButtonLink,
|
||||||
|
} from '../../BlueComponents';
|
||||||
|
import { BlueCurrentTheme } from '../../components/themes';
|
||||||
|
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||||
|
import { useNavigation, useRoute, useTheme } from '@react-navigation/native';
|
||||||
|
|
||||||
|
const IsItMyAddress = () => {
|
||||||
|
/** @type {AbstractWallet[]} */
|
||||||
|
const wallets = useContext(BlueStorageContext).wallets;
|
||||||
|
const { navigate } = useNavigation();
|
||||||
|
const { name } = useRoute();
|
||||||
|
const { colors } = useTheme();
|
||||||
|
|
||||||
|
const [address, setAddress] = useState('');
|
||||||
|
const [result, setResult] = useState('');
|
||||||
|
|
||||||
|
const stylesHooks = StyleSheet.create({
|
||||||
|
blueArea: {
|
||||||
|
backgroundColor: colors.background,
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
color: colors.foregroundColor,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleUpdateAddress = nextValue => setAddress(nextValue.trim());
|
||||||
|
|
||||||
|
const checkAddress = () => {
|
||||||
|
const cleanAddress = address.replace('bitcoin:', '').replace('BITCOIN:', '').replace('bitcoin=', '').split('?')[0];
|
||||||
|
const _result = [];
|
||||||
|
for (const w of wallets) {
|
||||||
|
if (w.weOwnAddress(cleanAddress)) {
|
||||||
|
_result.push(loc.formatString(loc.is_it_my_address.owns, { label: w.getLabel(), address: cleanAddress }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setResult(_result.join('\n\n'));
|
||||||
|
};
|
||||||
|
|
||||||
|
const onBarScanned = value => {
|
||||||
|
setAddress(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const importScan = () => {
|
||||||
|
navigate('ScanQRCodeRoot', {
|
||||||
|
screen: 'ScanQRCode',
|
||||||
|
params: {
|
||||||
|
launchedBy: name,
|
||||||
|
onBarScanned,
|
||||||
|
showFileImportButton: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SafeBlueArea style={[styles.blueArea, stylesHooks.blueArea]}>
|
||||||
|
<KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'position' : null} keyboardShouldPersistTaps="handled">
|
||||||
|
<View style={styles.wrapper}>
|
||||||
|
<BlueCard style={styles.mainCard}>
|
||||||
|
<View style={styles.topFormRow}>
|
||||||
|
<BlueFormLabel>{loc.is_it_my_address.enter_address}</BlueFormLabel>
|
||||||
|
</View>
|
||||||
|
<TextInput
|
||||||
|
style={[styles.text, stylesHooks.text]}
|
||||||
|
maxHeight={100}
|
||||||
|
minHeight={100}
|
||||||
|
maxWidth="100%"
|
||||||
|
minWidth="100%"
|
||||||
|
multiline
|
||||||
|
editable
|
||||||
|
value={address}
|
||||||
|
onChangeText={handleUpdateAddress}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<BlueSpacing10 />
|
||||||
|
<BlueButtonLink title={loc.wallets.import_scan_qr} onPress={importScan} />
|
||||||
|
<BlueSpacing10 />
|
||||||
|
<BlueButton title={loc.is_it_my_address.check_address} onPress={checkAddress} />
|
||||||
|
<BlueSpacing20 />
|
||||||
|
<BlueText>{result}</BlueText>
|
||||||
|
</BlueCard>
|
||||||
|
</View>
|
||||||
|
</KeyboardAvoidingView>
|
||||||
|
</SafeBlueArea>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default IsItMyAddress;
|
||||||
|
IsItMyAddress.navigationOptions = () => ({
|
||||||
|
...BlueNavigationStyle(),
|
||||||
|
title: loc.is_it_my_address.title,
|
||||||
|
});
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
wrapper: {
|
||||||
|
marginTop: 16,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'flex-start',
|
||||||
|
},
|
||||||
|
blueArea: {
|
||||||
|
flex: 1,
|
||||||
|
paddingTop: 19,
|
||||||
|
},
|
||||||
|
broadcastResultWrapper: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: 'column',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
height: '100%',
|
||||||
|
width: '100%',
|
||||||
|
},
|
||||||
|
mainCard: {
|
||||||
|
padding: 0,
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'flex-start',
|
||||||
|
},
|
||||||
|
topFormRow: {
|
||||||
|
flex: 0.1,
|
||||||
|
flexBasis: 0.1,
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
paddingBottom: 10,
|
||||||
|
paddingTop: 0,
|
||||||
|
paddingRight: 100,
|
||||||
|
height: 30,
|
||||||
|
maxHeight: 30,
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
flex: 1,
|
||||||
|
borderColor: '#ebebeb',
|
||||||
|
backgroundColor: '#d2f8d6',
|
||||||
|
borderRadius: 4,
|
||||||
|
marginTop: 20,
|
||||||
|
color: BlueCurrentTheme.colors.foregroundColor,
|
||||||
|
fontWeight: '500',
|
||||||
|
fontSize: 14,
|
||||||
|
paddingHorizontal: 16,
|
||||||
|
paddingBottom: 16,
|
||||||
|
paddingTop: 16,
|
||||||
|
},
|
||||||
|
});
|
|
@ -131,8 +131,12 @@ const WalletsAddMultisigStep2 = () => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const onCreate = async () => {
|
const onCreate = () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
setTimeout(_onCreate, 100);
|
||||||
|
};
|
||||||
|
|
||||||
|
const _onCreate = async () => {
|
||||||
const w = new MultisigHDWallet();
|
const w = new MultisigHDWallet();
|
||||||
w.setM(m);
|
w.setM(m);
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
|
|
@ -324,6 +324,10 @@ const WalletDetails = () => {
|
||||||
navigate('Broadcast');
|
navigate('Broadcast');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const navigateToIsItMyAddress = () => {
|
||||||
|
navigate('IsItMyAddress');
|
||||||
|
};
|
||||||
|
|
||||||
const walletNameTextInputOnBlur = () => {
|
const walletNameTextInputOnBlur = () => {
|
||||||
if (walletName.trim().length === 0) {
|
if (walletName.trim().length === 0) {
|
||||||
const walletLabel = wallet.getLabel();
|
const walletLabel = wallet.getLabel();
|
||||||
|
@ -512,6 +516,10 @@ const WalletDetails = () => {
|
||||||
<SecondButton onPress={navigateToBroadcast} title={loc.settings.network_broadcast} />
|
<SecondButton onPress={navigateToBroadcast} title={loc.settings.network_broadcast} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
<>
|
||||||
|
<BlueSpacing20 />
|
||||||
|
<SecondButton onPress={navigateToIsItMyAddress} title={loc.is_it_my_address.title} />
|
||||||
|
</>
|
||||||
<BlueSpacing20 />
|
<BlueSpacing20 />
|
||||||
<BlueSpacing20 />
|
<BlueSpacing20 />
|
||||||
<TouchableOpacity onPress={handleDeleteButtonTapped}>
|
<TouchableOpacity onPress={handleDeleteButtonTapped}>
|
||||||
|
|
Loading…
Add table
Reference in a new issue