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

Merge pull request #11932 from MetaMask/Version-v10.0.3

Version v10.0.3 RC
This commit is contained in:
ryanml 2021-08-26 09:43:35 -07:00 committed by GitHub
commit fbafffe1ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 70 additions and 16 deletions

View File

@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [10.0.3]
### Changed
- [#11931](https://github.com/MetaMask/metamask-extension/pull/11931): Temporarily Disabling Mobile Sync
- [#11936](https://github.com/MetaMask/metamask-extension/pull/11936): Use higher gas fees when attempting to speedup or cancel a transaction
### Fixed
- [#11900](https://github.com/MetaMask/metamask-extension/pull/11900): Fixing chainId comparison issue (sign typed message param validation)
- [#11930](https://github.com/MetaMask/metamask-extension/pull/11930): Using 9 decimal places of precision in gas price
## [10.0.2]
### Added
- [#11818](https://github.com/MetaMask/metamask-extension/pull/11818): Add gas recommendation options to cancel and speed up popovers
@ -2413,7 +2422,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Uncategorized
- Added the ability to restore accounts from seed words.
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.0.2...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.0.3...HEAD
[10.0.3]: https://github.com/MetaMask/metamask-extension/compare/v10.0.2...v10.0.3
[10.0.2]: https://github.com/MetaMask/metamask-extension/compare/v10.0.1...v10.0.2
[10.0.1]: https://github.com/MetaMask/metamask-extension/compare/v10.0.0...v10.0.1
[10.0.0]: https://github.com/MetaMask/metamask-extension/compare/v9.8.4...v10.0.0

View File

@ -1299,7 +1299,7 @@
"description": "Serves as link text for the 'mismatchedChain' key. This text will be embedded inside the translation for that key."
},
"mobileSyncWarning": {
"message": "⚠️ Proceeding will display a secret QR code that allows access to your accounts. Do not share it with anyone. Support staff will never ask your for it."
"message": "The 'Sync with extension' feature is temporarily disabled. If you want to use your extension wallet on MetaMask mobile, then on your mobile app: go back to the wallet setup options and select the 'Import with Secret Recovery Phrase' option. Use your extension wallets secret phrase to then import your wallet into mobile."
},
"mustSelectOne": {
"message": "Must select at least 1 token."

View File

@ -204,7 +204,7 @@ export default class TypedMessageManager extends EventEmitter {
`Cannot sign messages for chainId "${chainId}", because MetaMask is switching networks.`,
);
if (typeof chainId === 'string') {
chainId = parseInt(chainId, 16);
chainId = parseInt(chainId, chainId.startsWith('0x') ? 16 : 10);
}
assert.equal(
chainId,

View File

@ -1,6 +1,6 @@
{
"name": "metamask-crx",
"version": "10.0.2",
"version": "10.0.3",
"private": true,
"repository": {
"type": "git",

View File

@ -384,7 +384,7 @@ export const computeEstimatedGasLimit = createAsyncThunk(
*/
function getRoundedGasPrice(gasPriceEstimate) {
const gasPriceInDecGwei = conversionUtil(gasPriceEstimate, {
numberOfDecimals: 4,
numberOfDecimals: 9,
toDenomination: GWEI,
fromNumericBase: 'dec',
toNumericBase: 'dec',

View File

@ -6,6 +6,14 @@ import { getConversionRate, getSelectedAccount } from '../selectors';
import { increaseLastGasPrice } from '../helpers/utils/confirm-tx.util';
import { useCancelTransaction } from './useCancelTransaction';
jest.mock('../store/actions', () => ({
disconnectGasFeeEstimatePoller: jest.fn(),
getGasFeeEstimatesAndStartPolling: jest
.fn()
.mockImplementation(() => Promise.resolve()),
addPollingTokenToAppState: jest.fn(),
}));
describe('useCancelTransaction', function () {
let useSelector;
const dispatch = sinon.spy();

View File

@ -1,7 +1,10 @@
import BigNumber from 'bignumber.js';
import { addHexPrefix } from 'ethereumjs-util';
import { useMemo } from 'react';
import { multiplyCurrencies } from '../../shared/modules/conversion.utils';
import { isEIP1559Transaction } from '../../shared/modules/transaction.utils';
import { decGWEIToHexWEI } from '../helpers/utils/conversions.util';
import { useGasFeeEstimates } from './useGasFeeEstimates';
/**
* Simple helper to save on duplication to multiply the supplied wei hex string
@ -20,6 +23,26 @@ function addTenPercent(hexStringValue) {
);
}
/**
* Helper that returns the higher of two options for a new gas fee:
* The original fee + 10% or
* the current medium suggested fee from our gas estimation api
*
* @param {string} originalFee - hexWei vale of the original fee (maxFee or maxPriority)
* @param {string} currentEstimate - decGwei value of the current medium gasFee estimate (maxFee or maxPriorityfee)
* @returns {string} - hexWei value of the higher of the two inputs.
*/
function getHighestIncrementedFee(originalFee, currentEstimate) {
const buffedOriginalHexWei = addTenPercent(originalFee);
const currentEstimateHexWei = decGWEIToHexWEI(currentEstimate);
return new BigNumber(buffedOriginalHexWei, 16).greaterThan(
new BigNumber(currentEstimateHexWei, 16),
)
? buffedOriginalHexWei
: currentEstimateHexWei;
}
/**
* When initializing cancellations or speed ups we need to set the baseline
* gas fees to be 10% higher, which is the bare minimum that the network will
@ -35,6 +58,8 @@ function addTenPercent(hexStringValue) {
export function useIncrementedGasFees(transactionGroup) {
const { primaryTransaction } = transactionGroup;
const { gasFeeEstimates = {} } = useGasFeeEstimates();
// We memoize this value so that it can be relied upon in other hooks.
const customGasSettings = useMemo(() => {
// This hook is called indiscriminantly on all transactions appearing in
@ -46,29 +71,45 @@ export function useIncrementedGasFees(transactionGroup) {
gasLimit: primaryTransaction.txParams?.gas,
gas: primaryTransaction.txParams?.gas,
};
const suggestedMaxFeePerGas =
gasFeeEstimates?.medium?.suggestedMaxFeePerGas ?? '0';
const suggestedMaxPriorityFeePerGas =
gasFeeEstimates?.medium?.suggestedMaxPriorityFeePerGas ?? '0';
if (isEIP1559Transaction(primaryTransaction)) {
const transactionMaxFeePerGas = primaryTransaction.txParams?.maxFeePerGas;
const transactionMaxPriorityFeePerGas =
primaryTransaction.txParams?.maxPriorityFeePerGas;
temporaryGasSettings.maxFeePerGas =
transactionMaxFeePerGas === undefined ||
transactionMaxFeePerGas.startsWith('-')
? '0x0'
: addTenPercent(transactionMaxFeePerGas);
: getHighestIncrementedFee(
transactionMaxFeePerGas,
suggestedMaxFeePerGas,
);
temporaryGasSettings.maxPriorityFeePerGas =
transactionMaxPriorityFeePerGas === undefined ||
transactionMaxPriorityFeePerGas.startsWith('-')
? '0x0'
: addTenPercent(transactionMaxPriorityFeePerGas);
: getHighestIncrementedFee(
transactionMaxPriorityFeePerGas,
suggestedMaxPriorityFeePerGas,
);
} else {
const transactionGasPrice = primaryTransaction.txParams?.gasPrice;
temporaryGasSettings.gasPrice =
transactionGasPrice === undefined || transactionGasPrice.startsWith('-')
? '0x0'
: addTenPercent(transactionGasPrice);
: getHighestIncrementedFee(
transactionGasPrice,
suggestedMaxFeePerGas,
);
}
return temporaryGasSettings;
}, [primaryTransaction]);
}, [primaryTransaction, gasFeeEstimates]);
return customGasSettings;
}

View File

@ -8,7 +8,7 @@ import * as metricEventHook from './useMetricEvent';
import { useRetryTransaction } from './useRetryTransaction';
jest.mock('./useGasFeeEstimates', () => ({
useGasFeeEstimates: jest.fn(),
useGasFeeEstimates: jest.fn().mockImplementation(() => Promise.resolve({})),
}));
describe('useRetryTransaction', () => {

View File

@ -316,12 +316,7 @@ export default class MobileSyncPage extends Component {
}
return screen === PASSWORD_PROMPT_SCREEN ? (
<div>
{this.renderWarning(this.context.t('mobileSyncWarning'))}
<div className="reveal-seed__content">
{this.renderPasswordPromptContent()}
</div>
</div>
<div>{this.renderWarning(this.context.t('mobileSyncWarning'))}</div>
) : (
<div>
{this.renderWarning(this.context.t('syncWithMobileBeCareful'))}