Team,
I have integrated your endpoint in my node js project for ETH, OMG, USDT, USDC coins. Everything seems working on my development server but when I deployed the same on production some of the APIs are not responding.
This is the URL I am using https://mainnet.infura.io/v3/XXXXXXXXXXX4e4326b3fb4eec83f88640
-
Gebalance - getBalance() (This method is working perfect and I can get the response back from the server)
-
sendSignedTransaction() (This method does not respond back but when I check etherscan explorer I can the transaction is done)
Please find the code sample. I debugged and it goes to the success part but still, no response comes from the server.
get_payment: async (req, res) => {
if (!req.body.privateKey || !req.body.fromAddr || !req.body.toAddr || !req.body.value) {
return res.send({ code: 400, message: “Parameters Missing!!” })
}
getBalance(req.body.fromAddr, async (err, result) => {
if (err) {
return res.send({ code: 500, message: “Internal server error” })
}
else if (result < 0.01) {
res.send({ code: 500, message: “Min. 0.01eth is required” })
}
else if (result) {
privateKey = (req.body.privateKey).split(‘0x’)
privateKey = privateKey[1]
var privateKey = new Buffer(privateKey, ‘hex’);
var amount = new BigNumber(req.body.value).multipliedBy(new BigNumber(Math.pow(10, 18)));
signTxn(req.body.toAddr, req.body.fromAddr, amount, privateKey, async function (hash) {
if (hash) {
var receiptT = await web3.eth.sendSignedTransaction(hash)
if (receiptT) {
var transactionFee = (5 1e9) receiptT.gasUsed;
var fee_data = new BigNumber(transactionFee).dividedBy(new BigNumber(Math.pow(10, 18)));
return res.send({ code: 200, txid: receiptT.transactionHash, fee: fee_data })
}
}
else {
res.send({ code: 500, message: “Insufficient balance” })
}
})
} else {
return res.send({ code: 500, message: “Internal server error” })
}
})
}