Skip to content

Commit

Permalink
Merge pull request #186 from palladians/feat/enable-mainnet
Browse files Browse the repository at this point in the history
Feat/Enable Mainnet
  • Loading branch information
mrcnk authored Aug 2, 2024
2 parents 025d79b + 7a9207a commit 4cd51fb
Show file tree
Hide file tree
Showing 203 changed files with 5,970 additions and 7,896 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
VITE_APP_E2E=false
VITE_APP_DEFAULT_NETWORK=Devnet
VITE_APP_MINA_PROXY_MAINNET_URL=https://api.minascan.io/node/mainnet/v1/graphql
VITE_APP_MINA_PROXY_DEVNET_URL=https://api.minascan.io/node/devnet/v1/graphql
6 changes: 3 additions & 3 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ inputs:
description: Turborepo token
required: true
runs:
using: 'composite'
using: "composite"
steps:
- name: Turborepo Caching Server
uses: felixmosh/turborepo-gh-artifacts@v2
with:
repo-token: ${{ inputs.GITHUB_TOKEN }}
server-token: ${{ inputs.TURBO_SERVER_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/apps-extension-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ jobs:
test_and_build:
name: "Build and test"
env:
VITE_APP_MODE: web
VITE_APP_DEFAULT_NETWORK: Devnet
VITE_APP_DEFAULT_NETWORK: Mainnet
NODE_OPTIONS: "--max_old_space_size=4096"
runs-on: ubuntu-latest
steps:
Expand All @@ -52,7 +51,7 @@ jobs:
TURBO_API: "http://127.0.0.1:9080"
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: pallad
run: VITE_APP_MODE=$VITE_APP_MODE pnpm build:extension
run: VITE_APP_DEFAULT_NETWORK=$VITE_APP_DEFAULT_NETWORK pnpm build:extension
- name: Run unit tests
run: pnpm test:unit
- uses: actions/upload-artifact@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/apps-extension-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
e2e:
name: Run E2E tests
env:
VITE_APP_MODE: web
VITE_APP_E2E: true
VITE_APP_DEFAULT_NETWORK: Devnet
NODE_OPTIONS: "--max_old_space_size=4096"
runs-on: ubuntu-latest
Expand All @@ -27,7 +27,7 @@ jobs:
TURBO_API: "http://127.0.0.1:9080"
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: pallad
run: VITE_APP_MODE=$VITE_APP_MODE pnpm build:extension
run: VITE_APP_E2E=$VITE_APP_E2E VITE_APP_DEFAULT_NETWORK=$VITE_APP_DEFAULT_NETWORK pnpm build:extension
- name: Install Chromium for Playwright
working-directory: apps/extension
run: pnpm test:e2e:install
Expand Down
27 changes: 13 additions & 14 deletions .github/workflows/extension-release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,38 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Release version 🏷️'
description: "Release version 🏷️"
required: true
default: '0.0.1'
default: "0.0.1"
tag_name:
description: 'Tag name for the release 🔖'
description: "Tag name for the release 🔖"
required: true
release_name:
description: 'Name of the release 📛'
description: "Name of the release 📛"
required: true
release_body:
description: 'Release notes body 📝'
description: "Release notes body 📝"
required: true
draft:
description: 'Mark release as draft? 🚧'
description: "Mark release as draft? 🚧"
required: true
type: boolean
prerelease:
description: 'Mark as prerelease? 🚀'
description: "Mark as prerelease? 🚀"
required: true
type: boolean
generate_release_notes:
description: 'Generate release notes automatically? 📃'
description: "Generate release notes automatically? 📃"
required: true
type: boolean

jobs:
build_and_release:
name: 'Build and Release 🛠️'
name: "Build and Release 🛠️"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup env 🌍
uses: ./.github/actions/setup
with:
Expand All @@ -43,13 +43,12 @@ jobs:

- name: Build extension 🏗️
env:
VITE_APP_MODE: web
VITE_APP_DEFAULT_NETWORK: Devnet
NODE_OPTIONS: "--max_old_space_size=4096"
TURBO_API: 'http://127.0.0.1:9080'
TURBO_API: "http://127.0.0.1:9080"
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: pallad
run: VITE_APP_MODE=$VITE_APP_MODE pnpm build:extension
run: pnpm build:extension

- name: Compress dist folder
run: |
Expand All @@ -72,4 +71,4 @@ jobs:
draft: ${{ github.event.inputs.draft }}
prerelease: ${{ github.event.inputs.prerelease }}
files: pallad-chromium.zip
generate_release_notes: ${{ github.event.inputs.generate_release_notes }}
generate_release_notes: ${{ github.event.inputs.generate_release_notes }}
3 changes: 1 addition & 2 deletions .github/workflows/packages-ui-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
pages: write
id-token: write
env:
VITE_APP_MODE: web
VITE_APP_DEFAULT_NETWORK: Devnet
steps:
- uses: actions/checkout@v3
Expand All @@ -36,7 +35,7 @@ jobs:
TURBO_API: "http://127.0.0.1:9080"
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: pallad
run: VITE_APP_MODE=$VITE_APP_MODE pnpm build:features
run: pnpm build:features
- name: Build features stories
run: pnpm story:features
- name: Upload pages artifact
Expand Down
6 changes: 0 additions & 6 deletions apps/extension/.env.example

This file was deleted.

14 changes: 0 additions & 14 deletions apps/extension/app.html

This file was deleted.

12 changes: 8 additions & 4 deletions apps/extension/e2e/pom/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,14 @@ export class OnboardingPom extends BasePom {
return confirmAloneButton.click()
}
async fillMnemonic(mnemonic: string[]) {
for (let i = 0; i < mnemonic.length; i++) {
const field = this.page.getByTestId(`${TestId.MNEMONIC_FIELD}.${i}`)
await field.fill(mnemonic[i])
}
const modifier = process.platform === "darwin" ? "Meta" : "Control"
const wholeMnemonic = mnemonic.join(" ")
await this.page.evaluate(
`navigator.clipboard.writeText("${wholeMnemonic}")`,
)
const firstField = this.page.getByTestId(`${TestId.MNEMONIC_FIELD}.0`)
await firstField.focus()
await this.page.keyboard.press(`${modifier}+KeyV`)
}
getAddressTruncated() {
const addressTruncated = this.page.getByTestId(TestId.ADDRESS_TRUNCATED)
Expand Down
4 changes: 0 additions & 4 deletions apps/extension/e2e/provider-enable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ test.skip("enable window.mina and handle pop-up on a specific webpage", async ({
const responseRequestNetwork = await page.evaluate(() =>
window.mina.request({ method: "mina_requestNetwork" }),
)
console.log("responseRequestNetwork:", responseRequestNetwork)
expect(responseRequestNetwork.result.chainId).not.toBe(undefined)

const responseAddChain = await page.evaluate(() =>
Expand All @@ -67,7 +66,6 @@ test.skip("enable window.mina and handle pop-up on a specific webpage", async ({
},
}),
)
console.log("responseAddChain:", responseAddChain)
expect(responseAddChain.result.networkName).toBe("ZekoDevNet")

const responseSwitchChain = await page.evaluate(() =>
Expand All @@ -78,13 +76,11 @@ test.skip("enable window.mina and handle pop-up on a specific webpage", async ({
},
}),
)
console.log("responseSwitchChain:", responseSwitchChain)
expect(responseSwitchChain.result.networkName).toBe("ZekoDevNet")

const responseBalanceZeko = await page.evaluate(() =>
window.mina.request({ method: "mina_getBalance" }),
)
console.log("responseBalanceZeko:", responseBalanceZeko)
expect(responseBalanceZeko.result).not.toBe(0)

await page.evaluate(() =>
Expand Down
50 changes: 22 additions & 28 deletions apps/extension/index.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Pallad</title>
<link rel="stylesheet" href="/src/assets/fonts.css" />
<style>
:root {
--popup: 1;
}
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Pallad</title>
<link rel="stylesheet" href="/src/assets/fonts.css" />
<style>
:root {
--popup: 1;
}

html {
width: 371px;
height: 600px;
background-color: #0a0a10;
}
html {
background-color: #0a0a10;
}

#root {
min-height: 100vh;
display: flex;
}
</style>
<script type="module">
import { Buffer } from 'buffer'
window.Buffer = Buffer
</script>
</head>
#root {
min-height: 100vh;
display: flex;
}
</style>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
62 changes: 0 additions & 62 deletions apps/extension/manifest.config.ts

This file was deleted.

48 changes: 48 additions & 0 deletions apps/extension/manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import packageJson from "./package.json" with { type: "json" }

export const manifest: chrome.runtime.ManifestV3 = {
manifest_version: 3,
name: "Pallad",
description:
"Discover the Future of Web3 with Pallad. Unlock the power of the world's lightest blockchain 🪶",
icons: {
16: "icons/16.png",
32: "icons/32.png",
48: "icons/48.png",
128: "icons/128.png",
},
version: packageJson.version,
action: { default_title: "Click to open panel" },
side_panel: { default_path: "index.html" },
permissions: ["storage", "activeTab", "background", "sidePanel"],
background: {
service_worker: "src/background/index.ts",
type: "module",
},
content_scripts: [
{
matches: ["https://*/*"],
js: ["src/inject/index.ts"],
run_at: "document_start",
all_frames: true,
},
],
web_accessible_resources: [
{
resources: ["pallad_rpc.js"],
matches: ["https://*/*"],
},
],
host_permissions: ["https://*/*"],
commands: {
_execute_action: {
suggested_key: {
windows: "Alt+Shift+P",
mac: "Alt+Shift+P",
chromeos: "Alt+Shift+P",
linux: "Alt+Shift+P",
},
description: "Open the Pallad extension",
},
},
}
Loading

0 comments on commit 4cd51fb

Please sign in to comment.