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

refactor: upgrade ignite faucet dep #1

Merged
merged 6 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,21 @@ $ 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 | |
| cli-name | 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 | |
| legacy-send | LEGACY_SEND | whether to use legacy send command | false |
| 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 |
| 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

Expand Down
7 changes: 1 addition & 6 deletions cmd/faucet/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"flag"

"github.com/tendermint/starport/starport/pkg/cosmosfaucet"
"github.com/ignite/cli/ignite/pkg/cosmosfaucet"

"github.com/tendermint/faucet/internal/environ"
)
Expand All @@ -24,7 +24,6 @@ var (
creditAmount uint64
maxCredit uint64
nodeAddress string
legacySendCmd bool
coinType string
home string
)
Expand Down Expand Up @@ -75,10 +74,6 @@ func init() {
environ.GetString("NODE", ""),
"address of tendermint RPC endpoint for this chain",
)
flag.BoolVar(&legacySendCmd, "legacy-send",
environ.GetBool("LEGACY_SEND", false),
"whether to use legacy send command",
)
flag.StringVar(&coinType, "coin-type",
environ.GetString("COIN_TYPE", "118"),
"registered coin type number for HD derivation (BIP-0044), defaults from (satoshilabs/SLIP-0044)",
Expand Down
37 changes: 7 additions & 30 deletions cmd/faucet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (

log "github.com/sirupsen/logrus"

"github.com/tendermint/starport/starport/pkg/chaincmd"
chaincmdrunner "github.com/tendermint/starport/starport/pkg/chaincmd/runner"
"github.com/tendermint/starport/starport/pkg/cosmosfaucet"
"github.com/tendermint/starport/starport/pkg/cosmosver"
"github.com/ignite/cli/ignite/pkg/chaincmd"
chaincmdrunner "github.com/ignite/cli/ignite/pkg/chaincmd/runner"
"github.com/ignite/cli/ignite/pkg/cosmosfaucet"
"github.com/ignite/cli/ignite/pkg/cosmosver"
)

func main() {
Expand All @@ -34,32 +34,9 @@ func main() {
ccoptions = append(ccoptions, chaincmd.WithHome(home))
}

if legacySendCmd {
ccoptions = append(ccoptions, chaincmd.WithLegacySendCommand())
}

switch sdkVersion {
case "stargate-44":
ccoptions = append(ccoptions,
chaincmd.WithVersion(cosmosver.StargateFortyFourVersion),
)
case "stargate-40":
ccoptions = append(ccoptions,
chaincmd.WithVersion(cosmosver.StargateFortyVersion),
)
case "launchpad":
ccoptions = append(ccoptions,
chaincmd.WithVersion(cosmosver.MaxLaunchpadVersion),
chaincmd.WithLaunchpadCLI(appCli),
)
if home != "" {
ccoptions = append(ccoptions, chaincmd.WithLaunchpadCLIHome(home))
}
default:
ccoptions = append(ccoptions,
chaincmd.WithVersion(cosmosver.Latest),
)
}
ccoptions = append(ccoptions,
chaincmd.WithVersion(cosmosver.Latest),
)

cr, err := chaincmdrunner.New(context.Background(), chaincmd.New(appCli, ccoptions...))
if err != nil {
Expand Down
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
module github.com/tendermint/faucet

go 1.16
go 1.21

require (
github.com/sirupsen/logrus v1.8.1
github.com/tendermint/starport v0.19.5
github.com/ignite/cli v0.27.1
github.com/sirupsen/logrus v1.9.2
)

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
Loading