mirror of https://github.com/embarklabs/embark.git
add missing enable options to boilerplate configs; add communication initializer
This commit is contained in:
parent
a9e4435b77
commit
d1701c4031
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"development": {
|
"development": {
|
||||||
|
"enabled": true,
|
||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"genesisBlock": "config/development/genesis.json",
|
"genesisBlock": "config/development/genesis.json",
|
||||||
"datadir": ".embark/development/datadir",
|
"datadir": ".embark/development/datadir",
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"testnet": {
|
"testnet": {
|
||||||
|
"enabled": true,
|
||||||
"networkType": "testnet",
|
"networkType": "testnet",
|
||||||
"light": true,
|
"light": true,
|
||||||
"rpcHost": "localhost",
|
"rpcHost": "localhost",
|
||||||
|
@ -24,6 +26,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"livenet": {
|
"livenet": {
|
||||||
|
"enabled": true,
|
||||||
"networkType": "livenet",
|
"networkType": "livenet",
|
||||||
"light": true,
|
"light": true,
|
||||||
"rpcHost": "localhost",
|
"rpcHost": "localhost",
|
||||||
|
@ -34,6 +37,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"privatenet": {
|
"privatenet": {
|
||||||
|
"enabled": true,
|
||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"rpcHost": "localhost",
|
"rpcHost": "localhost",
|
||||||
"rpcPort": 8545,
|
"rpcPort": 8545,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"default": {
|
"default": {
|
||||||
|
"enabled": true,
|
||||||
"provider": "whisper"
|
"provider": "whisper"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"development": {
|
"development": {
|
||||||
|
"enabled": true,
|
||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"genesisBlock": "config/development/genesis.json",
|
"genesisBlock": "config/development/genesis.json",
|
||||||
"datadir": ".embark/development/datadir",
|
"datadir": ".embark/development/datadir",
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"testnet": {
|
"testnet": {
|
||||||
|
"enabled": true,
|
||||||
"networkType": "testnet",
|
"networkType": "testnet",
|
||||||
"light": true,
|
"light": true,
|
||||||
"rpcHost": "localhost",
|
"rpcHost": "localhost",
|
||||||
|
@ -24,6 +26,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"livenet": {
|
"livenet": {
|
||||||
|
"enabled": true,
|
||||||
"networkType": "livenet",
|
"networkType": "livenet",
|
||||||
"light": true,
|
"light": true,
|
||||||
"rpcHost": "localhost",
|
"rpcHost": "localhost",
|
||||||
|
@ -34,6 +37,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"privatenet": {
|
"privatenet": {
|
||||||
|
"enabled": true,
|
||||||
"networkType": "custom",
|
"networkType": "custom",
|
||||||
"rpcHost": "localhost",
|
"rpcHost": "localhost",
|
||||||
"rpcPort": 8545,
|
"rpcPort": 8545,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"default": {
|
"default": {
|
||||||
|
"enabled": true,
|
||||||
"provider": "whisper"
|
"provider": "whisper"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ ABIGenerator.prototype.generateContracts = function(useEmbarkJS) {
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
ABIGenerator.prototype.generateStorageInitialiation = function(useEmbarkJS) {
|
ABIGenerator.prototype.generateStorageInitialization = function(useEmbarkJS) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var result = "\n";
|
var result = "\n";
|
||||||
|
|
||||||
|
@ -79,13 +79,28 @@ ABIGenerator.prototype.generateStorageInitialiation = function(useEmbarkJS) {
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ABIGenerator.prototype.generateCommunicationInitialization = function(useEmbarkJS) {
|
||||||
|
var self = this;
|
||||||
|
var result = "\n";
|
||||||
|
|
||||||
|
if (!useEmbarkJS || self.communicationConfig === {}) return;
|
||||||
|
|
||||||
|
if (self.communicationConfig.provider === 'ipfs' && self.communicationConfig.enabled === true) {
|
||||||
|
result += "\n" + "EmbarkJS.Storage.setProvider('" + self.communicationConfig.provider + "');";
|
||||||
|
} else if (self.communicationConfig.provider === 'orbit' && self.communicationConfig.enabled === true) {
|
||||||
|
result += "\n" + "EmbarkJS.Storage.setProvider('" + self.communicationConfig.provider + "', {server: '" + self.communicationConfig.host + "', port: '" + self.communicationConfig.port + "'});";
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
ABIGenerator.prototype.generateABI = function(options) {
|
ABIGenerator.prototype.generateABI = function(options) {
|
||||||
var result = "";
|
var result = "";
|
||||||
|
|
||||||
result += this.generateProvider();
|
result += this.generateProvider();
|
||||||
result += this.generateContracts(options.useEmbarkJS);
|
result += this.generateContracts(options.useEmbarkJS);
|
||||||
result += this.generateStorageInitialiation(options.useEmbarkJS);
|
result += this.generateStorageInitialization(options.useEmbarkJS);
|
||||||
|
result += this.generateCommunicationInitialization(options.useEmbarkJS);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue