var img = document.createElement('img'); img.src = "https://terradocs.matomo.cloud//piwik.php?idsite=1&rec=1&url=https://docs.terra.money" + location.pathname; img.style = "border:0"; img.alt = "tracker"; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(img,s);
Skip to main content

Fees


_6
import { Fee } from '@terra-money/feather.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, 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.


_1
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:


_11
const lcd = new LCDClient({
_11
'pisco-1':' { // key must be the chainID
_11
'chainID': 'pisco-1',
_11
'lcd': 'https://pisco-lcd.terra.dev',
_11
'gasAdjustment': 1.75,
_11
'gasPrices': {
_11
'uluna': 0.015
_11
},
_11
'prefix': 'terra', // bech32 prefix, used by the LCD to understand which is the right chain to query
_11
}
_11
});

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


_6
const tx = await wallet.createAndSignTx({
_6
msgs,
_6
gasPrices: { uluna: 0.01 },
_6
gasAdjustment: 1.9,
_6
chainID: 'pisco-1',
_6
});