Fees
_6import { Fee } from '@terra-money/feather.js';_6_6const msgs = [ new MsgSend( ... ), new MsgExecuteContract( ... ), ]; // messages_6const fee = new Fee(50000, { uluna: 4500000 });_6_6const 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.
_1const 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:
_11const 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
:
_6const tx = await wallet.createAndSignTx({_6 msgs,_6 gasPrices: { uluna: 0.01 },_6 gasAdjustment: 1.9,_6 chainID: 'pisco-1',_6});