Skip to content

Commit

Permalink
celotool: Add error details
Browse files Browse the repository at this point in the history
I just got `too many arguments, want at most 0` as and error and that was
not helpful enough to debug the issue.
  • Loading branch information
karlb committed Oct 4, 2024
1 parent fd593f2 commit 5115867
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/celotool/send-tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@ $ celotool send --rpc-url $RPC_URL --private-key $PRIVATE_KEY $TO $FEECURRENCY -

chainId, err := client.ChainID(context.Background())
if err != nil {
return err
return fmt.Errorf("Can't get chain-id: %w", err)
}

nonce, err := client.PendingNonceAt(context.Background(), crypto.PubkeyToAddress(privateKey.PublicKey))
if err != nil {
return err
return fmt.Errorf("Can't get pending nonce: %w", err)
}

feeCap, err := client.SuggestGasPriceForCurrency(context.Background(), &feeCurrencyAddress)
if err != nil {
return err
return fmt.Errorf("Can't suggest gas price: %w", err)
}

txdata := &types.CeloDynamicFeeTxV2{
Expand All @@ -126,12 +126,12 @@ $ celotool send --rpc-url $RPC_URL --private-key $PRIVATE_KEY $TO $FEECURRENCY -
signer := types.LatestSignerForChainID(chainId)
tx, err := types.SignNewTx(privateKey, signer, txdata)
if err != nil {
return err
return fmt.Errorf("Can't sign tx: %w", err)
}

err = client.SendTransaction(context.Background(), tx)
if err != nil {
return err
return fmt.Errorf("Can't send tx: %w", err)
}

fmt.Printf("tx sent: %s\n", tx.Hash().Hex())
Expand Down

0 comments on commit 5115867

Please sign in to comment.