Keeping up with Embark after the team joined Status has become an impossible mission. Near-lightspeed development means we can bring you so many new features that they genuinely do not fit into one post.
As a technical writer, though, it’s the best kind of problem you can have. To help us navigate it all, here’s an index of the next iteration of developer tools for #buidling truly distributed applications:
Embark 3.2 comes with ENS support right out the box, no matter which chain you’re working on. The Ethereum Name Service (an alternative to DNS) requires quite a few contracts and libraries in order to function correctly, and setting these up yourself - especially in your local environment - can be a real pain.
However, the joy of open source frameworks is that we get to stand on each others’ shoulders, so now you can use Embark to set up ENS for you locally, on your private chain or use the existing on Ropsten, Rinkeby or Mainnet, with one simple command.
You can even pre-register domain names in your development chain with:
In the above setup, resolving your DApp with the name ‘status.eth’ will point to “0x1a2f3b98e434c02363f3dac3174af93c1d690914”
The javascript required to call this example is just one line: let address = await EmbarkJS.Names.resolve('domain.eth’)
.
Oh, and embark demo
has also been updated to include a “Naming (ENS)” tab to quickly showcase how to use ENS.
The embark new
command now has a --template
option. With this option you can either specify a known template name, or a URI containing the template.
For example:embark new MyApp —template typescript
will create a new dapp ready to use with typescript.
If you wish to create a new dapp, based on the dappcon workshop app, you can begin like this:
embark new MyDTwitter —template status-im/dappcon-workshop-dapp#start-here
This cmd will create a new DApp based on the one found here. There are also basic examples of what a more distributed Twitter, or Reddit might look like, with full support for React components that should help you get up and running really fast.
The --template
option supports several URL styles and shortcuts for GitHub repositories:
git@github.com/ghuser/repo_name
https://github.com/ghuser/repo_name
github.com/ghuser/repo_name
ghuser/repo_name
You can create your own custom template. The website also has a list of available templates. Please see our list of officially supported templates.
Embark 3.2 comes with a completely re-written build pipeline with full support for webpack.
By default, Embark will have its own config with many plugins pre-configured, including:
However, if you want to customize the webpack configuration to your needs, you can run the command embark eject-webpack
. This command outputs a webpack file named webpack.config.js
to the root directory of your DApp. You can then customize it to suit your specific needs.
There are, in fact, now two different pipeline modes, production
and development
. Development modes creates source maps, and generally will be much faster, but also outputs bigger js files. Production is slower, but creates MUCH smaller JS files (4x-20x).
embark run
uses development
mode by default, while embark build
uses production
you can specify the mode by using the parameter -—pipeline [mode]
.
Embark has now a full fledged REPL (Read Evaluate Print Loop) with embark console
. If embark run
is already running then embark console will simply connect to the same instance, otherwise it will first compile & deploy the contracts and build your dapp then make the REPL available.
The dashboard and console repo support the await
keyword.
Embark now supports EIP 1102, which has to do with opt-in web3 access, rather than automatic injection (with all the privacy concerns that comes with). DApps generated with Embark should be fully compatible with both existing and future versions of Status, Metamask and other DApp browsers.
We achieve this by gracefully detecting a lack of connection to any given DApp. The callback of EmbarkJS.onReady
will now have an err
variable. If defined, the developer can assume that no connection could be made (i.e the user is not in an Ethereum-enabled browser) and can react accordingly e.g.:
Note: Existing dapp projects should put "$WEB3"
last in the priority list of the dappConnection
field when in the development
environment otherwise EmbarkJS will wait for the connection before moving on and connecting to your node. Ignore this if you use Metamask or Mist in development. New DApps generated by Embark 3.2 will have this change already
Embark now supports the latest Vyper compiler v0.1.0-beta.2.
Compilation errors are also better displayed, because better errors and safer, more expressive languages are something we all need real bad!
We are proud to present swarm-api a Javascript Library fully compatible with the latest swarm release! This library will come by default with Embark but is also available as a standalone.
This graceful error detection comes along with a whole bunch of new contract configuration options that give you more granular control over what you're doing and when it happens:
deployIf - Can be used to determine whether a contract should be configured or not depending on a response from another contract.
accounts - The account index can be passed as a parameter to a contract, so if you want the first account to be passed as a param:
Password protected files - Can be used for deployment:
Embark will now do contract deployment in parallel which massively speeds up the deployment.
As always embark will recognize if contracts are inter-dependent and make sure they are deployed in the right order.
The exact solidity compiler options can now be specified in embark.json in the “options” field:
The custom genesis block feature is back! For development or private networks you can again specify a custom genesis file. To enable this feature will need to set mineWhenNeeded: true
and isDev: false
. The blockchain started by embark with embark run
or embark blockchain
will then run a normal PoW miner but will mine only to establish a certain minimum balance & new transactions come in.
Your tests will now display the gas costs for each run as well the total gas cost per test suite. This functionality will even work with a custom node...
You can also pass the --gasDetails
to display the gas cost of each contract deployed individually.
Embark now supports code coverage for Solidity smart contracts.
embark test --coverage
will run the tests and output the coverage to the coverage/
directory.
Currently, Istanbul is supported, support for other formats will be coming soon (Coveralls, codecov).
The test functionality will now detect if an embark instance is re-running and re-use the solc compiler, this results in MUCH faster tests.
It’s also possible to specify a node to connect to, if embark
is specified then it will use the node already started by embark as well resulting in even faster tests.
That is:
embark test —node embark
Will connect to an Embark instance and use whatever Ethereum node that Embark instance is connected to for the tests. In some cases this results in a speedup of 10x running tests.
Alternatively, you can specify a particular node to connect to directly:
embark test --node="ws://localhost:8556"
In case all of this isn't enough for those really crazy test-driven developers out there, contract deployment also includes gas used, price and estimated cost:
In case all the new templates and ENS support wasn't enough for you, there's also an official docker image for Embark now available here:
https://github.com/embark-framework/embark-docker