Merge pull request #4771 from ethereum/newLinter2

Linter rules
pull/4744/head
yann300 7 months ago committed by GitHub
commit 9d217e16cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      .eslintrc.json
  2. 3
      apps/circuit-compiler/.eslintrc
  3. 8
      apps/circuit-compiler/project.json
  4. 4
      apps/circuit-compiler/src/app/contexts/index.ts
  5. 2
      apps/circuit-compiler/src/app/reducers/state.ts
  6. 10
      apps/circuit-compiler/src/app/services/circomPluginClient.ts
  7. 2
      apps/circuit-compiler/src/app/types/index.ts
  8. 3
      apps/debugger/.eslintrc
  9. 8
      apps/debugger/project.json
  10. 6
      apps/debugger/src/app/debugger.ts
  11. 3
      apps/doc-gen/.eslintrc
  12. 8
      apps/doc-gen/project.json
  13. 6
      apps/doc-gen/src/app/docgen-client.ts
  14. 72
      apps/doc-gen/src/app/docgen/common/properties.ts
  15. 7
      apps/doc-gen/src/app/docgen/templates.ts
  16. 18
      apps/doc-gen/src/app/docgen/utils/memoized-getter.ts
  17. 8
      apps/doc-gen/src/app/docgen/utils/natspec.ts
  18. 2
      apps/doc-gen/src/app/docgen/utils/normalizeContractPath.ts
  19. 3
      apps/doc-viewer/.eslintrc
  20. 8
      apps/doc-viewer/project.json
  21. 3
      apps/etherscan/.eslintrc
  22. 8
      apps/etherscan/project.json
  23. 8
      apps/etherscan/src/app/EtherscanPluginClient.ts
  24. 6
      apps/etherscan/src/app/utils/utilities.ts
  25. 14
      apps/etherscan/src/app/utils/verify.ts
  26. 3
      apps/learneth/.eslintrc
  27. 8
      apps/learneth/project.json
  28. 4
      apps/learneth/src/redux/hooks.ts
  29. 8
      apps/learneth/src/redux/models/loading.ts
  30. 40
      apps/learneth/src/redux/models/remixide.ts
  31. 26
      apps/learneth/src/redux/models/workshop.ts
  32. 6
      apps/learneth/src/redux/store.ts
  33. 8
      apps/learneth/src/remix-client.ts
  34. 6
      apps/remix-ide/src/app/components/hidden-panel.tsx
  35. 8
      apps/remix-ide/src/app/components/main-panel.tsx
  36. 2
      apps/remix-ide/src/app/components/panel.ts
  37. 18
      apps/remix-ide/src/app/components/preload.tsx
  38. 8
      apps/remix-ide/src/app/components/side-panel.tsx
  39. 10
      apps/remix-ide/src/app/components/vertical-icons.tsx
  40. 26
      apps/remix-ide/src/app/files/dgitProvider.ts
  41. 2
      apps/remix-ide/src/app/files/electronProvider.ts
  42. 19
      apps/remix-ide/src/app/files/fileManager.ts
  43. 3
      apps/remix-ide/src/app/files/fileProvider.ts
  44. 1
      apps/remix-ide/src/app/files/fileSystem.ts
  45. 2
      apps/remix-ide/src/app/files/filesystems/fileSystemUtility.ts
  46. 1
      apps/remix-ide/src/app/files/filesystems/indexedDB.ts
  47. 2
      apps/remix-ide/src/app/files/filesystems/localStorage.ts
  48. 6
      apps/remix-ide/src/app/panels/terminal.tsx
  49. 3
      apps/remix-ide/src/app/plugins/code-format.ts
  50. 1
      apps/remix-ide/src/app/plugins/code-format/parser.ts
  51. 2
      apps/remix-ide/src/app/plugins/compile-details.tsx
  52. 2
      apps/remix-ide/src/app/plugins/config.ts
  53. 8
      apps/remix-ide/src/app/plugins/contractFlattener.tsx
  54. 4
      apps/remix-ide/src/app/plugins/electron/compilerLoaderPlugin.ts
  55. 6
      apps/remix-ide/src/app/plugins/electron/fsPlugin.ts
  56. 4
      apps/remix-ide/src/app/plugins/file-decorator.ts
  57. 10
      apps/remix-ide/src/app/plugins/notification.tsx
  58. 8
      apps/remix-ide/src/app/plugins/openaigpt.tsx
  59. 5
      apps/remix-ide/src/app/plugins/parser/code-parser.tsx
  60. 17
      apps/remix-ide/src/app/plugins/parser/services/code-parser-antlr-service.ts
  61. 16
      apps/remix-ide/src/app/plugins/parser/services/code-parser-compiler.ts
  62. 9
      apps/remix-ide/src/app/plugins/parser/services/code-parser-gas-service.ts
  63. 14
      apps/remix-ide/src/app/plugins/parser/services/code-parser-imports.ts
  64. 10
      apps/remix-ide/src/app/plugins/parser/types/antlr-types.ts
  65. 20
      apps/remix-ide/src/app/plugins/permission-handler-plugin.tsx
  66. 46
      apps/remix-ide/src/app/plugins/remixGuide.tsx
  67. 24
      apps/remix-ide/src/app/plugins/remixd-handle.tsx
  68. 46
      apps/remix-ide/src/app/plugins/solcoderAI.tsx
  69. 18
      apps/remix-ide/src/app/plugins/solidity-script.tsx
  70. 28
      apps/remix-ide/src/app/plugins/solidity-umlgen.tsx
  71. 10
      apps/remix-ide/src/app/plugins/vyper-compilation-details.tsx
  72. 20
      apps/remix-ide/src/app/providers/abstract-provider.tsx
  73. 8
      apps/remix-ide/src/app/providers/custom-vm-fork-provider.tsx
  74. 6
      apps/remix-ide/src/app/providers/external-http-provider.tsx
  75. 4
      apps/remix-ide/src/app/providers/foundry-provider.tsx
  76. 4
      apps/remix-ide/src/app/providers/ganache-provider.tsx
  77. 2
      apps/remix-ide/src/app/providers/goerli-vm-fork-provider.tsx
  78. 4
      apps/remix-ide/src/app/providers/hardhat-provider.tsx
  79. 2
      apps/remix-ide/src/app/providers/injected-arbitrum-one-provider.tsx
  80. 12
      apps/remix-ide/src/app/providers/injected-custom-provider.tsx
  81. 6
      apps/remix-ide/src/app/providers/injected-ephemery-testnet-provider.tsx
  82. 2
      apps/remix-ide/src/app/providers/injected-optimism-provider.tsx
  83. 4
      apps/remix-ide/src/app/providers/injected-provider-default.tsx
  84. 2
      apps/remix-ide/src/app/providers/injected-provider-trustwallet.tsx
  85. 16
      apps/remix-ide/src/app/providers/injected-provider.tsx
  86. 6
      apps/remix-ide/src/app/providers/injected-skale-chaos-testnet-provider.tsx
  87. 2
      apps/remix-ide/src/app/providers/mainnet-vm-fork-provider.tsx
  88. 2
      apps/remix-ide/src/app/providers/sepolia-vm-fork-provider.tsx
  89. 8
      apps/remix-ide/src/app/providers/vm-provider.tsx
  90. 6
      apps/remix-ide/src/app/tabs/compile-and-run.ts
  91. 4
      apps/remix-ide/src/app/tabs/search.tsx
  92. 8
      apps/remix-ide/src/app/tabs/settings-tab.tsx
  93. 68
      apps/remix-ide/src/blockchain/blockchain.tsx
  94. 2
      apps/remix-ide/src/blockchain/helper.ts
  95. 7
      apps/remix-ide/src/blockchain/providers/vm.ts
  96. 14
      apps/remix-ide/src/blockchain/providers/worker-vm.ts
  97. 16
      apps/remix-ide/src/index.tsx
  98. 3
      apps/remix-ide/src/remixAppManager.js
  99. 18
      apps/solhint/.eslintrc
  100. 8
      apps/solhint/project.json
  101. Some files were not shown because too many files have changed in this diff Show More

@ -54,7 +54,13 @@
"react-hooks/exhaustive-deps": "off",
"array-callback-return": "off",
"prefer-spread": "off",
"indent": ["error", 2]
"indent": ["error", 2],
"keyword-spacing": ["error", { "after": true, "before": true }],
"array-bracket-spacing": ["error", "never"],
"object-curly-spacing": ["error", "always", { "arraysInObjects": false }],
"no-trailing-spaces": "error",
"no-multi-spaces": "error",
"no-multiple-empty-lines": ["error" , { "max": 1}]
}
},
{

@ -0,0 +1,3 @@
{
"extends": "../../.eslintrc.json",
}

@ -35,6 +35,14 @@
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/circuit-compiler/**/*.ts"],
"eslintConfig": "apps/circuit-compiler/.eslintrc"
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",

@ -1,4 +1,4 @@
import {createContext} from 'react'
import {ICircuitAppContext} from '../types'
import { createContext } from 'react'
import { ICircuitAppContext } from '../types'
export const CircuitAppContext = createContext<ICircuitAppContext>({} as ICircuitAppContext)

@ -1,4 +1,4 @@
import {Actions, AppState} from '../types'
import { Actions, AppState } from '../types'
import { compiler_list } from 'circom_wasm'
export const appInitialState: AppState = {

@ -163,7 +163,7 @@ export class CircomPluginClient extends PluginClient {
} else {
this.lastCompiledFile = path
const fileName = extractNameFromKey(path)
this.lastCompiledCircuitPath = extractParentFromKey(path) + "/.bin/" + fileName.replace('circom', 'wasm')
// @ts-ignore
await this.call('fileManager', 'writeFile', this.lastCompiledCircuitPath, circuitProgram, { encoding: null })
@ -179,7 +179,7 @@ export class CircomPluginClient extends PluginClient {
this.internalEvents.emit('circuit_compiling_done', [])
}
circuitApi.log().map(log => {
log && this.call('terminal', 'log', { type: 'log', value: log })
log && this.call('terminal', 'log', { type: 'log', value: log })
})
// @ts-ignore
this.call('terminal', 'log', { type: 'typewritersuccess', value: 'Everything went okay' })
@ -222,11 +222,11 @@ export class CircomPluginClient extends PluginClient {
this.internalEvents.emit('circuit_generating_r1cs_done')
const fileName = extractNameFromKey(path)
const writePath = extractParentFromKey(path) + "/.bin/" + fileName.replace('circom', 'r1cs')
// @ts-ignore
await this.call('fileManager', 'writeFile', writePath, r1csProgram, true)
r1csApi.log().map(log => {
log && this.call('terminal', 'log', { type: 'log', value: log })
log && this.call('terminal', 'log', { type: 'log', value: log })
})
// @ts-ignore
this.call('terminal', 'log', { type: 'typewritersuccess', value: 'Everything went okay' })
@ -339,7 +339,7 @@ export class CircomPluginClient extends PluginClient {
absFilePath = include.startsWith('circomlib') ? absFilePath.substring(1) : absFilePath
if (!blackPath.includes(absFilePath)) {
if(!includeName.startsWith('circomlib')) {
if (!includeName.startsWith('circomlib')) {
dependencyContent = dependencyContent.replace(`${includeName}`, `${absFilePath}`)
return absFilePath
}

@ -1,5 +1,5 @@
import { compiler_list } from 'circom_wasm'
import {Dispatch} from 'react'
import { Dispatch } from 'react'
import type { CircomPluginClient } from '../services/circomPluginClient'
export type CompilerStatus = "compiling" | "generating" | "computing" | "idle" | "errored" | "warning"

@ -0,0 +1,3 @@
{
"extends": "../../.eslintrc.json",
}

@ -40,6 +40,14 @@
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/debugger/**/*.ts"],
"eslintConfig": "apps/debugger/.eslintrc"
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",

@ -1,13 +1,13 @@
import { PluginClient } from "@remixproject/plugin";
import { createClient } from "@remixproject/plugin-webview";
import { IDebuggerApi, LineColumnLocation,
import { IDebuggerApi, LineColumnLocation,
onBreakpointClearedListener, onBreakpointAddedListener, onEditorContentChanged, onEnvChangedListener, TransactionReceipt } from '@remix-ui/debugger-ui'
import { DebuggerApiMixin } from '@remix-ui/debugger-ui'
import { CompilerAbstract } from '@remix-project/remix-solidity'
export class DebuggerClientApi extends DebuggerApiMixin(PluginClient) {
export class DebuggerClientApi extends DebuggerApiMixin(PluginClient) {
constructor () {
super()
super()
createClient(this as any)
this.initDebuggerApi()
}

@ -0,0 +1,3 @@
{
"extends": "../../.eslintrc.json",
}

@ -38,6 +38,14 @@
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/doc-gen/**/*.ts"],
"eslintConfig": "apps/doc-gen/.eslintrc"
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",

@ -17,7 +17,7 @@ export class DocGenClient extends PluginClient {
public docs: string[] = []
private fileName: string = ''
private contractPath: string = ''
constructor() {
super()
this.eventEmitter = new EventEmitter()
@ -30,7 +30,7 @@ export class DocGenClient extends PluginClient {
async setListeners() {
this.currentTheme = await this.call('theme', 'currentTheme')
this.on('theme', 'themeChanged', (theme: any) => {
this.currentTheme = theme
this.eventEmitter.emit('themeChanged', this.currentTheme)
@ -50,7 +50,7 @@ export class DocGenClient extends PluginClient {
}
const segmentedPathList = normalizeContractPath(fileName)
this.fileName = segmentedPathList[segmentedPathList.length - 1]
this.contractPath = segmentedPathList[0]
this.contractPath = segmentedPathList[0]
this.eventEmitter.emit('compilationFinished', this.build, this.fileName)
})
}

@ -36,47 +36,47 @@ export function fullName ({ item, contract }: DocItemContext): string {
export function signature ({ item }: DocItemContext): string | undefined {
switch (item.nodeType) {
case 'ContractDefinition':
return undefined;
case 'FunctionDefinition': {
const { kind, name } = item;
const params = item.parameters.parameters;
const returns = item.returnParameters.parameters;
const head = (kind === 'function' || kind === 'freeFunction') ? [kind, name].join(' ') : kind;
const res = [
`${head}(${params.map(formatVariable).join(', ')})`,
item.visibility,
];
if (item.stateMutability !== 'nonpayable') {
res.push(item.stateMutability);
}
if (item.virtual) {
res.push('virtual');
}
if (returns.length > 0) {
res.push(`returns (${returns.map(formatVariable).join(', ')})`);
}
return res.join(' ');
case 'ContractDefinition':
return undefined;
case 'FunctionDefinition': {
const { kind, name } = item;
const params = item.parameters.parameters;
const returns = item.returnParameters.parameters;
const head = (kind === 'function' || kind === 'freeFunction') ? [kind, name].join(' ') : kind;
const res = [
`${head}(${params.map(formatVariable).join(', ')})`,
item.visibility,
];
if (item.stateMutability !== 'nonpayable') {
res.push(item.stateMutability);
}
case 'EventDefinition': {
const params = item.parameters.parameters;
return `event ${item.name}(${params.map(formatVariable).join(', ')})`;
if (item.virtual) {
res.push('virtual');
}
case 'ErrorDefinition': {
const params = item.parameters.parameters;
return `error ${item.name}(${params.map(formatVariable).join(', ')})`;
if (returns.length > 0) {
res.push(`returns (${returns.map(formatVariable).join(', ')})`);
}
return res.join(' ');
}
case 'ModifierDefinition': {
const params = item.parameters.parameters;
return `modifier ${item.name}(${params.map(formatVariable).join(', ')})`;
}
case 'EventDefinition': {
const params = item.parameters.parameters;
return `event ${item.name}(${params.map(formatVariable).join(', ')})`;
}
case 'ErrorDefinition': {
const params = item.parameters.parameters;
return `error ${item.name}(${params.map(formatVariable).join(', ')})`;
}
case 'ModifierDefinition': {
const params = item.parameters.parameters;
return `modifier ${item.name}(${params.map(formatVariable).join(', ')})`;
}
case 'VariableDeclaration':
return formatVariable(item);
case 'VariableDeclaration':
return formatVariable(item);
}
}

@ -3,7 +3,7 @@ import { mapKeys } from './utils/map-keys';
import { DocItemContext } from './site';
import * as defaultProperties from './common/properties';
import * as themeHelpers from './themes/markdown/helpers'
import * as themeHelpers from './themes/markdown/helpers'
const common = require('./themes/markdown/common.hbs');
const contract = require('./themes/markdown/contract.hbs');
@ -45,7 +45,6 @@ export async function loadTemplates(defaultTheme: string, root: string, userTemp
properties: { ...defaultProperties },
};
// Add partials and helpers from all themes, prefixed with the theme name.
for (const [themeName, theme] of Object.entries(themes)) {
const addPrefix = (k: string) => `${themeName}/${k}`;
@ -86,7 +85,7 @@ async function readPartials() {
}
async function readHelpers(name: string) {
const helpers: Record<string, (...args: any[]) => any> = {};
for (const name in themeHelpers) {
@ -94,7 +93,7 @@ async function readHelpers(name: string) {
helpers[name] = themeHelpers[name];
}
}
return helpers;
}

@ -6,17 +6,17 @@ export function defineGetterMemoized<K extends keyof any, T, O extends { [k in K
enumerable: true,
get() {
switch (state) {
case 'done':
return value;
case 'done':
return value;
case 'doing':
throw new Error("Detected recursion");
case 'doing':
throw new Error("Detected recursion");
case 'todo':
state = 'doing';
value = getter();
state = 'done';
return value;
case 'todo':
state = 'doing';
value = getter();
state = 'done';
return value;
}
}
});

@ -34,10 +34,10 @@ export function parseNatspec(item: DocItemWithContext): NatSpec {
const docString = docSource !== undefined
? cleanUpDocstringFromSource(docSource)
: 'documentation' in item && item.documentation
? typeof item.documentation === 'string'
? item.documentation
: cleanUpDocstringFromSolc(item.documentation.text)
: '';
? typeof item.documentation === 'string'
? item.documentation
: cleanUpDocstringFromSolc(item.documentation.text)
: '';
const tagMatches = execAll(
/^(?:@(\w+|custom:[a-z][a-z-]*) )?((?:(?!^@(?:\w+|custom:[a-z][a-z-]*) )[^])*)/m,

@ -4,7 +4,7 @@ export function normalizeContractPath(contractPath: string): string[]{
const filename = paths[paths.length - 1]
let folders = ''
for (let i = 0; i < paths.length - 1; i++) {
if(i !== paths.length -1) {
if (i !== paths.length -1) {
folders += `${paths[i]}/`
}
}

@ -0,0 +1,3 @@
{
"extends": "../../.eslintrc.json",
}

@ -38,6 +38,14 @@
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/doc-viewer/**/*.ts"],
"eslintConfig": "apps/doc-viewer/.eslintrc"
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",

@ -0,0 +1,3 @@
{
"extends": "../../.eslintrc.json",
}

@ -38,6 +38,14 @@
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/etherscan/**/*.ts"],
"eslintConfig": "apps/etherscan/.eslintrc"
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",

@ -1,7 +1,7 @@
import {PluginClient} from '@remixproject/plugin'
import { PluginClient } from '@remixproject/plugin'
import { createClient } from '@remixproject/plugin-webview'
import {verify, EtherScanReturn} from './utils/verify'
import {getReceiptStatus, getEtherScanApi, getNetworkName, getProxyContractReceiptStatus} from './utils'
import { verify, EtherScanReturn } from './utils/verify'
import { getReceiptStatus, getEtherScanApi, getNetworkName, getProxyContractReceiptStatus } from './utils'
import EventManager from 'events'
export class EtherscanPluginClient extends PluginClient {
@ -46,7 +46,7 @@ export class EtherscanPluginClient extends PluginClient {
async receiptStatus(receiptGuid: string, apiKey: string, isProxyContract: boolean) {
try {
const {network, networkId} = await getNetworkName(this)
const { network, networkId } = await getNetworkName(this)
if (network === 'vm') {
throw new Error('Cannot check the receipt status in the selected network')
}

@ -4,7 +4,7 @@ import { scanAPIurls } from "./networks"
type RemixClient = PluginClient
/*
status: 0=Error, 1=Pass
status: 0=Error, 1=Pass
message: OK, NOTOK
result: explanation
*/
@ -14,7 +14,7 @@ export type receiptStatus = {
status: string
}
export const getEtherScanApi = (networkId: any) => {
export const getEtherScanApi = (networkId: any) => {
if (!(networkId in scanAPIurls)) {
throw new Error("no known network to verify against")
}
@ -26,7 +26,7 @@ export const getNetworkName = async (client: RemixClient) => {
const network = await client.call("network", "detectNetwork")
if (!network) {
throw new Error("no known network to verify against")
}
}
return { network: network.name!.toLowerCase(), networkId: network.id }
}

@ -23,7 +23,7 @@ export const verify = async (
compilationResultParam: CompilerAbstract,
chainRef: number | string,
isProxyContract: boolean,
expectedImplAddress: string,
expectedImplAddress: string,
client: PluginClient,
onVerifiedContract: (value: EtherScanReturn) => void,
setResults: (value: string) => void
@ -47,7 +47,7 @@ export const verify = async (
etherscanApi = getEtherScanApi(networkChainId)
}
}
try {
const contractMetadata = getContractMetadata(
// cast from the remix-plugin interface to the solidity one. Should be fixed when remix-plugin move to the remix-project repository
@ -61,7 +61,7 @@ export const verify = async (
message: "Please recompile contract"
}
}
const contractMetadataParsed = JSON.parse(contractMetadata)
const fileName = getContractFileName(
@ -146,9 +146,9 @@ export const verify = async (
title: result,
})
const returnValue = {
message: result,
succeed: false,
isProxyContract
message: result,
succeed: false,
isProxyContract
}
resetAfter10Seconds(client, setResults)
return returnValue
@ -184,7 +184,7 @@ export const getContractFileName = (
}
return fileName
}
export const getContractMetadata = (
compilationResult: CompilationResult,
contractName: string

@ -0,0 +1,3 @@
{
"extends": "../../.eslintrc.json",
}

@ -35,6 +35,14 @@
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/learneth/**/*.ts"],
"eslintConfig": "apps/learneth/.eslintrc"
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",

@ -1,5 +1,5 @@
import {useDispatch, type TypedUseSelectorHook, useSelector} from 'react-redux'
import {type AppDispatch, type RootState} from './store'
import { useDispatch, type TypedUseSelectorHook, useSelector } from 'react-redux'
import { type AppDispatch, type RootState } from './store'
export const useAppDispatch: () => AppDispatch = useDispatch
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector

@ -1,11 +1,11 @@
import {type ModelType} from '../store'
import { type ModelType } from '../store'
const Model: ModelType = {
namespace: 'loading',
state: {screen: true},
state: { screen: true },
reducers: {
save(state, {payload}) {
return {...state, ...payload}
save(state, { payload }) {
return { ...state, ...payload }
},
},
effects: {},

@ -1,7 +1,7 @@
import {toast} from 'react-toastify'
import {type ModelType} from '../store'
import { toast } from 'react-toastify'
import { type ModelType } from '../store'
import remixClient from '../../remix-client'
import {router} from '../../App'
import { router } from '../../App'
function getFilePath(file: string): string {
const name = file.split('/')
@ -17,12 +17,12 @@ const Model: ModelType = {
// theme: '',
},
reducers: {
save(state, {payload}) {
return {...state, ...payload}
save(state, { payload }) {
return { ...state, ...payload }
},
},
effects: {
*connect(_, {put}) {
*connect(_, { put }) {
toast.info('connecting to the REMIX IDE')
yield put({
@ -45,7 +45,7 @@ const Model: ModelType = {
yield router.navigate('/home')
},
*displayFile({payload: step}, {select, put}) {
*displayFile({ payload: step }, { select, put }) {
let content = ''
let path = ''
if (step.solidity?.file) {
@ -73,7 +73,7 @@ const Model: ModelType = {
},
})
const {detail, selectedId} = yield select((state) => state.workshop)
const { detail, selectedId } = yield select((state) => state.workshop)
const workshop = detail[selectedId]
console.log('loading ', step, workshop)
@ -87,7 +87,7 @@ const Model: ModelType = {
yield remixClient.call('fileManager', 'switchFile', `${path}`)
yield put({
type: 'remixide/save',
payload: {errorLoadingFile: false},
payload: { errorLoadingFile: false },
})
toast.dismiss()
} catch (error) {
@ -95,7 +95,7 @@ const Model: ModelType = {
toast.error('File could not be loaded. Please try again.')
yield put({
type: 'remixide/save',
payload: {errorLoadingFile: true},
payload: { errorLoadingFile: true },
})
}
yield put({
@ -105,7 +105,7 @@ const Model: ModelType = {
},
})
},
*testStep({payload: step}, {select, put}) {
*testStep({ payload: step }, { select, put }) {
yield put({
type: 'loading/save',
payload: {
@ -116,9 +116,9 @@ const Model: ModelType = {
try {
yield put({
type: 'remixide/save',
payload: {success: false},
payload: { success: false },
})
const {detail, selectedId} = yield select((state) => state.workshop)
const { detail, selectedId } = yield select((state) => state.workshop)
const workshop = detail[selectedId]
@ -141,7 +141,7 @@ const Model: ModelType = {
if (!result) {
yield put({
type: 'remixide/save',
payload: {errors: ['Compiler failed to test this file']},
payload: { errors: ['Compiler failed to test this file']},
})
} else {
const success = result.totalFailing === 0
@ -149,7 +149,7 @@ const Model: ModelType = {
if (success) {
yield put({
type: 'remixide/save',
payload: {errors: [], success: true},
payload: { errors: [], success: true },
})
} else {
yield put({
@ -164,7 +164,7 @@ const Model: ModelType = {
console.log('TESTING ERROR', err)
yield put({
type: 'remixide/save',
payload: {errors: [String(err)]},
payload: { errors: [String(err)]},
})
}
yield put({
@ -174,7 +174,7 @@ const Model: ModelType = {
},
})
},
*showAnswer({payload: step}, {select, put}) {
*showAnswer({ payload: step }, { select, put }) {
yield put({
type: 'loading/save',
payload: {
@ -189,7 +189,7 @@ const Model: ModelType = {
const content = step.answer.content
let path = getFilePath(step.answer.file)
const {detail, selectedId} = yield select((state) => state.workshop)
const { detail, selectedId } = yield select((state) => state.workshop)
const workshop = detail[selectedId]
path = `.learneth/${workshop.name}/${step.name}/${path}`
@ -198,7 +198,7 @@ const Model: ModelType = {
} catch (err) {
yield put({
type: 'remixide/save',
payload: {errors: [String(err)]},
payload: { errors: [String(err)]},
})
}
@ -210,7 +210,7 @@ const Model: ModelType = {
},
})
},
*testSolidityCompiler(_, {put, select}) {
*testSolidityCompiler(_, { put, select }) {
try {
yield remixClient.call('solidity', 'getCompilationResult')
} catch (err) {

@ -1,10 +1,10 @@
import axios from 'axios'
import {toast} from 'react-toastify'
import { toast } from 'react-toastify'
import groupBy from 'lodash/groupBy'
import pick from 'lodash/pick'
import {type ModelType} from '../store'
import { type ModelType } from '../store'
import remixClient from '../../remix-client'
import {router} from '../../App'
import { router } from '../../App'
// const apiUrl = 'http://localhost:3001';
const apiUrl = 'https://static.220.14.12.49.clients.your-server.de:3000'
@ -17,12 +17,12 @@ const Model: ModelType = {
selectedId: '',
},
reducers: {
save(state, {payload}) {
return {...state, ...payload}
save(state, { payload }) {
return { ...state, ...payload }
},
},
effects: {
*init(_, {put}) {
*init(_, { put }) {
const cache = localStorage.getItem('workshop.state')
if (cache) {
@ -41,7 +41,7 @@ const Model: ModelType = {
})
}
},
*loadRepo({payload}, {put, select}) {
*loadRepo({ payload }, { put, select }) {
toast.info(`loading ${payload.name}/${payload.branch}`)
yield put({
@ -51,18 +51,18 @@ const Model: ModelType = {
},
})
const {list, detail} = yield select((state) => state.workshop)
const { list, detail } = yield select((state) => state.workshop)
const url = `${apiUrl}/clone/${encodeURIComponent(payload.name)}/${payload.branch}?${Math.random()}`
console.log('loading ', url)
const {data} = yield axios.get(url)
const { data } = yield axios.get(url)
const repoId = `${payload.name}-${payload.branch}`
for (let i = 0; i < data.ids.length; i++) {
const {
steps,
metadata: {
data: {steps: metadataSteps},
data: { steps: metadataSteps },
},
} = data.entities[data.ids[i]]
@ -130,8 +130,8 @@ const Model: ModelType = {
})
if (payload.id) {
const {detail, selectedId} = workshopState
const {ids, entities} = detail[selectedId]
const { detail, selectedId } = workshopState
const { ids, entities } = detail[selectedId]
for (let i = 0; i < ids.length; i++) {
const entity = entities[ids[i]]
if (entity.metadata.data.id === payload.id || i + 1 === payload.id) {
@ -141,7 +141,7 @@ const Model: ModelType = {
}
}
},
*resetAll(_, {put}) {
*resetAll(_, { put }) {
yield put({
type: 'workshop/save',
payload: {

@ -1,6 +1,6 @@
import {configureStore, createSlice, type PayloadAction, type Reducer} from '@reduxjs/toolkit'
import { configureStore, createSlice, type PayloadAction, type Reducer } from '@reduxjs/toolkit'
import createSagaMiddleware from 'redux-saga'
import {call, put, takeEvery, delay, select, all, fork, type ForkEffect} from 'redux-saga/effects'
import { call, put, takeEvery, delay, select, all, fork, type ForkEffect } from 'redux-saga/effects'
// @ts-expect-error
const context = require.context('./models', false, /\.ts$/)
@ -39,7 +39,7 @@ function createReducer(model: ModelType): Reducer {
}
const rootReducer = models.reduce((prev: any, model: ModelType) => {
return {...prev, [model.namespace]: createReducer(model)}
return { ...prev, [model.namespace]: createReducer(model) }
}, {})
function watchEffects(model: ModelType): ForkEffect {

@ -1,7 +1,7 @@
import {PluginClient} from '@remixproject/plugin'
import {createClient} from '@remixproject/plugin-webview'
import {store} from './redux/store'
import {router} from './App'
import { PluginClient } from '@remixproject/plugin'
import { createClient } from '@remixproject/plugin-webview'
import { store } from './redux/store'
import { router } from './App'
class RemixClient extends PluginClient {
constructor() {

@ -1,9 +1,9 @@
// eslint-disable-next-line no-use-before-define
import React from 'react'
import {AbstractPanel} from './panel'
import { AbstractPanel } from './panel'
import * as packageJson from '../../../../../package.json'
import {RemixPluginPanel} from '@remix-ui/panel'
import {PluginViewWrapper} from '@remix-ui/helper'
import { RemixPluginPanel } from '@remix-ui/panel'
import { PluginViewWrapper } from '@remix-ui/helper'
const profile = {
name: 'hiddenPanel',

@ -1,8 +1,8 @@
import React from 'react' // eslint-disable-line
import {AbstractPanel} from './panel'
import {RemixPluginPanel} from '@remix-ui/panel'
import { AbstractPanel } from './panel'
import { RemixPluginPanel } from '@remix-ui/panel'
import packageJson from '../../../../../package.json'
import {PluginViewWrapper} from '@remix-ui/helper'
import { PluginViewWrapper } from '@remix-ui/helper'
const profile = {
name: 'mainPanel',
@ -60,7 +60,7 @@ export class MainPanel extends AbstractPanel {
render() {
return (
<div style={{height: '100%', width: '100%'}} data-id="mainPanelPluginsContainer">
<div style={{ height: '100%', width: '100%' }} data-id="mainPanelPluginsContainer">
<PluginViewWrapper plugin={this} />
</div>
)

@ -49,7 +49,7 @@ export class AbstractPanel extends HostPlugin {
* @param {String} name The name of the plugin to display the content
*/
showContent (name) {
if (!this.plugins[name]) throw new Error(`Plugin ${name} is not yet activated`)
if (!this.plugins[name]) throw new Error(`Plugin ${name} is not yet activated`)
Object.values(this.plugins).forEach(plugin => {
plugin.active = false
})

@ -1,12 +1,12 @@
import {RemixApp} from '@remix-ui/app'
import { RemixApp } from '@remix-ui/app'
import axios from 'axios'
import React, {useEffect, useRef, useState} from 'react'
import React, { useEffect, useRef, useState } from 'react'
import { createRoot } from 'react-dom/client'
import * as packageJson from '../../../../../package.json'
import {fileSystem, fileSystems} from '../files/fileSystem'
import {indexedDBFileSystem} from '../files/filesystems/indexedDB'
import {localStorageFS} from '../files/filesystems/localStorage'
import {fileSystemUtility, migrationTestData} from '../files/filesystems/fileSystemUtility'
import { fileSystem, fileSystems } from '../files/fileSystem'
import { indexedDBFileSystem } from '../files/filesystems/indexedDB'
import { localStorageFS } from '../files/filesystems/localStorage'
import { fileSystemUtility, migrationTestData } from '../files/filesystems/fileSystemUtility'
import './styles/preload.css'
import isElectron from 'is-electron'
const _paq = (window._paq = window._paq || [])
@ -83,7 +83,7 @@ export const Preload = (props: any) => {
}
useEffect (() => {
if(isElectron()){
if (isElectron()){
loadAppComponent()
return
}
@ -177,8 +177,8 @@ export const Preload = (props: any) => {
) : null}
{supported && !error && !showDownloader ? (
<div>
<div className='text-center'>
<i className="fas fa-spinner fa-spin fa-2x"></i>
<div className='text-center'>
<i className="fas fa-spinner fa-spin fa-2x"></i>
</div>
{ tip && <div className='remix_tips text-center mt-3'>
<div><b>DID YOU KNOW</b></div>

@ -1,10 +1,10 @@
// eslint-disable-next-line no-use-before-define
import React from 'react'
import {AbstractPanel} from './panel'
import {RemixPluginPanel} from '@remix-ui/panel'
import { AbstractPanel } from './panel'
import { RemixPluginPanel } from '@remix-ui/panel'
import packageJson from '../../../../../package.json'
import {RemixUIPanelHeader} from '@remix-ui/panel'
import {PluginViewWrapper} from '@remix-ui/helper'
import { RemixUIPanelHeader } from '@remix-ui/panel'
import { PluginViewWrapper } from '@remix-ui/helper'
// const csjs = require('csjs-inject')
const sidePanel = {

@ -1,11 +1,11 @@
// eslint-disable-next-line no-use-before-define
import React from 'react'
import packageJson from '../../../../../package.json'
import {Plugin} from '@remixproject/engine'
import {EventEmitter} from 'events'
import {IconRecord, RemixUiVerticalIconsPanel} from '@remix-ui/vertical-icons-panel'
import {Profile} from '@remixproject/plugin-utils'
import {PluginViewWrapper} from '@remix-ui/helper'
import { Plugin } from '@remixproject/engine'
import { EventEmitter } from 'events'
import { IconRecord, RemixUiVerticalIconsPanel } from '@remix-ui/vertical-icons-panel'
import { Profile } from '@remixproject/plugin-utils'
import { PluginViewWrapper } from '@remix-ui/helper'
const profile = {
name: 'menuicons',

@ -14,7 +14,7 @@ import JSZip from 'jszip'
import path from 'path'
import FormData from 'form-data'
import axios from 'axios'
import {Registry} from '@remix-project/remix-lib'
import { Registry } from '@remix-project/remix-lib'
const profile = {
name: 'dGitProvider',
@ -121,7 +121,6 @@ class DGitProvider extends Plugin {
return status
}
const status = await git.statusMatrix({
...await this.getGitConfig(),
...cmd
@ -189,7 +188,7 @@ class DGitProvider extends Plugin {
return newmodule.name === module.name
})
})
for (const module of toRemove) {
const path = (await this.getGitConfig(module.path)).dir
if (await window.remixFileSystem.exists(path)) {
@ -224,7 +223,6 @@ class DGitProvider extends Plugin {
return status
}
const status = await git.log({
...await this.getGitConfig(),
...cmd,
@ -269,8 +267,6 @@ class DGitProvider extends Plugin {
async currentbranch(config) {
if ((Registry.getInstance().get('platform').api.isDesktop())) {
return await this.call('isogit', 'currentbranch')
}
@ -426,11 +422,11 @@ class DGitProvider extends Plugin {
input
}
this.call('terminal', 'logHtml', `Cloning ${input.url}... please wait...`)
try{
try {
const result = await this.call('isogit', 'clone', cmd)
this.call('fs', 'openWindow', folder)
return result
}catch(e){
} catch (e){
this.call('notification', 'alert', {
id: 'dgitAlert',
message: 'Unexpected error while cloning the repository: \n' + e.toString(),
@ -516,7 +512,7 @@ class DGitProvider extends Plugin {
for (const module of gitmodules) {
const dir = path.join(currentDir, module.path)
// if url contains git@github.com: convert it
if(module.url && module.url.startsWith('git@github.com:')) {
if (module.url && module.url.startsWith('git@github.com:')) {
module.url = module.url.replace('git@github.com:', 'https://github.com/')
}
try {
@ -530,7 +526,7 @@ class DGitProvider extends Plugin {
this.call('terminal', 'logHtml', `Cloning submodule ${dir}...`)
await git.clone(cmd)
this.call('terminal', 'logHtml', `Cloned successfully submodule ${dir}...`)
const commitHash = await git.resolveRef({
...await this.getGitConfig(currentDir),
ref: 'HEAD'
@ -540,12 +536,12 @@ class DGitProvider extends Plugin {
...await this.getGitConfig(currentDir),
trees: [git.TREE({ ref: commitHash })],
map: async function (filepath, [A]) {
if(filepath === module.path) {
if (filepath === module.path) {
return await A.oid()
}
}
})
if(result && result.length) {
if (result && result.length) {
this.call('terminal', 'logHtml', `Checking out submodule ${dir} to ${result[0]} in directory ${dir}`)
await git.fetch({
...await this.parseInput(input),
@ -558,16 +554,16 @@ class DGitProvider extends Plugin {
...await this.getGitConfig(dir),
ref: result[0]
})
const log = await git.log({
...await this.getGitConfig(dir),
})
if(log[0].oid !== result[0]) {
if (log[0].oid !== result[0]) {
this.call('terminal', 'log', {
type: 'error',
value: `Could not checkout submodule to ${result[0]}`
})} else {
})} else {
this.call('terminal', 'logHtml',`Checked out submodule ${dir} to ${result[0]}`)
}
}

@ -1,6 +1,5 @@
import FileProvider from "./fileProvider"
declare global {
interface Window {
remixFileSystem: any
@ -50,7 +49,6 @@ export class ElectronProvider extends FileProvider {
}
}
// isDirectory is already included
// this is a more efficient version of the default implementation
async resolveDirectory(path, cb) {

@ -4,7 +4,7 @@ import { saveAs } from 'file-saver'
import JSZip from 'jszip'
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
import {Registry} from '@remix-project/remix-lib'
import { Registry } from '@remix-project/remix-lib'
import { fileChangedToastMsg, recursivePasteToastMsg, storageFullMessage } from '@remix-ui/helper'
import helper from '../../lib/helper.js'
import { RemixAppManager } from '../../remixAppManager'
@ -251,7 +251,7 @@ class FileManager extends Plugin {
throw new Error(e)
}
}
/**
* Set the content of a specific file, does nnot rewrite file if it exists but creates a new unique name
* @param {string} path path of the file
@ -265,11 +265,11 @@ class FileManager extends Plugin {
if (await this.exists(path)) {
const newPath = await helper.createNonClashingNameAsync(path, this)
const content = await this.setFileContent(newPath, data)
return {newContent: content, newPath}
return { newContent: content, newPath }
} else {
const ret = await this.setFileContent(path, data)
this.emit('fileAdded', path)
return {newContent: ret, newpath: path}
return { newContent: ret, newpath: path }
}
} catch (e) {
throw new Error(e)
@ -523,7 +523,7 @@ class FileManager extends Plugin {
this._deps.electronExplorer.event.on('fileRenamed', (oldName, newName, isFolder) => { this.fileRenamedEvent(oldName, newName, isFolder) })
this._deps.electronExplorer.event.on('fileRemoved', (path) => { this.fileRemovedEvent(path) })
this._deps.electronExplorer.event.on('fileAdded', (path) => { this.fileAddedEvent(path) })
this.getCurrentFile = this.file
this.getFile = this.readFile
this.getFolder = this.readdir
@ -726,7 +726,7 @@ class FileManager extends Plugin {
}
try {
// This make sure dependencies are loaded in the editor context.
// This ensure monaco is aware of deps artifacts, so it can provide basic features like "go to" symbols.
// This ensure monaco is aware of deps artifacts, so it can provide basic features like "go to" symbols.
await this.editor.handleTypeScriptDependenciesOf(file, content, path => this.readFile(path), path => this.exists(path))
} catch (e) {
console.log('unable to handle TypeScript dependencies of', file)
@ -927,7 +927,6 @@ class FileManager extends Plugin {
return exists
}
async moveFileIsAllowed (src: string, dest: string) {
try {
src = this.normalize(src)
@ -970,7 +969,7 @@ class FileManager extends Plugin {
if (provider.isSubDirectory(src, dest)) {
this.call('notification', 'toast', recursivePasteToastMsg())
return false
}
}
return true
} catch (e) {
console.log(e)
@ -1033,7 +1032,7 @@ class FileManager extends Plugin {
if (provider.isSubDirectory(src, dest)) {
this.call('notification', 'toast', recursivePasteToastMsg())
return false
}
}
await this.inDepthCopy(src, dest, dirName)
await this.remove(src)
@ -1047,7 +1046,7 @@ class FileManager extends Plugin {
if (provider && provider.copyFolderToJson) {
return await provider.copyFolderToJson(folder)
}
throw new Error('copyFolderToJson not available')
throw new Error('copyFolderToJson not available')
}
}

@ -5,7 +5,6 @@ import EventManager from 'events'
import { Storage } from '@remix-project/remix-lib'
import pathModule from 'path'
export default class FileProvider {
event: any
type: any
@ -189,7 +188,7 @@ export default class FileProvider {
return await this.removeFile(path)
} else {
await window.remixFileSystem.unlink(path)
this.event.emit('fileRemoved', this._normalizePath(path))
this.event.emit('fileRemoved', this._normalizePath(path))
}
} catch (e) {
console.log(e)

@ -67,6 +67,5 @@ export class fileSystems {
return null
}
}

@ -72,7 +72,6 @@ export class fileSystemUtility {
}
}
/**
* copy the folder recursively
* @param {string} path is the folder to be copied over
@ -150,7 +149,6 @@ export class fileSystemUtility {
}
}
/* eslint-disable no-template-curly-in-string */
export const migrationTestData = {
'.workspaces': {

@ -47,7 +47,6 @@ export class IndexedDBStorage extends LightningFS {
}
}
export class indexedDBFileSystem extends fileSystem {
constructor() {
super()

@ -48,7 +48,7 @@ export class localStorageFS extends fileSystem {
localStorage.setItem(test, test);
localStorage.removeItem(test);
resolve(true)
} catch(e) {
} catch (e) {
reject(e)
}
})

@ -3,7 +3,7 @@ import React from 'react' // eslint-disable-line
import { RemixUiTerminal, RemixUITerminalWrapper } from '@remix-ui/terminal' // eslint-disable-line
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
import {Registry} from '@remix-project/remix-lib'
import { Registry } from '@remix-project/remix-lib'
import { PluginViewWrapper } from '@remix-ui/helper'
import vm from 'vm'
import EventManager from '../../lib/events'
@ -11,7 +11,6 @@ import EventManager from '../../lib/events'
import { CompilerImports } from '@remix-project/core-plugin' // eslint-disable-line
import { RemixUiXterminals } from '@remix-ui/xterm'
const KONSOLES = []
function register(api) { KONSOLES.push(api) }
@ -113,7 +112,6 @@ class Terminal extends Plugin {
}
onActivation() {
this.renderComponent()
}
@ -142,7 +140,7 @@ class Terminal extends Plugin {
}
updateComponent(state) {
return(
return (
<RemixUITerminalWrapper
plugin={state.plugin}
onReady={state.onReady}

@ -210,8 +210,6 @@ export class CodeFormat extends Plugin {
this.call('notification', 'toast', `Error parsing prettier config file: ${prettierConfigFile}`)
}
// merge options
if (parsed) {
options = {
@ -251,7 +249,6 @@ export class CodeFormat extends Plugin {
}
}
const result = this.prettier.format(content, {
plugins: [sol as any, this.ts, this.babel, this.espree, this.yml],
parser: parserName,

@ -194,4 +194,3 @@ export function parse(text, _parsers, options) {
return parsed;
}

@ -1,6 +1,6 @@
import React from 'react'
import { ViewPlugin } from '@remixproject/engine-web'
import {PluginViewWrapper} from '@remix-ui/helper'
import { PluginViewWrapper } from '@remix-ui/helper'
import { RemixAppManager } from '../../remixAppManager'
import { RemixUiCompileDetails } from '@remix-ui/solidity-compile-details'

@ -1,6 +1,6 @@
import { Plugin } from '@remixproject/engine'
import { QueryParams } from '@remix-project/remix-lib'
import {Registry} from '@remix-project/remix-lib'
import { Registry } from '@remix-project/remix-lib'
const profile = {
name: 'config',

@ -1,8 +1,8 @@
import React from 'react'
import {Plugin} from '@remixproject/engine'
import {customAction} from '@remixproject/plugin-api'
import {concatSourceFiles, getDependencyGraph, normalizeContractPath} from '@remix-ui/solidity-compiler'
import type {CompilerInput, CompilationSource } from '@remix-project/remix-solidity'
import { Plugin } from '@remixproject/engine'
import { customAction } from '@remixproject/plugin-api'
import { concatSourceFiles, getDependencyGraph, normalizeContractPath } from '@remix-ui/solidity-compiler'
import type { CompilerInput, CompilationSource } from '@remix-project/remix-solidity'
const _paq = (window._paq = window._paq || [])

@ -1,7 +1,7 @@
import { ElectronPlugin } from '@remixproject/engine-electron';
import { Plugin } from '@remixproject/engine';
import { baseURLBin, baseURLWasm } from '@remix-project/remix-solidity'
import axios, {AxiosResponse} from 'axios'
import axios, { AxiosResponse } from 'axios'
import { iSolJsonBinData } from '@remix-project/remix-lib'
const profile = {
@ -55,7 +55,7 @@ export class compilerLoaderPluginDesktop extends ElectronPlugin {
}
async onActivation(): Promise<void> {
this.on('solidity', 'loadingCompiler', async (url) => {
await this.call('compilerloader', 'downloadCompiler', url)
})

@ -78,7 +78,7 @@ export class fsPlugin extends ElectronPlugin {
try {
path = fixPath(path)
const stat = await this.call('fs', 'stat', path)
if(!stat) return undefined
if (!stat) return undefined
stat.isDirectory = () => stat.isDirectoryValue
stat.isFile = () => !stat.isDirectoryValue
return stat
@ -90,7 +90,7 @@ export class fsPlugin extends ElectronPlugin {
try {
path = fixPath(path)
const stat = await this.call('fs', 'lstat', path)
if(!stat) return undefined
if (!stat) return undefined
stat.isDirectory = () => stat.isDirectoryValue
stat.isFile = () => !stat.isDirectoryValue
return stat
@ -116,7 +116,7 @@ export class fsPlugin extends ElectronPlugin {
await this.call('fileManager', 'refresh')
})
this.on('fs', 'error', async (error: string) => {
if(error === 'ENOSPC'){
if (error === 'ENOSPC'){
this.call('notification', 'alert', {
id: 'fsError',
message: 'Cannot watch file changes. There are too many files in your project.'

@ -55,8 +55,8 @@ export class FileDecorator extends Plugin {
if (!from) return
const filteredState = this._fileStates.filter((state) => {
if(state.owner != from) return true
if(path && state.path != path) return true
if (state.owner != from) return true
if (path && state.path != path) return true
})
const newState = [...filteredState].sort(sortByPath)

@ -1,8 +1,8 @@
import {Plugin} from '@remixproject/engine'
import {LibraryProfile, MethodApi, StatusEvents} from '@remixproject/plugin-utils'
import {AppModal} from '@remix-ui/app'
import {AlertModal} from '@remix-ui/app'
import {dispatchModalInterface} from '@remix-ui/app'
import { Plugin } from '@remixproject/engine'
import { LibraryProfile, MethodApi, StatusEvents } from '@remixproject/plugin-utils'
import { AppModal } from '@remix-ui/app'
import { AlertModal } from '@remix-ui/app'
import { dispatchModalInterface } from '@remix-ui/app'
interface INotificationApi {
events: StatusEvents

@ -19,7 +19,7 @@ export class OpenAIGpt extends Plugin {
async message(prompt): Promise<CreateChatCompletionResponse> {
this.call('layout', 'maximizeTerminal')
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: 'Waiting for GPT answer...'})
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: 'Waiting for GPT answer...' })
let result
try {
result = await (
@ -36,10 +36,10 @@ export class OpenAIGpt extends Plugin {
this.call('terminal', 'log', { type: 'typewritererror', value: `Unable to get a response ${e.message}` })
return
}
if (result && result.choices && result.choices.length) {
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result.choices[0].message.content })
} else if (result.error) {
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result.choices[0].message.content })
} else if (result.error) {
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result.error })
} else {
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: 'No response...' })

@ -524,8 +524,8 @@ export class CodeParser extends Plugin {
nodeDefinition.parser = parserNodeDefinition
}
/* if the AST node name & type is the same as the parser node name & type,
/ then we can assume that the AST node is the definition,
/* if the AST node name & type is the same as the parser node name & type,
/ then we can assume that the AST node is the definition,
/ because the parser will always return most nodes it can find even with an error in the code
*/
@ -544,7 +544,6 @@ export class CodeParser extends Plugin {
return nodeDefinition.ast
}
return nodeDefinition.parser
}

@ -4,7 +4,7 @@ import { AstNode } from "@remix-project/remix-solidity"
import { CodeParser } from "../code-parser"
import { antlr } from '../types'
import { pathToFileURL } from 'url'
import {Registry} from '@remix-project/remix-lib'
import { Registry } from '@remix-project/remix-lib'
const SolidityParser = (window as any).SolidityParser = (window as any).SolidityParser || []
@ -117,8 +117,8 @@ export default class CodeParserAntlrService {
/**
* Tries to parse the current file or the given text and returns the AST
* If the parsing fails it returns the last successful AST for this file
* @param text
* @returns
* @param text
* @returns
*/
async setCurrentFileAST(text: string | null = null) {
try {
@ -149,7 +149,7 @@ export default class CodeParserAntlrService {
/**
* Lists the AST nodes from the current file parser
* These nodes need to be changed to match the node types returned by the compiler
* @returns
* @returns
*/
async listAstNodes() {
this.plugin.currentFile = await this.plugin.call('fileManager', 'file')
@ -201,11 +201,10 @@ export default class CodeParserAntlrService {
return nodes
}
/**
*
* @param ast
* @returns
*
* @param ast
* @returns
*/
async getLastNodeInLine(ast: string) {
let lastNode: any
@ -247,7 +246,7 @@ export default class CodeParserAntlrService {
try {
const startTime = Date.now()
const blocks = (SolidityParser as any).parseBlock(fileContent, { loc: true, range: true, tolerant: true })
if(this.cache[this.plugin.currentFile] && this.cache[this.plugin.currentFile].blockDurations){
if (this.cache[this.plugin.currentFile] && this.cache[this.plugin.currentFile].blockDurations){
this.cache[this.plugin.currentFile].blockDurations = [...this.cache[this.plugin.currentFile].blockDurations.slice(-this.parserThresholdSampleAmount), Date.now() - startTime]
this.setFileParsingState(this.plugin.currentFile)
}

@ -75,7 +75,6 @@ export default class CodeParserCompiler {
length: error.sourceLocation.end - error.sourceLocation.start
}, lineBreaks)
const filePath = error.sourceLocation.file
const fileTarget = await this.plugin.call('fileManager', 'getUrlFromPath', filePath)
@ -103,24 +102,23 @@ export default class CodeParserCompiler {
if (data.sources && Object.keys(data.sources).length === 0) return
this.plugin.compilerAbstract = new CompilerAbstract('soljson', data, source, input)
this.errorState = false
this.plugin.nodeIndex = {
declarations: {},
flatReferences: {},
nodesPerFile: {},
}
this.plugin._buildIndex(data, source)
// cast from the remix-plugin interface to the solidity one. Should be fixed when remix-plugin move to the remix-project repository
const extractedFiledNodes = this.plugin._extractFileNodes(this.plugin.currentFile, this.plugin.compilerAbstract as unknown as lastCompilationResult)
if(extractedFiledNodes) {
if (extractedFiledNodes) {
this.plugin.nodeIndex.nodesPerFile[this.plugin.currentFile] = extractedFiledNodes
}
await this.plugin.gasService.showGasEstimates()
this.plugin.emit('astFinished')
}
this.compiler = new Compiler((url, cb) => this.plugin.call('contentImport', 'resolveAndSave', url, undefined).then((result) => cb(null, result)).catch((error) => cb(error.message)))
this.compiler.event.register('compilationFinished', this.onAstFinished)
}
@ -128,8 +126,8 @@ export default class CodeParserCompiler {
// COMPILER
/**
*
* @returns
*
* @returns
*/
async compile() {
try {
@ -149,7 +147,7 @@ export default class CodeParserCompiler {
} else {
this.compiler.set('remappings', [])
}
const configFileContent = {
"language": "Solidity",
"settings": {
@ -227,7 +225,7 @@ export default class CodeParserCompiler {
const fileTarget = await this.plugin.call('fileManager', 'getPathFromUrl', fileName)
await this.plugin.call('fileDecorator', 'clearFileDecorators', fileTarget.file)
}
if(decorators.length > 0)
if (decorators.length > 0)
await this.plugin.call('fileDecorator', 'setFileDecorators', decorators)
await this.plugin.call('editor', 'clearErrorMarkers', filesWithOutErrors)

@ -33,17 +33,16 @@ export default class CodeParserGasService {
}
async showGasEstimates() {
const showGasConfig = await this.plugin.call('config', 'getAppParameter', 'show-gas')
if(!showGasConfig) {
if (!showGasConfig) {
await this.plugin.call('editor', 'discardLineTexts')
return
}
this.plugin.currentFile = await this.plugin.call('fileManager', 'file')
// cast from the remix-plugin interface to the solidity one. Should be fixed when remix-plugin move to the remix-project repository
const extractedFiledNodes = await this.plugin._extractFileNodes(this.plugin.currentFile, this.plugin.compilerAbstract as unknown as lastCompilationResult)
if(extractedFiledNodes) {
const extractedFiledNodes = await this.plugin._extractFileNodes(this.plugin.currentFile, this.plugin.compilerAbstract as unknown as lastCompilationResult)
if (extractedFiledNodes) {
this.plugin.nodeIndex.nodesPerFile[this.plugin.currentFile] = extractedFiledNodes
}
@ -72,10 +71,8 @@ export default class CodeParserGasService {
this.plugin.call('editor', 'addLineText', linetext, estimate.range.fileName)
}
}
}
}

@ -1,5 +1,5 @@
'use strict'
import {Registry} from '@remix-project/remix-lib'
import { Registry } from '@remix-project/remix-lib'
import { CodeParser } from "../code-parser";
export type CodeParserImportsData = {
@ -20,7 +20,7 @@ export default class CodeParserImports {
}
async getImports(){
if(!this.data || !this.data.files || !this.data.timestamp || this.data.timestamp != this.directoryUpdateCacheTimeStamp){
if (!this.data || !this.data.files || !this.data.timestamp || this.data.timestamp != this.directoryUpdateCacheTimeStamp){
await this.setFileTree()
}
return this.data
@ -33,13 +33,13 @@ export default class CodeParserImports {
.filter(x => x !== '')
.map(x => x.replace('./node_modules/', ''))
.filter(x => {
if(x.includes('@openzeppelin')) {
if (x.includes('@openzeppelin')) {
return !x.includes('mock')
}else{
} else {
return true
}
}
})
// get unique first words of the values in the array
this.data.packages = [...new Set(this.data.modules.map(x => x.split('/')[0]))]
}
@ -79,7 +79,7 @@ export default class CodeParserImports {
files = await this.plugin.call('fileManager', 'readdir', dir)
}
} catch (e) {}
const fileArray = this.normalize(files)
for (const fi of fileArray) {
if (fi) {

@ -24,7 +24,6 @@ interface Token {
}
}
interface Location {
start: {
line: number
@ -594,7 +593,6 @@ export type Statement =
type ASTMap<U> = { [K in ASTNodeTypeString]: U extends { type: K } ? U : never }
type ASTTypeMap = ASTMap<ASTNode>
export const astNodeTypes = [
'SourceUnit',
'PragmaDirective',
@ -673,9 +671,6 @@ export const astNodeTypes = [
'InvalidNode'
] as const
export const binaryOpValues = [
'+',
'-',
@ -725,8 +720,3 @@ export const unaryOpValues = [
] as const
export type UnaryOp = typeof unaryOpValues[number]

@ -1,9 +1,9 @@
import React from 'react' // eslint-disable-line
import {FormattedMessage} from 'react-intl'
import {Plugin} from '@remixproject/engine'
import {AppModal} from '@remix-ui/app'
import {PermissionHandlerDialog, PermissionHandlerValue} from '@remix-ui/permission-handler'
import {Profile} from '@remixproject/plugin-utils'
import { FormattedMessage } from 'react-intl'
import { Plugin } from '@remixproject/engine'
import { AppModal } from '@remix-ui/app'
import { PermissionHandlerDialog, PermissionHandlerValue } from '@remix-ui/permission-handler'
import { Profile } from '@remixproject/plugin-utils'
const profile = {
name: 'permissionhandler',
@ -89,7 +89,7 @@ export class PermissionHandlerPlugin extends Plugin {
if (!this.permissions[to.name][method][from.name]) return this.openPermission(from, to, method, message, sensitiveCall)
}
const {allow, hash} = sensitiveCall ? this.sessionPermissions[to.name][method][from.name] : this.permissions[to.name][method][from.name]
const { allow, hash } = sensitiveCall ? this.sessionPermissions[to.name][method][from.name] : this.permissions[to.name][method][from.name]
if (!allow) {
const warning = this.notAllowWarning(from, to, method)
const warnEl =
@ -97,9 +97,9 @@ export class PermissionHandlerPlugin extends Plugin {
<span>{ warning }</span>
<div className='d-flex flex-row'>
<span onClick={()=>{}}>To change the permission go to </span>
<span className='px-2' style={{fontWeight: 'bolder'}}>Plugin Manager</span>
<img alt="" id="permissionModalImagesFrom" src="/assets/img/pluginManager.webp" style={{height: '1rem', width: '1rem'}} />
<span className='pl-1' style={{fontWeight: 'bolder'}}> / Permissions</span>
<span className='px-2' style={{ fontWeight: 'bolder' }}>Plugin Manager</span>
<img alt="" id="permissionModalImagesFrom" src="/assets/img/pluginManager.webp" style={{ height: '1rem', width: '1rem' }} />
<span className='pl-1' style={{ fontWeight: 'bolder' }}> / Permissions</span>
</div>
</div>
this.call('notification', 'toast', warnEl)
@ -130,7 +130,7 @@ export class PermissionHandlerPlugin extends Plugin {
}
const modal: AppModal = {
id: 'PermissionHandler',
title: <FormattedMessage id="permissionHandler.permissionNeededFor" values={{to: to.displayName || to.name}} />,
title: <FormattedMessage id="permissionHandler.permissionNeededFor" values={{ to: to.displayName || to.name }} />,
message: <PermissionHandlerDialog plugin={this} theme={await this.getTheme()} value={value}></PermissionHandlerDialog>,
okLabel: <FormattedMessage id="permissionHandler.accept" />,
cancelLabel: <FormattedMessage id="permissionHandler.decline" />

@ -30,7 +30,7 @@ export class RemixGuidePlugin extends ViewPlugin {
super(profile)
this.appManager = appManager
this.element = document.createElement('div')
this.element.setAttribute('id', 'remixGuideEl')
this.element.setAttribute('id', 'remixGuideEl')
}
async onActivation() {
@ -49,13 +49,13 @@ export class RemixGuidePlugin extends ViewPlugin {
this.profile.displayName = `${contractName[0]}`
this.payload = sentPayload
const active = await this.call('theme', 'currentTheme')
this.renderComponent()
}
private handleThemeChange() {
this.on('theme', 'themeChanged', (theme: any) => {
this.renderComponent()
})
}
@ -114,7 +114,7 @@ export class RemixGuidePlugin extends ViewPlugin {
tagList={['L2', 'AI']}
logo='/assets/img/soliditySurvey2023.webp'
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell>
<RemixUIGridCell
plugin={this}
@ -122,55 +122,55 @@ export class RemixGuidePlugin extends ViewPlugin {
pinned={true}
tagList={['L2', 'plugins']}
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell> <RemixUIGridCell
plugin={this}
title="something"
pinned={false}
tagList={['solidity', 'plugins']}
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell>
<RemixUIGridCell
plugin={this}
title="1"
tagList={['solidity']}
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell> <RemixUIGridCell
plugin={this}
title="1"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell>
<RemixUIGridCell
plugin={this}
title="Something very very long"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell> <RemixUIGridCell
plugin={this}
title="1"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell>
<RemixUIGridCell
plugin={this}
title="1"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell>
<RemixUIGridCell
plugin={this}
title="1"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell>
<RemixUIGridCell
plugin={this}
title="1"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell>
</RemixUIGridSection>
<RemixUIGridSection
@ -183,58 +183,58 @@ export class RemixGuidePlugin extends ViewPlugin {
title="first item"
logo='/assets/img/soliditySurvey2023.webp'
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell>
<RemixUIGridCell
plugin={this}
title="next"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell> <RemixUIGridCell
plugin={this}
title="something"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell>
<RemixUIGridCell
plugin={this}
title="1"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell> <RemixUIGridCell
plugin={this}
title="1"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell>
<RemixUIGridCell
plugin={this}
title="1"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell> <RemixUIGridCell
plugin={this}
title="1"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell>
<RemixUIGridCell
plugin={this}
title="1"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell>
<RemixUIGridCell
plugin={this}
title="1"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell>
<RemixUIGridCell
plugin={this}
title="1"
>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{height: '70px', width: '70px'}} alt=""></img>
<img src={'/assets/img/soliditySurvey2023.webp'} style={{ height: '70px', width: '70px' }} alt=""></img>
</RemixUIGridCell>
</RemixUIGridSection>
</RemixUIGridView>

@ -1,13 +1,13 @@
/* eslint-disable no-unused-vars */
import React, {useRef, useState, useEffect} from 'react' // eslint-disable-line
import {FormattedMessage} from 'react-intl'
import {WebsocketPlugin} from '@remixproject/engine-web'
import { FormattedMessage } from 'react-intl'
import { WebsocketPlugin } from '@remixproject/engine-web'
import * as packageJson from '../../../../../package.json'
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
import {version as remixdVersion} from '../../../../../libs/remixd/package.json'
import {PluginManager} from '@remixproject/engine'
import {AppModal, AlertModal, appPlatformTypes} from '@remix-ui/app'
import {Registry} from '@remix-project/remix-lib'
import { version as remixdVersion } from '../../../../../libs/remixd/package.json'
import { PluginManager } from '@remixproject/engine'
import { AppModal, AlertModal, appPlatformTypes } from '@remix-ui/app'
import { Registry } from '@remix-project/remix-lib'
const LOCALHOST = ' - connect to localhost - '
@ -85,7 +85,7 @@ export class RemixdHandle extends WebsocketPlugin {
console.log(error)
const alert: AlertModal = {
id: 'connectionAlert',
message: window._intl.formatMessage({id: 'remixd.connectionAlert1'}),
message: window._intl.formatMessage({ id: 'remixd.connectionAlert1' }),
}
this.call('notification', 'alert', alert)
this.canceled()
@ -96,14 +96,14 @@ export class RemixdHandle extends WebsocketPlugin {
clearInterval(intervalId)
const alert: AlertModal = {
id: 'connectionAlert',
message: window._intl.formatMessage({id: 'remixd.connectionAlert2'}),
message: window._intl.formatMessage({ id: 'remixd.connectionAlert2' }),
}
this.call('notification', 'alert', alert)
this.canceled()
}
}, 3000)
this.localhostProvider.init(() => {
this.call('filePanel', 'setWorkspace', {name: LOCALHOST, isLocalhost: true}, true)
this.call('filePanel', 'setWorkspace', { name: LOCALHOST, isLocalhost: true }, true)
})
for (const plugin of this.dependentPlugins) {
await this.appManager.activatePlugin(plugin)
@ -116,10 +116,10 @@ export class RemixdHandle extends WebsocketPlugin {
// warn the user only if he/she is in the browser context
const mod: AppModal = {
id: 'remixdConnect',
title: window._intl.formatMessage({id: 'remixd.remixdConnect'}),
title: window._intl.formatMessage({ id: 'remixd.remixdConnect' }),
message: remixdDialog(),
okLabel: window._intl.formatMessage({id: 'remixd.connect'}),
cancelLabel: window._intl.formatMessage({id: 'remixd.cancel'}),
okLabel: window._intl.formatMessage({ id: 'remixd.connect' }),
cancelLabel: window._intl.formatMessage({ id: 'remixd.cancel' }),
}
const result = await this.call('notification', 'modal', mod)
if (result) {

@ -1,11 +1,11 @@
import { Plugin } from '@remixproject/engine'
export type SuggestOptions = {
max_new_tokens: number,
max_new_tokens: number,
temperature: number,
do_sample:boolean
top_k: number,
top_p:number,
top_p:number,
stream_result:boolean
}
@ -41,18 +41,18 @@ export class SolCoder extends Plugin {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({"data":[prompt, "code_completion", "", false,1000,0.9,0.92,50]}),
body: JSON.stringify({ "data":[prompt, "code_completion", "", false,1000,0.9,0.92,50]}),
})
).json()
if ("error" in result){
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result.error })
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result.error })
return result
}
return result.data
} catch (e) {
this.call('terminal', 'log', { type: 'typewritererror', value: `Unable to get a response ${e.message}` })
return
}finally {
} finally {
this.emit("aiInferingDone")
}
}
@ -69,18 +69,18 @@ export class SolCoder extends Plugin {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({"data":[prompt, "solidity_answer", false,1000,0.9,0.8,50]}),
body: JSON.stringify({ "data":[prompt, "solidity_answer", false,1000,0.9,0.8,50]}),
})
).json()
} catch (e) {
this.call('terminal', 'log', { type: 'typewritererror', value: `Unable to get a response ${e.message}` })
return
}finally {
} finally {
this.emit("aiInferingDone")
}
if (result) {
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result.data[0]})
} else if (result.error) {
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result.data[0] })
} else if (result.error) {
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: "Error on request" })
}
@ -98,17 +98,17 @@ export class SolCoder extends Plugin {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({"data":[prompt, "code_explaining", false,2000,0.9,0.8,50, context]}),
body: JSON.stringify({ "data":[prompt, "code_explaining", false,2000,0.9,0.8,50, context]}),
})
).json()
if (result) {
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result.data[0]})
this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result.data[0] })
}
return result.data[0]
} catch (e) {
this.call('terminal', 'log', { type: 'typewritererror', value: `Unable to get a response ${e.message}` })
return
}finally {
} finally {
this.emit("aiInferingDone")
}
}
@ -124,14 +124,14 @@ export class SolCoder extends Plugin {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({"data": !options? [
prompt, // string in 'context_code' Textbox component
body: JSON.stringify({ "data": !options? [
prompt, // string in 'context_code' Textbox component
"code_completion",
"", // string in 'comment' Textbox component
false, // boolean in 'stream_result' Checkbox component
30, // number (numeric value between 0 and 2000) in 'max_new_tokens' Slider component
0.9, // number (numeric value between 0.01 and 1) in 'temperature' Slider component
0.90, // number (numeric value between 0 and 1) in 'top_p' Slider component
"", // string in 'comment' Textbox component
false, // boolean in 'stream_result' Checkbox component
30, // number (numeric value between 0 and 2000) in 'max_new_tokens' Slider component
0.9, // number (numeric value between 0.01 and 1) in 'temperature' Slider component
0.90, // number (numeric value between 0 and 1) in 'top_p' Slider component
50, // number (numeric value between 1 and 200) in 'top_k' Slider component
] : [
prompt,
@ -170,15 +170,15 @@ export class SolCoder extends Plugin {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({"data":[
body: JSON.stringify({ "data":[
msg_pfx, // Text before current cursor line
"code_insertion",
msg_sfx, // Text after current cursor line
1024,
1024,
0.5,
0.92,
50
] }),
]}),
})
).json()
@ -195,6 +195,4 @@ export class SolCoder extends Plugin {
}
}
}

@ -1,8 +1,8 @@
import React from 'react' // eslint-disable-line
import {format} from 'util'
import {Plugin} from '@remixproject/engine'
import {compile} from '@remix-project/remix-solidity'
import {Transaction} from 'web3-types'
import { format } from 'util'
import { Plugin } from '@remixproject/engine'
import { compile } from '@remix-project/remix-solidity'
import { Transaction } from 'web3-types'
const _paq = (window._paq = window._paq || []) //eslint-disable-line
const profile = {
@ -37,7 +37,7 @@ export class SolidityScript extends Plugin {
${functionName}();
}
}`
const targets = {'script.sol': {content}}
const targets = { 'script.sol': { content } }
// compile
const compilation = await compile(targets, params, async (url, cb) => {
@ -81,20 +81,20 @@ export class SolidityScript extends Plugin {
this.call('terminal', 'logHtml', e.message)
return
}
tx = {
from: accounts[0],
to: receipt.contractAddress,
data: '0x69d4394b' // function remixRun() public
}
let receiptCall
let receiptCall
try {
receiptCall = await web3.eth.sendTransaction(tx, null, { checkRevertBeforeSending: false, ignoreGasPricing: true })
} catch (e) {
this.call('terminal', 'logHtml', e.message)
return
}
}
const hhlogs = await web3.remix.getHHLogsForTx(receiptCall.transactionHash)

@ -1,17 +1,17 @@
/* eslint-disable @nrwl/nx/enforce-module-boundaries */
import {ViewPlugin} from '@remixproject/engine-web'
import { ViewPlugin } from '@remixproject/engine-web'
import React from 'react'
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
import {RemixUiSolidityUmlGen} from '@remix-ui/solidity-uml-gen'
import {ISolidityUmlGen, ThemeQualityType, ThemeSummary} from 'libs/remix-ui/solidity-uml-gen/src/types'
import {RemixAppManager} from 'libs/remix-ui/plugin-manager/src/types'
import {normalizeContractPath} from 'libs/remix-ui/solidity-compiler/src/lib/logic/flattenerUtilities'
import {convertAST2UmlClasses} from 'sol2uml/lib/converterAST2Classes'
import { RemixUiSolidityUmlGen } from '@remix-ui/solidity-uml-gen'
import { ISolidityUmlGen, ThemeQualityType, ThemeSummary } from 'libs/remix-ui/solidity-uml-gen/src/types'
import { RemixAppManager } from 'libs/remix-ui/plugin-manager/src/types'
import { normalizeContractPath } from 'libs/remix-ui/solidity-compiler/src/lib/logic/flattenerUtilities'
import { convertAST2UmlClasses } from 'sol2uml/lib/converterAST2Classes'
import vizRenderStringSync from '@aduh95/viz.js/sync'
import {PluginViewWrapper} from '@remix-ui/helper'
import {customAction} from '@remixproject/plugin-api'
import {ClassOptions} from 'sol2uml/lib/converterClass2Dot'
import type {CompilerInput} from '@remix-project/remix-solidity'
import { PluginViewWrapper } from '@remix-ui/helper'
import { customAction } from '@remixproject/plugin-api'
import { ClassOptions } from 'sol2uml/lib/converterClass2Dot'
import type { CompilerInput } from '@remix-project/remix-solidity'
const parser = (window as any).SolidityParser
const _paq = (window._paq = window._paq || [])
@ -207,10 +207,10 @@ interface Sol2umlClassOptions extends ClassOptions {
textColor?: string
}
import {dirname} from 'path'
import {convertClass2Dot} from 'sol2uml/lib/converterClass2Dot'
import {Association, ClassStereotype, ReferenceType, UmlClass} from 'sol2uml/lib/umlClass'
import {findAssociatedClass} from 'sol2uml/lib/associations'
import { dirname } from 'path'
import { convertClass2Dot } from 'sol2uml/lib/converterClass2Dot'
import { Association, ClassStereotype, ReferenceType, UmlClass } from 'sol2uml/lib/umlClass'
import { findAssociatedClass } from 'sol2uml/lib/associations'
// const debug = require('debug')('sol2uml')

@ -1,6 +1,6 @@
import React from 'react'
import { ViewPlugin } from '@remixproject/engine-web'
import {PluginViewWrapper} from '@remix-ui/helper'
import { PluginViewWrapper } from '@remix-ui/helper'
import { RemixAppManager } from '../../remixAppManager'
import { RemixUiVyperCompileDetails } from '@remix-ui/vyper-compile-details'
import { ThemeKeys, ThemeObject } from '@microlink/react-json-view'
@ -49,13 +49,13 @@ export class VyperCompilationDetailsPlugin extends ViewPlugin {
}
async showDetails(sentPayload: any) {
const contractName = Object.entries(sentPayload).find(([key, value]) => key )
const contractName = Object.entries(sentPayload).find(([key, value]) => key )
await this.call('tabs', 'focus', 'vyperCompilationDetails')
this.profile.displayName = `${contractName[0]}`
this.payload = sentPayload
const active = await this.call('theme', 'currentTheme')
if (active.quality === 'dark') {
switch(active.name) {
switch (active.name) {
case 'HackerOwl':
this.theme = 'harmonic'
this.themeStyle = { backgroundColor: active.backgroundColor }
@ -78,7 +78,7 @@ export class VyperCompilationDetailsPlugin extends ViewPlugin {
break
}
} else {
switch(active.name) {
switch (active.name) {
case 'Candy':
this.theme = 'apathy:inverted'
this.themeStyle = { backgroundColor: active.backgroundColor }
@ -106,7 +106,7 @@ export class VyperCompilationDetailsPlugin extends ViewPlugin {
private handleThemeChange() {
this.on('theme', 'themeChanged', (theme: any) => {
if (theme.quality === 'dark') {
switch(theme.name) {
switch (theme.name) {
case 'HackerOwl':
this.theme = 'solarized'
this.themeStyle = { backgroundColor: theme.backgroundColor }

@ -1,7 +1,7 @@
import {Plugin} from '@remixproject/engine'
import {AppModal, AlertModal, ModalTypes} from '@remix-ui/app'
import {Blockchain} from '../../blockchain/blockchain'
import {ethers} from 'ethers'
import { Plugin } from '@remixproject/engine'
import { AppModal, AlertModal, ModalTypes } from '@remix-ui/app'
import { Blockchain } from '../../blockchain/blockchain'
import { ethers } from 'ethers'
export type JsonDataRequest = {
id: number
@ -66,7 +66,7 @@ export abstract class AbstractProvider extends Plugin implements IProvider {
okLabel: 'OK',
cancelLabel: 'Cancel',
validationFn: (value) => {
if (!value) return {valid: false, message: 'value is empty'}
if (!value) return { valid: false, message: 'value is empty' }
if (value.startsWith('https://') || value.startsWith('http://')) {
return {
valid: true,
@ -102,7 +102,7 @@ export abstract class AbstractProvider extends Plugin implements IProvider {
sendAsync(data: JsonDataRequest): Promise<JsonDataResult> {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
if (!this.provider) return reject({jsonrpc: '2.0', id: data.id, error: { message: 'provider node set', code: -32603 } } as JsonDataResult)
if (!this.provider) return reject({ jsonrpc: '2.0', id: data.id, error: { message: 'provider node set', code: -32603 } } as JsonDataResult)
this.sendAsyncInternal(data, resolve, reject)
})
}
@ -119,7 +119,7 @@ export abstract class AbstractProvider extends Plugin implements IProvider {
}
this.call('notification', 'alert', modalContent)
}
await this.call('udapp', 'setEnvironmentMode', {context: 'vm-cancun'})
await this.call('udapp', 'setEnvironmentMode', { context: 'vm-cancun' })
return
}
@ -127,17 +127,17 @@ export abstract class AbstractProvider extends Plugin implements IProvider {
if (this.provider) {
try {
const result = await this.provider.send(data.method, data.params)
resolve({jsonrpc: '2.0', result, id: data.id})
resolve({ jsonrpc: '2.0', result, id: data.id })
} catch (error) {
if (error && error.message && error.message.includes('net_version') && error.message.includes('SERVER_ERROR')) {
this.switchAway(true)
}
error.code = -32603
reject({jsonrpc: '2.0', error, id: data.id})
reject({ jsonrpc: '2.0', error, id: data.id })
}
} else {
const result = data.method === 'net_listening' ? 'canceled' : []
resolve({jsonrpc: '2.0', result: result, id: data.id})
resolve({ jsonrpc: '2.0', result: result, id: data.id })
}
}
}

@ -1,9 +1,9 @@
import React, {useRef} from 'react' // eslint-disable-line
import {FormattedMessage} from 'react-intl'
import { FormattedMessage } from 'react-intl'
import * as packageJson from '../../../../../package.json'
import {AppModal, ModalTypes} from '@remix-ui/app'
import {BasicVMProvider} from './vm-provider'
import {Hardfork} from '@ethereumjs/common'
import { AppModal, ModalTypes } from '@remix-ui/app'
import { BasicVMProvider } from './vm-provider'
import { Hardfork } from '@ethereumjs/common'
export class CustomForkVMProvider extends BasicVMProvider {
nodeUrl: string

@ -1,7 +1,7 @@
import * as packageJson from '../../../../../package.json'
import React from 'react' // eslint-disable-line
import {FormattedMessage} from 'react-intl'
import {AbstractProvider} from './abstract-provider'
import { FormattedMessage } from 'react-intl'
import { AbstractProvider } from './abstract-provider'
const profile = {
name: 'basic-http-provider',
@ -49,7 +49,7 @@ export class ExternalHttpProvider extends AbstractProvider {
</div>
<br />
<br />
<FormattedMessage id="udapp.externalHttpProviderText3" values={{b: (chunks) => <b><>{chunks}</></b>}} />
<FormattedMessage id="udapp.externalHttpProviderText3" values={{ b: (chunks) => <b><>{chunks}</></b> }} />
<br />
<br />
<FormattedMessage

@ -1,7 +1,7 @@
import * as packageJson from '../../../../../package.json'
import React from 'react' // eslint-disable-line
import {FormattedMessage} from 'react-intl'
import {AbstractProvider} from './abstract-provider'
import { FormattedMessage } from 'react-intl'
import { AbstractProvider } from './abstract-provider'
const profile = {
name: 'foundry-provider',

@ -1,7 +1,7 @@
import * as packageJson from '../../../../../package.json'
import React from 'react' // eslint-disable-line
import {FormattedMessage} from 'react-intl'
import {AbstractProvider} from './abstract-provider'
import { FormattedMessage } from 'react-intl'
import { AbstractProvider } from './abstract-provider'
const profile = {
name: 'ganache-provider',

@ -1,5 +1,5 @@
import * as packageJson from '../../../../../package.json'
import {BasicVMProvider} from './vm-provider'
import { BasicVMProvider } from './vm-provider'
export class GoerliForkVMProvider extends BasicVMProvider {
nodeUrl: string

@ -1,7 +1,7 @@
import * as packageJson from '../../../../../package.json'
import React from 'react' // eslint-disable-line
import {FormattedMessage} from 'react-intl'
import {AbstractProvider} from './abstract-provider'
import { FormattedMessage } from 'react-intl'
import { AbstractProvider } from './abstract-provider'
const profile = {
name: 'hardhat-provider',

@ -1,5 +1,5 @@
import * as packageJson from '../../../../../package.json'
import {InjectedCustomProvider} from './injected-custom-provider'
import { InjectedCustomProvider } from './injected-custom-provider'
const profile = {
name: 'injected-arbitrum-one-provider',

@ -1,5 +1,5 @@
import Web3 from 'web3'
import {InjectedProviderDefault} from './injected-provider-default'
import { InjectedProviderDefault } from './injected-provider-default'
export class InjectedCustomProvider extends InjectedProviderDefault {
chainName: string
@ -32,7 +32,7 @@ export const setCustomNetwork = async (chainName: string, chainId: string, rpcUr
try {
await (window as any).ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{chainId: chainId}]
params: [{ chainId: chainId }]
})
} catch (switchError) {
// This error code indicates that the chain has not been added to MetaMask.
@ -48,14 +48,14 @@ export const setCustomNetwork = async (chainName: string, chainId: string, rpcUr
if (blockExplorerUrls) paramsObj.blockExplorerUrls = blockExplorerUrls
await (window as any).ethereum.request({
method: 'wallet_addEthereumChain',
params: [ paramsObj ]
params: [paramsObj]
})
await (window as any).ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{chainId: chainId}]
params: [{ chainId: chainId }]
})
}
}
} catch (addError) {
// handle "add" error
}

@ -1,5 +1,5 @@
import * as packageJson from '../../../../../package.json'
import {InjectedCustomProvider} from './injected-custom-provider'
import { InjectedCustomProvider } from './injected-custom-provider'
import Web3 from 'web3'
const profile = {
@ -13,7 +13,7 @@ const profile = {
export class InjectedEphemeryTestnetProvider extends InjectedCustomProvider {
constructor() {
super(profile,
super(profile,
'Ephemery Testnet',
'',
['https://otter.bordel.wtf/erigon', 'https://eth.ephemeral.zeus.fyi'],
@ -25,7 +25,7 @@ export class InjectedEphemeryTestnetProvider extends InjectedCustomProvider {
[
'https://otter.bordel.wtf/',
'https://explorer.ephemery.dev/'
]
]
)
}

@ -1,5 +1,5 @@
import * as packageJson from '../../../../../package.json'
import {InjectedCustomProvider} from './injected-custom-provider'
import { InjectedCustomProvider } from './injected-custom-provider'
const profile = {
name: 'injected-optimism-provider',

@ -1,6 +1,6 @@
/* global ethereum */
import * as packageJson from '../../../../../package.json'
import {InjectedProvider} from './injected-provider'
import { InjectedProvider } from './injected-provider'
export class InjectedProviderDefaultBase extends InjectedProvider {
constructor(profile) {
@ -34,7 +34,7 @@ const profile = {
}
export class InjectedProviderDefault extends InjectedProviderDefaultBase {
provider: any
provider: any
constructor(provider: any, name: string) {
super({ ...profile, ...{ name, displayName: name } })
this.provider = provider

@ -1,6 +1,6 @@
/* global ethereum */
import * as packageJson from '../../../../../package.json'
import {InjectedProvider} from './injected-provider'
import { InjectedProvider } from './injected-provider'
const profile = {
name: 'injected-trustwallet',

@ -1,8 +1,8 @@
/* global ethereum */
import React from 'react' // eslint-disable-line
import {Plugin} from '@remixproject/engine'
import {JsonDataRequest, RejectRequest, SuccessRequest} from '../providers/abstract-provider'
import {IProvider} from './abstract-provider'
import { Plugin } from '@remixproject/engine'
import { JsonDataRequest, RejectRequest, SuccessRequest } from '../providers/abstract-provider'
import { IProvider } from './abstract-provider'
export abstract class InjectedProvider extends Plugin implements IProvider {
options: {[id: string]: any} = {}
@ -45,7 +45,7 @@ export abstract class InjectedProvider extends Plugin implements IProvider {
askPermission(throwIfNoInjectedProvider) {
const web3Provider = this.getInjectedProvider()
if (typeof web3Provider !== 'undefined' && typeof web3Provider.request === 'function') {
web3Provider.request({method: 'eth_requestAccounts'})
web3Provider.request({ method: 'eth_requestAccounts' })
} else if (throwIfNoInjectedProvider) {
throw new Error(this.notFound())
}
@ -86,19 +86,19 @@ export abstract class InjectedProvider extends Plugin implements IProvider {
}
try {
let resultData
if (web3Provider.request) resultData = await web3Provider.request({method: data.method, params: data.params})
if (web3Provider.request) resultData = await web3Provider.request({ method: data.method, params: data.params })
else if (web3Provider.send) resultData = await web3Provider.send(data.method, data.params)
else {
resolve({jsonrpc: '2.0', error: { message: 'provider not valid', code: -32603 }, id: data.id})
resolve({ jsonrpc: '2.0', error: { message: 'provider not valid', code: -32603 }, id: data.id })
return
}
if (resultData) {
if (resultData.jsonrpc && resultData.jsonrpc === '2.0') {
resultData = resultData.result
}
resolve({jsonrpc: '2.0', result: resultData, id: data.id})
resolve({ jsonrpc: '2.0', result: resultData, id: data.id })
} else {
resolve({jsonrpc: '2.0', result: null, id: data.id})
resolve({ jsonrpc: '2.0', result: null, id: data.id })
}
} catch (error) {
if (error.data && error.data.originalError && error.data.originalError.data) {

@ -13,9 +13,9 @@ const profile = {
export class InjectedSKALEChaosTestnetProvider extends InjectedCustomProvider {
constructor () {
super(profile,
'SKALE Chaos Testnet',
'0x50877ed6',
super(profile,
'SKALE Chaos Testnet',
'0x50877ed6',
['https://staging-v3.skalenodes.com/v1/staging-fast-active-bellatrix'],
{
"name": "sFUEL",

@ -1,5 +1,5 @@
import * as packageJson from '../../../../../package.json'
import {BasicVMProvider} from './vm-provider'
import { BasicVMProvider } from './vm-provider'
export class MainnetForkVMProvider extends BasicVMProvider {
nodeUrl: string

@ -1,5 +1,5 @@
import * as packageJson from '../../../../../package.json'
import {BasicVMProvider} from './vm-provider'
import { BasicVMProvider } from './vm-provider'
export class SepoliaForkVMProvider extends BasicVMProvider {
nodeUrl: string

@ -1,8 +1,8 @@
import React from 'react' // eslint-disable-line
import * as packageJson from '../../../../../package.json'
import {JsonDataRequest, RejectRequest, SuccessRequest} from '../providers/abstract-provider'
import {Plugin} from '@remixproject/engine'
import {IProvider} from './abstract-provider'
import { JsonDataRequest, RejectRequest, SuccessRequest } from '../providers/abstract-provider'
import { Plugin } from '@remixproject/engine'
import { IProvider } from './abstract-provider'
export class BasicVMProvider extends Plugin implements IProvider {
blockchain
@ -33,7 +33,7 @@ export class BasicVMProvider extends Plugin implements IProvider {
await this.blockchain.providers.vm.provider.sendAsync(data, (error, result) => {
if (error) return reject(error)
else {
resolve({jsonrpc: '2.0', result, id: data.id})
resolve({ jsonrpc: '2.0', result, id: data.id })
}
})
} catch (error) {

@ -26,7 +26,7 @@ export class CompileAndRun extends Plugin {
super(profile)
this.executionListener = async (e) => {
// ctrl+e or command+e
if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.keyCode === 83) {
const file = await this.call('fileManager', 'file')
if (file) {
@ -51,7 +51,7 @@ export class CompileAndRun extends Plugin {
}
async runScript (fileName, clearAllInstances) {
await this.call('terminal', 'log', { value: `running ${fileName} ...`, type: 'info' })
await this.call('terminal', 'log', { value: `running ${fileName} ...`, type: 'info' })
try {
const exists = await this.call('fileManager', 'exists', fileName)
if (!exists) {
@ -65,7 +65,7 @@ export class CompileAndRun extends Plugin {
await this.call('scriptRunner', 'execute', content, fileName)
} catch (e) {
this.call('notification', 'toast', e.message || e)
}
}
}
onActivation () {

@ -1,7 +1,7 @@
import {ViewPlugin} from '@remixproject/engine-web'
import { ViewPlugin } from '@remixproject/engine-web'
import * as packageJson from '../../../../../package.json'
import React from 'react' // eslint-disable-line
import {SearchTab} from '@remix-ui/search'
import { SearchTab } from '@remix-ui/search'
const profile = {
name: 'search',
displayName: 'Search in files',

@ -1,10 +1,10 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import React from 'react' // eslint-disable-line
import {ViewPlugin} from '@remixproject/engine-web'
import { ViewPlugin } from '@remixproject/engine-web'
import * as packageJson from '../../../../../package.json'
import {RemixUiSettings} from '@remix-ui/settings' //eslint-disable-line
import {Registry} from '@remix-project/remix-lib'
import {PluginViewWrapper} from '@remix-ui/helper'
import { Registry } from '@remix-project/remix-lib'
import { PluginViewWrapper } from '@remix-ui/helper'
declare global {
interface Window {
_paq: any
@ -62,7 +62,7 @@ module.exports = class SettingsTab extends ViewPlugin {
onActivation(): void {
}
render() {
return (
<div id="settingsTab">

@ -1,20 +1,20 @@
import React from 'react' // eslint-disable-line
import {fromWei, toBigInt, toWei} from 'web3-utils'
import {Plugin} from '@remixproject/engine'
import {toBytes, addHexPrefix} from '@ethereumjs/util'
import {EventEmitter} from 'events'
import {format} from 'util'
import {ExecutionContext} from './execution-context'
import { fromWei, toBigInt, toWei } from 'web3-utils'
import { Plugin } from '@remixproject/engine'
import { toBytes, addHexPrefix } from '@ethereumjs/util'
import { EventEmitter } from 'events'
import { format } from 'util'
import { ExecutionContext } from './execution-context'
import Config from '../config'
import {VMProvider} from './providers/vm'
import {InjectedProvider} from './providers/injected'
import {NodeProvider} from './providers/node'
import {execution, EventManager, helpers} from '@remix-project/remix-lib'
import {etherScanLink} from './helper'
import {logBuilder, cancelUpgradeMsg, cancelProxyMsg, addressToString} from '@remix-ui/helper'
const {txFormat, txExecution, typeConversion, txListener: Txlistener, TxRunner, TxRunnerWeb3, txHelper} = execution
const {txResultHelper} = helpers
const {resultToRemixTx} = txResultHelper
import { VMProvider } from './providers/vm'
import { InjectedProvider } from './providers/injected'
import { NodeProvider } from './providers/node'
import { execution, EventManager, helpers } from '@remix-project/remix-lib'
import { etherScanLink } from './helper'
import { logBuilder, cancelUpgradeMsg, cancelProxyMsg, addressToString } from '@remix-ui/helper'
const { txFormat, txExecution, typeConversion, txListener: Txlistener, TxRunner, TxRunnerWeb3, txHelper } = execution
const { txResultHelper } = helpers
const { resultToRemixTx } = txResultHelper
import * as packageJson from '../../../../package.json'
const _paq = (window._paq = window._paq || []) //eslint-disable-line
@ -91,7 +91,7 @@ export class Blockchain extends Plugin {
this.txRunner = new TxRunner(web3Runner, {})
this.networkcallid = 0
this.networkStatus = {network: {name: ' - ', id: ' - '}}
this.networkStatus = { network: { name: ' - ', id: ' - ' } }
this.registeredPluginEvents = []
this.setupEvents()
this.setupProviders()
@ -110,7 +110,7 @@ export class Blockchain extends Plugin {
this.registeredPluginEvents.push(plugin.name)
this.on(plugin.name, 'chainChanged', () => {
this.detectNetwork((error, network) => {
this.networkStatus = {network, error}
this.networkStatus = { network, error }
this._triggerEvent('networkStatus', [this.networkStatus])
})
})
@ -131,7 +131,7 @@ export class Blockchain extends Plugin {
await this.loadContext(context)
this._triggerEvent('contextChanged', [context])
this.detectNetwork((error, network) => {
this.networkStatus = {network, error}
this.networkStatus = { network, error }
this._triggerEvent('networkStatus', [this.networkStatus])
})
})
@ -146,7 +146,7 @@ export class Blockchain extends Plugin {
setInterval(() => {
this.detectNetwork((error, network) => {
this.networkStatus = {network, error}
this.networkStatus = { network, error }
this._triggerEvent('networkStatus', [this.networkStatus])
})
}, 30000)
@ -189,7 +189,7 @@ export class Blockchain extends Plugin {
}
deployContractAndLibraries(selectedContract, args, contractMetadata, compilerContracts, callbacks, confirmationCb) {
const {continueCb, promptCb, statusCb, finalCb} = callbacks
const { continueCb, promptCb, statusCb, finalCb } = callbacks
const constructor = selectedContract.getConstructorInterface()
txFormat.buildData(
selectedContract.name,
@ -215,7 +215,7 @@ export class Blockchain extends Plugin {
}
deployContractWithLibrary(selectedContract, args, contractMetadata, compilerContracts, callbacks, confirmationCb) {
const {continueCb, promptCb, statusCb, finalCb} = callbacks
const { continueCb, promptCb, statusCb, finalCb } = callbacks
const constructor = selectedContract.getConstructorInterface()
txFormat.encodeConstructorCallAndLinkLibraries(
selectedContract.object,
@ -257,7 +257,7 @@ export class Blockchain extends Plugin {
}
async runProxyTx(proxyData, implementationContractObject) {
const args = {useCall: false, data: proxyData}
const args = { useCall: false, data: proxyData }
let networkInfo
const confirmationCb = (network, tx, gasEstimation, continueTxExecution, cancelCb) => {
networkInfo = network
@ -308,7 +308,7 @@ export class Blockchain extends Plugin {
}
async runUpgradeTx(proxyAddress, data, newImplementationContractObject) {
const args = {useCall: false, data, to: proxyAddress}
const args = { useCall: false, data, to: proxyAddress }
let networkInfo
const confirmationCb = (network, tx, gasEstimation, continueTxExecution, cancelCb) => {
// continue using original authorization given by user
@ -336,7 +336,7 @@ export class Blockchain extends Plugin {
}
async saveDeployedContractStorageLayout(contractObject, proxyAddress, networkInfo) {
const {contractName, implementationAddress} = contractObject
const { contractName, implementationAddress } = contractObject
const networkName = networkInfo.name === 'custom' ? networkInfo.name + '-' + networkInfo.id : networkInfo.name
const hasPreviousDeploys = await this.call('fileManager', 'exists', `.deploys/upgradeable-contracts/${networkName}/UUPS.json`)
// TODO: make deploys folder read only.
@ -436,7 +436,7 @@ export class Blockchain extends Plugin {
data.contractABI = selectedContract.abi
}
this.runTx({data: data, useCall: false}, confirmationCb, continueCb, promptCb, (error, txResult, address) => {
this.runTx({ data: data, useCall: false }, confirmationCb, continueCb, promptCb, (error, txResult, address) => {
if (error) {
return finalCb(`creation of ${selectedContract.name} errored: ${error.message ? error.message : error}`)
}
@ -578,7 +578,7 @@ export class Blockchain extends Plugin {
data.contract = contract
}
const useCall = funABI.stateMutability === 'view' || funABI.stateMutability === 'pure'
this.runTx({to: address, data, useCall}, confirmationCb, continueCb, promptCb, (error, txResult, _address, returnValue) => {
this.runTx({ to: address, data, useCall }, confirmationCb, continueCb, promptCb, (error, txResult, _address, returnValue) => {
if (error) {
return logCallback(`${logMsg} errored: ${error.message ? error.message : error}`)
}
@ -629,13 +629,13 @@ export class Blockchain extends Plugin {
async loadContext(context: string) {
const saveEvmState = this.config.get('settings/save-evm-state')
if (saveEvmState) {
const contextExists = await this.call('fileManager', 'exists', `.states/${context}/state.json`)
if (contextExists) {
const stateDb = await this.call('fileManager', 'readFile', `.states/${context}/state.json`)
await this.getCurrentProvider().resetEnvironment(stateDb)
} else {
await this.getCurrentProvider().resetEnvironment()
@ -676,7 +676,7 @@ export class Blockchain extends Plugin {
view on etherscan
</a>
)
}
}
})
})
this.txRunner = new TxRunner(web3Runner, {})
@ -866,7 +866,7 @@ export class Blockchain extends Plugin {
const eventName = tx.useCall ? 'callExecuted' : 'transactionExecuted'
this._triggerEvent(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad])
return resolve({result, tx})
return resolve({ result, tx })
})
} catch (err) {
return reject(err)
@ -894,7 +894,7 @@ export class Blockchain extends Plugin {
this.call('fileManager', 'writeFile', `.states/${this.executionContext.getProvider()}/state.json`, state)
} catch (e) {
console.error(e)
}
}
}
const hhlogs = await this.web3().remix.getHHLogsForTx(txResult.transactionHash)
@ -923,7 +923,7 @@ export class Blockchain extends Plugin {
this.call('terminal', 'logHtml', finalLogs)
}
execResult = await this.web3().remix.getExecutionResultFromSimulator(txResult.transactionHash)
if (execResult) {
// if it's not the VM, we don't have return value. We only have the transaction, and it does not contain the return value.
returnValue = execResult
@ -959,9 +959,9 @@ export class Blockchain extends Plugin {
cb((await buildError(errorMessage, errorData)).message)
} else if (error.message || error.data) {
errorMessage = error.message
errorData = error.data
errorData = error.data
cb((await buildError(errorMessage, errorData)).message)
} else
} else
cb(error)
}
}

@ -6,7 +6,7 @@ const transactionDetailsLinks = {
Goerli: 'https://goerli.etherscan.io/tx/',
Sepolia: 'https://sepolia.etherscan.io/tx/'
}
export function etherScanLink (network: string, hash: string): string {
if (transactionDetailsLinks[network]) {
return transactionDetailsLinks[network] + hash

@ -46,7 +46,7 @@ export class VMProvider {
stamps[msg.data.stamp].reject(msg.data.error)
} else {
stamps[msg.data.stamp].resolve(msg.data.result)
}
}
} else if (msg.data.cmd === 'initiateResult') {
if (!msg.data.error) {
this.provider = {
@ -55,7 +55,7 @@ export class VMProvider {
const stamp = Date.now() + incr
incr++
stamps[stamp] = { callback, resolve, reject }
this.worker.postMessage({ cmd: 'sendAsync', query, stamp })
this.worker.postMessage({ cmd: 'sendAsync', query, stamp })
})
}
}
@ -102,7 +102,6 @@ export class VMProvider {
})
}
// TODO: is still here because of the plugin API
// can be removed later when we update the API
createVMAccount (newAccount) {
@ -134,5 +133,5 @@ export class VMProvider {
this.web3.eth.sign(message, account)
.then(signedData => cb(null, bytesToHex(messageHash), signedData))
.catch(error => cb(error))
}
}
}

@ -4,9 +4,9 @@ let provider: Provider = null
self.onmessage = (e: MessageEvent) => {
const data = e.data
switch (data.cmd) {
case 'init':
case 'init':
{
provider = new Provider({ fork: data.fork, nodeUrl: data.nodeUrl, blockNumber: data.blockNumber, stateDb: data.stateDb, blocks: data.blocks})
provider = new Provider({ fork: data.fork, nodeUrl: data.nodeUrl, blockNumber: data.blockNumber, stateDb: data.stateDb, blocks: data.blocks })
provider.init().then(() => {
self.postMessage({
cmd: 'initiateResult',
@ -40,7 +40,7 @@ self.onmessage = (e: MessageEvent) => {
stamp: data.stamp
})
}
break
}
case 'addAccount':
@ -48,7 +48,7 @@ self.onmessage = (e: MessageEvent) => {
if (provider) {
provider.Accounts._addAccount(data.privateKey, data.balance)
}
break
}
case 'newAccount':
@ -67,11 +67,11 @@ self.onmessage = (e: MessageEvent) => {
result: address,
stamp: data.stamp
})
}
}
})
}
break
}
}
}
}

@ -1,11 +1,11 @@
// eslint-disable-next-line no-use-before-define
import React from 'react'
import './index.css'
import {ThemeModule} from './app/tabs/theme-module'
import {Preload} from './app/components/preload'
import { ThemeModule } from './app/tabs/theme-module'
import { Preload } from './app/components/preload'
import Config from './config'
import {Registry} from '@remix-project/remix-lib'
import {Storage} from '@remix-project/remix-lib'
import { Registry } from '@remix-project/remix-lib'
import { Storage } from '@remix-project/remix-lib'
import { createRoot } from 'react-dom/client'
@ -13,14 +13,14 @@ import { createRoot } from 'react-dom/client'
try {
const configStorage = new Storage('config-v0.8:')
const config = new Config(configStorage)
Registry.getInstance().put({api: config, name: 'config'})
Registry.getInstance().put({ api: config, name: 'config' })
} catch (e) {}
const theme = new ThemeModule()
theme.initTheme()
const container = document.getElementById('root');
const root = createRoot(container)
if (container) {
if (container) {
root.render(<Preload root={root} />);
}
}
})()

@ -76,7 +76,8 @@ let requiredModules = [ // services + layout views + system views
'home',
'doc-viewer',
'doc-gen',
'remix-templates'
'remix-templates',
'solhint'
]

@ -0,0 +1,18 @@
{
"extends": "../../.eslintrc.json",
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"off"
]
}
}
]
}

@ -47,6 +47,14 @@
"parallel": false
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/solhint/**/*.ts"],
"eslintConfig": "apps/solhint/.eslintrc"
}
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"defaultConfiguration": "development",

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save