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

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' });
Copy

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' });
Copy

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
'chainID': 'pisco-1',
'lcd': 'https://pisco-lcd.terra.dev',
'gasAdjustment': 1.75,
'gasPrices': {
'uluna': 0.015
},
'prefix': 'terra', // bech32 prefix, used by the LCD to understand which is the right chain to query
}
});
Copy

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

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