Skip to content

Commit

Permalink
Merge branch 'develop' into currency-display-rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwing authored Jun 13, 2023
2 parents 4afb95f + 6c3f31d commit b12c7e9
Show file tree
Hide file tree
Showing 44 changed files with 621 additions and 719 deletions.
17 changes: 8 additions & 9 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,10 +513,12 @@ export default class MetamaskController extends EventEmitter {
this.networkController.getProviderAndBlockTracker().provider,
// NOTE: This option is inaccurately named; it should be called
// onNetworkDidChange
onNetworkStateChange: networkControllerMessenger.subscribe.bind(
networkControllerMessenger,
'NetworkController:networkDidChange',
),
onNetworkStateChange: (eventHandler) => {
networkControllerMessenger.subscribe(
'NetworkController:networkDidChange',
() => eventHandler(this.networkController.store.getState()),
);
},
getCurrentNetworkEIP1559Compatibility:
this.networkController.getEIP1559Compatibility.bind(
this.networkController,
Expand All @@ -530,11 +532,8 @@ export default class MetamaskController extends EventEmitter {
this.networkController.store.getState().providerConfig;
return process.env.IN_TEST || chainId === CHAIN_IDS.MAINNET;
},
getChainId: () => {
return process.env.IN_TEST
? CHAIN_IDS.MAINNET
: this.networkController.store.getState().providerConfig.chainId;
},
getChainId: () =>
this.networkController.store.getState().providerConfig.chainId,
});

this.qrHardwareKeyring = new QRHardwareKeyring();
Expand Down
26 changes: 2 additions & 24 deletions lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1467,36 +1467,14 @@
"setInterval": true
},
"packages": {
"@metamask/gas-fee-controller>@metamask/base-controller": true,
"@metamask/gas-fee-controller>@metamask/controller-utils": true,
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"eth-query": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true,
"uuid": true
}
},
"@metamask/gas-fee-controller>@metamask/base-controller": {
"packages": {
"immer": true
}
},
"@metamask/gas-fee-controller>@metamask/controller-utils": {
"globals": {
"URL": true,
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/jazzicon": {
"globals": {
"document.createElement": true,
Expand Down
26 changes: 2 additions & 24 deletions lavamoat/browserify/desktop/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1538,36 +1538,14 @@
"setInterval": true
},
"packages": {
"@metamask/gas-fee-controller>@metamask/base-controller": true,
"@metamask/gas-fee-controller>@metamask/controller-utils": true,
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"eth-query": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true,
"uuid": true
}
},
"@metamask/gas-fee-controller>@metamask/base-controller": {
"packages": {
"immer": true
}
},
"@metamask/gas-fee-controller>@metamask/controller-utils": {
"globals": {
"URL": true,
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/jazzicon": {
"globals": {
"document.createElement": true,
Expand Down
26 changes: 2 additions & 24 deletions lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1538,36 +1538,14 @@
"setInterval": true
},
"packages": {
"@metamask/gas-fee-controller>@metamask/base-controller": true,
"@metamask/gas-fee-controller>@metamask/controller-utils": true,
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"eth-query": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true,
"uuid": true
}
},
"@metamask/gas-fee-controller>@metamask/base-controller": {
"packages": {
"immer": true
}
},
"@metamask/gas-fee-controller>@metamask/controller-utils": {
"globals": {
"URL": true,
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/jazzicon": {
"globals": {
"document.createElement": true,
Expand Down
26 changes: 2 additions & 24 deletions lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1467,36 +1467,14 @@
"setInterval": true
},
"packages": {
"@metamask/gas-fee-controller>@metamask/base-controller": true,
"@metamask/gas-fee-controller>@metamask/controller-utils": true,
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"eth-query": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true,
"uuid": true
}
},
"@metamask/gas-fee-controller>@metamask/base-controller": {
"packages": {
"immer": true
}
},
"@metamask/gas-fee-controller>@metamask/controller-utils": {
"globals": {
"URL": true,
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/jazzicon": {
"globals": {
"document.createElement": true,
Expand Down
26 changes: 2 additions & 24 deletions lavamoat/browserify/mmi/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1688,36 +1688,14 @@
"setInterval": true
},
"packages": {
"@metamask/gas-fee-controller>@metamask/base-controller": true,
"@metamask/gas-fee-controller>@metamask/controller-utils": true,
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"eth-query": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true,
"uuid": true
}
},
"@metamask/gas-fee-controller>@metamask/base-controller": {
"packages": {
"immer": true
}
},
"@metamask/gas-fee-controller>@metamask/controller-utils": {
"globals": {
"URL": true,
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/jazzicon": {
"globals": {
"document.createElement": true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
"@metamask/eth-token-tracker": "^4.0.0",
"@metamask/eth-trezor-keyring": "^1.0.0",
"@metamask/etherscan-link": "^2.2.0",
"@metamask/gas-fee-controller": "^5.0.0",
"@metamask/gas-fee-controller": "^6.0.0",
"@metamask/jazzicon": "^2.0.0",
"@metamask/key-tree": "^7.0.0",
"@metamask/logo": "^3.1.1",
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/mock-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async function setupMocking(server, testSpecificMock) {
});

await server
.forGet('https://gas-api.metaswap.codefi.network/networks/1/gasPrices')
.forGet('https://gas-api.metaswap.codefi.network/networks/1337/gasPrices')
.thenCallback(() => {
return {
statusCode: 200,
Expand Down Expand Up @@ -130,7 +130,7 @@ async function setupMocking(server, testSpecificMock) {

await server
.forGet(
'https://gas-api.metaswap.codefi.network/networks/1/suggestedGasFees',
'https://gas-api.metaswap.codefi.network/networks/1337/suggestedGasFees',
)
.thenCallback(() => {
return {
Expand Down
12 changes: 7 additions & 5 deletions test/e2e/tests/add-account.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Add account', function () {
'[data-testid="multichain-account-menu-add-account"]',
);

await driver.fill('.new-account-create-form input', '2nd account');
await driver.fill('[placeholder="Account 2"]', '2nd account');
await driver.clickElement({ text: 'Create', tag: 'button' });
const accountName = await driver.waitForSelector({
css: '[data-testid="account-menu-icon"]',
Expand Down Expand Up @@ -86,7 +86,7 @@ describe('Add account', function () {
await driver.clickElement(
'[data-testid="multichain-account-menu-add-account"]',
);
await driver.fill('.new-account-create-form input', '2nd account');
await driver.fill('[placeholder="Account 2"]', '2nd account');
await driver.clickElement({ text: 'Create', tag: 'button' });
await waitForAccountRendered(driver);

Expand Down Expand Up @@ -190,8 +190,7 @@ describe('Add account', function () {
await driver.clickElement(
'[data-testid="multichain-account-menu-add-account"]',
);

await driver.fill('.new-account-create-form input', '2nd account');
await driver.fill('[placeholder="Account 2"]', '2nd account');
await driver.clickElement({ text: 'Create', tag: 'button' });

// Wait for 2nd account to be created
Expand Down Expand Up @@ -220,7 +219,10 @@ describe('Add account', function () {
await driver.clickElement('.menu__background');
await driver.clickElement({ text: 'Import account', tag: 'button' });
await driver.fill('#private-key-box', testPrivateKey);
await driver.clickElement({ text: 'Import', tag: 'button' });

await driver.clickElement(
'[data-testid="import-account-confirm-button"]',
);

// Wait for 3rd account to be created
await waitForAccountRendered(driver);
Expand Down
21 changes: 13 additions & 8 deletions test/e2e/tests/from-import-ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('MetaMask Import UI', function () {
await driver.clickElement({ text: 'Add account', tag: 'button' });

// set account name
await driver.fill('.new-account-create-form input', '2nd account');
await driver.fill('[placeholder="Account 2"]', '2nd account');
await driver.delay(regularDelayMs);
await driver.clickElement({ text: 'Create', tag: 'button' });

Expand Down Expand Up @@ -203,7 +203,9 @@ describe('MetaMask Import UI', function () {
// enter private key
await driver.findClickableElement('#private-key-box');
await driver.fill('#private-key-box', testPrivateKey1);
await driver.clickElement({ text: 'Import', tag: 'button' });
await driver.clickElement(
'[data-testid="import-account-confirm-button"]',
);

// should show the correct account name
const importedAccountName = await driver.findElement(
Expand All @@ -230,8 +232,9 @@ describe('MetaMask Import UI', function () {
// enter private key
await driver.findClickableElement('#private-key-box');
await driver.fill('#private-key-box', testPrivateKey2);
await driver.findClickableElement({ text: 'Import', tag: 'button' });
await driver.clickElement({ text: 'Import', tag: 'button' });
await driver.clickElement(
'[data-testid="import-account-confirm-button"]',
);

// should see new account in account menu
const importedAccount2Name = await driver.findElement(
Expand Down Expand Up @@ -303,8 +306,9 @@ describe('MetaMask Import UI', function () {
fileInput.sendKeys(importJsonFile);

await driver.fill('#json-password-box', 'foobarbazqux');

await driver.clickElement({ text: 'Import', tag: 'button' });
await driver.clickElement(
'[data-testid="import-account-confirm-button"]',
);

// should show the correct account name
const importedAccountName = await driver.findElement(
Expand Down Expand Up @@ -358,8 +362,9 @@ describe('MetaMask Import UI', function () {
// enter private key
await driver.findClickableElement('#private-key-box');
await driver.fill('#private-key-box', testPrivateKey);
await driver.findClickableElement({ text: 'Import', tag: 'button' });
await driver.clickElement({ text: 'Import', tag: 'button' });
await driver.clickElement(
'[data-testid="import-account-confirm-button"]',
);

// error should occur
await driver.waitForSelector({
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/network-error.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Gas API fallback', function () {
async function mockGasApiDown(mockServer) {
await mockServer
.forGet(
'https://gas-api.metaswap.codefi.network/networks/1/suggestedGasFees',
'https://gas-api.metaswap.codefi.network/networks/1337/suggestedGasFees',
)
.always()
.thenCallback(() => {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/user-actions-benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function loadNewAccount() {
await driver.clickElement(
'[data-testid="multichain-account-menu-add-account"]',
);
await driver.fill('.new-account-create-form input', '2nd account');
await driver.fill('[placeholder="Account 2"]', '2nd account');
await driver.clickElement({ text: 'Create', tag: 'button' });
await driver.waitForSelector({
css: '.currency-display-component__text',
Expand Down
Loading

0 comments on commit b12c7e9

Please sign in to comment.