mirror of https://github.com/embarklabs/embark.git
use request to get contract
This commit is contained in:
parent
7cebbec7b6
commit
c83064adf6
|
@ -20,6 +20,7 @@ class Deploy {
|
|||
// TODO: determining the arguments could also be in a module since it's not
|
||||
// part of ta 'normal' contract deployment
|
||||
determineArguments(suppliedArgs, contract, callback) {
|
||||
const self = this;
|
||||
let realArgs = [], contractName, referedContract;
|
||||
|
||||
let args = suppliedArgs;
|
||||
|
@ -41,10 +42,13 @@ class Deploy {
|
|||
|
||||
if (arg[0] === "$") {
|
||||
contractName = arg.substr(1);
|
||||
referedContract = this.contractsManager.getContract(contractName);
|
||||
self.events.request('contracts:contract', contractName, (referedContract) => {
|
||||
realArgs.push(referedContract.deployedAddress);
|
||||
nextEachCb();
|
||||
});
|
||||
} else if (Array.isArray(arg)) {
|
||||
let subRealArgs = [];
|
||||
// todo: convert to async each
|
||||
for (let sub_arg of arg) {
|
||||
if (sub_arg[0] === "$") {
|
||||
contractName = sub_arg.substr(1);
|
||||
|
@ -54,14 +58,15 @@ class Deploy {
|
|||
subRealArgs.push(sub_arg);
|
||||
}
|
||||
}
|
||||
// todo: put this in the final callback
|
||||
realArgs.push(subRealArgs);
|
||||
nextEachCb();
|
||||
} else {
|
||||
realArgs.push(arg);
|
||||
nextEachCb();
|
||||
}
|
||||
|
||||
|
||||
nextEachCb();
|
||||
|
||||
}, () => {
|
||||
callback(realArgs);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue