2018-10-09 06:25:36 +02:00
|
|
|
import React, { Component } from 'react';
|
2018-11-02 14:53:35 +01:00
|
|
|
import { Text, View, Image, FlatList, RefreshControl, TouchableOpacity } from 'react-native';
|
2018-12-11 23:52:46 +01:00
|
|
|
import LinearGradient from 'react-native-linear-gradient';
|
2018-10-09 06:25:36 +02:00
|
|
|
import PropTypes from 'prop-types';
|
2018-12-11 23:52:46 +01:00
|
|
|
import { NavigationEvents } from 'react-navigation';
|
|
|
|
import { LightningCustodianWallet } from '../../class';
|
2018-10-09 06:25:36 +02:00
|
|
|
import {
|
|
|
|
BlueText,
|
|
|
|
BlueTransactionOnchainIcon,
|
|
|
|
ManageFundsBigButton,
|
|
|
|
BlueTransactionIncommingIcon,
|
|
|
|
BlueTransactionOutgoingIcon,
|
|
|
|
BlueTransactionPendingIcon,
|
|
|
|
BlueTransactionOffchainIcon,
|
|
|
|
BlueSendButtonIcon,
|
|
|
|
BlueReceiveButtonIcon,
|
|
|
|
BlueListItem,
|
|
|
|
} from '../../BlueComponents';
|
|
|
|
import { Icon } from 'react-native-elements';
|
2018-10-20 23:10:21 +02:00
|
|
|
import { BitcoinUnit } from '../../models/bitcoinUnits';
|
2018-10-09 06:25:36 +02:00
|
|
|
/** @type {AppStorage} */
|
2018-10-20 23:10:21 +02:00
|
|
|
|
2018-10-09 06:25:36 +02:00
|
|
|
let BlueApp = require('../../BlueApp');
|
|
|
|
let loc = require('../../loc');
|
|
|
|
const BigNumber = require('bignumber.js');
|
|
|
|
let EV = require('../../events');
|
|
|
|
|
|
|
|
export default class WalletTransactions extends Component {
|
|
|
|
static navigationOptions = ({ navigation }) => {
|
|
|
|
return {
|
|
|
|
headerRight: (
|
2018-11-02 14:53:35 +01:00
|
|
|
<TouchableOpacity
|
|
|
|
style={{ marginHorizontal: 8 }}
|
2018-10-09 06:25:36 +02:00
|
|
|
onPress={() =>
|
|
|
|
navigation.navigate('WalletDetails', {
|
|
|
|
address: navigation.state.params.wallet.getAddress(),
|
|
|
|
secret: navigation.state.params.wallet.getSecret(),
|
|
|
|
})
|
|
|
|
}
|
2018-11-02 14:53:35 +01:00
|
|
|
>
|
|
|
|
<Text style={{ color: '#fff', fontSize: 20, fontWeight: '500' }}>{loc.wallets.options}</Text>
|
|
|
|
</TouchableOpacity>
|
2018-10-09 06:25:36 +02:00
|
|
|
),
|
|
|
|
headerStyle: {
|
2018-12-11 23:52:46 +01:00
|
|
|
backgroundColor: navigation.getParam('gradients')[0],
|
2018-10-09 06:25:36 +02:00
|
|
|
borderBottomWidth: 0,
|
2018-11-02 14:53:35 +01:00
|
|
|
elevation: 0,
|
|
|
|
shadowRadius: 0,
|
2018-10-09 06:25:36 +02:00
|
|
|
},
|
|
|
|
headerTintColor: '#FFFFFF',
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2018-12-11 23:52:46 +01:00
|
|
|
|
|
|
|
// here, when we receive REMOTE_TRANSACTIONS_COUNT_CHANGED we fetch TXs and balance for current wallet
|
|
|
|
EV(EV.enum.REMOTE_TRANSACTIONS_COUNT_CHANGED, this.refreshTransactionsFunction.bind(this));
|
|
|
|
const wallet = props.navigation.getParam('wallet');
|
|
|
|
|
|
|
|
this.props.navigation.setParams({ wallet: wallet });
|
2018-10-09 06:25:36 +02:00
|
|
|
this.state = {
|
|
|
|
isLoading: true,
|
|
|
|
isTransactionsLoading: false,
|
2018-12-11 23:52:46 +01:00
|
|
|
wallet: wallet,
|
|
|
|
dataSource: wallet.getTransactions(),
|
2018-10-09 06:25:36 +02:00
|
|
|
};
|
2018-12-11 23:52:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
this.refreshFunction();
|
2018-10-09 06:25:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Forcefully fetches TXs and balance for wallet
|
|
|
|
*/
|
|
|
|
refreshTransactionsFunction() {
|
|
|
|
let that = this;
|
|
|
|
setTimeout(function() {
|
|
|
|
that.refreshTransactions();
|
|
|
|
}, 4000); // giving a chance to remote server to propagate
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Redraws the screen
|
|
|
|
*/
|
|
|
|
refreshFunction() {
|
|
|
|
setTimeout(() => {
|
|
|
|
console.log('wallets/transactions refreshFunction()');
|
|
|
|
let showSend = false;
|
|
|
|
let showReceive = false;
|
|
|
|
const wallet = this.state.wallet;
|
|
|
|
if (wallet) {
|
|
|
|
showSend = wallet.allowSend();
|
|
|
|
showReceive = wallet.allowReceive();
|
|
|
|
}
|
|
|
|
|
|
|
|
let showManageFundsBigButton = false;
|
|
|
|
let showManageFundsSmallButton = false;
|
|
|
|
if (wallet && wallet.type === new LightningCustodianWallet().type && wallet.getBalance() * 1 === 0) {
|
|
|
|
showManageFundsBigButton = true;
|
|
|
|
showManageFundsSmallButton = false;
|
|
|
|
} else if (wallet && wallet.type === new LightningCustodianWallet().type && wallet.getBalance() > 0) {
|
|
|
|
showManageFundsSmallButton = true;
|
|
|
|
showManageFundsBigButton = false;
|
|
|
|
}
|
|
|
|
|
2018-12-11 23:52:46 +01:00
|
|
|
let txs = wallet.getTransactions();
|
|
|
|
for (let tx of txs) {
|
|
|
|
tx.sort_ts = +new Date(tx.received);
|
|
|
|
}
|
|
|
|
txs = txs.sort(function(a, b) {
|
|
|
|
return b.sort_ts - a.sort_ts;
|
|
|
|
});
|
|
|
|
|
2018-10-09 06:25:36 +02:00
|
|
|
this.setState({
|
|
|
|
isLoading: false,
|
|
|
|
isTransactionsLoading: false,
|
|
|
|
showReceiveButton: showReceive,
|
|
|
|
showSendButton: showSend,
|
|
|
|
showManageFundsBigButton,
|
|
|
|
showManageFundsSmallButton,
|
2018-12-11 23:52:46 +01:00
|
|
|
dataSource: txs,
|
2018-10-09 06:25:36 +02:00
|
|
|
});
|
|
|
|
}, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
isLightning() {
|
|
|
|
let w = this.state.wallet;
|
|
|
|
if (w && w.type === new LightningCustodianWallet().type) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Forcefully fetches TXs and balance for wallet
|
|
|
|
*/
|
|
|
|
refreshTransactions() {
|
|
|
|
this.setState(
|
|
|
|
{
|
|
|
|
isTransactionsLoading: true,
|
|
|
|
},
|
|
|
|
async function() {
|
|
|
|
let that = this;
|
|
|
|
setTimeout(async function() {
|
|
|
|
// more responsive
|
|
|
|
let noErr = true;
|
|
|
|
try {
|
|
|
|
/** @type {LegacyWallet} */
|
|
|
|
let wallet = that.state.wallet;
|
|
|
|
await wallet.fetchBalance();
|
|
|
|
let start = +new Date();
|
|
|
|
await wallet.fetchTransactions();
|
2018-12-11 23:52:46 +01:00
|
|
|
if (wallet.fetchPendingTransactions) {
|
|
|
|
await wallet.fetchPendingTransactions();
|
|
|
|
}
|
2018-10-09 06:25:36 +02:00
|
|
|
let end = +new Date();
|
|
|
|
console.log(wallet.getLabel(), 'fetch tx took', (end - start) / 1000, 'sec');
|
|
|
|
} catch (err) {
|
|
|
|
noErr = false;
|
|
|
|
console.warn(err);
|
|
|
|
}
|
|
|
|
if (noErr) {
|
|
|
|
await BlueApp.saveToDisk(); // caching
|
|
|
|
EV(EV.enum.TRANSACTIONS_COUNT_CHANGED); // let other components know they should redraw
|
|
|
|
}
|
|
|
|
|
|
|
|
that.refreshFunction(); // Redraws the screen
|
|
|
|
}, 1);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-10-20 23:10:21 +02:00
|
|
|
changeWalletBalanceUnit() {
|
2018-12-16 17:24:23 +01:00
|
|
|
const { wallet } = this.state;
|
2018-12-18 06:58:49 +01:00
|
|
|
if (wallet.getPreferredBalanceUnit() === undefined || wallet.getPreferredBalanceUnit() === BitcoinUnit.BTC) {
|
|
|
|
wallet.setPreferredBalanceUnit(BitcoinUnit.SATS);
|
|
|
|
} else if (wallet.getPreferredBalanceUnit() === BitcoinUnit.SATS) {
|
2018-12-16 17:24:23 +01:00
|
|
|
wallet.setPreferredBalanceUnit(BitcoinUnit.LOCAL_CURRENCY);
|
2018-12-18 06:58:49 +01:00
|
|
|
} else if (wallet.getPreferredBalanceUnit() === BitcoinUnit.LOCAL_CURRENCY) {
|
2018-12-16 17:24:23 +01:00
|
|
|
wallet.setPreferredBalanceUnit(BitcoinUnit.BTC);
|
2018-10-20 23:10:21 +02:00
|
|
|
}
|
2018-12-18 06:58:49 +01:00
|
|
|
this.setState({ wallet: wallet }, async () => {
|
|
|
|
await BlueApp.saveToDisk();
|
|
|
|
});
|
2018-10-20 23:10:21 +02:00
|
|
|
}
|
|
|
|
|
2018-10-09 06:25:36 +02:00
|
|
|
renderWalletHeader = () => {
|
2018-12-11 23:52:46 +01:00
|
|
|
const gradients = this.props.navigation.getParam('gradients');
|
2018-10-09 06:25:36 +02:00
|
|
|
return (
|
2018-12-11 23:52:46 +01:00
|
|
|
<LinearGradient colors={[gradients[0], gradients[1]]} style={{ padding: 15, minHeight: 164 }}>
|
2018-10-09 06:25:36 +02:00
|
|
|
<Image
|
|
|
|
source={
|
|
|
|
(new LightningCustodianWallet().type === this.state.wallet.type && require('../../img/lnd-shape.png')) ||
|
|
|
|
require('../../img/btc-shape.png')
|
|
|
|
}
|
|
|
|
style={{
|
|
|
|
width: 99,
|
|
|
|
height: 94,
|
|
|
|
position: 'absolute',
|
|
|
|
bottom: 0,
|
|
|
|
right: 0,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Text style={{ backgroundColor: 'transparent' }} />
|
|
|
|
<Text
|
|
|
|
numberOfLines={1}
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
fontSize: 19,
|
|
|
|
color: '#fff',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{this.state.wallet.getLabel()}
|
|
|
|
</Text>
|
2018-10-20 23:10:21 +02:00
|
|
|
<TouchableOpacity onPress={() => this.changeWalletBalanceUnit()}>
|
|
|
|
<Text
|
|
|
|
numberOfLines={1}
|
|
|
|
adjustsFontSizeToFit
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
fontSize: 36,
|
|
|
|
color: '#fff',
|
|
|
|
}}
|
|
|
|
>
|
2018-12-16 17:24:23 +01:00
|
|
|
{loc.formatBalance(this.state.wallet.getBalance(), this.state.wallet.getPreferredBalanceUnit())}
|
2018-10-20 23:10:21 +02:00
|
|
|
</Text>
|
|
|
|
</TouchableOpacity>
|
2018-10-09 06:25:36 +02:00
|
|
|
<Text style={{ backgroundColor: 'transparent' }} />
|
|
|
|
<Text
|
|
|
|
numberOfLines={1}
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
fontSize: 13,
|
|
|
|
color: '#fff',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{loc.wallets.list.latest_transaction}
|
|
|
|
</Text>
|
|
|
|
<Text
|
|
|
|
numberOfLines={1}
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
fontSize: 16,
|
|
|
|
color: '#fff',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{loc.transactionTimeToReadable(this.state.wallet.getLatestTransactionTime())}
|
|
|
|
</Text>
|
|
|
|
</LinearGradient>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
txMemo(hash) {
|
|
|
|
if (BlueApp.tx_metadata[hash] && BlueApp.tx_metadata[hash]['memo']) {
|
|
|
|
return BlueApp.tx_metadata[hash]['memo'];
|
|
|
|
}
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
2018-11-01 20:44:39 +01:00
|
|
|
_keyExtractor = (_item, index) => index.toString();
|
2018-10-09 06:25:36 +02:00
|
|
|
|
|
|
|
renderListHeaderComponent = () => {
|
|
|
|
return (
|
|
|
|
<View style={{ flexDirection: 'row', height: 50 }}>
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
paddingLeft: 15,
|
|
|
|
paddingTop: 15,
|
|
|
|
fontWeight: 'bold',
|
|
|
|
fontSize: 24,
|
|
|
|
color: BlueApp.settings.foregroundColor,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{loc.transactions.list.title}
|
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { navigate } = this.props.navigation;
|
|
|
|
return (
|
|
|
|
<View style={{ flex: 1 }}>
|
2018-12-12 04:33:28 +01:00
|
|
|
<NavigationEvents
|
|
|
|
onWillFocus={() => {
|
|
|
|
this.refreshFunction();
|
|
|
|
}}
|
|
|
|
/>
|
2018-10-09 06:25:36 +02:00
|
|
|
{this.renderWalletHeader()}
|
|
|
|
<View style={{ flex: 1, backgroundColor: '#FFFFFF' }}>
|
|
|
|
{(() => {
|
|
|
|
if (this.state.showManageFundsSmallButton) {
|
|
|
|
return (
|
|
|
|
<TouchableOpacity
|
|
|
|
style={{ alignSelf: 'flex-end', right: 10, flexDirection: 'row' }}
|
|
|
|
onPress={() => {
|
2018-10-09 20:48:32 +02:00
|
|
|
console.log('navigating to', this.state.wallet.getLabel());
|
|
|
|
navigate('ManageFunds', { fromSecret: this.state.wallet.getSecret() });
|
2018-10-09 06:25:36 +02:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
<BlueText style={{ fontWeight: '600', fontSize: 16 }}>{loc.lnd.title}</BlueText>
|
|
|
|
<Icon
|
|
|
|
style={{ position: 'relative' }}
|
|
|
|
name="link"
|
|
|
|
type="font-awesome"
|
|
|
|
size={14}
|
|
|
|
color={BlueApp.settings.foregroundColor}
|
|
|
|
iconStyle={{ left: 5, transform: [{ rotate: '90deg' }] }}
|
|
|
|
/>
|
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
})()}
|
2018-11-01 20:44:39 +01:00
|
|
|
<FlatList
|
|
|
|
ListHeaderComponent={this.renderListHeaderComponent}
|
|
|
|
ListEmptyComponent={
|
2018-12-11 23:52:46 +01:00
|
|
|
<View style={{ top: 50, minHeight: 200 }}>
|
2018-11-01 20:44:39 +01:00
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
fontSize: 18,
|
|
|
|
color: '#9aa0aa',
|
|
|
|
textAlign: 'center',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{(this.isLightning() &&
|
|
|
|
'Lightning wallet should be used for your daily\ntransactions. Fees are unfairly cheap and\nspeed is blazing fast.') ||
|
|
|
|
loc.wallets.list.empty_txs1}
|
|
|
|
</Text>
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
fontSize: 18,
|
|
|
|
color: '#9aa0aa',
|
|
|
|
textAlign: 'center',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{(this.isLightning() && '\nTo start using it tap on "manage funds"\nand topup your balance') ||
|
|
|
|
loc.wallets.list.empty_txs2}
|
|
|
|
</Text>
|
|
|
|
|
|
|
|
<Text />
|
|
|
|
<Text />
|
|
|
|
|
|
|
|
{!this.isLightning() && (
|
2018-10-10 21:36:32 +02:00
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
fontSize: 18,
|
|
|
|
color: '#9aa0aa',
|
|
|
|
textAlign: 'center',
|
2018-11-01 20:44:39 +01:00
|
|
|
textDecorationLine: 'underline',
|
2018-10-10 21:36:32 +02:00
|
|
|
}}
|
2018-11-01 20:44:39 +01:00
|
|
|
onPress={() =>
|
|
|
|
this.props.navigation.navigate('BuyBitcoin', {
|
|
|
|
address: this.state.wallet.getAddress(),
|
|
|
|
secret: this.state.wallet.getSecret(),
|
|
|
|
})
|
|
|
|
}
|
2018-10-10 21:36:32 +02:00
|
|
|
>
|
2018-11-01 20:44:39 +01:00
|
|
|
{loc.wallets.list.tap_here_to_buy}
|
2018-10-10 21:36:32 +02:00
|
|
|
</Text>
|
2018-11-01 20:44:39 +01:00
|
|
|
)}
|
|
|
|
</View>
|
|
|
|
}
|
|
|
|
refreshControl={<RefreshControl onRefresh={() => this.refreshTransactions()} refreshing={this.state.isTransactionsLoading} />}
|
|
|
|
data={this.state.dataSource}
|
|
|
|
extraData={this.state.dataSource}
|
|
|
|
keyExtractor={this._keyExtractor}
|
|
|
|
renderItem={rowData => {
|
|
|
|
return (
|
|
|
|
<BlueListItem
|
|
|
|
avatar={(() => {
|
|
|
|
// is it lightning refill tx?
|
|
|
|
if (rowData.item.category === 'receive' && rowData.item.confirmations < 3) {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionPendingIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
2018-10-28 02:11:07 +02:00
|
|
|
|
2018-11-01 20:44:39 +01:00
|
|
|
if (rowData.item.type && rowData.item.type === 'bitcoind_tx') {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionOnchainIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (rowData.item.type === 'paid_invoice') {
|
|
|
|
// is it lightning offchain payment?
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionOffchainIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
2018-10-09 06:25:36 +02:00
|
|
|
|
2018-11-01 20:44:39 +01:00
|
|
|
if (!rowData.item.confirmations) {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionPendingIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
} else if (rowData.item.value < 0) {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionOutgoingIcon />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<View style={{ width: 25 }}>
|
|
|
|
<BlueTransactionIncommingIcon />
|
|
|
|
</View>
|
|
|
|
);
|
2018-10-09 06:25:36 +02:00
|
|
|
}
|
2018-11-01 20:44:39 +01:00
|
|
|
})()}
|
|
|
|
title={loc.transactionTimeToReadable(rowData.item.received)}
|
|
|
|
subtitle={
|
|
|
|
(rowData.item.confirmations < 7 ? loc.transactions.list.conf + ': ' + rowData.item.confirmations + ' ' : '') +
|
|
|
|
this.txMemo(rowData.item.hash) +
|
|
|
|
(rowData.item.memo || '')
|
|
|
|
}
|
|
|
|
onPress={() => {
|
|
|
|
if (rowData.item.hash) {
|
|
|
|
navigate('TransactionDetails', {
|
|
|
|
hash: rowData.item.hash,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
badge={{
|
|
|
|
value: 3,
|
|
|
|
textStyle: { color: 'orange' },
|
|
|
|
containerStyle: { marginTop: 0 },
|
|
|
|
}}
|
|
|
|
hideChevron
|
2018-12-16 17:24:23 +01:00
|
|
|
rightTitle={loc.formatBalance(
|
|
|
|
new BigNumber((rowData.item.value && rowData.item.value) || 0).dividedBy(100000000),
|
|
|
|
this.state.wallet.getPreferredBalanceUnit(),
|
|
|
|
)}
|
2018-11-01 20:44:39 +01:00
|
|
|
rightTitleStyle={{
|
|
|
|
fontWeight: '600',
|
|
|
|
fontSize: 16,
|
|
|
|
color: rowData.item.value / 100000000 < 0 ? BlueApp.settings.foregroundColor : '#37c0a1',
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}}
|
|
|
|
/>
|
2018-10-09 06:25:36 +02:00
|
|
|
</View>
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignSelf: 'center',
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
position: 'absolute',
|
|
|
|
bottom: 30,
|
|
|
|
borderRadius: 15,
|
|
|
|
overflow: 'hidden',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{(() => {
|
|
|
|
if (this.state.showReceiveButton) {
|
|
|
|
return (
|
|
|
|
<BlueReceiveButtonIcon
|
|
|
|
onPress={() => {
|
|
|
|
navigate('ReceiveDetails', { address: this.state.wallet.getAddress(), secret: this.state.wallet.getSecret() });
|
|
|
|
if (this.state.wallet.getAddress()) {
|
|
|
|
// EV(EV.enum.RECEIVE_ADDRESS_CHANGED, w.getAddress());
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
})()}
|
|
|
|
|
|
|
|
{(() => {
|
|
|
|
if (this.state.showSendButton) {
|
|
|
|
return (
|
|
|
|
<BlueSendButtonIcon
|
|
|
|
onPress={() => {
|
|
|
|
if (this.state.wallet.type === new LightningCustodianWallet().type) {
|
|
|
|
navigate('ScanLndInvoice', { fromSecret: this.state.wallet.getSecret() });
|
|
|
|
} else {
|
|
|
|
navigate('SendDetails', { fromAddress: this.state.wallet.getAddress(), fromSecret: this.state.wallet.getSecret() });
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
})()}
|
|
|
|
|
|
|
|
{(() => {
|
|
|
|
if (this.state.showManageFundsBigButton) {
|
|
|
|
return (
|
|
|
|
<ManageFundsBigButton
|
|
|
|
onPress={() => {
|
2018-10-09 20:48:32 +02:00
|
|
|
console.log('navigating to', this.state.wallet.getLabel());
|
2018-10-09 06:25:36 +02:00
|
|
|
navigate('ManageFunds', { fromSecret: this.state.wallet.getSecret() });
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
})()}
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WalletTransactions.propTypes = {
|
|
|
|
navigation: PropTypes.shape({
|
|
|
|
navigate: PropTypes.func,
|
|
|
|
goBack: PropTypes.func,
|
|
|
|
getParam: PropTypes.func,
|
|
|
|
setParams: PropTypes.func,
|
|
|
|
}),
|
|
|
|
};
|