mirror of https://github.com/embarklabs/embark.git
Merge branch 'next' into develop
This commit is contained in:
commit
f3a8e68c60
|
@ -12,7 +12,8 @@
|
|||
"rpcCorsDomain": "http://localhost:8000",
|
||||
"account": {
|
||||
"password": "config/development/password"
|
||||
}
|
||||
},
|
||||
"wsOrigins": "http://localhost:8000"
|
||||
},
|
||||
"testnet": {
|
||||
"enabled": true,
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
"default": {
|
||||
"enabled": true,
|
||||
"provider": "whisper",
|
||||
"available_providers": ["whisper", "orbit"]
|
||||
"available_providers": ["whisper", "orbit"],
|
||||
"connection": {
|
||||
"host": "localhost",
|
||||
"port": 8546,
|
||||
"type": "ws"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
{
|
||||
"default": {
|
||||
"versions": {
|
||||
"web3.js": "1.0.0-beta",
|
||||
"solc": "0.4.18"
|
||||
},
|
||||
"deployment": {
|
||||
"host": "localhost",
|
||||
"port": 8545,
|
||||
"type": "rpc"
|
||||
},
|
||||
"dappConnection": [
|
||||
"$WEB3",
|
||||
"http://localhost:8545"
|
||||
],
|
||||
"gas": "auto",
|
||||
"contracts": {
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"enabled": true,
|
||||
"provider": "ipfs",
|
||||
"host": "localhost",
|
||||
"port": 5001
|
||||
"port": 5001,
|
||||
"getUrl": "http://localhost:8080/ipfs/"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
pragma solidity ^0.4.7;
|
||||
pragma solidity ^0.4.18;
|
||||
contract SimpleStorage {
|
||||
uint public storedData;
|
||||
|
||||
function SimpleStorage(uint initialValue) {
|
||||
function SimpleStorage(uint initialValue) public {
|
||||
storedData = initialValue;
|
||||
}
|
||||
|
||||
function set(uint x) {
|
||||
function set(uint x) public {
|
||||
storedData = x;
|
||||
}
|
||||
|
||||
function get() constant returns (uint retVal) {
|
||||
function get() public view returns (uint retVal) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
"rpcCorsDomain": "http://localhost:8000",
|
||||
"account": {
|
||||
"password": "config/development/password"
|
||||
}
|
||||
},
|
||||
"wsOrigins": "http://localhost:8000"
|
||||
},
|
||||
"testnet": {
|
||||
"enabled": true,
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
"default": {
|
||||
"enabled": true,
|
||||
"provider": "whisper",
|
||||
"available_providers": ["whisper", "orbit"]
|
||||
"available_providers": ["whisper", "orbit"],
|
||||
"connection": {
|
||||
"host": "localhost",
|
||||
"port": 8546,
|
||||
"type": "ws"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
{
|
||||
"default": {
|
||||
"versions": {
|
||||
"web3.js": "1.0.0-beta",
|
||||
"solc": "0.4.18"
|
||||
},
|
||||
"deployment": {
|
||||
"host": "localhost",
|
||||
"port": 8545,
|
||||
"type": "rpc"
|
||||
},
|
||||
"dappConnection": [
|
||||
"$WEB3",
|
||||
"http://localhost:8545"
|
||||
],
|
||||
"gas": "auto",
|
||||
"contracts": {
|
||||
"SimpleStorage": {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"enabled": true,
|
||||
"provider": "ipfs",
|
||||
"host": "localhost",
|
||||
"port": 5001
|
||||
"port": 5001,
|
||||
"getUrl": "http://localhost:8080/ipfs/"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,9 +58,9 @@ author = u'Iuri Matias'
|
|||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = u'2.5'
|
||||
version = u'2.6'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = u'2.5.2'
|
||||
release = u'2.6.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
@ -43,9 +43,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // identity function for calling harmony imports with the correct context
|
||||
/******/ __webpack_require__.i = function(value) { return value; };
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
|
@ -100,6 +97,7 @@ EmbarkJS.isNewWeb3 = function() {
|
|||
EmbarkJS.Contract = function(options) {
|
||||
var self = this;
|
||||
var i, abiElement;
|
||||
var ContractClass;
|
||||
|
||||
this.abi = options.abi;
|
||||
this.address = options.address;
|
||||
|
@ -110,14 +108,12 @@ EmbarkJS.Contract = function(options) {
|
|||
// TODO:
|
||||
// add default **from** address
|
||||
// add gasPrice
|
||||
var ContractClass = new this.web3.eth.Contract(this.abi, this.address);
|
||||
ContractClass = new this.web3.eth.Contract(this.abi, this.address);
|
||||
ContractClass.setProvider(this.web3.currentProvider);
|
||||
|
||||
return ContractClass;
|
||||
} else {
|
||||
|
||||
|
||||
var ContractClass = this.web3.eth.contract(this.abi);
|
||||
ContractClass = this.web3.eth.contract(this.abi);
|
||||
|
||||
this.eventList = [];
|
||||
|
||||
|
@ -444,7 +440,7 @@ EmbarkJS.Messages.setProvider = function(provider, options) {
|
|||
var self = this;
|
||||
var ipfs;
|
||||
if (provider === 'whisper') {
|
||||
this.providerName = 'whisper'
|
||||
this.providerName = 'whisper';
|
||||
this.currentMessages = EmbarkJS.Messages.Whisper;
|
||||
let provider;
|
||||
if (options === undefined) {
|
||||
|
@ -473,7 +469,7 @@ EmbarkJS.Messages.setProvider = function(provider, options) {
|
|||
self.currentMessages.whisperVersion = self.currentMessages.web3.version.whisper;
|
||||
});
|
||||
} else if (provider === 'orbit') {
|
||||
this.providerName = 'orbit'
|
||||
this.providerName = 'orbit';
|
||||
this.currentMessages = EmbarkJS.Messages.Orbit;
|
||||
if (options === undefined) {
|
||||
ipfs = HaadIpfsApi('localhost', '5001');
|
||||
|
@ -502,11 +498,12 @@ EmbarkJS.Messages.listenTo = function(options) {
|
|||
EmbarkJS.Messages.Whisper = {};
|
||||
|
||||
EmbarkJS.Messages.Whisper.sendMessage = function(options) {
|
||||
var topics, data, ttl, priority, payload;
|
||||
if (EmbarkJS.Messages.isNewWeb3()) {
|
||||
var topics = options.topic || options.topics;
|
||||
var data = options.data || options.payload;
|
||||
var ttl = options.ttl || 100;
|
||||
var priority = options.priority || 1000;
|
||||
topics = options.topic || options.topics;
|
||||
data = options.data || options.payload;
|
||||
ttl = options.ttl || 100;
|
||||
priority = options.priority || 1000;
|
||||
var powTime = options.powTime || 3;
|
||||
var powTarget = options.powTarget || 0.5;
|
||||
|
||||
|
@ -520,7 +517,7 @@ EmbarkJS.Messages.Whisper.sendMessage = function(options) {
|
|||
|
||||
topics = this.web3.utils.toHex(topics).slice(0, 10);
|
||||
|
||||
var payload = JSON.stringify(data);
|
||||
payload = JSON.stringify(data);
|
||||
|
||||
let message = {
|
||||
symKeyID: this.symKeyID, // encrypts using the sym key ID
|
||||
|
@ -534,11 +531,11 @@ EmbarkJS.Messages.Whisper.sendMessage = function(options) {
|
|||
|
||||
this.web3.shh.post(message, function() { });
|
||||
} else {
|
||||
var topics = options.topic || options.topics;
|
||||
var data = options.data || options.payload;
|
||||
topics = options.topic || options.topics;
|
||||
data = options.data || options.payload;
|
||||
ttl = options.ttl || 100;
|
||||
priority = options.priority || 1000;
|
||||
var identity = options.identity || this.identity || web3.shh.newIdentity();
|
||||
var ttl = options.ttl || 100;
|
||||
var priority = options.priority || 1000;
|
||||
var _topics;
|
||||
|
||||
if (topics === undefined) {
|
||||
|
@ -556,7 +553,7 @@ EmbarkJS.Messages.Whisper.sendMessage = function(options) {
|
|||
}
|
||||
topics = _topics;
|
||||
|
||||
var payload = JSON.stringify(data);
|
||||
payload = JSON.stringify(data);
|
||||
|
||||
var message;
|
||||
message = {
|
||||
|
@ -567,13 +564,14 @@ EmbarkJS.Messages.Whisper.sendMessage = function(options) {
|
|||
priority: priority
|
||||
};
|
||||
|
||||
return EmbarkJS.Messages.currentMessages.web3.shh.post(message, function() { console.log("message sent") });
|
||||
return EmbarkJS.Messages.currentMessages.web3.shh.post(message, function() { });
|
||||
}
|
||||
};
|
||||
|
||||
EmbarkJS.Messages.Whisper.listenTo = function(options) {
|
||||
var topics, _topics, messageEvents;
|
||||
if (EmbarkJS.Messages.isNewWeb3()) {
|
||||
var messageEvents = function() {
|
||||
messageEvents = function() {
|
||||
this.cb = function() {};
|
||||
};
|
||||
|
||||
|
@ -589,8 +587,8 @@ EmbarkJS.Messages.Whisper.listenTo = function(options) {
|
|||
this.filter.stopWatching();
|
||||
};
|
||||
|
||||
var topics = options.topic || options.topics;
|
||||
var _topics = [];
|
||||
topics = options.topic || options.topics;
|
||||
_topics = [];
|
||||
|
||||
let promise = new messageEvents();
|
||||
|
||||
|
@ -621,10 +619,10 @@ EmbarkJS.Messages.Whisper.listenTo = function(options) {
|
|||
|
||||
return promise;
|
||||
} else {
|
||||
var topics = options.topic || options.topics;
|
||||
var _topics = [];
|
||||
topics = options.topic || options.topics;
|
||||
_topics = [];
|
||||
|
||||
var messageEvents = function() {
|
||||
messageEvents = function() {
|
||||
this.cb = function() {};
|
||||
};
|
||||
|
||||
|
@ -673,7 +671,7 @@ EmbarkJS.Messages.Whisper.listenTo = function(options) {
|
|||
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
EmbarkJS.Messages.Orbit = {};
|
||||
|
||||
|
|
|
@ -162,7 +162,9 @@ class GethCommands {
|
|||
function whisper(callback) {
|
||||
if (config.whisper) {
|
||||
rpc_api.push('shh');
|
||||
ws_api.push('shh');
|
||||
if (ws_api.indexOf('shh') === -1) {
|
||||
ws_api.push('shh');
|
||||
}
|
||||
return callback(null, "--shh ");
|
||||
}
|
||||
callback("");
|
||||
|
|
|
@ -28,28 +28,28 @@ class CodeGenerator {
|
|||
let self = this;
|
||||
|
||||
// deprecated events; to remove in embark 2.7.0
|
||||
this.events.setCommandHandler('abi-vanila', function(cb) {
|
||||
this.events.setCommandHandlerOnce('abi-vanila', function(cb) {
|
||||
let vanillaABI = self.generateABI({useEmbarkJS: false});
|
||||
let contractsJSON = self.generateContractsJSON();
|
||||
|
||||
cb(vanillaABI, contractsJSON);
|
||||
});
|
||||
|
||||
this.events.setCommandHandler('abi', function(cb) {
|
||||
this.events.setCommandHandlerOnce('abi', function(cb) {
|
||||
let embarkJSABI = self.generateABI({useEmbarkJS: true});
|
||||
let contractsJSON = self.generateContractsJSON();
|
||||
|
||||
cb(embarkJSABI, contractsJSON);
|
||||
});
|
||||
|
||||
this.events.setCommandHandler('abi-contracts-vanila', function(cb) {
|
||||
this.events.setCommandHandlerOnce('abi-contracts-vanila', function(cb) {
|
||||
let vanillaContractsABI = self.generateContracts(false, true, false);
|
||||
let contractsJSON = self.generateContractsJSON();
|
||||
|
||||
cb(vanillaContractsABI, contractsJSON);
|
||||
});
|
||||
|
||||
this.events.setCommandHandler('abi-vanila-deployment', function(cb) {
|
||||
this.events.setCommandHandlerOnce('abi-vanila-deployment', function(cb) {
|
||||
let vanillaABI = self.generateABI({useEmbarkJS: false, deployment: true});
|
||||
let contractsJSON = self.generateContractsJSON();
|
||||
|
||||
|
@ -57,35 +57,34 @@ class CodeGenerator {
|
|||
});
|
||||
|
||||
// new events
|
||||
this.events.setCommandHandler('code-vanila', function(cb) {
|
||||
this.events.setCommandHandlerOnce('code-vanila', function(cb) {
|
||||
let vanillaABI = self.generateABI({useEmbarkJS: false});
|
||||
let contractsJSON = self.generateContractsJSON();
|
||||
|
||||
cb(vanillaABI, contractsJSON);
|
||||
});
|
||||
|
||||
this.events.setCommandHandler('code', function(cb) {
|
||||
this.events.setCommandHandlerOnce('code', function(cb) {
|
||||
let embarkJSABI = self.generateABI({useEmbarkJS: true});
|
||||
let contractsJSON = self.generateContractsJSON();
|
||||
|
||||
cb(embarkJSABI, contractsJSON);
|
||||
});
|
||||
|
||||
this.events.setCommandHandler('code-contracts-vanila', function(cb) {
|
||||
this.events.setCommandHandlerOnce('code-contracts-vanila', function(cb) {
|
||||
let vanillaContractsABI = self.generateContracts(false, true, false);
|
||||
let contractsJSON = self.generateContractsJSON();
|
||||
|
||||
cb(vanillaContractsABI, contractsJSON);
|
||||
});
|
||||
|
||||
this.events.setCommandHandler('code-vanila-deployment', function(cb) {
|
||||
this.events.setCommandHandlerOnce('code-vanila-deployment', function(cb) {
|
||||
let vanillaABI = self.generateABI({useEmbarkJS: false, deployment: true});
|
||||
let contractsJSON = self.generateContractsJSON();
|
||||
|
||||
cb(vanillaABI, contractsJSON);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
generateProvider(isDeployment) {
|
||||
|
@ -222,8 +221,6 @@ class CodeGenerator {
|
|||
result += Templates.exec_when_env_loaded({block: block});
|
||||
}
|
||||
|
||||
console.log(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ Config.prototype.loadContractsConfigFile = function() {
|
|||
var configObject = {
|
||||
"versions": {
|
||||
"web3.js": "0.19.1",
|
||||
"solc": "0.4.17"
|
||||
"solc": "0.4.18"
|
||||
},
|
||||
"deployment": {
|
||||
"host": "localhost",
|
||||
|
|
|
@ -42,4 +42,11 @@ EventEmitter.prototype.setCommandHandler = function(requestName, cb) {
|
|||
});
|
||||
};
|
||||
|
||||
EventEmitter.prototype.setCommandHandlerOnce = function(requestName, cb) {
|
||||
log("setting command handler for: ", requestName);
|
||||
return this.once('request:' + requestName, function(_cb) {
|
||||
cb.call(this, _cb);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = EventEmitter;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"version": "2.6.0",
|
||||
"description": "Embark is a framework that allows you to easily develop and deploy DApps",
|
||||
"scripts": {
|
||||
"test": "grunt jshint && mocha test/ --no-timeouts"
|
||||
"test": "grunt jshint && mocha test/ --no-timeouts && cd test_app/ && npm install && ../bin/embark test"
|
||||
},
|
||||
"bin": {
|
||||
"embark": "./bin/embark"
|
||||
|
@ -33,7 +33,7 @@
|
|||
"promptly": "^2.1.0",
|
||||
"serve-static": "^1.11.1",
|
||||
"shelljs": "^0.5.0",
|
||||
"solc": "0.4.17",
|
||||
"solc": "0.4.18",
|
||||
"tar": "^3.1.5",
|
||||
"toposort": "^1.0.0",
|
||||
"underscore": "^1.8.3",
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
pragma solidity ^0.4.11;
|
||||
pragma solidity ^0.4.18;
|
||||
contract AnotherStorage {
|
||||
address public simpleStorageAddress;
|
||||
address simpleStorageAddress2;
|
||||
|
||||
function AnotherStorage(address addr) {
|
||||
function AnotherStorage(address addr) public {
|
||||
simpleStorageAddress = addr;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.4.11;
|
||||
pragma solidity ^0.4.18;
|
||||
|
||||
/**
|
||||
* @title Ownable
|
||||
|
@ -13,7 +13,7 @@ contract Ownable {
|
|||
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
|
||||
* account.
|
||||
*/
|
||||
function Ownable() {
|
||||
function Ownable() public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ contract Ownable {
|
|||
*/
|
||||
modifier onlyOwner() {
|
||||
if (msg.sender != owner) {
|
||||
throw;
|
||||
revert();
|
||||
}
|
||||
_;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ contract Ownable {
|
|||
* @dev Allows the current owner to transfer control of the contract to a newOwner.
|
||||
* @param newOwner The address to transfer ownership to.
|
||||
*/
|
||||
function transferOwnership(address newOwner) onlyOwner {
|
||||
function transferOwnership(address newOwner) public onlyOwner {
|
||||
if (newOwner != address(0)) {
|
||||
owner = newOwner;
|
||||
}
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
pragma solidity ^0.4.7;
|
||||
pragma solidity ^0.4.18;
|
||||
|
||||
import "ownable.sol";
|
||||
|
||||
contract SimpleStorage is Ownable {
|
||||
uint public storedData;
|
||||
|
||||
function() payable { }
|
||||
function() public payable { }
|
||||
|
||||
function SimpleStorage(uint initialValue) {
|
||||
function SimpleStorage(uint initialValue) public {
|
||||
storedData = initialValue;
|
||||
}
|
||||
|
||||
function set(uint x) {
|
||||
function set(uint x) public {
|
||||
storedData = x;
|
||||
}
|
||||
|
||||
function set2(uint x, uint unusedGiveWarning) onlyOwner {
|
||||
function set2(uint x, uint unusedGiveWarning) public onlyOwner {
|
||||
storedData = x;
|
||||
}
|
||||
|
||||
function get() constant returns (uint retVal) {
|
||||
function get() public view returns (uint retVal) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
function getS() constant returns (string d) {
|
||||
function getS() public pure returns (string d) {
|
||||
return "hello";
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
pragma solidity ^0.4.11;
|
||||
pragma solidity ^0.4.18;
|
||||
|
||||
library ZAMyLib {
|
||||
|
||||
function add(uint _a, uint _b) returns (uint _c) {
|
||||
function add(uint _a, uint _b) public pure returns (uint _c) {
|
||||
return _a + _b;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ library ZAMyLib {
|
|||
|
||||
contract Test {
|
||||
|
||||
function testAdd() constant returns (uint _result) {
|
||||
function testAdd() public pure returns (uint _result) {
|
||||
return ZAMyLib.add(1, 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// https://github.com/nexusdev/erc20/blob/master/contracts/base.sol
|
||||
|
||||
pragma solidity ^0.4.2;
|
||||
pragma solidity ^0.4.18;
|
||||
contract Token {
|
||||
|
||||
event Transfer(address indexed from, address indexed to, uint value);
|
||||
|
@ -10,39 +10,39 @@ contract Token {
|
|||
mapping( address => mapping( address => uint ) ) _approvals;
|
||||
uint public _supply;
|
||||
//uint public _supply2;
|
||||
function Token( uint initial_balance ) {
|
||||
function Token( uint initial_balance ) public {
|
||||
_balances[msg.sender] = initial_balance;
|
||||
_supply = initial_balance;
|
||||
}
|
||||
function totalSupply() constant returns (uint supply) {
|
||||
function totalSupply() public constant returns (uint supply) {
|
||||
return _supply;
|
||||
}
|
||||
function balanceOf( address who ) constant returns (uint value) {
|
||||
function balanceOf( address who ) public constant returns (uint value) {
|
||||
return _balances[who];
|
||||
}
|
||||
function transfer( address to, uint value) returns (bool ok) {
|
||||
function transfer( address to, uint value) public returns (bool ok) {
|
||||
if( _balances[msg.sender] < value ) {
|
||||
throw;
|
||||
revert();
|
||||
}
|
||||
if( !safeToAdd(_balances[to], value) ) {
|
||||
throw;
|
||||
revert();
|
||||
}
|
||||
_balances[msg.sender] -= value;
|
||||
_balances[to] += value;
|
||||
Transfer( msg.sender, to, value );
|
||||
return true;
|
||||
}
|
||||
function transferFrom( address from, address to, uint value) returns (bool ok) {
|
||||
function transferFrom( address from, address to, uint value) public returns (bool ok) {
|
||||
// if you don't have enough balance, throw
|
||||
if( _balances[from] < value ) {
|
||||
throw;
|
||||
revert();
|
||||
}
|
||||
// if you don't have approval, throw
|
||||
if( _approvals[from][msg.sender] < value ) {
|
||||
throw;
|
||||
revert();
|
||||
}
|
||||
if( !safeToAdd(_balances[to], value) ) {
|
||||
throw;
|
||||
revert();
|
||||
}
|
||||
// transfer and return true
|
||||
_approvals[from][msg.sender] -= value;
|
||||
|
@ -51,16 +51,16 @@ contract Token {
|
|||
Transfer( from, to, value );
|
||||
return true;
|
||||
}
|
||||
function approve(address spender, uint value) returns (bool ok) {
|
||||
function approve(address spender, uint value) public returns (bool ok) {
|
||||
// TODO: should increase instead
|
||||
_approvals[msg.sender][spender] = value;
|
||||
Approval( msg.sender, spender, value );
|
||||
return true;
|
||||
}
|
||||
function allowance(address owner, address spender) constant returns (uint _allowance) {
|
||||
function allowance(address owner, address spender) public constant returns (uint _allowance) {
|
||||
return _approvals[owner][spender];
|
||||
}
|
||||
function safeToAdd(uint a, uint b) internal returns (bool) {
|
||||
function safeToAdd(uint a, uint b) internal pure returns (bool) {
|
||||
return (a + b >= a);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,53 +1,56 @@
|
|||
|
||||
$(document).ready(function() {
|
||||
|
||||
async.waterfall([
|
||||
function test1(callback) {
|
||||
AnotherStorage.simpleStorageAddress().then(function(simpleStorageAddress) {
|
||||
$("#tests").append("<br>test 1: " + (simpleStorageAddress === SimpleStorage.address));
|
||||
callback();
|
||||
});
|
||||
},
|
||||
function test2(callback) {
|
||||
SimpleStorage.storedData().then(function(result) {
|
||||
$("#tests").append("<br>test 2 (true first time): " + (result.toNumber() === 100));
|
||||
$("#tests").append("<br>test 2 (true after): " + (result.toNumber() === 150));
|
||||
callback();
|
||||
});
|
||||
},
|
||||
function test3(callback) {
|
||||
SimpleStorage.set(150).then(function() {
|
||||
SimpleStorage.get().then(function(result) {
|
||||
$("#tests").append("<br>test 3: " + (result.toNumber() === 150));
|
||||
document.getElementById("runTests").onclick = function() {
|
||||
async.waterfall([
|
||||
function test1(callback) {
|
||||
AnotherStorage.methods.simpleStorageAddress().call().then(function(simpleStorageAddress) {
|
||||
$("#tests").append("<br>test 1: " + (simpleStorageAddress === SimpleStorage._address));
|
||||
callback();
|
||||
});
|
||||
});
|
||||
},
|
||||
function test4(callback) {
|
||||
$("#tests").append("<br>test 4: " + (Token.address === "undefined"));
|
||||
$("#tests").append("<br>test 4: " + (MyToken.address !== undefined));
|
||||
$("#tests").append("<br>test 4: " + (MyToken2.address !== undefined));
|
||||
callback();
|
||||
},
|
||||
function test5(callback) {
|
||||
MyToken._supply().then(function(result) {
|
||||
$("#tests").append("<br>test 5: " + (result.toNumber() === 1000));
|
||||
},
|
||||
function test2(callback) {
|
||||
SimpleStorage.methods.storedData().call().then(function(result) {
|
||||
$("#tests").append("<br>test 2 (true first time): " + (result === "100"));
|
||||
$("#tests").append("<br>test 2 (true after): " + (result === "150"));
|
||||
callback();
|
||||
});
|
||||
},
|
||||
function test3(callback) {
|
||||
SimpleStorage.methods.set(150).send({from: web3.eth.defaultAccount}).then(function() {
|
||||
SimpleStorage.methods.get().call().then(function(result) {
|
||||
$("#tests").append("<br>test 3: " + (result === "150"));
|
||||
callback();
|
||||
});
|
||||
});
|
||||
},
|
||||
function test4(callback) {
|
||||
$("#tests").append("<br>test 4: " + (Token._address === null));
|
||||
$("#tests").append("<br>test 4: " + (MyToken._address !== undefined));
|
||||
$("#tests").append("<br>test 4: " + (MyToken2._address !== undefined));
|
||||
callback();
|
||||
});
|
||||
},
|
||||
function test6(callback) {
|
||||
MyToken2._supply().then(function(result) {
|
||||
$("#tests").append("<br>test 6: " + (result.toNumber() === 2000));
|
||||
},
|
||||
function test5(callback) {
|
||||
MyToken.methods._supply().call().then(function(result) {
|
||||
$("#tests").append("<br>test 5: " + (result === "1000"));
|
||||
callback();
|
||||
});
|
||||
},
|
||||
function test6(callback) {
|
||||
MyToken2.methods._supply().call().then(function(result) {
|
||||
$("#tests").append("<br>test 6: " + (result === "2000"));
|
||||
callback();
|
||||
});
|
||||
},
|
||||
function test7(callback) {
|
||||
$("#tests").append("<br>test 7: " + (AlreadyDeployedToken._address === "0xeCE374063fE5Cc7EFbACA0a498477CaDA94E5AD6"));
|
||||
callback();
|
||||
});
|
||||
},
|
||||
function test7(callback) {
|
||||
$("#tests").append("<br>test 7: " + (AlreadyDeployedToken.address === "0x123"));
|
||||
callback();
|
||||
}
|
||||
], function (err, result) {
|
||||
}
|
||||
], function (err, result) {
|
||||
$("#tests").append("<br>done");
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
</head>
|
||||
<body class="container">
|
||||
|
||||
<button id="runTests">Run Tests</button>
|
||||
<div id="tests"></div>
|
||||
|
||||
</body>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"default": {
|
||||
"versions": {
|
||||
"web3.js": "1.0.0-beta",
|
||||
"solc": "0.4.17"
|
||||
"solc": "0.4.18"
|
||||
},
|
||||
"deployment": {
|
||||
"host": "localhost",
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
"devDependencies": {},
|
||||
"dependencies": {
|
||||
"embark-babel": "^1.0.0",
|
||||
"embark-service": "./extensions/embark-service",
|
||||
"ethereumjs-testrpc": "^3.9.2"
|
||||
"embark-service": "./extensions/embark-service"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue