Merge pull request #491 from embark-framework/alias_address
alias address
This commit is contained in:
commit
60e4f9f07d
|
@ -29,6 +29,7 @@ EmbarkJS.Contract = function(options) {
|
||||||
ContractClass.setProvider(this.web3.currentProvider);
|
ContractClass.setProvider(this.web3.currentProvider);
|
||||||
ContractClass.options.data = this.code;
|
ContractClass.options.data = this.code;
|
||||||
ContractClass.abi = ContractClass.options.abi;
|
ContractClass.abi = ContractClass.options.abi;
|
||||||
|
ContractClass.address = this.address;
|
||||||
return ContractClass;
|
return ContractClass;
|
||||||
} else {
|
} else {
|
||||||
ContractClass = this.web3.eth.contract(this.abi);
|
ContractClass = this.web3.eth.contract(this.abi);
|
||||||
|
|
|
@ -148,6 +148,7 @@ class Test {
|
||||||
}
|
}
|
||||||
Object.assign(self.contracts[contractName], new self.web3.eth.Contract(contract.abiDefinition, contract.deployedAddress,
|
Object.assign(self.contracts[contractName], new self.web3.eth.Contract(contract.abiDefinition, contract.deployedAddress,
|
||||||
{from: self.web3.eth.defaultAccount, gas: 6000000}));
|
{from: self.web3.eth.defaultAccount, gas: 6000000}));
|
||||||
|
self.contracts[contractName].address = contract.deployedAddress;
|
||||||
eachCb();
|
eachCb();
|
||||||
}, next);
|
}, next);
|
||||||
}
|
}
|
||||||
|
@ -188,6 +189,7 @@ class Test {
|
||||||
}
|
}
|
||||||
this.contracts[contractName] = new this.web3.eth.Contract(contract.abiDefinition, contract.address,
|
this.contracts[contractName] = new this.web3.eth.Contract(contract.abiDefinition, contract.address,
|
||||||
{from: this.web3.eth.defaultAccount, gas: 6000000});
|
{from: this.web3.eth.defaultAccount, gas: 6000000});
|
||||||
|
this.contracts[contractName].address = contract.address;
|
||||||
return this.contracts[contractName];
|
return this.contracts[contractName];
|
||||||
}
|
}
|
||||||
throw new Error(__('Unknown module %s', module));
|
throw new Error(__('Unknown module %s', module));
|
||||||
|
|
|
@ -31,4 +31,8 @@ contract("SimpleStorage", function () {
|
||||||
assert.strictEqual(result, web3.eth.defaultAccount);
|
assert.strictEqual(result, web3.eth.defaultAccount);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should alias contract address", async function () {
|
||||||
|
assert.strictEqual(SimpleStorage.options.address, SimpleStorage.address);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue