Skip to content

Commit

Permalink
Add gas limit and gas estimation in getFees()
Browse files Browse the repository at this point in the history
  • Loading branch information
SDargarh committed Nov 30, 2023
1 parent 91e2070 commit dfcf8ea
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,9 @@

### 1.2.3 (2023-11-27)

- Updated node version to 18x
- Updated node version to 18x

### 1.2.4 (2023-11-30)

- Add gas limit and gas estimation in getFees()
- updated tests for getFees() update
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@getsafle/vault-bsc-controller",
"version": "1.2.3",
"version": "1.2.4",
"description": "",
"engines": {
"node": ">= 10"
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,10 @@ class KeyringController extends EventEmitter {
}

async getFees(bscTx, web3) {
const { from, to, value, data, gasLimit } = bscTx
const estimate = gasLimit ? gasLimit : await web3.eth.estimateGas({ to, from, value, data })
const { from, to, value, data } = bscTx
const gasLimit = await web3.eth.estimateGas({ to, from, value, data })
const gasPrice = await web3.eth.getGasPrice();
return { transactionFees: estimate * gasPrice }
return { gasLimit: gasLimit, gasPrice: gasPrice}
}
}

Expand Down

0 comments on commit dfcf8ea

Please sign in to comment.