ember-web3
This add-on is simplifies integrating Web3 into your Ember.js web app. For more information on Web3 visit: https://github.com/ethereum/web3.js/
Installation
ember install ember-web3
Usage
Inject the service where needed.
web3: Emberinject
- Define web3 provider and call the
setup
method passing in the provider.
let provider = windowweb3currentProvider; let web3Instance = this;
Ex. of using localhost as provider
let provider = "http://localhost:8545" let web3Instance = this;
web3 Instance
Service injection gives access to object Web3
, and instantiates a web3Instance
object using the provider specified in the config.
To retrieve the web3 instance:
let webInstance = this;
Or simply create your own
let web3 = "http://localhost:8545";
Contract Instance
The service also allows you to simply retrieve a deployed contract instance of existing Solidity contract using the ABI and address. Requires the ABI array and address. Returns a promise.
let contractABI = 'ABI array';let contractAddres = '0x6e93b795ba20f376e205d00c205eaa8cc10db9f7' // Not real a contract addressweb3Instance;
The most recently retrieved contract will be set to contractInstance
on the service.
let contractInstance = this;
TODO
- Tests
- Dummy app
Running Tests
npm test
(Runsember try:each
to test your addon against multiple Ember versions)ember test
ember test --server
Building
ember build
For more information on using ember-cli, visit http://ember-cli.com/.