From 7f29ef21b85d4bdb0891d220245dc13d33e74bba Mon Sep 17 00:00:00 2001 From: tipusinghaw <126460794+tipusinghaw@users.noreply.github.com> Date: Tue, 13 Feb 2024 12:12:01 +0530 Subject: [PATCH] fix: updated the estimation TX method (#9) * feat: implemented transaction estimation method Signed-off-by: tipusinghaw * fix: formatter issue Signed-off-by: tipusinghaw * fix: initialized the smart contract and rpcUrl Signed-off-by: tipusinghaw * fix: formatter issue Signed-off-by: tipusinghaw * feat: implemneted logic for schema checksum Signed-off-by: tipusinghaw * refactor: added validation empty schema details Signed-off-by: tipusinghaw * feat: add getAllSchema method Signed-off-by: tipusinghaw * fix: lock.yaml Signed-off-by: tipusinghaw * fix: did resolve method for create schema Signed-off-by: tipusinghaw * refactor: changed schema filter approach Signed-off-by: tipusinghaw * refactor: added validation for empty parameters Signed-off-by: tipusinghaw * fix: updated the estimation method Signed-off-by: tipusinghaw --------- Signed-off-by: tipusinghaw --- src/schema-manager.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/schema-manager.ts b/src/schema-manager.ts index 31584b3..8941400 100644 --- a/src/schema-manager.ts +++ b/src/schema-manager.ts @@ -326,16 +326,17 @@ export class PolygonSchema { if (!networkDetails) { 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),