Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #19 from klaytn/dev
Browse files Browse the repository at this point in the history
Fixed USD Aptos issue
  • Loading branch information
Sotatek-TinnNguyen authored Dec 13, 2023
2 parents f42eace + a794553 commit b459eea
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions aptos-tx-latency-measurement/sendtx_aptos.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,15 @@ async function sendTx() {
.then((response) => {
APTOStoUSD = response.data["aptos"]["usd"];
});
// const transactionDetail = await client.getTransactionByHash(txnHash);
// const gasUsed = transactionDetail.gas_used;
// const gasUnitPrice = transactionDetail.gas_unit_price;
// const txfee = gasUsed * gasUnitPrice * Math.pow(10, -8);
// data.txFee = txfee;
// data.txFeeInUSD = APTOStoUSD * data.txFee;
console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`)
const transactionDetail = await client.getTransactionByHash(txnHash);
const gasUsed = transactionDetail.gas_used;
const gasUnitPrice = transactionDetail.gas_unit_price;
const txfee = gasUsed * gasUnitPrice * Math.pow(10, -8);
data.txFee = txfee;
data.txFeeInUSD = APTOStoUSD * data.txFee;
// console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`)
} catch (err) {
sendSlackMsg("failed to execute, " + err.toString());
console.log("failed to execute.", err.toString());
data.error = err.toString();
console.log(`${data.executedAt},${data.chainId},${data.txhash},${data.startTime},${data.endTime},${data.latency},${data.txFee},${data.txFeeInUSD},${data.resourceUsedOfLatestBlock},${data.numOfTxInLatestBlock},${data.pingTime},${data.error}`)
Expand Down Expand Up @@ -264,4 +265,4 @@ async function main() {
}, interval);
}
loadConfig();
main();
main();

0 comments on commit b459eea

Please sign in to comment.