Skip to content

Commit a8cc17d

Browse files
authored
fix: convert to BigNumberish gas values (#152)
1 parent 42dab98 commit a8cc17d

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/allowance/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Contract, ContractTransaction, Signer, ethers } from 'ethers'
55
import ChainsService from '../services/ChainsService'
66
import { ERC20Contract, ERC20_ABI, RevokeTokenData } from '../types'
77
import { ServerError } from '../utils/errors'
8-
import { fetchDataUsingMulticall, MultiCallData } from '../utils/multicall'
8+
import { MultiCallData, fetchDataUsingMulticall } from '../utils/multicall'
99

1010
export const getApproved = async (
1111
signer: Signer,
@@ -44,7 +44,7 @@ export const setApproval = async (
4444
try {
4545
const estimatedGasLimit = await signer.estimateGas(transactionRequest)
4646
if (estimatedGasLimit) {
47-
const formattedGasLimit = ethers.utils.parseEther(
47+
const formattedGasLimit = ethers.BigNumber.from(
4848
`${(BigInt(estimatedGasLimit.toString()) * 125n) / 100n}`
4949
)
5050

src/execution/StepExecutionManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
TransactionResponse,
55
} from '@ethersproject/abstract-provider'
66
import { Execution, ExtendedTransactionInfo, FullStatusData } from '@lifi/types'
7+
import { BigNumber } from 'ethers'
78
import { checkAllowance } from '../allowance'
89
import { checkBalance } from '../balance'
910
import ApiService from '../services/ApiService'
@@ -16,7 +17,6 @@ import { isZeroAddress, personalizeStep } from '../utils/utils'
1617
import { stepComparison } from './stepComparison'
1718
import { switchChain } from './switchChain'
1819
import { getSubstatusMessage, waitForReceivingTransaction } from './utils'
19-
import { BigNumber, ethers } from 'ethers'
2020

2121
export class StepExecutionManager {
2222
allowUserInteraction = true

src/utils/preRestart.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-non-null-assertion */
2-
import { Signer } from 'ethers'
2+
import { BigNumber, Signer } from 'ethers'
33
import { Route } from '../types'
44
import { LifiErrorCode } from './errors'
55

@@ -34,9 +34,9 @@ const handleErrorType = async (route: Route, index: number, signer: Signer) => {
3434
} catch (error) {}
3535

3636
if (gasLimit) {
37-
transactionRequest.gasLimit = `${
38-
(BigInt(gasLimit.toString()) * 125n) / 100n
39-
}`
37+
transactionRequest.gasLimit = BigNumber.from(
38+
`${(BigInt(gasLimit.toString()) * 125n) / 100n}`
39+
)
4040
}
4141
}
4242

@@ -55,9 +55,9 @@ const handleErrorType = async (route: Route, index: number, signer: Signer) => {
5555
} catch (error) {}
5656

5757
if (gasPrice) {
58-
transactionRequest.gasPrice = `${
59-
(BigInt(gasPrice.toString()) * 125n) / 100n
60-
}`
58+
transactionRequest.gasPrice = BigNumber.from(
59+
`${(BigInt(gasPrice.toString()) * 125n) / 100n}`
60+
)
6161
}
6262
}
6363

0 commit comments

Comments
 (0)