diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml deleted file mode 100644 index c3a71a0a5..000000000 --- a/.github/workflows/gh-pages.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: GitHub Pages - -on: - push: - branches: - - main - pull_request: - -jobs: - deploy: - runs-on: ubuntu-20.04 - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - if: github.actor != 'dependabot[bot]' - steps: - - uses: actions/checkout@v3 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: "16" - cache: "yarn" - - - run: yarn setup - - run: | - echo 'module.exports = { basePath: "/argent-x" }' > packages/dapp/next.config.js - - run: yarn build - env: - UPLOAD_SENTRY_SOURCEMAPS: false - - - run: yarn --cwd packages/dapp export - - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - if: ${{ github.ref == 'refs/heads/main' }} - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./packages/dapp/out diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 000000000..098cf3161 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,198 @@ +name: Run all tests +on: + push: + branches: + - develop + pull_request: + branches: + - main + - develop + +jobs: + setup: + runs-on: ubuntu-latest + + env: + FEATURE_PRIVACY_SETTINGS: "true" + FEATURE_EXPERIMENTAL_SETTINGS: "true" + FEATURE_BANXA: "true" + FEATURE_LAYERSWAP: "true" + FEATURE_ORBITER: "true" + FEATURE_VERIFIED_DAPPS: "false" + ARGENT_API_BASE_URL: ${{ vars.ARGENT_API_BASE_URL }} + ARGENT_TRANSACTION_REVIEW_API_BASE_URL: ${{ vars.ARGENT_TRANSACTION_REVIEW_API_BASE_URL }} + ARGENT_X_STATUS_URL: ${{ vars.ARGENT_X_STATUS_URL }} + ARGENT_EXPLORER_BASE_URL: ${{ vars.ARGENT_EXPLORER_BASE_URL }} + UPLOAD_SENTRY_SOURCEMAPS: false + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "16" + cache: "yarn" + + - name: Setup project + run: yarn setup + + - name: Build extension + run: yarn lerna run --scope @argent-x/extension build + + - name: Cache build + uses: actions/cache@v3 + with: + path: ./* + key: ${{ github.sha }} + + test-unit: + runs-on: ubuntu-latest + needs: [setup] + + services: + devnet: + image: shardlabs/starknet-devnet:latest-seed0 + ports: + - 5050:5050 + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "16" + cache: "yarn" + + - name: Restore cached build + uses: actions/cache@v3 + with: + path: ./* + key: ${{ github.sha }} + + - name: Lint + run: yarn lint + + - name: Run tests + run: yarn test:ci + + test-e2e: + runs-on: ubuntu-latest + needs: [setup] + + services: + devnet: + image: argentlabs-argent-x.jfrog.io/e2e-starknet-devnet:latest + ports: + - 5050:5050 + credentials: + username: ${{ secrets.JFROG_USERNAME }} + password: ${{ secrets.JFROG_PASSWORD }} + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: "16" + cache: "yarn" + + - name: Restore cached build + uses: actions/cache@v3 + with: + path: ./* + key: ${{ github.sha }} + + - name: Install Playwright Browsers + run: npx playwright install chromium + + - name: Run e2e tests + run: xvfb-run --auto-servernum yarn test:e2e + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + if: always() + with: + name: test-results + path: | + packages/extension/test-results/ + packages/extension/e2e/artifacts/playwright/ + packages/extension/e2e/artifacts/reports/ + retention-days: 5 + + sonar: + runs-on: ubuntu-latest + needs: [setup] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "16" + cache: "yarn" + + - name: Restore cached build + uses: actions/cache@v3 + with: + path: ./* + key: ${{ github.sha }} + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} + + artifacts: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' }} # Run only for pull requests + needs: [setup, test-unit, test-e2e] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "16" + cache: "yarn" + + - name: Restore cached build + uses: actions/cache@v3 + with: + path: ./* + key: ${{ github.sha }} + + - name: Set filename prefix + run: echo "FILENAME_PREFIX=$(echo argent-extension-${{ github.ref_name }} | tr / -)" >> $GITHUB_ENV + + - name: Create chrome zip + run: (cd ./packages/extension/dist && zip -r "../../../${{ env.FILENAME_PREFIX }}-chrome.zip" .) + + - name: Upload artifacts for chrome + uses: actions/upload-artifact@v3 + with: + name: ${{ env.FILENAME_PREFIX }}-chrome.zip + path: "*-chrome.zip" + retention-days: 5 + + - name: Build Firefox version + run: MANIFEST_VERSION=v2 yarn --cwd packages/extension build + + - name: Create firefox zip + run: (cd ./packages/extension/dist && zip -r "../../../${{ env.FILENAME_PREFIX }}-firefox.zip" .) + + - name: Check bundlesize for firefox + run: yarn run bundlewatch + + - name: Upload artifacts for firefox + uses: actions/upload-artifact@v3 + with: + name: ${{ env.FILENAME_PREFIX }}-firefox.zip + path: "*-firefox.zip" + retention-days: 5 + + - name: Set GHA_BRANCH + run: echo "GHA_BRANCH=$(echo $GITHUB_REF | awk -F / '{print $3}')" >> $GITHUB_ENV + + - name: Comment PR + continue-on-error: true + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr comment ${{ env.GHA_BRANCH }} --body "[Builds for local testing](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 027f3a3e4..9609502cc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,8 +4,6 @@ on: push: tags: - "v*.*.*" - branches: - - prerelease/* env: FEATURE_PRIVACY_SETTINGS: "true" @@ -24,26 +22,26 @@ jobs: contents: write env: NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} - FILENAME: argent-extension-${{ github.ref_name }} SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY }} SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} RAMP_API_KEY: ${{ secrets.RAMP_API_KEY }} + FILENAME: argent-extension-${{ github.ref_name }} UPLOAD_SENTRY_SOURCEMAPS: true - ARGENT_API_BASE_URL: ${{ secrets.ARGENT_API_BASE_URL }} - ARGENT_TRANSACTION_REVIEW_API_BASE_URL: ${{ secrets.ARGENT_TRANSACTION_REVIEW_API_BASE_URL }} - ARGENT_X_STATUS_URL: ${{ secrets.ARGENT_X_STATUS_URL }} - ARGENT_EXPLORER_BASE_URL: ${{ secrets.ARGENT_EXPLORER_BASE_URL }} SAFE_ENV_VARS: true + ARGENT_API_BASE_URL: ${{ vars.ARGENT_API_BASE_URL }} + ARGENT_TRANSACTION_REVIEW_API_BASE_URL: ${{ vars.ARGENT_TRANSACTION_REVIEW_API_BASE_URL }} + ARGENT_X_STATUS_URL: ${{ vars.ARGENT_X_STATUS_URL }} + ARGENT_EXPLORER_BASE_URL: ${{ vars.ARGENT_EXPLORER_BASE_URL }} steps: - uses: actions/checkout@v3 - - name: Setup Node - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3 with: node-version: "16" cache: "yarn" - run: yarn setup - run: yarn build + - name: Release npm packages # if flow is triggered by a tag, publish to npm if: startsWith(github.ref, 'refs/tags/') @@ -52,23 +50,21 @@ jobs: cp Readme.md ./packages/get-starknet/README.md yarn --cwd packages/get-starknet publish --access public || exit 0 yarn --cwd packages/sessions publish --access public || exit 0 + - run: yarn --cwd packages/dapp export + - name: Check bundlesize for chrome run: yarn run bundlewatch + - name: Create chrome zip - run: | - cd packages/extension/dist - zip -r $(echo "${{ env.FILENAME }}" | tr / -)-chrome.zip ./* - mv $(echo "${{ env.FILENAME }}" | tr / -)-chrome.zip ../../../ - cd ../../../ + run: (cd ./packages/extension/dist && zip -r "../../../${{ env.FILENAME }}-chrome.zip" .) + - name: Build Firefox version run: MANIFEST_VERSION=v2 yarn --cwd packages/extension build + - name: Create firefox zip - run: | - cd packages/extension/dist - zip -r $(echo "${{ env.FILENAME }}" | tr / -)-firefox.zip ./* - mv $(echo "${{ env.FILENAME }}" | tr / -)-firefox.zip ../../../ - cd ../../../ + run: (cd ./packages/extension/dist && zip -r "../../../${{ env.FILENAME }}-firefox.zip" .) + - name: Check bundlesize for firefox run: yarn run bundlewatch @@ -80,6 +76,7 @@ jobs: path: "*-chrome.zip" retention-days: 14 if-no-files-found: error + - name: Upload artifacts for firefox if: ${{ !startsWith(github.ref, 'refs/tags/') }} uses: actions/upload-artifact@v3 diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml deleted file mode 100644 index 3069dfa4f..000000000 --- a/.github/workflows/test-e2e.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: Run e2e tests -on: - push: - branches: [develop] - pull_request: - branches: - - main - - develop - -jobs: - test: - runs-on: ubuntu-latest - - env: - FILENAME: argent-extension-${{ github.ref_name }} - FEATURE_PRIVACY_SETTINGS: "true" - FEATURE_EXPERIMENTAL_SETTINGS: "true" - FEATURE_BANXA: "true" - FEATURE_LAYERSWAP: "true" - FEATURE_ORBITER: "true" - FEATURE_VERIFIED_DAPPS: "false" - ARGENT_API_BASE_URL: ${{ secrets.ARGENT_API_BASE_URL }} - ARGENT_TRANSACTION_REVIEW_API_BASE_URL: ${{ secrets.ARGENT_TRANSACTION_REVIEW_API_BASE_URL }} - ARGENT_X_STATUS_URL: ${{ secrets.ARGENT_X_STATUS_URL }} - ARGENT_EXPLORER_BASE_URL: ${{ secrets.ARGENT_EXPLORER_BASE_URL }} - - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - - name: Build starknet-devnet - run: docker build -f ./packages/extension/e2e/Dockerfile . --tag e2e-starknet-devnet:latest - - name: Run starknet-devnet - run: docker run -d -it --name devnet -p 5050:5050 e2e-starknet-devnet:latest - - - uses: actions/setup-node@v3 - with: - node-version: "16" - cache: "yarn" - - - name: Install dependencies - run: yarn setup - - - name: Install Playwright Browsers - run: npx playwright install chromium - - - name: Build - run: yarn lerna run --scope @argent-x/extension build - env: - UPLOAD_SENTRY_SOURCEMAPS: false - - - name: Check docker local network - run: | - CODE=`curl --write-out '%{http_code}' \ - --silent \ - --output /dev/null \ - --request GET \ - --url 'http://localhost:5050/is_alive' \ - ` - if [[ "$CODE" != "200" ]] - then - echo "Local network is offline! $CODE" - exit 1 - else - echo "Local network is online." - fi - - - name: Run e2e tests - run: xvfb-run --auto-servernum yarn test:e2e - - - name: Stop starknet-devnet - run: docker stop devnet - - - uses: actions/upload-artifact@v3 - if: always() - with: - name: test-results - path: | - packages/extension/test-results/ - packages/extension/e2e/artifacts/playwright/ - packages/extension/e2e/artifacts/reports/ - retention-days: 5 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 99c93de85..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,139 +0,0 @@ -name: Run Tests -on: - push: - branches: [develop] - pull_request: - branches: - - main - - develop - -jobs: - test: - runs-on: ubuntu-latest - - services: - devnet: - image: shardlabs/starknet-devnet:latest-seed0 - ports: - - 5050:5050 - env: - FILENAME: argent-extension-${{ github.ref_name }} - FEATURE_PRIVACY_SETTINGS: "true" - FEATURE_EXPERIMENTAL_SETTINGS: "true" - FEATURE_BANXA: "true" - FEATURE_LAYERSWAP: "true" - FEATURE_ORBITER: "true" - FEATURE_VERIFIED_DAPPS: "false" - ARGENT_API_BASE_URL: ${{ secrets.ARGENT_API_BASE_URL }} - ARGENT_TRANSACTION_REVIEW_API_BASE_URL: ${{ secrets.ARGENT_TRANSACTION_REVIEW_API_BASE_URL }} - ARGENT_X_STATUS_URL: ${{ secrets.ARGENT_X_STATUS_URL }} - ARGENT_EXPLORER_BASE_URL: ${{ secrets.ARGENT_EXPLORER_BASE_URL }} - - steps: - - name: If github.head_ref not filled, we are merging - run: | - if [ "${{ github.head_ref }}" == "" || ${{ github.actor == 'dependabot[bot]' }} ]; then - echo "PUBLISH_COMMENT=no" >> $GITHUB_ENV - else - echo "PUBLISH_COMMENT=yes" >> $GITHUB_ENV - fi - - - name: Check out repository code - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: "16" - cache: "yarn" - - - name: Install dependencies - run: yarn setup - - - name: Lint - run: yarn lint - - - name: Build - run: yarn lerna run --scope @argent-x/extension build - env: - UPLOAD_SENTRY_SOURCEMAPS: false - - - name: Run tests - run: yarn test:ci - - - name: Check bundlesize for chrome - run: yarn run bundlewatch - - - uses: actions/upload-artifact@v3 - if: always() - with: - name: test-results - path: | - packages/extension/test-results/ - packages/extension/e2e/artifacts/playwright/ - packages/extension/e2e/artifacts/reports/ - retention-days: 5 - - ## Upload build and comment PR if not merging into develop - - name: Set filename prefix - if: ${{ env.PUBLISH_COMMENT == 'yes' }} - run: echo "FILENAME_PREFIX=$(echo ${{ env.FILENAME }} | tr / -)" >> $GITHUB_ENV - - - name: Create chrome zip - if: ${{ env.PUBLISH_COMMENT == 'yes' }} - run: | - cd packages/extension/dist - zip -r ${{ env.FILENAME_PREFIX }}-chrome.zip ./* - mv ${{ env.FILENAME_PREFIX }}-chrome.zip ../../../ - cd ../../../ - - - name: Build Firefox version - if: ${{ env.PUBLISH_COMMENT == 'yes' }} - run: MANIFEST_VERSION=v2 yarn --cwd packages/extension build - - - name: Create firefox zip - if: ${{ env.PUBLISH_COMMENT == 'yes' }} - run: | - cd packages/extension/dist - zip -r ${{ env.FILENAME_PREFIX }}-firefox.zip ./* - mv ${{ env.FILENAME_PREFIX }}-firefox.zip ../../../ - cd ../../../ - - - name: Check bundlesize for firefox - if: ${{ env.PUBLISH_COMMENT == 'yes' }} - run: yarn run bundlewatch - - - name: Upload artifacts for firefox - if: ${{ env.PUBLISH_COMMENT == 'yes' }} - uses: actions/upload-artifact@v3 - with: - name: ${{ env.FILENAME_PREFIX }}-firefox.zip - path: "*-firefox.zip" - retention-days: 5 - - - name: Upload artifacts for chrome - if: ${{ env.PUBLISH_COMMENT == 'yes' }} - uses: actions/upload-artifact@v3 - with: - name: ${{ env.FILENAME_PREFIX }}-chrome.zip - path: "*-chrome.zip" - retention-days: 5 - - - name: Set GHA_BRANCH - if: ${{ env.PUBLISH_COMMENT == 'yes' }} - run: echo "GHA_BRANCH=$(echo $GITHUB_REF | awk -F / '{print $3}')" >> $GITHUB_ENV - - - name: comment PR - if: ${{ env.PUBLISH_COMMENT == 'yes' }} - continue-on-error: true - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - INPUT_REPO: ${{ env.GHA_BRANCH }} - INPUT_OWNER: ${{ github.repository_owner }} - run: | - gh pr comment ${{ env.GHA_BRANCH }} --body "[Builds for local testing](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" - - name: SonarCloud Scan - if: github.actor != 'dependabot[bot]' - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} diff --git a/lerna.json b/lerna.json index f313188eb..2422a485d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "packages": ["packages/*"], - "version": "5.3.17", + "version": "5.3.20", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/dapp/package.json b/packages/dapp/package.json index 14ddd5ea1..aa9067aaa 100644 --- a/packages/dapp/package.json +++ b/packages/dapp/package.json @@ -1,6 +1,6 @@ { "name": "@argent-x/dapp", - "version": "5.3.17", + "version": "5.3.20", "private": true, "scripts": { "dev": "next dev", @@ -10,8 +10,8 @@ "lint": "next lint" }, "dependencies": { - "@argent/get-starknet": "^5.3.17", - "@argent/x-sessions": "^5.3.17", + "@argent/get-starknet": "^5.3.20", + "@argent/x-sessions": "^5.3.20", "ethers": "^5.5.1", "next": "^13.0.0", "react": "^18.0.0", diff --git a/packages/extension/e2e/network-setup/Dockerfile b/packages/extension/e2e/network-setup/Dockerfile new file mode 100644 index 000000000..db57732eb --- /dev/null +++ b/packages/extension/e2e/network-setup/Dockerfile @@ -0,0 +1,9 @@ + +FROM shardlabs/starknet-devnet:0.4.6 +RUN addgroup -S localuser \ + && adduser -S localuser -G localuser + +USER localuser + +COPY ./dump.pkl ./dump.pkl +ENTRYPOINT [ "starknet-devnet", "--host", "0.0.0.0", "--port", "5050", "--seed", "0", "--lite-mode", "--load-path", "./dump.pkl" ] \ No newline at end of file diff --git a/packages/extension/e2e/network-setup/build_and_push.sh b/packages/extension/e2e/network-setup/build_and_push.sh new file mode 100755 index 000000000..da2fd886d --- /dev/null +++ b/packages/extension/e2e/network-setup/build_and_push.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +docker build . --tag e2e-starknet-devnet:latest + +docker login argentlabs-argent-x.jfrog.io +docker tag e2e-starknet-devnet argentlabs-argent-x.jfrog.io/e2e-starknet-devnet:latest +docker push argentlabs-argent-x.jfrog.io/e2e-starknet-devnet:latest diff --git a/packages/extension/e2e/src/languages/ILanguage.ts b/packages/extension/e2e/src/languages/ILanguage.ts index d8fbf5561..1d097ec3f 100644 --- a/packages/extension/e2e/src/languages/ILanguage.ts +++ b/packages/extension/e2e/src/languages/ILanguage.ts @@ -16,6 +16,7 @@ export interface ILanguage { save: string create: string cancel: string + privacyStatement: string } account: { noAccounts: string diff --git a/packages/extension/e2e/src/languages/en/index.ts b/packages/extension/e2e/src/languages/en/index.ts index 356be6472..730b02ba4 100644 --- a/packages/extension/e2e/src/languages/en/index.ts +++ b/packages/extension/e2e/src/languages/en/index.ts @@ -16,6 +16,8 @@ const texts = { save: "Save", create: "Create", cancel: "Cancel", + privacyStatement: + "GDPR statement for browser extension wallet: Argent takes the privacy and security of individuals very seriously and takes every reasonable measure and precaution to protect and secure the personal data that we process. The browser extension wallet does not collect any personal information nor does it correlate any of your personal information with anonymous data processed as part of its services. On top of this Argent has robust information security policies and procedures in place to make sure any processing complies with applicable laws. If you would like to know more or have any questions then please visit our website at https://www.argent.xyz/", }, account: { noAccounts: "You have no accounts on ", diff --git a/packages/extension/e2e/src/page-objects/Settings.ts b/packages/extension/e2e/src/page-objects/Settings.ts index e647fccd0..52908afbd 100644 --- a/packages/extension/e2e/src/page-objects/Settings.ts +++ b/packages/extension/e2e/src/page-objects/Settings.ts @@ -86,4 +86,24 @@ export default class Settings { get copy() { return this.page.locator(`button:text-is("${lang.settings.copy}")`) } + + get help() { + return this.page.getByRole("link", { name: "Help" }) + } + + get discord() { + return this.page.getByRole("link", { name: "Discord" }) + } + + get github() { + return this.page.getByRole("link", { name: "Github" }) + } + + get privacyStatement() { + return this.page.getByRole("link", { name: "Privacy Statement" }) + } + + get privacyStatementText() { + return this.page.locator('[aria-label="privacyStatementText"]') + } } diff --git a/packages/extension/e2e/src/page-objects/Wallet.ts b/packages/extension/e2e/src/page-objects/Wallet.ts index 110bdaa03..7cb9ae9dc 100644 --- a/packages/extension/e2e/src/page-objects/Wallet.ts +++ b/packages/extension/e2e/src/page-objects/Wallet.ts @@ -40,6 +40,14 @@ export default class Wallet extends Navigation { ) } + get privacyStatement() { + return this.page.getByRole("link", { name: "Privacy Statement" }) + } + + get privacyStatementText() { + return this.page.locator('[aria-label="privacyStatementText"]') + } + //third screen get banner3() { return this.page.locator(`div h1:text-is("${lang.wallet.banner3}")`) @@ -90,6 +98,13 @@ export default class Wallet extends Navigation { expect(this.banner2).toBeVisible(), expect(this.description2).toBeVisible(), ]) + await expect(this.privacyStatement).toBeVisible() + await this.privacyStatement.click() + await expect(this.privacyStatementText).toHaveText( + lang.common.privacyStatement, + ) + + await this.page.locator('button:text-is("Back")').click() await this.disclaimerLostOfFunds.click() await this.disclaimerAlphaVersion.click() await this.continue.click() diff --git a/packages/extension/e2e/src/specs/links.spec.ts b/packages/extension/e2e/src/specs/links.spec.ts new file mode 100644 index 000000000..db7e72f4b --- /dev/null +++ b/packages/extension/e2e/src/specs/links.spec.ts @@ -0,0 +1,24 @@ +import { expect } from "@playwright/test" + +import { lang } from "../languages" +import test from "../test" + +test.describe("Links", () => { + test("Check settings links", async ({ extension }) => { + await extension.wallet.newWalletOnboarding() + await extension.open() + await extension.navigation.showSettings.click() + let href = await extension.settings.discord.getAttribute("href") + expect(href).toContain("https://discord.gg/T4PDFHxm6T") + href = await extension.settings.help.getAttribute("href") + expect(href).toContain( + "https://support.argent.xyz/hc/en-us/categories/5767453283473-Argent-X", + ) + href = await extension.settings.github.getAttribute("href") + expect(href).toContain("https://github.com/argentlabs/argent-x/issues") + await extension.settings.privacyStatement.click() + await expect(extension.settings.privacyStatementText).toHaveText( + lang.common.privacyStatement, + ) + }) +}) diff --git a/packages/extension/manifest/v2.json b/packages/extension/manifest/v2.json index 1c5626d1b..5e88672cb 100644 --- a/packages/extension/manifest/v2.json +++ b/packages/extension/manifest/v2.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/chrome-manifest.json", "name": "Argent X", "description": "The security of Ethereum with the scale of StarkNet", - "version": "5.3.17", + "version": "5.3.20", "manifest_version": 2, "browser_action": { "default_icon": { diff --git a/packages/extension/manifest/v3.json b/packages/extension/manifest/v3.json index 9d4a4c348..39cf659c3 100644 --- a/packages/extension/manifest/v3.json +++ b/packages/extension/manifest/v3.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/chrome-manifest.json", "name": "Argent X", "description": "The security of Ethereum with the scale of StarkNet", - "version": "5.3.17", + "version": "5.3.20", "manifest_version": 3, "action": { "default_icon": { diff --git a/packages/extension/package.json b/packages/extension/package.json index 73cb44aaa..65e37d068 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -1,6 +1,6 @@ { "name": "@argent-x/extension", - "version": "5.3.17", + "version": "5.3.20", "main": "index.js", "license": "MIT", "devDependencies": { @@ -74,13 +74,13 @@ "push-release-branch": "git push --set-upstream origin release/v$npm_package_version --follow-tags" }, "dependencies": { - "@argent/guardian": "^5.3.17", - "@argent/stack-router": "^5.3.17", - "@argent/ui": "^5.3.17", - "@argent/x-multicall": "^5.3.17", - "@argent/x-sessions": "^5.3.17", - "@argent/x-swap": "^5.3.17", - "@argent/x-window": "^5.3.17", + "@argent/guardian": "^5.3.20", + "@argent/stack-router": "^5.3.20", + "@argent/ui": "^5.3.20", + "@argent/x-multicall": "^5.3.20", + "@argent/x-sessions": "^5.3.20", + "@argent/x-swap": "^5.3.20", + "@argent/x-window": "^5.3.20", "@chakra-ui/icons": "^2.0.15", "@chakra-ui/react": "2.5.1", "@extend-chrome/messages": "^1.2.2", diff --git a/packages/extension/src/background/accountMessaging.ts b/packages/extension/src/background/accountMessaging.ts index 7e4c304c6..72e41642e 100644 --- a/packages/extension/src/background/accountMessaging.ts +++ b/packages/extension/src/background/accountMessaging.ts @@ -149,7 +149,7 @@ export const handleAccountMessage: HandleMessage = async ({ } const encryptedPrivateKey = await encryptForUi( - await wallet.exportPrivateKey(), + await wallet.exportPrivateKey(msg.data.account), msg.data.encryptedSecret, privateKey, ) diff --git a/packages/extension/src/background/wallet.ts b/packages/extension/src/background/wallet.ts index d25516712..fcad33993 100644 --- a/packages/extension/src/background/wallet.ts +++ b/packages/extension/src/background/wallet.ts @@ -57,7 +57,6 @@ import { getPreDeployedAccount, } from "./devnet/declareAccounts" import { - getIndexForPath, getNextPathIndex, getPathForIndex, getStarkPair, @@ -447,17 +446,15 @@ export class Wallet { const index = getNextPathIndex(currentPaths, baseDerivationPath) - const payload = await this.getDeployContractPayloadForAccountIndex( - index, - networkId, - ) + const { addressSalt, constructorCalldata } = + await this.getDeployContractPayloadForAccountIndex(index, networkId) const proxyClassHash = PROXY_CONTRACT_CLASS_HASHES[0] const proxyAddress = calculateContractAddressFromHash( - payload.addressSalt, + addressSalt, proxyClassHash, - payload.constructorCalldata, + constructorCalldata, 0, ) @@ -524,29 +521,14 @@ export class Wallet { if (!this.isSessionOpen()) { throw Error("no open session") } - const networkId = account.networkId - const network = await this.getNetwork(networkId) - - const provider = getProvider(network) - - const index = getIndexForPath( - account.signer.derivationPath, - baseDerivationPath, - ) - - const payload = await this.getDeployContractPayloadForAccountIndex( - index, - networkId, - ) const nonce = await getNonce(account, this) - const deployTransaction = await provider.deployAccountContract(payload, { - nonce, - }) + const deployTransaction = await this.deployAccount(account, { nonce }) + await increaseStoredNonce(account) - return { account, txHash: deployTransaction.transaction_hash } + return { account, txHash: deployTransaction.txHash } } /** Get the Account Deployment Payload * Use it in the deployAccount and getAccountDeploymentFee methods @@ -613,10 +595,10 @@ export class Wallet { return deployAccountPayload } - public async getDeployContractPayloadForAccountIndex( + private async getDeployContractPayloadForAccountIndex( index: number, networkId: string, - ): Promise> { + ): Promise, "signature">> { const hasSession = await this.isSessionOpen() const session = await this.sessionStore.get() const initialised = await this.isInitialized() @@ -645,7 +627,6 @@ export class Wallet { calldata: stark.compileCalldata({ signer: starkPub, guardian: "0" }), }), addressSalt: starkPub, - signature: starkPair.getPrivate(), } return payload @@ -830,13 +811,16 @@ export class Wallet { return starkPub } - public async exportPrivateKey(): Promise { + public async exportPrivateKey( + baseWalletAccount: BaseWalletAccount, + ): Promise { const session = await this.sessionStore.get() if (!this.isSessionOpen() || !session?.secret) { throw new Error("Session is not open") } - const account = await this.getSelectedAccount() + const account = await this.getAccount(baseWalletAccount) + if (!account) { throw new Error("no selected account") } diff --git a/packages/extension/src/shared/messages/AccountMessage.ts b/packages/extension/src/shared/messages/AccountMessage.ts index 0c04fc1c3..3756a9031 100644 --- a/packages/extension/src/shared/messages/AccountMessage.ts +++ b/packages/extension/src/shared/messages/AccountMessage.ts @@ -58,7 +58,7 @@ export type AccountMessage = | { type: "REDEPLOY_ACCOUNT_REJ" } | { type: "GET_ENCRYPTED_PRIVATE_KEY" - data: { encryptedSecret: string } + data: { encryptedSecret: string; account: BaseWalletAccount } } | { type: "GET_ENCRYPTED_PRIVATE_KEY_RES" diff --git a/packages/extension/src/shared/shield/backend/account.ts b/packages/extension/src/shared/shield/backend/account.ts index dedb127de..819aac2e4 100644 --- a/packages/extension/src/shared/shield/backend/account.ts +++ b/packages/extension/src/shared/shield/backend/account.ts @@ -44,7 +44,7 @@ const emailVerificationStatus = [ "notRequested", ] as const -export type EmailVerificationStatus = typeof emailVerificationStatus[number] +export type EmailVerificationStatus = (typeof emailVerificationStatus)[number] export const emailVerificationStatusErrorSchema = z.object({ name: z.string(), diff --git a/packages/extension/src/shared/shield/backend/time.ts b/packages/extension/src/shared/shield/backend/time.ts index 74541be6c..7d45cf7a1 100644 --- a/packages/extension/src/shared/shield/backend/time.ts +++ b/packages/extension/src/shared/shield/backend/time.ts @@ -21,27 +21,9 @@ export const getBackendTimeSeconds = async () => { } } -/** determine skew (difference) between local time and backend time */ - -export const getBackendTimeSkew = async () => { - const timeStart = new Date().getTime() - const backendTimeSeconds = await getBackendTimeSeconds() - const timeNow = new Date().getTime() - /** average how long it took for one hop client -> server, or server -> client */ - const responseTime = (timeNow - timeStart) / 2 - /** approximate what backend time should be right now */ - const backendTimeNow = backendTimeSeconds * 1000 + responseTime - /** determine skew (difference) between local time and backend time */ - const backendTimeSkew = backendTimeNow - timeNow - return backendTimeSkew -} - /** determine the expected backend time right now in seconds (aka 'epoch') */ export const getBackendTimeNowSeconds = async () => { - const backendTimeSkew = await getBackendTimeSkew() - const timeNow = new Date().getTime() - const backendTimeNow = timeNow + backendTimeSkew - /** conver to epoch */ - return Math.floor(backendTimeNow / 1000) + const backendTimeSeconds = await getBackendTimeSeconds() + return Math.floor(backendTimeSeconds) } diff --git a/packages/extension/src/shared/shield/jwt.ts b/packages/extension/src/shared/shield/jwt.ts index b65a56f9e..8df7abbac 100644 --- a/packages/extension/src/shared/shield/jwt.ts +++ b/packages/extension/src/shared/shield/jwt.ts @@ -53,7 +53,7 @@ export const generateJwt = async () => { .setProtectedHeader({ alg, jwk: publicJwk }) .setIssuedAt(backendTimeNowSeconds) .setIssuer("kid:" + thumbprint) - .setExpirationTime("5m") + .setExpirationTime(backendTimeNowSeconds + 5 * 60.0) .sign(privateKey) return jwt diff --git a/packages/extension/src/shared/token/storage.ts b/packages/extension/src/shared/token/storage.ts index 15835caf7..19d6af4f3 100644 --- a/packages/extension/src/shared/token/storage.ts +++ b/packages/extension/src/shared/token/storage.ts @@ -1,9 +1,7 @@ -import * as yup from "yup" +import { z } from "zod" -import { addressSchema } from "../../ui/services/addresses" import { ArrayStorage } from "../storage" -import { assertSchema } from "../utils/schema" -import { BaseToken, Token } from "./type" +import { BaseToken, BaseTokenSchema, Token } from "./type" import { equalToken, parsedDefaultTokens } from "./utils" export const tokenStore = new ArrayStorage(parsedDefaultTokens, { @@ -12,40 +10,34 @@ export const tokenStore = new ArrayStorage(parsedDefaultTokens, { compare: equalToken, }) -export const baseTokenSchema: yup.Schema = yup - .object() - .required("BaseToken is required") - .shape({ - address: addressSchema.required("Address is required"), - networkId: yup.string().required("Network is required"), - }) +export const tokenSchema = BaseTokenSchema.extend({ + name: z.string({ required_error: "Name is required" }), + symbol: z + .string({ + required_error: "Symbol is required", + }) + .min(1, { message: "Symbol must be atleast 1 character" }), + decimals: z.number({ required_error: "Decimals is required" }), + image: z.string().optional(), + showAlways: z.boolean().optional(), +}) -export const tokenSchema: yup.Schema = baseTokenSchema - .required("Token is required") - .shape({ - name: yup.string().required("Name is required"), - symbol: yup.string().required("Symbol is required").min(1).max(6), - decimals: yup - .string() - .matches(/^\d+$/, "Decimals must be a number") - .required("Decimals is required"), - image: yup.string(), - showAlways: yup.boolean(), +export async function addToken(token: Token) { + const newToken: Token = tokenSchema.parse({ + ...token, + showAlways: true, }) -export async function addToken(token: Token) { - const newToken: Token = { ...token, showAlways: true } - await assertSchema(tokenSchema, newToken) return tokenStore.push(newToken) } export async function hasToken(token: BaseToken) { - await assertSchema(baseTokenSchema, token) - const [hit] = await tokenStore.get((t) => equalToken(t, token)) + const parsedToken = BaseTokenSchema.parse(token) + const [hit] = await tokenStore.get((t) => equalToken(t, parsedToken)) return Boolean(hit) } export async function removeToken(token: BaseToken) { - await assertSchema(baseTokenSchema, token) - return tokenStore.remove((t) => equalToken(t, token)) + const parsedToken = BaseTokenSchema.parse(token) + return tokenStore.remove((t) => equalToken(t, parsedToken)) } diff --git a/packages/extension/src/shared/token/type.ts b/packages/extension/src/shared/token/type.ts index 0bce8b40e..e5a85ae8e 100644 --- a/packages/extension/src/shared/token/type.ts +++ b/packages/extension/src/shared/token/type.ts @@ -1,17 +1,28 @@ -export interface BaseToken { - address: string - networkId: string -} +import { z } from "zod" -export interface RequestToken extends Omit { - address: string - networkId?: string - name?: string - symbol?: string - decimals?: number -} +export const BaseTokenSchema = z.object( + { + address: z.string({ required_error: "Address is required" }), + networkId: z.string({ required_error: "Network is required" }), + }, + { required_error: "BaseToken is required" }, +) -export interface Token extends Required { - image?: string - showAlways?: boolean -} +export type BaseToken = z.infer + +export const RequestTokenSchema = z.object({ + address: z.string(), + networkId: z.string().optional(), + name: z.string().optional(), + symbol: z.string().optional(), + decimals: z.number().optional(), +}) + +export type RequestToken = z.infer + +export const TokenSchema = RequestTokenSchema.required().extend({ + image: z.string().optional(), + showAlways: z.boolean().optional(), +}) + +export type Token = z.infer diff --git a/packages/extension/src/shared/transactionReview.service.ts b/packages/extension/src/shared/transactionReview.service.ts index 5269d91fb..c2708462a 100644 --- a/packages/extension/src/shared/transactionReview.service.ts +++ b/packages/extension/src/shared/transactionReview.service.ts @@ -53,7 +53,7 @@ export const apiTransactionReviewActivityType = [ ] as const export type ApiTransactionReviewActivityType = - typeof apiTransactionReviewActivityType[number] + (typeof apiTransactionReviewActivityType)[number] export type TransactionReviewWithType = ApiTransactionReview & { type: ApiTransactionReviewActivityType diff --git a/packages/extension/src/ui/AppRoutes.tsx b/packages/extension/src/ui/AppRoutes.tsx index 7b710548a..059b555a6 100644 --- a/packages/extension/src/ui/AppRoutes.tsx +++ b/packages/extension/src/ui/AppRoutes.tsx @@ -55,7 +55,7 @@ import { AddressbookSettingsScreen } from "./features/settings/AddressbookSettin import { BlockExplorerSettingsScreen } from "./features/settings/BlockExplorerSettingsScreen" import { DappConnectionsSettingsScreen } from "./features/settings/DappConnectionsSettingsScreen" import { DeveloperSettings } from "./features/settings/DeveloperSettings" -import { DeclareOrDeployContractSuccess } from "./features/settings/DeveloperSettings/DeclareContractClasshash" +import { DeclareOrDeployContractSuccess } from "./features/settings/DeveloperSettings/DeclareOrDeployContractSuccess" import { DeclareSmartContractScreen } from "./features/settings/DeveloperSettings/DeclareSmartContractScreen" import { DeploySmartContractScreen } from "./features/settings/DeveloperSettings/DeploySmartContractScreen" import { PrivacyExperimentalSettings } from "./features/settings/ExperimentalSettings" diff --git a/packages/extension/src/ui/components/PrivacyStatementText.tsx b/packages/extension/src/ui/components/PrivacyStatementText.tsx index 2a904e9da..af28cc51d 100644 --- a/packages/extension/src/ui/components/PrivacyStatementText.tsx +++ b/packages/extension/src/ui/components/PrivacyStatementText.tsx @@ -13,7 +13,7 @@ const Container = styled.span` export const PrivacyStatementText: FC = () => { return ( - + GDPR statement for browser extension wallet: Argent takes the privacy and security of individuals very seriously and takes every reasonable measure and precaution to protect and secure the personal data that we process. diff --git a/packages/extension/src/ui/features/accountEdit/AccountEditScreen.tsx b/packages/extension/src/ui/features/accountEdit/AccountEditScreen.tsx index a42caa06e..fca50711d 100644 --- a/packages/extension/src/ui/features/accountEdit/AccountEditScreen.tsx +++ b/packages/extension/src/ui/features/accountEdit/AccountEditScreen.tsx @@ -240,7 +240,7 @@ export const AccountEditScreen: FC = () => { )} navigate(routes.exportPrivateKey())} + onClick={() => navigate(routes.exportPrivateKey(accountAddress))} > Export private key diff --git a/packages/extension/src/ui/features/accountTokens/ExportPrivateKeyScreen.tsx b/packages/extension/src/ui/features/accountTokens/ExportPrivateKeyScreen.tsx index d2453be67..c04be66fe 100644 --- a/packages/extension/src/ui/features/accountTokens/ExportPrivateKeyScreen.tsx +++ b/packages/extension/src/ui/features/accountTokens/ExportPrivateKeyScreen.tsx @@ -6,11 +6,12 @@ import styled from "styled-components" import { Button } from "../../components/Button" import { CopyTooltip } from "../../components/CopyTooltip" import { Paragraph } from "../../components/Page" -import { routes } from "../../routes" +import { routes, useRouteAccountAddress } from "../../routes" import { checkPassword } from "../../services/backgroundSessions" import { H2 } from "../../theme/Typography" import { StickyGroup } from "../actions/DeprecatedConfirmScreen" import { PasswordForm } from "../lock/PasswordForm" +import { useCurrentNetwork } from "../networks/useNetworks" import { StatusMessageBanner } from "../statusMessage/StatusMessageBanner" import { usePrivateKey } from "./usePrivateKey" @@ -70,8 +71,10 @@ export const ExportPrivateKeyScreen: FC = () => { const [isPasswordValid, setPasswordValid] = useState(false) const navigate = useNavigate() + const accountAddress = useRouteAccountAddress() + const network = useCurrentNetwork() - const privateKey = usePrivateKey() + const privateKey = usePrivateKey(accountAddress, network.id) const handleVerifyPassword = async (password: any) => { const isValid = await checkPassword(password) diff --git a/packages/extension/src/ui/features/accountTokens/usePrivateKey.ts b/packages/extension/src/ui/features/accountTokens/usePrivateKey.ts index fe5d37001..c4bd60e2e 100644 --- a/packages/extension/src/ui/features/accountTokens/usePrivateKey.ts +++ b/packages/extension/src/ui/features/accountTokens/usePrivateKey.ts @@ -1,16 +1,24 @@ import { useCallback, useEffect, useState } from "react" import { getPrivateKey } from "../../services/backgroundAccounts" +import { useSelectedAccount } from "../accounts/accounts.state" -export const usePrivateKey = () => { +export const usePrivateKey = (address?: string, networkId?: string) => { const [privateKey, setPrivateKey] = useState() const getPrivateKeyCallback = useCallback(getPrivateKey, []) useEffect(() => { - getPrivateKeyCallback().then(setPrivateKey) + if (address && networkId) { + getPrivateKeyCallback({ address, networkId }).then(setPrivateKey) + } // on mount }, []) // eslint-disable-line react-hooks/exhaustive-deps return privateKey } + +export const usePrivateKeyForSelectedAccount = () => { + const account = useSelectedAccount() + return usePrivateKey(account?.address, account?.networkId) +} diff --git a/packages/extension/src/ui/features/actions/AddTokenScreen.tsx b/packages/extension/src/ui/features/actions/AddTokenScreen.tsx index a19fecb6e..5f527f640 100644 --- a/packages/extension/src/ui/features/actions/AddTokenScreen.tsx +++ b/packages/extension/src/ui/features/actions/AddTokenScreen.tsx @@ -4,6 +4,7 @@ import React, { FC, useEffect, useMemo, useRef, useState } from "react" import { useNavigate } from "react-router-dom" import { number } from "starknet" import styled from "styled-components" +import { ZodError } from "zod" import { addToken } from "../../../shared/token/storage" import { RequestToken, Token } from "../../../shared/token/type" @@ -181,7 +182,11 @@ export const AddTokenScreen: FC = ({ onSubmit?.() navigate(routes.accountTokens()) } catch (e) { - setError("Token already exists") + if (e instanceof ZodError) { + setError(e.issues[0].message) + } else { + setError("Token not supported") + } } } }} diff --git a/packages/extension/src/ui/features/settings/DeveloperSettings/DeclareContractClasshash.tsx b/packages/extension/src/ui/features/settings/DeveloperSettings/DeclareOrDeployContractSuccess.tsx similarity index 76% rename from packages/extension/src/ui/features/settings/DeveloperSettings/DeclareContractClasshash.tsx rename to packages/extension/src/ui/features/settings/DeveloperSettings/DeclareOrDeployContractSuccess.tsx index 2270ac81e..ae95391d0 100644 --- a/packages/extension/src/ui/features/settings/DeveloperSettings/DeclareContractClasshash.tsx +++ b/packages/extension/src/ui/features/settings/DeveloperSettings/DeclareOrDeployContractSuccess.tsx @@ -2,20 +2,19 @@ import { BarCloseButton, Button, CopyTooltip, - H3, - H6, + FlowHeader, NavigationContainer, P3, icons, } from "@argent/ui" -import { Box, Flex, Text } from "@chakra-ui/react" +import { Box, Flex } from "@chakra-ui/react" import { FC } from "react" import { useNavigate, useParams } from "react-router-dom" import { routes } from "../../../routes" import { StickyGroup } from "../../actions/DeprecatedConfirmScreen" -const { TickCircleIcon } = icons +const { CopyIcon } = icons export const DeclareOrDeployContractSuccess: FC = () => { const navigate = useNavigate() @@ -32,25 +31,26 @@ export const DeclareOrDeployContractSuccess: FC = () => { } > {value && ( - - - - + {isDeclare ? ( - <> -

Contract declared

-
Contract declared with class hash:
- + ) : ( - <> -

Contract deployed

-
Contract deployed with address:
- + )} { copyValue={value} >
@@ -94,7 +95,7 @@ export const DeclareOrDeployContractSuccess: FC = () => { colorScheme="primary" width="100%" > - Go to account + Done )} diff --git a/packages/extension/src/ui/features/shield/ShieldAccountActivate.tsx b/packages/extension/src/ui/features/shield/ShieldAccountActivate.tsx index 31217d700..7e75de357 100644 --- a/packages/extension/src/ui/features/shield/ShieldAccountActivate.tsx +++ b/packages/extension/src/ui/features/shield/ShieldAccountActivate.tsx @@ -1,20 +1,26 @@ -import { icons } from "@argent/ui" +import { FlowHeader, icons } from "@argent/ui" import { Center, VStack } from "@chakra-ui/react" import { FC } from "react" -import { ShieldHeader } from "./ui/ShieldHeader" import { ShieldIconRow } from "./ui/ShieldIconRow" import { ShieldLearnMoreButton } from "./ui/ShieldLearnMoreButton" -const { EmailIcon, LockIcon, InfoIcon, ArgentShieldDeactivateIcon } = icons +const { + EmailIcon, + LockIcon, + InfoIcon, + ArgentShieldDeactivateIcon, + ArgentShieldIcon, +} = icons export const ShieldAccountActivate: FC = () => { return ( <> - diff --git a/packages/extension/src/ui/features/shield/ShieldAccountDeactivate.tsx b/packages/extension/src/ui/features/shield/ShieldAccountDeactivate.tsx index 24557cbf3..d9ccd2a77 100644 --- a/packages/extension/src/ui/features/shield/ShieldAccountDeactivate.tsx +++ b/packages/extension/src/ui/features/shield/ShieldAccountDeactivate.tsx @@ -1,4 +1,4 @@ -import { icons } from "@argent/ui" +import { FlowHeader, icons } from "@argent/ui" import { Center, VStack } from "@chakra-ui/react" import { FC } from "react" @@ -6,12 +6,11 @@ import { getAccountName, useAccountMetadata, } from "../accounts/accountMetadata.state" -import { ShieldHeader } from "./ui/ShieldHeader" import { ShieldIconRow } from "./ui/ShieldIconRow" import { ShieldLearnMoreButton } from "./ui/ShieldLearnMoreButton" import { useRouteAccount } from "./useRouteAccount" -const { InfoIcon } = icons +const { InfoIcon, ArgentShieldIcon } = icons export const ShieldAccountDeactivate: FC = () => { const account = useRouteAccount() @@ -22,10 +21,11 @@ export const ShieldAccountDeactivate: FC = () => { return ( <> - diff --git a/packages/extension/src/ui/features/shield/ShieldAccountNotDeployed.tsx b/packages/extension/src/ui/features/shield/ShieldAccountNotDeployed.tsx index 26c487448..2242a7e55 100644 --- a/packages/extension/src/ui/features/shield/ShieldAccountNotDeployed.tsx +++ b/packages/extension/src/ui/features/shield/ShieldAccountNotDeployed.tsx @@ -1,7 +1,6 @@ +import { FlowHeader, icons } from "@argent/ui" import { FC } from "react" - -import { ShieldHeader } from "./ui/ShieldHeader" - +const { ArgentShieldIcon } = icons interface ShieldAccountNotReadyProps { needsUpgrade?: boolean } @@ -11,9 +10,10 @@ export const ShieldAccountNotReady: FC = ({ }) => { const action = needsUpgrade ? "upgrade" : "deploy" return ( - ) } diff --git a/packages/extension/src/ui/features/shield/ShieldBaseActionScreen.tsx b/packages/extension/src/ui/features/shield/ShieldBaseActionScreen.tsx index 2902c5ee1..411d2cf01 100644 --- a/packages/extension/src/ui/features/shield/ShieldBaseActionScreen.tsx +++ b/packages/extension/src/ui/features/shield/ShieldBaseActionScreen.tsx @@ -1,9 +1,13 @@ -import { BarBackButton, Button, NavigationContainer, icons } from "@argent/ui" +import { + BarBackButton, + Button, + FlowHeader, + NavigationContainer, + icons, +} from "@argent/ui" import { Flex } from "@chakra-ui/react" import { FC } from "react" -import { ShieldHeader } from "./ui/ShieldHeader" - const { ArgentShieldIcon, ArgentShieldDeactivateIcon } = icons export interface ShieldBaseActionScreenProps { @@ -20,7 +24,7 @@ export const ShieldBaseActionScreen: FC = ({ return ( } title={"Argent Shield"}> - = ({ } })} > - { +}: GetFlowHeaderProps): FlowHeaderProps => { if (!liveAccountGuardianState) { return { title: "Argent Shield", @@ -98,7 +105,7 @@ export const ShieldBaseFinishScreen: FC = ({ }) => { const navigate = useNavigate() - const headerProps = getShieldHeaderProps({ + const headerProps = getFlowHeaderProps({ accountName, liveAccountGuardianState, }) @@ -117,7 +124,7 @@ export const ShieldBaseFinishScreen: FC = ({ return (
- +
= ({ leftButton={onBack ? : null} title={"Argent Shield"} > - - = ({ const { colorScheme, title } = getEscapeDisplayAttributes(liveAccountEscape) return ( - = ({ : `1 more transaction needed to remove Argent Shield due to our security model` return ( - = ({ const { colorScheme, title } = getEscapeDisplayAttributes(liveAccountEscape) return ( - { const navigate = useNavigate() const account = useRouteAccount() @@ -153,11 +160,12 @@ export const EscapeWarningScreen: FC = () => { if (pending) { return (
-
) @@ -165,11 +173,12 @@ export const EscapeWarningScreen: FC = () => { if (pendingChangeGuardian) { return (
-
) diff --git a/packages/extension/src/ui/routes.ts b/packages/extension/src/ui/routes.ts index 6de0dc489..d619d03d5 100644 --- a/packages/extension/src/ui/routes.ts +++ b/packages/extension/src/ui/routes.ts @@ -150,7 +150,10 @@ export const routes = { newToken: route("/tokens/new"), funding: route("/funding"), fundingBridge: route("/funding/bridge"), - exportPrivateKey: route("/export-private-key"), + exportPrivateKey: route( + (accountAddress) => `/export-private-key/${accountAddress}`, + "/export-private-key/:accountAddress", + ), fundingQrCode: route("/funding/qr-code"), fundingProvider: route("/funding/provider"), token: route( diff --git a/packages/extension/src/ui/services/backgroundAccounts.ts b/packages/extension/src/ui/services/backgroundAccounts.ts index f57202a47..a87a5a860 100644 --- a/packages/extension/src/ui/services/backgroundAccounts.ts +++ b/packages/extension/src/ui/services/backgroundAccounts.ts @@ -129,11 +129,11 @@ export const redeployAccount = async (data: BaseWalletAccount) => { } } -export const getPrivateKey = async () => { +export const getPrivateKey = async (account: BaseWalletAccount) => { const { secret, encryptedSecret } = await generateEncryptedSecret() sendMessage({ type: "GET_ENCRYPTED_PRIVATE_KEY", - data: { encryptedSecret }, + data: { encryptedSecret, account }, }) const { encryptedPrivateKey } = await waitForMessage( diff --git a/packages/get-starknet/package.json b/packages/get-starknet/package.json index 2380fd307..38b533ee8 100644 --- a/packages/get-starknet/package.json +++ b/packages/get-starknet/package.json @@ -1,6 +1,6 @@ { "name": "@argent/get-starknet", - "version": "5.3.17", + "version": "5.3.20", "repository": "github:argentlabs/argent-x", "private": false, "main": "dist/", diff --git a/packages/guardian/package.json b/packages/guardian/package.json index 32223cdf4..186705b5f 100644 --- a/packages/guardian/package.json +++ b/packages/guardian/package.json @@ -1,6 +1,6 @@ { "name": "@argent/guardian", - "version": "5.3.17", + "version": "5.3.20", "license": "MIT", "private": false, "type": "module", diff --git a/packages/multicall/package.json b/packages/multicall/package.json index e80b3b093..bde5880d5 100644 --- a/packages/multicall/package.json +++ b/packages/multicall/package.json @@ -1,6 +1,6 @@ { "name": "@argent/x-multicall", - "version": "5.3.17", + "version": "5.3.20", "description": "A library for batched calls to Starknet smart contracts", "keywords": [ "starknet", diff --git a/packages/sessions/package.json b/packages/sessions/package.json index e66e5451b..63ab8c816 100644 --- a/packages/sessions/package.json +++ b/packages/sessions/package.json @@ -1,6 +1,6 @@ { "name": "@argent/x-sessions", - "version": "5.3.17", + "version": "5.3.20", "description": "Manage sessions for Argent X wallets", "keywords": [ "starknet", diff --git a/packages/stack-router/package.json b/packages/stack-router/package.json index a2a168b2f..9729ff250 100644 --- a/packages/stack-router/package.json +++ b/packages/stack-router/package.json @@ -1,6 +1,6 @@ { "name": "@argent/stack-router", - "version": "5.3.17", + "version": "5.3.20", "license": "MIT", "private": true, "files": [ @@ -32,7 +32,7 @@ "lodash-es": "^4.17.21" }, "devDependencies": { - "@argent/ui": "^5.3.17", + "@argent/ui": "^5.3.20", "@types/lodash-es": "^4.17.6", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", diff --git a/packages/storybook/package.json b/packages/storybook/package.json index cb5305e1d..d69e07bbd 100644 --- a/packages/storybook/package.json +++ b/packages/storybook/package.json @@ -1,10 +1,10 @@ { "name": "@argent-x/storybook", - "version": "5.3.17", + "version": "5.3.20", "private": true, "devDependencies": { - "@argent-x/extension": "^5.3.17", - "@argent/ui": "^5.3.17", + "@argent-x/extension": "^5.3.20", + "@argent/ui": "^5.3.20", "@babel/core": "^7.18.5", "@chakra-ui/storybook-addon": "^4.0.12", "@storybook/addon-actions": "^6.5.9", diff --git a/packages/swap/package.json b/packages/swap/package.json index 30f7df19f..ef6f8b543 100644 --- a/packages/swap/package.json +++ b/packages/swap/package.json @@ -1,6 +1,6 @@ { "name": "@argent/x-swap", - "version": "5.3.17", + "version": "5.3.20", "license": "MIT", "private": true, "files": [ diff --git a/packages/ui/package.json b/packages/ui/package.json index f60c67d09..4bbddf920 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@argent/ui", - "version": "5.3.17", + "version": "5.3.20", "license": "MIT", "private": true, "files": [ diff --git a/packages/extension/src/ui/features/shield/ui/ShieldHeader.tsx b/packages/ui/src/components/FlowHeader.tsx similarity index 81% rename from packages/extension/src/ui/features/shield/ui/ShieldHeader.tsx rename to packages/ui/src/components/FlowHeader.tsx index 542a040d7..9d0921bfe 100644 --- a/packages/extension/src/ui/features/shield/ui/ShieldHeader.tsx +++ b/packages/ui/src/components/FlowHeader.tsx @@ -1,8 +1,8 @@ -import { H4, P3, icons } from "@argent/ui" import { Center, ChakraComponent, Circle, Spinner } from "@chakra-ui/react" import { FC, ReactNode } from "react" -const { ArgentShieldIcon } = icons +import { TickIcon } from "./icons" +import { H4, P3 } from "./Typography" const variants = { default: { @@ -31,23 +31,23 @@ const variants = { }, } -export type ShieldHeaderVariant = keyof typeof variants +export type FlowHeaderVariant = keyof typeof variants -export interface ShieldHeaderProps { +export interface FlowHeaderProps { title: ReactNode subtitle?: ReactNode - variant?: ShieldHeaderVariant + variant?: FlowHeaderVariant size?: "md" | "lg" icon?: ChakraComponent<"svg"> isLoading?: boolean } -export const ShieldHeader: FC = ({ +const FlowHeader: FC = ({ title, subtitle, variant: variantKey = "default", size = "md", - icon: Icon = ArgentShieldIcon, + icon: Icon = TickIcon, isLoading, }) => { const variant = variants[variantKey] @@ -72,3 +72,5 @@ export const ShieldHeader: FC = ({
) } + +export { FlowHeader } diff --git a/packages/ui/src/components/index.ts b/packages/ui/src/components/index.ts index 8a1630c40..50d9c6fa2 100644 --- a/packages/ui/src/components/index.ts +++ b/packages/ui/src/components/index.ts @@ -12,6 +12,7 @@ export * from "./DapplandBanner" export * from "./DetailAccordion" export * from "./Empty" export * from "./Error" +export * from "./FlowHeader" export * from "./Input" export * from "./LoadingPulse" export * from "./Menu" diff --git a/packages/window/package.json b/packages/window/package.json index cac7daead..ae7e67cd2 100644 --- a/packages/window/package.json +++ b/packages/window/package.json @@ -1,6 +1,6 @@ { "name": "@argent/x-window", - "version": "5.3.17", + "version": "5.3.20", "license": "MIT", "files": [ "dist" diff --git a/sonar-project.properties b/sonar-project.properties index bd3c93060..18c7aa154 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,4 +1,4 @@ # must be unique in a given SonarQube instance -sonar.projectKey=argentlabs_argent-x +sonar.projectKey=argentlabs_argent-x-private sonar.organization=argentlabs sonar.javascript.lcov.reportPaths=/packages/extension/coverage/lcov.info,/packages/sessions/coverage/lcov.info,/packages/multicall/coverage/lcov.info \ No newline at end of file