You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our Ethereum project, We are using free infura key(mainnet - https) for the provider. but the transaction takes 3 to 5 days. We send transaction less than five only per day, We have more balance in the account. Is any problem with the Free infura account?
We share our code here? Please help us
Our Ethereum project, We are using free infura key(mainnet - https) for the provider. but the transaction takes 3 to 5 days. We send transaction less than five only per day, We have more balance in the account. Is any problem with the Free infura account?
We share our code here? Please help us
`const { web3, Tx } = require("../includes/web3")
async function sendSignedTransactionsForContracts(data, senderAddress, senderPrivateKey) {
let txObject = {};
let nonce = null;
let gasPrice = null;
return new Promise(async (resolve, reject) => {
await Promise.all([web3.eth.getTransactionCount(senderAddress), web3.eth.getGasPrice()])
.then(result => {
nonce = result[0];
gasPrice = result[1];
gasPrice = (parseInt(gasPrice) + parseInt(gasPrice / 2)).toString();
console.log(gasPrice);
txObject = {
from: senderAddress,
nonce: web3.utils.toHex(nonce),
data: data
};
return web3.eth.estimateGas(txObject);
})
.then(estimateGas => {
txObject.gasPrice = web3.utils.toHex(gasPrice);
txObject.gas = web3.utils.toHex(estimateGas);
const tx = new Tx.Transaction(txObject, {'chain':'ropsten'});
const privateKey = Buffer.from(senderPrivateKey, 'hex');
tx.sign(privateKey);
const serializedTx = tx.serialize();
const raw = '0x' + serializedTx.toString('hex');
web3.eth.sendSignedTransaction(raw, async (err, txHash) => {
if (err) {
reject(err)
return
}
console.log('err:', err, 'txHash:', txHash)
let getTransaction = setInterval(async () => {
web3.eth.getTransactionReceipt(txHash, async function (error, result) {
if (error) {
clearInterval(getTransaction)
console.log({ 'errrr': error })
reject(error)
}
}
async function sendSignedTransactionsForMethods(data, contract_address, senderAddress, senderPrivateKey) {
}
module.exports = { sendSignedTransactionsForContracts, sendSignedTransactionsForMethods }`
The text was updated successfully, but these errors were encountered: