Merge branch 'master' of https://github.com/ethereum/remix-project into newFEdesktop

pull/4422/head
bunsenstraat 11 months ago
commit ecc2614318
  1. 20
      apps/remix-ide-e2e/src/tests/workspace.test.ts
  2. 5
      apps/remix-ide/src/app/tabs/locales/en/filePanel.json
  3. 1
      apps/remix-ide/src/remixEngine.js
  4. 2
      libs/remix-lib/src/execution/txRunnerWeb3.ts
  5. 2
      libs/remix-ui/helper/src/lib/components/custom-dropdown.tsx
  6. 23
      libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx
  7. 5
      libs/remix-ui/terminal/src/lib/components/Table.tsx
  8. 22
      libs/remix-ui/workspace/src/lib/actions/workspace.ts
  9. 10
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
  10. 2
      libs/remix-ui/workspace/src/lib/types/index.ts
  11. 13
      libs/remix-ui/workspace/src/lib/utils/constants.ts
  12. 8
      libs/remix-ui/workspace/src/lib/utils/types.ts
  13. 12
      releaseDetails.json

@ -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
}

@ -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",

@ -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 }
}

@ -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'
}
}

@ -29,7 +29,7 @@ export const CustomToggle = React.forwardRef(
className={className.replace('dropdown-toggle', '')}
>
<div className="d-flex">
<div className="mr-auto text-nowrap">{children}</div>
<div className="mr-auto text-nowrap overflow-hidden">{children}</div>
{icon && (
<div className="pr-1">
<i className={`${icon} pr-1`}></i>

@ -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])
}

@ -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 (
<table className={`mt-1 mb-2 mr-4 align-self-center ${showTableHash.includes(opts.hash) ? 'active' : ''}`} id="txTable" data-id={`txLoggerTable${opts.hash}`}>
<tbody>
@ -119,7 +120,7 @@ const showTable = (opts, showTableHash) => {
gas
</td>
<td className="remix_ui_terminal_td" data-id={`txLoggerTableGas${opts.hash}`} data-shared={`pair_${opts.hash}`}>
{opts.gas} gas
{gasInt} gas
<CopyToClipboard content={opts.gas} />
</td>
</tr>
@ -194,7 +195,7 @@ const showTable = (opts, showTableHash) => {
{opts.val ? (
<tr className="remix_ui_terminal_tr">
<td className="remix_ui_terminal_td" data-shared={`key_${opts.hash}`}>
val
value
</td>
<td className="remix_ui_terminal_td" data-id={`txLoggerTableHash${opts.hash}`} data-shared={`pair_${opts.hash}`}>
{val} wei

@ -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

@ -774,13 +774,19 @@ export function Workspace() {
{intl.formatMessage({id: 'filePanel.rln'})}
</option>
</optgroup>
<optgroup style={{fontSize: 'medium'}} label="Uniswap">
<optgroup style={{fontSize: 'medium'}} label="Uniswap V4">
<option style={{fontSize: 'small'}} value="uniswapV4Periphery">
{intl.formatMessage({id: 'filePanel.uniswapV4Periphery'})}
</option>
<option style={{fontSize: 'small'}} value="breakthroughLabsUniswapv4Hooks">
{intl.formatMessage({id: 'filePanel.breakthroughLabsUniswapv4Hooks'})}
</option>
</option>
<option style={{fontSize: 'small'}} value="uniswapV4HookBookMultiSigSwapHook">
{intl.formatMessage({id: 'filePanel.uniswapV4HookBookMultiSigSwapHook'})}
</option>
</optgroup>
</select>
<div id="ozcustomization" data-id="ozCustomization" ref={displayOzCustomRef} style={{display: 'none'}} className="mb-2">

@ -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
}

@ -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<string, TemplateType> = {
'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]
}
}

@ -0,0 +1,8 @@
export type TemplateType = {
type: 'git' | 'plugin'
url?: string
branch?: string
name?: string
endpoint?: string
params?: any[]
}

@ -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"
}
Loading…
Cancel
Save