This commit introduces a new feature that enables users to calculate Smart Contract
constructor arguments lazily using an (async) function. Similar to normal Smart Contract
configurations, the return or resolved value from that function has to be either a list
of arguments in the order as they are needed for the constructor, or as an object with
named members that match the arguments individually.
```
...
development: {
deploy: {
SimpleStorage: {
args: async ({ contracts, web3, logger}) => {
// do something with `contracts` and `web3` to determine
// arguments
let someValue = await ...;
return [someValue];
// or
return {
initialValue: someValue
};
}
}
}
}
...
```
Closes#2270
feat(@embark/utils): add method to verify if a plugin is installed & configured
feature(@embark/utils): add method to verify if a plugin is installed & configured
feature: warn about packages that will be independent plugins and are not configured
chore: update templates to specify plugins
refactor: add to plugin api params so that blockchain plugins no longer need to be passed options
address changes in code review
remove unneded space
Update packages/core/utils/src/index.ts
Co-Authored-By: Jonathan Rainville <rainville.jonathan@gmail.com>
Update packages/core/utils/src/index.ts
Co-Authored-By: Michael Bradley <michaelsbradleyjr@gmail.com>
fix linting issue
add missing import
remove optional plugins from coming as default
Revert "chore: update hooks examples to destructure dependencies object"
This reverts commit 448eab724b.
remove trailing comma
fix linting issue
include tsconfig
The profiler was not formatted correctly in the console as `util.inspect` was being applied to the ASCII table before being output to the console REPL.
In addition, functions containing solidity assertions (require, revert, assert) that cause the function to fail when estimating gas would print an error to embark’s console log, and would show nothing as their gas estimate in the table.
Do not `util.inspect` command output if the result is a string. For API commands being run, allow the command to specify whether or not the output of the command should be HTML escaped. This could pose security risks!
For functions that have errors during gas estimation, add a message in the embark console explaining that the error may be due to solidity assertions in the function that prevent the gas from being estimated correctly. For functions that error, show `-ERROR-` in the gas estimation column. Additionally, show a description in the table footer explaining that the error may be due to solidity assertions in the function.
For events with no gas estimate, show `-EVENT-` in the gas estimate column of the profile table, and a description in the table footer explaining that there is no gas estimate for events.
### Warnings
This PR allows the console command to specify whether or not it should allow for a string result of the command to be HTML-escaped before being sent in the API response. Combining this with Cockpit’s `dangerouslySetInnerHTML`, this could allow a plugin to register a console command that injects XSS in to Cockpit.
![Imgur](https://i.imgur.com/1Rqkjyx.png)
![Imgur](https://i.imgur.com/s6Y1Ecy.png)
![Imgur](https://i.imgur.com/BhsjkBs.png)
Many packages in the monorepo did not specify all of their dependencies; they
were effectively relying on resolution in the monorepo's root
`node_modules`. In a production release of `embark` and `embark[js]-*` packages
this can lead to broken packages.
To fix the problem currently and to help prevent it from happening again, make
use of the `eslint-plugin-import` package's `import/no-extraneous-dependencies`
and `import/no-unresolved` rules. In the root `tslint.json` set
`"no-implicit-dependencies": true`, wich is the tslint equivalent of
`import/no-extraneous-dependencies`; there is no tslint equivalent for
`import/no-unresolved`, but we will eventually replace tslint with an eslint
configuration that checks both `.js` and `.ts` files.
For `import/no-unresolved` to work in our monorepo setup, in most packages add
an `index.js` that has:
```js
module.exports = require('./dist'); // or './dist/lib' in some cases
```
And point `"main"` in `package.json` to `"./index.js"`. Despite what's
indicated in npm's documentation for `package.json`, it's also necessary to add
`"index.js"` to the `"files"` array.
Make sure that all `.js` files that can and should be linted are in fact
linted. For example, files in `packages/embark/src/cmd/` weren't being linted
and many test suites weren't being linted.
Bump all relevant packages to `eslint@6.8.0`.
Fix all linter errors that arose after these changes.
Implement a `check-yarn-lock` script that's run as part of `"ci:full"` and
`"qa:full"`, and can manually be invoked via `yarn cylock` in the root of the
monorepo. The script exits with error if any specifiers are found in
`yarn.lock` for `embark[js][-*]` and/or `@embarklabs/*` (with a few exceptions,
cf. `scripts/check-yarn-lock.js`).
`.deploy()` is an alias to `.new()` and in other tools also no longer used
as API to deploy instances. In addition, we don't want it to shadow the
original web3 `deploy()` API which actually caused a breeaking change.