mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-11 14:34:40 +00:00
adapt test app to work with 1.0
This commit is contained in:
parent
ef98346963
commit
69fa1b24c3
@ -114,7 +114,6 @@ EmbarkJS.Contract = function(options) {
|
||||
ContractClass.setProvider(this.web3.currentProvider);
|
||||
|
||||
return ContractClass;
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
|
@ -32,7 +32,6 @@ EmbarkJS.Contract = function(options) {
|
||||
ContractClass.setProvider(this.web3.currentProvider);
|
||||
|
||||
return ContractClass;
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
|
@ -153,9 +153,11 @@ result += "\n";
|
||||
connectionCode += "\nweb3.eth.getAccounts(function(err, account) { if(err) { next(null, true) } else { next(null, false) }})";
|
||||
|
||||
connectionCode += "\n}, function(err, _result) {";
|
||||
connectionCode += "\nweb3.eth.defaultAccount = web3.eth.accounts[0];";
|
||||
connectionCode += "\nweb3.eth.getAccounts(function(err, accounts) {;";
|
||||
connectionCode += "\nweb3.eth.defaultAccount = accounts[0];";
|
||||
connectionCode += '\ndone();';
|
||||
connectionCode += "\n});";
|
||||
connectionCode += "\n});";
|
||||
|
||||
result += connectionCode;
|
||||
}
|
||||
|
@ -11,15 +11,31 @@ $(document).ready(function() {
|
||||
|
||||
$("#blockchain button.set").click(function() {
|
||||
var value = parseInt($("#blockchain input.text").val(), 10);
|
||||
SimpleStorage.set(value);
|
||||
addToLog("#blockchain", "SimpleStorage.set(" + value + ")");
|
||||
|
||||
// If web3.js 1.0 is being used
|
||||
if (EmbarkJS.isNewWeb3()) {
|
||||
SimpleStorage.methods.set(value).send({from: web3.eth.defaultAccount});
|
||||
addToLog("#blockchain", "SimpleStorage.methods.set(value).send({from: web3.eth.defaultAccount})");
|
||||
} else {
|
||||
SimpleStorage.set(value);
|
||||
addToLog("#blockchain", "SimpleStorage.set(" + value + ")");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#blockchain button.get").click(function() {
|
||||
SimpleStorage.get().then(function(value) {
|
||||
$("#blockchain .value").html(value.toNumber());
|
||||
});
|
||||
addToLog("#blockchain", "SimpleStorage.get()");
|
||||
// If web3.js 1.0 is being used
|
||||
if (EmbarkJS.isNewWeb3()) {
|
||||
SimpleStorage.methods.get().call(function(err, value) {
|
||||
$("#blockchain .value").html(value);
|
||||
});
|
||||
addToLog("#blockchain", "SimpleStorage.methods.get(console.log)");
|
||||
} else {
|
||||
SimpleStorage.get().then(function(value) {
|
||||
$("#blockchain .value").html(value.toNumber());
|
||||
});
|
||||
addToLog("#blockchain", "SimpleStorage.get()");
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user