|
|
|
import { GAS_ESTIMATE_TYPES, GAS_LIMITS } from '../../shared/constants/gas';
|
|
|
|
import {
|
|
|
|
getCustomGasLimit,
|
|
|
|
getCustomGasPrice,
|
|
|
|
getRenderableBasicEstimateData,
|
|
|
|
getRenderableEstimateDataForSmallButtonsFromGWEI,
|
|
|
|
isCustomPriceSafe,
|
|
|
|
isCustomPriceExcessive,
|
|
|
|
} from './custom-gas';
|
|
|
|
|
|
|
|
describe('custom-gas selectors', () => {
|
|
|
|
describe('getCustomGasPrice()', () => {
|
|
|
|
it('should return gas.customData.price', () => {
|
|
|
|
const mockState = { gas: { customData: { price: 'mockPrice' } } };
|
|
|
|
expect(getCustomGasPrice(mockState)).toStrictEqual('mockPrice');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe('isCustomGasPriceSafe()', () => {
|
|
|
|
it('should return true for gas.customData.price 0x77359400', () => {
|
|
|
|
const mockState = {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
low: '1',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
customData: { price: '0x77359400' },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
expect(isCustomPriceSafe(mockState)).toStrictEqual(true);
|
|
|
|
});
|
|
|
|
it('should return true for gas.customData.price null', () => {
|
|
|
|
const mockState = {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
low: '1',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
customData: { price: null },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
expect(isCustomPriceSafe(mockState)).toStrictEqual(true);
|
|
|
|
});
|
|
|
|
it('should return true gas.customData.price undefined', () => {
|
|
|
|
const mockState = {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
low: '1',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
customData: { price: undefined },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
expect(isCustomPriceSafe(mockState)).toStrictEqual(true);
|
|
|
|
});
|
|
|
|
it('should return false gas.basicEstimates.safeLow undefined', () => {
|
|
|
|
const mockState = {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.NONE,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
low: undefined,
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
customData: { price: '0x77359400' },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
expect(isCustomPriceSafe(mockState)).toStrictEqual(false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('isCustomPriceExcessive()', () => {
|
|
|
|
it('should return false for gas.customData.price null', () => {
|
|
|
|
const mockState = {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
high: '150',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
customData: { price: null },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
expect(isCustomPriceExcessive(mockState)).toStrictEqual(false);
|
|
|
|
});
|
|
|
|
it('should return false gas.basicEstimates.fast undefined', () => {
|
|
|
|
const mockState = {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
high: undefined,
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
customData: { price: '0x77359400' },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
expect(isCustomPriceExcessive(mockState)).toStrictEqual(false);
|
|
|
|
});
|
|
|
|
it('should return false gas.basicEstimates.price 0x205d0bae00 (139)', () => {
|
|
|
|
const mockState = {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
high: '139',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
customData: { price: '0x205d0bae00' },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
expect(isCustomPriceExcessive(mockState)).toStrictEqual(false);
|
|
|
|
});
|
|
|
|
it('should return false gas.basicEstimates.price 0x1bf08eb000 (120)', () => {
|
|
|
|
const mockState = {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
high: '139',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
customData: { price: '0x1bf08eb000' },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
expect(isCustomPriceExcessive(mockState)).toStrictEqual(false);
|
|
|
|
});
|
|
|
|
it('should return false gas.basicEstimates.price 0x28bed01600 (175)', () => {
|
|
|
|
const mockState = {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
high: '139',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
customData: { price: '0x28bed01600' },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
expect(isCustomPriceExcessive(mockState)).toStrictEqual(false);
|
|
|
|
});
|
|
|
|
it('should return true gas.basicEstimates.price 0x30e4f9b400 (210)', () => {
|
|
|
|
const mockState = {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
high: '139',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
customData: { price: '0x30e4f9b400' },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
expect(isCustomPriceExcessive(mockState)).toStrictEqual(true);
|
|
|
|
});
|
|
|
|
it('should return false gas.basicEstimates.price 0x28bed01600 (175) (checkSend=true)', () => {
|
|
|
|
const mockState = {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
high: '139',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
send: {
|
|
|
|
gas: {
|
|
|
|
gasPrice: '0x28bed0160',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
customData: { price: null },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
expect(isCustomPriceExcessive(mockState, true)).toStrictEqual(false);
|
|
|
|
});
|
|
|
|
it('should return true gas.basicEstimates.price 0x30e4f9b400 (210) (checkSend=true)', () => {
|
|
|
|
const mockState = {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
high: '139',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
send: {
|
|
|
|
gas: {
|
|
|
|
gasPrice: '0x30e4f9b400',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
gas: {
|
|
|
|
customData: { price: null },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
expect(isCustomPriceExcessive(mockState, true)).toStrictEqual(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('getCustomGasLimit()', () => {
|
|
|
|
it('should return gas.customData.limit', () => {
|
|
|
|
const mockState = { gas: { customData: { limit: 'mockLimit' } } };
|
|
|
|
expect(getCustomGasLimit(mockState)).toStrictEqual('mockLimit');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('getRenderableBasicEstimateData()', () => {
|
|
|
|
const tests = [
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'SLOW',
|
|
|
|
feeInSecondaryCurrency: '$0.01',
|
|
|
|
feeInPrimaryCurrency: '0.0000525 ETH',
|
|
|
|
priceInHexWei: '0x9502f900',
|
|
|
|
},
|
|
|
|
{
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'AVERAGE',
|
|
|
|
feeInPrimaryCurrency: '0.000084 ETH',
|
|
|
|
feeInSecondaryCurrency: '$0.02',
|
|
|
|
priceInHexWei: '0xee6b2800',
|
|
|
|
},
|
|
|
|
{
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'FAST',
|
|
|
|
feeInSecondaryCurrency: '$0.03',
|
|
|
|
feeInPrimaryCurrency: '0.000105 ETH',
|
|
|
|
priceInHexWei: '0x12a05f200',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
low: '2.5',
|
|
|
|
medium: '4',
|
|
|
|
high: '5',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
conversionRate: 255.71,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: false,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'mainnet',
|
|
|
|
chainId: '0x1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'SLOW',
|
|
|
|
feeInSecondaryCurrency: '$0.27',
|
|
|
|
feeInPrimaryCurrency: '0.000105 ETH',
|
|
|
|
priceInHexWei: '0x12a05f200',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInPrimaryCurrency: '0.000147 ETH',
|
|
|
|
feeInSecondaryCurrency: '$0.38',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'AVERAGE',
|
|
|
|
priceInHexWei: '0x1a13b8600',
|
|
|
|
},
|
|
|
|
{
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'FAST',
|
|
|
|
feeInSecondaryCurrency: '$0.54',
|
|
|
|
feeInPrimaryCurrency: '0.00021 ETH',
|
|
|
|
priceInHexWei: '0x2540be400',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
low: '5',
|
|
|
|
medium: '7',
|
|
|
|
high: '10',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: false,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'mainnet',
|
|
|
|
chainId: '0x1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
send: {
|
|
|
|
gas: {
|
|
|
|
gasLimit: GAS_LIMITS.SIMPLE,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'SLOW',
|
|
|
|
feeInSecondaryCurrency: '',
|
|
|
|
feeInPrimaryCurrency: '0.000105 ETH',
|
|
|
|
priceInHexWei: '0x12a05f200',
|
|
|
|
},
|
|
|
|
{
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'AVERAGE',
|
|
|
|
feeInPrimaryCurrency: '0.000147 ETH',
|
|
|
|
feeInSecondaryCurrency: '',
|
|
|
|
priceInHexWei: '0x1a13b8600',
|
|
|
|
},
|
|
|
|
{
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'FAST',
|
|
|
|
feeInSecondaryCurrency: '',
|
|
|
|
feeInPrimaryCurrency: '0.00021 ETH',
|
|
|
|
priceInHexWei: '0x2540be400',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
low: '5',
|
|
|
|
medium: '7',
|
|
|
|
high: '10',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: false,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'rinkeby',
|
|
|
|
chainId: '0x4',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
send: {
|
|
|
|
gas: {
|
|
|
|
gasLimit: GAS_LIMITS.SIMPLE,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'SLOW',
|
|
|
|
feeInSecondaryCurrency: '$0.27',
|
|
|
|
feeInPrimaryCurrency: '0.000105 ETH',
|
|
|
|
priceInHexWei: '0x12a05f200',
|
|
|
|
},
|
|
|
|
{
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'AVERAGE',
|
|
|
|
feeInPrimaryCurrency: '0.000147 ETH',
|
|
|
|
feeInSecondaryCurrency: '$0.38',
|
|
|
|
priceInHexWei: '0x1a13b8600',
|
|
|
|
},
|
|
|
|
{
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'FAST',
|
|
|
|
feeInSecondaryCurrency: '$0.54',
|
|
|
|
feeInPrimaryCurrency: '0.00021 ETH',
|
|
|
|
priceInHexWei: '0x2540be400',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
low: '5',
|
|
|
|
medium: '7',
|
|
|
|
high: '10',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: true,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'rinkeby',
|
|
|
|
chainId: '0x4',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
send: {
|
|
|
|
gas: {
|
|
|
|
gasLimit: GAS_LIMITS.SIMPLE,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'SLOW',
|
|
|
|
feeInSecondaryCurrency: '$0.27',
|
|
|
|
feeInPrimaryCurrency: '0.000105 ETH',
|
|
|
|
priceInHexWei: '0x12a05f200',
|
|
|
|
},
|
|
|
|
{
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'AVERAGE',
|
|
|
|
feeInPrimaryCurrency: '0.000147 ETH',
|
|
|
|
feeInSecondaryCurrency: '$0.38',
|
|
|
|
priceInHexWei: '0x1a13b8600',
|
|
|
|
},
|
|
|
|
{
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'FAST',
|
|
|
|
feeInSecondaryCurrency: '$0.54',
|
|
|
|
feeInPrimaryCurrency: '0.00021 ETH',
|
|
|
|
priceInHexWei: '0x2540be400',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
low: '5',
|
|
|
|
medium: '7',
|
|
|
|
high: '10',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: true,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'mainnet',
|
|
|
|
chainId: '0x1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
send: {
|
|
|
|
gas: {
|
|
|
|
gasLimit: GAS_LIMITS.SIMPLE,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
it('should return renderable data about basic estimates', () => {
|
|
|
|
tests.forEach((test) => {
|
|
|
|
expect(
|
|
|
|
getRenderableBasicEstimateData(
|
|
|
|
test.mockState,
|
|
|
|
GAS_LIMITS.SIMPLE,
|
|
|
|
test.useFastestButtons,
|
|
|
|
),
|
|
|
|
).toStrictEqual(test.expectedResult);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('getRenderableEstimateDataForSmallButtonsFromGWEI()', () => {
|
|
|
|
const tests = [
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$0.13',
|
|
|
|
feeInPrimaryCurrency: '0.00052 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'SLOW',
|
|
|
|
priceInHexWei: '0x5d21dba00',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$0.16',
|
|
|
|
feeInPrimaryCurrency: '0.00063 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'AVERAGE',
|
|
|
|
priceInHexWei: '0x6fc23ac00',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$0.27',
|
|
|
|
feeInPrimaryCurrency: '0.00105 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'FAST',
|
|
|
|
priceInHexWei: '0xba43b7400',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
low: '25',
|
|
|
|
medium: '30',
|
|
|
|
high: '50',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
conversionRate: 255.71,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: false,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'mainnet',
|
|
|
|
chainId: '0x1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
send: {
|
|
|
|
gas: {
|
|
|
|
gasLimit: GAS_LIMITS.SIMPLE,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$2.68',
|
|
|
|
feeInPrimaryCurrency: '0.00105 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'SLOW',
|
|
|
|
priceInHexWei: '0xba43b7400',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$4.03',
|
|
|
|
feeInPrimaryCurrency: '0.00157 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'AVERAGE',
|
|
|
|
priceInHexWei: '0x1176592e00',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$5.37',
|
|
|
|
feeInPrimaryCurrency: '0.0021 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'FAST',
|
|
|
|
priceInHexWei: '0x174876e800',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
low: '50',
|
|
|
|
medium: '75',
|
|
|
|
high: '100',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: false,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'mainnet',
|
|
|
|
chainId: '0x1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
send: {
|
|
|
|
gas: {
|
|
|
|
gasLimit: GAS_LIMITS.SIMPLE,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '',
|
|
|
|
feeInPrimaryCurrency: '0.00105 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'SLOW',
|
|
|
|
priceInHexWei: '0xba43b7400',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '',
|
|
|
|
feeInPrimaryCurrency: '0.00157 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'AVERAGE',
|
|
|
|
priceInHexWei: '0x1176592e00',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '',
|
|
|
|
feeInPrimaryCurrency: '0.0021 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'FAST',
|
|
|
|
priceInHexWei: '0x174876e800',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
low: '50',
|
|
|
|
medium: '75',
|
|
|
|
high: '100',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: false,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'rinkeby',
|
|
|
|
chainId: '0x4',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
send: {
|
|
|
|
gas: {
|
|
|
|
gasLimit: GAS_LIMITS.SIMPLE,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$2.68',
|
|
|
|
feeInPrimaryCurrency: '0.00105 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'SLOW',
|
|
|
|
priceInHexWei: '0xba43b7400',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$4.03',
|
|
|
|
feeInPrimaryCurrency: '0.00157 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'AVERAGE',
|
|
|
|
priceInHexWei: '0x1176592e00',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$5.37',
|
|
|
|
feeInPrimaryCurrency: '0.0021 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'FAST',
|
|
|
|
priceInHexWei: '0x174876e800',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
low: '50',
|
|
|
|
medium: '75',
|
|
|
|
high: '100',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: true,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'rinkeby',
|
|
|
|
chainId: '0x4',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
send: {
|
|
|
|
gas: {
|
|
|
|
gasLimit: GAS_LIMITS.SIMPLE,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expectedResult: [
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$2.68',
|
|
|
|
feeInPrimaryCurrency: '0.00105 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'SLOW',
|
|
|
|
priceInHexWei: '0xba43b7400',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$4.03',
|
|
|
|
feeInPrimaryCurrency: '0.00157 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'AVERAGE',
|
|
|
|
priceInHexWei: '0x1176592e00',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
feeInSecondaryCurrency: '$5.37',
|
|
|
|
feeInPrimaryCurrency: '0.0021 ETH',
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
5 years ago
|
|
|
gasEstimateType: 'FAST',
|
|
|
|
priceInHexWei: '0x174876e800',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
mockState: {
|
|
|
|
metamask: {
|
|
|
|
gasEstimateType: GAS_ESTIMATE_TYPES.LEGACY,
|
|
|
|
gasFeeEstimates: {
|
|
|
|
low: '50',
|
|
|
|
medium: '75',
|
|
|
|
high: '100',
|
|
|
|
},
|
|
|
|
networkDetails: {
|
|
|
|
EIPS: {},
|
|
|
|
},
|
|
|
|
conversionRate: 2557.1,
|
|
|
|
currentCurrency: 'usd',
|
|
|
|
preferences: {
|
|
|
|
showFiatInTestnets: true,
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'mainnet',
|
|
|
|
chainId: '0x1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
send: {
|
|
|
|
gas: {
|
|
|
|
gasLimit: GAS_LIMITS.SIMPLE,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
it('should return renderable data about basic estimates appropriate for buttons with less info', () => {
|
|
|
|
tests.forEach((test) => {
|
|
|
|
expect(
|
|
|
|
getRenderableEstimateDataForSmallButtonsFromGWEI(test.mockState),
|
|
|
|
).toStrictEqual(test.expectedResult);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|