cosmjs
cosmjs copied to clipboard
SignAndBroadcast does not support fee granter
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
)