mirror of https://github.com/embarklabs/embark.git
add more registers but generation one fails in run
This commit is contained in:
parent
61be2c7bd7
commit
e4566f9f81
|
@ -19,6 +19,8 @@ const Templates = {
|
|||
class CodeGenerator {
|
||||
constructor(options) {
|
||||
this.blockchainConfig = options.blockchainConfig || {};
|
||||
this.rpcHost = this.blockchainConfig.rpcHost || '';
|
||||
this.rpcPort = this.blockchainConfig.rpcPort || '';
|
||||
this.contractsConfig = options.contractsConfig || {};
|
||||
this.storageConfig = options.storageConfig || {};
|
||||
this.communicationConfig = options.communicationConfig || {};
|
||||
|
|
|
@ -23,8 +23,33 @@ module.exports = function (embark) {
|
|||
embark.addFileToPipeline('./fileInPipeline.js');
|
||||
embark.addFileToPipeline('./fileInPipeline.js', 'js/fileInPipeline.js');
|
||||
|
||||
embark.registerBeforeDeploy(function(options, callback) {
|
||||
embark.registerBeforeDeploy(function (options, callback) {
|
||||
// Just calling register to prove it works. We don't actually want to change the contracts
|
||||
callback({contractCode: options.contract.code});
|
||||
});
|
||||
|
||||
embark.registerClientWeb3Provider(function(options) {
|
||||
return "web3 = new Web3(new Web3.providers.HttpProvider('http://" + options.rpcHost + ":" + options.rpcPort + "'));";
|
||||
});
|
||||
|
||||
/*embark.registerContractsGeneration(function (options) {
|
||||
const contractGenerations = [];
|
||||
Object.keys(options.contracts).map(className => {
|
||||
const contract = options.contracts[className];
|
||||
const abi = JSON.stringify(contract.abiDefinition);
|
||||
|
||||
contractGenerations.push(`${className} = new this.web3.eth.contract('${abi}').at('${contract.deployedAddress}')`);
|
||||
});
|
||||
return contractGenerations.join('\n');
|
||||
// return '';
|
||||
});*/
|
||||
|
||||
embark.registerConsoleCommand((cmd) => {
|
||||
if (cmd === "hello") {
|
||||
return "hello there!";
|
||||
}
|
||||
// continue to embark or next plugin;
|
||||
return false;
|
||||
});
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue