mirror of
https://github.com/status-im/autobounty.git
synced 2025-02-27 20:40:45 +00:00
Cleanup
This commit is contained in:
parent
5f335791e2
commit
b3715767ef
14
bot/index.js
14
bot/index.js
@ -132,19 +132,21 @@ const error = function (errorMessage) {
|
|||||||
|
|
||||||
const sendTransaction = function (to, amount, gasPrice) {
|
const sendTransaction = function (to, amount, gasPrice) {
|
||||||
|
|
||||||
var chaind = providers.Provider.chainId.ropsten;
|
var chainId = providers.Provider.chainId.ropsten;
|
||||||
var chainName = providers.networks.ropsten;
|
var chainName = providers.networks.ropsten;
|
||||||
if (!config.debug) {
|
|
||||||
|
if (config.realTransaction) {
|
||||||
chainId = providers.Provider.chainId.homestead;
|
chainId = providers.Provider.chainId.homestead;
|
||||||
chainName = providers.networks.homestead;
|
chainName = providers.networks.homestead;
|
||||||
}
|
}
|
||||||
|
|
||||||
var wallet = new Wallet(config.privateKey);
|
const wallet = new Wallet(config.privateKey);
|
||||||
const provider = ethers.providers.getDefaultProvider(chainName);
|
const provider = ethers.providers.getDefaultProvider(chainName);
|
||||||
|
|
||||||
|
wallet.provider = provider;
|
||||||
|
|
||||||
|
|
||||||
var transaction = {
|
var transaction = {
|
||||||
nonce: 0,
|
|
||||||
gasLimit: config.gasLimit,
|
gasLimit: config.gasLimit,
|
||||||
gasPrice: gasPrice,
|
gasPrice: gasPrice,
|
||||||
to: to,
|
to: to,
|
||||||
@ -152,10 +154,8 @@ const sendTransaction = function (to, amount, gasPrice) {
|
|||||||
chainId: chainId
|
chainId: chainId
|
||||||
};
|
};
|
||||||
|
|
||||||
var signedTransaction = wallet.sign(transaction);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
wallet.provider.sendTransaction(signedTransaction)
|
wallet.sendTransaction(transaction)
|
||||||
.then(function(hash) {
|
.then(function(hash) {
|
||||||
logTransaction(hash);
|
logTransaction(hash);
|
||||||
resolve(hash);
|
resolve(hash);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user