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:
@@ -52,6 +52,9 @@ export default Service.extend({
|
|||||||
let contract = null;
|
let contract = null;
|
||||||
|
|
||||||
if (isPresent(config.contractMetadata)) {
|
if (isPresent(config.contractMetadata)) {
|
||||||
|
if (localStorage.getItem('config:networkId')) {
|
||||||
|
config.contractMetadata['networkId'] = localStorage.getItem('config:networkId');
|
||||||
|
}
|
||||||
contract = kreditsContracts(this.get('web3'), config.contractMetadata)['Kredits'];
|
contract = kreditsContracts(this.get('web3'), config.contractMetadata)['Kredits'];
|
||||||
} else {
|
} else {
|
||||||
contract = kreditsContracts(this.get('web3'))['Kredits'];
|
contract = kreditsContracts(this.get('web3'))['Kredits'];
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ module.exports = function(environment) {
|
|||||||
if (process.env.WEB3_PROVIDER_URL) {
|
if (process.env.WEB3_PROVIDER_URL) {
|
||||||
ENV.web3ProviderUrl = process.env.WEB3_PROVIDER_URL;
|
ENV.web3ProviderUrl = process.env.WEB3_PROVIDER_URL;
|
||||||
}
|
}
|
||||||
|
ENV.contractMetadata['networkId'] = "17";
|
||||||
|
|
||||||
if (environment === 'development') {
|
if (environment === 'development') {
|
||||||
// ENV.APP.LOG_RESOLVER = true;
|
// ENV.APP.LOG_RESOLVER = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user