|
|
@ -14,7 +14,7 @@ import { |
|
|
|
Text, |
|
|
|
} from 'react-native'; |
|
|
|
import { Icon } from 'react-native-elements'; |
|
|
|
import { BlueNavigationStyle, BlueButton, BlueBitcoinAmount } from '../../BlueComponents'; |
|
|
|
import { BlueNavigationStyle, BlueButton, BlueBitcoinAmount, BlueAddressInput } from '../../BlueComponents'; |
|
|
|
import PropTypes from 'prop-types'; |
|
|
|
import Modal from 'react-native-modal'; |
|
|
|
import NetworkTransactionFees, { NetworkTransactionFee } from '../../models/networkTransactionFees'; |
|
|
@ -23,7 +23,6 @@ import { BitcoinUnit } from '../../models/bitcoinUnits'; |
|
|
|
import { HDLegacyP2PKHWallet, HDSegwitP2SHWallet } from '../../class'; |
|
|
|
import ReactNativeHapticFeedback from 'react-native-haptic-feedback'; |
|
|
|
const bip21 = require('bip21'); |
|
|
|
let EV = require('../../events'); |
|
|
|
let BigNumber = require('bignumber.js'); |
|
|
|
/** @type {AppStorage} */ |
|
|
|
let BlueApp = require('../../BlueApp'); |
|
|
@ -82,11 +81,15 @@ export default class SendDetails extends Component { |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
async componentDidMount() { |
|
|
|
EV(EV.enum.CREATE_TRANSACTION_NEW_DESTINATION_ADDRESS, data => { |
|
|
|
this.setState( |
|
|
|
{ isLoading: false }, |
|
|
|
() => { |
|
|
|
processAddressData = data => { |
|
|
|
this.props.navigation.goBack(null); |
|
|
|
this.setState( |
|
|
|
{ isLoading: true }, |
|
|
|
() => { |
|
|
|
console.warn(data); |
|
|
|
if (BitcoinBIP70TransactionDecode.matchesPaymentURL(data)) { |
|
|
|
this.processBIP70Invoice(data); |
|
|
|
} else { |
|
|
|
data = data.replace('bitcoin:', ''); |
|
|
|
if (btcAddressRx.test(data) || data.indexOf('bc1') === 0) { |
|
|
|
this.setState({ |
|
|
@ -112,14 +115,15 @@ export default class SendDetails extends Component { |
|
|
|
bip70TransactionExpiration: null, |
|
|
|
isLoading: false, |
|
|
|
}); |
|
|
|
} else if (BitcoinBIP70TransactionDecode.matchesPaymentURL(data)) { |
|
|
|
this.processBIP70Invoice(data); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
true, |
|
|
|
); |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
true, |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
async componentDidMount() { |
|
|
|
let recommendedFees = await NetworkTransactionFees.recommendedFees().catch(response => { |
|
|
|
this.setState({ |
|
|
|
fee: response.halfHourFee, |
|
|
@ -497,56 +501,17 @@ export default class SendDetails extends Component { |
|
|
|
amount={this.state.amount} |
|
|
|
onChangeText={text => this.setState({ amount: text })} |
|
|
|
/> |
|
|
|
<View |
|
|
|
style={{ |
|
|
|
flexDirection: 'row', |
|
|
|
borderColor: '#d2d2d2', |
|
|
|
borderBottomColor: '#d2d2d2', |
|
|
|
borderWidth: 1.0, |
|
|
|
borderBottomWidth: 0.5, |
|
|
|
backgroundColor: '#f5f5f5', |
|
|
|
minHeight: 44, |
|
|
|
height: 44, |
|
|
|
marginHorizontal: 20, |
|
|
|
alignItems: 'center', |
|
|
|
marginVertical: 8, |
|
|
|
borderRadius: 4, |
|
|
|
<BlueAddressInput |
|
|
|
onChangeText={text => { |
|
|
|
if (!this.processBIP70Invoice(text)) { |
|
|
|
this.setState({ address: text.replace(' ', ''), isLoading: false, bip70TransactionExpiration: null }); |
|
|
|
} else { |
|
|
|
this.setState({ address: text.replace(' ', ''), isLoading: false, bip70TransactionExpiration: null }); |
|
|
|
} |
|
|
|
}} |
|
|
|
> |
|
|
|
<TextInput |
|
|
|
onChangeText={text => { |
|
|
|
if (!this.processBIP70Invoice(text)) { |
|
|
|
this.setState({ address: text.replace(' ', ''), isLoading: false, bip70TransactionExpiration: null }); |
|
|
|
} else { |
|
|
|
this.setState({ address: text.replace(' ', ''), isLoading: false, bip70TransactionExpiration: null }); |
|
|
|
} |
|
|
|
}} |
|
|
|
placeholder={loc.send.details.address} |
|
|
|
numberOfLines={1} |
|
|
|
value={this.state.address} |
|
|
|
style={{ flex: 1, marginHorizontal: 8, minHeight: 33 }} |
|
|
|
editable={!this.state.isLoading} |
|
|
|
/> |
|
|
|
<TouchableOpacity |
|
|
|
disabled={this.state.isLoading} |
|
|
|
onPress={() => this.props.navigation.navigate('ScanQrAddress')} |
|
|
|
style={{ |
|
|
|
width: 75, |
|
|
|
height: 36, |
|
|
|
flexDirection: 'row', |
|
|
|
alignItems: 'center', |
|
|
|
justifyContent: 'space-between', |
|
|
|
backgroundColor: '#bebebe', |
|
|
|
borderRadius: 4, |
|
|
|
paddingVertical: 4, |
|
|
|
paddingHorizontal: 8, |
|
|
|
marginHorizontal: 4, |
|
|
|
}} |
|
|
|
> |
|
|
|
<Icon name="qrcode" size={22} type="font-awesome" color="#FFFFFF" /> |
|
|
|
<Text style={{ color: '#FFFFFF' }}>{loc.send.details.scan}</Text> |
|
|
|
</TouchableOpacity> |
|
|
|
</View> |
|
|
|
onBarScanned={this.processAddressData} |
|
|
|
address={this.state.address} |
|
|
|
/> |
|
|
|
<View |
|
|
|
hide={!this.state.showMemoRow} |
|
|
|
style={{ |
|
|
|