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

pull/5151/head
bunsenstraat 3 months ago
commit b5b5dd1e1f
  1. 2
      apps/remix-ide-e2e/src/tests/ballot.test.ts
  2. 2
      apps/remix-ide-e2e/src/tests/erc721.test.ts
  3. 2
      apps/remix-ide-e2e/src/tests/file_explorer_multiselect.test.ts
  4. 15
      apps/remix-ide-e2e/src/tests/workspace.test.ts
  5. 2
      apps/remix-ide-e2e/src/tests/workspace_git.test.ts
  6. 5
      apps/remix-ide/src/app/plugins/templates-selection/templates-selection-plugin.tsx
  7. 23
      apps/remix-ide/src/app/plugins/templates-selection/templates.ts
  8. 4
      apps/remix-ide/src/blockchain/blockchain.tsx
  9. 7
      libs/remix-ui/grid-view/src/lib/remix-ui-grid-section.tsx
  10. 2
      libs/remix-ui/workspace/src/lib/actions/workspace.ts
  11. 54
      libs/remix-ui/workspace/src/lib/utils/constants.ts

@ -102,6 +102,8 @@ module.exports = {
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]')
.setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_remix_default')
// eslint-disable-next-line dot-notation
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_remix_default' })
.modalFooterOKClick('TemplatesSelection')
.pause(1000)
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]')

@ -22,6 +22,8 @@ module.exports = {
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]')
.setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_erc721')
// eslint-disable-next-line dot-notation
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_erc721' })
.modalFooterOKClick('TemplatesSelection')
.pause(100)
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]')

@ -7,7 +7,7 @@ module.exports = {
init(browser, done)
},
'Should select multiple items in file explorer #group1': function (browser: NightwatchBrowser) {
'Should select multiple items in file explorer #group1': function (browser: NightwatchBrowser) {
const selectedElements = []
browser
.openFile('contracts')

@ -43,6 +43,8 @@ module.exports = {
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]')
.setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_remix_default')
// eslint-disable-next-line dot-notation
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_remix_default' })
.modalFooterOKClick('TemplatesSelection')
.pause(1000)
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]')
@ -115,6 +117,8 @@ module.exports = {
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]')
.setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_blank')
// eslint-disable-next-line dot-notation
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_blank' })
.modalFooterOKClick('TemplatesSelection')
.pause(100)
.waitForElementPresent('*[data-id="treeViewUltreeViewMenu"]')
@ -136,6 +140,8 @@ module.exports = {
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]')
.setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_erc20')
// eslint-disable-next-line dot-notation
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_erc20' })
.modalFooterOKClick('TemplatesSelection')
.pause(100)
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]')
@ -195,6 +201,8 @@ module.exports = {
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]')
.setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_erc721')
// eslint-disable-next-line dot-notation
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_erc721' })
.modalFooterOKClick('TemplatesSelection')
.pause(100)
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]')
@ -254,6 +262,8 @@ module.exports = {
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]')
.setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_erc1155')
// eslint-disable-next-line dot-notation
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_erc1155' })
.modalFooterOKClick('TemplatesSelection')
.pause(100)
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]')
@ -484,6 +494,7 @@ module.exports = {
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]')
.setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'sometestworkspace')
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'sometestworkspace' })
.modalFooterOKClick('TemplatesSelection')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts/MyToken.sol"]')
@ -510,6 +521,8 @@ module.exports = {
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]')
.setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_db_test')
// eslint-disable-next-line dot-notation
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_db_test' })
.modalFooterOKClick('TemplatesSelection')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts/MyToken.sol"]')
@ -538,6 +551,8 @@ module.exports = {
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]')
.setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'multisig cookbook')
// eslint-disable-next-line dot-notation
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'multisig cookbook' })
.modalFooterOKClick('TemplatesSelection')
.waitForElementVisible('[data-id="PermissionHandler-modal-footer-ok-react"]', 300000)
.click('[data-id="PermissionHandler-modal-footer-ok-react"]')

@ -53,6 +53,8 @@ module.exports = {
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.scrollAndClick('*[data-id="modalDialogCustomPromptTextCreate"]')
.setValue('*[data-id="modalDialogCustomPromptTextCreate"]', 'workspace_blank')
// eslint-disable-next-line dot-notation
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_blank' })
.click('[data-id="initGitRepositoryLabel"]')
.modalFooterOKClick('TemplatesSelection')
.pause(100)

@ -151,11 +151,14 @@ export class TemplatesSelectionPlugin extends ViewPlugin {
description="Select a template to create a workspace or to add it to current workspace"
>
{
templates(window._intl).map(template => {
templates(window._intl, this).map(template => {
return <RemixUIGridSection
plugin={this}
key={template.name}
title={template.name}
tooltipTitle={template.tooltip}
onClick={template.onClick}
onClickLabel={template.onClickLabel}
hScrollable={false}
>
{template.items.map(item => {

@ -1,5 +1,4 @@
export const templates = (intl) => {
export const templates = (intl, plugin) => {
return [
{
name: "Generic",
@ -258,6 +257,26 @@ export const templates = (intl) => {
}
]
},
{
name: "Cookbook",
tooltip: "Cookbook is a smart contract search tool. Click here to open cookbook and browse contracts.",
onClick: async () => {
await plugin.call('manager', 'activatePlugin', 'cookbookdev')
plugin.call('menuicons', 'showContent', 'cookbookdev')
},
onClickLabel: 'Open cookbook plugin',
items: [
{ value: "token-sale", displayName: 'Token Sale' },
{ value: "simple-nft-sale", displayName: 'Simple Nft Sale' },
{ value: "Azuki-ERC721A-NFT-Sale-basic", displayName: 'Azuki ERC721A NFT Sale basic' },
{ value: "Azuki-ERC721A-ERC721A", displayName: 'Azuki ERC721A' },
{ value: "token-staking-with-infinite-rewards", displayName: 'Token Staking with infinite rewards' },
{ value: "nft-staking-with-infinite-rewards", displayName: 'Nft Staking with infinite rewards' },
{ value: "basic-dao", displayName: 'Basic DAO' },
{ value: "soulbound-nft", displayName: 'Soulbound Nft' },
{ value: "multi-collection-nft-with-burnable-nfts-and-pausable-transfers", displayName: 'Multi collection nft with burnable nfts and pausable transfers' },
]
},
{
name: "OxProject",
items: [

@ -39,7 +39,7 @@ export type Transaction = {
to: string
value: string
data: string
gasLimit: number
gasLimit: string
useCall: boolean
timestamp?: number
}
@ -780,6 +780,8 @@ export class Blockchain extends Plugin {
sendTransaction(tx: Transaction) {
return new Promise((resolve, reject) => {
this.executionContext.detectNetwork((error, network) => {
tx.gasLimit = '0x0' // force using gas estimation
if (error) return reject(error)
if (network.name === 'Main' && network.id === '1') {
return reject(new Error('It is not allowed to make this action against mainnet'))

@ -1,4 +1,5 @@
import React, {useState, useEffect, useContext, useRef, ReactNode} from 'react' // eslint-disable-line
import { CustomTooltip } from "@remix-ui/helper";
import './remix-ui-grid-section.css'
import FiltersContext from "./filtersContext"
@ -13,6 +14,9 @@ const _paq = window._paq = window._paq || []
interface RemixUIGridSectionProps {
plugin: any
title?: string
onClick?: () => void
onClickLabel?: string
tooltipTitle?: string
hScrollable: boolean
classList?: string
styleList?: any
@ -61,8 +65,9 @@ export const RemixUIGridSection = (props: RemixUIGridSectionProps) => {
data-id={"remixUIGS" + props.title}
style={{ overflowX: 'auto' }}
>
<div className="d-flex flex-column w-100 remixui_grid_section">
<div className="w-100 remixui_grid_section">
{ props.title && <h6 className='mt-1 mb-0 align-items-left '>{ props.title }</h6> }
{ props.onClick && <span style={{ cursor: 'pointer' }} className='mt-2 btn btn-sm border align-items-left' onClick={() => props.onClick() }>{ props.onClickLabel }</span> }
<div className={(props.hScrollable) ? `d-flex flex-row pb-2 overflow-auto` : `d-flex flex-wrap`}>
{ !hasChildCell(children) && <span> No items found </span>}
{ props.children }

@ -219,7 +219,7 @@ export const populateWorkspace = async (
dispatch(cloneRepositorySuccess())
}).catch((e) => {
dispatch(cloneRepositorySuccess())
plugin.call('notification', 'toast', 'error adding template ' + e.message || e)
plugin.call('notification', 'toast', 'error adding template ' + (e.message || e))
})
}, 5000)
} else if (!isEmpty && !(isGitRepo && createCommit)) await loadWorkspacePreset(workspaceTemplateName, opts)

@ -34,6 +34,60 @@ export const TEMPLATE_METADATA: Record<string, TemplateType> = {
name: 'cookbookdev',
endpoint: 'openPattern',
params: ['Uniswap-V4-HookBook-MultiSigSwapHook', true]
},
'token-sale': {
type: 'plugin',
name: 'cookbookdev',
endpoint: 'openContract',
params: ['token-sale']
},
'simple-nft-sale': {
type: 'plugin',
name: 'cookbookdev',
endpoint: 'openContract',
params: ['simple-nft-sale']
},
'Azuki-ERC721A-NFT-Sale-basic': {
type: 'plugin',
name: 'cookbookdev',
endpoint: 'openContract',
params: ['Azuki-ERC721A-NFT-Sale-basic']
},
'Azuki-ERC721A-ERC721A': {
type: 'plugin',
name: 'cookbookdev',
endpoint: 'openContract',
params: ['Azuki-ERC721A-ERC721A']
},
'token-staking-with-infinite-rewards': {
type: 'plugin',
name: 'cookbookdev',
endpoint: 'openContract',
params: ['token-staking-with-infinite-rewards']
},
'nft-staking-with-infinite-rewards': {
type: 'plugin',
name: 'cookbookdev',
endpoint: 'openContract',
params: ['nft-staking-with-infinite-rewards']
},
'basic-dao': {
type: 'plugin',
name: 'cookbookdev',
endpoint: 'openContract',
params: ['basic-dao']
},
'soulbound-nft': {
type: 'plugin',
name: 'cookbookdev',
endpoint: 'openContract',
params: ['soulbound-nft']
},
'multi-collection-nft-with-burnable-nfts-and-pausable-transfers': {
type: 'plugin',
name: 'cookbookdev',
endpoint: 'openContract',
params: ['multi-collection-nft-with-burnable-nfts-and-pausable-transfers']
}
}

Loading…
Cancel
Save