This feature is still in Alpha. We recommend to keep a backup of the shared folder.
diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js
index 8e3d17e366..23a53846f7 100644
--- a/apps/remix-ide/src/app/tabs/compile-tab.js
+++ b/apps/remix-ide/src/app/tabs/compile-tab.js
@@ -56,6 +56,10 @@ class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerA
this.renderComponent()
}
+ onFileRemoved () {
+ this.renderComponent()
+ }
+
onNoFileSelected () {
this.renderComponent()
}
diff --git a/apps/remix-ide/src/app/tabs/foundry-provider.tsx b/apps/remix-ide/src/app/tabs/foundry-provider.tsx
new file mode 100644
index 0000000000..47e899865a
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/foundry-provider.tsx
@@ -0,0 +1,33 @@
+import * as packageJson from '../../../../../package.json'
+import { Plugin } from '@remixproject/engine'
+import { AppModal, AlertModal, ModalTypes } from '@remix-ui/app'
+import React from 'react' // eslint-disable-line
+import { Blockchain } from '../../blockchain/blockchain'
+import { ethers } from 'ethers'
+import { AbstractProvider } from './abstract-provider'
+
+const profile = {
+ name: 'foundry-provider',
+ displayName: 'Foundry Provider',
+ kind: 'provider',
+ description: 'Anvil',
+ methods: ['sendAsync'],
+ version: packageJson.version
+}
+
+export class FoundryProvider extends AbstractProvider {
+ constructor (blockchain) {
+ super(profile, blockchain, 'http://127.0.0.1:8545')
+ }
+
+ body (): JSX.Element {
+ return (
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/apps/remix-ide/src/app/tabs/ganache-provider.tsx b/apps/remix-ide/src/app/tabs/ganache-provider.tsx
index b73cb18786..002e31a3a2 100644
--- a/apps/remix-ide/src/app/tabs/ganache-provider.tsx
+++ b/apps/remix-ide/src/app/tabs/ganache-provider.tsx
@@ -23,7 +23,7 @@ export class GanacheProvider extends AbstractProvider {
body (): JSX.Element {
return (
Note: To run Ganache on your system, run
-
npm install -g ganache
+
yarn global add ganache
ganache
For more info, visit:
Ganache Documentation
Ganache JSON-RPC Endpoint:
diff --git a/apps/remix-ide/src/app/udapp/run-tab.js b/apps/remix-ide/src/app/udapp/run-tab.js
index 0f59ddd962..020c2a34df 100644
--- a/apps/remix-ide/src/app/udapp/run-tab.js
+++ b/apps/remix-ide/src/app/udapp/run-tab.js
@@ -127,6 +127,20 @@ export class RunTab extends ViewPlugin {
}
})
+ await this.call('blockchain', 'addProvider', {
+ name: 'Foundry Provider',
+ provider: {
+ async sendAsync (payload, callback) {
+ try {
+ const result = await udapp.call('foundry-provider', 'sendAsync', payload)
+ callback(null, result)
+ } catch (e) {
+ callback(e)
+ }
+ }
+ }
+ })
+
await this.call('blockchain', 'addProvider', {
name: 'Wallet Connect',
provider: {
diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js
index 96d79aba39..bf8c5dccd3 100644
--- a/apps/remix-ide/src/remixAppManager.js
+++ b/apps/remix-ide/src/remixAppManager.js
@@ -7,7 +7,7 @@ const _paq = window._paq = window._paq || []
const requiredModules = [ // services + layout views + system views
'manager', 'config', 'compilerArtefacts', 'compilerMetadata', 'contextualListener', 'editor', 'offsetToLineColumnConverter', 'network', 'theme',
'fileManager', 'contentImport', 'blockchain', 'web3Provider', 'scriptRunner', 'fetchAndCompile', 'mainPanel', 'hiddenPanel', 'sidePanel', 'menuicons',
- 'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp', 'dGitProvider', 'solidity-logic', 'gistHandler', 'layout',
+ 'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp', 'dGitProvider', 'solidity', 'solidity-logic', 'gistHandler', 'layout',
'notification', 'permissionhandler', 'walkthrough', 'storage', 'restorebackupzip', 'link-libraries', 'deploy-libraries', 'openzeppelin-proxy', 'hardhat-provider', 'compileAndRun', 'search']
const dependentModules = ['git', 'hardhat', 'truffle', 'slither'] // module which shouldn't be manually activated (e.g git is activated by remixd)
@@ -19,7 +19,7 @@ const sensitiveCalls = {
}
export function isNative(name) {
- const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity', 'hardhat-provider', 'solidityStaticAnalysis', 'solidityUnitTesting', 'layout', 'notification', 'hardhat-provider', 'ganache-provider']
+ const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity', 'solidity-logic', 'solidityStaticAnalysis', 'solidityUnitTesting', 'layout', 'notification', 'hardhat-provider', 'ganache-provider']
return nativePlugins.includes(name) || requiredModules.includes(name)
}
diff --git a/apps/remix-ide/team-best-practices.md b/apps/remix-ide/team-best-practices.md
index 3832c3be95..5a246096e7 100644
--- a/apps/remix-ide/team-best-practices.md
+++ b/apps/remix-ide/team-best-practices.md
@@ -54,7 +54,7 @@ Related links:
- How the backend (if any) works / will work (could be a smart contract).
- How the frontend works / will work.
- What is the general vision of the UX design for this particular story.
- Later progress and discussion is updated directly on the issue or pull request (Github).
+ Later progress and discussion is updated directly on the issue or pull request (GitHub).
---
@@ -72,7 +72,7 @@ Before starting coding, we should ensure all devs / contributors are aware of:
# Story / Bug fix
-- Prioritised list of PRs / issues are tracked in a Github Project, Remix IDE issues are managed by a prioritized backlog.
+- Prioritised list of PRs / issues are tracked in a GitHub Project, Remix IDE issues are managed by a prioritized backlog.
- Every story can be executed by a single developer or a group of 2 or more developers (depending on the size and complexity)
- Each dev should take the part he/she feels the most confortable with.
- Later progress and discussion is updated directly on the issue or pull request (github).
diff --git a/apps/solidity-compiler/src/app/compiler-api.ts b/apps/solidity-compiler/src/app/compiler-api.ts
index ade46d3223..3065af630a 100644
--- a/apps/solidity-compiler/src/app/compiler-api.ts
+++ b/apps/solidity-compiler/src/app/compiler-api.ts
@@ -18,7 +18,8 @@ export const CompilerApiMixin = (Base) => class extends Base {
onCurrentFileChanged: (fileName: string) => void
// onResetResults: () => void
- onSetWorkspace: (workspace: any) => void
+ onSetWorkspace: (isLocalhost: boolean, workspaceName: string) => void
+ onFileRemoved: (path: string) => void
onNoFileSelected: () => void
onCompilationFinished: (compilationDetails: { contractMap: { file: string } | Record
, contractsDetails: Record }) => void
onSessionSwitched: () => void
@@ -237,12 +238,16 @@ export const CompilerApiMixin = (Base) => class extends Base {
this.on('filePanel', 'setWorkspace', (workspace) => {
this.resetResults()
- if (this.onSetWorkspace) this.onSetWorkspace(workspace.isLocalhost)
+ if (this.onSetWorkspace) this.onSetWorkspace(workspace.isLocalhost, workspace.name)
+ })
+
+ this.on('fileManager', 'fileRemoved', (path) => {
+ if (this.onFileRemoved) this.onFileRemoved(path)
})
this.on('remixd', 'rootFolderChanged', () => {
this.resetResults()
- if (this.onSetWorkspace) this.onSetWorkspace(true)
+ if (this.onSetWorkspace) this.onSetWorkspace(true, 'localhost')
})
this.on('editor', 'sessionSwitched', () => {
@@ -282,36 +287,34 @@ export const CompilerApiMixin = (Base) => class extends Base {
type: 'warning'
})
} else this.statusChanged({ key: 'succeed', title: 'compilation successful', type: 'success' })
- // Store the contracts
- this.compilationDetails.contractsDetails = {}
- this.compiler.visitContracts((contract) => {
- this.compilationDetails.contractsDetails[contract.name] = parseContracts(
- contract.name,
- contract.object,
- this.compiler.getSource(contract.file)
- )
- })
} else {
const count = (data.errors ? data.errors.filter(error => error.severity === 'error').length : 0 + (data.error ? 1 : 0))
this.statusChanged({ key: count, title: `compilation failed with ${count} error${count > 1 ? 's' : ''}`, type: 'error' })
}
- // Update contract Selection
- this.compilationDetails.contractMap = {}
- if (success) this.compiler.visitContracts((contract) => { this.compilationDetails.contractMap[contract.name] = contract })
- this.compilationDetails.target = source.target
+ // Store the contracts and Update contract Selection
+ if (success) {
+ this.compilationDetails = await this.visitsContractApi(source, data)
+ } else {
+ this.compilationDetails = {
+ contractMap: {},
+ contractsDetails: {},
+ target: source.target
+ }
+ }
if (this.onCompilationFinished) this.onCompilationFinished(this.compilationDetails)
// set annotations
if (data.errors) {
for (const error of data.errors) {
let pos = helper.getPositionDetails(error.formattedMessage)
- if (pos.errFile) {
+ const file = pos.errFile
+ if (file) {
pos = {
row: pos.errLine,
column: pos.errCol,
text: error.formattedMessage,
type: error.severity
}
- await this.call('editor', 'addAnnotation', pos, pos.errFile)
+ await this.call('editor', 'addAnnotation', pos, file)
}
}
}
@@ -332,11 +335,40 @@ export const CompilerApiMixin = (Base) => class extends Base {
// ctrl+s or command+s
if ((e.metaKey || e.ctrlKey) && !e.shiftKey && e.keyCode === 83 && this.currentFile !== '') {
e.preventDefault()
- if(await this.getAppParameter('hardhat-compilation')) this.compileTabLogic.runCompiler('hardhat')
- else if(await this.getAppParameter('truffle-compilation')) this.compileTabLogic.runCompiler('truffle')
- else this.compileTabLogic.runCompiler(undefined)
+ if (this.currentFile && (this.currentFile.endsWith('.sol') || this.currentFile.endsWith('.yul'))) {
+ if(await this.getAppParameter('hardhat-compilation')) this.compileTabLogic.runCompiler('hardhat')
+ else if(await this.getAppParameter('truffle-compilation')) this.compileTabLogic.runCompiler('truffle')
+ else this.compileTabLogic.runCompiler(undefined)
+ }
}
}
window.document.addEventListener('keydown', this.data.eventHandlers.onKeyDown)
}
+
+ async visitsContractApi (source, data): Promise<{ contractMap: { file: string } | Record, contractsDetails: Record, target?: string }> {
+ return new Promise((resolve) => {
+ if (!data.contracts || (data.contracts && Object.keys(data.contracts).length === 0)) {
+ return resolve({
+ contractMap: {},
+ contractsDetails: {},
+ target: source.target
+ })
+ }
+ const contractMap = {}
+ const contractsDetails = {}
+ this.compiler.visitContracts((contract) => {
+ contractMap[contract.name] = contract
+ contractsDetails[contract.name] = parseContracts(
+ contract.name,
+ contract.object,
+ this.compiler.getSource(contract.file)
+ )
+ })
+ return resolve({
+ contractMap,
+ contractsDetails,
+ target: source.target
+ })
+ })
+ }
}
diff --git a/apps/solidity-compiler/src/app/compiler.ts b/apps/solidity-compiler/src/app/compiler.ts
index a58ff585a2..df64855ab9 100644
--- a/apps/solidity-compiler/src/app/compiler.ts
+++ b/apps/solidity-compiler/src/app/compiler.ts
@@ -6,31 +6,14 @@ import { CompilerApiMixin } from './compiler-api'
import { ICompilerApi } from '@remix-project/remix-lib-ts'
import { CompileTabLogic } from '@remix-ui/solidity-compiler'
-const profile = {
- name: 'solidity',
- displayName: 'Solidity compiler',
- icon: 'assets/img/solidity.webp',
- description: 'Compile solidity contracts',
- kind: 'compiler',
- permission: true,
- location: 'sidePanel',
- documentation: 'https://remix-ide.readthedocs.io/en/latest/solidity_editor.html',
- version: '0.0.1',
- methods: ['getCompilationResult', 'compile', 'compileWithParameters', 'setCompilerConfig', 'compileFile', 'getCompilerState']
-}
-
-const defaultAppParameters = {
- hideWarnings: false,
- autoCompile: false,
- includeNightlies: false
-}
-
const defaultCompilerParameters = {
runs: '200',
optimize: false,
version: 'soljson-v0.8.7+commit.e28d00a7',
evmVersion: null, // compiler default
- language: 'Solidity'
+ language: 'Solidity',
+ useFileConfiguration: false,
+ configFilePath: "compiler_config.json"
}
export class CompilerClientApi extends CompilerApiMixin(PluginClient) implements ICompilerApi {
constructor () {
@@ -48,7 +31,9 @@ export class CompilerClientApi extends CompilerApiMixin(PluginClient) implements
optimize: localStorage.getItem('optimize') === 'true',
version: localStorage.getItem('version') || defaultCompilerParameters.version,
evmVersion: localStorage.getItem('evmVersion') || defaultCompilerParameters.evmVersion, // default
- language: localStorage.getItem('language') || defaultCompilerParameters.language
+ language: localStorage.getItem('language') || defaultCompilerParameters.language,
+ useFileConfiguration: localStorage.getItem('useFileConfiguration') === 'true',
+ configFilePath: localStorage.getItem('configFilePath') || defaultCompilerParameters.configFilePath
}
return params
}
diff --git a/libs/remix-analyzer/README.md b/libs/remix-analyzer/README.md
index d81b93b787..a2cc46d6bd 100644
--- a/libs/remix-analyzer/README.md
+++ b/libs/remix-analyzer/README.md
@@ -10,7 +10,7 @@
### Installation
`@remix-project/remix-analyzer` is an NPM package and can be installed using NPM as:
-`npm install @remix-project/remix-analyzer`
+`yarn add @remix-project/remix-analyzer`
### How to use
diff --git a/libs/remix-analyzer/package.json b/libs/remix-analyzer/package.json
index 903e5f3c15..22d8646744 100644
--- a/libs/remix-analyzer/package.json
+++ b/libs/remix-analyzer/package.json
@@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-analyzer",
- "version": "0.5.22",
+ "version": "0.5.23",
"description": "Tool to perform static analysis on Solidity smart contracts",
"main": "src/index.js",
"types": "src/index.d.ts",
@@ -22,8 +22,8 @@
"@ethereumjs/block": "^3.5.1",
"@ethereumjs/tx": "^3.3.2",
"@ethereumjs/vm": "^5.5.3",
- "@remix-project/remix-astwalker": "^0.0.43",
- "@remix-project/remix-lib": "^0.5.13",
+ "@remix-project/remix-astwalker": "^0.0.44",
+ "@remix-project/remix-lib": "^0.5.14",
"async": "^2.6.2",
"ethereumjs-util": "^7.0.10",
"ethers": "^5.4.2",
@@ -52,5 +52,5 @@
"typescript": "^3.7.5"
},
"typings": "src/index.d.ts",
- "gitHead": "2be5108c51f2ac9226e4598c512ec6d3c63f5c78"
+ "gitHead": "3f311aaf25f5796f70711006bb783ee4087ffc71"
}
\ No newline at end of file
diff --git a/libs/remix-astwalker/README.md b/libs/remix-astwalker/README.md
index cc6416b8b0..6b03957968 100644
--- a/libs/remix-astwalker/README.md
+++ b/libs/remix-astwalker/README.md
@@ -10,7 +10,7 @@
### Installation
`@remix-project/remix-astwalker` is an NPM package and can be installed using NPM as:
-`npm install @remix-project/remix-astwalker`
+`yarn add @remix-project/remix-astwalker`
### How to use
diff --git a/libs/remix-astwalker/package.json b/libs/remix-astwalker/package.json
index 6a76dcf6dc..60e7f14374 100644
--- a/libs/remix-astwalker/package.json
+++ b/libs/remix-astwalker/package.json
@@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-astwalker",
- "version": "0.0.43",
+ "version": "0.0.44",
"description": "Tool to walk through Solidity AST",
"main": "src/index.js",
"scripts": {
@@ -37,7 +37,7 @@
"@ethereumjs/block": "^3.5.1",
"@ethereumjs/tx": "^3.3.2",
"@ethereumjs/vm": "^5.5.3",
- "@remix-project/remix-lib": "^0.5.13",
+ "@remix-project/remix-lib": "^0.5.14",
"@types/tape": "^4.2.33",
"async": "^2.6.2",
"ethereumjs-util": "^7.0.10",
@@ -54,5 +54,5 @@
"tap-spec": "^5.0.0"
},
"typings": "src/index.d.ts",
- "gitHead": "2be5108c51f2ac9226e4598c512ec6d3c63f5c78"
+ "gitHead": "3f311aaf25f5796f70711006bb783ee4087ffc71"
}
\ No newline at end of file
diff --git a/libs/remix-debug/README.md b/libs/remix-debug/README.md
index c8ea008043..e512499d36 100644
--- a/libs/remix-debug/README.md
+++ b/libs/remix-debug/README.md
@@ -10,7 +10,7 @@
### Installation
`@remix-project/remix-debug` is an NPM package and can be installed using NPM as:
-`npm install @remix-project/remix-debug`
+`yarn add @remix-project/remix-debug`
### How to use
diff --git a/libs/remix-debug/package.json b/libs/remix-debug/package.json
index 8d26e36358..e70aba4523 100644
--- a/libs/remix-debug/package.json
+++ b/libs/remix-debug/package.json
@@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-debug",
- "version": "0.5.13",
+ "version": "0.5.14",
"description": "Tool to debug Ethereum transactions",
"contributors": [
{
@@ -22,9 +22,9 @@
"@ethereumjs/common": "^2.5.0",
"@ethereumjs/tx": "^3.3.2",
"@ethereumjs/vm": "^5.5.3",
- "@remix-project/remix-astwalker": "^0.0.43",
- "@remix-project/remix-lib": "^0.5.13",
- "@remix-project/remix-simulator": "^0.2.13",
+ "@remix-project/remix-astwalker": "^0.0.44",
+ "@remix-project/remix-lib": "^0.5.14",
+ "@remix-project/remix-simulator": "^0.2.14",
"ansi-gray": "^0.1.1",
"async": "^2.6.2",
"color-support": "^1.1.3",
@@ -68,5 +68,5 @@
},
"homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-debug#readme",
"typings": "src/index.d.ts",
- "gitHead": "2be5108c51f2ac9226e4598c512ec6d3c63f5c78"
+ "gitHead": "3f311aaf25f5796f70711006bb783ee4087ffc71"
}
\ No newline at end of file
diff --git a/libs/remix-lib/README.md b/libs/remix-lib/README.md
index 31075ad154..64a6706ef3 100644
--- a/libs/remix-lib/README.md
+++ b/libs/remix-lib/README.md
@@ -10,7 +10,7 @@
### Installation
`@remix-project/remix-lib` is an NPM package and can be installed using NPM as:
-`npm install @remix-project/remix-lib`
+`yarn add @remix-project/remix-lib`
### How to use
diff --git a/libs/remix-lib/package.json b/libs/remix-lib/package.json
index 9decef15f7..1a26aee068 100644
--- a/libs/remix-lib/package.json
+++ b/libs/remix-lib/package.json
@@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-lib",
- "version": "0.5.13",
+ "version": "0.5.14",
"description": "Library to various Remix tools",
"contributors": [
{
@@ -54,5 +54,5 @@
},
"homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-lib#readme",
"typings": "src/index.d.ts",
- "gitHead": "2be5108c51f2ac9226e4598c512ec6d3c63f5c78"
+ "gitHead": "3f311aaf25f5796f70711006bb783ee4087ffc71"
}
\ No newline at end of file
diff --git a/libs/remix-lib/src/types/ICompilerApi.ts b/libs/remix-lib/src/types/ICompilerApi.ts
index 8e43892fa0..259aa2547a 100644
--- a/libs/remix-lib/src/types/ICompilerApi.ts
+++ b/libs/remix-lib/src/types/ICompilerApi.ts
@@ -24,7 +24,8 @@ export interface ICompilerApi {
onCurrentFileChanged: (fileName: string) => void
// onResetResults: () => void,
- onSetWorkspace: (workspace: any) => void
+ onSetWorkspace: (isLocalhost: boolean, workspaceName: string) => void
+ onFileRemoved: (path: string) => void
onNoFileSelected: () => void
onCompilationFinished: (contractsDetails: any, contractMap: any) => void
onSessionSwitched: () => void
diff --git a/libs/remix-simulator/README.md b/libs/remix-simulator/README.md
index ebd7b31aff..bf1b0c675a 100644
--- a/libs/remix-simulator/README.md
+++ b/libs/remix-simulator/README.md
@@ -10,7 +10,7 @@
### Installation
`@remix-project/remix-simulator` is an NPM package and can be installed using NPM as:
-`npm install @remix-project/remix-simulator`
+`yarn add @remix-project/remix-simulator`
### How to use
diff --git a/libs/remix-simulator/package.json b/libs/remix-simulator/package.json
index 95985105e7..edebf864e9 100644
--- a/libs/remix-simulator/package.json
+++ b/libs/remix-simulator/package.json
@@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-simulator",
- "version": "0.2.13",
+ "version": "0.2.14",
"description": "Ethereum IDE and tools for the web",
"contributors": [
{
@@ -18,7 +18,7 @@
"@ethereumjs/common": "^2.5.0",
"@ethereumjs/tx": "^3.3.2",
"@ethereumjs/vm": "^5.5.3",
- "@remix-project/remix-lib": "^0.5.13",
+ "@remix-project/remix-lib": "^0.5.14",
"ansi-gray": "^0.1.1",
"async": "^3.1.0",
"body-parser": "^1.18.2",
@@ -67,5 +67,5 @@
},
"homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-simulator#readme",
"typings": "src/index.d.ts",
- "gitHead": "2be5108c51f2ac9226e4598c512ec6d3c63f5c78"
+ "gitHead": "3f311aaf25f5796f70711006bb783ee4087ffc71"
}
\ No newline at end of file
diff --git a/libs/remix-simulator/src/methods/blocks.ts b/libs/remix-simulator/src/methods/blocks.ts
index 1ecc7b30e4..e2594b05ac 100644
--- a/libs/remix-simulator/src/methods/blocks.ts
+++ b/libs/remix-simulator/src/methods/blocks.ts
@@ -40,7 +40,6 @@ export class Blocks {
return cb(new Error('block not found'))
}
- console.log(block.transactions)
const transactions = block.transactions.map((t) => {
const hash = '0x' + t.hash().toString('hex')
const tx = this.vmContext.txByHash[hash]
@@ -95,7 +94,6 @@ export class Blocks {
eth_getBlockByHash (payload, cb) {
const block = this.vmContext.blocks[payload.params[0]]
- console.log(block.transactions)
const transactions = block.transactions.map((t) => {
const hash = '0x' + t.hash().toString('hex')
const tx = this.vmContext.txByHash[hash]
diff --git a/libs/remix-solidity/README.md b/libs/remix-solidity/README.md
index 2e448074fc..45f0cda698 100644
--- a/libs/remix-solidity/README.md
+++ b/libs/remix-solidity/README.md
@@ -12,7 +12,7 @@
`@remix-project/remix-solidity` is an NPM package and can be installed using NPM as:
-`npm install @remix-project/remix-solidity`
+`yarn add @remix-project/remix-solidity`
### How to use
diff --git a/libs/remix-solidity/package.json b/libs/remix-solidity/package.json
index 351f9ab46f..bc1038ded4 100644
--- a/libs/remix-solidity/package.json
+++ b/libs/remix-solidity/package.json
@@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-solidity",
- "version": "0.4.13",
+ "version": "0.5.0",
"description": "Tool to load and run Solidity compiler",
"main": "src/index.js",
"types": "src/index.d.ts",
@@ -18,7 +18,7 @@
"@ethereumjs/block": "^3.5.1",
"@ethereumjs/tx": "^3.3.2",
"@ethereumjs/vm": "^5.5.3",
- "@remix-project/remix-lib": "^0.5.13",
+ "@remix-project/remix-lib": "^0.5.14",
"async": "^2.6.2",
"eslint-scope": "^5.0.0",
"ethereumjs-util": "^7.0.10",
@@ -61,5 +61,5 @@
},
"homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-solidity#readme",
"typings": "src/index.d.ts",
- "gitHead": "2be5108c51f2ac9226e4598c512ec6d3c63f5c78"
+ "gitHead": "3f311aaf25f5796f70711006bb783ee4087ffc71"
}
\ No newline at end of file
diff --git a/libs/remix-solidity/src/compiler/compiler-input.ts b/libs/remix-solidity/src/compiler/compiler-input.ts
index 59a650620e..44c03305e0 100644
--- a/libs/remix-solidity/src/compiler/compiler-input.ts
+++ b/libs/remix-solidity/src/compiler/compiler-input.ts
@@ -46,3 +46,9 @@ export function getValidLanguage (val: string): Language {
}
return null
}
+
+export function compilerInputForConfigFile(sources: Source, opts)
+{
+ opts.sources = sources
+ return JSON.stringify(opts)
+}
diff --git a/libs/remix-solidity/src/compiler/compiler.ts b/libs/remix-solidity/src/compiler/compiler.ts
index a10fa6fce2..f728748a9e 100644
--- a/libs/remix-solidity/src/compiler/compiler.ts
+++ b/libs/remix-solidity/src/compiler/compiler.ts
@@ -2,7 +2,7 @@
import { update } from 'solc/abi'
import * as webworkify from 'webworkify-webpack'
-import compilerInput from './compiler-input'
+import compilerInput, { compilerInputForConfigFile } from './compiler-input'
import EventManager from '../lib/eventManager'
import txHelper from './helper'
import {
@@ -31,6 +31,8 @@ export class Compiler {
language: 'Solidity',
compilationStartTime: null,
target: null,
+ useFileConfiguration: false,
+ configFileContent: '',
lastCompilationResult: {
data: null,
source: null
@@ -111,11 +113,17 @@ export class Compiler {
return { error: 'Deferred import' }
}
let result: CompilationResult = {}
- let input
+ let input = ""
try {
if (source && source.sources) {
- const { optimize, runs, evmVersion, language } = this.state
- input = compilerInput(source.sources, { optimize, runs, evmVersion, language })
+ const { optimize, runs, evmVersion, language, useFileConfiguration, configFileContent } = this.state
+
+ if (useFileConfiguration) {
+ input = compilerInputForConfigFile(source.sources, JSON.parse(configFileContent))
+ } else {
+ input = compilerInput(source.sources, { optimize, runs, evmVersion, language })
+ }
+
result = JSON.parse(compiler.compile(input, { import: missingInputsCallback }))
}
} catch (exception) {
@@ -183,11 +191,17 @@ export class Compiler {
return { error: 'Deferred import' }
}
let result: CompilationResult = {}
- let input: string
+ let input = ""
try {
if (source && source.sources) {
- const { optimize, runs, evmVersion, language } = this.state
- input = compilerInput(source.sources, { optimize, runs, evmVersion, language })
+ const { optimize, runs, evmVersion, language, useFileConfiguration, configFileContent } = this.state
+
+ if (useFileConfiguration) {
+ input = compilerInputForConfigFile(source.sources, JSON.parse(configFileContent))
+ } else {
+ input = compilerInput(source.sources, { optimize, runs, evmVersion, language })
+ }
+
result = JSON.parse(remoteCompiler.compile(input, { import: missingInputsCallback }))
}
} catch (exception) {
@@ -289,12 +303,26 @@ export class Compiler {
this.state.compileJSON = (source: SourceWithTarget) => {
if (source && source.sources) {
- const { optimize, runs, evmVersion, language } = this.state
+ const { optimize, runs, evmVersion, language, useFileConfiguration, configFileContent } = this.state
jobs.push({ sources: source })
+ let input = ""
+
+ try {
+ if (useFileConfiguration) {
+ input = compilerInputForConfigFile(source.sources, JSON.parse(configFileContent))
+ } else {
+ input = compilerInput(source.sources, { optimize, runs, evmVersion, language })
+ }
+ } catch (exception) {
+ this.onCompilationFinished({ error: { formattedMessage: exception.message } }, [], source, "", this.state.currentVersion)
+ return
+ }
+
+
this.state.worker.postMessage({
cmd: 'compile',
job: jobs.length - 1,
- input: compilerInput(source.sources, { optimize, runs, evmVersion, language })
+ input: input
})
}
}
diff --git a/libs/remix-solidity/src/compiler/types.ts b/libs/remix-solidity/src/compiler/types.ts
index 76ed36ca17..c4e48dd2ff 100644
--- a/libs/remix-solidity/src/compiler/types.ts
+++ b/libs/remix-solidity/src/compiler/types.ts
@@ -164,6 +164,8 @@ export interface CompilerState {
language: Language,
compilationStartTime: number| null,
target: string | null,
+ useFileConfiguration: boolean,
+ configFileContent: string,
lastCompilationResult: {
data: CompilationResult | null,
source: SourceWithTarget | null | undefined
diff --git a/libs/remix-tests/README.md b/libs/remix-tests/README.md
index f08ca19985..81a3bc6aaf 100644
--- a/libs/remix-tests/README.md
+++ b/libs/remix-tests/README.md
@@ -12,11 +12,11 @@ To know more about Remix IDE `Solidity Unit Testing Plugin`, visit [Remix IDE of
### Installation
* As a dev dependency:
-`npm install --save-dev @remix-project/remix-tests`
+`yarn add --dev @remix-project/remix-tests`
* As a global NPM module to use as CLI:
-`npm -g install @remix-project/remix-tests`
+`yarn global add @remix-project/remix-tests`
To confirm installation, run:
```
diff --git a/libs/remix-tests/package.json b/libs/remix-tests/package.json
index 35e805d91f..2029b0ed7e 100644
--- a/libs/remix-tests/package.json
+++ b/libs/remix-tests/package.json
@@ -1,6 +1,6 @@
{
"name": "@remix-project/remix-tests",
- "version": "0.2.13",
+ "version": "0.2.14",
"description": "Tool to test Solidity smart contracts",
"main": "src/index.js",
"types": "./src/index.d.ts",
@@ -39,9 +39,9 @@
"@ethereumjs/common": "^2.5.0",
"@ethereumjs/tx": "^3.3.2",
"@ethereumjs/vm": "^5.5.3",
- "@remix-project/remix-lib": "^0.5.13",
- "@remix-project/remix-simulator": "^0.2.13",
- "@remix-project/remix-solidity": "^0.4.13",
+ "@remix-project/remix-lib": "^0.5.14",
+ "@remix-project/remix-simulator": "^0.2.14",
+ "@remix-project/remix-solidity": "^0.5.0",
"ansi-gray": "^0.1.1",
"async": "^2.6.0",
"axios": ">=0.21.1",
@@ -79,5 +79,5 @@
"typescript": "^3.3.1"
},
"typings": "src/index.d.ts",
- "gitHead": "2be5108c51f2ac9226e4598c512ec6d3c63f5c78"
+ "gitHead": "3f311aaf25f5796f70711006bb783ee4087ffc71"
}
\ No newline at end of file
diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts
index 496f6f4936..65bea514da 100644
--- a/libs/remix-tests/tests/testRunner.cli.spec.ts
+++ b/libs/remix-tests/tests/testRunner.cli.spec.ts
@@ -11,7 +11,7 @@ describe('testRunner: remix-tests CLI', () => {
const dirContent = result.stdout.toString()
// Install dependencies if 'node_modules' is not already present
if(!dirContent.includes('node_modules')) {
- execSync('npm install', { cwd: resolve(__dirname + '/../../../dist/libs/remix-tests') })
+ execSync('yarn install', { cwd: resolve(__dirname + '/../../../dist/libs/remix-tests') })
}
}
diff --git a/libs/remix-ui/editor/src/lib/remix-plugin-types.ts b/libs/remix-ui/editor/src/lib/remix-plugin-types.ts
index 3c0a4d5e23..ceb49f5399 100644
--- a/libs/remix-ui/editor/src/lib/remix-plugin-types.ts
+++ b/libs/remix-ui/editor/src/lib/remix-plugin-types.ts
@@ -1,5548 +1,935 @@
-export const types = `
-declare module 'dist/packages/api/lib/compiler/type/input' {
- export interface CompilationInput {
- /** Source code language */
- language: 'Solidity' | 'Vyper' | 'lll' | 'assembly' | 'yul';
- sources: SourcesInput;
- settings?: CompilerSettings;
- outputSelection?: CompilerOutputSelection;
- }
- export interface CondensedCompilationInput {
- language: 'Solidity' | 'Vyper' | 'lll' | 'assembly' | 'yul';
- optimize: boolean;
- /** e.g: 0.6.8+commit.0bbfe453 */
- version: string;
- evmVersion?: 'istanbul' | 'petersburg' | 'constantinople' | 'byzantium' | 'spuriousDragon' | 'tangerineWhistle' | 'homestead';
- }
- export interface SourceInputUrls {
- /** Hash of the source file. It is used to verify the retrieved content imported via URLs */
- keccak256?: string;
- /**
- * URL(s) to the source file.
- * URL(s) should be imported in this order and the result checked against the
- * keccak256 hash (if available). If the hash doesn't match or none of the
- * URL(s) result in success, an error should be raised.
- */
- urls: string[];
- }
- export interface SourceInputContent {
- /** Hash of the source file. */
- keccak256?: string;
- /** Literal contents of the source file */
- content: string;
- }
- export interface SourcesInput {
- [contractName: string]: SourceInputContent | SourceInputUrls;
- }
- export interface CompilerSettings {
- /** Sorted list of remappings */
- remappings?: string[];
- /** Optimizer settings */
- optimizer?: Partial;
- /** Version of the EVM to compile for. Affects type checking and code generation */
- evmVersion: 'homestead' | 'tangerineWhistle' | 'spuriousDragon' | 'byzantium' | 'constantinople';
- /** Metadata settings */
- metadata?: CompilerMetadata;
- /** Addresses of the libraries. If not all libraries are given here, it can result in unlinked objects whose output data is different. */
- libraries: CompilerLibraries;
- }
- export interface CompilerOptimizer {
- /** disabled by default */
- enable: boolean;
- /**
- * Optimize for how many times you intend to run the code.
- * Lower values will optimize more for initial deployment cost, higher values will optimize more for high-frequency usage.
- */
- runs: number;
- }
- export interface CompilerMetadata {
- /** Use only literal content and not URLs (false by default) */
- useLiteralContent: boolean;
- }
- /**
- * The top level key is the the name of the source file where the library is used.
- * If remappings are used, this source file should match the global path after remappings were applied.
- * If this key is an empty string, that refers to a global level.
- */
- export interface CompilerLibraries {
- [contractName: string]: {
- [libName: string]: string;
- };
- }
- export type OutputType = 'abi' | 'ast' | 'devdoc' | 'userdoc' | 'metadata' | 'ir' | 'evm.assembly' | 'evm.legacyAssembly' | 'evm.bytecode.object' | 'evm.bytecode.opcodes' | 'evm.bytecode.sourceMap' | 'evm.bytecode.linkReferences' | 'evm.deployedBytecode' | 'evm.methodIdentifiers' | 'evm.gasEstimates' | 'ewasm.wast' | 'ewasm.wasm';
- /**
- * The following can be used to select desired outputs.
- * If this field is omitted, then the compiler loads and does type checking, but will not generate any outputs apart from errors.
- * The first level key is the file name and the second is the contract name, where empty contract name refers to the file itself,
- * while the star refers to all of the contracts.
- * Note that using a using evm, evm.bytecode, ewasm, etc. will select every
- * target part of that output. Additionally, * can be used as a wildcard to request everything.
- */
- export interface CompilerOutputSelection {
- [file: string]: {
- [contract: string]: OutputType[];
- };
- }
-
-}
-declare module 'dist/packages/api/lib/compiler/type/output' {
- export interface CompilationFileSources {
- [fileName: string]: {
- keccak256?: string;
- content: string;
- urls?: string[];
- };
- }
- export interface SourceWithTarget {
- sources?: CompilationFileSources;
- target?: string | null | undefined;
- }
- export interface CompilationResult {
- /** not present if no errors/warnings were encountered */
- errors?: CompilationError[];
- /** This contains the file-level outputs. In can be limited/filtered by the outputSelection settings */
- sources: {
- [contractName: string]: CompilationSource;
- };
- /** This contains the contract-level outputs. It can be limited/filtered by the outputSelection settings */
- contracts: {
- /** If the language used has no contract names, this field should equal to an empty string. */
- [fileName: string]: {
- [contract: string]: CompiledContract;
- };
- };
- }
- export interface lastCompilationResult {
- data: CompilationResult | null;
- source: SourceWithTarget | null | undefined;
- }
- export interface CompilationError {
- /** Location within the source file */
- sourceLocation?: {
- file: string;
- start: number;
- end: number;
- };
- /** Error type */
- type: CompilationErrorType;
- /** Component where the error originated, such as "general", "ewasm", etc. */
- component: 'general' | 'ewasm' | string;
- severity: 'error' | 'warning';
- message: string;
- /** the message formatted with source location */
- formattedMessage?: string;
- } type CompilationErrorType = 'JSONError' | 'IOError' | 'ParserError' | 'DocstringParsingError' | 'SyntaxError' | 'DeclarationError' | 'TypeError' | 'UnimplementedFeatureError' | 'InternalCompilerError' | 'Exception' | 'CompilerError' | 'FatalError' | 'Warning';
- export interface CompilationSource {
- /** Identifier of the source (used in source maps) */
- id: number;
- /** The AST object */
- ast: AstNode;
- /** The legacy AST object */
- legacyAST: AstNodeLegacy;
- }
- export interface AstNode {
- absolutePath?: string;
- exportedSymbols?: Object;
- id: number;
- nodeType: string;
- nodes?: Array;
- src: string;
- literals?: Array;
- file?: string;
- scope?: number;
- sourceUnit?: number;
- symbolAliases?: Array;
- [x: string]: any;
- }
- export interface AstNodeLegacy {
- id: number;
- name: string;
- src: string;
- children?: Array;
- attributes?: AstNodeAtt;
- }
- export interface AstNodeAtt {
- operator?: string;
- string?: null;
- type?: string;
- value?: string;
- constant?: boolean;
- name?: string;
- public?: boolean;
- exportedSymbols?: Object;
- argumentTypes?: null;
- absolutePath?: string;
- [x: string]: any;
- }
- export interface CompiledContract {
- /** The Ethereum Contract ABI. If empty, it is represented as an empty array. */
- abi: ABIDescription[];
- metadata: string;
- /** User documentation (natural specification) */
- userdoc: UserDocumentation;
- /** Developer documentation (natural specification) */
- devdoc: DeveloperDocumentation;
- /** Intermediate representation (string) */
- ir: string;
- /** EVM-related outputs */
- evm: {
- assembly: string;
- legacyAssembly: {};
- /** Bytecode and related details. */
- bytecode: BytecodeObject;
- deployedBytecode: BytecodeObject;
- /** The list of function hashes */
- methodIdentifiers: {
- [functionIdentifier: string]: string;
- };
- gasEstimates: {
- creation: {
- codeDepositCost: string;
- executionCost: 'infinite' | string;
- totalCost: 'infinite' | string;
- };
- external: {
- [functionIdentifier: string]: string;
- };
- internal: {
- [functionIdentifier: string]: 'infinite' | string;
- };
- };
- };
- /** eWASM related outputs */
- ewasm: {
- /** S-expressions format */
- wast: string;
- /** Binary format (hex string) */
- wasm: string;
- };
- }
- export type ABIDescription = FunctionDescription | EventDescription;
- export interface FunctionDescription {
- /** Type of the method. default is 'function' */
- type?: 'function' | 'constructor' | 'fallback';
- /** The name of the function. Constructor and fallback functions never have a name */
- name?: string;
- /** List of parameters of the method. Fallback functions don’t have inputs. */
- inputs?: ABIParameter[];
- /** List of the output parameters for the method, if any */
- outputs?: ABIParameter[];
- /** State mutability of the method */
- stateMutability: 'pure' | 'view' | 'nonpayable' | 'payable';
- /** true if function accepts Ether, false otherwise. Default is false */
- payable?: boolean;
- /** true if function is either pure or view, false otherwise. Default is false */
- constant?: boolean;
- }
- export interface EventDescription {
- type: 'event';
- name: string;
- inputs: ABIParameter & {
- /** true if the field is part of the log’s topics, false if it one of the log’s data segment. */
- indexed: boolean;
- }[];
- /** true if the event was declared as anonymous. */
- anonymous: boolean;
- }
- export interface ABIParameter {
- /** The name of the parameter */
- name: string;
- /** The canonical type of the parameter */
- type: ABITypeParameter;
- /** Used for tuple types */
- components?: ABIParameter[];
- }
- export type ABITypeParameter = 'uint' | 'uint[]' | 'int' | 'int[]' | 'address' | 'address[]' | 'bool' | 'bool[]' | 'fixed' | 'fixed[]' | 'ufixed' | 'ufixed[]' | 'bytes' | 'bytes[]' | 'function' | 'function[]' | 'tuple' | 'tuple[]' | string;
- export interface UserDocumentation {
- methods: UserMethodList;
- notice: string;
- }
- export type UserMethodList = {
- [functionIdentifier: string]: UserMethodDoc;
- } & {
- 'constructor'?: string;
- };
- export interface UserMethodDoc {
- notice: string;
- }
- export interface DeveloperDocumentation {
- author: string;
- title: string;
- details: string;
- methods: DevMethodList;
- }
- export interface DevMethodList {
- [functionIdentifier: string]: DevMethodDoc;
- }
- export interface DevMethodDoc {
- author: string;
- details: string;
- return: string;
- returns: {
- [param: string]: string;
- };
- params: {
- [param: string]: string;
- };
- }
- export interface BytecodeObject {
- /** The bytecode as a hex string. */
- object: string;
- /** Opcodes list */
- opcodes: string;
- /** The source mapping as a string. See the source mapping definition. */
- sourceMap: string;
- /** If given, this is an unlinked object. */
- linkReferences?: {
- [contractName: string]: {
- /** Byte offsets into the bytecode. */
- [library: string]: {
- start: number;
- length: number;
- }[];
- };
- };
- }
- export {};
-
-}
-declare module 'dist/packages/api/lib/compiler/type/index' {
- export * from 'dist/packages/api/lib/compiler/type/input';
- export * from 'dist/packages/api/lib/compiler/type/output';
-
-}
-declare module 'packages/utils/src/lib/tools/event-name' {
- /** Create the name of the event for a call */
- export function callEvent(name: string, key: string, id: number): string;
- /** Create the name of the event for a listen */
- export function listenEvent(name: string, key: string): string;
-
-}
-declare module 'packages/utils/src/lib/tools/method-path' {
- /** Create a method path based on the method name and the path */
- export function getMethodPath(method: string, path?: string): string;
- /** Get the root name of a path */
- export function getRootPath(path: string): string;
-
-}
-declare module 'packages/utils/src/lib/types/service' {
- export type IPluginService = any> = {
- methods: string[];
- readonly path: string;
- } & T;
- export type GetPluginService> = S extends IPluginService ? S : IPluginService;
-
-}
-declare module 'packages/utils/src/lib/types/status' {
- export interface Status {
- /** Display an icon or number */
- key: number | 'edited' | 'succeed' | 'loading' | 'failed' | 'none';
- /** Bootstrap css color */
- type?: 'success' | 'info' | 'warning' | 'error';
- /** Describe the status on mouseover */
- title?: string;
- }
- export type StatusEvents = {
- statusChanged: (status: Status) => void;
- };
-
-}
-declare module 'packages/utils/src/lib/types/api' {
- import { StatusEvents } from 'packages/utils/src/lib/types/status';
- export interface Api {
- events: {
- [key: string]: (...args: any[]) => void;
- } & StatusEvents;
- methods: {
- [key: string]: (...args: any[]) => void;
- };
- }
- export type EventKey = Extract;
- export type EventParams> = T extends Api ? Parameters : any[];
- export type EventCallback> = T extends Api ? T['events'][K] : (...payload: any[]) => void;
- export type MethodKey = Extract;
- export type MethodParams> = T extends Api ? Parameters : any[];
- export interface EventApi {
- on: >(name: event, cb: T['events'][event]) => void;
- }
- export type MethodApi = {
- [m in Extract]: (...args: Parameters) => Promise>;
- };
- export type CustomApi = EventApi & MethodApi;
- /** A map of Api used to describe all the plugin's api in the project */
- export type ApiMap = Readonly>;
- /** A map of plugin based on the ApiMap. It enforces the PluginEngine */
- export type PluginApi = {
- [name in keyof T]: CustomApi;
- };
- export type API = {
- [M in keyof T['methods']]: T['methods'][M] | Promise;
- };
-
-}
-declare module 'packages/utils/src/lib/types/plugin' {
- import type { IPluginService } from 'packages/utils/src/lib/types/service';
- import { EventCallback, MethodParams, MethodKey, EventKey, Api, ApiMap, EventParams } from 'packages/utils/src/lib/types/api';
- export interface PluginBase {
- methods: string[];
- activateService: Record Promise>;
- /** Listen on an event from another plugin */
- on, Key extends EventKey>(name: Name, key: Key, cb: EventCallback): void;
- /** Listen one time on an event from another plugin, then remove event listener */
- once, Key extends EventKey>(name: Name, key: Key, cb: EventCallback): void;
- /** Stop listening on an event from another plugin */
- off, Key extends EventKey>(name: Name, key: Key): void;
- /** Call a method of another plugin */
- call, Key extends MethodKey>(name: Name, key: Key, ...payload: MethodParams): Promise;
- /** Clear calls in queue of a plugin called by plugin */
- cancel, Key extends MethodKey>(name: Name, key: Key): void;
- /** Emit an event */
- emit>(key: Key, ...payload: EventParams): void;
- }
-
-}
-declare module 'packages/utils/src/lib/tools/service' {
- import type { IPluginService, GetPluginService } from 'packages/utils/src/lib/types/service';
- import type { Api, ApiMap } from 'packages/utils/src/lib/types/api';
- import type { PluginBase } from 'packages/utils/src/lib/types/plugin';
- /** Check if the plugin is an instance of PluginService */
- export const isPluginService: (service: any) => service is PluginService;
- /**
- * Return the methods of a service, except "constructor" and methods starting with "_"
- * @param instance The instance of a class to get the method from
- */
- export function getMethods(service: IPluginService): any;
- /**
- * Create a plugin service
- * @param path The path of the service separated by '.' (ex: 'box.profile')
- * @param service The service template
- * @note If the service doesn't provide a property "methods" then all methods are going to be exposed by default
- */
- export function createService>(path: string, service: T): GetPluginService;
- /**
- * Connect the service to the plugin client
- * @param client The main client of the plugin
- * @param service A service to activate
- */
- export function activateService(client: PluginBase, service: IPluginService): any;
- /**
- * A node that forward the call to the right path
- */
- export abstract class PluginService implements IPluginService {
- methods: string[];
- abstract readonly path: string;
- protected abstract plugin: PluginBase;
- emit(key: string, ...payload: any[]): void;
- /**
- * Create a subservice under this service
- * @param name The name of the subservice inside this service
- * @param service The subservice to add
- */
- createService>(name: string, service: S): Promise>;
- /**
- * Prepare a service to be lazy loaded.
- * Service can be activated by doing client.activateService(path)
- * @param name The name of the subservice inside this service
- * @param factory A function to create the service on demand
- */
- prepareService>(name: string, factory: () => S): void;
- }
-
-}
-declare module 'packages/utils/src/lib/types/message' {
- export interface PluginRequest {
- /** The name of the plugin making the request */
- from: string;
- /** @deprecated Will be remove in the next version */
- isFromNative?: boolean;
- /**
- * The path to access the request inside the plugin
- * @example 'remixd.cmd.git'
- */
- path?: string;
- } type MessageActions = 'on' | 'off' | 'once' | 'call' | 'response' | 'emit' | 'cancel'; type OldMessageActions = 'notification' | 'request' | 'response' | 'listen';
- export interface Message {
- id: number;
- action: MessageActions | OldMessageActions;
- name: string;
- key: string;
- payload: any;
- requestInfo: PluginRequest;
- error?: Error | string;
- }
- export {};
-
-}
-declare module 'packages/utils/src/lib/types/queue' {
- import type { PluginRequest } from 'packages/utils/src/lib/types/message';
- export interface PluginQueueInterface {
- setCurrentRequest(request: PluginRequest): void;
- callMethod(method: string, args: any[]): void;
- letContinue(): void;
- cancel(): void;
- }
-
-}
-declare module 'packages/utils/src/lib/types/profile' {
- import { MethodKey, Api, ApiMap, EventKey } from 'packages/utils/src/lib/types/api';
- /** Describe a plugin */
- export interface Profile {
- name: string;
- displayName?: string;
- methods?: MethodKey[];
- events?: EventKey[];
- permission?: boolean;
- hash?: string;
- description?: string;
- documentation?: string;
- version?: string;
- kind?: string;
- canActivate?: string[];
- icon?: string;
- }
- export interface LocationProfile {
- location: string;
- }
- export interface ExternalProfile {
- url: string;
- }
- export interface HostProfile extends Profile {
- methods: ('addView' | 'removeView' | 'focus' | string)[];
- }
- export interface LibraryProfile extends Profile {
- events?: EventKey[];
- notifications?: {
- [name: string]: string[];
- };
- }
- /** A map of profile */
- export type ProfileMap = Partial<{
- [name in keyof T]: Profile;
- }>;
- /** Extract the API of a profile */
- export type ApiFromProfile = T extends Profile ? I : never;
- /** Create an ApiMap from a Profile Map */
- export type ApiMapFromProfileMap> = {
- [name in keyof T]: ApiFromProfile;
- };
- /** Transform an ApiMap into a profile map */
- export type ProfileMapFromApiMap = Readonly<{
- [name in keyof T]: Profile;
- }>;
-
-}
-declare module 'packages/utils/src/lib/tools/queue' {
- import { PluginQueueInterface } from 'packages/utils/src/lib/types/queue';
- import type { PluginRequest } from 'packages/utils/src/lib/types/message';
- import { Profile } from 'packages/utils/src/lib/types/profile';
- import { Api } from 'packages/utils/src/lib/types/api';
- import { PluginOptions } from '@remixproject/plugin-utils';
- export class PluginQueueItem implements PluginQueueInterface {
- private resolve;
- private reject;
- private timer;
- private running;
- private args;
- method: Profile['methods'][number];
- timedout: boolean;
- canceled: boolean;
- finished: boolean;
- request: PluginRequest;
- private options;
- constructor(resolve: (value: unknown) => void, reject: (reason: any) => void, request: PluginRequest, method: Profile['methods'][number], options: PluginOptions, args: any[]);
- setCurrentRequest(request: PluginRequest): void;
- callMethod(method: string, args: any[]): void;
- letContinue(): void;
- cancel(): void;
- run(): Promise;
- }
-
-}
-declare module 'packages/utils/src/lib/types/options' {
- export interface PluginOptions {
- /** The time to wait for a call to be executed before going to next call in the queue */
- queueTimeout?: number;
- }
-
-}
-declare module 'packages/utils/src/index' {
- export * from 'packages/utils/src/lib/tools/event-name';
- export * from 'packages/utils/src/lib/tools/method-path';
- export * from 'packages/utils/src/lib/tools/service';
- export * from 'packages/utils/src/lib/tools/queue';
- export * from 'packages/utils/src/lib/types/api';
- export * from 'packages/utils/src/lib/types/message';
- export * from 'packages/utils/src/lib/types/plugin';
- export * from 'packages/utils/src/lib/types/profile';
- export * from 'packages/utils/src/lib/types/service';
- export * from 'packages/utils/src/lib/types/status';
- export * from 'packages/utils/src/lib/types/queue';
- export * from 'packages/utils/src/lib/types/options';
-
-}
-declare module 'dist/packages/api/lib/compiler/api' {
- import { CompilationResult, CompilationFileSources, lastCompilationResult, CondensedCompilationInput, SourcesInput } from 'dist/packages/api/lib/compiler/type';
- import { StatusEvents, Api } from '@remixproject/plugin-utils';
- export interface ICompiler extends Api {
- events: {
- compilationFinished: (fileName: string, source: CompilationFileSources, languageVersion: string, data: CompilationResult) => void;
- } & StatusEvents;
- methods: {
- getCompilationResult(): lastCompilationResult;
- compile(fileName: string): void;
- setCompilerConfig(settings: CondensedCompilationInput): void;
- compileWithParameters(targets: SourcesInput, settings: CondensedCompilationInput): lastCompilationResult;
- };
- }
-
-}
-declare module 'dist/packages/api/lib/compiler/profile' {
- import { ICompiler } from 'dist/packages/api/lib/compiler/api';
- import { LibraryProfile } from '@remixproject/plugin-utils';
- export const compilerProfile: LibraryProfile;
-
-}
-declare module 'dist/packages/api/lib/compiler/index' {
- export * from 'dist/packages/api/lib/compiler/api';
- export * from 'dist/packages/api/lib/compiler/type';
- export * from 'dist/packages/api/lib/compiler/profile';
-
-}
-declare module 'dist/packages/api/lib/content-import/type' {
- export interface ContentImport {
- content: any;
- cleanUrl: string;
- type: 'github' | 'http' | 'https' | 'swarm' | 'ipfs';
- url: string;
- }
-
-}
-declare module 'dist/packages/api/lib/content-import/api' {
- import { ContentImport } from 'dist/packages/api/lib/content-import/type';
- import { StatusEvents } from '@remixproject/plugin-utils';
- export interface IContentImport {
- events: {} & StatusEvents;
- methods: {
- resolve(path: string): ContentImport;
- resolveAndSave(url: string, targetPath: string): string;
- };
- }
-
-}
-declare module 'dist/packages/api/lib/content-import/profile' {
- import { IContentImport } from 'dist/packages/api/lib/content-import/api';
- import { LibraryProfile } from '@remixproject/plugin-utils';
- export const contentImportProfile: LibraryProfile;
-
-}
-declare module 'dist/packages/api/lib/content-import/index' {
- export * from 'dist/packages/api/lib/content-import/api';
- export * from 'dist/packages/api/lib/content-import/type';
- export * from 'dist/packages/api/lib/content-import/profile';
-
-}
-declare module 'dist/packages/api/lib/editor/type' {
- export interface HighlightPosition {
- start: {
- line: number;
- column: number;
- };
- end: {
- line: number;
- column: number;
- };
- }
- export interface Annotation {
- row: number;
- column: number;
- text: string;
- type: "error" | "warning" | "info";
- }
-
-}
-declare module 'dist/packages/api/lib/editor/api' {
- import { HighlightPosition, Annotation } from 'dist/packages/api/lib/editor/type';
- import { StatusEvents } from '@remixproject/plugin-utils';
- export interface IEditor {
- events: {} & StatusEvents;
- methods: {
- highlight(position: HighlightPosition, filePath: string, hexColor: string): void;
- discardHighlight(): void;
- discardHighlightAt(line: number, filePath: string): void;
- addAnnotation(annotation: Annotation): void;
- clearAnnotations(): void;
- };
- }
-
-}
-declare module 'dist/packages/api/lib/editor/profile' {
- import { IEditor } from 'dist/packages/api/lib/editor/api';
- import { LibraryProfile } from '@remixproject/plugin-utils';
- export const editorProfile: LibraryProfile;
-
-}
-declare module 'dist/packages/api/lib/editor/index' {
- export * from 'dist/packages/api/lib/editor/type';
- export * from 'dist/packages/api/lib/editor/api';
- export * from 'dist/packages/api/lib/editor/profile';
-
-}
-declare module 'dist/packages/api/lib/file-system/type' {
- export interface Folder {
- [path: string]: {
- isDirectory: boolean;
- };
- }
-
-}
-declare module 'dist/packages/api/lib/file-system/api' {
- import { Folder } from 'dist/packages/api/lib/file-system/type';
- import { StatusEvents } from '@remixproject/plugin-utils';
- export interface IFileSystem {
- events: {
- currentFileChanged: (file: string) => void;
- fileSaved: (file: string) => void;
- fileAdded: (file: string) => void;
- fileRemoved: (file: string) => void;
- fileClosed: (file: string) => void;
- noFileSelected: () => void;
- fileRenamed: (oldName: string, newName: string, isFolder: boolean) => void;
- } & StatusEvents;
- methods: {
- /** Open the content of the file in the context (eg: Editor) */
- open(path: string): void;
- /** Set the content of a specific file */
- writeFile(path: string, data: string): void;
- /** Return the content of a specific file */
- readFile(path: string): string;
- /** Change the path of a file */
- rename(oldPath: string, newPath: string): void;
- /** Upsert a file with the content of the source file */
- copyFile(src: string, dest: string): void;
- /** Create a directory */
- mkdir(path: string): void;
- /** Get the list of files in the directory */
- readdir(path: string): string[];
- /** Removes a file or directory recursively */
- remove(path: string): void;
- /** Get the name of the file currently focused if any */
- getCurrentFile(): string;
- /** @deprecated Use readdir */
- getFolder(path: string): Folder;
- /** @deprecated Use readFile */
- getFile(path: string): string;
- /** @deprecated Use writeFile */
- setFile(path: string, content: string): void;
- /** @deprecated Use open */
- switchFile(path: string): void;
- };
- }
-
-}
-declare module 'dist/packages/api/lib/file-system/profile' {
- import { IFileSystem } from 'dist/packages/api/lib/file-system/api';
- import { LocationProfile, Profile } from '@remixproject/plugin-utils';
- export const filSystemProfile: Profile & LocationProfile;
-
-}
-declare module 'dist/packages/api/lib/file-system/index' {
- export * from 'dist/packages/api/lib/file-system/api';
- export * from 'dist/packages/api/lib/file-system/type';
- export * from 'dist/packages/api/lib/file-system/profile';
-
-}
-declare module 'dist/packages/api/lib/git/api' {
- import { StatusEvents } from '@remixproject/plugin-utils';
- export interface IGitSystem {
- events: {} & StatusEvents;
- methods: {
- clone(url: string): string;
- checkout(cmd: string): string;
- init(): string;
- add(cmd: string): string;
- commit(cmd: string): string;
- fetch(cmd: string): string;
- pull(cmd: string): string;
- push(cmd: string): string;
- reset(cmd: string): string;
- status(cmd: string): string;
- remote(cmd: string): string;
- log(): string;
- };
- }
-
-}
-declare module 'dist/packages/api/lib/git/profile' {
- import { IGitSystem } from 'dist/packages/api/lib/git/api';
- import { LibraryProfile } from '@remixproject/plugin-utils';
- export const gitProfile: LibraryProfile;
-
-}
-declare module 'dist/packages/api/lib/git/index' {
- export * from 'dist/packages/api/lib/git/api';
- export * from 'dist/packages/api/lib/git/profile';
-
-}
-declare module 'dist/packages/api/lib/network/type' {
- /** @deprecated: current version in Remix IDE. To improve to match standard JSON RPC methods */
- export interface CustomNetwork {
- id?: string;
- name: string;
- url: string;
- }
- /** @deprecated: current version in Remix IDE. To improve to match standard JSON RPC methods */
- export type NetworkProvider = 'vm' | 'injected' | 'web3';
- export type Network = {
- id: '1';
- name: 'Main';
- } | {
- id: '2';
- name: 'Morden (deprecated)';
- } | {
- id: '3';
- name: 'Ropsten';
- } | {
- id: '4';
- name: 'Rinkeby';
- } | {
- id: '5';
- name: 'Goerli';
- } | {
- id: '42';
- name: 'Kovan';
- };
-
-}
-declare module 'dist/packages/api/lib/network/api' {
- import { StatusEvents } from '@remixproject/plugin-utils';
- import { NetworkProvider, Network, CustomNetwork } from 'dist/packages/api/lib/network/type';
- /** @deprecated: current version in Remix IDE. To improve to match standard JSON RPC methods */
- export interface INetwork {
- events: {
- providerChanged: (provider: NetworkProvider) => void;
- } & StatusEvents;
- methods: {
- getNetworkProvider(): NetworkProvider;
- detectNetwork(): Network | Partial;
- getEndpoint(): string;
- addNetwork(network: CustomNetwork): void;
- removeNetwork(name: string): void;
- };
- }
-
-}
-declare module 'dist/packages/api/lib/network/profile' {
- import { INetwork } from 'dist/packages/api/lib/network/api';
- import { LibraryProfile } from '@remixproject/plugin-utils';
- export const networkProfile: LibraryProfile;
-
-}
-declare module 'dist/packages/api/lib/network/index' {
- export * from 'dist/packages/api/lib/network/api';
- export * from 'dist/packages/api/lib/network/type';
- export * from 'dist/packages/api/lib/network/profile';
-
-}
-declare module 'dist/packages/api/lib/plugin-manager/api' {
- import { StatusEvents, Profile } from '@remixproject/plugin-utils';
- export interface IPluginManager {
- events: {
- profileUpdated(profile: Profile): void;
- profileAdded(profile: Profile): void;
- pluginDeactivated(profile: Profile): void;
- pluginActivated(profile: Profile): void;
- } & StatusEvents;
- methods: {
- getProfile(name: string): Promise;
- updateProfile(profile: Partial): any;
- activatePlugin(name: string): any;
- deactivatePlugin(name: string): any;
- isActive(name: string): boolean;
- canCall(from: string, to: string, method: string, message?: string): any;
- };
- }
-
-}
-declare module 'dist/packages/api/lib/plugin-manager/profile' {
- import { IPluginManager } from 'dist/packages/api/lib/plugin-manager/api';
- import { LibraryProfile } from '@remixproject/plugin-utils';
- export const pluginManagerProfile: LibraryProfile & {
- name: 'manager';
- };
-
-}
-declare module 'dist/packages/api/lib/plugin-manager/index' {
- export * from 'dist/packages/api/lib/plugin-manager/api';
- export * from 'dist/packages/api/lib/plugin-manager/profile';
-
-}
-declare module 'dist/packages/api/lib/settings/api' {
- import { StatusEvents } from '@remixproject/plugin-utils';
- export interface ISettings {
- events: {} & StatusEvents;
- methods: {
- getGithubAccessToken(): string;
- };
- }
-
-}
-declare module 'dist/packages/api/lib/settings/profile' {
- import { ISettings } from 'dist/packages/api/lib/settings/api';
- import { LibraryProfile } from '@remixproject/plugin-utils';
- export const settingsProfile: LibraryProfile;
-
-}
-declare module 'dist/packages/api/lib/settings/index' {
- export * from 'dist/packages/api/lib/settings/api';
- export * from 'dist/packages/api/lib/settings/profile';
-
-}
-declare module 'dist/packages/api/lib/theme/types' {
- export interface Theme {
- url?: string;
- /** @deprecated Use brightness instead */
- quality?: 'dark' | 'light';
- brightness: 'dark' | 'light';
- colors: {
- surface: string;
- background: string;
- foreground: string;
- primary: string;
- primaryContrast: string;
- secondary?: string;
- secondaryContrast?: string;
- success?: string;
- successContrast?: string;
- warn: string;
- warnContrast: string;
- error: string;
- errorContrast: string;
- disabled: string;
- };
- breakpoints: {
- xs: number;
- sm: number;
- md: number;
- lg: number;
- xl: number;
- };
- fontFamily: string;
- /** A unit to multiply for margin & padding */
- space: number;
- }
- export interface ThemeUrls {
- light: string;
- dark: string;
- }
-
-}
-declare module 'dist/packages/api/lib/theme/api' {
- import { StatusEvents } from '@remixproject/plugin-utils';
- import { Theme } from 'dist/packages/api/lib/theme/types';
- export interface ITheme {
- events: {
- themeChanged: (theme: Theme) => void;
- } & StatusEvents;
- methods: {
- currentTheme(): Theme;
- };
- }
-
-}
-declare module 'dist/packages/api/lib/theme/profile' {
- import { ITheme } from 'dist/packages/api/lib/theme/api';
- import { LibraryProfile } from '@remixproject/plugin-utils';
- export const themeProfile: LibraryProfile;
-
-}
-declare module 'dist/packages/api/lib/theme/index' {
- export * from 'dist/packages/api/lib/theme/api';
- export * from 'dist/packages/api/lib/theme/profile';
- export * from 'dist/packages/api/lib/theme/types';
-
-}
-declare module 'dist/packages/api/lib/udapp/type' {
- export type RemixTxEvent = {
- contractAddress: string;
- data: string;
- envMode: 'vm';
- executionCost: string;
- from: string;
- gas: string;
- hash: string;
- input: string;
- logs: any[];
- returnValue: Uint8Array;
- status: '0x01' | '0x00';
- transactionCost: string;
- transactionHash: string;
- value: string;
- } | {
- blockHash: string;
- blockNumber: number;
- envMod: 'injected' | 'web3';
- from: string;
- gas: number;
- gasPrice: {
- c: number[];
- e: number;
- s: number;
- };
- hash: string;
- input: string;
- none: number;
- r: string;
- s: string;
- v: string;
- status: '0x01' | '0x00';
- to: string;
- transactionCost: string;
- transactionIndex: number;
- value: {
- c: number[];
- e: number;
- s: number;
- };
- };
- export interface RemixTx {
- data: string;
- from: string;
- to?: string;
- timestamp?: string;
- gasLimit: string;
- value: string;
- useCall: boolean;
- }
- export interface RemixTxReceipt {
- transactionHash: string;
- status: 0 | 1;
- gasUsed: string;
- error: string;
- return: string;
- createdAddress?: string;
- }
- export interface VMAccount {
- privateKey: string;
- balance: string;
- }
- export interface UdappSettings {
- selectedAccount: string;
- selectedEnvMode: 'vm' | 'injected' | 'web3';
- networkEnvironment: string;
- }
-
-}
-declare module 'dist/packages/api/lib/udapp/api' {
- import { RemixTx, RemixTxReceipt, RemixTxEvent, VMAccount, UdappSettings } from 'dist/packages/api/lib/udapp/type';
- import { StatusEvents } from '@remixproject/plugin-utils';
- export interface IUdapp {
- events: {
- newTransaction: (transaction: RemixTxEvent) => void;
- } & StatusEvents;
- methods: {
- sendTransaction(tx: RemixTx): RemixTxReceipt;
- getAccounts(): string[];
- createVMAccount(vmAccount: VMAccount): string;
- getSettings(): UdappSettings;
- setEnvironmentMode(env: 'vm' | 'injected' | 'web3'): void;
- };
- }
-
-}
-declare module 'dist/packages/api/lib/udapp/profile' {
- import { IUdapp } from 'dist/packages/api/lib/udapp/api';
- import { LibraryProfile } from '@remixproject/plugin-utils';
- export const udappProfile: LibraryProfile;
-
-}
-declare module 'dist/packages/api/lib/udapp/index' {
- export * from 'dist/packages/api/lib/udapp/api';
- export * from 'dist/packages/api/lib/udapp/type';
- export * from 'dist/packages/api/lib/udapp/profile';
-
-}
-declare module 'dist/packages/api/lib/unit-testing/type' {
- export interface UnitTestResult {
- totalFailing: number;
- totalPassing: number;
- totalTime: number;
- errors: UnitTestError[];
- }
- export interface UnitTestError {
- context: string;
- value: string;
- message: string;
- }
-
-}
-declare module 'dist/packages/api/lib/unit-testing/api' {
- import { UnitTestResult } from 'dist/packages/api/lib/unit-testing/type';
- import { StatusEvents } from '@remixproject/plugin-utils';
- export interface IUnitTesting {
- events: {} & StatusEvents;
- methods: {
- testFromPath(path: string): UnitTestResult;
- testFromSource(sourceCode: string): UnitTestResult;
- };
- }
-
-}
-declare module 'dist/packages/api/lib/unit-testing/profile' {
- import { IUnitTesting } from 'dist/packages/api/lib/unit-testing/api';
- import { LibraryProfile } from '@remixproject/plugin-utils';
- export const unitTestProfile: LibraryProfile;
-
-}
-declare module 'dist/packages/api/lib/unit-testing/index' {
- export * from 'dist/packages/api/lib/unit-testing/api';
- export * from 'dist/packages/api/lib/unit-testing/type';
- export * from 'dist/packages/api/lib/unit-testing/profile';
-
-}
-declare module 'dist/packages/api/lib/window/api' {
- import { StatusEvents } from '@remixproject/plugin-utils';
- export interface IWindow {
- events: {} & StatusEvents;
- methods: {
- /** Display an input window */
- prompt(message?: string): string;
- /** Ask confirmation for an action */
- confirm(message: string): boolean;
- /** Display a message with actions button. Returned the button clicked if any */
- alert(message: string, actions?: string[]): string | void;
- };
- }
-
-}
-declare module 'dist/packages/api/lib/window/profile' {
- import { IWindow } from 'dist/packages/api/lib/window/api';
- import { LibraryProfile } from '@remixproject/plugin-utils';
- export const windowProfile: LibraryProfile;
-
-}
-declare module 'dist/packages/api/lib/window/index' {
- export * from 'dist/packages/api/lib/window/api';
- export * from 'dist/packages/api/lib/window/profile';
-
-}
-declare module 'dist/packages/api/lib/remix-profile' {
- import { ProfileMap } from '@remixproject/plugin-utils';
- import { ICompiler } from 'dist/packages/api/lib/compiler';
- import { IFileSystem } from 'dist/packages/api/lib/file-system';
- import { IEditor } from 'dist/packages/api/lib/editor';
- import { INetwork } from 'dist/packages/api/lib/network';
- import { IUdapp } from 'dist/packages/api/lib/udapp';
- import { ITheme } from 'dist/packages/api/lib/theme';
- import { IUnitTesting } from 'dist/packages/api/lib/unit-testing';
- import { IContentImport } from 'dist/packages/api/lib/content-import';
- import { ISettings } from 'dist/packages/api/lib/settings';
- import { IPluginManager } from 'dist/packages/api/lib/plugin-manager';
- export interface IRemixApi {
- manager: IPluginManager;
- solidity: ICompiler;
- fileManager: IFileSystem;
- solidityUnitTesting: IUnitTesting;
- editor: IEditor;
- network: INetwork;
- udapp: IUdapp;
- contentImport: IContentImport;
- settings: ISettings;
- theme: ITheme;
- }
- export type RemixApi = Readonly;
- /** @deprecated Use remixProfiles instead. Will be remove in next version */
- export const remixApi: ProfileMap;
- /** Profiles of all the remix's Native Plugins */
- export const remixProfiles: ProfileMap;
-
-}
-declare module 'dist/packages/api/lib/standard-profile' {
- import { ProfileMap } from '@remixproject/plugin-utils';
- import { ICompiler } from 'dist/packages/api/lib/compiler';
- import { IFileSystem } from 'dist/packages/api/lib/file-system';
- import { IEditor } from 'dist/packages/api/lib/editor';
- import { INetwork } from 'dist/packages/api/lib/network';
- import { IUdapp } from 'dist/packages/api/lib/udapp';
- import { IPluginManager } from 'dist/packages/api/lib/plugin-manager';
- export interface IStandardApi {
- manager: IPluginManager;
- solidity: ICompiler;
- fileManager: IFileSystem;
- editor: IEditor;
- network: INetwork;
- udapp: IUdapp;
- }
- export type StandardApi = Readonly;
- /** Profiles of all the standard's Native Plugins */
- export const standardProfiles: ProfileMap;
-
-}
-declare module 'dist/packages/api/index' {
- export * from 'dist/packages/api/lib/compiler';
- export * from 'dist/packages/api/lib/content-import';
- export * from 'dist/packages/api/lib/editor';
- export * from 'dist/packages/api/lib/file-system';
- export * from 'dist/packages/api/lib/git';
- export * from 'dist/packages/api/lib/network';
- export * from 'dist/packages/api/lib/plugin-manager';
- export * from 'dist/packages/api/lib/settings';
- export * from 'dist/packages/api/lib/theme';
- export * from 'dist/packages/api/lib/udapp';
- export * from 'dist/packages/api/lib/unit-testing';
- export * from 'dist/packages/api/lib/window';
- export * from 'dist/packages/api/lib/remix-profile';
- export * from 'dist/packages/api/lib/standard-profile';
-
-}
-declare module 'dist/packages/engine/core/lib/abstract' {
- import type { Api, EventKey, EventParams, MethodKey, MethodParams, EventCallback, ApiMap, Profile, PluginRequest, PluginApi, PluginBase, IPluginService } from '@remixproject/plugin-utils';
- export interface RequestParams {
- name: string;
- key: string;
- payload: any[];
- }
- export interface PluginOptions {
- /** The time to wait for a call to be executed before going to next call in the queue */
- queueTimeout?: number;
- }
- export class Plugin implements PluginBase {
- profile: Profile;
- activateService: Record Promise>;
- protected requestQueue: Array<() => Promise>;
- protected currentRequest: PluginRequest;
- /** Give access to all the plugins registered by the engine */
- protected app: PluginApi;
- protected options: PluginOptions;
- onRegistration?(): void;
- onActivation?(): void;
- onDeactivation?(): void;
- constructor(profile: Profile);
- get name(): string;
- get methods(): Extract[];
- set methods(methods: Extract[]);
- activate(): any | Promise;
- deactivate(): any | Promise;
- setOptions(options?: Partial): void;
- /** Call a method from this plugin */
- protected callPluginMethod(key: string, args: any[]): any;
- /** Add a request to the list of current requests */
- protected addRequest(request: PluginRequest, method: Profile['methods'][number], args: any[]): Promise;
- /**
- * Ask the plugin manager if current request can call a specific method
- * @param method The method to call
- * @param message An optional message to show to the user
- */
- askUserPermission(method: MethodKey, message?: string): Promise;
- /**
- * Called by the engine when a plugin try to activate it
- * @param from the profile of the plugin activating this plugin
- * @param method method used to activate this plugin if any
- */
- canActivate(from: Profile, method?: string): Promise;
- /**
- * Called by the engine when a plugin try to deactivate it
- * @param from the profile of the plugin deactivating this plugin
- */
- canDeactivate(from: Profile): Promise;
- /**
- * Create a service under the client node
- * @param name The name of the service
- * @param service The service
- */
- createService>(name: string, service: S): Promise>;
- /**
- * Prepare a service to be lazy loaded
- * @param name The name of the subservice inside this service
- * @param factory A function to create the service on demand
- */
- prepareService>(name: string, factory: () => S): () => Promise>;
- /** Listen on an event from another plugin */
- on, Key extends EventKey>(name: Name, key: Key, cb: EventCallback): void;
- /** Listen once an event from another plugin then remove event listener */
- once, Key extends EventKey>(name: Name, key: Key, cb: EventCallback): void;
- /** Stop listening on an event from another plugin */
- off, Key extends EventKey>(name: Name, key: Key): void;
- /** Call a method of another plugin */
- call, Key extends MethodKey>(name: Name, key: Key, ...payload: MethodParams): Promise>;
- /** Emit an event */
- emit>(key: Key, ...payload: EventParams): void;
- }
-
-}
-declare module 'dist/packages/engine/core/lib/connector' {
- import type { ExternalProfile, Profile, Message } from '@remixproject/plugin-utils';
- import { Plugin, PluginOptions } from 'dist/packages/engine/core/lib/abstract';
- /** List of available gateways for decentralised storage */
- export const defaultGateways: {
- 'ipfs://': (url: any, name: any) => string;
- 'swarm://': (url: any, name: any) => string;
- };
- /** Transform the URL to use a gateway if decentralised storage is specified */
- export function transformUrl({ url, name }: Profile & ExternalProfile): any;
- export interface PluginConnectorOptions extends PluginOptions {
- /** Usally used to reload the plugin on changes */
- devMode?: boolean;
- transformUrl?: (profile: Profile & ExternalProfile) => string;
- engine?: string;
- }
- export abstract class PluginConnector extends Plugin {
- protected loaded: boolean;
- protected id: number;
- protected pendingRequest: Record void>;
- protected options: PluginConnectorOptions;
- profile: Profile & ExternalProfile;
- constructor(profile: Profile & ExternalProfile);
- /**
- * Send a message to the external plugin
- * @param message the message passed to the plugin
- */
- protected abstract send(message: Partial): void;
- /**
- * Open connection with the plugin
- * @param url The transformed url the plugin should connect to
- */
- protected abstract connect(url: string): any | Promise;
- /** Close connection with the plugin */
- protected abstract disconnect(): any | Promise;
- activate(): Promise;
- deactivate(): Promise;
- /** Set options for an external plugin */
- setOptions(options?: Partial): void;
- /** Call a method from this plugin */
- protected callPluginMethod(key: string, payload?: any[]): Promise;
- /** Perform handshake with the client if not loaded yet */
- protected handshake(handshakeSpecificPayload?: string[]): Promise;
- /**
- * React when a message comes from client
- * @param message The message sent by the client
- */
- protected getMessage(message: Message): Promise;
- }
-
-}
-declare module 'dist/packages/engine/core/lib/engine' {
- import type { Profile } from '@remixproject/plugin-utils';
- import { Plugin, PluginOptions } from 'dist/packages/engine/core/lib/abstract';
- export class Engine {
- private plugins;
- private events;
- private listeners;
- private eventMemory;
- private manager;
- onRegistration?(plugin: Plugin): void;
- /** Update the options of the plugin when being registered */
- setPluginOption?(profile: Profile): PluginOptions;
- /**
- * Broadcast an event to the plugin listening
- * @param emitter Plugin name that emits the event
- * @param event The name of the event
- * @param payload The content of the event
- */
- private broadcast;
- /**
- * Start listening on an event from another plugin
- * @param listener The name of the plugin that listen on the event
- * @param emitter The name of the plugin that emit the event
- * @param event The name of the event
- * @param cb Callback function to trigger when the event is trigger
- */
- private addListener;
- /**
- * Remove an event from the list of a listener's events
- * @param listener The name of the plugin that was listening on the event
- * @param emitter The name of the plugin that emitted the event
- * @param event The name of the event
- */
- private removeListener;
- /**
- * Create a listener that listen only once on an event
- * @param listener The name of the plugin that listen on the event
- * @param emitter The name of the plugin that emitted the event
- * @param event The name of the event
- * @param cb Callback function to trigger when event is triggered
- */
- private listenOnce;
- /**
- * Call a method of a plugin from another
- * @param caller The name of the plugin that calls the method
- * @param path The path of the plugin that manages the method
- * @param method The name of the method
- * @param payload The argument to pass to the method
- */
- private callMethod;
- /**
- * Create an object to easily access any registered plugin
- * @param name Name of the caller plugin
- * @note This method creates a snapshot at the time of activation
- */
- private createApp;
- /**
- * Activate a plugin by making its method and event available
- * @param name The name of the plugin
- * @note This method is trigger by the plugin manager when a plugin has been activated
- */
- private activatePlugin;
- /**
- * Deactivate a plugin by removing all its event listeners and making it inaccessible
- * @param name The name of the plugin
- * @note This method is trigger by the plugin manager when a plugin has been deactivated
- */
- private deactivatePlugin;
- /**
- * Update error message when trying to call a method when not activated
- * @param plugin The deactivated plugin to update the methods from
- */
- private updateErrorHandler;
- /**
- * Register a plugin to the engine and update the manager
- * @param plugin The plugin
- */
- register(plugins: Plugin | Plugin[]): string | string[];
- /** Register the manager */
- private registerManager;
- /** Remove plugin(s) from engine */
- remove(names: string | string[]): Promise | Promise;
- /**
- * Check is a name is already registered
- * @param name Name of the plugin
- */
- isRegistered(name: string): boolean;
- }
-
-}
-declare module 'dist/packages/engine/core/lib/library' {
- import type { EventEmitter } from 'events';
- import type { Api, Profile, LibraryProfile, LocationProfile } from '@remixproject/plugin-utils';
- import { Plugin } from 'dist/packages/engine/core/lib/abstract';
- export type LibraryApi = {
- [method in P['methods'][number]]: T['methods'][method];
- } & {
- events?: EventEmitter;
- } & {
- render?(): Element;
- }; type LibraryViewProfile = LocationProfile & LibraryProfile;
- export function isViewLibrary(profile: any): profile is LibraryViewProfile;
- export class LibraryPlugin extends Plugin {
- protected library: LibraryApi;
- profile: P;
- private isView;
- constructor(library: LibraryApi, profile: P);
- activate(): Promise;
- deactivate(): void;
- /** Call a method from this plugin */
- protected callPluginMethod(key: string, payload: any[]): any;
- }
- export {};
-
-}
-declare module 'dist/packages/engine/core/lib/manager' {
- import type { Profile } from '@remixproject/plugin-utils';
- import { Plugin } from 'dist/packages/engine/core/lib/abstract';
- export type BasePluginManager = {
- getProfile(name: string): Promise;
- updateProfile(profile: Partial): Promise;
- activatePlugin(name: string): Promise;
- deactivatePlugin(name: string): Promise;
- isActive(name: string): Promise;
- canCall(from: Profile, to: Profile, method: string): Promise;
- toggleActive(name: string): any;
- addProfile(profiles: Partial | Partial[]): any;
- canActivatePlugin(from: Profile, to: Profile, method?: string): Promise;
- canDeactivatePlugin(from: Profile, to: Profile): Promise;
- } & Plugin;
- interface ManagerProfile extends Profile {
- name: 'manager';
- }
- export class PluginManager extends Plugin implements BasePluginManager {
- protected profiles: Record;
- protected actives: string[];
- protected onPluginActivated?(profile: Profile): any;
- protected onPluginDeactivated?(profile: Profile): any;
- protected onProfileAdded?(profile: Profile): any;
- constructor(profile?: ManagerProfile);
- /** Return the name of the caller. If no request provided, this mean that the method has been called from the IDE so we use "manager" */
- get requestFrom(): string;
- /** Run engine activation. Implemented by Engine */
- private engineActivatePlugin;
- /** Run engine deactivation. Implemented by Engine */
- private engineDeactivatePlugin;
- /**
- * Get the profile if it's registered.
- * @param name The name of the plugin
- * @note This method can be overrided
- */
- getProfile(name: string): Promise>;
- /** Get all the profiles of the manager */
- getProfiles(): Profile[];
- /** Get all active profiles of the manager */
- getActiveProfiles(): Profile[];
- /**
- * Update the profile of the plugin
- * @param profile The Updated version of the plugin
- * @note Only the caller plugin should be able to update its profile
- */
- updateProfile(to: Partial): Promise;
- /**
- * Add a profile to the list of profile
- * @param profile The profile to add
- * @note This method should only be used by the engine
- */
- addProfile(profiles: Profile | Profile[]): void | void[];
- /**
- * Verify if a plugin is currently active
- * @param name Name of the plugin
- */
- isActive(name: string): Promise;
- /**
- * Check if caller can activate plugin and activate it if authorized
- * @param name The name of the plugin to activate
- */
- activatePlugin(names: string | string[]): Promise;
- /**
- * Check if caller can deactivate plugin and deactivate it if authorized
- * @param name The name of the plugin to activate
- */
- deactivatePlugin(names: string | string[]): Promise;
- /**
- * Activate or deactivate by bypassing permission
- * @param name The name of the plugin to activate
- * @note This method should ONLY be used by the IDE
- */
- toggleActive(names: string | string[]): Promise;
- /**
- * Check if a plugin can activate another
- * @param from Profile of the caller plugin
- * @param to Profile of the target plugin
- * @note This method should be overrided
- */
- canActivatePlugin(from: Profile, to: Profile): Promise;
- /**
- * Check if a plugin can deactivate another
- * @param from Profile of the caller plugin
- * @param to Profile of the target plugin
- * @note This method should be overrided
- */
- canDeactivatePlugin(from: Profile, to: Profile): Promise;
- /**
- * Check if a plugin can call a method of another
- * @param from Profile of the caller plugin
- * @param to Profile of the target plugin
- * @param method Method targetted by the caller
- * @param message Method provided by the targetted method plugin
- */
- canCall(from: Profile, to: Profile, method: string, message?: string): Promise;
- /**
- * Check if a plugin can update profile of another one
- * @param from Profile of the caller plugin
- * @param to Updates on the profile of the target plugin
- * @note This method can be overrided
- */
- canUpdateProfile(from: Profile, to: Partial): Promise;
- }
- export {};
-
-}
-declare module 'dist/packages/engine/core/index' {
- export * from 'dist/packages/engine/core/lib/abstract';
- export * from 'dist/packages/engine/core/lib/connector';
- export * from 'dist/packages/engine/core/lib/engine';
- export * from 'dist/packages/engine/core/lib/library';
- export * from 'dist/packages/engine/core/lib/manager';
-
-}
-declare module 'packages/engine/core/src/lib/abstract' {
- import type { Api, EventKey, EventParams, MethodKey, MethodParams, EventCallback, ApiMap, Profile, PluginRequest, PluginApi, PluginBase, IPluginService, PluginOptions } from '@remixproject/plugin-utils';
- import { PluginQueueItem } from '@remixproject/plugin-utils';
- export interface RequestParams {
- name: string;
- key: string;
- payload: any[];
- }
- export class Plugin implements PluginBase {
- profile: Profile;
- activateService: Record Promise>;
- protected currentRequest: PluginRequest;
- /** Give access to all the plugins registered by the engine */
- protected app: PluginApi;
- protected options: PluginOptions;
- protected queue: PluginQueueItem[];
- onRegistration?(): void;
- onActivation?(): void;
- onDeactivation?(): void;
- constructor(profile: Profile);
- get name(): string;
- get methods(): Extract[];
- set methods(methods: Extract[]);
- activate(): any | Promise;
- deactivate(): any | Promise;
- setOptions(options?: Partial): void;
- /** Call a method on this plugin */
- protected callPluginMethod(key: string, args: any[]): any;
- protected setCurrentRequest(request: PluginRequest): void;
- protected letContinue(): void;
- /** Add a request to the list of current requests */
- protected addRequest(request: PluginRequest, method: Profile['methods'][number], args: any[]): Promise;
- protected cancelRequests(request: PluginRequest, method: Profile['methods'][number]): void;
- /**
- * Ask the plugin manager if current request can call a specific method
- * @param method The method to call
- * @param message An optional message to show to the user
- */
- askUserPermission(method: MethodKey, message?: string): Promise;
- /**
- * Called by the engine when a plugin try to activate it
- * @param from the profile of the plugin activating this plugin
- * @param method method used to activate this plugin if any
- */
- canActivate(from: Profile, method?: string): Promise;
- /**
- * Called by the engine when a plugin try to deactivate it
- * @param from the profile of the plugin deactivating this plugin
- */
- canDeactivate(from: Profile): Promise;
- /**
- * Create a service under the client node
- * @param name The name of the service
- * @param service The service
- */
- createService>(name: string, service: S): Promise>;
- /**
- * Prepare a service to be lazy loaded
- * @param name The name of the subservice inside this service
- * @param factory A function to create the service on demand
- */
- prepareService>(name: string, factory: () => S): () => Promise>;
- /** Listen on an event from another plugin */
- on, Key extends EventKey>(name: Name, key: Key, cb: EventCallback): void;
- /** Listen once an event from another plugin then remove event listener */
- once, Key extends EventKey>(name: Name, key: Key, cb: EventCallback): void;
- /** Stop listening on an event from another plugin */
- off, Key extends EventKey>(name: Name, key: Key): void;
- /** Call a method of another plugin */
- call, Key extends MethodKey>(name: Name, key: Key, ...payload: MethodParams): Promise>;
- /** Cancel a method of another plugin */
- cancel, Key extends MethodKey>(name: Name, key: Key): Promise>;
- /** Emit an event */
- emit>(key: Key, ...payload: EventParams): void;
- }
-
-}
-declare module 'packages/engine/core/src/lib/connector' {
- import type { ExternalProfile, Profile, Message, PluginOptions } from '@remixproject/plugin-utils';
- import { Plugin } from 'packages/engine/core/src/lib/abstract';
- /** List of available gateways for decentralised storage */
- export const defaultGateways: {
- 'ipfs://': (url: any, name: any) => string;
- 'swarm://': (url: any, name: any) => string;
- };
- /** Transform the URL to use a gateway if decentralised storage is specified */
- export function transformUrl({ url, name }: Profile & ExternalProfile): any;
- export interface PluginConnectorOptions extends PluginOptions {
- /** Usally used to reload the plugin on changes */
- devMode?: boolean;
- transformUrl?: (profile: Profile & ExternalProfile) => string;
- engine?: string;
- }
- export abstract class PluginConnector extends Plugin {
- protected loaded: boolean;
- protected id: number;
- protected pendingRequest: Record void>;
- protected options: PluginConnectorOptions;
- profile: Profile & ExternalProfile;
- constructor(profile: Profile & ExternalProfile);
- /**
- * Send a message to the external plugin
- * @param message the message passed to the plugin
- */
- protected abstract send(message: Partial): void;
- /**
- * Open connection with the plugin
- * @param url The transformed url the plugin should connect to
- */
- protected abstract connect(url: string): any | Promise;
- /** Close connection with the plugin */
- protected abstract disconnect(): any | Promise;
- activate(): Promise;
- deactivate(): Promise;
- /** Set options for an external plugin */
- setOptions(options?: Partial): void;
- /** Call a method from this plugin */
- protected callPluginMethod(key: string, payload?: any[]): Promise;
- /** Perform handshake with the client if not loaded yet */
- protected handshake(): Promise;
- /**
- * React when a message comes from client
- * @param message The message sent by the client
- */
- protected getMessage(message: Message): Promise