File tree Expand file tree Collapse file tree
packages/eth-providers/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -960,18 +960,27 @@ export abstract class BaseProvider extends AbstractProvider {
960960
961961 const lenIncreaseAfterSignature = 100 ; // approximate length increase after signature
962962 let feeDetails = null ;
963- if ( ! apiAt . call . transactionPaymentCallApi ) {
964- // for old api
965- feeDetails = await apiAt . call . transactionPaymentApi . queryFeeDetails (
966- extrinsic . toU8a ( ) ,
967- extrinsic . toU8a ( ) . length + lenIncreaseAfterSignature ,
968- ) ;
969- } else {
963+ if ( apiAt . call . transactionPaymentCallApi ) {
970964 // for new api with runtime 2310
971965 feeDetails = await apiAt . call . transactionPaymentCallApi . queryCallFeeDetails (
972966 extrinsic ,
973967 extrinsic . toU8a ( ) . length + lenIncreaseAfterSignature ,
974968 ) ;
969+ } else if ( this . api . call . transactionPaymentCallApi && blockHash === this . bestBlockHash ) {
970+ // for chopsticks test
971+ feeDetails = await this . api . call . transactionPaymentCallApi . queryCallFeeDetails (
972+ extrinsic ,
973+ extrinsic . toU8a ( ) . length + lenIncreaseAfterSignature ,
974+ ) ;
975+ } else {
976+ // for old api
977+ feeDetails = await apiAt . call . transactionPaymentApi . queryFeeDetails (
978+ extrinsic . toU8a ( ) ,
979+ extrinsic . toU8a ( ) . length + lenIncreaseAfterSignature ,
980+ ) ;
981+ }
982+ if ( feeDetails . isEmpty || feeDetails . inclusionFee . isEmpty ) {
983+ return logger . throwError ( 'failed to estimate gas' , Logger . errors . CALL_EXCEPTION ) ;
975984 }
976985 const { baseFee, lenFee, adjustedWeightFee } = feeDetails . inclusionFee . unwrap ( ) ;
977986
You can’t perform that action at this time.
0 commit comments