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:
parent
6f633a97e1
commit
17909465f2
@ -760,8 +760,7 @@ function setGasTotal (gasTotal) {
|
|||||||
|
|
||||||
function getGasEstimate ({ selectedAddress, selectedToken, data }) {
|
function getGasEstimate ({ selectedAddress, selectedToken, data }) {
|
||||||
return (dispatch) => {
|
return (dispatch) => {
|
||||||
const { symbol } = selectedToken || {}
|
const estimateGasParams = getParamsForGasEstimate(selectedAddress, selectedToken, data)
|
||||||
const estimateGasParams = getParamsForGasEstimate(selectedAddress, symbol, data)
|
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
dispatch(actions.getGasPrice()),
|
dispatch(actions.getGasPrice()),
|
||||||
dispatch(actions.estimateGas(estimateGasParams)),
|
dispatch(actions.estimateGas(estimateGasParams)),
|
||||||
|
@ -139,7 +139,8 @@ function getAmountErrorObject ({
|
|||||||
return { amount: amountError }
|
return { amount: amountError }
|
||||||
}
|
}
|
||||||
|
|
||||||
function getParamsForGasEstimate (selectedAddress, symbol, data) {
|
function getParamsForGasEstimate (selectedAddress, selectedToken, data) {
|
||||||
|
const { symbol } = selectedToken || {}
|
||||||
const estimatedGasParams = {
|
const estimatedGasParams = {
|
||||||
from: selectedAddress,
|
from: selectedAddress,
|
||||||
gas: '746a528800',
|
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(
|
assert.deepEqual(
|
||||||
getParamsForGasEstimate('mockAddress', 'ABC'),
|
getParamsForGasEstimate('mockAddress', { symbol: 'ABC' }),
|
||||||
{
|
{
|
||||||
from: 'mockAddress',
|
from: 'mockAddress',
|
||||||
gas: '746a528800',
|
gas: '746a528800',
|
||||||
@ -160,7 +160,7 @@ describe('send utils', () => {
|
|||||||
|
|
||||||
it('should return data property if data provided', () => {
|
it('should return data property if data provided', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
getParamsForGasEstimate('mockAddress', 'ABC', 'somedata'),
|
getParamsForGasEstimate('mockAddress', { symbol: 'ABC' }, 'somedata'),
|
||||||
{
|
{
|
||||||
from: 'mockAddress',
|
from: 'mockAddress',
|
||||||
gas: '746a528800',
|
gas: '746a528800',
|
||||||
|
Loading…
Reference in New Issue
Block a user