diff options
author | Dan J Miller <danjm.com@gmail.com> | 2019-02-07 01:13:45 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-02-07 01:13:45 +0800 |
commit | 97e92a1b68fca9cde0d105ece135730a677a7413 (patch) | |
tree | 1c9014630c09f6ec3e9eb29a418ecd27e752a812 | |
parent | 798930afbaa01d691059db1cec4caf12414493b9 (diff) | |
download | tangerine-wallet-browser-97e92a1b68fca9cde0d105ece135730a677a7413.tar tangerine-wallet-browser-97e92a1b68fca9cde0d105ece135730a677a7413.tar.gz tangerine-wallet-browser-97e92a1b68fca9cde0d105ece135730a677a7413.tar.bz2 tangerine-wallet-browser-97e92a1b68fca9cde0d105ece135730a677a7413.tar.lz tangerine-wallet-browser-97e92a1b68fca9cde0d105ece135730a677a7413.tar.xz tangerine-wallet-browser-97e92a1b68fca9cde0d105ece135730a677a7413.tar.zst tangerine-wallet-browser-97e92a1b68fca9cde0d105ece135730a677a7413.zip |
Set custom gas data in state from inline advance gas controls on send screen (#6114)
-rw-r--r-- | ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js | 5 | ||||
-rw-r--r-- | ui/app/components/send/send-content/send-gas-row/tests/send-gas-row-container.test.js | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js b/ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js index b32928b75..96a6de424 100644 --- a/ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js +++ b/ui/app/components/send/send-content/send-gas-row/send-gas-row.container.js @@ -27,10 +27,13 @@ import { } from '../../../../ducks/send.duck' import { resetCustomData, + setCustomGasPrice, + setCustomGasLimit, } from '../../../../ducks/gas.duck' import { getGasLoadingError, gasFeeIsInError, getGasButtonGroupShown } from './send-gas-row.selectors.js' import { showModal, setGasPrice, setGasLimit, setGasTotal } from '../../../../actions' import { getAdvancedInlineGasShown, getCurrentEthBalance } from '../../../../selectors' +import { addHexPrefix } from 'ethereumjs-util' import SendGasRow from './send-gas-row.component' export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(SendGasRow) @@ -79,11 +82,13 @@ function mapDispatchToProps (dispatch) { setGasPrice: (newPrice, gasLimit) => { newPrice = decGWEIToHexWEI(newPrice) dispatch(setGasPrice(newPrice)) + dispatch(setCustomGasPrice(addHexPrefix(newPrice))) dispatch(setGasTotal(calcGasTotal(gasLimit, newPrice))) }, setGasLimit: (newLimit, gasPrice) => { newLimit = decimalToHex(newLimit) dispatch(setGasLimit(newLimit)) + dispatch(setCustomGasLimit(addHexPrefix(newLimit.toString(16)))) dispatch(setGasTotal(calcGasTotal(newLimit, gasPrice))) }, showGasButtonGroup: () => dispatch(showGasButtonGroup()), diff --git a/ui/app/components/send/send-content/send-gas-row/tests/send-gas-row-container.test.js b/ui/app/components/send/send-content/send-gas-row/tests/send-gas-row-container.test.js index 439f2ef6a..0d5dc4117 100644 --- a/ui/app/components/send/send-content/send-gas-row/tests/send-gas-row-container.test.js +++ b/ui/app/components/send/send-content/send-gas-row/tests/send-gas-row-container.test.js @@ -19,6 +19,8 @@ const sendDuckSpies = { const gasDuckSpies = { resetCustomData: sinon.spy(), + setCustomGasPrice: sinon.spy(), + setCustomGasLimit: sinon.spy(), } proxyquire('../send-gas-row.container.js', { @@ -123,9 +125,10 @@ describe('send-gas-row container', () => { describe('setGasPrice()', () => { it('should dispatch an action', () => { mapDispatchToPropsObject.setGasPrice('mockNewPrice', 'mockLimit') - assert(dispatchSpy.calledTwice) + assert(dispatchSpy.calledThrice) assert(actionSpies.setGasPrice.calledOnce) assert.equal(actionSpies.setGasPrice.getCall(0).args[0], '0xmockNewPrice000') + assert.equal(gasDuckSpies.setCustomGasPrice.getCall(0).args[0], '0xmockNewPrice000') assert(actionSpies.setGasTotal.calledOnce) assert.equal(actionSpies.setGasTotal.getCall(0).args[0], 'mockLimit0xmockNewPrice000') }) @@ -134,9 +137,10 @@ describe('send-gas-row container', () => { describe('setGasLimit()', () => { it('should dispatch an action', () => { mapDispatchToPropsObject.setGasLimit('mockNewLimit', 'mockPrice') - assert(dispatchSpy.calledTwice) + assert(dispatchSpy.calledThrice) assert(actionSpies.setGasLimit.calledOnce) assert.equal(actionSpies.setGasLimit.getCall(0).args[0], '0xmockNewLimit') + assert.equal(gasDuckSpies.setCustomGasLimit.getCall(0).args[0], '0xmockNewLimit') assert(actionSpies.setGasTotal.calledOnce) assert.equal(actionSpies.setGasTotal.getCall(0).args[0], '0xmockNewLimitmockPrice') }) |