Skip to content

Commit e4566f9

Browse files
committed
add more registers but generation one fails in run
1 parent 61be2c7 commit e4566f9

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

lib/contracts/code_generator.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ const Templates = {
1919
class CodeGenerator {
2020
constructor(options) {
2121
this.blockchainConfig = options.blockchainConfig || {};
22+
this.rpcHost = this.blockchainConfig.rpcHost || '';
23+
this.rpcPort = this.blockchainConfig.rpcPort || '';
2224
this.contractsConfig = options.contractsConfig || {};
2325
this.storageConfig = options.storageConfig || {};
2426
this.communicationConfig = options.communicationConfig || {};

test_apps/test_app/extensions/embark-service/index.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,33 @@ module.exports = function (embark) {
2323
embark.addFileToPipeline('./fileInPipeline.js');
2424
embark.addFileToPipeline('./fileInPipeline.js', 'js/fileInPipeline.js');
2525

26-
embark.registerBeforeDeploy(function(options, callback) {
26+
embark.registerBeforeDeploy(function (options, callback) {
2727
// Just calling register to prove it works. We don't actually want to change the contracts
2828
callback({contractCode: options.contract.code});
2929
});
30+
31+
embark.registerClientWeb3Provider(function(options) {
32+
return "web3 = new Web3(new Web3.providers.HttpProvider('http://" + options.rpcHost + ":" + options.rpcPort + "'));";
33+
});
34+
35+
/*embark.registerContractsGeneration(function (options) {
36+
const contractGenerations = [];
37+
Object.keys(options.contracts).map(className => {
38+
const contract = options.contracts[className];
39+
const abi = JSON.stringify(contract.abiDefinition);
40+
41+
contractGenerations.push(`${className} = new this.web3.eth.contract('${abi}').at('${contract.deployedAddress}')`);
42+
});
43+
return contractGenerations.join('\n');
44+
// return '';
45+
});*/
46+
47+
embark.registerConsoleCommand((cmd) => {
48+
if (cmd === "hello") {
49+
return "hello there!";
50+
}
51+
// continue to embark or next plugin;
52+
return false;
53+
});
54+
3055
};

0 commit comments

Comments
 (0)