Skip to content

Commit

Permalink
chore(wallet): refactor buffers to uint8arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcnk committed Jul 30, 2024
1 parent 8e78195 commit 6f709bc
Show file tree
Hide file tree
Showing 97 changed files with 673 additions and 956 deletions.
14 changes: 0 additions & 14 deletions apps/extension/app.html

This file was deleted.

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
4 changes: 0 additions & 4 deletions apps/extension/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
display: flex;
}
</style>
<script type="module">
import { Buffer } from "buffer";
window.Buffer = Buffer;
</script>
</head>

<body>
Expand Down
61 changes: 0 additions & 61 deletions apps/extension/manifest.config.ts

This file was deleted.

38 changes: 38 additions & 0 deletions apps/extension/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"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": "0.6.0",
"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://*/*"]
}
44 changes: 44 additions & 0 deletions apps/extension/manifest.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { writeJsonFile } from "write-json-file"
import packageJson from "./package.json" with { type: "json" }

const manifest = {
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://*/*"],
}

const run = async () => {
await writeJsonFile("manifest.json", manifest)
}

run()
14 changes: 8 additions & 6 deletions apps/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build && node scripts/append-oninstall.cjs",
"build": "tsc && node manifest.mjs && vite build",
"build:firefox": "web-ext build --source-dir=dist",
"build:safari": "xcrun safari-web-extension-converter dist --app-name Pallad --bundle-identifier xyz.pallad.app --swift --no-prompt --force --macos-only --no-open",
"build:safari": "xcrun safari-web-extension-converter dist --app-name Pallad --bundle-identifier co.pallad.app --swift --no-prompt --force --macos-only --no-open",
"preview": "vite preview",
"cleanup": "rimraf node_modules dist .turbo",
"test:e2e": "playwright test",
Expand All @@ -17,10 +17,10 @@
"@palladxyz/common": "workspace:*",
"@palladxyz/features": "workspace:*",
"@palladxyz/key-management": "workspace:*",
"@palladxyz/persistence": "workspace:*",
"@palladxyz/web-provider": "workspace:*",
"@plasmohq/messaging": "0.6.2",
"buffer": "6.0.3",
"debounce": "^2.1.0",
"next-themes": "0.3.0",
"react": "18.3.1",
"react-dom": "18.3.1",
Expand All @@ -32,13 +32,13 @@
"zod": "3.23.8"
},
"devDependencies": {
"@crxjs/vite-plugin": "2.0.0-beta.25",
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
"@esbuild-plugins/node-modules-polyfill": "0.2.2",
"@originjs/vite-plugin-commonjs": "1.0.3",
"@playwright/test": "1.45.3",
"@testing-library/react": "16.0.0",
"@total-typescript/ts-reset": "0.5.1",
"@tsconfig/vite-react": "3.0.2",
"@types/chrome": "0.0.269",
"@types/mocha": "10.0.7",
"@types/node": "22.0.0",
Expand All @@ -53,11 +53,13 @@
"type-fest": "4.23.0",
"vite": "5.3.5",
"vite-plugin-commonjs": "0.10.1",
"vite-plugin-node-polyfills": "0.22.0",
"vite-plugin-node-polyfills": "0.17.0",
"vite-plugin-require-transform": "1.0.21",
"vite-plugin-svgr": "4.2.0",
"vite-plugin-top-level-await": "1.4.2",
"vite-plugin-wasm": "3.3.0",
"web-ext": "8.2.0"
"vite-plugin-web-extension": "^4.1.6",
"web-ext": "8.2.0",
"write-json-file": "^6.0.0"
}
}
5 changes: 0 additions & 5 deletions apps/extension/prompt.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
display: flex;
}
</style>
<script type="module">
import { Buffer } from "buffer";
window.Buffer = Buffer;
chrome.runtime.connect({ name: "prompt" });
</script>
</head>

<body>
Expand Down
1 change: 0 additions & 1 deletion apps/extension/public/pallad_rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const callPalladAsync = ({ method, payload }) => {
channel.close()
const error = data.response?.error
if (error) {
console.log("[Pallad] Web Connector Error")
try {
console.table(JSON.parse(error.message))
} catch {
Expand Down
21 changes: 0 additions & 21 deletions apps/extension/scripts/append-oninstall.cjs

This file was deleted.

1 change: 1 addition & 0 deletions apps/extension/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useEffect } from "react"

function App() {
useEffect(() => {
if (typeof document === "undefined") return
const handleContextmenu = (e: MouseEvent) => {
if (!e.metaKey) e.preventDefault()
}
Expand Down
Loading

0 comments on commit 6f709bc

Please sign in to comment.