If the user does not have metamask or similar (no web3 provider is availale) we will load data from the infura node. No signer is available for the infura node but the ethers provider would throw an error if we try to access it - so this moves the decision of choosing the provider to the ethProvider function.
kredits-web
This README outlines the details of collaborating on this Ember application. A short introduction of this app could easily go here.
Prerequisites
You will need the following things properly installed on your computer.
- Git
- Node.js (with npm)
- Ember CLI
- Google Chrome
Installation
git clone git@github.com:67P/kredits-web.gitthis repositorycd kredits-webnpm install
Running / Development
ember serve- Visit your app at http://localhost:4200.
- Visit your tests at http://localhost:4200/tests.
See working with locally deployed contracts for details on how to develop with locally deployed contracts.
Code Generators
Make use of the many generators for code, try ember help generate for more details
Running Tests
ember testember test --server
Linting
npm run lint:jsnpm run lint:js -- --fix
Building
ember build(development)ember build --environment production(production)
Deploying
(You need collaborator permissions on the 5apps Deploy project.)
npm run deploy
Working with locally deployed contracts
The smart contracts and their JavaScript wrapper library are developed in the truffle-kredits repo/package.
You can run kredits-web on your machine, against a local, simulated Ethereum
network, provided e.g. by ganache or
ganache-cli.
truffle-kredits holds all the tools to start and set up such a simulated network, as well as to deploy smart contracts to it.
These are the basic steps to get up and running:
1. IPFS
Run a local IPFS deamon in offline mode.
- Make sure CORS headers are configured. See IPFS for more info.
ipfs daemon --offline
2. truffle-kredits
Get your local Ethereum development node running.
- Clone truffle-kredits
npm installnpm run ganache- which is basically:ganache-cli -p 7545 -i 100(we use the non-default port for local networks and a fixed network id)npm run bootstrap- bootstrap runs fresh migrations, adds some seed data and writes the address/abi information to JSON that will be used by kredits-webnpm link- make thetruffle-kreditsmodule linkable askredits-contractson your machine
3. kredits-web
With IPFS and Ethereum/ganache running, you can now start this Ember app.
npm link kredits-contracts- link the localtruffle-kreditspackage (it will becomekredits-contractssoon)npm start
IPFS
Install IPFS with your favorite package manager and run
ipfs init (on initial installation)
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["localhost:4200"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'