-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Eth Legacy): load legacy sweep, amt not calculated correctly
- Loading branch information
plondon
committed
May 4, 2018
1 parent
a41b56c
commit d96160a
Showing
14 changed files
with
178 additions
and
135 deletions.
There are no files selected for viewing
119 changes: 76 additions & 43 deletions
119
packages/blockchain-wallet-v4-frontend/src/assets/locales/en.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/blockchain-wallet-v4-frontend/src/data/components/sendEth/actions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
packages/blockchain-wallet-v4-frontend/src/data/modules/transferEther/actionTypes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
|
||
export const INIT_TRANSFER_ETHER = 'INIT_TRANSFER_ETHER' | ||
|
||
export const TRANSFER_ETHER = 'TRANSFER_ETHER' | ||
export const CONFIRM_TRANSFER_ETH = 'CONFIRM_TRANSFER_ETH' |
4 changes: 1 addition & 3 deletions
4
packages/blockchain-wallet-v4-frontend/src/data/modules/transferEther/actions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import * as AT from './actionTypes' | ||
|
||
export const initTransferEther = (balance) => ({ type: AT.INIT_TRANSFER_ETHER, payload: { balance } }) | ||
|
||
export const transferEther = () => ({ type: AT.TRANSFER_ETHER }) | ||
export const confirmTransferEth = payload => ({ type: AT.CONFIRM_TRANSFER_ETH, payload }) |
7 changes: 3 additions & 4 deletions
7
packages/blockchain-wallet-v4-frontend/src/data/modules/transferEther/sagaRegister.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import { takeEvery, takeLatest } from 'redux-saga/effects' | ||
import { takeLatest } from 'redux-saga/effects' | ||
import * as AT from './actionTypes' | ||
import sagas from './sagas' | ||
|
||
export default ({ coreSagas }) => { | ||
const transferEtherSagas = sagas({ coreSagas }) | ||
const transferEthSagas = sagas({ coreSagas }) | ||
|
||
return function * () { | ||
yield takeEvery(AT.INIT_TRANSFER_ETHER, transferEtherSagas.initTransferEther) | ||
yield takeLatest(AT.TRANSFER_ETHER, transferEtherSagas.transferEther) | ||
yield takeLatest(AT.CONFIRM_TRANSFER_ETH, transferEthSagas.confirmTransferEth) | ||
} | ||
} |
41 changes: 18 additions & 23 deletions
41
packages/blockchain-wallet-v4-frontend/src/data/modules/transferEther/sagas.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,30 @@ | ||
import { put, call } from 'redux-saga/effects' | ||
import { call, put, select } from 'redux-saga/effects' | ||
import * as actions from '../../actions.js' | ||
import * as selectors from './selectors' | ||
import { promptForSecondPassword } from 'services/SagaService' | ||
import settings from 'config' | ||
|
||
export default ({ coreSagas }) => { | ||
const initTransferEther = function * (action) { | ||
const confirmTransferEth = function * (action) { | ||
try { | ||
const { balance } = action.payload | ||
const { to, effectiveBalance } = action.payload | ||
let p = yield select(selectors.getPayment) | ||
let payment = coreSagas.payment.eth.create({ payment: p.getOrElse({}), network: settings.NETWORK_ETHEREUM }) | ||
payment = yield payment.to(to) | ||
const password = yield call(promptForSecondPassword) | ||
payment = yield payment.amount(effectiveBalance) | ||
payment = yield payment.build() | ||
payment = yield payment.sign(password) | ||
yield payment.publish() | ||
yield put(actions.modals.closeAllModals()) | ||
yield put(actions.modals.showModal('TransferEther', { balance }, { loading: true })) | ||
yield call(coreSagas.data.ethereum.fetchFee) | ||
yield put(actions.modals.updateModalOptions({ loading: false })) | ||
yield put(actions.router.push('/eth/transactions')) | ||
yield put(actions.alerts.displaySuccess('Ether transaction has been successfully published!')) | ||
} catch (e) { | ||
yield put(actions.alerts.displayError('Could not init transfer ether.')) | ||
} | ||
} | ||
|
||
const transferEther = function * (action) { | ||
try { | ||
// const gasPrice = yield select(selectors.core.data.ethereum.getFeeRegular) | ||
// const gasLimit = yield select(selectors.core.data.ethereum.getGasLimit) | ||
// const legacyAccount = yield select(selectors.core.kvStore.ethereum.getLegacyAccount) | ||
// const accounts = yield select(selectors.core.kvStore.ethereum.getAccounts) | ||
// const defaultAccount = head(accounts) | ||
|
||
// const transaction = yield call(coreSagas.data.ethereum.buildTx, { from, to, amount, gasPrice, gasLimit }) | ||
} catch (e) { | ||
yield put(actions.alerts.displayError('Could not transfer ether.')) | ||
yield put(actions.alerts.displayError('Ether transaction could not be published.')) | ||
} | ||
} | ||
|
||
return { | ||
initTransferEther, | ||
transferEther | ||
confirmTransferEth | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/blockchain-wallet-v4-frontend/src/data/modules/transferEther/selectors.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { path } from 'ramda' | ||
|
||
export const getStep = path(['components', 'sendEth', 'step']) | ||
export const getPayment = path(['components', 'sendEth', 'payment']) |
45 changes: 27 additions & 18 deletions
45
packages/blockchain-wallet-v4-frontend/src/modals/TransferEther/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters