Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(services): add faucet fee config #4513

Merged
merged 4 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- [#4477](https://github.com/ignite/cli/pull/4477) IBC v10 support
- [#4166](https://github.com/ignite/cli/issues/4166) Migrate buf config files to v2
- [#4494](https://github.com/ignite/cli/pull/4494) Automatic migrate the buf configs to v2
- [#4513](https://github.com/ignite/cli/pull/4513) Allow to pass tx fees to faucet server

### Changes

Expand Down
3 changes: 3 additions & 0 deletions ignite/config/chain/base/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ type Faucet struct {

// Port number for faucet server to listen at.
Port uint `yaml:"port,omitempty" doc:"Port number for the faucet server."`

// TxFee is the tx fee the faucet needs to pay for each transaction.
TxFee string `yaml:"tx_fee,omitempty" doc:"Tx fee the faucet needs to pay for each transaction."`
}

// Init overwrites sdk configurations with given values.
Expand Down
10 changes: 10 additions & 0 deletions ignite/services/chain/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ func (c *Chain) Faucet(ctx context.Context) (cosmosfaucet.Faucet, error) {
faucetOptions = append(faucetOptions, cosmosfaucet.Coin(parsedCoin.Amount, amountMax, parsedCoin.Denom))
}

// parse fees to pass to the faucet as fees.
if fee := conf.Faucet.TxFee; fee != "" {
parsedFee, err := sdk.ParseCoinNormalized(fee)
if err != nil {
return cosmosfaucet.Faucet{}, errors.Errorf("%w: %s", err, fee)
}

faucetOptions = append(faucetOptions, cosmosfaucet.FeeAmount(parsedFee.Amount, parsedFee.Denom))
}

if conf.Faucet.RateLimitWindow != "" {
rateLimitWindow, err := time.ParseDuration(conf.Faucet.RateLimitWindow)
if err != nil {
Expand Down
Loading