Commit Graph

4950 Commits

Author SHA1 Message Date
Iuri Matias e02d026499 refactor(@embark/debugger): add ts definition for async; use imports instead of requires 2018-11-22 09:00:55 -05:00
Iuri Matias d06ad53ece refactor(@embark/debugger): initialize default values in private variables instead of constructor 2018-11-22 09:00:55 -05:00
Iuri Matias e2efa4baa0 feature(@embark/debugger): limit steps; display possible actions & line info 2018-11-22 09:00:55 -05:00
Iuri Matias b86634886e refactor(@embark/debugger): move debugger index.js to typescript 2018-11-22 09:00:55 -05:00
Iuri Matias 227decde0a refactor(@embark/debugger): move debugger_manager.js to typescript 2018-11-22 09:00:55 -05:00
Pascal Precht 6526e83742 fix(@embark/ens): use local ZERO_ADDRESS in ENSFunctions
We've introduced a regression in 2dfaaa8201 where zero addresses
have been replaced with a constant, including the ones within ENSFunctions.

The problem is that this code is as well added to the EmbarkJS client, where importing
`../../utils/addressUtils` won't work as it isn't available.

This commit reverts back to have ENSFunctions having its own ZERO_ADDRESS constant.
2018-11-22 12:40:46 +01:00
Pascal Precht 2dfaaa8201 refactor(@embark/ens): use ZERO_ADDRESS constant 2018-11-21 16:28:44 -05:00
Pascal Precht 2ff119d2df fix(@embark/contracts_manager): set contract `deployedAddress` if address is set
This commit fixes a bug in a scenario where dapp developers choose to refer
to an already deployed Smart Contract (they don't own) and want to use its web3 instance
on the client-side, or in deployment hooks.

For example, Dapp developers might want to do something like this:

```
// config/contract.js
...
contracts: {
  SimpleStorage: {
    address: '0x1234...' // SimpleStorage is already deployed
  }
},
afterDeploy: async (deps) => {
  const simpleStorage = deps.contracts.SimpleStorage; // this is the web3 instance created from an ABI
  const value = await simpleStorage.methods.get().call();
  console.log(value);
}
...
```

In order for Embark to create ready-to-use web3 Smart Contract instances,
it needs the contract's ABI. At the moment there are two possible ways to
achieve this for contracts we don't own:

1. Set the `address` of the already deployed contract and create a Solidity
   interface with the same name of the existing Contract that matches that
   Contract's interface. Embark is then going to compile that interface
   which will output an ABI whic can be used for web3 instance creation.

2. If the source of the 3rd party Smart Contract is available, use the
   `file` option to specify the path to the source, which Embark then picks
   up for compilation. Again, this results in ABI code which is then used
   for web3 instance creation.

As of now option 1) doesn't actually work, at least web3 is going to throw
an error when trying to access Smart Contract instances that have been created
that way. The reason for that is that the instance doesn't have a `deployedAddress`.

This commit ensures that the `deployedAddress` is set when the Smart Contract
config comes with a preconfigured `address`.
2018-11-21 16:28:23 -05:00
Andre Medeiros 4dca72368b fix(@embark/cmd): output contract json
This fix ensures that `embark build --contracts` outputs the contracts
the same way a normal build would.
2018-11-21 16:13:54 -05:00
Richard Ramos 46e351ed36 feat(@embark/whister): Add signature and recipient public key to whisper envelope 2018-11-21 16:08:56 -05:00
Jonathan Rainville 0032569b50 fix(tests): enable coverage only when --coverage
Fixes #1091
Speeds up tests because coverage does stuff on each block
2018-11-21 15:57:42 -05:00
Filip Š 6522aaae24 Add Slovenian translation 2018-11-21 15:53:37 -05:00
Andre Medeiros 485b8ef558
fix: handle contracts being removed
Fixes #1077
2018-11-21 13:40:41 +01:00
Pascal Precht ab41860d9b chore: introduce release script
This commit automates our release process. It takes care of a couple of things:

- Bumps version number in package.json as needed, see below
- Generates changelog based on commit history
- Create release commit
- Tags release commit
- Pushes release commit including tags to upstream repository
- Publishes release on npm

There are a couple of options supported. The base command is run like this:

```
npm run release
```

This will do a minor bump and try to push to `origin` on `master`. However,
this can be altered with the following options.

```
npm run release -- --dry-run
```

Can be used to perform dry run and not actually committing, tagging, pushing,
publishing anything.

```
npm run release -- --release-as <something>
```

Something can be `minor`, `major`, `patch` or anything you want `foo`, `1.0.0` etc.

```
npm run release -- --prerelease alpha
```

Will create a prerelease version a la `4.0.0-alpha.x`.

```
npm run release -- --prerelease alpha --npm-dist-tag next
```

Publishes a dist tag on npm using dist tag `next`

```
npm run release -- --sign
```

Signs the release commit (you need to have PGP setup for that).

```
npm run release -- --repo-origin pascal --repo-branch foo/bar
```

Pushes the release commit into `pascal/foo/bar`.
2018-11-21 13:28:50 +01:00
Anthony Laibe 45afe83cb3 feat: update to solc 0.5.0 2018-11-21 08:50:43 +00:00
Anthony Laibe f32ddc9935 fix: coverage count
Instead of full match, start to count as soon
as there is 1 match
2018-11-21 08:50:01 +00:00
Pascal Precht c66fe695f0 refactor(@embark/deployment): make use of newly introduced ZERO_ADDRESS 2018-11-20 16:41:32 +01:00
Pascal Precht 8b68beca17 feat: introduce function support for deploy lifecycle hooks
Prior to this commits deployment lifecycle hooks had been defined as Array<string> due
to historical reasons (contracts.js) used to be a json file back in the days.

`deployIf`, `onDeploy` and `afterDeploy` can now be defined as (async)
function and have access to several dependencies such as contract instances and web3.
However, in order to have needed dependencies registered in the dependencies object,
all lifecycle hook dependencies need to be listed in the `deps` property
as shown below.

Also note that this is NOT a breaking change. Existing deployment lifecycle
hooks written in Array<string> style still work.

All three lifecycle hooks can now be defined as (async) functions and get an dependency
object with a shape like this:

```
interface DeploymentLifecycleHookDependencies {
  contracts: Map<string, ContractInstance>;
  web3: Web3Instance
}
```

`deployIf` lifecycle hook has to return a promise (or be defined using async/await and return
a value) like this:

```
contracts: {
  MyToken: {...},
  SimpleStorage: {
    deps: ['MyToken'], // this is needed to make `MyToken` available within `dependencies`
    deployIf: async (dependencies) => {
      return dependencies.contracts.MyToken_address;
    }
  },
}
```

Vanilla promises (instead of async/await) can be used as well:

```
contracts: {
  MyToken: {...},
  SimpleStorage: {
    deps: ['MyToken'],
    deployIf: (dependencies) => {
      return new Promise(resolve => resolve(dependencies.contracts.MyToken_address);
    }
  },
}
```

`onDeploy` as well, returns either a promise or is used using async/await:

```
contracts: {
  SimpleStorage: {
    onDeploy: async (dependencies) => {
      const simpleStorage = dependencies.contracts.SimpleStorage;
      const value = await simpleStorage.methods.get().call();
      console.log(value);
    }
  },
}
```

`afterDeploy` has automatically access to all configured and deployed contracts of the dapp:

```
contracts: {
  SimpleStorage: {...},
  MyToken: {...},
  afterDeploy: (dependencies) => {
    console.log('Done!');
  }
}
```

Closes #1029
2018-11-20 16:41:03 +01:00
Michael Bradley, Jr 53191447f5 build: use yarn for reproducible builds and CI
yarn.lock files are generated for embark and embark-ui, and their package.json
files and other npm related files are updated to support and require using yarn
for development of embark itself and for embark's CI.
2018-11-20 09:25:42 -06:00
Michael Bradley, Jr 9cd50c2031 build: remove and disable npm lock files, rely on pinned dev/deps
Buggy behavior related to npm lock files makes the goal of reproducible builds
and hassle-free automated releases nearly impossible to achieve at
present. With npm's lock files disabled we rely on pinned dependencies (exact
versions only in the package.json files of embark and embark-ui) for a
hopefully good result. This is an experiment while the project is in an alpha
release phase, and if problems are experienced we can return to using
npm-shrinkwrap.json / package-lock.json, or we can investigate a transition to
the yarn package manager, for ourselves and possibly for our users too.
2018-11-20 09:25:42 -06:00
Anthony Laibe 10caddd872 fix(ui): white screen on text editor
Only happens on Firefox
2018-11-20 13:31:50 +00:00
Anthony Laibe 66e431cf13 fix(ui): switch aside 2018-11-20 09:21:03 +00:00
Jonathan Rainville cabfa939e7 fix(ipc): sends requests and events only when connected
Fixes #1063
2018-11-18 13:00:44 -05:00
Santiago Gonzalez Toral 89e3eb6156 feat(@embark/cli): add --template option to embark demo cli command
Adds a --template option to the embark demo cli command so it is now possible to generate a demo project using an existing embark's template repository on Github with an existing demo branch (e.g. embark demo --template vue will use embark-framework/embark-vue-template#demo), or any other git URL repository. If no --template option is specified, the command  will generate a demo from default template in templates/demo
2018-11-18 12:50:02 -05:00
Anthony Laibe 58795ca7d2 refactor(core): convert i18n to TS 2018-11-18 12:30:36 -05:00
Jonathan Rainville c85c3bc809
Merge pull request #1089 from embark-framework/bug_fix/deploy-error
Fix using an object as arguments
2018-11-16 08:37:24 -05:00
Anthony Laibe b63525e7c0 style(modules/coverage): replace var 2018-11-16 09:49:30 +00:00
Anthony Laibe f84d7f1d21 feat: run coverage for bytecode and deployedBytecode 2018-11-16 09:49:30 +00:00
Anthony Laibe 3406ae833c feat: Allow parallel deploy 2018-11-16 09:35:12 +00:00
Anthony Laibe 51b8224325 feat: permanently save logs/events 2018-11-16 09:31:14 +00:00
Anthony Laibe 7fb5c0d0da chore: add scripts to start embark only 2018-11-16 09:31:14 +00:00
Jonathan Rainville 6b61c8ada9 fix(contracts_manager): fix object contract arguments 2018-11-15 14:53:27 -05:00
Jonathan Rainville 7a5035ec49 fix(deployment): add a message when the errror is about the input 2018-11-15 14:19:44 -05:00
Iuri Matias 21dff441d1 refactor(@embark/console): move console index.js to typescript 2018-11-15 14:00:30 -05:00
Iuri Matias d427e626c2 feat(@embark/console): better determine suggestions for any js object not just with the dot.' 2018-11-15 13:51:05 -05:00
Iuri Matias 23f623d750 refactor(@embark/console): convert suggestions class into typescript 2018-11-15 13:51:05 -05:00
Iuri Matias f206062919 feat(@embark/console): determine suggestions automatically for a js object of the type 'command.' 2018-11-15 13:51:05 -05:00
Iuri Matias 29117c280a refactor(@embark/console): refactor getSuggestions to return results in a callback; move sorting to its own method 2018-11-15 13:51:05 -05:00
Anthony Laibe 327aa00141 docs: align with angular/conventional commit config 2018-11-15 12:12:43 +01:00
Pascal Precht d3f6b43986 fix(@embark/core): ensure 0x0 address are extended to full zero addresses
This was a regression introduced in a web3 upgrade where `0x0` addresses where no longer
accepted as valid addresses and have to be replaced with full zero addresses.

This commit ensures that, if Embark apps still make use of `0x0` addresses in
their configs, they are properly replaced or extended to satisfy web3's APIs.

Fixes #956
2018-11-14 16:03:39 +01:00
Pascal Precht 70a61c5965 uiux(@embark/cli): propose `build --contracts as alternative if `compile` is used 2018-11-14 12:16:56 +01:00
Iuri Matias 3986d9761c chore(@embark/utils): convert utils/hosts.js to typescript 2018-11-13 10:35:24 -05:00
Anthony Laibe 192e6e112a chore(embark-ui): upgrade embark-ui to latest and greatest CRA 2018-11-13 10:55:35 +00:00
Jonathan Rainville 1a29a8f6c9
fix(simulator): adds `node` to sim command to comply with Windows 2018-11-13 10:19:51 +01:00
Jonathan Rainville 3353a05c3e
fix(simulator): use config's gas limit if no option provided
Fixes #1054
2018-11-13 10:19:51 +01:00
Jonathan Rainville 43be2a28d6
fix(cmd): removes -h as an option for host for the simulator 2018-11-13 10:19:50 +01:00
Pascal Precht 4961f70e5f fix(@embark/core): don't expect `balance` on `accounts`
In 594d1323fa we've introduced the ability
to configure balance-related options with human readable ether units.

There are cases where there's account configurations that don't come
with a `balance` property, which breaks Embark when running an Embark app.

Fixes #1067
2018-11-13 10:17:55 +01:00
Anthony Laibe f82d3de1b0 feat: add CRUD to file explorer 2018-11-13 09:13:23 +00:00
Anthony Laibe c8d6f18648
Merge pull request #1068 from embark-framework/bugfix/no-webserver-no-url
fix: do not display log if no webserver
2018-11-13 09:13:01 +00:00
Pascal Precht 8a00e04c06 chore(@embark/cli): introduce alias for `--simple` option in `run` command
Closes #1025
2018-11-13 10:11:08 +01:00