@@ -492,6 +492,11 @@ export const optionalDeps = {
492492export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
493493 static hopTransactionSalt = 'bitgoHopAddressRequestSalt' ;
494494 protected readonly sendMethodName : 'sendMultiSig' | 'sendMultiSigToken' ;
495+ protected readonly coinFamiliesWithL1Fees : ReadonlyArray < 'opeth' | 'dogeos' | 'morpheth' > = [
496+ 'opeth' ,
497+ 'dogeos' ,
498+ 'morpheth' ,
499+ ] ;
495500
496501 readonly staticsCoin ?: Readonly < StaticsBaseCoin > ;
497502
@@ -1516,10 +1521,9 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
15161521 const backupKeyBalance = await this . queryAddressBalance ( backupKeyAddress , params . apiKey ) ;
15171522 let totalGasNeeded = gasPrice . mul ( gasLimit ) ;
15181523
1519- // On optimism chain, L1 fees is to be paid as well apart from L2 fees
1520- // So we are adding the amount that can be used up as l1 fees
1521- if ( this . staticsCoin ?. family === 'opeth' ) {
1522- totalGasNeeded = totalGasNeeded . add ( new optionalDeps . ethUtil . BN ( ethGasConfigs . opethGasL1Fees ) ) ;
1524+ // On L2 chains with L1 data fees, add buffer for L1 fees
1525+ if ( this . staticsCoin ?. family !== undefined && this . coinFamiliesWithL1Fees . includes ( this . staticsCoin . family ) ) {
1526+ totalGasNeeded = totalGasNeeded . add ( new optionalDeps . ethUtil . BN ( ethGasConfigs . l1GasFeeBuffer ) ) ;
15231527 }
15241528
15251529 const weiToGwei = 10 ** 9 ;
@@ -2515,7 +2519,11 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
25152519
25162520 async validateBalanceAndGetTxAmount ( baseAddress : string , gasPrice : BN , gasLimit : BN , apiKey ?: string ) {
25172521 const baseAddressBalance = await this . queryAddressBalance ( baseAddress , apiKey ) ;
2518- const totalGasNeeded = gasPrice . mul ( gasLimit ) ;
2522+ let totalGasNeeded = gasPrice . mul ( gasLimit ) ;
2523+ // On L2 chains with L1 data fees, add buffer for L1 fees
2524+ if ( this . staticsCoin ?. family !== undefined && this . coinFamiliesWithL1Fees . includes ( this . staticsCoin . family ) ) {
2525+ totalGasNeeded = totalGasNeeded . add ( new optionalDeps . ethUtil . BN ( ethGasConfigs . l1GasFeeBuffer ) ) ;
2526+ }
25192527 const weiToGwei = new BN ( 10 ** 9 ) ;
25202528 if ( baseAddressBalance . lt ( totalGasNeeded ) ) {
25212529 throw new Error (
0 commit comments