2018-01-30 23:42:38 +01:00
|
|
|
/** @type {AppStorage} */
|
2018-03-17 21:39:21 +01:00
|
|
|
let BlueApp = require('../../BlueApp');
|
2018-01-30 23:42:38 +01:00
|
|
|
import React, { Component } from 'react';
|
2018-03-17 21:39:21 +01:00
|
|
|
import { ActivityIndicator, TextInput, View } from 'react-native';
|
2018-01-30 23:42:38 +01:00
|
|
|
import Ionicons from 'react-native-vector-icons/Ionicons';
|
2018-03-17 21:39:21 +01:00
|
|
|
import { SafeAreaView } from 'react-navigation';
|
|
|
|
import { Icon, Card, Header } from 'react-native-elements';
|
|
|
|
import { List, Button, ListItem } from 'react-native-elements';
|
|
|
|
import {
|
|
|
|
Divider,
|
|
|
|
FormLabel,
|
|
|
|
FormInput,
|
|
|
|
Text,
|
|
|
|
FormValidationMessage,
|
|
|
|
} from 'react-native-elements';
|
2018-01-30 23:42:38 +01:00
|
|
|
import QRCode from 'react-native-qrcode';
|
2018-03-17 21:39:21 +01:00
|
|
|
import {
|
|
|
|
BlueSpacing,
|
|
|
|
BlueButton,
|
|
|
|
SafeBlueArea,
|
|
|
|
BlueCard,
|
|
|
|
BlueText,
|
|
|
|
BlueListItem,
|
|
|
|
BlueHeader,
|
|
|
|
} from '../../BlueComponents';
|
|
|
|
let EV = require('../../events');
|
2018-01-30 23:42:38 +01:00
|
|
|
let BigNumber = require('bignumber.js');
|
|
|
|
|
|
|
|
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() {
|
2018-03-17 21:39:21 +01:00
|
|
|
const { navigate } = this.props.navigation;
|
2018-01-30 23:42:38 +01:00
|
|
|
|
|
|
|
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-01-30 23:42:38 +01:00
|
|
|
<BlueText>Address: {this.state.wallet.getAddress()}</BlueText>
|
|
|
|
<BlueText>WIF: {this.state.wallet.getSecret()}</BlueText>
|
|
|
|
|
|
|
|
<QRCode
|
|
|
|
value={this.state.wallet.getSecret()}
|
|
|
|
size={312}
|
|
|
|
bgColor={'white'}
|
2018-03-17 21:39:21 +01:00
|
|
|
fgColor={BlueApp.settings.brandingColor}
|
|
|
|
/>
|
2018-01-30 23:42:38 +01:00
|
|
|
</BlueCard>
|
|
|
|
|
|
|
|
<BlueButton
|
2018-03-17 21:39:21 +01:00
|
|
|
icon={{ name: 'arrow-left', type: 'octicon' }}
|
|
|
|
onPress={() => this.props.navigation.goBack()}
|
2018-01-30 23:42:38 +01:00
|
|
|
title="Go back"
|
|
|
|
/>
|
|
|
|
</SafeBlueArea>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|