Skip to content

Commit

Permalink
Merge branch 'develop' into feat-e2e-convert-to-pw-suite-coinmarket
Browse files Browse the repository at this point in the history
  • Loading branch information
Vere-Grey authored Dec 21, 2024
2 parents 88c48a8 + d800b0e commit 1e8b305
Show file tree
Hide file tree
Showing 95 changed files with 1,733 additions and 588 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release-suite-definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ jobs:
yarn nfts simple binance-smart-chain jws
yarn nfts simple optimistic-ethereum jws
yarn nfts simple base jws
yarn nfts simple arbitrum-one jws
yarn coins simple ethereum jws
yarn coins simple ethereum-classic jws
yarn coins simple polygon-pos jws
yarn coins simple binance-smart-chain jws
yarn coins simple optimistic-ethereum jws
yarn coins simple base jws
yarn coins simple arbitrum-one jws
yarn coins simple cardano jws
yarn coins simple solana jws
yarn coins advanced solana json
Expand All @@ -70,12 +72,14 @@ jobs:
yarn nfts simple binance-smart-chain jws
yarn nfts simple optimistic-ethereum jws
yarn nfts simple base jws
yarn nfts simple arbitrum-one jws
yarn coins simple ethereum jws
yarn coins simple ethereum-classic jws
yarn coins simple polygon-pos jws
yarn coins simple binance-smart-chain jws
yarn coins simple optimistic-ethereum jws
yarn coins simple base jws
yarn coins simple arbitrum-one jws
yarn coins simple cardano jws
yarn coins simple solana jws
yarn coins advanced solana json
Expand Down
5 changes: 5 additions & 0 deletions packages/address-validator/src/currencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,11 @@ var CURRENCIES = [
symbol: 'bnb',
validator: ETHValidator,
},
{
name: 'Arbitrum One',
symbol: 'arb', // TODO
validator: ETHValidator,
},
{
name: 'Base',
symbol: 'base', // TODO
Expand Down
2 changes: 0 additions & 2 deletions packages/blockchain-link-types/src/blockbook-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ export interface Token {
secondaryValue?: number;
ids?: string[];
multiTokenValues?: MultiTokenValue[];
totalReceived?: string;
totalSent?: string;
}
export interface Address {
page?: number;
Expand Down
4 changes: 1 addition & 3 deletions packages/blockchain-link-types/src/blockbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ type BlockFiltersBatch = `${string}:${string}:${string}`[];
// XPUBAddress, ERC20, ERC721, ERC1155 - blockbook generated type (Token) is not strict enough
export type XPUBAddress = {
type: 'XPUBAddress';
} & Required<
Pick<BlockbookToken, 'path' | 'decimals' | 'balance' | 'totalSent' | 'totalReceived'>
> &
} & Required<Pick<BlockbookToken, 'path' | 'decimals' | 'balance'>> &
Pick<BlockbookToken, 'name' | 'transfers'>;

type BaseERC = Required<Pick<BlockbookToken, 'contract'>> &
Expand Down
3 changes: 2 additions & 1 deletion packages/blockchain-link-types/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
TokenTransfer as BlockbookTokenTransfer,
ContractInfo,
StakingPool,
Token,
} from './blockbook-api';
import type { SolanaStakingAccount } from './solana';

Expand Down Expand Up @@ -179,7 +180,7 @@ export interface TokenAccount {
balance: string;
}

export interface TokenInfo {
export interface TokenInfo extends Partial<Pick<Token, 'multiTokenValues' | 'ids'>> {
type: string; // token type: ERC20...
contract: string; // token address, token unit for ADA
balance?: string; // token balance
Expand Down
2 changes: 0 additions & 2 deletions packages/blockchain-link-utils/src/blockbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,6 @@ export const transformAddresses = (
path: t.path,
transfers: t.transfers,
balance: t.balance,
sent: t.totalSent,
received: t.totalReceived,
},
]);
}, [] as Address[]);
Expand Down
22 changes: 22 additions & 0 deletions packages/blockchain-link/src/ui/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,28 @@ export default [
subscribe: '',
},
},
{
blockchain: {
name: 'Arbitrum One',
worker: 'js/blockbook-worker.js',
server: ['https://arb1.trezor.io', 'https://arb2.trezor.io'],
debug: true,
},
data: {
address: '',
accountInfoOptions: {
page: 1,
pageSize: 25,
contractFilter: undefined,
},
estimateFeeOptions: {
blocks: [1, 2, 10],
},
txid: '',
tx: '',
subscribe: '',
},
},
{
blockchain: {
name: 'Base',
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/Table/TableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const Row = styled.tr<{
$isCollapsed &&
css`
visibility: collapse;
border-top: 0;
border-top: 1;
opacity: 0;
`}
Expand Down
20 changes: 20 additions & 0 deletions packages/connect-common/files/coins-eth.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,26 @@
"T3T1": "2.6.1"
}
},
{
"blockchain_link": {
"type": "blockbook",
"url": ["https://arb1.trezor.io", "https://arb2.trezor.io"]
},
"chain": "arb",
"chain_id": 42161,
"coingecko_id": "arbitrum-one",
"is_testnet": false,
"name": "Arbitrum One",
"shortcut": "ARB",
"slip44": 9001,
"support": {
"T1B1": "1.9.4",
"T2B1": "2.6.1",
"T2T1": "2.3.5",
"T3B1": "2.8.1",
"T3T1": "2.6.1"
}
},
{
"blockchain_link": {
"type": "blockbook",
Expand Down
2 changes: 1 addition & 1 deletion packages/connect/src/backend/Blockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const getNormalizedTrezorShortcut = (shortcut: string) => {
return 'XRP';
}

if (['OP', 'BASE'].includes(shortcut)) {
if (['OP', 'BASE', 'ARB'].includes(shortcut)) {
return 'ETH';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ describe('utils/deviceFeaturesUtils', () => {
ada: 'no-support',
tada: 'no-support',
bnb: 'update-required',
arb: 'update-required',
base: 'update-required',
crw: 'update-required',
eos: 'no-support',
Expand Down Expand Up @@ -171,6 +172,7 @@ describe('utils/deviceFeaturesUtils', () => {
expect(getUnavailableCapabilities(featT2T1, coins2)).toEqual({
replaceTransaction: 'update-required',
amountUnit: 'update-required',
arb: 'update-required',
base: 'update-required',
bnb: 'update-required',
decreaseOutput: 'update-required',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type LegacyNetworkSymbol = 'eos' | 'nem' | 'xlm' | 'xtz';

export const COINS: Record<NetworkSymbol | LegacyNetworkSymbol, string> = {
ada: require('../../images/coins/ada.svg'),
arb: require('../../images/coins/arb.svg'),
base: require('../../images/coins/base.svg'),
bch: require('../../images/coins/bch.svg'),
bnb: require('../../images/coins/bnb.svg'),
Expand Down
17 changes: 17 additions & 0 deletions packages/product-components/src/images/coins/arb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions packages/suite-desktop-core/e2e/support/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { DevicePromptActions } from './pageActions/devicePromptActions';
import { AnalyticsActions } from './pageActions/analyticsActions';
import { IndexedDbFixture } from './indexedDb';
import { MarketActions } from './pageActions/marketActions';
import { RecoverActions } from './pageActions/recoverActions';
import { WordInputActions } from './pageActions/wordInputActions';

type Fixtures = {
startEmulator: boolean;
Expand All @@ -39,6 +41,8 @@ type Fixtures = {
backupPage: BackupActions;
analyticsPage: AnalyticsActions;
devicePrompt: DevicePromptActions;
recoverPage: RecoverActions;
wordInputPage: WordInputActions;
analytics: AnalyticsFixture;
indexedDb: IndexedDbFixture;
marketPage: MarketActions;
Expand Down Expand Up @@ -159,6 +163,14 @@ const test = base.extend<Fixtures>({
const devicePromptActions = new DevicePromptActions(page);
await use(devicePromptActions);
},
recoverPage: async ({ page }, use) => {
const recoverPage = new RecoverActions(page);
await use(recoverPage);
},
wordInputPage: async ({ page }, use) => {
const wordinputPage = new WordInputActions(page);
await use(wordinputPage);
},
analytics: async ({ page }, use) => {
const analytics = new AnalyticsFixture(page);
await use(analytics);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Locator, Page } from '@playwright/test';

export class RecoverActions {
readonly selectBasicRecoveryButton: Locator;

constructor(private page: Page) {
this.selectBasicRecoveryButton = page.getByTestId('@recover/select-type/basic');
}

async selectWordCount(number: 12 | 18 | 24) {
await this.page.getByTestId(`@recover/select-count/${number}`).click();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Locator, Page } from '@playwright/test';

import { TrezorUserEnvLink } from '@trezor/trezor-user-env-link';

export class WordInputActions {
readonly wordSelectInput: Locator;

constructor(private page: Page) {
this.wordSelectInput = page.getByTestId('@word-input-select/input');
}

async inputWord(word: string) {
await this.wordSelectInput.type(word);
await this.page.getByTestId(`@word-input-select/option/${word}`).click();
}

async inputMnemonicT1B1(mnemonic: string[]) {
for (let i = 0; i < 24; i++) {
await this.page.waitForTimeout(400);
const state = await TrezorUserEnvLink.getDebugState();
const position = state.recovery_word_pos - 1;
await this.inputWord(mnemonic[position]);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { test, expect } from '../../../support/fixtures';

test.describe('Onboarding - create wallet', { tag: ['@group=device-management'] }, () => {
test.use({
emulatorStartConf: { model: 'T1B1', version: '1-latest', wipe: true },
setupEmulator: false,
});

test.beforeEach(async ({ onboardingPage }) => {
await onboardingPage.disableFirmwareHashCheck();
});

test('Success (basic)', async ({
page,
analyticsPage,
onboardingPage,
devicePrompt,
trezorUserEnvLink,
}) => {
// Pass through analytics and firmware steps
await analyticsPage.passThroughAnalytics();
await onboardingPage.firmwareContinueButton.click();

// Start wallet creation
await page.getByTestId('@onboarding/path-create-button').click();

// Confirm on device
await devicePrompt.confirmOnDevicePromptIsShown();
await trezorUserEnvLink.pressYes();

// Skip backup
// It is possible to leave onboarding now
await expect(page.getByTestId('@onboarding/skip-backup')).toBeVisible();

// Start backup process
await page.getByTestId('@onboarding/create-backup-button').click();

// Check backup completion steps
await page.getByTestId('@backup/check-item/wrote-seed-properly').click();
await page.getByTestId('@backup/check-item/made-no-digital-copy').click();
await page.getByTestId('@backup/check-item/will-hide-seed').click();
await expect(page.getByTestId('@onboarding/confirm-on-device')).not.toBeVisible();

await page.getByTestId('@backup/start-button').click();
await devicePrompt.confirmOnDevicePromptIsShown();

for (let i = 0; i < 48; i++) {
await trezorUserEnvLink.pressYes();
}

await page.getByTestId('@backup/close-button').click();

// Proceed to PIN setup
// Now we are in PIN step, skip button is available
await expect(page.getByTestId('@onboarding/skip-button')).toBeVisible();

// Lets set PIN
await page.getByTestId('@onboarding/set-pin-button').click();
await devicePrompt.confirmOnDevicePromptIsShown();
await trezorUserEnvLink.pressYes();

// Simulate PIN mismatch
await page.getByTestId('@pin/input/1').click();
await page.getByTestId('@pin/submit-button').click();
await page.getByTestId('@pin/input/1').click();
await page.getByTestId('@pin/input/1').click();
await page.getByTestId('@pin/submit-button').click();
await expect(page.getByTestId('@pin-mismatch')).toBeVisible();
await page.getByTestId('@pin-mismatch/try-again-button').click();

// Retry PIN setup
await page.getByTestId('@onboarding/confirm-on-device').waitFor({ state: 'visible' });
await trezorUserEnvLink.pressYes();

// Pin matrix appears again
await expect(page.getByTestId('@pin/input/1')).toBeVisible();
});
});
Loading

0 comments on commit 1e8b305

Please sign in to comment.