mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
update prettier (#15360)
This commit is contained in:
parent
9e7c75d06d
commit
c72199a1a6
@ -615,11 +615,11 @@ function setupController(initState, initLangCode, remoteSourcePort) {
|
|||||||
const { unapprovedMsgCount } = controller.messageManager;
|
const { unapprovedMsgCount } = controller.messageManager;
|
||||||
const { unapprovedPersonalMsgCount } = controller.personalMessageManager;
|
const { unapprovedPersonalMsgCount } = controller.personalMessageManager;
|
||||||
const { unapprovedDecryptMsgCount } = controller.decryptMessageManager;
|
const { unapprovedDecryptMsgCount } = controller.decryptMessageManager;
|
||||||
const {
|
const { unapprovedEncryptionPublicKeyMsgCount } =
|
||||||
unapprovedEncryptionPublicKeyMsgCount,
|
controller.encryptionPublicKeyManager;
|
||||||
} = controller.encryptionPublicKeyManager;
|
|
||||||
const { unapprovedTypedMessagesCount } = controller.typedMessageManager;
|
const { unapprovedTypedMessagesCount } = controller.typedMessageManager;
|
||||||
const pendingApprovalCount = controller.approvalController.getTotalApprovalCount();
|
const pendingApprovalCount =
|
||||||
|
controller.approvalController.getTotalApprovalCount();
|
||||||
const waitingForUnlockCount =
|
const waitingForUnlockCount =
|
||||||
controller.appStateController.waitingForUnlock.length;
|
controller.appStateController.waitingForUnlock.length;
|
||||||
return (
|
return (
|
||||||
|
@ -174,13 +174,8 @@ export default class DetectTokensController {
|
|||||||
if (result) {
|
if (result) {
|
||||||
const nonZeroTokenAddresses = Object.keys(result);
|
const nonZeroTokenAddresses = Object.keys(result);
|
||||||
for (const nonZeroTokenAddress of nonZeroTokenAddresses) {
|
for (const nonZeroTokenAddress of nonZeroTokenAddresses) {
|
||||||
const {
|
const { address, symbol, decimals, iconUrl, aggregators } =
|
||||||
address,
|
tokenList[nonZeroTokenAddress];
|
||||||
symbol,
|
|
||||||
decimals,
|
|
||||||
iconUrl,
|
|
||||||
aggregators,
|
|
||||||
} = tokenList[nonZeroTokenAddress];
|
|
||||||
|
|
||||||
eventTokensDetails.push(`${symbol} - ${address}`);
|
eventTokensDetails.push(`${symbol} - ${address}`);
|
||||||
|
|
||||||
|
@ -291,9 +291,8 @@ describe('DetectTokensController', function () {
|
|||||||
const contractAddressesToDetect = erc20ContractAddresses.filter(
|
const contractAddressesToDetect = erc20ContractAddresses.filter(
|
||||||
(address) => address !== existingTokenAddress,
|
(address) => address !== existingTokenAddress,
|
||||||
);
|
);
|
||||||
const indexOfTokenToAdd = contractAddressesToDetect.indexOf(
|
const indexOfTokenToAdd =
|
||||||
tokenAddressToAdd,
|
contractAddressesToDetect.indexOf(tokenAddressToAdd);
|
||||||
);
|
|
||||||
const balances = new Array(contractAddressesToDetect.length);
|
const balances = new Array(contractAddressesToDetect.length);
|
||||||
|
|
||||||
balances[indexOfTokenToAdd] = new BigNumber(10);
|
balances[indexOfTokenToAdd] = new BigNumber(10);
|
||||||
@ -353,9 +352,8 @@ describe('DetectTokensController', function () {
|
|||||||
const contractAddressesToDetect = erc20ContractAddresses.filter(
|
const contractAddressesToDetect = erc20ContractAddresses.filter(
|
||||||
(address) => address !== existingTokenAddress,
|
(address) => address !== existingTokenAddress,
|
||||||
);
|
);
|
||||||
const indexOfTokenToAdd = contractAddressesToDetect.indexOf(
|
const indexOfTokenToAdd =
|
||||||
tokenAddressToAdd,
|
contractAddressesToDetect.indexOf(tokenAddressToAdd);
|
||||||
);
|
|
||||||
|
|
||||||
const balances = new Array(contractAddressesToDetect.length);
|
const balances = new Array(contractAddressesToDetect.length);
|
||||||
balances[indexOfTokenToAdd] = new BigNumber(10);
|
balances[indexOfTokenToAdd] = new BigNumber(10);
|
||||||
|
@ -190,9 +190,8 @@ describe('IncomingTransactionsController', function () {
|
|||||||
);
|
);
|
||||||
|
|
||||||
assert(mockedNetworkMethods.onNetworkDidChange.calledOnce);
|
assert(mockedNetworkMethods.onNetworkDidChange.calledOnce);
|
||||||
const networkControllerListenerCallback = mockedNetworkMethods.onNetworkDidChange.getCall(
|
const networkControllerListenerCallback =
|
||||||
0,
|
mockedNetworkMethods.onNetworkDidChange.getCall(0).args[0];
|
||||||
).args[0];
|
|
||||||
assert.strictEqual(incomingTransactionsController._update.callCount, 0);
|
assert.strictEqual(incomingTransactionsController._update.callCount, 0);
|
||||||
networkControllerListenerCallback('testNetworkType');
|
networkControllerListenerCallback('testNetworkType');
|
||||||
assert.strictEqual(incomingTransactionsController._update.callCount, 1);
|
assert.strictEqual(incomingTransactionsController._update.callCount, 1);
|
||||||
@ -253,8 +252,10 @@ describe('IncomingTransactionsController', function () {
|
|||||||
initState: getNonEmptyInitState(),
|
initState: getNonEmptyInitState(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const startBlock = getNonEmptyInitState()
|
const startBlock =
|
||||||
.incomingTxLastFetchedBlockByChainId[ROPSTEN_CHAIN_ID];
|
getNonEmptyInitState().incomingTxLastFetchedBlockByChainId[
|
||||||
|
ROPSTEN_CHAIN_ID
|
||||||
|
];
|
||||||
nock('https://api-ropsten.etherscan.io')
|
nock('https://api-ropsten.etherscan.io')
|
||||||
.get(
|
.get(
|
||||||
`/api?module=account&action=txlist&address=${MOCK_SELECTED_ADDRESS}&tag=latest&page=1&startBlock=${startBlock}`,
|
`/api?module=account&action=txlist&address=${MOCK_SELECTED_ADDRESS}&tag=latest&page=1&startBlock=${startBlock}`,
|
||||||
@ -546,8 +547,10 @@ describe('IncomingTransactionsController', function () {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
const NEW_MOCK_SELECTED_ADDRESS = `${MOCK_SELECTED_ADDRESS}9`;
|
const NEW_MOCK_SELECTED_ADDRESS = `${MOCK_SELECTED_ADDRESS}9`;
|
||||||
const startBlock = getNonEmptyInitState()
|
const startBlock =
|
||||||
.incomingTxLastFetchedBlockByChainId[ROPSTEN_CHAIN_ID];
|
getNonEmptyInitState().incomingTxLastFetchedBlockByChainId[
|
||||||
|
ROPSTEN_CHAIN_ID
|
||||||
|
];
|
||||||
nock('https://api-ropsten.etherscan.io')
|
nock('https://api-ropsten.etherscan.io')
|
||||||
.get(
|
.get(
|
||||||
`/api?module=account&action=txlist&address=${NEW_MOCK_SELECTED_ADDRESS}&tag=latest&page=1&startBlock=${startBlock}`,
|
`/api?module=account&action=txlist&address=${NEW_MOCK_SELECTED_ADDRESS}&tag=latest&page=1&startBlock=${startBlock}`,
|
||||||
@ -572,9 +575,10 @@ describe('IncomingTransactionsController', function () {
|
|||||||
incomingTransactionsController.store,
|
incomingTransactionsController.store,
|
||||||
);
|
);
|
||||||
|
|
||||||
const subscription = incomingTransactionsController.preferencesController.store.subscribe.getCall(
|
const subscription =
|
||||||
1,
|
incomingTransactionsController.preferencesController.store.subscribe.getCall(
|
||||||
).args[0];
|
1,
|
||||||
|
).args[0];
|
||||||
// The incoming transactions controller will always skip the first event
|
// The incoming transactions controller will always skip the first event
|
||||||
// We need to call subscription twice to test the event handling
|
// We need to call subscription twice to test the event handling
|
||||||
// TODO: stop skipping the first event
|
// TODO: stop skipping the first event
|
||||||
@ -658,9 +662,10 @@ describe('IncomingTransactionsController', function () {
|
|||||||
incomingTransactionsController.store,
|
incomingTransactionsController.store,
|
||||||
);
|
);
|
||||||
|
|
||||||
const subscription = incomingTransactionsController.preferencesController.store.subscribe.getCall(
|
const subscription =
|
||||||
1,
|
incomingTransactionsController.preferencesController.store.subscribe.getCall(
|
||||||
).args[0];
|
1,
|
||||||
|
).args[0];
|
||||||
// The incoming transactions controller will always skip the first event
|
// The incoming transactions controller will always skip the first event
|
||||||
// We need to call subscription twice to test the event handling
|
// We need to call subscription twice to test the event handling
|
||||||
// TODO: stop skipping the first event
|
// TODO: stop skipping the first event
|
||||||
@ -682,9 +687,8 @@ describe('IncomingTransactionsController', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should update when switching to a supported network', async function () {
|
it('should update when switching to a supported network', async function () {
|
||||||
const mockedNetworkMethods = getMockNetworkControllerMethods(
|
const mockedNetworkMethods =
|
||||||
ROPSTEN_CHAIN_ID,
|
getMockNetworkControllerMethods(ROPSTEN_CHAIN_ID);
|
||||||
);
|
|
||||||
const incomingTransactionsController = new IncomingTransactionsController(
|
const incomingTransactionsController = new IncomingTransactionsController(
|
||||||
{
|
{
|
||||||
blockTracker: getMockBlockTracker(),
|
blockTracker: getMockBlockTracker(),
|
||||||
@ -693,8 +697,10 @@ describe('IncomingTransactionsController', function () {
|
|||||||
initState: getNonEmptyInitState(),
|
initState: getNonEmptyInitState(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const startBlock = getNonEmptyInitState()
|
const startBlock =
|
||||||
.incomingTxLastFetchedBlockByChainId[ROPSTEN_CHAIN_ID];
|
getNonEmptyInitState().incomingTxLastFetchedBlockByChainId[
|
||||||
|
ROPSTEN_CHAIN_ID
|
||||||
|
];
|
||||||
nock('https://api-ropsten.etherscan.io')
|
nock('https://api-ropsten.etherscan.io')
|
||||||
.get(
|
.get(
|
||||||
`/api?module=account&action=txlist&address=${MOCK_SELECTED_ADDRESS}&tag=latest&page=1&startBlock=${startBlock}`,
|
`/api?module=account&action=txlist&address=${MOCK_SELECTED_ADDRESS}&tag=latest&page=1&startBlock=${startBlock}`,
|
||||||
@ -715,8 +721,8 @@ describe('IncomingTransactionsController', function () {
|
|||||||
incomingTransactionsController.store,
|
incomingTransactionsController.store,
|
||||||
);
|
);
|
||||||
|
|
||||||
const subscription = mockedNetworkMethods.onNetworkDidChange.getCall(0)
|
const subscription =
|
||||||
.args[0];
|
mockedNetworkMethods.onNetworkDidChange.getCall(0).args[0];
|
||||||
await subscription(ROPSTEN_CHAIN_ID);
|
await subscription(ROPSTEN_CHAIN_ID);
|
||||||
await updateStateCalled();
|
await updateStateCalled();
|
||||||
|
|
||||||
@ -763,9 +769,8 @@ describe('IncomingTransactionsController', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not update when switching to an unsupported network', async function () {
|
it('should not update when switching to an unsupported network', async function () {
|
||||||
const mockedNetworkMethods = getMockNetworkControllerMethods(
|
const mockedNetworkMethods =
|
||||||
ROPSTEN_CHAIN_ID,
|
getMockNetworkControllerMethods(ROPSTEN_CHAIN_ID);
|
||||||
);
|
|
||||||
const incomingTransactionsController = new IncomingTransactionsController(
|
const incomingTransactionsController = new IncomingTransactionsController(
|
||||||
{
|
{
|
||||||
blockTracker: getMockBlockTracker(),
|
blockTracker: getMockBlockTracker(),
|
||||||
@ -796,8 +801,8 @@ describe('IncomingTransactionsController', function () {
|
|||||||
incomingTransactionsController.store,
|
incomingTransactionsController.store,
|
||||||
);
|
);
|
||||||
|
|
||||||
const subscription = mockedNetworkMethods.onNetworkDidChange.getCall(0)
|
const subscription =
|
||||||
.args[0];
|
mockedNetworkMethods.onNetworkDidChange.getCall(0).args[0];
|
||||||
|
|
||||||
incomingTransactionsController.getCurrentChainId = () => FAKE_CHAIN_ID;
|
incomingTransactionsController.getCurrentChainId = () => FAKE_CHAIN_ID;
|
||||||
await subscription();
|
await subscription();
|
||||||
@ -820,15 +825,14 @@ describe('IncomingTransactionsController', function () {
|
|||||||
describe('_update', function () {
|
describe('_update', function () {
|
||||||
describe('when state is empty (initialized)', function () {
|
describe('when state is empty (initialized)', function () {
|
||||||
it('should use provided block number and update the latest block seen', async function () {
|
it('should use provided block number and update the latest block seen', async function () {
|
||||||
const incomingTransactionsController = new IncomingTransactionsController(
|
const incomingTransactionsController =
|
||||||
{
|
new IncomingTransactionsController({
|
||||||
blockTracker: getMockBlockTracker(),
|
blockTracker: getMockBlockTracker(),
|
||||||
...getMockNetworkControllerMethods(ROPSTEN_CHAIN_ID),
|
...getMockNetworkControllerMethods(ROPSTEN_CHAIN_ID),
|
||||||
preferencesController: getMockPreferencesController(),
|
preferencesController: getMockPreferencesController(),
|
||||||
initState: getEmptyInitState(),
|
initState: getEmptyInitState(),
|
||||||
getCurrentChainId: () => ROPSTEN_CHAIN_ID,
|
getCurrentChainId: () => ROPSTEN_CHAIN_ID,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
sinon.spy(incomingTransactionsController.store, 'updateState');
|
sinon.spy(incomingTransactionsController.store, 'updateState');
|
||||||
|
|
||||||
incomingTransactionsController._getNewIncomingTransactions = sinon
|
incomingTransactionsController._getNewIncomingTransactions = sinon
|
||||||
@ -857,15 +861,14 @@ describe('IncomingTransactionsController', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should update the last fetched block for network to highest block seen in incoming txs', async function () {
|
it('should update the last fetched block for network to highest block seen in incoming txs', async function () {
|
||||||
const incomingTransactionsController = new IncomingTransactionsController(
|
const incomingTransactionsController =
|
||||||
{
|
new IncomingTransactionsController({
|
||||||
blockTracker: getMockBlockTracker(),
|
blockTracker: getMockBlockTracker(),
|
||||||
...getMockNetworkControllerMethods(ROPSTEN_CHAIN_ID),
|
...getMockNetworkControllerMethods(ROPSTEN_CHAIN_ID),
|
||||||
preferencesController: getMockPreferencesController(),
|
preferencesController: getMockPreferencesController(),
|
||||||
initState: getEmptyInitState(),
|
initState: getEmptyInitState(),
|
||||||
getCurrentChainId: () => ROPSTEN_CHAIN_ID,
|
getCurrentChainId: () => ROPSTEN_CHAIN_ID,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const NEW_TRANSACTION_ONE = {
|
const NEW_TRANSACTION_ONE = {
|
||||||
id: 555,
|
id: 555,
|
||||||
@ -911,15 +914,14 @@ describe('IncomingTransactionsController', function () {
|
|||||||
|
|
||||||
describe('when state is populated with prior data for network', function () {
|
describe('when state is populated with prior data for network', function () {
|
||||||
it('should use the last fetched block for the current network and increment by 1 in state', async function () {
|
it('should use the last fetched block for the current network and increment by 1 in state', async function () {
|
||||||
const incomingTransactionsController = new IncomingTransactionsController(
|
const incomingTransactionsController =
|
||||||
{
|
new IncomingTransactionsController({
|
||||||
blockTracker: getMockBlockTracker(),
|
blockTracker: getMockBlockTracker(),
|
||||||
...getMockNetworkControllerMethods(ROPSTEN_CHAIN_ID),
|
...getMockNetworkControllerMethods(ROPSTEN_CHAIN_ID),
|
||||||
preferencesController: getMockPreferencesController(),
|
preferencesController: getMockPreferencesController(),
|
||||||
initState: getNonEmptyInitState(),
|
initState: getNonEmptyInitState(),
|
||||||
getCurrentChainId: () => ROPSTEN_CHAIN_ID,
|
getCurrentChainId: () => ROPSTEN_CHAIN_ID,
|
||||||
},
|
});
|
||||||
);
|
|
||||||
sinon.spy(incomingTransactionsController.store, 'updateState');
|
sinon.spy(incomingTransactionsController.store, 'updateState');
|
||||||
incomingTransactionsController._getNewIncomingTransactions = sinon
|
incomingTransactionsController._getNewIncomingTransactions = sinon
|
||||||
.stub()
|
.stub()
|
||||||
@ -1105,11 +1107,12 @@ describe('IncomingTransactionsController', function () {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const result = await incomingTransactionsController._getNewIncomingTransactions(
|
const result =
|
||||||
ADDRESS_TO_FETCH_FOR,
|
await incomingTransactionsController._getNewIncomingTransactions(
|
||||||
'789',
|
ADDRESS_TO_FETCH_FOR,
|
||||||
ROPSTEN_CHAIN_ID,
|
'789',
|
||||||
);
|
ROPSTEN_CHAIN_ID,
|
||||||
|
);
|
||||||
|
|
||||||
assert(mockFetch.calledOnce);
|
assert(mockFetch.calledOnce);
|
||||||
assert.deepStrictEqual(result, [
|
assert.deepStrictEqual(result, [
|
||||||
@ -1137,11 +1140,12 @@ describe('IncomingTransactionsController', function () {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const result = await incomingTransactionsController._getNewIncomingTransactions(
|
const result =
|
||||||
ADDRESS_TO_FETCH_FOR,
|
await incomingTransactionsController._getNewIncomingTransactions(
|
||||||
'789',
|
ADDRESS_TO_FETCH_FOR,
|
||||||
ROPSTEN_CHAIN_ID,
|
'789',
|
||||||
);
|
ROPSTEN_CHAIN_ID,
|
||||||
|
);
|
||||||
assert.deepStrictEqual(result, []);
|
assert.deepStrictEqual(result, []);
|
||||||
window.fetch = tempFetchStatusZero;
|
window.fetch = tempFetchStatusZero;
|
||||||
mockFetchStatusZero.reset();
|
mockFetchStatusZero.reset();
|
||||||
@ -1164,11 +1168,12 @@ describe('IncomingTransactionsController', function () {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const result = await incomingTransactionsController._getNewIncomingTransactions(
|
const result =
|
||||||
ADDRESS_TO_FETCH_FOR,
|
await incomingTransactionsController._getNewIncomingTransactions(
|
||||||
'789',
|
ADDRESS_TO_FETCH_FOR,
|
||||||
ROPSTEN_CHAIN_ID,
|
'789',
|
||||||
);
|
ROPSTEN_CHAIN_ID,
|
||||||
|
);
|
||||||
assert.deepStrictEqual(result, []);
|
assert.deepStrictEqual(result, []);
|
||||||
window.fetch = tempFetchEmptyResult;
|
window.fetch = tempFetchEmptyResult;
|
||||||
mockFetchEmptyResult.reset();
|
mockFetchEmptyResult.reset();
|
||||||
|
@ -558,15 +558,16 @@ export default class MetaMetricsController {
|
|||||||
[TRAITS.NETWORKS_ADDED]: metamaskState.frequentRpcListDetail.map(
|
[TRAITS.NETWORKS_ADDED]: metamaskState.frequentRpcListDetail.map(
|
||||||
(rpc) => rpc.chainId,
|
(rpc) => rpc.chainId,
|
||||||
),
|
),
|
||||||
[TRAITS.NETWORKS_WITHOUT_TICKER]: metamaskState.frequentRpcListDetail.reduce(
|
[TRAITS.NETWORKS_WITHOUT_TICKER]:
|
||||||
(networkList, currentNetwork) => {
|
metamaskState.frequentRpcListDetail.reduce(
|
||||||
if (!currentNetwork.ticker) {
|
(networkList, currentNetwork) => {
|
||||||
networkList.push(currentNetwork.chainId);
|
if (!currentNetwork.ticker) {
|
||||||
}
|
networkList.push(currentNetwork.chainId);
|
||||||
return networkList;
|
}
|
||||||
},
|
return networkList;
|
||||||
[],
|
},
|
||||||
),
|
[],
|
||||||
|
),
|
||||||
[TRAITS.NFT_AUTODETECTION_ENABLED]: metamaskState.useCollectibleDetection,
|
[TRAITS.NFT_AUTODETECTION_ENABLED]: metamaskState.useCollectibleDetection,
|
||||||
[TRAITS.NUMBER_OF_ACCOUNTS]: Object.values(metamaskState.identities)
|
[TRAITS.NUMBER_OF_ACCOUNTS]: Object.values(metamaskState.identities)
|
||||||
.length,
|
.length,
|
||||||
|
@ -132,12 +132,10 @@ function getMetaMetricsController({
|
|||||||
} = {}) {
|
} = {}) {
|
||||||
return new MetaMetricsController({
|
return new MetaMetricsController({
|
||||||
segment,
|
segment,
|
||||||
getNetworkIdentifier: networkController.getNetworkIdentifier.bind(
|
getNetworkIdentifier:
|
||||||
networkController,
|
networkController.getNetworkIdentifier.bind(networkController),
|
||||||
),
|
getCurrentChainId:
|
||||||
getCurrentChainId: networkController.getCurrentChainId.bind(
|
networkController.getCurrentChainId.bind(networkController),
|
||||||
networkController,
|
|
||||||
),
|
|
||||||
onNetworkDidChange: networkController.on.bind(
|
onNetworkDidChange: networkController.on.bind(
|
||||||
networkController,
|
networkController,
|
||||||
NETWORK_EVENTS.NETWORK_DID_CHANGE,
|
NETWORK_EVENTS.NETWORK_DID_CHANGE,
|
||||||
|
@ -34,8 +34,8 @@ describe('NetworkController', () => {
|
|||||||
describe('#provider', () => {
|
describe('#provider', () => {
|
||||||
it('provider should be updatable without reassignment', () => {
|
it('provider should be updatable without reassignment', () => {
|
||||||
networkController.initializeProvider(networkControllerProviderConfig);
|
networkController.initializeProvider(networkControllerProviderConfig);
|
||||||
const providerProxy = networkController.getProviderAndBlockTracker()
|
const providerProxy =
|
||||||
.provider;
|
networkController.getProviderAndBlockTracker().provider;
|
||||||
expect(providerProxy.test).toBeUndefined();
|
expect(providerProxy.test).toBeUndefined();
|
||||||
providerProxy.setTarget({ test: true });
|
providerProxy.setTarget({ test: true });
|
||||||
expect(providerProxy.test).toStrictEqual(true);
|
expect(providerProxy.test).toStrictEqual(true);
|
||||||
@ -79,7 +79,8 @@ describe('NetworkController', () => {
|
|||||||
describe('#getEIP1559Compatibility', () => {
|
describe('#getEIP1559Compatibility', () => {
|
||||||
it('should return false when baseFeePerGas is not in the block header', async () => {
|
it('should return false when baseFeePerGas is not in the block header', async () => {
|
||||||
networkController.initializeProvider(networkControllerProviderConfig);
|
networkController.initializeProvider(networkControllerProviderConfig);
|
||||||
const supportsEIP1559 = await networkController.getEIP1559Compatibility();
|
const supportsEIP1559 =
|
||||||
|
await networkController.getEIP1559Compatibility();
|
||||||
expect(supportsEIP1559).toStrictEqual(false);
|
expect(supportsEIP1559).toStrictEqual(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -88,7 +89,8 @@ describe('NetworkController', () => {
|
|||||||
getLatestBlockStub.callsFake(() =>
|
getLatestBlockStub.callsFake(() =>
|
||||||
Promise.resolve({ baseFeePerGas: '0xa ' }),
|
Promise.resolve({ baseFeePerGas: '0xa ' }),
|
||||||
);
|
);
|
||||||
const supportsEIP1559 = await networkController.getEIP1559Compatibility();
|
const supportsEIP1559 =
|
||||||
|
await networkController.getEIP1559Compatibility();
|
||||||
expect(supportsEIP1559).toStrictEqual(true);
|
expect(supportsEIP1559).toStrictEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -98,7 +100,8 @@ describe('NetworkController', () => {
|
|||||||
Promise.resolve({ baseFeePerGas: '0xa ' }),
|
Promise.resolve({ baseFeePerGas: '0xa ' }),
|
||||||
);
|
);
|
||||||
await networkController.getEIP1559Compatibility();
|
await networkController.getEIP1559Compatibility();
|
||||||
const supportsEIP1559 = await networkController.getEIP1559Compatibility();
|
const supportsEIP1559 =
|
||||||
|
await networkController.getEIP1559Compatibility();
|
||||||
expect(getLatestBlockStub.calledOnce).toStrictEqual(true);
|
expect(getLatestBlockStub.calledOnce).toStrictEqual(true);
|
||||||
expect(supportsEIP1559).toStrictEqual(true);
|
expect(supportsEIP1559).toStrictEqual(true);
|
||||||
});
|
});
|
||||||
|
@ -68,8 +68,7 @@ describe('PendingNonceMiddleware', () => {
|
|||||||
from: '0xf231d46dd78806e1dd93442cf33c7671f8538748',
|
from: '0xf231d46dd78806e1dd93442cf33c7671f8538748',
|
||||||
gas: GAS_LIMITS.SIMPLE,
|
gas: GAS_LIMITS.SIMPLE,
|
||||||
gasPrice: '0x1e8480',
|
gasPrice: '0x1e8480',
|
||||||
hash:
|
hash: '0x2cc5a25744486f7383edebbf32003e5a66e18135799593d6b5cdd2bb43674f09',
|
||||||
'0x2cc5a25744486f7383edebbf32003e5a66e18135799593d6b5cdd2bb43674f09',
|
|
||||||
input: '0x',
|
input: '0x',
|
||||||
nonce: '0x4',
|
nonce: '0x4',
|
||||||
type: TRANSACTION_ENVELOPE_TYPES.LEGACY,
|
type: TRANSACTION_ENVELOPE_TYPES.LEGACY,
|
||||||
|
@ -25,8 +25,7 @@ describe('network utils', () => {
|
|||||||
chainId: '0x3',
|
chainId: '0x3',
|
||||||
time: 1624408066355,
|
time: 1624408066355,
|
||||||
metamaskNetworkId: '3',
|
metamaskNetworkId: '3',
|
||||||
hash:
|
hash: '0x4bcb6cd6b182209585f8ad140260ddb35c81a575dd40f508d9767e652a9f60e7',
|
||||||
'0x4bcb6cd6b182209585f8ad140260ddb35c81a575dd40f508d9767e652a9f60e7',
|
|
||||||
r: '0x4c3111e42ed5eec3dcecba1e234700f387e8693c373c61c3e54a762a26f1570e',
|
r: '0x4c3111e42ed5eec3dcecba1e234700f387e8693c373c61c3e54a762a26f1570e',
|
||||||
s: '0x18bfc4eeb7ebcfacc3bd59ea100a6834ea3265e65945dbec69aa2a06564fafff',
|
s: '0x18bfc4eeb7ebcfacc3bd59ea100a6834ea3265e65945dbec69aa2a06564fafff',
|
||||||
v: '0x29',
|
v: '0x29',
|
||||||
@ -38,8 +37,7 @@ describe('network utils', () => {
|
|||||||
from: '0xc684832530fcbddae4b4230a47e991ddcec2831d',
|
from: '0xc684832530fcbddae4b4230a47e991ddcec2831d',
|
||||||
gas: '0x7b0d',
|
gas: '0x7b0d',
|
||||||
gasPrice: '0x77359400',
|
gasPrice: '0x77359400',
|
||||||
hash:
|
hash: '0x4bcb6cd6b182209585f8ad140260ddb35c81a575dd40f508d9767e652a9f60e7',
|
||||||
'0x4bcb6cd6b182209585f8ad140260ddb35c81a575dd40f508d9767e652a9f60e7',
|
|
||||||
input: '0x',
|
input: '0x',
|
||||||
maxFeePerGas: '0x77359400',
|
maxFeePerGas: '0x77359400',
|
||||||
maxPriorityFeePerGas: '0x77359400',
|
maxPriorityFeePerGas: '0x77359400',
|
||||||
@ -72,8 +70,7 @@ describe('network utils', () => {
|
|||||||
chainId: '0x3',
|
chainId: '0x3',
|
||||||
time: 1624408066355,
|
time: 1624408066355,
|
||||||
metamaskNetworkId: '3',
|
metamaskNetworkId: '3',
|
||||||
hash:
|
hash: '0x4bcb6cd6b182209585f8ad140260ddb35c81a575dd40f508d9767e652a9f60e7',
|
||||||
'0x4bcb6cd6b182209585f8ad140260ddb35c81a575dd40f508d9767e652a9f60e7',
|
|
||||||
r: '0x4c3111e42ed5eec3dcecba1e234700f387e8693c373c61c3e54a762a26f1570e',
|
r: '0x4c3111e42ed5eec3dcecba1e234700f387e8693c373c61c3e54a762a26f1570e',
|
||||||
s: '0x18bfc4eeb7ebcfacc3bd59ea100a6834ea3265e65945dbec69aa2a06564fafff',
|
s: '0x18bfc4eeb7ebcfacc3bd59ea100a6834ea3265e65945dbec69aa2a06564fafff',
|
||||||
v: '0x29',
|
v: '0x29',
|
||||||
@ -84,8 +81,7 @@ describe('network utils', () => {
|
|||||||
blockNumber: null,
|
blockNumber: null,
|
||||||
from: '0xc684832530fcbddae4b4230a47e991ddcec2831d',
|
from: '0xc684832530fcbddae4b4230a47e991ddcec2831d',
|
||||||
gas: '0x7b0d',
|
gas: '0x7b0d',
|
||||||
hash:
|
hash: '0x4bcb6cd6b182209585f8ad140260ddb35c81a575dd40f508d9767e652a9f60e7',
|
||||||
'0x4bcb6cd6b182209585f8ad140260ddb35c81a575dd40f508d9767e652a9f60e7',
|
|
||||||
input: '0x',
|
input: '0x',
|
||||||
gasPrice: '0x77359400',
|
gasPrice: '0x77359400',
|
||||||
nonce: '0x4b',
|
nonce: '0x4b',
|
||||||
|
@ -4,9 +4,8 @@ import { CaveatMutatorFactories } from './caveat-mutators';
|
|||||||
|
|
||||||
describe('caveat mutators', () => {
|
describe('caveat mutators', () => {
|
||||||
describe('restrictReturnedAccounts', () => {
|
describe('restrictReturnedAccounts', () => {
|
||||||
const { removeAccount } = CaveatMutatorFactories[
|
const { removeAccount } =
|
||||||
CaveatTypes.restrictReturnedAccounts
|
CaveatMutatorFactories[CaveatTypes.restrictReturnedAccounts];
|
||||||
];
|
|
||||||
|
|
||||||
describe('removeAccount', () => {
|
describe('removeAccount', () => {
|
||||||
it('returns the no-op operation if the target account is not permitted', () => {
|
it('returns the no-op operation if the target account is not permitted', () => {
|
||||||
|
@ -90,7 +90,8 @@ const initialState = {
|
|||||||
swapsQuoteRefreshTime: FALLBACK_QUOTE_REFRESH_TIME,
|
swapsQuoteRefreshTime: FALLBACK_QUOTE_REFRESH_TIME,
|
||||||
swapsQuotePrefetchingRefreshTime: FALLBACK_QUOTE_REFRESH_TIME,
|
swapsQuotePrefetchingRefreshTime: FALLBACK_QUOTE_REFRESH_TIME,
|
||||||
swapsStxBatchStatusRefreshTime: FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME,
|
swapsStxBatchStatusRefreshTime: FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME,
|
||||||
swapsStxGetTransactionsRefreshTime: FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME,
|
swapsStxGetTransactionsRefreshTime:
|
||||||
|
FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME,
|
||||||
swapsStxMaxFeeMultiplier: FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER,
|
swapsStxMaxFeeMultiplier: FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER,
|
||||||
swapsFeatureFlags: {},
|
swapsFeatureFlags: {},
|
||||||
},
|
},
|
||||||
@ -336,10 +337,8 @@ export default class SwapsController {
|
|||||||
if (Object.values(newQuotes).length === 0) {
|
if (Object.values(newQuotes).length === 0) {
|
||||||
this.setSwapsErrorKey(QUOTES_NOT_AVAILABLE_ERROR);
|
this.setSwapsErrorKey(QUOTES_NOT_AVAILABLE_ERROR);
|
||||||
} else {
|
} else {
|
||||||
const [
|
const [_topAggId, quotesWithSavingsAndFeeData] =
|
||||||
_topAggId,
|
await this._findTopQuoteAndCalculateSavings(newQuotes);
|
||||||
quotesWithSavingsAndFeeData,
|
|
||||||
] = await this._findTopQuoteAndCalculateSavings(newQuotes);
|
|
||||||
topAggId = _topAggId;
|
topAggId = _topAggId;
|
||||||
newQuotes = quotesWithSavingsAndFeeData;
|
newQuotes = quotesWithSavingsAndFeeData;
|
||||||
}
|
}
|
||||||
@ -486,10 +485,8 @@ export default class SwapsController {
|
|||||||
|
|
||||||
const quoteToUpdate = { ...swapsState.quotes[initialAggId] };
|
const quoteToUpdate = { ...swapsState.quotes[initialAggId] };
|
||||||
|
|
||||||
const {
|
const { gasLimit: newGasEstimate, simulationFails } =
|
||||||
gasLimit: newGasEstimate,
|
await this.timedoutGasReturn(quoteToUpdate.trade);
|
||||||
simulationFails,
|
|
||||||
} = await this.timedoutGasReturn(quoteToUpdate.trade);
|
|
||||||
|
|
||||||
if (newGasEstimate && !simulationFails) {
|
if (newGasEstimate && !simulationFails) {
|
||||||
const gasEstimateWithRefund = calculateGasEstimateWithRefund(
|
const gasEstimateWithRefund = calculateGasEstimateWithRefund(
|
||||||
@ -637,9 +634,8 @@ export default class SwapsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _findTopQuoteAndCalculateSavings(quotes = {}) {
|
async _findTopQuoteAndCalculateSavings(quotes = {}) {
|
||||||
const {
|
const { contractExchangeRates: tokenConversionRates } =
|
||||||
contractExchangeRates: tokenConversionRates,
|
this.getTokenRatesState();
|
||||||
} = this.getTokenRatesState();
|
|
||||||
const {
|
const {
|
||||||
swapsState: { customGasPrice, customMaxPriorityFeePerGas },
|
swapsState: { customGasPrice, customMaxPriorityFeePerGas },
|
||||||
} = this.store.getState();
|
} = this.store.getState();
|
||||||
@ -652,10 +648,8 @@ export default class SwapsController {
|
|||||||
|
|
||||||
const newQuotes = cloneDeep(quotes);
|
const newQuotes = cloneDeep(quotes);
|
||||||
|
|
||||||
const {
|
const { gasFeeEstimates, gasEstimateType } =
|
||||||
gasFeeEstimates,
|
await this._getEIP1559GasFeeEstimates();
|
||||||
gasEstimateType,
|
|
||||||
} = await this._getEIP1559GasFeeEstimates();
|
|
||||||
|
|
||||||
let usedGasPrice = '0x0';
|
let usedGasPrice = '0x0';
|
||||||
|
|
||||||
@ -756,9 +750,8 @@ export default class SwapsController {
|
|||||||
const tokenPercentageOfPreFeeDestAmount = new BigNumber(100, 10)
|
const tokenPercentageOfPreFeeDestAmount = new BigNumber(100, 10)
|
||||||
.minus(metaMaskFee, 10)
|
.minus(metaMaskFee, 10)
|
||||||
.div(100);
|
.div(100);
|
||||||
const destinationAmountBeforeMetaMaskFee = decimalAdjustedDestinationAmount.div(
|
const destinationAmountBeforeMetaMaskFee =
|
||||||
tokenPercentageOfPreFeeDestAmount,
|
decimalAdjustedDestinationAmount.div(tokenPercentageOfPreFeeDestAmount);
|
||||||
);
|
|
||||||
const metaMaskFeeInTokens = destinationAmountBeforeMetaMaskFee.minus(
|
const metaMaskFeeInTokens = destinationAmountBeforeMetaMaskFee.minus(
|
||||||
decimalAdjustedDestinationAmount,
|
decimalAdjustedDestinationAmount,
|
||||||
);
|
);
|
||||||
|
@ -42,8 +42,7 @@ const TEST_AGG_ID_APPROVAL = 'TEST_AGG_APPROVAL';
|
|||||||
const POLLING_TIMEOUT = SECOND * 1000;
|
const POLLING_TIMEOUT = SECOND * 1000;
|
||||||
|
|
||||||
const MOCK_APPROVAL_NEEDED = {
|
const MOCK_APPROVAL_NEEDED = {
|
||||||
data:
|
data: '0x095ea7b300000000000000000000000095e6f48254609a6ee006f7d493c8e5fb97094cef0000000000000000000000000000000000000000004a817c7ffffffdabf41c00',
|
||||||
'0x095ea7b300000000000000000000000095e6f48254609a6ee006f7d493c8e5fb97094cef0000000000000000000000000000000000000000004a817c7ffffffdabf41c00',
|
|
||||||
to: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
to: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||||
amount: '0',
|
amount: '0',
|
||||||
from: '0x2369267687A84ac7B494daE2f1542C40E37f4455',
|
from: '0x2369267687A84ac7B494daE2f1542C40E37f4455',
|
||||||
@ -139,7 +138,8 @@ const EMPTY_INIT_STATE = {
|
|||||||
swapsQuoteRefreshTime: 60000,
|
swapsQuoteRefreshTime: 60000,
|
||||||
swapsQuotePrefetchingRefreshTime: 60000,
|
swapsQuotePrefetchingRefreshTime: 60000,
|
||||||
swapsStxBatchStatusRefreshTime: FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME,
|
swapsStxBatchStatusRefreshTime: FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME,
|
||||||
swapsStxGetTransactionsRefreshTime: FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME,
|
swapsStxGetTransactionsRefreshTime:
|
||||||
|
FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME,
|
||||||
swapsStxMaxFeeMultiplier: FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER,
|
swapsStxMaxFeeMultiplier: FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER,
|
||||||
swapsUserFeeLevel: '',
|
swapsUserFeeLevel: '',
|
||||||
saveFetchedQuotes: false,
|
saveFetchedQuotes: false,
|
||||||
@ -370,13 +370,10 @@ describe('SwapsController', function () {
|
|||||||
baseGasEstimate,
|
baseGasEstimate,
|
||||||
);
|
);
|
||||||
|
|
||||||
const {
|
const { gasLimit: bufferedGasLimit } =
|
||||||
gasLimit: bufferedGasLimit,
|
await swapsController.getBufferedGasLimit();
|
||||||
} = await swapsController.getBufferedGasLimit();
|
const { gasEstimate, gasEstimateWithRefund } =
|
||||||
const {
|
swapsController.store.getState().swapsState.quotes[initialAggId];
|
||||||
gasEstimate,
|
|
||||||
gasEstimateWithRefund,
|
|
||||||
} = swapsController.store.getState().swapsState.quotes[initialAggId];
|
|
||||||
assert.strictEqual(gasEstimate, bufferedGasLimit);
|
assert.strictEqual(gasEstimate, bufferedGasLimit);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
gasEstimateWithRefund,
|
gasEstimateWithRefund,
|
||||||
@ -416,12 +413,10 @@ describe('SwapsController', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns the top aggId and quotes with savings and fee values if passed necessary data and an even number of quotes', async function () {
|
it('returns the top aggId and quotes with savings and fee values if passed necessary data and an even number of quotes', async function () {
|
||||||
const [
|
const [topAggId, resultQuotes] =
|
||||||
topAggId,
|
await swapsController._findTopQuoteAndCalculateSavings(
|
||||||
resultQuotes,
|
getTopQuoteAndSavingsMockQuotes(),
|
||||||
] = await swapsController._findTopQuoteAndCalculateSavings(
|
);
|
||||||
getTopQuoteAndSavingsMockQuotes(),
|
|
||||||
);
|
|
||||||
assert.equal(topAggId, TEST_AGG_ID_1);
|
assert.equal(topAggId, TEST_AGG_ID_1);
|
||||||
assert.deepStrictEqual(
|
assert.deepStrictEqual(
|
||||||
resultQuotes,
|
resultQuotes,
|
||||||
@ -442,10 +437,8 @@ describe('SwapsController', function () {
|
|||||||
medianMetaMaskFee: '0.0202',
|
medianMetaMaskFee: '0.0202',
|
||||||
};
|
};
|
||||||
|
|
||||||
const [
|
const [topAggId, resultQuotes] =
|
||||||
topAggId,
|
await swapsController._findTopQuoteAndCalculateSavings(testInput);
|
||||||
resultQuotes,
|
|
||||||
] = await swapsController._findTopQuoteAndCalculateSavings(testInput);
|
|
||||||
assert.equal(topAggId, TEST_AGG_ID_1);
|
assert.equal(topAggId, TEST_AGG_ID_1);
|
||||||
assert.deepStrictEqual(resultQuotes, expectedResultQuotes);
|
assert.deepStrictEqual(resultQuotes, expectedResultQuotes);
|
||||||
});
|
});
|
||||||
@ -485,10 +478,8 @@ describe('SwapsController', function () {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const [
|
const [topAggId, resultQuotes] =
|
||||||
topAggId,
|
await swapsController._findTopQuoteAndCalculateSavings(testInput);
|
||||||
resultQuotes,
|
|
||||||
] = await swapsController._findTopQuoteAndCalculateSavings(testInput);
|
|
||||||
assert.equal(topAggId, TEST_AGG_ID_1);
|
assert.equal(topAggId, TEST_AGG_ID_1);
|
||||||
assert.deepStrictEqual(resultQuotes, expectedResultQuotes);
|
assert.deepStrictEqual(resultQuotes, expectedResultQuotes);
|
||||||
});
|
});
|
||||||
@ -503,7 +494,8 @@ describe('SwapsController', function () {
|
|||||||
trade: { value: '0x8ac7230489e80000' },
|
trade: { value: '0x8ac7230489e80000' },
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
const baseExpectedResultQuotes = getTopQuoteAndSavingsBaseExpectedResults();
|
const baseExpectedResultQuotes =
|
||||||
|
getTopQuoteAndSavingsBaseExpectedResults();
|
||||||
const expectedResultQuotes = {
|
const expectedResultQuotes = {
|
||||||
[TEST_AGG_ID_1]: {
|
[TEST_AGG_ID_1]: {
|
||||||
...baseExpectedResultQuotes[TEST_AGG_ID_1],
|
...baseExpectedResultQuotes[TEST_AGG_ID_1],
|
||||||
@ -549,10 +541,8 @@ describe('SwapsController', function () {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const [
|
const [topAggId, resultQuotes] =
|
||||||
topAggId,
|
await swapsController._findTopQuoteAndCalculateSavings(testInput);
|
||||||
resultQuotes,
|
|
||||||
] = await swapsController._findTopQuoteAndCalculateSavings(testInput);
|
|
||||||
assert.equal(topAggId, TEST_AGG_ID_1);
|
assert.equal(topAggId, TEST_AGG_ID_1);
|
||||||
assert.deepStrictEqual(resultQuotes, expectedResultQuotes);
|
assert.deepStrictEqual(resultQuotes, expectedResultQuotes);
|
||||||
});
|
});
|
||||||
@ -569,7 +559,8 @@ describe('SwapsController', function () {
|
|||||||
);
|
);
|
||||||
// 0.04 ETH fee included in trade value
|
// 0.04 ETH fee included in trade value
|
||||||
testInput[TEST_AGG_ID_1].trade.value = '0x8b553ece48ec0000';
|
testInput[TEST_AGG_ID_1].trade.value = '0x8b553ece48ec0000';
|
||||||
const baseExpectedResultQuotes = getTopQuoteAndSavingsBaseExpectedResults();
|
const baseExpectedResultQuotes =
|
||||||
|
getTopQuoteAndSavingsBaseExpectedResults();
|
||||||
const expectedResultQuotes = {
|
const expectedResultQuotes = {
|
||||||
[TEST_AGG_ID_1]: {
|
[TEST_AGG_ID_1]: {
|
||||||
...baseExpectedResultQuotes[TEST_AGG_ID_1],
|
...baseExpectedResultQuotes[TEST_AGG_ID_1],
|
||||||
@ -626,10 +617,8 @@ describe('SwapsController', function () {
|
|||||||
delete expectedResultQuotes[TEST_AGG_ID_1].isBestQuote;
|
delete expectedResultQuotes[TEST_AGG_ID_1].isBestQuote;
|
||||||
delete expectedResultQuotes[TEST_AGG_ID_1].savings;
|
delete expectedResultQuotes[TEST_AGG_ID_1].savings;
|
||||||
|
|
||||||
const [
|
const [topAggId, resultQuotes] =
|
||||||
topAggId,
|
await swapsController._findTopQuoteAndCalculateSavings(testInput);
|
||||||
resultQuotes,
|
|
||||||
] = await swapsController._findTopQuoteAndCalculateSavings(testInput);
|
|
||||||
assert.equal(topAggId, TEST_AGG_ID_2);
|
assert.equal(topAggId, TEST_AGG_ID_2);
|
||||||
assert.deepStrictEqual(resultQuotes, expectedResultQuotes);
|
assert.deepStrictEqual(resultQuotes, expectedResultQuotes);
|
||||||
});
|
});
|
||||||
@ -638,7 +627,8 @@ describe('SwapsController', function () {
|
|||||||
const testInput = getTopQuoteAndSavingsMockQuotes();
|
const testInput = getTopQuoteAndSavingsMockQuotes();
|
||||||
// 0.04 ETH fee included in trade value
|
// 0.04 ETH fee included in trade value
|
||||||
testInput[TEST_AGG_ID_1].trade.value = '0x8e1bc9bf040000';
|
testInput[TEST_AGG_ID_1].trade.value = '0x8e1bc9bf040000';
|
||||||
const baseExpectedResultQuotes = getTopQuoteAndSavingsBaseExpectedResults();
|
const baseExpectedResultQuotes =
|
||||||
|
getTopQuoteAndSavingsBaseExpectedResults();
|
||||||
const expectedResultQuotes = {
|
const expectedResultQuotes = {
|
||||||
...baseExpectedResultQuotes,
|
...baseExpectedResultQuotes,
|
||||||
[TEST_AGG_ID_1]: {
|
[TEST_AGG_ID_1]: {
|
||||||
@ -662,10 +652,8 @@ describe('SwapsController', function () {
|
|||||||
delete expectedResultQuotes[TEST_AGG_ID_1].isBestQuote;
|
delete expectedResultQuotes[TEST_AGG_ID_1].isBestQuote;
|
||||||
delete expectedResultQuotes[TEST_AGG_ID_1].savings;
|
delete expectedResultQuotes[TEST_AGG_ID_1].savings;
|
||||||
|
|
||||||
const [
|
const [topAggId, resultQuotes] =
|
||||||
topAggId,
|
await swapsController._findTopQuoteAndCalculateSavings(testInput);
|
||||||
resultQuotes,
|
|
||||||
] = await swapsController._findTopQuoteAndCalculateSavings(testInput);
|
|
||||||
assert.equal(topAggId, TEST_AGG_ID_2);
|
assert.equal(topAggId, TEST_AGG_ID_2);
|
||||||
assert.deepStrictEqual(resultQuotes, expectedResultQuotes);
|
assert.deepStrictEqual(resultQuotes, expectedResultQuotes);
|
||||||
});
|
});
|
||||||
|
@ -225,9 +225,8 @@ export default class ThreeBoxController {
|
|||||||
PreferencesController: preferences,
|
PreferencesController: preferences,
|
||||||
AddressBookController: addressBook,
|
AddressBookController: addressBook,
|
||||||
};
|
};
|
||||||
const initialMigrationState = migrator.generateInitialState(
|
const initialMigrationState =
|
||||||
formattedStateBackup,
|
migrator.generateInitialState(formattedStateBackup);
|
||||||
);
|
|
||||||
const migratedState = await migrator.migrateData(initialMigrationState);
|
const migratedState = await migrator.migrateData(initialMigrationState);
|
||||||
return {
|
return {
|
||||||
preferences: migratedState.data.PreferencesController,
|
preferences: migratedState.data.PreferencesController,
|
||||||
|
@ -174,9 +174,8 @@ export default class TransactionController extends EventEmitter {
|
|||||||
);
|
);
|
||||||
return [...pendingTransactions, ...externalPendingTransactions];
|
return [...pendingTransactions, ...externalPendingTransactions];
|
||||||
},
|
},
|
||||||
getConfirmedTransactions: this.txStateManager.getConfirmedTransactions.bind(
|
getConfirmedTransactions:
|
||||||
this.txStateManager,
|
this.txStateManager.getConfirmedTransactions.bind(this.txStateManager),
|
||||||
),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.pendingTxTracker = new PendingTransactionTracker({
|
this.pendingTxTracker = new PendingTransactionTracker({
|
||||||
@ -189,9 +188,8 @@ export default class TransactionController extends EventEmitter {
|
|||||||
return [...pending, ...approved];
|
return [...pending, ...approved];
|
||||||
},
|
},
|
||||||
approveTransaction: this.approveTransaction.bind(this),
|
approveTransaction: this.approveTransaction.bind(this),
|
||||||
getCompletedTransactions: this.txStateManager.getConfirmedTransactions.bind(
|
getCompletedTransactions:
|
||||||
this.txStateManager,
|
this.txStateManager.getConfirmedTransactions.bind(this.txStateManager),
|
||||||
),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.txStateManager.store.subscribe(() =>
|
this.txStateManager.store.subscribe(() =>
|
||||||
@ -227,10 +225,10 @@ export default class TransactionController extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getEIP1559Compatibility(fromAddress) {
|
async getEIP1559Compatibility(fromAddress) {
|
||||||
const currentNetworkIsCompatible = await this._getCurrentNetworkEIP1559Compatibility();
|
const currentNetworkIsCompatible =
|
||||||
const fromAccountIsCompatible = await this._getCurrentAccountEIP1559Compatibility(
|
await this._getCurrentNetworkEIP1559Compatibility();
|
||||||
fromAddress,
|
const fromAccountIsCompatible =
|
||||||
);
|
await this._getCurrentAccountEIP1559Compatibility(fromAddress);
|
||||||
return currentNetworkIsCompatible && fromAccountIsCompatible;
|
return currentNetworkIsCompatible && fromAccountIsCompatible;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -815,10 +813,8 @@ export default class TransactionController extends EventEmitter {
|
|||||||
maxFeePerGas: defaultMaxFeePerGas,
|
maxFeePerGas: defaultMaxFeePerGas,
|
||||||
maxPriorityFeePerGas: defaultMaxPriorityFeePerGas,
|
maxPriorityFeePerGas: defaultMaxPriorityFeePerGas,
|
||||||
} = await this._getDefaultGasFees(txMeta, eip1559Compatibility);
|
} = await this._getDefaultGasFees(txMeta, eip1559Compatibility);
|
||||||
const {
|
const { gasLimit: defaultGasLimit, simulationFails } =
|
||||||
gasLimit: defaultGasLimit,
|
await this._getDefaultGasLimit(txMeta, getCodeResponse);
|
||||||
simulationFails,
|
|
||||||
} = await this._getDefaultGasLimit(txMeta, getCodeResponse);
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
txMeta = this.txStateManager.getTransaction(txMeta.id);
|
txMeta = this.txStateManager.getTransaction(txMeta.id);
|
||||||
@ -960,10 +956,8 @@ export default class TransactionController extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const {
|
const { gasFeeEstimates, gasEstimateType } =
|
||||||
gasFeeEstimates,
|
await this._getEIP1559GasFeeEstimates();
|
||||||
gasEstimateType,
|
|
||||||
} = await this._getEIP1559GasFeeEstimates();
|
|
||||||
if (
|
if (
|
||||||
eip1559Compatibility &&
|
eip1559Compatibility &&
|
||||||
gasEstimateType === GAS_ESTIMATE_TYPES.FEE_MARKET
|
gasEstimateType === GAS_ESTIMATE_TYPES.FEE_MARKET
|
||||||
@ -1038,11 +1032,8 @@ export default class TransactionController extends EventEmitter {
|
|||||||
return { gasLimit: GAS_LIMITS.SIMPLE };
|
return { gasLimit: GAS_LIMITS.SIMPLE };
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const { blockGasLimit, estimatedGasHex, simulationFails } =
|
||||||
blockGasLimit,
|
await this.txGasUtil.analyzeGasUsage(txMeta);
|
||||||
estimatedGasHex,
|
|
||||||
simulationFails,
|
|
||||||
} = await this.txGasUtil.analyzeGasUsage(txMeta);
|
|
||||||
|
|
||||||
// add additional gas buffer to our estimation for safety
|
// add additional gas buffer to our estimation for safety
|
||||||
const gasLimit = this.txGasUtil.addGasBuffer(
|
const gasLimit = this.txGasUtil.addGasBuffer(
|
||||||
@ -1545,9 +1536,8 @@ export default class TransactionController extends EventEmitter {
|
|||||||
const metricsParams = { gas_used: gasUsed };
|
const metricsParams = { gas_used: gasUsed };
|
||||||
|
|
||||||
if (submittedTime) {
|
if (submittedTime) {
|
||||||
metricsParams.completion_time = this._getTransactionCompletionTime(
|
metricsParams.completion_time =
|
||||||
submittedTime,
|
this._getTransactionCompletionTime(submittedTime);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (txReceipt.status === '0x0') {
|
if (txReceipt.status === '0x0') {
|
||||||
@ -1606,9 +1596,8 @@ export default class TransactionController extends EventEmitter {
|
|||||||
const metricsParams = { gas_used: gasUsed };
|
const metricsParams = { gas_used: gasUsed };
|
||||||
|
|
||||||
if (submittedTime) {
|
if (submittedTime) {
|
||||||
metricsParams.completion_time = this._getTransactionCompletionTime(
|
metricsParams.completion_time =
|
||||||
submittedTime,
|
this._getTransactionCompletionTime(submittedTime);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (txReceipt.status === '0x0') {
|
if (txReceipt.status === '0x0') {
|
||||||
@ -1673,10 +1662,8 @@ export default class TransactionController extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
async createTransactionEventFragment(transactionId, event) {
|
async createTransactionEventFragment(transactionId, event) {
|
||||||
const txMeta = this.txStateManager.getTransaction(transactionId);
|
const txMeta = this.txStateManager.getTransaction(transactionId);
|
||||||
const {
|
const { properties, sensitiveProperties } =
|
||||||
properties,
|
await this._buildEventFragmentProperties(txMeta);
|
||||||
sensitiveProperties,
|
|
||||||
} = await this._buildEventFragmentProperties(txMeta);
|
|
||||||
this._createTransactionEventFragment(
|
this._createTransactionEventFragment(
|
||||||
txMeta,
|
txMeta,
|
||||||
event,
|
event,
|
||||||
@ -2052,7 +2039,8 @@ export default class TransactionController extends EventEmitter {
|
|||||||
if (gasFeeEstimates?.[estimateType]?.suggestedMaxPriorityFeePerGas) {
|
if (gasFeeEstimates?.[estimateType]?.suggestedMaxPriorityFeePerGas) {
|
||||||
defaultMaxPriorityFeePerGas =
|
defaultMaxPriorityFeePerGas =
|
||||||
gasFeeEstimates[estimateType]?.suggestedMaxPriorityFeePerGas;
|
gasFeeEstimates[estimateType]?.suggestedMaxPriorityFeePerGas;
|
||||||
gasParams.default_max_priority_fee_per_gas = defaultMaxPriorityFeePerGas;
|
gasParams.default_max_priority_fee_per_gas =
|
||||||
|
defaultMaxPriorityFeePerGas;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2272,10 +2260,8 @@ export default class TransactionController extends EventEmitter {
|
|||||||
if (!txMeta) {
|
if (!txMeta) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const {
|
const { properties, sensitiveProperties } =
|
||||||
properties,
|
await this._buildEventFragmentProperties(txMeta, extraParams);
|
||||||
sensitiveProperties,
|
|
||||||
} = await this._buildEventFragmentProperties(txMeta, extraParams);
|
|
||||||
|
|
||||||
// Create event fragments for event types that spawn fragments, and ensure
|
// Create event fragments for event types that spawn fragments, and ensure
|
||||||
// existence of fragments for event types that act upon them.
|
// existence of fragments for event types that act upon them.
|
||||||
|
@ -2291,8 +2291,7 @@ describe('Transaction Controller', function () {
|
|||||||
providerResultStub.eth_getCode = '0xab';
|
providerResultStub.eth_getCode = '0xab';
|
||||||
// test update gasFees
|
// test update gasFees
|
||||||
await txController.updateEditableParams('1', {
|
await txController.updateEditableParams('1', {
|
||||||
data:
|
data: '0xa9059cbb000000000000000000000000e18035bf8712672935fdb4e5e431b1a0183d2dfc0000000000000000000000000000000000000000000000000de0b6b3a7640000',
|
||||||
'0xa9059cbb000000000000000000000000e18035bf8712672935fdb4e5e431b1a0183d2dfc0000000000000000000000000000000000000000000000000de0b6b3a7640000',
|
|
||||||
});
|
});
|
||||||
const result = txStateManager.getTransaction('1');
|
const result = txStateManager.getTransaction('1');
|
||||||
assert.equal(
|
assert.equal(
|
||||||
@ -2316,8 +2315,7 @@ describe('Transaction Controller', function () {
|
|||||||
// maxFeePerGas: '0x004',
|
// maxFeePerGas: '0x004',
|
||||||
to: VALID_ADDRESS,
|
to: VALID_ADDRESS,
|
||||||
from: VALID_ADDRESS,
|
from: VALID_ADDRESS,
|
||||||
data:
|
data: '0xa9059cbb000000000000000000000000e18035bf8712672935fdb4e5e431b1a0183d2dfc0000000000000000000000000000000000000000000000000de0b6b3a7640000',
|
||||||
'0xa9059cbb000000000000000000000000e18035bf8712672935fdb4e5e431b1a0183d2dfc0000000000000000000000000000000000000000000000000de0b6b3a7640000',
|
|
||||||
},
|
},
|
||||||
estimateUsed: '0x005',
|
estimateUsed: '0x005',
|
||||||
estimatedBaseFee: '0x006',
|
estimatedBaseFee: '0x006',
|
||||||
|
@ -198,13 +198,8 @@ export default class PendingTransactionTracker extends EventEmitter {
|
|||||||
try {
|
try {
|
||||||
const transactionReceipt = await this.query.getTransactionReceipt(txHash);
|
const transactionReceipt = await this.query.getTransactionReceipt(txHash);
|
||||||
if (transactionReceipt?.blockNumber) {
|
if (transactionReceipt?.blockNumber) {
|
||||||
const {
|
const { baseFeePerGas, timestamp: blockTimestamp } =
|
||||||
baseFeePerGas,
|
await this.query.getBlockByHash(transactionReceipt?.blockHash, false);
|
||||||
timestamp: blockTimestamp,
|
|
||||||
} = await this.query.getBlockByHash(
|
|
||||||
transactionReceipt?.blockHash,
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.emit(
|
this.emit(
|
||||||
'tx:confirmed',
|
'tx:confirmed',
|
||||||
|
@ -154,8 +154,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
it('should call _checkPendingTx for each pending transaction', async function () {
|
it('should call _checkPendingTx for each pending transaction', async function () {
|
||||||
const txMeta = {
|
const txMeta = {
|
||||||
id: 1,
|
id: 1,
|
||||||
hash:
|
hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
||||||
'0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
|
||||||
status: TRANSACTION_STATUSES.SIGNED,
|
status: TRANSACTION_STATUSES.SIGNED,
|
||||||
txParams: {
|
txParams: {
|
||||||
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
||||||
@ -212,8 +211,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
it('should publish a new transaction', async function () {
|
it('should publish a new transaction', async function () {
|
||||||
const txMeta = {
|
const txMeta = {
|
||||||
id: 1,
|
id: 1,
|
||||||
hash:
|
hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
||||||
'0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
|
||||||
status: TRANSACTION_STATUSES.SIGNED,
|
status: TRANSACTION_STATUSES.SIGNED,
|
||||||
txParams: {
|
txParams: {
|
||||||
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
||||||
@ -257,8 +255,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
it('should publish the given transaction if more than 2**retryCount blocks have passed', async function () {
|
it('should publish the given transaction if more than 2**retryCount blocks have passed', async function () {
|
||||||
const txMeta = {
|
const txMeta = {
|
||||||
id: 1,
|
id: 1,
|
||||||
hash:
|
hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
||||||
'0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
|
||||||
status: TRANSACTION_STATUSES.SIGNED,
|
status: TRANSACTION_STATUSES.SIGNED,
|
||||||
txParams: {
|
txParams: {
|
||||||
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
||||||
@ -304,8 +301,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
it('should NOT publish the given transaction if fewer than 2**retryCount blocks have passed', async function () {
|
it('should NOT publish the given transaction if fewer than 2**retryCount blocks have passed', async function () {
|
||||||
const txMeta = {
|
const txMeta = {
|
||||||
id: 1,
|
id: 1,
|
||||||
hash:
|
hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
||||||
'0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
|
||||||
status: TRANSACTION_STATUSES.SIGNED,
|
status: TRANSACTION_STATUSES.SIGNED,
|
||||||
txParams: {
|
txParams: {
|
||||||
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
||||||
@ -404,8 +400,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
assert.ok(
|
assert.ok(
|
||||||
await pendingTxTracker._checkIfTxWasDropped({
|
await pendingTxTracker._checkIfTxWasDropped({
|
||||||
id: 1,
|
id: 1,
|
||||||
hash:
|
hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
||||||
'0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
|
||||||
status: TRANSACTION_STATUSES.SUBMITTED,
|
status: TRANSACTION_STATUSES.SUBMITTED,
|
||||||
txParams: {
|
txParams: {
|
||||||
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
||||||
@ -437,8 +432,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
|
|
||||||
const dropped = await pendingTxTracker._checkIfTxWasDropped({
|
const dropped = await pendingTxTracker._checkIfTxWasDropped({
|
||||||
id: 1,
|
id: 1,
|
||||||
hash:
|
hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
||||||
'0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
|
||||||
status: TRANSACTION_STATUSES.SUBMITTED,
|
status: TRANSACTION_STATUSES.SUBMITTED,
|
||||||
txParams: {
|
txParams: {
|
||||||
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
||||||
@ -458,8 +452,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
const confirmedTxList = [
|
const confirmedTxList = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
hash:
|
hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
||||||
'0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
|
||||||
status: TRANSACTION_STATUSES.CONFIRMED,
|
status: TRANSACTION_STATUSES.CONFIRMED,
|
||||||
txParams: {
|
txParams: {
|
||||||
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
||||||
@ -471,8 +464,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
hash:
|
hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
||||||
'0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
|
||||||
status: TRANSACTION_STATUSES.CONFIRMED,
|
status: TRANSACTION_STATUSES.CONFIRMED,
|
||||||
txParams: {
|
txParams: {
|
||||||
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
||||||
@ -517,8 +509,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
const confirmedTxList = [
|
const confirmedTxList = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
hash:
|
hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
||||||
'0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
|
||||||
status: TRANSACTION_STATUSES.CONFIRMED,
|
status: TRANSACTION_STATUSES.CONFIRMED,
|
||||||
txParams: {
|
txParams: {
|
||||||
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
||||||
@ -530,8 +521,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
hash:
|
hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
||||||
'0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
|
||||||
status: TRANSACTION_STATUSES.CONFIRMED,
|
status: TRANSACTION_STATUSES.CONFIRMED,
|
||||||
txParams: {
|
txParams: {
|
||||||
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
||||||
@ -577,8 +567,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
it("should emit 'tx:warning' if getTransactionReceipt rejects", async function () {
|
it("should emit 'tx:warning' if getTransactionReceipt rejects", async function () {
|
||||||
const txMeta = {
|
const txMeta = {
|
||||||
id: 1,
|
id: 1,
|
||||||
hash:
|
hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
||||||
'0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
|
||||||
status: TRANSACTION_STATUSES.SUBMITTED,
|
status: TRANSACTION_STATUSES.SUBMITTED,
|
||||||
txParams: {
|
txParams: {
|
||||||
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
||||||
@ -730,8 +719,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
txParams: { nonce: '0x1' },
|
txParams: { nonce: '0x1' },
|
||||||
id: '123',
|
id: '123',
|
||||||
value: '0x02',
|
value: '0x02',
|
||||||
hash:
|
hash: '0x2a919d2512ec963f524bfd9730fb66b6d5a2e399d1dd957abb5e2b544a12644b',
|
||||||
'0x2a919d2512ec963f524bfd9730fb66b6d5a2e399d1dd957abb5e2b544a12644b',
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const pendingTxTracker = new PendingTransactionTracker({
|
const pendingTxTracker = new PendingTransactionTracker({
|
||||||
@ -774,8 +762,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
const nonceBN = new BN(2);
|
const nonceBN = new BN(2);
|
||||||
const txMeta = {
|
const txMeta = {
|
||||||
id: 1,
|
id: 1,
|
||||||
hash:
|
hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
||||||
'0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
|
|
||||||
status: TRANSACTION_STATUSES.SUBMITTED,
|
status: TRANSACTION_STATUSES.SUBMITTED,
|
||||||
txParams: {
|
txParams: {
|
||||||
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
from: '0x1678a085c290ebd122dc42cba69373b5953b831d',
|
||||||
|
@ -102,11 +102,8 @@ export default class TxGasUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getBufferedGasLimit(txMeta, multiplier) {
|
async getBufferedGasLimit(txMeta, multiplier) {
|
||||||
const {
|
const { blockGasLimit, estimatedGasHex, simulationFails } =
|
||||||
blockGasLimit,
|
await this.analyzeGasUsage(txMeta);
|
||||||
estimatedGasHex,
|
|
||||||
simulationFails,
|
|
||||||
} = await this.analyzeGasUsage(txMeta);
|
|
||||||
|
|
||||||
// add additional gas buffer to our estimation for safety
|
// add additional gas buffer to our estimation for safety
|
||||||
const gasLimit = this.addGasBuffer(
|
const gasLimit = this.addGasBuffer(
|
||||||
|
@ -82,9 +82,8 @@ const createTransakUrl = (walletAddress, chainId) => {
|
|||||||
* @returns String
|
* @returns String
|
||||||
*/
|
*/
|
||||||
const createMoonPayUrl = async (walletAddress, chainId) => {
|
const createMoonPayUrl = async (walletAddress, chainId) => {
|
||||||
const {
|
const { moonPay: { defaultCurrencyCode, showOnlyCurrencies } = {} } =
|
||||||
moonPay: { defaultCurrencyCode, showOnlyCurrencies } = {},
|
BUYABLE_CHAINS_MAP[chainId];
|
||||||
} = BUYABLE_CHAINS_MAP[chainId];
|
|
||||||
const moonPayQueryParams = new URLSearchParams({
|
const moonPayQueryParams = new URLSearchParams({
|
||||||
apiKey: MOONPAY_API_KEY,
|
apiKey: MOONPAY_API_KEY,
|
||||||
walletAddress,
|
walletAddress,
|
||||||
|
@ -116,9 +116,8 @@ describe('buy-url', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns a MoonPay url with a prefilled wallet address for the Ethereum network', async () => {
|
it('returns a MoonPay url with a prefilled wallet address for the Ethereum network', async () => {
|
||||||
const {
|
const { moonPay: { defaultCurrencyCode, showOnlyCurrencies } = {} } =
|
||||||
moonPay: { defaultCurrencyCode, showOnlyCurrencies } = {},
|
BUYABLE_CHAINS_MAP[MAINNET.chainId];
|
||||||
} = BUYABLE_CHAINS_MAP[MAINNET.chainId];
|
|
||||||
const moonPayQueryParams = new URLSearchParams({
|
const moonPayQueryParams = new URLSearchParams({
|
||||||
apiKey: MOONPAY_API_KEY,
|
apiKey: MOONPAY_API_KEY,
|
||||||
walletAddress: MAINNET.address,
|
walletAddress: MAINNET.address,
|
||||||
|
@ -35,9 +35,8 @@ export default async function resolveEnsToIpfsContentId({ provider, name }) {
|
|||||||
const type = contentHash.getCodec(rawContentHash);
|
const type = contentHash.getCodec(rawContentHash);
|
||||||
|
|
||||||
if (type === 'ipfs-ns' || type === 'ipns-ns') {
|
if (type === 'ipfs-ns' || type === 'ipns-ns') {
|
||||||
decodedContentHash = contentHash.helpers.cidV0ToV1Base32(
|
decodedContentHash =
|
||||||
decodedContentHash,
|
contentHash.helpers.cidV0ToV1Base32(decodedContentHash);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return { type, hash: decodedContentHash };
|
return { type, hash: decodedContentHash };
|
||||||
|
@ -314,8 +314,9 @@ export default class PersonalMessageManager extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
_saveMsgList() {
|
_saveMsgList() {
|
||||||
const unapprovedPersonalMsgs = this.getUnapprovedMsgs();
|
const unapprovedPersonalMsgs = this.getUnapprovedMsgs();
|
||||||
const unapprovedPersonalMsgCount = Object.keys(unapprovedPersonalMsgs)
|
const unapprovedPersonalMsgCount = Object.keys(
|
||||||
.length;
|
unapprovedPersonalMsgs,
|
||||||
|
).length;
|
||||||
this.memStore.updateState({
|
this.memStore.updateState({
|
||||||
unapprovedPersonalMsgs,
|
unapprovedPersonalMsgs,
|
||||||
unapprovedPersonalMsgCount,
|
unapprovedPersonalMsgCount,
|
||||||
|
@ -391,8 +391,9 @@ export default class TypedMessageManager extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
_saveMsgList() {
|
_saveMsgList() {
|
||||||
const unapprovedTypedMessages = this.getUnapprovedMsgs();
|
const unapprovedTypedMessages = this.getUnapprovedMsgs();
|
||||||
const unapprovedTypedMessagesCount = Object.keys(unapprovedTypedMessages)
|
const unapprovedTypedMessagesCount = Object.keys(
|
||||||
.length;
|
unapprovedTypedMessages,
|
||||||
|
).length;
|
||||||
this.memStore.updateState({
|
this.memStore.updateState({
|
||||||
unapprovedTypedMessages,
|
unapprovedTypedMessages,
|
||||||
unapprovedTypedMessagesCount,
|
unapprovedTypedMessagesCount,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -221,9 +221,10 @@ describe('MetaMaskController', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('adds private key to keyrings in KeyringController', async function () {
|
it('adds private key to keyrings in KeyringController', async function () {
|
||||||
const simpleKeyrings = metamaskController.keyringController.getKeyringsByType(
|
const simpleKeyrings =
|
||||||
'Simple Key Pair',
|
metamaskController.keyringController.getKeyringsByType(
|
||||||
);
|
'Simple Key Pair',
|
||||||
|
);
|
||||||
const privKeyBuffer = simpleKeyrings[0].wallets[0].privateKey;
|
const privKeyBuffer = simpleKeyrings[0].wallets[0].privateKey;
|
||||||
const pubKeyBuffer = simpleKeyrings[0].wallets[0].publicKey;
|
const pubKeyBuffer = simpleKeyrings[0].wallets[0].publicKey;
|
||||||
const addressBuffer = pubToAddress(pubKeyBuffer);
|
const addressBuffer = pubToAddress(pubKeyBuffer);
|
||||||
@ -234,7 +235,8 @@ describe('MetaMaskController', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('adds 1 account', async function () {
|
it('adds 1 account', async function () {
|
||||||
const keyringAccounts = await metamaskController.keyringController.getAccounts();
|
const keyringAccounts =
|
||||||
|
await metamaskController.keyringController.getAccounts();
|
||||||
assert.equal(
|
assert.equal(
|
||||||
keyringAccounts[keyringAccounts.length - 1],
|
keyringAccounts[keyringAccounts.length - 1],
|
||||||
'0xe18035bf8712672935fdb4e5e431b1a0183d2dfc',
|
'0xe18035bf8712672935fdb4e5e431b1a0183d2dfc',
|
||||||
@ -259,7 +261,8 @@ describe('MetaMaskController', function () {
|
|||||||
const identities = Object.keys(
|
const identities = Object.keys(
|
||||||
metamaskController.preferencesController.store.getState().identities,
|
metamaskController.preferencesController.store.getState().identities,
|
||||||
);
|
);
|
||||||
const addresses = await metamaskController.keyringController.getAccounts();
|
const addresses =
|
||||||
|
await metamaskController.keyringController.getAccounts();
|
||||||
|
|
||||||
identities.forEach((identity) => {
|
identities.forEach((identity) => {
|
||||||
assert.ok(
|
assert.ok(
|
||||||
@ -486,7 +489,8 @@ describe('MetaMaskController', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('changes preferences controller select address', function () {
|
it('changes preferences controller select address', function () {
|
||||||
const preferenceControllerState = metamaskController.preferencesController.store.getState();
|
const preferenceControllerState =
|
||||||
|
metamaskController.preferencesController.store.getState();
|
||||||
assert.equal(preferenceControllerState.selectedAddress, address);
|
assert.equal(preferenceControllerState.selectedAddress, address);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -517,9 +521,10 @@ describe('MetaMaskController', function () {
|
|||||||
await metamaskController
|
await metamaskController
|
||||||
.connectHardware(DEVICE_NAMES.TREZOR, 0)
|
.connectHardware(DEVICE_NAMES.TREZOR, 0)
|
||||||
.catch(() => null);
|
.catch(() => null);
|
||||||
const keyrings = await metamaskController.keyringController.getKeyringsByType(
|
const keyrings =
|
||||||
KEYRING_TYPES.TREZOR,
|
await metamaskController.keyringController.getKeyringsByType(
|
||||||
);
|
KEYRING_TYPES.TREZOR,
|
||||||
|
);
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
metamaskController.keyringController.addNewKeyring.getCall(0).args,
|
metamaskController.keyringController.addNewKeyring.getCall(0).args,
|
||||||
[KEYRING_TYPES.TREZOR],
|
[KEYRING_TYPES.TREZOR],
|
||||||
@ -532,9 +537,10 @@ describe('MetaMaskController', function () {
|
|||||||
await metamaskController
|
await metamaskController
|
||||||
.connectHardware(DEVICE_NAMES.LEDGER, 0)
|
.connectHardware(DEVICE_NAMES.LEDGER, 0)
|
||||||
.catch(() => null);
|
.catch(() => null);
|
||||||
const keyrings = await metamaskController.keyringController.getKeyringsByType(
|
const keyrings =
|
||||||
KEYRING_TYPES.LEDGER,
|
await metamaskController.keyringController.getKeyringsByType(
|
||||||
);
|
KEYRING_TYPES.LEDGER,
|
||||||
|
);
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
metamaskController.keyringController.addNewKeyring.getCall(0).args,
|
metamaskController.keyringController.addNewKeyring.getCall(0).args,
|
||||||
[KEYRING_TYPES.LEDGER],
|
[KEYRING_TYPES.LEDGER],
|
||||||
@ -586,9 +592,10 @@ describe('MetaMaskController', function () {
|
|||||||
.connectHardware(DEVICE_NAMES.TREZOR, 0)
|
.connectHardware(DEVICE_NAMES.TREZOR, 0)
|
||||||
.catch(() => null);
|
.catch(() => null);
|
||||||
await metamaskController.forgetDevice(DEVICE_NAMES.TREZOR);
|
await metamaskController.forgetDevice(DEVICE_NAMES.TREZOR);
|
||||||
const keyrings = await metamaskController.keyringController.getKeyringsByType(
|
const keyrings =
|
||||||
KEYRING_TYPES.TREZOR,
|
await metamaskController.keyringController.getKeyringsByType(
|
||||||
);
|
KEYRING_TYPES.TREZOR,
|
||||||
|
);
|
||||||
|
|
||||||
assert.deepEqual(keyrings[0].accounts, []);
|
assert.deepEqual(keyrings[0].accounts, []);
|
||||||
assert.deepEqual(keyrings[0].page, 0);
|
assert.deepEqual(keyrings[0].page, 0);
|
||||||
@ -645,9 +652,10 @@ describe('MetaMaskController', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set unlockedAccount in the keyring', async function () {
|
it('should set unlockedAccount in the keyring', async function () {
|
||||||
const keyrings = await metamaskController.keyringController.getKeyringsByType(
|
const keyrings =
|
||||||
KEYRING_TYPES.TREZOR,
|
await metamaskController.keyringController.getKeyringsByType(
|
||||||
);
|
KEYRING_TYPES.TREZOR,
|
||||||
|
);
|
||||||
assert.equal(keyrings[0].unlockedAccount, accountToUnlock);
|
assert.equal(keyrings[0].unlockedAccount, accountToUnlock);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -690,7 +698,8 @@ describe('MetaMaskController', function () {
|
|||||||
CUSTOM_RPC_URL,
|
CUSTOM_RPC_URL,
|
||||||
CUSTOM_RPC_CHAIN_ID,
|
CUSTOM_RPC_CHAIN_ID,
|
||||||
);
|
);
|
||||||
const networkControllerState = metamaskController.networkController.store.getState();
|
const networkControllerState =
|
||||||
|
metamaskController.networkController.store.getState();
|
||||||
assert.equal(networkControllerState.provider.rpcUrl, CUSTOM_RPC_URL);
|
assert.equal(networkControllerState.provider.rpcUrl, CUSTOM_RPC_URL);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -726,7 +735,8 @@ describe('MetaMaskController', function () {
|
|||||||
|
|
||||||
it('#addNewAccount', async function () {
|
it('#addNewAccount', async function () {
|
||||||
await metamaskController.addNewAccount();
|
await metamaskController.addNewAccount();
|
||||||
const getAccounts = await metamaskController.keyringController.getAccounts();
|
const getAccounts =
|
||||||
|
await metamaskController.keyringController.getAccounts();
|
||||||
assert.equal(getAccounts.length, 2);
|
assert.equal(getAccounts.length, 2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -959,7 +969,8 @@ describe('MetaMaskController', function () {
|
|||||||
// handle the promise so it doesn't throw an unhandledRejection
|
// handle the promise so it doesn't throw an unhandledRejection
|
||||||
promise.then(noop).catch(noop);
|
promise.then(noop).catch(noop);
|
||||||
|
|
||||||
metamaskPersonalMsgs = metamaskController.personalMessageManager.getUnapprovedMsgs();
|
metamaskPersonalMsgs =
|
||||||
|
metamaskController.personalMessageManager.getUnapprovedMsgs();
|
||||||
personalMessages = metamaskController.personalMessageManager.messages;
|
personalMessages = metamaskController.personalMessageManager.messages;
|
||||||
msgId = Object.keys(metamaskPersonalMsgs)[0];
|
msgId = Object.keys(metamaskPersonalMsgs)[0];
|
||||||
personalMessages[0].msgParams.metamaskId = parseInt(msgId, 10);
|
personalMessages[0].msgParams.metamaskId = parseInt(msgId, 10);
|
||||||
@ -1250,9 +1261,8 @@ describe('MetaMaskController', function () {
|
|||||||
describe('markNotificationsAsRead', function () {
|
describe('markNotificationsAsRead', function () {
|
||||||
it('marks the notification as read', function () {
|
it('marks the notification as read', function () {
|
||||||
metamaskController.markNotificationsAsRead([NOTIFICATION_ID]);
|
metamaskController.markNotificationsAsRead([NOTIFICATION_ID]);
|
||||||
const readNotification = metamaskController.getState().notifications[
|
const readNotification =
|
||||||
NOTIFICATION_ID
|
metamaskController.getState().notifications[NOTIFICATION_ID];
|
||||||
];
|
|
||||||
assert.notEqual(readNotification.readDate, null);
|
assert.notEqual(readNotification.readDate, null);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -18,11 +18,8 @@ const storage = {
|
|||||||
describe('storage is migrated successfully where transactions that are submitted have submittedTimes', () => {
|
describe('storage is migrated successfully where transactions that are submitted have submittedTimes', () => {
|
||||||
it('should add submittedTime key on the txMeta if appropriate', async () => {
|
it('should add submittedTime key on the txMeta if appropriate', async () => {
|
||||||
const migratedData = await migration22.migrate(storage);
|
const migratedData = await migration22.migrate(storage);
|
||||||
const [
|
const [txMeta1, txMeta2, txMeta3] =
|
||||||
txMeta1,
|
migratedData.data.TransactionController.transactions;
|
||||||
txMeta2,
|
|
||||||
txMeta3,
|
|
||||||
] = migratedData.data.TransactionController.transactions;
|
|
||||||
|
|
||||||
expect(migratedData.meta.version).toStrictEqual(22);
|
expect(migratedData.meta.version).toStrictEqual(22);
|
||||||
// should have written a submitted time
|
// should have written a submitted time
|
||||||
|
@ -33,7 +33,8 @@ function transformState(state) {
|
|||||||
delete frequentRpcListDetail[index].chainId;
|
delete frequentRpcListDetail[index].chainId;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
newState.PreferencesController.frequentRpcListDetail = frequentRpcListDetail;
|
newState.PreferencesController.frequentRpcListDetail =
|
||||||
|
frequentRpcListDetail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (state.NetworkController) {
|
if (state.NetworkController) {
|
||||||
|
@ -21,7 +21,8 @@ function transformState(state) {
|
|||||||
if (Array.isArray(transactions)) {
|
if (Array.isArray(transactions)) {
|
||||||
transactions.forEach((transaction) => {
|
transactions.forEach((transaction) => {
|
||||||
if (typeof transaction.metamaskNetworkId === 'number') {
|
if (typeof transaction.metamaskNetworkId === 'number') {
|
||||||
transaction.metamaskNetworkId = transaction.metamaskNetworkId.toString();
|
transaction.metamaskNetworkId =
|
||||||
|
transaction.metamaskNetworkId.toString();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,8 @@ export default {
|
|||||||
|
|
||||||
function transformState(state = {}) {
|
function transformState(state = {}) {
|
||||||
if (state.PreferencesController) {
|
if (state.PreferencesController) {
|
||||||
const {
|
const { metaMetricsId, participateInMetaMetrics, metaMetricsSendCount } =
|
||||||
metaMetricsId,
|
state.PreferencesController;
|
||||||
participateInMetaMetrics,
|
|
||||||
metaMetricsSendCount,
|
|
||||||
} = state.PreferencesController;
|
|
||||||
state.MetaMetricsController = state.MetaMetricsController ?? {};
|
state.MetaMetricsController = state.MetaMetricsController ?? {};
|
||||||
|
|
||||||
if (metaMetricsId !== undefined) {
|
if (metaMetricsId !== undefined) {
|
||||||
@ -31,7 +28,8 @@ function transformState(state = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (participateInMetaMetrics !== undefined) {
|
if (participateInMetaMetrics !== undefined) {
|
||||||
state.MetaMetricsController.participateInMetaMetrics = participateInMetaMetrics;
|
state.MetaMetricsController.participateInMetaMetrics =
|
||||||
|
participateInMetaMetrics;
|
||||||
delete state.PreferencesController.participateInMetaMetrics;
|
delete state.PreferencesController.participateInMetaMetrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,11 +34,8 @@ export default {
|
|||||||
|
|
||||||
function transformState(state = {}) {
|
function transformState(state = {}) {
|
||||||
if (state.PreferencesController) {
|
if (state.PreferencesController) {
|
||||||
const {
|
const { accountTokens, accountHiddenTokens, frequentRpcListDetail } =
|
||||||
accountTokens,
|
state.PreferencesController;
|
||||||
accountHiddenTokens,
|
|
||||||
frequentRpcListDetail,
|
|
||||||
} = state.PreferencesController;
|
|
||||||
|
|
||||||
const newAccountTokens = {};
|
const newAccountTokens = {};
|
||||||
const newAccountHiddenTokens = {};
|
const newAccountHiddenTokens = {};
|
||||||
|
@ -23,13 +23,16 @@ function transformState(state) {
|
|||||||
if (
|
if (
|
||||||
state?.IncomingTransactionsController?.incomingTxLastFetchedBlocksByNetwork
|
state?.IncomingTransactionsController?.incomingTxLastFetchedBlocksByNetwork
|
||||||
) {
|
) {
|
||||||
state.IncomingTransactionsController.incomingTxLastFetchedBlockByChainId = mapKeys(
|
state.IncomingTransactionsController.incomingTxLastFetchedBlockByChainId =
|
||||||
state.IncomingTransactionsController.incomingTxLastFetchedBlocksByNetwork,
|
mapKeys(
|
||||||
// using optional chaining in case user's state has fetched blocks for
|
state.IncomingTransactionsController
|
||||||
// RPC network types (which don't map to a single chainId). This should
|
.incomingTxLastFetchedBlocksByNetwork,
|
||||||
// not be possible, but it's safer
|
// using optional chaining in case user's state has fetched blocks for
|
||||||
(_, key) => NETWORK_TYPE_TO_ID_MAP[key]?.chainId ?? UNKNOWN_CHAIN_ID_KEY,
|
// RPC network types (which don't map to a single chainId). This should
|
||||||
);
|
// not be possible, but it's safer
|
||||||
|
(_, key) =>
|
||||||
|
NETWORK_TYPE_TO_ID_MAP[key]?.chainId ?? UNKNOWN_CHAIN_ID_KEY,
|
||||||
|
);
|
||||||
// Now that mainnet and test net last fetched blocks are keyed by their
|
// Now that mainnet and test net last fetched blocks are keyed by their
|
||||||
// respective chainIds, we can safely delete anything we had for custom
|
// respective chainIds, we can safely delete anything we had for custom
|
||||||
// networks. Any custom network that shares a chainId with one of the
|
// networks. Any custom network that shares a chainId with one of the
|
||||||
|
@ -30,11 +30,10 @@ export default {
|
|||||||
PreferencesController.accountTokens[account],
|
PreferencesController.accountTokens[account],
|
||||||
);
|
);
|
||||||
chains.forEach((chain) => {
|
chains.forEach((chain) => {
|
||||||
PreferencesController.accountTokens[account][
|
PreferencesController.accountTokens[account][chain] =
|
||||||
chain
|
PreferencesController.accountTokens[account][chain].filter(
|
||||||
] = PreferencesController.accountTokens[account][chain].filter(
|
({ address }) => address,
|
||||||
({ address }) => address,
|
);
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -95,8 +95,7 @@ describe('migration #64', () => {
|
|||||||
s: '0x49f74084dd8c517b305a2e60b39ae9002176a5244cb06de8f9ea3757811f5ec6',
|
s: '0x49f74084dd8c517b305a2e60b39ae9002176a5244cb06de8f9ea3757811f5ec6',
|
||||||
status: 'confirmed',
|
status: 'confirmed',
|
||||||
estimatedBaseFee: 'b',
|
estimatedBaseFee: 'b',
|
||||||
hash:
|
hash: '0x4d8543f12afd3795b94d723dcd0e20bfc3740e1af668e5e90a0c5ec49f36ba12',
|
||||||
'0x4d8543f12afd3795b94d723dcd0e20bfc3740e1af668e5e90a0c5ec49f36ba12',
|
|
||||||
},
|
},
|
||||||
1: {
|
1: {
|
||||||
type: SENT_ETHER,
|
type: SENT_ETHER,
|
||||||
@ -118,8 +117,7 @@ describe('migration #64', () => {
|
|||||||
status: 'unapproved',
|
status: 'unapproved',
|
||||||
time: 1631118004776,
|
time: 1631118004776,
|
||||||
txParams: {
|
txParams: {
|
||||||
data:
|
data: '0x608060405234801561001057600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000808190555061023b806100686000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632e1a7d4d1461005c5780638da5cb5b1461009d578063d0e30db0146100f4575b600080fd5b34801561006857600080fd5b5061008760048036038101908080359060200190929190505050610112565b6040518082815260200191505060405180910390f35b3480156100a957600080fd5b506100b26101d0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100fc6101f6565b6040518082815260200191505060405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561017057600080fd5b8160008082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156101c5573d6000803e3d6000fd5b506000549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003460008082825401925050819055506000549050905600a165627a7a72305820f237db3ec816a52589d82512117bc85bc08d3537683ffeff9059108caf3e5d400029',
|
||||||
'0x608060405234801561001057600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000808190555061023b806100686000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632e1a7d4d1461005c5780638da5cb5b1461009d578063d0e30db0146100f4575b600080fd5b34801561006857600080fd5b5061008760048036038101908080359060200190929190505050610112565b6040518082815260200191505060405180910390f35b3480156100a957600080fd5b506100b26101d0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100fc6101f6565b6040518082815260200191505060405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561017057600080fd5b8160008082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156101c5573d6000803e3d6000fd5b506000549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003460008082825401925050819055506000549050905600a165627a7a72305820f237db3ec816a52589d82512117bc85bc08d3537683ffeff9059108caf3e5d400029',
|
|
||||||
from: '0x0f002c95c041f003be01c3e4f52cae1f6ab3ba6e',
|
from: '0x0f002c95c041f003be01c3e4f52cae1f6ab3ba6e',
|
||||||
gas: '0x31413',
|
gas: '0x31413',
|
||||||
value: '0x0',
|
value: '0x0',
|
||||||
@ -159,8 +157,7 @@ describe('migration #64', () => {
|
|||||||
gas: '0xa9fe',
|
gas: '0xa9fe',
|
||||||
},
|
},
|
||||||
estimatedBaseFee: 'b',
|
estimatedBaseFee: 'b',
|
||||||
hash:
|
hash: '0x19ffab8a9467df9afbef82d8907f9e39f0696c7a774ed5473ecf7337adcc674b',
|
||||||
'0x19ffab8a9467df9afbef82d8907f9e39f0696c7a774ed5473ecf7337adcc674b',
|
|
||||||
origin: 'https://metamask.github.io',
|
origin: 'https://metamask.github.io',
|
||||||
r: '0xc2b2901f3593536d21e9b136c469b9b8f91a944f18a29a3cdf3a2eaadf660e71',
|
r: '0xc2b2901f3593536d21e9b136c469b9b8f91a944f18a29a3cdf3a2eaadf660e71',
|
||||||
rawTx:
|
rawTx:
|
||||||
@ -277,8 +274,7 @@ describe('migration #64', () => {
|
|||||||
s: '0x49f74084dd8c517b305a2e60b39ae9002176a5244cb06de8f9ea3757811f5ec6',
|
s: '0x49f74084dd8c517b305a2e60b39ae9002176a5244cb06de8f9ea3757811f5ec6',
|
||||||
status: 'confirmed',
|
status: 'confirmed',
|
||||||
estimatedBaseFee: 'b',
|
estimatedBaseFee: 'b',
|
||||||
hash:
|
hash: '0x4d8543f12afd3795b94d723dcd0e20bfc3740e1af668e5e90a0c5ec49f36ba12',
|
||||||
'0x4d8543f12afd3795b94d723dcd0e20bfc3740e1af668e5e90a0c5ec49f36ba12',
|
|
||||||
},
|
},
|
||||||
1: {
|
1: {
|
||||||
type: TRANSACTION_TYPES.SIMPLE_SEND,
|
type: TRANSACTION_TYPES.SIMPLE_SEND,
|
||||||
@ -300,8 +296,7 @@ describe('migration #64', () => {
|
|||||||
status: 'unapproved',
|
status: 'unapproved',
|
||||||
time: 1631118004776,
|
time: 1631118004776,
|
||||||
txParams: {
|
txParams: {
|
||||||
data:
|
data: '0x608060405234801561001057600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000808190555061023b806100686000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632e1a7d4d1461005c5780638da5cb5b1461009d578063d0e30db0146100f4575b600080fd5b34801561006857600080fd5b5061008760048036038101908080359060200190929190505050610112565b6040518082815260200191505060405180910390f35b3480156100a957600080fd5b506100b26101d0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100fc6101f6565b6040518082815260200191505060405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561017057600080fd5b8160008082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156101c5573d6000803e3d6000fd5b506000549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003460008082825401925050819055506000549050905600a165627a7a72305820f237db3ec816a52589d82512117bc85bc08d3537683ffeff9059108caf3e5d400029',
|
||||||
'0x608060405234801561001057600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000808190555061023b806100686000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632e1a7d4d1461005c5780638da5cb5b1461009d578063d0e30db0146100f4575b600080fd5b34801561006857600080fd5b5061008760048036038101908080359060200190929190505050610112565b6040518082815260200191505060405180910390f35b3480156100a957600080fd5b506100b26101d0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100fc6101f6565b6040518082815260200191505060405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561017057600080fd5b8160008082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156101c5573d6000803e3d6000fd5b506000549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003460008082825401925050819055506000549050905600a165627a7a72305820f237db3ec816a52589d82512117bc85bc08d3537683ffeff9059108caf3e5d400029',
|
|
||||||
from: '0x0f002c95c041f003be01c3e4f52cae1f6ab3ba6e',
|
from: '0x0f002c95c041f003be01c3e4f52cae1f6ab3ba6e',
|
||||||
gas: '0x31413',
|
gas: '0x31413',
|
||||||
value: '0x0',
|
value: '0x0',
|
||||||
@ -341,8 +336,7 @@ describe('migration #64', () => {
|
|||||||
gas: '0xa9fe',
|
gas: '0xa9fe',
|
||||||
},
|
},
|
||||||
estimatedBaseFee: 'b',
|
estimatedBaseFee: 'b',
|
||||||
hash:
|
hash: '0x19ffab8a9467df9afbef82d8907f9e39f0696c7a774ed5473ecf7337adcc674b',
|
||||||
'0x19ffab8a9467df9afbef82d8907f9e39f0696c7a774ed5473ecf7337adcc674b',
|
|
||||||
origin: 'https://metamask.github.io',
|
origin: 'https://metamask.github.io',
|
||||||
r: '0xc2b2901f3593536d21e9b136c469b9b8f91a944f18a29a3cdf3a2eaadf660e71',
|
r: '0xc2b2901f3593536d21e9b136c469b9b8f91a944f18a29a3cdf3a2eaadf660e71',
|
||||||
rawTx:
|
rawTx:
|
||||||
|
@ -19,10 +19,8 @@ export default {
|
|||||||
|
|
||||||
function transformState(state) {
|
function transformState(state) {
|
||||||
if (state.PreferencesController) {
|
if (state.PreferencesController) {
|
||||||
const {
|
const { completedOnboarding, firstTimeFlowType } =
|
||||||
completedOnboarding,
|
state.PreferencesController;
|
||||||
firstTimeFlowType,
|
|
||||||
} = state.PreferencesController;
|
|
||||||
state.OnboardingController = state.OnboardingController ?? {};
|
state.OnboardingController = state.OnboardingController ?? {};
|
||||||
|
|
||||||
if (completedOnboarding !== undefined) {
|
if (completedOnboarding !== undefined) {
|
||||||
|
@ -36,14 +36,13 @@ function transformState(state) {
|
|||||||
const cachedBalances = state.CachedBalancesController?.cachedBalances || {};
|
const cachedBalances = state.CachedBalancesController?.cachedBalances || {};
|
||||||
|
|
||||||
const userIsCurrentlyOnATestNet = TEST_CHAINS.includes(provider?.chainId);
|
const userIsCurrentlyOnATestNet = TEST_CHAINS.includes(provider?.chainId);
|
||||||
const userHasMadeATestNetTransaction = Object.values(
|
const userHasMadeATestNetTransaction = Object.values(transactions).some(
|
||||||
transactions,
|
({ chainId }) => TEST_CHAINS.includes(chainId),
|
||||||
).some(({ chainId }) => TEST_CHAINS.includes(chainId));
|
);
|
||||||
const userHasACachedBalanceOnATestnet = TEST_CHAINS.some((chainId) => {
|
const userHasACachedBalanceOnATestnet = TEST_CHAINS.some((chainId) => {
|
||||||
const cachedBalancesForChain = Object.values(cachedBalances[chainId] || {});
|
const cachedBalancesForChain = Object.values(cachedBalances[chainId] || {});
|
||||||
const userHasABalanceGreaterThanZeroOnThisChain = cachedBalancesForChain.some(
|
const userHasABalanceGreaterThanZeroOnThisChain =
|
||||||
hexNumberIsGreaterThanZero,
|
cachedBalancesForChain.some(hexNumberIsGreaterThanZero);
|
||||||
);
|
|
||||||
return userHasABalanceGreaterThanZeroOnThisChain;
|
return userHasABalanceGreaterThanZeroOnThisChain;
|
||||||
});
|
});
|
||||||
const userHasUsedATestnet =
|
const userHasUsedATestnet =
|
||||||
|
@ -38,9 +38,8 @@ function transformState(state) {
|
|||||||
permissionActivityLog: permissionsLog,
|
permissionActivityLog: permissionsLog,
|
||||||
permissionHistory: permissionsHistory,
|
permissionHistory: permissionsHistory,
|
||||||
},
|
},
|
||||||
SubjectMetadataController: getSubjectMetadataControllerState(
|
SubjectMetadataController:
|
||||||
domainMetadata,
|
getSubjectMetadataControllerState(domainMetadata),
|
||||||
),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,10 +119,8 @@ describe('migration #68', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const newStorage = await migration68.migrate(oldStorage);
|
const newStorage = await migration68.migrate(oldStorage);
|
||||||
const {
|
const { PermissionLogController, SubjectMetadataController } =
|
||||||
PermissionLogController,
|
newStorage.data;
|
||||||
SubjectMetadataController,
|
|
||||||
} = newStorage.data;
|
|
||||||
const expected = getOldState().PermissionsMetadata;
|
const expected = getOldState().PermissionsMetadata;
|
||||||
|
|
||||||
expect(PermissionLogController.permissionHistory).toStrictEqual(
|
expect(PermissionLogController.permissionHistory).toStrictEqual(
|
||||||
|
@ -80,10 +80,8 @@ export default class ExtensionPlatform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getVersion() {
|
getVersion() {
|
||||||
const {
|
const { version, version_name: versionName } =
|
||||||
version,
|
browser.runtime.getManifest();
|
||||||
version_name: versionName,
|
|
||||||
} = browser.runtime.getManifest();
|
|
||||||
|
|
||||||
const versionParts = version.split('.');
|
const versionParts = version.split('.');
|
||||||
if (versionName) {
|
if (versionName) {
|
||||||
|
@ -320,9 +320,8 @@ function removeFencedCode(filePath, typeOfCurrentBuild, fileContent) {
|
|||||||
let currentCommand;
|
let currentCommand;
|
||||||
|
|
||||||
for (let i = 0; i < parsedDirectives.length; i++) {
|
for (let i = 0; i < parsedDirectives.length; i++) {
|
||||||
const { line, indices, terminus, command, parameters } = parsedDirectives[
|
const { line, indices, terminus, command, parameters } =
|
||||||
i
|
parsedDirectives[i];
|
||||||
];
|
|
||||||
if (i % 2 === 0) {
|
if (i % 2 === 0) {
|
||||||
if (terminus !== DirectiveTerminuses.BEGIN) {
|
if (terminus !== DirectiveTerminuses.BEGIN) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@ -368,9 +367,8 @@ function removeFencedCode(filePath, typeOfCurrentBuild, fileContent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Forbid empty fences
|
// Forbid empty fences
|
||||||
const { line: previousLine, indices: previousIndices } = parsedDirectives[
|
const { line: previousLine, indices: previousIndices } =
|
||||||
i - 1
|
parsedDirectives[i - 1];
|
||||||
];
|
|
||||||
if (fileContent.substring(previousIndices[1], indices[0]).trim() === '') {
|
if (fileContent.substring(previousIndices[1], indices[0]).trim() === '') {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Empty fence found in file "${filePath}":\n${previousLine}\n${line}\n`,
|
`Empty fence found in file "${filePath}":\n${previousLine}\n${line}\n`,
|
||||||
|
@ -289,9 +289,8 @@ describe('build/transforms/remove-fenced-code', () => {
|
|||||||
),
|
),
|
||||||
).toStrictEqual([ignoredLine, true]);
|
).toStrictEqual([ignoredLine, true]);
|
||||||
|
|
||||||
const modifiedInputWithoutFences = testData.validInputs.withoutFences.concat(
|
const modifiedInputWithoutFences =
|
||||||
ignoredLine,
|
testData.validInputs.withoutFences.concat(ignoredLine);
|
||||||
);
|
|
||||||
|
|
||||||
// These inputs will not be transformed
|
// These inputs will not be transformed
|
||||||
expect(
|
expect(
|
||||||
|
@ -183,7 +183,8 @@ async function verifyEnglishLocale() {
|
|||||||
ignore: [testGlob],
|
ignore: [testGlob],
|
||||||
});
|
});
|
||||||
|
|
||||||
const strictSearchRegex = /\bt\(\s*'(\w+)'\s*\)|\btranslationKey:\s*'(\w+)'/gu;
|
const strictSearchRegex =
|
||||||
|
/\bt\(\s*'(\w+)'\s*\)|\btranslationKey:\s*'(\w+)'/gu;
|
||||||
// match "t(`...`)" because constructing message keys from template strings
|
// match "t(`...`)" because constructing message keys from template strings
|
||||||
// prevents this script from finding the messages, and then inappropriately
|
// prevents this script from finding the messages, and then inappropriately
|
||||||
// deletes them
|
// deletes them
|
||||||
|
@ -296,7 +296,7 @@
|
|||||||
"enzyme": "^3.10.0",
|
"enzyme": "^3.10.0",
|
||||||
"enzyme-adapter-react-16": "^1.15.1",
|
"enzyme-adapter-react-16": "^1.15.1",
|
||||||
"eslint": "^8.20.0",
|
"eslint": "^8.20.0",
|
||||||
"eslint-config-prettier": "^8.1.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-import-resolver-node": "^0.3.4",
|
"eslint-import-resolver-node": "^0.3.4",
|
||||||
"eslint-import-resolver-typescript": "^2.5.0",
|
"eslint-import-resolver-typescript": "^2.5.0",
|
||||||
"eslint-plugin-import": "^2.22.1",
|
"eslint-plugin-import": "^2.22.1",
|
||||||
@ -304,7 +304,7 @@
|
|||||||
"eslint-plugin-jsdoc": "^39.3.3",
|
"eslint-plugin-jsdoc": "^39.3.3",
|
||||||
"eslint-plugin-mocha": "^8.1.0",
|
"eslint-plugin-mocha": "^8.1.0",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"eslint-plugin-prettier": "^3.3.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"eslint-plugin-react": "^7.23.1",
|
"eslint-plugin-react": "^7.23.1",
|
||||||
"eslint-plugin-react-hooks": "^4.2.0",
|
"eslint-plugin-react-hooks": "^4.2.0",
|
||||||
"fancy-log": "^1.3.3",
|
"fancy-log": "^1.3.3",
|
||||||
@ -343,7 +343,7 @@
|
|||||||
"nyc": "^15.0.0",
|
"nyc": "^15.0.0",
|
||||||
"patch-package": "^6.4.7",
|
"patch-package": "^6.4.7",
|
||||||
"polyfill-crypto.getrandomvalues": "^1.0.0",
|
"polyfill-crypto.getrandomvalues": "^1.0.0",
|
||||||
"prettier": "^2.2.1",
|
"prettier": "^2.7.1",
|
||||||
"prettier-plugin-sort-json": "^0.0.1",
|
"prettier-plugin-sort-json": "^0.0.1",
|
||||||
"proxyquire": "^2.1.3",
|
"proxyquire": "^2.1.3",
|
||||||
"pumpify": "^2.0.1",
|
"pumpify": "^2.0.1",
|
||||||
|
@ -5,9 +5,9 @@ import contractMap from '@metamask/contract-metadata';
|
|||||||
* `@metamask/contract-metadata`. Used primarily to validate if manually entered
|
* `@metamask/contract-metadata`. Used primarily to validate if manually entered
|
||||||
* contract addresses do not match one of our listed tokens
|
* contract addresses do not match one of our listed tokens
|
||||||
*/
|
*/
|
||||||
export const LISTED_CONTRACT_ADDRESSES = Object.keys(
|
export const LISTED_CONTRACT_ADDRESSES = Object.keys(contractMap).map(
|
||||||
contractMap,
|
(address) => address.toLowerCase(),
|
||||||
).map((address) => address.toLowerCase());
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {object} TokenDetails
|
* @typedef {object} TokenDetails
|
||||||
|
@ -19,12 +19,11 @@ describe('Contract Utils', () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
const { isContractAddress: isNotContractAddress } =
|
||||||
isContractAddress: isNotContractAddress,
|
await readAddressAsContract(
|
||||||
} = await readAddressAsContract(
|
mockEthQuery,
|
||||||
mockEthQuery,
|
'0x76B4aa9Fc4d351a0062c6af8d186DF959D564A84',
|
||||||
'0x76B4aa9Fc4d351a0062c6af8d186DF959D564A84',
|
);
|
||||||
);
|
|
||||||
expect(isNotContractAddress).toStrictEqual(false);
|
expect(isNotContractAddress).toStrictEqual(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -157,10 +157,8 @@ export async function determineTransactionType(txParams, query) {
|
|||||||
if (data && !to) {
|
if (data && !to) {
|
||||||
result = TRANSACTION_TYPES.DEPLOY_CONTRACT;
|
result = TRANSACTION_TYPES.DEPLOY_CONTRACT;
|
||||||
} else {
|
} else {
|
||||||
const {
|
const { contractCode: resultCode, isContractAddress } =
|
||||||
contractCode: resultCode,
|
await readAddressAsContract(query, to);
|
||||||
isContractAddress,
|
|
||||||
} = await readAddressAsContract(query, to);
|
|
||||||
|
|
||||||
contractCode = resultCode;
|
contractCode = resultCode;
|
||||||
|
|
||||||
|
@ -149,8 +149,7 @@ describe('Transaction.utils', function () {
|
|||||||
const result = await determineTransactionType(
|
const result = await determineTransactionType(
|
||||||
{
|
{
|
||||||
to: '0x9e673399f795D01116e9A8B2dD2F156705131ee9',
|
to: '0x9e673399f795D01116e9A8B2dD2F156705131ee9',
|
||||||
data:
|
data: '0xa9059cbb0000000000000000000000002f318C334780961FB129D2a6c30D0763d9a5C970000000000000000000000000000000000000000000000000000000000000000a',
|
||||||
'0xa9059cbb0000000000000000000000002f318C334780961FB129D2a6c30D0763d9a5C970000000000000000000000000000000000000000000000000000000000000000a',
|
|
||||||
},
|
},
|
||||||
new EthQuery(_provider),
|
new EthQuery(_provider),
|
||||||
);
|
);
|
||||||
@ -174,8 +173,7 @@ describe('Transaction.utils', function () {
|
|||||||
const result = await determineTransactionType(
|
const result = await determineTransactionType(
|
||||||
{
|
{
|
||||||
to: '0x9e673399f795D01116e9A8B2dD2F156705131ee9',
|
to: '0x9e673399f795D01116e9A8B2dD2F156705131ee9',
|
||||||
data:
|
data: '0xa9059cbb0000000000000000000000002f318C334780961FB129D2a6c30D0763d9a5C970000000000000000000000000000000000000000000000000000000000000000a',
|
||||||
'0xa9059cbb0000000000000000000000002f318C334780961FB129D2a6c30D0763d9a5C970000000000000000000000000000000000000000000000000000000000000000a',
|
|
||||||
},
|
},
|
||||||
new EthQuery(_provider),
|
new EthQuery(_provider),
|
||||||
);
|
);
|
||||||
@ -199,8 +197,7 @@ describe('Transaction.utils', function () {
|
|||||||
const result = await determineTransactionType(
|
const result = await determineTransactionType(
|
||||||
{
|
{
|
||||||
to: '0x9e673399f795D01116e9A8B2dD2F156705131ee9',
|
to: '0x9e673399f795D01116e9A8B2dD2F156705131ee9',
|
||||||
data:
|
data: '0x095ea7b30000000000000000000000002f318C334780961FB129D2a6c30D0763d9a5C9700000000000000000000000000000000000000000000000000000000000000005',
|
||||||
'0x095ea7b30000000000000000000000002f318C334780961FB129D2a6c30D0763d9a5C9700000000000000000000000000000000000000000000000000000000000000005',
|
|
||||||
},
|
},
|
||||||
new EthQuery(_provider),
|
new EthQuery(_provider),
|
||||||
);
|
);
|
||||||
|
@ -405,8 +405,7 @@ describe('MetaMask', function () {
|
|||||||
it('finds the transaction in the transactions list', async function () {
|
it('finds the transaction in the transactions list', async function () {
|
||||||
await driver.waitForSelector(
|
await driver.waitForSelector(
|
||||||
{
|
{
|
||||||
css:
|
css: '.transaction-list__completed-transactions .transaction-list-item__primary-currency',
|
||||||
'.transaction-list__completed-transactions .transaction-list-item__primary-currency',
|
|
||||||
text: '-1 TST',
|
text: '-1 TST',
|
||||||
},
|
},
|
||||||
{ timeout: 10000 },
|
{ timeout: 10000 },
|
||||||
@ -488,8 +487,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
it('finds the transaction in the transactions list', async function () {
|
it('finds the transaction in the transactions list', async function () {
|
||||||
await driver.waitForSelector({
|
await driver.waitForSelector({
|
||||||
css:
|
css: '.transaction-list__completed-transactions .transaction-list-item__primary-currency',
|
||||||
'.transaction-list__completed-transactions .transaction-list-item__primary-currency',
|
|
||||||
text: '-1.5 TST',
|
text: '-1.5 TST',
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -545,8 +543,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
await driver.waitForSelector({
|
await driver.waitForSelector({
|
||||||
// Selects only the very first transaction list item immediately following the 'Pending' header
|
// Selects only the very first transaction list item immediately following the 'Pending' header
|
||||||
css:
|
css: '.transaction-list__pending-transactions .transaction-list__header + .transaction-list-item .list-item__heading',
|
||||||
'.transaction-list__pending-transactions .transaction-list__header + .transaction-list-item .list-item__heading',
|
|
||||||
text: 'Approve TST spend limit',
|
text: 'Approve TST spend limit',
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -638,8 +635,7 @@ describe('MetaMask', function () {
|
|||||||
it('finds the transaction in the transactions list', async function () {
|
it('finds the transaction in the transactions list', async function () {
|
||||||
await driver.waitForSelector({
|
await driver.waitForSelector({
|
||||||
// Select only the heading of the first entry in the transaction list.
|
// Select only the heading of the first entry in the transaction list.
|
||||||
css:
|
css: '.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
||||||
'.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
|
||||||
text: 'Approve TST spend limit',
|
text: 'Approve TST spend limit',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -691,14 +687,12 @@ describe('MetaMask', function () {
|
|||||||
await driver.waitForSelector({
|
await driver.waitForSelector({
|
||||||
// Select the heading of the first transaction list item in the
|
// Select the heading of the first transaction list item in the
|
||||||
// completed transaction list with text matching Send TST
|
// completed transaction list with text matching Send TST
|
||||||
css:
|
css: '.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
||||||
'.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
|
||||||
text: 'Send TST',
|
text: 'Send TST',
|
||||||
});
|
});
|
||||||
|
|
||||||
await driver.waitForSelector({
|
await driver.waitForSelector({
|
||||||
css:
|
css: '.transaction-list__completed-transactions .transaction-list-item:first-child .transaction-list-item__primary-currency',
|
||||||
'.transaction-list__completed-transactions .transaction-list-item:first-child .transaction-list-item__primary-currency',
|
|
||||||
text: '-1.5 TST',
|
text: '-1.5 TST',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -735,8 +729,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
await driver.waitForSelector({
|
await driver.waitForSelector({
|
||||||
// Selects only the very first transaction list item immediately following the 'Pending' header
|
// Selects only the very first transaction list item immediately following the 'Pending' header
|
||||||
css:
|
css: '.transaction-list__pending-transactions .transaction-list__header + .transaction-list-item .list-item__heading',
|
||||||
'.transaction-list__pending-transactions .transaction-list__header + .transaction-list-item .list-item__heading',
|
|
||||||
text: 'Approve TST spend limit',
|
text: 'Approve TST spend limit',
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -760,8 +753,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
it('finds the transaction in the transactions list', async function () {
|
it('finds the transaction in the transactions list', async function () {
|
||||||
await driver.waitForSelector({
|
await driver.waitForSelector({
|
||||||
css:
|
css: '.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
||||||
'.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
|
||||||
text: 'Approve TST spend limit',
|
text: 'Approve TST spend limit',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -39,11 +39,8 @@ describe('Chain Interactions', function () {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// verify chain details
|
// verify chain details
|
||||||
const [
|
const [networkName, networkUrl, chainIdElement] =
|
||||||
networkName,
|
await driver.findElements('.definition-list dd');
|
||||||
networkUrl,
|
|
||||||
chainIdElement,
|
|
||||||
] = await driver.findElements('.definition-list dd');
|
|
||||||
assert.equal(await networkName.getText(), `Localhost ${port}`);
|
assert.equal(await networkName.getText(), `Localhost ${port}`);
|
||||||
assert.equal(await networkUrl.getText(), `http://127.0.0.1:${port}`);
|
assert.equal(await networkUrl.getText(), `http://127.0.0.1:${port}`);
|
||||||
assert.equal(await chainIdElement.getText(), chainId.toString());
|
assert.equal(await chainIdElement.getText(), chainId.toString());
|
||||||
|
@ -132,8 +132,7 @@ describe('Stores custom RPC history', function () {
|
|||||||
await chainIdInput.clear();
|
await chainIdInput.clear();
|
||||||
await chainIdInput.sendKeys(duplicateChainId);
|
await chainIdInput.sendKeys(duplicateChainId);
|
||||||
await driver.findElement({
|
await driver.findElement({
|
||||||
text:
|
text: 'This Chain ID is currently used by the Localhost 8545 network.',
|
||||||
'This Chain ID is currently used by the Localhost 8545 network.',
|
|
||||||
tag: 'h6',
|
tag: 'h6',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -171,8 +171,7 @@ describe.skip('Create token, approve token and approve token without gas', funct
|
|||||||
|
|
||||||
await driver.waitForSelector({
|
await driver.waitForSelector({
|
||||||
// Selects only the very first transaction list item immediately following the 'Pending' header
|
// Selects only the very first transaction list item immediately following the 'Pending' header
|
||||||
css:
|
css: '.transaction-list__pending-transactions .transaction-list__header + .transaction-list-item .list-item__heading',
|
||||||
'.transaction-list__pending-transactions .transaction-list__header + .transaction-list-item .list-item__heading',
|
|
||||||
text: 'Approve Token spend limit',
|
text: 'Approve Token spend limit',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -230,8 +229,7 @@ describe.skip('Create token, approve token and approve token without gas', funct
|
|||||||
await driver.clickElement({ text: 'Save', tag: 'button' });
|
await driver.clickElement({ text: 'Save', tag: 'button' });
|
||||||
|
|
||||||
await driver.waitForSelector({
|
await driver.waitForSelector({
|
||||||
css:
|
css: '.confirm-approve-content__transaction-details-content__secondary-fee',
|
||||||
'.confirm-approve-content__transaction-details-content__secondary-fee',
|
|
||||||
text: '0.0006 ETH',
|
text: '0.0006 ETH',
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -269,8 +267,7 @@ describe.skip('Create token, approve token and approve token without gas', funct
|
|||||||
await driver.clickElement({ tag: 'button', text: 'Activity' });
|
await driver.clickElement({ tag: 'button', text: 'Activity' });
|
||||||
await driver.waitForSelector({
|
await driver.waitForSelector({
|
||||||
// Select only the heading of the first entry in the transaction list.
|
// Select only the heading of the first entry in the transaction list.
|
||||||
css:
|
css: '.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
||||||
'.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
|
||||||
text: 'Approve Token spend limit',
|
text: 'Approve Token spend limit',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -331,8 +328,7 @@ describe.skip('Create token, approve token and approve token without gas', funct
|
|||||||
|
|
||||||
await driver.waitForSelector({
|
await driver.waitForSelector({
|
||||||
// Selects only the very first transaction list item immediately following the 'Pending' header
|
// Selects only the very first transaction list item immediately following the 'Pending' header
|
||||||
css:
|
css: '.transaction-list__pending-transactions .transaction-list__header + .transaction-list-item .list-item__heading',
|
||||||
'.transaction-list__pending-transactions .transaction-list__header + .transaction-list-item .list-item__heading',
|
|
||||||
text: 'Approve Token spend limit',
|
text: 'Approve Token spend limit',
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -347,8 +343,7 @@ describe.skip('Create token, approve token and approve token without gas', funct
|
|||||||
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
||||||
|
|
||||||
await driver.waitForSelector({
|
await driver.waitForSelector({
|
||||||
css:
|
css: '.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
||||||
'.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
|
||||||
text: 'Approve Token spend limit',
|
text: 'Approve Token spend limit',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -58,14 +58,13 @@ const AddNetwork = () => {
|
|||||||
const [showPopover, setShowPopover] = useState(false);
|
const [showPopover, setShowPopover] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const anAddNetworkConfirmationFromMetaMaskExists = unapprovedConfirmations?.find(
|
const anAddNetworkConfirmationFromMetaMaskExists =
|
||||||
(confirmation) => {
|
unapprovedConfirmations?.find((confirmation) => {
|
||||||
return (
|
return (
|
||||||
confirmation.origin === 'metamask' &&
|
confirmation.origin === 'metamask' &&
|
||||||
confirmation.type === MESSAGE_TYPE.ADD_ETHEREUM_CHAIN
|
confirmation.type === MESSAGE_TYPE.ADD_ETHEREUM_CHAIN
|
||||||
);
|
);
|
||||||
},
|
});
|
||||||
);
|
|
||||||
if (!showPopover && anAddNetworkConfirmationFromMetaMaskExists) {
|
if (!showPopover && anAddNetworkConfirmationFromMetaMaskExists) {
|
||||||
setShowPopover(true);
|
setShowPopover(true);
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,8 @@ import { useI18nContext } from '../../../../hooks/useI18nContext';
|
|||||||
const AdvancedGasFeeDefaults = () => {
|
const AdvancedGasFeeDefaults = () => {
|
||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const {
|
const { gasErrors, maxBaseFee, maxPriorityFeePerGas } =
|
||||||
gasErrors,
|
useAdvancedGasFeePopoverContext();
|
||||||
maxBaseFee,
|
|
||||||
maxPriorityFeePerGas,
|
|
||||||
} = useAdvancedGasFeePopoverContext();
|
|
||||||
const advancedGasFeeValues = useSelector(getAdvancedGasFeeValues);
|
const advancedGasFeeValues = useSelector(getAdvancedGasFeeValues);
|
||||||
const { updateTransactionEventFragment } = useTransactionEventFragment();
|
const { updateTransactionEventFragment } = useTransactionEventFragment();
|
||||||
const { editGasMode } = useGasFeeContext();
|
const { editGasMode } = useGasFeeContext();
|
||||||
|
@ -20,14 +20,10 @@ const validateGasLimit = (gasLimit, minimumGasLimitDec) => {
|
|||||||
|
|
||||||
const AdvancedGasFeeGasLimit = () => {
|
const AdvancedGasFeeGasLimit = () => {
|
||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
const {
|
const { setGasLimit: setGasLimitInContext, setErrorValue } =
|
||||||
setGasLimit: setGasLimitInContext,
|
useAdvancedGasFeePopoverContext();
|
||||||
setErrorValue,
|
const { gasLimit: gasLimitInTransaction, minimumGasLimitDec } =
|
||||||
} = useAdvancedGasFeePopoverContext();
|
useGasFeeContext();
|
||||||
const {
|
|
||||||
gasLimit: gasLimitInTransaction,
|
|
||||||
minimumGasLimitDec,
|
|
||||||
} = useGasFeeContext();
|
|
||||||
const [isEditing, setEditing] = useState(false);
|
const [isEditing, setEditing] = useState(false);
|
||||||
const [gasLimit, setGasLimit] = useState(gasLimitInTransaction);
|
const [gasLimit, setGasLimit] = useState(gasLimitInTransaction);
|
||||||
const [gasLimitError, setGasLimitError] = useState();
|
const [gasLimitError, setGasLimitError] = useState();
|
||||||
|
@ -45,12 +45,8 @@ const validateBaseFee = (value, gasFeeEstimates, maxPriorityFeePerGas) => {
|
|||||||
const BaseFeeInput = () => {
|
const BaseFeeInput = () => {
|
||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
|
|
||||||
const {
|
const { gasFeeEstimates, estimateUsed, maxFeePerGas, editGasMode } =
|
||||||
gasFeeEstimates,
|
useGasFeeContext();
|
||||||
estimateUsed,
|
|
||||||
maxFeePerGas,
|
|
||||||
editGasMode,
|
|
||||||
} = useGasFeeContext();
|
|
||||||
const {
|
const {
|
||||||
gasLimit,
|
gasLimit,
|
||||||
maxPriorityFeePerGas,
|
maxPriorityFeePerGas,
|
||||||
@ -59,11 +55,8 @@ const BaseFeeInput = () => {
|
|||||||
setMaxBaseFee,
|
setMaxBaseFee,
|
||||||
} = useAdvancedGasFeePopoverContext();
|
} = useAdvancedGasFeePopoverContext();
|
||||||
|
|
||||||
const {
|
const { estimatedBaseFee, historicalBaseFeeRange, baseFeeTrend } =
|
||||||
estimatedBaseFee,
|
gasFeeEstimates;
|
||||||
historicalBaseFeeRange,
|
|
||||||
baseFeeTrend,
|
|
||||||
} = gasFeeEstimates;
|
|
||||||
const [baseFeeError, setBaseFeeError] = useState();
|
const [baseFeeError, setBaseFeeError] = useState();
|
||||||
const { currency, numberOfDecimals } = useUserPreferencedCurrency(PRIMARY);
|
const { currency, numberOfDecimals } = useUserPreferencedCurrency(PRIMARY);
|
||||||
|
|
||||||
|
@ -46,17 +46,10 @@ const validatePriorityFee = (value, gasFeeEstimates) => {
|
|||||||
const PriorityFeeInput = () => {
|
const PriorityFeeInput = () => {
|
||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
const advancedGasFeeValues = useSelector(getAdvancedGasFeeValues);
|
const advancedGasFeeValues = useSelector(getAdvancedGasFeeValues);
|
||||||
const {
|
const { gasLimit, setErrorValue, setMaxPriorityFeePerGas } =
|
||||||
gasLimit,
|
useAdvancedGasFeePopoverContext();
|
||||||
setErrorValue,
|
const { editGasMode, estimateUsed, gasFeeEstimates, maxPriorityFeePerGas } =
|
||||||
setMaxPriorityFeePerGas,
|
useGasFeeContext();
|
||||||
} = useAdvancedGasFeePopoverContext();
|
|
||||||
const {
|
|
||||||
editGasMode,
|
|
||||||
estimateUsed,
|
|
||||||
gasFeeEstimates,
|
|
||||||
maxPriorityFeePerGas,
|
|
||||||
} = useGasFeeContext();
|
|
||||||
const {
|
const {
|
||||||
latestPriorityFeeRange,
|
latestPriorityFeeRange,
|
||||||
historicalPriorityFeeRange,
|
historicalPriorityFeeRange,
|
||||||
|
@ -15,12 +15,8 @@ const AdvancedGasFeeSaveButton = () => {
|
|||||||
const { updateTransactionEventFragment } = useTransactionEventFragment();
|
const { updateTransactionEventFragment } = useTransactionEventFragment();
|
||||||
const { updateTransaction } = useGasFeeContext();
|
const { updateTransaction } = useGasFeeContext();
|
||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
const {
|
const { gasLimit, hasErrors, maxFeePerGas, maxPriorityFeePerGas } =
|
||||||
gasLimit,
|
useAdvancedGasFeePopoverContext();
|
||||||
hasErrors,
|
|
||||||
maxFeePerGas,
|
|
||||||
maxPriorityFeePerGas,
|
|
||||||
} = useAdvancedGasFeePopoverContext();
|
|
||||||
|
|
||||||
const onSave = () => {
|
const onSave = () => {
|
||||||
updateTransaction({
|
updateTransaction({
|
||||||
|
@ -57,13 +57,11 @@ const AssetList = ({ onClickAsset }) => {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const [
|
const [secondaryCurrencyDisplay, secondaryCurrencyProperties] =
|
||||||
secondaryCurrencyDisplay,
|
useCurrencyDisplay(selectedAccountBalance, {
|
||||||
secondaryCurrencyProperties,
|
numberOfDecimals: secondaryNumberOfDecimals,
|
||||||
] = useCurrencyDisplay(selectedAccountBalance, {
|
currency: secondaryCurrency,
|
||||||
numberOfDecimals: secondaryNumberOfDecimals,
|
});
|
||||||
currency: secondaryCurrency,
|
|
||||||
});
|
|
||||||
|
|
||||||
const primaryTokenImage = useSelector(getNativeCurrencyImage);
|
const primaryTokenImage = useSelector(getNativeCurrencyImage);
|
||||||
const detectedTokens = useSelector(getDetectedTokensInCurrentNetwork) || [];
|
const detectedTokens = useSelector(getDetectedTokensInCurrentNetwork) || [];
|
||||||
|
@ -36,7 +36,8 @@ export default function CancelButton({
|
|||||||
type="secondary"
|
type="secondary"
|
||||||
className={classnames({
|
className={classnames({
|
||||||
'transaction-list-item__header-button': !detailsModal,
|
'transaction-list-item__header-button': !detailsModal,
|
||||||
'transaction-list-item-details__header-button-rounded-button': detailsModal,
|
'transaction-list-item-details__header-button-rounded-button':
|
||||||
|
detailsModal,
|
||||||
})}
|
})}
|
||||||
disabled={!hasEnoughCancelGas}
|
disabled={!hasEnoughCancelGas}
|
||||||
>
|
>
|
||||||
|
@ -24,10 +24,8 @@ const MAXGASCOST_ABOVE_MOCK_MEDIUM_BN = new BigNumber(
|
|||||||
MAXFEEPERGAS_ABOVE_MOCK_MEDIUM_HEX,
|
MAXFEEPERGAS_ABOVE_MOCK_MEDIUM_HEX,
|
||||||
16,
|
16,
|
||||||
).times(21000, 10);
|
).times(21000, 10);
|
||||||
const MAXGASCOST_ABOVE_MOCK_MEDIUM_BN_PLUS_TEN_PCT_HEX = MAXGASCOST_ABOVE_MOCK_MEDIUM_BN.times(
|
const MAXGASCOST_ABOVE_MOCK_MEDIUM_BN_PLUS_TEN_PCT_HEX =
|
||||||
1.1,
|
MAXGASCOST_ABOVE_MOCK_MEDIUM_BN.times(1.1, 10).toString(16);
|
||||||
10,
|
|
||||||
).toString(16);
|
|
||||||
|
|
||||||
const EXPECTED_ETH_FEE_1 = hexWEIToDecETH(
|
const EXPECTED_ETH_FEE_1 = hexWEIToDecETH(
|
||||||
MAXGASCOST_ABOVE_MOCK_MEDIUM_BN_PLUS_TEN_PCT_HEX,
|
MAXGASCOST_ABOVE_MOCK_MEDIUM_BN_PLUS_TEN_PCT_HEX,
|
||||||
@ -40,18 +38,15 @@ const MOCK_SUGGESTED_MEDIUM_MAXFEEPERGAS_BN_WEI = new BigNumber(
|
|||||||
decGWEIToHexWEI(MOCK_SUGGESTED_MEDIUM_MAXFEEPERGAS_DEC_GWEI),
|
decGWEIToHexWEI(MOCK_SUGGESTED_MEDIUM_MAXFEEPERGAS_DEC_GWEI),
|
||||||
16,
|
16,
|
||||||
);
|
);
|
||||||
const MAXFEEPERGAS_BELOW_MOCK_MEDIUM_HEX = MOCK_SUGGESTED_MEDIUM_MAXFEEPERGAS_BN_WEI.div(
|
const MAXFEEPERGAS_BELOW_MOCK_MEDIUM_HEX =
|
||||||
10,
|
MOCK_SUGGESTED_MEDIUM_MAXFEEPERGAS_BN_WEI.div(10, 10).toString(16);
|
||||||
10,
|
|
||||||
).toString(16);
|
|
||||||
|
|
||||||
const EXPECTED_ETH_FEE_2 = hexWEIToDecETH(
|
const EXPECTED_ETH_FEE_2 = hexWEIToDecETH(
|
||||||
MOCK_SUGGESTED_MEDIUM_MAXFEEPERGAS_BN_WEI.times(21000, 10).toString(16),
|
MOCK_SUGGESTED_MEDIUM_MAXFEEPERGAS_BN_WEI.times(21000, 10).toString(16),
|
||||||
);
|
);
|
||||||
|
|
||||||
const MOCK_SUGGESTED_MEDIUM_MAXFEEPERGAS_HEX_WEI = MOCK_SUGGESTED_MEDIUM_MAXFEEPERGAS_BN_WEI.toString(
|
const MOCK_SUGGESTED_MEDIUM_MAXFEEPERGAS_HEX_WEI =
|
||||||
16,
|
MOCK_SUGGESTED_MEDIUM_MAXFEEPERGAS_BN_WEI.toString(16);
|
||||||
);
|
|
||||||
|
|
||||||
jest.mock('../../../store/actions', () => ({
|
jest.mock('../../../store/actions', () => ({
|
||||||
disconnectGasFeeEstimatePoller: jest.fn(),
|
disconnectGasFeeEstimatePoller: jest.fn(),
|
||||||
|
@ -6,10 +6,8 @@ import { Menu, MenuItem } from '../../ui/menu';
|
|||||||
|
|
||||||
const CollectibleOptions = ({ onRemove, onViewOnOpensea }) => {
|
const CollectibleOptions = ({ onRemove, onViewOnOpensea }) => {
|
||||||
const t = useContext(I18nContext);
|
const t = useContext(I18nContext);
|
||||||
const [
|
const [collectibleOptionsButtonElement, setCollectibleOptionsButtonElement] =
|
||||||
collectibleOptionsButtonElement,
|
useState(null);
|
||||||
setCollectibleOptionsButtonElement,
|
|
||||||
] = useState(null);
|
|
||||||
const [collectibleOptionsOpen, setCollectibleOptionsOpen] = useState(false);
|
const [collectibleOptionsOpen, setCollectibleOptionsOpen] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -118,9 +118,8 @@ export default function CollectiblesItems({
|
|||||||
[key]: !isExpanded,
|
[key]: !isExpanded,
|
||||||
};
|
};
|
||||||
|
|
||||||
collectiblesDropdownState[selectedAddress][
|
collectiblesDropdownState[selectedAddress][chainId] =
|
||||||
chainId
|
newCurrentAccountState;
|
||||||
] = newCurrentAccountState;
|
|
||||||
|
|
||||||
dispatch(updateCollectibleDropDownState(collectiblesDropdownState));
|
dispatch(updateCollectibleDropDownState(collectiblesDropdownState));
|
||||||
};
|
};
|
||||||
@ -186,13 +185,8 @@ export default function CollectiblesItems({
|
|||||||
{isExpanded ? (
|
{isExpanded ? (
|
||||||
<Box display={DISPLAY.FLEX} flexWrap={FLEX_WRAP.WRAP} gap={4}>
|
<Box display={DISPLAY.FLEX} flexWrap={FLEX_WRAP.WRAP} gap={4}>
|
||||||
{collectibles.map((collectible, i) => {
|
{collectibles.map((collectible, i) => {
|
||||||
const {
|
const { image, address, tokenId, backgroundColor, name } =
|
||||||
image,
|
collectible;
|
||||||
address,
|
|
||||||
tokenId,
|
|
||||||
backgroundColor,
|
|
||||||
name,
|
|
||||||
} = collectible;
|
|
||||||
const collectibleImage = getAssetImageURL(image, ipfsGateway);
|
const collectibleImage = getAssetImageURL(image, ipfsGateway);
|
||||||
const handleImageClick = () =>
|
const handleImageClick = () =>
|
||||||
history.push(`${ASSET_ROUTE}/${address}/${tokenId}`);
|
history.push(`${ASSET_ROUTE}/${address}/${tokenId}`);
|
||||||
@ -249,11 +243,8 @@ export default function CollectiblesItems({
|
|||||||
>
|
>
|
||||||
<>
|
<>
|
||||||
{collectionsKeys.map((key) => {
|
{collectionsKeys.map((key) => {
|
||||||
const {
|
const { collectibles, collectionName, collectionImage } =
|
||||||
collectibles,
|
collections[key];
|
||||||
collectionName,
|
|
||||||
collectionImage,
|
|
||||||
} = collections[key];
|
|
||||||
|
|
||||||
return renderCollection({
|
return renderCollection({
|
||||||
collectibles,
|
collectibles,
|
||||||
|
@ -36,11 +36,8 @@ export default function CollectiblesTab({ onAddNFT }) {
|
|||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const {
|
const { collectiblesLoading, collections, previouslyOwnedCollection } =
|
||||||
collectiblesLoading,
|
useCollectiblesCollections();
|
||||||
collections,
|
|
||||||
previouslyOwnedCollection,
|
|
||||||
} = useCollectiblesCollections();
|
|
||||||
|
|
||||||
const onEnableAutoDetect = () => {
|
const onEnableAutoDetect = () => {
|
||||||
history.push(EXPERIMENTAL_ROUTE);
|
history.push(EXPERIMENTAL_ROUTE);
|
||||||
|
@ -182,10 +182,12 @@ describe('Collectible Items', () => {
|
|||||||
const checkAndUpdateAllCollectiblesOwnershipStatusStub = jest.fn();
|
const checkAndUpdateAllCollectiblesOwnershipStatusStub = jest.fn();
|
||||||
const updateCollectibleDropDownStateStub = jest.fn();
|
const updateCollectibleDropDownStateStub = jest.fn();
|
||||||
setBackgroundConnection({
|
setBackgroundConnection({
|
||||||
setCollectiblesDetectionNoticeDismissed: setCollectiblesDetectionNoticeDismissedStub,
|
setCollectiblesDetectionNoticeDismissed:
|
||||||
|
setCollectiblesDetectionNoticeDismissedStub,
|
||||||
detectCollectibles: detectCollectiblesStub,
|
detectCollectibles: detectCollectiblesStub,
|
||||||
getState: getStateStub,
|
getState: getStateStub,
|
||||||
checkAndUpdateAllCollectiblesOwnershipStatus: checkAndUpdateAllCollectiblesOwnershipStatusStub,
|
checkAndUpdateAllCollectiblesOwnershipStatus:
|
||||||
|
checkAndUpdateAllCollectiblesOwnershipStatusStub,
|
||||||
updateCollectibleDropDownState: updateCollectibleDropDownStateStub,
|
updateCollectibleDropDownState: updateCollectibleDropDownStateStub,
|
||||||
});
|
});
|
||||||
const historyPushMock = jest.fn();
|
const historyPushMock = jest.fn();
|
||||||
|
@ -42,9 +42,8 @@ const ConfirmPageContainerSummary = (props) => {
|
|||||||
TRANSACTION_TYPES.TOKEN_METHOD_TRANSFER_FROM,
|
TRANSACTION_TYPES.TOKEN_METHOD_TRANSFER_FROM,
|
||||||
TRANSACTION_TYPES.TOKEN_METHOD_SAFE_TRANSFER_FROM,
|
TRANSACTION_TYPES.TOKEN_METHOD_SAFE_TRANSFER_FROM,
|
||||||
];
|
];
|
||||||
const isContractTypeTransaction = contractInitiatedTransactionType.includes(
|
const isContractTypeTransaction =
|
||||||
transactionType,
|
contractInitiatedTransactionType.includes(transactionType);
|
||||||
);
|
|
||||||
let contractAddress;
|
let contractAddress;
|
||||||
if (isContractTypeTransaction) {
|
if (isContractTypeTransaction) {
|
||||||
// If the transaction is TOKEN_METHOD_TRANSFER or TOKEN_METHOD_TRANSFER_FROM
|
// If the transaction is TOKEN_METHOD_TRANSFER or TOKEN_METHOD_TRANSFER_FROM
|
||||||
|
@ -125,11 +125,8 @@ export default class ConnectedAccountsList extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const { connectedAccounts, selectedAddress, shouldRenderListOptions } =
|
||||||
connectedAccounts,
|
this.props;
|
||||||
selectedAddress,
|
|
||||||
shouldRenderListOptions,
|
|
||||||
} = this.props;
|
|
||||||
const { t } = this.context;
|
const { t } = this.context;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -36,7 +36,8 @@ const ConnectedAccountsPermissions = ({ permissions }) => {
|
|||||||
className={classnames(
|
className={classnames(
|
||||||
'connected-accounts-permissions__list-container',
|
'connected-accounts-permissions__list-container',
|
||||||
{
|
{
|
||||||
'connected-accounts-permissions__list-container--expanded': expanded,
|
'connected-accounts-permissions__list-container--expanded':
|
||||||
|
expanded,
|
||||||
},
|
},
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
@ -37,10 +37,8 @@ export default function RecipientGroup({
|
|||||||
address,
|
address,
|
||||||
selectedAddress,
|
selectedAddress,
|
||||||
),
|
),
|
||||||
'send__select-recipient-wrapper__group-item--selected': addressesEqual(
|
'send__select-recipient-wrapper__group-item--selected':
|
||||||
address,
|
addressesEqual(address, selectedAddress),
|
||||||
selectedAddress,
|
|
||||||
),
|
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<Identicon address={address} diameter={28} />
|
<Identicon address={address} diameter={28} />
|
||||||
|
@ -27,9 +27,8 @@ const DetectedTokenSelectionPopover = ({
|
|||||||
const trackEvent = useContext(MetaMetricsContext);
|
const trackEvent = useContext(MetaMetricsContext);
|
||||||
|
|
||||||
const detectedTokens = useSelector(getDetectedTokensInCurrentNetwork);
|
const detectedTokens = useSelector(getDetectedTokensInCurrentNetwork);
|
||||||
const { selected: selectedTokens = [] } = sortingBasedOnTokenSelection(
|
const { selected: selectedTokens = [] } =
|
||||||
tokensListDetected,
|
sortingBasedOnTokenSelection(tokensListDetected);
|
||||||
);
|
|
||||||
const numOfTokensImporting =
|
const numOfTokensImporting =
|
||||||
selectedTokens.length === detectedTokens.length
|
selectedTokens.length === detectedTokens.length
|
||||||
? `All`
|
? `All`
|
||||||
|
@ -45,10 +45,8 @@ const DetectedToken = ({ setShowDetectedTokens }) => {
|
|||||||
return tokenObj;
|
return tokenObj;
|
||||||
}, {}),
|
}, {}),
|
||||||
);
|
);
|
||||||
const [
|
const [showDetectedTokenIgnoredPopover, setShowDetectedTokenIgnoredPopover] =
|
||||||
showDetectedTokenIgnoredPopover,
|
useState(false);
|
||||||
setShowDetectedTokenIgnoredPopover,
|
|
||||||
] = useState(false);
|
|
||||||
|
|
||||||
const importSelectedTokens = async (selectedTokens) => {
|
const importSelectedTokens = async (selectedTokens) => {
|
||||||
selectedTokens.forEach((importedToken) => {
|
selectedTokens.forEach((importedToken) => {
|
||||||
@ -71,10 +69,8 @@ const DetectedToken = ({ setShowDetectedTokens }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleClearTokensSelection = async () => {
|
const handleClearTokensSelection = async () => {
|
||||||
const {
|
const { selected: selectedTokens = [], deselected: deSelectedTokens = [] } =
|
||||||
selected: selectedTokens = [],
|
sortingBasedOnTokenSelection(tokensListDetected);
|
||||||
deselected: deSelectedTokens = [],
|
|
||||||
} = sortingBasedOnTokenSelection(tokensListDetected);
|
|
||||||
|
|
||||||
if (deSelectedTokens.length < detectedTokens.length) {
|
if (deSelectedTokens.length < detectedTokens.length) {
|
||||||
await importSelectedTokens(selectedTokens);
|
await importSelectedTokens(selectedTokens);
|
||||||
@ -115,9 +111,8 @@ const DetectedToken = ({ setShowDetectedTokens }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onImport = async () => {
|
const onImport = async () => {
|
||||||
const { selected: selectedTokens = [] } = sortingBasedOnTokenSelection(
|
const { selected: selectedTokens = [] } =
|
||||||
tokensListDetected,
|
sortingBasedOnTokenSelection(tokensListDetected);
|
||||||
);
|
|
||||||
|
|
||||||
if (selectedTokens.length < detectedTokens.length) {
|
if (selectedTokens.length < detectedTokens.length) {
|
||||||
setShowDetectedTokenIgnoredPopover(true);
|
setShowDetectedTokenIgnoredPopover(true);
|
||||||
|
@ -295,9 +295,8 @@ class NetworkDropdown extends Component {
|
|||||||
onClickOutside={(event) => {
|
onClickOutside={(event) => {
|
||||||
const { classList } = event.target;
|
const { classList } = event.target;
|
||||||
const isInClassList = (className) => classList.contains(className);
|
const isInClassList = (className) => classList.contains(className);
|
||||||
const notToggleElementIndex = notToggleElementClassnames.findIndex(
|
const notToggleElementIndex =
|
||||||
isInClassList,
|
notToggleElementClassnames.findIndex(isInClassList);
|
||||||
);
|
|
||||||
|
|
||||||
if (notToggleElementIndex === -1) {
|
if (notToggleElementIndex === -1) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
@ -99,9 +99,8 @@ export default function EditGasDisplay({
|
|||||||
}
|
}
|
||||||
}, [showAdvancedForm]);
|
}, [showAdvancedForm]);
|
||||||
|
|
||||||
const dappSuggestedAndTxParamGasFeesAreTheSame = areDappSuggestedAndTxParamGasFeesTheSame(
|
const dappSuggestedAndTxParamGasFeesAreTheSame =
|
||||||
transaction,
|
areDappSuggestedAndTxParamGasFeesTheSame(transaction);
|
||||||
);
|
|
||||||
|
|
||||||
const requireDappAcknowledgement = Boolean(
|
const requireDappAcknowledgement = Boolean(
|
||||||
transaction?.dappSuggestedGasFees &&
|
transaction?.dappSuggestedGasFees &&
|
||||||
|
@ -21,12 +21,8 @@ import NetworkStatistics from './network-statistics';
|
|||||||
const EditGasFeePopover = () => {
|
const EditGasFeePopover = () => {
|
||||||
const { balanceError, editGasMode } = useGasFeeContext();
|
const { balanceError, editGasMode } = useGasFeeContext();
|
||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
const {
|
const { closeAllModals, closeModal, currentModal, openModalCount } =
|
||||||
closeAllModals,
|
useTransactionModalContext();
|
||||||
closeModal,
|
|
||||||
currentModal,
|
|
||||||
openModalCount,
|
|
||||||
} = useTransactionModalContext();
|
|
||||||
|
|
||||||
if (currentModal !== 'editGasFee') {
|
if (currentModal !== 'editGasFee') {
|
||||||
return null;
|
return null;
|
||||||
|
@ -29,9 +29,8 @@ export const useGasItemFeeDetails = (priorityLevel) => {
|
|||||||
maxPriorityFeePerGas: maxPriorityFeePerGasValue,
|
maxPriorityFeePerGas: maxPriorityFeePerGasValue,
|
||||||
transaction,
|
transaction,
|
||||||
} = useGasFeeContext();
|
} = useGasFeeContext();
|
||||||
const [estimateGreaterThanGasUse, setEstimateGreaterThanGasUse] = useState(
|
const [estimateGreaterThanGasUse, setEstimateGreaterThanGasUse] =
|
||||||
false,
|
useState(false);
|
||||||
);
|
|
||||||
const advancedGasFeeValues = useSelector(getAdvancedGasFeeValues);
|
const advancedGasFeeValues = useSelector(getAdvancedGasFeeValues);
|
||||||
|
|
||||||
let maxFeePerGas;
|
let maxFeePerGas;
|
||||||
|
@ -63,10 +63,8 @@ export default function EditGasPopover({
|
|||||||
supportsEIP1559;
|
supportsEIP1559;
|
||||||
const [showEducationContent, setShowEducationContent] = useState(false);
|
const [showEducationContent, setShowEducationContent] = useState(false);
|
||||||
|
|
||||||
const [
|
const [dappSuggestedGasFeeAcknowledged, setDappSuggestedGasFeeAcknowledged] =
|
||||||
dappSuggestedGasFeeAcknowledged,
|
useState(false);
|
||||||
setDappSuggestedGasFeeAcknowledged,
|
|
||||||
] = useState(false);
|
|
||||||
|
|
||||||
const minimumGasLimitDec = hexToDecimal(minimumGasLimit);
|
const minimumGasLimitDec = hexToDecimal(minimumGasLimit);
|
||||||
const updatedCustomGasSettings = useIncrementedGasFees(transaction);
|
const updatedCustomGasSettings = useIncrementedGasFees(transaction);
|
||||||
|
@ -15,7 +15,8 @@ function lineBreaksToBr(source) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const METAMASK_LOGO = lineBreaksToBr(`MMm*mmMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMmm*mMM
|
const METAMASK_LOGO =
|
||||||
|
lineBreaksToBr(`MMm*mmMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMmm*mMM
|
||||||
MM*./***mMMMMMMMMMMMMMMMMMMMMMMMMMMm***/.*MM
|
MM*./***mMMMMMMMMMMMMMMMMMMMMMMMMMMm***/.*MM
|
||||||
MM/...///*mMMMMMMMMMMMMMMMMMMMMMMm*///.../MM
|
MM/...///*mMMMMMMMMMMMMMMMMMMMMMMm*///.../MM
|
||||||
Mm.....//../*mMMMMMMMMMMMMMMMMm*/..//.....mM
|
Mm.....//../*mMMMMMMMMMMMMMMMMm*/..//.....mM
|
||||||
@ -57,7 +58,8 @@ MMMMMMMMMMMMMMMMMm/....../mMMMMMMMMMMMMMMMMM
|
|||||||
MMMMMMMMMMMMMMMMMMmmmmmmmmMMMMMMMMMMMMMMMMMM`);
|
MMMMMMMMMMMMMMMMMMmmmmmmmmMMMMMMMMMMMMMMMMMM`);
|
||||||
|
|
||||||
/* eslint-disable no-irregular-whitespace */
|
/* eslint-disable no-irregular-whitespace */
|
||||||
const EXPERIMENTAL_AREA = lineBreaksToBr(`█▄█ █▀█ █░█ ▀ █▀█ █▀▀ █▀▀ █▄░█ ▀█▀ █▀▀ █▀█ █ █▄░█ █▀▀ ▄▀█ █▄░█
|
const EXPERIMENTAL_AREA =
|
||||||
|
lineBreaksToBr(`█▄█ █▀█ █░█ ▀ █▀█ █▀▀ █▀▀ █▄░█ ▀█▀ █▀▀ █▀█ █ █▄░█ █▀▀ ▄▀█ █▄░█
|
||||||
░█░ █▄█ █▄█ ░ █▀▄ ██▄ ██▄ █░▀█ ░█░ ██▄ █▀▄ █ █░▀█ █▄█ █▀█ █░▀█
|
░█░ █▄█ █▄█ ░ █▀▄ ██▄ ██▄ █░▀█ ░█░ ██▄ █▀▄ █ █░▀█ █▄█ █▀█ █░▀█
|
||||||
|
|
||||||
█▀▀ ▀▄▀ █▀█ █▀▀ █▀█ █ █▀▄▀█ █▀▀ █▄░█ ▀█▀ ▄▀█ █░░ ▄▀█ █▀█ █▀▀ ▄▀█
|
█▀▀ ▀▄▀ █▀█ █▀▀ █▀█ █ █▀▄▀█ █▀▀ █▄░█ ▀█▀ ▄▀█ █░░ ▄▀█ █▀█ █▀▀ ▄▀█
|
||||||
|
@ -166,7 +166,8 @@ export default class AdvancedGasInputs extends Component {
|
|||||||
errorType === 'error',
|
errorType === 'error',
|
||||||
'advanced-gas-inputs__gas-edit-row__input--warning':
|
'advanced-gas-inputs__gas-edit-row__input--warning':
|
||||||
errorType === 'warning',
|
errorType === 'warning',
|
||||||
'advanced-gas-inputs__gas-edit-row__input-arrows--hidden': disabled,
|
'advanced-gas-inputs__gas-edit-row__input-arrows--hidden':
|
||||||
|
disabled,
|
||||||
},
|
},
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
@ -210,16 +211,14 @@ export default class AdvancedGasInputs extends Component {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const { errorText: gasPriceErrorText, errorType: gasPriceErrorType } =
|
||||||
errorText: gasPriceErrorText,
|
this.gasPriceError({
|
||||||
errorType: gasPriceErrorType,
|
insufficientBalance,
|
||||||
} = this.gasPriceError({
|
customPriceIsSafe,
|
||||||
insufficientBalance,
|
isSpeedUp,
|
||||||
customPriceIsSafe,
|
gasPrice,
|
||||||
isSpeedUp,
|
customPriceIsExcessive,
|
||||||
gasPrice,
|
});
|
||||||
customPriceIsExcessive,
|
|
||||||
});
|
|
||||||
const gasPriceErrorComponent = gasPriceErrorType ? (
|
const gasPriceErrorComponent = gasPriceErrorType ? (
|
||||||
<div
|
<div
|
||||||
className={`advanced-gas-inputs__gas-edit-row__${gasPriceErrorType}-text`}
|
className={`advanced-gas-inputs__gas-edit-row__${gasPriceErrorType}-text`}
|
||||||
@ -228,10 +227,8 @@ export default class AdvancedGasInputs extends Component {
|
|||||||
</div>
|
</div>
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
const {
|
const { errorText: gasLimitErrorText, errorType: gasLimitErrorType } =
|
||||||
errorText: gasLimitErrorText,
|
this.gasLimitError({ insufficientBalance, gasLimit, minimumGasLimit });
|
||||||
errorType: gasLimitErrorType,
|
|
||||||
} = this.gasLimitError({ insufficientBalance, gasLimit, minimumGasLimit });
|
|
||||||
const gasLimitErrorComponent = gasLimitErrorType ? (
|
const gasLimitErrorComponent = gasLimitErrorType ? (
|
||||||
<div
|
<div
|
||||||
className={`advanced-gas-inputs__gas-edit-row__${gasLimitErrorType}-text`}
|
className={`advanced-gas-inputs__gas-edit-row__${gasLimitErrorType}-text`}
|
||||||
|
@ -49,9 +49,8 @@ describe('AdvancedTabContent Component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should call renderDataSummary with the expected params', () => {
|
it('should call renderDataSummary with the expected params', () => {
|
||||||
const renderDataSummaryArgs = AdvancedTabContent.prototype.renderDataSummary.getCall(
|
const renderDataSummaryArgs =
|
||||||
0,
|
AdvancedTabContent.prototype.renderDataSummary.getCall(0).args;
|
||||||
).args;
|
|
||||||
expect(renderDataSummaryArgs).toStrictEqual(['$0.25']);
|
expect(renderDataSummaryArgs).toStrictEqual(['$0.25']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -138,9 +138,8 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
conversionRate,
|
conversionRate,
|
||||||
});
|
});
|
||||||
const isGasEstimate = getIsGasEstimatesFetched(state);
|
const isGasEstimate = getIsGasEstimatesFetched(state);
|
||||||
const customNetworkEstimateWasFetched = getIsCustomNetworkGasPriceFetched(
|
const customNetworkEstimateWasFetched =
|
||||||
state,
|
getIsCustomNetworkGasPriceFetched(state);
|
||||||
);
|
|
||||||
|
|
||||||
let customPriceIsSafe = true;
|
let customPriceIsSafe = true;
|
||||||
if ((isMainnet || process.env.IN_TEST) && isGasEstimate) {
|
if ((isMainnet || process.env.IN_TEST) && isGasEstimate) {
|
||||||
|
@ -69,11 +69,8 @@ describe('GasPriceButtonGroup Component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should render the correct props on the ButtonGroup', () => {
|
it('should render the correct props on the ButtonGroup', () => {
|
||||||
const {
|
const { className, defaultActiveButtonIndex, noButtonActiveByDefault } =
|
||||||
className,
|
wrapper.props();
|
||||||
defaultActiveButtonIndex,
|
|
||||||
noButtonActiveByDefault,
|
|
||||||
} = wrapper.props();
|
|
||||||
expect(className).toStrictEqual('gas-price-button-group');
|
expect(className).toStrictEqual('gas-price-button-group');
|
||||||
expect(defaultActiveButtonIndex).toStrictEqual(2);
|
expect(defaultActiveButtonIndex).toStrictEqual(2);
|
||||||
expect(noButtonActiveByDefault).toStrictEqual(true);
|
expect(noButtonActiveByDefault).toStrictEqual(true);
|
||||||
@ -195,14 +192,15 @@ describe('GasPriceButtonGroup Component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should render a feeInPrimaryCurrency if passed a feeInPrimaryCurrency', () => {
|
it('should render a feeInPrimaryCurrency if passed a feeInPrimaryCurrency', () => {
|
||||||
const renderButtonContentResult = GasPriceButtonGroup.prototype.renderButtonContent(
|
const renderButtonContentResult =
|
||||||
{
|
GasPriceButtonGroup.prototype.renderButtonContent(
|
||||||
feeInPrimaryCurrency: 'mockFeeInPrimaryCurrency',
|
{
|
||||||
},
|
feeInPrimaryCurrency: 'mockFeeInPrimaryCurrency',
|
||||||
{
|
},
|
||||||
className: 'someClass',
|
{
|
||||||
},
|
className: 'someClass',
|
||||||
);
|
},
|
||||||
|
);
|
||||||
const wrappedRenderButtonContentResult = shallowWithContext(
|
const wrappedRenderButtonContentResult = shallowWithContext(
|
||||||
renderButtonContentResult,
|
renderButtonContentResult,
|
||||||
);
|
);
|
||||||
@ -217,14 +215,15 @@ describe('GasPriceButtonGroup Component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should render a feeInSecondaryCurrency if passed a feeInSecondaryCurrency', () => {
|
it('should render a feeInSecondaryCurrency if passed a feeInSecondaryCurrency', () => {
|
||||||
const renderButtonContentResult = GasPriceButtonGroup.prototype.renderButtonContent(
|
const renderButtonContentResult =
|
||||||
{
|
GasPriceButtonGroup.prototype.renderButtonContent(
|
||||||
feeInSecondaryCurrency: 'mockFeeInSecondaryCurrency',
|
{
|
||||||
},
|
feeInSecondaryCurrency: 'mockFeeInSecondaryCurrency',
|
||||||
{
|
},
|
||||||
className: 'someClass',
|
{
|
||||||
},
|
className: 'someClass',
|
||||||
);
|
},
|
||||||
|
);
|
||||||
const wrappedRenderButtonContentResult = shallowWithContext(
|
const wrappedRenderButtonContentResult = shallowWithContext(
|
||||||
renderButtonContentResult,
|
renderButtonContentResult,
|
||||||
);
|
);
|
||||||
@ -239,14 +238,15 @@ describe('GasPriceButtonGroup Component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should render a timeEstimate if passed a timeEstimate', () => {
|
it('should render a timeEstimate if passed a timeEstimate', () => {
|
||||||
const renderButtonContentResult = GasPriceButtonGroup.prototype.renderButtonContent(
|
const renderButtonContentResult =
|
||||||
{
|
GasPriceButtonGroup.prototype.renderButtonContent(
|
||||||
timeEstimate: 'mockTimeEstimate',
|
{
|
||||||
},
|
timeEstimate: 'mockTimeEstimate',
|
||||||
{
|
},
|
||||||
className: 'someClass',
|
{
|
||||||
},
|
className: 'someClass',
|
||||||
);
|
},
|
||||||
|
);
|
||||||
const wrappedRenderButtonContentResult = shallowWithContext(
|
const wrappedRenderButtonContentResult = shallowWithContext(
|
||||||
renderButtonContentResult,
|
renderButtonContentResult,
|
||||||
);
|
);
|
||||||
@ -261,13 +261,14 @@ describe('GasPriceButtonGroup Component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should render a check if showCheck is true', () => {
|
it('should render a check if showCheck is true', () => {
|
||||||
const renderButtonContentResult = GasPriceButtonGroup.prototype.renderButtonContent(
|
const renderButtonContentResult =
|
||||||
{},
|
GasPriceButtonGroup.prototype.renderButtonContent(
|
||||||
{
|
{},
|
||||||
className: 'someClass',
|
{
|
||||||
showCheck: true,
|
className: 'someClass',
|
||||||
},
|
showCheck: true,
|
||||||
);
|
},
|
||||||
|
);
|
||||||
const wrappedRenderButtonContentResult = shallowWithContext(
|
const wrappedRenderButtonContentResult = shallowWithContext(
|
||||||
renderButtonContentResult,
|
renderButtonContentResult,
|
||||||
);
|
);
|
||||||
@ -296,10 +297,8 @@ describe('GasPriceButtonGroup Component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should render no elements if all args passed', () => {
|
it('should render no elements if all args passed', () => {
|
||||||
const renderButtonContentResult = GasPriceButtonGroup.prototype.renderButtonContent(
|
const renderButtonContentResult =
|
||||||
{},
|
GasPriceButtonGroup.prototype.renderButtonContent({}, {});
|
||||||
{},
|
|
||||||
);
|
|
||||||
const wrappedRenderButtonContentResult = shallowWithContext(
|
const wrappedRenderButtonContentResult = shallowWithContext(
|
||||||
renderButtonContentResult,
|
renderButtonContentResult,
|
||||||
);
|
);
|
||||||
|
@ -61,21 +61,23 @@ const DEFAULT_OPTS = {
|
|||||||
isGasEstimatesLoading: true,
|
isGasEstimatesLoading: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const generateUseSelectorRouter = (opts = DEFAULT_OPTS) => (selector) => {
|
const generateUseSelectorRouter =
|
||||||
if (selector === checkNetworkAndAccountSupports1559) {
|
(opts = DEFAULT_OPTS) =>
|
||||||
return true;
|
(selector) => {
|
||||||
}
|
if (selector === checkNetworkAndAccountSupports1559) {
|
||||||
if (selector === getGasEstimateType) {
|
return true;
|
||||||
return opts.gasEstimateType ?? DEFAULT_OPTS.gasEstimateType;
|
}
|
||||||
}
|
if (selector === getGasEstimateType) {
|
||||||
if (selector === getGasFeeEstimates) {
|
return opts.gasEstimateType ?? DEFAULT_OPTS.gasEstimateType;
|
||||||
return opts.gasFeeEstimates ?? DEFAULT_OPTS.gasFeeEstimates;
|
}
|
||||||
}
|
if (selector === getGasFeeEstimates) {
|
||||||
if (selector === getIsGasEstimatesLoading) {
|
return opts.gasFeeEstimates ?? DEFAULT_OPTS.gasFeeEstimates;
|
||||||
return opts.isGasEstimatesLoading ?? DEFAULT_OPTS.isGasEstimatesLoading;
|
}
|
||||||
}
|
if (selector === getIsGasEstimatesLoading) {
|
||||||
return undefined;
|
return opts.isGasEstimatesLoading ?? DEFAULT_OPTS.isGasEstimatesLoading;
|
||||||
};
|
}
|
||||||
|
return undefined;
|
||||||
|
};
|
||||||
|
|
||||||
describe('Gas timing', () => {
|
describe('Gas timing', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@ -173,11 +173,10 @@ export default function LedgerInstructionField({ showDataInstruction }) {
|
|||||||
type="link"
|
type="link"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
if (environmentTypeIsFullScreen) {
|
if (environmentTypeIsFullScreen) {
|
||||||
const connectedDevices = await window.navigator.hid.requestDevice(
|
const connectedDevices =
|
||||||
{
|
await window.navigator.hid.requestDevice({
|
||||||
filters: [{ vendorId: LEDGER_USB_VENDOR_ID }],
|
filters: [{ vendorId: LEDGER_USB_VENDOR_ID }],
|
||||||
},
|
});
|
||||||
);
|
|
||||||
const webHidIsConnected = connectedDevices.some(
|
const webHidIsConnected = connectedDevices.some(
|
||||||
(device) =>
|
(device) =>
|
||||||
device.vendorId === Number(LEDGER_USB_VENDOR_ID),
|
device.vendorId === Number(LEDGER_USB_VENDOR_ID),
|
||||||
|
@ -59,11 +59,8 @@ export default class LoadingNetworkScreen extends PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
renderErrorScreenContent = () => {
|
renderErrorScreenContent = () => {
|
||||||
const {
|
const { showNetworkDropdown, setProviderArgs, setProviderType } =
|
||||||
showNetworkDropdown,
|
this.props;
|
||||||
setProviderArgs,
|
|
||||||
setProviderType,
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="loading-overlay__error-screen">
|
<div className="loading-overlay__error-screen">
|
||||||
|
@ -17,10 +17,8 @@ export default function MenuBar() {
|
|||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
const trackEvent = useContext(MetaMetricsContext);
|
const trackEvent = useContext(MetaMetricsContext);
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const [
|
const [accountOptionsButtonElement, setAccountOptionsButtonElement] =
|
||||||
accountOptionsButtonElement,
|
useState(null);
|
||||||
setAccountOptionsButtonElement,
|
|
||||||
] = useState(null);
|
|
||||||
const [accountOptionsMenuOpen, setAccountOptionsMenuOpen] = useState(false);
|
const [accountOptionsMenuOpen, setAccountOptionsMenuOpen] = useState(false);
|
||||||
const origin = useSelector(getOriginOfCurrentTab);
|
const origin = useSelector(getOriginOfCurrentTab);
|
||||||
|
|
||||||
|
@ -40,8 +40,7 @@ const SECTIONS = {
|
|||||||
key: 'TDL',
|
key: 'TDL',
|
||||||
props: {
|
props: {
|
||||||
dictionary: {
|
dictionary: {
|
||||||
term:
|
term: 'a word or phrase used to describe a thing or to express a concept, especially in a particular kind of language or branch of study.',
|
||||||
'a word or phrase used to describe a thing or to express a concept, especially in a particular kind of language or branch of study.',
|
|
||||||
definition:
|
definition:
|
||||||
'a statement of the exact meaning of a word, especially in a dictionary.',
|
'a statement of the exact meaning of a word, especially in a dictionary.',
|
||||||
dl: 'HTML tag denoting a definition list',
|
dl: 'HTML tag denoting a definition list',
|
||||||
|
@ -6,12 +6,8 @@ import CancelTransaction from './cancel-transaction.component';
|
|||||||
|
|
||||||
const mapStateToProps = (state, ownProps) => {
|
const mapStateToProps = (state, ownProps) => {
|
||||||
const { metamask } = state;
|
const { metamask } = state;
|
||||||
const {
|
const { transactionId, originalGasPrice, newGasFee, customGasSettings } =
|
||||||
transactionId,
|
ownProps;
|
||||||
originalGasPrice,
|
|
||||||
newGasFee,
|
|
||||||
customGasSettings,
|
|
||||||
} = ownProps;
|
|
||||||
const { currentNetworkTxList } = metamask;
|
const { currentNetworkTxList } = metamask;
|
||||||
const transaction = currentNetworkTxList.find(
|
const transaction = currentNetworkTxList.find(
|
||||||
({ id }) => id === transactionId,
|
({ id }) => id === transactionId,
|
||||||
|
@ -87,8 +87,10 @@ export default class EditApprovalPermission extends PureComponent {
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={classnames({
|
className={classnames({
|
||||||
'edit-approval-permission__edit-section__radio-button-outline': !selectedOptionIsUnlimited,
|
'edit-approval-permission__edit-section__radio-button-outline':
|
||||||
'edit-approval-permission__edit-section__radio-button-outline--selected': selectedOptionIsUnlimited,
|
!selectedOptionIsUnlimited,
|
||||||
|
'edit-approval-permission__edit-section__radio-button-outline--selected':
|
||||||
|
selectedOptionIsUnlimited,
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
<div className="edit-approval-permission__edit-section__radio-button-fill" />
|
<div className="edit-approval-permission__edit-section__radio-button-fill" />
|
||||||
@ -99,8 +101,10 @@ export default class EditApprovalPermission extends PureComponent {
|
|||||||
<div className="edit-approval-permission__edit-section__option-text">
|
<div className="edit-approval-permission__edit-section__option-text">
|
||||||
<div
|
<div
|
||||||
className={classnames({
|
className={classnames({
|
||||||
'edit-approval-permission__edit-section__option-label': !selectedOptionIsUnlimited,
|
'edit-approval-permission__edit-section__option-label':
|
||||||
'edit-approval-permission__edit-section__option-label--selected': selectedOptionIsUnlimited,
|
!selectedOptionIsUnlimited,
|
||||||
|
'edit-approval-permission__edit-section__option-label--selected':
|
||||||
|
selectedOptionIsUnlimited,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{new BigNumber(tokenAmount).equals(
|
{new BigNumber(tokenAmount).equals(
|
||||||
@ -126,8 +130,10 @@ export default class EditApprovalPermission extends PureComponent {
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={classnames({
|
className={classnames({
|
||||||
'edit-approval-permission__edit-section__radio-button-outline': selectedOptionIsUnlimited,
|
'edit-approval-permission__edit-section__radio-button-outline':
|
||||||
'edit-approval-permission__edit-section__radio-button-outline--selected': !selectedOptionIsUnlimited,
|
selectedOptionIsUnlimited,
|
||||||
|
'edit-approval-permission__edit-section__radio-button-outline--selected':
|
||||||
|
!selectedOptionIsUnlimited,
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
<div className="edit-approval-permission__edit-section__radio-button-fill" />
|
<div className="edit-approval-permission__edit-section__radio-button-fill" />
|
||||||
@ -138,8 +144,10 @@ export default class EditApprovalPermission extends PureComponent {
|
|||||||
<div className="edit-approval-permission__edit-section__option-text">
|
<div className="edit-approval-permission__edit-section__option-text">
|
||||||
<div
|
<div
|
||||||
className={classnames({
|
className={classnames({
|
||||||
'edit-approval-permission__edit-section__option-label': selectedOptionIsUnlimited,
|
'edit-approval-permission__edit-section__option-label':
|
||||||
'edit-approval-permission__edit-section__option-label--selected': !selectedOptionIsUnlimited,
|
selectedOptionIsUnlimited,
|
||||||
|
'edit-approval-permission__edit-section__option-label--selected':
|
||||||
|
!selectedOptionIsUnlimited,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{t('customSpendLimit')}
|
{t('customSpendLimit')}
|
||||||
|
@ -16,8 +16,7 @@ export default class PermissionsConnectFooter extends Component {
|
|||||||
className="permissions-connect-footer__text--link"
|
className="permissions-connect-footer__text--link"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
global.platform.openTab({
|
global.platform.openTab({
|
||||||
url:
|
url: 'https://metamask.zendesk.com/hc/en-us/articles/4405506066331-User-guide-Dapps',
|
||||||
'https://metamask.zendesk.com/hc/en-us/articles/4405506066331-User-guide-Dapps',
|
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -228,8 +228,7 @@ export default class SignatureRequestOriginal extends Component {
|
|||||||
className="request-signature__help-link"
|
className="request-signature__help-link"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
global.platform.openTab({
|
global.platform.openTab({
|
||||||
url:
|
url: 'https://consensys.net/blog/metamask/the-seal-of-approval-know-what-youre-consenting-to-with-permissions-and-approvals-in-metamask/',
|
||||||
'https://consensys.net/blog/metamask/the-seal-of-approval-know-what-youre-consenting-to-with-permissions-and-approvals-in-metamask/',
|
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -26,10 +26,8 @@ function mapStateToProps(state, ownProps) {
|
|||||||
msgParams: { from },
|
msgParams: { from },
|
||||||
} = ownProps.txData;
|
} = ownProps.txData;
|
||||||
|
|
||||||
const hardwareWalletRequiresConnection = doesAddressRequireLedgerHidConnection(
|
const hardwareWalletRequiresConnection =
|
||||||
state,
|
doesAddressRequireLedgerHidConnection(state, from);
|
||||||
from,
|
|
||||||
);
|
|
||||||
const isLedgerWallet = isAddressLedger(state, from);
|
const isLedgerWallet = isAddressLedger(state, from);
|
||||||
const messagesList = unconfirmedMessagesHashSelector(state);
|
const messagesList = unconfirmedMessagesHashSelector(state);
|
||||||
const messagesCount = getTotalUnapprovedMessagesCount(state);
|
const messagesCount = getTotalUnapprovedMessagesCount(state);
|
||||||
|
@ -13,10 +13,8 @@ function mapStateToProps(state, ownProps) {
|
|||||||
const {
|
const {
|
||||||
msgParams: { from },
|
msgParams: { from },
|
||||||
} = txData;
|
} = txData;
|
||||||
const hardwareWalletRequiresConnection = doesAddressRequireLedgerHidConnection(
|
const hardwareWalletRequiresConnection =
|
||||||
state,
|
doesAddressRequireLedgerHidConnection(state, from);
|
||||||
from,
|
|
||||||
);
|
|
||||||
const isLedgerWallet = isAddressLedger(state, from);
|
const isLedgerWallet = isAddressLedger(state, from);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -28,11 +26,8 @@ function mapStateToProps(state, ownProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mergeProps(stateProps, dispatchProps, ownProps) {
|
function mergeProps(stateProps, dispatchProps, ownProps) {
|
||||||
const {
|
const { allAccounts, isLedgerWallet, hardwareWalletRequiresConnection } =
|
||||||
allAccounts,
|
stateProps;
|
||||||
isLedgerWallet,
|
|
||||||
hardwareWalletRequiresConnection,
|
|
||||||
} = stateProps;
|
|
||||||
const {
|
const {
|
||||||
signPersonalMessage,
|
signPersonalMessage,
|
||||||
signTypedMessage,
|
signTypedMessage,
|
||||||
|
@ -40,8 +40,7 @@ describe('Signature Request', () => {
|
|||||||
txData: {
|
txData: {
|
||||||
msgParams: {
|
msgParams: {
|
||||||
id: 1,
|
id: 1,
|
||||||
data:
|
data: '{"types":{"EIP712Domain":[{"name":"name","type":"string"},{"name":"version","type":"string"},{"name":"chainId","type":"uint256"},{"name":"verifyingContract","type":"address"}],"Person":[{"name":"name","type":"string"},{"name":"wallet","type":"address"}],"Mail":[{"name":"from","type":"Person"},{"name":"to","type":"Person"},{"name":"contents","type":"string"}]},"primaryType":"Mail","domain":{"name":"Ether Mail","version":"1","chainId":"4","verifyingContract":"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"},"message":{"from":{"name":"Cow","wallet":"0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"},"to":{"name":"Bob","wallet":"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"},"contents":"Hello, Bob!"}}',
|
||||||
'{"types":{"EIP712Domain":[{"name":"name","type":"string"},{"name":"version","type":"string"},{"name":"chainId","type":"uint256"},{"name":"verifyingContract","type":"address"}],"Person":[{"name":"name","type":"string"},{"name":"wallet","type":"address"}],"Mail":[{"name":"from","type":"Person"},{"name":"to","type":"Person"},{"name":"contents","type":"string"}]},"primaryType":"Mail","domain":{"name":"Ether Mail","version":"1","chainId":"4","verifyingContract":"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"},"message":{"from":{"name":"Cow","wallet":"0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"},"to":{"name":"Bob","wallet":"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"},"contents":"Hello, Bob!"}}',
|
|
||||||
from: '0xd8f6a2ffb0fc5952d16c9768b71cfd35b6399aa5',
|
from: '0xd8f6a2ffb0fc5952d16c9768b71cfd35b6399aa5',
|
||||||
origin: 'test.domain',
|
origin: 'test.domain',
|
||||||
},
|
},
|
||||||
|
@ -1738,16 +1738,13 @@ describe('srp-input', () => {
|
|||||||
it('should be updated on paste to allow room for a longer SRP', async () => {
|
it('should be updated on paste to allow room for a longer SRP', async () => {
|
||||||
const onChange = jest.fn();
|
const onChange = jest.fn();
|
||||||
|
|
||||||
const {
|
const { getByTestId, queryByTestId, queryByRole } =
|
||||||
getByTestId,
|
renderWithLocalization(
|
||||||
queryByTestId,
|
<SrpInput
|
||||||
queryByRole,
|
onChange={onChange}
|
||||||
} = renderWithLocalization(
|
srpText={enLocale.secretRecoveryPhrase.message}
|
||||||
<SrpInput
|
/>,
|
||||||
onChange={onChange}
|
);
|
||||||
srpText={enLocale.secretRecoveryPhrase.message}
|
|
||||||
/>,
|
|
||||||
);
|
|
||||||
getByTestId('import-srp__srp-word-0').focus();
|
getByTestId('import-srp__srp-word-0').focus();
|
||||||
await userEvent.paste(new Array(15).fill('test').join(' '));
|
await userEvent.paste(new Array(15).fill('test').join(' '));
|
||||||
|
|
||||||
@ -1764,17 +1761,13 @@ describe('srp-input', () => {
|
|||||||
it('should be updated on paste to match the size of a shorter SRP', async () => {
|
it('should be updated on paste to match the size of a shorter SRP', async () => {
|
||||||
const onChange = jest.fn();
|
const onChange = jest.fn();
|
||||||
|
|
||||||
const {
|
const { getByRole, getByTestId, queryByTestId, queryByRole } =
|
||||||
getByRole,
|
renderWithLocalization(
|
||||||
getByTestId,
|
<SrpInput
|
||||||
queryByTestId,
|
onChange={onChange}
|
||||||
queryByRole,
|
srpText={enLocale.secretRecoveryPhrase.message}
|
||||||
} = renderWithLocalization(
|
/>,
|
||||||
<SrpInput
|
);
|
||||||
onChange={onChange}
|
|
||||||
srpText={enLocale.secretRecoveryPhrase.message}
|
|
||||||
/>,
|
|
||||||
);
|
|
||||||
await userEvent.selectOptions(getByRole('combobox'), '15');
|
await userEvent.selectOptions(getByRole('combobox'), '15');
|
||||||
getByTestId('import-srp__srp-word-0').focus();
|
getByTestId('import-srp__srp-word-0').focus();
|
||||||
await userEvent.paste(correct);
|
await userEvent.paste(correct);
|
||||||
@ -1792,16 +1785,13 @@ describe('srp-input', () => {
|
|||||||
it('should round up to nearest valid size on paste when SRP has an invalid number of words', async () => {
|
it('should round up to nearest valid size on paste when SRP has an invalid number of words', async () => {
|
||||||
const onChange = jest.fn();
|
const onChange = jest.fn();
|
||||||
|
|
||||||
const {
|
const { getByTestId, queryByTestId, queryByRole } =
|
||||||
getByTestId,
|
renderWithLocalization(
|
||||||
queryByTestId,
|
<SrpInput
|
||||||
queryByRole,
|
onChange={onChange}
|
||||||
} = renderWithLocalization(
|
srpText={enLocale.secretRecoveryPhrase.message}
|
||||||
<SrpInput
|
/>,
|
||||||
onChange={onChange}
|
);
|
||||||
srpText={enLocale.secretRecoveryPhrase.message}
|
|
||||||
/>,
|
|
||||||
);
|
|
||||||
getByTestId('import-srp__srp-word-0').focus();
|
getByTestId('import-srp__srp-word-0').focus();
|
||||||
await userEvent.paste(invalidWordCount);
|
await userEvent.paste(invalidWordCount);
|
||||||
|
|
||||||
|
@ -7,32 +7,28 @@ describe('TransactionActivityLog Component', () => {
|
|||||||
const activities = [
|
const activities = [
|
||||||
{
|
{
|
||||||
eventKey: 'transactionCreated',
|
eventKey: 'transactionCreated',
|
||||||
hash:
|
hash: '0xe46c7f9b39af2fbf1c53e66f72f80343ab54c2c6dba902d51fb98ada08fe1a63',
|
||||||
'0xe46c7f9b39af2fbf1c53e66f72f80343ab54c2c6dba902d51fb98ada08fe1a63',
|
|
||||||
id: 2005383477493174,
|
id: 2005383477493174,
|
||||||
timestamp: 1543957986150,
|
timestamp: 1543957986150,
|
||||||
value: '0x2386f26fc10000',
|
value: '0x2386f26fc10000',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
eventKey: 'transactionSubmitted',
|
eventKey: 'transactionSubmitted',
|
||||||
hash:
|
hash: '0xe46c7f9b39af2fbf1c53e66f72f80343ab54c2c6dba902d51fb98ada08fe1a63',
|
||||||
'0xe46c7f9b39af2fbf1c53e66f72f80343ab54c2c6dba902d51fb98ada08fe1a63',
|
|
||||||
id: 2005383477493174,
|
id: 2005383477493174,
|
||||||
timestamp: 1543957987853,
|
timestamp: 1543957987853,
|
||||||
value: '0x1319718a5000',
|
value: '0x1319718a5000',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
eventKey: 'transactionResubmitted',
|
eventKey: 'transactionResubmitted',
|
||||||
hash:
|
hash: '0x7d09d337fc6f5d6fe2dbf3a6988d69532deb0a82b665f9180b5a20db377eea87',
|
||||||
'0x7d09d337fc6f5d6fe2dbf3a6988d69532deb0a82b665f9180b5a20db377eea87',
|
|
||||||
id: 2005383477493175,
|
id: 2005383477493175,
|
||||||
timestamp: 1543957991563,
|
timestamp: 1543957991563,
|
||||||
value: '0x1502634b5800',
|
value: '0x1502634b5800',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
eventKey: 'transactionConfirmed',
|
eventKey: 'transactionConfirmed',
|
||||||
hash:
|
hash: '0x7d09d337fc6f5d6fe2dbf3a6988d69532deb0a82b665f9180b5a20db377eea87',
|
||||||
'0x7d09d337fc6f5d6fe2dbf3a6988d69532deb0a82b665f9180b5a20db377eea87',
|
|
||||||
id: 2005383477493175,
|
id: 2005383477493175,
|
||||||
timestamp: 1543958029960,
|
timestamp: 1543958029960,
|
||||||
value: '0x1502634b5800',
|
value: '0x1502634b5800',
|
||||||
@ -75,16 +71,14 @@ describe('TransactionActivityLog Component', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
eventKey: 'transactionResubmitted',
|
eventKey: 'transactionResubmitted',
|
||||||
hash:
|
hash: '0x7d09d337fc6f5d6fe2dbf3a6988d69532deb0a82b665f9180b5a20db377eea87',
|
||||||
'0x7d09d337fc6f5d6fe2dbf3a6988d69532deb0a82b665f9180b5a20db377eea87',
|
|
||||||
id: 2,
|
id: 2,
|
||||||
timestamp: 3,
|
timestamp: 3,
|
||||||
value: '0x1',
|
value: '0x1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
eventKey: 'transactionCancelAttempted',
|
eventKey: 'transactionCancelAttempted',
|
||||||
hash:
|
hash: '0x7d09d337fc6f5d6fe2dbf3a6988d69532deb0a82b665f9180b5a20db377eea87',
|
||||||
'0x7d09d337fc6f5d6fe2dbf3a6988d69532deb0a82b665f9180b5a20db377eea87',
|
|
||||||
id: 3,
|
id: 3,
|
||||||
timestamp: 4,
|
timestamp: 4,
|
||||||
value: '0x1',
|
value: '0x1',
|
||||||
@ -131,16 +125,14 @@ describe('TransactionActivityLog Component', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
eventKey: 'transactionResubmitted',
|
eventKey: 'transactionResubmitted',
|
||||||
hash:
|
hash: '0x7d09d337fc6f5d6fe2dbf3a6988d69532deb0a82b665f9180b5a20db377eea87',
|
||||||
'0x7d09d337fc6f5d6fe2dbf3a6988d69532deb0a82b665f9180b5a20db377eea87',
|
|
||||||
id: 2,
|
id: 2,
|
||||||
timestamp: 3,
|
timestamp: 3,
|
||||||
value: '0x1',
|
value: '0x1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
eventKey: 'transactionCancelAttempted',
|
eventKey: 'transactionCancelAttempted',
|
||||||
hash:
|
hash: '0x7d09d337fc6f5d6fe2dbf3a6988d69532deb0a82b665f9180b5a20db377eea87',
|
||||||
'0x7d09d337fc6f5d6fe2dbf3a6988d69532deb0a82b665f9180b5a20db377eea87',
|
|
||||||
id: 3,
|
id: 3,
|
||||||
timestamp: 4,
|
timestamp: 4,
|
||||||
value: '0x1',
|
value: '0x1',
|
||||||
|
@ -12,8 +12,10 @@ import {
|
|||||||
TRANSACTION_CANCEL_ATTEMPTED_EVENT,
|
TRANSACTION_CANCEL_ATTEMPTED_EVENT,
|
||||||
} from './transaction-activity-log.constants';
|
} from './transaction-activity-log.constants';
|
||||||
|
|
||||||
const matchesEventKey = (matchEventKey) => ({ eventKey }) =>
|
const matchesEventKey =
|
||||||
eventKey === matchEventKey;
|
(matchEventKey) =>
|
||||||
|
({ eventKey }) =>
|
||||||
|
eventKey === matchEventKey;
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
return {
|
return {
|
||||||
|
@ -21,8 +21,7 @@ describe('TransactionActivityLog utils', () => {
|
|||||||
it('should return activities for an array of transactions', () => {
|
it('should return activities for an array of transactions', () => {
|
||||||
const transactions = [
|
const transactions = [
|
||||||
{
|
{
|
||||||
hash:
|
hash: '0xa14f13d36b3901e352ce3a7acb9b47b001e5a3370f06232a0953c6fc6fad91b3',
|
||||||
'0xa14f13d36b3901e352ce3a7acb9b47b001e5a3370f06232a0953c6fc6fad91b3',
|
|
||||||
history: [
|
history: [
|
||||||
{
|
{
|
||||||
id: 6400627574331058,
|
id: 6400627574331058,
|
||||||
@ -92,8 +91,7 @@ describe('TransactionActivityLog utils', () => {
|
|||||||
type: TRANSACTION_TYPES.STANDARD,
|
type: TRANSACTION_TYPES.STANDARD,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
hash:
|
hash: '0xecbe181ee67c4291d04a7cb9ffbf1d5d831e4fbaa89994fd06bab5dd4cc79b33',
|
||||||
'0xecbe181ee67c4291d04a7cb9ffbf1d5d831e4fbaa89994fd06bab5dd4cc79b33',
|
|
||||||
history: [
|
history: [
|
||||||
{
|
{
|
||||||
id: 6400627574331060,
|
id: 6400627574331060,
|
||||||
@ -195,8 +193,7 @@ describe('TransactionActivityLog utils', () => {
|
|||||||
id: 6400627574331058,
|
id: 6400627574331058,
|
||||||
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
||||||
chainId: ROPSTEN_CHAIN_ID,
|
chainId: ROPSTEN_CHAIN_ID,
|
||||||
hash:
|
hash: '0xa14f13d36b3901e352ce3a7acb9b47b001e5a3370f06232a0953c6fc6fad91b3',
|
||||||
'0xa14f13d36b3901e352ce3a7acb9b47b001e5a3370f06232a0953c6fc6fad91b3',
|
|
||||||
eventKey: 'transactionCreated',
|
eventKey: 'transactionCreated',
|
||||||
timestamp: 1543958845581,
|
timestamp: 1543958845581,
|
||||||
value: '0x2386f26fc10000',
|
value: '0x2386f26fc10000',
|
||||||
@ -205,8 +202,7 @@ describe('TransactionActivityLog utils', () => {
|
|||||||
id: 6400627574331058,
|
id: 6400627574331058,
|
||||||
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
||||||
chainId: ROPSTEN_CHAIN_ID,
|
chainId: ROPSTEN_CHAIN_ID,
|
||||||
hash:
|
hash: '0xa14f13d36b3901e352ce3a7acb9b47b001e5a3370f06232a0953c6fc6fad91b3',
|
||||||
'0xa14f13d36b3901e352ce3a7acb9b47b001e5a3370f06232a0953c6fc6fad91b3',
|
|
||||||
eventKey: 'transactionSubmitted',
|
eventKey: 'transactionSubmitted',
|
||||||
timestamp: 1543958848147,
|
timestamp: 1543958848147,
|
||||||
value: '0x1319718a5000',
|
value: '0x1319718a5000',
|
||||||
@ -215,8 +211,7 @@ describe('TransactionActivityLog utils', () => {
|
|||||||
id: 6400627574331060,
|
id: 6400627574331060,
|
||||||
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
||||||
chainId: ROPSTEN_CHAIN_ID,
|
chainId: ROPSTEN_CHAIN_ID,
|
||||||
hash:
|
hash: '0xecbe181ee67c4291d04a7cb9ffbf1d5d831e4fbaa89994fd06bab5dd4cc79b33',
|
||||||
'0xecbe181ee67c4291d04a7cb9ffbf1d5d831e4fbaa89994fd06bab5dd4cc79b33',
|
|
||||||
eventKey: 'transactionResubmitted',
|
eventKey: 'transactionResubmitted',
|
||||||
timestamp: 1543958860061,
|
timestamp: 1543958860061,
|
||||||
value: '0x171c3a061400',
|
value: '0x171c3a061400',
|
||||||
@ -225,8 +220,7 @@ describe('TransactionActivityLog utils', () => {
|
|||||||
id: 6400627574331060,
|
id: 6400627574331060,
|
||||||
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
metamaskNetworkId: ROPSTEN_NETWORK_ID,
|
||||||
chainId: ROPSTEN_CHAIN_ID,
|
chainId: ROPSTEN_CHAIN_ID,
|
||||||
hash:
|
hash: '0xecbe181ee67c4291d04a7cb9ffbf1d5d831e4fbaa89994fd06bab5dd4cc79b33',
|
||||||
'0xecbe181ee67c4291d04a7cb9ffbf1d5d831e4fbaa89994fd06bab5dd4cc79b33',
|
|
||||||
eventKey: 'transactionConfirmed',
|
eventKey: 'transactionConfirmed',
|
||||||
timestamp: 1543958897165,
|
timestamp: 1543958897165,
|
||||||
value: '0x171c3a061400',
|
value: '0x171c3a061400',
|
||||||
|
@ -40,7 +40,8 @@ export default function TransactionDetailItem({
|
|||||||
</Typography>
|
</Typography>
|
||||||
<div
|
<div
|
||||||
className={classnames('transaction-detail-item__detail-values', {
|
className={classnames('transaction-detail-item__detail-values', {
|
||||||
'transaction-detail-item__detail-values--flex-width': flexWidthValues,
|
'transaction-detail-item__detail-values--flex-width':
|
||||||
|
flexWidthValues,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{detailText && (
|
{detailText && (
|
||||||
|
@ -27,18 +27,10 @@ export default function SmartTransactionListItem({
|
|||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
const [cancelSwapLinkClicked, setCancelSwapLinkClicked] = useState(false);
|
const [cancelSwapLinkClicked, setCancelSwapLinkClicked] = useState(false);
|
||||||
const [showDetails, setShowDetails] = useState(false);
|
const [showDetails, setShowDetails] = useState(false);
|
||||||
const {
|
const { primaryCurrency, recipientAddress, isPending, senderAddress } =
|
||||||
primaryCurrency,
|
useTransactionDisplayData(transactionGroup);
|
||||||
recipientAddress,
|
const { sourceTokenSymbol, destinationTokenSymbol, time, status } =
|
||||||
isPending,
|
smartTransaction;
|
||||||
senderAddress,
|
|
||||||
} = useTransactionDisplayData(transactionGroup);
|
|
||||||
const {
|
|
||||||
sourceTokenSymbol,
|
|
||||||
destinationTokenSymbol,
|
|
||||||
time,
|
|
||||||
status,
|
|
||||||
} = smartTransaction;
|
|
||||||
const category = TRANSACTION_GROUP_CATEGORIES.SWAP;
|
const category = TRANSACTION_GROUP_CATEGORIES.SWAP;
|
||||||
const title = t('swapTokenToToken', [
|
const title = t('swapTokenToToken', [
|
||||||
sourceTokenSymbol,
|
sourceTokenSymbol,
|
||||||
|
@ -50,9 +50,8 @@ function TransactionListItemInner({
|
|||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const { hasCancelled } = transactionGroup;
|
const { hasCancelled } = transactionGroup;
|
||||||
const [showDetails, setShowDetails] = useState(false);
|
const [showDetails, setShowDetails] = useState(false);
|
||||||
const [showCancelEditGasPopover, setShowCancelEditGasPopover] = useState(
|
const [showCancelEditGasPopover, setShowCancelEditGasPopover] =
|
||||||
false,
|
useState(false);
|
||||||
);
|
|
||||||
const [showRetryEditGasPopover, setShowRetryEditGasPopover] = useState(false);
|
const [showRetryEditGasPopover, setShowRetryEditGasPopover] = useState(false);
|
||||||
const { supportsEIP1559V2 } = useGasFeeContext();
|
const { supportsEIP1559V2 } = useGasFeeContext();
|
||||||
const { openModal } = useTransactionModalContext();
|
const { openModal } = useTransactionModalContext();
|
||||||
|
@ -23,8 +23,7 @@ function getActionFunctionById(id, history) {
|
|||||||
const actionFunctions = {
|
const actionFunctions = {
|
||||||
2: () => {
|
2: () => {
|
||||||
global.platform.openTab({
|
global.platform.openTab({
|
||||||
url:
|
url: 'https://survey.alchemer.com/s3/6173069/MetaMask-Extension-NPS-January-2021',
|
||||||
'https://survey.alchemer.com/s3/6173069/MetaMask-Extension-NPS-January-2021',
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
3: () => {
|
3: () => {
|
||||||
|
@ -7,8 +7,7 @@ import {
|
|||||||
import DefinitionList from './definition-list';
|
import DefinitionList from './definition-list';
|
||||||
|
|
||||||
const basic = {
|
const basic = {
|
||||||
term:
|
term: 'a word or phrase used to describe a thing or to express a concept, especially in a particular kind of language or branch of study.',
|
||||||
'a word or phrase used to describe a thing or to express a concept, especially in a particular kind of language or branch of study.',
|
|
||||||
definition:
|
definition:
|
||||||
'a statement of the exact meaning of a word, especially in a dictionary.',
|
'a statement of the exact meaning of a word, especially in a dictionary.',
|
||||||
dl: 'HTML tag denoting a definition list',
|
dl: 'HTML tag denoting a definition list',
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user