Skip to main content

Fees


_6
import { Fee } from '@terra-money/terra.js';
_6
_6
const msgs = [ new MsgSend( ... ), new MsgExecuteContract( ... ), ]; // messages
_6
const fee = new Fee(50000, { uluna: 4500000 });
_6
_6
const tx = await wallet.createAndSignTx({ msgs, fee });

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.


_1
const tx = await wallet.createAndSignTx({ msgs });

You can define the fee estimation parameters when you create your LCDClient instance. The defaults are:


_6
const terra = new LCDClient({
_6
URL: "https://phoenix-lcd.terra.dev",
_6
chainID: "phoenix-1",
_6
gasPrices: { uluna: 0.015 },
_6
gasAdjustment: 1.4,
_6
});

You can override these settings by passing the fee estimation parameters in wallet.createTx or wallet.createAndSignTx:


_5
const tx = await wallet.createAndSignTx({
_5
msgs,
_5
gasPrices: { ukrw: 0.01 },
_5
gasAdjustment: 1.9,
_5
});