From daace88ca6ab1cd3f1485338143a3e3c8c8d71e8 Mon Sep 17 00:00:00 2001 From: vignesha22 <82584664+vignesha22@users.noreply.github.com> Date: Tue, 12 Sep 2023 16:54:55 +0530 Subject: [PATCH] PRO-1842-Fixes on gas prices (#33) --- CHANGELOG.md | 4 ++++ package-lock.json | 4 ++-- package.json | 2 +- src/sdk/sdk.ts | 7 ++++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46a2442a..b943b508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +## [1.2.6] - 2023-09-12 +### Fixes +- Fixed the issue on setting gas prices by the user if specified on estimate step + ## [1.2.4] - 2023-09-11 ### Breaking Changes - Changed the paymasterApi to include api_key for ARKA diff --git a/package-lock.json b/package-lock.json index 41a3351f..2f51273c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@etherspot/prime-sdk", - "version": "1.2.5", + "version": "1.2.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@etherspot/prime-sdk", - "version": "1.2.5", + "version": "1.2.6", "license": "MIT", "dependencies": { "@apollo/client": "3.4.0", diff --git a/package.json b/package.json index 3ebeef8e..62b62ef0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@etherspot/prime-sdk", - "version": "1.2.5", + "version": "1.2.6", "description": "Etherspot Prime (Account Abstraction) SDK", "keywords": [ "ether", diff --git a/src/sdk/sdk.ts b/src/sdk/sdk.ts index 331d0a7b..61b3fb1c 100644 --- a/src/sdk/sdk.ts +++ b/src/sdk/sdk.ts @@ -156,8 +156,13 @@ export class PrimeSdk { const bundlerGasEstimate = await this.bundler.getVerificationGasInfo(partialtx); + // if user has specified the gas prices then use them + if (gasDetails?.maxFeePerGas && gasDetails?.maxPriorityFeePerGas) { + partialtx.maxFeePerGas = gasDetails.maxFeePerGas; + partialtx.maxPriorityFeePerGas = gasDetails.maxPriorityFeePerGas; + } // if estimation has gas prices use them, otherwise fetch them in a separate call - if (bundlerGasEstimate.maxFeePerGas && bundlerGasEstimate.maxPriorityFeePerGas) { + else if (bundlerGasEstimate.maxFeePerGas && bundlerGasEstimate.maxPriorityFeePerGas) { partialtx.maxFeePerGas = bundlerGasEstimate.maxFeePerGas; partialtx.maxPriorityFeePerGas = bundlerGasEstimate.maxPriorityFeePerGas; } else {