Commit Graph

511 Commits

Author SHA1 Message Date
Michael Bradley, Jr 3590197c55 fix(@cockpit/debugger): check if `debuggingContract` is undefined
Guard against redux-saga fetching races in `componentDidUpdate`.
2019-07-09 13:02:51 -05:00
Pascal Precht 3f77272e71 fix(@cockpit): don't send invalid value to Smart Contract methods
We've introduced a regression in 536a4029ba where the default
`value` sent to payable Smart Contract methods is `-1`, resulting in errors as it's not
a valid value.
2019-07-09 08:10:13 +02:00
Jonathan Rainville 9390673ef4 chore: update shelljs to 0.8.3 for all packages 2019-07-08 11:25:30 -05:00
Jonathan Rainville 1e59b58887 feat(@embark/solc): add embark-solc to monorepo 2019-07-08 11:25:30 -05:00
Jonathan Rainville c87d7da4cc fix(@embark/code-generator): use plugins for contract generation
`contractGeneration` plugins were only used in the Embark console
Now they are used to generate the Dapp artifacts too
2019-07-08 10:26:16 -05:00
emizzle 536a4029ba feat(@cockpit): Pass tx value as wei and add validation
For payable methods inside of the contract interatction section of cockpit, the value input has been updated to pass wei to the API. The input field now accepts value like `100 ether` or 25 szabo`. The value entered is automatically converted to wei and shown to the user in real time.

Additionally, the input is validated for a correct value, with an error shown to the user for incorrectly entered values.

A tooltip has been added to help the user enter correct values.

UI updates can be seen in video here: https://monosnap.com/file/642cHH2HxDeiFLzB2VLqHP9GuqoRfz
2019-07-08 10:00:34 -05:00
Pascal Precht 70ff3c1825 fix(@embark/contracts-manager): ensure ETH values sent through APIs are converted to string
This is due to a bug that has been introduced in d10c0b7951 where we end up
sending values as numbers to web3's `toWei()` utility. The `value` is always sent as number
and in fact always defined, so we just need to check for it's type and convert it to a string
according to `toWei()`'s API.
2019-07-08 10:00:34 -05:00
Michael Bradley, Jr bd602b45ee refactor(@embark/storage): wrap require.resolve in try/catch
Wrap `require.resolve` in try/catch instead of testing the path with
`embark.fs.access`.
2019-07-05 17:01:09 -05:00
Michael Bradley, Jr 13e926659f refactor(@embark/core): move CoreProcess into embark-core 2019-07-05 16:07:58 -05:00
Michael Bradley, Jr 04694edb0b refactor: move storage, ipfs and swarm modules into their own packages 2019-07-05 16:07:45 -05:00
Michael Bradley, Jr 158de04baf refactor(@embark/ens): remove caret range from async dependency 2019-07-05 16:05:21 -05:00
Pascal Precht d76a82a30a fix(@embark/deployment): don't over estimate gas when running tests against non-simulator nodes
When running tests against non-simulated blockchain nodes, even for simplex
Smart Contracts, deployment transactions would exceed the block gas limit.

E.g. running `embark blockchain` in one process and `embark test --node embark`
in another, inside our demo application, will throw an error when Embark attempts
to deploy its `SimpleStorage`:

```
Compiling contracts
Compilation done

[SimpleStorage]: error deploying =SimpleStorage= due to error: Returned error: exceeds block gas limit
Error deploying contracts. Please fix errors to continue.
Error deploying contracts. Please fix errors to continue.
terminating due to error
Error deploying contracts. Please fix errors to continue.
```

The reason for that is because in https://github.com/embark-framework/embark/pull/1650, we've introduced a static
gas estimation for Smart Contract deployment that is just right below Ganache's
maximum gas limit of `6721975`, since Ganache tends to underestimate gas for
complex Smart Contracts due to its [low base fee](8ad1ab29de/lib/utils/gasEstimation.js (L33-L39)).

The static gas estimation would apply any time we're in a test context, but we
didn't take into account the case where tests are executed against nodes
other than the simulated environment.

As mentioned in the comments in the linked PR:

> If this is not spec'ed at all, I wonder what complications it could cause when
> at some point we maybe switch to not using Ganache anymore for tests, or even
> the user itself (which I think is a reasonable thing to do).

This causes the error described above because we easily reach the block gas limit
with just two Smart Contracts and Embark already deploys a few Smart Contracts for
ENS.

So basically what we want is to use the static gas estimation when we know
the node we're connecting to is Ganache. In all other cases we can rely on the
standardized gas estimation offered by the node.
2019-07-05 14:15:12 +02:00
Jonathan Rainville 421c340613 fix(@embark/ipc): fix functions not being printed in console 2019-07-05 14:12:43 +02:00
Jonathan Rainville 0e9a4a136b feat(@embark/ui): sort contracts and functions alphabetically 2019-07-05 14:11:34 +02:00
Michael Bradley, Jr 52d54f0d87 fix(@cockpit/explorers): consistently display "Mined on" timestamps
Adjust the API endpoints to augment transaction objects with a timestamp
property from their corresponding blocks. This removes the necessity to copy
the timestamp property from a block to its transactions in the client.

Introduce a `formatTimestampForDisplay` util function in Cockpit for
consistently transforming timestamps into relative or absolute dates, depending
on whether a date is sometime during the last day.
2019-07-03 08:25:08 -05:00
Michael Bradley, Jr 7d27125eed fix(@embark/code-runner): restore EmbarkJS.environment property in the cli dashboard
The property is set/available on EmbarkJS in the artifacts, i.e. in a browser
build; but sometime since v3.2.4 it was no longer availble in the cli dashboard
environment.
2019-07-02 10:48:53 -05:00
Pascal Precht 93ca3ad97c fix(@embark/embarkjs-whisper): Messages.isAvailable() should always return a promise
`EmbarkJS.Messages.isAvailable()` in some cases return synchronously (when whisper isn't
set up), in other cases asynchronously. This actually breaks our demo application for
the following reason:

We check for Whisper's availability via:

```
EmbarkJS.Messages.Providers.whisper.getWhisperVersion((err, _version) => {
  if (err) {
    return console.log(err);
  }
  this.setState({whisperEnabled: true});
});
```

There's a couple of problems here:

- This code will break right away when whisper isn't available, resulting in an error:
  ```
  Cannot read property _requestManager of undefined
  ```

- The reason this error happens is because there's no `web3` object available inside
  our EmbarkJS.Messages code. Even though there **is** a web3 object, EmbarkJS.Messages
  doesn't know about this because it only sets it when its `setProvider()` API is called,
  which effectively doesn't happen at all when Whisper isn't enabled on the connected
  node

- While this could be fixed with a simple check on whether EmbarkJS.Messages' internal
  `web3` references is a thing, really what should be used in the demo is the `isAvailable()`
  API.

`isAvailable()` should always return a promise (similar to `EmbarkJS.Storage.isAvailable()`.

This commit ensures that `isAvailable()` always returns a promise and changes the demo
template to use `isAvailable()` over `getWhisperVersion()`.
2019-07-01 11:11:03 +02:00
Pascal Precht fc7eb0cca6 uiux(@cockpit/sign-and-verify): improve wording for verifying messages 2019-07-01 11:10:37 +02:00
Michael Bradley, Jr eecb48f5b6 chore(release): 4.1.0-beta.4 2019-06-27 14:23:32 -05:00
Jonathan Rainville f6d7a54195 fix(@embark/deploy-tracker): fix getting the block 0 with sim --fork 2019-06-27 14:12:29 -05:00
Jonathan Rainville 198a5dc3f4 fix(@embark/solidity): show a better error message in debug 2019-06-27 14:10:53 -05:00
Iuri Matias fc4faa8ba9 fix: alleviate races re: embarkjs by introducing Plugin#addGeneratedCode and related refactors 2019-06-27 14:10:12 -05:00
Michael Bradley, Jr d684b9af0f refactor(@embarkjs/web3): make web3 connector an internal plugin like the other embarkjs-* packages
Effectively deprecate the `embarkjs-connector-web3` package but don't introduce
a breaking change by simply not loading the plugin if it's specified in a
DApp's `embark.json`. If the deprecated plugin is specified, display a message
indicating the plugin was ignored and suggesting it be removed from the
project's `embark.json` and `package.json`.
2019-06-27 14:10:12 -05:00
emizzle 71cb161525 feat(@embark/blockchain-connector): Add command to get full account info
This PR adds a command to get full account details from the contradts config that includes info like private key.

The existing, and similar command, `blockchain:provider:contract:accounts:get` would only return account addresses if they existed, and not the full account info.
2019-06-27 08:42:58 -05:00
Michael Bradley, Jr 2ce9ca6bb0 fix(@embark/coverage): function types and single statement ifs 2019-06-27 08:40:24 -05:00
Pascal Precht 610d8f1baa fix(@cockpit/utils): Ensure whisper channels are at least 4 characters long
This check was already made when sending messages to whisper channel, however, we didn't
perform the same check when subscribing to channels within cockpit.
2019-06-27 08:36:25 -05:00
Jonathan Rainville 908aa3b148 fix(templates): fix templates because tests don't like empty files 2019-06-21 11:00:27 -04:00
Jonathan Rainville 9646673c6f fix(@embark/test-runner): only run tests on files with describe 2019-06-21 11:00:27 -04:00
Jonathan Rainville 332229ff9d feat(@embark/test-runner): return accounts in the describe callback 2019-06-21 11:00:27 -04:00
Jonathan Rainville 8c16541019 feat(@embark/test-runner): wait for deploy before enterning describe 2019-06-21 11:00:27 -04:00
Pascal Precht 24b53395b0 fix(@embark/config): disable webserver if pipeline is disabled
The webserver's job is to serve files generated by Embark's built-in pipeline,
however, since v4 users can choose they front-end tool to take care of building,
bundling and packing their DApps. Usually these tools come with a built-in
dev server as well.

Therefore, when the pipeline is turned off (which also soon will be the default),
there's not need start a webserver.
2019-06-20 10:49:00 +02:00
Pascal Precht 9e5c9c7f17 fix(@embark/deployment): don't break when using abiDefinitions
In https://github.com/embark-framework/embark/pull/1119 we've introduced a feature where
users can provide an already compiled ABI for Smart Contracts so they can be used
without the need to compiling them again.

This also means that, internally, those Smart Contract object won't have any
bytecode attached to it.

Later on, in 387d33a076,  we've introduced a warning
which is rendered when a Smart Contract's bytecode is too large. The check expects
a Smart Contract object to have bytecode associated to it, which will break the code
in cases where a Smart Contract has already an ABI and therefore didn't need compilation.

This commit ensures we only check a Smart Contract's bytecode when bytecode exists for
the Smart Contract in question.
2019-06-19 11:48:57 +02:00
Jonathan Rainville e288483661 fix(@embark/test-runenr): fix event listener overflow 2019-06-17 11:37:07 -04:00
Jonathan Rainville d5bce81e56 refactor: add normalizePath and toForwardSlashes for replaces 2019-06-11 10:02:08 +02:00
Jonathan Rainville 1edd68f3bd fix(@embark/solidity): fix recursive error on Windows 2019-06-11 10:02:08 +02:00
Michael Bradley, Jr ff3100b035 chore(release): 4.1.0-beta.3 2019-06-07 13:42:13 -05:00
Michael Bradley, Jr d264070069 style(@embark/contracts-manager): add semicolon to end of statement 2019-06-06 15:49:53 -05:00
Pascal Precht d10c0b7951 feat(@cockpit/explorer): enable users to send ether through payable methods (#1649) 2019-06-06 12:52:01 -04:00
Michael Bradley, Jr ed65b066e7 refactor (@embark/embarkjs-ens): move embarkjs-ens to its own module 2019-06-06 11:47:03 -05:00
Michael Bradley, Jr b45b2e21db fix(@embarkjs): unconditionally require symlinked embarkjs-* modules 2019-06-06 08:26:20 -05:00
André Medeiros 312c631f86
fix: gas estimates in test (#1650) 2019-06-04 13:12:43 -04:00
Andre Medeiros 0f633cd04e chore: make contract artifacts usable in node 2019-06-01 17:35:10 -05:00
Pascal Precht f2903e7577 fix(@embarkjs/whisper): don't rely on global EmbarkJS in whisper APIs
When trying to either sending, or listening to whisper channels within
Embark's consoles (CLI and Cockpit), the console outputs an error that
`EmbarkJS` isn't defined.

E.g. running:

```
> EmbarkJS.Messages.listenTo({ topic: ['somechannel'])
```

Outputs:

```
EmbarkJS is not defined
```

This seemed very odd as outputting `EmbarkJS` and all of its members
worked totally fine.

It turns out that both methods, `listenTo()` and `sendMessage()`, in
`EmbarkJS.Messages` are not necessarily what one thinks they are.
EmbarkJS decorates both methods to create some options that need to be
available in the delegate, two of them being `EmbarkJS.Utils.toAscii`
and `EmbarkJS.Utils.fromAscii` (ac76a40a61/packages/embarkjs-whisper/src/index.js (L43-L62) and ac76a40a61/packages/embarkjs-whisper/src/index.js (L64-L73))

These two global references to `EmbarkJS` are the only ones in `embarkjs-whisper`
and they are not the same reference as the `EmbarkJS` sandbox global
registered in the VM here ac76a40a61/packages/embark-code-runner/src/index.ts (L33).

In other words, the `EmbarkJS is not defined` message actually refers
to the `EmbarkJS` in the wrapping method, not the one registered with
the VM, which is also why inspecting the `EmbarkJS` object through the
VM works fine.

Since the `toAscii()` and `fromAscii()` methods in use are really just
facades around `web3.utils.[fromAscii|toAscii]()`, we can replace the
global EmbarkJS dependency with web3 utils that are already available
anyways.
2019-05-31 14:07:38 +02:00
Michael Bradley, Jr 3c9ed4183d refactor(@embark/watcher): downgrade from chokidar 3.x to latest 2.x
chokidar 3.x has fsevents `^2.0.6` [as a dependency][dependency], which
introduced node v12.x compatibility, a sought-after goal of our PR
1638. However, fsevents `2.0.6` node compatibility range is quite
[complicated][complicated]. After fsevents `2.0.6` was published its
maintainers published `1.2.9`, which backports NodeJS v12.x compatibility minus
some performance increases, while offering [much more
straightforward][straightforward] node compatibility. fsevents `1.2.9` [is
compatible][compatible] with the latest v2.x release of
chokidar (`2.1.6`). Since Embark advertises runtime compatibility with node
`>=8.11.3`, downgrade chokidar to `2.1.6`.

[dependency]: https://github.com/paulmillr/chokidar/blob/3.0.0/package.json#L25
[complicated]: https://github.com/fsevents/fsevents/blob/v2.0.6/package.json#L10
[straightforward]: https://github.com/fsevents/fsevents/blob/v1.2.9/package.json#L14
[compatible]: https://github.com/paulmillr/chokidar/blob/2.1.6/package.json#L49
2019-05-29 22:09:23 -05:00
Michael Bradley, Jr ac76a40a61 fix(@cockpit/explorer): slice contract function result string only if starts/ends with double-quote
Closes #1636.
2019-05-28 09:36:38 +02:00
Michael Bradley, Jr d116549c32 refactor(@embark/watcher): upgrade chokidar to 3.0.0
Upgrade chokidar to a version that's compatible with NodeJS v12.x.

Unfortunately, embark has other transitive dependencies that are not compatible
with v12.x, but upgrading chokidar is still a good step.
2019-05-28 09:36:06 +02:00
Michael Bradley, Jr 030aba190d build: change the engines range for NodeJS to indicate embark is not compatible with v12.x 2019-05-28 09:35:44 +02:00
Michael Bradley, Jr d477adc87e feat(@embark/cli): exit with error if --template and --contracts-only are both used with 'new' cmd 2019-05-28 09:35:24 +02:00
Pascal Precht e5fc12e256 fix(@embark/test-runner): don't try to deploy and register ENS domains after JS tests have run
When running unit tests inside a project that configures ENS subdomains using Smart Contract directives,
the tests will output an error because of that particular Smart Contract's `deployedAddress` being `undefined`.

This happens only when running tests, not when deploying the Smart Contracts including the custom ENS setup.

It turns out that Embark attempts to compile and deploy the Smart Contracts of the project *twice* - once
before tests are executed, and another time **after** tests are done executing.

Both compilations/deployments are triggered through our custom `config()` function within test context,
which ensures all Smart Contracts are deployed before tests are executed.

This explains a few things:

1. There's no such issue when running `embark run`, in fact the custom ENS subdomains work perfectly fine
2. That's also why the tests are passing fine as well as the first compilation/deployment doesn't have any issues.
The errors only appear *after* the tests have been executed.

Still, this raises a few more questions, mainly

- Why is the Smart Contract's `deployedAddress` property `undefined` when `config()` is executed a second time?
- Why is `config()` executed a second time in the first place?

Let's look into both of these.

Assuming that there's a valid reason that `config()` is called twice, it's remains unclear why that property
of a Smart Contract object is `undefined` in the second run. The reason for that is that Embark determines whether
or not a particular Smart Contract should be deployed. One of the routines ensures that only the Smart Contracts
configured for deployment are actually attempted to be deployed (as opposed to just deploying all Smart Contracts
found in the file system).

It turns out that the second `config()` call is done without any Smart Contract configuration, resulting basically in no deployment
for any Smart Contract of the application. The `address` and `deployedAddress` of a Smart Contract object are however only set
 *after* deployment, resulting in them being `undefined`.

**All this makes sense.**

`config()` is simply not designed for being used with an empty `contracts: {}` config. This raises another question:

Why is `config()` called with an empty configuration? This leads us to the second point.

It does seem a bit weird that Embark tries to configure compile *and* deploy a DApp's Smart Contracts again right **after**
the tests have been executed. So why is that?

A quick `git blame` (no blame intended here) shows us that this routine has been introduced in https://github.com/embark-framework/embark/commit/12cbb7bdd.

Notice the second list point of the commit:

> 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.

The above is a little tricky to understand without a little bit of context: Embark runs two types of tests, JavaScript tests
and Solidity tests. It does that as part of a single process, keeping state in memory in-between those two test runs.

With that in mind, the commit mentioned above says the following:

1. Artifacts that Embark generates as part of its compilation process are erased after JS tests are done executing.
This makes a lot of sense as we don't want to leave any side effects undone when tests are finished.

2. The commit ensures that not only the artifacts are removed from disc, but also updates Embark's state in memory
for `contractFiles`. The reason for that is that otherwise, in the second test run for Solidity tests, Embark will
  throw errors as it tries to look up the path for the artifacts in memory for all the Smart Contracts that had been
  compiled before.

3. Last but not least, there's *another* state that needs a reset and that's the Smart Contract configuration. If Embark
doesn't reset the memory it'll assume in the second run that all of those Smart Contracts left in memory
"have no code associated to it", while in reality, they shouldn't be in memory in the first place.

So it seems that `config()` is called a second time with an empty Smart Contracts configuration just to ensure that memory
is reset and no error messages are shown.

As discussed earlier, this unfortunately also introduced a lot of side effects along the way as Embark tries to reregister
ENS subdomains from Smart Contracts that are marked as undeployed and therefore don't have an address to interpolate.

While there's probably different ways to go about it, the most straight forward fix is to simply not call `config()`
a second time when it's really not needed. If the goal is to just reset the memory, we can take advantage of
Embark's internal `config:contractsConfig:set` event, which is what this commit is doing.
2019-05-28 09:34:52 +02:00
snyk-bot 9029bfe947 fix: packages/embark/package.json to reduce vulnerabilities
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-HANDLEBARS-174183
- https://snyk.io/vuln/SNYK-JS-TAR-174125
- https://snyk.io/vuln/npm:mem:20180117
2019-05-24 10:38:22 -05:00
Michael Bradley, Jr 91f87d2057 chore(release): 4.1.0-beta.2 2019-05-22 18:09:06 -05:00
Michael Bradley, Jr 0253c90111 fix(@embark/utils): add find-up and globule to dependencies
The embark-utils package, since 4.1.0-beta.1, is a transitive DApp dependency;
but it's loaded in the main process (not a child process), so embark-utils' own
deps can't be indirectly supplied from embark itself via NODE_PATH.
2019-05-22 17:44:41 -05:00
Pascal Precht 2c6c9489fc fix(@cockpit/whisper): ensure message subscription call is working
When introducing the `embark-api-client` in https://github.com/embark-framework/embark/commit/c1bbdbf34
we didn't properly update Cockpits apiService, resulting in calls to API endpoints
that don't exist.

This commit fixes a bug where calls to Embark's API to subscribe to whisper
channels are in a broken state.

It also updates Cockpit's apiService to no longer pass ignored parameters to embark-api-client.
2019-05-22 17:16:16 +02:00
Pascal Precht 7a0609b66c fix(@cockpit/utils): properly detect if ENS is enabled
With the move of Embark's modules into their own packages, the names under
which they are registered in the API service have changed as well.

This caused Cockpit to no longer being able to properly detect whether
ENS is enabled in the current Embark project
2019-05-22 17:15:57 +02:00
Pascal Precht 3aca2fe17b refactor(@embark/code-runner): move code-runner into its own package 2019-05-22 17:15:39 +02:00
Pascal Precht 038928f8a5 feat(@embark/utils): introduce setUpEnv() function
This package comes with a `setUpEnv()` function that can be called to
prepare Embark's environment variables for different process contexts.

This allows us to set up Embark's environment within a test runner context
without the requirement of importing `packages/embark/src/lib/core/env.js`,
which happens to set up those necessary environment variables as a side effect.

It's important that a path to `packages/embark`'s root is passed down to `setUpEnv()`
to ensure `EMBARK_PATH` gets the correct value.

E.g. within a package `embark-console`, `setUpEnv()` can be called within its tests
like the following:

```
// packages/embark-console/src/test/console.js

import { joinPath, setUpEnv } from 'embark-utils';

setUpEnv(joinPath(__dirname, '../../../embark'));
```

Here, `__dirname + '../../../embark'` ensures `EMBARK_PATH` points to the root
of `packages/embark`. This might look different in other contexts.

For example calling this function from a test file within `packages/embark`, this would
look like this:

```
// packages/embark/src/test/some_file.js

import { joinPath, setUpEnv } from 'embark-utils';

setUpEnv(joinPath(__dirname, '../../'));
```
2019-05-22 12:23:04 +02:00
Pascal Precht 57c3502f1f refactor(@embark/coverage): move coverage module into own package
This commit also moves several utility methods into @embark/utils as needed.
2019-05-22 11:47:29 +02:00
Pascal Precht 8ca6419a4e fix(@embark/pipeline): ensure color methods for logs are available
As part of 880a3a6946, we've introduced a
regression where the `colors` package isn't imported in the scope anymore where it's
needed. In this case the pipeline package. This resulted in log output messages
such as:

```
undefinedwriting fileundefined
```

Adding the `colors` package as dependency and importing it accordingly
fixes the issue.
2019-05-21 14:46:03 +02:00
Michael Bradley, Jr a10bd69756 docs: move root readme into packages/embark and symlink into root 2019-05-21 12:12:15 +02:00
Ricardo Guilherme Schmidt 4d079de1f4 fix(@embark/ens): use namehash for resolver 2019-05-21 12:11:14 +02:00
Pascal Precht 3df7f81732
refactor: move `dappPath`, `ipcPath` and `embarkPath` into @embark/utils 2019-05-17 11:25:40 +02:00
Michael Bradley, Jr a519a5d527 build: adjust reset script to delete coverage dirs if pkg has test script
Make the adjustment even if the test script is currently disabled. Consistently
use nyc to generate coverage with mocha even if the test script is currently
disabled.
2019-05-16 12:30:03 -05:00
Michael Bradley, Jr 4ee1567264 chore(release): 4.1.0-beta.1 2019-05-15 18:44:46 -05:00
Michael Bradley, Jr c4d647c299 fix(@embark/api): setup the embark-ui build dir before the express instance 2019-05-15 18:16:41 -05:00
Michael Bradley, Jr 78f7c52080 build: supply missing deps so production builds can function correctly 2019-05-15 18:15:50 -05:00
Pascal Precht 880a3a6946 refactor(@embark/pipeline): move pipeline into own package 2019-05-15 19:59:59 +02:00
Michael Bradley, Jr 79873bd3e7 build(@embark/deploy-tracker): disable watch:typecheck script 2019-05-15 12:52:20 -05:00
Michael Bradley, Jr 5799e00708 refactor(@embark/template_generator): use yarn to install template deps if embark cli is in monorepo
If the `embark` cli is detected to be inside the monorepo, the template
generator yarn-links any template deps that are part of the monorepo into the
dapp. However, `embarkjs-connector-web3` now has a dependency on `embark-core`,
which in turn has a dependency on `embark-i18n`. That causes `npm install` to
fail inside the dapp because npm checks for deps of `embarkjs-connector-web3`
relative to the dapp instead of checking relative to the symlink. `yarn
install` does not suffer from that behavior so use it instead.
2019-05-15 11:54:30 -05:00
emizzle f5722546b1 refactor(@embark/debugger): Move to embark-debugger
Move the debugger module to the `embark-debugger` package.

Handle case where `debug` is entered as a console command, and there is no transaction to be debugged.

add embark-i18n and mocha deps
2019-05-15 14:39:00 +02:00
Andre Medeiros 46c4a5c79c chore: move deploytracker to embark-deploy-tracker module 2019-05-15 14:38:34 +02:00
emizzle 634feb597a feat(@embark/api): Add command `service api on/off`
Add support for `service api on/off` commands.

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

`service api on` - Enables the API server serving Cockpit. Shows an error if the API server is already starting or started.

`service api off` - Disables the API server serving Cockpit. Shows an error if the API server is already stopping or stopped.

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

`api stop` - This command has been deprecated in favor of `service api off` and will be removed in future versions.

`api:start` - This event has been deprecated and will be removed in future versions.

`api:stop` - This event has been deprecated and will be removed in future versions.
2019-05-15 14:28:10 +02:00
Andre Medeiros 3a07d34cc2 chore: move embark_listener to module 2019-05-15 14:27:44 +02:00
emizzle fc01daf3e9 feat(@embark/whisper): Remove support for `service whisper on/off`
Remove support for `service whisper on/off` because Whisper cannot be started without first disabling it in the communications config, then restarting Embark.

Add documentation for the `service [process] on/off` command

This command was only added a few commits back so it is not considered a breaking change.

Refactor the `service [process] on/off` commands so that there is only one command. Previously we had a command registered for each process, ie:
```
service blockchain on/off
service ipfs on/off
…
```

Now, we only have one command with many options:
```
service [process] on/off - Starts/stops the process. Options: blockchain, embark, ipfs, api
```

Whisper is deliberately not included in the available options for the aforementioned reasons.
2019-05-15 13:34:13 +02:00
Pascal Precht e3ecf68fbc refactor: move embarkPath, ipcPath and dappPath into embark-core
This enables removing unnecessary `core/fs` dependencies which can be
replaced with `fs-extra`.

This commit also fixes a bug introduced in f868d1216d
where methods from `embark.fs` weren't available.

The reason for that is because we have several *Process instances
that are created through child process communication, specifically
process.send() APIs. Using those APIs, we can only send data structures
however, methods attached on any of those will get lost.

This is the case when sending embark.fs through process.send().

We still need fs in those places though, mostly because they are relying
on embarkPath and dappPath().

These places are now importing those functions from `embark-core`. Other
API such as writeFile or mkdirp() can be accessed through fs-extra
or fs modules.
2019-05-15 12:20:22 +02:00
Michael Bradley, Jr cae583137c refactor: bump ganache-cli to latest stable version for compat with newer solc
Fixes #1461
2019-05-14 10:12:24 -05:00
Andre Medeiros 85cf9ac44b chore: upgrade ethereumjs-wallet
This pull-request upgrades `ethereumjs-wallet`, which has upgraded the underlying dependency on scrypt.js to 0.3.0, making scrypt an optional dependency and offering a pure JS version as a fallback.

The reasoning behind this is that scrypt is problematic to install in some systems, particularly those that don't have node-gyp setup and we have seen some weird issues when installing with elevated privileges (i.e. `sudo npm install -g scrypt`)
2019-05-12 18:20:34 -04:00
Pascal Precht 192549add1 refactor(@embark/blockchain-connector): move blockchain connector into own module 2019-05-10 16:57:23 -04:00
Pascal Precht 8dd7300e3c chore: remove process-logs-api package from embark package
This module has been moved already and is therefore a left over here.
2019-05-10 16:56:59 -04:00
Pascal Precht cae8075682 refactor(@embark/solidity): move solidity module into own package 2019-05-10 16:44:54 -04:00
Pascal Precht f868d1216d refactor(@embark/blockchain-process): introduce package for blockchain-process module 2019-05-10 16:44:43 -04:00
Jonathan Rainville f9d7a3f41b feat(@embark/test-runner): show interface contract message in tests
But only show it if the contract was in the contract config
2019-05-10 09:49:34 -04:00
Jonathan Rainville 334d3bcdc5 feat(@embar/contracts-manager): add message for interface contracts 2019-05-10 09:49:34 -04:00
Pascal Precht 84439cb6fe refactor(@embark/blockchain-listener): move blockchain listener APIs into package 2019-05-09 12:57:04 +02:00
Jonathan Rainville a22d8fc6c4 fix(test): fix accountParser test in regards to privateKey fix 2019-05-08 15:55:06 -05:00
Michael Bradley, Jr fd09488e4b fix(@embark/core): move process.on inside ProcessWrapper's constructor
This avoids mistakenly placing process event handlers on the parent process
whenever the `embark-core` package is loaded. Also, don't listen for an
`'exit'` event on `process` and then call `process.exit(0)` since the event "is
emitted after the child process ends" ([docs][docs]), i.e. it's unnecessary to
do so and in any case it's not correct to always exit with code `0`.

[docs]: https://nodejs.org/docs/latest-v10.x/api/child_process.html#child_process_event_exit
2019-05-08 15:55:06 -05:00
Michael Bradley, Jr 2eb5617443 refactor: use explicit codes with process.exit so intent is clear and errors don't exit cleanly 2019-05-08 15:55:06 -05:00
Michael Bradley, Jr 8b94419670 refactor(@embark/i18n): expose __ from embark-i18n, drop global __ 2019-05-08 11:01:16 +02:00
Jonathan Rainville fc02405db2 fix(@embark-utils/accountParser): fix privateKey accounts 2019-05-08 10:59:44 +02:00
emizzle 3dcc339e4d feat(@embark/storage): Add command `service swarm on/off`
Add support for ability to start and stop Swarm via command `service swarm on/off`.

Fix issue with swarm not starting due to missing web3 object.

`service swarm on` - starts a swarm node if not already started. Shows an error if the node is already starting or started.

`service swarm off` - kills the running swarm node as long as Embark has started the swarm process. If the swarm process was started externally, an error is shown.
2019-05-07 16:28:42 -04:00
Michael Bradley, Jr 2f2c0eefbf refactor(@cockpit/explorer): revise transactions explorer per techniques of PRs #1492, #1494
In addition to introducing improvements per #1492 and #1494, adjust the
transactions request action to allow for a `blockLimit` argument, since that
API parameter is supported by embark.

Revise `changePage` to invoke `fetchTransactions` correctly, i.e. with
arguments pertaining to a starting block number and a block limit.

These changes together fix most of the pagination problems related to exploring
transactions, i.e. badly mis-ordered results are no longer displayed.

However, a *wart* still remains related to estimation of the total number of
transactions and pages. Sometimes the calculated number of pages for the
transactions explorer doesn't match up to the actual number of transactions on
the blockchain (owing to estimation). The pagination controls and display of
transactions will temporarily behave a little strangely if one jumps ahead in
the pages, e.g. a jump from cockpit explorer overview's transactions page 1 to
page 5 for embark's demo, if an additional transaction has been added and the
explorer overview is freshly loaded. This behavior is related to the fact that
actions such as `fetchBlocksFull` and `fetchTransactions` are async without any
means to determine when all actions have completed and React re-/rendering has
settled down.

There are probably some architectural changes that could improve the situation,
but they're outside the scope of this PR and in no way easy to solve by means
of React lifecycle methods. In fact, attempts to make an improvement with
`componentDidUpdate` (and watching what happens in the debugger) revealed the
nature of the problem, as described above.
2019-05-07 10:40:27 -05:00
Michael Bradley, Jr fa2807b335 refactor(@cockpit/explorer): revise blocks explorer per techniques of PRs #1492, #1494 2019-05-07 10:39:58 -05:00
Pascal Precht 8a0c33c91e refactor(@embark/utils): move compact utility into utils package 2019-05-07 13:26:42 +02:00
Pascal Precht 1330b9fb7a refactor(@embark/i18n): introduce embark-i18n package 2019-05-07 13:05:22 +02:00
Pascal Precht 21a0f62d86 refactor(@embark/core): move IPC into core package 2019-05-07 12:51:29 +02:00
Pascal Precht 9acf256dc7
fix(@embark/blockchain_process): use correct import for ProcessWrapper 2019-05-07 10:12:37 +02:00
Pascal Precht ed13aecc25 refactor(@embark/core): move process APIs to embark-core 2019-05-07 10:06:48 +02:00
Pascal Precht daaa0e649d refactor(@embark/utils): move buildUrl and buildUrlFromConfig to utils 2019-05-07 10:06:48 +02:00
Michael Bradley, Jr 437cc3feed refactor(@embark/console-listener): move console_listener into embark-console-listener package 2019-05-06 15:37:52 -05:00
Michael Bradley, Jr 20f1a13ae6 refactor(@embark/utils): move hexToNumber into embark-utils package 2019-05-06 15:11:40 -05:00
Michael Bradley, Jr b8708f4305 build(@embark/console): include suggestions.json in files packed by npm 2019-05-06 10:42:25 -05:00
Pascal Precht 45a9fee20b refactor(@embark/code-generator): move code-generator into own package 2019-05-06 11:38:35 +02:00
Pascal Precht a8ee57a088 refactor(@embark/deployment): move deployment module into own package 2019-05-06 11:38:03 +02:00
Pascal Precht a69f619cf7 refactor(@embark/utils): move toChecksumAddress to embark-utils 2019-05-06 11:38:03 +02:00
Michael Bradley, Jr c30f742c38 fix(@embark/plugin-cmd): revise package.json in light of #1573, #1574, #1575, #1576 2019-05-03 15:34:19 -05:00
emizzle 1e4e6e4758 feat(@embark/storage): Add command `service ipfs on/off`
Add support for ability to start and stop IPFS via command `service ipfs on/off`.

Add support for `ProcessState.Errored` process state in the `ProcessManager`. This allows for processes being launched and stopped to trigger an error and the resulting process will be in an errored state. Processes in errored states can still attempt to be started and stopped.

`service ipfs on` - starts an IPFS node if not already started. Shows an error if the node is already starting or started.

`service ipfs off` - kills the running IPFS node as long as Embark has started the IPFS process. If the IPFS process was started externally, an error is shown.

return early
2019-05-03 14:52:55 -04:00
Andre Medeiros dcecad5501 chore: move plugin_cmd to a package 2019-05-03 13:30:26 -04:00
Andre Medeiros 661ce74877 chore: move console to module 2019-05-03 09:24:09 -05:00
Michael Bradley, Jr 2044ed5e9b build: bump tslint in all relevant pkgs from v5.11.0 to v5.16.0
Related to bumping the typescript package to its latest version
2019-05-03 08:53:43 -05:00
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