diff --git a/App.js b/App.js
index 9397478f..035bb58e 100644
--- a/App.js
+++ b/App.js
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
import { Text, ScrollView, StyleSheet } from 'react-native';
import { DrawerNavigator, SafeAreaView } from 'react-navigation';
import MainBottomTabs from './MainBottomTabs';
+import Selftest from './screen/selftest';
require('./BlueApp');
@@ -66,22 +67,10 @@ const TabsInDrawer = DrawerNavigator(
},
},
- /* SecondaryBottomTabs: {
- screen: SecondaryBottomTabs,
- path: 'chat/aaa',
- navigationOptions: {
- drawer: () => ({
- label: 'SecondaryBottomTabs',
- icon: ({ tintColor }) => (
-
- ),
- }),
+ Selftest: {
+ screen: Selftest,
+ navigationOptions: {},
},
- }, */
},
{
contentComponent: CustomDrawerContentComponent,
diff --git a/SecondaryBottomTabs.js b/SecondaryBottomTabs.js
deleted file mode 100644
index b21a0de4..00000000
--- a/SecondaryBottomTabs.js
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * @flow
- */
-
-import React from 'react';
-import { Button, ScrollView } from 'react-native';
-import { SafeAreaView, StackNavigator, TabNavigator } from 'react-navigation';
-import PropTypes from 'prop-types';
-
-import Ionicons from 'react-native-vector-icons/Ionicons';
-
-const MyNavScreen = ({ navigation, banner }) => (
-
-
-
-
-);
-
-MyNavScreen.propTypes = {
- banner: PropTypes.string,
- navigation: PropTypes.shape({
- navigate: PropTypes.func,
- }),
-};
-
-const MyHomeScreen = ({ navigation }) => (
-
-);
-
-MyHomeScreen.propTypes = {
- navigation: PropTypes.shape({
- navigate: PropTypes.func,
- }),
-};
-
-const MyNotificationsSettingsScreen = ({ navigation }) => (
-
-);
-
-MyNotificationsSettingsScreen.propTypes = {
- navigation: PropTypes.shape({
- navigate: PropTypes.func,
- }),
-};
-
-const MySettingsScreen = ({ navigation }) => (
-
-);
-
-MySettingsScreen.propTypes = {
- navigation: PropTypes.shape({
- navigate: PropTypes.func,
- }),
-};
-
-var bitcoin = require('bitcoinjs-lib');
-var myString = bitcoin.ECPair.makeRandom().toWIF();
-
-const tabBarIconMainTab = ({ tintColor, focused }) => (
-
-);
-
-tabBarIconMainTab.propTypes = {
- tintColor: PropTypes.string,
- focused: PropTypes.boolean,
-};
-
-const tabBarIconSettingsTab = ({ tintColor, focused }) => (
-
-);
-
-tabBarIconSettingsTab.propTypes = {
- tintColor: PropTypes.string,
- focused: PropTypes.boolean,
-};
-
-const TabNav = TabNavigator(
- {
- MainTab: {
- screen: MyHomeScreen,
- path: '/',
- navigationOptions: {
- title: 'Welcome1 ' + myString,
- tabBarLabel: 'Transactions',
- tabBarIcon: tabBarIconMainTab,
- },
- },
- SettingsTab: {
- screen: MySettingsScreen,
- path: '/settings',
- navigationOptions: {
- title: 'Settings',
- tabBarIcon: tabBarIconSettingsTab,
- },
- },
- },
- {
- tabBarPosition: 'bottom',
- animationEnabled: false,
- swipeEnabled: false,
- },
-);
-
-const SecondaryBottomTabs = StackNavigator({
- Root: {
- screen: TabNav,
- },
- NotifSettings: {
- screen: MyNotificationsSettingsScreen,
- navigationOptions: {
- title: 'Notifications',
- },
- },
-});
-
-export default SecondaryBottomTabs;
diff --git a/class/app-storage.js b/class/app-storage.js
index 3f1a43cd..50bc5dab 100644
--- a/class/app-storage.js
+++ b/class/app-storage.js
@@ -1,4 +1,5 @@
-import { AsyncStorage } from 'react-native'
+import { AsyncStorage } from 'react-native';
+import { LegacyWallet, SegwitP2SHWallet, SegwitBech32Wallet } from './';
export class AppStorage {
constructor() {
diff --git a/class/constants.js b/class/constants.js
index 913df666..3631ed35 100644
--- a/class/constants.js
+++ b/class/constants.js
@@ -2,4 +2,4 @@
* Let's keep config vars, constants and definitions here
*/
-export const useBlockcypherTokens = false
+export const useBlockcypherTokens = false;
diff --git a/class/index.js b/class/index.js
index 3f86f7c9..d683d928 100644
--- a/class/index.js
+++ b/class/index.js
@@ -1,6 +1,6 @@
-export * from './abstract-wallet'
-export * from './app-storage'
-export * from './constants'
-export * from './legacy-wallet'
-export * from './segwit-bech-wallet'
-export * from './segwit-p2sh-wallet'
+export * from './abstract-wallet';
+export * from './app-storage';
+export * from './constants';
+export * from './legacy-wallet';
+export * from './segwit-bech-wallet';
+export * from './segwit-p2sh-wallet';
diff --git a/class/legacy-wallet.js b/class/legacy-wallet.js
index 25e4f75e..db7a1ad0 100644
--- a/class/legacy-wallet.js
+++ b/class/legacy-wallet.js
@@ -1,9 +1,10 @@
-import { AbstractWallet } from './abstract-wallet'
-import { useBlockcypherTokens } from './constants'
-import Frisbee from 'frisbee'
-const isaac = require('isaac')
-const BigNumber = require('bignumber.js')
-const bitcoin = require('bitcoinjs-lib')
+/* global fetch */
+import { AbstractWallet } from './abstract-wallet';
+import { useBlockcypherTokens } from './constants';
+import Frisbee from 'frisbee';
+const isaac = require('isaac');
+const BigNumber = require('bignumber.js');
+const bitcoin = require('bitcoinjs-lib');
/**
* Has private key and address signle like "1ABCD....."
@@ -256,6 +257,5 @@ export class LegacyWallet extends AbstractWallet {
let res = await api.get('/broadcast/' + txhex);
console.log('response', res.body);
return res.body;
-
}
}
diff --git a/class/segwit-bech-wallet.js b/class/segwit-bech-wallet.js
index bd89d065..986bc768 100644
--- a/class/segwit-bech-wallet.js
+++ b/class/segwit-bech-wallet.js
@@ -1,5 +1,5 @@
-import { LegacyWallet } from './legacy-wallet'
-const bitcoin = require('bitcoinjs-lib')
+import { LegacyWallet } from './legacy-wallet';
+const bitcoin = require('bitcoinjs-lib');
export class SegwitBech32Wallet extends LegacyWallet {
constructor() {
diff --git a/class/segwit-p2sh-wallet.js b/class/segwit-p2sh-wallet.js
index 07db0cf6..310e1a88 100644
--- a/class/segwit-p2sh-wallet.js
+++ b/class/segwit-p2sh-wallet.js
@@ -1,7 +1,7 @@
-import { LegacyWallet } from './legacy-wallet'
-const bitcoin = require('bitcoinjs-lib')
-const signer = require('../models/signer')
-const BigNumber = require('bignumber.js')
+import { LegacyWallet } from './legacy-wallet';
+const bitcoin = require('bitcoinjs-lib');
+const signer = require('../models/signer');
+const BigNumber = require('bignumber.js');
export class SegwitP2SHWallet extends LegacyWallet {
constructor() {
diff --git a/package.json b/package.json
index 51c2cee5..dac4e106 100644
--- a/package.json
+++ b/package.json
@@ -29,8 +29,8 @@
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"postinstall": "./node_modules/.bin/rn-nodeify --install buffer,events,process,stream,util,inherits,fs,path --hack",
- "test": "nodejs ./node_modules/.bin/mocha tests/* && node node_modules/jest/bin/jest.js && npm run lint",
- "lint": "./node_modules/.bin/eslint *.js screen/**/*.js screen/ --fix",
+ "test": "npm run test-only && node node_modules/jest/bin/jest.js && npm run lint",
+ "lint": "./node_modules/.bin/eslint *.js screen/**/*.js screen/ class/ --fix",
"test-only": "./node_modules/.bin/mocha tests/**/*.js"
},
"jest": {
diff --git a/screen/selftest.js b/screen/selftest.js
index 428cbd1e..e22b5db4 100644
--- a/screen/selftest.js
+++ b/screen/selftest.js
@@ -7,8 +7,10 @@ import {
SafeBlueArea,
BlueCard,
BlueText,
+ BlueButton,
BlueHeader,
} from '../BlueComponents';
+import PropTypes from 'prop-types';
import { SegwitP2SHWallet, LegacyWallet } from '../class';
let BlueApp = require('../BlueApp');
let BigNumber = require('bignumber.js');
@@ -38,7 +40,7 @@ export default class Selftest extends Component {
let uniqs = {};
let w = new SegwitP2SHWallet();
- for (let c = 0; c < 10000; c++) {
+ for (let c = 0; c < 1000; c++) {
w.generate();
if (uniqs[w.getSecret()]) {
errorMessage += 'failed to generate unique private key; ';
@@ -161,6 +163,14 @@ export default class Selftest extends Component {
);
}
})()}
+
+ {
+ this.props.navigation.goBack();
+ }}
+ />
@@ -168,4 +178,9 @@ export default class Selftest extends Component {
}
}
-Selftest.propTypes = {};
+Selftest.propTypes = {
+ navigation: PropTypes.shape({
+ navigate: PropTypes.func,
+ goBack: PropTypes.func,
+ }),
+};
diff --git a/screen/send/details.js b/screen/send/details.js
index a5b7887b..bb2a6e20 100644
--- a/screen/send/details.js
+++ b/screen/send/details.js
@@ -12,12 +12,12 @@ import {
BlueSpacing,
} from '../../BlueComponents';
import PropTypes from 'prop-types';
-const bip21 = require('bip21')
+const bip21 = require('bip21');
let EV = require('../../events');
let BigNumber = require('bignumber.js');
let BlueApp = require('../../BlueApp');
-const btcAddressRx = /^[a-zA-Z0-9]{26,35}$/
+const btcAddressRx = /^[a-zA-Z0-9]{26,35}$/;
export default class SendDetails extends Component {
static navigationOptions = {
@@ -67,16 +67,16 @@ export default class SendDetails extends Component {
if (btcAddressRx.test(data)) {
this.setState({
address: data,
- })
+ });
} else {
- const { address, options } = bip21.decode(data)
+ const { address, options } = bip21.decode(data);
if (btcAddressRx.test(address)) {
this.setState({
address,
amount: options.amount,
- memo: options.label
- })
+ memo: options.label,
+ });
}
}
});
diff --git a/screen/send/scanQrAddress.js b/screen/send/scanQrAddress.js
index 1f963cec..51519d91 100644
--- a/screen/send/scanQrAddress.js
+++ b/screen/send/scanQrAddress.js
@@ -19,11 +19,11 @@ export default class CameraExample extends React.Component {
};
async onBarCodeRead(ret) {
- if (this.ignoreRead) return
- this.ignoreRead = true
+ if (this.ignoreRead) return;
+ this.ignoreRead = true;
setTimeout(() => {
- this.ignoreRead = false
- }, 2000)
+ this.ignoreRead = false;
+ }, 2000);
this.props.navigation.goBack();
EV(EV.enum.CREATE_TRANSACTION_NEW_DESTINATION_ADDRESS, ret.data);
diff --git a/screen/settings.js b/screen/settings.js
index cbc1d33b..7b2da6bb 100644
--- a/screen/settings.js
+++ b/screen/settings.js
@@ -60,6 +60,7 @@ export default class Settings extends Component {
style: { color: '#fff', fontSize: 25 },
}}
/>
+
About
@@ -97,6 +98,13 @@ export default class Settings extends Component {
* Design by https://dribbble.com/chrometaphore
+
+ {
+ this.props.navigation.navigate('Selftest');
+ }}
+ title="Run self test"
+ />