Skip to content

Commit

Permalink
fix amount
Browse files Browse the repository at this point in the history
  • Loading branch information
waelhanfi04 committed Jan 5, 2024
1 parent 9c99f25 commit 7275199
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion web3/campaigns.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)}
Expand Down

0 comments on commit 7275199

Please sign in to comment.