mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-10 13:47:12 +00:00
🐛 Fix inconsistent gas multiplier value between signAndBroadcast
and signAndBroadcastSync
methods
This commit is contained in:
parent
5c1ec56189
commit
4d1f2e1a0e
@ -202,6 +202,9 @@ export class SigningCosmWasmClient extends CosmWasmClient {
|
||||
private readonly signer: OfflineSigner;
|
||||
private readonly aminoTypes: AminoTypes;
|
||||
private readonly gasPrice: GasPrice | undefined;
|
||||
// Starting with Cosmos SDK 0.47, we see many cases in which 1.3 is not enough anymore
|
||||
// E.g. https://github.com/cosmos/cosmos-sdk/issues/16020
|
||||
private readonly gasMultiplier = 1.4;
|
||||
|
||||
/**
|
||||
* Creates an instance by connecting to the given CometBFT RPC endpoint.
|
||||
@ -614,9 +617,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
|
||||
if (fee == "auto" || typeof fee === "number") {
|
||||
assertDefined(this.gasPrice, "Gas price must be set in the client options when auto gas is used.");
|
||||
const gasEstimation = await this.simulate(signerAddress, messages, memo);
|
||||
// Starting with Cosmos SDK 0.47, we see many cases in which 1.3 is not enough anymore
|
||||
// E.g. https://github.com/cosmos/cosmos-sdk/issues/16020
|
||||
const multiplier = typeof fee === "number" ? fee : 1.4;
|
||||
const multiplier = typeof fee === "number" ? fee : this.gasMultiplier;
|
||||
usedFee = calculateFee(Math.round(gasEstimation * multiplier), this.gasPrice);
|
||||
} else {
|
||||
usedFee = fee;
|
||||
@ -652,7 +653,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
|
||||
if (fee == "auto" || typeof fee === "number") {
|
||||
assertDefined(this.gasPrice, "Gas price must be set in the client options when auto gas is used.");
|
||||
const gasEstimation = await this.simulate(signerAddress, messages, memo);
|
||||
const multiplier = typeof fee === "number" ? fee : 1.3;
|
||||
const multiplier = typeof fee === "number" ? fee : this.gasMultiplier;
|
||||
usedFee = calculateFee(Math.round(gasEstimation * multiplier), this.gasPrice);
|
||||
} else {
|
||||
usedFee = fee;
|
||||
|
@ -110,6 +110,9 @@ export class SigningStargateClient extends StargateClient {
|
||||
private readonly signer: OfflineSigner;
|
||||
private readonly aminoTypes: AminoTypes;
|
||||
private readonly gasPrice: GasPrice | undefined;
|
||||
// Starting with Cosmos SDK 0.47, we see many cases in which 1.3 is not enough anymore
|
||||
// E.g. https://github.com/cosmos/cosmos-sdk/issues/16020
|
||||
private readonly gasMultiplier = 1.4;
|
||||
|
||||
/**
|
||||
* Creates an instance by connecting to the given CometBFT RPC endpoint.
|
||||
@ -308,9 +311,7 @@ export class SigningStargateClient extends StargateClient {
|
||||
if (fee == "auto" || typeof fee === "number") {
|
||||
assertDefined(this.gasPrice, "Gas price must be set in the client options when auto gas is used.");
|
||||
const gasEstimation = await this.simulate(signerAddress, messages, memo);
|
||||
// Starting with Cosmos SDK 0.47, we see many cases in which 1.3 is not enough anymore
|
||||
// E.g. https://github.com/cosmos/cosmos-sdk/issues/16020
|
||||
const multiplier = typeof fee === "number" ? fee : 1.4;
|
||||
const multiplier = typeof fee === "number" ? fee : this.gasMultiplier;
|
||||
usedFee = calculateFee(Math.round(gasEstimation * multiplier), this.gasPrice);
|
||||
} else {
|
||||
usedFee = fee;
|
||||
@ -337,7 +338,7 @@ export class SigningStargateClient extends StargateClient {
|
||||
if (fee == "auto" || typeof fee === "number") {
|
||||
assertDefined(this.gasPrice, "Gas price must be set in the client options when auto gas is used.");
|
||||
const gasEstimation = await this.simulate(signerAddress, messages, memo);
|
||||
const multiplier = typeof fee === "number" ? fee : 1.3;
|
||||
const multiplier = typeof fee === "number" ? fee : this.gasMultiplier;
|
||||
usedFee = calculateFee(Math.round(gasEstimation * multiplier), this.gasPrice);
|
||||
} else {
|
||||
usedFee = fee;
|
||||
|
Loading…
x
Reference in New Issue
Block a user