Fees
import { Fee } from '@terra-money/feather.js';
const msgs = [ new MsgSend( ... ), new MsgExecuteContract( ... ), ]; // messages
const fee = new Fee(50000, { uluna: 4500000 });
const tx = await wallet.createAndSignTx({ msgs, fee, chainID: 'pisco-1' });
Automatic fee estimation
If you don't specify a fee when you create your transaction, it will automatically be estimated by simulating it within the node.
const tx = await wallet.createAndSignTx({ msgs, chainID: 'pisco-1' });
You can define the fee estimation parameters when you create your LCDClient
instance. The recommended values are as follows:
const lcd = new LCDClient({
'pisco-1':' { // key must be the chainID
'lcd': 'https://pisco-lcd.terra.dev',
'prefix': 'terra', // bech32 prefix, used by the LCD to understand which is the right chain to query
You can override these settings by passing the fee estimation parameters in wallet.createTx
or wallet.createAndSignTx
:
const tx = await wallet.createAndSignTx({
gasPrices: { uluna: 0.01 },