Commit Graph

503 Commits

Author SHA1 Message Date
Michael Bradley, Jr ee17ab03e0 style: use comments to avoid confusion about @types/embark imports
We could use similar comments for imports related to other `@types` packages,
but the need to do it for `@types/embark` (located in
`packages/embark-typings`) seems more pressing since `import ... from "embark"`
statements in the monorepo can be so easily misunderstood.

Note that the comments, and indeed the whole lines, are automatically erased
during babel transpilation of TypeScript since TS types aren't relevant after
the `.js` files are built.
2019-05-02 20:34:22 -05:00
Michael Bradley, Jr e74e52e924 build: make package.json scripts consistently en/dis-abled 2019-05-02 20:34:01 -05:00
Michael Bradley, Jr d5c984c592 build: use babel cli's `--extensions` consistently in all packages
If a package uses only `.js` then supply `--extensions ".js"`. If a package
uses only `.ts` then supply `--extensions ".ts"`. If a package uses both, then
supply `--extensions ".js,.ts"`.

The reason for this is that adding/removing TS/JS support ought to occasion
revising a package's `package.json` file and adjusting other scripts as well,
e.g. for linting. With these changes, it won't work to simply start adding
`.ts` files in a package's `src/` directory, which should prompt the developer
to review `package.json` and make the appropriate changes, and/or other
developers may realize changes need to be made during code review.
2019-05-02 20:33:42 -05:00
Michael Bradley, Jr 142130e533 build: bump typescript in all relevant pkgs from v3.3.1 to v3.4.5
The more recent version of TypeScript works around a [problem][chalk-problem]
encountered with the chalk package's type definitions.

[chalk-problem]: https://github.com/chalk/chalk/pull/296#issuecomment-418789492
2019-05-02 20:24:02 -05:00
Michael Bradley, Jr ae8ec69dc9 fix(@embark/api): specify colors package as a dependency 2019-05-02 11:10:24 -04:00
Michael Bradley, Jr 2d2281999d fix(@embark/library-manager): specify colors package as a dependency 2019-05-02 11:10:05 -04:00
Iuri Matias a12769fd30 bugfix(@embark/embark): import colors do type string has missing properties 2019-05-02 10:02:47 -04:00
Pascal Precht 244e2e2fb1
fix(@embark/utils): expose longRunningProcessTimer properly
This seemed to have slipped through when reviewing 94c7ab3e12
2019-05-02 12:52:05 +02:00
Pascal Precht dd898f0c7a refactor(@embark/utils): move web3 dependent functions into web3Utils 2019-05-02 12:07:19 +02:00
Pascal Precht baf6f20066 refactor(@embark/test-runner): move test module into test-runner package 2019-05-02 12:07:19 +02:00
Pascal Precht 03d779ef5e refactor(@embark/utils): move transaction utils into utils package 2019-05-02 12:07:19 +02:00
Pascal Precht 7174f55c6c refactor(@embark/utils): move decodeParams and sha3 into web3Utils 2019-05-02 12:07:19 +02:00
Pascal Precht 6fbc1afbd1 refactor(@embark/utils): move accountParser into utils 2019-05-02 12:07:19 +02:00
Pascal Precht e8408ece75 refactor(@embark/utils): move web3 helper functions into web3Utils file 2019-05-02 12:07:19 +02:00
Pascal Precht 5c3f39442b refactor(@embark/utils): move getHexBalanceFromString to utils package 2019-05-02 12:07:19 +02:00
Pascal Precht e3aed6a423 refactor(@embark/utils): move getWeiBalanceFromString and contractsConfig.prepare into utils
This also renames `prepare` to `prepareContractsConfig` to make it less ambiguous.
2019-05-02 12:07:19 +02:00
Pascal Precht 93568ad911 refactor(@embark/utils): move unitRegex into utils package 2019-05-02 12:07:19 +02:00
Pascal Precht b9fe741585 refactor(@embark/utils): move timer and deconstructUrl helper functions 2019-05-02 12:07:19 +02:00
Andre Medeiros a75fa7941f fix: parity origins 2019-05-02 10:43:56 +02:00
Pascal Precht 94c7ab3e12 refactor(@embark/library_manager): move library manager into own package 2019-05-02 10:42:49 +02:00
Pascal Precht 6308c82993 refactor(@embark/embark-utils): move last fn into utils package 2019-05-02 10:42:49 +02:00
Michael Bradley, Jr fbfe376101 fix(@embark/api): import colors pkg so type string has .stripColors 2019-05-01 12:06:16 -05:00
Iuri Matias 086b3a3877 refactor (@embark/embark-api): move embark-api to its own module 2019-05-01 07:24:19 -04:00
Michael Bradley, Jr 436cfcbca0 refactor(@embark/contracts-manager): move contracts_manager into embark-contracts-manager package 2019-04-30 13:03:48 -05:00
Michael Bradley, Jr 65f3a270c0 refactor(@embark/utils): move proposeAlternative, toposort into embark-utils package 2019-04-30 12:39:33 -05:00
Michael Bradley, Jr 60ff097406 refactor(@embark/core): create embark-core package, move constants into embark-core 2019-04-30 12:11:25 -05:00
Jonathan Rainville d386bffda9 refactor(@embark/authenticator): move authenticator to a package 2019-04-30 12:06:54 -04:00
Jonathan Rainville bcd006a1cf refactor(@embark/utils): move copyToCliboard to embark-utils 2019-04-30 12:06:54 -04:00
Michael Bradley, Jr ad01d1402c test: collect code coverage in the root of the monorepo
Implement scripts to collect coverage reports (JSON format) from all packages
in the monorepo that generate such reports. Reports are copied to
`<root>/.nyc_output/coverage-[pkg-dir-name].json`.

Implement scripts to generate a combined html report in `<root>/coverage`.

Adjust root `reset` and `clean` scripts to delete `<root>/.nyc_output` and
`<root>/coverage`.

Implement a script in `<root>/package.json` to generate a `text-lcov` report
and upload it to coveralls from CI builds. Remove coveralls from
`packages/embark`.

Supply `packages/embark` with an nyc configuration in its `package.json` and
have its `"test":` script generate both `json` and `html` reports.

Use nyc with `embarkjs`'s test suite: supply an nyc configuration in its
`package.json` and have its `"test":` script generate both `json` and `html`
reports.

Adjust `embarkjs`'s tests for more accurate coverage reporting.
2019-04-30 12:04:01 -04:00
emizzle 0c394fea29 feat(@embark/webserver): Add support for `service webserver on/off`
Add support for `service webserver on/off` commands.

Deprecate commands `webserver start/stop` in favor of `service webserver on/off`.

Handles passing through of arguments to the function executed after process launch.

`service webserver on` - Enables the webserver serving the DApp. Shows an error if the webserver is already starting or started.

`service webserver off` - Disables the webserver serving the DApp. Shows an error if the webserver is already stopping or stopped.

`webserver start` - This command has been deprecated in favor of `service webserver on` and will be removed in future versions.

`webserver stop` - This command has been deprecated in favor of `service webserver off` and will be removed in future versions.
2019-04-30 12:02:02 -04:00
Jonathan Rainville 7495095d49 refactor(@embark/ens): move ens module to embark-ens package 2019-04-30 16:31:07 +02:00
Jonathan Rainville 8506778384 refactor(@embark/utils): move addressUtils to embark-utils 2019-04-30 16:31:07 +02:00
Jonathan Rainville 7eb85f0fbe fix(@embark/specialconfig): fix undefined contract name in onDeploy 2019-04-30 08:37:46 -04:00
Michael Bradley, Jr 33ee6d8d35 test: disable test script for packages without any tests
Several `embarkjs-*` packages specify a `"test":` script in their respective
`package.json` files but lack any tests, causing `yarn test` in the root of the
monorepo to fail. For now, disable those scripts.
2019-04-29 09:04:13 -05:00
Pascal Precht a874c38d72 refactor(@embark/embark-logger): move logger into own package 2019-04-29 13:00:10 +02:00
Pascal Precht 69ced6d894 refactor(@embark/embark-scaffolding): introduce new embark-scaffolding package 2019-04-29 12:06:59 +02:00
Pascal Precht c9e335ea21 refactor(@embark/embark-utils): move runCmd utility to utils package 2019-04-29 12:06:59 +02:00
Jonathan Rainville 70a528c296 refactor: move process-logs-api to its own packages 2019-04-26 12:37:19 -04:00
Pascal Precht e1f80eb1be refactor: move watcher into embark-watcher package 2019-04-26 16:45:52 +02:00
Jonathan Rainville 83b0a68eef refactor(@embark-utils): move logHandler and normalizeInput in utils 2019-04-26 16:38:19 +02:00
Jonathan Rainville 483f692e0b refactor(@embark-utils): move escapHtml to embark-utils 2019-04-26 16:38:19 +02:00
Pascal Precht 2464fb69af
Revert "refactor: move env module into own embark-env package"
This reverts commit 4f8734f19b.
2019-04-25 17:35:40 +02:00
Jonathan Rainville d5c3a9cf1d fix(@embark/console): fix cockpit console if using console command 2019-04-25 10:58:00 -04:00
Pascal Precht 4f8734f19b refactor: move env module into own embark-env package 2019-04-25 16:29:04 +02:00
Pascal Precht 0260154804 refactor(@embark/utils): move sha512 util into embark-utils package 2019-04-25 15:26:56 +02:00
Jonathan Rainville fa0220c950 refactor(@embark/embark-trasaction-tracker): move tx tracker to pck 2019-04-24 18:39:26 -04:00
Andre Medeiros c51ec5029b fix: dashboard auto complete 2019-04-24 18:38:51 -04:00
Andre Medeiros ea7ae22501 fix: improve wording on contract constructor failing 2019-04-24 18:38:15 -04:00
emizzle 7a76516534 feat(@embark/blockchain): Restart Ethereum via command
Add support for `service blockchain on/off` in the console.

Add service on/off command for each process started by, ie `service blockchain on/off` and `service whisper on/off`.

`service blockchain off` - Kills the blockchain process, stops the web3 provider, and shuts down the proxy (if used). In the case of `embark blockchain`, the entire process is exited.

`service blockchain on` - Starts the blockchain process *as a child process of the main embark process* then starts the web3 provider. This happens regardless of whether or not it was initially started with `embark blockchain` (see known issues).

## Known issues
1. If the blockchain process was started with `embark blockchain`, and then the blockchain process is killed with the `service blockchain off` command, when the blockchain process is restarted with `service blockchain on`, it will be restarted as a child process of the main embark process. It may be possible to allow for the blockchain process to be restarted in the same process it was originally started in, however this will take more development effort and can be handled in a different PR.
2. Parity has not been tested as it is currently not working in the master branch.
3. This PR adds a generic registration of commands for each process, ie `service whisper on/off`, however the only supported command is the `service blockchain on/off` command. Further support for other commands can be handled in separate PRs.
2019-04-24 18:37:15 -04:00
Pascal Precht bf0f4392a4 fix(@embark/deployment): only log error when error exists
This was a regression introduced in 72fc80df53
2019-04-23 12:18:34 +02:00
Andre Medeiros 740196684c fix: update solidity-parser-antlr to allow the use of the payable keyword in contracts 2019-04-22 11:44:32 -04:00
Andre Medeiros 0f4e554b22 fix: make coverage more forgiving 2019-04-22 11:44:32 -04:00
Jonathan Rainville 6b16f668e0 fix(embark/generator): add empty line to embarkjs 2019-04-19 12:34:26 -04:00
Jonathan Rainville 1ae0ab6b1f fix(embark/generator): add back environment to EmbarkJS 2019-04-17 17:59:27 -04:00
Michael Bradley, Jr 579328a9f4 chore(release): 4.1.0-beta.0 2019-04-17 11:11:28 -05:00
Iuri Matias 626aa5daf1 [CHERRY PICKED] chore(release): 4.0.2 2019-04-17 10:30:30 -05:00
Jonathan Rainville ae88cc612d feat(@embark/generator): transpile embarkjs.js to be used by node 2019-04-17 10:30:18 -05:00
Iuri Matias 79d96c3b4c refactor (@embark/embark-utils): move recursiveMerge to embark-utils 2019-04-17 10:30:04 -05:00
Pascal Precht 42aebb92fd fix(@embark/deployment): ensure logger is available in all hooks 2019-04-17 11:37:09 +02:00
Pascal Precht 72fc80df53 fix(@embark/deployment): ensure error messages emitted are logged
Errors emitted as part of the `deployAll()` routine got swallowed by
Embark, leaving users in the unknown when the deployment process
"froze".

This commit ensures errors emitted are now logged, making it obvious
when something went wrong.
2019-04-17 11:37:09 +02:00
Pascal Precht b8357b77bf feat(@embark/embark-reset): allow users to specify files to be removed in reset
This commit introduces a feature where users can specify which files should be removed
as part of Embark's `reset` command.

This is done by specifying the `options.reset` section in a project's `embark.json`.
The possible options are `defaults: bool` and `files: Array<String>`:

```
// embark.json
{
  ...
  "options": {
    "reset": {
      "defaults": true,
      "files": ["some.file", "some/other.file"]
    }
  }
}
```

`defaults` tells Embark whether or not it should remove the default files that are
defined by the `reset` command. Setting it to `false` will prevent Embark from
removing any of these (mostly files located inside `.embark`).

This gives users fine control as they now can re-add subsets or those file paths
in the `files` property.

If `options.reset` doesn't exist Embark will do the default behaviour, which is
is simply resetting/removing the files it has always removed.

It now also honors `generationDir` and `buildDir` as part of the defaults.
2019-04-17 11:23:13 +02:00
Jonathan Rainville a4f68cb0ee fix(embark/simulator): fix account object empty when no mnemonic 2019-04-16 17:30:38 -04:00
Jonathan Rainville bfebb3ce41 fix(embark/compiler): fix errors and bugs with solc 0.4.18 2019-04-16 14:25:59 -04:00
Michael Bradley, Jr eb9de680d3 fix(@cockpit/services): send only process names to embark-api-client
`webSocketProcess` function in `embark-api-client` expects only a process name,
but cockpit was calling it with name-strings prepended with `/process-logs/`
resulting in bad URLs. Revise cockpit's `services/api` module to call
`webSocketProcess` with process names only.
2019-04-16 14:25:35 -04:00
Michael Bradley, Jr a39c2c82d7 refactor(@embark/api): in dev use cockpit redirect instead of proxy
Embark API server's development proxy from port 55555 to 3000 was attempting to
inappropriately forward an `/embark-api/` endpoint for the blockchain process
logs to Create React App's development server. Why it was only happening for
the one endpoint is not known but probably has to do with timing around
registration of the API server's express routes.

The problem can be fixed with a one-line `filter:` function in the options for
`express-http-proxy`. However, it was realized that to fix an unrelated
problem, whereby the proxy doesn't forward websockets to CRA such that hot
reload doesn't work when accessing `embark-ui` in development on port 55555, a
switch to `http-proxy-middleware` would be required. That was quickly
attempted (easy switch) but there are outstanding [difficulties][bug] with
`webpack-dev-server` and `node-http-proxy` that cause CRA to crash.

Switch strategies and refactor the API module to serve a page on port 55555 (in
development only) that alerts the developer `embark-ui` should be accessed on
port 3000. The page redirects (client-side) after 10 seconds, with URL query
params and/or hash preserved. A future version could instead do client-side
polling of port 3000 with `fetch` and then redirect only once it's
available. The reason for not redirecting immediately is that the intermediate
page makes it more obvious what needs to be done, e.g. CRA dev server may need
to be started with `yarn start`.

[bug]: https://github.com/webpack/webpack-dev-server/issues/1642
2019-04-16 14:25:35 -04:00
Pascal Precht 3988fb4c8a uiux(@embark/embark-reset): output files that reset command removes 2019-04-12 14:59:48 -04:00
Pascal Precht 1aeb6fd83b feat(@embark/embark-specialconfigs): introduce new beforeDeploy hooks
This commit enables new `beforeDeploy` deployment hooks. With this change
it's possible to add `beforeDeploy` to either `contracts: {}` within the contracts
configuration, or an individual contract.

For example:

```
contracts: {
  SimpleStorage: {
    beforeDeploy: async (context) => {

    }
  }
}
```

Runs the hook before `SimpleStorage` will be deployed. Whereas

```
contracts: {
  ...
  beforeDeploy: async () => {

  }
}

will be executed before *all* Smart Contracts will be deployed.
2019-04-12 14:54:16 -04:00
Pascal Precht f0aed55319 uiux: improve logging of deployment hooks by adding logger dependency
This will allow users to generated deploy hook specific output using the supplied `logger` within deployment hooks.

The logger will generate an output a la:

```
ContractName > deploymentHook > Output
```

and

```
afterDeploy > Output
```

respectively.

E.g. an `onDeploy` hook config like this:

```
contracts: {
  SimpleStorage: {
    fromIndex: 0,
    args: [100],
    onDeploy: (context) => {
      context.logger.log('Hello from on deploy');
    }
  }
}
```

Will output:

```
SimpleStorage > onDeploy > Hello from on deploy
```
2019-04-12 14:51:00 -04:00
Michael Bradley 85c3bb6319 Update packages/embark/package.json
Co-Authored-By: iurimatias <iuri.matias@gmail.com>
2019-04-12 14:48:33 -04:00
emizzle 447f6f8973 fix(@embark/pipeline): Support embarkjs-whisper with external pipeline
Support embarkjs-whisper with external pipeline.

`embarkjs-whisper` is required by code that is through the VM, and therefore the `embark` package needs to be able to resolve `embarkjs-whisper`.
2019-04-12 14:48:33 -04:00
emizzle 36be50e5dc feat(@embark/proxy): Add dev tx to proxy when request fails to get response
Create a dev tx (a 0-value tx that is sent from the —dev account to itself) when a request goes through the proxy, but does not get a response after 5 seconds.

Log requests to disk (when log level is trace - enabled with the embark option `—loglevel trace`) that have not received a response and for which a dev tx has been sent.

Add logging to a `proxyLogs.json` log file as well, so that this information can be gleaned later for debugging purposes.

This particular PR Is meant to workaround an issue with running geth with the `—dev` option, as some transactions appear to get stuck, which then builds up further txs in a queue. Only when another tx is sent is the queue then purged as expected.

The remaining issue is that even though a dev tx is sent to relieve the queued txs, the originally offending tx still never receives a response from the node. This was the motivation behind creating a proxy log, so that a dev can inspect the txs that are essentially dropped.

**NOTE:** the base branch of this branch is `refactor/devfunds`. Please merge that branch first.
2019-04-12 14:48:07 -04:00
emizzle 0c98af7977 refactor(@embark/blockchain_process): Refactor dev_funds
Change name “DevFunds” to “DevTxs”.

Remove unused functions in dev_funds (create accounts, unlock accounts, fund accounts).

Add console command `sendtx` to send a one-off dev transaction.

Modify the dev tx to send a 0-value tx to itself (ie the `web3.eth.defaultAccount` which is the `—dev` account).

Deprecate the command `regularTxs on/off` in favour of `devtxs on/off` (notice the casing).

Strip regulartxs from cockpit and modify the browser warning to instruct users to run a console command.
2019-04-12 14:48:07 -04:00
Iuri Matias 4d2ffb9f28 [CHERRY PICKED] chore(release): 4.0.1
This commit has been originally cherry-picked from d0d89fc5ae and
slightly modified to update all packages, as meanwhile, new packages have been added to `master`.

The reason this commit is cherry-picked from `4.0.x` branch is because
it wasn't created from `master`.

Purpose is mainly to update `CHANGELOG` and get the package versions in sync again.
2019-04-10 12:18:35 +02:00
Iuri Matias 04f187cfb9 refactor (@embark/embark-utils): move soliditySha3 to embark-utils 2019-04-09 15:16:11 -04:00
Iuri Matias 7511e3c113 refactor (@embark/embark-utils): move hashTo32ByteHexStrin to embark-utils 2019-04-09 10:40:30 -04:00
Pascal Precht 47ba899c85 chore(@embark/embark): update handlebars dependency
Fixes: #1339
2019-04-09 10:45:16 +02:00
Andre Medeiros d5eff731f2 feature: generate lcov report on contract coverage 2019-04-08 13:39:24 -05:00
Iuri Matias f6c14d9f22 feature(@embark/embarkjs-swarm): make embarkjs swarm plugin to its own module 2019-04-05 16:28:42 -04:00
Andre Medeiros 776cb140d2 feature: stop debugging button 2019-04-04 14:47:26 -04:00
Iuri Matias c87284f72a feature(@embark/embarkjs-ipfs: make embarkjs ipfs plugin a module on its own 2019-04-04 14:45:28 -04:00
Michael Bradley, Jr d71352b781 feat(@cockpit): implement pagination for contracts
Display five contracts per page in the dashboard. Display ten contracts per
page in the contracts explorer and deployment page.

Sort contracts by name. In the future we can implement an option to sort by
block number and index within a block by calculating and including that
information as part of the server-side api response (based on a contract's
txhash).

Remove unnecessary contract filtering in the components since the containers
take care of it.

Make use of `listenToContracts` / `stopContracts` in DeploymentContainer.
2019-04-04 13:14:53 -05:00
Iuri Matias 07b2ecc448 feature(@embark/embarkjs-whisper: make embarkjs whisper plugin a module on its own
feature(@embark/embarkjs-whisper: make embarkjs whisper plugin a module on its own

feature(@embark/embarkjs-whisper: make embarkjs whisper plugin a module on its own
2019-04-04 13:29:55 -04:00
Iuri Matias b792b3fc78 refactor(@embark/embark-webserver): move webserver module 2019-04-04 13:09:37 -04:00
Andre Medeiros 542809cd9f fix: run geth and parity in archival mode for dev nodes
This will only be enabled for test networks in order to be able to debug
transactions that have occurred in the past.
2019-04-04 13:02:34 -04:00
Michael Bradley, Jr b751b9c559 refactor(@cockpit/explorer): show pagination when num pages > 1
During work on PRs #1492 and #1494 it became evident that it's not desirable to
show pagination controls unless the number of pages is greater than one.
2019-04-04 12:59:12 -04:00
Jonathan Rainville 75af5c4ed9 fix(pipeline): build contracts even when pipeline is disabled 2019-04-04 12:49:48 -04:00
Michael Bradley, Jr 6b2dc95fad feat(@cockpit/explorer): display truncated account balances
Display a truncated account balance if the balance is greater than 20
characters in length. This keeps the "Balance", "Tx Count", and "Index" fields
well-aligned in lists of accounts.

In the account details page continue to show the full balance.
2019-04-04 12:49:17 -04:00
Michael Bradley, Jr 745edafee4 feat(@cockpit/explorer): implement pagination for accounts explorer
Display two accounts per page in the explorer overview. Display ten accounts
per page in the accounts explorer page.

Sort accounts by their api-supplied index numbers with the lowest index coming
first.

Change the `initBlockHeader` saga so that it triggers a re-fetch of accounts
and therefore the "Tx Count" numbers of displayed accounts will reflect
increased counts.
2019-04-04 12:49:17 -04:00
emizzle 5a502b379a fix(@embark/debugger): Add error handling for missing line
During deploy with a failing transaction, embark was crashing due to the variable `line` being passed in as undefined.

Add better error handling to catch this error and prevent embark from crashing.
2019-04-04 12:47:34 -04:00
emizzle f27cde9261 feat(@cockpit/editor): Make tabs draggable
Make tabs draggable so they can be arranged how the user would like.

The dragging functionality locks the tabs to the parent container.

Support for multiple rows of tabs.

Styling updates for selected tabs.
2019-04-04 12:46:47 -04:00
emizzle c23316351e fix(@cockpit/deployment): Check if contracts deployed when connected to metamask
When connected to metamask, and “Injected Web3” is selected on the Deployment page of Cockpit, check to see if contracts have already been deployed or not.

For contracts that have not been deployed, or set to an address in the config, these should now all be re-deployable.

Supports libraries (that have bytecode with `0x73<address><bytecode>`).
2019-04-04 12:45:34 -04:00
Pascal Precht 4c3ec26fff uiux(@cockpit/explorer): render timestamp of transactions 2019-04-04 12:45:00 -04:00
Andre Medeiros 49f195be30 feature: azure pipelines for windows 2019-04-01 11:45:39 -05:00
Michael Bradley, Jr 4b1e126b60 fix(@embark/solidity): handle absolute paths correctly
Detect absolute paths and handle them differently from paths that have not been
resolved.
2019-04-01 11:42:53 -05:00
Michael Bradley, Jr 9e4204a492 fix(@embark/contracts_manager): compare correct property
Compare a contract's `originalFilename` property to a contract file's
normalized `originalPath` property instead of `filename`. The `filename`
property seems to have been removed.
2019-04-01 11:42:53 -05:00
Iuri Matias bb55ae120e refactor(@embark/embark-utils): move findNextPort to embark-utils
refactor(@embark/embark-utils): move findNextPort to embark-utils

refactor(@embark/embark-utils): move findNextPort to embark-utils

refactor(@embark/embark-utils): move findNextPort to embark-utils

fix linting issue

fix lint

fix lint
2019-03-28 15:50:56 -04:00
Iuri Matias 246715cd6b refactor(@embark/embark-utils): move checkIsAvailable to embark-utils 2019-03-28 15:50:56 -04:00
Iuri Matias a46ea71dbd refactor(@embark/embark-whisper): move whisper module to its own package
refactor(@embark/embark-whisper): move whisper module to its own package

add eslint to dependencies

register whisper module
2019-03-28 14:33:10 -04:00
Iuri Matias 9b493ae7e3 bugfix(@embark/embark-utils): fix import of dockerHostSwap
bugfix(@embark/embark-utils): fix import of dockerHostSwap

bugfix(@embark/embark-utils): fix ts npm call

add ts declartion for embark-utils

add ts declartion for embark-utils
2019-03-28 12:02:54 -04:00
Iuri Matias 3b396cf0c0 refactor(@embark/embark-utils): move host utils to embark-utils 2019-03-27 14:32:32 -04:00
Michael Bradley 5a5d0a69a8 Update packages/embark-utils/README.md
Co-Authored-By: iurimatias <iuri.matias@gmail.com>
2019-03-27 14:14:29 -04:00
Iuri Matias c8475da144 refactor(@embark/embark-utils): move joinPath to embark-utils 2019-03-27 14:14:29 -04:00
Iuri Matias c65a4a7f55 refactor(@embark/specialconfigs): move specialconfigs module 2019-03-27 14:11:03 -04:00
Iuri Matias 0f1a58730e gst 2019-03-27 14:09:26 -04:00
Iuri Matias 6cb14d90f6 refactor(@embark/embark-profiler): move profiler module 2019-03-27 14:09:26 -04:00
Iuri Matias 573237dc81 feature(@embark/embark-ui): add gwei and pwei units to unit converter 2019-03-27 12:35:20 -04:00
Pascal Precht 74683fdc73 uiux(@cockpit): use new Embark logo 2019-03-26 17:40:40 -04:00
Iuri Matias c1bbdbf345 move embark api client code into its own package
move embark api client code into its own package

move embark api client code into its own package

remove unused dependencies

fix linting
2019-03-26 17:36:26 -04:00
emizzle 12cbb7bdd0 fix(@embark/tests): Fix contracts app hanging
Contract app hangs when attempting to test the solc contract in the test folder.

There were several causes:
1. The test contract needed a referenced contract path updated
2. Contracts that had been compiled in the JS tests were being deleted at the end of the JS test run, which caused errors with the files not being found. The fix was to reset the contracts config to no longer require the non-test contracts to be compiled/deployed.
3. Contract filtering was attempting to filter on a property `filename` that must have been changed to `originalFilename` at some point and therefore was not filtering properly.
4. The accounts used by the contract deployer were getting overwritten when `SolcTest` was instantiated and thus preventing the `remix_tests` `Assert` library from getting deployed.
2019-03-26 17:35:51 -04:00
emizzle eca456f4cb fix(@embark/storage): Fix hang when IPFS/Swarm started externally
Fix hang when the storage provider (IPFS or Swarm) was started externally before running Embark.

If IPFS/Swarm was already running before `embark run` was run, then the relevant `registerProvider` and `setProvider` code was not being run through the console, and thus the module init event was never fired, preventing the DApp from being built.

This PR refactors the way the IPFS/Swarm process is launched so that the `registerProvider` and `setProvider` code snippets are run through the console in the case of:
* IPFS/Swarm running externally from Embark
* IPFS/Swarm started in a child process by Embark
* Storage is disabled in the DApp config
2019-03-26 17:35:27 -04:00
Michael Bradley, Jr a609035182 refactor(@cockpit): unregister the service worker
TL;DR
=====

Unregister (disable) the service worker in production builds of Cockpit. The
CRA dev server doesn't enable the service worker, so no changes are needed in
that context, i.e. `yarn start` in the monorepo.

**NOTE**: to effect these changes a user will need to load production Cockpit at
`localhost:55555` and then close all Cockpit tabs (or restart the
browser). This should be done for each browser that has been used to access
production Cockpit. See the *Step-by-Step* section below for more information.

Rationale
=========

There are a couple of factors:

* It's a bit confusing that after stopping `embark run` the production build of
  Cockpit is still accessible at `localhost:55555`. That's owing to CRA's
  [offline-first behavior][PWA] per the service worker it creates, which
  Cockpit [currently registers][current] (enables).

* It can be really confusing, if you don't know or forget about the service
  worker's behavior, that after a production rebuild of Cockpit the old build
  is still used in the browser, even after a page refresh. As [explained][ofb]
  in CRA's docs: *"users will end up seeing older content until they
  close (reloading is not enough) their existing, open tabs."* A similar effect
  is seen when switching between DApps, e.g. teller and embark_demo.

The CRA docs point to [some code][code] that could be adapted to an alert in
the UI prompting the user to close all tabs and reopen the app. That approach
definitely makes sense for DApps built with CRA that have opted-in to the
service worker. In fact, the service worker behavior would be critical in DApps
that make use of connected-/react-router because cold loads of routes that
don't actually correspond to static files couldn't otherwise work, i.e. if the
DApp is being served from ipfs/swarm.

But for Cockpit itself, when served from localhost with an express backend that
we control, little seems to be gained from offline-first behavior vs. a more
familiar behavior, i.e. when `embark run` isn't running then Cockpit isn't
accessible.

Step-by-Step
============

Flushing a site's service worker from cache can be tricky. The following steps
outline an approach to making sure the Cockpit in use is the one with service
worker disabled.

1. The first screenshot below shows the JavaScript console from a fresh load of
Cockpit with the service worker enabled, i.e. from a build on `master` at time
of writing and `embark run` running for the `embark_demo`. Note the messages
re: *"workbox"* and *"precaching"*.

![][step-1]

2. The next screenshot shows what happens when `embark run` is stopped and the
browser is refreshed. Service worker makes the page available offline, though
there are errors related to embark's API not being accessible.

![][step-2]

3. (a) Cockpit gets rebuilt on this PR's `refactor/cockpit-service-worker`
branch and `EMBARK_UI_STATIC=t embark run` is started; see [previous
commit][prevcom] re: `EMBARK_UI_STATIC`. (b) The browser is refreshed. Note the
message at the bottom re: *"New content is available"*.

![][step-3]

4. The Chrome browser is closed completely (command-Q), reopened and
`localhost:55555` is loaded again. Note there are *still* messages re:
*"workbox"* and *"precaching"*.

![][step-4]

5. The page is refreshed again and now the messages are completely gone.

![][step-5]

6. `embark run` is stopped and the page is reloaded, but there's a connection
error because no process is listening on `localhost:55555` &mdash; proof that
the service worker is no longer in play!

![][step-6]

Steps 3(b) to 6 will need to be repeated for each browser (Firefox, Safari,
etc.)  that visited `localhost:55555` when the service worker was enabled. And
they'll need to be repeated again if the browser is later used with a build of
Cockpit predating this PR.

[PWA]: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
[current]: 4d4704ac6f/packages/embark-ui/src/index.js (L39)
[ofb]: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app#offline-first-considerations
[code]: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/src/serviceWorker.js#L66-L93
[step-1]: https://user-images.githubusercontent.com/194260/54885199-adfa0900-4e47-11e9-830b-1b92816b2354.jpg
[step-2]: https://user-images.githubusercontent.com/194260/54885202-b3575380-4e47-11e9-9c1e-24817472d9c4.jpg
[step-3]: https://user-images.githubusercontent.com/194260/54885209-bb16f800-4e47-11e9-8e23-8fbc3b4f48fa.jpg
[prevcom]: https://github.com/embark-framework/embark/commit/322033cc
[step-4]: https://user-images.githubusercontent.com/194260/54885212-bfdbac00-4e47-11e9-9c8c-db90228d953a.jpg
[step-5]: https://user-images.githubusercontent.com/194260/54885214-c538f680-4e47-11e9-9963-58fd041675f0.jpg
[step-6]: https://user-images.githubusercontent.com/194260/54885217-ccf89b00-4e47-11e9-967a-7f8a523d4a92.jpg
2019-03-26 16:00:13 -04:00
Michael Bradley, Jr 9829e925b4 refactor(@embark/api): catch-all route, fallback pages for Cockpit
Implement a `/*` server-side catch-all route for Cockpit that loads Cockpit's
`index.html`.

This change is necessary with intent to disable offline-first behavior in
production builds of Cockpit. Cockpit's service worker effectively translates
server-side route unavailability into client-side behaviors of
connected-react-router. When the service worker is unregistered the same will
be accomplished via the server-side catch-all route.

Implement fallback pages for when embark is in the monorepo but Cockpit's
Create React App development server isn't yet started or isn't yet responsive.

Implement a fallback page for when the static build of Cockpit is missing. When
embark is in the monorepo, give instructions for building Cockpit. Otherwise,
report that the distribution is broken.

Deprecate the environment variable `EMBARK_DEVELOPMENT` in favor of
`EMBARK_UI_STATIC`. Unless the latter is truthy at runtime, when embark is in
the monorepo the CRA dev server of Cockpit will be accessible at
`localhost:55555` via proxied requests to `localhost:3000`. The deprecation is
not a breaking change as `EMBARK_DEVELOPMENT` / `EMBARK_UI_STATIC` are not
relevant to normal users, but only to developers working on embark itself.

Bump `express-http-proxy` to the latest version.
2019-03-26 16:00:13 -04:00
emizzle e4d1e4ea87 fix(@embark/ipfs): Fix IPFS gateway CORS for embark-status plugin
As well as the IPFS API CORS, update the IPFS gateway CORS to successfully run the `embark-status` plugin.
2019-03-22 13:28:05 -04:00
emizzle 431d366652 fix(@embark/utils): Fix proxy crash with unknown function
If a transaction is sent and the proxy is enabled, but the function hash (identified in the data of the transaction) is not recognized as a function of the contract (ie does not match a function hash in the contract’s ABI), then embark would crash.

The fix was to introduce error handling in `transactionUtils.getTransactionParams` that defaults the contract name and params to `UNKNOWN`.

This can be replicated by
1. Clone https://github.com/mortimr/ethvtx_embark
2. `embark run` the dapp
3. Connect with Metamask
4. Ensure you have enough funds
5. In the “Tx calls” bubble, enter a new value, then click “Set Value”.
6. When the Metamask dialog appears, the error should have already happened. The console shows:
```
embark/src/lib/utils/transactionUtils.ts:58
  const functionName = func.functionName;
                            ^
TypeError: Cannot read property 'functionName' of undefined
    at functionName (/Users/mortimr/Horyus/ethvtx_embark/node_modules/embark/src/lib/utils/transactionUtils.ts:58:29)
    at ConsoleListener.getTransactionParams [as _onIpcLogRequest] (/Users/mortimr/Horyus/ethvtx_embark/node_modules/embark/src/lib/modules/console_listener/index.js:102:41)
    at _onIpcLogRequest (/Users/mortimr/Horyus/ethvtx_embark/node_modules/embark/src/lib/modules/console_listener/index.js:76:12)
    at Server._done (/Users/mortimr/Horyus/ethvtx_embark/node_modules/embark/src/lib/core/ipc.js:81:7)
    at Server.emit (/Users/mortimr/Horyus/ethvtx_embark/node_modules/event-pubsub/es5.js:74:21)
    at Server.gotData (/Users/mortimr/Horyus/ethvtx_embark/node_modules/node-ipc/dao/socketServer.js:194:14)
    at Socket.emit (events.js:189:13)
    at Socket.EventEmitter.emit (domain.js:441:20)
    at addChunk (_stream_readable.js:284:12)
    at readableAddChunk (_stream_readable.js:261:13)
    at Socket.Readable.push (_stream_readable.js:220:10)
    at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
```
2019-03-22 13:27:22 -04:00
Iulian Rotaru (mortimr) 4d4704ac6f feat(@embark/embarkjs): add bytecode to contract
Contract artifacts built by `new.EmbarkJS.Blockchain.Contract(config)` now save the bytecode and runtime bytecode from the config in the instance
2019-03-20 13:11:21 -04:00
Michael Bradley, Jr 21e23313ba chore(release): 4.0.0 2019-03-18 18:26:56 -05:00
Michael Bradley, Jr 5161f54a39 fix(embark-ui): don't show debug button for txs of silent contracts 2019-03-18 17:53:51 -05:00
Michael Bradley, Jr fa89390ee0 chore(release): 4.0.0-beta.2 2019-03-18 17:04:40 -05:00
Iuri Matias b3b2b317c7 Fix linting 2019-03-18 17:49:00 -04:00
Iuri Matias 9c74da3a7b bugfix(@embark/code_generator): write blockchain config file before writing embarkjs artifact 2019-03-18 17:49:00 -04:00
Michael Bradley, Jr 832f16ae08 fix(embark-ui): detect fallback functions in the contracts explorer
When a fallback function is encountered give its signature as `function()`,
disable row expansion, and omit the interaction form. Also label with a
`fallback` badge.
2019-03-18 16:07:18 -04:00
Andre Medeiros 9d34355994 fix: typed commands in console 2019-03-18 12:23:18 -04:00
Michael Bradley, Jr 7f6c1be390 chore(release): 4.0.0-beta.1 2019-03-17 19:56:29 -05:00
Michael Bradley, Jr f4626f8fec fix(embark-ui): specify PUBLIC_URL=/ for production builds
Create React App automatically determines the base path for links within
production build artifacts based on the project's `"homepage"` field in
`package.json`.

An [alternative][alt-setting] is to set the `PUBLIC_URL` environment variable
in `.env.production`. Take that approach so embark-ui's `"homepage"` can
continue to point to its home in the monorepo on GitHub.

Generate source maps in the production build of embark-ui. Doing so increases
the size of the package's tarball by a few MB (it was already large because of
the editor component), but the benefits of being able to much more easily debug
a production build (e.g. when interacting with users experiencing problems)
outweigh the size cost.

[alt-setting]: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/config/paths.js#L36
2019-03-17 20:07:19 -04:00
Michael Bradley, Jr db40f03d68 fix(embark): specify "rxjs" as a dependency vs. "@reactivex/rxjs"
`"rxjs"` is [preferable][rxjs-pkg-name] in a CommonJS context,
e.g. node. Existing embark code is `require`-ing from the unscoped package
name, which worked in the monorepo because some other dependency specifies
`"rxjs"` and yarn hoists it to the root of the workspace. In a production
install of embark, though, `require('rxjs')` was failing.

[rxjs-pkg-name]: https://github.com/ReactiveX/rxjs/issues/2577
2019-03-17 20:07:12 -04:00
Michael Bradley, Jr e37598309f refactor(embark): restrict path for fs ops only in VM2 context
When testing production installs of embark 4.0.0-beta.1 (local registry), the
`restrictPath` mechanism of `core/fs` was too restrictive, interfering with
template generation (cause not completely determined). Also, it's known that
`restrictPath` causes problems when resolving plugins, etc. from "higher up"
`node_modules` paths, e.g. in the monorepo.

Introduce `codeRunner/fs` which uses `restrictPath` as before, and in `core/fs`
remove `restrictPath`. Revise the other `codeRunner` modules to use
`codeRunner/fs`.
2019-03-17 20:07:05 -04:00
Michael Bradley, Jr 6758a652eb build(embark-vyper): use a caret range for embark-async-wrapper
Member packages of the monorepo should use caret ranges when specifying other
packages in the monorepo as dependencies.
2019-03-17 20:06:57 -04:00
Michael Bradley, Jr 949015525c build(embark-compiler): use a caret range for embark-async-wrapper
Member packages of the monorepo should use caret ranges when specifying other
packages in the monorepo as dependencies.
2019-03-17 20:06:49 -04:00
Michael Bradley, Jr fd7909087d fix(embark-ui): AccountContainer should get txs for cold load case
Don't implicitly rely on explorer overview having been loaded to initially
populate `entities.transactions`. Also, that container should watch for new
blocks/transactions same as the other explorer containers.

Restore `fetchTransactions` and related to TransactionsContainer. It's no
longer the basis of pagination (it didn't work as desired), but when navigating
through the transaction pages that action will ensure more transactions are
fetched so that the account page will list more of an account's transactions
over time. That was a side effect of `getTransactions` before it was removed in
favor of `getBlocksFull`, which is still the basis of revised pagination logic
in the transactions explorer.
2019-03-15 15:25:56 -05:00
Michael Bradley, Jr fbeea47a6e fix(embark-ui): correctly calculate which transactions to display
Revise calculations related to transactions and pagination in the transactions
explorer and explorers overview.

Make the number of transactions to display per page configurable and set it to
3 in the explorers overview. Display a "No transactions..." message instead of
"0" when there are no transactions to display.

Introduce a `blocksFull` prop, action, api, etc. for calculating lists of
transactions relative to block objects that contain full transaction objects
instead of hash strings (the function backing the blocks endpoint already
supports that) and transaction receipts. In the future, the receipts can be
used to filter out constructor transactions for silent contracts.

Make pagination display conditional within the blocks explorer, same as in the
transactions explorer.
2019-03-15 15:25:56 -05:00
Jonathan Rainville b1881719e0 Fix tests (CI) and debug button (#1443)
* fix(embark/tests): fix tests by not tampering with the contract addr

* fix(cockpit/debugButtong): use deployedAddress instead address
2019-03-15 16:22:24 -04:00
Michael Bradley f60c979c75 refactor(embark-ui): filter silent contracts from contracts listings (#1444)
Filter silent contracts in the views that display contracts lists rather than
with `formatContractForDisplay` because the old approach prevents interaction
with a silent contract if a link to it is followed from the blocks or
transactions explorer, which is not desirable.
2019-03-15 16:22:15 -04:00
Michael Bradley, Jr 9afdbd9848 refactor(embark-ui): improve cockpit's contracts explorer
Rename contract "Transactions" tab to "Log". Display and allow filtering of all
contract methods. Disable debug button for pure/view functions and the
constructor.

Revise the filtering logic so that filters are combined together. Make the
status filter a drop down menu like the others.

Revise styling for consistent row height, alignment of text, and button sizes;
use a monospaced font in some cases to achieve the effect.

Handle enter/return correctly in forms within a contract's Interact tab.

Remove event rows from a contract's Interact tab.

Track pure/view calls in the blockchain proxy so they can be logged server-side
by console listener and reported in Cockpit within a contract's Log tab.

Eliminate double logging in the contracts manager. Ensure contracts deployed on
a fresh `embark run` have an `address` / `deployedAddress` property.
2019-03-15 12:03:52 -05:00
Andre Medeiros b15467f64a feature: decode raw transactions in tx decoder 2019-03-15 12:28:21 -04:00
Jonathan Rainville 5e4a80edec fix(embark/storage): fix hang when storage is disabled 2019-03-14 17:32:04 -04:00
Jonathan Rainville 4d424c06b9 fix(embark/solidity): fix getting the original filename of contracts 2019-03-14 14:15:45 -04:00
Andre Medeiros aba4e0e059 fix: track and debug last transaction correctly 2019-03-14 14:15:19 -04:00
Jonathan Rainville 9bb33e9274 fix(cockpit/suggestions): fix suggestions with slashes 2019-03-14 14:14:52 -04:00
Iuri Matias cfd06b5fe1 feature(@embark/ipfs) add other gateway urls for ipfs 2019-03-14 14:13:51 -04:00
Andre Medeiros 2cc0d305e6 fix: pressing enter on "Display additional results" does the expected thing 2019-03-14 14:13:35 -04:00
Jonathan Rainville 5816a79ae6 fix(cockpit/sidebar): fix closed sidebar in the dark-theme 2019-03-14 14:01:57 -04:00
Jonathan Rainville 22e771bbda fix(cockpit/console): fix cockpit's console outputting "console >" 2019-03-14 14:01:47 -04:00
Iuri Matias 785edf4c9d use e.key instead of e.which 2019-03-14 14:01:28 -04:00
emizzle 8b7a374313 fix(@embark/cockpit): Utils/Communications handle enter
Handle enter pressed when listening to channels and sending messages.
2019-03-14 14:01:28 -04:00
Michael Bradley, Jr cc8363a94b fix(embark-ui): correctly calculate which blocks to display
Revise calculations related to block numbers and pagination in the blocks
explorer and explorers overview.

Make the number of blocks to display per page configurable and set it to 5 in
the explorers overview.
2019-03-13 12:35:12 -04:00
Jonathan Rainville 618ceb6ff2 fix(embark/contracts): add the contracts back to the autocomplete 2019-03-13 12:34:54 -04:00
Jonathan Rainville dd1133d9cf fix(embark/dashboard): fix dashboard not printing repl errors 2019-03-13 12:20:25 -04:00
Jonathan Rainville dddc9d0cf6 fix(cockpit/firefox): fix bug with entities in firefox (ordering) 2019-03-13 12:13:52 -04:00
Jonathan Rainville 447f3eda06 fix(cockpit/transactions): enable filtering constructor 2019-03-13 11:08:20 -04:00
Jonathan Rainville a341a4f3b2 fix(cockpit/console): replace br with backslash n 2019-03-13 10:21:10 -04:00
Jonathan Rainville 71da423e4e fix(cockpit/console): increase number of suggestions 2019-03-13 10:21:01 -04:00
Jonathan Rainville 54698ccf53 fix(embark/dashboard): show command in the dashboard 2019-03-13 10:20:41 -04:00
emizzle 6f5efb16a6 fix(@embark/storage): Storage processes race conditions
Previously, storage providers in embarkjs were not waiting for their respective storage process (ipfs and swarm) to start before running `registerProvider` and `setProvider` in the console.

This PR forces the `registerProvider` and `setProviders` from running in the console until the storage processes have loaded. As a side effect, the code generation of `EmbarkJS` must wait for the storage module ot be fully initiated (ie once the processes have launched and the `registerProvider` and `setProviders` have been run) before generating the code.

This fixes errors pertaining to `Could not connect to a storage provider using any of the dappConnections in the storage config` as these errors were typically caused by `setProviders` being called before the storage processes had fully launched.
2019-03-13 10:15:52 -04:00
Jonathan Rainville be3817821d fix(cockpit/dashboard): fix logs not in cockpit with dashboard 2019-03-13 09:46:12 -04:00
Pascal Precht 20d3acb8b1 uiux(@embark/authenticator): Change web backend to Cockpit 2019-03-12 09:17:43 -04:00
Michael Bradley, Jr 5418f16082 feat: normalize README and package.json bugs, homepage, description
Make changes by running these commands in the root of the monorepo:

**bugs**
```shell
npx lerna exec --concurrency 1 --stream -- \
    'DIRPATH=$(realpath $PWD --relative-to=$LERNA_ROOT_PATH); \
    npx json -I -f package.json -e "this.bugs=\
        \"https://github.com/embark-framework/embark/issues\""'
```

**homepage**
```shell
npx lerna exec --concurrency 1 --stream -- \
    'DIRPATH=$(realpath $PWD --relative-to=$LERNA_ROOT_PATH); \
    npx json -I -f package.json -e "this.homepage=\
        \"https://github.com/embark-framework/embark/tree/master/${DIRPATH}#readme\""'
```

Don't commit changes to private packages, with the exceptions of embark-typings
and embark-reset because those may switch from private to public, and also
because the latter will be included in `node_modules` of embark even if it is
private since embark-reset is presently a bundled dependency of embark.

Don't include the homepage and bugs fields in dapps generated from the template
packages, except for the demo. Set those dapps' description field to an empty
string.

Ensure every package (inc. private packages) has a description.

Ensure every package (inc. private packages) has a README that begins with:

```markdown
`[pkgJson.name]`
================

> [pkgJson.description]

Visit [embark.status.im](https://embark.status.im/) to get started with
[Embark](https://github.com/embark-framework/embark).
```

Don't include the README in dapps generated from the template packages, except
for the demo.
2019-03-12 09:17:33 -04:00
emizzle 3aafde3335 fix(@embark/pipeline): Prevent crash when assets not specified
Prevent embark from crashing when app assets are not specified in `embark.json`.

Previously, if the `app` property of `embark.json` was missing, embark would crash with the error `TypeError: Cannot convert undefined or null to object`.

With this PR, the missing property is null-checked.
2019-03-12 07:55:01 -04:00
emizzle 5ea4807c90 feat(@embark/pipeline): Add `enabled` property to pipeline config
Add an `enabled` property to the pipeline config. This lets developers disable the pipeline using the config file.

Updates to the enabled property will be reflected while embark is running. For example if embark is running with the pipeline, setting `enabled: false` in the pipeline config will build/deploy the contracts but not run the pipeline. Conversely, if embark is running with the pipeline disabled, enabling the pipeline in the config will build/deploy the contracts then build the dapp.
2019-03-12 07:53:04 -04:00
Michael Bradley, Jr df0064f1a9 build: use package.json "files" instead of .npmignore
`package.json` allows for a [`"files"` whitelist][files] to be specified as an
alternative to a top-level `.npmignore` within a package root. Maintaining
whitelists is generally easier and less error-prone than maintaining
blacklists, so implement a `"files"` list for all non-private packages in the
monorepo and remove unneeded `.npmignore` files.

Switch `embark-reset` from being a private package to one that will be
published, adjust the workspace's `"nohoist"` setting accordingly, and no
longer specify `embark-reset` as a bundled dependency of `packages/embark`. I
originally thought there might be a good reason not to publish it, but I no
longer think so.

Remove unnecessary LICENSE files in `packages/{embark,embark-ui}` since Lerna
will automatically copy the root LICENSE into any packages lacking that file,
i.e. before tarballs are packed and published to the NPM registry.

Change the `"author"` field of `packages/embarkjs-connector-web3` to match the
other packages, i.e. such that it matches the copyright assignment in the root
LICENSE. If that's not a desirable thing to do, then instead that package can
have a separate LICENSE file that has a copyright assignment for `"Jonathan
Rainville"`.

Supply some missing `.npmrc` files in `packages/*`.

[files]: https://docs.npmjs.com/files/package.json#files
2019-03-12 07:50:25 -04:00
Andre Medeiros 0b530f308b fix: node_modules should be part of hidden files 2019-03-12 07:48:20 -04:00
Jonathan Rainville 88a41e7c28 fix(embark/logger): fix logs in the dashboard
they were displaying the color as text instead of as a color
2019-03-11 18:32:48 -04:00
Jonathan Rainville cba7c85242 fix(cockpit/transactions): fix a typo in the transactions page 2019-03-11 18:28:19 -04:00
Jonathan Rainville 74847ee323 feat(cockpit/transaction): display a link for contracts and accounts 2019-03-11 18:28:19 -04:00
emizzle 236f6e63e2 fix(@embark/core): Re-enable regular txs commands/api
https://github.com/embark-framework/embark/pull/1367 introduced a change that prevented the `blockchain_listener` from listening to logs until the IPC server connected. However, the restriction went too far, and included restricting registration of console commands and API endpoints for the regular transactions feature.

This fix reverts the changes that affect registration of regular txs endpoints and console commands.
2019-03-11 18:26:30 -04:00
Michael Bradley, Jr d61dc6ec2f refactor(embark): do not wrap mocha in a child process
It's possible to pass a `--require` option to mocha to load a script that sets
up `process.env.DAPP_PATH` as needed for embark's tests; that approach is
preferable to running mocha in a child process because when running in a child
process there seemed to be problems with sources maps and with VS Code's
debugger.

After the changes in this PR, the following works as expected, i.e. when there
are runtime errors line/col numbers are reported per the files in `src/`:

```
$ yarn build:no-ui
$ cd packages/embark
$ npx mocha "dist/test/**/*.js" \
            --exit \
            --no-timeouts \
            --require ./scripts/test.js \
            --require source-map-support/register
```

And the following VS Code launch config works well for me:

```json
{
  "type": "node",
  "request": "launch",
  "name": "test - packages/embark",
  "cwd": "${workspaceFolder}/packages/embark",
  "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
  "args": [
    "'dist/test/**/*.js'",
    "--exit",
    "--no-timeouts",
    "--require",
    "./scripts/test.js",
    "--require",
    "source-map-support/register"
  ],
  "autoAttachChildProcesses": true,
  "sourceMaps": true
}
```

NOTE for VS Code users: I found it's important to specify
`"'dist/test/**/*.js'"` in the launch config instead of
`"\"dist/test/**/*.js\""`, and that it's important to specify `"program":
"${workspaceFolder}/node_modules/mocha/bin/_mocha"` vs. `"program":
"${workspaceFolder}/packages/embark/node_modules/.bin/mocha"`.

KNOWN ISSUES: when there are runtime errors during `yarn test` in
`packages/embark`, line/col numbers reflect the sources in
`package/embark/dist` because `nyc` isn't setup correctly to use the
source-maps generated by babel. A solution has not yet been found.
2019-03-11 18:25:47 -04:00
Jonathan Rainville 99dcd785bc fix(cockpit/contract): remove contract profiling and use functions 2019-03-11 18:21:54 -04:00
Michael Bradley, Jr a9c5e1ade5 feat: add repository.directory field to package.json
See: https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md

Make changes by running this command in the root of the monorepo:

```shell
npx lerna exec --concurrency 1 --stream -- \
    'DIRPATH=$(realpath $PWD --relative-to=$LERNA_ROOT_PATH); \
    npx json -I -f package.json -e \
    "this.repository=\
        {\"directory\": \"$DIRPATH\", \
         \"type\": \"git\", \
         \"url\": \"https://github.com/embark-framework/embark.git\"}"'
```

Don't commit changes to private packages, with the exceptions of embark-typings
and embark-reset because those may switch from private to public, and also
because the latter will be included in `node_modules` of embark even if it is
private since embark-reset is presently a bundled dependency of embark.

Don't include the repository field in dapps generated from the template
packages, except for the demo.
2019-03-11 18:21:24 -04:00
Andre Medeiros f12ca22edb fix: limit cockpit editor file size 2019-03-11 18:20:56 -04:00
Andre Medeiros 616af6d765 fix: validate whisper channel name in communication tab 2019-03-11 18:19:00 -04:00
Andre Medeiros 4340a9b482 fix: editor wasn't saving changes 2019-03-11 18:18:52 -04:00
emizzle a6b15ae98f fix(@embark/cockpit): Switching between tabs resets logs
Switching between the two tabs shown on the Dashboard for the cockpit was removing some of the logs that were previously displayed. This was due to an overlap in `id`’s being assigned to the logs from different processes.

To alleviate this, the reducers has been updated to not only check `id` but also `process.name`.

Additionally, the reducer was updated so that the number of logs for **each process** is set to `ELEMENTS_LIMIT`. For example, our `ELEMENT_LIMIT` is currently set to `200` and it would have meant that the total number of process logs across all processes would have been capped at 200. The current changes in this PR allow for 400 total logs, given that we have two processes being monitored for logs.
2019-03-11 17:39:05 -04:00
emizzle 128ecd4c51 fix(@embark/core): Prevent unnecessary re-renderings
The services websocket was initiated in the AppContainer and causing all child components to continuously re-render every time there was a service check (which is effectively every second). In addition, the socket was never stopped when not needed (ie when the services component was unmounted).

Create a ServicesContainer that initiates the websocket as part of the container, and stops the socket when the container is unmounted.

Move the ContractsList to be part of the ContractsContainer with a `mode` switch.

Add Deployment page title and description.
2019-03-11 17:38:33 -04:00
Jonathan Rainville cc495c5cab hotfix(cockpit/editor): remove test alert 2019-03-11 16:00:26 -04:00
Jonathan Rainville c30c420ae8 fix(cockpit/editor): remove delay on tooltips
This caused issues when moving from one tooltip to the other
2019-03-11 09:05:49 -04:00
Jonathan Rainville 7720eac74f codacy fix 2019-03-11 09:05:15 -04:00
Jonathan Rainville ecdfd473df feat(cockpit/editor): add status messages for file operations 2019-03-11 09:05:15 -04:00
Jonathan Rainville 3f488e1d88 fix(cockpit/editor): add delete modal to confirm deletion
Also fix cases where modals closed for no reason
2019-03-11 09:04:45 -04:00
emizzle 563ba154a3 fix(@embark/tests): Make `web3` available in test descriptions
Previous to this PR, `web3` was only made available to each test case, as it was put in to the global namespace after each test deploy. This was causing issues for tests that use `web3` in the test description (ie in `describe()` or `contract()` functions), as the deploy had not happened yet, and thus `web3` was not yet available. The error encountered in these cases was `web3 is not defined`.

This PR puts `web3` in the global namespace before setting up the tests, making it available to test descriptions.
2019-03-11 12:15:45 +11:00
Jonathan Rainville da76c8d804 fix(cockpit/deployment): filter out silent contracts 2019-03-08 12:55:58 -05:00
Jonathan Rainville 0648824646 fix(cockpit/header): fix nav not highlighted for children pages 2019-03-08 12:55:05 -05:00
Jonathan Rainville 35648eefa0 fix(cockpit): fix converter inputs and copy-button position 2019-03-08 12:55:05 -05:00
Jonathan Rainville 359c28f5b5 fix(cockpit:editor): fix arrow not turning 2019-03-08 09:26:13 -05:00
Jonathan Rainville fac29e1601 revert console to only show cockpit results in cockpit 2019-03-08 08:54:30 -05:00
Jonathan Rainville 6662731898 fix(logger): filter undefined and null out of logs 2019-03-08 08:54:30 -05:00
Jonathan Rainville 32e8bd2ee1 fix(console/logger): fix console and logger not outputting objects
Also makes the logger smarter by stringifying objects
And revert repl changes
2019-03-08 08:54:30 -05:00
Jonathan Rainville e20c08ac6f fix(console): fix ENS tests not working with embark side by side 2019-03-08 08:54:30 -05:00
emizzle 9ea0383046 fix(@embark/storage): Allow upload when storage disabled
Allow `embark upload` to upload to IPFS/Swarm even if the storage module is disabled in the storage config.

An easy way to test this is to set `config/storage.js` > `enabled` to `false` in the demo. Then run `embark upload`.
2019-03-08 12:43:00 +11:00
emizzle c233dbc7fb fix(@embark/core): Metamask + geth warning to enable regular txs
A console warning is meant to appear in the browser console when the dapp is connecting to web3 using metamask and the blockchain client is geth. The warning displays information telling the user they should enable regular transactions to prevent known issues regarding transactions getting stuck.

The issue fixed here pertained to `warnAboutMetamask` vs `warnIfMetamask` - maybe there was a change that introduced this issue upstream.

Additionally, enabling and disabling of regular transactions via an API endpoint did not

Add ability to stop regular txs via query string, and validate request parameters.
2019-03-08 12:41:13 +11:00
Jonathan Rainville 0e63d6bcf9 feat(cockpit/contracts): don't display contracts marked as silent 2019-03-05 16:21:39 -05:00
Jonathan Rainville d80641c4e1 fix(ens/logger): add ens contracts to contract manager before deploy 2019-03-05 16:21:39 -05:00
André Medeiros 58ab76d2ca
fix: format \n as <br> in cockpit console (#1385) 2019-03-05 14:29:57 -05:00
André Medeiros 913b4e1817
fix: upgrade packages with vulnerabilities (#1388) 2019-03-05 14:29:36 -05:00
Michael Bradley, Jr eb1b6933af fix: revise test urls to reflect test_dapps/ -> dapps/tests/ 2019-03-05 13:26:38 -06:00
André Medeiros 73a06725ac
fix: don't eval function calls for suggestions (#1382) 2019-03-05 14:26:08 -05:00
André Medeiros 78201ce9df
fix: prevent HTML injection in the cockpit (#1381) 2019-03-05 14:14:58 -05:00
André Medeiros 41256cfb00
fix: blockchain logs show in cockpit (#1367) 2019-03-05 14:14:41 -05:00
André Medeiros 891174eda3
fix: cockpit search with tx hash shows tx page (#1386)
This issue was caused by a string to integer conversion. In JavaScript,
when converting a string that starts with `0` (which is the case for tx
hashes) to an integer using `parseInt` it will always yield 0. That,
combined with a block with number 0 would always return a block result
instead of the transaction.

```
> parseInt("0xluri", 10)
0
```

This PR checks if the resulting number equals the string that was
provided on top of checking for the block number.
2019-03-05 14:14:05 -05:00
Michael Bradley, Jr de0f02d00a build: make DApp templates member packages of the monorepo
Previously, templates were in a subdirectory of `packages/embark`. Reorganize
them so that they are member packages of the monorepo. This allows them to
cleanly depend on other members of the monorepo,
e.g. `embarkjs-connector-web3`.

It is desirable for the templates, in the context of the monorepo, to specify
embark as a dependency, to take advantage of `npx embark test` (and it's a
"forward looking" setup re: how we plan to evolve embark). However, if embark
were to specify the template packages as dependencies a circular relationship
would be introduced, which is [unsupported by Lerna][circular]. Therefore,
revise the template generator so that all templates are resolved / fetched at
runtime, i.e. `boilerplate`, `demo`, and `simple` are no longer
"built-ins" *per se*. This change won't be apparent to embark's users, but it
does mean that the template generator won't work (in a production install of
embark) if it can't connect to the npm registry, i.e. when the user runs
`embark demo` or `embark new [--simple]`. When embark is inside the monorepo,
templates are resolved and copied from the yarn workspace rather than being
fetched from the registry, which is convenient for development. Also, any
template dependencies that are members of the monorepo are linked into the
copied template's `node_modules` rather than being installed from the registry,
again for convenience. During template generation, remove scripts and
dependencies that pertain only to membership in the monorepo; for now, that
involves removing embark as a dependency since we're not quite ready for that
arrangement to be the default, i.e. outside of the monorepo.

Refactor the root scripts so that more of them can consistently be used with
Lerna's filter options, e.g. `--scope` and `--ignore`. "Combo" scripts that
don't support filtering generally have a `:full` postfix.

Flip `clean` and `reset` scripts at the root and in the member packages for
consistency re: Lerna's notion of `clean` and embark's notion of `reset`. Have
each package run its `reset` script when its `clean` script is invoked (and
that's all for now), relying on `lerna clean` to delete packages'
`node_modules` in view of how Lerna's topological sorting works.

Lift the implementation of `embark reset` into a private package in
`packages/embark-reset` and make it a bundled dependency of embark. Packages in
`dapps/*` depend on `embark-reset` directly and make use of it with `npx
embark-reset` (but only in monorepo context). This removes a "wart" where
reboots could show errors when embark's sources aren't already built in
`packages/embark/dist`. Users will not notice any difference since `embark
reset` works as before, transparently making use of the `embark-reset`
package. The only downside to having it be a bundled dependency of embark is
that bundled deps have all of their `node_modules` included in the tarball
built with `npm pack` (that's why having the templates as bundled dependencies
of embark isn't a viable approach). However, `embark-reset` only has one
dependency, `rimraf`, which is a tiny module, so the cost seems acceptable.

As part of the reorganization, move `test_dapps` into `dapps/tests` and
`packages/embark/templates` into `dapps/templates`. Keep the directory names
short but revise the package names to facilitate simple filtering with
`embark-dapp-*`. Consolidate `.yarnrc` and `.gitignore` and clean up some
redundant ignore listings.

Scripts run with `--scope embark-dapp-*` use `--concurrency=1` to avoid
conflicts that could arise over network ports. The `ci:full` and `qa:full`
scripts use `--concurrency=1` in all scopes, for two reasons: resource
limitations on Travis and AppVeyor result in slower runs with concurrency >1,
and if something fails in those contexts it's easier to see what went wrong
when Lerna's output isn't interleaved from a bunch of scripts in `packages/*`.

Bump the Lerna version.

[circular]: https://github.com/lerna/lerna/issues/1198#issuecomment-442278902
2019-03-05 10:20:57 -06:00
emizzle f957ba55dd fix(@embark/cockpit): Fix decode transaction error
Reproduce:
1. Go to cockpit > transactions
2. Click a transaction
3. There will be a flicker of an error, then the decoded tx displays OK. Inspecting the network requests, there is a 500 error with a response of
```
AssertionError [ERR_ASSERTION]: invalid remainder
```
This error is also printed in the console.

The issue is that the transaction is not a raw transaction, so instead of trying to decode the non-raw transaction, the transaction can be decoded by web3.
2019-03-05 12:01:07 +11:00
emizzle 9bd33a9de5 feature(@embark/console): Suggestions improvements
**Cache suggestions**
Suggestions are cached for better performance on each request. When contracts are deployed, the suggestion cache is cleared, allowing for updated contract methods to be built in to the suggestions.

** Handle edge cases **
Handle cases when console command is parsed as an empty string, or possibly returns an empty object, which would cause `Object.getOwnPropertyNames` to throw an error (that is ultimately swallowed).
2019-03-05 08:56:15 +11:00
emizzle 14323f5430 fix(@embark/swarm): Fix swarm not being registered
Swarm was not being registered as a service due to a recent change that introduced a bug. The previous change was meant to register “swarm” as a console command to provide output for the `swarm` console command when swarm had not been registered in the VM. The bug, however, returned too early in the cases when swarm was meant to be enabled, thus effectively not registering the entire process.

The fix simply returns only when swarm is in fact, disabled, and also alters slightly the way swarm is determined to be enabled (the changes of which have been copied over to `ipfs`).
2019-03-05 08:19:48 +11:00
emizzle 9fad77715b fix(@embark/core): Allow errors in event actions
Add the ability to pass an error in the callback of an event action.

Currently, event actions could either pass back a an error OR a result, but not both, and with no way to distinguish between the two parameters. This PR adds the ability to pass an error as the first parameter of the action callback.

An example of a use case that this fixed: errors on `deployIf` were silently swallowed, which has now been fixed.

All instances of `events.request(“deploy:contracts”)` were given an `error` parameter in their callback, and errors printed if it is not undefined.

All instances of `registerActionForEvent` were combed to ensure any callbacks were passing the expected error and result.
2019-03-04 12:35:35 +11:00
Jonathan Rainville 0639717d0c fix(blockchain): check if node is synched after connection 2019-03-01 11:04:14 -05:00
Jonathan Rainville 217357640a feat(test/reporter): only show tx details on option 2019-03-01 10:58:57 -05:00
Jonathan Rainville 87d92b6091 feat(test/reporter): log tx functions during tests
Extract function log function to utils to use in the reporter
  to show txs in tests
2019-03-01 10:58:57 -05:00
emizzle 89753c11e3 feature(@embark/cockpit): Add contract state changes to cockpit
Add contract state changes to the cockpit by sending contract state updates via the websocket.
2019-02-28 16:37:19 +11:00
emizzle bb86b605de fix(@embark/core): `web3.eth.getAccounts` returning empty
`web3.eth.getAccounts` was returning an empty array in the console due to a change, that I’m unsure of what the original intention was for.

@andremederios, could you please take a look, and let me know if this breaks the intention of the original changes?
2019-02-28 16:36:11 +11:00
emizzle a67a4ad96e fix(@embark/cockpit): Fix whisper messages not being received
Cockpit whisper messages were not being subscribed to due to a inocuous bug that would swallow errors and ultimately not be subscribed to the `rxjs` observer.
2019-02-27 14:51:24 +11:00
Jonathan Rainville c708bad8bb chore(cockpit/estimator): always return an integer for getGasPrice 2019-02-26 13:01:50 -05:00
Jonathan Rainville 1759aac8aa fix(cockpit/estimator): make estimator clearer 2019-02-26 13:01:50 -05:00
Jonathan Rainville 57cd6d3da1 feat(console): print console results as log so cockpit gets it 2019-02-26 12:55:58 -05:00
Jonathan Rainville e3396417da feat(cockpit/console): display cmds from cockpit in embark console 2019-02-26 12:55:58 -05:00
Anthony Laibe 46221a3bc0 feat(coverage): load contracts from plugin 2019-02-26 14:37:58 +00:00
Anthony Laibe f5f610d520 fix(embark-ui): pagination 2019-02-26 14:37:58 +00:00
Anthony Laibe 24a6a4701f fix: handle the case where account is an object 2019-02-26 14:37:58 +00:00
Anthony Laibe 7d5935dc0b fix: fetch accounts 2019-02-26 14:37:58 +00:00
Anthony Laibe 90adaab523 fix(solidity): make original really original 2019-02-26 14:36:37 +00:00
Iuri Matias 476fc246dd bug fix (@embark/embark) display better error message when an account is defined but invalid 2019-02-25 15:15:34 -05:00
Jonathan Rainville 7fffc442d4 fix(build): start code-generator service even for contracts only 2019-02-25 15:08:44 -05:00
Jonathan Rainville ed77fc7287 fix(blockchain-process): display error message when bad port 2019-02-25 15:08:10 -05:00
emizzle 0eaad43e4d fix(@embark/cockpit): Fix cockpit not suggesting console commands
This PR fixes a number of issues relating to the cockpit console.

#### Console commands display in cockpit console
Fix cockpit console not displaying console usage commands that included “<usage option>”. For example “resolve <name>” would not display the “<name>” part, as it was attempting to write this in as HTML (ansi-to-html conversion).

This was fixed by replacing any instances of “<usage>” with “[usage]”. Please note that future usage strings should not contain text wrapped in “<>”.

#### Autosuggestions for “web.eth.” not appearing
Fix “web3.eth.” not suggesting members of `web3.eth`. This was due to a `Object.keys(web3.eth)` throwing `'getOwnPropertyDescriptor' on proxy: trap returned descriptor for property 'defaultAccount' that is incompatible with the existing property in the proxy target` in the console. Changing `Object.keys` to `Object.getOwnPropertyDescriptor` solved the problem.

#### Fix autosuggestion of known console commands (ie from plugins)
Fix known console commands (ie from  plugins) not being autosuggested. For example, typing “web”, should autosuggest `webserver start/stop`,  `log webserver on`, and `log webserver off`.

This PR adds in support for registered console commands (from plugins).
2019-02-25 15:06:23 -05:00
Andre Medeiros a295a5bff5 fix: contract length check now checks the correct thing 2019-02-25 15:05:05 -05:00
Iuri Matias 10f6b6bcdb chore (@embark/templates) add missing flags to genesis.json files in the templates 2019-02-25 15:03:57 -05:00
Iuri Matias 017ec59b23 chore (@embark/embark-ui) clarify token login in cockpit 2019-02-25 15:03:46 -05:00
Iuri Matias 5bb0d7ceae chore (@embark/embark-ui) clarify placeholders in ens utils 2019-02-25 15:03:46 -05:00
Jonathan Rainville a84dd01eba change port for API 2019-02-25 15:00:35 -05:00
Jonathan Rainville a62d03dc7e rename to embarkjs-connector-web3 2019-02-25 15:00:35 -05:00
Jonathan Rainville 4eee4dfc65 chore(templates): replace blockchain.connect by onReady 2019-02-25 15:00:35 -05:00
Jonathan Rainville 7eceaf6c0a feat(web3-connector): convert web3connector to class and add connect 2019-02-25 15:00:35 -05:00
Jonathan Rainville a0d336e49e fix(embarkjs/blockchain): only call doFirst once on connect 2019-02-25 15:00:35 -05:00
Jonathan Rainville 5ab3e46947 feat(plugins): enable external plugin to be classes 2019-02-25 15:00:35 -05:00
Jonathan Rainville c9e6da9377 chore: rename web3connector to embarkjs-web3-connector 2019-02-25 15:00:35 -05:00
Iuri Matias c099be6172 chore (@embark/embark) rename service name from api to cockpit so it's clearer where cockpit is running 2019-02-25 15:00:02 -05:00
Andre Medeiros 576836df87 fix: use right accounts for contract deployment 2019-02-25 14:59:08 -05:00
Jonathan Rainville b5a3897795 fix(contracts): fix contracts being instanceOf a contract with libs 2019-02-22 11:33:37 -05:00
Jonathan Rainville dd14262108 fix(contractsConfig): fix using ints as gas and gasPrice 2019-02-22 11:33:37 -05:00
Jonathan Rainville a895e839fa fix(contract-artifacts): set address as deployedAddress on artifacts 2019-02-22 11:33:37 -05:00
Jonathan Rainville 0b77710003 chore(templates): fix typo in explicit 2019-02-22 11:33:30 -05:00
Jonathan Rainville fc113e8b2d fix(pipeline): fix contract magic imports 2019-02-22 11:33:30 -05:00
emizzle 0d72ebeda8 fix(@embark/storage): Fix storage not connecting error
In addition to `EmbarkJS.Storage` not being available in the console (ie `await EmbarkJS.Storage.isAvailable() alway returned false), the error `Could not connect to a storage provider using any of the dappConnections in the storage config` would always appear in the console. The storage operations in the dapps were working OK.

The fix to this was three-fold:
1) Wait for the ipfs process to be started before attempting to run the `EmbarkJS.Storage.registerProvider/setProvider` in the console.
2) Wait for `EmbarkJS.Storage.registerProvider` to be called before `EmbarkJS.Storage.setProvider`. This was actually handled in the previous PR.
3) Remove any async operations from the `setProviders` method in the storage module. This was causing `callback is not defined` errors which were being swallowed and masqueraded as an unsuccessful attempt to connect to a `dappConnection` or `upload` config.
2019-02-22 10:38:50 +11:00
emizzle d378ccf150 feat(@embark/core): Auto generate EmbarkJS events
For every provider registered and set with EmbarkJS, auto generate events to inform other modules of the state of the provider.

Any provider that belongs to EmbarkJS (currently Blockchain, Names, Messages, and Storage) will have both a `runcode:<provider name>:providerRegistered` and a `runcode:<provider name>:providerSet` event created automatically when the `CodeRunner` is instantiated.

Once the `registerProvider` code is run through the VM, ie `EmbarkJS.Blockchain.registerProvider(…)`, the corresponding event will be fired, ie `runcode:blockchain:providerRegistered`.

Likewise, once the `setProvider` code is run through the VM, ie `EmbarkJS.Blockchain.setProvider(…)`, the corresponding event will be fired, ie `runcode:blockchain:providerSet`.

Additional updates/fixes with this PR:
* Move `CodeRunner` to TypeScript
* Fix console errors with ENS and Storage due to a recent PR that waits for `code-generator:ready`. The solution here was to ensure that `code-generator:ready` is requested, so that premature events can be handled.
2019-02-22 10:38:50 +11:00
emizzle 58ea3d9c30 fix(@embark/demo): Fix demo
Fix demo not running, by fixing the following issues:

This was due to the removal of `Web3` from the VM initialisation in a recent PR. The reasoning behind the removal was so that the modules that need Web3 could require it as needed, however, it is needed in 3 modules (ENS, Whisper, and web3Connector), all of which would define `const Web = …` in the code generated EmbarkJS, thus causing issues in itself. This needs to be rethought prior to removing it from the VM sandbox.

Because Web3 is back to being required in the global sandbox of the VM, it does not need to be registered in the `web3Connector` module, hence the removal of the `runcode:register`.

Module not found: Error: Can't resolve 'embarkArtifacts/contracts/SimpleStorage.js' in '/Users/emizzle/temp/embark_demo/app/components’`
This was fixed by replacing
```
import SimpleStorage from 'Embark/contracts/SimpleStorage';
```
with
```
import SimpleStorage from '../../embarkArtifacts/contracts/SimpleStorage';
```

revert changes changing __Web3 to Web3
2019-02-22 10:38:50 +11:00
Jonathan Rainville 5e9955e828 fix(coverage): fix coverage regex on Windows 2019-02-21 13:38:42 -05:00
Jonathan Rainville 84d4f3a252 fix(ens): fix ens transactions getting stuck
Only happened during tests connected to a WS node somehow
2019-02-21 13:38:42 -05:00
Jonathan Rainville e64ed36092 fix(test): fix tests getting stuck when embark is run next to it 2019-02-21 13:38:42 -05:00
Jonathan Rainville d33425fb4c fixes for the test_dapp to work 2019-02-21 12:00:10 -05:00
Jonathan Rainville e049b459c8 chore(templates): add web3connector plugin to templates 2019-02-21 12:00:10 -05:00
Andre Medeiros 1334900eae fix: log command in console 2019-02-21 11:59:59 -05:00
Jonathan Rainville ebcc3c4a8d feat: enable embark to be run with an external pipeline 2019-02-20 15:06:12 -05:00
Andre Medeiros c1d08c667a fix: specify full path for password files (geth) 2019-02-20 14:16:35 +01:00