Skip to content

Commit

Permalink
fix: make linters happy
Browse files Browse the repository at this point in the history
  • Loading branch information
amimart committed Aug 11, 2022
1 parent e76f813 commit 363dc8f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ linters:
- nakedret
- nestif
- nilerr
- nilnil
- noctx
- nolintlint
- prealloc
Expand Down
1 change: 1 addition & 0 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
var serverConfig server.Config

// NewStartCommand returns a CLI command to start the REST api allowing to send tokens.
// nolint: funlen
func NewStartCommand() *cobra.Command {
var addr string
var batchWindow time.Duration
Expand Down
12 changes: 6 additions & 6 deletions graph/schema.resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ import (
)

// Send is the resolver for the send field.
func (r *mutationResolver) Send(ctx context.Context, input model.SendInput) (*string, error) {
if err := r.CaptchaResolver.CheckRecaptcha(ctx, input.CaptchaToken); err != nil {
return nil, err
func (r *mutationResolver) Send(ctx context.Context, input model.SendInput) (void *string, err error) {
if err = r.CaptchaResolver.CheckRecaptcha(ctx, input.CaptchaToken); err != nil {
return
}

if err := r.Faucet.Send(input.ToAddress); err != nil {
if err = r.Faucet.Send(input.ToAddress); err != nil {
log.Err(err).Str("toAddress", input.ToAddress).Msg("Could not register send request")
return nil, err
return
}

log.Info().Str("toAddress", input.ToAddress).Msg("Register send request")
return nil, nil
return
}

// Configuration is the resolver for the configuration field.
Expand Down
16 changes: 11 additions & 5 deletions pkg/client/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,23 @@ func (f *Faucet) handleTriggerTx(trigger *TriggerTx) {

msgCount := f.pool.Size()
resp, err := f.pool.Submit(ctx)
if err != nil {
switch {
case err != nil:
log.Err(err).Int("msgCount", msgCount).Msg("❌ Could not submit transaction")
} else if resp != nil {
case resp != nil:
if resp.Code != 0 {
log.Warn().
Int("messageCount", msgCount).
Interface("tx", resp).
Msg("😞 Transaction submitted with non 0 code")

} else {
log.Info().
Int("messageCount", msgCount).
Str("txHash", resp.TxHash).
Uint32("txCode", resp.Code).
Msg("🚀 Successfully submit transaction")
}
} else {
default:
log.Info().Msg("😥 No message to submit")
}
}
Expand Down Expand Up @@ -177,7 +177,13 @@ func (f *Faucet) makeSendMsg(addr string) (types.Msg, error) {
), nil
}

func makeTxSubmitter(config pkg.Config, txConfig client.TxConfig, grpcConn *grpc.ClientConn, privKey crypto.PrivKey, addr types.AccAddress) TxSubmitter {
func makeTxSubmitter(
config pkg.Config,
txConfig client.TxConfig,
grpcConn *grpc.ClientConn,
privKey crypto.PrivKey,
addr types.AccAddress,
) TxSubmitter {
return func(ctx context.Context, msgs []types.Msg) (*types.TxResponse, error) {
txBuilder, err := cosmos.BuildUnsignedTx(config, txConfig, msgs)
if err != nil {
Expand Down

0 comments on commit 363dc8f

Please sign in to comment.