getParamsForGasEstimate extracts symbol from token instead of just accepting symbol.

feature/default_network_editable
Dan 7 years ago
parent 6f633a97e1
commit 17909465f2
  1. 3
      ui/app/actions.js
  2. 3
      ui/app/components/send_/send.utils.js
  3. 6
      ui/app/components/send_/tests/send-utils.test.js

@ -760,8 +760,7 @@ function setGasTotal (gasTotal) {
function getGasEstimate ({ selectedAddress, selectedToken, data }) {
return (dispatch) => {
const { symbol } = selectedToken || {}
const estimateGasParams = getParamsForGasEstimate(selectedAddress, symbol, data)
const estimateGasParams = getParamsForGasEstimate(selectedAddress, selectedToken, data)
return Promise.all([
dispatch(actions.getGasPrice()),
dispatch(actions.estimateGas(estimateGasParams)),

@ -139,7 +139,8 @@ function getAmountErrorObject ({
return { amount: amountError }
}
function getParamsForGasEstimate (selectedAddress, symbol, data) {
function getParamsForGasEstimate (selectedAddress, selectedToken, data) {
const { symbol } = selectedToken || {}
const estimatedGasParams = {
from: selectedAddress,
gas: '746a528800',

@ -147,9 +147,9 @@ describe('send utils', () => {
)
})
it('should return value property if symbol provided', () => {
it('should return value property if selected token provided', () => {
assert.deepEqual(
getParamsForGasEstimate('mockAddress', 'ABC'),
getParamsForGasEstimate('mockAddress', { symbol: 'ABC' }),
{
from: 'mockAddress',
gas: '746a528800',
@ -160,7 +160,7 @@ describe('send utils', () => {
it('should return data property if data provided', () => {
assert.deepEqual(
getParamsForGasEstimate('mockAddress', 'ABC', 'somedata'),
getParamsForGasEstimate('mockAddress', { symbol: 'ABC' }, 'somedata'),
{
from: 'mockAddress',
gas: '746a528800',

Loading…
Cancel
Save