Manually set networkId

By default kredits-contracts gets the networkId from the web3 object.
This causes some random JSON RPC errors when using MetaMask:
https://github.com/MetaMask/metamask-plugin/issues/1538

This set the default networkId to 17 which is our custom private
network. For development purposes the networkId can also be set
dynamically through the config:networkId local storage entry.
This commit is contained in:
2017-06-04 19:18:51 +02:00
parent 32e1bbd617
commit f8b75cca61
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -52,6 +52,9 @@ export default Service.extend({
let contract = null;
if (isPresent(config.contractMetadata)) {
if (localStorage.getItem('config:networkId')) {
config.contractMetadata['networkId'] = localStorage.getItem('config:networkId');
}
contract = kreditsContracts(this.get('web3'), config.contractMetadata)['Kredits'];
} else {
contract = kreditsContracts(this.get('web3'))['Kredits'];