diff --git a/extension/.cspell.json b/extension/.cspell.json index 7dd4e950..8f58c810 100644 --- a/extension/.cspell.json +++ b/extension/.cspell.json @@ -21,6 +21,7 @@ "cowswap", "Delegatecall", "delegatecalls", + "depay", "esbuild", "ethersproject", "foundance", @@ -51,15 +52,22 @@ "refork", "rpcs", "Samczun", + "sandboxed", "sepolia", + "servedir", + "serviceworker", "shazow", + "sidepanel", "sighash", "Sindre", "Sorhus", "Sourcify", + "speculationrules", "staderlabs", "Stakewise", "Sushiswap", + "tailwindcss", + "textbox", "toastify", "Uids", "UNWRAPPER", @@ -67,14 +75,7 @@ "walletconnect", "whatsabi", "xdai", - "xmlhttprequest", - "serviceworker", - "textbox", - "servedir", - "sidepanel", - "sandboxed", - "speculationrules", - "depay" + "xmlhttprequest" ], "flagWords": [], "ignorePaths": [ diff --git a/extension/.vscode/settings.json b/extension/.vscode/settings.json index e1a6da18..11fd8a93 100644 --- a/extension/.vscode/settings.json +++ b/extension/.vscode/settings.json @@ -6,5 +6,6 @@ "typescript.enablePromptUseWorkspaceTsdk": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" - } + }, + "typescript.tsdk": "node_modules/typescript/lib" } diff --git a/extension/esbuild.js b/extension/esbuild.mjs similarity index 99% rename from extension/esbuild.js rename to extension/esbuild.mjs index 734f8a45..6f9cbd35 100644 --- a/extension/esbuild.js +++ b/extension/esbuild.mjs @@ -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: { diff --git a/extension/eslint.config.mjs b/extension/eslint.config.mjs index 5fe73f91..73483379 100644 --- a/extension/eslint.config.mjs +++ b/extension/eslint.config.mjs @@ -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 } }, } ) diff --git a/extension/package.json b/extension/package.json index 0c11514f..afd3badb 100644 --- a/extension/package.json +++ b/extension/package.json @@ -1,8 +1,8 @@ { "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 ", @@ -10,9 +10,9 @@ "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", @@ -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", @@ -111,4 +111,4 @@ "vitest-chrome": "patches/vitest-chrome.patch" } } -} +} \ No newline at end of file diff --git a/extension/pnpm-lock.yaml b/extension/pnpm-lock.yaml index af284f05..ec3fec0b 100644 --- a/extension/pnpm-lock.yaml +++ b/extension/pnpm-lock.yaml @@ -48,8 +48,8 @@ importers: specifier: ^2.4.2 version: 2.5.2(typescript@5.6.3) '@safe-global/protocol-kit': - specifier: ^4.0.2 - version: 4.1.1(typescript@5.6.3) + specifier: ^5.0.1 + version: 5.0.2(typescript@5.6.3) '@safe-global/safe-apps-sdk': specifier: ^9.1.0 version: 9.1.0(typescript@5.6.3) diff --git a/extension/public/sidepanel.html b/extension/public/sidepanel.html index 2b834c69..25e05ada 100644 --- a/extension/public/sidepanel.html +++ b/extension/public/sidepanel.html @@ -11,7 +11,7 @@ /> Zodiac Pilot - +
diff --git a/extension/src/panel/providers/ForkProvider.ts b/extension/src/panel/providers/ForkProvider.ts index 43c096b0..76c1c084 100644 --- a/extension/src/panel/providers/ForkProvider.ts +++ b/extension/src/panel/providers/ForkProvider.ts @@ -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') } @@ -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, }, ], diff --git a/extension/tsconfig.json b/extension/tsconfig.json index 18c09642..ccf542ee 100644 --- a/extension/tsconfig.json +++ b/extension/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "ES2020", + "target": "ES2023", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, @@ -9,8 +9,8 @@ "strict": true, "forceConsistentCasingInFileNames": true, "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", + "module": "ESNext", + "moduleResolution": "Node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true,