Skip to content

Commit

Permalink
initial app launch wallet creation fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielLaanpere committed Jul 11, 2020
1 parent b10d60d commit 9668c0e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"android": "adb reverse tcp:8081 tcp:8081 && react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start --reset-cache",
"postinstall": "npx react-native link react-native-randombytes && ./node_modules/.bin/rn-nodeify --hack --install",
Expand Down
1 change: 1 addition & 0 deletions src/reducers/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const initialState = {
publicKey: null,
privateKey: null,
walletPirvateKey: null,
walletPath: null,
};

function reducer(state = initialState, action) {
Expand Down
10 changes: 8 additions & 2 deletions src/sagas/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ export function* initWallet() {
}

export function* createInitialWallet(action) {
const { payload } = yield take(REHYDRATE);
// Take two as we have two different persisted stores
const { payload: payload1 } = yield take(REHYDRATE);
const { payload: payload2 } = yield take(REHYDRATE);
const payload = { ...payload1, ...payload2 };

try {
if (payload?.wallet && !payload.wallet.address) {
if (!payload?.wallet?.address) {
const password = '';
let mnemonic = new Mnemonic();
while (!Mnemonic.isValid(mnemonic.toString())) {
Expand Down Expand Up @@ -89,12 +93,14 @@ export function* createInitialWallet(action) {
createInitialWalletSuccess({
password,
address,
addressPath,
walletWif,
addressWif,
xPrivKey,
publicKey,
privateKey,
walletPirvateKey,
walletPath,
seedWords: mnemonic.phrase,
}),
);
Expand Down

0 comments on commit 9668c0e

Please sign in to comment.