add aliases to embarkjs

This commit is contained in:
Iuri Matias 2017-04-02 14:12:12 -04:00
parent 9ce25d7651
commit d800c1cee0
3 changed files with 569 additions and 547 deletions

File diff suppressed because it is too large Load Diff

View File

@ -144,6 +144,29 @@ EmbarkJS.Contract.prototype.deploy = function(args, _options) {
return promise;
};
EmbarkJS.Contract.prototype.new = EmbarkJS.Contract.prototype.deploy;
EmbarkJS.Contract.prototype.at = function(address) {
return new EmbarkJS.Contract({ abi: this.abi, code: this.code, address: address });
};
EmbarkJS.Contract.prototype.send = function(value, unit, _options) {
var options, wei;
if (typeof unit === 'object') {
options = unit;
wei = value;
} else {
options = _options || {};
wei = this.web3.toWei(value, unit);
}
options.to = this.address;
options.value = wei;
console.log(options);
this.web3.eth.sendTransaction(options);
};
//=========================================================
// Embark Storage
//=========================================================

View File

@ -2,6 +2,8 @@ pragma solidity ^0.4.7;
contract SimpleStorage {
uint public storedData;
function() payable { }
function SimpleStorage(uint initialValue) {
storedData = initialValue;
}