Skip to content

Commit 7a1e869

Browse files
committed
feat(services): add faucet fee config
1 parent 40bfc2c commit 7a1e869

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
- [#4477](https://github.com/ignite/cli/pull/4477) IBC v10 support
2727
- [#4166](https://github.com/ignite/cli/issues/4166) Migrate buf config files to v2
2828
- [#4494](https://github.com/ignite/cli/pull/4494) Automatic migrate the buf configs to v2
29+
- []() Allow to pass tx fees to faucet server
2930

3031
### Changes
3132

ignite/config/chain/base/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ type Faucet struct {
9090

9191
// Port number for faucet server to listen at.
9292
Port uint `yaml:"port,omitempty" doc:"Port number for the faucet server."`
93+
94+
// TxFee is the tx fee the faucet needs to pay for each transaction.
95+
TxFee string `yaml:"tx_fee,omitempty" doc:"Tx fee the faucet needs to pay for each transaction."`
9396
}
9497

9598
// Init overwrites sdk configurations with given values.

ignite/services/chain/faucet.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ func (c *Chain) Faucet(ctx context.Context) (cosmosfaucet.Faucet, error) {
108108
faucetOptions = append(faucetOptions, cosmosfaucet.Coin(parsedCoin.Amount, amountMax, parsedCoin.Denom))
109109
}
110110

111+
// parse fees to pass to the faucet as fees.
112+
if fee := conf.Faucet.TxFee; fee != "" {
113+
parsedFee, err := sdk.ParseCoinNormalized(fee)
114+
if err != nil {
115+
return cosmosfaucet.Faucet{}, errors.Errorf("%w: %s", err, fee)
116+
}
117+
118+
faucetOptions = append(faucetOptions, cosmosfaucet.FeeAmount(parsedFee.Amount, parsedFee.Denom))
119+
}
120+
111121
if conf.Faucet.RateLimitWindow != "" {
112122
rateLimitWindow, err := time.ParseDuration(conf.Faucet.RateLimitWindow)
113123
if err != nil {

0 commit comments

Comments
 (0)