2018-01-30 23:42:38 +01:00
|
|
|
import React, { Component } from 'react';
|
2018-03-18 03:48:23 +01:00
|
|
|
import { ActivityIndicator, View } from 'react-native';
|
2018-01-30 23:42:38 +01:00
|
|
|
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
|
|
import QRCode from 'react-native-qrcode';
|
2018-03-17 21:39:21 +01:00
|
|
|
import {
|
|
|
|
BlueSpacing,
|
|
|
|
SafeBlueArea,
|
|
|
|
BlueCard,
|
|
|
|
BlueText,
|
|
|
|
} from '../../BlueComponents';
|
2018-03-18 03:48:23 +01:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
/** @type {AppStorage} */
|
|
|
|
let BlueApp = require('../../BlueApp');
|
2018-01-30 23:42:38 +01:00
|
|
|
|
|
|
|
export default class WalletExport extends Component {
|
|
|
|
static navigationOptions = {
|
|
|
|
tabBarIcon: ({ tintColor, focused }) => (
|
|
|
|
<Ionicons
|
|
|
|
name={focused ? 'ios-briefcase' : 'ios-briefcase-outline'}
|
|
|
|
size={26}
|
|
|
|
style={{ color: tintColor }}
|
|
|
|
/>
|
|
|
|
),
|
2018-03-17 21:39:21 +01:00
|
|
|
};
|
2018-01-30 23:42:38 +01:00
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
2018-03-17 21:39:21 +01:00
|
|
|
let address = props.navigation.state.params.address;
|
|
|
|
let wallet;
|
2018-01-30 23:42:38 +01:00
|
|
|
|
2018-03-17 21:39:21 +01:00
|
|
|
for (let w of BlueApp.getWallets()) {
|
|
|
|
if (w.getAddress() === address) {
|
|
|
|
// found our wallet
|
|
|
|
wallet = w;
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
isLoading: true,
|
2018-03-17 21:39:21 +01:00
|
|
|
wallet,
|
|
|
|
};
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async componentDidMount() {
|
|
|
|
this.setState({
|
|
|
|
isLoading: false,
|
2018-03-17 21:39:21 +01:00
|
|
|
});
|
2018-01-30 23:42:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
if (this.state.isLoading) {
|
|
|
|
return (
|
2018-03-17 21:39:21 +01:00
|
|
|
<View style={{ flex: 1, paddingTop: 20 }}>
|
2018-01-30 23:42:38 +01:00
|
|
|
<ActivityIndicator />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
<BlueText style={{marginBottom: 10}}>
|
|
|
|
WIF stands for Wallet Import Format. Backup your WIF (also shown on QR) in a safe place.
|
|
|
|
</BlueText>
|
|
|
|
|
|
|
|
<Divider style={{ backgroundColor: '#ebebeb', marginBottom:20, }} />
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
return (
|
2018-03-17 21:39:21 +01:00
|
|
|
<SafeBlueArea style={{ flex: 1, paddingTop: 20 }}>
|
|
|
|
<BlueSpacing />
|
|
|
|
<BlueCard
|
|
|
|
title={'Wallet Export'}
|
|
|
|
style={{ alignItems: 'center', flex: 1 }}
|
|
|
|
>
|
2018-05-06 19:36:48 +02:00
|
|
|
<BlueText>{this.state.wallet.getAddress()}</BlueText>
|
2018-01-30 23:42:38 +01:00
|
|
|
<QRCode
|
|
|
|
value={this.state.wallet.getSecret()}
|
|
|
|
size={312}
|
|
|
|
bgColor={'white'}
|
2018-03-17 21:39:21 +01:00
|
|
|
fgColor={BlueApp.settings.brandingColor}
|
|
|
|
/>
|
2018-05-06 19:36:48 +02:00
|
|
|
<BlueText>
|
|
|
|
{this.state.wallet.getSecret()} [Wallet Import Format]
|
|
|
|
</BlueText>
|
2018-01-30 23:42:38 +01:00
|
|
|
</BlueCard>
|
|
|
|
</SafeBlueArea>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2018-03-18 03:48:23 +01:00
|
|
|
|
|
|
|
WalletExport.propTypes = {
|
|
|
|
navigation: PropTypes.shape({
|
|
|
|
state: PropTypes.shape({
|
|
|
|
params: PropTypes.shape({
|
|
|
|
address: PropTypes.string,
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
navigate: PropTypes.func,
|
|
|
|
goBack: PropTypes.func,
|
|
|
|
}),
|
|
|
|
};
|