Skip to content

Commit

Permalink
chore: update from base branch
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnbusuttil committed Apr 23, 2024
2 parents c22bd17 + 0601346 commit 28acc69
Show file tree
Hide file tree
Showing 437 changed files with 8,186 additions and 6,562 deletions.
5 changes: 2 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ module.exports = {
'no-invalid-this': 0,
'react/prop-types': 'off',
'max-len': 'off', // prettier is already handling this automatically,
// note: prod webpack config strips console logs anyway, nevertheless
// we don't want the dev build to be spammed by needless logging
'@typescript-eslint/no-explicit-any': ['error'],
'no-console': ['error', { allow: ['warn', 'error', 'info', 'debug'] }],
'lodash/import-scope': ['error', 'method']
'lodash/import-scope': ['error', 'method'],
'promise/avoid-new': 'off',
},
overrides: [
{
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-dev-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
PRODUCTION_MODE_TRACKING: 'false'
- name: Check for linter issues
run: yarn lint
- name: Run unit tests, generate test coverage report
- name: Run unit tests
env:
AVAILABLE_CHAINS: 'Preprod,Preview,Mainnet'
DEFAULT_CHAIN: 'Preprod'
run: yarn test:coverage --maxWorkers=2 --silent
run: yarn test --maxWorkers=2 --silent
- name: Upload build
uses: actions/upload-artifact@v4
with:
Expand Down
26 changes: 2 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,14 @@ jobs:
PRODUCTION_MODE_TRACKING: ${{ startsWith(github.ref, 'refs/heads/release') && 'true' || 'false' }}
- name: Check for linter issues
run: yarn lint
- name: Run unit tests, generate test coverage report
- name: Run unit tests
env:
AVAILABLE_CHAINS: 'Preprod,Preview,Mainnet'
DEFAULT_CHAIN: 'Preprod'
NODE_OPTIONS: '--max_old_space_size=8192'
run: yarn test:coverage --maxWorkers=2 --silent
run: yarn test --maxWorkers=2 --silent
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: lace
path: apps/browser-extension-wallet/dist
- name: Upload Coveralls report
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.COVERALLS_REPO_TOKEN }}
allow-empty: true
compare-ref: main
- name: Rebuild a version of Lace with feature flags enabled
shell: bash
env:
LACE_EXTENSION_KEY: ${{ secrets.MANIFEST_PUBLIC_KEY }}
POSTHOG_PRODUCTION_TOKEN_MAINNET: ${{ startsWith(github.ref, 'refs/heads/release') && secrets.POSTHOG_PRODUCTION_TOKEN_MAINNET || '' }}
POSTHOG_PRODUCTION_TOKEN_PREPROD: ${{ startsWith(github.ref, 'refs/heads/release') && secrets.POSTHOG_PRODUCTION_TOKEN_PREPROD || '' }}
POSTHOG_PRODUCTION_TOKEN_PREVIEW: ${{ startsWith(github.ref, 'refs/heads/release') && secrets.POSTHOG_PRODUCTION_TOKEN_PREVIEW || '' }}
PRODUCTION_MODE_TRACKING: ${{ startsWith(github.ref, 'refs/heads/release') && 'true' || 'false' }}
run: |
eval "set -x ; $(cat apps/browser-extension-wallet/.env.* | grep ^USE_ | sed -r 's/false/true/' | sort --unique | sed -r 's/^/export /' | tr '\n' ';') set +x"
yarn browser build
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: lace--all-feature-flags
path: apps/browser-extension-wallet/dist
2 changes: 2 additions & 0 deletions .github/workflows/core-chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Lace Core Chromatic

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- packages/core/**
push:
Expand All @@ -12,6 +13,7 @@ on:

jobs:
chromatic-deployment:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/git-checks.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Git Checks

on: [pull_request]
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
block-fixup:
if: github.event.pull_request.draft == false
runs-on: ubuntu-20.04

steps:
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/packages-staking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ jobs:
- name: Build dependencies of Staking Center
run: yarn staking build-deps
- name: Run tests
run: yarn workspace @lace/staking test:unit --coverage
- name: Upload test coverage artifacts
uses: actions/upload-artifact@v4
with:
name: staking-coverage
path: packages/staking/coverage
run: yarn workspace @lace/staking test:unit
- name: Build Staking dist
run: yarn workspace @lace/staking build
# TODO fix ladle build
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/post-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ jobs:
with:
name: lightwallet
path: apps/browser-extension-wallet/dist
- name: Run unit tests, generate test coverage report
run: yarn test:coverage --maxWorkers=2 --silent
- name: Upload Coveralls report
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.COVERALLS_REPO_TOKEN }}
allow-empty: true
- name: Run unit tests
env:
AVAILABLE_CHAINS: 'Preprod,Preview,Mainnet'
DEFAULT_CHAIN: 'Preprod'
NODE_OPTIONS: '--max_old_space_size=8192'
run: yarn test --maxWorkers=2 --silent
21 changes: 21 additions & 0 deletions .github/workflows/sonar-cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: SonarCloud
on:
push:
branches:
- main
- release/**
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud Code Analysis
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/staking-chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Lace Staking Chromatic

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- packages/staking/**
push:
Expand All @@ -12,6 +13,7 @@ on:

jobs:
chromatic-deployment:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ui-toolkit-chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Lace UI Toolkit

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- packages/ui/**
push:
Expand All @@ -12,6 +13,7 @@ on:

jobs:
chromatic-deployment:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down
3 changes: 1 addition & 2 deletions apps/browser-extension-wallet/.env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ USE_POSTHOG_ANALYTICS=true
USE_MULTI_DELEGATION_STAKING_LEDGER=false
USE_MULTI_DELEGATION_STAKING_TREZOR=false
USE_MULTI_DELEGATION_STAKING_ACTIVITY=true
USE_MULTI_DELEGATION_STAKING_GRID_VIEW=false
USE_MULTI_DELEGATION_STAKING_GRID_VIEW=true
USE_MULTI_DELEGATION_STAKING_FILTERS=false
USE_ROS_STAKING_COLUMN=false

Expand All @@ -38,7 +38,6 @@ CATALYST_GOOGLE_PLAY_URL=https://play.google.com/store/apps/details?id=io.iohk.v
CATALYST_APP_STORE_URL=https://apps.apple.com/fr/app/catalyst-voting/id1517473397?l=en
TWITTER_URL=https://twitter.com/lace_io
YOUTUBE_URL=https://www.youtube.com/c/Laceio
MEDIUM_URL=https://medium.com/@lace_wallet
GITHUB_URL=https://github.com/input-output-hk
DISCORD_URL=https://discord.gg/lacewallet
WEBSITE_URL=https://www.lace.io
Expand Down
4 changes: 2 additions & 2 deletions apps/browser-extension-wallet/.env.developerpreview
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ USE_POSTHOG_ANALYTICS=true
USE_MULTI_DELEGATION_STAKING_LEDGER=false
USE_MULTI_DELEGATION_STAKING_TREZOR=false
USE_MULTI_DELEGATION_STAKING_ACTIVITY=true
USE_MULTI_DELEGATION_STAKING_GRID_VIEW=false
USE_MULTI_DELEGATION_STAKING_GRID_VIEW=true
USE_ROS_STAKING_COLUMN=false

USE_POSTHOG_ANALYTICS_FOR_OPTED_OUT=false
Expand All @@ -38,7 +38,6 @@ CATALYST_GOOGLE_PLAY_URL=https://play.google.com/store/apps/details?id=io.iohk.v
CATALYST_APP_STORE_URL=https://apps.apple.com/fr/app/catalyst-voting/id1517473397?l=en
TWITTER_URL=https://twitter.com/lace_io
YOUTUBE_URL=https://www.youtube.com/c/Laceio
MEDIUM_URL=https://medium.com/@lace_wallet
GITHUB_URL=https://github.com/input-output-hk
DISCORD_URL=https://discord.gg/lacewallet
WEBSITE_URL=https://www.lace.io
Expand All @@ -60,6 +59,7 @@ PRODUCTION_MODE_TRACKING=false
POSTHOG_DEV_TOKEN_MAINNET=phc_gH96Lx5lEVXTTWEyytSdTFPDk3Xsxwi4BqG88mKObd1
POSTHOG_DEV_TOKEN_PREPROD=phc_Xlmldm6EYSfQVgB9Uxm3b2xC1noDlgFFXpF9AJ6SMfJ
POSTHOG_DEV_TOKEN_PREVIEW=phc_e8SaOOWpXpNE59TnpLumeUjWm4iv024AWjhQqU406jr
POSTHOG_DEV_TOKEN_SANCHONET=phc_OUu6sPucDu5S6skRmYbWN5Jn8TpggWTQu1Y1ETkm3xt

# Cardano Services
CARDANO_SERVICES_URL_MAINNET=https://dev-mainnet.lw.iog.io
Expand Down
3 changes: 1 addition & 2 deletions apps/browser-extension-wallet/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ USE_DATA_CHECK=false
USE_POSTHOG_ANALYTICS=true
USE_POSTHOG_ANALYTICS_FOR_OPTED_OUT=false
USE_MULTI_DELEGATION_STAKING_ACTIVITY=true
USE_MULTI_DELEGATION_STAKING_GRID_VIEW=false
USE_MULTI_DELEGATION_STAKING_GRID_VIEW=true
USE_MULTI_DELEGATION_STAKING_FILTERS=false
USE_ROS_STAKING_COLUMN=false

Expand All @@ -34,7 +34,6 @@ CATALYST_GOOGLE_PLAY_URL=https://play.google.com/store/apps/details?id=io.iohk.v
CATALYST_APP_STORE_URL=https://apps.apple.com/fr/app/catalyst-voting/id1517473397?l=en
TWITTER_URL=https://twitter.com/lace_io
YOUTUBE_URL=https://www.youtube.com/c/Laceio
MEDIUM_URL=https://medium.com/@lace_wallet
GITHUB_URL=https://github.com/input-output-hk
DISCORD_URL=https://discord.gg/inputoutput
WEBSITE_URL=https://www.lace.io
Expand Down
2 changes: 1 addition & 1 deletion apps/browser-extension-wallet/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "$WALLET_MANIFEST_NAME",
"description": "One fast, accessible, and secure platform for digital assets, DApps, NFTs, and DeFi.",
"version": "1.9.0",
"version": "1.10.2",
"manifest_version": 3,
"key": "$LACE_EXTENSION_KEY",
"icons": {
Expand Down
23 changes: 11 additions & 12 deletions apps/browser-extension-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lace/browser-extension-wallet",
"version": "1.9.0",
"version": "1.10.2",
"description": "A fully capable wallet packaged as browser extensions for Chrome, Firefox, and Edge",
"homepage": "https://github.com/input-output-hk/lace/blob/master/apps/browser-extension-wallet/README.md",
"bugs": {
Expand Down Expand Up @@ -34,20 +34,19 @@
"prepare": "ts-patch install -s",
"prettier": "run -T prettier --write .",
"test": "run -T jest --config test/jest.config.js",
"test:coverage": "NODE_OPTIONS=\"--max-old-space-size=8192\" run -T test --coverage --silent",
"test:e2e": "yarn exec echo \"No e2e tests on this app yet!\"",
"watch": "NODE_OPTIONS='--openssl-legacy-provider' rm -rf dist & run -T webpack --config webpack.sw.dev.js --progress --watch & run -T webpack --config webpack.app.dev.js --progress --watch"
},
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@cardano-sdk/cardano-services-client": "0.17.10",
"@cardano-sdk/core": "0.29.0",
"@cardano-sdk/dapp-connector": "0.12.13",
"@cardano-sdk/input-selection": "0.12.24",
"@cardano-sdk/tx-construction": "0.18.0",
"@cardano-sdk/cardano-services-client": "0.19.0",
"@cardano-sdk/core": "0.30.0",
"@cardano-sdk/dapp-connector": "0.12.14",
"@cardano-sdk/input-selection": "0.12.27",
"@cardano-sdk/tx-construction": "0.18.3",
"@cardano-sdk/util": "0.15.0",
"@cardano-sdk/wallet": "0.35.0",
"@cardano-sdk/web-extension": "0.25.0",
"@cardano-sdk/wallet": "0.37.0",
"@cardano-sdk/web-extension": "0.27.0",
"@emurgo/cip14-js": "~3.0.1",
"@koralabs/handles-public-api-interfaces": "^1.6.6",
"@lace/cardano": "0.1.0",
Expand All @@ -60,7 +59,7 @@
"@vespaiach/axios-fetch-adapter": "^0.3.0",
"antd": "^4.24.10",
"are-you-es5": "^2.1.2",
"axios": "0.21.4",
"axios": "0.28.0",
"bignumber.js": "9.0.1",
"bip39": "^3.0.4",
"blake2b-no-wasm": "2.1.4",
Expand All @@ -70,7 +69,7 @@
"dexie": "3.2.0-rc.2",
"dexie-react-hooks": "1.0.7",
"graphql-tag": "2.12.5",
"i18next": "20.4.0",
"i18next": "^22.5.1",
"intersection-observer-polyfill": "0.1.0",
"lodash": "4.17.21",
"node-abort-controller": "^3.1.1",
Expand All @@ -80,7 +79,7 @@
"process": "^0.11.10",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-i18next": "11.11.4",
"react-i18next": "^12.3.1",
"react-lottie": "^1.2.3",
"react-router": "5.2.0",
"react-router-dom": "5.2.0",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import MoonIcon from '../../../../assets/icons/moon.component.svg';
import { useBackgroundServiceAPIContext } from '@providers/BackgroundServiceAPI';
import { themes, useAnalyticsContext } from '@providers';
import { PostHogAction } from '@providers/AnalyticsProvider/analyticsTracker';
import { TranslationKey } from '@lib/translations/types';

type ThemeAnalyticsEvents<T> = Record<themes, T>;

Expand All @@ -26,7 +27,7 @@ const userWalletProfileThemeEvent: ThemeAnalyticsEvents<
light: PostHogAction.UserWalletProfileLightModeClick
};

const modeTranslate: Record<string, string> = {
const modeTranslate: Record<string, TranslationKey> = {
light: 'browserView.sideMenu.mode.light',
dark: 'browserView.sideMenu.mode.dark'
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const UserInfo = ({ onOpenWalletAccounts, avatarVisible = true }: UserInf
const activeWalletName = addEllipsis(fullWalletName, WALLET_NAME_MAX_LENGTH, 0);
const [handle] = useGetHandles();
const handleName = handle?.nftMetadata?.name;
const activeWalletId = cardanoWallet.source.wallet.walletId;

const handleOnAddressCopy = () => {
toast.notify({ duration: TOAST_DEFAULT_DURATION, text: t('general.clipboard.copiedToClipboard') });
Expand Down Expand Up @@ -87,6 +88,9 @@ export const UserInfo = ({ onOpenWalletAccounts, avatarVisible = true }: UserInf
id={`wallet-option-${wallet.walletId}`}
onOpenAccountsMenu={() => onOpenWalletAccounts(wallet)}
onClick={async () => {
if (activeWalletId === wallet.walletId) {
return;
}
analytics.sendEventToPostHog(PostHogAction.MultiWalletSwitchWallet);

await activateWallet({
Expand All @@ -103,7 +107,7 @@ export const UserInfo = ({ onOpenWalletAccounts, avatarVisible = true }: UserInf
/>
);
},
[activateWallet, getLastActiveAccount, onOpenWalletAccounts, setIsDropdownMenuOpen, analytics, t]
[activateWallet, getLastActiveAccount, onOpenWalletAccounts, setIsDropdownMenuOpen, analytics, t, activeWalletId]
);

const renderWallet = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import React, { useCallback, useMemo } from 'react';
import { useTranslation, Trans } from 'react-i18next';
import { NavigationButton, PostHogAction, toast } from '@lace/common';
import { Wallet } from '@lace/cardano';
import styles from './WalletAccounts.module.scss';
import { ProfileDropdown } from '@lace/ui';
import { AccountData } from '@lace/ui/dist/design-system/profile-dropdown/accounts/profile-dropdown-accounts-list.component';
Expand Down Expand Up @@ -145,6 +146,8 @@ export const WalletAccounts = ({ isPopup, onBack }: { isPopup: boolean; onBack:
const name = defaultAccountName(accountIndex);
try {
const timeout = setTimeout(showHWErrorState, HW_CONNECT_TIMEOUT_MS);
if (wallet.type === WalletType.InMemory) return;
await Wallet.connectDevice(wallet.type);
await addAccount({
wallet,
accountIndex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React, { useState, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { useSyncStatus } from '@src/stores';
import { WalletStatus, Status } from './WalletStatus';
import { TranslationKey } from '@lib/translations/types';

const DEFAULT_WALLET_STATUS = {
const DEFAULT_WALLET_STATUS: { status: Status; text: TranslationKey } = {
status: Status.SYNCING,
text: 'browserView.topNavigationBar.walletStatus.walletSyncing'
};
Expand Down
Loading

0 comments on commit 28acc69

Please sign in to comment.