2gwei min gas limit update
This commit is contained in:
parent
6b5dc8a55d
commit
249ed6c970
File diff suppressed because one or more lines are too long
|
@ -29,18 +29,21 @@ function addValidator(web3, func, validatorViewObj, address, contractAddr, cb) {
|
|||
+ toUnifiedLengthLeft(bytesCount(validatorViewObj.streetName).toString(16)) + streetNameHex.substring(2)
|
||||
+ toUnifiedLengthLeft(bytesCount(validatorViewObj.state).toString(16)) + stateHex.substring(2);
|
||||
|
||||
estimateGas(web3, address, contractAddr, data, null, function(estimatedGas, err) {
|
||||
if (err) {
|
||||
cb(null, err);
|
||||
return;
|
||||
}
|
||||
estimatedGas += 100000;
|
||||
sendTx(web3, address, contractAddr, data, null, estimatedGas, function(txHash, err) {
|
||||
getGasPrice(function(gasPrice) {
|
||||
console.log(gasPrice);
|
||||
estimateGas(web3, address, contractAddr, data, null, function(estimatedGas, err) {
|
||||
if (err) {
|
||||
cb(txHash, err);
|
||||
cb(null, err);
|
||||
return;
|
||||
}
|
||||
cb(txHash);
|
||||
estimatedGas += 100000;
|
||||
sendTx(web3, address, contractAddr, data, null, estimatedGas, gasPrice, function(txHash, err) {
|
||||
if (err) {
|
||||
cb(txHash, err);
|
||||
return;
|
||||
}
|
||||
cb(txHash);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -11,18 +11,18 @@ function estimateGas(web3, from, to, data, val, cb) {
|
|||
props = { from: from, data: data, to: to };
|
||||
|
||||
web3.eth.estimateGas(props, function(err, estimatedGas) {
|
||||
console.log(err);
|
||||
if (err) console.log(err);
|
||||
console.log(estimatedGas);
|
||||
cb(estimatedGas);
|
||||
});
|
||||
}
|
||||
|
||||
function sendTx(web3, from, to, data, val, estimatedGas, cb) {
|
||||
function sendTx(web3, from, to, data, val, estimatedGas, gasPrice, cb) {
|
||||
var props;
|
||||
if (val)
|
||||
props = { from: from, value: val, to: to, gas: estimatedGas };
|
||||
props = { from: from, value: val, to: to, gas: estimatedGas, gasPrice: gasPrice };
|
||||
else
|
||||
props = { from: from, data: data, to: to, gas: estimatedGas };
|
||||
props = { from: from, data: data, to: to, gas: estimatedGas, gasPrice: gasPrice };
|
||||
|
||||
web3.eth.sendTransaction(props, function(err, txHash) {
|
||||
cb(txHash, err);
|
||||
|
@ -39,4 +39,30 @@ function call(web3, from, to, data, cb) {
|
|||
web3.eth.call(props, function(err, data) {
|
||||
cb(data);
|
||||
});
|
||||
}
|
||||
|
||||
function getBalance(address, cb) {
|
||||
web3.eth.getBalance(address, function(err, balance) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
$(".loading-container").hide();
|
||||
return;
|
||||
}
|
||||
|
||||
cb(balance);
|
||||
});
|
||||
}
|
||||
|
||||
function getGasPrice(cb) {
|
||||
web3.eth.getGasPrice(function(err, gasPriceObj) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
$(".loading-container").hide();
|
||||
return;
|
||||
}
|
||||
console.log(gasPriceObj);
|
||||
var gasPrice = gasPriceObj.c[0];
|
||||
|
||||
cb(gasPrice);
|
||||
});
|
||||
}
|
|
@ -12,14 +12,16 @@ function createKeys(web3, func, keys, address, contractAddr, cb) {
|
|||
+ toUnifiedLengthLeft(keys.payoutKey.payoutKeyObject.address)
|
||||
+ toUnifiedLengthLeft(keys.votingKey.votingKeyObject.address);
|
||||
|
||||
estimateGas(web3, address, contractAddr, data, null, function(estimatedGas) {
|
||||
estimatedGas += 100000;
|
||||
sendTx(web3, address, contractAddr, data, null, estimatedGas, function(txHash, err) {
|
||||
if (err) {
|
||||
cb(txHash, err);
|
||||
return;
|
||||
}
|
||||
cb(txHash);
|
||||
getGasPrice(function(gasPrice) {
|
||||
estimateGas(web3, address, contractAddr, data, null, function(estimatedGas) {
|
||||
estimatedGas += 100000;
|
||||
sendTx(web3, address, contractAddr, data, null, estimatedGas, gasPrice, function(txHash, err) {
|
||||
if (err) {
|
||||
cb(txHash, err);
|
||||
return;
|
||||
}
|
||||
cb(txHash);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -196,31 +196,6 @@ function startDapp(web3, isOraclesNetwork) {
|
|||
});
|
||||
}
|
||||
|
||||
function getBalance(address, cb) {
|
||||
web3.eth.getBalance(address, function(err, balance) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
$(".loading-container").hide();
|
||||
return;
|
||||
}
|
||||
|
||||
cb(balance);
|
||||
});
|
||||
}
|
||||
|
||||
function getGasPrice(cb) {
|
||||
web3.eth.getGasPrice(function(err, gasPriceObj) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
$(".loading-container").hide();
|
||||
return;
|
||||
}
|
||||
var gasPrice = gasPriceObj.c[0];
|
||||
|
||||
cb(gasPrice);
|
||||
});
|
||||
}
|
||||
|
||||
function estimateGasForTx(address, to, balance, cb) {
|
||||
estimateGas(web3, address, to, null, parseInt(balance/2), function(estimatedGas, err) {
|
||||
if (err) {
|
||||
|
@ -240,41 +215,44 @@ function startDapp(web3, isOraclesNetwork) {
|
|||
}
|
||||
|
||||
function transferCoinsToPayoutKey(estimatedGas, gasPrice, address, to, ammountToSend) {
|
||||
web3.eth.sendTransaction({
|
||||
"gas": estimatedGas,
|
||||
"from": address,
|
||||
"to": to,
|
||||
"value": ammountToSend}, function(err, txHash) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
$(".loading-container").hide();
|
||||
return;
|
||||
}
|
||||
$(".loading-container").hide();
|
||||
swal("Sucess", "Keys are created", "success");
|
||||
$('.content').empty();
|
||||
$('.content').load("./keys.html", function() {
|
||||
$("#miningKey").text("0x" + keys.miningKey.miningKeyObject.address);
|
||||
$("#payoutKey").text("0x" + keys.payoutKey.payoutKeyObject.address);
|
||||
$("#votingKey").text("0x" + keys.votingKey.votingKeyObject.address);
|
||||
getGasPrice(function(gasPrice) {
|
||||
web3.eth.sendTransaction({
|
||||
"gas": estimatedGas,
|
||||
"gasPrice": gasPrice,
|
||||
"from": address,
|
||||
"to": to,
|
||||
"value": ammountToSend}, function(err, txHash) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
$(".loading-container").hide();
|
||||
return;
|
||||
}
|
||||
$(".loading-container").hide();
|
||||
swal("Sucess", "Keys are created", "success");
|
||||
$('.content').empty();
|
||||
$('.content').load("./keys.html", function() {
|
||||
$("#miningKey").text("0x" + keys.miningKey.miningKeyObject.address);
|
||||
$("#payoutKey").text("0x" + keys.payoutKey.payoutKeyObject.address);
|
||||
$("#votingKey").text("0x" + keys.votingKey.votingKeyObject.address);
|
||||
|
||||
$("#miningKeyPass").text(keys.miningKey.password);
|
||||
$("#payoutKeyPass").text(keys.payoutKey.password);
|
||||
$("#votingKeyPass").text(keys.votingKey.password);
|
||||
$("#miningKeyPass").text(keys.miningKey.password);
|
||||
$("#payoutKeyPass").text(keys.payoutKey.password);
|
||||
$("#votingKeyPass").text(keys.votingKey.password);
|
||||
|
||||
$("#miningKeyDownload").click(function() {
|
||||
download("mining_key_" + keys.miningKey.miningKeyObject.address, JSON.stringify(keys.miningKey.miningKeyObject));
|
||||
$("#miningKeyDownload").click(function() {
|
||||
download("mining_key_" + keys.miningKey.miningKeyObject.address, JSON.stringify(keys.miningKey.miningKeyObject));
|
||||
});
|
||||
|
||||
$("#payoutKeyDownload").click(function() {
|
||||
download("payout_key_" + keys.payoutKey.payoutKeyObject.address, JSON.stringify(keys.payoutKey.payoutKeyObject));
|
||||
});
|
||||
|
||||
$("#votingKeyDownload").click(function() {
|
||||
download("voting_key_" + keys.votingKey.votingKeyObject.address, JSON.stringify(keys.votingKey.votingKeyObject));
|
||||
});
|
||||
});
|
||||
|
||||
$("#payoutKeyDownload").click(function() {
|
||||
download("payout_key_" + keys.payoutKey.payoutKeyObject.address, JSON.stringify(keys.payoutKey.payoutKeyObject));
|
||||
});
|
||||
|
||||
$("#votingKeyDownload").click(function() {
|
||||
download("voting_key_" + keys.votingKey.votingKeyObject.address, JSON.stringify(keys.votingKey.votingKeyObject));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
</div>
|
||||
</footer>
|
||||
<script src="./assets/javascripts/sweetalert2.min.js" type="text/javascript"></script>
|
||||
<script src="./assets/javascripts/application.js?v=1.26" type="text/javascript"></script>
|
||||
<script src="./assets/javascripts/application.js?v=1.27" type="text/javascript"></script>
|
||||
<script src="./assets/javascripts/keythereum.min.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue