Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade safe protocol-kit and fix tooling #180

Open
wants to merge 6 commits into
base: sidepanel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions extension/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"cowswap",
"Delegatecall",
"delegatecalls",
"depay",
"esbuild",
"ethersproject",
"foundance",
Expand Down Expand Up @@ -51,30 +52,30 @@
"refork",
"rpcs",
"Samczun",
"sandboxed",
"sepolia",
"servedir",
"serviceworker",
"shazow",
"sidepanel",
"sighash",
"Sindre",
"Sorhus",
"Sourcify",
"speculationrules",
"staderlabs",
"Stakewise",
"Sushiswap",
"tailwindcss",
"textbox",
"toastify",
"Uids",
"UNWRAPPER",
"vnet",
"walletconnect",
"whatsabi",
"xdai",
"xmlhttprequest",
"serviceworker",
"textbox",
"servedir",
"sidepanel",
"sandboxed",
"speculationrules",
"depay"
"xmlhttprequest"
],
"flagWords": [],
"ignorePaths": [
Expand Down
3 changes: 2 additions & 1 deletion extension/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"typescript.enablePromptUseWorkspaceTsdk": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
},
"typescript.tsdk": "node_modules/typescript/lib"
}
1 change: 1 addition & 0 deletions extension/esbuild.js → extension/esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ esbuild
'./src/panel/app.tsx',
],
bundle: true,
format: 'esm',
minify: process.env.NODE_ENV === 'production',
sourcemap: process.env.NODE_ENV !== 'production' ? 'inline' : 'linked',
loader: {
Expand Down
2 changes: 1 addition & 1 deletion extension/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default tsEslint.config(
ignores: ['public/build', 'playwright-report'],
},
{
files: ['esbuild.js', 'manifest-util.js'],
files: ['esbuild.mjs', 'manifest-util.js'],
languageOptions: { globals: { process: true } },
}
)
10 changes: 5 additions & 5 deletions extension/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "zodiac-pilot",
"version": "0.0.0",
"type": "module",
"description": "Chrome extension to simulate dApp interactions and record transactions",
"type": "module",
"main": "index.js",
"repository": "https://github.com/gnosisguild/zodiac-pilot.git",
"author": "Jan-Felix <[email protected]>",
"license": "LGPLv3",
"private": true,
"scripts": {
"prebuild": "rimraf public/build",
"build": "NODE_ENV=production node esbuild.js",
"build": "NODE_ENV=production node esbuild.mjs",
"zip": "mv public zodiac-pilot && zip -vr zodiac-pilot.zip zodiac-pilot/ -x \"*.DS_Store\" && mv zodiac-pilot public",
"dev": "NODE_ENV=development node esbuild.js",
"dev": "NODE_ENV=development node esbuild.mjs",
"test:unit": "vitest",
"test:e2e": "playwright test --headed",
"check": "pnpm check:ts && pnpm check:format && pnpm check:lint && pnpm check:spelling",
Expand All @@ -33,7 +33,7 @@
"@noble/hashes": "^1.4.0",
"@playwright/test": "^1.48.1",
"@safe-global/api-kit": "^2.4.2",
"@safe-global/protocol-kit": "^4.0.2",
"@safe-global/protocol-kit": "^5.0.1",
"@safe-global/safe-apps-sdk": "^9.1.0",
"@safe-global/safe-core-sdk-types": "^5.0.2",
"@safe-global/safe-gateway-typescript-sdk": "^3.21.10",
Expand Down Expand Up @@ -111,4 +111,4 @@
"vitest-chrome": "patches/vitest-chrome.patch"
}
}
}
}
4 changes: 2 additions & 2 deletions extension/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion extension/public/sidepanel.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/>
<title>Zodiac Pilot</title>
<link rel="stylesheet" href="/build/panel/app.css" />
<script src="/build/panel/app.js" defer></script>
<script type="module" src="/build/panel/app.js" defer></script>
</head>
<body>
<div id="root"></div>
Expand Down
7 changes: 4 additions & 3 deletions extension/src/panel/providers/ForkProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ async function prepareSafeForSimulation(
let from = moduleAddress || ownerAddress || DUMMY_MODULE_ADDRESS
if (from === ZeroAddress) from = DUMMY_MODULE_ADDRESS

const iface = safe.getContractManager().safeContract?.contract.interface
if (!iface) {
const { safeContract } = safe.getContractManager()
if (!safeContract) {
throw new Error('Safe contract not found')
}

Expand All @@ -410,7 +410,8 @@ async function prepareSafeForSimulation(
params: [
{
to: avatarAddress,
data: iface.encodeFunctionData('enableModule', [from]),
// @ts-expect-error TODO: needs a fix in protocol-kit -> https://github.com/safe-global/safe-core-sdk/issues/1021
data: safeContract.encode('enableModule', [from]),
from: avatarAddress,
},
],
Expand Down
6 changes: 3 additions & 3 deletions extension/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "ES2020",
"target": "ES2023",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
Expand All @@ -9,8 +9,8 @@
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
Expand Down
Loading