Skip to content

Commit

Permalink
fix: updated fee calculation logic
Browse files Browse the repository at this point in the history
Signed-off-by: tipusinghaw <[email protected]>
  • Loading branch information
tipusinghaw committed Feb 13, 2024
1 parent 005adee commit dd2c751
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/registrar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,15 +378,17 @@ export class PolygonDID {
throw new Error('Network details not found!')
}

const maxGasFee = parseFloat(String(gasPriceDetails.maxFeePerGas)) / 1e9

// Calculate transaction fee
const transactionFee = gasLimitGwei * gasPriceGwei
const transactionFee = gasLimitGwei * maxGasFee

// Create EstimatedTxDetails object
const estimatedTxDetails: EstimatedTxDetails = {
transactionFee: String(transactionFee),
gasLimit: String(gasLimitGwei),
gasPrice: String(gasPriceGwei),
maxFeePerGas: parseFloat(String(gasPriceDetails.maxFeePerGas)) / 1e9,
maxFeePerGas: maxGasFee,
maxPriorityFeePerGas:
parseFloat(String(gasPriceDetails.maxPriorityFeePerGas)) / 1e9,
network: String(networkDetails.name),
Expand Down

0 comments on commit dd2c751

Please sign in to comment.