cosmjs icon indicating copy to clipboard operation
cosmjs copied to clipboard

SignAndBroadcast does not support fee granter

Open dadamu opened this issue 1 year ago • 0 comments

Currently, to broadcast a transaction with a fee granter only can be implemented by manually signing tranasction because signAndBroadCast does not support feeGranter parameter.

const gasEstimation = await client!.simulate(creator, [msg], "");
const fee = calculateFee(Math.round(gasEstimation * 2), GasPrice.fromString("0.2udaric"));
const tx = await client!.signTx(creator, [msg], {
  fee,
  feeGranter: "fee granter address",
});
const txBytes = TxRaw.encode(tx.txRaw).finish();
const response = await client!.broadcastTx(txBytes, client!.broadcastTimeoutMs, client!.broadcastPollIntervalMs);

Providing feeGranter parameter to signAndBroadcast can make it simpler, like:

public async signAndBroadcast(
  signerAddress: string,
  messages: readonly EncodeObject[],
  fee: StdFee | "auto" | number,
  memo = "",
  feeGranter = "", // added
)

dadamu avatar Aug 03 '23 09:08 dadamu