@@ -2,13 +2,13 @@ import axios from 'axios';
22import { BN } from '@polkadot/util' ;
33import { ethers } from 'ethers' ;
44import Web3 from 'web3' ;
5- import { TransactionConfig } from 'web3-eth ' ;
5+ import { TransactionCall } from 'web3-types ' ;
66import { ApiGasNow , GasPrice , GAS_API_URL } from '../index' ;
77import { astarChain } from '../../config' ;
88
99export const getEvmGas = async ( web3 : Web3 , selectedGasPrice : string ) : Promise < string > => {
1010 const gasPriceFallback = await web3 . eth . getGasPrice ( ) ;
11- const gasPrice = selectedGasPrice !== '0' ? selectedGasPrice : gasPriceFallback ;
11+ const gasPrice = selectedGasPrice !== '0' ? selectedGasPrice : gasPriceFallback . toString ( ) ;
1212 return gasPrice ;
1313} ;
1414
@@ -27,7 +27,7 @@ export const getEvmGasCost = async ({ isNativeToken,
2727 value : string ;
2828 encodedData ?: string ;
2929} ) : Promise < GasPrice > => {
30- const tx : TransactionConfig = isNativeToken
30+ const tx : TransactionCall = isNativeToken
3131 ? {
3232 from : fromAddress ,
3333 to : toAddress ,
@@ -42,7 +42,7 @@ export const getEvmGasCost = async ({ isNativeToken,
4242 } ;
4343
4444 const numEstimatedGas = await web3 . eth . estimateGas ( tx ) ;
45- const estimatedGas = new BN ( numEstimatedGas ) ;
45+ const estimatedGas = new BN ( numEstimatedGas . toString ( ) ) ;
4646 const data = {
4747 ...evmGasPrice ,
4848 slow : ethers . utils . formatEther ( estimatedGas . mul ( new BN ( evmGasPrice . slow ) ) . toString ( ) ) ,
0 commit comments