diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts index c8b391e2fd..6c9d7e6b07 100644 --- a/apps/remix-ide-e2e/src/tests/workspace.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts @@ -540,6 +540,26 @@ module.exports = { }, + 'Should create a cookbook workspace #group3': function (browser: NightwatchBrowser) { + browser + .clickLaunchIcon('filePanel') + .click('*[data-id="workspacesMenuDropdown"]') + .click('*[data-id="workspacecreate"]') + .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') + .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > button') + .click('select[id="wstemplate"]') + .click('select[id="wstemplate"] option[value=uniswapV4HookBookMultiSigSwapHook]') + // eslint-disable-next-line dot-notation + .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'multisig cookbook' }) + .waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') + .execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() }) + .waitForElementVisible('[data-id="PermissionHandler-modal-footer-ok-react"]', 300000) + .click('[data-id="PermissionHandler-modal-footer-ok-react"]') + .waitForElementVisible('*[data-id="treeViewLitreeViewItemsrc"]') + .waitForElementVisible('*[data-id="treeViewLitreeViewItemsrc/MULTI_SIG"]') + .waitForElementVisible('*[data-id="treeViewLitreeViewItemsrc/MULTI_SIG/MultiSigSwapHook.sol"]') + }, + tearDown: sauce } diff --git a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json index 4c92736be9..56a46287cb 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json +++ b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json @@ -109,8 +109,9 @@ "filePanel.semaphore": "Semaphore", "filePanel.hashchecker": "Hash Checker", "filePanel.rln": "Rate-Limiting Nullifier", - "filePanel.breakthroughLabsUniswapv4Hooks": "Breakthrough-Labs Uniswapv4Hooks", - "filePanel.uniswapV4Periphery": "Uniswap v4 Periphery", + "filePanel.breakthroughLabsUniswapv4Hooks": "Breakthrough-Labs Hooks", + "filePanel.uniswapV4Periphery": "v4 Periphery", + "filePanel.uniswapV4HookBookMultiSigSwapHook": "HookBook MultiSigSwapHook", "filePanel.transparent": "Transparent", "filePanel.initGitRepoTitle": "Check option to initialize workspace as a new git repository", "filePanel.switchToBranchTitle1": "Checkout new branch from remote branch", diff --git a/apps/remix-ide/src/remixEngine.js b/apps/remix-ide/src/remixEngine.js index 8622fe5a81..5c0657ce22 100644 --- a/apps/remix-ide/src/remixEngine.js +++ b/apps/remix-ide/src/remixEngine.js @@ -26,6 +26,7 @@ export class RemixEngine extends Engine { if (name === 'compilerloader') return { queueTimeout: 60000 * 4 } if (name === 'filePanel') return { queueTimeout: 60000 * 20 } if (name === 'openaigpt') return { queueTimeout: 60000 * 2 } + if (name === 'cookbookdev') return { queueTimeout: 60000 * 2 } return { queueTimeout: 10000 } } diff --git a/libs/remix-lib/src/execution/txRunnerWeb3.ts b/libs/remix-lib/src/execution/txRunnerWeb3.ts index 02d343b475..c25eba2519 100644 --- a/libs/remix-lib/src/execution/txRunnerWeb3.ts +++ b/libs/remix-lib/src/execution/txRunnerWeb3.ts @@ -32,7 +32,7 @@ export class TxRunnerWeb3 { tx.type = '0x2' } else { tx.gasPrice = toHex(BigInt(this.getWeb3().utils.toWei(txFee.gasPrice, 'gwei'))) - tx.type = '0x1' + // tx.type = '0x1' } } diff --git a/libs/remix-ui/helper/src/lib/components/custom-dropdown.tsx b/libs/remix-ui/helper/src/lib/components/custom-dropdown.tsx index 2fa0ed37c8..f27fc08869 100644 --- a/libs/remix-ui/helper/src/lib/components/custom-dropdown.tsx +++ b/libs/remix-ui/helper/src/lib/components/custom-dropdown.tsx @@ -29,7 +29,7 @@ export const CustomToggle = React.forwardRef( className={className.replace('dropdown-toggle', '')} >
-
{children}
+
{children}
{icon && (
diff --git a/libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx b/libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx index 5a9343b068..19fded98f9 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx @@ -71,14 +71,23 @@ function HomeTabGetStarted({plugin}: HomeTabGetStartedProps) { let templateDisplayName = TEMPLATE_NAMES[templateName] const metadata = TEMPLATE_METADATA[templateName] if (metadata) { - await plugin.call('dGitProvider', 'clone', {url: metadata.url, branch: metadata.branch}, templateDisplayName) - return + if (metadata.type === 'git') { + await plugin.call('dGitProvider', 'clone', {url: metadata.url, branch: metadata.branch}, templateDisplayName) + } else if (metadata && metadata.type === 'plugin') { + await plugin.appManager.activatePlugin('filePanel') + templateDisplayName = await plugin.call('filePanel', 'getAvailableWorkspaceName', templateDisplayName) + await plugin.call('filePanel', 'createWorkspace', templateDisplayName, 'blank') + await plugin.call('filePanel', 'setWorkspace', templateDisplayName) + plugin.verticalIcons.select('filePanel') + await plugin.call(metadata.name, metadata.endpoint, ...metadata.params) + } + } else { + await plugin.appManager.activatePlugin('filePanel') + templateDisplayName = await plugin.call('filePanel', 'getAvailableWorkspaceName', templateDisplayName) + await plugin.call('filePanel', 'createWorkspace', templateDisplayName, templateName) + await plugin.call('filePanel', 'setWorkspace', templateDisplayName) + plugin.verticalIcons.select('filePanel') } - await plugin.appManager.activatePlugin('filePanel') - templateDisplayName = await plugin.call('filePanel', 'getAvailableWorkspaceName', templateDisplayName) - await plugin.call('filePanel', 'createWorkspace', templateDisplayName, templateName) - await plugin.call('filePanel', 'setWorkspace', templateDisplayName) - plugin.verticalIcons.select('filePanel') _paq.push(['trackEvent', 'hometab', 'homeGetStarted', templateName]) } diff --git a/libs/remix-ui/terminal/src/lib/components/Table.tsx b/libs/remix-ui/terminal/src/lib/components/Table.tsx index 25055662ee..03748fe110 100644 --- a/libs/remix-ui/terminal/src/lib/components/Table.tsx +++ b/libs/remix-ui/terminal/src/lib/components/Table.tsx @@ -36,6 +36,7 @@ const showTable = (opts, showTableHash) => { stringified = typeConversion.stringify(opts.logs.decoded) } const val = opts.val != null ? typeConversion.toInt(opts.val) : 0 + const gasInt = opts.gas != null ? typeConversion.toInt(opts.gas) : 0 return ( @@ -119,7 +120,7 @@ const showTable = (opts, showTableHash) => { gas @@ -194,7 +195,7 @@ const showTable = (opts, showTableHash) => { {opts.val ? (
- {opts.gas} gas + {gasInt} gas
- val + value {val} wei diff --git a/libs/remix-ui/workspace/src/lib/actions/workspace.ts b/libs/remix-ui/workspace/src/lib/actions/workspace.ts index f98bb46e01..b45763bda1 100644 --- a/libs/remix-ui/workspace/src/lib/actions/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/actions/workspace.ts @@ -2,6 +2,7 @@ import React from 'react' import { bufferToHex } from '@ethereumjs/util' import { hash } from '@remix-project/remix-lib' import { TEMPLATE_METADATA, TEMPLATE_NAMES } from '../utils/constants' +import { TemplateType } from '../utils/types' import axios, { AxiosResponse } from 'axios' import { addInputFieldSuccess, @@ -139,7 +140,8 @@ export const createWorkspace = async ( return } await plugin.fileManager.closeAllFiles() - const promise = createWorkspaceTemplate(workspaceName, workspaceTemplateName) + const metadata = TEMPLATE_METADATA[workspaceTemplateName] + const promise = createWorkspaceTemplate(workspaceName, workspaceTemplateName, metadata) dispatch(createWorkspaceRequest()) promise.then(async () => { dispatch(createWorkspaceSuccess({ name: workspaceName, isGitRepo })) @@ -184,7 +186,18 @@ export const createWorkspace = async ( } } } - if (!isEmpty && !(isGitRepo && createCommit)) await loadWorkspacePreset(workspaceTemplateName, opts) + if (metadata && metadata.type === 'plugin') { + plugin.call('notification', 'toast', 'Please wait while the workspace is being populated with the template.') + dispatch(cloneRepositoryRequest()) + setTimeout(() => { + plugin.call(metadata.name, metadata.endpoint, ...metadata.params).then(() => { + dispatch(cloneRepositorySuccess()) + }).catch((e) => { + dispatch(cloneRepositorySuccess()) + plugin.call('notification', 'toast', 'error adding template ' + e.message || e) + }) + }, 5000) + } else if (!isEmpty && !(isGitRepo && createCommit)) await loadWorkspacePreset(workspaceTemplateName, opts) cb && cb(null, workspaceName) if (isGitRepo) { await checkGit() @@ -204,12 +217,11 @@ export const createWorkspace = async ( return promise } -export const createWorkspaceTemplate = async (workspaceName: string, template: WorkspaceTemplate = 'remixDefault') => { - const metadata = TEMPLATE_METADATA[template] +export const createWorkspaceTemplate = async (workspaceName: string, template: WorkspaceTemplate = 'remixDefault', metadata?: TemplateType) => { if (!workspaceName) throw new Error('workspace name cannot be empty') if (checkSpecialChars(workspaceName) || checkSlash(workspaceName)) throw new Error('special characters are not allowed') if ((await workspaceExists(workspaceName)) && template === 'remixDefault') throw new Error('workspace already exists') - else if (metadata) { + else if (metadata && metadata.type === 'git') { await plugin.call('dGitProvider', 'clone', {url: metadata.url, branch: metadata.branch}, workspaceName) } else { const workspaceProvider = plugin.fileProviders.workspace diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index f02c675fa5..d2ac1319bc 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -774,13 +774,19 @@ export function Workspace() { {intl.formatMessage({id: 'filePanel.rln'})} - + + + + + +
diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index 990ebbecaa..b3968ac21c 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -19,7 +19,7 @@ export interface JSONStandardInput { } } export type MenuItems = action[] -export type WorkspaceTemplate = 'gist-template' | 'code-template' | 'remixDefault' | 'blank' | 'ozerc20' | 'zeroxErc20' | 'ozerc721' | 'playground' | 'semaphore' | 'hashchecker' | 'rln' | 'breakthroughLabsUniswapv4Hooks' | 'uniswapV4Periphery' +export type WorkspaceTemplate = 'gist-template' | 'code-template' | 'remixDefault' | 'blank' | 'ozerc20' | 'zeroxErc20' | 'ozerc721' | 'playground' | 'semaphore' | 'hashchecker' | 'rln' | 'breakthroughLabsUniswapv4Hooks' | 'uniswapV4Periphery' | 'uniswapV4HookBookMultiSigSwapHook' export interface WorkspaceProps { plugin: FilePanelType } diff --git a/libs/remix-ui/workspace/src/lib/utils/constants.ts b/libs/remix-ui/workspace/src/lib/utils/constants.ts index 374d42708e..be8b7bdb4d 100644 --- a/libs/remix-ui/workspace/src/lib/utils/constants.ts +++ b/libs/remix-ui/workspace/src/lib/utils/constants.ts @@ -1,3 +1,4 @@ +import { TemplateType } from './types' export const ROOT_PATH = '/' export const solTestYml = ` name: Running Solidity Unit Tests @@ -87,15 +88,25 @@ export const TEMPLATE_NAMES = { 'rln': 'Rate-Limiting Nullifier', 'breakthroughLabsUniswapv4Hooks': 'Breakthrough-Labs Uniswapv4Hooks', 'uniswapV4Periphery': 'Uniswap v4 Periphery', + 'uniswapV4HookBookMultiSigSwapHook': 'Uniswap V4 HookBook MultiSigSwapHook', } -export const TEMPLATE_METADATA = { +export const TEMPLATE_METADATA: Record = { 'breakthroughLabsUniswapv4Hooks': { + type: 'git', url: 'https://github.com/Breakthrough-Labs/Uniswapv4Hooks', branch: 'foundry_pure' }, 'uniswapV4Periphery': { + type: 'git', url: 'https://github.com/Uniswap/v4-periphery', branch: 'main' + }, + 'uniswapV4HookBookMultiSigSwapHook': { + type: 'plugin', + name: 'cookbookdev', + endpoint: 'openPattern', + params: ['Uniswap-V4-HookBook-MultiSigSwapHook', true] } } + diff --git a/libs/remix-ui/workspace/src/lib/utils/types.ts b/libs/remix-ui/workspace/src/lib/utils/types.ts new file mode 100644 index 0000000000..750001bca5 --- /dev/null +++ b/libs/remix-ui/workspace/src/lib/utils/types.ts @@ -0,0 +1,8 @@ +export type TemplateType = { + type: 'git' | 'plugin' + url?: string + branch?: string + name?: string + endpoint?: string + params?: any[] + } \ No newline at end of file diff --git a/releaseDetails.json b/releaseDetails.json index 18c131baac..0dfc52a9a7 100644 --- a/releaseDetails.json +++ b/releaseDetails.json @@ -1,10 +1,10 @@ { - "version": "v0.38.0", + "version": "v0.40.0", "title": "RELEASE HIGHLIGHTS", - "highlight1": "Alpha release for Solidity co-pilot", - "highlight2": "Define Solidity remappings in remappings.txt file", - "highlight3": "Run free function for any selected environment", - "highlight4": "New Circom ZKP templates: Hash Checker & Rate Limiting Nullifier", + "highlight1": "Circom v2.1.6 support", + "highlight2": "Improved & stable support for Vyper development", + "highlight3": "New workspace template: Uniswap HookBook MultiSigSwapHook", + "highlight4": "", "more": "Read More", - "moreLink": "https://medium.com/remix-ide/remix-release-v0-38-0-dccd551b6f1e" + "moreLink": "https://medium.com/remix-ide/remix-release-v0-40-0-17668192db64" } \ No newline at end of file