1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

getParamsForGasEstimate extracts symbol from token instead of just accepting symbol.

This commit is contained in:
Dan 2018-05-19 22:08:25 -02:30
parent 6f633a97e1
commit 17909465f2
3 changed files with 6 additions and 6 deletions

View File

@ -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)),

View File

@ -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',

View File

@ -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',