@@ -1373,7 +1373,7 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
13731373 ? new optionalDeps . ethUtil . BN ( params . eip1559 . maxFeePerGas )
13741374 : params . gasPrice
13751375 ? new optionalDeps . ethUtil . BN ( this . setGasPrice ( params . gasPrice ) )
1376- : await this . getGasPriceFromExternalAPI ( ) ;
1376+ : await this . getGasPriceFromExternalAPI ( this . staticsCoin ?. name as string ) ;
13771377
13781378 const bitgoFeeAddressNonce = await this . getAddressNonce ( bitgoFeeAddress ) ;
13791379
@@ -1480,6 +1480,7 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
14801480 if ( ! params . gasLimit && userKey && ! userKey . startsWith ( 'xpub' ) ) {
14811481 const sendData = txBuilder . getSendData ( ) ;
14821482 gasLimit = await this . getGasLimitFromExternalAPI (
1483+ params . intendedChain as string ,
14831484 params . bitgoFeeAddress as string ,
14841485 params . walletContractAddress ,
14851486 sendData
@@ -1650,6 +1651,7 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
16501651 if ( ! params . gasLimit && userKey && ! userKey . startsWith ( 'xpub' ) ) {
16511652 const sendData = txBuilder . getSendData ( ) ;
16521653 gasLimit = await this . getGasLimitFromExternalAPI (
1654+ params . intendedChain as string ,
16531655 params . bitgoFeeAddress as string ,
16541656 params . walletContractAddress ,
16551657 sendData
@@ -2447,7 +2449,7 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
24472449 /**
24482450 * Fetch the gas price from the explorer
24492451 */
2450- async getGasPriceFromExternalAPI ( ) : Promise < BN > {
2452+ async getGasPriceFromExternalAPI ( wrongChainCoin : string ) : Promise < BN > {
24512453 try {
24522454 const res = await this . recoveryBlockchainExplorerQuery ( {
24532455 module : 'proxy' ,
@@ -2457,17 +2459,18 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
24572459 console . log ( ` Got gas price: ${ gasPrice } ` ) ;
24582460 return gasPrice ;
24592461 } catch ( e ) {
2460- throw new Error ( ' Failed to get gas price' ) ;
2462+ throw new Error ( ` Failed to get gas price. Please make sure to use the api key of ${ wrongChainCoin } ` ) ;
24612463 }
24622464 }
24632465
24642466 /**
24652467 * Fetch the gas limit from the explorer
2468+ * @param intendedChain
24662469 * @param from
24672470 * @param to
24682471 * @param data
24692472 */
2470- async getGasLimitFromExternalAPI ( from : string , to : string , data : string ) : Promise < BN > {
2473+ async getGasLimitFromExternalAPI ( intendedChain : string , from : string , to : string , data : string ) : Promise < BN > {
24712474 try {
24722475 const res = await this . recoveryBlockchainExplorerQuery ( {
24732476 module : 'proxy' ,
@@ -2480,7 +2483,9 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
24802483 console . log ( `Got gas limit: ${ gasLimit } ` ) ;
24812484 return gasLimit ;
24822485 } catch ( e ) {
2483- throw new Error ( 'Failed to get gas limit: ' ) ;
2486+ throw new Error (
2487+ `Failed to get gas limit. Please make sure to use the privateKey aka userKey of ${ intendedChain } wallet ${ to } `
2488+ ) ;
24842489 }
24852490 }
24862491
0 commit comments