From 7275199d92a866c4b5f839fa726a21c4b57d272d Mon Sep 17 00:00:00 2001 From: -g Date: Fri, 5 Jan 2024 17:11:07 +0100 Subject: [PATCH] fix amount --- web3/campaigns.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web3/campaigns.js b/web3/campaigns.js index 9daec99c..91d5e12f 100644 --- a/web3/campaigns.js +++ b/web3/campaigns.js @@ -1425,6 +1425,12 @@ exports.getTransactionAmount = async ( } catch (e) {} } +exports.getProviderUrl = async (networkName) => { + const network = networks.find(net => net.name === networkName); + return network ? network.providerUrl : null; +} + + exports.getTransactionAmountExternal = async ( credentials, type, @@ -1433,10 +1439,13 @@ exports.getTransactionAmountExternal = async ( ) => { try { let web3 = await new Web3( - new Web3.providers.HttpProvider(web3UrlBep20, options) + new Web3.providers.HttpProvider(await exports.getProviderUrl(credentials.network), options) ) let data = await new web3.eth.getTransactionReceipt(transactionHash) + console.log(data) + let amount = type === 'BTTC' ? data.logs[1].data : data.logs[0].data + console.log(amount) let hex = web3.utils.hexToNumberString(amount) return hex } catch (e) {console.log("error",e)}