mirror of https://github.com/embarklabs/embark.git
refactor(@embark/site): remove embarkjs-connector-web3 instructions
Also include a note on the "How to upgrade to Embark 4" blog post from March 2019.
This commit is contained in:
parent
fc4faa8ba9
commit
7652e1d75c
|
@ -115,6 +115,8 @@ We know that these steps are a bit too much, so we are working on a new command
|
|||
|
||||
## New Web3 plugin
|
||||
|
||||
*(2019/06/27)* **NOTE**: *the following instructions are* ***not*** *applicable to Embark `4.1.x` and newer, but should still be followed for `4.0.x` or `<=4.1.0-beta.3`.*
|
||||
|
||||
Starting with Embark 4 beta.1, Embark no longer supplies the Dapp with `Web3.js` by default. Don't run. We did that so that we can now have the possibility of supporting more than just `Web3.js`, such as EthersJS, and more. You can even roll your own.
|
||||
|
||||
To continue using `Web3.js` inside the Embark 4 Dapp, execute the following command in the Embark console: `plugin install embarkjs-connector-web3`.
|
||||
|
|
|
@ -26,40 +26,6 @@ The following code imports EmbarkJS:
|
|||
import EmbarkJS from './embarkArtifacts/embarkjs';
|
||||
```
|
||||
|
||||
### Installing a blockchain connector
|
||||
|
||||
Before the Embark can connect to the blockchain, we need to install a blockchain connector plugin. This is required because Embark doesn't have a strong opinion about which connector library we should use. Some people like to use `web3.js`, others prefer libraries like `ethers.js`. Once we know which library to use, we'll have to install a dedicated connector plugin. The Embark project maintains a blockchain connector for the `web3.js` library called `embarkjs-connector-web3`.
|
||||
|
||||
There are a few different ways to install the plugin. We can either use `yarn` or `npm` like this:
|
||||
|
||||
```
|
||||
$ npm install --save embarkjs-connector-web3
|
||||
```
|
||||
|
||||
And
|
||||
|
||||
```
|
||||
$ yarn add embarkjs-connector-web3
|
||||
```
|
||||
|
||||
Another option is to use Embark's very own `plugin` command that can be run from its [Interactive Console](/docs/using_the_console.html):
|
||||
|
||||
```
|
||||
$ Embark (development) > plugin install embarkjs-connector-web3<ENTER>
|
||||
```
|
||||
|
||||
Once installed, all we have to do is adding the plugin to our project's [embark.json](/docs/configuration.html):
|
||||
|
||||
```
|
||||
...
|
||||
"plugins": {
|
||||
"embarkjs-connector-web3": {}
|
||||
}
|
||||
...
|
||||
```
|
||||
|
||||
This will tell Embark to load the plugin on startup and register all necessary providers needed to connect to a blockchain. For more information about installing and creating plugins and other custom blockchain connectors, head over to our [Plugins guide](/docs/installing_plugins.html).
|
||||
|
||||
## Waiting for EmbarkJS to be ready
|
||||
|
||||
EmbarkJS also includes a `onReady` function. This is very useful to ensure that your Dapp only starts interacting with contracts when the proper connection to web3 has been made and ready to use.
|
||||
|
|
|
@ -71,34 +71,6 @@ Remove the following import from your application:
|
|||
import web3 from 'Embark/web3';
|
||||
```
|
||||
|
||||
### Installing a blockchain connector
|
||||
|
||||
As discussed in our guide on [using EmbarkJS](/docs/javascript_usage.html#Installing-a-blockchain-connector), EmbarkJS no longer has an opinion about which library to use to connect to a blockchain. You can use any library of your choice, whether it's `web3` or `ethers.js` or anything else.
|
||||
|
||||
All you have to do is installing the library and a dedicated connector plugin. The Embark project already comes with a connector plugin for `web3` and can be installed using either yarn or npm, or Embark's very own `plugin install` command:
|
||||
|
||||
```
|
||||
$ npm install embarkjs-connector-web3
|
||||
```
|
||||
Or
|
||||
```
|
||||
$ yarn add embarkjs-connector-web3
|
||||
```
|
||||
Or
|
||||
```
|
||||
Embark (development) > plugin install embarkjs-web3-connector<ENTER>
|
||||
```
|
||||
|
||||
Once installed we need to tell Embark to load the plugin. This is done by adding it to the `embark.json` plugins section:
|
||||
|
||||
```
|
||||
...
|
||||
"plugins": {
|
||||
"embarkjs-connector-web3": {}
|
||||
}
|
||||
...
|
||||
```
|
||||
|
||||
### Updating blockchain configurations
|
||||
|
||||
Embark 4 adds some new blockchain account configurations. To try to keep things as simple as possible, these additions are really similar to the ones in the Smart Contract configuration. For more information, please read the [Accounts Blockchain configuration guide](/docs/blockchain_accounts_configuration.html) in our docs.
|
||||
|
|
Loading…
Reference in New Issue