mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge branch 'develop' into feature/17670-cancel-speedup-popover
This commit is contained in:
commit
bc03fb39cf
21
codecov.yml
21
codecov.yml
@ -4,13 +4,14 @@ codecov:
|
|||||||
coverage:
|
coverage:
|
||||||
round: nearest
|
round: nearest
|
||||||
status:
|
status:
|
||||||
project:
|
project: off
|
||||||
global:
|
patch: off
|
||||||
target: auto
|
# global:
|
||||||
threshold: 0%
|
# target: auto
|
||||||
base: auto
|
# threshold: 0%
|
||||||
transforms:
|
# base: auto
|
||||||
target: 100%
|
# transforms:
|
||||||
threshold: 0%
|
# target: 100%
|
||||||
paths:
|
# threshold: 0%
|
||||||
- development/build/transforms/**/*.js
|
# paths:
|
||||||
|
# - development/build/transforms/**/*.js
|
||||||
|
@ -6,10 +6,29 @@ const reports = require('istanbul-reports');
|
|||||||
const glob = require('fast-glob');
|
const glob = require('fast-glob');
|
||||||
const yargs = require('yargs/yargs');
|
const yargs = require('yargs/yargs');
|
||||||
const { hideBin } = require('yargs/helpers');
|
const { hideBin } = require('yargs/helpers');
|
||||||
const yaml = require('js-yaml');
|
// Temporarily commented out as we can't rely on the commented yaml file
|
||||||
|
// Can be restored when the codecov checks are restored
|
||||||
|
// const yaml = require('js-yaml');
|
||||||
const codecovTargets = require('../coverage-targets');
|
const codecovTargets = require('../coverage-targets');
|
||||||
|
|
||||||
const codecovConfig = yaml.load(fs.readFileSync('codecov.yml', 'utf8'));
|
// Temporarily commented out as we can't rely on the commented yaml file
|
||||||
|
// Can be restored when the codecov checks are restored. In the meantime
|
||||||
|
// the important parts of the yaml file are copied below in normal js object
|
||||||
|
// format.
|
||||||
|
// const codecovConfig = yaml.load(fs.readFileSync('codecov.yml', 'utf8'));
|
||||||
|
|
||||||
|
const codecovConfig = {
|
||||||
|
coverage: {
|
||||||
|
status: {
|
||||||
|
global: {},
|
||||||
|
project: {
|
||||||
|
transforms: {
|
||||||
|
paths: ['development/build/transforms/**/*.js'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const COVERAGE_DIR = './coverage/';
|
const COVERAGE_DIR = './coverage/';
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ const ConfirmPageContainerNavigation = () => {
|
|||||||
const unapprovedEncryptionPublicKeyMsgs = useSelector(
|
const unapprovedEncryptionPublicKeyMsgs = useSelector(
|
||||||
unapprovedEncryptionPublicKeyMsgsSelector,
|
unapprovedEncryptionPublicKeyMsgsSelector,
|
||||||
);
|
);
|
||||||
const uncofirmedTransactions = useSelector(
|
const unconfirmedTransactions = useSelector(
|
||||||
unconfirmedTransactionsHashSelector,
|
unconfirmedTransactionsHashSelector,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ const ConfirmPageContainerNavigation = () => {
|
|||||||
...enumUnapprovedEncryptMsgsKey,
|
...enumUnapprovedEncryptMsgsKey,
|
||||||
];
|
];
|
||||||
|
|
||||||
const enumUnapprovedTxs = Object.keys(uncofirmedTransactions).filter(
|
const enumUnapprovedTxs = Object.keys(unconfirmedTransactions).filter(
|
||||||
(key) => enumDecryptAndEncryptMsgs.includes(key) === false,
|
(key) => enumDecryptAndEncryptMsgs.includes(key) === false,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ const ConfirmPageContainerNavigation = () => {
|
|||||||
if (txId) {
|
if (txId) {
|
||||||
dispatch(clearConfirmTransaction());
|
dispatch(clearConfirmTransaction());
|
||||||
history.push(
|
history.push(
|
||||||
uncofirmedTransactions[txId]?.msgParams
|
unconfirmedTransactions[txId]?.msgParams
|
||||||
? `${CONFIRM_TRANSACTION_ROUTE}/${txId}${SIGNATURE_REQUEST_PATH}`
|
? `${CONFIRM_TRANSACTION_ROUTE}/${txId}${SIGNATURE_REQUEST_PATH}`
|
||||||
: `${CONFIRM_TRANSACTION_ROUTE}/${txId}`,
|
: `${CONFIRM_TRANSACTION_ROUTE}/${txId}`,
|
||||||
);
|
);
|
||||||
|
@ -5,15 +5,21 @@ describe('txHelper', () => {
|
|||||||
it('always shows the oldest tx first', () => {
|
it('always shows the oldest tx first', () => {
|
||||||
const metamaskNetworkId = NETWORK_IDS.MAINNET;
|
const metamaskNetworkId = NETWORK_IDS.MAINNET;
|
||||||
const chainId = CHAIN_IDS.MAINNET;
|
const chainId = CHAIN_IDS.MAINNET;
|
||||||
const txs = {
|
const mockUnapprovedTxs = {
|
||||||
a: { metamaskNetworkId, time: 3 },
|
a: { metamaskNetworkId, time: 3 },
|
||||||
b: { metamaskNetworkId, time: 1 },
|
b: { metamaskNetworkId, time: 6 },
|
||||||
c: { metamaskNetworkId, time: 2 },
|
c: { metamaskNetworkId, time: 2 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const mockUnapprovedMsgs = {
|
||||||
|
d: { metamaskNetworkId, time: 4 },
|
||||||
|
e: { metamaskNetworkId, time: 1 },
|
||||||
|
f: { metamaskNetworkId, time: 5 },
|
||||||
|
};
|
||||||
|
|
||||||
const sorted = txHelper(
|
const sorted = txHelper(
|
||||||
txs,
|
mockUnapprovedTxs,
|
||||||
null,
|
mockUnapprovedMsgs,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@ -21,7 +27,9 @@ describe('txHelper', () => {
|
|||||||
metamaskNetworkId,
|
metamaskNetworkId,
|
||||||
chainId,
|
chainId,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(sorted[0].time).toStrictEqual(1);
|
expect(sorted[0].time).toStrictEqual(1);
|
||||||
expect(sorted[2].time).toStrictEqual(3);
|
expect(sorted[2].time).toStrictEqual(3);
|
||||||
|
expect(sorted[5].time).toStrictEqual(6);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -29,35 +29,33 @@ export default function txHelper(
|
|||||||
transactionMatchesNetwork(txMeta, chainId, networkId),
|
transactionMatchesNetwork(txMeta, chainId, networkId),
|
||||||
)
|
)
|
||||||
: valuesFor(unapprovedTxs);
|
: valuesFor(unapprovedTxs);
|
||||||
log.debug(`tx helper found ${txValues.length} unapproved txs`);
|
|
||||||
|
|
||||||
const msgValues = valuesFor(unapprovedMsgs);
|
const msgValues = valuesFor(unapprovedMsgs);
|
||||||
log.debug(`tx helper found ${msgValues.length} unsigned messages`);
|
|
||||||
let allValues = txValues.concat(msgValues);
|
|
||||||
|
|
||||||
const personalValues = valuesFor(personalMsgs);
|
const personalValues = valuesFor(personalMsgs);
|
||||||
|
const decryptValues = valuesFor(decryptMsgs);
|
||||||
|
const encryptionPublicKeyValues = valuesFor(encryptionPublicKeyMsgs);
|
||||||
|
const typedValues = valuesFor(typedMessages);
|
||||||
|
|
||||||
|
const allValues = txValues
|
||||||
|
.concat(msgValues)
|
||||||
|
.concat(personalValues)
|
||||||
|
.concat(decryptValues)
|
||||||
|
.concat(encryptionPublicKeyValues)
|
||||||
|
.concat(typedValues)
|
||||||
|
.sort((a, b) => {
|
||||||
|
return a.time - b.time;
|
||||||
|
});
|
||||||
|
|
||||||
|
log.debug(`tx helper found ${txValues.length} unapproved txs`);
|
||||||
|
log.debug(`tx helper found ${msgValues.length} unsigned messages`);
|
||||||
log.debug(
|
log.debug(
|
||||||
`tx helper found ${personalValues.length} unsigned personal messages`,
|
`tx helper found ${personalValues.length} unsigned personal messages`,
|
||||||
);
|
);
|
||||||
allValues = allValues.concat(personalValues);
|
|
||||||
|
|
||||||
const decryptValues = valuesFor(decryptMsgs);
|
|
||||||
log.debug(`tx helper found ${decryptValues.length} decrypt requests`);
|
log.debug(`tx helper found ${decryptValues.length} decrypt requests`);
|
||||||
allValues = allValues.concat(decryptValues);
|
|
||||||
|
|
||||||
const encryptionPublicKeyValues = valuesFor(encryptionPublicKeyMsgs);
|
|
||||||
log.debug(
|
log.debug(
|
||||||
`tx helper found ${encryptionPublicKeyValues.length} encryptionPublicKey requests`,
|
`tx helper found ${encryptionPublicKeyValues.length} encryptionPublicKey requests`,
|
||||||
);
|
);
|
||||||
allValues = allValues.concat(encryptionPublicKeyValues);
|
|
||||||
|
|
||||||
const typedValues = valuesFor(typedMessages);
|
|
||||||
log.debug(`tx helper found ${typedValues.length} unsigned typed messages`);
|
log.debug(`tx helper found ${typedValues.length} unsigned typed messages`);
|
||||||
allValues = allValues.concat(typedValues);
|
|
||||||
|
|
||||||
allValues = allValues.sort((a, b) => {
|
|
||||||
return a.time - b.time;
|
|
||||||
});
|
|
||||||
|
|
||||||
return allValues;
|
return allValues;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
|
||||||
&__warning {
|
&__warning {
|
||||||
padding: 0 24px 16px 24px;
|
padding: 0 24px 16px 24px;
|
||||||
|
@ -57,22 +57,22 @@ const ConfirmTransaction = () => {
|
|||||||
const mostRecentOverviewPage = useSelector(getMostRecentOverviewPage);
|
const mostRecentOverviewPage = useSelector(getMostRecentOverviewPage);
|
||||||
const sendTo = useSelector(getSendTo);
|
const sendTo = useSelector(getSendTo);
|
||||||
const unapprovedTxs = useSelector(getUnapprovedTransactions);
|
const unapprovedTxs = useSelector(getUnapprovedTransactions);
|
||||||
const unconfirmedTxs = useSelector(unconfirmedTransactionsListSelector);
|
const unconfirmedTxsSorted = useSelector(unconfirmedTransactionsListSelector);
|
||||||
const unconfirmedMessages = useSelector(unconfirmedTransactionsHashSelector);
|
const unconfirmedTxs = useSelector(unconfirmedTransactionsHashSelector);
|
||||||
|
|
||||||
const totalUnapproved = unconfirmedTxs.length || 0;
|
const totalUnapproved = unconfirmedTxsSorted.length || 0;
|
||||||
const getTransaction = useCallback(() => {
|
const getTransaction = useCallback(() => {
|
||||||
return totalUnapproved
|
return totalUnapproved
|
||||||
? unapprovedTxs[paramsTransactionId] ||
|
? unapprovedTxs[paramsTransactionId] ||
|
||||||
unconfirmedMessages[paramsTransactionId] ||
|
unconfirmedTxs[paramsTransactionId] ||
|
||||||
unconfirmedTxs[0]
|
unconfirmedTxsSorted[0]
|
||||||
: {};
|
: {};
|
||||||
}, [
|
}, [
|
||||||
paramsTransactionId,
|
paramsTransactionId,
|
||||||
totalUnapproved,
|
totalUnapproved,
|
||||||
unapprovedTxs,
|
unapprovedTxs,
|
||||||
unconfirmedMessages,
|
|
||||||
unconfirmedTxs,
|
unconfirmedTxs,
|
||||||
|
unconfirmedTxsSorted,
|
||||||
]);
|
]);
|
||||||
const [transaction, setTransaction] = useState(getTransaction);
|
const [transaction, setTransaction] = useState(getTransaction);
|
||||||
|
|
||||||
@ -88,8 +88,8 @@ const ConfirmTransaction = () => {
|
|||||||
paramsTransactionId,
|
paramsTransactionId,
|
||||||
totalUnapproved,
|
totalUnapproved,
|
||||||
unapprovedTxs,
|
unapprovedTxs,
|
||||||
unconfirmedMessages,
|
|
||||||
unconfirmedTxs,
|
unconfirmedTxs,
|
||||||
|
unconfirmedTxsSorted,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const { id, type } = transaction;
|
const { id, type } = transaction;
|
||||||
|
Loading…
Reference in New Issue
Block a user