Skip to content

Commit

Permalink
Merge branch 'develop' into feat-update-permit-redesign-spending-cap-…
Browse files Browse the repository at this point in the history
…copy
  • Loading branch information
digiwand authored Jul 2, 2024
2 parents 35fb71e + 7d94797 commit 7a95f8d
Show file tree
Hide file tree
Showing 43 changed files with 988 additions and 257 deletions.
12 changes: 9 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ develop_master_rc_only: &develop_master_rc_only
- master
- /^Version-v(\d+)[.](\d+)[.](\d+)/

exclude_develop_master_rc: &exclude_develop_master_rc
filters:
branches:
ignore:
- develop
- master
- /^Version-v(\d+)[.](\d+)[.](\d+)/
aliases:
# Shallow Git Clone
- &shallow-git-clone
Expand Down Expand Up @@ -106,6 +113,7 @@ workflows:
- check-pr-tag
- prep-deps
- get-changed-files-with-git-diff:
<<: *exclude_develop_master_rc
requires:
- prep-deps
- test-deps-audit:
Expand Down Expand Up @@ -203,7 +211,6 @@ workflows:
<<: *develop_master_rc_only
requires:
- prep-build-confirmation-redesign-test-mv2
- get-changed-files-with-git-diff
- test-e2e-chrome-rpc:
requires:
- prep-build-test
Expand All @@ -223,7 +230,6 @@ workflows:
<<: *develop_master_rc_only
requires:
- prep-build-test-flask-mv2
- get-changed-files-with-git-diff
- test-e2e-chrome-mmi:
requires:
- prep-build-test-mmi
Expand All @@ -243,7 +249,6 @@ workflows:
- /^Version-v(\d+)[.](\d+)[.](\d+)/
requires:
- prep-build
- get-changed-files-with-git-diff
- test-unit-jest-main:
requires:
- prep-deps
Expand Down Expand Up @@ -488,6 +493,7 @@ jobs:

# This job is used for the e2e quality gate.
# It must be run before any job which uses the run-all.js script.
# The job is skipped in develop, master or RC branches.
get-changed-files-with-git-diff:
executor: node-browsers-small
steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/dist/ledger-keyring.js b/dist/ledger-keyring.js
index 2386b2e7fe36d1e65ef74f0a19d3b41450dcfa48..f999a0ab465cce7a450a5812f1d7aa6e39b74aed 100644
--- a/dist/ledger-keyring.js
+++ b/dist/ledger-keyring.js
@@ -150,7 +150,12 @@ class LedgerKeyring extends events_1.EventEmitter {
});
}
catch (error) {
- throw error instanceof Error ? error : new Error('Unknown error');
+
+ /**
+ * For Fixing issue 22837, when ledger is locked and didnt open the ethereum app in ledger,
+ * The extension will always show `unknown error`, below change will transform the error to something meaningful.
+ */
+ throw error instanceof Error ? error : new Error('Unlock your Ledger device and open the ETH app');
}
if (updateHdk && payload.chainCode) {
this.hdk.publicKey = buffer_1.Buffer.from(payload.publicKey, 'hex');
24 changes: 15 additions & 9 deletions development/generate-rc-commits.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,31 @@ const authorTeams = {
'Niranjana Binoy',
'Victor Thomas',
'vthomas13',
'seaona',
'Norbert Elter',
],
DappAPI: ['tmashuang', 'jiexi', 'BelfordZ', 'Shane'],
'Confirmation UX': [
'Wallet API': ['tmashuang', 'jiexi', 'BelfordZ', 'Shane'],
Confirmations: [
'Pedro Figueiredo',
'Sylva Elendu',
'Olusegun Akintayo',
'Jyoti Puri',
'Ariella Vu',
'seaona',
],
'Confirmation Systems': [
'OGPoyraz',
'vinistevam',
'Matthew Walsh',
'cryptotavares',
'Vinicius Stevam',
'Derek Brans',
'sleepytanya',
'Priya',
],
'Design Systems': [
'georgewrmarshall',
'Garrett Bear',
'George Marshall',
'Devin',
],
'Design Systems': ['georgewrmarshall', 'Garrett Bear', 'George Marshall'],
Snaps: [
'David Drazic',
'hmalik88',
Expand All @@ -84,7 +89,7 @@ const authorTeams = {
Assets: ['salimtb', 'sahar-fehri', 'Brian Bergeron'],
Linea: ['VGau', 'Victorien Gauch'],
lavamoat: ['weizman', 'legobeat', 'kumavis', 'LeoTM'],
'Shared Libraries': [
'Wallet Framework': [
'Michele Esposito',
'Elliot Winkler',
'Gudahtt',
Expand All @@ -98,10 +103,11 @@ const authorTeams = {
'Shane T',
'Bernardo Garces Chapero',
],
Swaps: ['Daniel', 'Davide Brocchetto', 'Nicolas Ferro'],
Swaps: ['Daniel', 'Davide Brocchetto', 'Nicolas Ferro', 'infiniteflower'],
Devex: ['Thomas Huang', 'Alex Donesky', 'jiexi', 'Zachary Belford'],
Notifications: ['Prithpal-Sooriya', 'Matteo Scurati', 'Prithpal Sooriya'],
Bridging: ['Bilal', 'micaelae'],
Bridging: ['Bilal', 'micaelae', 'Ethan Wessel'],
Ramps: ['George Weiler'],
};

// Function to get PR labels
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
"@metamask/ens-controller": "^10.0.1",
"@metamask/eth-json-rpc-filters": "^7.0.0",
"@metamask/eth-json-rpc-middleware": "^12.1.1",
"@metamask/eth-ledger-bridge-keyring": "^2.0.1",
"@metamask/eth-ledger-bridge-keyring": "patch:@metamask/eth-ledger-bridge-keyring@npm%3A2.0.1#~/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch",
"@metamask/eth-query": "^4.0.0",
"@metamask/eth-sig-util": "^7.0.1",
"@metamask/eth-snap-keyring": "^4.3.1",
Expand Down
48 changes: 48 additions & 0 deletions test/e2e/accounts/snap-account-eth-swap.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { withFixtures, defaultGanacheOptions, WINDOW_TITLES } from '../helpers';
import { Driver } from '../webdriver/driver';
import FixtureBuilder from '../fixture-builder';
import {
buildQuote,
reviewQuote,
waitForTransactionToComplete,
checkActivityTransaction,
} from '../tests/swaps/shared';
import { installSnapSimpleKeyring } from './common';

const DAI = 'DAI';
const TEST_ETH = 'TESTETH';

describe('Snap Account - Swap', function () {
it('swaps ETH for DAI using a snap account', async function () {
await withFixtures(
{
fixtures: new FixtureBuilder().build(),
ganacheOptions: defaultGanacheOptions,
title: this.test?.fullTitle(),
},
async ({ driver }: { driver: Driver }) => {
await installSnapSimpleKeyring(driver, false);
await driver.switchToWindowWithTitle(
WINDOW_TITLES.ExtensionInFullScreenView,
);
await buildQuote(driver, {
amount: 0.001,
swapTo: DAI,
});
await reviewQuote(driver, {
amount: 0.001,
swapFrom: TEST_ETH,
swapTo: DAI,
});
await driver.clickElement({ text: 'Swap', tag: 'button' });
await waitForTransactionToComplete(driver, { tokenName: 'DAI' });
await checkActivityTransaction(driver, {
index: 0,
amount: '0.001',
swapFrom: TEST_ETH,
swapTo: DAI,
});
},
);
});
});
2 changes: 1 addition & 1 deletion test/e2e/changedFilesUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function readChangedFiles() {
return changedFiles;
} catch (error) {
console.error('Error reading from file:', error);
return '';
return [];
}
}

Expand Down
3 changes: 3 additions & 0 deletions test/e2e/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ export const TEST_SNAPS_SIMPLE_KEYRING_WEBSITE_URL =

/* Address of the VerifyingPaymaster smart contract deployed to Ganache. */
export const VERIFYING_PAYMASTER = '0xbdbDEc38ed168331b1F7004cc9e5392A2272C1D7';

/* Default ganache ETH balance in decimal when first login */
export const DEFAULT_GANACHE_ETH_BALANCE_DEC = '25';
27 changes: 22 additions & 5 deletions test/e2e/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ const { PAGES } = require('./webdriver/driver');
const GanacheSeeder = require('./seeder/ganache-seeder');
const { Bundler } = require('./bundler');
const { SMART_CONTRACTS } = require('./seeder/smart-contracts');
const { ERC_4337_ACCOUNT } = require('./constants');
const {
ERC_4337_ACCOUNT,
DEFAULT_GANACHE_ETH_BALANCE_DEC,
} = require('./constants');

const tinyDelayMs = 200;
const regularDelayMs = tinyDelayMs * 2;
Expand Down Expand Up @@ -672,6 +675,14 @@ const openDapp = async (driver, contract = null, dappURL = DAPP_URL) => {
: await driver.openNewPage(dappURL);
};

const openDappConnectionsPage = async (driver) => {
await driver.openNewPage(
`${driver.extensionUrl}/home.html#connections/${encodeURIComponent(
DAPP_URL,
)}`,
);
};

const createDappTransaction = async (driver, transaction) => {
await openDapp(
driver,
Expand Down Expand Up @@ -730,25 +741,30 @@ const ACCOUNT_1 = '0x5cfe73b6021e818b776b421b1c4db2474086a7e1';
const ACCOUNT_2 = '0x09781764c08de8ca82e156bbf156a3ca217c7950';

const defaultGanacheOptions = {
accounts: [{ secretKey: PRIVATE_KEY, balance: convertETHToHexGwei(25) }],
accounts: [
{
secretKey: PRIVATE_KEY,
balance: convertETHToHexGwei(DEFAULT_GANACHE_ETH_BALANCE_DEC),
},
],
};

const multipleGanacheOptions = {
accounts: [
{
secretKey: PRIVATE_KEY,
balance: convertETHToHexGwei(25),
balance: convertETHToHexGwei(DEFAULT_GANACHE_ETH_BALANCE_DEC),
},
{
secretKey: PRIVATE_KEY_TWO,
balance: convertETHToHexGwei(25),
balance: convertETHToHexGwei(DEFAULT_GANACHE_ETH_BALANCE_DEC),
},
],
};

const generateGanacheOptions = ({
secretKey = PRIVATE_KEY,
balance = convertETHToHexGwei(25),
balance = convertETHToHexGwei(DEFAULT_GANACHE_ETH_BALANCE_DEC),
...otherProps
}) => {
const accounts = [
Expand Down Expand Up @@ -1150,6 +1166,7 @@ module.exports = {
importWrongSRPOnboardingFlow,
testSRPDropdownIterations,
openDapp,
openDappConnectionsPage,
createDappTransaction,
switchToOrOpenDapp,
connectToDapp,
Expand Down
18 changes: 18 additions & 0 deletions test/e2e/page-objects/pages/header-navbar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Driver } from '../../webdriver/driver';

class HeaderNavbar {
private driver: Driver;

private accountMenuButton: string;

constructor(driver: Driver) {
this.driver = driver;
this.accountMenuButton = '[data-testid="account-menu-icon"]';
}

async openAccountMenu(): Promise<void> {
await this.driver.clickElement(this.accountMenuButton);
}
}

export default HeaderNavbar;
Loading

0 comments on commit 7a95f8d

Please sign in to comment.