File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
test_apps/test_app/extensions/embark-service Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ const Templates = {
1919class 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 || { } ;
Original file line number Diff line number Diff 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} ;
You can’t perform that action at this time.
0 commit comments