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

chore: bump ignite cli #25

Closed
wants to merge 10 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat: set fee amount for tx (#3)
* feat: set fee amount for tx

* add flag in readme
mazzy89 authored Nov 14, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 07fc803c6a3bc01231fba0eb7bc73d8bd0a06699
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -58,21 +58,22 @@ $ make install
You can configure the faucet either using command line flags or environment variables. The following table
shows the available configuration options and respective defaults:

| flag | env | description | default |
|------------------|-------------------|-------------------------------------------------------------- |-----------|
| port | PORT | tcp port where faucet will be listening for requests | 8000 |
| account-name | ACCOUNT_NAME | name of the account to be used by the faucet | faucet |
| mnemonic | MNEMONIC | mnemonic for restoring an account | |
| keyring-password | KEYRING_PASSWORD | password for accessing keyring | |
| denoms | DENOMS | denomination of the coins sent by default (comma separated) | uatom |
| credit-amount | CREDIT_AMOUNT | amount to credit in each request | 10000000 |
| max-credit | MAX_CREDIT | maximum credit per account | 100000000 |
| sdk-version | SDK_VERSION | version of sdk (launchpad or stargate) | stargate |
| node | NODE | address of tendermint RPC endpoint for this chain | |
| keyring-backend | KEYRING_BACKEND | keyring backend to be used | |
| coin-type | COIN_TYPE | registered coin type number for HD derivation (BIP-0044) | 118 |
| home | HOME | replaces the default home used by the chain | |
| | | | |
| flag | env | description | default |
|------------------|------------------|-------------------------------------------------------------- |-----------|
| port | PORT | tcp port where faucet will be listening for requests | 8000 |
| account-name | ACCOUNT_NAME | name of the account to be used by the faucet | faucet |
| mnemonic | MNEMONIC | mnemonic for restoring an account | |
| keyring-password | KEYRING_PASSWORD | password for accessing keyring | |
| denoms | DENOMS | denomination of the coins sent by default (comma separated) | uatom |
| credit-amount | CREDIT_AMOUNT | amount to credit in each request | 10000000 |
| max-credit | MAX_CREDIT | maximum credit per account | 100000000 |
| fee-amount | FEE_AMOUNT | fee to pay along with the transaction | 0 |
| sdk-version | SDK_VERSION | version of sdk (launchpad or stargate) | stargate |
| node | NODE | address of tendermint RPC endpoint for this chain | |
| keyring-backend | KEYRING_BACKEND | keyring backend to be used | |
| coin-type | COIN_TYPE | registered coin type number for HD derivation (BIP-0044) | 118 |
| home | HOME | replaces the default home used by the chain | |
| | | | |

### [gaia](https://github.com/cosmos/gaia) example

5 changes: 5 additions & 0 deletions cmd/faucet/config.go
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ var (
defaultDenoms string
creditAmount uint64
maxCredit uint64
feeAmount uint64
nodeAddress string
coinType string
home string
@@ -70,6 +71,10 @@ func init() {
"max-credit", environ.GetUint64("MAX_CREDIT", cosmosfaucet.DefaultMaxAmount),
"maximum credit per account",
)
flag.Uint64Var(&feeAmount,
"fee-amount", environ.GetUint64("FEE_AMOUNT", 0),
"fee to pay along with the transaction",
)
flag.StringVar(&nodeAddress, "node",
environ.GetString("NODE", ""),
"address of tendermint RPC endpoint for this chain",
6 changes: 6 additions & 0 deletions cmd/faucet/main.go
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import (
"net/http"
"strings"

sdkmath "cosmossdk.io/math"
log "github.com/sirupsen/logrus"

"github.com/ignite/cli/ignite/pkg/chaincmd"
@@ -47,10 +48,15 @@ func main() {

faucetOptions := make([]cosmosfaucet.Option, len(coins))
for i, coin := range coins {
creditAmount := sdkmath.NewInt(int64(creditAmount))
maxCredit := sdkmath.NewInt(int64(maxCredit))

faucetOptions[i] = cosmosfaucet.Coin(creditAmount, maxCredit, coin)
}

faucetOptions = append(faucetOptions, cosmosfaucet.Account(keyName, keyMnemonic, coinType))
// it is fair to consider the first coin added because it is considered as the default coin during transfer requests.
faucetOptions = append(faucetOptions, cosmosfaucet.FeeAmount(sdkmath.NewInt(int64(feeAmount)), coins[0]))

faucet, err := cosmosfaucet.New(context.Background(), cr, faucetOptions...)
if err != nil {
24 changes: 13 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
module github.com/tendermint/faucet

go 1.21
go 1.21.1

toolchain go1.21.4

require (
github.com/ignite/cli v0.27.1
cosmossdk.io/math v1.0.1
github.com/ignite/cli v0.27.2-0.20231113174004-0691e0df824b
github.com/sirupsen/logrus v1.9.2
)

require (
cosmossdk.io/errors v1.0.0-beta.7 // indirect
cosmossdk.io/math v1.0.1 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
@@ -22,7 +24,7 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cometbft/cometbft v0.37.1 // indirect
github.com/cometbft/cometbft v0.37.2 // indirect
github.com/cometbft/cometbft-db v0.7.0 // indirect
github.com/confio/ics23/go v0.9.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
@@ -99,16 +101,16 @@ require (
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/ledger-go v0.14.1 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20230519143937-03e91628a987 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.55.0 // indirect
google.golang.org/grpc v1.56.3 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
66 changes: 48 additions & 18 deletions go.sum

Large diffs are not rendered by default.