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

pull/5370/head
filip mertens 1 year ago
commit 971cfa57b9
  1. 8
      CONTRIBUTING.md
  2. 4
      README.md
  3. 16
      apps/circuit-compiler/src/app/components/compileBtn.tsx
  4. 1
      apps/circuit-compiler/src/app/services/circomPluginClient.ts
  5. 1
      apps/etherscan/src/app/utils/networks.ts
  6. 2
      apps/remix-ide-e2e/src/tests/homeTab.test.ts
  7. 2
      apps/remix-ide/src/app/tabs/locales/en/home.json
  8. 6
      libs/remix-lib/src/execution/txExecution.ts
  9. 19
      libs/remix-ui/home-tab/src/lib/components/homeTabFile.tsx
  10. 45
      libs/remix-ui/home-tab/src/lib/components/homeTablangOptions.tsx
  11. 7
      libs/remix-ui/home-tab/src/lib/components/types/carouselTypes.ts
  12. 2
      libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx
  13. 6
      libs/remix-ui/run-tab/src/lib/actions/deploy.ts
  14. 5
      libs/remix-ws-templates/src/templates/playground/contracts/HelloWorld.sol
  15. 2
      libs/remix-ws-templates/src/templates/playground/index.ts
  16. 7
      team-best-practices.md

@ -1,11 +1,11 @@
# Contributing
Everyone is very welcome to contribute on the codebase of Remix. Please reach us in [Gitter](https://gitter.im/ethereum/remix) in case of any queries.
Everyone is very welcome to contribute on the codebase of Remix. Please join our [Discord](https://discord.gg/mh9hFCKkEq) in case of any queries.
## Development
Remix libraries work closely with [Remix IDE](https://remix.ethereum.org). Each library has a readme to explain its application.
When you add a code in any library, please ensure you add related tests. You can visit [here](https://github.com/ethereum/remix-ide#installation) to test your changes by linking the remix libraries with Remix IDE.
When you add a code in any library, please ensure you add related unit tests.
## Coding style
@ -101,7 +101,7 @@ Well, that depends.
If you update an old json file, then you don't need to update it in other languages, because crowdin will do it for you.
But if you add a new json file, then you have to add it in other languages, and import it in `index.js` of all languages. Because crowdin will not update `index.js`, you have to do it manually.
But if you add a new json file, only English is needed.
### How to contribute on translations?
Remix is using crowdin to manage translations. If you want to contribute on that, you can do it on crowdin. Check the link below.
@ -110,4 +110,4 @@ https://crowdin.com/project/remix-translation
There are many languages, just get into your language, and you will see a folder named `Remix UI`, where you can do the translations.
Not only can you do the translations, you can also review it. If you agree or disagree with some translations, you can vote yes or no. If you vote no, you can comment to explain why you vote no, and give your translation.
Not only you can do the translations, you can also review it. If you agree or disagree with some translations, you can vote YES or NO. If you vote NO, you can comment to explain why you vote NO, and give your translation.

@ -12,7 +12,7 @@
[![GitHub contributors](https://img.shields.io/github/contributors/ethereum/remix-project?style=flat&logo=github)](https://github.com/ethereum/remix-project/blob/master/CONTRIBUTING.md)
[![Awesome Remix](https://img.shields.io/badge/Awesome--Remix-resources-green?logo=awesomelists)](https://github.com/ethereum/awesome-remix)
![GitHub](https://img.shields.io/github/license/ethereum/remix-project)
[![Discord](https://img.shields.io/badge/join-discord-brightgreen.svg?style=flat&logo=discord)](https://discord.gg/q4vS2GVn)
[![Discord](https://img.shields.io/badge/join-discord-brightgreen.svg?style=flat&logo=discord)](https://discord.gg/mh9hFCKkEq)
[![Twitter Follow](https://img.shields.io/twitter/follow/ethereumremix?style=flat&logo=twitter&color=green)](https://twitter.com/ethereumremix)
</div>
@ -286,4 +286,4 @@ parameters:
- Curated list of Remix resources: https://github.com/ethereum/awesome-remix
- Medium: https://medium.com/remix-ide
- Twitter: https://twitter.com/ethereumremix
- Join Discord: https://discord.gg/q4vS2GVn
- Join Discord: https://discord.gg/mh9hFCKkEq

@ -8,12 +8,7 @@ export function CompileBtn () {
const { plugin, appState } = useContext(CircuitAppContext)
return (
<button
className="btn btn-primary btn-block d-block w-100 text-break mb-1 mt-3"
onClick={() => { compileCircuit(plugin, appState) }}
disabled={(appState.filePath === "") || (appState.status === "compiling") || (appState.status === "generating")}
>
<CustomTooltip
<CustomTooltip
placement="auto"
tooltipId="overlay-tooltip-compile"
tooltipText={
@ -23,6 +18,11 @@ export function CompileBtn () {
</div>
</div>
}
>
<button
className="btn btn-primary btn-block d-block w-100 text-break mb-1 mt-3"
onClick={() => { compileCircuit(plugin, appState) }}
disabled={(appState.filePath === "") || (appState.status === "compiling") || (appState.status === "generating")}
>
<div className="d-flex align-items-center justify-content-center">
<RenderIf condition={appState.status === 'compiling'}>
@ -45,7 +45,7 @@ export function CompileBtn () {
</span>
</div>
</div>
</CustomTooltip>
</button>
</button>
</CustomTooltip>
)
}

@ -256,6 +256,7 @@ export class CircomPluginClient extends PluginClient {
if (depPath) {
// if depPath is provided, try to resolve include import from './deps' folder in remix
path = pathModule.resolve(depPath.slice(0, depPath.lastIndexOf('/')), include)
path = path.replace('https:/', 'https://')
if (path.indexOf('/') === 0) path = path.slice(1)
dependencyContent = await this.call('contentImport', 'resolveAndSave', path, null)
} else {

@ -16,6 +16,7 @@ export const scanAPIurls = {
100: 'https://api.gnosisscan.io/api',
1101: 'https://api-zkevm.polygonscan.com/api',
59144: 'https://api.lineascan.build/api',
8453: 'https://api.basescan.org/api',
// all testnet
5: 'https://api-goerli.etherscan.io/api',

@ -12,6 +12,6 @@ module.exports = {
browser
.waitForElementVisible('*[data-id="homeTabStartCoding"]')
.click('*[data-id="homeTabStartCoding"]')
.waitForElementVisible('div[data-id="treeViewDivtreeViewItemcontracts/helloWorld.sol"]')
.waitForElementVisible('div[data-id="treeViewDivtreeViewItemcontracts/HelloWorld.sol"]')
}
}

@ -57,7 +57,7 @@
"home.files": "Files",
"home.newFile": "New File",
"home.startCoding": "Start Coding",
"home.startCodingPlayground": "Open a playground for prototyping and simply learning",
"home.startCodingPlayground": "Open a playground for prototyping and simple learning",
"home.openFile": "Open File",
"home.openFileTooltip": "Open a File from your File System",
"home.accessFileSystem": "Access File System",

@ -82,8 +82,8 @@ export function checkError (execResult, compiledContracts) {
const exceptionError = execResult.errorMessage || ''
const error = `Error occured: ${execResult.errorMessage}.\n`
let msg = ''
if (exceptionError === errorCode.INVALID_OPCODE) {
msg = '\t\n\tThe execution might have thrown.\n'
if (exceptionError.includes(errorCode.INVALID_OPCODE)) {
msg = '\t\n\tThe execution might have thrown OR the EVM version used by the selected environment is not compatible with the compiler EVM version.\n'
ret.error = true
} else if (exceptionError === errorCode.OUT_OF_GAS) {
msg = '\tThe transaction ran out of gas. Please increase the Gas Limit.\n'
@ -173,4 +173,4 @@ export function checkError (execResult, compiledContracts) {
}
ret.message = `${error}\n${exceptionError}\n${msg}\nDebug the transaction to get more information.`
return ret
}
}

@ -142,19 +142,22 @@ function HomeTabFile({ plugin }: HomeTabFileProps) {
await plugin.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false })
await plugin.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false }) // calling once is not working.
const content = `// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12 <0.9.0;
pragma solidity >=0.6.12 <0.9.0;
contract HelloWorld {
function print() public pure returns (string memory) {
return "Hello World!";
}
}
contract HelloWorld {
/**
* @dev Prints Hello World string
*/
function print() public pure returns (string memory) {
return "Hello World!";
}
}
`
if (createFile) {
const { newPath } = await plugin.call('fileManager', 'writeFileNoRewrite', '/contracts/helloWorld.sol', content)
const { newPath } = await plugin.call('fileManager', 'writeFileNoRewrite', '/contracts/HelloWorld.sol', content)
await plugin.call('fileManager', 'open', newPath)
} else {
await plugin.call('fileManager', 'open', '/contracts/helloWorld.sol')
await plugin.call('fileManager', 'open', '/contracts/HelloWorld.sol')
}
}

@ -0,0 +1,45 @@
import React, { useEffect, useState } from 'react'
import { Dropdown, DropdownButton } from 'react-bootstrap'
import DropdownItem from 'react-bootstrap/DropdownItem'
import { localeLang } from './types/carouselTypes'
export function LanguageOptions({ plugin }: { plugin: any }) {
const [langOptions, setLangOptions] = useState<string>()
const changeLanguage = async (lang: string) => {
await plugin.call('locale', 'switchLocale', lang)
}
useEffect(() => {
plugin.call('locale', 'currentLocale').then(opt => {
setLangOptions(opt.code.toUpperCase())
})
}, [langOptions])
useEffect(() => {
plugin.on('locale', 'localeChanged', (lang: localeLang) => {
setLangOptions(lang.code.toUpperCase())
})
}, [langOptions])
return (
<>
<div className="d-flex align-items-center justify-content-end mr-2">
<DropdownButton title={langOptions} id="langdropdown" size="sm">
{['EN', 'ES', 'FR', 'ZH'].map(lang => (
<DropdownItem as={'span'} onClick={() =>
{
changeLanguage(lang.toLowerCase())
setLangOptions(lang)
}}
>
{lang}
</DropdownItem>
))}
</DropdownButton>
</div>
</>
)
}

@ -114,3 +114,10 @@ export default class Carousel extends React.Component<CarouselProps> {
direction: Direction;
containerRef: React.RefObject<HTMLDivElement>;
}
export type localeLang = {
code: string
localeName: string
messages: { [key: string]: string }
name: string
}

@ -11,6 +11,7 @@ import HomeTabFeatured from './components/homeTabFeatured'
import HomeTabFeaturedPlugins from './components/homeTabFeaturedPlugins'
import isElectron from 'is-electron'
import { HomeTabFileElectron } from './components/homeTabFileElectron'
import { LanguageOptions } from './components/homeTablangOptions'
declare global {
interface Window {
@ -64,6 +65,7 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {
<HomeTabLearn plugin={plugin} />
</div>
<div className="pl-2 pr-3 justify-content-start d-flex flex-column" style={{width: '65%'}} id="remixUIHTRight">
<LanguageOptions plugin={plugin}/>
<HomeTabFeatured></HomeTabFeatured>
<HomeTabGetStarted plugin={plugin}></HomeTabGetStarted>
<HomeTabFeaturedPlugins plugin={plugin}></HomeTabFeaturedPlugins>

@ -119,8 +119,10 @@ const getConfirmationCb = (plugin: RunTab, dispatch: React.Dispatch<any>, confir
export const continueHandler = (dispatch: React.Dispatch<any>, gasEstimationPrompt: (msg: string) => JSX.Element, error, continueTxExecution, cancelCb) => {
if (error) {
const msg = typeof error !== 'string' ? error.message : error
let msg = typeof error !== 'string' ? error.message : error
if (msg.includes('invalid opcode')) msg += '\n OR the EVM version used by the selected environment is not compatible with the compiler EVM version.'
dispatch(displayNotification('Gas estimation failed', gasEstimationPrompt(msg), 'Send Transaction', 'Cancel Transaction', () => {
continueTxExecution()
}, () => {

@ -2,7 +2,10 @@
pragma solidity >=0.6.12 <0.9.0;
contract HelloWorld {
/**
* @dev Prints Hello World string
*/
function print() public pure returns (string memory) {
return "Hello World!";
}
}
}

@ -1,7 +1,7 @@
export default async () => {
return {
// @ts-ignore
'contracts/helloWorld.sol': (await import('raw-loader!./contracts/helloWorld.sol')).default,
'contracts/HelloWorld.sol': (await import('raw-loader!./contracts/HelloWorld.sol')).default,
// @ts-ignore
'scripts/deploy_with_ethers.ts': (await import('!!raw-loader!./scripts/deploy_with_ethers.ts')).default,
// @ts-ignore

@ -20,10 +20,7 @@ Related links:
- Remix-debug NPM module: https://www.npmjs.com/package/@remix-project/remix-debug
- Remix-tests NPM module: https://www.npmjs.com/package/@remix-project/remix-tests
- Remix documentation: http://remix-ide.readthedocs.io/en/latest/
- General gitter channel: https://gitter.im/ethereum/remix
- Dev gitter channel: https://gitter.im/ethereum/remix-dev
- Dev plugin gitter channel: https://gitter.im/ethereum/remix-dev-plugin
- Discord: https://discord.gg/mh9hFCKkEq
---
@ -187,4 +184,4 @@ Before starting coding, we should ensure all devs / contributors are aware of:
# Coding best practices
- https://github.com/ethereum/remix-project/blob/master/best-practices.md
- https://github.com/ethereum/remix-project/blob/master/CONTRIBUTING.md

Loading…
Cancel
Save