Commit Graph

5261 Commits

Author SHA1 Message Date
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 c5e29b7844 use deps instead of onDeploy 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
Anthony Laibe e6eea1df06 fix(vyper): file path 2019-02-20 14:15:41 +01:00
Andre Medeiros 271a219c8b fix: template dependency errors don't exit 2019-02-20 14:15:03 +01:00
emizzle fc823bb7eb
fix(@embark/console): Fix console not working with VM2/monorepo
The console was not working correctly with the latest VM2/monorepo updates. This PR addresses namely fixes this problem, but also adds a few more notable changes:

* SIGNIFICANT improvement in loading time for `embark console` with an already running `embark run`. This is due to removing unneeded services starting, and instead forwarding user input to the main `embark run` process.
* All user input commands are now forwarded to the `embark run` process via IPC insteaad of evaluating the command in the `embark console` process.
* Removed IPC console history as it's no longer needed due to the above. Side effects:
  ** The signature of the `runcode:eval` and `runcode:register` events was changed to remove the `toRecord` parameter.
  ** Old `runcode:eval` signature: `events.request("runcode:eval", "code to be evaluated", (err, result) => {}, isNotUserInput, tolerateError)`
  ** New `runcode:eval` signature: `events.request("runcode:eval", "code to be evaluated", (err, result) => {}, tolerateError)`
  ** Old `runcode:register` signature: `events.request("runcode:register", "varName", variableValue, toRecord, (err, result) => {})`
  ** New `runcode:register` signature: `events.request("runcode:register", "varName", variableValue, (err, result) => {})`

* Removed unneeded `forceRegister` flag.
* Removed the `VM.getWeb3Config` method as it's no longer being used (EmbarkJS contracts are pulled out from the VM instead).
* Updated `web3Connector` `blockchain:connector:ready` to allow for event requests or event emissions.
* In the tests, removed the initial `initWeb3Provider` in the `init` as it was being called twice.
* In the tests, removed the `web3Connector` check message as the tests are now using the Console, and the console does this check. This was causing duplicate messages to be displayed in the output.
* Fix `web3 is not defined` browser error
2019-02-20 14:12:30 +01:00
emizzle 84ca98f962 feat(@embark/core): Add events oracle
Add the ability to request an event before it’s command handler has been set. Also, add the ability to emit an event before a listener has been set.

The most useful use case for this is to allow modules/plugins to load asynchronously and without need to know their load order beforehand. This let’s us request events in advance of having the event command handler set by the module/plugin.

BEFORE:
```
this.events.request(“event:name”, () => {
  // never fired
});
this.events.setCommandHandler(“event:name”, cb);
```

AFTER:
```
this.events.request(“event:name”, () => {
  // YAY it fires!
});
this.events.setCommandHandler(“event:name”, cb);
```
2019-02-20 13:05:08 +01:00
emizzle e943d03ce0 fix(@embark/cockpit): Fix contract method autosuggest
Prior to this PR, typing `SimpleStorage.methods.` in to the cockpit console would not show autosuggestions for the contract methods.

Contract names are case sensitive in the VM (VM2). Update the `Suggestions.getSuggestions` method to be case-sensitive when evaluating `Object.keys(<contract class name>.methods)`.
2019-02-15 13:22:57 -05:00