diff --git a/Navigation.js b/Navigation.js index 0cdd61db4..acc767ce1 100644 --- a/Navigation.js +++ b/Navigation.js @@ -60,6 +60,7 @@ import PsbtWithHardwareWallet from './screen/send/psbtWithHardwareWallet'; import PsbtMultisig from './screen/send/psbtMultisig'; import Success from './screen/send/success'; import Broadcast from './screen/send/broadcast'; +import IsItMyAddress from './screen/send/isItMyAddress'; import CoinControl from './screen/send/coinControl'; import ScanLndInvoice from './screen/lnd/scanLndInvoice'; @@ -148,6 +149,7 @@ const WalletsRoot = () => ( /> + { + /** @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 ( + + + + + + {loc.is_it_my_address.enter_address} + + + + + + + + + {result} + + + + + ); +}; + +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, + }, +}); diff --git a/screen/wallets/details.js b/screen/wallets/details.js index 8afa1392f..2945b868f 100644 --- a/screen/wallets/details.js +++ b/screen/wallets/details.js @@ -324,6 +324,10 @@ const WalletDetails = () => { navigate('Broadcast'); }; + const navigateToIsItMyAddress = () => { + navigate('IsItMyAddress'); + }; + const walletNameTextInputOnBlur = () => { if (walletName.trim().length === 0) { const walletLabel = wallet.getLabel(); @@ -512,6 +516,10 @@ const WalletDetails = () => { )} + <> + + +