diff --git a/apps/remix-ide-e2e/src/tests/ballot.test.ts b/apps/remix-ide-e2e/src/tests/ballot.test.ts index c9fb7c27bc..db34e18cf3 100644 --- a/apps/remix-ide-e2e/src/tests/ballot.test.ts +++ b/apps/remix-ide-e2e/src/tests/ballot.test.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"]') diff --git a/apps/remix-ide-e2e/src/tests/erc721.test.ts b/apps/remix-ide-e2e/src/tests/erc721.test.ts index 890a5e7fc3..8a3861a1c8 100644 --- a/apps/remix-ide-e2e/src/tests/erc721.test.ts +++ b/apps/remix-ide-e2e/src/tests/erc721.test.ts @@ -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"]') diff --git a/apps/remix-ide-e2e/src/tests/file_explorer_multiselect.test.ts b/apps/remix-ide-e2e/src/tests/file_explorer_multiselect.test.ts index f809a4930c..3a38619c67 100644 --- a/apps/remix-ide-e2e/src/tests/file_explorer_multiselect.test.ts +++ b/apps/remix-ide-e2e/src/tests/file_explorer_multiselect.test.ts @@ -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') diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts index 094b35a080..e9517e90e2 100644 --- a/apps/remix-ide-e2e/src/tests/workspace.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts @@ -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"]') diff --git a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts index 467d97e620..bf5da591e9 100644 --- a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts @@ -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) diff --git a/apps/remix-ide/src/app/plugins/templates-selection/templates-selection-plugin.tsx b/apps/remix-ide/src/app/plugins/templates-selection/templates-selection-plugin.tsx index 6df97e60b6..b2f5c593c2 100644 --- a/apps/remix-ide/src/app/plugins/templates-selection/templates-selection-plugin.tsx +++ b/apps/remix-ide/src/app/plugins/templates-selection/templates-selection-plugin.tsx @@ -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 {template.items.map(item => { diff --git a/apps/remix-ide/src/app/plugins/templates-selection/templates.ts b/apps/remix-ide/src/app/plugins/templates-selection/templates.ts index a42524a285..169aae0277 100644 --- a/apps/remix-ide/src/app/plugins/templates-selection/templates.ts +++ b/apps/remix-ide/src/app/plugins/templates-selection/templates.ts @@ -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: [ diff --git a/apps/remix-ide/src/blockchain/blockchain.tsx b/apps/remix-ide/src/blockchain/blockchain.tsx index 66f3baafc1..bbf1a9c805 100644 --- a/apps/remix-ide/src/blockchain/blockchain.tsx +++ b/apps/remix-ide/src/blockchain/blockchain.tsx @@ -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')) diff --git a/libs/remix-ui/grid-view/src/lib/remix-ui-grid-section.tsx b/libs/remix-ui/grid-view/src/lib/remix-ui-grid-section.tsx index a3cb8b15c0..5947db70b1 100644 --- a/libs/remix-ui/grid-view/src/lib/remix-ui-grid-section.tsx +++ b/libs/remix-ui/grid-view/src/lib/remix-ui-grid-section.tsx @@ -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' }} > -
+
{ props.title &&
{ props.title }
} + { props.onClick && props.onClick() }>{ props.onClickLabel } }
{ !hasChildCell(children) && No items found } { props.children } diff --git a/libs/remix-ui/workspace/src/lib/actions/workspace.ts b/libs/remix-ui/workspace/src/lib/actions/workspace.ts index c9fe57ea97..f5b70376bf 100644 --- a/libs/remix-ui/workspace/src/lib/actions/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/actions/workspace.ts @@ -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) diff --git a/libs/remix-ui/workspace/src/lib/utils/constants.ts b/libs/remix-ui/workspace/src/lib/utils/constants.ts index fcde9c1830..f0d150afb1 100644 --- a/libs/remix-ui/workspace/src/lib/utils/constants.ts +++ b/libs/remix-ui/workspace/src/lib/utils/constants.ts @@ -34,6 +34,60 @@ export const TEMPLATE_METADATA: Record = { 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'] } }