From a5b28d706edc677b1fc032885e2be9079cbb10cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danilo=20Ara=C3=BAjo=20Silva?= Date: Thu, 22 Feb 2024 11:23:52 +0000 Subject: [PATCH] Improvement to avoid problems when the gasPrice could not be found. --- src/connectors/kujira/kujira.config.ts | 1 + src/connectors/kujira/kujira.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/connectors/kujira/kujira.config.ts b/src/connectors/kujira/kujira.config.ts index ace4fedf41..be03d9c3ad 100644 --- a/src/connectors/kujira/kujira.config.ts +++ b/src/connectors/kujira/kujira.config.ts @@ -28,6 +28,7 @@ export namespace KujiraConfig { accountNumber: configManager.get('kujira.accountNumber') || 0, nativeToken: 'KUJI', gasPrice: configManager.get('kujira.gasPrice') ? BigNumber(configManager.get('kujira.gasPrice')) : null, + fallbackGasPrice: BigNumber(0.0034), gasPriceSuffix: 'ukuji', gasLimitEstimate: BigNumber( configManager.get('kujira.gasLimitEstimate') || 0.009147 diff --git a/src/connectors/kujira/kujira.ts b/src/connectors/kujira/kujira.ts index fc2dc10fda..f6bc32ac8a 100644 --- a/src/connectors/kujira/kujira.ts +++ b/src/connectors/kujira/kujira.ts @@ -329,7 +329,12 @@ export class Kujira { this.kujiraNetworkNativeFees = getNotNullOrThrowError( this.kujiraNetworkInfo['feeCurrencies'].find(it => it.coinDenom == config.nativeToken) ); - this.kujiraNetworkNativeGasPrice = config.gasPrice || BigNumber(getNotNullOrThrowError(this.kujiraNetworkNativeFees.gasPriceStep?.low)); + + try { + this.kujiraNetworkNativeGasPrice = config.gasPrice || BigNumber(getNotNullOrThrowError(this.kujiraNetworkNativeFees.gasPriceStep?.low)); + } catch (exception) { + this.kujiraNetworkNativeGasPrice = config.fallbackGasPrice; + } this.accounts = IMap().asMutable(); }