diff --git a/src/connectors/kujira/kujira.config.ts b/src/connectors/kujira/kujira.config.ts index fdc3f9bdef..ace4fedf41 100644 --- a/src/connectors/kujira/kujira.config.ts +++ b/src/connectors/kujira/kujira.config.ts @@ -27,7 +27,7 @@ export namespace KujiraConfig { prefix: configManager.get('kujira.prefix') || 'kujira', accountNumber: configManager.get('kujira.accountNumber') || 0, nativeToken: 'KUJI', - gasPrice: BigNumber(configManager.get('kujira.gasPrice') || 0.00125), + gasPrice: configManager.get('kujira.gasPrice') ? BigNumber(configManager.get('kujira.gasPrice')) : null, 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 1baa31c7b5..068ba59ffa 100644 --- a/src/connectors/kujira/kujira.ts +++ b/src/connectors/kujira/kujira.ts @@ -117,6 +117,7 @@ import { runWithRetryAndTimeout, } from './kujira.helpers'; import { + CHAIN_INFO, Denom, fin, KujiraQueryClient, @@ -167,6 +168,7 @@ import fse from 'fs-extra'; import { ConfigManagerCertPassphrase } from '../../services/config-manager-cert-passphrase'; import * as crypto from 'crypto'; import util from 'util'; +import {ChainInfo, FeeCurrency} from "@keplr-wallet/types"; const pbkdf2 = util.promisify(crypto.pbkdf2); @@ -206,6 +208,24 @@ export class Kujira { */ private readonly kujiraNetwork: keyof typeof contracts; + /** + * + * @private + */ + private readonly kujiraNetworkInfo: ChainInfo; + + /** + * + * @private + */ + private readonly kujiraNetworkNativeFees: FeeCurrency; + + /** + * + * @private + */ + private readonly kujiraNetworkNativeGasPrice: BigNumber; + /** * * @private @@ -288,6 +308,11 @@ export class Kujira { this.network = network; this.kujiraNetwork = convertNetworkToKujiraNetwork(this.network); + this.kujiraNetworkInfo = CHAIN_INFO[this.kujiraNetwork]; + this.kujiraNetworkNativeFees = getNotNullOrThrowError( + this.kujiraNetworkInfo['feeCurrencies'].find(it => it.coinDenom == config.nativeToken) + ); + this.kujiraNetworkNativeGasPrice = config.gasPrice || BigNumber(getNotNullOrThrowError(this.kujiraNetworkNativeFees.gasPriceStep?.low)); this.accounts = IMap().asMutable(); } @@ -499,7 +524,7 @@ export class Kujira { const prefix: string = config.prefix; - const gasPrice: string = `${config.gasPrice}${config.gasPriceSuffix}`; + const gasPrice: string = `${this.kujiraNetworkNativeGasPrice.toString()}${config.gasPriceSuffix}`; const mnemonic: string = basicWallet.mnemonic; @@ -1996,9 +2021,9 @@ export class Kujira { ): GetEstimatedFeesResponse { return { token: config.nativeToken, - price: config.gasPrice, + price: this.kujiraNetworkNativeGasPrice, limit: config.gasLimitEstimate, - cost: config.gasPrice.multipliedBy(config.gasLimitEstimate), + cost: this.kujiraNetworkNativeGasPrice.multipliedBy(config.gasLimitEstimate), } as EstimatedFees; } diff --git a/src/templates/kujira.yml b/src/templates/kujira.yml index 9966cda9ca..3198776a82 100644 --- a/src/templates/kujira.yml +++ b/src/templates/kujira.yml @@ -31,7 +31,7 @@ networks: nodeURL: null # Empty or null means choosing the RPC automatically prefix: 'kujira' accountNumber: 0 -gasPrice: 0.00125 +gasPrice: null # Empty or null means automatically gasPriceSuffix: 'ukuji' gasLimitEstimate: 0.009147 orderBook: