get contract
This commit is contained in:
parent
fab0df5c8b
commit
56e59d814b
|
@ -42,5 +42,9 @@ ChainManager.prototype.addContract = function(contractName, code, address) {
|
|||
}
|
||||
}
|
||||
|
||||
ChainManager.prototype.getContract = function(code) {
|
||||
return this.currentChain.contracts[sha3_256(code)];
|
||||
}
|
||||
|
||||
module.exports = ChainManager;
|
||||
|
||||
|
|
|
@ -30,4 +30,15 @@ describe('embark.chain_manager', function() {
|
|||
|
||||
});
|
||||
|
||||
describe('#getContract', function() {
|
||||
|
||||
it('should a contract in the chain', function() {
|
||||
var contract = chainManager.getContract("123456");
|
||||
|
||||
assert.equal(contract.name, "Foo");
|
||||
assert.equal(contract.address, "0x123");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue